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

4680 lines
168 KiB
JavaScript

2 years ago
Ext.namespace('Shipping');
Shipping.MsChHexiaoEdit = function (config) {
Ext.applyIf(this, config);
this.initUIComponents();
window.Shipping.MsChHexiaoEdit.superclass.constructor.call(this);
};
Ext.extend(Shipping.MsChHexiaoEdit, Ext.Panel, {
ParentWin: null,
OpStatus: 'add',
StoreList: null,
EditRecord: null,
addstore: false,
PageSize: 50,
StlPageSize: 50,
sqlcontext: '',
BodyPageSize: 50,
initUIComponents: function () {
this.serialNo = 0;
this.workSerialNo = 0;
this.bodyDel = [];
this.FeeSql = '';
this.BillSql = '';
this.DuiBillSql = '';
this.IsDebit = '0';
this.sortfield = '';
this.sortdire = '';
this.MsPeriod = null;
this.canedit = false;
this.selectfeesql = '';
this.selectstlno = '';
Ext.Ajax.timeout = 120000;
this.formname = "MsChHexiaoEdit"; //页面名称
this.StoreLockOp = Ext.create('DsExt.ux.RefTableStore', {
model: 'MsFeeOP',
proxy: { url: '/MvcShipping/MsBaseInfo/GetOpIDRang' }
});
// this.StoreLockOp.load({ params: { optype: "modRecvFeeSettlementLock"} });
this.StoreUnLockOp = Ext.create('DsExt.ux.RefTableStore', {
model: 'MsFeeOP',
proxy: { url: '/MvcShipping/MsBaseInfo/GetOpIDRang' }
});
// this.StoreUnLockOp.load({ params: { optype: "modRecvFeeSettlementUnLock"} });
Ext.define('DsShipping.ux.MsClientGroup', {
extend: 'Ext.data.Model',
fields: [
{ name: 'SHORTNAME', type: 'string' },
{ name: 'PCORPNAME', type: 'string' },
{ name: 'CODENAME', type: 'string' }
]
});
_this = this;
this.StoreClientGroup = Ext.create('DsExt.ux.RefTableStore', {
model: 'DsShipping.ux.MsClientGroup',
proxy: { url: '/MvcShipping/MsInfoClient/GetClientGroupList' }
});
this.StoreClientGroup.load({ params: { condition: "PCORPNAME<>'' " }
});
//#region 编辑form
//枚举参照相关(编辑form)
//表参照相关(编辑form)
this.storeCustCode = Ext.create('DsExt.ux.RefTableStore', {
model: 'DsShipping.ux.CustomInvRefModel',
proxy: { url: '/CommMng/BasicDataRef/GetCustomInvRefListRm' }
});
// this.storeCustCode.load({ params: { condition: ""} });
this.comboxCustCode = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: '核销单位',
store: this.storeCustCode,
allowBlank: false,
queryMode: 'remote',
minChars: 1,
queryParam: 'CODENAME',
name: 'CUSTOMERNAME',
valueField: 'CustName',
displayField: 'CodeAndName'
});
this.StoreOpRange = Ext.create('DsExt.ux.RefTableStore', {
model: 'MsOP',
proxy: { url: '/MvcShipping/MsBaseInfo/GetOpRang' }
});
this.StoreCurr = Ext.create('DsExt.ux.RefTableStore', {
model: 'MsFeeCurr',
proxy: { url: '/MvcShipping/MsChFee/GetFeeCurrList' }
});
this.StoreCurr.load({ params: { condition: ""} });
this.StoreDateCurr = Ext.create('DsExt.ux.RefTableStore', {
model: 'MsFeeCurr',
proxy: { url: '/MvcShipping/MsChFee/GetFeeNowCurrList' }
});
this.StoreDateCurr.load({ params: { condition: ""} });
this.comboxCurr = Ext.create('DsExt.ux.RefTableCombox', {
store: this.StoreCurr,
name: 'CURR',
valueField: 'CURR',
displayField: 'CURR'
});
this.StoreStlMode = Ext.create('DsExt.ux.RefTableStore', {
model: 'STLMODE',
proxy: { url: '/MvcShipping/MsBaseInfo/GetStlModeList' }
});
this.StoreStlMode.load({ params: { condition: ""} });
this.comboxStlMode = Ext.create('DsExt.ux.RefTableCombox', {
store: this.StoreStlMode,
valueField: 'STLCODE',
displayField: 'STLNAME'
});
this.StoreBANK = Ext.create('DsExt.ux.RefTableStore', {
model: 'BANK',
proxy: { url: '/MvcShipping/MsBaseInfo/GetBANKList' }
});
this.StoreBANK.load({ params: { condition: ""} });
this.comboxBANK = Ext.create('DsExt.ux.RefTableCombox', {
store: this.StoreBANK,
forceSelection: true,
name: 'ACCOUNT',
valueField: 'GID',
displayField: 'BANKACCOUNT'
});
this.storeBillType = Ext.create('Ext.data.Store', {
fields: ['DC', 'NAME']
});
this.storeBillType.add({ "DC": "1", "NAME": "应收" });
this.storeBillType.add({ "DC": "2", "NAME": "应付" });
this.comboxBillType = Ext.create('DsExt.ux.RefTableCombox', {
store: this.storeBillType,
valueField: 'DC',
displayField: 'NAME',
forceSelection: true
});
//编辑form
this.formEdit = Ext.widget('form', {
region: 'west',
width: 450,
frame: true,
bodyPadding: 3,
trackResetOnLoad: true,
// autoScroll: true,
fieldDefaults: {
margins: '2 2 2 2',
labelAlign: 'right',
flex: 1,
labelWidth: 80,
msgTarget: 'qtip'
},
items: [
{//fieldset 1
xtype: 'fieldset',
defaultType: 'textfield',
layout: 'anchor',
defaults: {
anchor: '100%'
},
items: [{
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [{
fieldLabel: 'GID',
name: 'GID', flex: 0, hidden: true, margins: '0'
}, {
fieldLabel: 'BILLSTATUS',
name: 'BILLSTATUS', flex: 0, hidden: true, margins: '0'
}, {
fieldLabel: 'COMPANYID',
name: 'COMPANYID', flex: 0, hidden: true, margins: '0'
}, {
fieldLabel: 'CREATEUSER',
name: 'CREATEUSER', flex: 0, hidden: true, margins: '0'
}, {
fieldLabel: 'CREATETIME',
name: 'CREATETIME', flex: 0, hidden: true, margins: '0'
}, {
fieldLabel: 'VOUNO',
name: 'VOUNO', flex: 0, hidden: true, margins: '0'
}, {
fieldLabel: 'EXPVOUNO',
name: 'EXPVOUNO', flex: 0, hidden: true, margins: '0'
},
{
fieldLabel: '核销单号',
readOnly: true,
name: 'BILLNO'
}, {
fieldLabel: '状态',
readOnly: true,
name: 'BILLSTATUSREF'
}
]
}, {
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [this.comboxCustCode, {
fieldLabel: '创建日期',
readOnly: true,
name: 'BILLDATE'
}]
}, {
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [{
fieldLabel: '创建人',
readOnly: true,
name: 'CREATEUSERREF'
}, {
fieldLabel: '审核人',
readOnly: true,
name: 'AUDITUSERREF'
}]
}, {
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [{
fieldLabel: '备注',
flex: 1,
name: 'REMARK'
}]
}
]//end items(fieldset 1)
}//end fieldset 1
]//end root items
}); //end this.formEdit
//#endregion
//#region 按钮Toolbar
this.panelBtn = new Ext.Panel({
region: "north",
tbar: [
{
id: 'btnESave',
text: "保存",
iconCls: "btnsave",
handler: function (button, event) {
this.Save('0');
},
scope: this
}, '-',
{
text: "打印",
handler: function (button, event) {
this.Print();
},
scope: this
},
'-',
{
id: 'btnESaveAndClose',
text: "保存并关闭",
handler: function (button, event) {
this.Save('1');
},
scope: this
},
'-',
{
id: 'btnESaveAndNew',
text: "保存并新建",
handler: function (button, event) {
this.Save('2');
this.GetEditStatus();
},
scope: this
},
'-',
{
id: 'btnENew',
text: "新建",
handler: function (button, event) {
this.LoadData('add', '*');
},
scope: this
}, '-', {
id: 'btnSubmitAudit',
text: '锁定',
tooltip: '锁定',
handler: function (button, event) {
this.onSubmitAuditClick();
},
scope: this
}, '-', {
id: 'btnSubmitAuditBack',
text: '撤销锁定',
tooltip: '撤销锁定',
handler: function (button, event) {
this.onSubmitAuditBackClick();
},
scope: this
}, '-', {
id: 'btnDelete',
text: '删除',
tooltip: '删除',
handler: function (button, event) {
this.onDeleteClick(button, event);
},
scope: this
}
]
}); //end 按钮Toolbar
//#endregion
//#region 结算列表
this.storeSelectList = Ext.create('Ext.data.Store', {
model: 'MsChSettlement'
});
this.storeStlList = Ext.create('Ext.data.Store', {
pageSize: this.StlPageSize,
model: 'MsChSettlement',
remoteSort: true,
proxy: {
type: 'ajax',
url: '/Account/Chfee_settlement/GetDataList',
reader: {
id: 'BILLNO',
root: 'data',
totalProperty: 'totalCount'
}
}
});
this.StlPagenum = Ext.create('Ext.form.field.Number', {
name: 'bottles',
fieldLabel: '每页记录数', //每页记录数
labelAlign: 'right',
value: this.StlPageSize,
maxValue: 100000,
width: 180,
minValue: 0,
listeners: {
specialkey: function (field, e) {
if (e.getKey() == e.ENTER) {
_this.storeStlList.reload();
}
}
}
});
this.StlGridCheckBoxModel = Ext.create('Ext.selection.CheckboxModel');
this.initstlgirdcolums = [{
sortable: true,
dataIndex: 'CUSTOMERNAME',
header: '结算单位',
width: 120
}, {
sortable: true,
dataIndex: 'BILLTYPE',
header: '收付',
editor: this.comboxBillType,
width: 50,
renderer: function (value, p, record) {
return record.data.BILLTYPEREF;
}
}, {
sortable: true,
dataIndex: 'CURR',
header: '币别',
editor: this.comboxCurr,
width: 50
}, {
sortable: true,
dataIndex: 'SETTLETYPE',
header: '结算方式',
editor: this.comboxStlMode,
width: 100,
renderer: function (value, p, record) {
return record.data.SETTLETYPEREF;
}
}, {
sortable: true,
dataIndex: 'AMOUNT',
header: '核销金额',
align: 'right',
width: 120
// ,
// editor: {
// xtype: 'numberfield',
// keyNavEnabled: false,
// selectOnFocus: true,
// hideTrigger: true,
// mouseWheelEnabled: false,
// enableKeyEvents: true
// }
}, {
sortable: true,
dataIndex: 'STLAMOUNT',
header: '预计核销',
align: 'right',
width: 120,
editor: {
xtype: 'numberfield',
keyNavEnabled: false,
selectOnFocus: true,
hideTrigger: true,
mouseWheelEnabled: false,
enableKeyEvents: true
}
}, {
sortable: true,
dataIndex: 'FINANCIAL_MONEY',
header: '其他金额',
align: 'right',
width: 80,
editor: {
xtype: 'numberfield',
keyNavEnabled: false,
selectOnFocus: true,
hideTrigger: true,
mouseWheelEnabled: false,
enableKeyEvents: true
}
}, {
sortable: true,
dataIndex: 'ADVANCE_MONEY',
header: '手续费',
align: 'right',
width: 80,
editor: {
xtype: 'numberfield',
keyNavEnabled: false,
selectOnFocus: true,
hideTrigger: true,
mouseWheelEnabled: false,
enableKeyEvents: true
}
}, {
sortable: true,
dataIndex: 'ACCOUNT',
header: '银行账户',
editor: this.comboxBANK,
width: 150,
renderer: function (value, p, record) {
return record.data.ACCOUNTREF;
}
}, {
sortable: true,
dataIndex: 'SETTLETIME',
header: '结算日期',
editor: {
xtype: 'datefield',
format: 'Y-m-d',
allowBlank: false,
selectOnFocus: true
},
renderer: Ext.util.Format.dateRenderer('Y-m-d'),
width: 100
}, {
sortable: true,
dataIndex: 'SETTLEUSERREF',
header: '结算人',
width: 100
}, {
sortable: true,
dataIndex: 'BILLNO',
header: '结算单号',
width: 120
}, {
sortable: true,
dataIndex: 'CREATETIME',
header: '创建时间',
width: 100
}, {
sortable: true,
dataIndex: 'NOINVOICE',
header: '未开票',
width: 120
}, {
sortable: true,
dataIndex: 'BILLSTATUS',
header: '状态',
width: 60,
renderer: function (value, p, record) {
return record.data.BILLSTATUSREF;
}
}, {
sortable: true,
dataIndex: 'ISEXPORT',
header: '是否导出凭证',
width: 120
}, {
sortable: true,
dataIndex: 'REMARK',
header: '备注',
width: 160
}];
this.stlgirdcolums = this.initstlgirdcolums;
this.stlgridListCellEditing = Ext.create('Ext.grid.plugin.CellEditing', {
clicksToEdit: 1
});
this.stlgridList = new Ext.grid.GridPanel({
store: this.storeStlList,
enableHdMenu: false,
region: 'center',
loadMask: { msg: "数据加载中,请稍等..." },
trackMouseOver: true,
disableSelection: false,
plugins: [this.stlgridListCellEditing],
selModel: this.StlGridCheckBoxModel,
viewConfig: {
enableTextSelection: true
},
tbar: [{
text: '添加结算',
tooltip: '添加结算',
id: 'btnaddstl',
iconCls: "btnadddetail",
handler: function (button, event) {
this.onAddStlClick();
},
scope: this
}, {
text: '拆分结算',
tooltip: '拆分结算',
id: 'btnfenstl',
iconCls: "btnadddetail",
handler: function (button, event) {
this.onMDStlClick();
},
scope: this
}, '-', {
text: '提交锁定',
tooltip: '提交锁定',
id: 'btnSubmitStlAudit',
handler: function (button, event) {
this.onSubmitStlAuditClick();
},
scope: this
}, '-', {
text: '撤销锁定',
tooltip: '撤销锁定',
id: 'btnSubmitStlAuditBack',
handler: function (button, event) {
this.onSubmitStlAuditBackClick();
},
scope: this
}, '-', {
text: '删除结算',
tooltip: '删除结算',
id: 'btndelstl',
iconCls: "btndeletedetail",
handler: function (button, event) {
this.onDelStlClick();
},
scope: this
}, '-', {
text: "保存列表样式",
menu: [
{ text: "保存",
handler: function (button, event) {
_this.stlgirdcolums = DsTruck.SaveGridPanel(USERID, _this.formname + 'stl', _this.stlgridList.columns, _this.stlgirdcolums, 1, true);
}
}, { text: "初始化",
handler: function (menu, event) {
_this.stlgirdcolums = DsTruck.SaveGridPanel(USERID, _this.formname + 'stl', _this.stlgridList.columns, _this.initstlgirdcolums, 1, true);
}
}],
scope: this
}],
columns: this.stlgirdcolums,
bbar: [Ext.create('Ext.PagingToolbar', {
store: this.storeStlList,
displayInfo: true,
displayMsg: '当前显示条数据', //当前显示条数据
emptyMsg: '没有数据'//没有数据
}), this.StlPagenum]
});
this.stlgridList.on('edit', function (editor, e, eOpts) {
this.stlgridAfterEdit(editor, e, eOpts);
}, this);
this.stlgridListCellEditing.on('beforeedit', function (editor, e) {
return this.cellEditingStlGridBeforeEdit(editor, e);
}, this);
this.stlgirdcolums = DsTruck.GetGridPanel(USERID, this.formname + 'stl', this.stlgirdcolums, 1); //使用者id表名中间column数组跳过一开始的几列
this.stlgridList.reconfigure(this.storeStlList, this.stlgirdcolums);
this.storeStlList.on('beforeload', function (store) {
var Duino = this.formEdit.getForm().findField('BILLNO').getValue();
var sql = " HXBILLNO='" + Duino + "'";
Ext.apply(store.proxy.extraParams, { condition: sql, billtype: 0 });
}, this);
_this.storeStlList.on('load', function (store, records) {
if (store.getCount() > 0) {
for (var i = 0; i < store.getCount(); i += 1) {
var member = store.getAt(i);
var GID = member.data.GID;
for (var j = 0; j < this.storeSelectList.getCount(); j += 1) {
var memberselect = this.storeSelectList.getAt(j);
if (GID == memberselect.data.GID) {
_this.stlgridList.getSelectionModel().select(member);
}
}
}
} else {
}
}, this);
//#endregion
//#region 明细表
//明细表表格相关
this.GridCheckBoxModel = Ext.create('Ext.selection.CheckboxModel');
//明细表-数据集
this.storeBodyList = Ext.create('Ext.data.Store', {
model: 'Chfee_do_detail',
pageSize: this.BodyPageSize,
remoteSort: true,
proxy: {
type: 'ajax',
timeout: 120000,
url: '/Account/Chfee_settlement/GetBillListPage',
reader: {
id: 'BSNO,FEEDOID',
root: 'data',
totalProperty: 'totalCount'
}
}
});
this.BodyPagenum = Ext.create('Ext.form.field.Number', {
name: 'bottles',
fieldLabel: '每页记录数', //每页记录数
labelAlign: 'right',
value: this.BodyPageSize,
maxValue: 100000,
width: 180,
minValue: 0,
listeners: {
specialkey: function (field, e) {
if (e.getKey() == e.ENTER) {
_this.storeBodyList.reload();
}
}
}
});
//明细表表格
this.gridListCellEditing = Ext.create('Ext.grid.plugin.CellEditing', {
clicksToEdit: 1
});
this.initgirdbillcolums = [ {
sortable: true,
dataIndex: 'BSNO',
header: 'BSNO',
hidden: true,
width: 100
}, {
sortable: true,
dataIndex: 'FEEDOID',
header: 'FEEDOID',
hidden: true,
width: 100
}, {
sortable: true,
dataIndex: 'BILLNO',
header: '结算单号',
width: 120
}, {
sortable: true,
dataIndex: 'CUSTNO',
header: '委托编号',
width: 120
}, {
sortable: true,
dataIndex: 'MBLNO',
header: '主提单号',
width: 120
}, {
sortable: true,
dataIndex: 'CUSTOMERNAME',
header: '委托单位',
width: 100
}, {
sortable: true,
dataIndex: 'ETD',
header: '开船日期',
renderer: Ext.util.Format.dateRenderer('Y-m-d'),
width: 100
}, {
sortable: true,
dataIndex: 'BSSOURCE',
header: '业务来源',
width: 80
}, {
sortable: true,
dataIndex: 'FEENAME',
header: '费用名称',
width: 80
}, {
sortable: true,
dataIndex: 'FEETYPEREF',
header: '收付',
width: 40
}, {
sortable: true,
dataIndex: 'FEEOBJNAME',
header: '费用对象',
width: 80
}, {
sortable: true,
dataIndex: 'AMOUNT',
header: '结算金额',
width: 80,
renderer: function (value, cellmeta, record, rowIndex, columnIndex, store) {
try {
var lsValue = usMoney(value, 2, '', false);
if (lsValue != "NaN") {
value = lsValue; if (parseFloat(lsValue) < 0) {
return '<SPAN style="COLOR: red">' + lsValue + '</SPAN>';
}
}
else {
return value;
}
}
catch (e) {
return value;
}
return value;
}
}, {
sortable: true,
dataIndex: 'ORIGCURRENCY',
header: '原始币别',
width: 80
}, {
sortable: true,
dataIndex: 'ORIGEXCHANGERATE',
header: '原始汇率',
width: 80
}, {
sortable: true,
dataIndex: 'EXCHANGERATE',
header: '折算汇率',
width: 80
}, {
sortable: true,
dataIndex: 'ORIGAMOUNT',
header: '原始金额',
width: 80,
renderer: function (value, cellmeta, record, rowIndex, columnIndex, store) {
try {
var lsValue = usMoney(value, 2, '', false);
if (lsValue != "NaN") {
value = lsValue; if (parseFloat(lsValue) < 0) {
return '<SPAN style="COLOR: red">' + lsValue + '</SPAN>';
}
}
else {
return value;
}
}
catch (e) {
return value;
}
return value;
}
}, {
sortable: true,
dataIndex: 'SALE',
header: '揽货人',
width: 80
}, {
sortable: true,
dataIndex: 'ENTERP',
header: '经营单位',
width: 80
}, {
sortable: true,
dataIndex: 'CUSTOMNO',
header: '报关单号',
width: 108
}, {
sortable: true,
dataIndex: 'ACCDATE',
header: '会计期间',
width: 108
}, {
sortable: true,
dataIndex: 'OPTYPE',
header: '更改单',
width: 108
}, {
sortable: true,
dataIndex: 'Remark',
header: '备注',
width: 180
}, {
sortable: true,
dataIndex: 'INPUTMODE',
header: '录入方式',
width: 160
}
];
this.girdbillcolums = this.initgirdbillcolums;
this.gridList = new Ext.grid.GridPanel({
store: this.storeBodyList,
enableHdMenu: false,
region: 'center',
loadMask: { msg: "数据加载中,请稍等..." },
trackMouseOver: true,
disableSelection: false,
viewConfig: {
enableTextSelection: true
},
selModel: this.GridCheckBoxModel,
tbar: [{
xtype: 'label',
width: 90,
// height: 22,
text: '结算明细'
}, {
text: '删除明细',
tooltip: '删除明细',
id: 'btndeldetail',
iconCls: "btndeletedetail",
handler: function (button, event) {
this.onDeleteDetailClick(button, event);
},
scope: this
}, '-', {
text: "保存列表样式",
id: "btntestbody",
menu: [
{ text: "保存",
handler: function (button, event) {
_this.girdbillcolums = DsTruck.SaveGridPanel(USERID, _this.formname + 'bill', _this.gridList.columns, _this.girdbillcolums, 1, true);
}
}, { text: "初始化",
handler: function (menu, event) {
_this.girdbillcolums = DsTruck.SaveGridPanel(USERID, _this.formname + 'bill', _this.gridList.columns, _this.initgirdbillcolums, 1, true);
}
}],
scope: this
}],
columns: this.girdbillcolums,
// paging bar on the bottom
bbar: [Ext.create('Ext.PagingToolbar', {
store: this.storeBodyList,
displayInfo: true,
displayMsg: '当前显示条数据', //当前显示条数据
emptyMsg: '没有数据'//没有数据
}), this.BodyPagenum]
});
this.gridList.addListener('sortchange', function (ct, column, direction, eOpts) {
this.sortfield = column.dataIndex;
this.sortdire = direction;
}, this);
this.gridList.addListener('itemdblclick', function (dataview, record, item, index, e, b) {
this.SelectedRecord = record;
var openSet = "height=700, width=1024, toolbar=no, menubar=no,scrollbars=1, resizable=1,location=no, status=no,Top= " + (screen.height - 750) / 2 + ",Left= " + (screen.width - 1100) / 2
var openType = "_blank";
var openUrl = "";
openUrl = "../../MvcShipping/MsOpBill/MsOpFeeView?handle=check&bsno=" + record.data.BSNO;
window.open(openUrl, openType, openSet);
}, this);
this.girdbillcolums = DsTruck.GetGridPanel(USERID, this.formname + 'bill', this.girdbillcolums, 1); //使用者id表名中间column数组跳过一开始的几列
this.girdbillcolums.unshift(new Ext.grid.RowNumberer());
this.gridList.reconfigure(this.storeBodyList, this.girdbillcolums);
this.storeBodySum = Ext.create('Ext.data.Store', {
model: 'Chfee_do_sum',
remoteSort: true,
proxy: {
type: 'ajax',
url: '/Account/Chfee_settlement/GetBillSum',
reader: {
root: 'data',
totalProperty: 'totalCount'
}
}
});
this.gridSum = new Ext.grid.GridPanel({
store: this.storeBodySum,
enableHdMenu: false,
region: 'center',
loadMask: { msg: "数据加载中,请稍等..." },
trackMouseOver: true,
disableSelection: false,
tbar: [{
xtype: 'label',
width: 120,
height: 22,
text: '结算金额合计'
}],
columns: [{
sortable: true,
dataIndex: 'FEETYPEREF',
header: '收付',
width: 40
}, {
sortable: true,
dataIndex: 'CURRENCY',
header: '币 别',
width: 80
}, {
sortable: true,
dataIndex: 'AMOUNT',
header: '金额',
width: 80,
renderer: function (value, cellmeta, record, rowIndex, columnIndex, store) {
try {
var lsValue = usMoney(value, 2, '', false);
if (lsValue != "NaN") {
value = lsValue; if (parseFloat(lsValue) < 0) {
return '<SPAN style="COLOR: red">' + lsValue + '</SPAN>';
}
}
else {
return value;
}
}
catch (e) {
return value;
}
return value;
}
}
]
});
this.storeBodyAddList = Ext.create('Ext.data.Store', {
pageSize: this.PageSize,
model: 'MsAddBillCustFee',
remoteSort: true,
proxy: {
type: 'ajax',
timeout: 120000,
url: '/Account/Chfee_hexiao/GetBillDataList',
reader: {
id: 'BSNO',
root: 'data',
totalProperty: 'totalCount'
}
}
});
//明细表表格
this.Pagenum = Ext.create('Ext.form.field.Number', {
name: 'bottles',
fieldLabel: '每页记录数',
labelAlign: 'right',
value: this.PageSize,
maxValue: 100000,
width: 180,
minValue: 0,
listeners: {
specialkey: function (field, e) {
if (e.getKey() == e.ENTER) {
_this.onRefreshClick();
}
}
}
});
this.initgirdbilladdcolums = [{
sortable: true,
dataIndex: 'BSNO',
header: 'BSNO',
hidden: true,
width: 100
}, {
sortable: true,
dataIndex: 'CUSTNO',
header: '委托编号',
width: 108
}, {
sortable: true,
dataIndex: 'MBLNO',
header: '主提单号',
width: 108
}, {
sortable: true,
dataIndex: 'CUSTOMERNAME',
header: '委托单位',
width: 100
}, {
sortable: true,
dataIndex: 'FEEOBJNAME',
header: '结费单位',
width: 90
}, {
sortable: true,
dataIndex: 'RMBDrBalAmount',
header: 'RMB未收',
width: 100
}, {
sortable: true,
dataIndex: 'USDDrBalAmount',
header: 'USD未收',
width: 100
}, {
sortable: true,
dataIndex: 'OTDrBalAmount',
header: '其他未收',
width: 100
}, {
sortable: true,
dataIndex: 'BALRMBINVDR',
header: 'RMB收未开票',
width: 70
}, {
sortable: true,
dataIndex: 'BALUSDINVDR',
header: 'USD收未开票',
width: 70
}, {
sortable: true,
dataIndex: 'RMBCrBalAmount',
header: 'RMB未付',
width: 100
}, {
sortable: true,
dataIndex: 'USDCrBalAmount',
header: 'USD未付',
width: 100
}, {
sortable: true,
dataIndex: 'OTCrBalAmount',
header: '其他未付',
width: 100
}, {
sortable: true,
dataIndex: 'OPLBNAME',
header: '业务类别',
width: 80
}, {
sortable: true,
dataIndex: 'ETD',
header: '开船日期',
renderer: Ext.util.Format.dateRenderer('Y-m-d'),
width: 100
}, {
sortable: true,
dataIndex: 'CUSTOMNO',
header: '报关单号',
width: 80
}, {
sortable: true,
dataIndex: 'ENTERP',
header: '经营单位',
width: 100
}, {
sortable: true,
dataIndex: 'SALE',
header: '揽货人',
width: 80
}, {
sortable: true,
dataIndex: 'ACCDATE',
header: '会计期间',
width: 80
}, {
sortable: true,
dataIndex: 'OP',
header: '操作',
width: 80
}, {
sortable: true,
dataIndex: 'INPUTBY',
header: '录入人',
width: 80
}, {
sortable: true,
dataIndex: 'PORTLOAD',
header: '起运港',
width: 120
}, {
sortable: true,
dataIndex: 'PORTDISCHARGE',
header: '目的港',
width: 120
}, {
sortable: true,
dataIndex: 'VESSEL',
header: '船名',
width: 150
}, {
sortable: true,
dataIndex: 'VOYNO',
header: '航次',
width: 60
}, {
sortable: true,
dataIndex: 'OPTYPE',
header: '更改单',
width: 80
}, {
sortable: true,
dataIndex: 'REMARK',
header: '备注',
width: 80
}
];
this.girdbilladdcolums = this.initgirdbilladdcolums; //使用者id表名中间column数组跳过一开始的几列
this.AddGridCheckBoxModel = Ext.create('Ext.selection.CheckboxModel');
this.gridAddList = new Ext.grid.GridPanel({
store: this.storeBodyAddList,
enableHdMenu: false,
region: 'center',
loadMask: { msg: "数据加载中,请稍等..." },
trackMouseOver: true,
disableSelection: false,
viewConfig: {
enableTextSelection: true
},
selModel: this.AddGridCheckBoxModel,
tbar: [{
text: '添加结算明细',
tooltip: '添加结算明细',
id: 'btnaddbill',
iconCls: "btnadddetail",
handler: function (button, event) {
this.onAddClick(button, event);
},
scope: this
}, '-', {
text: "保存列表样式",
id: "btntest",
menu: [
{ text: "保存",
handler: function (button, event) {
_this.girdbilladdcolums = DsTruck.SaveGridPanel(USERID, _this.formname + 'billadd', _this.gridAddList.columns, _this.girdbilladdcolums, 1, true);
}
}, { text: "初始化",
handler: function (menu, event) {
_this.girdbilladdcolums = DsTruck.SaveGridPanel(USERID, _this.formname + 'billadd', _this.gridAddList.columns, _this.initgirdbilladdcolums, 1, true);
}
}],
scope: this
}],
columns: this.girdbilladdcolums,
// paging bar on the bottom
bbar: [Ext.create('Ext.PagingToolbar', {
store: this.storeBodyAddList,
displayInfo: true,
displayMsg: '当前显示 {0} - {1}条记录 /共 {2}条记录',
emptyMsg: "没有数据"
}), this.Pagenum]
});
this.gridAddList.addListener('itemdblclick', function (dataview, record, item, index, e, b) {
this.SelectedRecord = record;
var openSet = "height=700, width=1024, toolbar=no, menubar=no,scrollbars=1, resizable=1,location=no, status=no,Top= " + (screen.height - 750) / 2 + ",Left= " + (screen.width - 1100) / 2
var openType = "_blank";
var openUrl = "";
openUrl = "../../MvcShipping/MsOpBill/MsOpFeeView?handle=check&bsno=" + record.data.BSNO;
window.open(openUrl, openType, openSet);
// DsOpenEditWin("/TruckMng/MsWlPc/Edit");
}, this);
this.girdbilladdcolums = DsTruck.GetGridPanel(USERID, this.formname + 'billadd', this.girdbilladdcolums, 1); //使用者id表名中间column数组跳过一开始的几列
this.girdbilladdcolums.unshift(new Ext.grid.RowNumberer());
this.gridAddList.reconfigure(this.storeBodyAddList, this.girdbilladdcolums);
this.gridAddList.addListener('sortchange', function (ct, column, direction, eOpts) {
this.addsortfield = column.dataIndex;
this.addsortdire = direction;
}, this);
_this = this;
this.CurrGroup = new Ext.form.RadioGroup({
id: 'CurrGroup',
xtype: 'radiogroup',
fieldLabel: '折算币别',
columns: 2,
items: [
{ boxLabel: 'RMB', name: 'Curr', inputValue: 'RMB', checked: true },
{ boxLabel: 'USD', name: 'Curr', inputValue: 'USD' }
]
});
this.storeAddFeeList = Ext.create('Ext.data.Store', {
pageSize: this.PageSize,
model: 'Chfee_add_detail',
remoteSort: true,
proxy: {
type: 'ajax',
timeout: 120000,
url: '/Account/Chfee_hexiao/GetFeeDetailList',
reader: {
id: 'BSNO',
root: 'data',
totalProperty: 'totalCount'
}
}
});
this.AddFeeGridCheckBoxModel = Ext.create('Ext.selection.CheckboxModel');
this.cellEditingFee = Ext.create('Ext.grid.plugin.CellEditing', {
clicksToEdit: 1,
listeners: {
'edit': function (editor, e) {
}
}
});
this.initgirdfeecolums = [{
sortable: true,
dataIndex: 'CH_ID',
header: 'CH_ID',
hidden: true,
width: 100
}, {
sortable: true,
dataIndex: 'BSNO',
header: 'BSNO',
hidden: true,
width: 100
}, {
sortable: true,
dataIndex: 'CustomerName',
header: '客户名称',
width: 90
}, {
sortable: true,
dataIndex: 'FeeType_Ref',
header: '收付',
width: 40
}, {
sortable: true,
dataIndex: 'FeeName',
header: '费用名称',
width: 90
}, {
sortable: true,
dataIndex: 'Amount',
header: '金额',
width: 70,
renderer: function (value, cellmeta, record, rowIndex, columnIndex, store) {
try {
var lsValue = usMoney(value, 2, '', false);
if (lsValue != "NaN") {
value = lsValue; if (parseFloat(lsValue) < 0) {
return '<SPAN style="COLOR: red">' + lsValue + '</SPAN>';
}
}
else {
return value;
}
}
catch (e) {
return value;
}
return value;
}
}, {
sortable: true,
dataIndex: 'Currency',
header: '币别',
width: 40
}, {
sortable: true,
dataIndex: 'BalAmount',
header: '未结金额',
width: 70,
renderer: function (value, cellmeta, record, rowIndex, columnIndex, store) {
try {
var lsValue = usMoney(value, 2, '', false);
if (lsValue != "NaN") {
value = lsValue; if (parseFloat(lsValue) < 0) {
return '<SPAN style="COLOR: red">' + lsValue + '</SPAN>';
}
}
else {
return value;
}
}
catch (e) {
return value;
}
return value;
}
}, {
sortable: true,
dataIndex: 'StlAmount',
header: '本次结算金额',
editor: {
xtype: 'numberfield',
keyNavEnabled: false,
allowDecimals: true,
decimalPrecision: 2,
selectOnFocus: true,
mouseWheelEnabled: false,
enableKeyEvents: true,
listeners: {
keydown: function (textfield, e) {
if (e.getKey() == 40) {
_this.onNextKeyClick(9)
} else if (e.getKey() == 38) {
_this.onUpKeyClick(9)
}
}
}
},
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;
},
width: 70
}, {
sortable: true,
dataIndex: 'ExChangerate',
header: '原始汇率',
width: 60
}, {
sortable: true,
dataIndex: 'Invoice',
header: '开票金额',
width: 60,
renderer: function (value, cellmeta, record, rowIndex, columnIndex, store) {
try {
var lsValue = usMoney(value, 2, '', false);
if (lsValue != "NaN") {
value = lsValue; if (parseFloat(lsValue) < 0) {
return '<SPAN style="COLOR: red">' + lsValue + '</SPAN>';
}
}
else {
return value;
}
}
catch (e) {
return value;
}
return value;
}
}, {
sortable: true,
dataIndex: 'Remark',
header: '备注',
width: 180
}, {
sortable: true,
dataIndex: 'INPUTMODE',
header: '录入方式',
width: 60
}
];
this.girdfeecolums = this.initgirdfeecolums;
this.gridAddFeeList = new Ext.grid.GridPanel({
store: this.storeAddFeeList,
enableHdMenu: false,
region: 'center',
loadMask: { msg: "数据加载中,请稍等..." },
trackMouseOver: true,
disableSelection: false,
plugins: [this.cellEditingFee],
viewConfig: {
enableTextSelection: true
},
selModel: this.AddFeeGridCheckBoxModel,
tbar: [{
text: '添加结算费用明细',
tooltip: '添加结算费用明细',
iconCls: "btnadddetail",
id: "btnadddetail",
handler: function (button, event) {
this.onAddDetailClick(button, event);
},
scope: this
}, '-', {
text: "保存列表样式",
id: "btntestfee",
menu: [
{ text: "保存",
handler: function (button, event) {
_this.girdfeecolums = DsTruck.SaveGridPanel(USERID, _this.formname + 'feeadd', _this.gridAddFeeList.columns, _this.girdfeecolums, 1, true);
}
}, { text: "初始化",
handler: function (menu, event) {
_this.girdfeecolums = DsTruck.SaveGridPanel(USERID, _this.formname + 'feeadd', _this.gridAddFeeList.columns, _this.initgirdfeecolums, 1, true);
}
}],
scope: this
}, { xtype: "label", id: "zongshu", text: "",
handler: function () { ; }
}
],
columns: this.girdfeecolums,
// paging bar on the bottom
bbar: Ext.create('Ext.PagingToolbar', {
store: this.storeAddFeeList,
displayInfo: true,
displayMsg: '当前显示 {0} - {1}条记录 /共 {2}条记录',
emptyMsg: "没有数据"
})
});
this.girdfeecolums = DsTruck.GetGridPanel(USERID, this.formname + 'feeadd', this.girdfeecolums, 1); //使用者id表名中间column数组跳过一开始的几列
this.gridAddFeeList.reconfigure(this.storeAddFeeList, this.girdfeecolums);
this.gridAddFeeList.on('edit', function (editor, e, eOpts) {
this.gridAddFeeListAfterEdit(editor, e, eOpts);
}, this);
this.storeSelectSum = Ext.create('Ext.data.Store', {
model: 'Chfee_do_selectsum'
});
this.gridSelectSum = new Ext.grid.GridPanel({
store: this.storeSelectSum,
enableHdMenu: false,
// anchor: '100% 50%',
region: 'south',
height: 80,
loadMask: { msg: "数据加载中,请稍等..." },
trackMouseOver: true,
disableSelection: false,
tbar: [{
xtype: 'label',
width: 220,
id: 'SelectGrid',
height: 22,
text: '所选费用合计'
}],
columns: [{
sortable: true,
dataIndex: 'RMBDRAMOUNT',
header: 'RMB未收',
width: 80
}, {
sortable: true,
dataIndex: 'RMBCRAMOUNT',
header: 'RMB未付',
width: 80
}, {
sortable: true,
dataIndex: 'USDDRAMOUNT',
header: 'USD未收',
width: 80
}, {
sortable: true,
dataIndex: 'USDCRAMOUNT',
header: 'USD未付',
width: 80
}, {
sortable: true,
dataIndex: 'OTDRAMOUNT',
header: '其他未收',
width: 80
}, {
sortable: true,
dataIndex: 'OTCRAMOUNT',
header: '其他未付',
width: 80
}
]
});
_this = this;
this.storeCustCodefee = Ext.create('DsExt.ux.RefTableStore', {
model: 'DsShipping.ux.CustomRefModel',
proxy: { url: '/CommMng/BasicDataRef/GetCustomRefListRm' }
});
// this.storeCustCodefee.load({ params: { condition: ""} });
this.comboxAddCustCode = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: '费用对象',
store: this.storeCustCodefee,
forceSelection: true,
queryMode: 'remote',
minChars: 1,
queryParam: 'CODENAME',
name: 'CUSTNAME',
valueField: 'CustName',
displayField: 'CodeAndName',
enableKeyEvents: true,
listeners: {
keyup: function (field, e) {
if (e.getKey() == e.ENTER) {
_this.onRefreshClick();
}
}
}
});
this.StoreOpLb = Ext.create('DsExt.ux.RefEnumStore', {});
this.StoreOpLb.load({ params: { enumTypeId: 96005} });
this.comboxOpLb = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: '业务类型',
store: this.StoreOpLb,
name: 'OPLBNAME',
valueField: 'EnumValueName',
displayField: 'EnumValueName',
enableKeyEvents: true,
listeners: {
keyup: function (field, e) {
if (e.getKey() == e.ENTER) {
_this.onRefreshClick();
}
}
}
});
this.storeAddDCType = Ext.create('Ext.data.Store', {
fields: ['DC', 'NAME']
});
this.storeAddDCType.add({ "DC": "", "NAME": "全部" });
this.storeAddDCType.add({ "DC": "1", "NAME": "应收" });
this.storeAddDCType.add({ "DC": "2", "NAME": "应付" });
this.comboxaddDCType = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: '收/付',
store: this.storeAddDCType,
valueField: 'DC',
displayField: 'NAME',
forceSelection: true,
name: 'DC',
value: '',
flex: 0.6,
enableKeyEvents: true,
listeners: {
keyup: function (field, e) {
if (e.getKey() == e.ENTER) {
_this.onRefreshClick();
}
}
}
});
this.comboxCurr2 = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: '币别',
store: this.StoreCurr,
forceSelection: true,
labelWidth: 40,
name: 'Currency',
valueField: 'CURR',
displayField: 'CURR',
flex: 0.4,
enableKeyEvents: true,
listeners: {
keyup: function (field, e) {
if (e.getKey() == e.ENTER) {
_this.onRefreshClick();
}
}
}
});
this.storeFeeNameRef = Ext.create('DsExt.ux.RefTableStore', {
model: 'DsShipping.ux.FeeTypeRefModel',
proxy: { url: '/MvcShipping/MsChFee/GetFeeTypeRefList' }
});
this.comboxFeeNameRef = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: '费用名称',
store: this.storeFeeNameRef,
forceSelection: true,
name: 'FeeName',
valueField: 'Name',
displayField: 'CodeAndName',
enableKeyEvents: true,
listeners: {
keyup: function (field, e) {
if (e.getKey() == e.ENTER) {
_this.onRefreshClick();
}
}
}
});
this.storeFeeNameRef.load({ params: { condition: ""} });
this.storeCurrExrate = Ext.create('Ext.data.Store', {
fields: ['CURR', 'EXRATE']
});
this.storeVoyVeg = Ext.create('DsExt.ux.RefTableStore', {
model: 'DsShipping.ux.VesselModel',
proxy: { url: '/CommMng/BasicDataRef/GetVesselList' }
});
this.storeVoyVeg.load({ params: { condition: ""} });
this.comboxVoyVeg = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: '船 名',
store: this.storeVoyVeg,
name: 'VESSEL',
valueField: 'VESSEL',
flex: 1,
displayField: 'VESSEL',
enableKeyEvents: true,
listeners: {
keyup: function (field, e) {
if (e.getKey() == e.ENTER) {
_this.onRefreshClick();
}
}
}
});
this.formSearch = Ext.widget('form', {
frame: true,
region: 'north',
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: [this.comboxAddCustCode, this.comboxOpLb, {
fieldLabel: '编号检索',
name: 'CustomNo',
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();
}
}
}
}, this.comboxFeeNameRef, {
xtype: 'button',
width: 90,
text: "执行查询",
iconCls: "btnrefresh",
handler: function (button, event) {
this.onRefreshClick(button, event);
},
scope: this
}
]
}, {
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [this.comboxaddDCType, this.comboxCurr2, {
fieldLabel: '对账编号',
name: 'DuiNo',
enableKeyEvents: true,
listeners: {
specialkey: function (field, e) {
if (e.getKey() == e.ENTER) {
_this.onRefreshClick();
}
}
}
}, {
fieldLabel: '会计期间',
xtype: 'monthfield',
name: 'ACCDATEFR',
enableKeyEvents: true,
listeners: {
specialkey: function (field, e) {
if (e.getKey() == e.ENTER) {
_this.onRefreshClick();
}
}
}
}, {
fieldLabel: '会计期间',
xtype: 'monthfield',
name: 'ACCDATETO',
enableKeyEvents: true,
listeners: {
specialkey: function (field, e) {
if (e.getKey() == e.ENTER) {
_this.onRefreshClick();
}
}
}
}, this.comboxVoyVeg, {
fieldLabel: '航次',
name: 'VOYNO',
enableKeyEvents: true,
listeners: {
specialkey: function (field, e) {
if (e.getKey() == e.ENTER) {
_this.onRefreshClick();
}
}
}
}, {
xtype: 'button',
width: 90,
text: "高级查询",
iconCls: "btnmore",
handler: function (button, event) {
var sql = this.getCondition();
var winAccess = new Shipping.DsQuery({
});
winAccess.StoreList = this.storeList;
winAccess.formname = this.formname;
winAccess.condition = sql;
winAccess.show();
return;
},
scope: this
}
]
}, {
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [{
fieldLabel: '申请编号',
name: 'ShenNo',
enableKeyEvents: true,
listeners: {
specialkey: function (field, e) {
if (e.getKey() == e.ENTER) {
_this.onRefreshClick();
}
}
}
}, {
fieldLabel: '发票号',
name: 'InvNo',
enableKeyEvents: true,
listeners: {
specialkey: function (field, e) {
if (e.getKey() == e.ENTER) {
_this.onRefreshClick();
}
}
}
}, { xtype: 'hiddenfield'
}, { xtype: 'hiddenfield'
}, { xtype: 'hiddenfield'
}, { xtype: 'hiddenfield'
}, {
xtype: 'button',
width: 90,
text: "重置",
iconCls: "btnreset",
handler: function (button, event) {
this.onClearSql(button, event);
},
scope: this
}
]
}
]//end items(fieldset 1)
}//end fieldset 1
]//end root items
});
this.panelService = new Ext.Panel({
layout: "border",
region: 'center',
margin: '2 2',
items: [this.gridList]
});
this.panelSum = new Ext.Panel({
layout: "border",
region: 'east',
width: 260,
split: true,
margin: '2 2',
items: [this.gridSum]
});
this.panelAddSum = new Ext.Panel({
layout: "anchor",
region: 'east',
width: 260,
split: true,
margin: '2 2',
items: [this.gridAddSum, this.gridSelectSum]
});
this.paneldetail = new Ext.Panel({
// title: '结算明细',
layout: "border",
height: 180,
region: "north",
split: true,
items: [
this.panelService, this.panelSum
]
});
this.panelAddService = new Ext.Panel({
layout: "border",
region: 'center',
margin: '2 2',
items: [this.gridAddList]
});
this.panelAddfee = new Ext.Panel({
layout: "border",
region: 'east',
width: 550,
split: true,
margin: '2 2',
items: [this.gridAddFeeList, this.gridSelectSum]
});
this.paneladddetail = new Ext.Panel({
layout: "border",
region: 'center',
items: [this.panelAddService, this.panelAddfee
]
});
this.paneladd = new Ext.Panel({
title: '添加结算明细',
layout: "border",
// region: 'south',
region: "center",
// height: 420,
items: [
this.formSearch, this.paneladddetail
]
});
//#endregion 明细表
//#region 布局
//控件布局
this.panelTop = new Ext.Panel({
layout: "border",
region: "north",
height: 158,
split: true,
items: [this.panelBtn, this.formEdit, this.stlgridList]
});
this.panelBody = new Ext.Panel({
// title: "结算明细",
layout: "border",
region: "center",
items: [this.paneldetail, this.paneladd]
});
// this.tabpanel = new Ext.TabPanel
// ({
// activeTab: 0,
// autoWidth: true,
// border: false,
// frame: false,
// region: 'center',
// id: "TabPanelID",
// enableTabScroll: true,
// items:
// [
// this.panelBody
// ]
// });
Ext.apply(this, {
items: [this.panelTop, this.panelBody]
});
//#endregion
//绑定查询窗体
this.ParentWin = window.parent.opener;
//初始化数据
this.InitData();
//绑定事件
var billno = '*';
if (this.opStatus == 'edit') {
billno = this.editRecord.get('BILLNO');
};
this.storeBodyList.on('beforeload', function (store) {
billno = this.editRecord.get('BILLNO');
var sql = " BILLNO in (select BILLNO FROM ch_fee_settlement WHERE HXBILLNO='" + billno + "')";
Ext.apply(store.proxy.extraParams, { condition: sql });
}, this);
this.storeBodyList.on('load', function (store, records) {
if (store.getCount() > 0) {
//this.gridList.getSelectionModel().select(0);
}
}, this);
this.storeBodyAddList.on('beforeload', function (store) {
// var sql = this.getCondition();
var ShenNo = this.formSearch.getForm().findField('ShenNo').getValue();
// var ShenNo = "";
Ext.apply(store.proxy.extraParams, { condition: this.sqlcontext, billtype: 1, ShenNo: ShenNo });
}, this);
this.storeAddFeeList.on('beforeload', function (store) {
var sql = '';
if (this.selectfeesql == '')
sql = '1=2 ';
else
sql = this.selectfeesql;
var ShenNo = this.formSearch.getForm().findField('ShenNo').getValue();
// var ShenNo = "";
Ext.apply(store.proxy.extraParams, { condition: sql, ShenNo: ShenNo });
}, this);
this.storeBodyAddList.on('load', function (store, records) {
if (store.getCount() > 0) {
// this.gridAddList.getSelectionModel().select(0);
var btnEAddbill = Ext.getCmp('btnaddbill');
if (this.canedit)
btnEAddbill.enable();
} else {
this.storeAddFeeList.removeAll();
}
}, this);
this.storeAddFeeList.on('load', function (store, records) {
if (store.getCount() > 0) {
var btnEAddDetail = Ext.getCmp('btnadddetail');
if (this.canedit)
btnEAddDetail.enable();
} else {
}
}, this);
var isloadfee = true;
this.gridAddList.getSelectionModel().on('select', function (model, record, index) {
if (!isloadfee) return;
var bsno = record.data.BSNO;
var feeobjname = record.data.FEEOBJNAME;
var sql = "";
sql = " f.BSNO='" + bsno + "' AND f.CUSTOMERNAME='" + feeobjname + "'";
sql = sql + getAndConSql(sql, this.FeeSqlStr, this.FeeSqlStr);
this.selectfeesql = sql;
isloadfee = false;
var ShenNo = this.formSearch.getForm().findField('ShenNo').getValue();
// var ShenNo = "";
this.storeAddFeeList.load({ params: { condition: sql, billtype: 1, ShenNo: ShenNo },
callback: function (r, options, success) {
if (success) {
isloadfee = true;
}
}
});
}, this);
this.storeAddFeeList.on('beforeload', function (store) {
var sql = this.getCondition();
Ext.apply(store.proxy.extraParams, { condition: this.BillSql, billtype: 2 });
}, this);
_this = this;
this.gridAddList.on({
selectionchange: function (sm, selections) {
var SelectGridtext = Ext.getCmp('SelectGrid');
_this.storeSelectSum.removeAll();
SelectGridtext.setText('所选费用合计');
if (selections.length == 0) {
return;
}
_this.storeSelectSum.add({ "RMBDRAMOUNT": 0, "RMBCRAMOUNT": 0, "USDDRAMOUNT": 0, "USDCRAMOUNT": 0, "OTDRAMOUNT": 0, "OTCRAMOUNT": 0 });
var R = selections.length;
for (var i = 0; i < selections.length; i++) {
var rec = selections[i];
var memberyf = _this.storeSelectSum.getAt(0);
var amount = memberyf.data.RMBDRAMOUNT;
var cramount = memberyf.data.RMBCRAMOUNT;
amount = (parseFloat(amount).add(parseFloat(rec.data.RMBDrBalAmount))).toFixed(2);
cramount = (parseFloat(cramount).add(parseFloat(rec.data.RMBCrBalAmount))).toFixed(2);
var usdamount = memberyf.data.USDDRAMOUNT;
var usdcramount = memberyf.data.USDCRAMOUNT;
usdamount = (parseFloat(usdamount).add(parseFloat(rec.data.USDDrBalAmount))).toFixed(2);
usdcramount = (parseFloat(usdcramount).add(parseFloat(rec.data.USDCrBalAmount))).toFixed(2);
var otamount = memberyf.data.OTDRAMOUNT;
var otcramount = memberyf.data.OTCRAMOUNT;
otamount = (parseFloat(otamount).add(parseFloat(rec.data.OTDrBalAmount))).toFixed(2);
otcramount = (parseFloat(otcramount).add(parseFloat(rec.data.OTCrBalAmount))).toFixed(2);
memberyf.set("RMBDRAMOUNT", amount);
memberyf.set("RMBCRAMOUNT", cramount);
memberyf.set("USDDRAMOUNT", usdamount);
memberyf.set("USDCRAMOUNT", usdcramount);
memberyf.set("OTDRAMOUNT", otamount);
memberyf.set("OTCRAMOUNT", otcramount);
memberyf.commit();
}
SelectGridtext.setText('所选费用合计(选中' + R + '票业务)');
}
});
this.gridAddFeeList.getSelectionModel().on('select', function (button, event) {
this.onSelectFee(button, event);
}, this);
// this.onInitRefreshClick();
}, //end initUIComponents
InitData: function () {
this.opStatus = 'add';
var condition = '';
if (this.ParentWin) {
var ret = this.ParentWin.OprationSwap();
this.opStatus = ret[0];
this.StoreList = ret[1];
this.editRecord = ret[2];
if (this.ParentWin.panelIndex.MsPeriod != NaN && this.ParentWin.panelIndex.MsPeriod != null)
this.MsPeriod = this.ParentWin.panelIndex.MsPeriod;
}
if (this.opStatus == 'edit')
condition = " cm.BILLNO='" + this.editRecord.get('BILLNO') + "'";
this.LoadData(this.opStatus, condition);
}, //end InitData
LoadData: function (opstatus, condition) {
this.serialNo = 0;
this.workSerialNo = 0;
this.bodyDel = [];
this.opStatus = opstatus;
_this = this;
Ext.Ajax.request({
waitMsg: '正在查询主表数据...',
url: '/Account/Chfee_hexiao/GetData',
params: {
handle: opstatus,
condition: condition
},
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;
}
var data = result.data;
_this.formEdit.getForm().findField('BILLSTATUS').setDisabled(false);
_this.formEdit.getForm().reset();
_this.formEdit.getForm().setValues(data);
_this.formEdit.getForm().findField('BILLSTATUS').setDisabled(true);
_this.GetEditStatus();
// _this.LoadPeriod(this.opStatus);
} else {
Ext.MessageBox.alert('请求出现错误,请重试', response.responseText);
}
},
scope: this
});
var billno = '*';
if (this.opStatus == 'edit') {
billno = this.editRecord.get('BILLNO');
};
// billno = this.formEdit.getForm().findField('DUINO').getValue();
this.storeBodyList.load({ params: { start: 0, limit: this.BodyPageSize, condition: " BILLNO in (select BILLNO FROM ch_fee_settlement WHERE HXBILLNO='" + billno + "')" },
callback: function (r, options, success) {
if (success) {
if (this.storeBodyList.getCount() > 0) {
this.comboxCustCode.setReadOnly(true);
}
else {
this.comboxCustCode.setReadOnly(false);
}
}
},
scope: this
});
this.storeBodySum.load({ params: { condition: " BILLNO in (select BILLNO FROM ch_fee_settlement WHERE HXBILLNO='" + billno + "')"} });
this.storeStlList.load({ params: { start: 0, limit: this.StlPageSize,condition: " HXBILLNO='" + billno + "'"} });
// this.storeFeeList.load({ params: { condition: " DUINO='" + billno + "'"} });
}, // end LoadDate
// LoadPeriod: function (opstatus) {
// Ext.Ajax.request({
// waitMsg: '正在查询主表数据...',
// url: '/Account/ChMonthClose/GetNowPeriod',
// params: {
// condition: ''
// },
// callback: function (options, success, response) {
// if (success) {
// var result = Ext.JSON.decode(response.responseText);
// if (!result.Success) {
// return;
// }
// data = result.data;
// this.MsPeriod = data;
// this.LoadPeriodStatus(opstatus);
// } else {
// Ext.MessageBox.alert('请求出现错误,请重试', response.responseText);
// }
// },
// scope: this
// });
// },
// LoadPeriodStatus: function (opstatus) {
// var SETTLETIME = this.formEdit.getForm().findField('SETTLETIME').getRawValue();
// if (SETTLETIME == '') {
// this.formEdit.getForm().findField('SETTLETIME').setMinValue(this.MsPeriod.FDAY);
// this.formEdit.getForm().findField('SETTLETIME').setReadOnly(false);
// } else {
// var oDate1 = new Date(SETTLETIME);
// var oDate2 = new Date(this.MsPeriod.FDAY);
// if (oDate1.getTime() >= oDate2.getTime()) {
// this.formEdit.getForm().findField('SETTLETIME').setMinValue(this.MsPeriod.FDAY);
// this.formEdit.getForm().findField('SETTLETIME').setReadOnly(false);
// } else {
// if (opstatus == 'add' || opstatus == 'copyadd') {
// this.formEdit.getForm().findField('SETTLETIME').setMinValue(this.MsPeriod.FDAY);
// this.formEdit.getForm().findField('SETTLETIME').setReadOnly(false);
// }
// else {
// this.formEdit.getForm().findField('SETTLETIME').setMinValue('');
// this.formEdit.getForm().findField('SETTLETIME').setReadOnly(true);
// this.setSaveBtnStatus(false);
// }
// }
// }
// },
Save: function (type) {
var basicForm = this.formEdit.getForm();
if (!basicForm.isValid()) {
return;
}
this.formEdit.getForm().findField('BILLSTATUS').setDisabled(false);
this.formEdit.getForm().findField('COMPANYID').setDisabled(false);
var data = basicForm.getValues();
this.formEdit.getForm().findField('BILLSTATUS').setDisabled(true);
this.formEdit.getForm().findField('COMPANYID').setDisabled(true);
var bodydatas = [];
var isnobank = 0;
for (var i = 0; i < this.storeStlList.getCount(); i += 1) {
var member = this.storeStlList.getAt(i);
var WEIGHDATE = member.data.SETTLETIME;
if (WEIGHDATE != '')
WEIGHDATE = Ext.util.Format.date(WEIGHDATE, 'Y-m-d');
member.data.SETTLETIME = WEIGHDATE;
bodydatas.push(member);
if (member.data.ACCOUNT == '') isnobank = 1;
if (member.data.BILLTYPE != 1 && member.data.BILLTYPE != 2) {
Ext.Msg.show({ title: '提示', msg: '收付类型不正确,不能保存!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
return;
}
}
if (isnobank == 1 && type != 3 && type != 4 && type != 5) {
Ext.Msg.show({ title: '提示', msg: '银行账户不能为空,不能保存!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
return;
}
var jsonBody = ConvertRecordsToJsonAll(bodydatas);
this.storeSelectList.removeAll();
var selections = this.stlgridList.getSelectionModel().getSelection();
if (selections.length != 0) {
for (var i = 0; i < selections.length; i++) {
var rec = selections[i];
this.storeSelectList.add(rec);
}
} else {
for (i = 0; i < this.storeStlList.getCount(); i += 1) {
var memberyf = this.storeStlList.getAt(i);
if (memberyf.data.BILLNO == "")
this.storeSelectList.add(memberyf);
}
}
Ext.Msg.wait('正在保存数据, 请稍侯..');
Ext.Ajax.request({
waitMsg: '正在保存数据...',
url: '/Account/Chfee_hexiao/Save',
scope: this,
params: {
opstatus: this.opStatus,
data: Ext.JSON.encode(data),
body: jsonBody
},
callback: function (options, success, response) {
if (success) {
Ext.MessageBox.hide();
var jsonresult = Ext.JSON.decode(response.responseText);
if (jsonresult.Success) {
var returnData = jsonresult.Data;
this.formEdit.getForm().setValues(returnData);
if (this.opStatus == 'add') {
var arrNewRecords = this.StoreList.insert(0, returnData);
this.editRecord = this.StoreList.getAt(0);
}
else if (this.opStatus == 'edit') {
var editp = Ext.create('MsChHexiao', returnData);
this.editRecord.fields.each(function (field) {
if (field.persist) {
name = field.name;
if (name != 'id')
this.editRecord.set(name, editp.get(name));
}
}, this);
this.editRecord.commit();
}
this.opStatus = 'edit';
if (type == '1') {
window.close();
} else if (type == '3' || type == '4' || type == '0' || type == '5') {
this.storeStlList.load({
params: { start: 0, limit: this.StlPageSize,condition: " HXBILLNO='" + returnData.BILLNO + "'" },
callback: function (r, options, success) {
if (success) {
if (type == '3') {
_this.addDetailfn();
} else if (type == '4') {
_this.addBillfn();
} else if (type == '5') {
_this.onAddStl();
}
}
},
scope: this
});
} else {
this.LoadData('add', '');
}
} else {
if (type == '3') {
var btnEAddDetail = Ext.getCmp('btnadddetail');
btnEAddDetail.enable();
} else if (type == '4') {
var btnEAddbill = Ext.getCmp('btnaddbill');
btnEAddbill.enable();
}
Ext.Msg.show({ title: '错误', msg: jsonresult.Message, icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK });
}
} else {
if (type == '3') {
var btnEAddDetail = Ext.getCmp('btnadddetail');
btnEAddDetail.enable();
} else if (type == '4') {
var btnEAddbill = Ext.getCmp('btnaddbill');
btnEAddbill.enable();
}
Ext.Msg.show({ title: '请重试',
msg: '服务器响应出错',
icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK
});
}
}
});
}, //end save
//#region 结算列表
onAddStlClick: function () {
var Duino = this.formEdit.getForm().findField('BILLNO').getValue();
var basicForm = this.formEdit.getForm();
_this = this;
if ((Duino == '*') || basicForm.isDirty()) {
this.Save('5');
} else {
this.onAddStl();
}
},
onAddStl: function () {
var Duino = this.formEdit.getForm().findField('BILLNO').getValue();
var basicForm = this.formEdit.getForm();
_this = this;
var newSerialno = 0;
var CUSTOMERNAME = this.formEdit.getForm().findField('CUSTOMERNAME').getValue();
store = this.storeStlList;
var myDate = new Date();
var mydatestr = Ext.util.Format.date(myDate, 'Y-m-d');
var prdata = null;
if (this.storeStlList.getCount() > 0) {
var memberbody = this.storeStlList.getAt(this.storeStlList.getCount() - 1);
prdata = memberbody.data;
}
if (prdata != null) {
var record = Ext.create('MsChSettlement', {
GID: NewGuid(),
SETTLETYPE: prdata.SETTLETYPE,
BILLTYPE: prdata.BILLTYPE,
BILLTYPEREF: prdata.BILLTYPEREF,
SETTLEMODE: prdata.SETTLEMODE,
CUSTOMERNAME: CUSTOMERNAME,
ACCOUNT: prdata.ACCOUNT,
ACCOUNTREF: prdata.ACCOUNTREF,
CURR: prdata.CURR,
SETTLETIME: mydatestr,
AMOUNT: 0,
STLAMOUNT: 0,
DOAMOUNT: 0,
AMOUNTRMB: 0,
AMOUNTUSD: 0,
AMOUNTOT: 0,
RATE: 0,
ACCOUNTS_MONEY: 0,
ACCOUNTS_RATE: 0,
PREPAY_RATE: 0,
PREPAY_MONEY: 0,
AHSR_MONEY: 0,
AHSR_RATE: 0,
FINANCIAL_MONEY: 0,
FINANCIAL_RATE: 0,
ADVANCE_MONEY: 0,
ADVANCE_RATE: 0,
ACCOUNTS_MONEY: 0,
BILLSTATUS: 2
});
var feeid = store.add(record);
} else {
var record = Ext.create('MsChSettlement', {
GID: NewGuid(),
SETTLETYPE: '1',
BILLTYPE: "1",
BILLTYPEREF: "应收",
SETTLEMODE: "0",
CUSTOMERNAME: CUSTOMERNAME,
CURR: "RMB",
SETTLETIME: mydatestr,
AMOUNT: 0,
STLAMOUNT: 0,
DOAMOUNT: 0,
AMOUNTRMB: 0,
AMOUNTUSD: 0,
AMOUNTOT: 0,
RATE: 0,
ACCOUNTS_MONEY: 0,
ACCOUNTS_RATE: 0,
PREPAY_RATE: 0,
PREPAY_MONEY: 0,
AHSR_MONEY: 0,
AHSR_RATE: 0,
FINANCIAL_MONEY: 0,
FINANCIAL_RATE: 0,
ADVANCE_MONEY: 0,
ADVANCE_RATE: 0,
ACCOUNTS_MONEY: 0,
BILLSTATUS: 2
});
var feeid = store.add(record);
}
var rown = store.data.keys.indexOf(feeid);
this.stlgridListCellEditing.startEditByPosition({ row: rown, column: 2 });
this.stlgridList.getSelectionModel().select(record);
},
onDelStlClick: function () {
var selections = this.stlgridList.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_settlement/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.storeStlList.remove(record);
this.storeBodyList.reload();
this.storeBodySum.reload();
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);
},
onMDStlClick: function () {
var selections = this.stlgridList.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;
var amount = record.data.AMOUNT;
if (billstatus == '1') {
Ext.Msg.show({ title: '提示', msg: '当前状态无法拆分此单据!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
return;
}
var Duino = this.formEdit.getForm().findField('BILLNO').getValue();
var formAuditStlShow = Ext.widget('form', {
frame: true,
region: 'center',
bodyPadding: 5,
fieldDefaults: {
margins: '2 2 2 2',
labelAlign: 'right',
flex: 1,
labelWidth: 80,
msgTarget: 'qtip'
},
items: [
{//fieldset 1
xtype: 'container',
defaultType: 'textfield',
layout: 'anchor',
defaults: {
anchor: '100%'
},
items: [{
fieldLabel: '拆分金额',
name: 'STLAMOUNT'
}, { xtype: 'hiddenfield',
flex: 1
}
]//end items(fieldset 1)
}//end fieldset 1
]//end root items
});
var winAuditStlShow = Ext.create('Ext.window.Window', {
title: "拆分费用", //"发送预配舱单",
width: 250,
//height : 120,
//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: [formAuditStlShow],
buttons: [{
text: "确定拆分", //"确定发送",
minWidth: 70,
handler: function () {
var stlamount = formAuditStlShow.getForm().findField('STLAMOUNT').getValue();
if (stlamount < 0) {
Ext.Msg.show({ title: '提示', msg: '拆分金额不能小于0!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
return;
}
if (stlamount >= amount) {
Ext.Msg.show({ title: '提示', msg: '拆分金额不能大于或等于核销金额!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
return;
}
Ext.Msg.wait('正在处理数据...');
Ext.Ajax.request({
waitMsg: '正在处理数据...',
url: '/Account/Chfee_hexiao/MdStl',
params: {
data: Ext.JSON.encode(record.data),
stlamount: stlamount,
billno: Duino
},
callback: function (options, success, response) {
if (success) {
var jsonresult = Ext.JSON.decode(response.responseText);
if (jsonresult.Success) {
_this.storeStlList.load({ params: { start: 0, limit: _this.StlPageSize,condition: " HXBILLNO='" + Duino + "'"} });
_this.storeBodyList.reload();
winAuditStlShow.close();
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
}
}, {
text: "关闭", //"关闭",
minWidth: 70,
handler: function () {
winAuditStlShow.close();
}
}]
});
winAuditStlShow.show();
},
onSubmitStlAuditClick: function () {
var selections = this.stlgridList.getSelectionModel().getSelection();
if (selections.length == 0) {
Ext.Msg.show({ title: '提示', msg: '请先选择单据!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
return;
}
var Duino = this.formEdit.getForm().findField('BILLNO').getValue();
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_settlement/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.storeStlList.load({ params: { start: 0, limit: _this.StlPageSize,condition: " HXBILLNO='" + Duino + "'"} });
}
} else {
Ext.MessageBox.alert('请求出现错误,请重试', response.responseText);
}
},
scope: this
});
}
},
onSubmitStlAuditBackClick: function () {
var selections = this.stlgridList.getSelectionModel().getSelection();
if (selections.length == 0) {
Ext.Msg.show({ title: '提示', msg: '请先选择单据!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
return;
}
var Duino = this.formEdit.getForm().findField('BILLNO').getValue();
var BILLNOStr = '';
var strIsVOUCHERNO = "";
for (var i = 0; i < selections.length; i++) {
var rec = selections[i];
var BILLNO = rec.data.BILLNO;
var isvou = rec.data.ISEXPORT;
var isVOUCHERNO = rec.data.VOUCHERNO;
if (isVOUCHERNO != "") {
strIsVOUCHERNO = "已经生成总账凭证的单据,不允许撤销锁定!";
}
if ((rec.data.BILLSTATUS == '1') && (isvou != true) && (isVOUCHERNO == "")) {
if (BILLNOStr == '')
BILLNOStr = BILLNO;
else {
BILLNOStr = BILLNOStr + ',' + BILLNO;
}
}
}
if (strIsVOUCHERNO != "") {
Ext.Msg.show({ title: '提示', msg: strIsVOUCHERNO, icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
}
_this = this;
if (BILLNOStr == '') {
} else {
Ext.Ajax.request({
waitMsg: '正在添加数据...',
url: '/Account/Chfee_settlement/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.storeStlList.load({ params: { start: 0, limit: _this.StlPageSize,condition: " HXBILLNO='" + Duino + "'"} });
}
} else {
Ext.MessageBox.alert('请求出现错误,请重试', response.responseText);
}
},
scope: this
});
};
},
stlgridAfterEdit: function (editor, e, eOpts) {
//需要自己实现里面的事件
if (e.field == 'ACCOUNT') {
var records = DsStoreQueryBy(this.StoreBANK, 'GID', e.value);
if (records.getCount() > 0) {
var data = records.getAt(0).data;
var BANKACCOUNT = data.BANKACCOUNT;
e.record.set('ACCOUNTREF', BANKACCOUNT);
}
}
if (e.field == 'BILLTYPE') {
var isctn = e.value;
if (isctn == "1")
e.record.set('BILLTYPEREF', "应收");
else if (isctn == "2")
e.record.set('BILLTYPEREF', "应付");
}
if (e.field == 'SETTLETYPE') {
var records = DsStoreQueryBy(this.StoreStlMode, 'STLCODE', e.value);
if (records.getCount() > 0) {
var data = records.getAt(0).data;
var STLNAME = data.STLNAME;
e.record.set('SETTLETYPEREF', STLNAME);
}
}
},
cellEditingStlGridBeforeEdit: function (editor, e) {
var canedit = true;
var BILLSTATUS = e.record.get('BILLSTATUS');
if (BILLSTATUS == '1') {
Ext.Msg.show({ title: "提示", msg: "已锁定,无法修改", icon: Ext.Msg.INFO, buttons: Ext.Msg.OK }); //当前费用已対帐无法修改!
canedit = false;
}
var BILLSTATUS = e.record.get('BILLSTATUS');
if (canedit && (e.field == 'CURR' || e.field == 'BILLTYPE')) {
var AMOUNT = e.record.get('AMOUNT');
if (AMOUNT != 0) {
canedit = false;
}
}
return canedit;
},
//#endregion
onAddDetailClick: function (button, event) {
this.addstore = true;
this.addDetail();
}, //end onAddDetailClick
onDelDetailClick: function (button, event, type) {
this.deleteDetail();
}, //onDelDetailClick
onAddClick: function (button, event) {
this.addstore = true;
this.addBill();
}, //end onAddDetailClick
onDeleteDetailClick: function (button, event) {
this.deleteBill();
}, //end onAddDetailClick
gridAddFeeListAfterEdit: function (editor, e, eOpts) {
//需要自己实现里面的事件
if (e.value == e.originalValue) return;
if (e.field == 'StlAmount') {
var BalAmount = e.record.data['BalAmount'];
var StlAmount = e.record.data['StlAmount'];
if (BalAmount >= 0) {
if (StlAmount > BalAmount) {
e.record.set('StlAmount', BalAmount);
Ext.Msg.show({ title: '提示', msg: '核销金额不能大于未核金额!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
}
} else {
if (StlAmount < BalAmount) {
e.record.set('StlAmount', BalAmount);
Ext.Msg.show({ title: '提示', msg: '核销金额不能大于未核金额!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
}
}
}
},
onNextKeyClick: function (col) {
var rows = this.gridAddFeeList.getSelectionModel().getSelection();
var row = rows[rows.length - 1];
var s = this.gridAddFeeList.getStore();
var number = s.indexOf(row) + 1;
this.cellEditingFee.startEditByPosition({ row: number, column: col });
},
onUpKeyClick: function (col) {
var rows = this.gridAddFeeList.getSelectionModel().getSelection();
var row = rows[rows.length - 1];
var s = this.gridAddFeeList.getStore();
var number = s.indexOf(row) - 1;
if (number < 0) number = 0;
this.cellEditingFee.startEditByPosition({ row: number, column: col });
},
addDetail: function () {
var btnEAddbill = Ext.getCmp('btnaddbill');
btnEAddbill.disable();
var btnEAddDetail = Ext.getCmp('btnadddetail');
btnEAddDetail.disable();
var Duino = this.formEdit.getForm().findField('BILLNO').getValue();
var basicForm = this.formEdit.getForm();
_this = this;
var m = 0;
for (var i = 0; i < this.storeStlList.getCount(); i += 1) {
var member = this.storeStlList.getAt(i);
var BILLSTATUS = member.data.BILLSTATUS;
if (BILLSTATUS == "2") {
m = m + 1;
}
}
if ((Duino == '*') || basicForm.isDirty() || m == 0) {
var FeeType = 1;
var CUSTOMERNAME = this.formEdit.getForm().findField('CUSTOMERNAME').getValue();
var selectedRecords = this.gridAddFeeList.selModel.getSelection();
if (selectedRecords.length > 0) {
var rec = selectedRecords[0];
var cust = rec.data.CustomerName;
var curr = rec.data.Currency;
FeeType = rec.data.FeeType;
var FeeType_Ref = rec.data.FeeType_Ref
if ((CUSTOMERNAME == '') || (CUSTOMERNAME == null))
this.formEdit.getForm().findField('CUSTOMERNAME').setValue(cust);
}
var CUSTOMERNAME = this.formEdit.getForm().findField('CUSTOMERNAME').getValue();
var myDate = new Date();
var mydatestr = Ext.util.Format.date(myDate, 'Y-m-d');
var record = Ext.create('MsChSettlement', {
GID: NewGuid(),
SETTLETYPE: '1',
BILLTYPE: FeeType,
BILLTYPEREF: FeeType_Ref,
SETTLEMODE: "0",
CUSTOMERNAME: CUSTOMERNAME,
CURR: curr,
SETTLETIME: mydatestr,
AMOUNT: 0,
DOAMOUNT: 0,
AMOUNTRMB: 0,
AMOUNTUSD: 0,
AMOUNTOT: 0,
RATE: 0,
ACCOUNTS_MONEY: 0,
ACCOUNTS_RATE: 0,
PREPAY_RATE: 0,
PREPAY_MONEY: 0,
AHSR_MONEY: 0,
AHSR_RATE: 0,
FINANCIAL_MONEY: 0,
FINANCIAL_RATE: 0,
ADVANCE_MONEY: 0,
ADVANCE_RATE: 0,
ACCOUNTS_MONEY: 0,
BILLSTATUS: 2
});
this.storeStlList.add(record);
if (!basicForm.isValid()) {
btnEAddDetail.enable();
btnEAddbill.enable();
return;
}
var type = 0;
this.Save('3');
} else {
var drmodify = this.storeStlList.getModifiedRecords();
var isadd = false;
for (i = 0; i < this.storeStlList.getCount(); i += 1) {
var memberyf = this.storeStlList.getAt(i);
if (memberyf.data.BILLNO == "")
isadd = true;
}
if (basicForm.isDirty() == true || isadd || drmodify.length != 0) {
this.Save('3');
} else {
this.addDetailfn();
}
}
},
addDetailfn: function () {
var btnEAddbill = Ext.getCmp('btnaddbill');
btnEAddbill.disable();
var btnEAddDetail = Ext.getCmp('btnadddetail');
if (this.addstore) {
this.storeCurrExrate.removeAll();
this.addstore = false;
}
var m = 0;
var Duino = this.formEdit.getForm().findField('BILLNO').getValue();
var billstatus = this.formEdit.getForm().findField('BILLSTATUS').getValue();
if (billstatus != 2) {
btnEAddDetail.enable();
btnEAddbill.enable();
Ext.Msg.show({ title: '提示', msg: '当前状态无法添加结算明细!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
return;
}
for (var i = 0; i < this.storeStlList.getCount(); i += 1) {
var member = this.storeStlList.getAt(i);
var BILLSTATUS = member.data.BILLSTATUS;
if (BILLSTATUS == "2") {
m = m + 1;
var record = member;
}
}
if (m == 1) {
} else {
var selections = this.stlgridList.getSelectionModel().getSelection();
if (selections.length == 0) {
Ext.Msg.show({ title: '提示', msg: '请先选择结算单!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
return;
} else if (selections.length != 1) {
Ext.Msg.show({ title: '提示', msg: '请先选择当前要结算的结算单!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
return;
}
var record = selections[0];
}
if (record.data.BILLSTATUS == '1') {
Ext.Msg.show({ title: '提示', msg: '当前结算单已锁定,不能再此结算单添加结算!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
return;
}
var basicForm = this.formEdit.getForm();
var billcust = record.data.CUSTOMERNAME;
var billno = record.data.BILLNO;
var billcurr = record.data.CURR;
var billtype = record.data.BILLTYPE;
var billgroupcorp = this.GetGroupCorp(billcust);
this.selectstlno = billno;
var selectedRecords = this.gridAddFeeList.selModel.getSelection();
var bodyAddDatas = [];
_this = this;
for (var i = 0; i < selectedRecords.length; i++) {
var rec = selectedRecords[i];
var cust = rec.data.CustomerName;
var custgroupcorp = this.GetGroupCorp(cust);
var bsno = rec.data.BSNO;
var curr = rec.data.Currency;
var ExChangerate = rec.data.ExChangerate;
if (cust == billcust || cust == billgroupcorp || (custgroupcorp == billgroupcorp && custgroupcorp != '')) {
if (billcurr == curr) {
rec.data.DoAmount = rec.data.StlAmount;
} else {
var recs = DsStoreQueryBy(_this.storeCurrExrate, 'CURR', curr);
if (recs.getCount() > 0) {
var data = recs.getAt(0).data;
var EXRATE = data.EXRATE;
rec.data.DoAmount = parseFloat(rec.data.StlAmount).mul(parseFloat(EXRATE));
rec.data.ExChangerate = EXRATE;
} else {
_this.ExrateConversion(curr, billcurr, 'detail', ExChangerate);
return;
}
}
bodyAddDatas.push(rec);
} else {
// Ext.Msg.show({ title: '提示', msg: '费用对象与收费结算客户不一致,不能添加此费用明细!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
alert('费用对象与收费结算客户不一致,不能添加此费用明细!');
}
}
if (bodyAddDatas.length == 0) {
btnEAddDetail.enable();
btnEAddbill.enable();
// Ext.Msg.show({ title: '提示', msg: '没有要添加的费用明细!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
return;
};
var jsonbodyAddDatas = ConvertRecordsToJsonAll(bodyAddDatas);
var ShenNo = this.formSearch.getForm().findField('ShenNo').getValue();
// var ShenNo = "";
Ext.Ajax.request({
waitMsg: '正在添加数据...',
url: '/Account/Chfee_settlement/AddDetailStl',
params: {
bill: billno,
data: jsonbodyAddDatas,
curr: billcurr,
billtype: billtype,
ShenNo: ShenNo
},
callback: function (options, success, response) {
if (success) {
var result = Ext.JSON.decode(response.responseText);
if (!result.Success) {
btnEAddDetail.enable();
btnEAddbill.enable();
Ext.Msg.show({
title: '提示',
msg: result.Message,
icon: Ext.MessageBox.ERROR,
buttons: Ext.Msg.OK
});
return;
} else {
_this.storeStlList.load({ params: { start: 0, limit: _this.StlPageSize,condition: " HXBILLNO='" + Duino + "'"} });
_this.storeAddFeeList.reload();
_this.storeBodyList.load({ params: { start: 0, limit: _this.BodyPageSize, condition: " BILLNO in (select BILLNO FROM ch_fee_settlement WHERE HXBILLNO='" + Duino + "')" },
callback: function (r, options, success) {
if (success) {
if (_this.storeBodyList.getCount() > 0) {
_this.comboxCustCode.setReadOnly(true);
}
else {
_this.comboxCustCode.setReadOnly(false);
}
}
},
scope: this
});
_this.storeBodySum.load({ params: { condition: " BILLNO in (select BILLNO FROM ch_fee_settlement WHERE HXBILLNO='" + Duino + "')"} });
}
} else {
btnEAddDetail.enable();
btnEAddbill.enable();
Ext.MessageBox.alert('请求出现错误,请重试', response.responseText);
}
},
scope: this
});
},
addBill: function () {
var btnEAddbill = Ext.getCmp('btnaddbill');
btnEAddbill.disable();
var btnadddetail = Ext.getCmp('btnadddetail');
btnadddetail.disable();
var basicForm = this.formEdit.getForm();
var Duino = this.formEdit.getForm().findField('BILLNO').getValue();
_this = this;
var m = 0;
for (var i = 0; i < this.storeStlList.getCount(); i += 1) {
var member = this.storeStlList.getAt(i);
var BILLSTATUS = member.data.BILLSTATUS;
if (BILLSTATUS == "2") {
m = m + 1;
}
}
var FeeType = 1;
if ((Duino == '*') || basicForm.isDirty() || m == 0) {
var CUSTOMERNAME = this.formEdit.getForm().findField('CUSTOMERNAME').getValue();
if (this.storeAddFeeList.getCount() > 0) {
var rec = this.storeAddFeeList.getAt(0);
var cust = rec.data.CustomerName;
var curr = rec.data.Currency;
FeeType = rec.data.FeeType;
var FeeType_Ref = rec.data.FeeType_Ref
if ((CUSTOMERNAME == '') || (CUSTOMERNAME == null))
this.formEdit.getForm().findField('CUSTOMERNAME').setValue(cust);
}
var CUSTOMERNAME = this.formEdit.getForm().findField('CUSTOMERNAME').getValue();
var myDate = new Date();
var mydatestr = Ext.util.Format.date(myDate, 'Y-m-d');
var record = Ext.create('MsChSettlement', {
GID: NewGuid(),
SETTLETYPE: '1',
BILLTYPE: FeeType,
BILLTYPEREF: FeeType_Ref,
SETTLEMODE: "0",
CUSTOMERNAME: CUSTOMERNAME,
CURR: curr,
SETTLETIME: mydatestr,
AMOUNT: 0,
STLAMOUNT: 0,
DOAMOUNT: 0,
AMOUNTRMB: 0,
AMOUNTUSD: 0,
AMOUNTOT: 0,
RATE: 0,
ACCOUNTS_MONEY: 0,
ACCOUNTS_RATE: 0,
PREPAY_RATE: 0,
PREPAY_MONEY: 0,
AHSR_MONEY: 0,
AHSR_RATE: 0,
FINANCIAL_MONEY: 0,
FINANCIAL_RATE: 0,
ADVANCE_MONEY: 0,
ADVANCE_RATE: 0,
ACCOUNTS_MONEY: 0,
BILLSTATUS: 2
});
this.storeStlList.add(record);
if (!basicForm.isValid()) {
btnEAddbill.enable();
btnadddetail.enable();
return;
}
var type = 0;
this.Save('4');
} else {
var drmodify = this.storeStlList.getModifiedRecords();
var isadd = false;
for (i = 0; i < this.storeStlList.getCount(); i += 1) {
var memberyf = this.storeStlList.getAt(i);
if (memberyf.data.BILLNO == "")
isadd = true;
}
if (basicForm.isDirty() == true || isadd || drmodify.length != 0) {
this.Save('4');
} else {
this.addBillfn();
}
}
}, //end save
addBillfn: function () {
var btnEAddbill = Ext.getCmp('btnaddbill');
var btnadddetail = Ext.getCmp('btnadddetail');
var Duino = this.formEdit.getForm().findField('BILLNO').getValue();
var billstatus = this.formEdit.getForm().findField('BILLSTATUS').getValue();
if (billstatus != 2) {
btnEAddbill.enable();
btnadddetail.enable();
Ext.Msg.show({ title: '提示', msg: '当前状态无法添加付费结算明细!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
return;
}
if (this.addstore) {
this.storeCurrExrate.removeAll();
this.addstore = false;
}
var m = 0;
for (var i = 0; i < this.storeStlList.getCount(); i += 1) {
var member = this.storeStlList.getAt(i);
var BILLSTATUS = member.data.BILLSTATUS;
if (BILLSTATUS == "2") {
m = m + 1;
var record = member;
}
}
if (m == 1) {
} else {
var selections = this.stlgridList.getSelectionModel().getSelection();
if (selections.length == 0) {
Ext.Msg.show({ title: '提示', msg: '请先选择结算单!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
return;
} else if (selections.length != 1) {
Ext.Msg.show({ title: '提示', msg: '请先选择当前要结算的结算单!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
return;
}
var record = selections[0];
}
if (record.data.BILLSTATUS == '1') {
Ext.Msg.show({ title: '提示', msg: '当前结算单已锁定,不能再此结算单添加结算!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
return;
}
var billcust = record.data.CUSTOMERNAME;
var billno = record.data.BILLNO;
var billcurr = record.data.CURR;
var billgroupcorp = this.GetGroupCorp(billcust);
var billtype = record.data.BILLTYPE;
var feeBSNOSql = '';
var sql = '';
var selectedRecords = this.gridAddList.selModel.getSelection();
if (selectedRecords.length == 0) {
btnEAddbill.enable();
btnadddetail.enable();
// Ext.Msg.show({ title: '提示', msg: '没有选择要添加的业务!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
return;
};
var bodyAddDatas = [];
for (var i = 0; i < selectedRecords.length; i++) {
var rec = selectedRecords[i];
var custgroupcorp = this.GetGroupCorp(rec.data.FEEOBJNAME);
if (rec.data.FEEOBJNAME == billcust || rec.data.FEEOBJNAME == billgroupcorp || (custgroupcorp == billgroupcorp && custgroupcorp != '')) {
var feeBSNO = " (f.BSNO='" + rec.data.BSNO + "' AND f.CUSTOMERNAME='" + rec.data.FEEOBJNAME + "') ";
if (feeBSNOSql == '') {
feeBSNOSql = feeBSNO;
} else {
feeBSNOSql = feeBSNOSql + " OR " + feeBSNO;
}
}
}
if (feeBSNOSql == '') {
btnEAddbill.enable();
btnadddetail.enable();
Ext.Msg.show({ title: '提示', msg: '没有要添加的费用明细!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
sql = " ";
return;
}
else {
sql = " (" + feeBSNOSql + ")";
sql = sql + getAndConSql(sql, this.FeeSqlStr, this.FeeSqlStr);
}
_this = this;
var bodydatas = [];
for (var i = 0; i < this.storeCurrExrate.getCount(); i += 1) {
var member = this.storeCurrExrate.getAt(i);
if (member.data.EXRATE == 0) {
_this.ExrateConversion(member.CURR, billcurr, 'bill', 0);
return;
}
bodydatas.push(member);
}
var currBody = ConvertRecordsToJsonAll(bodydatas);
var ShenNo = this.formSearch.getForm().findField('ShenNo').getValue();
// var ShenNo = "";
Ext.Ajax.request({
waitMsg: '正在添加数据...',
url: '/Account/Chfee_settlement/AddBillStl',
params: {
billno: billno,
billcust: billcust,
billcurr: billcurr,
feesql: sql,
storeCurrExrate: currBody,
billtype: billtype,
custgroup: true,
ShenNo: ShenNo
},
callback: function (options, success, response) {
if (success) {
var result = Ext.JSON.decode(response.responseText);
if (!result.Success) {
btnEAddbill.enable();
btnadddetail.enable();
Ext.Msg.show({
title: '提示',
msg: result.Message,
icon: Ext.MessageBox.ERROR,
buttons: Ext.Msg.OK
});
return;
} else {
dataList = result.Data;
if (dataList == null) {
_this.storeStlList.load({ params: { start: 0, limit: _this.StlPageSize,condition: " HXBILLNO='" + Duino + "'"} });
_this.storeBodyAddList.reload();
_this.storeBodyList.load({ params: { start: 0, limit: _this.BodyPageSize, condition: " BILLNO in (select BILLNO FROM ch_fee_settlement WHERE HXBILLNO='" + Duino + "')" },
callback: function (r, options, success) {
if (success) {
if (_this.storeBodyList.getCount() > 0) {
_this.comboxCustCode.setReadOnly(true);
}
else {
_this.comboxCustCode.setReadOnly(false);
}
}
},
scope: this
});
_this.storeBodySum.load({ params: { condition: " BILLNO in (select BILLNO FROM ch_fee_settlement WHERE HXBILLNO='" + Duino + "')"} });
} else {
if (dataList.lenght != 0) {
for (var i = 0; i < dataList.length; i++) {
var record = dataList[i];
_this.storeCurrExrate.add(record);
}
_this.ExrateConversion(record.CURR, billcurr, 'bill', 0);
return;
}
}
}
} else {
btnEAddbill.enable();
btnadddetail.enable();
Ext.MessageBox.alert('请求出现错误,请重试', response.responseText);
}
},
scope: this
});
},
deleteBill: function (type) {
var btnEDeleteDetail = Ext.getCmp('btndeldetail');
btnEDeleteDetail.disable();
var billno = this.formEdit.getForm().findField('BILLNO').getValue();
var selectedRecords = this.gridList.selModel.getSelection();
if (selectedRecords.length == 0) {
Ext.Msg.show({ title: '提示', msg: '没有要删除的费用明细!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
btnEDeleteDetail.enable();
return;
};
var billstatus = this.formEdit.getForm().findField('BILLSTATUS').getValue();
if (billstatus != 2) {
Ext.Msg.show({ title: '提示', msg: '当前状态无法删除结算明细!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
btnEDeleteDetail.enable();
return;
}
var bodyAddDatas = [];
for (var i = 0; i < selectedRecords.length; i++) {
var rec = selectedRecords[i];
for (i = 0; i < this.storeStlList.getCount(); i += 1) {
var memberyf = this.storeStlList.getAt(i);
if (memberyf.data.BILLNO == rec.data.BILLNO) {
if (memberyf.data.BILLSTATUS == '1') {
Ext.Msg.show({ title: '提示', msg: '此结算单已锁定,无法删除!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
btnEDeleteDetail.enable();
return;
} else {
bodyAddDatas.push(rec);
}
}
}
}
var jsonbodyAddDatas = ConvertRecordsToJsonAll(bodyAddDatas);
var sql = this.BillSql;
Ext.Msg.wait('正在删除数据., 请稍侯..');
Ext.Ajax.request({
waitMsg: '正在删除数据...',
url: '/Account/Chfee_hexiao/DelBill',
params: {
data: jsonbodyAddDatas,
billno: billno,
billtype: 1
},
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
});
btnEDeleteDetail.enable();
return;
} else {
Ext.MessageBox.hide();
_this.storeStlList.load({ params: { start: 0, limit: _this.StlPageSize,condition: " HXBILLNO='" + billno + "'"} });
_this.storeBodyList.load({ params: { start: 0, limit: _this.BodyPageSize, condition: " BILLNO in (select BILLNO FROM ch_fee_settlement WHERE HXBILLNO='" + billno + "')" },
callback: function (r, options, success) {
if (success) {
btnEDeleteDetail.enable();
if (_this.storeBodyList.getCount() > 0) {
_this.comboxCustCode.setReadOnly(true);
}
else {
_this.comboxCustCode.setReadOnly(false);
}
}
},
scope: this
});
_this.storeBodySum.load({ params: { condition: " BILLNO in (select BILLNO FROM ch_fee_settlement WHERE HXBILLNO='" + billno + "')"} });
}
} else {
Ext.MessageBox.alert('请求出现错误,请重试', response.responseText);
btnEDeleteDetail.enable();
}
},
scope: this
});
},
onSubmitAuditClick: function () {
var Duino = this.formEdit.getForm().findField('BILLNO').getValue();
var billstatus = this.formEdit.getForm().findField('BILLSTATUS').getValue();
var REMARK = this.formEdit.getForm().findField('REMARK').getValue();
// var btnESave = Ext.getCmp('btnESave');
// isDisabled()
if (Duino == '*') {
Ext.Msg.show({ title: '提示', msg: '请先保存收费结算,然后才能锁定!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
return;
};
if ((billstatus != 2)) {
Ext.Msg.show({ title: '提示', msg: '当前状态无法锁定!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
return;
}
if (this.storeBodyList.getCount() == 0) {
Ext.Msg.show({ title: '提示', msg: '没有结算明细,无法锁定!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
return;
}
_this = this;
Ext.Ajax.request({
waitMsg: '正在添加数据...',
url: '/Account/Chfee_hexiao/Lock',
params: {
bill: Duino,
remark: REMARK
},
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.LoadData('edit', " BILLNO='" + Duino + "'");
}
} else {
Ext.MessageBox.alert('请求出现错误,请重试', response.responseText);
}
},
scope: this
});
},
onSubmitAuditBackClick: function () {
var Duino = this.formEdit.getForm().findField('BILLNO').getValue();
var billstatus = this.formEdit.getForm().findField('BILLSTATUS').getValue();
if (Duino == '*') {
Ext.Msg.show({ title: '提示', msg: '请先保存收费结算,然后才能撤销锁定!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
return;
};
if (billstatus != 1) {
Ext.Msg.show({ title: '提示', msg: '当前状态无法撤销锁定!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
return;
}
var isVOUCHERNO = this.formEdit.getForm().findField('VOUNO').getValue();
if (isVOUCHERNO != "") {
Ext.Msg.show({ title: '提示', msg: '此票结算已生成总账凭证无法撤消锁定!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
return;
}
_this = this;
Ext.Ajax.request({
waitMsg: '正在添加数据...',
url: '/Account/Chfee_hexiao/UnLock',
params: {
bill: Duino
},
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.LoadData('edit', " BILLNO='" + Duino + "'");
}
} else {
Ext.MessageBox.alert('请求出现错误,请重试', response.responseText);
}
},
scope: this
});
},
onRefreshClick: function (button, event) {
var sql = this.getCondition();
this.sqlcontext = sql;
this.PageSize = this.Pagenum.getValue();
this.storeBodyAddList.pageSize = this.PageSize;
this.storeAddFeeList.removeAll();
var ShenNo = this.formSearch.getForm().findField('ShenNo').getValue();
// var ShenNo = "";
this.storeBodyAddList.load({ params: { start: 0, limit: this.PageSize, sort: '', condition: sql, billtype: 1, ShenNo: ShenNo} });
},
onDsQuery: function (button, event) {
var sql = this.sqlcontext;
this.PageSize = this.Pagenum.getValue();
this.storeBodyAddList.pageSize = this.PageSize;
this.storeAddFeeList.removeAll();
var ShenNo = this.formSearch.getForm().findField('ShenNo').getValue();
// var ShenNo = "";
this.storeBodyAddList.load({ params: { start: 0, limit: this.PageSize, sort: '', condition: sql, billtype: 1, ShenNo: ShenNo} });
},
onInitRefreshClick: function (button, event) {
var sql = this.getCondition();
this.sqlcontext = sql + " and 1=2 ";
this.storeAddFeeList.removeAll();
var ShenNo = this.formSearch.getForm().findField('ShenNo').getValue();
// var ShenNo = "";
this.storeBodyAddList.load({ params: { start: 0, limit: this.PageSize, sort: '', condition: this.sqlcontext, billtype: 1, ShenNo: ShenNo} });
},
onClearSql: function () {
var form = this.formSearch.getForm();
form.reset();
},
getCondition: function () {
var form = this.formSearch.getForm();
if (!form.isValid()) {
Ext.Msg.alert('提示', '查询条件赋值错误,请检查。');
return '';
}
var sql = '';
var customNo = form.findField('CustomNo').getValue();
sql = sql + getAndConSql(sql, customNo, " (b.CUSTNO like '%" + customNo + "%' or b.MBLNO like '%" + customNo + "%' or b.HBLNO like '%" + customNo + "%' or b.CUSTOMNO like '%" + customNo + "%' or b.ORDERNO like '%" + customNo + "%')");
var OPLBNAME = form.findField('OPLBNAME').getValue();
sql = sql + getAndConSql(sql, OPLBNAME, "b.OPLBNAME='" + OPLBNAME + "'");
var expDateBgn = form.findField('ExpDateBgn').getRawValue();
sql = sql + getAndConSql(sql, expDateBgn, "b.ETD >='" + expDateBgn + "'");
var expDateEnd = form.findField('ExpDateEnd').getRawValue();
sql = sql + getAndConSql(sql, expDateEnd, "b.ETD <='" + expDateEnd + "'");
var ACCDATE = form.findField('ACCDATEFR').getRawValue();
sql = sql + getAndConSql(sql, ACCDATE, "b.ACCDATE>='" + ACCDATE + "'");
var ACCDATETO = form.findField('ACCDATETO').getRawValue();
sql = sql + getAndConSql(sql, ACCDATETO, "b.ACCDATE<='" + ACCDATETO + "'");
var VESSEL = form.findField('VESSEL').getValue();
sql = sql + getAndConSql(sql, VESSEL, "b.VESSEL='" + VESSEL + "'");
var VOYNO = form.findField('VOYNO').getValue();
sql = sql + getAndConSql(sql, VOYNO, "b.VOYNO like '%" + VOYNO + "%'");
// var feesql = 'f.FEESTATUS IN (0,8,9) and (f.AMOUNT<>(f.SETTLEMENT+f.ORDERAMOUNT-ISNULL(f.ORDERSETTLEMENT,0))) ';
this.FeeSqlStr = this.getFeeCondition();
// feesql = feesql + getAndConSql(feesql, this.FeeSqlStr, this.FeeSqlStr);
sql = sql + getAndConSql(sql, this.FeeSqlStr, this.FeeSqlStr);
this.BillSql = sql;
return sql;
},
getFeeCondition: function () {
var form = this.formSearch.getForm();
var feesql = ' f.FEESTATUS IN (0,8,9) and (f.AMOUNT<>(f.SETTLEMENT)) ';
var CUSTNAME = form.findField('CUSTNAME').getValue();
feesql = feesql + getAndConSql(feesql, CUSTNAME, "f.CUSTOMERNAME='" + CUSTNAME + "'");
var DC = form.findField('DC').getValue();
feesql = feesql + getAndConSql(feesql, DC, "f.FEETYPE=" + DC);
var Currency = form.findField('Currency').getValue();
feesql = feesql + getAndConSql(feesql, Currency, "f.Currency='" + Currency + "'");
var FeeName = form.findField('FeeName').getValue();
feesql = feesql + getAndConSql(feesql, FeeName, "f.FeeName='" + FeeName + "'");
var DuiNo = form.findField('DuiNo').getValue();
feesql = feesql + getAndConSql(feesql, DuiNo, " f.GID IN (SELECT GID FROM V_DUI_FEE WHERE DUINO='" + DuiNo + "')");
// var ShenNo = form.findField('ShenNo').getValue();
// feesql = feesql + getAndConSql(feesql, ShenNo, " f.GID IN (SELECT FEEID FROM CH_FEE_DO WHERE BILLNO IN (SELECT BILLNO FROM ch_fee_payapplication WHERE BILLNO like '%" + ShenNo + "' AND BILLSTATUS NOT IN (1,2,3)))");
var InvNo = form.findField('InvNo').getValue();
feesql = feesql + getAndConSql(feesql, InvNo, " f.GID IN (SELECT FEEID FROM CH_FEE_DO WHERE BILLNO IN (SELECT BILLNO FROM ch_fee_invoice WHERE INVOICENO like '%" + InvNo + "'))");
// feesql = feesql + getAndConSql(feesql, InvNo, " f.INVOICENUM='" + InvNo + "'");
return feesql;
},
ExrateConversion: function (bfcurr, afcurr, fntype, dfexrate) {
var EXRATE = 0;
var achange = true;
var bchange = true;
formExrateConversion = 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: '1' + bfcurr + '=',
xtype: 'numberfield',
name: 'bfcurr',
decimalPrecision: 10,
value: 0,
renderer: function (value, cellmeta, record, rowIndex, columnIndex, store) {
try {
var lsValue = usMoney(value, 10, '', 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;
},
listeners: {
change: function () {
if (bchange) {
var bfcurr = formExrateConversion.getForm().findField('bfcurr').getValue();
var field = formExrateConversion.getForm().findField('afcurr');
if (bfcurr == 0) { field.setValue(0); } else {
var taxrate = (parseFloat(1).div(parseFloat(bfcurr))).toFixed(10);
achange = false;
field.setValue(taxrate);
}
}
achange = true;
}
}
}, {
xtype: 'label',
width: 120,
text: afcurr,
name: 'bfcurr2'
}
]
}, {
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [{
fieldLabel: '1' + afcurr + '=',
xtype: 'numberfield',
name: 'afcurr',
decimalPrecision: 10,
value: 0,
renderer: function (value, cellmeta, record, rowIndex, columnIndex, store) {
try {
var lsValue = usMoney(value, 10, '', 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;
},
listeners: {
change: function () {
if (achange) {
var afcurr = formExrateConversion.getForm().findField('afcurr').getValue();
var field = formExrateConversion.getForm().findField('bfcurr');
if (afcurr == 0) { field.setValue(0); } else {
var taxrate = (parseFloat(1).div(parseFloat(afcurr))).toFixed(10);
bchange = false;
field.setValue(taxrate);
}
}
bchange = true;
}
}
}, {
xtype: 'label',
width: 120,
text: bfcurr,
name: 'afcurr2'
}
]
}
]//end items(fieldset 1)
}//end fieldset 1
]//end root items
});
me = this;
winExrateShow = Ext.create('Ext.window.Window', {
title: "币别汇率折算",
width: 450,
iconCls: "addicon",
resizable: false,
collapsible: true, // 允许缩放条
closeAction: 'close',
closable: true,
modal: 'true',
buttonAlign: "center",
bodyStyle: "padding:0 0 0 0",
items: [formExrateConversion],
buttons: [{
text: "确定",
minWidth: 70,
handler: function () {
var form = formExrateConversion.getForm();
var UsdExrate = form.findField('bfcurr').getValue();
if (UsdExrate == '' || UsdExrate == null || UsdExrate == undefined) {
Ext.Msg.show({ title: '提示', msg: '必须填折算汇率!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
return;
};
var recs = DsStoreQueryBy(me.storeCurrExrate, 'CURR', bfcurr);
if (recs.getCount() > 0) {
for (var i = 0; i < me.storeCurrExrate.getCount(); i += 1) {
var member = me.storeCurrExrate.getAt(i);
if (member.data.CURR == bfcurr) {
member.set('EXRATE', UsdExrate);
member.commit();
}
}
} else {
me.storeCurrExrate.add({ "CURR": bfcurr, "EXRATE": UsdExrate })
}
winExrateShow.close();
if (fntype == 'detail') {
me.addDetail();
}
if (fntype == 'bill') {
me.addBill();
}
return;
}
}, {
text: "关闭",
minWidth: 70,
handler: function () {
winExrateShow.close();
me.GetEditStatus();
return;
}
}]
});
if (afcurr == 'RMB') {
var FFrecords = DsStoreQueryBy(this.StoreDateCurr, 'CURR', bfcurr);
if (FFrecords.getCount() > 0) {
var ffdata = FFrecords.getAt(0).data;
var DEFRATE = ffdata.DEFRATE;
} else {
var DFrecords = DsStoreQueryBy(this.StoreCurr, 'CURR', bfcurr);
if (DFrecords.getCount() > 0) {
var dfdata = DFrecords.getAt(0).data;
var DEFRATE = dfdata.DEFRATE;
} else {
var DEFRATE = 1;
}
}
var field = formExrateConversion.getForm().findField('bfcurr');
achange = true;
field.setValue(DEFRATE);
} else {
var DEFRATE = 1;
var field = formExrateConversion.getForm().findField('afcurr');
var recs = DsStoreQueryBy(me.StoreDateCurr, 'CURR', afcurr);
if (recs.getCount() > 0) {
var dfdata = recs.getAt(0).data;
DEFRATE = dfdata.DEFRATE;
} else {
var DFrecords = DsStoreQueryBy(this.StoreCurr, 'CURR', afcurr);
if (DFrecords.getCount() > 0) {
var dfdata = DFrecords.getAt(0).data;
DEFRATE = dfdata.DEFRATE;
} else {
DEFRATE = 1;
}
}
bchange = true;
field.setValue(DEFRATE);
}
winExrateShow.show();
},
GetGroupCorp: function (custname) {
_this = this;
var records = DsStoreQueryBy(_this.StoreClientGroup, 'SHORTNAME', custname);
if (records.getCount() > 0) {
return records.getAt(0).data.PCORPNAME;
} else {
return '';
}
},
// #region 根据权限和状态判断是否允许修改
GetEditStatus: function () {
var canedit = false;
var btnESubmitAudit = Ext.getCmp('btnSubmitAudit');
var btnESubmitAuditBack = Ext.getCmp('btnSubmitAuditBack');
this.formEdit.getForm().findField('BILLSTATUS').setDisabled(false);
var bsStatus = this.formEdit.getForm().findField('BILLSTATUS').getValue();
var op = this.formEdit.getForm().findField('CREATEUSERREF').getValue();
var opid = this.formEdit.getForm().findField('CREATEUSER').getValue();
this.formEdit.getForm().findField('BILLSTATUS').setDisabled(true);
_this = this;
if (bsStatus != 2) {
canedit = false;
this.setSaveBtnStatus(canedit);
} else {
this.StoreOpRange.load({ params: { optype: "modhexiao" },
callback: function (r, options, success) {
if (success) {
if (r.length != 0) {
var records = DsStoreQueryBy(_this.StoreOpRange, 'OPID', op);
if (records.getCount() > 0) {
canedit = true;
} else {
canedit = false;
}
_this.setSaveBtnStatus(canedit);
// _this.LoadPeriodStatus(_this.opStatus);
} else {
_this.setSaveBtnStatus(false);
Ext.getCmp('btnENew').hide();
}
}
}
});
}
this.StoreLockOp.load({ params: { optype: "modhexiaolock" },
callback: function (r, options, success) {
if (success) {
if (r.length != 0) {
var records = DsStoreQueryBy(_this.StoreLockOp, 'OPID', opid);
if (records.getCount() > 0) {
if (bsStatus == 1) {
btnESubmitAudit.disable();
} else {
btnESubmitAudit.enable();
}
} else {
btnESubmitAudit.disable();
}
}
}
}
});
this.StoreUnLockOp.load({ params: { optype: "modhexiaounlock" },
callback: function (r, options, success) {
if (success) {
if (r.length != 0) {
var records = DsStoreQueryBy(_this.StoreUnLockOp, 'OPID', opid);
if (records.getCount() > 0) {
if (bsStatus == 1) {
btnESubmitAuditBack.enable();
} else {
btnESubmitAuditBack.disable();
}
} else {
btnESubmitAuditBack.disable();
}
}
}
}
});
},
setSaveBtnStatus: function (enable) {
var btnESave = Ext.getCmp('btnESave');
var btnESaveAndClose = Ext.getCmp('btnESaveAndClose');
var btnESaveAndNew = Ext.getCmp('btnESaveAndNew');
var btnEAddDetail = Ext.getCmp('btnadddetail');
var btnEDeleteDetail = Ext.getCmp('btndeldetail');
var btnEAddbill = Ext.getCmp('btnaddbill');
var btnaddstl = Ext.getCmp('btnaddstl');
var btndelstl = Ext.getCmp('btndelstl');
var btnfenstl = Ext.getCmp('btnfenstl');
var btnDelete = Ext.getCmp('btnDelete');
this.canedit = enable;
if (enable) {
btnESave.enable();
btnESaveAndClose.enable();
btnESaveAndNew.enable();
btnEAddDetail.enable();
btnEDeleteDetail.enable();
btnEAddbill.enable();
btnaddstl.enable();
btndelstl.enable();
btnDelete.enable();
btnfenstl.enable();
} else {
btnESave.disable();
btnESaveAndClose.disable();
btnESaveAndNew.disable();
btnEAddDetail.disable();
btnEDeleteDetail.disable();
btnEAddbill.disable();
btnaddstl.disable();
btndelstl.disable();
btnDelete.disable();
btnfenstl.disable();
}
},
// #endregion
Print: function () {
var basicForm = this.formEdit.getForm();
var billNo = basicForm.findField('BILLNO').value;
if (billNo == '*' || billNo == '') {
Ext.Msg.show({ title: '错误', msg: '单据还没有保存,请保存后再打印', icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK });
return;
}
var sortstr = ' c.CREATETIME';
if (this.sortfield != '' && this.sortdire != '') {
sortstr = this.sortfield + ' ' + this.sortdire;
}
var printType = 'MSCHFEEHEXIAO';
var sql1 = "SELECT GID,cm.BILLNO,BILLDATE,CUSTOMERNAME,AUDITUSER,AUDITTIME,CREATEUSER,CREATETIME ";
sql1 = sql1 + " ,BILLSTATUS,REMARK,COMPANYID,VOUNO,(SELECT EXPVOUNO FROM cw_vouchers WHERE VOUALLNO=cm.VOUNO) EXPVOUNO ";
sql1 = sql1 + ",(select EnumValueName from tSysEnumValue where LangId=0 and EnumTypeID=97006 and EnumValueID=cm.BILLSTATUS) as BILLSTATUSREF";
sql1 = sql1 + " ,(select ShowName from [user] where GID=cm.CREATEUSER) as CREATEUSERREF,D.STLRMBDR,D.STLUSDDR,D.STLOTDR,D.STLRMBCR,D.STLUSDCR,D.STLOTCR";
sql1 = sql1 + " FROM ch_fee_hexiao cm left join v_fee_do_hexiao_SUM D ON (D.HXBILLNO=cm.BILLNO) WHERE cm.BILLNO='" + billNo + "'";
var sql2 = "SELECT c.GID,c.BSNO,c.FEEID,c.FEENAME,c.CURRENCY,c.AMOUNT,c.DOAMOUNT,c.ORIGCURRENCY,c.ORIGAMOUNT,c.EXCHANGERATE,FEETYPE ";
sql2 = sql2 + ",b.CUSTOMERNAME,b.VESSEL,b.VOYNO,b.ETD,b.PORTLOAD";
sql2 = sql2 + " ,b.PORTDISCHARGE,b.INPUTBY,b.OP,b.CUSTSERVICE,b.DOC,b.SALE,b.MBLNO,b.CUSTNO";
sql2 = sql2 + " FROM ch_fee_do c left join v_op_bill b on (b.bsno=c.bsno)";
sql2 = sql2 + " WHERE C.BILLNO='" + billNo + "' ORDER BY " + sortstr;
var sql3 = "";
var sql4 = "";
var sql5 = "";
var sql6 = "";
PrintComm(printType, sql1, sql2, sql3, sql4, sql5, sql6);
},
//#region 生成凭证
onAddCwVouchers: function (button, event) {
var billNo = this.formEdit.getForm().findField('BILLNO').value;
if (billNo == '*' || billNo == '') {
Ext.Msg.show({ title: '提示', msg: '请先保存单据!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
return;
}
// //
// var strGids = "";
// var VOUCHERNO = this.formEdit.getForm().findField('VOUCHERNO').value; //凭证号
// var BILLSTATUS = this.formEdit.getForm().findField('BILLSTATUS').value; //是否锁定
// var SETTLETYPEREF = this.formEdit.getForm().findField('SETTLETYPE').value; //结算方式
// var ACCOUNTREF = this.formEdit.getForm().findField('ACCOUNT').value; //结算账户
//
// if (VOUCHERNO == "" && BILLSTATUS == 1 && ((SETTLETYPEREF != "现金" && ACCOUNTREF != "") || SETTLETYPEREF == "现金")) {
// strGids = this.editRecord.data.GID.toString();
// }
// 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);
//
Ext.Ajax.request({
waitMsg: '正在预读数据,请稍候...',
url: '/Account/Chfee_hexiao/GetIsVoucher',
params: {
strGids: this.editRecord.data.GID.toString()
},
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;
}
//
this.storeListCw.load({ params: { strGids: this.editRecord.data.GID.toString() }, waitMsg: "正在刷新数据...", scope: this });
this.showContactForm(false, this.editRecord.data.GID.toString(), this);
} else {
Ext.MessageBox.alert('请求出现错误,请重试', response.responseText);
}
},
scope: this
});
},
//#endregion
//#region 层_显示信息
showContactForm: function (win, strGids, _this) {
var required = '<span style="color:red;font-weight:bold;" data-qtip="Required">*</span>';
if (!win) {
//#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,
name: 'VOUDATE',
value: Ext.util.Format.date(Ext.Date.add(new Date(), Ext.Date.MONTH - 1, 1), "Y-m-d")
}, this.comboxVKNO, //需求编号SR2017080200007
{
xtype: "checkbox", //checkbox控件
name: "ButtSettlement",
boxLabel: "对抵结算是否生成银行账款",
width: 200,
inputValue: "true", //选中的值
uncheckedValue: "false" //未选中的值
}, this.comboxMergeType, {
xtype: "checkbox", //checkbox控件
name: "ISRATE",
boxLabel: "是否按照系统录入汇率",
width: 200,
inputValue: "true", //选中的值
uncheckedValue: "false", //未选中的值
checked: true, //绘制时的选中状态,
listeners: {
'change': function (field, newValue, oldValue, eOpts) {
if (field.checked.toString() == "false") {
this.gridListCw.show();
}
else {
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_hexiao/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) {
Ext.Msg.show({ title: '提示', msg: jsonresult.Message, icon: Ext.MessageBox.INFO, buttons: Ext.Msg.OK });
//刷新页面
var billno = _this.formEdit.getForm().findField('BILLNO').getValue();
Ext.Ajax.request({
waitMsg: '正在查询主表数据...',
url: '/Account/Chfee_heixao/GetData',
params: {
handle: 'edit',
condition: " BILLNO='" + billno + "'"
},
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;
}
var data = result.data;
_this.formEdit.getForm().findField('BILLSTATUS').setDisabled(false);
_this.formEdit.getForm().reset();
_this.formEdit.getForm().setValues(data);
_this.formEdit.getForm().findField('BILLSTATUS').setDisabled(true);
var editp = Ext.create('MsChSettlement', data);
_this.editRecord.fields.each(function (field) {
if (field.persist) {
name = field.name;
if (name != 'id')
this.editRecord.set(name, editp.get(name));
}
}, this);
_this.editRecord.commit();
_this.GetEditStatus();
} else {
Ext.MessageBox.alert('请求出现错误,请重试', response.responseText);
}
},
scope: this
});
//Ext.getCmp('btnAddCwVouchers').setText("撤销凭证");
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();
}
}, {
text: '取消',
handler: function () {
this.up('form').getForm().reset();
this.up('window').hide();
}
}],
listeners: {
scope: this,
'render': function (thisDiv, thisExtend) {
//var ISRATE = thisDiv.form.findField('ISRATE').getValue().toString();
//if (ISRATE == "false") {
// this.gridListCw.show();
//}
//else {
// this.gridListCw.hide();
//}
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.INFO, 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();
//
thisDiv.form.findField('VOUDATE').setValue(strVOUDATE);
thisDiv.form.findField('VOUDATE').setMinValue(strACCDATE + "-01");
//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: 'hide',
width: 250,
height: 300,
layout: 'fit',
resizable: true,
modal: true,
closable: false,
items: formDiv
});
}
win.show();
}
//#endregion
,
onSelectFee: function (button, event) {
var selectedRecords = this.gridAddFeeList.selModel.getSelection();
var sum = 0;
for (var i = 0; i < selectedRecords.length; i++) {
var rec = selectedRecords[i];
sum = sum + rec.get("StlAmount");
}
sum = sum.toFixed(2);
Ext.getCmp("zongshu").setText(" 选中金额:" + sum);
},
onDeleteClick: function (button, event) {
var record = this.editRecord;
var billstatus = record.data.BILLSTATUS;
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_hexiao/Delete',
params: {
data: Ext.JSON.encode(record.data)
},
callback: function (options, success, response) {
if (success) {
var jsonresult = Ext.JSON.decode(response.responseText);
if (jsonresult.Success) {
Ext.Msg.show({ title: '提示', msg: '删除成功!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
window.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);
} //onDeleteClick
});