Example #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");
 }
Example #2
0
 function Main()
 {
     switch ($this->formArray["formAction"]) {
         case "search":
             $this->tpl->set_var("msg", "");
             $receiptRecords = new ReceiptRecords();
             $this->tpl->set_block("rptsTemplate", "Pages", "PagesBlock");
             $this->tpl->set_block("rptsTemplate", "PagesList", "PagesListBlock");
             $condition = $this->filterCancelled();
             $fields = array("receiptNumber", "checkNumber", "draweeBank");
             $count = $receiptRecords->countSearchRecords($this->formArray["searchKey"], $fields);
             if ($count == 0 || $count == false) {
                 $this->tpl->set_var("PagesBlock", "");
                 $this->tpl->set_var("PagesListBlock", "");
                 $numOfPages = 1;
                 $this->tpl->set_block("rptsTemplate", "PageNavigator", "PagesBlock");
                 $this->tpl->set_var("PageNavigatorBlock", "");
             } else {
                 $numOfPages = ceil($count / PAGE_BY);
                 // page list nav
                 $this->formArray["pageLinksInLine"] = 7;
                 if ($this->formArray["page"] < round($this->formArray["pageLinksInLine"] / 2)) {
                     $startPageLinks = 1;
                 } else {
                     $startPageLinks = $this->formArray["page"] - round($this->formArray["pageLinksInLine"] / 2);
                     if ($startPageLinks < 1) {
                         $startPageLinks = 1;
                     }
                 }
                 $endPageLinks = $startPageLinks + ($this->formArray["pageLinksInLine"] - 1);
                 if ($endPageLinks > $numOfPages) {
                     $endPageLinks = $numOfPages;
                 }
                 for ($i = $startPageLinks; $i <= $endPageLinks; $i++) {
                     if ($i == $this->formArray["page"]) {
                         $this->tpl->set_var("pageListPages", "");
                         $this->tpl->set_var("pageListPagesUrl", "");
                         $this->tpl->set_var("pageListPaged", $i);
                     } else {
                         $this->tpl->set_var("pageListPages", $i);
                         $this->tpl->set_var("pageListPagesUrl", $i . "&formAction=search&searchKey=" . urlencode($this->formArray["searchKey"]));
                         $this->tpl->set_var("pageListPaged", "");
                     }
                     $this->tpl->parse("PagesListBlock", "PagesList", true);
                 }
                 // drop down nav
                 for ($i = 1; $i <= $numOfPages; $i++) {
                     if ($i == $this->formArray["page"]) {
                         $this->tpl->set_var("pages", $i);
                         $this->tpl->set_var("pagesUrl", $i . "&formAction=search&searchKey=" . urlencode($this->formArray["searchKey"]));
                         $this->tpl->set_var("paged", "selected");
                     } else {
                         $this->tpl->set_var("pages", $i);
                         $this->tpl->set_var("pagesUrl", $i . "&formAction=search&searchKey=" . urlencode($this->formArray["searchKey"]));
                         $this->tpl->set_var("paged", "");
                     }
                     $this->tpl->parse("PagesBlock", "Pages", true);
                 }
             }
             if ($numOfPages == $this->formArray["page"]) {
                 $this->tpl->set_var("nextTxt", "");
             } else {
                 $this->tpl->set_var("next", $this->formArray["page"] + 1 . "&formAction=search&searchKey=" . urlencode($this->formArray["searchKey"]));
                 $this->tpl->set_var("nextTxt", "next");
             }
             if ($this->formArray["page"] == 1) {
                 $this->tpl->set_var("previousTxt", "");
             } else {
                 $this->tpl->set_var("previous", $this->formArray["page"] - 1 . "&formAction=search&searchKey=" . urlencode($this->formArray["searchKey"]));
                 $this->tpl->set_var("previousTxt", "previous");
             }
             $this->tpl->set_var("pageOf", $this->formArray["page"] . " of " . $numOfPages);
             $condition = $this->filterCancelled();
             $condition .= $this->sortBlocks();
             $condition .= " LIMIT " . ($this->formArray["page"] - 1) * PAGE_BY . "," . PAGE_BY;
             if (!$receiptRecords->searchRecords($this->formArray["searchKey"], $fields, $condition)) {
                 $this->tpl->set_var("pageOf", "");
                 $this->tpl->set_block("rptsTemplate", "ReceiptTable", "ReceiptTableBlock");
                 $this->tpl->set_var("ReceiptTableBlock", "");
                 $this->tpl->set_block("rptsTemplate", "ReceiptDBEmpty", "ReceiptDBEmptyBlock");
                 $this->tpl->set_var("ReceiptDBEmptyBlock", "");
                 $this->tpl->set_block("rptsTemplate", "Pages", "PagesBlock");
                 $this->tpl->set_var("PagesBlock", "");
                 $this->tpl->set_var("PagesListBlock", "");
                 $this->tpl->set_var("previousTxt", "");
                 $this->tpl->set_var("nextTxt", "");
             } else {
                 $this->tpl->set_block("rptsTemplate", "NotFound", "NotFoundBlock");
                 $this->tpl->set_var("NotFoundBlock", "");
                 $list = $receiptRecords->getArrayList();
                 if (count($list)) {
                     $this->tpl->set_block("rptsTemplate", "ReceiptDBEmpty", "ReceiptDBEmptyBlock");
                     $this->tpl->set_var("ReceiptDBEmptyBlock", "");
                     $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", date("m/d/Y", strtotime($value->getReceiptDate())));
                         $this->tpl->set_var("taxType", $this->getTaxType($value->getReceiptID()));
                         $receivedFromName = $this->getOwnerNames($value->getReceivedFrom());
                         $this->tpl->set_var("receivedFromName", $receivedFromName);
                         $this->tpl->parse("ReceiptListBlock", "ReceiptList", true);
                     }
                 }
             }
             break;
         default:
             $this->tpl->set_var("msg", "");
             $ReceiptList = new SoapObject(NCCBIZ . "ReceiptList.php", "urn:Object");
             $this->tpl->set_block("rptsTemplate", "Pages", "PagesBlock");
             $this->tpl->set_block("rptsTemplate", "PagesList", "PagesListBlock");
             $this->tpl->set_block("rptsTemplate", "NotFound", "NotFoundBlock");
             $this->tpl->set_var("NotFoundBlock", "");
             $condition = $this->filterCancelled();
             $receiptRecords = new ReceiptRecords();
             $count = $receiptRecords->countRecords($condition);
             if ($count == 0 || $count == false) {
                 $this->tpl->set_var("PagesBlock", "");
                 $this->tpl->set_var("PagesListBlock", "");
                 $this->tpl->set_block("rptsTemplate", "PageNavigator", "PagesBlock");
                 $this->tpl->set_var("PageNavigatorBlock", "");
             } else {
                 $numOfPages = ceil($count / PAGE_BY);
                 // page list nav
                 $this->formArray["pageLinksInLine"] = 7;
                 if ($this->formArray["page"] < round($this->formArray["pageLinksInLine"] / 2)) {
                     $startPageLinks = 1;
                 } else {
                     $startPageLinks = $this->formArray["page"] - round($this->formArray["pageLinksInLine"] / 2);
                     if ($startPageLinks < 1) {
                         $startPageLinks = 1;
                     }
                 }
                 $endPageLinks = $startPageLinks + ($this->formArray["pageLinksInLine"] - 1);
                 if ($endPageLinks > $numOfPages) {
                     $endPageLinks = $numOfPages;
                 }
                 for ($i = $startPageLinks; $i <= $endPageLinks; $i++) {
                     if ($i == $this->formArray["page"]) {
                         $this->tpl->set_var("pageListPages", "");
                         $this->tpl->set_var("pageListPagesUrl", "");
                         $this->tpl->set_var("pageListPaged", $i);
                     } else {
                         $this->tpl->set_var("pageListPages", $i);
                         $this->tpl->set_var("pageListPagesUrl", $i);
                         $this->tpl->set_var("pageListPaged", "");
                     }
                     $this->tpl->parse("PagesListBlock", "PagesList", true);
                 }
                 // drop down nav
                 for ($i = 1; $i <= $numOfPages; $i++) {
                     if ($i == $this->formArray["page"]) {
                         $this->tpl->set_var("pages", $i);
                         $this->tpl->set_var("pagesUrl", $i);
                         $this->tpl->set_var("paged", "selected");
                     } else {
                         $this->tpl->set_var("pages", $i);
                         $this->tpl->set_var("pagesUrl", $i);
                         $this->tpl->set_var("paged", "");
                     }
                     $this->tpl->parse("PagesBlock", "Pages", true);
                 }
             }
             if ($numOfPages == $this->formArray["page"]) {
                 $this->tpl->set_var("nextTxt", "");
             } else {
                 $this->tpl->set_var("next", $this->formArray["page"] + 1);
                 $this->tpl->set_var("nextTxt", "next");
             }
             if ($this->formArray["page"] == 1) {
                 $this->tpl->set_var("previousTxt", "");
             } else {
                 $this->tpl->set_var("previous", $this->formArray["page"] - 1);
                 $this->tpl->set_var("previousTxt", "previous");
             }
             if ($numOfPages == "") {
                 $this->tpl->set_var("pageOf", "");
             } else {
                 $this->tpl->set_var("pageOf", $this->formArray["page"] . " of " . $numOfPages);
             }
             $condition = $this->filterCancelled();
             $condition .= $this->sortBlocks();
             $condition .= " LIMIT " . ($this->formArray["page"] - 1) * PAGE_BY . "," . PAGE_BY;
             if (!$receiptRecords->selectRecords($condition)) {
                 $this->tpl->set_block("rptsTemplate", "ReceiptTable", "ReceiptTableBlock");
                 $this->tpl->set_var("ReceiptTableBlock", "");
             } else {
                 $list = $receiptRecords->getArrayList();
                 if (count($list)) {
                     $this->tpl->set_block("rptsTemplate", "ReceiptDBEmpty", "ReceiptDBEmptyBlock");
                     $this->tpl->set_var("ReceiptDBEmptyBlock", "");
                     $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", date("m/d/Y", strtotime($value->getReceiptDate())));
                         $this->tpl->set_var("taxType", $this->getTaxType($value->getReceiptID()));
                         $receivedFromName = $this->getOwnerNames($value->getReceivedFrom());
                         $this->tpl->set_var("receivedFromName", $receivedFromName);
                         $this->tpl->parse("ReceiptListBlock", "ReceiptList", true);
                     }
                 }
             }
             break;
     }
     $this->setForm();
     $this->setPageDetailPerms();
     $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");
 }
Example #3
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 = "&quot;" . $this->formArray["searchKey"] . "&quot; 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 = "&quot;" . $this->formArray["searchKey"] . "&quot; 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");
 }