Ext.namespace('Shipping');
Shipping.MsChPaysettlementIndex = function (config) {
Ext.applyIf(this, config);
this.initUIComponents();
window.Shipping.MsChPaysettlementIndex.superclass.constructor.call(this);
};
Ext.extend(Shipping.MsChPaysettlementIndex, Ext.Panel, {
PageSize: 500,
OprationStatus: null, //仅当弹出界面时使用
SelectedRecord: null,
sqlcontext: '',
isCwVouchers: false,
initUIComponents: function () {
this.StoreLockOp = Ext.create('DsExt.ux.RefTableStore', {
model: 'MsFeeOP',
proxy: { url: '/MvcShipping/MsBaseInfo/GetOpIDRang' }
});
this.StoreLockOp.load({ params: { optype: "modPayFeeSettlementLock"} });
this.StoreUnLockOp = Ext.create('DsExt.ux.RefTableStore', {
model: 'MsFeeOP',
proxy: { url: '/MvcShipping/MsBaseInfo/GetOpIDRang' }
});
this.StoreUnLockOp.load({ params: { optype: "modPayFeeSettlementUnLock"} });
this.StoreOpRange = Ext.create('DsExt.ux.RefTableStore', {
model: 'MsOP',
proxy: { url: '/MvcShipping/MsBaseInfo/GetOpRang' }
});
this.StoreOpRange.load({ params: { optype: "modPaySettlementList"} });
this.formname = "MsChPaysettlementIndex";
//定义数据集
this.storeList = Ext.create('Ext.data.Store', {
pageSize: this.PageSize,
model: 'MsChSettlement',
remoteSort: true,
proxy: {
type: 'ajax',
url: '/Account/Chfee_Foreignsettlement/GetDataList',
reader: {
id: 'BILLNO',
root: 'data',
totalProperty: 'totalCount'
}
}
});
//定义Grid
var _this = this;
this.column = [{
sortable: true,
dataIndex: 'BILLNO',
header: '结算单号',
width: 120
}, {
sortable: true,
dataIndex: 'BILLSTATUSREF',
header: '状态',
width: 60
}, {
sortable: true,
dataIndex: 'CUSTOMERNAME',
header: '结算单位',
width: 120
}, {
sortable: true,
dataIndex: 'SETTLEMODEREF',
header: '结算类别',
width: 100
}, {
sortable: true,
dataIndex: 'SETTLETYPEREF',
header: '结算方式',
width: 100
}, {
sortable: true,
dataIndex: 'AMOUNTRMB',
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 '' + lsValue + ''; } } else { return value; } } catch (e) { return value; } return value; },
align: 'right',
width: 120
}, {
sortable: true,
dataIndex: 'AMOUNTUSD',
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 '' + lsValue + ''; } } else { return value; } } catch (e) { return value; } return value; },
align: 'right',
width: 120
}, {
sortable: true,
dataIndex: 'FINANCIAL_MONEY',
header: '财务费用',
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 '' + lsValue + ''; } } else { return value; } } catch (e) { return value; } return value; },
align: 'right',
width: 120
}, {
sortable: true,
dataIndex: 'NOINVOICE',
header: '未开票',
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 '' + lsValue + ''; } } else { return value; } } catch (e) { return value; } return value; },
align: 'right',
width: 120
}, {
sortable: true,
dataIndex: 'ACCOUNTREF',
header: '结算账户',
width: 150
}, {
sortable: true,
dataIndex: 'SETTLETIME',
header: '结算日期',
width: 100
}, {
sortable: true,
dataIndex: 'SETTLEUSERREF',
header: '结算人',
width: 100
}, {
sortable: true,
dataIndex: 'ISEXPORT',
header: '是否导出凭证',
width: 120
}, {
sortable: true,
dataIndex: 'REMARK',
header: '备注',
width: 160
}, {
sortable: true,
dataIndex: 'VOUCHERNO',
header: '总账凭证号',
width: 100
}, {
sortable: true,
dataIndex: 'VOUNO',
header: '接口凭证号',
width: 100
}, {
sortable: true,
dataIndex: 'BS_CUSTOMERNAME',
header: '委托单位',
width: 180
}];
//定义Grid
this.GridCheckBoxModel = Ext.create('Ext.selection.CheckboxModel');
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();
}
}
}
});
Ext.grid.RowNumberer = Ext.extend(Ext.grid.RowNumberer, {
width: 40
});
this.gridList = new Ext.grid.GridPanel({
store: this.storeList,
enableHdMenu: false,
region: 'center',
loadMask: { msg: "数据加载中,请稍等..." },
trackMouseOver: true,
disableSelection: false,
selModel: this.GridCheckBoxModel,
columns: this.column,
viewConfig: {
enableTextSelection: true,
autoFill: true
},
bbar: [Ext.create('Ext.PagingToolbar', {
store: this.storeList,
displayInfo: true,
displayMsg: '当前显示 {0} - {1}条记录 /共 {2}条记录',
emptyMsg: "没有数据"
}), this.Pagenum]
});
this.gridList.addListener('itemdblclick', function (dataview, record, item, index, e, b) {
this.SelectedRecord = record;
this.OprationStatus = 'edit';
if (record.data.SETTLEMODE == 1)
DsOpenEditWin('/Account/Chfee_Foreignsettlement/PayAppEdit');
else if (record.data.SETTLEMODE == 3)
DsOpenEditWin('/Account/Chfee_Foreignsettlement/PayInvEdit');
else
DsOpenEditWin('/Account/Chfee_Foreignsettlement/PayBLEdit');
}, this);
/////////////以下部分为获取存储的gridpanel显示样式
this.column = DsTruck.GetGridPanel(USERID, this.formname, this.column);
//使用者id,表名 ,中间column数组
this.column.unshift(new Ext.grid.RowNumberer());
this.gridList.reconfigure(this.storeList, this.column);
////////////////////////////
//#region formSearch
//#region formSearch枚举参照相关
this.storeCompany = Ext.create('DsExt.ux.RefTableStore', {
model: 'companymb',
proxy: { url: '/CommMng/BasicDataRef/GetcompanyList' }
});
this.storeCompany.load({ params: { condition: " ISDISABLE=0 "} });
this.comboxCompany = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: '结算公司',
store: this.storeCompany,
name: 'companyid',
valueField: 'gid',
displayField: 'name',
listeners: {
specialkey: function (field, e) {
if (e.getKey() == e.ENTER) {
_this.onRefreshClick();
}
}
}
});
this.StoreBANK = Ext.create('DsExt.ux.RefTableStore', {
model: 'BANK',
proxy: { url: '/MvcShipping/MsBaseInfo/GetAllBANKList' }
});
this.StoreBANK.load({ params: { condition: ""} });
this.comboxBANK = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: '银行账号',
store: this.StoreBANK,
forceSelection: true,
name: 'ACCOUNT',
valueField: 'GID',
displayField: 'BANKNAME',
listeners: {
blur: function (field, newValue, oldValue) {
if (field.displayTplData[0].ISSTOP == "True") {
alert("该往来单位已经停用");
}
},
specialkey: function (field, e) {
if (e.getKey() == e.ENTER) {
_this.onRefreshClick();
}
},
scope: this
}
});
Ext.define('IsLockMd', {
extend: 'Ext.data.Model',
fields: [
{ name: 'IsLock', type: 'string' },
{ name: 'IsLock_REF', type: 'string' }
]
});
var IsLockData = [{ "IsLock": "", "IsLock_REF": "全部" },
{ "IsLock": "1", "IsLock_REF": "锁定" },
{ "IsLock": "2", "IsLock_REF": "未锁定" },
{ "IsLock": "3", "IsLock_REF": "结算撤销"}];
this.storeIsLockType = Ext.create('Ext.data.Store', {
model: 'IsLockMd',
data: IsLockData
});
this.comboxIsLock = Ext.create('DsExt.ux.RefEnumCombox', {
fieldLabel: '结算已锁定',
forceSelection: true,
store: this.storeIsLockType,
name: 'IsLock',
valueField: 'IsLock',
displayField: 'IsLock_REF',
listeners: {
specialkey: function (field, e) {
if (e.getKey() == e.ENTER) {
_this.onRefreshClick();
}
}
}
});
//#endregion
_this = this;
this.formSearch = Ext.widget('form', {
frame: true,
region: 'center',
bodyPadding: 5,
fieldDefaults: {
margins: '2 2 2 2',
labelAlign: 'right',
flex: 1,
labelWidth: 90,
msgTarget: 'qtip'
},
items: [
{//fieldset 1
xtype: 'container',
defaultType: 'textfield',
layout: 'anchor',
defaults: {
anchor: '100%'
},
items: [{
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [{
fieldLabel: '结算单号',
name: 'BillNo',
listeners: {
specialkey: function (field, e) {
if (e.getKey() == e.ENTER) {
_this.onRefreshClick();
}
}
}
}, {
fieldLabel: '业务编号',
name: 'BsNo',
listeners: {
specialkey: function (field, e) {
if (e.getKey() == e.ENTER) {
_this.onRefreshClick();
}
}
}
}, this.comboxCompany
, {
fieldLabel: '结算单位',
name: 'CustName',
enableKeyEvents: true,
listeners: {
specialkey: function (field, e) {
if (e.getKey() == e.ENTER) {
_this.onRefreshClick();
}
}
}
}, {
fieldLabel: '从结算日期',
format: 'Y-m-d',
xtype: 'datefield',
name: 'ExpDateBgn',
enableKeyEvents: true,
listeners: {
specialkey: function (field, e) {
if (e.getKey() == e.ENTER) {
_this.onRefreshClick();
}
}
}
}, {
fieldLabel: '到结算日期',
format: 'Y-m-d',
xtype: 'datefield',
name: 'ExpDateEnd',
enableKeyEvents: true,
listeners: {
specialkey: function (field, e) {
if (e.getKey() == e.ENTER) {
_this.onRefreshClick();
}
}
}
}
]
}
]//end items(fieldset 1)
}//end fieldset 1
, {//fieldset 2
xtype: 'container',
defaultType: 'textfield',
layout: 'anchor',
defaults: {
anchor: '100%'
},
items: [{
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [{
fieldLabel: '申请单号',
name: 'AppNo',
listeners: {
specialkey: function (field, e) {
if (e.getKey() == e.ENTER) {
_this.onRefreshClick();
}
}
}
}, {
fieldLabel: '从..金额',
name: 'Amount_min',
listeners: {
specialkey: function (field, e) {
if (e.getKey() == e.ENTER) {
_this.onRefreshClick();
}
}
}
}, {
fieldLabel: '到..金额',
name: 'Amount_max',
listeners: {
specialkey: function (field, e) {
if (e.getKey() == e.ENTER) {
_this.onRefreshClick();
}
}
}
}, this.comboxBANK
, this.comboxIsLock
, {
xtype: 'hiddenfield',
flex: 1
}
]
}
]//end items(fieldset 1)
}//end fieldset 2
]//end root items
});
//#endregion formSearch
//#region 打印菜单
var menu1 = new Ext.menu.Menu({
id: 'basicMenu',
items: [{
text: '付费结算流水',
handler: clickHandler_1
}, {
text: '付费结算流水(费用组分组)',
handler: clickHandler_2
}
]
});
//#endregion
//#region 打印格式定义
var _this = this;
function clickHandler_1() {
_this.Print();
};
function clickHandler_2() {
_this.Print_FYFZ();
};
//#endregion
//查询工具条
this.panelBtn = new Ext.Panel({
region: "north",
tbar: [
{
text: "自由结算",
iconCls: "btnadd",
handler: function (button, event) {
this.OprationStatus = 'add';
DsOpenEditWin('/Account/Chfee_Foreignsettlement/PayBLEdit');
},
scope: this
},
'-',
{
text: "申请结算",
iconCls: "btnadd",
handler: function (button, event) {
this.OprationStatus = 'add';
DsOpenEditWin('/Account/Chfee_Foreignsettlement/PayAppEdit');
},
scope: this
},
'-',
{
text: "付费发票结算",
iconCls: "btnadd",
handler: function (button, event) {
this.OprationStatus = 'add';
DsOpenEditWin('/Account/Chfee_Foreignsettlement/PayInvEdit');
},
scope: this
},
'-',
{
text: "执行查询",
id: "btnRefresh",
iconCls: "btnrefresh",
handler: function (button, event) {
this.onRefreshClick(button, event);
},
scope: this
},
{
text: "重置条件",
iconCls: "btnreset",
handler: function (button, event) {
var form = this.formSearch.getForm();
form.reset();
},
scope: this
}, '-', {
text: '提交锁定',
tooltip: '提交锁定',
id: 'btnSubmitAudit',
handler: function (button, event) {
this.onSubmitAuditClick();
},
scope: this
}, '-', {
text: '撤销锁定',
tooltip: '撤销锁定',
id: 'btnSubmitAuditBack',
handler: function (button, event) {
this.onSubmitAuditBackClick();
},
scope: this
}, '-',
{
text: "删除",
iconCls: "btndelete",
id: 'btndelete',
handler: function (button, event) {
this.onDeleteClick(button, event);
},
scope: this
}, '-',
{ text: "打印报表", menu: menu1, scope: this }
, '-',
{
text: "生成总账凭证",
id: "btnAddCwVouchers",
iconCls: "btnadd",
handler: function (button, event) {
this.onAddCwVouchers();
},
scope: this
}, {
text: "查看总账凭证",
id: "btnSelCwVouchers",
iconCls: "btnrefresh",
handler: function (button, event) {
this.onSelCwVouchers('');
},
scope: this
}, {
text: "生成接口凭证",
id: "btnAddCwVouchersJK",
iconCls: "btnadd",
handler: function (button, event) {
this.onAddCwVouchersJK();
},
scope: this
}, {
text: "查看接口凭证",
id: "btnSelCwVouchersJK",
iconCls: "btnrefresh",
handler: function (button, event) {
this.onSelCwVouchersJK('');
},
scope: this
}, '-', {
text: "保存列表样式",
id: "btnSaveTable",
handler: function (button, event) {
var formname = this.formname;
var tempcolumns = this.gridList.columns;
DsTruck.SaveGridPanel(USERID, formname, tempcolumns, this.column, 1, false);
},
scope: this
}
]
});
this.panelTop = new Ext.Panel({
layout: "border",
region: "north",
height: 100,
items: [this.formSearch, this.panelBtn]
});
Ext.apply(this, {
items: [this.panelTop, this.gridList]
});
this.storeList.on('beforeload', function (store) {
var sql = this.getCondition();
Ext.apply(store.proxy.extraParams, { condition: sql, billtype: 2 });
}, this);
this.gridList.getSelectionModel().on('select', function (model, record, index) {
var op = record.data.SETTLEUSER;
var opname = record.data.SETTLEUSERREF;
var bsstatus = record.data.BILLSTATUS;
var btnESubmitAudit = Ext.getCmp('btnSubmitAudit');
var btnESubmitAuditBack = Ext.getCmp('btnSubmitAuditBack');
var btndelete = Ext.getCmp('btndelete');
var records = DsStoreQueryBy(this.StoreLockOp, 'OPID', op);
if (records.getCount() > 0) {
if (bsstatus == 1) {
btnESubmitAudit.disable();
} else {
btnESubmitAudit.enable();
}
} else {
btnESubmitAudit.disable();
}
var records = DsStoreQueryBy(this.StoreUnLockOp, 'OPID', op);
if (records.getCount() > 0) {
if (bsstatus == 1) {
btnESubmitAuditBack.enable();
} else {
btnESubmitAuditBack.disable();
}
} else {
btnESubmitAuditBack.disable();
}
var records = DsStoreQueryBy(this.StoreOpRange, 'OPID', opname);
if (records.getCount() > 0) {
btndelete.enable();
} else {
btndelete.disable();
}
//#region 判断要显示的凭证按钮
//判断要显示的总账凭证按钮
if (this.isCwVouchers) {
var sVOUCHERNO = record.data.VOUCHERNO.toString();
if (sVOUCHERNO.trim() == "") {
Ext.getCmp('btnAddCwVouchers').show();
Ext.getCmp('btnSelCwVouchers').hide();
}
else {
Ext.getCmp('btnAddCwVouchers').hide();
Ext.getCmp('btnSelCwVouchers').show();
}
} else {
Ext.getCmp('btnAddCwVouchers').hide();
Ext.getCmp('btnSelCwVouchers').hide();
}
//判断要显示的接口凭证按钮
var sVOUNO = record.data.VOUNO.toString();
if (sVOUNO.trim() == "") {
Ext.getCmp('btnAddCwVouchersJK').show();
Ext.getCmp('btnSelCwVouchersJK').hide();
}
else {
Ext.getCmp('btnAddCwVouchersJK').hide();
Ext.getCmp('btnSelCwVouchersJK').show();
}
//#endregion
}, this);
//this.onRefreshClick();
//#region 生成凭证_权限加载
Ext.getCmp('btnAddCwVouchersJK').show();
Ext.getCmp('btnSelCwVouchersJK').hide();
//加载数据
this.StoreIsCwVouchers = Ext.create('DsExt.ux.RefTableStore', {
model: 'DsShipping.ux.ModuleModel',
proxy: { url: '/MvcShipping/MsBaseInfo/GetSysModuleList' }
});
this.StoreIsCwVouchers.load({
params: { condition: "[name]='modChPaySettlementIndexCwVouchers'" },
waitMsg: '正在查询数据...',
callback: function (options, success, response) {
if (success) {
//判断是否显示总账凭证按钮
if (options.length > 0) {
Ext.getCmp('btnAddCwVouchers').show();
this.isCwVouchers = true;
} else {
Ext.getCmp('btnAddCwVouchers').hide();
this.isCwVouchers = false;
}
Ext.getCmp('btnSelCwVouchers').hide();
}
},
scope: this
});
//#endregion
}, //end initUIComponents
onRefreshClick: function (button, event) {
var sql = this.getCondition();
sqlcontext = sql;
this.PageSize = this.Pagenum.getValue();
this.storeList.pageSize = this.PageSize;
this.storeList.load({
params: { start: 0, limit: this.PageSize, sort: '', condition: sql, billtype: 2 },
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 record = selections[0];
var billstatus = record.data.BILLSTATUS;
var settlemode = record.data.SETTLEMODE;
if (billstatus == '1') {
Ext.Msg.show({ title: '提示', msg: '当前状态无法删除此单据!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
return;
}
Ext.MessageBox.confirm('提示', '确定删除该记录吗?', function (btn) {
if (btn == 'yes') {
Ext.Msg.wait('正在删除数据...');
Ext.Ajax.request({
waitMsg: '正在删除数据...',
url: '/Account/Chfee_Foreignsettlement/Delete',
params: {
data: Ext.JSON.encode(record.data),
settlemode: settlemode
},
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: '删除成功!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
}
else {
Ext.Msg.show({ title: '错误', msg: jsonresult.Message, icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK });
}
}
},
failure: function (response, options) {
Ext.Msg.show({ title: '警告', msg: '服务器响应出错,请重试', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
},
success: function (response, options) {
},
scope: this
}); //end Ext.Ajax.request
}
}, this);
}, //onDeleteClick
onSubmitAuditClick: 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 BILLNOStr = '';
for (var i = 0; i < selections.length; i++) {
var rec = selections[i];
var BILLNO = rec.data.BILLNO;
if (rec.data.BILLSTATUS == '2') {
if (BILLNOStr == '')
BILLNOStr = BILLNO;
else {
BILLNOStr = BILLNOStr + ',' + BILLNO;
}
}
}
_this = this;
if (BILLNOStr == '') {
} else {
Ext.Ajax.request({
waitMsg: '正在添加数据...',
url: '/Account/Chfee_Foreignsettlement/LockList',
params: {
bills: BILLNOStr
},
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 {
_this.onRefreshClick();
}
} else {
Ext.MessageBox.alert('请求出现错误,请重试', response.responseText);
}
},
scope: this
});
}
},
onSubmitAuditBackClick: 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 BILLNOStr = '';
for (var i = 0; i < selections.length; i++) {
var rec = selections[i];
var BILLNO = rec.data.BILLNO;
var isvou = rec.data.ISEXPORT;
var VOUNO = rec.data.VOUNO;
var sVOUCHERNO = rec.data.VOUCHERNO;
if ((rec.data.BILLSTATUS == '1') && (isvou != true) && (VOUNO == "") && (VOUCHERNO == "")) {
if (BILLNOStr == '')
BILLNOStr = BILLNO;
else {
BILLNOStr = BILLNOStr + ',' + BILLNO;
}
}
}
_this = this;
if (BILLNOStr == '') {
} else {
Ext.Ajax.request({
waitMsg: '正在添加数据...',
url: '/Account/Chfee_Foreignsettlement/UnLockList',
params: {
bills: BILLNOStr
},
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 {
_this.onRefreshClick();
}
} else {
Ext.MessageBox.alert('请求出现错误,请重试', response.responseText);
}
},
scope: this
});
};
},
getCondition: function () {
var form = this.formSearch.getForm();
if (!form.isValid()) {
Ext.Msg.alert('提示', '查询条件赋值错误,请检查。');
return '';
}
var sql = ' BILLTYPE=2 ';
var BillNo = form.findField('BillNo').getValue();
sql = sql + getAndConSql(sql, BillNo, " BillNo like '%" + BillNo + "%' ");
var BsNo = form.findField('BsNo').getValue();
sql = sql + getAndConSql(sql, BsNo, " Billno in (select BILLNO from ch_fee_do where bsno in(select bsno from v_op_bs where Custno like '%" + BsNo + "%' )) ");
var AppNo = form.findField('AppNo').getValue();
sql = sql + getAndConSql(sql, AppNo, " Billno in (select BILLNO from ch_fee_do_payapplication where PAYBillno like '%" + AppNo + "%' )");
var custName = form.findField('CustName').getValue();
sql = sql + getAndConSql(sql, custName, "CUSTOMERNAME like '%" + custName + "%'");
var companyid = form.findField('companyid').getValue();
sql = sql + getAndConSql(sql, companyid, "(ACCOUNTRMB in(select gid from sys_bank where linkid= '" + companyid + "') or ACCOUNTUSD in(select gid from sys_bank where linkid= '" + companyid + "'))");
var expDateBgn = form.findField('ExpDateBgn').getRawValue();
sql = sql + getAndConSql(sql, expDateBgn, "SETTLETIME >='" + expDateBgn + "'");
var expDateEnd = form.findField('ExpDateEnd').getRawValue();
sql = sql + getAndConSql(sql, expDateEnd, "SETTLETIME <='" + expDateEnd + " 23:59:59'");
var Amount_max = form.findField('Amount_max').getValue();
if (parseFloat(Amount_max) == 0 || Amount_max == "") {
var Amount_min = form.findField('Amount_min').getValue();
sql = sql + getAndConSql(sql, Amount_min, "(AmountRMB = " + Amount_min + " or AmountUSD = " + Amount_min + ")");
} else {
var Amount_min = form.findField('Amount_min').getValue();
sql = sql + getAndConSql(sql, Amount_min, "((AmountRMB<>0 and AmountRMB >= " + Amount_min + ") or (AmountUSD<>0 and AmountUSD >= " + Amount_min + "))");
var Amount_max = form.findField('Amount_max').getValue();
sql = sql + getAndConSql(sql, Amount_max, "((AmountRMB<>0 and AmountRMB <= " + Amount_max + ") or (AmountUSD<>0 and AmountUSD<= " + Amount_max + "))");
}
//ACCOUNT
var ACCOUNT = form.findField('ACCOUNT').getValue();
sql = sql + getAndConSql(sql, ACCOUNT, "(ACCOUNTRMB = '" + ACCOUNT + "' or ACCOUNTUSD='" + ACCOUNT + "')");
var IsLock = form.findField('IsLock').getValue();
if (IsLock != "") {
sql = sql + getAndConSql(sql, IsLock, " BILLSTATUS='" + IsLock + "' ");
}
return sql;
},
Print: function () {///结算列表
var printType = 'XXH_PayAppSettle_1';
var MainList = "";
var selectedRecords = [];
selectedRecords = this.gridList.selModel.getSelection();
for (var i = 0; i < selectedRecords.length; i++) {
var rec = selectedRecords[i];
if (MainList == "") { MainList = "'" + rec.get('BILLNO') + "'"; }
else {
MainList = MainList + ",'" + rec.get('BILLNO') + "'";
}
}
var T = this.getCondition();
if (T != "") { T = " where " + T; };
var sql1 = " SELECT GID,cm.BILLNO 结算单号,BILLDATE,SETTLEMODE,CUSTOMERNAME 结算单位,SETTLETYPE ,AMOUNTRMB RMB金额,ACCOUNTRMB,RATE ";
sql1 = sql1 + " ,AMOUNTUSD USD金额,ACCOUNTUSD,BILLTYPE,VOUCHERNO 总账凭证号,SETTLEUSER,SETTLETIME 结算时间,AUDITUSER,AUDITTIME,CREATEUSER,CREATETIME ";
sql1 = sql1 + " ,ISEXPORT 是否导出凭证,FINANCIALVOUCHER,BILLSTATUS,REMARK 备注,STLCATEGROY,COMPANYID,CUSTBANK,CUSTACCOUNT,VOUNO 凭证号,ACCOUNTS_CURRENCY ";
sql1 = sql1 + " ,ACCOUNTS_RATE,ACCOUNTS_MONEY,PREPAY_CURRENCY,PREPAY_RATE,PREPAY_MONEY,AHSR_CURRENCY ";
sql1 = sql1 + " ,AHSR_RATE,AHSR_MONEY,FINANCIAL_CURRENCY,FINANCIAL_RATE,FINANCIAL_MONEY,ADVANCE_CURRENCY,ADVANCE_RATE,ADVANCE_MONEY,CURR 币别";
sql1 = sql1 + " ,(select EnumValueName from tSysEnumValue where LangId=0 and EnumTypeID=97006 and EnumValueID=cm.BILLSTATUS) as 状态 ";
sql1 = sql1 + " ,(select ShowName from [user] where GID=cm.SETTLEUSER) as 结算人 ";
sql1 = sql1 + " ,(select ShowName from [user] where GID=cm.CREATEUSER) as CREATEUSERREF ";
sql1 = sql1 + " ,(select STLNAME from [code_stlmode] where STLCODE=cm.SETTLETYPE) as 结算方式 ";
sql1 = sql1 + " ,(select BANKNAME from [sys_bank] where GID=cm.ACCOUNTRMB) as RMB账户 ";
sql1 = sql1 + " ,(select BANKNAME from [sys_bank] where GID=cm.ACCOUNTUSD) as USD账户 ";
sql1 = sql1 + " ,(select EnumValueName from tSysEnumValue where LangId=0 and EnumTypeID=97007 and EnumValueID=cm.SETTLEMODE) as 结算类别 ";
sql1 = sql1 + " ,ISNULL((select sum(isnull(amount,0)-isnull(invoice,0)) as 未开票 from ch_fee where ISINVOICE<>1 and gid in (select feeid from ch_fee_do where BILLNO=cm.BILLNO)),0) as NOINVOICE ";
sql1 = sql1 + " ,cm.BS_CUSTOMERNAME 委托单位 ";
sql1 = sql1 + " ,(select AMOUNT from ch_fee_settlement_PAYRMB where BILLNO=cm.BILLNO) 购汇RMB ";
sql1 = sql1 + " ,(select sxf from ch_fee_settlement_PAYRMB where BILLNO=cm.BILLNO) 手续费 ";
sql1 = sql1 + " ,(select dhf from ch_fee_settlement_PAYRMB where BILLNO=cm.BILLNO) 电汇费 ";
sql1 = sql1 + " FROM ch_fee_settlement cm ";
//if (MainList == "") {
sql1 = sql1 + T;
//} else {
// sql1 = sql1 + " where BILLNO in (" + MainList + ")"
//}
sql1 = sql1 + " order by BILLNO ";
var sql2 = "";
var sql3 = "";
var sql4 = "";
var sql5 = "";
var sql6 = "";
PrintComm(printType, sql1, sql2, sql3, sql4, sql5, sql6);
},
Print_FYFZ: function () {///结算列表
var printType = 'XXH_PayAppSettle_FYFZ';
var MainList = "";
var selectedRecords = [];
selectedRecords = this.gridList.selModel.getSelection();
for (var i = 0; i < selectedRecords.length; i++) {
var rec = selectedRecords[i];
if (MainList == "") { MainList = "'" + rec.get('BILLNO') + "'"; }
else {
MainList = MainList + ",'" + rec.get('BILLNO') + "'";
}
}
var T = this.getCondition();
//if (MainList == "") {
if (T != "") { T = " where " + T; };
//} else {
// T = " where billno in (" + MainList + ") "
//}
if (T == "" && MainList == "") {
alert("无条件查询可能时间很久,请稍候...");
}
var sql1 = " select 委托单位,billno,customername,CURRENCY,EXCHANGERATE ";
sql1 = sql1 + " ,sum(货款) 货款,sum(税金) 税金,sum(冷藏费) 冷藏费,sum(代理费) 代理费,sum(其他) 其他 ";
sql1 = sql1 + " ,sum(货款_W) 货款_W,sum(税金_W) 税金_W,sum(冷藏费_W) 冷藏费_W,sum(代理费_W) 代理费_W,sum(其他_W) 其他_W,ACCOUNTUSDREF ";
sql1 = sql1 + " from (select billno,customername, 委托单位,t.CURRENCY,t.EXCHANGERATE ";
sql1 = sql1 + " ,(case CURRENCY when 'RMB' then case FEEGROUP when '融资款' then amount when '货款' then amount else 0 end else 0 end) 货款 ";
sql1 = sql1 + " ,(case CURRENCY when 'RMB' then case FEEGROUP when '税金' then amount else 0 end else 0 end) 税金 ";
sql1 = sql1 + " ,(case CURRENCY when 'RMB' then case FEEGROUP when '冷藏费' then amount else 0 end else 0 end) 冷藏费 ";
sql1 = sql1 + " ,(case CURRENCY when 'RMB' then case FEEGROUP when '代理费' then amount else 0 end else 0 end) 代理费 ";
sql1 = sql1 + " ,(case CURRENCY when 'RMB' then case FEEGROUP when '其他' then amount else 0 end else 0 end) 其他 ";
sql1 = sql1 + " ,(case CURRENCY when 'RMB' then 0 else case FEEGROUP when '融资款' then amount when '货款' then amount else 0 end end) 货款_W ";
sql1 = sql1 + " ,(case CURRENCY when 'RMB' then 0 else case FEEGROUP when '税金' then amount else 0 end end) 税金_W ";
sql1 = sql1 + " ,(case CURRENCY when 'RMB' then 0 else case FEEGROUP when '冷藏费' then amount else 0 end end) 冷藏费_W ";
sql1 = sql1 + " ,(case CURRENCY when 'RMB' then 0 else case FEEGROUP when '代理费' then amount else 0 end end) 代理费_W ";
sql1 = sql1 + " ,(case CURRENCY when 'RMB' then 0 else case FEEGROUP when '其他' then amount else 0 end end) 其他_W ";
sql1 = sql1 + " ,ACCOUNTUSDREF ";
sql1 = sql1 + " from (select c.billno,s.CUSTOMERNAME,bs.CUSTOMERNAME 委托单位 ,c.CURRENCY,c.EXCHANGERATE,sum(AMOUNT) amount,cf.FEEGROUP ";
sql1 = sql1 + " ,case when s.CURR='RMB' then (select BANKNAME from [sys_bank] where GID=s.ACCOUNTRMB) ";
sql1 = sql1 + " else (select BANKNAME from [sys_bank] where GID=s.ACCOUNTUSD) end as ACCOUNTUSDREF ";
//sql1 = sql1 + " ,(select customername from v_op_bs where bsno=c.bsno) 委托单位";
sql1 = sql1 + " from ch_fee_do c ";
sql1 = sql1 + " left join ch_fee_settlement s on s.BILLNO=c.BILLNO ";
sql1 = sql1 + " left join code_fee cf on cf.NAME=c.FEENAME ";
sql1 = sql1 + " left join v_op_bs bs on bs.bsno=c.bsno ";
if (MainList == "") {
sql1 = sql1 + " where c.billno in (select billno from ch_fee_settlement cm " + T + ")";
} else {
sql1 = sql1 + " where c.BILLNO in (" + MainList + ")"
}
sql1 = sql1 + " group by bs.CUSTOMERNAME ,c.BILLNO,c.CURRENCY,c.EXCHANGERATE,cf.FEEGROUP,s.CUSTOMERNAME,s.CURR,s.ACCOUNTUSD,s.ACCOUNTRMB ";
sql1 = sql1 + ") t)tt group by billno,customername,委托单位,CURRENCY,EXCHANGERATE,ACCOUNTUSDREF ";
var sql2 = "";
var sql3 = "";
var sql4 = "";
var sql5 = "";
var sql6 = "";
PrintComm(printType, sql1, sql2, sql3, sql4, sql5, sql6);
},
//#region 总账凭证
//#region 生成总账凭证
onAddCwVouchers: 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 strGids = "";
for (var i = 0; i < selections.length; i++) {
var rec = selections[i];
var VOUCHERNO = rec.data.VOUCHERNO; //凭证号
var BILLSTATUS = rec.data.BILLSTATUS; //是否锁定
if (VOUCHERNO == "" && BILLSTATUS == 1) {
if (strGids == "")
strGids = rec.data.GID;
else {
strGids += "," + rec.data.GID;
}
}
}
if (strGids == "") {
Ext.Msg.show({ title: '提示', msg: '请选择已锁定且未生成凭证的单据!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
return;
}
//this.storeListCw.load({ params: { strGids: strGids }, waitMsg: "正在刷新数据...", scope: this });
this.showContactForm(false, strGids, this);
//
},
//#endregion
//#region 总账层_显示信息
showContactForm: function (win, strGids, _this) {
var required = '*';
if (!win) {
//#region formDiv 下拉框信息加载
//制单人
this.storePREPAREDCode = Ext.create('DsExt.ux.RefTableStore', {
model: 'DsShipping.ux.UserRefModel',
proxy: { url: '/CommMng/BasicDataRef/GetUserRefList' }
});
this.storePREPAREDCode.load();
this.comboxPREPARED = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: '制单人',
store: this.storePREPAREDCode,
forceSelection: true,
//id: 'PREPARED',
name: 'PREPARED',
valueField: 'UserName',
displayField: 'CodeAndName',
value: SHOWNAME
});
//#endregion
//#region 汇率列表
//#region 定义数据集
this.storeListCw = Ext.create('Ext.data.Store', {
pageSize: this.PageSize,
model: 'MsCodeCurrencyList',
remoteSort: true,
proxy: {
type: 'ajax',
url: '/Account/Chfee_settlement/GetCodeCurrencyList',
reader: {
id: 'CURR',
root: 'data',
totalProperty: 'totalCount'
}
}
});
//#endregion
//#region 列定义
this.girdcolums = [{
sortable: false,
text: '币别',
dataIndex: 'CURR',
width: 100,
align: 'center'
}, {
sortable: false,
text: '调整汇率',
dataIndex: 'FCYEXRATE',
width: 118,
align: 'right',
renderer: function (value, cellmeta, record, rowIndex, columnIndex, store) { try { var lsValue = usMoney(value, 5, '', false); if (lsValue != "NaN") { value = lsValue; if (parseFloat(lsValue) < 0) { return '' + lsValue + ''; } } else { return value; } } catch (e) { return value; } return value; },
editor: {
xtype: 'numberfield',
selectOnFocus: true, //得到焦点时自动选择文本
allowDecimals: true, //允许输入小数
decimalPrecision: 5, //允许保留的小数位数,并四舍五入
nanText: '请输入有效小数',
hideTrigger: true //是否隐藏上下调节按钮
}
}];
//#endregion
//#region gridList列表显示信息
this.gridListCellEditing = Ext.create('Ext.grid.plugin.CellEditing', {
clicksToEdit: 1 //1单击,2双击
});
this.gridListCw = new Ext.grid.GridPanel({
region: 'center',
width: 220,
store: this.storeListCw,
enableHdMenu: false, //是否显示表格列的菜单
hideHeaders: false, //是否隐藏表头
rowLines: true,
columnLines: true,
loadMask: { msg: "数据加载中,请稍等..." },
plugins: [this.gridListCellEditing],
selType: 'cellmodel',
columns: this.girdcolums
});
//#endregion
//#endregion
//#region 编辑formDiv 基本信息
var formDiv = Ext.widget('form', {
border: false,
bodyPadding: 10,
fieldDefaults: {
labelAlign: 'right',
labelWidth: 60,
labelStyle: 'font-weight:bold'
},
items: [this.comboxPREPARED, {
fieldLabel: '记账日期',
format: 'Y-m-d',
xtype: 'datefield',
allowBlank: false,
id: 'VOUDATE',
name: 'VOUDATE',
value: Ext.util.Format.date(Ext.Date.add(new Date(), Ext.Date.MONTH - 1, 1), "Y-m-d")
}, {
//fieldLabel: "",
xtype: "checkbox", //checkbox控件
//id: "ButtSettlement",
name: "ButtSettlement",
boxLabel: "对抵结算是否生成银行账款",
width: 200,
inputValue: "true", //选中的值
uncheckedValue: "false" //未选中的值
}, {
//fieldLabel: "",
xtype: "checkbox", //checkbox控件
id: "ISRATE",
name: "ISRATE",
boxLabel: "是否按照系统录入汇率",
width: 200,
inputValue: "true", //选中的值
uncheckedValue: "false", //未选中的值
checked: true, //绘制时的选中状态,
listeners: {
'change': function (field, newValue, oldValue, eOpts) {
if (field.checked.toString() == "false") {
//Ext.getCmp('myGroup').show();
this.gridListCw.show();
}
else {
//Ext.getCmp('myGroup').hide();
this.gridListCw.hide();
}
},
scope: this
}
}, this.gridListCw
],
buttons: [{
text: '生成凭证',
handler: function (options, success, response) {
if (!this.up('form').getForm().isValid()) {
return;
}
var dataDiv = this.up('form').getForm().getValues(false, false, false);
//
var j = 0;
var bodydatas = [];
for (var i = 0; i < _this.storeListCw.getCount(); i += 1) {
var member = _this.storeListCw.getAt(i);
bodydatas.push(member);
}
var jsonBody;
if (bodydatas.length > 0) {
jsonBody = ConvertRecordsToJsonAll(bodydatas);
}
//
Ext.Msg.wait('正在保存数据, 请稍侯..');
Ext.Ajax.request({
waitMsg: '正在保存数据...',
url: '/Account/Chfee_settlement/onAddCwVouchers',
scope: this,
params: {
strGids: strGids,
dataDiv: Ext.JSON.encode(dataDiv),
jsonBody: jsonBody
},
callback: function (options, success, response) {
if (success) {
Ext.MessageBox.hide();
var jsonresult = Ext.JSON.decode(response.responseText);
if (jsonresult.Success) {
var sData = jsonresult.Data;
//是否自动弹出结算凭证
Ext.Ajax.request({
waitMsg: '正在保存数据...',
url: '/Account/Chfee_settlement/onIsSettlementsopen',
scope: this,
callback: function (options, success, response) {
if (success) {
Ext.MessageBox.hide();
var jsonresult = Ext.JSON.decode(response.responseText);
if (jsonresult.Success) {
_this.onSelCwVouchers(sData.toString());
//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 });
}
} else {
//Ext.Msg.show({ title: '请重试', msg: '服务器响应出错', icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK });
}
//Ext.Msg.hide();
}
});
_this.onRefreshClick();
return;
} 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
});
}
}
});
//
this.up('form').getForm().reset();
//this.up('window').hide();
this.up('window').close();
}
}, {
text: '取消',
handler: function () {
this.up('form').getForm().reset();
//this.up('window').hide();
this.up('window').close();
}
}],
listeners: {
scope: this,
'render': function (thisDiv, thisExtend) {
this.storeListCw.load({ params: { strGids: strGids }, waitMsg: "正在刷新数据...", scope: this });
var ISRATE = Ext.getCmp('ISRATE').getValue().toString();
if (ISRATE == "false") {
this.gridListCw.show();
}
else {
this.gridListCw.hide();
}
//
Ext.Ajax.request({
waitMsg: '正在查询委托编号状态...',
url: '/MvcShipping/MsBaseInfo/GetCwVOUNO',
params: {
VKNO: "记"
},
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;
}
//
data = result.data;
var arrayList = new Array();
arrayList = data.split("~");
var strY = arrayList[0].toString();
var strM = arrayList[1].toString();
var sVOUNO = arrayList[2].toString();
var strVOUNO = arrayList[3].toString();
var strVOUDATE = arrayList[4].toString();
var strACCDATE = arrayList[5].toString();
//
Ext.getCmp('VOUDATE').setValue(strVOUDATE);
Ext.getCmp('VOUDATE').setMinValue(strACCDATE + "-01");
} else {
Ext.MessageBox.alert('请求出现错误,请重试', response.responseText);
}
},
scope: this
});
}
}
});
//#endregion
win = Ext.widget('window', {
title: '生成总账凭证',
closeAction: 'destroy', //hide,destroy
width: 250,
height: 250,
layout: 'fit',
resizable: true,
modal: true,
closable: false, //为false时tab上不显示叉号
items: formDiv
});
}
win.show();
},
//#endregion
//#region 查看总账凭证
onSelCwVouchers: function (sVOUCHERNO) {
if (sVOUCHERNO == '') {
var selections = this.gridList.getSelectionModel().getSelection();
var rec = selections[0];
var sVOUCHERNO = rec.data.VOUCHERNO;
if (sVOUCHERNO == '') {
//Ext.Msg.show({ title: '提示', msg: '请先生成接口凭证!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
return;
}
}
this.sqlcontext = sVOUCHERNO;
this.OprationStatus = 'sel';
DsOpenEditWin('/MvcShipping/MsCwVouchersGl/Edit', "总账凭证录入", "500", "940", "10", "10");
},
//#endregion
//#endregion
//#region 接口凭证
//#region 生成接口凭证
onAddCwVouchersJK: 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 strGids = "";
for (var i = 0; i < selections.length; i++) {
var rec = selections[i];
var VOUNO = rec.data.VOUNO; //凭证号
var BILLSTATUS = rec.data.BILLSTATUS; //是否锁定
if (VOUNO == "" && BILLSTATUS == 1) {
if (strGids == "")
strGids = rec.data.GID;
else {
strGids += "," + rec.data.GID;
}
}
}
if (strGids == "") {
Ext.Msg.show({ title: '提示', msg: '请选择已锁定且未生成凭证的单据!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
return;
}
//
this.showContactFormJK(false, strGids, this);
},
//#endregion
//#region 接口层_显示信息
showContactFormJK: function (winJK, strGids, _this) {
var required = '*';
if (!winJK) {
//#region formDiv 下拉框信息加载
//制单人
this.storePREPAREDCode = Ext.create('DsExt.ux.RefTableStore', {
model: 'DsShipping.ux.UserRefModel',
proxy: { url: '/CommMng/BasicDataRef/GetUserRefList' }
});
this.storePREPAREDCode.load();
this.comboxPREPARED = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: '制单人',
store: this.storePREPAREDCode,
forceSelection: true,
//id: 'PREPARED',
name: 'PREPARED',
valueField: 'UserName',
displayField: 'CodeAndName',
value: SHOWNAME
});
//#endregion
//#region 编辑formDiv 基本信息
var formDivJK = Ext.widget('form', {
border: false,
bodyPadding: 10,
fieldDefaults: {
labelAlign: 'right',
labelWidth: 60,
labelStyle: 'font-weight:bold'
},
items: [this.comboxPREPARED, {
fieldLabel: '记账日期',
format: 'Y-m-d',
xtype: 'datefield',
allowBlank: false,
id: 'VOUDATE',
name: 'VOUDATE',
value: Ext.util.Format.date(Ext.Date.add(new Date(), Ext.Date.MONTH - 1, 1), "Y-m-d"),
listeners: {
'blur': function (field, The, eOpts) {
this.GetCodeCurrencyListJK(Ext.getCmp('VOUDATE').getRawValue());
},
scope: this
}
}, {
//fieldLabel: "",
xtype: "checkbox", //checkbox控件
//id: "ButtSettlement",
name: "ButtSettlement",
boxLabel: "对抵结算是否生成银行账款",
width: 200,
inputValue: "true", //选中的值
uncheckedValue: "false" //未选中的值
}, {
//fieldLabel: "",
xtype: "checkbox", //checkbox控件
id: "ISRATE",
name: "ISRATE",
boxLabel: "是否按照系统录入汇率",
width: 200,
inputValue: "true", //选中的值
uncheckedValue: "false", //未选中的值
checked: true, //绘制时的选中状态
listeners: {
'change': function (field, newValue, oldValue, eOpts) {
if (field.checked.toString() == "false") {
Ext.getCmp('RATE').show();
}
else {
Ext.getCmp('RATE').hide();
}
},
scope: this
}
}, {
fieldLabel: '美元汇率',
id: 'RATE',
name: 'RATE',
xtype: 'numberfield',
nanText: '请输入有效整数',
value: 1,
//labelAlign: 'right',
//labelWidth: 65,
//width: 163,
allowBlank: false
}],
buttons: [{
text: '生成凭证',
handler: function (options, success, response) {
if (!this.up('form').getForm().isValid()) {
return;
}
var dataDiv = this.up('form').getForm().getValues(false, false, false);
//
Ext.Msg.wait('正在保存数据, 请稍侯..');
Ext.Ajax.request({
waitMsg: '正在保存数据...',
url: '/Account/Chfee_settlement/onAddCwVouchersJK',
scope: this,
params: {
strGids: strGids,
dataDiv: Ext.JSON.encode(dataDiv)
},
callback: function (options, success, response) {
if (success) {
Ext.MessageBox.hide();
var jsonresult = Ext.JSON.decode(response.responseText);
if (jsonresult.Success) {
var sData = jsonresult.Data;
//是否自动弹出结算凭证
Ext.Ajax.request({
waitMsg: '正在保存数据...',
url: '/Account/Chfee_settlement/onIsSettlementsopenJK',
scope: this,
callback: function (options, success, response) {
if (success) {
Ext.MessageBox.hide();
var jsonresult = Ext.JSON.decode(response.responseText);
if (jsonresult.Success) {
_this.onSelCwVouchersJK(sData.toString());
//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 });
}
} else {
//Ext.Msg.show({ title: '请重试', msg: '服务器响应出错', icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK });
}
//Ext.Msg.hide();
}
});
_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 });
}
}
});
//
this.up('form').getForm().reset();
//this.up('window').hide();
this.up('window').close();
}
}, {
text: '取消',
handler: function () {
this.up('form').getForm().reset();
//this.up('window').hide();
this.up('window').close();
}
}],
listeners: {
scope: this,
'render': function (thisDiv, thisExtend) {
Ext.getCmp('RATE').hide();
this.GetCodeCurrencyListJK(Ext.getCmp('VOUDATE').getRawValue());
}
}
});
//#endregion
winJK = Ext.widget('window', {
title: '生成接口凭证',
closeAction: 'destroy', //hide,destroy
width: 250,
height: 250,
layout: 'fit',
closable: false, //为false时tab上不显示叉号
resizable: true,
modal: true,
items: formDivJK
});
}
winJK.show();
},
//获取默认汇率
GetCodeCurrencyListJK: function (sVOUDATE) {
Ext.Ajax.request({
waitMsg: '正在添加数据...',
url: '/Account/Chfee_settlement/GetCodeCurrencyListJK',
params: {
sVOUDATE: sVOUDATE
},
callback: function (options, success, response) {
if (success) {
var result = Ext.JSON.decode(response.responseText);
if (!result.Success) {
Ext.getCmp('RATE').setValue("0");
//Ext.Msg.show({ title: '提示', msg: result.Message, icon: Ext.MessageBox.ERROR, buttons: Ext.Msg.OK });
return;
} else {
Ext.getCmp('RATE').setValue(result.data[0].FCYEXRATE.toString());
}
} else {
Ext.getCmp('RATE').setValue("0");
//Ext.MessageBox.alert('请求出现错误,请重试', response.responseText);
}
},
scope: this
});
},
//#endregion
//#region 查看接口凭证
onSelCwVouchersJK: function (sVOUNO) {
if (sVOUNO == '') {
var selections = this.gridList.getSelectionModel().getSelection();
var rec = selections[0];
var sVOUNO = rec.data.VOUNO;
if (sVOUNO == '') {
//Ext.Msg.show({ title: '提示', msg: '请先生成接口凭证!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
return;
}
}
this.sqlcontext = sVOUNO;
this.OprationStatus = 'sel';
DsOpenEditWin('/MvcShipping/MsCwVouchers/Edit', "接口凭证录入", "500", "940", "10", "10");
},
//#endregion
//#endregion
//凭证维护页面的传值
OprationSwapJK: function () {
var ret = new Array();
ret[0] = this.OprationStatus;
ret[1] = this.storeList;
ret[2] = this.SelectedRecord;
ret[3] = this.sqlcontext;
ret[4] = Ext.getCmp('btnRefresh');
ret[5] = null;
ret[6] = null;
ret[7] = null;
ret[8] = null;
ret[9] = null;
ret[10] = null;
return ret;
},
//维护页面的传值
OprationSwap: function () {
var ret = new Array();
ret[0] = this.OprationStatus;
ret[1] = this.storeList;
ret[2] = this.SelectedRecord;
ret[3] = this.sqlcontext;
return ret;
}
});