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/Account/Viewsjs/Chfee_recvprocess/ChRecvprocessEntry.js

2754 lines
99 KiB
JavaScript

2 years ago
Ext.namespace('Shipping');
Shipping.MsChRecvprocessEntry = function (config) {
Ext.applyIf(this, config);
this.initUIComponents();
window.Shipping.MsChRecvprocessEntry.superclass.constructor.call(this);
};
Ext.extend(Shipping.MsChRecvprocessEntry, Ext.Panel, {
ParentWin: null,
OpStatus: 'add',
StoreList: null,
EditRecord: null,
addstore: false,
PageSize: 30,
initUIComponents: function () {
this.serialNo = 0;
this.workSerialNo = 0;
this.bodyDel = [];
this.FeeSql = '';
this.BillSql = '';
this.DuiBillSql = '';
this.IsDebit = '0';
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"} });
//#region 编辑form
//枚举参照相关(编辑form)
//表参照相关(编辑form)
this.storeOpCode = Ext.create('DsExt.ux.RefTableStore', {
model: 'DsShipping.ux.UserRefModel',
proxy: { url: '/CommMng/BasicDataRef/GetUserLinkRefList' }
});
this.storeOpCode.load({ params: { condition: ""} }); //客服
this.comboxSETTLEUSER = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: '核销人',
store: this.storeOpCode,
forceSelection: true,
name: 'SETTLEUSER',
valueField: 'GID',
displayField: 'CodeAndName'
});
this.storeCustCode = Ext.create('DsExt.ux.RefTableStore', {
model: 'DsShipping.ux.CustomInvRefModel',
proxy: { url: '/CommMng/BasicDataRef/GetCustomInvRefList' }
});
this.storeCustCode.load({ params: { condition: ""} });
this.comboxCustCode = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: '结算单位',
store: this.storeCustCode,
allowBlank: true,
forceSelection: true,
name: 'CUSTOMERNAME',
valueField: 'CustName',
displayField: 'CodeAndName',
listeners: {
scope: this,
'select': function (combo, records, eOpts) {
if (records.length > 0) {
var CUSTOMERNAME = this.formEdit.getForm().findField('CUSTOMERNAME').getValue();
if (CUSTOMERNAME == '') return;
// var CUSTNAME = this.formSearch.getForm().findField('CUSTNAME');
// var tmpcust = CUSTNAME.getValue();
// if (tmpcust == '' || tmpcust == null || tmpcust == undefined) {
// CUSTNAME.setValue(CUSTOMERNAME);
// }
}
}
}
});
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: ""} });
//定位至RMB
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', {
fieldLabel: '币别',
store: this.StoreCurr,
forceSelection: true,
allowBlank: false,
name: 'CURR',
valueField: 'CURR',
displayField: 'CURR',
//value:"RMB",
listeners: {
scope: this,
'select': function (combo, records, eOpts) {
if (records.length > 0) {
var CUST = this.formEdit.getForm().findField('CUSTOMERNAME').getValue();
var recs = DsStoreQueryBy(this.storeCustCode, 'CustName', CUST);
var CUSTBANK = this.formEdit.getForm().findField('CUSTBANK');
var CUSTACCOUNT = this.formEdit.getForm().findField('CUSTACCOUNT');
var CURR = this.formEdit.getForm().findField('CURR').getValue();
var curr = this.formACCOUNTS.getForm().findField('ACCOUNTS_CURRENCY');
curr.setValue(records[0].data.CURR);
var curr = this.formPREPAY.getForm().findField('PREPAY_CURRENCY');
curr.setValue(records[0].data.CURR);
var curr = this.formAHSR.getForm().findField('AHSR_CURRENCY');
curr.setValue(records[0].data.CURR);
var curr = this.formFINANCIAL.getForm().findField('FINANCIAL_CURRENCY');
curr.setValue(records[0].data.CURR);
var curr = this.formADVANCE.getForm().findField('ADVANCE_CURRENCY');
curr.setValue(records[0].data.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', {
fieldLabel: '结算方式',
store: this.StoreStlMode,
forceSelection: true,
name: 'SETTLETYPE',
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', {
fieldLabel: '银行账号',
store: this.StoreBANK,
forceSelection: true,
name: 'ACCOUNT',
valueField: 'GID',
displayField: 'BANKNAME'
});
//编辑form
this.formEdit = Ext.widget('form', {
region: 'center',
frame: true,
bodyPadding: 3,
trackResetOnLoad: true,
// autoScroll: true,
fieldDefaults: {
margins: '2 2 2 2',
labelAlign: 'right',
flex: 1,
labelWidth: 90,
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: 'BILLDATE',
name: 'BILLDATE', flex: 0, hidden: true, margins: '0'
}, {
fieldLabel: 'COMPANYID',
name: 'COMPANYID', flex: 0, hidden: true, margins: '0'
}, {
fieldLabel: 'SETTLEMODE',
name: 'SETTLEMODE', flex: 0, hidden: true, margins: '0'
}, {
fieldLabel: 'BILLTYPE',
name: 'BILLTYPE', flex: 0, hidden: true, margins: '0'
}, {
fieldLabel: 'ISEXPORT',
name: 'ISEXPORT', flex: 0, hidden: true, margins: '0'
}, {
fieldLabel: 'CREATEUSER',
name: 'CREATEUSER', flex: 0, hidden: true, margins: '0'
},
{
fieldLabel: '结算单号',
readOnly: true,
name: 'BILLNO'
}, {
fieldLabel: '状态',
readOnly: true,
name: 'BILLSTATUSREF'
}, this.comboxCustCode, {
fieldLabel: '结算日期',
format: 'Y-m-d',
xtype: 'datefield',
name: 'SETTLETIME'
}, this.comboxSETTLEUSER
]
}, {
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [this.comboxCurr, {
fieldLabel: '实收金额',
name: 'AHSR_MONEY',
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;
}
}, {
fieldLabel: '核销金额',
readOnly: true,
name: 'AMOUNT',
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.comboxStlMode, this.comboxBANK]
}, {
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [{
fieldLabel: '录入人',
readOnly: true,
flex: 1,
name: 'CREATEUSERREF'
}, {
fieldLabel: '录入日期',
readOnly: true,
format: 'Y-m-d',
flex: 1,
xtype: 'datefield',
name: 'CREATETIME'
}, {
fieldLabel: '备注',
flex: 3,
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: 'btnAudit',
text: '审核通过',
tooltip: '审核通过',
handler: function (button, event) {
this.onAuditClick();
},
scope: this
}, '-', {
id: 'btnAuditBack',
text: '撤销审核',
tooltip: '撤销审核',
handler: function (button, event) {
this.onAuditBackClick();
},
scope: this
}
]
}); //end 按钮Toolbar
//#endregion
//#region 明细表
//明细表表格相关
this.GridCheckBoxModel = Ext.create('Ext.selection.CheckboxModel');
//明细表-数据集
this.storeBodyList = Ext.create('Ext.data.Store', {
model: 'Chfee_do_detail',
remoteSort: true,
proxy: {
type: 'ajax',
url: '/Account/Chfee_settlement/GetBillList',
reader: {
id: 'BSNO,FEEDOID',
root: 'data',
totalProperty: 'totalCount'
}
}
});
//明细表表格
this.gridListCellEditing = Ext.create('Ext.grid.plugin.CellEditing', {
clicksToEdit: 1
});
this.gridList = new Ext.grid.GridPanel({
store: this.storeBodyList,
enableHdMenu: false,
region: 'center',
loadMask: { msg: "数据加载中,请稍等..." },
trackMouseOver: true,
disableSelection: false,
selModel: this.GridCheckBoxModel,
columns: [{
sortable: true,
dataIndex: 'BILLNO',
header: 'BILL',
hidden: true,
width: 100
}, {
sortable: true,
dataIndex: 'BSNO',
header: 'BSNO',
hidden: true,
width: 100
}, {
sortable: true,
dataIndex: 'FEEDOID',
header: 'FEEDOID',
hidden: true,
width: 100
}, {
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: '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: '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
}
]
});
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 = this;
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.paneldetail = new Ext.Panel({
// title: '结算明细',
layout: "border",
region: "center",
split: true,
items: [
this.panelService, this.panelSum
]
});
//#endregion 明细表
//#region 预收预付
this.formACCOUNTS = Ext.widget('form', {
anchor: '20% 100%',
columnWidth: .20,
frame: true,
trackResetOnLoad: true,
bodyPadding: 5,
title: "记账资料",
fieldDefaults: {
margins: '2 2 2 2',
labelAlign: 'right',
flex: 1,
labelWidth: 40,
msgTarget: 'qtip'
},
items: [
{//fieldset 1
xtype: 'fieldset',
defaultType: 'textfield',
layout: 'anchor',
defaults: {
anchor: '100%'
},
items: [{
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [{
fieldLabel: '币别',
labelWidth: 40,
readOnly: true,
name: 'ACCOUNTS_CURRENCY'
}
]//end items(fieldset 1)
}, {
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [{
fieldLabel: '汇率',
labelWidth: 40,
name: 'ACCOUNTS_RATE'
}
]//end items(fieldset 1)
}, {
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [{
fieldLabel: '金额',
labelWidth: 40,
name: 'ACCOUNTS_MONEY',
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;
},
listeners: {
scope: this,
'blur': function (textfield, eOpts) {
if (textfield.value == textfield.originalValue) return;
var curr = this.formPREPAY.getForm().findField('PREPAY_MONEY');
var allamount = textfield.value;
var amount = this.formEdit.getForm().findField('AMOUNT').getValue();
var aftamount = parseFloat(allamount) - parseFloat(amount);
curr.setValue(aftamount);
this.formACCOUNTS.getForm().findField('ACCOUNTS_MONEY').setValue(amount);
var financialamount = this.formFINANCIAL.getForm().findField('FINANCIAL_MONEY').getValue();
var advanceamount = this.formADVANCE.getForm().findField('ADVANCE_MONEY').getValue();
amount = parseFloat(allamount).add(parseFloat(-advanceamount));
amount = parseFloat(amount).add(parseFloat(-financialamount));
this.formAHSR.getForm().findField('AHSR_MONEY').setValue(amount);
}
}
}
]//end items(fieldset 1)
}//end fieldset 1
]//end root items
}]
});
this.comboxCurrPREPAY = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: '币别',
store: this.StoreCurr,
forceSelection: true,
name: 'PREPAY_CURRENCY',
valueField: 'CURR',
displayField: 'CURR'
});
this.formPREPAY = Ext.widget('form', {
anchor: '20% 100%',
columnWidth: .20,
frame: true,
trackResetOnLoad: true,
bodyPadding: 5,
title: "+预收支资料",
fieldDefaults: {
margins: '2 2 2 2',
labelAlign: 'right',
flex: 1,
labelWidth: 40,
msgTarget: 'qtip'
},
items: [
{//fieldset 1
xtype: 'fieldset',
defaultType: 'textfield',
layout: 'anchor',
defaults: {
anchor: '100%'
},
items: [{
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [this.comboxCurrPREPAY
]//end items(fieldset 1)
}, {
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [{
fieldLabel: '汇率',
labelWidth: 40,
name: 'PREPAY_RATE'
}
]//end items(fieldset 1)
}, {
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [{
fieldLabel: '金额',
labelWidth: 40,
name: 'PREPAY_MONEY',
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;
}
}, {
xtype: 'button',
width: 115,
text: "查看核销明细",
iconCls: "btnrefresh",
handler: function (button, event) {
if (_this.paneldetailacc2.isVisible())
_this.paneldetailacc2.hide();
else {
_this.paneldetailacc2.show();
var billno = _this.formEdit.getForm().findField('BILLNO').getValue();
_this.storeBodyListAcc2.load({ params: { condition: " BILLNO='" + billno + "'"} });
}
},
scope: this
}
]//end items(fieldset 1)
}//end fieldset 1
]//end root items
}]
});
this.comboxCurrAHSR = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: '币别',
store: this.StoreCurr,
forceSelection: true,
readOnly: true,
name: 'AHSR_CURRENCY',
valueField: 'CURR',
displayField: 'CURR'
});
this.formAHSR = Ext.widget('form', {
anchor: '20% 100%',
columnWidth: .20,
frame: true,
trackResetOnLoad: true,
bodyPadding: 5,
title: "=实收支资料",
fieldDefaults: {
margins: '2 2 2 2',
labelAlign: 'right',
flex: 1,
labelWidth: 40,
msgTarget: 'qtip'
},
items: [
{//fieldset 1
xtype: 'fieldset',
defaultType: 'textfield',
layout: 'anchor',
defaults: {
anchor: '100%'
},
items: [{
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [this.comboxCurrAHSR
]//end items(fieldset 1)
}, {
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [{
fieldLabel: '汇率',
readOnly: true,
name: 'AHSR_RATE'
}
]//end items(fieldset 1)
}, {
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [{
fieldLabel: '金额',
readOnly: true,
name: 'AHSR_MONEY',
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;
}
}
]//end items(fieldset 1)
}//end fieldset 1
]//end root items
}]
});
this.comboxCurrFINANCIAL = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: '币别',
store: this.StoreCurr,
forceSelection: true,
name: 'FINANCIAL_CURRENCY',
valueField: 'CURR',
displayField: 'CURR'
});
this.formFINANCIAL = Ext.widget('form', {
anchor: '20% 100%',
columnWidth: .20,
frame: true,
trackResetOnLoad: true,
bodyPadding: 5,
title: "+财务费用",
fieldDefaults: {
margins: '2 2 2 2',
labelAlign: 'right',
flex: 1,
labelWidth: 40,
msgTarget: 'qtip'
},
items: [
{//fieldset 1
xtype: 'fieldset',
defaultType: 'textfield',
layout: 'anchor',
defaults: {
anchor: '100%'
},
items: [{
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [this.comboxCurrFINANCIAL]
}, {
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [{
fieldLabel: '汇率',
readOnly: true,
name: 'FINANCIAL_RATE'
}
]//end items(fieldset 1)
}, {
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [{
fieldLabel: '金额',
name: 'FINANCIAL_MONEY',
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;
},
listeners: {
scope: this,
'blur': function (textfield, eOpts) {
if (textfield.value == textfield.originalValue) return;
var curr = this.formAHSR.getForm().findField('AHSR_MONEY');
var accamount = this.formACCOUNTS.getForm().findField('ACCOUNTS_MONEY').getValue();
var prepamount = this.formPREPAY.getForm().findField('PREPAY_MONEY').getValue();
var advanceamount = this.formADVANCE.getForm().findField('ADVANCE_MONEY').getValue();
var amount = parseFloat(accamount).add(parseFloat(prepamount));
amount = parseFloat(amount).add(parseFloat(-advanceamount));
amount = parseFloat(amount).add(parseFloat(-textfield.value));
curr.setValue(amount);
}
}
}
]//end items(fieldset 1)
}//end fieldset 1
]//end root items
}]
});
this.comboxCurrADVANCE = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: '币别',
store: this.StoreCurr,
forceSelection: true,
name: 'ADVANCE_CURRENCY',
valueField: 'CURR',
displayField: 'CURR'
});
_this = this;
this.formADVANCE = Ext.widget('form', {
anchor: '20% 100%',
columnWidth: .20,
frame: true,
trackResetOnLoad: true,
bodyPadding: 5,
title: "+预收支取用资料",
fieldDefaults: {
margins: '2 2 2 2',
labelAlign: 'right',
flex: 1,
labelWidth: 40,
msgTarget: 'qtip'
},
items: [
{//fieldset 1
xtype: 'fieldset',
defaultType: 'textfield',
layout: 'anchor',
defaults: {
anchor: '100%'
},
items: [{
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [this.comboxCurrADVANCE
]//end items(fieldset 1)
}, {
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [{
fieldLabel: '汇率',
name: 'ADVANCE_RATE'
}
]//end items(fieldset 1)
}, {
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [{
fieldLabel: '金额',
readOnly: true,
name: 'ADVANCE_MONEY',
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;
}
}, {
xtype: 'button',
width: 90,
text: "取用/撤销",
iconCls: "btnrefresh",
handler: function (button, event) {
if (_this.panelaccdetail.isVisible())
_this.panelaccdetail.hide();
else {
_this.panelaccdetail.show();
var custome = _this.formEdit.getForm().findField('CUSTOMERNAME').getValue();
var billno = _this.formEdit.getForm().findField('BILLNO').getValue();
var curr = _this.formADVANCE.getForm().findField('ADVANCE_CURRENCY').getValue();
var sql = "CUSTOMERNAME='" + custome + "' and (ISFINISH=0 or ISFINISH IS NULL) AND FEETYPE=1 AND currency='" + curr + "' AND BILLNO<>'" + billno + "'";
_this.storeAccBodyList.load({ params: { start: 0, limit: _this.PageSize, sort: '', condition: sql} });
_this.storeBodyListAcc.load({ params: { condition: " SETTLEBILLNO='" + billno + "'" },
callback: function (r, options, success) {
if (success) {
if (_this.storeBodyListAcc.getCount() > 0) (this.comboxCurrADVANCE.readOnly = true)
}
},
scope: this
});
}
},
scope: this
}
]//end items(fieldset 1)
}//end fieldset 1
]//end root items
}]
});
//#endregion
this.panelAcc = new Ext.Panel({
layout: "column",
region: "north",
height: 140,
items: [this.formACCOUNTS, this.formPREPAY, this.formAHSR, this.formFINANCIAL, this.formADVANCE]
});
//#region 预收取用
this.storePaymentList = Ext.create('Ext.data.Store', {
model: 'CWAdvancePaymentmb',
remoteSort: true,
proxy: {
type: 'ajax',
url: '/Account/Chfee_settlement/GetAdvancePayment',
reader: {
id: 'BILLNO',
root: 'data',
totalProperty: 'totalCount'
}
}
});
this.GridAccCheckBoxModel = Ext.create('Ext.selection.CheckboxModel');
//明细表-数据集
this.storeAccBodyList = Ext.create('Ext.data.Store', {
model: 'CWAdvancePaymentmb',
remoteSort: true,
proxy: {
type: 'ajax',
url: '/Account/Chfee_settlement/GetAdvancePayment',
reader: {
id: 'BILLNO',
root: 'data',
totalProperty: 'totalCount'
}
}
});
//明细表表格
this.gridListAccCellEditing = Ext.create('Ext.grid.plugin.CellEditing', {
clicksToEdit: 1
});
this.gridListAcc = new Ext.grid.GridPanel({
store: this.storeAccBodyList,
enableHdMenu: false,
region: 'center',
loadMask: { msg: "数据加载中,请稍等..." },
trackMouseOver: true,
disableSelection: false,
plugins: [this.gridListAccCellEditing],
selModel: this.GridAccCheckBoxModel,
tbar: [{
text: '添加取用明细',
tooltip: '添加取用明细',
iconCls: "btnadddetail",
handler: function (button, event) {
this.onAddAPDetailClick(button, event);
},
scope: this
}],
columns: [{
sortable: true,
dataIndex: 'GID',
header: 'GID',
width: 80, hidden: true
},
{
sortable: true,
dataIndex: 'LINKGID',
header: 'LINKGID',
width: 80, hidden: true
},
{
sortable: true,
dataIndex: 'BILLNO',
header: '结算单号',
width: 120
},
{
sortable: true,
dataIndex: 'CUSTOMERNAME',
header: '结算对象',
width: 100
},
{
sortable: true,
dataIndex: 'CURRENCY',
header: '币别',
width: 60
},
{
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: 'DOAMOUNT',
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: 'REMAIN',
header: '本次核销',
editor: {
xtype: 'numberfield',
keyNavEnabled: false,
allowDecimals: true,
decimalPrecision: 2,
selectOnFocus: true,
mouseWheelEnabled: false,
enableKeyEvents: true
},
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: 80
},
{
sortable: true,
dataIndex: 'CREATEUSERREF',
header: '录入人',
width: 80
},
{
sortable: true,
dataIndex: 'CREATETIME',
header: '录入时间',
width: 80
},
{
sortable: true,
dataIndex: 'REMARK',
header: '备注',
width: 120
}
]
});
this.storeBodyListAcc = Ext.create('Ext.data.Store', {
model: 'CWAdvancePaymentBodymb',
remoteSort: true,
proxy: {
type: 'ajax',
url: '/Account/Chfee_settlement/GetAPBodyList',
reader: {
id: 'GID',
root: 'data',
totalProperty: 'totalCount'
}
}
});
this.GridBodyAccCheckBoxModel = Ext.create('Ext.selection.CheckboxModel');
this.gridBodyListAcc = new Ext.grid.GridPanel({
store: this.storeBodyListAcc,
enableHdMenu: false,
region: 'center',
//height: 600,
loadMask: { msg: "数据加载中,请稍等..." },
trackMouseOver: true,
disableSelection: false,
selModel: this.GridBodyAccCheckBoxModel,
viewConfig: {
autoFill: true,
enableTextSelection: true
},
tbar: [{
text: '删除取用明细',
tooltip: '删除取用明细',
iconCls: "btnadddetail",
handler: function (button, event) {
this.onDeleteApClick(button, event);
},
scope: this
}],
columns: [
{
sortable: true,
dataIndex: 'GID',
header: 'GID', hidden: true,
width: 80
},
{
sortable: true,
dataIndex: 'LINKGID',
header: 'LINKGID', hidden: true,
width: 80
},
{
sortable: true,
dataIndex: 'BILLNO',
header: '结算单号',
width: 120
},
{
sortable: true,
dataIndex: 'SETTLELINKGID',
header: 'SETTLELINKGID', hidden: true,
width: 80
},
{
sortable: true,
dataIndex: 'SETTLEBILLNO',
header: '核销使用单号',
width: 120
},
{
sortable: true,
dataIndex: 'FEETYPEREF',
header: '收付',
width: 80
},
{
sortable: true,
dataIndex: 'CUSTOMERNAME',
header: '结算对象', hidden: true,
width: 80
},
{
sortable: true,
dataIndex: 'CURRENCY',
header: '币别',
width: 80
},
{
sortable: true,
dataIndex: 'DOAMOUNT',
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: 'SETTLEUSERREF',
header: '核销人',
width: 80
},
{
sortable: true,
dataIndex: 'SETTLETIME',
header: '核销时间',
width: 80
},
{
sortable: true,
dataIndex: 'REMARK',
header: '备注',
width: 80
},
{
sortable: true,
dataIndex: 'VOUCHERNO',
header: '凭证号',
width: 80
}
]
});
this.storeBodyListAcc2 = Ext.create('Ext.data.Store', {
model: 'CWAdvancePaymentBodymb',
remoteSort: true,
proxy: {
type: 'ajax',
url: '/Account/Chfee_settlement/GetAPBodyList',
reader: {
id: 'GID',
root: 'data',
totalProperty: 'totalCount'
}
}
});
this.gridBodyListAcc2 = new Ext.grid.GridPanel({
store: this.storeBodyListAcc2,
enableHdMenu: false,
region: 'center',
//height: 600,
loadMask: { msg: "数据加载中,请稍等..." },
trackMouseOver: true,
disableSelection: false,
selType: 'cellmodel',
viewConfig: {
autoFill: true,
enableTextSelection: true
},
columns: [
{
sortable: true,
dataIndex: 'GID',
header: 'GID', hidden: true,
width: 80
},
{
sortable: true,
dataIndex: 'LINKGID',
header: 'LINKGID', hidden: true,
width: 80
},
{
sortable: true,
dataIndex: 'BILLNO',
header: '结算单号',
width: 80
},
{
sortable: true,
dataIndex: 'SETTLELINKGID',
header: 'SETTLELINKGID', hidden: true,
width: 80
},
{
sortable: true,
dataIndex: 'SETTLEBILLNO',
header: '核销使用单号',
width: 80
},
{
sortable: true,
dataIndex: 'CUSTOMERNAME',
header: '结算对象', hidden: true,
width: 80
},
{
sortable: true,
dataIndex: 'CURRENCY',
header: '币别',
width: 80
},
{
sortable: true,
dataIndex: 'DOAMOUNT',
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: 'SETTLEUSER',
header: '核销人',
width: 80
},
{
sortable: true,
dataIndex: 'SETTLETIME',
header: '核销时间',
width: 80
},
{
sortable: true,
dataIndex: 'REMARK',
header: '备注',
width: 80
},
{
sortable: true,
dataIndex: 'VOUCHERNO',
header: '凭证号',
width: 80
}
]
});
this.paneldetailacc = new Ext.Panel({
// title: '结算明细',
layout: "border",
height: 160,
region: "north",
split: true,
items: [
this.gridBodyListAcc
]
});
this.panelAddacc = new Ext.Panel({
layout: "border",
height: 160,
region: "north",
margin: '2 2',
items: [this.gridListAcc]
});
this.paneldetailacc2 = new Ext.Panel({
title: '核销明细',
layout: "border",
height: 160,
region: "north",
hidden: true,
items: [
this.gridBodyListAcc2
]
});
this.panelaccdetail = new Ext.Panel({
title: '取用或撤销预收明细',
layout: "border",
hidden: true,
height: 360,
region: "north",
split: true,
items: [
this.paneldetailacc, this.panelAddacc
]
});
//#endregion
//#region 布局
//控件布局
this.panelTop = new Ext.Panel({
layout: "border",
region: "north",
height: 130,
items: [this.panelBtn, this.formEdit]
});
this.panelBody = new Ext.Panel({
title: "结算明细",
layout: "border",
region: "center",
items: [this.paneldetail]
});
this.panelAccAll = new Ext.Panel({
title: "预收预付信息",
layout: "border",
region: "north",
height: 450,
items: [this.panelAcc, this.panelaccdetail, this.paneldetailacc2]
});
this.tabpanel = new Ext.TabPanel
({
activeTab: 0,
autoWidth: true,
border: false,
frame: false,
region: 'center',
id: "TabPanelID",
enableTabScroll: true,
items:
[
this.panelBody,
this.panelAccAll
]
});
Ext.apply(this, {
items: [this.panelTop, this.tabpanel]
});
//#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) {
var sql = " BILLNO='" + 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);
}, //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.opStatus == 'edit')
condition = " 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_recvprocess/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;
if (data.CURR == "") {
data.CURR="RMB";
}
_this.formEdit.getForm().findField('BILLSTATUS').setDisabled(false);
_this.formEdit.getForm().reset();
_this.formACCOUNTS.getForm().reset();
_this.formPREPAY.getForm().reset();
_this.formAHSR.getForm().reset();
_this.formFINANCIAL.getForm().reset();
_this.formADVANCE.getForm().reset();
_this.formEdit.getForm().setValues(data);
_this.formACCOUNTS.getForm().setValues(data);
_this.formPREPAY.getForm().setValues(data);
_this.formAHSR.getForm().setValues(data);
_this.formFINANCIAL.getForm().setValues(data);
_this.formADVANCE.getForm().setValues(data);
_this.formEdit.getForm().findField('BILLSTATUS').setDisabled(true);
_this.GetEditStatus();
} 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: { condition: " BILLNO='" + billno + "'"} });
this.storeBodySum.load({ params: { condition: " BILLNO='" + billno + "'"} });
this.storePaymentList.load({ params: { start: 0, limit: this.PageSize, sort: '', condition: "BILLNO='" + billno + "'" },
callback: function (r, options, success) {
if (success) {
if (this.storePaymentList.getCount() > 0) {
var member = this.storePaymentList.getAt(0);
if (member.data.ISVOU) {
this.formACCOUNTS.getForm().findField('ACCOUNTS_MONEY').readOnly = true;
this.formPREPAY.getForm().findField('PREPAY_MONEY').readOnly = true;
}
}
}
},
scope: this
});
// this.storeFeeList.load({ params: { condition: " DUINO='" + billno + "'"} });
}, // end LoadDate
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);
this.formEdit.getForm().findField('SETTLEMODE').setDisabled(false);
this.formEdit.getForm().findField('BILLTYPE').setDisabled(false);
var field = this.formEdit.getForm().findField('SETTLEMODE');
field.setValue(5);
var field = this.formEdit.getForm().findField('BILLTYPE');
field.setValue(1);
var data = basicForm.getValues();
var accountsdata = this.formACCOUNTS.getForm().getValues();
var prepaydata = this.formPREPAY.getForm().getValues();
var prepaychange = this.formPREPAY.getForm().findField('PREPAY_MONEY').isDirty();
var ahsrdata = this.formAHSR.getForm().getValues();
var financialdata = this.formFINANCIAL.getForm().getValues();
var advancedata = this.formADVANCE.getForm().getValues();
this.formEdit.getForm().findField('BILLSTATUS').setDisabled(true);
this.formEdit.getForm().findField('COMPANYID').setDisabled(true);
this.formEdit.getForm().findField('SETTLEMODE').setDisabled(true);
this.formEdit.getForm().findField('BILLTYPE').setDisabled(true);
Ext.Msg.wait('正在保存数据, 请稍侯..');
Ext.Ajax.request({
waitMsg: '正在保存数据...',
url: '/Account/Chfee_recvprocess/Save',
scope: this,
params: {
opstatus: this.opStatus,
data: Ext.JSON.encode(data),
accountsdata: Ext.JSON.encode(accountsdata),
prepaydata: Ext.JSON.encode(prepaydata),
ahsrdata: Ext.JSON.encode(ahsrdata),
financialdata: Ext.JSON.encode(financialdata),
advancedata: Ext.JSON.encode(advancedata),
billtype: 1,
prepaychange: prepaychange
},
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('MsChSettlement', 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();
}
if (type == '0') {
this.opStatus = 'edit';
} else if (type == '1') {
window.close();
} else {
this.LoadData('add', '');
}
} 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
});
}
}
});
}, //end save
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
onDeleteClick: function (button, event) {
this.deleteBill();
}, //end onAddDetailClick
//#region 预收付操作
onAddAPDetailClick: function (button, event) {
var gid = this.formEdit.getForm().findField('GID').getValue();
var billno = this.formEdit.getForm().findField('BILLNO').getValue();
var billstatus = this.formEdit.getForm().findField('BILLSTATUS').getValue();
if (billstatus != 2) {
Ext.Msg.show({ title: '提示', msg: '当前状态无法添加收费结算明细!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
return;
}
_this = this;
var basicForm = this.formEdit.getForm();
var basicForm1 = this.formACCOUNTS.getForm();
var basicForm2 = this.formPREPAY.getForm();
var basicForm3 = this.formAHSR.getForm();
var basicForm4 = this.formFINANCIAL.getForm();
var basicForm5 = this.formADVANCE.getForm();
if (basicForm.isDirty() || basicForm1.isDirty()
|| basicForm2.isDirty() || basicForm3.isDirty() || basicForm4.isDirty() || basicForm5.isDirty()) {
Ext.Msg.show({ title: '提示', msg: '请先保存收费结算单,然后才能添加明细!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
return;
};
var selectedRecords = this.gridListAcc.selModel.getSelection();
var bodyAddDatas = [];
_this = this;
for (var i = 0; i < selectedRecords.length; i++) {
var rec = selectedRecords[i];
bodyAddDatas.push(rec);
}
if (bodyAddDatas.length == 0) {
Ext.Msg.show({ title: '提示', msg: '没有要添加的费用明细!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
return;
};
var jsonbodyAddDatas = ConvertRecordsToJsonAll(bodyAddDatas);
_this = this;
Ext.Msg.wait('正在保存数据, 请稍侯..');
Ext.Ajax.request({
waitMsg: '正在保存数据...',
url: '/Account/Chfee_settlement/AddAPDetail',
scope: this,
params: {
billno: billno,
data: jsonbodyAddDatas,
stlnogid: gid,
feetype: 1
},
callback: function (options, success, response) {
if (success) {
Ext.MessageBox.hide();
var jsonresult = Ext.JSON.decode(response.responseText);
if (jsonresult.Success) {
var custome = _this.formEdit.getForm().findField('CUSTOMERNAME').getValue();
var billno = _this.formEdit.getForm().findField('BILLNO').getValue();
var curr = _this.formADVANCE.getForm().findField('ADVANCE_CURRENCY').getValue();
var sql = "CUSTOMERNAME='" + custome + "' and (ISFINISH=0 or ISFINISH IS NULL) AND FEETYPE=1 AND currency='" + curr + "' AND BILLNO<>'" + billno + "'";
_this.storeAccBodyList.load({ params: { start: 0, limit: _this.PageSize, sort: '', condition: sql} });
// _this.storePaymentList.load({ params: { start: 0, limit: _this.PageSize, sort: '', condition: "BILLNO='" + billno + "'"} });
_this.storeBodyListAcc.load({ params: { condition: " SETTLEBILLNO='" + billno + "'" },
callback: function (r, options, success) {
if (success) {
if (_this.storeBodyListAcc.getCount() > 0) (this.comboxCurrADVANCE.readOnly = true)
}
},
scope: this
});
Ext.Ajax.request({
waitMsg: '正在查询主表数据...',
url: '/Account/Chfee_settlement/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.formAHSR.getForm().reset();
_this.formADVANCE.getForm().reset();
_this.formAHSR.getForm().setValues(data);
_this.formADVANCE.getForm().setValues(data);
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();
} else {
Ext.MessageBox.alert('请求出现错误,请重试', response.responseText);
}
},
scope: this
});
} 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
});
}
}
});
},
onDeleteApClick: function (button, event) {
var billno = this.formEdit.getForm().findField('BILLNO').getValue();
var billstatus = this.formEdit.getForm().findField('BILLSTATUS').getValue();
if (billstatus != 2) {
Ext.Msg.show({ title: '提示', msg: '当前状态无法删除明细!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
return;
}
var selectedRecords = this.gridBodyListAcc.selModel.getSelection();
var bodyAddDatas = [];
_this = this;
for (var i = 0; i < selectedRecords.length; i++) {
var rec = selectedRecords[i];
var voucherno = rec.data.VOUCHERNO;
if (voucherno == '') {
bodyAddDatas.push(rec);
} else {
Ext.Msg.show({ title: '提示', msg: '已生成凭证不能删除!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
}
}
if (bodyAddDatas.length == 0) {
Ext.Msg.show({ title: '提示', msg: '没有要删除明细!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
return;
};
var jsonbodyAddDatas = ConvertRecordsToJsonAll(bodyAddDatas);
_this = this;
Ext.Msg.wait('正在保存数据, 请稍侯..');
Ext.Ajax.request({
waitMsg: '正在保存数据...',
url: '/Account/Chfee_settlement/DelAPBill',
scope: this,
params: {
data: jsonbodyAddDatas
},
callback: function (options, success, response) {
if (success) {
Ext.MessageBox.hide();
var jsonresult = Ext.JSON.decode(response.responseText);
if (jsonresult.Success) {
var custome = _this.formEdit.getForm().findField('CUSTOMERNAME').getValue();
var billno = _this.formEdit.getForm().findField('BILLNO').getValue();
var curr = _this.formADVANCE.getForm().findField('ADVANCE_CURRENCY').getValue();
var sql = "CUSTOMERNAME='" + custome + "' and (ISFINISH=0 or ISFINISH IS NULL) AND FEETYPE=1 AND currency='" + curr + "' AND BILLNO<>'" + billno + "'";
_this.storeAccBodyList.load({ params: { start: 0, limit: _this.PageSize, sort: '', condition: sql} });
// _this.storePaymentList.load({ params: { start: 0, limit: _this.PageSize, sort: '', condition: "BILLNO='" + billno + "'"} });
_this.storeBodyListAcc.load({ params: { condition: " SETTLEBILLNO='" + billno + "'" },
callback: function (r, options, success) {
if (success) {
if (_this.storeBodyListAcc.getCount() > 0) (this.comboxCurrADVANCE.readOnly = true)
}
},
scope: this
});
Ext.Ajax.request({
waitMsg: '正在查询主表数据...',
url: '/Account/Chfee_settlement/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.formAHSR.getForm().reset();
_this.formADVANCE.getForm().reset();
_this.formAHSR.getForm().setValues(data);
_this.formADVANCE.getForm().setValues(data);
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();
} else {
Ext.MessageBox.alert('请求出现错误,请重试', response.responseText);
}
},
scope: this
});
} 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
});
}
}
});
},
//#endregion
onSubmitAuditClick: function () {
var Duino = this.formEdit.getForm().findField('BILLNO').getValue();
var billstatus = this.formEdit.getForm().findField('BILLSTATUS').getValue();
var SETTLEUSER = this.formEdit.getForm().findField('SETTLEUSER').getValue();
// var btnESave = Ext.getCmp('btnESave');
// isDisabled()
if (Duino == '*') {
Ext.Msg.show({ title: '提示', msg: '请先保存收费登记,然后才能提交!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
return;
};
//if (SETTLEUSER == '' || SETTLEUSER == NaN || SETTLEUSER==null) {
// Ext.Msg.show({ title: '提示', msg: '请先录入核销人保存后,才能提交!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
// return;
//};
if ((billstatus != 7)) {
Ext.Msg.show({ title: '提示', msg: '当前状态无法提交!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
return;
}
_this = this;
Ext.Ajax.request({
waitMsg: '正在添加数据...',
url: '/Account/Chfee_recvprocess/UpdateStatus',
params: {
bill: Duino,
status: 'submit'
},
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 {
Ext.Ajax.request({
waitMsg: '正在查询主表数据...',
url: '/Account/Chfee_recvprocess/GetData',
params: {
handle: 'edit',
condition: " BILLNO='" + 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;
}
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
});
}
} 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 != 8) {
Ext.Msg.show({ title: '提示', msg: '当前状态无法撤销提交!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
return;
}
_this = this;
Ext.Ajax.request({
waitMsg: '正在添加数据...',
url: '/Account/Chfee_recvprocess/UpdateStatus',
params: {
bill: Duino,
status: 'cancelsubmit'
},
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 {
Ext.Ajax.request({
waitMsg: '正在查询主表数据...',
url: '/Account/Chfee_recvprocess/GetData',
params: {
handle: 'edit',
condition: " BILLNO='" + 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;
}
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
});
}
} else {
Ext.MessageBox.alert('请求出现错误,请重试', response.responseText);
}
},
scope: this
});
},
onAuditClick: function () {
var Duino = this.formEdit.getForm().findField('BILLNO').getValue();
var billstatus = this.formEdit.getForm().findField('BILLSTATUS').getValue();
if ((billstatus != 10)) {
Ext.Msg.show({ title: '提示', msg: '当前状态无法审核!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
return;
}
_this = this;
Ext.Ajax.request({
waitMsg: '正在添加数据...',
url: '/Account/Chfee_recvprocess/UpdateStatus',
params: {
bill: Duino,
status: 'Audit'
},
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 {
Ext.Ajax.request({
waitMsg: '正在查询主表数据...',
url: '/Account/Chfee_recvprocess/GetData',
params: {
handle: 'edit',
condition: " BILLNO='" + 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;
}
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
});
}
} else {
Ext.MessageBox.alert('请求出现错误,请重试', response.responseText);
}
},
scope: this
});
},
onAuditBackClick: function () {
var Duino = this.formEdit.getForm().findField('BILLNO').getValue();
var billstatus = this.formEdit.getForm().findField('BILLSTATUS').getValue();
if (billstatus != 1) {
Ext.Msg.show({ title: '提示', msg: '当前状态无法撤销审核!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
return;
}
_this = this;
Ext.Ajax.request({
waitMsg: '正在添加数据...',
url: '/Account/Chfee_recvprocess/UpdateStatus',
params: {
bill: Duino,
status: 'CancelAudit'
},
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 {
Ext.Ajax.request({
waitMsg: '正在查询主表数据...',
url: '/Account/Chfee_recvprocess/GetData',
params: {
handle: 'edit',
condition: " BILLNO='" + 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;
}
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
});
}
} else {
Ext.MessageBox.alert('请求出现错误,请重试', response.responseText);
}
},
scope: this
});
},
// #region 根据权限和状态判断是否允许修改
GetEditStatus: function () {
var canedit = false;
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);
var btnESubmitAuditBack = Ext.getCmp('btnSubmitAuditBack');
var btnEAuditBack = Ext.getCmp('btnAuditBack');
var btnEAudit = Ext.getCmp('btnAudit');
_this = this;
btnEAudit.disable();
btnEAuditBack.disable();
btnESubmitAuditBack.disable();
this.StoreOpRange.load({ params: { optype: "modRecvProcess" },
callback: function (r, options, success) {
if (success) {
if (r.length != 0) {
var records = DsStoreQueryBy(_this.StoreOpRange, 'OPID', op);
if (records.getCount() > 0) {
if (bsStatus == 7) canedit = true;
if (bsStatus == 10) btnEAudit.enable();
if (bsStatus == 1) btnEAuditBack.enable();
if (bsStatus == 8) btnESubmitAuditBack.enable();
} else {
canedit = false;
}
_this.setSaveBtnStatus(canedit);
}
}
}
});
},
setSaveBtnStatus: function (enable) {
var btnESave = Ext.getCmp('btnESave');
var btnESaveAndClose = Ext.getCmp('btnESaveAndClose');
var btnESaveAndNew = Ext.getCmp('btnESaveAndNew');
var btnESubmitAudit = Ext.getCmp('btnSubmitAudit');
if (enable) {
btnESave.enable();
btnESaveAndClose.enable();
btnESaveAndNew.enable();
btnESubmitAudit.enable();
} else {
btnESave.disable();
btnESaveAndClose.disable();
btnESaveAndNew.disable();
btnESubmitAudit.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 printType = 'MSCHFEERECVPROCESS';
var sql1 = "SELECT s.*,(select ShowName from [user] where GID=s.SETTLEUSER) as SETTLEUSERREF FROM ch_fee_settlement s WHERE 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";
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 b.VESSEL,b.VOYNO,b.MBLNO";
var sql3 = "";
var sql4 = "";
var sql5 = "";
var sql6 = "";
PrintComm(printType, sql1, sql2, sql3, sql4, sql5, sql6);
}
});