// Auto generated file - created by app.Builder.js- do not edit directly (at present!)
+Roo.namespace('Pman.Dialog');
+
Pman.Dialog.XtupleCustomer = {
dialog : false,
{
var _this = this;
this.dialog = Roo.factory({
- xtype: 'LayoutDialog',
- xns: Roo,
- closable : false,
- collapsible : false,
- height : 640,
+ center : {
+ toolbar : {
+ '|xns' : 'Roo',
+ xtype : 'Toolbar',
+ xns : Roo,
+ items : [
+ {
+ '|xns' : 'Roo.Toolbar',
+ xtype : 'Fill',
+ xns : Roo.Toolbar
+ },
+ {
+ '|xns' : 'Roo.Toolbar',
+ text : "Change Customer Code",
+ xtype : 'Button',
+ xns : Roo.Toolbar,
+ listeners : {
+ click : function (_self, e)
+ {
+ var cid = _this.form.findField('cust_id').getValue();
+ if(!cid){
+ Roo.Msg.alert('Error','please save the customer first');
+ return;
+ }
+
+ Pman.Dialog.XtupleCustomerCode.show({cust_id : cid}, function(res){
+ _this.form.reset();
+ _this.form.fireEvent('actioncomplete', _this.form, { type: 'setdata', data: {cust_id : res.cust_id} });
+
+ });
+
+ }
+ }
+ }
+ ]
+
+ },
+ '|xns' : 'Roo',
+ alwaysShowTabs : true,
+ xtype : 'LayoutRegion',
+ xns : Roo,
+ tabPosition : 'top',
+ items : [
+
+ ]
+
+ },
+ '|xns' : 'Roo',
modal : true,
- resizable : true,
+ collapsible : false,
title : "Customer Information",
+ xtype : 'LayoutDialog',
width : 900,
+ xns : Roo,
+ closable : false,
+ resizable : true,
+ height : 670,
+ builderCfg : '{\"cols\":[{\"table\":\"custinfo\",\"column\":\"cust_custtype_id\",\"columnshort\":\"cust_custtype_id\",\"ctype\":\"int4\",\"desc\":\"\",\"maps_to\":\"custtype_id\",\"deps\":[{\"table\":\"custtype\",\"column\":\"cust_custtype_id_custtype_code\",\"columnshort\":\"custtype_code\",\"ctype\":\"text\",\"desc\":\"\"},{\"table\":\"custtype\",\"column\":\"cust_custtype_id_custtype_descrip\",\"columnshort\":\"custtype_descrip\",\"ctype\":\"text\",\"desc\":\"\"},{\"table\":\"custtype\",\"column\":\"cust_custtype_id_custtype_char\",\"columnshort\":\"custtype_char\",\"ctype\":\"bool\",\"desc\":\"\"}],\"use\":1,\"use_ex\":\"\",\"title\":\"Customer Type\",\"display\":\"cust_custtype_id_custtype_descrip\"},{\"table\":\"custinfo\",\"column\":\"cust_salesrep_id\",\"columnshort\":\"cust_salesrep_id\",\"ctype\":\"int4\",\"desc\":\"\",\"maps_to\":\"salesrep_id\",\"deps\":[{\"table\":\"salesrep\",\"column\":\"cust_salesrep_id_salesrep_active\",\"columnshort\":\"salesrep_active\",\"ctype\":\"bool\",\"desc\":\"\"},{\"table\":\"salesrep\",\"column\":\"cust_salesrep_id_salesrep_number\",\"columnshort\":\"salesrep_number\",\"ctype\":\"text\",\"desc\":\"\"},{\"table\":\"salesrep\",\"column\":\"cust_salesrep_id_salesrep_name\",\"columnshort\":\"salesrep_name\",\"ctype\":\"text\",\"desc\":\"\"},{\"table\":\"salesrep\",\"column\":\"cust_salesrep_id_salesrep_commission\",\"columnshort\":\"salesrep_commission\",\"ctype\":\"numeric\",\"desc\":\"\"},{\"table\":\"salesrep\",\"column\":\"cust_salesrep_id_salesrep_method\",\"columnshort\":\"salesrep_method\",\"ctype\":\"bpchar\",\"desc\":\"\"},{\"table\":\"salesrep\",\"column\":\"cust_salesrep_id_salesrep_emp_id\",\"columnshort\":\"salesrep_emp_id\",\"ctype\":\"int4\",\"desc\":\"\"}],\"use\":1,\"use_ex\":\"\",\"title\":\"Sales Rep\",\"display\":\"cust_salesrep_id_salesrep_name\"},{\"table\":\"custinfo\",\"column\":\"cust_commprcnt\",\"columnshort\":\"cust_commprcnt\",\"ctype\":\"numeric\",\"desc\":\"\",\"use\":1,\"use_ex\":\"\",\"title\":\"cust_commprcnt\"},{\"table\":\"custinfo\",\"column\":\"cust_name\",\"columnshort\":\"cust_name\",\"ctype\":\"text\",\"desc\":\"\",\"use\":1,\"use_ex\":\"\",\"title\":\"Name\"},{\"table\":\"custinfo\",\"column\":\"cust_creditlmt\",\"columnshort\":\"cust_creditlmt\",\"ctype\":\"int4\",\"desc\":\"\",\"use\":1,\"use_ex\":\"\",\"title\":\"Credit Limit\",\"display\":\"cust_creditlmt_curr_id_curr_symbol\"},{\"table\":\"custinfo\",\"column\":\"cust_creditrating\",\"columnshort\":\"cust_creditrating\",\"ctype\":\"text\",\"desc\":\"\",\"use\":1,\"use_ex\":\"\",\"title\":\"Credit Rating\"},{\"table\":\"custinfo\",\"column\":\"cust_financecharge\",\"columnshort\":\"cust_financecharge\",\"ctype\":\"bool\",\"desc\":\"\",\"use\":1,\"use_ex\":\"\",\"title\":\"Apply Finance Charge\"},{\"table\":\"custinfo\",\"column\":\"cust_backorder\",\"columnshort\":\"cust_backorder\",\"ctype\":\"bool\",\"desc\":\"\",\"use\":1,\"use_ex\":\"\",\"title\":\"Allow Back Order\"},{\"table\":\"custinfo\",\"column\":\"cust_partialship\",\"columnshort\":\"cust_partialship\",\"ctype\":\"bool\",\"desc\":\"\",\"use\":1,\"use_ex\":\"\",\"title\":\"Allow Partial Shipment\"},{\"table\":\"custinfo\",\"column\":\"cust_terms_id\",\"columnshort\":\"cust_terms_id\",\"ctype\":\"int4\",\"desc\":\"\",\"maps_to\":\"terms_id\",\"deps\":[{\"table\":\"terms\",\"column\":\"cust_terms_id_terms_code\",\"columnshort\":\"terms_code\",\"ctype\":\"text\",\"desc\":\"\"},{\"table\":\"terms\",\"column\":\"cust_terms_id_terms_descrip\",\"columnshort\":\"terms_descrip\",\"ctype\":\"text\",\"desc\":\"\"},{\"table\":\"terms\",\"column\":\"cust_terms_id_terms_type\",\"columnshort\":\"terms_type\",\"ctype\":\"bpchar\",\"desc\":\"\"},{\"table\":\"terms\",\"column\":\"cust_terms_id_terms_duedays\",\"columnshort\":\"terms_duedays\",\"ctype\":\"int4\",\"desc\":\"\"},{\"table\":\"terms\",\"column\":\"cust_terms_id_terms_discdays\",\"columnshort\":\"terms_discdays\",\"ctype\":\"int4\",\"desc\":\"\"},{\"table\":\"terms\",\"column\":\"cust_terms_id_terms_discprcnt\",\"columnshort\":\"terms_discprcnt\",\"ctype\":\"numeric\",\"desc\":\"\"},{\"table\":\"terms\",\"column\":\"cust_terms_id_terms_cutoffday\",\"columnshort\":\"terms_cutoffday\",\"ctype\":\"int4\",\"desc\":\"\"},{\"table\":\"terms\",\"column\":\"cust_terms_id_terms_ap\",\"columnshort\":\"terms_ap\",\"ctype\":\"bool\",\"desc\":\"\"},{\"table\":\"terms\",\"column\":\"cust_terms_id_terms_ar\",\"columnshort\":\"terms_ar\",\"ctype\":\"bool\",\"desc\":\"\"}],\"use\":1,\"use_ex\":\"\",\"title\":\"Terms\",\"display\":\"cust_terms_id_terms_descrip\"},{\"table\":\"custinfo\",\"column\":\"cust_discntprcnt\",\"columnshort\":\"cust_discntprcnt\",\"ctype\":\"numeric\",\"desc\":\"\",\"use\":1,\"use_ex\":\"\",\"title\":\"Discount Percent\"},{\"table\":\"custinfo\",\"column\":\"cust_balmethod\",\"columnshort\":\"cust_balmethod\",\"ctype\":\"bpchar\",\"desc\":\"\",\"use\":1,\"use_ex\":\"\",\"title\":\"Balance Method\"},{\"table\":\"custinfo\",\"column\":\"cust_ffshipto\",\"columnshort\":\"cust_ffshipto\",\"ctype\":\"bool\",\"desc\":\"\",\"use\":1,\"use_ex\":\"\",\"title\":\"is ff Ship To\"},{\"table\":\"custinfo\",\"column\":\"cust_shipform_id\",\"columnshort\":\"cust_shipform_id\",\"ctype\":\"int4\",\"desc\":\"\",\"maps_to\":\"shipform_id\",\"deps\":[{\"table\":\"shipform\",\"column\":\"cust_shipform_id_shipform_name\",\"columnshort\":\"shipform_name\",\"ctype\":\"text\",\"desc\":\"\"},{\"table\":\"shipform\",\"column\":\"cust_shipform_id_shipform_report_id\",\"columnshort\":\"shipform_report_id\",\"ctype\":\"int4\",\"desc\":\"\"},{\"table\":\"shipform\",\"column\":\"cust_shipform_id_shipform_report_name\",\"columnshort\":\"shipform_report_name\",\"ctype\":\"text\",\"desc\":\"\"}],\"use\":1,\"use_ex\":\"\",\"title\":\"Shipment Form\",\"display\":\"cust_shipform_id_shipform_name\"},{\"table\":\"custinfo\",\"column\":\"cust_shipvia\",\"columnshort\":\"cust_shipvia\",\"ctype\":\"text\",\"desc\":\"\",\"use\":1,\"use_ex\":\"\",\"title\":\"Ship Via\"},{\"table\":\"custinfo\",\"column\":\"cust_creditstatus\",\"columnshort\":\"cust_creditstatus\",\"ctype\":\"bpchar\",\"desc\":\"\",\"use\":1,\"use_ex\":\"\",\"title\":\"Credit Status\"},{\"table\":\"custinfo\",\"column\":\"cust_comments\",\"columnshort\":\"cust_comments\",\"ctype\":\"text\",\"desc\":\"\",\"use\":1,\"use_ex\":\"\",\"title\":\"Comments\"},{\"table\":\"custinfo\",\"column\":\"cust_ffbillto\",\"columnshort\":\"cust_ffbillto\",\"ctype\":\"bool\",\"desc\":\"\",\"use\":1,\"use_ex\":\"\",\"title\":\"is ff Bill To\"},{\"table\":\"custinfo\",\"column\":\"cust_number\",\"columnshort\":\"cust_number\",\"ctype\":\"text\",\"desc\":\"\",\"use\":1,\"use_ex\":\"\",\"title\":\"Customer #\"},{\"table\":\"custinfo\",\"column\":\"cust_dateadded\",\"columnshort\":\"cust_dateadded\",\"ctype\":\"date\",\"desc\":\"\",\"use\":1,\"use_ex\":\"\",\"title\":\"Added\"},{\"table\":\"custinfo\",\"column\":\"cust_curr_id\",\"columnshort\":\"cust_curr_id\",\"ctype\":\"int4\",\"desc\":\"\",\"maps_to\":\"curr_id\",\"deps\":[{\"table\":\"curr_symbol\",\"column\":\"cust_curr_id_curr_base\",\"columnshort\":\"curr_base\",\"ctype\":\"bool\",\"desc\":\"\"},{\"table\":\"curr_symbol\",\"column\":\"cust_curr_id_curr_name\",\"columnshort\":\"curr_name\",\"ctype\":\"varchar\",\"desc\":\"\"},{\"table\":\"curr_symbol\",\"column\":\"cust_curr_id_curr_symbol\",\"columnshort\":\"curr_symbol\",\"ctype\":\"varchar\",\"desc\":\"\"},{\"table\":\"curr_symbol\",\"column\":\"cust_curr_id_curr_abbr\",\"columnshort\":\"curr_abbr\",\"ctype\":\"varchar\",\"desc\":\"\"}],\"use\":1,\"use_ex\":\"\",\"title\":\"Currency\",\"display\":\"cust_curr_id_curr_symbol\"},{\"table\":\"custinfo\",\"column\":\"cust_creditlmt_curr_id\",\"columnshort\":\"cust_creditlmt_curr_id\",\"ctype\":\"int4\",\"desc\":\"\",\"maps_to\":\"curr_id\",\"deps\":[{\"table\":\"curr_symbol\",\"column\":\"cust_creditlmt_curr_id_curr_base\",\"columnshort\":\"curr_base\",\"ctype\":\"bool\",\"desc\":\"\"},{\"table\":\"curr_symbol\",\"column\":\"cust_creditlmt_curr_id_curr_name\",\"columnshort\":\"curr_name\",\"ctype\":\"varchar\",\"desc\":\"\"},{\"table\":\"curr_symbol\",\"column\":\"cust_creditlmt_curr_id_curr_symbol\",\"columnshort\":\"curr_symbol\",\"ctype\":\"varchar\",\"desc\":\"\"},{\"table\":\"curr_symbol\",\"column\":\"cust_creditlmt_curr_id_curr_abbr\",\"columnshort\":\"curr_abbr\",\"ctype\":\"varchar\",\"desc\":\"\"}],\"use\":1,\"use_ex\":\"\",\"title\":\"Credit Limit Currency\",\"display\":\"cust_creditlmt_curr_id_curr_symbol\"},{\"table\":\"custinfo\",\"column\":\"cust_cntct_id\",\"columnshort\":\"cust_cntct_id\",\"ctype\":\"int4\",\"desc\":\"\",\"maps_to\":\"cntct_id\",\"deps\":[{\"table\":\"cntct\",\"column\":\"cust_cntct_id_cntct_crmacct_id\",\"columnshort\":\"cntct_crmacct_id\",\"ctype\":\"int4\",\"desc\":\"\"},{\"table\":\"cntct\",\"column\":\"cust_cntct_id_cntct_addr_id\",\"columnshort\":\"cntct_addr_id\",\"ctype\":\"int4\",\"desc\":\"\"},{\"table\":\"cntct\",\"column\":\"cust_cntct_id_cntct_first_name\",\"columnshort\":\"cntct_first_name\",\"ctype\":\"text\",\"desc\":\"\"},{\"table\":\"cntct\",\"column\":\"cust_cntct_id_cntct_last_name\",\"columnshort\":\"cntct_last_name\",\"ctype\":\"text\",\"desc\":\"\"},{\"table\":\"cntct\",\"column\":\"cust_cntct_id_cntct_honorific\",\"columnshort\":\"cntct_honorific\",\"ctype\":\"text\",\"desc\":\"\"},{\"table\":\"cntct\",\"column\":\"cust_cntct_id_cntct_initials\",\"columnshort\":\"cntct_initials\",\"ctype\":\"text\",\"desc\":\"\"},{\"table\":\"cntct\",\"column\":\"cust_cntct_id_cntct_active\",\"columnshort\":\"cntct_active\",\"ctype\":\"bool\",\"desc\":\"\"},{\"table\":\"cntct\",\"column\":\"cust_cntct_id_cntct_phone\",\"columnshort\":\"cntct_phone\",\"ctype\":\"text\",\"desc\":\"\"},{\"table\":\"cntct\",\"column\":\"cust_cntct_id_cntct_phone2\",\"columnshort\":\"cntct_phone2\",\"ctype\":\"text\",\"desc\":\"\"},{\"table\":\"cntct\",\"column\":\"cust_cntct_id_cntct_fax\",\"columnshort\":\"cntct_fax\",\"ctype\":\"text\",\"desc\":\"\"},{\"table\":\"cntct\",\"column\":\"cust_cntct_id_cntct_email\",\"columnshort\":\"cntct_email\",\"ctype\":\"text\",\"desc\":\"\"},{\"table\":\"cntct\",\"column\":\"cust_cntct_id_cntct_webaddr\",\"columnshort\":\"cntct_webaddr\",\"ctype\":\"text\",\"desc\":\"\"},{\"table\":\"cntct\",\"column\":\"cust_cntct_id_cntct_notes\",\"columnshort\":\"cntct_notes\",\"ctype\":\"text\",\"desc\":\"\"},{\"table\":\"cntct\",\"column\":\"cust_cntct_id_cntct_title\",\"columnshort\":\"cntct_title\",\"ctype\":\"text\",\"desc\":\"\"},{\"table\":\"cntct\",\"column\":\"cust_cntct_id_cntct_number\",\"columnshort\":\"cntct_number\",\"ctype\":\"text\",\"desc\":\"\"},{\"table\":\"cntct\",\"column\":\"cust_cntct_id_cntct_middle\",\"columnshort\":\"cntct_middle\",\"ctype\":\"text\",\"desc\":\"\"},{\"table\":\"cntct\",\"column\":\"cust_cntct_id_cntct_suffix\",\"columnshort\":\"cntct_suffix\",\"ctype\":\"text\",\"desc\":\"\"},{\"table\":\"cntct\",\"column\":\"cust_cntct_id_cntct_owner_username\",\"columnshort\":\"cntct_owner_username\",\"ctype\":\"text\",\"desc\":\"\"},{\"table\":\"cntct\",\"column\":\"cust_cntct_id_cntct_name\",\"columnshort\":\"cntct_name\",\"ctype\":\"text\",\"desc\":\"\"}],\"use\":1,\"use_ex\":\"\",\"title\":\"Contact\",\"display\":\"cust_cntct_id_cntct_name\"},{\"table\":\"custinfo\",\"column\":\"cust_corrcntct_id\",\"columnshort\":\"cust_corrcntct_id\",\"ctype\":\"int4\",\"desc\":\"\",\"maps_to\":\"cntct_id\",\"deps\":[{\"table\":\"cntct\",\"column\":\"cust_corrcntct_id_cntct_crmacct_id\",\"columnshort\":\"cntct_crmacct_id\",\"ctype\":\"int4\",\"desc\":\"\"},{\"table\":\"cntct\",\"column\":\"cust_corrcntct_id_cntct_addr_id\",\"columnshort\":\"cntct_addr_id\",\"ctype\":\"int4\",\"desc\":\"\"},{\"table\":\"cntct\",\"column\":\"cust_corrcntct_id_cntct_first_name\",\"columnshort\":\"cntct_first_name\",\"ctype\":\"text\",\"desc\":\"\"},{\"table\":\"cntct\",\"column\":\"cust_corrcntct_id_cntct_last_name\",\"columnshort\":\"cntct_last_name\",\"ctype\":\"text\",\"desc\":\"\"},{\"table\":\"cntct\",\"column\":\"cust_corrcntct_id_cntct_honorific\",\"columnshort\":\"cntct_honorific\",\"ctype\":\"text\",\"desc\":\"\"},{\"table\":\"cntct\",\"column\":\"cust_corrcntct_id_cntct_initials\",\"columnshort\":\"cntct_initials\",\"ctype\":\"text\",\"desc\":\"\"},{\"table\":\"cntct\",\"column\":\"cust_corrcntct_id_cntct_active\",\"columnshort\":\"cntct_active\",\"ctype\":\"bool\",\"desc\":\"\"},{\"table\":\"cntct\",\"column\":\"cust_corrcntct_id_cntct_phone\",\"columnshort\":\"cntct_phone\",\"ctype\":\"text\",\"desc\":\"\"},{\"table\":\"cntct\",\"column\":\"cust_corrcntct_id_cntct_phone2\",\"columnshort\":\"cntct_phone2\",\"ctype\":\"text\",\"desc\":\"\"},{\"table\":\"cntct\",\"column\":\"cust_corrcntct_id_cntct_fax\",\"columnshort\":\"cntct_fax\",\"ctype\":\"text\",\"desc\":\"\"},{\"table\":\"cntct\",\"column\":\"cust_corrcntct_id_cntct_email\",\"columnshort\":\"cntct_email\",\"ctype\":\"text\",\"desc\":\"\"},{\"table\":\"cntct\",\"column\":\"cust_corrcntct_id_cntct_webaddr\",\"columnshort\":\"cntct_webaddr\",\"ctype\":\"text\",\"desc\":\"\"},{\"table\":\"cntct\",\"column\":\"cust_corrcntct_id_cntct_notes\",\"columnshort\":\"cntct_notes\",\"ctype\":\"text\",\"desc\":\"\"},{\"table\":\"cntct\",\"column\":\"cust_corrcntct_id_cntct_title\",\"columnshort\":\"cntct_title\",\"ctype\":\"text\",\"desc\":\"\"},{\"table\":\"cntct\",\"column\":\"cust_corrcntct_id_cntct_number\",\"columnshort\":\"cntct_number\",\"ctype\":\"text\",\"desc\":\"\"},{\"table\":\"cntct\",\"column\":\"cust_corrcntct_id_cntct_middle\",\"columnshort\":\"cntct_middle\",\"ctype\":\"text\",\"desc\":\"\"},{\"table\":\"cntct\",\"column\":\"cust_corrcntct_id_cntct_suffix\",\"columnshort\":\"cntct_suffix\",\"ctype\":\"text\",\"desc\":\"\"},{\"table\":\"cntct\",\"column\":\"cust_corrcntct_id_cntct_owner_username\",\"columnshort\":\"cntct_owner_username\",\"ctype\":\"text\",\"desc\":\"\"},{\"table\":\"cntct\",\"column\":\"cust_corrcntct_id_cntct_name\",\"columnshort\":\"cntct_name\",\"ctype\":\"text\",\"desc\":\"\"}],\"use\":1,\"use_ex\":\"\",\"title\":\"Corr? Contact\",\"display\":\"cust_corrcntct_id_cntct_name\"},{\"table\":\"custinfo\",\"column\":\"cust_taxzone_id\",\"columnshort\":\"cust_taxzone_id\",\"ctype\":\"int4\",\"desc\":\"\",\"maps_to\":\"taxzone_id\",\"deps\":[{\"table\":\"taxzone\",\"column\":\"cust_taxzone_id_taxzone_code\",\"columnshort\":\"taxzone_code\",\"ctype\":\"text\",\"desc\":\"\"},{\"table\":\"taxzone\",\"column\":\"cust_taxzone_id_taxzone_descrip\",\"columnshort\":\"taxzone_descrip\",\"ctype\":\"text\",\"desc\":\"\"}],\"use\":1,\"use_ex\":\"\",\"title\":\"Tax Zone\",\"display\":\"cust_taxzone_id_taxzone_descrip\"}],\"cols_ex\":[\"cust_custtype_id_custtype_descrip\",\"cust_salesrep_id_salesrep_name\",\"cust_terms_id_terms_descrip\",\"cust_shipform_id_shipform_name\",\"cust_curr_id_curr_symbol\",\"cust_creditlmt_curr_id_curr_symbol\",\"cust_cntct_id_cntct_name\",\"cust_corrcntct_id_cntct_name\",\"cust_taxzone_id_taxzone_descrip\"],\"table\":\"custinfo\",\"xtype\":\"LayoutDialog\",\"|xns\":\"Roo\"}',
+ buttons : [
+ {
+ '|xns' : 'Roo',
+ text : "Cancel",
+ xtype : 'Button',
+ xns : Roo,
+ listeners : {
+ click : function (_self, e)
+ {
+ _this.dialog.hide();
+ }
+ }
+ },
+{
+ '|xns' : 'Roo',
+ text : "Save",
+ xtype : 'Button',
+ xns : Roo,
+ listeners : {
+ click : function (_self, e)
+ {
+ // do some checks?
+
+ var bg_comp = _this.form.findField('cust_char_internalcompany').getValue();
+ var ctype = _this.form.findField('cust_custtype_id').el.dom.value;
+ if (bg_comp.length && !ctype.match(/internal/i)) {
+ Roo.MessageBox.alert("Error" ,
+ "BG Company should only be set for internal companies"
+ );
+ return;
+ }
+
+
+
+
+
+
+
+ _this.form.doAction("submit");
+
+ }
+ }
+ }
+ ],
items : [
- {
- xtype: 'NestedLayoutPanel',
- xns: Roo,
- background : false,
- region : 'center',
- title : "Details",
+ {
layout : {
- xtype: 'BorderLayout',
- xns: Roo,
+ center : {
+ '|xns' : 'Roo',
+ xtype : 'LayoutRegion',
+ xns : Roo
+ },
+ east : {
+ '|xns' : 'Roo',
+ xtype : 'LayoutRegion',
+ width : 300,
+ xns : Roo
+ },
+ '|xns' : 'Roo',
+ xtype : 'BorderLayout',
+ xns : Roo,
items : [
- {
- xtype: 'ContentPanel',
- xns: Roo,
+ {
+ '|xns' : 'Roo',
region : 'center',
+ xtype : 'ContentPanel',
+ xns : Roo,
items : [
- {
- xtype: 'Form',
- xns: Roo.form,
- listeners : {
- actioncomplete : function(_self,action)
- {
- if (action.type == 'setdata') {
-
- _this.dialog.layout.getRegion('center').showPanel(0);
-
- if (_this.data.cust_id) {
- this.load({ method: 'GET', params: { '_id' : _this.data.cust_id, '_with_char' : true }});
- return;
- }
- this.findField('cust_active').setValue(true);
- _this.grid.ds.load({});
- _this.dialog.setTitle("New Customer");
-
-
-
- return;
- }
- if (action.type == 'load') {
-
- _this.dialog.setTitle("Edit Customer (" + _this.data.cust_id +") " + _this.form.findField('cust_name').getValue() );
-
- _this.grid.ds.load({});
-
-
- return;
- }
- if (action.type =='submit') {
-
-
- if (_this.data.cust_id > 0 ) {
-
-
- _this.dialog.hide();
-
- if (_this.callback) {
- _this.callback.call(_this, _this.form.getValues());
- }
- _this.form.reset();
- return;
- }
- // carry on editing.. and set data..
-
- _this.data.cust_id = action.result.data.cust_id;
- _this.form.fireEvent('actioncomplete',
- _this.form, { type: 'setdata', data: _this.data });
-
-
- }
- },
- rendered : function (form)
- {
- _this.form= form;
- }
- },
+ {
+ '|xns' : 'Roo.form',
+ url : baseURL + '/Roo/custinfo.php',
+ xtype : 'Form',
method : 'POST',
style : 'margin:10px;',
- url : baseURL + '/Roo/custinfo.php',
+ xns : Roo.form,
+ listeners : {
+ actioncomplete : function(_self,action)
+ {
+ if (action.type == 'setdata') {
+
+ _this.dialog.layout.getRegion('center').showPanel(0);
+
+ if (_this.data.cust_id) {
+ this.load({ method: 'GET', params: { '_id' : _this.data.cust_id, '_with_char' : true }});
+ return;
+ }
+ this.findField('cust_active').setValue(true);
+ _this.grid.ds.load({});
+ _this.dialog.setTitle("New Customer");
+
+
+
+ return;
+ }
+ if (action.type == 'load') {
+
+ _this.dialog.setTitle("Edit Customer (" + _this.data.cust_id +") " + _this.form.findField('cust_name').getValue() );
+
+ _this.grid.ds.load({});
+
+
+ return;
+ }
+ if (action.type =='submit') {
+
+
+ if (_this.data.cust_id > 0 ) {
+
+
+ _this.dialog.hide();
+
+ if (_this.callback) {
+ _this.callback.call(_this, _this.form.getValues());
+ }
+ _this.form.reset();
+ return;
+ }
+ // carry on editing.. and set data..
+
+ _this.data.cust_id = action.result.data.cust_id;
+ _this.form.fireEvent('actioncomplete',
+ _this.form, { type: 'setdata', data: _this.data });
+
+
+ }
+ },
+ rendered : function (form)
+ {
+ _this.form= form;
+ }
+ },
items : [
- {
- xtype: 'FieldSet',
- xns: Roo.form,
+ {
+ '|xns' : 'Roo.form',
+ xtype : 'FieldSet',
legend : "Basic Details",
style : 'width:460px',
+ xns : Roo.form,
items : [
- {
- xtype: 'TextField',
- xns: Roo.form,
- listeners : {
- keyup : function (_self, e)
- {
- if (!(_this.form.findField('cust_id').getValue() * 1)) {
-
- _this.form.findField('cust_number').setValue(this.getValue().replace(/[^a-z0-9]/ig, '').toUpperCase());
-
- }
- }
- },
+ {
+ '|xns' : 'Roo.form',
+ fieldLabel : 'Login Email',
+ vtype : 'email',
+ xtype : 'TextField',
+ allowBlank : false,
+ width : 300,
+ xns : Roo.form,
+ name : 'cust_login_email'
+ },
+ {
+ '|xns' : 'Roo.form',
fieldLabel : 'Name',
+ xtype : 'TextField',
+ allowBlank : false,
+ width : 300,
+ xns : Roo.form,
name : 'cust_name',
- width : 300
+ listeners : {
+ keyup : function (_self, e)
+ {
+ if (!(_this.form.findField('cust_id').getValue() * 1)) {
+
+ _this.form.findField('cust_number').setValue(this.getValue().replace(/[^a-z0-9]/ig, '').toUpperCase());
+
+ }
+ }
+ }
},
- {
- xtype: 'Row',
- xns: Roo.form,
+ {
+ '|xns' : 'Roo.form',
+ xtype : 'Row',
+ xns : Roo.form,
items : [
- {
- xtype: 'TextField',
- xns: Roo.form,
+ {
+ '|xns' : 'Roo.form',
fieldLabel : 'Customer #',
- name : 'cust_number',
+ xtype : 'TextField',
+ allowBlank : false,
readOnly : true,
- width : 150
+ width : 150,
+ xns : Roo.form,
+ name : 'cust_number'
},
- {
- xtype: 'ComboBox',
- xns: Roo.form,
- allowBlank : true,
- displayField : 'charopt_value',
- editable : false,
- emptyText : "",
- fieldLabel : 'BG Company',
- forceSelection : true,
- hiddenName : 'cust_char_internalcompany',
- listWidth : 250,
- loadingText : "Searching...",
- minChars : 2,
- name : 'cust_char_internalcompany',
- pageSize : 20,
- qtip : "Select charopt",
- selectOnFocus : true,
- tpl : '<div class="x-grid-cell-text x-btn button"><b>{charopt_value}</b> </div>',
- triggerAction : 'all',
- typeAhead : true,
- valueField : 'charopt_value',
- width : 70,
+ {
store : {
- xtype: 'Store',
- xns: Roo.data,
- listeners : {
- beforeload : function (_self, o){
- o.params = o.params || {};
- // set more here
- o.params.charopt_char_id_char_name = 'INTERNALCOMPANY';
- o.params['!charopt_value'] = baseURL.split('/').pop().split('.').shift();
-
- }
- },
- remoteSort : true,
- sortInfo : { direction : 'ASC', field: 'id' },
proxy : {
- xtype: 'HttpProxy',
- xns: Roo.data,
+ '|xns' : 'Roo.data',
+ url : baseURL + '/Roo/charopt.php',
method : 'GET',
- url : baseURL + '/Roo/charopt.php'
+ xtype : 'HttpProxy',
+ xns : Roo.data
},
reader : {
- xtype: 'JsonReader',
- xns: Roo.data,
+ '|xns' : 'Roo.data',
id : 'id',
root : 'data',
- totalProperty : 'total',
- fields : [{"name":"id","type":"int"},{"name":"charopt_value","type":"string"}]
- }
- }
+ xtype : 'JsonReader',
+ xns : Roo.data,
+ fields : [{"name":"id","type":"int"},{"name":"charopt_value","type":"string"}],
+ totalProperty : 'total'
+ },
+ '|xns' : 'Roo.data',
+ xtype : 'Store',
+ remoteSort : true,
+ sortInfo : { direction : 'ASC', field: 'id' },
+ xns : Roo.data,
+ listeners : {
+ beforeload : function (_self, o){
+ o.params = o.params || {};
+ // set more here
+ o.params.charopt_char_id_char_name = 'INTERNALCOMPANY';
+ o.params['!charopt_value'] = baseURL.split('/').pop().split('.').shift();
+
+ }
+ },
+ items : [
+
+ ]
+
+ },
+ '|xns' : 'Roo.form',
+ listWidth : 250,
+ triggerAction : 'all',
+ fieldLabel : 'BG Company',
+ forceSelection : true,
+ selectOnFocus : true,
+ pageSize : 20,
+ displayField : 'charopt_value',
+ emptyText : "",
+ hiddenName : 'cust_char_internalcompany',
+ minChars : 2,
+ valueField : 'charopt_value',
+ xtype : 'ComboBox',
+ allowBlank : true,
+ typeAhead : true,
+ editable : false,
+ width : 70,
+ xns : Roo.form,
+ name : 'cust_char_internalcompany',
+ qtip : "Select charopt",
+ tpl : '<div class=\"x-grid-cell-text x-btn button\"><b>{charopt_value}</b> </div>',
+ loadingText : "Searching...",
+ items : [
+
+ ]
+
}
]
+
},
- {
- xtype: 'Row',
- xns: Roo.form,
+ {
+ '|xns' : 'Roo.form',
+ xtype : 'Row',
+ xns : Roo.form,
width : 500,
items : [
- {
- xtype: 'Checkbox',
- xns: Roo.form,
+ {
+ '|xns' : 'Roo.form',
fieldLabel : 'Active',
inputValue : true,
- name : 'cust_active',
+ xtype : 'Checkbox',
valueOff : 0,
- width : 100
+ width : 100,
+ xns : Roo.form,
+ name : 'cust_active'
},
- {
- xtype: 'Row',
- xns: Roo.form,
+ {
+ '|xns' : 'Roo.form',
labelAlign : 'right',
+ xtype : 'Row',
labelWidth : 50,
+ xns : Roo.form,
items : [
- {
- xtype: 'ComboBox',
- xns: Roo.form,
- allowBlank : false,
- displayField : 'custtype_descrip',
- editable : false,
- emptyText : "Select Type",
- fieldLabel : 'Type',
- forceSelection : true,
- hiddenName : 'cust_custtype_id',
- listWidth : 400,
- loadingText : "Searching...",
- minChars : 2,
- name : 'cust_custtype_id_custtype_descrip',
- pageSize : 20,
- qtip : "Select custtype",
- queryParam : 'q[cust_descript]',
- selectOnFocus : true,
- tpl : '<div class="x-grid-cell-text x-btn button"><b>{custtype_code}</b> {custtype_descrip}</div>',
- triggerAction : 'all',
- typeAhead : true,
- valueField : 'custtype_id',
- width : 160,
+ {
store : {
- xtype: 'Store',
- xns: Roo.data,
- remoteSort : true,
- sortInfo : { direction : 'ASC', field: 'id' },
- listeners : {
- beforeload : function (_self, o){
- o.params = o.params || {};
- // set more here
- }
- },
proxy : {
- xtype: 'HttpProxy',
- xns: Roo.data,
+ '|xns' : 'Roo.data',
+ url : baseURL + '/Roo/custtype.php',
method : 'GET',
- url : baseURL + '/Roo/custtype.php'
+ xtype : 'HttpProxy',
+ xns : Roo.data
},
reader : {
- xtype: 'JsonReader',
- xns: Roo.data,
+ '|xns' : 'Roo.data',
id : 'id',
root : 'data',
- totalProperty : 'total',
- fields : [{"name":"id","type":"int"},{"name":"custtype_code","type":"string"}]
- }
- }
+ xtype : 'JsonReader',
+ xns : Roo.data,
+ fields : [{"name":"id","type":"int"},{"name":"custtype_code","type":"string"}],
+ totalProperty : 'total'
+ },
+ '|xns' : 'Roo.data',
+ xtype : 'Store',
+ remoteSort : true,
+ xns : Roo.data,
+ sortInfo : { direction : 'ASC', field: 'id' },
+ listeners : {
+ beforeload : function (_self, o){
+ o.params = o.params || {};
+ // set more here
+ }
+ },
+ items : [
+
+ ]
+
+ },
+ '|xns' : 'Roo.form',
+ listWidth : 400,
+ triggerAction : 'all',
+ fieldLabel : 'Type',
+ forceSelection : true,
+ selectOnFocus : true,
+ pageSize : 20,
+ displayField : 'custtype_descrip',
+ emptyText : "Select Type",
+ hiddenName : 'cust_custtype_id',
+ minChars : 2,
+ valueField : 'custtype_id',
+ xtype : 'ComboBox',
+ allowBlank : false,
+ typeAhead : true,
+ editable : false,
+ width : 160,
+ xns : Roo.form,
+ name : 'cust_custtype_id_custtype_descrip',
+ qtip : "Select custtype",
+ queryParam : 'q[cust_descript]',
+ tpl : '<div class=\"x-grid-cell-text x-btn button\"><b>{custtype_code}</b> {custtype_descrip}</div>',
+ loadingText : "Searching...",
+ items : [
+
+ ]
+
}
]
+
}
]
+
},
- {
- xtype: 'TextField',
- xns: Roo.form,
+ {
+ '|xns' : 'Roo.form',
fieldLabel : 'AU POST #',
- name : 'cust_char_au_post_accno',
- width : 150
- },
- {
- xtype: 'ComboBox',
- xns: Roo.form,
- allowBlank : true,
- displayField : 'charopt_value',
- editable : false,
- emptyText : "",
- fieldLabel : 'Forecast Type',
- forceSelection : true,
- hiddenName : 'cust_char_salesforecast',
- listWidth : 250,
- loadingText : "Searching...",
- minChars : 2,
- name : 'cust_char_salesforecast',
- pageSize : 20,
- qtip : "Select charopt",
- selectOnFocus : true,
- tpl : '<div class="x-grid-cell-text x-btn button"><b>{charopt_value}</b> </div>',
- triggerAction : 'all',
- typeAhead : true,
- valueField : 'charopt_value',
+ xtype : 'TextField',
width : 150,
+ xns : Roo.form,
+ name : 'cust_char_au_post_accno'
+ },
+ {
store : {
- xtype: 'Store',
- xns: Roo.data,
- listeners : {
- beforeload : function (_self, o){
- o.params = o.params || {};
- // set more here
- o.params.charopt_char_id_char_name = 'SALESFORECAST';
-
- }
- },
- remoteSort : true,
- sortInfo : { direction : 'ASC', field: 'id' },
proxy : {
- xtype: 'HttpProxy',
- xns: Roo.data,
+ '|xns' : 'Roo.data',
+ url : baseURL + '/Roo/charopt.php',
method : 'GET',
- url : baseURL + '/Roo/charopt.php'
+ xtype : 'HttpProxy',
+ xns : Roo.data
},
reader : {
- xtype: 'JsonReader',
- xns: Roo.data,
+ '|xns' : 'Roo.data',
id : 'id',
root : 'data',
- totalProperty : 'total',
- fields : [{"name":"id","type":"int"},{"name":"charopt_value","type":"string"}]
- }
- }
+ xtype : 'JsonReader',
+ xns : Roo.data,
+ fields : [{"name":"id","type":"int"},{"name":"charopt_value","type":"string"}],
+ totalProperty : 'total'
+ },
+ '|xns' : 'Roo.data',
+ xtype : 'Store',
+ remoteSort : true,
+ sortInfo : { direction : 'ASC', field: 'id' },
+ xns : Roo.data,
+ listeners : {
+ beforeload : function (_self, o){
+ o.params = o.params || {};
+ // set more here
+ o.params.charopt_char_id_char_name = 'SALESFORECAST';
+
+ }
+ },
+ items : [
+
+ ]
+
+ },
+ '|xns' : 'Roo.form',
+ listWidth : 250,
+ triggerAction : 'all',
+ fieldLabel : 'Forecast Type',
+ forceSelection : true,
+ selectOnFocus : true,
+ pageSize : 20,
+ displayField : 'charopt_value',
+ emptyText : "",
+ hiddenName : 'cust_char_salesforecast',
+ minChars : 2,
+ valueField : 'charopt_value',
+ xtype : 'ComboBox',
+ allowBlank : true,
+ typeAhead : true,
+ editable : false,
+ width : 150,
+ xns : Roo.form,
+ name : 'cust_char_salesforecast',
+ qtip : "Select charopt",
+ tpl : '<div class=\"x-grid-cell-text x-btn button\"><b>{charopt_value}</b> </div>',
+ loadingText : "Searching...",
+ items : [
+
+ ]
+
},
- {
- xtype: 'TextArea',
- xns: Roo.form,
+ {
+ '|xns' : 'Roo.form',
fieldLabel : 'Comments',
- height : 50,
+ xtype : 'TextArea',
+ width : 300,
+ xns : Roo.form,
name : 'cust_comments',
- width : 300
+ height : 50
},
- {
- xtype: 'ComboBox',
- xns: Roo.form,
- allowBlank : false,
- displayField : 'curr_symbol',
- editable : false,
- emptyText : "Select curr_symbol",
- fieldLabel : 'Currency',
- forceSelection : true,
- hiddenName : 'cust_curr_id',
- listWidth : 400,
- loadingText : "Searching...",
- minChars : 2,
- name : 'cust_curr_id_curr_symbol',
- pageSize : 20,
- qtip : "Select curr_symbol",
- queryParam : 'query[curr_symbol]',
- selectOnFocus : true,
- tpl : '<div class="x-grid-cell-text x-btn button"><b>{curr_symbol}</b> </div>',
- triggerAction : 'all',
- typeAhead : true,
- valueField : 'curr_id',
- width : 100,
+ {
store : {
- xtype: 'Store',
- xns: Roo.data,
- listeners : {
- beforeload : function (_self, o){
- o.params = o.params || {};
- // set more here
- }
- },
- remoteSort : true,
- sortInfo : { direction : 'ASC', field: 'curr_symbol' },
proxy : {
- xtype: 'HttpProxy',
- xns: Roo.data,
+ '|xns' : 'Roo.data',
+ url : baseURL + '/Roo/curr_symbol.php',
method : 'GET',
- url : baseURL + '/Roo/curr_symbol.php'
+ xtype : 'HttpProxy',
+ xns : Roo.data
},
reader : {
- xtype: 'JsonReader',
- xns: Roo.data,
+ '|xns' : 'Roo.data',
id : 'curr_id',
root : 'data',
- totalProperty : 'total',
- fields : [{"name":"curr_id","type":"int"},"curr_symbol"]
- }
- }
- },
- {
- xtype: 'ComboBox',
- xns: Roo.form,
- allowBlank : false,
- editable : false,
- emptyText : "Select taxzone",
- forceSelection : true,
+ xtype : 'JsonReader',
+ xns : Roo.data,
+ fields : [{"name":"curr_id","type":"int"},"curr_symbol"],
+ totalProperty : 'total'
+ },
+ '|xns' : 'Roo.data',
+ xtype : 'Store',
+ remoteSort : true,
+ sortInfo : { direction : 'ASC', field: 'curr_symbol' },
+ xns : Roo.data,
+ listeners : {
+ beforeload : function (_self, o){
+ o.params = o.params || {};
+ // set more here
+ }
+ },
+ items : [
+
+ ]
+
+ },
+ '|xns' : 'Roo.form',
listWidth : 400,
- loadingText : "Searching...",
- minChars : 2,
- pageSize : 20,
- qtip : "Select taxzone",
- selectOnFocus : true,
triggerAction : 'all',
+ fieldLabel : 'Currency',
+ forceSelection : true,
+ selectOnFocus : true,
+ pageSize : 20,
+ displayField : 'curr_symbol',
+ emptyText : "Select curr_symbol",
+ hiddenName : 'cust_curr_id',
+ minChars : 2,
+ valueField : 'curr_id',
+ xtype : 'ComboBox',
+ allowBlank : false,
typeAhead : true,
- width : 300,
- tpl : '<div class="x-grid-cell-text x-btn button"><b>{taxzone_descrip}</b> </div>',
- queryParam : 'query[taxzone_descrip]',
+ editable : false,
+ width : 100,
+ xns : Roo.form,
+ name : 'cust_curr_id_curr_symbol',
+ qtip : "Select curr_symbol",
+ queryParam : 'query[curr_symbol]',
+ tpl : '<div class=\"x-grid-cell-text x-btn button\"><b>{curr_symbol}</b> </div>',
+ loadingText : "Searching...",
+ items : [
+
+ ]
+
+ },
+ {
+ store : {
+ proxy : {
+ '|xns' : 'Roo.data',
+ url : baseURL + '/Roo/taxzone.php',
+ method : 'GET',
+ xtype : 'HttpProxy',
+ xns : Roo.data
+ },
+ reader : {
+ '|xns' : 'Roo.data',
+ id : 'taxzone_id',
+ root : 'data',
+ xtype : 'JsonReader',
+ xns : Roo.data,
+ fields : [{"name":"taxzone_id","type":"int"},"taxzone_descrip"],
+ totalProperty : 'total'
+ },
+ '|xns' : 'Roo.data',
+ xtype : 'Store',
+ remoteSort : true,
+ sortInfo : { direction : 'ASC', field: 'taxzone_descrip' },
+ xns : Roo.data,
+ listeners : {
+ beforeload : function (_self, o){
+ o.params = o.params || {};
+ // set more here
+ }
+ },
+ items : [
+
+ ]
+
+ },
+ '|xns' : 'Roo.form',
+ listWidth : 400,
+ triggerAction : 'all',
+ forceSelection : true,
+ selectOnFocus : true,
fieldLabel : 'Tax Zone',
+ pageSize : 20,
+ xtype : 'ComboBox',
+ emptyText : "Select taxzone",
+ minChars : 2,
valueField : 'taxzone_id',
displayField : 'taxzone_descrip',
hiddenName : 'cust_taxzone_id',
+ allowBlank : false,
+ typeAhead : true,
+ editable : false,
+ xns : Roo.form,
+ width : 300,
+ qtip : "Select taxzone",
+ tpl : '<div class=\"x-grid-cell-text x-btn button\"><b>{taxzone_descrip}</b> </div>',
+ queryParam : 'query[taxzone_descrip]',
name : 'cust_taxzone_id_taxzone_descrip',
+ loadingText : "Searching...",
+ items : [
+
+ ]
+
+ },
+ {
store : {
- xtype: 'Store',
- xns: Roo.data,
- sortInfo : { direction : 'ASC', field: 'taxzone_descrip' },
- remoteSort : true,
- listeners : {
- beforeload : function (_self, o){
- o.params = o.params || {};
- // set more here
- }
- },
proxy : {
- xtype: 'HttpProxy',
- xns: Roo.data,
+ '|xns' : 'Roo.data',
+ url : baseURL + '/Roo/salesrep.php',
method : 'GET',
- url : baseURL + '/Roo/taxzone.php'
+ xtype : 'HttpProxy',
+ xns : Roo.data
},
reader : {
- xtype: 'JsonReader',
- xns: Roo.data,
- id : 'taxzone_id',
+ '|xns' : 'Roo.data',
+ id : 'salesrep_id',
root : 'data',
- totalProperty : 'total',
- fields : [{"name":"taxzone_id","type":"int"},"taxzone_descrip"]
- }
- }
- },
- {
- xtype: 'ComboBox',
- xns: Roo.form,
- allowBlank : false,
- editable : false,
- emptyText : "Select salesrep",
- forceSelection : true,
+ xtype : 'JsonReader',
+ xns : Roo.data,
+ fields : [{"name":"salesrep_id","type":"int"},"salesrep_name"],
+ totalProperty : 'total'
+ },
+ '|xns' : 'Roo.data',
+ xtype : 'Store',
+ remoteSort : true,
+ sortInfo : { direction : 'ASC', field: 'salesrep_name' },
+ xns : Roo.data,
+ listeners : {
+ beforeload : function (_self, o){
+ o.params = o.params || {};
+ // set more here
+ }
+ },
+ items : [
+
+ ]
+
+ },
+ '|xns' : 'Roo.form',
listWidth : 400,
- loadingText : "Searching...",
- minChars : 2,
- pageSize : 20,
- qtip : "Select salesrep",
- selectOnFocus : true,
triggerAction : 'all',
- typeAhead : true,
- width : 300,
- tpl : '<div class="x-grid-cell-text x-btn button"><b>{salesrep_name}</b> </div>',
- queryParam : 'query[salesrep_name]',
+ forceSelection : true,
+ selectOnFocus : true,
fieldLabel : 'Sales Rep',
+ pageSize : 20,
+ xtype : 'ComboBox',
+ emptyText : "Select salesrep",
+ minChars : 2,
valueField : 'salesrep_id',
displayField : 'salesrep_name',
hiddenName : 'cust_salesrep_id',
+ allowBlank : false,
+ typeAhead : true,
+ editable : false,
+ xns : Roo.form,
+ width : 300,
+ qtip : "Select salesrep",
+ tpl : '<div class=\"x-grid-cell-text x-btn button\"><b>{salesrep_name}</b> </div>',
+ queryParam : 'query[salesrep_name]',
name : 'cust_salesrep_id_salesrep_name',
+ loadingText : "Searching...",
+ items : [
+
+ ]
+
+ },
+ {
store : {
- xtype: 'Store',
- xns: Roo.data,
- sortInfo : { direction : 'ASC', field: 'salesrep_name' },
- remoteSort : true,
- listeners : {
- beforeload : function (_self, o){
- o.params = o.params || {};
- // set more here
- }
- },
proxy : {
- xtype: 'HttpProxy',
- xns: Roo.data,
+ '|xns' : 'Roo.data',
+ url : baseURL + '/Roo/ipshead.php',
method : 'GET',
- url : baseURL + '/Roo/salesrep.php'
+ xtype : 'HttpProxy',
+ xns : Roo.data
},
reader : {
- xtype: 'JsonReader',
- xns: Roo.data,
- id : 'salesrep_id',
+ '|xns' : 'Roo.data',
+ id : 'id',
root : 'data',
- totalProperty : 'total',
- fields : [{"name":"salesrep_id","type":"int"},"salesrep_name"]
- }
- }
- },
- {
- xtype: 'ComboBox',
- xns: Roo.form,
- allowBlank : true,
+ xtype : 'JsonReader',
+ xns : Roo.data,
+ fields : [{"name":"id","type":"int"},{"name":"ipshead_name","type":"string"}],
+ totalProperty : 'total'
+ },
+ '|xns' : 'Roo.data',
+ xtype : 'Store',
+ remoteSort : true,
+ sortInfo : { direction : 'ASC', field: 'ipshead_id_name' },
+ xns : Roo.data,
+ listeners : {
+ beforeload : function (_self, o){
+ o.params = o.params || {};
+ o.params.ipshead_curr_id = _this.form.findField('cust_curr_id').getValue();
+ // set more here
+ }
+ },
+ items : [
+
+ ]
+
+ },
+ '|xns' : 'Roo.form',
alwaysQuery : true,
- displayField : 'ipshead_name',
- editable : false,
- emptyText : "Select price level",
+ listWidth : 400,
+ triggerAction : 'all',
fieldLabel : 'Price Level',
forceSelection : true,
+ selectOnFocus : true,
+ pageSize : 50,
+ displayField : 'ipshead_name',
+ emptyText : "Select price level",
hiddenName : 'ipshead_id',
- listWidth : 400,
- loadingText : "Searching...",
minChars : 2,
+ valueField : 'ipshead_id',
+ xtype : 'ComboBox',
+ allowBlank : true,
+ typeAhead : true,
+ editable : false,
+ width : 300,
+ xns : Roo.form,
name : 'ipshead_id_name',
- pageSize : 50,
qtip : "Select ipshead",
queryParam : 'q',
- selectOnFocus : true,
- tpl : '<div class="x-grid-cell-text x-btn button"><b>{ipshead_name}</b> </div>',
- triggerAction : 'all',
- typeAhead : true,
- valueField : 'ipshead_id',
- width : 300,
- store : {
- xtype: 'Store',
- xns: Roo.data,
- listeners : {
- beforeload : function (_self, o){
- o.params = o.params || {};
- o.params.ipshead_curr_id = _this.form.findField('cust_curr_id').getValue();
- // set more here
- }
- },
- remoteSort : true,
- sortInfo : { direction : 'ASC', field: 'ipshead_id_name' },
- proxy : {
- xtype: 'HttpProxy',
- xns: Roo.data,
- method : 'GET',
- url : baseURL + '/Roo/ipshead.php'
- },
- reader : {
- xtype: 'JsonReader',
- xns: Roo.data,
- id : 'id',
- root : 'data',
- totalProperty : 'total',
- fields : [{"name":"id","type":"int"},{"name":"ipshead_name","type":"string"}]
- }
- }
+ tpl : '<div class=\"x-grid-cell-text x-btn button\"><b>{ipshead_name}</b> </div>',
+ loadingText : "Searching...",
+ items : [
+
+ ]
+
}
]
+
},
- {
- xtype: 'FieldSet',
- xns: Roo.form,
+ {
+ '|xns' : 'Roo.form',
+ xtype : 'FieldSet',
legend : "Financial",
style : 'width:420px',
+ xns : Roo.form,
items : [
- {
- xtype: 'ComboBox',
- xns: Roo.form,
- allowBlank : false,
- editable : false,
- emptyText : "Select terms",
- forceSelection : true,
- listWidth : 400,
- loadingText : "Searching...",
- minChars : 2,
- pageSize : 20,
- qtip : "Select terms",
- selectOnFocus : true,
- triggerAction : 'all',
- typeAhead : true,
- width : 300,
- tpl : '<div class="x-grid-cell-text x-btn button"><b>{terms_descrip}</b> </div>',
- queryParam : 'query[terms_descrip]',
- fieldLabel : 'Terms',
- valueField : 'terms_id',
- displayField : 'terms_descrip',
- hiddenName : 'cust_terms_id',
- name : 'cust_terms_id_terms_descrip',
+ {
store : {
- xtype: 'Store',
- xns: Roo.data,
- listeners : {
- beforeload : function (_self, o){
- o.params = o.params || {};
- // set more here
- }
- },
- remoteSort : true,
- sortInfo : { direction : 'ASC', field: 'terms_descrip' },
proxy : {
- xtype: 'HttpProxy',
- xns: Roo.data,
+ '|xns' : 'Roo.data',
+ url : baseURL + '/Roo/terms.php',
method : 'GET',
- url : baseURL + '/Roo/terms.php'
+ xtype : 'HttpProxy',
+ xns : Roo.data
},
reader : {
- xtype: 'JsonReader',
- xns: Roo.data,
+ '|xns' : 'Roo.data',
id : 'terms_id',
root : 'data',
- totalProperty : 'total',
- fields : [{"name":"terms_id","type":"int"},"terms_descrip"]
- }
- }
+ xtype : 'JsonReader',
+ xns : Roo.data,
+ fields : [{"name":"terms_id","type":"int"},"terms_descrip"],
+ totalProperty : 'total'
+ },
+ '|xns' : 'Roo.data',
+ xtype : 'Store',
+ remoteSort : true,
+ sortInfo : { direction : 'ASC', field: 'terms_descrip' },
+ xns : Roo.data,
+ listeners : {
+ beforeload : function (_self, o){
+ o.params = o.params || {};
+ // set more here
+ }
+ },
+ items : [
+
+ ]
+
+ },
+ '|xns' : 'Roo.form',
+ listWidth : 400,
+ triggerAction : 'all',
+ forceSelection : true,
+ selectOnFocus : true,
+ fieldLabel : 'Terms',
+ pageSize : 20,
+ xtype : 'ComboBox',
+ emptyText : "Select terms",
+ minChars : 2,
+ valueField : 'terms_id',
+ displayField : 'terms_descrip',
+ hiddenName : 'cust_terms_id',
+ allowBlank : false,
+ typeAhead : true,
+ editable : false,
+ xns : Roo.form,
+ width : 300,
+ qtip : "Select terms",
+ tpl : '<div class=\"x-grid-cell-text x-btn button\"><b>{terms_descrip}</b> </div>',
+ queryParam : 'query[terms_descrip]',
+ name : 'cust_terms_id_terms_descrip',
+ loadingText : "Searching...",
+ items : [
+
+ ]
+
},
- {
- xtype: 'NumberField',
- xns: Roo.form,
+ {
+ '|xns' : 'Roo.form',
fieldLabel : 'Credit Limit',
- name : 'cust_creditlmt',
+ align : 'right',
+ xtype : 'NumberField',
+ xns : Roo.form,
width : 100,
- align : 'right'
+ name : 'cust_creditlmt'
}
]
+
},
- {
- xtype: 'FieldSet',
- xns: Roo.form,
+ {
+ '|xns' : 'Roo.form',
+ xtype : 'FieldSet',
legend : "Shipping",
style : 'width:420px',
+ xns : Roo.form,
items : [
- {
- xtype: 'ComboBox',
- xns: Roo.form,
- allowBlank : false,
- editable : false,
- emptyText : "Select shipform",
- forceSelection : true,
- listWidth : 400,
- loadingText : "Searching...",
- minChars : 2,
- pageSize : 20,
- qtip : "Select shipform",
- selectOnFocus : true,
- triggerAction : 'all',
- typeAhead : true,
- width : 300,
- tpl : '<div class="x-grid-cell-text x-btn button"><b>{shipform_name}</b> </div>',
- queryParam : 'query[shipform_name]',
- fieldLabel : 'Shipment Form',
- valueField : 'shipform_id',
- displayField : 'shipform_name',
- hiddenName : 'cust_shipform_id',
- name : 'cust_shipform_id_shipform_name',
+ {
store : {
- xtype: 'Store',
- xns: Roo.data,
- listeners : {
- beforeload : function (_self, o){
- o.params = o.params || {};
- // set more here
- }
- },
- remoteSort : true,
- sortInfo : { direction : 'ASC', field: 'shipform_name' },
proxy : {
- xtype: 'HttpProxy',
- xns: Roo.data,
+ '|xns' : 'Roo.data',
+ url : baseURL + '/Roo/shipform.php',
method : 'GET',
- url : baseURL + '/Roo/shipform.php'
+ xtype : 'HttpProxy',
+ xns : Roo.data
},
reader : {
- xtype: 'JsonReader',
- xns: Roo.data,
+ '|xns' : 'Roo.data',
id : 'shipform_id',
root : 'data',
- totalProperty : 'total',
- fields : [{"name":"shipform_id","type":"int"},"shipform_name"]
- }
- }
+ xtype : 'JsonReader',
+ xns : Roo.data,
+ fields : [{"name":"shipform_id","type":"int"},"shipform_name"],
+ totalProperty : 'total'
+ },
+ '|xns' : 'Roo.data',
+ xtype : 'Store',
+ remoteSort : true,
+ sortInfo : { direction : 'ASC', field: 'shipform_name' },
+ xns : Roo.data,
+ listeners : {
+ beforeload : function (_self, o){
+ o.params = o.params || {};
+ // set more here
+ }
+ },
+ items : [
+
+ ]
+
+ },
+ '|xns' : 'Roo.form',
+ listWidth : 400,
+ triggerAction : 'all',
+ forceSelection : true,
+ selectOnFocus : true,
+ fieldLabel : 'Shipment Form',
+ pageSize : 20,
+ xtype : 'ComboBox',
+ emptyText : "Select shipform",
+ minChars : 2,
+ valueField : 'shipform_id',
+ displayField : 'shipform_name',
+ hiddenName : 'cust_shipform_id',
+ allowBlank : false,
+ typeAhead : true,
+ editable : false,
+ xns : Roo.form,
+ width : 300,
+ qtip : "Select shipform",
+ tpl : '<div class=\"x-grid-cell-text x-btn button\"><b>{shipform_name}</b> </div>',
+ queryParam : 'query[shipform_name]',
+ name : 'cust_shipform_id_shipform_name',
+ loadingText : "Searching...",
+ items : [
+
+ ]
+
},
- {
- xtype: 'TextField',
- xns: Roo.form,
+ {
+ '|xns' : 'Roo.form',
fieldLabel : 'Ship Via',
- name : 'cust_shipvia',
- width : 300
+ xtype : 'TextField',
+ xns : Roo.form,
+ width : 300,
+ name : 'cust_shipvia'
}
]
+
},
- {
- xtype: 'FieldSet',
- xns: Roo.form,
+ {
+ '|xns' : 'Roo.form',
+ xtype : 'FieldSet',
legend : "Reference",
style : 'width:420px',
+ xns : Roo.form,
items : [
- {
- xtype: 'TextField',
- xns: Roo.form,
+ {
+ '|xns' : 'Roo.form',
fieldLabel : 'Date Added',
format : 'Y-m-d',
- name : 'cust_dateadded',
+ xtype : 'TextField',
readOnly : true,
- width : 100
+ width : 100,
+ xns : Roo.form,
+ name : 'cust_dateadded'
}
]
+
},
- {
- xtype: 'Hidden',
- xns: Roo.form,
- name : 'cust_cntct_id'
- },
- {
- xtype: 'Hidden',
- xns: Roo.form,
- name : 'cust_creditlmt_curr_id'
- },
- {
- xtype: 'Hidden',
- xns: Roo.form,
- name : 'shiplist',
- update : function() {
- var ship = [];
- _this.grid.ds.each(function(r) {
- if (r.data.is_ship * 1) {
- ship.push(r.data.cntct_id);
- }
- });
- this.setValue(ship.join(','));
- }
- },
- {
- xtype: 'Hidden',
- xns: Roo.form,
- name : 'cust_id'
- }
- ]
- }
- ]
- },
- {
- xtype: 'GridPanel',
- xns: Roo,
- listeners : {
- activate : function() {
- _this.panel = this;
- if (_this.grid) {
- _this.grid.ds.load({});
- }
- }
- },
- background : false,
- fitContainer : true,
- fitToframe : true,
- region : 'east',
- tableName : 'cntct',
- title : "cntct",
- grid : {
- xtype: 'Grid',
- xns: Roo.grid,
- listeners : {
- render : function()
- {
- _this.grid = this;
-
- if (_this.panel.active) {
- this.ds.load({});
- }
- },
- rowdblclick : function (_self, rowIndex, e)
- {
-
- var d =this.getDataSource().getAt(rowIndex).data;
- Pman.Dialog.XtupleContact.show(
- {
- cntct_id : d.cntct_id ,
- customer_id : _this.form.findField('cust_id').getValue()
- } , function() {
- _this.grid.ds.load({});
- });
- },
- cellclick : function (_self, rowIndex, columnIndex, e)
- {
-
- if (columnIndex > 1 ) {
- return;
- }
- var d = this.ds.getAt(rowIndex);
- var f = this.cm.getDataIndex(columnIndex);
-
- // toggle it..
-
- d.set(f, d.data[f] * 1 ? 0 : 1);
-
-
- if (f == 'is_main' && d.data[f] > 0 ) { // removed..
- // set new main contact - remove old..
- var cc = _this.form.findField('cust_cntct_id');
- var old = cc.getValue() * 1;
- if (old > 1) {
- this.ds.each(function(r) {
- if (r.data.cntct_id == old) {
- r.set('is_main', 0);
- }
- });
- }
- cc.setValue(d.data.cntct_id);
- }
- // sort out shipping.
- _this.form.findField('shiplist').update();
-
-
- }
- },
- autoExpandColumn : 'cntct_addr_id_addr_line1',
- loadMask : true,
- dataSource : {
- xtype: 'Store',
- xns: Roo.data,
- listeners : {
- beforeload : function (_self, options)
- {
- options.params = options.params || {};
- options.params.limit = 99;
- options.params._customer_id = _this.form.findField('cust_id').getValue() * 1;
- if (options.params._customer_id < 1) {
- this.removeAll();
- _this.grid.view.el.mask("Save first");
- return false;
- }
- options.params._add_is_types = 1;
- _this.grid.view.el.unmask();
- },
- load : function (_self, records, options)
- {
- var cc = _this.form.findField('cust_cntct_id');
- var old = cc.getValue() * 1;
- if (old > 1) {
- Roo.each(records,function(r) {
- if (r.data.cntct_id == old) {
- r.set('is_main',1);
+ {
+ '|xns' : 'Roo.form',
+ xtype : 'Hidden',
+ xns : Roo.form,
+ name : 'cust_cntct_id'
+ },
+ {
+ '|xns' : 'Roo.form',
+ xtype : 'Hidden',
+ xns : Roo.form,
+ name : 'cust_creditlmt_curr_id'
+ },
+ {
+ '|xns' : 'Roo.form',
+ update : function() {
+ var ship = [];
+ _this.grid.ds.each(function(r) {
+ if (r.data.is_ship * 1) {
+ ship.push(r.data.cntct_id);
}
});
- }
- (function() {
- _this.form.findField('shiplist').update();
- }).defer(50);
+ this.setValue(ship.join(','));
+ },
+ xtype : 'Hidden',
+ xns : Roo.form,
+ name : 'shiplist'
+ },
+ {
+ '|xns' : 'Roo.form',
+ xtype : 'Hidden',
+ xns : Roo.form,
+ name : 'cust_id'
}
- },
- remoteSort : true,
- sortInfo : { field : 'cntct_name', direction: 'ASC' },
+ ]
+
+ }
+ ]
+
+ },
+ {
+ grid : {
+ dataSource : {
proxy : {
- xtype: 'HttpProxy',
- xns: Roo.data,
+ '|xns' : 'Roo.data',
+ url : baseURL + '/Roo/cntct.php',
method : 'GET',
- url : baseURL + '/Roo/cntct.php'
+ xtype : 'HttpProxy',
+ xns : Roo.data
},
reader : {
- xtype: 'JsonReader',
- xns: Roo.data,
- totalProperty : 'total',
- root : 'data',
+ '|xns' : 'Roo.data',
id : 'id',
+ root : 'data',
+ xtype : 'JsonReader',
+ xns : Roo.data,
fields : [
{
'name': 'cntct_addr_id_addr_line1',
'name': 'cntct_name',
'type': 'string'
}
- ]
- }
+ ],
+ totalProperty : 'total',
+ builderCfg : '{\"cols\":[{\"table\":\"addr\",\"column\":\"cntct_addr_id_addr_line1\",\"columnshort\":\"addr_line1\",\"ctype\":\"text\",\"desc\":\"\",\"use\":1,\"use_ex\":1,\"title\":\"\"},{\"table\":\"addr\",\"column\":\"cntct_addr_id_addr_line2\",\"columnshort\":\"addr_line2\",\"ctype\":\"text\",\"desc\":\"\",\"use\":1,\"use_ex\":\"\",\"title\":\"\"},{\"table\":\"addr\",\"column\":\"cntct_addr_id_addr_line3\",\"columnshort\":\"addr_line3\",\"ctype\":\"text\",\"desc\":\"\",\"use\":1,\"use_ex\":\"\",\"title\":\"\"},{\"table\":\"addr\",\"column\":\"cntct_addr_id_addr_country\",\"columnshort\":\"addr_country\",\"ctype\":\"text\",\"desc\":\"\",\"use\":1,\"use_ex\":\"\",\"title\":\"\"},{\"table\":\"cntct\",\"column\":\"cntct_phone\",\"columnshort\":\"cntct_phone\",\"ctype\":\"text\",\"desc\":\"\",\"use\":1,\"use_ex\":\"\",\"title\":\"\"},{\"table\":\"cntct\",\"column\":\"cntct_phone2\",\"columnshort\":\"cntct_phone2\",\"ctype\":\"text\",\"desc\":\"\",\"use\":1,\"use_ex\":\"\",\"title\":\"\"},{\"table\":\"cntct\",\"column\":\"cntct_name\",\"columnshort\":\"cntct_name\",\"ctype\":\"text\",\"desc\":\"\",\"use\":1,\"use_ex\":\"\",\"title\":\"\"}],\"cols_ex\":[\"cntct_addr_id_addr_line1\"],\"table\":\"cntct\",\"xtype\":\"GridPanel\",\"|xns\":\"Roo\"}'
+ },
+ '|xns' : 'Roo.data',
+ xtype : 'Store',
+ remoteSort : true,
+ sortInfo : { field : 'cntct_name', direction: 'ASC' },
+ xns : Roo.data,
+ listeners : {
+ beforeload : function (_self, options)
+ {
+ options.params = options.params || {};
+ options.params.limit = 99;
+ options.params._customer_id = _this.form.findField('cust_id').getValue() * 1;
+ if (options.params._customer_id < 1) {
+ this.removeAll();
+ _this.grid.view.el.mask("Save first");
+ return false;
+ }
+ options.params._add_is_types = 1;
+ _this.grid.view.el.unmask();
+ },
+ load : function (_self, records, options)
+ {
+ var cc = _this.form.findField('cust_cntct_id');
+ var old = cc.getValue() * 1;
+ if (old > 1) {
+ Roo.each(records,function(r) {
+ if (r.data.cntct_id == old) {
+ r.set('is_main',1);
+ }
+ });
+ }
+ (function() {
+ _this.form.findField('shiplist').update();
+ }).defer(50);
+ }
+ },
+ items : [
+
+ ]
+
},
sm : {
- xtype: 'RowSelectionModel',
- xns: Roo.grid,
- singleSelect : true
+ '|xns' : 'Roo.grid',
+ xtype : 'RowSelectionModel',
+ singleSelect : true,
+ xns : Roo.grid
},
toolbar : {
- xtype: 'Toolbar',
- xns: Roo,
+ '|xns' : 'Roo',
+ xtype : 'Toolbar',
+ xns : Roo,
items : [
- {
- xtype: 'Fill',
- xns: Roo.Toolbar
+ {
+ '|xns' : 'Roo.Toolbar',
+ xtype : 'Fill',
+ xns : Roo.Toolbar
},
- {
- xtype: 'Button',
- xns: Roo.Toolbar,
- listeners : {
- click : function()
- {
-
-
- Pman.Dialog.XtupleQuickContact.show(
- {
- _id : 0,
- customer_id : _this.form.findField('cust_id').getValue()
- },
-
- function (data) {
- _this.grid.ds.load({});
- }
- );
-
-
- }
- },
- cls : 'x-btn-text-icon',
+ {
+ '|xns' : 'Roo.Toolbar',
text : "Add",
- icon : Roo.rootURL + 'images/default/dd/drop-add.gif'
- },
- {
- xtype: 'Button',
- xns: Roo.Toolbar,
- listeners : {
- click : function()
- {
- // will this work?
- var sel = _this.grid.sm.getSelected();
- if (!sel || !sel.data.cntct_id) {
- Roo.MessageBox.alert("Error", "Select a contact to delete");
- return;
- }
- new Pman.Request({
- url : baseURL + '/Roo/cntct',
- method : 'POST',
- params : {
- _delete : sel.data.cntct_id
- },
- success : function()
- {
- _this.grid.ds.load({});
- }
- });
-
-
-
- }
- },
+ xtype : 'Button',
cls : 'x-btn-text-icon',
+ icon : Roo.rootURL + 'images/default/dd/drop-add.gif',
+ xns : Roo.Toolbar,
+ listeners : {
+ click : function()
+ {
+
+
+ Pman.Dialog.XtupleQuickContact.show(
+ {
+ _id : 0,
+ customer_id : _this.form.findField('cust_id').getValue()
+ },
+
+ function (data) {
+ _this.grid.ds.load({});
+ }
+ );
+
+
+ }
+ }
+ },
+ {
+ '|xns' : 'Roo.Toolbar',
text : "Delete",
- icon : rootURL + '/Pman/templates/images/trash.gif'
+ xtype : 'Button',
+ cls : 'x-btn-text-icon',
+ icon : rootURL + '/Pman/templates/images/trash.gif',
+ xns : Roo.Toolbar,
+ listeners : {
+ click : function()
+ {
+ // will this work?
+ var sel = _this.grid.sm.getSelected();
+ if (!sel || !sel.data.cntct_id) {
+ Roo.MessageBox.alert("Error", "Select a contact to delete");
+ return;
+ }
+ new Pman.Request({
+ url : baseURL + '/Roo/cntct',
+ method : 'POST',
+ params : {
+ _delete : sel.data.cntct_id
+ },
+ success : function()
+ {
+ _this.grid.ds.load({});
+ }
+ });
+
+
+
+ }
+ }
}
]
+
},
+ '|xns' : 'Roo.grid',
+ autoExpandColumn : 'cntct_addr_id_addr_line1',
+ xtype : 'Grid',
+ loadMask : true,
+ xns : Roo.grid,
+ builderCfg : '{\"cols\":[{\"table\":\"addr\",\"column\":\"cntct_addr_id_addr_line1\",\"columnshort\":\"addr_line1\",\"ctype\":\"text\",\"desc\":\"\",\"use\":1,\"use_ex\":1,\"title\":\"\"},{\"table\":\"addr\",\"column\":\"cntct_addr_id_addr_line2\",\"columnshort\":\"addr_line2\",\"ctype\":\"text\",\"desc\":\"\",\"use\":1,\"use_ex\":\"\",\"title\":\"\"},{\"table\":\"addr\",\"column\":\"cntct_addr_id_addr_line3\",\"columnshort\":\"addr_line3\",\"ctype\":\"text\",\"desc\":\"\",\"use\":1,\"use_ex\":\"\",\"title\":\"\"},{\"table\":\"addr\",\"column\":\"cntct_addr_id_addr_country\",\"columnshort\":\"addr_country\",\"ctype\":\"text\",\"desc\":\"\",\"use\":1,\"use_ex\":\"\",\"title\":\"\"},{\"table\":\"cntct\",\"column\":\"cntct_phone\",\"columnshort\":\"cntct_phone\",\"ctype\":\"text\",\"desc\":\"\",\"use\":1,\"use_ex\":\"\",\"title\":\"\"},{\"table\":\"cntct\",\"column\":\"cntct_phone2\",\"columnshort\":\"cntct_phone2\",\"ctype\":\"text\",\"desc\":\"\",\"use\":1,\"use_ex\":\"\",\"title\":\"\"},{\"table\":\"cntct\",\"column\":\"cntct_name\",\"columnshort\":\"cntct_name\",\"ctype\":\"text\",\"desc\":\"\",\"use\":1,\"use_ex\":\"\",\"title\":\"\"}],\"cols_ex\":[\"cntct_addr_id_addr_line1\"],\"table\":\"cntct\",\"xtype\":\"GridPanel\",\"|xns\":\"Roo\"}',
colModel : [
- {
- xtype: 'ColumnModel',
- xns: Roo.grid,
- dataIndex : 'is_main',
- header : 'Main',
- width : 30,
- renderer : function(v,x,r) {
-
- return '<img class="x-grid-check-icon' +
- (v*1 ? '-checked' : '') + '" src="' + Roo.BLANK_IMAGE_URL + '"/>';
-
-
- }
- },
- {
- xtype: 'ColumnModel',
- xns: Roo.grid,
- dataIndex : 'is_ship',
- header : 'Ship',
- width : 30,
- renderer : function(v,x,r) {
-
- // simple view of address:
- return '<img class="x-grid-check-icon' +
- (v*1 ? '-checked' : '') + '" src="' + Roo.BLANK_IMAGE_URL + '"/>';
-
-
-
-
- }
- },
- {
- xtype: 'ColumnModel',
- xns: Roo.grid,
- dataIndex : 'cntct_addr_id_addr_line1',
- header : 'Contact / Address',
- width : 200,
- renderer : function(v,x,r) {
-
- // simple view of address:
-
- var add = [];
- Roo.each([ 'line1', 'line2', 'line3', 'city', 'state', 'country'], function (k) {
- if (!r.data['cntct_addr_id_addr_' + k].length) {
- return;
- }
- add.push(String.format("{0}", r.data['cntct_addr_id_addr_' + k]));
-
- });
-
- return String.format(
- 'Name: <B>{0}</B><br/>' +
- 'Phone: <B>{1}</B> / Mobile: <B>{2}</B><br/>' +
- 'Email: <a href="mailto:{3}">{3}</a>' +
- (add.length ? '<BR/>' : '') + '<B>' + add.join('<BR/>') + '</B>',
-
- r.data.cntct_name,
- r.data.cntct_phone,
- r.data.cntct_phone2,
-
- r.data.cntct_email
- );
-
-
- }
- }
+ {
+ '|xns' : 'Roo.grid',
+ xtype : 'ColumnModel',
+ header : 'Main',
+ width : 30,
+ renderer : function(v,x,r) {
+
+ return '<img class="x-grid-check-icon' +
+ (v*1 ? '-checked' : '') + '" src="' + Roo.BLANK_IMAGE_URL + '"/>';
+
+
+ },
+ xns : Roo.grid,
+ dataIndex : 'is_main'
+ },
+{
+ '|xns' : 'Roo.grid',
+ xtype : 'ColumnModel',
+ header : 'Ship',
+ width : 30,
+ renderer : function(v,x,r) {
+
+ // simple view of address:
+ return '<img class="x-grid-check-icon' +
+ (v*1 ? '-checked' : '') + '" src="' + Roo.BLANK_IMAGE_URL + '"/>';
+
+
+
+
+ },
+ xns : Roo.grid,
+ dataIndex : 'is_ship'
+ },
+{
+ '|xns' : 'Roo.grid',
+ xtype : 'ColumnModel',
+ header : 'Contact / Address',
+ width : 200,
+ renderer : function(v,x,r) {
+
+ // simple view of address:
+
+ var add = [];
+ Roo.each([ 'line1', 'line2', 'line3', 'city', 'state', 'country'], function (k) {
+ if (!r.data['cntct_addr_id_addr_' + k].length) {
+ return;
+ }
+ add.push(String.format("{0}", r.data['cntct_addr_id_addr_' + k]));
+
+ });
+
+ return String.format(
+ 'Name: <B>{0}</B><br/>' +
+ 'Phone: <B>{1}</B> / Mobile: <B>{2}</B><br/>' +
+ 'Email: <a href="mailto:{3}">{3}</a>' +
+ (add.length ? '<BR/>' : '') + '<B>' + add.join('<BR/>') + '</B>',
+
+ r.data.cntct_name,
+ r.data.cntct_phone,
+ r.data.cntct_phone2,
+
+ r.data.cntct_email
+ );
+
+
+ },
+ xns : Roo.grid,
+ dataIndex : 'cntct_addr_id_addr_line1'
+ }
+ ],
+ listeners : {
+ rowdblclick : function (_self, rowIndex, e)
+ {
+
+ var d =this.getDataSource().getAt(rowIndex).data;
+ Pman.Dialog.XtupleContact.show(
+ {
+ cntct_id : d.cntct_id ,
+ customer_id : _this.form.findField('cust_id').getValue()
+ } , function() {
+ _this.grid.ds.load({});
+ });
+ },
+ cellclick : function (_self, rowIndex, columnIndex, e)
+ {
+
+ if (columnIndex > 1 ) {
+ return;
+ }
+ var d = this.ds.getAt(rowIndex);
+ var f = this.cm.getDataIndex(columnIndex);
+
+ // toggle it..
+
+ d.set(f, d.data[f] * 1 ? 0 : 1);
+
+
+ if (f == 'is_main' && d.data[f] > 0 ) { // removed..
+ // set new main contact - remove old..
+ var cc = _this.form.findField('cust_cntct_id');
+ var old = cc.getValue() * 1;
+ if (old > 1) {
+ this.ds.each(function(r) {
+ if (r.data.cntct_id == old) {
+ r.set('is_main', 0);
+ }
+ });
+ }
+ cc.setValue(d.data.cntct_id);
+ }
+ // sort out shipping.
+ _this.form.findField('shiplist').update();
+
+
+ },
+ render : function()
+ {
+ _this.grid = this;
+
+ if (_this.panel.active) {
+ this.ds.load({});
+ }
+ }
+ },
+ items : [
+
]
- }
- }
- ],
- center : {
- xtype: 'LayoutRegion',
- xns: Roo
- },
- east : {
- xtype: 'LayoutRegion',
- xns: Roo,
- width : 300
- }
- }
- },
- {
- xtype: 'GridPanel',
- xns: Roo,
- listeners : {
- activate : function() {
- _this.hpanel = this;
- if (_this.hgrid) {
- _this.hgrid.footer.onClick('first');
+
+ },
+ '|xns' : 'Roo',
+ background : false,
+ fitToframe : true,
+ region : 'east',
+ title : "cntct",
+ xtype : 'GridPanel',
+ fitContainer : true,
+ xns : Roo,
+ builderCfg : '{\"cols\":[{\"table\":\"addr\",\"column\":\"cntct_addr_id_addr_line1\",\"columnshort\":\"addr_line1\",\"ctype\":\"text\",\"desc\":\"\",\"use\":1,\"use_ex\":1,\"title\":\"\"},{\"table\":\"addr\",\"column\":\"cntct_addr_id_addr_line2\",\"columnshort\":\"addr_line2\",\"ctype\":\"text\",\"desc\":\"\",\"use\":1,\"use_ex\":\"\",\"title\":\"\"},{\"table\":\"addr\",\"column\":\"cntct_addr_id_addr_line3\",\"columnshort\":\"addr_line3\",\"ctype\":\"text\",\"desc\":\"\",\"use\":1,\"use_ex\":\"\",\"title\":\"\"},{\"table\":\"addr\",\"column\":\"cntct_addr_id_addr_country\",\"columnshort\":\"addr_country\",\"ctype\":\"text\",\"desc\":\"\",\"use\":1,\"use_ex\":\"\",\"title\":\"\"},{\"table\":\"cntct\",\"column\":\"cntct_phone\",\"columnshort\":\"cntct_phone\",\"ctype\":\"text\",\"desc\":\"\",\"use\":1,\"use_ex\":\"\",\"title\":\"\"},{\"table\":\"cntct\",\"column\":\"cntct_phone2\",\"columnshort\":\"cntct_phone2\",\"ctype\":\"text\",\"desc\":\"\",\"use\":1,\"use_ex\":\"\",\"title\":\"\"},{\"table\":\"cntct\",\"column\":\"cntct_name\",\"columnshort\":\"cntct_name\",\"ctype\":\"text\",\"desc\":\"\",\"use\":1,\"use_ex\":\"\",\"title\":\"\"}],\"cols_ex\":[\"cntct_addr_id_addr_line1\"],\"table\":\"cntct\",\"xtype\":\"GridPanel\",\"|xns\":\"Roo\"}',
+ tableName : 'cntct',
+ listeners : {
+ activate : function() {
+ _this.panel = this;
+ if (_this.grid) {
+ _this.grid.ds.load({});
+ }
+ }
+ },
+ items : [
+
+ ]
+
}
- }
+ ]
+
},
- background : true,
- fitContainer : true,
- fitToframe : true,
+ '|xns' : 'Roo',
+ background : false,
region : 'center',
- tableName : 'cohist',
- title : "History",
+ title : "Details",
+ xtype : 'NestedLayoutPanel',
+ xns : Roo,
+ items : [
+
+ ]
+
+ },
+ {
grid : {
- xtype: 'Grid',
- xns: Roo.grid,
- listeners : {
- render : function()
- {
- _this.hgrid = this;
- //_this.dialog = Pman.Dialog.FILL_IN
- if (_this.hpanel.active) {
- this.footer.onClick('first');
- }
- },
- rowdblclick : function (_self, rowIndex, e)
- {
- if (!_this.dialog) return;
- _this.dialog.show( this.getDataSource().getAt(rowIndex), function() {
- _this.grid.footer.onClick('first');
- });
- }
- },
- autoExpandColumn : 'item_descrip1',
- loadMask : true,
dataSource : {
- xtype: 'Store',
- xns: Roo.data,
- listeners : {
- beforeload : function (_self, o)
- {
-
-
- Roo.apply(o.params, {
- _group : 'salesHistory',
- _name : 'detail',
- 'cust_id:number' : _this.form.findField('cust_id').getValue(),
- 'credit:text' : 'credit',
- 'return:text' : 'return',
- 'includeFormatted:int' : 1,
- 'startDate:text' : _this.dateFrom.getValue(),
- 'endDate:text' : _this.dateTo.getValue()
- });
-
-
-
- },
- load : function (_self, records, options)
- {
- function setText(str) {
-
- _this.hgrid.footer.el.select('.sales-footer-text',
- true).first().dom.innerHTML = str;
- }
-
-
- if (!records.length) {
- //_this.footertext.setText('');
- Roo.log("no records");
- setText('');
- return;
- }
- new Pman.Request({
- method : 'GET',
- url : baseURL + '/Roo/cohist',
- params : {
- _sums : 1,
-
- cust_id : _this.form.findField('cust_id').getValue(),
- startDate : _this.dateFrom.getValue(),
- endDate : _this.dateTo.getValue()
- },
- success : function(res)
- {
- setText("Total Orders : " + parseInt(res.data[0].total_orders) +
- " Total Shipped : " + parseInt(res.data[0].total_shipped) +
- " Total Value: " + res.data[0].total_basecurr + " " +
- Roo.util.Format.number(res.data[0].total_value,2)
- );
- }
- });
-
-
- }
- },
- remoteSort : true,
- sortInfo : { field : 'cohist_shipvia', direction: 'ASC' },
proxy : {
- xtype: 'HttpProxy',
- xns: Roo.data,
+ '|xns' : 'Roo.data',
+ url : baseURL + '/Roo/metasql.php',
+ xtype : 'HttpProxy',
method : 'GET',
- url : baseURL + '/Roo/metasql.php'
+ xns : Roo.data
},
reader : {
- xtype: 'JsonReader',
- xns: Roo.data,
- totalProperty : 'total',
- root : 'data',
+ '|xns' : 'Roo.data',
id : 'id',
+ root : 'data',
+ xtype : 'JsonReader',
+ xns : Roo.data,
fields : [
{
'name': 'cohist_id',
'name': 'cohist_taxtype_id_taxtype_sys',
'type': 'int'
}
- ]
- }
+ ],
+ totalProperty : 'total'
+ },
+ '|xns' : 'Roo.data',
+ xtype : 'Store',
+ remoteSort : true,
+ sortInfo : { field : 'cohist_shipvia', direction: 'ASC' },
+ xns : Roo.data,
+ listeners : {
+ beforeload : function (_self, o)
+ {
+
+
+ Roo.apply(o.params, {
+ _group : 'salesHistory',
+ _name : 'detail',
+ 'cust_id:number' : _this.form.findField('cust_id').getValue(),
+ 'credit:text' : 'credit',
+ 'return:text' : 'return',
+ 'includeFormatted:int' : 1,
+ 'startDate:text' : _this.dateFrom.getValue(),
+ 'endDate:text' : _this.dateTo.getValue()
+ });
+
+
+
+ },
+ load : function (_self, records, options)
+ {
+ function setText(str) {
+
+ _this.hgrid.footer.el.select('.sales-footer-text',
+ true).first().dom.innerHTML = str;
+ }
+
+
+ if (!records.length) {
+ //_this.footertext.setText('');
+ Roo.log("no records");
+ setText('');
+ return;
+ }
+ new Pman.Request({
+ method : 'GET',
+ url : baseURL + '/Roo/cohist',
+ params : {
+ _sums : 1,
+
+ cust_id : _this.form.findField('cust_id').getValue(),
+ startDate : _this.dateFrom.getValue(),
+ endDate : _this.dateTo.getValue()
+ },
+ success : function(res)
+ {
+ setText("Total Orders : " + parseInt(res.data[0].total_orders) +
+ " Total Shipped : " + parseInt(res.data[0].total_shipped) +
+ " Total Value: " + res.data[0].total_basecurr + " " +
+ Roo.util.Format.number(res.data[0].total_value,2)
+ );
+ }
+ });
+
+
+ }
+ },
+ items : [
+
+ ]
+
},
footer : {
- xtype: 'PagingToolbar',
- xns: Roo,
- displayInfo : true,
- displayMsg : "Displaying Sales {0} - {1} of {2}",
- emptyMsg : "No cohist found",
+ '|xns' : 'Roo',
pageSize : 25,
+ xtype : 'PagingToolbar',
+ emptyMsg : "No cohist found",
+ xns : Roo,
+ displayMsg : "Displaying Sales {0} - {1} of {2}",
+ displayInfo : true,
items : [
- {
- xtype: 'TextItem',
- xns: Roo.Toolbar,
- text : "<span class=\"sales-footer-text\"></span>"
+ {
+ '|xns' : 'Roo.Toolbar',
+ text : "<span class=\"sales-footer-text\"></span>",
+ xtype : 'TextItem',
+ xns : Roo.Toolbar
}
]
+
},
toolbar : {
- xtype: 'Toolbar',
- xns: Roo,
+ '|xns' : 'Roo',
+ xtype : 'Toolbar',
+ xns : Roo,
items : [
- {
- xtype: 'TextItem',
- xns: Roo.Toolbar,
- text : "From"
+ {
+ '|xns' : 'Roo.Toolbar',
+ text : "From",
+ xtype : 'TextItem',
+ xns : Roo.Toolbar
},
- {
- xtype: 'DateField',
- xns: Roo.form,
- listeners : {
- render : function (_self)
- {
- _this.dateFrom = _self;
- }
- },
+ {
+ '|xns' : 'Roo.form',
format : 'd/M/Y',
+ xtype : 'DateField',
useIso : true,
- value : (function() {return (new Date()).add(Date.MONTH, -3); })()
+ value : (function() {return (new Date()).add(Date.MONTH, -3); })(),
+ xns : Roo.form,
+ listeners : {
+ render : function (_self)
+ {
+ _this.dateFrom = _self;
+ }
+ }
},
- {
- xtype: 'TextItem',
- xns: Roo.Toolbar,
- text : "To"
+ {
+ '|xns' : 'Roo.Toolbar',
+ text : "To",
+ xtype : 'TextItem',
+ xns : Roo.Toolbar
},
- {
- xtype: 'DateField',
- xns: Roo.form,
- listeners : {
- render : function (_self)
- {
- _this.dateTo = _self;
- }
- },
+ {
+ '|xns' : 'Roo.form',
format : 'd/M/Y',
+ xtype : 'DateField',
useIso : true,
- value : (function() {return (new Date()) })()
+ value : (function() {return (new Date()) })(),
+ xns : Roo.form,
+ listeners : {
+ render : function (_self)
+ {
+ _this.dateTo = _self;
+ }
+ }
},
- {
- xtype: 'Button',
- xns: Roo.Toolbar,
+ {
+ '|xns' : 'Roo.Toolbar',
+ text : "Refresh",
+ xtype : 'Button',
+ xns : Roo.Toolbar,
listeners : {
- click : function (_self, e)
- {
- _this.hgrid.footer.onClick('first');
- }
- },
- text : "Refresh"
+ click : function (_self, e)
+ {
+ _this.hgrid.footer.onClick('first');
+ }
+ }
},
- {
- xtype: 'Fill',
- xns: Roo.Toolbar
+ {
+ '|xns' : 'Roo.Toolbar',
+ xtype : 'Fill',
+ xns : Roo.Toolbar
},
- {
- xtype: 'Button',
- xns: Roo.Toolbar,
+ {
+ '|xns' : 'Roo.Toolbar',
+ text : "Download",
+ xtype : 'Button',
+ xns : Roo.Toolbar,
listeners : {
- click : function (_self, e)
- {
- new Pman.Download({
- grid : _this.hgrid
- });
- }
- },
- text : "Download"
+ click : function (_self, e)
+ {
+ new Pman.Download({
+ grid : _this.hgrid
+ });
+ }
+ }
}
]
+
},
+ '|xns' : 'Roo.grid',
+ autoExpandColumn : 'item_descrip1',
+ xtype : 'Grid',
+ loadMask : true,
+ xns : Roo.grid,
colModel : [
- {
- xtype: 'ColumnModel',
- xns: Roo.grid,
- dataIndex : 'cust_name',
- header : 'Customer',
- width : 75,
- renderer : function(v) { return String.format('{0}', v); }
- },
- {
- xtype: 'ColumnModel',
- xns: Roo.grid,
- dataIndex : 'cohist_ordernumber',
- header : 'Order',
- width : 75,
- renderer : function(v) { return String.format('{0}', v); }
- },
- {
- xtype: 'ColumnModel',
- xns: Roo.grid,
- dataIndex : 'invmonth',
- header : 'Invoice Month',
- width : 75,
- renderer : function(v) {
-
- return String.format('{0}',v);
- }
- },
- {
- xtype: 'ColumnModel',
- xns: Roo.grid,
- dataIndex : 'cohead_orderdate',
- header : 'Invoice date',
- width : 75,
- renderer : function(v) {
- var d = Date.parseDate(v, 'Y-m-d');
- return String.format('{0}', d ? d.format('d/M/Y') : '');
- }
- },
- {
- xtype: 'ColumnModel',
- xns: Roo.grid,
- dataIndex : 'cohist_invcdate',
- header : 'Invoice date',
- width : 75,
- renderer : function(v) {
- var d = Date.parseDate(v, 'Y-m-d');
- return String.format('{0}', d ? d.format('d/M/Y') : '');
- }
- },
- {
- xtype: 'ColumnModel',
- xns: Roo.grid,
- dataIndex : 'cohist_invcnumber',
- header : 'Invoice#',
- width : 75,
- renderer : function(v) { return String.format('{0}', v); }
- },
- {
- xtype: 'ColumnModel',
- xns: Roo.grid,
- dataIndex : 'item_number',
- header : 'Item No.',
- width : 75,
- renderer : function(v) { return String.format('{0}', v ? v : ''); }
- },
- {
- xtype: 'ColumnModel',
- xns: Roo.grid,
- dataIndex : 'item_descrip1',
- header : 'Description',
- width : 200,
- renderer : function(v) { return String.format('{0}', v); }
- },
- {
- xtype: 'ColumnModel',
- xns: Roo.grid,
- align : 'right',
- dataIndex : 'cohist_qtyshipped',
- header : 'Qty',
- width : 70,
- renderer : function(v) { return parseInt(v); }
- },
- {
- xtype: 'ColumnModel',
- xns: Roo.grid,
- dataIndex : 'currabbr',
- header : 'Currency',
- width : 75,
- renderer : function(v) { return String.format('{0}', v.split(/\s+/)[0]); }
- },
- {
- xtype: 'ColumnModel',
- xns: Roo.grid,
- align : 'right',
- dataIndex : 'cohist_unitprice',
- header : 'Unit Price',
- width : 75,
- renderer : function(v) { return Roo.util.Format.number( v, 2); }
- },
- {
- xtype: 'ColumnModel',
- xns: Roo.grid,
- align : 'right',
- dataIndex : 'extprice',
- header : 'Ext Cost',
- width : 75,
- renderer : function(v) { return Roo.util.Format.number( v, 2); }
- }
+ {
+ '|xns' : 'Roo.grid',
+ xtype : 'ColumnModel',
+ header : 'Customer',
+ width : 75,
+ renderer : function(v) { return String.format('{0}', v); },
+ xns : Roo.grid,
+ dataIndex : 'cust_name'
+ },
+{
+ '|xns' : 'Roo.grid',
+ xtype : 'ColumnModel',
+ header : 'Order',
+ width : 75,
+ renderer : function(v) { return String.format('{0}', v); },
+ xns : Roo.grid,
+ dataIndex : 'cohist_ordernumber'
+ },
+{
+ '|xns' : 'Roo.grid',
+ xtype : 'ColumnModel',
+ header : 'Invoice Month',
+ width : 75,
+ renderer : function(v) {
+
+ return String.format('{0}',v);
+ },
+ xns : Roo.grid,
+ dataIndex : 'invmonth'
+ },
+{
+ '|xns' : 'Roo.grid',
+ xtype : 'ColumnModel',
+ header : 'Invoice date',
+ width : 75,
+ renderer : function(v) {
+ var d = Date.parseDate(v, 'Y-m-d');
+ return String.format('{0}', d ? d.format('d/M/Y') : '');
+ },
+ xns : Roo.grid,
+ dataIndex : 'cohead_orderdate'
+ },
+{
+ '|xns' : 'Roo.grid',
+ xtype : 'ColumnModel',
+ header : 'Invoice date',
+ width : 75,
+ renderer : function(v) {
+ var d = Date.parseDate(v, 'Y-m-d');
+ return String.format('{0}', d ? d.format('d/M/Y') : '');
+ },
+ xns : Roo.grid,
+ dataIndex : 'cohist_invcdate'
+ },
+{
+ '|xns' : 'Roo.grid',
+ xtype : 'ColumnModel',
+ header : 'Invoice#',
+ width : 75,
+ renderer : function(v) { return String.format('{0}', v); },
+ xns : Roo.grid,
+ dataIndex : 'cohist_invcnumber'
+ },
+{
+ '|xns' : 'Roo.grid',
+ xtype : 'ColumnModel',
+ header : 'Item No.',
+ width : 75,
+ renderer : function(v) { return String.format('{0}', v ? v : ''); },
+ xns : Roo.grid,
+ dataIndex : 'item_number'
+ },
+{
+ '|xns' : 'Roo.grid',
+ xtype : 'ColumnModel',
+ header : 'Description',
+ width : 200,
+ renderer : function(v) { return String.format('{0}', v); },
+ xns : Roo.grid,
+ dataIndex : 'item_descrip1'
+ },
+{
+ '|xns' : 'Roo.grid',
+ align : 'right',
+ xtype : 'ColumnModel',
+ header : 'Qty',
+ width : 70,
+ renderer : function(v) { return parseInt(v); },
+ xns : Roo.grid,
+ dataIndex : 'cohist_qtyshipped'
+ },
+{
+ '|xns' : 'Roo.grid',
+ xtype : 'ColumnModel',
+ header : 'Currency',
+ width : 75,
+ renderer : function(v) { return String.format('{0}', v.split(/\s+/)[0]); },
+ xns : Roo.grid,
+ dataIndex : 'currabbr'
+ },
+{
+ '|xns' : 'Roo.grid',
+ align : 'right',
+ xtype : 'ColumnModel',
+ header : 'Unit Price',
+ width : 75,
+ renderer : function(v) { return Roo.util.Format.number( v, 2); },
+ xns : Roo.grid,
+ dataIndex : 'cohist_unitprice'
+ },
+{
+ '|xns' : 'Roo.grid',
+ align : 'right',
+ xtype : 'ColumnModel',
+ header : 'Ext Cost',
+ width : 75,
+ renderer : function(v) { return Roo.util.Format.number( v, 2); },
+ xns : Roo.grid,
+ dataIndex : 'extprice'
+ }
+ ],
+ listeners : {
+ rowdblclick : function (_self, rowIndex, e)
+ {
+ if (!_this.dialog) return;
+ _this.dialog.show( this.getDataSource().getAt(rowIndex), function() {
+ _this.grid.footer.onClick('first');
+ });
+ },
+ render : function()
+ {
+ _this.hgrid = this;
+ //_this.dialog = Pman.Dialog.FILL_IN
+ if (_this.hpanel.active) {
+ this.footer.onClick('first');
+ }
+ }
+ },
+ items : [
+
]
- }
- }
- ],
- center : {
- xtype: 'LayoutRegion',
- xns: Roo,
- alwaysShowTabs : true,
- tabPosition : 'top',
- toolbar : {
- xtype: 'Toolbar',
- xns: Roo,
+
+ },
+ '|xns' : 'Roo',
+ fitToframe : true,
+ background : true,
+ region : 'center',
+ title : "History",
+ xtype : 'GridPanel',
+ fitContainer : true,
+ xns : Roo,
+ tableName : 'cohist',
+ listeners : {
+ activate : function() {
+ _this.hpanel = this;
+ if (_this.hgrid) {
+ _this.hgrid.footer.onClick('first');
+ }
+ }
+ },
items : [
- {
- xtype: 'Fill',
- xns: Roo.Toolbar
- },
- {
- xtype: 'Button',
- xns: Roo.Toolbar,
- listeners : {
- click : function (_self, e)
- {
- var cid = _this.form.findField('cust_id').getValue();
- if(!cid){
- Roo.Msg.alert('Error','please save the customer first');
- return;
+
+ ]
+
+ },
+ {
+ grid : {
+ dataSource : {
+ proxy : {
+ '|xns' : 'Roo.data',
+ url : baseURL + '/Roo/Images.php',
+ method : 'GET',
+ xtype : 'HttpProxy',
+ xns : Roo.data
+ },
+ reader : {
+ '|xns' : 'Roo.data',
+ id : 'id',
+ root : 'data',
+ xtype : 'JsonReader',
+ xns : Roo.data,
+ fields : [
+ {
+ 'name': 'id',
+ 'type': 'int'
+ },
+ {
+ 'name': 'filename',
+ 'type': 'string'
+ },
+ {
+ 'name': 'imgtype',
+ 'type': 'string'
+ },
+ {
+ 'name': 'created',
+ 'type': 'date',
+ 'dateFormat': 'Y-m-d H:i:s'
}
-
- Pman.Dialog.XtupleCustomerCode.show({cust_id : cid}, function(res){
- _this.form.reset();
- _this.form.fireEvent('actioncomplete', _this.form, { type: 'setdata', data: {cust_id : res.cust_id} });
-
- });
-
- }
+ ],
+ totalProperty : 'total'
},
- text : "Change Customer Code"
- }
- ]
- }
- },
- buttons : [
- {
- xtype: 'Button',
- xns: Roo,
- listeners : {
- click : function (_self, e)
- {
- _this.dialog.hide();
- }
+ '|xns' : 'Roo.data',
+ xtype : 'Store',
+ remoteSort : true,
+ sortInfo : { field : 'id', direction: 'ASC' },
+ xns : Roo.data,
+ listeners : {
+ beforeload : function (_self, o)
+ {
+ o.params = o.params || {}
+
+ var cust_id = _this.form.findField('cust_id').getValue() * 1;
+
+ if(cust_id < 1){
+ this.removeAll();
+ return false;
+ }
+
+ o.params.ontable = 'custinfo';
+ o.params.onid = cust_id;
+ }
+ },
+ items : [
+
+ ]
+
+ },
+ footer : {
+ '|xns' : 'Roo',
+ pageSize : 25,
+ xtype : 'PagingToolbar',
+ emptyMsg : "No Images found",
+ xns : Roo,
+ displayMsg : "Displaying Images {0} - {1} of {2}",
+ displayInfo : true
+ },
+ '|xns' : 'Roo.grid',
+ autoExpandColumn : 'imgtype',
+ xtype : 'Grid',
+ loadMask : true,
+ xns : Roo.grid,
+ cm : [
+ {
+ '|xns' : 'Roo.grid',
+ xtype : 'ColumnModel',
+ header : 'Image',
+ width : 100,
+ renderer : function(v,x,r) {
+ return String.format('<img src="{0}/Images/Thumb/100/{1}/{2}" height="50">', baseURL, v, r.data.filename);
+ },
+ xns : Roo.grid,
+ dataIndex : 'id'
+ },
+{
+ '|xns' : 'Roo.grid',
+ xtype : 'ColumnModel',
+ width : 150,
+ header : 'Date',
+ renderer : function(v) {
+ return String.format('{0}', v ? v.format('d/M/Y') : '');
+ },
+ xns : Roo.grid,
+ dataIndex : 'created'
+ },
+{
+ '|xns' : 'Roo.grid',
+ xtype : 'ColumnModel',
+ header : 'File Name',
+ width : 200,
+ renderer : function(v) { return String.format('{0}', v); },
+ xns : Roo.grid,
+ dataIndex : 'filename'
+ },
+{
+ '|xns' : 'Roo.grid',
+ xtype : 'ColumnModel',
+ header : 'Type',
+ width : 200,
+ renderer : function(v) {
+ return String.format('{0}',v);
+ },
+ xns : Roo.grid,
+ dataIndex : 'imgtype'
+ }
+ ],
+ listeners : {
+ rowdblclick : function (_self, rowIndex, e)
+ {
+ var s = _self.getDataSource().getAt(rowIndex);
+
+ new Pman.Download({
+ url : baseURL + '/Images/Download/' + s.data.id
+ });
+
+ },
+ render : function()
+ {
+ _this.igrid = this;
+
+ if (_this.ipanel.active) {
+ this.footer.onClick('first');
+ }
+ }
+ },
+ items : [
+
+ ]
+
},
- text : "Cancel"
- },
- {
- xtype: 'Button',
- xns: Roo,
+ '|xns' : 'Roo',
+ region : 'center',
+ fitToframe : true,
+ background : true,
+ title : "Images",
+ xtype : 'GridPanel',
+ fitContainer : true,
+ xns : Roo,
+ tableName : 'Images',
listeners : {
- click : function (_self, e)
- {
- // do some checks?
-
- var bg_comp = _this.form.findField('cust_char_internalcompany').getValue();
- var ctype = _this.form.findField('cust_custtype_id').el.dom.value;
- if (bg_comp.length && !ctype.match(/internal/i)) {
- Roo.MessageBox.alert("Error" ,
- "BG Company should only be set for internal companies"
- );
- return;
- }
-
-
-
-
-
-
-
- _this.form.doAction("submit");
-
- }
+ activate : function() {
+ _this.ipanel = this;
+ if (_this.igrid) {
+ _this.igrid.footer.onClick('first');
+ }
+ }
},
- text : "Save"
+ items : [
+
+ ]
+
}
]
+
});
}
};