Find this useful? Enter your email to receive occasional updates for securing PHP code.
Signing you up...
Thank you for signing up!
PHP Decode
<?php $memory_limit = substr(ini_get("memory_limit"), 0,-1); if($memory_limit<256){ i..
Decoded Output download
<?php
$memory_limit = substr(ini_get("memory_limit"), 0,-1);
if($memory_limit<256){
ini_set("memory_limit","256M");
}
global $x0b,$x0c,$x0d,$x0e,$x0f,$x10,$x11,$x12,$x13,$x14,$x15,$x16,$x17,$x18,$x19,$x1a,$x1b,$x1c,$x1d,$x1e,$x1f,$x20,$x21,$x22,$x23,$x24,$x25,$x26;
$x0b="array_keys"; $x0c="array_push"; $x0d="array_merge"; $x0e="array_sum"; $x0f="count"; $x10="date"; $x11="explode"; $x12="file_exists"; $x13="filesize"; $x14="html_entity_decode"; $x15="implode"; $x16="in_array"; $x17="ini_set"; $x18="is_object"; $x19="is_numeric"; $x1a="nl2br"; $x1b="number_format"; $x1c="round"; $x1d="rtrim"; $x1e="str_replace"; $x1f="str_ireplace"; $x20="strip_tags"; $x21="stripslashes"; $x22="strtoupper"; $x23="strpos"; $x24="substr"; $x25="strtolower"; $x26="trim";
class PDFContent {private $templateid;private $module;private $language;private $focus;private $db;private $mod_strings;private $app_strings;private $site_url;private $decimal_point;private $thousands_separator;private $decimals;public $pagebreak;private $ignored_picklist_values=array();private $header;private $footer;private $body;private $content;private $filename;private $templatename;private $section_sep="&#%ITS%%%@@@%%%ITS%#&";private $replacements;private $inventory_table_array = Array("PurchaseOrder"=>"vtiger_purchaseorder", "SalesOrder"=>"vtiger_salesorder", "Quotes"=>"vtiger_quotes", "Invoice"=>"vtiger_invoice");private $inventory_id_array = Array("PurchaseOrder"=>"purchaseorderid","SalesOrder"=>"salesorderid","Quotes"=>"quoteid","Invoice"=>"invoiceid");private $org_cols = array("organizationname" => "COMPANY_NAME","address" => "COMPANY_ADDRESS","city" => "COMPANY_CITY","state" => "COMPANY_STATE","code" => "COMPANY_ZIP","country" => "COMPANY_COUNTRY","phone" => "COMPANY_PHONE","fax" => "COMPANY_FAX","website" => "COMPANY_WEBSITE","logo" => "COMPANY_LOGO", );function __construct($templateid, $module, $focus, $language) {$db = "adb";$mod = "mod_strings";$app = "app_strings";global $$db, $$mod, $$app, $PDFMaker_template_id;$this->db = &$$db;$this->mod_strings = $$mod; $this->app_strings = $$app;$this->templateid = $templateid;$PDFMaker_template_id = $this->templateid;$this->module = $module;$this->focus = $focus;$this->language = $language;$this->x13();$this->x14();}public function getContent() { global $x0b,$x0c,$x0d,$x0e,$x0f,$x10,$x11,$x12,$x13,$x14,$x15,$x16,$x17,$x18,$x19,$x1a,$x1b,$x1c,$x1d,$x1e,$x1f,$x20,$x21,$x22,$x23,$x24,$x25,$x26; require_once("classes/simple_html_dom.php");$img_root = "img_root_directory";global $$img_root;$this->content = $this->body;$this->content = $this->header.$this->section_sep;$this->content .= $this->body.$this->section_sep;$this->content .= $this->footer;$this->replacements[" "]=" ";$this->replacements["##PAGE##"]="{PAGENO}";$this->replacements["##PAGES##"]="{nb}";$this->replacements["##DD-MM-YYYY##"]=$x10("d-m-Y");$this->replacements["##DD.MM.YYYY##"]=$x10("d.m.Y");$this->replacements["##MM-DD-YYYY##"]=$x10("m-d-Y");$this->replacements["##YYYY-MM-DD##"]=$x10("Y-m-d");$this->replacements["src='"]="src='".$$img_root;$this->replacements["$".$x22($this->module)."_CRMID$"]=$this->focus->id; $this->x12();$this->content = $x14($this->content,ENT_QUOTES,"utf-8"); $html = str_get_html($this->content); foreach($html->find("div[style^=page-break-after]") as $div_page_break){ $div_page_break->outertext = $this->pagebreak; $this->content = $html->save();} foreach($html->find("div[style^=PAGE-BREAK-AFTER]") as $div_page_break){ $div_page_break->outertext = $this->pagebreak; $this->content = $html->save();}$this->x0b();$this->x0e($this->module, $this->focus);$this->x0d();if($this->focus->column_fields["assigned_user_id"]==""){$this->focus->column_fields["assigned_user_id"]=$this->db->query_result($this->db->query("SELECT smownerid FROM vtiger_crmentity WHERE crmid=".$this->focus->id),0,"smownerid");}$this->x0f();$this->x10();$this->x11();$PDF_content = array();list($PDF_content["header"],$PDF_content["body"],$PDF_content["footer"]) = $x11($this->section_sep,$this->content);return $PDF_content;}public function getSettings() { global $x0b,$x0c,$x0d,$x0e,$x0f,$x10,$x11,$x12,$x13,$x14,$x15,$x16,$x17,$x18,$x19,$x1a,$x1b,$x1c,$x1d,$x1e,$x1f,$x20,$x21,$x22,$x23,$x24,$x25,$x26; $sql = "SELECT (margin_top * 10) AS margin_top,
(margin_bottom * 10) AS margin_bottom,
(margin_left * 10) AS margin_left,
(margin_right*10) AS margin_right,
format,
orientation,
encoding
FROM vtiger_pdfmaker_settings WHERE templateid = '".$this->templateid."'";$result = $this->db->query($sql);$Settings = $this->db->fetchByAssoc($result, 1);return $Settings;}private function x0b() { global $x0b,$x0c,$x0d,$x0e,$x0f,$x10,$x11,$x12,$x13,$x14,$x15,$x16,$x17,$x18,$x19,$x1a,$x1b,$x1c,$x1d,$x1e,$x1f,$x20,$x21,$x22,$x23,$x24,$x25,$x26; $sql = "SELECT fieldid, fieldname, uitype
FROM vtiger_field
WHERE tabid=".getTabId($this->module)." AND (displaytype != 3 OR fieldid = 64) AND fieldid != 105";$result = $this->db->query($sql);$num_rows = $this->db->num_rows($result);if ($num_rows > 0){while($row = $this->db->fetch_array($result)){$related_module = "";$fk_record = $this->focus->column_fields[$row["fieldname"]];switch ($row["uitype"]) {case "51": $related_module = "Accounts"; break;case "57": $related_module = "Contacts"; break;case "58": $related_module = "Campaigns"; break;case "59": $related_module = "Products"; break;case "73": $related_module = "Accounts"; break;case "75": $related_module = "Vendors"; break;case "81": $related_module = "Vendors"; break;case "76": $related_module = "Potentials"; break;case "78": $related_module = "Quotes"; break;case "80": $related_module = "SalesOrder"; break;case "68":case "10": $related_module = getSalesEntityType($fk_record); break;}if ($related_module != "") {$tabid = getTabId($related_module);$field_inf = "_fieldinfo_cache";$temp = &VTCacheUtils::$$field_inf;unset($temp[$tabid]);$focus2 = CRMEntity::getInstance($related_module);if ($fk_record != "" && $fk_record != "0") {$result_delete = $this->db->query("SELECT deleted FROM vtiger_crmentity WHERE crmid='".$fk_record."' AND deleted=0");if($this->db->num_rows($result_delete)>0){$focus2->retrieve_entity_info($fk_record,$related_module); $focus2->id = $fk_record;}}$this->replacements["$"."R_".$x22($related_module)."_CRMID$"]=$focus2->id; if(isset($related_module) AND $related_module == "Contacts"){$this->replacements['$R_CONTACTS_IMAGENAME$']=$this->x18($focus2->id); } $this->x12();$this->x0e($related_module, $focus2, true);unset($focus2);}if ($row["uitype"] == "10" || $row["uitype"] == "68") {if ($related_module == "Accounts")$related_module2 = "Contacts";else$related_module2 = "Accounts";$tabid2 = getTabId($related_module2);$field_inf = "_fieldinfo_cache";$temp = &VTCacheUtils::$$field_inf;unset($temp[$tabid2]);$focus3 = CRMEntity::getInstance($related_module2);$this->replacements["$"."R_".$x22($related_module2)."_CRMID$"]=$focus3->id;$this->x0e($related_module2, $focus3, true);unset($focus3);}}}}private function x0c() { global $x0b,$x0c,$x0d,$x0e,$x0f,$x10,$x11,$x12,$x13,$x14,$x15,$x16,$x17,$x18,$x19,$x1a,$x1b,$x1c,$x1d,$x1e,$x1f,$x20,$x21,$x22,$x23,$x24,$x25,$x26; require_once("classes/simple_html_dom.php");$html = str_get_html($this->content);$tableDOM=false;foreach($html->find("td") as $td){if($x26($td->plaintext) == "#PRODUCTBLOC_START#"){ $td->parent->outertext = "#PRODUCTBLOC_START#"; list($tag)=$x11(">",$td->parent->parent->parent->outertext,2);$header = $td->parent->prev_sibling()->outertext;$header_style = $td->parent->prev_sibling()->children[0]->getAttribute("style");$footer_tag="<tr>"; if(isset($header_style)){ $StyleHeader = $x11(";", $header_style);if(isset($StyleHeader)){ foreach($StyleHeader as $style_header_tag) {if($x23($style_header_tag, "border-top") == TRUE){$footer_tag.="<td colspan='".$td->getAttribute("colspan")."' style='".$style_header_tag."'> </td>";} }}} else {$footer_tag.="<td colspan='".$td->getAttribute("colspan")."' style=\"border-top:1px solid #000000;\"> </td>";}$footer_tag.="</tr>";$var = $td->parent->next_sibling()->last_child()->plaintext;$subtotal_tr="";if($x23($var, "TOTAL")!==false){ if($x18($td)){$style_subtotal=$td->getAttribute("style");} if(isset($td->innertext)){list($style_subtotal_tag,$style_subtotal_endtag)=$x11("#PRODUCTBLOC_START#",$td->innertext);} else {$style_subtotal_tag = "";$style_subtotal_endtag = "";}if(isset($style_subtotal)){$StyleSubtotal = $x11(";", $style_subtotal); if(isset($StyleSubtotal)){ foreach($StyleSubtotal as $style_tag) {if($x23($style_tag, "border-top") == TRUE){$tag.=" style=\"".$style_tag."\"";break;} } }} else {$style_subtotal = ""; } $tag.=">";$subtotal_tr="<tr>";$subtotal_tr.="<td colspan='".($td->getAttribute("colspan")-1)."' style='".$style_subtotal.";border-right:none'>".$style_subtotal_tag."%G_Subtotal%".$style_subtotal_endtag."</td>";$subtotal_tr.="<td align='right' nowrap=\"nowrap\" style='".$style_subtotal."'>".$style_subtotal_tag."".$x1d($var,"$")."_SUBTOTAL$".$style_subtotal_endtag."</td>"; $subtotal_tr.="</tr>"; }$tableDOM["tag"] = $tag; $tableDOM["header"] = $header; $tableDOM["footer"] = $footer_tag; $tableDOM["subtotal"] = $subtotal_tr;}if($x26($td->plaintext) == "#PRODUCTBLOC_END#") $td->parent->outertext = "#PRODUCTBLOC_END#";}$this->content=$html->save();return $tableDOM;}private function x0d() { global $x0b,$x0c,$x0d,$x0e,$x0f,$x10,$x11,$x12,$x13,$x14,$x15,$x16,$x17,$x18,$x19,$x1a,$x1b,$x1c,$x1d,$x1e,$x1f,$x20,$x21,$x22,$x23,$x24,$x25,$x26; if ($this->module == "Quotes" || $this->module == "Invoice" || $this->module == "SalesOrder" || $this->module == "PurchaseOrder"){$this->replacements["$"."SUBTOTAL$"] = $this->x1e($this->focus->column_fields["hdnSubTotal"]);$this->replacements["$"."TOTAL$"] = $this->x1e($this->focus->column_fields["hdnGrandTotal"]);$currencytype = $this->x1c();$currencytype["currency_symbol"] = $x1e("","€",$currencytype["currency_symbol"]);$currencytype["currency_symbol"] = $x1e("","£",$currencytype["currency_symbol"]);$this->replacements["$"."CURRENCYNAME$"] = getTranslatedCurrencyString($currencytype["currency_name"]);$this->replacements["$"."CURRENCYSYMBOL$"] = $currencytype["currency_symbol"];$this->replacements["$"."CURRENCYCODE$"] = $currencytype["currency_code"];$this->replacements["$"."ADJUSTMENT$"] = $this->x1e($this->focus->column_fields["txtAdjustment"]);$Products = $this->x15();$this->replacements["$"."TOTALWITHOUTVAT$"] = $Products["TOTAL"]["TOTALWITHOUTVAT"];$this->replacements["$"."VAT$"] = $Products["TOTAL"]["TAXTOTAL"];$this->replacements["$"."VATPERCENT$"] = $Products["TOTAL"]["TAXTOTALPERCENT"];if ($x0f($Products["TOTAL"]["VATBLOCK"]) > 0){ $vattable = "<table border='1' style=\"border-collapse:collapse;\" cellpadding=\"3\">"; $vattable .= "<tr>
<td nowrap align='center'>".$this->app_strings["Name"]."</td>
<td nowrap align='center'>".$this->mod_strings["LBL_VATBLOCK_VAT_PERCENT"]."</td>
<td nowrap align='center'>".$this->mod_strings["LBL_VATBLOCK_SUM"]." (".$currencytype["currency_symbol"].")"."</td>
<td nowrap align='center'>".$this->mod_strings["LBL_VATBLOCK_VAT_VALUE"]." (".$currencytype["currency_symbol"].")"."</td>
</tr>"; foreach ($Products["TOTAL"]["VATBLOCK"] as $keyW=>$valueW) {if($valueW["netto"]!=0) {$vattable .= "<tr>
<td nowrap align='left' width='20%'>".$valueW["label"]."</td>
<td nowrap align='right' width='25%'>".$this->x1e($valueW["value"])." %</td>
<td nowrap align='right' width='30%'>".$this->x1e($valueW["netto"])."</td>
<td nowrap align='right' width='25%'>".$this->x1e($valueW["vat"])."</td>
</tr>";} } $vattable .= "</table>";}else{ $vattable = "";}$this->replacements["$"."VATBLOCK$"] = $vattable;$this->replacements["$"."TOTALWITHVAT$"] = $Products["TOTAL"]["TOTALWITHVAT"];$this->replacements["$"."SHTAXAMOUNT$"] = $Products["TOTAL"]["SHTAXAMOUNT"];$this->replacements["$"."SHTAXTOTAL$"] = $Products["TOTAL"]["SHTAXTOTAL"];$this->replacements["$"."TOTALDISCOUNT$"] = $Products["TOTAL"]["FINALDISCOUNT"];$this->replacements["$"."TOTALDISCOUNTPERCENT$"] = $Products["TOTAL"]["FINALDISCOUNTPERCENT"];$this->replacements["$"."TOTALAFTERDISCOUNT$"] = $Products["TOTAL"]["TOTALAFTERDISCOUNT"];$this->x12();$var_array = array();if($x23($this->content,"#PRODUCTBLOC_START#") !== false && $x23($this->content,"#PRODUCTBLOC_END#") !== false){$tableTag = $this->x0c();$breaklines_array = $this->x16();$breaklines = $breaklines_array["products"];$show_header = $breaklines_array["show_header"];$show_subtotal = $breaklines_array["show_subtotal"];$breakline_type="";if($x0f($breaklines)>0){if($tableTag!==false) {$breakline_type="</table>".$this->pagebreak.$tableTag["tag"];if($show_header==1)$breakline_type.=$tableTag["header"];if($show_subtotal==1){$breakline_type=$tableTag["subtotal"].$breakline_type;} else {$breakline_type=$tableTag["footer"].$breakline_type;}}else$breakline_type=$this->pagebreak;}$ExplodedPdf = array();$Exploded = $x11("#PRODUCTBLOC_START#",$this->content);$ExplodedPdf[] = $Exploded[0];for($iterator=1;$iterator<$x0f($Exploded);$iterator++){$SubExploded = $x11("#PRODUCTBLOC_END#",$Exploded[$iterator]);foreach($SubExploded as $part)$ExplodedPdf[] = $part;$highestpartid = $iterator*2-1;$ProductParts[$highestpartid]=$ExplodedPdf[$highestpartid];$ExplodedPdf[$highestpartid]='';} if ($Products["P"]) {foreach ($Products["P"] AS $Product_i => $Product_Details) {foreach($ProductParts as $productpartid=>$productparttext){$breakline="";if($breakline_type!="" && isset($breaklines[$Product_Details["SERVICES_RECORD_ID"]."_".$Product_Details["PRODUCTSEQUENCE"]]) || isset($breaklines[$Product_Details["PRODUCTS_RECORD_ID"]."_".$Product_Details["PRODUCTSEQUENCE"]]) ){$breakline=$breakline_type;}$productparttext.=$breakline;foreach ($Product_Details AS $coll => $value) {$productparttext = $x1e("$".$x22($coll)."$",$value,$productparttext);}$ExplodedPdf[$productpartid].=$productparttext;}} }$this->content = $x15('',$ExplodedPdf);}}}private function x0e($emodule, $efocus, $is_related = false, $is_inventory = false) { global $x0b,$x0c,$x0d,$x0e,$x0f,$x10,$x11,$x12,$x13,$x14,$x15,$x16,$x17,$x18,$x19,$x1a,$x1b,$x1c,$x1d,$x1e,$x1f,$x20,$x21,$x22,$x23,$x24,$x25,$x26; $related_fieldnames = array("related_to","relatedto","parent_id","parentid","product_id","productid","service_id","serviceid","vendor_id","product","account","invoiceid","linktoaccountscontacts","projectid","sc_related_to");if($is_inventory)$inventory_content=array();$tabid = getTabid($emodule);if ($is_related)$related = "R_";else$related = "";$Checkboxes = array();$Picklists = array();$Textareas = array();$Datefields = array();$Multipicklists = array();$NumbersField = array();$sql = "SELECT fieldname, uitype FROM vtiger_field WHERE tabid = '".$tabid."'";$result = $this->db->query($sql);while($row = $this->db->fetchByAssoc($result)){if ($row["uitype"] == "19" || $row["uitype"] == "20" || $row["uitype"] == "21" || $row["uitype"] == "24")$Textareas[] = $row["fieldname"];elseif ($row["uitype"] == "5" || $row["uitype"] == "23" || $row["uitype"] == "70")$Datefields[] = $row["fieldname"];elseif ($row["uitype"] == "15" || $row["fieldname"] == "salutationtype")$Picklists[] = $row["fieldname"];elseif ($row["uitype"] == "56")$Checkboxes[] = $row["fieldname"];elseif ($row["uitype"] == "33")$Multipicklists[] = $row["fieldname"];elseif ($row["uitype"] == "71")$NumbersField[] = $row["fieldname"];}foreach ($efocus->column_fields as $fieldname => $value){if ($fieldname == "assigned_user_id")$value = $this->x19($value);elseif($fieldname == "account_id") { $value = getAccountName($value);}elseif($fieldname == "potential_id")$value = getPotentialName($value);elseif($fieldname == "contact_id")$value = getContactName($value);elseif($fieldname == "quote_id")$value = getQuoteName($value);elseif($fieldname == "salesorder_id")$value = getSoName($value);elseif($fieldname == "campaignid")$value = getCampaignName($value);elseif($fieldname == "terms_conditions")$value = $this->x20($value);elseif($fieldname == "comments")$value = $this->x21($efocus);elseif($fieldname == "folderid")$value = $this->x22($value);elseif($x16($fieldname, $related_fieldnames)) {if ($value != "") {$parent_module = getSalesEntityType($value);$displayValueArray = getEntityName($parent_module, $value);if(!empty($displayValueArray)) {foreach($displayValueArray as $key=>$p_value) {$value = $p_value;}}if($fieldname=="invoiceid" && $value=="0")$value="";}}if($x16($fieldname, $Datefields))$value = getValidDisplayDate($value);elseif($x16($fieldname, $Picklists)) {if(!$x16($x26($value), $this->ignored_picklist_values))$value = $this->x1b($value,$emodule);else$value = "";}elseif($x16($fieldname, $Checkboxes)) {$pdf_app_strings = return_application_language($this->language);if($value == 1)$value = $pdf_app_strings["yes"];else$value = $pdf_app_strings["no"];}elseif($x16($fieldname, $Textareas))$value = $x1a($value);elseif($x16($fieldname, $Multipicklists)) $value = $x1f(' |##| ',', ',$value);elseif($x16($fieldname, $NumbersField))$value = $this->x1e($value);if ($is_inventory)$inventory_content[$x22($emodule."_".$fieldname)] = $value;else$this->replacements["$".$related.$x22($emodule."_".$fieldname)."$"]=$value;}if($is_inventory)return $inventory_content;else$this->x12();}private function x0f() { global $x0b,$x0c,$x0d,$x0e,$x0f,$x10,$x11,$x12,$x13,$x14,$x15,$x16,$x17,$x18,$x19,$x1a,$x1b,$x1c,$x1d,$x1e,$x1f,$x20,$x21,$x22,$x23,$x24,$x25,$x26; $cur_usr = "current_user";$root_dir = "root_directory";global $$cur_usr,$$root_dir; $sql = "SELECT * FROM vtiger_organizationdetails";$result = $this->db->query($sql);$Org_Details = $this->db->fetchByAssoc($result, 1);foreach ($Org_Details AS $coll => $value) {if ($coll == "logo")$value = "<img src=\"".$$root_dir."test/logo/".$Org_Details["logoname"]."\">";$this->replacements["$".$this->org_cols[$coll]."$"] = $value;} $sql = "SELECT tandc FROM vtiger_inventory_tandc WHERE type = 'Inventory'";$tandc = $this->db->getOne($sql,0,"tandc");$this->replacements["$"."TERMS_AND_CONDITIONS$"] = $x1a($tandc); $user_sql = "SELECT * FROM vtiger_users WHERE id=".$this->focus->column_fields["assigned_user_id"];$user_res = $this->db->query($user_sql);$user_row = $this->db->fetchByAssoc($user_res);$this->replacements["$"."USER_USERNAME$"] = $user_row["user_name"];$this->replacements["$"."USER_FIRSTNAME$"] = $user_row["first_name"];$this->replacements["$"."USER_LASTNAME$"] = $user_row["last_name"];$this->replacements["$"."USER_EMAIL$"] = $user_row["email1"];$this->replacements["$"."USER_TITLE$"] = $user_row["title"];$this->replacements["$"."USER_FAX$"] = $user_row["phone_fax"];$this->replacements["$"."USER_DEPARTMENT$"] = $user_row["department"];$this->replacements["$"."USER_OTHER_EMAIL$"] = $user_row["email2"];$this->replacements["$"."USER_PHONE$"] = $user_row["phone_work"];$this->replacements["$"."USER_YAHOOID$"] = $user_row["yahoo_id"];$this->replacements["$"."USER_MOBILE$"] = $user_row["phone_mobile"];$this->replacements["$"."USER_HOME_PHONE$"] = $user_row["phone_home"];$this->replacements["$"."USER_OTHER_PHONE$"] = $user_row["phone_other"];$this->replacements["$"."USER_SIGHNATURE$"] = $user_row["signature"];$this->replacements["$"."USER_NOTES$"] = $user_row["description"];$this->replacements["$"."USER_ADDRESS$"] = $user_row["address_street"];$this->replacements["$"."USER_COUNTRY$"] = $user_row["address_country"];$this->replacements["$"."USER_CITY$"] = $user_row["address_city"];$this->replacements["$"."USER_ZIP$"] = $user_row["address_postalcode"];$this->replacements["$"."USER_STATE$"] = $user_row["address_state"]; $this->replacements["$"."L_USER_USERNAME$"] = $$cur_usr->column_fields["user_name"];$this->replacements["$"."L_USER_FIRSTNAME$"] = $$cur_usr->column_fields["first_name"];$this->replacements["$"."L_USER_LASTNAME$"] = $$cur_usr->column_fields["last_name"];$this->replacements["$"."L_USER_EMAIL$"] = $$cur_usr->column_fields["email1"];$this->replacements["$"."L_USER_TITLE$"] = $$cur_usr->column_fields["title"];$this->replacements["$"."L_USER_FAX$"] = $$cur_usr->column_fields["phone_fax"];$this->replacements["$"."L_USER_DEPARTMENT$"] = $$cur_usr->column_fields["department"];$this->replacements["$"."L_USER_OTHER_EMAIL$"] = $$cur_usr->column_fields["email2"];$this->replacements["$"."L_USER_PHONE$"] = $$cur_usr->column_fields["phone_work"];$this->replacements["$"."L_USER_YAHOOID$"] = $$cur_usr->column_fields["yahoo_id"];$this->replacements["$"."L_USER_MOBILE$"] = $$cur_usr->column_fields["phone_mobile"];$this->replacements["$"."L_USER_HOME_PHONE$"] = $$cur_usr->column_fields["phone_home"];$this->replacements["$"."L_USER_OTHER_PHONE$"] = $$cur_usr->column_fields["phone_other"];$this->replacements["$"."L_USER_SIGHNATURE$"] = $$cur_usr->column_fields["signature"];$this->replacements["$"."L_USER_NOTES$"] = $$cur_usr->column_fields["description"];$this->replacements["$"."L_USER_ADDRESS$"] = $$cur_usr->column_fields["address_street"];$this->replacements["$"."L_USER_COUNTRY$"] = $$cur_usr->column_fields["address_country"];$this->replacements["$"."L_USER_CITY$"] = $$cur_usr->column_fields["address_city"];$this->replacements["$"."L_USER_ZIP$"] = $$cur_usr->column_fields["address_postalcode"];$this->replacements["$"."L_USER_STATE$"] = $$cur_usr->column_fields["address_state"];$this->x12();}private function x10(){ global $x0b,$x0c,$x0d,$x0e,$x0f,$x10,$x11,$x12,$x13,$x14,$x15,$x16,$x17,$x18,$x19,$x1a,$x1b,$x1c,$x1d,$x1e,$x1f,$x20,$x21,$x22,$x23,$x24,$x25,$x26; $app_lang = return_application_language($this->language); $mod_lang = return_specified_module_language($this->language,$this->module); if($x23($this->content, "%G_")!==false){ foreach($app_lang as $key=>$value){ $this->replacements["%G_".$key."%"] = $value; } } if($x23($this->content, "%M_")!==false){ foreach($mod_lang as $key=>$value){ $this->replacements["%M_".$key."%"] = $value; } } $this->x12();}private function x11(){ global $x0b,$x0c,$x0d,$x0e,$x0f,$x10,$x11,$x12,$x13,$x14,$x15,$x16,$x17,$x18,$x19,$x1a,$x1b,$x1c,$x1d,$x1e,$x1f,$x20,$x21,$x22,$x23,$x24,$x25,$x26; require_once("classes/simple_html_dom.php");$this->replacements["[BARCODE|"]="<barcode>";$this->replacements["|BARCODE]"]="</barcode>";$this->x12();$html = str_get_html($this->content);foreach($html->find("barcode") as $barcode) {list($type,$code) = $x11("=",$barcode->plaintext,2);$barcode->outertext = '<barcode code="'.$code.'" type="'.$type.'" />';}$this->content = $html->save();}private function x12() { global $x0b,$x0c,$x0d,$x0e,$x0f,$x10,$x11,$x12,$x13,$x14,$x15,$x16,$x17,$x18,$x19,$x1a,$x1b,$x1c,$x1d,$x1e,$x1f,$x20,$x21,$x22,$x23,$x24,$x25,$x26; if(!empty($this->replacements)){$this->content = $x1e($x0b($this->replacements), $this->replacements, $this->content);$this->replacements = array();}} private function x13() { global $x0b,$x0c,$x0d,$x0e,$x0f,$x10,$x11,$x12,$x13,$x14,$x15,$x16,$x17,$x18,$x19,$x1a,$x1b,$x1c,$x1d,$x1e,$x1f,$x20,$x21,$x22,$x23,$x24,$x25,$x26; $salt="site_URL";global $$salt;$this->site_url = $x26($$salt,"/");$sql = "SELECT vtiger_pdfmaker.*, vtiger_pdfmaker_settings.*
FROM vtiger_pdfmaker
LEFT JOIN vtiger_pdfmaker_settings
ON vtiger_pdfmaker_settings.templateid = vtiger_pdfmaker.templateid
WHERE vtiger_pdfmaker.templateid=?";$result = $this->db->pquery($sql, array($this->templateid));$data = $this->db->fetch_array($result);$this->decimal_point = $x14($data["decimal_point"], ENT_QUOTES);$this->thousands_separator = $x14(($data["thousands_separator"]!="sp" ? $data["thousands_separator"] : " "), ENT_QUOTES);$this->decimals = $data["decimals"];$this->header = $data["header"];$this->footer = $data["footer"];$this->body = $data["body"];$this->filename = $data["file_name"];$this->templatename = $data["filename"]; $this->pagebreak = '<pagebreak orientation="'.$data["orientation"].'" margin-left="'.($data["margin_left"] * 10).'mm" margin-right="'.($data["margin_right"] * 10).'mm" margin-top="0mm" margin-bottom="0mm" margin-header="'.($data["margin_top"] * 10).'mm" margin-footer="'.($data["margin_bottom"] * 10).'mm" />';}private function x14() { global $x0b,$x0c,$x0d,$x0e,$x0f,$x10,$x11,$x12,$x13,$x14,$x15,$x16,$x17,$x18,$x19,$x1a,$x1b,$x1c,$x1d,$x1e,$x1f,$x20,$x21,$x22,$x23,$x24,$x25,$x26; $sql = "SELECT value FROM vtiger_pdfmaker_ignorepicklistvalues";$result = $this->db->query($sql);while($row = $this->db->fetchByAssoc($result)) {$this->ignored_picklist_values[] = $row["value"];}}private function x15() { global $x0b,$x0c,$x0d,$x0e,$x0f,$x10,$x11,$x12,$x13,$x14,$x15,$x16,$x17,$x18,$x19,$x1a,$x1b,$x1c,$x1d,$x1e,$x1f,$x20,$x21,$x22,$x23,$x24,$x25,$x26; $taxtype = $this->x1d();$currencytype = $this->x1c();$query="select case when vtiger_products.productid != '' then vtiger_products.productname else vtiger_service.servicename end as productname," ." case when vtiger_products.productid != '' then vtiger_products.productid else vtiger_service.serviceid end as psid," ." case when vtiger_products.productid != '' then vtiger_products.product_no else vtiger_service.service_no end as psno," ." case when vtiger_products.productid != '' then 'Products' else 'Services' end as entitytype," ." case when vtiger_products.productid != '' then vtiger_products.unit_price else vtiger_service.unit_price end as unit_price," ." case when vtiger_products.productid != '' then vtiger_products.usageunit else vtiger_service.service_usageunit end as usageunit," ." case when vtiger_products.productid != '' then vtiger_products.qty_per_unit else vtiger_service.qty_per_unit end as qty_per_unit," ." case when vtiger_products.productid != '' then vtiger_products.qtyinstock else 'NA' end as qtyinstock," ." case when vtiger_products.productid != '' then c1.description else c2.description end as psdescription, vtiger_inventoryproductrel.* " ." from vtiger_inventoryproductrel" ." left join vtiger_products on vtiger_products.productid=vtiger_inventoryproductrel.productid " ." left join vtiger_crmentity as c1 on c1.crmid = vtiger_products.productid " ." left join vtiger_service on vtiger_service.serviceid=vtiger_inventoryproductrel.productid " ." left join vtiger_crmentity as c2 on c2.crmid = vtiger_service.serviceid " ." where id=? ORDER BY sequence_no";$result = $this->db->pquery($query, array($this->focus->id));$num_rows=$this->db->num_rows($result);$netTotal = "0.00"; $totalAfterDiscount_subtotal=0;$total_subtotal=0;$totalsum_subtotal=0; $images = $this->x17(); $Total_Tax_Values = array();for($i=1;$i<=$num_rows;$i++){$sub_prod_query = $this->db->pquery("SELECT productid from vtiger_inventorysubproductrel WHERE id=? AND sequence_no=?",array($this->focus->id,$i));$subprodname_str='';if($this->db->num_rows($sub_prod_query)>0){for($j=0;$j<$this->db->num_rows($sub_prod_query);$j++){$sprod_id = $this->db->query_result($sub_prod_query,$j,"productid");$sprod_name = getProductName($sprod_id);$str_sep = "";if($j>0) $str_sep = ":";$subprodname_str .= $str_sep." - ".$sprod_name;}}$subprodname_str = $x1e(":","<br>",$subprodname_str);$psid = $this->db->query_result($result,$i-1,"psid");$psno = $this->db->query_result($result,$i-1,"psno");$productid=$this->db->query_result($result,$i-1,"productid");$entitytype=$this->db->query_result($result,$i-1,"entitytype");$producttitle = $productname= $this->db->query_result($result,$i-1,"productname");if($subprodname_str!="") $productname .= "<br/><span style='color:#C0C0C0;font-style:italic;'>".$subprodname_str."</span>";$comment=$this->db->query_result($result,$i-1,"comment");$psdescription =$this->db->query_result($result,$i-1,"psdescription");$inventory_prodrel_desc = $this->db->query_result($result,$i-1,"description");$qtyinstock=$this->db->query_result($result,$i-1,"qtyinstock");$qty=$this->db->query_result($result,$i-1,"quantity");$qty_per_unit=$this->db->query_result($result,$i-1,"qty_per_unit");$usageunit=$this->db->query_result($result,$i-1,"usageunit");$unitprice=$this->db->query_result($result,$i-1,"unit_price");$listprice=$this->db->query_result($result,$i-1,"listprice");$total = $qty*$listprice; $discount_percent=$this->db->query_result($result,$i-1,"discount_percent");$discount_amount=$this->db->query_result($result,$i-1,"discount_amount");$totalAfterDiscount = $total;$productDiscount = "0.00";$productDiscountPercent = "";if($discount_percent != "NULL" && $discount_percent != "") {$productDiscount = $total*$discount_percent/100;$totalAfterDiscount = $total-$productDiscount; $productDiscountPercent=$discount_percent;}elseif($discount_amount != "NULL" && $discount_amount != "") {$productDiscount = $discount_amount;$totalAfterDiscount = $total-$productDiscount;} $netprice = $totalAfterDiscount; if($taxtype == "individual") {$taxtotal = "0.00";$tax_info_message = $mod_strings["LBL_TOTAL_AFTER_DISCOUNT"]." = $totalAfterDiscount \n";$tax_details = getTaxDetailsForProduct($productid,"all");$Tax_Values = array();for($tax_count=0;$tax_count<$x0f($tax_details);$tax_count++) {$tax_name = $tax_details[$tax_count]["taxname"];$tax_label = $tax_details[$tax_count]["taxlabel"];$tax_value = getInventoryProductTaxValue($this->focus->id, $productid, $tax_name);$individual_taxamount = $totalAfterDiscount*$tax_value/100;$taxtotal = $taxtotal + $individual_taxamount;if ($tax_name != "" && $tax_value > 0){ $vatblock[$tax_name."-".$tax_value]["label"] = $tax_label;$vatblock[$tax_name."-".$tax_value]["netto"] += $totalAfterDiscount; $vatblock[$tax_name."-".$tax_value]["vat"] += $x1c($individual_taxamount,$this->decimals);$vatblock[$tax_name."-".$tax_value]["value"] = $tax_value;$x0c($Tax_Values, $tax_value);$x0c($Total_Tax_Values, $tax_value);}$netprice = $netprice + $taxtotal;} if ($x0f($Tax_Values) > 0){ $tax_avg_value = $x0e($Tax_Values);}else{ $tax_avg_value = "0.00";} $Details["P"][$i]["PRODUCTVATPERCENT"] = $this->x1e($tax_avg_value);$Details["P"][$i]["PRODUCTVATSUM"] = $this->x1e($taxtotal);}if ($entitytype == "Products"){ $Details["P"][$i]["PRODUCTS_CRMID"] = $psid; $Details["P"][$i]["SERVICES_CRMID"] = "";}else{ $Details["P"][$i]["PRODUCTS_CRMID"] = ""; $Details["P"][$i]["SERVICES_CRMID"] = $psid;}$Details["P"][$i]["PS_CRMID"] = $psid;$Details["P"][$i]["PS_NO"] = $psno;if($comment!=""){$comment = $x1e("\n", "<br>", $x1a($comment)); $comment = $x14($comment,ENT_QUOTES,"utf-8");$productname .= "<br /><small>".$comment."</small>";}$Details["P"][$i]["PRODUCTNAME"] = $productname;$Details["P"][$i]["PRODUCTTITLE"] = $producttitle;$psdescription = $x1e("\n", "<br>", $x1a($psdescription));$Details["P"][$i]["PRODUCTDESCRIPTION"] = $x14($psdescription,ENT_QUOTES,"utf-8");$Details["P"][$i]["PRODUCTEDITDESCRIPTION"] = $comment;$inventory_prodrel_desc = $x1e("\n", "<br>", $x1a($inventory_prodrel_desc)); $Details["P"][$i]["CRMNOWPRODUCTDESCRIPTION"] = $x14($inventory_prodrel_desc,ENT_QUOTES,"utf-8");$Details["P"][$i]["PRODUCTLISTPRICE"] = $this->x1e($listprice);$Details["P"][$i]["PRODUCTTOTAL"] = $this->x1e($total);$Details["P"][$i]["PRODUCTQUANTITY"] = $this->x1e($qty);$Details["P"][$i]["PRODUCTQINSTOCK"] = $this->x1e($qtyinstock); $Details["P"][$i]["PRODUCTPRICE"] = $this->x1e($unitprice); $Details["P"][$i]["PRODUCTPOSITION"] = $i;$Details["P"][$i]["PRODUCTQTYPERUNIT"] = $this->x1e($qty_per_unit); $Details["P"][$i]["PRODUCTUSAGEUNIT"] = $this->x1b($usageunit,"Products/Services");$Details["P"][$i]["PRODUCTDISCOUNT"] = $this->x1e($productDiscount);$Details["P"][$i]["PRODUCTDISCOUNTPERCENT"] = $this->x1e($productDiscountPercent);$Details["P"][$i]["PRODUCTSTOTALAFTERDISCOUNTSUM"] = $totalAfterDiscount; $Details["P"][$i]["PRODUCTSTOTALAFTERDISCOUNT"] = $this->x1e($totalAfterDiscount);$Details["P"][$i]["PRODUCTTOTALSUM"] = $this->x1e($totalAfterDiscount+$taxtotal); $totalAfterDiscount_subtotal += $totalAfterDiscount;$total_subtotal += $total;$totalsum_subtotal+= $totalAfterDiscount+$taxtotal;$Details["P"][$i]["PRODUCTSTOTALAFTERDISCOUNT_SUBTOTAL"] = $this->x1e($totalAfterDiscount_subtotal);$Details["P"][$i]["PRODUCTTOTAL_SUBTOTAL"] = $this->x1e($total_subtotal);$Details["P"][$i]["PRODUCTTOTALSUM_SUBTOTAL"] = $this->x1e($totalsum_subtotal); $sequence = $this->db->query_result($result,$i-1,"sequence_no");$Details["P"][$i]["PRODUCTSEQUENCE"] = $sequence;if(isset($images[$productid."_".$sequence])){$width="";$height="";if($images[$productid."_".$sequence]["width"]>0)$width=" width='".$images[$productid."_".$sequence]["width"]."' ";if($images[$productid."_".$sequence]["height"]>0)$height=" height='".$images[$productid."_".$sequence]["height"]."' ";$Details["P"][$i]["PRODUCTS_IMAGENAME"] = "<img src='".$this->site_url."/".$images[$productid."_".$sequence]["src"]."' ".$width.$height."/>";} $focus_p = CRMEntity::getInstance("Products");if ($entitytype == "Products" && $psid != "") {$focus_p->id = $psid;$this->x1f($focus_p,$psid,"Products"); }$Array_P = $this->x0e("Products", $focus_p, false, true);$Details["P"][$i] = $x0d($Array_P,$Details["P"][$i]);unset($focus_p);$focus_s = CRMEntity::getInstance("Services");if ($entitytype == "Services" && $psid != "") {$focus_s->id = $psid;$this->x1f($focus_s,$psid,"Services"); }$Array_S = $this->x0e("Services", $focus_s, false, true);$Details["P"][$i] = $x0d($Array_S,$Details["P"][$i]);unset($focus_s); $sumwithoutvat += $totalAfterDiscount;$netTotal = $netTotal + $netprice;} $finalDiscount = "0.00";$final_discount_info = "0";$finalDiscountPercent=""; if($this->focus->column_fields["hdnDiscountPercent"] != "0") {$finalDiscount = ($netTotal*$this->focus->column_fields["hdnDiscountPercent"]/100);$finalDiscountPercent = $this->focus->column_fields["hdnDiscountPercent"];}elseif($this->focus->column_fields["hdnDiscountAmount"] != "0") {$finalDiscount = $this->focus->column_fields["hdnDiscountAmount"];} $taxtotal = "0.00";if($taxtype == "group") {$final_totalAfterDiscount = $netTotal - $finalDiscount;$tax_details = getAllTaxes("available","","edit",$this->focus->id);for($tax_count=0;$tax_count<$x0f($tax_details);$tax_count++) {$tax_name = $tax_details[$tax_count]["taxname"];$tax_label = $tax_details[$tax_count]["taxlabel"];$tax_value = $this->db->query_result($result,0,$tax_name);if($tax_value == "" || $tax_value == "NULL")$tax_value = "0.00";$taxamount = ($netTotal-$finalDiscount)*$tax_value/100;$taxtotal = $taxtotal + $taxamount;if ($tax_name != "" && $tax_value > 0){$vatblock[$tax_name]["label"] = $tax_label;$vatblock[$tax_name]["netto"] = $final_totalAfterDiscount; $vatblock[$tax_name]["vat"] += $taxamount; $vatblock[$tax_name]["value"] = $tax_value; } $total_vat_percent += $tax_value;}$vat_value = $taxtotal; foreach ($Details["P"] as $keyP=>$valueP) {$productvatsum = ($Details["P"][$keyP]["PRODUCTSTOTALAFTERDISCOUNTSUM"]*$total_vat_percent)/100;$producttotalsum = $Details["P"][$keyP]["PRODUCTSTOTALAFTERDISCOUNTSUM"] + $productvatsum;$Details["P"][$keyP]["PRODUCTVATPERCENT"] = $this->x1e($total_vat_percent);$Details["P"][$keyP]["PRODUCTVATSUM"] = $this->x1e($productvatsum);$Details["P"][$keyP]["PRODUCTTOTALSUM"] = $this->x1e($producttotalsum);} }else{if ($x0f($vatblock) > 0){ foreach ($vatblock as $keyM => $valueM) $vat_value += $valueM["vat"];}else{ $vat_value = "0.00"; }} $shAmount = ($this->focus->column_fields["hdnS_H_Amount"] != "")?$this->focus->column_fields["hdnS_H_Amount"]:"0.00";$shtaxtotal = "0.00";$shtax_details = getAllTaxes("available","sh","edit",$this->focus->id);for($shtax_count=0;$shtax_count<$x0f($shtax_details);$shtax_count++) {$shtax_name = $shtax_details[$shtax_count]["taxname"];$shtax_label = $shtax_details[$shtax_count]["taxlabel"];$shtax_percent = getInventorySHTaxPercent($this->focus->id,$shtax_name);$shtaxamount = $shAmount*$shtax_percent/100;$shtaxtotal = $shtaxtotal + $shtaxamount;}$totalafterdiscount = $sumwithoutvat-$finalDiscount;$totalwithvat = ($sumwithoutvat-$finalDiscount)+$vat_value;$Details["TOTAL"]["NETTOTAL"] = $this->x1e($netTotal);$Details["TOTAL"]["TOTALWITHOUTVAT"] = $this->x1e($sumwithoutvat);$Details["TOTAL"]["FINALDISCOUNT"] = $this->x1e($finalDiscount);$Details["TOTAL"]["FINALDISCOUNTPERCENT"] = $this->x1e($finalDiscountPercent);$Details["TOTAL"]["TOTALAFTERDISCOUNT"] = $this->x1e($totalafterdiscount);$Details["TOTAL"]["TAXTOTAL"] = $this->x1e($vat_value);$Details["TOTAL"]["TAXTOTALPERCENT"] = $this->x1e($total_vat_percent); $Details["TOTAL"]["TOTALWITHVAT"] = $this->x1e($totalwithvat);$Details["TOTAL"]["SHTAXAMOUNT"] = $this->x1e($shAmount);$Details["TOTAL"]["SHTAXTOTAL"] = $this->x1e($shtaxtotal);$Details["TOTAL"]["VATBLOCK"] = $vatblock;return $Details;}private function x16(){ global $x0b,$x0c,$x0d,$x0e,$x0f,$x10,$x11,$x12,$x13,$x14,$x15,$x16,$x17,$x18,$x19,$x1a,$x1b,$x1c,$x1d,$x1e,$x1f,$x20,$x21,$x22,$x23,$x24,$x25,$x26; $sql="SELECT productid, sequence, show_header, show_subtotal FROM vtiger_pdfmaker_breakline WHERE crmid=?";$res = $this->db->pquery($sql,array($this->focus->id));$products=array();$show_header=0;$show_subtotal=0;while($row=$this->db->fetchByAssoc($res)){$products[$row["productid"]."_".$row["sequence"]] = $row["sequence"];$show_header=$row["show_header"];$show_subtotal=$row["show_subtotal"];}$output["products"] = $products;$output["show_header"] = $show_header;$output["show_subtotal"] = $show_subtotal;return $output;}private function x17(){ global $x0b,$x0c,$x0d,$x0e,$x0f,$x10,$x11,$x12,$x13,$x14,$x15,$x16,$x17,$x18,$x19,$x1a,$x1b,$x1c,$x1d,$x1e,$x1f,$x20,$x21,$x22,$x23,$x24,$x25,$x26; $sql="SELECT vtiger_attachments.path, vtiger_attachments.name, vtiger_attachments.attachmentsid, productid, sequence, width, height
FROM vtiger_pdfmaker_images
INNER JOIN vtiger_attachments
ON vtiger_attachments.attachmentsid=vtiger_pdfmaker_images.attachmentid
INNER JOIN vtiger_crmentity
ON vtiger_attachments.attachmentsid=vtiger_crmentity.crmid
WHERE deleted=0 AND vtiger_pdfmaker_images.crmid=?";$res = $this->db->pquery($sql,array($this->focus->id));$products=array();while($row=$this->db->fetchByAssoc($res)){$products[$row["productid"]."_".$row["sequence"]]["src"] = $row["path"].$row["attachmentsid"]."_".$row["name"];$products[$row["productid"]."_".$row["sequence"]]["width"] = $row["width"];$products[$row["productid"]."_".$row["sequence"]]["height"] = $row["height"];}return $products;}private function x18($id){ global $x0b,$x0c,$x0d,$x0e,$x0f,$x10,$x11,$x12,$x13,$x14,$x15,$x16,$x17,$x18,$x19,$x1a,$x1b,$x1c,$x1d,$x1e,$x1f,$x20,$x21,$x22,$x23,$x24,$x25,$x26; if(isset($id) AND $id!=""){$query="SELECT vtiger_attachments.path, vtiger_attachments.name, vtiger_attachments.attachmentsid
FROM vtiger_contactdetails
INNER JOIN vtiger_seattachmentsrel
ON vtiger_contactdetails.contactid=vtiger_seattachmentsrel.crmid
INNER JOIN vtiger_attachments
ON vtiger_attachments.attachmentsid=vtiger_seattachmentsrel.attachmentsid
INNER JOIN vtiger_crmentity
ON vtiger_attachments.attachmentsid=vtiger_crmentity.crmid
WHERE deleted=0 AND vtiger_contactdetails.contactid=?";$result = $this->db->pquery($query, array($id));$num_rows = $this->db->num_rows($result);if ($num_rows > 0){$image_src = $this->db->query_result($result,0,"path").$this->db->query_result($result,0,"attachmentsid")."_".$this->db->query_result($result,0,"name");$image = "<img src='".$this->site_url."/".$image_src."'/>";return $image;}} else {return "";}} private function x19($id) { global $x0b,$x0c,$x0d,$x0e,$x0f,$x10,$x11,$x12,$x13,$x14,$x15,$x16,$x17,$x18,$x19,$x1a,$x1b,$x1c,$x1d,$x1e,$x1f,$x20,$x21,$x22,$x23,$x24,$x25,$x26; if($id != "") {$sql = "SELECT user_name FROM vtiger_users WHERE id=?";$result = $this->db->pquery($sql, array($id));$ownername = $this->db->query_result($result,0,"user_name");}if($ownername == "") {$sql = "SELECT groupname FROM vtiger_groups WHERE groupid=?";$result = $this->db->pquery($sql, array($id));$ownername = $this->db->query_result($result,0,"groupname");}else {$ownername = getUserFullName($id);}return $ownername;}private function x1a($account_id) { global $x0b,$x0c,$x0d,$x0e,$x0f,$x10,$x11,$x12,$x13,$x14,$x15,$x16,$x17,$x18,$x19,$x1a,$x1b,$x1c,$x1d,$x1e,$x1f,$x20,$x21,$x22,$x23,$x24,$x25,$x26; $accountno = "";if($account_id != '') {$sql = "SELECT account_no FROM vtiger_account WHERE accountid=?";$result = $this->db->pquery($sql, array($account_id));$accountno = $this->db->query_result($result,0,"account_no");}return $accountno;}private function x1b($str,$emodule) { global $x0b,$x0c,$x0d,$x0e,$x0f,$x10,$x11,$x12,$x13,$x14,$x15,$x16,$x17,$x18,$x19,$x1a,$x1b,$x1c,$x1d,$x1e,$x1f,$x20,$x21,$x22,$x23,$x24,$x25,$x26; if($emodule!="Products/Services") {$app_lang = return_application_language($this->language);$mod_lang = return_specified_module_language($this->language,$emodule);}else {$app_lang = return_specified_module_language($this->language,"Services");$mod_lang = return_specified_module_language($this->language,"Products");}$trans_str = ($mod_lang[$str] != '') ? $mod_lang[$str] : (($app_lang[$str] != '') ? $app_lang[$str] : $str);return $trans_str;}private function x1c() { global $x0b,$x0c,$x0d,$x0e,$x0f,$x10,$x11,$x12,$x13,$x14,$x15,$x16,$x17,$x18,$x19,$x1a,$x1b,$x1c,$x1d,$x1e,$x1f,$x20,$x21,$x22,$x23,$x24,$x25,$x26; $inventory_table = $this->inventory_table_array[$this->module];$inventory_id = $this->inventory_id_array[$this->module];$res = $this->db->pquery("SELECT currency_id, ".$inventory_table.".conversion_rate AS conv_rate, vtiger_currency_info.*
FROM ".$inventory_table."
INNER JOIN vtiger_currency_info ON ".$inventory_table.".currency_id = vtiger_currency_info.id
WHERE ".$inventory_id."=?", array($this->focus->id));$currency_info = array();$currency_info["currency_id"] = $this->db->query_result($res,0,"currency_id");$currency_info["conversion_rate"] = $this->db->query_result($res,0,"conv_rate");$currency_info["currency_name"] = $this->db->query_result($res,0,"currency_name");$currency_info["currency_code"] = $this->db->query_result($res,0,"currency_code");$currency_info["currency_symbol"] = $this->db->query_result($res,0,"currency_symbol");return $currency_info;}private function x1d() { global $x0b,$x0c,$x0d,$x0e,$x0f,$x10,$x11,$x12,$x13,$x14,$x15,$x16,$x17,$x18,$x19,$x1a,$x1b,$x1c,$x1d,$x1e,$x1f,$x20,$x21,$x22,$x23,$x24,$x25,$x26; $res = $this->db->pquery("SELECT taxtype FROM ".$this->inventory_table_array[$this->module]." WHERE ".$this->inventory_id_array[$this->module]."=?", array($this->focus->id));$taxtype = $this->db->query_result($res,0,'taxtype');return $taxtype;}private function x1e($value) { global $x0b,$x0c,$x0d,$x0e,$x0f,$x10,$x11,$x12,$x13,$x14,$x15,$x16,$x17,$x18,$x19,$x1a,$x1b,$x1c,$x1d,$x1e,$x1f,$x20,$x21,$x22,$x23,$x24,$x25,$x26; if($x19($value)){$number = $x1b($value,$this->decimals,$this->decimal_point,$this->thousands_separator);}else {$number = "";}return $number;}private function x1f(&$focus,$record,$module) { global $x0b,$x0c,$x0d,$x0e,$x0f,$x10,$x11,$x12,$x13,$x14,$x15,$x16,$x17,$x18,$x19,$x1a,$x1b,$x1c,$x1d,$x1e,$x1f,$x20,$x21,$x22,$x23,$x24,$x25,$x26; $result = Array();foreach($focus->tab_name_index as $table_name=>$index)$result[$table_name] = $this->db->pquery("SELECT * FROM ".$table_name." WHERE ".$index."=?", array($record));$tabid = getTabid($module);$sql1 = "SELECT fieldname, fieldid, fieldlabel, columnname, tablename, uitype, typeofdata, presence
FROM vtiger_field WHERE tabid=?";$result1 = $this->db->pquery($sql1, array($tabid));$noofrows = $this->db->num_rows($result1);if($noofrows) {while($resultrow = $this->db->fetch_array($result1)) {$fieldcolname = $resultrow["columnname"];$tablename= $resultrow["tablename"];$fieldname= $resultrow["fieldname"];$fld_value="";if(isset($result[$tablename]))$fld_value = $this->db->query_result($result[$tablename],0,$fieldcolname);$focus->column_fields[$fieldname] = $fld_value;}}$focus->column_fields["record_id"] = $record;$focus->column_fields["record_module"] = $module;}private function x20($value) { global $x0b,$x0c,$x0d,$x0e,$x0f,$x10,$x11,$x12,$x13,$x14,$x15,$x16,$x17,$x18,$x19,$x1a,$x1b,$x1c,$x1d,$x1e,$x1f,$x20,$x21,$x22,$x23,$x24,$x25,$x26; if($x12("modules/Settings/EditTermDetails.php")) {$sql = "SELECT tandc FROM vtiger_inventory_tandc WHERE id='".$value."'";$res = $this->db->query($sql);$num = $this->db->num_rows($res);if($num>0)$tandc = $this->db->query_result($res,0,"tandc");else$tandc = $value;}else$tandc = $value;return $tandc;}private function x21($efocus) { global $x0b,$x0c,$x0d,$x0e,$x0f,$x10,$x11,$x12,$x13,$x14,$x15,$x16,$x17,$x18,$x19,$x1a,$x1b,$x1c,$x1d,$x1e,$x1f,$x20,$x21,$x22,$x23,$x24,$x25,$x26; $commentlist="";$prefix="";if($efocus->column_fields["record_module"] == "HelpDesk"){$prefix="ticket";}elseif($efocus->column_fields["record_module"] == "Faq") {$prefix="faq";}if($prefix!="") {$mod_lang = return_specified_module_language($this->language,$efocus->column_fields["record_module"]);$sql="SELECT * FROM vtiger_".$prefix."comments WHERE ".$prefix."id=".$efocus->id;$result=$this->db->query($sql);while($row = $this->db->fetchByAssoc($result)) {$comment = $row["comments"];$crtime = getValidDisplayDate($row["createdtime"]);$body="";if($prefix=="ticket"){$author = $this->x19($row["ownerid"]);$body=$comment."<br />".$mod_lang["LBL_AUTHOR"].": ".$author."<br />".$mod_lang["Created Time"].": ".$crtime."<br /><br />";}else {$body=$comment."<br />".$mod_lang["Created Time"].": ".$crtime."<br /><br />";}$commentlist.=$body;}}return $commentlist;}private function x22($folderid) { global $x0b,$x0c,$x0d,$x0e,$x0f,$x10,$x11,$x12,$x13,$x14,$x15,$x16,$x17,$x18,$x19,$x1a,$x1b,$x1c,$x1d,$x1e,$x1f,$x20,$x21,$x22,$x23,$x24,$x25,$x26; $sql="SELECT foldername FROM vtiger_attachmentsfolder WHERE folderid=".$folderid;return $foldername = $this->db->query_result($this->db->query($sql),0,"foldername");}public function getFilename() { global $x0b,$x0c,$x0d,$x0e,$x0f,$x10,$x11,$x12,$x13,$x14,$x15,$x16,$x17,$x18,$x19,$x1a,$x1b,$x1c,$x1d,$x1e,$x1f,$x20,$x21,$x22,$x23,$x24,$x25,$x26; $this->content = $this->filename;$this->replacements["$#TEMPLATE_NAME#$"]=$this->templatename;$this->replacements["$#DD-MM-YYYY#$"]=$x10("d-m-Y");$this->replacements["$#MM-DD-YYYY#$"]=$x10("m-d-Y");$this->replacements["$#YYYY-MM-DD#$"]=$x10("Y-m-d");$this->replacements["$".$x22($this->module)."_CRMID$"]=$this->focus->id;$this->x0e($this->module, $this->focus);$this->replacements=array();$this->replacements["
"]="";$this->replacements["
"]="";$this->replacements["
"]="";$this->replacements["
"]="";$this->x12();return $x24(generate_cool_uri($x20($x14($this->content,ENT_QUOTES,"utf-8"))),0,255); }}function generate_cool_uri($name){ global $x0b,$x0c,$x0d,$x0e,$x0f,$x10,$x11,$x12,$x13,$x14,$x15,$x16,$x17,$x18,$x19,$x1a,$x1b,$x1c,$x1d,$x1e,$x1f,$x20,$x21,$x22,$x23,$x24,$x25,$x26; $nazov=$x26($x25($x21($name)));$Search = array("$","","&","%",")","(","."," - ","/"," ",",","ľ","","č","ť","","","","","","","","ů","","","","ň","ď","","ŕ","Ľ","","Č","Ť","","","","","","","","Ď","\"","","");$Replace = array("","","","","","","-","-","-","-","-","l","s","c","t","z","y","a","i","e","o","o","u","u","u","a","n","d","o","r","l","s","c","t","z","y","a","i","e","o","u","d","","","ss");$return=$x1e($Search, $Replace, $name); return $return;}function createPDFAndSaveFile($templates,$focus,$modFocus,$file_name,$moduleName,$language){ global $x0b,$x0c,$x0d,$x0e,$x0f,$x10,$x11,$x12,$x13,$x14,$x15,$x16,$x17,$x18,$x19,$x1a,$x1b,$x1c,$x1d,$x1e,$x1f,$x20,$x21,$x22,$x23,$x24,$x25,$x26; $db="adb";$cu="current_user";$dl="default_language";global $$db, $$cu, $$dl; $date_var = $x10("Y-m-d H:i:s");$ownerid = $focus->column_fields["assigned_user_id"]; if(!isset($ownerid) || $ownerid=="")$ownerid = $$cu->id; $current_id = $$db->getUniqueID("vtiger_crmentity");$templates = $x1d($templates,";");$Templateids = $x11(";",$templates);$x17("memory_limit","128M");$name="";if (!$language || $language == "") $language = $$dl;foreach ($Templateids AS $templateid){$PDFContent = new PDFContent($templateid, $moduleName, $modFocus, $language);$pdf_content = $PDFContent->getContent();$Settings = $PDFContent->getSettings();if($name=="")$name = $PDFContent->getFilename();$header_html = $x14($pdf_content["header"],ENT_COMPAT,"utf-8");$body_html = $x14($pdf_content["body"],ENT_COMPAT,"utf-8");$footer_html = $x14($pdf_content["footer"],ENT_COMPAT,"utf-8");$encoding = $Settings["encoding"];if ($Settings["orientation"] == "landscape") $format = $Settings["format"]."-L";else $format = $Settings["format"];if (!isset($mpdf)){$mpdf=new mPDF('',$format,'','Arial',$Settings["margin_left"],$Settings["margin_right"],0,0,$Settings["margin_top"],$Settings["margin_bottom"]);$mpdf->SetAutoFont();@$mpdf->SetHTMLHeader($header_html);}else{@$mpdf->SetHTMLHeader($header_html);@$mpdf->WriteHTML('<pagebreak sheet-size="'.$format.'" margin-left="'.$Settings["margin_left"].'mm" margin-right="'.$Settings["margin_right"].'mm" margin-top="0mm" margin-bottom="0mm" margin-header="'.$Settings["margin_top"].'mm" margin-footer="'.$Settings["margin_bottom"].'mm" />');}@$mpdf->SetHTMLFooter($footer_html);@$mpdf->WriteHTML($body_html);}$upload_file_path = decideFilePath();if($name!="")$file_name = $name.".pdf"; $mpdf->Output($upload_file_path.$current_id."_".$file_name);$filesize = $x13($upload_file_path.$current_id."_".$file_name);$filetype = "application/pdf"; $sql1 = "insert into vtiger_crmentity (crmid,smcreatorid,smownerid,setype,description,createdtime,modifiedtime) values(?, ?, ?, ?, ?, ?, ?)"; $params1 = array($current_id, $$cu->id, $ownerid, "Documents Attachment", $focus->column_fields["description"], $$db->formatDate($date_var, true), $$db->formatDate($date_var, true)); $$db->pquery($sql1, $params1); $sql2="insert into vtiger_attachments(attachmentsid, name, description, type, path) values(?, ?, ?, ?, ?)"; $params2 = array($current_id, $file_name, $focus->column_fields["description"], $filetype, $upload_file_path); $result=$$db->pquery($sql2, $params2); $sql3='insert into vtiger_seattachmentsrel values(?,?)'; $$db->pquery($sql3, array($focus->id, $current_id));$sql4="UPDATE vtiger_notes SET filesize=?, filename=? WHERE notesid=?";$$db->pquery($sql4,array($filesize,$file_name,$focus->id)); return true;}
?>
Did this file decode correctly?
Original Code
<?php
$memory_limit = substr(ini_get("memory_limit"), 0,-1);
if($memory_limit<256){
ini_set("memory_limit","256M");
}
global $x0b,$x0c,$x0d,$x0e,$x0f,$x10,$x11,$x12,$x13,$x14,$x15,$x16,$x17,$x18,$x19,$x1a,$x1b,$x1c,$x1d,$x1e,$x1f,$x20,$x21,$x22,$x23,$x24,$x25,$x26;
$x0b="\141\162\162\141\x79\137\153eys"; $x0c="\141\x72\162a\x79\137\160u\x73h"; $x0d="\x61\x72r\141\171\x5f\155\x65r\147e"; $x0e="\141r\162a\x79_s\x75\155"; $x0f="\x63\x6f\x75n\164"; $x10="\144\141\x74e"; $x11="\145xp\x6c\157\144e"; $x12="f\151\x6c\145_\145\x78i\163\x74s"; $x13="\x66i\154\145\163\151\172\x65"; $x14="\x68\164ml_\145\x6e\164\151\164\x79\137\144\145\x63o\144\x65"; $x15="i\x6d\160l\x6f\x64\x65"; $x16="\x69n\137a\162\162a\x79"; $x17="\151n\151\x5fs\x65\164"; $x18="i\x73\x5f\x6f\x62j\145\x63\164"; $x19="i\x73\x5f\x6e\x75\155\145\162ic"; $x1a="n\x6c\x32b\x72"; $x1b="n\165\155\x62er\x5ffo\162m\x61\164"; $x1c="\x72\x6fun\x64"; $x1d="\x72\x74\x72im"; $x1e="\x73\x74r_r\x65\x70\154\141c\145"; $x1f="\x73tr\137\151\x72\x65\160\x6c\x61c\x65"; $x20="\x73\x74r\x69\x70_\x74ags"; $x21="\x73\164\x72\151ps\154a\163\150\x65s"; $x22="\x73\x74\162to\x75\x70p\x65\162"; $x23="s\164\162p\157s"; $x24="s\x75\x62\x73\x74r"; $x25="\163\x74r\164olo\167\x65r"; $x26="\x74r\151m";
class PDFContent {private $templateid;private $module;private $language;private $focus;private $db;private $mod_strings;private $app_strings;private $site_url;private $decimal_point;private $thousands_separator;private $decimals;public $pagebreak;private $ignored_picklist_values=array();private $header;private $footer;private $body;private $content;private $filename;private $templatename;private $section_sep="\046\043\x25\111\x54\123\x25\045\045\100\100@%%%\111\x54\123\x25\x23\x26";private $replacements;private $inventory_table_array = Array("Pu\162c\150a\x73\145\x4f\162\144\x65\x72"=>"vt\x69\147\145\x72\x5f\x70u\162\x63h\x61\163e\157\x72d\145r", "\123\x61\154\x65s\x4f\162\144e\x72"=>"\x76\x74\151\147\145r_\x73\x61\154\x65\x73or\144e\x72", "\121\165\x6ft\145\163"=>"\x76\164\x69\x67\145r\x5f\x71\x75\157\164\x65s", "I\156\166\x6fice"=>"\x76\x74\151g\145\162_\151\156\166oic\x65");private $inventory_id_array = Array("P\x75r\143h\x61\163\145O\x72\144e\x72"=>"\160\165\x72\143\x68a\163\145\x6fr\144e\162\x69\144","\123\141\154\145s\x4f\x72\x64\x65\x72"=>"\x73\141\x6ce\163\x6fr\144\145\x72\151\144","\x51\x75\157\164\x65\x73"=>"\x71uote\x69\144","I\x6e\x76\157\x69\x63\145"=>"\x69\156v\157i\143\x65i\144");private $org_cols = array("o\162\x67ani\172at\x69o\x6e\x6e\x61\155\145" => "C\117\115PAN\131\x5fN\x41M\x45","\141ddr\145\163s" => "\103\117\115\x50\101\116\131\137\x41DD\x52E\x53\x53","\143\x69ty" => "\x43\x4f\115\x50\101\x4eY\137\103I\124\131","\163\164\141\164\145" => "\x43\117MPA\116\131\x5f\123\x54\x41\x54\x45","\x63\x6f\x64\145" => "\103\x4fM\x50AN\131\x5fZ\x49\x50","\143o\x75\x6e\164\x72\x79" => "\x43\117\115\x50ANY\x5f\103\x4fUNT\122Y","\x70\x68\157\x6e\145" => "\103\x4f\115\120\x41\116Y_\120\110\117\116E","fax" => "\x43\x4fM\x50\x41\x4eY\x5f\x46A\x58","w\x65b\x73\151\164\145" => "C\x4f\115P\x41N\131_WE\x42\123\111\x54\x45","log\157" => "C\117\x4d\120A\116Y\x5fL\117\x47\x4f", );function __construct($templateid, $module, $focus, $language) {$db = "\141\x64b";$mod = "\x6d\157\144_\x73\x74ri\156\147\163";$app = "a\160\160\137st\162i\x6e\x67\163";global $$db, $$mod, $$app, $PDFMaker_template_id;$this->db = &$$db;$this->mod_strings = $$mod; $this->app_strings = $$app;$this->templateid = $templateid;$PDFMaker_template_id = $this->templateid;$this->module = $module;$this->focus = $focus;$this->language = $language;$this->x13();$this->x14();}public function getContent() { global $x0b,$x0c,$x0d,$x0e,$x0f,$x10,$x11,$x12,$x13,$x14,$x15,$x16,$x17,$x18,$x19,$x1a,$x1b,$x1c,$x1d,$x1e,$x1f,$x20,$x21,$x22,$x23,$x24,$x25,$x26; require_once("\x63l\x61sse\163/\x73im\x70\x6c\145\x5f\150tml\x5f\x64o\x6d\056\x70\x68\x70");$img_root = "\x69\155\147_\162\x6fot\x5f\144\x69\x72\145\143t\x6f\x72\171";global $$img_root;$this->content = $this->body;$this->content = $this->header.$this->section_sep;$this->content .= $this->body.$this->section_sep;$this->content .= $this->footer;$this->replacements["&\x6e\142\x73p;"]="\040";$this->replacements["\x23\x23\120\x41\107\x45\043\x23"]="\x7b\120\x41GE\116O}";$this->replacements["\043\043\120\101\107\105S\x23\043"]="\173\156\142\x7d";$this->replacements["#\x23D\104\055\115\115-\x59\x59Y\131\x23\043"]=$x10("\144-m\x2d\131");$this->replacements["\043#\104\x44\x2e\x4d\x4d\056\131\x59Y\131\x23\x23"]=$x10("\x64\x2em.\x59");$this->replacements["\043\x23\115M\x2d\x44D\055\x59\131\131Y#\x23"]=$x10("\x6d\055\144\055\x59");$this->replacements["\x23#\131\x59\131\131\055M\115\055DD\043#"]=$x10("Y-m\x2d\144");$this->replacements["sr\143\075\047"]="\163\x72\x63\x3d'".$$img_root;$this->replacements["\044".$x22($this->module)."\137C\x52\115\x49D\x24"]=$this->focus->id; $this->x12();$this->content = $x14($this->content,ENT_QUOTES,"\x75\x74\146-8"); $html = str_get_html($this->content); foreach($html->find("\x64i\x76[sty\154e\136=\x70\x61g\145-\142\162ea\153\x2d\x61\146t\x65\x72\x5d") as $div_page_break){ $div_page_break->outertext = $this->pagebreak; $this->content = $html->save();} foreach($html->find("\x64\x69v\x5b\163tyl\x65\136\x3d\120\x41\x47\105\x2dB\122\x45\101K-\101\106T\105\122\x5d") as $div_page_break){ $div_page_break->outertext = $this->pagebreak; $this->content = $html->save();}$this->x0b();$this->x0e($this->module, $this->focus);$this->x0d();if($this->focus->column_fields["a\x73\x73\x69\x67\156\145\x64\137\165ser\x5fi\x64"]==""){$this->focus->column_fields["as\x73\151g\156e\144\137u\x73er_\151d"]=$this->db->query_result($this->db->query("S\105LE\103T\x20sm\x6fw\x6ee\162id \106R\117\x4d\x20\x76t\x69g\145r_\x63\x72\155\145nt\x69\x74\x79 \127\x48\105R\105\x20\x63r\x6di\144=".$this->focus->id),0,"\x73\155\x6f\167\156\x65r\151\144");}$this->x0f();$this->x10();$this->x11();$PDF_content = array();list($PDF_content["\x68\x65\141d\x65\x72"],$PDF_content["bod\171"],$PDF_content["\146\157ot\145\162"]) = $x11($this->section_sep,$this->content);return $PDF_content;}public function getSettings() { global $x0b,$x0c,$x0d,$x0e,$x0f,$x10,$x11,$x12,$x13,$x14,$x15,$x16,$x17,$x18,$x19,$x1a,$x1b,$x1c,$x1d,$x1e,$x1f,$x20,$x21,$x22,$x23,$x24,$x25,$x26; $sql = "S\x45\114\x45C\x54\x20\050\155a\x72g\x69n_t\x6f\160\040\x2a\x20\061\060\x29 \101\x53 \x6d\141\162\147\151\156\x5f\164\157\x70\x2c\x0d\x0a \040\x20 \x20\x20 \040\x20 \040 \040\x20\x20\x20\x20 \x20\050\155\141\x72\147\x69n_\142ot\164\157\x6d\040\052\0401\x30\x29 A\123\040\155a\x72\147i\x6e_b\157\164t\157\155\054\x0d\012\x20 \040\040\040 \040\x20\x20\040\x20 \040\040 \040 \040 \050\155\141r\147in\x5f\x6c\145\x66t\040\x2a\x20\x31\x30)\040\101\x53\x20\155\141rgi\x6e\x5f\x6c\145f\x74,
\x0a\040\040\x20\040 \040 \x20 \x20\040\x20 \x20\x20 \040 (\x6d\141\162\x67\x69\x6e\x5f\162\151g\x68t*1\060)\x20\x41S\x20m\141\162\147\151\x6e\x5f\162\x69\147\x68\x74,\015\x0a\040 \040\x20\x20\040 \x20\040 \040\040\040\x20\x20\x20\x20 \x20 \x66\x6frm\141\x74\054
\x0a \040\x20\040\x20 \040\040\040\x20\x20\040\x20\x20 \040 \x20\157r\x69ent\141t\x69\157n\054\x0d\012\x20\x20\x20\x20 \x20 \040\040\040\040\040\040\040\040 \x20\040\040\040e\x6e\143od\x69\156\147\015\x0a \x20\040\x20\040\x20\040 \x20\x20 \x20 \106R\x4f\x4d v\164\x69\147e\162\x5f\160df\155a\153\x65\162_\163\x65t\164\151\156\x67s\x20\127\x48\x45\x52\x45\040te\x6d\160la\x74\x65\151d\x20\075\x20'".$this->templateid."'";$result = $this->db->query($sql);$Settings = $this->db->fetchByAssoc($result, 1);return $Settings;}private function x0b() { global $x0b,$x0c,$x0d,$x0e,$x0f,$x10,$x11,$x12,$x13,$x14,$x15,$x16,$x17,$x18,$x19,$x1a,$x1b,$x1c,$x1d,$x1e,$x1f,$x20,$x21,$x22,$x23,$x24,$x25,$x26; $sql = "S\x45\x4c\x45\x43\124 \x66ie\x6c\144\x69\x64,\040\x66i\145\x6cdnam\145\054\x20\x75\x69t\x79p\x65\015
\040\040 \x20\040\x20\040 \x46\122O\x4d\040\x76\x74\151g\145\162_\146\151\x65\154\x64\015\012 \040 \x20\x20\040 \040\x20\040 \x20\x57\x48ERE\x20\164a\142\x69d\075".getTabId($this->module)."\040\101\116\x44\040\x28\x64\x69\x73\x70l\x61\171\x74y\160e !\x3d\x203\x20\117\x52 f\x69e\x6c\x64\151\144 \075 \x36\x34)\040\101\x4e\104\x20\146\x69\145\154\x64i\144\040!\x3d\040\0610\x35";$result = $this->db->query($sql);$num_rows = $this->db->num_rows($result);if ($num_rows > 0){while($row = $this->db->fetch_array($result)){$related_module = "";$fk_record = $this->focus->column_fields[$row["fi\145\154\144\x6ea\155\x65"]];switch ($row["\x75\151\x74\x79pe"]) {case "5\x31": $related_module = "Ac\143\157u\x6e\x74s"; break;case "\065\x37": $related_module = "\x43\157\x6e\164a\x63\x74\163"; break;case "\065\070": $related_module = "Cam\x70ai\x67n\x73"; break;case "5\x39": $related_module = "P\162\x6f\144u\x63\x74s"; break;case "73": $related_module = "A\143\x63\x6f\165\156\164\x73"; break;case "\x375": $related_module = "\x56\x65\x6e\144o\x72\163"; break;case "8\061": $related_module = "\x56\x65n\x64\x6f\162s"; break;case "\067\x36": $related_module = "\x50\157\164ent\x69\x61ls"; break;case "7\x38": $related_module = "\x51u\x6f\164\x65\163"; break;case "\0700": $related_module = "\123al\145\163\117\162d\145\x72"; break;case "6\070":case "1\060": $related_module = getSalesEntityType($fk_record); break;}if ($related_module != "") {$tabid = getTabId($related_module);$field_inf = "\137f\151\145ld\151\156\x66o\137\143\x61c\150\145";$temp = &VTCacheUtils::$$field_inf;unset($temp[$tabid]);$focus2 = CRMEntity::getInstance($related_module);if ($fk_record != "" && $fk_record != "\x30") {$result_delete = $this->db->query("S\105\114\105\103\x54 d\145le\164\x65\x64 FR\x4f\115 \x76\164iger_\x63r\x6d\145\x6e\x74\x69ty\x20W\x48\x45\122E\x20c\x72\155i\144\075'".$fk_record."'\040\x41\116\104\x20\144\x65\154\x65\x74\x65\144\x3d\x30");if($this->db->num_rows($result_delete)>0){$focus2->retrieve_entity_info($fk_record,$related_module); $focus2->id = $fk_record;}}$this->replacements["\044"."\x52\x5f".$x22($related_module)."_\103\x52\115\x49\104\x24"]=$focus2->id; if(isset($related_module) AND $related_module == "\103o\x6e\x74a\143\x74\163"){$this->replacements['$R_CONTACTS_IMAGENAME$']=$this->x18($focus2->id); } $this->x12();$this->x0e($related_module, $focus2, true);unset($focus2);}if ($row["u\151\x74\x79\160\145"] == "10" || $row["\165itype"] == "\066\x38") {if ($related_module == "\101\143\x63\x6f\165\156t\x73")$related_module2 = "C\x6f\156\x74a\x63\x74\x73";else$related_module2 = "\101\x63\x63\x6f\165n\x74\163";$tabid2 = getTabId($related_module2);$field_inf = "_\146ie\x6c\144\151nf\157_ca\143he";$temp = &VTCacheUtils::$$field_inf;unset($temp[$tabid2]);$focus3 = CRMEntity::getInstance($related_module2);$this->replacements["\044"."\x52\x5f".$x22($related_module2)."\137\103\x52M\111D\044"]=$focus3->id;$this->x0e($related_module2, $focus3, true);unset($focus3);}}}}private function x0c() { global $x0b,$x0c,$x0d,$x0e,$x0f,$x10,$x11,$x12,$x13,$x14,$x15,$x16,$x17,$x18,$x19,$x1a,$x1b,$x1c,$x1d,$x1e,$x1f,$x20,$x21,$x22,$x23,$x24,$x25,$x26; require_once("\143\x6c\141\x73\163\x65\x73\x2f\x73\x69m\160\154e_h\164m\x6c\137\144\157\x6d.\160\x68\160");$html = str_get_html($this->content);$tableDOM=false;foreach($html->find("\164\x64") as $td){if($x26($td->plaintext) == "\x23P\122\117\104\125C\x54\x42\x4c\117C\137S\124A\122\x54#"){ $td->parent->outertext = "\x23\x50\x52\117D\x55C\x54B\x4c\117\103\137ST\x41\122T\043"; list($tag)=$x11(">",$td->parent->parent->parent->outertext,2);$header = $td->parent->prev_sibling()->outertext;$header_style = $td->parent->prev_sibling()->children[0]->getAttribute("\x73\x74\171\x6ce");$footer_tag="<\164\162\x3e"; if(isset($header_style)){ $StyleHeader = $x11(";", $header_style);if(isset($StyleHeader)){ foreach($StyleHeader as $style_header_tag) {if($x23($style_header_tag, "b\157\162de\162\055\164\x6f\x70") == TRUE){$footer_tag.="\x3c\x74d\040c\157ls\160\141n\075'".$td->getAttribute("\143\157\x6cs\160\141\x6e")."'\040\x73\164y\x6ce\x3d'".$style_header_tag."'\076\046\x6eb\163\160;\074\x2ft\144\076";} }}} else {$footer_tag.="\x3c\x74\x64\040c\x6f\x6cspa\156\075'".$td->getAttribute("\143\157lspan")."'\040\163\164\x79\154\145\x3d\"\142\x6fr\x64\145\162\055\x74\x6fp\072\x31\x70\170 \x73\157\154\151\144\x20\x23\060\060000\060\x3b\">\046\156b\x73\x70\073\074\x2f\x74d>";}$footer_tag.="\074\x2f\164\x72\076";$var = $td->parent->next_sibling()->last_child()->plaintext;$subtotal_tr="";if($x23($var, "\124\x4f\x54\x41\114")!==false){ if($x18($td)){$style_subtotal=$td->getAttribute("\163\164\171\154\145");} if(isset($td->innertext)){list($style_subtotal_tag,$style_subtotal_endtag)=$x11("\x23P\x52O\x44\125C\x54BL\x4f\x43\x5fST\x41\x52T\043",$td->innertext);} else {$style_subtotal_tag = "";$style_subtotal_endtag = "";}if(isset($style_subtotal)){$StyleSubtotal = $x11("\073", $style_subtotal); if(isset($StyleSubtotal)){ foreach($StyleSubtotal as $style_tag) {if($x23($style_tag, "\x62or\144\x65r\055to\160") == TRUE){$tag.=" \x73t\171\x6c\x65=\"".$style_tag."\"";break;} } }} else {$style_subtotal = ""; } $tag.="\x3e";$subtotal_tr="\074\164r>";$subtotal_tr.="\x3c\x74\x64\x20\143\x6f\154\x73p\x61n='".($td->getAttribute("\x63o\x6c\x73\160a\x6e")-1)."'\x20\163t\x79\x6c\145\075'".$style_subtotal."\x3b\x62\x6frd\x65\x72-\x72\151\147\x68\164\072\x6eon\145'\076".$style_subtotal_tag."\x25G\x5f\x53ubt\x6ft\x61\154\x25".$style_subtotal_endtag."<\x2f\164\x64\x3e";$subtotal_tr.="<t\x64\x20\x61\154\151\147\x6e\075'\x72\x69\x67\x68\164' \156\x6f\x77\x72a\x70=\"now\x72a\x70\"\x20\163ty\x6c\x65\075'".$style_subtotal."'\076".$style_subtotal_tag."".$x1d($var,"$")."_\x53\x55\102\x54O\x54A\114$".$style_subtotal_endtag."\x3c/t\x64>"; $subtotal_tr.="\074/\164\x72\076"; }$tableDOM["\x74\x61\147"] = $tag; $tableDOM["\x68\145\141de\x72"] = $header; $tableDOM["foo\x74e\162"] = $footer_tag; $tableDOM["\163\x75\142\164\x6ft\141\x6c"] = $subtotal_tr;}if($x26($td->plaintext) == "\x23\x50\x52\117\104\x55\103\x54BL\117\x43\137\x45\x4eD\x23") $td->parent->outertext = "\x23\x50\x52\x4fD\x55\x43TBL\117\103\137E\x4eD#";}$this->content=$html->save();return $tableDOM;}private function x0d() { global $x0b,$x0c,$x0d,$x0e,$x0f,$x10,$x11,$x12,$x13,$x14,$x15,$x16,$x17,$x18,$x19,$x1a,$x1b,$x1c,$x1d,$x1e,$x1f,$x20,$x21,$x22,$x23,$x24,$x25,$x26; if ($this->module == "Q\165\157\164es" || $this->module == "\x49\156\166\157\x69ce" || $this->module == "\123\x61l\x65s\117r\144\145r" || $this->module == "\x50\x75\x72\x63\x68\x61\163\145\x4fr\144\145r"){$this->replacements["$"."\123U\x42\x54\117TAL$"] = $this->x1e($this->focus->column_fields["\x68\x64n\x53ub\124\x6ft\x61\x6c"]);$this->replacements["$"."TO\124\101\x4c\044"] = $this->x1e($this->focus->column_fields["\x68\x64\156\107r\141\x6e\x64\124\157t\141\154"]);$currencytype = $this->x1c();$currencytype["\143\165r\x72e\156cy_\x73ym\x62\x6f\154"] = $x1e("","&\x65uro\073",$currencytype["c\x75\162\x72enc\171\137\x73\x79\x6d\x62ol"]);$currencytype["\143\165\162ren\143\x79_sy\155\x62ol"] = $x1e("","\x26p\x6f\x75nd\x3b",$currencytype["\143\165r\162e\x6ecy\x5f\x73\x79\x6db\157l"]);$this->replacements["$"."\x43\125R\x52\105N\103\131NA\115E$"] = getTranslatedCurrencyString($currencytype["\x63u\x72\162\x65\x6e\143y\x5f\x6e\x61\155e"]);$this->replacements["$"."\x43U\x52RE\x4e\103\131S\x59MB\x4fL\x24"] = $currencytype["c\x75r\162e\x6ecy\137s\x79m\142\x6fl"];$this->replacements["\044"."CUR\122E\116CY\x43\117D\105\x24"] = $currencytype["\143\165\162\162\145n\143\171\x5f\x63o\x64\145"];$this->replacements["\044"."\x41D\112U\x53\124\x4d\x45\116\124$"] = $this->x1e($this->focus->column_fields["t\170\x74\x41\144\x6a\x75stm\145n\164"]);$Products = $this->x15();$this->replacements["\x24"."TO\x54\101\x4cWI\x54\110O\125T\x56\101\x54\x24"] = $Products["\124\x4f\124A\x4c"]["T\117\x54A\114WI\x54HOU\x54VAT"];$this->replacements["\x24"."\126\x41\x54\x24"] = $Products["T\x4f\124\101\114"]["TA\130TOT\101\x4c"];$this->replacements["\x24"."\126\101\x54PERCE\116T\044"] = $Products["\x54O\124\x41\x4c"]["\124AX\x54\x4fTA\x4cP\105R\103\x45NT"];if ($x0f($Products["\x54\117T\x41\x4c"]["VA\x54BL\x4f\103K"]) > 0){ $vattable = "<\x74\141\x62\x6ce \x62o\x72\144e\162='1'\040\x73\164\171le\x3d\"border\055c\157\154l\141pse:\143\157\x6c\x6ca\x70\163\145\073\"\x20\143e\154\x6c\x70\x61\x64\x64\x69\x6eg=\"\063\"\x3e"; $vattable .= "\x3c\x74\x72>\015\012 \x20 \040\x20\x20\040 \040 \040\x20\x20\x20\040\x20 \x20\x20\040\040\040<\164\x64 \x6eo\167\x72\141\x70\x20\141\154ign\075'\143\x65\156te\x72'\076".$this->app_strings["\116a\155\145"]."\074\057t\x64\076\015
\x09 \011 \x09\011\x09\074td \x6eowr\x61\x70\x20\141\154i\x67n\x3d'\x63\145\156\x74\145r'\x3e".$this->mod_strings["L\x42\x4c\137\x56ATBL\x4f\103\x4b_VAT_\120\105\122\x43E\x4e\x54"]."<\057\x74\144\076\015
\x20\040 \040\x20\040 \x20\x20\040\x20\x20\x20\x20\040\x20\x20\x20 \x20 <\x74\144\x20\156\x6f\x77\162\x61\x70 \x61\x6ci\147\156\x3d'\143\x65n\x74e\162'>".$this->mod_strings["\x4c\102\x4c\x5f\x56\101\x54\102\114\117C\113\137SU\115"]."\x20\x28".$currencytype["cur\162ency_\x73\x79\x6d\142\157\x6c"]."\051"."\x3c/\x74\144>\x0d\012\011\040 \x20\x20\040\x20\040\040 \x20\040\040\x20\040 \x20\x20\040\x20\040 \x20 \x3c\x74\x64\x20nowr\x61\x70\040a\x6ci\x67n\075'\143\145\156te\162'\x3e".$this->mod_strings["\x4c\x42\x4c\x5fV\101T\x42\x4c\117\103\113_\126AT_V\x41LU\105"]."\x20\x28".$currencytype["c\x75\x72\162e\x6e\143y\137\163\x79mb\x6fl"]."\051"."<\x2f\164\144\076
\011\040\x20 \040\040\x20\040\040\040 \x20\x20\040\040\040 \040\x20\x20\040\x20\x20\x3c/\164\x72\x3e"; foreach ($Products["T\117T\x41\x4c"]["VA\x54BL\x4fCK"] as $keyW=>$valueW) {if($valueW["n\145\x74\164o"]!=0) {$vattable .= "\074t\162>
\x20\x20\x20 \x20\x20 \040\040\x20 \040 \x20\040\x20 \040\040\040\x20 \040\040\040\x20\040 \074\x74\x64 \156\x6f\x77r\x61p\x20\141\x6c\x69gn='lef\164'\x20\x77\x69\144t\x68\075'20\045'\x3e".$valueW["\154\x61be\154"]."\x3c\x2f\164\144>
\012 \040\040 \040\x20\040\040\x20\x20\x20 \x20\x20\040 \040 \011\011 \011<\164d\x20\156\x6f\x77\162\141\x70\x20\x61lig\x6e='\x72i\147ht'\x20\167\151\144\x74\150='\062\065%'\x3e".$this->x1e($valueW["\166al\x75\145"])."\x20\045<\057td\076\015
\x20\x20\x20\040\x20\040\x20\040\040 \040 \040\x20\040\x20\x20 \040\x20\040 \040 \x20\x20 \040 \x20\x20\040 \040<\x74\144\040\x6eow\162\x61p\x20\x61l\x69\x67n='ri\147h\x74'\040w\151\x64th\075'3\x30\045'\076".$this->x1e($valueW["\156\145\164t\x6f"])."\074\x2f\164\x64\076
\012\040\040\x20\x20\040\x20\040 \x20\040 \x20\x20\x20 \x20\x20\x20 \x20\040\040 \x20 \040\040\x20\040\040\x20 \x20\040<\x74d\x20\x6eo\167r\141\160\040al\x69gn\075'r\151\147h\164'\x20width='2\x35\x25'\x3e".$this->x1e($valueW["vat"])."\x3c\057td\x3e
\x20 \x20\040\x20\040 \040\x20 \040\x20\040\x20 \x20 \040\x20\x20\x20\x20\040 \x20\040\040 \040\x20\x20\074\057\164\x72\076";} } $vattable .= "\x3c\057\x74\141bl\145\076";}else{ $vattable = "";}$this->replacements["\x24"."VA\x54\102L\117\103\113$"] = $vattable;$this->replacements["\x24"."T\x4f\124\x41\x4c\x57\111\x54\x48V\101T$"] = $Products["\124\117\x54\x41L"]["\124\x4fT\x41\x4cW\111\124\110\x56AT"];$this->replacements["$"."\123H\124\101\130A\x4d\117\125\x4eT\x24"] = $Products["\124\117\124\x41\114"]["\123\110T\101\x58\101\115\x4f\125N\124"];$this->replacements["\x24"."\x53\110\x54\x41X\124\117\x54AL\044"] = $Products["TO\124AL"]["S\110TAX\x54\117\x54\101\114"];$this->replacements["\x24"."TOT\101\114\x44\x49\123\x43\117\x55N\124\044"] = $Products["\x54\x4f\124\101\114"]["\106I\x4e\x41\x4cD\111\x53\x43\x4fU\x4e\x54"];$this->replacements["\044"."\124O\124\101L\x44\111\x53\103O\x55NT\x50E\122C\x45\116\124\x24"] = $Products["T\117\x54AL"]["\106\111\116\101\x4c\104\x49S\x43\117U\x4eT\x50\105\122\103EN\x54"];$this->replacements["\x24"."T\117\124\101\x4c\x41\106\124\105RDI\123\103OUN\124$"] = $Products["\124\x4f\x54AL"]["T\x4f\x54\101\114A\x46T\x45\122\x44\111\123CO\x55N\x54"];$this->x12();$var_array = array();if($x23($this->content,"#\x50RO\104\x55C\124BLOC\x5f\123\x54\101RT\043") !== false && $x23($this->content,"\043\x50\122\x4f\x44UC\x54\102\114\117\x43\137\x45\116\104#") !== false){$tableTag = $this->x0c();$breaklines_array = $this->x16();$breaklines = $breaklines_array["\160r\157du\x63\x74\163"];$show_header = $breaklines_array["\x73\150o\167_h\x65\x61de\162"];$show_subtotal = $breaklines_array["s\150\x6f\167\x5f\163\165\142t\157ta\x6c"];$breakline_type="";if($x0f($breaklines)>0){if($tableTag!==false) {$breakline_type="\074\057\x74\x61b\154e\076".$this->pagebreak.$tableTag["\164\141g"];if($show_header==1)$breakline_type.=$tableTag["h\145a\x64\x65\162"];if($show_subtotal==1){$breakline_type=$tableTag["s\165b\164\157\x74a\154"].$breakline_type;} else {$breakline_type=$tableTag["fo\x6f\x74\145\x72"].$breakline_type;}}else$breakline_type=$this->pagebreak;}$ExplodedPdf = array();$Exploded = $x11("\043P\122\x4fD\x55\x43T\x42\x4c\x4f\103_\x53\x54\x41RT\043",$this->content);$ExplodedPdf[] = $Exploded[0];for($iterator=1;$iterator<$x0f($Exploded);$iterator++){$SubExploded = $x11("\x23\x50\x52\117D\125\x43\124B\x4cOC\x5f\105N\x44\x23",$Exploded[$iterator]);foreach($SubExploded as $part)$ExplodedPdf[] = $part;$highestpartid = $iterator*2-1;$ProductParts[$highestpartid]=$ExplodedPdf[$highestpartid];$ExplodedPdf[$highestpartid]='';} if ($Products["\120"]) {foreach ($Products["P"] AS $Product_i => $Product_Details) {foreach($ProductParts as $productpartid=>$productparttext){$breakline="";if($breakline_type!="" && isset($breaklines[$Product_Details["\x53\105\x52\x56\111CE\x53\137R\x45\103\x4f\122\x44\137\111\104"]."\137".$Product_Details["\120\122\x4f\x44\x55CT\x53E\x51\x55\105\116\103\105"]]) || isset($breaklines[$Product_Details["\x50\122\x4fD\125\103\x54S\137R\105\x43OR\104\137ID"]."_".$Product_Details["\120RO\x44\x55\x43\124S\x45\x51\125E\116\103\105"]]) ){$breakline=$breakline_type;}$productparttext.=$breakline;foreach ($Product_Details AS $coll => $value) {$productparttext = $x1e("$".$x22($coll)."$",$value,$productparttext);}$ExplodedPdf[$productpartid].=$productparttext;}} }$this->content = $x15('',$ExplodedPdf);}}}private function x0e($emodule, $efocus, $is_related = false, $is_inventory = false) { global $x0b,$x0c,$x0d,$x0e,$x0f,$x10,$x11,$x12,$x13,$x14,$x15,$x16,$x17,$x18,$x19,$x1a,$x1b,$x1c,$x1d,$x1e,$x1f,$x20,$x21,$x22,$x23,$x24,$x25,$x26; $related_fieldnames = array("\x72\x65\x6c\x61\x74e\x64\137to","\x72\145\154\x61\x74edt\157","\x70\141\x72\x65\156t_\x69\144","\x70a\x72\145nt\151d","\160\x72\157duc\164\137i\144","pr\x6fdu\x63\x74\x69\x64","\163\x65\x72\x76i\x63\145\137i\x64","se\x72v\x69\143\145id","ven\x64\x6f\162\x5f\x69\144","p\x72\x6fd\x75c\164","ac\x63\157\165n\x74","\151n\x76oi\x63e\151\144","\x6ci\x6ekto\x61\x63\x63o\165\x6et\163c\157n\x74\x61\x63\x74s","\160roje\x63\x74\151\x64","\x73\x63\137\162\145\x6c\141t\x65d\137to");if($is_inventory)$inventory_content=array();$tabid = getTabid($emodule);if ($is_related)$related = "R\x5f";else$related = "";$Checkboxes = array();$Picklists = array();$Textareas = array();$Datefields = array();$Multipicklists = array();$NumbersField = array();$sql = "\123\105L\105C\x54 \146i\x65\154d\x6eam\x65\054\040u\151\x74\x79\160\x65\040\x46\x52\117M \x76ti\147e\162\137f\x69el\x64\x20\127H\x45RE\040t\141\142\x69\x64 =\x20'".$tabid."'";$result = $this->db->query($sql);while($row = $this->db->fetchByAssoc($result)){if ($row["u\x69\x74\171\x70\145"] == "\061\071" || $row["\x75\151\164\x79\x70\x65"] == "\x32\x30" || $row["\x75i\x74\x79pe"] == "\x32\061" || $row["\165\151\x74\x79p\x65"] == "2\064")$Textareas[] = $row["fie\x6c\144na\x6de"];elseif ($row["ui\x74\171\160\145"] == "\065" || $row["\165\151\164\x79\x70\x65"] == "\062\x33" || $row["\165\151\x74\x79\x70\x65"] == "\0670")$Datefields[] = $row["f\x69\x65\154\144\156am\145"];elseif ($row["u\151\x74y\x70\x65"] == "15" || $row["\146\x69e\154\144\x6eame"] == "\x73a\154\165\x74\141\x74\x69\157\x6ety\x70\x65")$Picklists[] = $row["\x66\x69\x65\154\x64na\155\x65"];elseif ($row["\165\151t\171\x70\145"] == "56")$Checkboxes[] = $row["fi\145l\144\156\x61\x6de"];elseif ($row["\x75\x69t\171\160\x65"] == "\x333")$Multipicklists[] = $row["\146\x69\145l\x64\x6ea\155\x65"];elseif ($row["u\x69t\x79p\145"] == "\x371")$NumbersField[] = $row["\146\x69\145\154\x64\x6eam\145"];}foreach ($efocus->column_fields as $fieldname => $value){if ($fieldname == "\141s\163\151g\x6e\x65d_\165\163e\162\137id")$value = $this->x19($value);elseif($fieldname == "\x61c\143o\x75n\164_\x69\144") { $value = getAccountName($value);}elseif($fieldname == "po\x74\145n\164ial\x5f\151\144")$value = getPotentialName($value);elseif($fieldname == "\x63o\156\164\141c\164\x5f\151d")$value = getContactName($value);elseif($fieldname == "q\165\157t\x65\x5f\151d")$value = getQuoteName($value);elseif($fieldname == "s\x61\x6c\145so\162\x64\145r_\151\144")$value = getSoName($value);elseif($fieldname == "\x63\141\x6dp\141\151\x67\x6ei\x64")$value = getCampaignName($value);elseif($fieldname == "t\x65rm\163\137c\157\x6e\144it\x69\x6f\156\163")$value = $this->x20($value);elseif($fieldname == "\143\157m\155ent\x73")$value = $this->x21($efocus);elseif($fieldname == "folder\x69\144")$value = $this->x22($value);elseif($x16($fieldname, $related_fieldnames)) {if ($value != "") {$parent_module = getSalesEntityType($value);$displayValueArray = getEntityName($parent_module, $value);if(!empty($displayValueArray)) {foreach($displayValueArray as $key=>$p_value) {$value = $p_value;}}if($fieldname=="i\156\166\157\151\143ei\x64" && $value=="\060")$value="";}}if($x16($fieldname, $Datefields))$value = getValidDisplayDate($value);elseif($x16($fieldname, $Picklists)) {if(!$x16($x26($value), $this->ignored_picklist_values))$value = $this->x1b($value,$emodule);else$value = "";}elseif($x16($fieldname, $Checkboxes)) {$pdf_app_strings = return_application_language($this->language);if($value == 1)$value = $pdf_app_strings["\x79\x65s"];else$value = $pdf_app_strings["n\157"];}elseif($x16($fieldname, $Textareas))$value = $x1a($value);elseif($x16($fieldname, $Multipicklists)) $value = $x1f(' |##| ',', ',$value);elseif($x16($fieldname, $NumbersField))$value = $this->x1e($value);if ($is_inventory)$inventory_content[$x22($emodule."\137".$fieldname)] = $value;else$this->replacements["\044".$related.$x22($emodule."\137".$fieldname)."\044"]=$value;}if($is_inventory)return $inventory_content;else$this->x12();}private function x0f() { global $x0b,$x0c,$x0d,$x0e,$x0f,$x10,$x11,$x12,$x13,$x14,$x15,$x16,$x17,$x18,$x19,$x1a,$x1b,$x1c,$x1d,$x1e,$x1f,$x20,$x21,$x22,$x23,$x24,$x25,$x26; $cur_usr = "c\x75\x72\x72\145\x6et\x5fus\x65\162";$root_dir = "\x72\157\x6f\x74_\144\x69\x72\x65\143t\x6f\162\171";global $$cur_usr,$$root_dir; $sql = "\x53\105LE\103T *\040\x46\x52O\x4d \x76\x74ig\x65\162_o\162ga\x6e\x69\x7aa\164\151\157\x6ed\x65\164a\151l\163";$result = $this->db->query($sql);$Org_Details = $this->db->fetchByAssoc($result, 1);foreach ($Org_Details AS $coll => $value) {if ($coll == "\154\157\147o")$value = "\074im\x67\040s\162\143\075\"".$$root_dir."\x74\145s\x74/l\x6fg\x6f\x2f".$Org_Details["lo\x67\157n\141me"]."\">";$this->replacements["\044".$this->org_cols[$coll]."$"] = $value;} $sql = "\x53\x45LE\103T\040\164\141\156\x64\x63\040\x46\122\x4f\115 \166t\151\x67e\x72_i\156\166\145n\164\x6f\162\x79_\x74\x61nd\x63\040\127\x48\105\122\105\040\x74\x79\x70e\x20=\040'\111\156\166\x65\156to\x72\x79'";$tandc = $this->db->getOne($sql,0,"\x74\141\x6e\144\x63");$this->replacements["\044"."TE\122M\123\137A\x4e\104\x5f\103ON\104\111TI\x4f\x4eS$"] = $x1a($tandc); $user_sql = "\x53\x45\114\x45\x43T\040\x2a \x46\x52O\x4d \x76\x74\151\x67\x65\x72\137u\x73\x65\162\x73 \x57\x48ER\x45 i\x64\x3d".$this->focus->column_fields["\141\163si\147\x6e\145d\137u\x73\145\162\x5fid"];$user_res = $this->db->query($user_sql);$user_row = $this->db->fetchByAssoc($user_res);$this->replacements["\044"."\x55\123E\x52\x5f\125\x53E\x52\116A\x4d\x45$"] = $user_row["\x75\163e\162_\156\x61\x6d\145"];$this->replacements["\x24"."\125\x53ER\137\106IRS\124NAME\044"] = $user_row["\x66\151\x72\x73\x74\137\156\141\x6d\x65"];$this->replacements["$"."\x55\123ER\x5f\114\x41\x53TN\x41\115\x45\044"] = $user_row["\x6c\141\x73\x74\x5f\x6e\x61m\145"];$this->replacements["\044"."\125\123\x45R_\x45MAI\114\x24"] = $user_row["em\141il1"];$this->replacements["\x24"."\x55\x53\105\122_TI\124\x4c\105$"] = $user_row["ti\x74\154\145"];$this->replacements["\x24"."\125\x53E\122\x5f\x46\101X\x24"] = $user_row["\x70\150\x6f\156\145_\x66ax"];$this->replacements["\044"."\x55S\x45\122\137\x44EPA\122T\x4dEN\124\x24"] = $user_row["\x64\x65\160\141\162t\x6d\x65\x6e\x74"];$this->replacements["\044"."\x55\123\x45\x52\x5fO\x54\110\105R_EM\x41\x49L$"] = $user_row["\x65\155\141il\062"];$this->replacements["$"."U\x53\x45R\x5f\120\110ONE\044"] = $user_row["\x70ho\x6e\145_\167ork"];$this->replacements["\x24"."US\x45R\137\131\x41H\117\117I\104$"] = $user_row["\x79ah\x6f\157_i\x64"];$this->replacements["\x24"."\x55\x53ER\137\x4d\x4f\x42I\x4cE$"] = $user_row["\x70\x68\x6f\156\145_\155\157b\x69\x6c\145"];$this->replacements["$"."\125\123\105R\x5f\x48\117\x4d\105\x5fP\110\117\116E\x24"] = $user_row["p\150\157n\x65_\x68\157\155\145"];$this->replacements["$"."\x55SE\x52_\117\124\110\x45\122_\x50\110\117\x4eE\044"] = $user_row["\160\150one_\x6f\164\x68e\x72"];$this->replacements["\044"."\125S\x45\x52_\x53IGH\116\101\x54U\x52\x45\x24"] = $user_row["\x73\x69\x67\156\x61\164\x75\x72\x65"];$this->replacements["$"."\125S\x45\122\137\116\117TE\123$"] = $user_row["\144e\x73\x63r\151\x70\x74ion"];$this->replacements["\044"."\x55S\105R_ADDRES\123\044"] = $user_row["\x61d\x64\162es\163\137\x73\x74r\145e\164"];$this->replacements["\044"."\125\123\x45R\137\103\x4fU\116TR\131\x24"] = $user_row["\141\144d\162\x65\x73\x73_\143o\x75\156tr\171"];$this->replacements["\x24"."\x55SE\122\137C\x49\x54\131\044"] = $user_row["a\144\144\162\145\x73\163\x5fcit\x79"];$this->replacements["$"."\x55SER\137\x5a\x49P\x24"] = $user_row["\141d\x64r\145ss\137\x70\157st\x61l\x63\x6f\144\145"];$this->replacements["$"."\125SE\x52\137S\124A\124\x45\x24"] = $user_row["\x61\x64\144\x72\145\x73s_\163ta\x74e"]; $this->replacements["\044"."\x4c\137US\x45R\x5f\125S\x45R\x4e\101\115\x45\x24"] = $$cur_usr->column_fields["\x75\163e\162\x5fna\155\x65"];$this->replacements["\x24"."L\x5f\125\123\x45\x52\x5fF\x49R\123\124\116AM\105\044"] = $$cur_usr->column_fields["\146\x69\162s\x74\137\156\x61\x6de"];$this->replacements["\x24"."\x4c_U\123\x45R_\x4c\x41\123\124\116A\115E\044"] = $$cur_usr->column_fields["l\x61\x73t_\x6eam\145"];$this->replacements["$"."L\137\125S\x45\x52\137\x45\115\101\111\114\044"] = $$cur_usr->column_fields["\145m\x61il\x31"];$this->replacements["\x24"."L\137\x55\x53\x45\122\137T\x49\x54L\105\044"] = $$cur_usr->column_fields["\164\x69\x74\154e"];$this->replacements["\x24"."\x4c\x5f\125\123E\122\x5f\x46\101X$"] = $$cur_usr->column_fields["p\150\x6f\x6ee_\x66\141\x78"];$this->replacements["\x24"."\114\x5f\125\x53ER\x5f\x44\x45\x50\x41\122T\x4dE\116\124$"] = $$cur_usr->column_fields["d\x65\x70\141r\x74\x6d\145\156\164"];$this->replacements["$"."\114\x5f\x55S\x45\x52_\117T\x48ER\x5fE\115\101I\114\x24"] = $$cur_usr->column_fields["e\x6da\151\154\062"];$this->replacements["$"."\x4c_\x55S\105R_\120H\117\x4e\x45\x24"] = $$cur_usr->column_fields["\160\150\x6f\156\145_w\x6fr\x6b"];$this->replacements["\x24"."\114_\125\123ER\137\x59\101\x48\117O\111\104\x24"] = $$cur_usr->column_fields["y\141\x68\x6f\157\137\x69\144"];$this->replacements["$"."\x4c\137U\x53E\x52\137\115O\x42\x49L\x45\x24"] = $$cur_usr->column_fields["p\x68\x6fn\x65\137\155\x6fb\x69\154e"];$this->replacements["$"."\x4c\137\125\x53E\122\137\110OM\105\x5fP\110\x4f\x4e\105\044"] = $$cur_usr->column_fields["\x70h\157n\x65\x5f\150o\x6d\x65"];$this->replacements["\x24"."L_\125\x53ER\137O\x54H\x45\122\x5f\120HON\x45\044"] = $$cur_usr->column_fields["\160\x68\x6fne\x5f\157\x74\150e\162"];$this->replacements["\x24"."\114\x5f\x55S\x45\122\137\x53\111\x47\110\116A\124\125\x52\x45\x24"] = $$cur_usr->column_fields["\x73\151g\x6e\141\x74\165\x72\145"];$this->replacements["$"."\x4c\137\x55S\105R_N\117\124\x45S$"] = $$cur_usr->column_fields["d\x65\x73\143r\x69p\164i\157\156"];$this->replacements["\044"."\x4c\137\x55\123\105\122\x5fA\x44\104\x52\x45S\123\044"] = $$cur_usr->column_fields["\x61d\x64\162\145s\x73\x5fst\x72\145\145\x74"];$this->replacements["$"."L\137\x55\x53ER\x5f\x43\117U\x4eTR\x59\x24"] = $$cur_usr->column_fields["\x61\144d\162\145\x73s_c\x6fu\156try"];$this->replacements["$"."L_\x55\x53\105\x52\137C\x49\124\131$"] = $$cur_usr->column_fields["a\144\144\162\145ss\137ci\x74y"];$this->replacements["\x24"."L_U\x53\105\122\x5f\x5aI\120$"] = $$cur_usr->column_fields["addr\x65\163\163_p\157\163\164\141l\143ode"];$this->replacements["\x24"."\114\x5fU\123E\x52\x5fS\124A\124\105\044"] = $$cur_usr->column_fields["\141\144\x64r\145\x73s_\163\164a\x74\145"];$this->x12();}private function x10(){ global $x0b,$x0c,$x0d,$x0e,$x0f,$x10,$x11,$x12,$x13,$x14,$x15,$x16,$x17,$x18,$x19,$x1a,$x1b,$x1c,$x1d,$x1e,$x1f,$x20,$x21,$x22,$x23,$x24,$x25,$x26; $app_lang = return_application_language($this->language); $mod_lang = return_specified_module_language($this->language,$this->module); if($x23($this->content, "%G_")!==false){ foreach($app_lang as $key=>$value){ $this->replacements["\045\107\137".$key."\045"] = $value; } } if($x23($this->content, "%\x4d_")!==false){ foreach($mod_lang as $key=>$value){ $this->replacements["\x25\x4d_".$key."\045"] = $value; } } $this->x12();}private function x11(){ global $x0b,$x0c,$x0d,$x0e,$x0f,$x10,$x11,$x12,$x13,$x14,$x15,$x16,$x17,$x18,$x19,$x1a,$x1b,$x1c,$x1d,$x1e,$x1f,$x20,$x21,$x22,$x23,$x24,$x25,$x26; require_once("\143\154\141s\163\145s\x2f\163\151\x6d\160\154\145\x5fht\155\x6c\137dom.p\x68\160");$this->replacements["\133\x42\x41\x52\x43\x4f\104E|"]="<ba\x72co\144\145>";$this->replacements["|\102A\x52C\x4fD\105\x5d"]="\x3c\057ba\x72\143\x6fd\x65\x3e";$this->x12();$html = str_get_html($this->content);foreach($html->find("\x62a\x72cod\x65") as $barcode) {list($type,$code) = $x11("=",$barcode->plaintext,2);$barcode->outertext = '<barcode code="'.$code.'" type="'.$type.'" />';}$this->content = $html->save();}private function x12() { global $x0b,$x0c,$x0d,$x0e,$x0f,$x10,$x11,$x12,$x13,$x14,$x15,$x16,$x17,$x18,$x19,$x1a,$x1b,$x1c,$x1d,$x1e,$x1f,$x20,$x21,$x22,$x23,$x24,$x25,$x26; if(!empty($this->replacements)){$this->content = $x1e($x0b($this->replacements), $this->replacements, $this->content);$this->replacements = array();}} private function x13() { global $x0b,$x0c,$x0d,$x0e,$x0f,$x10,$x11,$x12,$x13,$x14,$x15,$x16,$x17,$x18,$x19,$x1a,$x1b,$x1c,$x1d,$x1e,$x1f,$x20,$x21,$x22,$x23,$x24,$x25,$x26; $salt="\163\151\164e\137UR\x4c";global $$salt;$this->site_url = $x26($$salt,"\057");$sql = "\x53E\114\105\103T vt\x69\147\145r\x5f\x70df\155a\153\x65\162\x2e\052\x2c \x76\164i\147e\162\x5f\x70\144\146\155\x61ke\x72\137\163\x65\164tin\147s\056*\015\x0a\040\040\x20\x20\x20\x20\040\x20\x20\x20\040\x20\040\x20\106R\117M\x20\166\164\151\147\x65\162\x5f\x70d\x66m\141k\x65\x72\015\x0a \040\x20\x20\040\x20 \x20\x20 L\x45\106T\040\x4aOI\116 v\x74\151\x67\145\162_\x70\x64fmake\x72\x5f\163\x65\x74\x74\151\156g\x73
\040\x20\040\x20 \x20\x20 \040\040 \x20 \x20ON\040\x76t\x69\147\145\x72\x5f\x70dfm\141\153\x65r\x5f\x73\145\164\x74\151\156g\163.\x74\145\155p\x6ca\164eid\040\075\040\166\164\x69ge\x72_p\144\x66\x6d\x61\x6b\x65\162\056\164\x65m\x70\154\x61\164\x65\151\x64\x0d\x0a\x20\040 \x20\x20\040 \040\x20\040\040 WH\105R\105\x20\166\x74\x69\x67\x65\162_\160d\x66m\141\153\145r.t\145\x6d\160\x6ca\164\145\x69\x64=\x3f";$result = $this->db->pquery($sql, array($this->templateid));$data = $this->db->fetch_array($result);$this->decimal_point = $x14($data["\144ec\151\x6da\154\137\160\x6f\151\x6et"], ENT_QUOTES);$this->thousands_separator = $x14(($data["\164\x68o\x75\x73\x61\156\x64s\x5f\x73\145p\x61\x72\141\x74o\x72"]!="\x73p" ? $data["\x74\150\x6f\165sa\156\144\163_\x73\x65\x70\141\x72\141t\157\x72"] : "\040"), ENT_QUOTES);$this->decimals = $data["\x64eci\155\x61ls"];$this->header = $data["\x68\x65a\x64e\162"];$this->footer = $data["\x66o\157\164er"];$this->body = $data["\x62\x6f\x64y"];$this->filename = $data["\146i\154\x65\137n\x61\155\x65"];$this->templatename = $data["\146\x69l\x65\x6e\x61\155\145"]; $this->pagebreak = '<pagebreak orientation="'.$data["\x6f\x72\151\145\x6e\164\x61\x74\151\157\156"].'" margin-left="'.($data["\155\x61r\147\x69n\137le\x66\164"] * 10).'mm" margin-right="'.($data["\155arg\151\x6e_r\151gh\x74"] * 10).'mm" margin-top="0mm" margin-bottom="0mm" margin-header="'.($data["m\x61\x72\x67\x69\156\137\x74\x6f\160"] * 10).'mm" margin-footer="'.($data["\155\x61\x72g\x69\x6e_\x62o\164\x74o\155"] * 10).'mm" />';}private function x14() { global $x0b,$x0c,$x0d,$x0e,$x0f,$x10,$x11,$x12,$x13,$x14,$x15,$x16,$x17,$x18,$x19,$x1a,$x1b,$x1c,$x1d,$x1e,$x1f,$x20,$x21,$x22,$x23,$x24,$x25,$x26; $sql = "\x53\105\114\105CT\x20v\141lu\145 F\122\117\115 vti\x67\145\x72\x5fp\144\146ma\x6b\145\162_\x69g\156\157\162\145\x70i\143kl\x69s\164\x76\x61\154\165\x65\163";$result = $this->db->query($sql);while($row = $this->db->fetchByAssoc($result)) {$this->ignored_picklist_values[] = $row["v\x61l\165\145"];}}private function x15() { global $x0b,$x0c,$x0d,$x0e,$x0f,$x10,$x11,$x12,$x13,$x14,$x15,$x16,$x17,$x18,$x19,$x1a,$x1b,$x1c,$x1d,$x1e,$x1f,$x20,$x21,$x22,$x23,$x24,$x25,$x26; $taxtype = $this->x1d();$currencytype = $this->x1c();$query="\163\x65\x6c\x65\x63\164\x20\x63\x61\163e w\x68\x65\156\x20vti\147\x65\x72_p\162\x6fdu\x63\164\163\x2e\x70\x72o\144u\143tid\x20!=\x20'' th\145n \166t\151\147e\162_\160\162o\x64uc\x74\x73\056p\x72\x6f\144\x75\x63\x74\x6e\x61\x6d\x65 \x65\x6c\163\x65\040\166ti\x67e\162_\163\145\162\166\151\x63\145.\163\145\x72\166\x69ce\156\x61\x6d\x65 \x65\x6e\144 a\x73 pr\x6f\x64\165\143\x74\156\x61m\x65," ." \143\141se\x20\x77\150e\x6e\x20v\x74\151\x67\145\x72_\160\x72\157\x64\x75\x63t\163\x2e\160\x72\x6fdu\143\164\151d\x20!\075\040''\040\164he\x6e \166ti\x67\x65\162\x5fp\x72\x6f\144\165\x63\164s\056\x70rodu\143\x74\x69\144 e\x6c\x73e v\164ig\x65\x72\137\163e\162\x76\151\x63\145\056\163\x65\x72\x76\x69c\x65i\144\x20\145n\144\x20\141\x73\040\x70\163\151\x64\054" ."\040c\x61\x73\145\x20\167h\x65n\x20v\164i\147er\x5f\160ro\144\165\x63\164\x73\056p\162\157d\165\143\x74i\x64\040\041\075\040''\040t\150\x65\x6e\x20\166t\151ger\137\160r\157d\165\x63\x74s.\x70\x72\157\144\165\143\164\x5fn\157 \x65ls\x65\040\166\x74i\x67\145\x72_\163e\162\166\151\x63e\056\x73\x65\x72v\151\x63\x65\x5f\156o\x20en\x64 a\x73 \160\163\x6eo," ."\x20\143\x61se\x20w\150\145n\040\166\x74\151\x67er_\x70\162oduct\163\056pr\x6fd\x75\143\164id != ''\040t\150\145\x6e\040'\x50\x72\x6f\x64\165\x63t\x73'\x20\145\x6c\x73e\x20'\x53\x65\162\166i\143\x65\163' \x65nd\x20\x61\x73\040en\164\151\164\171\x74\171p\x65\054" ."\040\x63ase\040\167\150en \x76\x74ig\145\162\137p\162\x6fdu\143\x74s\056\x70ro\x64u\143t\151d\x20\041= ''\040\x74h\x65\x6e\x20v\164\151ge\x72_\160\162\x6f\x64u\x63\164\x73\056\x75nit_\160\x72\x69\143\x65 \x65\154\163\145 \166\164ig\145\x72\x5f\163\x65r\166i\143\145\x2e\165nit\137\160\162\151\143e\x20e\156\x64\040\141\163\040\165n\151\164\137\160\x72\x69\143\145," ."\040\x63\x61\x73\x65 w\x68\145n \166\164\151\x67\x65r\137\x70roduct\163\056\160\x72\x6fdu\143\x74i\144\x20\041\075\x20''\040t\150en\x20v\164\x69ge\x72\x5f\160\162\157\144uct\163.\165\163\141g\145u\x6ei\x74\x20\x65\154\x73\x65 \166ti\x67\145r_\163erv\x69\143\145\056\163e\162\x76\x69\143e_\x75sa\x67e\x75\156\151\x74 \145n\144\040\141\163 u\163\141\x67\145\x75\156\151t," ."\x20c\141\x73\145\x20wh\145\156\x20vti\x67\x65\x72_\160r\157\144\165\x63\x74\x73.pr\x6f\144u\x63\x74i\144 !\075\x20''\x20t\x68\x65n\040\166\x74ig\145\162\x5f\160\x72\x6f\144\165\x63t\x73\x2eq\164\x79\x5fp\145\162_\165\x6e\x69\164\x20\x65\154\163\145\040v\164i\x67\x65\x72_\163\145r\166i\x63\145\056\x71\164\x79_\160\x65\x72_\x75n\x69\164\040\x65\156\x64\040a\x73\040\161\164\x79\137\160\145\x72\137\x75\x6e\151\164," ." \143\141\x73e\040\x77\150en\040\x76\164\151\147e\x72\x5f\160rodu\x63\164s\x2e\160\x72od\x75c\x74\151\x64 \041\x3d\040''\x20\x74\x68\x65\x6e\040\x76t\x69\x67\x65\x72\137\160\x72o\x64\x75ct\x73.\x71\164\171i\156\163\x74\x6f\x63k \145ls\x65\x20'\x4e\101'\x20\145\x6e\144\x20\141\163\x20\161\x74y\x69\156\163toc\153\054" ."\040\143as\x65\040\167h\145n\040\x76\x74\x69\147\x65\162_\x70r\157d\x75\143ts.p\162\x6fd\x75\143\164\x69\144\040\041\075 ''\x20t\150\x65n\x20\1431.de\x73\x63\162ipti\157\x6e\040e\x6c\163e \x63\062.d\145s\x63\162i\160\164\151\157\x6e\x20e\x6e\x64\040\x61\163\x20p\163d\145\x73\x63\x72\x69pti\x6f\x6e\054\x20\x76ti\147e\162\x5f\151\156\x76e\x6et\x6f\162\x79\x70ro\144\165\143tr\145l\x2e\052 " ."\x20\146rom \166\x74\x69g\145\x72_\x69n\x76\x65\156\164o\x72\171\160ro\144\x75\143tr\145\x6c" ." \154e\x66t\040\x6a\x6f\x69n\x20v\164\x69g\145\x72\137\x70\x72o\144\x75\143t\163 \157n\040\166tige\162\137\160\x72od\165\x63t\x73\056\x70\162\x6fduc\x74i\144\075v\164ig\145\x72_\x69nv\x65\x6et\157\162\x79\160\x72od\165\143t\x72\145l\x2e\160\162\157du\x63\x74\151\144\x20" ." \x6ce\146t \152\x6fi\x6e \166t\x69\x67\x65\162_\143\162\155\145n\x74ity\040a\x73\040\x63\x31\040\x6f\x6e \x63\x31.c\x72\155\151\x64\040\075\x20vtig\145r_\160\162odu\143\164s.p\x72\157\144\165\x63\x74\151\144\040" ." \x6c\x65\146\164\040\152o\x69n v\164\151\147e\162_\163e\162v\x69ce o\156\040\166\164\x69ge\x72_\x73e\x72\166\x69c\x65.s\145r\x76\x69\x63\x65id\x3d\166ti\x67\x65r_i\x6e\166\x65\x6e\164\157r\171p\162odu\x63\x74\x72\x65\x6c.\160r\157\144\x75c\x74\151\x64 " ." l\145\146\x74\040\152o\151\x6e\x20\166t\151\x67\x65r_\143\162m\x65n\x74\151t\171\x20\141\163 c2 \157\156 \143\x32\056\143\x72\x6d\151\x64 = \166t\151\147\145\162_s\145\162v\151\x63\145\056\163\145\162\x76\151c\145id\040" ."\x20\167\150\x65\x72\145 i\x64=\077\040\117\122\x44E\122 \x42\x59\x20\163e\161uenc\145\x5f\x6e\x6f";$result = $this->db->pquery($query, array($this->focus->id));$num_rows=$this->db->num_rows($result);$netTotal = "\060\x2e\0600"; $totalAfterDiscount_subtotal=0;$total_subtotal=0;$totalsum_subtotal=0; $images = $this->x17(); $Total_Tax_Values = array();for($i=1;$i<=$num_rows;$i++){$sub_prod_query = $this->db->pquery("\123EL\105\103T\x20\160ro\144\x75c\164\151d\040\x66\x72\x6f\155\040\166\164ig\145\x72\x5f\x69\x6e\x76\x65\x6eto\x72\x79su\x62\160\x72\157\144\x75\143\164\x72e\x6c\040\127H\105\122\105 \151\144\x3d\077\x20\x41\116\104 se\161\165en\x63e\137\156o=\077",array($this->focus->id,$i));$subprodname_str='';if($this->db->num_rows($sub_prod_query)>0){for($j=0;$j<$this->db->num_rows($sub_prod_query);$j++){$sprod_id = $this->db->query_result($sub_prod_query,$j,"\x70\x72o\144\x75\x63t\x69\144");$sprod_name = getProductName($sprod_id);$str_sep = "";if($j>0) $str_sep = "\x3a";$subprodname_str .= $str_sep." \055\x20".$sprod_name;}}$subprodname_str = $x1e("\072","\x3cb\x72>",$subprodname_str);$psid = $this->db->query_result($result,$i-1,"p\x73i\x64");$psno = $this->db->query_result($result,$i-1,"ps\156\x6f");$productid=$this->db->query_result($result,$i-1,"\160\162od\x75\143\x74\x69d");$entitytype=$this->db->query_result($result,$i-1,"\x65\156\x74\151\x74yt\x79p\145");$producttitle = $productname= $this->db->query_result($result,$i-1,"\x70rodu\143t\156\x61\x6de");if($subprodname_str!="") $productname .= "<\142\162\x2f\x3e<\163\160\x61\156\x20s\x74\x79l\x65='\143\157l\x6f\x72\072\043\1030\x43\x30\x43\x30\073f\x6fn\164\055st\171\154\x65\x3ai\164\x61l\151\143\x3b'>".$subprodname_str."<\057sp\x61\156>";$comment=$this->db->query_result($result,$i-1,"\x63\x6f\155m\145\156\x74");$psdescription =$this->db->query_result($result,$i-1,"\160\x73\x64es\x63r\151\160t\151\x6f\156");$inventory_prodrel_desc = $this->db->query_result($result,$i-1,"\144\145s\143\162i\x70\164\x69\157\156");$qtyinstock=$this->db->query_result($result,$i-1,"\161t\x79\151\x6e\163\x74\157\143k");$qty=$this->db->query_result($result,$i-1,"\x71\x75an\x74\151t\171");$qty_per_unit=$this->db->query_result($result,$i-1,"\161\x74\171_pe\x72\137\165\156\151\x74");$usageunit=$this->db->query_result($result,$i-1,"\x75s\141\147\145u\x6e\151t");$unitprice=$this->db->query_result($result,$i-1,"u\x6ei\164\x5fp\162ic\x65");$listprice=$this->db->query_result($result,$i-1,"l\x69s\x74\160\x72\x69\x63\145");$total = $qty*$listprice; $discount_percent=$this->db->query_result($result,$i-1,"\x64i\x73\x63oun\164_p\x65rce\156\x74");$discount_amount=$this->db->query_result($result,$i-1,"\144\x69\x73c\x6fu\156\x74_a\155\x6f\x75\156\x74");$totalAfterDiscount = $total;$productDiscount = "0\x2e\x300";$productDiscountPercent = "";if($discount_percent != "\x4e\x55\114\x4c" && $discount_percent != "") {$productDiscount = $total*$discount_percent/100;$totalAfterDiscount = $total-$productDiscount; $productDiscountPercent=$discount_percent;}elseif($discount_amount != "N\x55\114L" && $discount_amount != "") {$productDiscount = $discount_amount;$totalAfterDiscount = $total-$productDiscount;} $netprice = $totalAfterDiscount; if($taxtype == "i\x6e\x64i\166i\x64u\x61\x6c") {$taxtotal = "0\x2e00";$tax_info_message = $mod_strings["\x4c\x42\114\137\124\117\124\101L\137\101\x46TE\122_D\x49\x53CO\x55NT"]." \x3d\040$totalAfterDiscount \\\x6e";$tax_details = getTaxDetailsForProduct($productid,"a\154\154");$Tax_Values = array();for($tax_count=0;$tax_count<$x0f($tax_details);$tax_count++) {$tax_name = $tax_details[$tax_count]["t\x61\x78\x6e\x61\x6d\145"];$tax_label = $tax_details[$tax_count]["\164axla\x62\145\x6c"];$tax_value = getInventoryProductTaxValue($this->focus->id, $productid, $tax_name);$individual_taxamount = $totalAfterDiscount*$tax_value/100;$taxtotal = $taxtotal + $individual_taxamount;if ($tax_name != "" && $tax_value > 0){ $vatblock[$tax_name."\x2d".$tax_value]["\x6ca\x62e\154"] = $tax_label;$vatblock[$tax_name."\055".$tax_value]["nett\x6f"] += $totalAfterDiscount; $vatblock[$tax_name."\055".$tax_value]["v\141\164"] += $x1c($individual_taxamount,$this->decimals);$vatblock[$tax_name."\x2d".$tax_value]["\166a\x6cu\x65"] = $tax_value;$x0c($Tax_Values, $tax_value);$x0c($Total_Tax_Values, $tax_value);}$netprice = $netprice + $taxtotal;} if ($x0f($Tax_Values) > 0){ $tax_avg_value = $x0e($Tax_Values);}else{ $tax_avg_value = "\x30.\x30\060";} $Details["\120"][$i]["P\x52\117D\x55\103\124V\101\124PE\122C\105\116T"] = $this->x1e($tax_avg_value);$Details["\120"][$i]["P\x52\x4f\x44\x55\103\x54V\101\x54S\x55M"] = $this->x1e($taxtotal);}if ($entitytype == "P\162\157\x64\165\x63\164s"){ $Details["\120"][$i]["\120\122OD\125C\124\x53\x5fC\122\115\x49D"] = $psid; $Details["\x50"][$i]["\123E\x52\126\111\x43\105S\x5f\103RM\x49\104"] = "";}else{ $Details["\x50"][$i]["\120\122O\104\x55C\124S\137C\122\x4d\111\x44"] = ""; $Details["\x50"][$i]["S\x45R\126\x49\103\x45S\x5f\103R\x4d\111\104"] = $psid;}$Details["\120"][$i]["\120\123_\x43\122\115\111\x44"] = $psid;$Details["P"][$i]["\120S_\x4e\x4f"] = $psno;if($comment!=""){$comment = $x1e("\\n", "\074\x62r>", $x1a($comment)); $comment = $x14($comment,ENT_QUOTES,"\165tf\0558");$productname .= "\074b\162\040\x2f\076<\163\155al\154>".$comment."\074/\x73m\x61ll\076";}$Details["\x50"][$i]["P\122\117\104\125\103\124\x4eA\115E"] = $productname;$Details["\x50"][$i]["\x50\x52OD\125C\124T\111T\114E"] = $producttitle;$psdescription = $x1e("\\\156", "\x3c\x62\x72\076", $x1a($psdescription));$Details["P"][$i]["\120R\117D\x55\x43TD\x45\123\103\x52\x49\x50TI\117\x4e"] = $x14($psdescription,ENT_QUOTES,"u\164\x66\055\070");$Details["P"][$i]["\120\122O\x44\125\x43\x54\x45\104\x49T\104\x45SC\122\111\120\124\x49\117N"] = $comment;$inventory_prodrel_desc = $x1e("\\\156", "<\x62r\076", $x1a($inventory_prodrel_desc)); $Details["\120"][$i]["C\x52\x4d\116\117\x57\x50\122O\104\x55\x43T\x44\x45\x53\103R\x49\x50\x54\x49O\116"] = $x14($inventory_prodrel_desc,ENT_QUOTES,"\x75tf\0558");$Details["\120"][$i]["P\x52\x4f\x44\x55\103T\114\x49\123\124P\122\111C\x45"] = $this->x1e($listprice);$Details["\x50"][$i]["P\x52\117DU\103T\124\117TA\x4c"] = $this->x1e($total);$Details["P"][$i]["\120\x52OD\125\x43TQ\x55A\x4eT\x49\x54\131"] = $this->x1e($qty);$Details["\x50"][$i]["\120\x52O\x44\x55\x43\x54\121I\x4e\x53\x54OC\x4b"] = $this->x1e($qtyinstock); $Details["\x50"][$i]["\120\x52\117D\125\x43\124\x50R\x49CE"] = $this->x1e($unitprice); $Details["\120"][$i]["\x50\x52\x4fDU\x43T\x50\117S\111\x54ION"] = $i;$Details["\x50"][$i]["PR\x4fD\x55\x43\124\121TYP\x45R\125\x4e\111\124"] = $this->x1e($qty_per_unit); $Details["P"][$i]["\x50R\x4fDUC\x54US\101\x47\105\125\x4e\111T"] = $this->x1b($usageunit,"\x50\162\157\144u\143\164\163\x2f\x53\145rv\x69c\145\x73");$Details["\120"][$i]["\120RODU\103\124\104I\x53COU\116\x54"] = $this->x1e($productDiscount);$Details["P"][$i]["\x50\122\117D\125CT\x44\111\123\x43\x4f\x55N\124\x50\x45\x52C\x45N\124"] = $this->x1e($productDiscountPercent);$Details["\120"][$i]["\120\x52\x4f\x44U\103T\x53\124O\124\x41\114\x41FTE\x52D\x49\123\103\x4fU\x4eT\123U\115"] = $totalAfterDiscount; $Details["P"][$i]["\120ROD\x55\103T\123\x54\117T\x41\114\101FT\x45\122\x44I\x53\x43\x4f\x55\x4eT"] = $this->x1e($totalAfterDiscount);$Details["\120"][$i]["\120\x52O\104\125C\124\124O\124AL\x53U\x4d"] = $this->x1e($totalAfterDiscount+$taxtotal); $totalAfterDiscount_subtotal += $totalAfterDiscount;$total_subtotal += $total;$totalsum_subtotal+= $totalAfterDiscount+$taxtotal;$Details["\x50"][$i]["\120\122\117D\125\103\x54ST\117\x54\x41L\x41\106\124\x45\x52\x44\111\123\103\x4fU\116\124_\123\x55B\124\x4f\124AL"] = $this->x1e($totalAfterDiscount_subtotal);$Details["\120"][$i]["\120R\117\x44U\x43\124T\117\124\101\x4c\137\x53UB\124OTA\x4c"] = $this->x1e($total_subtotal);$Details["\x50"][$i]["PRO\104UCT\124\x4fT\101\x4c\123U\115\137\x53\125B\x54O\x54\101\x4c"] = $this->x1e($totalsum_subtotal); $sequence = $this->db->query_result($result,$i-1,"\163\145\161\165\145\156ce_\156\157");$Details["P"][$i]["\x50\122\x4fD\125\103\x54SE\121UE\x4e\103\x45"] = $sequence;if(isset($images[$productid."\137".$sequence])){$width="";$height="";if($images[$productid."\137".$sequence]["\167\x69\144\164h"]>0)$width="\040\x77\x69dth='".$images[$productid."\137".$sequence]["\x77\151dt\150"]."' ";if($images[$productid."\137".$sequence]["\x68\145\x69\x67ht"]>0)$height=" h\145\x69\x67\150\x74\x3d'".$images[$productid."\x5f".$sequence]["\150\x65i\x67\x68\164"]."'\x20";$Details["\x50"][$i]["P\122\x4fD\x55\x43\124\x53\137I\x4dA\107E\116\101M\105"] = "\x3c\x69\155\147 src\075'".$this->site_url."\x2f".$images[$productid."\137".$sequence]["s\x72c"]."' ".$width.$height."\x2f>";} $focus_p = CRMEntity::getInstance("P\162\157du\143t\163");if ($entitytype == "\x50r\x6f\144u\x63\x74\x73" && $psid != "") {$focus_p->id = $psid;$this->x1f($focus_p,$psid,"\x50\x72\157\x64\x75ct\x73"); }$Array_P = $this->x0e("\120rod\165c\164s", $focus_p, false, true);$Details["\x50"][$i] = $x0d($Array_P,$Details["\120"][$i]);unset($focus_p);$focus_s = CRMEntity::getInstance("\x53\145r\x76i\143es");if ($entitytype == "S\x65\162\x76\x69\x63\145\x73" && $psid != "") {$focus_s->id = $psid;$this->x1f($focus_s,$psid,"\123e\162\166\151\x63\x65\x73"); }$Array_S = $this->x0e("Se\162\166i\143e\x73", $focus_s, false, true);$Details["P"][$i] = $x0d($Array_S,$Details["P"][$i]);unset($focus_s); $sumwithoutvat += $totalAfterDiscount;$netTotal = $netTotal + $netprice;} $finalDiscount = "0.\x30\060";$final_discount_info = "\x30";$finalDiscountPercent=""; if($this->focus->column_fields["\x68\144\x6e\104\x69\163\143\157\165\156t\x50\x65\162c\x65n\x74"] != "0") {$finalDiscount = ($netTotal*$this->focus->column_fields["hd\156\x44\x69\163\143\x6f\165nt\x50\x65r\x63\145\x6e\164"]/100);$finalDiscountPercent = $this->focus->column_fields["\150\144n\104\151\x73\143oun\164\120er\143\x65n\x74"];}elseif($this->focus->column_fields["\150d\x6e\x44is\x63\157u\x6e\164\101mo\x75\156\x74"] != "\060") {$finalDiscount = $this->focus->column_fields["\150\x64\156Di\163\x63o\x75\156\164Am\157\x75\x6e\x74"];} $taxtotal = "\x30.\x300";if($taxtype == "\147roup") {$final_totalAfterDiscount = $netTotal - $finalDiscount;$tax_details = getAllTaxes("\x61\166\141i\x6c\x61\x62le","","e\x64i\x74",$this->focus->id);for($tax_count=0;$tax_count<$x0f($tax_details);$tax_count++) {$tax_name = $tax_details[$tax_count]["t\141\170\x6e\141\x6d\x65"];$tax_label = $tax_details[$tax_count]["\164\141\x78\x6cab\145\154"];$tax_value = $this->db->query_result($result,0,$tax_name);if($tax_value == "" || $tax_value == "N\125L\114")$tax_value = "\x30\0560\060";$taxamount = ($netTotal-$finalDiscount)*$tax_value/100;$taxtotal = $taxtotal + $taxamount;if ($tax_name != "" && $tax_value > 0){$vatblock[$tax_name]["\x6c\x61bel"] = $tax_label;$vatblock[$tax_name]["ne\164\x74o"] = $final_totalAfterDiscount; $vatblock[$tax_name]["\x76\141t"] += $taxamount; $vatblock[$tax_name]["v\x61\x6cu\145"] = $tax_value; } $total_vat_percent += $tax_value;}$vat_value = $taxtotal; foreach ($Details["\120"] as $keyP=>$valueP) {$productvatsum = ($Details["P"][$keyP]["\120\122O\x44\x55\x43T\123\124O\x54\x41\x4c\101F\124\x45R\x44\x49\x53\x43\117\125\x4e\124\123U\x4d"]*$total_vat_percent)/100;$producttotalsum = $Details["P"][$keyP]["P\x52ODUCTST\117T\101L\x41F\x54\105\x52\104\x49S\103O\125\x4e\x54\x53\x55M"] + $productvatsum;$Details["\120"][$keyP]["P\x52OD\x55\x43T\x56AT\x50\x45\x52CE\x4e\x54"] = $this->x1e($total_vat_percent);$Details["\x50"][$keyP]["\120\x52O\104\x55CTVA\x54\123U\115"] = $this->x1e($productvatsum);$Details["\x50"][$keyP]["\x50\122O\104\x55\x43TTO\x54\101L\x53\125M"] = $this->x1e($producttotalsum);} }else{if ($x0f($vatblock) > 0){ foreach ($vatblock as $keyM => $valueM) $vat_value += $valueM["\x76\x61\x74"];}else{ $vat_value = "\x30\056\x30\060"; }} $shAmount = ($this->focus->column_fields["\x68d\156\123\x5f\x48\x5f\x41\x6d\157\165\x6e\x74"] != "")?$this->focus->column_fields["h\x64\156\123\x5fH\x5fA\x6d\x6f\x75\x6et"]:"\x30.0\060";$shtaxtotal = "\060\x2e\x30\060";$shtax_details = getAllTaxes("\141\166a\151\x6c\x61\142\154e","\x73\x68","e\x64\151\164",$this->focus->id);for($shtax_count=0;$shtax_count<$x0f($shtax_details);$shtax_count++) {$shtax_name = $shtax_details[$shtax_count]["ta\170\x6e\141\x6d\x65"];$shtax_label = $shtax_details[$shtax_count]["\164\x61x\154\x61be\x6c"];$shtax_percent = getInventorySHTaxPercent($this->focus->id,$shtax_name);$shtaxamount = $shAmount*$shtax_percent/100;$shtaxtotal = $shtaxtotal + $shtaxamount;}$totalafterdiscount = $sumwithoutvat-$finalDiscount;$totalwithvat = ($sumwithoutvat-$finalDiscount)+$vat_value;$Details["\x54\117\x54\x41\114"]["\x4e\x45T\x54\x4f\124A\x4c"] = $this->x1e($netTotal);$Details["\124\117\124AL"]["TOT\x41L\x57I\124H\x4f\125\x54\126\x41\x54"] = $this->x1e($sumwithoutvat);$Details["\x54\117\124\101\x4c"]["F\x49NAL\x44\x49S\x43\117\125\116\124"] = $this->x1e($finalDiscount);$Details["\124\117\124A\114"]["\106INA\x4cD\111\x53\x43OU\116\124PE\x52C\x45N\124"] = $this->x1e($finalDiscountPercent);$Details["\124\x4f\x54\101\114"]["TO\124\101\x4cA\x46\x54E\122\x44\x49\123\x43\117\x55\116T"] = $this->x1e($totalafterdiscount);$Details["\x54\117\x54AL"]["\x54A\130TO\124\x41\114"] = $this->x1e($vat_value);$Details["T\x4fTA\x4c"]["\x54AX\x54\117TALP\x45\122\x43\x45N\124"] = $this->x1e($total_vat_percent); $Details["\x54OT\101L"]["\124OT\x41\114W\x49\x54H\126A\x54"] = $this->x1e($totalwithvat);$Details["\124\117TA\114"]["\x53\110\124\101\130\x41MO\125N\x54"] = $this->x1e($shAmount);$Details["T\x4f\x54A\x4c"]["S\x48T\x41XT\117\124\101\114"] = $this->x1e($shtaxtotal);$Details["\124\117\x54\x41L"]["\x56\x41\124B\x4cOCK"] = $vatblock;return $Details;}private function x16(){ global $x0b,$x0c,$x0d,$x0e,$x0f,$x10,$x11,$x12,$x13,$x14,$x15,$x16,$x17,$x18,$x19,$x1a,$x1b,$x1c,$x1d,$x1e,$x1f,$x20,$x21,$x22,$x23,$x24,$x25,$x26; $sql="S\x45LE\103T\x20\160\x72o\x64\165\143t\151\x64, \x73\x65\x71\165\x65\156\143\145\x2c\x20\x73\150\x6f\167\x5f\x68\x65\141\144e\162, \x73ho\167\x5fs\165b\x74\x6f\x74\141\154\x20F\122\x4f\x4d\x20\x76\164\x69g\x65r_\x70dfma\153\145\x72\137\142\x72e\141k\154\151\156\x65 \127H\105\122E\x20\x63r\155\151d\x3d\x3f";$res = $this->db->pquery($sql,array($this->focus->id));$products=array();$show_header=0;$show_subtotal=0;while($row=$this->db->fetchByAssoc($res)){$products[$row["pr\x6f\x64\x75\143ti\x64"]."\x5f".$row["se\161u\x65\x6ec\x65"]] = $row["\163eq\x75e\156\x63\x65"];$show_header=$row["s\150\x6f\167\x5fh\x65\141\x64er"];$show_subtotal=$row["s\x68o\167\137su\x62\x74\x6f\x74a\x6c"];}$output["\x70\x72\x6f\x64\165\143\x74\163"] = $products;$output["\x73\150\x6f\167_h\x65\x61\x64\145\162"] = $show_header;$output["\163ho\167\x5f\x73ub\164\157\164\x61\x6c"] = $show_subtotal;return $output;}private function x17(){ global $x0b,$x0c,$x0d,$x0e,$x0f,$x10,$x11,$x12,$x13,$x14,$x15,$x16,$x17,$x18,$x19,$x1a,$x1b,$x1c,$x1d,$x1e,$x1f,$x20,$x21,$x22,$x23,$x24,$x25,$x26; $sql="S\x45\x4c\x45\103T\x20vti\147\145\162\x5f\141t\164\141\x63\150\155\x65\x6e\164\163\x2e\x70\x61th\x2c \x76ti\x67\145\162\x5f\141\x74ta\143\x68\x6de\x6ets.\156\x61\x6d\x65\x2c \x76t\x69g\145r_a\x74\164\141\x63\150m\x65\x6e\164\x73\056\141t\164\x61\x63\150\x6dent\163\151\144,\x20pro\x64u\143\x74\151\x64,\x20\x73\x65\x71u\145\156\143\x65, w\151\x64\164h\054\x20\150e\151ght
\040 \040 \040\040\040\040\040\040\040\106R\117M \x76t\x69g\x65\x72\x5f\x70\144\146m\141\x6b\x65\x72\x5fim\141\147\145s
\012 \040\x20\040\x20\040 \x20\040 I\116\116\105R\x20\x4a\x4f\111N v\164\x69ge\162_\141\164\164\x61\143\x68\155\145nt\x73
\012\x20\x20\x20 \040\x20\x20\x20\040 \x20\x20\x20\x20\117\x4e \166\164\151g\x65r\x5f\141\164\164\x61ch\155\145\x6et\163\056\x61\164t\141\143\150\155\145n\x74si\144\x3d\x76\x74\151g\x65\x72\x5f\x70\144\x66\x6d\x61\153\145\162_\151\x6d\141\x67e\x73.a\x74t\x61\143h\x6de\156t\x69\x64
\x0a \040 \040 \x20\040\x20\040 \x20\040\x49N\x4e\x45R \112\x4f\x49N\040\x76t\151ge\162_\143r\155\145\156t\151\x74\x79\x0d\012\x20\040 \040\x20 \x20\x20 \x20\x20 \x20\040\117\116\040v\x74\x69g\x65r_\x61\x74\x74\141\x63\x68\x6d\x65\x6e\164\163\056a\x74\x74ac\150m\145\156\x74\163\151d\075\166\x74i\147\x65\162\x5f\x63\162\x6d\x65nt\x69\x74\x79\x2ecr\x6did\x0d\012\040\x20\x20\040\040 \x20\x20 \040 \040WHERE\x20d\x65\x6c\145t\x65\144\x3d\060\040\x41\x4e\x44 \166\x74\x69\147\x65\x72_\160\x64\146\x6da\x6b\145r\x5f\x69m\141\147\x65\x73\056c\x72\155\x69d\x3d?";$res = $this->db->pquery($sql,array($this->focus->id));$products=array();while($row=$this->db->fetchByAssoc($res)){$products[$row["pr\x6f\x64\x75\x63ti\144"]."\137".$row["\163\145\161\x75en\x63\145"]]["\163\x72c"] = $row["p\141t\x68"].$row["\x61\x74\164a\143h\x6d\145n\x74\x73\x69\x64"]."\x5f".$row["n\141\x6de"];$products[$row["p\x72od\x75c\164\151d"]."\137".$row["\163equen\143\145"]]["wid\164\150"] = $row["\x77i\144\x74\x68"];$products[$row["\160ro\x64\165\x63\164\x69\144"]."\x5f".$row["\x73e\x71\165\145\156\x63e"]]["\x68ei\147\150\x74"] = $row["\x68e\x69\147\x68t"];}return $products;}private function x18($id){ global $x0b,$x0c,$x0d,$x0e,$x0f,$x10,$x11,$x12,$x13,$x14,$x15,$x16,$x17,$x18,$x19,$x1a,$x1b,$x1c,$x1d,$x1e,$x1f,$x20,$x21,$x22,$x23,$x24,$x25,$x26; if(isset($id) AND $id!=""){$query="\123\x45L\105\x43T\x20\166\x74\x69\147\145r\137\141\164\x74ac\150\x6de\x6e\164\163\x2e\x70\141t\x68\x2c \x76\x74ig\145r\137\141\164\x74a\143\150\155ent\163.n\x61\155\145,\x20v\x74i\x67e\x72\137a\164\x74\x61\143hm\x65\156\x74\163.\141ttach\x6den\x74\x73\151\144\x0d\012\x20\x20\040\040 \040 \040\x20\040 \x20\x20\x46\x52\x4f\115\040\x76t\x69\147\145\x72\137\143o\156\x74a\x63\164\x64\145tail\163\x0d
\x20 \x20\040\x20\040 \040\x20\040\040 \x49\116\x4e\105\122 JO\x49N\040\166\x74i\147\x65\x72\137\x73\x65a\x74t\141\x63hm\x65n\x74\x73r\x65l\015\012 \040 \040\040\x20\x20 \040\040\x20\x20\x20 \117\116 \x76ti\x67\145\162_\x63ont\x61ct\x64\x65\x74ai\154\163\056\x63o\x6e\164a\x63\x74id=v\164ige\x72_s\x65\141tt\x61c\x68\x6d\145\x6e\x74\163\x72\145l.c\162\x6d\x69\144
\x0a\x20\040\040\040\040\040\x20\x20\040\x20\x20\x20\x20\040\x49\x4eN\x45\122\040J\x4fI\x4e\x20\x76\x74\x69\x67e\x72\x5fa\x74t\141\143\150\155\x65\156\164\163\015\x0a\040\x20 \040\040\040 \x20 \x20\x20\040\040 O\116\x20\166\x74\x69\147\x65\x72\137\x61t\164\141\x63\x68\155en\164s.a\164\164a\143h\155\145\x6et\x73id\x3dv\164\151\x67\x65r\137sea\x74\164\141\x63\150\x6d\145\156\x74srel.\141\x74\164ac\150\x6d\145\x6et\x73\151d\x0d\012\x20\040\040\040 \040 \x20 \040\x20\x20\111\116\116\x45\122\040\x4aOI\x4e \166ti\147\x65\x72_cr\x6d\145n\164\x69\x74y
\040\x20 \x20 \x20\x20 \040 \x20\040 \040 \040O\116 \166ti\147\145\x72\x5f\141\164\164\141\x63h\x6d\x65nt\163\056\x61tt\141c\150\x6d\x65\156\164s\151\x64\075vt\151g\145\x72_\143r\x6den\164\151\164y\056\x63rm\x69\x64\x0d\x0a\x20\040\x20\040 \040\x20 \040 \040\x20\x20\x57H\x45\x52\x45\x20d\x65\154e\x74e\144\075\x30 AND\x20vtig\145\x72_c\x6f\156\x74a\143\x74d\145t\141i\x6cs.c\x6f\x6et\141c\164\151\144=\077";$result = $this->db->pquery($query, array($id));$num_rows = $this->db->num_rows($result);if ($num_rows > 0){$image_src = $this->db->query_result($result,0,"\x70a\164\x68").$this->db->query_result($result,0,"a\x74\x74\141\143\150\155\x65n\164\163i\144")."_".$this->db->query_result($result,0,"\156\x61\x6d\x65");$image = "\074\151m\147\040sr\x63='".$this->site_url."/".$image_src."'\x2f\x3e";return $image;}} else {return "";}} private function x19($id) { global $x0b,$x0c,$x0d,$x0e,$x0f,$x10,$x11,$x12,$x13,$x14,$x15,$x16,$x17,$x18,$x19,$x1a,$x1b,$x1c,$x1d,$x1e,$x1f,$x20,$x21,$x22,$x23,$x24,$x25,$x26; if($id != "") {$sql = "S\x45\x4c\x45C\x54\040u\x73\145\x72\x5f\x6e\141\x6de\040\x46RO\x4d v\164\x69\x67er\137\x75\163\145\162\163\040W\x48ER\x45 i\x64\x3d\x3f";$result = $this->db->pquery($sql, array($id));$ownername = $this->db->query_result($result,0,"u\x73e\x72\x5f\x6e\x61m\145");}if($ownername == "") {$sql = "\x53E\114E\x43\124\x20\x67r\157\x75p\156\x61\155e \x46R\117M\040v\164\151\x67e\162\x5f\147r\157\x75p\163\x20\127\110\x45\122\x45 \x67r\157u\160i\x64=?";$result = $this->db->pquery($sql, array($id));$ownername = $this->db->query_result($result,0,"\x67r\x6f\165p\156a\x6d\145");}else {$ownername = getUserFullName($id);}return $ownername;}private function x1a($account_id) { global $x0b,$x0c,$x0d,$x0e,$x0f,$x10,$x11,$x12,$x13,$x14,$x15,$x16,$x17,$x18,$x19,$x1a,$x1b,$x1c,$x1d,$x1e,$x1f,$x20,$x21,$x22,$x23,$x24,$x25,$x26; $accountno = "";if($account_id != '') {$sql = "\123\105\x4c\105\x43\124 \x61\x63\143o\x75\156\164\137\x6e\157 \106\122\117\x4d vt\151\x67\145\x72_\141\x63\143\157u\156\164 \127\110E\122E\040acco\x75\x6e\164id\x3d\077";$result = $this->db->pquery($sql, array($account_id));$accountno = $this->db->query_result($result,0,"a\x63\x63\x6f\x75\156\164_\x6e\x6f");}return $accountno;}private function x1b($str,$emodule) { global $x0b,$x0c,$x0d,$x0e,$x0f,$x10,$x11,$x12,$x13,$x14,$x15,$x16,$x17,$x18,$x19,$x1a,$x1b,$x1c,$x1d,$x1e,$x1f,$x20,$x21,$x22,$x23,$x24,$x25,$x26; if($emodule!="\x50r\157\144u\143ts\057\x53\x65\x72\166\151\x63\145\163") {$app_lang = return_application_language($this->language);$mod_lang = return_specified_module_language($this->language,$emodule);}else {$app_lang = return_specified_module_language($this->language,"\x53\145\x72v\151c\145\163");$mod_lang = return_specified_module_language($this->language,"\x50r\x6f\x64\x75cts");}$trans_str = ($mod_lang[$str] != '') ? $mod_lang[$str] : (($app_lang[$str] != '') ? $app_lang[$str] : $str);return $trans_str;}private function x1c() { global $x0b,$x0c,$x0d,$x0e,$x0f,$x10,$x11,$x12,$x13,$x14,$x15,$x16,$x17,$x18,$x19,$x1a,$x1b,$x1c,$x1d,$x1e,$x1f,$x20,$x21,$x22,$x23,$x24,$x25,$x26; $inventory_table = $this->inventory_table_array[$this->module];$inventory_id = $this->inventory_id_array[$this->module];$res = $this->db->pquery("\x53E\114\105\x43\x54\040\x63\x75\162\x72\145\156\x63y\x5f\x69\x64\x2c\x20".$inventory_table.".\x63onv\145rs\x69\x6f\156\137\162\x61\x74\x65\040A\123 \143\x6f\156v\137\162\141t\x65\x2c\x20v\x74i\147\x65\x72\x5f\x63u\x72\x72\145nc\x79_in\146\x6f.\052\x0d\x0a\040\x20\040 \040\x20\x20\x20\x20\x20 \x20 \x20\040\040\040\040\040 \x20 \040 \x20\040\106R\x4f\115\x20".$inventory_table."\x0d\012\040\x20\x20 \040\040\x20\x20\040\x20\x20\040 \040 \040 \040\x20 \x20\x20INN\x45\x52\040J\x4fI\x4e\x20\166\x74\x69\147e\x72_\x63ur\x72\x65\156\143\171_in\x66o\040O\x4e\x20".$inventory_table.".c\165\162r\145\156\143\171\x5fi\x64 \075\040\x76\164\151\147e\x72_\x63\165r\x72\145\x6e\143\x79\x5f\x69\x6e\146\x6f\056i\x64
\040\040\040\x20 \040\040\x20\040\040\x20\040 \040\x20\040 \x20\040\040\x20 \040\x20 \040\127\x48E\122\x45\040".$inventory_id."\075\077", array($this->focus->id));$currency_info = array();$currency_info["\143\x75\x72\162\x65nc\x79\137\151\144"] = $this->db->query_result($res,0,"\x63urre\156\143y_\151\144");$currency_info["\x63\x6f\156\x76\x65r\163\151\157\x6e_r\141\x74e"] = $this->db->query_result($res,0,"con\x76_\162a\164e");$currency_info["\x63\x75rr\145\x6e\x63\171\137\x6e\141\155\x65"] = $this->db->query_result($res,0,"c\165r\x72e\156cy\x5fname");$currency_info["\143\165\162\x72e\x6e\143y\x5fcod\145"] = $this->db->query_result($res,0,"\143\165\x72\x72e\156c\171\x5f\143\x6f\x64\x65");$currency_info["c\x75r\x72\145\x6ec\x79\137\163\171\x6d\x62\x6f\x6c"] = $this->db->query_result($res,0,"\143\165rr\x65nc\171\137s\x79m\142ol");return $currency_info;}private function x1d() { global $x0b,$x0c,$x0d,$x0e,$x0f,$x10,$x11,$x12,$x13,$x14,$x15,$x16,$x17,$x18,$x19,$x1a,$x1b,$x1c,$x1d,$x1e,$x1f,$x20,$x21,$x22,$x23,$x24,$x25,$x26; $res = $this->db->pquery("\x53\x45\114E\103\x54 \164\x61xt\x79\160\145\x20F\122\x4f\115\040".$this->inventory_table_array[$this->module]."\040\x57\x48\x45R\105\x20".$this->inventory_id_array[$this->module]."\x3d\x3f", array($this->focus->id));$taxtype = $this->db->query_result($res,0,'taxtype');return $taxtype;}private function x1e($value) { global $x0b,$x0c,$x0d,$x0e,$x0f,$x10,$x11,$x12,$x13,$x14,$x15,$x16,$x17,$x18,$x19,$x1a,$x1b,$x1c,$x1d,$x1e,$x1f,$x20,$x21,$x22,$x23,$x24,$x25,$x26; if($x19($value)){$number = $x1b($value,$this->decimals,$this->decimal_point,$this->thousands_separator);}else {$number = "";}return $number;}private function x1f(&$focus,$record,$module) { global $x0b,$x0c,$x0d,$x0e,$x0f,$x10,$x11,$x12,$x13,$x14,$x15,$x16,$x17,$x18,$x19,$x1a,$x1b,$x1c,$x1d,$x1e,$x1f,$x20,$x21,$x22,$x23,$x24,$x25,$x26; $result = Array();foreach($focus->tab_name_index as $table_name=>$index)$result[$table_name] = $this->db->pquery("S\x45L\x45\x43\124\040\x2a FR\117\115 ".$table_name." W\110\105\x52\x45\x20".$index."\075?", array($record));$tabid = getTabid($module);$sql1 = "SE\x4c\105C\x54 \146\x69e\x6c\144\x6e\x61\x6d\x65\x2c\x20f\x69\x65l\144i\144\x2c\040\x66i\145l\144\154\x61\x62\145\x6c\x2c\x20\x63o\154\165\x6d\x6e\156\x61m\145\x2c\040tab\154\x65\156\141me\054 u\151t\171pe\054 t\171\160\x65o\146\x64\141\164\141\054 p\x72\145sence\015\x0a \040\x20\x20 \040 \x20 \040\x20 \106\x52\117\115 \166ti\x67e\x72_\x66\x69el\144\040W\110\105\122\x45\x20t\141\142\151\x64\075\077";$result1 = $this->db->pquery($sql1, array($tabid));$noofrows = $this->db->num_rows($result1);if($noofrows) {while($resultrow = $this->db->fetch_array($result1)) {$fieldcolname = $resultrow["\143ol\x75m\156n\x61m\145"];$tablename= $resultrow["t\141\142l\145\156\x61\x6de"];$fieldname= $resultrow["\146i\145\x6c\x64\x6e\x61m\x65"];$fld_value="";if(isset($result[$tablename]))$fld_value = $this->db->query_result($result[$tablename],0,$fieldcolname);$focus->column_fields[$fieldname] = $fld_value;}}$focus->column_fields["\162\145\143or\x64_\151d"] = $record;$focus->column_fields["re\143\157\x72\x64\137\x6do\x64\x75l\145"] = $module;}private function x20($value) { global $x0b,$x0c,$x0d,$x0e,$x0f,$x10,$x11,$x12,$x13,$x14,$x15,$x16,$x17,$x18,$x19,$x1a,$x1b,$x1c,$x1d,$x1e,$x1f,$x20,$x21,$x22,$x23,$x24,$x25,$x26; if($x12("\155\157\144\x75\154es\x2fS\x65\164t\151n\147\163\057\x45d\151t\x54\x65\x72\x6dDe\x74a\x69\x6cs.\160\150\160")) {$sql = "\x53\x45\x4c\x45\x43\x54\040\164\x61\x6ed\x63 \x46\122\x4f\115\040\166\164\x69\147er\x5f\x69\156\166\x65\x6e\x74\157r\171\137\x74\x61n\144c\x20\x57\110\x45\122\x45\x20\x69\x64\075'".$value."'";$res = $this->db->query($sql);$num = $this->db->num_rows($res);if($num>0)$tandc = $this->db->query_result($res,0,"t\x61n\x64c");else$tandc = $value;}else$tandc = $value;return $tandc;}private function x21($efocus) { global $x0b,$x0c,$x0d,$x0e,$x0f,$x10,$x11,$x12,$x13,$x14,$x15,$x16,$x17,$x18,$x19,$x1a,$x1b,$x1c,$x1d,$x1e,$x1f,$x20,$x21,$x22,$x23,$x24,$x25,$x26; $commentlist="";$prefix="";if($efocus->column_fields["rec\157\x72\x64\137\155od\165l\x65"] == "He\x6c\160D\x65s\x6b"){$prefix="\164\x69\143\x6b\x65t";}elseif($efocus->column_fields["\x72\x65\143o\162\144\137\x6dod\x75\154\145"] == "\106\141\161") {$prefix="\x66\141\161";}if($prefix!="") {$mod_lang = return_specified_module_language($this->language,$efocus->column_fields["re\143\x6f\x72d\137\155\157\144\x75l\145"]);$sql="\123\x45\114E\x43\124\x20*\040F\122\117M v\164\151g\145\162\x5f".$prefix."\143\157\x6dm\x65\156\164\163\040\127HE\x52E ".$prefix."\x69\144\075".$efocus->id;$result=$this->db->query($sql);while($row = $this->db->fetchByAssoc($result)) {$comment = $row["\143\x6fm\155\x65\x6et\x73"];$crtime = getValidDisplayDate($row["\x63r\x65at\145\144\164i\x6d\145"]);$body="";if($prefix=="t\151\x63k\145\164"){$author = $this->x19($row["o\x77n\145r\151\x64"]);$body=$comment."<\x62\162\x20/\076".$mod_lang["LB\x4c_\x41\125\x54\x48\x4f\x52"]."\x3a\x20".$author."<\x62\162\040\x2f\x3e".$mod_lang["\x43rea\x74\145\x64\x20\124\x69\x6d\145"].":\x20".$crtime."<\142r \x2f\076<\x62r\040/>";}else {$body=$comment."\074\x62\162 \x2f>".$mod_lang["C\x72\x65\x61\164e\144\040\124\x69\155e"]."\072 ".$crtime."\x3c\142\x72\x20\x2f\076\x3cbr\x20\057>";}$commentlist.=$body;}}return $commentlist;}private function x22($folderid) { global $x0b,$x0c,$x0d,$x0e,$x0f,$x10,$x11,$x12,$x13,$x14,$x15,$x16,$x17,$x18,$x19,$x1a,$x1b,$x1c,$x1d,$x1e,$x1f,$x20,$x21,$x22,$x23,$x24,$x25,$x26; $sql="\x53\105\114E\x43\124\x20\x66o\x6cd\145\x72\156\x61\155\145\040\x46\x52O\115\040\x76\x74\151g\x65r\137a\x74t\141\143h\x6d\145n\x74\163\146\157\154d\x65\x72 \x57\110\105\x52\105\x20fo\154d\145\x72i\x64\075".$folderid;return $foldername = $this->db->query_result($this->db->query($sql),0,"f\x6fl\144er\156ame");}public function getFilename() { global $x0b,$x0c,$x0d,$x0e,$x0f,$x10,$x11,$x12,$x13,$x14,$x15,$x16,$x17,$x18,$x19,$x1a,$x1b,$x1c,$x1d,$x1e,$x1f,$x20,$x21,$x22,$x23,$x24,$x25,$x26; $this->content = $this->filename;$this->replacements["$#TEM\120\x4c\x41\x54\x45_\116A\x4dE\x23$"]=$this->templatename;$this->replacements["$\043\x44\x44-M\115-\131\x59Y\131\x23$"]=$x10("d-m-Y");$this->replacements["$\043\115M\055DD\055\x59YY\x59#\x24"]=$x10("\155\x2dd\x2d\131");$this->replacements["$\x23YY\x59\x59\055\115\x4d\x2d\104\x44\043$"]=$x10("\x59-\155\x2d\x64");$this->replacements["\044".$x22($this->module)."\x5f\103\122MI\104\044"]=$this->focus->id;$this->x0e($this->module, $this->focus);$this->replacements=array();$this->replacements["\r\\156"]="";$this->replacements["\134\x6e\134\x72"]="";$this->replacements["\x5cn"]="";$this->replacements["\\162"]="";$this->x12();return $x24(generate_cool_uri($x20($x14($this->content,ENT_QUOTES,"\x75t\x66\x2d\070"))),0,255); }}function generate_cool_uri($name){ global $x0b,$x0c,$x0d,$x0e,$x0f,$x10,$x11,$x12,$x13,$x14,$x15,$x16,$x17,$x18,$x19,$x1a,$x1b,$x1c,$x1d,$x1e,$x1f,$x20,$x21,$x22,$x23,$x24,$x25,$x26; $nazov=$x26($x25($x21($name)));$Search = array("$","\x80","\x26","%",")","\050","\x2e"," -\x20","/","\x20","\x2c","\x26\x23\063\x318;","\x9a","\046\x23\x326\x39;","\x26#35\x37;","\236","","\xe1","","","\363","","\046\x2336\067\073","\372","\xfc","\xe4","&\x23\x33\x328\073","&\x23\x32\067\061\x3b","\364","\046\0433\x341\073","Ľ","","\x26\043\062\066\070\073","\x26\x23\x3356\x3b","\216","\335","\xc1","\xcd","\xc9","","\332","&\x23\06270\073","\"","\260","\xdf");$Replace = array("","","","","","","-","\055","\055","-","\x2d","l","\163","c","\x74","\x7a","\171","a","\151","\145","\157","o","\x75","\165","\x75","a","n","\144","\157","r","\154","s","\143","\x74","\172","\171","\141","i","e","\x6f","\x75","\144","","","\x73\163");$return=$x1e($Search, $Replace, $name); return $return;}function createPDFAndSaveFile($templates,$focus,$modFocus,$file_name,$moduleName,$language){ global $x0b,$x0c,$x0d,$x0e,$x0f,$x10,$x11,$x12,$x13,$x14,$x15,$x16,$x17,$x18,$x19,$x1a,$x1b,$x1c,$x1d,$x1e,$x1f,$x20,$x21,$x22,$x23,$x24,$x25,$x26; $db="\141\144\142";$cu="\x63\165\x72r\145n\164\137\x75\163er";$dl="d\x65\146a\165l\x74_l\x61\x6eg\x75\x61g\145";global $$db, $$cu, $$dl; $date_var = $x10("Y\055\155\055\x64\x20H:\151\072\x73");$ownerid = $focus->column_fields["a\163\x73i\147n\x65\144\137\165\163\145r\x5fi\144"]; if(!isset($ownerid) || $ownerid=="")$ownerid = $$cu->id; $current_id = $$db->getUniqueID("\x76\x74i\147e\x72_c\x72\155e\x6e\x74it\171");$templates = $x1d($templates,"\073");$Templateids = $x11("\x3b",$templates);$x17("\155e\155\157\x72\x79\137\x6ci\155\x69\x74","\061\x328\x4d");$name="";if (!$language || $language == "") $language = $$dl;foreach ($Templateids AS $templateid){$PDFContent = new PDFContent($templateid, $moduleName, $modFocus, $language);$pdf_content = $PDFContent->getContent();$Settings = $PDFContent->getSettings();if($name=="")$name = $PDFContent->getFilename();$header_html = $x14($pdf_content["\x68\x65\141\x64\x65r"],ENT_COMPAT,"\x75\164\146\055\x38");$body_html = $x14($pdf_content["bo\144\x79"],ENT_COMPAT,"\x75\x74f-\x38");$footer_html = $x14($pdf_content["\146o\157\x74\x65\162"],ENT_COMPAT,"\165\x74\x66\x2d8");$encoding = $Settings["\x65\156\x63\157din\x67"];if ($Settings["o\162i\145nta\164\151\x6f\156"] == "lan\144\163ca\160\145") $format = $Settings["\146\x6fr\x6d\x61\164"]."\055L";else $format = $Settings["\146or\x6d\x61\x74"];if (!isset($mpdf)){$mpdf=new mPDF('',$format,'','Arial',$Settings["m\141\x72g\x69\x6e_l\x65\x66\x74"],$Settings["\x6da\x72gi\x6e_\x72\x69g\x68\164"],0,0,$Settings["m\141r\x67in\x5f\x74o\160"],$Settings["m\x61\x72\147\x69\x6e\x5f\x62\x6f\x74\164\157m"]);$mpdf->SetAutoFont();@$mpdf->SetHTMLHeader($header_html);}else{@$mpdf->SetHTMLHeader($header_html);@$mpdf->WriteHTML('<pagebreak sheet-size="'.$format.'" margin-left="'.$Settings["\155\x61\162\x67\151\156_\154\145\x66\x74"].'mm" margin-right="'.$Settings["\155ar\x67\x69n\x5f\162\x69\147\x68\164"].'mm" margin-top="0mm" margin-bottom="0mm" margin-header="'.$Settings["\155\141r\147i\x6e\137\164\x6f\160"].'mm" margin-footer="'.$Settings["marg\x69\x6e_b\x6f\164\164\157\x6d"].'mm" />');}@$mpdf->SetHTMLFooter($footer_html);@$mpdf->WriteHTML($body_html);}$upload_file_path = decideFilePath();if($name!="")$file_name = $name."\x2e\160\144f"; $mpdf->Output($upload_file_path.$current_id."\137".$file_name);$filesize = $x13($upload_file_path.$current_id."_".$file_name);$filetype = "\141p\160\x6c\x69ca\x74\151\x6fn\x2f\160d\146"; $sql1 = "in\163\x65r\x74 i\156\164\157 \x76t\151\x67e\x72_\x63\162\x6d\145n\164\x69\164y\x20(\x63\162\x6d\x69\x64\x2csm\x63\162ea\164or\151\144\054\x73m\157\x77\x6e\x65\162\x69\144\x2c\x73\x65\164\x79pe\054\x64\145\163cr\x69pti\x6f\x6e,c\162\145at\145d\x74\x69m\x65,mo\x64ifi\x65dti\x6de)\x20\166\141\154ue\x73\x28\077,\040\x3f\x2c ?\x2c\040\x3f, \077, ?\x2c\x20?\x29"; $params1 = array($current_id, $$cu->id, $ownerid, "\104o\x63\165m\x65\x6e\x74\163\x20At\164a\x63\150\x6de\x6et", $focus->column_fields["\x64\145\163\143\162\x69p\x74\151\x6f\156"], $$db->formatDate($date_var, true), $$db->formatDate($date_var, true)); $$db->pquery($sql1, $params1); $sql2="i\x6eser\164 \151n\164\x6f\x20\x76\164i\x67e\162_\141\x74t\x61c\x68m\145\156\164s\x28a\x74t\141\x63\x68\155\x65n\x74\x73\x69\144\054 n\141m\x65, \144\x65sc\162i\160t\x69\157\x6e, \x74\x79p\x65\054\040\x70\141\x74h\x29\040\166\141\x6c\x75\x65\x73\x28?\x2c \077\x2c\040?\054 ?,\040\x3f)"; $params2 = array($current_id, $file_name, $focus->column_fields["\144es\143\162i\160\164\151o\x6e"], $filetype, $upload_file_path); $result=$$db->pquery($sql2, $params2); $sql3='insert into vtiger_seattachmentsrel values(?,?)'; $$db->pquery($sql3, array($focus->id, $current_id));$sql4="\x55P\x44\x41T\x45\040\x76\x74\151\x67\145\x72_\156\157\164es\x20\x53E\x54 \146\151\x6ce\x73\x69\x7a\145\075\077, fi\x6c\x65\x6e\141\155\145=?\x20WHE\x52E not\145\163\x69d\x3d\077";$$db->pquery($sql4,array($filesize,$file_name,$focus->id)); return true;}
?>
Function Calls
ini_get | 1 |
Stats
MD5 | 41d63c077ab2fe0bbf06f61bdb53f216 |
Eval Count | 0 |
Decode Time | 379 ms |