From a9d55e1c13cbd6a6305b9322ec8621a06516f9f3 Mon Sep 17 00:00:00 2001 From: Joe Hunt Date: Mon, 9 Nov 2015 20:19:47 +0100 Subject: [PATCH] Cleanup comments. Small bugfixes. Final run --- frontaccounting.php | 22 +- includes/ui/ui_view.inc | 2 +- reporting/includes/class.graphic.inc | 19 +- reporting/includes/class.pdf.inc | 1 - reporting/includes/excel_report.inc | 4 - reporting/includes/pdf_report.inc | 16 -- reporting/includes/reporting.inc | 1 - reporting/includes/reports_classes.inc | 3 +- reporting/rep101.php | 1 - reporting/rep102.php | 14 +- reporting/rep103.php | 31 +-- reporting/rep107.php | 1 - reporting/rep109.php | 1 - reporting/rep111.php | 2 - reporting/rep113.php | 249 +++++++++--------- reporting/rep201.php | 20 +- reporting/rep203.php | 14 +- reporting/rep205.php | 2 +- reporting/rep303.php | 23 +- reporting/rep307.php | 3 - reporting/rep309.php | 4 +- reporting/rep401.php | 2 - reporting/rep409.php | 4 +- reporting/rep601.php | 6 +- reporting/rep701.php | 1 - reporting/rep704.php | 5 +- reporting/rep705.php | 7 +- reporting/rep706.php | 4 +- reporting/rep707.php | 4 +- reporting/rep708.php | 4 +- reporting/rep709.php | 5 +- reporting/reports_main.php | 7 +- .../allocations/customer_allocation_main.php | 44 ++-- sales/create_recurrent_invoices.php | 22 +- sales/credit_note_entry.php | 6 +- sales/customer_credit_invoice.php | 7 - sales/customer_delivery.php | 19 +- sales/customer_invoice.php | 88 ++----- sales/customer_payments.php | 134 +++++----- sales/includes/cart_class.inc | 102 ++++--- sales/includes/db/payment_db.inc | 8 +- sales/includes/db/sales_credit_db.inc | 9 +- sales/includes/db/sales_delivery_db.inc | 7 +- sales/includes/db/sales_invoice_db.inc | 16 +- sales/includes/sales_db.inc | 17 +- sales/includes/ui/sales_credit_ui.inc | 78 +++--- sales/includes/ui/sales_order_ui.inc | 44 ++-- sales/inquiry/sales_orders_view.php | 5 +- sales/manage/sales_people.php | 6 +- sales/sales_order_entry.php | 8 +- taxes/tax_calc.inc | 26 +- themes/default/renderer.php | 4 +- version.php | 8 +- 53 files changed, 468 insertions(+), 672 deletions(-) diff --git a/frontaccounting.php b/frontaccounting.php index 3d3347b1..2e81867b 100644 --- a/frontaccounting.php +++ b/frontaccounting.php @@ -22,7 +22,7 @@ if (!isset($path_to_root) || isset($_GET['path_to_root']) || isset($_POST['path_ include_once($path_to_root . '/installed_extensions.php'); class front_accounting - { + { var $user; var $settings; var $applications; @@ -34,16 +34,16 @@ if (!isset($path_to_root) || isset($_GET['path_to_root']) || isset($_POST['path_ { } function add_application(&$app) - { - if ($app->enabled) // skip inactive modules - $this->applications[$app->id] = &$app; - } + { + if ($app->enabled) // skip inactive modules + $this->applications[$app->id] = &$app; + } function get_application($id) - { - if (isset($this->applications[$id])) - return $this->applications[$id]; - return null; - } + { + if (isset($this->applications[$id])) + return $this->applications[$id]; + return null; + } function get_selected_application() { if (isset($this->selected_application)) @@ -85,4 +85,4 @@ if (!isset($path_to_root) || isset($_GET['path_to_root']) || isset($_POST['path_ $this->add_application(new setup_app()); } -} + } diff --git a/includes/ui/ui_view.inc b/includes/ui/ui_view.inc index cf4b4880..5352cb91 100644 --- a/includes/ui/ui_view.inc +++ b/includes/ui/ui_view.inc @@ -716,7 +716,7 @@ function quickentry_calculate($base, $id, $taxgroup=null, $date=null) case "t+": // ditto & increase base amount case "t-": // ditto & reduce base amount if (substr($row['action'], 0, 1) != 'T') - $totrate += get_tax_type_default_rate($row['dest_id']); + $totrate += get_tax_type_rate($row['dest_id']); } } $first = true; diff --git a/reporting/includes/class.graphic.inc b/reporting/includes/class.graphic.inc index 60b41021..7b7d32e9 100644 --- a/reporting/includes/class.graphic.inc +++ b/reporting/includes/class.graphic.inc @@ -233,9 +233,6 @@ class graph // Fill background imagefill($this->img, 0, 0, $this->color['background']); - //imagefilledrectangle($this->img, 0, 0, $this->width, $this->height, $this->color['background']); - //if ($border) - // imagerectangle($this->img, 0, 0, $this->width-1, $this->height-1, imagecolorallocate($this->img, 100, 150, 200)); // Draw title if (!empty($this->title)) @@ -278,13 +275,11 @@ class graph if ($len2 < $len1) $len2 += ($len1-$len2-1); $less = 7 * $len2; - //$this->_imagestring($this->img, $this->size, ($x1-$less-7), ($y2-7), $value, $this->color['axis_values']); $this->_imagestring($this->img, $this->size, ($x1-$less-7), ($y2-7), $value, $this->color['axis_values']); } } // Axis X - //$this->_imagestring($this->img, $this->size, $this->graphic_area_x2+10, $this->graphic_area_y2+3, $this->axis_x, $this->color['title']); $this->_imagestring($this->img, $this->size, $this->graphic_area_x2+40, $this->graphic_area_y2+3, $this->axis_x, $this->color['title']); imageline($this->img, $this->graphic_area_x1, $this->graphic_area_y2, $this->graphic_area_x2, $this->graphic_area_y2, $this->color['axis_line']); // Axis Y @@ -373,7 +368,6 @@ class graph imageline($this->img, ($x2+1), ($y1-1), ($x2+1), $y2, $this->color['bars_shadow']); imageline($this->img, ($x2+2), ($y1-1), ($x2+2), $y2, $this->color['bars_shadow']); imagefilledrectangle($this->img, $x1, $y1, $x2, $y2, $this->color['bars']); - //$this->_imagestring($this->img, $this->size, ((($x1+$x2)/2) - (strlen($parameter)*7/2)), ($y2+2), $parameter, $this->color['axis_values'], $alt); $this->_imagestring($this->img, $this->size, $x1, ($y2+2), $parameter, $this->color['axis_values'], $alt); } } @@ -415,7 +409,6 @@ class graph imagefilledrectangle($this->img, $x1, $y1, $x2, $y2, $this->color['bars']); $this->_imagestring($this->img, $this->size, ($x2+7), ($y1+2), $this->number_formated($this->y[$i], $this->dec2), $this->color['bars_shadow']); - //$this->_imagestring($this->img, $this->size, ($x1 - ((strlen($parameter)*7)+7)), ($y1+2), $parameter, $this->color['axis_values']); $this->_imagestring($this->img, $this->size, 30, ($y1+2), $parameter, $this->color['axis_values']); } } @@ -445,7 +438,6 @@ class graph { imageline($this->img, $x[$i], ($this->graphic_area_y1+10), $x[$i], ($this->graphic_area_y2-1), $this->color['bg_lines']); } - //$this->_imagestring($this->img, $this->size, ($x[$i] - (strlen($parameter)*7/2 )), ($this->graphic_area_y2+2), $parameter, $this->color['axis_values'], $alt); $this->_imagestring($this->img, $this->size, $x[$i], ($this->graphic_area_y2+2), $parameter, $this->color['axis_values'], $alt); $x[$i+1] = $x[$i] + 40; @@ -529,7 +521,6 @@ class graph for ($i = $this->h3d; $i >= 0; $i--) { - //imagearc($this->img, $center_x, ($center_y+$i), $width, $height, $start, ($start+$size), $this->color[$color]); if ($size >= 1) imagefilledarc($this->img, $center_x, ($center_y+$i), $width, $height, $start, ($start+$size), $this->color[$color], IMG_ARC_NOFILL); } @@ -841,9 +832,7 @@ class graph { // Office case 1: - //$this->color['title'] = imagecolorallocate($this->img, 50, 50, 50); $this->color['title'] = imagecolorallocate($this->img, 40, 70, 130); - //$this->color['background'] = imagecolorallocate($this->img, 238, 255, 238); $this->color['background'] = imagecolorallocate($this->img, 255, 255, 255); $this->color['axis_values'] = imagecolorallocate($this->img, 50, 50, 50); $this->color['axis_line'] = imagecolorallocate($this->img, 100, 100, 100); @@ -925,7 +914,6 @@ class graph // Spring case 3: $this->color['title'] = imagecolorallocate($this->img, 250, 50, 50); - //$this->color['background'] = imagecolorallocate($this->img, 250, 250, 220); $this->color['background'] = imagecolorallocate($this->img, 255, 255, 255); $this->color['axis_values'] = imagecolorallocate($this->img, 50, 150, 50); $this->color['axis_line'] = imagecolorallocate($this->img, 50, 100, 50); @@ -976,7 +964,7 @@ class graph $string = mb_convert_encoding($string, 'UTF-8', $this->encoding); } - // New 2014-06-26 Joe Hunt for handling ev. RTL languages + // Handling ev. RTL languages if ($alt) { if ($this->encoding == 'UTF-8' && is_arabic($string)) @@ -1011,10 +999,7 @@ class graph else $size = 12; $y += $size + 3; - //if ($alt) - // $angle = -15; - //else - $angle = 0; + $angle = 0; imagettftext($img, $size, $angle, $x, $y + $alt, $col, $this->fontfile, $string); } diff --git a/reporting/includes/class.pdf.inc b/reporting/includes/class.pdf.inc index 2252c28c..a1e98917 100644 --- a/reporting/includes/class.pdf.inc +++ b/reporting/includes/class.pdf.inc @@ -120,7 +120,6 @@ class Cpdf extends FPDI { $this->FontFamily = 'helvetica'; $this->FontStyle = ''; $this->FontSizePt = 12; -// $this->utf8Bidi(array("")); } diff --git a/reporting/includes/excel_report.inc b/reporting/includes/excel_report.inc index f139ba83..ef387ada 100644 --- a/reporting/includes/excel_report.inc +++ b/reporting/includes/excel_report.inc @@ -84,7 +84,6 @@ class FrontReport extends Spreadsheet_Excel_Writer_Workbook $this->unique_name = uniqid('').".xls"; $this->path = company_path(). '/pdf_files'; $this->Spreadsheet_Excel_Writer_Workbook($this->path."/".$this->unique_name); - //$this->setCountry(48); if ($this->code != "iso-8859-1") $this->setVersion(8); // set biff version to 8 (0x0006 internal) $this->sheet =& $this->addWorksheet($this->worksheetNameGenerator($this->title)); @@ -198,10 +197,7 @@ class FrontReport extends Spreadsheet_Excel_Writer_Workbook { if (!isset($this->formatAmount[$dec])) { - //global $thoseps,$decseps; $dec = (int)$dec; - //$tsep = $thoseps[user_tho_sep()]; - //$dsep = $decseps[user_dec_sep()]; $tsep = ','; $dsep = '.'; $format = "###{$tsep}###{$tsep}###{$tsep}##0"; diff --git a/reporting/includes/pdf_report.inc b/reporting/includes/pdf_report.inc index 9e96bf2c..6b9b45c9 100644 --- a/reporting/includes/pdf_report.inc +++ b/reporting/includes/pdf_report.inc @@ -376,8 +376,6 @@ class FrontReport extends Cpdf */ function SetCommonData($myrow, $branch, $sales_order, $bankaccount, $doctype, $contacts) { -// $this->formData = array_merge($myrow, $branch, $sales_order, -// $bank_account, array('doctype' => $doctype)); $this->formData = array(); $datnames = array( @@ -471,16 +469,6 @@ class FrontReport extends Cpdf $footerCol = $this->leftMargin + PAGE_NUM_WIDTH; $footerRow = $this->bottomMargin - FOOTER_MARGIN; - // Calling this function generates a new PDF page after the first instance -// { -// // TODO: experimenting with line drawing to highlight current period -// $this->SetLineWidth(1); -// $this->LineTo($this->cols[3], 33, $this->cols[3], 534); -// $this->LineTo($this->cols[4], 33, $this->cols[4], 534); -// $this->SetLineWidth(0.1); - -// $this->newPage(); -// } $this->row = $this->pageHeight - $this->topMargin; // Set the color of dividing lines we'll draw @@ -969,9 +957,6 @@ class FrontReport extends Cpdf } // do not use standard filenames or your sensitive company data // are world readable -// if ($email == 1) -// $fname = $dir.'/'.$this->filename; -// else $fname = $dir.'/'.uniqid('').'.pdf'; $this->Output($fname, 'F'); @@ -1059,7 +1044,6 @@ class FrontReport extends Cpdf header('Expires: 0'); header('Cache-Control: must-revalidate, post-check=0, pre-check=0'); header('Pragma: public'); -// $this->Stream(basename($fname)); $this->Stream($this->filename); } } else { // send report to network printer diff --git a/reporting/includes/reporting.inc b/reporting/includes/reporting.inc index 68c443ea..80632db2 100644 --- a/reporting/includes/reporting.inc +++ b/reporting/includes/reporting.inc @@ -118,7 +118,6 @@ function print_document_link($doc_no, $link_text, $link=true, $type_no, break; default: return null; -// default: $ar = array(); } return print_link($link_text, $rep, $ar, "", $icon, $class, $id); diff --git a/reporting/includes/reports_classes.inc b/reporting/includes/reports_classes.inc index 96372d1c..0c32c420 100644 --- a/reporting/includes/reports_classes.inc +++ b/reporting/includes/reports_classes.inc @@ -211,7 +211,7 @@ class BoxReports } } } - else // saved parameters 2010-10-16 Joe Hunt + else // saved parameters $date = $_POST[$name]; $st = ""; if (user_use_date_picker()) @@ -423,7 +423,6 @@ class BoxReports $tag_type = TAG_ACCOUNT; else $tag_type = TAG_DIMENSION; - //return tag_list($name, 5, $tag_type, true, false, _("No tags")); return tag_list($name, 5, $tag_type, true); } diff --git a/reporting/rep101.php b/reporting/rep101.php index a7d1c1f3..a6866837 100644 --- a/reporting/rep101.php +++ b/reporting/rep101.php @@ -27,7 +27,6 @@ include_once($path_to_root . "/sales/includes/db/customers_db.inc"); //---------------------------------------------------------------------------------------------------- -// trial_inquiry_controls(); print_customer_balances(); function get_open_balance($debtorno, $to) diff --git a/reporting/rep102.php b/reporting/rep102.php index 95d267c3..e407c6d7 100644 --- a/reporting/rep102.php +++ b/reporting/rep102.php @@ -67,14 +67,14 @@ function print_aged_customer_analysis() { global $path_to_root, $systypes_array, $SysPrefs; - $to = $_POST['PARAM_0']; - $fromcust = $_POST['PARAM_1']; - $currency = $_POST['PARAM_2']; - $show_all = $_POST['PARAM_3']; + $to = $_POST['PARAM_0']; + $fromcust = $_POST['PARAM_1']; + $currency = $_POST['PARAM_2']; + $show_all = $_POST['PARAM_3']; $summaryOnly = $_POST['PARAM_4']; - $no_zeros = $_POST['PARAM_5']; - $graphics = $_POST['PARAM_6']; - $comments = $_POST['PARAM_7']; + $no_zeros = $_POST['PARAM_5']; + $graphics = $_POST['PARAM_6']; + $comments = $_POST['PARAM_7']; $orientation = $_POST['PARAM_8']; $destination = $_POST['PARAM_9']; if ($destination) diff --git a/reporting/rep103.php b/reporting/rep103.php index 9f1e797b..a93d5606 100644 --- a/reporting/rep103.php +++ b/reporting/rep103.php @@ -209,7 +209,7 @@ function print_customer_details_listing() $rep->NewLine(); } $rep->NewLine(); - // Here starts the new report lines 2010-11-02 Joe Hunt + // Here starts the new report lines $contacts = get_contacts_for_branch($myrow['branch_code']); $rep->TextCol(0, 1, $myrow['name']); $rep->TextCol(1, 2, _('Price List') . ": " . $myrow['sales_type']); @@ -278,35 +278,6 @@ function print_customer_details_listing() if ($newrow != 0 && $newrow < $rep->row) $rep->row = $newrow; $rep->NewLine(); - /* - $rep->TextCol(0, 1, $myrow['name']); - $adr = Explode("\n", $myrow['address']); - $count1 = count($adr); - for ($i = 0; $i < $count1; $i++) - $rep->TextCol(0, 1, $adr[$i], 0, ($i + 1) * $rep->lineHeight); - $count1++; - $rep->TextCol(1, 2, _('Price List') . ": " . $myrow['sales_type']); - if ($more != 0.0 || $less != 0.0) - $rep->TextCol(1, 2, _('Turnover') . ": " . number_format2($turnover, $dec), 0, $rep->lineHeight); - $rep->TextCol(2, 3, $myrow['br_name']); - - $contacts = get_branch_contacts($myrow['branch_code']); - if (isset($contacts[0])) - { - $rep->TextCol(2, 3, $contacts[0]['name'], 0, $rep->lineHeight); - $rep->TextCol(2, 3, _('Ph') . ": " . $contacts[0]['phone'], 0, 2 * $rep->lineHeight); - $rep->TextCol(2, 3, _('Fax') . ": " . $contacts[0]['fax'], 0, 3 * $rep->lineHeight); - } - $adr = Explode("\n", $myrow['br_address']); - $count2 = count($adr); - for ($i = 0; $i < $count2; $i++) - $rep->TextCol(3, 4, $adr[$i], 0, ($i + 1) * $rep->lineHeight); - //$rep->TextCol(3, 4, $myrow['email'], 0, ($count2 + 1) * $rep->lineHeight); - $count2++; - $count1 = Max($count1, $count2); - $count1 = Max($count1, 4); - $rep->NewLine($count3); - */ $rep->Line($rep->row + 8); $rep->NewLine(0, 3); } diff --git a/reporting/rep107.php b/reporting/rep107.php index a125995d..4de23cc4 100644 --- a/reporting/rep107.php +++ b/reporting/rep107.php @@ -195,7 +195,6 @@ function print_invoices() if (isset($prepayments)) { // Partial invoices table - //$rep->NewLine(); $rep->TextCol(0, 3,_("Prepayments invoiced to this order up to day:")); $rep->TextCol(0, 3, str_pad('', 150, '_')); $rep->cols[2] -= 20; diff --git a/reporting/rep109.php b/reporting/rep109.php index dde98667..53df06f6 100644 --- a/reporting/rep109.php +++ b/reporting/rep109.php @@ -138,7 +138,6 @@ function print_sales_orders() $rep->TextCol(6, 7, $DisplayNet, -2); } $rep->row = $newrow; - //$rep->NewLine(1); if ($rep->row < $rep->bottomMargin + (15 * $rep->lineHeight)) $rep->NewPage(); } diff --git a/reporting/rep111.php b/reporting/rep111.php index 45c5ab99..ecf9fc19 100644 --- a/reporting/rep111.php +++ b/reporting/rep111.php @@ -128,7 +128,6 @@ function print_sales_quotations() $image = company_path(). "/images/" . item_img_name($myrow2['stk_code']) . ".jpg"; if (file_exists($image)) { - //$rep->NewLine(); if ($rep->row - $SysPrefs->pic_height < $rep->bottomMargin) $rep->NewPage(); $rep->AddImage($image, $rep->cols[1], $rep->row - $SysPrefs->pic_height, 0, $SysPrefs->pic_height); @@ -136,7 +135,6 @@ function print_sales_quotations() $rep->NewLine(); } } - //$rep->NewLine(1); if ($rep->row < $rep->bottomMargin + (15 * $rep->lineHeight)) $rep->NewPage(); } diff --git a/reporting/rep113.php b/reporting/rep113.php index acf855c4..b1f93190 100644 --- a/reporting/rep113.php +++ b/reporting/rep113.php @@ -70,141 +70,140 @@ function print_credits() for ($i = $from; $i <= $to; $i++) { - if (!exists_customer_trans(ST_CUSTCREDIT, $i)) + if (!exists_customer_trans(ST_CUSTCREDIT, $i)) + continue; + $sign = -1; + $myrow = get_customer_trans($i, ST_CUSTCREDIT); + if ($currency != ALL_TEXT && $myrow['curr_code'] != $currency) { + continue; + } + $baccount = get_default_bank_account($myrow['curr_code']); + $params['bankaccount'] = $baccount['id']; + + $branch = get_branch($myrow["branch_code"]); + $branch['disable_branch'] = $paylink; // helper + $sales_order = null; + if ($email == 1) + { + $rep = new FrontReport("", "", user_pagesize(), 9, $orientation); + $rep->title = _('CREDIT NOTE'); + $rep->filename = "CreditNote" . $myrow['reference'] . ".pdf"; + } + $rep->currency = $cur; + $rep->Font(); + $rep->Info($params, $cols, null, $aligns); + + $contacts = get_branch_contacts($branch['branch_code'], 'invoice', $branch['debtor_no'], true); + $rep->SetCommonData($myrow, $branch, $sales_order, $baccount, ST_CUSTCREDIT, $contacts); + $rep->SetHeaderType('Header2'); + $rep->NewPage(); + + $result = get_customer_trans_details(ST_CUSTCREDIT, $i); + $SubTotal = 0; + while ($myrow2=db_fetch($result)) + { + if ($myrow2["quantity"] == 0) continue; - $sign = -1; - $myrow = get_customer_trans($i, ST_CUSTCREDIT); - if ($currency != ALL_TEXT && $myrow['curr_code'] != $currency) { + + $Net = round2($sign * ((1 - $myrow2["discount_percent"]) * $myrow2["unit_price"] * $myrow2["quantity"]), + user_price_dec()); + $SubTotal += $Net; + $DisplayPrice = number_format2($myrow2["unit_price"],$dec); + $DisplayQty = number_format2($sign*$myrow2["quantity"],get_qty_dec($myrow2['stock_id'])); + $DisplayNet = number_format2($Net,$dec); + if ($myrow2["discount_percent"]==0) + $DisplayDiscount =""; + else + $DisplayDiscount = number_format2($myrow2["discount_percent"]*100,user_percent_dec()) . "%"; + $rep->TextCol(0, 1, $myrow2['stock_id'], -2); + $oldrow = $rep->row; + $rep->TextColLines(1, 2, $myrow2['StockDescription'], -2); + $newrow = $rep->row; + $rep->row = $oldrow; + $rep->TextCol(2, 3, $DisplayQty, -2); + $rep->TextCol(3, 4, $myrow2['units'], -2); + $rep->TextCol(4, 5, $DisplayPrice, -2); + $rep->TextCol(5, 6, $DisplayDiscount, -2); + $rep->TextCol(6, 7, $DisplayNet, -2); + $rep->row = $newrow; + if ($rep->row < $rep->bottomMargin + (15 * $rep->lineHeight)) + $rep->NewPage(); + } + + $memo = get_comments_string(ST_CUSTCREDIT, $i); + if ($memo != "") + { + $rep->NewLine(); + $rep->TextColLines(1, 5, $memo, -2); + } + + $DisplaySubTot = number_format2($SubTotal,$dec); + $DisplayFreight = number_format2($sign*$myrow["ov_freight"],$dec); + + $rep->row = $rep->bottomMargin + (15 * $rep->lineHeight); + $doctype = ST_CUSTCREDIT; + + $rep->TextCol(3, 6, _("Sub-total"), -2); + $rep->TextCol(6, 7, $DisplaySubTot, -2); + $rep->NewLine(); + $rep->TextCol(3, 6, _("Shipping"), -2); + $rep->TextCol(6, 7, $DisplayFreight, -2); + $rep->NewLine(); + $tax_items = get_trans_tax_details(ST_CUSTCREDIT, $i); + $first = true; + while ($tax_item = db_fetch($tax_items)) + { + if ($tax_item['amount'] == 0) continue; - } - $baccount = get_default_bank_account($myrow['curr_code']); - $params['bankaccount'] = $baccount['id']; + $DisplayTax = number_format2($sign*$tax_item['amount'], $dec); - $branch = get_branch($myrow["branch_code"]); - $branch['disable_branch'] = $paylink; // helper - $sales_order = null; - if ($email == 1) - { - $rep = new FrontReport("", "", user_pagesize(), 9, $orientation); - $rep->title = _('CREDIT NOTE'); - $rep->filename = "CreditNote" . $myrow['reference'] . ".pdf"; - } - $rep->currency = $cur; - $rep->Font(); - $rep->Info($params, $cols, null, $aligns); - - $contacts = get_branch_contacts($branch['branch_code'], 'invoice', $branch['debtor_no'], true); - $rep->SetCommonData($myrow, $branch, $sales_order, $baccount, ST_CUSTCREDIT, $contacts); - $rep->SetHeaderType('Header2'); - $rep->NewPage(); - - $result = get_customer_trans_details(ST_CUSTCREDIT, $i); - $SubTotal = 0; - while ($myrow2=db_fetch($result)) - { - if ($myrow2["quantity"] == 0) - continue; - - $Net = round2($sign * ((1 - $myrow2["discount_percent"]) * $myrow2["unit_price"] * $myrow2["quantity"]), - user_price_dec()); - $SubTotal += $Net; - $DisplayPrice = number_format2($myrow2["unit_price"],$dec); - $DisplayQty = number_format2($sign*$myrow2["quantity"],get_qty_dec($myrow2['stock_id'])); - $DisplayNet = number_format2($Net,$dec); - if ($myrow2["discount_percent"]==0) - $DisplayDiscount =""; - else - $DisplayDiscount = number_format2($myrow2["discount_percent"]*100,user_percent_dec()) . "%"; - $rep->TextCol(0, 1, $myrow2['stock_id'], -2); - $oldrow = $rep->row; - $rep->TextColLines(1, 2, $myrow2['StockDescription'], -2); - $newrow = $rep->row; - $rep->row = $oldrow; - $rep->TextCol(2, 3, $DisplayQty, -2); - $rep->TextCol(3, 4, $myrow2['units'], -2); - $rep->TextCol(4, 5, $DisplayPrice, -2); - $rep->TextCol(5, 6, $DisplayDiscount, -2); - $rep->TextCol(6, 7, $DisplayNet, -2); - $rep->row = $newrow; - //$rep->NewLine(1); - if ($rep->row < $rep->bottomMargin + (15 * $rep->lineHeight)) - $rep->NewPage(); - } + if ($SysPrefs->suppress_tax_rates() == 1) + $tax_type_name = $tax_item['tax_type_name']; + else + $tax_type_name = $tax_item['tax_type_name']." (".$tax_item['rate']."%) "; - $memo = get_comments_string(ST_CUSTCREDIT, $i); - if ($memo != "") + if ($myrow['tax_included']) { - $rep->NewLine(); - $rep->TextColLines(1, 5, $memo, -2); - } - - $DisplaySubTot = number_format2($SubTotal,$dec); - $DisplayFreight = number_format2($sign*$myrow["ov_freight"],$dec); - - $rep->row = $rep->bottomMargin + (15 * $rep->lineHeight); - $doctype = ST_CUSTCREDIT; - - $rep->TextCol(3, 6, _("Sub-total"), -2); - $rep->TextCol(6, 7, $DisplaySubTot, -2); - $rep->NewLine(); - $rep->TextCol(3, 6, _("Shipping"), -2); - $rep->TextCol(6, 7, $DisplayFreight, -2); - $rep->NewLine(); - $tax_items = get_trans_tax_details(ST_CUSTCREDIT, $i); - $first = true; - while ($tax_item = db_fetch($tax_items)) - { - if ($tax_item['amount'] == 0) - continue; - $DisplayTax = number_format2($sign*$tax_item['amount'], $dec); - - if ($SysPrefs->suppress_tax_rates() == 1) - $tax_type_name = $tax_item['tax_type_name']; - else - $tax_type_name = $tax_item['tax_type_name']." (".$tax_item['rate']."%) "; - - if ($myrow['tax_included']) - { - if ($SysPrefs->alternative_tax_include_on_docs() == 1) - { - if ($first) - { - $rep->TextCol(3, 6, _("Total Tax Excluded"), -2); - $rep->TextCol(6, 7, number_format2($sign*$tax_item['net_amount'], $dec), -2); - $rep->NewLine(); - } - $rep->TextCol(3, 6, $tax_type_name, -2); - $rep->TextCol(6, 7, $DisplayTax, -2); - $first = false; - } - else - $rep->TextCol(3, 7, _("Included") . " " . $tax_type_name . _("Amount") . ": " . $DisplayTax, -2); - } - else - { + if ($SysPrefs->alternative_tax_include_on_docs() == 1) + { + if ($first) + { + $rep->TextCol(3, 6, _("Total Tax Excluded"), -2); + $rep->TextCol(6, 7, number_format2($sign*$tax_item['net_amount'], $dec), -2); + $rep->NewLine(); + } $rep->TextCol(3, 6, $tax_type_name, -2); $rep->TextCol(6, 7, $DisplayTax, -2); + $first = false; } - $rep->NewLine(); - } - $rep->NewLine(); - $DisplayTotal = number_format2($sign*($myrow["ov_freight"] + $myrow["ov_gst"] + - $myrow["ov_amount"]+$myrow["ov_freight_tax"]),$dec); - $rep->Font('bold'); - $rep->TextCol(3, 6, _("TOTAL CREDIT"), - 2); - $rep->TextCol(6, 7, $DisplayTotal, -2); - $words = price_in_words($myrow['Total'], ST_CUSTCREDIT); - if ($words != "") - { - $rep->NewLine(1); - $rep->TextCol(1, 7, $myrow['curr_code'] . ": " . $words, - 2); - } - $rep->Font(); - if ($email == 1) + else + $rep->TextCol(3, 7, _("Included") . " " . $tax_type_name . _("Amount") . ": " . $DisplayTax, -2); + } + else { - $myrow['dimension_id'] = $paylink; // helper for pmt link - $rep->End($email); + $rep->TextCol(3, 6, $tax_type_name, -2); + $rep->TextCol(6, 7, $DisplayTax, -2); } + $rep->NewLine(); + } + $rep->NewLine(); + $DisplayTotal = number_format2($sign*($myrow["ov_freight"] + $myrow["ov_gst"] + + $myrow["ov_amount"]+$myrow["ov_freight_tax"]),$dec); + $rep->Font('bold'); + $rep->TextCol(3, 6, _("TOTAL CREDIT"), - 2); + $rep->TextCol(6, 7, $DisplayTotal, -2); + $words = price_in_words($myrow['Total'], ST_CUSTCREDIT); + if ($words != "") + { + $rep->NewLine(1); + $rep->TextCol(1, 7, $myrow['curr_code'] . ": " . $words, - 2); + } + $rep->Font(); + if ($email == 1) + { + $myrow['dimension_id'] = $paylink; // helper for pmt link + $rep->End($email); + } } if ($email == 0) $rep->End(); diff --git a/reporting/rep201.php b/reporting/rep201.php index 0a818ad5..e3180acd 100644 --- a/reporting/rep201.php +++ b/reporting/rep201.php @@ -68,15 +68,15 @@ function getTransactions($supplier_id, $from, $to) function print_supplier_balances() { - global $path_to_root, $systypes_array; - - $from = $_POST['PARAM_0']; - $to = $_POST['PARAM_1']; - $fromsupp = $_POST['PARAM_2']; - $show_balance = $_POST['PARAM_3']; - $currency = $_POST['PARAM_4']; - $no_zeros = $_POST['PARAM_5']; - $comments = $_POST['PARAM_6']; + global $path_to_root, $systypes_array; + + $from = $_POST['PARAM_0']; + $to = $_POST['PARAM_1']; + $fromsupp = $_POST['PARAM_2']; + $show_balance = $_POST['PARAM_3']; + $currency = $_POST['PARAM_4']; + $no_zeros = $_POST['PARAM_5']; + $comments = $_POST['PARAM_6']; $orientation = $_POST['PARAM_7']; $destination = $_POST['PARAM_8']; if ($destination) @@ -115,7 +115,7 @@ function print_supplier_balances() 1 => array('text' => _('Period'), 'from' => $from, 'to' => $to), 2 => array('text' => _('Supplier'), 'from' => $supp, 'to' => ''), 3 => array( 'text' => _('Currency'),'from' => $currency, 'to' => ''), - 4 => array('text' => _('Suppress Zeros'), 'from' => $nozeros, 'to' => '')); + 4 => array('text' => _('Suppress Zeros'), 'from' => $nozeros, 'to' => '')); $rep = new FrontReport(_('Supplier Balances'), "SupplierBalances", user_pagesize(), 9, $orientation); if ($orientation == 'L') diff --git a/reporting/rep203.php b/reporting/rep203.php index 1422ce25..daa5d8a7 100644 --- a/reporting/rep203.php +++ b/reporting/rep203.php @@ -50,13 +50,13 @@ function getTransactions($supplier, $date) function print_payment_report() { - global $path_to_root, $systypes_array; + global $path_to_root, $systypes_array; - $to = $_POST['PARAM_0']; - $fromsupp = $_POST['PARAM_1']; - $currency = $_POST['PARAM_2']; - $no_zeros = $_POST['PARAM_3']; - $comments = $_POST['PARAM_4']; + $to = $_POST['PARAM_0']; + $fromsupp = $_POST['PARAM_1']; + $currency = $_POST['PARAM_2']; + $no_zeros = $_POST['PARAM_3']; + $comments = $_POST['PARAM_4']; $orientation = $_POST['PARAM_5']; $destination = $_POST['PARAM_6']; if ($destination) @@ -94,7 +94,7 @@ function print_payment_report() 1 => array('text' => _('End Date'), 'from' => $to, 'to' => ''), 2 => array('text' => _('Supplier'), 'from' => $from, 'to' => ''), 3 => array( 'text' => _('Currency'),'from' => $currency, 'to' => ''), - 4 => array('text' => _('Suppress Zeros'), 'from' => $nozeros, 'to' => '')); + 4 => array('text' => _('Suppress Zeros'), 'from' => $nozeros, 'to' => '')); $rep = new FrontReport(_('Payment Report'), "PaymentReport", user_pagesize(), 9, $orientation); if ($orientation == 'L') diff --git a/reporting/rep205.php b/reporting/rep205.php index 5de3fd4a..4b27c182 100644 --- a/reporting/rep205.php +++ b/reporting/rep205.php @@ -124,7 +124,7 @@ function print_supplier_details_listing() { $newrow = 0; $rep->NewLine(); - // Here starts the new report lines 2013-01-28 Joe Hunt + // Here starts the new report lines $contacts = get_supplier_contacts($myrow['supplier_id']); $rep->TextCol(0, 1, $myrow['supp_name']); $rep->TextCol(1, 2, _('Tax_Id') . ": " . $myrow['gst_no']); diff --git a/reporting/rep303.php b/reporting/rep303.php index 231e33d5..7d8984db 100644 --- a/reporting/rep303.php +++ b/reporting/rep303.php @@ -72,14 +72,14 @@ function print_stock_check() { global $path_to_root, $SysPrefs; - $category = $_POST['PARAM_0']; - $location = $_POST['PARAM_1']; - $pictures = $_POST['PARAM_2']; - $check = $_POST['PARAM_3']; - $shortage = $_POST['PARAM_4']; - $no_zeros = $_POST['PARAM_5']; - $like = $_POST['PARAM_6']; - $comments = $_POST['PARAM_7']; + $category = $_POST['PARAM_0']; + $location = $_POST['PARAM_1']; + $pictures = $_POST['PARAM_2']; + $check = $_POST['PARAM_3']; + $shortage = $_POST['PARAM_4']; + $no_zeros = $_POST['PARAM_5']; + $like = $_POST['PARAM_6']; + $comments = $_POST['PARAM_7']; $orientation = $_POST['PARAM_8']; $destination = $_POST['PARAM_9']; @@ -132,12 +132,7 @@ function print_stock_check() 1 => array('text' => _('Category'), 'from' => $cat, 'to' => ''), 2 => array('text' => _('Location'), 'from' => $loc, 'to' => ''), 3 => array('text' => _('Only Shortage'), 'from' => $short, 'to' => ''), - 4 => array('text' => _('Suppress Zeros'), 'from' => $nozeros, 'to' => '')); - - if ($pictures) - $user_comp = user_company(); - else - $user_comp = ""; + 4 => array('text' => _('Suppress Zeros'), 'from' => $nozeros, 'to' => '')); $rep = new FrontReport(_('Stock Check Sheets'), "StockCheckSheet", user_pagesize(), 9, $orientation); if ($orientation == 'L') diff --git a/reporting/rep307.php b/reporting/rep307.php index 214b5704..19db4099 100644 --- a/reporting/rep307.php +++ b/reporting/rep307.php @@ -104,14 +104,11 @@ function inventory_movements() else $cat = get_category_name($category); -// if ($location == ALL_TEXT) -// $location = ''; if ($location == '') $loc = _('All'); else $loc = get_location_name($location); - //$cols = array(0, 100, 300, 365, 440, 540, 640, 715); $cols = array(0, 60, 220, 240, 310, 380, 450, 520); $headers = array(_('Category'), _('Description'), _('UOM'), _('Opening'), _('Quantity In'), _('Quantity Out'), _('Balance')); diff --git a/reporting/rep309.php b/reporting/rep309.php index a306a433..b9c90bc4 100644 --- a/reporting/rep309.php +++ b/reporting/rep309.php @@ -113,8 +113,6 @@ function print_inventory_sales() $res = getTransactions($category, $from, $to); $total = $grandtotal = 0.0; - $total1 = $grandtotal1 = 0.0; - $total2 = $grandtotal2 = 0.0; $catt = ''; while ($trans=db_fetch($res)) { @@ -128,7 +126,7 @@ function print_inventory_sales() $rep->Line($rep->row - 2); $rep->NewLine(); $rep->NewLine(); - $total = $total1 = $total2 = 0.0; + $total = 0.0; } $rep->TextCol(0, 1, $trans['category_id']); $rep->TextCol(1, 7, $trans['cat_description']); diff --git a/reporting/rep401.php b/reporting/rep401.php index faab857a..ddb9692f 100644 --- a/reporting/rep401.php +++ b/reporting/rep401.php @@ -105,8 +105,6 @@ function print_bill_of_material() $dec = get_qty_dec($trans['component']); $rep->TextCol(0, 1, $trans['component']); $rep->TextCol(1, 2, $trans['CompDescription']); - //$rep->TextCol(2, 3, $trans['loc_code']); - //$rep->TextCol(3, 4, $trans['workcentre_added']); $wc = get_work_centre($trans['workcentre_added']); $rep->TextCol(2, 3, get_location_name($trans['loc_code'])); $rep->TextCol(3, 4, $wc['name']); diff --git a/reporting/rep409.php b/reporting/rep409.php index 73a38481..8ad60606 100644 --- a/reporting/rep409.php +++ b/reporting/rep409.php @@ -28,7 +28,7 @@ print_workorders(); function print_workorders() { - global $path_to_root, $SysPrefs, $dflt_lang; + global $path_to_root, $dflt_lang; include_once($path_to_root . "/reporting/includes/pdf_report.inc"); @@ -65,7 +65,6 @@ function print_workorders() $myrow = get_work_order($i); if ($myrow === false) continue; - $date_ = sql2date($myrow["date_"]); if ($email == 1) { $rep = new FrontReport("", "", user_pagesize(), 9, $orientation); @@ -86,7 +85,6 @@ function print_workorders() $result = get_wo_requirements($i); $rep->TextCol(0, 5,_("Work Order Requirements"), -2); $rep->NewLine(2); - $has_marked = false; while ($myrow2=db_fetch($result)) { $rep->TextCol(0, 1, $myrow2['stock_id'], -2); diff --git a/reporting/rep601.php b/reporting/rep601.php index ba630465..505ac4d3 100644 --- a/reporting/rep601.php +++ b/reporting/rep601.php @@ -43,11 +43,11 @@ function get_bank_transactions($from, $to, $account) { $from = date2sql($from); $to = date2sql($to); - $sql = "SELECT ".TB_PREF."bank_trans.* FROM ".TB_PREF."bank_trans - WHERE ".TB_PREF."bank_trans.bank_act = '$account' + $sql = "SELECT * FROM ".TB_PREF."bank_trans + WHERE bank_act = '$account' AND trans_date >= '$from' AND trans_date <= '$to' - ORDER BY trans_date,".TB_PREF."bank_trans.id"; + ORDER BY trans_date, id"; return db_query($sql,"The transactions for '$account' could not be retrieved"); } diff --git a/reporting/rep701.php b/reporting/rep701.php index 78dc2c7d..a110ea21 100644 --- a/reporting/rep701.php +++ b/reporting/rep701.php @@ -104,7 +104,6 @@ function print_Chart_of_Accounts() include_once($path_to_root . "/reporting/includes/pdf_report.inc"); $orientation = ($orientation ? 'L' : 'P'); - $dec = 0; $cols = array(0, 50, 300, 425, 500); diff --git a/reporting/rep704.php b/reporting/rep704.php index 1703ed0a..65ea8d09 100644 --- a/reporting/rep704.php +++ b/reporting/rep704.php @@ -49,7 +49,7 @@ function print_GL_transactions() $orientation = $_POST['PARAM_7']; $destination = $_POST['PARAM_8']; } - else if ($dim == 1) + elseif ($dim == 1) { $dimension = $_POST['PARAM_4']; $comments = $_POST['PARAM_5']; @@ -71,7 +71,6 @@ function print_GL_transactions() $rep = new FrontReport(_('GL Account Transactions'), "GLAccountTransactions", user_pagesize(), 9, $orientation); $dec = user_price_dec(); - //$cols = array(0, 80, 100, 150, 210, 280, 340, 400, 450, 510, 570); $cols = array(0, 65, 105, 125, 175, 230, 290, 345, 405, 465, 525); //------------0--1---2---3----4----5----6----7----8----9----10------- //-----------------------dim1-dim2----------------------------------- @@ -99,7 +98,7 @@ function print_GL_transactions() 4 => array('text' => _('Dimension')." 2", 'from' => get_dimension_string($dimension2), 'to' => '')); } - else if ($dim == 1) + elseif ($dim == 1) { $params = array( 0 => $comments, 1 => array('text' => _('Period'), 'from' => $from, 'to' => $to), diff --git a/reporting/rep705.php b/reporting/rep705.php index c9b3fd1a..58c58bec 100644 --- a/reporting/rep705.php +++ b/reporting/rep705.php @@ -178,7 +178,7 @@ function print_annual_expense_breakdown() $orientation = $_POST['PARAM_5']; $destination = $_POST['PARAM_6']; } - else if ($dim == 1) + elseif ($dim == 1) { $year = $_POST['PARAM_0']; $dimension = $_POST['PARAM_1']; @@ -202,13 +202,10 @@ function print_annual_expense_breakdown() $orientation = ($orientation ? 'L' : 'P'); $dec = 1; - //$pdec = user_percent_dec(); $cols = array(0, 40, 150, 180, 210, 240, 270, 300, 330, 360, 390, 420, 450, 480, 510); //------------0--1---2----3----4----5----6----7----8----10---11---12---13---14---15- - //$yr = date('Y'); - //$mo = date('m'): // from now $sql = "SELECT begin, end, YEAR(end) AS yr, MONTH(end) AS mo FROM ".TB_PREF."fiscal_year WHERE id=".db_escape($year); $result = db_query($sql, "could not get fiscal year"); @@ -254,7 +251,7 @@ function print_annual_expense_breakdown() 5 => array('text' => _('Info'), 'from' => _('Amounts in thousands'), 'to' => '')); } - else if ($dim == 1) + elseif ($dim == 1) { $params = array( 0 => $comments, 1 => array('text' => _("Year"), diff --git a/reporting/rep706.php b/reporting/rep706.php index 07585945..1bcd5a02 100644 --- a/reporting/rep706.php +++ b/reporting/rep706.php @@ -145,7 +145,7 @@ function print_balance_sheet() $orientation = $_POST['PARAM_8']; $destination = $_POST['PARAM_9']; } - else if ($dim == 1) + elseif ($dim == 1) { $dimension = $_POST['PARAM_2']; $tags = (isset($_POST['PARAM_3']) ? $_POST['PARAM_3'] : -1); @@ -197,7 +197,7 @@ function print_balance_sheet() 'from' => get_dimension_string($dimension2), 'to' => ''), 4 => array('text' => _('Tags'), 'from' => get_tag_names($tags), 'to' => '')); } - else if ($dim == 1) + elseif ($dim == 1) { $params = array( 0 => $comments, 1 => array('text' => _('Period'),'from' => $from, 'to' => $to), diff --git a/reporting/rep707.php b/reporting/rep707.php index a0373b52..7e526b5b 100644 --- a/reporting/rep707.php +++ b/reporting/rep707.php @@ -169,7 +169,7 @@ function print_profit_and_loss_statement() $orientation = $_POST['PARAM_9']; $destination = $_POST['PARAM_10']; } - else if ($dim == 1) + elseif ($dim == 1) { $dimension = $_POST['PARAM_3']; $tags = (isset($_POST['PARAM_4']) ? $_POST['PARAM_4'] : -1); @@ -221,7 +221,7 @@ function print_profit_and_loss_statement() 'from' => get_dimension_string($dimension2), 'to' => ''), 4 => array('text' => _('Tags'), 'from' => get_tag_names($tags), 'to' => '')); } - else if ($dim == 1) + elseif ($dim == 1) { $params = array( 0 => $comments, 1 => array('text' => _('Period'),'from' => $from, 'to' => $to), diff --git a/reporting/rep708.php b/reporting/rep708.php index a7a0df3a..1da9ce2a 100644 --- a/reporting/rep708.php +++ b/reporting/rep708.php @@ -57,7 +57,7 @@ function display_type ($type, $typename, &$dec, &$rep, $from, $to, $zero, $balan // FA doesn't really clear the closed year, therefore the brought forward balance includes all the transactions from the past, even though the balance is null. // If we want to remove the balanced part for the past years, this option removes the common part from from the prev and tot figures. - if (@$SysPregs->clear_trial_balance_opening) + if (@$SysPrefs->clear_trial_balance_opening) { $open = get_balance($account["account_code"], $dimension, $dimension2, $begin, $begin, false, true); $offset = min($open['debit'], $open['credit']); @@ -203,7 +203,7 @@ function print_trial_balance() 3 => array('text' => _('Dimension')." 2", 'from' => get_dimension_string($dimension2), 'to' => '')); } - else if ($dim == 1) + elseif ($dim == 1) { $params = array( 0 => $comments, 1 => array('text' => _('Period'),'from' => $from, 'to' => $to), diff --git a/reporting/rep709.php b/reporting/rep709.php index 5c12ac9d..9bfdc0a7 100644 --- a/reporting/rep709.php +++ b/reporting/rep709.php @@ -77,7 +77,7 @@ function getTaxInfo($id) function print_tax_report() { - global $path_to_root, $Hooks, $systypes_array; + global $path_to_root, $systypes_array; $from = $_POST['PARAM_0']; $to = $_POST['PARAM_1']; @@ -191,9 +191,6 @@ function print_tax_report() $rep->Info($params, $cols2, $headers2, $aligns2); - //for ($i = 0; $i < count($cols2); $i++) - // $rep->cols[$i] = $rep->leftMargin + $cols2[$i]; - $rep->headers = $headers2; $rep->aligns = $aligns2; $rep->NewPage(); diff --git a/reporting/reports_main.php b/reporting/reports_main.php index 2435cc69..b5a89fce 100644 --- a/reporting/reports_main.php +++ b/reporting/reports_main.php @@ -309,9 +309,6 @@ if ($dim > 0) _('Comments') => 'TEXTBOX', _('Orientation') => 'ORIENTATION', _('Destination') => 'DESTINATION')); - //$reports->addReport(_('Dimensions'),502, _('Dimension Details'), - //array( _('Dimension'),'DIMENSIONS'), - // _('Comments'),'TEXTBOX'))); } $reports->addReportClass(_('Banking'), RC_BANKING); $reports->addReport(RC_BANKING, 601, _('Bank &Statement'), @@ -342,8 +339,6 @@ $reports->addReport(RC_GL, 702, _('List of &Journal Entries'), _('Comments') => 'TEXTBOX', _('Orientation') => 'ORIENTATION', _('Destination') => 'DESTINATION')); -//$reports->addReport(RC_GL, 703, _('GL Account Group Summary'), -// array( _('Comments'),'TEXTBOX'))); if ($dim == 2) { @@ -399,7 +394,7 @@ if ($dim == 2) _('Orientation') => 'ORIENTATION', _('Destination') => 'DESTINATION')); } -else if ($dim == 1) +elseif ($dim == 1) { $reports->addReport(RC_GL, 704, _('GL Account &Transactions'), array( _('Start Date') => 'DATEBEGINM', diff --git a/sales/allocations/customer_allocation_main.php b/sales/allocations/customer_allocation_main.php index 766f6312..9c60415e 100644 --- a/sales/allocations/customer_allocation_main.php +++ b/sales/allocations/customer_allocation_main.php @@ -24,37 +24,31 @@ page(_($help_context = "Customer Allocations"), false, false, "", $js); //-------------------------------------------------------------------------------- start_form(); - /* show all outstanding receipts and credits to be allocated */ +/* show all outstanding receipts and credits to be allocated */ - if (!isset($_POST['customer_id'])) - $_POST['customer_id'] = get_global_customer(); +if (!isset($_POST['customer_id'])) + $_POST['customer_id'] = get_global_customer(); - echo "
" . _("Select a customer: ") . "  "; - echo customer_list('customer_id', $_POST['customer_id'], true, true); - echo "
"; - check(_("Show Settled Items:"), 'ShowSettled', null, true); - echo "


"; +echo "
" . _("Select a customer: ") . "  "; +echo customer_list('customer_id', $_POST['customer_id'], true, true); +echo "
"; +check(_("Show Settled Items:"), 'ShowSettled', null, true); +echo "


"; - set_global_customer($_POST['customer_id']); +set_global_customer($_POST['customer_id']); - if (isset($_POST['customer_id']) && ($_POST['customer_id'] == ALL_TEXT)) - { - unset($_POST['customer_id']); - } - - /*if (isset($_POST['customer_id'])) { - $custCurr = get_customer_currency($_POST['customer_id']); - if (!is_company_currency($custCurr)) - echo _("Customer Currency:") . $custCurr; - }*/ +if (isset($_POST['customer_id']) && ($_POST['customer_id'] == ALL_TEXT)) +{ + unset($_POST['customer_id']); +} - $settled = false; - if (check_value('ShowSettled')) - $settled = true; +$settled = false; +if (check_value('ShowSettled')) + $settled = true; - $customer_id = null; - if (isset($_POST['customer_id'])) - $customer_id = $_POST['customer_id']; +$customer_id = null; +if (isset($_POST['customer_id'])) + $customer_id = $_POST['customer_id']; //-------------------------------------------------------------------------------- function systype_name($dummy, $type) diff --git a/sales/create_recurrent_invoices.php b/sales/create_recurrent_invoices.php index f7704e5a..59ac59b5 100644 --- a/sales/create_recurrent_invoices.php +++ b/sales/create_recurrent_invoices.php @@ -175,17 +175,17 @@ if ($id != -1) $_POST['trans_date'] = $to; start_form(); - start_table(TABLESTYLE, "width=50%"); - label_row(_('Description:'), $myrow["description"]); - label_row(_('Template:'), get_customer_trans_view_str(30, $myrow["order_no"])); - label_row(_('Number of invoices:'), $count); - date_row(_('Invoice date:'), 'trans_date'); - text_row(_('Invoice notice:'), 'memo', sprintf(_("Recurrent Invoice covers period %s - %s."), $from, add_days($to, -1)), - 100, 100); - end_table(); - hidden('from', $from, true); - hidden('to', $to, true); - br(); + start_table(TABLESTYLE, "width=50%"); + label_row(_('Description:'), $myrow["description"]); + label_row(_('Template:'), get_customer_trans_view_str(30, $myrow["order_no"])); + label_row(_('Number of invoices:'), $count); + date_row(_('Invoice date:'), 'trans_date'); + text_row(_('Invoice notice:'), 'memo', sprintf(_("Recurrent Invoice covers period %s - %s."), $from, add_days($to, -1)), + 100, 100); + end_table(); + hidden('from', $from, true); + hidden('to', $to, true); + br(); submit_center_first('confirmed'.$id, _('Create'), _('Create recurrent invoices'), false, ICON_OK); submit_center_last('cancel', _('Cancel'), _('Return to recurrent invoices'), false, ICON_ESCAPE); submit_js_confirm("do_create".$id, sprintf(_("You are about to issue %s invoices.\n Do you want to continue?"), $count)); diff --git a/sales/credit_note_entry.php b/sales/credit_note_entry.php index 98fd6c1e..2a3077b4 100644 --- a/sales/credit_note_entry.php +++ b/sales/credit_note_entry.php @@ -83,9 +83,9 @@ if (isset($_GET['AddedID'])) { //-------------------------------------------------------------------------------- function line_start_focus() { - global $Ajax; - $Ajax->activate('items_table'); - set_focus('_stock_id_edit'); + global $Ajax; + $Ajax->activate('items_table'); + set_focus('_stock_id_edit'); } //----------------------------------------------------------------------------- diff --git a/sales/customer_credit_invoice.php b/sales/customer_credit_invoice.php index bb1445be..af42db4c 100644 --- a/sales/customer_credit_invoice.php +++ b/sales/customer_credit_invoice.php @@ -237,9 +237,6 @@ function display_credit_items() end_row(); start_row(); -// if (!isset($_POST['ref'])) -// $_POST['ref'] = $Refs->get_next(11); - if ($_SESSION['Items']->trans_no==0) { ref_cells(_("Reference"), 'ref', '', null, "class='tableheader2'", false, ST_CUSTCREDIT, array('customer' => $_SESSION['Items']->customer_id, @@ -255,10 +252,6 @@ function display_credit_items() } label_cell(_("Shipping Company"), "class='tableheader2'"); shippers_list_cells(null, 'ShipperID', $_POST['ShipperID']); -// if (!isset($_POST['sales_type_id'])) -// $_POST['sales_type_id'] = $_SESSION['Items']->sales_type; -// label_cell(_("Sales Type"), "class='tableheader2'"); -// sales_types_list_cells(null, 'sales_type_id', $_POST['sales_type_id']); end_row(); end_table(); diff --git a/sales/customer_delivery.php b/sales/customer_delivery.php index fe4ae827..1e29859e 100644 --- a/sales/customer_delivery.php +++ b/sales/customer_delivery.php @@ -248,13 +248,13 @@ function check_quantities() // Update cart delivery quantities/descriptions foreach ($_SESSION['Items']->line_items as $line=>$itm) { if (isset($_POST['Line'.$line])) { - if($_SESSION['Items']->trans_no) { - $min = $itm->qty_done; - $max = $itm->quantity; - } else { - $min = 0; - $max = $itm->quantity - $itm->qty_done; - } + if($_SESSION['Items']->trans_no) { + $min = $itm->qty_done; + $max = $itm->quantity; + } else { + $min = 0; + $max = $itm->quantity - $itm->qty_done; + } if (check_num('Line'.$line, $min, $max)) { $_SESSION['Items']->line_items[$line]->qty_dispatched = @@ -329,9 +329,6 @@ label_cells(_("Currency"), $_SESSION['Items']->customer_currency, "class='tableh end_row(); start_row(); -//if (!isset($_POST['ref'])) -// $_POST['ref'] = $Refs->get_next(ST_CUSTDELIVERY); - if ($_SESSION['Items']->trans_no==0) { ref_cells(_("Reference"), 'ref', '', null, "class='tableheader2'", false, ST_CUSTDELIVERY, array('customer' => $_SESSION['Items']->customer_id, @@ -379,7 +376,7 @@ if (!isset($_POST['due_date']) || !is_date($_POST['due_date'])) { $_POST['due_date'] = get_invoice_duedate($_SESSION['Items']->payment, $_POST['DispatchDate']); } customer_credit_row($_SESSION['Items']->customer_id, $_SESSION['Items']->credit, "class='tableheader2'"); -// 2010-09-03 Joe Hunt + $dim = get_company_pref('use_dimension'); if ($dim > 0) { start_row(); diff --git a/sales/customer_invoice.php b/sales/customer_invoice.php index 10993cc0..9ec89b56 100644 --- a/sales/customer_invoice.php +++ b/sales/customer_invoice.php @@ -108,7 +108,7 @@ if (isset($_GET['AddedID'])) { //----------------------------------------------------------------------------- if ( (isset($_GET['DeliveryNumber']) && ($_GET['DeliveryNumber'] > 0) ) -|| isset($_GET['BatchInvoice'])) { + || isset($_GET['BatchInvoice'])) { processing_start(); @@ -134,14 +134,7 @@ if ( (isset($_GET['DeliveryNumber']) && ($_GET['DeliveryNumber'] > 0) ) } elseif (isset($_GET['ModifyInvoice']) && $_GET['ModifyInvoice'] > 0) { check_is_editable(ST_SALESINVOICE, $_GET['ModifyInvoice']); -/* - if ( get_sales_parent_numbers(ST_SALESINVOICE, $_GET['ModifyInvoice']) == 0) { // 1.xx compatibility hack - echo"

" . _("There are no delivery notes for this invoice.
- Most likely this invoice was created in Front Accounting version prior to 2.0 - and therefore can not be modified.") . "
"; - display_footer_exit(); - } -*/ + processing_start(); $_SESSION['Items'] = new Cart(ST_SALESINVOICE, $_GET['ModifyInvoice']); @@ -152,44 +145,36 @@ if ( (isset($_GET['DeliveryNumber']) && ($_GET['DeliveryNumber'] > 0) ) copy_from_cart(); } elseif (isset($_GET['AllocationNumber']) || isset($_GET['InvoicePrepayments'])) { - check_deferred_income_act(_("You have to set Deferred Income Account in GL Setup to entry prepayment invoices.")); + check_deferred_income_act(_("You have to set Deferred Income Account in GL Setup to entry prepayment invoices.")); - if (isset($_GET['AllocationNumber'])) - { - $payments = array(get_cust_allocation($_GET['AllocationNumber'])); + if (isset($_GET['AllocationNumber'])) + { + $payments = array(get_cust_allocation($_GET['AllocationNumber'])); - if (!$payments || ($payments[0]['trans_type_to'] != ST_SALESORDER)) - { - display_error(_("Please select correct Sales Order Prepayment to be invoiced and try again.")); - display_footer_exit(); - } - $order_no = $payments[0]['trans_no_to']; - } - else { - $order_no = $_GET['InvoicePrepayments']; - $payments = get_payments_for($_GET['InvoicePrepayments'], ST_SALESORDER); + if (!$payments || ($payments[0]['trans_type_to'] != ST_SALESORDER)) + { + display_error(_("Please select correct Sales Order Prepayment to be invoiced and try again.")); + display_footer_exit(); } - processing_start(); - - $_SESSION['Items'] = new Cart(ST_SALESORDER, $order_no, ST_SALESINVOICE); - $_SESSION['Items']->order_no = $order_no; - $_SESSION['Items']->src_docs = array($order_no); - $_SESSION['Items']->trans_no = 0; - $_SESSION['Items']->trans_type = ST_SALESINVOICE; - $_SESSION['Items']->prepayments = $payments; - // prepayment invoice has all line quantities as stated on order. -// foreach($_SESSION['Items']->line_items as &$line) -// { -// $line->src_id = $line_id; -// $line->qty_dispatched = $line->quantity; -// } -// unset($line); - $_SESSION['Items']->update_payments(); - -// $_SESSION['Items']->alloc = $this_amount; - copy_from_cart(); + $order_no = $payments[0]['trans_no_to']; + } + else { + $order_no = $_GET['InvoicePrepayments']; + $payments = get_payments_for($_GET['InvoicePrepayments'], ST_SALESORDER); + } + processing_start(); + + $_SESSION['Items'] = new Cart(ST_SALESORDER, $order_no, ST_SALESINVOICE); + $_SESSION['Items']->order_no = $order_no; + $_SESSION['Items']->src_docs = array($order_no); + $_SESSION['Items']->trans_no = 0; + $_SESSION['Items']->trans_type = ST_SALESINVOICE; + $_SESSION['Items']->prepayments = $payments; + $_SESSION['Items']->update_payments(); + + copy_from_cart(); } - elseif (!processing_active()) { +elseif (!processing_active()) { /* This page can only be called with a delivery for invoicing or invoice no for edit */ display_error(_("This page can only be opened after delivery selection. Please select delivery to invoicing first.")); @@ -250,10 +235,7 @@ function set_delivery_shipping_sum($delivery_notes) foreach($delivery_notes as $delivery_num) { $myrow = get_customer_trans($delivery_num, 13); - //$branch = get_branch($myrow["branch_code"]); - //$sales_order = get_sales_order_header($myrow["order_"]); - - //$shipping += $sales_order['freight_cost']; + $shipping += $myrow['ov_freight']; } $_POST['ChargeFreightCost'] = price_format($shipping); @@ -468,15 +450,9 @@ if ($_SESSION['Items']->trans_no == 0) { label_cells(_("Reference"), $_SESSION['Items']->reference, "class='tableheader2'"); } -//label_cells(_("Delivery Notes:"), -//get_customer_trans_view_str(ST_CUSTDELIVERY, array_keys($_SESSION['Items']->src_docs)), "class='tableheader2'"); - label_cells(_("Sales Type"), $_SESSION['Items']->sales_type_name, "class='tableheader2'"); label_cells(_("Currency"), $_SESSION['Items']->customer_currency, "class='tableheader2'"); -// 2010-09-03 Joe Hunt -//if ($dim > 0) -// label_cells(_("Dimension"), get_dimension_string($_SESSION['Items']->dimension_id), "class='tableheader2'"); if ($dim > 0) { label_cell(_("Dimension").":", "class='tableheader2'"); $_POST['dimension_id'] = $_SESSION['Items']->dimension_id; @@ -514,12 +490,6 @@ if (!isset($_POST['due_date']) || !is_date($_POST['due_date'])) { } date_cells(_("Due Date"), 'due_date', '', null, 0, 0, 0, "class='tableheader2'"); -/* -if ($dim > 1) - label_cells(_("Dimension"). " 2", get_dimension_string($_SESSION['Items']->dimension2_id), "class='tableheader2'"); -else if ($dim > 0) - label_cell(" ", "colspan=2"); -*/ if ($dim > 1) { label_cell(_("Dimension")." 2:", "class='tableheader2'"); $_POST['dimension2_id'] = $_SESSION['Items']->dimension2_id; diff --git a/sales/customer_payments.php b/sales/customer_payments.php index 10742c88..59fe6077 100644 --- a/sales/customer_payments.php +++ b/sales/customer_payments.php @@ -184,13 +184,6 @@ function can_process() } } -// if (isset($_POST['_ex_rate']) && !check_num('_ex_rate', 0.000001)) -// { -// display_error(_("The exchange rate must be numeric and greater than zero.")); -// set_focus('_ex_rate'); -// return false; -// } - if (@$_POST['discount'] == "") { $_POST['discount'] = 0; @@ -202,7 +195,6 @@ function can_process() return false; } - //if ((input_num('amount') - input_num('discount') <= 0)) { if (input_num('amount') <= 0) { display_error(_("The balance of the amount and discount is zero or negative. Please enter valid amounts.")); set_focus('discount'); @@ -263,8 +255,8 @@ function read_customer_data() $_POST['HoldAccount'] = $myrow["dissallow_invoices"]; $_POST['pymt_discount'] = $myrow["pymt_discount"]; - //Chaitanya : 13-OCT-2011 - To support Edit feature - //If page is called first time and New entry fetch the nex reference number + // To support Edit feature + // If page is called first time and New entry fetch the nex reference number if (!$_SESSION['alloc']->trans_no && !isset($_POST['charge'])) $_POST['ref'] = $Refs->get_next(ST_CUSTPAYMENT, null, array( 'customer' => get_post('customer_id'), 'date' => get_post('DateBanked'))); @@ -273,7 +265,7 @@ function read_customer_data() //---------------------------------------------------------------------------------------------- $new = 1; -//Chaitanya : 13-OCT-2011 - To support Edit feature +// To support Edit feature if (isset($_GET['trans_no']) && $_GET['trans_no'] > 0 ) { $_POST['trans_no'] = $_GET['trans_no']; @@ -307,91 +299,91 @@ if (isset($_GET['trans_no']) && $_GET['trans_no'] > 0 ) $new = !$_SESSION['alloc']->trans_no; start_form(); - hidden('trans_no'); +hidden('trans_no'); - start_outer_table(TABLESTYLE2, "width='60%'", 5); +start_outer_table(TABLESTYLE2, "width='60%'", 5); - table_section(1); +table_section(1); - bank_accounts_list_row(_("Into Bank Account:"), 'bank_account', null, true); +bank_accounts_list_row(_("Into Bank Account:"), 'bank_account', null, true); - if ($new) - customer_list_row(_("From Customer:"), 'customer_id', null, false, true); - else { - label_cells(_("From Customer:"), $_SESSION['alloc']->person_name, "class='label'"); - hidden('customer_id', $_POST['customer_id']); - } +if ($new) + customer_list_row(_("From Customer:"), 'customer_id', null, false, true); +else { + label_cells(_("From Customer:"), $_SESSION['alloc']->person_name, "class='label'"); + hidden('customer_id', $_POST['customer_id']); +} - if (list_updated('customer_id') || ($new && list_updated('bank_account'))) { - $_SESSION['alloc']->read(); - $_POST['memo_'] = $_POST['amount'] = $_POST['discount'] = ''; - $Ajax->activate('alloc_tbl'); - } +if (list_updated('customer_id') || ($new && list_updated('bank_account'))) { + $_SESSION['alloc']->read(); + $_POST['memo_'] = $_POST['amount'] = $_POST['discount'] = ''; + $Ajax->activate('alloc_tbl'); +} - if (db_customer_has_branches($_POST['customer_id'])) { - customer_branches_list_row(_("Branch:"), $_POST['customer_id'], 'BranchID', null, false, true, true); - } else { - hidden('BranchID', ANY_NUMERIC); - } +if (db_customer_has_branches($_POST['customer_id'])) { + customer_branches_list_row(_("Branch:"), $_POST['customer_id'], 'BranchID', null, false, true, true); +} else { + hidden('BranchID', ANY_NUMERIC); +} - if (list_updated('customer_id') || ($new && list_updated('bank_account'))) { - $_SESSION['alloc']->set_person($_POST['customer_id'], PT_CUSTOMER); - $_SESSION['alloc']->read(); - $_POST['memo_'] = $_POST['amount'] = $_POST['discount'] = ''; - $Ajax->activate('alloc_tbl'); - } +if (list_updated('customer_id') || ($new && list_updated('bank_account'))) { + $_SESSION['alloc']->set_person($_POST['customer_id'], PT_CUSTOMER); + $_SESSION['alloc']->read(); + $_POST['memo_'] = $_POST['amount'] = $_POST['discount'] = ''; + $Ajax->activate('alloc_tbl'); +} - read_customer_data(); +read_customer_data(); - set_global_customer($_POST['customer_id']); - if (isset($_POST['HoldAccount']) && $_POST['HoldAccount'] != 0) - display_warning(_("This customer account is on hold.")); - $display_discount_percent = percent_format($_POST['pymt_discount']*100) . "%"; +set_global_customer($_POST['customer_id']); +if (isset($_POST['HoldAccount']) && $_POST['HoldAccount'] != 0) + display_warning(_("This customer account is on hold.")); +$display_discount_percent = percent_format($_POST['pymt_discount']*100) . "%"; - table_section(2); +table_section(2); - date_row(_("Date of Deposit:"), 'DateBanked', '', true, 0, 0, 0, null, true); +date_row(_("Date of Deposit:"), 'DateBanked', '', true, 0, 0, 0, null, true); - ref_row(_("Reference:"), 'ref','' , null, '', ST_CUSTPAYMENT); +ref_row(_("Reference:"), 'ref','' , null, '', ST_CUSTPAYMENT); - table_section(3); +table_section(3); - $comp_currency = get_company_currency(); - $cust_currency = $_SESSION['alloc']->set_person($_POST['customer_id'], PT_CUSTOMER); - if (!$cust_currency) - $cust_currency = $comp_currency; - $_SESSION['alloc']->currency = $bank_currency = get_bank_account_currency($_POST['bank_account']); +$comp_currency = get_company_currency(); +$cust_currency = $_SESSION['alloc']->set_person($_POST['customer_id'], PT_CUSTOMER); +if (!$cust_currency) + $cust_currency = $comp_currency; +$_SESSION['alloc']->currency = $bank_currency = get_bank_account_currency($_POST['bank_account']); - if ($cust_currency != $bank_currency) - { - amount_row(_("Payment Amount:"), 'bank_amount', null, '', $bank_currency); - } +if ($cust_currency != $bank_currency) +{ + amount_row(_("Payment Amount:"), 'bank_amount', null, '', $bank_currency); +} - amount_row(_("Bank Charge:"), 'charge', null, '', $bank_currency); +amount_row(_("Bank Charge:"), 'charge', null, '', $bank_currency); - end_outer_table(1); +end_outer_table(1); - div_start('alloc_tbl'); - show_allocatable(false); - div_end(); +div_start('alloc_tbl'); +show_allocatable(false); +div_end(); - start_table(TABLESTYLE, "width='60%'"); +start_table(TABLESTYLE, "width='60%'"); - label_row(_("Customer prompt payment discount :"), $display_discount_percent); +label_row(_("Customer prompt payment discount :"), $display_discount_percent); - amount_row(_("Amount of Discount:"), 'discount', null, '', $cust_currency); +amount_row(_("Amount of Discount:"), 'discount', null, '', $cust_currency); - amount_row(_("Amount:"), 'amount', null, '', $cust_currency); +amount_row(_("Amount:"), 'amount', null, '', $cust_currency); - textarea_row(_("Memo:"), 'memo_', null, 22, 4); - end_table(1); +textarea_row(_("Memo:"), 'memo_', null, 22, 4); +end_table(1); - if ($new) - submit_center('AddPaymentItem', _("Add Payment"), true, '', 'default'); - else - submit_center('AddPaymentItem', _("Update Payment"), true, '', 'default'); +if ($new) + submit_center('AddPaymentItem', _("Add Payment"), true, '', 'default'); +else + submit_center('AddPaymentItem', _("Update Payment"), true, '', 'default'); - br(); +br(); end_form(); end_page(); diff --git a/sales/includes/cart_class.inc b/sales/includes/cart_class.inc index 3bfb9526..b4c7f8f5 100644 --- a/sales/includes/cart_class.inc +++ b/sales/includes/cart_class.inc @@ -181,7 +181,7 @@ class cart $line = &$this->line_items[$line_no]; $src_docs[] = $src_type == ST_SALESORDER ? $srcline['order_no'] : $srcline['debtor_trans_no']; while($srcline['id'] != $line->src_id) // Logic : This will increment the line_items array till sales_order line is matched. - { // 0002259: Fixes Delivery note bug : Parent constraints not working if sales order line deleted after delivery + { // Fixes Delivery note bug : Parent constraints not working if sales order line deleted after delivery $line_no++; $line = &$this->line_items[$line_no]; } @@ -215,65 +215,64 @@ class cart if ($type == ST_SALESORDER || $type == ST_SALESQUOTE) { // sales order || sales quotation read_sales_order($trans_no[0], $this, $type); } else { // other type of sales transaction - read_sales_trans($type, $trans_no, $this); - $this->prepayments = get_payments_for($trans_no[0], $type); - if ($this->order_no) { // free hand credit notes have no order_no - $sodata = get_sales_order_header($this->order_no, ST_SALESORDER); - $this->cust_ref = $sodata["customer_ref"]; - // currently currency is hard linked to debtor account - // $this->customer_currency = $sodata["curr_code"]; - $this->delivery_to = $sodata["deliver_to"]; - $this->delivery_address = $sodata["delivery_address"]; - // child transaction reedition - update with parent info unless it is freehand - if (!$this->is_prepaid() && !$prepare_child) // this is read for view/reedition - $this->set_parent_constraints($sodata, $trans_no[0]); - } + read_sales_trans($type, $trans_no, $this); + $this->prepayments = get_payments_for($trans_no[0], $type); + if ($this->order_no) { // free hand credit notes have no order_no + $sodata = get_sales_order_header($this->order_no, ST_SALESORDER); + $this->cust_ref = $sodata["customer_ref"]; + // currently currency is hard linked to debtor account + $this->delivery_to = $sodata["deliver_to"]; + $this->delivery_address = $sodata["delivery_address"]; + // child transaction reedition - update with parent info unless it is freehand + if (!$this->is_prepaid() && !$prepare_child) // this is read for view/reedition + $this->set_parent_constraints($sodata, $trans_no[0]); + } } // convert document into child and prepare qtys for entry if ($prepare_child) $this->prepare_child($prepare_child); } else { // new document - $this->trans_type = $type; - $this->trans_no = 0; - $this->customer_currency = get_company_currency(); - // set new sales document defaults here - if (get_global_customer() != ALL_TEXT) - $this->customer_id = get_global_customer(); - else - $this->customer_id = ''; - $this->document_date = new_doc_date(); - if (!is_date_in_fiscalyear($this->document_date)) - $this->document_date = end_fiscalyear(); - $this->reference = $Refs->get_next($this->trans_type, null, array('date' => Today(), - 'customer' => $this->customer_id)); - if ($type != ST_SALESORDER && $type != ST_SALESQUOTE) // Added 2.1 Joe Hunt 2008-11-12 + $this->trans_type = $type; + $this->trans_no = 0; + $this->customer_currency = get_company_currency(); + // set new sales document defaults here + if (get_global_customer() != ALL_TEXT) + $this->customer_id = get_global_customer(); + else + $this->customer_id = ''; + $this->document_date = new_doc_date(); + if (!is_date_in_fiscalyear($this->document_date)) + $this->document_date = end_fiscalyear(); + $this->reference = $Refs->get_next($this->trans_type, null, array('date' => Today(), + 'customer' => $this->customer_id)); + if ($type != ST_SALESORDER && $type != ST_SALESQUOTE) // Added 2.1 Joe Hunt 2008-11-12 + { + $dim = get_company_pref('use_dimension'); + if ($dim > 0) { - $dim = get_company_pref('use_dimension'); - if ($dim > 0) + if ($this->customer_id == '') + $this->dimension_id = 0; + else + { + $cust = get_customer($this->customer_id); + $this->dimension_id = $cust['dimension_id']; + } + if ($dim > 1) { if ($this->customer_id == '') - $this->dimension_id = 0; + $this->dimension2_id = 0; else - { - $cust = get_customer($this->customer_id); - $this->dimension_id = $cust['dimension_id']; - } - if ($dim > 1) - { - if ($this->customer_id == '') - $this->dimension2_id = 0; - else - $this->dimension2_id = $cust['dimension2_id']; - } + $this->dimension2_id = $cust['dimension2_id']; } - } - if ($type == ST_SALESINVOICE) { - $this->due_date = - get_invoice_duedate($this->payment, $this->document_date); - } else - $this->due_date = - add_days($this->document_date, $SysPrefs->default_delivery_required_by()); + } + } + if ($type == ST_SALESINVOICE) { + $this->due_date = + get_invoice_duedate($this->payment, $this->document_date); + } else + $this->due_date = + add_days($this->document_date, $SysPrefs->default_delivery_required_by()); } $this->credit = get_current_cust_credit($this->customer_id); } @@ -509,7 +508,7 @@ class cart } $taxes = get_tax_for_items($items, $prices, $shipping_cost, - $this->tax_group_id, $this->tax_included, $this->tax_group_array); + $this->tax_group_id, $this->tax_included, $this->tax_group_array); // Adjustment for swiss franken, we always have 5 rappen = 1/20 franken if ($this->customer_currency == 'CHF') { @@ -604,7 +603,7 @@ class cart */ function is_prepaid() { - return $this->prepaid; //floatcmp($this->prep_amount, 0) > 0; + return $this->prepaid; } /* Order is ready for delivery in prepament mode. @@ -711,7 +710,6 @@ class line_details $this->item_description = $item_row["description"]; else $this->item_description = $description; - //$this->standard_cost = $item_row["material_cost"] + $item_row["labour_cost"] + $item_row["overhead_cost"]; $this->tax_type = $item_row["tax_type_id"]; $this->tax_type_name = $item_row["tax_type_name"]; $this->stock_id = $stock_id; diff --git a/sales/includes/db/payment_db.inc b/sales/includes/db/payment_db.inc index 3fd0164b..76664853 100644 --- a/sales/includes/db/payment_db.inc +++ b/sales/includes/db/payment_db.inc @@ -34,10 +34,10 @@ function write_customer_payment($trans_no, $customer_id, $branch_id, $bank_accou $company_record = get_company_prefs(); if ($trans_no != 0) { - delete_comments(ST_CUSTPAYMENT, $trans_no); - void_bank_trans(ST_CUSTPAYMENT, $trans_no, true); - void_gl_trans(ST_CUSTPAYMENT, $trans_no, true); - void_cust_allocations(ST_CUSTPAYMENT, $trans_no, $date_); + delete_comments(ST_CUSTPAYMENT, $trans_no); + void_bank_trans(ST_CUSTPAYMENT, $trans_no, true); + void_gl_trans(ST_CUSTPAYMENT, $trans_no, true); + void_cust_allocations(ST_CUSTPAYMENT, $trans_no, $date_); } $bank = get_bank_account($bank_account); diff --git a/sales/includes/db/sales_credit_db.inc b/sales/includes/db/sales_credit_db.inc index b23b9600..b3598782 100644 --- a/sales/includes/db/sales_credit_db.inc +++ b/sales/includes/db/sales_credit_db.inc @@ -61,15 +61,13 @@ function write_credit_note(&$credit_note, $write_off_acc) $items_added_tax = 0; $freight_added_tax = 0; } - // 2006-06-14. If the Customer Branch AR Account is set to a Bank Account, + // If the Customer Branch AR Account is set to a Bank Account, // the transaction will be settled at once. if (is_bank_account($branch_data['receivables_account'])) $alloc = $credit_note_total + $items_added_tax + $credit_note->freight_cost + $freight_added_tax; else $alloc = 0; -// $sales_order=$invoice->order_no; //? -// if (is_array($sales_order)) $sales_order = $sales_order[0]; //? if (!isset($credit_note->order_no)) $credit_note->order_no = 0; @@ -82,7 +80,6 @@ function write_credit_note(&$credit_note, $write_off_acc) $credit_note->sales_type, $credit_note->order_no, $credit_note->ship_via, null, $alloc, 0, $credit_note->dimension_id, $credit_note->dimension2_id, $credit_note->payment, $credit_note->tax_included); - // 2008-06-14 extra $alloc, 2008-11-12 dimension_id Joe Hunt if ($trans_no==0) { $credit_note->trans_no = array($credit_no=>0); @@ -204,7 +201,7 @@ function add_gl_trans_credit_costs($order, $order_line, $credit_no, $date_, { $stock_gl_codes = get_stock_gl_code($order_line->stock_id); $customer = get_customer($order->customer_id); - // 2008-08-01. If there is a Customer Dimension, then override with this, + // If there is a Customer Dimension, then override with this, // else take the Item Dimension (if any) $dim = ($order->dimension_id != $customer['dimension_id'] ? $order->dimension_id : ($customer['dimension_id'] != 0 ? $customer["dimension_id"] : $stock_gl_codes["dimension_id"])); @@ -249,7 +246,7 @@ function add_gl_trans_credit_costs($order, $order_line, $credit_no, $date_, //Post sales transaction to GL credit sales - // 2008-06-14. If there is a Branch Sales Account, then override with this, + // If there is a Branch Sales Account, then override with this, // else take the Item Sales Account if ($branch_data['sales_account'] != "") $sales_account = $branch_data['sales_account']; diff --git a/sales/includes/db/sales_delivery_db.inc b/sales/includes/db/sales_delivery_db.inc index 51b709c1..1b0912d4 100644 --- a/sales/includes/db/sales_delivery_db.inc +++ b/sales/includes/db/sales_delivery_db.inc @@ -78,8 +78,7 @@ function write_sales_delivery(&$delivery,$bo_policy) $line_tax = get_full_price_for_item($delivery_line->stock_id, $delivery_line->price, 0, $delivery->tax_included, $delivery->tax_group_array) - $line_taxfree_price; - //if ($trans_no != 0) // Inserted 2008-09-25 Joe Hunt. This condition is removed after experience by Chaitanya - $delivery_line->standard_cost = get_standard_cost($delivery_line->stock_id); + $delivery_line->standard_cost = get_standard_cost($delivery_line->stock_id); /* add delivery details for all lines */ write_customer_trans_detail_item(ST_CUSTDELIVERY, $delivery_no, $delivery_line->stock_id, @@ -101,7 +100,7 @@ function write_sales_delivery(&$delivery,$bo_policy) $stock_gl_code = get_stock_gl_code($delivery_line->stock_id); - // 2008-08-01. If there is a Customer Dimension, then override with this, + // If there is a Customer Dimension, then override with this, // else take the Item Dimension (if any) $dim = ($delivery->dimension_id != $customer['dimension_id'] ? $delivery->dimension_id : ($customer['dimension_id'] != 0 ? $customer["dimension_id"] : $stock_gl_code["dimension_id"])); @@ -166,8 +165,6 @@ function write_sales_delivery(&$delivery,$bo_policy) if ($trans_no == 0) { $Refs->save(ST_CUSTDELIVERY, $delivery_no, $delivery->reference); } -//_vd(get_gl(ST_CUSTDELIVERY, $delivery_no)); -//exit; hook_db_postwrite($delivery, ST_CUSTDELIVERY); commit_transaction(); diff --git a/sales/includes/db/sales_invoice_db.inc b/sales/includes/db/sales_invoice_db.inc index 4028233e..387575d0 100644 --- a/sales/includes/db/sales_invoice_db.inc +++ b/sales/includes/db/sales_invoice_db.inc @@ -86,7 +86,6 @@ function write_sales_invoice(&$invoice) $invoice->sales_type, $sales_order, $invoice->ship_via, $invoice->due_date, 0, 0, $invoice->dimension_id, $invoice->dimension2_id, $invoice->payment, $invoice->tax_included, $invoice->prep_amount); - // 2008-06-14 extra $alloc, 2008-11-12 added dimension_id Joe Hunt if ($trans_no == 0) { $invoice->trans_no = array($invoice_no=>0); @@ -127,11 +126,11 @@ function write_sales_invoice(&$invoice) if ($invoice_line->line_price() != 0) { //Post sales transaction to GL credit sales - // 2008-06-14. If there is a Branch Sales Account, then override with this, + // If there is a Branch Sales Account, then override with this, // else take the Item Sales Account if (!$invoice->is_prepaid()) $sales_account = ($branch_data['sales_account'] != "" ? $branch_data['sales_account'] : $stock_gl_code['sales_account']); - // 2008-08-01. If there is a Customer Dimension, then override with this, + // If there is a Customer Dimension, then override with this, // else take the Item Dimension (if any) $dim = ($invoice->dimension_id != $customer['dimension_id'] ? $invoice->dimension_id : ($customer['dimension_id'] != 0 ? $customer["dimension_id"] : $stock_gl_code["dimension_id"])); @@ -205,18 +204,9 @@ function write_sales_invoice(&$invoice) update_debtor_trans_allocation(ST_CUSTPAYMENT, $pmtno, $invoice->customer_id); } } -//_vd($allocs); reallocate_payments($invoice_no, ST_SALESINVOICE, $date_, $to_allocate, $allocs); -//_vd(get_payments_for($sales_order, ST_SALESORDER)); -//_vd(get_payments_for($invoice_no, ST_SALESINVOICE)); -//_vd(get_gl(ST_SALESINVOICE, $invoice_no)); -//_vd(get_customer_trans($invoice_no, ST_SALESINVOICE)); -//_vd(get_sales_order_header($sales_order, ST_SALESORDER)); hook_db_postwrite($invoice, ST_SALESINVOICE); -//$result = get_trans_tax_details(ST_SALESINVOICE, $invoice_no); -//while($row=db_fetch($result)) -// _vd($row); -//exit; + commit_transaction(); return $invoice_no; diff --git a/sales/includes/sales_db.inc b/sales/includes/sales_db.inc index 1698e40a..d5c0e487 100644 --- a/sales/includes/sales_db.inc +++ b/sales/includes/sales_db.inc @@ -117,20 +117,6 @@ function get_price ($stock_id, $currency, $sales_type_id, $factor=null, $date=nu { $price = $prices[$base_id][$home_curr] * $factor / $rate; } -/* - if (isset($prices[$sales_type_id][$home_curr])) - { - $price = $prices[$sales_type_id][$home_curr] / $rate; - } - elseif (isset($prices[$base_id][$currency])) - { - $price = $prices[$base_id][$currency] * $factor; - } - elseif (isset($prices[$base_id][$home_curr])) - { - $price = $prices[$base_id][$home_curr] * $factor / $rate; - } -*/ elseif ($num_rows == 0 && $add_pct != -1) { $price = get_calculated_price($stock_id, $add_pct); @@ -189,7 +175,6 @@ function update_parent_line($doc_type, $line_id, $qty_dispatched, $auto=false) $qty_dispatched = (float)$qty_dispatched; -// echo "update line: $line_id, $doc_type, $qty_dispatched"; if ($doc_type == 0) return false; else { @@ -237,7 +222,7 @@ function get_location(&$cart) function read_sales_trans($doc_type, $trans_no, &$cart) { if (!is_array($trans_no) && $trans_no) - $trans_no = array($trans_no); + $trans_no = array($trans_no); $cart->trans_type = $doc_type; if (!$trans_no) { // new document diff --git a/sales/includes/ui/sales_credit_ui.inc b/sales/includes/ui/sales_credit_ui.inc index 7f086ac2..0fd4dfc7 100644 --- a/sales/includes/ui/sales_credit_ui.inc +++ b/sales/includes/ui/sales_credit_ui.inc @@ -35,48 +35,43 @@ function display_credit_header(&$order) } customer_branches_list_row(_("Branch:"), $_POST['customer_id'], - 'branch_id', null, false, true, true, true); + 'branch_id', null, false, true, true, true); - //if (($_SESSION['credit_items']->order_no == 0) || - // ($order->customer_id != $_POST['customer_id']) || - // ($order->Branch != $_POST['branch_id'])) - // $customer_error = get_customer_details_to_order($order, $_POST['customer_id'], $_POST['branch_id']); if (($order->customer_id != $_POST['customer_id']) || ($order->Branch != $_POST['branch_id'])) - { - - $old_order = (PHP_VERSION<5) ? $order : clone $order; - $customer_error = get_customer_details_to_order($order, $_POST['customer_id'], $_POST['branch_id']); - - $_POST['Location'] = $order->Location; - $_POST['deliver_to'] = $order->deliver_to; - $_POST['delivery_address'] = $order->delivery_address; - $_POST['phone'] = $order->phone; - $Ajax->activate('Location'); - $Ajax->activate('deliver_to'); - $Ajax->activate('phone'); - $Ajax->activate('delivery_address'); - // change prices if necessary - // what about discount in template case? - if ($old_order->customer_currency != $order->customer_currency) { - $change_prices = 1; - } - if ($old_order->sales_type != $order->sales_type) { - // || $old_order->default_discount!=$order->default_discount - $_POST['sales_type_id'] = $order->sales_type; - $Ajax->activate('sales_type_id'); - $change_prices = 1; - } - if ($old_order->dimension_id != $order->dimension_id) { - $_POST['dimension_id'] = $order->dimension_id; - $Ajax->activate('dimension_id'); - } - if ($old_order->dimension2_id != $order->dimension2_id) { - $_POST['dimension2_id'] = $order->dimension2_id; - $Ajax->activate('dimension2_id'); - } - unset($old_order); - } + { + + $old_order = (PHP_VERSION<5) ? $order : clone $order; + $customer_error = get_customer_details_to_order($order, $_POST['customer_id'], $_POST['branch_id']); + + $_POST['Location'] = $order->Location; + $_POST['deliver_to'] = $order->deliver_to; + $_POST['delivery_address'] = $order->delivery_address; + $_POST['phone'] = $order->phone; + $Ajax->activate('Location'); + $Ajax->activate('deliver_to'); + $Ajax->activate('phone'); + $Ajax->activate('delivery_address'); + // change prices if necessary + // what about discount in template case? + if ($old_order->customer_currency != $order->customer_currency) { + $change_prices = 1; + } + if ($old_order->sales_type != $order->sales_type) { + $_POST['sales_type_id'] = $order->sales_type; + $Ajax->activate('sales_type_id'); + $change_prices = 1; + } + if ($old_order->dimension_id != $order->dimension_id) { + $_POST['dimension_id'] = $order->dimension_id; + $Ajax->activate('dimension_id'); + } + if ($old_order->dimension2_id != $order->dimension2_id) { + $_POST['dimension2_id'] = $order->dimension2_id; + $Ajax->activate('dimension2_id'); + } + unset($old_order); + } set_global_customer($_POST['customer_id']); if (!isset($_POST['ref'])) @@ -127,7 +122,7 @@ function display_credit_header(&$order) } $Ajax->activate('_ex_rate'); } - // 2008-11-12 Joe Hunt added dimensions + // added dimensions $dim = get_company_pref('use_dimension'); if ($dim > 0) dimensions_list_row(_("Dimension").":", 'dimension_id', @@ -147,7 +142,6 @@ function display_credit_header(&$order) $line = &$order->line_items[$line_no]; $line->price = get_price($line->stock_id, $order->customer_currency, $order->sales_type, $order->price_factor, get_post('OrderDate')); - // $line->discount_percent = $order->default_discount; } $Ajax->activate('items_table'); } @@ -166,7 +160,7 @@ function display_credit_items($title, &$order) div_start('items_table'); start_table(TABLESTYLE, "width='90%'"); $th = array(_("Item Code"), _("Item Description"), _("Quantity"), _("Unit"), - _("Price"), _("Discount %"), _("Total"),''); + _("Price"), _("Discount %"), _("Total"),''); if (count($order->line_items)) $th[]= ''; diff --git a/sales/includes/ui/sales_order_ui.inc b/sales/includes/ui/sales_order_ui.inc index c1209dc7..7b91967b 100644 --- a/sales/includes/ui/sales_order_ui.inc +++ b/sales/includes/ui/sales_order_ui.inc @@ -43,27 +43,27 @@ function add_to_order(&$order, $new_item, $new_item_qty, $price, $discount, $des } $item_price = round($item_price, user_price_dec()); - if (!$item['is_foreign'] && $item['item_code'] != $item['stock_id']) - { // this is sales kit - recurse - add_to_order($order, $item['stock_id'], $new_item_qty*$item['quantity'], - $item_price, $discount); - } - else - { // stock item record eventually with foreign code - - // check duplicate stock item - foreach ($order->line_items as $order_item) - { - if (strcasecmp($order_item->stock_id, $item['stock_id']) == 0) + if (!$item['is_foreign'] && $item['item_code'] != $item['stock_id']) + { // this is sales kit - recurse + add_to_order($order, $item['stock_id'], $new_item_qty*$item['quantity'], + $item_price, $discount); + } + else + { // stock item record eventually with foreign code + + // check duplicate stock item + foreach ($order->line_items as $order_item) { - display_warning(_("For Part :").$item['stock_id']. " " - . _("This item is already on this document. You have been warned.")); - break; + if (strcasecmp($order_item->stock_id, $item['stock_id']) == 0) + { + display_warning(_("For Part :").$item['stock_id']. " " + . _("This item is already on this document. You have been warned.")); + break; + } } + $order->add_to_cart (count($order->line_items), $item['stock_id'], + $new_item_qty*$item['quantity'], $item_price, $discount, 0,0, $description); } - $order->add_to_cart (count($order->line_items), $item['stock_id'], - $new_item_qty*$item['quantity'], $item_price, $discount, 0,0, $description); - } } } @@ -178,7 +178,6 @@ function display_order_summary($title, &$order, $editable_items=false) view_stock_status_cell($stock_item->stock_id); - //label_cell($stock_item->item_description, "nowrap" ); label_cell($stock_item->item_description ); $dec = get_qty_dec($stock_item->stock_id); qty_cell($stock_item->qty_dispatched, false, $dec); @@ -254,8 +253,6 @@ function display_order_header(&$order, $editable, $date_text) if (isset($order) && !$editable) { - // can't change the customer/branch if items already received on this order - //echo $order->customer_name . " - " . $order->deliver_to; label_row(null, $order->customer_name . " - " . $order->deliver_to); hidden('customer_id', $order->customer_id); hidden('branch_id', $order->Branch); @@ -465,7 +462,6 @@ function display_order_header(&$order, $editable, $date_text) $line = &$order->line_items[$line_no]; $line->price = get_kit_price($line->stock_id, $order->customer_currency, $order->sales_type, $order->price_factor, get_post('OrderDate')); - // $line->discount_percent = $order->default_discount; } $Ajax->activate('items_table'); } @@ -499,10 +495,6 @@ function sales_order_item_controls(&$order, &$rowcounter, $line_no=-1) hidden('item_description', $_POST['item_description']); label_cell($_POST['item_description']); } -// } else { -// sales_items_list_cells(null,'item_description', null, false, true); -// } - //label_cell($order->line_items[$line_no]->item_description, "nowrap"); $Ajax->activate('items_table'); } else // prepare new line diff --git a/sales/inquiry/sales_orders_view.php b/sales/inquiry/sales_orders_view.php index 676d6ea0..688f3f7f 100644 --- a/sales/inquiry/sales_orders_view.php +++ b/sales/inquiry/sales_orders_view.php @@ -196,8 +196,8 @@ if (get_post('_OrderNumber_changed') || get_post('_OrderReference_changed')) // $disable = get_post('OrderNumber') !== '' || get_post('OrderReference') !== ''; if ($show_dates) { - $Ajax->addDisable(true, 'OrdersAfterDate', $disable); - $Ajax->addDisable(true, 'OrdersToDate', $disable); + $Ajax->addDisable(true, 'OrdersAfterDate', $disable); + $Ajax->addDisable(true, 'OrdersToDate', $disable); } $Ajax->activate('orders_tbl'); @@ -273,7 +273,6 @@ else _("Currency") => array('align'=>'center') ); if ($_POST['order_view_mode'] == 'OutstandingOnly') { - //array_substitute($cols, 3, 1, _("Cust Order Ref")); array_append($cols, array( array('insert'=>true, 'fun'=>'dispatch_link'), array('insert'=>true, 'fun'=>'edit_link'))); diff --git a/sales/manage/sales_people.php b/sales/manage/sales_people.php index 2f44ad06..20a25fff 100644 --- a/sales/manage/sales_people.php +++ b/sales/manage/sales_people.php @@ -145,9 +145,9 @@ if ($selected_id != -1) } hidden('selected_id', $selected_id); } elseif ($Mode != 'ADD_ITEM') { - $_POST['provision'] = percent_format(0); - $_POST['break_pt'] = price_format(0); - $_POST['provision2'] = percent_format(0); + $_POST['provision'] = percent_format(0); + $_POST['break_pt'] = price_format(0); + $_POST['provision2'] = percent_format(0); } start_table(TABLESTYLE2); diff --git a/sales/sales_order_entry.php b/sales/sales_order_entry.php index 638bf263..aba35ebd 100644 --- a/sales/sales_order_entry.php +++ b/sales/sales_order_entry.php @@ -332,10 +332,10 @@ function copy_from_cart() //-------------------------------------------------------------------------------- function line_start_focus() { - global $Ajax; + global $Ajax; - $Ajax->activate('items_table'); - set_focus('_stock_id_edit'); + $Ajax->activate('items_table'); + set_focus('_stock_id_edit'); } //-------------------------------------------------------------------------------- @@ -565,7 +565,7 @@ function handle_delete_item($line_no) if ($_SESSION['Items']->some_already_delivered($line_no) == 0) { $_SESSION['Items']->remove_from_cart($line_no); } else { - display_error(_("This item cannot be deleted because some of it has already been delivered.")); + display_error(_("This item cannot be deleted because some of it has already been delivered.")); } line_start_focus(); } diff --git a/taxes/tax_calc.inc b/taxes/tax_calc.inc index bf1c79ef..28b40a7c 100644 --- a/taxes/tax_calc.inc +++ b/taxes/tax_calc.inc @@ -33,8 +33,6 @@ function get_tax_free_price_for_item($stock_id, $price, $tax_group, $tax_include else $ret_tax_array = get_tax_group_items_as_array($tax_group); - //print_r($ret_tax_array); - $tax_array = get_taxes_for_item($stock_id, $ret_tax_array); // if no exemptions or taxgroup is empty, then no included/excluded taxes @@ -149,9 +147,9 @@ function get_tax_for_items($items, $prices, $shipping_cost, $tax_group, $tax_inc $tax_algorithm = get_company_pref('tax_algorithm'); // first create and set an array with all the tax types of the tax group if($tax_items_array!=null) - $ret_tax_array = $tax_items_array; + $ret_tax_array = $tax_items_array; else - $ret_tax_array = get_tax_group_items_as_array($tax_group); + $ret_tax_array = get_tax_group_items_as_array($tax_group); $dec = user_price_dec(); @@ -186,11 +184,11 @@ function get_tax_for_items($items, $prices, $shipping_cost, $tax_group, $tax_inc if ($item_tax['rate'] !== null) { $index = $item_tax['tax_type_id']; if ($tax_included == 1) { - $ret_tax_array[$index]['Value'] += round2($prices[$i]*$item_tax['rate']/(100+$tax_multiplier), $dec); - $ret_tax_array[$index]['Net'] += round2($prices[$i]*100/(100+$tax_multiplier), $dec); + $ret_tax_array[$index]['Value'] += round2($prices[$i]*$item_tax['rate']/(100+$tax_multiplier), $dec); + $ret_tax_array[$index]['Net'] += round2($prices[$i]*100/(100+$tax_multiplier), $dec); } else { - $ret_tax_array[$index]['Value'] += round2($prices[$i] * $item_tax['rate'] / 100, $dec); - $ret_tax_array[$index]['Net'] += $prices[$i]; + $ret_tax_array[$index]['Value'] += round2($prices[$i] * $item_tax['rate'] / 100, $dec); + $ret_tax_array[$index]['Net'] += $prices[$i]; } } } @@ -218,13 +216,13 @@ function get_tax_for_items($items, $prices, $shipping_cost, $tax_group, $tax_inc { $index = $item_tax['tax_type_id']; if ($item_tax['rate'] !== null && $ret_tax_array[$index]['rate'] !== null) { - if($tax_included==1) { - $ret_tax_array[$index]['Value'] += round2($shipping_cost*$item_tax['rate']/(100+$tax_rate), $dec); - $ret_tax_array[$index]['Net'] += $shipping_net; - } else { + if($tax_included==1) { + $ret_tax_array[$index]['Value'] += round2($shipping_cost*$item_tax['rate']/(100+$tax_rate), $dec); + $ret_tax_array[$index]['Net'] += $shipping_net; + } else { $ret_tax_array[$index]['Value'] += round2($shipping_cost * $item_tax['rate'] / 100, $dec); - $ret_tax_array[$index]['Net'] += $shipping_cost; - } + $ret_tax_array[$index]['Net'] += $shipping_cost; + } } } } diff --git a/themes/default/renderer.php b/themes/default/renderer.php index e632284f..d9138468 100644 --- a/themes/default/renderer.php +++ b/themes/default/renderer.php @@ -215,5 +215,5 @@ echo ""; } echo ""; - } -} + } + } diff --git a/version.php b/version.php index 54d2e436..be3c02b8 100644 --- a/version.php +++ b/version.php @@ -18,8 +18,8 @@ $version = isset($SysPrefs->version) ? $SysPrefs->version : $src_version; $repo_auth = isset($SysPrefs->repo_auth) ? $SysPrefs->repo_auth : array( - 'login' => 'anonymous', - 'pass' => 'password', - 'host' => 'repo.frontaccounting.eu', // repo server address - 'branch' => '2.4' // Repository branch for current sources version + 'login' => 'anonymous', + 'pass' => 'password', + 'host' => 'repo.frontaccounting.eu', // repo server address + 'branch' => '2.4' // Repository branch for current sources version ); -- 2.30.2