Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- ob_start();
- require_once("plantilla.php");
- checkLogin();
- $anyoagua = isset($_REQUEST["anyo"])? (int)$_REQUEST["anyo"] : 2017;
- displayForm($anyoagua);
- function displayForm($anyoagua) {
- mysql_connect(DB_DSN_GRID,DB_USER_GRID ,DB_PASS_GRID);
- mysql_select_db(DB_DB_GRID);
- include("../lib/inc/jqgrid_dist.php");
- global $anyoagua;
- $g = new jqgrid();
- //ID lectura
- $col = array();
- $col["title"] = "ID"; // caption of column
- $col["name"] = "la_id"; // grid column name, must be exactly same as returned column-name from sql (tablefield or field-alias)
- $col["width"] = "4";
- $col["editable"] = false;
- $col["export"]=false;
- $col["hidden"] = true;
- $col["editrules"] = array("edithidden"=>true);
- $cols[] = $col;
- //FECHA
- $col = array();
- $col["title"] = "FECHA"; // caption of column
- $col["name"] = "la_fecha"; // grid column name, must be exactly same as returned column-name from sql (tablefield or field-alias)
- $col["width"] = "9";
- $col["editable"] = true;
- $col["formatter"] = "date";
- $col["formatoptions"] = array("srcformat"=>'Y-m-d',"newformat"=>'d/m/Y');
- $cols[] = $col;
- //UDS c1
- $col = array();
- $col["title"] = "L.COLONIA1"; // caption of column
- $col["name"] = "la_uds_colonia1"; //grid column name, must be exactly same as returned column-name from sql (tablefield or field-alias)
- $col["width"] = "9";
- $col["editable"] = true;
- //$col["formatter"] = "number";
- $col["editoptions"] = array("size"=>12);
- //$col["formatoptions"] = array("thousandsSeparator" =>".");
- $col["align"] = "right";
- $col["editoptions"]["autocomplete"] = "false";
- $cols[] = $col;
- //CONSUMO c1
- $col = array();
- $col["title"] = ""; // caption of column
- $col["name"] = "la_consumo_colonia1"; //grid column name, must be exactly same as returned column-name from sql (tablefield or field-alias)
- $col["width"] = "9";
- $col["editable"] = false;
- //$col["formatter"] = "number";
- $col["editoptions"] = array("size"=>12);
- $col["formatoptions"] = array("thousandsSeparator" =>".");
- $col["align"] = "right";
- $col["summaryType"] = "sum"; // available grouping fx: sum, count, min, max, avg
- $col["summaryTpl"] = '<b>Total: {0}</b>'; // display html for summary row - work when "groupSummary" is set true. search below
- $cols[] = $col;
- /*
- $col["summaryType"] = function (val, name, record) {
- // val.totalCount += 1;
- // if (record[name]) {
- // val.checkedCount += 1;
- // val.max = true;
- // }
- // return val;
- return 3;
- }
- */
- //UDS c2
- $col = array();
- $col["title"] = "L.COLONIA2"; // caption of column
- $col["name"] = "la_uds_colonia2"; //grid column name, must be exactly same as returned column-name from sql (tablefield or field-alias)
- $col["width"] = "9";
- $col["editable"] = true;
- //$col["formatter"] = "number";
- $col["editoptions"] = array("size"=>12);
- $col["formatoptions"] = array("thousandsSeparator" =>".");
- $col["align"] = "right";
- $col["editoptions"]["autocomplete"] = "false";
- $cols[] = $col;
- //CONSUMO c2
- $col = array();
- $col["title"] = ""; // caption of column
- $col["name"] = "la_consumo_colonia2"; //grid column name, must be exactly same as returned column-name from sql (tablefield or field-alias)
- $col["width"] = "9";
- $col["editable"] = false;
- //$col["formatter"] = "number";
- $col["editoptions"] = array("size"=>12);
- $col["formatoptions"] = array("thousandsSeparator" =>".");
- $col["align"] = "right";
- $col["summaryType"] = "sum"; // available grouping fx: sum, count, min, max, avg
- $col["summaryTpl"] = '<b>Total: {0}</b>'; // display html for summary row - work when "groupSummary" is set true. search below
- $cols[] = $col;
- //UDS MIRALLES
- $col = array();
- $col["title"] = "L.MIRALLES"; // caption of column
- $col["name"] = "la_uds_miralles"; //grid column name, must be exactly same as returned column-name from sql (tablefield or field-alias)
- $col["width"] = "9";
- $col["editable"] = true;
- //$col["formatter"] = "number";
- $col["editoptions"] = array("size"=>12);
- $col["formatoptions"] = array("thousandsSeparator" =>".");
- $col["align"] = "right";
- $col["editoptions"]["autocomplete"] = "false";
- $cols[] = $col;
- //CONSUMO MIRALLES
- $col = array();
- $col["title"] = ""; // caption of column
- $col["name"] = "la_consumo_miralles"; //grid column name, must be exactly same as returned column-name from sql (tablefield or field-alias)
- $col["width"] = "9";
- $col["editable"] = false;
- //$col["formatter"] = "number";
- $col["editoptions"] = array("size"=>12);
- $col["formatoptions"] = array("thousandsSeparator" =>".");
- $col["align"] = "right";
- $col["summaryType"] = "sum"; // available grouping fx: sum, count, min, max, avg
- $col["summaryTpl"] = '<b>Total: {0}</b>'; // display html for summary row - work when "groupSummary" is set true. search below
- $cols[] = $col;
- //UDS BORDILS
- $col = array();
- $col["title"] = "L.BORDILS"; // caption of column
- $col["name"] = "la_uds_bordils"; //grid column name, must be exactly same as returned column-name from sql (tablefield or field-alias)
- $col["width"] = "9";
- $col["editable"] = true;
- //$col["formatter"] = "number";
- $col["editoptions"] = array("size"=>12);
- $col["formatoptions"] = array("thousandsSeparator" =>".");
- $col["align"] = "right";
- $col["editoptions"]["autocomplete"] = "false";
- $cols[] = $col;
- //CONSUMO BORDILS
- $col = array();
- $col["title"] = ""; // caption of column
- $col["name"] = "la_consumo_bordils"; //grid column name, must be exactly same as returned column-name from sql (tablefield or field-alias)
- $col["width"] = "9";
- $col["editable"] = false;
- //$col["formatter"] = "number";
- $col["editoptions"] = array("size"=>12);
- $col["formatoptions"] = array("thousandsSeparator" =>".");
- $col["align"] = "right";
- $col["summaryType"] = "sum"; // available grouping fx: sum, count, min, max, avg
- $col["summaryTpl"] = '<b>Total: {0}</b>'; // display html for summary row - work when "groupSummary" is set true. search below
- $cols[] = $col;
- //UDS RUBIO
- $col = array();
- $col["title"] = "L.RUBIO"; // caption of column
- $col["name"] = "la_uds_rubio"; //grid column name, must be exactly same as returned column-name from sql (tablefield or field-alias)
- $col["width"] = "9";
- $col["editable"] = true;
- //$col["formatter"] = "number";
- $col["editoptions"] = array("size"=>12);
- $col["formatoptions"] = array("thousandsSeparator" =>".");
- $col["align"] = "right";
- $col["editoptions"]["autocomplete"] = "false";
- $cols[] = $col;
- //CONSUMO RUBIO
- $col = array();
- $col["title"] = ""; // caption of column
- $col["name"] = "la_consumo_rubio"; //grid column name, must be exactly same as returned column-name from sql (tablefield or field-alias)
- $col["width"] = "9";
- $col["editable"] = false;
- //$col["formatter"] = "number";
- $col["editoptions"] = array("size"=>12);
- $col["formatoptions"] = array("thousandsSeparator" =>".");
- $col["align"] = "right";
- $col["summaryType"] = "sum"; // available grouping fx: sum, count, min, max, avg
- $col["summaryTpl"] = '<b>Total: {0}</b>'; // display html for summary row - work when "groupSummary" is set true. search below
- $cols[] = $col;
- //UDS BAGU
- $col = array();
- $col["title"] = "L.BAGU"; // caption of column
- $col["name"] = "la_uds_bagu"; //grid column name, must be exactly same as returned column-name from sql (tablefield or field-alias)
- $col["width"] = "9";
- $col["editable"] = true;
- //$col["formatter"] = "number";
- $col["editoptions"] = array("size"=>12);
- $col["formatoptions"] = array("thousandsSeparator" =>".");
- $col["align"] = "right";
- $col["editoptions"]["autocomplete"] = "false";
- $cols[] = $col;
- //CONSUMO BAGU
- $col = array();
- $col["title"] = ""; // caption of column
- $col["name"] = "la_consumo_bagu"; //grid column name, must be exactly same as returned column-name from sql (tablefield or field-alias)
- $col["width"] = "9";
- $col["editable"] = false;
- //$col["formatter"] = "number";
- $col["editoptions"] = array("size"=>12);
- $col["formatoptions"] = array("thousandsSeparator" =>".");
- $col["align"] = "right";
- $col["summaryType"] = "sum"; // available grouping fx: sum, count, min, max, avg
- $col["summaryTpl"] = '<b>Total: {0}</b>'; // display html for summary row - work when "groupSummary" is set true. search below
- $cols[] = $col;
- //UDS APARICI
- $col = array();
- $col["title"] = "L.APARICI"; // caption of column
- $col["name"] = "la_uds_aparici"; //grid column name, must be exactly same as returned column-name from sql (tablefield or field-alias)
- $col["width"] = "9";
- $col["editable"] = true;
- //$col["formatter"] = "number";
- $col["editoptions"] = array("size"=>12);
- $col["formatoptions"] = array("thousandsSeparator" =>".");
- $col["align"] = "right";
- $col["editoptions"]["autocomplete"] = "false";
- $cols[] = $col;
- //CONSUMO APARICI
- $col = array();
- $col["title"] = ""; // caption of column
- $col["name"] = "la_consumo_aparici"; //grid column name, must be exactly same as returned column-name from sql (tablefield or field-alias)
- $col["width"] = "9";
- $col["editable"] = false;
- //$col["formatter"] = "number";
- $col["editoptions"] = array("size"=>12);
- $col["formatoptions"] = array("thousandsSeparator" =>".");
- $col["align"] = "right";
- $col["summaryType"] = "sum"; // available grouping fx: sum, count, min, max, avg
- $col["summaryTpl"] = '<b>Total: {0}</b>'; // display html for summary row - work when "groupSummary" is set true. search below
- $cols[] = $col;
- //UDS TOTAL
- $col = array();
- $col["title"] = "L.TOTAL"; // caption of column
- $col["name"] = "la_uds_total"; //grid column name, must be exactly same as returned column-name from sql (tablefield or field-alias)
- $col["width"] = "9";
- $col["editable"] = true;
- //$col["formatter"] = "number";
- $col["editoptions"] = array("size"=>12);
- $col["formatoptions"] = array("thousandsSeparator" =>".");
- $col["align"] = "right";
- $col["editoptions"]["autocomplete"] = "false";
- $cols[] = $col;
- //CONSUMO TOTAL
- $col = array();
- $col["title"] = ""; // caption of column
- $col["name"] = "la_consumo_total"; //grid column name, must be exactly same as returned column-name from sql (tablefield or field-alias)
- $col["width"] = "9";
- $col["editable"] = false;
- //$col["formatter"] = "number";
- $col["editoptions"] = array("size"=>12);
- $col["formatoptions"] = array("thousandsSeparator" =>".");
- $col["align"] = "right";
- $col["summaryType"] = "sum"; // available grouping fx: sum, count, min, max, avg
- $col["summaryTpl"] = '<b>Total: {0}</b>'; // display html for summary row - work when "groupSummary" is set true. search below
- $cols[] = $col;
- //UDS BALSA
- $col = array();
- $col["title"] = "L.BALSA"; // caption of column
- $col["name"] = "la_uds_balsa"; //grid column name, must be exactly same as returned column-name from sql (tablefield or field-alias)
- $col["width"] = "9";
- $col["editable"] = true;
- //$col["formatter"] = "number";
- $col["editoptions"] = array("size"=>12);
- $col["formatoptions"] = array("thousandsSeparator" =>".");
- $col["align"] = "right";
- $col["editoptions"]["autocomplete"] = "false";
- $cols[] = $col;
- //CONSUMO BALSA
- $col = array();
- $col["title"] = ""; // caption of column
- $col["name"] = "la_consumo_balsa"; //grid column name, must be exactly same as returned column-name from sql (tablefield or field-alias)
- $col["width"] = "9";
- $col["editable"] = false;
- //$col["formatter"] = "number";
- $col["editoptions"] = array("size"=>12);
- $col["formatoptions"] = array("thousandsSeparator" =>".");
- $col["align"] = "right";
- $col["summaryType"] = "sum"; // available grouping fx: sum, count, min, max, avg
- $col["summaryTpl"] = '<b>Total: {0}</b>'; // display html for summary row - work when "groupSummary" is set true. search below
- $cols[] = $col;
- //MESAÑO
- $col = array();
- $col["title"] = "MESAÑO"; // caption of column
- $col["name"] = "la_mes_anyo"; //grid column name, must be exactly same as returned column-name from sql (tablefield or field-alias)
- $col["width"] = "9";
- $col["editable"] = false;
- //$col["formatter"] = "";
- $col["editoptions"] = array("size"=>12);
- //$col["formatoptions"] = array("thousandsSeparator" =>".");
- $col["align"] = "right";
- $cols[] = $col;
- // set few params
- $grid["caption"] = "LECTURAS AGUA";
- $grid["altRows"]=true;
- $grid["altclass"]="myAltRowClass";
- $grid["autowidth"]=true;
- $grid["toolbar"] = "top";
- $grid["add_options"] = array('width'=>'680');
- $grid["edit_options"] = array('width'=>'680');
- $grid["add_options"] ["success_msg"] = "Registro añadido con éxito!";
- $grid["edit_options"] ["success_msg"] = "Registro actualizado con éxto!";
- $grid["delete_options"] ["success_msg"] = "Registro eliminado con éxito!";
- $grid["form"]["nav"] = true;
- $grid["sortname"] = 'la_fecha';
- $grid["sortorder"] = 'asc';
- $grid["footerrow"] = true; // Show footer row
- $grid["userDataOnFooter"] = true; // Fill footer row with userdata (with on_data_display event)
- $grid["grouping"] = true; //
- $grid["groupingView"]["groupField"] = array("la_mes_anyo"); // specify column name to group listing
- $grid["groupingView"]["groupColumnShow"] = array(false); // either show grouped column in list or not (default: true)
- $grid["groupingView"]["groupText"] = array("<b>{0}</b>"); // {0} is grouped value, {1} is count in group
- $grid["groupingView"]["groupOrder"] = array("asc"); // show group in asc or desc order
- $grid["groupingView"]["groupDataSorted"] = array(true); // show sorted data within group
- $grid["groupingView"]["groupSummary"] = array(true); // work with summaryType, summaryTpl, see column: $col["name"] = "total";
- $grid["groupingView"]["groupCollapse"] = false; // Turn true to show group collapse (default: false)
- $grid["groupingView"]["showSummaryOnHide"] = true; // show summary row even if group collapsed (hide)
- $grid["export"] = array("filename"=>"Lecturas Agua", "heading"=>"Lecturas Agua", "orientation"=>"landscape", "paper"=>"a4");
- $grid["export"]["range"] = "filtered";
- // for excel, sheet header
- $grid["export"]["sheetname"] = "Lecturas Agua";
- $grid["rowNum"]=500;
- $grid["rowList"]=array();
- $g->set_options($grid);
- $g->set_actions(array(
- "add"=>true, // allow/disallow add
- "edit"=>true, // allow/disallow edit
- "delete"=>true, // allow/disallow delete
- "clone"=>false, // allow/disallow clone
- "rowactions"=>false, // show/hide row wise edit/del/save option
- "autofilter" => true, // show/hide autofilter for search
- "export_excel"=>true, // export excel button
- "export_pdf"=>true, // export pdf button
- "export_csv"=>true, // export csv button
- "search" => "advance", // show single/multi field search condition (e.g. simple or advance)
- "showhidecolumns" => true
- )
- );
- //$g->select_command = "SELECT *,concat(convert(month(la_fecha),char),'-',convert(year(la_fecha),char)) as la_mes_anyo from lect_contadoresagua";
- $g->select_command = "SELECT *,concat(convert(year(la_fecha),char),'-',lpad(convert(month(la_fecha),char(2)),2,'0')) as la_mes_anyo from lect_contadoresagua where year(la_fecha)=" . $anyoagua;
- // set database table for CRUD operations
- $g->table = "lect_contadoresagua";
- // pass the cooked columns to grid
- $g->set_columns($cols);
- // group columns header
- $g->set_group_header( array(
- "useColSpanStyle"=>true,
- "groupHeaders"=>array(
- array(
- "startColumnName"=>'la_uds_colonia1', // group starts from this column
- "numberOfColumns"=>2, // group span to next 2 columns
- "titleText"=>'COLONIA1' // caption of group header
- ),
- array(
- "startColumnName"=>'la_uds_colonia2', // group starts from this column
- "numberOfColumns"=>2, // group span to next 2 columns
- "titleText"=>'COLONIA2' // caption of group header
- ),
- array(
- "startColumnName"=>'la_uds_miralles', // group starts from this column
- "numberOfColumns"=>2, // group span to next 2 columns
- "titleText"=>'MIRALLES' // caption of group header
- ),
- array(
- "startColumnName"=>'la_uds_bordils', // group starts from this column
- "numberOfColumns"=>2, // group span to next 2 columns
- "titleText"=>'BORDILS' // caption of group header
- ),
- array(
- "startColumnName"=>'la_uds_rubio', // group starts from this column
- "numberOfColumns"=>2, // group span to next 2 columns
- "titleText"=>'RUBIO' // caption of group header
- ),
- array(
- "startColumnName"=>'la_uds_bagu', // group starts from this column
- "numberOfColumns"=>2, // group span to next 2 columns
- "titleText"=>'BAGU' // caption of group header
- ),
- array(
- "startColumnName"=>'la_uds_aparici', // group starts from this column
- "numberOfColumns"=>2, // group span to next 2 columns
- "titleText"=>'APARICI' // caption of group header
- ),
- array(
- "startColumnName"=>'la_uds_total', // group starts from this column
- "numberOfColumns"=>2, // group span to next 2 columns
- "titleText"=>'TOTAL' // caption of group header
- ),
- array(
- "startColumnName"=>'la_uds_balsa', // group starts from this column
- "numberOfColumns"=>2, // group span to next 2 columns
- "titleText"=>'BALSA' // caption of group header
- )
- )
- )
- );
- $e["on_insert"] = array("add_lectura", null, false);
- $e["on_data_display"] = array("filter_display", null, true);
- $e["on_render_pdf"] = array("set_pdf_format", null);
- $g->set_events($e);
- function filter_display($data) //pre_render en http://www.phpgrid.org/demo/demos/appearance/footer-row.phps
- {
- // grand sum total and show in footer user data
- $totalc1 = 0;
- $totalc2 = 0;
- $totalmiralles=0;
- $totalbordils=0;
- $totalrubio=0;
- $totalbagu=0;
- $totalaparici=0;
- $totaltotal=0;
- $totalbalsa=0;
- foreach($data["params"] as $d)
- {
- $totalc1 += $d["la_consumo_colonia1"];
- $totalc2 += $d["la_consumo_colonia2"];
- $totalmiralles += $d["la_consumo_miralles"];
- $totalbordils += $d["la_consumo_bordils"];
- $totalrubio += $d["la_consumo_rubio"];
- $totalbagu += $d["la_consumo_bagu"];
- $totalaparici += $d["la_consumo_aparici"];
- $totaltotal += $d["la_consumo_total"];
- $totalbalsa += $d["la_consumo_balsa"];
- }
- //$data["params"]["userdata"] = array("la_consumo_colonia1"=>"Total: ".$total);
- $data["params"]["userdata"] = array("la_id"=>" ",
- "la_fecha"=>null,
- "la_uds_colonia1"=>$totalc1*21 . "€",
- "la_consumo_colonia1"=> $totalc1 ,
- "la_uds_colonia2"=>$totalc2*21 . "€",
- "la_consumo_colonia2"=>$totalc2 ,
- "la_uds_miralles"=>$totalmiralles*21 . "€",
- "la_consumo_miralles"=>$totalmiralles ,
- "la_uds_bordils"=>$totalbordils*21 . "€",
- "la_consumo_bordils"=>$totalbordils ,
- "la_uds_rubio"=>$totalrubio*21 . "€",
- "la_consumo_rubio"=>$totalrubio ,
- "la_uds_bagu"=>$totalbagu*21 . "€",
- "la_consumo_bagu"=>$totalbagu ,
- "la_uds_aparici"=>$totalaparici*21 . "€",
- "la_consumo_aparici"=>$totalaparici ,
- "la_uds_total"=>$totaltotal*21 . "€",
- "la_consumo_total"=>$totaltotal ,
- "la_uds_balsa"=>$totalbalsa*0.9 . "€",
- "la_consumo_balsa"=>$totalbalsa ,
- "la_mes_anyo"=>" ",
- "la_preciohragua"=>" ");
- }
- function add_lectura($data) {
- $idlectura = $data["params"]["la_id"];
- $fechalectura =$data["params"]["la_fecha"];
- $lecturaactualc1 =$data["params"]["la_uds_colonia1"];
- $lecturaactualc2 =$data["params"]["la_uds_colonia2"];
- $lecturaactualmiralles =$data["params"]["la_uds_miralles"];
- $lecturaactualbordils =$data["params"]["la_uds_bordils"];
- $lecturaactualrubio =$data["params"]["la_uds_rubio"];
- $lecturaactualbagu =$data["params"]["la_uds_bagu"];
- $lecturaactualaparici =$data["params"]["la_uds_aparici"];
- $lecturaactualtotal =$data["params"]["la_uds_total"];
- $lecturaactualbalsa =$data["params"]["la_uds_balsa"];
- $row = mysql_fetch_row(mysql_query("select la_fecha,la_uds_colonia1 from lect_contadoresagua where la_fecha<'{$fechalectura}' and la_uds_colonia1<>0 order by la_fecha DESC limit 1"));
- $lecturaanterior = $row[1];
- $consumoactualc1 = $lecturaactualc1-$lecturaanterior;
- $row = mysql_fetch_row(mysql_query("select la_fecha,la_uds_colonia2 from lect_contadoresagua where la_fecha<'{$fechalectura}' and la_uds_colonia2<>0 order by la_fecha DESC limit 1"));
- $lecturaanterior = $row[1];
- $consumoactualc2 = $lecturaactualc2-$lecturaanterior;
- $row = mysql_fetch_row(mysql_query("select la_fecha,la_uds_miralles from lect_contadoresagua where la_fecha<'{$fechalectura}' and la_uds_miralles<>0 order by la_fecha DESC limit 1"));
- $lecturaanterior = $row[1];
- $consumoactualmiralles = $lecturaactualmiralles-$lecturaanterior;
- $row = mysql_fetch_row(mysql_query("select la_fecha,la_uds_bordils from lect_contadoresagua where la_fecha<'{$fechalectura}' and la_uds_bordils<>0 order by la_fecha DESC limit 1"));
- $lecturaanterior = $row[1];
- $consumoactualbordils = $lecturaactualbordils-$lecturaanterior;
- $row = mysql_fetch_row(mysql_query("select la_fecha,la_uds_rubio from lect_contadoresagua where la_fecha<'{$fechalectura}' and la_uds_rubio<>0 order by la_fecha DESC limit 1"));
- $lecturaanterior = $row[1];
- $consumoactualrubio = $lecturaactualrubio-$lecturaanterior;
- $row = mysql_fetch_row(mysql_query("select la_fecha,la_uds_bagu from lect_contadoresagua where la_fecha<'{$fechalectura}' and la_uds_bagu<>0 order by la_fecha DESC limit 1"));
- $lecturaanterior = $row[1];
- $consumoactualbagu = $lecturaactualbagu-$lecturaanterior;
- $row = mysql_fetch_row(mysql_query("select la_fecha,la_uds_aparici from lect_contadoresagua where la_fecha<'{$fechalectura}' and la_uds_aparici<>0 order by la_fecha DESC limit 1"));
- $lecturaanterior = $row[1];
- $consumoactualaparici = $lecturaactualaparici-$lecturaanterior;
- $row = mysql_fetch_row(mysql_query("select la_fecha,la_uds_total from lect_contadoresagua where la_fecha<'{$fechalectura}' and la_uds_total<>0 order by la_fecha DESC limit 1"));
- $lecturaanterior = $row[1];
- $consumoactualtotal = $lecturaactualtotal-$lecturaanterior;
- $row = mysql_fetch_row(mysql_query("select la_fecha,la_uds_balsa from lect_contadoresagua where la_fecha<'{$fechalectura}' and la_uds_balsa<>0 order by la_fecha DESC limit 1"));
- $lecturaanterior = $row[1];
- $consumoactualbalsa = $lecturaactualbalsa-$lecturaanterior;
- mysql_query("insert into lect_contadoresagua(la_fecha,la_uds_colonia1,la_consumo_colonia1,la_uds_colonia2,la_consumo_colonia2,la_uds_miralles, la_consumo_miralles, la_uds_bordils, la_consumo_bordils,
- la_uds_rubio, la_consumo_rubio, la_uds_bagu, la_consumo_bagu, la_uds_aparici, la_consumo_aparici, la_uds_total, la_consumo_total, la_uds_balsa, la_consumo_balsa, la_preciohragua)
- values('{$fechalectura}','{$lecturaactualc1}','{$consumoactualc1}','{$lecturaactualc2}','{$consumoactualc2}','{$lecturaactualmiralles}','{$consumoactualmiralles}',
- '{$lecturaactualbordils}','{$consumoactualbordils}','{$lecturaactualrubio}','{$consumoactualrubio}','{$lecturaactualbagu}','{$consumoactualbagu}','{$lecturaactualaparici}','{$consumoactualaparici}',
- '{$lecturaactualtotal}','{$consumoactualtotal}','{$lecturaactualbalsa}','{$consumoactualbalsa}','{$_SESSION["DATOSCONFIGURACION"]->getValue("c_preciohragua")}')");
- }
- function set_pdf_format($arr) // render_pdf en http://www.phpgrid.org/demo/demos/appearance/footer-row.phps
- {
- $pdf = $arr["pdf"];
- $data = $arr["data"];
- $pdf->SetFont('courier', '', 8);
- $pdf->SetLineWidth(0.005);
- $amples = array(19,19,8,19,8,19,8,18,8,15,8,17,8,18,8,16,9,15,9,15);
- $pdf->SetCellWidths($amples);
- $alineament = array('L','R','L','R','L','R','L','R','L','R','L','R','L','R','L','R','L','R','L','L');
- $pdf->SetCellAlignment($alineament);
- $pdf->SetHeaderCellsFillColor(225,225,225);
- }
- // render grid and get html/js output
- $out = $g->render("list1");
- fnAsignarEncabezado("LECTURAS AGUA"); //carga encabezado
- fnMenuPrincipal();
- php echo $out;
- fnCerrarPaginaSinCalendario(); //cierra el contenido, el body y el html
- }
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement