$units = $myrow["units"];
}
- $order->add_to_order($order->lines_on_order+1, $myrow["item_code"],
+ $order->add_to_order($order->lines_on_order, $myrow["item_code"],
1,$myrow["description"], $myrow["unit_price"],$units,
sql2date($myrow["delivery_date"]), $myrow["quantity_inv"],
$myrow["qty_recd"]);
- $order->line_items[$order->lines_on_order]->po_detail_rec = $myrow["po_detail_item"];
+ $order->line_items[$order->lines_on_order-1]->po_detail_rec = $myrow["po_detail_item"];
} /* line po from purchase order details */
} //end of checks on returned data set
}
// add_comments(ST_PURCHORDER, $po_obj->order_no, $po_obj->orig_order_date, $po_obj->Comments);
- add_audit_trail($po_obj->trans_type, $po_obj->order_no, $po_obj->document_date, _("Updated."));
+ add_audit_trail($po_obj->trans_type, $po_obj->order_no, Today(), _("Updated."));
commit_transaction();
return $po_obj->order_no;
$units = $myrow["units"];
}
- if ($order->add_to_order($order->lines_on_order+1, $myrow["item_code"],
+ if ($order->add_to_order($order->lines_on_order, $myrow["item_code"],
$myrow["quantity_ordered"],$myrow["description"],
$myrow["unit_price"],$units, sql2date($myrow["delivery_date"]),
$myrow["qty_invoiced"], $myrow["quantity_received"])) {
- $order->line_items[$order->lines_on_order]->po_detail_rec = $myrow["po_detail_item"];
- $order->line_items[$order->lines_on_order]->standard_cost = $myrow["std_cost_unit"]; /*Needed for receiving goods and GL interface */
+ $newline = &$order->line_items[$order->lines_on_order-1];
+ $newline->po_detail_rec = $myrow["po_detail_item"];
+ $newline->standard_cost = $myrow["std_cost_unit"]; /*Needed for receiving goods and GL interface */
+ // set for later GRN edition
+// $newline->receive_qty = $newline->quantity - $newline->qty_dispatched;
}
} /* line po from purchase order details */
} //end of checks on returned data set
meta_forward($_SERVER['PHP_SELF'], "AddedGRN=$grn_no");
}
// Direct Purchase Invoice
- $inv = new supp_trans;
- $inv->is_invoice = true;
+ $inv = new supp_trans(ST_SUPPINVOICE);
$inv->Comments = $cart->Comments;
$inv->supplier_id = $cart->supplier_id;
$inv->tran_date = $cart->orig_order_date;
// Otherwise if you try to fullfill item quantities separately will give error.
$result = get_po_items($_SESSION['PO']->order_no);
- $line_no = 1;
+ $line_no = 0;
while ($myrow = db_fetch($result))
{
$ln_item = $_SESSION['PO']->line_items[$line_no];
unset ($_SESSION['supp_trans']);
}
- $_SESSION['supp_trans'] = new supp_trans;
- $_SESSION['supp_trans']->is_invoice = false;
+ $_SESSION['supp_trans'] = new supp_trans(ST_SUPPCREDIT);
if (isset($_GET['invoice_no']))
{
$_SESSION['supp_trans']->supp_reference = $_POST['invoice_no'] = $_GET['invoice_no'];
unset ($_SESSION['supp_trans']);
}
- $_SESSION['supp_trans'] = new supp_trans;
- $_SESSION['supp_trans']->is_invoice = true;
+ $_SESSION['supp_trans'] = new supp_trans(ST_SUPPINVOICE);
}
//--------------------------------------------------------------------------------------------------
// if ($writeoff_acc==0) return goods into $cart->Location
// if src_docs!=0 => credit invoice else credit note
//
-function write_credit_note($credit_note, $write_off_acc)
+function write_credit_note(&$credit_note, $write_off_acc)
{
global $Refs;
if ($trans_no == 0) {
$Refs->save(ST_CUSTCREDIT, $credit_no, $credit_note->reference);
}
-
commit_transaction();
return $credit_no;
return 0; // batch or complete invoice
}
-//--------------------------------------------------------------------------------------------------
-function get_parent_type($type)
-{
- $parent_types = array( ST_CUSTCREDIT => ST_SALESINVOICE, ST_SALESINVOICE => ST_CUSTDELIVERY, ST_CUSTDELIVERY => ST_SALESORDER );
- return isset($parent_types[$type]) ? $parent_types[$type] : 0;
-}
-
//--------------------------------------------------------------------------------------------------
function update_parent_line($doc_type, $line_id, $qty_dispatched, $auto=false)
{
$myrow["curr_code"], $myrow["discount"], $myrow["payment_terms"]);
$cart->set_branch($myrow["branch_code"], $myrow["tax_group_id"],
- $myrow["tax_group_name"], $myrow["phone"], $myrow["email"]);
+ $myrow["tax_group_name"]);
$cart->reference = $myrow["reference"];
$cart->order_no = $myrow["order_"];