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/createIndex2.js

1579 lines
54 KiB
JavaScript

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: 500,
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: 'XXHmb',
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";
//#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: 2,
width: 500,
labelWidth: 90,
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: ""} });
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.storeCompany = Ext.create('DsExt.ux.RefTableStore', {
model: 'companymb',
proxy: { url: '/CommMng/BasicDataRef/GetcompanyList' }
});
this.storeCompany.load({ params: { condition: ""} });
this.comboxCompany = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: '用证公司',
store: this.storeCompany,
name: 'company',
valueField: 'gid',
displayField: 'name',
listeners: {
specialkey: function (field, e) {
if (e.getKey() == e.ENTER) {
_this.onRefreshClick();
}
}
}
});
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,
//width: 500,
labelWidth: 99,
store: this.storeCname,
queryMode: 'local',
triggerOnClick: false,
valueField: 'FieldId',
displayField: 'FieldValue',
listeners: {
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('DsExt.ux.RefTableCombox', {
fieldLabel: '操作人',
forceSelection: true,
store: this.storeUser,
name: 'OP',
valueField: 'UserName',
displayField: 'CodeAndName',
listeners: {
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: {
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: ""} });
this.comboxAGENT = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: '代理',
//disabled: true,
forceSelection: true,
store: this.storeAGENT,
name: 'AGENT',
valueField: 'name',
displayField: 'codename'
});
//#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: 'companyname',
header: '用证公司',
width: 80
},
{
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: 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, 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
}, {
sortable: true,
dataIndex: 'BillNo',
header: '提单号',
width: 80
},
{
sortable: true,
dataIndex: 'ContainerNo',
header: '箱号',
width: 80
},
{
sortable: true,
dataIndex: 'ArrivalDate',
header: '到港日',
width: 80
},
{
sortable: true,
dataIndex: 'ShipCompanyRef',
header: '船公司',
width: 80
},
{
sortable: true,
dataIndex: 'BillType',
header: '提单提交方式',
width: 80
},
{
sortable: true,
dataIndex: 'E_Billtime',
header: '电放时间',
width: 80
},
{
sortable: true,
dataIndex: 'Billtime',
header: '正本时间',
width: 80
},
{
sortable: true,
dataIndex: 'TRADECOUNTRY_REF',
header: '贸易国',
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.storeSeller = Ext.create('DsExt.ux.RefTableStore', {
model: 'Tradermb',
proxy: { url: '/CommMng/BasicDataRef/GetTrader' }
});
this.storeSeller.load({ params: { condition: " isagent=1"} });
this.comboxSeller = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: '贸易商',
forceSelection: true,
store: this.storeSeller,
name: 'seller',
valueField: 'name',
displayField: 'codename'
});
/////////////////////////
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: '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, 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/Edit2", record.data.ContractNo, "500", "1000");
}, 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',
bodyPadding: 5,
fieldDefaults: {
margins: '2 2 2 2',
labelAlign: 'right',
flex: 1,
labelWidth: 100,
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();
}
}
}
}, this.comboxOP,
this.comboxCompany,
this.comboxCountry,
{
fieldLabel: '合同序列号',
name: 'ContractNo',
listeners: {
specialkey: function (field, e) {
if (e.getKey() == e.ENTER) {
_this.onRefreshClick();
}
}
}
}, {
fieldLabel: '从..接单日期',
format: 'Y-m-d',
xtype: 'datefield',
name: 'creattime_min',
listeners: {
specialkey: function (field, e) {
if (e.getKey() == e.ENTER) {
_this.onRefreshClick();
}
}
}
}, {
fieldLabel: '到..接单日期',
format: 'Y-m-d',
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,
{ fieldLabel: '贸易商',
name: 'seller',
listeners: {
specialkey: function (field, e) {
if (e.getKey() == e.ENTER) {
_this.onRefreshClick();
}
}
}
},
{ fieldLabel: '客户',
name: 'buyer',
listeners: {
specialkey: function (field, e) {
if (e.getKey() == e.ENTER) {
_this.onRefreshClick();
}
}
}
},this.comboxAGENT,
this.comboxMainstate
]
}]
},
//end fieldset 2
{//fieldset 1_2
xtype: 'container',
defaultType: 'textfield',
layout: 'anchor',
defaults: {
anchor: '100%'
},
items: [{
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [{
fieldLabel: '无标签',
xtype: 'checkbox',
name: 'NoMark',
flex: 1
}, {
fieldLabel: '无合同',
xtype: 'checkbox',
name: 'NoHTH',
flex: 1
}, {
fieldLabel: '无预计开船日',
xtype: 'checkbox',
name: 'NoEXSaillingdate',
flex: 1
}
, {
xtype: 'hiddenfield',
flex: 3
}
]
}]
}, //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',
listeners: {
specialkey: function (field, e) {
if (e.getKey() == e.ENTER) {
_this.onRefreshClick();
}
}
}
}, {
xtype: 'hiddenfield',
flex: 2
}]
}]
}, //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();
}
}
}
}, this.Cname
, {
fieldLabel: '货物名称包含',
name: 'CargoName', flex: 1,
listeners: {
specialkey: function (field, e) {
if (e.getKey() == e.ENTER) {
_this.onRefreshClick();
}
}
}
}, {
fieldLabel: '备注中包含',
name: 'remark', flex: 1,
listeners: {
specialkey: function (field, e) {
if (e.getKey() == e.ENTER) {
_this.onRefreshClick();
}
}
}
}, {
xtype: 'hiddenfield',
flex: 1
}]
}]
} //end items(fieldset 5)
]//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: 50, id: "CheckEdit",
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/Edit2", "新建合同", "500", "1000");
},
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 }
, '-',
{
text: "保存修改", id: "SaveBtn", hidden: true,
iconCls: "btnsave",
handler: function (button, event) {
this.onSaveClick(button, event);
},
scope: this
},
this.CB_EditMode
]
});
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
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 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('company').getValue();
sql = sql + getAndConSql(sql, company, "M.company = '" + 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').getRawValue();
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 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 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');
}
});
}
});