Merged changes form main trunk up to 2.2.4
authorJanusz Dobrowolski <janusz@frontaccounting.eu>
Wed, 20 Jan 2010 11:23:31 +0000 (11:23 +0000)
committerJanusz Dobrowolski <janusz@frontaccounting.eu>
Wed, 20 Jan 2010 11:23:31 +0000 (11:23 +0000)
22 files changed:
CHANGELOG.txt
admin/create_coy.php
config.default.php
gl/manage/gl_account_types.php
includes/data_checks.inc
includes/errors.inc
includes/main.inc
includes/page/footer.inc
includes/ui/ui_input.inc
includes/ui/ui_view.inc
inventory/cost_update.php
inventory/includes/item_adjustments_ui.inc
inventory/manage/sales_kits.php
inventory/view/view_adjustment.php
manufacturing/includes/db/work_orders_db.inc
purchasing/includes/db/grn_db.inc
purchasing/includes/db/invoice_db.inc
sales/includes/sales_db.inc
sales/manage/sales_points.php
sql/en_US-new.sql
taxes/item_tax_types.php
update.html

index 8d71f2ef6d7f621a75fd2cc111cc8fe76e7d483a..367afd8f54b6a57c78f77b596c40eb07a64d6191 100644 (file)
@@ -19,6 +19,65 @@ Legend:
 ! -> Note
 $ -> Affected files
 
+
+20-Jan-2010 Merged changes from main trunk 2.2.3-2.2.4 as follows
+------------------------------- Release 2.2.4 ----------------------------------
+17-Jan-2010 Joe Hunt
+! Release 2.2.4
+$ $config.default.php
+  update.html
+
+17-Jan-2010 Janusz Dobrowolski
+! Improved error checking.in company update/creation.
+$ /admin/create_coy.php
+# Fixed default value for stock_category.dflt_tax_type
+$ /sql/en_US-new.sql
+# Fixed errors display in ajax mode.
+$ /includes/errors.inc
+# Fixed checks for deleting POS
+$ /sales/manage/sales_points.php
+
+15-Jan-2010 Janusz Dobrowolski
+! Changed so GL Account Types id allows up to 10 digits.
+$ /gl/manage/gl_account_types.php
+# [0000187] Category and description reset after failed check;
+$ /inventory/manage/sales_kits.php
+# Cleaned warnings in errorlog.
+$ /sales/includes/sales_db.inc
+! Default 0 on empty amount fields
+$ /includes/data_checks.inc
+! Empty numeric input fields globaly defaulted to 0.
+$ /includes/data_checks.inc
+  /includes/ui/ui_input.inc
+
+15-Jan-2010 Joe Hunt
+# [0000190] Back link on confirmation only pages removed.
+$ /includes/page/footer.inc
+  /includes/ui/ui_view.inc
+  /includes/main.inc
+# Removed a comma after last item in structure for 0_tax_types, line 1596
+$ /sql/en_US-new.sql
+
+14-Jan-2010 Joe Hunt
+# A couple of small bugs were fixed in average material cost
+$ /purchasing/includes/db/grn_db.inc
+  /purchasing/includes/db/invoice_db.inc
+  /manufacturing/includes/db/work_orders_db.inc
+
+13-Jan-2010 Joe Hunt
+! Changed so also Item Adjustment and Cost Update allow more than 2 dec in price
+$ /inventory/cost_update.php
+  /inventory/includes/item_adjustments_ui.inc
+  /inventory/view/view_adjustment.php
+! Changed so GL Account Types id allows up to 6 digits.
+$ /gl/manage/gl_account_types.php
+  
+12-Jan-2010 Janusz Dobrowolski
+# Fixed buggy exemptions display
+$ /taxes/item_tax_types.php
+
+---------- End of changes from main trunk 2.2.3-2.2.4
+
 12-Jan-2010 Janusz Dobrowolski
 ! Added sorting by branch_ref
 $ /sales/includes/db/branches_db.inc
index 6667ea451e85da955df725451a9f3ab917642748..4a5f921de100d827de202a64b08ee076294dfa22 100644 (file)
@@ -83,7 +83,7 @@ function handle_submit()
            $comp_path, $comp_subdirs;
 
        $new = false;
-
+       $error = false;
        if (!check_data())
                return false;
 
@@ -115,25 +115,30 @@ function handle_submit()
                if (($db = db_create_db($conn)) == 0)
                {
                        display_error(_("Error creating Database: ") . $conn['dbname'] . _(", Please create it manually"));
-                       remove_connection($id);
-                       set_global_connection();
-                       return false;
-               }
+                       $error = true;
+               } else {
 
-               $filename = $_FILES['uploadfile']['tmp_name'];
-               if (is_uploaded_file ($filename))
-               {
-                       db_import($filename, $conn, $id);
-                       if (isset($_POST['admpassword']) && $_POST['admpassword'] != "")        
-                               update_admin_password($conn, md5($_POST['admpassword']));
+                       $filename = $_FILES['uploadfile']['tmp_name'];
+                       if (is_uploaded_file ($filename))
+                       {
+                               if (!db_import($filename, $conn, $id)) {
+                                       display_error(_('Cannot create new company due to bugs in sql file.'));
+                                       $error = true;
+                               } else
+                               if (isset($_POST['admpassword']) && $_POST['admpassword'] != "")
+                                       update_admin_password($conn, md5($_POST['admpassword']));
+                       }
+                       else
+                       {
+                               display_error(_("Error uploading Database Script, please upload it manually"));
+                               $error = true;
+                       }
                }
-               else
-               {
-                       display_error(_("Error uploading Database Script, please upload it manually"));
-                       set_global_connection();
+               set_global_connection();
+               if ($error) {
+                       remove_connection($id);
                        return false;
                }
-               set_global_connection();
        }
        $error = write_config_db($new);
        if ($error == -1)
@@ -153,6 +158,7 @@ function handle_submit()
        }
        $exts = get_company_extensions();
        write_extensions($exts, $id);
+       display_notification($new ? _('New company has been created.') : _('Company has been updated.'));
        return true;
 }
 
@@ -218,8 +224,7 @@ function handle_delete()
                display_error(_("Cannot remove temporary renamed company data directory ") . $tmpname);
                return;
        }
-
-       meta_forward($_SERVER['PHP_SELF']);
+       display_notification(_("Selected company as been deleted"));
 }
 
 //---------------------------------------------------------------------------------------------
@@ -359,19 +364,14 @@ function display_company_edit($selected_id)
 
 //---------------------------------------------------------------------------------------------
 
-if (isset($_GET['c']) && $_GET['c'] == 'df')
-{
-
+if (isset($_GET['c']) && $_GET['c'] == 'df') {
        handle_delete();
+       $selected_id = -1;
 }
 
 if (isset($_GET['c']) && $_GET['c'] == 'u')
-{
        if (handle_submit())
-       {
-               meta_forward($_SERVER['PHP_SELF']);
-       }
-}
+               $selected_id = -1;
 
 
 //---------------------------------------------------------------------------------------------
index 17fb66d7d8dbb05c71959236951d9c199bf3eb3d..dda1474e7ecf122efeb9f2705c13753ba4a70f43 100644 (file)
@@ -56,7 +56,7 @@ if (!isset($path_to_root) || isset($_GET['path_to_root']) || isset($_POST['path_
        // Main Title
        $app_title = "FrontAccounting";
        // application version
-       $version                = "2.3 CVS (m3)";
+       $version                = "2.3 CVS (m4)";
 
        // Build for development purposes
        $build_version  = date("d.m.Y", filemtime("$path_to_root/CHANGELOG.txt"));
index 8efa766e7e05b2c2b1b45dc1e2f0b22d3e69b459..57ab4a65730ca161b8a1462ed5d20962dcc84d4c 100644 (file)
@@ -174,7 +174,7 @@ if ($selected_id != -1)
        label_row(_("ID:"), $_POST['id']);
 }
 else
-       text_row_ex(_("ID:"), 'id', 4);
+       text_row_ex(_("ID:"), 'id', 10);
 text_row_ex(_("Name:"), 'name', 50);
 
 gl_account_types_list_row(_("Subgroup Of:"), 'parent', null, _("None"), true);
index 9589f13c9e60d181db3d8b3abef14017c0690969..ff316953030d9c322fea21c2a7e3aced11717340 100644 (file)
@@ -470,11 +470,12 @@ function check_int($postname, $min=null, $max=null) {
 //
 //     Numeric input check.
 //     Return 1 if number has proper form and is within <min, max> range
+//     Empty/not defined fields are defaulted to $dflt value.
 //
-function check_num($postname, $min=null, $max=null) {
+function check_num($postname, $min=null, $max=null, $dflt=0) {
        if(!isset($_POST[$postname]))
          return 0;
-    $num = input_num($postname);
+    $num = input_num($postname, $dflt);
     if ($num === false || $num === null) 
          return 0;
     if (isset($min) && ($num<$min)) 
index a9b68898498fb0e4f9854e678ad155b86a3bfa57..500d7e606ada7e1eb0020d996d1c39e313e2af74 100644 (file)
@@ -94,7 +94,12 @@ function error_box() {
        Helper to avoid sparse log notices.
 */
 function end_flush () {
-               if (ob_get_level()) ob_end_flush();
+       global $Ajax;
+
+       if (isset($Ajax))
+               $Ajax->run();
+
+       if (ob_get_level()) ob_end_flush();
 }
 
 function display_db_error($msg, $sql_statement=null, $exit=true)
index b0878fb5004450b941b39fe611ad9fa81b2ef3d9..138ae369a53eca55ad3cb3fd76ffbf73bcff3f96 100644 (file)
@@ -48,13 +48,13 @@ function page($title, $no_menu=false, $is_index=false, $onload="", $js="", $scri
        }
 }
 
-function end_page($no_menu=false, $is_index=false)
+function end_page($no_menu=false, $is_index=false, $hide_back_link=false)
 {
        global $path_to_root, $Ajax;
        $hide_menu = $no_menu;
                div_end();      // _page_body section
        include($path_to_root . "/includes/page/footer.inc");
-       page_footer($no_menu, $is_index);
+       page_footer($no_menu, $is_index, $hide_back_link);
 }
 
 function flush_dir($path, $wipe = false) 
index 90c951c19bb46e60327b4bf3c8ac5831056c93b1..e07f69838a5b900b126c5fc739b37eae7c9cae48 100644 (file)
@@ -9,11 +9,11 @@
     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
     See the License here <http://www.gnu.org/licenses/gpl-3.0.html>.
 ***********************************************************************/
-function page_footer($no_menu=false, $is_index=false)
+function page_footer($no_menu=false, $is_index=false, $hide_back_link=false)
 {
        global $path_to_root, $js_lib, $Validate, $Editors, $Ajax;
 
-       if (!$is_index && function_exists('hyperlink_back'))
+       if (!$is_index && !$hide_back_link && function_exists('hyperlink_back'))
                hyperlink_back();
        include_once($path_to_root."/themes/".user_theme()."/renderer.php");
        $rend = new renderer();
index b2a49e2b90a447cdb5848382d2f922ccd0ac205e..b27f5fde11ae787a486fc4fa73ecce2556dca591 100644 (file)
@@ -75,7 +75,7 @@ function simple_page_mode($numeric_id = true)
 //
 //     Read numeric value from user formatted input
 //
-function input_num($postname=null, $dflt=null)
+function input_num($postname=null, $dflt=0)
 {
        if (!isset($_POST[$postname]) || $_POST[$postname] == "")
                return $dflt;
index 9b51ce3f64c972da290168dd5afa9024b2c5f150..8e2591c3a9328ae619354dfa38a25e2e2e361369 100644 (file)
@@ -432,7 +432,7 @@ function display_edit_tax_items($taxes, $columns, $tax_included, $leftspan=0)
 function display_footer_exit()
 {
        br(2);
-       end_page();
+       end_page(false, false, true);
        exit;
 }
 
index 2ce775fc66c439681abba877375a998e465d954a..088cad5853bf0ee75fbe32fb7653103375a685b0 100644 (file)
@@ -103,20 +103,16 @@ hidden("OldLabourCost", $myrow["labour_cost"]);
 hidden("OldOverheadCost", $myrow["overhead_cost"]);
 
 start_table($table_style2);
+$dec1 = $dec2 = $dec3 = 0;
+$_POST['material_cost'] = price_decimal_format($myrow["material_cost"], $dec1);
+$_POST['labour_cost'] = price_decimal_format($myrow["labour_cost"], $dec2);
+$_POST['overhead_cost'] = price_decimal_format($myrow["overhead_cost"], $dec3);
 
-$_POST['material_cost'] = price_format($myrow["material_cost"]);
-$_POST['labour_cost'] = price_format($myrow["labour_cost"]);
-$_POST['overhead_cost'] = price_format($myrow["overhead_cost"]);
-
-amount_row(_("Standard Material Cost Per Unit"), "material_cost",
-       null, "class='tableheader2'");
-
+amount_row(_("Standard Material Cost Per Unit"), "material_cost", null, "class='tableheader2'", null, $dec1);
 if ($myrow["mb_flag"]=='M')
 {
-       amount_row(_("Standard Labour Cost Per Unit"), "labour_cost",
-               null, "class='tableheader2'");
-       amount_row(_("Standard Overhead Cost Per Unit"), "overhead_cost",
-               null, "class='tableheader2'");
+       amount_row(_("Standard Labour Cost Per Unit"), "labour_cost", null, "class='tableheader2'", null, $dec2);
+       amount_row(_("Standard Overhead Cost Per Unit"), "overhead_cost", null, "class='tableheader2'", null, $dec3);
 }
 else
 {
index 7b67cca306a7fe7f90fb939aa466a281c421646a..cfe697fa1c30efd813e678766ed6efd38d39c7fe 100644 (file)
@@ -81,7 +81,7 @@ function display_adjustment_items($title, &$order)
                        label_cell($stock_item->item_description);
                qty_cell($stock_item->quantity, false, get_qty_dec($stock_item->stock_id));
                        label_cell($stock_item->units);
-                       amount_cell($stock_item->standard_cost);
+                       amount_decimal_cell($stock_item->standard_cost);
                        amount_cell($stock_item->standard_cost * $stock_item->quantity);
 
                        edit_button_cell("Edit$line_no", _("Edit"),
@@ -112,13 +112,15 @@ function adjustment_edit_item_controls(&$order, $line_no=-1)
        global $Ajax;
        start_row();
 
+       $dec2 = 0;
        $id = find_submit('Edit');
        if ($line_no != -1 && $line_no == $id)
        {
                $_POST['stock_id'] = $order->line_items[$id]->stock_id;
                $_POST['qty'] = qty_format($order->line_items[$id]->quantity, 
                        $order->line_items[$id]->stock_id, $dec);
-               $_POST['std_cost'] = price_format($order->line_items[$id]->standard_cost);
+               //$_POST['std_cost'] = price_format($order->line_items[$id]->standard_cost);
+               $_POST['std_cost'] = price_decimal_format($order->line_items[$id]->standard_cost, $dec2);
                $_POST['units'] = $order->line_items[$id]->units;
 
                hidden('stock_id', $_POST['stock_id']);
@@ -138,14 +140,16 @@ function adjustment_edit_item_controls(&$order, $line_no=-1)
        $item_info = get_item_edit_info($_POST['stock_id']);
                $dec = $item_info['decimals'];
                $_POST['qty'] = number_format2(0, $dec);
-               $_POST['std_cost'] = price_format($item_info["standard_cost"]);
+               //$_POST['std_cost'] = price_format($item_info["standard_cost"]);
+               $_POST['std_cost'] = price_decimal_format($item_info["standard_cost"], $dec2);
                $_POST['units'] = $item_info["units"];
        }
 
        qty_cells(null, 'qty', $_POST['qty'], null, null, $dec);
        label_cell($_POST['units'], '', 'units');
 
-       amount_cells(null, 'std_cost', $_POST['std_cost']);
+       //amount_cells(null, 'std_cost', $_POST['std_cost']);
+       amount_cells(null, 'std_cost', null, null, null, $dec2);
        label_cell("&nbsp;");
 
        if ($id != -1)
index 005af381f9d9418587d62e0bf08dffb72d4a9c27..16a78f87bc2fde77d9a04353b7a6c7cfbc284a57 100644 (file)
@@ -200,7 +200,8 @@ if (get_post('item_code') == '') {
        start_table($table_style2);
        text_row(_("Alias/kit code:"), 'kit_code', null, 20, 21);
 } else
-{ // Kit selected so display bom or edit component
+{
+        // Kit selected so display bom or edit component
        $_POST['description'] = $props['description'];
        $_POST['category'] = $props['category_id'];
        start_table($table_style2);
@@ -226,8 +227,10 @@ if (get_post('item_code') == '') {
 //     if (get_post('description') == '')
 //             $_POST['description'] = get_kit_name($_POST['component']);
        if (get_post('item_code') == '') { // new kit/alias
-               $_POST['description'] = $props['description'];
-               $_POST['category'] = $props['category_id'];
+               if ($Mode!='ADD_ITEM' && $Mode!='UPDATE_ITEM') {
+                       $_POST['description'] = $props['description'];
+                       $_POST['category'] = $props['category_id'];
+               }
                text_row(_("Description:"), 'description', null, 50, 200);
                stock_categories_list_row(_("Category:"), 'category', null);
        }
index 6bc5076480c97ef9bde002211158b9c477aad29a..953e6018e1eab816910ca14c8fe1e9c9b26a4b4d 100644 (file)
@@ -64,7 +64,7 @@ while ($adjustment = db_fetch($adjustment_items))
     label_cell($adjustment['description']);
     qty_cell($adjustment['qty'], false, get_qty_dec($adjustment['stock_id']));
     label_cell($adjustment['units']);
-    amount_cell($adjustment['standard_cost']);
+    amount_decimal_cell($adjustment['standard_cost']);
     end_row();
 }
 
index 7e8be6487754d9ff4a5f208070173236fb52bc5c..c06994ee92c78f7f773263f97d86004514284cbe 100644 (file)
@@ -20,6 +20,8 @@ function add_material_cost($stock_id, $qty, $date_)
                $standard_cost = get_standard_cost($bom_item['component']);
                $m_cost += ($bom_item['quantity'] * $standard_cost);
        }
+       $dec = user_price_dec();
+       $m_cost = 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);
@@ -30,6 +32,7 @@ function add_material_cost($stock_id, $qty, $date_)
                $material_cost = 0;
        else
                $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");
@@ -37,6 +40,8 @@ function add_material_cost($stock_id, $qty, $date_)
 
 function add_overhead_cost($stock_id, $qty, $date_, $costs)
 {
+       $dec = user_price_dec();
+       $costs = price_decimal_format($costs, $dec); 
        if ($qty != 0)
                $costs /= $qty;
        $sql = "SELECT overhead_cost FROM ".TB_PREF."stock_master WHERE stock_id = "
@@ -49,6 +54,7 @@ function add_overhead_cost($stock_id, $qty, $date_, $costs)
                $overhead_cost = 0;
        else
                $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");
@@ -56,6 +62,8 @@ function add_overhead_cost($stock_id, $qty, $date_, $costs)
 
 function add_labour_cost($stock_id, $qty, $date_, $costs)
 {
+       $dec = user_price_dec();
+       $costs = price_decimal_format($costs, $dec); 
        if ($qty != 0)
                $costs /= $qty;
        $sql = "SELECT labour_cost FROM ".TB_PREF."stock_master WHERE stock_id = "
@@ -68,6 +76,7 @@ function add_labour_cost($stock_id, $qty, $date_, $costs)
                $labour_cost = 0;
        else
                $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");
@@ -82,11 +91,14 @@ function add_issue_cost($stock_id, $qty, $date_, $costs)
        $result = db_query($sql);
        $myrow = db_fetch($result);
        $material_cost =  $myrow['material_cost'];
+       $dec = user_price_dec();
+       $material_cost = price_decimal_format($material_cost, $dec); 
        $qoh = get_qoh_on_date($stock_id, null, $date_);
        if ($qoh + $qty  <= 0)
                $material_cost = 0;
        else
                $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);
index 84a2f938ad83de9ecb9eeddf6fbefe2484ffa6e0..b055c1f94eb8b14a955b9f8afa302d9eaf04303a 100644 (file)
@@ -17,20 +17,27 @@ function update_average_material_cost($supplier, $stock_id, $price, $qty, $date,
                $currency = get_supplier_currency($supplier);
        else
                $currency = null;
+       $dec = user_price_dec();
+       $price = price_decimal_format($price, $dec);
        if ($currency != null)
-               $price_in_home_currency = to_home_currency($price, $currency, $date);
+       {
+               $ex_rate = get_exchange_rate_to_home_currency($currency, $date_);
+               $price_in_home_currency = $price / $ex_rate;
+               //$price_in_home_currency = to_home_currency($price, $currency, $date);
+       }       
        else
                $price_in_home_currency = $price;
        $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'];
+       if ($price > -0.0001 && $price < 0.0001)
+               return $material_cost;
        if ($adj_only)
                $exclude = ST_CUSTDELIVERY;
        else
                $exclude = 0;
        $qoh = get_qoh_on_date($stock_id, null, $date, $exclude);
-
        if ($adj_only)
        {
                if ($qoh <= 0)
@@ -41,7 +48,12 @@ function update_average_material_cost($supplier, $stock_id, $price, $qty, $date,
        elseif ($qoh + $qty <= 0)
                $material_cost = 0;
        else
+       {
+               if ($qoh < 0)
+                       $qoh = 0;
                $material_cost = ($qoh * $material_cost + $qty * $price_in_home_currency) /     ($qoh + $qty);
+       }       
+       $material_cost = round2($material_cost, $dec);
 
        $sql = "UPDATE ".TB_PREF."stock_master SET material_cost=".db_escape($material_cost)."
                WHERE stock_id=".db_escape($stock_id);
@@ -66,7 +78,6 @@ function add_grn(&$po, $date_, $reference, $location)
                {
 
                        /*Update sales_order_details for the new quantity received and the standard cost used for postings to GL and recorded in the stock movements for FIFO/LIFO stocks valuations*/
-
                        //------------------- update average material cost ------------------------------------------ Joe Hunt Mar-03-2008
                        update_average_material_cost($po->supplier_id, $order_line->stock_id, $order_line->price,
                                $order_line->receive_qty, $date_);
index ec3e14a88321d55b30fd60f2c5bf1ade27cb8d4c..1b7d3aaa22aea133c0ae4ddd50dfe0f985e39ef5 100644 (file)
@@ -112,10 +112,15 @@ function get_deliveries_between($stock_id, $from, $to)
 
 function get_diff_in_home_currency($supplier, $old_date, $date, $amount1, $amount2)
 {
+       $dec = user_price_dec();
+       price_decimal_format($amount2, $dec);
        $currency = get_supplier_currency($supplier);
-       $amount1 = to_home_currency($amount1, $currency, $old_date);
-       $amount2 = to_home_currency($amount2, $currency, $date);
-       return $amount2 - $amount1;
+       $ex_rate = get_exchange_rate_to_home_currency($currency, $old_date);
+       $amount1 = $amount1 / $ex_rate;
+       $ex_rate = get_exchange_rate_to_home_currency($currency, $date_);
+       $amount2 = $amount2 / $ex_rate;
+       $diff = $amount2 - $amount1;
+       return round2($diff, $dec);
 }
 //----------------------------------------------------------------------------------------
 
@@ -207,7 +212,6 @@ function add_supp_invoice($supp_trans, $invoice_no=0) // do not receive as ref b
                        $entered_grn->this_quantity_inv = -$entered_grn->this_quantity_inv;
                        set_grn_item_credited($entered_grn, $supp_trans->supplier_id, $invoice_id, $date_);
        }
-
                $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);
index 483f5672609145054da9fce1094b28bd134b1190..88727e80982a3fd0aa088bbfdc8ec2daf18c102e 100644 (file)
@@ -187,7 +187,8 @@ function set_document_parent($cart)
        if (count($cart->src_docs) == 1) {
 
                // if this child document has only one parent - update child link
-               $del_no = reset(array_keys($cart->src_docs));
+               $src = array_keys($cart->src_docs);
+               $del_no = reset($src);
 
                $sql = 'UPDATE '.TB_PREF.'debtor_trans SET trans_link = ' . $del_no .
                        ' WHERE type='.db_escape($cart->trans_type).' AND trans_no='. $inv_no ;
index b394754855780ff0448451ab7099385e304ef921..4ac759007760855bc4ee0b3280546b2d93f61394 100644 (file)
@@ -64,7 +64,7 @@ if ($Mode=='UPDATE_ITEM' && can_process())
 
 if ($Mode == 'Delete')
 {
-       if (key_in_foreign_table($selected_id, 'users', 'print_profile'))
+       if (key_in_foreign_table($selected_id, 'users', 'pos'))
        {
                display_error(_("Cannot delete this POS because it is used in users setup."));
        } else {
@@ -140,7 +140,6 @@ if($cash) {
        cash_accounts_list_row(_("Default cash account").':', 'account');
 } else {
        hidden('credit', 1);
-       hidden('cash', 0);
        hidden('account', 0);
 }
 
index 372265e3e285e9094b153cb7b51972b31a607fe4..46e2248ce4bd115e568442c1d6d057835e052d4c 100644 (file)
@@ -402,7 +402,6 @@ CREATE TABLE `0_company` (
   PRIMARY KEY  (`coy_code`)
 ) TYPE=MyISAM  ;
 
-
 ### Data of table `0_company` ###
 
 INSERT INTO `0_company` VALUES ('1', 'Company name', '', '', '1', '1', 'N/A', '', '', '', '', '', 'USD', '1200', '5060', '2100', '5690', '4450', '9990', '3590', '4430', '4010', '4510', '4500', '1510', '5010', '5040', '4010', '1530', '5000', '0', '10', '10', '1000', '20', '20', '30', '1', '1', '0', '0', '0', '1', '0', '0', '', '1', '2.2', '0', '-1', '1', '600');
@@ -1629,7 +1628,7 @@ CREATE TABLE `0_tax_types` (
   `purchasing_gl_code` varchar(11) NOT NULL default '',
   `name` varchar(60) NOT NULL default '',
   `inactive` tinyint(1) NOT NULL default '0',
-  PRIMARY KEY  (`id`),
+  PRIMARY KEY  (`id`)
 ) TYPE=InnoDB AUTO_INCREMENT=2 ;
 
 
index 7e3dfce6bbc572b75678b06e3af9b0ff35df2e72..549b7fc0ce97afc0e9b9baba6c7bfab26b56f215 100644 (file)
@@ -146,7 +146,7 @@ if ($selected_id != -1)
 {
        if ($Mode == 'Edit') {
                $myrow = get_item_tax_type($selected_id);
-    
+               unset($_POST); // clear exemption checkboxes
                $_POST['name']  = $myrow["name"];
                $_POST['exempt']  = $myrow["exempt"];
        
index 8dc71bdb54f2b3f1ae547c4424f24864d854cfd6..2f6a2adb9708e7dea20d796e0d22e085409d02ed 100644 (file)
@@ -18,7 +18,7 @@ these files. </li></ul><ol>
         </ol>
 
       </li><li>Upload all the new files.
-      </li><li>Look into the file, <span style="font-weight: bold; font-style: italic;">config.default.php and compare with your own config.php</span> file. You should update the the following in your config.php:<br /><br /></li><ul><li><small>Change the $version in your <span style="font-weight: bold;">config.php</span> file, about line 59, from "2.X.X" to "2.2.3".</small></li><li><small>Copy these 2 lines from <span style="font-weight: bold;">config.default.php</span> at the bottom into <span style="font-weight: bold;">config.php</span> at the bottom:<br /><span style="font-family: monospace;"><br />/* allow using of multi level sub-types when digits are of same length in account types */</span><br style="font-family: monospace;" /><span style="font-family: monospace;">$use_new_account_types = 0;</span><br style="font-family: monospace;" /><span style="font-family: monospace;">Change this to 1 if you want to use new multi level sup-types.</span><br style="font-family: monospace;" /></small></li><li><small>If this is an update from "2.2.X" to "2.2.3" you are<span style="font-weight: bold;"> </span><span style="font-style: italic; font-weight: bold;">done and &nbsp;should ignore the the rest of the items in this note</span>.<br /></small></li><li><small>Copy these 2 lines from <span style="font-weight: bold;">config.default.php</span> about line 80-82 into <span style="font-weight: bold;">config.php</span> about line 80:<br /><br /><span style="font-family: monospace;">/* Show users online discretetely in the footer */</span><br style="font-family: monospace;" /><span style="font-family: monospace;">$show_users_online = 0;</span><br style="font-family: monospace;" /><span style="font-family: monospace;">Change this to 1 if you want to show users online.</span><br style="font-family: monospace;" /></small></li><li><small>Replace the 2 lines about line 110-111 in <span style="font-weight: bold;">config.php</span>:<br /><br /><span style="font-family: monospace;">$table_style &nbsp;&nbsp;&nbsp; = "cellpadding=3 border=1 bordercolor='#8cacbb' style='border-collapse: collapse'";</span><br style="font-family: monospace;" /><span style="font-family: monospace;">$table_style2 &nbsp;&nbsp; &nbsp;= "cellpadding=3 border=1 bordercolor='#cccccc' style='border-collapse: collapse'";</span><br style="font-family: monospace;" /></small></li><li><small>With these 4 lines from <span style="font-weight: bold;">config.default.php</span>:<br /><br /><span style="font-family: monospace;">if (!isset($_SESSION['bordercolor']))</span><br style="font-family: monospace;" /><span style="font-family: monospace;">&nbsp; &nbsp; $_SESSION['bordercolor'] = "#8cacbb";</span><br style="font-family: monospace;" /><span style="font-family: monospace;">$table_style &nbsp;&nbsp;&nbsp; = "cellpadding=3 border=1 bordercolor='".$_SESSION['bordercolor']."' class='tablestyle'";</span><br style="font-family: monospace;" /><span style="font-family: monospace;">$table_style2 &nbsp;&nbsp;&nbsp; = "cellpadding=3 border=1 bordercolor='#cccccc' class='tablestyle2'";</span><br style="font-family: monospace;" /></small></li><li><small>Remove these 2 lines from <span style="font-weight: bold;">config.php</span> about line 176-177:<br /><br /><span style="font-family: monospace;">/* default start-up tab (orders/AP/stock/manuf/proj/GL/system) */</span><br style="font-family: monospace;" /><span style="font-family: monospace;">$def_app = "orders";</span><br style="font-family: monospace;" /></small></li><li><small>Copy these 3 lines from config.default.php about line 113-115<br /><br /><span style="font-family: monospace;">// defalt dateformats and dateseps indexes used before user login</span></small><br style="font-family: monospace;" /><small style="font-family: monospace;">$dflt_date_fmt = 0;</small><br style="font-family: monospace;" /><small><span style="font-family: monospace;">$dflt_date_sep = 0;</span><br style="font-family: monospace;" /></small></li><li><small>Copy these 2 lines from <span style="font-weight: bold;">config.default.php</span> about line 211-212:<br /><br /><span style="font-family: monospace;">define("ICON_SUBMIT", "ok.gif");&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; // new in 2.2</span><br style="font-family: monospace;" /><span style="font-family: monospace;">define("ICON_ESCAPE", "escape.png");&nbsp;&nbsp;&nbsp; // new in 2.2</span><br style="font-family: monospace;" /></small></li><li><small>And paste them into <span style="font-weight: bold;">config.php</span> about line 209</small></li><li><small>If you use gregorian calendar and have non-workdays on Friday and first day of week = Saturday<br />then you &nbsp;should &nbsp;set this line in <span style="font-weight: bold;">config.php</span> about line&nbsp; 95.<br /></small><pre><small>$date_system = 3;</small></pre></li><li><small>If you want to use FrontAccounting help wiki then set this line in config.php about line 85<br /></small><pre><small>$help_base_url = "http://frontaccounting.net/fawiki?n=Help.";<br /></small></pre></li></ul><li>Rename or remove the /install folder (you have already performed the install
+      </li><li>Look into the file, <span style="font-weight: bold; font-style: italic;">config.default.php and compare with your own config.php</span> file. You should update the the following in your config.php:<br /><br /></li><ul><li><small>Change the $version in your <span style="font-weight: bold;">config.php</span> file, about line 59, from "2.X.X" to "2.2.4".</small></li><li><small>If this is an update from 2.2.3 to 2.2.4 &nbsp;</small><small>you are<span style="font-weight: bold;"> </span><span style="font-style: italic; font-weight: bold;">done and &nbsp;should ignore the the rest of the items in this note</span>.</small></li><li><small>Copy these 2 lines from <span style="font-weight: bold;">config.default.php</span> at the bottom into <span style="font-weight: bold;">config.php</span> at the bottom:<br /><span style="font-family: monospace;"><br />/* allow using of multi level sub-types when digits are of same length in account types */</span><br style="font-family: monospace;" /><span style="font-family: monospace;">$use_new_account_types = 0;</span><br style="font-family: monospace;" /><span style="font-family: monospace;">Change this to 1 if you want to use new multi level sup-types.</span><br style="font-family: monospace;" /></small></li><li><small>If this is an update from "2.2.X" to "2.2.3" you are<span style="font-weight: bold;"> </span><span style="font-style: italic; font-weight: bold;">done and &nbsp;should ignore the the rest of the items in this note</span>.<br /></small></li><li><small>Copy these 2 lines from <span style="font-weight: bold;">config.default.php</span> about line 80-82 into <span style="font-weight: bold;">config.php</span> about line 80:<br /><br /><span style="font-family: monospace;">/* Show users online discretetely in the footer */</span><br style="font-family: monospace;" /><span style="font-family: monospace;">$show_users_online = 0;</span><br style="font-family: monospace;" /><span style="font-family: monospace;">Change this to 1 if you want to show users online.</span><br style="font-family: monospace;" /></small></li><li><small>Replace the 2 lines about line 110-111 in <span style="font-weight: bold;">config.php</span>:<br /><br /><span style="font-family: monospace;">$table_style &nbsp;&nbsp;&nbsp; = "cellpadding=3 border=1 bordercolor='#8cacbb' style='border-collapse: collapse'";</span><br style="font-family: monospace;" /><span style="font-family: monospace;">$table_style2 &nbsp;&nbsp; &nbsp;= "cellpadding=3 border=1 bordercolor='#cccccc' style='border-collapse: collapse'";</span><br style="font-family: monospace;" /></small></li><li><small>With these 4 lines from <span style="font-weight: bold;">config.default.php</span>:<br /><br /><span style="font-family: monospace;">if (!isset($_SESSION['bordercolor']))</span><br style="font-family: monospace;" /><span style="font-family: monospace;">&nbsp; &nbsp; $_SESSION['bordercolor'] = "#8cacbb";</span><br style="font-family: monospace;" /><span style="font-family: monospace;">$table_style &nbsp;&nbsp;&nbsp; = "cellpadding=3 border=1 bordercolor='".$_SESSION['bordercolor']."' class='tablestyle'";</span><br style="font-family: monospace;" /><span style="font-family: monospace;">$table_style2 &nbsp;&nbsp;&nbsp; = "cellpadding=3 border=1 bordercolor='#cccccc' class='tablestyle2'";</span><br style="font-family: monospace;" /></small></li><li><small>Remove these 2 lines from <span style="font-weight: bold;">config.php</span> about line 176-177:<br /><br /><span style="font-family: monospace;">/* default start-up tab (orders/AP/stock/manuf/proj/GL/system) */</span><br style="font-family: monospace;" /><span style="font-family: monospace;">$def_app = "orders";</span><br style="font-family: monospace;" /></small></li><li><small>Copy these 3 lines from config.default.php about line 113-115<br /><br /><span style="font-family: monospace;">// defalt dateformats and dateseps indexes used before user login</span></small><br style="font-family: monospace;" /><small style="font-family: monospace;">$dflt_date_fmt = 0;</small><br style="font-family: monospace;" /><small><span style="font-family: monospace;">$dflt_date_sep = 0;</span><br style="font-family: monospace;" /></small></li><li><small>Copy these 2 lines from <span style="font-weight: bold;">config.default.php</span> about line 211-212:<br /><br /><span style="font-family: monospace;">define("ICON_SUBMIT", "ok.gif");&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; // new in 2.2</span><br style="font-family: monospace;" /><span style="font-family: monospace;">define("ICON_ESCAPE", "escape.png");&nbsp;&nbsp;&nbsp; // new in 2.2</span><br style="font-family: monospace;" /></small></li><li><small>And paste them into <span style="font-weight: bold;">config.php</span> about line 209</small></li><li><small>If you use gregorian calendar and have non-workdays on Friday and first day of week = Saturday<br />then you &nbsp;should &nbsp;set this line in <span style="font-weight: bold;">config.php</span> about line&nbsp; 95.<br /></small><pre><small>$date_system = 3;</small></pre></li><li><small>If you want to use FrontAccounting help wiki then set this line in config.php about line 85<br /></small><pre><small>$help_base_url = "http://frontaccounting.net/fawiki?n=Help.";<br /></small></pre></li></ul><li>Rename or remove the /install folder (you have already performed the install
 process earlier).<br /></li></ul><ol>