Beispiel #1
0
 function Main()
 {
     $db = new DB_RPTS();
     //$this->formArray['month']= 10; 		//ex Month january
     //$this->formArray['year']= 2003; 		//ex Month january
     /*$sql = "SELECT  DISTINCT payments.dueID FROM payments INNER  JOIN dues ON payments.dueID = dues.dueID
     		WHERE MONTH( dues.dueDate )  =  '01'"; 		
     		*/
     $sql = "SELECT sum( amount ) as amount , YEAR(dues.dueDate) as yearDue, sum( payments.penalty ) as penalty , sum( discount ) as discount, \r\n\t\t\tcollectionDate FROM collections INNER JOIN collectionPayments ON collections.collectionID = collectionPayments.collectionID INNER JOIN payments \r\n\t\t\tON collectionPayments.paymentID = payments.paymentID INNER JOIN dues ON payments.dueID = dues.dueID where \r\n\t\t\tMONTH(collectionDate) = '" . $this->formArray['month'] . "' AND YEAR(collectionDate) = '" . $this->formArray['year'] . "'  GROUP BY ( collectionDate ) order by collectionDate desc;";
     $ypos = 460;
     $this->tpl->set_block("rptsTemplate", "ROW", "rBlk");
     $db->query($sql);
     if (count($db->num_rows()) > 0) {
         for ($i = 0; $db->next_record(); $i++) {
             if ($db->f("yearDue") == date("Y")) {
                 $this->tpl->set_var(currentYear, $db->f("amount"));
                 $this->tpl->set_var(prevYear, "0.00");
             } else {
                 $this->tpl->set_var(prevYear, $db->f("amount"));
                 $this->tpl->set_var(currentYear, "0.00");
             }
             $this->tpl->set_var($db->Record);
             $this->tpl->set_var(ypos, $ypos);
             $ypos = $ypos - 10;
             $this->tpl->parse("rBlk", "ROW", true);
         }
     }
     $this->tpl->parse("report", "rptsTemplate");
     $this->tpl->finish("report");
     //		$this->tpl->p("report");
     $rptrpdf = new PDFWriter();
     $rptrpdf->setOutputXML($this->tpl->get('report'), "string");
     $rptrpdf->writePDF("collectionReport2.pdf");
 }
Beispiel #2
0
 function checkTD($tdNum = 0, &$xmlNode)
 {
     printf("checkTD(): Starting<br>\n");
     // Get the TD Information
     $sqlSelectTD = "SELECT tdID, cancelsTDNumber, taxBeginsWithTheYear, ceasesWithTheYear\n\t\t                FROM TD\n\t\t                WHERE taxDeclarationNumber = '{$tdNum}'";
     printf("checkTD(): {$sqlSelectTD}<br>\n");
     $dbTD = new DB_RPTS($sqlSelectTD);
     if ($dbTD->next_record()) {
         $tdID = $dbTD->f("tdID");
         $cancelsTD = $dbTD->f("cancelsTDNumber");
         $taxBegins = $dbTD->f("taxBeginsWithTheYear");
         $taxEnds = $dbTD->f("ceasesWithTheYear");
         if ($taxEnds == 0) {
             // TD is current and has no ending
             $today = getdate();
             $taxEnds = $today['year'];
         }
         // check if the TD still has unpaid dues
         $unpaidSinceFirst = false;
         $sqlSelectDues = "SELECT Year(dueDate) as dueYear from dues\n\t\t\t\twhere tdID = '{$tdID}' and paidInFull = 0\n\t\t\t\torder by dueYear";
         printf("checkTD(): {$sqlSelectDues}<br>\n");
         $dbDues = new DB_RPTS($sqlSelectDues);
         if ($dbDues->num_rows() > 0) {
             // prepare a new node for this TD
             $node = $this->xmlSOA->create_element("TD");
             $node->set_attribute("Number", $tdNum);
             // attach node to xmlNode
             printf("checkTD(): Attaching a TDdues node<br>\n");
             $tdNode = $xmlNode->append_child($node);
         } else {
             printf("checkTD(): found no dues<br>\n");
         }
         // get each unpaid due
         while ($dbDues->next_record()) {
             $dueYear = $dbDues->f('dueYear');
             $due = new Dues($tdID, $dueYear);
             // attach to TD Node
             $dueNode = $this->xmlSOA->create_element("TaxDues");
             $dueNode->set_attribute("Year", $dueYear);
             $dueNode->set_attribute("Amount", $due->getTotalDue());
             if ($due->getPctPenalty() > 0.0) {
                 $dueNode->set_attribute("PenaltyPerCent", $due->getPctPenalty());
             }
             $newnode = $tdNode->append_child($dueNode);
             printf("checkTD(): Attaching a dues node<br>\n");
             if ($dueYear == $taxBegins) {
                 $unpaidSinceFirst = true;
             }
         }
         // if first year dues are unpaid
         // check cancelled TD
         if ($unpaidSinceFirst) {
             $this->checkTD($cancelsTD, $tdNode);
         }
     }
     printf("checkTD(): Done<br>\n");
 }
Beispiel #3
0
 function run($barangayID)
 {
     // get od list by barangay
     $this->formArray["progressLog"] = "gathering RPUs...";
     $db = new DB_RPTS();
     $sql = "SELECT " . OD_TABLE . ".odID as odID " . "FROM " . OD_TABLE . " " . "LEFT JOIN " . LOCATION_TABLE . " " . "ON " . OD_TABLE . ".odID = " . LOCATION_TABLE . ".odID " . "LEFT JOIN " . LOCATIONADDRESS_TABLE . " " . "ON " . LOCATION_TABLE . ".locationAddressID=" . LOCATIONADDRESS_TABLE . ".locationAddressID " . "LEFT JOIN " . BARANGAY_TABLE . " " . "ON " . BARANGAY_TABLE . ".barangayID=" . LOCATIONADDRESS_TABLE . ".barangayID " . "LEFT JOIN " . ODHISTORY_TABLE . " " . "ON " . OD_TABLE . ".odID = " . ODHISTORY_TABLE . ".previousODID " . "WHERE " . BARANGAY_TABLE . ".barangayID='" . fixQuotes($barangayID) . "' " . "AND " . ODHISTORY_TABLE . ".previousODID IS NULL " . "AND ((" . OD_TABLE . ".transactionCode='GR' AND " . OD_TABLE . ".dateCreated <= " . fixQuotes($this->formArray["countBackDaysTimeStr"]) . ") " . "OR (" . OD_TABLE . ".transactionCode!='GR'))";
     $db->query($sql);
     $this->formArray["totalCreated"] = 0;
     $ctr = 0;
     $this->formArray["progressLog"] = "RPUs gathered...";
     $total = $db->nf();
     while ($db->next_record()) {
         $ctr++;
         // NCC Modification checked and implemented by K2 : November 17, 2005
         // details:
         //		commented out link 659 that uses $this->RunGeneralRevision();
         //		added line 660 that uses $this->RunGeneralRevisionBrgy();
         //$newODID = $this->RunGeneralRevision($db->f("odID"),$this->userID,"GR");
         $newODID = $this->RunGeneralRevisionBrgy($db->f("odID"), $this->userID, "GR");
         if ($newODID == "" || $newODID == false || is_numeric($newODID) == false) {
             // skipped
             $this->formArray["progressLog"] = "[" . $ctr . "/" . $total . "]...[skipped odID:" . $db->f("odID") . "]" . "\n" . $this->formArray["progressLog"];
         } else {
             // ran
             $this->formArray["progressLog"] = "[" . $ctr . "/" . $total . "]...[archived odID:" . $db->f("odID") . " | created odID:" . $newODID . "]" . "\n" . $this->formArray["progressLog"];
             $this->formArray["totalCreated"]++;
         }
     }
     $this->formArray["totalArchived"] = $db->num_rows();
 }
<?

 Header('Content-Type: image/png');
 include_once("web/prepend.php");
 include_once('web/panachart.php');
 
 $tpl=new rpts_Template();
 $tpl->set_file(array(report=>"Form.htm"));

 $db = new DB_RPTS;//DB_SelectLGU("erpts-test");
// $tmpdb = 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){
 
 if($brgyID==0){
 
$sql = "SELECT SUM( Collection.amountPaid )  AS amountPaid, Payment.paymentID AS paymentID, TD.tdID, ".ucwords($classification)."ActualUses.code as description
		FROM Collection
		INNER  JOIN Payment ON Payment.paymentID = Collection.paymentID
		INNER  JOIN TD