Fix #7123 - getting abra ready to test
[Pman.Xtuple] / Pman.Dialog.XtupleInvc.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.Dialog.XtupleInvc = {
6
7     dialog : false,
8     callback:  false,
9
10     show : function(data, cb)
11     {
12         if (!this.dialog) {
13             this.create();
14         }
15
16         this.callback = cb;
17         this.data = data;
18         this.dialog.show(this.data._el);
19         if (this.form) {
20            this.form.reset();
21            this.form.setValues(data);
22            this.form.fireEvent('actioncomplete', this.form,  { type: 'setdata', data: data });
23         }
24
25     },
26
27     create : function()
28     {
29         var _this = this;
30         this.dialog = Roo.factory({
31             xtype: 'LayoutDialog',
32             xns: Roo,
33             closable : true,
34             collapsible : false,
35             height : 600,
36             modal : true,
37             resizable : false,
38             title : "View Invoice",
39             width : 1000,
40             items : [
41                 {
42                     xtype: 'ContentPanel',
43                     xns: Roo,
44                     region : 'north',
45                     items : [
46                         {
47                             xtype: 'Form',
48                             xns: Roo.form,
49                             listeners : {
50                                 actioncomplete : function(_self,action)
51                                 {
52                                    if (action.type == 'setdata') {
53                                         if (_this.data._id) {
54                                             this.load({ method: 'GET', params: { '_id' : _this.data._id }});
55                                            return;
56                                        }      
57                                        
58                                        
59                                        
60                                        _this.saveBtn.hide();
61                                             
62                                        
63                                        
64                                        
65                                     }
66                                     if (action.type == 'load') {
67                                         var d = action.result.data;
68                                         
69                                 
70                                          _this.grid.ds.load({});
71                                         return;
72                                     }
73                                     if (action.type =='submit') {
74                                                 
75                                         _this.dialog.hide();
76                                         return;    
77                                          if (_this.callback) {
78                                             _this.callback.call(_this, _this.form.getValues());
79                                          }
80                                          _this.form.reset();
81                                          return;
82                                     }
83                                 },
84                                 rendered : function (form)
85                                 {
86                                     _this.form= form;
87                                 }
88                             },
89                             method : 'POST',
90                             style : 'margin:10px;',
91                             url : baseURL + '/Roo/invchead.php',
92                             items : [
93                                 {
94                                     xtype: 'Row',
95                                     xns: Roo.form,
96                                     width : 950,
97                                     items : [
98                                         {
99                                             xtype: 'Column',
100                                             xns: Roo.form,
101                                             style : 'float:left;',
102                                             width : 300,
103                                             items : [
104                                                 {
105                                                     xtype: 'FieldSet',
106                                                     xns: Roo.form,
107                                                     labelWidth : 70,
108                                                     legend : "Invoice Details",
109                                                     style : 'width:280px',
110                                                     items : [
111                                                         {
112                                                             xtype: 'DateField',
113                                                             xns: Roo.form,
114                                                             fieldLabel : 'Invoiced',
115                                                             format : 'Y-m-d',
116                                                             name : 'invchead_invcdate',
117                                                             width : 120
118                                                         },
119                                                         {
120                                                             xtype: 'DateField',
121                                                             xns: Roo.form,
122                                                             fieldLabel : 'Ordered',
123                                                             format : 'Y-m-d',
124                                                             name : 'invchead_orderdate',
125                                                             width : 120
126                                                         },
127                                                         {
128                                                             xtype: 'TextField',
129                                                             xns: Roo.form,
130                                                             fieldLabel : 'Invoice#',
131                                                             name : 'invchead_invcnumber',
132                                                             width : 120
133                                                         },
134                                                         {
135                                                             xtype: 'TextField',
136                                                             xns: Roo.form,
137                                                             fieldLabel : 'PO#',
138                                                             name : 'invchead_ponumber',
139                                                             width : 120
140                                                         },
141                                                         {
142                                                             xtype: 'TextField',
143                                                             xns: Roo.form,
144                                                             fieldLabel : 'Customer',
145                                                             name : 'cust_name',
146                                                             width : 200
147                                                         },
148                                                         {
149                                                             xtype: 'TextField',
150                                                             xns: Roo.form,
151                                                             fieldLabel : 'FOB',
152                                                             name : 'invchead_fob',
153                                                             width : 200
154                                                         },
155                                                         {
156                                                             xtype: 'TextField',
157                                                             xns: Roo.form,
158                                                             fieldLabel : 'Shipvia',
159                                                             name : 'invchead_shipvia',
160                                                             width : 200
161                                                         },
162                                                         {
163                                                             xtype: 'TextField',
164                                                             xns: Roo.form,
165                                                             fieldLabel : 'salesrep',
166                                                             name : 'invchead_salesrep_id',
167                                                             width : 75
168                                                         },
169                                                         {
170                                                             xtype: 'TextField',
171                                                             xns: Roo.form,
172                                                             fieldLabel : 'Terms',
173                                                             name : 'invchead_terms_id',
174                                                             width : 75
175                                                         }
176                                                     ]
177                                                 }
178                                             ]
179                                         },
180                                         {
181                                             xtype: 'Column',
182                                             xns: Roo.form,
183                                             style : 'margin-left:10px;float:left;',
184                                             width : 370,
185                                             items : [
186                                                 {
187                                                     xtype: 'FieldSet',
188                                                     xns: Roo.form,
189                                                     labelAlign : 'left',
190                                                     labelWidth : 100,
191                                                     legend : "Charges",
192                                                     style : 'width:350px',
193                                                     items : [
194                                                         {
195                                                             xtype: 'ComboBox',
196                                                             xns: Roo.form,
197                                                             allowBlank : false,
198                                                             displayField : 'invc_curr_id',
199                                                             editable : false,
200                                                             emptyText : "Select curr_symbol",
201                                                             fieldLabel : 'Currency',
202                                                             forceSelection : true,
203                                                             hiddenName : 'invchead_curr_id',
204                                                             listWidth : 400,
205                                                             loadingText : "Searching...",
206                                                             minChars : 2,
207                                                             name : 'invchead_curr_id_curr_name',
208                                                             pageSize : 20,
209                                                             qtip : "Select curr_symbol",
210                                                             queryParam : 'query[curr_name]',
211                                                             selectOnFocus : true,
212                                                             tpl : '<div class="x-grid-cell-text x-btn button"><b>{curr_name}</b> </div>',
213                                                             triggerAction : 'all',
214                                                             typeAhead : true,
215                                                             valueField : 'id',
216                                                             width : 220,
217                                                             store : {
218                                                                 xtype: 'Store',
219                                                                 xns: Roo.data,
220                                                                 remoteSort : true,
221                                                                 sortInfo : { direction : 'ASC', field: 'id' },
222                                                                 listeners : {
223                                                                     beforeload : function (_self, o){
224                                                                         o.params = o.params || {};
225                                                                         // set more here
226                                                                     }
227                                                                 },
228                                                                 proxy : {
229                                                                     xtype: 'HttpProxy',
230                                                                     xns: Roo.data,
231                                                                     method : 'GET',
232                                                                     url : baseURL + '/Roo/curr_symbol.php'
233                                                                 },
234                                                                 reader : {
235                                                                     xtype: 'JsonReader',
236                                                                     xns: Roo.data,
237                                                                     id : 'id',
238                                                                     root : 'data',
239                                                                     totalProperty : 'total',
240                                                                     fields : [{"name":"id","type":"int"},{"name":"curr_name","type":"string"}]
241                                                                 }
242                                                             }
243                                                         },
244                                                         {
245                                                             xtype: 'Row',
246                                                             xns: Roo.form,
247                                                             labelAlign : 'right',
248                                                             labelWidth : 250,
249                                                             items : [
250                                                                 {
251                                                                     xtype: 'TextField',
252                                                                     xns: Roo.form,
253                                                                     style : 'align:right;',
254                                                                     fieldLabel : 'Items Total',
255                                                                     name : 'invchead_invctotal',
256                                                                     width : 75
257                                                                 }
258                                                             ]
259                                                         },
260                                                         {
261                                                             xtype: 'Row',
262                                                             xns: Roo.form,
263                                                             labelAlign : 'right',
264                                                             labelWidth : 250,
265                                                             items : [
266                                                                 {
267                                                                     xtype: 'TextField',
268                                                                     xns: Roo.form,
269                                                                     style : 'align:right;',
270                                                                     fieldLabel : 'Freight',
271                                                                     name : 'invchead_freight',
272                                                                     width : 75
273                                                                 }
274                                                             ]
275                                                         },
276                                                         {
277                                                             xtype: 'Row',
278                                                             xns: Roo.form,
279                                                             labelAlign : 'top',
280                                                             labelSeparator : '&nbsp;',
281                                                             width : 430,
282                                                             items : [
283                                                                 {
284                                                                     xtype: 'TextField',
285                                                                     xns: Roo.form,
286                                                                     fieldLabel : 'Discount Description',
287                                                                     name : 'invchead_misc_descrip',
288                                                                     width : 235
289                                                                 },
290                                                                 {
291                                                                     xtype: 'NumberField',
292                                                                     xns: Roo.form,
293                                                                     style : 'align:right;',
294                                                                     fieldLabel : '&nbsp;',
295                                                                     name : 'invchead_misc_amount',
296                                                                     width : 75
297                                                                 }
298                                                             ]
299                                                         },
300                                                         {
301                                                             xtype: 'Row',
302                                                             xns: Roo.form,
303                                                             labelAlign : 'right',
304                                                             labelWidth : 250,
305                                                             items : [
306                                                                 {
307                                                                     xtype: 'TextField',
308                                                                     xns: Roo.form,
309                                                                     style : 'align:right;',
310                                                                     fieldLabel : 'Total',
311                                                                     name : 'invchead_total',
312                                                                     width : 75
313                                                                 }
314                                                             ]
315                                                         },
316                                                         {
317                                                             xtype: 'Row',
318                                                             xns: Roo.form,
319                                                             labelAlign : 'top',
320                                                             width : 430,
321                                                             items : [
322                                                                 {
323                                                                     xtype: 'TextField',
324                                                                     xns: Roo.form,
325                                                                     fieldLabel : 'Payment Ref',
326                                                                     name : 'invchead_paymentref',
327                                                                     width : 235
328                                                                 },
329                                                                 {
330                                                                     xtype: 'NumberField',
331                                                                     xns: Roo.form,
332                                                                     style : 'align:right;',
333                                                                     fieldLabel : 'Paid',
334                                                                     name : 'invchead_payment',
335                                                                     width : 75
336                                                                 }
337                                                             ]
338                                                         }
339                                                     ]
340                                                 }
341                                             ]
342                                         },
343                                         {
344                                             xtype: 'Column',
345                                             xns: Roo.form,
346                                             labelAlign : 'top',
347                                             style : 'margin-left:10px;float:left;',
348                                             width : 250,
349                                             items : [
350                                                 {
351                                                     xtype: 'TextArea',
352                                                     xns: Roo.form,
353                                                     fieldLabel : 'Invchead notes',
354                                                     height : 60,
355                                                     name : 'invchead_notes',
356                                                     width : 250
357                                                 },
358                                                 {
359                                                     xtype: 'TextArea',
360                                                     xns: Roo.form,
361                                                     fieldLabel : 'BillTo',
362                                                     height : 60,
363                                                     name : 'invchead_billto',
364                                                     width : 250
365                                                 },
366                                                 {
367                                                     xtype: 'TextArea',
368                                                     xns: Roo.form,
369                                                     fieldLabel : 'Shipto',
370                                                     height : 60,
371                                                     name : 'invchead_shipto',
372                                                     width : 250
373                                                 }
374                                             ]
375                                         }
376                                     ]
377                                 },
378                                 {
379                                     xtype: 'Hidden',
380                                     xns: Roo.form,
381                                     name : 'invchead_id'
382                                 },
383                                 {
384                                     xtype: 'Hidden',
385                                     xns: Roo.form,
386                                     name : 'invchead_void'
387                                 },
388                                 {
389                                     xtype: 'Hidden',
390                                     xns: Roo.form,
391                                     name : 'billitems'
392                                 }
393                             ]
394                         }
395                     ]
396                 },
397                 {
398                     xtype: 'GridPanel',
399                     xns: Roo,
400                     listeners : {
401                         activate : function() {
402                             _this.panel = this;
403                              
404                         }
405                     },
406                     background : false,
407                     fitContainer : true,
408                     fitToframe : true,
409                     region : 'center',
410                     tableName : 'invcitem',
411                     title : "invcitem",
412                     grid : {
413                         xtype: 'Grid',
414                         xns: Roo.grid,
415                         listeners : {
416                             render : function() 
417                             {
418                                 _this.grid = this; 
419                                 //_this.dialog = Pman.Dialog.FILL_IN
420                                 
421                             },
422                             rowdblclick : function (_self, rowIndex, e)
423                             {
424                                 if (!_this.dialog) return;
425                                 _this.dialog.show( this.getDataSource().getAt(rowIndex), function() {
426                                     _this.grid.footer.onClick('first');
427                                 }); 
428                             }
429                         },
430                         autoExpandColumn : 'invcitem_item_id_item_descrip1',
431                         loadMask : true,
432                         dataSource : {
433                             xtype: 'Store',
434                             xns: Roo.data,
435                             listeners : {
436                                 beforeload : function (_self, o)
437                                 {
438                                     o.params = o.params || {};
439                                         var id  = _this.form.findField('invchead_id').getValue();
440                                         if (!id){
441                                             return false;
442                                         }
443                                         o.params.invcitem_invchead_id = id;
444                                         o.params.limit = 999;
445                                 }
446                             },
447                             remoteSort : true,
448                             sortInfo : { field : 'invcitem_linenumber', direction: 'ASC' },
449                             proxy : {
450                                 xtype: 'HttpProxy',
451                                 xns: Roo.data,
452                                 method : 'GET',
453                                 url : baseURL + '/Roo/invcitem.php'
454                             },
455                             reader : {
456                                 xtype: 'JsonReader',
457                                 xns: Roo.data,
458                                 totalProperty : 'total',
459                                 root : 'data',
460                                 id : 'id',
461                                 fields : [
462                                     {
463                                         'name': 'invcitem_id',
464                                         'type': 'int'
465                                     },
466                                     {
467                                         'name': 'invcitem_invchead_id',
468                                         'type': 'int'
469                                     },
470                                     {
471                                         'name': 'invcitem_invchead_id',
472                                         'type': 'int'
473                                     },
474                                     {
475                                         'name': 'invcitem_linenumber',
476                                         'type': 'int'
477                                     },
478                                     {
479                                         'name': 'invcitem_item_id',
480                                         'type': 'int'
481                                     },
482                                     {
483                                         'name': 'invcitem_warehous_id',
484                                         'type': 'int'
485                                     },
486                                     {
487                                         'name': 'invcitem_custpn',
488                                         'type': 'string'
489                                     },
490                                     {
491                                         'name': 'invcitem_number',
492                                         'type': 'string'
493                                     },
494                                     {
495                                         'name': 'invcitem_descrip',
496                                         'type': 'string'
497                                     },
498                                     {
499                                         'name': 'invcitem_ordered',
500                                         'type': 'float'
501                                     },
502                                     {
503                                         'name': 'invcitem_billed',
504                                         'type': 'float'
505                                     },
506                                     {
507                                         'name': 'invcitem_custprice',
508                                         'type': 'float'
509                                     },
510                                     {
511                                         'name': 'invcitem_price',
512                                         'type': 'float'
513                                     },
514                                     {
515                                         'name': 'invcitem_notes',
516                                         'type': 'string'
517                                     },
518                                     {
519                                         'name': 'invcitem_salescat_id',
520                                         'type': 'int'
521                                     },
522                                     {
523                                         'name': 'invcitem_taxtype_id',
524                                         'type': 'int'
525                                     },
526                                     {
527                                         'name': 'invcitem_qty_uom_id',
528                                         'type': 'int'
529                                     },
530                                     {
531                                         'name': 'invcitem_qty_invuomratio',
532                                         'type': 'float'
533                                     },
534                                     {
535                                         'name': 'invcitem_price_uom_id',
536                                         'type': 'int'
537                                     },
538                                     {
539                                         'name': 'invcitem_price_invuomratio',
540                                         'type': 'float'
541                                     },
542                                     {
543                                         'name': 'invcitem_coitem_id',
544                                         'type': 'int'
545                                     },
546                                     {
547                                         'name': 'invcitem_updateinv',
548                                         'type': 'int'
549                                     },
550                                     {
551                                         'name': 'invcitem_taxtype_id_taxtype_id',
552                                         'type': 'int'
553                                     },
554                                     {
555                                         'name': 'invcitem_taxtype_id_taxtype_name',
556                                         'type': 'string'
557                                     },
558                                     {
559                                         'name': 'invcitem_taxtype_id_taxtype_descrip',
560                                         'type': 'string'
561                                     },
562                                     {
563                                         'name': 'invcitem_taxtype_id_taxtype_sys',
564                                         'type': 'int'
565                                     },
566                                     {
567                                         'name': 'invcitem_qty_uom_id_uom_id',
568                                         'type': 'int'
569                                     },
570                                     {
571                                         'name': 'invcitem_qty_uom_id_uom_name',
572                                         'type': 'string'
573                                     },
574                                     {
575                                         'name': 'invcitem_qty_uom_id_uom_descrip',
576                                         'type': 'string'
577                                     },
578                                     {
579                                         'name': 'invcitem_qty_uom_id_uom_item_weight',
580                                         'type': 'int'
581                                     },
582                                     {
583                                         'name': 'invcitem_price_uom_id_uom_id',
584                                         'type': 'int'
585                                     },
586                                     {
587                                         'name': 'invcitem_price_uom_id_uom_name',
588                                         'type': 'string'
589                                     },
590                                     {
591                                         'name': 'invcitem_price_uom_id_uom_descrip',
592                                         'type': 'string'
593                                     },
594                                     {
595                                         'name': 'invcitem_price_uom_id_uom_item_weight',
596                                         'type': 'int'
597                                     },
598                                     {
599                                         'name': 'invcitem_invchead_id_invchead_id',
600                                         'type': 'int'
601                                     },
602                                     {
603                                         'name': 'invcitem_invchead_id_invchead_cust_id',
604                                         'type': 'int'
605                                     },
606                                     {
607                                         'name': 'invcitem_invchead_id_invchead_shipto_id',
608                                         'type': 'int'
609                                     },
610                                     {
611                                         'name': 'invcitem_invchead_id_invchead_ordernumber',
612                                         'type': 'string'
613                                     },
614                                     {
615                                         'name': 'invcitem_invchead_id_invchead_orderdate',
616                                         'type': 'date'
617                                     },
618                                     {
619                                         'name': 'invcitem_invchead_id_invchead_posted',
620                                         'type': 'int'
621                                     },
622                                     {
623                                         'name': 'invcitem_invchead_id_invchead_printed',
624                                         'type': 'int'
625                                     },
626                                     {
627                                         'name': 'invcitem_invchead_id_invchead_invcnumber',
628                                         'type': 'string'
629                                     },
630                                     {
631                                         'name': 'invcitem_invchead_id_invchead_invcdate',
632                                         'type': 'date'
633                                     },
634                                     {
635                                         'name': 'invcitem_invchead_id_invchead_shipdate',
636                                         'type': 'date'
637                                     },
638                                     {
639                                         'name': 'invcitem_invchead_id_invchead_ponumber',
640                                         'type': 'string'
641                                     },
642                                     {
643                                         'name': 'invcitem_invchead_id_invchead_shipvia',
644                                         'type': 'string'
645                                     },
646                                     {
647                                         'name': 'invcitem_invchead_id_invchead_fob',
648                                         'type': 'string'
649                                     },
650                                     {
651                                         'name': 'invcitem_invchead_id_invchead_billto_name',
652                                         'type': 'string'
653                                     },
654                                     {
655                                         'name': 'invcitem_invchead_id_invchead_billto_address1',
656                                         'type': 'string'
657                                     },
658                                     {
659                                         'name': 'invcitem_invchead_id_invchead_billto_address2',
660                                         'type': 'string'
661                                     },
662                                     {
663                                         'name': 'invcitem_invchead_id_invchead_billto_address3',
664                                         'type': 'string'
665                                     },
666                                     {
667                                         'name': 'invcitem_invchead_id_invchead_billto_city',
668                                         'type': 'string'
669                                     },
670                                     {
671                                         'name': 'invcitem_invchead_id_invchead_billto_state',
672                                         'type': 'string'
673                                     },
674                                     {
675                                         'name': 'invcitem_invchead_id_invchead_billto_zipcode',
676                                         'type': 'string'
677                                     },
678                                     {
679                                         'name': 'invcitem_invchead_id_invchead_billto_phone',
680                                         'type': 'string'
681                                     },
682                                     {
683                                         'name': 'invcitem_invchead_id_invchead_shipto_name',
684                                         'type': 'string'
685                                     },
686                                     {
687                                         'name': 'invcitem_invchead_id_invchead_shipto_address1',
688                                         'type': 'string'
689                                     },
690                                     {
691                                         'name': 'invcitem_invchead_id_invchead_shipto_address2',
692                                         'type': 'string'
693                                     },
694                                     {
695                                         'name': 'invcitem_invchead_id_invchead_shipto_address3',
696                                         'type': 'string'
697                                     },
698                                     {
699                                         'name': 'invcitem_invchead_id_invchead_shipto_city',
700                                         'type': 'string'
701                                     },
702                                     {
703                                         'name': 'invcitem_invchead_id_invchead_shipto_state',
704                                         'type': 'string'
705                                     },
706                                     {
707                                         'name': 'invcitem_invchead_id_invchead_shipto_zipcode',
708                                         'type': 'string'
709                                     },
710                                     {
711                                         'name': 'invcitem_invchead_id_invchead_shipto_phone',
712                                         'type': 'string'
713                                     },
714                                     {
715                                         'name': 'invcitem_invchead_id_invchead_salesrep_id',
716                                         'type': 'int'
717                                     },
718                                     {
719                                         'name': 'invcitem_invchead_id_invchead_commission',
720                                         'type': 'float'
721                                     },
722                                     {
723                                         'name': 'invcitem_invchead_id_invchead_terms_id',
724                                         'type': 'int'
725                                     },
726                                     {
727                                         'name': 'invcitem_invchead_id_invchead_freight',
728                                         'type': 'float'
729                                     },
730                                     {
731                                         'name': 'invcitem_invchead_id_invchead_misc_amount',
732                                         'type': 'float'
733                                     },
734                                     {
735                                         'name': 'invcitem_invchead_id_invchead_misc_descrip',
736                                         'type': 'string'
737                                     },
738                                     {
739                                         'name': 'invcitem_invchead_id_invchead_misc_accnt_id',
740                                         'type': 'int'
741                                     },
742                                     {
743                                         'name': 'invcitem_invchead_id_invchead_payment',
744                                         'type': 'float'
745                                     },
746                                     {
747                                         'name': 'invcitem_invchead_id_invchead_paymentref',
748                                         'type': 'string'
749                                     },
750                                     {
751                                         'name': 'invcitem_invchead_id_invchead_notes',
752                                         'type': 'string'
753                                     },
754                                     {
755                                         'name': 'invcitem_invchead_id_invchead_billto_country',
756                                         'type': 'string'
757                                     },
758                                     {
759                                         'name': 'invcitem_invchead_id_invchead_shipto_country',
760                                         'type': 'string'
761                                     },
762                                     {
763                                         'name': 'invcitem_invchead_id_invchead_prj_id',
764                                         'type': 'int'
765                                     },
766                                     {
767                                         'name': 'invcitem_invchead_id_invchead_curr_id',
768                                         'type': 'int'
769                                     },
770                                     {
771                                         'name': 'invcitem_invchead_id_invchead_gldistdate',
772                                         'type': 'date'
773                                     },
774                                     {
775                                         'name': 'invcitem_invchead_id_invchead_recurring',
776                                         'type': 'int'
777                                     },
778                                     {
779                                         'name': 'invcitem_invchead_id_invchead_recurring_interval',
780                                         'type': 'int'
781                                     },
782                                     {
783                                         'name': 'invcitem_invchead_id_invchead_recurring_type',
784                                         'type': 'string'
785                                     },
786                                     {
787                                         'name': 'invcitem_invchead_id_invchead_recurring_until',
788                                         'type': 'date'
789                                     },
790                                     {
791                                         'name': 'invcitem_invchead_id_invchead_recurring_invchead_id',
792                                         'type': 'int'
793                                     },
794                                     {
795                                         'name': 'invcitem_invchead_id_invchead_shipchrg_id',
796                                         'type': 'int'
797                                     },
798                                     {
799                                         'name': 'invcitem_invchead_id_invchead_taxzone_id',
800                                         'type': 'int'
801                                     },
802                                     {
803                                         'name': 'invcitem_invchead_id_invchead_void',
804                                         'type': 'int'
805                                     }
806                                 ]
807                             }
808                         },
809                         colModel : [
810                             {
811                                 xtype: 'ColumnModel',
812                                 xns: Roo.grid,
813                                 dataIndex : 'invcitem_linenumber',
814                                 header : 'Line',
815                                 width : 75,
816                                 renderer : function(v) { return String.format('{0}', v); }
817                             },
818                             {
819                                 xtype: 'ColumnModel',
820                                 xns: Roo.grid,
821                                 dataIndex : 'invcitem_item_id_item_number',
822                                 header : 'SKU#',
823                                 width : 75,
824                                 renderer : function(v) { return String.format('{0}', v); }
825                             },
826                             {
827                                 xtype: 'ColumnModel',
828                                 xns: Roo.grid,
829                                 dataIndex : 'invcitem_item_id_item_descrip1',
830                                 header : 'Description',
831                                 width : 200,
832                                 renderer : function(v) { return String.format('{0}', v); }
833                             },
834                             {
835                                 xtype: 'ColumnModel',
836                                 xns: Roo.grid,
837                                 align : 'right',
838                                 dataIndex : 'invcitem_price',
839                                 header : 'Price',
840                                 width : 75,
841                                 renderer : function(v) { return String.format('{0}', v); }
842                             },
843                             {
844                                 xtype: 'ColumnModel',
845                                 xns: Roo.grid,
846                                 align : 'right',
847                                 dataIndex : 'invcitem_ordered',
848                                 header : 'Qty',
849                                 width : 75,
850                                 renderer : function(v) { return String.format('{0}', v); }
851                             }
852                         ]
853                     }
854                 }
855             ],
856             center : {
857                 xtype: 'LayoutRegion',
858                 xns: Roo
859             },
860             north : {
861                 xtype: 'LayoutRegion',
862                 xns: Roo,
863                 height : 250,
864                 split : true
865             },
866             buttons : [
867                 {
868                     xtype: 'Button',
869                     xns: Roo,
870                     listeners : {
871                         click : function (_self, e)
872                         {
873                             var invchead_id = _this.form.findField('invchead_id').getValue();
874                             if(invchead_id * 1 < 1){
875                                 Roo.MessageBox.alert("Error", "Error occur on getting the invchead_id");
876                                 return;
877                             }
878                             new Pman.Download({
879                                 url : baseURL + '/Roo/invchead',
880                                 method : 'GET',
881                                 params : {
882                                     invchead_id : invchead_id,
883                                     _print : 1
884                                 },
885                                 success : function() {
886                         
887                                 }
888                             })
889                         }
890                     },
891                     cls : 'x-btn-text-icon',
892                     text : "Print Invoice",
893                     icon : rootURL + '/Pman/templates/images/pdf.gif'
894                 },
895                 {
896                     xtype: 'Button',
897                     xns: Roo,
898                     listeners : {
899                         click : function (_self, e)
900                         {
901                             new Pman.Download({
902                                 grid : _this.grid
903                             });
904                         }
905                     },
906                     text : "Download items"
907                 },
908                 {
909                     xtype: 'Button',
910                     xns: Roo,
911                     listeners : {
912                         click : function (_self, e)
913                         {
914                             _this.dialog.hide();
915                         }
916                     },
917                     text : "Cancel"
918                 }
919             ]
920         });
921     }
922 };