Pman.Tab.XtupleGeneralLedger.bjs
[Pman.Xtuple] / Pman.Tab.XtupleGeneralLedger.js
1 //<script type="text/javascript">
2
3 // Auto generated file - created by app.Builder.js- do not edit directly (at present!)
4
5 Pman.Tab.XtupleGeneralLedger = new Roo.XComponent({
6     part     :  ["Xtuple","GeneralLedger"],
7     order    : '100-Pman.Tab.XtupleGeneralLedger',
8     region   : 'center',
9     parent   : 'Pman.Tab.XtupleAccountsTab',
10     name     : "unnamed module",
11     disabled : false, 
12     permname : '', 
13     _tree : function()
14     {
15         var _this = this;
16         var MODULE = this;
17         return {
18             xtype: 'NestedLayoutPanel',
19             xns: Roo,
20             background : true,
21             fitContainer : true,
22             fitToFrame : true,
23             region : 'center',
24             title : "General Ledger",
25             layout : {
26                 xtype: 'BorderLayout',
27                 xns: Roo,
28                 items : [
29                     {
30                         xtype: 'GridPanel',
31                         xns: Roo,
32                         listeners : {
33                             activate : function() {
34                                 _this.wpanel = this;
35                                 if (_this.wgrid) {
36                                     _this.wgrid.ds.load({});
37                                 }
38                             }
39                         },
40                         background : false,
41                         fitContainer : true,
42                         fitToframe : true,
43                         region : 'west',
44                         tableName : 'accnt',
45                         title : "Account",
46                         grid : {
47                             xtype: 'Grid',
48                             xns: Roo.grid,
49                             listeners : {
50                                 render : function() 
51                                 {
52                                     _this.wgrid = this; 
53                                     _this.active = 1;
54                                     //_this.dialog = Pman.Dialog.FILL_IN
55                                     if (_this.wpanel.active) {
56                                        this.ds.load({});
57                                     }
58                                 },
59                                 rowclick : function (_self, rowIndex, e)
60                                 {
61                                     var s = _this.wgrid.ds.getAt(rowIndex);
62                                     
63                                     if(s.data.accnt_id * 1 < 1){
64                                         return;
65                                     }
66                                     
67                                     _this.grid.footer.onClick('first');
68                                     
69                                     
70                                 },
71                                 rowdblclick : function (_self, rowIndex, e)
72                                 {
73                                     var ret = _this.wgrid.ds.getAt(rowIndex).data;
74                                     if(ret.accnt_id * 1 < 1){
75                                         Roo.MessageBox.alert("Error", "Error occur on getting the account id!");
76                                         return;
77                                     }
78                                     Pman.Dialog.XtupleGLAccountNameEdit.show( {accnt_id : ret.accnt_id}, function() {
79                                         _this.wgrid.ds.load({});
80                                     }); 
81                                 }
82                             },
83                             autoExpandColumn : 'accnt_descrip',
84                             loadMask : true,
85                             toolbar : {
86                                 xtype: 'Toolbar',
87                                 xns: Roo,
88                                 items : [
89                                     {
90                                         xtype: 'TextField',
91                                         xns: Roo.form,
92                                         listeners : {
93                                             specialkey : function (_self, e)
94                                             {
95                                               _this.wgrid.ds.load({});
96                                             },
97                                             render : function (_self)
98                                             {
99                                                 _this.searchBox = _self;
100                                             }
101                                         },
102                                         width : 100
103                                     },
104                                     {
105                                         xtype: 'Button',
106                                         xns: Roo.Toolbar,
107                                         listeners : {
108                                             click : function (_self, e)
109                                             {
110                                                 _this.wgrid.ds.load({});
111                                             }
112                                         },
113                                         cls : 'x-btn-icon',
114                                         icon : rootURL + '/Pman/templates/images/search.gif'
115                                     },
116                                     {
117                                         xtype: 'Button',
118                                         xns: Roo.Toolbar,
119                                         listeners : {
120                                             click : function (_self, e)
121                                             {
122                                                 _this.searchBox.setValue('');\r
123                                                 _this.wgrid.ds.load({});\r
124                                             }
125                                         },
126                                         cls : 'x-btn-icon',
127                                         icon : rootURL + '/Pman/templates/images/edit-clear.gif'
128                                     },
129                                     {
130                                         xtype: 'DateField',
131                                         xns: Roo.form,
132                                         listeners : {
133                                             render : function (_self)\r
134                                             {\r
135                                                 _this.dateSel = _self;\r
136                                                _self.setValue(  new Date() );\r
137                                             },
138                                             select : function (combo, date)
139                                             {
140                                                 _this.wgrid.ds.load({});
141                                             }
142                                         },
143                                         allowBlank : false,
144                                         format : 'd/M/Y',
145                                         width : 100
146                                     },
147                                     {
148                                         xtype: 'Fill',
149                                         xns: Roo.Toolbar
150                                     },
151                                     {
152                                         xtype: 'TextField',
153                                         xns: Roo.form,
154                                         listeners : {
155                                             render : function (_self)
156                                             {
157                                                 _this.orderBox = _self;
158                                             }
159                                         },
160                                         width : 80
161                                     },
162                                     {
163                                         xtype: 'Button',
164                                         xns: Roo.Toolbar,
165                                         text : "Download / Upload",
166                                         menu : {
167                                             xtype: 'Menu',
168                                             xns: Roo.menu,
169                                             items : [
170                                                 {
171                                                     xtype: 'Item',
172                                                     xns: Roo.menu,
173                                                     listeners : {
174                                                         click : function (_self, e)
175                                                         {
176                                                             _this.active = (_this.active) ? 0 : 1;
177                                                             this.setText(_this.active ? "Show Inactive" : "Hide Inactive");
178                                                             _this.wgrid.ds.load({});
179                                                         }
180                                                     },
181                                                     text : "Show Inactive"
182                                                 },
183                                                 {
184                                                     xtype: 'Separator',
185                                                     xns: Roo.menu
186                                                 },
187                                                 {
188                                                     xtype: 'Item',
189                                                     xns: Roo.menu,
190                                                     listeners : {
191                                                         click : function (_self, e)
192                                                         {
193                                                             
194                                                           new Pman.Download({
195                                                                 url : baseURL + '/Roo/Metasql',
196                                                                 method : 'GET',
197                                                                 timeout: 60000,
198                                                                 newWindow : true,
199                                                                 params : {
200                                                                     _group : 'accnt',
201                                                                     _name : 'export',
202                                                                     csvCols : '*',
203                                                                     csvTitles : '*', 
204                                                                     limit : 9999         
205                                                                     
206                                                                 }
207                                                             });;
208                                                             Roo.MessageBox.alert("Notice", "Downloading");
209                                                         }
210                                                     },
211                                                     text : "Export Account Details"
212                                                 },
213                                                 {
214                                                     xtype: 'Item',
215                                                     xns: Roo.menu,
216                                                     listeners : {
217                                                         click : function (_self, e)
218                                                         {
219                                                             
220                                                             new Pman.download({
221                                                                 url : baseURL + '/Roo/accnt.php',
222                                                                 method : 'GET',
223                                                                 params : {
224                                                                     'start' : 0,
225                                                                     'limit' : 9999,
226                                                                     _with_xt_balances : 1,
227                                                                     'csvTitles[0]' : 'Name', 'csvCols[0]' : 'accnt_name',
228                                                                     'csvTitles[1]' : 'Description', 'csvCols[1]' : 'accnt_descrip',
229                                                                     'csvTitles[2]' : 'Alternative Code', 'csvCols[2]' : 'accnt_code_alt',
230                                                                     'csvTitles[3]' : 'Alternative Description', 'csvCols[3]' : 'accnt_code_descrip',
231                                                                     'csvTitles[4]' : 'ADJUST', 'csvCols[4]' : 'balance_base'
232                                                                 }
233                                                                 
234                                                             });
235                                                         }
236                                                     },
237                                                     text : "Download Balances"
238                                                 },
239                                                 {
240                                                     xtype: 'Separator',
241                                                     xns: Roo.menu
242                                                 },
243                                                 {
244                                                     xtype: 'Item',
245                                                     xns: Roo.menu,
246                                                     listeners : {
247                                                         click : function (_self, e)
248                                                         {
249                                                            Pman.Dialog.XtupleUploadBalances.show( {} , function(res) {
250                                                                 Pman.Dialog.Image.show({
251                                                                     _url : baseURL + '/Xtuple/Import/JournalEntry?' + Roo.urlEncode(res)
252                                                                 }, function(data) {
253                                                                      _this.wgrid.ds.load({});
254                                                                 });
255                                                            }); 
256                                                         }
257                                                     },
258                                                     text : "Upload JE adjustment"
259                                                 },
260                                                 {
261                                                     xtype: 'Item',
262                                                     xns: Roo.menu,
263                                                     listeners : {
264                                                         click : function (_self, e)
265                                                         {
266                                                            Pman.Dialog.Image.show(
267                                                                {
268                                                                     _url : baseURL+'/Xtuple/Import/Accounts',
269                                                                     timeout : 90000
270                                                                 
271                                                                },
272                                                                function (data) {
273                                                                     Roo.MessageBox.alert("Notice", data); 
274                                                                     _this.grid.footer.onClick('first');
275                                                         
276                                                                }
277                                                            );
278                                                         }
279                                                     },
280                                                     text : "Upload Account Details"
281                                                 },
282                                                 {
283                                                     xtype: 'Separator',
284                                                     xns: Roo.menu
285                                                 },
286                                                 {
287                                                     xtype: 'Item',
288                                                     xns: Roo.menu,
289                                                     listeners : {
290                                                         click : function (_self, e)
291                                                         {
292                                                             
293                                                           new Pman.Download({
294                                                                 url : baseURL + '/Roo/Metasql',
295                                                                 method : 'GET',
296                                                                 timeout: 60000,
297                                                                 newWindow : true,
298                                                                 params : {
299                                                                     _group : 'apopen',
300                                                                     _name : 'bydate',
301                                                                     csvCols : '*',
302                                                                     csvTitles : '*', 
303                                                                     limit : 9999         
304                                                                     
305                                                                 }
306                                                             });;
307                                                             Roo.MessageBox.alert("Notice", "This may take some time to calculate");
308                                                         }
309                                                     },
310                                                     text : "Download AP - Day by Day Comparison"
311                                                 },
312                                                 {
313                                                     xtype: 'Item',
314                                                     xns: Roo.menu,
315                                                     listeners : {
316                                                         click : function (_self, e)
317                                                         {
318                                                             
319                                                           new Pman.Download({
320                                                                 url : baseURL + '/Roo/Metasql',
321                                                                 method : 'GET',
322                                                                 timeout: 90000,
323                                                                 params : {
324                                                                     _group : 'apopen',
325                                                                     _name : 'bydatesummary',
326                                                                     csvCols : '*',
327                                                                     csvTitles : '*', 
328                                                                     limit : 9999         
329                                                                     
330                                                                 }
331                                                             });;
332                                                             Roo.MessageBox.alert("Notice", "This may take some time to calculate");
333                                                         }
334                                                     },
335                                                     text : "Download AP open vs GL - summary of bad days"
336                                                 },
337                                                 {
338                                                     xtype: 'Item',
339                                                     xns: Roo.menu,
340                                                     listeners : {
341                                                         click : function (_self, e)
342                                                         {
343                                                             
344                                                           new Pman.Download({
345                                                                 url : baseURL + '/Roo/Metasql',
346                                                                 method : 'GET',
347                                                                 timeout: 90000,
348                                                                 params : {
349                                                                      'startDate:text' : _this.dateSel.getValue().format('Y-m-d'),
350                                                                     'endDate:text' :  _this.dateSel.getValue().add(Date.DAY,1).format('Y-m-d'),
351                                                                 
352                                                                     _group : 'apopen',
353                                                                     _name : 'all',
354                                                                     csvCols : '*',
355                                                                     csvTitles : '*', 
356                                                                     limit : 9999         
357                                                                     
358                                                                 }
359                                                             });;
360                                                             Roo.MessageBox.alert("Notice", "This may take some time to calculate");
361                                                         }
362                                                     },
363                                                     text : "Download AP - Transactions on a single day"
364                                                 },
365                                                 {
366                                                     xtype: 'Item',
367                                                     xns: Roo.menu,
368                                                     listeners : {
369                                                         click : function (_self, e)
370                                                         {
371                                                             
372                                                           new Pman.Download({
373                                                                 url : baseURL + '/Roo/Metasql',
374                                                                 method : 'GET',
375                                                                 timeout: 90000,
376                                                                 newWindow : 1,
377                                                                 params : {
378                                                                      'relDate:text' : _this.dateSel.getValue().format('Y-m-d'),
379                                                                     'useDocDate:text' :  'FALSE',
380                                                                     
381                                                                     _group : 'apAging',
382                                                                     _name : 'bydate',
383                                                                     csvCols : '*',
384                                                                     csvTitles : '*', 
385                                                                     limit : 9999         
386                                                                     
387                                                                 }
388                                                             });;
389                                                             Roo.MessageBox.alert("Notice", "This may take some time to calculate");
390                                                         }
391                                                     },
392                                                     text : "Download AP Aging at this date"
393                                                 },
394                                                 {
395                                                     xtype: 'Item',
396                                                     xns: Roo.menu,
397                                                     listeners : {
398                                                         click : function (_self, e)
399                                                         {
400                                                             
401                                                           new Pman.Download({
402                                                                 url : baseURL + '/Roo/Metasql',
403                                                                 method : 'GET',
404                                                                 timeout: 90000,
405                                                                 params : {
406                                                                       'relDate:text' : _this.dateSel.getValue().format('Y-m-d'),
407                                                                     
408                                                                     _group : 'apopen',
409                                                                     _name : 'history',
410                                                                     csvCols : '*',
411                                                                     csvTitles : '*', 
412                                                                     limit : 9999         
413                                                                     
414                                                                 }
415                                                             });
416                                                             Roo.MessageBox.alert("Notice", "This may take some time to calculate");
417                                                         }
418                                                     },
419                                                     text : "Download AP Aging Comparison back from this date"
420                                                 },
421                                                 {
422                                                     xtype: 'Separator',
423                                                     xns: Roo.menu
424                                                 },
425                                                 {
426                                                     xtype: 'Item',
427                                                     xns: Roo.menu,
428                                                     listeners : {
429                                                         click : function (_self, e)
430                                                         {
431                                                             
432                                                              new Pman.Download({
433                                                                 url : baseURL + '/Roo/Metasql',
434                                                                 method : 'GET',
435                                                                 params : {
436                                                                     _group : 'aropen',
437                                                                     _name : 'all',
438                                                                     'startDate:text' : _this.dateSel.getValue().format('Y-m-d'),
439                                                                     'endDate:text' :  _this.dateSel.getValue().add(Date.DAY,1).format('Y-m-d'),
440                                                                     csvCols : '*',
441                                                                     csvTitles : '*', 
442                                                                     limit : 9999        
443                                                                     
444                                                                 }
445                                                             });;
446                                                         }
447                                                     },
448                                                     text : "Download AR - Transactions on a day"
449                                                 },
450                                                 {
451                                                     xtype: 'Item',
452                                                     xns: Roo.menu,
453                                                     listeners : {
454                                                         click : function (_self, e)
455                                                         {
456                                                             
457                                                              new Pman.Download({
458                                                                 url : baseURL + '/Roo/Metasql',
459                                                                 method : 'GET',
460                                                                 params : {
461                                                                     _group : 'aropen',
462                                                                     _name : 'bydate',
463                                                                     csvCols : '*',
464                                                                     csvTitles : '*', 
465                                                                     limit : 9999         
466                                                                     
467                                                                 }
468                                                             });;
469                                                         }
470                                                     },
471                                                     text : "Download AR - Day by Day Comparison"
472                                                 },
473                                                 {
474                                                     xtype: 'Separator',
475                                                     xns: Roo.menu
476                                                 },
477                                                 {
478                                                     xtype: 'Item',
479                                                     xns: Roo.menu,
480                                                     text : "Gltrans vs Stock (COHEAD)",
481                                                     menu : {
482                                                         xtype: 'Menu',
483                                                         xns: Roo.menu,
484                                                         items : [
485                                                             {
486                                                                 xtype: 'Item',
487                                                                 xns: Roo.menu,
488                                                                 listeners : {
489                                                                     click : function (_self, e)
490                                                                     {
491                                                                         
492                                                                          new Pman.Download({
493                                                                             url : baseURL + '/Roo/Metasql',
494                                                                             method : 'GET',
495                                                                             timeout: 600000,
496                                                                             params : {
497                                                                                 _group : 'gltrans_stock',
498                                                                                 _name : 'bydate',
499                                                                                 csvCols : '*',
500                                                                                 csvTitles : '*', 
501                                                                                 limit : 9999       
502                                                                             }
503                                                                         });
504                                                                     }
505                                                                 },
506                                                                 text : "Download Gltrans vs Stock By Date"
507                                                             },
508                                                             {
509                                                                 xtype: 'Item',
510                                                                 xns: Roo.menu,
511                                                                 listeners : {
512                                                                     click : function (_self, e)
513                                                                     {
514                                                                         
515                                                                          new Pman.Download({
516                                                                             url : baseURL + '/Roo/Metasql',
517                                                                             method : 'GET',
518                                                                             timeout: 600000,
519                                                                             params : {
520                                                                                 _group : 'gltrans_stock',
521                                                                                 _name : 'bycohead',
522                                                                                 csvCols : '*',
523                                                                                 csvTitles : '*', 
524                                                                                 limit : 9999       
525                                                                             }
526                                                                         });
527                                                                     }
528                                                                 },
529                                                                 text : "Download Gltrans vs Sales Order"
530                                                             },
531                                                             {
532                                                                 xtype: 'Item',
533                                                                 xns: Roo.menu,
534                                                                 listeners : {
535                                                                     click : function (_self, e)
536                                                                     {
537                                                                         var dt = _this.dateSel.getValue();
538                                                                          new Pman.Download({
539                                                                             url : baseURL + '/Roo/Metasql',
540                                                                             method : 'GET',
541                                                                             params : {
542                                                                                 _group : 'gltrans_stock',
543                                                                                 _name : 'gltrans',
544                                                                                 '_as_of:text' : typeof(dt) == 'string' ? dt : dt.format('Y-m-d'),
545                                                                                 csvCols : '*',
546                                                                                 csvTitles : '*', 
547                                                                                 limit : 9999       
548                                                                             }
549                                                                         });
550                                                                     }
551                                                                 },
552                                                                 text : "Download Gltrans"
553                                                             },
554                                                             {
555                                                                 xtype: 'Item',
556                                                                 xns: Roo.menu,
557                                                                 listeners : {
558                                                                     click : function (_self, e)
559                                                                     {
560                                                                         var dt = _this.dateSel.getValue();
561                                                                          new Pman.Download({
562                                                                             url : baseURL + '/Roo/Metasql',
563                                                                             method : 'GET',
564                                                                             params : {
565                                                                                 _group : 'gltrans_stock',
566                                                                                 _name : 'stock',
567                                                                                 '_as_of:text' : typeof(dt) == 'string' ? dt : dt.format('Y-m-d'),
568                                                                                 csvCols : '*',
569                                                                                 csvTitles : '*', 
570                                                                                 limit : 9999       
571                                                                             }
572                                                                         });
573                                                                     }
574                                                                 },
575                                                                 text : "Download Stock"
576                                                             }
577                                                         ]
578                                                     }
579                                                 },
580                                                 {
581                                                     xtype: 'Separator',
582                                                     xns: Roo.menu
583                                                 },
584                                                 {
585                                                     xtype: 'Item',
586                                                     xns: Roo.menu,
587                                                     text : "Gltrans vs Stock (PO)",
588                                                     menu : {
589                                                         xtype: 'Menu',
590                                                         xns: Roo.menu,
591                                                         items : [
592                                                             {
593                                                                 xtype: 'Item',
594                                                                 xns: Roo.menu,
595                                                                 listeners : {
596                                                                     click : function (_self, e)
597                                                                     {
598                                                                         
599                                                                          new Pman.Download({
600                                                                             url : baseURL + '/Roo/Metasql',
601                                                                             method : 'GET',
602                                                                             timeout: 600000,
603                                                                             params : {
604                                                                                 _group : 'gltrans_stock',
605                                                                                 _name : 'byorder',
606                                                                                 csvCols : '*',
607                                                                                 csvTitles : '*', 
608                                                                                 limit : 9999       
609                                                                             }
610                                                                         });
611                                                                     }
612                                                                 },
613                                                                 text : "Download Gltrans vs Stock By PO"
614                                                             },
615                                                             {
616                                                                 xtype: 'Item',
617                                                                 xns: Roo.menu,
618                                                                 listeners : {
619                                                                     click : function (_self, e)
620                                                                     {
621                                                                         var ord = _this.orderBox.getValue();
622                                                                         
623                                                                         if(!ord.length){
624                                                                             Roo.MessageBox.alert('Error','Please enter a PO number');
625                                                                             return;
626                                                                         }
627                                                                         
628                                                                         
629                                                                          new Pman.Download({
630                                                                             url : baseURL + '/Roo/Metasql',
631                                                                             method : 'GET',
632                                                                             params : {
633                                                                                 _group : 'gltrans_stock',
634                                                                                 _name : 'byordergltrans',
635                                                                                 'docnumber:text' : ord,
636                                                                                 csvCols : '*',
637                                                                                 csvTitles : '*', 
638                                                                                 limit : 9999       
639                                                                             }
640                                                                         });
641                                                                     }
642                                                                 },
643                                                                 text : "Download Gltrans"
644                                                             },
645                                                             {
646                                                                 xtype: 'Item',
647                                                                 xns: Roo.menu,
648                                                                 listeners : {
649                                                                     click : function (_self, e)
650                                                                     {
651                                                                         var ord = _this.orderBox.getValue();
652                                                                         
653                                                                         if(!ord.length){
654                                                                             Roo.MessageBox.alert('Error','Please enter a PO number');
655                                                                             return;
656                                                                         }
657                                                                         
658                                                                         
659                                                                          new Pman.Download({
660                                                                             url : baseURL + '/Roo/Metasql',
661                                                                             method : 'GET',
662                                                                             params : {
663                                                                                 _group : 'gltrans_stock',
664                                                                                 _name : 'byorderstock',
665                                                                                 'docnumber:text' : ord,
666                                                                                 csvCols : '*',
667                                                                                 csvTitles : '*', 
668                                                                                 limit : 9999      
669                                                                             }
670                                                                         });
671                                                                     }
672                                                                 },
673                                                                 text : "Download Stock"
674                                                             }
675                                                         ]
676                                                     }
677                                                 },
678                                                 {
679                                                     xtype: 'Separator',
680                                                     xns: Roo.menu
681                                                 },
682                                                 {
683                                                     xtype: 'Item',
684                                                     xns: Roo.menu,
685                                                     text : "Kingdee",
686                                                     menu : {
687                                                         xtype: 'Menu',
688                                                         xns: Roo.menu,
689                                                         items : [
690                                                             {
691                                                                 xtype: 'Item',
692                                                                 xns: Roo.menu,
693                                                                 listeners : {
694                                                                     click : function (_self, e)
695                                                                     {
696                                                                         
697                                                                          new Pman.Download({
698                                                                             url : baseURL+'/Xtuple/Kingdee/Currency',
699                                                                             method : 'GET',
700                                                                             timeout: 600000
701                                                                         });
702                                                                         Roo.MessageBox.alert("Notice", "Report will download shortly");
703                                                                     }
704                                                                 },
705                                                                 text : "Currency"
706                                                             },
707                                                             {
708                                                                 xtype: 'Item',
709                                                                 xns: Roo.menu,
710                                                                 listeners : {
711                                                                     click : function (_self, e)
712                                                                     {
713                                                                         
714                                                                          new Pman.Download({
715                                                                             url : baseURL+'/Xtuple/Kingdee/Rate',
716                                                                             method : 'GET',
717                                                                             timeout: 600000
718                                                                         });
719                                                                         Roo.MessageBox.alert("Notice", "Report will download shortly");
720                                                                     }
721                                                                 },
722                                                                 text : "Exchange Rate"
723                                                             },
724                                                             {
725                                                                 xtype: 'Item',
726                                                                 xns: Roo.menu,
727                                                                 listeners : {
728                                                                     click : function (_self, e)
729                                                                     {
730                                                                         
731                                                                          new Pman.Download({
732                                                                             url : baseURL+'/Xtuple/Kingdee/Account',
733                                                                             method : 'GET',
734                                                                             timeout: 600000
735                                                                         });
736                                                                         Roo.MessageBox.alert("Notice", "Report will download shortly");
737                                                                     }
738                                                                 },
739                                                                 text : "Accounts"
740                                                             },
741                                                             {
742                                                                 xtype: 'Item',
743                                                                 xns: Roo.menu,
744                                                                 listeners : {
745                                                                     click : function (_self, e)
746                                                                     {
747                                                                         new Pman.Download({
748                                                                             url : baseURL+'/Xtuple/Kingdee/VoucherGroup',
749                                                                             method : 'GET',
750                                                                             timeout: 600000
751                                                                         });
752                                                                         Roo.MessageBox.alert("Notice", "Report will download shortly");
753                                                                     }
754                                                                 },
755                                                                 text : "Voucher Category"
756                                                             },
757                                                             {
758                                                                 xtype: 'Item',
759                                                                 xns: Roo.menu,
760                                                                 listeners : {
761                                                                     click : function (_self, e)
762                                                                     {
763                                                                         var dt = _this.dateSel.getValue();
764                                                                         new Pman.Download({
765                                                                             url : baseURL+'/Xtuple/Kingdee/Voucher',
766                                                                             method : 'GET',
767                                                                             timeout: 600000,
768                                                                             params : {
769                                                                                 _as_of : (typeof(dt) == 'string') ? dt : dt.format('Y-m-d')
770                                                                             }
771                                                                         });
772                                                                         Roo.MessageBox.alert("Notice", "Report will download shortly - If you wanna import again, please delete all the exist!");
773                                                                     }
774                                                                 },
775                                                                 text : "Transactions"
776                                                             }
777                                                         ]
778                                                     }
779                                                 }
780                                             ]
781                                         }
782                                     }
783                                 ]
784                             },
785                             dataSource : {
786                                 xtype: 'Store',
787                                 xns: Roo.data,
788                                 listeners : {
789                                     beforeload : function (_self, options)
790                                     {
791                                         options.params = options.params || {};
792                                         
793                                         options.params.limit = 9999;
794                                         
795                                         options.params._general_ledger = 1;
796                                         
797                                         options.params['search[name]'] = _this.searchBox.getValue();
798                                         
799                                         if (_this.active) {\r
800                                             options.params.accnt_active = 1;
801                                             options.params._with_balances = 1;\r
802                                         }
803                                         
804                                        
805                                         \r    var dt = _this.dateSel.getValue();\r
806                                         options.params._as_of = typeof(dt) == 'string' ? dt : dt.format('Y-m-d');
807                                         
808                                     
809                                     }
810                                 },
811                                 remoteSort : true,
812                                 sortInfo : { field : 'accnt_name', direction: 'ASC' },
813                                 proxy : {
814                                     xtype: 'HttpProxy',
815                                     xns: Roo.data,
816                                     listeners : {
817                                         loadexception : function (This, o, arg, e)
818                                         {
819                                         
820                                         }
821                                     },
822                                     method : 'GET',
823                                     url : baseURL + '/Roo/accnt.php'
824                                 },
825                                 reader : {
826                                     xtype: 'JsonReader',
827                                     xns: Roo.data,
828                                     id : 'accnt_id',
829                                     root : 'data',
830                                     totalProperty : 'total',
831                                     fields : [
832                                         {
833                                             'name': 'accnt_id',
834                                             'type': 'int'
835                                         },
836                                         {
837                                             'name': 'accnt_name',
838                                             'type': 'string'
839                                         },
840                                         {
841                                             'name': 'accnt_descrip',
842                                             'type': 'string'
843                                         },
844                                         {
845                                             'name': 'accnt_type',
846                                             'type': 'string'
847                                         },
848                                         {
849                                             'name': 'accnt_subaccnttype_code',
850                                             'type': 'string'
851                                         },
852                                         {
853                                             'name': 'accnt_curr_id_curr_name',
854                                             'type': 'string'
855                                         },
856                                         {
857                                             'name': 'accnt_curr_id_curr_id',
858                                             'type': 'int'
859                                         }
860                                     ]
861                                 }
862                             },
863                             colModel : [
864                                 {
865                                     xtype: 'ColumnModel',
866                                     xns: Roo.grid,
867                                     dataIndex : 'accnt_name',
868                                     header : 'Name',
869                                     sortable : true,
870                                     width : 100,
871                                     renderer : function(v) { return String.format('{0}', v); }
872                                 },
873                                 {
874                                     xtype: 'ColumnModel',
875                                     xns: Roo.grid,
876                                     dataIndex : 'accnt_code_alt',
877                                     header : 'Alternative Code',
878                                     hidden : true,
879                                     sortable : true,
880                                     width : 50,
881                                     renderer : function(v) { return String.format('{0}', v); }
882                                 },
883                                 {
884                                     xtype: 'ColumnModel',
885                                     xns: Roo.grid,
886                                     dataIndex : 'accnt_descrip_alt',
887                                     header : 'Alternative Description',
888                                     hidden : true,
889                                     sortable : true,
890                                     width : 50,
891                                     renderer : function(v) { return String.format('{0}', v); }
892                                 },
893                                 {
894                                     xtype: 'ColumnModel',
895                                     xns: Roo.grid,
896                                     dataIndex : 'accnt_type',
897                                     header : 'Type',
898                                     sortable : true,
899                                     width : 50,
900                                     renderer : function(v,x,r) {
901                                          return String.format('{0}-{1}', v,r.data.accnt_subaccnttype_code); 
902                                      }
903                                 },
904                                 {
905                                     xtype: 'ColumnModel',
906                                     xns: Roo.grid,
907                                     dataIndex : 'accnt_descrip',
908                                     header : 'Description',
909                                     sortable : true,
910                                     width : 200,
911                                     renderer : function(v,x,r) 
912                                     { 
913                                         if(r.data.accnt_descrip_alt){
914                                             return String.format('{0} ({1})', v, r.data.accnt_descrip_alt);     
915                                         }
916                                         
917                                         return String.format('{0}', v); 
918                                     }
919                                 },
920                                 {
921                                     xtype: 'ColumnModel',
922                                     xns: Roo.grid,
923                                     align : 'right',
924                                     dataIndex : 'accnt_curr_id_curr_name',
925                                     header : 'Currency',
926                                     sortable : true,
927                                     width : 50,
928                                     renderer : function(v) { 
929                                         var base = baseURL.match(/sg\.php$/) ? 'SGD' : 'HKD';
930                                         if (v != base) {
931                                             return String.format('<span style="color:green">{0}</span>', v);     
932                                         }
933                                     
934                                         return String.format('{0}', v); 
935                                     }
936                                 },
937                                 {
938                                     xtype: 'ColumnModel',
939                                     xns: Roo.grid,
940                                     dataIndex : 'balance',
941                                     header : 'Balance',
942                                     sortable : true,
943                                     width : 100,
944                                     renderer : function(v) { \r
945                                        return String.format('<span style="color:blue;text-decoration:underline;">{0}</span>',\r
946                                                 Roo.util.Format.usMoney(v) ); 
947                                     }
948                                 }
949                             ]
950                         }
951                     },
952                     {
953                         xtype: 'GridPanel',
954                         xns: Roo,
955                         listeners : {
956                             activate : function() {
957                                 _this.panel = this;
958                              /*   if (_this.grid) {
959                                     _this.grid.ds.load({});
960                                 } */
961                             }
962                         },
963                         background : false,
964                         fitContainer : true,
965                         fitToframe : true,
966                         region : 'center',
967                         tableName : 'gltrans',
968                         title : "Transactions",
969                         grid : {
970                             xtype: 'EditorGrid',
971                             xns: Roo.grid,
972                             listeners : {
973                                 render : function() 
974                                 {
975                                     _this.grid = this; 
976                                     //_this.dialog = Pman.Dialog.FILL_IN
977                                    /* if (_this.panel.active) {
978                                        this.ds.load({});
979                                     } */
980                                 },
981                                 afteredit : function (e)
982                                 {   
983                                     var r = _this.grid.ds.getAt(e.row);
984                                     
985                                     if(e.value == e.originalValue || !r){
986                                         return;
987                                     }
988                                 
989                                     new Pman.Request({
990                                         url : baseURL + '/Roo/Gltrans.php',
991                                         method :'POST',
992                                         params : {
993                                             gltrans_id : r.data.gltrans_id,
994                                             gltrans_notes : e.value,
995                                             _update_notes : 1
996                                             
997                                         },
998                                         success : function() {
999                                            
1000                                             _this.grid.footer.onClick('refresh');
1001                                             
1002                                         }
1003                                     });
1004                                     
1005                                 },
1006                                 rowclass : function (gridview, rowcfg)
1007                                 {
1008                                   rowcfg.rowClass = 'dragon-gl-fixedheight';
1009                                 },
1010                                 celldblclick : function (_self, rowIndex, columnIndex, e)
1011                                 {
1012                                     var cm = this.colModel.config[columnIndex].dataIndex;
1013                                     var r = this.ds.getAt(rowIndex);
1014                                     if (cm != 'gltrans_date') {
1015                                         return;
1016                                     }
1017                                     new Pman.Download({
1018                                         url : baseURL+ '/Roo/Metasql',
1019                                         method : 'GET',
1020                                         params : {
1021                                             _group : 'gltrans',
1022                                             _name : 'sequence',
1023                                             'gltrans_sequence:number' : r.data.gltrans_sequence,
1024                                             limit : 9999
1025                                         }
1026                                     });
1027                                     
1028                                 },
1029                                 cellclick : function (_self, rowIndex, columnIndex, e)
1030                                 {
1031                                     if (!Roo.get(e.getTarget()).hasClass('dragon-ref-accounts')) {
1032                                         return;
1033                                     }
1034                                     var r = this.ds.getAt(rowIndex);
1035                                     Pman.Dialog.XtupleJournalEntry.show({
1036                                         gltrans_id : r.data.gltrans_id
1037                                     }, function()
1038                                     {
1039                                         // no need to refresh as it's viewed only?
1040                                     });
1041                                     
1042                                     
1043                                 }
1044                             },
1045                             autoExpandColumn : 'gltrans_notes',
1046                             clicksToEdit : 2,
1047                             loadMask : true,
1048                             toolbar : {
1049                                 xtype: 'Toolbar',
1050                                 xns: Roo,
1051                                 items : [
1052                                     {
1053                                         xtype: 'TextField',
1054                                         xns: Roo.form,
1055                                         listeners : {
1056                                             specialkey : function (_self, e)
1057                                             {
1058                                               _this.grid.footer.onClick('first');
1059                                             },
1060                                             render : function (_self)
1061                                             {
1062                                                 _this.gltransBox = _self;
1063                                             }
1064                                         }
1065                                     },
1066                                     {
1067                                         xtype: 'ComboBox',
1068                                         xns: Roo.form,
1069                                         listeners : {
1070                                             render : function (_self)
1071                                             {
1072                                               _this.sourceCombo = _self;
1073                                             },
1074                                             select : function (combo, record, index)
1075                                             {
1076                                                 Roo.log('select');
1077                                                 _this.grid.footer.onClick('first');
1078                                             }
1079                                         },
1080                                         allowBlank : false,
1081                                         displayField : 'gltrans_source_name',
1082                                         editable : false,
1083                                         hiddenName : 'gltrans_source',
1084                                         listWidth : 200,
1085                                         mode : 'local',
1086                                         name : 'gltrans_source_name',
1087                                         tpl : '<div class="x-grid-cell-text x-btn button"><b>{gltrans_source_name}</b> </div>',
1088                                         triggerAction : 'all',
1089                                         value : "ALL",
1090                                         valueField : 'gltrans_source',
1091                                         width : 150,
1092                                         store : {
1093                                             xtype: 'SimpleStore',
1094                                             xns: Roo.data,
1095                                             data : [ 
1096                                                 [ 'ALL', "All Transactions"],
1097                                                 [ 'S/R' , "Sales Return"],
1098                                                 [ 'S/O', "Sales Orders"] ,
1099                                                 [ 'A/P', "Accounts Payable"] ,
1100                                                 [ 'A/R', "Accounts Recievable"] ,
1101                                                 [ 'I/M', "Inventory "] ,
1102                                                 [ 'G/L', "General Ledger "] 
1103                                                 
1104                                                 
1105                                             ],
1106                                             fields : [  'gltrans_source', 'gltrans_source_name']
1107                                         }
1108                                     },
1109                                     {
1110                                         xtype: 'Button',
1111                                         xns: Roo.Toolbar,
1112                                         listeners : {
1113                                             click : function (_self, e)
1114                                             {
1115                                                 _this.grid.footer.onClick('first');
1116                                             }
1117                                         },
1118                                         cls : 'x-btn-icon',
1119                                         icon : rootURL + '/Pman/templates/images/search.gif'
1120                                     },
1121                                     {
1122                                         xtype: 'Button',
1123                                         xns: Roo.Toolbar,
1124                                         listeners : {
1125                                             click : function (_self, e)
1126                                             {
1127                                                 _this.gltransBox.setValue('');\r
1128                                                 _this.grid.footer.onClick('first');\r
1129                                             }
1130                                         },
1131                                         cls : 'x-btn-icon',
1132                                         icon : rootURL + '/Pman/templates/images/edit-clear.gif'
1133                                     },
1134                                     {
1135                                         xtype: 'Fill',
1136                                         xns: Roo.Toolbar
1137                                     },
1138                                     {
1139                                         xtype: 'Button',
1140                                         xns: Roo.Toolbar,
1141                                         cls : 'x-btn-text-icon',
1142                                         text : "Download",
1143                                         icon : rootURL + '/Pman/templates/images/spreadsheet.gif',
1144                                         menu : {
1145                                             xtype: 'Menu',
1146                                             xns: Roo.menu,
1147                                             items : [
1148                                                 {
1149                                                     xtype: 'Item',
1150                                                     xns: Roo.menu,
1151                                                     listeners : {
1152                                                         click : function (_self, e)
1153                                                         {
1154                                                             var s = _this.wgrid.getSelectionModel().getSelected();
1155                                                             
1156                                                             if(!s){
1157                                                                 Roo.MessageBox.alert("Error", "Please select a account"); 
1158                                                                 return false;
1159                                                             }
1160                                                             
1161                                                             var dt = _this.dateSel.getValue();
1162                                                             
1163                                                             if(!dt){
1164                                                                 Roo.MessageBox.alert("Error", "Please select a date on the right"); 
1165                                                                 return false;
1166                                                             }  
1167                                                             
1168                                                             var g = _this.gltransBox.getValue();
1169                                                             
1170                                                             var params = {
1171                                                                 '_group' : 'account',
1172                                                                 '_name' : 'summary',
1173                                                                 'limit' : 99999,
1174                                                                 'accnt_id:number' : s.data.accnt_id,
1175                                                                 'endDate:text' : typeof(dt) == 'string' ? dt : dt.format('Y-m-d'),
1176                                                                 'csvTitles' : '*',
1177                                                                 'csvCols' : '*'
1178                                                             };
1179                                                             
1180                                                             if(g.length){
1181                                                                 params['search:text'] = g;
1182                                                             }
1183                                                             
1184                                                             new Pman.Download({
1185                                                               url : baseURL + '/Roo/Metasql',
1186                                                               params :   params,
1187                                                               method : 'GET'
1188                                                             });
1189                                                             
1190                                                             Roo.MessageBox.alert("Notice", "All Transactions Report for " + s.data.accnt_descrip + " will download shortly");
1191                                                         }
1192                                                     },
1193                                                     text : "Transactions from search result"
1194                                                 },
1195                                                 {
1196                                                     xtype: 'Item',
1197                                                     xns: Roo.menu,
1198                                                     listeners : {
1199                                                         click : function (_self, e)
1200                                                         {
1201                                                             var s = _this.wgrid.getSelectionModel().getSelected();
1202                                                             
1203                                                             if(!s){
1204                                                                 Roo.MessageBox.alert("Error", "Please select a account"); 
1205                                                                 return false;
1206                                                             }
1207                                                             
1208                                                             var dt = _this.dateSel.getValue();
1209                                                             
1210                                                             if(!dt){
1211                                                                 Roo.MessageBox.alert("Error", "Please select a date on the right"); 
1212                                                                 return false;
1213                                                             }  
1214                                                             
1215                                                             var g = _this.gltransBox.getValue();
1216                                                             
1217                                                             var params = {
1218                                                                 '_group' : 'account',
1219                                                                 '_name' : 'summary',
1220                                                                 'limit' : 99999,
1221                                                                 'accnt_id:number' : s.data.accnt_id,
1222                                                                 'endDate:text' : typeof(dt) == 'string' ? dt : dt.format('Y-m-d'),
1223                                                                 'csvTitles' : '*',
1224                                                                 'csvCols' : '*'
1225                                                             };
1226                                                             
1227                                                             if(g.length){
1228                                                                 params['search:text'] = g;
1229                                                             }
1230                                                             
1231                                                             new Pman.Download({
1232                                                               url : baseURL + '/Roo/Metasql',
1233                                                               params :   params,
1234                                                               method : 'GET'
1235                                                             });
1236                                                             
1237                                                             Roo.MessageBox.alert("Notice", "All Transactions Report for " + s.data.accnt_descrip + " will download shortly");
1238                                                         }
1239                                                     },
1240                                                     text : "All Transactions"
1241                                                 },
1242                                                 {
1243                                                     xtype: 'Item',
1244                                                     xns: Roo.menu,
1245                                                     listeners : {
1246                                                         click : function (_self, e)
1247                                                         {
1248                                                             var s = _this.wgrid.getSelectionModel().getSelected();
1249                                                             
1250                                                             if(!s){
1251                                                                 Roo.MessageBox.alert("Error", "Please select a account"); 
1252                                                                 return false;
1253                                                             }
1254                                                             
1255                                                             var dt = _this.dateSel.getValue();
1256                                                             
1257                                                             if(!dt){
1258                                                                 Roo.MessageBox.alert("Error", "Please select a date on the right"); 
1259                                                                 return false;
1260                                                             }  
1261                                                             
1262                                                             new Pman.Download({
1263                                                                 url : baseURL + '/Roo/Gltrans.php',
1264                                                                 method :'GET',
1265                                                                 params : {
1266                                                                     gltrans_accnt_id : s.data.accnt_id,
1267                                                                     _as_of : typeof(dt) == 'string' ? dt : dt.format('Y-m-d'),
1268                                                                     _download : 1
1269                                                                 }
1270                                                             });
1271                                                             
1272                                                             Roo.MessageBox.alert("Notice", "Financial Year Report for " + s.data.accnt_descrip + " will download shortly");
1273                                                         }
1274                                                     },
1275                                                     text : "All Transactions (Selected Financial Year)"
1276                                                 },
1277                                                 {
1278                                                     xtype: 'Item',
1279                                                     xns: Roo.menu,
1280                                                     listeners : {
1281                                                         click : function (_self, e)
1282                                                         {   
1283                                                             var dt = _this.dateSel.getValue();
1284                                                             
1285                                                             if(!dt){
1286                                                                 Roo.MessageBox.alert("Error", "Please select a date on the right"); 
1287                                                                 return false;
1288                                                             }   
1289                                                                
1290                                                             new Pman.Download({
1291                                                                 url : baseURL + '/Roo/Gltrans.php',
1292                                                                 method :'GET',
1293                                                                 timeout : 900000,
1294                                                                 params : {
1295                                                                     _as_of : typeof(dt) == 'string' ? dt : dt.format('Y-m-d'),
1296                                                                     _download : 1
1297                                                                 }
1298                                                             });
1299                                                             
1300                                                             Roo.MessageBox.alert("Notice", "Financial Year Report for all accounts will download shortly! it might take several minutes");
1301                                                         }
1302                                                     },
1303                                                     text : "Download All Transactions  / All Accounts (Selected Financial Year)"
1304                                                 }
1305                                             ]
1306                                         }
1307                                     }
1308                                 ]
1309                             },
1310                             dataSource : {
1311                                 xtype: 'Store',
1312                                 xns: Roo.data,
1313                                 listeners : {
1314                                     beforeload : function (_self, options)
1315                                     {
1316                                         options.params = options.params || {};
1317                                         
1318                                         var s = _this.wgrid.getSelectionModel().getSelected();
1319                                         
1320                                         if(!s){
1321                                             return;
1322                                         }
1323                                         
1324                                         var dt = _this.dateSel.getValue();
1325                                         var g = _this.gltransBox.getValue();
1326                                         
1327                                         var params = {
1328                                             _group : 'account',
1329                                             _name : 'summary',
1330                                             'accnt_id:number' : s.data.accnt_id,
1331                                             'endDate:text' : typeof(dt) == 'string' ? dt : dt.format('Y-m-d')
1332                                         };
1333                                         
1334                                         // can not do source + search..
1335                                         var source = _this.sourceCombo.getValue();
1336                                         if (source != 'ALL') {
1337                                             params['search:text']  = source;
1338                                         }
1339                                         
1340                                         if(g.length){
1341                                             params['search:text'] = g;
1342                                         }
1343                                         
1344                                         Roo.apply(options.params,params);
1345                                         
1346                                         var cm = _this.grid.getColumnModel();
1347                                         var hide = (g.length) ? true : false;
1348                                         
1349                                         cm.setHidden(cm.getIndexByDataIndex('gltrans_balance'), hide);
1350                                         
1351                                         
1352                                     }
1353                                 },
1354                                 remoteSort : true,
1355                                 proxy : {
1356                                     xtype: 'HttpProxy',
1357                                     xns: Roo.data,
1358                                     method : 'GET',
1359                                     timeout : 600000,
1360                                     url : baseURL + '/Roo/Metasql.php'
1361                                 },
1362                                 reader : {
1363                                     xtype: 'JsonReader',
1364                                     xns: Roo.data,
1365                                     id : 'gltrans_id',
1366                                     root : 'data',
1367                                     totalProperty : 'total',
1368                                     fields : [
1369                                         {
1370                                             'name': 'gltrans_id',
1371                                             'type': 'int'
1372                                         },
1373                                         {
1374                                             'name': 'gltrans_accnt_id',
1375                                             'type': 'int'
1376                                         },
1377                                         {
1378                                             'name': 'gltrans_source',
1379                                             'type': 'string'
1380                                         },
1381                                         {
1382                                             'name': 'gltrans_amount',
1383                                             'type': 'int'
1384                                         },
1385                                         {
1386                                             'name': 'gltrans_notes',
1387                                             'type': 'string'
1388                                         }
1389                                     ]
1390                                 }
1391                             },
1392                             footer : {
1393                                 xtype: 'PagingToolbar',
1394                                 xns: Roo,
1395                                 pageSize : 100,
1396                                 items : [
1397                                     {
1398                                         xtype: 'TextItem',
1399                                         xns: Roo.Toolbar,
1400                                         text : "Double Click To Edit"
1401                                     }
1402                                 ]
1403                             },
1404                             colModel : [
1405                                 {
1406                                     xtype: 'ColumnModel',
1407                                     xns: Roo.grid,
1408                                     dataIndex : 'gltrans_date',
1409                                     header : 'Date',
1410                                     sortable : true,
1411                                     width : 100,
1412                                     renderer : function(v,x,r) { 
1413                                         return String.format('{0}<br/><i style="color:#ccc;">{1}</i>',
1414                                              v ? v : '', r.data.gltrans_sequence
1415                                          ); 
1416                                     }
1417                                 },
1418                                 {
1419                                     xtype: 'ColumnModel',
1420                                     xns: Roo.grid,
1421                                     dataIndex : 'gltrans_source',
1422                                     header : 'Source / Who',
1423                                     sortable : true,
1424                                     width : 100,
1425                                     renderer : function(v,x,r) { 
1426                                         return String.format('{0} - {1}<br/>{2}', v,r.data.gltrans_doctype, r.data.gltrans_username);
1427                                      }
1428                                 },
1429                                 {
1430                                     xtype: 'ColumnModel',
1431                                     xns: Roo.grid,
1432                                     dataIndex : 'gltrans_docnumber',
1433                                     header : 'Doc Number',
1434                                     hidden : true,
1435                                     sortable : true,
1436                                     width : 100
1437                                 },
1438                                 {
1439                                     xtype: 'ColumnModel',
1440                                     xns: Roo.grid,
1441                                     dataIndex : 'gltrans_notes',
1442                                     header : 'Account / Notes',
1443                                     width : 200,
1444                                     renderer : function(v,x,r) 
1445                                     { 
1446                                         return String.format(
1447                                                 '<u class="dragon-ref-accounts">{3}</u> - <span qtip="{2}"><b>{0}</b>' + "\n" + '{1}', 
1448                                                 r.data.gltrans_docnumber,
1449                                                  v, 
1450                                                 v.split('\n').join('<br/>'),
1451                                                 r.data.related_accounts
1452                                                 
1453                                             ).split('\n').join('<br/>');
1454                                         
1455                                     },
1456                                     editor : {
1457                                         xtype: 'GridEditor',
1458                                         xns: Roo.grid,
1459                                         field : {
1460                                             xtype: 'TextArea',
1461                                             xns: Roo.form
1462                                         }
1463                                     }
1464                                 },
1465                                 {
1466                                     xtype: 'ColumnModel',
1467                                     xns: Roo.grid,
1468                                     align : 'right',
1469                                     dataIndex : 'gltrans_base_curr',
1470                                     header : 'Currency',
1471                                     sortable : true,
1472                                     width : 75,
1473                                     renderer : function(v) { 
1474                                         return String.format('{0}', v); 
1475                                     }
1476                                 },
1477                                 {
1478                                     xtype: 'ColumnModel',
1479                                     xns: Roo.grid,
1480                                     align : 'right',
1481                                     dataIndex : 'gltrans_credit_amount',
1482                                     header : 'Credit',
1483                                     sortable : true,
1484                                     width : 100,
1485                                     renderer : function(v,x,r) { 
1486                                         return String.format('{0}', v ? Roo.util.Format.number(v*1,2)  : ''  );
1487                                     }
1488                                 },
1489                                 {
1490                                     xtype: 'ColumnModel',
1491                                     xns: Roo.grid,
1492                                     align : 'right',
1493                                     dataIndex : 'gltrans_debit_amount',
1494                                     header : 'Debit',
1495                                     sortable : true,
1496                                     width : 100,
1497                                     renderer : function(v,x,r) { 
1498                                         return String.format('{0}', v ? Roo.util.Format.number(v*1,2)  : ''  );
1499                                     }
1500                                 },
1501                                 {
1502                                     xtype: 'ColumnModel',
1503                                     xns: Roo.grid,
1504                                     align : 'right',
1505                                     dataIndex : 'gltrans_balance',
1506                                     header : 'Amount',
1507                                     sortable : true,
1508                                     width : 100,
1509                                     renderer : function(v) { 
1510                                         var c =v >= 0.0 ? 'black' :  'red';
1511                                     \r
1512                                        return String.format('<span style="color:' + c + ';">{0}</span>',\r
1513                                                 Roo.util.Format.number(v,2) ); 
1514                                     }
1515                                 }
1516                             ]
1517                         }
1518                     }
1519                 ],
1520                 center : {
1521                     xtype: 'LayoutRegion',
1522                     xns: Roo,
1523                     tabPosition : 'top'
1524                 },
1525                 west : {
1526                     xtype: 'LayoutRegion',
1527                     xns: Roo,
1528                     split : true,
1529                     tabPosition : 'top',
1530                     width : 600
1531                 }
1532             }
1533         };
1534     }
1535 });