1 //<script type="text/javascript">
3 // Auto generated file - created by app.Builder.js- do not edit directly (at present!)
5 Pman.Tab.XtuplePurchaseStock = new Roo.XComponent({
6 part : ["Xtuple","PurchaseStock"],
7 order : '200-Pman.Tab.XtuplePurchaseStock',
9 parent : 'Pman.Tab.XtuplePurchases',
10 name : "Pman.Tab.XtuplePurchaseStock",
18 xtype: 'NestedLayoutPanel',
21 title : "Incoming Stock Schedule",
23 xtype: 'BorderLayout',
30 activate : function() {
33 _this.grid.footer.onClick('first');
42 title : "Incoming Stock Schedule",
50 //_this.dialog = Pman.Dialog.FILL_IN
51 if (_this.panel.active) {
52 this.footer.onClick('first');
55 afteredit : function (e)
57 if (e.originalValue == e.value || e.field == 'join_poitem_location_name') {
64 rowdblclick : function (_self, rowIndex, e)
67 var r = _this.grid.ds.getAt(rowIndex);
68 Pman.Dialog.XtuplePurchaseOrder.show( { pohead_id : r.data.join_poitem_pohead_id , office : _this.office.getValue()}, function() {
69 _this.grid.footer.onClick('refresh');
72 beforeedit : function (e)
74 var office = _this.office.getValue();
75 var local = baseURL.split('/').pop().split('.').shift();
81 rowclick : function (_self, rowIndex, e)
86 autoExpandColumn : 'item_descrip',
93 beforeload : function (_self, o)
95 o.params = o.params || {};
97 o.params._incoming_stock = 1;
99 o.params.poitem_status = _this.status.getValue();
101 o.params._roo_office = _this.office.getValue();
103 o.params['search[location]'] = _this.location.getValue();
105 o.params['search[name]'] = _this.searchBox.getValue();
108 update : function (_self, record, operation)
110 if (operation != 'commit') {
115 pohead_id : record.data.join_poitem_pohead_id,
116 pohead_comments : record.data.join_poitem_pohead_comments,
117 pohead_bg_va : record.data.join_poitem_pohead_bg_va,
118 pohead_bg_arrival_est_day : record.data.join_poitem_pohead_bg_arrival_est_day,
119 pohead_bg_available_est_day : record.data.join_poitem_pohead_bg_available_est_day,
120 pohead_bg_available_latest_day : record.data.join_poitem_pohead_bg_available_latest_day,
121 pohead_notes : record.data.join_poitem_pohead_notes
127 url : baseURL + '/Roo/pohead',
132 _this.grid.footer.onClick('refresh');
136 sortInfo : { field : 'name', direction: 'ASC' },
141 url : baseURL + '/Xtuple/Roo/Poitem.php'
146 totalProperty : 'total',
171 'name': 'leader_office_id',
175 'name': 'leader_name',
179 'name': 'leader_phone',
183 'name': 'leader_fax',
187 'name': 'leader_email',
191 'name': 'leader_company_id',
195 'name': 'leader_role',
199 'name': 'leader_active',
203 'name': 'leader_remarks',
207 'name': 'leader_passwd',
211 'name': 'leader_owner_id',
215 'name': 'leader_lang',
219 'name': 'leader_no_reset_sent',
223 'name': 'leader_action_type',
227 'name': 'leader_project_id',
231 'name': 'leader_deleted_by',
235 'name': 'leader_deleted_dt',
239 'name': 'leader_firstname',
243 'name': 'leader_lastname',
247 'name': 'leader_name_facebook',
251 'name': 'leader_url_blog',
255 'name': 'leader_url_twitter',
259 'name': 'leader_url_linkedin',
263 'name': 'leader_crm_lead_percentage',
267 'name': 'leader_crm_industry_id',
271 'name': 'leader_crm_updated_action_id',
275 'name': 'leader_crm_created_action_id',
279 'name': 'leader_crm_type_id',
293 specialkey : function (_self, e)
295 _this.grid.footer.onClick('first');
297 render : function (_self)
299 _this.searchBox = _self;
307 click : function (_self, e)
309 _this.grid.footer.onClick('first');
313 icon : rootURL + '/Pman/templates/images/search.gif'
319 click : function (_self, e)
321 _this.searchBox.setValue('');
322 _this.grid.footer.onClick('first');
326 icon : rootURL + '/Pman/templates/images/edit-clear.gif'
332 render : function (_self)
334 _this.status = _self;
336 select : function (combo, record, index)
339 _this.grid.footer.onClick('first');
343 displayField : 'fname',
345 emptyText : "Select Status",
346 fieldLabel : 'Status',
347 hiddenName : 'poitem_status',
350 name : 'poitem_status',
351 tpl : '<div class="x-grid-cell-text x-btn button"><b>{fname}</b> </div>',
352 triggerAction : 'all',
354 valueField : 'ftype',
357 xtype: 'SimpleStore',
364 fields : [ 'ftype', 'fname']
371 render : function (_self)
373 _this.location = _self;
375 select : function (combo, record, index)
377 _this.grid.footer.onClick('first');
382 displayField : 'location_name',
384 emptyText : "Select a location",
385 fieldLabel : 'Location',
386 forceSelection : true,
387 hiddenName : 'pohead_location_id',
389 loadingText : "Searching...",
391 name : 'pohead_location_id',
393 qtip : "Select terms",
394 queryParam : 'query[location_name]',
395 selectOnFocus : true,
396 tpl : '<div class="x-grid-cell-text x-btn button"><b>{location_name}</b> </div>',
397 triggerAction : 'all',
399 valueField : 'location_id',
405 beforeload : function (_self, o){
406 o.params = o.params || {};
408 o.params.location_netable = 1;
409 o.params._roo_office = _this.office.getValue();
410 o.params._notinternalcompany = 1;
414 sortInfo : { direction : 'ASC', field: 'location_name' },
419 url : baseURL + '/Xtuple/Roo/location.php'
426 totalProperty : 'total',
427 fields : [{"name":"location_id","type":"int"},"location_name"]
435 render : function (_self)
437 _this.office = _self;
439 select : function (combo, record, index)
441 _this.location.reset();
442 _this.grid.footer.onClick('first');
446 displayField : 'office',
448 fieldLabel : 'Office',
449 hiddenName : 'office',
453 tpl : '<div class="x-grid-cell-text x-btn button"><b>{office}</b> </div>',
454 triggerAction : 'all',
455 valueField : 'office',
457 value : (function() {
458 if(uiConfig.incomming_default_company){
459 return uiConfig.incomming_default_company;
464 xtype: 'SimpleStore',
468 if(uiConfig.incomming_default_company){
469 officeList.push([uiConfig.incomming_default_company]);
471 officeList.push(['hk']);
483 var sel = _this.grid.getSelectionModel().getSelectedCell();
485 Roo.MessageBox.alert("Error", "Select a Row");
488 var s = _this.grid.ds.getAt(sel[0]);
489 if(!s.data.join_poitem_pohead_id.length){
493 var office = _this.office.getValue();
494 var local = baseURL.split('/').pop().split('.').shift();
497 Roo.MessageBox.alert("Error", "You cannot edit the remote date, Only local data can be edited!");
501 Pman.Dialog.XtuplePurchaseOrderEdit.show({pohead_id : s.data.join_poitem_pohead_id} , function () {
502 _this.grid.footer.onClick('refresh');
507 cls : 'x-btn-text-icon',
508 text : "Fill location",
509 icon : Roo.rootURL + 'images/default/tree/leaf.gif'
514 xtype: 'PagingToolbar',
517 displayMsg : "Displaying poitem{0} - {1} of {2}",
518 emptyMsg : "No poitem found",
535 cls : 'x-btn-text-icon',
536 text : "Download Schedule",
537 icon : rootURL + '/Pman/templates/images/spreadsheet.gif'
543 xtype: 'ColumnModel',
545 dataIndex : 'join_poitem_pohead_number',
549 renderer : function(v) { return String.format('{0}', v); }
552 xtype: 'ColumnModel',
554 dataIndex : 'brand_value',
557 renderer : function(v) { return String.format('{0}', v); }
560 xtype: 'ColumnModel',
562 dataIndex : 'item_name',
563 header : 'Item (SKU)',
566 renderer : function(v) { return String.format('{0}', v); }
569 xtype: 'ColumnModel',
571 dataIndex : 'item_descrip',
572 header : 'Description',
574 renderer : function(v) { return String.format('{0}', v); }
577 xtype: 'ColumnModel',
579 dataIndex : 'join_poitem_pohead_comments',
580 header : 'B&G reference',
582 renderer : function(v) { return String.format('{0}', v); },
593 xtype: 'ColumnModel',
595 dataIndex : 'join_poitem_pohead_bg_va',
598 renderer : function(v) { return String.format('{0}', v); },
609 xtype: 'ColumnModel',
611 dataIndex : 'join_poitem_pohead_bg_arrival_est_day',
612 header : 'Est. Arrival',
614 renderer : function(v) {
615 if(typeof(v) == 'object'){
616 return String.format('{0}',v.format('d/M/Y'));
618 var d = Date.parseDate(v, 'Y-m-d');
619 return String.format('{0}', d ? d.format('d/M/Y') : '');
633 xtype: 'ColumnModel',
635 dataIndex : 'join_poitem_pohead_bg_available_est_day',
636 header : 'Est. Avail',
638 renderer : function(v) {
639 if(typeof(v) == 'object'){
640 return String.format('{0}',v.format('d/M/Y'));
642 var d = Date.parseDate(v, 'Y-m-d');
643 return String.format('{0}', d ? d.format('d/M/Y') : '');
657 xtype: 'ColumnModel',
659 dataIndex : 'join_poitem_pohead_bg_available_latest_day',
660 header : 'Confirm Avail',
663 renderer : function(v) {
664 if(typeof(v) == 'object'){
665 return String.format('{0}',v.format('d/M/Y'));
667 var d = Date.parseDate(v, 'Y-m-d');
668 return String.format('{0}', d ? d.format('d/M/Y') : '');
682 xtype: 'ColumnModel',
684 dataIndex : 'join_poitem_location_name',
688 renderer : function(v,x,r)
691 return String.format('{0}', v ? v : '');
700 beforeselect : function (combo, record, index)
702 var ar = _this.grid.activeEditor.record;
704 if(record.data.location_id == ar.data.join_poitem_location_id){
709 poitem_id : ar.data.poitem_id,
710 poitem_location_id : record.data.location_id
716 url : baseURL + '/Roo/poitem',
723 displayField : 'location_name',
725 emptyText : "Select a location",
726 forceSelection : true,
727 hiddenName : 'join_poitem_location_id',
729 loadingText : "Searching...",
731 name : 'join_poitem_location_name',
733 qtip : "Select a location",
734 queryParam : 'query[location_name]',
735 selectOnFocus : true,
736 tpl : '<div class="x-grid-cell-text x-btn button"><b>{location_name}</b> </div>',
737 triggerAction : 'all',
739 valueField : 'location_id',
744 beforeload : function (_self, o){
745 o.params = o.params || {};
746 o.params.location_netable = 1;
750 sortInfo : { direction : 'ASC', field: 'location_name' },
755 url : baseURL + '/Roo/location.php'
762 totalProperty : 'total',
763 fields : [{"name":"location_id","type":"int"},"location_name"]
770 xtype: 'ColumnModel',
772 dataIndex : 'join_poitem_vend_name',
773 header : 'Originating from',
776 renderer : function(v,x,r)
778 if(v && r.data.join_poitem_pohead_vendcountry)
780 return String.format('{0}', v + ' (' + r.data.join_poitem_pohead_vendcountry + ')');
782 return String.format('{0}', v);
786 xtype: 'ColumnModel',
788 dataIndex : 'poitem_qty_ordered',
791 renderer : function(v) { return String.format('{0}', v ? v : '' ); }
794 xtype: 'ColumnModel',
796 dataIndex : 'join_poitem_pohead_orderdate',
797 header : 'Order Created',
800 renderer : function(v)
802 var d = Date.parseDate(v, 'Y-m-d');
803 return String.format('{0}', d ? d.format('d/M/Y') : '');
807 xtype: 'ColumnModel',
809 dataIndex : 'poitem_duedate',
813 renderer : function(v)
815 // var d = Date.parseDate(v, 'Y-m-d');
816 return String.format('{0}', v ? v.format('d/M/Y') : '');
820 xtype: 'ColumnModel',
822 dataIndex : 'join_poitem_pohead_last_updated',
823 header : 'Last Updated',
825 renderer : function(v,x,r)
830 var d = (new Date()).add(Date.DAY, -15);
834 return '<span style="color:red">' + v.format('d/M/Y') + '</span>';
837 return String.format('{0}', v ? v.format('d/M/Y') : '');
841 xtype: 'ColumnModel',
843 dataIndex : 'join_poitem_pohead_notes',
846 renderer : function(v) { return String.format('{0}', v); },
861 xtype: 'LayoutRegion',