$this->user = $auth->auth; $tpl->set_var("uname", $this->user["uname"]); $tpl->set_var("today", date("F j, Y")); // must have atleast TM-VIEW access $pageType = "%%%%1%%%%%"; if (!checkPerms($this->user["userType"], $pageType)) { header("Location: Unauthorized.php" . $this->sess->url("")); exit; } $tpl->set_block(report, LGUBLK, lguBlk); $db = new DB_RPTS(); $sql = "select * from MunicipalityCity order by description;"; $db->query($sql); for ($i = 0; $db->next_record(); $i++) { $tpl->set_var($db->Record); $tpl->parse(lguBlk, LGUBLK, true); } if ($municipalityCityID) { $tpl->set_var("selected_municipalityCityID_" . $municipalityCityID, "selected"); } else { $tpl->set_var("selected_municipalityCityID_" . $municipalityCityID, ""); } if ($startMM) { $tpl->set_var("selected_startMM_" . $startMM, "selected"); } else { $tpl->set_var("selected_startMM_" . startMM, ""); } if ($endMM) { $tpl->set_var("selected_endMM_" . $endMM, "selected"); } else { $tpl->set_var("selected_endMM_" . $endMM, "");
<? include_once("web/prepend.php"); include_once('web/panachart.php'); $tpl=new rpts_Template(); $tpl->set_file(array(report=>"Form.htm")); $db = new DB_SelectLGU("erpts-test"); $db->query("SELECT * FROM Barangay ORDER BY description"); $tpl->set_block(report,BRGY,bBlk); if($db->num_rows()>0){ for($r=0;$db->next_record();$r++){ $tpl->set_var(barangayID,$db->f("barangayID")); $tpl->set_var(barangayName,$db->f("description")); $tpl->parse(bBlk,BRGY,true); } } $tpl->set_var(fileName,$PHP_SELF); if($isSubmit){ $db = new DB_SelectLGU("erpts-test"); if($brgyID==0) $sql ="SELECT ".ucwords($classification)."ActualUses.code as description, sum( ".ucwords($classification).".marketValue ) as total FROM AFS INNER JOIN ".ucwords($classification)." USING ( afsID ) INNER JOIN ".ucwords($classification)."ActualUses ON ".ucwords($classification).".actualUse = ".ucwords($classification)."ActualUses.".$classification."ActualUsesID GROUP BY ( ".$classification."ActualUsesID )";
//echo ceil(count($buffer)/$rowPerPage)."<br>"; $tpl->set_block(report, PAGE, pageBlk); $tpl->set_block(PAGE, ROW, rowBlk); $tpl->set_block(PAGE, ROW1, row1Blk); $pages = ceil(count($buffer) / $rowPerPage); $tpl->set_var("pages", $pages * 2); for ($h = 1; $h <= $pages; $h++) { $tpl->set_var("sheet1", ($h - 1) * 2 + 1); $tpl->set_var("sheet2", ($h - 1) * 2 + 2); for ($i = $iStart; $i < count($buffer) && floor($i / $h) < $rowPerPage; $i++) { $ypos = $ypos - 18; $ypos1 = $ypos1 - 18; $tpl->set_var($buffer[$i]); $tpl->set_var(ypos, $ypos); $tpl->set_var(ypos1, $ypos1); $tpl->parse(rowBlk, ROW, true); } $iStart = $i; #echo("row=".$i."<br>"); for ($j = $jStart; $j < count($buffer) && floor($j / $h) < $rowPerPage; $j++) { $yposx = $yposx - 18; $yposx1 = $yposx1 - 18; $tpl->set_var($buffer[$j]); $tpl->set_var(ypos, $yposx); $tpl->set_var(ypos1, $yposx1); $tpl->parse(row1Blk, ROW1, true); } $jStart = $j; #echo("row1=".$i."<br>"); $tpl->parse(pageBlk, PAGE, true); $tpl->set_var(rowBlk, "");