From: Joe Hunt Date: Sat, 26 Mar 2011 23:55:14 +0000 (+0100) Subject: Warning if line price is below standard cost in sales documents. X-Git-Tag: 2.3-final~733 X-Git-Url: https://delta.frontaccounting.com/gitweb/?a=commitdiff_plain;h=6351f4f948b1d66a1adf148ce2b8caa07c038f18;p=fa-stable.git Warning if line price is below standard cost in sales documents. --- diff --git a/sales/sales_order_entry.php b/sales/sales_order_entry.php index 60ba5def..52cfbd9d 100644 --- a/sales/sales_order_entry.php +++ b/sales/sales_order_entry.php @@ -493,6 +493,22 @@ function check_item_data() } return true; } + $cost_home = get_standard_cost(get_post('stock_id')); // Added 2011-03-27 Joe Hunt + $cost = $cost_home / get_exchange_rate_from_home_currency($_SESSION['Items']->customer_currency, $_SESSION['Items']->document_date); + if (input_num('price') < $cost) + { + $dec = user_price_dec(); + $curr = $_SESSION['Items']->customer_currency; + $price = number_format2(input_num('price'), $dec); + if ($cost_home == $cost) + $std_cost = number_format2($cost_home, $dec); + else + { + $price = $curr . " " . $price; + $std_cost = $curr . " " . number_format2($cost, $dec); + } + display_warning(sprintf(_("Price %s is below Standard Cost %s"), $price, $std_cost)); + } return true; }