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.

2138 lines
90 KiB
JavaScript

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

Ext.namespace('Shipping');
Shipping.MsChFeeYsAutoDuiEdit = function (config) {
Ext.applyIf(this, config);
this.initUIComponents();
window.Shipping.MsChFeeYsAutoDuiEdit.superclass.constructor.call(this);
};
var sqlParms = '';
var selCustName = '';
var dMainId = '';
var KaiPiaoCurr = 0;//开票币别0rmb 1:usd
Ext.extend(Shipping.MsChFeeYsAutoDuiEdit, Ext.Panel, {
PageSize: 2000,
OprationStatus: 'add', //仅当弹出界面时使用
SelectedRecord: null,
selectbsnostr: '',
selectfeestr: '',
sqlcontext: '',
parentWin: null,
initUIComponents: function () {
_thisfee = this;
Ext.Ajax.timeout = 12000000;
this.formname = 'MsChFeeYsDuiEdit';
//#region 对账明细grid
this.storeListDetails = Ext.create('Ext.data.Store', {
model: 'MsChFeeYsAutoDuiDetails',
remoteSort: false,
proxy: {
type: 'ajax',
url: '/MvcShipping/MsChFeeYsAutoDui/GetDetailsList',
reader: {
id: 'ZhuTiDanHao',
root: 'data',
totalProperty: 'totalCount'
}
}
});
this.gridListDetails = new Ext.grid.GridPanel({
store: this.storeListDetails,
height: 730,
enableHdMenu: false,
region: 'center',
loadMask: { msg: "数据加载中,请稍等..." },
trackMouseOver: true,
disableSelection: false,
selType: 'cellmodel',
columns: [
{
sortable: true,
dataIndex: 'YeWuLeiXing',
header: '业务名称',
width: 100
}, {
sortable: true,
dataIndex: 'ZhuTiDanHao',
header: '主提单号',
width: 160
}, {
sortable: true,
dataIndex: 'FenTiDanHao',
header: '分提单号',
width: 160
}, {
sortable: true,
dataIndex: 'KaiChuanRiQi',
header: '开船日期',
width: 80
}, {
sortable: true,
dataIndex: 'YingShouRMB',
header: '应收RMB',
width: 80
}, {
sortable: true,
dataIndex: 'YingShouUSD',
header: '应收USD',
width: 80
}, {
sortable: true,
dataIndex: 'YingShouQiTa',
header: '应收其他',
width: 80
}, {
sortable: true,
dataIndex: 'YingFuRMB',
header: '应付RMB',
width: 80
}, {
sortable: true,
dataIndex: 'YingFuUSD',
header: '应付USD',
width: 80
}, {
sortable: true,
dataIndex: 'YingFuQiTa',
header: '应付其他',
width: 80
}, {
sortable: true,
dataIndex: 'ZhuangYunFangShi',
header: '装运方式',
width: 120
}, {
sortable: true,
dataIndex: 'WeiTuoBianHao',
header: '委托编号',
width: 120
},
{
sortable: true,
dataIndex: 'ChuanMing',
header: '船名',
width: 120
}, {
sortable: true,
dataIndex: 'HangCi',
header: '航次',
width: 80
}, {
sortable: true,
dataIndex: 'JiZhuangXiang',
header: '集装箱',
width: 80
}, {
sortable: true,
dataIndex: 'LanHuoRen',
header: '揽货人',
width: 80
}, {
sortable: true,
dataIndex: 'CaoZuo',
header: '操作',
width: 80
}, {
sortable: true,
dataIndex: 'DanZheng',
header: '单证',
width: 80
}, {
sortable: true,
dataIndex: 'HangXian',
header: '航线',
width: 80
}, {
sortable: true,
dataIndex: 'KeFu',
header: '客服',
width: 80
}, {
sortable: true,
dataIndex: 'ZhuangHuoGang',
header: '装货港',
width: 80
}, {
sortable: true,
dataIndex: 'XieHuoGang',
header: '卸货港',
width: 80
}, {
sortable: true,
dataIndex: 'SALECORP',
header: '核算对象',
width: 80
}
]
});
this.winDetailsShow = Ext.create('Ext.window.Window', {
title: "对账明细",
width: 1350,
height: 800,
//plain : true,
resizable: false,
draggable: true, // 是否可以拖动
collapsible: true, // 允许缩放条
closeAction: 'close',
closable: true,
modal: 'true',
buttonAlign: "center",
bodyStyle: "padding:0 0 0 0",
items: [this.gridListDetails],
buttons: [{
text: "关闭",
minWidth: 70,
handler: function () {
me.winDetailsShow.close();
}
}]
});
//#endregion
//#region 邮箱签名设置窗体
this.CheckBill = new Ext.form.Checkbox({
fieldLabel: '抄送本人', //'货代提单',
checked: true
});
this.formMailSignShow = Ext.widget('form', {
frame: true,
region: 'center',
height: 350,
autoScroll: true,
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: [
this.CheckBill,{
xtype: 'container',
layout: 'hbox',
defaultType: 'htmleditor',
items: [{
fieldLabel: '邮箱签名',
name: 'MailSign',
height: 250,
id: 'MailSign',
enableColors: true, //启用前景色,背景色选择按钮
enableFont: true, //启用字体选择按钮
enableFontSize: true, //启用字体增大和缩小按钮
enableFormat: true, //启用粗体,斜体,下划线按钮
enableLinks: true//启用创建连接按钮
}
]
}
]//end items(fieldset 1)
}//end fieldset 1
]//end root items
});
me = this;
this.winMailSignShow = Ext.create('Ext.window.Window', {
title: "邮箱签名设置",
width: 700,
height: 350,
//plain : true,
iconCls: "addicon",
resizable: false,
// draggable:false,// 是否可以拖动
collapsible: true, // 允许缩放条
closeAction: 'close',
closable: true,
modal: 'true',
buttonAlign: "center",
bodyStyle: "padding:0 0 0 0",
items: [this.formMailSignShow],
buttons: [{
text: "关闭",
minWidth: 70,
handler: function () {
me.winMailSignShow.close();
}
}, {
text: "保存",
minWidth: 70,
handler: function () {
alert(1);
}
}, {
text: "保存并发送",
minWidth: 70,
handler: function () {
me.onSendDui();
}
}]
});
//#endregion
//#region 下载窗体
this.formDownloadShow = Ext.widget('form', {
frame: true,
region: 'center',
height: 150,
autoScroll: true,
bodyPadding: 5,
fieldDefaults: {
margins: '2 2 2 2',
labelAlign: 'right',
flex: 1,
labelWidth: 90,
msgTarget: 'qtip'
},
items: [{
xtype: 'container',
defaultType: 'textfield',
layout: 'anchor',
id: 'downloadfile',
defaults: {
anchor: '100%'
},
items: [{
xtype: 'label',
html: '',
width: 120,
text: ''
}]
}]
});
this.winDownloadShow = Ext.create('Ext.window.Window', {
title: "下载文件",
width: 450,
height: 150,
//plain : true,
iconCls: "addicon",
resizable: false,
// draggable:false,// 是否可以拖动
collapsible: true, // 允许缩放条
closeAction: 'close',
closable: true,
modal: 'true',
buttonAlign: "center",
bodyStyle: "padding:0 0 0 0",
items: [this.formDownloadShow],
buttons: [{
text: "关闭",
minWidth: 70,
handler: function () {
me.winDownloadShow.close();
}
}]
});
//#endregion
//定义数据集
this.storeList = Ext.create('Ext.data.Store', {
model: 'MsChFeeYsAutoDui',
pageSize: this.PageSize,
remoteSort: true,
proxy: {
type: 'ajax',
url: '/MvcShipping/MsChFeeYsAutoDui/GetDataList',
reader: {
id: 'DUINO',
root: 'data',
totalProperty: 'totalCount'
}
}
});
this.initgirdcolums = [
{
sortable: true,
dataIndex: 'DuiZhangBianHao',
header: '对账编号',
width: 120
},
{
sortable: true,
dataIndex: 'KeHuJianCheng',
header: '客户简称',
width: 160
}, {
sortable: true,
dataIndex: 'KeHuQuanCheng',
header: '客户全称',
width: 160
}, {
sortable: true,
dataIndex: 'LanHuoRen',
header: '揽货人',
width: 60
}, {
sortable: true,
dataIndex: 'YingShouKaiPiao',
header: '应收开票',
width: 60
}, {
sortable: true,
dataIndex: 'YingShouRMB',
header: '应收RMB',
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; },
align: 'right',
summaryType: 'sum',
summaryRenderer: function (value, cellmeta, record, rowIndex, columnIndex, store) {
value = usMoney(value, 2, '', true);
return value;
},
width: 80
}, {
sortable: true,
dataIndex: 'YingShouUSD',
header: '应收USD',
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; },
align: 'right',
summaryType: 'sum',
summaryRenderer: function (value, cellmeta, record, rowIndex, columnIndex, store) {
value = usMoney(value, 2, '', true);
return value;
},
width: 80
}, {
sortable: true,
dataIndex: 'YingFuRMB',
header: '应付RMB',
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; },
align: 'right',
summaryType: 'sum',
summaryRenderer: function (value, cellmeta, record, rowIndex, columnIndex, store) {
value = usMoney(value, 2, '', true);
return value;
},
width: 80
}, {
sortable: true,
dataIndex: 'YingFuUSD',
header: '应付USD',
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; },
align: 'right',
summaryType: 'sum',
summaryRenderer: function (value, cellmeta, record, rowIndex, columnIndex, store) {
value = usMoney(value, 2, '', true);
return value;
},
width: 80
}, {
sortable: true,
dataIndex: 'DuiZhangLianXiRen',
header: '对账联系人',
width: 80
}, {
sortable: true,
dataIndex: 'DuiZhangLianXiYouXiang',
header: '对账联系邮箱',
width: 120
}, {
sortable: true,
dataIndex: 'DuiZhangLianXiDianHua',
header: '对账联系电话',
width: 120
}, {
sortable: true,
dataIndex: 'DuiZhangBeiZhu',
header: '对账备注',
width: 120,
editor: {
xtype: 'textfield'
}
}, {
sortable: true,
dataIndex: 'DuiZhangRiQi',
header: '对账日期',
width: 120
},
{
sortable: true,
dataIndex: 'JieFeiLeiXing',
header: '结费类型',
width: 60
}
// , {
// sortable: true,
// dataIndex: 'YiJieSuan',
// header: '已结算',
// width: 80
// }, {
// sortable: true,
// dataIndex: 'ZhangQi',
// header: '账期',
// width: 80
// }, {
// sortable: true,
// dataIndex: 'YingJieRiQi',
// header: '应结日期',
// width: 120
// }
];
this.girdcolums = this.initgirdcolums;
this.GridCheckBoxModel = Ext.create('Ext.selection.CheckboxModel');
//定义Grid
this.Pagenum = Ext.create('Ext.form.field.Number', {
name: 'bottles',
fieldLabel: Zi.LAN.NumberOfpage, //每页记录数
labelAlign: 'right',
value: this.PageSize,
maxValue: 100000,
width: 180,
minValue: 0,
listeners: {
specialkey: function (field, e) {
if (e.getKey() == e.ENTER) {
_this.onRefreshClick();
}
}
}
});
//明细表表格
this.gridDetailsListCellEditing = Ext.create('Ext.grid.plugin.CellEditing', {
clicksToEdit: 1
});
this.gridList = new Ext.grid.GridPanel({
store: this.storeList,
enableHdMenu: false,
region: 'center',
loadMask: { msg: Zi.LAN.LoadData }, //数据加载中,请稍等...
trackMouseOver: true,
plugins: [this.gridDetailsListCellEditing],
disableSelection: false,
columns: this.girdcolums,
selModel: this.GridCheckBoxModel,
viewConfig: {
autoFill: true,
enableTextSelection: true, //允许复制数据
getRowClass: function (record, rowIndex, rowParams, store) {
var BILLSTATUSREF = record.get('BILLSTATUSREF');
if (BILLSTATUSREF == "锁定")
return 'feestatus_refer';
}
},
// paging bar on the bottom
bbar: [Ext.create('Ext.PagingToolbar', {
store: this.storeList,
displayInfo: true,
displayMsg: Zi.LAN.FenYe, //当前显示 {0} - {1}条记录 /共 {2}条记录
emptyMsg: Zi.LAN.Nodata//没有数据
}), this.Pagenum]
});
this.girdcolums = DsTruck.GetGridPanel(USERID, this.formname, this.girdcolums, 1); //使用者id表名中间column数组跳过一开始的几列
this.gridList.reconfigure(this.storeList, this.girdcolums);
this.gridList.addListener('itemdblclick', function (dataview, record, item, index, e, b) {
this.SelectedRecord = record;
this.OprationStatus = 'edit';
var duizhangbianhao = record.data.DuiZhangBianHao;
var condition = sqlParms + " and C.DEBITNO ='" + duizhangbianhao + "'";
this.storeListDetails.load({
params: { start: 0, limit: this.PageSize, sort: '', condition: condition },
waitMsg: Zi.LAN.NowSelect, //正在查询数据...
scope: this
});
//DsOpenEditWin('/MvcShipping/MsChFeeYsAutoDui/EditDetails', "自动对账明细", "650", "900");
this.winDetailsShow.show();
}, this);
this.gridList.on('edit', function (editor, e, eOpts) {
this.WMSINAfterEdit(editor, e, eOpts);
}, this);
//#region formSearch
//客户加载_委托单位
this.storeCustCode = Ext.create('DsExt.ux.RefTableStore', {
model: 'DsShipping.ux.CustomRefModel',
proxy: { url: '/CommMng/BasicDataRef/GetCustomRefListRm' }
});
// this.storeCustCode.load({ params: { condition: ""} });
//委托单位
this.comboxDuiZhangKeHu = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: Zi.LAN.duizkehu, //对账客户
store: this.storeCustCode,
name: 'DuiZhangKeHu',
queryMode: 'remote',
minChars: 0,
queryParam: 'CODENAME',
valueField: 'CustName',
displayField: 'CodeAndName',
enableKeyEvents: true,
listeners: {
//specialkey: function (field, e) {
keyup: function (field, e) {
if (e.getKey() == e.ENTER) {
_this.onRefreshClick();
}
}
}
});
//#endregion
//#region 收付方向
this.storeShouFuFangXiang = Ext.create('Ext.data.Store', {
fields: ['DC', 'NAME']
});
this.storeShouFuFangXiang.add({ "DC": "0", "NAME": "全部" });
this.storeShouFuFangXiang.add({ "DC": "1", "NAME": "应收" });
this.storeShouFuFangXiang.add({ "DC": "2", "NAME": "应付" });
this.comboxShouFuFangXiang = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: "收付方向",
store: this.storeShouFuFangXiang,
valueField: 'DC',
displayField: 'NAME',
flex: 0.7,
forceSelection: true,
name: 'ShouFuFangXiang'
});
//#endregion
//#region 结费类型
this.storeJieFeiLeiXing = Ext.create('Ext.data.Store', {
fields: ['DC', 'NAME']
});
this.storeJieFeiLeiXing.add({ "DC": "0", "NAME": "全部" });
this.storeJieFeiLeiXing.add({ "DC": "1", "NAME": "月结" });
this.storeJieFeiLeiXing.add({ "DC": "2", "NAME": "票结" });
this.storeJieFeiLeiXing.add({ "DC": "3", "NAME": "半月结" });
this.storeJieFeiLeiXing.add({ "DC": "4", "NAME": "约定天数" });
this.comboxJieFeiLeiXing = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: "结费类型",
store: this.storeJieFeiLeiXing,
valueField: 'NAME',
displayField: 'NAME',
flex: 0.7,
forceSelection: true,
name: 'JieFeiLeiXing'
});
//#endregion
//#region 费用状态
this.storeFeiYongZhuangTai = Ext.create('Ext.data.Store', {
fields: ['DC', 'NAME']
});
this.storeFeiYongZhuangTai.add({ "DC": "0", "NAME": "全部" });
this.storeFeiYongZhuangTai.add({ "DC": "1", "NAME": "结算完毕" });
this.storeFeiYongZhuangTai.add({ "DC": "2", "NAME": "未结算完毕" });
this.storeFeiYongZhuangTai.add({ "DC": "3", "NAME": "已审核未结算" });
this.storeFeiYongZhuangTai.add({ "DC": "6", "NAME": "已审核未开票" });
this.storeFeiYongZhuangTai.add({ "DC": "11", "NAME": "仅已开发票" });
this.storeFeiYongZhuangTai.add({ "DC": "12", "NAME": "仅未开发票" });
this.storeFeiYongZhuangTai.add({ "DC": "13", "NAME": "仅已开发票未收款" });
this.storeFeiYongZhuangTai.add({ "DC": "14", "NAME": "仅已收款未开发票" });
this.storeFeiYongZhuangTai.add({ "DC": "15", "NAME": "仅未开票未申请未收款" });
this.storeFeiYongZhuangTai.add({ "DC": "16", "NAME": "仅已收款已开发票" });
this.storeFeiYongZhuangTai.add({ "DC": "17", "NAME": "仅未开票未收款" });
this.storeFeiYongZhuangTai.add({ "DC": "18", "NAME": "仅已付款未收发票" });
this.storeFeiYongZhuangTai.add({ "DC": "19", "NAME": "仅已收发票未付款" });
this.comboxFeiYongZhuangTai = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: "费用状态",
store: this.storeFeiYongZhuangTai,
valueField: 'DC',
displayField: 'NAME',
flex: 1,
forceSelection: true,
name: 'FeiYongZhuangTai'
});
//#endregion
//#region 是否已开票
this.storeKaiPiao = Ext.create('Ext.data.Store', {
fields: ['DC', 'NAME']
});
this.storeKaiPiao.add({ "DC": "0", "NAME": "全部" });
this.storeKaiPiao.add({ "DC": "1", "NAME": "是" });
this.storeKaiPiao.add({ "DC": "2", "NAME": "否" });
this.comboxKaiPiao = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: "是否开票",
store: this.storeKaiPiao,
valueField: 'DC',
displayField: 'NAME',
flex: 0.7,
forceSelection: true,
name: 'ShiFouYiKaiPiao'
});
//#endregion
this.storeISCHAOQI = Ext.create('Ext.data.Store', {
fields: ['DC', 'NAME']
});
this.storeISCHAOQI.add({ "DC": "0", "NAME": "全部" });
this.storeISCHAOQI.add({ "DC": "1", "NAME": "是" });
this.storeISCHAOQI.add({ "DC": "2", "NAME": "否" });
this.comboxISCHAOQI = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: "仅超期",
store: this.storeISCHAOQI,
valueField: 'DC',
displayField: 'NAME',
flex: 0.6,
forceSelection: true,
name: 'ISCHAOQI'
});
this.storeISZHIQI = Ext.create('Ext.data.Store', {
fields: ['DC', 'NAME']
});
this.storeISZHIQI.add({ "DC": "0", "NAME": "全部" });
this.storeISZHIQI.add({ "DC": "1", "NAME": "是" });
this.storeISZHIQI.add({ "DC": "2", "NAME": "否" });
this.comboxISZHIQI = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: "计算滞期",
store: this.storeISZHIQI,
valueField: 'DC',
displayField: 'NAME',
flex: 0.6,
forceSelection: true,
name: 'ISZHIQI'
});
//#region 币别
this.storeBiBie = Ext.create('Ext.data.Store', {
fields: ['DC', 'NAME']
});
this.storeBiBie.add({ "DC": "", "NAME": "全部" });
this.storeBiBie.add({ "DC": "RMB", "NAME": "RMB" });
this.storeBiBie.add({ "DC": "USD", "NAME": "USD" });
this.comboxBiBie = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: "币别",
store: this.storeBiBie,
valueField: 'DC',
displayField: 'NAME',
labelWidth: 40,
flex: 0.7,
forceSelection: true,
name: 'BiBie'
});
this.storeFeeNameRef = Ext.create('DsExt.ux.RefTableStore', {
model: 'DsShipping.ux.FeeTypeRefModel',
proxy: { url: '/MvcShipping/MsChFee/GetFeeTypeRefList' }
});
this.storeFeeNameRef.load({ params: { condition: "" } });
this.comboxFeeNameRef = Ext.create('DsExt.ux.RefTableCombox', {
store: this.storeFeeNameRef,
fieldLabel: '费用名称', //是否开垫付
forceSelection: true,
name: 'FEENAME',
valueField: 'Name',
displayField: 'CodeAndName'
});
//this.StoreBLTYPE = Ext.create('DsExt.ux.RefTableStore', {
// model: 'DsExtEnumModel',
// proxy: { url: '/CommMng/PubSys/GetEnumValueList' }
//});
//this.StoreBLTYPE.load({ params: { enumTypeId: 97042 } });
this.StoreBLTYPE = Ext.create('Ext.data.Store', {
fields: ['BLTYPE']
});
this.StoreBLTYPE.add({ "BLTYPE": "整箱" });
this.StoreBLTYPE.add({ "BLTYPE": "拼箱主票" });
this.StoreBLTYPE.add({ "BLTYPE": "拼箱分票" });
this.StoreBLTYPE.add({ "BLTYPE": "拼箱单票" });
this.StoreBLTYPE.add({ "BLTYPE": "舱单业务" });
this.StoreBLTYPE.add({ "BLTYPE": "代报关" });
this.StoreBLTYPE.add({ "BLTYPE": "陆运" });
this.comboxBLTYPE = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: '装运方式', //'装运方式',
store: this.StoreBLTYPE,
forceSelection: true,
name: 'BLTYPE',
valueField: 'BLTYPE',
displayField: 'BLTYPE',
value: ''
});
//#endregion
_this = this;
this.formEdit = Ext.widget('form', {
frame: true,
region: 'north',
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: [{
fieldLabel: '对账记录号',
name: 'mainDuiNo'
}, {
fieldLabel: '对账名称',
name: 'mainDuiName'
}, {
fieldLabel: '记录',
name: 'description',
flex: 2
}, {
fieldLabel: '对账日期',
format: 'Y-m-d',
xtype: 'datefield',
name: 'duiDate'
}
]
}
]//end items(fieldset 1)
}//end fieldset 1
]//end root items
});
Ext.define('MsCompanysEntity', {
extend: 'Ext.data.Model',
idProperty: 'GID',
fields: [
{ name: 'GID', type: 'string' }, //GID
{ name: 'CODENAME', type: 'string' }, //CODENAME
{ name: 'NAME', type: 'string' }, //NAME
{ name: 'FULLNAME', type: 'string' }, //FULLNAME
{ name: 'ENNAME', type: 'string' }, //公司英文名称
{ name: 'ADDRESS', type: 'string' }, //ADDRESS
{ name: 'ENADDRESS', type: 'string' }, //公司英文地址
{ name: 'POSTCODE', type: 'string' }, //POSTCODE
{ name: 'OFFICEPHONE', type: 'string' }, //OFFICEPHONE
{ name: 'FAX', type: 'string' }, //FAX
{ name: 'EMAIL', type: 'string' }, //EMAIL
{ name: 'WEBSITEURL', type: 'string' }, //WEBSITEURL
{ name: 'LICENSECODE', type: 'string' }, //LICENSECODE
{ name: 'TAXCODE', type: 'string' }, //TAXCODE
//{name: 'LOGO', type: 'byte[]' }, //徽标
{ name: 'CREATEUSER', type: 'string' }, //CREATEUSER
{ name: 'CREATETIME', type: 'DateTime' }, //CREATETIME
{ name: 'MODIFIEDUSER', type: 'string' }, //更新人gid
{ name: 'MODIFIEDTIME', type: 'DateTime' }, //更新时间
{ name: 'ISDELETED', type: 'bool' }, //ISDELETED
{ name: 'ISDISABLE', type: 'bool' }, //ISDISABLE
{ name: 'PARENTID', type: 'string' }, //PARENTID
{ name: 'BILLRISES', type: 'string' }, //发票抬头
{ name: 'CHEQUEPAYABLE', type: 'string' }, //支票抬头
{ name: 'PRTHEADXML1', type: 'string' }, //打印抬头1
{ name: 'PRTHEADXML2', type: 'string' }, //打印抬头2
{ name: 'PRTHEADXML3', type: 'string' }, //打印抬头3
{ name: 'PRTHEADXML4', type: 'string' }, //打印抬头4
{ name: 'PRTHEADXML5', type: 'string' }, //打印抬头5
{ name: 'BANKSHEAD', type: 'string' }, //BANKSHEAD
{ name: 'LOCALCURR', type: 'string' }, //本地货币
{ name: 'WORKFLOWMSG', type: 'string' }, //是否启用消息提示
{ name: 'GPSUSER', type: 'string' }, //GPSUser
{ name: 'GPSPASSWORD', type: 'string' }, //GPSPassWord
{ name: 'ORGANIZATIONCODE', type: 'string' },
{ name: 'MODIFIEDUSERNAME', type: 'string' },
{ name: 'DBNAME', type: 'string' },
{ name: 'LOGOURL', type: 'string' }
]
});
this.storeSaleCompany = Ext.create('DsExt.ux.RefTableStore', {
model: 'MsCompanysEntity',
proxy: { url: '/MvcShipping/MsCompanys/GetNoPicDataList' }
});
this.storeSaleCompany.load({ params: { condition: "" } });
this.comboxSaleCompany = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel:'所属分部', //'委托分公司',
store: this.storeSaleCompany,
forceSelection: true,
name: 'SALECORPID',
valueField: 'GID',
displayField: 'NAME'
});
Ext.define('SubComp', {
extend: 'Ext.data.Model',
fields: [
{ name: 'GID', type: 'string' },
{ name: 'NAME', type: 'string' },
{ name: 'ENNAME', type: 'string' }
]
});
this.StoreSubComp = Ext.create('DsExt.ux.RefTableStore', {
model: 'SubComp',
proxy: { url: '/MvcShipping/MsBaseInfo/GetCompanyEN' }
});
this.StoreSubComp.load({ params: { condition: "" } });
this.comboxSubComp = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: '所属公司',
store: this.StoreSubComp,
name: 'CORPID',
// flex: 0.5,
// labelWidth: 55,
valueField: 'GID',
displayField: 'NAME',
enableKeyEvents: true,
listeners: {
keyup: function (field, e) {
if (e.getKey() == e.ENTER) {
_this.onRefreshClick();
}
}
}
});
this.formSearch = Ext.widget('form', {
frame: true,
region: 'center',
bodyPadding: 5,
fieldDefaults: {
margins: '2 2 2 2',
labelAlign: 'right',
flex: 1,
labelWidth: 60,
msgTarget: 'qtip'
},
items: [
{//fieldset 1
xtype: 'container',
defaultType: 'textfield',
layout: 'anchor',
defaults: {
anchor: '100%'
},
items: [
{
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [{
fieldLabel: '从开船日', //到对账日期
labelWidth: 70,
format: 'Y-m-d',
xtype: 'datefield',
name: 'ETDFROM',
id: 'SETD1'
}, {
fieldLabel: '到开船日', //到对账日期
format: 'Y-m-d',
labelWidth: 70,
xtype: 'datefield',
name: 'ETDTO',
id: 'SETD2'
}, this.comboxDuiZhangKeHu, this.comboxShouFuFangXiang, this.comboxJieFeiLeiXing, this.comboxBLTYPE, this.comboxSaleCompany, this.comboxISCHAOQI, this.comboxISZHIQI,
{
xtype: 'button',
text: '生成对账', //执行查询
width: 80,
iconCls: "btnrefresh",
handler: function (button, event) {
this.Save('1');
},
scope: this
}
]
}, {
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [{
fieldLabel: '从会计期间',
xtype: 'monthfield',
labelWidth: 70,
name: 'PS_ACCDATEBGN',
labelWidth: 70,
enableKeyEvents: true,
listeners: {
specialkey: function (field, e) {
if (e.getKey() == e.ENTER) {
_this.onRefreshClick();
}
}
}
}, {
fieldLabel: '至会计期间',
xtype: 'monthfield',
labelWidth: 70,
name: 'PS_ACCDATEEND',
labelWidth: 70,
enableKeyEvents: true,
listeners: {
specialkey: function (field, e) {
if (e.getKey() == e.ENTER) {
_this.onRefreshClick();
}
}
}
},
this.comboxFeiYongZhuangTai, this.comboxKaiPiao, this.comboxBiBie, this.comboxFeeNameRef, this.comboxSubComp, {
fieldLabel: '折算汇率',
flex: 1.2,
name: 'EXCHANGERATE'
}
, {
xtype: 'button',
text: '发送账单', //执行查询
width:40,
// iconCls: "btnrefresh",
handler: function (button, event) {
this.winMailSignShow.show();
//this.onSendDui();
},
scope: this
}, {
xtype: 'button',
text: '导出账单', //执行查询
width:40,
// iconCls: "btnrefresh",
handler: function (button, event) {
this.onExportDui(button, event);
},
scope: this
}
]
}
]//end items(fieldset 1)
}//end fieldset 1
]//end root items
});
//#endregion formSearch
//查询工具条
_this = this;
this.panelBtn = new Ext.Panel({
region: "north",
tbar: [
{
text: '刷新数据', //执行查询
iconCls: "btnrefresh",
handler: function (button, event) {
this.onRefreshClick(button, event);
},
scope: this
},
{
text: '取消对账', //重置条件
iconCls: "btnreset",
handler: function (button, event) {
this.CancelDui();
},
scope: this
},
{
text: '保存',
id: 'btnSave',
iconCls: "btnsave",
handler: function (button, event) {
this.Save('0');
},
scope: this
},
{
text: '申请开票(RMB)',
id: 'btnShenQingKaiPiaoRMB',
iconCls: "btnrefresh",
handler: function (button, event) {
this.onShenIvoiceClick(0);
},
scope: this
},
{
text: '申请开票(USD)',
id: 'btnShenQingKaiPiaoUSD',
iconCls: "btnrefresh",
handler: function (button, event) {
this.onShenIvoiceClick(1);
},
scope: this
}, '-', {
text: Zi.LAN.Saveliststyle, //保存列表样式
id: "btntest",
menu: [
{ text: Zi.LAN.Save, //保存
handler: function (button, event) {
this.girdcolums = DsTruck.SaveGridPanel(USERID, _this.formname, _this.gridList.columns, _this.girdcolums, 1, true);
}
}, { text: Zi.LAN.Initialization,
handler: function (menu, event) {
_this.InitGrid(_this.initgirdcolums);
_this.girdcolums = DsTruck.SaveGridPanel(USERID, _this.formname, _this.gridList.columns, _this.initgirdcolums, 1, true);
}
}],
scope: this
},
{
text: '保存并关闭',
id: 'btnESaveAndClose',
handler: function (button, event) {
this.Save('2');
},
scope: this
}, {
text: '复制新建',
id: 'btnCopyNew',
handler: function (button, event) {
this.CopyNew();
},
scope: this
}
]
});
this.panelTop = new Ext.Panel({
layout: "border",
region: "north",
height: 145,
items: [this.formSearch, this.panelBtn, this.formEdit]
});
Ext.apply(this, {
items: [this.panelTop, this.gridList]
});
this.storeList.on('beforeload', function (store) {
var sql = this.sqlcontext;
Ext.apply(store.proxy.extraParams, { condition: sql });
}, this);
parentWin = window.parent.opener;
this.InitData();
}, //end initUIComponents
InitData: function () {
var condition = '';
if (parentWin) {
var ret = parentWin.OprationSwap();
if (this.OprationStatus != 'edit') {
this.OprationStatus = ret[0];
}
this.SelectedRecord = ret[1];
}
if (this.OprationStatus == 'edit') {
if (dMainId == '') {
dMainId = this.SelectedRecord.get('dMainId');
}
condition = " AND CD.DuiNo in (select duino from ch_dui_main_dui where dMainId = '" + dMainId + "') ";
this.LoadData(condition);
}
else {
this.LoadData(condition);
}
}, //end InitData
LoadData: function (condition) {
//editform
var _this = this;
this.LoadSign();
if (this.OprationStatus == 'edit') {
//var sql = " dMainId = '" + this.SelectedRecord.get('dMainId') + "'";
var sql = " dMainId = '" + dMainId + "'";
Ext.Ajax.request({
waitMsg: '正在查询主表数据...',
url: '/MvcShipping/MsChFeeYsAutoDui/GetMainData',
params: {
condition: sql,
opStatus: this.OprationStatus
},
callback: function (options, success, response) {
if (success) {
var result = Ext.JSON.decode(response.responseText);
if (!result.Success) {
Ext.Msg.show({
title: '提示',
msg: result.Message,
icon: Ext.MessageBox.ERROR,
buttons: Ext.Msg.OK
});
return;
} else {
var data = result.data;
this.formEdit.getForm().setValues(data);
this.formSearch.getForm().findField('ETDFROM').setValue(data.KaiChuanRiFrom);
this.formSearch.getForm().findField('ETDTO').setValue(data.KaiChuanRiTo);
this.formSearch.getForm().findField('DuiZhangKeHu').setValue(data.DuiZhangKeHu);
this.formSearch.getForm().findField('ShiFouYiKaiPiao').setValue(data.ShiFouYiKaiPiao);
this.formSearch.getForm().findField('JieFeiLeiXing').setValue(data.JieFeiLeiXing);
this.formSearch.getForm().findField('ShouFuFangXiang').setValue(data.ShouFuFangXiang);
this.formSearch.getForm().findField('FeiYongZhuangTai').setValue(data.FeiYongZhuangTai);
this.formSearch.getForm().findField('PS_ACCDATEBGN').setValue(data.accDate_Min);
this.formSearch.getForm().findField('PS_ACCDATEEND').setValue(data.accDate_Max);
this.formSearch.getForm().findField('SALECORPID').setValue(data.SALECORPID);
this.formSearch.getForm().findField('CORPID').setValue(data.CORPID);
this.formSearch.getForm().findField('BiBie').setValue(data.BiBie);
this.formSearch.getForm().findField('FEENAME').setValue(data.FEENAME);
this.formSearch.getForm().findField('ISCHAOQI').setValue(data.ISCHAOQI);
this.formSearch.getForm().findField('ISZHIQI').setValue(data.ISZHIQI);
this.formSearch.getForm().findField('EXCHANGERATE').setValue(data.EXCHANGERATE);
}
}
},
scope: this
});
//明细
this.storeList.load({
params: { start: 0, limit: this.PageSize, sort: '', condition: condition, optype: 'load', dMainId: dMainId },
waitMsg: Zi.LAN.NowSelect, //正在查询数据...
scope: this
});
Ext.getCmp('SETD1').disable();
Ext.getCmp('SETD2').disable();
} else {
Ext.Ajax.request({
waitMsg: '正在查询主表数据...',
url: '/MvcShipping/MsChFeeYsAutoDui/GetMainData',
params: {
condition: '',
opStatus: this.OprationStatus
},
callback: function (options, success, response) {
if (success) {
var result = Ext.JSON.decode(response.responseText);
if (!result.Success) {
Ext.Msg.show({
title: '提示',
msg: result.Message,
icon: Ext.MessageBox.ERROR,
buttons: Ext.Msg.OK
});
return;
} else {
var data = result.data;
dMainId = data.dMainId;
this.formEdit.getForm().setValues(data);
}
}
},
scope: this
});
}
},
CopyNew: function () {
this.OprationStatus = 'add';
Ext.Ajax.request({
waitMsg: '正在查询主表数据...',
url: '/MvcShipping/MsChFeeYsAutoDui/GetMainData',
params: {
condition: '',
opStatus: this.OprationStatus
},
callback: function (options, success, response) {
if (success) {
var result = Ext.JSON.decode(response.responseText);
if (!result.Success) {
Ext.Msg.show({
title: '提示',
msg: result.Message,
icon: Ext.MessageBox.ERROR,
buttons: Ext.Msg.OK
});
return;
} else {
var data = result.data;
dMainId = data.dMainId;
this.formEdit.getForm().setValues(data);
}
}
},
scope: this
});
this.storeList.removeAll();
},
InitGrid: function (grid) {
var agirdcolums = grid;
this.gridList.reconfigure(this.storeList, agirdcolums);
},
onClearSql: function () {
var form = this.formSearch.getForm();
form.reset();
}, //onDeleteClick
onRefreshClick: function (button, event) {
this.InitData();
},
onCreateDui: function (button, event) {
var sql = this.getCondition('1');
this.sqlcontext = sql;
this.PageSize = this.Pagenum.getValue();
this.storeList.pageSize = this.PageSize;
this.storeList.load({
params: { start: 0, limit: this.PageSize, sort: '', condition: sql, optype: 'create', dMainId: dMainId },
waitMsg: Zi.LAN.NowSelect, //正在查询数据...
scope: this,
callback: function (r, o, s) {
this.onRefreshClick();
}
});
this.OprationStatus = "edit";
},
onSendDui: function () {
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 selectedRecords = [];
selectedRecords = this.gridList.selModel.getSelection();
var selectStores = [];
for (var i = 0; i < selectedRecords.length; i++) {
selectStores.push(selectedRecords[i].data);
}
var signForm = this.formMailSignShow.getForm();
var Sign = signForm.findField('MailSign').value;
var ischeck = 0;
if (this.CheckBill.checked) ischeck = 1;
var ISZHIQI = this.formSearch.getForm().findField('ISZHIQI').getValue();
var EXCHANGERATE = this.formSearch.getForm().findField('EXCHANGERATE').getValue();
var ISCHAOQI = this.formSearch.getForm().findField('ISCHAOQI').getValue();
Ext.MessageBox.confirm('提示', '确定发送对账单吗?', function (btn) {
if (btn == 'yes') {
Ext.Msg.wait('正在发送...');
Ext.Ajax.request({
waitMsg: '正在发送...',
timeout: 1200000,
url: '/MvcShipping/MsChFeeYsAutoDui/SendExcel',
params: {
data: Ext.JSON.encode(selectStores),
sign: Sign,
cc: ischeck,
ISZHIQI: ISZHIQI,
EXCHANGERATE: EXCHANGERATE,
ISCHAOQI: ISCHAOQI
},
callback: function (options, success, response) {
if (success) {
var jsonresult = Ext.JSON.decode(response.responseText);
if (jsonresult.Success) {
Ext.Msg.show({ title: '提示', msg: jsonresult.Message, icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
me.winMailSignShow.close();
}
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);
//InitData();
},
onExportDui: function (button, event) {
var form = this.formSearch.getForm();
var sql = " C.ISDEBIT = 1 ";
var DuiZhangKeHu = form.findField('DuiZhangKeHu').getValue();
if (DuiZhangKeHu != "" && DuiZhangKeHu != null) {
sql = sql + getAndConSql(sql, DuiZhangKeHu, "C.CUSTOMERNAME = '" + DuiZhangKeHu + "'");
}
var SALECORPID = form.findField('SALECORPID').getValue();
if (SALECORPID != "" && SALECORPID != null) {
sql = sql + getAndConSql(sql, SALECORPID, "VB.SALECORPID = '" + SALECORPID + "'");
}
var CORPID = form.findField('CORPID').getValue();
if (CORPID != "" && CORPID != null) {
sql = sql + getAndConSql(sql, CORPID, "VB.CORPID = '" + CORPID + "'");
}
var BLTYPE = form.findField('BLTYPE').getValue();
if (BLTYPE != "" && BLTYPE != null) {
sql = sql + getAndConSql(sql, BLTYPE, "VB.BLTYPE = '" + BLTYPE + "'");
}
var ETDFROM = form.findField('ETDFROM').getRawValue();
if (ETDFROM != "" && ETDFROM != null) {
sql = sql + getAndConSql(sql, ETDFROM, "VB.ETD >='" + ETDFROM + "'");
}
var ETDTO = form.findField('ETDTO').getRawValue();
if (ETDTO != "" && ETDTO != null) {
sql = sql + getAndConSql(sql, ETDTO, "VB.ETD <='" + ETDTO + "'");
}
var accDate_Min = form.findField('PS_ACCDATEBGN').getRawValue();
sql = sql + getAndConSql(sql, accDate_Min, " VB.ACCDATE>='" + accDate_Min + "'");
var accDate_Max = form.findField('PS_ACCDATEEND').getRawValue();
sql = sql + getAndConSql(sql, accDate_Max, " VB.ACCDATE<='" + accDate_Max + "'");
var SHOUFU = form.findField('ShouFuFangXiang').getValue();
if (SHOUFU != "0" && SHOUFU != null) {
sql = sql + getAndConSql(sql, SHOUFU, "C.FEETYPE = " + SHOUFU + "");
}
var JIEFEI = form.findField('JieFeiLeiXing').getValue();
if (JIEFEI != "全部" && JIEFEI != "0" && JIEFEI != null) {
sql = sql + getAndConSql(sql, JIEFEI, " EXISTS (SELECT 1 FROM Info_Client_ACCDATE ICA,info_client CL WHERE CL.SHORTNAME = C.CUSTOMERNAME AND ICA.LINKGID = CL.GID and ICA.BGNDATE<=VB.ETD AND ICA.ENDDATE>=VB.ETD and ICA.ACCTYPE = '" + JIEFEI + "') ");
}
var KP = form.findField('ShiFouYiKaiPiao').getValue();
if (KP != "全部" && KP != "0" && KP != null) {
if (KP == "1") {
sql = sql + getAndConSql(sql, KP, " (C.ISINVOICE=1 OR C.INVOICE <> 0 or C.ORDERINVOICE <>0)");
} else if (KP == "2") {
sql = sql + getAndConSql(sql, KP, " C.ISINVOICE<>1 and (C.INVOICE = 0 and C.ORDERINVOICE =0)");
}
}
var FeiYongZhuangTai = form.findField('FeiYongZhuangTai').getValue();
if (FeiYongZhuangTai != "全部" && FeiYongZhuangTai != "0" && FeiYongZhuangTai != null) {
if (FeiYongZhuangTai == "1") {
sql = sql + getAndConSql(sql, FeiYongZhuangTai, "C.FEESTATUS = 9");
}
if (FeiYongZhuangTai == "3") {
sql = sql + getAndConSql(sql, FeiYongZhuangTai, " (C.FEESTATUS = 0 OR C.FEESTATUS = 8) ");
}
if (FeiYongZhuangTai == "4") {
sql = sql + getAndConSql(sql, FeiYongZhuangTai, " (C.FEESTATUS = 0 ) ");
}
if (FeiYongZhuangTai == "6") {
sql = sql + getAndConSql(sql, FeiYongZhuangTai, " (C.FEESTATUS = 0 and ISNULL(C.INVOICE,0)=0 ) ");
}
if (FeiYongZhuangTai == "2") {
sql = sql + getAndConSql(sql, FeiYongZhuangTai, " (C.FEESTATUS =0 or C.FEESTATUS =2 or C.FEESTATUS =1 or C.FEESTATUS =8 ) ");
} else if (FeiYongZhuangTai == "11") {
sql = sql + getAndConSql(sql, FeiYongZhuangTai, " ISNULL(C.INVOICE,0)<>0 ");
} else if (FeiYongZhuangTai == "12") {
sql = sql + getAndConSql(sql, FeiYongZhuangTai, " ISNULL(C.INVOICE,0)<>F.AMOUNT and ISNULL(C.ISINVOICE,0)=0 ");
} else if (FeiYongZhuangTai == "13") {
sql = sql + getAndConSql(sql, FeiYongZhuangTai, " C.FEETYPE=1 AND ISNULL(C.INVOICE,0)<>0 AND ((C.AMOUNT>0 and ISNULL(C.INVOICE,0)>ISNULL(C.SETTLEMENT,0)) or (C.AMOUNT<0 and ISNULL(C.INVOICE,0)<ISNULL(C.SETTLEMENT,0))) ");
} else if (FeiYongZhuangTai == "14") {
sql = sql + getAndConSql(sql, FeiYongZhuangTai, " C.FEETYPE=1 AND ISNULL(C.SETTLEMENT,0)<>0 and ISNULL(C.ISINVOICE,0)=0 AND ((C.AMOUNT>0 and ISNULL(C.SETTLEMENT,0)>ISNULL(C.INVOICE,0)) or (C.AMOUNT<0 and ISNULL(C.SETTLEMENT,0)<ISNULL(C.INVOICE,0))) ");
} else if (FeiYongZhuangTai == "15") {
sql = sql + getAndConSql(sql, FeiYongZhuangTai, " C.FEETYPE=1 AND ISNULL(C.SETTLEMENT,0)=0 and ISNULL(C.ISINVOICE,0)=0 AND ISNULL(C.INVOICE,0)=0 and ISNULL(C.ORDERINVOICE,0)=0 and C.FEETYPE=1 ");
} else if (FeiYongZhuangTai == "16") {
sql = sql + getAndConSql(sql, FeiYongZhuangTai, " ISNULL(C.SETTLEMENT,0)<>0 AND ISNULL(CINVOICE,0)<>0 and C.FEETYPE=1 ");
} else if (FeiYongZhuangTai == "17") {
sql = sql + getAndConSql(sql, FeiYongZhuangTai, " ISNULL(C.SETTLEMENT,0)=0 AND ISNULL(C.INVOICE,0)=0 and ISNULL(C.ISINVOICE,0)=0 and C.FEETYPE=1 ");
} else if (FeiYongZhuangTai == "18") {
sql = sql + getAndConSql(sql, FeiYongZhuangTai, " C.FEETYPE=2 AND ISNULL(C.SETTLEMENT,0)<>0 and ISNULL(C.ISINVOICE,0)=0 AND ((C.AMOUNT>0 and ISNULL(C.SETTLEMENT,0)>ISNULL(C.INVOICE,0)) or (C.AMOUNT<0 and ISNULL(C.SETTLEMENT,0)<ISNULL(C.INVOICE,0))) ");
} else if (FeiYongZhuangTai == "19") {
sql = sql + getAndConSql(sql, FeiYongZhuangTai, " C.FEETYPE=2 AND ISNULL(C.INVOICE,0)<>0 AND ((C.AMOUNT>0 and ISNULL(C.INVOICE,0)>ISNULL(C.SETTLEMENT,0)) or (C.AMOUNT<0 and ISNULL(C.INVOICE,0)<ISNULL(C.SETTLEMENT,0))) ");
}
}
var BiBie = form.findField('BiBie').getValue();
if (BiBie != "" && BiBie != "全部" && BiBie != null) {
sql = sql + getAndConSql(sql, BiBie, "C.CURRENCY = '" + BiBie + "'");
}
var FEENAME = form.findField('FEENAME').getValue();
if (FEENAME != "" && FEENAME != null) {
sql = sql + getAndConSql(sql, FEENAME, "C.FEENAME = '" + FEENAME + "'");
}
var ISCHAOQI = form.findField('ISCHAOQI').getValue();
if (ISCHAOQI != "" && ISCHAOQI != null) {
if (ISCHAOQI=='1')
sql = sql + getAndConSql(sql, ISCHAOQI, " DATEDIFF([day],[dbo].[GetCustStlDay](VB.OPDATE,C.CUSTOMERNAME,VB.SALE),GETDATE())>0 ");
if (ISCHAOQI == '2')
sql = sql + getAndConSql(sql, ISCHAOQI, " DATEDIFF([day],[dbo].[GetCustStlDay](VB.OPDATE,C.CUSTOMERNAME,VB.SALE),GETDATE())<=0 ");
}
var ISZHIQI = this.formSearch.getForm().findField('ISZHIQI').getValue();
var EXCHANGERATE = this.formSearch.getForm().findField('EXCHANGERATE').getValue();
var ISCHAOQI = this.formSearch.getForm().findField('ISCHAOQI').getValue();
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 selectedRecords = [];
selectedRecords = this.gridList.selModel.getSelection();
var selectStores = [];
for (var i = 0; i < selectedRecords.length; i++) {
selectStores.push(selectedRecords[i].data);
}
Ext.MessageBox.confirm('提示', '确定导出数据?', function (btn) {
if (btn == 'yes') {
Ext.Msg.wait('正在生成...');
Ext.Ajax.request({
waitMsg: '正在生成...',
url: '/MvcShipping/MsChFeeYsAutoDui/GetExcel',
timeout: 1200000,
params: {
data: Ext.JSON.encode(selectStores),
condition: sql,
ISZHIQI: ISZHIQI,
EXCHANGERATE: EXCHANGERATE,
ISCHAOQI: ISCHAOQI
},
callback: function (options, success, response) {
if (success) {
var jsonresult = Ext.JSON.decode(response.responseText);
if (jsonresult.Success) {
var downloadfile = Ext.getCmp('downloadfile');
var children = downloadfile.items;
if (children) {
for (var i = 0, len = children.length; i < len; i++) {
downloadfile.remove(children.items[i], true);
}
}
var downloadfiles = jsonresult.data;
var htmla = Ext.widget('label', { html: downloadfiles, width: 120, text: '' });
downloadfile.items.add(htmla);
this.winDownloadShow.show();
//
Ext.Msg.hide();
}
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);
//InitData();
},
getCondition: function (type) {
//生成对账单
if (type == '1') {
var form = this.formSearch.getForm();
var sql = " and C.ISDEBIT = 0";
var DuiZhangKeHu = form.findField('DuiZhangKeHu').getValue();
if (DuiZhangKeHu != "" && DuiZhangKeHu != null) {
sql = sql + getAndConSql(sql, DuiZhangKeHu, "C.CUSTOMERNAME = '" + DuiZhangKeHu + "'");
}
var SALECORPID = form.findField('SALECORPID').getValue();
if (SALECORPID != "" && SALECORPID != null) {
sql = sql + getAndConSql(sql, SALECORPID, "VB.SALECORPID = '" + SALECORPID + "'");
}
var CORPID = form.findField('CORPID').getValue();
if (CORPID != "" && CORPID != null) {
sql = sql + getAndConSql(sql, CORPID, "VB.CORPID = '" + CORPID + "'");
}
var BLTYPE = form.findField('BLTYPE').getValue();
if (BLTYPE != "" && BLTYPE != null) {
sql = sql + getAndConSql(sql, BLTYPE, "VB.BLTYPE = '" + BLTYPE + "'");
}
var ETDFROM = form.findField('ETDFROM').getRawValue();
if (ETDFROM != "" && ETDFROM != null) {
sql = sql + getAndConSql(sql, ETDFROM, "VB.ETD >='" + ETDFROM + "'");
}
var ETDTO = form.findField('ETDTO').getRawValue();
if (ETDTO != "" && ETDTO != null) {
sql = sql + getAndConSql(sql, ETDTO, "VB.ETD <='" + ETDTO + "'");
}
var accDate_Min = form.findField('PS_ACCDATEBGN').getRawValue();
sql = sql + getAndConSql(sql, accDate_Min, " VB.ACCDATE>='" + accDate_Min + "'");
var accDate_Max = form.findField('PS_ACCDATEEND').getRawValue();
sql = sql + getAndConSql(sql, accDate_Max, " VB.ACCDATE<='" + accDate_Max + "'");
var SHOUFU = form.findField('ShouFuFangXiang').getValue();
if (SHOUFU != "0" && SHOUFU != null) {
sql = sql + getAndConSql(sql, SHOUFU, "C.FEETYPE = " + SHOUFU + "");
}
var JIEFEI = form.findField('JieFeiLeiXing').getValue();
if (JIEFEI != "全部" && JIEFEI != "0" && JIEFEI != null) {
sql = sql + getAndConSql(sql, JIEFEI, " EXISTS (SELECT 1 FROM Info_Client_ACCDATE ICA,info_client CL WHERE CL.SHORTNAME = C.CUSTOMERNAME AND ICA.LINKGID = CL.GID and ICA.BGNDATE<=VB.ETD AND ICA.ENDDATE>=VB.ETD and ICA.ACCTYPE = '" + JIEFEI + "') ");
}
var KP = form.findField('ShiFouYiKaiPiao').getValue();
if (KP != "全部" && KP != "0" && KP != null) {
if (KP == "1") {
sql = sql + getAndConSql(sql, KP, " (C.ISINVOICE=1 or C.INVOICE <> 0 or C.ORDERINVOICE <>0)");
} else if (KP == "2") {
sql = sql + getAndConSql(sql, KP, " (C.ISINVOICE<>1 and C.INVOICE = 0 and C.ORDERINVOICE =0)");
}
}
var FeiYongZhuangTai = form.findField('FeiYongZhuangTai').getValue();
if (FeiYongZhuangTai != "全部" && FeiYongZhuangTai != "0" && FeiYongZhuangTai != null) {
if (FeiYongZhuangTai == "1") {
sql = sql + getAndConSql(sql, FeiYongZhuangTai, "C.FEESTATUS = 9");
}
if (FeiYongZhuangTai == "3") {
sql = sql + getAndConSql(sql, FeiYongZhuangTai, " (C.FEESTATUS = 0 OR C.FEESTATUS = 8) ");
}
if (FeiYongZhuangTai == "4") {
sql = sql + getAndConSql(sql, FeiYongZhuangTai, " (C.FEESTATUS = 0 ) ");
}
if (FeiYongZhuangTai == "6") {
sql = sql + getAndConSql(sql, FeiYongZhuangTai, " (C.FEESTATUS = 0 and ISNULL(C.INVOICE,0)=0 ) ");
}
if (FeiYongZhuangTai == "2") {
sql = sql + getAndConSql(sql, FeiYongZhuangTai, " (C.FEESTATUS =0 or C.FEESTATUS =2 or C.FEESTATUS =1 or C.FEESTATUS =8 ) ");
} else if (FeiYongZhuangTai == "11") {
sql = sql + getAndConSql(sql, FeiYongZhuangTai, " ISNULL(C.INVOICE,0)<>0 ");
} else if (FeiYongZhuangTai == "12") {
sql = sql + getAndConSql(sql, FeiYongZhuangTai, " ISNULL(C.INVOICE,0)<>F.AMOUNT and ISNULL(C.ISINVOICE,0)=0 ");
} else if (FeiYongZhuangTai == "13") {
sql = sql + getAndConSql(sql, FeiYongZhuangTai, " C.FEETYPE=1 AND ISNULL(C.INVOICE,0)<>0 AND ((C.AMOUNT>0 and ISNULL(C.INVOICE,0)>ISNULL(C.SETTLEMENT,0)) or (C.AMOUNT<0 and ISNULL(C.INVOICE,0)<ISNULL(C.SETTLEMENT,0))) ");
} else if (FeiYongZhuangTai == "14") {
sql = sql + getAndConSql(sql, FeiYongZhuangTai, " C.FEETYPE=1 AND ISNULL(C.SETTLEMENT,0)<>0 and ISNULL(C.ISINVOICE,0)=0 AND ((C.AMOUNT>0 and ISNULL(C.SETTLEMENT,0)>ISNULL(C.INVOICE,0)) or (C.AMOUNT<0 and ISNULL(C.SETTLEMENT,0)<ISNULL(C.INVOICE,0))) ");
} else if (FeiYongZhuangTai == "15") {
sql = sql + getAndConSql(sql, FeiYongZhuangTai, " C.FEETYPE=1 AND ISNULL(C.SETTLEMENT,0)=0 and ISNULL(C.ISINVOICE,0)=0 AND ISNULL(C.INVOICE,0)=0 and ISNULL(C.ORDERINVOICE,0)=0 and C.FEETYPE=1 ");
} else if (FeiYongZhuangTai == "16") {
sql = sql + getAndConSql(sql, FeiYongZhuangTai, " ISNULL(C.SETTLEMENT,0)<>0 AND ISNULL(CINVOICE,0)<>0 and C.FEETYPE=1 ");
} else if (FeiYongZhuangTai == "17") {
sql = sql + getAndConSql(sql, FeiYongZhuangTai, " ISNULL(C.SETTLEMENT,0)=0 AND ISNULL(C.INVOICE,0)=0 and ISNULL(C.ISINVOICE,0)=0 and C.FEETYPE=1 ");
} else if (FeiYongZhuangTai == "18") {
sql = sql + getAndConSql(sql, FeiYongZhuangTai, " C.FEETYPE=2 AND ISNULL(C.SETTLEMENT,0)<>0 and ISNULL(C.ISINVOICE,0)=0 AND ((C.AMOUNT>0 and ISNULL(C.SETTLEMENT,0)>ISNULL(C.INVOICE,0)) or (C.AMOUNT<0 and ISNULL(C.SETTLEMENT,0)<ISNULL(C.INVOICE,0))) ");
} else if (FeiYongZhuangTai == "19") {
sql = sql + getAndConSql(sql, FeiYongZhuangTai, " C.FEETYPE=2 AND ISNULL(C.INVOICE,0)<>0 AND ((C.AMOUNT>0 and ISNULL(C.INVOICE,0)>ISNULL(C.SETTLEMENT,0)) or (C.AMOUNT<0 and ISNULL(C.INVOICE,0)<ISNULL(C.SETTLEMENT,0))) ");
}
}
var BiBie = form.findField('BiBie').getValue();
if (BiBie != "" && BiBie != "全部" && BiBie != null) {
sql = sql + getAndConSql(sql, BiBie, "C.CURRENCY = '" + BiBie + "'");
}
var FEENAME = form.findField('FEENAME').getValue();
if (FEENAME != "" && FEENAME != null) {
sql = sql + getAndConSql(sql, FEENAME, "C.FEENAME = '" + FEENAME + "'");
}
var ISCHAOQI = form.findField('ISCHAOQI').getValue();
if (ISCHAOQI != "" && ISCHAOQI != null) {
if (ISCHAOQI == '1')
sql = sql + getAndConSql(sql, ISCHAOQI, " DATEDIFF([day],[dbo].[GetCustStlDay](VB.OPDATE,C.CUSTOMERNAME,VB.SALE),GETDATE())>0 ");
if (ISCHAOQI == '2')
sql = sql + getAndConSql(sql, ISCHAOQI, " DATEDIFF([day],[dbo].[GetCustStlDay](VB.OPDATE,C.CUSTOMERNAME,VB.SALE),GETDATE())<=0 ");
}
return sql;
}
//发送excel
if (type == '2') {
var form = this.formSearch.getForm();
var sql = " and C.ISDEBIT = 0";
var SALECORPID = form.findField('SALECORPID').getValue();
if (SALECORPID != "" && DuiZhangKeHu != null) {
sql = sql + getAndConSql(sql, SALECORPID, "VB.SALECORPID = '" + SALECORPID + "'");
}
var CORPID = form.findField('CORPID').getValue();
if (CORPID != "" && CORPID != null) {
sql = sql + getAndConSql(sql, CORPID, "VB.CORPID = '" + CORPID + "'");
}
var BLTYPE = form.findField('BLTYPE').getValue();
if (BLTYPE != "" && BLTYPE != null) {
sql = sql + getAndConSql(sql, BLTYPE, "VB.BLTYPE = '" + BLTYPE + "'");
}
var ETDFROM = form.findField('ETDFROM').getRawValue();
if (ETDFROM != "" && ETDFROM != null) {
sql = sql + getAndConSql(sql, ETDFROM, "ETD >='" + ETDFROM + "'");
}
var ETDTO = form.findField('ETDTO').getRawValue();
if (ETDTO != "" && ETDTO != null) {
sql = sql + getAndConSql(sql, ETDTO, "ETD <='" + ETDTO + "'");
}
var accDate_Min = form.findField('PS_ACCDATEBGN').getRawValue();
sql = sql + getAndConSql(sql, accDate_Min, " VB.ACCDATE>='" + accDate_Min + "'");
var accDate_Max = form.findField('PS_ACCDATEEND').getRawValue();
sql = sql + getAndConSql(sql, accDate_Max, " VB.ACCDATE<='" + accDate_Max + "'");
var SHOUFU = form.findField('ShouFuFangXiang').getValue();
if (SHOUFU != "0" && SHOUFU != null) {
sql = sql + getAndConSql(sql, SHOUFU, "C.FEETYPE = " + SHOUFU + "");
}
var JIEFEI = form.findField('JieFeiLeiXing').getValue();
if (JIEFEI != "全部" && JIEFEI != "0" && JIEFEI != null) {
sql = sql + getAndConSql(sql, JIEFEI, " EXISTS (SELECT 1 FROM Info_Client_ACCDATE ICA,info_client CL WHERE CL.SHORTNAME = C.CUSTOMERNAME AND ICA.LINKGID = CL.GID and ICA.BGNDATE<=VB.ETD AND ICA.ENDDATE>=VB.ETD and ICA.ACCTYPE = '" + JIEFEI + "') ");
}
var KP = form.findField('ShiFouYiKaiPiao').getValue();
if (KP != "全部" && KP != "0" && KP != null) {
if (KP == "1") {
sql = sql + getAndConSql(sql, KP, " (C.ISINVOICE=1 or C.INVOICE <> 0 or C.ORDERINVOICE <>0)");
} else if (KP == "2") {
sql = sql + getAndConSql(sql, KP, " (C.ISINVOICE<>1 and C.INVOICE = 0 and C.ORDERINVOICE =0)");
}
}
var FeiYongZhuangTai = form.findField('FeiYongZhuangTai').getValue();
if (FeiYongZhuangTai != "全部" && FeiYongZhuangTai != "0" && FeiYongZhuangTai != null) {
if (FeiYongZhuangTai == "1") {
sql = sql + getAndConSql(sql, FeiYongZhuangTai, "C.FEESTATUS = 9");
}
if (FeiYongZhuangTai == "3") {
sql = sql + getAndConSql(sql, FeiYongZhuangTai, " (C.FEESTATUS = 0 OR C.FEESTATUS = 8) ");
}
if (FeiYongZhuangTai == "4") {
sql = sql + getAndConSql(sql, FeiYongZhuangTai, " (C.FEESTATUS = 0 ) ");
}
if (FeiYongZhuangTai == "6") {
sql = sql + getAndConSql(sql, FeiYongZhuangTai, " (C.FEESTATUS = 0 and ISNULL(C.INVOICE,0)=0 ) ");
}
if (FeiYongZhuangTai == "2") {
sql = sql + getAndConSql(sql, FeiYongZhuangTai, " (C.FEESTATUS =0 or C.FEESTATUS =2 or C.FEESTATUS =1 or C.FEESTATUS =8 ) ");
} else if (FeiYongZhuangTai == "11") {
sql = sql + getAndConSql(sql, FeiYongZhuangTai, " ISNULL(C.INVOICE,0)<>0 ");
} else if (FeiYongZhuangTai == "12") {
sql = sql + getAndConSql(sql, FeiYongZhuangTai, " ISNULL(C.INVOICE,0)<>F.AMOUNT and ISNULL(C.ISINVOICE,0)=0 ");
} else if (FeiYongZhuangTai == "13") {
sql = sql + getAndConSql(sql, FeiYongZhuangTai, " C.FEETYPE=1 AND ISNULL(C.INVOICE,0)<>0 AND ((C.AMOUNT>0 and ISNULL(C.INVOICE,0)>ISNULL(C.SETTLEMENT,0)) or (C.AMOUNT<0 and ISNULL(C.INVOICE,0)<ISNULL(C.SETTLEMENT,0))) ");
} else if (FeiYongZhuangTai == "14") {
sql = sql + getAndConSql(sql, FeiYongZhuangTai, " C.FEETYPE=1 AND ISNULL(C.SETTLEMENT,0)<>0 and ISNULL(C.ISINVOICE,0)=0 AND ((C.AMOUNT>0 and ISNULL(C.SETTLEMENT,0)>ISNULL(C.INVOICE,0)) or (C.AMOUNT<0 and ISNULL(C.SETTLEMENT,0)<ISNULL(C.INVOICE,0))) ");
} else if (FeiYongZhuangTai == "15") {
sql = sql + getAndConSql(sql, FeiYongZhuangTai, " C.FEETYPE=1 AND ISNULL(C.SETTLEMENT,0)=0 and ISNULL(C.ISINVOICE,0)=0 AND ISNULL(C.INVOICE,0)=0 and ISNULL(C.ORDERINVOICE,0)=0 and C.FEETYPE=1 ");
} else if (FeiYongZhuangTai == "16") {
sql = sql + getAndConSql(sql, FeiYongZhuangTai, " ISNULL(C.SETTLEMENT,0)<>0 AND ISNULL(CINVOICE,0)<>0 and C.FEETYPE=1 ");
} else if (FeiYongZhuangTai == "17") {
sql = sql + getAndConSql(sql, FeiYongZhuangTai, " ISNULL(C.SETTLEMENT,0)=0 AND ISNULL(C.INVOICE,0)=0 and ISNULL(C.ISINVOICE,0)=0 and C.FEETYPE=1 ");
} else if (FeiYongZhuangTai == "18") {
sql = sql + getAndConSql(sql, FeiYongZhuangTai, " C.FEETYPE=2 AND ISNULL(C.SETTLEMENT,0)<>0 and ISNULL(C.ISINVOICE,0)=0 AND ((C.AMOUNT>0 and ISNULL(C.SETTLEMENT,0)>ISNULL(C.INVOICE,0)) or (C.AMOUNT<0 and ISNULL(C.SETTLEMENT,0)<ISNULL(C.INVOICE,0))) ");
} else if (FeiYongZhuangTai == "19") {
sql = sql + getAndConSql(sql, FeiYongZhuangTai, " C.FEETYPE=2 AND ISNULL(C.INVOICE,0)<>0 AND ((C.AMOUNT>0 and ISNULL(C.INVOICE,0)>ISNULL(C.SETTLEMENT,0)) or (C.AMOUNT<0 and ISNULL(C.INVOICE,0)<ISNULL(C.SETTLEMENT,0))) ");
}
}
var BiBie = form.findField('BiBie').getValue();
if (BiBie != "" && BiBie != "全部" && BiBie != null) {
sql = sql + getAndConSql(sql, BiBie, "C.CURRENCY = '" + BiBie + "'");
}
var FEENAME = form.findField('FEENAME').getValue();
if (FEENAME != "" && FEENAME != null) {
sql = sql + getAndConSql(sql, FEENAME, "C.FEENAME = '" + FEENAME + "'");
}
var ISCHAOQI = form.findField('ISCHAOQI').getValue();
if (ISCHAOQI != "" && ISCHAOQI != null) {
if (ISCHAOQI == '1')
sql = sql + getAndConSql(sql, ISCHAOQI, " DATEDIFF([day],[dbo].[GetCustStlDay](VB.OPDATE,C.CUSTOMERNAME,VB.SALE),GETDATE())>0 ");
if (ISCHAOQI == '2')
sql = sql + getAndConSql(sql, ISCHAOQI, " DATEDIFF([day],[dbo].[GetCustStlDay](VB.OPDATE,C.CUSTOMERNAME,VB.SALE),GETDATE())<=0 ");
}
return sql;
}
},
Save: function (isCreateDui) {
var searchForm = this.formSearch.getForm();
var editForm = this.formEdit.getForm();
var ETDFROM = searchForm.findField('ETDFROM').getRawValue();
var ETDTO = searchForm.findField('ETDTO').getRawValue();
var accDate_Min = searchForm.findField('PS_ACCDATEBGN').getRawValue();
var accDate_Max = searchForm.findField('PS_ACCDATEEND').getRawValue();
var mainDuiName = editForm.findField('mainDuiName').getRawValue();
if (mainDuiName == '' || mainDuiName == null) {
Ext.Msg.show({ title: '提示', msg: '请填写对账名称!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
return;
}
//if ((ETDFROM == '' || ETDTO == '')&&(accDate_Min == '' || accDate_Max == '')) {
// Ext.Msg.show({ title: '提示', msg: '请选择开船日区间', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
// return;
//}
var _this = this;
var data = this.formEdit.getForm().getValues();
var etdfrom = searchForm.findField('ETDFROM').value;
var etdto = searchForm.findField('ETDTO').value;
var DuiZhangKeHu = searchForm.findField('DuiZhangKeHu').value;
var ShiFouYiKaiPiao = searchForm.findField('ShiFouYiKaiPiao').value;
var JieFeiLeiXing = searchForm.findField('JieFeiLeiXing').value;
var ShouFuFangXiang = searchForm.findField('ShouFuFangXiang').value;
var FeiYongZhuangTai = searchForm.findField('FeiYongZhuangTai').value;
var SALECORPID = searchForm.findField('SALECORPID').value;
var CORPID = searchForm.findField('CORPID').value;
var BiBie = searchForm.findField('BiBie').value;
var FEENAME = searchForm.findField('FEENAME').value;
var ISCHAOQI = searchForm.findField('ISCHAOQI').value;
var ISZHIQI = searchForm.findField('ISZHIQI').value;
var EXCHANGERATE = searchForm.findField('EXCHANGERATE').value;
data.accDate_Min = accDate_Min;
data.accDate_Max = accDate_Max;
data.KaiChuanRiFrom = etdfrom;
data.KaiChuanRiTo = etdto;
data.dMainId = dMainId;
data.DuiZhangKeHu = DuiZhangKeHu == null ? "" : DuiZhangKeHu;
data.ShiFouYiKaiPiao = ShiFouYiKaiPiao == null ? "0" : ShiFouYiKaiPiao;
data.JieFeiLeiXing = JieFeiLeiXing == null ? "" : JieFeiLeiXing;
data.ShouFuFangXiang = ShouFuFangXiang == null ? "0" : ShouFuFangXiang;
data.FeiYongZhuangTai = FeiYongZhuangTai == null ? "0" : FeiYongZhuangTai;
data.SALECORPID = SALECORPID == null ? "" : SALECORPID;
data.CORPID = CORPID == null ? "" : CORPID;
data.BiBie = BiBie == null ? "" : BiBie;
data.FEENAME = FEENAME == null ? "" : FEENAME;
data.ISCHAOQI = ISCHAOQI == null ? "0" : ISCHAOQI;
data.ISZHIQI = ISZHIQI == null ? "0" : ISZHIQI;
data.EXCHANGERATE = EXCHANGERATE == null ? "0" : EXCHANGERATE;
var modifiedlist = []; //声明空数组
var records = this.gridList.getStore().getModifiedRecords();
Ext.each(records, function (record) {//遍历行数据数组
modifiedlist.push(record.data);
});
Ext.Ajax.request({
waitMsg: '正在发送...',
url: '/MvcShipping/MsChFeeYsAutoDui/SaveMain',
params: {
data: Ext.JSON.encode(data),
detailsdata: Ext.JSON.encode(modifiedlist)
},
callback: function (options, success, response) {
if (success) {
var jsonresult = Ext.JSON.decode(response.responseText);
if (jsonresult.Success) {
_this.OprationStatus = 'edit';
dMainId = jsonresult.dMainId;
if (isCreateDui == '1') {
_this.onCreateDui('1');
} else if (isCreateDui == '2') {
window.close();
} else{
Ext.Msg.show({ title: '提示', msg: jsonresult.Message, icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
}
_this.parentWin.onRefreshClick();
}
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
});
},
CancelDui: function () {
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 _this = this;
var selectedRecords = [];
selectedRecords = this.gridList.selModel.getSelection();
var selectStores = [];
for (var i = 0; i < selectedRecords.length; i++) {
selectStores.push(selectedRecords[i].data);
}
Ext.MessageBox.confirm('提示', '确定取消对账?', function (btn) {
if (btn == 'yes') {
Ext.Msg.wait('正在生成...');
Ext.Ajax.request({
waitMsg: '正在生成...',
url: '/MvcShipping/MsChFeeYsAutoDui/CancelDui',
params: {
data: Ext.JSON.encode(selectStores)
},
callback: function (options, success, response) {
if (success) {
var jsonresult = Ext.JSON.decode(response.responseText);
if (jsonresult.Success) {
Ext.Msg.show({ title: '提示', msg: jsonresult.Message, icon: Ext.Msg.OK, buttons: Ext.Msg.OK });
_this.onRefreshClick();
}
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);
},
OprationSwap: function () {
var selections = this.gridList.getSelectionModel().getSelection();
var duino = selections[0].data.DuiZhangBianHao;
var currSql = "";
if (KaiPiaoCurr == 0) {
currSql = " and currency = 'RMB'";
} else {
" and currency = 'USD'";
}
var selectFeeGid = " f.GID IN (select gid from ch_fee where debitno = '" + duino + "' "+currSql+")";
var bsno = "(select bsno from ch_fee where debitno = '" + duino + "' )";
var ret = new Array();
ret[0] = this.OprationStatus;
ret[1] = this.storeList;
ret[2] = this.SelectedRecord;
ret[3] = this.SelectedRecord;
ret[4] = " b.BSNO in " + bsno + " and " + selectFeeGid;
ret[5] = selectFeeGid;
return ret;
},
SaveSign: function () {
Ext.Ajax.request({
waitMsg: '正在保存...',
url: '/MvcShipping/MsChFeeYsAutoDui/SaveSign',
params: {
data: Ext.JSON.encode(selectStores)
},
callback: function (options, success, response) {
if (success) {
var jsonresult = Ext.JSON.decode(response.responseText);
if (jsonresult.Success) {
Ext.Msg.show({ title: '提示', msg: jsonresult.Message, icon: Ext.Msg.OK, 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
},
LoadSign: function () {
Ext.Ajax.request({
waitMsg: '正在保存...',
url: '/MvcShipping/MsChFeeYsAutoDui/GetSign',
params: {
},
callback: function (options, success, response) {
if (success) {
var jsonresult = Ext.JSON.decode(response.responseText);
if (jsonresult.Success) {
Ext.getCmp("MailSign").setValue(jsonresult.Data);
}
}
},
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
},
onCreateInvShenClick: function (Curr, invcust, isfeename) {
DsOpenEditWin("/Account/Chfee_invoiceapplication/BLEdit?handle=check&bsnosql=feelist&bsCurr=" + Curr + "&bsCust=" + invcust + "&isfeename=" + isfeename, '发票申请');
},
onShenIvoiceClick: function (currType) {
KaiPiaoCurr = currType;
var selections = this.gridList.getSelectionModel().getSelection();
if (selections.length == 0) {
Ext.Msg.show({ title: '提示', msg: '请先选择记录!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
return;
}
if (selections.length > 1) {
Ext.Msg.show({ title: '提示', msg: '请先单条记录!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
return;
}
var invcurr = 'RMB';
var invcurrusd = '';
var invcust = selections[0].data.KeHuJianCheng;
var bsno = '';
var GidStr = '';
if (this.winIFTMBFShow == undefined || this.winIFTMBFShow == NaN) {
this.comboxInvCurr = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: '实收币别',
store: this.storeBiBie,
id: 'ShenCurr',
forceSelection: true,
allowBlank: false,
name: 'CURR',
value: invcurr,
valueField: 'DC',
displayField: 'NAME'
});
this.storeINVFEENAME = Ext.create('Ext.data.Store', {
fields: ['FSTATUS', 'NAME']
});
this.storeINVFEENAME.add({ "FSTATUS": "0", "NAME": "否" });
this.storeINVFEENAME.add({ "FSTATUS": "1", "NAME": "是" });
this.comboxINVFEENAME = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: '是否明细',
store: this.storeINVFEENAME,
valueField: 'FSTATUS',
displayField: 'NAME',
id: 'INVFEENAME',
forceSelection: true,
name: 'INVFEENAME',
value: '0'
});
this.formIFTMBFSShow = Ext.widget('form', {
frame: true,
region: 'center',
bodyPadding: 5,
fieldDefaults: {
margins: '2 2 2 2',
labelAlign: 'right',
flex: 1,
labelWidth: 80,
msgTarget: 'qtip'
},
items: [{
xtype: 'container',
defaultType: 'textfield',
layout: 'hbox',
defaults: {
anchor: '100%'
},
items: [this.comboxInvCurr, this.comboxINVFEENAME]
}]
});
me = this;
this.winIFTMBFShow = Ext.create('Ext.window.Window', {
width: 320,
height: 160,
//plain : true,
iconCls: "addicon",
resizable: false,
// 是否可以拖动
// draggable:false,
collapsible: true, // 允许缩放条
closeAction: 'close',
closable: true,
modal: 'true',
buttonAlign: "center",
bodyStyle: "padding:0 0 0 0",
items: [this.formIFTMBFSShow],
buttons: [{
text: '确认生成',
minWidth: 70,
handler: function () {
var ShenCurr = Ext.getCmp('ShenCurr');
var Curr = ShenCurr.getValue();
var isfeename = Ext.getCmp('INVFEENAME').getValue(); ;
me.onCreateInvShenClick(Curr, invcust, isfeename);
me.winIFTMBFShow.close();
}
}, {
text: '关闭',
minWidth: 70,
handler: function () {
me.winIFTMBFShow.close();
}
}]
});
} else {
Ext.getCmp('ShenCurr').setValue(invcurr);
}
this.winIFTMBFShow.show();
}
});