Pman.Tab.XtupleTerms.bjs
[Pman.Xtuple] / Pman.Tab.XtupleTerms.js
1 //<script type="text/javascript">
2
3 // Auto generated file - created by app.Builder.js- do not edit directly (at present!)
4
5 Roo.namespace('Pman.Tab');
6
7 Pman.Tab.XtupleTerms = new Roo.XComponent({
8     part     :  ["Xtuple", "Terms" ],
9     order    : '700-Pman.Tab.XtupleTerms',
10     region   : 'center',
11     parent   : 'Pman.Tab.XtupleAccountsTab',
12     name     : "unnamed module",
13     disabled : false, 
14     permname : '', 
15     _tree : function()
16     {
17         var _this = this;
18         var MODULE = this;
19         return {
20             layout : {
21                 center : {
22                     '|xns' : 'Roo',
23                     xtype : 'LayoutRegion',
24                     xns : Roo
25                 },
26                 '|xns' : 'Roo',
27                 xtype : 'BorderLayout',
28                 xns : Roo,
29                 items : [
30                         {
31                         grid : {
32                             toolbar : {
33                                 '|xns' : 'Roo',
34                                 xtype : 'Toolbar',
35                                 xns : Roo,
36                                 items : [
37                                         {
38                                         '|xns' : 'Roo.form',
39                                         xtype : 'TextField',
40                                         xns : Roo.form,
41                                         listeners : {
42                                                 specialkey : function (_self, e)
43                                                    {
44                                                      _this.grid.footer.onClick('first');
45                                                    },
46                                                 render : function (_self)
47                                                    {
48                                                        _this.searchBox = _self;
49                                                    }
50                                         }
51                                     },
52                                         {
53                                         '|xns' : 'Roo.Toolbar',
54                                         xtype : 'Button',
55                                         cls : 'x-btn-icon',
56                                         icon : rootURL + '/Pman/templates/images/search.gif',
57                                         xns : Roo.Toolbar,
58                                         listeners : {
59                                                 click : function (_self, e)
60                                                    {
61                                                        _this.grid.footer.onClick('first');
62                                                    }
63                                         }
64                                     },
65                                         {
66                                         '|xns' : 'Roo.Toolbar',
67                                         xtype : 'Button',
68                                         cls : 'x-btn-icon',
69                                         icon : rootURL + '/Pman/templates/images/edit-clear.gif',
70                                         xns : Roo.Toolbar,
71                                         listeners : {
72                                                 click : function (_self, e)
73                                                    {
74                                                        _this.searchBox.setValue('');\r
75                                                    \r
76                                                        _this.grid.footer.onClick('first');\r
77                                                    }
78                                         }
79                                     }
80                                 ]
81
82                             },
83                             dataSource : {
84                                 proxy : {
85                                     '|xns' : 'Roo.data',
86                                     url : baseURL + '/Roo/terms.php',
87                                     xtype : 'HttpProxy',
88                                     method : 'GET',
89                                     xns : Roo.data
90                                 },
91                                 reader : {
92                                     '|xns' : 'Roo.data',
93                                     id : 'id',
94                                     root : 'data',
95                                     xtype : 'JsonReader',
96                                     xns : Roo.data,
97                                     fields : [
98                                         {
99                                             'name': 'terms_id',
100                                             'type': 'int'
101                                         },
102                                         {
103                                             'name': 'terms_code',
104                                             'type': 'string'
105                                         },
106                                         {
107                                             'name': 'terms_descrip',
108                                             'type': 'string',
109                                         }
110                                     ],
111                                     totalProperty : 'total'
112                                 },
113                                 '|xns' : 'Roo.data',
114                                 xtype : 'Store',
115                                 remoteSort : true,
116                                 sortInfo : { field : 'crdate', direction: 'ASC' },
117                                 xns : Roo.data,
118                                 listeners : {
119                                         beforeload : function (_self, o)
120                                            {
121                                                o.params = o.params || {};
122                                                
123                                                var s = _this.searchBox.getValue();
124                                                
125                                                if(s.length){
126                                                    o.params['search[name]'] = s;
127                                                }
128                                                
129                                              
130                                            }
131                                 },
132                                 items : [
133
134                                 ]
135
136                             },
137                             footer : {
138                                 '|xns' : 'Roo',
139                                 pageSize : 25,
140                                 xtype : 'PagingToolbar',
141                                 emptyMsg : "No terms found",
142                                 xns : Roo,
143                                 displayInfo : true,
144                                 displayMsg : "Displaying Terms{0} - {1} of {2}"
145                             },
146                             '|xns' : 'Roo.grid',
147                             autoExpandColumn : 'terms_descrip',
148                             xtype : 'Grid',
149                             loadMask : true,
150                             xns : Roo.grid,
151                             cm : [
152                                  {
153                                         '|xns' : 'Roo.grid',
154                                         xtype : 'ColumnModel',
155                                         header : 'ID#',
156                                         width : 200,
157                                         renderer : function(v) { return String.format('{0}', v ? v : ''); },
158                                         xns : Roo.grid,
159                                         sortable : true,
160                                         dataIndex : 'terms_id'
161                                     },
162 {
163                                         '|xns' : 'Roo.grid',
164                                         xtype : 'ColumnModel',
165                                         width : 150,
166                                         header : 'Code',
167                                         renderer : function(v) { return String.format('{0}', v ? v : ''); },
168                                         xns : Roo.grid,
169                                         sortable : true,
170                                         dataIndex : 'terms_code'
171                                     },
172 {
173                                         '|xns' : 'Roo.grid',
174                                         xtype : 'ColumnModel',
175                                         header : 'Description',
176                                         width : 150,
177                                         renderer : function(v) { return String.format('{0}', v ? v : ''); },
178                                         xns : Roo.grid,
179                                         sortable : true,
180                                         dataIndex : 'terms_descrip'
181                                     },
182 {
183                                         '|xns' : 'Roo.grid',
184                                         xtype : 'ColumnModel',
185                                         width : 150,
186                                         header : 'Type',
187                                         renderer : function(v) { 
188                                             var t = (v == 'D') ? 'Days' : 'Proximo';
189                                             
190                                             return String.format('{0}', t); 
191                                         },
192                                         xns : Roo.grid,
193                                         sortable : true,
194                                         dataIndex : 'term_type'
195                                     },
196 {
197                                         '|xns' : 'Roo.grid',
198                                         xtype : 'ColumnModel',
199                                         width : 150,
200                                         header : 'Due Days',
201                                         renderer : function(v) { return String.format('{0}', v ? v : ''); },
202                                         xns : Roo.grid,
203                                         sortable : true,
204                                         dataIndex : 'terms_duedays'
205                                     },
206 {
207                                         '|xns' : 'Roo.grid',
208                                         xtype : 'ColumnModel',
209                                         width : 150,
210                                         header : 'Discount Days',
211                                         renderer : function(v) { return String.format('{0}', v ? v : ''); },
212                                         xns : Roo.grid,
213                                         sortable : true,
214                                         dataIndex : 'terms_discdays'
215                                     },
216 {
217                                         '|xns' : 'Roo.grid',
218                                         xtype : 'ColumnModel',
219                                         width : 150,
220                                         header : 'Cut Off Days',
221                                         renderer : function(v) { return String.format('{0}', v ? v : ''); },
222                                         xns : Roo.grid,
223                                         sortable : true,
224                                         dataIndex : 'terms_cutoffday'
225                                     },
226 {
227                                         '|xns' : 'Roo.grid',
228                                         xtype : 'ColumnModel',
229                                         width : 150,
230                                         header : 'Used in Payables',
231                                         renderer : function(v) {  
232                                             var state = v  ?  '-checked' : '';
233                                         
234                                             return '<img class="x-grid-check-icon' + state + '" src="' + Roo.BLANK_IMAGE_URL + '"/>';
235                                                         
236                                          },
237                                         xns : Roo.grid,
238                                         sortable : true,
239                                         dataIndex : 'terms_ap'
240                                     },
241 {
242                                         '|xns' : 'Roo.grid',
243                                         xtype : 'ColumnModel',
244                                         header : 'Used in Receivables',
245                                         width : 150,
246                                         renderer : function(v) {  
247                                             var state = v  ?  '-checked' : '';
248                                         
249                                             return '<img class="x-grid-check-icon' + state + '" src="' + Roo.BLANK_IMAGE_URL + '"/>';
250                                                         
251                                          },
252                                         xns : Roo.grid,
253                                         sortable : true,
254                                         dataIndex : 'terms_ar'
255                                     }
256                             ],
257                             listeners : {
258                                 render : function() 
259                                    {
260                                        _this.grid = this; 
261                                        
262                                        if (_this.panel.active) {
263                                           this.footer.onClick('first');
264                                        }
265                                    }
266                             },
267                             items : [
268
269                             ]
270
271                         },
272                         '|xns' : 'Roo',
273                         fitToframe : true,
274                         background : false,
275                         region : 'center',
276                         title : "Terms",
277                         xtype : 'GridPanel',
278                         fitContainer : true,
279                         xns : Roo,
280                         tableName : 'terms',
281                         listeners : {
282                                 activate : function() {
283                                        _this.panel = this;
284                                        if (_this.grid) {
285                                            _this.grid.footer.onClick('first');
286                                        }
287                                    }
288                         },
289                         items : [
290
291                         ]
292
293                     }
294                 ]
295
296             },
297             '|xns' : 'Roo',
298             background : false,
299             region : 'center',
300             title : "Terms",
301             xtype : 'NestedLayoutPanel',
302             xns : Roo,
303             items : [
304
305             ]
306
307         };    }
308 });