0004641: items->transactions should not show QOH for service items. @Braathwaate...
[fa-stable.git] / manufacturing / includes / manufacturing_ui.inc
index 426356d9c61a4efa053edd055dba260cb2717772..812590edd1a9f6a51884f7e5c1921e7cbd5a3867 100644 (file)
@@ -15,8 +15,6 @@ include_once($path_to_root . "/includes/ui.inc");
 
 function display_bom($item_check)
 {
-       global $table_style;
-
     $result = get_bom($item_check);
 
     if (db_num_rows($result) == 0)
@@ -26,9 +24,9 @@ function display_bom($item_check)
     else
     {
 
-        start_table($table_style);
+        start_table(TABLESTYLE);
         $th = array(_("Component"), _("Description"), _("Work Centre"),
-               _("From Location"), _("Quantity"), _("Unit Cost"), _("Total Cost"));
+               _("From Location"), _("Quantity"), _("Unit Cost"), _("Cost"));
 
         table_header($th);
 
@@ -47,19 +45,36 @@ function display_bom($item_check)
                        label_cell($myrow["WorkCentreDescription"]);
                        label_cell($myrow["location_name"]);
                        qty_cell($myrow["quantity"], false, get_qty_dec($myrow["component"]));
-                       amount_cell($myrow["standard_cost"]);
+                       amount_cell($myrow["ProductCost"]);
                        amount_cell($myrow["ComponentCost"]);
                        end_row();
                $total_cost += $myrow["ComponentCost"];
 
                $j++;
-               If ($j == 12)
+               if ($j == 12)
                {
                        $j = 1;
                        table_header($th);
-               }//end of page full new headings if
-               }//end of while
+               }
+               }
 
+               $item = get_item($item_check);
+               if ($item['labour_cost'] != 0)
+               {
+                       $total_cost += $item['labour_cost'];
+                       alt_table_row_color($k);
+               label_cells(_("Standard Labour Cost"), number_format2($item['labour_cost'],user_price_dec()),
+               "colspan=6 align=left", "class=odd_row nowrap align=right");
+           end_row();
+               }
+               if ($item['overhead_cost'] != 0)
+               {
+                       $total_cost += $item['overhead_cost'];
+                       alt_table_row_color($k);
+               label_cells(_("Standard Overhead Cost"), number_format2($item['overhead_cost'],user_price_dec()),
+               "colspan=6 align=left", "nowrap align=right");
+           end_row();
+               }
         label_row("<b>" . _("Total Cost") . "</b>", "<b>" . number_format2($total_cost,user_price_dec()) ."</b>",
                "colspan=6 align=right", "nowrap align=right");
                end_table();
@@ -70,7 +85,7 @@ function display_bom($item_check)
 
 function display_wo_requirements($woid, $quantity, $show_qoh=false, $date=null)
 {
-       global $table_style, $SysPrefs;
+       global $SysPrefs;
 
     $result = get_wo_requirements($woid);
 
@@ -81,7 +96,7 @@ function display_wo_requirements($woid, $quantity, $show_qoh=false, $date=null)
     else
     {
 
-        start_table("$table_style width=80%");
+        start_table(TABLESTYLE, "width='80%'");
         $th = array(_("Component"), _("From Location"), _("Work Centre"),
                _("Unit Quantity"), _("Total Quantity"), _("Units Issued"), _("On Hand"));
 
@@ -145,7 +160,7 @@ function display_wo_requirements($woid, $quantity, $show_qoh=false, $date=null)
 
 function display_wo_productions($woid)
 {
-       global $path_to_root, $table_style;
+       global $path_to_root;
 
     $result = get_work_order_productions($woid);
 
@@ -155,7 +170,7 @@ function display_wo_productions($woid)
     }
     else
     {
-        start_table($table_style);
+        start_table(TABLESTYLE);
         $th = array(_("#"), _("Reference"), _("Date"), _("Quantity"));
 
         table_header($th);
@@ -170,7 +185,7 @@ function display_wo_productions($woid)
 
                        $total_qty += $myrow['quantity'];
 
-               label_cell(get_trans_view_str(29, $myrow["id"]));
+               label_cell(get_trans_view_str(ST_MANURECEIVE, $myrow["id"]));
                        label_cell($myrow['reference']);
                        label_cell(sql2date($myrow["date_"]));
                        qty_cell($myrow['quantity'], false, get_qty_dec($myrow['reference']));
@@ -188,7 +203,7 @@ function display_wo_productions($woid)
 
 function display_wo_issues($woid)
 {
-       global $path_to_root, $table_style;
+       global $path_to_root;
 
     $result = get_work_order_issues($woid);
 
@@ -198,7 +213,7 @@ function display_wo_issues($woid)
     }
     else
     {
-        start_table($table_style);
+        start_table(TABLESTYLE);
         $th = array(_("#"), _("Reference"), _("Date"));
 
         table_header($th);
@@ -210,7 +225,7 @@ function display_wo_issues($woid)
 
                        alt_table_row_color($k);
 
-               label_cell(get_trans_view_str(28, $myrow["issue_no"]));
+               label_cell(get_trans_view_str(ST_MANUISSUE, $myrow["issue_no"]));
                        label_cell($myrow['reference']);
                        label_cell(sql2date($myrow["issue_date"]));
                        end_row();
@@ -224,10 +239,9 @@ function display_wo_issues($woid)
 
 function display_wo_payments($woid)
 {
-       global $path_to_root, $table_style, $wo_cost_types;
+       global $path_to_root, $wo_cost_types;
 
-    //$result = get_bank_trans(null, null, PT_WORKORDER, $woid);
-    $result = get_gl_wo_cost_trans($woid);
+    $result = get_wo_costing($woid);
 
     if (db_num_rows($result) == 0)
     {
@@ -235,23 +249,21 @@ function display_wo_payments($woid)
     }
     else
     {
-        start_table($table_style);
+        start_table(TABLESTYLE);
         $th = array(_("#"), _("Type"), _("Date"), _("Amount"));
 
         table_header($th);
 
-        $k = 0; //row colour counter
-               
+        $k = 0;
         while ($myrow = db_fetch($result))
         {
-
                        alt_table_row_color($k);
 
-               label_cell(get_gl_view_str(ST_WORKORDER, $myrow["type_no"], $myrow["type_no"]));
-               label_cell($wo_cost_types[$myrow['person_id']]);
+               label_cell(get_gl_view_str( $myrow["trans_type"], $myrow["trans_no"], $myrow["trans_no"]));
+               label_cell($wo_cost_types[$myrow['cost_type']]);
                $date = sql2date($myrow["tran_date"]);
                label_cell($date);
-                       amount_cell(-($myrow['amount']));
+                       amount_cell($myrow['amount']);
                        end_row();
                }
 
@@ -263,7 +275,7 @@ function display_wo_payments($woid)
 
 function display_wo_details($woid, $suppress_view_link=false)
 {
-       global $table_style, $wo_types_array;
+       global $wo_types_array;
 
        $myrow = get_work_order($woid);
 
@@ -273,7 +285,7 @@ function display_wo_details($woid, $suppress_view_link=false)
        exit;
     }
 
-       start_table("$table_style width=80%");
+       start_table(TABLESTYLE, "width='80%'");
 
        if ($myrow["released"] == true)
                $th = array(_("#"), _("Reference"), _("Type"), _("Manufactured Item"),
@@ -319,7 +331,7 @@ function display_wo_details($woid, $suppress_view_link=false)
 
 function display_wo_details_quick($woid, $suppress_view_link=false)
 {
-       global $table_style, $wo_types_array;
+       global $wo_types_array;
 
        $myrow = get_work_order($woid);
 
@@ -329,7 +341,7 @@ function display_wo_details_quick($woid, $suppress_view_link=false)
        exit;
     }
 
-       start_table("$table_style width=80%");
+       start_table(TABLESTYLE, "width='80%'");
 
        $th = array(_("#"), _("Reference"), _("Type"), _("Manufactured Item"),
                _("Into Location"), _("Date"), _("Quantity"));
@@ -360,4 +372,3 @@ function display_wo_details_quick($woid, $suppress_view_link=false)
     }
 }
 
-?>
\ No newline at end of file