From 72f7a7675bd089e337892af420b29b77b507ca6f Mon Sep 17 00:00:00 2001 From: Joe Hunt Date: Fri, 11 Sep 2009 15:06:02 +0000 Subject: [PATCH] Changed so deleting of fiscal year also handles sales quotations --- CHANGELOG.txt | 6 +++++- admin/fiscalyears.php | 10 +++++----- 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/CHANGELOG.txt b/CHANGELOG.txt index b8ff716a..0796ea3e 100644 --- a/CHANGELOG.txt +++ b/CHANGELOG.txt @@ -19,7 +19,11 @@ Legend: ! -> Note $ -> Affected files -10-Swp-2009 Joe Hunt +11-Sep-2009 Joe Hunt +! Changed so deleting of fiscal year also handles sales quotations +$ /admin/fiscalyears.php + +10-Sep-2009 Joe Hunt ! By changing a simple sentence in allocation_cart.inc, the customer/supplier payments works with prompt payment discounts $ /includes/ui/allocation_cart.inc # Small typo error in types.inc diff --git a/admin/fiscalyears.php b/admin/fiscalyears.php index a0cb0ced..5e9e6d86 100644 --- a/admin/fiscalyears.php +++ b/admin/fiscalyears.php @@ -204,20 +204,20 @@ function delete_this_fiscalyear($selected_id) $ref = _("Open Balance"); $myrow = get_fiscalyear($selected_id); $to = $myrow['end']; - $sql = "SELECT order_no FROM ".TB_PREF."sales_orders WHERE ord_date <= '$to' AND type <> 1"; // don't take the templates + $sql = "SELECT order_no, trans_type FROM ".TB_PREF."sales_orders WHERE ord_date <= '$to' AND type <> 1"; // don't take the templates $result = db_query($sql, "Could not retrieve sales orders"); while ($row = db_fetch($result)) { - $sql = "SELECT SUM(qty_sent), SUM(quantity) FROM ".TB_PREF."sales_order_details WHERE order_no = {$row['order_no']}"; + $sql = "SELECT SUM(qty_sent), SUM(quantity) FROM ".TB_PREF."sales_order_details WHERE order_no = {$row['order_no']} AND trans_type = {$row['trans_type']}"; $res = db_query($sql, "Could not retrieve sales order details"); $row2 = db_fetch_row($res); if ($row2[0] == $row2[1]) { - $sql = "DELETE FROM ".TB_PREF."sales_order_details WHERE order_no = {$row['order_no']}"; + $sql = "DELETE FROM ".TB_PREF."sales_order_details WHERE order_no = {$row['order_no']} AND trans_type = {$row['trans_type']}"; db_query($sql, "Could not delete sales order details"); - $sql = "DELETE FROM ".TB_PREF."sales_orders WHERE order_no = {$row['order_no']}"; + $sql = "DELETE FROM ".TB_PREF."sales_orders WHERE order_no = {$row['order_no']} AND trans_type = {$row['trans_type']}"; db_query($sql, "Could not delete sales order"); - delete_attachments_and_comments(systypes::sales_order(), $row['order_no']); + delete_attachments_and_comments($row['trans_type'], $row['order_no']); } } $sql = "SELECT order_no FROM ".TB_PREF."purch_orders WHERE ord_date <= '$to'"; -- 2.30.2