Merged changes from main trunk up to 2.2.5
authorJanusz Dobrowolski <janusz@frontaccounting.eu>
Tue, 2 Feb 2010 10:02:01 +0000 (10:02 +0000)
committerJanusz Dobrowolski <janusz@frontaccounting.eu>
Tue, 2 Feb 2010 10:02:01 +0000 (10:02 +0000)
45 files changed:
CHANGELOG.txt
admin/gl_setup.php
applications/generalledger.php
config.default.php
gl/bank_transfer.php
gl/includes/db/gl_db_trans.inc
gl/inquiry/balance_sheet.php [new file with mode: 0644]
gl/inquiry/gl_account_inquiry.php
gl/manage/exchange_rates.php
includes/db/manufacturing_db.inc
includes/errors.inc
includes/types.inc
includes/ui/ui_view.inc
js/inserts.js
js/utils.js
purchasing/supplier_payment.php
reporting/includes/doctext.inc
reporting/includes/doctext2.inc
reporting/includes/header2.inc
reporting/includes/reporting.inc
reporting/includes/reports_classes.inc
reporting/rep107.php
reporting/rep108.php
reporting/rep109.php
reporting/rep110.php
reporting/rep111.php
reporting/rep112.php [new file with mode: 0644]
reporting/rep209.php
reporting/rep210.php
reporting/rep601.php
reporting/rep704.php
reporting/rep705.php
reporting/rep706.php
reporting/rep707.php
reporting/rep709.php
reporting/reports_main.php
sales/customer_payments.php
sales/includes/db/sales_order_db.inc
sales/includes/sales_db.inc
sales/inquiry/customer_inquiry.php
sales/sales_order_entry.php
sql/en_US-demo.sql
sql/en_US-new.sql
taxes/tax_types.php
update.html

index 1894dd5b2a961a28a46e8206984b2c4783ed14a3..4e0ee63b5b032781289eebfce5194fe867da931b 100644 (file)
@@ -19,6 +19,102 @@ Legend:
 ! -> Note
 $ -> Affected files
 
+20-Jan-2010 Merged changes from main trunk 2.2.4-2.2.5 as follows
+------------------------------- Release 2.2.5 ----------------------------------
+02-Feb-2010 Joe Hunt
+! Release 2.2.5
+$ $config.default.php
+  update.html
+# Bug in direct invoice when cash sales and no cash account defined in sales pos.
+$ /sales/sales_order_entry.php
+
+01-Feb-2010 Janusz Dobrowolski
+# Fixed error display hidden during ajax call in some situations
+$ /includes/errors.inc
+! Ajax timeout changed to 6/60s without retries, otherwise multiply 
+ errors are generated on fatal failure.
+$ /js/utils.js
+  /js/inserts.js
+
+01-Feb-2010 Joe Hunt
+# [0000198] Bug ignoring shipping cost in Direct Invoice (cash).
+$ /sales/sales_order_entry.php
+# [0000197] Bug in closing some special balance sheet levels.
+$ /gl/inquiry/balance_sheet.php
+  /reporting/rep705.php
+  /reporting/rep706.php
+  /reporting/rep707.php
+
+31-Jan-2010 Joe Hunt
+# Bug in Quick Entries with Tax added.
+$ /includes/ui/ui_view.inc
+
+30-Jan-2010 Joe Hunt/Chaitanya
++ Added a Balance Sheet drilldown inquiry in Banking and GL.
+  Contributed by Chatanya. Magnificient!
+$ /applications/generalledger.php
+  /gl/inquiry/balance_sheet.php (new file)
+  /gl/inquiry/gl_account_inquiry.php
++ Added Purchase tax account in en_US-new.sql and en_US-demo.sql
+$ /sql/en_US-demo.sql
+  /sql/en_US_new.sql
+# Fixed bug in gl accounts checks
+  /taxes/tax_types.php
+
+30-Jan-2010 Janusz Dobrowolski
+# [0000194] Fixed tax records from journal entry (voiding problem)
+$ /gl/includes/db/gl_db_trans.inc
+  /reporting/rep709.php
+
+25-Jan-2010 Joe Hunt
+# [0000195] Bug not deleting refs record when deleting Sales Order, Quotation
+# A couple of redirecting bugs
+$ /sales/sales_order_entry.php
+  /sales/includes/db/sales_order_db.inc
+# Bug in the sequence in sales price pickup
+$ /sales/includes/sales_db.inc
++ Added document Receipt and small rearrangements and bugfixes
+$ /includes/types.inc
+  /includes/ui/ui_view.inc
+  /reporting/rep107.php
+  /reporting/rep108.php
+  /reporting/rep109.php
+  /reporting/rep110.php
+  /reporting/rep111.php
+  /reporting/rep112.php (new document file)
+  /reporting/rep209.php
+  /reporting/rep210.php
+  /reporting/reports_main.php
+  /reporting/includes/doctext.inc
+  /reporting/includes/doctext2.inc
+  /reporting/includes/header2.inc
+  /reporting/includes/reporting.inc
+  /reporting/includes/reports_classes.inc
+  /sales/customer_payments.php
+  /sales/sales_order_entry.php
+  /sales/inquiry/customer_inquiry.php
+  
+22-Jan-2010 Tom Hallman/Joe Hunt
+# Exchange rate doesn't update table when adding new or deleting rate
+$ /gl/manage/exchange_rates.php
+! Small adjustments to Bank Statement and GL Transactions Reports
+$ /reporting/rep601.php
+  /reporting/rep704.php
+! Layout fix for Report Selectors in when running in Windows OS.
+$ /reporting/includes/reports_classes.inc
+
+20-Jan-2010 Joe Hunt
+! Put a heavy warning on marking the checkbox 'Allow Negative Inventory'.
+$ /admin/gl_setup.php
+
+18-Jan-2010 Joe Hunt
+# Demand was calculated double from Sales Quotation. Should be 0.
+$ /includes/db/manufacturing_db.inc
+# A back link was still in Bank Transfer.
+$ /gl/bank_transfer.php
+
+---------- End of changes from main trunk 2.2.4-2.2.5
+
 26-Jan-2010 Janusz Dobrowolski
 + Editable sales terms in sales orders and invoices, default terms from customer record.
 $ /admin/db/company_db.inc
@@ -104,6 +200,7 @@ $ /admin/create_coy.php
 $ /js/utils.js
 
 20-Jan-2010 Merged changes from main trunk 2.2.3-2.2.4 as follows
+
 ------------------------------- Release 2.2.4 ----------------------------------
 17-Jan-2010 Joe Hunt
 ! Release 2.2.4
index ddd2b8e2640d72a07df22852d00f39983d107976..f1b2dbcc853ea79f124db9ea395035bc7bbf7750 100644 (file)
@@ -177,6 +177,7 @@ gl_all_accounts_list_row(_("Purchase Discount Account:"), 'pyt_discount_act', $_
 table_section_title(_("Inventory"));
 
 check_row(_("Allow Negative Inventory:"), 'allow_negative_stock', null);
+label_row(null, _("Warning:  Checking this will result in incorrect values in General Ledger"), "", "class='stockmankofg' colspan=2"); 
 
 table_section_title(_("Items Defaults"));
 gl_all_accounts_list_row(_("Sales Account:"), 'default_inv_sales_act', $_POST['default_inv_sales_act']);
index 676d3b1028ef9860e96bc7900c761a310ea7580c..c227dffae1433c91112c99a205b4dfbfadfc3c57 100644 (file)
@@ -42,6 +42,8 @@ class general_ledger_app extends application
 
                $this->add_rapp_function(1, _("Trial &Balance"),
                        "gl/inquiry/gl_trial_balance.php?", 'SA_GLANALYTIC');
+               $this->add_rapp_function(1, _("Balance &Sheet"),
+                       "gl/inquiry/balance_sheet.php?", 'SA_GLANALYTIC');
                $this->add_rapp_function(1, _("Banking &Reports"),
                        "reporting/reports_main.php?Class=5", 'SA_BANKREP');
                $this->add_rapp_function(1, _("General Ledger &Reports"),
index b0d8043de0311589a8df059995daebe09940ed64..35ae9efd06bfbba6fcb1f6aab08f4d3a2ea018c6 100644 (file)
@@ -56,7 +56,7 @@ if (!isset($path_to_root) || isset($_GET['path_to_root']) || isset($_POST['path_
        // Main Title
        $app_title = "FrontAccounting";
        // application version
-       $version                = "2.3 CVS (m4)";
+       $version                = "2.3 CVS (m5)";
         // src-data compatibility check. Do not change.
        $core_version = "2.3";
 
index 2256a4a041aa93dee001f71e4c6372ccfc3db7af..7ec52cc899a4bb103104c3dd5d6e68ef1added5e 100644 (file)
@@ -42,7 +42,7 @@ if (isset($_GET['AddedID']))
 
        hyperlink_no_params($_SERVER['PHP_SELF'], _("Enter &Another Transfer"));
 
-       safeExit();
+       display_footer_exit();
 }
 
 if (isset($_POST['_DatePaid_changed'])) {
@@ -170,21 +170,11 @@ function handle_add_deposit()
 
 //----------------------------------------------------------------------------------------
 
-function safeExit()
-{
-       echo "<br><br>";
-       end_page();
-       exit;
-}
-
-//----------------------------------------------------------------------------------------
-
 if (isset($_POST['AddPayment']))
 {
        if (check_valid_entries() == true) 
        {
                handle_add_deposit();
-               safeExit();
        }
 }
 
index 45d8eb085a788d0a44c494e8472d47915195e131..7c94063a6e399f477e898fe708dce141851209b0 100644 (file)
@@ -337,8 +337,8 @@ function add_gl_tax_details($gl_code, $trans_type, $trans_no, $amount, $ex_rate,
        if(!$tax_type) return;  // $gl_code is not tax account
        
        $tax = get_tax_type($tax_type);
-       //if ($gl_code == $tax['sales_gl_code']) 
-       //      $amount = -$amount;
+       if ($gl_code == $tax['sales_gl_code']) 
+               $amount = -$amount;
        // we have to restore net amount as we cannot know the base amount
        if ($tax['rate'] == 0) {
 //             display_warning(_("You should not post gl transactions  
@@ -407,14 +407,27 @@ function get_tax_summary($from, $to)
        $todate = date2sql($to);
 
        $sql = "SELECT 
+                               SUM(IF(trans_type=".ST_CUSTCREDIT." || trans_type=".ST_SUPPINVOICE
+                                       ." || trans_type=".ST_JOURNAL.",-1,1)*
+                               IF(trans_type=".ST_BANKDEPOSIT." || trans_type=".ST_SALESINVOICE 
+                                       ." || (trans_type=".ST_JOURNAL ." AND amount<0)"
+                                       ." || trans_type=".ST_CUSTCREDIT.", net_amount*ex_rate,0)) net_output,
+
+                               SUM(IF(trans_type=".ST_CUSTCREDIT." || trans_type=".ST_SUPPINVOICE
+                                       ." || trans_type=".ST_JOURNAL.",-1,1)*
+                               IF(trans_type=".ST_BANKDEPOSIT." || trans_type=".ST_SALESINVOICE
+                                       ." || (trans_type=".ST_JOURNAL ." AND amount<0)"
+                                       ." || trans_type=".ST_CUSTCREDIT.", amount*ex_rate,0)) payable,
+
                                SUM(IF(trans_type=".ST_CUSTCREDIT." || trans_type=".ST_SUPPINVOICE.",-1,1)*
-                               IF(trans_type=".ST_BANKDEPOSIT." || trans_type=".ST_SALESINVOICE." || trans_type=".ST_CUSTCREDIT.", net_amount*ex_rate,0)) net_output,
-                               SUM(IF(trans_type=".ST_CUSTCREDIT." || trans_type=".ST_SUPPINVOICE.",-1,1)*
-                               IF(trans_type=".ST_BANKDEPOSIT." || trans_type=".ST_SALESINVOICE." || trans_type=".ST_CUSTCREDIT.", amount*ex_rate,0)) payable,
-                               SUM(IF(trans_type=".ST_CUSTCREDIT." || trans_type=".ST_SUPPINVOICE.",-1,1)*
-                               IF(trans_type=".ST_BANKDEPOSIT." || trans_type=".ST_SALESINVOICE." || trans_type=".ST_CUSTCREDIT.", 0, net_amount*ex_rate)) net_input,
+                               IF(trans_type=".ST_BANKDEPOSIT." || trans_type=".ST_SALESINVOICE
+                                       ." || (trans_type=".ST_JOURNAL ." AND amount<0)"
+                                       ." || trans_type=".ST_CUSTCREDIT.", 0, net_amount*ex_rate)) net_input,
+
                                SUM(IF(trans_type=".ST_CUSTCREDIT." || trans_type=".ST_SUPPINVOICE.",-1,1)*
-                               IF(trans_type=".ST_BANKDEPOSIT." || trans_type=".ST_SALESINVOICE." || trans_type=".ST_CUSTCREDIT.", 0, amount*ex_rate)) collectible,
+                               IF(trans_type=".ST_BANKDEPOSIT." || trans_type=".ST_SALESINVOICE
+                                       ." || (trans_type=".ST_JOURNAL ." AND amount<0)"
+                                       ." || trans_type=".ST_CUSTCREDIT.", 0, amount*ex_rate)) collectible,
                                taxrec.rate,
                                ttype.id,
                                ttype.name
@@ -469,7 +482,7 @@ function write_journal_entries(&$cart, $reverse, $use_transaction=true)
        }
                // store tax details if the gl account is a tax account
                add_gl_tax_details($journal_item->code_id, 
-                       ($journal_item->amount < 0.0 ? ST_BANKDEPOSIT : ST_BANKPAYMENT), $trans_id, -$journal_item->amount, 1, $date_, $memo_);
+                       ST_JOURNAL, $trans_id, $journal_item->amount, 1, $date_, $memo_);
        }
        
        if ($new) {
@@ -506,7 +519,7 @@ function write_journal_entries(&$cart, $reverse, $use_transaction=true)
                }
                        // store tax details if the gl account is a tax account
                        add_gl_tax_details($journal_item->code_id, 
-                               ($journal_item->amount < 0.0 ? ST_BANKDEPOSIT : ST_BANKPAYMENT), $trans_id, $journal_item->amount, 1, $reversingDate, $memo_);
+                               ST_JOURNAL, $trans_id, $journal_item->amount, 1, $reversingDate, $memo_);
        }
 
        add_comments($trans_type, $trans_id_reverse, $reversingDate, $memo_);
diff --git a/gl/inquiry/balance_sheet.php b/gl/inquiry/balance_sheet.php
new file mode 100644 (file)
index 0000000..370dfda
--- /dev/null
@@ -0,0 +1,361 @@
+<?php
+/**********************************************************************
+    Copyright (C) FrontAccounting, LLC.
+       Released under the terms of the GNU General Public License, GPL, 
+       as published by the Free Software Foundation, either version 3 
+       of the License, or (at your option) any later version.
+    This program is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
+    See the License here <http://www.gnu.org/licenses/gpl-3.0.html>.
+***********************************************************************/
+$page_security = 'SA_GLANALYTIC';
+$path_to_root="../..";
+
+include_once($path_to_root . "/includes/session.inc");
+
+include_once($path_to_root . "/includes/date_functions.inc");
+include_once($path_to_root . "/includes/ui.inc");
+include_once($path_to_root . "/includes/data_checks.inc");
+
+include_once($path_to_root . "/gl/includes/gl_db.inc");
+
+$js = "";
+if ($use_date_picker)
+       $js = get_js_date_picker();
+
+page(_($help_context = "Balance Sheet"), false, false, "", $js);
+
+//----------------------------------------------------------------------------------------------------
+// Ajax updates
+
+if (get_post('Show')) 
+{
+       $Ajax->activate('balance_tbl');
+}
+
+if (isset($_GET["TransFromDate"]))
+       $_POST["TransFromDate"] = $_GET["TransFromDate"];       
+if (isset($_GET["TransToDate"]))
+       $_POST["TransToDate"] = $_GET["TransToDate"];
+if (isset($_GET["AccGrp"]))
+       $_POST["AccGrp"] = $_GET["AccGrp"];     
+
+//----------------------------------------------------------------------------------------------------
+
+function is_of_account_type($accttype,$typeslist)
+{
+       return in_array($accttype, $typeslist);
+}
+
+function get_child_account_types($acctype)
+{
+       global $parentsarr;
+       $parentsarr = array();
+       $childernsarr = array();
+       $list = '';
+       array_push($parentsarr, $acctype);
+    while (sizeof($parentsarr)>0)
+    {
+               $parent = array_pop($parentsarr);
+               array_push($childernsarr,$parent);
+               pushchilds($parent);
+       }
+       $list = substr($list,0,-1);
+       return $childernsarr;
+}
+
+function pushchilds($parent)
+{
+       global $parentsarr;
+
+       $sql = "SELECT id FROM  ".TB_PREF."chart_types WHERE parent=".$parent;
+       $result = db_query($sql,"Query failed");   
+       while ($myrow=db_fetch($result))
+       {
+               array_push($parentsarr, $myrow['id']);
+       }
+}
+
+function inquiry_controls()
+{
+   
+    start_table("class='tablestyle_noborder'");
+       date_cells(_("As at:"), 'TransToDate');
+       submit_cells('Show',_("Show"),'','', 'default');
+    end_table();
+
+       hidden('TransFromDate');
+       hidden('AccGrp');
+
+}
+
+function print_balance_sheet()
+{
+       global $comp_path, $path_to_root, $table_style;
+       
+       $from = begin_fiscalyear();
+       $to = $_POST['TransToDate'];
+       
+       $dim = get_company_pref('use_dimension');
+       $dimension = $dimension2 = 0;   
+       
+       $classname = '';
+       $classopen = 0.0;
+       $classperiod = 0.0;
+       $classclose = 0.0;
+       $assetsopen = 0.0;
+       $assetsperiod = 0.0;
+       $assetsclose = 0.0;
+       $equityopen = 0.0;
+       $equityperiod = 0.0;
+       $equityclose = 0.0;
+       $lopen = 0.0;
+       $lperiod = 0.0;
+       $lclose = 0.0;
+       
+       $typeopen = array(0,0,0,0,0,0,0,0,0,0);
+       $typeperiod = array(0,0,0,0,0,0,0,0,0,0);
+       $typeclose = array(0,0,0,0,0,0,0,0,0,0);
+       $typename = array('','','','','','','','','','');
+       $acctype = array('','','','','','','','','','');
+       $closing = array(-1,-1,-1,-1,-1,-1,-1,-1,-1,-1);
+       //$parent = array(-1,-1,-1,-1,-1,-1,-1,-1,-1,-1);
+       $level = 0;
+       $last = -1;
+       
+       $closeclass = false;
+       $ctype = 0;
+       $convert = 1;   
+
+       $accounts = get_gl_accounts_all(1);
+       
+       div_start('balance_tbl');
+
+       start_table("width=30% $table_style");
+       
+       while ($account=db_fetch($accounts))
+       {
+               if ($account['account_code'] == null && $account['parent'] > 0)
+                       continue;
+
+               //Check for confirming the account type
+               if (isset($_POST['AccGrp']) && (strlen($_POST['AccGrp']) > 0) )
+               {       
+                       $sub_types_arr = get_child_account_types($_POST['AccGrp']);
+                       if (!is_of_account_type($account['AccountType'], $sub_types_arr))
+                               continue;
+               }
+                                                       
+               if ($account['account_code'] != null)
+               {
+                       $prev_balance = get_gl_balance_from_to("", $from, $account["account_code"], $dimension, $dimension2);
+
+                       $curr_balance = get_gl_trans_from_to($from, $to, $account["account_code"], $dimension, $dimension2);
+
+                       if (!$prev_balance && !$curr_balance)
+                               continue;
+               }
+               if ($account['AccountClassName'] != $classname)
+               {
+                       if ($classname != '')
+                       {
+                               $closeclass = true;
+                       }
+               }
+               if ($account['AccountTypeName'] != $typename[$level])
+               {
+                       if ($typename[$level] != '')
+                       {
+                               for ( ; $level >= 0, $typename[$level] != ''; $level--) 
+                               {
+                                       if ($account['parent'] == $closing[$level] || $account['parent'] < $last || $account['parent'] <= 0 || $closeclass)
+                                       {       
+                                       
+                                               $url = "<a href='$path_to_root/gl/inquiry/balance_sheet.php?TransFromDate=" 
+                                                       . $from . "&TransToDate=" . $to 
+                                                       . "&AccGrp=" . $acctype[$level] . "'>" . $typename[$level] . "</a>";
+                                                                               
+                                               alt_table_row_color($k);
+                                               label_cell($url);
+                                               amount_cell($typeclose[$level] * $convert);
+                                               end_row();                                              
+
+                                               $typeopen[$level] = $typeperiod[$level] = $typeclose[$level] = 0.0;
+                                       }       
+                                       else
+                                               break;
+                               }
+
+                               if ($closeclass)
+                               {       
+                                       start_row("class='inquirybg' style='font-weight:bold'");
+                                       label_cell(_('Total') . " " . $classname);
+                                       amount_cell($classclose * $convert, true);
+                                       end_row();                                              
+                                                               
+                                       if ($ctype == CL_EQUITY)
+                                       {
+                                               $equityopen += $classopen;
+                                               $equityperiod += $classperiod;
+                                               $equityclose += $classclose;
+                                       }
+                                       if ($ctype == CL_LIABILITIES)
+                                       {
+                                               $lopen += $classopen;
+                                               $lperiod += $classperiod;
+                                               $lclose += $classclose;
+                                       }
+                                       $assetsopen += $classopen;
+                                       $assetsperiod += $classperiod;
+                                       $assetsclose += $classclose;
+                                       $classopen = $classperiod = $classclose = 0.0;
+
+                                       $closeclass = false;
+                               }
+                       }
+                       if ($account['AccountClassName'] != $classname)
+                       {
+                               if (isset($_POST['AccGrp']) && (strlen($_POST['AccGrp']) > 0))
+                                       table_section_title($account['AccountTypeName']);
+                               else 
+                                       table_section_title($account['AccountClassName']);
+                       }
+                       $level++;
+                       if ($account['parent'] != $last)
+                               $last = $account['parent'];
+                       $typename[$level] = $account['AccountTypeName'];
+                       
+                       $acctype[$level] = $account['AccountType'];
+                       
+                       $closing[$level] = $account['parent'];
+
+               }
+               $classname = $account['AccountClassName'];
+               $classtype = $account['AccountType'];
+               $ctype = $account['ClassType'];
+               $convert = get_class_type_convert($ctype); 
+
+               if ($account['account_code'] != null)
+               {
+                       for ($i = 0; $i <= $level; $i++)
+                       {
+                               $typeopen[$i] += $prev_balance;
+                               $typeperiod[$i] += $curr_balance;
+                               $typeclose[$i] = $typeopen[$i] + $typeperiod[$i];
+                       }
+                       $classopen += $prev_balance;
+                       $classperiod += $curr_balance;
+                       $classclose = $classopen + $classperiod;
+
+                       //Show accounts details only for drill down and direct child of Account Group
+                       if ( isset($_POST['AccGrp']) && ($account['AccountType'] == $_POST['AccGrp']))
+                       {
+                               $url = "<a href='$path_to_root/gl/inquiry/gl_account_inquiry.php?TransFromDate=" 
+                                       . $from . "&TransToDate=" . $to 
+                                       . "&account=" . $account['account_code'] . "'>" . $account['account_code'] 
+                                       ." ". $account['account_name'] ."</a>";                         
+                                       
+                               start_row("class='stockmankobg'");
+                               label_cell($url);
+                               amount_cell(($curr_balance + $prev_balance) * $convert);
+                               end_row();
+                       }
+               }       
+       }
+       
+       if ($account['AccountClassName'] != $classname)
+       {
+               if ($classname != '')
+               {
+                       $closeclass = true;
+               }
+       }
+       if ($account['AccountTypeName'] != $typename[$level])
+       {
+
+               if ($typename[$level] != '')
+               {
+                       for ( ; $level >= 0, $typename[$level] != ''; $level--) 
+                       {
+                               if ($account['parent'] == $closing[$level] || $account['parent'] < $last || $account['parent'] <= 0 || $closeclass)
+                               {
+                                       //Inside drill down, no hyperlink
+                                       if (isset($_POST['AccGrp']) && (strlen($_POST['AccGrp']) > 0) && ($acctype[$level] == $_POST['AccGrp']))
+                                       {
+                                               start_row("class='inquirybg' style='font-weight:bold'");
+                                               label_cell(_('Total') . " " .$typename[$level]);
+                                               amount_cell($typeclose[$level] * $convert);
+                                               end_row();                                                      
+                                       }
+                                       else
+                                       {
+                                               $url = "<a href='$path_to_root/gl/inquiry/balance_sheet.php?TransFromDate=" 
+                                                       . $from . "&TransToDate=" . $to 
+                                                       . "&AccGrp=" . $acctype[$level] . "'>" . $typename[$level] . "</a>";                                    
+                                               
+                                               alt_table_row_color($k);
+                                               label_cell($url);
+                                               amount_cell($typeclose[$level] * $convert);
+                                               end_row();                                                      
+                                       }
+                                       
+                                       $typeopen[$level] = $typeperiod[$level] = $typeclose[$level] = 0.0;                                     
+                                       
+                               }
+                               else
+                                       break;
+
+                       }
+
+                       if (($closeclass) && !(isset($_POST['AccGrp']) && (strlen($_POST['AccGrp']) > 0)) )
+                       {
+                               $calculateopen = -$assetsopen - $classopen;
+                               $calculateperiod = -$assetsperiod - $classperiod;
+                               $calculateclose = -$assetsclose  - $classclose;
+                               if ($ctype == CL_EQUITY)
+                               {
+                                       $equityopen += $classopen;
+                                       $equityperiod += $classperiod;
+                                       $equityclose += $classclose;
+                               }
+                       
+                               alt_table_row_color($k);
+                               label_cell(_('Calculated Return'));
+                               amount_cell($calculateclose * $convert);
+                               end_row();      
+                                                       
+                               start_row("class='inquirybg' style='font-weight:bold'");
+                               label_cell(_('Total') . " " . $classname);
+                               amount_cell(-$assetsclose * $convert);
+                               end_row();                                      
+                               
+                               if ($equityopen != 0.0 || $equityperiod != 0.0 || $equityclose != 0.0 ||
+                                       $lopen != 0.0 || $lperiod != 0.0 || $lclose != 0.0)
+                               {
+                                       alt_table_row_color($k);
+                                       label_cell(_('Total') . " " . _('Liabilities') . _(' and ') . _('Equities'));
+                                       amount_cell(($lclose + $equityclose + $calculateclose) * -1);
+                                       end_row();      
+                               }
+                       }
+               }
+       }
+       end_table(1); // outer table
+       div_end();
+}
+
+//----------------------------------------------------------------------------------------------------
+
+start_form();
+
+inquiry_controls();
+
+print_balance_sheet();
+
+end_form();
+
+end_page();
+
+?>
+
index a86f0c2b6a518464381b9bd13f1723f5e5922d65..5612e36333a2a3579555f1c14fe9e4232b0a925d 100644 (file)
@@ -228,7 +228,7 @@ gl_inquiry_controls();
 
 div_start('trans_tbl');
 
-if (get_post('Show'))
+if (get_post('Show') || get_post('account'))
     show_results();
 
 div_end();
index 9ea1c17f71f0c0cf26c51b37b85979dbd266bed0..e50fc5f308ae6995876c35213866cffca5005969 100644 (file)
@@ -67,6 +67,7 @@ function handle_submit()
        }
 
        $selected_id = '';
+       clear_data();
 }
 
 //---------------------------------------------------------------------------------------------
@@ -79,6 +80,7 @@ function handle_delete()
                return;
        delete_exchange_rate($selected_id);
        $selected_id = '';
+       clear_data();
 }
 
 //---------------------------------------------------------------------------------------------
index 14927475ed8ad206f406051bf239b6bde12d7320..1e8af932385ed5b12f861f2e32a032f4f9ff30fa 100644 (file)
@@ -17,7 +17,8 @@ function get_demand_qty($stock_id, $location)
                        FROM ".TB_PREF."sales_order_details,
                                        ".TB_PREF."sales_orders
                                WHERE ".TB_PREF."sales_order_details.order_no="
-                               .TB_PREF."sales_orders.order_no AND ";
+                               .TB_PREF."sales_orders.order_no AND ".TB_PREF."sales_orders.trans_type=".ST_SALESORDER." AND 
+                               ".TB_PREF."sales_orders.trans_type=".TB_PREF."sales_order_details.trans_type AND ";
        if ($location != "")
                $sql .= TB_PREF."sales_orders.from_stk_loc =".db_escape($location)." AND ";
        $sql .= TB_PREF."sales_order_details.stk_code = ".db_escape($stock_id);
@@ -101,7 +102,9 @@ function get_demand_asm_qty($stock_id, $location)
                                   FROM ".TB_PREF."sales_order_details,
                                                ".TB_PREF."sales_orders,
                                                ".TB_PREF."stock_master
-                                  WHERE ".TB_PREF."sales_orders.order_no = ".TB_PREF."sales_order_details.order_no AND ";
+                                  WHERE ".TB_PREF."sales_orders.order_no = ".TB_PREF."sales_order_details.order_no AND 
+                                       ".TB_PREF."sales_orders.trans_type=".ST_SALESORDER." AND 
+                                       ".TB_PREF."sales_orders.trans_type=".TB_PREF."sales_order_details.trans_type AND ";
        if ($location != "")
                $sql .= TB_PREF."sales_orders.from_stk_loc =".db_escape($location)." AND ";
        $sql .= TB_PREF."sales_order_details.quantity-".TB_PREF."sales_order_details.qty_sent > 0 AND
index fc8f4fb692fca3205b277009755fd70291cf90df..551d32e4438a2c5b63f260d2e5adf84ac96be76d 100644 (file)
@@ -85,9 +85,9 @@ function error_box() {
     global $before_box;
     
     echo "<div id='msgbox'>";
-       $before_box = ob_get_clean(); // save html content before error box 
+
 // Necessary restart instead of get_contents/clean calls due to a bug in php 4.3.2
-       register_shutdown_function('end_flush');
+       $before_box = ob_get_clean(); // save html content before error box 
     ob_start('output_html');
     echo "</div>";
 }
@@ -99,8 +99,8 @@ function end_flush () {
 
        if (isset($Ajax))
                $Ajax->run();
-
-       if (ob_get_level()) ob_end_flush();
+       // flush all output buffers (works also with exit inside any div levels)
+       while(ob_get_level()) ob_end_flush();
 }
 
 function display_db_error($msg, $sql_statement=null, $exit=true)
index 3636a4936e3eee4287504da194059956ee210755..c7bb52c2b3e013cd982285922cfee684891b823c 100644 (file)
@@ -42,6 +42,11 @@ define('ST_SALESQUOTE', 32);
 define('ST_COSTUPDATE', 35);
 define('ST_DIMENSION', 40);
 
+// Don't include these defines in the $systypes_array.
+// They are used for documents only.
+define ('ST_STATEMENT', 91);
+define ('ST_CHEQUE', 92);
+
 $systypes_array = array (
        ST_JOURNAL => _("Journal Entry"),
        ST_BANKPAYMENT => _("Bank Payment"),
index 8e2591c3a9328ae619354dfa38a25e2e2e361369..65b6bf91f00541814f581ad3dcc62616870f6b24 100644 (file)
@@ -597,9 +597,10 @@ function display_quick_entries(&$cart, $id, $base, $type, $descr='')
                                        if (substr($qe_line['action'],0,1) != 'T') 
                                                $part = $taxbase;
                                        else
-                                               $part = $base;
+                                               $part = $base/100;
                                        $item_tax = get_tax_type($qe_line['dest_id']);
-                                       if ($type == QE_SUPPINV && substr($qe_line['action'],0,1) != 'T')
+                                       //if ($type == QE_SUPPINV && substr($qe_line['action'],0,1) != 'T')
+                                       if ($type == QE_SUPPINV)
                                        {
                                                $taxgroup = $cart->tax_group_id;
                                                $rates = 0;
@@ -649,6 +650,86 @@ function display_quick_entries(&$cart, $id, $base, $type, $descr='')
        return $bank_amount;
 }
 
+//--------------------------------------------------------------------------------------
+//
+//     Simple English version of number to words conversion.
+//
+function _number_to_words($number) 
+{ 
+    $Bn = floor($number / 1000000000); /* Billions (giga) */ 
+    $number -= $Bn * 1000000000; 
+    $Gn = floor($number / 1000000);  /* Millions (mega) */ 
+    $number -= $Gn * 1000000; 
+    $kn = floor($number / 1000);     /* Thousands (kilo) */ 
+    $number -= $kn * 1000; 
+    $Hn = floor($number / 100);      /* Hundreds (hecto) */ 
+    $number -= $Hn * 100; 
+    $Dn = floor($number / 10);       /* Tens (deca) */ 
+    $n = $number % 10;               /* Ones */
+
+    $res = ""; 
+
+    if ($Bn) 
+        $res .= _number_to_words($Bn) . " Billion"; 
+    if ($Gn) 
+        $res .= (empty($res) ? "" : " ") . _number_to_words($Gn) . " Million"; 
+    if ($kn) 
+        $res .= (empty($res) ? "" : " ") . _number_to_words($kn) . " Thousand"; 
+    if ($Hn) 
+        $res .= (empty($res) ? "" : " ") . _number_to_words($Hn) . " Hundred"; 
+
+    $ones = array("", "One", "Two", "Three", "Four", "Five", "Six", 
+        "Seven", "Eight", "Nine", "Ten", "Eleven", "Twelve", "Thirteen", 
+        "Fourteen", "Fifteen", "Sixteen", "Seventeen", "Eightteen", 
+        "Nineteen"); 
+    $tens = array("", "", "Twenty", "Thirty", "Fourty", "Fifty", "Sixty", 
+        "Seventy", "Eigthy", "Ninety"); 
+
+    if ($Dn || $n) 
+    { 
+        if (!empty($res)) 
+            $res .= " and "; 
+        if ($Dn < 2) 
+            $res .= $ones[$Dn * 10 + $n]; 
+        else 
+        { 
+            $res .= $tens[$Dn]; 
+            if ($n) 
+                $res .= "-" . $ones[$n]; 
+        } 
+    } 
+
+    if (empty($res)) 
+        $res = "zero"; 
+    return $res; 
+} 
+
+function price_in_words($amount, $document=0)
+{
+       global $Hooks;
+       // use local price_in_words() if the hook is defined
+       if (method_exists($Hooks, 'price_in_words'))
+       {
+               return $Hooks->price_in_words($amount, $document);
+       }
+       // Only usefor Remittance and Receipts as default
+       if (!($document == ST_SUPPAYMENT || $document == ST_CUSTPAYMENT || $document == ST_CHEQUE))
+               return "";
+       if ($amount < 0 || $amount > 999999999999)
+               return "";
+       $dec = user_price_dec();
+       if ($dec > 0)
+       {
+               $divisor = pow(10, $dec);       
+               $frac = round2($amount - floor($amount), $dec) * $divisor;
+               $frac = sprintf("%0{$dec}d", $frac);
+               $and = _("and");
+       $frac = " $and $frac/$divisor";
+    }
+    else
+       $frac = "";
+    return _number_to_words(intval($amount)) . $frac;
+}    
 
 function get_js_open_window($width, $height)
 {
index a853a716bf4ecef25bd3acfeaefdbd7a5da3184a..5b8d73a7686832d9fc298a4a6f248c0dc9892ffe 100644 (file)
@@ -220,7 +220,7 @@ var inserts = {
                    e.onclick = function() {
                            save_focus(e);
                                        if (e.getAttribute('aspect') == 'process')
-                                               JsHttpRequest.request(this, null, 30000);
+                                               JsHttpRequest.request(this, null, 60000);
                                        else
                                                JsHttpRequest.request(this);
                                return false;
index 1f63f301167edbbe012ad6012315c011d769168e..8d707b3dd01682212d6add3644cc0e21f4dfa690 100644 (file)
@@ -35,10 +35,10 @@ function disp_msg(msg, cl) {
 // 
 JsHttpRequest.request= function(trigger, form, tout) {
 //     if (trigger.type=='submit' && !validate(trigger)) return false;
-       tout = tout | 3000;     // default timeout value
+       tout = tout | 6000;     // default timeout value
        document.getElementById('msgbox').innerHTML='';
-       set_mark(tout>5000 ? 'progressbar.gif' : 'ajax-loader.gif');
-       JsHttpRequest._request(trigger, form, tout, 2);
+       set_mark(tout>10000 ? 'progressbar.gif' : 'ajax-loader.gif');
+       JsHttpRequest._request(trigger, form, tout, 0);
 }
 
 JsHttpRequest._request = function(trigger, form, tout, retry) {
index 0c8aa7dd4940c75979d984fafdf4f6ec9e786a93..e0aa2d08bd2f2b77ea82eb6e97582f6ea33d7a03 100644 (file)
@@ -73,7 +73,7 @@ if (isset($_GET['AddedID']))
        submenu_print(_("&Print This Remittance"), ST_SUPPAYMENT, $payment_id."-".ST_SUPPAYMENT, 'prtopt');
        submenu_print(_("&Email This Remittance"), ST_SUPPAYMENT, $payment_id."-".ST_SUPPAYMENT, null, 1);
 
-    display_note(get_gl_view_str(22, $payment_id, _("View the GL &Journal Entries for this Payment")));
+    display_note(get_gl_view_str(ST_SUPPAYMENT, $payment_id, _("View the GL &Journal Entries for this Payment")));
 
 //    hyperlink_params($path_to_root . "/purchasing/allocations/supplier_allocate.php", _("&Allocate this Payment"), "trans_no=$payment_id&trans_type=22");
 
index 40a0802b5a3fa65224c72e28861a15b34586460d..c76cfed9a7f92f80bc79de5aa8ca6b47fc9ac191 100644 (file)
@@ -20,7 +20,10 @@ if (isset($header2type))
        }
        else
        {
-               $doc_Charge_To = _("Charge To");
+               if ($doctype == ST_CUSTPAYMENT)
+                       $doc_Charge_To = _("With thanks from");
+               else    
+                       $doc_Charge_To = _("Charge To");
                $doc_Delivered_To = _("Delivered To");
        }       
        $doc_Shipping_Company = _("Shipping Company");
@@ -42,7 +45,7 @@ if (isset($header2type))
        }       
        else
        {
-               if ($doctype == ST_SUPPAYMENT)
+               if ($doctype == ST_SUPPAYMENT || $doctype == ST_CUSTPAYMENT)
                        $doc_Our_Ref = _("Type");
                else    
                        $doc_Our_Ref = _("Sales Person");
@@ -53,10 +56,13 @@ if (isset($header2type))
        }
        $doc_Our_VAT_no = _("Our VAT No.");
        $doc_Domicile = _("Domicile");
+       $doc_Extra = "";
        if($doctype == ST_CUSTDELIVERY || $doctype == ST_SALESQUOTE || $doctype == ST_PURCHORDER || $doctype == ST_SALESORDER ||
-               $doctype == ST_SUPPAYMENT) {
-        $doc_Bank_Account = '';
-        $doc_Please_Quote = _("All amounts stated in");
+               $doctype == ST_SUPPAYMENT || $doctype == ST_CUSTPAYMENT) {
+               if ($doctype == ST_CUSTPAYMENT)
+                       $doc_Extra = _("* Subject to Realisation of the Cheque.");
+               $doc_Bank_Account = '';
+               $doc_Please_Quote = _("All amounts stated in");
   } else {
         $doc_Bank_Account = _("Bank Account");
         $doc_Please_Quote = $doctype==ST_SALESINVOICE ? 
@@ -68,7 +74,8 @@ if (isset($header2type))
        $doc_Bank = _("Bank");
        $doc_Payment_Link = _("You can pay through");
        if ($doctype == ST_SALESQUOTE || $doctype == ST_PURCHORDER || $doctype == ST_SALESORDER || $doctype == ST_SALESINVOICE || 
-               $doctype == ST_CUSTCREDIT || $doctype == ST_CUSTDELIVERY || $doctype == ST_WORKORDER || $doctype == ST_SUPPAYMENT)
+               $doctype == ST_CUSTCREDIT || $doctype == ST_CUSTDELIVERY || $doctype == ST_WORKORDER || $doctype == ST_SUPPAYMENT || 
+               $doctype == ST_CUSTPAYMENT)
        {
                if ($doctype == ST_SALESQUOTE)
                        $this->title = _("SALES QUOTATION");
@@ -84,6 +91,8 @@ if (isset($header2type))
                        $this->title = _("WORK ORDER");
                elseif ($doctype == ST_SUPPAYMENT)
                        $this->title = _("REMITTANCE");
+               elseif ($doctype == ST_CUSTPAYMENT)
+                       $this->title = _("RECEIPT");
                else
                        $this->title = _("CREDIT NOTE");
                if ($doctype == ST_PURCHORDER)
@@ -92,13 +101,13 @@ if (isset($header2type))
                elseif ($doctype == ST_WORKORDER)
                        $this->headers = array(_("Item Code"), _("Item Description"),
                                _("From Location"), _("Work Centre"),   _("Unit Quantity"), _("Total Quantity"), _("Units Issued"));
-               elseif ($doctype == ST_SUPPAYMENT)
+               elseif ($doctype == ST_SUPPAYMENT || $doctype == ST_CUSTPAYMENT)
                        $this->headers = array(_("Trans Type"), _("#"), _("Date"), _("Due Date"), _("Total Amount"), _("Left to Allocate"), _("This Allocation"));
                else
                        $this->headers = array(_("Item Code"), _("Item Description"),   _("Quantity"),
                                _("Unit"), _("Price"), _("Discount %"), _("Total"));
        }
-       else if ($doctype == ST_CUSTPAYMENT)
+       else if ($doctype == ST_STATEMENT)
        {
                $this->title = _("STATEMENT");
                $this->headers = array(_("Trans Type"), _("#"), _("Date"), _("DueDate"), _("Charges"),
@@ -115,9 +124,10 @@ if (isset($emailtype))
 if (isset($header2type) || isset($linetype))
 {
        $doc_Invoice_no = ($doctype==ST_CUSTDELIVERY ? _("Delivery Note No.") : 
+               ($doctype == ST_CUSTPAYMENT ? _("Receipt No.") :
                ($doctype == ST_SUPPAYMENT ? _("Remittance No.") :
                (($doctype==ST_SALESQUOTE || $doctype==ST_PURCHORDER || $doctype==ST_SALESORDER) ? _("Order no.") : 
-               ($doctype==ST_SALESINVOICE ? _("Invoice No.") : ($doctype==ST_WORKORDER ? _("Word Order No") : _("Credit No."))))));
+               ($doctype==ST_SALESINVOICE ? _("Invoice No.") : ($doctype==ST_WORKORDER ? _("Word Order No") : _("Credit No.")))))));
        $doc_Delivery_no = _("Delivery Note No.");
        $doc_Order_no = _("Order no.");
 }
@@ -136,13 +146,22 @@ if (isset($linetype))
                $doc_TOTAL_PO = _("TOTAL PO EX VAT");
                $doc_TOTAL_DELIVERY = _("TOTAL DELIVERY INCL. VAT");
        }
-       elseif ($doctype == ST_SUPPAYMENT)
+       elseif ($doctype == ST_SUPPAYMENT || ST_CUSTPAYMENT)
        {
+               $doc_Towards = _("As advance / full / part / payment towards:");
+               $doc_by_Cheque = _("By Cash / Cheque* / Draft No.");
+               $doc_Dated = _("Dated");
+               $doc_Drawn = _("Drawn on Bank");
+               $doc_Drawn_Branch = _("Branch");
+               $doc_Received = _("Received / Sign");
                $doc_Total_Allocated = _("Total Allocated");
                $doc_Left_To_Allocate = _("Left to Allocate");
-               $doc_Total_Payment = _("TOTAL REMITTANCE");
+               if ($doctype == ST_CUSTPAYMENT)
+                       $doc_Total_Payment = _("TOTAL RECEIPT");
+               else    
+                       $doc_Total_Payment = _("TOTAL REMITTANCE");
        }
-       elseif ($doctype == ST_CUSTPAYMENT)
+       elseif ($doctype == ST_STATEMENT)
        {
                $doc_Outstanding = _("Outstanding Transactions");
                $doc_Current = _("Current");
index 554409e774acb5c4bfa6ec6111063fb24e059729..761f60f75a88f30cd019bd541b249b940905a9c6 100644 (file)
@@ -20,7 +20,10 @@ if (isset($header2type))
        }
        else
        {
-               $doc_Charge_To = "Charge To";
+               if ($doctype == ST_CUSTPAYMENT)
+                       $doc_Charge_To = "With thanks from";
+               else    
+                       $doc_Charge_To = "Charge To";
                $doc_Delivered_To = "Delivered To";
        }       
        $doc_Shipping_Company = "Shipping Company";
@@ -42,7 +45,7 @@ if (isset($header2type))
        }       
        else
        {
-               if ($doctype == ST_SUPPAYMENT)
+               if ($doctype == ST_SUPPAYMENT || $doctype == ST_CUSTPAYMENT)
                        $doc_Our_Ref = "Type";
                else    
                        $doc_Our_Ref = "Sales Person";
@@ -51,12 +54,15 @@ if (isset($header2type))
                $doc_Customers_Ref = "Customers Reference";
                $doc_Our_Order_No = "Our Order No";
        }
+       $doc_Extra = "";
        $doc_Our_VAT_no = "Our VAT No.";
        $doc_Domicile = "Domicile";
        if($doctype == ST_CUSTDELIVERY || $doctype == ST_SALESQUOTE || $doctype == ST_PURCHORDER || $doctype == ST_SALESORDER ||
-               $doctype == ST_SUPPAYMENT) {
-        $doc_Bank_Account = '';
-        $doc_Please_Quote = "All amounts stated in";
+               $doctype == ST_SUPPAYMENT || $doctype == ST_CUSTPAYMENT) {
+               if ($doctype == ST_CUSTPAYMENT)
+                       $doc_Extra = "* Subject to Realisation of the Cheque.";
+               $doc_Bank_Account = '';
+               $doc_Please_Quote = "All amounts stated in";
   } else {
         $doc_Please_Quote = "Please quote ".($doctype==ST_SALESINVOICE ? "Invoice" : "Credit")
                ." no. when paying. All amounts stated in";
@@ -67,7 +73,8 @@ if (isset($header2type))
        $doc_Bank = "Bank";
        $doc_Payment_Link = "You can pay through";
        if ($doctype == ST_SALESQUOTE || $doctype == ST_PURCHORDER || $doctype == ST_SALESORDER || $doctype == ST_SALESINVOICE || 
-               $doctype == ST_CUSTCREDIT || $doctype == ST_CUSTDELIVERY || $doctype == ST_WORKORDER || $doctype == ST_SUPPAYMENT)
+               $doctype == ST_CUSTCREDIT || $doctype == ST_CUSTDELIVERY || $doctype == ST_WORKORDER || $doctype == ST_SUPPAYMENT || 
+               $doctype == ST_CUSTPAYMENT)
        {
                if ($doctype == ST_SALESQUOTE)
                        $this->title = "SALES QUOTATION";
@@ -83,6 +90,8 @@ if (isset($header2type))
                        $this->title = "WORK ORDER";
                elseif ($doctype == ST_SUPPAYMENT)
                        $this->title = "REMITTANCE";
+               elseif ($doctype == ST_CUSTPAYMENT)
+                       $this->title = "RECEIPT";
                else
                        $this->title = "CREDIT NOTE";
                if ($doctype == ST_PURCHORDER)
@@ -91,13 +100,13 @@ if (isset($header2type))
                elseif ($doctype == ST_WORKORDER)
                        $this->headers = array("Item Code", "Item Description",
                                "From Location", "Work Centre",         "Unit Quantity", "Total Quantity", "Units Issued");
-               elseif ($doctype == ST_SUPPAYMENT)
+               elseif ($doctype == ST_SUPPAYMENT || $doctype == ST_CUSTPAYMENT)
                        $this->headers = array('Trans Type', '#', 'Date', 'Due Date', 'Total Amount', 'Left to Allocate', 'This Allocation');
                else
                        $this->headers = array('Item Code', 'Item Description', 'Quantity', 'Unit',
                                'Price', 'Discount %', 'Total');
        }
-       elseif ($doctype == ST_CUSTPAYMENT)
+       elseif ($doctype == ST_STATEMENT)
        {
                $this->title = "STATEMENT";
                $this->headers = array('Trans Type', '#', 'Date', 'Due Date', 'Charges',
@@ -114,9 +123,10 @@ if (isset($emailtype))
 if (isset($header2type) || isset($linetype))
 {
        $doc_Invoice_no = ($doctype==ST_CUSTDELIVERY ? "Delivery Note No." :
+               ($doctype == ST_CUSTPAYMENT ? "Receipt No." :
                ($doctype == ST_SUPPAYMENT ? "Remittance No." :
                (($doctype == ST_SALESQUOTE || $doctype==ST_PURCHORDER || $doctype==ST_SALESORDER) ? "Order no." : 
-               ($doctype==ST_SALESINVOICE ? "Invoice No." : ($doctype == ST_WORKORDER ? "Work Order No" : "Credit No.")))));
+               ($doctype==ST_SALESINVOICE ? "Invoice No." : ($doctype == ST_WORKORDER ? "Work Order No" : "Credit No."))))));
        $doc_Delivery_no = "Delivery Note No.";
        $doc_Order_no = "Order no.";
 }
@@ -135,13 +145,22 @@ if (isset($linetype))
                $doc_TOTAL_PO = "TOTAL PO EX VAT";
                $doc_TOTAL_DELIVERY = "TOTAL DELIVERY INCL. VAT";
        }
-       elseif ($doctype == ST_SUPPAYMENT)
+       elseif ($doctype == ST_SUPPAYMENT || $doctype == ST_CUSTPAYMENT)
        {
+               $doc_Towards = "As advance / full / part / payment towards:";
+               $doc_by_Cheque = "By Cash / Cheque* / Draft No.";
+               $doc_Dated = "Dated";
+               $doc_Drawn = "Drawn on Bank";
+               $doc_Drawn_Branch = "Branch";
+               $doc_Received = "Received / Sign";
                $doc_Total_Allocated = "Total Allocated";
                $doc_Left_To_Allocate = "Left to Allocate";
-               $doc_Total_Payment = "TOTAL REMITTANCE";
+               if ($doctype == ST_CUSTPAYMENT)
+                       $doc_Total_Payment = "TOTAL RECEIPT";
+               else    
+                       $doc_Total_Payment = "TOTAL REMITTANCE";
        }
-       elseif ($doctype == ST_CUSTPAYMENT)
+       elseif ($doctype == ST_STATEMENT)
        {
                $doc_Outstanding = "Outstanding Transactions";
                $doc_Current = "Current";
index e09df98175a81322dbdbe858a358e2f46e58e687..5602afee84f50a5241098612de8567b4dee1474d 100644 (file)
                        $this->Text($c2col, $this->company['gst_no'], $mcol);
                        $this->NewLine();
                }
-               if (($doctype == ST_SALESINVOICE || $doctype == ST_CUSTPAYMENT) && $this->company['domicile'] != "")
+               if (($doctype == ST_SALESINVOICE || $doctype == ST_STATEMENT) && $this->company['domicile'] != "")
                {
                        $this->Text($ccol, $doc_Domicile, $c2col);
                        $this->Text($c2col, $this->company['domicile'], $mcol);
                        $this->row = $temp;
                        if ($doctype == ST_PURCHORDER)
                                $this->Text($mcol, $this->company['coy_name']);
-                       elseif ($doctype != ST_SUPPAYMENT)
+                       elseif ($doctype != ST_SUPPAYMENT && isset($sales_order['deliver_to']))
                                $this->Text($mcol, $sales_order['deliver_to']);
                        $this->NewLine();
-                       if ($doctype != ST_SUPPAYMENT)
+                       if ($doctype != ST_SUPPAYMENT && isset($sales_order['deliver_to']))
                                $this->TextWrapLines($mcol, $this->rightMargin - $mcol, $sales_order['delivery_address']);
                }
                $this->row = $iline2 - $this->lineHeight - 1;
                        $this->TextWrap($col, $this->row, $width, $myrow['wo_ref'], 'C');
                elseif (isset($sales_order["customer_ref"]))
                        $this->TextWrap($col, $this->row, $width, $sales_order["customer_ref"], 'C');
+               elseif (isset($myrow["debtor_ref"]))
+                       $this->TextWrap($col, $this->row, $width, $myrow["debtor_ref"], 'C');
                $col += $width; 
                if ($branch != null)
                {
                        //$this->TextWrap($col, $this->row, $width, $row['salesman_name'], 'C');
                        $this->TextWrap($col, $this->row, $width, get_salesman_name($id), 'C');
                }               
-               elseif ($doctype == ST_SUPPAYMENT)
+               elseif ($doctype == ST_SUPPAYMENT || $doctype == ST_CUSTPAYMENT)
                        $this->TextWrap($col, $this->row, $width, $systypes_array[$myrow["type"]], 'C');
                elseif ($doctype == ST_WORKORDER)
                        $this->TextWrap($col, $this->row, $width, $wo_types_array[$myrow["type"]], 'C');
                }
                elseif ($doctype == ST_WORKORDER)
                        $this->TextWrap($col, $this->row, $width, $myrow["location_name"], 'C');
-               elseif (isset($myrow['order_']))
+               elseif (isset($myrow['order_']) && $myrow['order_'] != 0)
                        $this->TextWrap($col, $this->row, $width, $myrow['order_'], 'C');
                $col += $width; 
                if ($doctype == ST_SALESORDER || $doctype == ST_SALESQUOTE)
                        $this->TextWrap($col, $this->row, $width, sql2date($myrow['delivery_date']), 'C');
                elseif ($doctype == ST_WORKORDER)       
                        $this->TextWrap($col, $this->row, $width, $myrow["units_issued"], 'C');
-               elseif ($doctype != ST_PURCHORDER && $doctype != ST_CUSTCREDIT && isset($myrow['due_date']))
+               elseif ($doctype != ST_PURCHORDER && $doctype != ST_CUSTCREDIT && $doctype != ST_CUSTPAYMENT &&
+                       $doctype != ST_SUPPAYMENT && isset($myrow['due_date']))
                        $this->TextWrap($col, $this->row, $width, sql2date($myrow['due_date']), 'C');
                if (!isset($packing_slip) || $packing_slip == 0)
                {
                                $this->row -= $this->lineHeight;
                        }
                }
+               if ($doc_Extra != "")
+               {
+                       $this->TextWrap($ccol, $this->row, $right - $ccol, $doc_Extra, 'C');
+                       $this->row -= $this->lineHeight;
+               }
                if ($this->params['comments'] != '')
                {
                        $this->TextWrap($ccol, $this->row, $right - $ccol, $this->params['comments'], 'C');
                        $this->row -= $this->lineHeight;
                }
-               if (($doctype == ST_SALESINVOICE || $doctype == ST_CUSTPAYMENT) && $this->company['legal_text'] != "") 
+               if (($doctype == ST_SALESINVOICE || $doctype == ST_STATEMENT) && $this->company['legal_text'] != "") 
                {
                        $this->TextWrapLines($ccol, $right - $ccol, $this->company['legal_text'], 'C');
                }
index 4ce4d148d3a37f31b309795a31d2999f9d772c1e..2bfa425748808030cf87e4797b27f40260124be3 100644 (file)
@@ -77,6 +77,15 @@ function print_document_link($doc_no, $link_text, $link=true, $type_no,
                                'PARAM_3' => $email, 
                                'PARAM_4' => '');
                        break;
+               case ST_CUSTPAYMENT :
+                       $rep = 112;
+                       // from, to, currency, bank acc, email, comments
+                       $ar = array(
+                               'PARAM_0' => $doc_no, 
+                               'PARAM_1' => $doc_no, 
+                               'PARAM_2' => '', 
+                               'PARAM_4' => '');
+                       break;
                case ST_SUPPAYMENT :
                        $rep = 210;
                        // from, to, currency, bank acc, email, comments
index fc1d9d0f054d14e103acd6eeb72f8cf51926733e..4db83a31e5af0c7df076a4a278eedff216488420 100644 (file)
@@ -64,10 +64,9 @@ class BoxReports
        
                                        $st_params = "<table border=0><tr><td>\n"
                                                . "<form method='POST' action='$action' target='_blank'>\n";
-                                       $st_params .= hidden('REP_ID', $report->id, false);
                                        $st_params .= submit('Rep'.$report->id,  
                                                _("Display: ") . access_string($report->name, true),
-                                               false, '', $pdf_debug ? false : 'default') . '<br><br>';
+                                               false, '', $pdf_debug ? false : 'default') . hidden('REP_ID', $report->id, false).'<br><br>';
                                        $st_params .= $this->getOptions($report->get_controls());
                                        $st_params .= "\n</form></td></tr></table>\n";
                                        set_focus('Rep'.$report->id);
@@ -333,6 +332,16 @@ class BoxReports
                                                FROM ".TB_PREF."suppliers, ".TB_PREF."supp_trans WHERE (type=".ST_BANKPAYMENT." OR type=".ST_SUPPAYMENT." OR type=".ST_SUPPCREDIT.") AND ".TB_PREF."suppliers.supplier_id=".TB_PREF."supp_trans.supplier_id ORDER BY ".TB_PREF."supp_trans.trans_no DESC";
                                        return combo_input($name, '', $sql, 'TNO', 'IName',array('order'=>false));
 
+                               case 'RECEIPT':
+                                       $BD = _("BD");
+                                       $CP = _("CP");
+                                       $CN = _("CN");
+                                       $ref = ($print_invoice_no == 1 ? "trans_no" : "reference");
+                                       $sql = "SELECT concat(".TB_PREF."debtor_trans.trans_no, '-',
+                                               ".TB_PREF."debtor_trans.type) AS TNO, concat(".TB_PREF."debtor_trans.$ref, if (type=".ST_BANKDEPOSIT.", ' $BD ', if (type=".ST_CUSTPAYMENT.", ' $CP ', ' $CN ')), ".TB_PREF."debtors_master.name) as IName
+                                               FROM ".TB_PREF."debtors_master, ".TB_PREF."debtor_trans WHERE (type=".ST_BANKDEPOSIT." OR type=".ST_CUSTPAYMENT." OR type=".ST_CUSTCREDIT.") AND ".TB_PREF."debtors_master.debtor_no=".TB_PREF."debtor_trans.debtor_no ORDER BY ".TB_PREF."debtor_trans.trans_no DESC";
+                                       return combo_input($name, '', $sql, 'TNO', 'IName',array('order'=>false));
+
                                case 'ITEMS':
                                        return stock_manufactured_items_list($name);
 
index 5d181090fe02a27242deaa06525bb61a51d1b79a..54aefe044b6a0eae4b6078fa2da5fd17be5113bb 100644 (file)
@@ -192,6 +192,12 @@ function print_invoices()
                        $rep->Font('bold');
                        $rep->TextCol(3, 6, $doc_TOTAL_INVOICE, - 2);
                        $rep->TextCol(6, 7, $DisplayTotal, -2);
+                       $words = price_in_words($myrow['Total'], $j);
+                       if ($words != "")
+                       {
+                               $rep->NewLine(1);
+                               $rep->TextCol(1, 7, $myrow['curr_code'] . ": " . $words, - 2);
+                       }       
                        $rep->Font();
                        if ($email == 1)
                        {
index dc5219d96c4420db85efe1894663f9578b4d2d9c..81e3bb7f02a500325822bc8d296c8229ab49e3b7 100644 (file)
@@ -107,10 +107,10 @@ function print_statements()
                        $rep->filename = "Statement" . $myrow['debtor_no'] . ".pdf";
                        $rep->Info($params, $cols, null, $aligns);
                }
-               $rep->Header2($myrow, null, null, $baccount, ST_CUSTPAYMENT);
+               $rep->Header2($myrow, null, null, $baccount, ST_STATEMENT);
                $rep->NewLine();
                $linetype = true;
-               $doctype = ST_CUSTPAYMENT;
+               $doctype = ST_STATEMENT;
                if ($rep->currency != $myrow['curr_code'])
                {
                        include($path_to_root . "/reporting/includes/doctext2.inc");
@@ -142,7 +142,7 @@ function print_statements()
                        $rep->TextCol(7, 8,     $DisplayNet, -2);
                        $rep->NewLine();
                        if ($rep->row < $rep->bottomMargin + (10 * $rep->lineHeight))
-                               $rep->Header2($myrow, null, null, $baccount, ST_CUSTPAYMENT);
+                               $rep->Header2($myrow, null, null, $baccount, ST_STATEMENT);
                }
                $nowdue = "1-" . $PastDueDays1 . " " . $doc_Days;
                $pastdue1 = $PastDueDays1 + 1 . "-" . $PastDueDays2 . " " . $doc_Days;
@@ -163,7 +163,7 @@ function print_statements()
                for ($i = 0; $i < 5; $i++)
                        $rep->TextWrap($col[$i], $rep->row, $col[$i + 1] - $col[$i], $str2[$i], 'right');
                if ($email == 1)
-                       $rep->End($email, $doc_Statement . " " . $doc_as_of . " " . sql2date($date), $myrow, ST_CUSTPAYMENT);
+                       $rep->End($email, $doc_Statement . " " . $doc_as_of . " " . sql2date($date), $myrow, ST_STATEMENT);
 
        }
        if ($email == 0)
index 5b049c111ce799fd0a4be400fe0b6a03ab392320..2c3bb116e54e4c3ad0c8fc9c1d0b694e17dc1608 100644 (file)
@@ -158,6 +158,12 @@ function print_sales_orders()
                else    
                        $rep->TextCol(3, 6, $doc_TOTAL_ORDER2, - 2);
                $rep->TextCol(6, 7,     $DisplayTotal, -2);
+               $words = price_in_words($myrow["freight_cost"] + $SubTotal, ST_SALESORDER);
+               if ($words != "")
+               {
+                       $rep->NewLine(1);
+                       $rep->TextCol(1, 7, $myrow['curr_code'] . ": " . $words, - 2);
+               }       
                $rep->Font();
                if ($email == 1)
                {
index a8fdbc4a6caae71abf175ab090c49b5b6d9d4ac8..5afa8b825f5be99aa0791c89253ad4e5263ad54e 100644 (file)
@@ -187,6 +187,12 @@ function print_deliveries()
                                $rep->Font('bold');
                                $rep->TextCol(3, 6, $doc_TOTAL_DELIVERY, - 2);
                                $rep->TextCol(6, 7,     $DisplayTotal, -2);
+                               $words = price_in_words($myrow['Total'], ST_CUSTDELIVERY);
+                               if ($words != "")
+                               {
+                                       $rep->NewLine(1);
+                                       $rep->TextCol(1, 7, $myrow['curr_code'] . ": " . $words, - 2);
+                               }       
                                $rep->Font();
                        }       
                        if ($email == 1)
index 0301ed616e2f8677c3765cb3f703702f0e16aca9..5db2f9d06dd40f8ce9281e46d4c1eea7228f35fa 100644 (file)
@@ -142,6 +142,12 @@ function print_sales_quotations()
                else    
                        $rep->TextCol(3, 6, $doc_TOTAL_ORDER2, - 2);
                $rep->TextCol(6, 7,     $DisplayTotal, -2);
+               $words = price_in_words($myrow["freight_cost"] + $SubTotal, ST_SALESQUOTE);
+               if ($words != "")
+               {
+                       $rep->NewLine(1);
+                       $rep->TextCol(1, 7, $myrow['curr_code'] . ": " . $words, - 2);
+               }       
                $rep->Font();
                if ($email == 1)
                {
diff --git a/reporting/rep112.php b/reporting/rep112.php
new file mode 100644 (file)
index 0000000..87d87ce
--- /dev/null
@@ -0,0 +1,181 @@
+<?php
+/**********************************************************************
+    Copyright (C) FrontAccounting, LLC.
+       Released under the terms of the GNU General Public License, GPL, 
+       as published by the Free Software Foundation, either version 3 
+       of the License, or (at your option) any later version.
+    This program is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
+    See the License here <http://www.gnu.org/licenses/gpl-3.0.html>.
+***********************************************************************/
+
+$page_security = $_POST['PARAM_0'] == $_POST['PARAM_1'] ?
+       'SA_SALESTRANSVIEW' : 'SA_SALESBULKREP';
+// ----------------------------------------------------------------
+// $ Revision: 2.0 $
+// Creator:    Joe Hunt
+// date_:      2005-05-19
+// Title:      Purchase Orders
+// ----------------------------------------------------------------
+$path_to_root="..";
+
+include_once($path_to_root . "/includes/session.inc");
+include_once($path_to_root . "/includes/date_functions.inc");
+include_once($path_to_root . "/includes/data_checks.inc");
+
+//----------------------------------------------------------------------------------------------------
+
+print_receipts();
+
+//----------------------------------------------------------------------------------------------------
+function get_receipt($type, $trans_no)
+{
+    $sql = "SELECT ".TB_PREF."debtor_trans.*,
+                               (".TB_PREF."debtor_trans.ov_amount + ".TB_PREF."debtor_trans.ov_gst + ".TB_PREF."debtor_trans.ov_freight + 
+                               ".TB_PREF."debtor_trans.ov_freight_tax + ".TB_PREF."debtor_trans.ov_discount) AS Total, 
+                               ".TB_PREF."debtors_master.name AS DebtorName,  ".TB_PREF."debtors_master.debtor_ref,
+                               ".TB_PREF."debtors_master.curr_code, ".TB_PREF."debtors_master.payment_terms, ".TB_PREF."debtors_master.tax_id AS tax_id, 
+                               ".TB_PREF."debtors_master.email, ".TB_PREF."debtors_master.address
+                       FROM ".TB_PREF."debtor_trans, ".TB_PREF."debtors_master 
+                               WHERE ".TB_PREF."debtor_trans.debtor_no = ".TB_PREF."debtors_master.debtor_no
+                               AND ".TB_PREF."debtor_trans.type = ".db_escape($type)."
+                               AND ".TB_PREF."debtor_trans.trans_no = ".db_escape($trans_no);
+       $result = db_query($sql, "The remittance cannot be retrieved");
+       if (db_num_rows($result) == 0)
+               return false;
+    return db_fetch($result);
+}
+
+function get_allocations_for_receipt($debtor_id, $type, $trans_no)
+{
+       $sql = get_alloc_trans_sql("amt, trans.reference, trans.alloc", "trans.trans_no = alloc.trans_no_to
+               AND trans.type = alloc.trans_type_to
+               AND alloc.trans_no_from=$trans_no
+               AND alloc.trans_type_from=$type
+               AND trans.debtor_no=".db_escape($debtor_id),
+               TB_PREF."cust_allocations as alloc");
+       $sql .= " ORDER BY trans_no";
+       return db_query($sql, "Cannot retreive alloc to transactions");
+}
+
+function print_receipts()
+{
+       global $path_to_root, $systypes_array;
+
+       include_once($path_to_root . "/reporting/includes/pdf_report.inc");
+
+       $from = $_POST['PARAM_0'];
+       $to = $_POST['PARAM_1'];
+       $currency = $_POST['PARAM_2'];
+       $comments = $_POST['PARAM_3'];
+
+       if ($from == null)
+               $from = 0;
+       if ($to == null)
+               $to = 0;
+       $dec = user_price_dec();
+
+       $fno = explode("-", $from);
+       $tno = explode("-", $to);
+
+       $cols = array(4, 85, 150, 225, 275, 360, 450, 515);
+
+       // $headers in doctext.inc
+       $aligns = array('left', 'left', 'left', 'left', 'right', 'right', 'right');
+
+       $params = array('comments' => $comments);
+
+       $cur = get_company_Pref('curr_default');
+
+       $rep = new FrontReport(_('RECEIPT'), "ReceiptBulk", user_pagesize());
+       $rep->currency = $cur;
+       $rep->Font();
+       $rep->Info($params, $cols, null, $aligns);
+
+       for ($i = $fno[0]; $i <= $tno[0]; $i++)
+       {
+               if ($fno[0] == $tno[0])
+                       $types = array($fno[1]);
+               else
+                       $types = array(ST_BANKDEPOSIT, ST_CUSTPAYMENT, ST_CUSTCREDIT);
+               foreach ($types as $j)
+               {
+                       $myrow = get_receipt($j, $i);
+                       if (!$myrow)
+                               continue;                       
+                       $baccount = get_default_bank_account($myrow['curr_code']);
+                       $params['bankaccount'] = $baccount['id'];
+
+                       $rep->title = _('RECEIPT');
+                       $rep->Header2($myrow, null, $myrow, $baccount, ST_CUSTPAYMENT);
+                       $result = get_allocations_for_receipt($myrow['debtor_no'], $myrow['type'], $myrow['trans_no']);
+
+                       $linetype = true;
+                       $doctype = ST_CUSTPAYMENT;
+                       if ($rep->currency != $myrow['curr_code'])
+                       {
+                               include($path_to_root . "/reporting/includes/doctext2.inc");
+                       }
+                       else
+                       {
+                               include($path_to_root . "/reporting/includes/doctext.inc");
+                       }
+
+                       $total_allocated = 0;
+                       $rep->TextCol(0, 4,     $doc_Towards, -2);
+                       $rep->NewLine(2);
+                       
+                       while ($myrow2=db_fetch($result))
+                       {
+                               $rep->TextCol(0, 1,     $systypes_array[$myrow2['type']], -2);
+                               $rep->TextCol(1, 2,     $myrow2['reference'], -2);
+                               $rep->TextCol(2, 3,     sql2date($myrow2['tran_date']), -2);
+                               $rep->TextCol(3, 4,     sql2date($myrow2['due_date']), -2);
+                               $rep->AmountCol(4, 5, $myrow2['Total'], $dec, -2);
+                               $rep->AmountCol(5, 6, $myrow2['Total'] - $myrow2['alloc'], $dec, -2);
+                               $rep->AmountCol(6, 7, $myrow2['amt'], $dec, -2);
+
+                               $total_allocated += $myrow2['amt'];
+                               $rep->NewLine(1);
+                               if ($rep->row < $rep->bottomMargin + (15 * $rep->lineHeight))
+                                       $rep->Header2($myrow, null, $myrow, $baccount, ST_CUSTPAYMENT);
+                       }
+
+                       $rep->row = $rep->bottomMargin + (15 * $rep->lineHeight);
+
+                       $rep->TextCol(3, 6, $doc_Total_Allocated, -2);
+                       $rep->AmountCol(6, 7, $total_allocated, $dec, -2);
+                       $rep->NewLine();
+                       $rep->TextCol(3, 6, $doc_Left_To_Allocate, -2);
+                       $rep->AmountCol(6, 7, $myrow['Total'] - $total_allocated, $dec, -2);
+                       $rep->NewLine();
+                       $rep->Font('bold');
+                       $rep->TextCol(3, 6, $doc_Total_Payment, - 2);
+                       $rep->AmountCol(6, 7, $myrow['Total'], $dec, -2);
+                       $words = price_in_words($myrow['Total'], ST_CUSTPAYMENT);
+                       if ($words != "")
+                       {
+                               $rep->NewLine(1);
+                               $rep->TextCol(0, 7, $myrow['curr_code'] . ": " . $words, - 2);
+                       }       
+                       $rep->Font();
+                       $rep->NewLine();
+                       $rep->TextCol(6, 7, $doc_Received, - 2);
+                       $rep->NewLine();
+                       $rep->TextCol(0, 2, $doc_by_Cheque, - 2);
+                       $rep->TextCol(2, 4, "______________________________", - 2);
+                       $rep->TextCol(4, 5, $doc_Dated, - 2);
+                       $rep->TextCol(5, 6, "__________________", - 2);
+                       $rep->NewLine(1);
+                       $rep->TextCol(0, 2, $doc_Drawn, - 2);
+                       $rep->TextCol(2, 4, "______________________________", - 2);
+                       $rep->TextCol(4, 5, $doc_Drawn_Branch, - 2);
+                       $rep->TextCol(5, 6, "__________________", - 2);
+                       $rep->TextCol(6, 7, "__________________");
+               }       
+       }
+       $rep->End();
+}
+
+?>
\ No newline at end of file
index e8278e60e13036c644e5742654c61c983c4b0a79..87b9f559a623ce49e356e5873f2dad1239f96c9b 100644 (file)
@@ -167,6 +167,12 @@ function print_po()
                $rep->Font('bold');
                $rep->TextCol(3, 6, $doc_TOTAL_PO, - 2);
                $rep->TextCol(6, 7,     $DisplayTotal, -2);
+               $words = price_in_words($SubTotal, ST_PURCHORDER);
+               if ($words != "")
+               {
+                       $rep->NewLine(1);
+                       $rep->TextCol(1, 7, $myrow['curr_code'] . ": " . $words, - 2);
+               }       
                $rep->Font();
                if ($email == 1)
                {
index f25b792543661359c681f12216a107c2814bde31..27d56cd704a3ad7f51053bda7a44b284f37b04c4 100644 (file)
@@ -90,7 +90,7 @@ function print_remittances()
 
        if ($email == 0)
        {
-               $rep = new FrontReport(_('PURCHASE ORDER'), "PurchaseOrderBulk", user_pagesize());
+               $rep = new FrontReport(_('REMITTANCE'), "RemittanceBulk", user_pagesize());
                $rep->currency = $cur;
                $rep->Font();
                $rep->Info($params, $cols, null, $aligns);
@@ -103,8 +103,6 @@ function print_remittances()
                else
                        $types = array(ST_BANKPAYMENT, ST_SUPPAYMENT, ST_SUPPCREDIT);
                foreach ($types as $j)
-               //for ($j = ST_BANKPAYMENT; $j <= ST_SUPPAYMENT; $j = ($j == ST_BANKPAYMENT ? ST_SUPPAYMENT : 999))
-               //for ($j = $ft; $j <= $tt; $j = ($j == ST_BANKPAYMENT ? ST_SUPPAYMENT : 999))
                {
                        $myrow = get_remittance($j, $i);
                        if (!$myrow)
@@ -126,7 +124,21 @@ function print_remittances()
                        $rep->Header2($myrow, null, $myrow, $baccount, ST_SUPPAYMENT);
                        $result = get_allocations_for_remittance($myrow['supplier_id'], $myrow['type'], $myrow['trans_no']);
 
+                       $linetype = true;
+                       $doctype = ST_SUPPAYMENT;
+                       if ($rep->currency != $myrow['curr_code'])
+                       {
+                               include($path_to_root . "/reporting/includes/doctext2.inc");
+                       }
+                       else
+                       {
+                               include($path_to_root . "/reporting/includes/doctext.inc");
+                       }
+
                        $total_allocated = 0;
+                       $rep->TextCol(0, 4,     $doc_Towards, -2);
+                       $rep->NewLine(2);
+                       
                        while ($myrow2=db_fetch($result))
                        {
                                $rep->TextCol(0, 1,     $systypes_array[$myrow2['type']], -2);
@@ -144,16 +156,6 @@ function print_remittances()
                        }
 
                        $rep->row = $rep->bottomMargin + (15 * $rep->lineHeight);
-                       $linetype = true;
-                       $doctype = ST_SUPPAYMENT;
-                       if ($rep->currency != $myrow['curr_code'])
-                       {
-                               include($path_to_root . "/reporting/includes/doctext2.inc");
-                       }
-                       else
-                       {
-                               include($path_to_root . "/reporting/includes/doctext.inc");
-                       }
 
                        $rep->TextCol(3, 6, $doc_Total_Allocated, -2);
                        $rep->AmountCol(6, 7, $total_allocated, $dec, -2);
@@ -165,6 +167,12 @@ function print_remittances()
                        $rep->Font('bold');
                        $rep->TextCol(3, 6, $doc_Total_Payment, - 2);
                        $rep->AmountCol(6, 7, $myrow['Total'], $dec, -2);
+                       $words = price_in_words($myrow['Total'], ST_SUPPAYMENT);
+                       if ($words != "")
+                       {
+                               $rep->NewLine(2);
+                               $rep->TextCol(1, 7, $myrow['curr_code'] . ": " . $words, - 2);
+                       }       
                        $rep->Font();
                        if ($email == 1)
                        {
index 893c8d9d29daae54f64af6ab9c263d1c469d1382..7e443fb29b0cebacee938e6054a06ef1fbd0aac9 100644 (file)
@@ -106,6 +106,10 @@ function print_bank_transactions()
                $rep->NewLine(2);
                if ($rows > 0)
                {
+                       // Keep a running total as we loop through
+                       // the transactions.
+                       $total_debit = $total_credit = 0;                       
+                       
                        while ($myrow=db_fetch($trans))
                        {
                                $total += $myrow['amount'];
@@ -116,9 +120,15 @@ function print_bank_transactions()
                                $rep->DateCol(3, 4,     $myrow["trans_date"], true);
                                $rep->TextCol(4, 5,     payment_person_name($myrow["person_type_id"],$myrow["person_id"], false));
                                if ($myrow['amount'] > 0.0)
+                               {
                                        $rep->AmountCol(5, 6, abs($myrow['amount']), $dec);
+                                       $total_debit += abs($myrow['amount']);
+                               }
                                else
+                               {
                                        $rep->AmountCol(6, 7, abs($myrow['amount']), $dec);
+                                       $total_credit += abs($myrow['amount']);
+                               }
                                $rep->AmountCol(7, 8, $total, $dec);
                                $rep->NewLine();
                                if ($rep->row < $rep->bottomMargin + $rep->lineHeight)
@@ -129,6 +139,13 @@ function print_bank_transactions()
                        }
                        $rep->NewLine();
                }
+               
+               // Print totals for the debit and credit columns.
+               $rep->TextCol(3, 5, _("Total Debit / Credit"));
+               $rep->AmountCol(5, 6, $total_debit, $dec);
+               $rep->AmountCol(6, 7, $total_credit, $dec);
+               $rep->NewLine(2);
+
                $rep->Font('bold');
                $rep->TextCol(3, 5,     _("Ending Balance"));
                if ($total > 0.0)
@@ -138,6 +155,14 @@ function print_bank_transactions()
                $rep->Font();
                $rep->Line($rep->row - $rep->lineHeight + 4);
                $rep->NewLine(2, 1);
+               
+               // Print the difference between starting and ending balances.
+               $net_change = ($total - $prev_balance); 
+               $rep->TextCol(3, 5, _("Net Change"));
+               if ($total > 0.0)
+                       $rep->AmountCol(5, 6, $net_change, $dec, 0, 0, 0, 0, null, 1, True);
+               else
+                       $rep->AmountCol(6, 7, $net_change, $dec, 0, 0, 0, 0, null, 1, True);
        }
        $rep->End();
 }
index 8986237d2ebc4f18cb32594b1f46bd413e005a9c..b6b12c38cf9204a65d29038435abb3eb5315375a 100644 (file)
@@ -66,21 +66,22 @@ function print_GL_transactions()
        $rep = new FrontReport(_('GL Account Transactions'), "GLAccountTransactions", user_pagesize());
        $dec = user_price_dec();
 
-       $cols = array(0, 80, 100, 150, 210, 280, 340, 400, 450, 510, 570);
+  //$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-----------------------------------
        //-----------------------dim1----------------------------------------
        //-------------------------------------------------------------------
-       $aligns = array('left', 'left', 'left', 'left', 'left', 'left', 'right', 'right', 'right');
+       $aligns = array('left', 'left', 'left', 'left', 'left', 'left', 'left', 'right', 'right', 'right');
 
        if ($dim == 2)
-               $headers = array(_('Type'),     _('#'), _('Date'), _('Dimension')." 1", _('Dimension')." 2",
+               $headers = array(_('Type'),     _('Ref'), _('#'),       _('Date'), _('Dimension')." 1", _('Dimension')." 2",
                        _('Person/Item'), _('Debit'),   _('Credit'), _('Balance'));
        elseif ($dim == 1)
-               $headers = array(_('Type'),     _('#'), _('Date'), _('Dimension'), "", _('Person/Item'),
+               $headers = array(_('Type'),     _('Ref'), _('#'),       _('Date'), _('Dimension'), "", _('Person/Item'),
                        _('Debit'),     _('Credit'), _('Balance'));
        else
-               $headers = array(_('Type'),     _('#'), _('Date'), "", "", _('Person/Item'),
+               $headers = array(_('Type'),     _('Ref'), _('#'),       _('Date'), "", "", _('Person/Item'),
                        _('Debit'),     _('Credit'), _('Balance'));
 
        if ($dim == 2)
@@ -132,12 +133,12 @@ function print_GL_transactions()
                if ($prev_balance == 0.0 && $rows == 0)
                        continue;
                $rep->Font('bold');
-               $rep->TextCol(0, 3,     $account['account_code'] . " " . $account['account_name']);
-               $rep->TextCol(3, 5, _('Opening Balance'));
+               $rep->TextCol(0, 4,     $account['account_code'] . " " . $account['account_name'], -2);
+               $rep->TextCol(4, 6, _('Opening Balance'));
                if ($prev_balance > 0.0)
-                       $rep->AmountCol(6, 7, abs($prev_balance), $dec);
-               else
                        $rep->AmountCol(7, 8, abs($prev_balance), $dec);
+               else
+                       $rep->AmountCol(8, 9, abs($prev_balance), $dec);
                $rep->Font();
                $total = $prev_balance;
                $rep->NewLine(2);
@@ -147,19 +148,21 @@ function print_GL_transactions()
                        {
                                $total += $myrow['amount'];
 
-                               $rep->TextCol(0, 1, $systypes_array[$myrow["type"]]);
-                               $rep->TextCol(1, 2,     $myrow['type_no']);
-                               $rep->DateCol(2, 3,     $myrow["tran_date"], true);
+                               $rep->TextCol(0, 1, $systypes_array[$myrow["type"]], -2);
+                               $reference = get_reference($myrow["type"], $myrow["type_no"]);
+                               $rep->TextCol(1, 2, $reference);
+                               $rep->TextCol(2, 3,     $myrow['type_no'], -2);
+                               $rep->DateCol(3, 4,     $myrow["tran_date"], true);
                                if ($dim >= 1)
-                                       $rep->TextCol(3, 4,     get_dimension_string($myrow['dimension_id']));
+                                       $rep->TextCol(4, 5,     get_dimension_string($myrow['dimension_id']));
                                if ($dim > 1)
-                                       $rep->TextCol(4, 5,     get_dimension_string($myrow['dimension2_id']));
-                               $rep->TextCol(5, 6,     payment_person_name($myrow["person_type_id"],$myrow["person_id"], false));
+                                       $rep->TextCol(5, 6,     get_dimension_string($myrow['dimension2_id']));
+                               $rep->TextCol(6, 7,     payment_person_name($myrow["person_type_id"],$myrow["person_id"], false));
                                if ($myrow['amount'] > 0.0)
-                                       $rep->AmountCol(6, 7, abs($myrow['amount']), $dec);
-                               else
                                        $rep->AmountCol(7, 8, abs($myrow['amount']), $dec);
-                               $rep->TextCol(8, 9,     number_format2($total, $dec));
+                               else
+                                       $rep->AmountCol(8, 9, abs($myrow['amount']), $dec);
+                               $rep->TextCol(9, 10, number_format2($total, $dec));
                                $rep->NewLine();
                                if ($rep->row < $rep->bottomMargin + $rep->lineHeight)
                                {
@@ -170,11 +173,11 @@ function print_GL_transactions()
                        $rep->NewLine();
                }
                $rep->Font('bold');
-               $rep->TextCol(3, 5,     _("Ending Balance"));
+               $rep->TextCol(4, 6,     _("Ending Balance"));
                if ($total > 0.0)
-                       $rep->AmountCol(6, 7, abs($total), $dec);
-               else
                        $rep->AmountCol(7, 8, abs($total), $dec);
+               else
+                       $rep->AmountCol(8, 9, abs($total), $dec);
                $rep->Font();
                $rep->Line($rep->row - $rep->lineHeight + 4);
                $rep->NewLine(2, 1);
index ad10656cdc0f5f142359a2c5ad67a539e76fba34..607b446c1da5ddc916cc8cbaece65e3e10655c70 100644 (file)
@@ -236,7 +236,7 @@ function print_annual_expense_breakdown()
                        {
                                for ( ; $level >= 0, $typename[$level] != ''; $level--) 
                                {
-                                       if ($account['parent'] == $closing[$level] || $account['parent'] < $last || $account['parent'] <= 0)
+                                       if ($account['parent'] == $closing[$level] || $account['parent'] < $last || $account['parent'] <= 0 || $closeclass)
                                        {
                                                $rep->row += 6;
                                                $rep->Line($rep->row);
@@ -332,7 +332,7 @@ function print_annual_expense_breakdown()
                {
                        for ( ; $level >= 0, $typename[$level] != ''; $level--) 
                        {
-                               if ($account['parent'] == $closing[$level] || $account['parent'] < $last || $account['parent'] <= 0)
+                               if ($account['parent'] == $closing[$level] || $account['parent'] < $last || $account['parent'] <= 0 || $closeclass)
                                {
                                        $rep->row += 6;
                                        $rep->Line($rep->row);
index 1ef4a9d72bc7877f3eb8783fd3baec3f1aa6abcc..58d605992164e6dd5e9faf0bbf4196fcfb6ee09e 100644 (file)
@@ -164,7 +164,7 @@ function print_balance_sheet()
                        {
                                for ( ; $level >= 0, $typename[$level] != ''; $level--) 
                                {
-                                       if ($account['parent'] == $closing[$level] || $account['parent'] < $last || $account['parent'] <= 0)
+                                       if ($account['parent'] == $closing[$level] || $account['parent'] < $last || $account['parent'] <= 0 || $closeclass)
                                        {
                                                $rep->row += 6;
                                                $rep->Line($rep->row);
@@ -281,7 +281,7 @@ function print_balance_sheet()
                {
                        for ( ; $level >= 0, $typename[$level] != ''; $level--) 
                        {
-                               if ($account['parent'] == $closing[$level] || $account['parent'] < $last || $account['parent'] <= 0)
+                               if ($account['parent'] == $closing[$level] || $account['parent'] < $last || $account['parent'] <= 0 || $closeclass)
                                {
                                        $rep->row += 6;
                                        $rep->Line($rep->row);
index 15690a09a23ac1e0e840d42b2e9a37f9a937d480..0516c17ec53e8e6250a7f438052bad2cb0950414 100644 (file)
@@ -191,7 +191,7 @@ function print_profit_and_loss_statement()
                        {
                                for ( ; $level >= 0, $typename[$level] != ''; $level--) 
                                {
-                                       if ($account['parent'] == $closing[$level] || $account['parent'] < $last || $account['parent'] <= 0)
+                                       if ($account['parent'] == $closing[$level] || $account['parent'] < $last || $account['parent'] <= 0 || $closeclass)
                                        {
                                                $rep->row += 6;
                                                $rep->Line($rep->row);
@@ -295,7 +295,7 @@ function print_profit_and_loss_statement()
                {
                        for ( ; $level >= 0, $typename[$level] != ''; $level--) 
                        {
-                               if ($account['parent'] == $closing[$level] || $account['parent'] < $last || $account['parent'] <= 0)
+                               if ($account['parent'] == $closing[$level] || $account['parent'] < $last || $account['parent'] <= 0 || $closeclass)
                                {
                                        $rep->row += 6;
                                        $rep->Line($rep->row);
index 4baf0105841b9e4e4b91416a7c8446ab4258f03e..3fc4c6375673372cf19974563a047c1fb5625ee0 100644 (file)
@@ -143,7 +143,11 @@ function print_tax_report()
                                $rep->Header();
                        }
                }
-               if (in_array($trans['trans_type'], array(ST_BANKDEPOSIT,ST_SALESINVOICE,ST_CUSTCREDIT))) {
+               if ($trans['trans_type']==ST_JOURNAL && $trans['amount']<0) {
+                       $taxes[$trans['tax_type_id']]['taxout'] -= $trans['amount'];
+                       $taxes[$trans['tax_type_id']]['out'] -= $trans['net_amount'];
+               }
+               elseif (in_array($trans['trans_type'], array(ST_BANKDEPOSIT,ST_SALESINVOICE,ST_CUSTCREDIT))) {
                        $taxes[$trans['tax_type_id']]['taxout'] += $trans['amount'];
                        $taxes[$trans['tax_type_id']]['out'] += $trans['net_amount'];
                } else {
index a36a043cd87826ed9429ff446005604e77310712..d1ba1b3686effd2f261a12fc48f9d7c2bbd03bec 100644 (file)
@@ -103,6 +103,17 @@ $reports->addReport(_('Customer'),111,_('&Print Sales Quotations'),
                        _('Currency Filter') => 'CURRENCY',
                        _('Email Customers') => 'YES_NO',
                        _('Comments') => 'TEXTBOX'));
+$reports->addReport(_('Customer'),111,_('&Print Sales Quotations'),
+       array(  _('From') => 'QUOTATIONS',
+                       _('To') => 'QUOTATIONS',
+                       _('Currency Filter') => 'CURRENCY',
+                       _('Email Customers') => 'YES_NO',
+                       _('Comments') => 'TEXTBOX'));
+$reports->addReport(_('Customer'),112,_('Print Receipts'),
+       array(  _('From') => 'RECEIPT',
+                       _('To') => 'RECEIPT',
+                       _('Currency Filter') => 'CURRENCY',
+                       _('Comments') => 'TEXTBOX'));
 
 $reports->addReportClass(_('Supplier'));
 $reports->addReport(_('Supplier'),201,_('Supplier &Balances'),
index 9f4630a4f4739eb201b8c2585ed0b94043065da4..565d9f95538b285a45bdd58b4453c798b83e6258 100644 (file)
@@ -19,6 +19,7 @@ include_once($path_to_root . "/includes/banking.inc");
 include_once($path_to_root . "/includes/data_checks.inc");
 include_once($path_to_root . "/sales/includes/sales_db.inc");
 //include_once($path_to_root . "/sales/includes/ui/cust_alloc_ui.inc");
+include_once($path_to_root . "/reporting/includes/reporting.inc");
 
 $js = "";
 if ($use_popup_windows) {
@@ -60,14 +61,15 @@ if (isset($_GET['AddedID'])) {
 
        display_notification_centered(_("The customer payment has been successfully entered."));
 
+       submenu_print(_("&Print This Receipt"), ST_CUSTPAYMENT, $payment_no."-".ST_CUSTPAYMENT, 'prtopt');
+
        display_note(get_gl_view_str(ST_CUSTPAYMENT, $payment_no, _("&View the GL Journal Entries for this Customer Payment")));
 
 //     hyperlink_params($path_to_root . "/sales/allocations/customer_allocate.php", _("&Allocate this Customer Payment"), "trans_no=$payment_no&trans_type=12");
 
        hyperlink_no_params($path_to_root . "/sales/customer_payments.php", _("Enter Another &Customer Payment"));
-       br(1);
-       end_page();
-       exit;
+       
+       display_footer_exit();
 }
 
 //----------------------------------------------------------------------------------------------
index de50c6aad94a789b3f3fc06de79486a9c0353807..cf7b668239a203d784d52a1032bb0c4cc15fc4f9 100644 (file)
@@ -128,6 +128,8 @@ function delete_sales_order($order_no, $trans_type)
                .db_escape($order_no) . " AND trans_type=".db_escape($trans_type);
        db_query($sql, "order Detail Delete");
 
+       delete_reference($trans_type, $order_no);
+
        add_audit_trail($trans_type, $order_no, Today(), _("Deleted."));
        commit_transaction();
 }
index c350642ad05c605d792bf51bf0bfae1050c5a9d1..e9d7a95ef9b6372f1a4f4ba150ddba87bcf89726 100644 (file)
@@ -115,6 +115,23 @@ function get_price ($stock_id, $currency, $sales_type_id, $factor=null, $date=nu
            $prices[$myrow['sales_type_id']][$myrow['curr_abrev']] = $myrow['price'];
        }
        $price = false;
+       if (isset($prices[$sales_type_id][$currency])) 
+       {
+           $price = $prices[$sales_type_id][$currency];
+       }
+       elseif (isset($prices[$base_id][$currency])) 
+       {
+           $price = $prices[$base_id][$currency] * $factor;
+       }
+       elseif (isset($prices[$sales_type_id][$home_curr])) 
+       {
+           $price = $prices[$sales_type_id][$home_curr] / $rate;
+       }
+       elseif (isset($prices[$base_id][$home_curr])) 
+       {
+           $price = $prices[$base_id][$home_curr] * $factor / $rate;
+       }
+/*
        if (isset($prices[$sales_type_id][$home_curr])) 
        {
            $price = $prices[$sales_type_id][$home_curr] / $rate;
@@ -127,6 +144,7 @@ function get_price ($stock_id, $currency, $sales_type_id, $factor=null, $date=nu
        {
            $price = $prices[$base_id][$home_curr] * $factor / $rate;
        }
+*/     
        elseif ($num_rows == 0 && $add_pct != -1)
        {
                $price = get_calculated_price($stock_id, $add_pct);
index 8029dc9ccb0a7e5f18088ca54f4b09ab0d9d2f53..8bd2d4c72babe5de35ba9bc3128b3de69be8fa9c 100644 (file)
@@ -194,7 +194,9 @@ function edit_link($row)
 function prt_link($row)
 {
        if ($row['type'] != ST_CUSTPAYMENT && $row['type'] != ST_BANKDEPOSIT) // customer payment or bank deposit printout not defined yet.
-               return print_document_link($row['trans_no'], _("Print"), true, $row['type'], ICON_PRINT);
+               return print_document_link($row['trans_no']."-".$row['type'], _("Print"), true, $row['type'], ICON_PRINT);
+       else    
+               return print_document_link($row['trans_no']."-".$row['type'], _("Print Receipt"), true, ST_CUSTPAYMENT, ICON_PRINT);
 }
 
 function check_overdue($row)
index b2483063e564a315d9daa47a6130d8fba6f619fe..32e5c3b5f021862b96d7ac3911b11b22735cc1e5 100644 (file)
@@ -201,9 +201,16 @@ if (isset($_GET['AddedID'])) {
 
        submenu_view(_("&View This Invoice"), ST_SALESINVOICE, $invoice);
 
-       submenu_print(_("&Print Sales Invoice"), ST_SALESINVOICE, $invoice, 'prtopt');
-       submenu_print(_("&Email Sales Invoice"), ST_SALESINVOICE, $invoice, null, 1);
+       submenu_print(_("&Print Sales Invoice"), ST_SALESINVOICE, $invoice."-".ST_SALESINVOICE, 'prtopt');
+       submenu_print(_("&Email Sales Invoice"), ST_SALESINVOICE, $invoice."-".ST_SALESINVOICE, null, 1);
        set_focus('prtopt');
+       
+       $sql = "SELECT trans_type_from, trans_no_from FROM ".TB_PREF."cust_allocations
+                       WHERE trans_type_to=".ST_SALESINVOICE." AND trans_no_to=".db_escape($invoice);
+       $result = db_query($sql, "could not retrieve customer allocation");
+       $row = db_fetch($result);
+       if ($row !== false)
+               submenu_print(_("Print &Receipt"), $row['trans_type_from'], $row['trans_no_from']."-".$row['trans_type_from'], 'prtopt');
 
        display_note(get_gl_view_str(ST_SALESINVOICE, $invoice, _("View the GL &Journal Entries for this Invoice")),0, 1);
 
@@ -237,7 +244,7 @@ function copy_to_cart()
        if ($cart->cash) {
                $cart->due_date = $cart->document_date;
                $cart->phone = $cart->cust_ref = $cart->delivery_address = '';
-               $cart->freight_cost = 0;
+               $cart->freight_cost = input_num('freight_cost');
                $cart->ship_via = 1;
                $cart->deliver_to = '';//$_POST['deliver_to'];
        } else {
@@ -332,6 +339,7 @@ function can_process() {
                return false;
        }
 
+
                if (strlen($_POST['delivery_address']) <= 1) {
                        display_error( _("You should enter the street address in the box provided. Orders cannot be accepted without a valid street address."));
                        set_focus('delivery_address');
@@ -364,6 +372,14 @@ function can_process() {
                        return false;
                }
        }
+       else
+       {
+               if (!db_has_cash_accounts())
+               {
+                       display_error(_("You need to define a cash account for your Sales Point."));
+                       return false;
+               }       
+       }       
        if (!$Refs->is_valid($_POST['ref'])) {
                display_error(_("You must enter a reference."));
                set_focus('ref');
@@ -498,27 +514,28 @@ function  handle_cancel_order()
 
 
        if ($_SESSION['Items']->trans_type == ST_CUSTDELIVERY) {
-               display_note(_("Direct delivery entry has been cancelled as requested."), 1);
-               submenu_option(_("Enter a New Sales Delivery"), $_SERVER['PHP_SELF']."?NewDelivery=0");
+               display_notification(_("Direct delivery entry has been cancelled as requested."), 1);
+               submenu_option(_("Enter a New Sales Delivery"), "/sales/sales_order_entry.php?NewDelivery=1");
 
        } elseif ($_SESSION['Items']->trans_type == ST_SALESINVOICE) {
-               display_note(_("Direct invoice entry has been cancelled as requested."), 1);
-               submenu_option(_("Enter a New Sales Invoice"),  $_SERVER['PHP_SELF']."?NewInvoice=0");
+               display_notification(_("Direct invoice entry has been cancelled as requested."), 1);
+               submenu_option(_("Enter a New Sales Invoice"),  "/sales/sales_order_entry.php?NewInvoice=1");
        } else {
                if ($_SESSION['Items']->trans_no != 0) {
-                       if (sales_order_has_deliveries(key($_SESSION['Items']->trans_no)))
+                       if ($_SESSION['Items']->trans_type == ST_SALESORDER && 
+                               sales_order_has_deliveries(key($_SESSION['Items']->trans_no)))
                                display_error(_("This order cannot be cancelled because some of it has already been invoiced or dispatched. However, the line item quantities may be modified."));
                        else {
                                delete_sales_order(key($_SESSION['Items']->trans_no), $_SESSION['Items']->trans_type);
                                if ($_SESSION['Items']->trans_type == ST_SALESQUOTE)
                                {
-                                       display_note(_("This sales quotation has been cancelled as requested."), 1);
-                                       submenu_option(_("Enter a New Sales Quotation"), $_SERVER['PHP_SELF']."?NewQuotation=Yes");
+                                       display_notification(_("This sales quotation has been cancelled as requested."), 1);
+                                       submenu_option(_("Enter a New Sales Quotation"), "/sales/sales_order_entry.php?NewQuotation=Yes");
                                }
                                else
                                {
-                                       display_note(_("This sales order has been cancelled as requested."), 1);
-                                       submenu_option(_("Enter a New Sales Order"), $_SERVER['PHP_SELF']."?NewOrder=Yes");
+                                       display_notification(_("This sales order has been cancelled as requested."), 1);
+                                       submenu_option(_("Enter a New Sales Order"), "/sales/sales_order_entry.php?NewOrder=Yes");
                                }
                        }       
                } else {
@@ -528,9 +545,7 @@ function  handle_cancel_order()
        }
        $Ajax->activate('_page_body');
        processing_end();
-       br(1);
-       end_page();
-       exit;
+       display_footer_exit();
 }
 
 //--------------------------------------------------------------------------------
@@ -634,7 +649,6 @@ if ($_SESSION['Items']->trans_type == ST_SALESINVOICE) {
 start_form();
 
 hidden('cart_id');
-
 $customer_error = display_order_header($_SESSION['Items'],
        ($_SESSION['Items']->any_already_delivered() == 0), $idate);
 
index c1597a2afb83e7c2bfa4d8b7877b533500ae4871..239b41a216aacf24952b0fa129909a24a5809dd1 100644 (file)
@@ -249,6 +249,7 @@ INSERT INTO `0_chart_master` VALUES ('2110', '', 'Accrued Income Tax - Federal',
 INSERT INTO `0_chart_master` VALUES ('2120', '', 'Accrued Income Tax - State', '4', '0');
 INSERT INTO `0_chart_master` VALUES ('2130', '', 'Accrued Franchise Tax', '4', '0');
 INSERT INTO `0_chart_master` VALUES ('2140', '', 'Accrued Real &amp; Personal Prop Tax', '4', '0');
+INSERT INTO `0_chart_master` VALUES ('2145', '', 'Purchase Tax', '4', '0');
 INSERT INTO `0_chart_master` VALUES ('2150', '', 'Sales Tax', '4', '0');
 INSERT INTO `0_chart_master` VALUES ('2160', '', 'Accrued Use Tax Payable', '4', '0');
 INSERT INTO `0_chart_master` VALUES ('2210', '', 'Accrued Wages', '4', '0');
@@ -1925,7 +1926,7 @@ CREATE TABLE `0_tax_types` (
 
 ### Data of table `0_tax_types` ###
 
-INSERT INTO `0_tax_types` VALUES ('1', '5', '2150', '2150', 'Tax', '0');
+INSERT INTO `0_tax_types` VALUES ('1', '5', '2150', '2145', 'Tax', '0');
 
 ### Structure of table `0_trans_tax_details` ###
 
index 0abbc9678425b691a05707b2d1481b49912c637b..d107e9ba6f096e0172d994380107b6fd4c0021b0 100644 (file)
@@ -231,6 +231,7 @@ INSERT INTO `0_chart_master` VALUES ('2110', '', 'Accrued Income Tax - Federal',
 INSERT INTO `0_chart_master` VALUES ('2120', '', 'Accrued Income Tax - State', '4', '0');
 INSERT INTO `0_chart_master` VALUES ('2130', '', 'Accrued Franchise Tax', '4', '0');
 INSERT INTO `0_chart_master` VALUES ('2140', '', 'Accrued Real &amp; Personal Prop Tax', '4', '0');
+INSERT INTO `0_chart_master` VALUES ('2145', '', 'Purchase Tax', '4', '0');
 INSERT INTO `0_chart_master` VALUES ('2150', '', 'Sales Tax', '4', '0');
 INSERT INTO `0_chart_master` VALUES ('2160', '', 'Accrued Use Tax Payable', '4', '0');
 INSERT INTO `0_chart_master` VALUES ('2210', '', 'Accrued Wages', '4', '0');
@@ -1704,7 +1705,7 @@ CREATE TABLE `0_tax_types` (
 
 ### Data of table `0_tax_types` ###
 
-INSERT INTO `0_tax_types` VALUES ('1', '5', '2150', '2150', 'Tax', '0');
+INSERT INTO `0_tax_types` VALUES ('1', '5', '2150', '2145', 'Tax', '0');
 
 
 ### Structure of table `0_trans_tax_details` ###
index 87b3f255058b1df5b0aa4604ae9a9b4827b7b28c..14af1c196946bb44ec1d02cd198b8404b2e0cecc 100644 (file)
@@ -38,7 +38,7 @@ function can_process()
                return false;
        }
 
-       if (!is_tax_gl_unique(get_post('sales_gl_code', 'purchasing_gl_code', $selected_id))) {
+       if (!is_tax_gl_unique(get_post('sales_gl_code'), get_post('purchasing_gl_code'), $selected_id)) {
                display_error( _("Selected GL Accounts cannot be used by another tax type."));
                set_focus('sales_gl_code');
                return false;
index 2f6a2adb9708e7dea20d796e0d22e085409d02ed..01bdeee045663f0ede906c5f71e54e579a4f901c 100644 (file)
   <li>You can easily upload all the files to your installation folder on the
 server overwriting the existing files. From 2.2 RC, your existing configuration files, - <span style="font-weight: bold;">config_db.php, config.php, /lang/installed_languages.inc and installed_extensions.php</span> - will nolonger be installed. They are created the first time you install FrontAccounting and don't need further updates.<br /><ol>
       </ol><ul><li>Backup&nbsp; (download) the following files to another folder:
-        <ul><li>if you have made <em>changes to other files</em>, like themes or so, backup
+        <ul><li>if you have made <em>changes to other files than above mentioned</em>, like themes or so, backup
 these files. </li></ul><ol>
         </ol>
 
       </li><li>Upload all the new files.
-      </li><li>Look into the file, <span style="font-weight: bold; font-style: italic;">config.default.php and compare with your own config.php</span> file. You should update the the following in your config.php:<br /><br /></li><ul><li><small>Change the $version in your <span style="font-weight: bold;">config.php</span> file, about line 59, from "2.X.X" to "2.2.4".</small></li><li><small>If this is an update from 2.2.3 to 2.2.4 &nbsp;</small><small>you are<span style="font-weight: bold;"> </span><span style="font-style: italic; font-weight: bold;">done and &nbsp;should ignore the the rest of the items in this note</span>.</small></li><li><small>Copy these 2 lines from <span style="font-weight: bold;">config.default.php</span> at the bottom into <span style="font-weight: bold;">config.php</span> at the bottom:<br /><span style="font-family: monospace;"><br />/* allow using of multi level sub-types when digits are of same length in account types */</span><br style="font-family: monospace;" /><span style="font-family: monospace;">$use_new_account_types = 0;</span><br style="font-family: monospace;" /><span style="font-family: monospace;">Change this to 1 if you want to use new multi level sup-types.</span><br style="font-family: monospace;" /></small></li><li><small>If this is an update from "2.2.X" to "2.2.3" you are<span style="font-weight: bold;"> </span><span style="font-style: italic; font-weight: bold;">done and &nbsp;should ignore the the rest of the items in this note</span>.<br /></small></li><li><small>Copy these 2 lines from <span style="font-weight: bold;">config.default.php</span> about line 80-82 into <span style="font-weight: bold;">config.php</span> about line 80:<br /><br /><span style="font-family: monospace;">/* Show users online discretetely in the footer */</span><br style="font-family: monospace;" /><span style="font-family: monospace;">$show_users_online = 0;</span><br style="font-family: monospace;" /><span style="font-family: monospace;">Change this to 1 if you want to show users online.</span><br style="font-family: monospace;" /></small></li><li><small>Replace the 2 lines about line 110-111 in <span style="font-weight: bold;">config.php</span>:<br /><br /><span style="font-family: monospace;">$table_style &nbsp;&nbsp;&nbsp; = "cellpadding=3 border=1 bordercolor='#8cacbb' style='border-collapse: collapse'";</span><br style="font-family: monospace;" /><span style="font-family: monospace;">$table_style2 &nbsp;&nbsp; &nbsp;= "cellpadding=3 border=1 bordercolor='#cccccc' style='border-collapse: collapse'";</span><br style="font-family: monospace;" /></small></li><li><small>With these 4 lines from <span style="font-weight: bold;">config.default.php</span>:<br /><br /><span style="font-family: monospace;">if (!isset($_SESSION['bordercolor']))</span><br style="font-family: monospace;" /><span style="font-family: monospace;">&nbsp; &nbsp; $_SESSION['bordercolor'] = "#8cacbb";</span><br style="font-family: monospace;" /><span style="font-family: monospace;">$table_style &nbsp;&nbsp;&nbsp; = "cellpadding=3 border=1 bordercolor='".$_SESSION['bordercolor']."' class='tablestyle'";</span><br style="font-family: monospace;" /><span style="font-family: monospace;">$table_style2 &nbsp;&nbsp;&nbsp; = "cellpadding=3 border=1 bordercolor='#cccccc' class='tablestyle2'";</span><br style="font-family: monospace;" /></small></li><li><small>Remove these 2 lines from <span style="font-weight: bold;">config.php</span> about line 176-177:<br /><br /><span style="font-family: monospace;">/* default start-up tab (orders/AP/stock/manuf/proj/GL/system) */</span><br style="font-family: monospace;" /><span style="font-family: monospace;">$def_app = "orders";</span><br style="font-family: monospace;" /></small></li><li><small>Copy these 3 lines from config.default.php about line 113-115<br /><br /><span style="font-family: monospace;">// defalt dateformats and dateseps indexes used before user login</span></small><br style="font-family: monospace;" /><small style="font-family: monospace;">$dflt_date_fmt = 0;</small><br style="font-family: monospace;" /><small><span style="font-family: monospace;">$dflt_date_sep = 0;</span><br style="font-family: monospace;" /></small></li><li><small>Copy these 2 lines from <span style="font-weight: bold;">config.default.php</span> about line 211-212:<br /><br /><span style="font-family: monospace;">define("ICON_SUBMIT", "ok.gif");&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; // new in 2.2</span><br style="font-family: monospace;" /><span style="font-family: monospace;">define("ICON_ESCAPE", "escape.png");&nbsp;&nbsp;&nbsp; // new in 2.2</span><br style="font-family: monospace;" /></small></li><li><small>And paste them into <span style="font-weight: bold;">config.php</span> about line 209</small></li><li><small>If you use gregorian calendar and have non-workdays on Friday and first day of week = Saturday<br />then you &nbsp;should &nbsp;set this line in <span style="font-weight: bold;">config.php</span> about line&nbsp; 95.<br /></small><pre><small>$date_system = 3;</small></pre></li><li><small>If you want to use FrontAccounting help wiki then set this line in config.php about line 85<br /></small><pre><small>$help_base_url = "http://frontaccounting.net/fawiki?n=Help.";<br /></small></pre></li></ul><li>Rename or remove the /install folder (you have already performed the install
+      </li><li>Look into the file, <span style="font-weight: bold; font-style: italic;">config.default.php and compare with your own config.php</span> file. You should update the the following in your config.php:<br /><br /></li><ul><li><small>Change the $version in your <span style="font-weight: bold;">config.php</span> file, about line 59, from "2.X.X" to "2.2.5".</small></li><li><small>If this is an update from 2.2.3, 2.2.4&nbsp; to 2.2.5 &nbsp;</small><small>you are<span style="font-weight: bold;"> </span><span style="font-style: italic; font-weight: bold;">done and &nbsp;should ignore the the rest of the items in this note</span>.</small></li><li><small>Copy these 2 lines from <span style="font-weight: bold;">config.default.php</span> at the bottom into <span style="font-weight: bold;">config.php</span> at the bottom:<br /><span style="font-family: monospace;"><br />/* allow using of multi level sub-types when digits are of same length in account types */</span><br style="font-family: monospace;" /><span style="font-family: monospace;">$use_new_account_types = 0;</span><br style="font-family: monospace;" /><span style="font-family: monospace;">Change this to 1 if you want to use new multi level sup-types.</span><br style="font-family: monospace;" /></small></li><li><small>If this is an update from "2.2.X" to "2.2.5" you are<span style="font-weight: bold;"> </span><span style="font-style: italic; font-weight: bold;">done and &nbsp;should ignore the the rest of the items in this note</span>.<br /></small></li><li><small>Copy these 2 lines from <span style="font-weight: bold;">config.default.php</span> about line 80-82 into <span style="font-weight: bold;">config.php</span> about line 80:<br /><br /><span style="font-family: monospace;">/* Show users online discretetely in the footer */</span><br style="font-family: monospace;" /><span style="font-family: monospace;">$show_users_online = 0;</span><br style="font-family: monospace;" /><span style="font-family: monospace;">Change this to 1 if you want to show users online.</span><br style="font-family: monospace;" /></small></li><li><small>Replace the 2 lines about line 110-111 in <span style="font-weight: bold;">config.php</span>:<br /><br /><span style="font-family: monospace;">$table_style &nbsp;&nbsp;&nbsp; = "cellpadding=3 border=1 bordercolor='#8cacbb' style='border-collapse: collapse'";</span><br style="font-family: monospace;" /><span style="font-family: monospace;">$table_style2 &nbsp;&nbsp; &nbsp;= "cellpadding=3 border=1 bordercolor='#cccccc' style='border-collapse: collapse'";</span><br style="font-family: monospace;" /></small></li><li><small>With these 4 lines from <span style="font-weight: bold;">config.default.php</span>:<br /><br /><span style="font-family: monospace;">if (!isset($_SESSION['bordercolor']))</span><br style="font-family: monospace;" /><span style="font-family: monospace;">&nbsp; &nbsp; $_SESSION['bordercolor'] = "#8cacbb";</span><br style="font-family: monospace;" /><span style="font-family: monospace;">$table_style &nbsp;&nbsp;&nbsp; = "cellpadding=3 border=1 bordercolor='".$_SESSION['bordercolor']."' class='tablestyle'";</span><br style="font-family: monospace;" /><span style="font-family: monospace;">$table_style2 &nbsp;&nbsp;&nbsp; = "cellpadding=3 border=1 bordercolor='#cccccc' class='tablestyle2'";</span><br style="font-family: monospace;" /></small></li><li><small>Remove these 2 lines from <span style="font-weight: bold;">config.php</span> about line 176-177:<br /><br /><span style="font-family: monospace;">/* default start-up tab (orders/AP/stock/manuf/proj/GL/system) */</span><br style="font-family: monospace;" /><span style="font-family: monospace;">$def_app = "orders";</span><br style="font-family: monospace;" /></small></li><li><small>Copy these 3 lines from config.default.php about line 113-115<br /><br /><span style="font-family: monospace;">// defalt dateformats and dateseps indexes used before user login</span></small><br style="font-family: monospace;" /><small style="font-family: monospace;">$dflt_date_fmt = 0;</small><br style="font-family: monospace;" /><small><span style="font-family: monospace;">$dflt_date_sep = 0;</span><br style="font-family: monospace;" /></small></li><li><small>Copy these 2 lines from <span style="font-weight: bold;">config.default.php</span> about line 211-212:<br /><br /><span style="font-family: monospace;">define("ICON_SUBMIT", "ok.gif");&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; // new in 2.2</span><br style="font-family: monospace;" /><span style="font-family: monospace;">define("ICON_ESCAPE", "escape.png");&nbsp;&nbsp;&nbsp; // new in 2.2</span><br style="font-family: monospace;" /></small></li><li><small>And paste them into <span style="font-weight: bold;">config.php</span> about line 209</small></li><li><small>If you use gregorian calendar and have non-workdays on Friday and first day of week = Saturday<br />then you &nbsp;should &nbsp;set this line in <span style="font-weight: bold;">config.php</span> about line&nbsp; 95.<br /></small><pre><small>$date_system = 3;</small></pre></li><li><small>If you want to use FrontAccounting help wiki then set this line in config.php about line 85<br /></small><pre><small>$help_base_url = "http://frontaccounting.net/fawiki?n=Help.";<br /></small></pre></li></ul><li>Rename or remove the /install folder (you have already performed the install
 process earlier).<br /></li></ul><ol>