$sql = "SELECT act_price, unit_price FROM ".TB_PREF."purch_order_details WHERE
po_detail_item = ".db_escape($po_detail_item);
$result = db_query($sql, "The old actual price of the purchase order line could not be retrieved");
- $row = db_fetch_row($result);
- $ret = $row[0];
+ $row = db_fetch($result);
+ $ret = $row['act_price'];
- $unit_price = $row[1]; //Added by Rasmus
+ $unit_price = $row['unit_price']; //Added by Rasmus
$sql = "SELECT delivery_date
FROM ".TB_PREF."grn_batch grn,"
WHERE
grn.id = line.grn_batch_id AND line.id=".db_escape($id);
$result = db_query($sql, "The old delivery date from the received record cout not be retrieved");
- $row = db_fetch_row($result);
- $date = $row[0];
+ $row = db_fetch($result);
+ $date = $row['delivery_date'];
}
else
{
$tax_total = 0;
$taxes = $supp_trans->get_taxes($supp_trans->tax_group_id);
if ($trans_no) {
- $allocs = get_payments_for($trans_no, $trans_type); // save allocations
+ $allocs = get_payments_for($trans_no, $trans_type, $supp_trans->supplier_id); // save allocations
void_transaction($trans_type, $trans_no, Today(), _("Document reentered."));
$Refs->restore_last($trans_type, $trans_no);
} else
}
}
-//_vd($allocs);
- reallocate_payments($invoice_id, ST_SUPPINVOICE, $date_, $to_allocate, $allocs);
-//_vd(get_payments_for($sales_order, ST_PURCHORDER));
-//_vd(get_payments_for($invoice_id, ST_SUPPINVOICE));
-//exit;
+ reallocate_payments($invoice_id, ST_SUPPINVOICE, $date_, $to_allocate, $allocs, $supp_trans->supplier_id);
$supp_trans->trans_no = $invoice_id;
hook_db_postwrite($supp_trans, $supp_trans->trans_type);
commit_transaction();