1 //<script type="text/javascript">
3 // Auto generated file - created by app.Builder.js- do not edit directly (at present!)
5 Pman.Dialog.XtupleVendorEdit = {
10 show : function(data, cb)
18 this.dialog.show(this.data._el);
21 this.form.setValues(data);
22 this.form.fireEvent('actioncomplete', this.form, { type: 'setdata', data: data });
30 this.dialog = Roo.factory({
31 xtype: 'LayoutDialog',
34 show : function (_self)
36 this.layout.getRegion('center').showPanel(0);
44 title : "Edit / Create Vendor",
48 xtype: 'ContentPanel',
57 actioncomplete : function(_self,action)
59 if (action.type == 'setdata') {
60 if(_this.data.vend_id){
61 _this.dialog.el.mask("Loading");
62 this.load({ method: 'GET', params: { '_id' : _this.data.vend_id }});
67 if (action.type == 'load') {
68 _this.data = action.result.data;
69 _this.form.findField('addr_view').sync();
70 _this.dialog.el.unmask();
73 if (action.type =='submit') {
75 _this.dialog.el.unmask();
79 _this.callback.call(_this, _this.form.getValues());
85 rendered : function (form)
91 style : 'margin:10px;',
92 url : baseURL + '/Roo/vendinfo.php',
97 legend : "Basic Details",
98 style : 'width:450px',
104 keyup : function (_self, e)
106 if (!(_this.form.findField('vend_id').getValue() * 1)) {
108 _this.form.findField('vend_number').setValue(this.getValue().replace(/[^a-z0-9]/ig, '').toUpperCase());
122 fieldLabel : 'Vendor #',
123 name : 'vend_number',
131 fieldLabel : 'Ship Via',
132 name : 'vend_shipvia',
140 displayField : 'curr_symbol',
142 emptyText : "Select Currency",
143 fieldLabel : 'Currency',
144 forceSelection : true,
145 hiddenName : 'vend_curr_id',
147 loadingText : "Searching...",
149 name : 'vend_curr_id_curr_symbol',
151 qtip : "Select Currency",
152 queryParam : 'query[curr_symbol]',
153 selectOnFocus : true,
154 tpl : '<div class="x-grid-cell-text x-btn button"><b>{curr_symbol}</b> </div>',
155 triggerAction : 'all',
157 valueField : 'curr_id',
163 beforeload : function (_self, o){
164 o.params = o.params || {};
168 sortInfo : { direction : 'ASC', field: 'curr_symbol' },
173 url : baseURL + '/Roo/curr_symbol.php'
180 totalProperty : 'total',
181 fields : [{"name":"curr_id","type":"int"},"curr_symbol"]
190 displayField : 'terms_descrip',
192 emptyText : "Select Terms",
193 fieldLabel : 'Terms',
194 forceSelection : true,
195 hiddenName : 'vend_terms_id',
197 loadingText : "Searching...",
199 name : 'vend_terms_id_terms_descrip',
201 qtip : "Select Terms",
202 queryParam : 'query[terms_descrip]',
203 selectOnFocus : true,
204 tpl : '<div class="x-grid-cell-text x-btn button"><b>{terms_descrip}</b> </div>',
205 triggerAction : 'all',
207 valueField : 'terms_id',
213 beforeload : function (_self, o){
214 o.params = o.params || {};
218 sortInfo : { direction : 'ASC', field: 'terms_descrip' },
223 url : baseURL + '/Roo/terms.php'
230 totalProperty : 'total',
231 fields : [{"name":"terms_id","type":"int"},"terms_descrip"]
240 displayField : 'taxzone_descrip',
242 emptyText : "Select Taxzone",
243 fieldLabel : 'Tax Zone',
244 forceSelection : true,
245 hiddenName : 'vend_taxzone_id',
247 loadingText : "Searching...",
249 name : 'vend_taxzone_id_taxzone_descrip',
251 qtip : "Select Taxzone",
252 queryParam : 'query[taxzone_descrip]',
253 selectOnFocus : true,
254 tpl : '<div class="x-grid-cell-text x-btn button"><b>{taxzone_descrip}</b> </div>',
255 triggerAction : 'all',
257 valueField : 'taxzone_id',
263 beforeload : function (_self, o){
264 o.params = o.params || {};
268 sortInfo : { direction : 'ASC', field: 'taxzone_descrip' },
273 url : baseURL + '/Roo/taxzone.php'
280 totalProperty : 'total',
281 fields : [{"name":"taxzone_id","type":"int"},"taxzone_descrip"]
289 add : function (combo)
291 Pman.Dialog.XtupleVendTypeEdit.show({vendtype_id : 0}, function(res){
292 _this.form.findField('vend_vendtype_id').setFromData(res);
296 edit : function (combo, record)
298 var s = _this.form.findField('vend_vendtype_id').getValue() * 1;
300 Roo.MessageBox.alert('Error','Please select a type');
304 Pman.Dialog.XtupleVendTypeEdit.show({vendtype_id : s}, function(res){
306 _this.form.findField('vend_vendtype_id').setFromData(res);
313 displayField : 'vendtype_descrip',
315 emptyText : "Select Vendor Type",
317 forceSelection : true,
318 hiddenName : 'vend_vendtype_id',
320 loadingText : "Searching...",
322 name : 'vend_vendtype_id_vendtype_descrip',
324 qtip : "Select Vendor Type",
325 queryParam : 'query[vendtype_descrip]',
326 selectOnFocus : true,
327 tpl : '<div class="x-grid-cell-text x-btn button"><b>{vendtype_descrip}</b> </div>',
328 triggerAction : 'all',
330 valueField : 'vendtype_id',
336 beforeload : function (_self, o){
337 o.params = o.params || {};
341 sortInfo : { direction : 'ASC', field: 'vendtype_descrip' },
346 url : baseURL + '/Roo/vendtype.php'
353 totalProperty : 'total',
354 fields : [{"name":"vendtype_id","type":"int"},"vendtype_descrip"]
361 fieldLabel : 'Active',
363 name : 'vend_active',
370 fieldLabel : 'Comments',
371 name : 'vend_comments'
380 style : 'width:450px;',
386 add : function (combo)
388 Pman.Dialog.XtupleAddress.show({addr_id : 0});
390 edit : function (combo, record)
392 var s = _this.form.findField('vend_addr_id').getValue() * 1;
394 Roo.MessageBox.alert('Error','Please select a address');
397 Pman.Dialog.XtupleAddress.show({addr_id : s});
399 select : function (combo, record, index)
401 for(var i in record.data) {
402 _this.data['vend_addr_id_' + i] = record.data[i];
405 _this.form.findField('addr_view').sync();
410 displayField : 'addr_number',
412 emptyText : "Select Address",
413 fieldLabel : 'Address',
414 forceSelection : true,
415 hiddenName : 'vend_addr_id',
417 loadingText : "Searching...",
419 name : 'vend_addr_id_addr_number',
421 qtip : "Select Address",
422 queryParam : 'query[address]',
423 selectOnFocus : true,
424 tpl : '<div class="x-grid-cell-text x-btn button"><b>#{addr_id} - {addr_number}</b> </div>',
425 triggerAction : 'all',
427 valueField : 'addr_id',
433 beforeload : function (_self, o){
434 o.params = o.params || {};
439 sortInfo : { direction : 'DESC', field: 'addr_id' },
444 url : baseURL + '/Roo/addr.php'
451 totalProperty : 'total',
452 fields : [{"name":"addr_id","type":"int"},"addr_number"]
460 fieldLabel : 'Notes',
465 var a = [ 'line1', 'line2', 'line3', 'city', 'state', 'country' ];
468 Roo.each(a, function(e) {
469 if (_this.data['vend_addr_id_addr_' +e].length) {
470 v.push(_this.data['vend_addr_id_addr_' +e]);
474 this.setValue(v.join("\n"));
492 activate : function() {
495 _this.grid.footer.onClick('first');
503 tableName : 'itemsrc',
504 title : "Supplier of",
512 //_this.dialog = Pman.Dialog.FILL_IN
513 if (_this.panel.active) {
514 this.footer.onClick('first');
517 rowdblclick : function (_self, rowIndex, e)
520 Pman.Dialog.XtupleItem.show({ item_id : this.getDataSource().getAt(rowIndex).data.itemsrc_item_id }, function() {
521 _this.grid.footer.onClick('first');
525 autoExpandColumn : 'itemsrc_vend_item_descrip',
531 beforeload : function (_self, options)
533 options.params.itemsrc_vend_id = _this.form.findField('vend_id').getValue();
534 var s = _this.searchBox.getValue();
536 options.params['search[name]'] = s;
541 sortInfo : { field : 'itemsrc_item_id_item_number', direction: 'ASC' },
546 url : baseURL + '/Roo/itemsrc.php'
551 totalProperty : 'total',
556 'name': 'itemsrc_id',
560 'name': 'itemsrc_item_id',
564 'name': 'itemsrc_item_id',
568 'name': 'itemsrc_vend_id',
572 'name': 'itemsrc_vend_id',
576 'name': 'itemsrc_vend_item_number',
580 'name': 'itemsrc_vend_item_descrip',
584 'name': 'itemsrc_comments',
588 'name': 'itemsrc_vend_uom',
592 'name': 'itemsrc_invvendoruomratio',
596 'name': 'itemsrc_minordqty',
600 'name': 'itemsrc_multordqty',
604 'name': 'itemsrc_leadtime',
608 'name': 'itemsrc_ranking',
612 'name': 'itemsrc_active',
616 'name': 'itemsrc_manuf_name',
620 'name': 'itemsrc_manuf_item_number',
624 'name': 'itemsrc_manuf_item_descrip',
628 'name': 'itemsrc_default',
632 'name': 'itemsrc_upccode',
639 xtype: 'PagingToolbar',
642 displayMsg : "Displaying itemsrc{0} - {1} of {2}",
643 emptyMsg : "No itemsrc found",
654 render : function (_self)
656 _this.searchBox = _self;
658 specialkey : function (_self, e)
660 _this.grid.footer.onClick('first');
668 click : function (_self, e)
670 _this.grid.footer.onClick('first');
674 icon : rootURL + '/Pman/templates/images/search.gif'
680 click : function (_self, e)
682 _this.searchBox.setValue('');
684 _this.grid.footer.onClick('first');
688 icon : rootURL + '/Pman/templates/images/edit-clear.gif'
701 Pman.Dialog.XtupleSalesProductList.show({
702 exclude_itemsrc_vendor : _this.form.findField('vend_id').getValue(),
709 Roo.each(sels,function(rec) {
710 ids.push(rec.data.item_id);
714 url : baseURL + '/Roo/Itemsrc',
717 add_multiple : ids.join(','),
718 itemsrc_vend_id : _this.form.findField('vend_id').getValue()
720 success : function() {
723 _this.grid.footer.onClick('first');
732 cls : 'x-btn-text-icon',
734 icon : Roo.rootURL + 'images/default/dd/drop-add.gif'
742 Pman.genericDelete(_this, 'itemsrc');
745 cls : 'x-btn-text-icon',
747 icon : rootURL + '/Pman/templates/images/trash.gif'
753 xtype: 'ColumnModel',
755 dataIndex : 'itemsrc_item_id_item_number',
758 renderer : function(v) { return String.format('{0}', v); }
761 xtype: 'ColumnModel',
763 dataIndex : 'itemsrc_vend_item_number',
764 header : 'Vendor item number',
766 renderer : function(v) { return String.format('{0}', v); }
769 xtype: 'ColumnModel',
771 dataIndex : 'itemsrc_vend_item_descrip',
772 header : 'Vendor item description',
774 renderer : function(v) { return String.format('{0}', v); }
777 xtype: 'ColumnModel',
779 dataIndex : 'itemsrc_vend_uom',
782 renderer : function(v) { return String.format('{0}', v); }
785 xtype: 'ColumnModel',
787 dataIndex : 'itemsrc_minordqty',
788 header : 'Min ord qty',
790 renderer : function(v) { return String.format('{0}', v); }
793 xtype: 'ColumnModel',
795 dataIndex : 'itemsrc_leadtime',
796 header : 'Lead time',
798 renderer : function(v) { return String.format('{0}', v); }
801 xtype: 'ColumnModel',
803 dataIndex : 'itemsrc_active',
806 renderer : function(v) { return String.format('{0}', v); }
815 activate : function() {
818 _this.agrid.footer.onClick('first');
826 tableName : 'vendaddrinfo',
835 //_this.dialog = Pman.Dialog.FILL_IN
836 if (_this.apanel.active) {
837 this.footer.onClick('first');
841 autoExpandColumn : 'vendaddr_addr_id_addr_line1',
844 xtype: 'RowSelectionModel',
852 beforeload : function (_self, options)
854 options.params = options.params || {};
856 var id = _this.form.findField('vend_id').getValue();
862 options.params.vendaddr_vend_id = id;
866 sortInfo : { field : 'vendaddr_id', direction: 'ASC' },
871 url : baseURL + '/Roo/vendaddrinfo.php'
878 totalProperty : 'total',
881 'name': 'vendaddr_id',
885 'name': 'vendaddr_vend_id',
889 'name': 'vendaddr_code',
896 xtype: 'PagingToolbar',
899 displayMsg : "Displaying address{0} - {1} of {2}",
900 emptyMsg : "Nothing found",
915 click : function (_self, e)
917 var id = _this.form.findField('vend_id').getValue();
920 Roo.MessageBox.alert('Error', 'Please save the vendor first');
924 Pman.Dialog.Image.show(
926 _url : baseURL+'/Xtuple/Import/VendAddrInfo?' + Roo.urlEncode({'vend_id' : id})
930 _this.agrid.footer.onClick('first');
943 var s = _this.agrid.getSelectionModel().getSelected();
945 if(!s || s.data.vendaddr_id * 1 < 1){
946 Roo.MessageBox.alert('Error', 'Please select a row');
950 Roo.MessageBox.confirm("Confirm", "Are you sure you want to delete that?",
957 url: baseURL+ '/Roo/vendaddrinfo',
959 _delete : s.data.vendaddr_id
961 success : function() {
962 _this.agrid.footer.onClick('refresh');
968 cls : 'x-btn-text-icon',
970 icon : rootURL + '/Pman/templates/images/trash.gif'
978 var s = _this.form.findField('vend_id').getValue() * 1;
981 Roo.MessageBox.alert('Error', 'Save first!');
985 Roo.MessageBox.confirm("Confirm", "Are you sure you want to delete all the address?",
992 url: baseURL+ '/Roo/vendinfo',
997 success : function() {
998 _this.agrid.footer.onClick('refresh');
1004 cls : 'x-btn-text-icon',
1005 text : "Delete All",
1006 icon : rootURL + '/Pman/templates/images/trash.gif'
1012 xtype: 'ColumnModel',
1014 dataIndex : 'vendaddr_code',
1017 renderer : function(v) { return String.format('{0}', v); }
1020 xtype: 'ColumnModel',
1022 dataIndex : 'vendaddr_addr_id_addr_city',
1023 header : 'District',
1025 renderer : function(v) { return String.format('{0}', v); }
1028 xtype: 'ColumnModel',
1030 dataIndex : 'vendaddr_addr_id_addr_line1',
1031 header : 'Address Line 1',
1033 renderer : function(v) { return String.format('{0}', v); }
1036 xtype: 'ColumnModel',
1038 dataIndex : 'vendaddr_addr_id_addr_line2',
1039 header : 'Address Line 2',
1041 renderer : function(v) { return String.format('{0}', v); }
1048 xtype: 'LayoutRegion',
1057 click : function (_self, e)
1059 _this.dialog.hide();
1068 click : function (_self, e)
1070 _this.form.doAction("submit");