Moving 2.0 development version to main trunk.
[fa-stable.git] / manufacturing / includes / manufacturing_ui.inc
index b903d2c8f500fb85254c9cf460a04a8bb68abb25..5753b716bd51f7025960f6ef33afb33b0a2ef31e 100644 (file)
@@ -13,8 +13,8 @@ function display_bom($item_check)
     if (db_num_rows($result) == 0)
     {
        display_note(_("The bill of material for this item is empty."), 0, 1);
-    } 
-    else 
+    }
+    else
     {
 
         start_table($table_style);
@@ -28,7 +28,7 @@ function display_bom($item_check)
 
         $total_cost = 0;
 
-        while ($myrow = db_fetch($result)) 
+        while ($myrow = db_fetch($result))
         {
 
                        alt_table_row_color($k);
@@ -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();
@@ -68,8 +68,8 @@ function display_wo_requirements($woid, $quantity, $show_qoh=false, $date=null)
     if (db_num_rows($result) == 0)
     {
        display_note(_("There are no Requirements for this Order."), 1, 0);
-    } 
-    else 
+    }
+    else
     {
 
         start_table("$table_style width=80%");
@@ -84,11 +84,11 @@ function display_wo_requirements($woid, $quantity, $show_qoh=false, $date=null)
                if ($date == null)
                        $date = Today();
 
-        while ($myrow = db_fetch($result)) 
+        while ($myrow = db_fetch($result))
         {
 
                        $qoh = 0;
-
+                       $show_qoh = true;
                        // if it's a non-stock item (eg. service) don't show qoh
                        if (!has_stock_holding($myrow["mb_flag"]))
                                $show_qoh = false;
@@ -96,13 +96,13 @@ function display_wo_requirements($woid, $quantity, $show_qoh=false, $date=null)
                        if ($show_qoh)
                                $qoh = get_qoh_on_date($myrow["stock_id"], $myrow["loc_code"], $date);
 
-                       if ($show_qoh && ($myrow["units_req"] * $quantity > $qoh) && 
-                               !sys_prefs::allow_negative_stock()) 
+                       if ($show_qoh && ($myrow["units_req"] * $quantity > $qoh) &&
+                               !sys_prefs::allow_negative_stock())
                        {
                                // oops, we don't have enough of one of the component items
                                start_row("class='stockmankobg'");
                                $has_marked = true;
-                       } 
+                       }
                        else
                                alt_table_row_color($k);
 
@@ -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();
@@ -142,8 +143,8 @@ function display_wo_productions($woid)
     if (db_num_rows($result) == 0)
     {
        display_note(_("There are no Productions for this Order."), 1, 1);
-    } 
-    else 
+    }
+    else
     {
         start_table($table_style);
         $th = array(_("#"), _("Reference"), _("Date"), _("Quantity"));
@@ -153,7 +154,7 @@ function display_wo_productions($woid)
         $k = 0; //row colour counter
                $total_qty = 0;
 
-        while ($myrow = db_fetch($result)) 
+        while ($myrow = db_fetch($result))
         {
 
                        alt_table_row_color($k);
@@ -163,11 +164,11 @@ function display_wo_productions($woid)
                label_cell(get_trans_view_str(29, $myrow["id"]));
                        label_cell($myrow['reference']);
                        label_cell(sql2date($myrow["date_"]));
-                       qty_cell($myrow['quantity']);
+                       qty_cell($myrow['quantity'], false, get_qty_dec($myrow['reference']));
                        end_row();
                }//end of while
 
-               label_row(_("Total"), number_format2($total_qty,user_qty_dec()), 
+               label_row(_("Total"), number_format2($total_qty,user_qty_dec()),
                        "colspan=3", "nowrap align=right");
 
                end_table();
@@ -185,8 +186,8 @@ function display_wo_issues($woid)
     if (db_num_rows($result) == 0)
     {
        display_note(_("There are no Issues for this Order."), 0, 1);
-    } 
-    else 
+    }
+    else
     {
         start_table($table_style);
         $th = array(_("#"), _("Reference"), _("Date"));
@@ -195,7 +196,7 @@ function display_wo_issues($woid)
 
         $k = 0; //row colour counter
 
-        while ($myrow = db_fetch($result)) 
+        while ($myrow = db_fetch($result))
         {
 
                        alt_table_row_color($k);
@@ -220,9 +221,9 @@ function display_wo_payments($woid)
 
     if (db_num_rows($result) == 0)
     {
-       echo _("There are no Payments for this Order.") . "<br>";
-    } 
-    else 
+       display_note(_("There are no Payments for this Order."), 0, 1);
+    }
+    else
     {
         start_table($table_style);
         $th = array(_("#"), _("Reference"), _("Date"), _("Amount"));
@@ -231,7 +232,7 @@ function display_wo_payments($woid)
 
         $k = 0; //row colour counter
 
-        while ($myrow = db_fetch($result)) 
+        while ($myrow = db_fetch($result))
         {
 
                        alt_table_row_color($k);
@@ -256,7 +257,7 @@ function display_wo_details($woid, $suppress_view_link=false)
 
        $myrow = get_work_order($woid);
 
-    if (strlen($myrow[0]) == 0) 
+    if (strlen($myrow[0]) == 0)
     {
        display_note(_("The work order number sent is not valid."));
        exit;
@@ -264,11 +265,11 @@ function display_wo_details($woid, $suppress_view_link=false)
 
        start_table("$table_style width=80%");
 
-       if ($myrow["released"] == true) 
+       if ($myrow["released"] == true)
                $th = array(_("#"), _("Reference"), _("Type"), _("Manufactured Item"),
                        _("Into Location"), _("Date"), _("Required By"), _("Quantity Required"),
                        _("Released Date"), _("Manufactured"));
-       else            
+       else
                $th = array(_("#"), _("Reference"), _("Type"), _("Manufactured Item"),
                        _("Into Location"), _("Date"), _("Required By"), _("Quantity Required"));
 
@@ -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"]));
+       $dec = get_qty_dec($myrow["stock_id"]);
+       qty_cell($myrow["units_reqd"], false, $dec);
 
-       qty_cell($myrow["units_reqd"]);
-
-       if ($myrow["released"] == true) 
+       if ($myrow["released"] == true)
        {
                label_cell(sql2date($myrow["released_date"]));
-               qty_cell($myrow["units_issued"]);
+               qty_cell($myrow["units_issued"], false, $dec);
        }
        end_row();
 
@@ -298,7 +299,7 @@ function display_wo_details($woid, $suppress_view_link=false)
 
        end_table();
 
-    if ($myrow["closed"] == true) 
+    if ($myrow["closed"] == true)
     {
        display_note(_("This work order is closed."));
     }
@@ -312,7 +313,7 @@ function display_wo_details_quick($woid, $suppress_view_link=false)
 
        $myrow = get_work_order($woid);
 
-    if (strlen($myrow[0]) == 0) 
+    if (strlen($myrow[0]) == 0)
     {
        display_note(_("The work order number sent is not valid."));
        exit;
@@ -322,7 +323,7 @@ function display_wo_details_quick($woid, $suppress_view_link=false)
 
        $th = array(_("#"), _("Reference"), _("Type"), _("Manufactured Item"),
                _("Into Location"), _("Date"), _("Quantity"));
-       table_header($th);      
+       table_header($th);
 
        start_row();
        if ($suppress_view_link)
@@ -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();
 
@@ -343,7 +344,7 @@ function display_wo_details_quick($woid, $suppress_view_link=false)
 
        end_table();
 
-    if ($myrow["closed"] == true) 
+    if ($myrow["closed"] == true)
     {
        display_note(_("This work order is closed."));
     }