X-Git-Url: https://delta.frontaccounting.com/gitweb/?a=blobdiff_plain;f=inventory%2Fincludes%2Finventory_db.inc;h=df25675516832e4ba3361dfb3c2e7fe8d1a06c0c;hb=a0afdae50f1bba4e8802d3699387c8c044392401;hp=901ddcfd9dae68c561c10c65f9135fce4e2c7c51;hpb=e9ad9e87f5eb2682d2e91c93134250fd8a8d2ad9;p=fa-stable.git diff --git a/inventory/includes/inventory_db.inc b/inventory/includes/inventory_db.inc index 901ddcfd..df256755 100644 --- a/inventory/includes/inventory_db.inc +++ b/inventory/includes/inventory_db.inc @@ -34,14 +34,16 @@ function get_stock_movements($stock_id, $StockLocation, $BeforeDate, $AfterDate) { $before_date = date2sql($BeforeDate); $after_date = date2sql($AfterDate); - $sql = "SELECT move.*, IF(ISNULL(supplier.supplier_id), debtor.name, supplier.supp_name) name"; + // PO Delivery and Customer Credit Notes references should be saved in stock moves reference in 2.5 + $sql = "SELECT move.*, IF(ISNULL(supplier.supplier_id), debtor.name, supplier.supp_name) name, + IF(move.type=".ST_SUPPRECEIVE.", grn.reference, IF(move.type=".ST_CUSTCREDIT.", cust_trans.reference, move.reference)) reference"; if(!$StockLocation) { $sql .= ", move.loc_code"; } $sql.= " FROM ".TB_PREF."stock_moves move LEFT JOIN ".TB_PREF."supp_trans credit ON credit.trans_no=move.trans_no AND credit.type=move.type - LEFT JOIN ".TB_PREF."grn_batch grn ON grn.id=move.trans_no AND 25=move.type + LEFT JOIN ".TB_PREF."grn_batch grn ON grn.id=move.trans_no AND move.type=".ST_SUPPRECEIVE." LEFT JOIN ".TB_PREF."suppliers supplier ON IFNULL(grn.supplier_id, credit.supplier_id)=supplier.supplier_id LEFT JOIN ".TB_PREF."debtor_trans cust_trans ON cust_trans.trans_no=move.trans_no AND cust_trans.type=move.type LEFT JOIN ".TB_PREF."debtors_master debtor ON cust_trans.debtor_no=debtor.debtor_no @@ -93,7 +95,7 @@ function send_reorder_email($loc, $st_ids, $st_names, $st_num, $st_reorder) $company = get_company_prefs(); $mail = new email($company['coy_name'], $company['email']); $to = $loc['location_name'] . " <" . $loc['email'] . ">"; - $subject = _("Stocks below Re-Order Level at " . $loc['location_name']); + $subject = _("Stocks below Re-Order Level at ") . $loc['location_name']; $msg = "\n"; for ($i = 0; $i < count($st_ids); $i++) $msg .= $st_ids[$i] . " " . $st_names[$i] . ", " . _("Re-Order Level") . ": " . $st_reorder[$i] . ", " . _("Below") . ": " . $st_num[$i] . "\n";