|
|
Ext.namespace('Shipping');
|
|
|
|
|
|
Shipping.MsChBalApplicationEdit = function (config) {
|
|
|
Ext.applyIf(this, config);
|
|
|
this.initUIComponents();
|
|
|
window.Shipping.MsChBalApplicationEdit.superclass.constructor.call(this);
|
|
|
};
|
|
|
|
|
|
Ext.extend(Shipping.MsChBalApplicationEdit, Ext.Panel, {
|
|
|
|
|
|
ParentWin: null,
|
|
|
OpStatus: 'add',
|
|
|
StoreList: null,
|
|
|
EditRecord: null,
|
|
|
addstore: false,
|
|
|
PageSize: 30,
|
|
|
sqlcontext: '',
|
|
|
|
|
|
|
|
|
initUIComponents: function () {
|
|
|
this.serialNo = 0;
|
|
|
this.workSerialNo = 0;
|
|
|
this.bodyDel = [];
|
|
|
this.FeeSql = '';
|
|
|
this.BillSql = '';
|
|
|
this.DuiBillSql = '';
|
|
|
this.IsDebit = '0';
|
|
|
|
|
|
|
|
|
this.formname = "MsChBalApplicationEdit"; //页面名称
|
|
|
|
|
|
|
|
|
|
|
|
//#region 编辑form
|
|
|
|
|
|
//枚举参照相关(编辑form)
|
|
|
|
|
|
|
|
|
//表参照相关(编辑form)
|
|
|
|
|
|
this.bsno = getUrlParam('bsno');
|
|
|
|
|
|
|
|
|
this.storeCustCode = Ext.create('DsExt.ux.RefTableStore', {
|
|
|
model: 'DsShipping.ux.CustomRefModel',
|
|
|
proxy: { url: '/CommMng/BasicDataRef/GetCustomRefList' }
|
|
|
});
|
|
|
this.storeCustCode.load({ params: { condition: ""} });
|
|
|
this.comboxCustCode = Ext.create('DsExt.ux.RefTableCombox', {
|
|
|
fieldLabel: '结算单位',
|
|
|
store: this.storeCustCode,
|
|
|
allowBlank: false,
|
|
|
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();
|
|
|
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: ""} });
|
|
|
|
|
|
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,
|
|
|
emptyText: '原币申请',
|
|
|
name: 'CURR',
|
|
|
valueField: 'CURR',
|
|
|
displayField: 'CURR',
|
|
|
listeners: {
|
|
|
scope: this,
|
|
|
'select': function (combo, records, eOpts) {
|
|
|
if (records.length > 0) {
|
|
|
var CUSTOMERNAME = this.formEdit.getForm().findField('CUSTOMERNAME').getValue();
|
|
|
|
|
|
if (CUSTOMERNAME == '') { return; }
|
|
|
else {
|
|
|
|
|
|
}
|
|
|
}
|
|
|
|
|
|
}
|
|
|
}
|
|
|
});
|
|
|
|
|
|
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'
|
|
|
});
|
|
|
|
|
|
//编辑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: 'APPLICANT',
|
|
|
name: 'APPLICANT', flex: 0, hidden: true, margins: '0'
|
|
|
}, {
|
|
|
fieldLabel: 'COMPANYID',
|
|
|
name: 'COMPANYID', flex: 0, hidden: true, margins: '0'
|
|
|
},
|
|
|
{
|
|
|
fieldLabel: '申请编号',
|
|
|
readOnly: true,
|
|
|
name: 'BILLNO'
|
|
|
}, {
|
|
|
fieldLabel: '状态',
|
|
|
readOnly: true,
|
|
|
name: 'BILLSTATUSREF'
|
|
|
}, this.comboxCustCode, {
|
|
|
fieldLabel: '申请人',
|
|
|
readOnly: true,
|
|
|
name: 'APPLICANTNAME'
|
|
|
},
|
|
|
{
|
|
|
fieldLabel: '申请日期',
|
|
|
readOnly: true,
|
|
|
name: 'APPLYTIME'
|
|
|
}
|
|
|
|
|
|
]
|
|
|
}, {
|
|
|
xtype: 'container',
|
|
|
layout: 'hbox',
|
|
|
defaultType: 'textfield',
|
|
|
items: [{
|
|
|
fieldLabel: 'RMB金额',
|
|
|
readOnly: true,
|
|
|
name: 'AMOUNTRMB',
|
|
|
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: 'AMOUNTUSD',
|
|
|
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: 'hiddenfield' }, { xtype: 'hiddenfield' }, { xtype: 'hiddenfield'}]
|
|
|
|
|
|
}, {
|
|
|
xtype: 'container',
|
|
|
layout: 'hbox',
|
|
|
defaultType: 'textfield',
|
|
|
items: [{
|
|
|
fieldLabel: '备注',
|
|
|
flex: 4,
|
|
|
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: 'btnEPrev',
|
|
|
text: "上一票",
|
|
|
// iconCls: "btnsave",
|
|
|
handler: function (button, event) {
|
|
|
this.PrevRecord();
|
|
|
},
|
|
|
scope: this
|
|
|
}, {
|
|
|
id: 'btnENext',
|
|
|
text: "下一票",
|
|
|
// iconCls: "btnsave",
|
|
|
handler: function (button, event) {
|
|
|
this.NextRecord();
|
|
|
},
|
|
|
scope: this
|
|
|
}, {
|
|
|
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
|
|
|
}
|
|
|
]
|
|
|
}); //end 按钮Toolbar
|
|
|
|
|
|
//#endregion
|
|
|
|
|
|
|
|
|
|
|
|
//#region 发票核销的明细
|
|
|
|
|
|
this.storeBodyInvList = Ext.create('Ext.data.Store', {
|
|
|
pageSize: this.PageSize,
|
|
|
model: 'MsChInvoicehexiao',
|
|
|
remoteSort: true,
|
|
|
proxy: {
|
|
|
type: 'ajax',
|
|
|
url: '/Account/Chfee_Invoicehexiao/GetDataList',
|
|
|
reader: {
|
|
|
id: 'BILLNO',
|
|
|
root: 'data',
|
|
|
totalProperty: 'totalCount'
|
|
|
}
|
|
|
}
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
this.InvGridCheckBoxModel = Ext.create('Ext.selection.CheckboxModel');
|
|
|
this.gridInvList = new Ext.grid.GridPanel({
|
|
|
store: this.storeBodyInvList,
|
|
|
enableHdMenu: false,
|
|
|
region: 'center',
|
|
|
loadMask: { msg: "数据加载中,请稍等..." },
|
|
|
trackMouseOver: true,
|
|
|
disableSelection: false,
|
|
|
selModel: this.InvGridCheckBoxModel,
|
|
|
tbar: [{
|
|
|
text: '删除发票明细',
|
|
|
tooltip: '删除发票明细',
|
|
|
id: 'btndeldetail',
|
|
|
iconCls: "btndeletedetail",
|
|
|
handler: function (button, event) {
|
|
|
this.onDeleteClick(button, event);
|
|
|
},
|
|
|
scope: this
|
|
|
}],
|
|
|
columns: [{
|
|
|
sortable: true,
|
|
|
dataIndex: 'BILLNO',
|
|
|
header: '发票核销号',
|
|
|
width: 120
|
|
|
}, {
|
|
|
sortable: true,
|
|
|
dataIndex: 'BILLSTATUS',
|
|
|
header: '状态',
|
|
|
width: 80
|
|
|
}, {
|
|
|
sortable: true,
|
|
|
dataIndex: 'INVDATE',
|
|
|
header: '发票日期',
|
|
|
width: 100
|
|
|
}, {
|
|
|
sortable: true,
|
|
|
dataIndex: 'INVNO',
|
|
|
header: '发票号',
|
|
|
width: 120
|
|
|
}, {
|
|
|
sortable: true,
|
|
|
dataIndex: 'CUSTOMERNAME',
|
|
|
header: '开票单位',
|
|
|
width: 160
|
|
|
}, {
|
|
|
sortable: true,
|
|
|
dataIndex: 'CURR',
|
|
|
header: '币别',
|
|
|
width: 60
|
|
|
}, {
|
|
|
sortable: true,
|
|
|
dataIndex: 'AMOUNT',
|
|
|
header: '实际金额',
|
|
|
align: 'right',
|
|
|
width: 120,
|
|
|
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: 'INVAMOUNT',
|
|
|
header: '开票金额',
|
|
|
align: 'right',
|
|
|
width: 120,
|
|
|
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: 'TAXRATE',
|
|
|
header: '税率',
|
|
|
align: 'right',
|
|
|
width: 120,
|
|
|
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: 'TAX',
|
|
|
header: '税额',
|
|
|
align: 'right',
|
|
|
width: 120,
|
|
|
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: 'INVOICECUSTNAME',
|
|
|
header: '发票抬头',
|
|
|
width: 160
|
|
|
}, {
|
|
|
sortable: true,
|
|
|
dataIndex: 'OP',
|
|
|
header: '核销人',
|
|
|
width: 160
|
|
|
}, {
|
|
|
sortable: true,
|
|
|
dataIndex: 'REMARKS',
|
|
|
header: '备注',
|
|
|
width: 160
|
|
|
}
|
|
|
]
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
//#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_Invoicehexiao/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: '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: '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
|
|
|
}
|
|
|
]
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//#region 添加业务列表
|
|
|
|
|
|
this.storeBodyAddList = Ext.create('Ext.data.Store', {
|
|
|
pageSize: this.PageSize,
|
|
|
model: 'MsChInvoicehexiao',
|
|
|
remoteSort: true,
|
|
|
proxy: {
|
|
|
type: 'ajax',
|
|
|
url: '/Account/Chfee_Invoicehexiao/GetDataList',
|
|
|
reader: {
|
|
|
id: 'BILLNO',
|
|
|
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.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,
|
|
|
selModel: this.AddGridCheckBoxModel,
|
|
|
tbar: [{
|
|
|
text: '添加结算明细',
|
|
|
tooltip: '添加结算明细',
|
|
|
id: 'btnaddbill',
|
|
|
iconCls: "btnadddetail",
|
|
|
handler: function (button, event) {
|
|
|
this.onAddClick(button, event);
|
|
|
},
|
|
|
scope: this
|
|
|
}],
|
|
|
columns: [{
|
|
|
sortable: true,
|
|
|
dataIndex: 'BILLNO',
|
|
|
header: '发票核销号',
|
|
|
width: 120
|
|
|
}, {
|
|
|
sortable: true,
|
|
|
dataIndex: 'BILLSTATUS',
|
|
|
header: '状态',
|
|
|
width: 80
|
|
|
}, {
|
|
|
sortable: true,
|
|
|
dataIndex: 'INVDATE',
|
|
|
header: '发票日期',
|
|
|
width: 100
|
|
|
}, {
|
|
|
sortable: true,
|
|
|
dataIndex: 'INVNO',
|
|
|
header: '发票号',
|
|
|
width: 120
|
|
|
}, {
|
|
|
sortable: true,
|
|
|
dataIndex: 'CUSTOMERNAME',
|
|
|
header: '开票单位',
|
|
|
width: 160
|
|
|
}, {
|
|
|
sortable: true,
|
|
|
dataIndex: 'CURR',
|
|
|
header: '币别',
|
|
|
width: 60
|
|
|
}, {
|
|
|
sortable: true,
|
|
|
dataIndex: 'AMOUNT',
|
|
|
header: '实际金额',
|
|
|
align: 'right',
|
|
|
width: 120,
|
|
|
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: 'INVAMOUNT',
|
|
|
header: '开票金额',
|
|
|
align: 'right',
|
|
|
width: 120,
|
|
|
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: 'TAXRATE',
|
|
|
header: '税率',
|
|
|
align: 'right',
|
|
|
width: 120,
|
|
|
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: 'TAX',
|
|
|
header: '税额',
|
|
|
align: 'right',
|
|
|
width: 120,
|
|
|
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: 'INVOICECUSTNAME',
|
|
|
header: '发票抬头',
|
|
|
width: 160
|
|
|
}, {
|
|
|
sortable: true,
|
|
|
dataIndex: 'OP',
|
|
|
header: '核销人',
|
|
|
width: 160
|
|
|
}, {
|
|
|
sortable: true,
|
|
|
dataIndex: 'REMARKS',
|
|
|
header: '备注',
|
|
|
width: 160
|
|
|
}
|
|
|
],
|
|
|
// 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);
|
|
|
|
|
|
|
|
|
_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' }
|
|
|
]
|
|
|
});
|
|
|
|
|
|
//#endregion
|
|
|
|
|
|
//#region 添加费用列表
|
|
|
this.storeAddFeeList = Ext.create('Ext.data.Store', {
|
|
|
pageSize: this.PageSize,
|
|
|
model: 'Chfee_do_detail',
|
|
|
remoteSort: true,
|
|
|
proxy: {
|
|
|
type: 'ajax',
|
|
|
url: '/Account/Chfee_Invoicehexiao/GetBillList',
|
|
|
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.gridAddFeeList = new Ext.grid.GridPanel({
|
|
|
store: this.storeAddFeeList,
|
|
|
enableHdMenu: false,
|
|
|
region: 'center',
|
|
|
loadMask: { msg: "数据加载中,请稍等..." },
|
|
|
trackMouseOver: true,
|
|
|
disableSelection: false,
|
|
|
plugins: [this.cellEditingFee],
|
|
|
selModel: this.AddFeeGridCheckBoxModel,
|
|
|
tbar: [{ xtype: "label", id: "zongshu", text: "",
|
|
|
handler: function () { ; }
|
|
|
}],
|
|
|
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
|
|
|
}
|
|
|
],
|
|
|
// paging bar on the bottom
|
|
|
bbar: Ext.create('Ext.PagingToolbar', {
|
|
|
store: this.storeAddFeeList,
|
|
|
displayInfo: true,
|
|
|
displayMsg: '当前显示 {0} - {1}条记录 /共 {2}条记录',
|
|
|
emptyMsg: "没有数据"
|
|
|
})
|
|
|
});
|
|
|
|
|
|
|
|
|
this.gridAddFeeList.on('edit', function (editor, e, eOpts) {
|
|
|
this.gridAddFeeListAfterEdit(editor, e, eOpts);
|
|
|
}, this);
|
|
|
|
|
|
this.gridAddFeeList.on('cellclick', function (button, event) {
|
|
|
this.onSelectFee(button, event);
|
|
|
}, this);
|
|
|
|
|
|
|
|
|
|
|
|
//#endregion
|
|
|
|
|
|
_this = this;
|
|
|
|
|
|
this.storeCustCodefee = Ext.create('DsExt.ux.RefTableStore', {
|
|
|
model: 'DsShipping.ux.CustomRefModel',
|
|
|
proxy: { url: '/CommMng/BasicDataRef/GetCustomRefList' }
|
|
|
});
|
|
|
|
|
|
this.storeCustCodefee.load({ params: { condition: ""} });
|
|
|
|
|
|
this.comboxAddCustCode = Ext.create('DsExt.ux.RefTableCombox', {
|
|
|
fieldLabel: '费用对象',
|
|
|
store: this.storeCustCodefee,
|
|
|
forceSelection: true,
|
|
|
name: 'CUSTNAME',
|
|
|
valueField: 'CustName',
|
|
|
displayField: 'CodeAndName',
|
|
|
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: 90,
|
|
|
msgTarget: 'qtip'
|
|
|
},
|
|
|
|
|
|
items: [
|
|
|
{//fieldset 1
|
|
|
xtype: 'container',
|
|
|
defaultType: 'textfield',
|
|
|
layout: 'anchor',
|
|
|
defaults: {
|
|
|
anchor: '100%'
|
|
|
},
|
|
|
items: [{
|
|
|
xtype: 'container',
|
|
|
layout: 'hbox',
|
|
|
defaultType: 'textfield',
|
|
|
items: [this.comboxAddCustCode, {
|
|
|
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();
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
}, {
|
|
|
xtype: 'button',
|
|
|
width: 60,
|
|
|
text: "查询",
|
|
|
iconCls: "btnrefresh",
|
|
|
handler: function (button, event) {
|
|
|
this.onRefreshClick(button, event);
|
|
|
},
|
|
|
scope: this
|
|
|
}, {
|
|
|
xtype: 'button',
|
|
|
width: 30,
|
|
|
// text: "重置条件",
|
|
|
iconCls: "btnreset",
|
|
|
handler: function (button, event) {
|
|
|
this.onClearSql(button, event);
|
|
|
},
|
|
|
scope: this
|
|
|
}, {
|
|
|
xtype: 'button',
|
|
|
width: 30,
|
|
|
// text: "高级查询",
|
|
|
iconCls: "btnmore",
|
|
|
handler: function (button, event) {
|
|
|
var sql = this.getCondition();
|
|
|
var winAccess = new Shipping.DsQuery({
|
|
|
|
|
|
});
|
|
|
winAccess.StoreList = this.storeBodyAddList;
|
|
|
winAccess.formname = this.formname;
|
|
|
winAccess.condition = sql;
|
|
|
winAccess.show();
|
|
|
return;
|
|
|
},
|
|
|
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.panelInv = new Ext.Panel({
|
|
|
layout: "border",
|
|
|
region: 'west',
|
|
|
width: 950,
|
|
|
split: true,
|
|
|
margin: '2 2',
|
|
|
items: [this.gridInvList]
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
this.paneldetail = new Ext.Panel({
|
|
|
title: '申请明细',
|
|
|
layout: "border",
|
|
|
height: 240,
|
|
|
region: "north",
|
|
|
split: true,
|
|
|
items: [
|
|
|
this.panelInv, this.panelService
|
|
|
]
|
|
|
});
|
|
|
|
|
|
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',
|
|
|
height: 300,
|
|
|
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: 155,
|
|
|
items: [this.panelBtn, this.formEdit]
|
|
|
});
|
|
|
|
|
|
Ext.apply(this, {
|
|
|
items: [this.panelTop, this.paneldetail, this.paneladd]
|
|
|
});
|
|
|
|
|
|
//#endregion
|
|
|
|
|
|
//绑定查询窗体
|
|
|
this.ParentWin = window.parent.opener;
|
|
|
|
|
|
if (this.bsno == undefined) {
|
|
|
|
|
|
//初始化数据
|
|
|
this.InitData();
|
|
|
|
|
|
//绑定事件
|
|
|
|
|
|
var billno = '*';
|
|
|
|
|
|
if (this.opStatus == 'edit') {
|
|
|
billno = this.editRecord.get('BILLNO');
|
|
|
|
|
|
};
|
|
|
} else {
|
|
|
var condition = " BILLNO='" + this.bsno + "'";
|
|
|
|
|
|
this.LoadData('edit', condition);
|
|
|
|
|
|
}
|
|
|
|
|
|
this.storeBodyList.on('beforeload', function (store) {
|
|
|
|
|
|
var billno = _this.formEdit.getForm().findField('BILLNO').getValue();
|
|
|
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);
|
|
|
|
|
|
|
|
|
this.storeBodyAddList.on('beforeload', function (store) {
|
|
|
// var sql = this.getCondition();
|
|
|
|
|
|
Ext.apply(store.proxy.extraParams, { condition: this.sqlcontext });
|
|
|
}, this);
|
|
|
|
|
|
this.storeBodyAddList.on('load', function (store, records) {
|
|
|
if (store.getCount() > 0) {
|
|
|
this.gridAddList.getSelectionModel().select(0);
|
|
|
|
|
|
} else {
|
|
|
this.storeAddFeeList.removeAll();
|
|
|
}
|
|
|
}, this);
|
|
|
|
|
|
|
|
|
this.gridAddList.getSelectionModel().on('select', function (model, record, index) {
|
|
|
|
|
|
var bsno = record.data.BILLNO;
|
|
|
|
|
|
var sql = "";
|
|
|
sql = " BILLNO='" + bsno + "' ";
|
|
|
this.storeAddFeeList.load({ params: { condition: sql} });
|
|
|
// this.onSelectFee(button, event);
|
|
|
}, 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_Invoicehexiao/GetBalData',
|
|
|
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.formSearch.getForm().findField('CUSTNAME').setValue(data.CUSTOMERNAME);
|
|
|
|
|
|
|
|
|
_this.GetEditStatus();
|
|
|
} else {
|
|
|
Ext.MessageBox.alert('请求出现错误,请重试', response.responseText);
|
|
|
}
|
|
|
},
|
|
|
scope: this
|
|
|
});
|
|
|
|
|
|
var billno = '*';
|
|
|
|
|
|
if (this.opStatus == 'edit') {
|
|
|
if (this.bsno == undefined) {
|
|
|
billno = this.editRecord.get('BILLNO');
|
|
|
} else billno = this.bsno;
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
this.storeBodyList.load({ params: { condition: " BILLNO in (SELECT BILLNO FROM ch_fee_invoicehexiao where BALBILLNO='" + billno + "')" },
|
|
|
callback: function (r, options, success) {
|
|
|
if (success) {
|
|
|
if (this.storeBodyList.getCount() > 0) {
|
|
|
// this.comboxCurr.setReadOnly(true);
|
|
|
this.comboxCustCode.setReadOnly(true);
|
|
|
}
|
|
|
else {
|
|
|
// this.comboxCurr.setReadOnly(false);
|
|
|
this.comboxCustCode.setReadOnly(false);
|
|
|
}
|
|
|
}
|
|
|
},
|
|
|
scope: this
|
|
|
});
|
|
|
|
|
|
this.storeBodyInvList.load({ params: { condition: " BALBILLNO='" + billno + "'"} });
|
|
|
|
|
|
// 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('APPLICANT').setDisabled(false);
|
|
|
this.formEdit.getForm().findField('COMPANYID').setDisabled(false);
|
|
|
var data = basicForm.getValues();
|
|
|
this.formEdit.getForm().findField('BILLSTATUS').setDisabled(true);
|
|
|
this.formEdit.getForm().findField('APPLICANT').setDisabled(true);
|
|
|
this.formEdit.getForm().findField('COMPANYID').setDisabled(true);
|
|
|
|
|
|
Ext.Msg.wait('正在保存数据, 请稍侯..');
|
|
|
Ext.Ajax.request({
|
|
|
waitMsg: '正在保存数据...',
|
|
|
url: '/Account/Chfee_Invoicehexiao/SaveBal',
|
|
|
scope: this,
|
|
|
params: {
|
|
|
opstatus: this.opStatus,
|
|
|
data: Ext.JSON.encode(data)
|
|
|
},
|
|
|
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.bsno == undefined) {
|
|
|
|
|
|
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('MsChBalapplication', 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
|
|
|
onAddBillClick: function (button, event) {
|
|
|
this.addstore = true;
|
|
|
this.addBill();
|
|
|
}, //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
|
|
|
|
|
|
|
|
|
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 });
|
|
|
},
|
|
|
|
|
|
|
|
|
|
|
|
addBill: function () {
|
|
|
var basicForm = this.formEdit.getForm();
|
|
|
var selectedRecords = this.gridAddList.selModel.getSelection();
|
|
|
|
|
|
if (selectedRecords.length == 0) {
|
|
|
Ext.Msg.show({ title: '提示', msg: '没有选择要添加的业务!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
|
|
|
return;
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var btnEAddbill = Ext.getCmp('btnaddbill');
|
|
|
btnEAddbill.disable();
|
|
|
var Duino = this.formEdit.getForm().findField('BILLNO').getValue();
|
|
|
_this = this;
|
|
|
if ((Duino == '*') || basicForm.isDirty()) {
|
|
|
|
|
|
var CUSTOMERNAME = this.formEdit.getForm().findField('CUSTOMERNAME').getValue();
|
|
|
// var CURR = this.formEdit.getForm().findField('CURR').getValue();
|
|
|
if ((CUSTOMERNAME == '') || (CUSTOMERNAME == null)) {
|
|
|
var rec = selectedRecords[0];
|
|
|
var cust = rec.data.CUSTOMERNAME;
|
|
|
this.formEdit.getForm().findField('CUSTOMERNAME').setValue(cust);
|
|
|
}
|
|
|
// if ((CURR == '') || (CURR == null)) {
|
|
|
// var rec = selectedRecords[i];
|
|
|
// var curr = rec.data.CURR;
|
|
|
// this.formEdit.getForm().findField('CURR').setValue(curr);
|
|
|
// }
|
|
|
|
|
|
var CUSTOMERNAME = this.formEdit.getForm().findField('CUSTOMERNAME').getValue();
|
|
|
|
|
|
if (!basicForm.isValid()) {
|
|
|
return;
|
|
|
}
|
|
|
var type = 0;
|
|
|
var data = basicForm.getValues();
|
|
|
|
|
|
Ext.Msg.wait('正在保存数据, 请稍侯..');
|
|
|
Ext.Ajax.request({
|
|
|
waitMsg: '正在保存数据...',
|
|
|
url: '/Account/Chfee_Invoicehexiao/SaveBal',
|
|
|
scope: this,
|
|
|
params: {
|
|
|
opstatus: this.opStatus,
|
|
|
data: Ext.JSON.encode(data)
|
|
|
},
|
|
|
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.bsno == undefined) {
|
|
|
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('MsChBalapplication', 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';
|
|
|
_this.addBillfn();
|
|
|
|
|
|
} else {
|
|
|
btnEAddbill.enable();
|
|
|
Ext.Msg.show({ title: '错误', msg: jsonresult.Message, icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK });
|
|
|
}
|
|
|
} else {
|
|
|
btnEAddbill.enable();
|
|
|
|
|
|
Ext.Msg.show({ title: '请重试',
|
|
|
msg: '服务器响应出错',
|
|
|
icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK
|
|
|
});
|
|
|
}
|
|
|
}
|
|
|
});
|
|
|
} else {
|
|
|
|
|
|
this.addBillfn();
|
|
|
}
|
|
|
}, //end save
|
|
|
|
|
|
addBillfn: function () {
|
|
|
|
|
|
var btnEAddbill = Ext.getCmp('btnaddbill');
|
|
|
var billstatus = this.formEdit.getForm().findField('BILLSTATUS').getValue();
|
|
|
|
|
|
if ((billstatus != 1) && (billstatus != 6)) {
|
|
|
btnEAddbill.enable();
|
|
|
Ext.Msg.show({ title: '提示', msg: '当前状态无法添加付费申请明细!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
|
|
|
|
|
|
|
|
|
return;
|
|
|
|
|
|
}
|
|
|
|
|
|
var billcust = this.formEdit.getForm().findField('CUSTOMERNAME').getValue();
|
|
|
var billno = this.formEdit.getForm().findField('BILLNO').getValue();
|
|
|
|
|
|
|
|
|
|
|
|
var feeBSNOSql = '';
|
|
|
var sql = '';
|
|
|
var selectedRecords = this.gridAddList.selModel.getSelection();
|
|
|
|
|
|
if (selectedRecords.length == 0) {
|
|
|
btnEAddbill.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];
|
|
|
if (rec.data.CUSTOMERNAME == billcust)
|
|
|
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.Ajax.request({
|
|
|
waitMsg: '正在添加数据...',
|
|
|
url: '/Account/Chfee_Invoicehexiao/AddBalList',
|
|
|
params: {
|
|
|
billno: billno,
|
|
|
data: jsonbodyAddDatas
|
|
|
},
|
|
|
callback: function (options, success, response) {
|
|
|
if (success) {
|
|
|
var result = Ext.JSON.decode(response.responseText);
|
|
|
if (!result.Success) {
|
|
|
btnEAddbill.enable();
|
|
|
Ext.Msg.show({
|
|
|
title: '提示',
|
|
|
msg: result.Message,
|
|
|
icon: Ext.MessageBox.ERROR,
|
|
|
buttons: Ext.Msg.OK
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
return;
|
|
|
} else {
|
|
|
|
|
|
btnEAddbill.enable();
|
|
|
|
|
|
|
|
|
var sql = this.sqlcontext;
|
|
|
|
|
|
this.storeBodyAddList.load({ params: { start: 0, limit: _this.PageSize, sort: '', condition: sql} });
|
|
|
|
|
|
this.storeBodyList.load({ params: { condition: " BILLNO in (SELECT BILLNO FROM ch_fee_invoicehexiao where BALBILLNO='" + billno + "')" },
|
|
|
callback: function (r, options, success) {
|
|
|
if (success) {
|
|
|
if (this.storeBodyList.getCount() > 0) {
|
|
|
// this.comboxCurr.setReadOnly(true);
|
|
|
this.comboxCustCode.setReadOnly(true);
|
|
|
}
|
|
|
else {
|
|
|
// this.comboxCurr.setReadOnly(false);
|
|
|
this.comboxCustCode.setReadOnly(false);
|
|
|
}
|
|
|
}
|
|
|
},
|
|
|
scope: this
|
|
|
});
|
|
|
|
|
|
this.storeBodyInvList.load({ params: { condition: " BALBILLNO='" + billno + "'"} });
|
|
|
|
|
|
|
|
|
|
|
|
Ext.Ajax.request({
|
|
|
waitMsg: '正在查询主表数据...',
|
|
|
url: '/Account/Chfee_Invoicehexiao/GetBalData',
|
|
|
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().reset();
|
|
|
this.formEdit.getForm().setValues(data);
|
|
|
if (this.bsno == undefined) {
|
|
|
var editp = Ext.create('MsChBalapplication', 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 {
|
|
|
btnEAddbill.enable();
|
|
|
Ext.MessageBox.alert('请求出现错误,请重试', response.responseText);
|
|
|
}
|
|
|
},
|
|
|
scope: this
|
|
|
});
|
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
deleteBill: function (type) {
|
|
|
|
|
|
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 });
|
|
|
return;
|
|
|
};
|
|
|
|
|
|
// var billstatus = this.formEdit.getForm().findField('BILLSTATUS').getValue();
|
|
|
|
|
|
// if ((billstatus != 1) && (billstatus != 6)) {
|
|
|
|
|
|
// 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];
|
|
|
bodyAddDatas.push(rec);
|
|
|
}
|
|
|
|
|
|
var jsonbodyAddDatas = ConvertRecordsToJsonAll(bodyAddDatas);
|
|
|
|
|
|
var sql = this.sqlcontext;
|
|
|
_this = this;
|
|
|
|
|
|
Ext.Ajax.request({
|
|
|
waitMsg: '正在删除数据...',
|
|
|
url: '/Account/Chfee_Invoicehexiao/DelBalBill',
|
|
|
params: {
|
|
|
data: jsonbodyAddDatas,
|
|
|
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;
|
|
|
} else {
|
|
|
|
|
|
var sql = this.sqlcontext;
|
|
|
this.storeBodyAddList.load({ params: { start: 0, limit: _this.PageSize, sort: '', condition: sql} });
|
|
|
|
|
|
this.storeBodyList.load({ params: { condition: " BILLNO in (SELECT BILLNO FROM ch_fee_invoicehexiao where BALBILLNO='" + billno + "')" },
|
|
|
callback: function (r, options, success) {
|
|
|
if (success) {
|
|
|
if (this.storeBodyList.getCount() > 0) {
|
|
|
// this.comboxCurr.setReadOnly(true);
|
|
|
this.comboxCustCode.setReadOnly(true);
|
|
|
}
|
|
|
else {
|
|
|
// this.comboxCurr.setReadOnly(false);
|
|
|
this.comboxCustCode.setReadOnly(false);
|
|
|
}
|
|
|
}
|
|
|
},
|
|
|
scope: this
|
|
|
});
|
|
|
|
|
|
this.storeBodyInvList.load({ params: { condition: " BALBILLNO='" + billno + "'"} });
|
|
|
|
|
|
Ext.Ajax.request({
|
|
|
waitMsg: '正在查询主表数据...',
|
|
|
url: '/Account/Chfee_Invoicehexiao/GetBalData',
|
|
|
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().reset();
|
|
|
this.formEdit.getForm().setValues(data);
|
|
|
if (this.bsno == undefined) {
|
|
|
var editp = Ext.create('MsChBalapplication', 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.MessageBox.alert('请求出现错误,请重试', response.responseText);
|
|
|
}
|
|
|
},
|
|
|
scope: this
|
|
|
});
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
onSubmitAuditClick: function () {
|
|
|
var billno = this.formEdit.getForm().findField('BILLNO').getValue();
|
|
|
|
|
|
var billstatus = this.formEdit.getForm().findField('BILLSTATUS').getValue();
|
|
|
|
|
|
|
|
|
|
|
|
// var btnESave = Ext.getCmp('btnESave');
|
|
|
// isDisabled()
|
|
|
|
|
|
if (billno == '*') {
|
|
|
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;
|
|
|
|
|
|
}
|
|
|
|
|
|
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_Invoicehexiao/Lock',
|
|
|
params: {
|
|
|
bill: 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;
|
|
|
} else {
|
|
|
|
|
|
Ext.Ajax.request({
|
|
|
waitMsg: '正在查询主表数据...',
|
|
|
url: '/Account/Chfee_Invoicehexiao/GetBalData',
|
|
|
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().reset();
|
|
|
this.formEdit.getForm().setValues(data);
|
|
|
if (this.bsno == undefined) {
|
|
|
var editp = Ext.create('MsChBalapplication', 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.MessageBox.alert('请求出现错误,请重试', response.responseText);
|
|
|
}
|
|
|
},
|
|
|
scope: this
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
onSubmitAuditBackClick: function () {
|
|
|
var billno = this.formEdit.getForm().findField('BILLNO').getValue();
|
|
|
|
|
|
var billstatus = this.formEdit.getForm().findField('BILLSTATUS').getValue();
|
|
|
|
|
|
if (billno == '*') {
|
|
|
Ext.Msg.show({ title: '提示', msg: '请先保存收费结算,然后才能撤销锁定!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
|
|
|
return;
|
|
|
};
|
|
|
|
|
|
|
|
|
if (billstatus != 0) {
|
|
|
|
|
|
Ext.Msg.show({ title: '提示', msg: '当前状态无法撤销锁定!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
|
|
|
return;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
_this = this;
|
|
|
|
|
|
Ext.Ajax.request({
|
|
|
waitMsg: '正在添加数据...',
|
|
|
url: '/Account/Chfee_Invoicehexiao/UnLockBalList',
|
|
|
params: {
|
|
|
bill: 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;
|
|
|
} else {
|
|
|
|
|
|
Ext.Ajax.request({
|
|
|
waitMsg: '正在查询主表数据...',
|
|
|
url: '/Account/Chfee_Invoicehexiao/GetBalData',
|
|
|
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().reset();
|
|
|
this.formEdit.getForm().setValues(data);
|
|
|
if (this.bsno == undefined) {
|
|
|
var editp = Ext.create('MsChBalapplication', 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.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.storeBodyAddList.load({ params: { start: 0, limit: this.PageSize, sort: '', condition: sql} });
|
|
|
},
|
|
|
|
|
|
onDsQuery: function () {
|
|
|
//var girdcolums = this.gridList.getColumnMode();
|
|
|
var sql = this.sqlcontext;
|
|
|
this.storeBodyAddList.load({ params: { start: 0, limit: this.PageSize, sort: '', condition: sql} });
|
|
|
},
|
|
|
|
|
|
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 = " (BALBILLNO IS NULL OR BALBILLNO='') ";
|
|
|
|
|
|
var customNo = form.findField('CustomNo').getValue();
|
|
|
sql = sql + getAndConSql(sql, customNo, " BILLNO like '%" + customNo + "%' ");
|
|
|
|
|
|
var CUSTNAME = form.findField('CUSTNAME').getValue();
|
|
|
sql = sql + getAndConSql(sql, CUSTNAME, "CUSTOMERNAME='" + CUSTNAME + "'");
|
|
|
|
|
|
|
|
|
var expDateBgn = form.findField('ExpDateBgn').getRawValue();
|
|
|
sql = sql + getAndConSql(sql, expDateBgn, "INVDATE>='" + expDateBgn + "'");
|
|
|
|
|
|
var expDateEnd = form.findField('ExpDateEnd').getRawValue();
|
|
|
sql = sql + getAndConSql(sql, expDateEnd, "INVDATE <='" + expDateEnd + "'");
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return sql;
|
|
|
},
|
|
|
|
|
|
|
|
|
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;
|
|
|
this.formEdit.getForm().findField('BILLSTATUS').setDisabled(false);
|
|
|
var bsStatus = this.formEdit.getForm().findField('BILLSTATUS').getValue();
|
|
|
var op = this.formEdit.getForm().findField('APPLICANTNAME').getValue();
|
|
|
this.formEdit.getForm().findField('BILLSTATUS').setDisabled(true);
|
|
|
var btnSubmitAudit = Ext.getCmp('btnSubmitAudit');
|
|
|
var btnSubmitAuditBack = Ext.getCmp('btnSubmitAuditBack');
|
|
|
_this = this;
|
|
|
|
|
|
this.StoreOpRange.load({ params: { optype: "modPaySettleAppList" },
|
|
|
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;
|
|
|
}
|
|
|
if ((bsStatus != 1) && (bsStatus != 6)) {
|
|
|
_this.setSaveBtnStatus(false);
|
|
|
} else {
|
|
|
|
|
|
_this.setSaveBtnStatus(canedit);
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
});
|
|
|
|
|
|
Ext.Ajax.request({
|
|
|
waitMsg: '正在添加数据...',
|
|
|
url: '/MvcShipping/MsBaseInfo/GetUserModuleEnable',
|
|
|
params: {
|
|
|
modulename: 'modBalAppLock'
|
|
|
},
|
|
|
callback: function (options, success, response) {
|
|
|
if (success) {
|
|
|
var result = Ext.JSON.decode(response.responseText);
|
|
|
if (!result.Success) {
|
|
|
btnSubmitAudit.disable();
|
|
|
btnSubmitAuditBack.disable();
|
|
|
} else {
|
|
|
if (bsStatus == 1) {
|
|
|
btnSubmitAudit.enable();
|
|
|
btnSubmitAuditBack.disable();
|
|
|
} else {
|
|
|
btnSubmitAudit.disable();
|
|
|
btnSubmitAuditBack.enable();
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
} else {
|
|
|
|
|
|
}
|
|
|
},
|
|
|
scope: this
|
|
|
});
|
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
setSaveBtnStatus: function (enable) {
|
|
|
var btnESave = Ext.getCmp('btnESave');
|
|
|
var btnESaveAndClose = Ext.getCmp('btnESaveAndClose');
|
|
|
var btnESaveAndNew = Ext.getCmp('btnESaveAndNew');
|
|
|
var btnEAddbill = Ext.getCmp('btnaddbill');
|
|
|
var btnEDeleteDetail = Ext.getCmp('btndeldetail');
|
|
|
|
|
|
|
|
|
|
|
|
if (enable) {
|
|
|
btnESave.enable();
|
|
|
btnESaveAndClose.enable();
|
|
|
btnESaveAndNew.enable();
|
|
|
|
|
|
btnEDeleteDetail.enable();
|
|
|
btnEAddbill.enable();
|
|
|
|
|
|
|
|
|
} else {
|
|
|
btnESave.disable();
|
|
|
btnESaveAndClose.disable();
|
|
|
btnESaveAndNew.disable();
|
|
|
btnEDeleteDetail.disable();
|
|
|
btnEAddbill.disable();
|
|
|
|
|
|
|
|
|
}
|
|
|
},
|
|
|
|
|
|
|
|
|
// #endregion
|
|
|
|
|
|
|
|
|
PrevRecord: function () {
|
|
|
|
|
|
// var modifystr = this.getIsModify();
|
|
|
// if (modifystr != "") {
|
|
|
// Ext.Msg.show({ title: '警告', msg: modifystr + '未保存,如果离开此页,将丢失未保存的更改 !!!', icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK });
|
|
|
// return;
|
|
|
// }
|
|
|
var j = this.StoreList.indexOf(this.editRecord);
|
|
|
if (j == 0) {
|
|
|
Ext.Msg.show({ title: '警告', msg: '已是最前一票', icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK });
|
|
|
|
|
|
return;
|
|
|
}
|
|
|
if (j == this.StoreList.count) {
|
|
|
Ext.Msg.show({ title: '警告', msg: '已是最后一票', icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK });
|
|
|
|
|
|
return;
|
|
|
|
|
|
}
|
|
|
j = j - 1;
|
|
|
this.editRecord = this.StoreList.getAt(j);
|
|
|
if (this.opStatus == 'edit')
|
|
|
condition = " BILLNO='" + this.editRecord.get('BILLNO') + "'";
|
|
|
this.LoadData(this.opStatus, condition);
|
|
|
},
|
|
|
NextRecord: function () {
|
|
|
|
|
|
// var modifystr = this.getIsModify();
|
|
|
// if (modifystr != "") {
|
|
|
// Ext.Msg.show({ title: '警告', msg: modifystr + '未保存,如果离开此页,将丢失未保存的更改 !!!', icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK });
|
|
|
// return;
|
|
|
// }
|
|
|
|
|
|
var j = this.StoreList.indexOf(this.editRecord);
|
|
|
|
|
|
if (j == (this.StoreList.data.length - 1)) {
|
|
|
Ext.Msg.show({ title: '警告', msg: '已是最后一票', icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK });
|
|
|
|
|
|
return;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
j = j + 1;
|
|
|
this.editRecord = this.StoreList.getAt(j);
|
|
|
if (this.opStatus == 'edit')
|
|
|
condition = " BILLNO='" + this.editRecord.get('BILLNO') + "'";
|
|
|
this.LoadData(this.opStatus, condition);
|
|
|
},
|
|
|
|
|
|
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 = 'MSBALAPP';
|
|
|
var sql1 = "SELECT p.*,(select ShowName from [user] where GID=p.APPLICANT) as APPLICANTNAME,(select ShowName from [user] where GID=p.AUDITUSER) as AUDITUSERREF FROM ch_fee_balapplication p WHERE BILLNO='" + billNo + "'";
|
|
|
var sql2 = "select * from ch_fee_invoicehexiao where BALBILLNO='" + billNo + "'";
|
|
|
var sql3 = "SELECT c.GID,c.BSNO,c.FEEID,c.FEENAME,c.CURRENCY,c.AMOUNT,c.DOAMOUNT,c.ORIGCURRENCY,c.ORIGAMOUNT,c.EXCHANGERATE,FEETYPE ";
|
|
|
sql3 = sql3 + ",b.CUSTOMERNAME,b.VESSEL,b.VOYNO,b.ETD,b.PORTLOAD";
|
|
|
sql3 = sql3 + " ,b.PORTDISCHARGE,b.INPUTBY,b.OP,b.CUSTSERVICE,b.DOC,b.SALE,b.MBLNO,b.CUSTNO"
|
|
|
sql3 = sql3 + " FROM ch_fee_do c left join v_op_bill b on (b.bsno=c.bsno)";
|
|
|
sql3 = sql3 + " WHERE C.BILLNO IN (SELECT BILLNO FROM ch_fee_invoicehexiao WHERE BALBILLNO='" + billNo + "') ORDER BY b.VESSEL,b.VOYNO,b.MBLNO";
|
|
|
|
|
|
|
|
|
var sql4 = "";
|
|
|
var sql5 = "";
|
|
|
var sql6 = "";
|
|
|
|
|
|
PrintComm(printType, sql1, sql2, sql3, sql4, sql5, sql6);
|
|
|
}
|
|
|
|
|
|
, onSelectFee: function (button, event) {
|
|
|
//Ext.getCmp("zongshu").setText("1234");
|
|
|
|
|
|
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("Amount");
|
|
|
}
|
|
|
sum = sum.toFixed(2);
|
|
|
Ext.getCmp("zongshu").setText(" 选中金额:" + sum);
|
|
|
|
|
|
}
|
|
|
});
|
|
|
|
|
|
|