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/create/createIndex.js

1706 lines
60 KiB
JavaScript

2 years ago
Ext.namespace('DsTruck');
DsTruck.createIndex = function (config) {
Ext.applyIf(this, config);
this.initUIComponents();
window.DsTruck.createIndex.superclass.constructor.call(this);
};
Ext.extend(DsTruck.createIndex, Ext.Panel, {
PageSize: 100,
OprationStatus: null, //仅当弹出界面时使用
SelectedRecord: null,
ChfeeCount: 0,
initUIComponents: function () {
//定义数据集
this.storeList = Ext.create('Ext.data.Store', {
model: 'XXHmb',
remoteSort: true,
pageSize: this.PageSize,
proxy: {
type: 'ajax',
url: '/Import/XXH/GetDataList',
reader: {
idProperty: 'id' + 'cgid',
root: 'data',
totalProperty: 'totalCount'
}
}
});
this.formname = "Create";
this.storeList_Edit = Ext.create('Ext.data.Store', {
model: 'XXH_CreateEditmb',
remoteSort: true,
pageSize: this.PageSize,
proxy: {
type: 'ajax',
url: '/Import/XXH/GetDataList',
reader: {
idProperty: 'id' + 'cgid',
root: 'data',
totalProperty: 'totalCount'
}
}
});
this.formname_Edit = "Create_Edit";
parentWin = window.parent;
mainWin = getMainForm(parentWin);
//#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',
listeners: {
specialkey: function (field, e) {
if (e.getKey() == e.ENTER) {
_this.onRefreshClick();
}
}
}
});
this.storeMainstate = Ext.create('DsExt.ux.RefEnumStore', {});
this.storeMainstate.load({ params: { enumTypeId: 3} });
this.comboxMainstate = Ext.create('Ext.ux.form.field.BoxSelect', {
fieldLabel: '合同状态',
autosize: true,
bodyPadding: 5,
flex: 1,
width: 200,
labelWidth: 80,
store: this.storeMainstate,
queryMode: 'local',
triggerOnClick: false,
valueField: 'EnumValueId',
displayField: 'EnumValueName',
listeners: {
specialkey: function (field, e) {
if (e.getKey() == e.ENTER) {
_this.onRefreshClick();
}
}
}
});
//表参照
this.storeCountry = Ext.create('DsExt.ux.RefTableStore', {
model: 'ConutryRef',
proxy: { url: '/CommMng/BasicDataRef/GetCountryRefList' }
});
this.storeCountry.load({ params: { condition: ""} });
this.comboxCountry = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: '进口国',
store: this.storeCountry,
name: 'countryid',
valueField: 'countryid',
displayField: 'country_idandname',
listeners: {
specialkey: function (field, e) {
if (e.getKey() == e.ENTER) {
_this.onRefreshClick();
}
}
}
});
this.storeCargoinfo = Ext.create('DsExt.ux.RefTableStore', {
model: 'CargoRef',
proxy: { url: '/CommMng/BasicDataRef/GetCargoRefList' }
});
//this.storeCargoinfo.load({ params: { condition: ""} });
var _pub_hscode = mainWin.GetPubStore("HSCODE");
this.storeCargoinfo.loadData(_pub_hscode.data.items);
this.comboxCargoinfo = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: 'HS代码',
matchFieldWidth: false,
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);
},
specialkey: function (field, e) {
if (e.getKey() == e.ENTER) {
_this.onRefreshClick();
}
},
scope: this
}
});
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.01,
//width: 500,
labelWidth: 70,
store: this.storeCname,
queryMode: 'local',
triggerOnClick: false,
valueField: 'FieldId',
displayField: 'FieldValue',
listeners: {
beforequery: function (e) {
return FilterCombox(e);
},
specialkey: function (field, e) {
if (e.getKey() == e.ENTER) {
_this.onRefreshClick();
}
}
}
});
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('Ext.ux.form.field.BoxSelect', {
fieldLabel: '操作人',
forceSelection: true,
queryMode: 'local',
autosize: true,
store: this.storeUser,
name: 'OP',
flex: 2.005,
labelWidth:80,
valueField: 'UserName',
displayField: 'CodeAndName',
listeners: {
beforequery: function (e) {
return FilterCombox(e);
},
specialkey: function (field, e) {
if (e.getKey() == e.ENTER) {
_this.onRefreshClick();
}
}
}
});
this.storeReceiver = Ext.create('DsExt.ux.RefTableStore', {
model: 'DsTruckMng.ux.UserRefModel',
proxy: { url: '/CommMng/BasicDataRef/GetUserRefList' }
});
this.storeReceiver.load({ params: { condition: "" } });
this.comboxReceiver = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: '接单人',
forceSelection: true,
labelWidth:80,
store: this.storeReceiver, flex: 1,
name: 'Receiver',
valueField: 'UserCode',
displayField: 'CodeAndName',
listeners: {
beforequery: function (e) {
return FilterCombox(e);
},
specialkey: function (field, e) {
if (e.getKey() == e.ENTER) {
_this.onRefreshClick();
}
}
}
});
this.storeBUZTYPE = Ext.create('DsExt.ux.RefEnumStore', {});
this.storeBUZTYPE.load({ params: { enumTypeId: 27} });
this.comboxBUZTYPE = Ext.create('DsExt.ux.RefEnumCombox', {
fieldLabel: '业务类型',
forceSelection: true,
store: this.storeBUZTYPE,
name: 'BUZTYPE',
listeners: {
beforequery: function (e) {
return FilterCombox(e);
},
specialkey: function (field, e) {
if (e.getKey() == e.ENTER) {
_this.onRefreshClick();
}
}
}
});
//客户加载_代理
this.storeAGENT = Ext.create('DsExt.ux.RefTableStore', {
model: 'Tradermb',
proxy: { url: '/CommMng/BasicDataRef/GetTrader' }
});
this.storeAGENT.load({ params: { condition: " isagentcn=1 "} });
this.comboxAGENT = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: '代理',
flex: 1,
//disabled: true,
forceSelection: true,
store: this.storeAGENT,
name: 'AGENT',
valueField: 'name',
displayField: 'codename',
matchFieldWidth: false,
listeners: {
beforequery: function (e) {
return FilterCombox(e);
},
specialkey: function (field, e) {
if (e.getKey() == e.ENTER) {
_this.onRefreshClick();
}
}
}
});
this.storeSeller = Ext.create('DsExt.ux.RefTableStore', {
model: 'Tradermb',
proxy: { url: '/CommMng/BasicDataRef/GetTrader' }
});
//this.storeSeller.load({ params: { condition: " isagent=1" } });
this.storeSeller.loadData(mainWin.GetPubStore("IMPORT_SELLER").data.items);
this.comboxSeller = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: '贸易商',
forceSelection: true,
store: this.storeSeller,
name: 'seller',
valueField: 'name',
displayField: 'codename',
matchFieldWidth: false,
listeners: {
beforequery: function (e) {
return FilterCombox(e);
},
specialkey: function (field, e) {
if (e.getKey() == e.ENTER) {
_this.onRefreshClick();
}
}
}
});
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', {
this.storeBuyer.loadData(mainWin.GetPubStore("IMPORT_BUYER").data.items);
this.comboxBuyer = Ext.create('Ext.ux.form.field.BoxSelect', {
fieldLabel: '客户',
autosize: true,
flex: 1,
labelWidth: 70,
store: this.storeBuyer,
queryMode: 'local',
name: 'buyer',
triggerOnClick: false,
valueField: 'name',
displayField: 'codename',
matchFieldWidth: false,
listeners: {
beforequery: function (e) {
return FilterCombox(e);
},
specialkey: function (field, e) {
if (e.getKey() == e.ENTER) {
_this.onRefreshClick();
}
}
}
});
//#endregion
Ext.grid.RowNumberer = Ext.extend(Ext.grid.RowNumberer, {
width: 30
});
this.column = [
{
sortable: true,
dataIndex: 'ContractNo',
header: '合同序列号',
width: 120
}, {
sortable: true,
dataIndex: 'HTH',
header: '合同号',
width: 80
}, {
sortable: true,
dataIndex: 'HTDATE',
header: '合同日期',
renderer: Ext.util.Format.dateRenderer('Y-m-d'),
width: 80
},
{
sortable: true,
dataIndex: 'companyname',
header: '用证公司',
width: 80
}, {
sortable: true,
dataIndex: 'CORPNAME',
header: '当前货所属公司',
width: 100
},
{
sortable: true,
dataIndex: 'seller',
header: '贸易商',
width: 80
},
{
sortable: true,
dataIndex: 'buyer',
header: '客户(购货方)',
width: 80
}, {
sortable: true, dataIndex: 'id', header: 'id', hidden: true
},
{
dataIndex: 'TimeMark', header: 'TimeMark', hidden: true
},
{
sortable: true,
dataIndex: 'cgid',
header: 'cgid',
hidden: true,
width: 80
},
{
sortable: true,
dataIndex: 'name',
header: '货物名称',
width: 80
}, {
sortable: true,
dataIndex: 'weight',
header: '净重(吨)',
width: 80
},
{
sortable: true,
dataIndex: 'cicode',
header: '商品手册编号',
width: 80
},
{
sortable: true,
dataIndex: 'ciname',
header: '商品手册名称',
width: 80
},
{
sortable: true,
dataIndex: 'countryid',
header: 'countryid',
hidden: true,
width: 80
},
{
sortable: true,
dataIndex: 'country',
header: '进口国',
width: 80
}, {
sortable: true,
dataIndex: 'portRef',
header: '目的港',
width: 80
}, {
sortable: true,
dataIndex: 'MainstateRef',
header: '合同工作状态',
width: 80
}, {
sortable: true,
dataIndex: 'TRADINGAGENCY',
header: '订货方(中间商)',
width: 80
}, {
sortable: true,
dataIndex: 'FactoryNo',
header: '厂号',
width: 120
},
{
dataIndex: 'ICP',
header: '备案号',
width: 120
},
{
sortable: true, id: '',
dataIndex: 'RCVMode', hidden: true,
header: 'RCVMode',
width: 140
}, {
sortable: true, id: '',
dataIndex: 'RCVModeREF',
header: '收单据模式',
width: 140
}, {
sortable: true, id: '',
dataIndex: 'OP',
header: '操作人',
width: 80
}, {
sortable: true, id: '',
dataIndex: 'AppNo',
header: '许可证号',
width: 80
}, {
sortable: true, id: '',
dataIndex: 'ValidDate',
header: '许可证有效期',
width: 80
}, {
sortable: true, id: '',
dataIndex: 'ZMQ',
header: '自贸区',
width: 80
}, {
sortable: true, id: '',
dataIndex: 'STT',
header: '双抬头',
width: 80
}, {
sortable: true,
dataIndex: 'HaveContract',
header: '有合同',
width: 60
},
{
sortable: true,
dataIndex: 'HaveCargoMark',
header: '有标签',
width: 60
},
{
sortable: true,
dataIndex: 'remark_2',
header: '备注2',
width: 120
},
{
sortable: true,
dataIndex: 'price',
header: '单价',
width: 80,
renderer: function (value, cellmeta, record, rowIndex, columnIndex, store) {
try {
var lsValue = usMoney(value, 2, '', false);
if (lsValue != "NaN") {
value = lsValue; if (parseFloat(lsValue) < 0) {
return '<SPAN style="COLOR: red">' + lsValue + '</SPAN>';
}
}
else {
return value;
}
}
catch (e) {
return value;
}
return value;
}
},
{
sortable: true,
dataIndex: 'price_agio',
header: '差价',
width: 80,
renderer: function (value, cellmeta, record, rowIndex, columnIndex, store) {
try {
var lsValue = usMoney(value, 2, '', false);
if (lsValue != "NaN") {
value = lsValue; if (parseFloat(lsValue) < 0) {
return '<SPAN style="COLOR: red">' + lsValue + '</SPAN>';
}
}
else {
return value;
}
}
catch (e) {
return value;
}
return value;
}
},
{
sortable: true,
dataIndex: 'Agent',
header: '代理',
width: 80
},
{
sortable: true,
dataIndex: 'Agent2',
header: '代理2',
width: 80
},
{
sortable: true,
dataIndex: 'Agent3',
header: '代理3',
width: 80
}
];
//定义Grid
this.MainCB = Ext.create('Ext.selection.CheckboxModel', { checkOnly: true });
this.Pagenum = Ext.create('Ext.form.field.Number', {
name: 'bottles',
fieldLabel: '每页记录数',
labelAlign: 'right',
value: this.PageSize,
maxValue: 100000,
width: 180,
minValue: 0,
listeners: {
specialkey: function (field, e) {
if (e.getKey() == e.ENTER) {
_this.onRefreshClick();
}
}
}
});
this.gridList = new Ext.grid.GridPanel({
store: this.storeList,
enableHdMenu: false,
region: 'center',
loadMask: { msg: "数据加载中,请稍等..." },
trackMouseOver: true,
disableSelection: false,
stripeRows: true,
viewConfig: {
enableTextSelection: true
},
selModel: this.MainCB,
columns: [new Ext.grid.RowNumberer()],
bbar: [Ext.create('Ext.PagingToolbar', {
id: "bbar1",
store: this.storeList,
displayInfo: true,
displayMsg: '当前显示 {0} - {1}条记录 /共 {2}条记录',
emptyMsg: "没有数据"
}), this.Pagenum]
});
/////////////以下部分为获取存储的gridpanel显示样式
this.column = DsTruck.GetGridPanel(GID, this.formname, this.column);
this.column.unshift(new Ext.grid.RowNumberer());
this.gridList.reconfigure(this.storeList, this.column);
////////////////////////////
/////////////////////////
this.storeContainerType = Ext.create('DsExt.ux.RefTableStore', {
model: 'DsTruckMng.ux.CtnRefModel',
proxy: { url: '/CommMng/BasicDataRef/GetCtnDispList' }
});
this.storeContainerType.load({ params: { condition: ""} });
this.comboxContainerType = Ext.create('DsExt.ux.RefTableCombox', {
//fieldLabel: '箱型',
store: this.storeContainerType,
name: 'CTN',
valueField: 'CtnName',
//disabled: true,
displayField: 'CtnName'
});
Ext.grid.RowNumberer2 = Ext.extend(Ext.grid.RowNumberer, {
width: 50
});
this.column_Edit = [
{
sortable: true, hidden: true,
dataIndex: 'id',
header: 'id',
width: 80
}, {
sortable: true,
dataIndex: 'ContractNo',
header: '合同序列号',
width: 120
}, {
sortable: true,
dataIndex: 'HTH',
header: '合同号',
width: 100,
editor: {
xtype: 'textfield',
selectOnFocus: true
}
}, {
sortable: true,
dataIndex: 'HTDATE',
header: '合同日期',
width: 100,
editor: {
xtype: 'datefield',
format: 'Y-m-d',
selectOnFocus: true
},
renderer: Ext.util.Format.dateRenderer('Y-m-d')
}, {
sortable: true,
dataIndex: 'STT',
header: '双抬头',
width: 100,
editor: {
xtype: 'textfield',
selectOnFocus: true
}
},
{
sortable: true,
dataIndex: 'companyname',
header: '用证公司',
width: 80
},
{
sortable: true,
dataIndex: 'seller',
header: '贸易商',
width: 80
},
{
sortable: true,
dataIndex: 'buyer',
header: '客户(购货方)',
width: 80
},
{
dataIndex: 'TimeMark', header: 'TimeMark', hidden: true
},
{
sortable: true,
dataIndex: 'cgid',
header: 'cgid',
hidden: true,
width: 80
},
{
sortable: true,
dataIndex: 'name',
header: '货物名称',
width: 80,
editor: {
xtype: 'textfield',
selectOnFocus: true
}
}, {
sortable: true,
dataIndex: 'weight',
header: '净重(吨)',
width: 80
},
{
sortable: true,
dataIndex: 'cicode',
header: '商品手册编号',
width: 80
},
{
sortable: true,
dataIndex: 'ciname',
header: '商品手册名称',
width: 80
},
{
sortable: true,
dataIndex: 'countryid',
header: 'countryid',
hidden: true,
width: 80
},
{
sortable: true,
dataIndex: 'country',
header: '进口国',
width: 80
}, {
sortable: true,
dataIndex: 'portRef',
header: '目的港',
width: 80
}, {
sortable: true,
dataIndex: 'Ex_sailingdate',
header: '预计开船日',
width: 80,
renderer: Ext.util.Format.dateRenderer('Y-m-d'),
editor: {
xtype: 'datefield',
selectOnFocus: true
}
}, {
sortable: true,
dataIndex: 'portRef',
header: '目的港',
width: 80
}, {
sortable: true,
dataIndex: 'MainstateRef',
header: '合同工作状态',
width: 80
}, {
sortable: true,
dataIndex: 'TRADINGAGENCY',
header: '订货方(中间商)',
width: 80
}, {
sortable: true,
dataIndex: 'FactoryNo',
header: '厂号',
width: 80
}, {
sortable: true,
dataIndex: 'ICP',
header: '备案号',
width: 80
}, {
sortable: true, id: '',
dataIndex: 'RCVMode', hidden: true,
header: 'RCVMode',
width: 140
}, {
sortable: true, id: '',
dataIndex: 'RCVModeREF',
header: '收单据模式',
width: 140
}, {
sortable: true, id: '',
dataIndex: 'OP',
header: '操作人',
width: 80
}, {
sortable: true, id: '',
dataIndex: 'AppNo',
header: '许可证号',
width: 80
}, {
sortable: true, id: '',
dataIndex: 'ValidDate',
header: '许可证有效期',
width: 80
}, {
sortable: true, id: '',
dataIndex: 'ZMQ',
header: '自贸区',
width: 80
},
{
sortable: true, hidden: true,
dataIndex: 'creator',
header: 'creator',
width: 80
},
{
sortable: true, //hidden: true,
dataIndex: 'creattime',
header: '接单日期',
width: 80
},
{
sortable: true, hidden: true,
dataIndex: 'Mainstate',
header: 'Mainstate',
width: 80
}, {
dataIndex: 'remark',
header: '备注1',
width: 280,
editor: {
xtype: 'textfield',
selectOnFocus: true
}
},
{
sortable: true, hidden: true,
dataIndex: 'TransactionMethod',
header: 'TransactionMeth',
width: 80
},
{
sortable: true, hidden: true,
dataIndex: 'PaymentMethods',
header: 'PaymentMethods',
width: 80
},
{
sortable: true, hidden: true,
dataIndex: 'FinanceStatus',
header: 'FinanceStatus',
width: 80
},
{
sortable: true, hidden: true,
dataIndex: 'BUZTYPE',
header: 'BUZTYPE',
width: 80
},
{
sortable: true, hidden: true,
dataIndex: 'HaveContract',
header: 'BUZTYPE',
width: 80
},
{
sortable: true, hidden: true,
dataIndex: 'HaveCargoMark',
header: 'BUZTYPEREF',
width: 80
},
{
sortable: true,
dataIndex: 'CTN',
header: 'CTN',
width: 80,
editor: this.comboxContainerType
}];
//定义Grid
this.cellEditing_1 = Ext.create('Ext.grid.plugin.CellEditing', {
clicksToEdit: 1
});
this.gridList_Edit = new Ext.grid.GridPanel({
store: this.storeList_Edit,
hidden: true,
enableHdMenu: false,
region: 'center',
loadMask: { msg: "数据加载中,请稍等..." },
trackMouseOver: true,
disableSelection: false,
stripeRows: true,
viewConfig: {
enableTextSelection: true
},
plugins: [this.cellEditing_1],
columns: this.column_Edit,
bbar: Ext.create('Ext.PagingToolbar', {
id: "bbar2",
store: this.storeList_Edit,
displayInfo: true,
displayMsg: '当前显示 {0} - {1}条记录 /共 {2}条记录',
emptyMsg: "没有数据"
})
});
/////////////以下部分为获取存储的gridpanel显示样式
this.column_Edit = DsTruck.GetGridPanel(GID, this.formname_Edit, this.column_Edit);
this.column_Edit.unshift(new Ext.grid.RowNumberer2());
this.gridList_Edit.reconfigure(this.storeList_Edit, this.column_Edit);
////////////////////////////
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';
//DsOpenEditWin('/Import/create/Edit');
DsOpenEditWin("/Import/create/Edit", record.data.ContractNo, "700", "1100","150","150");
}, this);
/* this.gridList.addListener('itemdblclick', function (dataview, record, item, index, e, b) {
alert(record.get("ContractNo"))
}, this);*/
//#region formSearch
this.formSearch = Ext.widget('form', {
frame: true,
region: 'center',
bodyStyle: 'overflow-x:visible; overflow-y:scroll',
bodyPadding: 5,
fieldDefaults: {
margins: '2 2 2 2',
labelAlign: 'right',
flex: 1,
labelWidth: 70,
msgTarget: 'qtip'
},
items: [
//fieldset 1
{
xtype: 'container',
defaultType: 'textfield',
layout: 'anchor',
defaults: {
anchor: '100%'
},
items: [{
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [{
fieldLabel: '合同号',
name: 'HTH',
listeners: {
specialkey: function (field, e) {
if (e.getKey() == e.ENTER) {
_this.onRefreshClick();
}
}
}
},
{
fieldLabel: '用证公司',
name: 'companyname',
listeners: {
specialkey: function (field, e) {
if (e.getKey() == e.ENTER) {
_this.onRefreshClick();
}
}
}
},
//this.comboxCompany,
this.comboxCountry,
{
fieldLabel: '合同序列号',
name: 'ContractNo',
listeners: {
specialkey: function (field, e) {
if (e.getKey() == e.ENTER) {
_this.onRefreshClick();
}
}
}
}, {
fieldLabel: '从..接单日期',
format: 'Y-m-d', labelWidth: 80,
xtype: 'datefield',
name: 'creattime_min',
listeners: {
specialkey: function (field, e) {
if (e.getKey() == e.ENTER) {
_this.onRefreshClick();
}
}
}
}, {
fieldLabel: '到..接单日期',
format: 'Y-m-d', labelWidth: 80,
xtype: 'datefield',
name: 'creattime_max',
listeners: {
specialkey: function (field, e) {
if (e.getKey() == e.ENTER) {
_this.onRefreshClick();
}
}
}
}
]
}]
}, //end items(fieldset 1)
//fieldset 2
{
xtype: 'container',
defaultType: 'textfield',
layout: 'anchor',
defaults: {
anchor: '100%'
},
items: [{
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [this.comboxBUZTYPE, this.comboxport,
this.comboxSeller,
this.comboxBuyer,
this.comboxMainstate,
this.comboxReceiver
]
}]
},
//end fieldset 2
//end items(fieldset 1_2)
//fieldset 3
{
xtype: 'container',
defaultType: 'textfield',
layout: 'anchor',
defaults: {
anchor: '100%'
},
items: [{
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [this.comboxRemind, {
fieldLabel: '从..开船日',
format: 'Y-m-d',
xtype: 'datefield',
name: 'ExsailingDate_min',
listeners: {
specialkey: function (field, e) {
if (e.getKey() == e.ENTER) {
_this.onRefreshClick();
}
}
}
}, {
fieldLabel: '到..开船日',
format: 'Y-m-d',
xtype: 'datefield',
name: 'ExsailingDate_max',
listeners: {
specialkey: function (field, e) {
if (e.getKey() == e.ENTER) {
_this.onRefreshClick();
}
}
}
},
{ fieldLabel: '订货方(中间商)',
name: 'TRADINGAGENCY', labelWidth: 95,
listeners: {
specialkey: function (field, e) {
if (e.getKey() == e.ENTER) {
_this.onRefreshClick();
}
}
}
}, this.comboxOP]
}]
}, //end items(fieldset 3)
//fieldset 5
{
xtype: 'container',
defaultType: 'textfield',
layout: 'anchor',
defaults: {
anchor: '100%'
},
items: [{
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [{ fieldLabel: '厂号',
name: 'FactoryNo', flex: 1,
listeners: {
specialkey: function (field, e) {
if (e.getKey() == e.ENTER) {
_this.onRefreshClick();
}
}
}
},{
fieldLabel: '备案号',
name: 'ICP', flex: 1,
listeners: {
specialkey: function (field, e) {
if (e.getKey() == e.ENTER) {
_this.onRefreshClick();
}
}
}
}, this.Cname
, {
fieldLabel: '货物名称包含',
name: 'CargoName', flex: 1, labelWidth: 80,
listeners: {
specialkey: function (field, e) {
if (e.getKey() == e.ENTER) {
_this.onRefreshClick();
}
}
}
}, {
fieldLabel: '备注中包含', labelWidth: 80,
name: 'remark', flex: 1,
listeners: {
specialkey: function (field, e) {
if (e.getKey() == e.ENTER) {
_this.onRefreshClick();
}
}
}
}]
}]
}, {//fieldset 1_2
xtype: 'container',
defaultType: 'textfield',
layout: 'anchor',
defaults: {
anchor: '100%'
},
items: [{
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [this.comboxAGENT, {
fieldLabel: '无标签',
xtype: 'checkbox',
name: 'NoMark',
flex: 1
}, {
fieldLabel: '无合同',
xtype: 'checkbox',
name: 'NoHTH',
flex: 1
}, {
fieldLabel: '无预计开船日',
xtype: 'checkbox',
labelWidth: 90,
name: 'NoEXSaillingdate',
flex: 1
}
, {
xtype: 'hiddenfield',
flex: 2
}
]
}]
}
]//end root items
});
//#endregion formSearch
//查询工具条
var menu1 = new Ext.menu.Menu({
id: 'basicMenu',
items: [{
text: '对账单',
handler: clickHandler
}
]
});
function clickHandler() {
panelTest.Print();
};
var _this = this;
this.CB_EditMode = new Ext.form.Checkbox({
//fieldLabel: '编辑模式',
//labelwidth: 40,
id: "CheckEdit",
hideLabel: true, //boxLabel: '编辑模式',
//width:70,
listeners: {
change: function (newValue, oldValue, eOpts)//change事件
{
if (newValue.checked) {
Ext.getCmp('SaveBtn').show();
_this.gridList.hide();
_this.gridList_Edit.show();
_this.onRefreshClick();
} else {
Ext.getCmp('SaveBtn').hide();
_this.gridList.show();
_this.gridList_Edit.hide();
_this.onRefreshClick();
}
}
}
});
this.panelBtn = new Ext.Panel({
region: "north",
tbar: [
{
text: "新建",
iconCls: "btnadd",
handler: function (button, event) {
this.OprationStatus = 'add';
DsOpenEditWin("/Import/create/Edit", "新建合同", "700", "1100","100","100");
},
scope: this
}, {
text: "复制新建",
iconCls: "btnadd",
handler: 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];
this.SelectedRecord = record;
this.OprationStatus = 'copyadd';
DsOpenEditWin("/Import/create/Edit", record.data.ContractNo, "700", "1100","100","100");
},
scope: this
},
{
text: "删除",
iconCls: "btndelete",
handler: function (button, event) {
this.onDeleteClick(button, event);
},
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);
//alert(this.getCondition);
},
scope: this
}, {
text: "保存列表样式",
id: "btntest",
handler: function (button, event) {
var mode = Ext.getCmp('CheckEdit').getValue();
if (mode == true) {
var tempcolumns = this.gridList_Edit.columns;
DsTruck.SaveGridPanel(GID, this.formname_Edit, tempcolumns, this.column_Edit, 1, false);
}
else {
var tempcolumns = this.gridList.columns;
DsTruck.SaveGridPanel(GID, this.formname, tempcolumns, this.column, 1, false);
}
},
scope: this
}, '-',
{ text: "打印报表", menu: menu1, scope: this }
, '-', {xtype:'label',text: '编辑模式'},
{
text: "保存修改", id: "SaveBtn", hidden: true,
iconCls: "btnsave",
handler: function (button, event) {
this.onSaveClick(button, event);
},
scope: this
},
this.CB_EditMode,'-',
{
text: "打印",
id: "print",
iconCls: "btnprint",
handler: function (button, event) {
this.onPrintClick();
},
scope: this
},
{
text: "跳转至对应港口操作",
id: "delorg",
iconCls: "delorg",
handler: 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 c_No = selections[0].data.ContractNo;
this.SelectedRecord = selections[0];
this.OprationStatus = 'edit';
DsOpenEditWin('/Import/PortOperate/Edit', c_No, "750", "1000");
},
scope: this
}
]
});
this.panelTop = new Ext.Panel({
layout: "border",
region: "north",
height: 175,
items: [this.formSearch, this.panelBtn]
});
Ext.apply(this, {
items: [this.panelTop, this.gridList, this.gridList_Edit]
});
this.storeList.on('beforeload', function (store) {
var sql = this.getCondition();
Ext.apply(store.proxy.extraParams, { condition: sql });
}, this);
this.storeList_Edit.on('beforeload', function (store) {
var sql = this.getCondition();
Ext.apply(store.proxy.extraParams, { condition: sql });
}, this);
}, //end initUIComponents
onPrintClick: function () {
PrintComm('MSCREATELIST', "select ROW_NUMBER() over(order by CREATETIME desc) 序号,M.ContractNo as 合同序列号,HTH as 合同号,comp.name as 用证公司,seller as 贸易商,buyer as '客户(购货方)',cg.name as 货物名称,cg.[weight]/1000 as '净重(吨)',ci.code as 商品手册编号,ci.name as 商品手册名称,c.country as 进口国, (select EnumValueName from tSysEnumValue where LangId=0 and EnumTypeID=10 and EnumValueID=M.port) as 目的港,(select EnumValueName from tSysEnumValue where LangId=0 and EnumTypeID=3 and EnumValueID=M.MainState) as 合同工作状态,M.TRADINGAGENCY as '订货方(中间商)',cg.FactoryNo as 厂号,cg.ICP as 备案号,(select EnumValueName from tSysEnumValue where LangId=0 and EnumTypeID=23 and EnumValueID=M.RCVMode) as 收单据模式,M.OP as 操作人,ap.AppNo as 许可证号,ap.ValidDate as 许可证有效期,case when ap.remark like '%自贸%' then ap.remark else '' end as 自贸区,STT as 双抬头,HaveContract as 有合同,M.remark_2 as 备注2,cg.price as 单价,cg.price_agio as 差价, M.Agent as 代理,M.Agent2 as 代理2,M.Agent3 as 代理3 from Import_main M left join company comp on comp.gid=M.company left join import_cargo cg on cg.contractno=M.contractno left join import_cargoinfo ci on ci.id=cg.cargoinfo_id left join import_appstate ast on ast.cargo_id=cg.id left join import_approval ap on ap.id=ast.app_id left join code_country c on M.countryid=c.countryid where" + this.getCondition());
},
checkHandler: function () {
alert('Checked a menu item');
},
onRefreshClick: function (button, event) {
var sql = this.getCondition();
this.PageSize = this.Pagenum.getValue();
this.storeList.pageSize = this.PageSize;
this.storeList_Edit.pageSize = this.PageSize;
var mode = Ext.getCmp('CheckEdit').getValue();
if (mode == true) {
this.storeList_Edit.load({
params: { start: 0, limit: this.PageSize, sort: '', condition: sql },
waitMsg: "正在查询数据...",
scope: this
});
}
else {
this.storeList.load({
params: { start: 0, limit: this.PageSize, sort: '', condition: sql },
waitMsg: "正在查询数据...",
scope: this
});
}
},
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 _L = selections.length;
Ext.MessageBox.confirm('提示', '确定删除这' + _L + '条记录吗?', function (btn) {
if (btn == 'yes') {
//var record = selections[0];
for (var i = 0; i < _L; i++) {
var record = selections[i];
var ContractNo = record.data.ContractNo;
var HTH = record.data.HTH;
var sql = " BSNO='" + ContractNo + "'";
Ext.Ajax.request({
waitMsg: '正在查询数据...',
url: '/Import/XXH/GetChfee',
scope: this,
async: false,
params: { condition: sql },
waitMsg: "正在查询数据...",
callback: function (options, success, response) {
if (success) {
var jsonresult = Ext.JSON.decode(response.responseText);
var returnData = jsonresult.data;
//alert(returnData.Count);
this.ChfeeCount = parseInt(returnData.Count);
if (this.ChfeeCount != "") {
alert("序列号<" + ContractNo + ">的业务包含未删除的费用,不能删除");
return;
} else {
Ext.Msg.wait('正在删除数据...');
Ext.Ajax.request({
waitMsg: '正在删除数据...',
url: '/Import/XXH/Delete',
params: {
data: Ext.JSON.encode(record.data),
USERID: GID
},
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
}
} else {
Ext.Msg.show({ title: '请重试',
msg: '服务器响应出错',
icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK
});
return;
}
}
});
}
//this.storeList.remove(record);
//if (i >= _L ) {
// Ext.Msg.show({ title: '提示', msg: "数据删除结束", icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
//}
};
Ext.Msg.show({ title: '提示', msg: "数据删除结束", icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
this.onRefreshClick(button, event);
}, this);
}, //onDeleteClick
onResetClick: function (button, event) {
this.formSearch.getForm().reset();
},
getCondition: function () {
var form = this.formSearch.getForm();
if (!form.isValid()) {
Ext.Msg.alert('提示', '查询条件赋值错误,请检查。');
return '';
}
var sql = ' M.ISDELETE=0 ';
var OP = form.findField('OP').getValue();
//sql = sql + getAndConSql(sql, OP, "M.OP = '" + OP + "'");
var opstr = '';
for (var i = 0; i < OP.length; i++) {
opstr = opstr + "'" + OP[i] + "',";
}
opstr = opstr.substr(0,opstr.length-1);
sql = sql + getAndConSql(sql, OP, "M.OP in (" + opstr + ")");
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 company = form.findField('companyname').getValue();
sql = sql + getAndConSql(sql, company, "comp.name like '%" + company + "%'");
var countryid = form.findField('countryid').getValue();
sql = sql + getAndConSql(sql, countryid, "m.countryid like '%" + countryid + "%'");
var BUZTYPE = form.findField('BUZTYPE').getValue();
sql = sql + getAndConSql(sql, BUZTYPE, "m.BUZTYPE = " + BUZTYPE + "");
var port = form.findField('port').getValue();
sql = sql + getAndConSql(sql, port, "m.port = " + port + "");
var Mainstate = this.comboxMainstate.getValue();
if (Mainstate != "") {
sql = sql + getAndConSql(sql, Mainstate, "m.Mainstate in (" + Mainstate + ")");
}
var seller = form.findField('seller').getValue();
sql = sql + getAndConSql(sql, seller, "M.seller like '%" + seller + "%'");
var buyer = form.findField('buyer').getValue();
sql = sql + getAndConSql(sql, buyer, "M.buyer like '%" + buyer + "%'");
var receiver = this.comboxReceiver.getValue();
sql = sql + getAndConSql(sql, receiver, "M.Creator like '%" + receiver + "%'");
var TRADINGAGENCY = form.findField('TRADINGAGENCY').getRawValue();
sql = sql + getAndConSql(sql, TRADINGAGENCY, "M.TRADINGAGENCY like '%" + TRADINGAGENCY + "%'");
var ExsailingDate_min = form.findField('ExsailingDate_min').getRawValue();
sql = sql + getAndConSql(sql, ExsailingDate_min, "m.Ex_sailingdate >= '" + ExsailingDate_min + "'");
var ExsailingDate_max = form.findField('ExsailingDate_max').getRawValue();
sql = sql + getAndConSql(sql, ExsailingDate_max, "m.Ex_sailingdate <= '" + ExsailingDate_max + " 23:59:59'");
var creattime_min = form.findField('creattime_min').getRawValue();
sql = sql + getAndConSql(sql, creattime_min, "m.creattime >= '" + creattime_min + "'");
var creattime_max = form.findField('creattime_max').getRawValue();
sql = sql + getAndConSql(sql, creattime_max, "m.creattime <= '" + creattime_max + " 23:59:59'");
var remark = form.findField('remark').getValue();
sql = sql + getAndConSql(sql, remark, "m.remark like '%" + remark + "%'");
var FactoryNo = form.findField('FactoryNo').getValue();
sql = sql + getAndConSql(sql, FactoryNo, "cg.FactoryNo like '%" + FactoryNo + "%'");
var ICP = form.findField('ICP').getValue();
sql = sql + getAndConSql(sql, ICP, "cg.ICP like '%" + ICP + "%'");
var Remind = form.findField('Remind').getValue();
sql = sql + getAndConSql(sql, Remind, Remind);
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 CargoName = form.findField('CargoName').getValue();
sql = sql + getAndConSql(sql, CargoName, "cg.name like '%" + CargoName + "%'");
var NoMark = form.findField("NoMark").getValue();
if (NoMark)
{ sql = sql + getAndConSql(sql, NoMark, " isnull(m.HaveCargoMark,0)=0 "); }
var NoHTH = form.findField("NoHTH").getValue();
if (NoHTH)
{ sql = sql + getAndConSql(sql, NoHTH, " isnull(m.HaveContract,0)=0 "); }
var NoEXSaillingdate = form.findField("NoEXSaillingdate").getValue();
if (NoEXSaillingdate)
{ sql = sql + getAndConSql(sql, NoEXSaillingdate, " isnull(m.Ex_sailingdate,'')='' "); }
var AGENT = form.findField('AGENT').getValue();
sql = sql + getAndConSql(sql, AGENT, " (M.AGENT like '%" + AGENT + "%' or M.AGENT2 like '%" + AGENT + "%' or M.AGENT3 like '%" + AGENT + "%')");
return sql;
},
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;
},
Print: function () {
//alert("print");
var printType = 'XXH_YS_KHDZ'; //应收 客户对账
var T = this.getCondition();
if (T != "") { T = " where " + T; };
var sql1 = "select M.buyer,M.hth,* from [vImprotRPT_KHDZ] v ";
sql1 = sql1 + " left join import_main m on m.contractno=v.bsno ";
sql1 = sql1 + " where bsno in(select contractno from import_main m " + T + " )";
var sql2 = "";
var sql3 = "";
var sql4 = "";
var sql5 = "";
var sql6 = "";
PrintComm(printType, sql1, sql2, sql3, sql4, sql5, sql6);
},
onSaveClick: function () {
var bodyList = [];
for (i = 0; i < this.storeList_Edit.getCount(); i += 1) {
var member = this.storeList_Edit.getAt(i);
bodyList.push(member);
};
var jsonBody = ConvertRecordsToJson(bodyList);
if (jsonBody == '') {
return;
}
Ext.Msg.wait('正在保存数据, 请稍侯..');
Ext.Ajax.request({
waitMsg: '正在保存数据...',
url: '/Import/create/SaveList',
scope: this,
params: {
data: jsonBody
},
callback: function (options, success, response) {
if (success) {
Ext.MessageBox.hide();
var jsonresult = Ext.JSON.decode(response.responseText);
if (jsonresult.Success) {
//this.storeEditList.commitChanges();
this.onRefreshClick();
} else {
Ext.Msg.show({ title: '错误', msg: jsonresult.Message, icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK });
}
} else {
Ext.Msg.show({ title: '请重试',
msg: '服务器响应出错',
icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK
});
}
//alert('03');
}
});
}
});