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