4869: Work order listing and print work orders reports should omit voided orders...
authorJoe Hunt <joe.hunt.consulting@gmail.com>
Tue, 26 Mar 2019 09:42:35 +0000 (10:42 +0100)
committerJoe Hunt <joe.hunt.consulting@gmail.com>
Tue, 26 Mar 2019 09:42:35 +0000 (10:42 +0100)
manufacturing/includes/db/work_orders_db.inc
reporting/includes/reports_classes.inc
reporting/rep402.php

index 05ddbb6b4075247e1c7cee399f015ec0c8aac3d3..845253fe0fb7fb2626186937097281030218e220 100644 (file)
@@ -122,10 +122,12 @@ function get_work_order($woid, $allow_null=false)
 {
     $sql = "SELECT wo.*,st.description As StockItemName,l.location_name,
                l.delivery_address,l.email, l.contact, st.inventory_account, st.wip_account
-               FROM ".TB_PREF."workorders wo, "
+                       FROM ".TB_PREF."workorders wo
+                       LEFT JOIN ".TB_PREF."voided v ON v.id=wo.id and v.type=".ST_WORKORDER.","
                        .TB_PREF."stock_master st, "
                        .TB_PREF."locations l
-               WHERE st.stock_id=wo.stock_id
+               WHERE ISNULL(v.id)
+               AND st.stock_id=wo.stock_id
                AND     l.loc_code=wo.loc_code
                AND wo.id=".db_escape($woid)."
                GROUP BY wo.id";
index 77399c3f3a663b3c08631bc5909f57a101c7e5fa..1ad826e4a1187b71a0fb80be6eb5eb5478cd58e7 100644 (file)
@@ -410,6 +410,8 @@ class BoxReports
                                                FROM ".TB_PREF."stock_master item,"
                                                        .TB_PREF."workorders wo 
                                                        LEFT JOIN ".TB_PREF."voided v ON wo.id=v.id and v.type=".ST_WORKORDER."
+                                               WHERE ISNULL(v.id)
+                                               AND item.stock_id=wo.stock_id
                                                WHERE item.stock_id=wo.stock_id
                                                ORDER BY wo.id DESC";
                                        return combo_input($name, '', $sql, 'id', 'IName',array('order'=>false));
index 447a730573273d6a3e57215bfedca5b7160aa066..5cbb6994c08cb1b12fbe7b80f4b723ecf1cdcc1a 100644 (file)
@@ -43,10 +43,12 @@ function getTransactions($items, $open_only, $location)
                workorder.required_by,
                workorder.closed,
                workorder.stock_id
-               FROM ".TB_PREF."workorders as workorder,"
-                       .TB_PREF."stock_master as item,"
+               FROM ".TB_PREF."workorders as workorder
+                       LEFT JOIN ".TB_PREF."voided v ON v.id=workorder.id and v.type=".ST_WORKORDER.","
+                       .TB_PREF."stock_master as item,"
                        .TB_PREF."locations as location
-               WHERE workorder.stock_id=item.stock_id 
+               WHERE ISNULL(v.id)
+                       AND workorder.stock_id=item.stock_id 
                        AND workorder.loc_code=location.loc_code";
 
        if ($open_only != 0)