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