'_POST'=> $rawPost,
);
foreach ($source as $dst=>$src) {
- // First correct all 2-byte entities.
- $s = preg_replace('/%(?!5B)(?!5D)([0-9a-f]{2})/si', '%u00\\1', $src);
- // Now we can use standard parse_str() with no worry!
- $data = null;
- parse_str($s, $data);
- $GLOBALS[$dst] = $this->_ucs2EntitiesDecode($data);
+ if ($src != NULL) {
+ // First correct all 2-byte entities.
+ $s = preg_replace('/%(?!5B)(?!5D)([0-9a-f]{2})/si', '%u00\\1', $src);
+ // Now we can use standard parse_str() with no worry!
+ $data = null;
+ parse_str($s, $data);
+ $GLOBALS[$dst] = $this->_ucs2EntitiesDecode($data);
+ }
}
$GLOBALS['HTTP_GET_VARS'] = $_GET; // deprecated vars
$GLOBALS['HTTP_POST_VARS'] = $_POST;
$link = "";
$id = $name;
if ($SysPrefs->use_popup_windows) {
- switch (strtolower($type)) {
- case "stock":
- $link = $path_to_root . "/inventory/inquiry/stock_list.php?popup=1&type=all&client_id=" . $id;
- $img_title = _("Search items");
- break;
- case "stock_manufactured":
- $link = $path_to_root . "/inventory/inquiry/stock_list.php?popup=1&type=manufactured&client_id=" . $id;
- $img_title = _("Search items");
- break;
- case "stock_purchased":
- $link = $path_to_root . "/inventory/inquiry/stock_list.php?popup=1&type=purchasable&client_id=" . $id;
- $img_title = _("Search items");
- break;
- case "stock_sales":
- $link = $path_to_root . "/inventory/inquiry/stock_list.php?popup=1&type=sales&client_id=" . $id;
- $img_title = _("Search items");
- break;
- case "stock_costable":
- $link = $path_to_root . "/inventory/inquiry/stock_list.php?popup=1&type=costable&client_id=" . $id;
- $img_title = _("Search items");
- break;
- case "component":
- $parent = $opts['parent'];
- $link = $path_to_root . "/inventory/inquiry/stock_list.php?popup=1&type=component&parent=".$parent."&client_id=" . $id;
- $img_title = _("Search items");
- break;
- case "kits":
- $link = $path_to_root . "/inventory/inquiry/stock_list.php?popup=1&type=kits&client_id=" . $id;
- $img_title = _("Search items");
- break;
- case "customer":
- $link = $path_to_root . "/sales/inquiry/customers_list.php?popup=1&client_id=" . $id;
- $img_title = _("Search customers");
- break;
- case "branch":
- $link = $path_to_root . "/sales/inquiry/customer_branches_list.php?popup=1&client_id=" . $id . "#customer_id";
- $img_title = _("Search branches");
- break;
- case "supplier":
- $link = $path_to_root . "/purchasing/inquiry/suppliers_list.php?popup=1&client_id=" . $id;
- $img_title = _("Search suppliers");
- break;
- case "account":
- case "account2":
- $skip = strtolower($type) == "account" ? false : true;
- $link = $path_to_root . "/gl/inquiry/accounts_list.php?popup=1&skip=".$skip."&client_id=" . $id;
- $img_title = _("Search GL accounts");
- break;
- }
+ if ($type != NULL) {
+ switch (strtolower($type)) {
+ case "stock":
+ $link = $path_to_root . "/inventory/inquiry/stock_list.php?popup=1&type=all&client_id=" . $id;
+ $img_title = _("Search items");
+ break;
+ case "stock_manufactured":
+ $link = $path_to_root . "/inventory/inquiry/stock_list.php?popup=1&type=manufactured&client_id=" . $id;
+ $img_title = _("Search items");
+ break;
+ case "stock_purchased":
+ $link = $path_to_root . "/inventory/inquiry/stock_list.php?popup=1&type=purchasable&client_id=" . $id;
+ $img_title = _("Search items");
+ break;
+ case "stock_sales":
+ $link = $path_to_root . "/inventory/inquiry/stock_list.php?popup=1&type=sales&client_id=" . $id;
+ $img_title = _("Search items");
+ break;
+ case "stock_costable":
+ $link = $path_to_root . "/inventory/inquiry/stock_list.php?popup=1&type=costable&client_id=" . $id;
+ $img_title = _("Search items");
+ break;
+ case "component":
+ $parent = $opts['parent'];
+ $link = $path_to_root . "/inventory/inquiry/stock_list.php?popup=1&type=component&parent=".$parent."&client_id=" . $id;
+ $img_title = _("Search items");
+ break;
+ case "kits":
+ $link = $path_to_root . "/inventory/inquiry/stock_list.php?popup=1&type=kits&client_id=" . $id;
+ $img_title = _("Search items");
+ break;
+ case "customer":
+ $link = $path_to_root . "/sales/inquiry/customers_list.php?popup=1&client_id=" . $id;
+ $img_title = _("Search customers");
+ break;
+ case "branch":
+ $link = $path_to_root . "/sales/inquiry/customer_branches_list.php?popup=1&client_id=" . $id . "#customer_id";
+ $img_title = _("Search branches");
+ break;
+ case "supplier":
+ $link = $path_to_root . "/purchasing/inquiry/suppliers_list.php?popup=1&client_id=" . $id;
+ $img_title = _("Search suppliers");
+ break;
+ case "account":
+ case "account2":
+ $skip = strtolower($type) == "account" ? false : true;
+ $link = $path_to_root . "/gl/inquiry/accounts_list.php?popup=1&skip=".$skip."&client_id=" . $id;
+ $img_title = _("Search GL accounts");
+ break;
+ }
+ }
}
if ($link !=="") {
function TextWrap($xpos, $ypos, $len, $str, $align = 'left', $border = 0, $fill = 0, $link = NULL, $stretch = 1, $spacebreak=false)
{
- $str = strtr($str, array("\r"=>''));
+ $str = ($str != NULL ? strtr($str, array("\r"=>'')) : "");
if ($this->fontSize != $this->oldFontSize)
{
function TextWrapLines($c, $width, $txt, $align='left', $border=0, $fill=0, $link=NULL, $stretch=0, $spacebreak=true)
{
- $str = explode("\n", $txt);
+ $str = ($txt != NULL ? explode("\n", $txt) : array());
for ($i = 0; $i < count($str); $i++)
{
$bal = get_open_balance($myrow['debtor_no'], $from);
$init = array();
- $init[0] = round2(abs($bal['charges']*$rate), $dec);
- $init[1] = round2(abs($bal['credits']*$rate), $dec);
- $init[2] = round2($bal['Allocated']*$rate, $dec);
+ $init[0] = round2(($bal != false ? abs($bal['charges']) : 0)*$rate, $dec);
+ $init[1] = round2(($bal != false ? abs($bal['credits']) : 0)*$rate, $dec);
+ $init[2] = round2(($bal != false ? $bal['Allocated'] : 0)*$rate, $dec);
if ($show_balance)
{
$init[3] = $init[0] - $init[1];
$accumulate += $init[3];
}
else
- $init[3] = round2($bal['OutStanding']*$rate, $dec);
+ $init[3] = round2(($bal != false ? $bal['OutStanding'] : 0)*$rate, $dec);
$res = get_transactions($myrow['debtor_no'], $from, $to);
if ($no_zeros && db_num_rows($res) == 0) continue;
$rep->TextCol(1, 2, _('Price List') . ": " . $myrow['sales_type']);
$rep->TextCol(2, 3, $myrow['br_name']);
$rep->NewLine();
- $adr = Explode("\n", $myrow['address']);
+ $adr = $myrow['address'] != NULL ? Explode("\n", $myrow['address']) : array();
if ($myrow['br_post_address'] == '')
$adr2 = Explode("\n", $myrow['br_address']);
else
$rate = $convert ? get_exchange_rate_from_home_currency($myrow['curr_code'], Today()) : 1;
$bal = get_open_balance($myrow['supplier_id'], $from);
$init = array();
- $bal['charges'] = isset($bal['charges']) ? $bal['charges'] : 0;
- $bal['credits'] = isset($bal['credits']) ? $bal['credits'] : 0;
- $bal['Allocated'] = isset($bal['Allocated']) ? $bal['Allocated'] : 0;
- $bal['OutStanding'] = isset($bal['OutStanding']) ? $bal['OutStanding'] : 0;
- $init[0] = round2(abs($bal['charges']*$rate), $dec);
- $init[1] = round2(Abs($bal['credits']*$rate), $dec);
- $init[2] = round2($bal['Allocated']*$rate, $dec);
+ //$bal['charges'] = $bal != false ? $bal['charges'] : 0;
+ //$bal['credits'] = $bal != false ? $bal['credits'] : 0;
+ //$bal['Allocated'] = $bal != false ? $bal['Allocated'] : 0;
+ //$bal['OutStanding'] = $bal != false ? $bal['OutStanding'] : 0;
+ $init[0] = round2(($bal != false ? abs($bal['charges']) : 0)*$rate, $dec);
+ $init[1] = round2(($bal != false ? abs($bal['credits']) : 0)*$rate, $dec);
+ $init[2] = round2(($bal != false ? $bal['Allocated'] : 0)*$rate, $dec);
if ($show_balance)
{
$init[3] = $init[0] - $init[1];
$accumulate += $init[3];
}
else
- $init[3] = round2($bal['OutStanding']*$rate, $dec);
+ $init[3] = round2(($bal != false ? $bal['OutStanding'] : 0)*$rate, $dec);
$res = getTransactions($myrow['supplier_id'], $from, $to);
if ($no_zeros && db_num_rows($res) == 0) continue;
$rate = $convert ? get_exchange_rate_from_home_currency($myrow['curr_code'], Today()) : 1;
$bal = get_open_balance($myrow['supplier_id'], $from);
$init = array();
- $bal['charges'] = isset($bal['charges']) ? $bal['charges'] : 0;
- $bal['credits'] = isset($bal['credits']) ? $bal['credits'] : 0;
- $bal['Allocated'] = isset($bal['Allocated']) ? $bal['Allocated'] : 0;
- $bal['OutStanding'] = isset($bal['OutStanding']) ? $bal['OutStanding'] : 0;
- $init[0] = round2(abs($bal['charges']*$rate), $dec);
- $init[1] = round2(Abs($bal['credits']*$rate), $dec);
- $init[2] = round2($bal['Allocated']*$rate, $dec);
+ $init[0] = round2(($bal != false ? abs($bal['charges']) : 0)*$rate, $dec);
+ $init[1] = round2(($bal != false ? abs($bal['credits']) : 0)*$rate, $dec);
+ $init[2] = round2(($bal != false ? $bal['Allocated'] : 0)*$rate, $dec);
$init[3] = $init[1] - $init[0];
$accumulate += $init[3];
$cols = array(0, 50, 150, 180, 210, 240, 270, 300, 330, 390, 435, 480, 525);
- $per0 = strftime('%b',mktime(0,0,0,date('m'),1,date('Y')));
- $per1 = strftime('%b',mktime(0,0,0,date('m')-1,1,date('Y')));
- $per2 = strftime('%b',mktime(0,0,0,date('m')-2,1,date('Y')));
- $per3 = strftime('%b',mktime(0,0,0,date('m')-3,1,date('Y')));
- $per4 = strftime('%b',mktime(0,0,0,date('m')-4,1,date('Y')));
+ $per0 = substr(date('F',mktime(0,0,0,date('m'),1,date('Y'))), 0, 3);
+ $per1 = substr(date('F',mktime(0,0,0,date('m')-1,1,date('Y'))), 0, 3);
+ $per2 = substr(date('F',mktime(0,0,0,date('m')-2,1,date('Y'))), 0, 3);
+ $per3 = substr(date('F',mktime(0,0,0,date('m')-3,1,date('Y'))), 0, 3);
+ $per4 = substr(date('F',mktime(0,0,0,date('m')-4,1,date('Y'))), 0, 3);
$headers = array(_('Category'), '', $per4, $per3, $per2, $per1, $per0, '3*M',
_('QOH'), _('Cust Ord'), _('Supp Ord'), _('Sugg Ord'));
list($yr, $mo, $da) = jalali_to_gregorian($yr, $mo, $da);
elseif ($SysPrefs->date_system == 2)
list($yr, $mo, $da) = islamic_to_gregorian($yr, $mo, $da);
- $per12 = strftime('%b',mktime(0,0,0,$mo,$da,$yr));
- $per11 = strftime('%b',mktime(0,0,0,$mo-1,$da,$yr));
- $per10 = strftime('%b',mktime(0,0,0,$mo-2,$da,$yr));
- $per09 = strftime('%b',mktime(0,0,0,$mo-3,$da,$yr));
- $per08 = strftime('%b',mktime(0,0,0,$mo-4,$da,$yr));
- $per07 = strftime('%b',mktime(0,0,0,$mo-5,$da,$yr));
- $per06 = strftime('%b',mktime(0,0,0,$mo-6,$da,$yr));
- $per05 = strftime('%b',mktime(0,0,0,$mo-7,$da,$yr));
- $per04 = strftime('%b',mktime(0,0,0,$mo-8,$da,$yr));
- $per03 = strftime('%b',mktime(0,0,0,$mo-9,$da,$yr));
- $per02 = strftime('%b',mktime(0,0,0,$mo-10,$da,$yr));
- $per01 = strftime('%b',mktime(0,0,0,$mo-11,$da,$yr));
+ $per12 = substr(date('F',mktime(0,0,0,$mo,$da,$yr)), 0, 3);
+ $per11 = substr(date('F',mktime(0,0,0,$mo-1,$da,$yr)), 0, 3);
+ $per10 = substr(date('F',mktime(0,0,0,$mo-2,$da,$yr)), 0, 3);
+ $per09 = substr(date('F',mktime(0,0,0,$mo-3,$da,$yr)), 0, 3);
+ $per08 = substr(date('F',mktime(0,0,0,$mo-4,$da,$yr)), 0, 3);
+ $per07 = substr(date('F',mktime(0,0,0,$mo-5,$da,$yr)), 0, 3);
+ $per06 = substr(date('F',mktime(0,0,0,$mo-6,$da,$yr)), 0, 3);
+ $per05 = substr(date('F',mktime(0,0,0,$mo-7,$da,$yr)), 0, 3);
+ $per04 = substr(date('F',mktime(0,0,0,$mo-8,$da,$yr)), 0, 3);
+ $per03 = substr(date('F',mktime(0,0,0,$mo-9,$da,$yr)), 0, 3);
+ $per02 = substr(date('F',mktime(0,0,0,$mo-10,$da,$yr)), 0, 3);
+ $per01 = substr(date('F',mktime(0,0,0,$mo-11,$da,$yr)), 0, 3);
$headers = array(_('Account'), _('Account Name'), $per01, $per02, $per03, $per04,
$per05, $per06, $per07, $per08, $per09, $per10, $per11, $per12, _('Total'));