X-Git-Url: https://delta.frontaccounting.com/gitweb/?a=blobdiff_plain;f=haxe%2FLocation.hx;h=f6cbccd5176934d59c11e6997fe7b44fe092ba30;hb=514ad9dfb6f8ea147b9cb9ee9b89d2b0b485b607;hp=50f2807e6f407623e227d922a559d87c052ce567;hpb=a73cdbbda185c9a43ef3870f5ab95d3e861b9f87;p=order_line_extra.git diff --git a/haxe/Location.hx b/haxe/Location.hx index 50f2807..f6cbccd 100644 --- a/haxe/Location.hx +++ b/haxe/Location.hx @@ -21,6 +21,26 @@ class Location { delivery = config_date != null ? Date.fromString(config_date) : null; } + public function quantityOnOrder(stock_id) : Int { + var TB = FA.tb(); + var sql = 'SELECT SUM(quantity_ordered - quantity_received) as quantity + FROM '+TB+'purch_order_details + NATURAL JOIN '+TB+'purch_orders + WHERE item_code = "'+stock_id+'" AND into_stock_location = "'+code+'" + AND quantity_ordered > quantity_received + ORDER by delivery_date' ; + + var result = FA.query(sql); + if(result.hasNext()) { + var row = php.Lib.objectOfAssociativeArray(result.next()); + return row.quantity; + } + else { + return 0; + } + + } + public function quantityOnHand(stock_id, date) : Null { if(qoh_cache == null || stock_id != stock_id_cache) { qoh_cache = untyped __call__('get_qoh_on_date', stock_id, code, date);