コード例 #1
0
ファイル: SOA2-1Aug2003.php プロジェクト: armic/erpts
 function Main()
 {
     $RPTOPDetails = new SoapObject(NCCBIZ . "RPTOPDetails.php", "urn:Object");
     if (!($xmlStr = $RPTOPDetails->getRPTOP($this->formArray["rptopID"]))) {
         exit("xml failed");
     } else {
         //echo $xmlStr;
         if (!($domDoc = domxml_open_mem($xmlStr))) {
             $this->tpl->set_block("rptsTemplate", "OwnerListTable", "OwnerListTableBlock");
             $this->tpl->set_var("OwnerListTableBlock", "error xmlDoc");
         } else {
             $rptop = new RPTOP();
             $rptop->parseDomDocument($domDoc);
             foreach ($rptop as $key => $value) {
                 switch ($key) {
                     case "owner":
                         //$RPTOPEncode = new SoapObject(NCCBIZ."RPTOPEncode.php", "urn:Object");
                         if (is_a($value, "Owner")) {
                             $this->formArray["ownerID"] = $rptop->owner->getOwnerID();
                             $xmlStr = $rptop->owner->domDocument->dump_mem(true);
                             if (!$xmlStr) {
                                 $this->tpl->set_block("rptsTemplate", "OwnerListTable", "OwnerListTableBlock");
                                 $this->tpl->set_var("OwnerListTableBlock", "");
                             } else {
                                 if (!($domDoc = domxml_open_mem($xmlStr))) {
                                     $this->tpl->set_block("rptsTemplate", "OwnerListTable", "OwnerListTableBlock");
                                     $this->tpl->set_var("OwnerListTableBlock", "error xmlDoc");
                                 } else {
                                     $this->displayOwnerList($domDoc);
                                 }
                             }
                         } else {
                             $this->tpl->set_block("rptsTemplate", "PersonList", "PersonListBlock");
                             $this->tpl->set_var("PersonListBlock", "");
                             $this->tpl->set_block("rptsTemplate", "CompanyList", "CompanyListBlock");
                             $this->tpl->set_var("CompanyListBlock", "");
                         }
                         break;
                     case "cityAssessor":
                         if (is_a($value, Assessor)) {
                             $this->tpl->set_var("cityAssessorID", $value->getAssessorID());
                             $this->tpl->set_var("cityAssessorName", $value->getFullName());
                             $this->formArray["cityAssessorName"] = $value->getFullName();
                         } else {
                             $this->tpl->set_var($key, "");
                         }
                         break;
                     case "cityTreasurer":
                         if (is_a($value, Assessor)) {
                             $this->tpl->set_var("cityTreasurerID", $value->getAssessorID());
                             $this->tpl->set_var("cityTreasurerName", $value->getFullName());
                             $this->formArray["cityTreasurerName"] = $value->getFullName();
                         } else {
                             $this->tpl->set_var($key, "");
                         }
                         break;
                     case "tdArray":
                         $this->tpl->set_block("rptsTemplate", "defaultTDList", "defaultTDListBlock");
                         $this->tpl->set_block("rptsTemplate", "toggleTDList", "toggleTDListBlock");
                         $this->tpl->set_block("rptsTemplate", "TDList", "TDListBlock");
                         $tdCtr = 0;
                         $totalBalance = 0;
                         if (count($value)) {
                             $this->tpl->set_block("rptsTemplate", "TDDBEmpty", "TDDBEmptyBlock");
                             $this->tpl->set_var("TDDBEmptyBlock", "");
                             $this->tpl->set_block("TDList", "Land", "LandBlock");
                             $this->tpl->set_block("TDList", "PlantsTrees", "PlantsTreesBlock");
                             $this->tpl->set_block("TDList", "ImprovementsBuildings", "ImprovementsBuildingsBlock");
                             $this->tpl->set_block("TDList", "Machineries", "MachineriesBlock");
                             foreach ($value as $tkey => $tvalue) {
                                 $propertyType = $tvalue->getPropertyType();
                                 $propertyID = $tvalue->getPropertyID();
                                 switch ($propertyType) {
                                     case "Land":
                                         $land = new Land();
                                         $land->selectRecord($propertyID);
                                         $assessedValue = $land->getAssessedValue();
                                         $propertyIdentityNumber = $land->getPropertyIndexNumber();
                                         break;
                                     case "PlantsTrees":
                                         $plantsTrees = new PlantsTrees();
                                         $plantsTrees->selectRecord($propertyID);
                                         $assessedValue = $plantsTrees->getAssessedValue();
                                         $PropertyIndexNumber = $plantsTrees->getPropertyIndexNumber();
                                         break;
                                     case "ImprovementsBuildings":
                                         $improvementsBuildings = new ImprovementsBuildings();
                                         $improvementsBuildings->selectRecord($propertyID);
                                         $assessedValue = $improvementsBuildings->getAssessedValue();
                                         $PropertyIndexNumber = $improvementsBuildings->getPropertyIndexNumber();
                                         break;
                                     case "Machineries":
                                         $machineries = new Machineries();
                                         $machineries->selectRecord($propertyID);
                                         $assessedValue = $machineries->getAssessedValue();
                                         $PropertyIndexNumber = $machineries->getPropertyIndexNumber();
                                         break;
                                     default:
                                         break;
                                 }
                                 # set or get the due for this TD
                                 $taxDue = new Dues();
                                 $taxDue->create($tvalue->getTaxDeclarationNumber(), "Jan 1, " . $rptop->getRptopdate());
                                 $taxDue->setBasic($assessedValue);
                                 $taxDue->setSEF($assessedValue);
                                 $taxDue->store();
                                 $dueValues['basic'] = number_format($taxDue->getBasic(), 2);
                                 $dueValues['penalty'] = number_format($taxDue->getPenalty(), 2);
                                 $dueValues['sef'] = number_format($taxDue->getSEF(), 2);
                                 $dueValues['total'] = number_format($taxDue->getBasic() + $taxDue->getSEF() + $taxDue->getPenalty(), 2);
                                 $this->tpl->set_var($dueValues);
                                 $paidValues['paidBasic'] = number_format($taxDue->getPaidBasic(), 2);
                                 $paidValues['paidPenalty'] = number_format($taxDue->getPaidPenalty(), 2);
                                 $paidValues['paidSEF'] = number_format($taxDue->getPaidSEF(), 2);
                                 $paidValues['paidTotal'] = number_format($taxDue->getPaidBasic() + $taxDue->getPaidPenalty() + $taxDue->getPaidSEF(), 2);
                                 $this->tpl->set_var($paidValues);
                                 $balance = $taxDue->getBasic() + $taxDue->getSEF() + $taxDue->getPenalty() - ($taxDue->getPaidBasic() + $taxDue->getPaidPenalty() + $taxDue->getPaidSEF());
                                 $totalBalance += $balance;
                                 $this->tpl->set_var(balance, number_format($balance, 2));
                                 $totalValues['totAssessedValue'] += $assessedValue;
                                 $totalValues['totBasic'] += $taxDue->getBasic();
                                 $totalValues['totPenalty'] += $taxDue->getPenalty();
                                 $totalValues['totSEF'] += $taxDue->getSEF();
                                 $totalValues['totTotal'] += $taxDue->getBasic() + $taxDue->getPenalty() + $taxDue->getSEF();
                                 $totalValues['totPaidBasic'] += $taxDue->getPaidBasic();
                                 $totalValues['totPaidPenalty'] += $taxDue->getPaidPenalty();
                                 $totalValues['totPaidSEF'] += $taxDue->getPaidSEF();
                                 $totalValues['totPaidTotal'] += $taxDue->getPaidBasic() + $taxDue->getPaidPenalty() + $taxDue->getPaidSEF();
                                 $tdValues['assessedValue'] = number_format($assessedValue, 2);
                                 $tdValues['tdNumber'] = $tvalue->getTaxDeclarationNumber();
                                 $tdValues['propertyIndexNumber'] = $PropertyIndexNumber;
                                 $this->tpl->set_var($tdValues);
                                 $this->tpl->set_var("ctr", $tdCtr);
                                 $this->tpl->parse("TDListBlock", "TDList", true);
                                 $tdCtr++;
                             }
                         } else {
                             $this->tpl->set_var("TDListBlock", "");
                         }
                         $this->tpl->set_var("tdCtr", $tdCtr);
                         break;
                     default:
                         $this->formArray[$key] = $value;
                 }
             }
         }
     }
     $this->setForm();
     $this->tpl->set_var(totBalance, number_format($totalBalance, 2));
     $this->tpl->set_var(amountDue, number_format($totalValues['totTotal'] - $totalValues['totPaidTotal'], 2));
     $totalValues['totAssessedValue'] = number_format($totalValues['totAssessedValue'], 2);
     $totalValues['totBasic'] = number_format($totalValues['totBasic'], 2);
     $totalValues['totPenalty'] = number_format($totalValues['totPenalty'], 2);
     $totalValues['totSEF'] = number_format($totalValues['totSEF'], 2);
     $totalValues['totTotal'] = number_format($totalValues['totTotal'], 2);
     $totPaidalValues['totPaidBasic'] = number_format($totPaidalValues['totPaidBasic'], 2);
     $totPaidalValues['totPaidPenalty'] = number_format($totPaidalValues['totPaidPenalty'], 2);
     $totPaidalValues['totPaidSEF'] = number_format($totPaidalValues['totPaidSEF'], 2);
     $totPaidalValues['totPaidTotal'] = number_format($totPaidalValues['totPaidTotal'], 2);
     $this->tpl->set_var($totalValues);
     $this->tpl->set_var("Session", $this->sess->url("") . $this->sess->add_query(array("rptopID" => $this->formArray["rptopID"], "ownerID" => $this->formArray["ownerID"])));
     $this->tpl->parse("templatePage", "rptsTemplate");
     $this->tpl->finish("templatePage");
     $this->tpl->p("templatePage");
 }