1 //<script type="text/javascript">
3 // Auto generated file - created by app.Builder.js- do not edit directly (at present!)
5 Pman.Tab.XtupleLanded = new Roo.XComponent({
6 part : ["Xtuple","Landed"],
7 order : '100-Pman.Tab.XtupleLanded',
9 parent : 'Pman.Tab.XtuplePurchases',
10 name : "Pman.Tab.XtupleLanded",
18 xtype: 'NestedLayoutPanel',
22 title : "Landed Costs",
24 xtype: 'BorderLayout',
31 activate : function() {
34 _this.grid.footer.onClick('first');
51 //_this.dialog = Pman.Dialog.FILL_IN
52 if (_this.panel.active) {
53 this.footer.onClick('first');
56 rowdblclick : function (_self, rowIndex, e)
58 if (!_this.dialog) return;
59 _this.dialog.show( this.getDataSource().getAt(rowIndex).data, function() {
60 _this.grid.footer.onClick('first');
64 autoExpandColumn : 'vohead_reference',
70 beforeload : function (_self, options)
72 options.params._landed = 1;
76 options.params._landed_status = _this.status.getValue();
79 options.params._search = _this.vsearch.getValue();
81 load : function (_self, records, options)
83 _this.rgrid.footer.onClick('refresh');
87 sortInfo : { field : 'vohead_gldistdate', direction: 'DESC' },
92 url : baseURL + '/Roo/vohead.php'
97 totalProperty : 'total',
106 'name': 'vohead_number',
110 'name': 'vohead_pohead_id',
114 'name': 'vohead_posted',
118 'name': 'vohead_duedate',
120 'dateFormat': 'Y-m-d'
123 'name': 'vohead_invcnumber',
127 'name': 'vohead_amount',
131 'name': 'vohead_docdate',
133 'dateFormat': 'Y-m-d'
136 'name': 'vohead_1099',
140 'name': 'vohead_distdate',
142 'dateFormat': 'Y-m-d'
145 'name': 'vohead_reference',
149 'name': 'vohead_terms_id',
153 'name': 'vohead_vend_id',
157 'name': 'vohead_curr_id',
161 'name': 'vohead_adjtaxtype_id',
165 'name': 'vohead_freighttaxtype_id',
169 'name': 'vohead_gldistdate',
171 'dateFormat': 'Y-m-d'
174 'name': 'vohead_misc',
178 'name': 'vohead_taxzone_id',
182 'name': 'vohead_taxtype_id',
186 'name': 'vohead_notes',
193 xtype: 'RowSelectionModel',
196 afterselectionchange : function (_self)
198 _this.rsearch.setValue('');
199 _this.rgrid.footer.onClick('first');
205 xtype: 'PagingToolbar',
209 displayMsg : "Displaying vohead{0} - {1} of {2}",
210 emptyMsg : "No vohead found"
220 render : function (_self)
222 _this.status = _self;
224 select : function (combo, record, index)
227 _this.grid.footer.onClick('first');
231 displayField : 'fname',
233 fieldLabel : 'Status',
234 hiddenName : 'cm_status',
237 name : 'cm_status_name',
238 triggerAction : 'all',
240 valueField : 'ftype',
243 xtype: 'SimpleStore',
246 [ 'NOTASSIGN', "Not Assigned"],
247 [ 'ASSIGNED' , "Assigned"]
249 fields : [ 'ftype', 'fname']
256 render : function (_self)
258 _this.vsearch = _self;
260 specialkey : function (_self, e)
262 _this.grid.footer.onClick('first');
270 click : function (_self, e)
272 _this.grid.footer.onClick('first');
276 icon : rootURL + '/Pman/templates/images/search.gif'
282 xtype: 'ColumnModel',
284 dataIndex : 'vohead_gldistdate',
287 renderer : function(v) { return String.format('{0}', v ? v.format('d/M/Y') : ''); }
290 xtype: 'ColumnModel',
292 dataIndex : 'vohead_number',
295 renderer : function(v,x,r) {
296 return String.format('{0} / {1}', v,r.data.vohead_invcnumber);
300 xtype: 'ColumnModel',
302 dataIndex : 'vohead_reference',
305 renderer : function(v) { return String.format('{0}', v); }
308 xtype: 'ColumnModel',
310 dataIndex : 'vohead_vend_id_vend_name',
311 header : 'Vohead vend',
313 renderer : function(v) { return String.format('{0}', v); }
316 xtype: 'ColumnModel',
319 dataIndex : 'vohead_total',
322 renderer : function(v,x,r) {
325 return String.format('{0} {1}', r.data.vohead_curr_id_curr_symbol,v);
329 xtype: 'ColumnModel',
332 dataIndex : 'assigned',
335 renderer : function(v,x,r) {
336 return v ? String.format('${0}', v) : '';
346 activate : function() {
349 // _this.rgrid.footer.onClick('first');
357 tableName : 'recvgrp',
366 //_this.dialog = Pman.Dialog.FILL_IN
367 //if (_this.panel.active) {
368 // this.footer.onClick('first');
371 rowdblclick : function (_self, rowIndex, e)
373 if (!_this.dialog) return;
374 _this.dialog.show( this.getDataSource().getAt(rowIndex).data, function() {
375 _this.grid.footer.onClick('first');
379 autoExpandColumn : 'recvgrp_number',
385 beforeload : function (_self, o)
387 var sel = _this.grid.selModel.getSelected();
392 o.params = o.params || {};
393 o.params._landed_vohead = sel.data.vohead_id;
394 o.params._search = _this.rsearch.getValue();
400 sortInfo : { field : 'recvgrp_date', direction: 'ASC' },
405 url : baseURL + '/Roo/recvgrp.php'
410 totalProperty : 'total',
415 'name': 'recvgrp_id',
419 'name': 'recvgrp_number',
426 xtype: 'PagingToolbar',
430 displayMsg : "Displaying recvgrp{0} - {1} of {2}",
431 emptyMsg : "No recvgrp found"
441 render : function (_self)
443 _this.rsearch = _self;
445 specialkey : function (_self, e)
447 _this.rgrid.footer.onClick('first');
455 click : function (_self, e)
457 _this.rgrid.footer.onClick('first');
461 icon : rootURL + '/Pman/templates/images/search.gif'
471 click : function (_self, e)
473 var recv = _this.rgrid.selModel.getSelected();
474 var vo = _this.grid.selModel.getSelected();
481 url : baseURL + '/Roo/Recvgrpland',
483 recvgrpland_vohead_id : vo.data.vohead_id,
484 recvgrpland_recvgrp_id : recv.data.recvgrp_id,
485 recvgrpland_cost : vo.data.vohead_total,
486 recvgrpland_curr_id : vo.data.vohead_curr_id
488 success : function () {
489 _this.grid.footer.onClick('refresh');
503 click : function (_self, e)
505 var recv = _this.rgrid.selModel.getSelected();
506 var vo = _this.grid.selModel.getSelected();
511 var avail = ((1*vo.data.vohead_total) - (1*vo.data.assigned)).toFixed(2);
513 Roo.MessageBox.prompt("How much to assign?",
514 "The total available to assign is " + vo.data.vohead_curr_id_curr_symbol +
515 ' ' + Roo.util.Format.number(avail,2),
522 Roo.MessageBox.alert("Error", "did not get a number");
526 //vo.data.vohead_total
528 Roo.MessageBox.alert("Error", "you assigned to much, try again");
536 url : baseURL + '/Roo/Recvgrpland',
538 recvgrpland_vohead_id : vo.data.vohead_id,
539 recvgrpland_recvgrp_id : recv.data.recvgrp_id,
540 recvgrpland_cost : n,
541 recvgrpland_curr_id : vo.data.vohead_curr_id
543 success : function () {
544 _this.grid.footer.onClick('refresh');
559 click : function (_self, e)
561 var recv = _this.rgrid.selModel.getSelected();
562 var vo = _this.grid.selModel.getSelected();
566 var av = recv.data.assigned_landed * 1;
574 url : baseURL + '/Roo/Recvgrpland',
577 recvgrpland_vohead_id : vo.data.vohead_id,
578 recvgrpland_recvgrp_id : recv.data.recvgrp_id
580 success : function () {
581 _this.grid.footer.onClick('refresh');
589 text : "Remove Assign"
595 xtype: 'ColumnModel',
597 dataIndex : 'recvgrp_date',
600 renderer : function(v) { return String.format('{0}', v.format('d/M/Y')); }
603 xtype: 'ColumnModel',
605 dataIndex : 'recvgrp_pohead_id_pohead_number',
608 renderer : function(v) { return String.format('{0}', v); }
611 xtype: 'ColumnModel',
613 dataIndex : 'recvgrp_number',
616 renderer : function(v) { return String.format('{0}', v); }
619 xtype: 'ColumnModel',
621 dataIndex : 'vend_name',
624 renderer : function(v) { return String.format('{0}', v); }
627 xtype: 'ColumnModel',
629 dataIndex : 'recvgrp_location_id_location_descrip',
632 renderer : function(v) { return String.format('{0}', v); }
635 xtype: 'ColumnModel',
638 dataIndex : 'recv_qty',
641 renderer : function(v) {
645 return Roo.util.Format.number(v, 2);
649 xtype: 'ColumnModel',
652 dataIndex : 'recvgrp_landed_cost',
653 header : 'Old landed',
656 renderer : function(v) {
660 return Roo.util.Format.number(v, 2);
664 xtype: 'ColumnModel',
667 dataIndex : 'assigned_landed',
668 header : 'Assigned Value',
670 renderer : function(v,x,r) {
673 if (r.data.total_landed_cost*1 > 0) {
674 return '<span style="color:#ccc">' +
675 String.format('{0}', r.data.base_curr_symbol) +
676 Roo.util.Format.number(r.data.total_landed_cost, 2) + '</span>';
681 return String.format('{0}', r.data.base_curr_symbol) + Roo.util.Format.number(v, 2);
689 xtype: 'LayoutRegion',
693 xtype: 'LayoutRegion',