- $total_cost += add_gl_trans_std_cost(ST_WORKORDER, $woid, $date_, $issue["inventory_account"], 0, 0,
- $date_.": "._("Issue of")." ".$stockitem["description"], -$issue_cost);
- $issue_total += $issue_cost;
- }
- if ($issue_total != 0)
- add_issue_cost($details['stock_id'], $details['units_reqd'], $date_, $issue_total);
- $issue = get_stock_gl_code($details['stock_id']);
- $stockitem = get_item($details['stock_id']);
- add_gl_trans_std_cost(ST_WORKORDER, $woid, $date_, $issue["inventory_account"],
- 0, 0, $date_.": "._("Issue to")." ".$stockitem["description"], -$total_cost);
+
+ // Compatibility for Service Items
+ if (!is_service($stockitem["mb_flag"]))
+ $ivaccount = $stockitem["inventory_account"];
+ else
+ $ivaccount = $stockitem["cogs_account"];
+
+ $total_cost += add_gl_trans_std_cost(ST_MANUISSUE, $number, $date_, $ivaccount, 0, 0,
+ $date_.": "._("Issue of")." ".$stockitem["description"], -$issue_cost);
+ }
+
+ $stockitem = get_item($wo['stock_id']);
+
+ $wip_account = $stockitem["wip_account"];
+
+ add_gl_trans_std_cost(ST_MANUISSUE, $number, $date_, $wip_account,
+ 0, 0, $date_.": "._("Issue to")." ".$stockitem["description"], -$total_cost);