You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
DS7/DSWeb/Areas/Import/Viewsjs/XXH/XXHIndex.js

1442 lines
47 KiB
JavaScript

3 years ago
Ext.namespace('DsTruck');
DsTruck.XXHIndex = function (config) {
Ext.applyIf(this, config);
this.initUIComponents();
window.DsTruck.XXHIndex.superclass.constructor.call(this);
};
Ext.extend(DsTruck.XXHIndex, Ext.Panel, {
PageSize: 500,
OprationStatus: null, //仅当弹出界面时使用
SelectedRecord: null,
initUIComponents: function () {
//定义数据集
/*
this.storeList = Ext.create('Ext.data.Store', {
model: 'XXH_ALLmb',
remoteSort: false,
pageSize: this.PageSize,
proxy: {
//type: 'jsonp',
type: 'ajax',
url: '/Import/XXH/GetDataList_ALL', //http://120.27.53.37:8089
reader: {
type: 'json',
root: 'data',
totalProperty: 'totalCount'
}
}
});*/
this.storeList = Ext.create('Ext.data.Store', {
model: 'XXH_ALLmb',
remoteSort: false,
pageSize: this.PageSize,
proxy: {
type: 'jsonp',
//type: 'ajax',
url: '/Import/XXH/GetDataList_ALL_OUT', //http://120.27.53.37:8089
reader: {
type: 'json',
root: 'data',
totalProperty: 'totalCount'
}
}
});
//#region 枚举参照
/*
this.storeport = Ext.create('DsExt.ux.RefEnumStore', {});
this.storeport.load({ params: { enumTypeId: 10} });
this.comboxport = Ext.create('DsExt.ux.RefEnumCombox', {
fieldLabel: '目的港',
store: this.storeport,
name: 'port'
});*/
//表参照
this.storeCargoinfo = Ext.create('DsExt.ux.RefTableStore', {
model: 'CargoRef',
proxy: { url: '/CommMng/BasicDataRef/GetCargoRefList' }
});
this.storeCargoinfo.load({ params: { condition: ""} });
this.comboxCargoinfo = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: 'HS代码',
store: this.storeCargoinfo,
name: 'Cargoinfo_id',
valueField: 'id',
displayField: 'codeandname'
//HS代码
});
this.storeCargociq = Ext.create('DsExt.ux.RefTableStore', {
model: 'CargociqRef',
proxy: { url: '/CommMng/BasicDataRef/GetCargociqRefList' }
});
this.storeCargociq.load({ params: { condition: ""} });
this.comboxCargociq = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: 'CIQ代码',
store: this.storeCargociq,
name: 'Cargociq_id',
valueField: 'id',
displayField: 'codeandname'
//ciq代码
});
this.storeRemind = Ext.create('DsExt.ux.RefTableStore', {
model: 'remind',
proxy: { url: '/CommMng/BasicDataRef/Getimportremind' }
});
this.storeRemind.load({ params: { condition: ""} });
this.comboxRemind = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: '业务提醒',
store: this.storeRemind,
name: 'Remind',
valueField: 'RemindSql',
displayField: 'RemindName',
triggerAction: 'all',
selectOnFocus: true,
listeners: {
change: function (field, newValue, oldValue) {
this.onGetremind(field, newValue, oldValue);
},
scope: this
}
});
this.storeUser = Ext.create('DsExt.ux.RefTableStore', {
model: 'DsTruckMng.ux.UserRefModel',
proxy: { url: '/CommMng/BasicDataRef/GetUserRefList' }
});
this.storeUser.load({ params: { condition: ""} });
this.comboxOP = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: '操作人',
forceSelection: true,
store: this.storeUser,
name: 'OP', flex: 1,
valueField: 'UserName',
displayField: 'CodeAndName'
});
//#endregion
Ext.grid.RowNumberer = Ext.extend(Ext.grid.RowNumberer, {
width: 50
});
this.column = [
{
id: '',
sortable: true,
dataIndex: 'seller',
header: '贸易商',
width: 80
}, {
sortable: true, id: '',
dataIndex: 'buyer',
header: '购货方',
width: 80
}, {
sortable: true, id: '',
dataIndex: 'HTH',
header: '合同号',
width: 80
}, {
sortable: true, id: '',
dataIndex: 'country',
header: '进口国',
width: 80
}, {
sortable: true, id: '',
dataIndex: 'countryid',
header: 'countryid',
hidden: true,
width: 80
}, {
sortable: true, id: '',
dataIndex: 'portRef',
header: '目的港',
width: 80
}, {
sortable: true, id: '',
dataIndex: 'companyname',
header: '用证公司',
width: 80
}, {
sortable: true, id: '',
dataIndex: 'creattime',
header: '接单日期',
width: 80
}, {
sortable: true, id: '',
dataIndex: 'name',
header: '货物名称',
width: 80
}, {
sortable: true, id: '',
dataIndex: 'weight',
header: '净重(吨)',
width: 80
}, //{
// sortable: true,
// dataIndex: 'cicode',
// header: '商品手册编号',
// width: 80
//},
{
sortable: true, id: '',
dataIndex: 'ciname',
header: '商品手册名称',
width: 80
}, {
sortable: true, id: '',
dataIndex: 'AppNo',
header: '许可证号',
width: 80
}, {
sortable: true, id: '',
dataIndex: 'STT',
header: '双抬头',
width: 80
}, {
sortable: true, id: '',
dataIndex: 'printedRef',
header: '发票打印完成',
width: 80
}, {
sortable: true, id: '',
dataIndex: 'AutoAPPRef',
header: '自动证',
width: 80
}, {
sortable: true, id: '',
dataIndex: 'WriteoffsRef',
header: '核销完成',
width: 80
}, {
sortable: true, id: '',
dataIndex: 'MainstateRef',
header: '合同状态',
width: 80
}, {
sortable: true, id: '',
dataIndex: 'Ex_sailingdate',
header: '预计开船日',
width: 80
}, {
sortable: true, id: '',
dataIndex: 'Sailingdate',
header: '开船日',
width: 80
}, {
sortable: true, id: '',
dataIndex: 'ArrivalDate',
header: '到港日',
width: 80
}, {
sortable: true, id: '',
dataIndex: 'ValidDate',
header: '许可证有效期',
width: 80
}, {
sortable: true, id: '',
dataIndex: 'ReceiptStatusRef',
header: '单据是否完备',
width: 80
}, {
sortable: true, id: '',
dataIndex: 'Receiptremark',
header: '寄单情况',
width: 280
}, {
sortable: true, id: '',
dataIndex: 'tax_date',
header: '出税日期',
width: 80
}, {
sortable: true, id: '',
dataIndex: 'tax_paydate',
header: '付税日期',
width: 80
}, {
sortable: true, id: '', dataIndex: 'id', header: 'id', hidden: true
},
{
dataIndex: 'TimeMark', header: 'TimeMark', id: '', hidden: true
},
{
sortable: true, id: '',
dataIndex: 'cgid',
header: 'cgid',
hidden: true,
width: 80
}, {
sortable: true, id: '',
dataIndex: 'BillNo',
header: '提单号',
width: 80
}, {
sortable: true, id: '',
dataIndex: 'E_Billtime',
header: '电放时间',
width: 80
}, {
sortable: true, id: '',
dataIndex: 'BillTime',
header: '正本时间',
width: 80
}, {
sortable: true, id: '',
dataIndex: 'HDtime',
header: '换单时间',
width: 80
}, {
sortable: true, id: '',
dataIndex: 'ContainerNo',
header: '箱号',
width: 80
}, {
sortable: true, id: '',
dataIndex: 'SealNo',
header: '铅封号',
width: 80
}, {
sortable: true, id: '',
dataIndex: 'ShipCompanyRef',
header: '船公司',
width: 80
}, {
sortable: true, id: '',
dataIndex: 'Vessel',
header: '船名',
width: 80
}, {
sortable: true, id: '',
dataIndex: 'Voyage',
header: '航次',
width: 80
}, {
sortable: true, id: '',
dataIndex: 'CIQ_licence',
header: '卫生证号',
width: 80
}, {
sortable: true, id: '',
dataIndex: 'CIQ_canbesearchRef',
header: '卫生证是否可查',
width: 80
}, {
sortable: true, id: '',
dataIndex: 'inspection_Signup_date',
header: '报检日期',
width: 80
}, {
sortable: true, id: '',
dataIndex: 'inspection_no',
header: '报检号',
width: 80
}, {
sortable: true, id: '',
dataIndex: 'SamplingDate_Plan',
header: '海关确定抽检',
width: 80
}, {
sortable: true, id: '',
dataIndex: 'SamplingDate_Act',
header: '海关实际验货',
width: 80
}, {
sortable: true, id: '',
dataIndex: 'CustomsReleaseDate',
header: '海关放行日期',
width: 80
}, {
sortable: true, id: '',
dataIndex: 'DeclareNumber',
header: '报关单号',
width: 80
}, {
sortable: true, id: '',
dataIndex: 'ContractNo',
header: '合同序列号',
width: 120
}, {
sortable: true, id: '',
dataIndex: 'm_weight',
header: '毛重',
width: 80
},
{
sortable: true, id: '',
dataIndex: 'price',
header: '单价',
width: 80
},
{
sortable: true, id: '',
dataIndex: 'price_agio',
header: '差价',
width: 80
},
{
sortable: true, id: '',
dataIndex: 'price_limit',
header: '限价',
width: 80
},
{
sortable: true, id: '',
dataIndex: 'amount',
header: '合同金额(对客户)',
width: 80
},
{
sortable: true, id: '',
dataIndex: 'tax_amount',
header: '完税价格',
width: 80
},
{
sortable: true, id: '',
dataIndex: 'pay_amount',
header: '合同金额(对贸易商)',
width: 80
},
{
sortable: true, id: '',
dataIndex: 'codename',
header: '币别',
width: 80
},
{
sortable: true, id: '',
dataIndex: 'boxcount',
header: '箱/件数',
width: 80
},
{
sortable: true, id: '',
dataIndex: 'boxweight',
header: '规格',
width: 80
},
{
sortable: true, id: '',
dataIndex: 'exporter',
header: '出口商',
width: 80
},
{
sortable: true, id: '',
dataIndex: 'FactoryNo',
header: '厂号',
width: 80
},
{
sortable: true, id: '',
dataIndex: 'productiondate',
header: '生产日期',
width: 80
},
{
sortable: true, id: '',
dataIndex: 'prepayments',
header: '预付款',
width: 80
},
{
sortable: true, id: '',
dataIndex: 'balance',
header: '尾款',
width: 80
},
{
sortable: true, id: '',
dataIndex: 'baolv',
header: '保率',
width: 80
},
{
sortable: true, id: '',
dataIndex: 'tariff',
header: '关税类型',
width: 80
},
{
sortable: true, id: '',
dataIndex: 'tax',
header: '关税税率',
width: 80
},
{
sortable: true, id: '',
dataIndex: 'tax_zz',
header: '增值税税率',
width: 80
},
{
sortable: true, id: '',
dataIndex: 'exchangerate',
header: '汇率(商务)',
width: 80
},
{
sortable: true, id: '',
dataIndex: 'exchangerate_customs',
header: '汇率(海关)',
width: 80
},
{
sortable: true, id: '',
dataIndex: 'tax_1',
header: '应收关税',
width: 80
},
{
sortable: true, id: '',
dataIndex: 'tax_zz_1',
header: '应收增值税',
width: 80
},
{
sortable: true, id: '',
dataIndex: 'tax_2',
header: '应付关税',
width: 80
},
{
sortable: true, id: '',
dataIndex: 'tax_zz_2',
header: '应付增值税',
width: 80
}, {
sortable: true, id: '',
dataIndex: 'Paydate',
header: '付货款时间(尾款)',
width: 80
}, {
sortable: true, id: '',
dataIndex: 'Prepaydate',
header: '付货款时间(预付)',
width: 80
}, {
sortable: true, id: '',
dataIndex: 'DeliveryDate',
header: '送货日期',
width: 80
}, {
sortable: true, id: '',
dataIndex: 'DeliveryAddress',
header: '送货地址',
width: 80
}, {
sortable: true, id: '',
dataIndex: 'Contacter',
header: '联系人',
width: 80
}, {
sortable: true, id: '',
dataIndex: 'Tel',
header: '电话',
width: 80
}, {
sortable: true, id: '',
dataIndex: 'RMBAmount',
header: '合同金额(RMB)',
width: 120
}, {
sortable: true, id: '',
dataIndex: 'TransactionMethodRef',
header: '成交方式',
width: 80
}, {
sortable: true, id: '',
dataIndex: 'PaymentMethodsRef',
header: '付款方式',
width: 80
}, {
sortable: true, id: '',
dataIndex: 'Inspection_StorageREF',
header: '是否采样',
width: 80
}, {
sortable: true, id: '',
dataIndex: 'remark_2',
header: '备注2',
width: 80
}, {
sortable: true, id: '',
dataIndex: 'remark_3',
header: '备注3',
width: 80
}, {
sortable: true, id: '',
dataIndex: 'remark_4',
header: '备注4',
width: 80
}, {
sortable: true, id: '',
dataIndex: 'Overfilled',
header: '溢短装',
width: 80
}, {
sortable: true, id: '',
dataIndex: 'FinanceStatusREF',
header: '融资状态',
width: 80
}, {
sortable: true, id: '',
dataIndex: 'remark',
header: '备注',
width: 80
}, {
sortable: true, id: '',
dataIndex: 'OP',
header: '操作人',
width: 80
}, {
sortable: true, id: '',
dataIndex: 'ZMQ',
header: '自贸区',
width: 80
}, {
sortable: true, id: '',
dataIndex: 'FactoryNo',
header: '厂号',
width: 80
}, {
sortable: true, id: '',
dataIndex: 'ValidDate',
header: '许可证有效期',
width: 80
}, {
sortable: true, id: '',
dataIndex: 'ACCDATE',
header: '合同完成时间',
width: 80
}];
//定义Grid
this.gridList = new Ext.grid.GridPanel({
store: this.storeList,
enableHdMenu: false,
region: 'center',
loadMask: { msg: "数据加载中,请稍等..." },
trackMouseOver: true,
disableSelection: false,
stripeRows: true,
viewConfig: {
enableTextSelection: true
},
columns: [new Ext.grid.RowNumberer()],
bbar: Ext.create('Ext.PagingToolbar', {
store: this.storeList,
displayInfo: true,
displayMsg: '当前显示 {0} - {1}条记录 /共 {2}条记录',
emptyMsg: "没有数据"
})
});
/////////////以下部分为获取存储的gridpanel显示样式
if (GID == '') { alert('未检测到用户信息,请重新登陆') }
else {
this.column = DsTruck.GetGridPanel(GID, "HT_Index", this.column);
this.column.unshift(new Ext.grid.RowNumberer());
this.gridList.reconfigure(this.storeList, this.column);
}
////////////////////////////
this.gridList.addListener('itemdblclick', function (dataview, record, item, index, e, b) {
// alert('0....' + dataview.toString() + ',' + record.toString() + ',' + item.toString() + ',' + index.toString() + ',' + e.toString() + ',' + b.toString());
this.SelectedRecord = record;
this.OprationStatus = 'edit';
DsOpenMultiEditWin('/Import/XXH/Edit', '', 650, 1150);
}, this);
//#region formSearch枚举参照相关
///////////////////////////////////////////////////
this.storeBuyer = Ext.create('DsExt.ux.RefTableStore', {
model: 'Tradermb',
proxy: { url: '/CommMng/BasicDataRef/GetTrader' }
});
this.storeBuyer.load({ params: { condition: " isagentcn=1 "} });
this.comboxBuyer = Ext.create('Ext.ux.form.field.BoxSelect', {
fieldLabel: '客户',
//renderTo: 'basicBoxselect',height:60,pinList: false,
//autoHeight:true,width: 500,stacked: true,
autosize: true,
bodyPadding: 7,
flex: 1,
labelWidth: 90,
store: this.storeBuyer,
queryMode: 'local',
triggerOnClick: false,
valueField: 'name',
displayField: 'codename'
});
this.storeSeller = Ext.create('DsExt.ux.RefTableStore', {
model: 'Tradermb',
proxy: { url: '/CommMng/BasicDataRef/GetTrader' }
});
this.storeSeller.load({ params: { condition: " isagent=1 "} });
this.comboxSeller = Ext.create('Ext.ux.form.field.BoxSelect', {
fieldLabel: '贸易商',
//renderTo: 'basicBoxselect',height:60,pinList: false,
//autoHeight:true,width: 500,stacked: true,
autosize: true,
bodyPadding: 7,
flex: 1,
labelWidth: 90,
store: this.storeSeller,
queryMode: 'local',
triggerOnClick: false,
valueField: 'name',
displayField: 'codename'
});
this.storeTRADINGAGENCY = Ext.create('DsExt.ux.RefTableStore', {
model: 'Tradermb',
proxy: { url: '/CommMng/BasicDataRef/GetTrader' }
});
this.storeTRADINGAGENCY.load({ params: { condition: " isTRADINGAGENCY=1 "} });
this.comboxTRADINGAGENCY = Ext.create('Ext.ux.form.field.BoxSelect', {
fieldLabel: '订货方',
//renderTo: 'basicBoxselect',height:60,pinList: false,
//autoHeight:true,width: 500,stacked: true,
autosize: true,
bodyPadding: 7,
flex: 1,
labelWidth: 90,
store: this.storeTRADINGAGENCY,
queryMode: 'local',
triggerOnClick: false,
valueField: 'name',
displayField: 'codename'
});
this.storeport = Ext.create('DsExt.ux.RefEnumStore', {});
this.storeport.load({ params: { enumTypeId: 10} });
this.comboxPort = Ext.create('Ext.ux.form.field.BoxSelect', {
fieldLabel: '目的港',
//renderTo: 'basicBoxselect',
//autoHeight:true,
autosize: true,
bodyPadding: 7,
flex: 1,
//height:60,
width: 100,
labelWidth: 90,
store: this.storeport,
queryMode: 'local',
//stacked: true,
//pinList: false,
triggerOnClick: false,
valueField: 'EnumValueId',
displayField: 'EnumValueName'
//,value: ['TX', 'CA']
});
this.storeMainstate = Ext.create('DsExt.ux.RefEnumStore', {});
this.storeMainstate.load({ params: { enumTypeId: 3} }); //comboxMainstate
this.comboxMainstate = Ext.create('Ext.ux.form.field.BoxSelect', {
fieldLabel: '合同状态',
//renderTo: 'basicBoxselect',height:60,pinList: false,
//autoHeight:true,width: 500,stacked: true,
autosize: true,
bodyPadding: 7,
flex: 1,
labelWidth: 90,
store: this.storeMainstate,
queryMode: 'local',
triggerOnClick: false,
valueField: 'EnumValueId',
displayField: 'EnumValueName'
});
this.storeCountry = Ext.create('DsExt.ux.RefTableStore', {
model: 'ConutryRef',
proxy: { url: '/CommMng/BasicDataRef/GetCountryRefList' }
}); //comboxCountry
this.storeCountry.load({ params: { condition: ""} });
this.comboxCountry = Ext.create('Ext.ux.form.field.BoxSelect', {
fieldLabel: '进口国',
//renderTo: 'basicBoxselect',height:60,pinList: false,
//autoHeight:true,width: 500,stacked: true,
autosize: true,
bodyPadding: 7,
flex: 1,
labelWidth: 90,
store: this.storeCountry,
queryMode: 'local',
triggerOnClick: false,
valueField: 'countryid',
displayField: 'country_idandname'
});
this.storeCompany = Ext.create('DsExt.ux.RefTableStore', {
model: 'companymb',
proxy: { url: '/CommMng/BasicDataRef/GetcompanyList' }
});
this.storeCompany.load({ params: { condition: ""} });
this.comboxCompany = Ext.create('Ext.ux.form.field.BoxSelect', {
fieldLabel: '用证公司',
//renderTo: 'basicBoxselect',height:60,pinList: false,
//autoHeight:true,width: 500,stacked: true,
autosize: true,
bodyPadding: 7,
flex: 1,
labelWidth: 90,
store: this.storeCompany,
queryMode: 'local',
triggerOnClick: false,
valueField: 'gid',
displayField: 'name'
});
this.storeCname = Ext.create('DsExt.ux.RefTableStore', {
model: 'Fieldmb',
proxy: { url: '/Import/XXH/GetField' }
});
this.storeCname.load({ params: { tablename: 'import_cargo', fieldid: 'name', fieldvalue: 'name'} });
this.Cname = Ext.create('Ext.ux.form.field.BoxSelect', {
fieldLabel: '货物名称',
autosize: true,
bodyPadding: 7,
flex: 2,
//width: 500,
labelWidth: 88,
store: this.storeCname,
queryMode: 'local',
triggerOnClick: false,
valueField: 'FieldId',
displayField: 'FieldValue'
});
this.storeWriteoffs = Ext.create('DsExt.ux.RefEnumStore', {});
this.storeWriteoffs.load({ params: { enumTypeId: 0} });
this.comboxWriteoffs = Ext.create('DsExt.ux.RefEnumCombox', {
fieldLabel: '核销完成',
store: this.storeWriteoffs,
name: 'Writeoffs'
});
////////////////////
//#endregion
this.formSearch = Ext.widget('form', {
frame: true,
region: 'center',
bodyPadding: 5,
fieldDefaults: {
margins: '2 2 2 2',
labelAlign: 'right',
flex: 1,
labelWidth: 90,
msgTarget: 'qtip'
},
items: [
{//fieldset 1
xtype: 'container',
defaultType: 'textfield',
layout: 'anchor',
defaults: {
anchor: '100%'
},
items: [{
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [//this.comboxport,
/*{
fieldLabel: '合同号',
name: 'HTH'
},*/
this.comboxCompany,
this.comboxCountry, {
fieldLabel: '合同序列号',
name: 'ContractNo'
}, {
fieldLabel: '开船日 晚于',
format: 'Y-m-d',
xtype: 'datefield',
name: 'SailingDate_min'
}, {
fieldLabel: '开船日 早于',
format: 'Y-m-d',
xtype: 'datefield',
name: 'SailingDate_max'
}]
}]
}, //end items(fieldset 1)
{//fieldset 2
xtype: 'container',
defaultType: 'textfield',
layout: 'anchor',
defaults: {
anchor: '100%'
},
items: [{
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [
this.comboxMainstate,
/*
{ fieldLabel: '贸易商',
name: 'seller'
},
{ fieldLabel: '客户',
name: 'buyer'
},*/
this.comboxSeller,
this.comboxBuyer,
this.comboxTRADINGAGENCY,
this.comboxRemind
]
}]
}, //end fieldset 2
{//fieldset 4
xtype: 'container',
defaultType: 'textfield',
layout: 'anchor',
defaults: {
anchor: '100%'
},
items: [{
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [{
fieldLabel: '提单号',
name: 'BillNo'
}, {
fieldLabel: '箱号',
name: 'ContainerNo'
}, {
fieldLabel: '铅封号',
name: 'SealNo'
}, {
fieldLabel: '从..到港日',
format: 'Y-m-d',
xtype: 'datefield',
name: 'ArrivalDate_min'
}, {
fieldLabel: '到..到港日',
format: 'Y-m-d',
xtype: 'datefield',
name: 'ArrivalDate_max'
}]
}]
}, //end items(fieldset 4)
{//fieldset 5
xtype: 'container',
defaultType: 'textfield',
layout: 'anchor',
defaults: {
anchor: '100%'
},
items: [{
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [this.comboxOP, {
fieldLabel: '业务单据不完整',
xtype: 'checkbox',
name: 'ReceiptStatus',
flex: 1
}, {
fieldLabel: '包含双抬头',
xtype: 'checkbox',
name: 'STT', flex: 1
}, {
fieldLabel: '备注中包含',
name: 'remark', flex: 2,
labelWidth: 88
}]
}]
} //end items(fieldset 5)
, {//fieldset 6
xtype: 'container',
defaultType: 'textfield',
layout: 'anchor',
defaults: {
anchor: '100%'
},
items: [{
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [/*{
fieldLabel: '库存清空',
xtype: 'checkbox',
name: 'KCClear', flex: 1
},*/this.comboxPort, this.Cname, {
fieldLabel: '已删除',
xtype: 'checkbox',
name: 'ISDELETE', flex: 1
}]
}]
} //end items(fieldset 6)
, {//fieldset 6
xtype: 'container',
defaultType: 'textfield',
layout: 'anchor',
defaults: {
anchor: '100%'
},
items: [{
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [{
fieldLabel: '从..合同完成日期',
format: 'Y-m-d',
xtype: 'datefield',
name: 'ACCDATE_min'
}, {
fieldLabel: '到..合同完成日期',
format: 'Y-m-d',
xtype: 'datefield',
name: 'ACCDATE_max'
}, { xtype: 'hiddenfield', flex: 3}]
}]
} //end items(fieldset 6)
]//end root items
});
//#endregion formSearch
_this = this;
this.CBMSearch = new Ext.form.Checkbox({
fieldLabel: '高级查询',
listeners: {
change: function (newValue, oldValue, eOpts)//change事件
{
//alert(newValue.checked);
if (newValue.checked) {
_this.panelSearch.show();
} else {
_this.panelSearch.hide();
}
}
}
});
var menu1 = new Ext.menu.Menu({
id: 'basicMenu',
items: [{
text: '合同利润',
handler: clickHandler
}
]
});
function clickHandler() {
panelTest.Print();
};
//查询工具条
this.panelBtn = new Ext.Panel({
region: "north",
tbar: [
{
text: "新建",
iconCls: "btnadd",
handler: function (button, event) {
this.OprationStatus = 'add';
DsOpenEditWin("/Import/XXH/Edit", "新建合同", "700", "900");
},
scope: this
},
{
text: "删除",
iconCls: "btndelete",
handler: function (button, event) {
this.onDeleteClick(button, event);
},
disabled: true,
scope: this
},
'-',
{
text: "执行查询",
iconCls: "btnrefresh",
handler: function (button, event) {
this.onRefreshClick(button, event);
},
scope: this
},
{
text: "重置条件",
iconCls: "btnreset",
handler: function (button, event) {
this.onResetClick(button, event);
},
scope: this
}, '-', {
text: "获取远程数据",
iconCls: "btnrefresh",
handler: function (button, event) {
this.onGetdataClick(button, event);
},
scope: this
}, '-', {
text: "导出Excel",
id: "btnExportExcel",
iconCls: 'btnexportexcel',
handler: function (button, event) {
this.onExportClick(button, event);
},
scope: this
}, {
text: "保存列表样式",
id: "btntest",
//iconCls: 'btnexportexcel',
handler: function (button, event) {
var tempcolumns = this.gridList.columns;
DsTruck.SaveGridPanel(GID, "HT_Index", tempcolumns, this.column, 1, false);
},
scope: this
}, '-',
{ text: "打印报表", menu: menu1, scope: this },
/* {
text: "合并单元格",
id: "btnhb",
handler: function (button, event) {
mergeCells(_this.gridList, [1]);
},
scope: this
},*/
{id: "S_HTH",
fieldLabel: "合同号",
labelWidth: 55,
xtype: 'textfield',
name: 'HTH'
}, { xtype: 'label', id: 'label1', text: "" },
//this.comboxport
this.CBMSearch
]
});
this.panelTop = new Ext.Panel({
layout: "border",
region: "north",
height: 30,
items: [this.panelBtn]
});
this.panelSearch = new Ext.Panel({
layout: "border",
region: "north",
height: 200,
autoSize: true,
hidden: true,
items: [this.formSearch]
});
Ext.apply(this, {
items: [this.panelTop, this.panelSearch, this.gridList]
});
this.storeList.on('beforeload', function (store) {
var sql = this.getCondition();
Ext.apply(store.proxy.extraParams, { condition: sql });
}, this);
this.storeList.on('refresh', function (store) {
mergeCells(_this.gridList, [1]);
//alert('refresh');
}, this);
}, //end initUIComponents
onRefreshClick: function (button, event) {
var sql = this.getCondition();
this.storeList.load({
params: { start: 0, limit: this.PageSize, sort: '', condition: sql },
waitMsg: "正在查询数据...",
callback: function (records, options, success, response) {
//mergeCells(_this.gridList, [1]);
//alert(records);
}
});
},
onGetdataClick: function (button, event) {
var sql = this.getCondition();
Ext.Msg.wait('正在查询数据...');
Ext.Ajax.request({
waitMsg: '正在查询数据...',
url: 'http://120.27.53.37:8089/Import/XXH/GetDataList_ALL',
type: 'jsonp',
params: { start: 0, limit: this.PageSize, sort: '', condition: sql },
callback: function (options, success, response) {
if (success) {
var jsonresult = Ext.JSON.decode(response.responseText);
if (jsonresult.Success) {
this.storeList.remove(record);
Ext.Msg.show({ title: '提示', msg: jsonresult.Message, icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
}
else {
Ext.Msg.show({ title: '错误', msg: jsonresult.Message, icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK });
}
}
},
failure: function (response, options) {
Ext.Msg.show({ title: '警告', msg: '服务器响应出错,请重试', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
},
success: function (response, options) {
},
scope: this
}); //end Ext.Ajax.request
},
onDeleteClick: function (button, event) {
var selections = this.gridList.getSelectionModel().getSelection();
if (selections.length == 0) {
Ext.Msg.show({ title: '提示', msg: '请先选择单据!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
return;
}
var record = selections[0];
Ext.MessageBox.confirm('提示', '确定删除该记录吗?', function (btn) {
if (btn == 'yes') {
Ext.Msg.wait('正在删除数据...');
Ext.Ajax.request({
waitMsg: '正在删除数据...',
url: '/Import/XXH/Delete',
params: {
data: Ext.JSON.encode(record.data)
},
callback: function (options, success, response) {
if (success) {
var jsonresult = Ext.JSON.decode(response.responseText);
if (jsonresult.Success) {
this.storeList.remove(record);
Ext.Msg.show({ title: '提示', msg: jsonresult.Message, icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
}
else {
Ext.Msg.show({ title: '错误', msg: jsonresult.Message, icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK });
}
}
},
failure: function (response, options) {
Ext.Msg.show({ title: '警告', msg: '服务器响应出错,请重试', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
},
success: function (response, options) {
},
scope: this
}); //end Ext.Ajax.request
}
}, this);
}, //onDeleteClick
onResetClick: function (button, event) {
this.formSearch.getForm().reset();
},
getCondition: function () {
var sql = '';
var form = this.formSearch.getForm();
if (!form.isValid()) {
Ext.Msg.alert('提示', '查询条件赋值错误,请检查。');
return '';
}
var OP = form.findField('OP').getValue();
sql = sql + getAndConSql(sql, OP, "M.OP = '" + OP + "'");
var ContractNo = form.findField('ContractNo').getValue();
sql = sql + getAndConSql(sql, ContractNo, "M.ContractNo like '%" + ContractNo + "%'");
/*
var HTH = form.findField('HTH').getValue();
sql = sql + getAndConSql(sql, HTH, "M.HTH like '%" + HTH + "%'");
var port = form.findField('port').getValue();
sql = sql + getAndConSql(sql, port, "m.port = " + port + "");*/
var HTH = Ext.getCmp('S_HTH').getValue();
sql = sql + getAndConSql(sql, HTH, "M.HTH like '%" + HTH + "%'");
/*
var port = Ext.getCmp('S_port').getValue();
sql = sql + getAndConSql(sql, port, "m.port = " + port + "");*/
var port = this.comboxPort.getValue();
if (port != "") {
sql = sql + getAndConSql(sql, port, "m.port in (" + port + ")");
}
var CnameList = this.Cname.getValue();
var CnameString = "";
for (var i in CnameList) {
if (CnameString == "") { CnameString = "'" + CnameList[i] + "'"; }
else { CnameString = CnameString + ",'" + CnameList[i] + "'"; }
}
if (CnameString != "") {
sql = sql + getAndConSql(sql, CnameString, "cg.name in (" + CnameString + ")");
}
var company = this.getStrValue(this.comboxCompany.getValue());
sql = sql + getAndConSql(sql, company, "M.company in (" + company + ")");
var countryid = this.getStrValue(this.comboxCountry.getValue());
sql = sql + getAndConSql(sql, countryid, "M.countryid in (" + countryid + ")");
var SailingDate_min = form.findField('SailingDate_min').getRawValue();
sql = sql + getAndConSql(sql, SailingDate_min, "m.SailingDate >= '" + SailingDate_min + "'");
var SailingDate_max = form.findField('SailingDate_max').getRawValue();
sql = sql + getAndConSql(sql, SailingDate_max, "m.SailingDate <= '" + SailingDate_max + " 23:59:59'");
var Mainstate = this.comboxMainstate.getValue();
//sql = sql + getAndConSql(sql, Mainstate, "m.Mainstate = " + Mainstate + "");
sql = sql + getAndConSql(sql, Mainstate, "m.Mainstate in (" + Mainstate + ")");
var seller = this.getStrValue(this.comboxSeller.getValue());
sql = sql + getAndConSql(sql, seller, "M.seller in (" + seller + ")");
var buyer = this.getStrValue(this.comboxBuyer.getValue());
sql = sql + getAndConSql(sql, buyer, "M.buyer in (" + buyer + ")");
var TRADINGAGENCY = this.getStrValue(this.comboxTRADINGAGENCY.getValue());
sql = sql + getAndConSql(sql, TRADINGAGENCY, "M.TRADINGAGENCY in (" + TRADINGAGENCY + ")");
var BillNo = form.findField('BillNo').getRawValue();
sql = sql + getAndConSql(sql, BillNo, "m.BillNo like '%" + BillNo + "%'");
var ContainerNo = form.findField('ContainerNo').getRawValue();
sql = sql + getAndConSql(sql, ContainerNo, "m.ContainerNo like '%" + ContainerNo + "%'");
var SealNo = form.findField('SealNo').getValue();
sql = sql + getAndConSql(sql, SealNo, "m.SealNo like '%" + SealNo + "%'");
// alert(sql);
var STT = form.findField("STT").getValue();
if (STT)
{ sql = sql + getAndConSql(sql, STT, " m.STT is not null and m.STT<>'' "); }
/*
var KCClear = form.findField("KCClear").getValue();
if (KCClear)
{ sql = sql + getAndConSql(sql, KCClear, " m.KCClear = 1 "); }
else { sql = sql + getAndConSql(sql, "True", " m.KCClear = 0 "); }
*/
var ISDELETE = form.findField("ISDELETE").getValue();
if (ISDELETE)
{ sql = sql + getAndConSql(sql, ISDELETE, " m.ISDELETE = 1 "); }
else { sql = sql + getAndConSql(sql, "True", " m.ISDELETE = 0 "); }
var ReceiptStatus = form.findField("ReceiptStatus").getValue();
if (ReceiptStatus)
{ sql = sql + getAndConSql(sql, ReceiptStatus, " (m.ReceiptStatus is null or m.ReceiptStatus=0 )"); }
var ArrivalDate_min = form.findField('ArrivalDate_min').getRawValue();
sql = sql + getAndConSql(sql, ArrivalDate_min, "m.ArrivalDate >= '" + ArrivalDate_min + "'");
var ArrivalDate_max = form.findField('ArrivalDate_max').getRawValue();
sql = sql + getAndConSql(sql, ArrivalDate_max, "m.ArrivalDate <= '" + ArrivalDate_max + " 23:59:59'");
var remark = form.findField('remark').getValue();
sql = sql + getAndConSql(sql, remark, "(m.remark like '%" + remark + "%' or m.remark_2 like '%"
+ remark + "%' or m.remark_3 like '%" + remark + "%' or m.remark_4 like '%" + remark + "%' or m.Receiptremark like '%" + remark + "%' )");
if (this.remind != "") {
sql = sql + getAndConSql(sql, this.remind, this.remind);
}
var ACCDATE_min = form.findField('ACCDATE_min').getRawValue();
sql = sql + getAndConSql(sql, ACCDATE_min, "m.ACCDATE >= '" + ACCDATE_min + "'");
var ACCDATE_max = form.findField('ACCDATE_max').getRawValue();
sql = sql + getAndConSql(sql, ACCDATE_max, "m.ACCDATE <= '" + ACCDATE_max + " 23:59:59'");
return sql;
},
getStrValue: function (list) {
var _list = [];
for (var _i = 0; _i < list.length; _i++) {
_list.push("'" + list[_i] + "'");
}
return _list;
},
onGetremind: function (field, newValue, oldValue) {
if (newValue != null) {
this.storeList.load({
params: { start: 0, limit: this.PageSize, sort: '', condition: newValue },
waitMsg: "正在查询数据...",
scope: this
});
}
},
OprationSwap: function () {
var ret = new Array();
ret[0] = this.OprationStatus;
ret[1] = this.storeList;
ret[2] = this.SelectedRecord;
return ret;
},
// alert(this.OprationStatus.ToString());
// alert(this.storeList.toString());
// alert(this.SelectedRecord.toString());
onExportClick: function (button, event) {
GridExportExcelPage(this.gridList);
},
Print: function () {
var printType = 'XXH_LRBB'; //合同 完成合同利润报表
var MainList = "";
var selectedRecords = [];
selectedRecords = this.gridList.selModel.getSelection();
for (var i = 0; i < selectedRecords.length; i++) {
var rec = selectedRecords[i];
if (MainList == "") { MainList = "'" + rec.get('ContractNo') + "'"; }
else {
MainList = MainList + ",'" + rec.get('ContractNo') + "'";
}
}
var T = this.getCondition();
if (T != "") { T = " where " + T; };
var sql1 = " select v.bsno,m.hth 合同号,m.buyer 委托单位,dbo.trimdate(m.ACCDATE) 合同完成时间,m.OP 操作人 ";
sql1 = sql1 + " ,v.FHPROFIT 付汇利润,v.LCPROFIT 冷藏利润,v.OTPROFIT 代理利润,v.OTherPROFIT 其他利润,v.hk_profit 货款利润,v.rz_profit 融资款利润 ";
sql1 = sql1 + " from vxxhprofitsum v ";
sql1 = sql1 + " left join Import_main m on m.ContractNo=v.bsno ";
sql1 = sql1 + T;
if (MainList != "" && T == "") {
sql1 = sql1 + " where " + "m.contractno in(" + MainList + ")";
}
if (MainList != "" && T != "") {
sql1 = sql1 + " and " + "m.contractno in(" + MainList + ")";
}
sql1 = sql1 + " order by M.buyer,M.accdate,M.contractno ";
var sql2 = "";
var sql3 = "";
var sql4 = "";
var sql5 = "";
var sql6 = "";
PrintComm(printType, sql1, sql2, sql3, sql4, sql5, sql6);
}
});