Stable merged into unstable again (due to failure on binary file during previous...
authorJanusz Dobrowolski <janusz@frontaccouting.eu>
Sat, 3 Mar 2012 21:35:40 +0000 (22:35 +0100)
committerJanusz Dobrowolski <janusz@frontaccouting.eu>
Sat, 3 Mar 2012 21:35:40 +0000 (22:35 +0100)
153 files changed:
admin/attachments.php
admin/db/company_db.inc
admin/db/fiscalyears_db.inc
admin/db/maintenance_db.inc
admin/gl_setup.php
admin/inst_upgrade.php
admin/void_transaction.php
applications/generalledger.php
config.default.php
dimensions/view/view_dimension.php
doc/api_changes.txt [new file with mode: 0644]
gl/accruals.php
gl/bank_account_reconcile.php
gl/bank_transfer.php
gl/gl_bank.php
gl/gl_journal.php
gl/includes/db/gl_db_accounts.inc
gl/includes/db/gl_db_bank_accounts.inc
gl/includes/db/gl_db_banking.inc
gl/includes/db/gl_db_trans.inc
gl/includes/ui/gl_bank_ui.inc
gl/includes/ui/gl_journal_ui.inc
gl/inquiry/bank_inquiry.php
gl/inquiry/gl_trial_balance.php
gl/manage/close_period.php [new file with mode: 0644]
gl/manage/gl_accounts.php
gl/manage/revaluate_currencies.php
gl/view/gl_deposit_view.php
gl/view/gl_payment_view.php
gl/view/gl_trans_view.php
includes/access_levels.inc
includes/app_entries.inc [new file with mode: 0644]
includes/current_user.inc
includes/data_checks.inc
includes/date_functions.inc
includes/db/audit_trail_db.inc
includes/db/connect_db.inc
includes/db/inventory_db.inc
includes/errors.inc
includes/hooks.inc
includes/main.inc
includes/references.inc
includes/session.inc
includes/sysnames.inc
includes/system_tests.inc
includes/types.inc
includes/ui/items_cart.inc
includes/ui/ui_controls.inc
includes/ui/ui_input.inc
includes/ui/ui_lists.inc
includes/ui/ui_view.inc
install/lang/ar_EG/LC_MESSAGES/ar_EG.po
install/lang/fr_FR/LC_MESSAGES/fr_FR.mo
install/lang/fr_FR/LC_MESSAGES/fr_FR.po
install/lang/new_language_template/LC_MESSAGES/empty.po
install/lang/pl_PL/LC_MESSAGES/pl_PL.po
install/lang/pt_BR/LC_MESSAGES/pt_BR.po
inventory/adjustments.php
inventory/cost_update.php
inventory/includes/db/items_trans_db.inc
inventory/inquiry/stock_movements.php
inventory/inquiry/stock_status.php
inventory/manage/items.php
inventory/transfers.php
manufacturing/includes/db/work_order_costing_db.inc [new file with mode: 0644]
manufacturing/includes/db/work_order_issues_db.inc
manufacturing/includes/db/work_order_produce_items_db.inc
manufacturing/includes/db/work_orders_db.inc
manufacturing/includes/db/work_orders_quick_db.inc
manufacturing/includes/manufacturing_db.inc
manufacturing/includes/manufacturing_ui.inc
manufacturing/view/wo_costs_view.php [new file with mode: 0644]
manufacturing/work_order_add_finished.php
manufacturing/work_order_costs.php
manufacturing/work_order_entry.php
manufacturing/work_order_issue.php
purchasing/includes/db/grn_db.inc
purchasing/includes/db/invoice_db.inc
purchasing/includes/db/invoice_items_db.inc
purchasing/includes/db/po_db.inc
purchasing/includes/db/supp_payment_db.inc
purchasing/includes/db/supp_trans_db.inc
purchasing/includes/db/suppalloc_db.inc
purchasing/includes/db/suppliers_db.inc
purchasing/includes/po_class.inc
purchasing/includes/supp_trans_class.inc
purchasing/includes/ui/grn_ui.inc
purchasing/includes/ui/invoice_ui.inc
purchasing/includes/ui/po_ui.inc
purchasing/inquiry/po_search_completed.php
purchasing/inquiry/supplier_allocation_inquiry.php
purchasing/inquiry/supplier_inquiry.php
purchasing/manage/suppliers.php
purchasing/po_entry_items.php
purchasing/po_receive_items.php
purchasing/supplier_credit.php
purchasing/supplier_invoice.php
purchasing/supplier_payment.php
purchasing/view/view_supp_invoice.php
reporting/includes/class.pdf.inc
reporting/includes/doctext.inc
reporting/includes/excel_report.inc
reporting/rep107.php
reporting/rep109.php
reporting/rep110.php
reporting/rep111.php
reporting/rep112.php
reporting/rep202.php
reporting/rep209.php
reporting/rep210.php
reporting/rep305.php
reporting/rep601.php
reporting/rep602.php [new file with mode: 0644]
reporting/rep701.php
reporting/rep702.php
reporting/rep708.php
reporting/rep709.php
reporting/reports_main.php
sales/create_recurrent_invoices.php
sales/credit_note_entry.php
sales/customer_credit_invoice.php
sales/customer_delivery.php
sales/customer_invoice.php
sales/customer_payments.php
sales/includes/cart_class.inc
sales/includes/db/branches_db.inc
sales/includes/db/cust_trans_db.inc
sales/includes/db/customers_db.inc
sales/includes/db/sales_credit_db.inc
sales/includes/db/sales_delivery_db.inc
sales/includes/db/sales_invoice_db.inc
sales/includes/db/sales_order_db.inc
sales/inquiry/customer_inquiry.php
sales/inquiry/sales_orders_view.php
sales/manage/customer_branches.php
sales/manage/customers.php
sales/sales_order_entry.php
sales/view/view_sales_order.php
sql/alter2.1.php
sql/alter2.2.php
sql/alter2.3.php
sql/alter2.4.php [new file with mode: 0644]
sql/alter2.4.sql [new file with mode: 0644]
sql/en_US-demo.sql
sql/en_US-new.sql
taxes/db/tax_groups_db.inc
taxes/tax_calc.inc
taxes/tax_groups.php
themes/aqua/images/closed.png [new file with mode: 0644]
themes/cool/images/closed.png [new file with mode: 0644]
themes/default/images/closed.png [new file with mode: 0644]
update.html
version.php

index d41684b1b87854187ac11ecd81a7b1dd700a7da2..2dcce85df2e7e9b3d69bfd016259b34fd185daf6 100644 (file)
@@ -92,7 +92,7 @@ if ($Mode == 'ADD_ITEM' || $Mode == 'UPDATE_ITEM')
                        $index_file = "<?php\nheader(\"Location: ../index.php\");\n?>";
                        $fp = fopen($dir."/index.php", "w");
                        fwrite($fp, $index_file);
-                       fclose($fp); _vd($dir);
+                       fclose($fp);
                }
                // file name compatible with POSIX
                // protect against directory traversal
index b75251d5feabc2cc0d3df5e95c29f1f061853660..9fd2e68c27adf2931ce65aeb9bb01586bd801526 100644 (file)
@@ -12,9 +12,9 @@
 /*
        Update main or gl company setup.
 */
-function update_company_prefs( $params, $pref = TB_PREF )
+function update_company_prefs($params)
 {
-       $sql = "UPDATE {$pref}sys_prefs SET value = ";
+       $sql = "UPDATE ".TB_PREF."sys_prefs SET value = ";
        foreach($params as $name => $value) {
                if (!db_query($sql. db_escape($value). " WHERE name=".db_escape($name),
                         "The company prefferences could not be updated "))
@@ -30,21 +30,15 @@ function update_company_prefs( $params, $pref = TB_PREF )
        $prefs can be preference name, array of names, or null for all preferences.
        
 */
-function get_company_pref($prefs = null, $tbpref = null)
+function get_company_pref($prefs = null)
 {
        global $SysPrefs, $db_version;
        
-       static $cached; // retrieve values from db once a request. Some values can't be cached between requests
-                                       // to ensure prefs integrity for all usrs (e.g. gl_close_date).
-       
-       if (!$cached || !isset($_SESSION['SysPrefs'])) { // cached preferences
+       if (!isset($_SESSION['SysPrefs']->prefs)) { // cached preferences
 
                $_SESSION['SysPrefs'] = new sys_prefs();
 
-               if (!isset($tbpref))
-                       $tbpref = TB_PREF;
-
-               $sql = "SELECT name, value FROM {$tbpref}sys_prefs";
+               $sql = "SELECT name, value FROM ".TB_PREF."sys_prefs";
                $result = @db_query($sql); // supress errors before 2.3 db structure upgrade
 
                if(!$result)
@@ -58,7 +52,6 @@ function get_company_pref($prefs = null, $tbpref = null)
 
                // update current db status for info in log file
                $SysPrefs->db_ok = $SysPrefs->prefs['version_id'] == $db_version;
-               $cached = true;
        }
 
        $all = $_SESSION['SysPrefs']->prefs;
@@ -75,15 +68,15 @@ function get_company_pref($prefs = null, $tbpref = null)
                return $ret;
 }
 
-function get_company_prefs($tbpref = TB_PREF)
+function get_company_prefs()
 {
-       return get_company_pref(null, $tbpref);
+       return get_company_pref(null);
 }
 
 function set_company_pref($pref, $category, $type, $length, $value)
 {
-       $sql = "REPLACE ".TB_PREF."sys_prefs SET name=".db_escape($pref).", category=".db_escape($category)
-               .", type=".db_escape($type).", length=".db_escape($length).", value=".db_escape($value);
+       $sql = "REPLACE `".TB_PREF."sys_prefs` SET `name`=".db_escape($pref).", `category`=".db_escape($category)
+               .", `type`=".db_escape($type).", `length`=".db_escape($length).", `value`=".db_escape($value);
        return db_query($sql, "cannot set company pref");
 }
 
index c605c064d2b0aae5bd7abdf9d541ea1f304f99ee..9ace5d195ee0b3c684a1f1a811dae7cb56803ed1 100644 (file)
@@ -180,7 +180,7 @@ function open_year($year)
        $from = sql2date($myrow['begin']);
 
        begin_transaction();
-       open_transactions($from);
+       close_transactions(add_days($from, -1));
        commit_transaction();
 }
 
@@ -337,19 +337,26 @@ 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";
+       $sql = "SELECT account, SUM(amount) AS amount, person_type_id, person_id FROM "
+               .TB_PREF."gl_trans WHERE tran_date <= '$to' GROUP by account, person_type_id, person_id";
        $result = db_query($sql, "Could not retrieve gl trans");
        $trans_no = get_next_trans_no(ST_JOURNAL);
+
+       $last_account='';
        $new = false;
        while ($row = db_fetch($result))
        {
-               $sql = "DELETE FROM ".TB_PREF."gl_trans WHERE tran_date <= '$to' AND account = '{$row['account']}'";
-               db_query($sql, "Could not delete gl trans");
-               if (is_account_balancesheet($row['account']))
+               if ($last_account != $row['account']) // deletes all subledgers postings, so do it once for account
+               {
+                       $sql = "DELETE FROM ".TB_PREF."gl_trans WHERE tran_date <= '$to' AND account = '{$row['account']}'";
+                       db_query($sql, "Could not delete gl trans");
+                       $last_account = $row['account'];
+               }
+               if (is_account_balancesheet($row['account']) && $row['amount'])
                {
-                       $sql = "INSERT INTO ".TB_PREF."gl_trans (type, type_no, tran_date, account, memo_, amount) VALUES
-                               (".ST_JOURNAL.", $trans_no, '$to', '{$row['account']}', '$ref', {$row['amount']})";
+                       $sql = "INSERT INTO ".TB_PREF."gl_trans (type, type_no, tran_date, account, memo_, amount, person_type_id, person_id) VALUES
+                               (".ST_JOURNAL.", $trans_no, '$to', '{$row['account']}', '$ref', {$row['amount']}, "
+                               .db_escape($row['person_type_id'], true).", ".db_escape($row['person_id'], true).")";
                        db_query($sql, "Could not insert gl trans");
                        $new = true;
                }
index c9e07c57ad2d7f059075b8b66dcd6f19fe30d699..ce8e550619a22ee44fb388c06a54a1b04eac3d22 100644 (file)
@@ -379,7 +379,7 @@ function db_import($filename, $connection, $force=true)
                        }
                }
        }
-
+       
        db_query("SET foreign_key_checks=1");
        if ($delimiter != ';') db_query("delimiter ;"); // just for any case
 
@@ -446,23 +446,27 @@ function db_unzip($mode, $path)
        return explode("\n", $file_data);
 }
 
-function db_backup($conn, $ext='no', $comm='', $tbpref = TB_PREF)
+function db_backup($conn, $ext='no', $comm='', $path=null)
 {
        if ($conn['tbpref'] != "")
                $filename = $conn['dbname'] . "_" . $conn['tbpref'] . date("Ymd_Hi") . ".sql";
        else
                $filename = $conn['dbname'] . "_" . date("Ymd_Hi") . ".sql";
 
-       return db_export($conn, clean_file_name($filename), $ext, $comm, $tbpref);
+       if (!isset($path))
+               $path = BACKUP_PATH;
+
+       return db_export($conn, $path . clean_file_name($filename), $ext, $comm);
 }
 
 // generates a dump of $db database
 // $drop and $zip tell if to include the drop table statement or dry to pack
-function db_export($conn, $filename, $zip='no', $comment='', $tbpref = TB_PREF, $no_default=false)
+function db_export($conn, $filename, $zip='no', $comment='', $no_default=false)
 {
 
        global $app_title, $version, $power_url, $path_to_root;
 
+
     $error = false;
     // set max string size before writing to file
     $max_size = 1048576 * 2; // 2 MB
@@ -477,7 +481,7 @@ function db_export($conn, $filename, $zip='no', $comment='', $tbpref = TB_PREF,
        $backupfile = $filename . ".zip";
     else
        $backupfile = $filename;
-    $company = get_company_pref('coy_name', $tbpref);
+    $company = $conn['name']; // get_company_pref('coy_name');
 
     //create comment
     $out="# MySQL dump of database '".$conn["dbname"]."' on host '".$conn["host"]."'\n";
@@ -625,7 +629,7 @@ function db_export($conn, $filename, $zip='no', $comment='', $tbpref = TB_PREF,
                        }
                        elseif ($error)
                        {
-                               @unlink(BACKUP_PATH . $backupfile);
+                               @unlink($backupfile);
                                return false;
                        }
 
@@ -643,7 +647,7 @@ function db_export($conn, $filename, $zip='no', $comment='', $tbpref = TB_PREF,
        }
        else
        {
-               @unlink(BACKUP_PATH . $backupfile);
+               @unlink($backupfile);
                return false;
        }
 
@@ -655,7 +659,7 @@ function db_export($conn, $filename, $zip='no', $comment='', $tbpref = TB_PREF,
        }
        else
        {
-               @unlink(BACKUP_PATH . $backupfile);
+               @unlink($backupfile);
                return false;
        }
     return $backupfile;
@@ -712,13 +716,15 @@ function order_sql_tables($tables, $fks)
 
 // saves the string in $fileData to the file $backupfile as gz file or not ($zip)
 // returns backup file name if name has changed (zip), else TRUE. If saving failed, return value is FALSE
-function save_to_file($backupfile, $zip, $fileData)
+function save_to_file($path, $zip, $fileData)
 {
        global $path_to_root;
 
+       $backupfile = basename($path);
+
     if ($zip == "gzip")
     {
-        if ($zp = @gzopen(BACKUP_PATH . $backupfile, "a9"))
+        if ($zp = @gzopen($path, "a9"))
         {
                        @gzwrite($zp, $fileData);
                        @gzclose($zp);
@@ -795,7 +801,7 @@ function save_to_file($backupfile, $zip, $fileData)
         // total # of entries "on this disk", total # of entries overall, size of central dir, offset to start of central dir, .zip file comment length
         $fileData .= pack('v', 1) . pack('v', 1) . pack('V', strlen($cdrec)) . pack('V', strlen($fr)) . "\x00\x00";
 
-        if ($zp = @fopen(BACKUP_PATH . $backupfile, "a"))
+        if ($zp = @fopen($path, "a"))
         {
                        @fwrite($zp, $fileData);
                        @fclose($zp);
@@ -810,7 +816,7 @@ function save_to_file($backupfile, $zip, $fileData)
     }
     else
     {
-        if ($zp = @fopen(BACKUP_PATH . $backupfile, "a"))
+        if ($zp = @fopen($path, "a"))
         {
                        @fwrite($zp, $fileData);
                        @fclose($zp);
index 1ef3e40e06c3272f150606f0907dee47161b4604..fe494679a0ea6ff885175eceacacecfcf2810945 100644 (file)
@@ -67,7 +67,7 @@ if (isset($_POST['submit']) && can_process())
                'default_prompt_payment_act', 'default_inventory_act', 'default_cogs_act',
                'default_adj_act', 'default_inv_sales_act', 'default_assembly_act', 'legal_text',
                'past_due_days', 'default_workorder_required', 'default_dim_required',
-               'default_delivery_required', 'grn_clearing_act',
+               'default_delivery_required', 'grn_clearing_act', 'tax_algorithm',
                'allow_negative_stock'=> 0, 'accumulate_shipping'=> 0,
                'po_over_receive' => 0.0, 'po_over_charge' => 0.0, 'default_credit_limit'=>0.0
 )));
@@ -83,7 +83,6 @@ start_form();
 start_outer_table(TABLESTYLE2);
 
 table_section(1);
-
 if (get_company_pref('grn_clearing_act') === null) { // available form 2.3.1, can be not defined on pre-2.4 installations
        set_company_pref('grn_clearing_act', 'glsetup.purchase', 'varchar', 15, 0);
        refresh_sys_prefs();
@@ -100,6 +99,7 @@ $_POST['pyt_discount_act']  = $myrow["pyt_discount_act"];
 
 $_POST['exchange_diff_act'] = $myrow["exchange_diff_act"];
 $_POST['bank_charge_act'] = $myrow["bank_charge_act"];
+$_POST['tax_algorithm'] = $myrow["tax_algorithm"];
 $_POST['default_sales_act'] = $myrow["default_sales_act"];
 $_POST['default_sales_discount_act']  = $myrow["default_sales_discount_act"];
 $_POST['default_prompt_payment_act']  = $myrow["default_prompt_payment_act"];
@@ -141,6 +141,8 @@ gl_all_accounts_list_row(_("Exchange Variances Account:"), 'exchange_diff_act',
 
 gl_all_accounts_list_row(_("Bank Charges Account:"), 'bank_charge_act', $_POST['bank_charge_act']);
 
+tax_algorithm_list_row(_("Tax Algorithm:"), 'tax_algorithm', $_POST['tax_algorithm']);
+
 //---------------
 
 table_section_title(_("Customers and Sales"));
index 9691b22e0eedeb4aa15bf0f1bf2958d09031b11f..4e7e05b43309b0f6fb1c5ebd69d641712e843646 100644 (file)
@@ -52,7 +52,7 @@ function get_installers()
 //
 //     Apply one differential data set.
 //
-function upgrade_step($index, $conn) 
+function upgrade_step($index, $company, $conn) 
 {
        global $path_to_root, $installers;
 
@@ -75,7 +75,7 @@ function upgrade_step($index, $conn)
                        if ($sql != '')
                                $ret &= db_import($path_to_root.'/sql/'.$sql, $conn, $force);
 
-                       $ret &= $inst->install($pref, $force);
+                       $ret &= $inst->install($company, $force);
 
                        error_log(_("Database upgrade finished."));
 
@@ -104,11 +104,11 @@ if (get_post('Upgrade'))
                        continue;
                }
        // create security backup       
-               db_backup($conn, 'no', 'Security backup before upgrade', $conn['tbpref']);
+               db_backup($conn, 'no', 'Security backup before upgrade');
        // apply all upgrade data
                foreach ($installers as $i => $inst) 
                {
-                       $ret = upgrade_step($i, $conn);
+                       $ret = upgrade_step($i, $comp, $conn);
                        if (!$ret)
                                display_error(
                                sprintf(_("Database upgrade to version %s failed for company '%s'."),
index 8d35c207c7ef50a2e7f4e116862f483de06f6d68..474217a0c32a942cccea23ed0225b8d865884327 100644 (file)
@@ -122,7 +122,7 @@ function select_link($row)
        if (!isset($row['type']))
                $row['type'] = $_POST['filterType'];
        if (!is_date_in_fiscalyear($row['trans_date'], true))
-               return _("No");
+               return _("N/A");
        return button('Edit'.$row["trans_no"], _("Select"), _("Select"), ICON_EDIT);
 }
 
@@ -154,7 +154,7 @@ function voiding_controls()
     start_table(TABLESTYLE_NOBORDER);
        start_row();
 
-       systypes_list_cells(_("Type:"), 'filterType', null, true, $not_implemented);
+       systypes_list_cells(_("Transaction Type:"), 'filterType', null, true, $not_implemented);
        if (list_updated('filterType'))
                $selected_id = -1;
 
@@ -168,7 +168,7 @@ function voiding_controls()
     ref_cells(_("to #:"), 'ToTransNo');
 
     submit_cells('ProcessSearch', _("Search"), '', '', 'default');
-               
+
        end_row();
     end_table(1);
     
index c4c0522b4f3cd4296991c96a45c8a14837e70e89..351e2486d178001483f41216de32e73498bed4de 100644 (file)
@@ -71,7 +71,8 @@ class general_ledger_app extends application
                        "gl/manage/gl_account_types.php?", 'SA_GLACCOUNTGROUP', MENU_MAINTENANCE);
                $this->add_rapp_function(2, _("GL Account &Classes"),
                        "gl/manage/gl_account_classes.php?", 'SA_GLACCOUNTCLASS', MENU_MAINTENANCE);
-               $this->add_rapp_function(2, "","");
+               $this->add_rapp_function(2, _("&Closing GL Transactions"),
+                       "gl/manage/close_period.php?", 'SA_GLSETUP', MENU_MAINTENANCE);
                $this->add_rapp_function(2, _("&Revaluation of Currency Accounts"),
                        "gl/manage/revaluate_currencies.php?", 'SA_EXCHANGERATE', MENU_MAINTENANCE);
 
index 161fec2537346e8df51a7206a46622fd1c88b4d9..5cd7fe20e010ba0807dda80c2d165990e60713d4 100644 (file)
@@ -91,7 +91,7 @@ if (!isset($path_to_root) || isset($_GET['path_to_root']) || isset($_POST['path_
 
        /* $show_voiced_gl_trans = 0, setting this to 1 will show the voided gl trans */
        $show_voided_gl_trans = 0;
-       
+
        /* use old style convert (income and expense in BS, PL) */
        $use_oldstyle_convert = 0;
 
@@ -135,7 +135,10 @@ if (!isset($path_to_root) || isset($_GET['path_to_root']) || isset($_POST['path_
 
        /* suppress tax rates on documents. 0 = no, 1 = yes. */
        $suppress_tax_rates = 0;
-       
+
+       /* allow reopening closed transactions */
+       $allow_gl_reopen = 0;
+
        $dateformats    = array("MMDDYYYY", "DDMMYYYY", "YYYYMMDD");
        $dateseps               = array("/", ".", "-", " ");
        $thoseps                = array(",", ".", " ");
@@ -219,25 +222,26 @@ if(isset($_SESSION["wa_current_user"])) {
 
 if (!defined('ICON_EDIT'))
 {
-       define("ICON_EDIT", "edit.gif");        
-       define("ICON_DELETE", "delete.gif");    
-       define("ICON_ADD", "ok.gif");   
-       define("ICON_UPDATE", "ok.gif");        
-       define("ICON_OK", "ok.gif");    
-       define("ICON_CANCEL", "cancel.png");    
-       define("ICON_GL", "gl.png");    
-       define("ICON_PRINT", "print.png");      
-       define("ICON_PDF", "pdf.gif");  
-       define("ICON_DOC", "invoice.gif");      
-       define("ICON_CREDIT", "credit.gif");    
-       define("ICON_RECEIVE", "receive.gif");  
-       define("ICON_DOWN", "download.gif");    
-       define("ICON_MONEY", "money.png");      
-       define("ICON_REMOVE", "remove.png");    
-       define("ICON_REPORT", "report.png");    
-       define("ICON_VIEW", "view.gif");        
+       define("ICON_EDIT", "edit.gif");
+       define("ICON_DELETE", "delete.gif");
+       define("ICON_ADD", "ok.gif");
+       define("ICON_UPDATE", "ok.gif");
+       define("ICON_OK", "ok.gif");
+       define("ICON_CANCEL", "cancel.png");
+       define("ICON_GL", "gl.png");
+       define("ICON_PRINT", "print.png");
+       define("ICON_PDF", "pdf.gif");
+       define("ICON_DOC", "invoice.gif");
+       define("ICON_CREDIT", "credit.gif");
+       define("ICON_RECEIVE", "receive.gif");
+       define("ICON_DOWN", "download.gif");
+       define("ICON_MONEY", "money.png");
+       define("ICON_REMOVE", "remove.png");
+       define("ICON_REPORT", "report.png");
+       define("ICON_VIEW", "view.gif");
        define("ICON_SUBMIT", "ok.gif");
-       define("ICON_ESCAPE", "escape.png");    
+       define("ICON_ESCAPE", "escape.png");
+       define("ICON_CLOSED", "closed.png");
 }
 
 ?>
\ No newline at end of file
index 71da5b3d7fe258a72708da34d0eebbbe6b3ae653..28b16de19cd9850abd059397173e7759b65aecb4 100644 (file)
@@ -83,7 +83,7 @@ if (!isset($_POST['TransToDate']))
        $_POST['TransToDate'] = Today();
 date_cells(_("from:"), 'TransFromDate');
 date_cells(_("to:"), 'TransToDate');
-submit_cells('Show',_("Show"), '', false);
+submit_cells('Show',_("Show"), '', false, 'default');
 
 end_row();
 
diff --git a/doc/api_changes.txt b/doc/api_changes.txt
new file mode 100644 (file)
index 0000000..6af93f4
--- /dev/null
@@ -0,0 +1,63 @@
+Changes in framework API introduced in FrontAccounting 2.4
+----------------------------------------------------------
+The list does not contain changes made in user interface files.
+
+Changed functions:
+ company_db_inc: 
+       update_company_prefs($params)
+       get_company_pref($prefs = null)
+       get_company_prefs()
+ maintenance_db.inc:
+       db_backup($conn, $ext='no', $comm='', $path=null)
+       db_export($conn, $filename, $zip='no', $comment='', $no_default=false)
+       save_to_file($path, $zip, $fileData)
+
+
+Before 2.4:
+       update_company_prefs( $params, $pref = TB_PREF )
+Now:
+       update_company_prefs($params)
+Description:
+       $pref parameter has been removed. All calls should be done after switch to selected company database with 
+       set_global_connection($company).
+
+Before 2.4:
+       get_company_pref($prefs = null, $tbpref = null)
+Now:
+       get_company_pref($prefs = null)
+Description:
+       $tbpref parameter has been removed. All calls should be done after switch to selected company database with 
+       set_global_connection($company).
+
+Before 2.4:
+       get_company_prefs($tbpref = TB_PREF)
+Now:
+       get_company_prefs()
+Description:
+       $tbpref parameter has been removed. All calls should be done after switch to selected company database with 
+       set_global_connection($company).
+
+Before 2.4:
+       db_backup($conn, $ext='no', $comm='', $tbpref = TB_PREF)
+Now:
+       db_backup($conn, $ext='no', $comm='', $path=null)
+Description: 
+       $tbpref parameter has been removed. Calls should be done after switch to selected company database with 
+       set_global_connection($company).
+       $path parameter has been added: path to storage directory for generated backup file. If not set defaults to BACKUP_PATH.
+
+Before 2.4:
+       db_export($conn, $filename, $zip='no', $comment='', $tbpref = TB_PREF, $no_default=false)
+Now:
+       db_export($conn, $filename, $zip='no', $comment='', $no_default=false)
+Description:
+       $tbpref parameter has been removed. Calls should be done after switch to selected company database with 
+       set_global_connection($company).
+       $filename now have to contain full path to target directory.
+
+Before 2.4:
+       save_to_file($backupfile, $zip, $fileData)
+Now:
+       save_to_file($path, $zip, $fileData)
+Description:
+       $path parameter have to contain full path to file, no assumptions to target folder is done inside function.
index 660c700395f4ccc9638eff8a31568249a88d60fd..c9233a058868f61ef074d2da853e24c224c0f19d 100644 (file)
@@ -35,7 +35,7 @@ if (isset($_POST['go']) || isset($_POST['show']))
        }
        elseif (!is_date_in_fiscalyear($_POST['date_']))
        {
-               display_error(_("The entered date is not in fiscal year."));
+               display_error(_("The entered date is out of fiscal year or is closed for further data entry."));
                set_focus('date_');
                $input_error = 1;
        }
@@ -64,7 +64,7 @@ if (isset($_POST['go']) || isset($_POST['show']))
 
                if (!is_date_in_fiscalyears($lastdate, false))
                {
-                       display_error(_("Some of the period dates are outside the fiscal year. Create a new fiscal year first!"));
+                       display_error(_("Some of the period dates are outside the fiscal year or are closed for further data entry. Create a new fiscal year first!"));
                        set_focus('date_');
                        $input_error = 1;
                }
index 4fa56550696664b5d957fc36fdd3c86497908a50..9a260037be00796ae50b6d19dc7247e5427de719 100644 (file)
@@ -86,9 +86,9 @@ function fmt_credit($row)
        return $value>0 ? price_format($value) : '';
 }
 
-function fmt_person($row)
+function fmt_person($trans)
 {
-       return payment_person_name($row["person_type_id"],$row["person_id"]);
+       return get_counterparty_name($trans["type"], $trans["trans_no"]);
 }
 
 $update_pager = false;
index a4866002f03135947b2d6bf8cb7926d20c670b6e..7e293af1544fcb69624cd12bb9f2af817f8e58b9 100644 (file)
@@ -113,7 +113,7 @@ function check_valid_entries()
        }
        if (!is_date_in_fiscalyear($_POST['DatePaid']))
        {
-               display_error(_("The entered date is not in fiscal year."));
+               display_error(_("The entered date is out of fiscal year or is closed for further data entry."));
                set_focus('DatePaid');
                return false;
        }
index 97f67ddcb9815f7d123358d9ede77175a8467ded..58479d5bee8bed7f6ccd39efda69f8227fa64251 100644 (file)
@@ -144,6 +144,8 @@ function create_cart($type, $trans_no)
                unset ($_SESSION['pay_items']);
        }
 
+       check_is_closed($type, $trans_no);
+
        $cart = new items_cart($type);
     $cart->order_id = $trans_no;
 
@@ -194,7 +196,7 @@ function create_cart($type, $trans_no)
                // apply exchange rate
                foreach($cart->gl_items as $line_no => $line)
                        $cart->gl_items[$line_no]->amount *= $ex_rate;
-               
+
        } else {
                $cart->reference = $Refs->get_next($cart->trans_type);
                $cart->tran_date = new_doc_date();
@@ -264,7 +266,7 @@ if (isset($_POST['Process']))
        }
        elseif (!is_date_in_fiscalyear($_POST['date_']))
        {
-               display_error(_("The entered date is not in fiscal year."));
+               display_error(_("The entered date is out of fiscal year or is closed for further data entry."));
                set_focus('date_');
                $input_error = 1;
        } 
@@ -294,7 +296,7 @@ if (isset($_POST['Process']))
                $_SESSION['pay_items']->trans_type, $_SESSION['pay_items']->order_id, $_POST['bank_account'],
                $_SESSION['pay_items'], $_POST['date_'],
                $_POST['PayType'], $_POST['person_id'], get_post('PersonDetailID'),
-               $_POST['ref'], $_POST['memo_'], true);
+               $_POST['ref'], $_POST['memo_'], false);
 
        $trans_type = $trans[0];
        $trans_no = $trans[1];
index be1dc607c0c16a50c5055df236cfde030b1cfd83..107c6d6328a21813fcb7186d0b4233139918a450 100644 (file)
@@ -41,6 +41,7 @@ page($_SESSION['page_title'], false, false,'', $js);
 function line_start_focus() {
   global       $Ajax;
 
+  unset($_POST['Index']);
   $Ajax->activate('items_table');
   set_focus('_code_id_edit');
 }
@@ -99,6 +100,7 @@ function create_cart($type=0, $trans_no=0)
                unset ($_SESSION['journal_items']);
        }
 
+       check_is_closed($type, $trans_no);
        $cart = new items_cart($type);
     $cart->order_id = $trans_no;
 
@@ -110,7 +112,7 @@ function create_cart($type=0, $trans_no=0)
                                if ($row['amount'] == 0) continue;
                                $date = $row['tran_date'];
                                $cart->add_gl_item($row['account'], $row['dimension_id'], 
-                                       $row['dimension2_id'], $row['amount'], $row['memo_']);
+                                       $row['dimension2_id'], $row['amount'], $row['memo_'], '', $row['person_id']);
                        }
                }
                $cart->memo_ = get_comments_string($type, $trans_no);
@@ -159,7 +161,7 @@ if (isset($_POST['Process']))
        } 
        elseif (!is_date_in_fiscalyear($_POST['date_'])) 
        {
-               display_error(_("The entered date is not in fiscal year."));
+               display_error(_("The entered date is out of fiscal year or is closed for further data entry."));
                set_focus('date_');
                $input_error = 1;
        } 
@@ -267,7 +269,7 @@ function handle_update_item()
                $amount = -input_num('AmountCredit');
 
        $_SESSION['journal_items']->update_gl_item($_POST['Index'], $_POST['code_id'], 
-           $_POST['dimension_id'], $_POST['dimension2_id'], $amount, $_POST['LineMemo']);
+           $_POST['dimension_id'], $_POST['dimension2_id'], $amount, $_POST['LineMemo'], '', get_post('person_id'));
     }
        line_start_focus();
 }
@@ -293,7 +295,7 @@ function handle_new_item()
                $amount = -input_num('AmountCredit');
        
        $_SESSION['journal_items']->add_gl_item($_POST['code_id'], $_POST['dimension_id'],
-               $_POST['dimension2_id'], $amount, $_POST['LineMemo']);
+               $_POST['dimension2_id'], $amount, $_POST['LineMemo'], '', get_post('person_id'));
        line_start_focus();
 }
 
index a788604ac814541506f3af3fb2fc9c3c3385f518..6a41188c225c7847860a56cb97cc21b70ef77f62 100644 (file)
@@ -191,6 +191,31 @@ function gl_account_in_quick_entry_lines($acc)
        $myrow = db_fetch_row($result);
        return ($myrow[0] > 0); 
 }
+//
+//     Returns n>0 when account is AR, n<0 when account is AP
+//  (priority for AR accounts)
+//
+ function is_subledger_account($account)
+ {
+       $sql = "SELECT 1 FROM ".TB_PREF."cust_branch WHERE receivables_account=".db_escape($account)
+       ." UNION SELECT -1 FROM ".TB_PREF."suppliers WHERE payable_account=".db_escape($account);
+
+       $result = db_query($sql,"Couldn't test AR/AP account");
+       $myrow = db_fetch_row($result);
+       return $myrow[0];
+ }
+
+function get_subaccount_name($code_id, $person_id)
+{
+       $sql = "SELECT debtor_ref as ref FROM ".TB_PREF."cust_branch branch LEFT JOIN ".TB_PREF."debtors_master d ON branch.debtor_no = d.debtor_no
+               WHERE branch.receivables_account=".db_escape($code_id)." AND d.debtor_no=".db_escape($person_id)
+               ." UNION SELECT supp_ref as ref FROM ".TB_PREF."suppliers supp
+               WHERE payable_account=".db_escape($code_id)." AND supplier_id=".db_escape($person_id);
+       $result = db_query($sql, 'cannot retrieve counterparty name');
+       $row = db_fetch($result);
+
+       return  $row ? $row['ref'] : '';
+}
 
 function gl_account_in_bank_accounts($acc)
 {
index 1669d20005656ccff82c445f0f24dd4881870ea7..c4318279a033840c769c8293e132c06b1a78aa4e 100644 (file)
@@ -347,5 +347,20 @@ function get_bank_account_limit($account, $date, $user=null)
                return null;
        return max(0, get_balance_before_for_bank_account($account, add_days($date,1))); // in case of manco made before the check was implemented
 }
+function identify_bank_account($account_number)
+{
+       $number = db_escape($account_number);
+       $sql = "(SELECT id AS id, ".BO_COMPANY." AS type FROM ".TB_PREF."bank_accounts WHERE REPLACE(bank_account_number,' ', '')=$number)";
+       $sql .= " UNION (SELECT supplier_id AS id, ".BO_SUPPLIER." AS type FROM ".TB_PREF."suppliers WHERE REPLACE(bank_account,' ', '')=$number)";
+       $sql .= " UNION (SELECT branch_code AS id, ".BO_CUSTBRANCH." AS type FROM ".TB_PREF."cust_branch WHERE REPLACE(bank_account,' ', '')=$number)";
+
+       $result = db_query($sql, 'bank account identification failed');
+
+       if (db_num_rows($result))
+               return db_fetch($result);
+       else
+               return null;
+}
 
 ?>
\ No newline at end of file
index 4a88583a24a73138d080699f128edbbfa5f934ae..0650a0c654ceafd40c6bb60a5ca984a016ebdb97 100644 (file)
@@ -116,7 +116,6 @@ function get_account_home_balance($person_id, $person_type, $rec_account, $to_da
 }
 //------------- New helper functions for revaluation of customer/supplier currencies 2011-05-08 Joe Hunt.
 
-
 function add_exchange_variation_all($date=null, $ref="", $memo)
 {
        global $Refs;
@@ -178,7 +177,7 @@ function add_exchange_variation_all($date=null, $ref="", $memo)
                }
        }
        //------------- END
-               
+
        commit_transaction();
        return array(($exchanged ? $trans_no : 0), $je);
 }
@@ -252,7 +251,6 @@ function add_bank_transfer($from_account, $to_account, $date_,
        if ($SysPrefs->auto_currency_revaluation())
        {
                $currency = get_bank_account_currency($to_account);
-       
                if (add_exchange_variation($trans_no1, $date_, $to_account, $to_gl_account,     
                        $currency, PT_MISC, $person_id))
                        $exchanged = true;
@@ -306,6 +304,7 @@ function write_bank_transaction($trans_type, $trans_no, $from_account, $items, $
                'person_type_id', 'person_id', 'person_detail_id', 'ref', 'memo_', 'use_transaction'),
                $args);
        hook_db_prewrite($args, $trans_type);
+
        $aid = 0;
        if ($trans_no) {
                $old_trans = $trans_no;
@@ -434,5 +433,3 @@ function write_bank_transaction($trans_type, $trans_no, $from_account, $items, $
 
        return array($trans_type, $trans_no);
 }
-
-?>
\ No newline at end of file
index fe9599afb10d6bc804d5ff4b3d9d5c8c436494b9..536143a3764be6ba2b470847190d01d7c3c6be8e 100644 (file)
@@ -42,6 +42,9 @@ function add_gl_trans($type, $trans_id, $date_, $account, $dimension, $dimension
                else
                        $memo_ = $_SESSION["wa_current_user"]->username . " - " . $memo_;
        }
+       if (!is_subledger_account($account))
+               $person_id = $person_type_id = null;
+
        $sql = "INSERT INTO ".TB_PREF."gl_trans ( type, type_no, tran_date,
                account, dimension_id, dimension2_id, memo_, amount";
 
@@ -161,17 +164,20 @@ function get_gl_trans($type, $trans_id)
 
 //--------------------------------------------------------------------------------
 
-function get_gl_wo_cost_trans($trans_id, $person_id=-1)
+function get_gl_wo_cost_trans($trans_id, $cost_type=-1)
 {
-       $sql = "SELECT ".TB_PREF."gl_trans.*, ".TB_PREF."chart_master.account_name FROM "
-               .TB_PREF."gl_trans, ".TB_PREF."chart_master
-               WHERE ".TB_PREF."chart_master.account_code=".TB_PREF."gl_trans.account
-               AND ".TB_PREF."gl_trans.type=".ST_WORKORDER
-               ." AND ".TB_PREF."gl_trans.type_no=".db_escape($trans_id)."
-               AND ".TB_PREF."gl_trans.person_type_id=".PT_WORKORDER;
-       if ($person_id != -1)
-               $sql .= " AND ".TB_PREF."gl_trans.person_id=".db_escape($person_id);
-       $sql .= " AND amount < 0";      
+       $sql = "SELECT costing.*, gl.*, chart.account_name, com.memo_ FROM "
+               .TB_PREF."wo_costing costing, "
+               .TB_PREF."gl_trans gl LEFT JOIN ".TB_PREF."comments com ON gl.type=com.type     AND gl.type_no=com.id,"
+               .TB_PREF."chart_master chart
+               WHERE 
+                       costing.workorder_id=".db_escape($trans_id)
+               ."      AND chart.account_code=gl.account
+                       AND gl.type=costing.trans_type
+                       AND gl.type_no=costing.trans_no";
+       if ($cost_type != -1)
+               $sql .= " AND costing.cost_type=".db_escape($cost_type);
+       $sql .= " AND amount < 0";
 
        return db_query($sql, "The gl transactions could not be retrieved");
 }
@@ -362,7 +368,7 @@ function add_gl_tax_details($gl_code, $trans_type, $trans_no, $amount, $ex_rate,
        }
        add_trans_tax_details($trans_type, $trans_no, $tax['id'], $tax['rate'], $included, 
                $amount, $net_amount, $ex_rate, $date, $memo);
-                       
+
 }
 
 //--------------------------------------------------------------------------------
@@ -495,9 +501,12 @@ function write_journal_entries(&$cart, $reverse, $use_transaction=true)
                // post to first found bank account using given gl acount code.
                $is_bank_to = is_bank_account($journal_item->code_id);
 
-               add_gl_trans($trans_type, $trans_id, $date_, $journal_item->code_id,
-                       $journal_item->dimension_id, $journal_item->dimension2_id,
-                       $journal_item->reference, $journal_item->amount);
+               add_gl_trans($trans_type, $trans_id, $date_, $journal_item->code_id,
+                       $journal_item->dimension_id, $journal_item->dimension2_id,
+                       $journal_item->reference, $journal_item->amount, null, 
+                       $journal_item->person_type_id, 
+                       $journal_item->person_id);
+
        if ($is_bank_to)
        {
                add_bank_trans($trans_type, $trans_id, $is_bank_to, $ref,
@@ -532,7 +541,9 @@ function write_journal_entries(&$cart, $reverse, $use_transaction=true)
 
                add_gl_trans($trans_type, $trans_id_reverse, $reversingDate,
                        $journal_item->code_id, $journal_item->dimension_id, $journal_item->dimension2_id,
-                       $journal_item->reference, -$journal_item->amount);
+                       $journal_item->reference, -$journal_item->amount, 
+                       null, $journal_item->person_type_id, $journal_item->person_id);
+
                if ($is_bank_to)
                {
                        add_bank_trans($trans_type, $trans_id_reverse, $is_bank_to, $ref,
@@ -586,6 +597,22 @@ function void_gl_trans($type, $trans_id, $nested=false)
 
 //----------------------------------------------------------------------------------------
 
+function clear_gl_trans($type, $trans_id, $nested=false)
+{
+       if (!$nested)
+               begin_transaction();
+
+       $sql = "DELETE FROM ".TB_PREF."gl_trans WHERE type=".db_escape($type)
+       ." AND type_no=".db_escape($trans_id);
+
+       db_query($sql, "could not clear gl transactions for type=$type and trans_no=$trans_id");
+
+       if (!$nested)
+               commit_transaction();
+}
+
+//----------------------------------------------------------------------------------------
+
 function void_journal_trans($type, $type_no, $use_transaction=true)
 {
        if ($use_transaction)
@@ -634,7 +661,11 @@ function get_sql_for_journal_inquiry($filter, $from, $to, $ref='', $memo='', $al
        if (!$alsoclosed) {
                $sql .= " AND gl_seq=0";
        }
-       $sql .= " GROUP BY gl.type, gl.type_no";
+       else
+               $sql .= " AND NOT ISNULL(a.gl_seq)";
+
+       $sql .= " GROUP BY tran_date, gl_seq, gl.type, gl.type_no";
+
        return $sql;
 }
 ?>
\ No newline at end of file
index 5c262eaf83c945e4707503d814bf4fa3ebc8f6dd..5425edfbaa605af1d5e1b89083e2019f5febddff 100644 (file)
@@ -83,9 +83,9 @@ function display_bank_header(&$order)
                                $customer_error = true;
                                        display_error(_("This customer account is on hold."));
                        }
-                       else                    
+                       else
                                        display_warning(_("This customer account is on hold."));
-               }               
+               }
                break;
 
                case PT_QUICKENTRY :
index 8c4aec6ae44d2b27e7db29c0c6013add32e4a7b4..d68f09140bbb951795a7687dc129fc8f905fe647 100644 (file)
@@ -43,9 +43,9 @@ function display_order_header(&$Order)
        {
                table_section(3, "40%");
                start_row();
-               quick_entries_list_cells(_("Quick Entry").":", 'person_id', null, QE_JOURNAL, true);
-               $qid = get_quick_entry(get_post('person_id'));
-               if (list_updated('person_id')) {
+               quick_entries_list_cells(_("Quick Entry").":", 'quick', null, QE_JOURNAL, true);
+               $qid = get_quick_entry(get_post('quick'));
+               if (list_updated('quick')) {
                        unset($_POST['totamount']); // enable default
                $Ajax->activate('totamount');
                }
@@ -63,7 +63,7 @@ function display_order_header(&$Order)
                end_row();
 
        }
-               
+
        end_outer_table(1);
 }
 
@@ -77,6 +77,9 @@ function display_gl_items($title, &$order)
 
        $dim = get_company_pref('use_dimension');
 
+       $sub_type = is_subledger_account(get_post('code_id'));
+       $has_subaccounts = $order->has_sub_accounts();
+
     div_start('items_table');
        start_table(TABLESTYLE, "colspan=7 width=95%");
        if ($dim == 2)
@@ -90,19 +93,28 @@ function display_gl_items($title, &$order)
                        _("Debit"), _("Credit"), _("Memo"), "");
 
        if (count($order->gl_items)) $th[] = '';
+       if ($sub_type || $has_subaccounts)
+               array_insert($th, 2, _("Counterparty"));
 
-       table_header($th);      
+       table_header($th);
 
        $k = 0;
 
        $id = find_submit('Edit');
+       if ($id == -1) 
+               $id = get_post('Index', -1);
+
        foreach ($order->gl_items as $line => $item) 
        {
                if ($id != $line)
                {
                alt_table_row_color($k);
 
-                       label_cells($item->code_id, $item->description);
+                       $acc = $item->code_id . ($item->person_id ? sprintf(' %05d', $item->person_id) : '');
+                       label_cells($acc, $item->description);
+
+                       label_cell($item->person_name);
+
                if ($dim >= 1)
                                label_cell(get_dimension_string($item->dimension_id, true));
                if ($dim > 1)
@@ -111,7 +123,7 @@ function display_gl_items($title, &$order)
                {
                        amount_cell(abs($item->amount));
                        label_cell("");
-               }       
+               }
                else
                {
                        label_cell("");
@@ -127,12 +139,12 @@ function display_gl_items($title, &$order)
                } 
                else 
                {
-                       gl_edit_item_controls($order, $dim, $line);
+                       gl_edit_item_controls($order, $dim, $item->person_id, $line);
                }
        }
 
        if ($id == -1)
-               gl_edit_item_controls($order, $dim);
+               gl_edit_item_controls($order, $dim, $sub_type);
 
        if ($order->count_gl_items()) 
        {
@@ -151,35 +163,47 @@ function display_gl_items($title, &$order)
 
 //---------------------------------------------------------------------------------
 
-function gl_edit_item_controls(&$order, $dim, $Index=null)
+function gl_edit_item_controls(&$order, $dim, $sub_accounts, $Index=null)
 {
        global $Ajax;
        start_row();
 
        $id = find_submit('Edit');
+       if ($id == -1) 
+               $continue = $id = get_post('Index', -1);
+
        if ($Index != -1 && $Index == $id)
        {
            // Modifying an existing row
                $item = $order->gl_items[$Index];
-               $_POST['code_id'] = $item->code_id;
-               $_POST['dimension_id'] = $item->dimension_id;
-               $_POST['dimension2_id'] = $item->dimension2_id;
-               if ($item->amount > 0)
+               if (!isset($continue))
                {
-                       $_POST['AmountDebit'] = price_format($item->amount);
-                       $_POST['AmountCredit'] = "";
+                       $_POST['code_id'] = $item->code_id;
+                       $_POST['dimension_id'] = $item->dimension_id;
+                       $_POST['dimension2_id'] = $item->dimension2_id;
+                       $_POST['person_id'] = $item->person_id;
+                       if ($item->amount > 0)
+                       {
+                               $_POST['AmountDebit'] = price_format($item->amount);
+                               $_POST['AmountCredit'] = "";
+                       }
+                       else
+                       {
+                               $_POST['AmountDebit'] = "";
+                               $_POST['AmountCredit'] = price_format(abs($item->amount));
+                       }
+                       $_POST['description'] = $item->description;
+                       $_POST['LineMemo'] = $item->reference;
                }
-               else
-               {
-                       $_POST['AmountDebit'] = "";
-                       $_POST['AmountCredit'] = price_format(abs($item->amount));
-               }       
-               $_POST['description'] = $item->description;
-               $_POST['LineMemo'] = $item->reference;
-
                hidden('Index', $id);
                $skip_bank = !$_SESSION["wa_current_user"]->can_access('SA_BANKJOURNAL');
-               echo gl_all_accounts_list('code_id', null, $skip_bank, true);
+               echo gl_all_accounts_list('code_id', null, $skip_bank, true, _('[Select account]'), true, false, false);
+
+               if (is_subledger_account(get_post('code_id')))
+               {
+                       subledger_list_cells(null, 'person_id', get_post('code_id'));
+               } elseif ($order->has_sub_accounts())
+                       label_cell('');
                if ($dim >= 1) 
                        dimensions_list_cells(null, 'dimension_id', null, true, " ", false, 1);
                if ($dim > 1) 
@@ -188,20 +212,32 @@ function gl_edit_item_controls(&$order, $dim, $Index=null)
        }
        else
        {
-           // Adding a new row
-               $_POST['AmountDebit'] = '';  //price_format(0);
-               $_POST['AmountCredit'] = ''; //price_format(0);
-               $_POST['dimension_id'] = 0;
-               $_POST['dimension2_id'] = 0;
-               //$_POST['LineMemo'] = ""; // let memo go to next line Joe Hunt 2010-05-30
-               $_POST['_code_id_edit'] = "";
-               $_POST['code_id'] = "";
+
+               if (!list_updated('code_id'))
+               {
+                   // Adding a new row
+                       $_POST['AmountDebit'] = '';  //price_format(0);
+                       $_POST['AmountCredit'] = ''; //price_format(0);
+                       $_POST['dimension_id'] = 0;
+                       $_POST['dimension2_id'] = 0;
+                       //$_POST['LineMemo'] = ""; // let memo go to next line Joe Hunt 2010-05-30
+                       $_POST['_code_id_edit'] = "";
+                       $_POST['code_id'] = "";
+               }
                if(isset($_POST['_code_id_update'])) {
-                           $Ajax->activate('code_id');
+                   $Ajax->activate('code_id');
                }
-               
+
                $skip_bank = !$_SESSION["wa_current_user"]->can_access('SA_BANKJOURNAL');
-               echo gl_all_accounts_list('code_id', null, $skip_bank, true);
+               echo gl_all_accounts_list('code_id', null, $skip_bank, true, _('[Select account]'), true, false, false);
+
+               if ($sub_accounts)
+               {
+                       subledger_list_cells(null, 'person_id', get_post('code_id'));
+               }
+               elseif ($order->has_sub_accounts())
+                       label_cell('');
+
                if ($dim >= 1)
                        dimensions_list_cells(null, 'dimension_id', null, true, " ", false, 1);
                if ($dim > 1)
@@ -241,8 +277,3 @@ function gl_options_controls()
 
          echo "</table>";
 }
-
-
-//---------------------------------------------------------------------------------
-
-?>
\ No newline at end of file
index b264fe7f673f539571e71d27d8f51bcaefbac00a..30380989c73ab95a6a557a55b34587a00e95dfa2 100644 (file)
@@ -102,7 +102,7 @@ while ($myrow = db_fetch($result))
        label_cell($trandate);
        display_debit_or_credit_cells($myrow["amount"]);
        amount_cell($running_total);
-       label_cell(payment_person_name($myrow["person_type_id"],$myrow["person_id"]));
+       label_cell(get_counterparty_name($myrow["type"], $myrow["trans_no"]));
        label_cell(get_gl_view_str($myrow["type"], $myrow["trans_no"]));
        end_row();
        if ($myrow["amount"] > 0 ) 
index 53738843364d6462b6227b6ba5018933363bff8e..1f6545c9ded2b3983e14aa736141ceeeedb63181 100644 (file)
@@ -65,33 +65,31 @@ function gl_inquiry_controls()
 function display_trial_balance($type, $typename)
 {
        global $path_to_root;
-       
+
        global $k, $pdeb, $pcre, $cdeb, $ccre, $tdeb, $tcre, $pbal, $cbal, $tbal;
        $printtitle = 0; //Flag for printing type name          
 
        $k = 0;
 
-       //$accounts = get_gl_accounts();
        //Get Accounts directly under this group/type
-       $accounts = get_gl_accounts(null, null, $type);         
-       
+       $accounts = get_gl_accounts(null, null, $type);
+
        $begin = get_fiscalyear_begin_for_date($_POST['TransFromDate']);
-       //$begin = begin_fiscalyear();
        if (date1_greater_date2($begin, $_POST['TransFromDate']))
                $begin = $_POST['TransFromDate'];
        $begin = add_days($begin, -1);
-       
+
        while ($account = db_fetch($accounts))
        {
                //Print Type Title if it has atleast one non-zero account       
                if (!$printtitle)
-               {       
+               {
                        start_row("class='inquirybg' style='font-weight:bold'");
                        label_cell(_("Group")." - ".$type ." - ".$typename, "colspan=8");
-                       end_row();              
-                       $printtitle = 1;                
-               }       
-       
+                       end_row();
+                       $printtitle = 1;
+               }
+
                $prev = get_balance($account["account_code"], $_POST['Dimension'], $_POST['Dimension2'], $begin, $_POST['TransFromDate'], false, false);
                $curr = get_balance($account["account_code"], $_POST['Dimension'], $_POST['Dimension2'], $_POST['TransFromDate'], $_POST['TransToDate'], true, true);
                $tot = get_balance($account["account_code"], $_POST['Dimension'], $_POST['Dimension2'], $begin, $_POST['TransToDate'], false, true);
@@ -108,7 +106,7 @@ function display_trial_balance($type, $typename)
                        display_debit_or_credit_cells($prev['balance']);
                        display_debit_or_credit_cells($curr['balance']);
                        display_debit_or_credit_cells($tot['balance']);
-                       
+
                }
                else
                {
@@ -140,8 +138,9 @@ function display_trial_balance($type, $typename)
                {
                        start_row("class='inquirybg' style='font-weight:bold'");
                        label_cell(_("Group")." - ".$type ." - ".$typename, "colspan=8");
-                       end_row();              
-                       $printtitle = 1;                
+                       end_row();
+                       $printtitle = 1;
+
                }
                display_trial_balance($accounttype["id"], $accounttype["name"].' ('.$typename.')');
        }
@@ -159,8 +158,8 @@ if (isset($_POST['TransFromDate']))
                display_error(_("The from date cannot be bigger than the fiscal year end."));
                set_focus('TransFromDate');
                return;
-       }       
-}      
+       }
+}
 div_start('balance_tbl');
 if (!isset($_POST['Dimension']))
        $_POST['Dimension'] = 0;
diff --git a/gl/manage/close_period.php b/gl/manage/close_period.php
new file mode 100644 (file)
index 0000000..fc057c2
--- /dev/null
@@ -0,0 +1,109 @@
+<?php
+/**********************************************************************
+    Copyright (C) FrontAccounting, LLC.
+       Released under the terms of the GNU General Public License, GPL, 
+       as published by the Free Software Foundation, either version 3 
+       of the License, or (at your option) any later version.
+    This program is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
+    See the License here <http://www.gnu.org/licenses/gpl-3.0.html>.
+***********************************************************************/
+
+$page_security = 'SA_GLCLOSE';
+$path_to_root = "../..";
+include_once($path_to_root . "/includes/session.inc");
+
+include_once($path_to_root . "/includes/date_functions.inc");
+include_once($path_to_root . "/includes/ui.inc");
+include_once($path_to_root . "/includes/banking.inc");
+include_once($path_to_root . "/admin/db/fiscalyears_db.inc");
+
+$js = "";
+if ($use_date_picker)
+       $js .= get_js_date_picker();
+page(_($help_context = "Closing GL Transactions"), false, false, "", $js);
+
+//---------------------------------------------------------------------------------------------
+function check_data()
+{
+       global $Refs, $allow_gl_reopen;
+       
+       if (!is_date($_POST['date']) || date1_greater_date2($_POST['date'], Today()))
+       {
+               display_error( _("The entered date is invalid."));
+               set_focus('date');
+               return false;
+       }
+       if (!is_date_in_fiscalyears($_POST['date'], false))
+       {
+               display_error(_("Selected date is not in fiscal year or the year is closed."));
+               set_focus('date');
+               return false;
+       }
+       if (date1_greater_date2(sql2date(get_company_pref('gl_closing_date')), $_POST['date']))
+       {
+               if (!$allow_gl_reopen) {
+                       display_error(_("The entered date is earlier than date already selected as closing date."));
+                       set_focus('date');
+                       return false;
+               } elseif (!user_check_access('SA_GLREOPEN')) {
+                       display_error(_("You are not allowed to reopen already closed transactions."));
+                       set_focus('date');
+                       return false;
+               }
+       }
+       return true;
+}
+
+//---------------------------------------------------------------------------------------------
+
+function handle_submit()
+{
+       if (!check_data())
+               return;
+
+       if (!close_transactions($_POST['date']))
+       {
+               display_notification(
+                       sprintf( _("All transactions resulting in GL accounts changes up to %s has been closed for further edition."),
+                       sql2date(get_company_pref('gl_closing_date'))) );
+       }
+
+}
+
+
+//---------------------------------------------------------------------------------------------
+
+function clear_data()
+{
+       unset($_POST['date_']);
+}
+
+//---------------------------------------------------------------------------------------------
+
+if (get_post('submit'))
+       handle_submit();
+else
+       display_note(_("Using this feature you can prevent entering new transactions <br>
+       and disable edition of already entered transactions up to specified date.<br>
+       Only transactions which can generate GL postings are subject to the constraint."));
+
+//---------------------------------------------------------------------------------------------
+
+br(1);
+start_form();
+start_table(TABLESTYLE2);
+if (!isset($_POST['date'])) {
+       $cdate = sql2date(get_company_pref('gl_closing_date'));
+       $_POST['date'] = $cdate ;// ? end_month(add_months($cdate, 1)) : Today();
+}
+date_row(_("End date of closing period:"), 'date');
+end_table(1);
+
+submit_center('submit', _("Close Transactions"), true, false);
+end_form();
+
+end_page();
+
+?>
index 221a76cd28e8d7944f1fc84157fa7c12372f8f6f..0ce1d5da8e385b5a4a0b7253354df5b151b6fef8 100644 (file)
@@ -12,7 +12,7 @@
 $page_security = 'SA_GLACCOUNT';
 $path_to_root = "../..";
 include($path_to_root . "/includes/session.inc");
+
 page(_($help_context = "Chart of Accounts"));
 
 include($path_to_root . "/includes/ui.inc");
@@ -79,7 +79,7 @@ if (isset($_POST['add']) || isset($_POST['update']))
                        if (get_post('inactive') == 1 && is_bank_account($_POST['account_code']))
                        {
                                display_error(_("The account belongs to a bank account and cannot be inactivated."));
-                       }       
+                       }
                elseif (update_gl_account($_POST['account_code'], $_POST['account_name'], 
                                $_POST['account_type'], $_POST['account_code2'])) {
                                update_record_status($_POST['account_code'], $_POST['inactive'],
@@ -127,32 +127,31 @@ function can_delete($selected_account)
        {
                display_error(_("Cannot delete this account because it is used by a bank account."));
                return false;
-       }       
+       }
 
        if (gl_account_in_stock_category($selected_account))
        {
                display_error(_("Cannot delete this account because it is used by one or more Item Categories."));
                return false;
-       }       
-       
+       }
+
        if (gl_account_in_stock_master($selected_account))
        {
                display_error(_("Cannot delete this account because it is used by one or more Items."));
                return false;
-       }       
-       
+       }
+
        if (gl_account_in_tax_types($selected_account))
        {
                display_error(_("Cannot delete this account because it is used by one or more Taxes."));
                return false;
-       }       
-       
+       }
+
        if (gl_account_in_cust_branch($selected_account))
        {
                display_error(_("Cannot delete this account because it is used by one or more Customer Branches."));
                return false;
-       }               
-       
+       }
        if (gl_account_in_suppliers($selected_account))
        {
                display_error(_("Cannot delete this account because it is used by one or more suppliers."));
index a35c4a91e177a99db8964bdedb32085354d01509..050637d5f26cfee6b9646dc0420bec6a28a24130 100644 (file)
@@ -56,7 +56,7 @@ function check_data()
        }
        if (!is_date_in_fiscalyear($_POST['date']))
        {
-               display_error(_("The entered date is not in fiscal year."));
+               display_error(_("The entered date is out of fiscal year or is closed for further data entry."));
                set_focus('date');
                return false;
        }
index 42e1aa39fdc395234ef4d6e31c5e39a61c98733b..88b9a2f23e415e0ebb0d7e068be7ce46eb47ac4b 100644 (file)
@@ -68,7 +68,7 @@ label_cells(_("Amount"), number_format2($to_trans['amount'], user_price_dec()),
 label_cells(_("Date"), sql2date($to_trans['trans_date']), "class='tableheader2'");
 end_row();
 start_row();
-label_cells(_("From"), payment_person_name($to_trans['person_type_id'], $to_trans['person_id']), "class='tableheader2'", "colspan=$colspan1");
+label_cells(_("From"), get_counterparty_name(ST_BANKDEPOSIT, $trans_no), "class='tableheader2'", "colspan=$colspan1");
 label_cells(_("Deposit Type"), $bank_transfer_types[$to_trans['account_type']], "class='tableheader2'");
 end_row();
 start_row();
index f348de15c2c672e8d4587ebc2fce40cf65068361..681373c2c9577d3924bc6319b0f598a12c877854 100644 (file)
@@ -66,7 +66,7 @@ label_cells(_("Amount"), number_format2(-$from_trans['amount'], user_price_dec()
 label_cells(_("Date"), sql2date($from_trans['trans_date']), "class='tableheader2'");
 end_row();
 start_row();
-label_cells(_("Pay To"), payment_person_name($from_trans['person_type_id'], $from_trans['person_id']), "class='tableheader2'", "colspan=$colspan1");
+label_cells(_("Pay To"), get_counterparty_name(ST_BANKPAYMENT, $trans_no), "class='tableheader2'", "colspan=$colspan1");
 label_cells(_("Payment Type"), $bank_transfer_types[$from_trans['account_type']], "class='tableheader2'");
 end_row();
 start_row();
index 4e61fef91349cf9967a12ef5815ccb6a07bacdfa..5d54c72f6210c91bc6a5138e2c3d985173b08ba4 100644 (file)
@@ -33,14 +33,19 @@ function display_gl_heading($myrow)
        $trans_name = $systypes_array[$_GET['type_id']];
     start_table(TABLESTYLE, "width=95%");
     $th = array(_("General Ledger Transaction Details"), _("Reference"),
-       _("Date"), _("Person/Item"));
-    table_header($th); 
-    start_row();       
+       _("Date"));
+
+       if ($_GET['type_id'] != ST_JOURNAL)
+               $th[] = _("Counterparty");
+
+    table_header($th);
+    start_row();
     label_cell("$trans_name #" . $_GET['trans_no']);
     label_cell($myrow["reference"]);
        label_cell(sql2date($myrow["tran_date"]));
-       label_cell(payment_person_name($myrow["person_type_id"],$myrow["person_id"]));
-       
+       if ($_GET['type_id'] != ST_JOURNAL)
+               label_cell(get_counterparty_name($_GET['type_id'],$_GET['trans_no']));
+
        end_row();
 
        comments_display_row($_GET['type_id'], $_GET['trans_no']);
@@ -68,6 +73,7 @@ else if ($dim == 1)
 else           
        $th = array(_("Account Code"), _("Account Name"),
                _("Debit"), _("Credit"), _("Memo"));
+
 $k = 0; //row colour counter
 $heading_shown = false;
 
@@ -81,12 +87,15 @@ while ($myrow = db_fetch($result))
                start_table(TABLESTYLE, "width=95%");
                table_header($th);
                $heading_shown = true;
-       }       
+       }
 
        alt_table_row_color($k);
-       
-    label_cell($myrow['account']);
-       label_cell($myrow['account_name']);
+
+       $counterpartyname = get_subaccount_name($myrow["account"], $myrow["person_id"]);
+       $counterparty_id = $counterpartyname ? sprintf(' %05d', $myrow["person_id"]) : '';
+
+    label_cell($myrow['account'].$counterparty_id);
+       label_cell($myrow['account_name'] . ($counterpartyname ? ': '.$counterpartyname : ''));
        if ($dim >= 1)
                label_cell(get_dimension_string($myrow['dimension_id'], true));
        if ($dim > 1)
index 38d78abf6c755457f2fa19ffcb444882f24534d5..a8bb7b840ee0074172e41bcb71e13aaf0c2e20fd 100644 (file)
@@ -227,6 +227,8 @@ $security_areas =array(
        'SA_FISCALYEARS' => array(SS_GL_C|9, _("Fiscal years maintenance")),
        'SA_GLSETUP' => array(SS_GL_C|10, _("Company GL setup")),
        'SA_GLACCOUNTTAGS' => array(SS_GL_C|11, _("GL Account tags")),
+       'SA_GLCLOSE' => array(SS_GL_C|14, _("Closing GL transactions")),
+       'SA_GLREOPEN' => array(SS_GL_C|15, _("Reopening GL transactions")), // see below
        'SA_MULTIFISCALYEARS' => array(SS_GL_C|13, _("Allow entry on non closed Fiscal years")),
 
        'SA_BANKTRANSVIEW' => array(SS_GL|1, _("Bank transactions view")),
@@ -247,6 +249,9 @@ $security_areas =array(
        'SA_BANKREP' => array(SS_GL_A|3, _("Bank reports and inquiries")),
        'SA_GLREP' => array(SS_GL_A|4, _("GL reports and inquiries")),
 );
+
+if (!@$allow_gl_reopen)
+       unset($security_areas['SA_GLREOPEN']);
 /*
        This function should be called whenever we want to extend core access level system
        with new security areas and/or sections i.e.: 
diff --git a/includes/app_entries.inc b/includes/app_entries.inc
new file mode 100644 (file)
index 0000000..eabfdd8
--- /dev/null
@@ -0,0 +1,54 @@
+<?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>.
+***********************************************************************/
+/*
+       This file contains all application entry points.
+*/
+
+/*
+       Transaction editors. First paraneter is transaction number, second (optional) transaction type.
+*/
+$trans_editors = array(
+
+       ST_JOURNAL => "/gl/gl_journal.php?ModifyGL=Yes&trans_no=%d&trans_type=%d",
+       ST_BANKPAYMENT => "/gl/gl_bank.php?ModifyPayment=Yes&trans_no=%d&trans_type=%d",
+       ST_BANKDEPOSIT => "/gl/gl_bank.php?ModifyDeposit=Yes&trans_no=%d&trans_type=%d",
+       //ST_BANKTRANSFER => ,
+
+       ST_SALESINVOICE => "/sales/customer_invoice.php?ModifyInvoice=%d",
+//   11=>
+// free hand (debtors_trans.order_==0)
+//     "/sales/credit_note_entry.php?ModifyCredit=%d"
+// credit invoice
+//     "/sales/customer_credit_invoice.php?ModifyCredit=%d"
+       ST_CUSTCREDIT =>  "/sales/customer_credit_invoice.php?ModifyCredit=%s",
+       //ST_CUSTPAYMENT =>  ,
+       ST_CUSTDELIVERY => "/sales/customer_delivery.php?ModifyDelivery=%d",
+
+       //ST_LOCTRANSFER =>  ,
+       //ST_INVADJUST =>  ,
+
+       ST_PURCHORDER =>  "/purchasing/po_entry_items.php?ModifyOrderNumber=%d",
+       ST_SUPPINVOICE => "/purchasing/supplier_invoice.php?ModifyInvoice=%d",
+
+       //ST_SUPPCREDIT =>  ,
+       //ST_SUPPAYMENT =>  ,
+       //ST_SUPPRECEIVE => ,
+
+       //ST_WORKORDER =>  ,
+       //ST_MANUISSUE =>  ,
+       //ST_MANURECEIVE =>  ,
+
+       ST_SALESORDER => "/sales/sales_order_entry.php?ModifyOrderNumber=%d",
+       ST_SALESQUOTE => "/sales/sales_order_entry.php?ModifyQuotationNumber=%d",
+       //ST_COSTUPDATE =>  ,
+       //ST_DIMENSION =>  ,
+);
index 60964cbb8ad1224b7be575b42976755c2ab9f83f..0a5b7481dc381bba29617ae769f30ef60a24dae0 100644 (file)
@@ -76,6 +76,7 @@ class current_user
                if ($Auth_Result)
                {
                        $myrow = get_user_by_login($loginname);
+
                        $this->old_db = isset($myrow["full_access"]);
                        if (! @$myrow["inactive"]) {
                                if ($this->old_db) { 
@@ -433,6 +434,11 @@ function user_startup_tab()
        return $_SESSION["wa_current_user"]->prefs->start_up_tab();
 }
 
+function user_check_access($sec_area)
+{
+       return $_SESSION["wa_current_user"]->can_access($sec_area);
+}
+
 function set_user_prefs($prefs)
 {
        $_SESSION["wa_current_user"]->update_prefs($prefs);
@@ -544,6 +550,7 @@ function flush_dir($path, $wipe = false)
        $dir = opendir($path);
        if(!$dir)
                return;
+
        while(false !== ($fname = readdir($dir))) {
                if($fname=='.' || $fname=='..' || $fname=='CVS' || (!$wipe && $fname=='index.php')) continue;
                if(is_dir($path.'/'.$fname)) {
index 798e84c4b5c10070a4526a2ccbc7a2ad987b0898..f50e94540319f94d40b1a684c2e93f7de3751081 100644 (file)
@@ -485,5 +485,16 @@ function check_num($postname, $min=null, $max=null, $dflt=0) {
     return 1;
 }
 
-
-?>
\ No newline at end of file
+function check_is_closed($type, $type_no, $msg=null)
+{
+       global $systypes_array;
+       
+    if (($type_no > 0) && is_closed_trans($type, $type_no))
+    {
+       if (!$msg)
+               $msg = sprintf(_("%s #%s is closed for further edition."), $systypes_array[$type], $type_no);
+       display_error($msg, true);
+       end_page();
+       exit;
+    }
+}
index 6f8379e072877bbf9413f274ca29366da2af68a6..d1aacdf8302f7fbbf80da6089a8b16e86b19fda3 100644 (file)
@@ -160,26 +160,29 @@ function is_date_in_fiscalyear($date, $convert=false)
        global $path_to_root;
        include_once($path_to_root . "/admin/db/fiscalyears_db.inc");
 
-    //Chaitanya
-    if ($convert)
-        $date2 = sql2date($date);
-    else
-        $date2 = $date;
-
-    if ($_SESSION["wa_current_user"]->can_access('SA_MULTIFISCALYEARS')) // allow all open years for this one
-        return is_date_in_fiscalyears($date2, false); 
-
-    $myrow = get_current_fiscalyear();
-    if ($myrow['closed'] == 1)
-        return 0;
-    
-    $begin = sql2date($myrow['begin']);
-    $end = sql2date($myrow['end']);
-    if (date1_greater_date2($begin, $date2) || date1_greater_date2($date2, $end))
-    {
-        return 0;
-    }
-    return 1;
+       if ($convert)
+               $date2 = sql2date($date);
+       else
+               $date2 = $date;
+
+       if (user_check_access('SA_MULTIFISCALYEARS')) // allow all open years for this one
+               return is_date_in_fiscalyears($date2, false);
+
+       if (is_date_closed($date2))
+               return 0;
+       $myrow = get_current_fiscalyear();
+       $begin = sql2date($myrow['begin']);
+       $end = sql2date($myrow['end']);
+       if (date1_greater_date2($begin, $date2) || date1_greater_date2($date2, $end))
+       {
+               return 0;
+       }
+       return 1;
+}
+
+function is_date_closed($date)
+{
+       return !date1_greater_date2($date, sql2date(get_company_pref('gl_closing_date')));
 }
 
 function begin_fiscalyear()
@@ -345,7 +348,6 @@ and converts to a yyyy/mm/dd format */
 
        $date_ = trim($date_);
     $year = $month = $day = 0;
-
     // Split up the date by the separator based on "how" to split it
     if ($how == 0) // MMDDYYYY
         list($month, $day, $year) = explode($sep, $date_);
index f9efe9a01861a2d3016dbdbf21e7c4d1fcec4904..c25fdc5111526228c42f858afa8ed8756123b524 100644 (file)
 
 function add_audit_trail($trans_type, $trans_no, $trans_date, $descr='')
 {
+       $date = date2sql($trans_date);
        $sql = "INSERT INTO ".TB_PREF."audit_trail"
-               . " (type, trans_no, user, fiscal_year, gl_date, description, gl_seq)
+               . " (type, trans_no, user, gl_date, description)
                        VALUES(".db_escape($trans_type).", ".db_escape($trans_no).","
-                       . $_SESSION["wa_current_user"]->user. ","
-                       . get_company_pref('f_year') .","
-                       . "'". date2sql($trans_date) ."',"
-                       . db_escape($descr). ", 0)";
+                       . $_SESSION["wa_current_user"]->user . ","
+                       . "'$date',". db_escape($descr). ")";
 
        db_query($sql, "Cannot add audit info");
-       
-       // all audit records beside latest one should have gl_seq set to NULL
+       // all audit records beside just inserted one should have gl_seq set to NULL
        // to avoid need for subqueries (not existing in MySQL 3) all over the code
-       $sql = "UPDATE ".TB_PREF."audit_trail SET gl_seq = NULL"
+       $sql = "UPDATE ".TB_PREF."audit_trail audit LEFT JOIN ".TB_PREF."fiscal_year year ON year.begin<='$date' AND year.end>='$date'
+               SET audit.gl_seq = IF(audit.id=".db_insert_id().", 0, NULL),"
+               ."audit.fiscal_year=year.id"
                . " WHERE type=".db_escape($trans_type)." AND trans_no="
-               .db_escape($trans_no)." AND id!=".db_insert_id();
+               . db_escape($trans_no);
 
        db_query($sql, "Cannot update audit gl_seq");
 }
@@ -58,14 +58,18 @@ function get_audit_trail_last($trans_type, $trans_no)
        and reindex     journal.
 */
 function close_transactions($todate) {
+
+       begin_transaction();
+
        $errors = 0;
-       $sql = "SELECT DISTINCT a.id, a.gl_date, a.fiscal_year"
+       // select only those audit trail records which produce any GL postings
+       $sql = "SELECT a.id, gl.tran_date, a.fiscal_year, a.gl_seq,
+                gl.tran_date <= '". date2sql($todate) ."' as closed"
                ." FROM ".TB_PREF."gl_trans gl"
                ." LEFT JOIN ". TB_PREF."audit_trail a ON 
                        (gl.type=a.type AND gl.type_no=a.trans_no)"
-               . " WHERE gl_date<='". date2sql($todate) ."'"
-               . " AND NOT ISNULL(gl_seq)"
-               . " ORDER BY a.fiscal_year, a.gl_date, a.id";
+               . " WHERE NOT ISNULL(a.gl_seq) AND gl.amount!=0"        // skip old audit records and voided transactions
+               . " GROUP BY  a.id, gl.tran_date, a.fiscal_year, a.gl_seq ORDER BY a.fiscal_year, gl.tran_date, a.id";
 
        $result = db_query($sql, "Cannot select transactions for closing");
 
@@ -78,59 +82,44 @@ function close_transactions($todate) {
                        }
                        if ($last_year != $row['fiscal_year']) {
                                $last_year = $row['fiscal_year'];
-                               $counter = 1; // reset counter on fiscal year change
-                       } else
-                               $counter++;
-                       $sql2 = "UPDATE ".TB_PREF."audit_trail SET"
-                               . " gl_seq=$counter"
-                               . " WHERE id=".$row['id'];
-                                                                                       
-                       db_query($sql2, "Cannot reindex journal");
+                               $counter = 0; // reset counter on fiscal year change
+                       }
+
+                       $seq = $row['closed'] ? ++$counter : 0;
+                       if ($row['gl_seq'] != $seq)     { // update transaction status only when gl_seq has changed
+                               $sql2 = "UPDATE ".TB_PREF."audit_trail SET"
+                                       . " gl_seq=$seq"
+                                       . " WHERE id=".$row['id'];
+                               db_query($sql2, "Cannot reindex journal");
+                       }
                }
        }
-       
+
        if ($errors) 
                display_warning(_("Some transactions journal GL postings were not indexed due to lack of audit trail record."));
-}
-
-/*
-       Reopen all transactions for edition up from date $fromdate
-*/
-function open_transactions($fromdate) {
-
-       $sql = "SELECT a.id, a.gl_date, a.fiscal_year"
-               ." FROM ".TB_PREF."gl_trans gl"
-               ." LEFT JOIN ". TB_PREF."audit_trail a ON 
-                       (gl.type=a.type AND gl.type_no=a.trans_no)"
-               . " WHERE gl_date>='". date2sql($fromdate) ."'"
-               . " AND !ISNULL(gl_seq)"
-               . " ORDER BY a.fiscal_year, a.gl_date, a.id";
-
-       $result = db_query($sql, "Cannot select transactions for openning");
+       else
+               update_company_prefs(array('gl_closing_date'=> date2sql($todate)));
+       commit_transaction();
 
-       if (db_num_rows($result)) {
-               $last_year = 0;
-
-               while ($row = db_fetch($result)) {
-                       if ($row['fiscal_year'] == null) {
-                               continue;
-                       }
-                       $sql2 = "UPDATE ".TB_PREF."audit_trail SET"
-                               . " gl_seq=0"
-                               . " WHERE id=".$row['id'];
-                                                                                       
-                       db_query($sql2, "Cannot clear journal order");
-               }
-       }
+       return $errors;
 }
+
 /*
        Closed transactions have gl_seq number assigned.
 */
 function is_closed_trans($type, $trans_no) {
+
+       $cdate = get_company_pref('gl_closing_date');
+       if (!$cdate)
+               return false;
+
+// FIXME: gl_date can be badly entered for some transactions due to bug in previous FA versions 
        $sql = "SELECT  gl_seq  FROM ".TB_PREF."audit_trail"
                . " WHERE type=".db_escape($type)
                ." AND trans_no=".db_escape($trans_no)
-               ." AND gl_seq>0";
+               ." AND gl_date<='$cdate'"; // date is stored in sql format
+//             ." AND (gl_date<='$cdate'" // some transaction can be not sequenced due to 0 amount, however after edition this could change
+//             ." OR gl_seq>0)";
 
        $res = db_query($sql, "Cannot check transaction");
 
index c181b98952e434744cc1018d3868a2aeefef5439..fda58ab32e1863a95b739bd74f52a1cb1f861d73 100644 (file)
@@ -37,7 +37,7 @@ function db_query($sql, $err_msg=null)
 {
        global $db, $show_sql, $sql_trail, $select_trail, $go_debug, $sql_queries, $Ajax,
                $db_connections, $db_last_inserted_id;
-       
+
        // set current db prefix
        $cur_prefix = $db_connections[$_SESSION["wa_current_user"]->cur_con]['tbpref'];
        $sql = str_replace(TB_PREF, $cur_prefix, $sql);
@@ -49,7 +49,7 @@ function db_query($sql, $err_msg=null)
        }
 
        $result = mysql_query($sql, $db);
-       
+
        if($sql_trail) {
                $db_last_inserted_id = mysql_insert_id($db);    // preserve in case trail insert is done
                if ($select_trail || (strstr($sql, 'SELECT') === false)) {
index 068c1645ee7451e48f1f63c7d8ec975bc52e9098..e0ea2ef7646f00d33338e2ab29246d0561b5dcf0 100644 (file)
@@ -140,9 +140,9 @@ function last_negative_stock_trans_id($stock_id, $to)
                        $negative_trans_id = $myrow['trans_id'];
                }
                if ($qty >= 0)
-                       $flag = 0;      
+                       $flag = 0;
        }
-               
+
        if ($flag == 1)
                return $negative_trans_id;
        else 
@@ -166,29 +166,29 @@ function get_deliveries_between($stock_id, $from, $to)
 function get_deliveries_from_trans($stock_id, $from)
 {
        // -ve qty is delivery either by ST_CUSTDELIVERY or inventory adjustment
-    //Price for GRN and SUPPCREDIT and std_cost for other trans_types\r
-    $sql = "SELECT SUM(-qty), SUM(-qty*IF(type=".ST_SUPPRECEIVE." OR type=".ST_SUPPCREDIT.", price, standard_cost))\r
-        FROM ".TB_PREF."stock_moves\r
-        WHERE stock_id=".db_escape($stock_id)." AND qty < 0 AND\r
+    //Price for GRN and SUPPCREDIT and std_cost for other trans_types
+    $sql = "SELECT SUM(-qty), SUM(-qty*IF(type=".ST_SUPPRECEIVE." OR type=".ST_SUPPCREDIT.", price, standard_cost))
+        FROM ".TB_PREF."stock_moves
+        WHERE stock_id=".db_escape($stock_id)." AND qty < 0 AND
             trans_id>='$from' GROUP BY stock_id";
        $result = db_query($sql, "The deliveries could not be updated");
        $row = db_fetch_row($result);
        
-    $sql = "SELECT IF(type=".ST_SUPPRECEIVE." OR type=".ST_SUPPCREDIT.", price, standard_cost)\r
-        FROM ".TB_PREF."stock_moves\r
-        WHERE stock_id=".db_escape($stock_id)\r
-            ." AND trans_id ='$from'";\r
-    $result = db_query($sql, "The deliveries could not be updated");\r
+    $sql = "SELECT IF(type=".ST_SUPPRECEIVE." OR type=".ST_SUPPCREDIT.", price, standard_cost)
+        FROM ".TB_PREF."stock_moves
+        WHERE stock_id=".db_escape($stock_id)
+            ." AND trans_id ='$from'";
+    $result = db_query($sql, "The deliveries could not be updated");
     $cost = db_fetch_row($result);
-       
+
        // Adjusting QOH valuation 
        $sql = "SELECT SUM(qty) FROM ".TB_PREF."stock_moves
                WHERE stock_id=".db_escape($stock_id)." AND
                        trans_id<'$from' GROUP BY stock_id";
        $result = db_query($sql, "The deliveries could not be updated");
        $qoh = db_fetch_row($result);
-       
-       $qty = $row[0] - $qoh[0]; //QOH prior to -ve stock is subtracted\r
+
+       $qty = $row[0] - $qoh[0]; //QOH prior to -ve stock is subtracted
        $final_cost = $row[1] - $qoh[0]*$cost[0];
        
        return array($qty,$final_cost); 
@@ -234,7 +234,7 @@ function adjust_deliveries($stock_id, $material_cost, $to)
                $new_purchase_cost = $row[0] * $material_cost;
                $purchase_diff = $new_purchase_cost - $old_purchase_cost;
        }
-       
+
        $diff =  $sales_diff - $purchase_diff;
        
        if ($diff != 0)
@@ -271,10 +271,10 @@ function get_stock_gl_code($stock_id)
 }
 
 //-----------------------------------------------------------------------------------------
-\r
+
 function handle_negative_inventory($stock_id, $quantity, $standard_cost, $date_)
 {
-       //If negative adjustment result in negative or zero inventory \r
+       //If negative adjustment result in negative or zero inventory
        //then difference should be adjusted
        $qoh = get_qoh_on_date($stock_id);
 
@@ -381,18 +381,16 @@ function get_stock_moves($type, $type_no, $visible=false)
 
 function void_stock_move($type, $type_no)
 {
-   
     $sql = "SELECT stock_id, standard_cost, loc_code, tran_date, reference, person_id, visible, discount_percent, price, 
        sum(qty) qty FROM ".TB_PREF."stock_moves WHERE type=".db_escape($type)." AND trans_no=".db_escape($type_no)." 
        GROUP BY stock_id, standard_cost, loc_code, tran_date, reference, person_id, visible, discount_percent, price HAVING sum(qty) <> 0";
 
-
     $result = db_query($sql, "Could not void stock moves");
     while ($row = db_fetch($result))
     {
                //Skip cost averaging of service items
                if (is_inventory_item($row["stock_id"]))
-               {        
+               {
                        // The cost has to be adjusted.
                        // Transaction rates are stored either as price or standard_cost depending on types
                        $types = array(ST_SUPPCREDIT, ST_SUPPRECEIVE);
@@ -404,13 +402,13 @@ function void_stock_move($type, $type_no)
                        update_average_material_cost(0, $row["stock_id"],
                                $trans_rate, -$row["qty"], sql2date($row["tran_date"]));
                }
-               
+
                //Post stock move for service items also
         add_stock_move($type, $row["stock_id"], $type_no, $row["loc_code"],
                sql2date($row["tran_date"]), $row["reference"], -$row["qty"]
                        , $row["standard_cost"], $row["person_id"], $row["visible"],
                $row["price"], $row["discount_percent"]);
-    }\r
+    }
 }
 
 //--------------------------------------------------------------------------------------------------
@@ -430,8 +428,3 @@ function get_location_name($loc_code)
 
        display_db_error("could not retreive the location name for $loc_code", $sql, true);
 }
-
-//--------------------------------------------------------------------------------------------------
-
-
-?>
\ No newline at end of file
index 6f9a243299c391f0f2330145773872d6bfc22cda..9b40fa9f887e4c08c2b25f758319463e59d0d12f 100644 (file)
@@ -91,7 +91,7 @@ function error_handler($errno, $errstr, $file, $line) {
 // FIX center is unused now
 function fmt_errors($center=false) {
     global $messages, $path_to_root, $go_debug;
-  
+
   $msg_class = array(
        E_USER_ERROR => 'err_msg',
        E_USER_WARNING =>'warn_msg', 
@@ -117,7 +117,7 @@ function fmt_errors($center=false) {
                                        $content = '';                  // clean other messages
                        }
                }
-               
+
            $str = $msg[1];
                if (!in_array($msg[0], array(E_USER_NOTICE, E_USER_ERROR, E_USER_WARNING)) && $msg[2] != null)
                  $str .= ' '._('in file').': '.$msg[2].' '._('at line ').$msg[3];
index 90bf2071b231bd2f2b059ccd717e38f939624f0e..cd40491b31fa17998cf7efec7653392eec0b1254 100644 (file)
@@ -103,6 +103,7 @@ class hooks {
        function price_in_words($amount, $doc_type)
        {
        }
+
        //
        // Exchange rate currency $curr as on date $date.
        // Keep in mind FA has internally implemented 3 exrate providers
@@ -212,7 +213,7 @@ function install_hooks()
 function activate_hooks($ext, $comp)
 {
        global $Hooks;
-       
+
        $hooks = @$Hooks[$ext];
        if (!$hooks) {
                $hookclass = 'hooks_'.$ext;
@@ -272,7 +273,7 @@ function hook_invoke_first($method, &$data, $opts=null)
 {
 
        global $Hooks;
-       
+
        $result = null;
        foreach($Hooks as $ext => $hook) {
                if (method_exists($hook, $method)) {
index 8f2b3c33d56ea3912b97e3579d6b9488b45c9aa4..98143cf9843626965a97036f555bf0008be2baff 100644 (file)
@@ -22,21 +22,24 @@ include_once($path_to_root . "/includes/db/audit_trail_db.inc");
 include_once($path_to_root . "/admin/db/users_db.inc");
 include_once($path_to_root . "/includes/ui/ui_view.inc");
 include_once($path_to_root . "/includes/ui/ui_controls.inc");
-       
+
+$page_nested = -1;
+
 function page($title, $no_menu=false, $is_index=false, $onload="", $js="", $script_only=false, $css='')
 {
 
-       global $path_to_root, $page_security;
+       global $path_to_root, $page_security, $page_nested;
 
+       if (++$page_nested) return;
 
        $hide_menu = $no_menu;
 
-       include($path_to_root . "/includes/page/header.inc");
+       include_once($path_to_root . "/includes/page/header.inc");
 
        page_header($title, $no_menu, $is_index, $onload, $js, $css);
        check_page_security($page_security);
 //     error_box();
-       if($script_only) {              
+       if($script_only) {
                echo '<noscript>';
                echo display_heading(_('This page is usable only with javascript enabled browsers.'));
                echo '</noscript>';
@@ -48,13 +51,15 @@ function page($title, $no_menu=false, $is_index=false, $onload="", $js="", $scri
 
 function end_page($no_menu=false, $is_index=false, $final_screen=false, $type_no=0, $trans_no=0)
 {
-       global $path_to_root;
+       global $path_to_root, $page_nested;
+
+       if ($page_nested-- > 0) return;
 
        if (!$is_index && function_exists('hyperlink_back'))
                hyperlink_back(true, $no_menu, $type_no, $trans_no, $final_screen);
        div_end();      // end of _page_body section
 
-       include($path_to_root . "/includes/page/footer.inc");
+       include_once($path_to_root . "/includes/page/footer.inc");
        page_footer($no_menu, $is_index);
 }
 
index 16781175b5922cc221d6894594becbb38b77a740..292ccf4402c178b7fe8cd9c1073ca5cebc4de7fc 100644 (file)
@@ -101,8 +101,10 @@ class references
 }
 
 //----------------------------------------------------------------------------
-
-function is_new_reference($ref, $type)
+//
+//     Check if reference was not used so far (for other transaction than $trans_no)
+//
+function is_new_reference($ref, $type, $trans_no=0)
 {
        $db_info = get_systype_db_info($type);
        $db_name = $db_info[0];
index 7cd9d749fe3dcec85b13a5b0f4d43e62fab8f401..98ed4677ccba50aab299aa3e16ae525a76ec968e 100644 (file)
@@ -294,6 +294,8 @@ foreach ($installed_extensions as $ext)
 
 ini_set('session.gc_maxlifetime', 36000); // 10hrs
 
+hook_session_start(@$_POST["company_login_name"]);
+
 $Session_manager = new SessionManager();
 $Session_manager->sessionStart('FA'.md5(dirname(__FILE__)));
 
@@ -317,6 +319,7 @@ $_SESSION['language']->set_language($_SESSION['language']->code);
 include_once($path_to_root . "/includes/access_levels.inc");
 include_once($path_to_root . "/version.php");
 include_once($path_to_root . "/includes/main.inc");
+include_once($path_to_root . "/includes/app_entries.inc");
 
 // Ajax communication object
 $Ajax = new Ajax();
@@ -396,5 +399,3 @@ $SysPrefs = &$_SESSION['SysPrefs'];
 // POST vars cleanup needed for direct reuse.
 // We quote all values later with db_escape() before db update.
 $_POST = strip_quotes($_POST);
-
-?>
\ No newline at end of file
index 1b9f675487d2febb8b50d2172b62d6ceb10ab5ee..7c296ad9632ab1ef910b4884bb44d4bf09d8149e 100644 (file)
@@ -16,7 +16,7 @@
 //
 global $systypes_array, $bank_account_types, $bank_transfer_types, 
        $payment_person_types, $wo_types_array, $wo_cost_types, $class_types,
-       $quick_actions, $quick_entry_types, $stock_types, $tag_types;
+       $quick_actions, $quick_entry_types, $stock_types, $tag_types, $bank_owner;
 
 $systypes_array = array (
        ST_JOURNAL => _("Journal Entry"),
@@ -110,6 +110,7 @@ $wo_types_array = array (
 $wo_cost_types = array(
        WO_LABOUR => _("Labour Cost"),
        WO_OVERHEAD => _("Overhead Cost"),
+       WO_MATERIALS => _("Materials")
 );
 
 //----------------------------------------------------------------------------------
@@ -182,5 +183,17 @@ $pterm_types = array(
        PTT_FOLLOWING => _("Day In Following Month")
 );
 
+$tax_algorithms = array( 
+       TCA_LINES => _("Sum per line taxes"), 
+       TCA_TOTALS => _("Taxes from totals")
+);
+//----------------------------------------------------------------------------------
+
+$bank_owner_types = array(
+       BO_UNKNOWN => _("Unknown"),
+       BO_COMPANY => _("Company"),
+       BO_CUSTBRANCH => _("Customer"),
+       BO_SUPPLIER => _("Supplier")
+);
 
 ?>
\ No newline at end of file
index 710178e4e294fe2dc9bb6f17a0a1d771c38faaa8..46cb9ac512b8063464efba03229bf71b6820c41b 100644 (file)
@@ -229,7 +229,7 @@ function tst_tmpdir()
 function tst_langs($install)
 {
        global $installed_languages, $path_to_root, $GetText;
-       
+
        $test['descr'] = _('Language configuration consistency');
        $test['type'] = 3;
        $test['result'] = true;
index 79ef8be71c01699d87a8daf242fee733ad718fe3..94d5c4e026391ecf95fb7180025e63560fa7167b 100644 (file)
@@ -137,6 +137,79 @@ function payment_person_name($type, $person_id, $full=true) {
        }
 }
 
+//
+//     Returns counterparty (supplier/customer) name for selected transaction.
+//
+function get_counterparty_name($trans_type, $trans_no, $full=true)
+{
+       switch($trans_type)
+       {
+               case ST_SALESORDER:
+               case ST_SALESQUOTE:
+                       $sql = "SELECT order.customer_id as person_id, debtor.name as name
+                       FROM ".TB_PREF."sales_orders order, ".TB_PREF."debtors_master debtor
+                       WHERE order_no=".db_escape($trans_no)." AND trans_type=".db_escape($trans_type)
+                       ." AND order.debtor_no=debtor.debtor_no";
+                       break;
+               case ST_SALESINVOICE :
+               case ST_CUSTCREDIT :
+               case ST_CUSTPAYMENT :
+               case ST_CUSTDELIVERY :
+                       $sql = "SELECT trans.debtor_no as person_id, debtor.name as name
+                       FROM ".TB_PREF."debtor_trans trans, ".TB_PREF."debtors_master debtor
+                       WHERE trans_no=".db_escape($trans_no)." AND type=".db_escape($trans_type)
+                       ." AND trans.debtor_no=debtor.debtor_no";
+                       break;
+
+               case ST_PURCHORDER :
+                       $sql = "SELECT order.supplier_id as person_id, supp.supp_name as name
+                       FROM ".TB_PREF."purch_orders order, ".TB_PREF."suppliers supp
+                       WHERE order_no=".db_escape($trans_no)
+                       ." AND order.supplier_id=supp.supplier_id";
+                       break;
+
+               case ST_SUPPINVOICE :
+               case ST_SUPPCREDIT :
+               case ST_SUPPAYMENT :
+                       $sql = "SELECT trans.supplier_id as person_id, supp.supp_name as name
+                       FROM ".TB_PREF."supp_trans trans, ".TB_PREF."suppliers supp
+                       WHERE trans_no=".db_escape($trans_no)." AND type=".db_escape($trans_type)
+                       ." AND trans.supplier_id=supp.supplier_id";
+                       break;
+
+               case ST_SUPPRECEIVE :
+                       $sql = "SELECT trans.supplier_id as person_id, supp.supp_name as name
+                       FROM ".TB_PREF."grn_batch trans, ".TB_PREF."suppliers supp
+                       WHERE id=".db_escape($trans_no)
+                       ." AND trans.supplier_id=supp.supplier_id";
+                       break;
+
+               case ST_JOURNAL:        // FIXME - this one can have multiply counterparties of various types depending on person_type_id
+
+               default: 
+               /*      // internal operations
+               case ST_WORKORDER :
+               case ST_INVADJUST : // GRN/DN returns ?
+               case ST_BANKTRANSFER :
+               case ST_LOCTRANSFER :
+               case ST_MANUISSUE :
+               case ST_MANURECEIVE :
+               case ST_COSTUPDATE :
+               case ST_BANKPAYMENT :   // generic bank transactions
+               case ST_BANKDEPOSIT :*/
+                       return null;
+       }
+
+       $result = db_query($sql, 'cannot retrieve counterparty name');
+       if (db_num_rows($result))
+       {
+               $row = db_fetch($result);
+               return sprintf("[%05s] %s", $row['person_id'], $row['name']);
+       }
+
+       return '';
+}
+
 function payment_person_has_items($type) {
        switch ($type)
        {
@@ -171,6 +244,7 @@ define('WO_ADVANCED', 2);
 
 define('WO_LABOUR', 0);
 define('WO_OVERHEAD', 1);
+define('WO_MATERIALS', 2);
 
 //----------------------------------------------------------------------------------
 //     GL account classes
@@ -226,6 +300,19 @@ define('PTT_CASH', 2);
 define('PTT_DAYS', 3);
 define('PTT_FOLLOWING', 4);
 
+//----------------------------------------------------------------------------------
+// Tax calculation algorithms used in als and purchase (depends on supplier's invoicing software)
+
+define('TCA_TOTALS', 1); // taxes are calculated from respective net totals for all lines
+define('TCA_LINES', 2); // taxes calculated for every line, then summed
+//
+//     Bank account owner types
+//
+define('BO_UNKNOWN', 0);
+define('BO_COMPANY', 1);
+define('BO_CUSTBRANCH', 2);
+define('BO_SUPPLIER', 3);
+
 include_once($path_to_root . '/includes/sysnames.inc');
 
 ?>
\ No newline at end of file
index a5e15fdbf4a524d1c7ded60d06f48ed4b6a75372..25101807d61c6b26b04448e5ce2a7b3b1e871edc 100644 (file)
@@ -26,7 +26,6 @@ class items_cart
        var $transfer_type;
        var $increase;
        var $memo_;
-       var $person_id;
        var $branch_id;
        var $reference;
        var $original_amount;
@@ -95,12 +94,12 @@ class items_cart
 
        // ----------- GL item functions
 
-       function add_gl_item($code_id, $dimension_id, $dimension2_id, $amount, $reference, $description=null)
+       function add_gl_item($code_id, $dimension_id, $dimension2_id, $amount, $reference, $description=null, $person_id=null)
        {
                if (isset($code_id) && $code_id != "" && isset($amount) && isset($dimension_id)  &&
                        isset($dimension2_id))
                {
-                       $this->gl_items[] = new gl_item($code_id, $dimension_id, $dimension2_id, $amount, $reference, $description);
+                       $this->gl_items[] = new gl_item($code_id, $dimension_id, $dimension2_id, $amount, $reference, $description, $person_id);
                        return true;
                }
                else
@@ -112,9 +111,20 @@ class items_cart
                return false;
        }
 
-       function update_gl_item($index, $code_id, $dimension_id, $dimension2_id, $amount, $reference, $description=null)
+       function update_gl_item($index, $code_id, $dimension_id, $dimension2_id, $amount, $reference, $description=null, $person_id=null)
        {
            $this->gl_items[$index]->code_id = $code_id;
+           $this->gl_items[$index]->person_id = $person_id;
+
+               $gl_type = is_subledger_account($code_id, $person_id);
+               if ($gl_type)
+               {
+                       $this->gl_items[$index]->person_type_id = $gl_type > 0 ? PT_CUSTOMER : PT_SUPPLIER;
+                       $this->gl_items[$index]->person_name = get_subaccount_name($code_id, $person_id);
+               } else
+               {
+                       $this->gl_items[$index]->person_type_id = $this->gl_items[$index]->person_name = '';
+               }
                $this->gl_items[$index]->dimension_id = $dimension_id;
                $this->gl_items[$index]->dimension2_id = $dimension2_id;
                $this->gl_items[$index]->amount = $amount;
@@ -177,6 +187,18 @@ class items_cart
                $this->gl_items = array();
 
        }
+       //
+       //      Check if cart contains virtual subaccount (AP/AR) postings
+       //
+       function has_sub_accounts()
+       {
+               foreach ($this->gl_items as $gl_item)
+               {
+                       if ($gl_item->person_id)
+                               return true;
+               }
+               return false;
+       }
 }
 
 //--------------------------------------------------------------------------------------------
@@ -256,9 +278,12 @@ class gl_item
        var $amount;
        var $reference;
        var $description;
+       var $person_id;
+       var $person_type_id;
+       var $person_name;
 
        function gl_item($code_id, $dimension_id, $dimension2_id, $amount, $reference,
-               $description=null)
+               $description=null, $person_id=null)
        {
                //echo "adding $index, $code_id, $dimension_id, $amount, $reference<br>";
 
@@ -268,6 +293,13 @@ class gl_item
                        $this->description = $description;
 
                $this->code_id = $code_id;
+               $this->person_id = $person_id;
+               $gl_type = is_subledger_account($code_id, $person_id);
+               if ($gl_type)
+               {
+                       $this->person_type_id = $gl_type > 0 ? PT_CUSTOMER : PT_SUPPLIER;
+                       $this->person_name = get_subaccount_name($code_id, $person_id);
+               }
                $this->dimension_id = $dimension_id;
                $this->dimension2_id = $dimension2_id;
                $this->amount = $amount;
index bbe4c7f5142f3680055589e48ecbe906daaca390..0639124a5a236a4f6170ca70b57c0c7a5b637dd8 100644 (file)
@@ -32,10 +32,15 @@ function get_post($name, $dflt='')
                                ((!isset($_POST[$name]) || $_POST[$name] === '') ? $dflt : $_POST[$name]);
 }
 //---------------------------------------------------------------------------------
+$form_nested = -1;
 
 function start_form($multi=false, $dummy=false, $action="", $name="")
 {
        // $dummy - leaved for compatibility with 2.0 API
+       global $form_nested;
+
+       if (++$form_nested) return;
+
 
        if ($name != "")
                $name = "name='$name'";
@@ -53,7 +58,9 @@ function start_form($multi=false, $dummy=false, $action="", $name="")
 
 function end_form($breaks=0)
 {
-       global $Ajax;
+       global $Ajax, $form_nested;
+
+       if ($form_nested-- > 0) return;
 
        $_SESSION['csrf_token'] = hash('sha256', uniqid(mt_rand(), true));
        if ($breaks)
@@ -470,7 +477,7 @@ function set_editor($type, $input, $caller=true)
 
        $Editors[$key] = array( $path_to_root . $popup_editors[$type][0], $input, 
                $popup_editors[$type][3], $popup_editors[$type][4]);
-       
+
        $help = 'F' . ($key - 111) . ' - ';
        $help .= $popup_editors[$type][2];
        $Pagehelp[] = $help;
index 1b3eec45e6dee0323796f4b02e1b91c48563f488..e252c8b136165c079853fe5816aed1df221267ac 100644 (file)
@@ -113,6 +113,7 @@ function hidden($name, $value=null, $echo=true)
                'cancel'  - cancel form entry on Escape press; dflt ICON_CANCEL
                'process' - displays progress bar during call; optional icon
                'nonajax' - ditto, non-ajax submit
+
        $atype can contain also multiply type selectors separated by space, 
        however make sense only combination of 'process' and one of defualt/selector/cancel
 */
@@ -937,10 +938,30 @@ function supplier_credit_row($supplier, $credit, $parms='')
                ."</a>", $parms);
 }
 
+/*
+       Edit transaction link to be used in transaction inquires
+*/
+function edit_trans_link($trans_type, $trans_no, $url='')
+{
+       global $path_to_root, $trans_editors;
+
+       if (!$url) $url = @$trans_editors[$trans_type];
+
+       if (!$trans_no || !$url)
+               return '';
+
+       if (is_closed_trans($trans_type, $trans_no)) {
+               return set_icon(ICON_CLOSED, _('Closed'));
+       } else {
+               $link_text = user_graphic_links() ? set_icon(ICON_EDIT, _('Edit')) : _('Edit');
+               return "<a href='".$path_to_root . sprintf($url, $trans_no, $trans_type)."'>$link_text</a>";
+       }
+}
+
 function bank_balance_row($bank_acc, $parms='')
 {
        global $path_to_root;
-       
+
        $to = add_days(Today(), 1);
        $bal = get_balance_before_for_bank_account($bank_acc, $to);
        label_row( _("Bank Balance:"),
index 91722536b7931b3aab1c842d41f7df768bb0f215..e85e38995f574d4fd02638a162020c8f5a9ae41c 100644 (file)
@@ -443,7 +443,7 @@ function supplier_list($name, $selected_id=null, $spec_option=false, $submit_on_
 
        if ($editkey)
                set_editor('supplier', $name, $editkey);
-               
+
        $ret = combo_input($name, $selected_id, $sql, 'supplier_id', 'supp_name',
        array(
                'format' => '_format_add_curr',
@@ -529,7 +529,6 @@ function customer_list_cells($label, $name, $selected_id=null, $all_option=false
 function customer_list_row($label, $name, $selected_id=null, $all_option = false, 
        $submit_on_change=false, $show_inactive=false, $editkey = false)
 {
-       global $path_to_root;
 
        echo "<tr><td class='label'>$label</td><td nowrap>";
        echo customer_list($name, $selected_id, $all_option, $submit_on_change,
@@ -563,7 +562,7 @@ function customer_branches_list($customer_id, $name, $selected_id=null,
        if ($editkey)
        {
                $ret .= add_edit_combo('branch');
-       }       
+       }
        return $ret;
 }
 //------------------------------------------------------------------------------------------------
@@ -761,9 +760,8 @@ function stock_items_list($name, $selected_id=null, $all_option=false,
                'order' => array('c.description','stock_id')
          ), $opts) );
        if ($editkey)
-               $ret .= add_edit_combo('item');         
+               $ret .= add_edit_combo('item');
        return $ret;
-         
 }
 
 function _format_stock_items($row)
@@ -1439,8 +1437,10 @@ function bank_accounts_list_row($label, $name, $selected_id=null, $submit_on_cha
 }
 //-----------------------------------------------------------------------------------------------
 
-function cash_accounts_list_row($label, $name, $selected_id=null, $submit_on_change=false)
+function cash_accounts_list_row($label, $name, $selected_id=null, $submit_on_change=false, $all_option=false)
 {
+       global $all_items;
+
        $sql = "SELECT ".TB_PREF."bank_accounts.id, bank_account_name, bank_curr_code, inactive
                FROM ".TB_PREF."bank_accounts
                WHERE ".TB_PREF."bank_accounts.account_type=".BT_CASH;
@@ -1450,6 +1450,8 @@ function cash_accounts_list_row($label, $name, $selected_id=null, $submit_on_cha
        echo "<td>";
        echo combo_input($name, $selected_id, $sql, 'id', 'bank_account_name',
        array(
+               'spec_option' => $all_option,
+               'spec_id' => $all_items,
                'format' => '_format_add_curr',
                'select_submit'=> $submit_on_change,
                'async' => true
@@ -2372,4 +2374,78 @@ function payment_services($name)
                ));
 }
 
-?>
+function tax_algorithm_list($name, $value=null, $submit_on_change = false)
+{
+       global $tax_algorithms;
+       
+       return array_selector($name, $value, $tax_algorithms, 
+               array( 
+                       'select_submit'=> $submit_on_change,
+                       'async' => true,
+                       )
+       );
+}
+
+function tax_algorithm_list_cells($label, $name, $value=null, $submit_on_change=false)
+{
+       if ($label != null)
+               echo "<td>$label</td>\n";
+       echo "<td>";
+       echo tax_algorithm_list($name, $value, $submit_on_change);
+       echo "</td>\n";
+}
+
+function tax_algorithm_list_row($label, $name, $value=null, $submit_on_change=false)
+{
+       echo "<tr><td class='label'>$label</td>";
+       tax_algorithm_list_cells(null, $name, $value, $submit_on_change);
+       echo "</tr>\n";
+}
+//----------------------------------------------------------------------------------------------
+
+function subledger_list($name, $account, $selected_id=null)
+{
+       global $all_items;
+
+       $type = is_subledger_account($account);
+       if (!$type)
+               return '';
+
+       if($type > 0)
+               $sql = "SELECT DISTINCT d.debtor_no as id, debtor_ref as name 
+               FROM "
+               .TB_PREF."debtors_master d,"
+               .TB_PREF."cust_branch c
+               WHERE d.debtor_no=c.debtor_no AND c.receivables_account=".db_escape($account);
+       else
+               $sql = "SELECT supplier_id as id, supp_ref as name 
+               FROM "
+               .TB_PREF."suppliers s
+               WHERE s.payable_account=".db_escape($account);
+
+       $mode = get_company_pref('no_customer_list');
+
+       return combo_input($name, $selected_id, $sql, 'id', 'name',
+       array(
+               'type' => 1,
+               'size' => 20,
+               'async' => false,
+       ) );
+}
+
+function subledger_list_cells($label, $name, $account, $selected_id=null)
+{
+       if ($label != null)
+               echo "<td>$label</td>\n";
+       echo "<td nowrap>";
+       echo subledger_list($name, $account, $selected_id);
+       echo "</td>\n";
+}
+
+function subledger_list_row($label, $name, $selected_id=null, $all_option = false, 
+       $submit_on_change=false, $show_inactive=false, $editkey = false)
+{
+       echo "<tr><td class='label'>$label</td><td nowrap>";
+       echo subledger_list($name, $account, $selected_id);
+       echo "</td>\n</tr>\n";
+}
index e366af368f085e0aee7051d550782f4ae24bb8ec..938f0a33768292029ec17229134f21c74b218268 100644 (file)
@@ -50,11 +50,11 @@ function get_gl_view_str($type, $trans_no, $label="", $force=false, $class='', $
        {
                $label = _("GL");
                $icon = ICON_GL;
-       }       
+       }
+       $url = ($type == ST_WORKORDER && !work_order_is_closed($trans_no)) ? "manufacturing/view/wo_costs_view.php?trans_no=$trans_no"
+               : "gl/view/gl_trans_view.php?type_id=$type&trans_no=$trans_no";
 
-       return viewer_link($label, 
-               "gl/view/gl_trans_view.php?type_id=$type&trans_no=$trans_no", 
-               $class, $id, $icon);
+       return viewer_link($label, $url, $class, $id, $icon);
 }
 
 //--------------------------------------------------------------------------------------
@@ -586,9 +586,9 @@ function display_quick_entries(&$cart, $id, $base, $type, $descr='')
                                        $begin = "";
                                else
                                        $begin = begin_fiscalyear(); // from fiscalyear begin
-                       }               
+                       }
                        $base = get_gl_trans_from_to($begin, $cart->tran_date, $qe['base_desc']);
-                               
+
                }
                if ($descr != '') $qe['description'] .= ': '.$descr;
                $result = get_quick_entry_lines($id);
@@ -597,7 +597,7 @@ function display_quick_entries(&$cart, $id, $base, $type, $descr='')
                        display_error( _("No Quick Entry lines are defined."));
                        set_focus('totamount');
                        return 0;
-               }       
+               }
                $totrate = 0;
                while ($row = db_fetch($result))
                {
@@ -782,7 +782,7 @@ function price_in_words($amount, $document=0)
     else
        $frac = "";
     return _number_to_words(intval($amount)) . $frac;
-}    
+}
 
 function get_js_open_window($width, $height)
 {
@@ -1344,5 +1344,3 @@ function payment_link($name, $options)
 
        return strtr($link, $patterns);
 }
-
-?>
\ No newline at end of file
index e4df8d03fd17383d221467a8f0aa8296037a7212..5f646539fdf3778f610abada884d9191af9f978e 100644 (file)
@@ -5,10 +5,10 @@
 #
 msgid ""
 msgstr ""
-"Project-Id-Version: PACKAGE TEAM\n"
+"Project-Id-Version: PACKAGE VERSION\n"
 "Report-Msgid-Bugs-To: \n"
-"POT-Creation-Date: 2011-03-31 10:54+0200\n"
-"PO-Revision-Date: 2011-03-31 19:30+0100\n"
+"POT-Creation-Date: 2010-08-08 12:50+0200\n"
+"PO-Revision-Date: 2010-08-13 09:13+0100\n"
 "Last-Translator: Translation Team <info@frontaccounting.net>\n"
 "Language-Team: infotechaccountants.com <hameed@infotechaccountants.com>\n"
 "MIME-Version: 1.0\n"
@@ -16,485 +16,449 @@ msgstr ""
 "Content-Transfer-Encoding: 8bit\n"
 "X-Poedit-Language: Arabic\n"
 "X-Poedit-Country: EGYPT\n"
-"X-Poedit-SourceCharset: iso-8859-1\n"
 
-#: install/index.php:20
-#: install/index.php:40
+#: /var/www/fa2.3/devel/../install/index.php:20
+#: /var/www/fa2.3/devel/../install/index.php:40
 msgid "FrontAccouting ERP Installation Wizard"
 msgstr "معالج التثبيت الخاص بالحل المالي لإدارة موارد المؤسسات \"FrontAccounting\""
 
-#: install/index.php:41
+#: /var/www/fa2.3/devel/../install/index.php:41
 #, php-format
 msgid "Step %d: %s"
 msgstr "الخطوة %d: %s "
 
-#: install/index.php:48
+#: /var/www/fa2.3/devel/../install/index.php:48
 msgid "Chart of accounts"
 msgstr "خريطة الحسابات"
 
-#: install/index.php:48
-#: install/index.php:75
+#: /var/www/fa2.3/devel/../install/index.php:48
+#: /var/www/fa2.3/devel/../install/index.php:75
 msgid "Encoding"
 msgstr "الترميز"
 
-#: install/index.php:48
-#: install/index.php:75
+#: /var/www/fa2.3/devel/../install/index.php:48
+#: /var/www/fa2.3/devel/../install/index.php:75
 msgid "Description"
 msgstr "الوصف"
 
-#: install/index.php:48
-#: install/index.php:75
+#: /var/www/fa2.3/devel/../install/index.php:48
+#: /var/www/fa2.3/devel/../install/index.php:75
 msgid "Install"
 msgstr "التثبيت"
 
-#: install/index.php:65
-#: install/index.php:93
+#: /var/www/fa2.3/devel/../install/index.php:65
+#: /var/www/fa2.3/devel/../install/index.php:93
 msgid "Installed"
 msgstr "تم تثبيته"
 
-#: install/index.php:75
+#: /var/www/fa2.3/devel/../install/index.php:75
 msgid "Language"
 msgstr "اللغة"
 
-#: install/index.php:123
-msgid "Cannot connect to database. User or password is invalid or you have no permittions to create database."
-msgstr ""
-
-#: install/index.php:159
+#: /var/www/fa2.3/devel/../install/index.php:156
 msgid "Cannot save system configuration file 'config.php'."
 msgstr "لا يمكن حفظ ملف التوصيف الخاص بالنظام  'config.php'"
 
-#: install/index.php:166
+#: /var/www/fa2.3/devel/../install/index.php:173
 msgid "Cannot open 'config_db.php' configuration file."
 msgstr "لا يمكن فتح ملف التوصيف 'config_db.php'"
 
-#: install/index.php:169
+#: /var/www/fa2.3/devel/../install/index.php:176
 msgid "Cannot write to the 'config_db.php' configuration file."
 msgstr "لا يمكن الكتابة على ملف التوصيف 'config_db.php'"
 
-#: install/index.php:172
+#: /var/www/fa2.3/devel/../install/index.php:179
 msgid "Configuration file 'config_db.php' is not writable. Change its permissions so it is, then re-run installation step."
 msgstr "ملف التوصيف 'config_db.php' غير قابل للكتابة ، الرجاء تغيير صلاحيات الأستخدام و بعد ذلك أعد تشغيل خطوة التثبيت مرة أخرى"
 
-#: install/index.php:211
+#: /var/www/fa2.3/devel/../install/index.php:217
 msgid "Host name cannot be empty."
 msgstr "أسم المضيف لا يمكن تركه فارغاً "
 
-#: install/index.php:215
+#: /var/www/fa2.3/devel/../install/index.php:221
 msgid "Database user name cannot be empty."
 msgstr "أسم مستخدم قاعدة البيانات لا يمكن تركه فارغاً"
 
-#: install/index.php:219
+#: /var/www/fa2.3/devel/../install/index.php:225
 msgid "Database name cannot be empty."
 msgstr "لا يمكن ترك أسم قاعدة البيانات فارغاً"
 
-#: install/index.php:272
+#: /var/www/fa2.3/devel/../install/index.php:277
 msgid "Company name cannot be empty."
 msgstr "لا يمكن ترك أسم الشركة فارغاً"
 
-#: install/index.php:276
+#: /var/www/fa2.3/devel/../install/index.php:281
 msgid "Company admin name cannot be empty."
 msgstr "لا يمكن ترك أسم مدير النظام فارغاً"
 
-#: install/index.php:280
+#: /var/www/fa2.3/devel/../install/index.php:285
 msgid "Company admin password cannot be empty."
 msgstr "لا يمكن ترك كلمة مرور مدير النظام فارغاً"
 
-#: install/index.php:284
+#: /var/www/fa2.3/devel/../install/index.php:289
 msgid "Company admin passwords differ."
 msgstr "كلمات مرور مدير النظام مختلفة"
 
-#: install/index.php:316
+#: /var/www/fa2.3/devel/../install/index.php:320
 msgid "System Diagnostics"
 msgstr "تشخيص النظام"
 
-#: install/index.php:318
+#: /var/www/fa2.3/devel/../install/index.php:323
 msgid "Select install wizard language:"
 msgstr "أختيار لغة معالج التثبيت"
 
-#: install/index.php:324
+#: /var/www/fa2.3/devel/../install/index.php:329
 msgid "All application preliminary requirements seems to be correct. Please press Continue button below."
 msgstr "جميع المتطلبات التمهيدية الخاصة بالتطبيق تبدو صحيحة ، الرجاء الضغط على زر الأستمرار في الأسفل"
 
-#: install/index.php:325
-#: install/index.php:351
-#: install/index.php:358
-#: install/index.php:365
-#: install/index.php:384
+#: /var/www/fa2.3/devel/../install/index.php:330
+#: /var/www/fa2.3/devel/../install/index.php:356
+#: /var/www/fa2.3/devel/../install/index.php:363
+#: /var/www/fa2.3/devel/../install/index.php:370
+#: /var/www/fa2.3/devel/../install/index.php:389
 msgid "Continue >>"
 msgstr "<< الاستمرار"
 
-#: install/index.php:327
+#: /var/www/fa2.3/devel/../install/index.php:332
 msgid "Application cannot be installed. Please fix problems listed below in red, and press Refresh button."
 msgstr "لا يمكن تثبيت التطبيق ، الرجاء إصلاح المشاكل الملونة باللون الأحمر و المدرجة بالأسف ثم الضغط على زر التنشيط"
 
-#: install/index.php:328
+#: /var/www/fa2.3/devel/../install/index.php:333
 msgid "Refresh"
 msgstr "تنشيط"
 
-#: install/index.php:338
+#: /var/www/fa2.3/devel/../install/index.php:343
 msgid "Database Server Settings"
 msgstr "إعدادات خادم قاعدة البيانات"
 
-#: install/index.php:340
+#: /var/www/fa2.3/devel/../install/index.php:345
 msgid "Server Host:"
 msgstr "الخادم المستضيف :"
 
-#: install/index.php:341
+#: /var/www/fa2.3/devel/../install/index.php:346
 msgid "Database User:"
 msgstr "مستخدم قاعدة البيانات:"
 
-#: install/index.php:342
+#: /var/www/fa2.3/devel/../install/index.php:347
 msgid "Database Password:"
 msgstr "كلمة مرور قاعدة البيانات:"
 
-#: install/index.php:343
+#: /var/www/fa2.3/devel/../install/index.php:348
 msgid "Database Name:"
 msgstr "أسم قاعدة البيانات:"
 
-#: install/index.php:344
+#: /var/www/fa2.3/devel/../install/index.php:349
 msgid "Use '0_' Table Prefix:"
 msgstr "استخدام '0_' كبادئة جدول"
 
-#: install/index.php:344
-#: includes/system_tests.inc:38
-#: includes/system_tests.inc:113
-#: includes/system_tests.inc:126
+#: /var/www/fa2.3/devel/../install/index.php:349
+#: /var/www/fa2.3/devel/../includes/system_tests.inc:38
+#: /var/www/fa2.3/devel/../includes/system_tests.inc:113
+#: /var/www/fa2.3/devel/../includes/system_tests.inc:126
 msgid "Yes"
 msgstr "نعم"
 
-#: install/index.php:344
-#: includes/system_tests.inc:38
-#: includes/system_tests.inc:113
-#: includes/system_tests.inc:126
+#: /var/www/fa2.3/devel/../install/index.php:349
+#: /var/www/fa2.3/devel/../includes/system_tests.inc:38
+#: /var/www/fa2.3/devel/../includes/system_tests.inc:113
+#: /var/www/fa2.3/devel/../includes/system_tests.inc:126
 msgid "No"
 msgstr "لا"
 
-#: install/index.php:345
+#: /var/www/fa2.3/devel/../install/index.php:350
 msgid "Install Additional Language Packs from FA Repository:"
 msgstr "تثبيت حزم لغات إضافية من مستودع التطبيق :"
 
-#: install/index.php:346
+#: /var/www/fa2.3/devel/../install/index.php:351
 msgid "Install Additional COAs from FA Repository:"
 msgstr "تثبيت خرائط حسابات أضافية من مستودع التطبيق :"
 
-#: install/index.php:348
+#: /var/www/fa2.3/devel/../install/index.php:353
 msgid "Use table prefix if you share selected database for more than one FA company."
 msgstr "أستخدم بادئة جدول إذا كنت تريد أن تحتوي قاعدة البيانات الواحدة على أكثر من شركة واحدة"
 
-#: install/index.php:349
+#: /var/www/fa2.3/devel/../install/index.php:354
 msgid "Do not select additional langs nor COAs if you have no working internet connection right now. You can install them later."
 msgstr "لا تختار لغات إضافية أو خرائط حسابات إضافية إذا لم يكن لديك الآن توصيلة أنترنت تعمل بكفاءة ، يمكنك أن تثبت اللغات و خرائط الحسابات في وقت لاحق"
 
-#: install/index.php:350
-#: install/index.php:357
-#: install/index.php:364
-#: install/index.php:383
+#: /var/www/fa2.3/devel/../install/index.php:355
+#: /var/www/fa2.3/devel/../install/index.php:362
+#: /var/www/fa2.3/devel/../install/index.php:369
+#: /var/www/fa2.3/devel/../install/index.php:388
 msgid "<< Back"
 msgstr "للخلف >>"
 
-#: install/index.php:355
+#: /var/www/fa2.3/devel/../install/index.php:360
 msgid "User Interface Languages Selection"
 msgstr "اختيار لغات واجهة المستخدم"
 
-#: install/index.php:362
+#: /var/www/fa2.3/devel/../install/index.php:367
 msgid "Charts of Accounts Selection"
 msgstr "أختيار خرائط الحسابات"
 
-#: install/index.php:374
+#: /var/www/fa2.3/devel/../install/index.php:379
 msgid "Company Settings"
 msgstr "إعدادات الشركة"
 
-#: install/index.php:376
+#: /var/www/fa2.3/devel/../install/index.php:381
 msgid "Company Name:"
 msgstr "أسم الشركة :"
 
-#: install/index.php:377
+#: /var/www/fa2.3/devel/../install/index.php:382
 msgid "Admin Login:"
 msgstr "أسم الدخول لمدير النظام :"
 
-#: install/index.php:378
+#: /var/www/fa2.3/devel/../install/index.php:383
 msgid "Admin Password:"
 msgstr "كلمة مرور مدير النظام :"
 
-#: install/index.php:379
+#: /var/www/fa2.3/devel/../install/index.php:384
 msgid "Reenter Password:"
 msgstr "إعادة أدخال كلمة المرور :"
 
-#: install/index.php:380
+#: /var/www/fa2.3/devel/../install/index.php:385
 msgid "Select Chart of Accounts:"
 msgstr "اختيار خريطة الحسابات :"
 
-#: install/index.php:381
+#: /var/www/fa2.3/devel/../install/index.php:386
 msgid "Select Default Language:"
 msgstr "اختيار اللغة الأفتراضية :"
 
-#: install/index.php:388
+#: /var/www/fa2.3/devel/../install/index.php:393
 msgid "FrontAccounting ERP has been installed successsfully."
 msgstr "تمت عملية تثبيت FrontAccounting ERP بنجاح"
 
-#: install/index.php:389
+#: /var/www/fa2.3/devel/../install/index.php:394
 msgid "Please do not forget to remove install wizard folder."
 msgstr "الرجاء لا تنسى أن تزيل مجلد معالج التثبيت"
 
-#: install/index.php:392
+#: /var/www/fa2.3/devel/../install/index.php:396
 msgid "Click here to start."
 msgstr "الضغط هنا للبدء"
 
-#: includes/system_tests.inc:15
+#: /var/www/fa2.3/devel/../includes/system_tests.inc:15
 msgid "Info"
 msgstr "معلومات"
 
-#: includes/system_tests.inc:16
+#: /var/www/fa2.3/devel/../includes/system_tests.inc:16
 msgid "Optional"
 msgstr "اختياري"
 
-#: includes/system_tests.inc:17
+#: /var/www/fa2.3/devel/../includes/system_tests.inc:17
 msgid "Recommended"
 msgstr "يوصى به"
 
-#: includes/system_tests.inc:18
+#: /var/www/fa2.3/devel/../includes/system_tests.inc:18
 msgid "Required "
 msgstr "مطلوب"
 
-#: includes/system_tests.inc:24
+#: /var/www/fa2.3/devel/../includes/system_tests.inc:24
 msgid "MySQL version"
 msgstr "إصدار MySQL"
 
-#: includes/system_tests.inc:28
+#: /var/www/fa2.3/devel/../includes/system_tests.inc:28
 msgid "Upgrade MySQL server to version at least 4.1"
 msgstr "ترقية خادم MySQL إلى الإصدار 4.1 على الأقل"
 
-#: includes/system_tests.inc:35
+#: /var/www/fa2.3/devel/../includes/system_tests.inc:35
 msgid "PHP MySQL extension"
 msgstr "رابط برمجي بين PHP و MySQL"
 
-#: includes/system_tests.inc:40
+#: /var/www/fa2.3/devel/../includes/system_tests.inc:40
 msgid "Your PHP has to have MySQL extension enabled."
 msgstr "الـ PHP الخاص بك يجب أن يحتوي على رابط برمجي لـ MySQL مفعل"
 
-#: includes/system_tests.inc:46
+#: /var/www/fa2.3/devel/../includes/system_tests.inc:46
 msgid "PHP version"
 msgstr "إصدار PHP"
 
-#: includes/system_tests.inc:50
+#: /var/www/fa2.3/devel/../includes/system_tests.inc:50
 msgid "Upgrade PHP to version at least 4.3.3"
 msgstr "ترقية PHP إلى الإصدار رقم 4.3.3 على الأقل"
 
-#: includes/system_tests.inc:57
+#: /var/www/fa2.3/devel/../includes/system_tests.inc:57
 msgid "Server system"
 msgstr "نظام الخادم"
 
-#: includes/system_tests.inc:67
+#: /var/www/fa2.3/devel/../includes/system_tests.inc:67
 msgid "Session save path"
 msgstr "مسار حفظ جلسة الأستخدام"
 
-#: includes/system_tests.inc:79
+#: /var/www/fa2.3/devel/../includes/system_tests.inc:79
 msgid "Removed install wizard folder"
 msgstr "مجلد معالج التثبيت الذي تمت إزالته"
 
-#: includes/system_tests.inc:82
+#: /var/www/fa2.3/devel/../includes/system_tests.inc:82
 msgid "Not removed"
 msgstr "لم يتم إزالته"
 
-#: includes/system_tests.inc:83
+#: /var/www/fa2.3/devel/../includes/system_tests.inc:83
 msgid "Remove or rename install wizard folder for security reasons."
 msgstr "قم بإزالة أو قم بإعادة تسمية مجلد معالج التثبيت و ذلك لأسباب أمنية"
 
-#: includes/system_tests.inc:90
+#: /var/www/fa2.3/devel/../includes/system_tests.inc:90
 msgid "Browser type"
 msgstr "نوع المتصفح"
 
-#: includes/system_tests.inc:94
+#: /var/www/fa2.3/devel/../includes/system_tests.inc:94
 msgid "Any browser is supported"
 msgstr "أي مستصفح تم دعمه"
 
-#: includes/system_tests.inc:101
+#: /var/www/fa2.3/devel/../includes/system_tests.inc:101
 msgid "Http server type"
 msgstr "نوع خادم Http"
 
-#: includes/system_tests.inc:105
+#: /var/www/fa2.3/devel/../includes/system_tests.inc:105
 msgid "Any server is supported"
 msgstr "أي خادم تم دعمه"
 
-#: includes/system_tests.inc:112
+#: /var/www/fa2.3/devel/../includes/system_tests.inc:112
 msgid "Native gettext"
 msgstr "جيتيكس الطبيعية"
 
-#: includes/system_tests.inc:116
+#: /var/www/fa2.3/devel/../includes/system_tests.inc:116
 msgid "In case of no gettext support, php emulation is used"
 msgstr "في حالة عدم دعم جيتيكس ، فإن محاكي PHP سوف يستخدم "
 
-#: includes/system_tests.inc:124
+#: /var/www/fa2.3/devel/../includes/system_tests.inc:124
 msgid "Debugging mode"
 msgstr "بيئة تصحيح الأخطاء"
 
-#: includes/system_tests.inc:128
+#: /var/www/fa2.3/devel/../includes/system_tests.inc:128
 msgid "To switch debugging on set $go_debug>0 in config.php file"
 msgstr "لتفعيل بيئة تصحيح الأخطاء يجب أن يتم ضبط $go_debug>0 في الملف config.php"
 
-#: includes/system_tests.inc:137
+#: /var/www/fa2.3/devel/../includes/system_tests.inc:137
 msgid "Error logging"
 msgstr "سجل وقائع الأخطاء"
 
-#: includes/system_tests.inc:145
+#: /var/www/fa2.3/devel/../includes/system_tests.inc:145
 msgid "Disabled"
 msgstr "غير مفعل"
 
-#: includes/system_tests.inc:148
+#: /var/www/fa2.3/devel/../includes/system_tests.inc:148
 msgid "To switch error logging set $error_logging in config.php file"
 msgstr "لتفعيل سجل وقائع الأخطاء يجب أن يتم ضبط $error_logging في ملف config.php"
 
-#: includes/system_tests.inc:151
+#: /var/www/fa2.3/devel/../includes/system_tests.inc:151
 msgid "Log file is not writeable"
 msgstr "ملف سجل الوقائع غير قابل للكتابة عليه"
 
-#: includes/system_tests.inc:161
+#: /var/www/fa2.3/devel/../includes/system_tests.inc:161
 msgid "Current database version"
 msgstr "إصدار قاعدة البيانات الحالي"
 
-#: includes/system_tests.inc:165
+#: /var/www/fa2.3/devel/../includes/system_tests.inc:165
 msgid "Database structure seems to be not upgraded to current version"
 msgstr "يبدو أن هيكل قاعدة البيانات لم تتم ترقيته إلى الإصدار الحالي"
 
-#: includes/system_tests.inc:180
+#: /var/www/fa2.3/devel/../includes/system_tests.inc:180
 msgid "Company subdirectories consistency"
 msgstr "اتساق الفهارس الفرعية للشركة"
 
-#: includes/system_tests.inc:193
-#: includes/system_tests.inc:200
-#: includes/system_tests.inc:208
-#: includes/system_tests.inc:225
-#: includes/system_tests.inc:340
-#: includes/system_tests.inc:349
-#: includes/system_tests.inc:358
+#: /var/www/fa2.3/devel/../includes/system_tests.inc:193
+#: /var/www/fa2.3/devel/../includes/system_tests.inc:200
+#: /var/www/fa2.3/devel/../includes/system_tests.inc:208
+#: /var/www/fa2.3/devel/../includes/system_tests.inc:225
+#: /var/www/fa2.3/devel/../includes/system_tests.inc:345
 #, php-format
 msgid "'%s' is not writeable"
 msgstr "'%s' غير قابل للكتابة عليه"
 
-#: includes/system_tests.inc:221
+#: /var/www/fa2.3/devel/../includes/system_tests.inc:221
 msgid "Temporary directory"
 msgstr "الفهرس المؤقت"
 
-#: includes/system_tests.inc:233
+#: /var/www/fa2.3/devel/../includes/system_tests.inc:233
 msgid "Language configuration consistency"
 msgstr "اتساق توصيف اللغة"
 
-#: includes/system_tests.inc:242
+#: /var/www/fa2.3/devel/../includes/system_tests.inc:242
 msgid "Languages folder should be writeable."
 msgstr "مجلد اللغات يجب أن يكون قابل للكتابة عليه"
 
-#: includes/system_tests.inc:251
+#: /var/www/fa2.3/devel/../includes/system_tests.inc:250
 msgid "Languages configuration file should be writeable."
 msgstr "ملف توصيف اللغات يجب أن يكون قابل للكتابة عليه"
 
-#: includes/system_tests.inc:270
+#: /var/www/fa2.3/devel/../includes/system_tests.inc:268
 #, php-format
 msgid "Missing %s translation file."
 msgstr "ملف الترجمة %s مفقود"
 
-#: includes/system_tests.inc:275
+#: /var/www/fa2.3/devel/../includes/system_tests.inc:273
 #, php-format
 msgid "Missing system locale: %s"
 msgstr "مسار النظام المفقود : %s"
 
-#: includes/system_tests.inc:288
+#: /var/www/fa2.3/devel/../includes/system_tests.inc:286
 msgid "Main config file"
 msgstr "ملف التوصيف الرئيسي"
 
-#: includes/system_tests.inc:295
-#: includes/system_tests.inc:317
+#: /var/www/fa2.3/devel/../includes/system_tests.inc:293
+#: /var/www/fa2.3/devel/../includes/system_tests.inc:315
 #, php-format
 msgid "Can't write '%s' file. Check FA directory write permissions."
 msgstr "لا يمكن الكتابة على الملف  '%s' ، قم بفحص صلاحيات الكتابة على مجلد التطبيق"
 
-#: includes/system_tests.inc:296
-#: includes/system_tests.inc:318
+#: /var/www/fa2.3/devel/../includes/system_tests.inc:294
+#: /var/www/fa2.3/devel/../includes/system_tests.inc:316
 #, php-format
 msgid "'%s' file exists."
 msgstr "ملف  '%s' موجود"
 
-#: includes/system_tests.inc:300
+#: /var/www/fa2.3/devel/../includes/system_tests.inc:298
 #, php-format
 msgid "'%s' file should be read-only"
 msgstr "الملف  '%s' يجب أن يكون للقراءة فقط "
 
-#: includes/system_tests.inc:309
+#: /var/www/fa2.3/devel/../includes/system_tests.inc:307
 msgid "Database auth file"
 msgstr "ملف اعتماد قاعدة البيانات"
 
-#: includes/system_tests.inc:322
+#: /var/www/fa2.3/devel/../includes/system_tests.inc:320
 #, php-format
 msgid "'%s' file should be read-only if you do not plan to add or change companies"
 msgstr "الملف  '%s' يجب أن يكون للقراءة فقط ، إذا كنت تخطط أن تضيف أو تغير الشركات"
 
-#: includes/system_tests.inc:333
+#: /var/www/fa2.3/devel/../includes/system_tests.inc:331
 msgid "Extensions system"
 msgstr "نظام الإضافات البرمجية"
 
-#: includes/system_tests.inc:363
+#: /var/www/fa2.3/devel/../includes/system_tests.inc:366
 msgid "Extensions configuration files and directories should be writeable"
 msgstr "ملفات توصيف الإضافات البرمجية و المجلدات يجب أن تكون قابلة للكتابة"
 
-#: includes/system_tests.inc:375
+#: /var/www/fa2.3/devel/../includes/system_tests.inc:378
 #, php-format
 msgid "Non-standard theme directory '%s' is not writable"
 msgstr "مجلد الشكل الغير معياري  '%s' يجب أن يكون غير قابل للكتابة"
 
-#: includes/system_tests.inc:385
+#: /var/www/fa2.3/devel/../includes/system_tests.inc:388
 msgid "OpenSSL PHP extension have to be enabled to use extension repository system."
 msgstr "نظام الروابط البرمجية OpenSSL لـ PHP يجب أن يكون مفعل لأستخدام مستودع الإضافات البرمجية للنظام"
 
-#: includes/system_tests.inc:388
+#: /var/www/fa2.3/devel/../includes/system_tests.inc:391
 msgid "OpenSSL have to be available on your server to use extension repository system."
 msgstr "OpenSSL يجب أن يكون متاح على الخادم حتى يمكنك أستخدام مستودع الإضافات البرمجية للنظام"
 
-#: includes/system_tests.inc:411
+#: /var/www/fa2.3/devel/../includes/system_tests.inc:414
 msgid "Test"
 msgstr "اختبار"
 
-#: includes/system_tests.inc:411
+#: /var/www/fa2.3/devel/../includes/system_tests.inc:414
 msgid "Test type"
 msgstr "نوع الاختبار"
 
-#: includes/system_tests.inc:411
+#: /var/www/fa2.3/devel/../includes/system_tests.inc:414
 msgid "Value"
 msgstr "القيمة"
 
-#: includes/system_tests.inc:411
+#: /var/www/fa2.3/devel/../includes/system_tests.inc:414
 msgid "Comments"
 msgstr "الملاحظات"
 
-#: includes/system_tests.inc:435
+#: /var/www/fa2.3/devel/../includes/system_tests.inc:438
 msgid "Ok"
 msgstr "موافق"
 
-#: includes/packages.inc:190
-#, php-format
-msgid "No key field '%s' in file '%s'"
-msgstr ""
-
-#: includes/packages.inc:295
-msgid "Release file in repository is invalid, or public key is outdated."
-msgstr ""
-
-#: includes/packages.inc:311
-msgid "Repository version does not match application version."
-msgstr ""
-
-#: includes/packages.inc:325
-#, php-format
-msgid "Security alert: broken index file in repository '%s'. Please inform repository administrator about this issue."
-msgstr ""
-
-#: includes/packages.inc:358
-#, php-format
-msgid "Security alert: broken package '%s' in repository. Please inform repository administrator about this issue."
-msgstr ""
-
-#: includes/packages.inc:613
-#: includes/packages.inc:664
-#, php-format
-msgid "Package '%s' not found."
-msgstr ""
-
index 22a75372d9fcc2b19532b5b694edd1210264f456..6466405abe0b23f3e133a1143301ae21a98c6e15 100644 (file)
Binary files a/install/lang/fr_FR/LC_MESSAGES/fr_FR.mo and b/install/lang/fr_FR/LC_MESSAGES/fr_FR.mo differ
index 19af11db2f0ed597139c94a0738c542092ff55a7..9d296a4c88c5ce5619b24d05c1ecc429867ab836 100644 (file)
@@ -7,491 +7,456 @@ msgid ""
 msgstr ""
 "Project-Id-Version: FrontAccounting 2.3.0\n"
 "Report-Msgid-Bugs-To: \n"
-"POT-Creation-Date: \n"
-"PO-Revision-Date: 2011-03-31 19:39+0100\n"
-"Last-Translator: Translation Team <info@frontaccounting.net>\n"
-"Language-Team: Language <LL@li.org>\n"
+"POT-Creation-Date: 2010-08-08 12:50+0200\n"
+"PO-Revision-Date: 2010-08-08 12:48-0500\n"
+"Last-Translator: Gaston <gaston.huot@videotron.ca>\n"
+"Language-Team: LANGUAGE <LL@li.org>\n"
 "MIME-Version: 1.0\n"
 "Content-Type: text/plain; charset=ISO-8859-1\n"
 "Content-Transfer-Encoding: 8bit\n"
 
-#: install/index.php:20
-#: install/index.php:40
+#: /var/www/fa2.3/devel/../install/index.php:20
+#: /var/www/fa2.3/devel/../install/index.php:40
 msgid "FrontAccouting ERP Installation Wizard"
 msgstr "Outil d'installation assistée de FrontAccounting"
 
-#: install/index.php:41
+#: /var/www/fa2.3/devel/../install/index.php:41
 #, php-format
 msgid "Step %d: %s"
 msgstr "Étape %d: %s"
 
-#: install/index.php:48
+#: /var/www/fa2.3/devel/../install/index.php:48
 msgid "Chart of accounts"
 msgstr "Charte des postes comptables"
 
-#: install/index.php:48
-#: install/index.php:75
+#: /var/www/fa2.3/devel/../install/index.php:48
+#: /var/www/fa2.3/devel/../install/index.php:75
 msgid "Encoding"
 msgstr "Codage des caractères"
 
-#: install/index.php:48
-#: install/index.php:75
+#: /var/www/fa2.3/devel/../install/index.php:48
+#: /var/www/fa2.3/devel/../install/index.php:75
 msgid "Description"
 msgstr "Description"
 
-#: install/index.php:48
-#: install/index.php:75
+#: /var/www/fa2.3/devel/../install/index.php:48
+#: /var/www/fa2.3/devel/../install/index.php:75
 msgid "Install"
 msgstr "Installer"
 
-#: install/index.php:65
-#: install/index.php:93
+#: /var/www/fa2.3/devel/../install/index.php:65
+#: /var/www/fa2.3/devel/../install/index.php:93
 msgid "Installed"
 msgstr "Installé"
 
-#: install/index.php:75
+#: /var/www/fa2.3/devel/../install/index.php:75
 msgid "Language"
 msgstr "Langue"
 
-#: install/index.php:123
-msgid "Cannot connect to database. User or password is invalid or you have no permittions to create database."
-msgstr ""
-
-#: install/index.php:159
+#: /var/www/fa2.3/devel/../install/index.php:156
 msgid "Cannot save system configuration file 'config.php'."
 msgstr "Impossible d'enregistrer le fichier 'config.php'"
 
-#: install/index.php:166
+#: /var/www/fa2.3/devel/../install/index.php:173
 msgid "Cannot open 'config_db.php' configuration file."
 msgstr "Impossible d'ouvrir le fichier 'config_db.php'"
 
-#: install/index.php:169
+#: /var/www/fa2.3/devel/../install/index.php:176
 msgid "Cannot write to the 'config_db.php' configuration file."
 msgstr "Impossible d'écrire dans le fichier 'config_db.php'"
 
-#: install/index.php:172
+#: /var/www/fa2.3/devel/../install/index.php:179
 msgid "Configuration file 'config_db.php' is not writable. Change its permissions so it is, then re-run installation step."
 msgstr "Il n'est pas possible d'écrire dans le fichier de configuration 'config_db.php'. Svp revoir les permissions et recommencer le processus d'installation."
 
-#: install/index.php:211
+#: /var/www/fa2.3/devel/../install/index.php:217
 msgid "Host name cannot be empty."
 msgstr "Le nom du Host ne peut être vide."
 
-#: install/index.php:215
+#: /var/www/fa2.3/devel/../install/index.php:221
 msgid "Database user name cannot be empty."
 msgstr "Svp un code d'utilisateur pour cette BD"
 
-#: install/index.php:219
+#: /var/www/fa2.3/devel/../install/index.php:225
 msgid "Database name cannot be empty."
 msgstr "Svp préciser le nom de la BD"
 
-#: install/index.php:272
+#: /var/www/fa2.3/devel/../install/index.php:277
 msgid "Company name cannot be empty."
 msgstr "SVP préciser le nom de la compagnie"
 
-#: install/index.php:276
+#: /var/www/fa2.3/devel/../install/index.php:281
 msgid "Company admin name cannot be empty."
 msgstr "SVP préciser le nom de l'administrateur "
 
-#: install/index.php:280
+#: /var/www/fa2.3/devel/../install/index.php:285
 msgid "Company admin password cannot be empty."
 msgstr "SVP préciser le mot de passe de l'administrateur"
 
-#: install/index.php:284
+#: /var/www/fa2.3/devel/../install/index.php:289
 msgid "Company admin passwords differ."
 msgstr "Les 2 entrées de mot de passe diffèrent."
 
-#: install/index.php:316
+#: /var/www/fa2.3/devel/../install/index.php:320
 msgid "System Diagnostics"
 msgstr "Diagnostique du système"
 
-#: install/index.php:318
+#: /var/www/fa2.3/devel/../install/index.php:323
 msgid "Select install wizard language:"
 msgstr "Svp choisir la langue d'installation."
 
-#: install/index.php:324
+#: /var/www/fa2.3/devel/../install/index.php:329
 msgid "All application preliminary requirements seems to be correct. Please press Continue button below."
 msgstr "Tous les pré-requis semblent corrects. Svp appuyez sur le bouton Continuer situé ci-après"
 
-#: install/index.php:325
-#: install/index.php:351
-#: install/index.php:358
-#: install/index.php:365
-#: install/index.php:384
+#: /var/www/fa2.3/devel/../install/index.php:330
+#: /var/www/fa2.3/devel/../install/index.php:356
+#: /var/www/fa2.3/devel/../install/index.php:363
+#: /var/www/fa2.3/devel/../install/index.php:370
+#: /var/www/fa2.3/devel/../install/index.php:389
 msgid "Continue >>"
 msgstr "Continuer >>"
 
-#: install/index.php:327
+#: /var/www/fa2.3/devel/../install/index.php:332
 msgid "Application cannot be installed. Please fix problems listed below in red, and press Refresh button."
 msgstr "L'application n'a pu être installée. Svp résoudre le problème libellé en rouge et appuyez sur le bouton Actualiser"
 
-#: install/index.php:328
+#: /var/www/fa2.3/devel/../install/index.php:333
 msgid "Refresh"
 msgstr "Actualiser"
 
-#: install/index.php:338
+#: /var/www/fa2.3/devel/../install/index.php:343
 msgid "Database Server Settings"
 msgstr "Réglages de la BD"
 
-#: install/index.php:340
+#: /var/www/fa2.3/devel/../install/index.php:345
 msgid "Server Host:"
 msgstr "Nom du serveur:"
 
-#: install/index.php:341
+#: /var/www/fa2.3/devel/../install/index.php:346
 msgid "Database User:"
 msgstr "ID de l'utilisateur de la BD:"
 
-#: install/index.php:342
+#: /var/www/fa2.3/devel/../install/index.php:347
 msgid "Database Password:"
 msgstr "Mot de passe :"
 
-#: install/index.php:343
+#: /var/www/fa2.3/devel/../install/index.php:348
 msgid "Database Name:"
 msgstr "Nom de la BD:"
 
-#: install/index.php:344
+#: /var/www/fa2.3/devel/../install/index.php:349
 msgid "Use '0_' Table Prefix:"
 msgstr "Utilisez le préfix de table '0_':"
 
-#: install/index.php:344
-#: includes/system_tests.inc:38
-#: includes/system_tests.inc:113
-#: includes/system_tests.inc:126
+#: /var/www/fa2.3/devel/../install/index.php:349
+#: /var/www/fa2.3/devel/../includes/system_tests.inc:38
+#: /var/www/fa2.3/devel/../includes/system_tests.inc:113
+#: /var/www/fa2.3/devel/../includes/system_tests.inc:126
 msgid "Yes"
 msgstr "Oui"
 
-#: install/index.php:344
-#: includes/system_tests.inc:38
-#: includes/system_tests.inc:113
-#: includes/system_tests.inc:126
+#: /var/www/fa2.3/devel/../install/index.php:349
+#: /var/www/fa2.3/devel/../includes/system_tests.inc:38
+#: /var/www/fa2.3/devel/../includes/system_tests.inc:113
+#: /var/www/fa2.3/devel/../includes/system_tests.inc:126
 msgid "No"
 msgstr "Non"
 
-#: install/index.php:345
+#: /var/www/fa2.3/devel/../install/index.php:350
 msgid "Install Additional Language Packs from FA Repository:"
 msgstr "Installer d'autres langues:"
 
-#: install/index.php:346
+#: /var/www/fa2.3/devel/../install/index.php:351
 msgid "Install Additional COAs from FA Repository:"
 msgstr "Installer d'autres COAs à partir du dépôt de FA:"
 
-#: install/index.php:348
+#: /var/www/fa2.3/devel/../install/index.php:353
 msgid "Use table prefix if you share selected database for more than one FA company."
 msgstr "Svp utiliser un préfixe de table si vous partagez la BD pour plus d'une compagnie."
 
-#: install/index.php:349
+#: /var/www/fa2.3/devel/../install/index.php:354
 msgid "Do not select additional langs nor COAs if you have no working internet connection right now. You can install them later."
 msgstr "Ne pas sélectionner d'autres langues (ni COA) si votre connection internet n'est pas active en ce moment. Vous pourrez le faire plus tard."
 
-#: install/index.php:350
-#: install/index.php:357
-#: install/index.php:364
-#: install/index.php:383
+#: /var/www/fa2.3/devel/../install/index.php:355
+#: /var/www/fa2.3/devel/../install/index.php:362
+#: /var/www/fa2.3/devel/../install/index.php:369
+#: /var/www/fa2.3/devel/../install/index.php:388
 msgid "<< Back"
 msgstr "<< Retour"
 
-#: install/index.php:355
+#: /var/www/fa2.3/devel/../install/index.php:360
 msgid "User Interface Languages Selection"
 msgstr "Sélection de la langue :"
 
-#: install/index.php:362
+#: /var/www/fa2.3/devel/../install/index.php:367
 msgid "Charts of Accounts Selection"
 msgstr "Sélection de la charte des postes comptables"
 
-#: install/index.php:374
+#: /var/www/fa2.3/devel/../install/index.php:379
 msgid "Company Settings"
 msgstr "Réglages systèmes de la compagnie"
 
-#: install/index.php:376
+#: /var/www/fa2.3/devel/../install/index.php:381
 msgid "Company Name:"
 msgstr "Nom de la compagnie:"
 
-#: install/index.php:377
+#: /var/www/fa2.3/devel/../install/index.php:382
 msgid "Admin Login:"
 msgstr "Identifiant d'administrateur:"
 
-#: install/index.php:378
+#: /var/www/fa2.3/devel/../install/index.php:383
 msgid "Admin Password:"
 msgstr "Mot de passe de l'administrateur:"
 
-#: install/index.php:379
+#: /var/www/fa2.3/devel/../install/index.php:384
 msgid "Reenter Password:"
 msgstr "Saisir de nouveau le mot de passe:"
 
-#: install/index.php:380
+#: /var/www/fa2.3/devel/../install/index.php:385
 msgid "Select Chart of Accounts:"
 msgstr "Sélectionner la charte de postes comptables:"
 
-#: install/index.php:381
+#: /var/www/fa2.3/devel/../install/index.php:386
 msgid "Select Default Language:"
 msgstr "Sélectionner la langue par défaut:"
 
-#: install/index.php:388
+#: /var/www/fa2.3/devel/../install/index.php:393
 msgid "FrontAccounting ERP has been installed successsfully."
 msgstr "L'installation de FrontAccounting est un succès."
 
-#: install/index.php:389
+#: /var/www/fa2.3/devel/../install/index.php:394
 msgid "Please do not forget to remove install wizard folder."
 msgstr "Svp ne pas oublier de retirer le répertoire d'installation."
 
-#: install/index.php:392
+#: /var/www/fa2.3/devel/../install/index.php:396
 msgid "Click here to start."
 msgstr "Appuyez ici pour démarrer."
 
-#: includes/system_tests.inc:15
+#: /var/www/fa2.3/devel/../includes/system_tests.inc:15
 msgid "Info"
 msgstr "Information"
 
-#: includes/system_tests.inc:16
+#: /var/www/fa2.3/devel/../includes/system_tests.inc:16
 msgid "Optional"
 msgstr "Optionnel"
 
-#: includes/system_tests.inc:17
+#: /var/www/fa2.3/devel/../includes/system_tests.inc:17
 msgid "Recommended"
 msgstr "Recommandé"
 
-#: includes/system_tests.inc:18
+#: /var/www/fa2.3/devel/../includes/system_tests.inc:18
 msgid "Required "
 msgstr "Requis"
 
-#: includes/system_tests.inc:24
+#: /var/www/fa2.3/devel/../includes/system_tests.inc:24
 msgid "MySQL version"
 msgstr "Version de MySQL"
 
-#: includes/system_tests.inc:28
+#: /var/www/fa2.3/devel/../includes/system_tests.inc:28
 msgid "Upgrade MySQL server to version at least 4.1"
 msgstr "Mettre à niveau MySQL à la vesion 4.1 et plus"
 
-#: includes/system_tests.inc:35
+#: /var/www/fa2.3/devel/../includes/system_tests.inc:35
 msgid "PHP MySQL extension"
 msgstr "Extension MySQL de PHP"
 
-#: includes/system_tests.inc:40
+#: /var/www/fa2.3/devel/../includes/system_tests.inc:40
 msgid "Your PHP has to have MySQL extension enabled."
 msgstr "SVP activer l'extension MySQL de votre PHP"
 
-#: includes/system_tests.inc:46
+#: /var/www/fa2.3/devel/../includes/system_tests.inc:46
 msgid "PHP version"
 msgstr "Version de PHP"
 
-#: includes/system_tests.inc:50
+#: /var/www/fa2.3/devel/../includes/system_tests.inc:50
 msgid "Upgrade PHP to version at least 4.3.3"
 msgstr "Mettre à niveau PHP à la version 4.3.3 et plus"
 
-#: includes/system_tests.inc:57
+#: /var/www/fa2.3/devel/../includes/system_tests.inc:57
 msgid "Server system"
 msgstr "Système serveur"
 
-#: includes/system_tests.inc:67
+#: /var/www/fa2.3/devel/../includes/system_tests.inc:67
 msgid "Session save path"
 msgstr "Chemin d'accès à la sauvegarde de la session"
 
-#: includes/system_tests.inc:79
+#: /var/www/fa2.3/devel/../includes/system_tests.inc:79
 msgid "Removed install wizard folder"
 msgstr "Le répertoire d'installation a été retiré."
 
-#: includes/system_tests.inc:82
+#: /var/www/fa2.3/devel/../includes/system_tests.inc:82
 msgid "Not removed"
 msgstr "Non retiré"
 
-#: includes/system_tests.inc:83
+#: /var/www/fa2.3/devel/../includes/system_tests.inc:83
 msgid "Remove or rename install wizard folder for security reasons."
 msgstr "Pour des raisons de sécurité, vous devez retirer ou renommer le répertoire d'installation."
 
-#: includes/system_tests.inc:90
+#: /var/www/fa2.3/devel/../includes/system_tests.inc:90
 msgid "Browser type"
 msgstr "Type de navigateur"
 
-#: includes/system_tests.inc:94
+#: /var/www/fa2.3/devel/../includes/system_tests.inc:94
 msgid "Any browser is supported"
 msgstr "Tous les navigateurs sont supportés"
 
-#: includes/system_tests.inc:101
+#: /var/www/fa2.3/devel/../includes/system_tests.inc:101
 msgid "Http server type"
 msgstr "Type de serveur Http"
 
-#: includes/system_tests.inc:105
+#: /var/www/fa2.3/devel/../includes/system_tests.inc:105
 msgid "Any server is supported"
 msgstr "Tous les serveurs sont supportés"
 
-#: includes/system_tests.inc:112
+#: /var/www/fa2.3/devel/../includes/system_tests.inc:112
 msgid "Native gettext"
 msgstr "Gettext natif"
 
-#: includes/system_tests.inc:116
+#: /var/www/fa2.3/devel/../includes/system_tests.inc:116
 msgid "In case of no gettext support, php emulation is used"
 msgstr "Si gettext est non supporté, l'émulation php sera utilisée"
 
-#: includes/system_tests.inc:124
+#: /var/www/fa2.3/devel/../includes/system_tests.inc:124
 msgid "Debugging mode"
 msgstr "Mode de débuggage"
 
-#: includes/system_tests.inc:128
+#: /var/www/fa2.3/devel/../includes/system_tests.inc:128
 msgid "To switch debugging on set $go_debug>0 in config.php file"
 msgstr "Pour activer le code de débug, modifier $go_debug>0 dans le fichier config.php"
 
-#: includes/system_tests.inc:137
+#: /var/www/fa2.3/devel/../includes/system_tests.inc:137
 msgid "Error logging"
 msgstr "Enregistrement des erreurs"
 
-#: includes/system_tests.inc:145
+#: /var/www/fa2.3/devel/../includes/system_tests.inc:145
 msgid "Disabled"
 msgstr "Désactivé"
 
-#: includes/system_tests.inc:148
+#: /var/www/fa2.3/devel/../includes/system_tests.inc:148
 msgid "To switch error logging set $error_logging in config.php file"
 msgstr "Pour activer l'enregistrement des erreurs, modifiez $error_logging dans le fichier de configuration config.php"
 
-#: includes/system_tests.inc:151
+#: /var/www/fa2.3/devel/../includes/system_tests.inc:151
 msgid "Log file is not writeable"
 msgstr "Impossible d'écrire dans le fichier de log"
 
-#: includes/system_tests.inc:161
+#: /var/www/fa2.3/devel/../includes/system_tests.inc:161
 msgid "Current database version"
 msgstr "Version de la BD"
 
-#: includes/system_tests.inc:165
+#: /var/www/fa2.3/devel/../includes/system_tests.inc:165
 msgid "Database structure seems to be not upgraded to current version"
 msgstr "La structure de la BD ne semble pas être de niveau avec la version actuelle"
 
-#: includes/system_tests.inc:180
+#: /var/www/fa2.3/devel/../includes/system_tests.inc:180
 msgid "Company subdirectories consistency"
 msgstr "Cohérence des sous-répertoire de la compagnie"
 
-#: includes/system_tests.inc:193
-#: includes/system_tests.inc:200
-#: includes/system_tests.inc:208
-#: includes/system_tests.inc:225
-#: includes/system_tests.inc:340
-#: includes/system_tests.inc:349
-#: includes/system_tests.inc:358
+#: /var/www/fa2.3/devel/../includes/system_tests.inc:193
+#: /var/www/fa2.3/devel/../includes/system_tests.inc:200
+#: /var/www/fa2.3/devel/../includes/system_tests.inc:208
+#: /var/www/fa2.3/devel/../includes/system_tests.inc:225
+#: /var/www/fa2.3/devel/../includes/system_tests.inc:345
 #, php-format
 msgid "'%s' is not writeable"
 msgstr "Il est impossible d'écrire dans '%s' "
 
-#: includes/system_tests.inc:221
+#: /var/www/fa2.3/devel/../includes/system_tests.inc:221
 msgid "Temporary directory"
 msgstr "Répertoire temporaire"
 
-#: includes/system_tests.inc:233
+#: /var/www/fa2.3/devel/../includes/system_tests.inc:233
 msgid "Language configuration consistency"
 msgstr "Cohérence de la configuration de la langue"
 
-#: includes/system_tests.inc:242
+#: /var/www/fa2.3/devel/../includes/system_tests.inc:242
 msgid "Languages folder should be writeable."
 msgstr "Les répertoires de langue doivent avoir un accès en écriture"
 
-#: includes/system_tests.inc:251
+#: /var/www/fa2.3/devel/../includes/system_tests.inc:250
 msgid "Languages configuration file should be writeable."
 msgstr "Le fichier de configuration de langues doit être accessible en écriture"
 
-#: includes/system_tests.inc:270
+#: /var/www/fa2.3/devel/../includes/system_tests.inc:268
 #, php-format
 msgid "Missing %s translation file."
 msgstr "Le fichier de traduction '%s' est manquant"
 
-#: includes/system_tests.inc:275
+#: /var/www/fa2.3/devel/../includes/system_tests.inc:273
 #, php-format
 msgid "Missing system locale: %s"
 msgstr "Il manque '%s'"
 
-#: includes/system_tests.inc:288
+#: /var/www/fa2.3/devel/../includes/system_tests.inc:286
 msgid "Main config file"
 msgstr "Fichier de configuration"
 
-#: includes/system_tests.inc:295
-#: includes/system_tests.inc:317
+#: /var/www/fa2.3/devel/../includes/system_tests.inc:293
+#: /var/www/fa2.3/devel/../includes/system_tests.inc:315
 #, php-format
 msgid "Can't write '%s' file. Check FA directory write permissions."
 msgstr "Impossible d'écrire '%s'. Svp vérifier les permissions d'écriture sur le répertoire de FA"
 
-#: includes/system_tests.inc:296
-#: includes/system_tests.inc:318
+#: /var/www/fa2.3/devel/../includes/system_tests.inc:294
+#: /var/www/fa2.3/devel/../includes/system_tests.inc:316
 #, php-format
 msgid "'%s' file exists."
 msgstr "Fichier '%s' existant."
 
-#: includes/system_tests.inc:300
+#: /var/www/fa2.3/devel/../includes/system_tests.inc:298
 #, php-format
 msgid "'%s' file should be read-only"
 msgstr "'%s' doit être en lecture seule."
 
-#: includes/system_tests.inc:309
+#: /var/www/fa2.3/devel/../includes/system_tests.inc:307
 msgid "Database auth file"
 msgstr "Fichier d'autorisation de la BD"
 
-#: includes/system_tests.inc:322
+#: /var/www/fa2.3/devel/../includes/system_tests.inc:320
 #, php-format
 msgid "'%s' file should be read-only if you do not plan to add or change companies"
 msgstr "Le fichier '%s' devrait être en lecture seule si vous ne prévoyez pas ajouter ou changer les compagnies."
 
-#: includes/system_tests.inc:333
+#: /var/www/fa2.3/devel/../includes/system_tests.inc:331
 msgid "Extensions system"
 msgstr "Système des extensions"
 
-#: includes/system_tests.inc:363
+#: /var/www/fa2.3/devel/../includes/system_tests.inc:366
 msgid "Extensions configuration files and directories should be writeable"
 msgstr "Les répertoires et fichiers de configuration des extensions doivent accepter les écritures"
 
-#: includes/system_tests.inc:375
+#: /var/www/fa2.3/devel/../includes/system_tests.inc:378
 #, php-format
 msgid "Non-standard theme directory '%s' is not writable"
 msgstr "Le répertoire de thèmes non-standards '%s' n'accepte pas les écritures"
 
-#: includes/system_tests.inc:385
+#: /var/www/fa2.3/devel/../includes/system_tests.inc:388
 msgid "OpenSSL PHP extension have to be enabled to use extension repository system."
 msgstr "Les extensions OpenSSL de PHP doivent être activées pour utiliser le système de dépôt des extensions"
 
-#: includes/system_tests.inc:388
+#: /var/www/fa2.3/devel/../includes/system_tests.inc:391
 msgid "OpenSSL have to be available on your server to use extension repository system."
 msgstr "Les extensions OpenSSL de PHP doivent être disponibles pour utiliser le système de dépôt des extensions"
 
-#: includes/system_tests.inc:411
+#: /var/www/fa2.3/devel/../includes/system_tests.inc:414
 msgid "Test"
 msgstr "Test"
 
-#: includes/system_tests.inc:411
+#: /var/www/fa2.3/devel/../includes/system_tests.inc:414
 msgid "Test type"
 msgstr "Type de test"
 
-#: includes/system_tests.inc:411
+#: /var/www/fa2.3/devel/../includes/system_tests.inc:414
 msgid "Value"
 msgstr "Valeur"
 
-#: includes/system_tests.inc:411
+#: /var/www/fa2.3/devel/../includes/system_tests.inc:414
 msgid "Comments"
 msgstr "Commentaires"
 
-#: includes/system_tests.inc:435
+#: /var/www/fa2.3/devel/../includes/system_tests.inc:438
 msgid "Ok"
 msgstr "Ok"
 
-#: includes/packages.inc:190
-#, php-format
-msgid "No key field '%s' in file '%s'"
-msgstr ""
-
-#: includes/packages.inc:295
-msgid "Release file in repository is invalid, or public key is outdated."
-msgstr ""
-
-#: includes/packages.inc:311
-msgid "Repository version does not match application version."
-msgstr ""
-
-#: includes/packages.inc:325
-#, php-format
-msgid "Security alert: broken index file in repository '%s'. Please inform repository administrator about this issue."
-msgstr ""
-
-#: includes/packages.inc:358
-#, php-format
-msgid "Security alert: broken package '%s' in repository. Please inform repository administrator about this issue."
-msgstr ""
-
-#: includes/packages.inc:613
-#: includes/packages.inc:664
-#, php-format
-msgid "Package '%s' not found."
-msgstr ""
-
index b82bd46a4fa36b77d39205ecfc2e7ec393b948e3..804d5ae202a8c9e176402edb869cfac220715293 100644 (file)
@@ -8,6 +8,7 @@ msgid ""
 msgstr ""
 "Project-Id-Version: PACKAGE VERSION\n"
 "Report-Msgid-Bugs-To: \n"
+"POT-Creation-Date: 2012-02-29 09:49+0100\n"
 "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
 "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
 "Language-Team: LANGUAGE <LL@li.org>\n"
@@ -16,58 +17,58 @@ msgstr ""
 "Content-Type: text/plain; charset=ISO-8859-2\n"
 "Content-Transfer-Encoding: 8bit\n"
 
-#: install/index.php:20 install/index.php:40
+#: install/index.php:20 install/index.php:41
 msgid "FrontAccouting ERP Installation Wizard"
 msgstr ""
 
-#: install/index.php:41
+#: install/index.php:42
 #, php-format
 msgid "Step %d: %s"
 msgstr ""
 
-#: install/index.php:48
+#: install/index.php:49
 msgid "Chart of accounts"
 msgstr ""
 
-#: install/index.php:48 install/index.php:75
+#: install/index.php:49 install/index.php:76
 msgid "Encoding"
 msgstr ""
 
-#: install/index.php:48 install/index.php:75
+#: install/index.php:49 install/index.php:76
 msgid "Description"
 msgstr ""
 
-#: install/index.php:48 install/index.php:75
+#: install/index.php:49 install/index.php:76
 msgid "Install"
 msgstr ""
 
-#: install/index.php:65 install/index.php:93
+#: install/index.php:66 install/index.php:94
 msgid "Installed"
 msgstr ""
 
-#: install/index.php:75
+#: install/index.php:76
 msgid "Language"
 msgstr ""
 
-#: install/index.php:123
+#: install/index.php:124
 msgid ""
 "Cannot connect to database. User or password is invalid or you have no "
 "permittions to create database."
 msgstr ""
 
-#: install/index.php:159
+#: install/index.php:160
 msgid "Cannot save system configuration file 'config.php'."
 msgstr ""
 
-#: install/index.php:166
+#: install/index.php:167
 msgid "Cannot open 'config_db.php' configuration file."
 msgstr ""
 
-#: install/index.php:169
+#: install/index.php:170
 msgid "Cannot write to the 'config_db.php' configuration file."
 msgstr ""
 
-#: install/index.php:172
+#: install/index.php:173
 msgid ""
 "Configuration file 'config_db.php' is not writable. Change its permissions "
 "so it is, then re-run installation step."
@@ -116,7 +117,7 @@ msgid ""
 msgstr ""
 
 #: install/index.php:325 install/index.php:351 install/index.php:358
-#: install/index.php:365 install/index.php:384
+#: install/index.php:365 install/index.php:389
 msgid "Continue >>"
 msgstr ""
 
@@ -184,7 +185,7 @@ msgid ""
 msgstr ""
 
 #: install/index.php:350 install/index.php:357 install/index.php:364
-#: install/index.php:383
+#: install/index.php:388
 msgid "<< Back"
 msgstr ""
 
@@ -196,43 +197,43 @@ msgstr ""
 msgid "Charts of Accounts Selection"
 msgstr ""
 
-#: install/index.php:374
+#: install/index.php:379
 msgid "Company Settings"
 msgstr ""
 
-#: install/index.php:376
+#: install/index.php:381
 msgid "Company Name:"
 msgstr ""
 
-#: install/index.php:377
+#: install/index.php:382
 msgid "Admin Login:"
 msgstr ""
 
-#: install/index.php:378
+#: install/index.php:383
 msgid "Admin Password:"
 msgstr ""
 
-#: install/index.php:379
+#: install/index.php:384
 msgid "Reenter Password:"
 msgstr ""
 
-#: install/index.php:380
+#: install/index.php:385
 msgid "Select Chart of Accounts:"
 msgstr ""
 
-#: install/index.php:381
+#: install/index.php:386
 msgid "Select Default Language:"
 msgstr ""
 
-#: install/index.php:388
+#: install/index.php:393
 msgid "FrontAccounting ERP has been installed successsfully."
 msgstr ""
 
-#: install/index.php:389
+#: install/index.php:394
 msgid "Please do not forget to remove install wizard folder."
 msgstr ""
 
-#: install/index.php:392
+#: install/index.php:397
 msgid "Click here to start."
 msgstr ""
 
@@ -468,29 +469,34 @@ msgstr ""
 msgid "No key field '%s' in file '%s'"
 msgstr ""
 
-#: includes/packages.inc:295
+#: includes/packages.inc:295 includes/packages.inc:329
+#, php-format
+msgid "Cannot delete outdated '%s' file."
+msgstr ""
+
+#: includes/packages.inc:299
 msgid "Release file in repository is invalid, or public key is outdated."
 msgstr ""
 
-#: includes/packages.inc:311
+#: includes/packages.inc:316
 msgid "Repository version does not match application version."
 msgstr ""
 
-#: includes/packages.inc:325
+#: includes/packages.inc:333
 #, php-format
 msgid ""
 "Security alert: broken index file in repository '%s'. Please inform "
 "repository administrator about this issue."
 msgstr ""
 
-#: includes/packages.inc:358
+#: includes/packages.inc:366
 #, php-format
 msgid ""
 "Security alert: broken package '%s' in repository. Please inform repository "
 "administrator about this issue."
 msgstr ""
 
-#: includes/packages.inc:613 includes/packages.inc:664
+#: includes/packages.inc:621 includes/packages.inc:672
 #, php-format
 msgid "Package '%s' not found."
 msgstr ""
index 3ad76a1b74e5d70c925e9f714038b604fd4f5e25..210033b0095f712b189a8177c7e8066db441a41d 100644 (file)
@@ -7,492 +7,481 @@ msgid ""
 msgstr ""
 "Project-Id-Version: \n"
 "Report-Msgid-Bugs-To: \n"
-"POT-Creation-Date: 2011-03-31 10:54+0200\n"
+"POT-Creation-Date: 2010-08-08 12:50+0200\n"
 "PO-Revision-Date: \n"
-"Last-Translator: Translation Team <info@frontaccounting.net>\n"
+"Last-Translator: Janusz Dobrowolski <janusz@iron.from.pl>\n"
 "Language-Team: \n"
-"Language: \n"
 "MIME-Version: 1.0\n"
 "Content-Type: text/plain; charset=ISO-8859-2\n"
 "Content-Transfer-Encoding: 8bit\n"
 
-#: install/index.php:20
-#: install/index.php:40
+#: /var/www/fa2.3/devel/../install/index.php:20
+#: /var/www/fa2.3/devel/../install/index.php:40
 msgid "FrontAccouting ERP Installation Wizard"
 msgstr "Instalator FrontAccounting ERP"
 
-#: install/index.php:41
+#: /var/www/fa2.3/devel/../install/index.php:41
 #, php-format
 msgid "Step %d: %s"
 msgstr "Krok %d: %s"
 
-#: install/index.php:48
+#: /var/www/fa2.3/devel/../install/index.php:48
 msgid "Chart of accounts"
 msgstr "Plan kont"
 
-#: install/index.php:48
-#: install/index.php:75
+#: /var/www/fa2.3/devel/../install/index.php:48
+#: /var/www/fa2.3/devel/../install/index.php:75
 msgid "Encoding"
 msgstr "Kodowanie"
 
-#: install/index.php:48
-#: install/index.php:75
+#: /var/www/fa2.3/devel/../install/index.php:48
+#: /var/www/fa2.3/devel/../install/index.php:75
 msgid "Description"
 msgstr "Opis"
 
-#: install/index.php:48
-#: install/index.php:75
+#: /var/www/fa2.3/devel/../install/index.php:48
+#: /var/www/fa2.3/devel/../install/index.php:75
 msgid "Install"
 msgstr "Zainstaluj"
 
-#: install/index.php:65
-#: install/index.php:93
+#: /var/www/fa2.3/devel/../install/index.php:65
+#: /var/www/fa2.3/devel/../install/index.php:93
 msgid "Installed"
 msgstr "Zainstalowany"
 
-#: install/index.php:75
+#: /var/www/fa2.3/devel/../install/index.php:75
 msgid "Language"
 msgstr "Jêzyk"
 
-#: install/index.php:123
-msgid "Cannot connect to database. User or password is invalid or you have no permittions to create database."
-msgstr "Nie mo¿na po³aæzyæ siê z baz± danych. Login lub has³o jest niepoprawne, lub brak uprawnieñ do tworzenia bazy danych."
-
-#: install/index.php:159
+#: /var/www/fa2.3/devel/../install/index.php:156
 msgid "Cannot save system configuration file 'config.php'."
 msgstr "Nie mo¿na zapisaæ pliku konfiguracyjnego 'config.php'."
 
-#: install/index.php:166
+#: /var/www/fa2.3/devel/../install/index.php:173
 msgid "Cannot open 'config_db.php' configuration file."
 msgstr "Nie mo¿na utworzyæ pliku konfiguracji 'config_db.php'."
 
-#: install/index.php:169
+#: /var/www/fa2.3/devel/../install/index.php:176
 msgid "Cannot write to the 'config_db.php' configuration file."
 msgstr "Nie mo¿na zapisaæ pliku konfiguracji  'config_db.php'."
 
-#: install/index.php:172
-msgid "Configuration file 'config_db.php' is not writable. Change its permissions so it is, then re-run installation step."
-msgstr "Plik konfiguracji 'config_db.php' jest zabezpieczony przed zapisem. Zmieñ prawa dostêpu i powtórz krok instalacji."
+#: /var/www/fa2.3/devel/../install/index.php:179
+msgid ""
+"Configuration file 'config_db.php' is not writable. Change its permissions "
+"so it is, then re-run installation step."
+msgstr ""
+"Plik konfiguracji 'config_db.php' jest zabezpieczony przed zapisem. Zmieñ "
+"prawa dostêpu i powtórz krok instalacji."
 
-#: install/index.php:211
+#: /var/www/fa2.3/devel/../install/index.php:217
 msgid "Host name cannot be empty."
 msgstr "Adres serwera nie mo¿e byæ pusty."
 
-#: install/index.php:215
+#: /var/www/fa2.3/devel/../install/index.php:221
 msgid "Database user name cannot be empty."
 msgstr "Nazwa u¿ytkownika nie mo¿e by pusta."
 
-#: install/index.php:219
+#: /var/www/fa2.3/devel/../install/index.php:225
 msgid "Database name cannot be empty."
 msgstr "Nazwa bazy danych nie mo¿e byæ pusta."
 
-#: install/index.php:272
+#: /var/www/fa2.3/devel/../install/index.php:277
 msgid "Company name cannot be empty."
 msgstr "Nazwa firmy nie mo¿e by pusta."
 
-#: install/index.php:276
+#: /var/www/fa2.3/devel/../install/index.php:281
 msgid "Company admin name cannot be empty."
 msgstr "Nazwa administratora nie mo¿e byæ pusta."
 
-#: install/index.php:280
+#: /var/www/fa2.3/devel/../install/index.php:285
 msgid "Company admin password cannot be empty."
 msgstr "Has³o administratora nie mo¿e by puste."
 
-#: install/index.php:284
+#: /var/www/fa2.3/devel/../install/index.php:289
 msgid "Company admin passwords differ."
 msgstr "Wprowadzone has³a ró¿ni± siê."
 
-#: install/index.php:316
+#: /var/www/fa2.3/devel/../install/index.php:320
 msgid "System Diagnostics"
 msgstr "Diagnostyka Systemu"
 
-#: install/index.php:318
+#: /var/www/fa2.3/devel/../install/index.php:323
 msgid "Select install wizard language:"
 msgstr "Wybierz jêzyk u¿ywany przy instalacji:"
 
-#: install/index.php:324
-msgid "All application preliminary requirements seems to be correct. Please press Continue button below."
-msgstr "Wszystkie wymagania systemu wydaj± siê byæ spe³nione. Kliknij klawisz poni¿ej aby rozpocz±æ instalacjê."
-
-#: install/index.php:325
-#: install/index.php:351
-#: install/index.php:358
-#: install/index.php:365
-#: install/index.php:384
+#: /var/www/fa2.3/devel/../install/index.php:329
+msgid ""
+"All application preliminary requirements seems to be correct. Please press "
+"Continue button below."
+msgstr ""
+"Wszystkie wymagania systemu wydaj± siê byæ spe³nione. Kliknij klawisz "
+"poni¿ej aby rozpocz±æ instalacjê."
+
+#: /var/www/fa2.3/devel/../install/index.php:330
+#: /var/www/fa2.3/devel/../install/index.php:356
+#: /var/www/fa2.3/devel/../install/index.php:363
+#: /var/www/fa2.3/devel/../install/index.php:370
+#: /var/www/fa2.3/devel/../install/index.php:389
 msgid "Continue >>"
 msgstr "Kontynuuj >>"
 
-#: install/index.php:327
-msgid "Application cannot be installed. Please fix problems listed below in red, and press Refresh button."
-msgstr "Aplikacja nie mo¿e byæ zainstalowana. Usuñ wskazane problemy i kliknij klawisz 'Od¶wie¿'."
+#: /var/www/fa2.3/devel/../install/index.php:332
+msgid ""
+"Application cannot be installed. Please fix problems listed below in red, "
+"and press Refresh button."
+msgstr ""
+"Aplikacja nie mo¿e byæ zainstalowana. Usuñ wskazane problemy i kliknij "
+"klawisz 'Od¶wie¿'."
 
-#: install/index.php:328
+#: /var/www/fa2.3/devel/../install/index.php:333
 msgid "Refresh"
 msgstr "Od¶wierz"
 
-#: install/index.php:338
+#: /var/www/fa2.3/devel/../install/index.php:343
 msgid "Database Server Settings"
 msgstr "Ustawienia Serwera Bazy Danych"
 
-#: install/index.php:340
+#: /var/www/fa2.3/devel/../install/index.php:345
 msgid "Server Host:"
 msgstr "Adres Serwera:"
 
-#: install/index.php:341
+#: /var/www/fa2.3/devel/../install/index.php:346
 msgid "Database User:"
 msgstr "Nazwa U¿ytkownika:"
 
-#: install/index.php:342
+#: /var/www/fa2.3/devel/../install/index.php:347
 msgid "Database Password:"
 msgstr "Has³o:"
 
-#: install/index.php:343
+#: /var/www/fa2.3/devel/../install/index.php:348
 msgid "Database Name:"
 msgstr "Nazwa Bazy Danych:"
 
-#: install/index.php:344
+#: /var/www/fa2.3/devel/../install/index.php:349
 msgid "Use '0_' Table Prefix:"
 msgstr "Prefiks '0_' dla Nazw Tablic:"
 
-#: install/index.php:344
-#: includes/system_tests.inc:38
-#: includes/system_tests.inc:113
-#: includes/system_tests.inc:126
+#: /var/www/fa2.3/devel/../install/index.php:349
+#: /var/www/fa2.3/devel/../includes/system_tests.inc:38
+#: /var/www/fa2.3/devel/../includes/system_tests.inc:113
+#: /var/www/fa2.3/devel/../includes/system_tests.inc:126
 msgid "Yes"
 msgstr "Tak"
 
-#: install/index.php:344
-#: includes/system_tests.inc:38
-#: includes/system_tests.inc:113
-#: includes/system_tests.inc:126
+#: /var/www/fa2.3/devel/../install/index.php:349
+#: /var/www/fa2.3/devel/../includes/system_tests.inc:38
+#: /var/www/fa2.3/devel/../includes/system_tests.inc:113
+#: /var/www/fa2.3/devel/../includes/system_tests.inc:126
 msgid "No"
 msgstr "Nie"
 
-#: install/index.php:345
+#: /var/www/fa2.3/devel/../install/index.php:350
 msgid "Install Additional Language Packs from FA Repository:"
 msgstr "Instalacja Dodatkowych Jêzyków z Repozytorium FA:"
 
-#: install/index.php:346
+#: /var/www/fa2.3/devel/../install/index.php:351
 msgid "Install Additional COAs from FA Repository:"
 msgstr "Instalacja Dodatkowych Planów Kont z Repozytorium FA:"
 
-#: install/index.php:348
-msgid "Use table prefix if you share selected database for more than one FA company."
+#: /var/www/fa2.3/devel/../install/index.php:353
+msgid ""
+"Use table prefix if you share selected database for more than one FA company."
 msgstr "U¿yj prefiksu je¶li ta sama baza danych bêdzie u¿ywana dla kilku firm."
 
-#: install/index.php:349
-msgid "Do not select additional langs nor COAs if you have no working internet connection right now. You can install them later."
-msgstr "Nie zaznaczaj wyboru dodatkowych jêzyków ani planów kont je¶li w tej chwili nie masz dostêpu do internetu. Bêdziesz je móg³ zainstalowaæ równie¿ pó¼niej."
+#: /var/www/fa2.3/devel/../install/index.php:354
+msgid ""
+"Do not select additional langs nor COAs if you have no working internet "
+"connection right now. You can install them later."
+msgstr ""
+"Nie zaznaczaj wyboru dodatkowych jêzyków ani planów kont je¶li w tej chwili "
+"nie masz dostêpu do internetu. Bêdziesz je móg³ zainstalowaæ równie¿ pó¼niej."
 
-#: install/index.php:350
-#: install/index.php:357
-#: install/index.php:364
-#: install/index.php:383
+#: /var/www/fa2.3/devel/../install/index.php:355
+#: /var/www/fa2.3/devel/../install/index.php:362
+#: /var/www/fa2.3/devel/../install/index.php:369
+#: /var/www/fa2.3/devel/../install/index.php:388
 msgid "<< Back"
 msgstr "<< Wróæ"
 
-#: install/index.php:355
+#: /var/www/fa2.3/devel/../install/index.php:360
 msgid "User Interface Languages Selection"
 msgstr "Wybór Jêzyków Interfejsu U¿ytkownika"
 
-#: install/index.php:362
+#: /var/www/fa2.3/devel/../install/index.php:367
 msgid "Charts of Accounts Selection"
 msgstr "Wybór Planów Kont"
 
-#: install/index.php:374
+#: /var/www/fa2.3/devel/../install/index.php:379
 msgid "Company Settings"
 msgstr "Ustawienia Firmy"
 
-#: install/index.php:376
+#: /var/www/fa2.3/devel/../install/index.php:381
 msgid "Company Name:"
 msgstr "Nazwa Firmy:"
 
-#: install/index.php:377
+#: /var/www/fa2.3/devel/../install/index.php:382
 msgid "Admin Login:"
 msgstr "Login Administratora:"
 
-#: install/index.php:378
+#: /var/www/fa2.3/devel/../install/index.php:383
 msgid "Admin Password:"
 msgstr "Has³o Administratora:"
 
-#: install/index.php:379
+#: /var/www/fa2.3/devel/../install/index.php:384
 msgid "Reenter Password:"
 msgstr "Powtórz Has³o:"
 
-#: install/index.php:380
+#: /var/www/fa2.3/devel/../install/index.php:385
 msgid "Select Chart of Accounts:"
 msgstr "Wybierz Planów Kont:"
 
-#: install/index.php:381
+#: /var/www/fa2.3/devel/../install/index.php:386
 msgid "Select Default Language:"
 msgstr "Wybierz Jêzyk Domy¶lny:"
 
-#: install/index.php:388
+#: /var/www/fa2.3/devel/../install/index.php:393
 msgid "FrontAccounting ERP has been installed successsfully."
 msgstr "Aplikacja FrontAccounting ERP zosta³a zainstalowana pomy¶lnie."
 
-#: install/index.php:389
+#: /var/www/fa2.3/devel/../install/index.php:394
 msgid "Please do not forget to remove install wizard folder."
 msgstr "Nie zapomnij usun±æ folderu instalatora."
 
-#: install/index.php:392
+#: /var/www/fa2.3/devel/../install/index.php:396
 msgid "Click here to start."
 msgstr "Kliknij tutaj, aby rozpocz±æ pracê."
 
-#: includes/system_tests.inc:15
+#: /var/www/fa2.3/devel/../includes/system_tests.inc:15
 msgid "Info"
 msgstr "Informacja"
 
-#: includes/system_tests.inc:16
+#: /var/www/fa2.3/devel/../includes/system_tests.inc:16
 msgid "Optional"
 msgstr "Opcjonalne"
 
-#: includes/system_tests.inc:17
+#: /var/www/fa2.3/devel/../includes/system_tests.inc:17
 msgid "Recommended"
 msgstr "Zalecane"
 
-#: includes/system_tests.inc:18
+#: /var/www/fa2.3/devel/../includes/system_tests.inc:18
 msgid "Required "
 msgstr "Wymagane"
 
-#: includes/system_tests.inc:24
+#: /var/www/fa2.3/devel/../includes/system_tests.inc:24
 msgid "MySQL version"
 msgstr "Wersja MySQL"
 
-#: includes/system_tests.inc:28
+#: /var/www/fa2.3/devel/../includes/system_tests.inc:28
 msgid "Upgrade MySQL server to version at least 4.1"
 msgstr "U¿yj wersji serwera MySQL minimum 4.1"
 
-#: includes/system_tests.inc:35
+#: /var/www/fa2.3/devel/../includes/system_tests.inc:35
 msgid "PHP MySQL extension"
 msgstr "Rozszerzenie PHP MySQL"
 
-#: includes/system_tests.inc:40
+#: /var/www/fa2.3/devel/../includes/system_tests.inc:40
 msgid "Your PHP has to have MySQL extension enabled."
 msgstr "PHP musi mieæ w³±czone rozszerzenie MySQL."
 
-#: includes/system_tests.inc:46
+#: /var/www/fa2.3/devel/../includes/system_tests.inc:46
 msgid "PHP version"
 msgstr "Wersja PHP"
 
-#: includes/system_tests.inc:50
+#: /var/www/fa2.3/devel/../includes/system_tests.inc:50
 msgid "Upgrade PHP to version at least 4.3.3"
 msgstr "Zainstaluj PHP w wersji co najmniej 4.3.3"
 
-#: includes/system_tests.inc:57
+#: /var/www/fa2.3/devel/../includes/system_tests.inc:57
 msgid "Server system"
 msgstr "System serwera"
 
-#: includes/system_tests.inc:67
+#: /var/www/fa2.3/devel/../includes/system_tests.inc:67
 msgid "Session save path"
 msgstr "Katalog zapisu pliku sesji"
 
-#: includes/system_tests.inc:79
+#: /var/www/fa2.3/devel/../includes/system_tests.inc:79
 msgid "Removed install wizard folder"
 msgstr "Folder instalatora usuniêty"
 
-#: includes/system_tests.inc:82
+#: /var/www/fa2.3/devel/../includes/system_tests.inc:82
 msgid "Not removed"
 msgstr "Nie usuniêty"
 
-#: includes/system_tests.inc:83
+#: /var/www/fa2.3/devel/../includes/system_tests.inc:83
 msgid "Remove or rename install wizard folder for security reasons."
 msgstr "Ze wzglêdów bezpieczeñstwa usuñ lub zmieñ nazwê folderu instalatora."
 
-#: includes/system_tests.inc:90
+#: /var/www/fa2.3/devel/../includes/system_tests.inc:90
 msgid "Browser type"
 msgstr "Typ przegl±darki"
 
-#: includes/system_tests.inc:94
+#: /var/www/fa2.3/devel/../includes/system_tests.inc:94
 msgid "Any browser is supported"
 msgstr "Mo¿e byæ u¿yty dowolny typ przegl±darki"
 
-#: includes/system_tests.inc:101
+#: /var/www/fa2.3/devel/../includes/system_tests.inc:101
 msgid "Http server type"
 msgstr "Serwer http"
 
-#: includes/system_tests.inc:105
+#: /var/www/fa2.3/devel/../includes/system_tests.inc:105
 msgid "Any server is supported"
 msgstr "Dowolny"
 
-#: includes/system_tests.inc:112
+#: /var/www/fa2.3/devel/../includes/system_tests.inc:112
 msgid "Native gettext"
 msgstr "Biblioteka Gettext "
 
-#: includes/system_tests.inc:116
+#: /var/www/fa2.3/devel/../includes/system_tests.inc:116
 msgid "In case of no gettext support, php emulation is used"
 msgstr "W przypadku braku wsparcia systemu,  gettext jest emulowany."
 
-#: includes/system_tests.inc:124
+#: /var/www/fa2.3/devel/../includes/system_tests.inc:124
 msgid "Debugging mode"
 msgstr "Tryb debug"
 
-#: includes/system_tests.inc:128
+#: /var/www/fa2.3/devel/../includes/system_tests.inc:128
 msgid "To switch debugging on set $go_debug>0 in config.php file"
 msgstr "Aby w³±czyæ tryb debug ustaw $go_debug>0 in config.php file"
 
-#: includes/system_tests.inc:137
+#: /var/www/fa2.3/devel/../includes/system_tests.inc:137
 msgid "Error logging"
 msgstr "Logowanie b³êdów"
 
-#: includes/system_tests.inc:145
+#: /var/www/fa2.3/devel/../includes/system_tests.inc:145
 msgid "Disabled"
 msgstr "Wy³±czony"
 
-#: includes/system_tests.inc:148
+#: /var/www/fa2.3/devel/../includes/system_tests.inc:148
 msgid "To switch error logging set $error_logging in config.php file"
-msgstr "Aby w³±czyæ logowanie b³êdów ustaw zmienn± $error_logging w pliku config.php"
+msgstr ""
+"Aby w³±czyæ logowanie b³êdów ustaw zmienn± $error_logging w pliku config.php"
 
-#: includes/system_tests.inc:151
+#: /var/www/fa2.3/devel/../includes/system_tests.inc:151
 msgid "Log file is not writeable"
 msgstr "Logfile jest niezapisywalny"
 
-#: includes/system_tests.inc:161
+#: /var/www/fa2.3/devel/../includes/system_tests.inc:161
 msgid "Current database version"
 msgstr "Aktualna wersja bazy danych"
 
-#: includes/system_tests.inc:165
+#: /var/www/fa2.3/devel/../includes/system_tests.inc:165
 msgid "Database structure seems to be not upgraded to current version"
 msgstr "Struktura bazy danych nie jest zaktualizowana do bie¿±cej wersji"
 
-#: includes/system_tests.inc:180
+#: /var/www/fa2.3/devel/../includes/system_tests.inc:180
 msgid "Company subdirectories consistency"
 msgstr "Prawid³owa struktura folderów firmowych"
 
-#: includes/system_tests.inc:193
-#: includes/system_tests.inc:200
-#: includes/system_tests.inc:208
-#: includes/system_tests.inc:225
-#: includes/system_tests.inc:340
-#: includes/system_tests.inc:349
-#: includes/system_tests.inc:358
+#: /var/www/fa2.3/devel/../includes/system_tests.inc:193
+#: /var/www/fa2.3/devel/../includes/system_tests.inc:200
+#: /var/www/fa2.3/devel/../includes/system_tests.inc:208
+#: /var/www/fa2.3/devel/../includes/system_tests.inc:225
+#: /var/www/fa2.3/devel/../includes/system_tests.inc:345
 #, php-format
 msgid "'%s' is not writeable"
 msgstr "'%s' jest niezapisywalny"
 
-#: includes/system_tests.inc:221
+#: /var/www/fa2.3/devel/../includes/system_tests.inc:221
 msgid "Temporary directory"
 msgstr "Katalog plików tymczasowych"
 
-#: includes/system_tests.inc:233
+#: /var/www/fa2.3/devel/../includes/system_tests.inc:233
 msgid "Language configuration consistency"
 msgstr "Konfiguracja jêzykowa"
 
-#: includes/system_tests.inc:242
+#: /var/www/fa2.3/devel/../includes/system_tests.inc:242
 msgid "Languages folder should be writeable."
 msgstr "Folder jêzyków musi byæ zapisywalny"
 
-#: includes/system_tests.inc:251
+#: /var/www/fa2.3/devel/../includes/system_tests.inc:250
 msgid "Languages configuration file should be writeable."
 msgstr "Pliki konfiguracyjny jêzyków musi byæ zapisywalny."
 
-#: includes/system_tests.inc:270
+#: /var/www/fa2.3/devel/../includes/system_tests.inc:268
 #, php-format
 msgid "Missing %s translation file."
 msgstr "Brak pliku t³umaczeñ %s"
 
-#: includes/system_tests.inc:275
+#: /var/www/fa2.3/devel/../includes/system_tests.inc:273
 #, php-format
 msgid "Missing system locale: %s"
 msgstr "Lokalizacja '%s' nie jest zainstalowana w systemie"
 
-#: includes/system_tests.inc:288
+#: /var/www/fa2.3/devel/../includes/system_tests.inc:286
 msgid "Main config file"
 msgstr "G³ówny plik konfiguracyjny "
 
-#: includes/system_tests.inc:295
-#: includes/system_tests.inc:317
+#: /var/www/fa2.3/devel/../includes/system_tests.inc:293
+#: /var/www/fa2.3/devel/../includes/system_tests.inc:315
 #, php-format
 msgid "Can't write '%s' file. Check FA directory write permissions."
 msgstr "Nie mo¿na zapisaæ pliku '%s'. Sprawd¼ prawa zapisu do foderu FA."
 
-#: includes/system_tests.inc:296
-#: includes/system_tests.inc:318
+#: /var/www/fa2.3/devel/../includes/system_tests.inc:294
+#: /var/www/fa2.3/devel/../includes/system_tests.inc:316
 #, php-format
 msgid "'%s' file exists."
 msgstr "Plik '%s' istnieje."
 
-#: includes/system_tests.inc:300
+#: /var/www/fa2.3/devel/../includes/system_tests.inc:298
 #, php-format
 msgid "'%s' file should be read-only"
 msgstr "Plik '%s powinien byæ zabezpieczony przed zapisem"
 
-#: includes/system_tests.inc:309
+#: /var/www/fa2.3/devel/../includes/system_tests.inc:307
 msgid "Database auth file"
 msgstr "Pik configuracyjny bazy danych"
 
-#: includes/system_tests.inc:322
+#: /var/www/fa2.3/devel/../includes/system_tests.inc:320
 #, php-format
-msgid "'%s' file should be read-only if you do not plan to add or change companies"
-msgstr "Plik '%s' powinien byæ zabezpieczony przed zapisem je¶li nie planujesz dodawania ani zmiany firm"
+msgid ""
+"'%s' file should be read-only if you do not plan to add or change companies"
+msgstr ""
+"Plik '%s' powinien byæ zabezpieczony przed zapisem je¶li nie planujesz "
+"dodawania ani zmiany firm"
 
-#: includes/system_tests.inc:333
+#: /var/www/fa2.3/devel/../includes/system_tests.inc:331
 msgid "Extensions system"
 msgstr "System rozszerzeñ"
 
-#: includes/system_tests.inc:363
+#: /var/www/fa2.3/devel/../includes/system_tests.inc:366
 msgid "Extensions configuration files and directories should be writeable"
 msgstr "Pliki konfiguracyjne i foldery rozszerzeñ powinny byæ zapisywalne"
 
-#: includes/system_tests.inc:375
+#: /var/www/fa2.3/devel/../includes/system_tests.inc:378
 #, php-format
 msgid "Non-standard theme directory '%s' is not writable"
 msgstr "Niestandardowy folder tematu '%s' jest zazpieczony przed zapisem"
 
-#: includes/system_tests.inc:385
-msgid "OpenSSL PHP extension have to be enabled to use extension repository system."
+#: /var/www/fa2.3/devel/../includes/system_tests.inc:388
+msgid ""
+"OpenSSL PHP extension have to be enabled to use extension repository system."
 msgstr "System pakietów wymaga zaisnatlowanego rozszerzenia PHP OpenSSL."
 
-#: includes/system_tests.inc:388
-msgid "OpenSSL have to be available on your server to use extension repository system."
-msgstr "Serwer musi mieæ zainstalowane OpenSSL ¿eby mo¿na by³o korzystaæ z repozytorium pakietów rozszerzeñ FA."
+#: /var/www/fa2.3/devel/../includes/system_tests.inc:391
+msgid ""
+"OpenSSL have to be available on your server to use extension repository "
+"system."
+msgstr ""
+"Serwer musi mieæ zainstalowane OpenSSL ¿eby mo¿na by³o korzystaæ z "
+"repozytorium pakietów rozszerzeñ FA."
 
-#: includes/system_tests.inc:411
+#: /var/www/fa2.3/devel/../includes/system_tests.inc:414
 msgid "Test"
 msgstr "Test"
 
-#: includes/system_tests.inc:411
+#: /var/www/fa2.3/devel/../includes/system_tests.inc:414
 msgid "Test type"
 msgstr "Typ testu"
 
-#: includes/system_tests.inc:411
+#: /var/www/fa2.3/devel/../includes/system_tests.inc:414
 msgid "Value"
 msgstr "Warto¶æ"
 
-#: includes/system_tests.inc:411
+#: /var/www/fa2.3/devel/../includes/system_tests.inc:414
 msgid "Comments"
 msgstr "Komentarz"
 
-#: includes/system_tests.inc:435
+#: /var/www/fa2.3/devel/../includes/system_tests.inc:438
 msgid "Ok"
 msgstr "Ok"
-
-#: includes/packages.inc:190
-#, php-format
-msgid "No key field '%s' in file '%s'"
-msgstr "Brak pola '%s' w pliku '%s'"
-
-#: includes/packages.inc:295
-msgid "Release file in repository is invalid, or public key is outdated."
-msgstr "Plik kontrolny wydania jest uszkodzony, lub klucz publiczny jest nieaktualny."
-
-#: includes/packages.inc:311
-msgid "Repository version does not match application version."
-msgstr "Wersja repozytorium nie zgadza siê z wersj± aplikacji."
-
-#: includes/packages.inc:325
-#, php-format
-msgid "Security alert: broken index file in repository '%s'. Please inform repository administrator about this issue."
-msgstr "Alarm bezpieczeñstwa: uszkodzony plik indeksu repozytorium '%s'. Poinformuj administratora repozytorium o tym problemie."
-
-#: includes/packages.inc:358
-#, php-format
-msgid "Security alert: broken package '%s' in repository. Please inform repository administrator about this issue."
-msgstr "Alarm bezpieczeñstwa: uszkodzony plik '%s' w repozytorium. Poinformuj administratora repozytorium o tym problemie."
-
-#: includes/packages.inc:613
-#: includes/packages.inc:664
-#, php-format
-msgid "Package '%s' not found."
-msgstr "Pakiet '%s' nie zosta³ znaleziony."
-
index 0f09527fce42c6efb062bf89bbee0cd895266a5a..c58a8c509fa082e6d3631cedbef40c37cf1e0b4d 100644 (file)
 # This file is distributed under the same license as the PACKAGE package.
 # InterConnect Brasil Ltda. <info@inter.bz>, 2010.
 #
+#, fuzzy
 msgid ""
 msgstr ""
-"Project-Id-Version: PACKAGE Version\n"
+"Project-Id-Version: PACKAGE VERSION\n"
 "Report-Msgid-Bugs-To: \n"
-"POT-Creation-Date: \n"
-"PO-Revision-Date: 2011-03-31 22:44+0100\n"
-"Last-Translator: Translation Team <info@frontaccounting.net>\n"
+"POT-Creation-Date: 2010-08-08 12:50+0200\n"
+"PO-Revision-Date: 2010-08-12 12:50+0200\n"
+"Last-Translator: InterConnect Brasil <info@inter.bz>\n"
 "Language-Team: PT-BR <>\n"
 "MIME-Version: 1.0\n"
 "Content-Type: text/plain; charset=ISO-8859-1\n"
 "Content-Transfer-Encoding: 8bit\n"
 
-#: install/index.php:20
-#: install/index.php:40
+#: /var/www/fa2.3/devel/../install/index.php:20
+#: /var/www/fa2.3/devel/../install/index.php:40
 msgid "FrontAccouting ERP Installation Wizard"
 msgstr "Assistente de Instalação do FrontAccouting ERP"
 
-#: install/index.php:41
+#: /var/www/fa2.3/devel/../install/index.php:41
 #, php-format
 msgid "Step %d: %s"
 msgstr "%do. passo:  %s"
 
-#: install/index.php:48
+#: /var/www/fa2.3/devel/../install/index.php:48
 msgid "Chart of accounts"
 msgstr "Plano de contas"
 
-#: install/index.php:48
-#: install/index.php:75
+#: /var/www/fa2.3/devel/../install/index.php:48
+#: /var/www/fa2.3/devel/../install/index.php:75
 msgid "Encoding"
 msgstr "Codificação"
 
-#: install/index.php:48
-#: install/index.php:75
+#: /var/www/fa2.3/devel/../install/index.php:48
+#: /var/www/fa2.3/devel/../install/index.php:75
 msgid "Description"
 msgstr "Descrição"
 
-#: install/index.php:48
-#: install/index.php:75
+#: /var/www/fa2.3/devel/../install/index.php:48
+#: /var/www/fa2.3/devel/../install/index.php:75
 msgid "Install"
 msgstr "Instalar"
 
-#: install/index.php:65
-#: install/index.php:93
+#: /var/www/fa2.3/devel/../install/index.php:65
+#: /var/www/fa2.3/devel/../install/index.php:93
 msgid "Installed"
 msgstr "Instalado"
 
-#: install/index.php:75
+#: /var/www/fa2.3/devel/../install/index.php:75
 msgid "Language"
 msgstr "Idioma"
 
-#: install/index.php:123
-msgid "Cannot connect to database. User or password is invalid or you have no permittions to create database."
-msgstr ""
-
-#: install/index.php:159
+#: /var/www/fa2.3/devel/../install/index.php:156
 msgid "Cannot save system configuration file 'config.php'."
 msgstr "Não é possível gravar o arquivo de configuração do sistema 'config.php'."
 
-#: install/index.php:166
+#: /var/www/fa2.3/devel/../install/index.php:173
 msgid "Cannot open 'config_db.php' configuration file."
 msgstr "Não é possível abrir o arquivo de configuração 'config_db.php'."
 
-#: install/index.php:169
+#: /var/www/fa2.3/devel/../install/index.php:176
 msgid "Cannot write to the 'config_db.php' configuration file."
 msgstr "Não é possível escrever no arquivo de configuração 'config_db.php'."
 
-#: install/index.php:172
-msgid "Configuration file 'config_db.php' is not writable. Change its permissions so it is, then re-run installation step."
-msgstr "Arquivo de configuração 'config_db.php' não é gravável. Mudar suas permissões para gravável, então reinstale passo a passo."
+#: /var/www/fa2.3/devel/../install/index.php:179
+msgid ""
+"Configuration file 'config_db.php' is not writable. Change its permissions "
+"so it is, then re-run installation step."
+msgstr ""
+"Arquivo de configuração 'config_db.php' não é gravável. Mudar suas permissões "
+"para gravável, então reinstale passo a passo."
 
-#: install/index.php:211
+#: /var/www/fa2.3/devel/../install/index.php:217
 msgid "Host name cannot be empty."
 msgstr "O nome da máquina deve ser preenchido."
 
-#: install/index.php:215
+#: /var/www/fa2.3/devel/../install/index.php:221
 msgid "Database user name cannot be empty."
 msgstr "O nome do usuário do banco de dados deve ser preenchido."
 
-#: install/index.php:219
+#: /var/www/fa2.3/devel/../install/index.php:225
 msgid "Database name cannot be empty."
 msgstr "O nome do banco de dados deve ser preenchido."
 
-#: install/index.php:272
+#: /var/www/fa2.3/devel/../install/index.php:277
 msgid "Company name cannot be empty."
 msgstr "O nome da empresa deve ser preenchido."
 
-#: install/index.php:276
+#: /var/www/fa2.3/devel/../install/index.php:281
 msgid "Company admin name cannot be empty."
 msgstr "O nome do admin da empresa deve ser preenchido."
 
-#: install/index.php:280
+#: /var/www/fa2.3/devel/../install/index.php:285
 msgid "Company admin password cannot be empty."
 msgstr "A senha do admin da empresa deve ser preenchida."
 
-#: install/index.php:284
+#: /var/www/fa2.3/devel/../install/index.php:289
 msgid "Company admin passwords differ."
 msgstr "As senhas do administrador da empresa diferem"
 
-#: install/index.php:316
+#: /var/www/fa2.3/devel/../install/index.php:320
 msgid "System Diagnostics"
 msgstr "Diagnóstico do Sistema"
 
-#: install/index.php:318
+#: /var/www/fa2.3/devel/../install/index.php:323
 msgid "Select install wizard language:"
 msgstr "Selecione o idioma do assistente de instalação:"
 
-#: install/index.php:324
-msgid "All application preliminary requirements seems to be correct. Please press Continue button below."
-msgstr "Todos os requisitos de aplicação preliminar parece esta correto. Por favor pressione o botão Continuar."
-
-#: install/index.php:325
-#: install/index.php:351
-#: install/index.php:358
-#: install/index.php:365
-#: install/index.php:384
+#: /var/www/fa2.3/devel/../install/index.php:329
+msgid ""
+"All application preliminary requirements seems to be correct. Please press "
+"Continue button below."
+msgstr ""
+"Todos os requisitos de aplicação preliminar parece esta correto. Por favor "
+"pressione o botão Continuar."
+
+#: /var/www/fa2.3/devel/../install/index.php:330
+#: /var/www/fa2.3/devel/../install/index.php:356
+#: /var/www/fa2.3/devel/../install/index.php:363
+#: /var/www/fa2.3/devel/../install/index.php:370
+#: /var/www/fa2.3/devel/../install/index.php:389
 msgid "Continue >>"
 msgstr "Continuar >>"
 
-#: install/index.php:327
-msgid "Application cannot be installed. Please fix problems listed below in red, and press Refresh button."
-msgstr "O aplicativo não pode ser instalad0. Por favor corrija os problemas listados abaixo em vermelho, e pressione o botão Atualizar."
+#: /var/www/fa2.3/devel/../install/index.php:332
+msgid ""
+"Application cannot be installed. Please fix problems listed below in red, "
+"and press Refresh button."
+msgstr ""
+"O aplicativo não pode ser instalad0. Por favor corrija os problemas listados abaixo em vermelho, "
+"e pressione o botão Atualizar."
 
-#: install/index.php:328
+#: /var/www/fa2.3/devel/../install/index.php:333
 msgid "Refresh"
 msgstr "Atualizar"
 
-#: install/index.php:338
+#: /var/www/fa2.3/devel/../install/index.php:343
 msgid "Database Server Settings"
 msgstr "Configuração do Banco de Dados"
 
-#: install/index.php:340
+#: /var/www/fa2.3/devel/../install/index.php:345
 msgid "Server Host:"
 msgstr "Servidor do Banco de Dados:"
 
-#: install/index.php:341
+#: /var/www/fa2.3/devel/../install/index.php:346
 msgid "Database User:"
 msgstr "Usuário do Banco de Dados:"
 
-#: install/index.php:342
+#: /var/www/fa2.3/devel/../install/index.php:347
 msgid "Database Password:"
 msgstr "Senha do Banco de Dados:"
 
-#: install/index.php:343
+#: /var/www/fa2.3/devel/../install/index.php:348
 msgid "Database Name:"
 msgstr "Nome do Banco de Dados:"
 
-#: install/index.php:344
+#: /var/www/fa2.3/devel/../install/index.php:349
 msgid "Use '0_' Table Prefix:"
 msgstr "Usar Prefixo de Tabela '0_':"
 
-#: install/index.php:344
-#: includes/system_tests.inc:38
-#: includes/system_tests.inc:113
-#: includes/system_tests.inc:126
+#: /var/www/fa2.3/devel/../install/index.php:349
+#: /var/www/fa2.3/devel/../includes/system_tests.inc:38
+#: /var/www/fa2.3/devel/../includes/system_tests.inc:113
+#: /var/www/fa2.3/devel/../includes/system_tests.inc:126
 msgid "Yes"
 msgstr "Sim"
 
-#: install/index.php:344
-#: includes/system_tests.inc:38
-#: includes/system_tests.inc:113
-#: includes/system_tests.inc:126
+#: /var/www/fa2.3/devel/../install/index.php:349
+#: /var/www/fa2.3/devel/../includes/system_tests.inc:38
+#: /var/www/fa2.3/devel/../includes/system_tests.inc:113
+#: /var/www/fa2.3/devel/../includes/system_tests.inc:126
 msgid "No"
 msgstr "Não"
 
-#: install/index.php:345
+#: /var/www/fa2.3/devel/../install/index.php:350
 msgid "Install Additional Language Packs from FA Repository:"
 msgstr "Instalar Suporte de Idiomas Adicionais do Repositório do FA:"
 
-#: install/index.php:346
+#: /var/www/fa2.3/devel/../install/index.php:351
 msgid "Install Additional COAs from FA Repository:"
 msgstr "Instalar Plano de Contas do Repositório do FA:"
 
-#: install/index.php:348
-msgid "Use table prefix if you share selected database for more than one FA company."
-msgstr "Use o prefixo da tabela se você for utilizar o banco de dados para mais de uma empresa."
+#: /var/www/fa2.3/devel/../install/index.php:353
+msgid ""
+"Use table prefix if you share selected database for more than one FA company."
+msgstr ""
+"Use o prefixo da tabela se você for utilizar o banco de dados para mais de uma empresa."
 
-#: install/index.php:349
-msgid "Do not select additional langs nor COAs if you have no working internet connection right now. You can install them later."
-msgstr "Não selecione Idiomas Adicionais nem Plano de Contas se você não tem uma conexão com a internet agora. Você poderá instalar mais tarde."
+#: /var/www/fa2.3/devel/../install/index.php:354
+msgid ""
+"Do not select additional langs nor COAs if you have no working internet "
+"connection right now. You can install them later."
+msgstr ""
+"Não selecione Idiomas Adicionais nem Plano de Contas se você não tem uma "
+"conexão com a internet agora. Você poderá instalar mais tarde."
 
-#: install/index.php:350
-#: install/index.php:357
-#: install/index.php:364
-#: install/index.php:383
+#: /var/www/fa2.3/devel/../install/index.php:355
+#: /var/www/fa2.3/devel/../install/index.php:362
+#: /var/www/fa2.3/devel/../install/index.php:369
+#: /var/www/fa2.3/devel/../install/index.php:388
 msgid "<< Back"
 msgstr "<< Voltar"
 
-#: install/index.php:355
+#: /var/www/fa2.3/devel/../install/index.php:360
 msgid "User Interface Languages Selection"
 msgstr "Seleção da Idioma da Interface"
 
-#: install/index.php:362
+#: /var/www/fa2.3/devel/../install/index.php:367
 msgid "Charts of Accounts Selection"
 msgstr "Seleção do Plano de Contas"
 
-#: install/index.php:374
+#: /var/www/fa2.3/devel/../install/index.php:379
 msgid "Company Settings"
 msgstr "Configuração da Empresa"
 
-#: install/index.php:376
+#: /var/www/fa2.3/devel/../install/index.php:381
 msgid "Company Name:"
 msgstr "Nome da Empresa:"
 
-#: install/index.php:377
+#: /var/www/fa2.3/devel/../install/index.php:382
 msgid "Admin Login:"
 msgstr "Login do Administrador:"
 
-#: install/index.php:378
+#: /var/www/fa2.3/devel/../install/index.php:383
 msgid "Admin Password:"
 msgstr "Senha do Administrador:"
 
-#: install/index.php:379
+#: /var/www/fa2.3/devel/../install/index.php:384
 msgid "Reenter Password:"
 msgstr "Digitar a Senha Novamente:"
 
-#: install/index.php:380
+#: /var/www/fa2.3/devel/../install/index.php:385
 msgid "Select Chart of Accounts:"
 msgstr "Selecionar Plano de Contas:"
 
-#: install/index.php:381
+#: /var/www/fa2.3/devel/../install/index.php:386
 msgid "Select Default Language:"
 msgstr "Selecionar Idioma Padrão:"
 
-#: install/index.php:388
+#: /var/www/fa2.3/devel/../install/index.php:393
 msgid "FrontAccounting ERP has been installed successsfully."
 msgstr "O FrontAccounting ERP foi instalado com sucesso."
 
-#: install/index.php:389
+#: /var/www/fa2.3/devel/../install/index.php:394
 msgid "Please do not forget to remove install wizard folder."
 msgstr "Por favor não se esqueça de remover a pasta de instalação do assistente."
 
-#: install/index.php:392
+#: /var/www/fa2.3/devel/../install/index.php:396
 msgid "Click here to start."
 msgstr "Clique aqui para iniciar."
 
-#: includes/system_tests.inc:15
+#: /var/www/fa2.3/devel/../includes/system_tests.inc:15
 msgid "Info"
 msgstr "Info"
 
-#: includes/system_tests.inc:16
+#: /var/www/fa2.3/devel/../includes/system_tests.inc:16
 msgid "Optional"
 msgstr "Opcional"
 
-#: includes/system_tests.inc:17
-#, fuzzy
-msgid "Recommended"
+#: /var/www/fa2.3/devel/../includes/system_tests.inc:17
+msgid "Recomended"
 msgstr "Recomendado"
 
-#: includes/system_tests.inc:18
+#: /var/www/fa2.3/devel/../includes/system_tests.inc:18
 msgid "Required "
 msgstr "Requerido "
 
-#: includes/system_tests.inc:24
+#: /var/www/fa2.3/devel/../includes/system_tests.inc:24
 msgid "MySQL version"
 msgstr "Versão do MySQL"
 
-#: includes/system_tests.inc:28
+#: /var/www/fa2.3/devel/../includes/system_tests.inc:28
 msgid "Upgrade MySQL server to version at least 4.1"
 msgstr "Atualize o servidor MySQL para versão 4.1 ou superior"
 
-#: includes/system_tests.inc:35
+#: /var/www/fa2.3/devel/../includes/system_tests.inc:35
 msgid "PHP MySQL extension"
 msgstr "Extensão PHP MySQL"
 
-#: includes/system_tests.inc:40
+#: /var/www/fa2.3/devel/../includes/system_tests.inc:40
 msgid "Your PHP has to have MySQL extension enabled."
 msgstr "Seu PHP deve ter extensão de MySQL habilitada."
 
-#: includes/system_tests.inc:46
+#: /var/www/fa2.3/devel/../includes/system_tests.inc:46
 msgid "PHP version"
 msgstr "Versão do PHP"
 
-#: includes/system_tests.inc:50
+#: /var/www/fa2.3/devel/../includes/system_tests.inc:50
 msgid "Upgrade PHP to version at least 4.3.3"
 msgstr "Atualize o PHP para versão 4.3.3 ou superior"
 
-#: includes/system_tests.inc:57
+#: /var/www/fa2.3/devel/../includes/system_tests.inc:57
 msgid "Server system"
 msgstr "Sistema do Servidor"
 
-#: includes/system_tests.inc:67
+#: /var/www/fa2.3/devel/../includes/system_tests.inc:67
 msgid "Session save path"
 msgstr "Endereço de gravação da seção"
 
-#: includes/system_tests.inc:79
+#: /var/www/fa2.3/devel/../includes/system_tests.inc:79
 msgid "Removed install wizard folder"
 msgstr "Removida a pasta do assistente de instalação"
 
-#: includes/system_tests.inc:82
+#: /var/www/fa2.3/devel/../includes/system_tests.inc:82
 msgid "Not removed"
 msgstr "Não removido"
 
-#: includes/system_tests.inc:83
+#: /var/www/fa2.3/devel/../includes/system_tests.inc:83
 msgid "Remove or rename install wizard folder for security reasons."
 msgstr "Remover ou renomear a pasta do assistente de instalação por motivos de segurança."
 
-#: includes/system_tests.inc:90
+#: /var/www/fa2.3/devel/../includes/system_tests.inc:90
 msgid "Browser type"
 msgstr "Tipo do navegador"
 
-#: includes/system_tests.inc:94
+#: /var/www/fa2.3/devel/../includes/system_tests.inc:94
 msgid "Any browser is supported"
 msgstr "Qualquer navegador é compatível"
 
-#: includes/system_tests.inc:101
+#: /var/www/fa2.3/devel/../includes/system_tests.inc:101
 msgid "Http server type"
 msgstr "Tipo de servidor Http"
 
-#: includes/system_tests.inc:105
+#: /var/www/fa2.3/devel/../includes/system_tests.inc:105
 msgid "Any server is supported"
 msgstr "Qualquer servidor é compatível"
 
-#: includes/system_tests.inc:112
+#: /var/www/fa2.3/devel/../includes/system_tests.inc:112
 msgid "Native gettext"
 msgstr "gettext nativo"
 
-#: includes/system_tests.inc:116
-#, fuzzy
-msgid "In case of no gettext support, php emulation is used"
+#: /var/www/fa2.3/devel/../includes/system_tests.inc:116
+msgid "In case of no getext support, php emulation is used"
 msgstr "Na falta de suporte getext, a emulação php será usada"
 
-#: includes/system_tests.inc:124
+#: /var/www/fa2.3/devel/../includes/system_tests.inc:124
 msgid "Debugging mode"
 msgstr "Modo de depuração (debug)"
 
-#: includes/system_tests.inc:128
+#: /var/www/fa2.3/devel/../includes/system_tests.inc:128
 msgid "To switch debugging on set $go_debug>0 in config.php file"
 msgstr "Para ativar depuração (debug) inclua $go_debug>0 no arquivo config.php"
 
-#: includes/system_tests.inc:137
+#: /var/www/fa2.3/devel/../includes/system_tests.inc:137
 msgid "Error logging"
 msgstr "Log de erros"
 
-#: includes/system_tests.inc:145
+#: /var/www/fa2.3/devel/../includes/system_tests.inc:145
 msgid "Disabled"
 msgstr "Desabilitado"
 
-#: includes/system_tests.inc:148
+#: /var/www/fa2.3/devel/../includes/system_tests.inc:148
 msgid "To switch error logging set $error_logging in config.php file"
 msgstr "Para logar erros inclua $error_logging no arquivo config.php"
 
-#: includes/system_tests.inc:151
+#: /var/www/fa2.3/devel/../includes/system_tests.inc:151
 msgid "Log file is not writeable"
 msgstr "Arquivo de log não é gravável"
 
-#: includes/system_tests.inc:161
+#: /var/www/fa2.3/devel/../includes/system_tests.inc:161
 msgid "Current database version"
 msgstr "Versão do banco de dados atual"
 
-#: includes/system_tests.inc:165
+#: /var/www/fa2.3/devel/../includes/system_tests.inc:165
 msgid "Database structure seems to be not upgraded to current version"
 msgstr "A estrutura do banco de dados não foi atualizada para a versão atual"
 
-#: includes/system_tests.inc:180
+#: /var/www/fa2.3/devel/../includes/system_tests.inc:180
 msgid "Company subdirectories consistency"
 msgstr "Consistência de subdiretórios da empresa"
 
-#: includes/system_tests.inc:193
-#: includes/system_tests.inc:200
-#: includes/system_tests.inc:208
-#: includes/system_tests.inc:225
-#: includes/system_tests.inc:340
-#: includes/system_tests.inc:349
-#: includes/system_tests.inc:358
+#: /var/www/fa2.3/devel/../includes/system_tests.inc:193
+#: /var/www/fa2.3/devel/../includes/system_tests.inc:200
+#: /var/www/fa2.3/devel/../includes/system_tests.inc:208
+#: /var/www/fa2.3/devel/../includes/system_tests.inc:225
+#: /var/www/fa2.3/devel/../includes/system_tests.inc:345
 #, php-format
 msgid "'%s' is not writeable"
 msgstr "'%s' não é gravável"
 
-#: includes/system_tests.inc:221
+#: /var/www/fa2.3/devel/../includes/system_tests.inc:221
 msgid "Temporary directory"
 msgstr "Diretório temporário"
 
-#: includes/system_tests.inc:233
+#: /var/www/fa2.3/devel/../includes/system_tests.inc:233
 msgid "Language configuration consistency"
 msgstr "Consistência de configuração de idioma"
 
-#: includes/system_tests.inc:242
+#: /var/www/fa2.3/devel/../includes/system_tests.inc:242
 msgid "Languages folder should be writeable."
 msgstr "Diretório de idiomas deveria ser gravável."
 
-#: includes/system_tests.inc:251
+#: /var/www/fa2.3/devel/../includes/system_tests.inc:250
 msgid "Languages configuration file should be writeable."
 msgstr "O arquivo de configuração de idiomas deve ser gravável."
 
-#: includes/system_tests.inc:270
+#: /var/www/fa2.3/devel/../includes/system_tests.inc:268
 #, php-format
 msgid "Missing %s translation file."
 msgstr "Falta o arquivo de tradução %s."
 
-#: includes/system_tests.inc:275
+#: /var/www/fa2.3/devel/../includes/system_tests.inc:273
 #, php-format
 msgid "Missing system locale: %s"
 msgstr "Falta localidade (locale) do sistema: %s"
 
-#: includes/system_tests.inc:288
+#: /var/www/fa2.3/devel/../includes/system_tests.inc:286
 msgid "Main config file"
 msgstr "Arquivo de configuração principal"
 
-#: includes/system_tests.inc:295
-#: includes/system_tests.inc:317
+#: /var/www/fa2.3/devel/../includes/system_tests.inc:293
+#: /var/www/fa2.3/devel/../includes/system_tests.inc:315
 #, php-format
 msgid "Can't write '%s' file. Check FA directory write permissions."
 msgstr "Não é possível escrever no arquivo '%s'. Verifique a permissõe de escrita do diretório FA"
 
-#: includes/system_tests.inc:296
-#: includes/system_tests.inc:318
+#: /var/www/fa2.3/devel/../includes/system_tests.inc:294
+#: /var/www/fa2.3/devel/../includes/system_tests.inc:316
 #, php-format
 msgid "'%s' file exists."
 msgstr "O arquivo '%s' existente."
 
-#: includes/system_tests.inc:300
+#: /var/www/fa2.3/devel/../includes/system_tests.inc:298
 #, php-format
 msgid "'%s' file should be read-only"
 msgstr "O arquivo '%s' deve ser somente leitura"
 
-#: includes/system_tests.inc:309
+#: /var/www/fa2.3/devel/../includes/system_tests.inc:307
 msgid "Database auth file"
 msgstr "Arquivo de autorização da base de dados"
 
-#: includes/system_tests.inc:322
+#: /var/www/fa2.3/devel/../includes/system_tests.inc:320
 #, php-format
-msgid "'%s' file should be read-only if you do not plan to add or change companies"
-msgstr "O arquivo '%s' deve ser somente leitura se você não planeja adicionar ou alterar empresas"
+msgid ""
+"'%s' file should be read-only if you do not plan to add or change companies"
+msgstr ""
+"O arquivo '%s' deve ser somente leitura se você não planeja adicionar ou alterar empresas"
 
-#: includes/system_tests.inc:333
+#: /var/www/fa2.3/devel/../includes/system_tests.inc:331
 msgid "Extensions system"
 msgstr "Sistema de extensões"
 
-#: includes/system_tests.inc:363
+#: /var/www/fa2.3/devel/../includes/system_tests.inc:366
 msgid "Extensions configuration files and directories should be writeable"
 msgstr "Extensões de arquivos de configuração e diretórios devem ser graváveis"
 
-#: includes/system_tests.inc:375
+#: /var/www/fa2.3/devel/../includes/system_tests.inc:378
 #, php-format
 msgid "Non-standard theme directory '%s' is not writable"
 msgstr "Descrição de diretório sem-padrão '%s' não é gravável"
 
-#: includes/system_tests.inc:385
-msgid "OpenSSL PHP extension have to be enabled to use extension repository system."
-msgstr "A extensão OpenSSL PHP tem que estar habilitada para usar o repositório de extensão."
+#: /var/www/fa2.3/devel/../includes/system_tests.inc:388
+msgid ""
+"OpenSSL PHP extension have to be enabled to use extension repository system."
+msgstr ""
+"A extensão OpenSSL PHP tem que estar habilitada para usar o repositório de extensão."
 
-#: includes/system_tests.inc:388
-msgid "OpenSSL have to be available on your server to use extension repository system."
-msgstr "OpenSSL deve estar disponível no seu servidor para utilizar o repositório de extensão."
+#: /var/www/fa2.3/devel/../includes/system_tests.inc:391
+msgid ""
+"OpenSSL have to be available on your server to use extension repository "
+"system."
+msgstr ""
+"OpenSSL deve estar disponível no seu servidor para utilizar o repositório "
+"de extensão."
 
-#: includes/system_tests.inc:411
+#: /var/www/fa2.3/devel/../includes/system_tests.inc:414
 msgid "Test"
 msgstr "Teste"
 
-#: includes/system_tests.inc:411
+#: /var/www/fa2.3/devel/../includes/system_tests.inc:414
 msgid "Test type"
 msgstr "Tipo de teste"
 
-#: includes/system_tests.inc:411
+#: /var/www/fa2.3/devel/../includes/system_tests.inc:414
 msgid "Value"
 msgstr "Valor"
 
-#: includes/system_tests.inc:411
+#: /var/www/fa2.3/devel/../includes/system_tests.inc:414
 msgid "Comments"
 msgstr "Comentários"
 
-#: includes/system_tests.inc:435
+#: /var/www/fa2.3/devel/../includes/system_tests.inc:438
 msgid "Ok"
 msgstr "Ok"
-
-#: includes/packages.inc:190
-#, php-format
-msgid "No key field '%s' in file '%s'"
-msgstr ""
-
-#: includes/packages.inc:295
-msgid "Release file in repository is invalid, or public key is outdated."
-msgstr ""
-
-#: includes/packages.inc:311
-msgid "Repository version does not match application version."
-msgstr ""
-
-#: includes/packages.inc:325
-#, php-format
-msgid "Security alert: broken index file in repository '%s'. Please inform repository administrator about this issue."
-msgstr ""
-
-#: includes/packages.inc:358
-#, php-format
-msgid "Security alert: broken package '%s' in repository. Please inform repository administrator about this issue."
-msgstr ""
-
-#: includes/packages.inc:613
-#: includes/packages.inc:664
-#, php-format
-msgid "Package '%s' not found."
-msgstr ""
-
index cba646365a9e7e7e91688e09f77f3d31881edb3c..51edf4d4ed86495b9390c7176c64bbf8be80bc5c 100644 (file)
@@ -113,7 +113,7 @@ function can_process()
        } 
        elseif (!is_date_in_fiscalyear($_POST['AdjDate'])) 
        {
-               display_error(_("The entered date is not in fiscal year."));
+               display_error(_("The entered date is out of fiscal year or is closed for further data entry."));
                set_focus('AdjDate');
                return false;
        } else {
index b5ee125dd966fab6f3094b8360c60692e950d428..0e39a0c050c33f6fe5799b5e79f9bf40b46ed728 100644 (file)
@@ -39,7 +39,7 @@ if (isset($_POST['UpdateData']))
 {
 
        $old_cost = get_standard_cost($_POST['stock_id']);
-     
+
        $new_cost = input_num('material_cost') + input_num('labour_cost')
             + input_num('overhead_cost');
 
index 78930e81d9bce8ca9dc4132646aa25fa9664ef0e..923d18c4f79f5dc65690186196360203e78f1f16 100644 (file)
@@ -51,6 +51,12 @@ function stock_cost_update($stock_id, $material_cost, $labour_cost, $overhead_co
        {
                $new_cost = $material_cost + $labour_cost + $overhead_cost;
 
+               $value_of_change = $qoh * ($new_cost - $last_cost);
+
+               $memo_ = "Cost was " . $last_cost . " changed to " . $new_cost . " x quantity on hand of $qoh";
+               add_gl_trans_std_cost(ST_COSTUPDATE, $update_no, $date_, $stock_gl_code["adjustment_account"], 
+                       $stock_gl_code["dimension_id"], $stock_gl_code["dimension2_id"], $memo_, (-$value_of_change));     
+
                $value_of_change = round2($qoh * ($new_cost - $last_cost), user_price_dec());
 
                if ($value_of_change != 0)
@@ -63,7 +69,7 @@ function stock_cost_update($stock_id, $material_cost, $labour_cost, $overhead_co
 
                        add_gl_trans_std_cost(ST_COSTUPDATE, $update_no, $date_, $stock_gl_code["inventory_account"], 0, 0, $memo_, 
                                $value_of_change);
-               }               
+               }
        }
 
        add_audit_trail(ST_COSTUPDATE, $update_no, $date_);
index 2c5aa0e044b6c77a139190e9850f43a56288c590..417b5df5c6ad7b9440e95aa89d970998bd1879c7 100644 (file)
@@ -18,15 +18,12 @@ include_once($path_to_root . "/includes/banking.inc");
 include_once($path_to_root . "/sales/includes/sales_db.inc");
 
 include_once($path_to_root . "/includes/ui.inc");
-if (!@$_GET['popup'])
-{
-       $js = "";
-       if ($use_popup_windows)
-               $js .= get_js_open_window(800, 500);
-       if ($use_date_picker)
-               $js .= get_js_date_picker();
-       page(_($help_context = "Inventory Item Movement"), @$_GET['popup'], false, "", $js);
-}      
+$js = "";
+if ($use_popup_windows)
+       $js .= get_js_open_window(800, 500);
+if ($use_date_picker)
+       $js .= get_js_date_picker();
+page(_($help_context = "Inventory Item Movement"), @$_GET['popup'], false, "", $js);
 //------------------------------------------------------------------------------------------------
 
 check_db_has_stock_items(_("There are no items defined in the system."));
@@ -41,15 +38,14 @@ if (isset($_GET['stock_id']))
        $_POST['stock_id'] = $_GET['stock_id'];
 }
 
-if (!@$_GET['popup'])
-       start_form();
+start_form();
 
 if (!isset($_POST['stock_id']))
        $_POST['stock_id'] = get_global_stock_item();
 
 start_table(TABLESTYLE_NOBORDER);
 start_row();
-if (!@$_GET['popup'])
+if (!$page_nested)
        stock_costable_items_list_cells(_("Item:"), 'stock_id', $_POST['stock_id']);
 end_row();
 end_table();
@@ -190,7 +186,6 @@ end_row();
 
 end_table(1);
 div_end();
-if (!@$_GET['popup'])
-       end_page(@$_GET['popup'], false, false);
+end_page();
 
 ?>
index b6965d2961c78602852f29db014ef7ac9d65eb5b..146422fa6bfc5772fa8a924b0f364314901806e9 100644 (file)
@@ -13,16 +13,11 @@ $page_security = 'SA_ITEMSSTATVIEW';
 $path_to_root = "../..";
 include_once($path_to_root . "/includes/session.inc");
 
-if (!@$_GET['popup'])
-{
-       if (isset($_GET['stock_id'])){
-               page(_($help_context = "Inventory Item Status"), true);
-       } else {
-               page(_($help_context = "Inventory Item Status"));
-       }
-}
+page(_($help_context = "Inventory Item Status"));
+
 if (isset($_GET['stock_id']))
        $_POST['stock_id'] = $_GET['stock_id'];
+
 include_once($path_to_root . "/includes/date_functions.inc");
 include_once($path_to_root . "/includes/ui.inc");
 include_once($path_to_root . "/includes/manufacturing.inc");
@@ -36,17 +31,16 @@ if (list_updated('stock_id'))
 
 check_db_has_stock_items(_("There are no items defined in the system."));
 
-if (!@$_GET['popup'])
-       start_form();
+start_form();
 
 if (!isset($_POST['stock_id']))
        $_POST['stock_id'] = get_global_stock_item();
 
-if (!@$_GET['popup'])
+if (!$page_nested)
 {
        echo "<center> " . _("Item:"). " ";
        echo stock_costable_items_list('stock_id', $_POST['stock_id'], false, true);
-}      
+}
 echo "<br>";
 
 echo "<hr></center>";
@@ -122,10 +116,7 @@ while ($myrow = db_fetch($loc_details))
 
 end_table();
 div_end();
-if (!@$_GET['popup'])
-{
-       end_form();
-       end_page(@$_GET['popup'], false, false);
-}      
+end_form();
+end_page();
 
 ?>
index 666486f08b94ddd1295210e20c122d80e8547feb..70572f59fed52f10d7245ca162d4941a38af1864 100644 (file)
 $page_security = 'SA_ITEM';
 $path_to_root = "../..";
 include($path_to_root . "/includes/session.inc");
+
 $js = "";
 if ($use_popup_windows)
        $js .= get_js_open_window(900, 500);
 if ($use_date_picker)
        $js .= get_js_date_picker();
        
-page(_($help_context = "Items"), false, false, "", $js);
+page(_($help_context = "Items"), @$_REQUEST['popup'], false, "", $js);
+
 
 include_once($path_to_root . "/includes/date_functions.inc");
 include_once($path_to_root . "/includes/ui.inc");
@@ -85,6 +87,11 @@ if (isset($_FILES['pic']) && $_FILES['pic']['name'] != '')
                display_warning(_('The file size is over the maximum allowed. The maximum size allowed in KB is') . ' ' . $max_image_size);
                $upload_file ='No';
        } 
+       elseif ( $_FILES['pic']['type'] == "text/plain" ) 
+       {  //File type Check
+               display_warning( _('Only graphics files can be uploaded'));
+               $upload_file ='No';
+       } 
        elseif (file_exists($filename))
        {
                $result = unlink($filename);
@@ -477,7 +484,6 @@ tabbed_content_end();
 
 div_end();
 
-
 hidden('popup', @$_REQUEST['popup']);
 end_form();
 
index 26859e59a19c2b0939ddb698efeec2e98709ee5a..b4cc678e452c3a31b35f9a8fd9bd007bde1a0a4a 100644 (file)
@@ -108,7 +108,7 @@ if (isset($_POST['Process']))
        } 
        elseif (!is_date_in_fiscalyear($_POST['AdjDate'])) 
        {
-               display_error(_("The entered date is not in fiscal year."));
+               display_error(_("The entered date is out of fiscal year or is closed for further data entry."));
                set_focus('AdjDate');
                $input_error = 1;
        } 
diff --git a/manufacturing/includes/db/work_order_costing_db.inc b/manufacturing/includes/db/work_order_costing_db.inc
new file mode 100644 (file)
index 0000000..bf4493c
--- /dev/null
@@ -0,0 +1,188 @@
+<?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>.
+***********************************************************************/
+
+function add_wo_costing($workorder_id, $cost_type, $trans_type, $trans_no, $factor=1)
+{
+       $sql = "INSERT INTO ".TB_PREF."wo_costing (workorder_id, cost_type, trans_type, trans_no, factor)
+               VALUES (".db_escape($workorder_id).","
+               .db_escape($cost_type).",".db_escape($trans_type).","
+               .db_escape($trans_no).",".db_escape($factor).")";
+
+       db_query($sql, "could not add work order costing");
+
+}
+
+function get_wo_costing($workorder_id)
+{
+       $sql="SELECT * FROM ".TB_PREF."wo_costing WHERE workorder_id=".db_escape($workorder_id);
+
+       return db_query($sql, "could not get work order costing");
+}
+
+function delete_wo_costing($trans_type, $trans_no)
+{
+       $sql="DELETE FROM ".TB_PREF."wo_costing WHERE trans_type=".db_escape($trans_type)
+               ." AND trans_no=".db_escape($trans_no);
+
+       db_query($sql, "could not delete work order costing");
+}
+
+//--------------------------------------------------------------------------------------
+
+function add_material_cost($stock_id, $qty, $date_)
+{
+       $m_cost = 0;
+    $result = get_bom($stock_id);
+       while ($bom_item = db_fetch($result))
+       {
+               $standard_cost = get_standard_cost($bom_item['component']);
+               $m_cost += ($bom_item['quantity'] * $standard_cost);
+       }
+       //$dec = user_price_dec();
+       //price_decimal_format($m_cost, $dec);
+       $sql = "SELECT material_cost FROM ".TB_PREF."stock_master WHERE stock_id = "
+               .db_escape($stock_id);
+       $result = db_query($sql);
+       $myrow = db_fetch($result);
+       $material_cost =  $myrow['material_cost'];
+       //$qoh = get_qoh_on_date($stock_id, null, $date_);
+       $qoh = get_qoh_on_date($stock_id);
+       if ($qoh < 0)
+               $qoh = 0;
+       if ($qoh + $qty != 0)   
+               $material_cost = ($qoh * $material_cost + $qty * $m_cost) /     ($qoh + $qty);
+       //$material_cost = round2($material_cost, $dec);        
+       $sql = "UPDATE ".TB_PREF."stock_master SET material_cost=$material_cost
+               WHERE stock_id=".db_escape($stock_id);
+       db_query($sql,"The cost details for the inventory item could not be updated");
+}
+
+function add_overhead_cost($stock_id, $qty, $date_, $costs)
+{
+       //$dec = user_price_dec();
+       //price_decimal_format($costs, $dec); 
+       if ($qty != 0)
+               $costs /= $qty;
+       $sql = "SELECT overhead_cost FROM ".TB_PREF."stock_master WHERE stock_id = "
+               .db_escape($stock_id);
+       $result = db_query($sql);
+       $myrow = db_fetch($result);
+       $overhead_cost =  $myrow['overhead_cost'];
+       //$qoh = get_qoh_on_date($stock_id, null, $date_);
+       $qoh = get_qoh_on_date($stock_id);
+       if ($qoh < 0)
+               $qoh = 0;
+       if ($qoh + $qty != 0)   
+               $overhead_cost = ($qoh * $overhead_cost + $qty * $costs) /      ($qoh + $qty);
+       //$overhead_cost = round2($overhead_cost, $dec);        
+       $sql = "UPDATE ".TB_PREF."stock_master SET overhead_cost=".db_escape($overhead_cost)."
+               WHERE stock_id=".db_escape($stock_id);
+       db_query($sql,"The cost details for the inventory item could not be updated");
+}
+
+function add_labour_cost($stock_id, $qty, $date_, $costs)
+{
+       //$dec = user_price_dec();
+       //price_decimal_format($costs, $dec); 
+       if ($qty != 0)
+               $costs /= $qty;
+       $sql = "SELECT labour_cost FROM ".TB_PREF."stock_master WHERE stock_id = "
+               .db_escape($stock_id);
+       $result = db_query($sql);
+       $myrow = db_fetch($result);
+       $labour_cost =  $myrow['labour_cost'];
+       //$qoh = get_qoh_on_date($stock_id, null, $date_);
+       $qoh = get_qoh_on_date($stock_id);
+       if ($qoh < 0)
+               $qoh = 0;
+       if ($qoh + $qty != 0)   
+               $labour_cost = ($qoh * $labour_cost + $qty * $costs) /  ($qoh + $qty);
+       //$labour_cost = round2($labour_cost, $dec);    
+       $sql = "UPDATE ".TB_PREF."stock_master SET labour_cost=".db_escape($labour_cost)."
+               WHERE stock_id=".db_escape($stock_id);
+       db_query($sql,"The cost details for the inventory item could not be updated");
+}
+
+function add_issue_cost($stock_id, $qty, $date_, $costs)
+{
+       if ($qty != 0)
+               $costs /= $qty;
+       $sql = "SELECT material_cost FROM ".TB_PREF."stock_master WHERE stock_id = "
+               .db_escape($stock_id);
+       $result = db_query($sql);
+       $myrow = db_fetch($result);
+       $material_cost =  $myrow['material_cost'];
+       //$dec = user_price_dec();
+       //price_decimal_format($material_cost, $dec); 
+       //$qoh = get_qoh_on_date($stock_id, null, $date_);
+       $qoh = get_qoh_on_date($stock_id);
+       if ($qoh < 0)
+               $qoh = 0;
+       if ($qoh + $qty != 0)   
+               $material_cost = ($qty * $costs) /      ($qoh + $qty);
+       //$material_cost = round2($material_cost, $dec);        
+       $sql = "UPDATE ".TB_PREF."stock_master SET material_cost=material_cost+"
+               .db_escape($material_cost)
+               ." WHERE stock_id=".db_escape($stock_id);
+       db_query($sql,"The cost details for the inventory item could not be updated");
+}
+
+/*
+       Create journal entry for WO related costs.
+*/
+function add_wo_costs_journal($wo_id, $amount, $cost_type, $cr_acc, $db_acc, $date, $dim1=0, $dim2=0, $memo = null, $ref= null)
+{
+//-------- this should be done by single call to write_journal_entries() using items_cart()
+//
+       global $Refs, $wo_cost_types;
+
+       begin_transaction();
+
+    $journal_id = get_next_trans_no(ST_JOURNAL);
+    if (!$ref) $ref = $Refs->get_next(ST_JOURNAL);
+
+       add_gl_trans_std_cost(ST_JOURNAL, $journal_id, $date, $cr_acc,
+               0, 0, $wo_cost_types[$cost_type], -$amount);
+       $is_bank_to = is_bank_account($cr_acc);
+       if ($is_bank_to)
+       {
+               add_bank_trans(ST_JOURNAL, $journal_id, $is_bank_to, "",
+                       $date, -$amount, PT_WORKORDER, $wo_id, get_company_currency(),
+                       "Cannot insert a destination bank transaction");
+       }
+
+       add_gl_trans_std_cost(ST_JOURNAL, $journal_id, $date, $db_acc,
+               $dim1, $dim2,  $wo_cost_types[$cost_type], $amount);
+
+       $Refs->save(ST_JOURNAL, $journal_id, $ref);
+
+       add_wo_costing($wo_id, $cost_type, ST_JOURNAL, $journal_id);
+
+       add_comments(ST_JOURNAL, $journal_id, $date, $memo);
+       add_audit_trail(ST_JOURNAL, $journal_id, $date);
+
+       commit_transaction();
+}
+
+function void_wo_costing($wo_id)
+{
+       $res = get_wo_costing($wo_id);
+
+       while($row = db_fetch($res))
+       {
+               // void any related gl trans
+               void_gl_trans($row['trans_type'], $row['trans_no'], true);
+       }
+
+       $sql = "DELETE FROM ".TB_PREF."wo_costing WHERE workorder_id=".db_escape($wo_id);
+       db_query($sql, "could not delete work order costing");
+}
index ca2f4a86883b5d213f556cc460a5c738b3b41275..8b7f7f7db36c82d2ef12b505807a5f3b295743b9 100644 (file)
@@ -70,13 +70,13 @@ function add_work_order_issue($woid, $ref, $to_work_order, $items, $location, $w
                $issue_cost = $standard_cost * $item->quantity;
                $issue = get_stock_gl_code($item->stock_id);
         $stockitem = get_item($item->stock_id);
-               
+
                //Chaitanya : Compatibility for Service Items
                if (!is_service($issue["mb_flag"]))
                        $ivaccount = $issue["inventory_account"];
                else
                        $ivaccount = $issue["cogs_account"];            
-               
+
         $total_cost += add_gl_trans_std_cost(ST_WORKORDER, $woid, $date_, $ivaccount, 0, 0,
                 $date_.": "._("Issue of")." ".$stockitem["description"], -$issue_cost);                        
                $issue_total += $issue_cost;
@@ -166,7 +166,7 @@ function void_work_order_issue($type_no)
 {
        begin_transaction();
        hook_db_prevoid(ST_MANUISSUE, $type_no);
-       
+
        //Chaitanya : Skip processing already voided entry i.e. explicitly voided
        $void_entry = get_voided_entry(ST_MANUISSUE, $type_no);
        if ($void_entry)
@@ -186,7 +186,7 @@ function void_work_order_issue($type_no)
        $manf_stock_id = $issue["stock_id"];
        $date_ = sql2date($issue["issue_date"]);
        $woid = $issue["workorder_id"];
-               
+
        $result = get_stock_moves(ST_MANUISSUE, $type_no);
        $total_cost = 0;
        $issue_total = 0;
@@ -195,18 +195,18 @@ function void_work_order_issue($type_no)
                $issue_cost = $myrow["qty"]*$myrow["standard_cost"];
                $issue = get_stock_gl_code($myrow["stock_id"]);
         $stockitem = get_item($myrow["stock_id"]);
-               
+
                //Chaitanya : Compatibility for Service Items
                if (!is_service($issue["mb_flag"]))
                        $ivaccount = $issue["inventory_account"];
                else
-                       $ivaccount = $issue["cogs_account"];            
-               
+                       $ivaccount = $issue["cogs_account"];
+
                if ($issue_cost != 0)
                {
                        $total_cost += add_gl_trans_std_cost(ST_WORKORDER, $woid, $date_, $ivaccount, 0, 0,
                                $date_.": "._("Reversed the issue of")." ".$stockitem["description"],
-                               -$issue_cost);                  
+                               -$issue_cost);
                        $issue_total += $issue_cost;
                }
        }
@@ -219,10 +219,10 @@ function void_work_order_issue($type_no)
                add_gl_trans_std_cost(ST_WORKORDER, $woid, $date_, $issue["inventory_account"],
                        0, 0, $date_.": "._("Reversed the issue to")." ".$stockitem["description"], 
                        -$total_cost);  
-       
+
        //Chaitanya : Shifted below void all related stock moves
        void_stock_move(ST_MANUISSUE, $type_no);
-       
+
        commit_transaction();
 }
 
index 38af2add9b98efd04427682b1d22abdcb67aa694..dcac240cb831ba4020f5b989cac60b7672c86a85 100644 (file)
@@ -44,11 +44,10 @@ function work_order_produce($woid, $ref, $quantity, $date_, $memo_, $close_wo)
        db_query($sql,"A work order manufacture could not be added");
 
        $id = db_insert_id();
-       
+
        // -------------------------------------------------------------------------
 
        work_order_quick_costs($woid, $details["stock_id"], $quantity, $date_, $id);
-       
        // -------------------------------------------------------------------------
 
        // Chaitanya: stamp BOM cost to finished item
@@ -58,7 +57,7 @@ function work_order_produce($woid, $ref, $quantity, $date_, $memo_, $close_wo)
        {
                $standard_cost = get_standard_cost($bom_item['component']);
                $m_cost += ($bom_item['quantity'] * $standard_cost);
-       }       
+       }
 
        // insert a +ve stock move for the item being manufactured
        // negative means "unproduce" or unassemble
@@ -118,7 +117,7 @@ function void_work_order_produce($type_no)
 {
        begin_transaction();
        hook_db_prevoid(ST_MANURECEIVE, $type_no);
-       
+
        //Chaitanya : Skip processing already voided entry i.e. explicitly voided
        $void_entry = get_voided_entry(ST_MANURECEIVE, $type_no);
        if ($void_entry)
@@ -145,25 +144,24 @@ function void_work_order_produce($type_no)
                $issue_cost = $myrow["qty"]*$myrow["standard_cost"];
                $issue = get_stock_gl_code($myrow["stock_id"]);
         $stockitem = get_item($myrow["stock_id"]);
-               
+
                //Chaitanya : Compatibility for Service Items
                if (!is_service($issue["mb_flag"]))
                        $ivaccount = $issue["inventory_account"];
                else
-                       $ivaccount = $issue["cogs_account"];            
-               
+                       $ivaccount = $issue["cogs_account"];
+
                if ($issue_cost != 0)
                {
                        add_gl_trans_std_cost(ST_WORKORDER, $woid, $date_, $ivaccount, 0, 0,
                                $date_.": "._("Reversed the production ")." ".$stockitem["description"],
                                -$issue_cost);
                }
-       }       
-                       
+       }
        // clear the production record
        $sql = "UPDATE ".TB_PREF."wo_manufacture SET quantity=0 WHERE id=".db_escape($type_no);
-       db_query($sql, "Cannot void a wo production");                  
-       
+       db_query($sql, "Cannot void a wo production");
+
        //Chaitanya : Shifted below
        // void all related stock moves
        void_stock_move(ST_MANURECEIVE, $type_no);
index 2aed7c1912876680a39523f78f77e181dc342497..eb31056809b6c4f81d88bc4b8b9faacfbce5ed2c 100644 (file)
@@ -9,210 +9,6 @@
     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
     See the License here <http://www.gnu.org/licenses/gpl-3.0.html>.
 ***********************************************************************/
-//--------------------------------------------------------------------------------------
-
-function add_material_cost($stock_id, $qty, $date_, $advanced=false)
-{
-       $m_cost = 0;
-    $result = get_bom($stock_id);
-       while ($bom_item = db_fetch($result))
-       {
-               $standard_cost = get_standard_cost($bom_item['component']);
-               $m_cost += ($bom_item['quantity'] * $standard_cost);
-       }
-       $bom_cost = $m_cost;
-       
-       $sql = "SELECT material_cost, labour_cost, overhead_cost FROM ".TB_PREF."stock_master WHERE stock_id = "
-               .db_escape($stock_id);
-       $result = db_query($sql);
-       $myrow = db_fetch($result);
-       $material_cost =  $myrow['material_cost'];
-       
-       if ($advanced)
-       {
-               //reduce overhead_cost and labour_cost from price as those will remain as is
-               $m_cost = $m_cost - $myrow['labour_cost'] - $myrow['overhead_cost'];
-       }
-       
-       $qoh = get_qoh_on_date($stock_id);
-       $cost_adjust = false;
-       if ($qoh < 0)
-       {
-               if ($qoh + $qty >= 0)
-                       $cost_adjust = true;
-               $qoh = 0;
-       }               
-       if ($qoh + $qty != 0)   
-               $material_cost = ($qoh * $material_cost + $qty * $m_cost) /     ($qoh + $qty);
-       
-       if ($advanced && $cost_adjust) // new 2010-02-10
-               adjust_deliveries($stock_id, $bom_cost, $date_);        
-       
-       $sql = "UPDATE ".TB_PREF."stock_master SET material_cost=".db_escape($material_cost)."
-                   WHERE stock_id=".db_escape($stock_id);
-       db_query($sql,"The cost details for the inventory item could not be updated");
-}
-
-function add_overhead_cost($stock_id, $qty, $date_, $costs, $adj_only=false)
-{
-       if ($qty != 0)
-               $costs /= $qty;
-       $sql = "SELECT overhead_cost FROM ".TB_PREF."stock_master WHERE stock_id = "
-               .db_escape($stock_id);
-       $result = db_query($sql);
-       $myrow = db_fetch($result);
-       $overhead_cost =  $myrow['overhead_cost'];
-       $qoh = get_qoh_on_date($stock_id);
-       if ($qoh < 0)
-               $qoh = 0;
-       if ($adj_only)
-       {
-               if ($qty != 0)
-                       $costs = $qty * $costs;
-               if ($qoh>0)
-                       $overhead_cost = ($qoh * $overhead_cost + $costs) / $qoh;
-               else // Journal Entry if QOH is 0/negative \r
-               {
-                       global $Refs;
-
-                       $id = get_next_trans_no(ST_JOURNAL);
-                       $ref = $Refs->get_next(ST_JOURNAL);
-                       
-                       $stock_gl_code = get_stock_gl_code($stock_id);
-                       $memo = "WO Overhead cost settlement JV for zero/negative respository of ".$stock_id;
-                       //Reverse the inventory effect if $qoh <=0
-                       add_gl_trans_std_cost(ST_JOURNAL, $id, $date_, 
-                               $stock_gl_code["inventory_account"],
-                               $stock_gl_code['dimension_id'], $stock_gl_code['dimension2_id'], $memo, 
-                               -$costs);
-                       //GL Posting to inventory adjustment account
-                       add_gl_trans_std_cost(ST_JOURNAL, $id, $date_, 
-                               $stock_gl_code["adjustment_account"],
-                               $stock_gl_code['dimension_id'], $stock_gl_code['dimension2_id'], $memo,
-                               $costs);
-                               
-                       add_audit_trail(ST_JOURNAL, $id, $date_);
-                       add_comments(ST_JOURNAL, $id, $date_, $memo);
-                       $Refs->save(ST_JOURNAL, $id, $ref);     
-               }
-       }
-       else
-       {               
-               if ($qoh + $qty != 0)   
-                       $overhead_cost = ($qoh * $overhead_cost + $qty * $costs) /      ($qoh + $qty);
-       }
-       $sql = "UPDATE ".TB_PREF."stock_master SET overhead_cost=".db_escape($overhead_cost)."
-               WHERE stock_id=".db_escape($stock_id);
-       db_query($sql,"The cost details for the inventory item could not be updated");
-}
-
-function add_labour_cost($stock_id, $qty, $date_, $costs, $adj_only=false)
-{
-       if ($qty != 0)
-               $costs /= $qty;
-       $sql = "SELECT labour_cost FROM ".TB_PREF."stock_master WHERE stock_id = "
-               .db_escape($stock_id);
-       $result = db_query($sql);
-       $myrow = db_fetch($result);
-       $labour_cost =  $myrow['labour_cost'];
-       $qoh = get_qoh_on_date($stock_id);
-       if ($qoh < 0)
-               $qoh = 0;
-       if ($adj_only)
-       {
-               if ($qty != 0)
-                       $costs = $qty * $costs;
-               if ($qoh>0)
-                       $labour_cost = ($qoh * $labour_cost + $costs) / $qoh;   
-               else // Journal Entry if QOH is 0/negative \r
-               {
-                       global $Refs;
-
-                       $id = get_next_trans_no(ST_JOURNAL);
-                       $ref = $Refs->get_next(ST_JOURNAL);
-                       
-                       $stock_gl_code = get_stock_gl_code($stock_id);
-                       $memo = "WO labour cost settlement JV for zero/negative respository of ".$stock_id;
-                       //Reverse the inventory effect if $qoh <=0
-                       add_gl_trans_std_cost(ST_JOURNAL, $id, $date_, 
-                               $stock_gl_code["inventory_account"],
-                               $stock_gl_code['dimension_id'], $stock_gl_code['dimension2_id'], $memo, 
-                               -$costs);
-                       //GL Posting to inventory adjustment account
-                       add_gl_trans_std_cost(ST_JOURNAL, $id, $date_, 
-                               $stock_gl_code["adjustment_account"],
-                               $stock_gl_code['dimension_id'], $stock_gl_code['dimension2_id'], $memo,
-                               $costs);
-                               
-                       add_audit_trail(ST_JOURNAL, $id, $date_);
-                       add_comments(ST_JOURNAL, $id, $date_, $memo);
-                       $Refs->save(ST_JOURNAL, $id, $ref);     
-               }
-       }
-       else
-       {               
-               if ($qoh + $qty != 0)   
-                       $labour_cost = ($qoh * $labour_cost + $qty * $costs) /  ($qoh + $qty);
-       }       \r
-       $sql = "UPDATE ".TB_PREF."stock_master SET labour_cost=".db_escape($labour_cost)."
-               WHERE stock_id=".db_escape($stock_id);
-       db_query($sql,"The cost details for the inventory item could not be updated");
-}
-
-function add_issue_cost($stock_id, $qty, $date_, $costs, $adj_only=false)
-{
-       if ($qty != 0)
-               $costs /= $qty;
-       $sql = "SELECT material_cost FROM ".TB_PREF."stock_master WHERE stock_id = "
-               .db_escape($stock_id);
-       $result = db_query($sql);
-       $myrow = db_fetch($result);
-       $material_cost =  $myrow['material_cost'];
-       $qoh = get_qoh_on_date($stock_id);
-       if ($qoh < 0)
-               $qoh = 0;
-       if ($adj_only)
-       {
-               if ($qty != 0)
-                       $costs = $qty * $costs;
-               if ($qoh>0)
-                       $material_cost = $costs / $qoh;
-               else // Journal Entry if QOH is 0/negative\r
-               {
-                       global $Refs;
-
-                       $id = get_next_trans_no(ST_JOURNAL);
-                       $ref = $Refs->get_next(ST_JOURNAL);
-                       
-                       $stock_gl_code = get_stock_gl_code($stock_id);
-                       $memo = "WO Issue settlement JV for zero/negative respository of ".$stock_id;
-                       //Reverse the inventory effect if $qoh <=0
-                       add_gl_trans_std_cost(ST_JOURNAL, $id, $date_, 
-                               $stock_gl_code["inventory_account"],
-                               $stock_gl_code['dimension_id'], $stock_gl_code['dimension2_id'], $memo, 
-                               -$costs);
-                       //GL Posting to inventory adjustment account
-                       add_gl_trans_std_cost(ST_JOURNAL, $id, $date_, 
-                               $stock_gl_code["adjustment_account"],
-                               $stock_gl_code['dimension_id'], $stock_gl_code['dimension2_id'], $memo,
-                               $costs);
-                               
-                       add_audit_trail(ST_JOURNAL, $id, $date_);
-                       add_comments(ST_JOURNAL, $id, $date_, $memo);
-                       $Refs->save(ST_JOURNAL, $id, $ref);     
-               }
-       }
-       else
-       {
-               if ($qoh + $qty != 0)   
-                       $material_cost = ($qty * $costs) /      ($qoh + $qty);
-       }       \r
-       $sql = "UPDATE ".TB_PREF."stock_master SET material_cost=material_cost+"
-               .db_escape($material_cost)
-               ." WHERE stock_id=".db_escape($stock_id);
-       db_query($sql,"The cost details for the inventory item could not be updated");
-}
-
 function add_work_order($wo_ref, $loc_code, $units_reqd, $stock_id,
        $type, $date_, $required_by, $memo_, $costs, $cr_acc, $labour, $cr_lab_acc)
 {
@@ -228,6 +24,8 @@ function add_work_order($wo_ref, $loc_code, $units_reqd, $stock_id,
        $args->woid = 0;
        hook_db_prewrite($args, ST_WORKORDER);
 
+       add_material_cost($stock_id, $units_reqd, $date_);
+
        $date = date2sql($date_);
        $required = date2sql($required_by);
 
@@ -263,6 +61,9 @@ function update_work_order($woid, $loc_code, $units_reqd, $stock_id,
                'date_', 'required_by', 'memo_'), $args);
        hook_db_prewrite($args, ST_WORKORDER);
 
+       add_material_cost($_POST['old_stk_id'], -$_POST['old_qty'], $date_);
+       add_material_cost($stock_id, $units_reqd, $date_);
+
        $date = date2sql($date_);
        $required = date2sql($required_by);
 
@@ -286,6 +87,8 @@ function delete_work_order($woid)
        begin_transaction();
        hook_db_prevoid(ST_WORKORDER, $woid);
 
+       add_material_cost($_POST['stock_id'], -$_POST['quantity'], $_POST['date_']);
+
        // delete the work order requirements
        delete_wo_requirements($woid);
 
@@ -370,7 +173,7 @@ function release_work_order($woid, $releaseDate, $memo_)
        create_wo_requirements($woid, $stock_id);
 
        add_comments(ST_WORKORDER, $woid, $releaseDate, $memo_);
-       add_audit_trail(ST_WORKORDER, $woid, $releaseDate,_("Released."));
+       add_audit_trail(ST_WORKORDER, $woid, sql2date($myrow['date_']), _("Released."));
 
        commit_transaction();
 }
@@ -414,6 +217,16 @@ function void_work_order($woid)
        $work_order = get_work_order($woid);
        if (!($work_order["type"] == WO_ADVANCED))
        {
+               $date = sql2date($work_order['date_']);
+               $qty = $work_order['units_reqd'];
+               add_material_cost($work_order['stock_id'], -$qty, $date); // remove avg. cost for qty
+               $cost = get_gl_wo_cost($woid, WO_LABOUR); // get the labour cost and reduce avg cost
+               if ($cost != 0)
+                       add_labour_cost($work_order['stock_id'], -$qty, $date, $cost);
+               $cost = get_gl_wo_cost($woid, WO_OVERHEAD); // get the overhead cost and reduce avg cost
+               if ($cost != 0)
+                       add_overhead_cost($work_order['stock_id'], -$qty, $date, $cost);
+
                $sql = "UPDATE ".TB_PREF."workorders SET closed=1,units_reqd=0,units_issued=0 WHERE id = "
                        .db_escape($woid);
                db_query($sql, "The work order couldn't be voided");
@@ -421,8 +234,7 @@ function void_work_order($woid)
                // void all related stock moves
                void_stock_move(ST_WORKORDER, $woid);
 
-               // void any related bank/gl trans
-               void_bank_trans(ST_WORKORDER, $woid, true);
+               void_wo_costing($woid);
 
                // clear the requirements units received
                void_wo_requirements($woid);
@@ -431,47 +243,44 @@ function void_work_order($woid)
        {
                // void everything inside the work order : issues, productions, payments
                $date = sql2date($work_order['date_']);
-               
+               add_material_cost($work_order['stock_id'], -$work_order['units_reqd'], $date); // remove avg. cost for qty
                $result = get_work_order_productions($woid); // check the produced quantity
                $qty = 0;
                while ($row = db_fetch($result))
                {
-                       void_work_order_produce($row['id']);
+                       $qty += $row['quantity'];
+                       // clear the production record
+                       $sql = "UPDATE ".TB_PREF."wo_manufacture SET quantity=0 WHERE id=".$$row['id'];
+                       db_query($sql, "Cannot void a wo production");
                        
-                       //Post voided entry if not prevoided explicitly
-                       $void_entry = get_voided_entry(ST_MANURECEIVE, $row['id']);
-                       if ($void_entry)
-                               continue;
-                       $memo_ = _("Voiding Work Order Trans # ").$woid;
-                       add_audit_trail(ST_MANURECEIVE, $row['id'], today(), _("Voided.")."\n".$memo_);
-                       add_voided_entry(ST_MANURECEIVE, $row['id'], today(), $memo_);\r
+                       void_stock_move(ST_MANURECEIVE, $row['id']); // and void the stock moves; 
                }
-\r
-               $result = get_work_order_issues($woid);
+               $result = get_additional_issues($woid); // check the issued quantities
                $cost = 0;
                $issue_no = 0;
                while ($row = db_fetch($result))
                {
-                       void_work_order_issue($row['issue_no']);
-                       
-                       //Post voided entry if not prevoided explicitly
-                       $void_entry = get_voided_entry(ST_MANUISSUE, $row['issue_no']);
-                       if ($void_entry)
-                               continue;
-                       $memo_ = _("Voiding Work Order Trans # ").$woid;
-                       add_audit_trail(ST_MANUISSUE, $row['issue_no'], today(), _("Voided.")."\n".$memo_);
-                       add_voided_entry(ST_MANUISSUE, $row['issue_no'], today(), $memo_);                              
-               }
+                       $std_cost = get_standard_cost($row['stock_id']);
+                       $icost = $std_cost * $row['qty_issued'];
+                       $cost += $icost;
+                       if ($issue_no == 0)
+                               $issue_no = $row['issue_no'];
+                       // void the actual issue items and their quantities
+                       $sql = "UPDATE ".TB_PREF."wo_issue_items SET qty_issued = 0 WHERE issue_id="
+                               .db_escape($row['id']);
+                       db_query($sql,"A work order issue item could not be voided");
+               }       
+               if ($issue_no != 0)
+                       void_stock_move(ST_MANUISSUE, $issue_no); // and void the stock moves 
+               if ($cost != 0)
+                       add_issue_cost($work_order['stock_id'], -$qty, $date, $cost);
 
-               //Adust avg labour cost\r
-               $cost = get_gl_wo_cost($woid, WO_LABOUR); \r
+               $cost = get_gl_wo_cost($woid, WO_LABOUR); // get the labour cost and reduce avg cost
                if ($cost != 0)
-                       add_labour_cost($work_order['stock_id'], 1, $date, -$cost, true);
-                       \r
-               //Adust avg overhead cost\r
-               $cost = get_gl_wo_cost($woid, WO_OVERHEAD); \r
+                       add_labour_cost($work_order['stock_id'], -$qty, $date, $cost);
+               $cost = get_gl_wo_cost($woid, WO_OVERHEAD); // get the overhead cost and reduce avg cost
                if ($cost != 0)
-                       add_overhead_cost($work_order['stock_id'], 1, $date, -$cost, true);
+                       add_overhead_cost($work_order['stock_id'], -$qty, $date, $cost);
                
                $sql = "UPDATE ".TB_PREF."workorders SET closed=1,units_reqd=0,units_issued=0 WHERE id = "
                        .db_escape($woid);
@@ -480,8 +289,7 @@ function void_work_order($woid)
                // void all related stock moves
                void_stock_move(ST_WORKORDER, $woid);
 
-               // void any related bank/gl trans
-               void_bank_trans(ST_WORKORDER, $woid, true);
+               void_wo_costing($wo);
 
                // clear the requirements units received
                void_wo_requirements($woid);
index 9b869d0a1b935d6a94372450e139c3d02c110084..bcf9688f0ef015e1d5270a564042ed5b91c95664 100644 (file)
@@ -66,29 +66,12 @@ function add_work_order_quick($wo_ref, $loc_code, $units_reqd, $stock_id, $type,
         db_query($sql, "The work order requirements could not be added");
 
                // insert a -ve stock move for each item
-               // Chaitanya: Updated to record price and cost as std_cost for work order issued item
-               $UnitCost = get_standard_cost($bom_item["component"]);
                add_stock_move(ST_WORKORDER, $bom_item["component"], $woid,
-                       $bom_item["loc_code"], $date_, $wo_ref, -$item_quantity, $UnitCost, 0, 1, $UnitCost);
-       }
-       
-       // -------------------------------------------------------------------------
-       //Negative Stock Handling
-       $qoh = get_qoh_on_date($stock_id);
-       $cost_adjust = false;
-       if ($qoh < 0)
-       {
-               if ($qoh + $units_reqd > 0)
-                       $cost_adjust = true;
+                       $bom_item["loc_code"], $date_, $wo_ref, -$item_quantity, 0);
        }
 
+
        // -------------------------------------------------------------------------
-       
-       //Negative Stock Handling First; Prior to add_stock_move
-       if ($cost_adjust)
-               adjust_deliveries($stock_id, get_standard_cost($stock_id), $date_);
-               
-       // -------------------------------------------------------------------------    
 
        // insert a +ve stock move for the item being manufactured
        add_stock_move(ST_WORKORDER, $stock_id, $woid,  $loc_code, $date_,
@@ -97,8 +80,8 @@ function add_work_order_quick($wo_ref, $loc_code, $units_reqd, $stock_id, $type,
        // -------------------------------------------------------------------------
 
        work_order_quick_costs($woid, $stock_id, $units_reqd, $date_, 0, $costs, $cr_acc, $labour, $cr_lab_acc);
-               
-       //--------------------------------------------------------------------------
+
+       // -------------------------------------------------------------------------
 
        add_comments(ST_WORKORDER, $woid, $date_, $memo_);
 
@@ -120,10 +103,9 @@ function work_order_quick_costs($woid, $stock_id, $units_reqd, $date_, $advanced
 
        // credit all the components
        $total_cost = 0;
-       //Chaitanya : capture the exact i.e. non-rounded cost to avoid rounding error amplification
-       $total_material_cost = 0;
        while ($bom_item = db_fetch($result))
        {
+
                $bom_accounts = get_stock_gl_code($bom_item["component"]);
 
                $bom_cost = $bom_item["ComponentCost"] * $units_reqd;
@@ -134,26 +116,16 @@ function work_order_quick_costs($woid, $stock_id, $units_reqd, $date_, $advanced
                        $memo = $date_.": ".$memo; 
                        update_wo_requirement_issued($woid, $bom_item['component'], $bom_item["quantity"] * $units_reqd);                       
                        // insert a -ve stock move for each item
-                       // Chaitanya: Updated to record price and cost as std_cost for work order issued item
-                       $UnitCost = get_standard_cost($bom_item["component"]);                  
                        add_stock_move(ST_MANURECEIVE, $bom_item["component"], $advanced,
-                               $bom_item["loc_code"], $date_, "", -$bom_item["quantity"] * $units_reqd, $UnitCost, 0, 1, $UnitCost);
+                               $bom_item["loc_code"], $date_, "", -$bom_item["quantity"] * $units_reqd, 0);
                }
-               
-               //Chaitanya : Compatibility for Service Items
-               if (!is_service($bom_accounts["mb_flag"]))
-                       $ivaccount = $bom_accounts["inventory_account"];
-               else
-                       $ivaccount = $bom_accounts["cogs_account"];
-               $total_cost += add_gl_trans_std_cost(ST_WORKORDER, $woid, $date_, $ivaccount, 0, 0,
+               $total_cost += add_gl_trans_std_cost(ST_WORKORDER, $woid, $date_, $bom_accounts["inventory_account"], 0, 0,
                        $memo, -$bom_cost);
-               $total_material_cost += $bom_cost;
+
        }
+       $item_accounts = get_stock_gl_code($stock_id);
        if ($advanced)
        {
-               //Chaitanya: Material cost added at time of production as per BOM at the time and in adjustment mode.
-               add_material_cost($stock_id, $units_reqd, $date_, true);        
-       
                $wo = get_work_order($woid);
                // also take the additional issues
                // moved to work_order_issues_db.inc
@@ -173,47 +145,24 @@ function work_order_quick_costs($woid, $stock_id, $units_reqd, $date_, $advanced
                if ($issue_total != 0)
                        add_issue_cost($stock_id, $units_reqd, $date_, $issue_total);
                */      
-               
-               // Logic moved to work_order_costs.php
-               /*
                $lcost = get_gl_wo_cost($woid, WO_LABOUR);
                add_labour_cost($stock_id, $units_reqd, $date_, $lcost * $units_reqd / $wo['units_reqd']);
                $ocost = get_gl_wo_cost($woid, WO_OVERHEAD);
-               add_overhead_cost($stock_id, $units_reqd, $date_, $ocost * $units_reqd / $wo['units_reqd']); */
-       }
-       // credit additional costs
-       $item_accounts = get_stock_gl_code($stock_id);
-       if ($costs != 0.0)
-       {
-               add_gl_trans_std_cost(ST_WORKORDER, $woid, $date_, $cr_acc,
-                       0, 0, $wo_cost_types[WO_OVERHEAD], -$costs, PT_WORKORDER, WO_OVERHEAD);
-               $is_bank_to = is_bank_account($cr_acc);
-       if ($is_bank_to)
-       {
-               add_bank_trans(ST_WORKORDER, $woid, $is_bank_to, "",
-                       $date_, -$costs, PT_WORKORDER, WO_OVERHEAD, get_company_currency(),
-                       "Cannot insert a destination bank transaction");
-       }
-                       
-               add_gl_trans_std_cost(ST_WORKORDER, $woid, $date_, $item_accounts["assembly_account"],
-                       $item_accounts["dimension_id"], $item_accounts["dimension2_id"], $wo_cost_types[WO_OVERHEAD], $costs, 
-                       PT_WORKORDER, WO_OVERHEAD);
-       }
-       if ($labour != 0.0)
-       {
-               add_gl_trans_std_cost(ST_WORKORDER, $woid, $date_, $cr_lab_acc,
-                       0, 0, $wo_cost_types[WO_LABOUR], -$labour, PT_WORKORDER, WO_LABOUR);
-               $is_bank_to = is_bank_account($cr_lab_acc);
-       if ($is_bank_to)
-       {
-               add_bank_trans(ST_WORKORDER, $woid, $is_bank_to, "",
-                       $date_, -$labour, PT_WORKORDER, WO_LABOUR, get_company_currency(),
-                       "Cannot insert a destination bank transaction");
-       }
-                       
-               add_gl_trans_std_cost(ST_WORKORDER, $woid, $date_, $item_accounts["assembly_account"],
-                       $item_accounts["dimension_id"], $item_accounts["dimension2_id"], $wo_cost_types[WO_LABOUR], $labour, 
-                       PT_WORKORDER, WO_LABOUR);
+               add_overhead_cost($stock_id, $units_reqd, $date_, $ocost * $units_reqd / $wo['units_reqd']);
+
+       } else { // only for quick
+               // credit additional costs
+
+               if ($costs != 0.0)
+               {
+                       add_wo_costs_journal($woid, $costs, WO_OVERHEAD, $cr_acc, $item_accounts["assembly_account"],
+                               $date_, $item_accounts["dimension_id"], $item_accounts["dimension2_id"]);
+               }
+               if ($labour != 0.0) // only for quick
+               {
+                       add_wo_costs_journal($woid, $labour, WO_LABOUR, $cr_lab_acc, $item_accounts["assembly_account"],
+                               $date_, $item_accounts["dimension_id"], $item_accounts["dimension2_id"]);
+               }
        }
        // debit total components $total_cost
        $stockitem = get_item($stock_id);
@@ -221,11 +170,7 @@ function work_order_quick_costs($woid, $stock_id, $units_reqd, $date_, $advanced
        if ($advanced)
                $memo = $date_.": ".$memo;
     add_gl_trans_std_cost(ST_WORKORDER, $woid, $date_, $item_accounts["inventory_account"],
-        0, 0, $memo, -$total_cost);    
-               
-       //Chaitanya : Update cost of the manufactured item in stock moves table
-       $UnitWOCost = ($total_material_cost + $costs + $labour)/$units_reqd;
-       update_stock_move(ST_WORKORDER, $woid, $stock_id, $UnitWOCost);         
+        0, 0, $memo, -$total_cost);
 }
 
 //--------------------------------------------------------------------------------------
index 3a599161cb1005bef8fd85e2a996f2c021c9a749..2c880aef09216080dce47a9f9a5de06d49541207 100644 (file)
@@ -11,6 +11,7 @@
 ***********************************************************************/
 include_once($path_to_root . "/manufacturing/includes/db/work_centres_db.inc");
 include_once($path_to_root . "/manufacturing/includes/db/work_orders_db.inc");
+include_once($path_to_root . "/manufacturing/includes/db/work_order_costing_db.inc");
 include_once($path_to_root . "/manufacturing/includes/db/work_orders_quick_db.inc");
 include_once($path_to_root . "/manufacturing/includes/db/work_order_issues_db.inc");
 include_once($path_to_root . "/manufacturing/includes/db/work_order_produce_items_db.inc");
index f2cde17f2ee9e09d8e622e0c8221e015d7a6cda0..7e63f77a76ec1342e42e1e2bc2d9de424c8949fb 100644 (file)
@@ -244,8 +244,8 @@ function display_wo_payments($woid)
 
                        alt_table_row_color($k);
 
-               label_cell(get_gl_view_str(ST_WORKORDER, $myrow["type_no"], $myrow["type_no"]));
-               label_cell($wo_cost_types[$myrow['person_id']]);
+               label_cell(get_gl_view_str( $myrow["type"], $myrow["type_no"], $myrow["type_no"]));
+               label_cell($wo_cost_types[$myrow['cost_type']]);
                $date = sql2date($myrow["tran_date"]);
                label_cell($date);
                        amount_cell(-($myrow['amount']));
diff --git a/manufacturing/view/wo_costs_view.php b/manufacturing/view/wo_costs_view.php
new file mode 100644 (file)
index 0000000..12ed5fe
--- /dev/null
@@ -0,0 +1,73 @@
+<?php
+/**********************************************************************
+    Copyright (C) FrontAccounting, LLC.
+       Released under the terms of the GNU General Public License, GPL, 
+       as published by the Free Software Foundation, either version 3 
+       of the License, or (at your option) any later version.
+    This program is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
+    See the License here <http://www.gnu.org/licenses/gpl-3.0.html>.
+***********************************************************************/
+$page_security = 'SA_MANUFTRANSVIEW';
+$path_to_root = "../..";
+
+include_once($path_to_root . "/includes/session.inc");
+
+$js = "";
+if ($use_popup_windows)
+       $js .= get_js_open_window(900, 500);
+page(_($help_context = "View Work Order Costs"), true, false, "", $js);
+
+include_once($path_to_root . "/includes/date_functions.inc");
+include_once($path_to_root . "/includes/manufacturing.inc");
+include_once($path_to_root . "/includes/data_checks.inc");
+
+include_once($path_to_root . "/manufacturing/includes/manufacturing_db.inc");
+include_once($path_to_root . "/manufacturing/includes/manufacturing_ui.inc");
+
+//-------------------------------------------------------------------------------------------------
+
+if ($_GET['trans_no'] != "")
+{
+       $wo_id = $_GET['trans_no'];
+}
+
+//-------------------------------------------------------------------------------------------------
+
+function display_wo_costs($prod_id)
+{
+       global $wo_cost_types;
+
+    $costs = get_gl_wo_cost_trans($prod_id);
+
+       br(1);
+    start_table(TABLESTYLE);
+    $th = array(_("Date"), _("Type"), _("Amount"), _("Memo"), '');
+    table_header($th);
+       while($myrow = db_fetch($costs)) {
+               start_row();
+               label_cell(sql2date($myrow["tran_date"]));
+               label_cell($wo_cost_types[$myrow["cost_type"]]);
+               amount_cell(-$myrow['amount']);
+               label_cell($myrow['memo_']);
+               label_cell(get_trans_view_str($myrow['trans_type'],$myrow["trans_no"]));
+               end_row();
+       }
+       end_table(1);
+}
+
+//-------------------------------------------------------------------------------------------------
+
+display_heading(sprintf(_("Production Costs for Work Order # %d"), $wo_id));
+
+display_wo_costs($wo_id);
+
+//-------------------------------------------------------------------------------------------------
+
+br(2);
+
+end_page(true, false, false, ST_WORKORDER, $wo_id);
+
+?>
+
index acf67f73e197ef7e0621795772b40b17426a1893..c9c7e6271133e40a0ab0cc16a986ed8133d7667a 100644 (file)
@@ -101,7 +101,7 @@ function can_process()
        }
        elseif (!is_date_in_fiscalyear($_POST['date_']))
        {
-               display_error(_("The entered date is not in fiscal year."));
+               display_error(_("The entered date is out of fiscal year or is closed for further data entry."));
                set_focus('date_');
                return false;
        }
index e7e0fb07700dbe18a9f45fc70448590f7c0a2204..4054fcbdc1cf6889cf8251e6e23ec922264a5db2 100644 (file)
@@ -44,8 +44,6 @@ if (isset($_GET['AddedID']))
 
     display_note(get_trans_view_str($stype, $id, _("View this Work Order")));
 
-       display_note(get_gl_view_str($stype, $id, _("View the GL Journal Entries for this Work Order")), 1);
-
        hyperlink_params("work_order_costs.php", _("Enter another additional cost."), "trans_no=$id");
  
        hyperlink_no_params("search_work_orders.php", _("Select another &Work Order to Process"));
@@ -67,16 +65,15 @@ if (strlen($wo_details[0]) == 0)
 
 //--------------------------------------------------------------------------------------------------
 
-function can_process()
+function can_process($wo_details)
 {
-       global $wo_details;
 
        if (!check_num('costs', 0))
        {
                display_error(_("The amount entered is not a valid number or less then zero."));
                set_focus('costs');
                return false;
-       }       
+       }
 
        if (!is_date($_POST['date_']))
        {
@@ -86,7 +83,7 @@ function can_process()
        }
        elseif (!is_date_in_fiscalyear($_POST['date_']))
        {
-               display_error(_("The entered date is not in fiscal year."));
+               display_error(_("The entered date is out of fiscal year or is closed for further data entry."));
                set_focus('date_');
                return false;
        }
@@ -102,32 +99,14 @@ function can_process()
 
 //--------------------------------------------------------------------------------------------------
 
-if (isset($_POST['process']) && can_process() == true)
+if (isset($_POST['process']) && can_process($wo_details) == true)
 {
        $date = $_POST['date_'];
-       begin_transaction();
-       add_gl_trans_std_cost(ST_WORKORDER, $_POST['selected_id'], $_POST['date_'], $_POST['cr_acc'],
-               0, 0, $date.": ".$wo_cost_types[$_POST['PaymentType']], -input_num('costs'), PT_WORKORDER, $_POST['PaymentType']);
-       $is_bank_to = is_bank_account($_POST['cr_acc']);
-       if ($is_bank_to)
-       {
-               add_bank_trans(ST_WORKORDER, $_POST['selected_id'], $is_bank_to, "",
-                       $_POST['date_'], -input_num('costs'), PT_WORKORDER, $_POST['PaymentType'], get_company_currency(),
-                       "Cannot insert a destination bank transaction");
-       }
+       $memo = $_POST['memo'];
+       $ref  = $_POST['ref'];
 
-       add_gl_trans_std_cost(ST_WORKORDER, $_POST['selected_id'], $_POST['date_'], $_POST['db_acc'],
-               $_POST['dim1'], $_POST['dim2'], $date.": ".$wo_cost_types[$_POST['PaymentType']], input_num('costs'), PT_WORKORDER, 
-                       $_POST['PaymentType']);
-                       
-       //Chaitanya : Apply the costs to manfuctured stock item as adjustement
-       $wo = get_work_order($_POST['selected_id']);
-       if ($_POST['PaymentType'] == 0)
-               add_labour_cost($wo['stock_id'], 0, $_POST['date_'], input_num('costs'), true);
-       else
-               add_overhead_cost($wo['stock_id'], 0, $_POST['date_'], input_num('costs'), true);
-                       
-       commit_transaction();   
+       add_wo_costs_journal($_POST['selected_id'], input_num('costs'), $_POST['PaymentType'], 
+               $_POST['cr_acc'], $_POST['db_acc'], $date, $_POST['dim1'], $_POST['dim2'], $memo, $ref);
 
        meta_forward($_SERVER['PHP_SELF'], "AddedID=".$_POST['selected_id']);
 }
@@ -138,6 +117,9 @@ display_wo_details($_POST['selected_id']);
 
 //-------------------------------------------------------------------------------------
 
+if (!isset($_POST['ref']))
+       $_POST['ref'] = $Refs->get_next(ST_JOURNAL);
+
 start_form();
 
 hidden('selected_id', $_POST['selected_id']);
@@ -147,9 +129,11 @@ start_table(TABLESTYLE2);
 
 br();
 
-yesno_list_row(_("Type:"), 'PaymentType', null,        $wo_cost_types[WO_OVERHEAD], $wo_cost_types[WO_LABOUR]);
 
 date_row(_("Date:"), 'date_');
+ref_row(_("Reference:"), 'ref', '');
+
+yesno_list_row(_("Type:"), 'PaymentType', null,        $wo_cost_types[WO_OVERHEAD], $wo_cost_types[WO_LABOUR]);
 
 $item_accounts = get_stock_gl_code($wo_details['stock_id']);
 $_POST['db_acc'] = $item_accounts['assembly_account'];
@@ -159,7 +143,7 @@ $_POST['cr_acc'] = $r[0];
 amount_row(_("Additional Costs:"), 'costs');
 gl_all_accounts_list_row(_("Debit Account"), 'db_acc', null);
 gl_all_accounts_list_row(_("Credit Account"), 'cr_acc', null);
-
+textarea_row(_("Memo:"), 'memo', null, 40, 5);
 end_table(1);
 hidden('dim1', $item_accounts["dimension_id"]);
 hidden('dim2', $item_accounts["dimension2_id"]);
index ce96abaa43743aa1647798fd634fb82898e5ab61..af7bf947e43a24a57413754a60258c15d5945905 100644 (file)
@@ -157,7 +157,7 @@ function can_process()
        }
        elseif (!is_date_in_fiscalyear($_POST['date_']))
        {
-               display_error(_("The entered date is not in fiscal year."));
+               display_error(_("The entered date is out of fiscal year or is closed for further data entry."));
                set_focus('date_');
                return false;
        }
@@ -236,7 +236,7 @@ function can_process()
                }
                //elseif (!is_date_in_fiscalyear($_POST['RequDate']))
                //{
-               //      display_error(_("The entered date is not in fiscal year."));
+               //  display_error(_("The entered date is out of fiscal year or is closed for further data entry."));
                //      return false;
                //}
        if (isset($selected_id))
index c7d1cd7cc5d43b15b14f31652f880f078e541d01..b5d6e4cc1f0058d6d264f1780b6039a1154fbcaf 100644 (file)
@@ -11,6 +11,7 @@
 ***********************************************************************/
 $page_security = 'SA_MANUFISSUE';
 $path_to_root = "..";
+
 include_once($path_to_root . "/includes/ui/items_cart.inc");
 
 include_once($path_to_root . "/includes/session.inc");
@@ -26,6 +27,7 @@ if ($use_popup_windows)
        $js .= get_js_open_window(800, 500);
 if ($use_date_picker)
        $js .= get_js_date_picker();
+
 page(_($help_context = "Issue Items to Work Order"), false, false, "", $js);
 
 //-----------------------------------------------------------------------------------------------
@@ -62,14 +64,11 @@ function handle_new_order()
                unset ($_SESSION['issue_items']);
        }
 
-     Session_register("issue_items");
-
      $_SESSION['issue_items'] = new items_cart(ST_MANUISSUE);
      $_SESSION['issue_items']->order_id = $_GET['trans_no'];
 }
 
 //-----------------------------------------------------------------------------------------------
-
 function can_process()
 {
        global $Refs;
@@ -82,7 +81,7 @@ function can_process()
        } 
        elseif (!is_date_in_fiscalyear($_POST['date_'])) 
        {
-               display_error(_("The entered date is not in fiscal year."));
+               display_error(_("The entered date is out of fiscal year or is closed for further data entry."));
                set_focus('date_');
                return false;
        }
@@ -103,8 +102,9 @@ function can_process()
        $failed_item = $_SESSION['issue_items']->check_qoh($_POST['Location'], $_POST['date_'], !$_POST['IssueType']);
        if ($failed_item != -1) 
        {
+               $item = $_SESSION['issue_items']->line_items[$failed_item];
        display_error( _("The issue cannot be processed because an entered item would cause a negative inventory balance :") .
-               " " . $failed_item->stock_id . " - " .  $failed_item->item_description);
+               " " . $item->stock_id . " - " .  $item->item_description);
                return false;
        }
 
index a31bc2ec83665bc9ebe9ff0a3dcfa47c7f96889f..00e088e0fbc489aa884ac5216080e0fa79c139b5 100644 (file)
@@ -13,8 +13,8 @@
 function update_average_material_cost($supplier, $stock_id, $price, $qty, $date, $adj_only=false)
 {
        //Handle if inventory will become negative
-    //8-OCT-2011 : Skip negative inventory adjustment for case of adjust_only\r
-    if (is_inventory_item($stock_id) && !$adj_only) \r
+    //8-OCT-2011 : Skip negative inventory adjustment for case of adjust_only
+    if (is_inventory_item($stock_id) && !$adj_only)
         handle_negative_inventory($stock_id, $qty, $price, $date);     
 
        // probably this function should be optimized
@@ -38,7 +38,7 @@ function update_average_material_cost($supplier, $stock_id, $price, $qty, $date,
        }       
        else
                $price_in_home_currency = $price;
-       
+
        $price_in_home_currency_ = $price_in_home_currency;
        
        $sql = "SELECT mb_flag, material_cost, labour_cost, overhead_cost FROM ".TB_PREF."stock_master WHERE stock_id=".db_escape($stock_id);
@@ -46,19 +46,20 @@ function update_average_material_cost($supplier, $stock_id, $price, $qty, $date,
        $myrow = db_fetch($result);
        $material_cost = $myrow['material_cost'];
        
-       //Price adjustment for manufactured item\r
-       if (!$adj_only && $myrow['mb_flag'] == 'M') \r
+       //Price adjustment for manufactured item
+       if (!$adj_only && $myrow['mb_flag'] == 'M') 
        {
                $standard_cost = get_standard_cost($stock_id);
                //reduce overhead_cost and labour_cost from price as those will remain as is
                $price_in_home_currency = $price_in_home_currency - $myrow['labour_cost'] - $myrow['overhead_cost'];
        }
-       
+
        if ($adj_only)
                $exclude = ST_CUSTDELIVERY;
        else
                $exclude = 0;
        $cost_adjust = false;
+
        $qoh = get_qoh_on_date($stock_id);
 
        if ($adj_only)
@@ -75,10 +76,9 @@ function update_average_material_cost($supplier, $stock_id, $price, $qty, $date,
                        $qoh = 0;
                }
                if ($qoh + $qty > 0)
-                       $material_cost 
-= ($qoh * $material_cost + $qty * $price_in_home_currency) /   ($qoh + $qty);
-       }       
-       
+                       $material_cost = ($qoh * $material_cost + $qty * $price_in_home_currency) /     ($qoh + $qty);
+       }
+
        if ($cost_adjust) // new 2010-02-10 //Chaitanya : Material_cost replaced with price
                adjust_deliveries($stock_id, $price_in_home_currency_, $date);
        $sql = "UPDATE ".TB_PREF."stock_master SET material_cost=".db_escape($material_cost)."
@@ -117,10 +117,10 @@ function add_grn(&$po)
                                if ($clearing_act)
                                        $total += add_gl_trans_supplier(ST_SUPPRECEIVE, $grn, $date_, $stock_gl_code["inventory_account"],
                                                $stock_gl_code['dimension_id'], $stock_gl_code['dimension2_id'],
-                                               $order_line->receive_qty * $order_line->taxfree_charge_price($po), $po->supplier_id, '', 0, $order_line->stock_id);\r
-                               update_average_material_cost($po->supplier_id, $order_line->stock_id, $order_line->price,\r
+                                               $order_line->receive_qty * $order_line->taxfree_charge_price($po), $po->supplier_id, '', 0, $order_line->stock_id);
+                               update_average_material_cost($po->supplier_id, $order_line->stock_id, $order_line->price,
                                        $order_line->receive_qty, $date_);
-                       }               
+                       }
                        //----------------------------------------------------------------------------------------------------------------
                        if ($order_line->qty_received == 0)
                        {
@@ -143,7 +143,7 @@ function add_grn(&$po)
                        /* Update location stock records - NB  a po cannot be entered for a service/kit parts done automatically */
                        add_stock_move(ST_SUPPRECEIVE, $order_line->stock_id, $grn, $po->Location, $date_, "",
                                $order_line->receive_qty, $order_line->standard_cost,
-                       $po->supplier_id, 1, $order_line->taxfree_charge_price($po));\r
+                       $po->supplier_id, 1, $order_line->taxfree_charge_price($po));
 
                } /*quantity received is != 0 */
        } /*end of order_line loop */
@@ -255,41 +255,50 @@ function set_grn_item_credited(&$entered_grn, $supplier, $transno, $date)
 function get_grn_items($grn_batch_id=0, $supplier_id="", $outstanding_only=false,
        $is_invoiced_only=false, $invoice_no=0, $begin="", $end="")
 {
-    $sql = "SELECT ".TB_PREF."grn_batch.*, ".TB_PREF."grn_items.*, "
-       .TB_PREF."purch_order_details.unit_price,"
-       .TB_PREF."purch_order_details.act_price,"
-       .TB_PREF."purch_order_details.quantity_ordered,"
-               .TB_PREF."purch_order_details.std_cost_unit, units
-       FROM ".TB_PREF."grn_batch, ".TB_PREF."grn_items, "
-       .TB_PREF."purch_order_details, ".TB_PREF."stock_master";
-    if ($invoice_no != 0)
-       $sql .= ", ".TB_PREF."supp_invoice_items";
-    $sql .= " WHERE ".TB_PREF."grn_items.grn_batch_id=".TB_PREF."grn_batch.id
-               AND ".TB_PREF."grn_items.po_detail_item=".TB_PREF."purch_order_details.po_detail_item";
-       if ($invoice_no != 0)
-               $sql .= " AND ".TB_PREF."supp_invoice_items.supp_trans_type=".ST_SUPPINVOICE." AND 
-                       ".TB_PREF."supp_invoice_items.supp_trans_no=$invoice_no AND
-                       ".TB_PREF."grn_items.id=".TB_PREF."supp_invoice_items.grn_item_id";
-       $sql .= " AND ".TB_PREF."stock_master.stock_id=".TB_PREF."grn_items.item_code ";
+    $sql = "SELECT grn.*, grn_item.*,
+               grn_item.quantity_inv".($invoice_no ? "-invoice_item.quantity" : '')."  quantity_inv,
+       po_item.unit_price,
+       po_item.act_price,
+       po_item.quantity_ordered,
+       po_item.std_cost_unit, units
+       FROM    ".TB_PREF."grn_batch grn, "
+                       .TB_PREF."purch_order_details po_item, "
+                       .TB_PREF."stock_master stock_item,"
+                               .TB_PREF."grn_items grn_item ";
+    if ($invoice_no != 0) {
+       $sql .= " LEFT JOIN ".TB_PREF."supp_invoice_items invoice_item ON ";
+
+               $inv_cond = "invoice_item.supp_trans_type=".ST_SUPPINVOICE." AND invoice_item.supp_trans_no ";
+               if (is_array($invoice_no))
+                       $inv_cond .= " IN (".implode(',' , $invoice_no) . ")";
+               else
+                       $inv_cond .= " = $invoice_no";
+               $sql .= "($inv_cond) AND grn_item.id=invoice_item.grn_item_id";
+       }
+    $sql .= " WHERE grn_item.grn_batch_id=grn.id
+               AND grn_item.po_detail_item=po_item.po_detail_item";
+
+       if ($outstanding_only)
+       $sql .= " AND (".($invoice_no ? "$inv_cond OR ":'')."grn_item.qty_recd - grn_item.quantity_inv > 0)";
+
+       $sql .= " AND stock_item.stock_id=grn_item.item_code ";
 
        if ($begin != "")
-               $sql .= " AND ".TB_PREF."grn_batch.delivery_date>='".date2sql($begin)."'";
+               $sql .= " AND grn.delivery_date>='".date2sql($begin)."'";
        if ($end != "")
-               $sql .= " AND ".TB_PREF."grn_batch.delivery_date<='".date2sql($end)."'";
+               $sql .= " AND grn.delivery_date<='".date2sql($end)."'";
        if ($grn_batch_id != 0)
-               $sql .= " AND ".TB_PREF."grn_batch.id=".db_escape($grn_batch_id)
-                       ." AND ".TB_PREF."grn_items.grn_batch_id=".db_escape($grn_batch_id);
+               $sql .= " AND grn.id=".db_escape($grn_batch_id)
+                       ." AND grn_item.grn_batch_id=".db_escape($grn_batch_id);
 
        if ($is_invoiced_only)
-               $sql .= " AND ".TB_PREF."grn_items.quantity_inv > 0";
-
-       if ($outstanding_only)
-       $sql .= " AND ".TB_PREF."grn_items.qty_recd - ".TB_PREF."grn_items.quantity_inv > 0";
+               $sql .= " AND grn_item.quantity_inv > 0";
 
        if ($supplier_id != "")
-               $sql .= " AND ".TB_PREF."grn_batch.supplier_id =".db_escape($supplier_id);
+               $sql .= " AND grn.supplier_id =".db_escape($supplier_id);
 
-       $sql .= " ORDER BY ".TB_PREF."grn_batch.delivery_date, ".TB_PREF."grn_batch.id, ".TB_PREF."grn_items.id";
+       $sql .= " ORDER BY grn.delivery_date, grn.id, grn_item.id";
 
        return db_query($sql, "Could not retreive GRNS");
 }
index 3ffc35d3abc23a8ac628a5a5f2f9074bb51f1096..0f7f9b53d01d7365c32166de61407e4ffc74573c 100644 (file)
@@ -16,13 +16,14 @@ include_once($path_to_root . "/purchasing/includes/db/invoice_items_db.inc");
 function read_supplier_details_to_trans(&$supp_trans, $supplier_id)
 {
        $sql = "SELECT supp.supp_name, terms.terms, terms.days_before_due,
-               terms.day_in_following_month, supp.tax_included,
+               terms.day_in_following_month, supp.tax_included, supp.tax_algorithm,
                supp.tax_group_id, tax_group.name AS tax_group_name,
                supp.credit_limit - Sum(IFNULL(IF(trans.type=".ST_SUPPCREDIT.", -1, 1) 
                        * (ov_amount + ov_gst + ov_discount),0)) as cur_credit
-               FROM ".TB_PREF."suppliers supp 
-                       LEFT JOIN ".TB_PREF."supp_trans trans ON supp.supplier_id = trans.supplier_id, "
-                       .TB_PREF."payment_terms terms, ".TB_PREF."tax_groups tax_group
+               FROM ".TB_PREF."suppliers supp LEFT JOIN "
+                       .TB_PREF."supp_trans trans ON supp.supplier_id = trans.supplier_id, "
+                       .TB_PREF."payment_terms terms, "
+                       .TB_PREF."tax_groups tax_group
                WHERE supp.tax_group_id = tax_group.id
                AND supp.payment_terms=terms.terms_indicator
                AND supp.supplier_id = ".db_escape($supplier_id)." GROUP BY supp.supp_name";
@@ -31,33 +32,37 @@ function read_supplier_details_to_trans(&$supp_trans, $supplier_id)
 
        $myrow = db_fetch($result);
 
+    if ($supp_trans->tran_date == "")
+    {
+               $supp_trans->tran_date = Today();
+
+               if (!is_date_in_fiscalyear($supp_trans->tran_date))
+                       $supp_trans->tran_date = end_fiscalyear();
+       }
+       if ($supp_trans->supplier_id != $supplier_id)
+           get_duedate_from_terms($supp_trans);
+
     $supp_trans->supplier_id = $supplier_id;
     $supp_trans->tax_included = $myrow['tax_included'];
+    $supp_trans->tax_algorithm = $supp_trans->stored_algorithm = $myrow['tax_algorithm'];
     $supp_trans->supplier_name = $myrow['supp_name'];
        $supp_trans->terms = array( 
                'description' => $myrow['terms'],
                'days_before_due' => $myrow['days_before_due'], 
                'day_in_following_month' => $myrow['day_in_following_month'] );
-               
+
        $supp_trans->credit = $myrow['cur_credit'];
 
        $supp_trans->tax_description = $myrow['tax_group_name'];
        $supp_trans->tax_group_id = $myrow['tax_group_id'];
 
-    if ($supp_trans->tran_date == "")
-    {
-               $supp_trans->tran_date = Today();
-               if (!is_date_in_fiscalyear($supp_trans->tran_date))
-                       $supp_trans->tran_date = end_fiscalyear();
-       }
-    //if ($supp_trans->due_date=="") {
-    // get_duedate_from_terms($supp_trans);
-    //}
-    get_duedate_from_terms($supp_trans);
 }
 
-//--------------------------------------------------------------------------------------------------
-
+//-------------------------------------------------------------------------------------------------
+//     Updates invoiced quantity in PO and GRN line, and act_price in PO
+//  Returns:
+// if chg_price is set:         previous act_price, delivery date and unit_price from PO
+//
 function update_supp_received_items_for_invoice($id, $po_detail_item, $qty_invoiced, $chg_price=null)
 {
        if ($chg_price != null)
@@ -114,16 +119,22 @@ function get_diff_in_home_currency($supplier, $old_date, $date, $amount1, $amoun
 }
 //----------------------------------------------------------------------------------------
 
-function add_supp_invoice($supp_trans, $invoice_no=0) // do not receive as ref because we change locally
+function add_supp_invoice(&$supp_trans) // do not receive as ref because we change locally
 {
        global $Refs;
 
        //$company_currency = get_company_currency();
+       $trans_no = $supp_trans->trans_no;
+       $trans_type = $supp_trans->trans_type;
        /*Start an sql transaction */
        begin_transaction();
-       hook_db_prewrite($supp_trans, $supp_trans->trans_type);
+       hook_db_prewrite($supp_trans, $trans_type);
        $tax_total = 0;
     $taxes = $supp_trans->get_taxes($supp_trans->tax_group_id);
+       if ($trans_no) {
+               void_transaction($trans_type, $trans_no, Today(), _("Document reentered."));
+               $Refs->restore_last($trans_type, $trans_no);
+       }
 
     foreach ($taxes as $n => $taxitem)
     {
@@ -131,18 +142,15 @@ function add_supp_invoice($supp_trans, $invoice_no=0) // do not receive as ref b
        $tax_total += $taxes[$n]['Value'];
     }
 
-       $invoice_items_total = $supp_trans->get_items_total();
+       $invoice_items_total = $supp_trans->get_items_total(); // get total with/without tax dep. on tax_included
 //     $invoice_items_total = $supp_trans->get_total_taxfree($supp_trans->tax_group_id);
 
        if($supp_trans->tax_included==0) {
                $item_added_tax = $tax_total;
        } else {
                $item_added_tax = 0;
-               
        }
 
-       $trans_type = $supp_trans->trans_type;
-       
        if ($trans_type == ST_SUPPCREDIT)
        {
                // let's negate everything because it's a credit note
@@ -158,7 +166,11 @@ function add_supp_invoice($supp_trans, $invoice_no=0) // do not receive as ref b
     /*First insert the invoice into the supp_trans table*/
        $invoice_id = write_supp_trans($trans_type, 0, $supp_trans->supplier_id, $date_, $supp_trans->due_date,
                $supp_trans->reference, $supp_trans->supp_reference,
-               $invoice_items_total, $item_added_tax, $supp_trans->ov_discount, "", 0, $supp_trans->tax_included);
+               $invoice_items_total, $item_added_tax, $supp_trans->ov_discount, "", 0, $supp_trans->tax_included,
+               $supp_trans->tax_algorithm);
+
+
+       $supp_trans->trans_no = $invoice_id;
 
        $total = 0;
     /* Now the control account */
@@ -191,7 +203,7 @@ function add_supp_invoice($supp_trans, $invoice_no=0) // do not receive as ref b
                        $trans_type, $invoice_id, $entered_gl_code->amount,
                        $ex_rate, $date_, $supp_trans->supp_reference, $supp_trans->tax_included);
     }
-    
+
     $clearing_act = get_company_pref('grn_clearing_act');
     foreach ($supp_trans->grn_items as $line_no => $entered_grn)
     {
@@ -204,7 +216,7 @@ function add_supp_invoice($supp_trans, $invoice_no=0) // do not receive as ref b
                $line_taxfree = $entered_grn->taxfree_charge_price($supp_trans->tax_group_id);
                $line_tax = $entered_grn->full_charge_price($supp_trans->tax_group_id) - $line_taxfree;
                $stock_gl_code = get_stock_gl_code($entered_grn->item_code);
-               
+
        if ($trans_type == ST_SUPPCREDIT)
                {
                        $iv_act = (is_inventory_item($entered_grn->item_code) ? $stock_gl_code["inventory_account"] : 
@@ -251,7 +263,7 @@ function add_supp_invoice($supp_trans, $invoice_no=0) // do not receive as ref b
                                        $entered_grn->this_quantity_inv * $old_price, $supp_trans->supplier_id, "", $ex_rate);
                                $diff = get_diff_in_home_currency($supp_trans->supplier_id, $old_date, $date_, $old_price, 
                                        $line_taxfree); 
-                       
+
                                // always return due to change in currency.
                                /*$mat_cost = update_average_material_cost(null, $entered_grn->item_code,
                                        $diff, $entered_grn->this_quantity_inv, $old_date, true); */
@@ -370,12 +382,15 @@ function add_supp_invoice($supp_trans, $invoice_no=0) // do not receive as ref b
                                $taxitem['tax_type_id'], $taxitem['rate'], $supp_trans->tax_included, $taxitem['Value'],
                                $taxitem['Net'], $ex_rate, $date_, $supp_trans->supp_reference);
 
-               if ($trans_type == ST_SUPPCREDIT)
-                       $taxitem['Value'] = -$taxitem['Value'];
-               $total += add_gl_trans_supplier($trans_type, $invoice_id, $date_,
-                       $taxitem['purchasing_gl_code'], 0, 0, $taxitem['Value'],
-                       $supp_trans->supplier_id,
-                       "A general ledger transaction for the tax amount could not be added");
+                       if (isset($taxitem['purchasing_gl_code']))
+                       {
+                       if ($trans_type == ST_SUPPCREDIT)
+                               $taxitem['Value'] = -$taxitem['Value'];
+                       $total += add_gl_trans_supplier($trans_type, $invoice_id, $date_,
+                               $taxitem['purchasing_gl_code'], 0, 0, $taxitem['Value'],
+                               $supp_trans->supplier_id,
+                               "A general ledger transaction for the tax amount could not be added");
+                       }
        }
     }
        
@@ -386,26 +401,26 @@ function add_supp_invoice($supp_trans, $invoice_no=0) // do not receive as ref b
 
        $Refs->save($trans_type, $invoice_id, $supp_trans->reference);
 
-       if ($invoice_no != 0)
+       if ($supp_trans->src_docs)
        {
-               $invoice_alloc_balance = get_supp_trans_allocation_balance(ST_SUPPINVOICE, $invoice_no);
+               $invoice_alloc_balance = get_supp_trans_allocation_balance(ST_SUPPINVOICE, $supp_trans->src_docs);
                if ($invoice_alloc_balance > 0) 
                {       //the invoice is not already fully allocated 
 
-                       $trans = get_supp_trans($invoice_no, ST_SUPPINVOICE);
+                       $trans = get_supp_trans($supp_trans->src_docs, ST_SUPPINVOICE);
                        $total = $trans['Total'];
 
                        $allocate_amount = ($invoice_alloc_balance > $total) ? $total : $invoice_alloc_balance;
                        /*Now insert the allocation record if > 0 */
                        if ($allocate_amount != 0) 
                        {
-                               update_supp_trans_allocation(ST_SUPPINVOICE, $invoice_no, $allocate_amount);
+                               update_supp_trans_allocation(ST_SUPPINVOICE, $supp_trans->src_docs, $allocate_amount);
                                update_supp_trans_allocation(ST_SUPPCREDIT, $invoice_id, $allocate_amount); // ***
-                               add_supp_allocation($allocate_amount, ST_SUPPCREDIT, $invoice_id, ST_SUPPINVOICE, $invoice_no,
+                               add_supp_allocation($allocate_amount, ST_SUPPCREDIT, $invoice_id, ST_SUPPINVOICE, $supp_trans->src_docs,
                                        $date_);
                                // Exchange Variations Joe Hunt 2008-09-20 ////////////////////////////////////////
 
-                               exchange_variation(ST_SUPPCREDIT, $invoice_id, ST_SUPPINVOICE, $invoice_no, $date_,
+                               exchange_variation(ST_SUPPCREDIT, $invoice_id, ST_SUPPINVOICE, $supp_trans->src_docs, $date_,
                                        $allocate_amount, PT_SUPPLIER);
 
                                ///////////////////////////////////////////////////////////////////////////
@@ -413,7 +428,6 @@ function add_supp_invoice($supp_trans, $invoice_no=0) // do not receive as ref b
                }
        }
 
-       $supp_trans->trans_no = $invoice_id;
        hook_db_postwrite($supp_trans, $supp_trans->trans_type);
     commit_transaction();
 
@@ -445,9 +459,11 @@ function get_po_invoices_credits($po_number)
 
 function read_supp_invoice($trans_no, $trans_type, &$supp_trans)
 {
-       $sql = "SELECT ".TB_PREF."supp_trans.*, supp_name FROM ".TB_PREF."supp_trans,".TB_PREF."suppliers
+       $sql = "SELECT ".TB_PREF."supp_trans.*, supp_name 
+               FROM ".TB_PREF."supp_trans,".TB_PREF."suppliers
                WHERE trans_no = ".db_escape($trans_no)." AND type = ".db_escape($trans_type)."
                AND ".TB_PREF."suppliers.supplier_id=".TB_PREF."supp_trans.supplier_id";
+
        $result = db_query($sql, "Cannot retreive a supplier transaction");
 
        if (db_num_rows($result) == 1)
@@ -465,6 +481,7 @@ function read_supp_invoice($trans_no, $trans_type, &$supp_trans)
                $supp_trans->ov_discount = $trans_row["ov_discount"];
                $supp_trans->ov_gst = $trans_row["ov_gst"];
                $supp_trans->tax_included = $trans_row["tax_included"];
+               $supp_trans->stored_algorithm = $supp_trans->tax_algorithm = $trans_row["tax_algorithm"];
 
                $id = $trans_row["trans_no"];
 
@@ -479,7 +496,10 @@ function read_supp_invoice($trans_no, $trans_type, &$supp_trans)
                if ($details_row["gl_code"] == 0)
                {
                        $supp_trans->add_grn_to_trans($details_row["grn_item_id"], $details_row["po_detail_item_id"], $details_row["stock_id"],
-                                       $details_row["description"], 0, 0, $details_row["quantity"], 0, $details_row["FullUnitPrice"],
+                                       $details_row["description"], 
+                                       $details_row['qty_recd'],
+                                       $details_row['quantity_inv']-$details_row["quantity"],
+                                       $details_row["quantity"], 0, $details_row["FullUnitPrice"],
                                        0, 0);
                }
                else
@@ -548,9 +568,8 @@ function void_supp_invoice($type, $type_no)
                                $batch = get_grn_batch_from_item($details_row["grn_item_id"]);  
                                $grn = get_grn_batch($batch);
                        if ($type == ST_SUPPCREDIT) // credit note 2009-06-14 Joe Hunt Must restore the po and grn
-                       {       
+                       {       // We must get the corresponding invoice item to check for price chg.
                                        $match = get_matching_invoice_item($details_row["stock_id"], $details_row["po_detail_item_id"]);
-                                       
                                        //Chaitanya : Skipped costing block & handle in void_stock_move
                                        // We must get the corresponding invoice item to check for price chg.
                                        /*if ($match !== false)
@@ -559,7 +578,7 @@ function void_supp_invoice($type, $type_no)
                                        else            
                                                $mat_cost = update_average_material_cost($grn["supplier_id"], $details_row["stock_id"],  
                                                        $details_row["FullUnitPrice"], -$details_row["quantity"], $old_date, $old[1] !== $trans['tran_date']);*/
-                                                       
+
                                        $sql = "UPDATE ".TB_PREF."purch_order_details
                                        SET quantity_ordered = quantity_ordered + ".-$details_row["quantity"].", ";
                                if ($match !== false)
@@ -652,17 +671,17 @@ function is_reference_already_there($supplier_id, $supp_reference, $trans_no=0)
 
 function remove_not_invoice_item($id)
 {
-    begin_transaction();
+       begin_transaction();
 
     $myrow = get_grn_item_detail($id);
 
     $grn = get_grn_batch($myrow['grn_batch_id']);
-    
+
     $supp = get_supplier($grn["supplier_id"]);
 
-    $sql = "UPDATE ".TB_PREF."purch_order_details
-        SET quantity_received = qty_invoiced, quantity_ordered = qty_invoiced WHERE po_detail_item = ".$myrow["po_detail_item"];
-    db_query($sql, "The quantity invoiced of the purchase order line could not be updated");
+       $sql = "UPDATE ".TB_PREF."purch_order_details
+               SET quantity_received = qty_invoiced, quantity_ordered = qty_invoiced WHERE po_detail_item = ".$myrow["po_detail_item"];
+       db_query($sql, "The quantity invoiced of the purchase order line could not be updated");
 
     $sql = "UPDATE ".TB_PREF."grn_items
         SET qty_recd = quantity_inv WHERE id = ".$myrow["id"];
@@ -695,4 +714,23 @@ function remove_not_invoice_item($id)
 
     commit_transaction();
 }
-?>
+
+function find_src_invoices($cart)
+{
+       $invoices = $po_ids = array();
+       foreach($cart->grn_items as $item)
+               $po_ids[] = "'$item->po_detail_item'";  // credit item lines
+
+       if (count($po_ids)) {
+               $sql = "SELECT DISTINCT trans.trans_no, trans.reference, trans.supp_reference
+                       FROM ".TB_PREF."supp_invoice_items items
+                       LEFT JOIN ".TB_PREF."supp_trans trans ON trans.trans_no=items.supp_trans_no AND trans.`type`=items.supp_trans_type
+                       WHERE items.po_detail_item_id IN (" . implode(',', $po_ids). ")"." AND items.supp_trans_type=20";
+               $result = db_query($sql, "cannot find source invoice details");
+               while ($rec = db_fetch($result))
+               {
+                       $invoices[$rec['trans_no']] = $rec['supp_reference']; // array($rec['reference'], $rec['supp_reference']);
+               }
+       }
+       return $invoices;
+}
index efcdcb4bd323b1af4a737c2cbd2225ed10b176c2..e851f5734d76b4581a30674eafb269412d7915a9 100644 (file)
@@ -44,9 +44,11 @@ function add_supp_invoice_gl_item($supp_trans_type, $supp_trans_no, $gl_code, $a
 
 function get_supp_invoice_items($supp_trans_type, $supp_trans_no)
 {
-       $sql = "SELECT *, unit_price AS FullUnitPrice FROM ".TB_PREF."supp_invoice_items
+       $sql = "SELECT *, unit_price AS FullUnitPrice FROM "
+               .TB_PREF."supp_invoice_items inv LEFT JOIN ".TB_PREF."grn_items grn ON grn.id =inv.grn_item_id
                WHERE supp_trans_type = ".db_escape($supp_trans_type)."
-               AND supp_trans_no = ".db_escape($supp_trans_no)." ORDER BY id";
+               AND supp_trans_no = ".db_escape($supp_trans_no)
+               ." ORDER BY inv.id";
        return db_query($sql, "Cannot retreive supplier transaction detail records");
 }
 
index e841d5e8caa34208d56c97069d823a5e096939f1..45810f1da0b9050b430457a06aaf3f0d64cb0370 100644 (file)
@@ -107,7 +107,6 @@ function update_po(&$po_obj)
                        .db_escape($po_line->price) . ", "
                        .db_escape($po_line->quantity) . ", "
                        .db_escape($po_line->qty_received) . ")";
-               
                db_query($sql, "One of the purchase order detail records could not be updated");
     }
 
@@ -124,8 +123,9 @@ function update_po(&$po_obj)
 
 function read_po_header($order_no, &$order)
 {
-       $sql = "SELECT ".TB_PREF."purch_orders.*, ".TB_PREF."suppliers.supp_name, ".TB_PREF."suppliers.tax_group_id,
-               ".TB_PREF."suppliers.curr_code, ".TB_PREF."locations.location_name
+       $sql = "SELECT ".TB_PREF."purch_orders.*, "
+               .TB_PREF."suppliers.*, "
+               .TB_PREF."locations.location_name 
                FROM ".TB_PREF."purch_orders, ".TB_PREF."suppliers, ".TB_PREF."locations
                WHERE ".TB_PREF."purch_orders.supplier_id = ".TB_PREF."suppliers.supplier_id
                AND ".TB_PREF."locations.loc_code = into_stock_location
@@ -140,9 +140,9 @@ function read_po_header($order_no, &$order)
 
        $order->trans_type = ST_PURCHORDER;
        $order->order_no = $order_no;
-       
+
        $order->set_supplier($myrow["supplier_id"], $myrow["supp_name"], $myrow["curr_code"],
-               $myrow['tax_group_id'], $myrow["tax_included"]);
+               $myrow['tax_group_id'], $myrow["tax_included"], @$myrow["tax_algorithm"]);
 
                $order->credit = get_current_supp_credit($order->supplier_id);
 
index 9628ac76c7783e1098b017a019e7177c4ce76fd8..f4a0e27f622162d1d1520902ae841438eda59a26 100644 (file)
@@ -78,7 +78,7 @@ function add_supp_payment($supplier_id, $date_, $bank_account,
 
    /*now enter the bank_trans entry */
        add_bank_trans($trans_type, $payment_id, $bank_account, $ref,
-               $date_, -($amount + $charge), PT_SUPPLIER,
+               $date_, -($amount + $supp_charge), PT_SUPPLIER,
                $supplier_id, $bank_account_currency,
                "Could not add the supplier payment bank transaction");
 
index b5b93d9e7be0d2e8bbb330baae140e4fa7a3c4a3..8a7464d79fc4f1a65b0bf4826d7820ad06dccdd3 100644 (file)
@@ -14,7 +14,7 @@
 //     FIXME - this should be revised for transaction update case.
 //
 function write_supp_trans($type, $trans_no, $supplier_id, $date_, $due_date, $reference, $supp_reference,
-       $amount, $amount_tax, $discount, $err_msg="", $rate=0, $included=0)
+       $amount, $amount_tax, $discount, $err_msg="", $rate=0, $included=0, $tax_algorithm = null)
 {
        $new = $trans_no==0;
        $date = date2sql($date_);
@@ -33,11 +33,12 @@ function write_supp_trans($type, $trans_no, $supplier_id, $date_, $due_date, $re
 
 
        $sql = "INSERT INTO ".TB_PREF."supp_trans (trans_no, type, supplier_id, tran_date, due_date,
-               reference, supp_reference, ov_amount, ov_gst, rate, ov_discount, tax_included) ";
+               reference, supp_reference, ov_amount, ov_gst, rate, ov_discount, tax_included, tax_algorithm) ";
        $sql .= "VALUES (".db_escape($trans_no).", ".db_escape($type)
        .", ".db_escape($supplier_id).", '$date', '$due_date',
                ".db_escape($reference).", ".db_escape($supp_reference).", ".db_escape($amount)
-               .", ".db_escape($amount_tax).", ".db_escape($rate).", ".db_escape($discount).", ".db_escape($included).")";
+               .", ".db_escape($amount_tax).", ".db_escape($rate).", ".db_escape($discount).", ".db_escape($included).
+               ", ".db_escape($tax_algorithm, true).")";
 
        if ($err_msg == "")
                $err_msg = "Cannot insert a supplier transaction record";
index 535e66c5a0208a3b79a44cc50e0447da8e51c1c3..6091e42e9092901d9ba2b50ffd990be80c126281 100644 (file)
@@ -124,7 +124,7 @@ function get_alloc_supp_sql($extra_fields=null, $extra_conditions=null, $extra_t
 
        if ($extra_conditions)
                $sql .= " AND $extra_conditions";
-       
+
        return $sql;
 }
 
@@ -195,6 +195,7 @@ function get_allocatable_from_supp_transactions($supplier_id, $trans_no=null, $t
        return db_query($sql." ORDER BY due_date", "Cannot retreive alloc to transactions");
 }
 
+
 function get_sql_for_supplier_allocation_inquiry()
 {
        $date_after = date2sql($_POST['TransAfterDate']);
index dd9e49c906fa3cbb4689ba5e95e2387d368555e3..61cf2bdce8a8194ab8e4bdda72024cbffa38679d 100644 (file)
 function add_supplier($supp_name, $supp_ref, $address, $supp_address, $gst_no,
        $website, $supp_account_no, $bank_account, $credit_limit, $dimension_id, $dimension2_id, 
        $curr_code, $payment_terms, $payable_account, $purchase_account, $payment_discount_account, 
-       $notes, $tax_group_id, $tax_included)
+       $notes, $tax_group_id, $tax_included, $tax_algorithm)
 {
        $sql = "INSERT INTO ".TB_PREF."suppliers (supp_name, supp_ref, address, supp_address, gst_no, website,
                supp_account_no, bank_account, credit_limit, dimension_id, dimension2_id, curr_code,
                payment_terms, payable_account, purchase_account, payment_discount_account, notes, 
-               tax_group_id, tax_included)
-               VALUES (".db_escape($supp_name). ", "
+               tax_group_id, tax_included, tax_algorithm)
+               VALUES (".db_escape($_POST['supp_name']). ", "
                .db_escape($supp_ref). ", "
                .db_escape($address) . ", "
                .db_escape($supp_address) . ", "
@@ -27,7 +27,7 @@ function add_supplier($supp_name, $supp_ref, $address, $supp_address, $gst_no,
                .db_escape($website). ", "
                .db_escape($supp_account_no). ", "
                .db_escape($bank_account). ", "
-               .db_escape($credit_limit). ", "
+               .$credit_limit. ", "
                .db_escape($dimension_id). ", "
                .db_escape($dimension2_id). ", "
                .db_escape($curr_code). ", "
@@ -37,7 +37,8 @@ function add_supplier($supp_name, $supp_ref, $address, $supp_address, $gst_no,
                .db_escape($payment_discount_account). ", "
                .db_escape($notes). ", "
                .db_escape($tax_group_id). ", "
-               .db_escape($tax_included). ")";
+               .db_escape($tax_included). ", "
+               .db_escape($tax_algorithm). ")";
 
        db_query($sql,"The supplier could not be added");
 }
@@ -45,7 +46,7 @@ function add_supplier($supp_name, $supp_ref, $address, $supp_address, $gst_no,
 function update_supplier($supplier_id, $supp_name, $supp_ref, $address, $supp_address, $gst_no, 
        $website, $supp_account_no, $bank_account, $credit_limit, $dimension_id, $dimension2_id, 
        $curr_code, $payment_terms, $payable_account, $purchase_account, $payment_discount_account, 
-       $notes, $tax_group_id, $tax_included)
+       $notes, $tax_group_id, $tax_included, $tax_algorithm)
 {
        $sql = "UPDATE ".TB_PREF."suppliers SET supp_name=".db_escape($supp_name) . ",
                supp_ref=".db_escape($supp_ref) . ",
@@ -65,7 +66,8 @@ function update_supplier($supplier_id, $supp_name, $supp_ref, $address, $supp_ad
                payment_discount_account=".db_escape($payment_discount_account) . ",
                notes=".db_escape($notes) . ",
                tax_group_id=".db_escape($tax_group_id). ",
-               tax_included=".db_escape($tax_included)
+               tax_included=".db_escape($tax_included).",
+               tax_algorithm=".db_escape($tax_algorithm)
                ." WHERE supplier_id = ".db_escape($supplier_id);
 
        db_query($sql,"The supplier could not be updated");
@@ -120,7 +122,6 @@ function get_supplier_details($supplier_id, $to=null, $all=true)
                          ".TB_PREF."payment_terms.terms,
                          ".TB_PREF."payment_terms.days_before_due,
                          ".TB_PREF."payment_terms.day_in_following_month";
-
     $result = db_query($sql,"The customer details could not be retrieved");
     $supp = db_fetch($result);
 
@@ -179,4 +180,10 @@ function is_new_supplier($id)
 
        return !key_in_foreign_table($id, $tables, 'supplier_id');
 }
-?>
\ No newline at end of file
+
+function update_supp_tax_algorithm($supplier_id, $tax_algorithm)
+{
+       $sql = "UPDATE ".TB_PREF."suppliers SET tax_algorithm=".db_escape($tax_algorithm)
+               . " WHERE supplier_id=".db_escape($supplier_id);
+       return db_query($sql, "cannot update supplier's tax calculation algorithm");
+}
index b767e9ea9261f66e9ee64245c4f9067bae4bd475..c9ec00df2f32362d5ca993b480c1e699026266f4 100644 (file)
@@ -32,6 +32,8 @@ class purch_order
        var $tax_group_id;
        var $tax_group_array = null; // saves db queries
        var $tax_included; // type of prices
+       var $tax_algorithm;
+       var $stored_algorithm; // copy to find the change after invoice in processed
        var $terms;
        
        var $reference;
@@ -43,13 +45,14 @@ class purch_order
                $this->lines_on_order = $this->order_no = $this->supplier_id = 0;
        }
        
-       function set_supplier($supplier_id, $supplier_name, $curr_code, $tax_group_id, $tax_included)
+       function set_supplier($supplier_id, $supplier_name, $curr_code, $tax_group_id, $tax_included, $tax_algorithm)
        {
                $this->supplier_id = $supplier_id;
                $this->supplier_name = $supplier_name;
                $this->curr_code = $curr_code;
                $this->tax_group_id = $tax_group_id;
                $this->tax_included = $tax_included;
+               $this->stored_algorithm = $this->tax_algorithm = $tax_algorithm;
                $this->tax_group_array = get_tax_group_items_as_array($tax_group_id);
        }
        
@@ -141,13 +144,12 @@ class purch_order
                        $prices[] = round($ln_itm->price * ($receival ? $ln_itm->receive_qty : $ln_itm->quantity),  user_price_dec());
                }
                $taxes = get_tax_for_items($items, $prices, $shipping_cost,
-                 $this->tax_group_id, $this->tax_included,  $this->tax_group_array);
+                 $this->tax_group_id, $this->tax_included,  $this->tax_group_array, $this->tax_algorithm);
 
        // Adjustment for swiss franken, we always have 5 rappen = 1/20 franken
            if ($this->curr_code == 'CHF') {
                        $val = $taxes['1']['Value'];
-                       $val1 = (floatval((intval(round(($val*20),0)))/20));
-                       $taxes['1']['Value'] = $val1;
+                       $taxes['1']['Value'] = (floatval((intval(round(($val*20),0)))/20));
                } 
                return $taxes;
        }
@@ -169,7 +171,7 @@ class purch_order
 
                if (!$this->tax_included ) {
                        $taxes = get_tax_for_items($items, $prices, 0, $this->tax_group_id,
-                       $this->tax_included,  $this->tax_group_array);
+                       $this->tax_included,  $this->tax_group_array, $this->tax_algorithm);
 
                        foreach($taxes as $tax)
                                $total += round($tax['Value'], $dec);
index 130354d7142516a28303246d7f4e9cf7fd2da9da..8178d30d1094affee1bf159c88b1058ebdbe7f8f 100644 (file)
@@ -28,10 +28,12 @@ class supp_trans
        var $tax_included;
        
        var $trans_type;        // invoice or credit
+       var $trans_no;
 
        var $Comments;
        var $tran_date;
        var $due_date;
+       var $src_docs = array();                // source invoice for this credit note (if any)
 
        var $supp_reference;
        var $reference;
@@ -40,13 +42,31 @@ class supp_trans
        var $ov_gst;
        var $gl_codes_counter=0;
        var $credit = 0;
+       var $tax_algorithm;
+       var $stored_algorithm;
+       var $currency;
 
-       function supp_trans($trans_type)
+       function supp_trans($trans_type, $trans_no=0)
        {
                $this->trans_type = $trans_type;
                /*Constructor function initialises a new Supplier Transaction object */
-               $this->grn_items = array();
-               $this->gl_codes = array();
+               $this->read($trans_type, $trans_no);
+       }
+
+       function read($trans_type, $trans_no)
+       {
+               $this->trans_type = $trans_type;
+               $this->trans_no = $trans_no;
+               $this->grn_items = array();
+               $this->gl_codes = array();
+               if ($trans_no) {
+                       read_supp_invoice($trans_no, $trans_type, $this);
+                       if ($trans_type == ST_SUPPCREDIT)
+                       {
+                               $this->src_docs = find_src_invoices($trans_no);
+                       }
+                       read_supplier_details_to_trans($this, $this->supplier_id);
+               }
        }
 
        function add_grn_to_trans($grn_item_id, $po_detail_item, $item_code, $item_description, 
@@ -56,6 +76,7 @@ class supp_trans
                $this->grn_items[$grn_item_id] = new grn_item($grn_item_id, $po_detail_item, 
                        $item_code, $item_description, $qty_recd, $prev_quantity_inv, $this_quantity_inv, 
                        $order_price, $chg_price, $std_cost_unit, $gl_code, $this->tax_included);
+               $this->src_docs = find_src_invoices($this);
                return 1;
        }
 
@@ -114,7 +135,7 @@ class supp_trans
         if ($tax_group_id == null)
                $tax_group_id = $this->tax_group_id;
         $taxes = get_tax_for_items($items, $prices, $shipping_cost, $tax_group_id, 
-               $this->tax_included);
+               $this->tax_included, null, $this->tax_algorithm);
 
 ///////////////// Joe Hunt 2009.08.18
 
@@ -156,7 +177,9 @@ class supp_trans
                }       
                return $total;
     }
-
+       //
+       //      Returns transaction total 
+       //
        function get_items_total()
        {
                $total = 0;
index a5c88381cd79a685bc561ba378c263d47ddace01..cfb2f26c21fa7dc120c76a4eeab39247a0017150 100644 (file)
@@ -36,7 +36,7 @@ function display_grn_summary(&$po, $editable=false)
        ref_cells(_("Reference"), 'ref', '', null, "class='tableheader2'");
                
         if (!isset($_POST['Location']))
-               $_POST['Location'] = $po->location;
+               $_POST['Location'] = $po->Location;
         label_cell(_("Deliver Into Location"), "class='tableheader2'");
         locations_list_cells(null, "Location", $_POST['Location']);
         
@@ -51,7 +51,7 @@ function display_grn_summary(&$po, $editable=false)
     else 
     {
        label_cells(_("Reference"), $po->reference, "class='tableheader2'");
-       label_cells(_("Deliver Into Location"), get_location_name($po->location), "class='tableheader2'");
+       label_cells(_("Deliver Into Location"), get_location_name($po->Location), "class='tableheader2'");
                label_cells(_("Supplier's Reference"), $po->supp_ref, "class='tableheader2'");
     }
     
index 67a02e668b110fb7a1db73a2019e86d8fed820db..298fcb828f33d9fb665673fad6b7d7f481b0af4f 100644 (file)
@@ -19,6 +19,7 @@ function copy_from_trans(&$supp_trans)
        $_POST['supp_reference'] = $supp_trans->supp_reference;
        $_POST['reference'] = $supp_trans->reference;
        $_POST['supplier_id'] = $supp_trans->supplier_id;
+       $_POST['tax_algorithm'] = $supp_trans->tax_algorithm;
 }
 
 //--------------------------------------------------------------------------------------------------
@@ -30,6 +31,8 @@ function copy_to_trans(&$supp_trans)
        $supp_trans->due_date = $_POST['due_date'];
        $supp_trans->supp_reference = $_POST['supp_reference'];
        $supp_trans->reference = $_POST['reference'];
+       if (isset($_POST['tax_algorithm']))
+           $supp_trans->tax_algorithm = $_POST['tax_algorithm'];
 
        $supp_trans->ov_amount = 0; /* for starters */
        if (count($supp_trans->grn_items) > 0)
@@ -65,19 +68,28 @@ function invoice_header(&$supp_trans)
 
        table_section(1);
 
-       if (isset($_POST['invoice_no']))
+       if ($supp_trans->trans_type == ST_SUPPCREDIT && $supp_trans->src_docs)
        {
-               $trans = get_supp_trans($_POST['invoice_no'], ST_SUPPINVOICE);
-               $_POST['supplier_id'] = $trans['supplier_id'];
-               $supp = $trans['supplier_name'] . " - " . $trans['SupplierCurrCode'];
+//             $trans = get_supp_trans($_POST['invoice_no'], ST_SUPPINVOICE);
+//             $trans = get_supp_trans($supp_trans->supplier_id, ST_SUPPINVOICE);
+//             $_POST['supplier_id'] = $trans['supplier_id'];
+//             $supp = $trans['supplier_name'] . " - " . $trans['SupplierCurrCode'];
+
+               $_POST['supplier_id'] = $supp_trans->supplier_id;
+               $supp = $supp_trans->supplier_name." - ".$supp_trans->currency;
                label_row(_("Supplier:"), $supp.hidden('supplier_id', $_POST['supplier_id'], false));
-       }       
+       }
        else
        {
        if (!isset($_POST['supplier_id']) && (get_global_supplier() != ALL_TEXT))
                $_POST['supplier_id'] = get_global_supplier();
 
-               supplier_list_row(_("Supplier:"), 'supplier_id', $_POST['supplier_id'], false, true);
+               if (!$supp_trans->trans_no)
+                       supplier_list_row(_("Supplier:"), 'supplier_id', $_POST['supplier_id'], false, true);
+               else
+                       label_row(_("Supplier:"), $supp_trans->supplier_name
+                       .($supp_trans->currency ? ' - '.$supp_trans->currency  : '')
+                       .hidden('supplier_id', $_POST['supplier_id'], false));
        }
        if ($supp_trans->supplier_id != $_POST['supplier_id'])
        {
@@ -91,12 +103,11 @@ function invoice_header(&$supp_trans)
 
        ref_row(_("Reference:"), 'reference', '', $Refs->get_next($supp_trans->trans_type));
 
-       if (isset($_POST['invoice_no']))
+       if ($supp_trans->trans_type == ST_SUPPCREDIT)
        {
-               label_row(_("Supplier's Ref.:"), $_POST['invoice_no'].hidden('invoice_no', $_POST['invoice_no'], false).hidden('supp_reference', $_POST['invoice_no'], false));
-       }       
-       else
-               text_row(_("Supplier's Ref.:"), 'supp_reference', $_POST['supp_reference'], 20, 60);
+               label_row(_("Source Invoices:"), implode(',' , $supp_trans->src_docs),'','','src_docs');
+       }
+               text_row(_("Supplier's Ref.:"), 'supp_reference', $_POST['supp_reference'], 20, 60);
 
        table_section(2, "33%");
 
@@ -137,10 +148,13 @@ function invoice_header(&$supp_trans)
 
 function invoice_totals(&$supp_trans)
 {
+       global $Ajax;
+
        copy_to_trans($supp_trans);
 
        $dim = get_company_pref('use_dimension');
        $colspan = ($dim == 2 ? 7 : ($dim == 1 ? 6 : 5));
+       div_start('tax_table');
        start_table(TABLESTYLE, "width=95%");
        label_row(_("Sub-total:"), price_format( $supp_trans->ov_amount), "colspan=$colspan align=right", "align=right");
 
@@ -158,8 +172,14 @@ function invoice_totals(&$supp_trans)
 
     end_table(1);
     start_table(TABLESTYLE2);
+    tax_algorithm_list_row(_("Tax algorithm:"), 'tax_algorithm', null, true);
+       if (list_updated('tax_algorithm')) {
+               $supp_trans->tax_algorithm = $_POST['tax_algorithm'];
+           $Ajax->activate('tax_table');
+       }
     textarea_row(_("Memo:"), "Comments", null, 50, 3);
     end_table(1);
+       div_end();
 }
 
 //--------------------------------------------------------------------------------------------------
@@ -319,15 +339,14 @@ function display_gl_items(&$supp_trans, $mode=0)
 
 function display_grn_items_for_selection(&$supp_trans, $k)
 {
-
-       if ($supp_trans->trans_type == ST_SUPPINVOICE)
-               $result = get_grn_items(0, $supp_trans->supplier_id, true);
+       if ($supp_trans->trans_type == ST_SUPPINVOICE)  // outstanding grns and eventually for selected invoice
+               $result = get_grn_items(0, $supp_trans->supplier_id, true, false, $supp_trans->trans_no);
        else
-       {
+       { // only invoiced
                if (isset($_POST['receive_begin']) && isset($_POST['receive_end']))
                        $result = get_grn_items(0, $supp_trans->supplier_id, false, true, 0, $_POST['receive_begin'], $_POST['receive_end']);
-               else if (isset($_POST['invoice_no']))
-                       $result = get_grn_items(0, $supp_trans->supplier_id, false, true, $_POST['invoice_no']);
+               else if ($supp_trans->src_docs)
+                       $result = get_grn_items(0, $supp_trans->supplier_id, false, true, array_keys($supp_trans->src_docs));
                else    
                        $result = get_grn_items(0, $supp_trans->supplier_id, false, true);
        }
@@ -349,21 +368,22 @@ function display_grn_items_for_selection(&$supp_trans, $k)
                        $grn_already_on_invoice = true;
                }
        }
+
        if ($grn_already_on_invoice == false)
        {
 
                        alt_table_row_color($k);
 
                        $n = $myrow["id"];
-               label_cell(get_trans_view_str(25, $myrow["grn_batch_id"]).
-               hidden('qty_recd'.$n, $myrow["qty_recd"], false).
-               hidden('item_code'.$n, $myrow["item_code"], false).
-               hidden('item_description'.$n, $myrow["description"], false).
-               hidden('prev_quantity_inv'.$n, $myrow['quantity_inv'], false).
-               hidden('order_price'.$n, $myrow['unit_price'], false).
-               hidden('std_cost_unit'.$n, $myrow['std_cost_unit'], false).
-               hidden('po_detail_item'.$n, $myrow['po_detail_item'], false).
-               hidden('location'.$n, $myrow["loc_code"], false));
+               label_cell(get_trans_view_str(ST_SUPPRECEIVE, $myrow["grn_batch_id"]));
+               label_cell($myrow["id"].
+               hidden('qty_recd'.$n, $myrow["qty_recd"], false).
+               hidden('item_code'.$n, $myrow["item_code"], false).
+               hidden('item_description'.$n, $myrow["description"], false).
+               hidden('prev_quantity_inv'.$n, $myrow['quantity_inv'], false).
+               hidden('order_price'.$n, $myrow['unit_price'], false).
+               hidden('std_cost_unit'.$n, $myrow['std_cost_unit'], false).
+               hidden('po_detail_item'.$n, $myrow['po_detail_item'], false));
                label_cell(get_trans_view_str(ST_PURCHORDER, $myrow["purch_order_no"]));
             label_cell($myrow["item_code"]);
             label_cell($myrow["description"]);
@@ -374,10 +394,10 @@ function display_grn_items_for_selection(&$supp_trans, $k)
             if ($supp_trans->trans_type == ST_SUPPINVOICE)
                qty_cells(null, 'this_quantity_inv'.$n, number_format2($myrow["qty_recd"] - $myrow["quantity_inv"], $dec), 
                        null, null, $dec);
-            else               
+            else
                qty_cells(null, 'This_QuantityCredited'.$n, number_format2(max($myrow["quantity_inv"], 0), $dec), 
                        null, null, $dec);
-            $dec2 = 0;                 
+            $dec2 = 0;
             if ($supp_trans->trans_type == ST_SUPPINVOICE)
             {
                amount_cells(null, 'ChgPrice'.$n, price_decimal_format($myrow["unit_price"], $dec2), null, null, $dec2);
@@ -395,7 +415,7 @@ function display_grn_items_for_selection(&$supp_trans, $k)
                if (($supp_trans->trans_type == ST_SUPPINVOICE) && $_SESSION["wa_current_user"]->can_access('SA_GRNDELETE')) {  // Added 2008-10-18 by Joe Hunt. Special access rights needed.
                        submit_cells('void_item_id'.$n, _("Remove"), '', _("WARNING! Be careful with removal. The operation is executed immediately and cannot be undone !!!"), true);
                                submit_js_confirm('void_item_id'.$n,
-                                       _('You are about to remove all yet non-invoiced items from selected delivery line. This operation also irreversibly changes related order line. Do you want to continue ?'));
+                                       sprintf(_('You are about to remove all yet non-invoiced items from delivery line #%d. This operation also irreversibly changes related order line. Do you want to continue ?'), $n));
                        }
                        end_row();
        }
@@ -439,28 +459,28 @@ function display_grn_items(&$supp_trans, $mode=0)
                        $heading = _("Received Items Charged on this Invoice");
                else
                        $heading = _("Received Items Credited on this Note");
-       }               
+       }
 
        display_heading($heading);
 
        if ($mode == 1)
        {
-               if ($supp_trans->trans_type == ST_SUPPCREDIT && !isset($_POST['invoice_no']))
+               if ($supp_trans->trans_type == ST_SUPPCREDIT)
                {
                        echo "</td>";
                        date_cells(_("Received between"), 'receive_begin', "", null, -30, 0, 0, "valign=middle");
                        date_cells(_("and"), 'receive_end', '', null, 1, 0, 0, "valign=middle");
                        submit_cells('RefreshInquiry', _("Search"),'',_('Refresh Inquiry'), true);
                        echo "<td>";
-               }       
-                       
+               }
+
                if ($heading2 != "")
                {
                        display_note($heading2, 0, 0, "class='overduefg'");
-               }       
+               }
                echo "</td><td width=10% align='right'>";
                submit('InvGRNAll', _("Add All Items"), true, false,true);
-       }       
+       }
 
        end_outer_table(0, false);
 
@@ -468,7 +488,7 @@ function display_grn_items(&$supp_trans, $mode=0)
        start_table(TABLESTYLE, "width=95%");
        if ($mode == 1)
        {
-       $th = array(_("Delivery"), _("P.O."), _("Item"), _("Description"),
+       $th = array(_("Delivery"), _("Sequence #"), _("P.O."), _("Item"), _("Description"),
                _("Received On"), _("Quantity Received"), _("Quantity Invoiced"),
                _("Qty Yet To Invoice"), $supp_trans->tax_included ? _("Price after Tax") : _("Price before Tax"), 
                _("Total"), "");
@@ -496,12 +516,13 @@ function display_grn_items(&$supp_trans, $mode=0)
                alt_table_row_color($k);
 
                        $grn_batch = get_grn_batch_from_item($entered_grn->id);
-               label_cell(get_trans_view_str(ST_SUPPRECEIVE,$grn_batch));
+               label_cell(get_trans_view_str(ST_SUPPRECEIVE, $grn_batch));
                if ($mode == 1)
                {
-                               $row = get_grn_batch($grn_batch);
-                               label_cell($row['purch_order_no']); // PO
-                       }
+                               label_cell($entered_grn->id);
+                               $row = get_grn_batch($grn_batch);
+                               label_cell(get_trans_view_str(ST_PURCHORDER, $row["purch_order_no"])); // PO
+                       }       
                        label_cell($entered_grn->item_code);
                        label_cell($entered_grn->item_description);
             $dec = get_qty_dec($entered_grn->item_code);
index ec5ad432683a4dfbb8503c4511739eedfdb1abdb..617e78e48eabf38fe27cada73ed04d256f33d7a7 100644 (file)
@@ -19,13 +19,14 @@ function copy_from_cart()
 
        $_POST['supplier_id'] = $cart->supplier_id;
        $_POST['OrderDate'] = $cart->orig_order_date;
-       if ($cart->trans_type==ST_SUPPINVOICE)
+       if ($cart->trans_type == ST_SUPPINVOICE)
                $_POST['due_date'] = $cart->due_date;
     $_POST['supp_ref'] = $cart->supp_ref;
     $_POST['ref'] = $cart->reference;
        $_POST['Comments'] = $cart->Comments;
     $_POST['StkLocation'] = $cart->Location;
     $_POST['delivery_address'] = $cart->delivery_address;
+    $_POST['tax_algorithm'] = $cart->tax_algorithm;
 }
 
 function copy_to_cart()
@@ -34,19 +35,21 @@ function copy_to_cart()
 
        $cart->supplier_id = $_POST['supplier_id'];     
        $cart->orig_order_date = $_POST['OrderDate'];
-       if ($cart->trans_type==ST_SUPPINVOICE)
+       if ($cart->trans_type == ST_SUPPINVOICE)
                $cart->due_date = $_POST['due_date'];
        $cart->reference = $_POST['ref'];
        $cart->supp_ref = $_POST['supp_ref'];
        $cart->Comments = $_POST['Comments'];   
        $cart->Location = $_POST['StkLocation'];
        $cart->delivery_address = $_POST['delivery_address'];
+       if (isset($_POST['tax_algorithm']))
+           $cart->tax_algorithm = $_POST['tax_algorithm'];
 }
 // ------------------------------------------------------------------------------
 
 function get_supplier_details_to_order(&$order, $supplier_id)
 {
-       $sql = "SELECT curr_code, supp_name, tax_group_id, supp.tax_included,
+       $sql = "SELECT curr_code, supp_name, tax_group_id, supp.tax_included, supp.tax_algorithm,
                        supp.credit_limit - Sum(IFNULL(IF(trans.type=".ST_SUPPCREDIT.", -1, 1) 
                                * (ov_amount + ov_gst + ov_discount),0)) as cur_credit,
                                terms.terms, terms.days_before_due, terms.day_in_following_month
@@ -71,7 +74,7 @@ function get_supplier_details_to_order(&$order, $supplier_id)
        $_POST['curr_code'] = $myrow["curr_code"];
 
        $order->set_supplier($supplier_id, $myrow["supp_name"], $myrow["curr_code"], 
-               $myrow["tax_group_id"], $myrow["tax_included"]);
+               $myrow["tax_group_id"], $myrow["tax_included"], $myrow["tax_algorithm"]);
 }
 
 //---------------------------------------------------------------------------------------------------
@@ -130,6 +133,7 @@ function display_po_header(&$order)
                get_supplier_details_to_order($order, $_POST['supplier_id']); 
            get_duedate_from_terms($order);
                $_POST['due_date'] = $order->due_date;
+               $_POST['tax_algorithm'] = $order->tax_algorithm;
 
                // supplier default price update
                foreach ($order->line_items as $line_no=>$item) {
@@ -141,6 +145,7 @@ function display_po_header(&$order)
                }
            $Ajax->activate('items_table');
            $Ajax->activate('due_date');
+           $Ajax->activate('tax_algorithm');
        }
        set_global_supplier($_POST['supplier_id']);
 
index 9925ac6399a393387a286074b120a8e11c0e1492..90d869aa907acbe5cf0452e0e4047e293b59913b 100644 (file)
@@ -16,15 +16,13 @@ include_once($path_to_root . "/includes/session.inc");
 
 include_once($path_to_root . "/purchasing/includes/purchasing_ui.inc");
 include_once($path_to_root . "/reporting/includes/reporting.inc");
-if (!@$_GET['popup'])
-{
-       $js = "";
-       if ($use_popup_windows)
-               $js .= get_js_open_window(900, 500);
-       if ($use_date_picker)
-               $js .= get_js_date_picker();
-       page(_($help_context = "Search Purchase Orders"), false, false, "", $js);
-}
+$js = "";
+if ($use_popup_windows)
+       $js .= get_js_open_window(900, 500);
+if ($use_date_picker)
+       $js .= get_js_date_picker();
+page(_($help_context = "Search Purchase Orders"), false, false, "", $js);
+
 if (isset($_GET['order_number']))
 {
        $order_number = $_GET['order_number'];
@@ -55,8 +53,7 @@ if (get_post('SearchOrders'))
 }
 //---------------------------------------------------------------------------------------------
 
-if (!@$_GET['popup'])
-       start_form();
+start_form();
 
 start_table(TABLESTYLE_NOBORDER);
 start_row();
@@ -101,7 +98,9 @@ function trans_view($trans)
 
 function edit_link($row) 
 {
-       if (@$_GET['popup'])
+       global $page_nested;
+
+       if ($page_nested)
                return '';
        return pager_link( _("Edit"),
                "/purchasing/po_entry_items.php?" . SID 
@@ -141,9 +140,6 @@ $table->width = "80%";
 
 display_db_pager($table);
 
-if (!@$_GET['popup'])
-{
-       end_form();
-       end_page();
-}      
+end_form();
+end_page();
 ?>
index 17bf983bf87247d39273b2a18d651e14f5bcf202..eb7cedc169c5da130b6f71a83dc3a06cc3207640 100644 (file)
@@ -95,15 +95,14 @@ function fmt_balance($row)
 
 function alloc_link($row)
 {
-       if (($row["type"] == ST_BANKPAYMENT || $row["type"] == ST_SUPPCREDIT || $row["type"] == ST_SUPPAYMENT) 
+       $link = 
+       pager_link(_("Allocations"),
+               "/purchasing/allocations/supplier_allocate.php?trans_no=" .
+                       $row["trans_no"]. "&trans_type=" . $row["type"], ICON_MONEY );
+
+       return (($row["type"] == ST_BANKPAYMENT || $row["type"] == ST_SUPPCREDIT || $row["type"] == ST_SUPPAYMENT) 
                && (-$row["TotalAmount"] - $row["Allocated"]) > 0)
-                       return  pager_link(_("Allocations"), "/purchasing/allocations/supplier_allocate.php?trans_no=" .
-                               $row["trans_no"]. "&trans_type=" . $row["type"], ICON_MONEY );
-       elseif ($row["type"] == ST_SUPPINVOICE && ($row["TotalAmount"] - $row["Allocated"]) > 0)
-                       return  pager_link(_("Pay"), "/purchasing/supplier_payment.php?supplier_id=".$row["supplier_id"]
-                               ."&PInvoice=".$row["trans_no"], ICON_MONEY );
-       else
-               return '';
+               ? $link : '';
 }
 
 function fmt_debit($row)
index ffb264b523420876cef4ae6fe3ca936e884faa09..af6c2216623c06cd168d7d8cd735143f5dfdfaca 100644 (file)
@@ -17,15 +17,13 @@ include_once($path_to_root . "/includes/session.inc");
 include_once($path_to_root . "/purchasing/includes/purchasing_ui.inc");
 include_once($path_to_root . "/reporting/includes/reporting.inc");
 
-if (!@$_GET['popup'])
-{
-       $js = "";
-       if ($use_popup_windows)
-               $js .= get_js_open_window(900, 500);
-       if ($use_date_picker)
-               $js .= get_js_date_picker();
-       page(_($help_context = "Supplier Inquiry"), isset($_GET['supplier_id']), false, "", $js);
-}
+$js = "";
+if ($use_popup_windows)
+       $js .= get_js_open_window(900, 500);
+if ($use_date_picker)
+       $js .= get_js_date_picker();
+page(_($help_context = "Supplier Inquiry"), isset($_GET['supplier_id']), false, "", $js);
+
 if (isset($_GET['supplier_id'])){
        $_POST['supplier_id'] = $_GET['supplier_id'];
 }
@@ -38,8 +36,7 @@ if (isset($_GET['ToDate'])){
 
 //------------------------------------------------------------------------------------------------
 
-if (!@$_GET['popup'])
-       start_form();
+start_form();
 
 if (!isset($_POST['supplier_id']))
        $_POST['supplier_id'] = get_global_supplier();
@@ -47,8 +44,8 @@ if (!isset($_POST['supplier_id']))
 start_table(TABLESTYLE_NOBORDER);
 start_row();
 
-if (!@$_GET['popup'])
-       supplier_list_cells(_("Select a supplier:"), 'supplier_id', null, true, false, false, !@$_GET['popup']);
+if (!$page_nested)
+       supplier_list_cells(_("Select a supplier:"), 'supplier_id', null, true, false, false, true);
 
 date_cells(_("From:"), 'TransAfterDate', '', null, -30);
 date_cells(_("To:"), 'TransToDate');
@@ -109,6 +106,7 @@ function systype_name($dummy, $type)
        global $systypes_array;
        return $systypes_array[$type];
 }
+div_end();
 
 function trans_view($trans)
 {
@@ -127,7 +125,9 @@ function gl_view($row)
 
 function credit_link($row)
 {
-       if (@$_GET['popup'])
+       global $page_nested;
+
+       if ($page_nested)
                return '';
        return $row['type'] == ST_SUPPINVOICE && $row["TotalAmount"] - $row["Allocated"] > 0 ?
                pager_link(_("Credit This"),
@@ -160,6 +160,11 @@ function check_overdue($row)
        return $row['OverDue'] == 1
                && (abs($row["TotalAmount"]) - $row["Allocated"] != 0);
 }
+
+function edit_link($row)
+{
+       return edit_trans_link($row['type'], $row['trans_no']);
+}
 //------------------------------------------------------------------------------------------------
 
 $sql = get_sql_for_supplier_inquiry();
@@ -177,7 +182,8 @@ $cols = array(
                        _("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'=>'prt_link')
+                       array('insert'=>true, 'fun'=>'prt_link'),
+                       array('insert'=>true, 'fun'=>'edit_link')
                        );
 
 if ($_POST['supplier_id'] != ALL_TEXT)
@@ -185,8 +191,6 @@ if ($_POST['supplier_id'] != ALL_TEXT)
        $cols[_("Supplier")] = 'skip';
        $cols[_("Currency")] = 'skip';
 }
-//------------------------------------------------------------------------------------------------
-
 
 /*show a table of the transactions returned by the sql */
 $table =& new_db_pager('trans_tbl', $sql, $cols);
@@ -196,9 +200,7 @@ $table->width = "85%";
 
 display_db_pager($table);
 
-if (!@$_GET['popup'])
-{
-       end_form();
-       end_page(@$_GET['popup'], false, false);
-}
+end_form();
+end_page();
+
 ?>
index edfad13a6d9d3021e8f5d3c29a33b5b30a9e87f7..287849ff9d765c980a9fb1d73fa9da04aa6cff6c 100644 (file)
@@ -61,6 +61,7 @@ function supplier_settings(&$supplier_id)
                $_POST['credit_limit']  = price_format($myrow["credit_limit"]);
                $_POST['tax_group_id'] = $myrow["tax_group_id"];
                $_POST['tax_included'] = $myrow["tax_included"];
+               $_POST['tax_algorithm'] = $myrow["tax_algorithm"];
                $_POST['payable_account']  = $myrow["payable_account"];
                $_POST['purchase_account']  = $myrow["purchase_account"];
                $_POST['payment_discount_account'] = $myrow["payment_discount_account"];
@@ -74,6 +75,7 @@ function supplier_settings(&$supplier_id)
                $_POST['dimension_id'] = 0;
                $_POST['dimension2_id'] = 0;
                $_POST['tax_included'] = 0;
+               $_POST['tax_algorithm'] = 1;
                $_POST['sales_type'] = -1;
                $_POST['gst_no'] = $_POST['bank_account'] = '';
                $_POST['payment_terms']  = '';
@@ -111,7 +113,7 @@ function supplier_settings(&$supplier_id)
        payment_terms_list_row(_("Payment Terms:"), 'payment_terms', null);
        //
        // tax_included option from supplier record is used directly in update_average_cost() function,
-       // therefore we can't edit the option after any transaction waas done for the supplier.
+       // therefore we can't edit the option after any transaction was done for the supplier.
        //
        if (is_new_supplier($supplier_id))
                check_row(_("Prices contain tax included:"), 'tax_included');
@@ -119,6 +121,10 @@ function supplier_settings(&$supplier_id)
                hidden('tax_included');
                label_row(_("Prices contain tax included:"), $_POST['tax_included'] ? _('Yes') : _('No'));
        }
+       tax_algorithm_list_row(_("Tax Calculation Algorithm:"), 'tax_algorithm', null);
+
+       if (!$supplier_id) table_section(2);
+
        table_section_title(_("Accounts"));
        gl_all_accounts_list_row(_("Accounts Payable Account:"), 'payable_account', $_POST['payable_account']);
        gl_all_accounts_list_row(_("Purchase Account:"), 'purchase_account', $_POST['purchase_account'],
@@ -128,9 +134,11 @@ function supplier_settings(&$supplier_id)
                table_section_title(_("Contact Data"));
                text_row(_("Phone Number:"), 'phone', null, 32, 30);
                text_row(_("Secondary Phone Number:"), 'phone2', null, 32, 30);
+               table_section_title(_("Contact Data"));
+               text_row(_("Fax Number:"), 'fax', null, 32, 30);
+               email_row(_("E-mail:"), 'email', null, 35, 55);
+               languages_list_row(_("Document Language:"), 'rep_lang', null, _('System default'));
        }
-
-       table_section(2);
        $dim = get_company_pref('use_dimension');
        if ($dim >= 1)
        {
@@ -143,6 +151,7 @@ function supplier_settings(&$supplier_id)
                hidden('dimension_id', 0);
        if ($dim < 2)
                hidden('dimension2_id', 0);
+       table_section(2);
 
 
        table_section_title(_("Addresses"));
@@ -153,13 +162,6 @@ function supplier_settings(&$supplier_id)
        textarea_row(_("General Notes:"), 'notes', null, 35, 5);
        if ($supplier_id)
                record_status_list_row(_("Supplier status:"), 'inactive');
-       else {
-               table_section_title(_("Contact Data"));
-               text_row(_("Contact Person:"), 'contact', null, 42, 40);
-               text_row(_("Fax Number:"), 'fax', null, 32, 30);
-               email_row(_("E-mail:"), 'email', null, 35, 55);
-               languages_list_row(_("Document Language:"), 'rep_lang', null, _('System default'));
-       }
        end_outer_table(1);
 
        div_start('controls');
@@ -214,7 +216,7 @@ if (isset($_POST['submit']))
                                $_POST['website'], $_POST['supp_account_no'], $_POST['bank_account'], 
                                input_num('credit_limit', 0), $_POST['dimension_id'], $_POST['dimension2_id'], $_POST['curr_code'],
                                $_POST['payment_terms'], $_POST['payable_account'], $_POST['purchase_account'], $_POST['payment_discount_account'],
-                               $_POST['notes'], $_POST['tax_group_id'], @$_POST['tax_included']);
+                               $_POST['notes'], $_POST['tax_group_id'], @$_POST['tax_included'], get_post('tax_algorithm'));
                        update_record_status($_POST['supplier_id'], $_POST['inactive'],
                                'suppliers', 'supplier_id');
 
@@ -227,7 +229,7 @@ if (isset($_POST['submit']))
                                $_POST['gst_no'], $_POST['website'], $_POST['supp_account_no'], $_POST['bank_account'], 
                                input_num('credit_limit',0), $_POST['dimension_id'], $_POST['dimension2_id'],
                                $_POST['curr_code'], $_POST['payment_terms'], $_POST['payable_account'], $_POST['purchase_account'],
-                               $_POST['payment_discount_account'], $_POST['notes'], $_POST['tax_group_id'], check_value('tax_included'));
+                               $_POST['payment_discount_account'], $_POST['notes'], $_POST['tax_group_id'], check_value('tax_included'), get_post('tax_algorithm'));
 
                        $supplier_id = $_POST['supplier_id'] = db_insert_id();
 
index a23b7a0754b94603dc9e8e1d22931b4d6df3f337..388eb772158c7449dee682d35dfc5b0d8e91705c 100644 (file)
@@ -57,6 +57,9 @@ if (isset($_GET['ModifyOrderNumber']) && is_numeric($_GET['ModifyOrderNumber']))
 
 page($_SESSION['page_title'], false, false, "", $js);
 
+if (isset($_GET['ModifyOrderNumber']))
+       check_is_closed(ST_PURCHORDER, $_GET['ModifyOrderNumber']);
+
 //---------------------------------------------------------------------------------------------------
 
 check_db_has_suppliers(_("There are no suppliers defined in the system."));
@@ -327,17 +330,16 @@ function can_commit()
                set_focus('supplier_id');
                return false;
        } 
-       
+
        if (!is_date($_POST['OrderDate'])) 
        {
                display_error(_("The entered order date is invalid."));
                set_focus('OrderDate');
                return false;
        } 
-       
-       if ($_SESSION['PO']->trans_type != ST_PURCHORDER && !is_date_in_fiscalyear($_POST['OrderDate'])) 
-       {
-               display_error(_("The entered date is not in fiscal year"));
+       if (($_SESSION['PO']->trans_type == ST_SUPPRECEIVE || $_SESSION['PO']->trans_type == ST_SUPPINVOICE) 
+               && !is_date_in_fiscalyear($_POST['OrderDate'])) {
+               display_error(_("The entered date is out of fiscal year or is closed for further data entry."));
                set_focus('OrderDate');
                return false;
        }
@@ -348,7 +350,7 @@ function can_commit()
                set_focus('due_date');
                return false;
        } 
-       
+
        if (!$_SESSION['PO']->order_no) 
        {
        if (!$Refs->is_valid(get_post('ref'))) 
@@ -357,7 +359,7 @@ function can_commit()
                        set_focus('ref');
                return false;
        } 
-       
+
        if (!is_new_reference(get_post('ref'), $_SESSION['PO']->trans_type)) 
        {
                display_error(_("The entered reference is already in use."));
@@ -365,7 +367,7 @@ function can_commit()
                return false;
        }
        }
-       
+
        if ($_SESSION['PO']->trans_type == ST_SUPPINVOICE && !$Refs->is_valid(get_post('supp_ref'))) 
        {
                display_error(_("You must enter a supplier's invoice reference."));
@@ -405,6 +407,8 @@ function can_commit()
 
 function handle_commit_order()
 {
+       global $Refs, $type_shortcuts;
+
        $cart = &$_SESSION['PO'];
 
        if (can_commit()) {
@@ -451,24 +455,43 @@ function handle_commit_order()
                        $inv->reference = $ref;
                        $inv->supp_reference = $cart->supp_ref;
                        $inv->tax_included = $cart->tax_included;
+                       $inv->tax_algorithm = $cart->tax_algorithm;
+                       $inv->stored_algorithm = $cart->stored_algorithm;
                        $supp = get_supplier($cart->supplier_id);
                        $inv->tax_group_id = $supp['tax_group_id'];
-//                     $inv->ov_discount 'this isn't used at all'
-                       $inv->ov_amount = $inv->ov_gst = 0;
-                       
+                       $total = 0;
+
                        foreach($cart->line_items as $key => $line) {
                                $inv->add_grn_to_trans($line->grn_item_id, $line->po_detail_rec, $line->stock_id,
                                        $line->item_description, $line->receive_qty, 0, $line->receive_qty,
                                        $line->price, $line->price, true, get_standard_cost($line->stock_id), '');
-                               $inv->ov_amount += round2(($line->receive_qty * $line->price), user_price_dec());
+                               $total += round2(($line->receive_qty * $line->price), user_price_dec());
                        }
-                       $taxes = $inv->get_taxes($inv->tax_group_id, 0, false);
-                       foreach( $taxes as $taxitem) {
-                               $inv->ov_gst += round2($taxitem['Value'], user_price_dec());
+                       if (!$inv->tax_included) {
+                               $taxes = $inv->get_taxes($inv->tax_group_id, 0, false, $inv->tax_algorithm);
+                               foreach( $taxes as $taxitem) {
+                                       $total += $taxitem['Value'];
+                               }
                        }
+
                        $inv_no = add_supp_invoice($inv);
-                       commit_transaction(); // save PO+GRN+PI
-                       // FIXME payment for cash terms. (Needs cash account selection)
+                       // presume supplier data need correction
+                       if ($inv->stored_algorithm != $inv->tax_algorithm)
+                               update_supp_tax_algorithm($inv->supplier_id, $inv->tax_algorithm);
+
+                       if (get_post('cash_account')) {
+
+                               $pmt_no = add_supp_payment($inv->supplier_id, $inv->tran_date, get_post('cash_account'),
+                                       $total, 0,      $Refs->get_next(ST_SUPPAYMENT), 
+                                       _('Payment for:').$inv->supp_reference .' ('.$type_shortcuts[ST_SUPPINVOICE].$inv_no.')');
+                               add_supp_allocation($total, ST_SUPPAYMENT, $pmt_no, ST_SUPPINVOICE, $inv_no, $inv->tran_date);
+                               update_supp_trans_allocation(ST_SUPPINVOICE, $inv_no, $total);
+                               update_supp_trans_allocation(ST_SUPPAYMENT, $pmt_no, $total);
+
+                       }
+
+                       commit_transaction(); // save PO+GRN+PI(+SP)
+
                        unset($_SESSION['PO']);
                        meta_forward($_SERVER['PHP_SELF'], "AddedPI=$inv_no");
                }
@@ -515,6 +538,17 @@ echo "<br>";
 display_po_items($_SESSION['PO']);
 
 start_table(TABLESTYLE2);
+
+if (list_updated('tax_algorithm')) {
+       $_SESSION['PO']->tax_algorithm = $_POST['tax_algorithm'];
+    $Ajax->activate('items_table');
+}
+
+if ($_SESSION['PO']->trans_type == ST_SUPPINVOICE) {
+       tax_algorithm_list_row(_("Tax algorithm:"), 'tax_algorithm', null, true);
+       cash_accounts_list_row(_("Payment:"), 'cash_account', null, false, _('Delayed'));
+}
+
 textarea_row(_("Memo:"), 'Comments', null, 70, 4);
 
 end_table(1);
index 3d09c3d8a3eac70fbadeb3d27e775f7c7e817c40..83900c865a0458592d0532360f48cb880875ff79 100644 (file)
@@ -175,10 +175,8 @@ function can_process()
                set_focus('DefaultReceivedDate');
                return false;
        }
-
-       if (!is_date_in_fiscalyear($_POST['DefaultReceivedDate'])) 
-       {
-               display_error(_("The entered date is not in fiscal year"));
+       if (!is_date_in_fiscalyear($_POST['DefaultReceivedDate'])) {
+               display_error(_("The entered date is out of fiscal year or is closed for further data entry."));
                set_focus('DefaultReceivedDate');
                return false;
        }
index 038f50857d60e409647be029c6f4dbfb2ef23e15..e4805768230b53374c9aa4566b118ba7f3e63996 100644 (file)
@@ -25,12 +25,47 @@ if ($use_popup_windows)
        $js .= get_js_open_window(900, 500);
 if ($use_date_picker)
        $js .= get_js_date_picker();
-page(_($help_context = "Supplier Credit Note"), false, false, "", $js);
 
 //----------------------------------------------------------------------------------------
 
 check_db_has_suppliers(_("There are no suppliers defined in the system."));
 
+if (isset($_GET['ModifyCredit']))
+       check_is_closed(ST_SUPPINVOICE, $_GET['ModifyCredit']);
+
+//---------------------------------------------------------------------------------------------------
+
+if (isset($_GET['New']))
+{
+       if (isset( $_SESSION['supp_trans']))
+       {
+               unset ($_SESSION['supp_trans']->grn_items);
+               unset ($_SESSION['supp_trans']->gl_codes);
+               unset ($_SESSION['supp_trans']);
+       }
+
+       if (isset($_GET['invoice_no']))
+       {
+               $_SESSION['supp_trans'] = new supp_trans(ST_SUPPINVOICE, $_GET['invoice_no']);
+               $_SESSION['supp_trans']->src_doc = $_GET['invoice_no'];
+
+
+               $_SESSION['supp_trans']->trans_type = ST_SUPPCREDIT;
+               $_SESSION['supp_trans']->trans_no = 0;
+               $_SESSION['supp_trans']->supp_reference = '';
+               //              $_SESSION['supp_trans']->supp_reference = $_POST['invoice_no'] = $_GET['invoice_no'];
+               $help_context = "Supplier Credit Note";
+               $_SESSION['page_title'] = _("Supplier Credit Note");
+
+               $_SESSION['supp_trans'] = new supp_trans(ST_SUPPCREDIT);
+       } elseif (isset($_GET['ModifyInvoice'])) {
+               $help_context = 'Modifying Purchase Invoice';
+               $_SESSION['page_title'] = sprintf( _("Modifying Supplier Credit # %d"), $_GET['ModifyCredit']);
+               $_SESSION['supp_trans'] = new supp_trans(ST_SUPPCREDIT, $_GET['ModifyCredit']);
+       }
+}
+page($_SESSION['page_title'], false, false, "", $js);
+
 //---------------------------------------------------------------------------------------------------------------
 
 if (isset($_GET['AddedID'])) 
@@ -47,26 +82,8 @@ if (isset($_GET['AddedID']))
 
     hyperlink_params($_SERVER['PHP_SELF'], _("Enter Another Credit Note"), "New=1");
        hyperlink_params("$path_to_root/admin/attachments.php", _("Add an Attachment"), "filterType=$trans_type&trans_no=$invoice_no");
-       
-       display_footer_exit();
-}
-
-//---------------------------------------------------------------------------------------------------
-
-if (isset($_GET['New']))
-{
-       if (isset( $_SESSION['supp_trans']))
-       {
-               unset ($_SESSION['supp_trans']->grn_items);
-               unset ($_SESSION['supp_trans']->gl_codes);
-               unset ($_SESSION['supp_trans']);
-       }
 
-       $_SESSION['supp_trans'] = new supp_trans(ST_SUPPCREDIT);
-       if (isset($_GET['invoice_no']))
-       {
-               $_SESSION['supp_trans']->supp_reference = $_POST['invoice_no'] = $_GET['invoice_no'];
-       }
+       display_footer_exit();
 }
 
 function clear_fields()
@@ -91,7 +108,7 @@ if (isset($_POST['ClearFields']))
        clear_fields();
 }
 
-if (isset($_POST['AddGLCodeToTrans'])){
+if (isset($_POST['AddGLCodeToTrans'])) {
 
        $Ajax->activate('gl_items');
        $input_error = false;
@@ -136,7 +153,7 @@ if (isset($_POST['AddGLCodeToTrans'])){
 function check_data()
 {
        global $total_grn_value, $total_gl_value, $Refs, $SysPrefs;
-       
+
        if (!$_SESSION['supp_trans']->is_valid_trans_to_post())
        {
                display_error(_("The credit note cannot be processed because the there are no items or values on the invoice.  Credit notes are expected to have a charge."));
@@ -151,7 +168,7 @@ function check_data()
                return false;
        }
 
-       if (!is_new_reference($_SESSION['supp_trans']->reference, ST_SUPPCREDIT)) 
+       if (!is_new_reference($_SESSION['supp_trans']->reference, ST_SUPPCREDIT, $_SESSION['supp_trans']->trans_no))
        {
                display_error(_("The entered reference is already in use."));
                set_focus('reference');
@@ -173,7 +190,7 @@ function check_data()
        } 
        elseif (!is_date_in_fiscalyear($_SESSION['supp_trans']->tran_date)) 
        {
-               display_error(_("The entered date is not in fiscal year."));
+               display_error(_("The entered date is out of fiscal year or is closed for further data entry."));
                set_focus('tran_date');
                return false;
        }
index b4c7b89e636aa9c022490e4f6f422307b4415567..7e3ca5df811f8a5743fddfa35e829e3908f2198b 100644 (file)
@@ -25,12 +25,34 @@ if ($use_popup_windows)
        $js .= get_js_open_window(900, 500);
 if ($use_date_picker)
        $js .= get_js_date_picker();
-page(_($help_context = "Enter Supplier Invoice"), false, false, "", $js);
-
 //----------------------------------------------------------------------------------------
 
 check_db_has_suppliers(_("There are no suppliers defined in the system."));
 
+if (isset($_GET['ModifyInvoice']))
+       check_is_closed(ST_SUPPINVOICE, $_GET['ModifyInvoice']);
+
+//--------------------------------------------------------------------------------------------------
+
+if (isset($_GET['New']))
+{
+       if (isset( $_SESSION['supp_trans']))
+       {
+               unset ($_SESSION['supp_trans']->grn_items);
+               unset ($_SESSION['supp_trans']->gl_codes);
+               unset ($_SESSION['supp_trans']);
+       }
+       $help_context = "Enter Supplier Invoice";
+       $_SESSION['page_title'] = _("Enter Supplier Invoice");
+
+       $_SESSION['supp_trans'] = new supp_trans(ST_SUPPINVOICE);
+} else if(isset($_GET['ModifyInvoice'])) {
+       $help_context = 'Modifying Purchase Invoice';
+       $_SESSION['page_title'] = sprintf( _("Modifying Purchase Invoice # %d"), $_GET['ModifyInvoice']);
+       $_SESSION['supp_trans'] = new supp_trans(ST_SUPPINVOICE, $_GET['ModifyInvoice']);
+}
+
+page($_SESSION['page_title'], false, false, "", $js);
 //---------------------------------------------------------------------------------------------------------------
 
 if (isset($_GET['AddedID'])) 
@@ -66,6 +88,8 @@ if (isset($_GET['New']))
        }
 
        $_SESSION['supp_trans'] = new supp_trans(ST_SUPPINVOICE);
+} else if(isset($_GET['ModifyInvoice'])) {
+       $_SESSION['supp_trans'] = new supp_trans(ST_SUPPINVOICE, $_GET['ModifyInvoice']);
 }
 
 //--------------------------------------------------------------------------------------------------
@@ -149,7 +173,7 @@ function check_data()
                return false;
        }
 
-       if (!is_new_reference($_SESSION['supp_trans']->reference, ST_SUPPINVOICE)) 
+       if (!is_new_reference($_SESSION['supp_trans']->reference, ST_SUPPINVOICE, $_SESSION['supp_trans']->trans_no))
        {
                display_error(_("The entered reference is already in use."));
                set_focus('reference');
@@ -171,7 +195,7 @@ function check_data()
        } 
        elseif (!is_date_in_fiscalyear($_SESSION['supp_trans']->tran_date)) 
        {
-               display_error(_("The entered date is not in fiscal year."));
+               display_error(_("The entered date is out of fiscal year or is closed for further data entry."));
                set_focus('trans_date');
                return false;
        }
@@ -182,7 +206,7 @@ function check_data()
                return false;
        }
 
-       if (is_reference_already_there($_SESSION['supp_trans']->supplier_id, $_POST['supp_reference']))
+       if (is_reference_already_there($_SESSION['supp_trans']->supplier_id, $_POST['supp_reference'], $_SESSION['supp_trans']->trans_no))
        {       /*Transaction reference already entered */
                display_error(_("This invoice number has already been entered. It cannot be entered again.") . " (" . $_POST['supp_reference'] . ")");
                return false;
@@ -199,8 +223,12 @@ function handle_commit_invoice()
 
        if (!check_data())
                return;
+       $inv = $_SESSION['supp_trans'];
+       $invoice_no = add_supp_invoice($inv);
 
-       $invoice_no = add_supp_invoice($_SESSION['supp_trans']);
+       // presume supplier data need correction
+       if ($inv->stored_algorithm != $inv->tax_algorithm)
+               update_supp_tax_algorithm($inv->supplier_id, $inv->tax_algorithm);
 
     $_SESSION['supp_trans']->clear_items();
     unset($_SESSION['supp_trans']);
@@ -219,6 +247,7 @@ function check_item_data($n)
 {
        global $check_price_charged_vs_order_price,
                $check_qty_charged_vs_del_qty, $SysPrefs;
+
        if (!check_num('this_quantity_inv'.$n, 0) || input_num('this_quantity_inv'.$n)==0)
        {
                display_error( _("The quantity to invoice must be numeric and greater than zero."));
@@ -268,10 +297,19 @@ function commit_item_data($n)
 {
        if (check_item_data($n))
        {
+       if (input_num('this_quantity_inv'.$n) >= ($_POST['qty_recd'.$n] - $_POST['prev_quantity_inv'.$n]))
+       {
+               $complete = true;
+       }
+       else
+       {
+               $complete = false;
+       }
+
                $_SESSION['supp_trans']->add_grn_to_trans($n, $_POST['po_detail_item'.$n],
                        $_POST['item_code'.$n], $_POST['item_description'.$n], $_POST['qty_recd'.$n],
                        $_POST['prev_quantity_inv'.$n], input_num('this_quantity_inv'.$n),
-                       $_POST['order_price'.$n], input_num('ChgPrice'.$n),
+                       $_POST['order_price'.$n], input_num('ChgPrice'.$n), $complete,
                        $_POST['std_cost_unit'.$n], "");
        }
 }
index ed8f5a089a9c50302c9e7614358e2e68b31fe496..6d9992a68666b0f87ffb2de0dda65ae89a09808a 100644 (file)
@@ -182,7 +182,7 @@ function check_inputs()
        } 
        elseif (!is_date_in_fiscalyear($_POST['DatePaid'])) 
        {
-               display_error(_("The entered date is not in fiscal year."));
+               display_error(_("The entered date is out of fiscal year or is closed for further data entry."));
                set_focus('DatePaid');
                return false;
        }
@@ -273,12 +273,12 @@ start_form();
     supplier_list_row(_("Payment To:"), 'supplier_id', null, false, true);
 
        set_global_supplier($_POST['supplier_id']);
-       
+
        if (!list_updated('bank_account'))
                $_POST['bank_account'] = get_default_supplier_bank_account($_POST['supplier_id']);              
-       
+
     bank_accounts_list_row(_("From Bank Account:"), 'bank_account', null, true);
-       
+
        bank_balance_row($_POST['bank_account']);
 
        table_section(2);
index 025e6581ef0631b454e268e92def09729802873d..ad7030aaaadf47bdba28d5f7f00853c08c7d67b8 100644 (file)
@@ -13,6 +13,7 @@ $page_security = 'SA_SUPPTRANSVIEW';
 $path_to_root = "../..";
 
 include_once($path_to_root . "/purchasing/includes/purchasing_db.inc");
+include_once($path_to_root . "/includes/ui/items_cart.inc");
 include_once($path_to_root . "/includes/session.inc");
 
 include_once($path_to_root . "/purchasing/includes/purchasing_ui.inc");
@@ -69,7 +70,7 @@ display_supp_trans_tax_details($tax_items, 1);
 
 $display_total = number_format2($supp_trans->ov_amount + $supp_trans->ov_gst,user_price_dec());
 
-label_row(_("TOTAL INVOICE"), $display_total, "colspan=1 align=right", "nowrap align=right");
+label_row(_("TOTAL INVOICE").' ('.$supplier_curr_code.')', $display_total, "colspan=1 align=right", "nowrap align=right");
 
 end_table(1);
 
index 300cd40194987856fee4080535f9f81ba44f86ff..9bc222d3eaa82ef13e0d5f65e58d0bdc9458af39 100644 (file)
@@ -181,7 +181,7 @@ class Cpdf extends FPDI {
                 {
                     default :        $fontname = "freesans13";     break;
                 }
-            }                  
+            }
             // else use built-in adobe fonts helvetica.
                }
                $this->SetFont($fontname, $style);
index 7044cee4572eaa352406610d92d10b1ede016a04..f279283b10a93e50ae63c6d2cb20ba20495f7b7f 100644 (file)
                foreach(explode("\n", $this->company['legal_text']) as $line)
                        $Footer[] = $line;
        }
-
-?>
index 33ac54a529448ee627444c4679e9dd357a41b567..7d1379b43676d9bb45929b6173ac95cfed7ad060 100644 (file)
@@ -695,7 +695,6 @@ class FrontReport extends Spreadsheet_Excel_Writer_Workbook
 
        function End($email=0, $subject='')
        {
-               global $path_to_root;
                ++$this->y;
                for ($i = 0; $i < $this->numcols; $i++)
                        $this->sheet->writeBlank($this->y, $i, $this->formatFooter);
index 5e044f2898df54935a36d3daf75de299c4b10cde..36acff5abcd21e3ca7e592cc14fa3ae72ae8a496 100644 (file)
@@ -125,7 +125,7 @@ function print_invoices()
                                        $rep->TextCol(4, 5,     $DisplayPrice, -2);
                                        $rep->TextCol(5, 6,     $DisplayDiscount, -2);
                                        $rep->TextCol(6, 7,     $DisplayNet, -2);
-                               }       
+                               }
                                $rep->row = $newrow;
                                //$rep->NewLine(1);
                                if ($rep->row < $rep->bottomMargin + (15 * $rep->lineHeight))
@@ -158,7 +158,7 @@ function print_invoices()
                        if ($tax_item['amount'] == 0)
                                continue;
                        $DisplayTax = number_format2($sign*$tax_item['amount'], $dec);
-                       
+
                        if (isset($suppress_tax_rates) && $suppress_tax_rates == 1)
                                $tax_type_name = $tax_item['tax_type_name'];
                        else
index c8b4a1ef3e782f8ac34fc86df9d67742fa5d13e0..08990e10babfbe463828ef9225cff3e3e14802bf 100644 (file)
@@ -131,7 +131,7 @@ function print_sales_orders()
                                $rep->TextCol(4, 5,     $DisplayPrice, -2);
                                $rep->TextCol(5, 6,     $DisplayDiscount, -2);
                                $rep->TextCol(6, 7,     $DisplayNet, -2);
-                       }       
+                       }
                        $rep->row = $newrow;
                        //$rep->NewLine(1);
                        if ($rep->row < $rep->bottomMargin + (15 * $rep->lineHeight))
index 7b9318d0e845ac9ecd2920aa87580bb3d5456b78..856da3240a51fb35ccea69f6d235f177731e354a 100644 (file)
@@ -111,7 +111,7 @@ function print_deliveries()
                        {
                                if ($myrow2["quantity"] == 0)
                                        continue;
-                                       
+
                                $Net = round2(((1 - $myrow2["discount_percent"]) * $myrow2["unit_price"] * $myrow2["quantity"]),
                                   user_price_dec());
                                $SubTotal += $Net;
@@ -128,7 +128,7 @@ function print_deliveries()
                                $newrow = $rep->row;
                                $rep->row = $oldrow;
                                if ($Net != 0.0  || !is_service($myrow2['mb_flag']) || !isset($no_zero_lines_amount) || $no_zero_lines_amount == 0)
-                               {                       
+                               {
                                        $rep->TextCol(2, 3,     $DisplayQty, -2);
                                        $rep->TextCol(3, 4,     $myrow2['units'], -2);
                                        if ($packing_slip == 0)
@@ -137,7 +137,7 @@ function print_deliveries()
                                                $rep->TextCol(5, 6,     $DisplayDiscount, -2);
                                                $rep->TextCol(6, 7,     $DisplayNet, -2);
                                        }
-                               }       
+                               }
                                $rep->row = $newrow;
                                //$rep->NewLine(1);
                                if ($rep->row < $rep->bottomMargin + (15 * $rep->lineHeight))
index 2662fca59d1221403d0a4cdff2785a063b24c8ac..be0c48c0c55a4007b23c22f4a0874918ac7926ba 100644 (file)
@@ -118,7 +118,7 @@ function print_sales_quotations()
                                $rep->TextCol(4, 5,     $DisplayPrice, -2);
                                $rep->TextCol(5, 6,     $DisplayDiscount, -2);
                                $rep->TextCol(6, 7,     $DisplayNet, -2);
-                       }       
+                       }
                        $rep->row = $newrow;
                        //$rep->NewLine(1);
                        if ($rep->row < $rep->bottomMargin + (15 * $rep->lineHeight))
@@ -132,7 +132,6 @@ function print_sales_quotations()
                $DisplaySubTot = number_format2($SubTotal,$dec);
                $DisplayFreight = number_format2($myrow["freight_cost"],$dec);
 
-               $rep->row = $rep->bottomMargin + (15 * $rep->lineHeight);
                $doctype = ST_SALESQUOTE;
 
                $rep->TextCol(3, 6, _("Sub-total"), -2);
index ba6c94653b4571ccf24f83b4ff94a1294ad7efd4..c510160a1566486adaae4f7f0a74e27917c1a148 100644 (file)
@@ -105,7 +105,7 @@ function print_receipts()
                {
                        $myrow = get_receipt($j, $i);
                        if (!$myrow)
-                               continue;                       
+                               continue;
                        $res = get_bank_trans($j, $i);
                        $baccount = db_fetch($res);
                        $params['bankaccount'] = $baccount['bank_act'];
@@ -121,7 +121,7 @@ function print_receipts()
                        $total_allocated = 0;
                        $rep->TextCol(0, 4,     _("As advance / full / part / payment towards:"), -2);
                        $rep->NewLine(2);
-                       
+
                        while ($myrow2=db_fetch($result))
                        {
                                $rep->TextCol(0, 1,     $systypes_array[$myrow2['type']], -2);
@@ -161,7 +161,7 @@ function print_receipts()
                        {
                                $rep->NewLine(1);
                                $rep->TextCol(0, 7, $myrow['curr_code'] . ": " . $words, - 2);
-                       }       
+                       }
                        $rep->Font();
                        $rep->NewLine();
                        $rep->TextCol(6, 7, _("Received / Sign"), - 2);
@@ -176,7 +176,7 @@ function print_receipts()
                        $rep->TextCol(4, 5, _("Branch"), - 2);
                        $rep->TextCol(5, 6, "__________________", - 2);
                        $rep->TextCol(6, 7, "__________________");
-               }       
+               }
        }
        $rep->End();
 }
index 6bbf6d92c02fb1f53f13d0a559bfe49a6b373b88..5901260596b53b878a93ff35f6fbdbbb1bb163b2 100644 (file)
@@ -38,7 +38,7 @@ function get_invoices($supplier_id, $to, $all=true)
        // Revomed allocated from sql
        if ($all)
        $value = "(".TB_PREF."supp_trans.ov_amount + ".TB_PREF."supp_trans.ov_gst + ".TB_PREF."supp_trans.ov_discount)";
-    else       
+    else
        $value = "IF (".TB_PREF."supp_trans.type=".ST_SUPPINVOICE." OR ".TB_PREF."supp_trans.type=".ST_BANKDEPOSIT.", 
        (".TB_PREF."supp_trans.ov_amount + ".TB_PREF."supp_trans.ov_gst + ".TB_PREF."supp_trans.ov_discount - ".TB_PREF."supp_trans.alloc),
        (".TB_PREF."supp_trans.ov_amount + ".TB_PREF."supp_trans.ov_gst + ".TB_PREF."supp_trans.ov_discount + ".TB_PREF."supp_trans.alloc))";
index c7eed103c8092c3a15968f0185a3f04b70f8b778..1131a350464478182e6962f7ad57ceccc7042dfd 100644 (file)
@@ -34,7 +34,7 @@ print_po();
 function get_po($order_no)
 {
        $sql = "SELECT ".TB_PREF."purch_orders.*, ".TB_PREF."suppliers.supp_name,  "
-               .TB_PREF."suppliers.supp_account_no,".TB_PREF."suppliers.tax_included,
+               .TB_PREF."suppliers.supp_account_no,".TB_PREF."suppliers.tax_included,".TB_PREF."suppliers.tax_algorithm,
                ".TB_PREF."suppliers.curr_code, ".TB_PREF."suppliers.payment_terms, ".TB_PREF."locations.location_name,
                ".TB_PREF."suppliers.address, ".TB_PREF."suppliers.contact, ".TB_PREF."suppliers.tax_group_id
                FROM ".TB_PREF."purch_orders, ".TB_PREF."suppliers, ".TB_PREF."locations
@@ -169,7 +169,7 @@ function print_po()
                $rep->NewLine();
 
                $tax_items = get_tax_for_items($items, $prices, 0,
-                 $myrow['tax_group_id'], $myrow['tax_included'],  null);
+                 $myrow['tax_group_id'], $myrow['tax_included'],  null, $myrow['tax_algorithm']);
                $first = true;
                foreach($tax_items as $tax_item)
                {
@@ -177,7 +177,10 @@ function print_po()
                                continue;
                        $DisplayTax = number_format2($tax_item['Value'], $dec);
 
-                       $tax_type_name = $tax_item['tax_type_name'];
+                       if (isset($suppress_tax_rates) && $suppress_tax_rates == 1)
+                               $tax_type_name = $tax_item['tax_type_name'];
+                       else
+                               $tax_type_name = $tax_item['tax_type_name']." (".$tax_item['rate']."%) ";
 
                        if ($myrow['tax_included'])
                        {
index 136f0d2c9fe355b542fc8dd06cbad64d5f112d27..9d8b8d7ddfbf9b0a0c71d3a3115fcf38631a7412 100644 (file)
@@ -108,7 +108,7 @@ function print_remittances()
                {
                        $myrow = get_remittance($j, $i);
                        if (!$myrow)
-                               continue;                       
+                               continue;
                        $res = get_bank_trans($j, $i);
                        $baccount = db_fetch($res);
                        $params['bankaccount'] = $baccount['bank_act'];
@@ -135,7 +135,7 @@ function print_remittances()
                        $total_allocated = 0;
                        $rep->TextCol(0, 4,     _("As advance / full / part / payment towards:"), -2);
                        $rep->NewLine(2);
-                       
+
                        while ($myrow2=db_fetch($result))
                        {
                                $rep->TextCol(0, 1,     $systypes_array[$myrow2['type']], -2);
@@ -175,14 +175,14 @@ function print_remittances()
                        {
                                $rep->NewLine(2);
                                $rep->TextCol(1, 7, $myrow['curr_code'] . ": " . $words, - 2);
-                       }       
+                       }
                        $rep->Font();
                        if ($email == 1)
                        {
                                $myrow['DebtorName'] = $myrow['supp_name'];
                                $rep->End($email);
                        }
-               }       
+               }
        }
        if ($email == 0)
                $rep->End();
index 1471ae66c1e46c59862948bf4f0a755e4b43ab81..3fdef19ed092cc2e6bb77db024158198afa3f707 100644 (file)
@@ -33,7 +33,7 @@ function getTransactions($from, $to)
 {
        $from = date2sql($from);
        $to = date2sql($to);
-       
+
        $sql = "SELECT ".TB_PREF."grn_batch.id batch_no,
                        ".TB_PREF."grn_batch.supplier_id, 
             ".TB_PREF."purch_order_details.*,
@@ -53,7 +53,7 @@ function getTransactions($from, $to)
         AND ".TB_PREF."grn_batch.delivery_date>='$from'
         AND ".TB_PREF."grn_batch.delivery_date<='$to'
         ORDER BY ".TB_PREF."stock_master.stock_id, ".TB_PREF."grn_batch.delivery_date";        
-       
+
     return db_query($sql,"No transactions were returned");
 
 }
@@ -135,7 +135,7 @@ function print_grn_valuation()
                $rep->TextCol(2, 3, $trans['order_no']);
                $qdec = get_qty_dec($trans['item_code']);
                $rep->TextCol(3, 4, $trans['batch_no']);
-               
+
                if ($trans['quantity_inv'])
                {
                        $suppinv = getSuppInvDetails($trans['grn_item_id']);
index 1d47bc78a1510ca4e201862ab6cdff147e2709bb..1cedff0df8f07ef669516ba0d638e2a13f4d7c9e 100644 (file)
@@ -118,7 +118,7 @@ function print_bank_transactions()
                                $rep->TextCol(1, 2,     $myrow['trans_no']);
                                $rep->TextCol(2, 3,     $myrow['ref']);
                                $rep->DateCol(3, 4,     $myrow["trans_date"], true);
-                               $rep->TextCol(4, 5,     payment_person_name($myrow["person_type_id"],$myrow["person_id"], false));
+                               $rep->TextCol(4, 5,     get_counterparty_name($myrow["type"], $myrow["trans_no"], false));
                                if ($myrow['amount'] > 0.0)
                                {
                                        $rep->AmountCol(5, 6, abs($myrow['amount']), $dec);
diff --git a/reporting/rep602.php b/reporting/rep602.php
new file mode 100644 (file)
index 0000000..fec3d0e
--- /dev/null
@@ -0,0 +1,220 @@
+<?php
+/**********************************************************************
+    Copyright (C) FrontAccounting, LLC.
+       Released under the terms of the GNU General Public License, GPL, 
+       as published by the Free Software Foundation, either version 3 
+       of the License, or (at your option) any later version.
+    This program is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
+    See the License here <http://www.gnu.org/licenses/gpl-3.0.html>.
+***********************************************************************/
+$page_security = 'SA_BANKREP';
+// ----------------------------------------------------------------
+// $ Revision: 2.3.3-1
+// Creator:    Chaitanya-India <3chaitanya@gmail.com>
+// date_:      2005-05-19
+// Title:      Bank Statements w/Reconcile
+// Desc:       Bank Statement w/ Reconcile like the normal Bank Statement but with reconcile columns\r
+// ----------------------------------------------------------------
+$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");
+include_once($path_to_root . "/gl/includes/gl_db.inc");
+
+//----------------------------------------------------------------------------------------------------
+
+print_bank_transactions_reconcile();
+
+//----------------------------------------------------------------------------------------------------
+
+function get_bank_balance_to($to, $account)
+{
+       $to = date2sql($to);
+       $sql = "SELECT SUM(amount) FROM ".TB_PREF."bank_trans WHERE bank_act='$account'
+       AND trans_date < '$to'";
+       $result = db_query($sql, "The starting balance on hand could not be calculated");
+       $row = db_fetch_row($result);
+       return $row[0];
+}
+
+function get_bank_transactions($from, $to, $account)
+{
+       $from = date2sql($from);
+       $to = date2sql($to);
+       $sql = "SELECT ".TB_PREF."bank_trans.*, ".TB_PREF."comments.memo_\r
+                       FROM ".TB_PREF."bank_trans LEFT JOIN ".TB_PREF."comments ON \r
+                       (".TB_PREF."bank_trans.type = ".TB_PREF."comments.type\r
+                       AND ".TB_PREF."bank_trans.trans_no = ".TB_PREF."comments.id)\r
+               WHERE ".TB_PREF."bank_trans.bank_act = '$account'
+               AND trans_date >= '$from'
+               AND trans_date <= '$to'
+               ORDER BY trans_date,".TB_PREF."bank_trans.id";
+
+       return db_query($sql,"The transactions for '$account' could not be retrieved");
+}
+
+function print_bank_transactions_reconcile()
+{
+       global $path_to_root, $systypes_array;
+
+       $acc = $_POST['PARAM_0'];
+       $from = $_POST['PARAM_1'];
+       $to = $_POST['PARAM_2'];
+       $comments = $_POST['PARAM_3'];
+       $destination = $_POST['PARAM_4'];
+       if ($destination)
+               include_once($path_to_root . "/reporting/includes/excel_report.inc");
+       else
+               include_once($path_to_root . "/reporting/includes/pdf_report.inc");
+
+       $rep = new FrontReport(_('Bank Statement w/Reconcile'), "BankStatementReconcile", user_pagesize(), 9, "L");
+       $dec = user_price_dec();
+
+       $cols = array(0, 90, 110, 170, 225, 450, 500, 550, 600, 660, 700);\r
+
+       $aligns = array('left', 'left', 'left', 'left', 'left', 'right', 'right', 'right', 'center', 'left');\r
+
+       $headers = array(_('Type'),     _('#'), _('Reference'), _('Date'), _('Person/Item'),
+               _('Debit'),     _('Credit'), _('Balance'), _('Reco Date'), _('Narration'));\r
+
+       $account = get_bank_account($acc);
+       $act = $account['bank_account_name']." - ".$account['bank_curr_code']." - ".$account['bank_account_number'];
+       $params =   array(      0 => $comments,
+           1 => array('text' => _('Period'), 'from' => $from, 'to' => $to),
+           2 => array('text' => _('Bank Account'),'from' => $act,'to' => ''));
+
+       $rep->Font();
+       $rep->Info($params, $cols, $headers, $aligns);
+       $rep->NewPage();
+
+
+       $prev_balance = get_bank_balance_to($from, $account["id"]);
+
+       $trans = get_bank_transactions($from, $to, $account['id']);
+
+       $rows = db_num_rows($trans);
+       if ($prev_balance != 0.0 || $rows != 0)
+       {
+               $rep->Font('bold');
+               $rep->TextCol(0, 3,     $act);
+               $rep->TextCol(3, 5, _('Opening Balance'));
+               if ($prev_balance > 0.0)
+                       $rep->AmountCol(5, 6, abs($prev_balance), $dec);
+               else
+                       $rep->AmountCol(6, 7, abs($prev_balance), $dec);
+               $rep->Font();
+               $total = $prev_balance;
+               $rep->NewLine(2);
+               if ($rows > 0)
+               {
+                       // Keep a running total as we loop through
+                       // the transactions.
+                       $total_debit = $total_credit = 0;                       \r
+                       
+                       while ($myrow=db_fetch($trans))
+                       {
+                               $total += $myrow['amount'];
+
+                               $rep->TextCol(0, 1, $systypes_array[$myrow["type"]]);
+                               $rep->TextCol(1, 2,     $myrow['trans_no']);
+                               $rep->TextCol(2, 3,     $myrow['ref']);
+                               $rep->DateCol(3, 4,     $myrow["trans_date"], true);
+                               $rep->TextCol(4, 5,     payment_person_name($myrow["person_type_id"],$myrow["person_id"], false));
+                               if ($myrow['amount'] > 0.0)
+                               {
+                                       $rep->AmountCol(5, 6, abs($myrow['amount']), $dec);
+                                       $total_debit += abs($myrow['amount']);
+                               }
+                               else
+                               {
+                                       $rep->AmountCol(6, 7, abs($myrow['amount']), $dec);
+                                       $total_credit += abs($myrow['amount']);
+                               }
+                               $rep->AmountCol(7, 8, $total, $dec);
+                               if ($myrow["reconciled"] && $myrow["reconciled"] != '0000-00-00')\r
+                                       $rep->DateCol(8, 9,     $myrow["reconciled"], true);\r
+                               $rep->TextCol(9, 10, $myrow['memo_']);\r
+                               $rep->NewLine();
+                               if ($rep->row < $rep->bottomMargin + $rep->lineHeight)
+                               {
+                                       $rep->Line($rep->row - 2);
+                                       $rep->NewPage();
+                               }
+                       }
+                       $rep->NewLine();
+               }
+               
+               // Print totals for the debit and credit columns.
+               $rep->TextCol(3, 5, _("Total Debit / Credit"));
+               $rep->AmountCol(5, 6, $total_debit, $dec);
+               $rep->AmountCol(6, 7, $total_credit, $dec);
+               $rep->NewLine(2);
+
+               $rep->Font('bold');
+               $rep->TextCol(3, 5,     _("Ending Balance"));
+               if ($total > 0.0)
+                       $rep->AmountCol(5, 6, abs($total), $dec);
+               else
+                       $rep->AmountCol(6, 7, abs($total), $dec);
+               $rep->Font();
+               $rep->NewLine(2);       \r
+               
+               // Print the difference between starting and ending balances.
+               $net_change = ($total - $prev_balance); 
+               $rep->TextCol(3, 5, _("Net Change"));
+               if ($total > 0.0)
+                       $rep->AmountCol(5, 6, $net_change, $dec, 0, 0, 0, 0, null, 1, True);
+               else
+                       $rep->AmountCol(6, 7, $net_change, $dec, 0, 0, 0, 0, null, 1, True);
+               $rep->Font();\r
+               $rep->NewLine(2);       \r
+               \r
+               // Calculate Bank Balance as per reco\r
+               $date = date2sql($to);\r
+               $sql = "SELECT SUM(IF(reconciled<='$date' AND reconciled !='0000-00-00', amount, 0)) as reconciled,\r
+                                SUM(amount) as books_total\r
+                       FROM ".TB_PREF."bank_trans trans\r
+                       WHERE bank_act=".db_escape($account['id'])."\r
+                       AND trans_date <= '$date'";     \r
+                       \r
+               //      ." AND trans.reconciled IS NOT NULL";\r
+               //display_notification($sql);\r
+               $t_result = db_query($sql,"Cannot retrieve reconciliation data");\r
+\r
+               if ($t_row = db_fetch($t_result)) {\r
+                       $books_total = $t_row['books_total'];\r
+                       $reconciled = $t_row['reconciled'];\r
+               }                       \r
+               $difference = $books_total - $reconciled;               \r
+               \r
+               // Bank Balance (by Reco)\r
+               $rep->Font('bold');\r
+               $rep->TextCol(3, 5,     _("Bank Balance"));\r
+               if ($reconciled > 0.0)\r
+                       $rep->AmountCol(5, 6, abs($reconciled), $dec);\r
+               else\r
+                       $rep->AmountCol(6, 7, abs($reconciled), $dec);\r
+               $rep->Font();\r
+               $rep->NewLine(2);       \r
+\r
+               // Reco Difference\r
+               $rep->Font('bold');\r
+               $rep->TextCol(3, 5,     _("Difference"));\r
+               if ($difference > 0.0)\r
+                       $rep->AmountCol(5, 6, abs($difference), $dec);\r
+               else\r
+                       $rep->AmountCol(6, 7, abs($difference), $dec);\r
+               $rep->Font();\r
+               $rep->NewLine(2);       \r
+                       \r
+               $rep->Line($rep->row - $rep->lineHeight + 4);\r
+               $rep->NewLine(2, 1);                    \r
+                       \r
+       }
+       $rep->End();
+}
+
+?>
\ No newline at end of file
index 30e6aa05595ae67b6a58affc4482625bcae367da..2bfffade74b2ee4bb6ff385933db231422bb5263 100644 (file)
@@ -28,7 +28,7 @@ include_once($path_to_root . "/gl/includes/gl_db.inc");
 function display_type ($type, $typename, &$dec, &$rep, $showbalance, $level)
 {
        $printtitle = 0; //Flag for printing type name  
-       
+
        //Get Accounts directly under this group/type
        $result = get_gl_accounts(null, null, $type);   
        while ($account=db_fetch($result))
@@ -40,7 +40,7 @@ function display_type ($type, $typename, &$dec, &$rep, $showbalance, $level)
                        for ($sp=1; $sp<=$level; $sp++)
                        {
                                $prefix .= '         ';
-                       }               
+                       }
                        $printtitle = 1;
                        $rep->row -= 4;
                        $rep->TextCol(0, 1, $type);
@@ -63,7 +63,7 @@ function display_type ($type, $typename, &$dec, &$rep, $showbalance, $level)
                        $rep->AmountCol(3, 4, $balance, $dec);
                $rep->NewLine();
        }
-               
+
        //Get Account groups/types under this group/type
        $result = get_account_types(false, false, $type);
        while ($accounttype=db_fetch($result))
index 01d3606a420f84a9c46d9ce57525daf6785b2ebc..9fdde38eb02970756f53731a0cba51adf5db3f04 100644 (file)
@@ -95,7 +95,7 @@ function print_list_of_journal_entries()
             $rep->TextCol(0, 1, $TransName . " # " . $myrow['type_no']);
             $rep->TextCol(1, 2, get_reference($myrow['type'], $myrow['type_no']));
             $rep->DateCol(2, 3, $myrow['tran_date'], true);
-            $coms =  payment_person_name($myrow["person_type_id"],$myrow["person_id"]);
+            $coms =  get_subaccount_name($myrow["account"], $myrow["person_id"]);
             $memo = get_comments_string($myrow['type'], $myrow['type_no']);
             if ($memo != '')
             {
index 979ca2e1e4a45bffa0d9e871a8627e209f11b8b7..9ff9b2964783a21f4966185605b06ed8d5fe2c38 100644 (file)
@@ -208,7 +208,7 @@ function print_trial_balance()
        $rep->Font();
        $rep->Info($params, $cols, $headers, $aligns, $cols2, $headers2, $aligns2);
        $rep->NewPage();
-       
+
        $classresult = get_account_classes(false);
        while ($class = db_fetch($classresult))
        {
@@ -256,7 +256,7 @@ function print_trial_balance()
        else
                $rep->AmountCol(7, 8, abs($tbal), $dec);
        $rep->NewLine();
-               
+
        $rep->Line($rep->row + 10);
        if (($pbal = round2($pbal, $dec)) != 0.0 && $dimension == 0 && $dimension2 == 0)
        {
index dbe25e5bd59e82f1472f06b0c566ee4e9f055baf..c3cd8e193a4f46ad550e37a477392fb4c8e552c8 100644 (file)
@@ -74,7 +74,7 @@ function getTaxInfo($id)
 function print_tax_report()
 {
        global $path_to_root, $trans_dir, $Hooks, $systypes_array;
-       
+
        $from = $_POST['PARAM_0'];
        $to = $_POST['PARAM_1'];
        $summaryOnly = $_POST['PARAM_2'];
@@ -126,7 +126,7 @@ function print_tax_report()
                        $trans['net_amount'] *= -1;
                        $trans['amount'] *= -1;
                }
-               
+
                if (!$summaryOnly)
                {
                        $rep->TextCol(0, 1, $systypes_array[$trans['trans_type']]);
@@ -140,7 +140,7 @@ function print_tax_report()
                        $rep->AmountCol(5, 6, $trans['net_amount'], $dec);
                        $rep->AmountCol(6, 7, $trans['rate'], $dec);
                        $rep->AmountCol(7, 8, $trans['amount'], $dec);
-                       
+
                        $rep->TextCol(9, 10, $trans['taxname']);
 
                        $rep->NewLine();
index ca27855618aaf47e3298a5fa06d0624075d365f1..e91353097171e968f7aeaa4112cde2d03ddb8fe6 100644 (file)
@@ -165,7 +165,7 @@ $reports->addReport(RC_SUPPLIER, 209, _('Print Purchase &Orders'),
                        _('Currency Filter') => 'CURRENCY',
                        _('Email Customers') => 'YES_NO',
                        _('Comments') => 'TEXTBOX'));
-$reports->addReport(RC_SUPPLIER, 210, _('Print Remittances'),
+$reports->addReport(RC_SUPPLIER, 210, _('Print Remi&ttances'),
        array(  _('From') => 'REMITTANCE',
                        _('To') => 'REMITTANCE',
                        _('Currency Filter') => 'CURRENCY',
@@ -175,7 +175,7 @@ $reports->addReport(RC_SUPPLIER, 210, _('Print Remittances'),
 $reports->addReportClass(_('Inventory'), RC_INVENTORY);
 
 $reports->addReport(RC_INVENTORY,  301, _('Inventory &Valuation Report'),
-       array(  _('End Date') => 'DATE',        
+       array(  _('End Date') => 'DATE',
                        _('Inventory Category') => 'CATEGORIES',
                        _('Location') => 'LOCATIONS',
                        _('Summary Only') => 'YES_NO',
index ee92d03b9327e5d472125473a626a369b5595be7..5b13f04dc39c5fce6dc49e726dadb256c1aff08f 100644 (file)
@@ -105,7 +105,7 @@ if ($id != -1)
                }
        }
        else
-               display_error(_("The entered date is not in fiscal year."));
+               display_error(_("The entered date is out of fiscal year or is closed for further data entry."));
 }
 
 $result = get_recurrent_invoices();
index de84ba09f8e0133846d7ae231766d38ed8b83115..7fc278a82643a698fd9542b3841b7ecc7b5f11ec 100644 (file)
@@ -158,7 +158,7 @@ function can_process()
                set_focus('OrderDate');
                $input_error = 1;
        } elseif (!is_date_in_fiscalyear($_POST['OrderDate'])) {
-               display_error(_("The entered date is not in fiscal year."));
+               display_error(_("The entered date is out of fiscal year or is closed for further data entry."));
                set_focus('OrderDate');
                $input_error = 1;
        }
index 18318e566db3d9f945123e6a6a156c4596df7cfa..d9a6542499cf858f240fc9e8c320df34a4ce62a8 100644 (file)
@@ -92,7 +92,7 @@ function can_process()
                set_focus('CreditDate');
                return false;
        } elseif (!is_date_in_fiscalyear($_POST['CreditDate'])) {
-               display_error(_("The entered date is not in fiscal year."));
+               display_error(_("The entered date is out of fiscal year or is closed for further data entry."));
                set_focus('CreditDate');
                return false;
        }
index 30e359193d6e25253d0ac1ed60d4084b235cb30b..df8bad06d9ebd4016d13e8f24174a1cf90420c50 100644 (file)
@@ -103,7 +103,8 @@ if (isset($_GET['OrderNumber']) && $_GET['OrderNumber'] > 0) {
 
 } elseif (isset($_GET['ModifyDelivery']) && $_GET['ModifyDelivery'] > 0) {
 
-       $_SESSION['Items'] = new Cart(ST_CUSTDELIVERY, $_GET['ModifyDelivery']);
+       check_is_closed(ST_CUSTDELIVERY, $_GET['ModifyDelivery']);
+       $_SESSION['Items'] = new Cart(ST_CUSTDELIVERY,$_GET['ModifyDelivery']);
 
        if ($_SESSION['Items']->count_items() == 0) {
                hyperlink_params($path_to_root . "/sales/inquiry/sales_orders_view.php",
@@ -150,7 +151,7 @@ function check_data()
        }
 
        if (!is_date_in_fiscalyear($_POST['DispatchDate'])) {
-               display_error(_("The entered date of delivery is not in fiscal year."));
+               display_error(_("The entered date is out of fiscal year or is closed for further data entry."));
                set_focus('DispatchDate');
                return false;
        }
@@ -282,7 +283,7 @@ function check_qoh()
                 if (!$newdelivery)
                 {
                     $delivered = get_already_delivered($itm->stock_id, $_POST['Location'], key($dn->trans_no));
-                    
+
                     $qoh_abs = $qoh_abs - $delivered;
                     $qoh_by_date = $qoh_by_date - $delivered;
                 }
index 9c9e171bddd11612f00a90a3add294bb0939bd6b..5bebcb7498ec398b67bc67d25fe315ee9ea3f385 100644 (file)
@@ -127,6 +127,8 @@ if ( (isset($_GET['DeliveryNumber']) && ($_GET['DeliveryNumber'] > 0) )
 
 } elseif (isset($_GET['ModifyInvoice']) && $_GET['ModifyInvoice'] > 0) {
 
+       check_is_closed(ST_SALESINVOICE, $_GET['ModifyInvoice']);
+
        if ( get_sales_parent_numbers(ST_SALESINVOICE, $_GET['ModifyInvoice']) == 0) { // 1.xx compatibility hack
                echo"<center><br><b>" . _("There are no delivery notes for this invoice.<br>
                Most likely this invoice was created in Front Accounting version prior to 2.0
@@ -264,7 +266,7 @@ function check_data()
        }
 
        if (!is_date_in_fiscalyear($_POST['InvoiceDate'])) {
-               display_error(_("The entered invoice date is not in fiscal year."));
+               display_error(_("The entered date is out of fiscal year or is closed for further data entry."));
                set_focus('InvoiceDate');
                return false;
        }
index f5d1f011a5e9a1ec4347023e295c3c45bf721738..e268dd22d73f75d0160416ab27bbb6b05e958ee6 100644 (file)
@@ -142,7 +142,7 @@ function can_process()
                set_focus('DateBanked');
                return false;
        } elseif (!is_date_in_fiscalyear($_POST['DateBanked'])) {
-               display_error(_("The entered date is not in fiscal year."));
+               display_error(_("The entered date is out of fiscal year or is closed for further data entry."));
                set_focus('DateBanked');
                return false;
        }
@@ -246,7 +246,7 @@ if (isset($_POST['ref']) && $_SESSION['alloc']->trans_no == 0) // added by Joe t
                display_error( _("The entered reference is already in use."));
                display_footer_exit();
        }
-}              
+}
 $new = $_SESSION['alloc']->trans_no == 0;
 
 if (list_updated('customer_id') || ($new && list_updated('bank_account'))) {
@@ -376,7 +376,6 @@ start_form();
        //Chaitanya : 13-OCT-2011 - Is AJAX call really needed ???
        //bank_accounts_list_row(_("Into Bank Account:"), 'bank_account', null, true);
        bank_accounts_list_row(_("Into Bank Account:"), 'bank_account', null, false);
-
        text_row(_("Reference:"), 'ref', null, 20, 40);
 
        table_section(3);
index cc7d15675b660a8437f6f08c7e8fbd94c0d6d58c..062d9bad732a49529f6b417d2af54dce4e625a9f 100644 (file)
@@ -64,7 +64,9 @@ class cart
        var $tax_group_array = null; // saves db queries
        var $price_factor;       // ditto for price calculations
 
-       var     $pos;                   // user assigned POS (contains cash accont number/name)
+       var     $pos;                   // user assigned POS
+       var $cash_account;
+       var $account_name;
        var $cash_discount;     // not used as of FA 2.1
        var $dimension_id;
        var $dimension2_id;
@@ -75,8 +77,8 @@ class cart
        //-------------------------------------------------------------------------
        //
        //  $trans_no==0 => open new/direct document
-       //  $trans_no!=0 && $prep_child==false => update with parent constarints for reedition
-       //  $trans_no!=0 && $prep_child==true => prepare for child doc entry
+       //  $trans_no!=0 && $no_edit==false => update with parent constarints for reedition
+       //  $trans_no!=0 && $no_edit==true => read only: for view, or later child doc entry
        //
        function Cart($type, $trans_no=0, $prep_child=false) {
                /*Constructor function initialises a new shopping cart */
@@ -241,7 +243,7 @@ class cart
        // Writing new/modified sales document to database.
        // Makes parent documents for direct delivery/invoice by recurent call.
        // $policy - 0 or 1:  writeoff/return for IV, back order/cancel for DN
-       function write($policy=0) { 
+       function write($policy=0) {
                begin_transaction(); // prevents partial database changes in case of direct delivery/invoice
                if (count($this->src_docs) == 0 && ($this->trans_type == ST_SALESINVOICE || $this->trans_type == ST_CUSTDELIVERY)) {
                        // this is direct document - first add parent
@@ -482,7 +484,7 @@ class cart
        function get_shipping_tax()
        {
 
-               $tax_items = get_shipping_tax_as_array();
+               $tax_items = get_shipping_tax_as_array($this->tax_group_id);
                $tax_rate = 0;
                if ($tax_items != null) {
                        foreach ($tax_items as $item_tax) {
index c02b74c2d8ad81747cbbd572c69a099555774e3b..09b1fbe4f28af171c013cd574c5bbc028b5bdf9c 100644 (file)
 function add_branch($customer_id, $br_name, $br_ref, $br_address, $salesman, $area, 
        $tax_group_id, $sales_account, $sales_discount_account, $receivables_account, 
        $payment_discount_account, $default_location, $br_post_address, $disable_trans, $group_no,
-       $default_ship_via, $notes)
+       $default_ship_via, $notes, $bank_account)
 {
        $sql = "INSERT INTO ".TB_PREF."cust_branch (debtor_no, br_name, branch_ref, br_address,
                salesman, area, tax_group_id, sales_account, receivables_account, payment_discount_account, 
                sales_discount_account, default_location,
-               br_post_address, disable_trans, group_no, default_ship_via, notes)
+               br_post_address, disable_trans, group_no, default_ship_via, notes, bank_account)
                VALUES (".db_escape($customer_id). ",".db_escape($br_name) . ", "
                        .db_escape($br_ref) . ", "
                        .db_escape($br_address) . ", ".db_escape($salesman) . ", "
@@ -32,14 +32,15 @@ function add_branch($customer_id, $br_name, $br_ref, $br_address, $salesman, $ar
                        .db_escape($disable_trans) . ", "
                        .db_escape($group_no) . ", "
                        .db_escape($default_ship_via). ", "
-                       .db_escape($notes).")";
+                       .db_escape($notes). ", "
+                       .db_escape($bank_account, true).")";
        db_query($sql,"The branch record could not be added");
 }
 
 function update_branch($customer_id, $branch_code, $br_name, $br_ref, $br_address,
        $salesman, $area, $tax_group_id, $sales_account, $sales_discount_account, $receivables_account, 
        $payment_discount_account, $default_location, $br_post_address, $disable_trans, $group_no,
-       $default_ship_via, $notes)
+       $default_ship_via, $notes, $bank_account)
 {
        $sql = "UPDATE ".TB_PREF."cust_branch SET br_name = " . db_escape($br_name) . ",
                branch_ref = " . db_escape($br_ref) . ",
@@ -56,7 +57,8 @@ function update_branch($customer_id, $branch_code, $br_name, $br_ref, $br_addres
                disable_trans=".db_escape($disable_trans) . ",
                group_no=".db_escape($group_no) . ", 
                default_ship_via=".db_escape($default_ship_via) . ",
-               notes=".db_escape($notes) . "
+               notes=".db_escape($notes) . ",
+               bank_account=".db_escape($bank_account, true)."
                WHERE branch_code =".db_escape($branch_code) . "
                AND debtor_no=".db_escape($customer_id);
        db_query($sql,"The branch record could not be updated");
index bf28fe604863b255ec56bd2ab67e3237bc4e1f90..a07bdc4f692b18f17ca8909da84ca835002ee1ca 100644 (file)
@@ -43,7 +43,7 @@ function get_customer_trans_version($type, $trans_no) {
        $sql .= implode(' OR ', $trans_no) . ')';
 
        $res = db_query($sql, 'document version retreival');
-       
+
        $vers = array();
        while($mysql=db_fetch($res)) {
                $vers[$mysql['trans_no']] = $mysql['version'];
@@ -56,7 +56,7 @@ function get_customer_trans_version($type, $trans_no) {
 function write_customer_trans($trans_type, $trans_no, $debtor_no, $BranchNo,
        $date_, $reference, $Total, $discount=0, $Tax=0, $Freight=0, $FreightTax=0,
        $sales_type=0, $order_no=0, $ship_via=0, $due_date="",
-       $AllocAmt=0, $rate=0, $dimension_id=0, $dimension2_id=0, $payment_terms=null)
+       $AllocAmt=0, $rate=0, $dimension_id=0, $dimension2_id=0, $payment_terms=null, $tax_included=0)
 {
        $new = $trans_no==0;
        $curr = get_customer_currency($debtor_no);
@@ -85,7 +85,7 @@ function write_customer_trans($trans_type, $trans_no, $debtor_no, $BranchNo,
                order_, ov_amount, ov_discount,
                ov_gst, ov_freight, ov_freight_tax,
                rate, ship_via, alloc,
-               dimension_id, dimension2_id, payment_terms
+               dimension_id, dimension2_id, payment_terms, tax_included
                ) VALUES (".db_escape($trans_no).", ".db_escape($trans_type).",
                ".db_escape($debtor_no).", ".db_escape($BranchNo).",
                '$SQLDate', '$SQLDueDate', ".db_escape($reference).",
@@ -93,7 +93,8 @@ function write_customer_trans($trans_type, $trans_no, $debtor_no, $BranchNo,
                ".db_escape($Freight).",
                $FreightTax, $rate, ".db_escape($ship_via).", $AllocAmt,
                ".db_escape($dimension_id).", ".db_escape($dimension2_id).", "
-               .db_escape($payment_terms, true).")";
+               .db_escape($payment_terms, true).", "
+               .db_escape($tax_included).")";
        } else {        // may be optional argument should stay unchanged ?
        $sql = "UPDATE ".TB_PREF."debtor_trans SET
                debtor_no=".db_escape($debtor_no)." , branch_code=".db_escape($BranchNo).",
@@ -103,7 +104,8 @@ function write_customer_trans($trans_type, $trans_no, $debtor_no, $BranchNo,
                ov_freight=".db_escape($Freight).", ov_freight_tax=$FreightTax, rate=$rate,
                ship_via=".db_escape($ship_via).", alloc=$AllocAmt,
                dimension_id=".db_escape($dimension_id).", dimension2_id=".db_escape($dimension2_id).",
-               payment_terms=".db_escape($payment_terms)."
+               payment_terms=".db_escape($payment_terms).",
+               tax_included=".db_escape($tax_included)."
                WHERE trans_no=".db_escape($trans_no)." AND type=".db_escape($trans_type);
        }
        db_query($sql, "The debtor transaction record could not be inserted");
index 3a67e4edb895d29189e5307c8e526ff328066ca9..21ce5e41e871791fbf20d96f99a70ad6baed339b 100644 (file)
@@ -24,7 +24,6 @@ function add_customer($CustName, $cust_ref, $address, $tax_id, $curr_code,
                " . db_escape($credit_status) . ", ".db_escape($payment_terms) . ", " . $discount . ", 
                " . $pymt_discount . ", " . $credit_limit 
                 .", ".db_escape($sales_type).", ".db_escape($notes) . ")";
-
        db_query($sql,"The customer could not be added");
 }
 
index d5be9c44b0b16a4a00d7b7e9637ac43f038d6187..0fb76057b1d9e059dbfe548be44132032e73545f 100644 (file)
@@ -17,8 +17,13 @@ function write_credit_note(&$credit_note, $write_off_acc)
 {
        global $Refs;
 
-       $credit_invoice =       is_array($credit_note->src_docs) ?
-                reset(array_keys($credit_note->src_docs)) : $credit_note->src_docs;
+       if (is_array($credit_note->src_docs))
+       {
+               $docs = array_keys($credit_note->src_docs);
+               $credit_invoice = reset($docs);
+       }
+       else
+               $credit_invoice = $credit_note->src_docs;
 
        $credit_date = $credit_note->document_date;
        $tax_group_id = $credit_note->tax_group_id;
@@ -74,7 +79,7 @@ function write_credit_note(&$credit_note, $write_off_acc)
                $credit_note->freight_cost, $freight_added_tax,
                $credit_note->sales_type, $credit_note->order_no, $credit_note->ship_via,
                null, $alloc, 0, $credit_note->dimension_id, $credit_note->dimension2_id,
-               $credit_note->payment); 
+               $credit_note->payment, $credit_note->tax_included); 
                // 2008-06-14 extra $alloc, 2008-11-12 dimension_id Joe Hunt
 
        if ($trans_no==0) {
@@ -171,7 +176,6 @@ function write_credit_note(&$credit_note, $write_off_acc)
 // Insert a stock movement coming back in to show the credit note and
 //     a reversing stock movement to show the write off
 //
-
 function add_credit_movements_item(&$credit_note, &$credit_line,
        $credit_type, $price, $credited_invoice=0)
 {
index f92feca5b02622541dcddf3a48563d0f883ddaa3..f74afa20ee4a8c474102fb085905cb5487144cb9 100644 (file)
@@ -46,7 +46,7 @@ function write_sales_delivery(&$delivery,$bo_policy)
                $delivery->tax_included ? 0 : $freight_tax,
                $delivery->sales_type, $delivery->order_no,
                $delivery->ship_via, $delivery->due_date, 0, 0, $delivery->dimension_id, 
-               $delivery->dimension2_id, $delivery->payment);
+               $delivery->dimension2_id, $delivery->payment, $delivery->tax_included);
 
        if ($trans_no == 0) {
                $delivery->trans_no = array($delivery_no=>0);
index 558b2159aba0159fd9a1bad9c8e0a000ad275cfd..ecaf4466f9bb5f6d1b42c195d56cad1bcac13613 100644 (file)
@@ -64,7 +64,7 @@ function write_sales_invoice(&$invoice)
                $items_added_tax, $invoice->freight_cost, $freight_added_tax,
                $invoice->sales_type, $sales_order, $invoice->ship_via, 
                $invoice->due_date, 0, 0, $invoice->dimension_id, 
-               $invoice->dimension2_id, $invoice->payment); 
+               $invoice->dimension2_id, $invoice->payment, $invoice->tax_included); 
                // 2008-06-14 extra $alloc, 2008-11-12 added dimension_id Joe Hunt
 
        if ($trans_no == 0) {
@@ -146,9 +146,10 @@ function write_sales_invoice(&$invoice)
                                $taxitem['rate'], $invoice->tax_included, $taxitem['Value'],
                                 $taxitem['Net'], $ex_rate, $date_, $invoice->reference);
 
-                       $total += add_gl_trans_customer(ST_SALESINVOICE, $invoice_no, $date_, $taxitem['sales_gl_code'], 0, 0,
-                               (-$taxitem['Value']), $invoice->customer_id,
-                               "A tax GL posting could not be inserted");
+                       if (isset($taxitem['sales_gl_code']))
+                               $total += add_gl_trans_customer(ST_SALESINVOICE, $invoice_no, $date_, $taxitem['sales_gl_code'], 0, 0,
+                                       (-$taxitem['Value']), $invoice->customer_id,
+                                       "A tax GL posting could not be inserted");
                }
        }
 
index e4eaa5c15a4d69908b393cad61ea32a49e6feb6b..386e3b86b2a1213d8d6419ab2ad9998d0efa4056 100644 (file)
@@ -94,6 +94,9 @@ function add_sales_order(&$order)
        add_audit_trail($order->trans_type, $order_no, $order->document_date);
        $Refs->save($order->trans_type, $order_no, $order->reference);
 
+       add_audit_trail($order->trans_type, $order_no, $order->document_date);
+       $Refs->save($order->trans_type, $order_no, $order->reference);
+
        hook_db_postwrite($order, $order->trans_type);
        commit_transaction();
 
@@ -563,7 +566,7 @@ function get_sql_for_sales_orders_view($selected_customer, $trans_type, $trans_n
 
                elseif ($filter=='InvoiceTemplates' || $filter=='DeliveryTemplates')
                        $sql .= " AND sorder.type=1";
-                       
+
                //Chaiatanya : New Filter
                if ($customer_id != ALL_TEXT)
                        $sql .= " AND sorder.debtor_no = ".db_escape($customer_id);             
index 3ebc84b5c0b624034f7904947c314836bb126cb5..d8a000c1866431d7d4ba3fc857adfe104a9b805f 100644 (file)
@@ -18,15 +18,12 @@ include_once($path_to_root . "/sales/includes/sales_ui.inc");
 include_once($path_to_root . "/sales/includes/sales_db.inc");
 include_once($path_to_root . "/reporting/includes/reporting.inc");
 
-if (!@$_GET['popup'])
-{
-       $js = "";
-       if ($use_popup_windows)
-               $js .= get_js_open_window(900, 500);
-       if ($use_date_picker)
-               $js .= get_js_date_picker();
-       page(_($help_context = "Customer Transactions"), isset($_GET['customer_id']), false, "", $js);
-}
+$js = "";
+if ($use_popup_windows)
+       $js .= get_js_open_window(900, 500);
+if ($use_date_picker)
+       $js .= get_js_date_picker();
+page(_($help_context = "Customer Transactions"), isset($_GET['customer_id']), false, "", $js);
 
 if (isset($_GET['customer_id']))
 {
@@ -35,8 +32,7 @@ if (isset($_GET['customer_id']))
 
 //------------------------------------------------------------------------------------------------
 
-if (!@$_GET['popup'])
-       start_form();
+start_form();
 
 if (!isset($_POST['customer_id']))
        $_POST['customer_id'] = get_global_customer();
@@ -44,7 +40,7 @@ if (!isset($_POST['customer_id']))
 start_table(TABLESTYLE_NOBORDER);
 start_row();
 
-if (!@$_GET['popup'])
+if (!$page_nested)
        customer_list_cells(_("Select a customer: "), 'customer_id', null, true, false, false, !@$_GET['popup']);
 
 date_cells(_("From:"), 'TransAfterDate', '', null, -30);
@@ -158,7 +154,9 @@ function fmt_credit($row)
 
 function credit_link($row)
 {
-       if (@$_GET['popup'])
+       global $page_nested;
+       
+       if ($page_nested)
                return '';
        return $row['type'] == ST_SALESINVOICE && $row["Outstanding"] > 0 ?
                pager_link(_("Credit This") ,
@@ -167,36 +165,14 @@ function credit_link($row)
 
 function edit_link($row)
 {
-       $str = '';
+       global $page_nested;
 
-       if (@$_GET['popup'])
+       $str = '';
+       if ($page_nested)
                return '';
-       switch($row['type']) {
-       case ST_SALESINVOICE:
-               if (get_voided_entry(ST_SALESINVOICE, $row["trans_no"]) === false && $row['Allocated'] == 0)
-                       $str = "/sales/customer_invoice.php?ModifyInvoice=".$row['trans_no'];
-               break;
-       case ST_CUSTCREDIT:
-               if (get_voided_entry(ST_CUSTCREDIT, $row["trans_no"]) === false && $row['Allocated'] == 0) // 2008-11-19 Joe Hunt
-               {        
-                       if ($row['order_']==0) // free-hand credit note
-                           $str = "/sales/credit_note_entry.php?ModifyCredit=".$row['trans_no'];
-                       else    // credit invoice
-                           $str = "/sales/customer_credit_invoice.php?ModifyCredit=".$row['trans_no'];
-               }           
-               break;
-       case ST_CUSTDELIVERY:
-               if (get_voided_entry(ST_CUSTDELIVERY, $row["trans_no"]) === false)
-                       $str = "/sales/customer_delivery.php?ModifyDelivery=".$row['trans_no'];
-               break;
-       case ST_CUSTPAYMENT:
-               if (get_voided_entry(ST_CUSTPAYMENT, $row["trans_no"]) === false)
-                       $str = "/sales/customer_payments.php?trans_no=".$row['trans_no'];
-               break;
-       }               
-       if ($str != "" && !is_closed_trans($row['type'], $row["trans_no"]))
-               return pager_link(_('Edit'), $str, ICON_EDIT);
-       return '';      
+
+       return edit_trans_link($row['type'], $row['trans_no'], $row['type']==ST_CUSTCREDIT && $row['order_']==0 ?
+               "/sales/credit_note_entry.php?ModifyCredit=%d" : 0);
 }
 
 function prt_link($row)
@@ -254,9 +230,6 @@ $table->width = "85%";
 
 display_db_pager($table);
 
-if (!@$_GET['popup'])
-{
-       end_form();
-       end_page(@$_GET['popup'], false, false);
-}
+end_form();
+end_page();
 ?>
index f59be9c028bb5de375939bc49421bd8c3b1dbdb1..281e3a5f548482877ac3c35e68fb556357e3172b 100644 (file)
@@ -61,15 +61,12 @@ else
        $_SESSION['page_title'] = _($help_context = "Search All Sales Quotations");
 }
 
-if (!@$_GET['popup'])
-{
-       $js = "";
-       if ($use_popup_windows)
-               $js .= get_js_open_window(900, 600);
-       if ($use_date_picker)
-               $js .= get_js_date_picker();
-       page($_SESSION['page_title'], false, false, "", $js);
-}
+$js = "";
+if ($use_popup_windows)
+       $js .= get_js_open_window(900, 600);
+if ($use_date_picker)
+       $js .= get_js_date_picker();
+page($_SESSION['page_title'], false, false, "", $js);
 
 if (isset($_GET['selected_customer']))
 {
@@ -121,8 +118,10 @@ function prt_link($row)
 
 function edit_link($row) 
 {
-       if (@$_GET['popup'])\r
-               return '';\r
+       global $page_nested;
+       
+       if ($page_nested)
+               return '';
        global $trans_type;
        $modify = ($trans_type == ST_SALESORDER ? "ModifyOrderNumber" : "ModifyQuotationNumber");
   return pager_link( _("Edit"),
@@ -164,11 +163,12 @@ function order_link($row)
 
 function tmpl_checkbox($row)
 {
-       global $trans_type;
+       global $trans_type, $page_nested;
        if ($trans_type == ST_SALESQUOTE)
                return '';
-       if (@$_GET['popup'])\r
-               return '';\r
+
+       if ($page_nested)
+               return '';
        $name = "chgtpl" .$row['order_no'];
        $value = $row['type'] ? 1:0;
 
@@ -217,8 +217,7 @@ if (get_post('_OrderNumber_changed') || get_post('_OrderReference_changed')) //
        $Ajax->activate('orders_tbl');
 }
 
-if (!@$_GET['popup'])\r
-       start_form();
+start_form();
 
 start_table(TABLESTYLE_NOBORDER);
 start_row();
@@ -239,8 +238,8 @@ if($show_dates) {
        start_row();
 }
 stock_items_list_cells(_("Item:"), 'SelectStockFromList', null, true);
-if (!@$_GET['popup'])\r
-       customer_list_cells(_("Select a customer: "), 'customer_id', null, true);\r
+if (!@$_GET['popup'])
+       customer_list_cells(_("Select a customer: "), 'customer_id', null, true);
 if ($trans_type == ST_SALESQUOTE)
        check_cells(_("Show All:"), 'show_all');
 
@@ -255,7 +254,7 @@ end_table(1);
 //     Orders inquiry table
 //
 $sql = get_sql_for_sales_orders_view($selected_customer, $trans_type, $_POST['OrderNumber'], $_POST['order_view_mode'],
-       @$selected_stock_item, @$_POST['OrdersAfterDate'], @$_POST['OrdersToDate'], @$_POST['OrderReference'], $_POST['StockLocation'], $_POST['customer_id']);\r
+       @$selected_stock_item, @$_POST['OrdersAfterDate'], @$_POST['OrdersToDate'], @$_POST['OrderReference'], $_POST['StockLocation'], $_POST['customer_id']);
 
 if ($trans_type == ST_SALESORDER)
        $cols = array(
@@ -285,11 +284,11 @@ else
                'Type' => 'skip',
                _("Currency") => array('align'=>'center')
        );
-if ($_POST['order_view_mode'] == 'OutstandingOnly') {\r
-       //array_substitute($cols, 3, 1, _("Cust Order Ref"));\r
-       array_append($cols, array(\r
-               array('insert'=>true, 'fun'=>'dispatch_link'),\r
-               array('insert'=>true, 'fun'=>'edit_link')));\r
+if ($_POST['order_view_mode'] == 'OutstandingOnly') {
+       //array_substitute($cols, 3, 1, _("Cust Order Ref"));
+       array_append($cols, array(
+               array('insert'=>true, 'fun'=>'dispatch_link'),
+               array('insert'=>true, 'fun'=>'edit_link')));
 
 } elseif ($_POST['order_view_mode'] == 'InvoiceTemplates') {
        array_substitute($cols, 3, 1, _("Description"));
@@ -322,9 +321,6 @@ $table->width = "80%";
 display_db_pager($table);
 submit_center('Update', _("Update"), true, '', null);
 
-if (!@$_GET['popup'])\r
-{
-       end_form();
-       end_page();
-}\r
+end_form();
+end_page();
 ?>
\ No newline at end of file
index e3b1565fba697ddbb21f6c6feab7bcfcc67adfed..374d2f57d74fc1512645f382fd976d5b2658b1b9 100644 (file)
@@ -81,7 +81,7 @@ if ($Mode=='ADD_ITEM' || $Mode=='UPDATE_ITEM')
                                $_POST['br_address'], $_POST['salesman'], $_POST['area'], $_POST['tax_group_id'], $_POST['sales_account'],
                                $_POST['sales_discount_account'], $_POST['receivables_account'], $_POST['payment_discount_account'],
                                $_POST['default_location'], $_POST['br_post_address'], $_POST['disable_trans'], $_POST['group_no'],
-                               $_POST['default_ship_via'], $_POST['notes']);
+                               $_POST['default_ship_via'], $_POST['notes'], $_POST['bank_account']);
 //                     update_record_status($_POST['supplier_id'], $_POST['inactive'],
 //                             'cust_branch', 'branch_code');
 
@@ -93,7 +93,7 @@ if ($Mode=='ADD_ITEM' || $Mode=='UPDATE_ITEM')
                                $_POST['br_address'], $_POST['salesman'], $_POST['area'], $_POST['tax_group_id'], $_POST['sales_account'],
                                $_POST['sales_discount_account'], $_POST['receivables_account'], $_POST['payment_discount_account'],
                                $_POST['default_location'], $_POST['br_post_address'], 0, $_POST['group_no'],
-                               $_POST['default_ship_via'], $_POST['notes']);
+                               $_POST['default_ship_via'], $_POST['notes'], $_POST['bank_account']);
                        $selected_id = db_insert_id();
 
                        add_crm_person($_POST['contact_name'], $_POST['contact_name'], '', $_POST['br_post_address'], 
@@ -204,6 +204,7 @@ function branch_settings($selected_id) {
                    $_POST['payment_discount_account'] = $myrow['payment_discount_account'];
                        $_POST['group_no']  = $myrow["group_no"];
                        $_POST['notes']  = $myrow["notes"];
+                       $_POST['bank_account']  = $myrow["bank_account"];
 
                }
        }
@@ -224,7 +225,7 @@ function branch_settings($selected_id) {
 
                        // We use the Item Sales Account as default!
                    // $_POST['sales_account'] = $company_record["default_sales_act"];
-                   $_POST['sales_account'] = $_POST['notes']  = '';
+                   $_POST['sales_account'] = $_POST['notes']  = $_POST['bank_account'] = '';
                    $_POST['sales_discount_account'] = $company_record['default_sales_discount_act'];
                    $_POST['receivables_account'] = $company_record['debtors_act'];
                    $_POST['payment_discount_account'] = $company_record['default_prompt_payment_act'];
@@ -251,6 +252,7 @@ function branch_settings($selected_id) {
        gl_all_accounts_list_row(_("Sales Discount Account:"), 'sales_discount_account');
        gl_all_accounts_list_row(_("Accounts Receivable Account:"), 'receivables_account', null, true);
        gl_all_accounts_list_row(_("Prompt Payment Discount Account:"), 'payment_discount_account');
+       text_row(_("Bank Account Number:"), 'bank_account', null, 30, 60);
 
        table_section(2);
 
index 41c642ac760ae5e964c9c0e00157c7491c258ad9..af14b9a6af09421cd6bad62a1f3b60b31bfe701e 100644 (file)
@@ -12,7 +12,7 @@
 $page_security = 'SA_CUSTOMER';
 $path_to_root = "../..";
 
-include($path_to_root . "/includes/db_pager.inc");
+include_once($path_to_root . "/includes/db_pager.inc");
 include_once($path_to_root . "/includes/session.inc");
 $js = "";
 if ($use_popup_windows)
@@ -356,12 +356,10 @@ tabbed_content_start('tabs', array(
                        break;
                case 'transactions':
                        $_GET['customer_id'] = $selected_id;
-                       $_GET['popup'] = 1;
                        include_once($path_to_root."/sales/inquiry/customer_inquiry.php");
                        break;
                case 'orders':
                        $_GET['customer_id'] = $selected_id;
-                       $_GET['popup'] = 1;
                        include_once($path_to_root."/sales/inquiry/sales_orders_view.php");
                        break;
        };
index fd9723dfe6841dc5695e4be418563529014ebb9e..25d804fd5bf572ef14d0cdb3e779ff2e62545cd0 100644 (file)
@@ -87,6 +87,7 @@ if (isset($_GET['NewDelivery']) && is_numeric($_GET['NewDelivery'])) {
 }
 
 page($_SESSION['page_title'], false, false, "", $js);
+
 //-----------------------------------------------------------------------------
 
 if (list_updated('branch_id')) {
@@ -342,7 +343,7 @@ function can_process() {
                return false;
        }
        if ($_SESSION['Items']->trans_type!=ST_SALESORDER && $_SESSION['Items']->trans_type!=ST_SALESQUOTE && !is_date_in_fiscalyear($_POST['OrderDate'])) {
-               display_error(_("The entered date is not in fiscal year"));
+               display_error(_("The entered date is out of fiscal year or is closed for further data entry."));
                set_focus('OrderDate');
                return false;
        }
index 405f1d6653589024b7e0fe315783a511644136f6..712c5470981912b20319bbf9d06120b90a07db7c 100644 (file)
@@ -39,7 +39,7 @@ if (isset($_SESSION['View']))
        unset ($_SESSION['View']);
 }
 
-$_SESSION['View'] = new Cart($_GET['trans_type'], $_GET['trans_no']);
+$_SESSION['View'] = new Cart($_GET['trans_type'], $_GET['trans_no'], true);
 
 start_table(TABLESTYLE2, "width=95%", 5);
 
index ff9467a292f4fa1e3446f3008e5cfa7a3c3d3335..869186ac0cd4d671cea0c3dd13592474870124c7 100644 (file)
@@ -21,23 +21,24 @@ class fa2_1 {
        //      Install procedure. All additional changes 
        //      not included in sql file should go here.
        //
-       function install($pref, $force) 
+       function install($company, $force) 
        {
                global $db;
+
        /*
        Statement below is allowed only for MySQL >=4.0.4:
        UPDATE `0_bank_trans`, `0_bank_accounts` 
                SET 0_bank_trans.bank_act=0_bank_accounts.id 
                WHERE 0_bank_trans.bank_act=0_bank_accounts.account_code;
        */
-               $sql = "SELECT id, account_code FROM ".$pref."bank_accounts";
+               $sql = "SELECT id, account_code FROM ".TB_PREF."bank_accounts";
                if(!($res = db_query($sql))) {
                        display_error(_("Cannot retrieve bank accounts codes")
                                .':<br>'. db_error_msg($db));
                        return false;
                }
                while ($acc = db_fetch($res)) {
-                       $sql = "UPDATE ".$pref."bank_trans SET bank_act='"
+                       $sql = "UPDATE ".TB_PREF."bank_trans SET bank_act='"
                                .$acc['id']."' WHERE bank_act=".$acc['account_code'];
                        if (db_query($sql)==false) {
                        display_error(_("Cannot update bank transactions")
@@ -46,7 +47,7 @@ class fa2_1 {
                        }
                }
                // copy all item codes from stock_master into item_codes
-               $sql = "SELECT `stock_id`,`description`,`category_id` FROM ".$pref."stock_master";
+               $sql = "SELECT `stock_id`,`description`,`category_id` FROM ".TB_PREF."stock_master";
                $result = db_query($sql);
                if (!$result) {
                        display_error(_("Cannot select stock identificators")
@@ -55,7 +56,7 @@ class fa2_1 {
                } else {
                        while ($row = db_fetch_assoc($result)) {
                                $sql = "INSERT IGNORE "
-                                       .$pref."item_codes (`item_code`,`stock_id`,`description`,`category_id`)
+                                       .TB_PREF."item_codes (`item_code`,`stock_id`,`description`,`category_id`)
                                        VALUES('".$row['stock_id']."','".$row['stock_id']."','"
                                        .$row['description']."','".$row['category_id']."')";
                                $res2 = db_query($sql);
@@ -81,11 +82,11 @@ class fa2_1 {
                "SELECT tr.tran_date, tr.type, tr.trans_no, dt.tax_type_id, 
                        dt.rate, dt.included_in_price, dt.amount, tr.reference as ref,
                        tr.rate as ex_rate
-               FROM ".$pref."debtor_trans_tax_details dt       
-                       LEFT JOIN ".$pref."trans_tax_details tt
+               FROM ".TB_PREF."debtor_trans_tax_details dt     
+                       LEFT JOIN ".TB_PREF."trans_tax_details tt
                                ON dt.debtor_trans_no=tt.trans_no 
                                AND dt.debtor_trans_type=tt.trans_type,
-                       ".$pref."debtor_trans tr
+                       ".TB_PREF."debtor_trans tr
                WHERE tt.trans_type is NULL
                        AND dt.debtor_trans_no = tr.trans_no 
                        AND dt.debtor_trans_type = tr.type",
@@ -94,8 +95,8 @@ class fa2_1 {
                "SELECT tr.tran_date, tr.type, tr.trans_no, st.tax_type_id, 
                        st.rate, st.included_in_price, st.amount, tr.supp_reference as ref,
                        tr.rate as ex_rate
-                       FROM ".$pref."supp_invoice_tax_items st 
-                               LEFT JOIN ".$pref."trans_tax_details tt
+                       FROM ".TB_PREF."supp_invoice_tax_items st       
+                               LEFT JOIN ".TB_PREF."trans_tax_details tt
                                        ON st.supp_trans_no=tt.trans_no 
                                        AND st.supp_trans_type=tt.trans_type,
                                        ".$pref."supp_trans tr
@@ -104,14 +105,14 @@ class fa2_1 {
                                        AND st.supp_trans_type = tr.type");
 
        foreach ($move_sql as $tbl => $sql) {
-               if (!check_table($pref, $tbl)){
+               if (!check_table(TB_PREF, $tbl)){
                        $res = db_query($sql, "Cannot retrieve trans tax details from $tbl");
                        while ($row = db_fetch($res)) {
                                $net_amount = $row['rate'] == 0 ?
                                        0 : ($row['included_in_price'] ? 
                                                        ($row['amount']/$row['rate']*(100-$row['rate']))
                                                        :($row['amount']/$row['rate']*100));
-                               $sql2 = "INSERT INTO ".$pref."trans_tax_details 
+                               $sql2 = "INSERT INTO ".TB_PREF."trans_tax_details 
                                (trans_type,trans_no,tran_date,tax_type_id,rate,ex_rate,
                                        included_in_price, net_amount, amount, memo)
                                VALUES ('".$row['type']."','".$row['trans_no']."','"
@@ -121,7 +122,7 @@ class fa2_1 {
                                        ."','".$row['amount']."','".$row['ref']."')";
                                db_query($sql2, "Cannot move trans tax details from $tbl");
                        }
-                       db_query("DROP TABLE ".$pref.$tbl, "cannot remove $tbl");
+                       db_query("DROP TABLE ".TB_PREF.$tbl, "cannot remove $tbl");
                }
        }
                
index fcf9f60f34a55da9508ca6a7522844b2fc6294af..ee1fca7bec6a92bf21cdcf2bc722272f39359db6 100644 (file)
@@ -28,13 +28,14 @@ class fa2_2 {
        //      Install procedure. All additional changes 
        //      not included in sql file should go here.
        //
-       function install($pref, $force) 
+       function install($company, $force) 
        {
-               global $db, $systypes_array;
+               global $db, $systypes_array, $db_connections;
                
                if (!$this->preconf)
                        return false;
 
+               $pref = $db_connections[$company]['tbpref'];
                // Until 2.2 sanitizing text input with db_escape was not
                // consequent enough. To avoid comparision problems we have to 
                // fix this now.
@@ -45,7 +46,7 @@ class fa2_2 {
 
                // set item category dflt accounts to values from company GL setup
                $prefs = get_company_prefs();
-               $sql = "UPDATE {$pref}stock_category SET "
+               $sql = "UPDATE ".TB_PREF."stock_category SET "
                        ."dflt_sales_act = '" . $prefs['default_inv_sales_act'] . "',"
                        ."dflt_cogs_act = '". $prefs['default_cogs_act'] . "',"
                        ."dflt_inventory_act = '" . $prefs['default_inventory_act'] . "',"
@@ -60,14 +61,14 @@ class fa2_2 {
                foreach($systypes_array as $typeno => $typename) {
                        $info = get_systype_db_info($typeno);
                        if ($info == null || $info[3] == null) continue;
-                       $tbl = str_replace(TB_PREF, $pref, $info[0]);
+                       $tbl = $info[0];
                        $sql = "SELECT DISTINCT {$info[2]} as id,{$info[3]} as ref FROM $tbl";
                        if ($info[1])
                                $sql .= " WHERE {$info[1]}=$typeno";
                        $result = db_query($sql);
                        if (db_num_rows($result)) {
                                while ($row = db_fetch($result)) {
-                                       $res2 = db_query("INSERT INTO {$pref}refs VALUES("
+                                       $res2 = db_query("INSERT INTO ".TB_PREF."refs VALUES("
                                                . $row['id'].",".$typeno.",'".$row['ref']."')");
                                        if (!$res2) {
                                                display_error(_("Cannot copy references from $tbl")
@@ -78,7 +79,7 @@ class fa2_2 {
                        }
                }
 
-               if (!($ret = db_query("SELECT MAX(`order_no`) FROM `{$pref}sales_orders`")) ||
+               if (!($ret = db_query("SELECT MAX(`order_no`) FROM `".TB_PREF."sales_orders`")) ||
                        !db_num_rows($ret))
                {
                                display_error(_('Cannot query max sales order number.'));
@@ -87,7 +88,7 @@ class fa2_2 {
                $row = db_fetch($ret);
                $max_order = $row[0];
                $next_ref = $max_order+1;
-               $sql = "UPDATE `{$pref}sys_types` 
+               $sql = "UPDATE `".TB_PREF."sys_types` 
                        SET `type_no`='$max_order',`next_reference`='$next_ref'
                        WHERE `type_id`=30";
                if(!db_query($sql))
@@ -209,7 +210,7 @@ function convert_roles($pref)
                        }
                        $sections  = array_keys($sections);
                        sort($sections); sort($area_set);
-                       import_security_role($pref, $security_headings[$role_id], $sections, $area_set);
+                       import_security_role($security_headings[$role_id], $sections, $area_set);
                        $new_ids[$role_id] = db_insert_id();
                }
                $result = get_users(true);
@@ -219,7 +220,7 @@ function convert_roles($pref)
                }
                foreach($users as $old_id => $uids)
                        foreach( $uids as $id) {
-                               $sql = "UPDATE {$pref}users set role_id=".$new_ids[$old_id].
+                               $sql = "UPDATE ".TB_PREF."users set role_id=".$new_ids[$old_id].
                                        " WHERE id=$id";
                                $ret = db_query($sql, 'cannot update users roles');
                                if(!$ret) return false;
@@ -227,9 +228,9 @@ function convert_roles($pref)
                return true;
 }
 
-function import_security_role($pref, $name, $sections, $areas)
+function import_security_role($name, $sections, $areas)
 {
-       $sql = "INSERT INTO {$pref}security_roles (role, description, sections, areas)
+       $sql = "INSERT INTO ".TB_PREF."security_roles (role, description, sections, areas)
        VALUES (".db_escape('FA 2.1 '.$name).",".db_escape($name).","
        .db_escape(implode(';',$sections)).",".db_escape(implode(';',$areas)).")";
 
@@ -307,7 +308,7 @@ function sanitize_database($pref, $test = false) {
                        }
                }
 
-               if (empty($keys)) { // comments table have no primary key, so let's give up
+               if (empty($keys)) { // comments table have no primary key, so give up
                        continue;
                }
                if ($test)
@@ -333,10 +334,9 @@ function sanitize_database($pref, $test = false) {
                                $key[] = $k.'=\''.$rec[substr($k,1,-1)].'\'';
                        }
                        $sql .= implode( ' AND ', $key);
-                       if ($test) {
-                               error_log($sql);
+                       if ($test)
                                error_log("\t(".implode(',',$val).") updated");
-                       else
+                       else
                                db_query($sql, 'cannot update record');
                }
        }
index 2a517deb7321b79314cfa9ab6812bfaef9de01e3..7705f261fd221251ee7c96f935282e82354a887a 100644 (file)
@@ -24,7 +24,7 @@ class fa2_3 {
        //      Install procedure. All additional changes 
        //      not included in sql file should go here.
        //
-       function install($pref, $force) 
+       function install($company, $force) 
        {
                global $db_version, $dflt_lang;
 
@@ -35,8 +35,8 @@ class fa2_3 {
                if (!$this->beta) {
                        // all specials below are already done on 2.3beta
 
-                       $sql = "SELECT debtor_no, payment_terms FROM {$pref}debtors_master";
-               
+                       $sql = "SELECT debtor_no, payment_terms FROM ".TB_PREF."debtors_master";
+
                        $result = db_query($sql);
                        if (!$result) {
                                display_error("Cannot read customers"
@@ -45,7 +45,7 @@ class fa2_3 {
                        }
                        // update all sales orders and transactions with customer std payment terms
                        while($cust = db_fetch($result)) {
-                               $sql = "UPDATE {$pref}debtor_trans SET "
+                               $sql = "UPDATE ".TB_PREF."debtor_trans SET "
                                        ."payment_terms = '" .$cust['payment_terms']
                                        ."' WHERE debtor_no='".$cust['debtor_no']."'";
                                if (db_query($sql)==false) {
@@ -53,7 +53,7 @@ class fa2_3 {
                                        .':<br>'. db_error_msg($db));
                                        return false;
                                }
-                               $sql = "UPDATE {$pref}sales_orders SET "
+                               $sql = "UPDATE ".TB_PREF."sales_orders SET "
                                        ."payment_terms = '" .$cust['payment_terms']
                                        ."' WHERE debtor_no='".$cust['debtor_no']."'";
                                if (db_query($sql)==false) {
@@ -62,11 +62,11 @@ class fa2_3 {
                                        return false;
                                }
                        }
-                       if (!$this->update_totals($pref)) {
+                       if (!$this->update_totals()) {
                                display_error("Cannot update order totals");
                                return false;
                        }
-                       if (!$this->update_line_relations($pref)) {
+                       if (!$this->update_line_relations()) {
                                display_error("Cannot update sales document links");
                                return false;
                        }
@@ -82,18 +82,18 @@ class fa2_3 {
 
                        foreach($dropcol as $table => $columns)
                                foreach($columns as $col) {
-                                       if (db_query("ALTER TABLE `{$pref}{$table}` DROP `$col`")==false) {
+                                       if (db_query("ALTER TABLE `".TB_PREF."{$table}` DROP `$col`")==false) {
                                                display_error("Cannot drop {$table}.{$col} column:<br>".db_error_msg($db));
                                                return false;
                                        }
                                }
                        // remove old preferences table after upgrade script has been executed
-                       $sql = "DROP TABLE IF EXISTS `{$pref}company`";
+                       $sql = "DROP TABLE IF EXISTS `".TB_PREF."company`";
                        if (!db_query($sql))
                                return false;
                }
                $this->update_lang_cfg();
-               return  update_company_prefs(array('version_id'=>$db_version), $pref);
+               return  update_company_prefs(array('version_id'=>$db_version));
        }
        //
        //      Checking before install
@@ -131,33 +131,33 @@ class fa2_3 {
        /*
                Update order totals
        */
-       function update_totals($pref)
+       function update_totals()
        {
                global $path_to_root;
 
                include_once("$path_to_root/sales/includes/cart_class.inc");
                include_once("$path_to_root/purchasing/includes/po_class.inc");
                $cart = new cart(ST_SALESORDER);
-               $sql = "SELECT order_no, trans_type FROM {$pref}sales_orders";
+               $sql = "SELECT order_no, trans_type FROM ".TB_PREF."sales_orders";
                $orders = db_query($sql);
                if (!$orders)
                        return false;
                while ($order = db_fetch($orders)) {
                        read_sales_order($order['order_no'], $cart, $order['trans_type']);
-                       $result = db_query("UPDATE {$pref}sales_orders 
+                       $result = db_query("UPDATE ".TB_PREF."sales_orders 
                                SET total=".$cart->get_trans_total()
                                ." WHERE order_no=".$order[0]);
                        unset($cart->line_items);
                }
                unset($cart);
                $cart = new purch_order();
-               $sql = "SELECT order_no FROM {$pref}purch_orders";
+               $sql = "SELECT order_no FROM ".TB_PREF."purch_orders";
                $orders = db_query($sql);
                if (!$orders)
                         return false;
                while ($order_no = db_fetch($orders)) {
                        read_po($order_no[0], $cart);
-                       $result = db_query("UPDATE {$pref}purch_orders SET total=".$cart->get_trans_total());
+                       $result = db_query("UPDATE ".TB_PREF."purch_orders SET total=".$cart->get_trans_total());
                        unset($cart->line_items);
                }
                return true;
@@ -200,14 +200,14 @@ class fa2_3 {
                there can be sales documents with lines not properly linked to parents. This rare 
                cases will be described in error log.
        */
-       function update_line_relations($pref)
+       function update_line_relations()
        {
                global $path_to_root, $systypes_array;
 
                require_once("$path_to_root/includes/sysnames.inc");
                
-               $sql =  "SELECT d.type, trans_no, order_ FROM {$pref}debtor_trans d
-                       LEFT JOIN {$pref}voided v ON d.type=v.type AND d.trans_no=v.id
+               $sql =  "SELECT d.type, trans_no, order_ FROM ".TB_PREF."debtor_trans d
+                       LEFT JOIN ".TB_PREF."voided v ON d.type=v.type AND d.trans_no=v.id
                                WHERE ISNULL(v.type) AND 
                                (d.type=".ST_CUSTDELIVERY
                                ." OR d.type=".ST_SALESINVOICE
@@ -251,7 +251,7 @@ class fa2_3 {
                                if ($src_line['stock_id'] == $doc_line['stock_id']
                                        && ($src_line['quantity'] >= $doc_line['quantity'])) {
 
-                                       $sql = "UPDATE {$pref}debtor_trans_details SET src_id = {$src_line['id']}
+                                       $sql = "UPDATE ".TB_PREF."debtor_trans_details SET src_id = {$src_line['id']}
                                                WHERE id = {$doc_line['id']}";
                                        if (!db_query($sql))
                                                return false;
diff --git a/sql/alter2.4.php b/sql/alter2.4.php
new file mode 100644 (file)
index 0000000..f48ca01
--- /dev/null
@@ -0,0 +1,96 @@
+<?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>.
+***********************************************************************/
+class fa2_4 {
+       var $version = '2.4';   // version installed
+       var $description;
+       var $sql = 'alter2.4.sql';
+       var $preconf = true;
+       
+       function fa2_4() {
+               $this->description = _('Upgrade from version 2.3 to 2.4');
+       }
+       
+       //
+       //      Install procedure. All additional changes 
+       //      not included in sql file should go here.
+       //
+       function install($company, $force) 
+       {
+               global $db_version;
+               
+               if (get_company_pref('grn_clearing_act') === null) { // available form 2.3.1, can be not defined on pre-2.4 installations
+                       set_company_pref('grn_clearing_act', 'glsetup.purchase', 'varchar', 15, 0);
+               }
+               $result = $this->update_workorders();
+               if ($result)
+                       $result = $this->do_cleanup();
+//             return  update_company_prefs(array('version_id'=>$db_version));
+               return true;
+       }
+       //
+       //      Checking before install
+       //
+       function pre_check($pref, $force)
+       {
+               return true;
+       }
+       //
+       //      Test if patch was applied before.
+       //
+       function installed($pref)
+       {
+               $n = 2; // number of patches to be installed
+               $patchcnt = 0;
+
+               if (!check_table($pref, 'suppliers', 'tax_algorithm')) $patchcnt++;
+               if (!check_table($pref, 'wo_costing')) $patchcnt++;
+               return $n == $patchcnt ? true : ($patchcnt ? ($patchcnt.'/'. $n) : 0);
+       }
+
+       function update_workorders()
+       {
+               global $db;
+
+               $sql = "SELECT DISTINCT type, type_no, tran_date, person_id FROM ".TB_PREF."gl_trans WHERE `type`=".ST_WORKORDER
+               ." AND person_type_id=1";
+               $res = db_query($sql);
+               if (!$res)
+               {
+                       display_error("Cannot update work orders costs"
+                               .':<br>'. db_error_msg($db));
+                       return false;
+               }
+               while ($row = db_fetch($res))
+               {
+                       $journal_id = get_next_trans_no(ST_JOURNAL);
+
+                       $sql1 = "UPDATE ".TB_PREF."gl_trans SET `type`=".ST_JOURNAL.", type_no={$journal_id},
+                               person_type_id=NULL, person_id=0
+                               WHERE `type`=".ST_WORKORDER." AND type_no={$row['type_no']} AND tran_date='{$row['tran_date']}'
+                               AND person_id='{$row['person_id']}'";
+                       if (!db_query($sql1)) return false;
+                       
+                       $sql2 = "INSERT INTO ".TB_PREF."wo_costing (workorder_id, cost_type, trans_no) 
+                               VALUES ({$row['type_no']}, {$row['person_id']}, {$journal_id})";
+                       if (!db_query($sql2)) return false;
+               }
+               return true;
+       }
+
+       function do_cleanup()
+       {
+               $sql = "ALTER TABLE `".TB_PREF."tax_group_items` DROP COLUMN `rate`";
+               return db_query($sql);
+       }
+}
+
+$install = new fa2_4;
diff --git a/sql/alter2.4.sql b/sql/alter2.4.sql
new file mode 100644 (file)
index 0000000..d99fdc1
--- /dev/null
@@ -0,0 +1,44 @@
+ALTER TABLE `0_suppliers` ADD COLUMN  `tax_algorithm` tinyint(1) NOT NULL default '1' AFTER `tax_included`;
+ALTER TABLE `0_supp_trans` ADD COLUMN `tax_algorithm` tinyint(1) NULL default '1' AFTER `tax_included`;
+INSERT INTO `0_sys_prefs` VALUES('tax_algorithm','glsetup.customer', 'tinyint', 1, '1');
+INSERT INTO `0_sys_prefs` VALUES('gl_closing_date','setup.closing_date', 'date', 8, '');
+# Fix eventual invalid date/year in audit records
+UPDATE `0_audit_trail` audit 
+               LEFT JOIN `0_gl_trans` gl ON  gl.`type`=audit.`type` AND gl.type_no=audit.trans_no
+               LEFT JOIN `0_fiscal_year` year ON year.begin<=gl.tran_date AND year.end>=gl.tran_date
+               SET audit.gl_date=gl.tran_date, audit.fiscal_year=year.id
+               WHERE NOT ISNULL(gl.`type`);
+
+DROP TABLE IF EXISTS `0_wo_costing`;
+
+CREATE TABLE `0_wo_costing` (
+  `id` int(11) NOT NULL auto_increment,
+  `workorder_id` int(11) NOT NULL default '0',
+  `cost_type`  tinyint(1) NOT NULL default '0',
+  `trans_type` int(11) NOT NULL default '0',
+  `trans_no` int(11) NOT NULL default '0',
+  `factor` double NOT NULL default '1',
+  PRIMARY KEY  (`id`)
+) TYPE=InnoDB;
+
+UPDATE `0_gl_trans` gl
+               LEFT JOIN `0_cust_branch` br ON br.receivables_account=gl.account AND br.debtor_no=gl.person_id AND gl.person_type_id=2
+               LEFT JOIN `0_suppliers` sup ON sup.payable_account=gl.account AND sup.supplier_id=gl.person_id AND gl.person_type_id=3
+ SET `person_id` = IF(br.receivables_account, br.debtor_no, IF(sup.payable_account, sup.supplier_id, NULL)), 
+       `person_type_id` = IF(br.receivables_account, 2, IF(sup.payable_account, 3, NULL));
+
+ALTER TABLE `0_tax_group_items` ADD COLUMN `tax_shipping` tinyint(1) NOT NULL default '0' AFTER `rate`;
+UPDATE `0_tax_group_items` tgi
+       SET tgi.tax_shipping=1
+       WHERE tgi.rate=(SELECT 0_tax_types.rate FROM 0_tax_types, 0_tax_groups 
+               WHERE tax_shipping=1 AND tgi.tax_group_id=0_tax_groups.id AND tgi.tax_type_id=0_tax_types.id);
+ALTER TABLE `0_tax_groups` DROP COLUMN `tax_shipping`;
+
+ALTER TABLE `0_sales_order_details` ADD KEY `stkcode` (`stk_code`);
+ALTER TABLE `0_purch_order_details` ADD KEY `itemcode` (`item_code`);
+ALTER TABLE `0_sys_prefs` CHANGE `value` `value` TEXT NOT NULL DEFAULT '';
+ALTER TABLE `0_cust_branch` ADD COLUMN `bank_account` varchar(60) DEFAULT NULL AFTER `notes`;
+
+ALTER TABLE `0_debtor_trans` ADD COLUMN `tax_included` tinyint(1) unsigned NOT NULL default '0' AFTER `payment_terms`;
+UPDATE `0_debtor_trans` tr, `0_trans_tax_details` td SET tr.tax_included=td.included_in_price
+       WHERE tr.`type`=td.trans_type AND tr.trans_no=td.trans_no AND td.included_in_price
\ No newline at end of file
index 205355a05ef59888b40807b8724ee53a30b26a89..159ab6c28fd9d9e29370c7085a0e7fd724172f1c 100644 (file)
@@ -611,6 +611,7 @@ CREATE TABLE IF NOT EXISTS `0_cust_branch` (
   `br_post_address` tinytext NOT NULL,
   `group_no` int(11) NOT NULL default '0',
   `notes` tinytext NOT NULL,
+  `bank_account` varchar(60) DEFAULT NULL,
   `inactive` tinyint(1) NOT NULL default '0',
   PRIMARY KEY  (`branch_code`,`debtor_no`),
   KEY `branch_code` (`branch_code`),
@@ -622,9 +623,9 @@ CREATE TABLE IF NOT EXISTS `0_cust_branch` (
 -- Dumping data for table `0_cust_branch`
 --
 
-INSERT INTO `0_cust_branch` VALUES(1, 1, 'Beefeater Ltd.', 'Beefeater', '', 1, 1, 'Main Branch', 'DEF', 2, '', '4510', '1200', '4500', 1, 0, 'Address 1\nAddress 2\nAddress 3', 0, '', 0);
-INSERT INTO `0_cust_branch` VALUES(2, 2, 'Ghostbusters Corp.', 'Ghostbusters', 'Address 1\nAddress 2\nAddress 3', 1, 1, 'Main Branch', 'DEF', 1, '', '4510', '1200', '4500', 1, 0, 'Address 1\nAddress 2\nAddress 3', 0, '', 0);
-INSERT INTO `0_cust_branch` VALUES(3, 3, 'Brezan', 'Brezan', 'Address 1\nAddress 2\nAddress 3', 1, 1, 'Main Branch', 'DEF', 1, '', '4510', '1200', '4500', 1, 0, 'Address 1\nAddress 2\nAddress 3', 0, '', 0);
+INSERT INTO `0_cust_branch` VALUES(1, 1, 'Beefeater Ltd.', 'Beefeater', '', 1, 1, 'Main Branch', 'DEF', 2, '', '4510', '1200', '4500', 1, 0, 'Address 1\nAddress 2\nAddress 3', 0, '', '', 0);
+INSERT INTO `0_cust_branch` VALUES(2, 2, 'Ghostbusters Corp.', 'Ghostbusters', 'Address 1\nAddress 2\nAddress 3', 1, 1, 'Main Branch', 'DEF', 1, '', '4510', '1200', '4500', 1, 0, 'Address 1\nAddress 2\nAddress 3', 0, '','', 0);
+INSERT INTO `0_cust_branch` VALUES(3, 3, 'Brezan', 'Brezan', 'Address 1\nAddress 2\nAddress 3', 1, 1, 'Main Branch', 'DEF', 1, '', '4510', '1200', '4500', 1, 0, 'Address 1\nAddress 2\nAddress 3', 0, '', '', 0);
 
 -- --------------------------------------------------------
 
@@ -692,6 +693,7 @@ CREATE TABLE IF NOT EXISTS `0_debtor_trans` (
   `dimension_id` int(11) NOT NULL default '0',
   `dimension2_id` int(11) NOT NULL default '0',
   `payment_terms` int(11) default NULL,
+  `tax_included` tinyint(1) unsigned NOT NULL default '0',
   PRIMARY KEY  (`type`,`trans_no`),
   KEY `debtor_no` (`debtor_no`,`branch_code`),
   KEY `tran_date` (`tran_date`)
@@ -701,14 +703,14 @@ CREATE TABLE IF NOT EXISTS `0_debtor_trans` (
 -- Dumping data for table `0_debtor_trans`
 --
 
-INSERT INTO `0_debtor_trans` VALUES(17, 10, 0, 2, 2, '2009-06-21', '2009-06-22', '1', 1, 2, 50, 2.5, 0, 0, 0, 0, 1, 1, 0, 0, 4);
-INSERT INTO `0_debtor_trans` VALUES(18, 10, 1, 3, 3, '2009-06-21', '2009-07-01', '2', 2, 3, 35.89, 1.79, 0, 0, 0, 37.68, 1.3932, 1, 2, 0, 3);
-INSERT INTO `0_debtor_trans` VALUES(19, 10, 0, 2, 2, '2009-06-21', '2009-06-22', '3', 1, 5, 50, 0, 5, 0, 0, 0, 1, 1, 0, 0, 4);
-INSERT INTO `0_debtor_trans` VALUES(3, 11, 0, 3, 3, '2009-06-21', '0000-00-00', '1', 2, 3, 35.89, 1.79, 0, 0, 0, 37.68, 1.3932, 1, 2, 0, 3);
-INSERT INTO `0_debtor_trans` VALUES(2, 13, 0, 1, 1, '2009-06-21', '2009-06-22', '1', 2, 1, 60.8, 0, 10, 0, 0, 0, 1.6445729799917, 1, 0, 0, 3);
-INSERT INTO `0_debtor_trans` VALUES(3, 13, 1, 2, 2, '2009-06-21', '2009-06-22', 'auto', 1, 2, 50, 2.5, 0, 0, 0, 0, 1, 1, 0, 0, 4);
-INSERT INTO `0_debtor_trans` VALUES(4, 13, 1, 3, 3, '2009-06-21', '2009-07-01', 'auto', 2, 3, 35.89, 1.79, 0, 0, 0, 0, 1.3932, 1, 2, 0, 3);
-INSERT INTO `0_debtor_trans` VALUES(5, 13, 1, 2, 2, '2009-06-21', '2009-06-22', 'auto', 1, 5, 50, 0, 5, 0, 0, 0, 1, 1, 0, 0, 4);
+INSERT INTO `0_debtor_trans` VALUES(17, 10, 0, 2, 2, '2009-06-21', '2009-06-22', '1', 1, 2, 50, 2.5, 0, 0, 0, 0, 1, 1, 0, 0, 4, 0);
+INSERT INTO `0_debtor_trans` VALUES(18, 10, 1, 3, 3, '2009-06-21', '2009-07-01', '2', 2, 3, 35.89, 1.79, 0, 0, 0, 37.68, 1.3932, 1, 2, 0, 3, 0);
+INSERT INTO `0_debtor_trans` VALUES(19, 10, 0, 2, 2, '2009-06-21', '2009-06-22', '3', 1, 5, 50, 0, 5, 0, 0, 0, 1, 1, 0, 0, 4, 0);
+INSERT INTO `0_debtor_trans` VALUES(3, 11, 0, 3, 3, '2009-06-21', '0000-00-00', '1', 2, 3, 35.89, 1.79, 0, 0, 0, 37.68, 1.3932, 1, 2, 0, 3, 0);
+INSERT INTO `0_debtor_trans` VALUES(2, 13, 0, 1, 1, '2009-06-21', '2009-06-22', '1', 2, 1, 60.8, 0, 10, 0, 0, 0, 1.6445729799917, 1, 0, 0, 3, 0);
+INSERT INTO `0_debtor_trans` VALUES(3, 13, 1, 2, 2, '2009-06-21', '2009-06-22', 'auto', 1, 2, 50, 2.5, 0, 0, 0, 0, 1, 1, 0, 0, 4, 0);
+INSERT INTO `0_debtor_trans` VALUES(4, 13, 1, 3, 3, '2009-06-21', '2009-07-01', 'auto', 2, 3, 35.89, 1.79, 0, 0, 0, 0, 1.3932, 1, 2, 0, 3, 0);
+INSERT INTO `0_debtor_trans` VALUES(5, 13, 1, 2, 2, '2009-06-21', '2009-06-22', 'auto', 1, 5, 50, 0, 5, 0, 0, 0, 1, 1, 0, 0, 4, 0);
 
 -- --------------------------------------------------------
 
@@ -1367,7 +1369,8 @@ CREATE TABLE IF NOT EXISTS `0_purch_order_details` (
   `quantity_ordered` double NOT NULL default '0',
   `quantity_received` double NOT NULL default '0',
   PRIMARY KEY  (`po_detail_item`),
-  KEY `order` (`order_no`,`po_detail_item`)
+  KEY `order` (`order_no`,`po_detail_item`),
+  KEY `itemcode` (`item_code`)
 ) ENGINE=InnoDB  AUTO_INCREMENT=6 ;
 
 --
@@ -1572,7 +1575,8 @@ CREATE TABLE IF NOT EXISTS `0_sales_order_details` (
   `quantity` double NOT NULL default '0',
   `discount_percent` double NOT NULL default '0',
   PRIMARY KEY  (`id`),
-  KEY `sorder` (`trans_type`,`order_no`)
+  KEY `sorder` (`trans_type`,`order_no`),
+  KEY `stkcode` (`stk_code`)
 ) ENGINE=InnoDB  AUTO_INCREMENT=6 ;
 
 --
@@ -1878,6 +1882,7 @@ CREATE TABLE IF NOT EXISTS `0_suppliers` (
   `curr_code` char(3) default NULL,
   `payment_terms` int(11) default NULL,
   `tax_included` tinyint(1) NOT NULL default '0',
+  `tax_algorithm` tinyint(1) NOT NULL default '1',
   `dimension_id` int(11) default '0',
   `dimension2_id` int(11) default '0',
   `tax_group_id` int(11) default NULL,
@@ -1895,9 +1900,9 @@ CREATE TABLE IF NOT EXISTS `0_suppliers` (
 -- Dumping data for table `0_suppliers`
 --
 
-INSERT INTO `0_suppliers` VALUES(1, 'Junk Beer ApS', 'Junk Beer', 'Mailing 1\nMailing 2\nMailing 3', 'Address 1\nAddress 2\nAddress 3', '123456', 'Contact', '111', '', '', 'DKK', 3, 0, 1, 0, 2, 1000, '', '2100', '5060', 'A supplier with junk beers.', 0);
-INSERT INTO `0_suppliers` VALUES(2, 'Lucky Luke Inc.', 'Lucky Luke', 'Mailing 1\nMailing 2\nMailing 3', 'Address 1\nAddress 2\nAddress 3', '654321', 'Luke', '333', '', '', 'USD', 3, 0, 0, 0, 1, 500, '', '2100', '5060', '', 0);
-INSERT INTO `0_suppliers` VALUES(3, 'Money Makers Ltd.', 'Money Makers', 'Mailing 1\nMailing 2\nMailing 3', 'Address 1\nAddress 2\nAddress 3', '987654', 'Makers', '222', '', '', 'GBP', 3, 0, 0, 0, 2, 300, '', '2100', '5060', '', 0);
+INSERT INTO `0_suppliers` VALUES(1, 'Junk Beer ApS', 'Junk Beer', 'Mailing 1\nMailing 2\nMailing 3', 'Address 1\nAddress 2\nAddress 3', '123456', 'Contact', '111', '', '', 'DKK', 3, 0, 1, 1, 0, 2, 1000, '', '2100', '5060', 'A supplier with junk beers.', 0);
+INSERT INTO `0_suppliers` VALUES(2, 'Lucky Luke Inc.', 'Lucky Luke', 'Mailing 1\nMailing 2\nMailing 3', 'Address 1\nAddress 2\nAddress 3', '654321', 'Luke', '333', '', '', 'USD', 3, 0, 1, 0, 0, 1, 500, '', '2100', '5060', '', 0);
+INSERT INTO `0_suppliers` VALUES(3, 'Money Makers Ltd.', 'Money Makers', 'Mailing 1\nMailing 2\nMailing 3', 'Address 1\nAddress 2\nAddress 3', '987654', 'Makers', '222', '', '', 'GBP', 3, 0, 1, 0, 0, 2, 300, '', '2100', '5060', '', 0);
 
 -- --------------------------------------------------------
 
@@ -1980,6 +1985,7 @@ CREATE TABLE IF NOT EXISTS `0_supp_trans` (
   `rate` double NOT NULL default '1',
   `alloc` double NOT NULL default '0',
   `tax_included` tinyint(1) NOT NULL default '0',
+  `tax_algorihm` tinyint(1) NOT NULL default '1',
   PRIMARY KEY  (`type`,`trans_no`),
   KEY `supplier_id` (`supplier_id`),
   KEY `SupplierID_2` (`supplier_id`,`supp_reference`),
@@ -1991,9 +1997,9 @@ CREATE TABLE IF NOT EXISTS `0_supp_trans` (
 -- Dumping data for table `0_supp_trans`
 --
 
-INSERT INTO `0_supp_trans` VALUES(7, 20, 2, '1', '5t', '2009-06-21', '2009-07-01', 3300, 0, 165, 1, 3465, 0);
-INSERT INTO `0_supp_trans` VALUES(8, 20, 2, '2', 'cc', '2009-06-21', '2009-07-01', 20, 0, 0, 1, 0, 0);
-INSERT INTO `0_supp_trans` VALUES(4, 22, 2, '1', '', '2009-06-21', '2009-06-21', -3465, 0, 0, 1, 3465, 0);
+INSERT INTO `0_supp_trans` VALUES(7, 20, 2, '1', '5t', '2009-06-21', '2009-07-01', 3300, 0, 165, 1, 3465, 0, 1);
+INSERT INTO `0_supp_trans` VALUES(8, 20, 2, '2', 'cc', '2009-06-21', '2009-07-01', 20, 0, 0, 1, 0, 0, 1);
+INSERT INTO `0_supp_trans` VALUES(4, 22, 2, '1', '', '2009-06-21', '2009-06-21', -3465, 0, 0, 1, 3465, 0, 1);
 
 -- --------------------------------------------------------
 
@@ -2007,7 +2013,7 @@ CREATE TABLE IF NOT EXISTS `0_sys_prefs` (
   `category` varchar(30) default NULL,
   `type` varchar(20) NOT NULL default '',
   `length` smallint(6) default NULL,
-  `value` tinytext,
+  `value` text,
   PRIMARY KEY  (`name`),
   KEY `category` (`category`)
 ) ENGINE=MyISAM;
@@ -2029,7 +2035,7 @@ INSERT INTO `0_sys_prefs` VALUES('coy_logo', 'setup.company', 'varchar', 100, 'l
 INSERT INTO `0_sys_prefs` VALUES('domicile', 'setup.company', 'varchar', 55, '');
 INSERT INTO `0_sys_prefs` VALUES('curr_default', 'setup.company', 'char', 3, 'USD');
 INSERT INTO `0_sys_prefs` VALUES('use_dimension', 'setup.company', 'tinyint', 1, '1');
-INSERT INTO `0_sys_prefs` VALUES('f_year', 'setup.company', 'int', 11, '4');
+INSERT INTO `0_sys_prefs` VALUES('f_year', 'setup.company', 'int', 11, '3');
 INSERT INTO `0_sys_prefs` VALUES('no_item_list', 'setup.company', 'tinyint', 1, '0');
 INSERT INTO `0_sys_prefs` VALUES('no_customer_list', 'setup.company', 'tinyint', 1, '0');
 INSERT INTO `0_sys_prefs` VALUES('no_supplier_list', 'setup.company', 'tinyint', 1, '0');
@@ -2043,6 +2049,7 @@ INSERT INTO `0_sys_prefs` VALUES('profit_loss_year_act', 'glsetup.general', 'var
 INSERT INTO `0_sys_prefs` VALUES('retained_earnings_act', 'glsetup.general', 'varchar', 15, '3590');
 INSERT INTO `0_sys_prefs` VALUES('bank_charge_act', 'glsetup.general', 'varchar', 15, '5690');
 INSERT INTO `0_sys_prefs` VALUES('exchange_diff_act', 'glsetup.general', 'varchar', 15, '4450');
+INSERT INTO `0_sys_prefs` VALUES('tax_algorithm', 'glsetup.general', 'tinyint', 1, '1');
 INSERT INTO `0_sys_prefs` VALUES('default_credit_limit', 'glsetup.customer', 'int', 11, '1000');
 INSERT INTO `0_sys_prefs` VALUES('accumulate_shipping', 'glsetup.customer', 'tinyint', 1, '0');
 INSERT INTO `0_sys_prefs` VALUES('legal_text', 'glsetup.customer', 'tinytext', 0, '');
@@ -2159,7 +2166,6 @@ DROP TABLE IF EXISTS `0_tax_groups`;
 CREATE TABLE IF NOT EXISTS `0_tax_groups` (
   `id` int(11) NOT NULL auto_increment,
   `name` varchar(60) NOT NULL default '',
-  `tax_shipping` tinyint(1) NOT NULL default '0',
   `inactive` tinyint(1) NOT NULL default '0',
   PRIMARY KEY  (`id`),
   UNIQUE KEY `name` (`name`)
@@ -2169,8 +2175,8 @@ CREATE TABLE IF NOT EXISTS `0_tax_groups` (
 -- Dumping data for table `0_tax_groups`
 --
 
-INSERT INTO `0_tax_groups` VALUES(1, 'Tax', 0, 0);
-INSERT INTO `0_tax_groups` VALUES(2, 'Tax Exempt', 0, 0);
+INSERT INTO `0_tax_groups` VALUES(1, 'Tax', 0);
+INSERT INTO `0_tax_groups` VALUES(2, 'Tax Exempt', 0);
 
 -- --------------------------------------------------------
 
@@ -2182,7 +2188,7 @@ DROP TABLE IF EXISTS `0_tax_group_items`;
 CREATE TABLE IF NOT EXISTS `0_tax_group_items` (
   `tax_group_id` int(11) NOT NULL default '0',
   `tax_type_id` int(11) NOT NULL default '0',
-  `rate` double NOT NULL default '0',
+  `tax_shipping` tinyint(1) NOT NULL default '0',
   PRIMARY KEY  (`tax_group_id`,`tax_type_id`)
 ) ENGINE=InnoDB;
 
@@ -2190,7 +2196,7 @@ CREATE TABLE IF NOT EXISTS `0_tax_group_items` (
 -- Dumping data for table `0_tax_group_items`
 --
 
-INSERT INTO `0_tax_group_items` VALUES(1, 1, 5);
+INSERT INTO `0_tax_group_items` VALUES(1, 1, 1);
 
 -- --------------------------------------------------------
 
index a866a6f7e7b4587df8f57d3d2eeb70b91b3e1f95..09fe3108c6d170333a64605a80fc550fa1867a75 100644 (file)
@@ -576,6 +576,7 @@ CREATE TABLE IF NOT EXISTS `0_cust_branch` (
   `br_post_address` tinytext NOT NULL,
   `group_no` int(11) NOT NULL default '0',
   `notes` tinytext NOT NULL,
+  `bank_account` varchar(60) DEFAULT NULL,
   `inactive` tinyint(1) NOT NULL default '0',
   PRIMARY KEY  (`branch_code`,`debtor_no`),
   KEY `branch_code` (`branch_code`),
@@ -651,6 +652,7 @@ CREATE TABLE IF NOT EXISTS `0_debtor_trans` (
   `dimension_id` int(11) NOT NULL default '0',
   `dimension2_id` int(11) NOT NULL default '0',
   `payment_terms` int(11) default NULL,
+  `tax_included` tinyint(1) unsigned NOT NULL default '0',
   PRIMARY KEY  (`type`,`trans_no`),
   KEY `debtor_no` (`debtor_no`,`branch_code`),
   KEY `tran_date` (`tran_date`)
@@ -1196,7 +1198,8 @@ CREATE TABLE IF NOT EXISTS `0_purch_order_details` (
   `quantity_ordered` double NOT NULL default '0',
   `quantity_received` double NOT NULL default '0',
   PRIMARY KEY  (`po_detail_item`),
-  KEY `order` (`order_no`,`po_detail_item`)
+  KEY `order` (`order_no`,`po_detail_item`),
+  KEY `itemcode` (`item_code`)
 ) ENGINE=InnoDB AUTO_INCREMENT=1 ;
 
 --
@@ -1389,7 +1392,8 @@ CREATE TABLE IF NOT EXISTS `0_sales_order_details` (
   `quantity` double NOT NULL default '0',
   `discount_percent` double NOT NULL default '0',
   PRIMARY KEY  (`id`),
-  KEY `sorder` (`trans_type`,`order_no`)
+  KEY `sorder` (`trans_type`,`order_no`),
+  KEY `stkcode` (`stk_code`)
 ) ENGINE=InnoDB AUTO_INCREMENT=1 ;
 
 --
@@ -1649,6 +1653,7 @@ CREATE TABLE IF NOT EXISTS `0_suppliers` (
   `curr_code` char(3) default NULL,
   `payment_terms` int(11) default NULL,
   `tax_included` tinyint(1) NOT NULL default '0',
+  `tax_algorithm` tinyint(1) NOT NULL default '1',
   `dimension_id` int(11) default '0',
   `dimension2_id` int(11) default '0',
   `tax_group_id` int(11) default NULL,
@@ -1742,6 +1747,7 @@ CREATE TABLE IF NOT EXISTS `0_supp_trans` (
   `rate` double NOT NULL default '1',
   `alloc` double NOT NULL default '0',
   `tax_included` tinyint(1) NOT NULL default '0',
+  `tax_algorihm` tinyint(1) NOT NULL default '1',
   PRIMARY KEY  (`type`,`trans_no`),
   KEY `supplier_id` (`supplier_id`),
   KEY `SupplierID_2` (`supplier_id`,`supp_reference`),
@@ -1766,7 +1772,7 @@ CREATE TABLE IF NOT EXISTS `0_sys_prefs` (
   `category` varchar(30) default NULL,
   `type` varchar(20) NOT NULL default '',
   `length` smallint(6) default NULL,
-  `value` tinytext,
+  `value` text,
   PRIMARY KEY  (`name`),
   KEY `category` (`category`)
 ) ENGINE=MyISAM;
@@ -1788,7 +1794,7 @@ INSERT INTO `0_sys_prefs` VALUES('coy_logo', 'setup.company', 'varchar', 100, ''
 INSERT INTO `0_sys_prefs` VALUES('domicile', 'setup.company', 'varchar', 55, '');
 INSERT INTO `0_sys_prefs` VALUES('curr_default', 'setup.company', 'char', 3, 'USD');
 INSERT INTO `0_sys_prefs` VALUES('use_dimension', 'setup.company', 'tinyint', 1, '1');
-INSERT INTO `0_sys_prefs` VALUES('f_year', 'setup.company', 'int', 11, '4');
+INSERT INTO `0_sys_prefs` VALUES('f_year', 'setup.company', 'int', 11, '3');
 INSERT INTO `0_sys_prefs` VALUES('no_item_list', 'setup.company', 'tinyint', 1, '0');
 INSERT INTO `0_sys_prefs` VALUES('no_customer_list', 'setup.company', 'tinyint', 1, '0');
 INSERT INTO `0_sys_prefs` VALUES('no_supplier_list', 'setup.company', 'tinyint', 1, '0');
@@ -1802,6 +1808,7 @@ INSERT INTO `0_sys_prefs` VALUES('profit_loss_year_act', 'glsetup.general', 'var
 INSERT INTO `0_sys_prefs` VALUES('retained_earnings_act', 'glsetup.general', 'varchar', 15, '3590');
 INSERT INTO `0_sys_prefs` VALUES('bank_charge_act', 'glsetup.general', 'varchar', 15, '5690');
 INSERT INTO `0_sys_prefs` VALUES('exchange_diff_act', 'glsetup.general', 'varchar', 15, '4450');
+INSERT INTO `0_sys_prefs` VALUES('tax_algorithm', 'glsetup.general', 'tinyint', 1, '1');
 INSERT INTO `0_sys_prefs` VALUES('default_credit_limit', 'glsetup.customer', 'int', 11, '1000');
 INSERT INTO `0_sys_prefs` VALUES('accumulate_shipping', 'glsetup.customer', 'tinyint', 1, '0');
 INSERT INTO `0_sys_prefs` VALUES('legal_text', 'glsetup.customer', 'tinytext', 0, '');
@@ -1918,7 +1925,6 @@ DROP TABLE IF EXISTS `0_tax_groups`;
 CREATE TABLE IF NOT EXISTS `0_tax_groups` (
   `id` int(11) NOT NULL auto_increment,
   `name` varchar(60) NOT NULL default '',
-  `tax_shipping` tinyint(1) NOT NULL default '0',
   `inactive` tinyint(1) NOT NULL default '0',
   PRIMARY KEY  (`id`),
   UNIQUE KEY `name` (`name`)
@@ -1928,8 +1934,8 @@ CREATE TABLE IF NOT EXISTS `0_tax_groups` (
 -- Dumping data for table `0_tax_groups`
 --
 
-INSERT INTO `0_tax_groups` VALUES(1, 'Tax', 0, 0);
-INSERT INTO `0_tax_groups` VALUES(2, 'Tax Exempt', 0, 0);
+INSERT INTO `0_tax_groups` VALUES(1, 'Tax', 0);
+INSERT INTO `0_tax_groups` VALUES(2, 'Tax Exempt', 0);
 
 -- --------------------------------------------------------
 
@@ -1941,7 +1947,7 @@ DROP TABLE IF EXISTS `0_tax_group_items`;
 CREATE TABLE IF NOT EXISTS `0_tax_group_items` (
   `tax_group_id` int(11) NOT NULL default '0',
   `tax_type_id` int(11) NOT NULL default '0',
-  `rate` double NOT NULL default '0',
+  `tax_shipping` tinyint(1) NOT NULL default '0',
   PRIMARY KEY  (`tax_group_id`,`tax_type_id`)
 ) ENGINE=InnoDB;
 
@@ -1949,7 +1955,7 @@ CREATE TABLE IF NOT EXISTS `0_tax_group_items` (
 -- Dumping data for table `0_tax_group_items`
 --
 
-INSERT INTO `0_tax_group_items` VALUES(1, 1, 5);
+INSERT INTO `0_tax_group_items` VALUES(1, 1, 5, 1);
 
 -- --------------------------------------------------------
 
index 826ad8a05865b3b6dc482b86d017b764c3fbb678..032cc560f6596b2fb54e5e4b29f1cf79e1179a38 100644 (file)
@@ -9,40 +9,29 @@
     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
     See the License here <http://www.gnu.org/licenses/gpl-3.0.html>.
 ***********************************************************************/
-function clear_shipping_tax_group() {
-         $sql = "UPDATE ".TB_PREF."tax_groups SET tax_shipping=0 WHERE 1";
-         db_query($sql, "could not update tax_shipping fields");         
-}
-
-function add_tax_group($name, $tax_shipping, $taxes, $rates)
+function add_tax_group($name, $taxes, $tax_shippings)
 {
        begin_transaction();
 
-       if($tax_shipping)       // only one tax group for shipping
-         clear_shipping_tax_group();
-               
-       $sql = "INSERT INTO ".TB_PREF."tax_groups (name, tax_shipping) VALUES (".db_escape($name).", ".db_escape($tax_shipping).")";
+       $sql = "INSERT INTO ".TB_PREF."tax_groups (name) VALUES (".db_escape($name).")";
        db_query($sql, "could not add tax group");
        
        $id = db_insert_id();
        
-       add_tax_group_items($id, $taxes, $rates);       
+       add_tax_group_items($id, $taxes, $tax_shippings);       
        
        commit_transaction();   
 }
 
-function update_tax_group($id, $name, $tax_shipping, $taxes, $rates)
+function update_tax_group($id, $name, $taxes, $tax_shippings)
 {
        begin_transaction();    
 
-       if($tax_shipping)       // only one tax group for shipping
-         clear_shipping_tax_group();
-       
-    $sql = "UPDATE ".TB_PREF."tax_groups SET name=".db_escape($name).",tax_shipping=".db_escape($tax_shipping)." WHERE id=".db_escape($id);
+    $sql = "UPDATE ".TB_PREF."tax_groups SET name=".db_escape($name)." WHERE id=".db_escape($id);
        db_query($sql, "could not update tax group");
        
        delete_tax_group_items($id);
-       add_tax_group_items($id, $taxes, $rates);       
+       add_tax_group_items($id, $taxes, $tax_shippings);       
        
        commit_transaction();                   
 }
@@ -77,12 +66,12 @@ function delete_tax_group($id)
        commit_transaction();
 }
 
-function add_tax_group_items($id, $items, $rates)
+function add_tax_group_items($id, $items, $tax_shippings)
 {
        for ($i=0; $i < count($items); $i++) 
        {
-               $sql = "INSERT INTO ".TB_PREF."tax_group_items (tax_group_id, tax_type_id, rate)
-                       VALUES (".db_escape($id).",  ".db_escape($items[$i]).", " . $rates[$i] .")";
+               $sql = "INSERT INTO ".TB_PREF."tax_group_items (tax_group_id, tax_type_id, tax_shipping)
+                       VALUES (".db_escape($id).",  ".db_escape($items[$i]).", " . $tax_shippings[$i] .")";
                db_query($sql, "could not add item tax group item");                                    
        }               
 }
@@ -98,7 +87,7 @@ function delete_tax_group_items($id)
 //     Return all tax types with rate value updated according to tax group selected
 //     Call the function without arg to find shipment group taxes.
 //
-function get_tax_group_rates($group_id=null)
+function get_tax_group_rates($group_id=null, $tax_shipping=false)
 {
        global $suppress_tax_rates;
 
@@ -109,43 +98,46 @@ function get_tax_group_rates($group_id=null)
                        : "CONCAT(t.name, ' (', t.rate, '%)') as tax_type_name,")
                ."t.sales_gl_code,
                  t.purchasing_gl_code,
-                 IF(g.tax_type_id, t.rate, NULL) as rate
+                 IF(g.tax_type_id, t.rate, NULL) as rate,
+                 g.tax_shipping
                FROM ".TB_PREF."tax_types t 
                  LEFT JOIN ".TB_PREF."tax_group_items g ON t.id=g.tax_type_id
-                       AND g.tax_group_id=". ($group_id ? db_escape($group_id) : "(SELECT id FROM ".TB_PREF."tax_groups WHERE tax_shipping=1)")
-               ." WHERE !t.inactive";
+       AND g.tax_group_id=". ($group_id ? db_escape($group_id) : "(SELECT MIN(id) FROM ".TB_PREF."tax_groups)")                  
+       . " WHERE !t.inactive";
+       if ($tax_shipping)
+               $sql .= " AND g.tax_shipping=1";
 
        return db_query($sql, "cannot get tax types as array");
 }
 
 function get_tax_group_items_as_array($id)
 {
-       $active_taxes = $ret_tax_array = array();
-
+       $ret_tax_array = array();
+       
        $tax_group_items = get_tax_group_rates($id);
-
-       while ($tax_group_item = db_fetch_assoc($tax_group_items)) 
+       
+       while ($tax_group_item = db_fetch($tax_group_items)) 
        {
                $tax_group_item['Value'] = 0;
                $ret_tax_array[$tax_group_item['tax_type_id']] = $tax_group_item;
-       }
 
+       }
+       
        return $ret_tax_array;
 }
 
-
-function get_shipping_tax_as_array()
+function get_shipping_tax_as_array($id)
 {
-       $active_taxes = $ret_tax_array = array();
+       $ret_tax_array = array();
 
-       $tax_group_items = get_tax_group_rates();
+       $tax_group_items = get_tax_group_rates($id, true);
 
-       while ($tax_group_item = db_fetch_assoc($tax_group_items)) 
+       while ($tax_group_item = db_fetch($tax_group_items)) 
        {
                $tax_group_item['Value'] = 0;
                $ret_tax_array[$tax_group_item['tax_type_id']] = $tax_group_item;
        }
-
+       
        return $ret_tax_array;
 }
-
+?>
\ No newline at end of file
index 4c4b9f37c5a7ea047e6a4d908d3a3c7f5502c107..27b1ccfadeca21a750a35021d06aede635a18ee7 100644 (file)
@@ -36,6 +36,7 @@ function get_tax_free_price_for_item($stock_id, $price, $tax_group, $tax_include
        //print_r($ret_tax_array);
 
        $tax_array = get_taxes_for_item($stock_id, $ret_tax_array);
+
        // if no exemptions or taxgroup is empty, then no included/excluded taxes
        if ($tax_array == null)
                return $price;
@@ -142,23 +143,38 @@ function get_taxes_for_item($stock_id, $tax_group_items_array)
 //-----------------------------------------------------------------------------------
 // return an array of (tax_type_id, tax_type_name, sales_gl_code, purchasing_gl_code, rate, included_in_price, Value) 
 
-function get_tax_for_items($items, $prices, $shipping_cost, $tax_group, $tax_included=null, $tax_items_array=null)
+function get_tax_for_items($items, $prices, $shipping_cost, $tax_group, $tax_included=null, $tax_items_array=null, $tax_algorithm = null)
 {
+       if (!$tax_algorithm)
+               $tax_algorithm = get_company_pref('tax_algorithm');
        // first create and set an array with all the tax types of the tax group
        if($tax_items_array!=null)
          $ret_tax_array = $tax_items_array;
        else
          $ret_tax_array = get_tax_group_items_as_array($tax_group);
 
+       $dec = user_price_dec();
+
+       $fully_exempt = true;
        foreach($ret_tax_array as $k=>$t)
+       {
+               if ($t['rate'] !== null)
+                       $fully_exempt = false;
                $ret_tax_array[$k]['Net'] = 0;
+       }
 
+       $ret_tax_array['exempt'] = array('Value'=>0, 'Net'=>0, 'rate' => null, 'tax_type_id' => '');
        $dec = user_price_dec();
        // loop for all items
        for ($i = 0; $i < count($items); $i++)
        {
                $item_taxes = get_taxes_for_item($items[$i], $ret_tax_array);
-               if ($item_taxes != null) 
+               if ($item_taxes == null || $fully_exempt) 
+               {
+                         $ret_tax_array['exempt']['Value'] += round2(0, $dec);
+                         $ret_tax_array['exempt']['Net'] += $prices[$i];
+               }
+               else
                {
                        $tax_multiplier = 0;
                        foreach ($item_taxes as $taxitem) 
@@ -173,18 +189,17 @@ function get_tax_for_items($items, $prices, $shipping_cost, $tax_group, $tax_inc
                                          $ret_tax_array[$index]['Value'] += round2($prices[$i]*$item_tax['rate']/(100+$tax_multiplier), $dec);
                                          $ret_tax_array[$index]['Net'] += round2($prices[$i]*100/(100+$tax_multiplier), $dec);
                                        } else {
-                                         $ret_tax_array[$index]['Value'] += ($prices[$i] * $item_tax['rate'] / 100);
+                                         $ret_tax_array[$index]['Value'] += round2($prices[$i] * $item_tax['rate'] / 100, $dec);
                                          $ret_tax_array[$index]['Net'] += $prices[$i];
                                        }
                                }
                        }
                }
        }
-
        // add the shipping taxes, only if non-zero, and only if tax group taxes shipping
        if ($shipping_cost != 0) 
        {
-               $item_taxes = get_shipping_tax_as_array();
+               $item_taxes = get_shipping_tax_as_array($tax_group);
                if ($item_taxes != null) 
                {
                        if ($tax_included == 1)
@@ -207,14 +222,20 @@ function get_tax_for_items($items, $prices, $shipping_cost, $tax_group, $tax_inc
                                            $ret_tax_array[$index]['Value'] += round2($shipping_cost*$item_tax['rate']/(100+$tax_rate), $dec);
                                            $ret_tax_array[$index]['Net'] += $shipping_net;
                                          } else {
-                                               $ret_tax_array[$index]['Value'] += ($shipping_cost * $item_tax['rate'] / 100);
+                                               $ret_tax_array[$index]['Value'] += round2($shipping_cost * $item_tax['rate'] / 100, $dec);
                                            $ret_tax_array[$index]['Net'] += $shipping_cost;
                                          }
                                }
                        }
                }
        }
-       //print_r($ret_tax_array);
+
+       if ($tax_algorithm == TCA_TOTALS ) {
+               // update taxes with 
+               foreach($ret_tax_array as $index => $item_tax) {
+                       $ret_tax_array[$index]['Value'] = round2($item_tax['Net'] * $item_tax['rate'] / 100, $dec);
+               }
+       }
 
        return $ret_tax_array;
 }
index cac3520b090dc3dff03c2f87afcb0c019597faa7..4e138991efbca8f4bed509f0e1a442a93b08e58a 100644 (file)
@@ -40,29 +40,28 @@ if ($Mode=='ADD_ITEM' || $Mode=='UPDATE_ITEM')
                display_error(_("The tax group name cannot be empty."));
                set_focus('name');
        } 
-
        if ($input_error != 1) 
        {
 
                // create an array of the taxes and array of rates
        $taxes = array();
-       $rates = array();
+       $tax_shippings = array();
 
                while (($id = find_submit('tax_type_id'))!=-1)
                {
                        $taxes[] = $id;
-                       $rates[] = get_tax_type_default_rate($id);
+                       $tax_shippings[] = check_value('tax_shipping'.$id);
                        unset($_POST['tax_type_id' . $id]);
+                       unset($_POST['tax_shipping' . $id]);
                }
        if ($selected_id != -1) 
        {
-                       update_tax_group($selected_id, $_POST['name'], $_POST['tax_shipping'], $taxes, 
-                       $rates);
+                       update_tax_group($selected_id, $_POST['name'], $taxes, $tax_shippings);
                        display_notification(_('Selected tax group has been updated'));
        } 
        else 
        {
-                       add_tax_group($_POST['name'], $_POST['tax_shipping'], $taxes, $rates);
+                       add_tax_group($_POST['name'], $taxes, $tax_shippings);
                        display_notification(_('New tax group has been added'));
        }
 
@@ -111,7 +110,7 @@ if ($Mode == 'RESET')
        $selected_id = -1;
        $sav = get_post('show_inactive');
        unset($_POST);
-       if($sav)
+       if ($sav)
                $_POST['show_inactive'] = $sav;
 }
 //-----------------------------------------------------------------------------------
@@ -121,7 +120,7 @@ $result = get_all_tax_groups(check_value('show_inactive'));
 start_form();
 
 start_table(TABLESTYLE);
-$th = array(_("Description"), _("Shipping Tax"), "", "");
+$th = array(_("Description"), "", "");
 inactive_control_column($th);
 
 table_header($th);
@@ -133,10 +132,6 @@ while ($myrow = db_fetch($result))
        alt_table_row_color($k);
 
        label_cell($myrow["name"]);
-       if ($myrow["tax_shipping"])
-               label_cell(_("Yes"));
-       else
-               label_cell(_("No"));
 
        inactive_control_cell($myrow["id"], $myrow["inactive"], 'tax_groups', 'id');
        edit_button_cell("Edit".$myrow["id"], _("Edit"));
@@ -159,30 +154,47 @@ if ($selected_id != -1)
        $group = get_tax_group($selected_id);
 
        $_POST['name']  = $group["name"];
-       $_POST['tax_shipping'] = $group["tax_shipping"];
 
        }
        hidden('selected_id', $selected_id);
+
 }
 text_row_ex(_("Description:"), 'name', 40);
-yesno_list_row(_("Tax applied to Shipping:"), 'tax_shipping', null, "", "", true);
 
 end_table();
 
 display_note(_("Select the taxes that are included in this group."), 1, 1);
 
-// null means transport tax group, but for new we do not use real rates
 $items = get_tax_group_rates($selected_id!=-1 ? $selected_id : null);
 
-$th = array(_("Tax"), "");
-
 start_table(TABLESTYLE2);
+$th = array(_("Tax"), "", _("Shipping Tax"));
 table_header($th);
 
-while($item = db_fetch_assoc($items)) 
+while($item = db_fetch($items)) 
 {
-       check_row($item['tax_type_name'], 'tax_type_id' . $item['tax_type_id'], 
-               $selected_id!=-1 && isset($item['rate']), "align='center'");
+       start_row();
+       if ($selected_id != -1)
+       {
+               check_cells($item['tax_type_name'], 'tax_type_id' . $item['tax_type_id'], 
+                       isset($item['rate']), true, false, "align='center'");
+               if (isset($item['rate']))
+                       check_cells(null, 'tax_shipping' . $item['tax_type_id'], $item['tax_shipping']);
+       }
+       else
+       {
+               check_cells($item['tax_type_name'], 'tax_type_id' . $item['tax_type_id'], 
+                       null, true, false, "align='center'");
+               if (get_post('_tax_type_id' . $item['tax_type_id'].'_update'))  
+               {
+                       //$_POST['_tax_type_id' . $item['tax_type_id'].'_update'] = 0;
+                       $Ajax->activate('_page_body');
+               }
+               if (check_value('tax_type_id' . $item['tax_type_id'])==1)
+                       check_cells(null, 'tax_shipping' . $item['tax_type_id'], null);
+       }               
+       end_row();      
+       
 }
 
 end_table(1);
diff --git a/themes/aqua/images/closed.png b/themes/aqua/images/closed.png
new file mode 100644 (file)
index 0000000..624c9ed
Binary files /dev/null and b/themes/aqua/images/closed.png differ
diff --git a/themes/cool/images/closed.png b/themes/cool/images/closed.png
new file mode 100644 (file)
index 0000000..624c9ed
Binary files /dev/null and b/themes/cool/images/closed.png differ
diff --git a/themes/default/images/closed.png b/themes/default/images/closed.png
new file mode 100644 (file)
index 0000000..624c9ed
Binary files /dev/null and b/themes/default/images/closed.png differ
index efa23202a2922c5b4f36d5178d4587457272e342..3af13a0ed2c90e66fd6986353990c285d0cd2036 100644 (file)
 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
-<html><head>\r
-       <meta http-equiv="CONTENT-TYPE" content="text/html; charset=iso-8859-2">\r
-       \r
-       <title>FrontAccounting Update</title><meta name="GENERATOR" content="OpenOffice.org 2.4  (Linux)">\r
-       <meta name="CREATED" content="0;0">\r
-       <meta name="CHANGED" content="20100902;19041400"></head>\r
-<body dir="ltr" lang="en-US">\r
-<p style="margin-bottom: 0cm;"><strong><font color="#cc6600"><font style="font-size: 20pt;" size="5"><i>Front</i></font></font></strong><strong><font style="font-size: 20pt;" size="5">Accounting\r
-Update</font></strong></p>\r
-<h2>Important Notes for release 2.3.5.</h2>Change in the behaviour of <span style="font-weight: bold; font-style: italic;">Recurrent Invoices</span>.<br><ul><li>Now\r
-the Last Sent day is stamped with the former Last Sent (or Begin date\r
-the first time) + months + days. Before the Last Sent day was stamped\r
-with tthe creation date (today). The Invoice date is still todays date.\r
-</li><li>If you for some reason want to make a pause in the recurrent\r
-invoices, you can now edit the Last Sent day in the Management section\r
-of Sales tab.</li><li>Before the days value, together with a month\r
-value, decided which day in the month the invoice was due.. &nbsp;This\r
-does not&nbsp;work now. You can&nbsp;change the day in the month you\r
-want the recurrency to happen by setting the Last Sent day with the new\r
-day in the Management section.&nbsp;</li><li>If you create a new Recurrent Invoice the Beginning date can be set to the day in the month you want the recurrencies to be due.</li></ul>\r
-<h2>Important Notes</h2>\r
-<p>Upgrade process can be done only by administrator of the first\r
-company created during FrontAccounting installation. This person is\r
-considered as a site admin who have granted access to potentially\r
-dangerous setup options, like Setup/Software Upgrade.</p>\r
-<p>In the following description sections related to older FA versions are\r
-prefixed with <span style="background: rgb(235, 97, 61) none repeat scroll 0% 50%; -moz-background-clip: initial; -moz-background-origin: initial; -moz-background-inline-policy: initial;">[color tags]</span><span style="background: transparent none repeat scroll 0% 50%; -moz-background-clip: initial; -moz-background-origin: initial; -moz-background-inline-policy: initial;">\r
-. Y</span>ou can skip tagged fragment safely if currently FA\r
-application is newer than the version in tag.</p>\r
-<p>Upgrade process consists of up to four stages, some of them are\r
-optional:</p>\r
-<ol>\r
-       <li><p>Application source files update \r
-       </p>\r
-       </li><li><p>Database upgrade &#8211; this step is needed only during\r
-       upgrade which involves change in major application version number\r
-       (e.g. from 2.2.x to 2.3.x), and sometimes during upgrade from beta\r
-       release to stable version. Otherwise this step can be skipped.</p>\r
-       </li><li><p>Final cleanup &#8211; is needed when some old source files,\r
-       obsoleted by new release should be removed.</p>\r
-       </li><li><p>New features configuration &#8211; this is optional step\r
-       needed for most major releases and some minor ones. \r
-       </p>\r
-</li></ol>\r
-<p style="margin-bottom: 0cm;">Before starting upgrade ensure nobody\r
-is using the application and make database backup for all companies.\r
-To be on safe side backup also old source files, especially those\r
-locally customized (if any).</p>\r
-<p>Log into admin account of first company.<strong> </strong><strong><span style="">If\r
-you use a theme other than the standard 3 (aqua, cool or default),\r
-switch to one of these before going further.</span></strong></p>\r
-<h2><strong><b>1. Application files update</b></strong></h2>\r
-<p style="margin-top: 0.42cm; page-break-after: avoid;"><font face="Liberation Sans, sans-serif"><font size="4"><strong><span style="">a. Source\r
-files update</span></strong></font></font></p>\r
-<p><strong><span style="">Extract distribution\r
-zip/tar.gz file in empty directory, and copy all the files to your\r
-FrontAccounting directory overwriting old files. If it is major\r
-release upgrade you can skip next step and go directly to cleanup.</span></strong></p>\r
-<p style="margin-top: 0.42cm; page-break-after: avoid;"><strong><font face="Liberation Sans, sans-serif"><font size="4"><span style="">b. Configuration\r
-files update</span></font></font></strong></p>\r
-<p><strong><span style="">Compare new\r
-</span></strong><strong><i><b>config.default.php</b></i></strong><strong>\r
-</strong><strong><span style="">file with the old\r
-</span></strong><strong><i><b>config.php </b></i></strong><strong><span style="font-style: normal;"><span style="">and\r
-add all n</span></span></strong><strong><span style="">ew\r
-settings (if any). </span></strong>\r
-</p>\r
-<p><strong><span style=""><span style="background: rgb(235, 97, 61) none repeat scroll 0% 50%; -moz-background-clip: initial; -moz-background-origin: initial; -moz-background-inline-policy: initial;">[&lt;FA\r
-2.2beta]</span></span></strong></p>\r
-<p><strong> <span style="">$show_users_online = 0;</span></strong></p>\r
-<p><strong> <span style="">$def_print_destination\r
-= 0;</span></strong></p>\r
-<p><strong><span style="">$dflt_date_fmt=0;</span></strong></p>\r
-<p><strong><span style="">$dflt_date_sep=0;</span></strong></p>\r
-<p><strong><span style="">$table_style,table_style2\r
-changed</span></strong></p>\r
-<p><strong><span style=""><span style="background: rgb(235, 97, 61) none repeat scroll 0% 50%; -moz-background-clip: initial; -moz-background-origin: initial; -moz-background-inline-policy: initial;">[&lt;FA\r
-2.3beta]</span></span></strong></p>\r
-<p><strong> <span style="">$alternative_tax_include_on_doc=0;</span></strong></p>\r
-<p><strong><span style="">$suppress_tax_rates = 0;</span></strong></p>\r
-<p><strong><span style=""><span style="background: rgb(235, 97, 61) none repeat scroll 0% 50%; -moz-background-clip: initial; -moz-background-origin: initial; -moz-background-inline-policy: initial;">[&lt;FA\r
-2.3RC1]</span></span></strong><strong> </strong>\r
-</p>\r
-<p><strong><span style="">Application version\r
-information and a couple of other private FA variables are stored in\r
-</span></strong><strong><i><b>version.php</b></i></strong><strong>\r
-</strong><strong><span style="">file. The\r
-application version displayed in footer is defined in $version\r
-variable unless this is set in config.php file. If you want current\r
-release version to be displayed on every FA update just remove or\r
-comment out $version variable in </span></strong><strong><span style="font-style: normal;"><span style="">config.php</span></span></strong><strong><span style="">.</span></strong></p>\r
-<p><strong><span style=""><span style="background: rgb(235, 97, 61) none repeat scroll 0% 50%; -moz-background-clip: initial; -moz-background-origin: initial; -moz-background-inline-policy: initial;">[&lt;FA\r
-2.3RC2]</span></span></strong></p>\r
-<p><strong> <span style="">$save_report_selections &nbsp;= 0; &nbsp;// A value &gt; 0 means days to save the report selections.</span></strong></p><p><strong><span style=""><span style="background: rgb(235, 97, 61) none repeat scroll 0% 50%; -moz-background-clip: initial; -moz-background-origin: initial; -moz-background-inline-policy: initial;">[&lt;FA\r
-2.3]</span></span></strong></p><p><strong> <span style="">$save_po_item_codes &nbsp;= 0; &nbsp;//&nbsp; show item codes on purchase order&nbsp;</span></strong></p><p><strong><span style="">$def_print_destination = 0; // &nbsp;default print destination. 0 = PDF/Printer, 1 = Excel</span></strong></p><p><strong><span style="">$alternative_tax_include_on_docs = 0; // &nbsp;1 = print Subtotal tax excluded, tax and Total tax included</span></strong></p><p><strong><span style="">$suppress_tax_rates = 0; // &nbsp;suppress tax rates on documents. 0 = no, 1 = yes.</span></strong></p><strong><span style=""><span style="background: rgb(235, 97, 61) none repeat scroll 0% 50%; -moz-background-clip: initial; -moz-background-origin: initial; -moz-background-inline-policy: initial;"></span></span></strong>\r
-\r
-<strong><span style=""><span style="background: rgb(235, 97, 61) none repeat scroll 0% 50%; -moz-background-clip: initial; -moz-background-origin: initial; -moz-background-inline-policy: initial;"></span></span></strong><h2><strong><b>2. Database upgrade</b></strong></h2>\r
-<p><strong><span style="">This step can be skipped\r
-for small version updates i.e. when you have already installed\r
-FrontAccounting version 2.3.1 or later. Before database upgrade is\r
-done on all company databases backup file is created automatically to\r
-enable database restore after failure.</span></strong></p>\r
-<p><strong><span style="">After major version\r
-upgrade overwriting files in first step makes the system unaccessible\r
-for all users but site admin, who have to run upgrade procedures to\r
-update all company databases to the new version provided with the\r
-release. After logging to administrator account of first installed\r
-company go directly to Setup/Software Upgrade screen, mark all\r
-subsequent 'Install' checkboxes and press 'Upgrade System'.</span></strong></p>\r
-<p style="">If something goes wrong during\r
-upgrade, you can eventually try forced upgrade option. Forced upgrade\r
-ignores some smaller errors which can arise during upgrade due to\r
-some exotic database configuration. This is depreciated option, so\r
-first read error messages if any, try to fix signalized problems,\r
-restore databases from backup and retry normal installation. To run\r
-upgrade in forced mode check box 'Force Upgrade', and press 'Upgrade\r
-System' again.</p>\r
-<h2>3. Final cleanup</h2>\r
-<p>Remove or rename install folder in main FrontAccounting directory.\r
-</p>\r
-<p>After upgrade is installed you can remove files obsoleted by new\r
-FrontAccounting version. Also old, unused settings <span style="font-style: normal;"><span style="">can\r
-be removed from  </span></span><i><b>config.php</b></i><span style="font-style: normal;"><span style="">\r
-file.</span></span></p>\r
-<p style="margin-top: 0.42cm; page-break-after: avoid;"><font face="Liberation Sans, sans-serif"><font size="4">a.\r
-Source files cleanup</font></font></p>\r
-<p><strong><span style=""><span style="background: rgb(235, 97, 61) none repeat scroll 0% 50%; -moz-background-clip: initial; -moz-background-origin: initial; -moz-background-inline-policy: initial;">[&lt;FA\r
-2.2beta]</span></span></strong></p>\r
-<p><strong><span style=""><span style="background: transparent none repeat scroll 0% 50%; -moz-background-clip: initial; -moz-background-origin: initial; -moz-background-inline-policy: initial;">/includes/reserved.inc\r
-&#8211; removed.</span></span></strong></p>\r
-<p><strong><span style=""><span style="background: rgb(235, 97, 61) none repeat scroll 0% 50%; -moz-background-clip: initial; -moz-background-origin: initial; -moz-background-inline-policy: initial;">[&lt;FA\r
-2.1]</span></span></strong><strong> </strong>\r
-</p>\r
-<p><strong><span style="">/admin/db/v_banktrans.inc\r
-- removed</span></strong></p>\r
-<p style="margin-top: 0.42cm; page-break-after: avoid;"><font face="Liberation Sans, sans-serif"><font size="4"><span style="font-style: normal;"><span style="">b.\r
-Config.php cleanup </span></span></font></font>\r
-</p>\r
-<p><strong><span style=""><span style="background: rgb(235, 97, 61) none repeat scroll 0% 50%; -moz-background-clip: initial; -moz-background-origin: initial; -moz-background-inline-policy: initial;">[&lt;FA\r
-2.2RC1]</span></span></strong><strong> </strong>\r
-</p>\r
-<p><strong><span style="">$security_headings,\r
-$security_groups arrays &#8211; moved to database (see Access Setup) \r
-</span></strong>\r
-</p>\r
-<p><strong><span style="">$def_app &#8211; moved\r
-to user configuration in database.</span></strong></p>\r
-<p><strong><span style="font-style: normal;"><span style="">$version\r
-&#8211; moved to </span></span></strong><strong><i><b>version.php</b></i></strong><strong><span style="font-style: normal;"><span style="">\r
-file. Remove</span></span></strong></p>\r
-<h2>4. New features configuration</h2>\r
-<p>During upgrade process new features are initialized to default\r
-status, and sometimes old settings are also changed to conform with\r
-new security policy. This automatic process is designed to be as\r
-neutral for end users as possible, however sometimes site or company\r
-admin intervention can be necessary to set thing after changes to\r
-their best state. Below you will find description of new settings\r
-available after upgrade.</p>\r
-<p><br><br>\r
-</p>\r
-<p>----------------------</p>\r
-<ul></ul>\r
+<html><head>
+       <meta http-equiv="CONTENT-TYPE" content="text/html; charset=iso-8859-2">
+       
+       <title>FrontAccounting Update</title><meta name="GENERATOR" content="OpenOffice.org 2.4  (Linux)">
+       <meta name="CREATED" content="0;0">
+       <meta name="CHANGED" content="20100902;19041400"></head>
+<body dir="ltr" lang="en-US">
+<p style="margin-bottom: 0cm;"><strong><font color="#cc6600"><font style="font-size: 20pt;" size="5"><i>Front</i></font></font></strong><strong><font style="font-size: 20pt;" size="5">Accounting
+Update</font></strong></p>
+<h2>Important Notes for release 2.3.5.</h2>Change in the behaviour of <span style="font-weight: bold; font-style: italic;">Recurrent Invoices</span>.<br><ul><li>Now
+the Last Sent day is stamped with the former Last Sent (or Begin date
+the first time) + months + days. Before the Last Sent day was stamped
+with tthe creation date (today). The Invoice date is still todays date.
+</li><li>If you for some reason want to make a pause in the recurrent
+invoices, you can now edit the Last Sent day in the Management section
+of Sales tab.</li><li>Before the days value, together with a month
+value, decided which day in the month the invoice was due.. &nbsp;This
+does not&nbsp;work now. You can&nbsp;change the day in the month you
+want the recurrency to happen by setting the Last Sent day with the new
+day in the Management section.&nbsp;</li><li>If you create a new Recurrent Invoice the Beginning date can be set to the day in the month you want the recurrencies to be due.</li></ul>
+<h2>Important Notes</h2>
+<p>Upgrade process can be done only by administrator of the first
+company created during FrontAccounting installation. This person is
+considered as a site admin who have granted access to potentially
+dangerous setup options, like Setup/Software Upgrade.</p>
+<p>In the following description sections related to older FA versions are
+prefixed with <span style="background: rgb(235, 97, 61) none repeat scroll 0% 50%; -moz-background-clip: initial; -moz-background-origin: initial; -moz-background-inline-policy: initial;">[color tags]</span><span style="background: transparent none repeat scroll 0% 50%; -moz-background-clip: initial; -moz-background-origin: initial; -moz-background-inline-policy: initial;">
+. Y</span>ou can skip tagged fragment safely if currently FA
+application is newer than the version in tag.</p>
+<p>Upgrade process consists of up to four stages, some of them are
+optional:</p>
+<ol>
+       <li><p>Application source files update 
+       </p>
+       </li><li><p>Database upgrade &#8211; this step is needed only during
+       upgrade which involves change in major application version number
+       (e.g. from 2.2.x to 2.3.x), and sometimes during upgrade from beta
+       release to stable version. Otherwise this step can be skipped.</p>
+       </li><li><p>Final cleanup &#8211; is needed when some old source files,
+       obsoleted by new release should be removed.</p>
+       </li><li><p>New features configuration &#8211; this is optional step
+       needed for most major releases and some minor ones. 
+       </p>
+</li></ol>
+<p style="margin-bottom: 0cm;">Before starting upgrade ensure nobody
+is using the application and make database backup for all companies.
+To be on safe side backup also old source files, especially those
+locally customized (if any).</p>
+<p>Log into admin account of first company.<strong> </strong><strong><span style="">If
+you use a theme other than the standard 3 (aqua, cool or default),
+switch to one of these before going further.</span></strong></p>
+<h2><strong><b>1. Application files update</b></strong></h2>
+<p style="margin-top: 0.42cm; page-break-after: avoid;"><font face="Liberation Sans, sans-serif"><font size="4"><strong><span style="">a. Source
+files update</span></strong></font></font></p>
+<p><strong><span style="">Extract distribution
+zip/tar.gz file in empty directory, and copy all the files to your
+FrontAccounting directory overwriting old files. If it is major
+release upgrade you can skip next step and go directly to cleanup.</span></strong></p>
+<p style="margin-top: 0.42cm; page-break-after: avoid;"><strong><font face="Liberation Sans, sans-serif"><font size="4"><span style="">b. Configuration
+files update</span></font></font></strong></p>
+<p><strong><span style="">Compare new
+</span></strong><strong><i><b>config.default.php</b></i></strong><strong>
+</strong><strong><span style="">file with the old
+</span></strong><strong><i><b>config.php </b></i></strong><strong><span style="font-style: normal;"><span style="">and
+add all n</span></span></strong><strong><span style="">ew
+settings (if any). </span></strong>
+</p>
+<p><strong><span style=""><span style="background: rgb(235, 97, 61) none repeat scroll 0% 50%; -moz-background-clip: initial; -moz-background-origin: initial; -moz-background-inline-policy: initial;">[&lt;FA
+2.2beta]</span></span></strong></p>
+<p><strong> <span style="">$show_users_online = 0;</span></strong></p>
+<p><strong> <span style="">$def_print_destination
+= 0;</span></strong></p>
+<p><strong><span style="">$dflt_date_fmt=0;</span></strong></p>
+<p><strong><span style="">$dflt_date_sep=0;</span></strong></p>
+<p><strong><span style="">$table_style,table_style2
+changed</span></strong></p>
+<p><strong><span style=""><span style="background: rgb(235, 97, 61) none repeat scroll 0% 50%; -moz-background-clip: initial; -moz-background-origin: initial; -moz-background-inline-policy: initial;">[&lt;FA
+2.3beta]</span></span></strong></p>
+<p><strong> <span style="">$alternative_tax_include_on_doc=0;</span></strong></p>
+<p><strong><span style="">$suppress_tax_rates = 0;</span></strong></p>
+<p><strong><span style=""><span style="background: rgb(235, 97, 61) none repeat scroll 0% 50%; -moz-background-clip: initial; -moz-background-origin: initial; -moz-background-inline-policy: initial;">[&lt;FA
+2.3RC1]</span></span></strong><strong> </strong>
+</p>
+<p><strong><span style="">Application version
+information and a couple of other private FA variables are stored in
+</span></strong><strong><i><b>version.php</b></i></strong><strong>
+</strong><strong><span style="">file. The
+application version displayed in footer is defined in $version
+variable unless this is set in config.php file. If you want current
+release version to be displayed on every FA update just remove or
+comment out $version variable in </span></strong><strong><span style="font-style: normal;"><span style="">config.php</span></span></strong><strong><span style="">.</span></strong></p>
+<p><strong><span style=""><span style="background: rgb(235, 97, 61) none repeat scroll 0% 50%; -moz-background-clip: initial; -moz-background-origin: initial; -moz-background-inline-policy: initial;">[&lt;FA
+2.3RC2]</span></span></strong></p>
+<p><strong> <span style="">$save_report_selections &nbsp;= 0; &nbsp;// A value &gt; 0 means days to save the report selections.</span></strong></p><p><strong><span style=""><span style="background: rgb(235, 97, 61) none repeat scroll 0% 50%; -moz-background-clip: initial; -moz-background-origin: initial; -moz-background-inline-policy: initial;">[&lt;FA
+2.3]</span></span></strong></p><p><strong> <span style="">$save_po_item_codes &nbsp;= 0; &nbsp;//&nbsp; show item codes on purchase order&nbsp;</span></strong></p><p><strong><span style="">$def_print_destination = 0; // &nbsp;default print destination. 0 = PDF/Printer, 1 = Excel</span></strong></p><p><strong><span style="">$alternative_tax_include_on_docs = 0; // &nbsp;1 = print Subtotal tax excluded, tax and Total tax included</span></strong></p><p><strong><span style="">$suppress_tax_rates = 0; // &nbsp;suppress tax rates on documents. 0 = no, 1 = yes.</span></strong></p><strong><span style=""><span style="background: rgb(235, 97, 61) none repeat scroll 0% 50%; -moz-background-clip: initial; -moz-background-origin: initial; -moz-background-inline-policy: initial;"></span></span></strong>
+
+<strong><span style=""><span style="background: rgb(235, 97, 61) none repeat scroll 0% 50%; -moz-background-clip: initial; -moz-background-origin: initial; -moz-background-inline-policy: initial;"></span></span></strong><h2><strong><b>2. Database upgrade</b></strong></h2>
+<p><strong><span style="">This step can be skipped
+for small version updates i.e. when you have already installed
+FrontAccounting version 2.3.1 or later. Before database upgrade is
+done on all company databases backup file is created automatically to
+enable database restore after failure.</span></strong></p>
+<p><strong><span style="">After major version
+upgrade overwriting files in first step makes the system unaccessible
+for all users but site admin, who have to run upgrade procedures to
+update all company databases to the new version provided with the
+release. After logging to administrator account of first installed
+company go directly to Setup/Software Upgrade screen, mark all
+subsequent 'Install' checkboxes and press 'Upgrade System'.</span></strong></p>
+<p style="">If something goes wrong during
+upgrade, you can eventually try forced upgrade option. Forced upgrade
+ignores some smaller errors which can arise during upgrade due to
+some exotic database configuration. This is depreciated option, so
+first read error messages if any, try to fix signalized problems,
+restore databases from backup and retry normal installation. To run
+upgrade in forced mode check box 'Force Upgrade', and press 'Upgrade
+System' again.</p>
+<h2>3. Final cleanup</h2>
+<p>Remove or rename install folder in main FrontAccounting directory.
+</p>
+<p>After upgrade is installed you can remove files obsoleted by new
+FrontAccounting version. Also old, unused settings <span style="font-style: normal;"><span style="">can
+be removed from  </span></span><i><b>config.php</b></i><span style="font-style: normal;"><span style="">
+file.</span></span></p>
+<p style="margin-top: 0.42cm; page-break-after: avoid;"><font face="Liberation Sans, sans-serif"><font size="4">a.
+Source files cleanup</font></font></p>
+<p><strong><span style=""><span style="background: rgb(235, 97, 61) none repeat scroll 0% 50%; -moz-background-clip: initial; -moz-background-origin: initial; -moz-background-inline-policy: initial;">[&lt;FA
+2.2beta]</span></span></strong></p>
+<p><strong><span style=""><span style="background: transparent none repeat scroll 0% 50%; -moz-background-clip: initial; -moz-background-origin: initial; -moz-background-inline-policy: initial;">/includes/reserved.inc
+&#8211; removed.</span></span></strong></p>
+<p><strong><span style=""><span style="background: rgb(235, 97, 61) none repeat scroll 0% 50%; -moz-background-clip: initial; -moz-background-origin: initial; -moz-background-inline-policy: initial;">[&lt;FA
+2.1]</span></span></strong><strong> </strong>
+</p>
+<p><strong><span style="">/admin/db/v_banktrans.inc
+- removed</span></strong></p>
+<p style="margin-top: 0.42cm; page-break-after: avoid;"><font face="Liberation Sans, sans-serif"><font size="4"><span style="font-style: normal;"><span style="">b.
+Config.php cleanup </span></span></font></font>
+</p>
+<p><strong><span style=""><span style="background: rgb(235, 97, 61) none repeat scroll 0% 50%; -moz-background-clip: initial; -moz-background-origin: initial; -moz-background-inline-policy: initial;">[&lt;FA
+2.2RC1]</span></span></strong><strong> </strong>
+</p>
+<p><strong><span style="">$security_headings,
+$security_groups arrays &#8211; moved to database (see Access Setup) 
+</span></strong>
+</p>
+<p><strong><span style="">$def_app &#8211; moved
+to user configuration in database.</span></strong></p>
+<p><strong><span style="font-style: normal;"><span style="">$version
+&#8211; moved to </span></span></strong><strong><i><b>version.php</b></i></strong><strong><span style="font-style: normal;"><span style="">
+file. Remove</span></span></strong></p>
+<h2>4. New features configuration</h2>
+<p>During upgrade process new features are initialized to default
+status, and sometimes old settings are also changed to conform with
+new security policy. This automatic process is designed to be as
+neutral for end users as possible, however sometimes site or company
+admin intervention can be necessary to set thing after changes to
+their best state. Below you will find description of new settings
+available after upgrade.</p>
+<p><br><br>
+</p>
+<p>----------------------</p>
+<ul></ul>
 </body></html>
\ No newline at end of file
index 8c86a3cc72780e7d05882498df33f9a0e2a4e930..1b3db02e8fdeb9893cfaaaeaad54a738f401149a 100644 (file)
@@ -9,7 +9,7 @@ $db_version = "2.3rc";
 
 // application version - can be overriden in config.php
 if (!isset($version))
-       $version                = "2.3.10";
+       $version                = "2.4 alpha";
 
 //======================================================================
 // Extension packages repository settings