Ext.namespace('Shipping'); Ext.ns("Zi.LAN"); Shipping.DsQuery = function (config) { Ext.applyIf(this, config); this.initUIComponents(); Shipping.DsQuery.superclass.constructor.call(this); }; Ext.extend(Shipping.DsQuery, Ext.Window, { StoreList: null, formname: '', start: 0, limit: 100, condition: '', returnsql: null, _parentWin:null, initUIComponents: function () { // BEGIN OF CODE GENERATION PARTS, DON'T DELETE CODE BELOW var LANGUAGESStr = get_cookie("Lan"); if (LANGUAGESStr == 'English') { Zi.LAN.EQUAL = '='; Zi.LAN.NOTEQUAL = '<>'; Zi.LAN.LIKE = 'LIKE'; Zi.LAN.GREATER = '>='; Zi.LAN.LESSTHAN = '<='; Zi.LAN.AND = 'AND'; Zi.LAN.OR = 'OR'; Zi.LAN.displayField = 'FIELDENAME'; Zi.LAN.prompt='Prompt'; Zi.LAN.prompterro='Query conditions errors, please check.'; Zi.LAN.MoreQuery='More Query'; Zi.LAN.Query='Query'; Zi.LAN.Close='Close'; Zi.LAN.SaveQuery='Save Query'; } else { Zi.LAN.EQUAL = '等于'; Zi.LAN.NOTEQUAL = '不等于'; Zi.LAN.LIKE = '模糊'; Zi.LAN.GREATER = '大于'; Zi.LAN.LESSTHAN = '小于'; Zi.LAN.AND = '且'; Zi.LAN.OR = '或'; Zi.LAN.displayField = 'FIELDCNAME'; Zi.LAN.prompt='提示'; Zi.LAN.prompterro='查询条件赋值错误,请检查。'; Zi.LAN.MoreQuery='高级查询'; Zi.LAN.Query='查询'; Zi.LAN.Close='关闭'; Zi.LAN.SaveQuery='记忆查询条件'; } Ext.define('EditConditionModel', { extend: 'Ext.data.Model', fields: [ { name: 'Name', type: 'string' } ] }); this.dataEditCondition = [{ "Name": Zi.LAN.EQUAL }, { "Name": Zi.LAN.NOTEQUAL }, { "Name": Zi.LAN.LIKE}]; this.storeEditCondition = Ext.create('Ext.data.Store', { model: 'EditConditionModel', data: this.dataEditCondition }); Ext.define('DateConditionModel', { extend: 'Ext.data.Model', fields: [ { name: 'Name', type: 'string' } ] }); this.DateCondition = [{ "Name": Zi.LAN.EQUAL }, { "Name": Zi.LAN.NOTEQUAL }, { "Name": Zi.LAN.GREATER }, { "Name": Zi.LAN.LESSTHAN}]; this.storeDateCondition = Ext.create('Ext.data.Store', { model: 'DateConditionModel', data: this.DateCondition }); Ext.define('AndConditionModel', { extend: 'Ext.data.Model', fields: [ { name: 'Name', type: 'string' } ] }); Ext.define('DsQueryListModel', { extend: 'Ext.data.Model', fields: [ { name: 'NAME', type: 'string' }, { name: 'VALUE', type: 'string' } ] }); this.AndCondition = [{ "Name": Zi.LAN.AND }, { "Name": Zi.LAN.OR}]; this.storeAndCondition = Ext.create('Ext.data.Store', { model: 'AndConditionModel', data: this.AndCondition }); this.comboxANDCONDIT1 = Ext.create('DsExt.ux.RefTableCombox', { store: this.storeAndCondition, forceSelection: true, name: 'ANDCONDIT1', valueField: 'Name', displayField: 'Name', disabled: true, value: '' }); this.comboxANDCONDIT2 = Ext.create('DsExt.ux.RefTableCombox', { store: this.storeAndCondition, forceSelection: true, name: 'ANDCONDIT2', valueField: 'Name', displayField: 'Name', value: Zi.LAN.AND }); this.comboxANDCONDIT3 = Ext.create('DsExt.ux.RefTableCombox', { store: this.storeAndCondition, forceSelection: true, name: 'ANDCONDIT3', valueField: 'Name', displayField: 'Name', value: Zi.LAN.AND }); this.comboxANDCONDIT4 = Ext.create('DsExt.ux.RefTableCombox', { store: this.storeAndCondition, forceSelection: true, name: 'ANDCONDIT4', valueField: 'Name', displayField: 'Name', value: Zi.LAN.AND }); this.comboxANDCONDIT5 = Ext.create('DsExt.ux.RefTableCombox', { store: this.storeAndCondition, forceSelection: true, name: 'ANDCONDIT5', valueField: 'Name', displayField: 'Name', value: Zi.LAN.AND }); this.comboxANDCONDIT6 = Ext.create('DsExt.ux.RefTableCombox', { store: this.storeAndCondition, forceSelection: true, name: 'ANDCONDIT6', valueField: 'Name', displayField: 'Name', value: Zi.LAN.AND }); this.comboxCONDIT1 = Ext.create('DsExt.ux.RefTableCombox', { store: this.storeEditCondition, forceSelection: true, name: 'CONDIT1', valueField: 'Name', displayField: 'Name', value: Zi.LAN.LIKE }); this.comboxCONDIT2 = Ext.create('DsExt.ux.RefTableCombox', { store: this.storeEditCondition, forceSelection: true, name: 'CONDIT2', valueField: 'Name', displayField: 'Name', value: Zi.LAN.LIKE }); this.comboxCONDIT3 = Ext.create('DsExt.ux.RefTableCombox', { store: this.storeEditCondition, forceSelection: true, name: 'CONDIT3', valueField: 'Name', displayField: 'Name', value: Zi.LAN.LIKE }); this.comboxCONDIT4 = Ext.create('DsExt.ux.RefTableCombox', { store: this.storeEditCondition, forceSelection: true, name: 'CONDIT4', valueField: 'Name', displayField: 'Name', value: Zi.LAN.LIKE }); this.comboxCONDIT5 = Ext.create('DsExt.ux.RefTableCombox', { store: this.storeEditCondition, forceSelection: true, name: 'CONDIT5', valueField: 'Name', displayField: 'Name', value: Zi.LAN.EQUAL }); this.comboxCONDIT6 = Ext.create('DsExt.ux.RefTableCombox', { store: this.storeEditCondition, forceSelection: true, name: 'CONDIT6', valueField: 'Name', displayField: 'Name', value: Zi.LAN.EQUAL }); Ext.define('FieldQueryModel', { extend: 'Ext.data.Model', fields: [ { name: 'GID', type: 'string' }, { name: 'FORMNAME', type: 'string' }, { name: 'FIELDCNAME', type: 'string' }, { name: 'FIELDENAME', type: 'string' }, { name: 'FIELDTYPE', type: 'string' }, { name: 'FIELDNAME', type: 'string' }, { name: 'NESTEDSQL', type: 'string' } ] }); this.StoreFieldQuery = Ext.create('DsExt.ux.RefTableStore', { model: 'FieldQueryModel', proxy: { url: '/MvcShipping/MsBaseInfo/GetQueryFieldSetting' } }); _thisQuery = this; this.comboxQueryField1 = Ext.create('DsExt.ux.RefTableCombox', { store: this.StoreFieldQuery, // forceSelection: true, name: 'QUERYFIELD1', flex: 3, valueField: 'FIELDNAME', displayField: Zi.LAN.displayField, listeners: { scope: this, 'select': function (combo, records, eOpts) { if (records.length > 0) { this.formSearch.getForm().findField('NESTEDSQL1').setValue(records[0].data.NESTEDSQL); } }, 'change': function (comboa, newValue, oldValue, eOpts) { var Cargoinforecords = DsStoreQueryBy(this.StoreFieldQuery, Zi.LAN.displayField, comboa.rawValue); if (Cargoinforecords.getCount() > 0) { // this.formSearch.getForm().findField('NESTEDSQL1').setValue(Cargoinforecords.getAt(0).data.NESTEDSQL); this.formSearch.getForm().findField('FIELDTYPE1').setValue(Cargoinforecords.getAt(0).data.FIELDTYPE); if (Cargoinforecords.getAt(0).data.FIELDTYPE == "DATE") { this.formSearch.getForm().findField('STRFIELD1').setVisible(false); this.formSearch.getForm().findField('LISTFIELD1').setVisible(false); this.formSearch.getForm().findField('DATEFIELD1').setVisible(true); this.formSearch.getForm().findField('DATEFIELD1').format = 'Y-m-d'; this.formSearch.getForm().findField('DATEFIELD1').setValue(''); this.formSearch.getForm().findField('MONTHFIELD1').setVisible(false); this.formSearch.getForm().findField('DATETIMEFIELD1').setVisible(false); this.comboxCONDIT1.store = this.storeDateCondition; this.comboxCONDIT1.setValue(Zi.LAN.GREATER); }else if (Cargoinforecords.getAt(0).data.FIELDTYPE == "DATETIME") { this.formSearch.getForm().findField('STRFIELD1').setVisible(false); this.formSearch.getForm().findField('LISTFIELD1').setVisible(false); this.formSearch.getForm().findField('DATEFIELD1').setVisible(false); this.formSearch.getForm().findField('MONTHFIELD1').setVisible(false); this.formSearch.getForm().findField('DATETIMEFIELD1').setVisible(true); this.formSearch.getForm().findField('DATETIMEFIELD1').format = 'Y-m-d H:i:s'; this.formSearch.getForm().findField('DATETIMEFIELD1').setValue(''); this.comboxCONDIT1.store = this.storeDateCondition; this.comboxCONDIT1.setValue(Zi.LAN.GREATER); } else if (Cargoinforecords.getAt(0).data.FIELDTYPE == "ACCDATE") { this.formSearch.getForm().findField('STRFIELD1').setVisible(false); this.formSearch.getForm().findField('LISTFIELD1').setVisible(false); this.formSearch.getForm().findField('DATEFIELD1').setVisible(false); this.formSearch.getForm().findField('MONTHFIELD1').setVisible(true); this.formSearch.getForm().findField('DATETIMEFIELD1').setVisible(false); this.comboxCONDIT1.store = this.storeDateCondition; this.comboxCONDIT1.setValue(Zi.LAN.GREATER); } else if (Cargoinforecords.getAt(0).data.FIELDTYPE == "STR") { this.formSearch.getForm().findField('STRFIELD1').setVisible(true); this.formSearch.getForm().findField('LISTFIELD1').setVisible(false); this.formSearch.getForm().findField('DATEFIELD1').setVisible(false); this.formSearch.getForm().findField('MONTHFIELD1').setVisible(false); this.formSearch.getForm().findField('DATETIMEFIELD1').setVisible(false); this.comboxCONDIT1.store = this.storeEditCondition; this.comboxCONDIT1.setValue(Zi.LAN.LIKE); } else if (Cargoinforecords.getAt(0).data.FIELDTYPE == "NUM") { this.formSearch.getForm().findField('STRFIELD1').setVisible(true); this.formSearch.getForm().findField('LISTFIELD1').setVisible(false); this.formSearch.getForm().findField('DATEFIELD1').setVisible(false); this.formSearch.getForm().findField('MONTHFIELD1').setVisible(false); this.formSearch.getForm().findField('DATETIMEFIELD1').setVisible(false); this.comboxCONDIT1.store = this.storeDateCondition; this.comboxCONDIT1.setValue(Zi.LAN.EQUAL); } else { this.formSearch.getForm().findField('STRFIELD1').setVisible(false); this.formSearch.getForm().findField('LISTFIELD1').setVisible(true); this.formSearch.getForm().findField('DATEFIELD1').setVisible(false); this.formSearch.getForm().findField('MONTHFIELD1').setVisible(false); this.formSearch.getForm().findField('DATETIMEFIELD1').setVisible(false); this.storeListCode1.load({ params: { type: Cargoinforecords.getAt(0).data.FIELDTYPE} }); this.comboxCONDIT1.store = this.storeEditCondition; this.comboxCONDIT1.setValue(Zi.LAN.EQUAL); } } } } }); this.comboxQueryField2 = Ext.create('DsExt.ux.RefTableCombox', { store: this.StoreFieldQuery, // forceSelection: true, flex: 3, name: 'QUERYFIELD2', valueField: 'FIELDNAME', displayField: Zi.LAN.displayField, listeners: { scope: this, 'select': function (combo, records, eOpts) { if (records.length > 0) { this.formSearch.getForm().findField('NESTEDSQL2').setValue(records[0].data.NESTEDSQL); } }, 'change': function (comboa, newValue, oldValue, eOpts) { var Cargoinforecords = DsStoreQueryBy(this.StoreFieldQuery, Zi.LAN.displayField, comboa.rawValue); if (Cargoinforecords.getCount() > 0) { this.formSearch.getForm().findField('FIELDTYPE2').setValue(Cargoinforecords.getAt(0).data.FIELDTYPE); if (Cargoinforecords.getAt(0).data.FIELDTYPE == "DATE") { this.formSearch.getForm().findField('STRFIELD2').setVisible(false); this.formSearch.getForm().findField('LISTFIELD2').setVisible(false); this.formSearch.getForm().findField('MONTHFIELD2').setVisible(false); this.formSearch.getForm().findField('DATEFIELD2').setVisible(true); this.formSearch.getForm().findField('DATEFIELD2').format = 'Y-m-d'; this.formSearch.getForm().findField('DATEFIELD2').setValue(''); this.formSearch.getForm().findField('DATETIMEFIELD2').setVisible(false); this.comboxCONDIT2.store = this.storeDateCondition; this.comboxCONDIT2.setValue(Zi.LAN.GREATER); } else if (Cargoinforecords.getAt(0).data.FIELDTYPE == "DATETIME") { this.formSearch.getForm().findField('STRFIELD2').setVisible(false); this.formSearch.getForm().findField('LISTFIELD2').setVisible(false); this.formSearch.getForm().findField('MONTHFIELD2').setVisible(false); this.formSearch.getForm().findField('DATETIMEFIELD2').setVisible(true); this.formSearch.getForm().findField('DATETIMEFIELD2').format = 'Y-m-d H:i:s'; this.formSearch.getForm().findField('DATETIMEFIELD2').setValue(''); this.formSearch.getForm().findField('DATEFIELD2').setVisible(false); this.comboxCONDIT2.store = this.storeDateCondition; this.comboxCONDIT2.setValue(Zi.LAN.GREATER); } else if (Cargoinforecords.getAt(0).data.FIELDTYPE == "ACCDATE") { this.formSearch.getForm().findField('STRFIELD2').setVisible(false); this.formSearch.getForm().findField('LISTFIELD2').setVisible(false); this.formSearch.getForm().findField('DATEFIELD2').setVisible(false); this.formSearch.getForm().findField('MONTHFIELD2').setVisible(true); this.formSearch.getForm().findField('DATETIMEFIELD2').setVisible(false); this.comboxCONDIT2.store = this.storeDateCondition; this.comboxCONDIT2.setValue(Zi.LAN.LESSTHAN); } else if (Cargoinforecords.getAt(0).data.FIELDTYPE == "STR") { this.formSearch.getForm().findField('STRFIELD2').setVisible(true); this.formSearch.getForm().findField('LISTFIELD2').setVisible(false); this.formSearch.getForm().findField('DATEFIELD2').setVisible(false); this.formSearch.getForm().findField('MONTHFIELD2').setVisible(false); this.formSearch.getForm().findField('DATETIMEFIELD2').setVisible(false); this.comboxCONDIT2.store = this.storeEditCondition; this.comboxCONDIT2.setValue(Zi.LAN.LIKE); } else if (Cargoinforecords.getAt(0).data.FIELDTYPE == "NUM") { this.formSearch.getForm().findField('STRFIELD2').setVisible(true); this.formSearch.getForm().findField('LISTFIELD2').setVisible(false); this.formSearch.getForm().findField('DATEFIELD2').setVisible(false); this.formSearch.getForm().findField('MONTHFIELD2').setVisible(false); this.formSearch.getForm().findField('DATETIMEFIELD2').setVisible(false); this.comboxCONDIT2.store = this.storeDateCondition; this.comboxCONDIT2.setValue(Zi.LAN.LESSTHAN); } else { this.formSearch.getForm().findField('STRFIELD2').setVisible(false); this.formSearch.getForm().findField('LISTFIELD2').setVisible(true); this.formSearch.getForm().findField('DATEFIELD2').setVisible(false); this.formSearch.getForm().findField('MONTHFIELD2').setVisible(false); this.formSearch.getForm().findField('DATETIMEFIELD2').setVisible(false); this.storeListCode2.load({ params: { type: Cargoinforecords.getAt(0).data.FIELDTYPE} }); this.comboxCONDIT2.store = this.storeEditCondition; this.comboxCONDIT2.setValue(Zi.LAN.EQUAL); } } } } }); this.comboxQueryField3 = Ext.create('DsExt.ux.RefTableCombox', { store: this.StoreFieldQuery, // forceSelection: true, flex: 3, name: 'QUERYFIELD3', valueField: 'FIELDNAME', displayField: Zi.LAN.displayField, listeners: { scope: this, 'select': function (combo, records, eOpts) { if (records.length > 0) { this.formSearch.getForm().findField('NESTEDSQL3').setValue(records[0].data.NESTEDSQL); } }, 'change': function (comboa, newValue, oldValue, eOpts) { var Cargoinforecords = DsStoreQueryBy(this.StoreFieldQuery, Zi.LAN.displayField, comboa.rawValue); if (Cargoinforecords.getCount() > 0) { this.formSearch.getForm().findField('FIELDTYPE3').setValue(Cargoinforecords.getAt(0).data.FIELDTYPE); if (Cargoinforecords.getAt(0).data.FIELDTYPE == "DATE") { this.formSearch.getForm().findField('STRFIELD3').setVisible(false); this.formSearch.getForm().findField('LISTFIELD3').setVisible(false); this.formSearch.getForm().findField('DATEFIELD3').setVisible(true); this.formSearch.getForm().findField('MONTHFIELD3').setVisible(false); this.formSearch.getForm().findField('DATEFIELD3').format = 'Y-m-d'; this.formSearch.getForm().findField('DATEFIELD3').setValue(''); this.formSearch.getForm().findField('DATETIMEFIELD3').setVisible(false); this.comboxCONDIT3.store = this.storeDateCondition; this.comboxCONDIT3.setValue(Zi.LAN.GREATER); } else if (Cargoinforecords.getAt(0).data.FIELDTYPE == "DATETIME") { this.formSearch.getForm().findField('STRFIELD3').setVisible(false); this.formSearch.getForm().findField('LISTFIELD3').setVisible(false); this.formSearch.getForm().findField('DATEFIELD3').setVisible(false); this.formSearch.getForm().findField('MONTHFIELD3').setVisible(false); this.formSearch.getForm().findField('DATETIMEFIELD3').format = 'Y-m-d H:i:s'; this.formSearch.getForm().findField('DATETIMEFIELD3').setValue(''); this.formSearch.getForm().findField('DATETIMEFIELD3').setVisible(true); this.comboxCONDIT3.store = this.storeDateCondition; this.comboxCONDIT3.setValue(Zi.LAN.GREATER); }else if (Cargoinforecords.getAt(0).data.FIELDTYPE == "ACCDATE") { this.formSearch.getForm().findField('STRFIELD3').setVisible(false); this.formSearch.getForm().findField('LISTFIELD3').setVisible(false); this.formSearch.getForm().findField('DATEFIELD3').setVisible(false); this.formSearch.getForm().findField('MONTHFIELD3').setVisible(true); this.formSearch.getForm().findField('DATETIMEFIELD3').setVisible(false); this.comboxCONDIT3.store = this.storeDateCondition; this.comboxCONDIT3.setValue(Zi.LAN.LESSTHAN); } else if (Cargoinforecords.getAt(0).data.FIELDTYPE == "STR") { this.formSearch.getForm().findField('STRFIELD3').setVisible(true); this.formSearch.getForm().findField('LISTFIELD3').setVisible(false); this.formSearch.getForm().findField('DATEFIELD3').setVisible(false); this.formSearch.getForm().findField('MONTHFIELD3').setVisible(false); this.formSearch.getForm().findField('DATETIMEFIELD3').setVisible(false); this.comboxCONDIT3.store = this.storeEditCondition; this.comboxCONDIT3.setValue(Zi.LAN.LIKE); } else if (Cargoinforecords.getAt(0).data.FIELDTYPE == "NUM") { this.formSearch.getForm().findField('STRFIELD3').setVisible(true); this.formSearch.getForm().findField('LISTFIELD3').setVisible(false); this.formSearch.getForm().findField('DATEFIELD3').setVisible(false); this.formSearch.getForm().findField('MONTHFIELD3').setVisible(false); this.formSearch.getForm().findField('DATETIMEFIELD3').setVisible(false); this.comboxCONDIT3.store = this.storeDateCondition; this.comboxCONDIT3.setValue(Zi.LAN.EQUAL); } else { this.formSearch.getForm().findField('STRFIELD3').setVisible(false); this.formSearch.getForm().findField('LISTFIELD3').setVisible(true); this.formSearch.getForm().findField('DATEFIELD3').setVisible(false); this.formSearch.getForm().findField('MONTHFIELD3').setVisible(false); this.formSearch.getForm().findField('DATETIMEFIELD3').setVisible(false); this.storeListCode3.load({ params: { type: Cargoinforecords.getAt(0).data.FIELDTYPE} }); this.comboxCONDIT3.store = this.storeEditCondition; this.comboxCONDIT3.setValue(Zi.LAN.EQUAL); } } } } }); this.comboxQueryField4 = Ext.create('DsExt.ux.RefTableCombox', { store: this.StoreFieldQuery, // forceSelection: true, flex: 3, name: 'QUERYFIELD4', valueField: 'FIELDNAME', displayField: Zi.LAN.displayField, listeners: { scope: this, 'select': function (combo, records, eOpts) { if (records.length > 0) { this.formSearch.getForm().findField('NESTEDSQL4').setValue(records[0].data.NESTEDSQL); } }, 'change': function (comboa, newValue, oldValue, eOpts) { var Cargoinforecords = DsStoreQueryBy(this.StoreFieldQuery, Zi.LAN.displayField, comboa.rawValue); if (Cargoinforecords.getCount() > 0) { this.formSearch.getForm().findField('FIELDTYPE4').setValue(Cargoinforecords.getAt(0).data.FIELDTYPE); if (Cargoinforecords.getAt(0).data.FIELDTYPE == "DATE") { this.formSearch.getForm().findField('STRFIELD4').setVisible(false); this.formSearch.getForm().findField('LISTFIELD4').setVisible(false); this.formSearch.getForm().findField('DATEFIELD4').setVisible(true); this.formSearch.getForm().findField('MONTHFIELD4').setVisible(false); this.formSearch.getForm().findField('DATEFIELD4').format = 'Y-m-d'; this.formSearch.getForm().findField('DATEFIELD4').setValue(''); this.formSearch.getForm().findField('DATETIMEFIELD4').setVisible(false); this.comboxCONDIT4.store = this.storeDateCondition; this.comboxCONDIT4.setValue(Zi.LAN.GREATER); } else if (Cargoinforecords.getAt(0).data.FIELDTYPE == "DATETIME") { this.formSearch.getForm().findField('STRFIELD4').setVisible(false); this.formSearch.getForm().findField('LISTFIELD4').setVisible(false); this.formSearch.getForm().findField('DATEFIELD4').setVisible(false); this.formSearch.getForm().findField('MONTHFIELD4').setVisible(false); this.formSearch.getForm().findField('DATETIMEFIELD4').format = 'Y-m-d H:i:s'; this.formSearch.getForm().findField('DATETIMEFIELD4').setValue(''); this.formSearch.getForm().findField('DATETIMEFIELD4').setVisible(true); this.comboxCONDIT4.store = this.storeDateCondition; this.comboxCONDIT4.setValue(Zi.LAN.GREATER); }else if (Cargoinforecords.getAt(0).data.FIELDTYPE == "ACCDATE") { this.formSearch.getForm().findField('STRFIELD4').setVisible(false); this.formSearch.getForm().findField('LISTFIELD4').setVisible(false); this.formSearch.getForm().findField('DATEFIELD4').setVisible(false); this.formSearch.getForm().findField('MONTHFIELD4').setVisible(true); this.formSearch.getForm().findField('DATETIMEFIELD4').setVisible(false); this.comboxCONDIT4.store = this.storeDateCondition; this.comboxCONDIT4.setValue(Zi.LAN.LESSTHAN); } else if (Cargoinforecords.getAt(0).data.FIELDTYPE == "STR") { this.formSearch.getForm().findField('STRFIELD4').setVisible(true); this.formSearch.getForm().findField('LISTFIELD4').setVisible(false); this.formSearch.getForm().findField('DATEFIELD4').setVisible(false); this.formSearch.getForm().findField('MONTHFIELD4').setVisible(false); this.formSearch.getForm().findField('DATETIMEFIELD4').setVisible(false); this.comboxCONDIT4.store = this.storeEditCondition; this.comboxCONDIT4.setValue(Zi.LAN.LIKE); } else if (Cargoinforecords.getAt(0).data.FIELDTYPE == "NUM") { this.formSearch.getForm().findField('STRFIELD4').setVisible(true); this.formSearch.getForm().findField('LISTFIELD4').setVisible(false); this.formSearch.getForm().findField('DATEFIELD4').setVisible(false); this.formSearch.getForm().findField('MONTHFIELD4').setVisible(false); this.formSearch.getForm().findField('DATETIMEFIELD4').setVisible(false); this.comboxCONDIT4.store = this.storeDateCondition; this.comboxCONDIT4.setValue(Zi.LAN.EQUAL); } else { this.formSearch.getForm().findField('STRFIELD4').setVisible(false); this.formSearch.getForm().findField('LISTFIELD4').setVisible(true); this.formSearch.getForm().findField('DATEFIELD4').setVisible(false); this.formSearch.getForm().findField('DATETIMEFIELD4').setVisible(false); this.storeListCode4.load({ params: { type: Cargoinforecords.getAt(0).data.FIELDTYPE} }); this.comboxCONDIT4.store = this.storeEditCondition; this.comboxCONDIT4.setValue(Zi.LAN.EQUAL); } } } } }); this.comboxQueryField5 = Ext.create('DsExt.ux.RefTableCombox', { store: this.StoreFieldQuery, // forceSelection: true, flex: 3, name: 'QUERYFIELD5', valueField: 'FIELDNAME', displayField: Zi.LAN.displayField, listeners: { scope: this, 'select': function (combo, records, eOpts) { if (records.length > 0) { this.formSearch.getForm().findField('NESTEDSQL5').setValue(records[0].data.NESTEDSQL); } }, 'change': function (comboa, newValue, oldValue, eOpts) { var Cargoinforecords = DsStoreQueryBy(this.StoreFieldQuery, Zi.LAN.displayField, comboa.rawValue); if (Cargoinforecords.getCount() > 0) { this.formSearch.getForm().findField('FIELDTYPE5').setValue(Cargoinforecords.getAt(0).data.FIELDTYPE); if (Cargoinforecords.getAt(0).data.FIELDTYPE == "DATE") { this.formSearch.getForm().findField('STRFIELD5').setVisible(false); this.formSearch.getForm().findField('LISTFIELD5').setVisible(false); this.formSearch.getForm().findField('MONTHFIELD5').setVisible(false); this.formSearch.getForm().findField('DATEFIELD5').setVisible(true); this.formSearch.getForm().findField('DATEFIELD5').format = 'Y-m-d'; this.formSearch.getForm().findField('DATEFIELD5').setValue(''); this.formSearch.getForm().findField('DATETIMEFIELD5').setVisible(false); this.comboxCONDIT5.store = this.storeDateCondition; this.comboxCONDIT5.setValue(Zi.LAN.GREATER); } else if (Cargoinforecords.getAt(0).data.FIELDTYPE == "DATETIME") { this.formSearch.getForm().findField('STRFIELD5').setVisible(false); this.formSearch.getForm().findField('LISTFIELD5').setVisible(false); this.formSearch.getForm().findField('MONTHFIELD5').setVisible(false); this.formSearch.getForm().findField('DATEFIELD5').setVisible(false); this.formSearch.getForm().findField('DATETIMEFIELD5').format = 'Y-m-d H:i:s'; this.formSearch.getForm().findField('DATETIMEFIELD5').setValue(''); this.formSearch.getForm().findField('DATETIMEFIELD5').setVisible(true); this.comboxCONDIT5.store = this.storeDateCondition; this.comboxCONDIT5.setValue(Zi.LAN.GREATER); } else if (Cargoinforecords.getAt(0).data.FIELDTYPE == "ACCDATE") { this.formSearch.getForm().findField('STRFIELD5').setVisible(false); this.formSearch.getForm().findField('LISTFIELD5').setVisible(false); this.formSearch.getForm().findField('DATEFIELD5').setVisible(false); this.formSearch.getForm().findField('MONTHFIELD5').setVisible(true); this.formSearch.getForm().findField('DATETIMEFIELD5').setVisible(false); this.comboxCONDIT5.store = this.storeDateCondition; this.comboxCONDIT5.setValue(Zi.LAN.LESSTHAN); } else if (Cargoinforecords.getAt(0).data.FIELDTYPE == "STR") { this.formSearch.getForm().findField('STRFIELD5').setVisible(true); this.formSearch.getForm().findField('LISTFIELD5').setVisible(false); this.formSearch.getForm().findField('DATEFIELD5').setVisible(false); this.formSearch.getForm().findField('MONTHFIELD5').setVisible(false); this.formSearch.getForm().findField('DATETIMEFIELD5').setVisible(false); this.comboxCONDIT5.store = this.storeEditCondition; this.comboxCONDIT5.setValue(Zi.LAN.LIKE); } else if (Cargoinforecords.getAt(0).data.FIELDTYPE == "NUM") { this.formSearch.getForm().findField('STRFIELD5').setVisible(true); this.formSearch.getForm().findField('LISTFIELD5').setVisible(false); this.formSearch.getForm().findField('DATEFIELD5').setVisible(false); this.formSearch.getForm().findField('MONTHFIELD5').setVisible(false); this.formSearch.getForm().findField('DATETIMEFIELD5').setVisible(false); this.comboxCONDIT5.store = this.storeDateCondition; this.comboxCONDIT5.setValue(Zi.LAN.EQUAL); } else { this.formSearch.getForm().findField('STRFIELD5').setVisible(false); this.formSearch.getForm().findField('LISTFIELD5').setVisible(true); this.formSearch.getForm().findField('DATEFIELD5').setVisible(false); this.formSearch.getForm().findField('MONTHFIELD5').setVisible(false); this.formSearch.getForm().findField('DATETIMEFIELD5').setVisible(false); this.storeListCode5.load({ params: { type: Cargoinforecords.getAt(0).data.FIELDTYPE} }); this.comboxCONDIT5.store = this.storeEditCondition; this.comboxCONDIT5.setValue(Zi.LAN.EQUAL); } } } } }); this.comboxQueryField6 = Ext.create('DsExt.ux.RefTableCombox', { store: this.StoreFieldQuery, // forceSelection: true, flex: 3, name: 'QUERYFIELD6', valueField: 'FIELDNAME', displayField: Zi.LAN.displayField, listeners: { scope: this, 'select': function (combo, records, eOpts) { if (records.length > 0) { this.formSearch.getForm().findField('NESTEDSQL6').setValue(records[0].data.NESTEDSQL); } }, 'change': function (comboa, newValue, oldValue, eOpts) { var Cargoinforecords = DsStoreQueryBy(this.StoreFieldQuery, Zi.LAN.displayField, comboa.rawValue); if (Cargoinforecords.getCount() > 0) { this.formSearch.getForm().findField('FIELDTYPE6').setValue(Cargoinforecords.getAt(0).data.FIELDTYPE); if (Cargoinforecords.getAt(0).data.FIELDTYPE == "DATE") { this.formSearch.getForm().findField('STRFIELD6').setVisible(false); this.formSearch.getForm().findField('LISTFIELD6').setVisible(false); this.formSearch.getForm().findField('MONTHFIELD6').setVisible(false); this.formSearch.getForm().findField('DATEFIELD6').setVisible(true); this.formSearch.getForm().findField('DATEFIELD6').format = 'Y-m-d'; this.formSearch.getForm().findField('DATEFIELD6').setValue(''); this.formSearch.getForm().findField('DATETIMEFIELD6').setVisible(false); this.comboxCONDIT6.store = this.storeDateCondition; this.comboxCONDIT6.setValue(Zi.LAN.GREATER); } else if (Cargoinforecords.getAt(0).data.FIELDTYPE == "DATETIME") { this.formSearch.getForm().findField('STRFIELD6').setVisible(false); this.formSearch.getForm().findField('LISTFIELD6').setVisible(false); this.formSearch.getForm().findField('MONTHFIELD6').setVisible(false); this.formSearch.getForm().findField('DATEFIELD6').setVisible(false); this.formSearch.getForm().findField('DATETIMEFIELD6').format = 'Y-m-d H:i:s'; this.formSearch.getForm().findField('DATETIMEFIELD6').setValue(''); this.formSearch.getForm().findField('DATETIMEFIELD6').setVisible(true); this.comboxCONDIT6.store = this.storeDateCondition; this.comboxCONDIT6.setValue(Zi.LAN.GREATER); } else if (Cargoinforecords.getAt(0).data.FIELDTYPE == "ACCDATE") { this.formSearch.getForm().findField('STRFIELD6').setVisible(false); this.formSearch.getForm().findField('LISTFIELD6').setVisible(false); this.formSearch.getForm().findField('DATEFIELD6').setVisible(false); this.formSearch.getForm().findField('MONTHFIELD6').setVisible(true); this.formSearch.getForm().findField('DATETIMEFIELD6').setVisible(false); this.comboxCONDIT6.store = this.storeDateCondition; this.comboxCONDIT6.setValue(Zi.LAN.LESSTHAN); } else if (Cargoinforecords.getAt(0).data.FIELDTYPE == "STR") { this.formSearch.getForm().findField('STRFIELD6').setVisible(true); this.formSearch.getForm().findField('LISTFIELD6').setVisible(false); this.formSearch.getForm().findField('DATEFIELD6').setVisible(false); this.formSearch.getForm().findField('MONTHFIELD6').setVisible(false); this.formSearch.getForm().findField('DATETIMEFIELD6').setVisible(false); this.comboxCONDIT6.store = this.storeEditCondition; this.comboxCONDIT6.setValue(Zi.LAN.LIKE); } else if (Cargoinforecords.getAt(0).data.FIELDTYPE == "NUM") { this.formSearch.getForm().findField('STRFIELD6').setVisible(true); this.formSearch.getForm().findField('LISTFIELD6').setVisible(false); this.formSearch.getForm().findField('DATEFIELD6').setVisible(false); this.formSearch.getForm().findField('MONTHFIELD6').setVisible(false); this.formSearch.getForm().findField('DATETIMEFIELD6').setVisible(false); this.comboxCONDIT6.store = this.storeDateCondition; this.comboxCONDIT6.setValue(Zi.LAN.EQUAL); } else { this.formSearch.getForm().findField('STRFIELD6').setVisible(false); this.formSearch.getForm().findField('LISTFIELD6').setVisible(true); this.formSearch.getForm().findField('DATEFIELD6').setVisible(false); this.formSearch.getForm().findField('MONTHFIELD6').setVisible(false); this.formSearch.getForm().findField('DATETIMEFIELD6').setVisible(false); this.storeListCode6.load({ params: { type: Cargoinforecords.getAt(0).data.FIELDTYPE} }); this.comboxCONDIT6.store = this.storeEditCondition; this.comboxCONDIT6.setValue(Zi.LAN.EQUAL); } } } } }); this.storeListCode1 = Ext.create('DsExt.ux.RefTableStore', { model: 'DsQueryListModel', proxy: { url: '/MvcShipping/MsBaseInfo/GetQueryListValue' } }); this.storeListCode2 = Ext.create('DsExt.ux.RefTableStore', { model: 'DsQueryListModel', proxy: { url: '/MvcShipping/MsBaseInfo/GetQueryListValue' } }); this.storeListCode3 = Ext.create('DsExt.ux.RefTableStore', { model: 'DsQueryListModel', proxy: { url: '/MvcShipping/MsBaseInfo/GetQueryListValue' } }); this.storeListCode4 = Ext.create('DsExt.ux.RefTableStore', { model: 'DsQueryListModel', proxy: { url: '/MvcShipping/MsBaseInfo/GetQueryListValue' } }); this.storeListCode5 = Ext.create('DsExt.ux.RefTableStore', { model: 'DsQueryListModel', proxy: { url: '/MvcShipping/MsBaseInfo/GetQueryListValue' } }); this.storeListCode6 = Ext.create('DsExt.ux.RefTableStore', { model: 'DsQueryListModel', proxy: { url: '/MvcShipping/MsBaseInfo/GetQueryListValue' } }); this.comboxListField1 = Ext.create('DsExt.ux.RefTableCombox', { store: this.storeListCode1, // forceSelection: true, flex: 3, hidden: true, name: 'LISTFIELD1', valueField: 'VALUE', displayField: 'NAME', enableKeyEvents: true, listeners: { keyup: function (field, e) { if (e.getKey() == e.ENTER) { _thisQuery.execSql(); } } } }); this.comboxListField2 = Ext.create('DsExt.ux.RefTableCombox', { store: this.storeListCode2, // forceSelection: true, flex: 3, hidden: true, name: 'LISTFIELD2', valueField: 'VALUE', displayField: 'NAME', enableKeyEvents: true, listeners: { keyup: function (field, e) { if (e.getKey() == e.ENTER) { _thisQuery.execSql(); } } } }); this.comboxListField3 = Ext.create('DsExt.ux.RefTableCombox', { store: this.storeListCode3, // forceSelection: true, flex: 3, hidden: true, name: 'LISTFIELD3', valueField: 'VALUE', displayField: 'NAME', enableKeyEvents: true, listeners: { keyup: function (field, e) { if (e.getKey() == e.ENTER) { _thisQuery.execSql(); } } } }); this.comboxListField4 = Ext.create('DsExt.ux.RefTableCombox', { store: this.storeListCode4, // forceSelection: true, flex: 3, hidden: true, name: 'LISTFIELD4', valueField: 'VALUE', displayField: 'NAME', enableKeyEvents: true, listeners: { keyup: function (field, e) { if (e.getKey() == e.ENTER) { _thisQuery.execSql(); } } } }); this.comboxListField5 = Ext.create('DsExt.ux.RefTableCombox', { store: this.storeListCode5, // forceSelection: true, flex: 3, hidden: true, name: 'LISTFIELD5', valueField: 'VALUE', displayField: 'NAME', enableKeyEvents: true, listeners: { keyup: function (field, e) { if (e.getKey() == e.ENTER) { _thisQuery.execSql(); } } } }); this.comboxListField6 = Ext.create('DsExt.ux.RefTableCombox', { store: this.storeListCode6, // forceSelection: true, flex: 3, hidden: true, name: 'LISTFIELD6', valueField: 'VALUE', displayField: 'NAME', enableKeyEvents: true, listeners: { keyup: function (field, e) { if (e.getKey() == e.ENTER) { _thisQuery.execSql(); } } } }); this.CheckSaveQuery = new Ext.form.Checkbox({ fieldLabel: Zi.LAN.SaveQuery, checked: false, flex: 0.5, width: 90 }); this.formSearch = Ext.widget('form', { frame: true, region: 'center', bodyPadding: 5, fieldDefaults: { margins: '2 2 2 2', labelAlign: 'right', flex: 1, labelWidth: 60, msgTarget: 'qtip' }, items: [{ xtype: 'container', defaultType: 'textfield', layout: 'anchor', defaults: { anchor: '100%' }, items: [{ xtype: 'container', layout: 'hbox', defaultType: 'textfield', items: [this.comboxANDCONDIT1, this.comboxQueryField1, { name: 'FIELDTYPE1', hidden: true }, { name: 'NESTEDSQL1', hidden: true }, this.comboxCONDIT1, this.comboxListField1, { name: 'STRFIELD1', flex: 3, hidden: false, enableKeyEvents: true, listeners: { keyup: function (field, e) { if (e.getKey() == e.ENTER) { _thisQuery.execSql(); } } } }, { format: 'Y-m-d', hidden: true, name: 'DATEFIELD1', flex: 3, xtype: 'datefield', enableKeyEvents: true, listeners: { keyup: function (field, e) { if (e.getKey() == e.ENTER) { _thisQuery.execSql(); } } } }, { format: 'Y-m-d H:i:s', hidden: true, name: 'DATETIMEFIELD1', flex: 3, xtype: 'datetimefield', enableKeyEvents: true, listeners: { keyup: function (field, e) { if (e.getKey() == e.ENTER) { _thisQuery.execSql(); } } } }, { hidden: true, name: 'MONTHFIELD1', flex: 3, xtype: 'monthfield', enableKeyEvents: true, listeners: { keyup: function (field, e) { if (e.getKey() == e.ENTER) { _thisQuery.execSql(); } } } }] }, { xtype: 'container', layout: 'hbox', defaultType: 'textfield', items: [this.comboxANDCONDIT2, this.comboxQueryField2, { name: 'FIELDTYPE2', hidden: true }, { name: 'NESTEDSQL2', hidden: true }, this.comboxCONDIT2, this.comboxListField2, { name: 'STRFIELD2', flex: 3, hidden: false, enableKeyEvents: true, listeners: { keyup: function (field, e) { if (e.getKey() == e.ENTER) { _thisQuery.execSql(); } } } }, { format: 'Y-m-d', hidden: true, name: 'DATEFIELD2', flex: 3, xtype: 'datefield', enableKeyEvents: true, listeners: { keyup: function (field, e) { if (e.getKey() == e.ENTER) { _thisQuery.execSql(); } } } }, { format: 'Y-m-d H:i:s', hidden: true, name: 'DATETIMEFIELD2', flex: 3, xtype: 'datetimefield', enableKeyEvents: true, listeners: { keyup: function (field, e) { if (e.getKey() == e.ENTER) { _thisQuery.execSql(); } } } }, { hidden: true, name: 'MONTHFIELD2', flex: 3, xtype: 'monthfield', enableKeyEvents: true, listeners: { keyup: function (field, e) { if (e.getKey() == e.ENTER) { _thisQuery.execSql(); } } } }] }, { xtype: 'container', layout: 'hbox', defaultType: 'textfield', items: [this.comboxANDCONDIT3, this.comboxQueryField3, { name: 'FIELDTYPE3', hidden: true }, { name: 'NESTEDSQL3', hidden: true }, this.comboxCONDIT3, this.comboxListField3, { name: 'STRFIELD3', flex: 3, hidden: false, enableKeyEvents: true, listeners: { keyup: function (field, e) { if (e.getKey() == e.ENTER) { _thisQuery.execSql(); } } } }, { format: 'Y-m-d', hidden: true, name: 'DATEFIELD3', flex: 3, xtype: 'datefield', enableKeyEvents: true, listeners: { keyup: function (field, e) { if (e.getKey() == e.ENTER) { _thisQuery.execSql(); } } } }, { format: 'Y-m-d H:i:s', hidden: true, name: 'DATETIMEFIELD3', flex: 3, xtype: 'datetimefield', enableKeyEvents: true, listeners: { keyup: function (field, e) { if (e.getKey() == e.ENTER) { _thisQuery.execSql(); } } } }, { hidden: true, name: 'MONTHFIELD3', flex: 3, xtype: 'monthfield', enableKeyEvents: true, listeners: { keyup: function (field, e) { if (e.getKey() == e.ENTER) { _thisQuery.execSql(); } } } }] }, { xtype: 'container', layout: 'hbox', defaultType: 'textfield', items: [this.comboxANDCONDIT4, this.comboxQueryField4, { name: 'FIELDTYPE4', hidden: true }, { name: 'NESTEDSQL4', hidden: true }, this.comboxCONDIT4, this.comboxListField4, { name: 'STRFIELD4', flex: 3, hidden: false, enableKeyEvents: true, listeners: { keyup: function (field, e) { if (e.getKey() == e.ENTER) { _thisQuery.execSql(); } } } }, { format: 'Y-m-d', hidden: true, name: 'DATEFIELD4', flex: 3, xtype: 'datefield', enableKeyEvents: true, listeners: { keyup: function (field, e) { if (e.getKey() == e.ENTER) { _thisQuery.execSql(); } } } }, { format: 'Y-m-d H:i:s', hidden: true, name: 'DATETIMEFIELD4', flex: 3, xtype: 'datetimefield', enableKeyEvents: true, listeners: { keyup: function (field, e) { if (e.getKey() == e.ENTER) { _thisQuery.execSql(); } } } }, { hidden: true, name: 'MONTHFIELD4', flex: 3, xtype: 'monthfield', enableKeyEvents: true, listeners: { keyup: function (field, e) { if (e.getKey() == e.ENTER) { _thisQuery.execSql(); } } } }] }, { xtype: 'container', layout: 'hbox', defaultType: 'textfield', items: [this.comboxANDCONDIT5, this.comboxQueryField5, { name: 'FIELDTYPE5', hidden: true }, { name: 'NESTEDSQL5', hidden: true }, this.comboxCONDIT5, this.comboxListField5, { name: 'STRFIELD5', flex: 3, hidden: false, enableKeyEvents: true, listeners: { keyup: function (field, e) { if (e.getKey() == e.ENTER) { _thisQuery.execSql(); } } } }, { format: 'Y-m-d', hidden: true, name: 'DATEFIELD5', flex: 3, xtype: 'datefield', enableKeyEvents: true, listeners: { keyup: function (field, e) { if (e.getKey() == e.ENTER) { _thisQuery.execSql(); } } } }, { format: 'Y-m-d H:i:s', hidden: true, name: 'DATETIMEFIELD5', flex: 3, xtype: 'datetimefield', enableKeyEvents: true, listeners: { keyup: function (field, e) { if (e.getKey() == e.ENTER) { _thisQuery.execSql(); } } } }, { hidden: true, name: 'MONTHFIELD5', flex: 3, xtype: 'monthfield', enableKeyEvents: true, listeners: { keyup: function (field, e) { if (e.getKey() == e.ENTER) { _thisQuery.execSql(); } } } }] }, { xtype: 'container', layout: 'hbox', defaultType: 'textfield', items: [this.comboxANDCONDIT6, this.comboxQueryField6, { name: 'FIELDTYPE6', hidden: true }, { name: 'NESTEDSQL6', hidden: true }, this.comboxCONDIT6, this.comboxListField6, { name: 'STRFIELD6', flex: 3, hidden: false, enableKeyEvents: true, listeners: { keyup: function (field, e) { if (e.getKey() == e.ENTER) { _thisQuery.execSql(); } } } }, { format: 'Y-m-d', hidden: true, name: 'DATEFIELD6', flex: 3, xtype: 'datefield', enableKeyEvents: true, listeners: { keyup: function (field, e) { if (e.getKey() == e.ENTER) { _thisQuery.execSql(); } } } }, { format: 'Y-m-d H:i:s', hidden: true, name: 'DATETIMEFIELD6', flex: 3, xtype: 'datetimefield', enableKeyEvents: true, listeners: { keyup: function (field, e) { if (e.getKey() == e.ENTER) { _thisQuery.execSql(); } } } }, { hidden: true, name: 'MONTHFIELD6', flex: 3, xtype: 'monthfield', enableKeyEvents: true, listeners: { keyup: function (field, e) { if (e.getKey() == e.ENTER) { _thisQuery.execSql(); } } } }] }] }], buttons: [this.CheckSaveQuery, { text: Zi.LAN.Query, id: 'btnQuery', handler: function (button, event) { _thisQuery.execSql(); }, scope: this }, { text: Zi.LAN.Close, handler: function (button, event) { var win = this.up("window"); win.close(); } }] }); _thissearch = this; Ext.apply(this, { height: 250, closable: true, draggable: true, title: Zi.LAN.MoreQuery, defaultButton: 'btnQuery', resizable: false, items: [this.formSearch], layout: "border", width: 500, xtype: "window", id: "DsQueryWin", listeners: { scope: this, 'beforeshow': function (thewin, eOpts) { this.StoreFieldQuery.load({ params: { formname: this.formname }, callback: function (r, options, success) { if (success) { if (r.length != 0) { LoadQueryData(_thissearch.formname + 'DS', _thissearch.formSearch, _thissearch.CheckSaveQuery); } } } }); } } }); }, //onDeleteClick LoadQueryData_self: function (formname) { LoadQueryData(formname + 'DS', this.formSearch, this.CheckSaveQuery); }, execSql: function () { var issavevalue = false; var isvisible = true; if (this.CheckSaveQuery.checked) issavevalue = true saveQuerySetting(this.formname + 'DS', this.formSearch, isvisible, issavevalue); var storeList = this.StoreList; var sql = this.getCondition(); if (this.formname == 'MsOp_BLISSUEIndex' || this.formname == 'PcHeadEdit_WFSD') { parentWin = window.panelTest; } else if (this.formname == 'ChInvoiceapplicationAudit' || this.formname == 'formMsCwVouchersGlChFeeIndex' || this.formname == 'formMsCwVouchersGlSettlementIndex') { parentWin = window.panelIndex; } else parentWin = window._this; if (!parentWin && window.panelIndex) parentWin = window.panelIndex; if (!parentWin && this._parentWin) parentWin = this._parentWin; if (this.formname == 'formMsChInvoicehexiaoEdit') { parentWin.BillSql = sql; parentWin.sqlcontext = sql; } else parentWin.sqlcontext = sql; parentWin.onDsQuery(); var win = Ext.getCmp("DsQueryWin"); win.close(); }, getCondition: function () { var form = this.formSearch.getForm(); if (!form.isValid()) { Ext.Msg.alert(Zi.LAN.prompt, Zi.LAN.prompterro); return ''; } //var sql = this.condition; var sql = ''; var QUERYFIELD1 = form.findField('QUERYFIELD1').getValue(); var FIELDTYPE1 = form.findField('FIELDTYPE1').getValue(); var CONDIT1 = form.findField('CONDIT1').getValue(); var STRFIELD1 = form.findField('STRFIELD1').getValue(); var DATEFIELD1 = form.findField('DATEFIELD1').getRawValue(); var LISTFIELD1 = form.findField('LISTFIELD1').getValue(); var NESTEDSQL1 = form.findField('NESTEDSQL1').getValue(); var MONTHFIELD1 = form.findField('MONTHFIELD1').getRawValue(); var DATETIMEFIELD1 = form.findField('DATETIMEFIELD1').getRawValue(); sql = sql + this.getformSql(sql, QUERYFIELD1, FIELDTYPE1, CONDIT1, STRFIELD1, LISTFIELD1, DATEFIELD1, '且', NESTEDSQL1, MONTHFIELD1, DATETIMEFIELD1); var QUERYFIELD2 = form.findField('QUERYFIELD2').getValue(); var FIELDTYPE2 = form.findField('FIELDTYPE2').getValue(); var CONDIT2 = form.findField('CONDIT2').getValue(); var STRFIELD2 = form.findField('STRFIELD2').getValue(); var DATEFIELD2 = form.findField('DATEFIELD2').getRawValue(); var LISTFIELD2 = form.findField('LISTFIELD2').getValue(); var ANDCONDIT2 = form.findField('ANDCONDIT2').getValue(); var NESTEDSQL2 = form.findField('NESTEDSQL2').getValue(); var MONTHFIELD2 = form.findField('MONTHFIELD2').getRawValue(); var DATETIMEFIELD2 = form.findField('DATETIMEFIELD2').getRawValue(); sql = sql + this.getformSql(sql, QUERYFIELD2, FIELDTYPE2, CONDIT2, STRFIELD2, LISTFIELD2, DATEFIELD2, ANDCONDIT2, NESTEDSQL2, MONTHFIELD2, DATETIMEFIELD2); var QUERYFIELD3 = form.findField('QUERYFIELD3').getValue(); var FIELDTYPE3 = form.findField('FIELDTYPE3').getValue(); var CONDIT3 = form.findField('CONDIT3').getValue(); var STRFIELD3 = form.findField('STRFIELD3').getValue(); var DATEFIELD3 = form.findField('DATEFIELD3').getRawValue(); var LISTFIELD3 = form.findField('LISTFIELD3').getValue(); var ANDCONDIT3 = form.findField('ANDCONDIT3').getValue(); var NESTEDSQL3 = form.findField('NESTEDSQL3').getValue(); var MONTHFIELD3 = form.findField('MONTHFIELD3').getRawValue(); var DATETIMEFIELD3 = form.findField('DATETIMEFIELD3').getRawValue(); sql = sql + this.getformSql(sql, QUERYFIELD3, FIELDTYPE3, CONDIT3, STRFIELD3, LISTFIELD3, DATEFIELD3, ANDCONDIT3, NESTEDSQL3, MONTHFIELD3, DATETIMEFIELD3); var QUERYFIELD4 = form.findField('QUERYFIELD4').getValue(); var FIELDTYPE4 = form.findField('FIELDTYPE4').getValue(); var CONDIT4 = form.findField('CONDIT4').getValue(); var STRFIELD4 = form.findField('STRFIELD4').getValue(); var DATEFIELD4 = form.findField('DATEFIELD4').getRawValue(); var LISTFIELD4 = form.findField('LISTFIELD4').getValue(); var ANDCONDIT4 = form.findField('ANDCONDIT4').getValue(); var NESTEDSQL4 = form.findField('NESTEDSQL4').getValue(); var MONTHFIELD4 = form.findField('MONTHFIELD4').getRawValue(); var DATETIMEFIELD4 = form.findField('DATETIMEFIELD4').getRawValue(); sql = sql + this.getformSql(sql, QUERYFIELD4, FIELDTYPE4, CONDIT4, STRFIELD4, LISTFIELD4, DATEFIELD4, ANDCONDIT4, NESTEDSQL4, MONTHFIELD4, DATETIMEFIELD4); var QUERYFIELD5 = form.findField('QUERYFIELD5').getValue(); var FIELDTYPE5 = form.findField('FIELDTYPE5').getValue(); var CONDIT5 = form.findField('CONDIT5').getValue(); var STRFIELD5 = form.findField('STRFIELD5').getValue(); var DATEFIELD5 = form.findField('DATEFIELD5').getRawValue(); var LISTFIELD5 = form.findField('LISTFIELD5').getValue(); var ANDCONDIT5 = form.findField('ANDCONDIT5').getValue(); var NESTEDSQL5 = form.findField('NESTEDSQL5').getValue(); var MONTHFIELD5 = form.findField('MONTHFIELD5').getRawValue(); var DATETIMEFIELD5 = form.findField('DATETIMEFIELD5').getRawValue(); sql = sql + this.getformSql(sql, QUERYFIELD5, FIELDTYPE5, CONDIT5, STRFIELD5, LISTFIELD5, DATEFIELD5, ANDCONDIT5, NESTEDSQL5, MONTHFIELD5, DATETIMEFIELD5); var QUERYFIELD6 = form.findField('QUERYFIELD6').getValue(); var FIELDTYPE6 = form.findField('FIELDTYPE6').getValue(); var CONDIT6 = form.findField('CONDIT6').getValue(); var STRFIELD6 = form.findField('STRFIELD6').getValue(); var DATEFIELD6 = form.findField('DATEFIELD6').getRawValue(); var LISTFIELD6 = form.findField('LISTFIELD6').getValue(); var ANDCONDIT6 = form.findField('ANDCONDIT6').getValue(); var NESTEDSQL6 = form.findField('NESTEDSQL6').getValue(); var MONTHFIELD6 = form.findField('MONTHFIELD6').getRawValue(); var DATETIMEFIELD6 = form.findField('DATETIMEFIELD6').getRawValue(); sql = sql + this.getformSql(sql, QUERYFIELD6, FIELDTYPE6, CONDIT6, STRFIELD6, LISTFIELD6, DATEFIELD6, ANDCONDIT6, NESTEDSQL6, MONTHFIELD6, DATETIMEFIELD6); if (sql == '') { sql = this.condition; } else { if (this.condition != '') sql = this.condition + ' and (' + sql + ')'; } return sql; }, getformSql: function (sql, queryfield, fieldtype, condit, strdata, custdata, datedata, andcondit, nestedsql, monthdata, datetimedata) { var constr = ''; if (queryfield == '' || queryfield == null || queryfield == undefined || fieldtype == '' || fieldtype == null || fieldtype == undefined) { if (fieldtype == '' || fieldtype == null || fieldtype == undefined) { return ''; } else { if (custdata == '' || custdata == null || custdata == undefined) { return ''; } else { if (condit == Zi.LAN.EQUAL) { constr = custdata } else if (condit == Zi.LAN.NOTEQUAL) { constr = custdata } else if (condit == Zi.LAN.LIKE) { constr = '' } if (nestedsql != '') { constr = nestedsql.replace('@CONSTR', constr); } if (sql == '') { return constr; } else { if (andcondit == Zi.LAN.OR) return ' or ' + constr; else return ' and ' + constr; } } } } else { if (fieldtype == 'DATE') { if (datedata == '' || datedata == null || datedata == undefined) { return ''; } else { if (condit == Zi.LAN.EQUAL) { constr = queryfield + "='" + datedata + "'" } else if (condit == Zi.LAN.GREATER) { constr = queryfield + ">='" + datedata + "'" } else if (condit == Zi.LAN.LESSTHAN) { constr = queryfield + "<='" + datedata + "'" } else if (condit == Zi.LAN.NOTEQUAL) { constr = queryfield + "<>'" + datedata + "'" } if (nestedsql != '') { constr = nestedsql.replace('@CONSTR', constr); } if (sql == '') { return constr; } else { if (andcondit == Zi.LAN.OR) return ' or ' + constr; else return ' and ' + constr; } } } else if (fieldtype == 'DATETIME') { if (datetimedata == '' || datetimedata == null || datetimedata == undefined) { return ''; } else { if (condit == Zi.LAN.EQUAL) { constr = queryfield + "='" + datetimedata + "'" } else if (condit == Zi.LAN.GREATER) { constr = queryfield + ">='" + datetimedata + "'" } else if (condit == Zi.LAN.LESSTHAN) { constr = queryfield + "<='" + datetimedata + "'" } else if (condit == Zi.LAN.NOTEQUAL) { constr = queryfield + "<>'" + datetimedata + "'" } if (nestedsql != '') { constr = nestedsql.replace('@CONSTR', constr); } if (sql == '') { return constr; } else { if (andcondit == Zi.LAN.OR) return ' or ' + constr; else return ' and ' + constr; } } } else if (fieldtype == 'ACCDATE') { if (monthdata == '' || monthdata == null || monthdata == undefined) { return ''; } else { if (condit == Zi.LAN.EQUAL) { constr = queryfield + "='" + monthdata + "'" } else if (condit == Zi.LAN.GREATER) { constr = queryfield + ">='" + monthdata + "'" } else if (condit == Zi.LAN.LESSTHAN) { constr = queryfield + "<='" + monthdata + "'" } else if (condit == Zi.LAN.NOTEQUAL) { constr = queryfield + "<>'" + monthdata + "'" } if (nestedsql != '') { constr = nestedsql.replace('@CONSTR', constr); } if (sql == '') { return constr; } else { if (andcondit == Zi.LAN.OR) return ' or ' + constr; else return ' and ' + constr; } } } else if (fieldtype == 'NUM') { if (strdata == '' || strdata == null || strdata == undefined) { return ''; } else { if (condit == Zi.LAN.EQUAL) { constr = queryfield + "=" + strdata + "" } else if (condit == Zi.LAN.GREATER) { constr = queryfield + ">=" + strdata + "" } else if (condit == Zi.LAN.LESSTHAN) { constr = queryfield + "<=" + strdata + "" } else if (condit == Zi.LAN.NOTEQUAL) { constr = queryfield + "<>" + strdata + "" } if (nestedsql != '') { constr = nestedsql.replace('@CONSTR', constr); } if (sql == '') { return constr; } else { if (andcondit == Zi.LAN.OR) return ' or ' + constr; else return ' and ' + constr; } } } else if (fieldtype == 'BOOLEAN') { if (custdata == '' || custdata == null || custdata == undefined) { return ''; } else { if (condit == Zi.LAN.EQUAL) { if (custdata == '1') constr = queryfield + "=1" else constr = ' (' + queryfield + " IS NULL OR " + queryfield + "=0) " } else if (condit == Zi.LAN.NOTEQUAL) { if (custdata == '1') constr = ' (' + queryfield + " IS NULL OR " + queryfield + "=0) " else constr = queryfield + "=1" } if (nestedsql != '') { constr = nestedsql.replace('@CONSTR', constr); } if (sql == '') { return constr; } else { if (andcondit == Zi.LAN.OR) return ' or ' + constr; else return ' and ' + constr; } } } else if (fieldtype == 'STR') { if (strdata == '' || strdata == null || strdata == undefined) { return ''; } else { if (condit == Zi.LAN.EQUAL) { constr = queryfield + "='" + strdata + "'" } else if (condit == Zi.LAN.NOTEQUAL) { constr = queryfield + "<>'" + strdata + "'" } else if (condit == Zi.LAN.LIKE) { constr = queryfield + " like '%" + strdata + "%'" } if (nestedsql != '') { constr = nestedsql.replace('@CONSTR', constr); } if (sql == '') { return constr; } else { if (andcondit == Zi.LAN.OR) return ' or ' + constr; else return ' and ' + constr; } } } else { if (custdata == '' || custdata == null || custdata == undefined) { return ''; } else { if (condit == Zi.LAN.EQUAL) { constr = queryfield + "='" + custdata + "'" } else if (condit == Zi.LAN.NOTEQUAL) { constr = queryfield + "<>'" + custdata + "'" } else if (condit == Zi.LAN.LIKE) { constr = queryfield + " like '%" + custdata + "%'" } if (nestedsql != '') { constr = nestedsql.replace('@CONSTR', constr); } if (sql == '') { return constr; } else { if (andcondit == Zi.LAN.OR) return ' or ' + constr; else return ' and ' + constr; } } } } } });