Marged fixes from ain trunk up to 2.2.11
authorJanusz Dobrowolski <janusz@frontaccounting.eu>
Mon, 28 Jun 2010 10:57:14 +0000 (10:57 +0000)
committerJanusz Dobrowolski <janusz@frontaccounting.eu>
Mon, 28 Jun 2010 10:57:14 +0000 (10:57 +0000)
14 files changed:
CHANGELOG.txt
admin/payment_terms.php
config.default.php
includes/db/manufacturing_db.inc
reporting/rep101.php
reporting/rep102.php
reporting/rep201.php
reporting/rep202.php
reporting/rep203.php
reporting/rep303.php
reporting/reports_main.php
sales/create_recurrent_invoices.php
sales/customer_credit_invoice.php
sales/includes/db/custalloc_db.inc

index 6fc4785ad452f606df228bf27f99ec2d173a5b43..b18913e4f12aa18848606aa72db2ea2b6da57682 100644 (file)
@@ -19,6 +19,42 @@ Legend:
 ! -> Note
 $ -> Affected files
 
+28-Jun-2010 Merged changes from main trunk (2.2.11) as follows
+------------------------------- Release 2.2.11 ----------------------------------
+! Release 2.2.11
+$ config.default.php
+  update.html
+
+22-Jun-2010 Joe Hunt
+# Minor select bug in create recurrent invoices
+$ /sales/create_recurrent_invoices.php
+
+18-Jun-2010 Joe Hunt
+- Removed constraint on day values in Payment Terms
+$ /admin/payment_terms.php
+
+18-Jun-2010 Janusz Dobrowolski
+# Small bug on final credit note screen redirection
+$ /sales/customer_credit_invoice.php
+
+17-Jun-2010 Janusz Dobrowolski
+# [0000235],[0000236] db error in sales order view window.
+$ /sales/view/view_sales_order.php
+
+14-Jun-2010 Tom Moulton/Joe Hunt
+# Bug [0000231] Wrong On Order for Advanced Manufacturing.before final production.
+$ /includes/db/manufacturing_db.inc
+! Allow optional non zero values in reports 101,102,201,202,203 and 303.
+$ /reporting/rep101.php
+  /reporting/rep102.php
+  /reporting/rep201.php
+  /reporting/rep202.php
+  /reporting/rep203.php
+  /reporting/rep303.php
+  /reporting/reports_main.php
+
+---------- End of changes from main trunk 2.2.11
+
 27-Jun-2010 Janusz Dobrowolski
 + Added debtor_trans.src_id update
 $ /sql/alter2.3.php
@@ -189,6 +225,7 @@ $ /purchasing/includes/db/grn_db.inc
   /purchasing/supplier_invoice.php
 
 13-Jun-2010 Merged changes from main trunk (2.2.10) as follows
+
 ------------------------------- Release 2.2.10 ----------------------------------
 11-Jun-2010 Joe Hunt
 ! Release 2.2.10
index df7401ea4e5a7fad5fce4e3e983387ad4674b6b6..76ccd53eb3f3ebebcf0768cc92cebbf2422d428b 100644 (file)
@@ -56,18 +56,6 @@ if ($Mode=='ADD_ITEM' || $Mode=='UPDATE_ITEM')
                $input_error = 1;
                display_error( _("The Terms description must be entered."));
                set_focus('terms');
-       } // there should be no limits by 30 here if they want longer payment terms. Joe Hunt 2010-05-31
-       //elseif ($_POST['DayNumber'] > 30 && !check_value('DaysOrFoll')) 
-       //{
-       //      $input_error = 1;
-       //      display_error( _("When the check box to indicate a day in the following month is the due date, the due date cannot be a day after the 30th. A number between 1 and 30 is expected."));
-       //      set_focus('DayNumber');
-       //} 
-       elseif ($_POST['DayNumber'] > 500 && get_post('type')==PTT_DAYS) 
-       {
-               $input_error = 1;
-               display_error( _("When the Day of the Following Month is selected the number entered should be less than 500 days."));
-               set_focus('DayNumber');
        }
 
        if ($_POST['DayNumber'] == '')
index 67b1d62767d1b85d13d44bd4d9add0767b6b9bd1..d4e432703703dad660f4beae6dee7d7328a746d9 100644 (file)
@@ -129,11 +129,11 @@ if (!isset($path_to_root) || isset($_GET['path_to_root']) || isset($_POST['path_
        $pagesizes              = array("Letter", "A4"); // default PDF pagesize
 
        /* Default border and spacing for tables */
-       /* Should be moved to CSS */
-
-       $table_style    = "class='tablestyle'";
-       $table_style2   = "class='tablestyle2'";
-
+       /* Should be moved to CSS */
+    $table_style    = "class='tablestyle'";
+    $table_style2   = "class='tablestyle2'";
        /* Accounts Payable */
        /* System check to see if quantity charged on purchase invoices exceeds the quantity received.
        If this parameter is checked the proportion by which the purchase invoice is an overcharge
index c47cc561815c1387fb6a024c3bb51bb69c6a53f0..9378f645219edbab59dc6aeb24b4778a60a853ce 100644 (file)
@@ -61,8 +61,8 @@ function stock_demand_manufacture($stock_id, $qty, $demand_id, $location, $level
                $qoh_stock = array();
                load_stock_levels($location);
        }
-       $stock_qty = $qoh_stock[$stock_id];
-       if ($stock_qty == NULL) $stock_qty = 0;
+       if (empty($qoh_stock[$stock_id])) $stock_qty = 0;
+       else $stock_qty = $qoh_stock[$stock_id];
        if ($qty <= $stock_qty) return $demand;
        $bom = @$bom_list[$stock_id];
        if ($bom == NULL) {
index 4800ddc5e446ec2dcfad76e37d0c7fdd98f96421..dc027b5ad54e394e48769d76aab17ac07ffe29ea 100644 (file)
@@ -94,14 +94,15 @@ function get_transactions($debtorno, $from, $to)
 
 function print_customer_balances()
 {
-    global $path_to_root, $systypes_array;
-
-    $from = $_POST['PARAM_0'];
-    $to = $_POST['PARAM_1'];
-    $fromcust = $_POST['PARAM_2'];
-    $currency = $_POST['PARAM_3'];
-    $comments = $_POST['PARAM_4'];
-       $destination = $_POST['PARAM_5'];
+       global $path_to_root, $systypes_array;
+
+       $from = $_POST['PARAM_0'];
+       $to = $_POST['PARAM_1'];
+       $fromcust = $_POST['PARAM_2'];
+       $currency = $_POST['PARAM_3'];
+       $no_zeros = $_POST['PARAM_4'];
+       $comments = $_POST['PARAM_5'];
+       $destination = $_POST['PARAM_6'];
        if ($destination)
                include_once($path_to_root . "/reporting/includes/excel_report.inc");
        else
@@ -111,7 +112,7 @@ function print_customer_balances()
                $cust = _('All');
        else
                $cust = get_customer_name($fromcust);
-    $dec = user_price_dec();
+       $dec = user_price_dec();
 
        if ($currency == ALL_TEXT)
        {
@@ -121,6 +122,9 @@ function print_customer_balances()
        else
                $convert = false;
 
+       if ($no_zeros) $nozeros = _('Yes');
+       else $nozeros = _('No');
+
        $cols = array(0, 100, 130, 190, 250, 320, 385, 450,     515);
 
        $headers = array(_('Trans Type'), _('#'), _('Date'), _('Due Date'), _('Charges'), _('Credits'),
@@ -131,12 +135,14 @@ function print_customer_balances()
     $params =   array(         0 => $comments,
                                    1 => array('text' => _('Period'), 'from' => $from,          'to' => $to),
                                    2 => array('text' => _('Customer'), 'from' => $cust,        'to' => ''),
-                                   3 => array('text' => _('Currency'), 'from' => $currency, 'to' => ''));
+                                   3 => array('text' => _('Currency'), 'from' => $currency, 'to' => ''),
+                                               4 => array('text' => _('Suppress Zeros'), 'from' => $nozeros, 'to' => ''));
 
     $rep = new FrontReport(_('Customer Balances'), "CustomerBalances", user_pagesize());
     $rep->Font();
     $rep->Info($params, $cols, $headers, $aligns);
     $rep->NewPage();
+
        $grandtotal = array(0,0,0,0);
 
        $sql = "SELECT debtor_no, name, curr_code FROM ".TB_PREF."debtors_master ";
@@ -144,26 +150,32 @@ function print_customer_balances()
                $sql .= "WHERE debtor_no=".db_escape($fromcust);
        $sql .= " ORDER BY name";
        $result = db_query($sql, "The customers could not be retrieved");
+       $num_lines = 0;
 
        while ($myrow = db_fetch($result))
        {
-               if (!$convert && $currency != $myrow['curr_code'])
-                       continue;
+               if (!$convert && $currency != $myrow['curr_code']) continue;
+
+               $bal = get_open_balance($myrow['debtor_no'], $from, $convert);
+               $init[0] = $init[1] = 0.0;
+               $init[0] = round2(abs($bal['charges']), $dec);
+               $init[1] = round2(Abs($bal['credits']), $dec);
+               $init[2] = round2($bal['Allocated'], $dec);
+               $init[3] = round2($bal['OutStanding'], $dec);;
+
+               $res = get_transactions($myrow['debtor_no'], $from, $to);
+               if ($no_zeros && db_num_rows($res) == 0) continue;
+
+               $num_lines++;
                $rep->fontSize += 2;
                $rep->TextCol(0, 2, $myrow['name']);
                if ($convert)
                        $rep->TextCol(2, 3,     $myrow['curr_code']);
                $rep->fontSize -= 2;
-               $bal = get_open_balance($myrow['debtor_no'], $from, $convert);
-               $init[0] = $init[1] = 0.0;
                $rep->TextCol(3, 4,     _("Open Balance"));
-               $init[0] = round2(abs($bal['charges']), $dec);
                $rep->AmountCol(4, 5, $init[0], $dec);
-               $init[1] = round2(Abs($bal['credits']), $dec);
                $rep->AmountCol(5, 6, $init[1], $dec);
-               $init[2] = round2($bal['Allocated'], $dec);
                $rep->AmountCol(6, 7, $init[2], $dec);
-               $init[3] = round2($bal['OutStanding'], $dec);;
                $rep->AmountCol(7, 8, $init[3], $dec);
                $total = array(0,0,0,0);
                for ($i = 0; $i < 4; $i++)
@@ -172,12 +184,12 @@ function print_customer_balances()
                        $grandtotal[$i] += $init[$i];
                }
                $rep->NewLine(1, 2);
-               $res = get_transactions($myrow['debtor_no'], $from, $to);
                if (db_num_rows($res)==0)
                        continue;
                $rep->Line($rep->row + 4);
                while ($trans = db_fetch($res))
                {
+                       if ($no_zeros && $trans['TotalAmount'] == 0 && $trans['Allocated'] == 0) continue;
                        $rep->NewLine(1, 2);
                        $rep->TextCol(0, 1, $systypes_array[$trans['type']]);
                        $rep->TextCol(1, 2,     $trans['reference']);
@@ -225,8 +237,8 @@ function print_customer_balances()
                $rep->TextCol(0, 3, _('Total'));
                for ($i = 0; $i < 4; $i++)
                        $rep->AmountCol($i + 4, $i + 5, $total[$i], $dec);
-       $rep->Line($rep->row  - 4);
-       $rep->NewLine(2);
+               $rep->Line($rep->row  - 4);
+               $rep->NewLine(2);
        }
        $rep->fontSize += 2;
        $rep->TextCol(0, 3, _('Grand Total'));
@@ -235,7 +247,7 @@ function print_customer_balances()
                $rep->AmountCol($i + 4, $i + 5, $grandtotal[$i], $dec);
        $rep->Line($rep->row  - 4);
        $rep->NewLine();
-    $rep->End();
+       $rep->End();
 }
 
-?>
\ No newline at end of file
+?>
index 62128b5022a543ce24c65fd69e1267ef7f80e4f2..7892e2ebc310b686cb9ed67fedb083c8375d4dfd 100644 (file)
@@ -66,13 +66,14 @@ function print_aged_customer_analysis()
 {
     global $path_to_root, $systypes_array;
 
-    $to = $_POST['PARAM_0'];
-    $fromcust = $_POST['PARAM_1'];
-    $currency = $_POST['PARAM_2'];
+       $to = $_POST['PARAM_0'];
+       $fromcust = $_POST['PARAM_1'];
+       $currency = $_POST['PARAM_2'];
        $summaryOnly = $_POST['PARAM_3'];
-    $graphics = $_POST['PARAM_4'];
-    $comments = $_POST['PARAM_5'];
-       $destination = $_POST['PARAM_6'];
+       $no_zeros = $_POST['PARAM_4'];
+       $graphics = $_POST['PARAM_5'];
+       $comments = $_POST['PARAM_6'];
+       $destination = $_POST['PARAM_7'];
        if ($destination)
                include_once($path_to_root . "/reporting/includes/excel_report.inc");
        else
@@ -87,7 +88,7 @@ function print_aged_customer_analysis()
                $from = _('All');
        else
                $from = get_customer_name($fromcust);
-    $dec = user_price_dec();
+       $dec = user_price_dec();
 
        if ($summaryOnly == 1)
                $summary = _('Summary Only');
@@ -101,6 +102,9 @@ function print_aged_customer_analysis()
        else
                $convert = false;
 
+       if ($no_zeros) $nozeros = _('Yes');
+       else $nozeros = _('No');
+
        $PastDueDays1 = get_company_pref('past_due_days');
        $PastDueDays2 = 2 * $PastDueDays1;
        $nowdue = "1-" . $PastDueDays1 . " " . _('Days');
@@ -113,15 +117,16 @@ function print_aged_customer_analysis()
 
        $aligns = array('left', 'left', 'left', 'right', 'right', 'right', 'right',     'right');
 
-    $params =   array(         0 => $comments,
-                                       1 => array('text' => _('End Date'), 'from' => $to, 'to' => ''),
-                                   2 => array('text' => _('Customer'), 'from' => $from, 'to' => ''),
-                                   3 => array('text' => _('Currency'), 'from' => $currency, 'to' => ''),
-                       4 => array('text' => _('Type'),         'from' => $summary,'to' => ''));
+       $params =   array(      0 => $comments,
+                               1 => array('text' => _('End Date'), 'from' => $to, 'to' => ''),
+                               2 => array('text' => _('Customer'),     'from' => $from, 'to' => ''),
+                               3 => array('text' => _('Currency'), 'from' => $currency, 'to' => ''),
+                               4 => array('text' => _('Type'),         'from' => $summary,'to' => ''),
+                               5 => array('text' => _('Suppress Zeros'), 'from' => $nozeros, 'to' => ''));
 
        if ($convert)
                $headers[2] = _('Currency');
-    $rep = new FrontReport(_('Aged Customer Analysis'), "AgedCustomerAnalysis", user_pagesize());
+       $rep = new FrontReport(_('Aged Customer Analysis'), "AgedCustomerAnalysis", user_pagesize());
 
     $rep->Font();
     $rep->Info($params, $cols, $headers, $aligns);
@@ -139,29 +144,28 @@ function print_aged_customer_analysis()
        {
                if (!$convert && $currency != $myrow['curr_code'])
                        continue;
-               $rep->fontSize += 2;
-               $rep->TextCol(0, 2, $myrow['name']);
-               if ($convert)
-               {
-                       $rate = get_exchange_rate_from_home_currency($myrow['curr_code'], $to);
-                       $rep->TextCol(2, 3,     $myrow['curr_code']);
-               }
-               else
-                       $rate = 1.0;
-               $rep->fontSize -= 2;
+
+               if ($convert) $rate = get_exchange_rate_from_home_currency($myrow['curr_code'], $to);
+               else $rate = 1.0;
                $custrec = get_customer_details($myrow['debtor_no'], $to);
                foreach ($custrec as $i => $value)
                        $custrec[$i] *= $rate;
-               $total[0] += ($custrec["Balance"] - $custrec["Due"]);
-               $total[1] += ($custrec["Due"]-$custrec["Overdue1"]);
-               $total[2] += ($custrec["Overdue1"]-$custrec["Overdue2"]);
-               $total[3] += $custrec["Overdue2"];
-               $total[4] += $custrec["Balance"];
                $str = array($custrec["Balance"] - $custrec["Due"],
                        $custrec["Due"]-$custrec["Overdue1"],
                        $custrec["Overdue1"]-$custrec["Overdue2"],
                        $custrec["Overdue2"],
                        $custrec["Balance"]);
+               if ($no_zeros && array_sum($str) == 0) continue;
+
+               $rep->fontSize += 2;
+               $rep->TextCol(0, 2, $myrow['name']);
+               if ($convert) $rep->TextCol(2, 3,       $myrow['curr_code']);
+               $rep->fontSize -= 2;
+               $total[0] += ($custrec["Balance"] - $custrec["Due"]);
+               $total[1] += ($custrec["Due"]-$custrec["Overdue1"]);
+               $total[2] += ($custrec["Overdue1"]-$custrec["Overdue2"]);
+               $total[3] += $custrec["Overdue2"];
+               $total[4] += $custrec["Balance"];
                for ($i = 0; $i < count($str); $i++)
                        $rep->AmountCol($i + 3, $i + 4, $str[$i], $dec);
                $rep->NewLine(1, 2);
@@ -242,4 +246,4 @@ function print_aged_customer_analysis()
     $rep->End();
 }
 
-?>
\ No newline at end of file
+?>
index b176f2bdb8461591bb158f660df28944958fc3f1..1c1ee43839ef40cc80b831805a6d3a0222a61af6 100644 (file)
@@ -82,14 +82,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'];
-    $currency = $_POST['PARAM_3'];
-    $comments = $_POST['PARAM_4'];
-       $destination = $_POST['PARAM_5'];
+       global $path_to_root, $systypes_array;
+
+       $from = $_POST['PARAM_0'];
+       $to = $_POST['PARAM_1'];
+       $fromsupp = $_POST['PARAM_2'];
+       $currency = $_POST['PARAM_3'];
+       $no_zeros = $_POST['PARAM_4'];
+       $comments = $_POST['PARAM_5'];
+       $destination = $_POST['PARAM_6'];
        if ($destination)
                include_once($path_to_root . "/reporting/includes/excel_report.inc");
        else
@@ -99,7 +100,7 @@ function print_supplier_balances()
                $supp = _('All');
        else
                $supp = get_supplier_name($fromsupp);
-    $dec = user_price_dec();
+       $dec = user_price_dec();
 
        if ($currency == ALL_TEXT)
        {
@@ -109,6 +110,9 @@ function print_supplier_balances()
        else
                $convert = false;
 
+       if ($no_zeros) $nozeros = _('Yes');
+       else $nozeros = _('No');
+
        $cols = array(0, 100, 130, 190, 250, 320, 385, 450,     515);
 
        $headers = array(_('Trans Type'), _('#'), _('Date'), _('Due Date'), _('Charges'),
@@ -117,9 +121,10 @@ function print_supplier_balances()
        $aligns = array('left', 'left', 'left', 'left', 'right', 'right', 'right', 'right');
 
     $params =   array(         0 => $comments,
-                                   1 => array('text' => _('Period'), 'from' => $from, 'to' => $to),
-                                   2 => array('text' => _('Supplier'), 'from' => $supp, 'to' => ''),
-                                   3 => array(  'text' => _('Currency'),'from' => $currency, 'to' => ''));
+                       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' => ''));
 
     $rep = new FrontReport(_('Supplier Balances'), "SupplierBalances", user_pagesize());
 
@@ -140,35 +145,37 @@ function print_supplier_balances()
        {
                if (!$convert && $currency != $myrow['curr_code'])
                        continue;
-               $rep->fontSize += 2;
-               $rep->TextCol(0, 2, $myrow['name']);
-               if ($convert)
-                       $rep->TextCol(2, 3,     $myrow['curr_code']);
-               $rep->fontSize -= 2;
                $bal = get_open_balance($myrow['supplier_id'], $from, $convert);
                $init[0] = $init[1] = 0.0;
-               $rep->TextCol(3, 4,     _("Open Balance"));
                $init[0] = round2(abs($bal['charges']), $dec);
-               $rep->AmountCol(4, 5, $init[0], $dec);
                $init[1] = round2(Abs($bal['credits']), $dec);
-               $rep->AmountCol(5, 6, $init[1], $dec);
                $init[2] = round2($bal['Allocated'], $dec);
-               $rep->AmountCol(6, 7, $init[2], $dec);
                $init[3] = round2($bal['OutStanding'], $dec);;
-               $rep->AmountCol(7, 8, $init[3], $dec);
                $total = array(0,0,0,0);
                for ($i = 0; $i < 4; $i++)
                {
                        $total[$i] += $init[$i];
                        $grandtotal[$i] += $init[$i];
                }
-               $rep->NewLine(1, 2);
                $res = getTransactions($myrow['supplier_id'], $from, $to);
-               if (db_num_rows($res)==0)
-                       continue;
+               if ($no_zeros && db_num_rows($res) == 0) continue;
+
+               $rep->fontSize += 2;
+               $rep->TextCol(0, 2, $myrow['name']);
+               if ($convert) $rep->TextCol(2, 3,       $myrow['curr_code']);
+               $rep->fontSize -= 2;
+               $rep->TextCol(3, 4,     _("Open Balance"));
+               $rep->AmountCol(4, 5, $init[0], $dec);
+               $rep->AmountCol(5, 6, $init[1], $dec);
+               $rep->AmountCol(6, 7, $init[2], $dec);
+               $rep->AmountCol(7, 8, $init[3], $dec);
+               $rep->NewLine(1, 2);
+               if (db_num_rows($res)==0) continue;
+
                $rep->Line($rep->row + 4);
                while ($trans=db_fetch($res))
                {
+                       if ($no_zeros && $trans['TotalAmount'] == 0 && $trans['Allocated'] == 0) continue;
                        $rep->NewLine(1, 2);
                        $rep->TextCol(0, 1, $systypes_array[$trans['type']]);
                        $rep->TextCol(1, 2,     $trans['reference']);
@@ -230,4 +237,4 @@ function print_supplier_balances()
     $rep->End();
 }
 
-?>
\ No newline at end of file
+?>
index 2915fc8f54592298508804318e2991ef75b041ea..57ef0e8baaa4cd1d9620479150b0a01381d664f3 100644 (file)
@@ -71,9 +71,11 @@ function print_aged_supplier_analysis()
     $fromsupp = $_POST['PARAM_1'];
     $currency = $_POST['PARAM_2'];
        $summaryOnly = $_POST['PARAM_3'];
-    $graphics = $_POST['PARAM_4'];
-    $comments = $_POST['PARAM_5'];
-       $destination = $_POST['PARAM_6'];
+    $no_zeros = $_POST['PARAM_4'];
+    $graphics = $_POST['PARAM_5'];
+    $comments = $_POST['PARAM_6'];
+       $destination = $_POST['PARAM_7'];
+
        if ($destination)
                include_once($path_to_root . "/reporting/includes/excel_report.inc");
        else
@@ -88,7 +90,7 @@ function print_aged_supplier_analysis()
                $from = _('All');
        else
                $from = get_supplier_name($fromsupp);
-    $dec = user_price_dec();
+       $dec = user_price_dec();
 
        if ($summaryOnly == 1)
                $summary = _('Summary Only');
@@ -101,6 +103,10 @@ function print_aged_supplier_analysis()
        }
        else
                $convert = false;
+
+       if ($no_zeros) $nozeros = _('Yes');
+       else $nozeros = _('No');
+
        $PastDueDays1 = get_company_pref('past_due_days');
        $PastDueDays2 = 2 * $PastDueDays1;
        $nowdue = "1-" . $PastDueDays1 . " " . _('Days');
@@ -114,19 +120,26 @@ function print_aged_supplier_analysis()
 
        $aligns = array('left', 'left', 'left', 'right', 'right', 'right', 'right',     'right');
 
-    $params =   array(         0 => $comments,
-                                   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' => _('Type'), 'from' => $summary,'to' => ''));
+       $params =   array(      0 => $comments,
+                               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' => _('Type'), 'from' => $summary,'to' => ''),
+                               5 => array('text' => _('Suppress Zeros'), 'from' => $nozeros, 'to' => ''));
 
        if ($convert)
                $headers[2] = _('currency');
-    $rep = new FrontReport(_('Aged Supplier Analysis'), "AgedSupplierAnalysis", user_pagesize());
+       $rep = new FrontReport(_('Aged Supplier Analysis'), "AgedSupplierAnalysis", user_pagesize());
 
+<<<<<<< rep202.php
     $rep->Font();
     $rep->Info($params, $cols, $headers, $aligns);
     $rep->NewPage();
+=======
+       $rep->Font();
+       $rep->Info($params, $cols, $headers, $aligns);
+       $rep->Header();
+>>>>>>> 1.7
 
        $total = array();
        $total[0] = $total[1] = $total[2] = $total[3] = $total[4] = 0.0;
@@ -145,31 +158,32 @@ function print_aged_supplier_analysis()
 
        while ($myrow=db_fetch($result))
        {
-               if (!$convert && $currency != $myrow['curr_code'])
-                       continue;
-               $rep->fontSize += 2;
-               $rep->TextCol(0, 2,     $myrow['name']);
-               if ($convert)
-               {
-                       $rate = get_exchange_rate_from_home_currency($myrow['curr_code'], $to);
-                       $rep->TextCol(2, 3,     $myrow['curr_code']);
-               }
-               else
-                       $rate = 1.0;
-               $rep->fontSize -= 2;
+               if (!$convert && $currency != $myrow['curr_code']) continue;
+
+               if ($convert) $rate = get_exchange_rate_from_home_currency($myrow['curr_code'], $to);
+               else $rate = 1.0;
+
                $supprec = get_supplier_details($myrow['supplier_id'], $to);
                foreach ($supprec as $i => $value)
                        $supprec[$i] *= $rate;
-               $total[0] += ($supprec["Balance"] - $supprec["Due"]);
-               $total[1] += ($supprec["Due"]-$supprec["Overdue1"]);
-               $total[2] += ($supprec["Overdue1"]-$supprec["Overdue2"]);
-               $total[3] += $supprec["Overdue2"];
-               $total[4] += $supprec["Balance"];
+
                $str = array($supprec["Balance"] - $supprec["Due"],
                        $supprec["Due"]-$supprec["Overdue1"],
                        $supprec["Overdue1"]-$supprec["Overdue2"],
                        $supprec["Overdue2"],
                        $supprec["Balance"]);
+
+               if ($no_zeros && array_sum($str) == 0) continue;
+
+               $rep->fontSize += 2;
+               $rep->TextCol(0, 2,     $myrow['name']);
+               if ($convert) $rep->TextCol(2, 3,       $myrow['curr_code']);
+               $rep->fontSize -= 2;
+               $total[0] += ($supprec["Balance"] - $supprec["Due"]);
+               $total[1] += ($supprec["Due"]-$supprec["Overdue1"]);
+               $total[2] += ($supprec["Overdue1"]-$supprec["Overdue2"]);
+               $total[3] += $supprec["Overdue2"];
+               $total[4] += $supprec["Balance"];
                for ($i = 0; $i < count($str); $i++)
                        $rep->AmountCol($i + 3, $i + 4, $str[$i], $dec);
                $rep->NewLine(1, 2);
@@ -243,4 +257,4 @@ function print_aged_supplier_analysis()
     $rep->End();
 }
 
-?>
\ No newline at end of file
+?>
index 6fe008d410bceeeb8f3493c0d32d97baea34fb46..e6f00ce8c5b46ec372be7e9ac2797e75a21593d0 100644 (file)
@@ -55,13 +55,14 @@ function getTransactions($supplier, $date)
 
 function print_payment_report()
 {
-    global $path_to_root, $systypes_array;
-
-    $to = $_POST['PARAM_0'];
-    $fromsupp = $_POST['PARAM_1'];
-    $currency = $_POST['PARAM_2'];
-    $comments = $_POST['PARAM_3'];
-       $destination = $_POST['PARAM_4'];
+       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'];
+       $destination = $_POST['PARAM_5'];
        if ($destination)
                include_once($path_to_root . "/reporting/includes/excel_report.inc");
        else
@@ -72,7 +73,7 @@ function print_payment_report()
        else
                $from = get_supplier_name($fromsupp);
 
-    $dec = user_price_dec();
+       $dec = user_price_dec();
 
        if ($currency == ALL_TEXT)
        {
@@ -82,6 +83,9 @@ function print_payment_report()
        else
                $convert = false;
 
+       if ($no_zeros) $nozeros = _('Yes');
+       else $nozeros = _('No');
+
        $cols = array(0, 100, 130, 190, 250, 320, 385, 450,     515);
 
        $headers = array(_('Trans Type'), _('#'), _('Due Date'), '', '',
@@ -90,9 +94,10 @@ function print_payment_report()
        $aligns = array('left', 'left', 'left', 'left', 'right', 'right', 'right', 'right');
 
     $params =   array(         0 => $comments,
-                                   1 => array('text' => _('End Date'), 'from' => $to, 'to' => ''),
-                                   2 => array('text' => _('Supplier'), 'from' => $from, 'to' => ''),
-                                   3 => array(  'text' => _('Currency'),'from' => $currency, 'to' => ''));
+                       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' => ''));
 
     $rep = new FrontReport(_('Payment Report'), "PaymentReport", user_pagesize());
 
@@ -113,25 +118,28 @@ function print_payment_report()
 
        while ($myrow=db_fetch($result))
        {
-               if (!$convert && $currency != $myrow['curr_code'])
-                       continue;
+               if (!$convert && $currency != $myrow['curr_code']) continue;
+
+               $res = getTransactions($myrow['supplier_id'], $to);
+               if ($no_zeros && db_num_rows($res)==0) continue;
+
                $rep->fontSize += 2;
                $rep->TextCol(0, 6, $myrow['name'] . " - " . $myrow['terms']);
                if ($convert)
                        $rep->TextCol(6, 7,     $myrow['curr_code']);
                $rep->fontSize -= 2;
                $rep->NewLine(1, 2);
-               $res = getTransactions($myrow['supplier_id'], $to);
                if (db_num_rows($res)==0)
                        continue;
                $rep->Line($rep->row + 4);
                $total[0] = $total[1] = 0.0;
                while ($trans=db_fetch($res))
                {
-                       if ($convert)
-                               $rate = $trans['rate'];
-                       else
-                               $rate = 1.0;
+                       if ($no_zeros && $trans['TranTotal'] == 0 && $trans['Balance'] == 0) continue;
+
+                       if ($convert) $rate = $trans['rate'];
+                       else $rate = 1.0;
+
                        $rep->NewLine(1, 2);
                        $rep->TextCol(0, 1, $systypes_array[$trans['type']]);
                        $rep->TextCol(1, 2,     $trans['supp_reference']);
@@ -175,4 +183,4 @@ function print_payment_report()
     $rep->End();
 }
 
-?>
\ No newline at end of file
+?>
index b72e9db353f6cbd071edd9e0db23b702b8a2b486..e96f32b81d97881a99983dfd9b91b8b64dfd6d10 100644 (file)
@@ -61,15 +61,17 @@ function getTransactions($category, $location)
 
 function print_stock_check()
 {
-    global $path_to_root, $pic_height, $pic_width;
-
-    $category = $_POST['PARAM_0'];
-    $location = $_POST['PARAM_1'];
-    $pictures = $_POST['PARAM_2'];
-    $check    = $_POST['PARAM_3'];
-    $shortage = $_POST['PARAM_4'];
-    $comments = $_POST['PARAM_5'];
-       $destination = $_POST['PARAM_6'];
+    global $path_to_root, $pic_height;
+
+       $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'];
+       $comments = $_POST['PARAM_6'];
+               $destination = $_POST['PARAM_7'];
+
        if ($destination)
                include_once($path_to_root . "/reporting/includes/excel_report.inc");
        else
@@ -97,7 +99,9 @@ function print_stock_check()
        {
                $short = _('No');
                $available = _('Available');
-       }       
+       }
+       if ($no_zeros) $nozeros = _('Yes');
+       else $nozeros = _('No');
        if ($check)
        {
                $cols = array(0, 100, 250, 295, 345, 390, 445,  515);
@@ -112,21 +116,28 @@ function print_stock_check()
        }
 
 
-    $params =   array(         0 => $comments,
-                                   1 => array('text' => _('Category'), 'from' => $cat, 'to' => ''),
-                                   2 => array('text' => _('Location'), 'from' => $loc, 'to' => ''),
-                                   3 => array('text' => _('Only Shortage'), 'from' => $short, 'to' => ''));
+       $params =   array(      0 => $comments,
+                               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 = "";
 
-    $rep = new FrontReport(_('Stock Check Sheets'), "StockCheckSheet", user_pagesize());
+       $rep = new FrontReport(_('Stock Check Sheets'), "StockCheckSheet", user_pagesize());
 
+<<<<<<< rep303.php
     $rep->Font();
     $rep->Info($params, $cols, $headers, $aligns);
     $rep->NewPage();
+=======
+       $rep->Font();
+       $rep->Info($params, $cols, $headers, $aligns);
+       $rep->Header();
+>>>>>>> 1.22
 
        $res = getTransactions($category, $location);
        $catt = '';
@@ -141,7 +152,9 @@ function print_stock_check()
                $onorder = get_on_porder_qty($trans['stock_id'], $loc_code);
                $flag = get_mb_flag($trans['stock_id']);
                if ($flag == 'M')
-                       $onorder += get_on_worder_qty($trans['stock_id'], $loc_code);
+                       $onorder += get_on_worder_qty($trans['stock_id'], $loc_code);
+               if ($no_zeros && $trans['QtyOnHand'] == 0 && $demandqty == 0 && $onorder == 0)
+                       continue;
                if ($shortage && $trans['QtyOnHand'] - $demandqty >= 0)
                        continue;
                if ($catt != $trans['cat_description'])
index e4831e2b9090ce2c23f2add2751a13cc33e8f89a..d60dfe2abb24c480d18d7799c3f1a3831cdc6d1f 100644 (file)
@@ -32,6 +32,7 @@ $reports->addReport(RC_CUSTOMER, 101, _('Customer &Balances'),
                        _('End Date') => 'DATEENDM',
                        _('Customer') => 'CUSTOMERS_NO_FILTER',
                        _('Currency Filter') => 'CURRENCY',
+                       _('Suppress Zeros') => 'YES_NO',
                        _('Comments') => 'TEXTBOX',
                        _('Destination') => 'DESTINATION'));
 $reports->addReport(RC_CUSTOMER, 102, _('&Aged Customer Analysis'),
@@ -39,6 +40,7 @@ $reports->addReport(RC_CUSTOMER, 102, _('&Aged Customer Analysis'),
                        _('Customer') => 'CUSTOMERS_NO_FILTER',
                        _('Currency Filter') => 'CURRENCY',
                        _('Summary Only') => 'YES_NO',
+                       _('Suppress Zeros') => 'YES_NO',
                        _('Graphics') => 'GRAPHIC',
                        _('Comments') => 'TEXTBOX',
                        _('Destination') => 'DESTINATION'));
@@ -121,6 +123,7 @@ $reports->addReport(RC_SUPPLIER, 201, _('Supplier &Balances'),
                        _('End Date') => 'DATEENDM',
                        _('Supplier') => 'SUPPLIERS_NO_FILTER',
                        _('Currency Filter') => 'CURRENCY',
+                       _('Suppress Zeros') => 'YES_NO',
                        _('Comments') => 'TEXTBOX',
                        _('Destination') => 'DESTINATION'));
 $reports->addReport(RC_SUPPLIER, 202, _('&Aged Supplier Analyses'),
@@ -128,6 +131,7 @@ $reports->addReport(RC_SUPPLIER, 202, _('&Aged Supplier Analyses'),
                        _('Supplier') => 'SUPPLIERS_NO_FILTER',
                        _('Currency Filter') => 'CURRENCY',
                        _('Summary Only') => 'YES_NO',
+                       _('Suppress Zeros') => 'YES_NO',
                        _('Graphics') => 'GRAPHIC',
                        _('Comments') => 'TEXTBOX',
                        _('Destination') => 'DESTINATION'));
@@ -135,6 +139,7 @@ $reports->addReport(RC_SUPPLIER, 203, _('&Payment Report'),
        array(  _('End Date') => 'DATE',
                        _('Supplier') => 'SUPPLIERS_NO_FILTER',
                        _('Currency Filter') => 'CURRENCY',
+                       _('Suppress Zeros') => 'YES_NO',
                        _('Comments') => 'TEXTBOX',
                        _('Destination') => 'DESTINATION'));
 $reports->addReport(RC_SUPPLIER, 204, _('Outstanding &GRNs Report'),
@@ -173,6 +178,7 @@ $reports->addReport(RC_INVENTORY, 303, _('Stock &Check Sheets'),
                        _('Show Pictures') => 'YES_NO',
                        _('Inventory Column') => 'YES_NO',
                        _('Show Shortage') => 'YES_NO',
+                       _('Suppress Zeros') => 'YES_NO',
                        _('Comments') => 'TEXTBOX',
                        _('Destination') => 'DESTINATION'));
 $reports->addReport(RC_INVENTORY, 304, _('Inventory &Sales Report'),
@@ -393,4 +399,4 @@ echo "<script language='javascript'>
 echo $reports->getDisplay();
 
 end_page();
-?>
\ No newline at end of file
+?>
index 3ccbbff711be99af60538e131ce45d6fb4e4d6f4..dcc9cffe44c4c11b3ab491cf18ac1707894b55ff 100644 (file)
@@ -81,7 +81,7 @@ if (isset($_GET['recurrent']))
                display_notification(sprintf(_("%s recurrent invoice(s) created, # $min - # $max."), count($invs)));
                if (count($invs) > 0)
                {
-                       $ar = array('PARAM_0' => $min,  'PARAM_1' => $max, 'PARAM_2' => "",
+                       $ar = array('PARAM_0' => $min."-".ST_SALESINVOICE,      'PARAM_1' => $max."-".ST_SALESINVOICE, 'PARAM_2' => "",
                                'PARAM_3' => 0, 'PARAM_4' => 0, 'PARAM_5' => "", 'PARAM_6' => ST_SALESINVOICE);
                        display_note(print_link(_("&Print Recurrent Invoices # $min - # $max"), 107, $ar), 0, 1);
                        $ar['PARAM_3'] = 1; 
index 9dde9f10a15d7d4ba78c9fcdb591c47af3befb07..e687ec490cf79c504d05792c4c3e7462cb4f93ce 100644 (file)
@@ -215,7 +215,7 @@ if (isset($_POST['ProcessCredit']) && can_process()) {
        if ($new_credit) new_doc_date($_SESSION['Items']->document_date);
     $credit_no = $_SESSION['Items']->write($_POST['WriteOffGLCode']);
 
-       processing_end();exit;
+       processing_end();
        if ($new_credit) {
                meta_forward($_SERVER['PHP_SELF'], "AddedID=$credit_no");
        } else {
index c269b42562a37c7050b6065b5c482d382ab8055b..f9fc78e7cc0a47e0d568dd5ff13a4a09eda8e0e9 100644 (file)
@@ -108,7 +108,7 @@ function get_alloc_trans_sql($extra_fields=null, $extra_conditions=null, $extra_
 
        if ($extra_conditions)
                $sql .= " AND $extra_conditions ";
-       
+
        return $sql;
 }