Merged changes from main trunk up to 2.2.3
authorJanusz Dobrowolski <janusz@frontaccounting.eu>
Tue, 12 Jan 2010 14:04:56 +0000 (14:04 +0000)
committerJanusz Dobrowolski <janusz@frontaccounting.eu>
Tue, 12 Jan 2010 14:04:56 +0000 (14:04 +0000)
38 files changed:
CHANGELOG.txt
admin/db/fiscalyears_db.inc
admin/fiscalyears.php
config.default.php
gl/includes/db/gl_db_accounts.inc
gl/includes/db/gl_db_banking.inc
includes/current_user.inc
includes/data_checks.inc
includes/date_functions.inc
includes/references.inc
includes/session.inc
includes/ui/db_pager_view.inc
inventory/manage/item_codes.php
inventory/reorder_level.php
js/inserts.js
purchasing/inquiry/supplier_inquiry.php
purchasing/supplier_payment.php
reporting/includes/class.pdf.inc
reporting/includes/doctext.inc
reporting/includes/doctext2.inc
reporting/includes/header2.inc
reporting/includes/pdf_report.inc
reporting/includes/reporting.inc
reporting/includes/reports_classes.inc
reporting/prn_redirect.php
reporting/rep108.php
reporting/rep109.php
reporting/rep110.php
reporting/rep111.php
reporting/rep209.php
reporting/rep210.php [new file with mode: 0644]
reporting/rep701.php
reporting/reports_main.php
sales/allocations/customer_allocate.php
sales/create_recurrent_invoices.php
taxes/db/tax_groups_db.inc
taxes/tax_calc.inc
update.html

index 7f857820ee47c4dba75be72a511a10a7473424b7..7a6286c29ee4ec0d26bcdbaa12aa9e8c45f2d809 100644 (file)
@@ -19,6 +19,97 @@ Legend:
 ! -> Note
 $ -> Affected files
 
+12-Jan-2010 Merged changes from main trunk 2.2.2-2.2.3 as follows
+------------------------------- Release 2.2.3 ----------------------------------
+12-Jan-2010 Joe Hunt
+! Release 2.2.3
+! Allow using of multi level sub-types when digits are of same length in account types
+$ config.default.php
+  update.html
+  /gl/includes/db/gl_db_accounts.inc
+! Print COA also prints class id and account type id.
+$ /reporting/rep701.php
+
+
+11-Jan-2010 Janusz Dobrowolski
+# Removed invalid constraint on tax_types.
+$ /sql/en_US-new.sql
+
+10-Jan-2010 Janusz Dobrowolski
+! Small fix in new_doc_date()
+$ /includes/date_functions.inc
+# Prevent warnings for sql results without 'inactive' field
+$ /includes/ui/db_pager_view.inc
+# Fixed js error in IE7
+$ /js/inserts.js
++ Added support for customized doctext.inc/header2.inc
+$ /reporting/prn_redirect.php
+  /reporting/includes/pdf_report.inc
+! Increased number of decimals for tax calculations
+$ /taxes/tax_calc.inc
+! Code cleanup
+$ /includes/current_user.inc
+# Fixed check for missing POST in check_num()
+$ /includes/data_checks.inc
+# [0000187] Category and description reset after failed check;
+$ /inventory/manage/item_codes.php
+# [0000186] Timeout on Refresh button
+$ /sales/allocations/customer_allocate.php
+# [0000185] Update notification missing.
+$ inventory/reorder_level.php
+
+09-Jan-2010 Joe Hunt
+# Bugs in deleting fiscal year. Some transactions weren't deleted.
+$ /admin/fiscalyear.php
+
+07-Jan-2010 Joe Hunt
+! Changed to let the $doctypes in documents follow the types in types.inc
++ New document, Remittance, to print payment allocations to suppliers
+  Also print/email links from Supplier Payment and Supplier Inquiry.
+$ /purchasing/supplier_payment.php
+  /purchasing/inquiry/supplier_inquiry.php
+  /reporting/rep108.php
+  /reporting/rep109.php
+  /reporting/rep110.php
+  /reporting/rep111.php
+  /reporting/rep209.php
+  /reporting/rep210.php (New file)
+  /reporting/reports_main.php
+  /reporting/includes/doctext.inc
+  /reporting/includes/doctext2.inc
+  /reporting/includes/header2.inc
+  /reporting/includes/pdf_report.inc
+  /reporting/includes/reporting.inc
+  /reporting/includes/reports_classes.inc
+# Creating recurrent invoices with date outside fiscal year.  
+  /sales/create_recurrent_invoices.php
+  
+06-Jan-2010 Janusz Dobrowolski
+# Check on existence of locale.inc added to avoid blank pages when the file is broken.
+$ /includes/session.inc
+! Changed reference incrementation algorithm to preserve both number prefix and postfix.
+$ /includes/references.inc
+
+04-Jan-2010 Joe Hunt
+! Making the stretch parameter = 1 on default print pdf all over
+  Improved layout on documents.
+$ /reporting/includes/class.pdf.inc
+  /reporting/includes/pdf_report.inc
+  /reporting/includes/doctext.inc
+  /reporting/includes/doctext2.inc
+  /reporting/includes/header2.inc
+  
+31-Dec-2009 Joe Hunt
+# When updating tax rate, it didn't show and calculate correct in documents.
+$ /taxes/db/tax_groups_db.inc
+
+27-Dec-2009 Joe Hunt
+# Problems letting various currency bank accounts sharing the same GL account
+$ /gl/manage/bank_accounts.php
+  /gl/includes/db/gl_db_banking.inc
+
+---------- End of changes from main trunk 2.2.2-2.2.3
+
 11-Jan-2010 Janusz Dobrowolski
 ! Optimized database indexes.
 $ /sql/alter2.3.sql
@@ -61,6 +152,8 @@ $ /applications/application.php
 $ /js/inserts.js
 
 24-Dec-2009 Merged changes from main trunk 2.2.1-2.2.2 as follows
+------------------------------- Release 2.2.2 ----------------------------------
+23-Dec-2009 Joe Hunt
 ! Release 2.2.2
 $ /update.html
 ! Changed so Printed Sales Order (Quotation) shows TOTAL VAT INCL. if it is.
index fb2084c313e486032a34b3e178ff16ca21493540..cbd4784ee9de60787cf55abce2cc6f65b24e9e6c 100644 (file)
@@ -173,8 +173,11 @@ function delete_attachments_and_comments($type_no, $trans_no)
        }       
        $sql = "DELETE FROM ".TB_PREF."comments WHERE  type = $type_no AND id = $trans_no";
        db_query($sql, "Could not delete comments");
+       $sql = "DELETE FROM ".TB_PREF."refs WHERE  type = $type_no AND id = $trans_no";
+       db_query($sql, "Could not delete refs");
 }      
 
+//---------------------------------------------------------------------------------------------
 function delete_this_fiscalyear($selected_id)
 {
        global $db_connections;
@@ -240,9 +243,10 @@ function delete_this_fiscalyear($selected_id)
                                db_query($sql, "Could not delete debtor trans details");
                                $sql = "DELETE FROM ".TB_PREF."debtor_trans WHERE trans_no = $delivery AND type = ".ST_CUSTDELIVERY;
                                db_query($sql, "Could not delete debtor trans");
+                               delete_attachments_and_comments(ST_CUSTDELIVERY, $delivery);
                        }               
                }       
-               $sql = "DELETE FROM ".TB_PREF."cust_allocations WHERE trans_no_from = {$row['trans_no']} AND type_no_from = {$row['type']}";
+               $sql = "DELETE FROM ".TB_PREF."cust_allocations WHERE trans_no_from = {$row['trans_no']} AND trans_type_from = {$row['type']}";
                db_query($sql, "Could not delete cust allocations");
                $sql = "DELETE FROM ".TB_PREF."debtor_trans_details WHERE debtor_trans_no = {$row['trans_no']} AND debtor_trans_type = {$row['type']}";
                db_query($sql, "Could not delete debtor trans details");
@@ -255,7 +259,7 @@ function delete_this_fiscalyear($selected_id)
        $result = db_query($sql, "Could not retrieve supp trans");
        while ($row = db_fetch($result))
        {
-               $sql = "DELETE FROM ".TB_PREF."supp_allocations WHERE trans_no_from = {$row['trans_no']} AND type_no_from = {$row['type']}";
+               $sql = "DELETE FROM ".TB_PREF."supp_allocations WHERE trans_no_from = {$row['trans_no']} AND trans_type_from = {$row['type']}";
                db_query($sql, "Could not delete supp allocations");
                $sql = "DELETE FROM ".TB_PREF."supp_invoice_items WHERE supp_trans_no = {$row['trans_no']} AND supp_trans_type = {$row['type']}";
                db_query($sql, "Could not delete supp invoice items");
@@ -274,7 +278,7 @@ function delete_this_fiscalyear($selected_id)
                        $sql = "DELETE FROM ".TB_PREF."wo_issue_items WHERE issue_id = {$row2[0]}";
                        db_query($sql, "Could not delete wo issue items");
                }       
-               delete_attachments_and_comments(28, $row['id']);
+               delete_attachments_and_comments(ST_MANUISSUE, $row['id']);
                $sql = "DELETE FROM ".TB_PREF."wo_issues WHERE workorder_id = {$row['id']}";
                db_query($sql, "Could not delete wo issues");
                $sql = "DELETE FROM ".TB_PREF."wo_manufacture WHERE workorder_id = {$row['id']}";
@@ -283,7 +287,7 @@ function delete_this_fiscalyear($selected_id)
                db_query($sql, "Could not delete wo requirements");
                $sql = "DELETE FROM ".TB_PREF."workorders WHERE id = {$row['id']}";
                db_query($sql, "Could not delete workorders");
-               delete_attachments_and_comments(26, $row['id']);
+               delete_attachments_and_comments(ST_WORKORDER, $row['id']);
        }
        $sql = "SELECT loc_code, stock_id, SUM(qty) AS qty, SUM(qty*standard_cost) AS std_cost FROM ".TB_PREF."stock_moves WHERE tran_date <= '$to' GROUP by 
                loc_code, stock_id";
@@ -306,6 +310,7 @@ function delete_this_fiscalyear($selected_id)
        db_query($sql, "Could not delete exchange rates");
        $sql = "DELETE FROM ".TB_PREF."budget_trans WHERE tran_date <= '$to'";
        db_query($sql, "Could not delete exchange rates");
+       
        $sql = "SELECT account, SUM(amount) AS amount FROM ".TB_PREF."gl_trans WHERE tran_date <= '$to' GROUP by account";
        $result = db_query($sql, "Could not retrieve gl trans");
        while ($row = db_fetch($result))
@@ -314,25 +319,57 @@ function delete_this_fiscalyear($selected_id)
                db_query($sql, "Could not delete gl trans");
                if (is_account_balancesheet($row['account']))
                {
-                       $trans_no = get_next_trans_no(0);
-                       if (is_bank_account($row['account']))
-                       {
-                               $sql = "SELECT SUM(amount) FROM ".TB_PREF."bank_trans WHERE trans_date <= '$to' AND bank_act = '{$row['account']}'";
-                               $res = db_query($sql, "Could not retrieve bank trans");
-                               $row2 = db_fetch_row($res);
-                               $sql = "DELETE FROM ".TB_PREF."bank_trans WHERE trans_date <= '$to' AND bank_act = '{$row['account']}'";
-                               db_query($sql, "Could not delete bank trans");
-                               $sql = "INSERT INTO ".TB_PREF."bank_trans (type, trans_no, trans_date, bank_act, ref, amount) VALUES
-                                       (0, $trans_no, '$to', '{$row['account']}', '$ref', {$row2[0]})";
-                               db_query($sql, "Could not insert bank trans");
-                       }       
+                       $trans_no = get_next_trans_no(ST_JOURNAL);
                        $sql = "INSERT INTO ".TB_PREF."gl_trans (type, type_no, tran_date, account, memo_, amount) VALUES
-                               (0, $trans_no, '$to', '{$row['account']}', '$ref', {$row['amount']})";
+                               (".ST_JOURNAL.", $trans_no, '$to', '{$row['account']}', '$ref', {$row['amount']})";
                        db_query($sql, "Could not insert gl trans");
                }
        }
+       
+       $sql = "SELECT bank_act, SUM(amount) AS amount FROM ".TB_PREF."bank_trans WHERE trans_date <= '$to' GROUP BY bank_act";
+       $result = db_query($sql, "Could not retrieve bank trans");
+       while ($row = db_fetch($result))
+       {
+               $sql = "DELETE FROM ".TB_PREF."bank_trans WHERE trans_date <= '$to' AND bank_act = '{$row['bank_act']}'";
+               db_query($sql, "Could not delete bank trans");
+               $sql = "INSERT INTO ".TB_PREF."bank_trans (type, trans_no, trans_date, bank_act, ref, amount) VALUES
+                       (0, 0, '$to', '{$row['bank_act']}', '$ref', {$row['amount']})";
+               db_query($sql, "Could not insert bank trans");
+       }       
+       
+       $sql = "DELETE FROM ".TB_PREF."audit_trail WHERE gl_date <= '$to'";
+       db_query($sql, "Could not delete audit trail");
+       
+       $sql = "SELECT type, id FROM ".TB_PREF."comments WHERE type != ".ST_SALESQUOTE." AND type != ".ST_SALESORDER." AND type != ".ST_PURCHORDER;
+       $result = db_query($sql, "Could not retrieve comments");
+       while ($row = db_fetch($result))
+       {
+               $sql = "SELECT count(*) FROM ".TB_PREF."gl_trans WHERE type = {$row['type']} AND type_no = {$row['id']}";
+               $res = db_query($sql, "Could not retrieve gl_trans");
+               $row2 = db_fetch_row($res);
+               if ($row2[0] == 0) // if no link, then delete comments
+               {
+                       $sql = "DELETE FROM ".TB_PREF."comments WHERE type = {$row['type']} AND id = {$row['id']}";
+                       db_query($sql, "Could not delete comments");
+               }
+       }       
+       $sql = "SELECT type, id FROM ".TB_PREF."refs WHERE type != ".ST_SALESQUOTE." AND type != ".ST_SALESORDER." AND type != ".ST_PURCHORDER;
+       $result = db_query($sql, "Could not retrieve refs");
+       while ($row = db_fetch($result))
+       {
+               $sql = "SELECT count(*) FROM ".TB_PREF."gl_trans WHERE type = {$row['type']} AND type_no = {$row['id']}";
+               $res = db_query($sql, "Could not retrieve gl_trans");
+               $row2 = db_fetch_row($res);
+               if ($row2[0] == 0) // if no link, then delete refs
+               {
+                       $sql = "DELETE FROM ".TB_PREF."refs WHERE type = {$row['type']} AND id = {$row['id']}";
+                       db_query($sql, "Could not delete refs");
+               }
+       }       
+               
        delete_fiscalyear($selected_id);
        commit_transaction();   
 }
 
+
 ?>
\ No newline at end of file
index 1c674ff4ee7f57a9386d66b9400956c03ac1ea68..bae4e4bbc4226e7b095ccb313a39ad43e710e47a 100644 (file)
@@ -126,7 +126,7 @@ function display_fiscalyears()
 
        $result = get_all_fiscalyears();
        start_form();
-       display_note(_("Warning: During fiscal year removal all transactions 
+       display_note(_("Warning: Deleting a fiscal year all transactions 
                are removed and converted into relevant balances. This process is irreversible!"), 
                0, 0, "class='currentfg'");
        start_table($table_style);
@@ -161,7 +161,7 @@ function display_fiscalyears()
                if ($myrow["id"] != $company_year) {
                        delete_button_cell("Delete".$myrow['id'], _("Delete"));
                        submit_js_confirm("Delete".$myrow['id'],
-                               sprintf(_("Are you sure you want to remove fiscal year %s - %s? All transactions are removed and converted into relevant balances. Do you want to continue ?"), $from, $to));
+                               sprintf(_("Are you sure you want to delete fiscal year %s - %s? All transactions are deleted and converted into relevant balances. Do you want to continue ?"), $from, $to));
                } else
                        label_cell('');
                end_row();
index 67bb2dd25494a1a70daa3d8922bb60269746d265..17fb66d7d8dbb05c71959236951d9c199bf3eb3d 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";
+       $version                = "2.3 CVS (m3)";
 
        // Build for development purposes
        $build_version  = date("d.m.Y", filemtime("$path_to_root/CHANGELOG.txt"));
@@ -211,4 +211,8 @@ if (!defined('ICON_EDIT'))
        define("ICON_SUBMIT", "ok.gif");
        define("ICON_ESCAPE", "escape.png");    
 }
+
+       /* allow using of multi level sub-types when digits are of same length in account types */
+       $use_new_account_types = 0;
+
 ?>
\ No newline at end of file
index 279a55bee2fb93dd42b71a6b3c831cbd8a3900a2..685619736746e6bffbd9b152d5adf4ed95f8c3d0 100644 (file)
@@ -50,6 +50,8 @@ function get_gl_accounts($from=null, $to=null)
 
 function get_gl_accounts_all($balance=-1)
 {
+       global $use_new_account_types;
+       
        if ($balance == 1)
                $where ="WHERE ctype>0 AND ctype<".CL_INCOME;
        elseif ($balance == 0)  
@@ -62,8 +64,11 @@ function get_gl_accounts_all($balance=-1)
                LEFT JOIN ".TB_PREF."chart_master ON ".TB_PREF."chart_master.account_type=".TB_PREF."chart_types.id ";
        if ($balance != -1)
                $sql .= $where;                                 
-        $sql .= " ORDER BY ".TB_PREF."chart_class.cid, IF(parent > 0,parent,".TB_PREF."chart_types.id), 
-               IF(parent > 0,".TB_PREF."chart_types.id, parent), ".TB_PREF."chart_master.account_code";
+       if (isset($use_new_account_types) && $use_new_account_types == 1)
+               $sql .= " ORDER BY ".TB_PREF."chart_class.cid, ".TB_PREF."chart_types.id, parent, ".TB_PREF."chart_master.account_code";
+       else
+               $sql .= " ORDER BY ".TB_PREF."chart_class.cid, IF(parent > 0,parent,".TB_PREF."chart_types.id), 
+                       IF(parent > 0,".TB_PREF."chart_types.id, parent), ".TB_PREF."chart_master.account_code";
 
        return db_query($sql, "could not get gl accounts");
 }
index 84df6f9d2a53ab1866b08759de5b3cc344a0ffc3..afc9e516ccdad66570c4dd028863e230eb8e9353 100644 (file)
@@ -17,6 +17,7 @@ function add_exchange_variation($trans_type, $trans_no, $date_, $acc_id, $accoun
        if ($date_ == null)
                $date_ = Today();
        $rate = get_exchange_rate_from_home_currency($currency, $date_);
+/*     
        $result = db_query("SELECT SUM(amount) FROM ".TB_PREF."bank_trans WHERE 
                bank_act=".db_escape($acc_id)." AND trans_date<='".date2sql($date_)."'", 
                "Transactions for account $account could not be calculated");
@@ -24,6 +25,16 @@ function add_exchange_variation($trans_type, $trans_no, $date_, $acc_id, $accoun
        $foreign_amount = $row[0];
        $amount = get_gl_trans_from_to("", $date_, $account);
        $diff = $amount - (round2($foreign_amount * $rate, user_price_dec()));
+*/
+       $result = db_query("SELECT SUM(bt.amount) AS foreign_amount, SUM(gt.amount) AS amount           
+               FROM ".TB_PREF."bank_trans bt,  ".TB_PREF."gl_trans gt, ".TB_PREF."bank_accounts ba
+               WHERE bt.bank_act=".db_escape($acc_id)." AND bt.trans_date<='".date2sql($date_)."'
+               AND ((bt.amount > 0 AND gt.amount > 0) OR (bt.amount <= 0 AND gt.amount <= 0)) 
+               AND bt.type = gt.type AND bt.trans_no = gt.type_no 
+               AND ba.id = bt.bank_act AND ba.account_code = gt.account",
+               "Transactions for account $account could not be calculated");
+       $row = db_fetch($result);
+       $diff = $row['amount'] - (round2($row['foreign_amount'] * $rate, user_price_dec()));
        if ($diff != 0)
        {
                if ($trans_type == null)
@@ -102,7 +113,9 @@ function add_bank_transfer($from_account, $to_account, $date_,
                $date_, $amount, PT_MISC, "",
                $currency, "Cannot insert a destination bank transaction");
 
-       add_exchange_variation($trans_type, $trans_no, $date_, $from_account, $from_gl_account, 
+       $currency = get_bank_account_currency($to_account);
+       
+       add_exchange_variation($trans_type, $trans_no, $date_, $to_account, $to_gl_account, 
                $currency, PT_MISC, "");
        
        add_comments($trans_type, $trans_no, $date_, $memo_);
index 023da535e5d737e72fdad0f1f0631715ccb77b48..bca45f0875cdcd589a6430b5b701498979e04d67 100644 (file)
@@ -281,10 +281,12 @@ function user_numeric($input) {
 
     $num = trim($input);
     $sep = $thoseps[user_tho_sep()];
-    if($sep!='') $num = str_replace( $sep, '', $num);
-       str_replace($sep, '', $num);
+    if ($sep!='')
+       $num = str_replace( $sep, '', $num);
+
     $sep = $decseps[user_dec_sep()];
-    if($sep!='.') $num = str_replace( $sep, '.', $num);
+    if ($sep!='.')
+       $num = str_replace( $sep, '.', $num);
 
     if (!is_numeric($num))
          return false;
index 295a353e1203d2ec1cc484291803d9e8113f7fe7..9589f13c9e60d181db3d8b3abef14017c0690969 100644 (file)
@@ -475,7 +475,7 @@ function check_num($postname, $min=null, $max=null) {
        if(!isset($_POST[$postname]))
          return 0;
     $num = input_num($postname);
-    if ($num === false) 
+    if ($num === false || $num === null
          return 0;
     if (isset($min) && ($num<$min)) 
          return 0;
index 94654c35c874d5003e9021db442e1e626530a7ba..47876bb87d0de2bef00ba5019b4c0e39754b0e68 100644 (file)
@@ -148,7 +148,7 @@ function Now()
 //
 function new_doc_date($date=null)
 {
-       if (isset($date))
+       if (isset($date) && $date != '')
                $_SESSION['_default_date'] = $date;
 
        if (!isset($_SESSION['_default_date']) || !sticky_doc_date())
index 6487404b299546ff98f77cd89110b562b7042609..420e960e805d0169280c8d8dafd73dcd25656398 100644 (file)
@@ -64,16 +64,19 @@ class references
        function increment($reference) 
        {
                // New method done by Pete. So f.i. WA036 will increment to WA037 and so on.
-               // If $reference is trailed by digits, and digits only,
-        // extract them and add 1, then put the alpha prefix back on
+               // If $reference contains at least one group of digits,
+        // extract first didgits group and add 1, then put all together.
         // NB. preg_match returns 1 if the regex matches completely 
         // also $result[0] holds entire string, 1 the first captured, 2 the 2nd etc.
-        if (preg_match('/^(.*?)(\d+)$/', $reference, $result) == 1) 
+        //
+        if (preg_match('/^(\D*?)(\d+)(.*)/', $reference, $result) == 1) 
         {
-            $dig_count = strlen($result[2]); // How many digits? eg. 0003 = 4
-            $fmt = '%0' . $dig_count . 'd'; // Make a format string - leading zeroes
-            $nextval =  $result[1] . sprintf($fmt, intval($result[2] + 1)); // Add one on, and put prefix back on
-            return $nextval;
+                       list($all, $prefix, $number, $postfix) = $result;
+                       $dig_count = strlen($number); // How many digits? eg. 0003 = 4
+                       $fmt = '%0' . $dig_count . 'd'; // Make a format string - leading zeroes
+                       $nextval =  sprintf($fmt, intval($number + 1)); // Add one on, and put prefix back on
+
+                       return $prefix.$nextval.$postfix;
         }
         else 
             return $reference;
index ba703dee0e8432e5dbd442cfcfd78b2e66db3be8..8929ff2e4341e83a777b7e75ebd4fb7d76e8789c 100644 (file)
@@ -176,8 +176,9 @@ if (!isset($_SESSION['language']))
 $_SESSION['language']->set_language($_SESSION['language']->code);
 
 // include $Hooks object if locale file exists
-if(@include_once($path_to_root . "/lang/".$_SESSION['language']->code."/locale.inc")) 
+if (file_exists($path_to_root . "/lang/".$_SESSION['language']->code."/locale.inc"))
 {
+       include_once($path_to_root . "/lang/".$_SESSION['language']->code."/locale.inc");
        $Hooks = new Hooks();
 }
 
index 4bc49948dc312bae82ff99a40624a22f793bd908..d941cf9056af0bec273a33d2ae79a5472a5b43c4 100644 (file)
@@ -162,7 +162,7 @@ function display_db_pager(&$pager) {
 
        start_row("class='navibar'");
        $colspan = count($pager->columns);
-               $inact = $pager->inactive_ctrl==true 
+               $inact = @$pager->inactive_ctrl==true 
                        ? ' '.checkbox(null, 'show_inactive', null, true). _("Show also Inactive") : '';
         if($pager->rec_count) {
                echo "<td colspan=$colspan class='navibar' style='border:none;padding:3px;'>";
@@ -170,7 +170,7 @@ function display_db_pager(&$pager) {
                $but_pref = $pager->name.'_page_';
            start_table();
                start_row();
-               if ($pager->inactive_ctrl) 
+               if (@$pager->inactive_ctrl) 
                                submit('Update', _('Update'), true, '', null); // inactive update
                echo navi_button_cell($but_pref.'first', _('First'), $pager->first_page, 'right');
                echo navi_button_cell($but_pref.'prev', _('Prev'), $pager->prev_page,'right');
index a731d9ed5336078555ff2aeb6c0b2753753994e3..d26f6f413522ea7178d016badb5fed0bb9643547 100644 (file)
@@ -35,10 +35,10 @@ if ($Mode=='ADD_ITEM' || $Mode=='UPDATE_ITEM')
        display_error( _("There is no item selected."));
                set_focus('stock_id');
        }
-       elseif (!check_num('quantity', 0))
+       elseif (!input_num('quantity'))
        {
        $input_error = 1;
-       display_error( _("The price entered was not numeric."));
+       display_error( _("The price entered was not positive number."));
                set_focus('quantity');
        }
        elseif ($_POST['description'] == '')
@@ -152,22 +152,23 @@ div_end();
 
 //-----------------------------------------------------------------------------------------------
 
-if ($Mode =='Edit')
-{
-       $myrow = get_item_code($selected_id);
-       $_POST['item_code'] = $myrow["item_code"];
-    $_POST['quantity'] = $myrow["quantity"];
-    $_POST['description'] = $myrow["description"];
-    $_POST['category_id'] = $myrow["category_id"];
-}
- else {
-    $_POST['quantity'] = 1;
-    $_POST['description'] = $dflt_desc;
-    $_POST['category_id'] = $dflt_cat;
+if ($selected_id != '') {
+       if ($Mode =='Edit')
+       {
+               $myrow = get_item_code($selected_id);
+               $_POST['item_code'] = $myrow["item_code"];
+               $_POST['quantity'] = $myrow["quantity"];
+               $_POST['description'] = $myrow["description"];
+               $_POST['category_id'] = $myrow["category_id"];
+       }
+       hidden('selected_id', $selected_id);
+} else {
+       $_POST['quantity'] = 1;
+       $_POST['description'] = $dflt_desc;
+       $_POST['category_id'] = $dflt_cat;
 }
 
 echo "<br>";
-hidden('selected_id', $selected_id);
 start_table($table_style2);
 
 hidden('code_id', $selected_id);
index 25e849554dbba04f5aae19a4105979687c7cfbc4..787348a5987e08e3442b60446aa02afc0b003ee8 100644 (file)
@@ -72,6 +72,7 @@ while ($myrow = db_fetch($result))
 
                $myrow["reorder_level"] = input_num($myrow["loc_code"]);
                set_reorder_level($_POST['stock_id'], $myrow["loc_code"], input_num($myrow["loc_code"]));
+               display_notification(_("Reorder levels has been updated."));
        }
 
        $qoh = get_qoh_on_date($_POST['stock_id'], $myrow["loc_code"]);
index 4d665e843fbe8b6a73353a745a4cbe16ec7ed96b..cebb2a438bae3bd2d930c3147620c4a50d73937b 100644 (file)
@@ -305,7 +305,7 @@ var inserts = {
                    }
                }
            }
-       },
+       }
 /*     'tr.editrow': function(e) {
                        e.onkeydown = function(ev) { 
                        ev = ev||window.event;
@@ -332,6 +332,7 @@ var inserts = {
        }
 */
 };
+
 function stopEv(ev) {
                        if(ev.preventDefault) {
                                ev.preventDefault();
index 7a012905589c617165d86a2bdcc657149840e8ce..ea5c8384cfb8624a7e5fe1d58ad3d93538a0f203 100644 (file)
@@ -15,6 +15,7 @@ include($path_to_root . "/includes/db_pager.inc");
 include($path_to_root . "/includes/session.inc");
 
 include($path_to_root . "/purchasing/includes/purchasing_ui.inc");
+include($path_to_root . "/reporting/includes/reporting.inc");
 
 $js = "";
 if ($use_popup_windows)
@@ -146,7 +147,8 @@ function fmt_credit($row)
 
 function prt_link($row)
 {
-               return print_document_link($row['trans_no'], _("Print"), true, $row['type']);
+       if ($row['type'] == ST_SUPPAYMENT || $row['type'] == ST_BANKPAYMENT || $row['type'] == ST_SUPPCREDIT) 
+               return print_document_link($row['trans_no']."-".$row['type'], _("Print Remittance"), true, ST_SUPPAYMENT, ICON_PRINT);
 }
 
 function check_overdue($row)
@@ -170,7 +172,8 @@ $cols = array(
                        _("Debit") => array('align'=>'right', 'fun'=>'fmt_debit'), 
                        _("Credit") => array('align'=>'right', 'insert'=>true,'fun'=>'fmt_credit'), 
                        array('insert'=>true, 'fun'=>'gl_view'),
-                       array('insert'=>true, 'fun'=>'credit_link')
+                       array('insert'=>true, 'fun'=>'credit_link'),
+                       array('insert'=>true, 'fun'=>'prt_link')
                        );
 
 if ($_POST['supplier_id'] != ALL_TEXT)
index 68ed1c8f61b8762878d9c9528c21ebc1bc93d2c4..0c8aa7dd4940c75979d984fafdf4f6ec9e786a93 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 . "/purchasing/includes/ui/supp_alloc_ui.inc");
 include_once($path_to_root . "/purchasing/includes/purchasing_db.inc");
+include_once($path_to_root . "/reporting/includes/reporting.inc");
 
 $js = "";
 if ($use_popup_windows)
@@ -69,6 +70,9 @@ if (isset($_GET['AddedID']))
 
        display_notification_centered( _("Payment has been sucessfully entered"));
 
+       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")));
 
 //    hyperlink_params($path_to_root . "/purchasing/allocations/supplier_allocate.php", _("&Allocate this Payment"), "trans_no=$payment_id&trans_type=22");
index 6eae796133ea9faa3a08533a60321a46a231e93c..778459dc7124c603b6382df824a2ae6d965172a9 100644 (file)
@@ -258,7 +258,7 @@ class Cpdf extends TCPDF {
                return array($txt2, $ret);
        }
 
-       function addTextWrap($xb, $yb, $w, $h, $txt, $align='left', $border=0, $fill=0, $link = NULL, $stretch = 0, $spacebreak=false)
+       function addTextWrap($xb, $yb, $w, $h, $txt, $align='left', $border=0, $fill=0, $link = NULL, $stretch = 1, $spacebreak=false)
        {
                $ret = "";
                if (!$this->rtl)
index d94ffe0cde8490ff2559b57ce364dd75e1713e98..40a0802b5a3fa65224c72e28861a15b34586460d 100644 (file)
@@ -13,7 +13,7 @@ if (isset($header2type))
 {
        $doc_Cust_no = _("Cust no");
        $doc_Date = _("Date");
-       if ($doctype == 8) // Purchase Order
+       if ($doctype == ST_PURCHORDER || $doctype == ST_SUPPAYMENT) // Purchase Order
        {
                $doc_Charge_To = _("Order To");
                $doc_Delivered_To = _("Charge To");
@@ -24,14 +24,14 @@ if (isset($header2type))
                $doc_Delivered_To = _("Delivered To");
        }       
        $doc_Shipping_Company = _("Shipping Company");
-       if ($doctype == 7)
+       if ($doctype == ST_SALESQUOTE)
                $doc_Due_Date = _("Valid until");
-       elseif ($doctype == 9)
+       elseif ($doctype == ST_SALESORDER)
                $doc_Due_Date = _("Delivery Date");
        else
                $doc_Due_Date = _("Due Date");
        $doc_Your_Ref = _("Your Ref");
-       if ($doctype == 26)
+       if ($doctype == ST_WORKORDER)
        {
                $doc_Our_Ref = _("Type");
                $doc_Your_VAT_no = _("Manufactured Item");
@@ -42,7 +42,10 @@ if (isset($header2type))
        }       
        else
        {
-               $doc_Our_Ref = _("Our Ref.");
+               if ($doctype == ST_SUPPAYMENT)
+                       $doc_Our_Ref = _("Type");
+               else    
+                       $doc_Our_Ref = _("Sales Person");
                $doc_Your_VAT_no = _("Your VAT no.");
                $doc_Payment_Terms = _("Payment Terms");
                $doc_Customers_Ref = _("Customers Reference");
@@ -50,47 +53,52 @@ if (isset($header2type))
        }
        $doc_Our_VAT_no = _("Our VAT No.");
        $doc_Domicile = _("Domicile");
-       if($doctype == 13 || $doctype == 7 || $doctype == 8 || $doctype == 9) {
+       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");
   } else {
         $doc_Bank_Account = _("Bank Account");
-        $doc_Please_Quote = $doctype==10 ? 
+        $doc_Please_Quote = $doctype==ST_SALESINVOICE ? 
         _("Please quote Invoice no. when paying. All amounts stated in") :
         _("Please quote Credit no. when paying. All amounts stated in");
        }
        $doc_Address = _("Address");
        $doc_Phone_Fax_Email = _("Phone/Fax/Email");
        $doc_Bank = _("Bank");
-       $doc_Bank_Account = _("Bank Account");
        $doc_Payment_Link = _("You can pay through");
-       if ($doctype == 7 || $doctype == 8 || $doctype == 9 || $doctype == 10 || $doctype == 11 || $doctype == 13 || $doctype == 26)
+       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)
        {
-               if ($doctype == 7)
+               if ($doctype == ST_SALESQUOTE)
                        $this->title = _("SALES QUOTATION");
-               elseif ($doctype == 8)
+               elseif ($doctype == ST_PURCHORDER)
                        $this->title = _("PURCHASE ORDER");
-               elseif ($doctype == 13)
+               elseif ($doctype == ST_CUSTDELIVERY)
                        $this->title = ($packing_slip==1 ? _("PACKING SLIP") : _("DELIVERY NOTE"));
-               elseif ($doctype == 9)
+               elseif ($doctype == ST_SALESORDER)
                        $this->title = ($print_as_quote==1 ? _("QUOTE") : _("SALES ORDER"));
-               elseif ($doctype == 10)
+               elseif ($doctype == ST_SALESINVOICE)
                        $this->title = _("INVOICE");
-               elseif ($doctype == 26)
+               elseif ($doctype == ST_WORKORDER)
                        $this->title = _("WORK ORDER");
+               elseif ($doctype == ST_SUPPAYMENT)
+                       $this->title = _("REMITTANCE");
                else
                        $this->title = _("CREDIT NOTE");
-               if ($doctype == 8)
+               if ($doctype == ST_PURCHORDER)
                        $this->headers = array(_("Item Code"), _("Item Description"),
                                _("Delivery Date"), _("Quantity"),      _("Unit"), _("Price"), _("Total"));
-               elseif ($doctype == 26)
+               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)
+                       $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 == 12)
+       else if ($doctype == ST_CUSTPAYMENT)
        {
                $this->title = _("STATEMENT");
                $this->headers = array(_("Trans Type"), _("#"), _("Date"), _("DueDate"), _("Charges"),
@@ -106,26 +114,35 @@ if (isset($emailtype))
 }
 if (isset($header2type) || isset($linetype))
 {
-       $doc_Invoice_no = ($doctype==13 ? _("Delivery Note No.") : (($doctype==7 || $doctype==8 || $doctype==9) ? _("Order no.") : 
-               ($doctype==10 ? _("Invoice No.") : ($doctype==26 ? _("Word Order No") : _("Credit No.")))));
+       $doc_Invoice_no = ($doctype==ST_CUSTDELIVERY ? _("Delivery Note 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."))))));
        $doc_Delivery_no = _("Delivery Note No.");
        $doc_Order_no = _("Order no.");
 }
 if (isset($linetype))
 {
-       if ($doctype == 7 || $doctype == 8 || $doctype == 9 || $doctype == 10 || $doctype == 11 || $doctype == 13)
+       if ($doctype == ST_SALESQUOTE || $doctype == ST_PURCHORDER || $doctype == ST_SALESORDER || 
+               $doctype == ST_SALESINVOICE || $doctype == ST_CUSTCREDIT || $doctype == ST_CUSTDELIVERY)
        {
                $doc_Sub_total = _("Sub-total");
                $doc_Shipping = _("Shipping");
                $doc_Included = _("Included");
                $doc_Amount = _("Amount");
-               $doc_TOTAL_INVOICE = $doctype ==10 ? _("TOTAL INVOICE") : _("TOTAL CREDIT");
+               $doc_TOTAL_INVOICE = $doctype ==ST_SALESINVOICE ? _("TOTAL INVOICE") : _("TOTAL CREDIT");
                $doc_TOTAL_ORDER = _("TOTAL ORDER EX VAT");
                $doc_TOTAL_ORDER2 = _("TOTAL ORDER VAT INCL.");
                $doc_TOTAL_PO = _("TOTAL PO EX VAT");
                $doc_TOTAL_DELIVERY = _("TOTAL DELIVERY INCL. VAT");
        }
-       else if ($doctype == 12)
+       elseif ($doctype == ST_SUPPAYMENT)
+       {
+               $doc_Total_Allocated = _("Total Allocated");
+               $doc_Left_To_Allocate = _("Left to Allocate");
+               $doc_Total_Payment = _("TOTAL REMITTANCE");
+       }
+       elseif ($doctype == ST_CUSTPAYMENT)
        {
                $doc_Outstanding = _("Outstanding Transactions");
                $doc_Current = _("Current");
index d4a725b76ab43c1189dd74efa4a48c74917b4392..554409e774acb5c4bfa6ec6111063fb24e059729 100644 (file)
@@ -13,7 +13,7 @@ if (isset($header2type))
 {
        $doc_Cust_no = "Cust no";
        $doc_Date = "Date";
-       if ($doctype == 8) // Purchase Order
+       if ($doctype == ST_PURCHORDER || $doctype == ST_SUPPAYMENT) // Purchase Order
        {
                $doc_Charge_To = "Order To";
                $doc_Delivered_To = "Charge To";
@@ -24,14 +24,14 @@ if (isset($header2type))
                $doc_Delivered_To = "Delivered To";
        }       
        $doc_Shipping_Company = "Shipping Company";
-       if ($doctype == 7)
+       if ($doctype == ST_SALESQUOTE)
                $doc_Due_Date = "Valid until";
-       if ($doctype == 9)
+       elseif ($doctype == ST_SALESORDER)
                $doc_Due_Date = "Delivery Date";
        else
                $doc_Due_Date = "Due Date";
        $doc_Your_Ref = "Your Ref";
-       if ($doctype == 26)
+       if ($doctype == ST_WORKORDER)
        {
                $doc_Our_Ref = "Type";
                $doc_Your_VAT_no = "Manufactured Item";
@@ -42,7 +42,10 @@ if (isset($header2type))
        }       
        else
        {
-               $doc_Our_Ref = "Our Ref.";
+               if ($doctype == ST_SUPPAYMENT)
+                       $doc_Our_Ref = "Type";
+               else    
+                       $doc_Our_Ref = "Sales Person";
                $doc_Your_VAT_no = "Your VAT no.";
                $doc_Payment_Terms = "Payment Terms";
                $doc_Customers_Ref = "Customers Reference";
@@ -50,46 +53,51 @@ if (isset($header2type))
        }
        $doc_Our_VAT_no = "Our VAT No.";
        $doc_Domicile = "Domicile";
-       if($doctype == 13 || $doctype == 7 || $doctype == 8 || $doctype == 9) {
+       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";
   } else {
-        $doc_Please_Quote = "Please quote ".($doctype==10 ? "Invoice" : "Credit")
+        $doc_Please_Quote = "Please quote ".($doctype==ST_SALESINVOICE ? "Invoice" : "Credit")
                ." no. when paying. All amounts stated in";
         $doc_Bank_Account = "Bank Account";
        }
        $doc_Address = "Address";
        $doc_Phone_Fax_Email = "Phone/Fax/Email";
        $doc_Bank = "Bank";
-       $doc_Bank_Account = "Bank Account";
        $doc_Payment_Link = "You can pay through";
-       if ($doctype == 7 || $doctype == 8 || $doctype == 9 || $doctype == 10 || $doctype == 11 || $doctype == 13 || $doctype == 26)
+       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)
        {
-               if ($doctype == 7)
+               if ($doctype == ST_SALESQUOTE)
                        $this->title = "SALES QUOTATION";
-               elseif ($doctype == 8)
+               elseif ($doctype == ST_PURCHORDER)
                        $this->title = "PURCHASE ORDER";
-               elseif ($doctype == 9)
+               elseif ($doctype == ST_SALESORDER)
                        $this->title = ($print_as_quote==1 ? "QUOTE" : "SALES ORDER");
-               elseif ($doctype == 10)
+               elseif ($doctype == ST_SALESINVOICE)
                        $this->title = "INVOICE";
-               elseif ($doctype == 13)
+               elseif ($doctype == ST_CUSTDELIVERY)
                        $this->title = ($packing_slip==1 ? "PACKING SLIP" : "DELIVERY NOTE");
-               elseif ($doctype == 26)
+               elseif ($doctype == ST_WORKORDER)
                        $this->title = "WORK ORDER";
+               elseif ($doctype == ST_SUPPAYMENT)
+                       $this->title = "REMITTANCE";
                else
                        $this->title = "CREDIT NOTE";
-               if ($doctype == 8)
+               if ($doctype == ST_PURCHORDER)
                        $this->headers = array('Item Code', 'Item Description', 'Delivery Date',
                                'Quantity', 'Unit',     'Price', 'Total');
-               elseif ($doctype == 26)
+               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)
+                       $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 == 12)
+       elseif ($doctype == ST_CUSTPAYMENT)
        {
                $this->title = "STATEMENT";
                $this->headers = array('Trans Type', '#', 'Date', 'Due Date', 'Charges',
@@ -105,26 +113,35 @@ if (isset($emailtype))
 }
 if (isset($header2type) || isset($linetype))
 {
-       $doc_Invoice_no = ($doctype==13 ? "Delivery Note No." : (($doctype == 7 || $doctype==8 || $doctype==9) ? "Order no." : 
-       ($doctype==10 ? "Invoice No." : ($doctype == 26 ? "Work Order No" : "Credit No."))));
+       $doc_Invoice_no = ($doctype==ST_CUSTDELIVERY ? "Delivery Note 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.")))));
        $doc_Delivery_no = "Delivery Note No.";
        $doc_Order_no = "Order no.";
 }
 if (isset($linetype))
 {
-       if ($doctype == 7 || $doctype == 8 || $doctype == 9 || $doctype == 10 || $doctype == 11 || $doctype == 13)
+       if ($doctype == ST_SALESQUOTE || $doctype == ST_PURCHORDER || $doctype == ST_SALESORDER || $doctype == ST_SALESINVOICE || 
+               $doctype == ST_CUSTCREDIT || $doctype == ST_CUSTDELIVERY)
        {
                $doc_Sub_total = "Sub-total";
                $doc_Shipping = "Shipping";
                $doc_Included = "Included";
                $doc_Amount = "amount";
-               $doc_TOTAL_INVOICE = $doctype==10 ? "TOTAL INVOICE" : "TOTAL CREDIT";
+               $doc_TOTAL_INVOICE = $doctype==ST_SALESINVOICE ? "TOTAL INVOICE" : "TOTAL CREDIT";
                $doc_TOTAL_ORDER = "TOTAL ORDER EX VAT";
                $doc_TOTAL_ORDER2 = "TOTAL ORDER VAT INCL.";
                $doc_TOTAL_PO = "TOTAL PO EX VAT";
                $doc_TOTAL_DELIVERY = "TOTAL DELIVERY INCL. VAT";
        }
-       else if ($doctype == 12)
+       elseif ($doctype == ST_SUPPAYMENT)
+       {
+               $doc_Total_Allocated = "Total Allocated";
+               $doc_Left_To_Allocate = "Left to Allocate";
+               $doc_Total_Payment = "TOTAL REMITTANCE";
+       }
+       elseif ($doctype == ST_CUSTPAYMENT)
        {
                $doc_Outstanding = "Outstanding Transactions";
                $doc_Current = "Current";
index 1a03c8b823cdb0c1ef2a0559451465ad388b14cf..e09df98175a81322dbdbe858a358e2f46e58e687 100644 (file)
@@ -11,7 +11,7 @@
 ***********************************************************************/
                // New version (without vertical lines)
 
-       global $wo_types_array;
+       global $wo_types_array, $systypes_array;
        
                $this->row = $this->pageHeight - $this->topMargin;
 
                        $this->Text($c2col, $this->company['gst_no'], $mcol);
                        $this->NewLine();
                }
-               if (($doctype == 10 || $doctype == 12) && $this->company['domicile'] != "")
+               if (($doctype == ST_SALESINVOICE || $doctype == ST_CUSTPAYMENT) && $this->company['domicile'] != "")
                {
                        $this->Text($ccol, $doc_Domicile, $c2col);
                        $this->Text($c2col, $this->company['domicile'], $mcol);
                $this->Font();
                $this->row = $adrline;
                $this->NewLine(3);
-               $this->Text($mcol + 100, $doc_Date.":");
-               if ($doctype == 7 || $doctype == 8 || $doctype == 9)
+               $this->Text($mcol + 100, $doc_Date);
+               if ($doctype == ST_SALESQUOTE || $doctype == ST_PURCHORDER || $doctype == ST_SALESORDER)
                        $this->Text($mcol + 180, sql2date($myrow['ord_date']));
-               elseif ($doctype == 26) 
+               elseif ($doctype == ST_WORKORDER)       
                        $this->Text($mcol + 180, sql2date($myrow['date_']));
                else
                        $this->Text($mcol + 180, sql2date($myrow['tran_date']));
                $this->NewLine();
                $this->Text($mcol + 100, $doc_Invoice_no);
-               if ($doctype == 7 || $doctype == 8 || $doctype == 9) // QUOTE, PO or SO
+               if ($doctype == ST_SALESQUOTE || $doctype == ST_PURCHORDER || $doctype == ST_SALESORDER) // QUOTE, PO or SO
                {
                        if ($print_invoice_no == 1)
                                $this->Text($mcol + 180, $myrow['order_no']);
                        else    
                                $this->Text($mcol + 180, $myrow['reference']);
                }               
-               elseif ($doctype == 26) 
+               elseif ($doctype == ST_WORKORDER)       
                        $this->Text($mcol + 180, $myrow['id']);
                else if (isset($myrow['trans_no']) && isset($myrow['reference'])) // INV/CRE/STA
                {
                $this->row = $this->row - $this->lineHeight - 5;
 
                $temp = $this->row;
-               if ($doctype == 7 || $doctype == 9)
+               if ($doctype == ST_SALESQUOTE || $doctype == ST_SALESORDER)
                {
                        $this->Text($ccol, $myrow['name'], $icol);
                }
-               elseif ($doctype == 26)
+               elseif ($doctype == ST_WORKORDER)
                {
                        $this->Text($ccol, $myrow['location_name'], $icol);
                        $this->NewLine();
                }
                else
                {
-                       if ($doctype == 8) {
+                       if ($doctype == ST_PURCHORDER || $doctype == ST_SUPPAYMENT) {
                                $name = $myrow['supp_name'];
                                $addr = $myrow['address'];
                        } else {
                if ($sales_order != NULL)
                {
                        $this->row = $temp;
-                       if ($doctype == 8)
+                       if ($doctype == ST_PURCHORDER)
                                $this->Text($mcol, $this->company['coy_name']);
-                       else
+                       elseif ($doctype != ST_SUPPAYMENT)
                                $this->Text($mcol, $sales_order['deliver_to']);
                        $this->NewLine();
-                       $this->TextWrapLines($mcol, $this->rightMargin - $mcol, $sales_order['delivery_address']);
+                       if ($doctype != ST_SUPPAYMENT)
+                               $this->TextWrapLines($mcol, $this->rightMargin - $mcol, $sales_order['delivery_address']);
                }
                $this->row = $iline2 - $this->lineHeight - 1;
                $col = $this->leftMargin;
                $col += $width;
                $this->TextWrap($col, $this->row, $width, $doc_Your_VAT_no, 'C');
                $col += $width;
-               if ($doctype == 10)
+               if ($doctype == ST_SALESINVOICE)
                        $this->TextWrap($col, $this->row, $width, $doc_Delivery_no, 'C');
                else
                        $this->TextWrap($col, $this->row, $width, $doc_Our_Order_No, 'C');
                $this->TextWrap($col, $this->row, $width, $doc_Due_Date, 'C');
                $this->row = $iline3 - $this->lineHeight - 1;
                $col = $this->leftMargin;
-               if ($doctype == 8)
+               if ($doctype == ST_PURCHORDER || $doctype == ST_SUPPAYMENT)
                        $this->TextWrap($col, $this->row, $width, $myrow['supp_account_no'], 'C');
-               elseif ($doctype == 26)
+               elseif ($doctype == ST_WORKORDER)
                        $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');
                        //$this->TextWrap($col, $this->row, $width, $row['salesman_name'], 'C');
                        $this->TextWrap($col, $this->row, $width, get_salesman_name($id), 'C');
                }               
-               elseif ($doctype == 26)
+               elseif ($doctype == ST_SUPPAYMENT)
+                       $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');
                $col += $width; 
-               if ($doctype == 26)
+               if ($doctype == ST_WORKORDER)
                        $this->TextWrap($col, $this->row, $width, $myrow["StockItemName"], 'C');
-               elseif ($doctype != 8 && isset($myrow['tax_id']))
+               elseif ($doctype != ST_PURCHORDER && isset($myrow['tax_id']))
                        $this->TextWrap($col, $this->row, $width, $myrow['tax_id'], 'C');
                $col += $width; 
-               if ($doctype == 10)
+               if ($doctype == ST_SALESINVOICE)
                {
                        $deliveries = get_parent_trans(ST_SALESINVOICE, $myrow['trans_no']);
                        $line = "";
                        }               
                        $this->TextWrap($col, $this->row, $width, $line, 'C');
                }
-               elseif ($doctype == 13)
+               elseif ($doctype == ST_CUSTDELIVERY)
                {
                        $ref = $myrow['order_'];
                        if ($print_invoice_no == 0)
                        }               
                        $this->TextWrap($col, $this->row, $width, $ref, 'C');
                }
-               elseif ($doctype == 26)
+               elseif ($doctype == ST_WORKORDER)
                        $this->TextWrap($col, $this->row, $width, $myrow["location_name"], 'C');
                elseif (isset($myrow['order_']))
                        $this->TextWrap($col, $this->row, $width, $myrow['order_'], 'C');
                $col += $width; 
-               if ($doctype == 9 || $doctype == 7)
+               if ($doctype == ST_SALESORDER || $doctype == ST_SALESQUOTE)
                        $this->TextWrap($col, $this->row, $width, sql2date($myrow['delivery_date']), 'C');
-               elseif ($doctype == 26) 
+               elseif ($doctype == ST_WORKORDER)       
                        $this->TextWrap($col, $this->row, $width, $myrow["units_issued"], 'C');
-               elseif ($doctype != 8 && $doctype != 11 && isset($myrow['due_date']))
+               elseif ($doctype != ST_PURCHORDER && $doctype != ST_CUSTCREDIT && isset($myrow['due_date']))
                        $this->TextWrap($col, $this->row, $width, sql2date($myrow['due_date']), 'C');
                if (!isset($packing_slip) || $packing_slip == 0)
                {
                        $this->row -= (2 * $this->lineHeight);
-                       if ($doctype == 26)
+                       if ($doctype == ST_WORKORDER)
                                $str = sql2date($myrow["required_by"]);
                        else
                        {
                $this->Font();
                $this->Font('italic');
                $this->row = $iline7 - $this->lineHeight - 6;
-               if ($doctype != 26)
+               if ($doctype != ST_WORKORDER)
                        $this->TextWrap($ccol, $this->row, $right - $ccol, $doc_Please_Quote . " - " . $myrow['curr_code'], 'C');
                $this->row -= $this->lineHeight;
 
                        $this->TextWrap($ccol, $this->row, $right - $ccol, $txt, 'C');
                        $this->row -= $this->lineHeight;
                }       
-               if ($doctype == 10 && $branch['disable_branch'] > 0) // payment links
+               if ($doctype == ST_SALESINVOICE && $branch['disable_branch'] > 0) // payment links
                {
                        if ($branch['disable_branch'] == 1)
                        {
                        $this->TextWrap($ccol, $this->row, $right - $ccol, $this->params['comments'], 'C');
                        $this->row -= $this->lineHeight;
                }
-               if (($doctype == 10 || $doctype == 12) && $this->company['legal_text'] != "") 
+               if (($doctype == ST_SALESINVOICE || $doctype == ST_CUSTPAYMENT) && $this->company['legal_text'] != "") 
                {
                        $this->TextWrapLines($ccol, $right - $ccol, $this->company['legal_text'], 'C');
                }
index 13896dc8b2cc3888eea8c1484b1720649434fd26..170ad964a0a9be65ffbe91b8fd06b5848308aced 100644 (file)
@@ -364,16 +364,19 @@ class FrontReport extends Cpdf
                if ($this->pageNumber > 1)
                        $this->newPage();
                $header2type = true;
+               
+                // leave layout files names without path to enable including
+                // modified versions from comapny/x/reporting directory
                if (isset($myrow['curr_code']) && $this->currency != $myrow['curr_code'])
                {
-                       include($path_to_root . "/reporting/includes/doctext2.inc");
+                       include("includes/doctext2.inc");
                }
                else
                {
-                       include($path_to_root . "/reporting/includes/doctext.inc");
+                       include("includes/doctext.inc");
                }
 
-               include($path_to_root . "/reporting/includes/header2.inc");
+               include("includes/header2.inc");
 
                $this->row = $temp;
        }
@@ -694,7 +697,7 @@ class FrontReport extends Cpdf
                parent::SetCellPadding($pad);
        }
        
-       function Text($c, $txt, $n=0, $corr=0, $r=0, $align='left', $border=0, $fill=0, $link=NULL, $stretch=0)
+       function Text($c, $txt, $n=0, $corr=0, $r=0, $align='left', $border=0, $fill=0, $link=NULL, $stretch=1)
        {
                if ($n == 0)
                        $n = $this->pageWidth - $this->rightMargin;
@@ -702,7 +705,7 @@ class FrontReport extends Cpdf
                return $this->TextWrap($c, $this->row - $r, $n - $c + $corr, $txt, $align, $border, $fill, $link, $stretch);
        }
 
-       function TextWrap($xpos, $ypos, $len, $str, $align = 'left', $border = 0, $fill = 0, $link = NULL, $stretch = 0)
+       function TextWrap($xpos, $ypos, $len, $str, $align = 'left', $border = 0, $fill = 0, $link = NULL, $stretch = 1)
        {
                if ($this->fontSize != $this->oldFontSize)
                {
@@ -712,12 +715,12 @@ class FrontReport extends Cpdf
                return $this->addTextWrap($xpos, $ypos, $len, $this->fontSize, $str, $align, $border, $fill, $link, $stretch);
        }
 
-       function TextCol($c, $n, $txt, $corr=0, $r=0, $border=0, $fill=0, $link=NULL, $stretch=0)
+       function TextCol($c, $n, $txt, $corr=0, $r=0, $border=0, $fill=0, $link=NULL, $stretch=1)
        {
                return $this->TextWrap($this->cols[$c], $this->row - $r, $this->cols[$n] - $this->cols[$c] + $corr, $txt, $this->aligns[$c], $border, $fill, $link, $stretch);
        }
        
-       function AmountCol($c, $n, $txt, $dec=0, $corr=0, $r=0, $border=0, $fill=0, $link=NULL, $stretch=0, $color_red=false)
+       function AmountCol($c, $n, $txt, $dec=0, $corr=0, $r=0, $border=0, $fill=0, $link=NULL, $stretch=1, $color_red=false)
        {
                if ($color_red && $txt < 0)
                        $this->SetTextColor(255, 0, 0);
@@ -727,7 +730,7 @@ class FrontReport extends Cpdf
                return $ret;    
        }
 
-       function AmountCol2($c, $n, $txt, $dec=0, $corr=0, $r=0, $border=0, $fill=0, $link=NULL, $stretch=0, $color_red=false, $amount_locale = 'en_US.UTF-8', $amount_format = '%(!.2n')
+       function AmountCol2($c, $n, $txt, $dec=0, $corr=0, $r=0, $border=0, $fill=0, $link=NULL, $stretch=1, $color_red=false, $amount_locale = 'en_US.UTF-8', $amount_format = '%(!.2n')
        {
                setlocale(LC_MONETARY, $amount_locale);
                if ($color_red && $txt < 0)
@@ -738,25 +741,25 @@ class FrontReport extends Cpdf
                return $ret;    
        }
        
-       function DateCol($c, $n, $txt, $conv=false, $corr=0, $r=0, $border=0, $fill=0, $link=NULL, $stretch=0)
+       function DateCol($c, $n, $txt, $conv=false, $corr=0, $r=0, $border=0, $fill=0, $link=NULL, $stretch=1)
        {
                if ($conv)
                        $txt = sql2date($txt);
                return $this->TextCol($c, $n, $txt, $corr, $r, $border, $fill, $link, $stretch);
        }
 
-       function TextCol2($c, $n, $txt, $corr=0, $r=0, $border=0, $fill=0, $link=NULL, $stretch=0)
+       function TextCol2($c, $n, $txt, $corr=0, $r=0, $border=0, $fill=0, $link=NULL, $stretch=1)
        {
                return $this->TextWrap($this->cols2[$c], $this->row - $r, $this->cols2[$n] - $this->cols2[$c] + $corr, $txt, $this->aligns2[$c], $border, $fill, $link, $stretch);
        }
 
-       function TextColLines($c, $n, $txt, $corr=0, $r=0, $border=0, $fill=0, $link=NULL, $stretch=0)
+       function TextColLines($c, $n, $txt, $corr=0, $r=0, $border=0, $fill=0, $link=NULL, $stretch=1)
        {
                $this->row -= $r;
                $this->TextWrapLines($this->cols[$c], $this->cols[$n] - $this->cols[$c] + $corr, $txt, $this->aligns[$c], $border, $fill, $link, $stretch);
        }
 
-       function TextWrapLines($c, $width, $txt, $align='left', $border=0, $fill=0, $link=NULL, $stretch=0)
+       function TextWrapLines($c, $width, $txt, $align='left', $border=0, $fill=0, $link=NULL, $stretch=1)
        {
                $str = Explode("\n", $txt);
                for ($i = 0; $i < count($str); $i++)
@@ -917,11 +920,11 @@ class FrontReport extends Cpdf
                                $emailtype = true;
                                if ($this->currency != $myrow['curr_code'])
                                {
-                                       include("doctext2.inc");
+                                       include("includes/doctext2.inc");
                                }
                                else
                                {
-                                       include("doctext.inc");
+                                       include("includes/doctext.inc");
                                }
                                require_once($path_to_root . "/reporting/includes/class.mail.inc");
                        $mail = new email($this->company['coy_name'], $this->company['email']);
@@ -930,7 +933,7 @@ class FrontReport extends Cpdf
                        $to = $myrow['DebtorName'] . " <" . $myrow['email'] . ">";
                        $msg = $doc_Dear_Sirs . " " . $myrow['DebtorName'] . ",\n\n" . $doc_AttachedFile . " " . $subject .
                                "\n\n";
-                               if (isset($myrow['dimension_id']) && $myrow['dimension_id'] > 0 && $doctype == 10) // helper for payment links
+                               if (isset($myrow['dimension_id']) && $myrow['dimension_id'] > 0 && $doctype == ST_SALESINVOICE) // helper for payment links
                                {
                                        if ($myrow['dimension_id'] == 1)
                                        {
index 6a0712998267b8fd02ce64aec1dc785ebe14b1ec..4ce4d148d3a37f31b309795a31d2999f9d772c1e 100644 (file)
@@ -77,6 +77,16 @@ function print_document_link($doc_no, $link_text, $link=true, $type_no,
                                'PARAM_3' => $email, 
                                'PARAM_4' => '');
                        break;
+               case ST_SUPPAYMENT :
+                       $rep = 210;
+                       // from, to, currency, bank acc, email, comments
+                       $ar = array(
+                               'PARAM_0' => $doc_no, 
+                               'PARAM_1' => $doc_no, 
+                               'PARAM_2' => '', 
+                               'PARAM_3' => $email, 
+                               'PARAM_4' => '');
+                       break;
 //             default: $ar = array();
        }
        
index ec1d59111dd309e45aaf46c875e5032e7907c541..fc1d9d0f054d14e103acd6eeb72f8cf51926733e 100644 (file)
@@ -323,6 +323,16 @@ class BoxReports
                                                FROM ".TB_PREF."suppliers, ".TB_PREF."purch_orders WHERE ".TB_PREF."suppliers.supplier_id=".TB_PREF."purch_orders.supplier_id ORDER BY ".TB_PREF."purch_orders.order_no DESC";
                                        return combo_input($name, '', $sql, 'order_no', 'IName',array('order'=>false));
 
+                               case 'REMITTANCE':
+                                       $BP = _("BP");
+                                       $SP = _("SP");
+                                       $CN = _("CN");
+                                       $ref = ($print_invoice_no == 1 ? "trans_no" : "reference");
+                                       $sql = "SELECT concat(".TB_PREF."supp_trans.trans_no, '-',
+                                               ".TB_PREF."supp_trans.type) AS TNO, concat(".TB_PREF."supp_trans.$ref, if (type=".ST_BANKPAYMENT.", ' $BP ', if (type=".ST_SUPPAYMENT.", ' $SP ', ' $CN ')), ".TB_PREF."suppliers.supp_name) as IName
+                                               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 'ITEMS':
                                        return stock_manufactured_items_list($name);
 
index 9018e0fd424be98585075561fb44a8f02b3d4fea..3f38f70889b36319a98925fd7acdb193c485322a 100644 (file)
@@ -17,27 +17,29 @@ $path_to_root = "..";
 $page_security = 'SA_OPEN';    // this level is later overriden in rep file
 include_once($path_to_root . "/includes/session.inc");
 
-/*
-       Find report definition file.
-       Standard reports can be superseded by report with the same id
-       included in active extension, or company customized report.
-*/
 function find_report_file($rep) {
        global $installed_extensions, $comp_path, $path_to_root;
 
        // customized per company versions 
-       $rep_file = $comp_path.'/'.user_company()."/reporting/rep$rep.php";
-       if (file_exists($rep_file)) 
+       $path = $comp_path.'/'.user_company()."/reporting";
+       $rep_file = $path."/rep$rep.php";
+       if (file_exists($rep_file)) {
+               // add local include path for custom reports
+               set_include_path($path.PATH_SEPARATOR.get_include_path());
                return $rep_file;
+       }
        // reports added by active extension modules
        if (count($installed_extensions) > 0)
        {
                $extensions = $installed_extensions;
                foreach ($extensions as $ext)
                        if (($ext['active'] && $ext['type'] == 'module')) {
-                               $rep_file = $path_to_root.'/'.$ext['path']."/reporting/rep$rep.php";
-                               if (file_exists($rep_file))
+                               $path = $path_to_root.'/'.$ext['path']."/reporting";
+                               $rep_file = $path."/rep$rep.php";
+                               if (file_exists($rep_file)) {
+                                       set_include_path($path.PATH_SEPARATOR.get_include_path());
                                        return $rep_file;
+                               }
                        }
        }
        // standard reports
index a3519221d453818e5588b3f68b8385948bf280f4..d5b1c022b480f231ef86745fe2d90541630cb73b 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, 12);
+               $rep->Header2($myrow, null, null, $baccount, ST_CUSTPAYMENT);
                $rep->NewLine();
                $linetype = true;
-               $doctype = 12;
+               $doctype = ST_CUSTPAYMENT;
                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, 12);
+                               $rep->Header2($myrow, null, null, $baccount, ST_CUSTPAYMENT);
                }
                $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, 12);
+                       $rep->End($email, $doc_Statement . " " . $doc_as_of . " " . sql2date($date), $myrow, ST_CUSTPAYMENT);
 
        }
        if ($email == 0)
index 11349184d626e43203791e1eb8a2ca92d2269964..5b049c111ce799fd0a4be400fe0b6a03ab392320 100644 (file)
@@ -94,7 +94,7 @@ function print_sales_orders()
                }
                else
                        $rep->title = ($print_as_quote==1 ? _("QUOTE") : _("SALES ORDER"));
-               $rep->Header2($myrow, $branch, $myrow, $baccount, 9);
+               $rep->Header2($myrow, $branch, $myrow, $baccount, ST_SALESORDER);
 
                $result = get_sales_order_details($i, ST_SALESORDER);
                $SubTotal = 0;
@@ -123,7 +123,7 @@ function print_sales_orders()
                        $rep->row = $newrow;
                        //$rep->NewLine(1);
                        if ($rep->row < $rep->bottomMargin + (15 * $rep->lineHeight))
-                               $rep->Header2($myrow, $branch, $myrow, $baccount, 9);
+                               $rep->Header2($myrow, $branch, $myrow, $baccount, ST_SALESORDER);
                }
                if ($myrow['comments'] != "")
                {
@@ -135,7 +135,7 @@ function print_sales_orders()
 
                $rep->row = $rep->bottomMargin + (15 * $rep->lineHeight);
                $linetype = true;
-               $doctype = 9;
+               $doctype = ST_SALESORDER;
                if ($rep->currency != $myrow['curr_code'])
                {
                        include($path_to_root . "/reporting/includes/doctext2.inc");
index fc330428b7f6af2f030b9dd28198f467b8cf6489..a8fdbc4a6caae71abf175ab090c49b5b6d9d4ac8 100644 (file)
@@ -99,9 +99,9 @@ function print_deliveries()
                        }
                        else
                                $rep->title = _('DELIVERY NOTE');
-                       $rep->Header2($myrow, $branch, $sales_order, '', 13);
+                       $rep->Header2($myrow, $branch, $sales_order, '', ST_CUSTDELIVERY);
 
-                       $result = get_customer_trans_details(13, $i);
+                       $result = get_customer_trans_details(ST_CUSTDELIVERY, $i);
                        $SubTotal = 0;
                        while ($myrow2=db_fetch($result))
                        {
@@ -131,7 +131,7 @@ function print_deliveries()
                                $rep->row = $newrow;
                                //$rep->NewLine(1);
                                if ($rep->row < $rep->bottomMargin + (15 * $rep->lineHeight))
-                                       $rep->Header2($myrow, $branch, $sales_order,'',13);
+                                       $rep->Header2($myrow, $branch, $sales_order,'',ST_CUSTDELIVERY);
                        }
 
                        $comments = get_comments(ST_CUSTDELIVERY, $i);
@@ -147,7 +147,7 @@ function print_deliveries()
 
                $rep->row = $rep->bottomMargin + (15 * $rep->lineHeight);
                        $linetype = true;
-                       $doctype=13;
+                       $doctype=ST_CUSTDELIVERY;
                        if ($rep->currency != $myrow['curr_code'])
                        {
                                include($path_to_root . "/reporting/includes/doctext2.inc");
@@ -164,7 +164,7 @@ function print_deliveries()
                                $rep->TextCol(3, 6, $doc_Shipping, -2);
                                $rep->TextCol(6, 7,     $DisplayFreight, -2);
                                $rep->NewLine();
-                               $tax_items = get_trans_tax_details(13, $i);
+                               $tax_items = get_trans_tax_details(ST_CUSTDELIVERY, $i);
                        while ($tax_item = db_fetch($tax_items))
                        {
                                $DisplayTax = number_format2($tax_item['amount'], $dec);
@@ -196,7 +196,7 @@ function print_deliveries()
                                        $myrow['email'] = $branch['email'];
                                        $myrow['DebtorName'] = $branch['br_name'];
                                }
-                               $rep->End($email, $doc_Delivery_no . " " . $myrow['reference'], $myrow, 13);
+                               $rep->End($email, $doc_Delivery_no . " " . $myrow['reference'], $myrow, ST_CUSTDELIVERY);
                        }
        }
        if ($email == 0)
index 826089bca9f5577b56032b6e56e20d2cbfa717d5..0301ed616e2f8677c3765cb3f703702f0e16aca9 100644 (file)
@@ -78,7 +78,7 @@ function print_sales_quotations()
                        $rep->Info($params, $cols, null, $aligns);
                }
                $rep->title = _("SALES QUOTATION");
-               $rep->Header2($myrow, $branch, $myrow, $baccount, 7);
+               $rep->Header2($myrow, $branch, $myrow, $baccount, ST_SALESQUOTE);
 
                $result = get_sales_order_details($i, ST_SALESQUOTE);
                $SubTotal = 0;
@@ -107,7 +107,7 @@ function print_sales_quotations()
                        $rep->row = $newrow;
                        //$rep->NewLine(1);
                        if ($rep->row < $rep->bottomMargin + (15 * $rep->lineHeight))
-                               $rep->Header2($myrow, $branch, $myrow, $baccount, 9);
+                               $rep->Header2($myrow, $branch, $myrow, $baccount, ST_SALESQUOTE);
                }
                if ($myrow['comments'] != "")
                {
@@ -119,7 +119,7 @@ function print_sales_quotations()
 
                $rep->row = $rep->bottomMargin + (15 * $rep->lineHeight);
                $linetype = true;
-               $doctype = 9;
+               $doctype = ST_SALESQUOTE;
                if ($rep->currency != $myrow['curr_code'])
                {
                        include($path_to_root . "/reporting/includes/doctext2.inc");
index b6b88a4572ee85b310b3493d5109b019c5594441..e8278e60e13036c644e5742654c61c983c4b0a79 100644 (file)
@@ -105,7 +105,7 @@ function print_po()
                }
                else
                        $rep->title = _('PURCHASE ORDER');
-               $rep->Header2($myrow, null, $myrow, $baccount, 8);
+               $rep->Header2($myrow, null, $myrow, $baccount, ST_PURCHORDER);
 
                $result = get_po_details($i);
                $SubTotal = 0;
@@ -139,7 +139,7 @@ function print_po()
                        $rep->TextCol(6, 7,     $DisplayNet, -2);
                        $rep->NewLine(1);
                        if ($rep->row < $rep->bottomMargin + (15 * $rep->lineHeight))
-                               $rep->Header2($myrow, $branch, $myrow, $baccount, 8);
+                               $rep->Header2($myrow, $branch, $myrow, $baccount, ST_PURCHORDER);
                }
                if ($myrow['comments'] != "")
                {
@@ -150,7 +150,7 @@ function print_po()
 
                $rep->row = $rep->bottomMargin + (15 * $rep->lineHeight);
                $linetype = true;
-               $doctype = 8;
+               $doctype = ST_PURCHORDER;
                if ($rep->currency != $myrow['curr_code'])
                {
                        include($path_to_root . "/reporting/includes/doctext2.inc");
diff --git a/reporting/rep210.php b/reporting/rep210.php
new file mode 100644 (file)
index 0000000..f25b792
--- /dev/null
@@ -0,0 +1,182 @@
+<?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_SUPPTRANSVIEW' : 'SA_SUPPBULKREP';
+// ----------------------------------------------------------------
+// $ 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_remittances();
+
+//----------------------------------------------------------------------------------------------------
+function get_remittance($type, $trans_no)
+{
+       $sql = "SELECT ".TB_PREF."supp_trans.*, 
+               (".TB_PREF."supp_trans.ov_amount+".TB_PREF."supp_trans.ov_gst+".TB_PREF."supp_trans.ov_discount) AS Total, 
+               ".TB_PREF."suppliers.supp_name,  ".TB_PREF."suppliers.supp_account_no,
+               ".TB_PREF."suppliers.curr_code, ".TB_PREF."suppliers.payment_terms, ".TB_PREF."suppliers.gst_no AS tax_id, 
+               ".TB_PREF."suppliers.email, ".TB_PREF."suppliers.address, ".TB_PREF."suppliers.contact
+               FROM ".TB_PREF."supp_trans, ".TB_PREF."suppliers
+               WHERE ".TB_PREF."supp_trans.supplier_id = ".TB_PREF."suppliers.supplier_id
+               AND ".TB_PREF."supp_trans.type = ".db_escape($type)."
+               AND ".TB_PREF."supp_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_remittance($supplier_id, $type, $trans_no)
+{
+       $sql = get_alloc_supp_sql("amt, supp_reference, trans.alloc", "trans.trans_no = alloc.trans_no_to
+               AND trans.type = alloc.trans_type_to
+               AND alloc.trans_no_from=".db_escape($trans_no)."
+               AND alloc.trans_type_from=".db_escape($type)."
+               AND trans.supplier_id=".db_escape($supplier_id),
+               TB_PREF."supp_allocations as alloc");
+       $sql .= " ORDER BY trans_no";
+       return db_query($sql, "Cannot retreive alloc to transactions");
+}
+
+function print_remittances()
+{
+       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'];
+       $email = $_POST['PARAM_3'];
+       $comments = $_POST['PARAM_4'];
+
+       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');
+
+       if ($email == 0)
+       {
+               $rep = new FrontReport(_('PURCHASE ORDER'), "PurchaseOrderBulk", 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_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)
+                               continue;                       
+                       $baccount = get_default_bank_account($myrow['curr_code']);
+                       $params['bankaccount'] = $baccount['id'];
+
+                       if ($email == 1)
+                       {
+                               $rep = new FrontReport("", "", user_pagesize());
+                               $rep->currency = $cur;
+                               $rep->Font();
+                               $rep->title = _('REMITTANCE');
+                               $rep->filename = "Remittance" . $i . ".pdf";
+                               $rep->Info($params, $cols, null, $aligns);
+                       }
+                       else
+                               $rep->title = _('REMITTANCE');
+                       $rep->Header2($myrow, null, $myrow, $baccount, ST_SUPPAYMENT);
+                       $result = get_allocations_for_remittance($myrow['supplier_id'], $myrow['type'], $myrow['trans_no']);
+
+                       $total_allocated = 0;
+                       while ($myrow2=db_fetch($result))
+                       {
+                               $rep->TextCol(0, 1,     $systypes_array[$myrow2['type']], -2);
+                               $rep->TextCol(1, 2,     $myrow2['supp_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_SUPPAYMENT);
+                       }
+
+                       $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);
+                       $rep->NewLine();
+                       $rep->TextCol(3, 6, $doc_Left_To_Allocate, -2);
+                       $myrow['Total'] *= -1;
+                       $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);
+                       $rep->Font();
+                       if ($email == 1)
+                       {
+                               $myrow['contact_email'] = $myrow['email'];
+                               $myrow['DebtorName'] = $myrow['supp_name'];
+                               if ($myrow['contact'] != '') $myrow['DebtorName'] = $myrow['contact'];
+                               $rep->End($email, $doc_Order_no . " " . $myrow['reference'], $myrow);
+                       }
+               }       
+       }
+       if ($email == 0)
+               $rep->End();
+}
+
+?>
\ No newline at end of file
index 847fb04e7371d6f1f4fe9fb35d3d263a296e3c85..fc7b8a43006f1149fb0f0b9b51abf576ef471811 100644 (file)
@@ -71,13 +71,17 @@ function print_Chart_of_Accounts()
                        if ($account['AccountClassName'] != $classname)
                        {
                                $rep->Font('bold');
-                               $rep->TextCol(0, 4, $account['AccountClassName']);
+                               //$rep->TextCol(0, 4, $account['AccountClassName']);
+                               $rep->TextCol(0, 1, $account['ClassID']);
+                               $rep->TextCol(1, 4, $account['AccountClassName']);
                                $rep->Font();
                                //$rep->row -= ($rep->lineHeight + 4);
                                $rep->NewLine();
                        }
                        $group = $account['AccountTypeName'];
-                       $rep->TextCol(0, 4, $account['AccountTypeName']);
+                       //$rep->TextCol(0, 4, $account['AccountTypeName']);
+                       $rep->TextCol(0, 1, $account['AccountType']);
+                       $rep->TextCol(1, 4, $account['AccountTypeName']);
                        //$rep->Line($rep->row - 4);
                        //$rep->row -= ($rep->lineHeight + 4);
                        $rep->NewLine();
index 650f0dba39e091ffee83b247ab1189e8da524da6..a36a043cd87826ed9429ff446005604e77310712 100644 (file)
@@ -136,6 +136,12 @@ $reports->addReport(_('Supplier'),209,_('Print Purchase &Orders'),
                        _('Currency Filter') => 'CURRENCY',
                        _('Email Customers') => 'YES_NO',
                        _('Comments') => 'TEXTBOX'));
+$reports->addReport(_('Supplier'),210,_('Print Remittances'),
+       array(  _('From') => 'REMITTANCE',
+                       _('To') => 'REMITTANCE',
+                       _('Currency Filter') => 'CURRENCY',
+                       _('Email Customers') => 'YES_NO',
+                       _('Comments') => 'TEXTBOX'));
 
 $reports->addReportClass(_('Inventory'));
 $reports->addReport(_('Inventory'),301,_('Inventory &Valuation Report'),
index 63a04cdb4427abccc206d5792a3e8eeaa484d57f..97ece6a3c4997f6293334fe63e121eac9c447aad 100644 (file)
@@ -39,25 +39,6 @@ function clear_allocations()
        //session_register('alloc');
 }
 
-
-//--------------------------------------------------------------------------------
-
-if (isset($_POST['Process']))
-{
-       if (check_allocations())
-       {
-               $_SESSION['alloc']->write();
-               clear_allocations();
-               $_POST['Cancel'] = 1;
-       }
-}
-//--------------------------------------------------------------------------------
-
-if (isset($_POST['Cancel']))
-{
-       clear_allocations();
-       meta_forward($path_to_root . "/sales/allocations/customer_allocation_main.php");
-}
 //--------------------------------------------------------------------------------
 
 function edit_allocations_for_transaction($type, $trans_no)
@@ -96,17 +77,34 @@ function edit_allocations_for_transaction($type, $trans_no)
 
 //--------------------------------------------------------------------------------
 
+if (isset($_POST['Process']))
+{
+       if (check_allocations())
+       {
+               $_SESSION['alloc']->write();
+               clear_allocations();
+               $_POST['Cancel'] = 1;
+       }
+}
+//--------------------------------------------------------------------------------
+
+if (isset($_POST['Cancel']))
+{
+       clear_allocations();
+       meta_forward($path_to_root . "/sales/allocations/customer_allocation_main.php");
+}
+
+//--------------------------------------------------------------------------------
+
 if (isset($_GET['trans_no']) && isset($_GET['trans_type']))
 {
        clear_allocations();
        $_SESSION['alloc'] = new allocation($_GET['trans_type'], $_GET['trans_no']);
 }
+
 if(get_post('UpdateDisplay'))
 {
-       $trans_no = $_SESSION['alloc']->trans_no;
-       $type = $_SESSION['alloc']->type;
-       clear_allocations();
-       get_allocations_for_transaction($type, $trans_no);
+       $_SESSION['alloc']->read();
        $Ajax->activate('alloc_tbl');
 }
 
index 309f50f61a0dc7df76437a2a0b7a260538f40d3e..04c4bda526256d21355ae7b4f67aba3b9c3d6b77 100644 (file)
@@ -54,37 +54,43 @@ function create_recurrent_invoices($customer_id, $branch_id, $order_no, $tmpl_no
 
 if (isset($_GET['recurrent']))
 {
-       $invs = array();
-       $myrow = get_recurrent_invoice($_GET['recurrent']);
-       if ($myrow['debtor_no'] == 0)
+       $date = Today();
+       if (is_date_in_fiscalyear($date))
        {
-               $cust = get_cust_branches_from_group($myrow['group_no']);
-               while ($row = db_fetch($cust))
+               $invs = array();
+               $myrow = get_recurrent_invoice($_GET['recurrent']);
+               if ($myrow['debtor_no'] == 0)
                {
-                       $invs[] = create_recurrent_invoices($row['debtor_no'], $row['branch_code'], $myrow['order_no'], $myrow['id']);
-               }       
+                       $cust = get_cust_branches_from_group($myrow['group_no']);
+                       while ($row = db_fetch($cust))
+                       {
+                               $invs[] = create_recurrent_invoices($row['debtor_no'], $row['branch_code'], $myrow['order_no'], $myrow['id']);
+                       }       
+               }
+               else
+               {
+                       $invs[] = create_recurrent_invoices($myrow['debtor_no'], $myrow['group_no'], $myrow['order_no'], $myrow['id']);
+               }
+               if (count($invs) > 0)
+               {
+                       $min = min($invs);
+                       $max = max($invs);
+               }
+               else 
+                       $min = $max = 0;
+               display_notification(sprintf(_("%s recurrent invoice(s) created, # $min - # $max."), count($invs)));
+               if (count($invs) > 0)
+               {
+                       $ar = array('PARAM_0' => $min,  'PARAM_1' => $max, 'PARAM_2' => "",
+                               'PARAM_3' => 0, 'PARAM_4' => 0, 'PARAM_5' => "", 'PARAM_6' => ST_SALESINVOICE);
+                       display_note(print_link(_("&Print Recurrent Invoices # $min - # $max"), 107, $ar), 0, 1);
+                       $ar['PARAM_3'] = 1; 
+                       display_note(print_link(_("&Email Recurrent Invoices # $min - # $max"), 107, $ar), 0, 1);
+               }
        }
        else
-       {
-               $invs[] = create_recurrent_invoices($myrow['debtor_no'], $myrow['group_no'], $myrow['order_no'], $myrow['id']);
-       }
-       if (count($invs) > 0)
-       {
-               $min = min($invs);
-               $max = max($invs);
-       }
-       else 
-               $min = $max = 0;
-       display_notification(sprintf(_("%s recurrent invoice(s) created, # $min - # $max."), count($invs)));
-       if (count($invs) > 0)
-       {
-               $ar = array('PARAM_0' => $min,  'PARAM_1' => $max, 'PARAM_2' => "",
-                       'PARAM_3' => 0, 'PARAM_4' => 0, 'PARAM_5' => "", 'PARAM_6' => ST_SALESINVOICE);
-               display_note(print_link(_("&Print Recurrent Invoices # $min - # $max"), 107, $ar), 0, 1);
-               $ar['PARAM_3'] = 1; 
-               display_note(print_link(_("&Email Recurrent Invoices # $min - # $max"), 107, $ar), 0, 1);
-       }
-}      
+               display_error(_("The entered date is not in fiscal year."));
+}
 
 $result = get_recurrent_invoices();
 
index 392ec8cbbec5528c1a49234df3658742d0d8f1e9..5c217aa275bb0457c67a8285b57bf0ff4f509fca 100644 (file)
@@ -96,7 +96,7 @@ function delete_tax_group_items($id)
 
 function get_tax_group_items($id)
 {
-       $sql = "SELECT ".TB_PREF."tax_group_items.*, ".TB_PREF."tax_types.name AS tax_type_name, 
+       $sql = "SELECT ".TB_PREF."tax_group_items.*, ".TB_PREF."tax_types.name AS tax_type_name, ".TB_PREF."tax_types.rate, 
                ".TB_PREF."tax_types.sales_gl_code, ".TB_PREF."tax_types.purchasing_gl_code  
                FROM ".TB_PREF."tax_group_items, ".TB_PREF."tax_types 
                WHERE tax_group_id=".db_escape($id)."
@@ -128,7 +128,7 @@ function get_tax_group_items_as_array($id)
 function get_shipping_tax_group_items()
 {
 
-       $sql = "SELECT ".TB_PREF."tax_group_items.*, ".TB_PREF."tax_types.name AS tax_type_name, 
+       $sql = "SELECT ".TB_PREF."tax_group_items.*, ".TB_PREF."tax_types.name AS tax_type_name, ".TB_PREF."tax_types.rate,
                ".TB_PREF."tax_types.sales_gl_code, ".TB_PREF."tax_types.purchasing_gl_code  
                FROM " .TB_PREF."tax_group_items, ".TB_PREF."tax_types, ".TB_PREF."tax_groups
                WHERE " .TB_PREF."tax_groups.tax_shipping=1
index 0da0a74ed147d0f40746e3d065d4920b30922ade..1230d8e70685cddb777ea44424387a9b4c57eb6a 100644 (file)
@@ -50,7 +50,7 @@ function get_tax_free_price_for_item($stock_id, $price, $tax_group, $tax_include
                        $tax_multiplier += $taxitem["rate"];
        }
        
-       return round($price / (1 + ($tax_multiplier / 100)),  user_price_dec());
+       return round($price / (1 + ($tax_multiplier / 100)),  2*user_price_dec());
 }
 //
 //     Full price (incl. VAT) for item $stock_id with line price $price,
@@ -86,7 +86,7 @@ function get_full_price_for_item($stock_id, $price, $tax_group, $tax_included, $
                        $tax_multiplier += $taxitem["rate"];
        }
        
-       return round($price * (1 + ($tax_multiplier / 100)),  user_price_dec());
+       return round($price * (1 + ($tax_multiplier / 100)),  2*user_price_dec());
 }
 
 //---------------------------------------------------------------------------------
index 2580973dac2222b8e1cdcafec1d8923506a32d76..8dc71bdb54f2b3f1ae547c4424f24864d854cfd6 100644 (file)
@@ -18,7 +18,7 @@ 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.2".</small></li><li><small>If this is an update from "2.2.X" to "2.2.2" you are <span style="font-weight: bold; font-style: italic;">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.3".</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
 process earlier).<br /></li></ul><ol>