Cleanup comments. Small bugfixes. Final run
authorJoe Hunt <joe.hunt.consulting@gmail.com>
Mon, 9 Nov 2015 19:19:47 +0000 (20:19 +0100)
committerJoe Hunt <joe.hunt.consulting@gmail.com>
Mon, 9 Nov 2015 19:19:47 +0000 (20:19 +0100)
53 files changed:
frontaccounting.php
includes/ui/ui_view.inc
reporting/includes/class.graphic.inc
reporting/includes/class.pdf.inc
reporting/includes/excel_report.inc
reporting/includes/pdf_report.inc
reporting/includes/reporting.inc
reporting/includes/reports_classes.inc
reporting/rep101.php
reporting/rep102.php
reporting/rep103.php
reporting/rep107.php
reporting/rep109.php
reporting/rep111.php
reporting/rep113.php
reporting/rep201.php
reporting/rep203.php
reporting/rep205.php
reporting/rep303.php
reporting/rep307.php
reporting/rep309.php
reporting/rep401.php
reporting/rep409.php
reporting/rep601.php
reporting/rep701.php
reporting/rep704.php
reporting/rep705.php
reporting/rep706.php
reporting/rep707.php
reporting/rep708.php
reporting/rep709.php
reporting/reports_main.php
sales/allocations/customer_allocation_main.php
sales/create_recurrent_invoices.php
sales/credit_note_entry.php
sales/customer_credit_invoice.php
sales/customer_delivery.php
sales/customer_invoice.php
sales/customer_payments.php
sales/includes/cart_class.inc
sales/includes/db/payment_db.inc
sales/includes/db/sales_credit_db.inc
sales/includes/db/sales_delivery_db.inc
sales/includes/db/sales_invoice_db.inc
sales/includes/sales_db.inc
sales/includes/ui/sales_credit_ui.inc
sales/includes/ui/sales_order_ui.inc
sales/inquiry/sales_orders_view.php
sales/manage/sales_people.php
sales/sales_order_entry.php
taxes/tax_calc.inc
themes/default/renderer.php
version.php

index 3d3347b1aa4f613065745b45ab6dd78ac8431812..2e81867be205511bdce83731087987e264260c10 100644 (file)
@@ -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());
                }
-}
+       }
index cf4b4880f4d187958990369b427f4cc0046b2f20..5352cb91371cebd4ee9590ca625a2034614cb242 100644 (file)
@@ -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;
index 60b41021fa124846d56b9ca86b3564d7e276a545..7b7d32e9d886341116b634244a058e9d05274147 100644 (file)
@@ -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);
        }
index 2252c28c86e6dd8c07c68b77e51b5bdc279c0444..a1e989172ebd382e2ef01aba0719ffb29b9c50a5 100644 (file)
@@ -120,7 +120,6 @@ class Cpdf extends FPDI {
                $this->FontFamily = 'helvetica';
                $this->FontStyle = '';
                $this->FontSizePt = 12;
-//             $this->utf8Bidi(array(""));
        }
 
 
index f139ba836465caa053f39ee787d1316b95341c25..ef387adaf1702f7d7f6728db7c33577281292a75 100644 (file)
@@ -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";
index 9e96bf2ca826169e461f1a3b8914d6650d83f913..6b9b45c9f637c53b089a3a016eeefae8d93c9984 100644 (file)
@@ -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
index 68c443ea45ba24b9cfe88d7fec3abf5842030aa7..80632db211e2b2645413846bbad7ec37ef0d746d 100644 (file)
@@ -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);
index 96372d1c0bf62329cddf8f58dc9e7e805049ec1d..0c32c42026e2b1ffe69cabb6a730b1831009b726 100644 (file)
@@ -211,7 +211,7 @@ class BoxReports
                                                        }
                                                }
                                        }
-                                       else // saved parameters 2010-10-16 Joe Hunt
+                                       else // saved parameters
                                                $date = $_POST[$name];
                                        $st = "<input type='text' name='$name' value='$date'>";
                                        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);
 
                        }
index a7d1c1f33ef04fb6deb1b64a14be1b02971bd408..a68668375117d07cb56117e069c99cfdb9318ccf 100644 (file)
@@ -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)
index 95d267c352f02b8b0d73759922331b4fc57089a4..e407c6d7b8f77a2323d55d83a5e2a42b2b936584 100644 (file)
@@ -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)
index 9f1e797b29691ad598dbf9aa2fa948ad747cc88a..a93d56062c853ff8ff81a9a1dc818a2fae74de90 100644 (file)
@@ -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);
                }
index a125995dce7b5a04d4818f0eadbc441cdca21de0..4de23cc4896994f22b634d43519c84a0c37e126b 100644 (file)
@@ -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;
index dde986674c2e7cfc7315cfb429aa0bcbcade74af..53df06f61a8b42d9a89a16c016124bd3bdaec212 100644 (file)
@@ -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();
                }
index 45c5ab999e4be66466387c6dc2a6c6786ade4d60..ecf9fc19f10a62b02ca29e4c6ad238142794ff24 100644 (file)
@@ -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();
                }
index acf855c426618f39bd1e18ff7df4caf6bfc386be..b1f931909a37759368c192a35bdfc3bd1db341ea 100644 (file)
@@ -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();
index 0a818ad51b225f5a98ec1a5fb94740136c88357f..e3180acd9adf90cff0c618822b00547a94f4d93c 100644 (file)
@@ -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')
index 1422ce256f7fc9d87f33331e1b75394a3c7edca9..daa5d8a78d084a1d88475a4c751f8f89b3f934a0 100644 (file)
@@ -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')
index 5de3fd4aa590c06720b3295374037e953d5b1e01..4b27c182c697804ba060d71be0d8473f254d3c5c 100644 (file)
@@ -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']);
index 231e33d578ecafe072d2075082f6a24c3f2c4e38..7d8984dbfca13d4b2af6974b529c3b901985d9a5 100644 (file)
@@ -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')
index 214b5704feb62e353464d8aa5051d86524b7170b..19db40997a4ba6b9485a043a695be1afe9548f91 100644 (file)
@@ -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'));
index a306a4330fab62e4a630f95fbf31b7a97d04c2c9..b9c90bc46a7b0866ccc0a84fd793a6fc0e8e3da0 100644 (file)
@@ -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']);
index faab857a5f948c70e57ee816d88405f5929c139f..ddb9692fba1defb90c51b204d8a5b5cd1a6a85fb 100644 (file)
@@ -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']);
index 73a384813bc9bfb4d0e008180ce92052099a43a8..8ad6060636027ebb5d10eab677afa0e44596395d 100644 (file)
@@ -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);
index ba630465ab1062e2c6a64d11444217674e6759f0..505ac4d38408d94d98532aeb63dffbbeff4c681e 100644 (file)
@@ -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");
 }
index 78dc2c7d91a7f794916eca23cfe91ec9f8be3895..a110ea215afc007617d489170a214c5c446e739e 100644 (file)
@@ -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);
 
index 1703ed0a81762b1696ba698c12d3cee3dcd3407d..65ea8d09d47a3ca5d7c5def61ae4e4df8a681e6b 100644 (file)
@@ -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),
index c9b3fd1ac201d9e77aa58c52bef63098354e4038..58c58bec9be142a8fb4b0f0334e185e12ec3cbd1 100644 (file)
@@ -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"),
index 07585945b5e50cddd5f9b3708f13068fdded39e6..1bcd5a02a8782c33bfa0b4390a3622904fc0c68c 100644 (file)
@@ -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),
index a0373b52e05751e39b53c1f725ccd6fc974a2329..7e526b5ba718cbd560418e42cbcbf34e74232ee9 100644 (file)
@@ -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),
index a7a0df3a142dc723af77289fd829f05d3ad594f4..1da9ce2a39bc7dfd796398c388b0b5ce80df15fd 100644 (file)
@@ -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),
index 5c12ac9dd32d4e1a3709588303660f3b36473463..9bfdc0a78e0844decf19774c881bb889cf0d913e 100644 (file)
@@ -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();
index 2435cc698923fd85d659aac8381b74593435ff70..b5a89fcea87399278320404f96a142cdcb84cd94 100644 (file)
@@ -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',
index 766f6312635e604a67da0cf813168a3e55c7068d..9c60415e7101e95afa2e4e49216eaeb2821e1012 100644 (file)
@@ -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 "<center>" . _("Select a customer: ") . "&nbsp;&nbsp;";
-       echo customer_list('customer_id', $_POST['customer_id'], true, true);
-    echo "<br>";
-    check(_("Show Settled Items:"), 'ShowSettled', null, true);
-       echo "</center><br><br>";
+echo "<center>" . _("Select a customer: ") . "&nbsp;&nbsp;";
+echo customer_list('customer_id', $_POST['customer_id'], true, true);
+echo "<br>";
+check(_("Show Settled Items:"), 'ShowSettled', null, true);
+echo "</center><br><br>";
 
-       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)
index f7704e5a480366773774aa5e7dda81c3e19ba6d6..59ac59b52646caeed9403eef0a9d73e026d9de59 100644 (file)
@@ -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));
index 98fd6c1e0b6c9d997f72a167efdcbd12b3ed3f96..2a3077b4c5787b5e6c9680d26e92b50fae916284 100644 (file)
@@ -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');
 }
 
 //-----------------------------------------------------------------------------
index bb1445be6eb11a39380d2446b7bede53931ecf90..af42db4c0378e497a870c5c8fb567cfb38c48e77 100644 (file)
@@ -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();
index fe4ae8276d507f269dbf57ada97d2339b20c6e46..1e29859ea49905f170704b7f19967f9c62c0a4e7 100644 (file)
@@ -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();
index 10993cc040cd73cf76e91f54e3f59c8abf97f2d9..9ec89b569eede7069de04c40653e9714a729ca54 100644 (file)
@@ -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"<center><br><b>" . _("There are no delivery notes for this invoice.<br>
-               Most likely this invoice was created in Front Accounting version prior to 2.0
-               and therefore can not be modified.") . "</b></center>";
-               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("&nbsp;", "colspan=2");
-*/
 if ($dim > 1) {
        label_cell(_("Dimension")." 2:", "class='tableheader2'");
        $_POST['dimension2_id'] = $_SESSION['Items']->dimension2_id;
index 10742c88dac54381fc360a932bd108ab593dfc98..59fe6077ebbe0cf35f5666d8733b64dce6bd8f19 100644 (file)
@@ -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();
index 3bfb9526f1e6c0fddb33a4c2dc4577bde022fdca..b4c7f8f5b7c4562cb0a5ad7603b70ade8387edea 100644 (file)
@@ -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;
index 3fd0164bad6caa092a5e77a584366912f45f7fbb..766648533351281e718ebcde127902624c4722e8 100644 (file)
@@ -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);
index b23b96001b0113f564294dcfb620b4dd909cbefc..b35987824408c2102fab500cb8a189ef22c39582 100644 (file)
@@ -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'];
index 51b709c12b5f10abb47bdbe008162b2c930b2d40..1b0912d4b336e42e8c47b3d3234058ea3120e833 100644 (file)
@@ -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();
 
index 4028233e78f11f97818b4fffeb57f8917bcd44b8..387575d05b7d1d122f34733619733c9386eb3949 100644 (file)
@@ -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;
index 1698e40a2d88ff2c1a603f28e4e195fbdc08bf22..d5c0e487d2ba9a9203c9b4313bc7e92909f07bff 100644 (file)
@@ -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
index 7f086ac2f5d42b0cb648ab419ef901db71059f63..0fd4dfc7c87aef892ea3316ede3fef2d2825e7fc 100644 (file)
@@ -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[]= '';
 
index c1209dc758269c4abf39140bc47d77b7ead351bd..7b91967b97ab7bb734e393d297781c7496f53c17 100644 (file)
@@ -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
index 676d6ea045f48b93c55d670c10e908ea4a71b875..688f3f7f356132333e0d16f681634b552eaba12d 100644 (file)
@@ -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')));
index 2f44ad0659585e1875eac401f4dd3aa21be18425..20a25fffa5391af718a1c3103fd32e24fa97bd56 100644 (file)
@@ -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);
index 638bf263c678873ef33b9f7a91f82a81fe020e89..aba35ebd108e82f151afb3f69e265ac0702c1899 100644 (file)
@@ -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();
 }
index bf1c79ef3b078fac3d27b5169f68ba6e5a49d37c..28b40a7c580f4932a64f4aa562aed87ebd0e4b1c 100644 (file)
@@ -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;
+                                       }
                                }
                        }
                }
index e632284fc373235d17bc6c4f20116b10c29b2161..d9138468dd6195c9a48c1a33bf946b3d74f5016e 100644 (file)
                                echo "</tr></table></td></tr>";
                        }
                        echo "</table>";
-       }
-}
+               }
+       }
index 54d2e436ea7f5d3ca3083c8d59fc7d47b19e26b5..be3c02b8abffa2dcfbbab21bbb587712cad1569f 100644 (file)
@@ -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
 );