Changed the Quantity routines to use the Item Units decimals if any. A lot of files.
authorJoe Hunt <joe.hunt.consulting@gmail.com>
Mon, 16 Jun 2008 09:34:53 +0000 (09:34 +0000)
committerJoe Hunt <joe.hunt.consulting@gmail.com>
Mon, 16 Jun 2008 09:34:53 +0000 (09:34 +0000)
48 files changed:
CHANGELOG.txt
includes/current_user.inc
includes/ui/ui_input.inc
includes/ui/ui_lists.inc
inventory/includes/db/items_units_db.inc
inventory/includes/item_adjustments_ui.inc
inventory/includes/stock_transfers_ui.inc
inventory/inquiry/stock_movements.php
inventory/inquiry/stock_status.php
inventory/manage/item_units.php
inventory/reorder_level.php
inventory/view/view_adjustment.php
inventory/view/view_transfer.php
manufacturing/includes/manufacturing_ui.inc
manufacturing/includes/work_order_issue_ui.inc
manufacturing/inquiry/where_used_inquiry.php
manufacturing/manage/bom_edit.php
manufacturing/search_work_orders.php
manufacturing/view/wo_issue_view.php
manufacturing/view/wo_production_view.php
manufacturing/work_order_entry.php
purchasing/includes/ui/invoice_ui.inc
purchasing/includes/ui/po_ui.inc
purchasing/po_receive_items.php
purchasing/supplier_credit_grns.php
purchasing/supplier_invoice_grns.php
purchasing/view/view_grn.php
purchasing/view/view_po.php
reporting/rep105.php
reporting/rep107.php
reporting/rep108.php
reporting/rep109.php
reporting/rep110.php
reporting/rep204.php
reporting/rep209.php
reporting/rep301.php
reporting/rep302.php
reporting/rep303.php
reporting/rep401.php
sales/customer_credit_invoice.php
sales/customer_delivery.php
sales/customer_invoice.php
sales/includes/ui/sales_credit_ui.inc
sales/includes/ui/sales_order_ui.inc
sales/view/view_credit.php
sales/view/view_dispatch.php
sales/view/view_invoice.php
sales/view/view_sales_order.php

index a9a9b197b47014639e657cb37a74c0b6cd753665..799bc44dc66d57d9aa38c936bf5a59c2a147669f 100644 (file)
@@ -19,6 +19,56 @@ Legend:
 ! -> Note
 $ -> Affected files
 
+16-Jun-2008 Joe Hunt
+! Changed the Quantity routines to use the Item Units decimals if any. A lot of files.
+$ /includes/current_user.inc
+  /includes/ui/ui_input.inc
+  /includes/ui/ui_lists.inc
+  /inventory/reorder_level.inc
+  /inventory/includes/item_adjustments_ui.inc
+  /inventory/includes/stock_transfers_ui.inc
+  /inventory/includes/db/items_units_db.inc
+  /inventory/inquiry/stock_movements.php
+  /inventory/inquiry/stock_status.php
+  /inventory/manage/item_units.php
+  /inventory/view/view_adjustment.php
+  /inventory/view/view_transfer.php
+  /manufacturing/search_work_orders.php
+  /manufacturing/work_order_entry.php
+  /manufacturing/includes/manufacturing_ui.inc
+  /manufacturing/includes/work_order_issue_ui.inc
+  /manufacturing/inquiry/where_used_inquiry.php
+  /manufacturing/manage/bom_edit.php
+  /manufacturing/view/wo_issue_view.php
+  /manufacturing/view/wo_production_view.php
+  /purchasing/po_receive_items.php
+  /purchasing/supplier_credit_grns.php
+  /purchasing/supplier_invoice_grns.php
+  /purchasing/includes/ui/invoice_ui.inc
+  /purchasing/includes/ui/po_ui.inc
+  /purchasing/view/view_grn.php
+  /purchasing/view/view_po.php
+  /reporting/rep105.php
+  /reporting/rep107.php
+  /reporting/rep108.php
+  /reporting/rep109.php
+  /reporting/rep110.php
+  /reporting/rep204.php
+  /reporting/rep209.php
+  /reporting/rep301.php
+  /reporting/rep302.php
+  /reporting/rep303.php
+  /reporting/rep401.php
+  /sales/customer_credit_invoice.php
+  /sales/customer_delivery.php
+  /sales/customer_invoice.php
+  /sales/includes/ui/sales_credit_ui.inc
+  /sales/includes/ui/sales_order_ui.inc
+  /sales/view/view_credit.php
+  /sales/view/view_dispatch.php
+  /sales/view/view_invoice.php
+  /sales/view/view_sales_order.php
+  
 15-Jun-2008 Janusz Dobrowolski
 + Ajax driven delivery and order queries.
 $ /sales/inquiry/sales_deliveries_view.php
index 9e5938eba5e2f1bc1092420b0860aa79683119f8..3aa6a3f91aaf6ca72a3c0e06b6d5cfeb3623fbc0 100644 (file)
@@ -4,7 +4,7 @@ include_once($path_to_root . "/includes/prefs/userprefs.inc");
 
 //--------------------------------------------------------------------------
 
-class current_user 
+class current_user
 {
 
        var $loginname;
@@ -54,8 +54,8 @@ class current_user
                    update_user_visitdate($loginname);
                    $this->logged = true;
 
-               } 
-               else 
+               }
+               else
                {
                        $this->logged = false;
                }
@@ -86,10 +86,10 @@ class current_user
        $db = mysql_connect($connection["host"] ,
                $connection["dbuser"], $connection["dbpassword"]);
        mysql_select_db($connection["dbname"],$db);
-               
+
                if (!defined('TB_PREF'))
                        define('TB_PREF', $connection["tbpref"]);
-               
+
        return $db;
        }
 
@@ -106,7 +106,7 @@ class current_user
 
 //--------------------------------------------------------------------------
 
-function number_format2($number, $decimals=0) 
+function number_format2($number, $decimals=0)
 {
        global $thoseps, $decseps;
        $tsep = $thoseps[$_SESSION["wa_current_user"]->prefs->tho_sep()];
@@ -115,22 +115,34 @@ function number_format2($number, $decimals=0)
 }
 
 function price_format($number) {
-    return number_format2($number, 
+    return number_format2($number,
        $_SESSION["wa_current_user"]->prefs->price_dec());
 }
-
-function qty_format($number) {
-    return number_format2($number, 
-       $_SESSION["wa_current_user"]->prefs->qty_dec());
+// 2008-06-15. Added extra parameter $stock_id and reference for $dec
+//--------------------------------------------------------------------
+function qty_format($number, $stock_id=null, &$dec=0) {
+       $dec = get_qty_dec($stock_id);
+    return number_format2($number, $dec);
 }
-
+// and get_qty_dec
+function get_qty_dec($stock_id=null)
+{
+       global $path_to_root;
+       include_once($path_to_root."/inventory/includes/db/items_units_db.inc");
+       if ($stock_id != null)
+               $dec = get_unit_dec($stock_id);
+       if ($stock_id == null || $dec == -1 || $dec == null)
+               $dec = $_SESSION["wa_current_user"]->prefs->qty_dec();
+       return $dec;
+}
+//-------------------------------------------------------------------
 function exrate_format($number) {
-    return number_format2($number, 
+    return number_format2($number,
        $_SESSION["wa_current_user"]->prefs->exrate_dec());
 }
 
 function percent_format($number) {
-    return number_format2($number, 
+    return number_format2($number,
        $_SESSION["wa_current_user"]->prefs->percent_dec());
 }
 
@@ -143,7 +155,7 @@ function user_numeric($input) {
        str_replace($sep, '', $num);
     $sep = $decseps[user_dec_sep()];
     if($sep!='.') $num = str_replace( $sep, '.', $num);
-    
+
     if (!is_numeric($num))
          return false;
     $num = (float)$num;
@@ -153,88 +165,88 @@ function user_numeric($input) {
          return $num;
 }
 
-function user_company() 
+function user_company()
 {
        return $_SESSION["wa_current_user"]->company;
 }
 
-function user_language() 
+function user_language()
 {
        return $_SESSION["wa_current_user"]->prefs->language();
 }
 
-function user_qty_dec() 
+function user_qty_dec()
 {
        return $_SESSION["wa_current_user"]->prefs->qty_dec();
 }
 
-function user_price_dec() 
+function user_price_dec()
 {
        return $_SESSION["wa_current_user"]->prefs->price_dec();
 }
 
-function user_exrate_dec() 
+function user_exrate_dec()
 {
        return $_SESSION["wa_current_user"]->prefs->exrate_dec();
 }
 
-function user_percent_dec() 
+function user_percent_dec()
 {
        return $_SESSION["wa_current_user"]->prefs->percent_dec();
 }
 
-function user_show_gl_info() 
+function user_show_gl_info()
 {
        return $_SESSION["wa_current_user"]->prefs->show_gl_info();
 }
 
-function user_show_codes() 
+function user_show_codes()
 {
        return $_SESSION["wa_current_user"]->prefs->show_codes();
 }
 
-function user_date_format() 
+function user_date_format()
 {
        return $_SESSION["wa_current_user"]->prefs->date_format();
 }
 
-function user_date_display() 
+function user_date_display()
 {
        return $_SESSION["wa_current_user"]->prefs->date_display();
 }
 
-function user_date_sep() 
+function user_date_sep()
 {
        return $_SESSION["wa_current_user"]->prefs->date_sep();
 }
 
-function user_tho_sep() 
+function user_tho_sep()
 {
        return $_SESSION["wa_current_user"]->prefs->tho_sep();
 }
 
-function user_dec_sep() 
+function user_dec_sep()
 {
        return $_SESSION["wa_current_user"]->prefs->dec_sep();
 }
 
-function user_theme() 
+function user_theme()
 {
        return $_SESSION["wa_current_user"]->prefs->get_theme();
 }
 
-function user_pagesize() 
+function user_pagesize()
 {
        return $_SESSION["wa_current_user"]->prefs->get_pagesize();
 }
 
-function user_hints() 
+function user_hints()
 {
        return $_SESSION["wa_current_user"]->prefs->show_hints();
 }
 
 function set_user_prefs($price_dec, $qty_dec, $exrate_dec, $percent_dec, $showgl, $showcodes,
-       $date_format, $date_sep, $tho_sep, $dec_sep, $theme, $pagesize, $show_hints) 
+       $date_format, $date_sep, $tho_sep, $dec_sep, $theme, $pagesize, $show_hints)
 {
 
        $_SESSION["wa_current_user"]->update_prefs($price_dec, $qty_dec, $exrate_dec, $percent_dec, $showgl, $showcodes,
@@ -246,7 +258,7 @@ function add_user_js_data() {
 
        $ts = $thoseps[user_tho_sep()];
        $ds = $decseps[user_dec_sep()];
-  
+
     $js = "\n<script type=\"text/javascript\">\n"
          . "<!--\n"
          . "var user = {\n"
index 8842fc537a0ae3f25781bea30027a7daaa2c3076..753fc3d94745b8190a02a05f4b4e6d101e77b3a5 100644 (file)
@@ -179,7 +179,7 @@ function check($label, $name, $value, $submit_on_change=false, $title=false)
 
        if ($value == null)
                $value = (!isset($_POST[$name]) ? 0 : $_POST[$name]);
-       
+
                echo "<input"
                    .($value == 1 ? ' checked':'')
                    ." type='checkbox' name='$name' value='1'"
@@ -241,13 +241,15 @@ function percent_cell($label, $bold=false, $id=null)
        else
                label_cell(percent_format($label), "nowrap align=right", $id);
 }
-
+// 2008-06-15. Changed
 function qty_cell($label, $bold=false, $dec=null, $id=null)
 {
+       if ($dec == null)
+               $dec = get_qty_dec();
        if ($bold)
-               label_cell("<b>".qty_format($label, $dec)."</b>", "nowrap align=right", $id);
+               label_cell("<b>".number_format2($label, $dec)."</b>", "nowrap align=right", $id);
        else
-               label_cell(qty_format($label, $dec), "nowrap align=right", $id);
+               label_cell(number_format2($label, $dec), "nowrap align=right", $id);
 }
 
 function label_cells($label, $value, $params="", $params2="")
index 51b0e956a4fe93f4dd687e125dfcc61cdee2e546..e46fe645993dbf01ef29eacb2b98d8445ccebc69 100644 (file)
@@ -66,7 +66,7 @@ $opts = array(                // default options
        }
        if ($opts['sel_hint'] === null)
                $opts['sel_hint'] = $by_id || $search_box==false ?
-                       '' : _('Press Space tab for search pattern entry');
+               '' : _('Press Space tab for search pattern entry');
 
        if ($opts['box_hint'] === null)
                $opts['box_hint'] = $search_box ?
@@ -100,16 +100,16 @@ $opts = array(            // default options
        }
        if ($txt == '') {
                if ($spec_option === false)
-                       $limit = ' LIMIT 1';
+               $limit = ' LIMIT 1';
                else
-                       $opts['where'][] = $valfield . "='". get_post($name, $spec_id)."'";
+               $opts['where'][] = $valfield . "='". get_post($name, $spec_id)."'";
        }
        else
                if ($txt != '*') {
 
                foreach($opts['search'] as $i=> $s)
                        $opts['search'][$i] = $s . " LIKE '%{$txt}%'";
-                       $opts['where'][] = '('. implode($opts['search'], ' OR ') . ')';
+               $opts['where'][] = '('. implode($opts['search'], ' OR ') . ')';
                }
        }
    }
@@ -539,7 +539,7 @@ function stock_items_list_cells($label, $name, $selected_id, $all_option=false,
        if ($label != null)
                echo "<td>$label</td>\n";
        $str = stock_items_list($name, $selected_id, $all_option, $submit_on_change,
-               array('cells'=>true));
+       array('cells'=>true));
        return $str;
 }
 /*
@@ -717,8 +717,6 @@ function stock_item_types_list_row($label, $name, $selected_id, $enabled=true)
 
 function stock_units_list_row($label, $name, $value, $enabled=true)
 {
-       global $stock_units;
-
        default_focus($name);
        $result = get_all_item_units();
        echo "<tr><td>$label</td>\n";
@@ -753,8 +751,6 @@ function stock_units_list_row($label, $name, $value, $enabled=true)
 
 function tax_types_list($name, $selected_id, $none_option=false, $submit_on_change=false)
 {
-       global $all_items;
-
        $sql = "SELECT id, CONCAT(name, ' (',rate,'%)') as name FROM ".TB_PREF."tax_types";
 
        return combo_input($name, $selected_id, $sql, 'id', 'name',
@@ -791,8 +787,6 @@ function tax_types_list_row($label, $name, $selected_id, $none_option=false,
 function tax_groups_list($name, $selected_id,
        $none_option=false, $submit_on_change=false)
 {
-       global $all_items;
-
        $sql = "SELECT id, name FROM ".TB_PREF."tax_groups";
 
        return combo_input($name, $selected_id, $sql, 'id', 'name',
@@ -995,8 +989,6 @@ function credit_status_list_row($label, $name, $selected_id)
 
 function sales_types_list($name, $selected_id, $submit_on_change=false, $special_option=false)
 {
-       global $all_items;
-
        $sql = "SELECT id, sales_type FROM ".TB_PREF."sales_types";
 
        return combo_input($name, $selected_id, $sql, 'id', 'sales_type',
@@ -1818,47 +1810,55 @@ function credit_type_list_row($label, $name, $selected, $submit_on_change=false)
        return $str;
 }
 
-function number_list($name, $selected, $from, $to, $firstlabel="")
+function number_list($name, $selected, $from, $to, $no_option=false)
 {
        default_focus($name);
        if ($selected == null)
        {
-               $selected = (!isset($_POST[$name]) ? $from : $_POST[$name]);
-               if ($selected == $from)
-                       $_POST[$name] = $selected;
+               $selected = (!isset($_POST[$name]) ? reserved_words::get_all_numeric() : $_POST[$name]);
        }
        echo "<select name='$name'>";
+       if ($no_option !== false)
+       {
+               $reserved_word = reserved_words::get_all_numeric();
+
+       if ($selected == $reserved_word)
+       {
+            echo "<option selected value='$reserved_word'>$no_option</option>\n";
+       }
+       else
+       {
+            echo "<option value='$reserved_word'>$no_option</option>\n";
+       }
+       }
+
        for ($i = $from; $i <= $to; $i++)
        {
-               if ($i == 0 && $firstlabel != "")
-                       $label = $firstlabel;
-               else
-                       $label = $i;
                if ($selected == $i)
                {
-                       echo "<option selected value='$i'>$label</option>\n";
+                       echo "<option selected value='$i'>$i</option>\n";
                }
                else
                {
-                       echo "<option value='$i'>$label</option>\n";
+                       echo "<option value='$i'>$i</option>\n";
                }
        }
        echo "</select>\n";
 }
 
-function number_list_cells($label, $name, $selected, $from, $to)
+function number_list_cells($label, $name, $selected, $from, $to, $no_option=false)
 {
        if ($label != null)
                label_cell($label);
        echo "<td>\n";
-       number_list($name, $selected, $from, $to);
+       number_list($name, $selected, $from, $to, $no_option);
        echo "</td>\n";
 }
 
-function number_list_row($label, $name, $selected, $from, $to)
+function number_list_row($label, $name, $selected, $from, $to, $no_option=false)
 {
        echo "<tr>\n";
-       number_list_cells($label, $name, $selected, $from, $to);
+       number_list_cells($label, $name, $selected, $from, $to, $no_option);
        echo "</tr>\n";
 }
 ?>
\ No newline at end of file
index f7ad5f655241135c9db5a1d8bee2972ce7ad1ffd..1f63252a3e932eef412790129c53b1d02165da2b 100644 (file)
@@ -53,4 +53,15 @@ function get_all_item_units() {
     $sql = "SELECT * FROM ".TB_PREF."item_units ORDER BY name";
     return  db_query($sql, "could not get stock categories");
 }
+// 2008-06-15. Added Joe Hunt to get a measure of unit by given stock_id
+function get_unit_dec($stock_id)
+{
+       $sql = "SELECT decimals FROM ".TB_PREF."item_units,     ".TB_PREF."stock_master
+               WHERE abbr=units AND stock_id='$stock_id' LIMIT 1";
+       $result = db_query($sql, "could not get unit decimals");
+
+       $row = db_fetch_row($result);
+       return $row[0];
+}
+
 ?>
\ No newline at end of file
index 39c728a46bf4429e2a6caf4560b92478f0302fd4..b4d8edd56804778c385bbfdb809fe98e85290367 100644 (file)
@@ -9,9 +9,9 @@ function add_to_order(&$order, $new_item, $new_item_qty, $standard_cost)
 {
     $allready_on_order = 0;
 
-       foreach ($order->line_items as $order_item) 
+       foreach ($order->line_items as $order_item)
        {
-        if (strcasecmp($order_item->stock_id, $new_item) == 0) 
+        if (strcasecmp($order_item->stock_id, $new_item) == 0)
         {
             $allready_on_order = 1;
             display_error(_("For Part :") . $new_item . " " . "This item is already on this order.  You can change the quantity ordered of the existing line if necessary.");
@@ -29,9 +29,9 @@ function add_to_order(&$order, $new_item, $new_item_qty, $standard_cost)
 function display_order_header(&$order)
 {
        global $table_style2;
-       
+
        start_table("width=70% $table_style2"); // outer table
-       echo "<tr><td valign=top width=33%>"; 
+       echo "<tr><td valign=top width=33%>";
        echo "<table>"; // inner table
 
        locations_list_row(_("Location:"), 'StockLocation', null);
@@ -39,7 +39,7 @@ function display_order_header(&$order)
 
        echo "</table>"; // inner table
 
-       echo "</td><td width=33%>"; 
+       echo "</td><td width=33%>";
 
        echo "<table>"; // inner table
 
@@ -47,7 +47,7 @@ function display_order_header(&$order)
 
        echo "</table>"; // inner table
 
-       echo "</td><td width=33%>"; 
+       echo "</td><td width=33%>";
 
        echo "<table>"; // inner table
     movement_types_list_row(_("Detail:"), 'type', null);
@@ -59,7 +59,7 @@ function display_order_header(&$order)
 
        echo "</table>"; // inner table
 
-       echo "</td></tr>"; 
+       echo "</td></tr>";
        end_table(1); // outer table
 }
 
@@ -71,7 +71,7 @@ function display_adjustment_items($title, &$order)
 
        display_heading($title);
        start_table("$table_style width=80%");
-       $th = array(_("Item Code"), _("Item Description"), _("Quantity"), 
+       $th = array(_("Item Code"), _("Item Description"), _("Quantity"),
                _("Unit"), _("Unit Cost"), _("Total"));
        if ( count($order->line_items)) $th[] = '';
 
@@ -79,7 +79,7 @@ function display_adjustment_items($title, &$order)
        $total = 0;
        $k = 0;  //row colour counter
 
-       foreach ($order->line_items as $stock_item) 
+       foreach ($order->line_items as $stock_item)
        {
 
                $quantity = number_format2($stock_item->quantity,user_qty_dec());
@@ -100,8 +100,8 @@ function display_adjustment_items($title, &$order)
                        edit_link_cell(SID . "Edit=$stock_item->stock_id");
                        delete_link_cell(SID . "Delete=$stock_item->stock_id");
                        end_row();
-               } 
-               else 
+               }
+               else
                {
                        adjustment_edit_item_controls($order, $stock_item->stock_id);
                }
@@ -126,7 +126,7 @@ function adjustment_edit_item_controls(&$order, $stock_id=null)
                if (!isset($_POST['stock_id']))
                        $_POST['stock_id'] = $order->line_items[$stock_id]->stock_id;
                if (!isset($_POST['qty']) OR ($_POST['qty']==""))
-                       $_POST['qty'] = qty_format($order->line_items[$stock_id]->quantity);
+                       $_POST['qty'] = qty_format($order->line_items[$stock_id]->quantity, $order->line_items[$stock_id]->stock_id, $dec);
                if (!isset($_POST['std_cost']) OR ($_POST['std_cost']==""))
                        $_POST['std_cost'] = price_format($order->line_items[$stock_id]->standard_cost);
 
@@ -144,23 +144,23 @@ function adjustment_edit_item_controls(&$order, $stock_id=null)
 
        $item_info = get_item_edit_info($_POST['stock_id']);
 
-               $_POST['qty'] = qty_format(0);
+               $_POST['qty'] = qty_format(0, $_POST['stock_id'], $dec);
                $_POST['std_cost'] = price_format($item_info["standard_cost"]);
                $_POST['units'] = $item_info["units"];
        }
 
-       qty_cells(null, 'qty', $_POST['qty']);
+       qty_cells(null, 'qty', $_POST['qty'], null, null, $dec);
 
        label_cell($_POST['units']);
        amount_cells(null, 'std_cost', $_POST['std_cost']);
        label_cell("&nbsp;");
 
-       if (isset($_GET['Edit'])) 
+       if (isset($_GET['Edit']))
        {
        submit_cells('UpdateItem', _("Update"));
        submit_cells('CancelItemChanges', _("Cancel"));
-       } 
-       else 
+       }
+       else
        {
                submit_cells('AddItem', _("Add Item"), "colspan=2");
        }
index 2cbfc7cc1999d29c203c647ec0e471781e923936..48182ed89f25e5548bea7191a8135715f0ef848c 100644 (file)
@@ -9,9 +9,9 @@ function add_to_order(&$order, $new_item, $new_item_qty, $standard_cost)
 {
     $already_on_order = 0;
 
-       foreach ($order->line_items as $order_item) 
+       foreach ($order->line_items as $order_item)
        {
-        if (strcasecmp($order_item->stock_id, $new_item) == 0) 
+        if (strcasecmp($order_item->stock_id, $new_item) == 0)
         {
             $already_on_order = 1;
             display_error(_("For Part :") . $new_item . " " . "This item is already on this order.  You can change the quantity ordered of the existing line if necessary.");
@@ -72,7 +72,7 @@ function display_transfer_items($title, &$order)
        $subtotal = 0;
        $k = 0;  //row colour counter
 
-       foreach ($order->line_items as $stock_item) 
+       foreach ($order->line_items as $stock_item)
        {
 
                $quantity = number_format2($stock_item->quantity,user_qty_dec());
@@ -83,14 +83,14 @@ function display_transfer_items($title, &$order)
 
                label_cell("<a target='_blank' href='$path_to_root/inventory/inquiry/stock_status.php?" . SID . "stock_id=" . $stock_item->stock_id . "'>$stock_item->stock_id</a>");
                label_cell($stock_item->item_description);
-               label_cell($quantity, "nowrap align=right");
+               qty_cell($stock_item->quantity, false, get_qty_dec($stock_item->stock_id));
                label_cell($stock_item->units);
 
                        edit_link_cell(SID . "Edit=$stock_item->stock_id");
                        delete_link_cell(SID . "Delete=$stock_item->stock_id");
                end_row();
-               } 
-               else 
+               }
+               else
                {
                        transfer_edit_item_controls($order, $stock_item->stock_id);
                }
@@ -113,7 +113,7 @@ function transfer_edit_item_controls(&$order, $stock_id=null)
                if (!isset($_POST['stock_id']))
                        $_POST['stock_id'] = $order->line_items[$stock_id]->stock_id;
                if (!isset($_POST['qty']) || $_POST['qty'] == '')
-                       $_POST['qty'] = qty_format($order->line_items[$stock_id]->quantity);
+                       $_POST['qty'] = qty_format($order->line_items[$stock_id]->quantity, $order->line_items[$stock_id]->stock_id, $dec);
 
                $_POST['units'] = $order->line_items[$stock_id]->units;
 
@@ -129,20 +129,20 @@ function transfer_edit_item_controls(&$order, $stock_id=null)
 
        $item_info = get_item_edit_info($_POST['stock_id']);
 
-               $_POST['qty'] = qty_format(0);
+               $_POST['qty'] = qty_format(0, $_POST['stock_id'], $dec);
                $_POST['units'] = $item_info["units"];
        }
 
 
-       small_qty_cells(null, 'qty', $_POST['qty']);
+       small_qty_cells(null, 'qty', $_POST['qty'], null, null, $dec);
        label_cell($_POST['units']);
 
-       if (isset($_GET['Edit'])) 
+       if (isset($_GET['Edit']))
        {
        submit_cells('UpdateItem', _("Update"));
        submit_cells('CancelItemChanges', _("Cancel"));
-       } 
-       else 
+       }
+       else
        {
                submit_cells('AddItem', _("Add Item"), "colspan=2");
        }
index 698eb37fe802d291e9e4fc67525f35cae515a932..944cb437b3c95ae1b501f8bfa20de6002a553080 100644 (file)
@@ -78,7 +78,8 @@ if (!isset($before_qty_row[0]))
 start_row("class='inquirybg'");
 label_cell("<b>"._("Quantity on hand before") . " " . $_POST['AfterDate']."</b>", "align=center colspan=5");
 label_cell("&nbsp;", "colspan=2");
-qty_cell($before_qty);
+$dec = get_qty_dec($_POST['stock_id']);
+qty_cell($before_qty, false, $dec);
 end_row();
 
 $j = 1;
@@ -98,12 +99,12 @@ while ($myrow = db_fetch($result))
 
        if ($myrow["qty"] > 0)
        {
-               $quantity_formatted = number_format2($myrow["qty"],user_qty_dec());
+               $quantity_formatted = number_format2($myrow["qty"], $dec);
                $total_in += $myrow["qty"];
        }
        else
        {
-               $quantity_formatted = number_format2(-$myrow["qty"],user_qty_dec());
+               $quantity_formatted = number_format2(-$myrow["qty"], $dec);
                $total_out += -$myrow["qty"];
        }
        $after_qty += $myrow["qty"];
@@ -154,7 +155,7 @@ while ($myrow = db_fetch($result))
 
        label_cell((($myrow["qty"] >= 0) ? $quantity_formatted : ""), "nowrap align=right");
        label_cell((($myrow["qty"] < 0) ? $quantity_formatted : ""), "nowrap align=right");
-       label_cell(number_format2($after_qty,user_qty_dec()), "nowrap align=right");
+       qty_cell($after_qty, false, $dec);
        end_row();
        $j++;
        If ($j == 12)
@@ -171,9 +172,9 @@ while ($myrow = db_fetch($result))
 //{
        start_row("class='inquirybg'");
     label_cell("<b>"._("Quantity on hand after") . " " . $_POST['BeforeDate']."</b>", "align=center colspan=5");
-    qty_cell($total_in);
-    qty_cell($total_out);
-    qty_cell($after_qty);
+    qty_cell($total_in, false, $dec);
+    qty_cell($total_out, false, $dec);
+    qty_cell($after_qty, false, $dec);
     end_row();
 //}
 
index c0509a73f38d307bed659059efdceb7b97d98912..ae0764567c14fbde263f5cf1f7caa619755d4cbf 100644 (file)
@@ -61,6 +61,7 @@ else
                _("Demand"), _("Available"), _("On Order"));
 }
 table_header($th);
+$dec = get_qty_dec($_POST['stock_id']);
 $j = 1;
 $k = 0; //row colour counter
 
@@ -110,11 +111,11 @@ while ($myrow = db_fetch($loc_details))
                }
 
                label_cell($myrow["location_name"]);
-               qty_cell($qoh);
-        qty_cell($myrow["reorder_level"]);
-        qty_cell($demand_qty);
-        qty_cell($qoh - $demand_qty);
-        qty_cell($qoo);
+               qty_cell($qoh, false, $dec);
+        qty_cell($myrow["reorder_level"], false, $dec);
+        qty_cell($demand_qty, false, $dec);
+        qty_cell($qoh - $demand_qty, false, $dec);
+        qty_cell($qoo, false, $dec);
         end_row();
 
        }
@@ -122,7 +123,7 @@ while ($myrow = db_fetch($loc_details))
        {
        /* It must be a service or kitset part */
                label_cell($myrow["location_name"]);
-               qty_cell($demand_qty);
+               qty_cell($demand_qty, false, $dec);
                end_row();
 
        }
index ce5f50d0de6ef45680f803e43232c313957a2dfe..3798bfe30f24f94e62720645c2f196766787eb70 100644 (file)
@@ -13,7 +13,7 @@ include_once($path_to_root . "/inventory/includes/db/items_units_db.inc");
 if (isset($_GET['selected_id']))
 {
        $selected_id = $_GET['selected_id'];
-} 
+}
 else if (isset($_POST['selected_id']))
 {
        $selected_id = $_POST['selected_id'];
@@ -21,25 +21,25 @@ else if (isset($_POST['selected_id']))
 
 //----------------------------------------------------------------------------------
 
-if (isset($_POST['ADD_ITEM']) || isset($_POST['UPDATE_ITEM'])) 
+if (isset($_POST['ADD_ITEM']) || isset($_POST['UPDATE_ITEM']))
 {
 
        //initialise no input errors assumed initially before we test
        $input_error = 0;
 
-       if (strlen($_POST['abbr']) == 0) 
+       if (strlen($_POST['abbr']) == 0)
        {
                $input_error = 1;
                display_error(_("The unit of measure code cannot be empty."));
                set_focus('abbr');
        }
-       if (strlen($_POST['description']) == 0) 
+       if (strlen($_POST['description']) == 0)
        {
                $input_error = 1;
                display_error(_("The unit of measure description cannot be empty."));
                set_focus('description');
        }
-       if (!is_numeric($_POST['decimals'])) 
+       if (!is_numeric($_POST['decimals']))
        {
                $input_error = 1;
                display_error(_("The number of decimal places must be integer."));
@@ -49,26 +49,26 @@ if (isset($_POST['ADD_ITEM']) || isset($_POST['UPDATE_ITEM']))
 
        if ($input_error !=1) {
        write_item_unit(isset($selected_id) ? $selected_id : '', $_POST['abbr'], $_POST['description'], $_POST['decimals'] );
-               meta_forward($_SERVER['PHP_SELF']); 
+               meta_forward($_SERVER['PHP_SELF']);
        }
 }
 
-//---------------------------------------------------------------------------------- 
+//----------------------------------------------------------------------------------
 
-if (isset($_GET['delete'])) 
+if (isset($_GET['delete']))
 {
 
        // PREVENT DELETES IF DEPENDENT RECORDS IN 'stock_master'
-    
+
        if (item_unit_used($selected_id))
        {
                display_error(_("Cannot delete this unit of measure because items have been created using this units."));
 
-       } 
-       else 
+       }
+       else
        {
                delete_item_unit($selected_id);
-               meta_forward($_SERVER['PHP_SELF']);             
+               meta_forward($_SERVER['PHP_SELF']);
        }
 }
 
@@ -81,9 +81,9 @@ $th = array(_('Unit'), _('Description'), _('Decimals'), "", "");
 table_header($th);
 $k = 0; //row colour counter
 
-while ($myrow = db_fetch($result)) 
+while ($myrow = db_fetch($result))
 {
-       
+
        alt_table_row_color($k);
 
        label_cell($myrow["abbr"]);
@@ -105,7 +105,7 @@ start_form();
 
 start_table("class='tablestyle_noborder'");
 
-if (isset($selected_id)) 
+if (isset($selected_id))
 {
        //editing an existing item category
 
@@ -123,8 +123,10 @@ if (isset($selected_id) && item_unit_used($selected_id)) {
     hidden('abbr', $_POST['abbr']);
 } else
     text_row(_("Unit Abbreviation:"), 'abbr', null, 20, 20);
-text_row(_("Descriptive Name:"), 'description', null, 40, 40);  
-text_row(_("Decimal Places:"), 'decimals', null, 3, 3);  
+text_row(_("Descriptive Name:"), 'description', null, 40, 40);
+
+//text_row(_("Decimal Places:"), 'decimals', null, 3, 3);
+number_list_row(_("Decimal Places:"), 'decimals', null, 0, 6, _("User Quantity Decimals"));
 
 end_table(1);
 
index dfe6f2dc2862e63b3fd98e5ac3f81e0ee7dda73c..5b1ac7282c92dbad8bbfbc2f3919d7f68b5ba9de 100644 (file)
@@ -66,10 +66,10 @@ while ($myrow = db_fetch($result))
 
        label_cell($myrow["location_name"]);
 
-       $_POST[$myrow["loc_code"]] = qty_format($myrow["reorder_level"]);
+       $_POST[$myrow["loc_code"]] = qty_format($myrow["reorder_level"], $_POST['stock_id'], $dec);
 
-       label_cell(number_format2($qoh,user_qty_dec()), "nowrap align='right'");
-       qty_cells(null, $myrow["loc_code"]);
+       qty_cell($qoh, false, $dec);
+       qty_cells(null, $myrow["loc_code"], null, null, null, $dec);
        end_row();
        $j++;
        If ($j == 12)
index f5d9cbd692c4fcb467ab2d64907fcd3448b7340c..a4eb1fe9b3f37e06e61cb80d2b5b4ccb6b7ffa75 100644 (file)
@@ -21,13 +21,13 @@ display_heading(systypes::name(systypes::inventory_adjustment()) . " #$trans_no"
 $adjustment_items = get_stock_adjustment_items($trans_no);
 $k = 0;
 $header_shown = false;
-while ($adjustment = db_fetch($adjustment_items)) 
+while ($adjustment = db_fetch($adjustment_items))
 {
 
-       if (!$header_shown) 
+       if (!$header_shown)
        {
                $adjustment_type = get_movement_type($adjustment['person_id']) ;
-               
+
                start_table("$table_style2 width=90%");
                start_row();
                label_cells(_("At Location"), $adjustment['location_name'], "class='tableheader2'");
@@ -45,14 +45,14 @@ while ($adjustment = db_fetch($adjustment_items))
 
        $th = array(_("Item"), _("Description"), _("Quantity"),
                _("Units"), _("Unit Cost"));
-       table_header($th);      
+       table_header($th);
        }
 
     alt_table_row_color($k);
 
     label_cell($adjustment['stock_id']);
     label_cell($adjustment['description']);
-    qty_cell($adjustment['qty']);
+    qty_cell($adjustment['qty'], false, get_qty_dec($adjustment['stock_id']));
     label_cell($adjustment['units']);
     amount_cell($adjustment['standard_cost']);
     end_row();
index 66f5a7a44d4209f636686631e16673d8994d8244..75f567cbe50c6a72270a49be7a389f867e75642d 100644 (file)
@@ -48,16 +48,16 @@ start_table("$table_style width=90%");
 $th = array(_("Item"), _("Description"), _("Quantity"), _("Units"));
 table_header($th);
 $transfer_items = get_stock_moves(systypes::location_transfer(), $trans_no);
-
-while ($item = db_fetch($transfer_items))      
+$k = 0;
+while ($item = db_fetch($transfer_items))
 {
-       if ($item['loc_code'] == $to_trans['loc_code']) 
+       if ($item['loc_code'] == $to_trans['loc_code'])
        {
         alt_table_row_color($k);
 
         label_cell($item['stock_id']);
         label_cell($item['description']);
-        qty_cell($item['qty']);
+        qty_cell($item['qty'], false, get_qty_dec($item['stock_id']));
         label_cell($item['units']);
         end_row();;
        }
index eb14c8a11c64dcd3309d2e873845beda9fcc7769..62bfb5c8dd74889246d51bd1decfeddca5820f22 100644 (file)
@@ -37,7 +37,7 @@ function display_bom($item_check)
                        label_cell($myrow["description"]);
                        label_cell($myrow["WorkCentreDescription"]);
                        label_cell($myrow["location_name"]);
-                       qty_cell($myrow["quantity"]);
+                       qty_cell($myrow["quantity"], false, get_qty_dec($myrow["component"]));
                        amount_cell($myrow["standard_cost"]);
                        amount_cell($myrow["ComponentCost"]);
                        end_row();
@@ -113,11 +113,12 @@ function display_wo_requirements($woid, $quantity, $show_qoh=false, $date=null)
 
                        label_cell($myrow["location_name"]);
                        label_cell($myrow["WorkCentreDescription"]);
-            qty_cell($myrow["units_req"]);
-                       qty_cell($myrow["units_req"] * $quantity);
-            qty_cell($myrow["units_issued"]);
+                       $dec = get_qty_dec($myrow["stock_id"]);
+            qty_cell($myrow["units_req"], false, $dec);
+                       qty_cell($myrow["units_req"] * $quantity, false, $dec);
+            qty_cell($myrow["units_issued"], false, $dec);
                        if ($show_qoh)
-                               qty_cell($qoh);
+                               qty_cell($qoh, false, $dec);
                        else
                                label_cell("");
                        end_row();
@@ -284,13 +285,13 @@ function display_wo_details($woid, $suppress_view_link=false)
        label_cell($myrow["location_name"]);
        label_cell(sql2date($myrow["date_"]));
        label_cell(sql2date($myrow["required_by"]));
-
-       qty_cell($myrow["units_reqd"]);
+       $dec = get_qty_dec($myrow["stock_id"]);
+       qty_cell($myrow["units_reqd"], false, $dec);
 
        if ($myrow["released"] == true)
        {
                label_cell(sql2date($myrow["released_date"]));
-               qty_cell($myrow["units_issued"]);
+               qty_cell($myrow["units_issued"], false, $dec);
        }
        end_row();
 
@@ -335,7 +336,7 @@ function display_wo_details_quick($woid, $suppress_view_link=false)
        label_cell($myrow["location_name"]);
        label_cell(sql2date($myrow["date_"]));
 
-       qty_cell($myrow["units_issued"]);
+       qty_cell($myrow["units_issued"], false, get_qty_dec($myrow["stock_id"]));
 
        end_row();
 
index 8d061381f34279c1dcaaa984d370fe9cfbef8040..ba8cd36a0dca0a12bba13549dd9de0772ba3f05e 100644 (file)
@@ -9,9 +9,9 @@ function add_to_order(&$order, $new_item, $new_item_qty, $standard_cost)
 {
     $already_on_order = 0;
 
-       foreach ($order->line_items as $order_item) 
+       foreach ($order->line_items as $order_item)
        {
-        if (strcasecmp($order_item->stock_id, $new_item) == 0) 
+        if (strcasecmp($order_item->stock_id, $new_item) == 0)
         {
             $already_on_order = 1;
             display_error(_("For Part :") . $new_item . " " . "This item is already on this order.  You can change the quantity ordered of the existing line if necessary.");
@@ -42,12 +42,11 @@ function display_adjustment_items($Title, &$order)
        start_table("$table_style colspan=7");
        $th = array(_("Item Code"), _("Item Description"), _("Quantity"),
                _("Unit"), _("Unit Cost"));
-       table_header($th);      
+       table_header($th);
 
-       $subtotal = 0;
        $k = 0;  //row colour counter
 
-       foreach ($order->line_items as $stock_item) 
+       foreach ($order->line_items as $stock_item)
        {
 
                if ($_GET['Edit'] != $stock_item->stock_id)
@@ -56,7 +55,7 @@ function display_adjustment_items($Title, &$order)
 
                label_cell("<a target='_blank' href='$path_to_root/inventory/inquiry/stock_status.php?" . SID . "stock_id=" . $stock_item->stock_id . "'>$stock_item->stock_id</a>");
                label_cell($stock_item->item_description);
-               qty_cell($stock_item_quantity);
+               qty_cell($stock_item->quantity, false, get_qty_dec($stock_item->stock_id));
                if (strlen($stock_item->units))
                        label_cell($stock_item->units);
                else
@@ -66,8 +65,8 @@ function display_adjustment_items($Title, &$order)
                edit_link_cell(SID . "Edit=$stock_item->stock_id");
                delete_link_cell(SID . "Delete=$stock_item->stock_id");
                end_row();
-               } 
-               else 
+               }
+               else
                {
                        adjustment_edit_item_controls($order, $stock_item->stock_id);
                }
@@ -120,12 +119,12 @@ function adjustment_edit_item_controls(&$order, $stock_id=null)
        label_cell($_POST['units']);
        text_cells(null, 'std_cost', $_POST['std_cost'], 15, 14);
 
-       if (isset($_GET['Edit'])) 
+       if (isset($_GET['Edit']))
        {
        submit_cells('UpdateItem', _("Update"));
        submit_cells('CancelItemChanges', _("Cancel"));
-       } 
-       else 
+       }
+       else
        {
                submit_cells('AddItem', _("Add Item"), "colspan=2");
        }
index ca58c439f61a1ca561e7e353af2d784fe4ea5de0..c848a1dac99b9c6d65d9b5dc313945caffe81020 100644 (file)
@@ -59,7 +59,7 @@ if (isset($_POST['stock_id']))
                label_cell("<a href='$select_item'>" . $myrow["parent"]. " - " . $myrow["description"]. "</a>");
                label_cell($myrow["WorkCentreName"]);
                label_cell($myrow["location_name"]);
-               label_cell(qty_format($myrow["quantity"]));
+               label_cell(qty_format($myrow["quantity"], $_POST['stock_id']));
                        end_row();
 
                $j++;
index 2df314090a9420c65b3bbec3435b44799eadaa6b..2469afad8af4b0ed6bee52784b0003c27e14214e 100644 (file)
@@ -102,7 +102,7 @@ div_start('bom');
                label_cell($myrow["description"]);
         label_cell($myrow["location_name"]);
         label_cell($myrow["WorkCentreDescription"]);
-        label_cell(qty_format($myrow["quantity"]));
+        label_cell(qty_format($myrow["quantity"], $myrow["component"]));
         label_cell($myrow["units"]);
         edit_link_cell(SID . "NewItem=$selected_parent&selected_component=" . $myrow["id"]);
         delete_link_cell(SID . "delete=" . $myrow["id"]. "&stock_id=" . $_POST['stock_id']);
@@ -245,7 +245,7 @@ if (isset($_POST['stock_id']))
 
                $_POST['loc_code'] = $myrow["loc_code"];
                $_POST['workcentre_added']  = $myrow["workcentre_added"];
-               $_POST['quantity'] = qty_format($myrow["quantity"]);
+               $_POST['quantity'] = qty_format($myrow["quantity"], $myrow["component"], $dec);
 
                hidden('selected_parent', $selected_parent);
                hidden('selected_component', $selected_component);
@@ -271,9 +271,9 @@ if (isset($_POST['stock_id']))
 
        if (!isset($_POST['quantity']))
        {
-               $_POST['quantity'] = qty_format(1);
+               $_POST['quantity'] = qty_format(1, $_POST['stock_id'], $dec);
        }
-       qty_row(_("Quantity:"), 'quantity', $_POST['quantity']);
+       qty_row(_("Quantity:"), 'quantity', $_POST['quantity'], null, null, $dec);
 
        end_table(1);
        submit_center('Submit', _("Add/Update"));
index 386ff583c13ef1e58167b101d27e8a3cd3ff08b0..666206129add29c08edc6592e604c662a769682f 100644 (file)
@@ -9,12 +9,12 @@ include_once($path_to_root . "/manufacturing/includes/manufacturing_ui.inc");
 $js = "";
 if ($use_popup_windows)
        $js .= get_js_open_window(800, 500);
-if (isset($_GET['outstanding_only'])) 
+if (isset($_GET['outstanding_only']))
 {
        $outstanding_only = 1;
        page(_("Search Outstanding Work Orders"), false, false, "", $js);
-} 
-else 
+}
+else
 {
        $outstanding_only = 0;
        page(_("Search Work Orders"), false, false, "", $js);
@@ -53,27 +53,27 @@ $sql = "SELECT ".TB_PREF."workorders.*, ".TB_PREF."stock_master.description,".TB
        WHERE ".TB_PREF."stock_master.stock_id=".TB_PREF."workorders.stock_id AND
        ".TB_PREF."locations.loc_code=".TB_PREF."workorders.loc_code ";
 
-if (check_value('OpenOnly')) 
+if (check_value('OpenOnly'))
 {
        $sql .= " AND ".TB_PREF."workorders.closed=0 ";
 }
 
-if (isset($_POST['StockLocation']) && $_POST['StockLocation'] != $all_items) 
+if (isset($_POST['StockLocation']) && $_POST['StockLocation'] != $all_items)
 {
        $sql .= "AND ".TB_PREF."workorders.loc_code='" . $_POST['StockLocation'] . "' ";
 }
 
-if (isset($_POST['OrderNumber']) && $_POST['OrderNumber'] != "") 
+if (isset($_POST['OrderNumber']) && $_POST['OrderNumber'] != "")
 {
        $sql .= "AND ".TB_PREF."workorders.wo_ref LIKE '%". $_POST['OrderNumber'] . "%'";
 }
 
-if (isset($_POST['SelectedStockItem']) && $_POST['SelectedStockItem'] != $all_items) 
+if (isset($_POST['SelectedStockItem']) && $_POST['SelectedStockItem'] != $all_items)
 {
        $sql .= "AND ".TB_PREF."workorders.stock_id='". $_POST['SelectedStockItem'] . "'";
 }
 
-if (check_value('OverdueOnly')) 
+if (check_value('OverdueOnly'))
 {
        $Today = date2sql(Today());
 
@@ -92,12 +92,12 @@ table_header($th);
 $j = 1;
 $k = 0;
 
-while ($myrow = db_fetch($result)) 
+while ($myrow = db_fetch($result))
 {
 
 
        // check if it's an overdue work order
-       if (!$myrow["closed"] && date_diff(Today(), sql2date($myrow["required_by"]), "d") > 0) 
+       if (!$myrow["closed"] && date_diff(Today(), sql2date($myrow["required_by"]), "d") > 0)
        {
                start_row("class='overduebg'");
        }
@@ -106,7 +106,7 @@ while ($myrow = db_fetch($result))
 
        $modify_page = $path_to_root . "/manufacturing/work_order_entry.php?" . SID . "trans_no=" . $myrow["id"];
        $release_page = $path_to_root . "/manufacturing/work_order_release.php?" . SID . "trans_no=" . $myrow["id"];
-       if ($myrow["closed"] == 0) 
+       if ($myrow["closed"] == 0)
        {
                $issue = $path_to_root . "/manufacturing/work_order_issue.php?" . SID . "trans_no=" .$myrow["id"];
                $add_finished = $path_to_root . "/manufacturing/work_order_add_finished.php?" . SID . "trans_no=" .$myrow["id"];
@@ -115,29 +115,29 @@ while ($myrow = db_fetch($result))
                $issue_link = $can_issue?("<a href=$issue>" . _("Issue") . "</a></td>
                        <td><a href=$add_finished>" . _("Produce") . "</a></td>
                        <td><a href=$costs>" . _("Costs") . "</a>"): _("Not Released");
-       } 
-       else 
+       }
+       else
        {
                $issue_link = "";
        }
-
+       $dec = get_qty_dec($myrow["stock_id"]);
        label_cell(get_trans_view_str(systypes::work_order(), $myrow["id"]));
        label_cell(get_trans_view_str(systypes::work_order(), $myrow["id"], $myrow["wo_ref"]));
        label_cell(wo_types::name($myrow["type"]));
        label_cell($myrow["location_name"]);
        view_stock_status_cell($myrow["stock_id"], $myrow["description"]);
-       qty_cell($myrow["units_reqd"]);
-       qty_cell($myrow["units_issued"]);
+       qty_cell($myrow["units_reqd"], false, $dec);
+       qty_cell($myrow["units_issued"], false, $dec);
        label_cell(sql2date($myrow["date_"]));
        label_cell(sql2date($myrow["required_by"]));
        label_cell(($myrow["closed"]? _("Yes"):_("No")));
        if ($issue_link != "")
                label_cell($issue_link);
-       if ($myrow["released"] == 0) 
+       if ($myrow["released"] == 0)
        {
                label_cell("<a href=$release_page>" . _("Release") . "</a>");
        }
-       if ($myrow["closed"] == 0) 
+       if ($myrow["closed"] == 0)
        {
                label_cell("<a href=$modify_page>" . _("Edit") . "</a>");
        }
index 484b08ec74161975a34eea80c69726ae4a1be3d3..e3ba38bcb7358d44b97b45d708aa71f417e3de9f 100644 (file)
@@ -83,7 +83,7 @@ function display_wo_issue_details($issue_no)
                        alt_table_row_color($k);
 
                label_cell($myrow["stock_id"]  . " - " . $myrow["description"]);
-            qty_cell($myrow["qty_issued"]);
+            qty_cell($myrow["qty_issued"], false, get_qty_dec($myrow["stock_id"]));
                        label_cell($myrow["units"]);
                        end_row();;
 
index 002c9ef7b9985e3aa5aab06d2335b059c3ce098d..02450db5370aaaa0bedb10911bce5b58f29e100c 100644 (file)
@@ -16,7 +16,7 @@ include_once($path_to_root . "/manufacturing/includes/manufacturing_ui.inc");
 
 //-------------------------------------------------------------------------------------------------
 
-if ($_GET['trans_no'] != "") 
+if ($_GET['trans_no'] != "")
 {
        $wo_production = $_GET['trans_no'];
 }
@@ -32,14 +32,14 @@ function display_wo_production($prod_id)
     start_table($table_style);
     $th = array(_("Production #"), _("Reference"), _("For Work Order #"),
        _("Item"), _("Quantity Manufactured"), _("Date"));
-    table_header($th); 
+    table_header($th);
 
        start_row();
        label_cell($myrow["id"]);
        label_cell($myrow["reference"]);
        label_cell(get_trans_view_str(systypes::work_order(),$myrow["workorder_id"]));
        label_cell($myrow["stock_id"] . " - " . $myrow["StockDescription"]);
-       qty_cell($myrow["quantity"]);
+       qty_cell($myrow["quantity"], false, get_qty_dec($myrow["stock_id"]));
        label_cell(sql2date($myrow["date_"]));
        end_row();
 
index 1e78f7fee0e8ad0409fd3c2f4907a0fa52b82704..28d00f2935a3786cf0f84a02efb6a9096641f04b 100644 (file)
@@ -308,11 +308,11 @@ if (isset($selected_id))
        }
 
        $_POST['wo_ref'] = $myrow["wo_ref"];
-       $_POST['quantity'] = qty_format($myrow["units_reqd"]);
+       $_POST['stock_id'] = $myrow["stock_id"];
+       $_POST['quantity'] = qty_format($myrow["units_reqd"], $_POST['stock_id'], $dec);
        $_POST['StockLocation'] = $myrow["loc_code"];
        $_POST['released'] = $myrow["released"];
        $_POST['closed'] = $myrow["closed"];
-       $_POST['stock_id'] = $myrow["stock_id"];
        $_POST['type'] = $myrow["type"];
        $_POST['date_'] = sql2date($myrow["date_"]);
        $_POST['RequDate'] = sql2date($myrow["required_by"]);
@@ -359,19 +359,19 @@ else
 }
 
 if (!isset($_POST['quantity']))
-       $_POST['quantity'] = qty_format(1);
+       $_POST['quantity'] = qty_format(1, $_POST['stock_id'], $dec);
 
 if (get_post('type') == wo_types::advanced())
 {
-    qty_row(_("Quantity Required:"), 'quantity', 12);
+    qty_row(_("Quantity Required:"), 'quantity', null, null, null, $dec);
     if ($_POST['released'])
-       label_row(_("Quantity Manufactured:"), qty_format($_POST['units_issued']));
+       label_row(_("Quantity Manufactured:"), qty_format($_POST['units_issued'], $_POST['stock_id']));
     date_row(_("Date") . ":", 'date_');
        date_row(_("Date Required By") . ":", 'RequDate', '', null, sys_prefs::default_wo_required_by());
 }
 else
 {
-    qty_row(_("Quantity:"), 'quantity', 12);
+    qty_row(_("Quantity:"), 'quantity', null, null, null, $dec);
     date_row(_("Date") . ":", 'date_');
        hidden('RequDate', '');
 
index da5c2ecd90d520db4dd11668a8bf27870d3f37e4..b583553f10ec3e66dc4704b03fa340a3fffb1cd9 100644 (file)
@@ -59,7 +59,7 @@ function invoice_header(&$supp_trans)
 
        supplier_list_row(_("Supplier:"), 'supplier_id', $_POST['supplier_id'], false, true);
 
-       if ($supp_trans->supplier_id != $_POST['supplier_id']) 
+       if ($supp_trans->supplier_id != $_POST['supplier_id'])
        {
                // supplier has changed
                // delete all the order items - drastic but necessary because of
@@ -131,7 +131,7 @@ function invoice_totals(&$supp_trans)
        if ($supp_trans->is_invoice)
        label_row(_("Invoice Total:"), $display_total, "align=right", "align=right");
     else
-               label_row("<font color=red>" . _("Credit Note Total:") . "</font>", 
+               label_row("<font color=red>" . _("Credit Note Total:") . "</font>",
                        "<font color=red><b>$display_total</b></font>", "align=right", "nowrap align=right");
 
     end_table();
@@ -176,7 +176,7 @@ function display_gl_items(&$supp_trans, $mode=0)
 
        echo "<table width=100%>";
        echo "<tr><td align=center><span class='headingtext'>$heading</span></td>";
-       if ($mode == 0) 
+       if ($mode == 0)
        {
        submit_cells('InvGL', _("Edit"), "align=right");
        }
@@ -185,7 +185,7 @@ function display_gl_items(&$supp_trans, $mode=0)
        echo "</td></tr><tr><td>"; // ouer table
 
        echo "<table width=100% $table_style>";
-       
+
        $dim = get_company_pref('use_dimension');
        if ($dim == 2)
        $th = array(_("Account"), _("Name"), _("Dimension")." 1", _("Dimension")." 2", _("Amount"), _("Memo"));
@@ -211,7 +211,7 @@ function display_gl_items(&$supp_trans, $mode=0)
 
                        label_cell($entered_gl_code->gl_code);
                        label_cell($entered_gl_code->gl_act_name);
-               
+
                        if ($dim >= 1)
                                label_cell(get_dimension_string($entered_gl_code->gl_dim, true));
                        if ($dim > 1)
@@ -230,20 +230,20 @@ function display_gl_items(&$supp_trans, $mode=0)
                        $i++;
                        if ($i > 15)
                        {
-                               $i = 0; 
-                               table_header($th); 
+                               $i = 0;
+                               table_header($th);
                        }
                }
 
        }
        $colspan = ($dim == 2 ? 4 : ($dim == 1 ? 3 : 2));
-       label_row(_("Total"), price_format($total_gl_value), 
+       label_row(_("Total"), price_format($total_gl_value),
                "colspan=".$colspan." align=right", "nowrap align=right");
 
        echo "</table>";
 
     echo "</td></tr>";
-    
+
     end_table(); // outertable
 
        return $total_gl_value;
@@ -284,7 +284,7 @@ function display_grn_items(&$supp_trans, $mode=0)
 
        echo "<table width=100% >";
        echo "<tr><td align=center><span class='headingtext'>$heading</span></td>";
-       if ($mode == 0) 
+       if ($mode == 0)
        {
                submit_cells('InvGRN', _("Edit"), "align=right");
        }
@@ -311,7 +311,7 @@ function display_grn_items(&$supp_trans, $mode=0)
                label_cell(get_trans_view_str(25,$entered_grn->id));
                        label_cell($entered_grn->item_code);
                        label_cell($entered_grn->item_description);
-                       qty_cell(abs($entered_grn->this_quantity_inv));
+                       qty_cell(abs($entered_grn->this_quantity_inv), false, get_qty_dec($entered_grn->item_code));
                        amount_cell($entered_grn->chg_price);
                        amount_cell( round($entered_grn->chg_price * abs($entered_grn->this_quantity_inv)), user_price_dec());
 
@@ -337,7 +337,7 @@ function display_grn_items(&$supp_trans, $mode=0)
     echo "</table>";
 
     echo "</td></tr>";
-    
+
     end_table(); // outertable
 
        return $total_grn_value;
@@ -346,15 +346,15 @@ function display_grn_items(&$supp_trans, $mode=0)
 //--------------------------------------------------------------------------------------------------
 function get_duedate_from_terms(&$supp_trans)
 {
-       if (!is_date($supp_trans->tran_date)) 
+       if (!is_date($supp_trans->tran_date))
        {
                $supp_trans->tran_date = Today();
        }
-       if (substr( $supp_trans->terms, 0, 1) == "1") 
+       if (substr( $supp_trans->terms, 0, 1) == "1")
        { /*Its a day in the following month when due */
                $supp_trans->due_date = add_days(end_month($supp_trans->tran_date), (int) substr( $supp_trans->terms,1));
-       } 
-       else 
+       }
+       else
        { /*Use the Days Before Due to add to the invoice date */
                $supp_trans->due_date = add_days($supp_trans->tran_date, (int) substr( $supp_trans->terms,1));
        }
index 0104d2f329a1382b06fcb64ffb8fe2ab24aedab7..f9a5071c6bc5c1b80a6909d4f3c92220cd1f26ae 100644 (file)
@@ -183,7 +183,7 @@ function display_po_items(&$order, $editable=true)
                        alt_table_row_color($k);
                        label_cell($po_line->stock_id);
                        label_cell($po_line->item_description);
-                qty_cell($po_line->quantity);
+                qty_cell($po_line->quantity, false, get_qty_dec($po_line->stock_id));
                        label_cell($po_line->units);
                 label_cell($po_line->req_del_date);
                        amount_cell($po_line->price);
@@ -278,7 +278,7 @@ function po_item_controls(&$order, $stock_id=null)
                if (!isset($_POST['stock_id']))
                        $_POST['stock_id'] = $order->line_items[$_GET['Edit']]->stock_id;
                if (!isset($_POST['qty']) || ($_POST['qty'] == ""))
-                       $_POST['qty'] = qty_format($order->line_items[$_GET['Edit']]->quantity);
+                       $_POST['qty'] = qty_format($order->line_items[$_GET['Edit']]->quantity, $_POST['stock_id'], $dec);
                if (!isset($_POST['price']) || ($_POST['price'] == ""))
                        $_POST['price'] = price_format($order->line_items[$_GET['Edit']]->price);
                if (!isset($_POST['req_del_date']) || ($_POST['req_del_date'] == ""))
@@ -298,12 +298,12 @@ function po_item_controls(&$order, $stock_id=null)
        $item_info = get_item_edit_info($_POST['stock_id']);
                $_POST['units'] = $item_info["units"];
 
-               $_POST['qty'] = qty_format(1);
+               $_POST['qty'] = qty_format(1, $_POST['stock_id'], $dec);
                $_POST['price'] = price_format(get_purchase_price ($order->supplier_id, $_POST['stock_id']));
                $_POST['req_del_date'] = add_days(Today(), 10);
        }
 
-       qty_cells(null, 'qty', null);
+       qty_cells(null, 'qty', null, null, null, $dec);
 
        label_cell($_POST['units']);
        date_cells(null, 'req_del_date', '', null, 0, 0, 0);
index e0a584280be3dcf3860b7f63fec817754b997776..f8aa583fa6b0c8a7d90473f99ffd3dec41401e05 100644 (file)
@@ -16,7 +16,7 @@ page(_("Receive Purchase Order Items"), false, false, "", $js);
 
 //---------------------------------------------------------------------------------------------------------------
 
-if (isset($_GET['AddedID'])) 
+if (isset($_GET['AddedID']))
 {
        $grn = $_GET['AddedID'];
        $trans_type = 25;
@@ -36,8 +36,8 @@ if (isset($_GET['AddedID']))
 
 //--------------------------------------------------------------------------------------------------
 
-if ((!isset($_GET['PONumber']) || $_GET['PONumber'] == 0) && !isset($_SESSION['PO'])) 
-//if (isset($_GET['PONumber']) && !$_GET['PONumber'] > 0 && !isset($_SESSION['PO'])) 
+if ((!isset($_GET['PONumber']) || $_GET['PONumber'] == 0) && !isset($_SESSION['PO']))
+//if (isset($_GET['PONumber']) && !$_GET['PONumber'] > 0 && !isset($_SESSION['PO']))
 {
        die (_("This page can only be opened if a purchase order has been selected. Please select a purchase order first."));
 }
@@ -50,7 +50,7 @@ function display_po_receive_items()
     start_table("colspan=7 $table_style width=90%");
     $th = array(_("Item Code"), _("Description"), _("Ordered"), _("Units"), _("Received"),
        _("Outstanding"), _("This Delivery"), _("Price"), _("Total"));
-    table_header($th); 
+    table_header($th);
 
     /*show the line items on the order with the quantity being received for modification */
 
@@ -59,7 +59,7 @@ function display_po_receive_items()
 
     if (count($_SESSION['PO']->line_items)> 0 )
     {
-               foreach ($_SESSION['PO']->line_items as $ln_itm) 
+               foreach ($_SESSION['PO']->line_items as $ln_itm)
                {
 
                        alt_table_row_color($k);
@@ -79,16 +79,17 @@ function display_po_receive_items()
                                text_cells(null, $ln_itm->stock_id . "Desc", $ln_itm->item_description, 30, 50);
                        else
                                label_cell($ln_itm->item_description);
-                       qty_cell($ln_itm->quantity);
+                       $dec = get_qty_dec($ln_itm->stock_id);
+                       qty_cell($ln_itm->quantity, false, $dec);
                        label_cell($ln_itm->units);
-                       qty_cell($ln_itm->qty_received);
-                       qty_cell($qty_outstanding);
+                       qty_cell($ln_itm->qty_received, false, $dec);
+                       qty_cell($qty_outstanding, false, $dec);
 
                        if ($qty_outstanding > 0)
-                               qty_cells(null, $ln_itm->line_no, qty_format($ln_itm->receive_qty), "align=right");
+                               qty_cells(null, $ln_itm->line_no, qty_format($ln_itm->receive_qty, $ln_itm->stock_id, $dec), "align=right", null, $dec);
                        else
-                               qty_cells(null, $ln_itm->line_no, qty_format($ln_itm->receive_qty), "align=right", 
-                                       "disabled");
+                               qty_cells(null, $ln_itm->line_no, qty_format($ln_itm->receive_qty, $ln_itm->stock_id, $dec), "align=right",
+                                       "disabled", $dec);
 
                        amount_cell($ln_itm->price);
                        amount_cell($line_total);
@@ -119,18 +120,18 @@ function check_po_changed()
     check_db_error("Could not check that the details of the purchase order had not been changed by another user ", $sql);
 
        $line_no = 1;
-       while ($myrow = db_fetch($result)) 
+       while ($myrow = db_fetch($result))
        {
                $ln_item = $_SESSION['PO']->line_items[$line_no];
 
                // only compare against items that are outstanding
                $qty_outstanding = $ln_item->quantity - $ln_item->qty_received;
-               if ($qty_outstanding > 0) 
+               if ($qty_outstanding > 0)
                {
-               if ($ln_item->qty_inv != $myrow["qty_invoiced"] || 
-                       $ln_item->stock_id != $myrow["item_code"] || 
-                       $ln_item->quantity != $myrow["quantity_ordered"] || 
-                       $ln_item->qty_received != $myrow["quantity_received"]) 
+               if ($ln_item->qty_inv != $myrow["qty_invoiced"] ||
+                       $ln_item->stock_id != $myrow["item_code"] ||
+                       $ln_item->quantity != $myrow["quantity_ordered"] ||
+                       $ln_item->qty_received != $myrow["quantity_received"])
                {
                        return true;
                }
@@ -151,21 +152,21 @@ function can_process()
        return false;
        }
 
-       if (!is_date($_POST['DefaultReceivedDate'])) 
+       if (!is_date($_POST['DefaultReceivedDate']))
        {
                display_error(_("The entered date is invalid."));
                set_focus('DefaultReceivedDate');
                return false;
        }
 
-    if (!references::is_valid($_POST['ref'])) 
+    if (!references::is_valid($_POST['ref']))
     {
                display_error(_("You must enter a reference."));
                set_focus('ref');
                return false;
        }
 
-       if (!is_new_reference($_POST['ref'], 25)) 
+       if (!is_new_reference($_POST['ref'], 25))
        {
                display_error(_("The entered reference is already in use."));
                set_focus('ref');
@@ -173,9 +174,9 @@ function can_process()
        }
 
        $something_received = 0;
-       foreach ($_SESSION['PO']->line_items as $order_line) 
+       foreach ($_SESSION['PO']->line_items as $order_line)
        {
-               if ($order_line->receive_qty > 0) 
+               if ($order_line->receive_qty > 0)
                {
                        $something_received = 1;
                        break;
@@ -184,10 +185,10 @@ function can_process()
 
     // Check whether trying to deliver more items than are recorded on the actual purchase order (+ overreceive allowance)
     $delivery_qty_too_large = 0;
-       foreach ($_SESSION['PO']->line_items as $order_line) 
+       foreach ($_SESSION['PO']->line_items as $order_line)
        {
-               if ($order_line->receive_qty+$order_line->qty_received > 
-                       $order_line->quantity * (1+ (sys_prefs::over_receive_allowance() / 100))) 
+               if ($order_line->receive_qty+$order_line->qty_received >
+                       $order_line->quantity * (1+ (sys_prefs::over_receive_allowance() / 100)))
                {
                        $delivery_qty_too_large = 1;
                        break;
@@ -198,7 +199,7 @@ function can_process()
     {  /*Then dont bother proceeding cos nothing to do ! */
         display_error(_("There is nothing to process. Please enter valid quantities greater than zero."));
        return false;
-    } 
+    }
     elseif ($delivery_qty_too_large == 1)
     {
        display_error(_("Entered quantities cannot be greater than the quantity entered on the purchase order including the allowed over-receive percentage") . " (" . sys_prefs::over_receive_allowance() ."%)."
@@ -219,7 +220,7 @@ function process_receive_po()
        if (!can_process())
                return;
 
-       if (check_po_changed()) 
+       if (check_po_changed())
        {
                echo "<br> " . _("This order has been changed or invoiced since this delivery was started to be actioned. Processing halted. To enter a delivery against this purchase order, it must be re-selected and re-read again to update the changes made by the other user.") . "<BR>";
 
@@ -242,7 +243,7 @@ function process_receive_po()
 
 //--------------------------------------------------------------------------------------------------
 
-if (isset($_GET['PONumber']) && $_GET['PONumber'] > 0 && !isset($_POST['Update'])) 
+if (isset($_GET['PONumber']) && $_GET['PONumber'] > 0 && !isset($_POST['Update']))
 {
 
        create_new_po();
@@ -253,24 +254,24 @@ if (isset($_GET['PONumber']) && $_GET['PONumber'] > 0 && !isset($_POST['Update']
 
 //--------------------------------------------------------------------------------------------------
 
-if (isset($_POST['Update']) || isset($_POST['ProcessGoodsReceived'])) 
+if (isset($_POST['Update']) || isset($_POST['ProcessGoodsReceived']))
 {
 
        /* if update quantities button is hit page has been called and ${$line->line_no} would have be
        set from the post to the quantity to be received in this receival*/
-       foreach ($_SESSION['PO']->line_items as $line) 
+       foreach ($_SESSION['PO']->line_items as $line)
        {
 
                $_POST[$line->line_no] = max($_POST[$line->line_no], 0);
                if (!check_num($line->line_no))
-                       $_POST[$line->line_no] = qty_format(0);
+                       $_POST[$line->line_no] = qty_format(0, $line->stock_id);
 
                if (!isset($_POST['DefaultReceivedDate']) || $_POST['DefaultReceivedDate'] == "")
                        $_POST['DefaultReceivedDate'] = Today();
 
                $_SESSION['PO']->line_items[$line->line_no]->receive_qty = input_num($line->line_no);
 
-               if (isset($_POST[$line->stock_id . "Desc"]) && strlen($_POST[$line->stock_id . "Desc"]) > 0) 
+               if (isset($_POST[$line->stock_id . "Desc"]) && strlen($_POST[$line->stock_id . "Desc"]) > 0)
                {
                        $_SESSION['PO']->line_items[$line->line_no]->item_description = $_POST[$line->stock_id . "Desc"];
                }
index 373e7676762d3dab7572de075662a01cb71ace8d..49b07b49ce9f70e46ed59730c98e976d3f404d84 100644 (file)
@@ -29,7 +29,7 @@ echo "<br>";
 
 function check_data()
 {
-       if (!check_num('This_QuantityCredited', 0)) 
+       if (!check_num('This_QuantityCredited', 0))
        {
                display_error(_("The quantity to credit must be numeric and greater than zero."));
                set_focus('This_QuantityCredited');
@@ -117,7 +117,7 @@ while ($myrow = db_fetch($result))
 
        foreach ($_SESSION['supp_trans']->grn_items as $entered_grn)
        {
-               if ($entered_grn->id == $myrow["id"]) 
+               if ($entered_grn->id == $myrow["id"])
                {
                        $grn_already_on_credit = True;
                }
@@ -133,9 +133,10 @@ while ($myrow = db_fetch($result))
         label_cell($myrow["item_code"]);
         label_cell($myrow["description"]);
         label_cell(sql2date($myrow["delivery_date"]));
-        qty_cell($myrow["qty_recd"]);
-        qty_cell($myrow["quantity_inv"]);
-        qty_cell($myrow["qty_recd"] - $myrow["quantity_inv"]);
+        $dec = get_qty_dec($myrow["item_code"]);
+        qty_cell($myrow["qty_recd"], false, $dec);
+        qty_cell($myrow["quantity_inv"], false, $dec);
+        qty_cell($myrow["qty_recd"] - $myrow["quantity_inv"], false, $dec);
                amount_cell($myrow["unit_price"]);
                amount_cell(round($myrow["unit_price"] * $myrow["quantity_inv"],  user_price_dec()));
                end_row();
@@ -162,13 +163,14 @@ if (isset($_POST['grn_item_id']) && $_POST['grn_item_id'] != "")
        start_table("$table_style width=80%");
        $th = array(_("Sequence #"), _("Item"), _("Qty Already Invoiced"),
                _("Quantity to Credit"), _("Order Price"), _("Credit Price"));
-       table_header($th);      
+       table_header($th);
 
        start_row();
        label_cell($_POST['grn_item_id']);
     label_cell($myrow['item_code'] . " " . $myrow['description']);
-    qty_cell($myrow["quantity_inv"]);
-    qty_cells(null, 'This_QuantityCredited', qty_format(max($myrow['quantity_inv'],0)));
+    $dec = get_qty_dec($myrow['item_code']);
+    qty_cell($myrow["quantity_inv"], false, $dec);
+    qty_cells(null, 'This_QuantityCredited', qty_format(max($myrow['quantity_inv'],0),$myrow['item_code'], $dec), null, null, $dec);
     amount_cell($myrow['unit_price']);
     amount_cells(null, 'ChgPrice', price_format($myrow['unit_price']));
     end_row();
index 13f4d3040b78c7182b9b6c1d3668243e1ed07fdc..3c444880ae94c86639f941bfd479b9fc59ca2aed 100644 (file)
@@ -33,7 +33,7 @@ function check_data()
 {
        global $check_price_charged_vs_order_price,
                $check_qty_charged_vs_del_qty;
-       if (!check_num('this_quantity_inv', 0) || input_num('this_quantity_inv')==0) 
+       if (!check_num('this_quantity_inv', 0) || input_num('this_quantity_inv')==0)
        {
                display_error( _("The quantity to invoice must be numeric and greater than zero."));
                set_focus('this_quantity_inv');
@@ -47,11 +47,11 @@ function check_data()
                return false;
        }
 
-       if ($check_price_charged_vs_order_price == True) 
+       if ($check_price_charged_vs_order_price == True)
        {
                if ($_POST['order_price']!=input_num('ChgPrice')) {
                     if ($_POST['order_price']==0 ||
-                       input_num('ChgPrice')/$_POST['order_price'] > 
+                       input_num('ChgPrice')/$_POST['order_price'] >
                            (1 + (sys_prefs::over_charge_allowance() / 100)))
                    {
                        display_error(_("The price being invoiced is more than the purchase order price by more than the allowed over-charge percentage. The system is set up to prohibit this. See the system administrator to modify the set up parameters if necessary.") .
@@ -62,9 +62,9 @@ function check_data()
                }
        }
 
-       if ($check_qty_charged_vs_del_qty == True) 
+       if ($check_qty_charged_vs_del_qty == True)
        {
-               if (input_num('this_quantity_inv') / ($_POST['qty_recd'] - $_POST['prev_quantity_inv']) > 
+               if (input_num('this_quantity_inv') / ($_POST['qty_recd'] - $_POST['prev_quantity_inv']) >
                        (1+ (sys_prefs::over_charge_allowance() / 100)))
                {
                        display_error( _("The quantity being invoiced is more than the outstanding quantity by more than the allowed over-charge percentage. The system is set up to prohibit this. See the system administrator to modify the set up parameters if necessary.")
@@ -87,8 +87,8 @@ if (isset($_POST['AddGRNToTrans']))
        if (input_num('this_quantity_inv') >= ($_POST['qty_recd'] - $_POST['prev_quantity_inv']))
        {
                $complete = True;
-       } 
-       else 
+       }
+       else
        {
                $complete = False;
        }
@@ -150,7 +150,7 @@ function display_grn_items_for_selection()
 
        foreach ($_SESSION['supp_trans']->grn_items as $entered_grn)
        {
-               if ($entered_grn->id == $myrow["id"]) 
+               if ($entered_grn->id == $myrow["id"])
                {
                        $grn_already_on_invoice = True;
                }
@@ -167,14 +167,15 @@ function display_grn_items_for_selection()
             label_cell($myrow["item_code"]);
             label_cell($myrow["description"]);
             label_cell(sql2date($myrow["delivery_date"]));
-            qty_cell($myrow["qty_recd"]);
-            qty_cell($myrow["quantity_inv"]);
-            qty_cell($myrow["qty_recd"] - $myrow["quantity_inv"]);
+            $dec = get_qty_dec($myrow["item_code"]);
+            qty_cell($myrow["qty_recd"], false, $dec);
+            qty_cell($myrow["quantity_inv"], false, $dec);
+            qty_cell($myrow["qty_recd"] - $myrow["quantity_inv"], false, $dec);
             amount_cell($myrow["unit_price"]);
             amount_cell(round($myrow["unit_price"] * ($myrow["qty_recd"] - $myrow["quantity_inv"]),
                           user_price_dec()));
                        end_row();
-                       
+
                $i++;
                if ($i > 15)
                {
@@ -203,14 +204,15 @@ if (isset($_POST['grn_item_id']) && $_POST['grn_item_id'] != "")
        start_table("$table_style width=80%");
        $th = array(_("Sequence #"), _("Item"), _("Description"), _("Quantity Outstanding"),
                _("Quantity to Invoice"), _("Order Price"), _("Actual Price"));
-       table_header($th);      
+       table_header($th);
 
        start_row();
        label_cell($_POST['grn_item_id']);
        label_cell($myrow['item_code']);
        label_cell($myrow['description']);
-       qty_cell($myrow['QtyOstdg']);
-       qty_cells(null, 'this_quantity_inv', qty_format($myrow['QtyOstdg']));
+       $dec = get_qty_dec($myrow['item_code']);
+       qty_cell($myrow['QtyOstdg'], false, $dec);
+       qty_cells(null, 'this_quantity_inv', qty_format($myrow['QtyOstdg'], $myrow['item_code'], $dec), null, null, $dec);
        amount_cell($myrow['unit_price']);
        small_amount_cells(null, 'ChgPrice', price_format($myrow['unit_price']));
        end_row();
index 0df3c99458930ec1f1379646e8a80275f989f948..4988358cb98c5e7ce799c9b291b1f6e346d25606 100644 (file)
@@ -9,7 +9,7 @@ page(_("View Purchase Order Delivery"), true);
 
 include($path_to_root . "/purchasing/includes/purchasing_ui.inc");
 
-if (!isset($_GET['trans_no'])) 
+if (!isset($_GET['trans_no']))
 {
        die ("<BR>" . _("This page must be called with a Purchase Order Delivery number to review."));
 }
@@ -26,13 +26,13 @@ display_heading2(_("Line Details"));
 start_table("colspan=9 $table_style width=90%");
 $th = array(_("Item Code"), _("Item Description"), _("Delivery Date"), _("Quantity"),
        _("Unit"), _("Price"), _("Line Total"), _("Quantity Invoiced"));
-       
-table_header($th);     
+
+table_header($th);
 
 $total = 0;
 $k = 0;  //row colour counter
 
-foreach ($purchase_order->line_items as $stock_item) 
+foreach ($purchase_order->line_items as $stock_item)
 {
 
        $line_total = $stock_item->qty_received * $stock_item->price;
@@ -42,18 +42,19 @@ foreach ($purchase_order->line_items as $stock_item)
        label_cell($stock_item->stock_id);
        label_cell($stock_item->item_description);
        label_cell($stock_item->req_del_date, "nowrap align=right");
-       qty_cell($stock_item->qty_received);
+       $dec = get_qty_dec($stock_item->stock_id);
+       qty_cell($stock_item->qty_received, false, $dec);
        label_cell($stock_item->units);
        amount_cell($stock_item->price);
        amount_cell($line_total);
-       qty_cell($stock_item->qty_inv);
+       qty_cell($stock_item->qty_inv, false, $dec);
        end_row();
 
        $total += $line_total;
 }
 
 $display_total = number_format2($total,user_price_dec());
-label_row(_("Total Excluding Tax/Shipping"),  $display_total, 
+label_row(_("Total Excluding Tax/Shipping"),  $display_total,
        "colspan=6", "nowrap align=right");
 
 end_table(1);
index 878c59af80d042939ddc7efb4f2c8dd2e30cee9c..fe1648222a364cecd5cb8fa08093dd76f30a199b 100644 (file)
@@ -10,7 +10,7 @@ page(_("View Purchase Order"), true);
 
 include($path_to_root . "/purchasing/includes/purchasing_ui.inc");
 
-if (!isset($_GET['trans_no'])) 
+if (!isset($_GET['trans_no']))
 {
        die ("<br>" . _("This page must be called with a purchase order number to review."));
 }
@@ -41,7 +41,7 @@ table_header($th);
 $total = $k = 0;
 $overdue_items = false;
 
-foreach ($purchase_order->line_items as $stock_item) 
+foreach ($purchase_order->line_items as $stock_item)
 {
 
        $line_total = $stock_item->quantity * $stock_item->price;
@@ -52,21 +52,22 @@ foreach ($purchase_order->line_items as $stock_item)
        {
        start_row("class='overduebg'");
        $overdue_items = true;
-       } 
-       else 
+       }
+       else
        {
                alt_table_row_color($k);
        }
 
        label_cell($stock_item->stock_id);
        label_cell($stock_item->item_description);
-       qty_cell($stock_item->quantity);
+       $dec = get_qty_dec($stock_item->stock_id);
+       qty_cell($stock_item->quantity, false, $dec);
        label_cell($stock_item->units);
        amount_cell($stock_item->price);
        amount_cell($line_total);
        label_cell($stock_item->req_del_date);
-       qty_cell($stock_item->qty_received);
-       qty_cell($stock_item->qty_inv);
+       qty_cell($stock_item->qty_received, false, $dec);
+       qty_cell($stock_item->qty_inv, false, $dec);
        end_row();
 
        $total += $line_total;
index 1d3f66b3dbe9fa40f7af137fbc6d942a526ea221..e25b89aae94034ca24de57b4f91d4fdff55eaaca 100644 (file)
@@ -72,8 +72,6 @@ function print_order_status_list()
        $backorder = $_POST['PARAM_4'];
        $comments = $_POST['PARAM_5'];
 
-       $dec = user_qty_dec();
-
        if ($category == reserved_words::get_all_numeric())
                $category = 0;
        if ($location == reserved_words::get_all())
@@ -146,6 +144,7 @@ function print_order_status_list()
                }
                $rep->TextCol(0, 1,     $myrow['stk_code']);
                $rep->TextCol(1, 2,     $myrow['description']);
+               $dec = get_qty_dec($myrow['stk_code']);
                $rep->TextCol(2, 3,     number_format2($myrow['quantity'], $dec));
                $rep->TextCol(3, 4,     number_format2($myrow['qty_sent'], $dec));
                $rep->TextCol(4, 5,     number_format2($myrow['quantity'] - $myrow['qty_sent'], $dec));
index 06e30233e0cbedd476e441849ba85acad44a4cd8..1288e5173e6a0fa90192d049ee7b7c606978bd90 100644 (file)
@@ -104,11 +104,11 @@ function print_invoices()
                        $SubTotal = 0;
                        while ($myrow2=db_fetch($result))
                        {
-                       $Net = round($sign * ((1 - $myrow2["discount_percent"]) * $myrow2["unit_price"] * $myrow2["quantity"]), 
-                          user_price_dec());
-                       $SubTotal += $Net;
+                               $Net = round($sign * ((1 - $myrow2["discount_percent"]) * $myrow2["unit_price"] * $myrow2["quantity"]),
+                                  user_price_dec());
+                               $SubTotal += $Net;
                        $DisplayPrice = number_format2($myrow2["unit_price"],$dec);
-                       $DisplayQty = number_format2($sign*$myrow2["quantity"],user_qty_dec());
+                       $DisplayQty = number_format2($sign*$myrow2["quantity"],get_qty_dec($myrow2['stock_id']));
                        $DisplayNet = number_format2($Net,$dec);
                        if ($myrow2["discount_percent"]==0)
                                        $DisplayDiscount ="";
@@ -159,7 +159,7 @@ function print_invoices()
                while ($tax_item = db_fetch($tax_items))
                {
                        $DisplayTax = number_format2($sign*$tax_item['amount'], $dec);
-                       
+
                        if ($tax_item['included_in_price'])
                        {
                                        $rep->TextCol(3, 7, $doc_Included . " " . $tax_item['tax_type_name'] .
index 04d871a7512880c0a585923215b4f9c7cac05e6a..6ec43659144f03d5352f9f45990f8447115efedf 100644 (file)
@@ -23,7 +23,7 @@ print_statements();
 
 function getTransactions($debtorno, $date)
 {
-    $sql = "SELECT ".TB_PREF."debtor_trans.*, ".TB_PREF."sys_types.type_name, 
+    $sql = "SELECT ".TB_PREF."debtor_trans.*, ".TB_PREF."sys_types.type_name,
                                (".TB_PREF."debtor_trans.ov_amount + ".TB_PREF."debtor_trans.ov_gst + ".TB_PREF."debtor_trans.ov_freight + ".TB_PREF."debtor_trans.ov_discount)
                                AS TotalAmount, ".TB_PREF."debtor_trans.alloc AS Allocated,
                                ((".TB_PREF."debtor_trans.type = 10)
@@ -31,6 +31,7 @@ function getTransactions($debtorno, $date)
                        FROM ".TB_PREF."debtor_trans, ".TB_PREF."sys_types
                        WHERE ".TB_PREF."debtor_trans.tran_date <= '$date' AND ".TB_PREF."debtor_trans.debtor_no = '$debtorno'
                                AND ".TB_PREF."debtor_trans.type = ".TB_PREF."sys_types.type_id
+                               AND ".TB_PREF."debtor_trans.type <> 13
                                ORDER BY ".TB_PREF."debtor_trans.tran_date";
 
     return db_query($sql,"No transactions were returned");
@@ -41,32 +42,32 @@ function getTransactions($debtorno, $date)
 function print_statements()
 {
        global $path_to_root;
-       
+
        include_once($path_to_root . "reporting/includes/pdf_report.inc");
-       
+
        $customer = $_POST['PARAM_0'];
        $currency = $_POST['PARAM_1'];
        $bankaccount = $_POST['PARAM_2'];
-       $email = $_POST['PARAM_3'];     
+       $email = $_POST['PARAM_3'];
        $comments = $_POST['PARAM_4'];
 
        $dec = user_price_dec();
-       
+
        $cols = array(4, 100, 130, 190, 250, 320, 385, 450, 515);
-       
+
        //$headers in doctext.inc
 
        $aligns = array('left', 'left', 'left', 'left', 'right', 'right', 'right', 'right');
-       
+
        $params = array('comments' => $comments,
                                        'bankaccount' => $bankaccount);
-       
+
        $baccount = get_bank_account($params['bankaccount']);
 
        $cur = get_company_pref('curr_default');
        $PastDueDays1 = get_company_pref('past_due_days');
        $PastDueDays2 = 2 * $PastDueDays1;
-       
+
        if ($email == 0)
        {
                $rep = new FrontReport(_('STATEMENT'), "StatementBulk.pdf", user_pagesize());
@@ -74,20 +75,20 @@ function print_statements()
                $rep->Font();
                $rep->Info($params, $cols, null, $aligns);
        }
-       
+
        $sql = "SELECT debtor_no, name AS DebtorName, address, tax_id, email, curr_code, curdate() AS tran_date, payment_terms FROM ".TB_PREF."debtors_master";
        if ($customer != reserved_words::get_all_numeric())
                $sql .= " WHERE debtor_no = $customer";
        else
                $sql .= " ORDER by name";
        $result = db_query($sql, "The customers could not be retrieved");
-       
-       while ($myrow=db_fetch($result)) 
+
+       while ($myrow=db_fetch($result))
        {
                $date = date('Y-m-d');
-               
+
                $myrow['order_'] = "";
-               
+
                $TransResult = getTransactions($myrow['debtor_no'], $date);
                if (db_num_rows($TransResult) == 0)
                        continue;
@@ -106,38 +107,35 @@ function print_statements()
                $doctype = 12;
                if ($rep->currency != $myrow['curr_code'])
                {
-                       include($path_to_root . "reporting/includes/doctext2.inc");                     
-               }       
+                       include($path_to_root . "reporting/includes/doctext2.inc");
+               }
                else
                {
-                       include($path_to_root . "reporting/includes/doctext.inc");                      
-               }       
+                       include($path_to_root . "reporting/includes/doctext.inc");
+               }
                $rep->fontSize += 2;
                $rep->TextCol(0, 8, $doc_Outstanding);
                $rep->fontSize -= 2;
                $rep->NewLine(2);
-               while ($myrow2=db_fetch($TransResult)) 
+               while ($myrow2=db_fetch($TransResult))
                {
                        $DisplayTotal = number_format2(Abs($myrow2["TotalAmount"]),$dec);
                        $DisplayAlloc = number_format2($myrow2["Allocated"],$dec);
-                       if ($myrow2['type'] == 10)
-                               $DisplayNet = number_format2($myrow2["TotalAmount"] - $myrow2["Allocated"],$dec);
-                       else    
-                               $DisplayNet = number_format2($myrow2["TotalAmount"] + $myrow2["Allocated"],$dec);
+                       $DisplayNet = number_format2($myrow2["TotalAmount"] - $myrow2["Allocated"],$dec);
 
                        $rep->TextCol(0, 1,     $myrow2['type_name'], -2);
                        $rep->TextCol(1, 2,     $myrow2['reference'], -2);
                        $rep->TextCol(2, 3,     sql2date($myrow2['tran_date']), -2);
-                       if ($myrow2['type'] == 10)      
+                       if ($myrow2['type'] == 10)
                                $rep->TextCol(3, 4,     sql2date($myrow2['due_date']), -2);
-                       if ($myrow2['TotalAmount'] > 0.0)       
+                       if ($myrow2['type'] == 10)
                                $rep->TextCol(4, 5,     $DisplayTotal, -2);
-                       else            
+                       else
                                $rep->TextCol(5, 6,     $DisplayTotal, -2);
                        $rep->TextCol(6, 7,     $DisplayAlloc, -2);
                        $rep->TextCol(7, 8,     $DisplayNet, -2);
-                       $rep->NewLine(); 
-                       if ($rep->row < $rep->bottomMargin + (10 * $rep->lineHeight)) 
+                       $rep->NewLine();
+                       if ($rep->row < $rep->bottomMargin + (10 * $rep->lineHeight))
                                $rep->Header2($myrow, null, null, $baccount);
                }
                $nowdue = "1-" . $PastDueDays1 . " " . $doc_Days;
@@ -151,17 +149,17 @@ function print_statements()
                        number_format2($CustomerRecord["Overdue2"],$dec),
                        number_format2($CustomerRecord["Balance"],$dec));
                $col = array($rep->cols[0], $rep->cols[0] + 110, $rep->cols[0] + 210, $rep->cols[0] + 310,
-                       $rep->cols[0] + 410, $rep->cols[0] + 510);      
+                       $rep->cols[0] + 410, $rep->cols[0] + 510);
                $rep->row = $rep->bottomMargin + (8 * $rep->lineHeight);
                for ($i = 0; $i < 5; $i++)
                        $rep->TextWrap($col[$i], $rep->row, $col[$i + 1] - $col[$i], $str[$i], 'right');
-               $rep->NewLine();        
+               $rep->NewLine();
                for ($i = 0; $i < 5; $i++)
                        $rep->TextWrap($col[$i], $rep->row, $col[$i + 1] - $col[$i], $str2[$i], 'right');
                if ($email == 1)
                        $rep->End($email, $doc_Statement . " " . $doc_as_of . " " . sql2date($date), $myrow, 12);
-                       
-       }       
+
+       }
        if ($email == 0)
                $rep->End();
 }
index 36d5e491596530557f253a434056cea99e3cf529..e9be5d7669f1d94dbe449de250b67a8ead918352 100644 (file)
@@ -24,15 +24,15 @@ $print_as_quote = 0;
 function print_sales_orders()
 {
        global $path_to_root, $print_as_quote;
-       
+
        include_once($path_to_root . "reporting/includes/pdf_report.inc");
-       
+
        $from = $_POST['PARAM_0'];
        $to = $_POST['PARAM_1'];
        $currency = $_POST['PARAM_2'];
        $bankaccount = $_POST['PARAM_3'];
-       $email = $_POST['PARAM_4'];     
-       $print_as_quote = $_POST['PARAM_5'];    
+       $email = $_POST['PARAM_4'];
+       $print_as_quote = $_POST['PARAM_5'];
        $comments = $_POST['PARAM_6'];
 
        if ($from == null)
@@ -40,23 +40,23 @@ function print_sales_orders()
        if ($to == null)
                $to = 0;
        $dec = user_price_dec();
-       
+
        $cols = array(4, 60, 225, 300, 325, 385, 450, 515);
 
-       // $headers in doctext.inc      
+       // $headers in doctext.inc
        $aligns = array('left', 'left', 'right', 'left', 'right', 'right', 'right');
-       
+
        $params = array('comments' => $comments,
                                        'bankaccount' => $bankaccount);
-       
+
        $baccount = get_bank_account($params['bankaccount']);
        $cur = get_company_Pref('curr_default');
-       
+
        if ($email == 0)
        {
                if ($print_as_quote == 1)
                        $rep = new FrontReport(_("QUOTE"), "QuoteBulk.pdf", user_pagesize());
-               else    
+               else
                        $rep = new FrontReport(_("SALES ORDER"), "SalesOrderBulk.pdf", user_pagesize());
                $rep->currency = $cur;
                $rep->Font();
@@ -81,7 +81,7 @@ function print_sales_orders()
                        {
                                $rep->title = _("SALES ORDER");
                                $rep->filename = "SalesOrder" . $i . ".pdf";
-                       }       
+                       }
                        $rep->Info($params, $cols, null, $aligns);
                }
                else
@@ -92,15 +92,15 @@ function print_sales_orders()
                $SubTotal = 0;
                while ($myrow2=db_fetch($result))
                {
-                       $Net = round(((1 - $myrow2["discount_percent"]) * $myrow2["unit_price"] * $myrow2["quantity"]), 
+                       $Net = round(((1 - $myrow2["discount_percent"]) * $myrow2["unit_price"] * $myrow2["quantity"]),
                           user_price_dec());
                        $SubTotal += $Net;
                        $DisplayPrice = number_format2($myrow2["unit_price"],$dec);
-                       $DisplayQty = number_format2($myrow2["quantity"],user_qty_dec());
+                       $DisplayQty = number_format2($myrow2["quantity"],get_qty_dec($myrow2['stk_code']));
                        $DisplayNet = number_format2($Net,$dec);
                        if ($myrow2["discount_percent"]==0)
                                $DisplayDiscount ="";
-                       else 
+                       else
                                $DisplayDiscount = number_format2($myrow2["discount_percent"]*100,user_percent_dec()) . "%";
                        $rep->TextCol(0, 1,     $myrow2['stk_code'], -2);
                        $rep->TextCol(1, 2,     $myrow2['description'], -2);
@@ -110,14 +110,14 @@ function print_sales_orders()
                        $rep->TextCol(5, 6,     $DisplayDiscount, -2);
                        $rep->TextCol(6, 7,     $DisplayNet, -2);
                        $rep->NewLine(1);
-                       if ($rep->row < $rep->bottomMargin + (15 * $rep->lineHeight)) 
+                       if ($rep->row < $rep->bottomMargin + (15 * $rep->lineHeight))
                                $rep->Header2($myrow, $branch, $sales_order, $baccount);
                }
                if ($myrow['comments'] != "")
                {
                        $rep->NewLine();
                        $rep->TextColLines(1, 5, $myrow['comments'], -2);
-               }       
+               }
                $DisplaySubTot = number_format2($SubTotal,$dec);
                $DisplayFreight = number_format2($myrow["freight_cost"],$dec);
 
@@ -126,12 +126,12 @@ function print_sales_orders()
                $doctype = 9;
                if ($rep->currency != $myrow['curr_code'])
                {
-                       include($path_to_root . "reporting/includes/doctext2.inc");                     
-               }       
+                       include($path_to_root . "reporting/includes/doctext2.inc");
+               }
                else
                {
-                       include($path_to_root . "reporting/includes/doctext.inc");                      
-               }       
+                       include($path_to_root . "reporting/includes/doctext.inc");
+               }
 
                $rep->TextCol(3, 6, $doc_Sub_total, -2);
                $rep->TextCol(6, 7,     $DisplaySubTot, -2);
@@ -140,10 +140,10 @@ function print_sales_orders()
                $rep->TextCol(6, 7,     $DisplayFreight, -2);
                $rep->NewLine();
                $DisplayTotal = number_format2($myrow["freight_cost"] + $SubTotal, $dec);
-               $rep->Font('bold');     
+               $rep->Font('bold');
                $rep->TextCol(3, 6, $doc_TOTAL_ORDER, - 2);
                $rep->TextCol(6, 7,     $DisplayTotal, -2);
-               $rep->Font();   
+               $rep->Font();
                if ($email == 1)
                {
                        if ($myrow['contact_email'] == '')
@@ -152,7 +152,7 @@ function print_sales_orders()
                                $myrow['DebtorName'] = $branch['br_name'];
                        }
                        $rep->End($email, $doc_Invoice_no . " " . $myrow['reference'], $myrow);
-               }       
+               }
        }
        if ($email == 0)
                $rep->End();
index d30d06a94424fa5d3cbd10400e81cc866ee64174..659a4a490e3774b7f09c1f0bfc38bf7c2ea7b2d5 100644 (file)
@@ -25,12 +25,12 @@ print_deliveries();
 function print_deliveries()
 {
        global $path_to_root;
-       
+
        include_once($path_to_root . "reporting/includes/pdf_report.inc");
-       
+
        $from = $_POST['PARAM_0'];
        $to = $_POST['PARAM_1'];
-       $email = $_POST['PARAM_2'];     
+       $email = $_POST['PARAM_2'];
        $comments = $_POST['PARAM_3'];
 
        if ($from == null)
@@ -38,19 +38,19 @@ function print_deliveries()
        if ($to == null)
                $to = 0;
        $dec = user_price_dec();
-       
+
        $fno = explode("-", $from);
        $tno = explode("-", $to);
 
        $cols = array(4, 60, 225, 300, 325, 385, 450, 515);
 
-       // $headers in doctext.inc      
+       // $headers in doctext.inc
        $aligns = array('left', 'left', 'right', 'left', 'right', 'right', 'right');
-       
+
        $params = array('comments' => $comments);
-       
+
        $cur = get_company_Pref('curr_default');
-       
+
        if ($email == 0)
        {
                $rep = new FrontReport(_('DELIVERY'), "DeliveryNoteBulk.pdf", user_pagesize());
@@ -78,20 +78,20 @@ function print_deliveries()
                        else
                                $rep->title = _('DELIVERY NOTE');
                        $rep->Header2($myrow, $branch, $sales_order, '', 13);
-                       
+
                $result = get_customer_trans_details(13, $i);
                        $SubTotal = 0;
                        while ($myrow2=db_fetch($result))
                        {
-                               $Net = round(((1 - $myrow2["discount_percent"]) * $myrow2["unit_price"] * $myrow2["quantity"]), 
+                               $Net = round(((1 - $myrow2["discount_percent"]) * $myrow2["unit_price"] * $myrow2["quantity"]),
                                   user_price_dec());
                                $SubTotal += $Net;
                        $DisplayPrice = number_format2($myrow2["unit_price"],$dec);
-                       $DisplayQty = number_format2($myrow2["quantity"],user_qty_dec());
+                       $DisplayQty = number_format2($myrow2["quantity"],get_qty_dec($myrow2['stock_id']));
                        $DisplayNet = number_format2($Net,$dec);
                        if ($myrow2["discount_percent"]==0)
                                        $DisplayDiscount ="";
-                       else 
+                       else
                                        $DisplayDiscount = number_format2($myrow2["discount_percent"]*100,user_percent_dec()) . "%";
                                $rep->TextCol(0, 1,     $myrow2['stock_id'], -2);
                                $rep->TextCol(1, 2,     $myrow2['StockDescription'], -2);
@@ -101,18 +101,18 @@ function print_deliveries()
                                $rep->TextCol(5, 6,     $DisplayDiscount, -2);
                                $rep->TextCol(6, 7,     $DisplayNet, -2);
                                $rep->NewLine(1);
-                               if ($rep->row < $rep->bottomMargin + (15 * $rep->lineHeight)) 
+                               if ($rep->row < $rep->bottomMargin + (15 * $rep->lineHeight))
                                        $rep->Header2($myrow, $branch, $sales_order,'',13);
                        }
-                       
+
                        $comments = get_comments(13, $i);
                        if ($comments && db_num_rows($comments))
-                       {       
+                       {
                                $rep->NewLine();
-                       while ($comment=db_fetch($comments)) 
+                       while ($comment=db_fetch($comments))
                                $rep->TextColLines(0, 6, $comment['memo_'], -2);
-                       }       
-                               
+                       }
+
                        $DisplaySubTot = number_format2($SubTotal,$dec);
                        $DisplayFreight = number_format2($myrow["ov_freight"],$dec);
 
@@ -121,13 +121,13 @@ function print_deliveries()
                        $doctype=13;
                        if ($rep->currency != $myrow['curr_code'])
                        {
-                               include($path_to_root . "reporting/includes/doctext2.inc");                     
-                       }       
+                               include($path_to_root . "reporting/includes/doctext2.inc");
+                       }
                        else
                        {
-                               include($path_to_root . "reporting/includes/doctext.inc");                      
-                       }       
-               
+                               include($path_to_root . "reporting/includes/doctext.inc");
+                       }
+
                        $rep->TextCol(3, 6, $doc_Sub_total, -2);
                        $rep->TextCol(6, 7,     $DisplaySubTot, -2);
                        $rep->NewLine();
@@ -135,29 +135,29 @@ function print_deliveries()
                        $rep->TextCol(6, 7,     $DisplayFreight, -2);
                        $rep->NewLine();
                        $tax_items = get_customer_trans_tax_details(13, $i);
-               while ($tax_item = db_fetch($tax_items)) 
+               while ($tax_item = db_fetch($tax_items))
                {
                        $DisplayTax = number_format2($tax_item['amount'], $dec);
                        if ($tax_item['included_in_price'])
                        {
-                                       $rep->TextCol(3, 7, $doc_Included . " " . $tax_item['tax_type_name'] . 
+                                       $rep->TextCol(3, 7, $doc_Included . " " . $tax_item['tax_type_name'] .
                                                " (" . $tax_item['rate'] . "%) " . $doc_Amount . ":" . $DisplayTax, -2);
-                               }               
+                               }
                        else
                        {
-                                       $rep->TextCol(3, 6, $tax_item['tax_type_name'] . " (" . 
+                                       $rep->TextCol(3, 6, $tax_item['tax_type_name'] . " (" .
                                                $tax_item['rate'] . "%)", -2);
                                        $rep->TextCol(6, 7,     $DisplayTax, -2);
-                               }                       
+                               }
                                $rep->NewLine();
                }
                $rep->NewLine();
                        $DisplayTotal = number_format2($myrow["ov_freight"] +$myrow["ov_freight_tax"] + $myrow["ov_gst"] +
                                $myrow["ov_amount"],$dec);
-                       $rep->Font('bold');     
-                       $rep->TextCol(3, 6, $doc_TOTAL_DELIVERY, - 2); 
+                       $rep->Font('bold');
+                       $rep->TextCol(3, 6, $doc_TOTAL_DELIVERY, - 2);
                        $rep->TextCol(6, 7,     $DisplayTotal, -2);
-                       $rep->Font();   
+                       $rep->Font();
                        if ($email == 1)
                        {
                                $myrow['dimension_id'] = $paylink; // helper for pmt link
@@ -167,7 +167,7 @@ function print_deliveries()
                                        $myrow['DebtorName'] = $branch['br_name'];
                                }
                                $rep->End($email, $doc_Delivery_no . " " . $myrow['reference'], $myrow, 13);
-                       }       
+                       }
        }
        if ($email == 0)
                $rep->End();
index 98e99e0c1c25f31164a1210a980d6dc56092b348..e3d3dc5a9f9ddfc396ad4c0aa88bc9a76accbde3 100644 (file)
@@ -42,7 +42,7 @@ function getTransactions($fromsupp)
                AND qty_recd-quantity_inv <>0 ";
        if ($fromsupp != reserved_words::get_all_numeric())
                $sql .= "AND ".TB_PREF."grn_batch.supplier_id ='" . $fromsupp . "' ";
-       $sql .= "ORDER BY ".TB_PREF."grn_batch.supplier_id, 
+       $sql .= "ORDER BY ".TB_PREF."grn_batch.supplier_id,
                        ".TB_PREF."grn_batch.id";
 
     return db_query($sql, "No transactions were returned");
@@ -58,7 +58,7 @@ function print_outstanding_GRN()
 
     $fromsupp = $_POST['PARAM_0'];
     $comments = $_POST['PARAM_1'];
-    
+
        if ($fromsupp == reserved_words::get_all_numeric())
                $from = _('All');
        else
@@ -85,9 +85,10 @@ function print_outstanding_GRN()
        $Supplier = '';
        $SuppTot_Val=0;
        $res = getTransactions($fromsupp);
-       
+
        While ($GRNs = db_fetch($res))
-       {       
+       {
+               $dec2 = get_qty_dec($GRNs['item_code']);
                if ($Supplier != $GRNs['supplier_id'])
                {
                        if ($Supplier != '')
@@ -106,11 +107,11 @@ function print_outstanding_GRN()
                $rep->TextCol(0, 1, $GRNs['id']);
                $rep->TextCol(1, 2, $GRNs['order_no']);
                $rep->TextCol(2, 3, $GRNs['item_code'] . '-' . $GRNs['description']);
-               $rep->TextCol(3, 4, number_format2($GRNs['qty_recd'], $dec));
-               $rep->TextCol(4, 5, number_format2($GRNs['quantity_inv'], $dec));
+               $rep->TextCol(3, 4, number_format2($GRNs['qty_recd'], $dec2));
+               $rep->TextCol(4, 5, number_format2($GRNs['quantity_inv'], $dec2));
                $QtyOstg = $GRNs['qty_recd'] - $GRNs['quantity_inv'];
                $Value = ($GRNs['qty_recd'] - $GRNs['quantity_inv']) * $GRNs['std_cost_unit'];
-               $rep->TextCol(5, 6, number_format2($QtyOstg, $dec));
+               $rep->TextCol(5, 6, number_format2($QtyOstg, $dec2));
                $rep->TextCol(6, 7, number_format2($GRNs['std_cost_unit'], $dec));
                $rep->TextCol(7, 8, number_format2($Value, $dec));
                $Tot_Val += $Value;
index c2c3c0fe58ca988492bcae63f57f59527c4e81ad..6ae258303147d1c9e62b557c352930eaa966237d 100644 (file)
@@ -22,12 +22,12 @@ print_po();
 //----------------------------------------------------------------------------------------------------
 function get_po($order_no)
 {
-       $sql = "SELECT ".TB_PREF."purch_orders.*, ".TB_PREF."suppliers.supp_name, 
+       $sql = "SELECT ".TB_PREF."purch_orders.*, ".TB_PREF."suppliers.supp_name,
                ".TB_PREF."suppliers.curr_code, ".TB_PREF."suppliers.payment_terms, ".TB_PREF."locations.location_name,
-               ".TB_PREF."suppliers.email, ".TB_PREF."suppliers.address 
-               FROM ".TB_PREF."purch_orders, ".TB_PREF."suppliers, ".TB_PREF."locations 
+               ".TB_PREF."suppliers.email, ".TB_PREF."suppliers.address
+               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 
+               AND ".TB_PREF."locations.loc_code = into_stock_location
                AND ".TB_PREF."purch_orders.order_no = " . $order_no;
        $result = db_query($sql, "The order cannot be retrieved");
     return db_fetch($result);
@@ -35,10 +35,10 @@ function get_po($order_no)
 
 function get_po_details($order_no)
 {
-       $sql = "SELECT ".TB_PREF."purch_order_details.*, units 
-               FROM ".TB_PREF."purch_order_details 
-               LEFT JOIN ".TB_PREF."stock_master 
-               ON ".TB_PREF."purch_order_details.item_code=".TB_PREF."stock_master.stock_id 
+       $sql = "SELECT ".TB_PREF."purch_order_details.*, units
+               FROM ".TB_PREF."purch_order_details
+               LEFT JOIN ".TB_PREF."stock_master
+               ON ".TB_PREF."purch_order_details.item_code=".TB_PREF."stock_master.stock_id
                WHERE order_no =$order_no ";
        $sql .= " ORDER BY po_detail_item";
        return db_query($sql, "Retreive order Line Items");
@@ -47,14 +47,14 @@ function get_po_details($order_no)
 function print_po()
 {
        global $path_to_root;
-       
+
        include_once($path_to_root . "reporting/includes/pdf_report.inc");
-       
+
        $from = $_POST['PARAM_0'];
        $to = $_POST['PARAM_1'];
        $currency = $_POST['PARAM_2'];
        $bankaccount = $_POST['PARAM_3'];
-       $email = $_POST['PARAM_4'];     
+       $email = $_POST['PARAM_4'];
        $comments = $_POST['PARAM_5'];
 
        if ($from == null)
@@ -62,18 +62,18 @@ function print_po()
        if ($to == null)
                $to = 0;
        $dec = user_price_dec();
-       
-       $cols = array(4, 60, 225, 300, 325, 385, 450, 515);
 
-       // $headers in doctext.inc      
-       $aligns = array('left', 'left', 'left', 'left', 'right', 'right', 'right');
-       
+       $cols = array(4, 60, 225, 300, 340, 385, 450, 515);
+
+       // $headers in doctext.inc
+       $aligns = array('left', 'left', 'left', 'right', 'left', 'right', 'right');
+
        $params = array('comments' => $comments,
                                        'bankaccount' => $bankaccount);
-       
+
        $baccount = get_bank_account($params['bankaccount']);
        $cur = get_company_Pref('curr_default');
-       
+
        if ($email == 0)
        {
                $rep = new FrontReport(_('PURCHASE ORDER'), "PurchaseOrderBulk.pdf", user_pagesize());
@@ -107,7 +107,7 @@ function print_po()
                          user_price_dec());
                        $SubTotal += $Net;
                        $DisplayPrice = number_format2($myrow2["unit_price"],$dec);
-                       $DisplayQty = number_format2($myrow2["quantity_ordered"],user_qty_dec());
+                       $DisplayQty = number_format2($myrow2["quantity_ordered"],get_qty_dec($myrow2['item_code']));
                        $DisplayNet = number_format2($Net,$dec);
                        //$rep->TextCol(0, 1,   $myrow2['item_code'], -2);
                        $rep->TextCol(0, 2,     $myrow2['description'], -2);
@@ -117,14 +117,14 @@ function print_po()
                        $rep->TextCol(5, 6,     $DisplayPrice, -2);
                        $rep->TextCol(6, 7,     $DisplayNet, -2);
                        $rep->NewLine(1);
-                       if ($rep->row < $rep->bottomMargin + (15 * $rep->lineHeight)) 
+                       if ($rep->row < $rep->bottomMargin + (15 * $rep->lineHeight))
                                $rep->Header2($myrow, $branch, $sales_order, $baccount);
                }
                if ($myrow['comments'] != "")
                {
                        $rep->NewLine();
                        $rep->TextColLines(1, 5, $myrow['comments'], -2);
-               }       
+               }
                $DisplaySubTot = number_format2($SubTotal,$dec);
 
                $rep->row = $rep->bottomMargin + (15 * $rep->lineHeight);
@@ -132,28 +132,28 @@ function print_po()
                $doctype = 8;
                if ($rep->currency != $myrow['curr_code'])
                {
-                       include($path_to_root . "reporting/includes/doctext2.inc");                     
-               }       
+                       include($path_to_root . "reporting/includes/doctext2.inc");
+               }
                else
                {
-                       include($path_to_root . "reporting/includes/doctext.inc");                      
-               }       
+                       include($path_to_root . "reporting/includes/doctext.inc");
+               }
 
                $rep->TextCol(3, 6, $doc_Sub_total, -2);
                $rep->TextCol(6, 7,     $DisplaySubTot, -2);
                $rep->NewLine();
                $DisplayTotal = number_format2($SubTotal, $dec);
-               $rep->Font('bold');     
+               $rep->Font('bold');
                $rep->TextCol(3, 6, $doc_TOTAL_PO, - 2);
                $rep->TextCol(6, 7,     $DisplayTotal, -2);
-               $rep->Font();   
+               $rep->Font();
                if ($email == 1)
                {
                        $myrow['contact_email'] = $myrow['email'];
                        $myrow['DebtorName'] = $myrow['supp_name'];
                        $myrow['reference'] = $myrow['order_no'];
                        $rep->End($email, $doc_Order_no . " " . $myrow['reference'], $myrow);
-               }       
+               }
        }
        if ($email == 0)
                $rep->End();
index 1778773382a772059e56c81ca2403c1b4e8b5443..45fb4406d959a7e14aa587859fa71a6ca1913e9f 100644 (file)
@@ -63,7 +63,7 @@ function print_inventory_valuation_report()
     $location = $_POST['PARAM_1'];
     $detail = $_POST['PARAM_2'];
     $comments = $_POST['PARAM_3'];
-    
+
     $dec = user_price_dec();
 
        if ($category == reserved_words::get_all_numeric())
@@ -97,7 +97,7 @@ function print_inventory_valuation_report()
     $rep->Header();
 
        $res = getTransactions($category, $location);
-       $total = $grandtotal = 0.0; 
+       $total = $grandtotal = 0.0;
        $catt = '';
        while ($trans=db_fetch($res))
        {
@@ -109,13 +109,13 @@ function print_inventory_valuation_report()
                                {
                                        $rep->NewLine(2, 3);
                                        $rep->TextCol(0, 4, _('Total'));
-                               }       
+                               }
                                $rep->Textcol(4, 5, number_format2($total, $dec));
                                if ($detail)
                                {
                                        $rep->Line($rep->row - 2);
                                        $rep->NewLine();
-                               }       
+                               }
                                $rep->NewLine();
                                $total = 0.0;
                        }
@@ -131,7 +131,7 @@ function print_inventory_valuation_report()
                        $rep->fontsize -= 2;
                        $rep->TextCol(0, 1, $trans['stock_id']);
                        $rep->TextCol(1, 2, $trans['description']);
-                       $rep->TextCol(2, 3, number_format2($trans['QtyOnHand'], user_qty_dec()));
+                       $rep->TextCol(2, 3, number_format2($trans['QtyOnHand'], get_qty_dec($trans['stock_id'])));
                        $rep->TextCol(3, 4, number_format2($trans['UnitCost'], $dec));
                        $rep->TextCol(4, 5, number_format2($trans['ItemTotal'], $dec));
                        $rep->fontsize += 2;
@@ -143,7 +143,7 @@ function print_inventory_valuation_report()
        {
                $rep->NewLine(2, 3);
                $rep->TextCol(0, 4, _('Total'));
-       }       
+       }
        $rep->Textcol(4, 5, number_format2($total, $dec));
        if ($detail)
        {
index 2a91d0373f6cb190afb59e41cc644959a2092d68..47bf8448c8c2212dd4cb1d255ed30cb14fef7539 100644 (file)
@@ -142,8 +142,6 @@ function print_inventory_planning()
     $location = $_POST['PARAM_1'];
     $comments = $_POST['PARAM_2'];
 
-    $dec = user_qty_dec();
-
        if ($category == reserved_words::get_all_numeric())
                $category = 0;
        if ($category == 0)
@@ -204,6 +202,7 @@ function print_inventory_planning()
                $suppqty = getSuppQty($trans['stock_id'], $trans['loc_code']);
                $period = getPeriods($trans['stock_id'], $trans['loc_code']);
                $rep->NewLine();
+               $dec = get_qty_dec($trans['stock_id']);
                $rep->TextCol(0, 1, $trans['stock_id']);
                $rep->TextCol(1, 2, $trans['description']);
                $rep->TextCol(2, 3, number_format2($period['prd0'], $dec));
index bb0fc86d6a15228ed12dc9d3b6c30f5276044cba..1cfab257919bd862636f370bd1107bab99d407f0 100644 (file)
@@ -103,8 +103,6 @@ function print_stock_check()
     $pictures = $_POST['PARAM_2'];
     $comments = $_POST['PARAM_3'];
 
-    $dec = user_qty_dec();
-
        if ($category == reserved_words::get_all_numeric())
                $category = 0;
        if ($category == 0)
@@ -159,6 +157,7 @@ function print_stock_check()
                $demandqty = getDemandQty($trans['stock_id'], $trans['loc_code']);
                $demandqty += getDemandAsmQty($trans['stock_id'], $trans['loc_code']);
                $rep->NewLine();
+               $dec = get_qty_dec($trans['stock_id']);
                $rep->TextCol(0, 1, $trans['stock_id']);
                $rep->TextCol(1, 2, $trans['description']);
                $rep->TextCol(2, 3, number_format2($trans['QtyOnHand'], $dec));
index c0d3987d30690b1e3a61ae87a52bd52a57c7ca11..096952c7bc4e8b9ddcc24dba1ebd9cd15d51c450 100644 (file)
@@ -52,8 +52,6 @@ function print_bill_of_material()
     $frompart = $_POST['PARAM_0'];
     $topart = $_POST['PARAM_1'];
     $comments = $_POST['PARAM_2'];
-    
-    $dec = user_qty_dec();
 
        $cols = array(0, 50, 305, 375, 445,     515);
 
@@ -87,12 +85,16 @@ function print_bill_of_material()
                        $parent = $trans['parent'];
                        $rep->NewLine();
                }
-               
+
                $rep->NewLine();
+               $dec = get_qty_dec($trans['component']);
                $rep->TextCol(0, 1, $trans['component']);
                $rep->TextCol(1, 2, $trans['CompDescription']);
-               $rep->TextCol(2, 3, $trans['loc_code']);
-               $rep->TextCol(3, 4, $trans['workcentre_added']);
+               //$rep->TextCol(2, 3, $trans['loc_code']);
+               //$rep->TextCol(3, 4, $trans['workcentre_added']);
+               $wc = get_work_centre($trans['workcentre_added']);
+               $rep->TextCol(2, 3, get_location_name($trans['loc_code']));
+               $rep->TextCol(3, 4, $wc['name']);
                $rep->TextCol(4, 5, number_format2($trans['quantity'], $dec));
        }
        $rep->Line($rep->row - 4);
index e9fb3a007b499f44bc6fe5055ee126484f3eafae..3c0f9fa43ce76e8593f62cb2790cf78a3172f27e 100644 (file)
@@ -144,7 +144,7 @@ if (isset($_GET['InvoiceNumber']) && $_GET['InvoiceNumber'] > 0) {
        foreach ($_SESSION['Items']->line_items as $line_no=>$itm) {
                if (isset($_POST['Line'.$line_no])) {
                        if (check_num('Line'.$line_no, ($itm->quantity - $itm->qty_done))) {
-                               $_SESSION['Items']->line_items[$line_no]->qty_dispatched = 
+                               $_SESSION['Items']->line_items[$line_no]->qty_dispatched =
                                  input_num('Line'.$line_no);
                        }
                }
@@ -281,10 +281,10 @@ function display_credit_items()
 
        text_cells(null, 'Line'.$line_no.'Desc', $ln_itm->item_description, 30, 50);
 
-       qty_cell($ln_itm->quantity);
+       qty_cell($ln_itm->quantity, false, get_qty_dec($ln_itm->stock_id));
        label_cell($ln_itm->units);
 
-       amount_cells(null, 'Line'.$line_no, qty_format($ln_itm->qty_dispatched));
+       amount_cells(null, 'Line'.$line_no, qty_format($ln_itm->qty_dispatched, $ln_itm->stock_id));
 
        $line_total =($ln_itm->qty_dispatched * $ln_itm->price * (1 - $ln_itm->discount_percent));
 
index 5d0aaa1cbda6bab31974b0cf2b2b767173139fce..9fa1a2a211ead4650b17e56d579e6384c0f9133c 100644 (file)
@@ -217,7 +217,7 @@ function check_quantities()
        foreach ($_SESSION['Items']->line_items as $line=>$itm) {
                if (isset($_POST['Line'.$line])) {
                        if (!check_num('Line'.$line, $itm->qty_done, $itm->quantity) == 0) {
-                               $_SESSION['Items']->line_items[$line]->qty_dispatched = 
+                               $_SESSION['Items']->line_items[$line]->qty_dispatched =
                                  input_num('Line'.$line);
                        } else {
                                $ok = 0;
@@ -381,11 +381,12 @@ foreach ($_SESSION['Items']->line_items as $line=>$ln_itm) {
        view_stock_status_cell($ln_itm->stock_id);
 
        text_cells(null, 'Line'.$line.'Desc', $ln_itm->item_description, 30, 50);
-       qty_cell($ln_itm->quantity);
+       $dec = get_qty_dec($ln_itm->stock_id);
+       qty_cell($ln_itm->quantity, false, $dec);
        label_cell($ln_itm->units);
-       qty_cell($ln_itm->qty_done);
+       qty_cell($ln_itm->qty_done, false, $dec);
 
-       small_qty_cells(null, 'Line'.$line, qty_format($ln_itm->qty_dispatched));
+       small_qty_cells(null, 'Line'.$line, qty_format($ln_itm->qty_dispatched, $ln_itm->stock_id, $dec), null, null, $dec);
 
        $display_discount_percent = percent_format($ln_itm->discount_percent*100) . "%";
 
index 9a6da912b01273dbea7b8c5b3f34ba391970f410..18d674c695722353a37fe0bcb1f064402de2a3a0 100644 (file)
@@ -349,17 +349,18 @@ foreach ($_SESSION['Items']->line_items as $line=>$ln_itm) {
        view_stock_status_cell($ln_itm->stock_id);
 
        text_cells(null, 'Line'.$line.'Desc', $ln_itm->item_description, 30, 50);
-       qty_cell($ln_itm->quantity);
+       $dec = get_qty_dec($ln_itm->stock_id);
+       qty_cell($ln_itm->quantity, false, $dec);
        label_cell($ln_itm->units);
-       qty_cell($ln_itm->qty_done);
+       qty_cell($ln_itm->qty_done, false, $dec);
 
        if ($is_batch_invoice) {
                // for batch invoices we can only remove whole deliveries
                echo '<td nowrap align=right>';
                hidden('Line' . $line, $ln_itm->qty_dispatched );
-               echo qty_format($ln_itm->qty_dispatched).'</td>';
+               echo number_format2($ln_itm->qty_dispatched, $dec).'</td>';
        } else {
-               small_qty_cells(null, 'Line'.$line, qty_format($ln_itm->qty_dispatched));
+               small_qty_cells(null, 'Line'.$line, qty_format($ln_itm->qty_dispatched, $ln_itm->stock_id, $dec), null, null, $dec);
        }
        $display_discount_percent = percent_format($ln_itm->discount_percent*100) . " %";
 
index 156145ad9bbc6dce2aa04103bf4288f6a608d574..3267bb4343c029d6d1e2a76d9b89a5ad53dbf643 100644 (file)
@@ -48,7 +48,7 @@ function display_credit_header(&$order)
            ref_row(_("Reference").':', 'ref');
        else
            label_row(_("Reference").':', $_POST['ref'] );
-       
+
 
 
        echo "</table>";
@@ -128,7 +128,7 @@ function display_credit_items($title, &$order)
 
            label_cell("<a target='_blank' href='$path_to_root/inventory/inquiry/stock_status.php?" . SID . "stock_id=" . $line->stock_id . "'>$line->stock_id</a>");
            label_cell($line->item_description, "nowrap");
-           qty_cell($line->qty_dispatched);
+           qty_cell($line->qty_dispatched, false, get_qty_dec($line->stock_id));
            label_cell($line->units);
            amount_cell($line->price);
 
@@ -182,7 +182,7 @@ function credit_edit_item_controls(&$order, $rowcounter, $line_no=-1)
        {
 
                $_POST['stock_id'] = $order->line_items[$id]->stock_id;
-               $_POST['qty'] = qty_format($order->line_items[$id]->qty_dispatched);
+               $_POST['qty'] = qty_format($order->line_items[$id]->qty_dispatched, $_POST['stock_id'], $dec);
                $_POST['price'] = price_format($order->line_items[$id]->price);
                $_POST['Disc'] = percent_format(($order->line_items[$id]->discount_percent)*100);
                $_POST['units'] = $order->line_items[$id]->units;
@@ -197,7 +197,7 @@ function credit_edit_item_controls(&$order, $rowcounter, $line_no=-1)
 
                $_POST['units'] = $item_info["units"];
 
-               $_POST['qty'] = qty_format(0);
+               $_POST['qty'] = qty_format(0, $_POST['stock_id'], $dec);
                $_POST['price'] = price_format(get_price($_POST['stock_id'], $order->customer_currency,
                    $order->sales_type, $order->price_factor, $order->document_date));
 
@@ -206,7 +206,7 @@ function credit_edit_item_controls(&$order, $rowcounter, $line_no=-1)
        }
 
 
-       qty_cells(null, 'qty', $_POST['qty']);
+       qty_cells(null, 'qty', $_POST['qty'], null, null, $dec);
 //     if ($order->trans_no!=0) {
 //             amount_cell($line_no==-1 ? 0 :$order->line_items[$line_no]->qty_done);
 //     }
index 1df65425ab1da1f74faceeb4e8e1448c7416bdae..b9f5e12e205ded2f1317ec3577420ceeab0c2c92 100644 (file)
@@ -47,7 +47,7 @@ function get_customer_details_to_order(&$order, $customer_id, $branch_id)
                if (db_num_rows($result) == 0)
                {
                return _("The selected customer and branch are not valid, or the customer does not have any branches.");
-               } 
+               }
 
                $myrow = db_fetch($result);
 
@@ -108,7 +108,7 @@ function display_order_summary($title, &$order, $editable_items=false)
                        view_stock_status_cell($stock_item->stock_id);
 
                        label_cell($stock_item->item_description, "nowrap" );
-                       qty_cell($stock_item->qty_dispatched);
+                       qty_cell($stock_item->qty_dispatched, false, get_qty_dec($stock_item->stock_id));
 
                        if ($order->trans_no!=0)
                                amount_cell($stock_item->qty_done);
@@ -132,7 +132,7 @@ function display_order_summary($title, &$order, $editable_items=false)
                {
                        sales_order_item_controls($order, $k,  $line_no);
                }
-               
+
                $total += $line_total;
        }
 
@@ -179,7 +179,7 @@ function display_order_header(&$order, $editable, $date_text, $display_tax_group
                        $_POST['branch_id'] = '';
                        $Ajax->activate('branch_id');
                }
-               customer_branches_list_row(_("Branch:"), 
+               customer_branches_list_row(_("Branch:"),
                  $_POST['customer_id'], 'branch_id', null, false, true, true);
 
                if (!isset($_POST['branch_id']) || $_POST['branch_id'] == "")
@@ -315,7 +315,7 @@ function sales_order_item_controls(&$order, &$rowcounter, $line_no=-1)
        if ($line_no!=-1 && $line_no == $id)
        {
                $_POST['stock_id'] = $order->line_items[$id]->stock_id;
-               $_POST['qty'] = qty_format($order->line_items[$id]->qty_dispatched);
+               $_POST['qty'] = qty_format($order->line_items[$id]->qty_dispatched, $_POST['stock_id']);
                $_POST['price'] = price_format($order->line_items[$id]->price);
                $_POST['Disc'] = percent_format($order->line_items[$id]->discount_percent*100);
                $units = $order->line_items[$id]->units;
@@ -336,17 +336,17 @@ function sales_order_item_controls(&$order, &$rowcounter, $line_no=-1)
                $item_info = get_item_edit_info($_POST['stock_id']);
                $units = $item_info["units"];
 
-               $_POST['qty'] = qty_format(1);
+               $_POST['qty'] = qty_format(1, $_POST['stock_id']);
 
                $_POST['price'] = price_format(get_price ($_POST['stock_id'],
-                       $order->customer_currency, $order->sales_type, 
+                       $order->customer_currency, $order->sales_type,
                        $order->price_factor, $order->document_date));
                // default to the customer's discount %
                $_POST['Disc'] = percent_format($order->default_discount * 100);
 
        }
 
-       qty_cells(null, 'qty', qty_format($_POST['qty']));
+       qty_cells(null, 'qty', qty_format($_POST['qty'], $_POST['stock_id'], $dec), null, null, $dec);
 
        if ($order->trans_no!=0) {
                amount_cell($line_no==-1 ? 0 :$order->line_items[$line_no]->qty_done);
@@ -355,7 +355,7 @@ function sales_order_item_controls(&$order, &$rowcounter, $line_no=-1)
        label_cell($units, '', 'units');
 
        $str = amount_cells(null, 'price');
-       
+
        small_amount_cells(null, 'Disc', percent_format($_POST['Disc']), null, null, user_percent_dec());
 
        $line_total = $_POST['qty'] * $_POST['price'] * (1 - $_POST['Disc'] / 100);
@@ -374,7 +374,7 @@ function sales_order_item_controls(&$order, &$rowcounter, $line_no=-1)
        }
        else
        {
-               submit_cells('AddItem', _("Add Item"), "colspan=2", 
+               submit_cells('AddItem', _("Add Item"), "colspan=2",
                    _('Add new item to document'), true);
        }
 
@@ -410,7 +410,7 @@ function display_delivery_details(&$order)
 
        locations_list_row(_("Deliver from Location:"), 'Location', $order->Location);
 
-       date_row($delname, 'delivery_date', 
+       date_row($delname, 'delivery_date',
            _('Enter requested day of delivery'), $order->due_date, 0, 0, 0);
 
        text_row(_("Deliver To:"), 'deliver_to', $order->deliver_to, 40, 40,
index ec14f0313f250e6d5356781cfdb42901ddd9e939..f220fca140512116bcd29f3f7af4c1d8fe935855 100644 (file)
@@ -17,7 +17,7 @@ page(_("View Credit Note"), true, false, "", $js);
 if (isset($_GET["trans_no"]))
 {
        $trans_id = $_GET["trans_no"];
-} 
+}
 elseif (isset($_POST["trans_no"]))
 {
        $trans_id = $_POST["trans_no"];
@@ -80,7 +80,7 @@ if (db_num_rows($result) > 0)
 {
        $th = array(_("Item Code"), _("Item Description"), _("Quantity"),
                _("Unit"), _("Price"), _("Discount %"), _("Total"));
-       table_header($th);      
+       table_header($th);
 
        $k = 0; //row colour counter
        $sub_total = 0;
@@ -90,29 +90,29 @@ if (db_num_rows($result) > 0)
 
                alt_table_row_color($k);
 
-               $value = round(((1 - $myrow2["discount_percent"]) * $myrow2["unit_price"] * $myrow2["quantity"]), 
+               $value = round(((1 - $myrow2["discount_percent"]) * $myrow2["unit_price"] * $myrow2["quantity"]),
                   user_price_dec());
                $sub_total += $value;
 
                if ($myrow2["discount_percent"] == 0)
                {
                        $display_discount = "";
-               } 
-               else 
+               }
+               else
                {
                   $display_discount = percent_format($myrow2["discount_percent"]*100) . "%";
                }
 
                label_cell($myrow2["stock_id"]);
                label_cell($myrow2["StockDescription"]);
-               qty_cell($myrow2["quantity"]);
+               qty_cell($myrow2["quantity"], false, get_qty_dec($myrow2["stock_id"]));
                label_cell($myrow2["units"], "align=right");
                amount_cell($myrow2["unit_price"]);
                label_cell($display_discount, "align=right");
                amount_cell($value);
                end_row();
        } //end while there are line items to print out
-} 
+}
 else
        display_note(_("There are no line items on this credit note."), 1, 2);
 
@@ -138,7 +138,7 @@ end_table(1);
 $voided = is_voided_display(11, $trans_id, _("This credit note has been voided."));
 
 if (!$voided)
-       display_allocations_from(payment_person_types::customer(), 
+       display_allocations_from(payment_person_types::customer(),
                $myrow['debtor_no'], 11, $trans_id, $credit_total);
 
 /* end of check to see that there was an invoice record to print */
index 20ecb619d60ab7feea10c34af63a100dd519357d..3d7d2e75253d70b0febbd844408e92b6a797f229 100644 (file)
@@ -17,7 +17,7 @@ page(_("View Sales Dispatch"), true, false, "", $js);
 if (isset($_GET["trans_no"]))
 {
        $trans_id = $_GET["trans_no"];
-} 
+}
 elseif (isset($_POST["trans_no"]))
 {
        $trans_id = $_POST["trans_no"];
@@ -75,7 +75,7 @@ start_table("$table_style width=100%");
 start_row();
 label_cells(_("Reference"), $myrow["reference"], "class='tableheader2'");
 label_cells(_("Currency"), $sales_order["curr_code"], "class='tableheader2'");
-label_cells(_("Our Order No"), 
+label_cells(_("Our Order No"),
        get_customer_trans_view_str(systypes::sales_order(),$sales_order["order_no"]), "class='tableheader2'");
 end_row();
 start_row();
@@ -102,7 +102,7 @@ if (db_num_rows($result) > 0)
 {
        $th = array(_("Item Code"), _("Item Description"), _("Quantity"),
                _("Unit"), _("Price"), _("Discount %"), _("Total"));
-       table_header($th);      
+       table_header($th);
 
        $k = 0; //row colour counter
        $sub_total = 0;
@@ -111,22 +111,22 @@ if (db_num_rows($result) > 0)
                if($myrow2['quantity']==0) continue;
                alt_table_row_color($k);
 
-               $value = round(((1 - $myrow2["discount_percent"]) * $myrow2["unit_price"] * $myrow2["quantity"]), 
+               $value = round(((1 - $myrow2["discount_percent"]) * $myrow2["unit_price"] * $myrow2["quantity"]),
                   user_price_dec());
                $sub_total += $value;
 
            if ($myrow2["discount_percent"] == 0)
            {
                        $display_discount = "";
-           } 
-           else 
+           }
+           else
            {
                        $display_discount = percent_format($myrow2["discount_percent"]*100) . "%";
            }
 
-       label_cell($myrow2["stock_id"]);
-       label_cell($myrow2["StockDescription"]);
-        qty_cell($myrow2["quantity"]);
+               label_cell($myrow2["stock_id"]);
+               label_cell($myrow2["StockDescription"]);
+        qty_cell($myrow2["quantity"], false, get_qty_dec($myrow2["stock_id"]));
         label_cell($myrow2["units"], "align=right");
         amount_cell($myrow2["unit_price"]);
         label_cell($display_discount, "nowrap align=right");
@@ -134,7 +134,7 @@ if (db_num_rows($result) > 0)
        end_row();
        } //end while there are line items to print out
 
-} 
+}
 else
        display_note(_("There are no line items on this dispatch."), 1, 2);
 
@@ -142,7 +142,7 @@ $display_sub_tot = price_format($sub_total);
 $display_freight = price_format($myrow["ov_freight"]);
 
 /*Print out the delivery note text entered */
-label_row(_("Sub-total"), $display_sub_tot, "colspan=6 align=right", 
+label_row(_("Sub-total"), $display_sub_tot, "colspan=6 align=right",
        "nowrap align=right width=15%");
 label_row(_("Shipping"), $display_freight, "colspan=6 align=right", "nowrap align=right");
 
index c15753b6c2678c80396e32f6cde34d788ba28a0f..f14e0ced9f75925bdc797da922478fe0e044d906 100644 (file)
@@ -17,7 +17,7 @@ page(_("View Sales Invoice"), true, false, "", $js);
 if (isset($_GET["trans_no"]))
 {
        $trans_id = $_GET["trans_no"];
-} 
+}
 elseif (isset($_POST["trans_no"]))
 {
        $trans_id = $_POST["trans_no"];
@@ -75,7 +75,7 @@ start_table("$table_style width=100%");
 start_row();
 label_cells(_("Reference"), $myrow["reference"], "class='tableheader2'");
 label_cells(_("Currency"), $sales_order["curr_code"], "class='tableheader2'");
-label_cells(_("Our Order No"), 
+label_cells(_("Our Order No"),
        get_customer_trans_view_str(systypes::sales_order(),$sales_order["order_no"]), "class='tableheader2'");
 end_row();
 start_row();
@@ -102,7 +102,7 @@ if (db_num_rows($result) > 0)
 {
        $th = array(_("Item Code"), _("Item Description"), _("Quantity"),
                _("Unit"), _("Price"), _("Discount %"), _("Total"));
-       table_header($th);      
+       table_header($th);
 
        $k = 0; //row colour counter
        $sub_total = 0;
@@ -111,22 +111,22 @@ if (db_num_rows($result) > 0)
            if($myrow2["quantity"]==0) continue;
                alt_table_row_color($k);
 
-               $value = round(((1 - $myrow2["discount_percent"]) * $myrow2["unit_price"] * $myrow2["quantity"]), 
+               $value = round(((1 - $myrow2["discount_percent"]) * $myrow2["unit_price"] * $myrow2["quantity"]),
                   user_price_dec());
                $sub_total += $value;
 
            if ($myrow2["discount_percent"] == 0)
            {
                        $display_discount = "";
-           } 
-           else 
+           }
+           else
            {
                        $display_discount = percent_format($myrow2["discount_percent"]*100) . "%";
            }
 
            label_cell($myrow2["stock_id"]);
                label_cell($myrow2["StockDescription"]);
-        qty_cell($myrow2["quantity"]);
+        qty_cell($myrow2["quantity"], false, get_qty_dec($myrow2["stock_id"]));
         label_cell($myrow2["units"], "align=right");
         amount_cell($myrow2["unit_price"]);
         label_cell($display_discount, "nowrap align=right");
@@ -134,7 +134,7 @@ if (db_num_rows($result) > 0)
                end_row();
        } //end while there are line items to print out
 
-} 
+}
 else
        display_note(_("There are no line items on this invoice."), 1, 2);
 
@@ -142,7 +142,7 @@ $display_sub_tot = price_format($sub_total);
 $display_freight = price_format($myrow["ov_freight"]);
 
 /*Print out the invoice text entered */
-label_row(_("Sub-total"), $display_sub_tot, "colspan=6 align=right", 
+label_row(_("Sub-total"), $display_sub_tot, "colspan=6 align=right",
        "nowrap align=right width=15%");
 label_row(_("Shipping"), $display_freight, "colspan=6 align=right", "nowrap align=right");
 
index 13bebb09beec97d4fcb670a17d68c6bcfe8123c6..333a11301284140d63818efc27cebc402988c9fd 100644 (file)
@@ -39,7 +39,7 @@ echo "<tr valign=top><td>";
 start_table("$table_style width=95%");
 label_row(_("Customer Name"), $_SESSION['Items']->customer_name, "class='tableheader2'",
        "colspan=3");
-start_row();   
+start_row();
 label_cells(_("Customer Order Ref."), $_SESSION['Items']->cust_ref, "class='tableheader2'");
 label_cells(_("Deliver To Branch"), $_SESSION['Items']->deliver_to, "class='tableheader2'");
 end_row();
@@ -52,7 +52,7 @@ label_cells(_("Order Currency"), $_SESSION['Items']->customer_currency, "class='
 label_cells(_("Deliver From Location"), $_SESSION['Items']->location_name, "class='tableheader2'");
 end_row();
 
-label_row(_("Delivery Address"), nl2br($_SESSION['Items']->delivery_address), 
+label_row(_("Delivery Address"), nl2br($_SESSION['Items']->delivery_address),
        "class='tableheader2'", "colspan=3");
 label_row(_("Telephone"), $_SESSION['Items']->phone, "class='tableheader2'", "colspan=3");
 label_row(_("E-mail"), "<a href='mailto:" . $_SESSION['Items']->email . "'>" . $_SESSION['Items']->email . "</a>",
@@ -74,7 +74,7 @@ $result = db_query($sql,"The related delivery notes could not be retreived");
 $delivery_total = 0;
 $k = 0;
 
-while ($del_row = db_fetch($result)) 
+while ($del_row = db_fetch($result))
 {
 
        alt_table_row_color($k);
@@ -107,7 +107,7 @@ $result = db_query($sql,"The related invoices could not be retreived");
 $invoices_total = 0;
 $k = 0;
 
-while ($inv_row = db_fetch($result)) 
+while ($inv_row = db_fetch($result))
 {
 
        alt_table_row_color($k);
@@ -139,7 +139,7 @@ $result = db_query($sql,"The related credit notes could not be retreived");
 $credits_total = 0;
 $k = 0;
 
-while ($credits_row = db_fetch($result)) 
+while ($credits_row = db_fetch($result))
 {
 
        alt_table_row_color($k);
@@ -177,20 +177,21 @@ $k = 0;  //row colour counter
 
 foreach ($_SESSION['Items']->line_items as $stock_item) {
 
-       $line_total = round($stock_item->quantity * $stock_item->price * (1 - $stock_item->discount_percent), 
+       $line_total = round($stock_item->quantity * $stock_item->price * (1 - $stock_item->discount_percent),
           user_price_dec());
 
        alt_table_row_color($k);
 
        label_cell($stock_item->stock_id);
        label_cell($stock_item->item_description);
-       qty_cell($stock_item->quantity);
+       $dec = get_qty_dec($stock_item->stock_id);
+       qty_cell($stock_item->quantity, false, $dec);
        label_cell($stock_item->units);
        amount_cell($stock_item->price);
        amount_cell($stock_item->discount_percent * 100);
        amount_cell($line_total);
-       
-       qty_cell($stock_item->qty_done);
+
+       qty_cell($stock_item->qty_done, false, $dec);
        end_row();
 }