Exemplo n.º 1
0
 function Main()
 {
     $this->tpl->set_var("uname", $this->user["uname"]);
     $this->tpl->set_var("today", date("F j, Y"));
     $this->setPageDetailPerms();
     $this->displayReceiptBasketList();
     // show owner
     $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);
             //print_r($rptop);
             if (is_object($rptop->owner)) {
                 //$RPTOPEncode = new SoapObject(NCCBIZ."RPTOPEncode.php", "urn:Object");
                 if (is_a($rptop->owner, "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", "");
                 }
             }
             // display Receipts
             $condition = "WHERE";
             foreach ($this->formArray["receiptIDArray"] as $receiptIDKey => $receiptID) {
                 if ($condition != "WHERE") {
                     $condition .= " OR ";
                 }
                 $condition .= " receiptID='" . $receiptID . "' ";
             }
             $ReceiptList = new SoapObject(NCCBIZ . "ReceiptList.php", "urn:Object");
             if (!($xmlStr = $ReceiptList->getReceiptList($condition))) {
                 // echo "xml failed";
                 // xml failed
             } else {
                 if (!($domDoc = domxml_open_mem($xmlStr))) {
                     // echo "error domDoc";
                     // error domDoc
                 } else {
                     $receiptRecords = new ReceiptRecords();
                     $receiptRecords->parseDomDocument($domDoc);
                     $receiptArrayList = $receiptRecords->getArrayList();
                     $this->tpl->set_block("rptsTemplate", "ReceiptList", "ReceiptListBlock");
                     foreach ($receiptArrayList as $receipt) {
                         $this->tpl->set_var("receiptID", $receipt->getReceiptID());
                         $this->tpl->set_var("receiptNumber", $receipt->getReceiptNumber());
                         $this->tpl->set_var("paymentMode", $receipt->getPaymentMode());
                         $this->tpl->set_var("amountPaid", formatCurrency($this->getTotalAmountPaid($receipt->getReceiptID())));
                         $this->tpl->parse("ReceiptListBlock", "ReceiptList", true);
                     }
                 }
             }
         }
     }
     $this->setForm();
     $this->tpl->set_var("Session", $this->sess->url(""));
     $this->tpl->parse("templatePage", "rptsTemplate");
     $this->tpl->finish("templatePage");
     $this->tpl->p("templatePage");
 }
Exemplo n.º 2
0
 function Main()
 {
     switch ($this->formArray["formAction"]) {
         case "search":
             $ReceiptList = new SoapObject(NCCBIZ . "ReceiptList.php", "urn:Object");
             if (!($xmlStr = $ReceiptList->searchReceipt($this->formArray["searchKey"]))) {
                 $this->tpl->set_block("rptsTemplate", "Found", "FoundBlock");
                 $this->tpl->set_var("FoundBlock", "");
                 $notFoundMessage = """ . $this->formArray["searchKey"] . "" not found";
                 $this->tpl->set_var("notFoundMessage", $notFoundMessage);
             } else {
                 if (!($domDoc = domxml_open_mem($xmlStr))) {
                     $this->tpl->set_block("rptsTemplate", "Table", "TableBlock");
                     $this->tpl->set_var("TableBlock", "error xmlDoc");
                     $notFoundMessage = """ . $this->formArray["searchKey"] . "" not found";
                     $this->tpl->set_var("notFoundMessage", $notFoundMessage);
                 } else {
                     $receiptRecords = new ReceiptRecords();
                     $receiptRecords->parseDomDocument($domDoc);
                     $list = $receiptRecords->getArrayList();
                     if (count($list)) {
                         $this->tpl->set_block("rptsTemplate", "ReceiptList", "ReceiptListBlock");
                         foreach ($list as $key => $value) {
                             $this->tpl->set_var("receiptID", $value->getReceiptID());
                             $this->tpl->set_var("receiptNumber", $value->getReceiptNumber());
                             $this->tpl->set_var("receiptDate", $value->getReceiptDate());
                             $receivedFromName = $this->getOwnerNames($value->getReceivedFrom());
                             $this->tpl->set_var("receivedFromName", $receivedFromName);
                             $this->tpl->parse("ReceiptListBlock", "ReceiptList", true);
                         }
                         $this->tpl->set_block("rptsTemplate", "NotFound", "NotFoundBlock");
                         $this->tpl->set_var("NotFoundBlock", "");
                     } else {
                         $this->tpl->set_block("rptsTemplate", "Found", "FoundBlock");
                         $this->tpl->set_var("FoundBlock", "");
                     }
                 }
             }
             break;
         case "cancel":
             $ReceiptList = new SoapObject(NCCBIZ . "ReceiptList.php", "urn:Object");
             if (is_array($this->formArray["receiptID"])) {
                 if (!($xmlStr = $ReceiptList->cancelReceiptList($this->formArray["receiptID"]))) {
                     $this->tpl->set_block("rptsTemplate", "Found", "FoundBlock");
                     $this->tpl->set_var("FoundBlock", "");
                     $notFoundMessage = "0 receipts cancelled";
                     $this->tpl->set_var("notFoundMessage", $notFoundMessage);
                 } else {
                     if (!($domDoc = domxml_open_mem($xmlStr))) {
                         $this->tpl->set_block("rptsTemplate", "Found", "FoundBlock");
                         $this->tpl->set_var("FoundBlock", "");
                         $notFoundMessage = "0 receipts cancelled";
                         $this->tpl->set_var("notFoundMessage", $notFoundMessage);
                     } else {
                         $receiptRecords = new ReceiptRecords();
                         $receiptRecords->parseDomDocument($domDoc);
                         $list = $receiptRecords->getArrayList();
                         if (count($list)) {
                             $this->formArray["listTitle"] = "Cancelled selected and associated Receipts";
                             $this->tpl->set_block("rptsTemplate", "ReceiptList", "ReceiptListBlock");
                             $this->tpl->set_block("ReceiptList", "HideCancelCheckbox", "HideCancelCheckboxBlock");
                             foreach ($list as $key => $value) {
                                 $this->tpl->set_var("receiptID", $this->strikeout($value->getReceiptID()));
                                 $this->tpl->set_var("receiptNumber", $this->strikeout($value->getReceiptNumber()));
                                 $this->tpl->set_var("receiptDate", $this->strikeout($value->getReceiptDate()));
                                 $receivedFromName = $this->getOwnerNames($value->getReceivedFrom());
                                 $this->tpl->set_var("receivedFromName", $this->strikeout($receivedFromName));
                                 $this->tpl->set_var("HideCancelCheckboxBlock", "");
                                 $this->tpl->parse("ReceiptListBlock", "ReceiptList", true);
                             }
                             $this->tpl->set_block("rptsTemplate", "HideCancelBtn", "HideCancelBtnBlock");
                             $this->tpl->set_var("HideCancelBtnBlock", "");
                             $this->tpl->set_block("rptsTemplate", "NotFound", "NotFoundBlock");
                             $this->tpl->set_var("NotFoundBlock", "");
                         } else {
                             $this->tpl->set_block("rptsTemplate", "Found", "FoundBlock");
                             $this->tpl->set_var("FoundBlock", "");
                             $notFoundMessage = "0 receipts cancelled";
                             $this->tpl->set_var("notFoundMessage", $notFoundMessage);
                         }
                     }
                 }
             }
             break;
         default:
             $this->tpl->set_block("rptsTemplate", "Table", "TableBlock");
             $this->tpl->set_var("TableBlock", "");
             $this->tpl->set_block("rptsTemplate", "NotFound", "NotFoundBlock");
             $this->tpl->set_var("NotFoundBlock", "");
     }
     $this->setForm();
     $this->tpl->set_var("uname", $this->user["uname"]);
     $this->tpl->set_var("today", date("F j, Y"));
     $this->tpl->set_var("Session", $this->sess->url(""));
     $this->tpl->parse("templatePage", "rptsTemplate");
     $this->tpl->finish("templatePage");
     $this->tpl->p("templatePage");
 }