begin_transaction();
hook_db_prewrite($po, ST_SUPPRECEIVE);
+ add_new_exchange_rate(get_supplier_currency($po->supplier_id), $date_, $po->ex_rate);
+
$grn = add_grn_batch($po->order_no, $po->supplier_id, $po->reference, $po->Location, $date_);
$clearing_act = get_company_pref('grn_clearing_act');
$supplier = get_supplier($supp_trans->supplier_id);
+ add_new_exchange_rate($supplier['curr_code'], $supp_trans->tran_date, $supp_trans->ex_rate);
+
foreach ($taxes as $n => $taxitem)
{
$taxes[$n]['Value'] = round2($taxitem['Value'], user_price_dec());
var $tax_group_array = null; // saves db queries
var $tax_included; // type of prices
var $terms;
-
+ var $ex_rate;
+
var $reference;
var $tax_overrides = array(); // array of taxes manually inserted during sales invoice entry (direct invoice)
var $supplier_id;
var $supplier_name;
var $terms;
+ var $ex_rate;
var $tax_description;
var $tax_group_id;
***********************************************************************/
//---------------------------------------------------------------------------------------------------
-function display_grn_summary(&$po, $editable=false)
+function display_grn_summary(&$po)
{
global $Refs;
start_table(TABLESTYLE2, "width=90%");
-
+
start_row();
label_cells(_("Supplier"), $po->supplier_name, "class='tableheader2'");
-
+
if (!is_company_currency($po->curr_code))
label_cells(_("Order Currency"), $po->curr_code, "class='tableheader2'");
-
+
label_cells(_("For Purchase Order"), get_trans_view_str(ST_PURCHORDER, $po->order_no),
"class='tableheader2'");
-
+
label_cells(_("Ordered On"), $po->orig_order_date, "class='tableheader2'");
end_row();
-
+
start_row();
- if ($editable)
- {
+ label_cells(_("Reference"), $po->reference, "class='tableheader2'");
+ label_cells(_("Deliver Into Location"), get_location_name($po->Location), "class='tableheader2'");
+ label_cells(_("Supplier's Reference"), $po->supp_ref, "class='tableheader2'");
+
+ end_row();
+
+ label_row(_("Delivery Address"), $po->delivery_address, "class='tableheader2'", "colspan=9");
+
+ if ($po->Comments != "")
+ label_row(_("Order Comments"), $po->Comments, "class='tableheader2'", "colspan=9");
+ end_table(1);
+}
+
+function edit_grn_summary(&$po)
+{
+ global $Refs;
+
+ start_outer_table(TABLESTYLE2, "width=80%");
+
+ table_section(1);
+ label_row(_("Supplier"), $po->supplier_name);
+
+ if (!is_company_currency($po->curr_code))
+ label_row(_("Order Currency"), $po->curr_code);
+
+ label_row(_("For Purchase Order"), get_trans_view_str(ST_PURCHORDER, $po->order_no));
+
+ label_row(_("Ordered On"), $po->orig_order_date);
+
+ table_section(2);
if (!isset($_POST['ref']))
$_POST['ref'] = $Refs->get_next(ST_SUPPRECEIVE);
- ref_cells(_("Reference"), 'ref', '', null, "class='tableheader2'");
-
+ ref_row(_("Reference"), 'ref', '', null);
+
if (!isset($_POST['Location']))
$_POST['Location'] = $po->Location;
- label_cell(_("Deliver Into Location"), "class='tableheader2'");
- locations_list_cells(null, "Location", $_POST['Location']);
-
+
+ locations_list_row(_("Deliver Into Location"), "Location", $_POST['Location']);
+
if (!isset($_POST['DefaultReceivedDate']))
$_POST['DefaultReceivedDate'] = new_doc_date();
-
- date_cells(_("Date Items Received"), 'DefaultReceivedDate', '', true, 0, 0, 0, "class='tableheader2'");
+
+ date_row(_("Date Items Received"), 'DefaultReceivedDate', '', true, 0, 0, 0, '', true);
+
+ table_section(3);
// currently this is related order supp reference
-// ref_cells(_("Supplier's Reference"), 'supp_ref', _("Supplier's Reference"), null, "class='tableheader2'");
- label_cells(_("Supplier's Reference"), $po->supp_ref, "class='tableheader2'");
- }
- else
- {
- label_cells(_("Reference"), $po->reference, "class='tableheader2'");
- label_cells(_("Deliver Into Location"), get_location_name($po->Location), "class='tableheader2'");
- label_cells(_("Supplier's Reference"), $po->supp_ref, "class='tableheader2'");
- }
-
- end_row();
-
- if (!$editable)
-
- label_row(_("Delivery Address"), $po->delivery_address, "class='tableheader2'", "colspan=9");
-
- if ($po->Comments != "")
- label_row(_("Order Comments"), $po->Comments, "class='tableheader2'", "colspan=9");
- end_table(1);
+// ref_row(_("Supplier's Reference"), 'supp_ref', _("Supplier's Reference"));
+ label_row(_("Supplier's Reference"), $po->supp_ref);
+
+ label_row(_("Delivery Address"), $po->delivery_address);
+
+ if ($po->Comments != "")
+ label_row(_("Order Comments"), $po->Comments, "class='tableheader2'", "colspan=9");
+
+ if (!is_company_currency($po->curr_code))
+ exchange_rate_display($po->curr_code, get_company_currency(), get_post('DefaultReceivedDate'));
+ end_outer_table(1);
}
?>
\ No newline at end of file
$_POST['supp_reference'] = $supp_trans->supp_reference;
$_POST['reference'] = $supp_trans->reference;
$_POST['supplier_id'] = $supp_trans->supplier_id;
+ $_POST['_ex_rate'] = $supp_trans->ex_rate;
if (isset($supp_trans->tax_overrides))
foreach($supp_trans->tax_overrides as $id => $value)
$_POST['mantax'][$id] = price_format($value);
$supp_trans->due_date = $_POST['due_date'];
$supp_trans->supp_reference = $_POST['supp_reference'];
$supp_trans->reference = $_POST['reference'];
+ $supp_trans->ex_rate = input_num('_ex_rate', null);
$supp_trans->ov_amount = $supp_trans->ov_discount = 0; /* for starters */
if (isset($_POST['mantax'])) {
$_POST['Comments'] = $cart->Comments;
$_POST['StkLocation'] = $cart->Location;
$_POST['delivery_address'] = $cart->delivery_address;
+ $_POST['_ex_rate'] = $cart->ex_rate;
foreach($cart->tax_overrides as $id => $value)
$_POST['mantax'][$id] = price_format($value);
}
$cart->Comments = $_POST['Comments'];
$cart->Location = $_POST['StkLocation'];
$cart->delivery_address = $_POST['delivery_address'];
+ $cart->ex_rate = input_num('_ex_rate', null);
+
if (isset($_POST['mantax'])) {
foreach($_POST['mantax'] as $id => $tax) {
$cart->tax_overrides[$id] = user_numeric($_POST['mantax'][$id]); }
$editable = ($order->order_no == 0);
- start_outer_table(TABLESTYLE2, "width=80%");
+ start_outer_table(TABLESTYLE2, 'width=80%');
table_section(1);
if ($editable)
}
set_global_supplier($_POST['supplier_id']);
+ date_row($order->trans_type==ST_PURCHORDER ? _("Order Date:") :
+ ($order->trans_type==ST_SUPPRECEIVE ? _("Delivery Date:") : _("Invoice Date:")),
+ 'OrderDate', '', true, 0, 0, 0, null, true);
+
+ if (isset($_POST['_OrderDate_changed'])) {
+ $order->orig_order_date = $_POST['OrderDate'];
+ get_duedate_from_terms($order);
+ $_POST['due_date'] = $order->due_date;
+ $Ajax->activate('due_date');
+ }
+ supplier_credit_row($order->supplier_id, $order->credit);
+
if (!is_company_currency($order->curr_code))
{
label_row(_("Supplier Currency:"), $order->curr_code);
$_POST['OrderDate']);
}
- supplier_credit_row($order->supplier_id, $order->credit);
-
if ($editable)
{
table_section(2);
- // check this out?????????
- //if (!isset($_POST['OrderDate']) || $_POST['OrderDate'] == "")
- // $_POST['OrderDate'] = $order->orig_order_date;
- //if (!isset($_POST['OrderDate']) || $_POST['OrderDate'] == "")
- //{
- // $_POST['OrderDate'] = Today();
- // if (!is_date_in_fiscalyear($_POST['OrderDate']))
- // $_POST['OrderDate'] = end_fiscalyear();
- //}
- date_row($order->trans_type==ST_PURCHORDER ? _("Order Date:") :
- ($order->trans_type==ST_SUPPRECEIVE ? _("Delivery Date:") : _("Invoice Date:")),
- 'OrderDate', '', true, 0, 0, 0, null, true);
-
- if (isset($_POST['_OrderDate_changed'])) {
- $order->orig_order_date = $_POST['OrderDate'];
- get_duedate_from_terms($order);
- $_POST['due_date'] = $order->due_date;
- $Ajax->activate('_ex_rate');
- $Ajax->activate('due_date');
- }
if ($order->trans_type==ST_SUPPINVOICE)
date_row(_("Due Date:"), 'due_date', '', false, 0, 0, 0, null, true);
$total += isset($taxitem['Override']) ? $taxitem['Override'] : $taxitem['Value'];
}
}
+ $inv->ex_rate = $cart->ex_rate;
$inv_no = add_supp_invoice($inv);
commit_transaction(); // save PO+GRN+PI
$grn->orig_order_date = $_POST['DefaultReceivedDate'];
$grn->reference = $_POST['ref'];
$grn->Location = $_POST['Location'];
+ $grn->ex_rate = input_num('_ex_rate', null);
$grn_no = add_grn($grn);
start_form();
-display_grn_summary($_SESSION['PO'], true);
+edit_grn_summary($_SESSION['PO'], true);
display_heading(_("Items to Receive"));
display_po_receive_items();