if (!is_company_currency($order->customer_currency))
{
+ div_start('currency');
echo "<table height='5'>";
label_row(_("Customer Currency:"), $order->customer_currency);
exchange_rate_display($order->customer_currency, get_company_currency(),
- $_POST['OrderDate'], true);
+ $_POST['OrderDate']);
echo "</table>";
echo "</td><td>"; // outer table
+ div_end();
}
echo "<table height='5'>";
$change_prices = 1;
}
- if ($change_prices != 0) {
- foreach ($order->line_items as $line_no=>$item) {
- $line = &$order->line_items[$line_no];
- $line->price = get_price($line->stock_id, $order->customer_currency,
- $order->sales_type, $order->price_factor, $order->document_date);
- // $line->discount_percent = $order->default_discount;
- }
- $Ajax->activate('items_table');
- }
-
label_row(_("Customer Discount:"), ($order->default_discount * 100) . "%");
echo "</table>";
if (!isset($_POST['OrderDate']) || $_POST['OrderDate'] == "")
$_POST['OrderDate'] = $order->document_date;
- date_row(_("Date:"), 'OrderDate');
-
+ date_row(_("Date:"), 'OrderDate', '', null, 0, 0, 0, null, true);
+ if (isset($_POST['_OrderDate_changed'])) {
+ $change_prices = 1;
+ $Ajax->activate('currency');
+ }
shippers_list_row(_("Shipping Company:"), 'ShipperID', $order->ship_via);
echo "</table>";
end_table(1); // outer table
+ if ($change_prices != 0) {
+ foreach ($order->line_items as $line_no=>$item) {
+ $line = &$order->line_items[$line_no];
+ $line->price = get_price($line->stock_id, $order->customer_currency,
+ $order->sales_type, $order->price_factor, get_post('OrderDate'));
+ // $line->discount_percent = $order->default_discount;
+ }
+ $Ajax->activate('items_table');
+ }
+
+
return $customer_error;
}
amount_cells(null, 'price', null);
small_amount_cells(null, 'Disc', percent_format(0), null, null, user_percent_dec());
- amount_cell($_POST['qty'] * $_POST['price'] * (1 - $_POST['Disc']/100));
+ amount_cell(input_num('qty') * input_num('price') * (1 - input_num('Disc')/100));
if ($id!=-1)
{
echo "<table height='5'>";
label_row(_("Customer Currency:"), $order->customer_currency);
exchange_rate_display($order->customer_currency, get_company_currency(),
- ($editable ? $_POST['OrderDate'] : $order->document_date), $editable);
+ ($editable ? $_POST['OrderDate'] : $order->document_date));
echo "</table>";
div_end();
echo "</td><td>"; // outer table
if ($order->sales_type != $_POST['sales_type']) {
$myrow = get_sales_type($_POST['sales_type']);
$order->set_sales_type($myrow['id'], $myrow['sales_type'],
- $myrow['tax_included'], $myrow['factor']);
+ $myrow['tax_included'], $myrow['factor']);
$Ajax->activate('sales_type');
$change_prices = 1;
}
- if ($change_prices != 0) {
- foreach ($order->line_items as $line_no=>$item) {
- $line = &$order->line_items[$line_no];
- $line->price = get_price($line->stock_id, $order->customer_currency,
- $order->sales_type, $order->price_factor, $order->document_date);
- // $line->discount_percent = $order->default_discount;
- }
- $Ajax->activate('items_table');
- }
label_row(_("Customer Discount:"), ($order->default_discount * 100) . "%");
echo "</table>";
$_POST['OrderDate'] = $order->document_date;
date_row($date_text, 'OrderDate',
- _('Date of order receive'));
+ _('Date of order receive'), null, 0, 0, 0, null, true);
+ if (isset($_POST['_OrderDate_changed'])) {
+ $change_prices = 1;
+ $Ajax->activate('currency');
+ if ($order->trans_type == 10) {
+ $_POST['delivery_date'] = get_invoice_duedate(get_post('customer_id'), get_post('OrderDate'));
+ } else
+ $_POST['delivery_date'] = add_days(get_post('OrderDate'), sys_prefs::default_delivery_required_by());
+ $Ajax->activate('delivery_date');
+ }
}
else
{
end_table(1); // outer table
+ if ($change_prices != 0) {
+ foreach ($order->line_items as $line_no=>$item) {
+ $line = &$order->line_items[$line_no];
+ $line->price = get_price($line->stock_id, $order->customer_currency,
+ $order->sales_type, $order->price_factor, get_post('OrderDate'));
+ // $line->discount_percent = $order->default_discount;
+ }
+ $Ajax->activate('items_table');
+ }
+
return $customer_error;
}
$_POST['price'] = price_format(get_price ($_POST['stock_id'],
$order->customer_currency, $order->sales_type,
- $order->price_factor, $order->document_date));
+ $order->price_factor, get_post('OrderDate')));
// default to the customer's discount %
$_POST['Disc'] = percent_format($order->default_discount * 100);
small_amount_cells(null, 'Disc', percent_format($_POST['Disc']), null, null, user_percent_dec());
- $line_total = $_POST['qty'] * $_POST['price'] * (1 - $_POST['Disc'] / 100);
+ $line_total = input_num('qty') * input_num('price') * (1 - input_num('Disc') / 100);
amount_cell($line_total, false, '','line_total');