$invoice->sales_type, $sales_order, $invoice->ship_via,
$invoice->due_date, 0, 0, $invoice->dimension_id,
$invoice->dimension2_id, $invoice->payment, $invoice->tax_included, $invoice->prep_amount);
$invoice->sales_type, $sales_order, $invoice->ship_via,
$invoice->due_date, 0, 0, $invoice->dimension_id,
$invoice->dimension2_id, $invoice->payment, $invoice->tax_included, $invoice->prep_amount);
// else take the Item Sales Account
if (!$invoice->is_prepaid())
$sales_account = ($branch_data['sales_account'] != "" ? $branch_data['sales_account'] : $stock_gl_code['sales_account']);
// else take the Item Sales Account
if (!$invoice->is_prepaid())
$sales_account = ($branch_data['sales_account'] != "" ? $branch_data['sales_account'] : $stock_gl_code['sales_account']);
// else take the Item Dimension (if any)
$dim = ($invoice->dimension_id != $customer['dimension_id'] ? $invoice->dimension_id :
($customer['dimension_id'] != 0 ? $customer["dimension_id"] : $stock_gl_code["dimension_id"]));
// else take the Item Dimension (if any)
$dim = ($invoice->dimension_id != $customer['dimension_id'] ? $invoice->dimension_id :
($customer['dimension_id'] != 0 ? $customer["dimension_id"] : $stock_gl_code["dimension_id"]));
reallocate_payments($invoice_no, ST_SALESINVOICE, $date_, $to_allocate, $allocs);
reallocate_payments($invoice_no, ST_SALESINVOICE, $date_, $to_allocate, $allocs);
-//_vd(get_payments_for($sales_order, ST_SALESORDER));
-//_vd(get_payments_for($invoice_no, ST_SALESINVOICE));
-//_vd(get_gl(ST_SALESINVOICE, $invoice_no));
-//_vd(get_customer_trans($invoice_no, ST_SALESINVOICE));
-//_vd(get_sales_order_header($sales_order, ST_SALESORDER));