Fix #7123 - getting abra ready to test
[Pman.Xtuple] / Pman.Tab.XtupleSalesShipment.js
1 //<script type="text/javascript">
2
3 // Auto generated file - created by app.Builder.js- do not edit directly (at present!)
4
5 Roo.namespace('Pman.Tab');
6
7 Pman.Tab.XtupleSalesShipment = new Roo.XComponent({
8     part     :  ["Xtuple", "SalesShipment" ],
9     order    : '100-Pman.Tab.XtupleSalesShipment',
10     region   : 'center',
11     parent   : 'Pman.Tab.XtupleSales',
12     name     : "unnamed module",
13     disabled : false, 
14     permname : '', 
15     _tree : function()
16     {
17         var _this = this;
18         var MODULE = this;
19         return {
20             grid : {
21                 dataSource : {
22                     proxy : {
23                         '|xns' : 'Roo.data',
24                         url : baseURL + '/Roo/shiphead.php',
25                         method : 'GET',
26                         xtype : 'HttpProxy',
27                         xns : Roo.data
28                     },
29                     reader : {
30                         '|xns' : 'Roo.data',
31                         id : 'id',
32                         root : 'data',
33                         xtype : 'JsonReader',
34                         xns : Roo.data,
35                         fields : [
36                             {
37                                 'name': 'shiphead_order_id',
38                                 'type': 'int'
39                             },
40                             {
41                                 'name': 'shiphead_number',
42                                 'type': 'string'
43                             },
44                             {
45                                 'name': 'shiphead_notes',
46                                 'type': 'string'
47                             },
48                             {
49                                 'name': 'shiphead_shipped',
50                                 'type': 'boolean'
51                             },
52                             {
53                                 'name': 'shiphead_shipdate',
54                                 'type': 'date'
55                             },
56                             {
57                                 'name': 'shiphead_sfstatus'
58                             }
59                         ],
60                         totalProperty : 'total',
61                         builderCfg : '{\"cols\":[{\"table\":\"shiphead\",\"column\":\"shiphead_order_id\",\"columnshort\":\"shiphead_order_id\",\"ctype\":\"int4\",\"desc\":\"\",\"use\":1,\"use_ex\":\"\",\"title\":\"Order#\"},{\"table\":\"shiphead\",\"column\":\"shiphead_number\",\"columnshort\":\"shiphead_number\",\"ctype\":\"text\",\"desc\":\"\",\"use\":1,\"use_ex\":0,\"title\":\"Shipment#\"},{\"table\":\"shiphead\",\"column\":\"shiphead_notes\",\"columnshort\":\"shiphead_notes\",\"ctype\":\"text\",\"desc\":\"\",\"use\":1,\"use_ex\":1,\"title\":\"\"},{\"table\":\"shiphead\",\"column\":\"shiphead_shipped\",\"columnshort\":\"shiphead_shipped\",\"ctype\":\"bool\",\"desc\":\"\",\"use\":1,\"use_ex\":\"\",\"title\":\"\"},{\"table\":\"shiphead\",\"column\":\"shiphead_shipdate\",\"columnshort\":\"shiphead_shipdate\",\"ctype\":\"date\",\"desc\":\"\",\"use\":1,\"use_ex\":\"\",\"title\":\"\"},{\"table\":\"shiphead\",\"column\":\"shiphead_sfstatus\",\"columnshort\":\"shiphead_sfstatus\",\"ctype\":\"bpchar\",\"desc\":\"\",\"use\":1,\"use_ex\":\"\",\"title\":\"\"}],\"cols_ex\":[\"shiphead_notes\"],\"table\":\"shiphead\",\"xtype\":\"GridPanel\",\"|xns\":\"Roo\"}'
62                     },
63                     '|xns' : 'Roo.data',
64                     xtype : 'Store',
65                     remoteSort : true,
66                     sortInfo : { field : 'shiphead_shipdate', direction: 'DESC' },
67                     xns : Roo.data,
68                     listeners : {
69                         beforeload : function (_self, o)
70                            {
71                                o.params._status =  _this.status.getValue();
72                                var cust = _this.custSel.getValue();
73                                if (cust *1) {
74                                     o.params.shiphead_custinfo_cust_id = cust;
75                                }
76                                
77                                if (_this.fromDate.getValue()) {
78                                    o.params['search[fromDate]'] = _this.fromDate.getValue().format('Y-m-d');
79                                }
80                                if (_this.toDate.getValue()) {
81                                    o.params['search[toDate]'] = _this.toDate.getValue().format('Y-m-d');
82                                }
83                            }
84                     },
85                     items : [
86
87                     ]
88
89                 },
90                 footer : {
91                     '|xns' : 'Roo',
92                     pageSize : 25,
93                     xtype : 'PagingToolbar',
94                     emptyMsg : "No shiphead found",
95                     xns : Roo,
96                     displayInfo : true,
97                     displayMsg : "Displaying shiphead{0} - {1} of {2}",
98                     items : [
99                         {
100                             '|xns' : 'Roo.Toolbar',
101                             text : "Download",
102                             xtype : 'Button',
103                             xns : Roo.Toolbar,
104                             listeners : {
105                                 click : function (_self, e)
106                                    {
107                                        new Pman.Download({
108                                            grid: _this.grid
109                                        });
110                                        Roo.MessageBox.alert("Notice", "Download should start soon");
111                                    }
112                             }
113                         }
114                     ]
115
116                 },
117                 toolbar : {
118                     '|xns' : 'Roo',
119                     xtype : 'Toolbar',
120                     xns : Roo,
121                     items : [
122                         {
123                             store : {
124                                 proxy : {
125                                     '|xns' : 'Roo.data',
126                                     url : baseURL + '/Roo/custinfo.php',
127                                     method : 'GET',
128                                     xtype : 'HttpProxy',
129                                     xns : Roo.data
130                                 },
131                                 reader : {
132                                     '|xns' : 'Roo.data',
133                                     id : 'cust_id',
134                                     root : 'data',
135                                     xtype : 'JsonReader',
136                                     xns : Roo.data,
137                                     fields : [{"name":"cust_id","type":"int"},"cust_name"],
138                                     totalProperty : 'total'
139                                 },
140                                 '|xns' : 'Roo.data',
141                                 xtype : 'Store',
142                                 remoteSort : true,
143                                 sortInfo : { direction : 'ASC', field: 'cust_name' },
144                                 xns : Roo.data,
145                                 listeners : {
146                                         beforeload : function (_self, o){
147                                                o.params = o.params || {};
148                                                // set more here
149                                            }
150                                 },
151                                 items : [
152
153                                 ]
154
155                             },
156                             '|xns' : 'Roo.form',
157                             listWidth : 400,
158                             triggerAction : 'all',
159                             fieldLabel : 'cust_name',
160                             forceSelection : false,
161                             selectOnFocus : true,
162                             pageSize : 20,
163                             displayField : 'cust_name',
164                             emptyText : "Select custinfo",
165                             hiddenName : 'cust_id',
166                             minChars : 2,
167                             valueField : 'cust_id',
168                             xtype : 'ComboBox',
169                             allowBlank : true,
170                             typeAhead : true,
171                             editable : true,
172                             width : 300,
173                             xns : Roo.form,
174                             name : 'cust_name',
175                             qtip : "Select Customer",
176                             queryParam : 'query[cust_name_begin]',
177                             tpl : '<div class=\"x-grid-cell-text x-btn button\"><b>{cust_name}</b> </div>',
178                             loadingText : "Searching...",
179                             listeners : {
180                                 render : function (_self)
181                                    {
182                                        _this.custSel = _self;
183                                    },
184                                 select : function (combo, record, index)
185                                    {
186                                     (function() {   _this.grid.footer.onClick('first'); }).defer(100);
187                                    }
188                             },
189                             items : [
190
191                             ]
192
193                         },
194                         {
195                             store : {
196                                 '|xns' : 'Roo.data',
197                                 xtype : 'SimpleStore',
198                                 data : [ 
199                                     [ 'S', "Shipped"],
200                                     [ 'R' , "Reserved"],
201                                     [ 'V' , "Void Only"],    
202                                     [ 'A', "All"] 
203                                 ],
204                                 fields : [  'ftype', 'fname'],
205                                 xns : Roo.data
206                             },
207                             '|xns' : 'Roo.form',
208                             listWidth : 200,
209                             triggerAction : 'all',
210                             fieldLabel : 'Status',
211                             displayField : 'fname',
212                             hiddenName : 'status',
213                             value : "S",
214                             valueField : 'ftype',
215                             xtype : 'ComboBox',
216                             allowBlank : false,
217                             editable : false,
218                             width : 100,
219                             xns : Roo.form,
220                             mode : 'local',
221                             name : 'status',
222                             listeners : {
223                                 render : function (_self)
224                                    {
225                                      _this.status = _self;
226                                    },
227                                 beforeselect : function (combo, record, index)
228                                    {
229                                     (function() {   _this.grid.footer.onClick('first'); }).defer(100);
230                                    }
231                             },
232                             items : [
233
234                             ]
235
236                         },
237                         {
238                             '|xns' : 'Roo.Toolbar',
239                             text : "From:",
240                             xtype : 'TextItem',
241                             xns : Roo.Toolbar
242                         },
243                         {
244                             '|xns' : 'Roo.form',
245                             format : 'Y-m-d',
246                             xtype : 'DateField',
247                             xns : Roo.form,
248                             listeners : {
249                                 render : function (_self)
250                                    {
251                                        _this.fromDate = _self;
252                                    },
253                                 select : function (combo, date)
254                                    {
255                                        _this.grid.footer.onClick('first');
256                                    }
257                             }
258                         },
259                         {
260                             '|xns' : 'Roo.Toolbar',
261                             text : " To:",
262                             xtype : 'TextItem',
263                             xns : Roo.Toolbar
264                         },
265                         {
266                             '|xns' : 'Roo.form',
267                             format : 'Y-m-d',
268                             xtype : 'DateField',
269                             xns : Roo.form,
270                             listeners : {
271                                 render : function (_self)
272                                    {
273                                        _this.toDate = _self;
274                                    },
275                                 select : function (combo, date)
276                                    {
277                                        _this.grid.footer.onClick('first');
278                                    }
279                             }
280                         }
281                     ]
282
283                 },
284                 '|xns' : 'Roo.grid',
285                 autoExpandColumn : 'shiphead_notes',
286                 xtype : 'Grid',
287                 loadMask : true,
288                 xns : Roo.grid,
289                 builderCfg : '{\"cols\":[{\"table\":\"shiphead\",\"column\":\"shiphead_order_id\",\"columnshort\":\"shiphead_order_id\",\"ctype\":\"int4\",\"desc\":\"\",\"use\":1,\"use_ex\":\"\",\"title\":\"Order#\"},{\"table\":\"shiphead\",\"column\":\"shiphead_number\",\"columnshort\":\"shiphead_number\",\"ctype\":\"text\",\"desc\":\"\",\"use\":1,\"use_ex\":0,\"title\":\"Shipment#\"},{\"table\":\"shiphead\",\"column\":\"shiphead_notes\",\"columnshort\":\"shiphead_notes\",\"ctype\":\"text\",\"desc\":\"\",\"use\":1,\"use_ex\":1,\"title\":\"\"},{\"table\":\"shiphead\",\"column\":\"shiphead_shipped\",\"columnshort\":\"shiphead_shipped\",\"ctype\":\"bool\",\"desc\":\"\",\"use\":1,\"use_ex\":\"\",\"title\":\"\"},{\"table\":\"shiphead\",\"column\":\"shiphead_shipdate\",\"columnshort\":\"shiphead_shipdate\",\"ctype\":\"date\",\"desc\":\"\",\"use\":1,\"use_ex\":\"\",\"title\":\"\"},{\"table\":\"shiphead\",\"column\":\"shiphead_sfstatus\",\"columnshort\":\"shiphead_sfstatus\",\"ctype\":\"bpchar\",\"desc\":\"\",\"use\":1,\"use_ex\":\"\",\"title\":\"\"}],\"cols_ex\":[\"shiphead_notes\"],\"table\":\"shiphead\",\"xtype\":\"GridPanel\",\"|xns\":\"Roo\"}',
290                 colModel : [
291                          {
292                                 '|xns' : 'Roo.grid',
293                                 xtype : 'ColumnModel',
294                                 sortable : true,
295                                 header : 'Order#',
296                                 width : 75,
297                                 renderer : function(v) { return String.format('{0}', v); },
298                                 xns : Roo.grid,
299                                 dataIndex : 'shiphead_order_id_cohead_number',
300                                 builderCfg : '{\"table\":\"shiphead\",\"column\":\"shiphead_order_id\",\"columnshort\":\"shiphead_order_id\",\"ctype\":\"int4\",\"desc\":\"\",\"use\":1,\"use_ex\":\"\",\"title\":\"Order#\"}'
301                             },
302 {
303                                 '|xns' : 'Roo.grid',
304                                 xtype : 'ColumnModel',
305                                 header : 'Customer',
306                                 width : 200,
307                                 renderer : function(v) { return String.format('{0}', v); },
308                                 xns : Roo.grid,
309                                 dataIndex : 'shiphead_custinfo_cust_name'
310                             },
311 {
312                                 '|xns' : 'Roo.grid',
313                                 xtype : 'ColumnModel',
314                                 sortable : true,
315                                 header : 'Shipment#',
316                                 width : 200,
317                                 renderer : function(v) { return String.format('{0}', v); },
318                                 xns : Roo.grid,
319                                 dataIndex : 'shiphead_number',
320                                 builderCfg : '{\"table\":\"shiphead\",\"column\":\"shiphead_number\",\"columnshort\":\"shiphead_number\",\"ctype\":\"text\",\"desc\":\"\",\"use\":1,\"use_ex\":0,\"title\":\"Shipment#\"}'
321                             },
322 {
323                                 '|xns' : 'Roo.grid',
324                                 xtype : 'ColumnModel',
325                                 header : 'notes',
326                                 width : 200,
327                                 renderer : function(v) { return String.format('{0}', v); },
328                                 xns : Roo.grid,
329                                 builderCfg : '{\"table\":\"shiphead\",\"column\":\"shiphead_notes\",\"columnshort\":\"shiphead_notes\",\"ctype\":\"text\",\"desc\":\"\",\"use\":1,\"use_ex\":1,\"title\":\"\"}',
330                                 dataIndex : 'shiphead_notes'
331                             },
332 {
333                                 '|xns' : 'Roo.grid',
334                                 xtype : 'ColumnModel',
335                                 header : 'Delivery Note#',
336                                 width : 200,
337                                 renderer : function(v) { return String.format('{0}', v); },
338                                 xns : Roo.grid,
339                                 dataIndex : 'shiphead_delivery_note'
340                             },
341 {
342                                 '|xns' : 'Roo.grid',
343                                 xtype : 'ColumnModel',
344                                 header : 'shipped',
345                                 width : 75,
346                                 renderer : function(v,x,r) { 
347                                 
348                                 
349                                 
350                                   
351                                     if (r.json.shiphead_shipdate.length) {
352                                     
353                                         if (r.json.shiphead_shipped) {
354                                             return "Confirmed";
355                                         }
356                                     
357                                          return 'Draft';
358                                     }
359                                      
360                                     return 'VOID';
361                                    
362                                 
363                                 },
364                                 xns : Roo.grid,
365                                 dataIndex : 'shiphead_shipped',
366                                 builderCfg : '{\"table\":\"shiphead\",\"column\":\"shiphead_shipped\",\"columnshort\":\"shiphead_shipped\",\"ctype\":\"bool\",\"desc\":\"\",\"use\":1,\"use_ex\":\"\",\"title\":\"\"}'
367                             },
368 {
369                                 '|xns' : 'Roo.grid',
370                                 xtype : 'ColumnModel',
371                                 sortable : true,
372                                 header : 'shipdate',
373                                 width : 75,
374                                 renderer : function(v) { return String.format('{0}', v ? v.format('d/M/Y') : ''); },
375                                 xns : Roo.grid,
376                                 dataIndex : 'shiphead_shipdate',
377                                 builderCfg : '{\"table\":\"shiphead\",\"column\":\"shiphead_shipdate\",\"columnshort\":\"shiphead_shipdate\",\"ctype\":\"date\",\"desc\":\"\",\"use\":1,\"use_ex\":\"\",\"title\":\"\"}'
378                             }
379                 ],
380                 listeners : {
381                         rowdblclick : function (_self, rowIndex, e)
382                            {
383                                 if (!_this.dialog) return;
384                                 
385                                 var d =  this.getDataSource().getAt(rowIndex).data;
386                                _this.dialog.show( {
387                                    cohead_id : d.shiphead_order_id
388                                
389                                }, function() {
390                                    _this.grid.footer.onClick('refresh');
391                                    Pman.Tab.XtupleSales.grid.footer.onClick('first');
392                                }); 
393                            },
394                         render : function() 
395                            {
396                                _this.grid = this; 
397                                try { 
398                                    _this.dialog = Pman.Dialog.XtupleSalesOrder;
399                                } catch(e) {}
400                                if (_this.panel.active) {
401                                   this.footer.onClick('first');
402                                }
403                            }
404                 },
405                 items : [
406
407                 ]
408
409             },
410             '|xns' : 'Roo',
411             fitToframe : true,
412             background : true,
413             region : 'center',
414             xtype : 'GridPanel',
415             title : "Fullfillments",
416             xns : Roo,
417             fitContainer : true,
418             builderCfg : '{\"cols\":[{\"table\":\"shiphead\",\"column\":\"shiphead_order_id\",\"columnshort\":\"shiphead_order_id\",\"ctype\":\"int4\",\"desc\":\"\",\"use\":1,\"use_ex\":\"\",\"title\":\"Order#\"},{\"table\":\"shiphead\",\"column\":\"shiphead_number\",\"columnshort\":\"shiphead_number\",\"ctype\":\"text\",\"desc\":\"\",\"use\":1,\"use_ex\":0,\"title\":\"Shipment#\"},{\"table\":\"shiphead\",\"column\":\"shiphead_notes\",\"columnshort\":\"shiphead_notes\",\"ctype\":\"text\",\"desc\":\"\",\"use\":1,\"use_ex\":1,\"title\":\"\"},{\"table\":\"shiphead\",\"column\":\"shiphead_shipped\",\"columnshort\":\"shiphead_shipped\",\"ctype\":\"bool\",\"desc\":\"\",\"use\":1,\"use_ex\":\"\",\"title\":\"\"},{\"table\":\"shiphead\",\"column\":\"shiphead_shipdate\",\"columnshort\":\"shiphead_shipdate\",\"ctype\":\"date\",\"desc\":\"\",\"use\":1,\"use_ex\":\"\",\"title\":\"\"},{\"table\":\"shiphead\",\"column\":\"shiphead_sfstatus\",\"columnshort\":\"shiphead_sfstatus\",\"ctype\":\"bpchar\",\"desc\":\"\",\"use\":1,\"use_ex\":\"\",\"title\":\"\"}],\"cols_ex\":[\"shiphead_notes\"],\"table\":\"shiphead\",\"xtype\":\"GridPanel\",\"|xns\":\"Roo\"}',
419             tableName : 'shiphead',
420             listeners : {
421                 activate : function() {
422                        _this.panel = this;
423                        if (_this.grid) {
424                            _this.grid.footer.onClick('first');
425                        }
426                    }
427             },
428             items : [
429
430             ]
431
432         };    }
433 });