$trans_no = key($trans_no);
}
- $credit_type = $write_off_acc == 0 ? 'Return' : 'Writeoff';
+ $credit_type = $write_off_acc == 0 ? 'Return' : 'WriteOff';
begin_transaction();
$dim2 = ($customer['dimension2_id'] != 0 ? $customer["dimension2_id"] : $stock_gl_codes["dimension2_id"]);
/* insert gl_trans to credit stock and debit cost of sales at standard cost*/
- if ($order_line->standard_cost != 0) {
+ $standard_cost = get_standard_cost($order_line->stock_id);
+ if ($standard_cost != 0) {
/*first the cost of sales entry*/
add_gl_trans_std_cost(11, $credit_no, $date_, $stock_gl_codes["cogs_account"],
- $dim, $dim2, "", -($order_line->standard_cost * $order_line->qty_dispatched),
+ $dim, $dim2, "", -($standard_cost * $order_line->qty_dispatched),
payment_person_types::customer(), $order->customer_id,
"The cost of sales GL posting could not be inserted");
}
add_gl_trans_std_cost(11, $credit_no, $date_, $stock_entry_account, 0, 0,
- "", ($order_line->standard_cost * $order_line->qty_dispatched),
+ "", ($standard_cost * $order_line->qty_dispatched),
payment_person_types::customer(), $order->customer_id,
"The stock side (or write off) of the cost of sales GL posting could not be inserted");