delete_comments(ST_CUSTDELIVERY, $delivery_no);
}
- foreach ($delivery->line_items as $delivery_line) {
+ foreach ($delivery->line_items as $line_no => $delivery_line) {
+ if ($delivery_line->qty_dispatched == 0) {
+ unset($delivery->line_items[$line_no]);
+ continue;
+ }
$line_price = $delivery_line->line_price();
$line_taxfree_price = get_tax_free_price_for_item($delivery_line->stock_id,
$delivery_line->price, 0, $delivery->tax_included,
if ($trans_no != 0) // Inserted 2008-09-25 Joe Hunt
$delivery_line->standard_cost = get_standard_cost($delivery_line->stock_id);
- // do not use standard cost if it's a non-inventory item, 2010-02-03 Joe Hunt
- if (!is_inventory_item($delivery_line->stock_id))
- $delivery_line->standard_cost = 0;
-
/* add delivery details for all lines */
write_customer_trans_detail_item(ST_CUSTDELIVERY, $delivery_no, $delivery_line->stock_id,
$delivery_line->item_description, $delivery_line->qty_dispatched,
"The cost of sales GL posting could not be inserted");
/*now the stock entry*/
- //$stock_gl_code = get_stock_gl_code($order_line->stock_id);
add_gl_trans_std_cost(ST_CUSTDELIVERY, $delivery_no, $delivery->document_date,
$stock_gl_code["inventory_account"], 0, 0, "",
void_trans_tax_details(ST_SALESINVOICE, $invoice_no);
}
$total = 0;
- foreach ($invoice->line_items as $invoice_line) {
-
+ foreach ($invoice->line_items as $line_no => $invoice_line) {
+ if ($invoice_line->qty_dispatched == 0) {
+ unset($invoice->line_items[$line_no]);
+ continue;
+ }
$line_taxfree_price = get_tax_free_price_for_item($invoice_line->stock_id,
$invoice_line->price, 0, $invoice->tax_included,
$invoice->tax_group_array);