Fix #7123 - getting abra ready to test
[Pman.Xtuple] / Pman.Tab.XtupleArAging.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.XtupleArAging = new Roo.XComponent({
8     part     :  ["Xtuple", "ArAging" ],
9     order    : '400-Pman.Tab.XtupleArAging',
10     region   : 'center',
11     parent   : 'Pman.Tab.XtupleAccountsTab',
12     name     : "unnamed module",
13     disabled : false, 
14     permname : '', 
15     _tree : function()
16     {
17         var _this = this;
18         var MODULE = this;
19         return {
20             layout : {
21                 center : {
22                     '|xns' : 'Roo',
23                     xtype : 'LayoutRegion',
24                     xns : Roo
25                 },
26                 '|xns' : 'Roo',
27                 xtype : 'BorderLayout',
28                 xns : Roo,
29                 items : [
30                         {
31                         grid : {
32                             dataSource : {
33                                 proxy : {
34                                     '|xns' : 'Roo.data',
35                                     url : baseURL + '/Roo/Metasql.php',
36                                     method : 'GET',
37                                     xtype : 'HttpProxy',
38                                     timeout : 600000,
39                                     xns : Roo.data
40                                 },
41                                 reader : {
42                                     '|xns' : 'Roo.data',
43                                     id : 'id',
44                                     root : 'data',
45                                     xtype : 'JsonReader',
46                                     fields : [
47                                         {
48                                             'name': 'araging_apopen_id',
49                                             'type': 'int'
50                                         },
51                                         {
52                                             'name': 'araging_cust_id',
53                                             'type': 'int'
54                                         }
55                                     ],
56                                     xns : Roo.data,
57                                     totalProperty : 'total'
58                                 },
59                                 '|xns' : 'Roo.data',
60                                 xtype : 'Store',
61                                 remoteSort : true,
62                                 xns : Roo.data,
63                                 listeners : {
64                                         beforeload : function (_self, o)
65                                            {
66                                                o.params = o.params || {};
67                                                
68                                            
69                                                
70                                                var dt = _this.relDate.getValue();
71                                                
72                                                var params = {
73                                                    _group : 'arAging',
74                                                    _name : 'bydate',
75                                                    'relDate:text' : typeof(dt) == 'string' ? dt : dt.format('Y-m-d'),
76                                                    'useDocDate:text' : false
77                                                };
78                                                
79                                                var cs = _this.customerSel.getValue();
80                                                if (cs*1) {
81                                                    params['cust_id:number'] = cs;
82                                                
83                                                }
84                                                
85                                                
86                                                Roo.apply(o.params,params);
87                                            }
88                                 },
89                                 items : [
90
91                                 ]
92
93                             },
94                             toolbar : {
95                                 '|xns' : 'Roo',
96                                 xtype : 'Toolbar',
97                                 xns : Roo,
98                                 items : [
99                                         {
100                                         store : {
101                                             proxy : {
102                                                 '|xns' : 'Roo.data',
103                                                 url : baseURL + '/Roo/metasql.php',
104                                                 xtype : 'HttpProxy',
105                                                 method : 'GET',
106                                                 xns : Roo.data
107                                             },
108                                             reader : {
109                                                 '|xns' : 'Roo.data',
110                                                 id : 'cust_id',
111                                                 root : 'data',
112                                                 xtype : 'JsonReader',
113                                                 xns : Roo.data,
114                                                 fields : [{"name":"cust_id","type":"int"},"cust_name"],
115                                                 totalProperty : 'total'
116                                             },
117                                             '|xns' : 'Roo.data',
118                                             xtype : 'Store',
119                                             remoteSort : true,
120                                             sortInfo : { direction : 'ASC', field: 'cust_name' },
121                                             xns : Roo.data,
122                                             listeners : {
123                                                 beforeload : function (_self, o){
124                                                        o.params = o.params || {};
125                                                    
126                                                        if (!_this.relDate) {
127                                                            return false;
128                                                        }
129                                                        var dt = _this.relDate.getValue();    
130                                                        // set more here
131                                                        o.params['_group'] = 'arAging';
132                                                        o.params['_name'] = 'customers';
133                                                        o.params['relDate:text']  = typeof(dt) == 'string' ? dt : dt.format('Y-m-d');
134                                                        o.params['useDocDate:text'] = false    
135                                                    }
136                                             },
137                                             items : [
138
139                                             ]
140
141                                         },
142                                         '|xns' : 'Roo.form',
143                                         listWidth : 400,
144                                         triggerAction : 'all',
145                                         fieldLabel : 'cust_name',
146                                         forceSelection : true,
147                                         selectOnFocus : true,
148                                         pageSize : 20,
149                                         displayField : 'cust_name',
150                                         emptyText : "Select customer",
151                                         hiddenName : 'cust_id',
152                                         minChars : 2,
153                                         valueField : 'cust_id',
154                                         xtype : 'ComboBox',
155                                         allowBlank : true,
156                                         typeAhead : true,
157                                         editable : true,
158                                         width : 300,
159                                         xns : Roo.form,
160                                         name : 'cust_name',
161                                         qtip : "Select Customer",
162                                         queryParam : 'cust_name:text',
163                                         tpl : '<div class=\"x-grid-cell-text x-btn button\"><b>{cust_name}</b> </div>',
164                                         loadingText : "Searching...",
165                                         listeners : {
166                                                 render : function (_self)
167                                                    {
168                                                        _this.customerSel = _self;
169                                                    },
170                                                 select : function (combo, record, index)
171                                                    {
172                                                        _this.grid.footer.onClick('first');
173                                                    }
174                                         },
175                                         items : [
176
177                                         ]
178
179                                     },
180                                         {
181                                         '|xns' : 'Roo.Toolbar',
182                                         text : "as Of:",
183                                         xtype : 'TextItem',
184                                         xns : Roo.Toolbar
185                                     },
186                                         {
187                                         '|xns' : 'Roo.form',
188                                         format : 'Y-m-d',
189                                         xtype : 'DateField',
190                                         allowBlank : false,
191                                         width : 100,
192                                         xns : Roo.form,
193                                         listeners : {
194                                                 render : function (_self)\r
195                                                    {\r
196                                                        _this.relDate = _self;\r
197                                                       _self.setValue(  new Date() );\r
198                                                    },
199                                                 select : function (combo, date)
200                                                    {
201                                                        _this.grid.footer.onClick('first');
202                                                    }
203                                         }
204                                     }
205                                 ]
206
207                             },
208                             footer : {
209                                 '|xns' : 'Roo',
210                                 pageSize : 25,
211                                 xtype : 'PagingToolbar',
212                                 emptyMsg : "Nothing found",
213                                 xns : Roo,
214                                 displayMsg : "Displaying araging{0} - {1} of {2}",
215                                 displayInfo : true
216                             },
217                             '|xns' : 'Roo.grid',
218                             autoExpandColumn : 'araging_cust_name',
219                             xtype : 'Grid',
220                             loadMask : true,
221                             xns : Roo.grid,
222                             colModel : [
223                                  {
224                                         '|xns' : 'Roo.grid',
225                                         xtype : 'ColumnModel',
226                                         header : 'Date',
227                                         width : 100,
228                                         renderer : function(v) { 
229                                             var d = Date.parseDate(v, 'Y-m-d');
230                                         
231                                             return String.format('{0}', d.format('d/M/Y')); 
232                                         },
233                                         xns : Roo.grid,
234                                         dataIndex : 'araging_docdate'
235                                     },
236 {
237                                         '|xns' : 'Roo.grid',
238                                         xtype : 'ColumnModel',
239                                         header : 'Customer',
240                                         width : 200,
241                                         renderer : function(v) { return String.format('{0}', v); },
242                                         xns : Roo.grid,
243                                         dataIndex : 'araging_cust_name'
244                                     },
245 {
246                                         '|xns' : 'Roo.grid',
247                                         xtype : 'ColumnModel',
248                                         header : 'Doc Type',
249                                         width : 120,
250                                         renderer : function(v) {
251                                             switch(v) {
252                                                 case 'I':
253                                                     return "Invoice";
254                                                 case 'C':
255                                                     return "Credit Memo";        
256                                                 case 'D':
257                                                     return "Debit Memo";                    
258                                                 case 'R':
259                                                     return "Cash Receipt";        
260                                                 case 'V':
261                                                     return "Voucher";     
262                                                 default:
263                                                      return String.format('{0}', v); 
264                                              }
265                                          },
266                                         xns : Roo.grid,
267                                         dataIndex : 'araging_doctype'
268                                     },
269 {
270                                         '|xns' : 'Roo.grid',
271                                         xtype : 'ColumnModel',
272                                         header : 'Docnumber',
273                                         width : 120,
274                                         renderer : function(v) {
275                                             
276                                                      return String.format('{0}', v); 
277                                              
278                                          },
279                                         xns : Roo.grid,
280                                         dataIndex : 'araging_docnumber'
281                                     },
282 {
283                                         '|xns' : 'Roo.grid',
284                                         xtype : 'ColumnModel',
285                                         header : 'Order',
286                                         width : 150,
287                                         renderer : function(v) { return String.format('{0}', v); },
288                                         xns : Roo.grid,
289                                         dataIndex : 'araging_ponumber_pretty'
290                                     },
291 {
292                                         '|xns' : 'Roo.grid',
293                                         xtype : 'ColumnModel',
294                                         header : 'Currency',
295                                         width : 120,
296                                         renderer : function(v) {
297                                             
298                                                      return String.format('{0}', v); 
299                                              
300                                          },
301                                         xns : Roo.grid,
302                                         dataIndex : 'araging_curr_symbol'
303                                     },
304 {
305                                         '|xns' : 'Roo.grid',
306                                         align : 'right',
307                                         xtype : 'ColumnModel',
308                                         header : 'Value',
309                                         width : 100,
310                                         renderer : function(v) { 
311                                         
312                                                 return String.format(v*1 < 0 ? '<span style="color:red">{0}</span>' : '{0}', 
313                                                     Roo.util.Format.usMoney(v)); 
314                                             },
315                                         xns : Roo.grid,
316                                         dataIndex : 'araging_aropen_amount'
317                                     },
318 {
319                                         '|xns' : 'Roo.grid',
320                                         align : 'right',
321                                         xtype : 'ColumnModel',
322                                         header : '30 Days',
323                                         width : 100,
324                                         renderer : function(v) { 
325                                         
326                                                 return String.format(v*1 < 0 ? '<span style="color:red">{0}</span>' : '{0}', 
327                                                     Roo.util.Format.usMoney(v)); 
328                                             },
329                                         xns : Roo.grid,
330                                         dataIndex : 'araging_cur_val'
331                                     },
332 {
333                                         '|xns' : 'Roo.grid',
334                                         align : 'right',
335                                         xtype : 'ColumnModel',
336                                         header : '60 Days',
337                                         width : 100,
338                                         renderer : function(v) { 
339                                         
340                                                 return String.format(v*1 < 0 ? '<span style="color:red">{0}</span>' : '{0}', 
341                                                     Roo.util.Format.usMoney(v)); 
342                                             },
343                                         xns : Roo.grid,
344                                         dataIndex : 'araging_sixty_val'
345                                     },
346 {
347                                         '|xns' : 'Roo.grid',
348                                         align : 'right',
349                                         xtype : 'ColumnModel',
350                                         header : '90 Days',
351                                         width : 100,
352                                         renderer : function(v) { 
353                                         
354                                                 return String.format(v*1 < 0 ? '<span style="color:red">{0}</span>' : '{0}', 
355                                                     Roo.util.Format.usMoney(v)); 
356                                             },
357                                         xns : Roo.grid,
358                                         dataIndex : 'araging_ninety_val'
359                                     },
360 {
361                                         '|xns' : 'Roo.grid',
362                                         align : 'right',
363                                         xtype : 'ColumnModel',
364                                         header : 'Over 90 days',
365                                         width : 150,
366                                         renderer : function(v) { 
367                                         
368                                                 return String.format(v*1 < 0 ? '<span style="color:red">{0}</span>' : '{0}', 
369                                                     Roo.util.Format.usMoney(v)); 
370                                             },
371                                         xns : Roo.grid,
372                                         dataIndex : 'araging_plus_val'
373                                     },
374 {
375                                         '|xns' : 'Roo.grid',
376                                         align : 'right',
377                                         xtype : 'ColumnModel',
378                                         header : 'Total',
379                                         width : 150,
380                                         renderer : function(v) { 
381                                         
382                                                 return String.format(v*1 < 0 ? '<span style="color:red">{0}</span>' : '{0}', 
383                                                     Roo.util.Format.usMoney(v)); 
384                                             },
385                                         xns : Roo.grid,
386                                         dataIndex : 'araging_total_val'
387                                     },
388 {
389                                         '|xns' : 'Roo.grid',
390                                         align : 'right',
391                                         xtype : 'ColumnModel',
392                                         header : 'Total (BASE)',
393                                         width : 150,
394                                         renderer : function(v) { 
395                                         
396                                                 return String.format(v*1 < 0 ? '<span style="color:red">{0}</span>' : '{0}', 
397                                                     Roo.util.Format.usMoney(v)); 
398                                             },
399                                         xns : Roo.grid,
400                                         dataIndex : 'araging_base_total'
401                                     }
402                             ],
403                             listeners : {
404                                 render : function() 
405                                    {
406                                        _this.grid = this; 
407                                        //_this.dialog = Pman.Dialog.FILL_IN
408                                        if (_this.panel.active) {
409                                           this.footer.onClick('first');
410                                        }
411                                    }
412                             },
413                             items : [
414
415                             ]
416
417                         },
418                         '|xns' : 'Roo',
419                         fitToframe : true,
420                         background : true,
421                         region : 'center',
422                         title : "ArAging",
423                         xtype : 'GridPanel',
424                         fitContainer : true,
425                         xns : Roo,
426                         tableName : 'aropen',
427                         listeners : {
428                                 activate : function() {
429                                        _this.panel = this;
430                                        if (_this.grid) {
431                                            _this.grid.footer.onClick('first');
432                                        }
433                                    }
434                         },
435                         items : [
436
437                         ]
438
439                     }
440                 ]
441
442             },
443             '|xns' : 'Roo',
444             fitToFrame : true,
445             background : true,
446             region : 'center',
447             title : "Accounts Recievable",
448             xtype : 'NestedLayoutPanel',
449             fitContainer : true,
450             xns : Roo,
451             items : [
452
453             ]
454
455         };    }
456 });