コード例 #1
0
 function setvar($key, $value, $formatCurrency = false)
 {
     if ($formatCurrency) {
         $value = formatCurrency($value);
     }
     $this->tpl->set_var($key, html_entity_to_alpha($value));
 }
コード例 #2
0
 public static function renderColumn(CAppUI $AppUI, $fieldName, $row)
 {
     switch ($fieldName) {
         case 'project_creator':
         case 'project_owner':
             $s .= '<td nowrap="nowrap">';
             $s .= w2PgetUsernameFromID($row[$fieldName]);
             $s .= '</td>';
             break;
         case 'project_target_budget':
         case 'project_actual_budget':
             $s .= '<td>';
             $s .= $w2Pconfig['currency_symbol'];
             $s .= formatCurrency($row[$fieldName], $AppUI->getPref('CURRENCYFORM'));
             $s .= '</td>';
             break;
         case 'project_url':
         case 'project_demo_url':
             $s .= '<td>';
             $s .= w2p_url($row[$fieldName]);
             $s .= '</td>';
             break;
         case 'project_start_date':
         case 'project_end_date':
             $df = $AppUI->getPref('SHDATEFORMAT');
             $myDate = intval($row[$fieldName]) ? new w2p_Utilities_Date($row[$fieldName]) : null;
             $s .= '<td nowrap="nowrap" class="center">' . ($myDate ? $myDate->format($df) : '-') . '</td>';
             break;
         default:
             $s .= '<td nowrap="nowrap" class="center">';
             $s .= htmlspecialchars($row[$fieldName], ENT_QUOTES);
             $s .= '</td>';
     }
     return $s;
 }
コード例 #3
0
 function ah_formatstat($billingcycle, $stat)
 {
     global $data, $currency, $currencytotal;
     $value = array_key_exists($billingcycle, $data) ? $data[$billingcycle][$stat] : '';
     if (!$value) {
         $value = 0;
     }
     if ($stat == "sum") {
         if ($billingcycle == "Monthly") {
             $currencytotal += $value * 12;
         } elseif ($billingcycle == "Quarterly") {
             $currencytotal += $value * 4;
         } elseif ($billingcycle == "Semi-Annually") {
             $currencytotal += $value * 2;
         } elseif ($billingcycle == "Annually") {
             $currencytotal += $value;
         } elseif ($billingcycle == "Biennially") {
             $currencytotal += $value / 2;
         } elseif ($billingcycle == "Triennially") {
             $currencytotal += $value / 3;
         }
         $value = formatCurrency($value);
     }
     return $value;
 }
コード例 #4
0
ファイル: Product.php プロジェクト: jewelhuq/erp
 public function parseValue($type, $item)
 {
     foreach ($item as $field => $value) {
         switch ($field) {
             case 'defaultPrice':
                 $parsed[$field] = formatCurrency($value);
                 break;
             default:
                 $parsed[$field] = $value;
         }
         if (isset($parsed[$field]) && $field != 'defaultPrice') {
             $parsed[$field] = htmlspecialchars($parsed[$field], ENT_QUOTES | ENT_HTML5, 'UTF-8');
         }
     }
     return $parsed;
 }
コード例 #5
0
ファイル: open_invoices.php プロジェクト: MarcelaGotta/Webty
function widget_open_invoices($vars)
{
    global $_ADMINLANG, $currency;
    $title = $_ADMINLANG['home']['openinvoices'];
    if (!function_exists("getGatewaysArray")) {
        require ROOTDIR . "/includes/gatewayfunctions.php";
    }
    $gatewaysarray = getGatewaysArray();
    $content = '<table class="table table-condensed">
<tr style="background-color:#efefef;font-weight:bold;text-align:center"><td>' . $_ADMINLANG['fields']['invoicenum'] . '</td><td>' . $_ADMINLANG['fields']['clientname'] . '</td><td>' . $_ADMINLANG['fields']['invoicedate'] . '</td><td>' . $_ADMINLANG['fields']['duedate'] . '</td><td>' . $_ADMINLANG['fields']['totaldue'] . '</td><td>' . $_ADMINLANG['fields']['paymentmethod'] . '</td><td width="20"></td></tr>
';
    $id = '';
    $query = "SELECT tblinvoices.*,tblinvoices.total-COALESCE((SELECT SUM(amountin) FROM tblaccounts WHERE tblaccounts.invoiceid=tblinvoices.id),0) AS invoicebalance,tblclients.firstname,tblclients.lastname FROM tblinvoices INNER JOIN tblclients ON tblclients.id=tblinvoices.userid WHERE tblinvoices.status='Unpaid' ORDER BY duedate,date ASC LIMIT 0,5";
    $result = full_query($query);
    while ($data = mysql_fetch_array($result)) {
        $id = $data["id"];
        $invoicenum = $data["invoicenum"];
        $userid = $data["userid"];
        $firstname = $data["firstname"];
        $lastname = $data["lastname"];
        $date = $data["date"];
        $duedate = $data["duedate"];
        $total = $data["total"];
        $invoicebalance = $data["invoicebalance"];
        $paymentmethod = $data["paymentmethod"];
        $paymentmethod = $gatewaysarray[$paymentmethod];
        $date = fromMySQLDate($date);
        $duedate = fromMySQLDate($duedate);
        $currency = getCurrency($userid);
        if (!$invoicenum) {
            $invoicenum = $id;
        }
        $content .= '<tr bgcolor="#ffffff" style="text-align:center;"><td><a href="invoices.php?action=edit&id=' . $id . '">' . $invoicenum . '</a></td><td>' . $firstname . ' ' . $lastname . '</td><td>' . $date . '</td><td>' . $duedate . '</td><td>' . formatCurrency($total) . '</td><td>' . $paymentmethod . '</td><td><a href="invoices.php?action=edit&id=' . $id . '"><img src="images/edit.gif" border="0" /></a></td></tr>';
    }
    if (!$id) {
        $content .= '<tr bgcolor="#ffffff" style="text-align:center;"><td colspan="7">' . $_ADMINLANG['global']['norecordsfound'] . '</td></tr>';
    }
    $content .= '</table>
<div class="widget-footer">
    <a href="invoices.php?status=Unpaid" class="btn btn-info btn-sm">' . $_ADMINLANG['home']['viewall'] . ' &raquo;</a>
</div>';
    return array('title' => $title, 'content' => $content);
}
コード例 #6
0
ファイル: Discount.php プロジェクト: jewelhuq/erp
 public function parseValue($type, $item)
 {
     foreach ($item as $field => $value) {
         switch ($field) {
             case 'discountType':
                 $parsed[$field] = $value == 'C' ? 'Cash' : 'Percentage';
                 break;
             case 'discountAmount':
                 $parsed[$field] = $item['discountType'] == 'C' ? formatCurrency($value) : $value + 0 . '%';
                 break;
             default:
                 $parsed[$field] = $value;
         }
         if (isset($parsed[$field]) && ($field != 'discountAmount' || $field == 'discountAmount' && $item['discountType'] != 'C')) {
             $parsed[$field] = htmlspecialchars($parsed[$field], ENT_QUOTES | ENT_HTML5, 'UTF-8');
         }
     }
     return $parsed;
 }
コード例 #7
0
function compoundInterest($investment, $interest_rate, $years, $compound_monthly = false)
{
    // calculate the future value
    $is_compounded_monthly = '';
    $future_value = $investment;
    for ($i = 1; $i <= $years; $i++) {
        if ($compound_monthly) {
            $future_value = $future_value * pow(1 + $interest_rate / (100 * 12), 12);
            $is_compounded_monthly = "Yes";
        } else {
            $future_value = $future_value + $future_value * $interest_rate * 0.01;
            $is_compounded_monthly = "No";
        }
    }
    // apply currency and percent formatting
    $investment_f = formatCurrency($investment);
    $yearly_rate_f = formatPercentage($interest_rate);
    $future_value_f = formatCurrency($future_value);
    include 'display_results.php';
}
コード例 #8
0
function chartdata_income()
{
    global $currency;
    $currency = getCurrency();
    $chartdata = array();
    $chartdata['cols'][] = array('label' => 'Day', 'type' => 'string');
    $chartdata['cols'][] = array('label' => 'Income', 'type' => 'number');
    $chartdata['cols'][] = array('label' => 'Expenditure/Refunds', 'type' => 'number');
    for ($i = 14; $i >= 0; $i--) {
        $date = mktime(0, 0, 0, date("m"), date("d") - $i, date("Y"));
        $data = get_query_vals("tblaccounts", "SUM(amountin/rate),SUM(amountout/rate)", "date LIKE '" . date("Y-m-d", $date) . "%'");
        if (!$data[0]) {
            $data[0] = 0;
        }
        if (!$data[1]) {
            $data[1] = 0;
        }
        $chartdata['rows'][] = array('c' => array(array('v' => date("dS", $date)), array('v' => (int) $data[0], 'f' => formatCurrency($data[0])), array('v' => (int) $data[1], 'f' => formatCurrency($data[1]))));
    }
    return $chartdata;
}
コード例 #9
0
 function Main()
 {
     switch ($this->formArray["formAction"]) {
         case "remove":
             //echo "removeOwnerRPTOP(".$this->formArray["rptopID"].",".$this->formArray["ownerID"].",".$this->formArray["personID"].",".$this->formArray["companyID"].")";
             $OwnerList = new SoapObject(NCCBIZ . "OwnerList.php", "urn:Object");
             if (count($this->formArray["personID"]) || count($this->formArray["companyID"])) {
                 if (!($deletedRows = $OwnerList->removeOwnerRPTOP($this->formArray["rptopID"], $this->formArray["ownerID"], $this->formArray["personID"], $this->formArray["companyID"]))) {
                     $this->tpl->set_var("msg", "SOAP failed");
                     //echo "SOAP failed";
                 } else {
                     $this->tpl->set_var("msg", $deletedRows . " records deleted");
                 }
             } else {
                 $this->tpl->set_var("msg", "0 records deleted");
             }
             header("location: RPTOPDetails.php" . $this->sess->url("") . $this->sess->add_query(array("rptopID" => $this->formArray["rptopID"])));
             exit;
             break;
         default:
             $this->tpl->set_var("msg", "");
     }
     //select
     $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);
             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_numeric($value)) {
                             $cityAssessor = new Person();
                             $cityAssessor->selectRecord($value);
                             $this->tpl->set_var("cityAssessorID", $cityAssessor->getPersonID());
                             $this->tpl->set_var("cityAssessorName", $cityAssessor->getFullName());
                             $this->formArray["cityAssessorName"] = $cityAssessor->getFullName();
                         } else {
                             $cityAssessor = $value;
                             $this->tpl->set_var("cityAssessorID", $cityAssessor);
                             $this->tpl->set_var("cityAssessorName", $cityAssessor);
                             $this->formArray["cityAssessorName"] = $cityAssessor;
                         }
                         break;
                     case "cityTreasurer":
                         if (is_numeric($value)) {
                             $cityTreasurer = new Person();
                             $cityTreasurer->selectRecord($value);
                             $this->tpl->set_var("cityTreasurerID", $cityTreasurer->getPersonID());
                             $this->tpl->set_var("cityTreasurerName", $cityTreasurer->getFullName());
                             $this->formArray["cityTreasurerName"] = $cityTreasurer->getFullName();
                         } else {
                             $cityTreasurer = $value;
                             $this->tpl->set_var("cityTreasurerID", $cityTreasurer);
                             $this->tpl->set_var("cityTreasurerName", $cityTreasurer);
                             $this->formArray["cityTreasurerName"] = $cityTreasurer;
                         }
                         break;
                     case "tdArray":
                         //$this->tpl->set_block("rptsTemplate", "defaultTDList", "defaultTDListBlock");
                         //$this->tpl->set_block("rptsTemplate", "toggleTDList", "toggleTDListBlock");
                         //$this->tpl->set_block("rptsTemplate", "TDList", "TDListBlock");
                         //$this->tpl->set_block("TDList", "BacktaxesList", "BacktaxesListBlock");
                         $tdCtr = 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) {
                                 //foreach($tvalue as $column => $val){
                                 //	$this->tpl->set_var($column,$val);
                                 //}
                                 /*
                                 $this->tpl->set_var("tdID",$tvalue->getTDID());
                                 $this->tpl->set_var("taxDeclarationNumber",$tvalue->getTaxDeclarationNumber());
                                 $this->tpl->set_var("afsID",$tvalue->getAfsID());
                                 $this->tpl->set_var("cancelsTDNumber",$tvalue->getCancelsTDNumber());
                                 $this->tpl->set_var("canceledByTDNumber",$tvalue->getCanceledByTDNumber());
                                 $this->tpl->set_var("taxBeginsWithTheYear",$tvalue->getTaxBeginsWithTheYear());
                                 $this->tpl->set_var("ceasesWithTheYear",$tvalue->getCeasesWithTheYear());
                                 $this->tpl->set_var("enteredInRPARForBy",$tvalue->getEnteredInRPARForBy());
                                 $this->tpl->set_var("enteredInRPARForYear",$tvalue->getEnteredInRPARForYear());
                                 $this->tpl->set_var("previousOwner",$tvalue->getPreviousOwner());
                                 $this->tpl->set_var("previousAssessedValue",$tvalue->getPreviousAssessedValue());
                                 
                                 list($dateArr["year"],$dateArr["month"],$dateArr["day"]) = explode("-",$tvalue->getProvincialAssessorDate());
                                 $this->tpl->set_var("pa_yearValue",removePreZero($dateArr["year"]));
                                 $this->tpl->set_var("pa_month",removePreZero($dateArr["month"]));
                                 $this->tpl->set_var("pa_dayValue",removePreZero($dateArr["day"]));
                                 list($dateArr["year"],$dateArr["month"],$dateArr["day"]) = explode("-",$tvalue->getCityMunicipalAssessorDate());
                                 $this->tpl->set_var("cm_yearValue",removePreZero($dateArr["year"]));
                                 $this->tpl->set_var("cm_month",removePreZero($dateArr["month"]));
                                 $this->tpl->set_var("cm_dayValue",removePreZero($dateArr["day"]));
                                 
                                 $this->tpl->set_var("provincialAssessorName",$tvalue->provincialAssessor);
                                 $this->tpl->set_var("cityMunicipalAssessorName",$tvalue->cityMunicipalAssessor);
                                 //$this->tpl->set_var("assessedValue",$tvalue->getAssessedValue());
                                 
                                 $this->tpl->set_var("propertyType",$tvalue->getPropertyType());
                                 
                                 $this->tpl->set_var("basicTax","");
                                 $this->tpl->set_var("sefTax", "");
                                 $this->tpl->set_var("total", "");
                                 
                                 //$this->tpl->set_var("basicTax",$tvalue->getBasicTax());
                                 //$this->tpl->set_var("sefTax",$tvalue->getSefTax());
                                 //$this->tpl->set_var("total",$tvalue->getTotal());
                                 */
                                 $this->tdRecord["arpNumber"] = $tvalue->getTaxDeclarationNumber();
                                 $AFSDetails = new SoapObject(NCCBIZ . "AFSDetails.php", "urn:Object");
                                 if (!($xmlStr = $AFSDetails->getAFS($tvalue->getAfsID()))) {
                                     //$this->tpl->set_block("rptsTemplate", "AFSTable", "AFSTableBlock");
                                     //$this->tpl->set_var("AFSTableBlock", "afs not found");
                                 } else {
                                     //echo $xmlStr;
                                     if (!($domDoc = domxml_open_mem($xmlStr))) {
                                         //$this->tpl->set_block("rptsTemplate", "OwnerListTable", "OwnerListTableBlock");
                                         //$this->tpl->set_var("OwnerListTableBlock", "error xmlDoc");
                                     } else {
                                         $afs = new AFS();
                                         $afs->parseDomDocument($domDoc);
                                         $odID = $afs->getOdID();
                                         $od = new OD();
                                         $od->selectRecord($odID);
                                         if (is_object($od->locationAddress)) {
                                             $locationAddress = $od->getLocationAddress();
                                             $this->tdRecord["location"] = $locationAddress->getBarangay() . ", " . $locationAddress->getMunicipalityCity();
                                         }
                                         switch ($tvalue->getPropertyType()) {
                                             case "ImprovementsBuildings":
                                                 if (is_array($afs->getImprovementsBuildingsArray())) {
                                                     $improvementsBuildings = $afs->improvementsBuildingsArray[0];
                                                     $actualUse = $improvementsBuildings->getActualUse();
                                                     if (is_numeric($actualUse)) {
                                                         $improvementsBuildingsActualUses = new ImprovementsBuildingsActualUses();
                                                         $improvementsBuildingsActualUses->selectRecord($actualUse);
                                                         $actualUse = $improvementsBuildingsActualUses->getCode();
                                                         //$actualUse = $improvementsBuildingsActualUses->getDescription();
                                                     }
                                                     $this->tdRecord["class"] = $actualUse;
                                                 }
                                                 break;
                                             case "Machineries":
                                                 if (is_array($afs->getMachineriesArray())) {
                                                     $machineries = $afs->machineriesArray[0];
                                                     $actualUse = $machineries->getActualUse();
                                                     if (is_numeric($actualUse)) {
                                                         $machineriesActualUses = new MachineriesActualUses();
                                                         $machineriesActualUses->selectRecord($actualUse);
                                                         $actualUse = $machineriesActualUses->getCode();
                                                         //$actualUse = $machineriesActualUses->getDescription();
                                                     }
                                                     $this->tdRecord["class"] = $actualUse;
                                                 }
                                                 break;
                                             case "Land":
                                             default:
                                                 if (is_array($afs->getLandArray())) {
                                                     $land = $afs->landArray[0];
                                                     $actualUse = $land->getActualUse();
                                                     if (is_numeric($actualUse)) {
                                                         $landActualUses = new LandActualUses();
                                                         $landActualUses->selectRecord($actualUse);
                                                         $actualUse = $landActualUses->getCode();
                                                         //$actualUse = $landActualUses->getDescription();
                                                     }
                                                     $this->tdRecord["class"] = $actualUse;
                                                 } else {
                                                     if (is_array($afs->getPlantsTreesArray())) {
                                                         if (is_numeric($actualUse)) {
                                                             $plantsTreesActualUses = new PlantsTreesActualUses();
                                                             $plantsTreesActualUses->selectRecord($actualUse);
                                                             $actualUse = $plantsTreesActualUses->getCode();
                                                             //$actualUse = $plantsTreesActualUses->getDescription();
                                                         }
                                                         $this->tdRecord["class"] = $actualUse;
                                                     }
                                                 }
                                         }
                                         $this->formArray["landTotalMarketValue"] += $afs->getLandTotalMarketValue();
                                         $this->formArray["landTotalAssessedValue"] += $afs->getLandTotalAssessedValue();
                                         $this->formArray["plantTotalMarketValue"] += $afs->getPlantTotalMarketValue();
                                         $this->formArray["plantTotalAssessedValue"] += $afs->getPlantTotalAssessedValue();
                                         $this->formArray["bldgTotalMarketValue"] += $afs->getBldgTotalMarketValue();
                                         $this->formArray["bldgTotalAssessedValue"] += $afs->getBldgTotalAssessedValue();
                                         $this->formArray["machTotalMarketValue"] += $afs->getMachTotalMarketValue();
                                         $this->formArray["machTotalAssessedValue"] += $afs->getMachTotalAssessedValue();
                                         $this->formArray["totalMarketValue"] += $afs->getTotalMarketValue();
                                         $this->formArray["totalAssessedValue"] += $afs->getTotalAssessedValue();
                                         $this->tpl->set_var("marketValue", number_format($afs->getTotalMarketValue(), 2, '.', ','));
                                         $this->tpl->set_var("assessedValue", number_format($afs->getTotalAssessedValue(), 2, '.', ','));
                                         $this->tpl->set_var("taxability", $afs->getTaxability());
                                         $this->tpl->set_var("effectivity", $afs->getEffectivity());
                                         $this->formArray["idle"] = "No";
                                         if ($tvalue->getPropertyType() == "Land") {
                                             if (is_array($afs->landArray)) {
                                                 // if land is stripped
                                                 if (count($afs->landArray) > 1) {
                                                     foreach ($afs->landArray as $land) {
                                                         if ($land->getIdle() == "Yes") {
                                                             $this->formArray["idle"] = "Yes";
                                                             break;
                                                         }
                                                     }
                                                 } else {
                                                     $this->formArray["idle"] = $afs->landArray[0]->getIdle();
                                                 }
                                             }
                                         }
                                         if ($this->formArray["idle"] == "") {
                                             $this->formArray["idle"] = "No";
                                         }
                                         $this->tpl->set_var("idle", $this->formArray["idle"]);
                                     }
                                 }
                                 // grab DueRecords from tdID
                                 $DueList = new SoapObject(NCCBIZ . "DueList.php", "urn:Object");
                                 $dueArrayList = array("Annual" => "", "Q1" => "", "Q2" => "", "Q3" => "", "Q4" => "");
                                 if (!($xmlStr = $DueList->getDueList($tvalue->getTdID(), $rptop->getTaxableYear()))) {
                                     if ($this->formArray["rptopID"] != "") {
                                         $redirectMessage = "Dues are uncalculated. <a href='CalculateRPTOPDetails.php" . $this->sess->url("") . "&rptopID=" . $this->formArray["rptopID"] . "'>Click here</a> to go to calculation page or <a href='SOA.php" . $this->sess->url("") . "'>return to list</a>.";
                                     } else {
                                         $redirectMessage = "Dues are uncalculated. <a href='SOA.php" . $this->sess->url("") . "'>Click here</a> to return to list.";
                                     }
                                     exit($redirectMessage);
                                 } else {
                                     if (!($domDoc = domxml_open_mem($xmlStr))) {
                                         if ($this->formArray["rptopID"] != "") {
                                             $redirectMessage = "Dues are uncalculated. <a href='CalculateRPTOPDetails.php" . $this->sess->url("") . "&rptopID=" . $this->formArray["rptopID"] . "'>Click here</a> to go to calculation page or <a href='SOA.php" . $this->sess->url("") . "'>return to list</a>.";
                                         } else {
                                             $redirectMessage = "Dues are uncalculated. <a href='SOA.php" . $this->sess->url("") . "'>Click here</a> to return to list.";
                                         }
                                         exit($redirectMessage);
                                     } else {
                                         $dueRecords = new DueRecords();
                                         $dueRecords->parseDomDocument($domDoc);
                                         foreach ($dueRecords->getArrayList() as $due) {
                                             foreach ($due as $dueKey => $dueValue) {
                                                 switch ($dueKey) {
                                                     case "dueType":
                                                         if ($dueValue == "Annual") {
                                                             $this->formArray["totalTaxDue"] += $due->getTaxDue();
                                                         }
                                                         $dueArrayList[$dueValue] = $due;
                                                         $this->tpl->set_var("basicTax[" . $dueValue . "]", formatCurrency($due->getBasicTax()));
                                                         $this->tpl->set_var("sefTax[" . $dueValue . "]", formatCurrency($due->getSEFTax()));
                                                         $this->tpl->set_var("idleTax[" . $dueValue . "]", formatCurrency($due->getIdleTax()));
                                                         $this->tpl->set_var("taxDue[" . $dueValue . "]", formatCurrency($due->getTaxDue()));
                                                         $this->tpl->set_var("dueDate[" . $dueValue . "]", date("M. d, Y", strtotime($due->getDueDate())));
                                                         $dueDateYear = date("Y", strtotime($due->getDueDate()));
                                                         $this->tdRecord["year"] = $dueDateYear;
                                                         break;
                                                 }
                                             }
                                         }
                                         $treasurySettings = new TreasurySettings();
                                         $treasurySettings->selectRecord();
                                         // initialize discountPeriod and discountPercentage for earlyPaymentDiscount
                                         $this->tpl->set_var("discountPercentage", $treasurySettings->getDiscountPercentage() . "%");
                                         $this->tpl->set_var("discountPeriod", "January 01, " . $dueDateYear . " - " . date("F d, Y", strtotime($dueDateYear . "-" . $treasurySettings->getDiscountPeriod())));
                                         $this->formArray["discountPercentage"] = $treasurySettings->getDiscountPercentage();
                                         $this->formArray["discountPeriod"] = $treasurySettings->getDiscountPeriod();
                                         $this->formArray["discountPeriod_End"] = strtotime($dueDateYear . "-" . $this->formArray["discountPeriod"]);
                                         $this->formArray["discountPeriod_Start"] = strtotime($dueDateYear . "-01-01");
                                         // initialize advancedDiscountPercentage for advancedPayment
                                         $this->tpl->set_var("advancedDiscountPercentage", $treasurySettings->getAdvancedDiscountPercentage() . "%");
                                         $this->formArray["advancedDiscountPercentage"] = $treasurySettings->getAdvancedDiscountPercentage();
                                         $this->tpl->set_var("q1AdvancedDiscountPercentage", $treasurySettings->getQ1AdvancedDiscountPercentage() . "%");
                                         $this->formArray["q1AdvancedDiscountPercentage"] = $treasurySettings->getQ1AdvancedDiscountPercentage();
                                         // initialize penaltyLUTArray
                                         $penaltyLUTArray = $treasurySettings->getPenaltyLUT();
                                         $this->penaltyLUTArray = $treasurySettings->getPenaltyLUT();
                                         foreach ($dueArrayList as $dKey => $due) {
                                             $dueArrayList[$dKey]->setEarlyPaymentDiscountPeriod($this->formArray["discountPeriod"]);
                                             $dueArrayList[$dKey]->setEarlyPaymentDiscountPercentage($this->formArray["discountPercentage"]);
                                             // compute earlyPaymentDiscount as of today
                                             // check if today is within the discountPeriod and compute Discount
                                             // AND if today is BEFORE annual dueDate
                                             $dueArrayList[$dKey]->setEarlyPaymentDiscount(0.0);
                                             if ($due->getDueType() == "Annual") {
                                                 if (strtotime($this->now) >= $this->formArray["discountPeriod_Start"] && strtotime($this->now) <= $this->formArray["discountPeriod_End"]) {
                                                     if (strtotime($this->now) <= strtotime($dueArrayList[$dKey]->getDueDate())) {
                                                         $dueArrayList[$dKey]->setEarlyPaymentDiscount($dueArrayList[$dKey]->getTaxDue() * ($this->formArray["discountPercentage"] / 100));
                                                     }
                                                 }
                                             } else {
                                                 // if today is BEFORE dueDate
                                                 if (strtotime($this->now) <= strtotime($due->getDueDate()) && strtotime($this->now) >= $this->formArray["discountPeriod_Start"]) {
                                                     $dueArrayList[$dKey]->setEarlyPaymentDiscount($dueArrayList[$dKey]->getTaxDue() * ($this->formArray["discountPercentage"] / 100));
                                                 }
                                                 // commented out Febuary 08, 2005 : Provide Quarterly Discounts
                                                 // earlyPaymentDiscount aren't given to Quarterly Dues except for Quarter 1
                                                 /*
                                                 if($due->getDueType()=="Q1"){
                                                 	if(strtotime($this->now) >= $this->formArray["discountPeriod_Start"] && strtotime($this->now) <= $this->formArray["discountPeriod_End"]){
                                                 		if(strtotime($this->now) <= strtotime($dueArrayList[$dKey]->getDueDate())){
                                                 			$dueArrayList[$dKey]->setEarlyPaymentDiscount($dueArrayList[$dKey]->getTaxDue() * ($this->formArray["discountPercentage"]/100));
                                                 		}
                                                 	}
                                                 }
                                                 */
                                             }
                                             // compute advancedPaymentDiscount as of today
                                             // check if today is BEFORE January 1 of the year of the annual dueDate
                                             $dueArrayList[$dKey]->setAdvancedPaymentDiscount(0.0);
                                             if (strtotime($this->now) < strtotime(date("Y", strtotime($dueArrayList[$dKey]->getDueDate())) . "-01-01")) {
                                                 // for advanced payments, give 20% discount to annual dues [advanced discount]
                                                 // give 10% discount to quarterly dues [early discount]
                                                 if ($due->getDueType() == "Annual") {
                                                     $dueArrayList[$dKey]->setAdvancedPaymentDiscount($dueArrayList[$dKey]->getTaxDue() * ($this->formArray["advancedDiscountPercentage"] / 100));
                                                 } else {
                                                     if ($due->getDueType() == "Q1") {
                                                         $dueArrayList[$dKey]->setAdvancedPaymentDiscount($dueArrayList[$dKey]->getTaxDue() * ($this->formArray["q1AdvancedDiscountPercentage"] / 100));
                                                     } else {
                                                         $dueArrayList[$dKey]->setAdvancedPaymentDiscount($dueArrayList[$dKey]->getTaxDue() * ($this->formArray["discountPercentage"] / 100));
                                                     }
                                                     // commented out: February 08, 2005
                                                     // advancedPaymentDiscount aren't given to Quarterly Dues except for Quarter 1
                                                     /*
                                                     if($due->getDueType()=="Q1"){
                                                     	$dueArrayList[$dKey]->setAdvancedPaymentDiscount($dueArrayList[$dKey]->getTaxDue() * ($this->formArray["q1AdvancedDiscountPercentage"]/100));
                                                     }
                                                     */
                                                 }
                                             }
                                             $latestPaymentDate[$dKey] = $this->getLatestPaymentDateForDue($dueArrayList[$dKey]);
                                             $amountPaidForDue = $this->getAmountPaidForDue($dueArrayList);
                                             $latestPaymentDueType = $this->getLatestPaymentDueType($dueArrayList);
                                             $amnestyStatus[$dKey] = $this->getAmnestyStatusForDue($dueArrayList[$dKey]);
                                             $totalEarlyPaymentDiscount = $this->getTotalEarlyPaymentDiscountForDue($dueArrayList);
                                             $totalAdvancedPaymentDiscount = $this->getTotalAdvancedPaymentDiscountForDue($dueArrayList);
                                             if ($totalEarlyPaymentDiscount > 0) {
                                                 $earlyPaymentDiscountForDueType = $this->getTotalEarlyPaymentDiscountForDueType($dueArrayList[$dKey]);
                                                 if ($earlyPaymentDiscountForDueType > 0) {
                                                     $dueArrayList[$dKey]->setEarlyPaymentDiscount($earlyPaymentDiscountForDueType);
                                                 }
                                             }
                                             if ($totalAdvancedPaymentDiscount > 0) {
                                                 $advancedPaymentDiscountForDueType = $this->getTotalAdvancedPaymentDiscountForDueType($dueArrayList[$dKey]);
                                                 if ($advancedPaymentDiscountForDueType > 0) {
                                                     $dueArrayList[$dKey]->setAdvancedPaymentDiscount($advancedPaymentDiscountForDueType);
                                                 }
                                             }
                                             // calculate Penalties verses either today or verses the last paymentDate
                                             if ($latestPaymentDate[$dKey] != "" || $latestPaymentDate[$dKey] != "now") {
                                                 $dueArrayList[$dKey] = $this->computePenalty($latestPaymentDate[$dKey], $dueArrayList[$dKey]);
                                                 // if balance is 0 leave penalty as is, otherwise calculatePenalty according to date now
                                                 $balance = round($dueArrayList[$dKey]->getInitialNetDue() - $amountPaidForDue, 4);
                                                 // 0.1 is used instead of 0 because a lot of balances may end up as 0.002 or so...
                                                 if ($balance > 0.1) {
                                                     $dueArrayList[$dKey] = $this->computePenalty($this->now, $dueArrayList[$dKey]);
                                                 }
                                             } else {
                                                 $dueArrayList[$dKey] = $this->computePenalty($this->now, $dueArrayList[$dKey]);
                                             }
                                             //print_r($dueArrayList[$dKey]);
                                             //echo "<hr>";
                                             $this->tpl->set_var("advancedPaymentDiscount[" . $dKey . "]", formatCurrency($dueArrayList[$dKey]->getAdvancedPaymentDiscount()));
                                             $this->tpl->set_var("earlyPaymentDiscount[" . $dKey . "]", formatCurrency($dueArrayList[$dKey]->getEarlyPaymentDiscount()));
                                             $this->tpl->set_var("monthsOverDue[" . $dKey . "]", $dueArrayList[$dKey]->getMonthsOverDue());
                                             $this->tpl->set_var("penaltyPercentage[" . $dKey . "]", $dueArrayList[$dKey]->getPenaltyPercentage() * 100);
                                             $this->tpl->set_var("penalty[" . $dKey . "]", formatCurrency($dueArrayList[$dKey]->getPenalty()));
                                             $this->initialNetDue[$dKey] = $dueArrayList[$dKey]->getInitialNetDue();
                                             if ($amnestyStatus[$dKey]) {
                                                 $this->initialNetDue[$dKey] -= $dueArrayList[$dKey]->getPenalty();
                                                 $this->tpl->set_var("amnesty[" . $dKey . "]", "Yes");
                                             } else {
                                                 $this->tpl->set_var("amnesty[" . $dKey . "]", "No");
                                             }
                                             $this->tpl->set_var("initialNetDue[" . $dKey . "]", formatCurrency($this->initialNetDue[$dKey]));
                                         }
                                         // out of the loop,
                                         // verify balances to make disable penalties and discounts for Annual if ALL QUARTERS have been paid
                                         // and to disable penalties and discounts for Quarters if ALL of ANNUAL has been paid
                                         // example: Q1, Q2, Q3 and Q4 have been fully paid. Annual should not show any payables.
                                         //          Likewise if Annual has been fully paid, Q1, Q2, Q3 and Q4 should not show any payables.
                                         $totalQuarterlyNetDue = 0;
                                         $totalQuarterlyNetDue += $dueArrayList["Q1"]->getBasicTax() + $dueArrayList["Q1"]->getSefTax() + $dueArrayList["Q1"]->getIdleTax();
                                         $totalQuarterlyNetDue -= $dueArrayList["Q1"]->getEarlyPaymentDiscount() + $dueArrayList["Q1"]->getAdvancedPaymentDiscount();
                                         if (!$amnestyStatus["Q1"]) {
                                             $totalQuarterlyNetDue += $dueArrayList["Q1"]->getPenalty();
                                         }
                                         $totalQuarterlyNetDue += $dueArrayList["Q2"]->getBasicTax() + $dueArrayList["Q2"]->getSefTax() + $dueArrayList["Q2"]->getIdleTax();
                                         $totalQuarterlyNetDue -= $dueArrayList["Q2"]->getEarlyPaymentDiscount() + $dueArrayList["Q2"]->getAdvancedPaymentDiscount();
                                         if (!$amnestyStatus["Q2"]) {
                                             $totalQuarterlyNetDue += $dueArrayList["Q2"]->getPenalty();
                                         }
                                         $totalQuarterlyNetDue += $dueArrayList["Q3"]->getBasicTax() + $dueArrayList["Q3"]->getSefTax() + $dueArrayList["Q3"]->getIdleTax();
                                         $totalQuarterlyNetDue -= $dueArrayList["Q3"]->getEarlyPaymentDiscount() + $dueArrayList["Q3"]->getAdvancedPaymentDiscount();
                                         if (!$amnestyStatus["Q3"]) {
                                             $totalQuarterlyNetDue += $dueArrayList["Q3"]->getPenalty();
                                         }
                                         $totalQuarterlyNetDue += $dueArrayList["Q4"]->getBasicTax() + $dueArrayList["Q4"]->getSefTax() + $dueArrayList["Q4"]->getIdleTax();
                                         $totalQuarterlyNetDue -= $dueArrayList["Q4"]->getEarlyPaymentDiscount() + $dueArrayList["Q4"]->getAdvancedPaymentDiscount();
                                         if (!$amnestyStatus["Q4"]) {
                                             $totalQuarterlyNetDue += $dueArrayList["Q4"]->getPenalty();
                                         }
                                         $totalAnnualNetDue = 0;
                                         $totalAnnualNetDue += $dueArrayList["Annual"]->getBasicTax() + $dueArrayList["Annual"]->getSefTax() + $dueArrayList["Annual"]->getIdleTax();
                                         $totalAnnualNetDue -= $dueArrayList["Annual"]->getEarlyPaymentDiscount() + $dueArrayList["Annual"]->getAdvancedPaymentDiscount();
                                         if (!$amnestyStatus["Annual"]) {
                                             $totalAnnualNetDue += $dueArrayList["Annual"]->getPenalty();
                                         }
                                         if ($latestPaymentDueType != "Annual" && $totalQuarterlyNetDue - $amountPaidForDue <= 0) {
                                             // all QUARTERLY DUES have been paid, modify Annual Due values
                                             $dueArrayList["Annual"]->setAdvancedPaymentDiscount(0);
                                             $dueArrayList["Annual"]->setEarlyPaymentDiscount(0);
                                             $dueArrayList["Annual"]->setMonthsOverDue(0);
                                             $dueArrayList["Annual"]->setPenaltyPercentage(0);
                                             $dueArrayList["Annual"]->setPenalty(0);
                                             $this->initialNetDue["Annual"] = $dueArrayList["Annual"]->getInitialNetDue();
                                             $this->tpl->set_var("advancedPaymentDiscount[Annual]", formatCurrency($dueArrayList["Annual"]->getAdvancedPaymentDiscount()));
                                             $this->tpl->set_var("earlyPaymentDiscount[Annual]", formatCurrency($dueArrayList["Annual"]->getEarlyPaymentDiscount()));
                                             $this->tpl->set_var("monthsOverDue[Annual]", $dueArrayList["Annual"]->getMonthsOverDue());
                                             $this->tpl->set_var("penaltyPercentage[Annual]", $dueArrayList["Annual"]->getPenaltyPercentage() * 100);
                                             $this->tpl->set_var("penalty[Annual]", formatCurrency($dueArrayList["Annual"]->getPenalty()));
                                             $this->tpl->set_var("amnesty[Annual]", "No");
                                             $this->tpl->set_var("initialNetDue[Annual]", formatCurrency($this->initialNetDue["Annual"]));
                                         } else {
                                             if ($latestPaymentDueType == "Annual" && $totalAnnualNetDue - $amountPaidForDue <= 0) {
                                                 // all of ANNUAL Due has been fully paid, modify Quarterly Due values
                                                 $quarterlyDueKeys = array("Q1", "Q2", "Q3", "Q4");
                                                 foreach ($quarterlyDueKeys as $dKey) {
                                                     $dueArrayList[$dKey]->setAdvancedPaymentDiscount(0);
                                                     $dueArrayList[$dKey]->setEarlyPaymentDiscount(0);
                                                     $dueArrayList[$dKey]->setMonthsOverDue(0);
                                                     $dueArrayList[$dKey]->setPenaltyPercentage(0);
                                                     $dueArrayList[$dKey]->setPenalty(0);
                                                     $this->initialNetDue[$dKey] = $dueArrayList[$dKey]->getInitialNetDue();
                                                     $this->tpl->set_var("advancedPaymentDiscount[" . $dKey . "]", formatCurrency($dueArrayList[$dKey]->getAdvancedPaymentDiscount()));
                                                     $this->tpl->set_var("earlyPaymentDiscount[" . $dKey . "]", formatCurrency($dueArrayList[$dKey]->getEarlyPaymentDiscount()));
                                                     $this->tpl->set_var("monthsOverDue[" . $dKey . "]", $dueArrayList[$dKey]->getMonthsOverDue());
                                                     $this->tpl->set_var("penaltyPercentage[" . $dKey . "]", $dueArrayList[$dKey]->getPenaltyPercentage() * 100);
                                                     $this->tpl->set_var("penalty[" . $dKey . "]", formatCurrency($dueArrayList[$dKey]->getPenalty()));
                                                     $this->tpl->set_var("amnesty[" . $dKey . "]", "No");
                                                     $this->tpl->set_var("initialNetDue[" . $dKey . "]", formatCurrency($this->initialNetDue[$dKey]));
                                                 }
                                             }
                                         }
                                     }
                                 }
                                 // display Backtaxes and previousTD Backtaxes
                                 $this->formArray["totalBacktaxesBalance"] = 0;
                                 $this->displayBacktaxTD($tvalue->getTdID());
                                 $precedingTDArray = $this->getPrecedingTDArray($tvalue);
                                 if (is_array($precedingTDArray)) {
                                     foreach ($precedingTDArray as $precedingTD) {
                                         $this->displayBacktaxTD($precedingTD->getTdID());
                                     }
                                 }
                                 $this->tpl->set_var("total", number_format($this->formArray["totalBacktaxesDue"], 2));
                                 $this->tpl->set_var("totalBacktaxesBalance", number_format($this->formArray["totalBacktaxesBalance"], 2));
                                 // grab dueID's and backtaxTDID's to run through payments
                                 // create $dueIDArray
                                 foreach ($dueArrayList as $due) {
                                     $this->dueIDArray[] = $due->getDueID();
                                 }
                                 $this->displayTotalPaid();
                                 $this->displayNetDue();
                                 $this->tdArrayList[$this->tdRecord["year"] . $this->tdArrayListCounter] = $this->tdRecord;
                                 $this->tdArrayListCounter++;
                                 unset($this->tdRecord);
                                 $this->tpl->set_var("ctr", $tdCtr);
                                 //$this->tpl->parse("defaultTDListBlock", "defaultTDList", true);
                                 //$this->tpl->parse("toggleTDListBlock", "toggleTDList", true);
                                 //$this->tpl->parse("TDListBlock", "TDList", true);
                                 //$this->tpl->set_var("BacktaxesListBlock", "");
                                 /*
                                 $this->tpl->set_var("LandBlock", "");
                                 $this->tpl->set_var("PlantsTreesBlock", "");
                                 $this->tpl->set_var("ImprovementsBuildingsBlock", "");
                                 $this->tpl->set_var("MachineriesBlock", "");
                                 */
                                 $tdCtr++;
                             }
                         } else {
                             $this->tpl->set_var("defaultTDListBlock", "//no default");
                             $this->tpl->set_var("toggleTDListBlock", "//no Toggle");
                             $this->tpl->set_var("TDListBlock", "");
                         }
                         $this->tpl->set_var("tdCtr", $tdCtr);
                         break;
                     case "landTotalMarketValue":
                         if (!$this->formArray[$key]) {
                             $this->formArray[$key] = $value;
                         }
                         break;
                     case "landTotalAssessedValue":
                         if (!$this->formArray[$key]) {
                             $this->formArray[$key] = $value;
                         }
                         break;
                     case "plantTotalMarketValue":
                         if (!$this->formArray[$key]) {
                             $this->formArray[$key] = $value;
                         }
                         break;
                     case "plantTotalAssessedValue":
                         if (!$this->formArray[$key]) {
                             $this->formArray[$key] = $value;
                         }
                         break;
                     case "bldgTotalMarketValue":
                         if (!$this->formArray[$key]) {
                             $this->formArray[$key] = $value;
                         }
                         break;
                     case "bldgTotalAssessedValue":
                         if (!$this->formArray[$key]) {
                             $this->formArray[$key] = $value;
                         }
                         break;
                     case "machTotalMarketValue":
                         if (!$this->formArray[$key]) {
                             $this->formArray[$key] = $value;
                         }
                         break;
                     case "machTotalAssessedValue":
                         if (!$this->formArray[$key]) {
                             $this->formArray[$key] = $value;
                         }
                         break;
                     case "totalMarketValue":
                         if (!$this->formArray[$key]) {
                             $this->formArray[$key] = $value;
                         }
                         break;
                     case "totalAssessedValue":
                         if (!$this->formArray[$key]) {
                             $this->formArray[$key] = $value;
                         }
                         break;
                     default:
                         $this->formArray[$key] = $value;
                 }
             }
             $this->formArray["totalMarketValue"] = $this->formArray["landTotalMarketValue"] + $this->formArray["plantTotalMarketValue"] + $this->formArray["bldgTotalMarketValue"] + $this->formArray["machTotalMarketValue"];
             $this->formArray["totalAssessedValue"] = $this->formArray["landTotalAssessedValue"] + $this->formArray["plantTotalAssessedValue"] + $this->formArray["bldgTotalAssessedValue"] + $this->formArray["machTotalAssessedValue"];
             unset($rptop);
             $AFSEncode = new SoapObject(NCCBIZ . "AFSEncode.php", "urn:Object");
             $rptop = new RPTOP();
             $rptop->setRptopID($this->formArray["rptopID"]);
             $rptop->setLandTotalMarketValue($this->formArray["landTotalMarketValue"]);
             $rptop->setLandTotalAssessedValue($this->formArray["landTotalAssessedValue"]);
             $rptop->setPlantTotalMarketValue($this->formArray["plantTotalMarketValue"]);
             $rptop->setPlantTotalPlantAssessedValue($this->formArray["plantTotalAssessedValue"]);
             $rptop->setBldgTotalMarketValue($this->formArray["bldgTotalMarketValue"]);
             $rptop->setBldgTotalAssessedValue($this->formArray["bldgTotalAssessedValue"]);
             $rptop->setMachTotalMarketValue($this->formArray["machTotalMarketValue"]);
             $rptop->setMachTotalAssessedValue($this->formArray["machTotalAssessedValue"]);
             $rptop->setTotalMarketValue($this->formArray["totalMarketValue"]);
             $rptop->setTotalAssessedValue($this->formArray["totalAssessedValue"]);
             $rptop->setCreatedBy($this->userID);
             $rptop->setModifiedBy($this->userID);
             $rptop->setDomDocument();
             $RPTOPEncode = new SoapObject(NCCBIZ . "RPTOPEncode.php", "urn:Object");
             $rptop->setDomDocument();
             $doc = $rptop->getDomDocument();
             $xmlStr = $doc->dump_mem(true);
             //echo $xmlStr;
             if (!($ret = $RPTOPEncode->updateRPTOPtotals($xmlStr))) {
                 echo "ret=" . $ret;
             }
             //echo $ret;
         }
     }
     if (is_array($this->tdArrayList)) {
         ksort($this->tdArrayList);
         reset($this->tdArrayList);
         //			$this->tpl->set_block("rptsTemplate", "TDList", "TDListBlock");
         $this->tpl->set_block("rptsTemplate", "Page", "PageBlock");
         $this->tpl->set_block("Page", "TDList", "TDListBlock");
         $this->tpl->set_block("Page", "TotalDue", "TotalDueBlock");
         $this->formArray["totalTaxDue"] = 0;
         $maxRows = 20;
         $numRows = count($this->tdArrayList);
         $numPages = ceil($numRows / $maxRows);
         $rowStr = "";
         $j = 0;
         $page = 0;
         foreach ($this->tdArrayList as $tdRecord) {
             ++$j;
             if ($j > $maxRows) {
                 $this->formArray["tdYPosValue"] = "564";
                 $this->tpl->set_var("TDListBlock", $rowStr);
                 $this->tpl->set_var("PageNumber", ++$page);
                 if ($page == $numPages) {
                     $this->tpl->set_var("TotalDueBlock", $this->tpl->subst("TotalDue"));
                 } else {
                     $this->tpl->set_var("TotalDueBlock", "");
                 }
                 $this->tpl->parse("PageBlock", "Page", true);
                 $rowStr = "";
                 $j = 1;
             }
             $this->tpl->set_var("arpNumber", $tdRecord["arpNumber"]);
             $this->tpl->set_var("class", $tdRecord["class"]);
             $this->tpl->set_var("location", $tdRecord["location"]);
             $this->tpl->set_var("year", $tdRecord["year"]);
             $this->tpl->set_var("taxDue", formatCurrency($tdRecord["taxDue"]));
             $this->tpl->set_var("tdYPos", $this->formArray["tdYPosValue"]);
             $this->formArray["tdYPosValue"] -= 15;
             $this->formArray["totalTaxDue"] += $tdRecord["taxDue"];
             $rowStr .= $this->tpl->subst("TDList");
         }
         $this->tpl->set_var("TDListBlock", $rowStr);
         $this->tpl->set_var("PageNumber", ++$page);
         if ($page == $numPages) {
             $this->tpl->set_var("TotalDueBlock", $this->tpl->subst("TotalDue"));
         } else {
             $this->tpl->set_var("TotalDueBlock", "");
         }
         $this->tpl->parse("PageBlock", "Page", true);
         //			echo $this->tpl->subst("Page");
         /*
         			$maxRows = 5;
         			$numRows = count($this->tdArrayList);
         			$numPages = ceil($numRows/$maxRows);
         			$tdRecord = current($this->tdArrayList);
         			for ($page=0; $page<$numPages; ++$page) {
         				$rowStr = "";
         				$this->formArray["tdYPosValue"] = "564";
         				for ($currRow=0; $currRow<$maxRows; ++$currRow) {
         //					$tdRecord = $this->tdArrayList[($page*$maxRows)+$currRow];
         
         					$this->tpl->set_var("arpNumber", $tdRecord["arpNumber"]);
         					$this->tpl->set_var("class", $tdRecord["class"]);
         					$this->tpl->set_var("location", $tdRecord["location"]);
         					$this->tpl->set_var("year", $tdRecord["year"]);
         					$this->tpl->set_var("taxDue", formatCurrency($tdRecord["taxDue"]));
         					$this->tpl->set_var("tdYPos", $this->formArray["tdYPosValue"]);
         					$this->formArray["tdYPosValue"]-=15;
         					$rowStr .= $this->tpl->subst("TDList");
         
         					$this->formArray["totalTaxDue"] += $tdRecord["taxDue"];
         					$tdRecord = next($this->tdArrayList);
         				}
         				echo $rowStr;
         				$this->tpl->set_var("TDListBlock", $rowStr);
         				$this->tpl->set_var("PageNum", $page+1);
         				$this->tpl->parse("PageBlock", "Page", true);
         			}
         
         			foreach($this->tdArrayList as $tdRecord){
         				$this->tpl->set_var("arpNumber", $tdRecord["arpNumber"]);
         				$this->tpl->set_var("class", $tdRecord["class"]);
         				$this->tpl->set_var("location", $tdRecord["location"]);
         				$this->tpl->set_var("year", $tdRecord["year"]);
         				$this->tpl->set_var("taxDue", formatCurrency($tdRecord["taxDue"]));
         				$this->tpl->set_var("tdYPos", $this->formArray["tdYPosValue"]);
         
         				$this->formArray["totalTaxDue"] += $tdRecord["taxDue"];
         				$this->tpl->parse("TDListBlock", "TDList", true);
         				$this->formArray["tdYPosValue"]-=15;
         			}
         */
     }
     $this->setForm();
     /*
     $this->setPageDetailPerms();
     
     $this->tpl->set_var("uname", $this->user["uname"]);
     
     $this->tpl->set_var("today", date("F j, Y",strtotime($this->now)));
     
     $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");
     */
     $this->tpl->set_var("today", date("F j, Y", strtotime($this->now)));
     $this->setLguDetails();
     $this->tpl->parse("templatePage", "rptsTemplate");
     $this->tpl->finish("templatePage");
     $testpdf = new PDFWriter();
     $testpdf->setOutputXML($this->tpl->get("templatePage"), "test");
     if (isset($this->formArray["print"])) {
         $testpdf->writePDF($name);
         //,$this->formArray["print"]);
     } else {
         $testpdf->writePDF($name);
     }
     //		header("location: ".$testpdf->pdfPath);
     exit;
 }
コード例 #10
0
 function formatCurrencyFigures()
 {
     $suffixKey = 1;
     for ($suffixKey = 1; $suffixKey <= 11; $suffixKey++) {
         $this->formArray["paidBasic" . $suffixKey] = formatCurrency($this->formArray["paidBasic" . $suffixKey]);
         $this->formArray["discountBasic" . $suffixKey] = formatCurrency($this->formArray["discountBasic" . $suffixKey]);
         $this->formArray["priorBasic" . $suffixKey] = formatCurrency($this->formArray["priorBasic" . $suffixKey]);
         $this->formArray["penaltyBasic" . $suffixKey] = formatCurrency($this->formArray["penaltyBasic" . $suffixKey]);
         $this->formArray["priorPenaltyBasic" . $suffixKey] = formatCurrency($this->formArray["priorPenaltyBasic" . $suffixKey]);
         $this->formArray["totalNetBasic" . $suffixKey] = formatCurrency($this->formArray["totalNetBasic" . $suffixKey]);
         $this->formArray["paidSEF" . $suffixKey] = formatCurrency($this->formArray["paidSEF" . $suffixKey]);
         $this->formArray["discountSEF" . $suffixKey] = formatCurrency($this->formArray["discountSEF" . $suffixKey]);
         $this->formArray["priorSEF" . $suffixKey] = formatCurrency($this->formArray["priorSEF" . $suffixKey]);
         $this->formArray["penaltySEF" . $suffixKey] = formatCurrency($this->formArray["penaltySEF" . $suffixKey]);
         $this->formArray["priorPenaltySEF" . $suffixKey] = formatCurrency($this->formArray["priorPenaltySEF" . $suffixKey]);
         $this->formArray["totalNetSEF" . $suffixKey] = formatCurrency($this->formArray["totalNetSEF" . $suffixKey]);
         $this->formArray["paidIdle" . $suffixKey] = formatCurrency($this->formArray["paidIdle" . $suffixKey]);
         $this->formArray["priorIdle" . $suffixKey] = formatCurrency($this->formArray["priorIdle" . $suffixKey]);
         $this->formArray["penaltyIdle" . $suffixKey] = formatCurrency($this->formArray["penaltyIdle" . $suffixKey]);
         $this->formArray["totalIdle" . $suffixKey] = formatCurrency($this->formArray["totalIdle" . $suffixKey]);
         $this->formArray["specialLevy" . $suffixKey] = formatCurrency($this->formArray["specialLevy" . $suffixKey]);
         $this->formArray["totalNonCash" . $suffixKey] = formatCurrency($this->formArray["totalNonCash" . $suffixKey]);
         $this->formArray["grandTotalNetCol" . $suffixKey] = formatCurrency($this->formArray["grandTotalNetCol" . $suffixKey]);
     }
     $this->formArray["totalPaidBasic"] = formatCurrency($this->formArray["totalPaidBasic"]);
     $this->formArray["totalDiscountBasic"] = formatCurrency($this->formArray["totalDiscountBasic"]);
     $this->formArray["totalPriorBasic"] = formatCurrency($this->formArray["totalPriorBasic"]);
     $this->formArray["totalPenaltyBasic"] = formatCurrency($this->formArray["totalPenaltyBasic"]);
     $this->formArray["totalPriorPenaltyBasic"] = formatCurrency($this->formArray["totalPriorPenaltyBasic"]);
     $this->formArray["totalTotalNetBasic"] = formatCurrency($this->formArray["totalTotalNetBasic"]);
     $this->formArray["totalPaidSEF"] = formatCurrency($this->formArray["totalPaidSEF"]);
     $this->formArray["totalDiscountSEF"] = formatCurrency($this->formArray["totalDiscountSEF"]);
     $this->formArray["totalPriorSEF"] = formatCurrency($this->formArray["totalPriorSEF"]);
     $this->formArray["totalPenaltySEF"] = formatCurrency($this->formArray["totalPenaltySEF"]);
     $this->formArray["totalPriorPenaltySEF"] = formatCurrency($this->formArray["totalPriorPenaltySEF"]);
     $this->formArray["totalTotalNetSEF"] = formatCurrency($this->formArray["totalTotalNetSEF"]);
     $this->formArray["totalPaidIdle"] = formatCurrency($this->formArray["totalPaidIdle"]);
     $this->formArray["totalPriorIdle"] = formatCurrency($this->formArray["totalPriorIdle"]);
     $this->formArray["totalPenaltyIdle"] = formatCurrency($this->formArray["totalPenaltyIdle"]);
     $this->formArray["totalTotalIdle"] = formatCurrency($this->formArray["totalTotalIdle"]);
     $this->formArray["totalSpecialLevy"] = formatCurrency($this->formArray["totalSpecialLevy"]);
     $this->formArray["totalTotalNonCash"] = formatCurrency($this->formArray["totalTotalNonCash"]);
     $this->formArray["totalGrandTotalNetCol"] = formatCurrency($this->formArray["totalGrandTotalNetCol"]);
 }
コード例 #11
0
    }
    if ($semiannually >= 0) {
        $output .= '<option value="semiannually">' . $_LANG['orderpaymentterm6month'] . ' - ' . formatCurrency($semiannually / 6) . '/mo';
        if ($ssetupfee != "0.00") {
            $output .= " + " . formatCurrency($ssetupfee) . " " . $_LANG['ordersetupfee'];
        }
        $output .= '</option>';
    }
    if ($quarterly >= 0) {
        $output .= '<option value="quarterly">' . $_LANG['orderpaymentterm3month'] . ' - ' . formatCurrency($quarterly / 3) . '/mo';
        if ($qsetupfee != "0.00") {
            $output .= " + " . formatCurrency($qsetupfee) . " " . $_LANG['ordersetupfee'];
        }
        $output .= '</option>';
    }
    if ($monthly >= 0) {
        $output .= '<option value="monthly">' . $_LANG['orderpaymenttermmonthly'] . ' - ' . formatCurrency($monthly) . '/mo';
        if ($msetupfee != "0.00") {
            $output .= " + " . formatCurrency($msetupfee) . " " . $_LANG['ordersetupfee'];
        }
        $output .= '</option>';
    }
    $output .= '</select>';
}
$output .= ' <input type="submit" value="' . $_LANG['domainordernow'] . '" /></form>';
widgetoutput($output);
function widgetoutput($value)
{
    echo "document.write('" . addslashes($value) . "');";
    exit;
}
コード例 #12
0
ファイル: domainfunctions.php プロジェクト: billyprice1/whmcs
function getTLDPriceList($tld, $display = "", $renewpricing = "", $userid = "")
{
    global $currency;
    if ($renewpricing == "renew") {
        $renewpricing = true;
    }
    $currency_id = $currency['id'];
    $result = select_query("tbldomainpricing", "id", array("extension" => $tld));
    $data = mysql_fetch_array($result);
    $id = $data['id'];
    if (!$userid && isset($_SESSION['uid'])) {
        $userid = $_SESSION['uid'];
    }
    $clientgroupid = $userid ? get_query_val("tblclients", "groupid", array("id" => $userid)) : "0";
    $checkfields = array("msetupfee", "qsetupfee", "ssetupfee", "asetupfee", "bsetupfee", "monthly", "quarterly", "semiannually", "annually", "biennially");
    if (!$renewpricing || $renewpricing === "transfer") {
        $data = get_query_vals("tblpricing", "", array("type" => "domainregister", "currency" => $currency_id, "relid" => $id, "tsetupfee" => $clientgroupid));
        if (!$data) {
            $data = get_query_vals("tblpricing", "", array("type" => "domainregister", "currency" => $currency_id, "relid" => $id, "tsetupfee" => "0"));
        }
        foreach ($checkfields as $k => $v) {
            $register[$k + 1] = $data[$v];
        }
        $data = get_query_vals("tblpricing", "", array("type" => "domaintransfer", "currency" => $currency_id, "relid" => $id, "tsetupfee" => $clientgroupid));
        if (!$data) {
            $data = get_query_vals("tblpricing", "", array("type" => "domaintransfer", "currency" => $currency_id, "relid" => $id, "tsetupfee" => "0"));
        }
        foreach ($checkfields as $k => $v) {
            $transfer[$k + 1] = $data[$v];
        }
    }
    if (!$renewpricing || $renewpricing !== "transfer") {
        $data = get_query_vals("tblpricing", "", array("type" => "domainrenew", "currency" => $currency_id, "relid" => $id, "tsetupfee" => $clientgroupid));
        if (!$data) {
            $data = get_query_vals("tblpricing", "", array("type" => "domainrenew", "currency" => $currency_id, "relid" => $id, "tsetupfee" => "0"));
        }
        foreach ($checkfields as $k => $v) {
            $renew[$k + 1] = $data[$v];
        }
    }
    $tldpricing = array();
    $years = 1;
    while ($years <= 10) {
        if ($renewpricing === "transfer") {
            if (0 < $register[$years] && 0 <= $transfer[$years]) {
                if ($display) {
                    $transfer[$years] = formatCurrency($transfer[$years]);
                }
                $tldpricing[$years]['transfer'] = $transfer[$years];
            }
        } else {
            if ($renewpricing) {
                if (0 < $renew[$years]) {
                    if ($display) {
                        $renew[$years] = formatCurrency($renew[$years]);
                    }
                    $tldpricing[$years]['renew'] = $renew[$years];
                }
            } else {
                if (0 < $register[$years]) {
                    if ($display) {
                        $register[$years] = formatCurrency($register[$years]);
                    }
                    $tldpricing[$years]['register'] = $register[$years];
                    if (0 <= $transfer[$years]) {
                        if ($display) {
                            $transfer[$years] = formatCurrency($transfer[$years]);
                        }
                        $tldpricing[$years]['transfer'] = $transfer[$years];
                    }
                    if (0 < $renew[$years]) {
                        if ($display) {
                            $renew[$years] = formatCurrency($renew[$years]);
                        }
                        $tldpricing[$years]['renew'] = $renew[$years];
                    }
                }
            }
        }
        $years += 1;
    }
    return $tldpricing;
}
コード例 #13
0
ファイル: Order.php プロジェクト: jewelhuq/erp
    public function generatePDF($id, $pdfID)
    {
        global $dbh;
        global $SETTINGS;
        $filename = 'Default';
        $html = '';
        if ($pdfID == 1) {
            //TODO: make this look a bit nicer
            //TODO: padding doesn't work in tables in tcpdf, another option might be dompdf (https://github.com/dompdf/dompdf)
            $filename = 'Invoice';
            $html = '<body style="font-size:1em;">
					<div style="width:640px; margin:0 auto;">
					<span style="font-weight:bold; font-size:1.5em;">' . $SETTINGS['companyName'] . '</span>
					<div style="border-bottom: 2px solid #E5E5E5; margin:5px 0;">&nbsp;</div><br>
					Thank you for your order.  Your invoice is below.<br><br>';
            //get order info
            $sth = $dbh->prepare('SELECT date
						FROM orders
						WHERE orderID = :orderID');
            $sth->execute([':orderID' => $id]);
            $row = $sth->fetch();
            $html .= '<b>Order ID:</b> ' . $id . '<br>
						<b>Order Date:</b> ' . formatDate($row['date']) . '<br><br>
						<table style="width:100%;">
							<thead>
								<tr style="font-weight:bold;">
									<th style="width:40%;">Item</th>
									<th style="text-align:center; width:20%;">Quantity</th>
									<th style="text-align:center; width:20%;">Unit Price</th>
									<th style="text-align:right; width:20%;">Item Total</th>
								</tr>
							</thead>
							<tbody>';
            //get line items
            $lineItemTable = self::getLineItemTable($id);
            foreach ($lineItemTable[0] as $line) {
                if ($line['type'] == 'service' || $line['type'] == 'product') {
                    $recurringStr = !is_null($line['recurring']) ? ' (occurs monthly on day ' . $line['recurring'][0] . ' from ' . formatDate($line['recurring'][1]) . ' to ' . formatDate($line['recurring'][2]) . ')' : '';
                    $dateStr = isset($line['date']) ? formatDate($line['date']) . ': ' : '';
                    $html .= '<tr><td style="width:40%;">' . $dateStr . $line['name'] . $recurringStr . '</td>';
                    $html .= '<td style="text-align:center; width:20%;">' . formatNumber($line['quantity']) . '</td>';
                    $html .= '<td style="text-align:center; width:20%;">' . formatCurrency($line['unitPrice']) . '</td>';
                    $html .= '<td style="text-align:right; width:20%;">' . formatCurrency($line['lineAmount']) . '</td></tr>';
                } elseif ($line['type'] == 'discount') {
                    $unitPrice = $line['discountType'] == 'C' ? formatCurrency(-$line['discountAmount']) : $line['discountAmount'] . '%';
                    $html .= '<tr><td>Discount: ' . $line['name'] . '</td><td></td>';
                    $html .= '<td style="text-align:center;">' . $unitPrice . '</td>';
                    $html .= '<td style="text-align:right;">' . formatCurrency(-$line['lineAmount']) . '</td></tr>';
                }
            }
            $html .= '</tbody>
						</table>';
            //find amount paid
            $sth = $dbh->prepare('SELECT SUM(paymentAmount)
							FROM orderPayments
							WHERE orderID = :orderID');
            $sth->execute([':orderID' => $id]);
            $row = $sth->fetch();
            $paidAmount = $row['SUM(paymentAmount)'];
            //print totals
            $html .= '<table style="width:100%; text-align:right;"><tbody>';
            $html .= '<tr><td>Total:</td><td>' . formatCurrency($lineItemTable[1]) . '</td></tr>';
            $html .= '<tr><td>Amount Paid:</td><td>' . formatCurrency($paidAmount, true) . '</td></tr>';
            $html .= '<tr style="font-weight: bold;"><td>Amount Due:</td><td>' . formatCurrency($lineItemTable[1] - $paidAmount, true) . '</td></tr>';
            $html .= '</tbody></table>
					</div>
				</body>
				';
        }
        return [$filename, $html];
    }
コード例 #14
0
ファイル: premium.php プロジェクト: mmorpg2015/ghtweb5
    ?>

    <?php 
    $this->widget('app.widgets.FlashMessages.FlashMessages');
    ?>

    <?php 
    echo CHtml::beginForm();
    ?>

        <?php 
    foreach ($gs['services_premium_cost'] as $row) {
        ?>

            <?php 
        $msg = Yii::t('main', '{n} день :cost|{n} дня :cost|{n} дней :cost|{n} дня :cost', array($row['days'], ':cost' => formatCurrency($row['cost'])));
        ?>
            
            <div class="button-group">
                <button type="submit" value="<?php 
        echo $row['days'];
        ?>
" class="button" name="period">
                    <span><?php 
        echo $msg;
        ?>
</span>
                </button>
            </div>

        <?php 
コード例 #15
0
                                            <td align="right" nowrap="nowrap">
                                                <?php 
echo $AppUI->_('Total Cost');
?>
                                            </td>
                                            <td nowrap="nowrap" style="text-align: left; padding-left: 40px;">
                                                <?php 
echo $w2Pconfig['currency_symbol'];
?>
&nbsp;
                                                <?php 
$totalCosts = 0;
if (isset($results['totalCosts'])) {
    $totalCosts = $results['totalCosts'];
}
echo formatCurrency($totalCosts, $AppUI->getPref('CURRENCYFORM'));
?>
                                            </td>
                                        </tr>
                                    </table>
                                </td>
                            </tr>
                            <?php 
if (isset($results['uncountedHours']) && $results['uncountedHours']) {
    ?>
                            <tr>
                                <td colspan="2" align="center" class="hilite">
                                    <?php 
    echo '<span style="float:right; font-style: italic;">' . $results['uncountedHours'] . ' hours without billing codes</span>';
    ?>
                                </td>
コード例 #16
0
echo arraySelect($times, 'pref_name[TIMEFORMAT]', 'class=text size=1', $prefs['TIMEFORMAT'], false);
?>
	</td>
</tr>

<tr>
	<td align="right"><?php 
echo $AppUI->_('Currency Format');
?>
:</td>
	<td>
<?php 
$currencies = array();
$currEx = 1234567.89;
foreach (array_keys($LANGUAGES) as $lang) {
    $currencies[$lang] = formatCurrency($currEx, $AppUI->setUserLocale($lang, false));
}
echo arraySelect($currencies, 'pref_name[CURRENCYFORM]', 'class=text size=1', $prefs['CURRENCYFORM'], false);
?>
	</td>
</tr>

<tr>
	<td align="right"><?php 
echo $AppUI->_('User Interface Style');
?>
:</td>
	<td>
<?php 
$uis = $prefs['UISTYLE'] ? $prefs['UISTYLE'] : 'default';
$styles = $AppUI->readDirs('style');
コード例 #17
0
ファイル: productsinfo.php プロジェクト: MarcelaGotta/Webty
    // Verify user input for currency exists, is numeric, and as is a valid id
    $billingCycle = $whmcs->get_req_var('billingcycle');
    $currencyID = $whmcs->get_req_var('currency');
    if (!is_numeric($currencyID)) {
        $currency = array();
    } else {
        $currency = getCurrency('', $currencyID);
    }
    if (!$currency || !is_array($currency) || !isset($currency['id'])) {
        $currency = getCurrency();
    }
    $currencyID = $currency['id'];
    $result = select_query("tblpricing", "", array("type" => "product", "currency" => $currencyID, "relid" => $pid));
    $data = mysql_fetch_array($result);
    $price = $data[$billingCycle];
    $price = formatCurrency($price);
    widgetOutput($price);
} else {
    widgetOutput('Invalid get option. Valid options are "name", "description", "configoption", "orderurl" or "price"');
}
/**
 * The function to output the widget data to the browser in a javascript format.
 *
 * @throws WHMCS\Exception\ProgramExit
 * @param string $value the data to output
 */
function widgetOutput($value)
{
    echo "document.write('" . addslashes($value) . "');";
    throw new ProgramExit();
}
コード例 #18
0
ファイル: domainpricing.php プロジェクト: carriercomm/whmcs-5
<style type="text/css">
table.domainpricing {
    width: 600px;
    background-color: #ccc;
}
table.domainpricing th {
    padding: 3px;
    background-color: #efefef;
    font-weight: bold;
}
table.domainpricing td {
    padding: 3px;
    background-color: #fff;
    text-align: center;
}
</style>
<script language="javascript" src="feeds/domainpricing.php"></script>
*/
$currency = $currency ? getCurrency('', $currency) : getCurrency();
$code = '<table cellspacing="1" cellpadding="0" class="domainpricing"><tr><th>TLD</th><th>Min. Years</th><th>Register</th><th>Transfer</th><th>Renew</th></tr>';
$freeamt = formatCurrency(0);
$tldslist = getTLDList();
foreach ($tldslist as $tld) {
    $tldpricing = getTLDPriceList($tld, true);
    $firstoption = current($tldpricing);
    $year = key($tldpricing);
    $transfer = $firstoption["transfer"] == $freeamt ? $_LANG['orderfree'] : $firstoption["transfer"];
    $code .= '<tr><td>' . $tld . '</td><td>' . $year . '</td><td>' . $firstoption["register"] . '</td><td>' . $transfer . '</td><td>' . $firstoption["renew"] . '</td></tr>';
}
$code .= '</table>';
echo "document.write('" . $code . "');";
コード例 #19
0
ファイル: CalculateRPTOP.php プロジェクト: armic/erpts
 function Main()
 {
     switch ($this->formArray["formAction"]) {
         case "delete":
             //print_r($this->formArray);
             if (count($this->formArray["rptopID"]) > 0) {
                 $RPTOPList = new SoapObject(NCCBIZ . "RPTOPList.php", "urn:Object");
                 if (!($deletedRows = $RPTOPList->deleteRPTOP($this->formArray["rptopID"]))) {
                     $this->tpl->set_var("msg", "SOAP failed");
                 } else {
                     $this->tpl->set_var("msg", $deletedRows . " records deleted");
                 }
             } else {
                 $this->tpl->set_var("msg", "0 records deleted");
             }
             break;
         case "search":
             $RPTOPList = new SoapObject(NCCBIZ . "RPTOPList.php", "urn:Object");
             $this->tpl->set_block("rptsTemplate", "Pages", "PagesBlock");
             if (!($count = $RPTOPList->getSearchCount($this->formArray["searchKey"]))) {
                 $this->tpl->set_var("PagesBlock", "");
                 $numOfPages = 1;
                 $this->tpl->set_block("rptsTemplate", "PageNavigator", "PageNavigatorBlock");
                 $this->tpl->set_var("PageNavigatorBlock", "");
             } else {
                 $numOfPages = ceil($count / PAGE_BY);
                 for ($i = 1; $i <= $numOfPages; $i++) {
                     if ($i == $this->formArray["page"]) {
                         $this->tpl->set_var("pages", "");
                         $this->tpl->set_var("pagesUrl", "");
                         $this->tpl->set_var("paged", $i);
                     } 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->sortBlocks();
             if (!($xmlStr = $RPTOPList->searchRPTOP($this->formArray["page"], $condition, $this->formArray["searchKey"]))) {
                 $this->tpl->set_var("pageOf", "");
                 $this->tpl->set_block("rptsTemplate", "RPTOPTable", "RPTOPTableBlock");
                 $this->tpl->set_var("RPTOPTableBlock", "");
                 $this->tpl->set_block("rptsTemplate", "RPTOPDBEmpty", "RPTOPDBEmptyBlock");
                 $this->tpl->set_var("RPTOPDBEmptyBlock", "");
                 $this->tpl->set_block("rptsTemplate", "Pages", "PagesBlock");
                 $this->tpl->set_var("PagesBlock", "");
                 $this->tpl->set_var("previousTxt", "");
                 $this->tpl->set_var("nextTxt", "");
             } else {
                 if (!($domDoc = domxml_open_mem($xmlStr))) {
                     $this->tpl->set_block("rptsTemplate", "RPTOPListTable", "RPTOPListTableBlock");
                     $this->tpl->set_var("RPTOPListTableBlock", "error xmlDoc");
                 } else {
                     $this->tpl->set_block("rptsTemplate", "NotFound", "NotFoundBlock");
                     $this->tpl->set_var("NotFoundBlock", "");
                     $rptopRecords = new RPTOPRecords();
                     $rptopRecords->parseDomDocument($domDoc);
                     $list = $rptopRecords->getArrayList();
                     if (count($list)) {
                         $this->tpl->set_block("rptsTemplate", "RPTOPDBEmpty", "RPTOPDBEmptyBlock");
                         $this->tpl->set_var("RPTOPDBEmptyBlock", "");
                         $this->tpl->set_block("rptsTemplate", "RPTOPList", "RPTOPListBlock");
                         $this->tpl->set_block("RPTOPList", "PersonList", "PersonListBlock");
                         $this->tpl->set_block("RPTOPList", "CompanyList", "CompanyListBlock");
                         foreach ($list as $key => $value) {
                             $this->tpl->set_var("rptopID", $value->getRptopID());
                             $oValue = $value->owner;
                             $pOwnerStr = "";
                             if (count($oValue->personArray)) {
                                 foreach ($oValue->personArray as $pKey => $pValue) {
                                     $this->tpl->set_var("personID", $pValue->getPersonID());
                                     $this->tpl->set_var("OwnerPerson", $pValue->getFullName());
                                     $this->tpl->parse("PersonListBlock", "PersonList", true);
                                 }
                             }
                             if (count($oValue->companyArray)) {
                                 foreach ($oValue->companyArray as $cKey => $cValue) {
                                     $this->tpl->set_var("companyID", $cValue->getCompanyID());
                                     $this->tpl->set_var("OwnerCompany", $cValue->getCompanyName());
                                     $this->tpl->parse("CompanyListBlock", "CompanyList", true);
                                 }
                             }
                             if (count($oValue->personArray) || count($oValue->companyArray)) {
                                 $this->tpl->set_var("none", "");
                             } else {
                                 $this->tpl->set_var("none", "none");
                             }
                             $this->tpl->set_var("totalMarketValue", number_format($value->getTotalMarketValue(), 2, '.', ','));
                             $this->tpl->set_var("totalAssessedValue", number_format($value->getTotalAssessedValue(), 2, '.', ','));
                             $this->tpl->set_var("taxableYear", $value->getTaxableYear());
                             // grab Dues of rptop to get totalTaxDue
                             $totalTaxDue = 0.0;
                             if (is_array($value->tdArray)) {
                                 foreach ($value->tdArray as $td) {
                                     $DueDetails = new SoapObject(NCCBIZ . "DueDetails.php", "urn:Object");
                                     $AFSDetails = new SoapObject(NCCBIZ . "AFSDetails.php", "urn:Object");
                                     $afsXml = $AFSDetails->getAfs($td->getAfsID());
                                     $afsDomDoc = domxml_open_mem($afsXml);
                                     $afs = new AFS();
                                     $afs->parseDomDocument($afsDomDoc);
                                     if (!($xmlStr = $DueDetails->getDueFromTdID($td->getTdID(), $value->getTaxableYear()))) {
                                         $totalTaxDue = "uncalculated";
                                         break;
                                     } else {
                                         if (!($domDoc = domxml_open_mem($xmlStr))) {
                                             $totalTaxDue = "uncalculated";
                                         } else {
                                             $due = new Due();
                                             $due->parseDomDocument($domDoc);
                                             $totalTaxDue += $due->getTaxDue();
                                         }
                                     }
                                 }
                             } else {
                                 $totalTaxDue = "no TD's";
                             }
                             if (is_numeric($totalTaxDue)) {
                                 $totalTaxDue = formatCurrency($totalTaxDue);
                             }
                             $this->tpl->set_var("totalTaxDue", $totalTaxDue);
                             $this->setRPTOPListBlockPerms();
                             $this->tpl->parse("RPTOPListBlock", "RPTOPList", true);
                             $this->tpl->set_var("PersonListBlock", "");
                             $this->tpl->set_var("CompanyListBlock", "");
                         }
                     } else {
                         $this->tpl->set_block("rptsTemplate", "RPTOPList", "RPTOPListBlock");
                         $this->tpl->set_var("RPTOPListBlock", "huh");
                     }
                 }
             }
             break;
         case "cancel":
             header("location: CalculateRPTOP.php");
             exit;
             break;
         default:
             $this->tpl->set_var("msg", "");
             $RPTOPList = new SoapObject(NCCBIZ . "RPTOPList.php", "urn:Object");
             $this->tpl->set_block("rptsTemplate", "Pages", "PagesBlock");
             $this->tpl->set_block("rptsTemplate", "NotFound", "NotFoundBlock");
             $this->tpl->set_var("NotFoundBlock", "");
             if (!($count = $RPTOPList->getRPTOPCount())) {
                 $this->tpl->set_var("PagesBlock", "");
                 $this->tpl->set_block("rptsTemplate", "PageNavigator", "PageNavigatorBlock");
                 $this->tpl->set_var("PageNavigatorBlock", "");
             } else {
                 $numOfPages = ceil($count / PAGE_BY);
                 for ($i = 1; $i <= $numOfPages; $i++) {
                     if ($i == $this->formArray["page"]) {
                         $this->tpl->set_var("pages", "");
                         $this->tpl->set_var("pagesUrl", "");
                         $this->tpl->set_var("paged", $i);
                     } 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->sortBlocks();
             if (!($xmlStr = $RPTOPList->getRPTOPList($this->formArray["page"], $condition))) {
                 $this->tpl->set_block("rptsTemplate", "RPTOPTable", "RPTOPTableBlock");
                 $this->tpl->set_var("RPTOPTableBlock", "");
             } else {
                 if (!($domDoc = domxml_open_mem($xmlStr))) {
                     $this->tpl->set_block("rptsTemplate", "RPTOPListTable", "RPTOPListTableBlock");
                     $this->tpl->set_var("RPTOPListTableBlock", "");
                 } else {
                     $rptopRecords = new RPTOPRecords();
                     $rptopRecords->parseDomDocument($domDoc);
                     $list = $rptopRecords->getArrayList();
                     if (count($list)) {
                         $this->tpl->set_block("rptsTemplate", "RPTOPDBEmpty", "RPTOPDBEmptyBlock");
                         $this->tpl->set_var("RPTOPDBEmptyBlock", "");
                         $this->tpl->set_block("rptsTemplate", "RPTOPList", "RPTOPListBlock");
                         $this->tpl->set_block("RPTOPList", "PersonList", "PersonListBlock");
                         $this->tpl->set_block("RPTOPList", "CompanyList", "CompanyListBlock");
                         foreach ($list as $key => $value) {
                             $this->tpl->set_var("rptopID", $value->getRptopID());
                             $oValue = $value->owner;
                             $pOwnerStr = "";
                             if (count($oValue->personArray)) {
                                 foreach ($oValue->personArray as $pKey => $pValue) {
                                     $this->tpl->set_var("personID", $pValue->getPersonID());
                                     $this->tpl->set_var("OwnerPerson", $pValue->getFullName());
                                     $this->tpl->parse("PersonListBlock", "PersonList", true);
                                 }
                             }
                             if (count($oValue->companyArray)) {
                                 foreach ($oValue->companyArray as $cKey => $cValue) {
                                     $this->tpl->set_var("companyID", $cValue->getCompanyID());
                                     $this->tpl->set_var("OwnerCompany", $cValue->getCompanyName());
                                     $this->tpl->parse("CompanyListBlock", "CompanyList", true);
                                 }
                             }
                             if (count($oValue->personArray) || count($oValue->companyArray)) {
                                 $this->tpl->set_var("none", "");
                             } else {
                                 $this->tpl->set_var("none", "none");
                             }
                             $this->tpl->set_var("totalMarketValue", number_format($value->getTotalMarketValue(), 2, '.', ','));
                             $this->tpl->set_var("totalAssessedValue", number_format($value->getTotalAssessedValue(), 2, '.', ','));
                             $this->tpl->set_var("taxableYear", $value->getTaxableYear());
                             // grab Dues of rptop to get totalTaxDue
                             $totalTaxDue = 0.0;
                             if (is_array($value->tdArray)) {
                                 foreach ($value->tdArray as $td) {
                                     $DueDetails = new SoapObject(NCCBIZ . "DueDetails.php", "urn:Object");
                                     $AFSDetails = new SoapObject(NCCBIZ . "AFSDetails.php", "urn:Object");
                                     $afsXml = $AFSDetails->getAfs($td->getAfsID());
                                     $afsDomDoc = domxml_open_mem($afsXml);
                                     $afs = new AFS();
                                     $afs->parseDomDocument($afsDomDoc);
                                     if (!($xmlStr = $DueDetails->getDueFromTdID($td->getTdID(), $value->getTaxableYear()))) {
                                         $totalTaxDue = "uncalculated";
                                         break;
                                     } else {
                                         if (!($domDoc = domxml_open_mem($xmlStr))) {
                                             $totalTaxDue = "uncalculated";
                                         } else {
                                             $due = new Due();
                                             $due->parseDomDocument($domDoc);
                                             $totalTaxDue += $due->getTaxDue();
                                         }
                                     }
                                 }
                             } else {
                                 $totalTaxDue = "no TD's";
                             }
                             if (is_numeric($totalTaxDue)) {
                                 $totalTaxDue = formatCurrency($totalTaxDue);
                             }
                             $this->tpl->set_var("totalTaxDue", $totalTaxDue);
                             $this->setRPTOPListBlockPerms();
                             $this->tpl->parse("RPTOPListBlock", "RPTOPList", true);
                             $this->tpl->set_var("PersonListBlock", "");
                             $this->tpl->set_var("CompanyListBlock", "");
                         }
                     } else {
                         $this->tpl->set_block("rptsTemplate", "RPTOPList", "RPTOPListBlock");
                         $this->tpl->set_var("RPTOPListBlock", "huh");
                     }
                 }
             }
     }
     $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");
 }
コード例 #20
0
 function Main()
 {
     $this->displayPageHeading();
     $this->tpl->set_block("rptsTemplate", "Page", "PageBlock");
     $this->tpl->set_block("Page", "CollectionList", "CollectionListBlock");
     $this->tpl->set_block("Page", "GrandTotal", "GrandTotalBlock");
     $collectionArrayList = $this->getCollectionArrayList();
     if (!is_array($collectionArrayList)) {
         exit("no results found for the selected owner in collection list or empty database");
     }
     $lineCounter = 0;
     $continuousLineCounter = 0;
     $count = count($collectionArrayList);
     $numOfPages = ceil($count / $this->formArray["collectionLinesPerPage"]);
     //		foreach($collectionArrayList as $key => $value){
     //			$keyArray[] = $key;
     //		}
     $tmpOwnerName = "";
     for ($collectionCounter = 0; $collectionCounter <= $count; $collectionCounter++) {
         if ($lineCounter == $this->formArray["collectionLinesPerPage"] || $collectionCounter == $count) {
             $this->formArray["stYPos"] = $this->formArray["cYPos"] - 30;
             $this->formArray["gtYPos"] = $this->formArray["stYPos"] - 20;
             $this->tpl->set_var("stYPos", $this->formArray["stYPos"]);
             $this->tpl->set_var("gtYPos", $this->formArray["gtYPos"]);
             $this->tpl->set_var("stBasicTax", formatCurrency($this->formArray["stBasicTax"]));
             $this->tpl->set_var("stSefTax", formatCurrency($this->formArray["stSefTax"]));
             $this->tpl->set_var("stTotal", formatCurrency($this->formArray["stTotal"]));
             if ($this->formArray["pageNumber"] < $numOfPages) {
                 $this->tpl->set_var("GrandTotalBlock", "");
             } else {
                 $this->tpl->set_var("gtBasicTax", formatCurrency($this->formArray["gtBasicTax"]));
                 $this->tpl->set_var("gtSefTax", formatCurrency($this->formArray["gtSefTax"]));
                 $this->tpl->set_var("gtTotal", formatCurrency($this->formArray["gtTotal"]));
                 $this->tpl->parse("GrandTotalBlock", "GrandTotal", false);
             }
             $this->tpl->set_var("pageNumber", $this->formArray["pageNumber"]);
             $this->tpl->parse("PageBlock", "Page", true);
             $this->tpl->set_var("CollectionListBlock", "");
             $this->formArray["pageNumber"]++;
             $this->formArray["cYPos"] = 616;
             $lineCounter = 0;
         }
         $collectionRecordArray = $collectionArrayList[$collectionCounter];
         if ($tmpOwnerName != $collectionRecordArray["ownerName"]) {
             $ownerName = $collectionRecordArray["ownerName"];
         } else {
             $ownerName = "''";
         }
         if (strlen($ownerName) > 22) {
             $this->tpl->set_var("ownerName", substr($ownerName, 0, 22) . "-");
             $this->tpl->set_var("ownerName2", substr($ownerName, 22));
             $cYPos2 = $this->formArray["cYPos"] - 12;
         } else {
             $this->tpl->set_var("ownerName", $ownerName);
             $this->tpl->set_var("ownerName2", "");
             $cYPos2 = 0;
         }
         $tmpOwnerName = $collectionRecordArray["ownerName"];
         $this->tpl->set_var("taxDeclarationNumber", $collectionRecordArray["taxDeclarationNumber"]);
         $this->tpl->set_var("datePaid", $collectionRecordArray["datePaid"]);
         $this->tpl->set_var("orNumber", $collectionRecordArray["orNumber"]);
         $this->tpl->set_var("basicTax", formatCurrency($collectionRecordArray["basicTax"]));
         $this->tpl->set_var("sefTax", formatCurrency($collectionRecordArray["sefTax"]));
         $this->tpl->set_var("total", formatCurrency($collectionRecordArray["total"]));
         $this->formArray["stBasicTax"] += $collectionRecordArray["basicTax"];
         $this->formArray["stSefTax"] += $collectionRecordArray["sefTax"];
         $this->formArray["stTotal"] += $collectionRecordArray["total"];
         $this->formArray["gtBasicTax"] += $collectionRecordArray["basicTax"];
         $this->formArray["gtSefTax"] += $collectionRecordArray["sefTax"];
         $this->formArray["gtTotal"] += $collectionRecordArray["total"];
         $this->tpl->set_var("cYPos", $this->formArray["cYPos"]);
         $this->tpl->set_var("cYPos2", $cYPos2);
         $this->formArray["cYPos"] -= 12;
         if ($cYPos2 > 0) {
             $this->formArray["cYPos"] -= 12;
             $lineCounter++;
         }
         $this->tpl->set_var("i", $continuousLineCounter + 1);
         $this->tpl->parse("CollectionListBlock", "CollectionList", true);
         $lineCounter++;
         $continuousLineCounter++;
     }
     $this->tpl->parse("templatePage", "rptsTemplate");
     $this->tpl->finish("templatePage");
     //		exit;
     $testpdf = new PDFWriter();
     $testpdf->setOutputXML($this->tpl->get("templatePage"), "test");
     if (isset($this->formArray["print"])) {
         $testpdf->writePDF($name);
         //,$this->formArray["print"]);
     } else {
         $testpdf->writePDF($name);
     }
 }
コード例 #21
0
ファイル: index.php プロジェクト: qhyabdoel/hris_mujigae
    echo formatCurrency($salary->basic_salary);
    ?>
</div>
						</div>
						
						<?php 
    $allowances = $salary->allowances;
    foreach ($allowances as $allowance) {
        ?>
							<div class="form-group">
								<label class="col-md-3 col-xs-12 control-label"><?php 
        echo CHtml::encode($allowance->allowance->name);
        ?>
</label>
								<div class="col-md-6 col-xs-12"><?php 
        echo formatCurrency($allowance->values);
        ?>
</div>
							</div>
						<?php 
    }
    ?>
					
					<?php 
}
?>
				</div>
			</div>
			<!-- END DEFAULT DATATABLE -->
		</div>
	</div>
コード例 #22
0
ファイル: clientsservices.php プロジェクト: billyprice1/whmcs
 }
 foreach ($serversarr2 as $k => $v) {
     $serversarr[$k] = $v;
 }
 $promoarr = array();
 $result = select_query("tblpromotions", "", "", "code", "ASC");
 while ($data = mysql_fetch_array($result)) {
     $promo_id = $data['id'];
     $promo_code = $data['code'];
     $promo_type = $data['type'];
     $promo_recurring = $data['recurring'];
     $promo_value = $data['value'];
     if ($promo_type == "Percentage") {
         $promo_value .= "%";
     } else {
         $promo_value = formatCurrency($promo_value);
     }
     if ($promo_type == "Free Setup") {
         $promo_value = $aInt->lang("promos", "freesetup");
     }
     $promo_recurring = $promo_recurring ? $aInt->lang("status", "recurring") : $aInt->lang("status", "onetime");
     if ($promo_type == "Price Override") {
         $promo_recurring = $aInt->lang("promos", "priceoverride");
     }
     if ($promo_type == "Free Setup") {
         $promo_recurring = "";
     }
     $promoarr[$promo_id] = $promo_code . " - " . $promo_value . " " . $promo_recurring;
 }
 $tbl = new WHMCS_Table();
 $tbl->add($aInt->lang("fields", "ordernum"), $orderid . " - <a href=\"orders.php?action=view&id=" . $orderid . "\">" . $aInt->lang("orders", "vieworder") . "</a>");
コード例 #23
0
    die("This file cannot be accessed directly");
}
$reportdata["title"] = "Affiliates Overview";
$reportdata["description"] = "An overview of affiliates for the current year";
$reportdata["tableheadings"] = array('Affiliate ID', 'Affiliate Name', 'Visitors', 'Pending Commissions', 'Available to Withdraw', 'Withdrawn Amount', 'YTD Total Commissions Paid');
$result = select_query("tblaffiliates", "tblaffiliates.id,tblaffiliates.clientid,tblaffiliates.visitors,tblaffiliates.balance,tblaffiliates.withdrawn,tblclients.firstname,tblclients.lastname,tblclients.companyname", "", "visitors", "DESC", "", "tblclients ON tblclients.id=tblaffiliates.clientid");
while ($data = mysql_fetch_array($result)) {
    $affid = $data['id'];
    $clientid = $data['clientid'];
    $visitors = $data['visitors'];
    $balance = $data['balance'];
    $withdrawn = $data['withdrawn'];
    $firstname = $data['firstname'];
    $lastname = $data['lastname'];
    $companyname = $data['companyname'];
    $name = $firstname . ' ' . $lastname;
    if ($companyname) {
        $name .= ' (' . $companyname . ')';
    }
    $result2 = select_query("tblaffiliatespending", "COUNT(*),SUM(tblaffiliatespending.amount)", array("affiliateid" => $affid), "clearingdate", "DESC", "", "tblaffiliatesaccounts ON tblaffiliatesaccounts.id=tblaffiliatespending.affaccid INNER JOIN tblhosting ON tblhosting.id=tblaffiliatesaccounts.relid INNER JOIN tblproducts ON tblproducts.id=tblhosting.packageid INNER JOIN tblclients ON tblclients.id=tblhosting.userid");
    $data = mysql_fetch_array($result2);
    $pendingcommissions = $data[0];
    $pendingcommissionsamount = $data[1];
    $result2 = select_query("tblaffiliateshistory", "SUM(amount)", "affiliateid={$affid} AND date LIKE '" . date("Y") . "-%'");
    $data = mysql_fetch_array($result2);
    $ytdtotal = $data[0];
    $currency = getCurrency($clientid);
    $pendingcommissionsamount = formatCurrency($pendingcommissionsamount);
    $ytdtotal = formatCurrency($ytdtotal);
    $reportdata["tablevalues"][] = array('<a href="affiliates.php?action=edit&id=' . $affid . '">' . $affid . '</a>', $name, $visitors, $pendingcommissionsamount, $balance, $withdrawn, $ytdtotal);
}
コード例 #24
0
ファイル: PaymentDetails.php プロジェクト: armic/erpts
 function Main()
 {
     switch ($this->formArray["formAction"]) {
         case "remove":
             //echo "removeOwnerRPTOP(".$this->formArray["rptopID"].",".$this->formArray["ownerID"].",".$this->formArray["personID"].",".$this->formArray["companyID"].")";
             $OwnerList = new SoapObject(NCCBIZ . "OwnerList.php", "urn:Object");
             if (count($this->formArray["personID"]) || count($this->formArray["companyID"])) {
                 if (!($deletedRows = $OwnerList->removeOwnerRPTOP($this->formArray["rptopID"], $this->formArray["ownerID"], $this->formArray["personID"], $this->formArray["companyID"]))) {
                     $this->tpl->set_var("msg", "SOAP failed");
                     //echo "SOAP failed";
                 } else {
                     $this->tpl->set_var("msg", $deletedRows . " records deleted");
                 }
             } else {
                 $this->tpl->set_var("msg", "0 records deleted");
             }
             header("location: RPTOPDetails.php" . $this->sess->url("") . $this->sess->add_query(array("rptopID" => $this->formArray["rptopID"])));
             exit;
             break;
         default:
             $this->tpl->set_var("msg", "");
     }
     //select
     $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);
             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_numeric($value)) {
                             $cityAssessor = new Person();
                             $cityAssessor->selectRecord($value);
                             $this->tpl->set_var("cityAssessorID", $cityAssessor->getPersonID());
                             $this->tpl->set_var("cityAssessorName", $cityAssessor->getFullName());
                             $this->formArray["cityAssessorName"] = $cityAssessor->getFullName();
                         } else {
                             $cityAssessor = $value;
                             $this->tpl->set_var("cityAssessorID", $cityAssessor);
                             $this->tpl->set_var("cityAssessorName", $cityAssessor);
                             $this->formArray["cityAssessorName"] = $cityAssessor;
                         }
                         break;
                     case "cityTreasurer":
                         if (is_numeric($value)) {
                             $cityTreasurer = new Person();
                             $cityTreasurer->selectRecord($value);
                             $this->tpl->set_var("cityTreasurerID", $cityTreasurer->getPersonID());
                             $this->tpl->set_var("cityTreasurerName", $cityTreasurer->getFullName());
                             $this->formArray["cityTreasurerName"] = $cityTreasurer->getFullName();
                         } else {
                             $cityTreasurer = $value;
                             $this->tpl->set_var("cityTreasurerID", $cityTreasurer);
                             $this->tpl->set_var("cityTreasurerName", $cityTreasurer);
                             $this->formArray["cityTreasurerName"] = $cityTreasurer;
                         }
                         break;
                     case "tdArray":
                         $this->tpl->set_block("rptsTemplate", "defaultTDList", "defaultTDListBlock");
                         $this->tpl->set_block("rptsTemplate", "toggleTDList", "toggleTDListBlock");
                         $this->tpl->set_block("rptsTemplate", "TDList", "TDListBlock");
                         $this->tpl->set_block("rptsTemplate", "JSTDList", "JSTDListBlock");
                         $this->tpl->set_block("TDList", "DueTypeList", "DueTypeListBlock");
                         $this->tpl->set_block("TDList", "BacktaxesList", "BacktaxesListBlock");
                         $this->tpl->set_block("JSTDList", "JSBacktaxesList", "JSBacktaxesListBlock");
                         $this->tpl->set_block("BacktaxesList", "BacktaxDueTypeList", "BacktaxDueTypeListBlock");
                         $tdCtr = 0;
                         if (count($value)) {
                             $this->tpl->set_block("rptsTemplate", "TDDBEmpty", "TDDBEmptyBlock");
                             $this->tpl->set_var("TDDBEmptyBlock", "");
                             foreach ($value as $tkey => $tvalue) {
                                 $this->tpl->set_var("tdID", $tvalue->getTDID());
                                 $this->tpl->set_var("taxDeclarationNumber", $tvalue->getTaxDeclarationNumber());
                                 $this->tpl->set_var("afsID", $tvalue->getAfsID());
                                 $this->tpl->set_var("cancelsTDNumber", $tvalue->getCancelsTDNumber());
                                 $this->tpl->set_var("canceledByTDNumber", $tvalue->getCanceledByTDNumber());
                                 $this->tpl->set_var("taxBeginsWithTheYear", $tvalue->getTaxBeginsWithTheYear());
                                 $this->tpl->set_var("ceasesWithTheYear", $tvalue->getCeasesWithTheYear());
                                 $this->tpl->set_var("enteredInRPARForBy", $tvalue->getEnteredInRPARForBy());
                                 $this->tpl->set_var("enteredInRPARForYear", $tvalue->getEnteredInRPARForYear());
                                 $this->tpl->set_var("previousOwner", $tvalue->getPreviousOwner());
                                 $this->tpl->set_var("previousAssessedValue", $tvalue->getPreviousAssessedValue());
                                 list($dateArr["year"], $dateArr["month"], $dateArr["day"]) = explode("-", $tvalue->getProvincialAssessorDate());
                                 $this->tpl->set_var("pa_yearValue", removePreZero($dateArr["year"]));
                                 $this->tpl->set_var("pa_month", removePreZero($dateArr["month"]));
                                 $this->tpl->set_var("pa_dayValue", removePreZero($dateArr["day"]));
                                 list($dateArr["year"], $dateArr["month"], $dateArr["day"]) = explode("-", $tvalue->getCityMunicipalAssessorDate());
                                 $this->tpl->set_var("cm_yearValue", removePreZero($dateArr["year"]));
                                 $this->tpl->set_var("cm_month", removePreZero($dateArr["month"]));
                                 $this->tpl->set_var("cm_dayValue", removePreZero($dateArr["day"]));
                                 $this->tpl->set_var("provincialAssessorName", $tvalue->provincialAssessor);
                                 $this->tpl->set_var("cityMunicipalAssessorName", $tvalue->cityMunicipalAssessor);
                                 $this->tpl->set_var("propertyType", $tvalue->getPropertyType());
                                 $this->tpl->set_var("basicTax", "");
                                 $this->tpl->set_var("sefTax", "");
                                 $this->tpl->set_var("total", "");
                                 $AFSDetails = new SoapObject(NCCBIZ . "AFSDetails.php", "urn:Object");
                                 if (!($xmlStr = $AFSDetails->getAFS($tvalue->getAfsID()))) {
                                     //
                                 } else {
                                     if (!($domDoc = domxml_open_mem($xmlStr))) {
                                         //
                                     } else {
                                         $afs = new AFS();
                                         $afs->parseDomDocument($domDoc);
                                         $this->formArray["landTotalMarketValue"] += $afs->getLandTotalMarketValue();
                                         $this->formArray["landTotalAssessedValue"] += $afs->getLandTotalAssessedValue();
                                         $this->formArray["plantTotalMarketValue"] += $afs->getPlantTotalMarketValue();
                                         $this->formArray["plantTotalAssessedValue"] += $afs->getPlantTotalAssessedValue();
                                         $this->formArray["bldgTotalMarketValue"] += $afs->getBldgTotalMarketValue();
                                         $this->formArray["bldgTotalAssessedValue"] += $afs->getBldgTotalAssessedValue();
                                         $this->formArray["machTotalMarketValue"] += $afs->getMachTotalMarketValue();
                                         $this->formArray["machTotalAssessedValue"] += $afs->getMachTotalAssessedValue();
                                         $this->formArray["totalMarketValue"] += $afs->getTotalMarketValue();
                                         $this->formArray["totalAssessedValue"] += $afs->getTotalAssessedValue();
                                         $this->tpl->set_var("marketValue", number_format($afs->getTotalMarketValue(), 2, '.', ','));
                                         $this->tpl->set_var("assessedValue", number_format($afs->getTotalAssessedValue(), 2, '.', ','));
                                         $this->tpl->set_var("taxability", $afs->getTaxability());
                                         $this->tpl->set_var("effectivity", $afs->getEffectivity());
                                         $this->formArray["idle"] = "No";
                                         if ($tvalue->getPropertyType() == "Land") {
                                             if (is_array($afs->landArray)) {
                                                 // if land is stripped
                                                 if (count($afs->landArray) > 1) {
                                                     foreach ($afs->landArray as $land) {
                                                         if ($land->getIdle() == "Yes") {
                                                             $this->formArray["idle"] = "Yes";
                                                             break;
                                                         }
                                                     }
                                                 } else {
                                                     $this->formArray["idle"] = $afs->landArray[0]->getIdle();
                                                 }
                                             }
                                         }
                                         if ($this->formArray["idle"] == "") {
                                             $this->formArray["idle"] = "No";
                                         }
                                         $this->tpl->set_var("idle", $this->formArray["idle"]);
                                     }
                                 }
                                 // grab DueRecords from tdID
                                 $DueList = new SoapObject(NCCBIZ . "DueList.php", "urn:Object");
                                 $dueArrayList = array("Annual" => "", "Q1" => "", "Q2" => "", "Q3" => "", "Q4" => "");
                                 $this->tpl->set_var("dueYear", $rptop->getTaxableYear());
                                 if (!($xmlStr = $DueList->getDueList($tvalue->getTdID(), $rptop->getTaxableYear()))) {
                                     foreach ($dueArrayList as $dueKey => $dueValue) {
                                         $this->tpl->set_var("basicTax[" . $dueKey . "]", "uncalculated");
                                         $this->tpl->set_var("sefTax[" . $dueKey . "]", "uncalculated");
                                         $this->tpl->set_var("idleTax[" . $dueKey . "]", "uncalculated");
                                         $this->tpl->set_var("taxDue[" . $dueKey . "]", "uncalculated");
                                         $this->tpl->set_var("dueDate[" . $dueKey . "]", "-");
                                     }
                                 } else {
                                     if (!($domDoc = domxml_open_mem($xmlStr))) {
                                         foreach ($dueArrayList as $dueKey => $dueValue) {
                                             $this->tpl->set_var("basicTax[" . $dueKey . "]", "uncalculated");
                                             $this->tpl->set_var("sefTax[" . $dueKey . "]", "uncalculated");
                                             $this->tpl->set_var("idleTax[" . $dueKey . "]", "uncalculated");
                                             $this->tpl->set_var("taxDue[" . $dueKey . "]", "uncalculated");
                                             $this->tpl->set_var("dueDate[" . $dueKey . "]", "-");
                                         }
                                     } else {
                                         $dueRecords = new DueRecords();
                                         $dueRecords->parseDomDocument($domDoc);
                                         foreach ($dueRecords->getArrayList() as $due) {
                                             foreach ($due as $dueKey => $dueValue) {
                                                 switch ($dueKey) {
                                                     case "dueType":
                                                         if ($dueValue == "Annual") {
                                                             $this->formArray["totalTaxDue"] += $due->getTaxDue();
                                                         }
                                                         $dueArrayList[$dueValue] = $due;
                                                         $this->tpl->set_var("basicTax[" . $dueValue . "]", formatCurrency($due->getBasicTax()));
                                                         $this->tpl->set_var("sefTax[" . $dueValue . "]", formatCurrency($due->getSEFTax()));
                                                         $this->tpl->set_var("idleTax[" . $dueValue . "]", formatCurrency($due->getIdleTax()));
                                                         $this->tpl->set_var("taxDue[" . $dueValue . "]", formatCurrency($due->getTaxDue()));
                                                         $this->tpl->set_var("dueDate[" . $dueValue . "]", date("M. d, Y", strtotime($due->getDueDate())));
                                                         $this->tpl->set_var("dueID[" . $dueValue . "]", $due->getDueID());
                                                         break;
                                                 }
                                             }
                                         }
                                         // initialize discountPeriod and discountPercentage for earlyPaymentDiscount
                                         $treasurySettings = $this->getTreasurySettings();
                                         $this->tpl->set_var("discountPercentage", $treasurySettings->getDiscountPercentage() . "%");
                                         $this->tpl->set_var("discountPeriod", "January 01, " . $rptop->getTaxableYear() . " - " . date("F d, Y", strtotime($rptop->getTaxableYear() . "-" . $treasurySettings->getDiscountPeriod())));
                                         $this->formArray["discountPercentage"] = $treasurySettings->getDiscountPercentage();
                                         $this->formArray["discountPeriod"] = $treasurySettings->getDiscountPeriod();
                                         $this->formArray["discountPeriod_End"] = strtotime($rptop->getTaxableYear() . "-" . $this->formArray["discountPeriod"]);
                                         $this->formArray["discountPeriod_Start"] = strtotime($rptop->getTaxableYear() . "-01-01");
                                         // initialize advancedDiscountPercentage for advancedPayment
                                         $this->tpl->set_var("advancedDiscountPercentage", $treasurySettings->getAdvancedDiscountPercentage() . "%");
                                         $this->formArray["advancedDiscountPercentage"] = $treasurySettings->getAdvancedDiscountPercentage();
                                         $this->tpl->set_var("q1AdvancedDiscountPercentage", $treasurySettings->getQ1AdvancedDiscountPercentage() . "%");
                                         $this->formArray["q1AdvancedDiscountPercentage"] = $treasurySettings->getQ1AdvancedDiscountPercentage();
                                         // initialize penaltyLUTArray
                                         $penaltyLUTArray = $this->getPenaltyLUTArray();
                                         // get paymentHistory
                                         $defaultDueType = "Annual";
                                         $allowableDueTypesArray = array("Annual", "Q1", "Q2", "Q3", "Q4");
                                         /* alxjvr 2006.03.22
                                         											if(!$paymentHistory = $this->getPaymentHistory($dueArrayList,"")){
                                         												$defaultDueType = "Annual";
                                         												$allowableDueTypesArray = array("Annual","Q1");
                                         											}
                                         											else{
                                         												$defaultDueType = $paymentHistory->arrayList[0]->getDueType();
                                         
                                         												if($defaultDueType=="Annual"){
                                         													$allowableDueTypesArray = array("Annual");
                                         												}
                                         												else{
                                         													switch($defaultDueType){
                                         														case "Q1":
                                         															$allowableDueTypesArray = array("Q1", "Q2");
                                         															break;
                                         														case "Q2":
                                         															$allowableDueTypesArray = array("Q2", "Q3");
                                         															break;
                                         														case "Q3":
                                         															$allowableDueTypesArray = array("Q3", "Q4");
                                         															break;
                                         														case "Q4":
                                         															$allowableDueTypesArray = array("Q4");
                                         															break;
                                         													}
                                         												}
                                         											}
                                         											*/
                                         foreach ($dueArrayList as $dKey => $due) {
                                             $dueArrayList[$dKey]->setEarlyPaymentDiscountPeriod($this->formArray["discountPeriod"]);
                                             $dueArrayList[$dKey]->setEarlyPaymentDiscountPercentage($this->formArray["discountPercentage"]);
                                             // compute earlyPaymentDiscount as of today
                                             // check if today is within the discountPeriod and compute Discount
                                             // AND if today is BEFORE annual dueDate
                                             $dueArrayList[$dKey]->setEarlyPaymentDiscount(0.0);
                                             if ($due->getDueType() == "Annual") {
                                                 if (strtotime($this->now) >= $this->formArray["discountPeriod_Start"] && strtotime($this->now) <= $this->formArray["discountPeriod_End"]) {
                                                     if (strtotime($this->now) <= strtotime($dueArrayList[$dKey]->getDueDate())) {
                                                         $dueArrayList[$dKey]->setEarlyPaymentDiscount($dueArrayList[$dKey]->getTaxDue() * ($this->formArray["discountPercentage"] / 100));
                                                     }
                                                 }
                                             } else {
                                                 // if today is BEFORE dueDate
                                                 if (strtotime($this->now) <= strtotime($due->getDueDate()) && strtotime($this->now) >= $this->formArray["discountPeriod_Start"]) {
                                                     $dueArrayList[$dKey]->setEarlyPaymentDiscount($dueArrayList[$dKey]->getTaxDue() * ($this->formArray["discountPercentage"] / 100));
                                                 }
                                                 // commented out: February 08, 2005
                                                 // earlyPaymentDiscount aren't given to Quarterly Dues except for Quarter 1
                                                 /*
                                                 if($due->getDueType()=="Q1"){
                                                 	if(strtotime($this->now) >= $this->formArray["discountPeriod_Start"] && strtotime($this->now) <= $this->formArray["discountPeriod_End"]){
                                                 		if(strtotime($this->now) <= strtotime($dueArrayList[$dKey]->getDueDate())){
                                                 			$dueArrayList[$dKey]->setEarlyPaymentDiscount($dueArrayList[$dKey]->getTaxDue() * ($this->formArray["discountPercentage"]/100));
                                                 		}
                                                 	}
                                                 }
                                                 */
                                             }
                                             // compute advancedPaymentDiscount as of today
                                             // check if today is BEFORE January 1 of the year of the annual dueDate
                                             $dueArrayList[$dKey]->setAdvancedPaymentDiscount(0.0);
                                             if (strtotime($this->now) < strtotime(date("Y", strtotime($dueArrayList[$dKey]->getDueDate())) . "-01-01")) {
                                                 // for advanced payments, give 20% discount to annual dues [advanced discount]
                                                 // give 10% discount to quarterly dues [early discount]
                                                 if ($due->getDueType() == "Annual") {
                                                     $dueArrayList[$dKey]->setAdvancedPaymentDiscount($dueArrayList[$dKey]->getTaxDue() * ($this->formArray["advancedDiscountPercentage"] / 100));
                                                 } else {
                                                     // commented out: February 08, 2005
                                                     // advancedPaymentDiscount aren't given to Quarterly Dues
                                                     // except for Quarter 1
                                                     if ($due->getDueType() == "Q1") {
                                                         $dueArrayList[$dKey]->setAdvancedPaymentDiscount($dueArrayList[$dKey]->getTaxDue() * ($this->formArray["q1AdvancedDiscountPercentage"] / 100));
                                                     } else {
                                                         $dueArrayList[$dKey]->setAdvancedPaymentDiscount($dueArrayList[$dKey]->getTaxDue() * ($this->formArray["discountPercentage"] / 100));
                                                     }
                                                 }
                                             }
                                             $latestPaymentDate[$dKey] = $this->getLatestPaymentDateForDue($dueArrayList[$dKey]);
                                             $amountPaidForDue = $this->getAmountPaidForDue($dueArrayList);
                                             $amnestyStatus = $this->getAmnestyStatusForDue($dueArrayList);
                                             $totalEarlyPaymentDiscount = $this->getTotalEarlyPaymentDiscountForDue($dueArrayList);
                                             $totalAdvancedPaymentDiscount = $this->getTotalAdvancedPaymentDiscountForDue($dueArrayList);
                                             if ($totalEarlyPaymentDiscount > 0) {
                                                 $earlyPaymentDiscountForDueType = $this->getTotalEarlyPaymentDiscountForDueType($dueArrayList[$dKey]);
                                                 if ($earlyPaymentDiscountForDueType > 0) {
                                                     $dueArrayList[$dKey]->setEarlyPaymentDiscount($earlyPaymentDiscountForDueType);
                                                 }
                                             }
                                             if ($totalAdvancedPaymentDiscount > 0) {
                                                 $advancedPaymentDiscountForDueType = $this->getTotalAdvancedPaymentDiscountForDueType($dueArrayList[$dKey]);
                                                 if ($advancedPaymentDiscountForDueType > 0) {
                                                     $dueArrayList[$dKey]->setAdvancedPaymentDiscount($advancedPaymentDiscountForDueType);
                                                 }
                                             }
                                             if ($amnestyStatus) {
                                                 $this->tpl->set_var("amnesty_status", "checked");
                                             } else {
                                                 $this->tpl->set_var("amnesty_status", "");
                                             }
                                             // calculate Penalties verses either today or verses the last paymentDate
                                             if ($latestPaymentDate[$dKey] != "" || $latestPaymentDate[$dKey] != "now") {
                                                 $dueArrayList[$dKey] = $this->computePenalty($latestPaymentDate[$dKey], $dueArrayList[$dKey]);
                                                 // if balance is 0 leave penalty as is, otherwise calculatePenalty according to date now
                                                 $balance = $dueArrayList[$dKey]->getInitialNetDue() - $amountPaidForDue;
                                                 // 0.1 is used instead of 0 because sometimes rounded off balances intended to be 0 end up appearing as 0.002 or so...
                                                 if (round($balance, 4) > 0.1) {
                                                     $dueArrayList[$dKey] = $this->computePenalty($this->now, $dueArrayList[$dKey]);
                                                 }
                                             } else {
                                                 $dueArrayList[$dKey] = $this->computePenalty($this->now, $dueArrayList[$dKey]);
                                             }
                                             $this->tpl->set_var("advancedPaymentDiscount[" . $dKey . "]", formatCurrency($dueArrayList[$dKey]->getAdvancedPaymentDiscount()));
                                             $this->tpl->set_var("earlyPaymentDiscount[" . $dKey . "]", formatCurrency($dueArrayList[$dKey]->getEarlyPaymentDiscount()));
                                             $this->tpl->set_var("monthsOverDue[" . $dKey . "]", $dueArrayList[$dKey]->getMonthsOverDue());
                                             $this->tpl->set_var("penaltyPercentage[" . $dKey . "]", $dueArrayList[$dKey]->getPenaltyPercentage() * 100);
                                             $this->tpl->set_var("penalty[" . $dKey . "]", formatCurrency($dueArrayList[$dKey]->getPenalty()));
                                             $this->tpl->set_var("totalPaid[" . $dKey . "]", formatCurrency($this->getAmountPaidForDueID($dueArrayList[$dKey]->getDueID())));
                                             $this->tpl->set_var("initialNetDue[" . $dKey . "]", formatCurrency($dueArrayList[$dKey]->getInitialNetDue()));
                                             $this->initialNetDue[$dKey] = $dueArrayList[$dKey]->getInitialNetDue();
                                         }
                                         // revert Back to Annual mode if Quarterly Dues have Penalties
                                         foreach ($dueArrayList as $dKey => $due) {
                                             if ($dKey != "Annual") {
                                                 if ($dueArrayList[$dKey]->getPenalty() > 0) {
                                                     $defaultDueType = "Annual";
                                                     $allowableDueTypesArray = array("Annual");
                                                     $revertedBackToAnnual = true;
                                                     break;
                                                 }
                                             }
                                         }
                                         foreach ($allowableDueTypesArray as $allowableDueType) {
                                             $this->tpl->set_var("allowableDueType", $allowableDueType);
                                             $this->tpl->parse("DueTypeListBlock", "DueTypeList", true);
                                         }
                                         $this->tpl->set_var("dueType[Annual]_status", "checked");
                                         $this->tpl->set_var("dueType[Q1]_status", "");
                                         $this->tpl->set_var("dueType[Q2]_status", "");
                                         $this->tpl->set_var("dueType[Q3]_status", "");
                                         $this->tpl->set_var("dueType[Q4]_status", "");
                                         $this->tpl->set_var("dueDate", date("M. d, Y", strtotime($dueArrayList[$defaultDueType]->getDueDate())));
                                         $this->tpl->set_var("basicTax", formatCurrency($dueArrayList[$defaultDueType]->getBasicTax()));
                                         $this->tpl->set_var("sefTax", formatCurrency($dueArrayList[$defaultDueType]->getSEFTax()));
                                         $this->tpl->set_var("idleTax", formatCurrency($dueArrayList[$defaultDueType]->getIdleTax()));
                                         $this->tpl->set_var("taxDue", formatCurrency($dueArrayList[$defaultDueType]->getTaxDue()));
                                         $this->tpl->set_var("advancedPaymentDiscount", formatCurrency($dueArrayList[$defaultDueType]->getAdvancedPaymentDiscount()));
                                         $this->tpl->set_var("earlyPaymentDiscount", formatCurrency($dueArrayList[$defaultDueType]->getEarlyPaymentDiscount()));
                                         $this->tpl->set_var("penalty", formatCurrency($dueArrayList[$defaultDueType]->getPenalty()));
                                         // get amountPaid for defaultDueType
                                         // but if dues have been reverted back to "Annual" mode from "Quarterly" mode
                                         // get amountPaid for all the quarters that have been paid so far
                                         if ($revertedBackToAnnual) {
                                             $amountPaid = 0;
                                             $amountPaid += $this->getAmountpaidForDueID($dueArrayList["Annual"]->getDueID());
                                             $amountPaid += $this->getAmountpaidForDueID($dueArrayList["Q1"]->getDueID());
                                             $amountPaid += $this->getAmountpaidForDueID($dueArrayList["Q2"]->getDueID());
                                             $amountPaid += $this->getAmountpaidForDueID($dueArrayList["Q3"]->getDueID());
                                             $amountPaid += $this->getAmountpaidForDueID($dueArrayList["Q4"]->getDueID());
                                         } else {
                                             $amountPaid = $this->getAmountPaidForDueID($dueArrayList[$defaultDueType]->getDueID());
                                         }
                                         $this->tpl->set_var("amountPaid", formatCurrency($amountPaid));
                                         $balance = $dueArrayList[$defaultDueType]->getTaxDue();
                                         if ($dueArrayList[$defaultDueType]->getAdvancedPaymentDiscount() > 0) {
                                             $balance = $dueArrayList[$defaultDueType]->getTaxDue() - $dueArrayList[$defaultDueType]->getAdvancedPaymentDiscount();
                                         } else {
                                             if ($dueArrayList[$defaultDueType]->getEarlyPaymentDiscount() > 0) {
                                                 $balance = $dueArrayList[$defaultDueType]->getTaxDue() - $dueArrayList[$defaultDueType]->getEarlyPaymentDiscount();
                                             }
                                         }
                                         $balance = round($balance + $dueArrayList[$defaultDueType]->getPenalty() - $amountPaid, 2);
                                         $this->tpl->set_var("balance", formatCurrency($balance));
                                     }
                                 }
                                 // display Backtaxes and previousTD Backtaxes
                                 $this->formArray["totalBacktaxesBalance"] = 0;
                                 $this->displayBacktaxTD($tvalue->getTdID());
                                 $precedingTDArray = $this->getPrecedingTDArray($tvalue);
                                 if (is_array($precedingTDArray)) {
                                     foreach ($precedingTDArray as $precedingTD) {
                                         $this->displayBacktaxTD($precedingTD->getTdID());
                                     }
                                 }
                                 $this->tpl->set_var("total", number_format($this->formArray["totalBacktaxesDue"], 2));
                                 $this->tpl->set_var("totalBacktaxesBalance", number_format($this->formArray["totalBacktaxesBalance"], 2));
                                 // grab dueID's and backtaxTDID's to run through payments
                                 // create $dueIDArray
                                 foreach ($dueArrayList as $due) {
                                     $this->dueIDArray[] = $due->getDueID();
                                 }
                                 $this->displayTotalPaid();
                                 $this->displayNetDue();
                                 $this->tpl->set_var("ctr", $tdCtr);
                                 $this->tpl->parse("defaultTDListBlock", "defaultTDList", true);
                                 $this->tpl->parse("toggleTDListBlock", "toggleTDList", true);
                                 $this->tpl->parse("TDListBlock", "TDList", true);
                                 $this->tpl->parse("JSTDListBlock", "JSTDList", true);
                                 $this->tpl->set_var("DueTypeListBlock", "");
                                 // added following line Feb.22,2005 to solve erpts issue (2005-22), backtaxTD blocking bug.
                                 $this->tpl->set_var("BacktaxesListBlock", "");
                                 $tdCtr++;
                             }
                         } else {
                             $this->tpl->set_var("defaultTDListBlock", "//no default");
                             $this->tpl->set_var("toggleTDListBlock", "//no Toggle");
                             $this->tpl->set_var("TDListBlock", "");
                             $this->tpl->set_var("JSTDListBlock", "");
                         }
                         $this->tpl->set_var("tdCtr", $tdCtr);
                         break;
                     case "landTotalMarketValue":
                         if (!$this->formArray[$key]) {
                             $this->formArray[$key] = $value;
                         }
                         break;
                     case "landTotalAssessedValue":
                         if (!$this->formArray[$key]) {
                             $this->formArray[$key] = $value;
                         }
                         break;
                     case "plantTotalMarketValue":
                         if (!$this->formArray[$key]) {
                             $this->formArray[$key] = $value;
                         }
                         break;
                     case "plantTotalAssessedValue":
                         if (!$this->formArray[$key]) {
                             $this->formArray[$key] = $value;
                         }
                         break;
                     case "bldgTotalMarketValue":
                         if (!$this->formArray[$key]) {
                             $this->formArray[$key] = $value;
                         }
                         break;
                     case "bldgTotalAssessedValue":
                         if (!$this->formArray[$key]) {
                             $this->formArray[$key] = $value;
                         }
                         break;
                     case "machTotalMarketValue":
                         if (!$this->formArray[$key]) {
                             $this->formArray[$key] = $value;
                         }
                         break;
                     case "machTotalAssessedValue":
                         if (!$this->formArray[$key]) {
                             $this->formArray[$key] = $value;
                         }
                         break;
                     case "totalMarketValue":
                         if (!$this->formArray[$key]) {
                             $this->formArray[$key] = $value;
                         }
                         break;
                     case "totalAssessedValue":
                         if (!$this->formArray[$key]) {
                             $this->formArray[$key] = $value;
                         }
                         break;
                     default:
                         $this->formArray[$key] = $value;
                 }
             }
             $this->formArray["totalMarketValue"] = $this->formArray["landTotalMarketValue"] + $this->formArray["plantTotalMarketValue"] + $this->formArray["bldgTotalMarketValue"] + $this->formArray["machTotalMarketValue"];
             $this->formArray["totalAssessedValue"] = $this->formArray["landTotalAssessedValue"] + $this->formArray["plantTotalAssessedValue"] + $this->formArray["bldgTotalAssessedValue"] + $this->formArray["machTotalAssessedValue"];
             unset($rptop);
             $AFSEncode = new SoapObject(NCCBIZ . "AFSEncode.php", "urn:Object");
             $rptop = new RPTOP();
             $rptop->setRptopID($this->formArray["rptopID"]);
             $rptop->setLandTotalMarketValue($this->formArray["landTotalMarketValue"]);
             $rptop->setLandTotalAssessedValue($this->formArray["landTotalAssessedValue"]);
             $rptop->setPlantTotalMarketValue($this->formArray["plantTotalMarketValue"]);
             $rptop->setPlantTotalPlantAssessedValue($this->formArray["plantTotalAssessedValue"]);
             $rptop->setBldgTotalMarketValue($this->formArray["bldgTotalMarketValue"]);
             $rptop->setBldgTotalAssessedValue($this->formArray["bldgTotalAssessedValue"]);
             $rptop->setMachTotalMarketValue($this->formArray["machTotalMarketValue"]);
             $rptop->setMachTotalAssessedValue($this->formArray["machTotalAssessedValue"]);
             $rptop->setTotalMarketValue($this->formArray["totalMarketValue"]);
             $rptop->setTotalAssessedValue($this->formArray["totalAssessedValue"]);
             $rptop->setCreatedBy($this->userID);
             $rptop->setModifiedBy($this->userID);
             $rptop->setDomDocument();
             $RPTOPEncode = new SoapObject(NCCBIZ . "RPTOPEncode.php", "urn:Object");
             $rptop->setDomDocument();
             $doc = $rptop->getDomDocument();
             $xmlStr = $doc->dump_mem(true);
             //echo $xmlStr;
             if (!($ret = $RPTOPEncode->updateRPTOPtotals($xmlStr))) {
                 echo "ret=" . $ret;
             }
             //echo $ret;
         }
     }
     $this->setForm();
     $this->setPageDetailPerms();
     $this->tpl->set_var("uname", $this->user["uname"]);
     $this->tpl->set_var("today", date("F j, Y", strtotime($this->now)));
     $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");
 }
コード例 #25
0
ファイル: orders.php プロジェクト: billyprice1/whmcs
         if ($registrar) {
             echo " checked";
         } else {
             echo " disabled";
         }
         echo "> Send Confirmation Email</label></td></tr>";
     }
 }
 $result = select_query("tblupgrades", "", array("orderid" => $id));
 while ($data = mysql_fetch_array($result)) {
     $upgradeid = $data['id'];
     $type = $data['type'];
     $relid = $data['relid'];
     $originalvalue = $data['originalvalue'];
     $newvalue = $data['newvalue'];
     $upgradeamount = formatCurrency($data['amount']);
     $newrecurringamount = $data['newrecurringamount'];
     $status = $data['status'];
     $paid = $data['paid'];
     $result2 = select_query("tblhosting", "tblproducts.name AS productname,domain", array("tblhosting.id" => $relid), "", "", "", "tblproducts ON tblproducts.id=tblhosting.packageid");
     $data = mysql_fetch_array($result2);
     $productname = $data['productname'];
     $domain = $data['domain'];
     if ($type == "package") {
         $result2 = select_query("tblproducts", "name", array("id" => $originalvalue));
         $data = mysql_fetch_array($result2);
         $oldpackagename = $data['name'];
         $newvalue = explode(",", $newvalue);
         $newpackageid = $newvalue[0];
         $result2 = select_query("tblproducts", "name", array("id" => $newpackageid));
         $data = mysql_fetch_array($result2);
コード例 #26
0
ファイル: vw_active.php プロジェクト: eureka2/web2project
        ?>
&nbsp;<?php 
        echo $project['contact_last_name'];
        ?>
</td>
			<td nowrap="nowrap"><?php 
        echo $start_date->format($df);
        ?>
</td>
			<td nowrap="nowrap"><?php 
        echo $AppUI->_($pstatus[$project['project_status']]);
        ?>
</td>
			<td nowrap="nowrap">
                <?php 
        echo $w2Pconfig['currency_symbol'];
        echo formatCurrency($project['project_target_budget'], $AppUI->getPref('CURRENCYFORM'));
        ?>
            </td>
		</tr>
		<?php 
    }
} else {
    ?>
<tr><td colspan="5"><?php 
    echo $AppUI->_('No data available') . '<br />' . $AppUI->getMsg();
    ?>
</td></tr><?php 
}
?>
</table>
コード例 #27
0
ファイル: project_summary.php プロジェクト: billyprice1/whmcs
 } else {
     $client = "None";
 }
 $ticketinvoicelinks = array();
 foreach ($ticketids as $i => $ticketnum) {
     if ($ticketnum) {
         $ticketnum = get_query_val("tbltickets", "tid", array("tid" => $ticketnum));
         $ticketinvoicelinks[] = "description LIKE '%Ticket #" . $ticketnum . "%'";
         continue;
     }
 }
 $ticketinvoicesquery = !empty($ticketinvoicelinks) ? "(\".implode(' AND '," . $ticketinvoicelinks . ").\") OR " : "";
 $totalinvoiced = get_query_val("tblinvoices", "SUM(subtotal+tax+tax2)", "id IN (SELECT invoiceid FROM tblinvoiceitems WHERE description LIKE '%Project #" . $projectid . "%' OR " . $ticketinvoicesquery . " (type='Project' AND relid='" . $projectid . "'))");
 $totalinvoiced = $userid ? formatCurrency($totalinvoiced) : format_as_currency($totalinvoiced);
 $totalpaid = get_query_val("tblinvoices", "SUM(subtotal+tax+tax2)", "id IN (SELECT invoiceid FROM tblinvoiceitems WHERE description LIKE '%Project #" . $projectid . "%' OR " . $ticketinvoicesquery . " (type='Project' AND relid='" . $projectid . "')) AND status='Paid'");
 $totalpaid = $userid ? formatCurrency($totalpaid) : format_as_currency($totalpaid);
 $reportdata['drilldown'][$i]['tableheadings'] = array("Task Name", "Start Time", "Stop Time", "Duration", "Task Status");
 $timerresult = select_query("mod_projecttimes", "mod_projecttimes.start,mod_projecttimes.end,mod_projecttasks.task,mod_projecttasks.completed", array("mod_projecttimes.projectid" => $projectid), "", "", "", "mod_projecttasks ON mod_projecttimes.taskid = mod_projecttasks.id");
 while ($data2 = mysql_fetch_assoc($timerresult)) {
     $rowcount = $rowtotal = 0;
     $taskid = $data2['id'];
     $task = $data2['task'];
     $taskadminid = $data2['adminid'];
     $timerstart = $data2['start'];
     $timerend = $data2['end'];
     $duration = $timerend ? $timerend - $timerstart : 0;
     $taskadmin = getAdminName($taskadminid);
     $starttime = date("d/m/Y H:i:s ", $timerstart);
     $stoptime = date("d/m/Y H:i:s ", $timerend);
     $taskstatus = $data2['completed'] ? "Completed" : "Open";
     $totalprojectstime += $duration;
コード例 #28
0
ファイル: collectionReport7.php プロジェクト: armic/erpts
 function Main()
 {
     $eRPTSSettings = new eRPTSSettings();
     if ($eRPTSSettings->selectRecord(1)) {
         $this->tpl->set_var("lguType", strtoupper($eRPTSSettings->getLguType()));
         $this->tpl->set_var("lguName", strtoupper($eRPTSSettings->getLguName()));
     }
     $dbPayment = new DB_RPTS();
     $dbTD = new DB_RPTS();
     $dbBacktaxTD = new DB_RPTS();
     $dbDue = new DB_RPTS();
     $dbPaymentTD = new DB_RPTS();
     $dbPaymentBacktaxTD = new DB_RPTS();
     $dbCollection = new DB_RPTS();
     // gather unique TD's and BacktaxTD's from Payments for year
     $sqlPayment = "SELECT paymentID, " . "tdID, " . "backtaxTDID " . "FROM Payment " . "WHERE status!='cancelled' " . "AND YEAR(paymentDate) LIKE '" . $this->formArray["year"] . "' " . "GROUP BY tdID, backtaxTDID " . "ORDER BY paymentID DESC ";
     $dbPayment->query($sqlPayment);
     if ($dbPayment->nf() > 0) {
         while ($dbPayment->next_record()) {
             $year = "";
             $pageRecord = array("propertyIndexNumber" => "", "tdNumber" => "", "paidBasic" => 0, "paidSef" => 0, "discount" => 0, "basicSef" => 0, "yearDel" => "", "basicDel" => 0, "sefDel" => 0, "penalty" => 0, "totalDel" => 0, "totalAmount" => 0);
             if ($dbPayment->f("backtaxTDID") != 0) {
                 // ------- start of BacktaxTD condition ------------------------- //
                 // gather BacktaxTD details
                 $sqlBacktaxTD = "SELECT tdNumber as tdNumber, " . "startYear as year " . "FROM BacktaxTD " . "WHERE " . "backtaxTDID = '" . $dbPayment->f("backtaxTDID") . "' ";
                 $dbBacktaxTD->query($sqlBacktaxTD);
                 if ($dbBacktaxTD->next_record()) {
                     $pageRecord["tdNumber"] = $dbBacktaxTD->f("tdNumber");
                     $year = $dbBacktaxTD->f("year");
                 }
                 // gather Payments for BacktaxTD for this year
                 $sqlPaymentBacktaxTD = "SELECT * " . "FROM Payment WHERE " . "backtaxTDID='" . $dbPayment->f("backtaxTDID") . "' " . "AND YEAR(paymentDate) LIKE '" . $this->formArray["year"] . "' " . "AND status!='cancelled' " . "ORDER BY paymentID DESC ";
                 $dbPaymentBacktaxTD->query($sqlPaymentBacktaxTD);
                 if ($dbPaymentBacktaxTD->nf() > 0) {
                     while ($dbPaymentBacktaxTD->next_record()) {
                         // gather Collections for Payment
                         $sqlCollection = "SELECT * " . "FROM Collection " . "WHERE paymentID='" . $dbPaymentBacktaxTD->f("paymentID") . "' " . "AND Collection.status!='cancelled' " . "ORDER BY collectionID DESC ";
                         $dbCollection->query($sqlCollection);
                         if ($dbCollection->nf() > 0) {
                             while ($dbCollection->next_record()) {
                                 switch ($dbCollection->f("taxType")) {
                                     case "basic":
                                         // paidBasic
                                         $paidBasic = 0;
                                         if ($dbCollection->f("amnesty") != "true") {
                                             $paidBasic = $dbCollection->f("amountPaid") - $dbCollection->f("penalty");
                                             // penalty, basicDel and totalDel
                                             if ($dbCollection->f("penalty") > 0) {
                                                 $pageRecord["yearDel"] = $year;
                                                 // basicDel
                                                 $basicDel = 0;
                                                 $basicDel = $dbCollection->f("taxDue");
                                                 // penalty
                                                 $penalty = 0;
                                                 $penalty = $dbCollection->f("penalty");
                                                 // totalDel
                                                 $totalDel = $basicDel + $penalty;
                                                 $pageRecord["basicDel"] += $basicDel;
                                                 $pageRecord["penalty"] += $penalty;
                                                 $pageRecord["totalDel"] += $totalDel;
                                                 // totalAmount
                                                 $pageRecord["totalAmount"] += $penalty;
                                             }
                                         }
                                         $paidBasic = $paidBasic + ($dbCollection->f("earlyPaymentDiscount") + $dbCollection->f("advancedPaymentDiscount"));
                                         // discount
                                         $discount = $dbCollection->f("earlyPaymentDiscount") + $dbCollection->f("advancedPaymentDiscount");
                                         // basicSef
                                         $basicSef = $paidBasic - $discount;
                                         $pageRecord["paidBasic"] += $paidBasic;
                                         $pageRecord["discount"] += $discount;
                                         $pageRecord["basicSef"] += $basicSef;
                                         // totalAmount
                                         $pageRecord["totalAmount"] += $basicSef;
                                         break;
                                     case "sef":
                                         // paidSef
                                         $paidSef = 0;
                                         if ($dbCollection->f("amnesty") != "true") {
                                             $paidSef = $dbCollection->f("amountPaid") - $dbCollection->f("penalty");
                                             // penalty, sefDel and totalDel
                                             if ($dbCollection->f("penalty") > 0) {
                                                 $pageRecord["yearDel"] = $year;
                                                 // sefDel
                                                 $sefDel = 0;
                                                 $sefDel = $dbCollection->f("taxDue");
                                                 // penalty
                                                 $penalty = 0;
                                                 $penalty = $dbCollection->f("penalty");
                                                 // totalDel
                                                 $totalDel = $sefDel + $penalty;
                                                 $pageRecord["sefDel"] += $sefDel;
                                                 $pageRecord["penalty"] += $penalty;
                                                 $pageRecord["totalDel"] += $totalDel;
                                                 // totalAmount
                                                 $pageRecord["totalAmount"] += $penalty;
                                             }
                                         }
                                         $paidSef = $paidSef + ($dbCollection->f("earlyPaymentDiscount") + $dbCollection->f("advancedPaymentDiscount"));
                                         // discount
                                         $discount = $dbCollection->f("earlyPaymentDiscount") + $dbCollection->f("advancedPaymentDiscount");
                                         // basicSef
                                         $basicSef = $paidSef - $discount;
                                         $pageRecord["paidSef"] += $paidSef;
                                         $pageRecord["discount"] += $discount;
                                         $pageRecord["basicSef"] += $basicSef;
                                         // totalAmount
                                         $pageRecord["totalAmount"] += $basicSef;
                                         break;
                                 }
                             }
                         }
                     }
                 }
                 // ------- start of BacktaxTD condition ------------------------- //
             } else {
                 if ($dbPayment->f("tdID") != 0) {
                     // ------- start of TD condition ------------------------- //
                     // gather TD details
                     $sqlTD = "SELECT AFS.propertyIndexNumber as propertyIndexNumber, " . "TD.taxDeclarationNumber as taxDeclarationNumber " . "FROM TD, AFS " . "WHERE " . "TD.afsID = AFS.afsID " . "AND TD.tdID='" . $dbPayment->f("tdID") . "' " . "AND TD.archive!='true' " . "AND AFS.archive!='true' ";
                     $dbTD->query($sqlTD);
                     if ($dbTD->next_record()) {
                         $pageRecord["propertyIndexNumber"] = $dbTD->f("propertyIndexNumber");
                         $pageRecord["tdNumber"] = $dbTD->f("taxDeclarationNumber");
                     }
                     // gather dueDate Year from Due
                     $sqlDue = "SELECT YEAR(dueDate) as year " . "FROM Due " . "WHERE tdID='" . $dbPayment->f("tdID") . "' " . "AND dueType='Annual' ";
                     $dbDue->query($sqlDue);
                     if ($dbDue->next_record()) {
                         $year = $dbDue->f("year");
                     }
                     // gather Payments for TD for this year
                     $sqlPaymentTD = "SELECT * " . "FROM Payment WHERE " . "tdID='" . $dbPayment->f("tdID") . "' " . "AND YEAR(paymentDate) LIKE '" . $this->formArray["year"] . "' " . "AND status!='cancelled' " . "ORDER BY paymentID DESC ";
                     $dbPaymentTD->query($sqlPaymentTD);
                     if ($dbPaymentTD->nf() > 0) {
                         while ($dbPaymentTD->next_record()) {
                             // gather Collections for Payment
                             $sqlCollection = "SELECT * " . "FROM Collection " . "WHERE paymentID='" . $dbPaymentTD->f("paymentID") . "' " . "AND Collection.status!='cancelled' " . "ORDER BY collectionID DESC ";
                             $dbCollection->query($sqlCollection);
                             if ($dbCollection->nf() > 0) {
                                 while ($dbCollection->next_record()) {
                                     switch ($dbCollection->f("taxType")) {
                                         case "basic":
                                             // paidBasic
                                             $paidBasic = 0;
                                             if ($dbCollection->f("amnesty") != "true") {
                                                 $paidBasic = $dbCollection->f("amountPaid") - $dbCollection->f("penalty");
                                                 // penalty, basicDel and totalDel
                                                 if ($dbCollection->f("penalty") > 0) {
                                                     $pageRecord["yearDel"] = $year;
                                                     // basicDel
                                                     $basicDel = 0;
                                                     $basicDel = $dbCollection->f("taxDue");
                                                     // penalty
                                                     $penalty = 0;
                                                     $penalty = $dbCollection->f("penalty");
                                                     // totalDel
                                                     $totalDel = $basicDel + $penalty;
                                                     $pageRecord["basicDel"] += $basicDel;
                                                     $pageRecord["penalty"] += $penalty;
                                                     $pageRecord["totalDel"] += $totalDel;
                                                     // totalAmount
                                                     $pageRecord["totalAmount"] += $penalty;
                                                 }
                                             }
                                             $paidBasic = $paidBasic + ($dbCollection->f("earlyPaymentDiscount") + $dbCollection->f("advancedPaymentDiscount"));
                                             // discount
                                             $discount = $dbCollection->f("earlyPaymentDiscount") + $dbCollection->f("advancedPaymentDiscount");
                                             // basicSef
                                             $basicSef = $paidBasic - $discount;
                                             $pageRecord["paidBasic"] += $paidBasic;
                                             $pageRecord["discount"] += $discount;
                                             $pageRecord["basicSef"] += $basicSef;
                                             // totalAmount
                                             $pageRecord["totalAmount"] += $basicSef;
                                             break;
                                         case "sef":
                                             // paidSef
                                             $paidSef = 0;
                                             if ($dbCollection->f("amnesty") != "true") {
                                                 $paidSef = $dbCollection->f("amountPaid") - $dbCollection->f("penalty");
                                                 // penalty, sefDel and totalDel
                                                 if ($dbCollection->f("penalty") > 0) {
                                                     $pageRecord["yearDel"] = $year;
                                                     // sefDel
                                                     $sefDel = 0;
                                                     $sefDel = $dbCollection->f("taxDue");
                                                     // penalty
                                                     $penalty = 0;
                                                     $penalty = $dbCollection->f("penalty");
                                                     // totalDel
                                                     $totalDel = $sefDel + $penalty;
                                                     $pageRecord["sefDel"] += $sefDel;
                                                     $pageRecord["penalty"] += $penalty;
                                                     $pageRecord["totalDel"] += $totalDel;
                                                     // totalAmount
                                                     $pageRecord["totalAmount"] += $penalty;
                                                 }
                                             }
                                             $paidSef = $paidSef + ($dbCollection->f("earlyPaymentDiscount") + $dbCollection->f("advancedPaymentDiscount"));
                                             // discount
                                             $discount = $dbCollection->f("earlyPaymentDiscount") + $dbCollection->f("advancedPaymentDiscount");
                                             // basicSef
                                             $basicSef = $paidSef - $discount;
                                             $pageRecord["paidSef"] += $paidSef;
                                             $pageRecord["discount"] += $discount;
                                             $pageRecord["basicSef"] += $basicSef;
                                             // totalAmount
                                             $pageRecord["totalAmount"] += $basicSef;
                                             break;
                                     }
                                 }
                             }
                         }
                     }
                     // ------- end of TD condition ------------------------- //
                 }
             }
             $pageRecordArrayList[] = $pageRecord;
             unset($pageRecord);
         }
         if (is_array($pageRecordArrayList)) {
             $ypos = 426;
             $decrementYposBy = 12;
             $linesPerPage = 24;
             $count = count($pageRecordArrayList);
             $numOfPages = ceil($count / $linesPerPage);
             $pageCtr = 1;
             $lineCtr = 1;
             $recordCtr = 1;
             $this->tpl->set_var("year", $this->formArray["year"]);
             $this->tpl->set_var("numOfPages", $numOfPages);
             $this->tpl->set_block("rptsTemplate", "Page", "PageBlock");
             $this->tpl->set_block("Page", "Row", "RowBlock");
             $this->tpl->set_block("Page", "Totals", "TotalsBlock");
             $totalsArray = array("totalPaidBasic" => 0, "totalPaidSef" => 0, "totalDiscount" => 0, "totalBasicSef" => 0, "totalBasicDel" => 0, "totalSefDel" => 0, "totalPenalty" => 0, "totalTotalDel" => 0, "totalTotalAmount" => 0);
             foreach ($pageRecordArrayList as $recordArray) {
                 $this->tpl->set_var("ypos", $ypos);
                 $this->tpl->set_var("recordCtr", $recordCtr);
                 // write values
                 $totalsArray["totalPaidBasic"] += un_number_format($recordArray["paidBasic"]);
                 $totalsArray["totalPaidSef"] += un_number_format($recordArray["paidSef"]);
                 $totalsArray["totalDiscount"] += un_number_format($recordArray["discount"]);
                 $totalsArray["totalBasicSef"] += un_number_format($recordArray["basicSef"]);
                 $totalsArray["totalBasicDel"] += un_number_format($recordArray["basicDel"]);
                 $totalsArray["totalSefDel"] += un_number_format($recordArray["sefDel"]);
                 $totalsArray["totalPenalty"] += un_number_format($recordArray["penalty"]);
                 $totalsArray["totalTotalDel"] += un_number_format($recordArray["totalDel"]);
                 $totalsArray["totalTotalAmount"] += un_number_format($recordArray["totalAmount"]);
                 foreach ($recordArray as $key => $value) {
                     switch ($key) {
                         case "paidBasic":
                         case "paidSef":
                         case "discount":
                         case "basicSef":
                         case "basicDel":
                         case "sefDel":
                         case "penalty":
                         case "totalDel":
                         case "totalAmount":
                             $value = formatCurrency($value);
                             break;
                     }
                     $this->tpl->set_var($key, $value);
                 }
                 $this->tpl->parse("RowBlock", "Row", true);
                 if ($recordCtr == count($pageRecordArrayList) || $lineCtr == $linesPerPage) {
                     if ($pageCtr == $numOfPages) {
                         foreach ($totalsArray as $key => $value) {
                             $value = formatCurrency($value);
                             $this->tpl->set_var($key, $value);
                         }
                         $this->tpl->parse("TotalsBlock", "Totals", true);
                     } else {
                         $this->tpl->set_var("TotalsBlock", "");
                     }
                     $this->tpl->set_var("page", $pageCtr);
                     $this->tpl->parse("PageBlock", "Page", true);
                     $this->tpl->set_var("RowBlock", "");
                     $this->tpl->set_var("TotalsBlock", "");
                     $ypos = 426;
                     $lineCtr = 0;
                     $pageCtr++;
                 }
                 $lineCtr++;
                 $recordCtr++;
                 $ypos = $ypos - $decrementYposBy;
             }
             $this->tpl->parse("templatePage", "rptsTemplate");
             $this->tpl->finish("templatePage");
         } else {
             exit("no collections to list for " . $this->formArray["year"]);
         }
     } else {
         exit("no collections to list for " . $this->formArray["year"]);
     }
     $this->tpl->parse("templatePage", "rptsTemplate");
     $this->tpl->finish("templatePage");
     $testpdf = new PDFWriter();
     $testpdf->setOutputXML($this->tpl->get("templatePage"), "test");
     if (isset($this->formArray["print"])) {
         $testpdf->writePDF($name);
         //,$this->formArray["print"]);
     } else {
         $testpdf->writePDF($name);
     }
 }
コード例 #29
0
$total += $itemtotal;
$reportdata["tablevalues"][] = array('', '<strong>Sub-Total</strong>', '<strong>' . formatCurrency($itemtotal) . '</strong>');
$chartdata['rows'][] = array('c' => array(array('v' => "Addons"), array('v' => $itemtotal, 'f' => formatCurrency($itemtotal))));
$itemtotal = 0;
$reportdata["tablevalues"][] = array("**<strong>Miscellaneous</strong>");
$result = full_query("SELECT COUNT(*),SUM(tblinvoiceitems.amount) FROM tblinvoiceitems INNER JOIN tblclients ON tblclients.id=tblinvoices.userid INNER JOIN tblinvoices ON tblinvoices.id=tblinvoiceitems.invoiceid WHERE tblinvoices.datepaid LIKE '" . (int) $year . "-" . $pmonth . "-%' AND tblinvoiceitems.type='Item' AND currency='{$currencyid}'");
$data = mysql_fetch_array($result);
$itemtotal += $data[1];
$number = $data[0];
$amount = $data[1];
if (!$amount) {
    $amount = "0.00";
}
if (!$number) {
    $number = "0";
}
$reportdata["tablevalues"][] = array('Billable Items', $number, formatCurrency($amount));
$result = full_query("SELECT COUNT(*),SUM(tblinvoiceitems.amount) FROM tblinvoiceitems INNER JOIN tblinvoices ON tblinvoices.id=tblinvoiceitems.invoiceid INNER JOIN tblclients ON tblclients.id=tblinvoices.userid WHERE tblinvoices.datepaid LIKE '" . (int) $year . "-" . $pmonth . "-%' AND tblinvoiceitems.type='' AND currency='{$currencyid}'");
$data = mysql_fetch_array($result);
$itemtotal += $data[1];
$reportdata["tablevalues"][] = array('Custom Invoice Line Items', $data[0], formatCurrency($data[1]));
$total += $itemtotal;
$reportdata["tablevalues"][] = array('', '<strong>Sub-Total</strong>', '<strong>' . formatCurrency($itemtotal) . '</strong>');
$chartdata['rows'][] = array('c' => array(array('v' => "Miscellaneous"), array('v' => $itemtotal, 'f' => formatCurrency($itemtotal))));
$total = formatCurrency($total);
$chartdata['cols'][] = array('label' => 'Days Range', 'type' => 'string');
$chartdata['cols'][] = array('label' => 'Value', 'type' => 'number');
$args = array();
$args['legendpos'] = 'right';
$reportdata["footertext"] = $chart->drawChart('Pie', $chartdata, $args, '300px');
$reportdata["monthspagination"] = true;
コード例 #30
0
<?php

/**
 * @var string $profit
 */
?>
<font color="#ead255" face="Trebuchet MS" style="font-size: 24px;"><?php 
echo Yii::t('main', 'Здравствуйте!');
?>
</font>
<br /><br /><br /><br />
<?php 
echo Yii::t('main', 'Ваш баланс был пополнен на :profit по партнерской программе.', array(':profit' => '<font color="#ead255"><b>' . formatCurrency($profit) . '</b></font>'));
?>
<br />
<?php 
echo Yii::t('main', 'Спасибо за Ваше участие.');