var result = untyped __call__('db_query', sql, sql);
return new QueryIterator(result);
}
+
+ static public function tb() : String {
+ return untyped __php__('TB_PREF');
+ }
}
class ItemScheduler {
var stock_id:String;
}
function generateTable(): Void {
- for(schedule in this.schedules()) {
- this.formatRow(schedule);
+ for(location in locations()) {
+ formatLocation(location);
+ }
+ for(order in this.orders()) {
+ this.formatRow(order);
}
}
}
+ function formatLocation(location : Location) {
+ var cells = [
+ location.code
+ ,location.name
+ ];
+ var status = 'header';
+ php.Lib.print('<tr class="'+status+'">');
+ for(cell in cells) {
+ php.Lib.print('<td>');
+ php.Lib.print(cell);
+ php.Lib.print('</td>');
+ }
+ php.Lib.print('</tr>');
+ }
+
function schedules() {
+ //return orders()+locations();
+ //return orders();
+ return cast(locations(), Array<Dynamic>);
+
+ }
+
+ function orders() {
var tb : String = untyped __php__('TB_PREF');
var sql : String = "SELECT *
FROM "+tb+"denorm_order_details_queue
return FA.query(sql);
}
+
+ function locations() {
+ var TB = FA.tb();
+ var sql = 'SELECT *
+ FROM '+TB+'locations';
+ var _locs = [];
+ for(row in FA.query(sql)) {
+ _locs.push(new Location(row));
+ }
+
+ return _locs;
+
+ }
+
+
+ function purcharseOrders() {
+ }
+
}
--- /dev/null
+/*
+enum Either<U,V> {
+
+};
+*/
+class Location {
+ public var code : String;
+ public var name : String;
+ public var comment : String;
+
+ public function new(row : Dynamic) {
+ var obj = php.Lib.objectOfAssociativeArray(row);
+ code = obj.loc_code;
+ name = obj.location_name;
+ comment = obj.delivery_address;
+ }
+}