X-Git-Url: https://delta.frontaccounting.com/gitweb/?a=blobdiff_plain;f=sales%2Fincludes%2Fui%2Fsales_order_ui.inc;h=20509efcf373ba48fedd64c0148a925aac6acc5f;hb=22486f7826944e00937e7ccceab1a927c94d8f6a;hp=9cb6c363e0a9ffd2c6ffd0432c942f8efb14d002;hpb=f7357591d8dc95238a632a5d77e260057c982553;p=fa-stable.git
diff --git a/sales/includes/ui/sales_order_ui.inc b/sales/includes/ui/sales_order_ui.inc
index 9cb6c363..20509efc 100644
--- a/sales/includes/ui/sales_order_ui.inc
+++ b/sales/includes/ui/sales_order_ui.inc
@@ -123,11 +123,13 @@ function get_customer_details_to_order(&$order, $customer_id, $branch_id)
}
elseif ($order->trans_type == ST_SALESORDER)
$order->due_date = add_days($order->document_date, $SysPrefs->default_delivery_required_by());
+ elseif ($order->trans_type == ST_SALESQUOTE)
+ $order->due_date = add_days($order->document_date, $SysPrefs->default_quote_valid_days());
if($order->payment_terms['cash_sale']) {
$order->set_location($order->pos["pos_location"], $order->pos["location_name"]);
} else
$order->set_location($myrow["default_location"], $myrow["location_name"]);
-
+
return $ret_error;
}
@@ -135,12 +137,12 @@ function get_customer_details_to_order(&$order, $customer_id, $branch_id)
function display_order_summary($title, &$order, $editable_items=false)
{
- global $SysPrefs;
display_heading($title);
div_start('items_table');
- start_table(TABLESTYLE, "colspan=7 width=90%");
+ start_table(TABLESTYLE, "width='90%'");
+
$th = array(_("Item Code"), _("Item Description"), _("Quantity"),
_("Delivered"),
_("Unit"), $order->tax_included ? _("Price after Tax") : _("Price before Tax"), _("Discount %"), _("Total"), "");
@@ -158,8 +160,9 @@ function display_order_summary($title, &$order, $editable_items=false)
$k = 0; //row colour counter
$id = find_submit('Edit');
- $has_marked = false;
- foreach ($order->line_items as $line_no=>$stock_item)
+
+ $low_stock = $order->check_qoh($_POST['OrderDate'], $_POST['Location']);
+ foreach ($order->get_items() as $line_no=>$stock_item)
{
$line_total = round($stock_item->qty_dispatched * $stock_item->price * (1 - $stock_item->discount_percent),
@@ -168,22 +171,10 @@ function display_order_summary($title, &$order, $editable_items=false)
$qoh_msg = '';
if (!$editable_items || $id != $line_no)
{
- if (!$SysPrefs->allow_negative_stock() && is_inventory_item($stock_item->stock_id)) {
- $qoh = get_qoh_on_date($stock_item->stock_id,
- $_POST['Location'], $_POST['delivery_date']);
- if (($stock_item->qty_dispatched -$stock_item->qty_done) > $qoh)
- {
- // oops, we don't have enough of one of the component items
- start_row("class='stockmankobg'");
- $qoh_msg .= $stock_item->stock_id . " - " . $stock_item->item_description . ": " .
- _("Quantity On Hand") . " = "
- . number_format2($qoh, get_qty_dec($stock_item->stock_id)) . '
';
- $has_marked = true;
- } else
- alt_table_row_color($k);
- } else {
+ if (in_array($stock_item->stock_id, $low_stock))
+ start_row("class='stockmankobg'"); // notice low stock status
+ else
alt_table_row_color($k);
- }
view_stock_status_cell($stock_item->stock_id);
@@ -242,12 +233,9 @@ function display_order_summary($title, &$order, $editable_items=false)
end_row();
end_table();
- if ($has_marked) {
+ if ($low_stock)
display_note(_("Marked items have insufficient quantities in stock as on day of delivery."), 0, 1, "class='stockmankofg'");
- if ($order->trans_type!=30 && !$SysPrefs->allow_negative_stock())
- display_error(_("The delivery cannot be processed because there is an insufficient quantity for item:")
- . '
'. $qoh_msg);
- }
+
div_end();
}
@@ -257,7 +245,7 @@ function display_order_header(&$order, $editable, $date_text)
{
global $Ajax, $SysPrefs;
- start_outer_table(TABLESTYLE2, "width=80%");
+ start_outer_table(TABLESTYLE2, "width='80%'");
table_section(1);
@@ -370,7 +358,6 @@ function display_order_header(&$order, $editable, $date_text)
$row = get_customer_to_order($_POST['customer_id']);
if ($row['dissallow_invoices'] == 1)
$customer_error = _("The selected customer account is currently on hold. Please contact the credit control personnel to discuss.");
-
}
}
@@ -378,10 +365,10 @@ function display_order_header(&$order, $editable, $date_text)
table_section(2);
- if (!is_company_currency($order->customer_currency))
+ if (!is_company_currency($order->customer_currency) && in_array($order->trans_type, array(ST_SALESINVOICE, ST_CUSTDELIVERY)))
{
label_row(_("Customer Currency:"), $order->customer_currency);
- exchange_rate_display($order->customer_currency, get_company_currency(),
+ exchange_rate_display(get_company_currency(), $order->customer_currency,
($editable ? $_POST['OrderDate'] : $order->document_date));
}
@@ -390,6 +377,7 @@ function display_order_header(&$order, $editable, $date_text)
label_row(_("Customer Discount:"), ($order->default_discount * 100) . "%");
table_section(3);
+ start_row();
if ($order->pos['cash_sale'] || $order->pos['credit_sale']) {
// editable payment type
if (get_post('payment') !== $order->payment) {
@@ -412,6 +400,7 @@ function display_order_header(&$order, $editable, $date_text)
} else {
label_cells(_('Payment:'), $order->payment_terms['terms']);
}
+ end_row();
if($editable) {
$str = sales_types_list_row(_("Price List:"), 'sales_type', null, true);
@@ -518,7 +507,7 @@ function sales_order_item_controls(&$order, &$rowcounter, $line_no=-1)
}
else // prepare new line
{
- sales_items_list_cells(null,'stock_id', null, false, true);
+ sales_items_list_cells(null,'stock_id', null, false, true, true);
if (list_updated('stock_id')) {
$Ajax->activate('price');
$Ajax->activate('units');
@@ -584,7 +573,7 @@ function display_delivery_details(&$order)
if ($order->payment_terms['cash_sale']) { // Direct payment sale
$Ajax->activate('items_table');
display_heading(_('Cash payment'));
- start_table(TABLESTYLE2, "width=60%");
+ start_table(TABLESTYLE2, "width='60%'");
locations_list_row(_("Deliver from Location:"), 'Location', null, false, true);
if (list_updated('Location'))
@@ -615,7 +604,7 @@ function display_delivery_details(&$order)
$delname = _("Required Delivery Date").':';
}
display_heading($title);
- start_outer_table(TABLESTYLE2, "width=90%");
+ start_outer_table(TABLESTYLE2, "width='90%'");
table_section(1);
locations_list_row(_("Deliver from Location:"), 'Location', null, false, true);