if (db_num_rows($result) == 0)
{
return _("The selected customer and branch are not valid, or the customer does not have any branches.");
- }
+ }
$myrow = db_fetch($result);
$order->set_location($myrow["default_location"], $myrow["location_name"]);
$order->set_delivery($myrow["default_ship_via"], $myrow["br_name"],
$address);
+ if ($order->trans_type == 10)
+ $order->due_date = get_invoice_duedate($customer_id, $order->document_date);
}
return $ret_error;
view_stock_status_cell($stock_item->stock_id);
label_cell($stock_item->item_description, "nowrap" );
- qty_cell($stock_item->qty_dispatched);
+ qty_cell($stock_item->qty_dispatched, false, get_qty_dec($stock_item->stock_id));
if ($order->trans_no!=0)
amount_cell($stock_item->qty_done);
{
sales_order_item_controls($order, $k, $line_no);
}
-
+
$total += $line_total;
}
$_POST['branch_id'] = '';
$Ajax->activate('branch_id');
}
- customer_branches_list_row(_("Branch:"),
+ customer_branches_list_row(_("Branch:"),
$_POST['customer_id'], 'branch_id', null, false, true, true);
if (!isset($_POST['branch_id']) || $_POST['branch_id'] == "")
$_POST['deliver_to'] = $order->deliver_to;
$_POST['delivery_address'] = $order->delivery_address;
$_POST['phone'] = $order->phone;
+ if ($order->trans_type == 10)
+ {
+ $_POST['delivery_date'] = $order->due_date;
+ $Ajax->activate('delivery_date');
+ }
$Ajax->activate('Location');
$Ajax->activate('deliver_to');
$Ajax->activate('phone');
if ($line_no!=-1 && $line_no == $id)
{
$_POST['stock_id'] = $order->line_items[$id]->stock_id;
- $_POST['qty'] = qty_format($order->line_items[$id]->qty_dispatched);
+ $dec = get_qty_dec($_POST['stock_id']);
+ $_POST['qty'] = number_format2($order->line_items[$id]->qty_dispatched, $dec);
$_POST['price'] = price_format($order->line_items[$id]->price);
$_POST['Disc'] = percent_format($order->line_items[$id]->discount_percent*100);
$units = $order->line_items[$id]->units;
if(isset($_POST['_stock_id_update'])) {
$Ajax->activate('price');
$Ajax->activate('units');
+ $Ajax->activate('qty');
$Ajax->activate('line_total');
}
$item_info = get_item_edit_info($_POST['stock_id']);
$units = $item_info["units"];
-
- $_POST['qty'] = qty_format(1);
+ $dec = get_qty_dec($_POST['stock_id']);
+ $_POST['qty'] = number_format2(1, $dec);
$_POST['price'] = price_format(get_price ($_POST['stock_id'],
- $order->customer_currency, $order->sales_type,
+ $order->customer_currency, $order->sales_type,
$order->price_factor, $order->document_date));
// default to the customer's discount %
$_POST['Disc'] = percent_format($order->default_discount * 100);
}
- qty_cells(null, 'qty', qty_format($_POST['qty']));
+ qty_cells(null, 'qty', $_POST['qty'], null, null, $dec);
if ($order->trans_no!=0) {
- amount_cell($line_no==-1 ? 0 :$order->line_items[$line_no]->qty_done);
+ qty_cell($line_no==-1 ? 0 :$order->line_items[$line_no]->qty_done, false, $dec);
}
label_cell($units, '', 'units');
$str = amount_cells(null, 'price');
-
+
small_amount_cells(null, 'Disc', percent_format($_POST['Disc']), null, null, user_percent_dec());
$line_total = $_POST['qty'] * $_POST['price'] * (1 - $_POST['Disc'] / 100);
_('Cancel changes'));
hidden('LineNo', $line_no);
set_focus('qty');
- $Ajax->addFocus(true, 'qty');
}
else
{
- submit_cells('AddItem', _("Add Item"), "colspan=2",
+ submit_cells('AddItem', _("Add Item"), "colspan=2",
_('Add new item to document'), true);
}
locations_list_row(_("Deliver from Location:"), 'Location', $order->Location);
- date_row($delname, 'delivery_date',
+ date_row($delname, 'delivery_date',
_('Enter requested day of delivery'), $order->due_date, 0, 0, 0);
text_row(_("Deliver To:"), 'deliver_to', $order->deliver_to, 40, 40,