function setBacktaxTDFromDueArray($tdID, $backtaxTDID, $dueArray, $previousTD, $previousAFS) { $backtaxTD = new BacktaxTD(); $backtaxTD->setBacktaxTDID($backtaxTDID); $backtaxTD->setCreatedBy($this->user["uid"]); $backtaxTD->setModifiedBy($this->user["uid"]); $backtaxTD->setTDID($tdID); $backtaxTD->setTdNumber($previousTD->getTaxDeclarationNumber()); $backtaxTD->setStartYear(date("Y", strtotime($dueArray["Annual"]->getDueDate()))); $backtaxTD->setEndYear(date("Y", strtotime($dueArray["Annual"]->getDueDate()))); $backtaxTD->setAssessedValue($previousAFS->getTotalAssessedValue()); $backtaxTD->setBasicRate($dueArray["Annual"]->getBasicTaxRate()); $backtaxTD->setSefRate($dueArray["Annual"]->getSefTaxRate()); $backtaxTD->setBasicTax($dueArray["Annual"]->getBasicTax()); $backtaxTD->setSefTax($dueArray["Annual"]->getSefTax()); $backtaxTD->setIdleTax($dueArray["Annual"]->getIdleTax()); $backtaxTD->setBalance($backtaxTD->getTotalTaxes()); // figure out startQuarter, penalties, paid $backtaxTD->setStartQuarter(""); $backtaxTD->setPenalties(""); $backtaxTD->setPaid(""); return $backtaxTD; }
function captureBacktaxTDDetails($backtaxTDID, $dueType) { $BacktaxTDDetails = new SoapObject(NCCBIZ . "BacktaxTDDetails.php", "urn:Object"); if (!($xmlStr = $BacktaxTDDetails->getBacktaxTD2($backtaxTDID))) { // error xmlStr } else { if (!($domDoc = domxml_open_mem($xmlStr))) { // error domDoc } else { $backtaxTD = new BacktaxTD(); $backtaxTD->parseDomDocument($domDoc); foreach ($this->tdArray as $tdID => $tdElementArray) { foreach ($tdElementArray as $tdElementKey => $tdElementValue) { switch ($tdElementKey) { case "btTD": if (is_array($tdElementValue)) { $btTDArray = $tdElementValue; foreach ($btTDArray as $btTDID => $btTDElementArray) { if ($btTDID == $backtaxTDID) { $backtaxTD->setBasicTax($btTDElementArray["basicTax"]); $backtaxTD->setSefTax($btTDElementArray["sefTax"]); $backtaxTD->setIdleTax($btTDElementArray["idleTax"]); $backtaxTD->setPenalties($btTDElementArray["penalty"]); $backtaxTD->setBalance($btTDElementArray["balance"]); $backtaxTD->setPaid($btTDElementArray["amountPaid"]); } } } break; } } } return $backtaxTD; } } return false; }
function Main() { switch ($this->formArray["formAction"]) { case "save": $BacktaxTDEncode = new SoapObject(NCCBIZ . "BacktaxTDEncode.php", "urn:Object"); if ($this->formArray["backtaxTDID"] != "") { $BacktaxTDDetails = new SoapObject(NCCBIZ . "BacktaxTDDetails.php", "urn:Object"); if (!($xmlStr = $BacktaxTDDetails->getBacktaxTD2($this->formArray["backtaxTDID"]))) { $this->tpl->set_block("rptsTemplate", "Table", "TableBlock"); $this->tpl->set_var("TableBlock", "record not found"); } else { if (!($domDoc = domxml_open_mem($xmlStr))) { $this->tpl->set_block("rptsTemplate", "Table", "TableBlock"); $this->tpl->set_var("TableBlock", "error xmlDoc"); } else { $backtaxTD = new BacktaxTD(); $backtaxTD->parseDomDocument($domDoc); $backtaxTD->setBacktaxTDID($this->formArray["backtaxTDID"]); $backtaxTD->setTDID($this->formArray["tdID"]); $backtaxTD->setTdNumber($this->formArray["tdNumber"]); $backtaxTD->setStartYear($this->formArray["startYear"]); $backtaxTD->setEndYear($this->formArray["startYear"]); $backtaxTD->setStartQuarter($this->formArray["startQuarter"]); $backtaxTD->setAssessedValue($this->formArray["assessedValue"]); $backtaxTD->setBasicRate($this->formArray["basicRate"]); $backtaxTD->setSefRate($this->formArray["sefRate"]); $backtaxTD->setBasicTax($this->formArray["basicTax"]); $backtaxTD->setSefTax($this->formArray["sefTax"]); $backtaxTD->setIdleTax($this->formArray["idleTax"]); $backtaxTD->setPenalties($this->formArray["penalties"]); $backtaxTD->setPaid($this->formArray["paid"]); $backtaxTD->setBalance($this->formArray["balance"]); $backtaxTD->setModifiedBy($this->userID); //$backtaxTD->setPaidStatus($this->formArray["paidStatus"]); //$backtaxTD->setTotal($this->formArray["total"]); $backtaxTD->setDomDocument(); $doc = $backtaxTD->getDomDocument(); $xmlStr = $doc->dump_mem(true); if (!($ret = $BacktaxTDEncode->updateBacktaxTD($xmlStr))) { exit("error update"); } } } } else { $startYear = $this->formArray["startYear"]; //print_r($startYear); //exit; ///* $endYear = $this->formArray["endYear"]; //echo($startYear."->".$endYear); sort($startYear, SORT_NUMERIC); //print_r($startYear); //exit; foreach ($startYear as $key => $value) { //for ($i = $startYear; $i<=$endYear; $i++){ //echo $i."<br>"; ///* $backtaxTD = new BacktaxTD(); $backtaxTD->selectRecord($this->formArray["backtaxTDID"]); //$backtaxTD->parseDomDocument($domDoc); $backtaxTD->setBacktaxTDID($this->formArray["backtaxTDID"]); $backtaxTD->setTDID($this->formArray["tdID"]); $backtaxTD->setTdNumber($this->formArray["tdNumber"]); $backtaxTD->setStartYear($value); $backtaxTD->setEndYear($value); $quarter = $key == 0 ? $this->formArray["startQuarter"] : 1; $backtaxTD->setStartQuarter($quarter); $backtaxTD->setAssessedValue($this->formArray["assessedValue"]); $backtaxTD->setBasicRate($this->formArray["basicRate"]); $backtaxTD->setSefRate($this->formArray["sefRate"]); $backtaxTD->setBasicTax($this->formArray["basicTax"]); $backtaxTD->setSefTax($this->formArray["sefTax"]); $backtaxTD->setIdleTax($this->formArray["idleTax"]); $backtaxTD->setPenalties($this->formArray["penalties"]); $paid = $key == 0 ? $this->formArray["paid"] : 0; $backtaxTD->setPaid($paid); $backtaxTD->setBalance($backtaxTD->getTotalTaxDue()); $backtaxTD->setCreatedBy($this->userID); //$backtaxTD->setPaidStatus($this->formArray["paidStatus"]); //$backtaxTD->setTotal($this->formArray["total"]); $backtaxTD->setDomDocument(); $doc = $backtaxTD->getDomDocument(); $xmlStr = $doc->dump_mem(true); //echo $i." - ".$xmlStr."<br>"; if (!($ret = $BacktaxTDEncode->saveBacktaxTD($xmlStr))) { echo "Error saving"; } } //*/ } //exit; $this->formArray["backtaxTDID"] = $ret; header("location: BacktaxTDClose.php" . $this->sess->url("") . $this->sess->add_query(array("afsID" => $this->formArray["afsID"]))); exit($ret); break; default: if ($this->formArray["backtaxTDID"]) { $BacktaxTDDetails = new SoapObject(NCCBIZ . "BacktaxTDDetails.php", "urn:Object"); if (!($xmlStr = $BacktaxTDDetails->getBacktaxTD2($this->formArray["backtaxTDID"]))) { echo "xml failed"; } else { //echo $xmlStr; if (!($domDoc = domxml_open_mem($xmlStr))) { // } else { $backtaxTD = new BacktaxTD(); $backtaxTD->parseDomDocument($domDoc); foreach ($backtaxTD as $key => $value) { switch ($key) { default: $this->formArray[$key] = $value; } } } } } } $this->setForm(); $this->tpl->set_var("Session", $this->sess->url("") . $this->sess->add_query(array("tdID" => $this->formArray["tdID"], "afsID" => $this->formArray["afsID"]))); $this->tpl->parse("templatePage", "rptsTemplate"); $this->tpl->finish("templatePage"); $this->tpl->p("templatePage"); }