Pman.Tab.XtupleCurrency.bjs
[Pman.Xtuple] / Pman.Tab.XtupleCurrency.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.XtupleCurrency = new Roo.XComponent({
6     part     :  ["Xtuple","Currency"],
7     order    : '901-Pman.Tab.XtupleCurrency',
8     region   : 'center',
9     parent   : 'Pman.Tab.XtupleAccountsTab',
10     name     : "Pman.Tab.XtupleCurrency",
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             region : 'center',
22             title : "Currency / Rates",
23             layout : {
24                 xtype: 'BorderLayout',
25                 xns: Roo,
26                 items : [
27                     {
28                         xtype: 'GridPanel',
29                         xns: Roo,
30                         listeners : {
31                             activate : function() {
32                                 _this.panel = this;
33                                 if (_this.grid) {
34                                     _this.grid.footer.onClick('first');
35                                 }
36                             }
37                         },
38                         background : false,
39                         fitContainer : true,
40                         fitToframe : true,
41                         region : 'west',
42                         tableName : 'curr_symbol',
43                         title : "curr_symbol",
44                         grid : {
45                             xtype: 'Grid',
46                             xns: Roo.grid,
47                             autoExpandColumn : 'curr_name',
48                             loadMask : true,
49                             listeners : {
50                                 render : function() 
51                                 {
52                                     _this.grid = this; 
53                                     //_this.dialog = Pman.Dialog.FILL_IN
54                                     if (_this.panel.active) {
55                                        this.footer.onClick('first');
56                                     }
57                                 },
58                                 rowdblclick : function (_self, rowIndex, e)
59                                 {
60                                     if (!_this.dialog) return;
61                                     _this.dialog.show( this.getDataSource().getAt(rowIndex).data, function() {
62                                         _this.grid.footer.onClick('first');
63                                     }); 
64                                 }
65                             },
66                             sm : {
67                                 xtype: 'RowSelectionModel',
68                                 xns: Roo.grid,
69                                 listeners : {
70                                     afterselectionchange : function (_self)
71                                     {
72                                         _this.rgrid.footer.onClick('first');
73                                     }
74                                 },
75                                 singleSelect : true
76                             },
77                             dataSource : {
78                                 xtype: 'Store',
79                                 xns: Roo.data,
80                                 remoteSort : true,
81                                 sortInfo : { field : 'curr_name', direction: 'ASC' },
82                                 proxy : {
83                                     xtype: 'HttpProxy',
84                                     xns: Roo.data,
85                                     method : 'GET',
86                                     url : baseURL + '/Roo/curr_symbol.php'
87                                 },
88                                 reader : {
89                                     xtype: 'JsonReader',
90                                     xns: Roo.data,
91                                     totalProperty : 'total',
92                                     root : 'data',
93                                     id : 'id',
94                                     fields : [
95                                         {
96                                             'name': 'curr_id',
97                                             'type': 'int'
98                                         },
99                                         {
100                                             'name': 'curr_base',
101                                             'type': 'int'
102                                         },
103                                         {
104                                             'name': 'curr_name',
105                                             'type': 'string'
106                                         },
107                                         {
108                                             'name': 'curr_symbol',
109                                             'type': 'string'
110                                         },
111                                         {
112                                             'name': 'curr_abbr',
113                                             'type': 'string'
114                                         }
115                                     ]
116                                 }
117                             },
118                             footer : {
119                                 xtype: 'PagingToolbar',
120                                 xns: Roo,
121                                 pageSize : 25,
122                                 displayInfo : true,
123                                 displayMsg : "Displaying curr_symbol{0} - {1} of {2}",
124                                 emptyMsg : "No curr_symbol found"
125                             },
126                             toolbar : {
127                                 xtype: 'Toolbar',
128                                 xns: Roo,
129                                 items : [
130                                     {
131                                         xtype: 'Fill',
132                                         xns: Roo.Toolbar
133                                     },
134                                     {
135                                         xtype: 'Button',
136                                         xns: Roo.Toolbar,
137                                         text : "Add",
138                                         cls : 'x-btn-text-icon',
139                                         icon : Roo.rootURL + 'images/default/dd/drop-add.gif',
140                                         listeners : {
141                                             click : function()
142                                             {
143                                                 if (!_this.dialog) return;
144                                                 _this.dialog.show( { id : 0 } , function() {
145                                                     _this.grid.footer.onClick('first');
146                                                }); 
147                                             }
148                                         }
149                                     }
150                                 ]
151                             },
152                             colModel : [
153                                 {
154                                     xtype: 'ColumnModel',
155                                     xns: Roo.grid,
156                                     dataIndex : 'curr_name',
157                                     header : 'Name',
158                                     width : 80,
159                                     renderer : function(v,x,r) { 
160                                     
161                                         return String.format(r.data.curr_base*1 ? '<span style="color:red">{0}</span>' : '{0}', v); 
162                                         
163                                     }
164                                 },
165                                 {
166                                     xtype: 'ColumnModel',
167                                     xns: Roo.grid,
168                                     dataIndex : 'curr_symbol',
169                                     header : 'Symbol',
170                                     width : 80,
171                                     renderer : function(v,x,r) { 
172                                     
173                                         return String.format(r.data.curr_base*1 ? '<span style="color:red">{0}</span>' : '{0}', v); 
174                                         
175                                     }
176                                 },
177                                 {
178                                     xtype: 'ColumnModel',
179                                     xns: Roo.grid,
180                                     dataIndex : 'curr_abbr',
181                                     header : 'Abbr.',
182                                     width : 80,
183                                     renderer : function(v,x,r) { 
184                                     
185                                         return String.format(r.data.curr_base*1 ? '<span style="color:red">{0}</span>' : '{0}', v); 
186                                         
187                                     }
188                                 }
189                             ]
190                         }
191                     },
192                     {
193                         xtype: 'GridPanel',
194                         xns: Roo,
195                         listeners : {
196                             activate : function() {
197                                 _this.rpanel = this;
198                                 if (_this.rgrid) {
199                                     _this.rgrid.footer.onClick('first');
200                                 }
201                             }
202                         },
203                         background : false,
204                         fitContainer : true,
205                         fitToframe : true,
206                         region : 'center',
207                         tableName : 'curr_rate',
208                         title : "curr_rate",
209                         grid : {
210                             xtype: 'Grid',
211                             xns: Roo.grid,
212                             listeners : {
213                                 render : function() 
214                                 {
215                                     _this.rgrid = this; 
216                                     //_this.dialog = Pman.Dialog.FILL_IN
217                                     if (_this.rpanel.active) {
218                                        this.footer.onClick('first');
219                                     }
220                                 },
221                                 rowdblclick : function (_self, rowIndex, e)
222                                 {
223                                     if (!_this.dialog) return;
224                                     _this.dialog.show( this.getDataSource().getAt(rowIndex).data, function() {
225                                         _this.grid.footer.onClick('first');
226                                     }); 
227                                 }
228                             },
229                             autoExpandColumn : 'curr_rate',
230                             loadMask : true,
231                             dataSource : {
232                                 xtype: 'Store',
233                                 xns: Roo.data,
234                                 listeners : {
235                                     beforeload : function (_self, options)
236                                     {
237                                         var s = _this.grid.selModel.getSelected();
238                                         if (!s) { 
239                                             this.removeAll();
240                                             return false;
241                                         }
242                                         options.params.curr_id = s.data.curr_id;
243                                     }
244                                 },
245                                 remoteSort : true,
246                                 sortInfo : { field : 'curr_effective', direction: 'DESC' },
247                                 proxy : {
248                                     xtype: 'HttpProxy',
249                                     xns: Roo.data,
250                                     method : 'GET',
251                                     url : baseURL + '/Roo/curr_rate.php'
252                                 },
253                                 reader : {
254                                     xtype: 'JsonReader',
255                                     xns: Roo.data,
256                                     totalProperty : 'total',
257                                     root : 'data',
258                                     id : 'id',
259                                     fields : [
260                                         {
261                                             'name': 'curr_rate_id',
262                                             'type': 'int'
263                                         },
264                                         {
265                                             'name': 'curr_id',
266                                             'type': 'int'
267                                         },
268                                         {
269                                             'name': 'curr_id',
270                                             'type': 'int'
271                                         },
272                                         {
273                                             'name': 'curr_rate',
274                                             'type': 'float'
275                                         },
276                                         {
277                                             'name': 'curr_effective',
278                                             'type': 'date',
279                                             'dateFormat': 'Y-m-d'
280                                         },
281                                         {
282                                             'name': 'curr_expires',
283                                             'type': 'date',
284                                             'dateFormat': 'Y-m-d'
285                                         }
286                                     ]
287                                 }
288                             },
289                             footer : {
290                                 xtype: 'PagingToolbar',
291                                 xns: Roo,
292                                 pageSize : 25,
293                                 displayInfo : true,
294                                 displayMsg : "Displaying curr_rate{0} - {1} of {2}",
295                                 emptyMsg : "No curr_rate found"
296                             },
297                             toolbar : {
298                                 xtype: 'Toolbar',
299                                 xns: Roo,
300                                 items : [
301                                     {
302                                         xtype: 'Fill',
303                                         xns: Roo.Toolbar
304                                     },
305                                     {
306                                         xtype: 'Button',
307                                         xns: Roo.Toolbar,
308                                         text : "Add",
309                                         cls : 'x-btn-text-icon',
310                                         icon : Roo.rootURL + 'images/default/dd/drop-add.gif',
311                                         listeners : {
312                                             click : function()
313                                             {
314                                                 if (!_this.dialog) return;
315                                                 _this.dialog.show( { id : 0 } , function() {
316                                                     _this.grid.footer.onClick('first');
317                                                }); 
318                                             }
319                                         }
320                                     }
321                                 ]
322                             },
323                             colModel : [
324                                 {
325                                     xtype: 'ColumnModel',
326                                     xns: Roo.grid,
327                                     dataIndex : 'curr_effective',
328                                     header : 'From',
329                                     width : 150,
330                                     renderer : function(v) { return String.format('{0}', v ? v.format('d/M/Y') : ''); }
331                                 },
332                                 {
333                                     xtype: 'ColumnModel',
334                                     xns: Roo.grid,
335                                     dataIndex : 'curr_expires',
336                                     header : 'To',
337                                     width : 150,
338                                     renderer : function(v) { return String.format('{0}', v ? v.format('d/M/Y') : ''); }
339                                 },
340                                 {
341                                     xtype: 'ColumnModel',
342                                     xns: Roo.grid,
343                                     align : 'right',
344                                     dataIndex : 'curr_rate',
345                                     header : 'Rate',
346                                     width : 75,
347                                     renderer : function(v) { return String.format('{0}', v); }
348                                 },
349                                 {
350                                     xtype: 'ColumnModel',
351                                     xns: Roo.grid,
352                                     align : 'right',
353                                     dataIndex : 'curr_rate',
354                                     header : 'Rate',
355                                     width : 75,
356                                     renderer : function(v) { return String.format('{0}', v); }
357                                 }
358                             ]
359                         }
360                     }
361                 ],
362                 west : {
363                     xtype: 'LayoutRegion',
364                     xns: Roo,
365                     split : true,
366                     width : 300
367                 },
368                 center : {
369                     xtype: 'LayoutRegion',
370                     xns: Roo
371                 }
372             }
373         };
374     }
375 });