1 //<script type="text/javascript">
3 // Auto generated file - created by app.Builder.js- do not edit directly (at present!)
5 Pman.Tab.XtupleSalesInvoice = new Roo.XComponent({
6 part : ["Xtuple","SalesInvoice"],
7 order : '300-Pman.Tab.XtupleSalesInvoice',
9 parent : 'Pman.Tab.XtupleSales',
10 name : "unnamed module",
21 activate : function() {
24 _this.grid.footer.onClick('first');
32 tableName : 'invchead',
41 //_this.dialog = Pman.Dialog.FILL_IN
42 if (_this.panel.active) {
43 this.footer.onClick('first');
46 rowdblclick : function (_self, rowIndex, e)
50 var d = this.getDataSource().getAt(rowIndex).data;
54 Pman.Dialog.XtupleSalesOrder.show( {
55 cohead_id : d.cohead_id
58 _this.grid.footer.onClick('refresh');
60 Pman.Tab.XtupleSales.grid.footer.onClick('first');
65 // other wise not a sales order related..
68 Pman.Dialog.XtupleInvc.show( {
72 _this.grid.footer.onClick('refresh');
74 Pman.Tab.XtupleSales.grid.footer.onClick('first');
79 autoExpandColumn : 'cust_name',
85 beforeload : function (_self, o)
87 if (_this.ordernumber.getValue().length) {
88 o.params['query[invchead_ordernumber]'] = _this.ordernumber.getValue();
91 if (_this.invcnumber.getValue().length) {
92 o.params['query[invchead_invcnumber]'] = _this.invcnumber.getValue();
96 if (_this.customer.getValue()) {
97 o.params.invchead_cust_id = _this.customer.getValue();
99 if (_this.fromDate.getValue()) {
100 o.params['search[fromDate]'] = _this.fromDate.getValue().format('Y-m-d');
102 if (_this.toDate.getValue()) {
103 o.params['search[toDate]'] = _this.toDate.getValue().format('Y-m-d');
105 o.params._show_status = _this.status.getValue();
107 o.params._with_salesorder = 1;
111 sortInfo : { field : 'invchead_invcdate', direction: 'DESC' },
116 url : baseURL + '/Roo/invchead.php'
121 totalProperty : 'total',
126 'name': 'invchead_ordernumber',
130 'name': 'invchead_orderdate',
134 'name': 'invchead_posted',
138 'name': 'invchead_printed',
142 'name': 'invchead_invcdate',
146 'name': 'invchead_billto_name',
153 xtype: 'PagingToolbar',
157 displayMsg : "Displaying invchead{0} - {1} of {2}",
158 emptyMsg : "No invchead found",
164 click : function (_self, e)
169 Roo.MessageBox.alert("Notice", "Download should start soon");
184 render : function (_self)
186 _this.invcnumber = _self;
188 specialkey : function (_self, e)
190 _this.grid.footer.onClick('first');
193 emptyText : "Invoice #",
200 render : function (_self)
202 _this.ordernumber = _self;
204 select : function (combo, record, index)
207 _this.grid.footer.onClick('first');
211 displayField : 'invchead_ordernumber',
214 fieldLabel : 'ordernumber',
215 forceSelection : true,
216 hiddenName : 'invchead_id',
218 loadingText : "Searching...",
220 name : 'invchead_ordernumber',
222 qtip : "Select invchead",
223 queryParam : 'query[invchead_ordernumber]',
224 selectOnFocus : true,
225 tpl : '<div class="x-grid-cell-text x-btn button"><b>{invchead_ordernumber}</b> </div>',
226 triggerAction : 'all',
227 valueField : 'invchead_ordernumber',
232 sortInfo : { direction : 'ASC', field: 'invchead_ordernumber' },
235 beforeload : function (_self, o){
236 o.params = o.params || {};
244 url : baseURL + '/Roo/invchead.php'
251 totalProperty : 'total',
252 fields : [{"name":"invchead_id","type":"int"},"invchead_ordernumber"]
260 render : function (_self)
262 _this.customer = _self;
264 select : function (combo, record, index)
266 _this.grid.footer.onClick('first');
270 displayField : 'cust_name',
272 emptyText : "Select Customer",
273 fieldLabel : 'cust_name',
274 forceSelection : true,
275 hiddenName : 'cust_id',
277 loadingText : "Searching...",
281 qtip : "Select custinfo",
282 queryParam : 'query[cust_name]',
283 selectOnFocus : true,
284 tpl : '<div class="x-grid-cell-text x-btn button"><b>{cust_name}</b> </div>',
285 triggerAction : 'all',
286 valueField : 'cust_id',
291 sortInfo : { direction : 'ASC', field: 'cust_name' },
294 beforeload : function (_self, o){
295 o.params = o.params || {};
303 url : baseURL + '/Roo/custinfo.php'
310 totalProperty : 'total',
311 fields : [{"name":"cust_id","type":"int"},"cust_name"]
319 render : function (_self)
321 _this.status = _self;
323 beforeselect : function (combo, record, index)
325 (function() { _this.grid.footer.onClick('first'); }).defer(100);
329 displayField : 'fname',
331 fieldLabel : 'Status',
332 hiddenName : 'status',
336 triggerAction : 'all',
338 valueField : 'ftype',
341 xtype: 'SimpleStore',
345 [ 'NV' , "Not Void Only"],
346 [ 'V' , "Void Only"],
349 fields : [ 'ftype', 'fname']
361 select : function (combo, date)
363 _this.grid.footer.onClick('first');
365 render : function (_self)
367 _this.fromDate = _self;
381 select : function (combo, date)
383 _this.grid.footer.onClick('first');
385 render : function (_self)
387 _this.toDate = _self;
403 if (!Pman.hasPerm('Xtuple.InvoiceAll', 'S')) {
404 Roo.MessageBox.alert("Error", "You do not have permissions to do that, please contact the administrator to void invoices, or edit the sales order.");
410 var sel = _this.grid.getSelectionModel().getSelected();
412 Roo.MessageBox.alert("Error", "Select a invoice");
415 // check current status of shipment..
417 Roo.MessageBox.confirm("Are you sure", "Are you sure you want to VOID that invoice?",
424 url : baseURL + '/Roo/invchead',
427 invchead_id : sel.data.invchead_id,
430 success : function() {
431 _this.grid.footer.onClick('refresh');
442 cls : 'x-btn-text-icon',
443 text : "Void Invoice",
444 icon : rootURL + '/Pman/templates/images/trash.gif'
450 xtype: 'ColumnModel',
453 dataIndex : 'invchead_ordernumber',
454 header : 'Sales Order#',
456 renderer : function(v) { return String.format('{0}', v); }
459 xtype: 'ColumnModel',
462 dataIndex : 'invchead_invcnumber',
465 renderer : function(v,x,r) {
466 if (r.data.invchead_void) {
467 var vv = v.split('x-').shift();
468 return String.format('<s>{0}</s>', vv);
470 return String.format('{0}', v);
474 xtype: 'ColumnModel',
478 dataIndex : 'invchead_orderdate',
479 renderer : function(v) { return String.format('{0}', v ? v.format('d/M/Y') : ''); }
482 xtype: 'ColumnModel',
484 dataIndex : 'invchead_posted',
487 renderer : function(v,x,r) {
489 if (r.data.invchead_void) {
490 return String.format('<s>VOID</s>', v);
493 return String.format('{0}', v);
497 xtype: 'ColumnModel',
499 dataIndex : 'invchead_void',
503 renderer : function(v,x,r) {
506 return String.format('{0}', v);
510 xtype: 'ColumnModel',
512 dataIndex : 'invchead_salesrep_id_salesrep_name',
513 header : 'Sales Rep',
515 renderer : function(v) { return String.format('{0}', v); }
518 xtype: 'ColumnModel',
520 dataIndex : 'cust_salesrep_id_salesrep_name',
521 header : 'Customer Rep',
523 renderer : function(v) { return String.format('{0}', v); }
526 xtype: 'ColumnModel',
528 dataIndex : 'invchead_printed',
532 renderer : function(v) { return String.format('{0}', v); }
535 xtype: 'ColumnModel',
539 dataIndex : 'invchead_invcdate',
540 renderer : function(v) { return String.format('{0}', v ? v.format('d/M/Y') : ''); }
543 xtype: 'ColumnModel',
545 dataIndex : 'cust_addr_id_addr_postalcode',
546 header : 'Customer Postcode',
548 renderer : function(v) { return String.format('{0}', v); }
551 xtype: 'ColumnModel',
553 dataIndex : 'cust_addr_id_addr_state',
554 header : 'Customer State',
556 renderer : function(v) { return String.format('{0}', v); }
559 xtype: 'ColumnModel',
561 dataIndex : 'cust_name',
564 renderer : function(v) { return String.format('{0}', v); }
567 xtype: 'ColumnModel',
569 dataIndex : 'invchead_curr_id_curr_symbol',
572 renderer : function(v) { return String.format('{0}', v ? v : '??'); }
575 xtype: 'ColumnModel',
578 dataIndex : 'invchead_total',
581 renderer : function(v) { return v ? Roo.util.Format.usMoney( v) : ''; }
584 xtype: 'ColumnModel',
587 dataIndex : 'aropen_amount',
590 renderer : function(v) { return v ? Roo.util.Format.usMoney( v) : ''; }