- // void any related gl trans\r
- //Chaitanya : Nothing happens due to next statement as all gl postings are done against WO\r
- //void_gl_trans(ST_MANUISSUE, $type_no, true);\r
- \r
- //Chaitanya : Reverse the gl posting\r
- $issue = get_work_order_issue($type_no);\r
- $manf_stock_id = $issue["stock_id"];\r
- $date_ = sql2date($issue["issue_date"]);\r
- $woid = $issue["workorder_id"];\r
- \r
- $result = get_stock_moves(ST_MANUISSUE, $type_no);\r
- $total_cost = 0;\r
- $issue_total = 0;\r
- while ($myrow = db_fetch($result))\r
- {\r
- $issue_cost = $myrow["qty"]*$myrow["standard_cost"];\r
- $issue = get_stock_gl_code($myrow["stock_id"]);\r
- $stockitem = get_item($myrow["stock_id"]);\r
- \r
- //Chaitanya : Compatibility for Service Items\r
- if (!is_service($issue["mb_flag"]))\r
- $ivaccount = $issue["inventory_account"];\r
- else\r
- $ivaccount = $issue["cogs_account"]; \r
- \r
- if ($issue_cost != 0)\r
- {\r
- $total_cost += add_gl_trans_std_cost(ST_WORKORDER, $woid, $date_, $ivaccount, 0, 0,\r
- $date_.": "._("Reversed the issue of")." ".$stockitem["description"],\r
- -$issue_cost); \r
- $issue_total += $issue_cost;\r
- }\r
- }\r
- if ($issue_total != 0)\r
- //Chaitanya : Revese cost effect on manfactured stock item as adjustment only\r
- add_issue_cost($manf_stock_id, 0, $date_, $issue_total, true);\r
- $issue = get_stock_gl_code($manf_stock_id);\r
- $stockitem = get_item($manf_stock_id);\r
- if ($total_cost != 0)\r
- add_gl_trans_std_cost(ST_WORKORDER, $woid, $date_, $issue["inventory_account"],\r
- 0, 0, $date_.": "._("Reversed the issue to")." ".$stockitem["description"], \r
- -$total_cost); \r
- \r
- //Chaitanya : Shifted below void all related stock moves\r