From: Maxime Bourget Date: Sat, 1 Jun 2013 14:20:45 +0000 (+0100) Subject: Add ScheduleParameters class X-Git-Url: https://delta.frontaccounting.com/gitweb/?a=commitdiff_plain;h=32c1762ad84bf66d4b57041fcf53c53f0e37ee2c;p=order_line_extra.git Add ScheduleParameters class --- diff --git a/haxe/ItemScheduler.hx b/haxe/ItemScheduler.hx index f8bfc0a..5cb2682 100644 --- a/haxe/ItemScheduler.hx +++ b/haxe/ItemScheduler.hx @@ -1,5 +1,40 @@ import php.Lib; +typedef Detail = { + id : String, + quantity : Int, + position : Int, +} + +class ScheduleParameters { + var row_id : String; + var row_ids : Array; + var rowDetails: Hash; + function new(rawData : Dynamic) { + var data = php.Lib.objectOfAssociativeArray(rawData); + row_id = data.row_id; + row_ids = data.row_ids; + + rowDetails = new Hash(); + $type(rowDetails); + + var position = 1; + for(id in row_ids) { + rowDetails.set(id, { + id: id + ,quantity: null + ,position: position++ + }); + } + } + + public function position(id: String) : Int { + return rowDetails.get(id).position; + + } +} + + class ItemScheduler { var stock_id:String; var startLocation:String; @@ -183,6 +218,7 @@ class ItemScheduler { function purcharseOrders() { } + }