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                                         '|xns' : 'Roo.Toolbar',
82                                         xtype : 'Fill',
83                                         xns : Roo.Toolbar
84                                     }
85                                 ]
86
87                             },
88                             dataSource : {
89                                 proxy : {
90                                     '|xns' : 'Roo.data',
91                                     url : baseURL + '/Roo/terms.php',
92                                     xtype : 'HttpProxy',
93                                     method : 'GET',
94                                     xns : Roo.data
95                                 },
96                                 reader : {
97                                     '|xns' : 'Roo.data',
98                                     id : 'id',
99                                     root : 'data',
100                                     xtype : 'JsonReader',
101                                     xns : Roo.data,
102                                     fields : [
103                                         {
104                                             'name': 'terms_id',
105                                             'type': 'int'
106                                         },
107                                         {
108                                             'name': 'terms_code',
109                                             'type': 'string'
110                                         },
111                                         {
112                                             'name': 'terms_descrip',
113                                             'type': 'string',
114                                         }
115                                     ],
116                                     totalProperty : 'total'
117                                 },
118                                 '|xns' : 'Roo.data',
119                                 xtype : 'Store',
120                                 remoteSort : true,
121                                 sortInfo : { field : 'crdate', direction: 'ASC' },
122                                 xns : Roo.data,
123                                 listeners : {
124                                         beforeload : function (_self, o)
125                                            {
126                                                o.params = o.params || {};
127                                                
128                                                var s = _this.searchBox.getValue();
129                                                
130                                                if(s.length){
131                                                    o.params['search[name]'] = s;
132                                                }
133                                                
134                                              
135                                            }
136                                 },
137                                 items : [
138
139                                 ]
140
141                             },
142                             footer : {
143                                 '|xns' : 'Roo',
144                                 pageSize : 25,
145                                 xtype : 'PagingToolbar',
146                                 emptyMsg : "No terms found",
147                                 xns : Roo,
148                                 displayInfo : true,
149                                 displayMsg : "Displaying Terms{0} - {1} of {2}"
150                             },
151                             '|xns' : 'Roo.grid',
152                             autoExpandColumn : 'terms_descrip',
153                             xtype : 'Grid',
154                             loadMask : true,
155                             xns : Roo.grid,
156                             cm : [
157                                  {
158                                         '|xns' : 'Roo.grid',
159                                         xtype : 'ColumnModel',
160                                         header : 'ID#',
161                                         width : 75,
162                                         renderer : function(v) { return String.format('{0}', v ? v : ''); },
163                                         xns : Roo.grid,
164                                         sortable : true,
165                                         dataIndex : 'terms_id'
166                                     },
167 {
168                                         '|xns' : 'Roo.grid',
169                                         xtype : 'ColumnModel',
170                                         width : 150,
171                                         header : 'Code',
172                                         renderer : function(v) { return String.format('{0}', v ? v : ''); },
173                                         xns : Roo.grid,
174                                         sortable : true,
175                                         dataIndex : 'terms_code'
176                                     },
177 {
178                                         '|xns' : 'Roo.grid',
179                                         xtype : 'ColumnModel',
180                                         header : 'Description',
181                                         width : 150,
182                                         renderer : function(v) { return String.format('{0}', v ? v : ''); },
183                                         xns : Roo.grid,
184                                         sortable : true,
185                                         dataIndex : 'terms_descrip'
186                                     },
187 {
188                                         '|xns' : 'Roo.grid',
189                                         xtype : 'ColumnModel',
190                                         width : 75,
191                                         header : 'Type',
192                                         renderer : function(v) { 
193                                             var t = (v == 'D') ? 'Days' : 'Proximo';
194                                             
195                                             return String.format('{0}', t); 
196                                         },
197                                         xns : Roo.grid,
198                                         sortable : true,
199                                         dataIndex : 'terms_type'
200                                     },
201 {
202                                         '|xns' : 'Roo.grid',
203                                         xtype : 'ColumnModel',
204                                         width : 100,
205                                         header : 'Due Days',
206                                         renderer : function(v) { return String.format('{0}', v ? v : ''); },
207                                         xns : Roo.grid,
208                                         sortable : true,
209                                         dataIndex : 'terms_duedays'
210                                     },
211 {
212                                         '|xns' : 'Roo.grid',
213                                         xtype : 'ColumnModel',
214                                         width : 100,
215                                         header : 'Discount Days',
216                                         renderer : function(v) { return String.format('{0}', v ? v : ''); },
217                                         xns : Roo.grid,
218                                         sortable : true,
219                                         dataIndex : 'terms_discdays'
220                                     },
221 {
222                                         '|xns' : 'Roo.grid',
223                                         xtype : 'ColumnModel',
224                                         width : 100,
225                                         header : 'Cut Off Days',
226                                         renderer : function(v) { return String.format('{0}', v ? v : ''); },
227                                         xns : Roo.grid,
228                                         sortable : true,
229                                         dataIndex : 'terms_cutoffday'
230                                     },
231 {
232                                         '|xns' : 'Roo.grid',
233                                         xtype : 'ColumnModel',
234                                         width : 150,
235                                         header : 'Used in Payables',
236                                         renderer : function(v) {  
237                                             var state = v  ?  '-checked' : '';
238                                         
239                                             return '<img class="x-grid-check-icon' + state + '" src="' + Roo.BLANK_IMAGE_URL + '"/>';
240                                                         
241                                          },
242                                         xns : Roo.grid,
243                                         sortable : true,
244                                         dataIndex : 'terms_ap'
245                                     },
246 {
247                                         '|xns' : 'Roo.grid',
248                                         xtype : 'ColumnModel',
249                                         header : 'Used in Receivables',
250                                         width : 150,
251                                         renderer : function(v) {  
252                                             var state = v  ?  '-checked' : '';
253                                         
254                                             return '<img class="x-grid-check-icon' + state + '" src="' + Roo.BLANK_IMAGE_URL + '"/>';
255                                                         
256                                          },
257                                         xns : Roo.grid,
258                                         sortable : true,
259                                         dataIndex : 'terms_ar'
260                                     }
261                             ],
262                             listeners : {
263                                 render : function() 
264                                    {
265                                        _this.grid = this; 
266                                        
267                                        if (_this.panel.active) {
268                                           this.footer.onClick('first');
269                                        }
270                                    }
271                             },
272                             items : [
273
274                             ]
275
276                         },
277                         '|xns' : 'Roo',
278                         fitToframe : true,
279                         background : false,
280                         region : 'center',
281                         title : "Terms",
282                         xtype : 'GridPanel',
283                         fitContainer : true,
284                         xns : Roo,
285                         tableName : 'terms',
286                         listeners : {
287                                 activate : function() {
288                                        _this.panel = this;
289                                        if (_this.grid) {
290                                            _this.grid.footer.onClick('first');
291                                        }
292                                    }
293                         },
294                         items : [
295
296                         ]
297
298                     }
299                 ]
300
301             },
302             '|xns' : 'Roo',
303             background : false,
304             region : 'center',
305             title : "Terms",
306             xtype : 'NestedLayoutPanel',
307             xns : Roo,
308             items : [
309
310             ]
311
312         };    }
313 });