From: Maxime Bourget Date: Mon, 27 May 2013 21:09:27 +0000 (+0100) Subject: Add header X-Git-Url: https://delta.frontaccounting.com/gitweb/?a=commitdiff_plain;h=5545ba2774de6c88576e4d4fc75c093d4c529723;p=order_line_extra.git Add header --- diff --git a/haxe/ItemScheduler.hx b/haxe/ItemScheduler.hx index 8efb21a..1cde71a 100644 --- a/haxe/ItemScheduler.hx +++ b/haxe/ItemScheduler.hx @@ -41,12 +41,14 @@ class FA { } class ItemScheduler { var stock_id:String; + var qoh: Int; function new(stock_id: String) { this.stock_id = stock_id; + qoh = untyped __call__('get_qoh_on_date', this.stock_id, 'DEF'); } function tableHeader() { - return ["A", "B", "C"]; + return ["Order", "Customer", "Quantity", "Left", "On Hand", "Loc", "Required Date"]; } function generateTable(): Void { @@ -57,7 +59,31 @@ class ItemScheduler { function formatRow(row) { var array = php.Lib.hashOfAssociativeArray(row); - php.Lib.print(''+array.get('stock_id')+''); + var quantity_before : Int = array.get('quantity_before'); + var quantity_available = qoh - quantity_before; + var quantity: Int = array.get('quantity'); + + + var status : String = if(quantity_available < quantity) 'overduebg'; + + var cells : Array = [ + array.get('order_id') + ,array.get('deliver_to') + ,quantity + ,quantity_available-quantity + ,quantity_available + ,array.get('from_stk_loc') + ,array.get('delivery_date') + ]; + + php.Lib.print(''); + for(cell in cells) { + php.Lib.print(''); + php.Lib.print(cell); + php.Lib.print(''); + } + php.Lib.print(''); + } @@ -66,7 +92,9 @@ class ItemScheduler { var sql : String = "SELECT * FROM "+tb+"denorm_order_details_queue JOIN "+tb+"sales_orders ON (order_no = order_id) - WHERE stock_id = '"+this.stock_id+"'"; + WHERE stock_id = '"+this.stock_id+"' + ORDER by quantity_before"; + return FA.query(sql); } }