Fix #7123 - getting abra ready to test
[Pman.Xtuple] / Pman.Tab.XtupleApAging.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.XtupleApAging = new Roo.XComponent({
8     part     :  ["Xtuple", "ApAging" ],
9     order    : '500-Pman.Tab.XtupleApAging',
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                             sm : {
33                                 '|xns' : 'Roo.grid',
34                                 xtype : 'RowSelectionModel',
35                                 singleSelect : true,
36                                 xns : Roo.grid
37                             },
38                             dataSource : {
39                                 proxy : {
40                                     '|xns' : 'Roo.data',
41                                     url : baseURL + '/Roo/Metasql.php',
42                                     method : 'GET',
43                                     xtype : 'HttpProxy',
44                                     timeout : 600000,
45                                     xns : Roo.data
46                                 },
47                                 reader : {
48                                     '|xns' : 'Roo.data',
49                                     id : 'id',
50                                     root : 'data',
51                                     xtype : 'JsonReader',
52                                     fields : [
53                                         {
54                                             'name': 'apaging_doctype',
55                                             'type': 'string'
56                                         }
57                                     ],
58                                     xns : Roo.data,
59                                     totalProperty : 'total'
60                                 },
61                                 '|xns' : 'Roo.data',
62                                 xtype : 'Store',
63                                 remoteSort : true,
64                                 xns : Roo.data,
65                                 listeners : {
66                                         beforeload : function (_self, o)
67                                            {
68                                                o.params = o.params || {};
69                                                
70                                            
71                                                
72                                                var dt = _this.relDate.getValue();
73                                                
74                                                var params = {
75                                                    _group : 'apAging',
76                                                    _name : 'bydate',
77                                                    'relDate:text' : typeof(dt) == 'string' ? dt : dt.format('Y-m-d'),
78                                                    'useDocDate:text' : false
79                                                };
80                                                
81                                                var vend = _this.vendSel.getValue();
82                                                if (vend*1) {
83                                                    params['vend_id:number'] = vend;
84                                                
85                                                }
86                                                
87                                                
88                                                Roo.apply(o.params,params);
89                                            }
90                                 },
91                                 items : [
92
93                                 ]
94
95                             },
96                             toolbar : {
97                                 '|xns' : 'Roo',
98                                 xtype : 'Toolbar',
99                                 xns : Roo,
100                                 items : [
101                                         {
102                                         store : {
103                                             proxy : {
104                                                 '|xns' : 'Roo.data',
105                                                 url : baseURL + '/Roo/metasql.php',
106                                                 xtype : 'HttpProxy',
107                                                 method : 'GET',
108                                                 xns : Roo.data
109                                             },
110                                             reader : {
111                                                 '|xns' : 'Roo.data',
112                                                 id : 'cust_id',
113                                                 root : 'data',
114                                                 xtype : 'JsonReader',
115                                                 fields : [{"name":"vend_id","type":"int"},"vend_name"],
116                                                 xns : Roo.data,
117                                                 totalProperty : 'total'
118                                             },
119                                             '|xns' : 'Roo.data',
120                                             xtype : 'Store',
121                                             remoteSort : true,
122                                             sortInfo : { direction : 'ASC', field: 'cust_name' },
123                                             xns : Roo.data,
124                                             listeners : {
125                                                 beforeload : function (_self, o){
126                                                        o.params = o.params || {};
127                                                    
128                                                        if (!_this.relDate) {
129                                                            return false;
130                                                        }
131                                                        var dt = _this.relDate.getValue();    
132                                                        // set more here
133                                                        o.params['_group'] = 'apAging';
134                                                        o.params['_name'] = 'vendors';
135                                                        o.params['relDate:text']  = typeof(dt) == 'string' ? dt : dt.format('Y-m-d');
136                                                        o.params['useDocDate:text'] = false    
137                                                    }
138                                             },
139                                             items : [
140
141                                             ]
142
143                                         },
144                                         '|xns' : 'Roo.form',
145                                         listWidth : 400,
146                                         triggerAction : 'all',
147                                         fieldLabel : 'cust_name',
148                                         forceSelection : true,
149                                         selectOnFocus : true,
150                                         pageSize : 20,
151                                         displayField : 'vend_name',
152                                         emptyText : "Select Vendor",
153                                         hiddenName : 'vend_id',
154                                         minChars : 2,
155                                         valueField : 'vend_id',
156                                         xtype : 'ComboBox',
157                                         allowBlank : true,
158                                         typeAhead : true,
159                                         editable : true,
160                                         width : 300,
161                                         xns : Roo.form,
162                                         name : 'vend_name',
163                                         qtip : "Select Vendor",
164                                         queryParam : 'vend_name:text',
165                                         tpl : '<div class=\"x-grid-cell-text x-btn button\"><b>{vend_name}</b> </div>',
166                                         loadingText : "Searching...",
167                                         listeners : {
168                                                 render : function (_self)
169                                                    {
170                                                        _this.vendSel = _self;
171                                                    },
172                                                 select : function (combo, record, index)
173                                                    {
174                                                        _this.grid.footer.onClick('first');
175                                                    }
176                                         },
177                                         items : [
178
179                                         ]
180
181                                     },
182                                         {
183                                         '|xns' : 'Roo.Toolbar',
184                                         text : "as Of:",
185                                         xtype : 'TextItem',
186                                         xns : Roo.Toolbar
187                                     },
188                                         {
189                                         '|xns' : 'Roo.form',
190                                         format : 'Y-m-d',
191                                         xtype : 'DateField',
192                                         allowBlank : false,
193                                         width : 100,
194                                         xns : Roo.form,
195                                         listeners : {
196                                                 render : function (_self)\r
197                                                    {\r
198                                                        _this.relDate = _self;\r
199                                                       _self.setValue(  new Date() );\r
200                                                    },
201                                                 select : function (combo, date)
202                                                    {
203                                                        _this.grid.footer.onClick('first');
204                                                    }
205                                         }
206                                     },
207                                         {
208                                         '|xns' : 'Roo.Toolbar',
209                                         xtype : 'Fill',
210                                         xns : Roo.Toolbar
211                                     },
212                                         {
213                                         '|xns' : 'Roo.Toolbar',
214                                         text : "Void",
215                                         xtype : 'Button',
216                                         cls : 'x-btn-text-icon',
217                                         icon : rootURL + '/Pman/templates/images/trash.gif',
218                                         xns : Roo.Toolbar,
219                                         listeners : {
220                                                 click : function ()
221                                                    {
222                                                        var s = _this.grid.getSelectionModel().getSelected();
223                                                        
224                                                        if(!s || s.data.apopen_id * 1 < 1){
225                                                            Roo.MessageBox.alert('Error', 'Please select a row');
226                                                            return;
227                                                        }
228                                                        
229                                                        if(s.data.apaging_doctype != 'V'){
230                                                            Roo.MessageBox.alert('Error', 'We just can handle voucher at the time being');
231                                                            return;
232                                                        }
233                                                        
234                                                        Roo.MessageBox.confirm("Are you sure", "Are you sure you want to VOID that?",
235                                                            function(r) {
236                                                                if (r != 'yes') {
237                                                                    return;
238                                                                }
239                                                                new Pman.Request({
240                                                                    mask : 'Voiding',
241                                                                    url : baseURL + '/Roo/Apopen',
242                                                                    method : 'POST',
243                                                                    params :  {
244                                                                        apopen_id : s.data.apopen_id,
245                                                                        _void : 1
246                                                                    },
247                                                                    success : function() {
248                                                                        _this.grid.footer.onClick('first');
249                                                                    }
250                                                                })
251                                                                
252                                                            }
253                                                        );
254                                                                
255                                                                
256                                                       
257                                                    }
258                                         }
259                                     }
260                                 ]
261
262                             },
263                             footer : {
264                                 '|xns' : 'Roo',
265                                 pageSize : 25,
266                                 xtype : 'PagingToolbar',
267                                 emptyMsg : "Nothing found",
268                                 xns : Roo,
269                                 displayMsg : "Displaying araging{0} - {1} of {2}",
270                                 displayInfo : true
271                             },
272                             '|xns' : 'Roo.grid',
273                             autoExpandColumn : 'araging_cust_name',
274                             xtype : 'Grid',
275                             loadMask : true,
276                             xns : Roo.grid,
277                             colModel : [
278                                  {
279                                         '|xns' : 'Roo.grid',
280                                         xtype : 'ColumnModel',
281                                         header : 'Date',
282                                         width : 100,
283                                         renderer : function(v) { 
284                                             var d = Date.parseDate(v, 'Y-m-d');
285                                         
286                                             return String.format('{0}', d.format('d/M/Y')); 
287                                         },
288                                         xns : Roo.grid,
289                                         dataIndex : 'apaging_docdate'
290                                     },
291 {
292                                         '|xns' : 'Roo.grid',
293                                         xtype : 'ColumnModel',
294                                         header : 'Vendor',
295                                         width : 200,
296                                         renderer : function(v) { return String.format('{0}', v); },
297                                         xns : Roo.grid,
298                                         dataIndex : 'apaging_vend_name'
299                                     },
300 {
301                                         '|xns' : 'Roo.grid',
302                                         xtype : 'ColumnModel',
303                                         header : 'Doc Type',
304                                         width : 120,
305                                         renderer : function(v) {
306                                             switch(v) {
307                                                 case 'I':
308                                                     return "Invoice";
309                                                 case 'C':
310                                                     return "Credit Memo";        
311                                                 case 'D':
312                                                     return "Debit Memo";                    
313                                                 case 'R':
314                                                     return "Cash Receipt";        
315                                                 case 'V':
316                                                     return "Voucher";        
317                                                 default:
318                                                      return String.format('{0}', v); 
319                                              }
320                                          },
321                                         xns : Roo.grid,
322                                         dataIndex : 'apaging_doctype'
323                                     },
324 {
325                                         '|xns' : 'Roo.grid',
326                                         xtype : 'ColumnModel',
327                                         header : 'Docnumber',
328                                         width : 120,
329                                         renderer : function(v) {
330                                             
331                                                      return String.format('{0}', v); 
332                                              
333                                          },
334                                         xns : Roo.grid,
335                                         dataIndex : 'apaging_docnumber'
336                                     },
337 {
338                                         '|xns' : 'Roo.grid',
339                                         xtype : 'ColumnModel',
340                                         header : 'Currency',
341                                         width : 120,
342                                         renderer : function(v) {
343                                             
344                                                      return String.format('{0}', v); 
345                                              
346                                          },
347                                         xns : Roo.grid,
348                                         dataIndex : 'apaging_curr_symbol'
349                                     },
350 {
351                                         '|xns' : 'Roo.grid',
352                                         align : 'right',
353                                         xtype : 'ColumnModel',
354                                         header : 'Value',
355                                         width : 100,
356                                         renderer : function(v) { 
357                                         
358                                                 return String.format(v*1 < 0 ? '<span style="color:red">{0}</span>' : '{0}', 
359                                                     Roo.util.Format.usMoney(v)); 
360                                             },
361                                         xns : Roo.grid,
362                                         dataIndex : 'apaging_apopen_amount'
363                                     },
364 {
365                                         '|xns' : 'Roo.grid',
366                                         align : 'right',
367                                         xtype : 'ColumnModel',
368                                         header : '30 Days',
369                                         width : 100,
370                                         renderer : function(v) { 
371                                         
372                                                 return String.format(v*1 < 0 ? '<span style="color:red">{0}</span>' : '{0}', 
373                                                     Roo.util.Format.usMoney(v)); 
374                                             },
375                                         xns : Roo.grid,
376                                         dataIndex : 'apaging_cur_val'
377                                     },
378 {
379                                         '|xns' : 'Roo.grid',
380                                         align : 'right',
381                                         xtype : 'ColumnModel',
382                                         header : '60 Days',
383                                         width : 100,
384                                         renderer : function(v) { 
385                                         
386                                                 return String.format(v*1 < 0 ? '<span style="color:red">{0}</span>' : '{0}', 
387                                                     Roo.util.Format.usMoney(v)); 
388                                             },
389                                         xns : Roo.grid,
390                                         dataIndex : 'apaging_sixty_val'
391                                     },
392 {
393                                         '|xns' : 'Roo.grid',
394                                         align : 'right',
395                                         xtype : 'ColumnModel',
396                                         header : '90 Days',
397                                         width : 100,
398                                         renderer : function(v) { 
399                                         
400                                                 return String.format(v*1 < 0 ? '<span style="color:red">{0}</span>' : '{0}', 
401                                                     Roo.util.Format.usMoney(v)); 
402                                             },
403                                         xns : Roo.grid,
404                                         dataIndex : 'apaging_ninety_val'
405                                     },
406 {
407                                         '|xns' : 'Roo.grid',
408                                         align : 'right',
409                                         xtype : 'ColumnModel',
410                                         header : 'Over 90 days',
411                                         width : 150,
412                                         renderer : function(v) { 
413                                         
414                                                 return String.format(v*1 < 0 ? '<span style="color:red">{0}</span>' : '{0}', 
415                                                     Roo.util.Format.usMoney(v)); 
416                                             },
417                                         xns : Roo.grid,
418                                         dataIndex : 'apaging_plus_val'
419                                     },
420 {
421                                         '|xns' : 'Roo.grid',
422                                         align : 'right',
423                                         xtype : 'ColumnModel',
424                                         header : 'Total',
425                                         width : 150,
426                                         renderer : function(v) { 
427                                         
428                                                 return String.format(v*1 < 0 ? '<span style="color:red">{0}</span>' : '{0}', 
429                                                     Roo.util.Format.usMoney(v)); 
430                                             },
431                                         xns : Roo.grid,
432                                         dataIndex : 'apaging_total_val'
433                                     },
434 {
435                                         '|xns' : 'Roo.grid',
436                                         align : 'right',
437                                         xtype : 'ColumnModel',
438                                         header : 'Total (BASE)',
439                                         width : 150,
440                                         renderer : function(v) { 
441                                         
442                                                 return String.format(v*1 < 0 ? '<span style="color:red">{0}</span>' : '{0}', 
443                                                     Roo.util.Format.usMoney(v)); 
444                                             },
445                                         xns : Roo.grid,
446                                         dataIndex : 'apaging_base_total'
447                                     }
448                             ],
449                             listeners : {
450                                 render : function() 
451                                    {
452                                        _this.grid = this; 
453                                        //_this.dialog = Pman.Dialog.FILL_IN
454                                        if (_this.panel.active) {
455                                           this.footer.onClick('first');
456                                        }
457                                    }
458                             },
459                             items : [
460
461                             ]
462
463                         },
464                         '|xns' : 'Roo',
465                         fitToframe : true,
466                         background : true,
467                         region : 'center',
468                         title : "ApAging",
469                         xtype : 'GridPanel',
470                         fitContainer : true,
471                         xns : Roo,
472                         tableName : 'apopen',
473                         listeners : {
474                                 activate : function() {
475                                        _this.panel = this;
476                                        if (_this.grid) {
477                                            _this.grid.footer.onClick('first');
478                                        }
479                                    }
480                         },
481                         items : [
482
483                         ]
484
485                     }
486                 ]
487
488             },
489             '|xns' : 'Roo',
490             fitToFrame : true,
491             background : true,
492             region : 'center',
493             title : "Accounts Payable",
494             xtype : 'NestedLayoutPanel',
495             fitContainer : true,
496             xns : Roo,
497             items : [
498
499             ]
500
501         };    }
502 });