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