Pman.Tab.XtuplePriceLists.bjs
[Pman.Xtuple] / Pman.Tab.XtuplePriceLists.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.XtuplePriceLists = new Roo.XComponent({
6     part     :  ["Xtuple","PriceLists"],
7     order    : '001-Pman.Tab.XtuplePriceLists',
8     region   : 'center',
9     parent   : 'Pman.Tab.XtupleManage',
10     name     : "Pman.Tab.XtuplePriceLists",
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             background : true,
21             fitContainer : true,
22             fitToFrame : true,
23             region : 'center',
24             title : "Accounts Recievable",
25             layout : {
26                 xtype: 'BorderLayout',
27                 xns: Roo,
28                 items : [
29                     {
30                         xtype: 'GridPanel',
31                         xns: Roo,
32                         listeners : {
33                             activate : function() {
34                                 _this.panel = this;
35                                 if (_this.grid) {
36                                     _this.grid.footer.onClick('first');
37                                 }
38                             }
39                         },
40                         background : true,
41                         fitContainer : true,
42                         fitToframe : true,
43                         region : 'center',
44                         tableName : 'ipshead',
45                         title : "Price Lists",
46                         grid : {
47                             xtype: 'Grid',
48                             xns: Roo.grid,
49                             listeners : {
50                                 render : function() 
51                                 {
52                                     _this.grid = this; 
53                                     _this.dialog = Pman.Dialog.XtuplePriceList
54                                     if (_this.panel.active) {
55                                        this.footer.onClick('first');
56                                     }
57                                 },
58                                 rowdblclick : function (_self, rowIndex, e)
59                                 {
60                                     if (!_this.dialog) return;
61                                     _this.dialog.show( this.getDataSource().getAt(rowIndex).data, function() {
62                                         _this.grid.footer.onClick('first');
63                                     }); 
64                                     
65                                 }
66                             },
67                             autoExpandColumn : 'ipshead_descrip',
68                             loadMask : true,
69                             dataSource : {
70                                 xtype: 'Store',
71                                 xns: Roo.data,
72                                 remoteSort : true,
73                                 sortInfo : { field : 'ipshead_name', direction: 'ASC' },
74                                 proxy : {
75                                     xtype: 'HttpProxy',
76                                     xns: Roo.data,
77                                     method : 'GET',
78                                     url : baseURL + '/Roo/ipshead.php'
79                                 },
80                                 reader : {
81                                     xtype: 'JsonReader',
82                                     xns: Roo.data,
83                                     totalProperty : 'total',
84                                     root : 'data',
85                                     id : 'id',
86                                     fields : [
87                                         {
88                                             'name': 'ipshead_id',
89                                             'type': 'int'
90                                         },
91                                         {
92                                             'name': 'ipshead_name',
93                                             'type': 'string'
94                                         },
95                                         {
96                                             'name': 'ipshead_descrip',
97                                             'type': 'string'
98                                         },
99                                         {
100                                             'name': 'ipshead_effective',
101                                             'type': 'date',
102                                             'dateFormat': 'Y-m-d'
103                                         },
104                                         {
105                                             'name': 'ipshead_expires',
106                                             'type': 'date',
107                                             'dateFormat': 'Y-m-d'
108                                         },
109                                         {
110                                             'name': 'ipshead_curr_id',
111                                             'type': 'int'
112                                         },
113                                         {
114                                             'name': 'ipshead_updated',
115                                             'type': 'date',
116                                             'dateFormat': 'Y-m-d'
117                                         },
118                                         {
119                                             'name': 'ipshead_curr_id_curr_id',
120                                             'type': 'int'
121                                         },
122                                         {
123                                             'name': 'ipshead_curr_id_curr_base',
124                                             'type': 'int'
125                                         },
126                                         {
127                                             'name': 'ipshead_curr_id_curr_name',
128                                             'type': 'string'
129                                         },
130                                         {
131                                             'name': 'ipshead_curr_id_curr_symbol',
132                                             'type': 'string'
133                                         },
134                                         {
135                                             'name': 'ipshead_curr_id_curr_abbr',
136                                             'type': 'string'
137                                         }
138                                     ]
139                                 }
140                             },
141                             footer : {
142                                 xtype: 'PagingToolbar',
143                                 xns: Roo,
144                                 displayInfo : true,
145                                 displayMsg : "Displaying ipshead{0} - {1} of {2}",
146                                 emptyMsg : "No ipshead found",
147                                 pageSize : 25
148                             },
149                             toolbar : {
150                                 xtype: 'Toolbar',
151                                 xns: Roo,
152                                 items : [
153                                     {
154                                         xtype: 'Button',
155                                         xns: Roo.Toolbar,
156                                         listeners : {
157                                             click : function (_self, e)
158                                             {
159                                                new Pman.Download({
160                                                     method: 'GET',
161                                                     url : baseURL + '/Roo/Ipsiteminfo',
162                                                     params : {
163                                                         _pricegrid : 1
164                                                     }
165                                                });
166                                             }
167                                         },
168                                         text : "Download Price Matrix"
169                                     },
170                                     {
171                                         xtype: 'Button',
172                                         xns: Roo.Toolbar,
173                                         listeners : {
174                                             click : function (_self, e)
175                                             {
176                                                Pman.Dialog.Image.show(
177                                                    {
178                                                         _url : baseURL+'/Xtuple/Pricing'
179                                                     
180                                                    },
181                                                    function (data) {
182                                                         var msg = [];
183                                                         if (data.deleted) {
184                                                             msg.push("Deleted " + data.deleted + " Price(s)");
185                                                         }
186                                                         if (data.updated) {
187                                                             msg.push("Updated " + data.updated + " Price(s)");
188                                                         }            
189                                                         if (data.inserted) {
190                                                             msg.push("Added " + data.inserted + " Price(s)");
191                                                         }
192                                                         if (!msg.length) {
193                                                             msg.push("No data changed");
194                                                         }
195                                                         Roo.MessageBox.alert("Notice", msg.join("\n"));
196                                             
197                                                    }
198                                                );
199                                             }
200                                         },
201                                         text : "Upload Price Matrix"
202                                     },
203                                     {
204                                         xtype: 'Fill',
205                                         xns: Roo.Toolbar
206                                     },
207                                     {
208                                         xtype: 'Button',
209                                         xns: Roo.Toolbar,
210                                         text : "Add",
211                                         cls : 'x-btn-text-icon',
212                                         icon : Roo.rootURL + 'images/default/dd/drop-add.gif',
213                                         listeners : {
214                                             click : function()
215                                             {
216                                                 if (!_this.dialog) return;
217                                                 _this.dialog.show( { id : 0 } , function() {
218                                                     _this.grid.footer.onClick('first');
219                                                }); 
220                                             }
221                                         }
222                                     },
223                                     {
224                                         xtype: 'Button',
225                                         xns: Roo.Toolbar,
226                                         text : "Delete",
227                                         cls : 'x-btn-text-icon',
228                                         icon : rootURL + '/Pman/templates/images/trash.gif',
229                                         listeners : {
230                                             click : function()
231                                             {
232                                                  Pman.genericDelete(_this, 'ipshead'); 
233                                             }
234                                         }
235                                     }
236                                 ]
237                             },
238                             colModel : [
239                                 {
240                                     xtype: 'ColumnModel',
241                                     xns: Roo.grid,
242                                     dataIndex : 'ipshead_curr_id_curr_name',
243                                     header : 'Ipshead curr',
244                                     sortable : true,
245                                     width : 75,
246                                     renderer : function(v) { return String.format('{0}', v); }
247                                 },
248                                 {
249                                     xtype: 'ColumnModel',
250                                     xns: Roo.grid,
251                                     dataIndex : 'ipshead_name',
252                                     header : 'Ipshead name',
253                                     sortable : true,
254                                     width : 200,
255                                     renderer : function(v) { return String.format('{0}', v); }
256                                 },
257                                 {
258                                     xtype: 'ColumnModel',
259                                     xns: Roo.grid,
260                                     header : 'Ipshead descrip',
261                                     width : 200,
262                                     dataIndex : 'ipshead_descrip',
263                                     renderer : function(v) { return String.format('{0}', v); }
264                                 },
265                                 {
266                                     xtype: 'ColumnModel',
267                                     xns: Roo.grid,
268                                     header : 'Ipshead effective',
269                                     width : 75,
270                                     dataIndex : 'ipshead_effective',
271                                     renderer : function(v) { return String.format('{0}', v ? v.format('d/M/Y') : ''); }
272                                 },
273                                 {
274                                     xtype: 'ColumnModel',
275                                     xns: Roo.grid,
276                                     dataIndex : 'ipshead_expires',
277                                     header : 'Ipshead expires',
278                                     width : 75,
279                                     renderer : function(v) { return String.format('{0}', v ? v.format('d/M/Y') : ''); }
280                                 },
281                                 {
282                                     xtype: 'ColumnModel',
283                                     xns: Roo.grid,
284                                     header : 'Ipshead updated',
285                                     width : 75,
286                                     dataIndex : 'ipshead_updated',
287                                     renderer : function(v) { return String.format('{0}', v ? v.format('d/M/Y') : ''); }
288                                 }
289                             ]
290                         }
291                     }
292                 ],
293                 center : {
294                     xtype: 'LayoutRegion',
295                     xns: Roo
296                 }
297             }
298         };
299     }
300 });