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