+ // If there is a Customer Dimension, then override with this,
+ // else take the Item Dimension (if any)
+ $dim = ($delivery->dimension_id != $customer['dimension_id'] ? $delivery->dimension_id :
+ ($customer['dimension_id'] != 0 ? $customer["dimension_id"] : $stock_gl_code["dimension_id"]));
+ $dim2 = ($delivery->dimension2_id != $customer['dimension2_id'] ? $delivery->dimension2_id :
+ ($customer['dimension2_id'] != 0 ? $customer["dimension2_id"] : $stock_gl_code["dimension2_id"]));
+ if ($delivery->is_prepaid())
+ {
+ $sales_account = ($branch_data['sales_account'] != "" ? $branch_data['sales_account'] : $stock_gl_code['sales_account']);
+
+ $total += add_gl_trans_customer(ST_CUSTDELIVERY, $delivery_no, $delivery->document_date, $sales_account, $dim, $dim2,
+ -$line_taxfree_price*$delivery_line->qty_dispatched, // FIXME - calculation order should be exactly like in invoice to minimalize roundings
+ $delivery->customer_id, "The sales price GL posting could not be inserted");
+ }