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.

4428 lines
168 KiB
JavaScript

This file contains ambiguous Unicode characters!

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

Ext.namespace('Shipping');
Shipping.MsChPayapplicationBLEdit = function (config) {
Ext.applyIf(this, config);
this.initUIComponents();
window.Shipping.MsChPayapplicationBLEdit.superclass.constructor.call(this);
};
var BillNo;
var BillState;
Ext.extend(Shipping.MsChPayapplicationBLEdit, Ext.Panel, {
ParentWin: null,
OpStatus: 'add',
StoreList: null,
EditRecord: null,
addstore: false,
PageSize: 30,
BodyPageSize: 100,
sqlcontext: '',
sortfield: '',
sortdire: '',
addsortfield: '',
addsortdire: '',
initUIComponents: function () {
this.serialNo = 0;
this.workSerialNo = 0;
this.bodyDel = [];
this.FeeSql = '';
this.BillSql = '';
this.DuiBillSql = '';
this.IsDebit = '0';
this.sortfield = '';
this.sortdire = '';
this.addsortfield = '';
this.addsortdire = '';
this.canedit = false;
this.selectfeesql = '';
this.formname = "MsChPayapplicationBLEdit"; //页面名称
Ext.Ajax.timeout = 120000;
this.bsnosql = getUrlParam('bsnosql');
this.bsCust = getUrlParam('bsCust');
Ext.define('DsShipping.ux.MsClientGroup', {
extend: 'Ext.data.Model',
fields: [
{ name: 'SHORTNAME', type: 'string' },
{ name: 'PCORPNAME', type: 'string' },
{ name: 'CODENAME', type: 'string' }
]
});
_this = this;
this.StoreClientGroup = Ext.create('DsExt.ux.RefTableStore', {
model: 'DsShipping.ux.MsClientGroup',
proxy: { url: '/MvcShipping/MsInfoClient/GetClientGroupList' }
});
this.StoreClientGroup.load({ params: { condition: "PCORPNAME<>'' " }
});
this.storeMustBe = Ext.create('Ext.data.Store', {
model: 'DsShipping.ux.OpDefValue',
remoteSort: true,
proxy: {
type: 'ajax',
url: '/MvcShipping/MsCodeOpMustField/GetDataList',
reader: {
id: 'GID',
root: 'data',
totalProperty: 'totalCount'
}
}
});
//#region 编辑form
//枚举参照相关(编辑form)
//表参照相关(编辑form)
// this.storeCustACCOUNT = Ext.create('DsExt.ux.RefTableStore', {
// model: 'DsShipping.ux.CustomACCOUNTModel',
// proxy: { url: '/CommMng/BasicDataRef/GetCustomACCOUNTList' }
// });
// this.comboxCustACCOUNT = Ext.create('DsExt.ux.RefTableCombox', {
// fieldLabel: '结算对象账户', flex: 2, id: "CUSTACCOUNTGID",
// store: this.storeCustACCOUNT,
// forceSelection: true,
// name: 'CUSTACCOUNTGID',
// valueField: 'GID',
// displayField: 'BANKNAME_ACCOUNT',
// listeners: {
// scope: this,
// 'select': function (combo, records, eOpts) {
// if (records.length > 0) {
// //alert(records[0].data.GID);
// //alert(records[0].data.BANKNAME_ACCOUNT);
// }
// }
// }
// });
this.storeCustACCOUNT = Ext.create('DsExt.ux.RefTableStore', {
model: 'DsShipping.ux.CustomACCOUNTModel',
proxy: { url: '/CommMng/BasicDataRef/GetCustomACCOUNTList' }
});
this.comboxCustACCOUNT = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: Zi.LAN.jsuanzh, //结算对象账户
store: this.storeCustACCOUNT,
forceSelection: true,
name: 'CUSTACCOUNTGID',
valueField: 'GID',
displayField: 'BANKNAME_ACCOUNT',
listeners: {
scope: this,
'select': function (combo, records, eOpts) {
if (records.length > 0) {
var CUSTACCOUNT = this.formEdit.getForm().findField('CUSTACCOUNT');
CUSTACCOUNT.setValue(records[0].data.ACCOUNT);
}
}
}
});
this.storeCustCode = Ext.create('DsExt.ux.RefTableStore', {
model: 'DsShipping.ux.CustomRefModel',
proxy: { url: '/CommMng/BasicDataRef/GetCustomRefListRm' }
});
// this.storeCustCode.load({ params: { condition: ""} });
this.comboxCustCode = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: Zi.LAN.SettlementUnit, //结算单位
store: this.storeCustCode,
allowBlank: false,
queryMode: 'remote',
minChars: 1,
queryParam: 'CODENAME',
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.storeCustACCOUNT.load({ params: { condition: " LINKID=(select GID from info_client where shortname='" + CUSTOMERNAME + "') "} });
this.LoadCustACCOUNT(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: Zi.LAN.Currency, //币别
store: this.StoreCurr,
forceSelection: true,
emptyText: Zi.LAN.ybsq, //原币申请
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.LoadCustACCOUNT(CUSTOMERNAME);
}
}
}
}
});
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: Zi.LAN.jstype, //结算方式
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: 'ISPRINT',
name: 'ISPRINT', 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: Zi.LAN.sqnum, //申请编号
readOnly: true,
name: 'BILLNO'
}, {
fieldLabel: Zi.LAN.status, //状态
readOnly: true,
name: 'BILLSTATUSREF'
}, this.comboxCustCode
, this.comboxCustACCOUNT, {
fieldLabel: Zi.LAN.jsdxzh, //结算对象账号
readOnly: true,
name: 'CUSTACCOUNT'
},
{
fieldLabel: Zi.LAN.DateApplication, //申请日期
readOnly: true,
name: 'APPLYTIME'
}
]
}, {
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [this.comboxCurr, {
fieldLabel: 'RMB' + Zi.LAN.AmountOfMoney, //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: 'USD' + Zi.LAN.AmountOfMoney, //USD金额'
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;
}
}, {
fieldLabel: Zi.LAN.otherwb, //其他外币金额'
readOnly: true,
name: 'AMOUNTOT',
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: Zi.LAN.jhEMB, //计划结算RMB
name: 'PREAMOUNTRMB'
}, {
fieldLabel: Zi.LAN.jhUSD, //计划结算USD
name: 'PREAMOUNTUSD'
}]
}, {
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [this.comboxStlMode, {
fieldLabel: Zi.LAN.ApplyPaymentDate, //申请支付日期
format: 'Y-m-d',
xtype: 'datetimefield',
allowBlank: false,
name: 'PAYABLETIME'
}, {
fieldLabel: Zi.LAN.Applicant, //申请人
readOnly: true,
name: 'APPLICANTNAME'
}, {
fieldLabel: Zi.LAN.jhjies, //计划结算其他'
name: 'PREAMOUNTOT'
}, {
fieldLabel: Zi.LAN.weisq + 'RMB', //未申请RMB
readOnly: true,
name: 'BALAMOUNTRMB'
}, {
fieldLabel: Zi.LAN.weisq + 'USD', //未申请USD
readOnly: true,
name: 'BALAMOUNTUSD'
}
]
}, {
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [{
fieldLabel: Zi.LAN.zptait, //支票抬头
name: 'CHEQUEPAYABLE'
}, {
fieldLabel: Zi.LAN.zpbzhu, //支票备注
flex: 1,
name: 'CHEQUENUMREMARK'
}, {
fieldLabel: Zi.LAN.InvoiceNumber, //发票号
flex: 1,
name: 'INVNO'
}, {
fieldLabel: Zi.LAN.fpdate, //发票日期
flex: 1,
format: 'Y-m-d',
xtype: 'datefield',
name: 'INVDATE'
}, {
fieldLabel: Zi.LAN.weisqOther, //未申请其他
readOnly: true,
name: 'BALAMOUNTOT'
}, { xtype: 'hiddenfield' }
]
}, {
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [{
fieldLabel: Zi.LAN.Remarks, //备注
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: Zi.LAN.sypiao, //上一票
// iconCls: "btnsave",
handler: function (button, event) {
this.PrevRecord();
},
scope: this
}, {
id: 'btnENext',
text: Zi.LAN.xypiao, //下一票"
// iconCls: "btnsave",
handler: function (button, event) {
this.NextRecord();
},
scope: this
}, {
id: 'btnESave',
text: Zi.LAN.Save, //保存"
iconCls: "btnsave",
handler: function (button, event) {
this.Save('0', '0');
},
scope: this
}, '-',
{
text: Zi.LAN.print, //打印
handler: function (button, event) {
this.Print();
},
scope: this
},
'-',
{
id: 'btnESaveAndClose',
text: Zi.LAN.saveandclose, //保存并关闭
handler: function (button, event) {
this.Save('1', '0');
},
scope: this
},
'-',
{
id: 'btnESaveAndNew',
text: Zi.LAN.saveandnew, //保存并新建
handler: function (button, event) {
this.Save('2', '0');
this.GetEditStatus();
},
scope: this
},
'-',
{
id: 'btnENew',
text: Zi.LAN.xnew, //新建
handler: function (button, event) {
this.LoadData('add', '*');
},
scope: this
}, '-', {
id: 'btnSubmitAudit',
text: Zi.LAN.tjshe,
tooltip: Zi.LAN.tjshe, //提交审核
handler: function (button, event) {
// this.onSubmitAuditClick();
this.Save('0', '1');
},
scope: this
}, '-', {
id: 'btnSubmitAuditBack',
text: Zi.LAN.cxsh,
tooltip: Zi.LAN.cxsh, //撤销审核
handler: function (button, event) {
this.onSubmitAuditBackClick();
},
scope: this
}, '-', {
xtype: 'checkbox',
fieldLabel: Zi.LAN.chatts, //微信推送
labelWidth: 60,
labelAlign: "right",
id: 'wxpush',
vertical: true,
handler: function (obj, checked) {
},
scope: this
}
]
}); //end 按钮Toolbar
//#endregion
//#region 明细表
//明细表表格相关
this.GridCheckBoxModel = Ext.create('Ext.selection.CheckboxModel');
//明细表-数据集
this.storeBodyList = Ext.create('Ext.data.Store', {
model: 'TruckChfee_do_detail',
pageSize: this.BodyPageSize,
remoteSort: true,
proxy: {
type: 'ajax',
url: '/Account/Chfee_payapplication/GetTruckBillList',
timeout: 120000,
reader: {
id: 'BSNO,FEEDOID',
root: 'data',
totalProperty: 'totalCount'
}
}
});
this.BodyPagenum = Ext.create('Ext.form.field.Number', {
name: 'bottles',
fieldLabel: Zi.LAN.NumberOfpage, //每页记录数
labelAlign: 'right',
value: this.BodyPageSize,
maxValue: 100000,
width: 180,
minValue: 0,
listeners: {
specialkey: function (field, e) {
if (e.getKey() == e.ENTER) {
_this.storeBodyList.reload();
}
}
}
});
//明细表表格
this.gridListCellEditing = Ext.create('Ext.grid.plugin.CellEditing', {
clicksToEdit: 1
});
this.initgirdbillcolums = [{
sortable: true,
dataIndex: '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: Zi.LAN.DelegateNumber, //委托编号
width: 120
}, {
sortable: true,
dataIndex: 'MBLNO',
header: Zi.LAN.ZhuTDH, //主提单号
width: 120
}, {
sortable: true,
dataIndex: 'ORDERNO',
header: '客户订单号', //主提单号
width: 120
}, {
sortable: true,
dataIndex: 'CONTRACTNO',
header: '合同号', //主提单号
width: 100
}, {
sortable: true,
dataIndex: 'CUSTOMERNAME',
header: Zi.LAN.Requester, //委托单位
width: 100
}, {
sortable: true,
dataIndex: 'ETD',
header: '要求派车日期', //开船日期
renderer: Ext.util.Format.dateRenderer('Y-m-d'),
width: 100
}, {
sortable: true,
dataIndex: 'ETA',
header: '到货日期', //业务来源
width: 80
}, {
sortable: true,
dataIndex: 'FEENAME',
header: Zi.LAN.CostName, //费用名称
width: 80
}, {
sortable: true,
dataIndex: 'FEETYPEREF',
header: Zi.LAN.PayReceive, //收付
width: 40
}, {
sortable: true,
dataIndex: 'FEEOBJNAME',
header: Zi.LAN.fyduixiang, //费用对象
width: 80
}, {
sortable: true,
dataIndex: 'AMOUNT',
header: Zi.LAN.sjmoney, //申请金额
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: Zi.LAN.OriginalCurrency, //原始币别
width: 80
}, {
sortable: true,
dataIndex: 'ORIGEXCHANGERATE',
header: Zi.LAN.OriginalExchangeRate, //原始汇率
width: 80
}, {
sortable: true,
dataIndex: 'EXCHANGERATE',
header: Zi.LAN.ExchangeRate, //折算汇率
width: 80
}, {
sortable: true,
dataIndex: 'ORIGAMOUNT',
header: Zi.LAN.OriginalAmount, //原始金额
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: 'OP',
header: '操作',
width: 80
}, {
sortable: true,
dataIndex: 'CUSTATTN',
header: '客户联系人',
width: 80
}, {
sortable: true,
dataIndex: 'CUSTTEL',
header: '客户联系人电话',
width: 80
}, {
sortable: true,
dataIndex: 'CONSIGNEENAME',
header: '收货方',
width: 80
}, {
sortable: true,
dataIndex: 'CONSIGNEEATTN',
header: '收货联系人',
width: 80
}, {
sortable: true,
dataIndex: 'CONSIGNEETEL',
header: '收货联系人电话',
width: 80
}, {
sortable: true,
dataIndex: 'CONSIGNEEADDR',
header: '收货地址',
width: 80
}, {
sortable: true,
dataIndex: 'PORTLOAD',
header: '起运地',
width: 80
}, {
sortable: true,
dataIndex: 'PORTDISCHARGE',
header: '目的地',
width: 80
}, {
sortable: true,
dataIndex: 'GOODSNAME',
header: '品名',
width: 80
}, {
sortable: true,
dataIndex: 'KGS',
header: '毛重',
width: 80
}, {
sortable: true,
dataIndex: 'NETWEIGHT',
header: '净重',
width: 80
}, {
sortable: true,
dataIndex: 'CBM',
header: '尺码',
width: 80
}, {
sortable: true,
dataIndex: 'PKGS',
header: '数量',
width: 80
}, {
sortable: true,
dataIndex: 'CNTRTOTAL',
header: Zi.LAN.CNTRTOTAL, //录入方式
width: 100
}, {
sortable: true,
dataIndex: 'TRANSTYPE',
header:'单据类型', //录入方式
width: 100
}, {
sortable: true,
dataIndex: 'TRUCKER',
header: '承运商',
width: 80
}, {
sortable: true,
dataIndex: 'TRUCKNO',
header: '车号',
width: 80
}
];
this.girdbillcolums = this.initgirdbillcolums;
this.gridList = new Ext.grid.GridPanel({
store: this.storeBodyList,
enableHdMenu: false,
region: 'center',
loadMask: { msg: Zi.LAN.LoadData }, //数据加载中,请稍等...
trackMouseOver: true,
disableSelection: false,
selModel: this.GridCheckBoxModel,
viewConfig: {
enableTextSelection: true
},
tbar: [{
text: Zi.LAN.deletemx, //删除申请明细
tooltip: Zi.LAN.deletemx, //删除申请明细
id: 'btndeldetail',
iconCls: "btndeletedetail",
handler: function (button, event) {
this.onDeleteClick(button, event, 1);
},
scope: this
}, '-', {
text: Zi.LAN.ExportExcel, //导出Excel
id: "btnExportExcel",
iconCls: 'btnexportexcel',
handler: function (button, event) {
this.onExportClick(button, event);
},
scope: this
}, '-', {
text: Zi.LAN.Saveliststyle, //保存列表样式
id: "btntestbody",
menu: [
{ text: Zi.LAN.Save, //保存
handler: function (button, event) {
_this.girdbillcolums = DsTruck.SaveGridPanel(USERID, _this.formname + 'bill', _this.gridList.columns, _this.girdbillcolums, 1, true);
}
}, { text: Zi.LAN.Initialization, //初始化
handler: function (menu, event) {
_this.girdbillcolums = DsTruck.SaveGridPanel(USERID, _this.formname + 'bill', _this.gridList.columns, _this.initgirdbillcolums, 1, true);
}
}],
scope: this
},
{
fieldLabel: "单号",
labelWidth: 40,
xtype: 'textfield',
name: 'BSNO',
listeners: {
specialkey: function (field, e) {
if (e.getKey() == e.ENTER) {
var billno = _this.formEdit.getForm().findField('BILLNO').getValue();
var mblno = field.value;
var sql = " BILLNO='" + billno + "' and (b.MBLNO+b.HBLNO+b.CUSTNO like '%" + mblno + "%') ";
_this.storeBodyList.load({ params: { start: 0, limit: _this.BodyPageSize, condition: sql } });
}
}
}
}],
columns: this.girdbillcolums,
// paging bar on the bottom
bbar: [Ext.create('Ext.PagingToolbar', {
store: this.storeBodyList,
displayInfo: true,
displayMsg: Zi.LAN.FenYe, //当前显示条数据
emptyMsg: Zi.LAN.Nodata//没有数据
}), this.BodyPagenum]
});
this.gridList.addListener('sortchange', function (ct, column, direction, eOpts) {
this.sortfield = column.dataIndex;
this.sortdire = direction;
}, this);
this.gridList.addListener('itemdblclick', function (dataview, record, item, index, e, b) {
this.SelectedRecord = record;
var openSet = "height=700, width=1024, toolbar=no, menubar=no,scrollbars=1, resizable=1,location=no, status=no,Top= " + (screen.height - 750) / 2 + ",Left= " + (screen.width - 1100) / 2
var openType = "_blank";
var openUrl = "";
openUrl = "../../MvcShipping/MsOpBill/MsOpFeeView?handle=check&bsno=" + record.data.BSNO;
window.open(openUrl, openType, openSet);
}, this);
this.girdbillcolums = DsTruck.GetGridPanel(USERID, this.formname + 'bill', this.girdbillcolums, 1); //使用者id表名中间column数组跳过一开始的几列
this.girdbillcolums.unshift(new Ext.grid.RowNumberer());
this.gridList.reconfigure(this.storeBodyList, this.girdbillcolums);
this.storeBodySum = Ext.create('Ext.data.Store', {
model: 'Chfee_do_sum',
remoteSort: true,
proxy: {
type: 'ajax',
url: '/Account/Chfee_payapplication/GetBillSum',
reader: {
root: 'data',
totalProperty: 'totalCount'
}
}
});
this.gridSum = new Ext.grid.GridPanel({
store: this.storeBodySum,
enableHdMenu: false,
region: 'center',
loadMask: { msg: Zi.LAN.LoadData }, //数据加载中,请稍等...
trackMouseOver: true,
disableSelection: false,
tbar: [{
xtype: 'label',
width: 120,
height: 22,
text: Zi.LAN.TotalAmount//申请金额合计
}],
columns: [{
sortable: true,
dataIndex: 'FEETYPEREF',
header: Zi.LAN.PayReceive, //收付
width: 40
}, {
sortable: true,
dataIndex: 'CURRENCY',
header: Zi.LAN.Currency, //币 别
width: 80
}, {
sortable: true,
dataIndex: 'AMOUNT',
header: Zi.LAN.AmountOfMoney, //金额
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;
}
}
]
});
//#region 添加业务列表
this.storeBodyAddList = Ext.create('Ext.data.Store', {
pageSize: this.PageSize,
model: 'MsAddTruckBillCustFee',
remoteSort: true,
proxy: {
type: 'ajax',
timeout: 120000,
url: '/Account/Chfee_payapplication/GetTruckBillDataList',
reader: {
id: 'BSNO',
root: 'data',
totalProperty: 'totalCount'
}
}
});
this.Pagenum = Ext.create('Ext.form.field.Number', {
name: 'bottles',
fieldLabel: Zi.LAN.NumberOfpage, //每页记录数
labelAlign: 'right',
value: this.PageSize,
maxValue: 100000,
width: 180,
minValue: 0,
listeners: {
specialkey: function (field, e) {
if (e.getKey() == e.ENTER) {
_this.onRefreshClick();
}
}
}
});
this.initgirdbilladdcolums = [{
sortable: true,
dataIndex: 'BSNO',
header: 'BSNO',
hidden: true,
width: 100
}, {
sortable: true,
dataIndex: 'CUSTNO',
header: Zi.LAN.DelegateNumber, //委托编号
width: 108
}, {
sortable: true,
dataIndex: 'MBLNO',
header: Zi.LAN.ZhuTDH, //主提单号
width: 108
}, {
sortable: true,
dataIndex: 'FEEOBJNAME',
header: Zi.LAN.jfdanwei, //结费单位
width: 90
}, {
sortable: true,
dataIndex: 'RMBCrBalAmount',
header: Zi.LAN.weifu, //RMB未付
width: 85
}, {
sortable: true,
dataIndex: 'USDCrBalAmount',
header: 'USD' + Zi.LAN.weifu, //USD未付
width: 85
}, {
sortable: true,
dataIndex: 'OTCrBalAmount',
header: Zi.LAN.Otherwf, //其他未付
width: 85
}, {
sortable: true,
dataIndex: 'RMBDrBalAmount',
header: 'RMB' + Zi.LAN.weishou, //RMB未收
width: 85
}, {
sortable: true,
dataIndex: 'USDDrBalAmount',
header: 'USD' + Zi.LAN.weishou,
width: 85
}, {
sortable: true,
dataIndex: 'OTDrBalAmount',
header: Zi.LAN.otherws, //其他未收
width: 85
}, {
sortable: true,
dataIndex: 'BALRMBINVCR',
header: 'RMB' + Zi.LAN.fwkpiao, //RMB付未开票
width: 70
}, {
sortable: true,
dataIndex: 'BALUSDINVCR',
header: 'USD' + Zi.LAN.fwkpiao, //USD付未开票
width: 70
}, {
sortable: true,
dataIndex: 'ORDERNO',
header: '客户订单号', //主提单号
width: 120
}, {
sortable: true,
dataIndex: 'CONTRACTNO',
header: '合同号', //主提单号
width: 100
}, {
sortable: true,
dataIndex: 'CUSTOMERNAME',
header: Zi.LAN.Requester, //委托单位
width: 100
}, {
sortable: true,
dataIndex: 'ETD',
header: '要求派车日期', //开船日期
renderer: Ext.util.Format.dateRenderer('Y-m-d'),
width: 100
}, {
sortable: true,
dataIndex: 'ETA',
header: '到货日期', //业务来源
width: 80
}, {
sortable: true,
dataIndex: 'SALE',
header: '客户经理', //揽货人
width: 80
}, {
sortable: true,
dataIndex: 'OP',
header: '操作',
width: 80
}, {
sortable: true,
dataIndex: 'CUSTATTN',
header: '客户联系人',
width: 80
}, {
sortable: true,
dataIndex: 'CUSTTEL',
header: '客户联系人电话',
width: 80
}, {
sortable: true,
dataIndex: 'CONSIGNEENAME',
header: '收货方',
width: 80
}, {
sortable: true,
dataIndex: 'CONSIGNEEATTN',
header: '收货联系人',
width: 80
}, {
sortable: true,
dataIndex: 'CONSIGNEETEL',
header: '收货联系人电话',
width: 80
}, {
sortable: true,
dataIndex: 'CONSIGNEEADDR',
header: '收货地址',
width: 80
}, {
sortable: true,
dataIndex: 'PORTLOAD',
header: '起运地',
width: 80
}, {
sortable: true,
dataIndex: 'PORTDISCHARGE',
header: '目的地',
width: 80
}, {
sortable: true,
dataIndex: 'GOODSNAME',
header: '品名',
width: 80
}, {
sortable: true,
dataIndex: 'KGS',
header: '毛重',
width: 80
}, {
sortable: true,
dataIndex: 'NETWEIGHT',
header: '净重',
width: 80
}, {
sortable: true,
dataIndex: 'CBM',
header: '尺码',
width: 80
}, {
sortable: true,
dataIndex: 'PKGS',
header: '数量',
width: 80
}, {
sortable: true,
dataIndex: 'CNTRTOTAL',
header: Zi.LAN.CNTRTOTAL, //操作
width: 80
}, {
sortable: true,
dataIndex: 'RMBDRSTATUS',
header: Zi.LAN.RMBDRSTATUS, //操作
width: 80,
renderer: function (value, meta) {
if (value == '已收回') {
meta.tdCls = 'feestatus_pass';
} else if (value == '部分收回') {
meta.tdCls = 'feestatus_refer';
}
return value;
}
}, {
sortable: true,
dataIndex: 'USDDRSTATUS',
header: Zi.LAN.USDDRSTATUS, //操作
width: 80,
renderer: function (value, meta) {
if (value == '已收回') {
meta.tdCls = 'feestatus_pass';
} else if (value == '部分收回') {
meta.tdCls = 'feestatus_refer';
}
return value;
}
}];
this.girdbilladdcolums = this.initgirdbilladdcolums; //使用者id表名中间column数组跳过一开始的几列
this.AddGridCheckBoxModel = Ext.create('Ext.selection.CheckboxModel');
this.gridAddList = new Ext.grid.GridPanel({
store: this.storeBodyAddList,
enableHdMenu: false,
region: 'center',
loadMask: { msg: Zi.LAN.LoadData }, //数据加载中,请稍等...
trackMouseOver: true,
disableSelection: false,
selModel: this.AddGridCheckBoxModel,
viewConfig: {
enableTextSelection: true
},
tbar: [{
text: Zi.LAN.addjsmx, //添加结算明细
tooltip: Zi.LAN.addjsmx,
id: 'btnaddbill',
iconCls: "btnadddetail",
handler: function (button, event) {
this.onAddClick(button, event);
},
scope: this
}, '-', {
text: Zi.LAN.Saveliststyle, //保存列表样式
id: "btntest",
menu: [
{ text: Zi.LAN.Save, //保存
handler: function (button, event) {
_this.girdbilladdcolums = DsTruck.SaveGridPanel(USERID, _this.formname + 'billadd', _this.gridAddList.columns, _this.girdbilladdcolums, 1, true);
}
}, { text: Zi.LAN.Initialization, //初始化
handler: function (menu, event) {
_this.girdbilladdcolums = DsTruck.SaveGridPanel(USERID, _this.formname + 'billadd', _this.gridAddList.columns, _this.initgirdbilladdcolums, 1, true);
}
}],
scope: this
}],
columns: this.girdbilladdcolums,
// paging bar on the bottom
bbar: [Ext.create('Ext.PagingToolbar', {
store: this.storeBodyAddList,
displayInfo: true,
displayMsg: Zi.LAN.FenYe, //当前显示 {0} - {1}条记录 /共 {2}条记录
emptyMsg: Zi.LAN.Nodata//没有数据
}), this.Pagenum]
});
this.gridAddList.addListener('itemdblclick', function (dataview, record, item, index, e, b) {
this.SelectedRecord = record;
var openSet = "height=700, width=1024, toolbar=no, menubar=no,scrollbars=1, resizable=1,location=no, status=no,Top= " + (screen.height - 750) / 2 + ",Left= " + (screen.width - 1100) / 2
var openType = "_blank";
var openUrl = "";
openUrl = "../../MvcShipping/MsOpBill/MsOpFeeView?handle=check&bsno=" + record.data.BSNO;
window.open(openUrl, openType, openSet);
}, this);
this.girdbilladdcolums = DsTruck.GetGridPanel(USERID, this.formname + 'billadd', this.girdbilladdcolums, 1); //使用者id表名中间column数组跳过一开始的几列
this.girdbilladdcolums.unshift(new Ext.grid.RowNumberer());
this.gridAddList.reconfigure(this.storeBodyAddList, this.girdbilladdcolums);
this.gridAddList.addListener('sortchange', function (ct, column, direction, eOpts) {
this.addsortfield = column.dataIndex;
this.addsortdire = direction;
}, this);
_this = this;
this.CurrGroup = new Ext.form.RadioGroup({
id: 'CurrGroup',
xtype: 'radiogroup',
fieldLabel: Zi.LAN.zdbibie, //折算币别
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_add_detail',
remoteSort: true,
proxy: {
type: 'ajax',
url: '/Account/Chfee_payapplication/GetFeeDetailList',
reader: {
id: 'CH_ID',
root: 'data',
totalProperty: 'totalCount'
}
}
});
this.AddFeeGridCheckBoxModel = Ext.create('Ext.selection.CheckboxModel');
this.cellEditingFee = Ext.create('Ext.grid.plugin.CellEditing', {
clicksToEdit: 1,
listeners: {
'edit': function (editor, e) {
}
}
});
this.initgirdfeecolums = [{
sortable: true,
dataIndex: 'CH_ID',
header: 'CH_ID',
hidden: true,
width: 100
}, {
sortable: true,
dataIndex: 'BSNO',
header: 'BSNO',
hidden: true,
width: 100
}, {
sortable: true,
dataIndex: 'CustomerName',
header: Zi.LAN.kehname, //客户名称
width: 90
}, {
sortable: true,
dataIndex: 'FeeType_Ref',
header: Zi.LAN.PayReceive, //收付
width: 40
}, {
sortable: true,
dataIndex: 'FeeName',
header: Zi.LAN.CostName, //费用名称
width: 90
}, {
sortable: true,
dataIndex: 'Amount',
header: Zi.LAN.AmountOfMoney, //金额
width: 70,
renderer: function (value, cellmeta, record, rowIndex, columnIndex, store) {
try {
var lsValue = usMoney(value, 2, '', false);
if (lsValue != "NaN") {
value = lsValue; if (parseFloat(lsValue) < 0) {
return '<SPAN style="COLOR: red">' + lsValue + '</SPAN>';
}
}
else {
return value;
}
}
catch (e) {
return value;
}
return value;
}
}, {
sortable: true,
dataIndex: 'Currency',
header: Zi.LAN.Currency, //币别
width: 40
}, {
sortable: true,
dataIndex: 'BalAmount',
header: Zi.LAN.wjmoney, //未结金额
width: 70
}, {
sortable: true,
dataIndex: 'StlAmount',
header: Zi.LAN.bcjsmoney, //本次结算金额
editor: {
xtype: 'numberfield',
keyNavEnabled: false,
allowDecimals: true,
decimalPrecision: 2,
selectOnFocus: true,
mouseWheelEnabled: false,
enableKeyEvents: true,
listeners: {
keydown: function (textfield, e) {
if (e.getKey() == 40) {
_this.onNextKeyClick(9)
} else if (e.getKey() == 38) {
_this.onUpKeyClick(9)
}
}
}
},
renderer: function (value, cellmeta, record, rowIndex, columnIndex, store) {
try {
var lsValue = usMoney(value, 2, '', false);
if (lsValue != "NaN") {
value = lsValue; if (parseFloat(lsValue) < 0) {
return '<SPAN style="COLOR: red">' + lsValue + '</SPAN>';
}
}
else {
return value;
}
}
catch (e) {
return value;
}
return value;
},
width: 70
}, {
sortable: true,
dataIndex: 'ExChangerate',
header: Zi.LAN.OriginalExchangeRate, //原始汇率
width: 60
}, {
sortable: true,
dataIndex: 'Invoice',
header: Zi.LAN.kpmoney, //开票金额
width: 60,
renderer: function (value, cellmeta, record, rowIndex, columnIndex, store) {
try {
var lsValue = usMoney(value, 2, '', false);
if (lsValue != "NaN") {
value = lsValue; if (parseFloat(lsValue) < 0) {
return '<SPAN style="COLOR: red">' + lsValue + '</SPAN>';
}
}
else {
return value;
}
}
catch (e) {
return value;
}
return value;
}
}, {
sortable: true,
dataIndex: 'Remark',
header: Zi.LAN.Remarks, //备注
width: 180
}, {
sortable: true,
dataIndex: 'INPUTMODE',
header: Zi.LAN.EntryMethod, //录入方式
width: 60
}
];
this.girdfeecolums = this.initgirdfeecolums;
this.gridAddFeeList = new Ext.grid.GridPanel({
store: this.storeAddFeeList,
enableHdMenu: false,
region: 'center',
loadMask: { msg: Zi.LAN.LoadData }, //数据加载中,请稍等..
trackMouseOver: true,
disableSelection: false,
plugins: [this.cellEditingFee],
selModel: this.AddFeeGridCheckBoxModel,
tbar: [{
text: Zi.LAN.addfsymx, //添加申请费用明细
tooltip: Zi.LAN.addfsymx,
iconCls: "btnadddetail",
id: "btnadddetail",
handler: function (button, event) {
this.onAddDetailClick(button, event);
},
scope: this
}, '-', {
text: Zi.LAN.Saveliststyle, //保存列表样式
id: "btntestfee",
menu: [
{ text: Zi.LAN.Save, //保存
handler: function (button, event) {
_this.girdfeecolums = DsTruck.SaveGridPanel(USERID, _this.formname + 'feeadd', _this.gridAddFeeList.columns, _this.girdfeecolums, 1, true);
}
}, { text: Zi.LAN.Initialization, //初始化
handler: function (menu, event) {
_this.girdfeecolums = DsTruck.SaveGridPanel(USERID, _this.formname + 'feeadd', _this.gridAddFeeList.columns, _this.initgirdfeecolums, 1, true);
_this.gridAddFeeList.reconfigure(_this.storeAddFeeList, _this.girdfeecolums);
}
}],
scope: this
}, { xtype: "label", id: "zongshu", text: "",
handler: function () { ; }
}],
columns: this.girdfeecolums,
// paging bar on the bottom
bbar: Ext.create('Ext.PagingToolbar', {
store: this.storeAddFeeList,
displayInfo: true,
displayMsg: Zi.LAN.FenYe, //当前显示 {0} - {1}条记录 /共 {2}条记录
emptyMsg: Zi.LAN.Nodata//没有数据
})
});
this.girdfeecolums = DsTruck.GetGridPanel(USERID, this.formname + 'feeadd', this.girdfeecolums, 1); //使用者id表名中间column数组跳过一开始的几列
this.gridAddFeeList.reconfigure(this.storeAddFeeList, this.girdfeecolums);
this.gridAddFeeList.on('edit', function (editor, e, eOpts) {
this.gridAddFeeListAfterEdit(editor, e, eOpts);
}, this);
this.gridAddFeeList.on('cellclick', function (button, event) {
this.onSelectFee(button, event);
}, this);
this.storeSelectSum = Ext.create('Ext.data.Store', {
model: 'Chfee_do_selectsum'
});
this.gridSelectSum = new Ext.grid.GridPanel({
store: this.storeSelectSum,
enableHdMenu: false,
// anchor: '100% 50%',
region: 'south',
height: 80,
loadMask: { msg: Zi.LAN.LoadData }, //数据加载中,请稍等...
trackMouseOver: true,
disableSelection: false,
tbar: [{
xtype: 'label',
width: 220,
id: 'SelectGrid',
height: 22,
text: Zi.LAN.countfyong//所选费用合计
}],
columns: [{
sortable: true,
dataIndex: 'RMBDRAMOUNT',
header: 'RMB' + Zi.LAN.weishou, //RMB未收
width: 80
}, {
sortable: true,
dataIndex: 'RMBCRAMOUNT',
header: 'RMB' + Zi.LAN.weifu, //RMB未付
width: 80
}, {
sortable: true,
dataIndex: 'USDDRAMOUNT',
header: 'USD' + Zi.LAN.weishou, //USD未收
width: 80
}, {
sortable: true,
dataIndex: 'USDCRAMOUNT',
header: 'USD' + Zi.LAN.weifu, //USD未付
width: 80
}, {
sortable: true,
dataIndex: 'OTDRAMOUNT',
header: Zi.LAN.otherws, //其他未收
width: 80
}, {
sortable: true,
dataIndex: 'OTCRAMOUNT',
header: Zi.LAN.Otherwf, //其他未付
width: 80
}
]
});
//#endregion
_this = this;
this.storeCustCodefee = Ext.create('DsExt.ux.RefTableStore', {
model: 'DsShipping.ux.CustomRefModel',
proxy: { url: '/CommMng/BasicDataRef/GetCustomRefListRm' }
});
// this.storeCustCodefee.load({ params: { condition: ""} });
this.comboxAddCustCode = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: Zi.LAN.fyduixiang, //费用对象
store: this.storeCustCodefee,
queryMode: 'remote',
// forceSelection: true,
minChars: 1,
queryParam: 'CODENAME',
name: 'CUSTNAME',
valueField: 'CustName',
displayField: 'CodeAndName',
enableKeyEvents: true,
listeners: {
keyup: function (field, e) {
if (e.getKey() == e.ENTER) {
_this.onRefreshClick();
}
}
}
});
this.StoreOpLb = Ext.create('DsExt.ux.RefEnumStore', {});
this.StoreOpLb.load({ params: { enumTypeId: 96005} });
this.comboxOpLb = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: Zi.LAN.yewutype, //业务类别
store: this.StoreOpLb,
valueField: 'EnumValueName',
displayField: 'EnumValueName',
forceSelection: true,
name: 'OPLBNAME',
enableKeyEvents: true,
listeners: {
keyup: function (field, e) {
if (e.getKey() == e.ENTER) {
_this.onRefreshClick();
}
}
}
});
this.storeAddDCType = Ext.create('Ext.data.Store', {
fields: ['DC', 'NAME']
});
this.storeAddDCType.add({ "DC": "", "NAME": "全部" }); //全部
this.storeAddDCType.add({ "DC": "1", "NAME": "应收" }); //应收
this.storeAddDCType.add({ "DC": "2", "NAME": "应付" }); //应付
this.comboxaddDCType = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: Zi.LAN.shoufu, //收/付
store: this.storeAddDCType,
valueField: 'DC',
labelWidth: 50,
flex: 0.5,
displayField: 'NAME',
forceSelection: true,
name: 'DC',
value: '2',
enableKeyEvents: true,
listeners: {
keyup: function (field, e) {
if (e.getKey() == e.ENTER) {
_this.onRefreshClick();
}
}
}
});
this.comboxCurr2 = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: Zi.LAN.Currency, //币别
store: this.StoreCurr,
forceSelection: true,
labelWidth: 50,
flex: 0.5,
name: 'Currency',
valueField: 'CURR',
displayField: 'CURR',
enableKeyEvents: true,
listeners: {
keyup: function (field, e) {
if (e.getKey() == e.ENTER) {
_this.onRefreshClick();
}
}
}
});
this.storeFeeNameRef = Ext.create('DsExt.ux.RefTableStore', {
model: 'DsShipping.ux.FeeTypeRefModel',
proxy: { url: '/MvcShipping/MsChFee/GetFeeTypeRefList' }
});
this.comboxFeeNameRef = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: Zi.LAN.CostName, //费用名称
store: this.storeFeeNameRef,
forceSelection: true,
name: 'FeeName',
valueField: 'Name',
displayField: 'CodeAndName',
enableKeyEvents: true,
listeners: {
keyup: function (field, e) {
if (e.getKey() == e.ENTER) {
_this.onRefreshClick();
}
}
}
});
this.storeFeeNameRef.load({ params: { condition: ""} });
this.storeCurrExrate = Ext.create('Ext.data.Store', {
fields: ['CURR', 'EXRATE', 'DFEXRATE']
});
this.storeINVSTATUS = Ext.create('Ext.data.Store', {
fields: ['FSTATUS', 'NAME']
});
this.storeINVSTATUS.add({ "FSTATUS": "", "NAME": "全部" }); //全部
this.storeINVSTATUS.add({ "FSTATUS": "0", "NAME": "仅开票" }); //仅开票
this.storeINVSTATUS.add({ "FSTATUS": "1", "NAME": "仅不开票" }); //仅不开票
this.comboxINVSTATUS = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: Zi.LAN.iskaipiao, //是否开票
store: this.storeINVSTATUS,
valueField: 'FSTATUS',
displayField: 'NAME',
forceSelection: true,
name: 'ISINVOICE',
value: '',
enableKeyEvents: true,
listeners: {
keyup: function (field, e) {
if (e.getKey() == e.ENTER) {
_this.onRefreshClick();
}
}
}
});
this.storeISADVANCEDPAY = Ext.create('Ext.data.Store', {
fields: ['FSTATUS', 'NAME']
});
this.storeISADVANCEDPAY.add({ "FSTATUS": "", "NAME": "全部" }); //全部
this.storeISADVANCEDPAY.add({ "FSTATUS": "0", "NAME": "仅未垫付" }); //仅未垫付
this.storeISADVANCEDPAY.add({ "FSTATUS": "1", "NAME": "仅垫付" }); //仅垫付
this.comboxISADVANCEDPAY = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: Zi.LAN.isdianfu, //是否开垫付
store: this.storeISADVANCEDPAY,
valueField: 'FSTATUS',
displayField: 'NAME',
forceSelection: true,
name: 'ISADVANCEDPAY',
value: '',
enableKeyEvents: true,
listeners: {
keyup: function (field, e) {
if (e.getKey() == e.ENTER) {
_this.onRefreshClick();
}
}
}
});
this.storeListTruckLoadPort = Ext.create('Ext.data.Store', {
fields: [
{ name: 'PORTID', type: 'string' },
{ name: 'PORTCODE', type: 'string' },
{ name: 'PORT', type: 'string' },
{ name: 'CODEANDNAME', type: 'string' },
{ name: 'PROVINCE', type: 'string' }
],
pageSize: 5000,
remoteSort: true,
proxy: {
type: 'ajax',
url: '/TruckMng/MsCodeTruckPort/GetDataListRm',
reader: {
id: '',
root: 'data',
totalProperty: 'totalCount'
}
}
});
this.storeListTruckLoadPort.load();
this.comboxLoadPort = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: '起运地', //'费用类型',
store: this.storeListTruckLoadPort,
valueField: 'PORT',
displayField: 'CODEANDNAME',
queryMode: 'remote',
minChars: 0,
queryParam: 'CODENAME',
labelWidth: 60,
forceSelection: true,
name: 'PORTLOAD',
listeners: {
keyup: function (field, e) {
if (e.getKey() == e.ENTER) {
_this.onRefresh2Click();
}
}
}
});
this.storeListTruckDistPort = Ext.create('Ext.data.Store', {
fields: [
{ name: 'PORTID', type: 'string' },
{ name: 'PORTCODE', type: 'string' },
{ name: 'PORT', type: 'string' },
{ name: 'CODEANDNAME', type: 'string' },
{ name: 'PROVINCE', type: 'string' }
],
pageSize: 5000,
remoteSort: true,
proxy: {
type: 'ajax',
url: '/TruckMng/MsCodeTruckPort/GetDataListRm',
reader: {
id: '',
root: 'data',
totalProperty: 'totalCount'
}
}
});
this.storeListTruckDistPort.load();
this.comboxDistPort = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: '目的地', //'费用类型',
store: this.storeListTruckDistPort,
valueField: 'PORT',
displayField: 'CODEANDNAME',
queryMode: 'remote',
labelWidth: 60,
minChars: 0,
queryParam: 'CODENAME',
forceSelection: true,
name: 'PORTDISCHARGE',
listeners: {
keyup: function (field, e) {
if (e.getKey() == e.ENTER) {
_this.onRefresh2Click();
}
}
}
});
//客户加载_车队
this.storeTRUCKER = Ext.create('DsExt.ux.RefTableStore', {
model: 'DsShipping.ux.CustomRefModel',
proxy: { url: '/CommMng/BasicDataRef/GetCustomRefListTRUCK' }
});
//车队
this.comboxTRUCKER = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: '承运商', //'车队',
store: this.storeTRUCKER,
forceSelection: true,
queryMode: 'remote',
minChars: 0,
queryParam: 'CODENAME',
name: 'TRUCKER',
valueField: 'CustName',
displayField: 'CodeAndName'
});
//客户加载_委托单位
this.storeCustCode = Ext.create('DsExt.ux.RefTableStore', {
model: 'DsShipping.ux.CustomRefModel',
proxy: { url: '/CommMng/BasicDataRef/GetCustomRefListController' }
});
this.storeCustCode.load();
//委托单位
this.comboxCustCode = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: '委托单位',
store: this.storeCustCode,
queryMode: 'remote',
minChars: 0,
queryParam: 'CODENAME',
forceSelection: true,
name: 'CUSTOMERNAME',
valueField: 'CustName',
displayField: 'CodeAndFull',
enableKeyEvents: true,
listeners: {
//specialkey: function (field, e) {
keyup: function (field, e) {
if (e.getKey() == e.ENTER) {
_this.onRefreshClick();
}
}
}
});
this.storeTransStatus = Ext.create('Ext.data.Store', {
fields: ['DC', 'NAME']
});
this.storeTransStatus.add({ "DC": "新建", "NAME": "新建" });
this.storeTransStatus.add({ "DC": "提交审核", "NAME": "提交审核" });
this.storeTransStatus.add({ "DC": "审核通过", "NAME": "审核通过" });
this.storeTransStatus.add({ "DC": "在途", "NAME": "在途" });
this.storeTransStatus.add({ "DC": "已到货", "NAME": "已到货" });
// this.storeTransStatus.add({ "DC": "已回单", "NAME": "已回单" });
this.comboxTransStatus = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: '派车单状态', //'费用类型',
store: this.storeTransStatus,
valueField: 'DC',
displayField: 'NAME',
forceSelection: true,
name: 'TRANSSTATUS'
});
this.storeTransStatus2 = Ext.create('Ext.data.Store', {
fields: ['DC', 'NAME']
});
this.storeTransStatus2.add({ "DC": "新建", "NAME": "新建" });
this.storeTransStatus2.add({ "DC": "提交审核", "NAME": "提交审核" });
this.storeTransStatus2.add({ "DC": "审核通过", "NAME": "审核通过" });
this.storeTransStatus2.add({ "DC": "配载", "NAME": "配载" });
this.storeTransStatus2.add({ "DC": "完成", "NAME": "完成" });
this.comboxTransStatus2 = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: '订单状态', //'费用类型',
store: this.storeTransStatus2,
valueField: 'DC',
displayField: 'NAME',
value: '',
// readOnly: true,
forceSelection: true,
name: 'TRANSSTATUS2'
});
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: 'ORDERNO',
enableKeyEvents: true,
listeners: {
specialkey: function (field, e) {
if (e.getKey() == e.ENTER) {
_this.onRefreshClick();
}
}
}
}, {
fieldLabel:'车号', //编号检索
name: 'TRUCKNO',
enableKeyEvents: true,
listeners: {
specialkey: function (field, e) {
if (e.getKey() == e.ENTER) {
_this.onRefreshClick();
}
}
}
}, this.comboxLoadPort, this.comboxDistPort, {
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: 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) {
if (this.bsnosql == undefined) {
var sql = this.getCondition();
} else {
var sql = this.sqlcontext;
}
var winAccess = new Shipping.DsQuery({
});
winAccess.StoreList = this.storeBodyAddList;
winAccess.formname = this.formname;
winAccess.condition = sql;
winAccess.show();
return;
},
scope: this
}
]
}, {
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [this.comboxCustCode, this.comboxTRUCKER, this.comboxaddDCType, this.comboxCurr2, this.comboxFeeNameRef
, this.comboxTransStatus, this.comboxTransStatus2, {
fieldLabel: Zi.LAN.fphexiaohao, //发票核销号
name: 'InvNo',
enableKeyEvents: true,
listeners: {
specialkey: function (field, e) {
if (e.getKey() == e.ENTER) {
_this.onRefreshClick();
}
}
}
}, {
xtype: 'button',
width: 60,
text: Zi.LAN.onselect, //查询
iconCls: "btnrefresh",
handler: function (button, event) {
this.onRefreshClick(button, event);
},
scope: this
}
]
}
]//end items(fieldset 1)
}//end fieldset 1
]//end root items
});
//#region 附件上传
this.storeChfeeFile = Ext.create('Ext.data.Store', {
model: 'FeeFileModel',
remoteSort: false,
proxy: {
type: 'ajax',
url: '/Account/Chfee_payapplication/GetFileList',
reader: {
id: 'GID',
root: 'data',
totalProperty: 'totalCount'
}
}
});
//表格
this.FeeFileColumns = [
{
sortable: true, hidden: true,
dataIndex: 'GID', readOnly: true,
header: 'GID',
width: 80
}, {
sortable: true, hidden: false,
dataIndex: 'File_OriginalName', readOnly: true,
header: Zi.LAN.FileName, //文件名称
width: 80
}, {
sortable: true, hidden: false,
dataIndex: 'UpdateTime', readOnly: true,
header: Zi.LAN.FileDate, //上传日期
width: 80
}, {
sortable: true, hidden: false,
dataIndex: 'Operator', readOnly: true,
header: Zi.LAN.FilePerson, //上传者
width: 80
}, {
sortable: true, hidden: true,
dataIndex: 'File_Name', readOnly: true,
header: Zi.LAN.FileWName, //文件物理名称
width: 80
},
{
sortable: true, hidden: true,
dataIndex: 'File_Path',
header: 'File_Path',
width: 80
}, {
xtype: 'actioncolumn',
width: 50,
text: Zi.LAN.Operating, //操作
items: [{
icon: '/images/icons/btnSearch.gif', // Use a URL in the icon config
tooltip: '预览',
handler: function (grid, rowIndex, colIndex) {
var rec = grid.getStore().getAt(rowIndex);
var filePath = "/Areas/Account/Files/" + rec.get('BillNo') + '/' + rec.get('File_Name') + '?a=' + Math.random();
var imgView = new Shipping.FileView({ filePath: filePath });
imgView.show();
}
}]
}
];
var selCertModel = Ext.create('Ext.selection.CheckboxModel');
this.fileGrid = new Ext.grid.GridPanel({
store: this.storeChfeeFile,
enableHdMenu: false,
layout: 'border',
region: 'center',
loadMask: { msg: Zi.LAN.LoadData }, //数据加载中,请稍等...
trackMouseOver: true,
disableSelection: false,
selModel: selCertModel,
singleSelect: true,
selType: 'rowmodel',
tbar: [{
text: Zi.LAN.filetp, //上传图片
tooltip: Zi.LAN.filetp,
iconCls: "btnadddetail",
handler: function (button, event) {
this.onAddFileClick(button, event);
},
scope: this
}, '-', {
text: Zi.LAN.delete1, //删除
tooltip: Zi.LAN.delete1, //删除图片
iconCls: "btndeletedetail",
handler: function (button, event) {
this.onDelFileClick(button, event);
},
scope: this
}],
columns: this.FeeFileColumns
});
//#endregion附件上传
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",
height: 210,
region: "north",
split: true,
items: [
this.panelService, this.panelSum
]
});
//#region 增加附件上传tab
this.page_1 = new Ext.Panel({
id: "page_1",
title: Zi.LAN.sqmxi, //申请明细
autoScroll: true,
layout: "border",
region: 'center',
//closable:true,
items: [this.paneldetail]
});
this.page_2 = new Ext.Panel({
id: "page_2",
title: Zi.LAN.filefujina, //附件上传
autoScroll: true,
layout: "border",
region: 'center',
//closable:true,
items: [this.fileGrid]
});
this.MainTab = new Ext.tab.Panel({
layout: "border",
height: 250,
region: "north", split: true,
items: [
this.page_1
, this.page_2
]
});
//#endregion
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: Zi.LAN.addjsmingxi, //添加支付结算明细
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: 185,
items: [this.panelBtn, this.formEdit]
});
Ext.apply(this, {
items: [this.panelTop, this.MainTab, this.paneladd]
});
//#endregion
//绑定查询窗体
this.ParentWin = window.parent.opener;
//初始化数据
if (this.bsnosql == undefined) {
this.InitData();
} else {
this.opStatus = 'add'
this.StoreList = Ext.create('Ext.data.Store', {
pageSize: 50,
model: 'MsChPayapplication',
remoteSort: true,
proxy: {
type: 'ajax',
url: '/Account/Chfee_payapplication/GetDataList',
reader: {
id: 'BILLNO',
root: 'data',
totalProperty: 'totalCount'
}
}
});
// this.StoreList.load({ params: { condition:" 1=2 "} });
var bsnos = "";
var currsql = "";
if (this.ParentWin && this.bsnosql == 'oplist') {
var ret = this.ParentWin.OprationSwap();
bsnos = ret[3];
currsql = ret[6];
} else if (this.ParentWin && this.bsnosql == 'feelist') {
this.ParentWin = this.ParentWin._thisfee;
var ret = this.ParentWin.OprationSwap();
bsnos = ret[4];
currsql = ret[5];
}
this.comboxCustCode.allowBlank = true;
// this.comboxCurr.allowBlank = true;
var condition = '';
var sql = this.getCondition();
this.sqlcontext = sql + ' and ' + bsnos;
if (currsql != '')
this.FeeSqlStr = this.FeeSqlStr + ' and ' + currsql;
this.PageSize = this.Pagenum.getValue();
this.LoadData(this.opStatus, condition);
this.LoadMustBe();
}
//绑定事件
var billno = '*';
if (this.opStatus == 'edit') {
billno = this.editRecord.get('BILLNO');
};
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.storeAddFeeList.on('beforeload', function (store) {
var sql = '';
if (this.selectfeesql == '')
sql = '1=2 ';
else
sql = this.selectfeesql;
Ext.apply(store.proxy.extraParams, { condition: sql });
}, this);
this.storeBodyAddList.on('load', function (store, records) {
if (store.getCount() > 0) {
// this.gridAddList.getSelectionModel().select(0);
var btnEAddbill = Ext.getCmp('btnaddbill');
if (this.canedit)
btnEAddbill.enable();
} else {
this.storeAddFeeList.removeAll();
}
}, this);
this.storeAddFeeList.on('load', function (store, records) {
if (store.getCount() > 0) {
var btnEAddDetail = Ext.getCmp('btnadddetail');
if (this.canedit)
btnEAddDetail.enable();
} else {
}
}, this);
var isloadfee = true;
this.gridAddList.getSelectionModel().on('select', function (model, record, index) {
if (!isloadfee) return;
var bsno = record.data.BSNO;
var feeobjname = record.data.FEEOBJNAME;
var sql = "";
sql = " BSNO='" + bsno + "' AND CUSTOMERNAME='" + feeobjname + "'";
sql = sql + getAndConSql(sql, this.FeeSqlStr, this.FeeSqlStr);
isloadfee = false;
this.selectfeesql = sql;
this.storeAddFeeList.load({ params: { condition: sql },
callback: function (r, options, success) {
if (success) {
isloadfee = true;
}
}
});
// this.onSelectFee(button, event);
}, this);
_this = this;
this.gridAddList.on({
selectionchange: function (sm, selections) {
var SelectGridtext = Ext.getCmp('SelectGrid');
_this.storeSelectSum.removeAll();
SelectGridtext.setText(Zi.LAN.countfyong); //所选费用合计
if (selections.length == 0) {
return;
}
_this.storeSelectSum.add({ "RMBDRAMOUNT": 0, "RMBCRAMOUNT": 0, "USDDRAMOUNT": 0, "USDCRAMOUNT": 0, "OTDRAMOUNT": 0, "OTCRAMOUNT": 0 });
var R = selections.length;
for (var i = 0; i < selections.length; i++) {
var rec = selections[i];
var memberyf = _this.storeSelectSum.getAt(0);
var amount = memberyf.data.RMBDRAMOUNT;
var cramount = memberyf.data.RMBCRAMOUNT;
amount = (parseFloat(amount).add(parseFloat(rec.data.RMBDrBalAmount))).toFixed(2);
cramount = (parseFloat(cramount).add(parseFloat(rec.data.RMBCrBalAmount))).toFixed(2);
var usdamount = memberyf.data.USDDRAMOUNT;
var usdcramount = memberyf.data.USDCRAMOUNT;
usdamount = (parseFloat(usdamount).add(parseFloat(rec.data.USDDrBalAmount))).toFixed(2);
usdcramount = (parseFloat(usdcramount).add(parseFloat(rec.data.USDCrBalAmount))).toFixed(2);
var otamount = memberyf.data.OTDRAMOUNT;
var otcramount = memberyf.data.OTCRAMOUNT;
otamount = (parseFloat(otamount).add(parseFloat(rec.data.OTDrBalAmount))).toFixed(2);
otcramount = (parseFloat(otcramount).add(parseFloat(rec.data.OTCrBalAmount))).toFixed(2);
memberyf.set("RMBDRAMOUNT", amount);
memberyf.set("RMBCRAMOUNT", cramount);
memberyf.set("USDDRAMOUNT", usdamount);
memberyf.set("USDCRAMOUNT", usdcramount);
memberyf.set("OTDRAMOUNT", otamount);
memberyf.set("OTCRAMOUNT", otcramount);
memberyf.commit();
}
SelectGridtext.setText(Zi.LAN.countfyong + Zi.LAN.selecto + R + Zi.LAN.pyewu); //所选费用合计(选中' + R + '票业务)'
}
});
}, //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);
this.LoadMustBe();
}, //end InitData
LoadData: function (opstatus, condition) {
this.serialNo = 0;
this.workSerialNo = 0;
this.bodyDel = [];
this.opStatus = opstatus;
_this = this;
Ext.Ajax.request({
waitMsg: Zi.LAN.onselect, //正在查询主表数据...'
url: '/Account/Chfee_payapplication/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: Zi.LAN.Prompt, //提示
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);
BillNo = data.BILLNO;
BillState = data.BILLSTATUSREF;
this.storeChfeeFile.load({ params: { start: 0, limit: 9999, BillNo: BillNo} });
if (this.bsCust != undefined) {
_this.formEdit.getForm().findField('CUSTOMERNAME').setValue(this.bsCust)
this.LoadCustACCOUNT(this.bsCust);
_this.formSearch.getForm().findField('CUSTNAME').setValue(this.bsCust);
} else {
if (data.CUSTOMERNAME != "") {
/*
this.storeCustACCOUNT.load({
async: false,
params: { condition: " LINKID=(select GID from info_client where shortname='" + data.CUSTOMERNAME + "') " }
});*/
this.LoadCustACCOUNT(data.CUSTOMERNAME, true, data);
}
_this.formSearch.getForm().findField('CUSTNAME').setValue(data.CUSTOMERNAME);
}
if (this.bsnosql != undefined) {
this.storeBodyAddList.pageSize = this.PageSize;
this.storeBodyAddList.load({ params: { start: 0, limit: this.PageSize, sort: '', condition: this.sqlcontext },
callback: function (r, options, success) {
if (success) {
if (r.length != 0) {
_this.gridAddList.getSelectionModel().selectAll();
_this.addBill();
} else {
Ext.MessageBox.alert('提示', '无添加申请费用明细!');
}
}
}
});
}
_this.GetEditStatus();
if (data.WxPush == 0) {
Ext.getCmp("wxpush").setValue(false);
} else {
Ext.getCmp("wxpush").setValue(true);
}
} else {
Ext.MessageBox.alert(Zi.LAN.qqerror, response.responseText); //请求出现错误,请重试
}
},
scope: this
});
var billno = '*';
if (this.opStatus == 'edit') {
billno = this.editRecord.get('BILLNO');
};
this.storeBodyList.load({ params: { start: 0, limit: this.BodyPageSize, condition: " BILLNO='" + 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.storeBodySum.load({ params: { condition: " BILLNO='" + billno + "'"} });
// this.storeFeeList.load({ params: { condition: " DUINO='" + billno + "'"} });
}, // end LoadDate
Save: function (type, submit) {
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);
var wxpush = Ext.getCmp("wxpush").getValue();
var pushvalue = 0;
if (wxpush) {
pushvalue = 1;
} else {
pushvalue = 0;
}
data.wxpush = pushvalue;
Ext.Msg.wait(Zi.LAN.nowsave); //正在保存数据, 请稍侯.
Ext.Ajax.request({
waitMsg: Zi.LAN.nowsave, //正在保存数据..
url: '/Account/Chfee_payapplication/Save',
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.opStatus == 'add') {
var arrNewRecords = this.StoreList.insert(0, returnData);
this.editRecord = this.StoreList.getAt(0);
}
else if (this.opStatus == 'edit') {
var editp = Ext.create('MsChPayapplication', 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', '');
}
//提交审核
if (submit == '1') {
this.onSubmitAuditClick();
}
} else {//错误
Ext.Msg.show({ title: Zi.LAN.Error, msg: jsonresult.Message, icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK });
}
} else {//请重试
Ext.Msg.show({ title: Zi.LAN.qagin,
msg: Zi.LAN.FuWuQiError, //服务器响应出错
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); //提示', msg: '申请金额不能大于未申金额!
Ext.Msg.show({ title: Zi.LAN.Prompt, msg: Zi.LAN.sqmoneybuneng, icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
}
} else {
if (StlAmount < BalAmount) {
e.record.set('StlAmount', BalAmount); //提示', msg: '申请金额不能大于未申金额!'
Ext.Msg.show({ title: Zi.LAN.Prompt, msg: Zi.LAN.sqmoneybuneng, icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
}
}
}
},
onNextKeyClick: function (col) {
var rows = this.gridAddFeeList.getSelectionModel().getSelection();
var row = rows[rows.length - 1];
var s = this.gridAddFeeList.getStore();
var number = s.indexOf(row) + 1;
this.cellEditingFee.startEditByPosition({ row: number, column: col });
},
onUpKeyClick: function (col) {
var rows = this.gridAddFeeList.getSelectionModel().getSelection();
var row = rows[rows.length - 1];
var s = this.gridAddFeeList.getStore();
var number = s.indexOf(row) - 1;
if (number < 0) number = 0;
this.cellEditingFee.startEditByPosition({ row: number, column: col });
},
addDetail: function () {
var btnEAddDetail = Ext.getCmp('btnadddetail');
btnEAddDetail.disable();
var basicForm = this.formEdit.getForm();
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 selectedRecords = this.gridAddFeeList.selModel.getSelection();
if (selectedRecords.length > 0) {
var rec = selectedRecords[0];
var cust = rec.data.CustomerName;
var curr = rec.data.Currency;
if ((CUSTOMERNAME == '') || (CUSTOMERNAME == null))
this.formEdit.getForm().findField('CUSTOMERNAME').setValue(cust);
/*
this.storeCustACCOUNT.load({
async: false,
params: { condition: " LINKID=(select GID from info_client where shortname='" + cust + "') " }
});*/
this.LoadCustACCOUNT(cust);
}
}
var STLDATE = this.formEdit.getForm().findField('PAYABLETIME').getValue();
if ((STLDATE == '') || (STLDATE == null)) {
var myDate = new Date();
var mydatestr = Ext.util.Format.date(myDate, 'Y-m-d');
this.formEdit.getForm().findField('PAYABLETIME').setValue(mydatestr);
}
if (!basicForm.isValid()) {
btnEAddDetail.enable();
return;
}
var type = 0;
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(Zi.LAN.nowsave); //正在保存数据, 请稍侯..
Ext.Ajax.request({
waitMsg: Zi.LAN.nowsave, //正在保存数据...
url: '/Account/Chfee_payapplication/Save',
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.opStatus == 'add') {
var arrNewRecords = this.StoreList.insert(0, returnData);
this.editRecord = this.StoreList.getAt(0);
}
else if (this.opStatus == 'edit') {
var editp = Ext.create('MsChPayapplication', 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.addDetailfn();
} else {
btnEAddDetail.enable(); //错误
Ext.Msg.show({ title: Zi.LAN.Error, msg: jsonresult.Message, icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK });
}
} else {
btnEAddDetail.enable();
Ext.Msg.show({ title: Zi.LAN.qagin, //请重试
msg: Zi.LAN.FuWuQiError, //服务器响应出错
icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK
});
}
}
});
} else {
this.addDetailfn();
}
},
addDetailfn: function () {
var btnEAddDetail = Ext.getCmp('btnadddetail');
if (this.addstore) {
this.storeCurrExrate.removeAll();
this.addstore = false;
}
var Duino = this.formEdit.getForm().findField('BILLNO').getValue();
var billstatus = this.formEdit.getForm().findField('BILLSTATUS').getValue();
if ((billstatus != 1) && (billstatus != 6)) {
//提示', msg: '当前状态无法添加付费申请明细!
Ext.Msg.show({ title: Zi.LAN.Prompt, msg: Zi.LAN.dqstatenot, icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
btnEAddDetail.enable();
return;
}
var basicForm = this.formEdit.getForm();
var billcust = this.editRecord.data.CUSTOMERNAME;
var billno = this.editRecord.data.BILLNO;
var billcurr = this.editRecord.data.CURR;
var billgroupcorp = this.GetGroupCorp(billcust);
var selectedRecords = this.gridAddFeeList.selModel.getSelection();
var bodyAddDatas = [];
_this = this;
for (var i = 0; i < selectedRecords.length; i++) {
var rec = selectedRecords[i];
var cust = rec.data.CustomerName;
var custgroupcorp = this.GetGroupCorp(cust);
var bsno = rec.data.BSNO;
var curr = rec.data.Currency;
var ExChangerate = rec.data.ExChangerate;
if (cust == billcust || cust == billgroupcorp || (custgroupcorp == billgroupcorp && custgroupcorp != '')) {
if (billcurr == curr || billcurr == null || billcurr == '') {
rec.data.DoAmount = rec.data.StlAmount;
} else {
var recs = DsStoreQueryBy(_this.storeCurrExrate, 'CURR', curr);
if (recs.getCount() > 0) {
var data = recs.getAt(0).data;
var EXRATE = data.EXRATE;
rec.data.ExChangerate = EXRATE;
rec.data.DoAmount = parseFloat(rec.data.StlAmount).mul(parseFloat(EXRATE));
} else {
_this.ExrateConversion(curr, billcurr, 'detail', ExChangerate);
return;
}
}
bodyAddDatas.push(rec);
} else {
// Ext.Msg.show({ title: '提示', msg: '费用对象与付费申请客户不一致,不能添加此费用明细!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
alert(Zi.LAN.notaddfeiyongmingxi); //费用对象与付费申请客户不一致,不能添加此费用明细!
}
}
if (bodyAddDatas.length == 0) {//'提示', msg: '没有要添加的费用明细!
Ext.Msg.show({ title: Zi.LAN.Prompt, msg: Zi.LAN.notaddmingxi, icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
btnEAddDetail.enable();
return;
};
var jsonbodyAddDatas = ConvertRecordsToJsonAll(bodyAddDatas);
Ext.Ajax.request({
waitMsg: Zi.LAN.addnumnow, //正在添加数据
url: '/Account/Chfee_payapplication/AddDetail',
params: {
bill: billno,
data: jsonbodyAddDatas,
curr: billcurr
},
callback: function (options, success, response) {
if (success) {
var result = Ext.JSON.decode(response.responseText);
if (!result.Success) {
Ext.Msg.show({
title: Zi.LAN.Prompt, //提示
msg: result.Message,
icon: Ext.MessageBox.ERROR,
buttons: Ext.Msg.OK
});
btnEAddDetail.enable();
return;
} else {
if (result.Message != '添加成功') {//添加成功
Ext.MessageBox.alert(Zi.LAN.Prompt, result.Message); //提示
}
var sql = this.sqlcontext;
this.storeAddFeeList.reload();
// this.storeBodyAddList.load({ params: { start: 0, limit: _this.PageSize, sort: '', condition: sql} });
if (this.storeBodyList.getCount() != 0) {
_this.storeBodyList.reload({
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
});
} else {
_this.storeBodyList.load({
params: { start: 0, limit: _this.BodyPageSize, condition: " BILLNO='" + 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.storeBodySum.load({ params: { condition: " BILLNO='" + billno + "'"} });
Ext.Ajax.request({
waitMsg: Zi.LAN.onselect, //正在查询主表数据
url: '/Account/Chfee_payapplication/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: Zi.LAN.Prompt, //提示
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);
var editp = Ext.create('MsChPayapplication', 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(Zi.LAN.qqerror, response.responseText);
}
},
scope: this
});
}
} else {
btnEAddDetail.enable(); //请求出现错误,请重试
Ext.MessageBox.alert(Zi.LAN.qqerror, response.responseText);
}
},
scope: this
});
},
addBill: function () {
var basicForm = this.formEdit.getForm();
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)) {
if (this.storeAddFeeList.getCount() > 0) {
var rec = this.storeAddFeeList.getAt(0);
var cust = rec.data.CustomerName;
var curr = rec.data.Currency;
if ((CUSTOMERNAME == '') || (CUSTOMERNAME == null))
this.formEdit.getForm().findField('CUSTOMERNAME').setValue(cust);
// if ((CURR == '') || (CURR == null))
// this.formEdit.getForm().findField('CURR').setValue(curr);
} else {
btnEAddbill.enable(); //'提示', msg: '核算客户不能为空!'
Ext.Msg.show({ title: Zi.LAN.Prompt, msg: Zi.LAN.hesnotnull, icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
return;
}
}
var STLDATE = this.formEdit.getForm().findField('PAYABLETIME').getValue();
if ((STLDATE == '') || (STLDATE == null)) {
var myDate = new Date();
var mydatestr = Ext.util.Format.date(myDate, 'Y-m-d');
this.formEdit.getForm().findField('PAYABLETIME').setValue(mydatestr);
}
var CUSTOMERNAME = this.formEdit.getForm().findField('CUSTOMERNAME').getValue();
this.LoadCustACCOUNT(CUSTOMERNAME);
if (!basicForm.isValid()) {
return;
}
var type = 0;
var data = basicForm.getValues();
//正在保存数据, 请稍侯..
Ext.Msg.wait(Zi.LAN.nowsave);
Ext.Ajax.request({
waitMsg: Zi.LAN.nowsave, //正在保存数据...
url: '/Account/Chfee_payapplication/Save',
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);
BillNo = returnData.BILLNO;
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('MsChPayapplication', 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: Zi.LAN.Error, msg: jsonresult.Message, icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK });
}
} else {
btnEAddbill.enable();
Ext.Msg.show({ title: Zi.LAN.qagin, //请重试
msg: Zi.LAN.FuWuQiError, //服务器响应出错
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(); //'提示', msg: '当前状态无法添加付费申请明细!'
Ext.Msg.show({ title: Zi.LAN.Prompt, msg: Zi.LAN.dqstatenot, icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
return;
}
if (this.addstore) {
this.storeCurrExrate.removeAll();
this.addstore = false;
}
var billcust = this.editRecord.data.CUSTOMERNAME;
var billno = this.editRecord.data.BILLNO;
var billcurr = this.editRecord.data.CURR;
var billgroupcorp = this.GetGroupCorp(billcust);
var feeBSNOSql = '';
var sql = '';
var selectedRecords = this.gridAddList.selModel.getSelection();
if (selectedRecords.length == 0) {
btnEAddbill.enable(); //提示', msg: '没有选择要添加的业务!
Ext.Msg.show({ title: Zi.LAN.Prompt, msg: Zi.LAN.notselectaddyw, icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
return;
};
var bodyAddDatas = [];
for (var i = 0; i < selectedRecords.length; i++) {
var rec = selectedRecords[i];
var custgroupcorp = this.GetGroupCorp(rec.data.FEEOBJNAME);
if (rec.data.FEEOBJNAME == billcust || rec.data.FEEOBJNAME == billgroupcorp || (custgroupcorp == billgroupcorp && custgroupcorp != '')) {
var feeBSNO = " (BSNO='" + rec.data.BSNO + "' AND CUSTOMERNAME='" + rec.data.FEEOBJNAME + "') ";
if (feeBSNOSql == '') {
feeBSNOSql = feeBSNO;
} else {
feeBSNOSql = feeBSNOSql + " OR " + feeBSNO;
}
}
}
if (feeBSNOSql == '') {
btnEAddbill.enable(); //提示', msg: '没有要添加的费用明细!
Ext.Msg.show({ title: Zi.LAN.Prompt, msg: Zi.LAN.notaddmingxi, icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
sql = " ";
return;
}
else {
sql = " (" + feeBSNOSql + ")";
sql = sql + getAndConSql(sql, this.FeeSqlStr, this.FeeSqlStr);
}
_this = this;
var bodydatas = [];
for (var i = 0; i < this.storeCurrExrate.getCount(); i += 1) {
var member = this.storeCurrExrate.getAt(i);
if (member.data.EXRATE == 0) {
_this.ExrateConversion(member.CURR, billcurr, 'bill', 0);
return;
}
bodydatas.push(member);
}
var currBody = ConvertRecordsToJsonAll(bodydatas);
Ext.Ajax.request({
waitMsg: Zi.LAN.addnumnow, //正在添加数据...
url: '/Account/Chfee_payapplication/AddBill',
params: {
billno: billno,
billcust: billcust,
billcurr: billcurr,
feesql: sql,
storeCurrExrate: currBody,
custgroup: true
},
callback: function (options, success, response) {
if (success) {
var result = Ext.JSON.decode(response.responseText);
if (!result.Success) {
btnEAddbill.enable();
Ext.Msg.show({
title: Zi.LAN.Prompt, //提示
msg: result.Message,
icon: Ext.MessageBox.ERROR,
buttons: Ext.Msg.OK
});
return;
} else {
dataList = result.Data;
if (dataList == null) {
if (result.Message != '添加成功') {//添加成功
Ext.MessageBox.alert(Zi.LAN.Prompt, result.Message); //提示
}
var sql = this.sqlcontext;
var sortstr = 'b.ETD,b.MBLNO,b.BsNo ';
if (this.addsortfield != '' && this.addsortdire != '') {
sortstr = this.addsortfield + ' ' + this.addsortdire;
}
// this.storeBodyAddList.load({ params: { start: 0, limit: _this.PageSize, sort: sortstr, condition: sql} });
this.storeBodyAddList.reload();
if (this.storeBodyList.getCount() != 0) {
_this.storeBodyList.reload({
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
});
} else {
_this.storeBodyList.load({
params: { start: 0, limit: _this.BodyPageSize, condition: " BILLNO='" + 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.storeBodySum.load({ params: { condition: " BILLNO='" + billno + "'"} });
Ext.Ajax.request({
waitMsg: Zi.LAN.onselect, //正在查询主表数据
url: '/Account/Chfee_payapplication/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: Zi.LAN.Prompt, //提示
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);
var editp = Ext.create('MsChPayapplication', 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(Zi.LAN.qqerror, response.responseText);
}
},
scope: this
});
} else {
if (dataList.lenght != 0) {
for (var i = 0; i < dataList.length; i++) {
var record = dataList[i];
_this.storeCurrExrate.add(record);
}
_this.ExrateConversion(record.CURR, billcurr, 'bill', 0);
return;
}
}
}
} else {
btnEAddbill.enable(); //请求出现错误,请重试
Ext.MessageBox.alert(Zi.LAN.qqerror, response.responseText);
}
},
scope: this
});
},
deleteBill: function (type) {
var btnEDeleteDetail = Ext.getCmp('btndeldetail');
btnEDeleteDetail.disable();
var billno = this.formEdit.getForm().findField('BILLNO').getValue();
var selectedRecords = this.gridList.selModel.getSelection();
if (selectedRecords.length == 0) {//提示', msg: '没有要删除的费用明细!
Ext.Msg.show({ title: Zi.LAN.Prompt, msg: Zi.LAN.nodeletemingxi, icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
btnEDeleteDetail.enable();
return;
};
var billstatus = this.formEdit.getForm().findField('BILLSTATUS').getValue();
if ((billstatus != 1) && (billstatus != 6)) {
//提示', msg: '当前状态无法删除付费申请明细!
Ext.Msg.show({ title: Zi.LAN.Prompt, msg: Zi.LAN.dqztnotdelectmx, icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
btnEDeleteDetail.enable();
return;
}
var bodyAddDatas = [];
for (var i = 0; i < selectedRecords.length; i++) {
var rec = selectedRecords[i];
bodyAddDatas.push(rec);
}
var jsonbodyAddDatas = ConvertRecordsToJsonAll(bodyAddDatas);
var sql = this.sqlcontext;
_this = this; //正在删除数据., 请稍侯..
Ext.Msg.wait(Zi.LAN.nowdelete);
Ext.Ajax.request({
waitMsg: Zi.LAN.nowdelete,
url: '/Account/Chfee_payapplication/DelBill',
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: Zi.LAN.Prompt, //提示
msg: result.Message,
icon: Ext.MessageBox.ERROR,
buttons: Ext.Msg.OK
});
btnEDeleteDetail.enable();
return;
} else {
Ext.MessageBox.hide();
var sql = this.sqlcontext;
this.storeBodyAddList.load({ params: { start: 0, limit: _this.PageSize, sort: '', condition: sql} });
_this.storeBodyList.load({ params: { start: 0, limit: _this.BodyPageSize, condition: " BILLNO='" + 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.storeBodySum.load({ params: { condition: " BILLNO='" + billno + "'"} });
Ext.Ajax.request({
waitMsg: Zi.LAN.onselect, //正在查询主表数据
url: '/Account/Chfee_payapplication/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: Zi.LAN.Prompt, //提示
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);
var editp = Ext.create('MsChPayapplication', 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();
btnEDeleteDetail.enable();
} else {
btnEDeleteDetail.enable(); //请求出现错误,请重试
Ext.MessageBox.alert(Zi.LAN.qqerror, response.responseText);
}
},
scope: this
});
}
} else {
btnEDeleteDetail.enable(); //请求出现错误,请重试
Ext.MessageBox.alert(Zi.LAN.qqerror, response.responseText);
}
},
scope: this
});
},
onSubmitAuditClick: function () {
var Duino = this.formEdit.getForm().findField('BILLNO').getValue();
var billstatus = this.formEdit.getForm().findField('BILLSTATUS').getValue();
if (Duino == '*') {//提示', msg: '请先保存付费申请,然后才能提交审核
Ext.Msg.show({ title: Zi.LAN.Prompt, msg: Zi.LAN.baocunshenq, icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
return;
};
if ((billstatus != 1) && (billstatus != 6)) {
//提示', msg: '当前状态无法提交审核
Ext.Msg.show({ title: Zi.LAN.Prompt, msg: Zi.LAN.nowcanntsh, icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
return;
}
if (this.storeBodyList.getCount() == 0) {//提示', msg: '没有付费明细,无法提交审核
Ext.Msg.show({ title: Zi.LAN.Prompt, msg: Zi.LAN.notmingxish, icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
return;
}
_this = this;
Ext.Ajax.request({
waitMsg: Zi.LAN.addnumnow, //正在添加数据..
url: '/Account/Chfee_payapplication/SubmitAudit',
params: {
bill: Duino
},
callback: function (options, success, response) {
if (success) {
var result = Ext.JSON.decode(response.responseText);
if (!result.Success) {
Ext.Msg.show({
title: Zi.LAN.Prompt, //提示
msg: result.Message,
icon: Ext.MessageBox.ERROR,
buttons: Ext.Msg.OK
});
return;
} else {
Ext.Ajax.request({
waitMsg: Zi.LAN.onselect, //正在查询主表数据
url: '/Account/Chfee_payapplication/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: Zi.LAN.Prompt,
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('MsChPayapplication', 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(Zi.LAN.qqerror, response.responseText);
}
},
scope: this
});
}
} else {//请求出现错误,请重试'
Ext.MessageBox.alert(Zi.LAN.qqerror, response.responseText);
}
},
scope: this
});
},
onSubmitAuditBackClick: function () {
var Duino = this.formEdit.getForm().findField('BILLNO').getValue();
var billstatus = this.formEdit.getForm().findField('BILLSTATUS').getValue();
if (Duino == '*') {//提示', msg: '请先保存付费申请,然后才能提交审核!
Ext.Msg.show({ title: Zi.LAN.Prompt, msg: Zi.LAN.baocunshenq, icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
return;
};
if (billstatus != 2) {
//提示', msg: '当前状态无法撤销提交!
Ext.Msg.show({ title: Zi.LAN.Prompt, msg: Zi.LAN.wufachexiaotj, icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
return;
}
_this = this;
Ext.Ajax.request({//正在添加数据..
waitMsg: Zi.LAN.addnumnow,
url: '/Account/Chfee_payapplication/SubmitAuditBack',
params: {
bill: Duino
},
callback: function (options, success, response) {
if (success) {
var result = Ext.JSON.decode(response.responseText);
if (!result.Success) {
Ext.Msg.show({//提示
title: Zi.LAN.Prompt,
msg: result.Message,
icon: Ext.MessageBox.ERROR,
buttons: Ext.Msg.OK
});
return;
} else {
Ext.Ajax.request({//正在查询主表数据
waitMsg: Zi.LAN.onselect,
url: '/Account/Chfee_payapplication/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: Zi.LAN.Prompt,
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('MsChPayapplication', 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(Zi.LAN.qqerror, response.responseText);
}
},
scope: this
});
}
} else {//请求出现错误,请重试'
Ext.MessageBox.alert(Zi.LAN.qqerror, 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();
},
LoadCustACCOUNT: function (CUSTOMERNAME, ISLOAD, loaddata) {
var CURR = this.formEdit.getForm().findField('CURR').getValue();
var CUSTBANK = this.formEdit.getForm().findField('CUSTACCOUNTGID');
var CUSTACCOUNT = this.formEdit.getForm().findField('CUSTACCOUNT');
var condition = " LINKID=(select GID from info_client where shortname='" + CUSTOMERNAME + "') ";
if (CURR != "" && CURR != undefined) {
condition = condition + " and CURRENCY='" + CURR + "'";
}
this.storeCustACCOUNT.load({ params: { condition: condition },
callback: function (r, options, success) {
if (success) {
if (r.length != 0) {
if (ISLOAD) {
CUSTBANK.setValue(loaddata.CUSTACCOUNTGID);
CUSTACCOUNT.setValue(loaddata.CUSTACCOUNT);
} else {
CUSTBANK.setValue(this.storeCustACCOUNT.data.items[0].data.GID);
CUSTACCOUNT.setValue(this.storeCustACCOUNT.data.items[0].data.ACCOUNT);
}
}
}
},
scope: this
});
},
getCondition: function () {
var form = this.formSearch.getForm();
if (!form.isValid()) {//提示', '查询条件赋值错误,请检查
Ext.Msg.alert(Zi.LAN.Prompt, Zi.LAN.SelectError);
return '';
}
var sql = '';
var TRANSSTATUS = form.findField('TRANSSTATUS').getValue();
sql = sql + getAndConSql(sql, TRANSSTATUS, " ((b.TRANSTYPE='陆运普货订单' or b.TRANSTYPE='陆运集运订单') and b.TRANSSTATUS='" + TRANSSTATUS + "')");
var TRANSSTATUS2 = form.findField('TRANSSTATUS2').getValue();
sql = sql + getAndConSql(sql, TRANSSTATUS2, " ((b.TRANSTYPE='普运' or b.TRANSTYPE='集装箱') and b.TRANSSTATUS='" + TRANSSTATUS2 + "')");
var TRUCKNO = form.findField('TRUCKNO').getValue();
sql = sql + getAndConSql(sql, TRUCKNO, "TRUCKNO like '%" + TRUCKNO + "%'");
var ORDERNO = form.findField('ORDERNO').getValue();
sql = sql + getAndConSql(sql, ORDERNO, "ORDERNO like '%" + ORDERNO + "%'");
var CUSTOMERNAME = form.findField('CUSTOMERNAME').getValue();
sql = sql + getAndConSql(sql, CUSTOMERNAME, "b.CUSTOMERNAME='" + CUSTOMERNAME + "'");
var TRUCKER = form.findField('TRUCKER').getValue();
sql = sql + getAndConSql(sql, TRUCKER, "TRUCKER='" + TRUCKER + "'");
var PORTLOAD = form.findField('PORTLOAD').getValue();
sql = sql + getAndConSql(sql, PORTLOAD, "PORTLOAD= '" + PORTLOAD + "'");
var PORTDISCHARGE = form.findField('PORTDISCHARGE').getValue();
sql = sql + getAndConSql(sql, PORTDISCHARGE, "PORTDISCHARGE= '" + PORTDISCHARGE + "'");
// var OPLBNAME = form.findField('OPLBNAME').getValue();
// sql = sql + getAndConSql(sql, OPLBNAME, "b.OPLBNAME='" + OPLBNAME + "'");
var expDateBgn = form.findField('ExpDateBgn').getRawValue();
sql = sql + getAndConSql(sql, expDateBgn, "b.ETD >='" + expDateBgn + "'");
var expDateEnd = form.findField('ExpDateEnd').getRawValue();
sql = sql + getAndConSql(sql, expDateEnd, "b.ETD <='" + expDateEnd + "'");
//var ACCDATE = form.findField('ACCDATEFR').getRawValue();
//sql = sql + getAndConSql(sql, ACCDATE, "b.ACCDATE>='" + ACCDATE + "'");
//var ACCDATETO = form.findField('ACCDATETO').getRawValue();
//sql = sql + getAndConSql(sql, ACCDATETO, "b.ACCDATE<='" + ACCDATETO + "'");
this.FeeSqlStr = this.getFeeCondition();
sql = sql + getAndConSql(sql, this.FeeSqlStr, this.FeeSqlStr);
// sql = sql + getAndConSql(sql, feesql, feesql);
// this.BillSql = sql;
return sql;
},
getFeeCondition: function () {
var form = this.formSearch.getForm();
var feesql = ' (f.amount-isnull(f.SETTLEMENT,0))<>0 ';
var CUSTNAME = form.findField('CUSTNAME').getValue();
feesql = feesql + getAndConSql(feesql, CUSTNAME, "f.CUSTOMERNAME='" + CUSTNAME + "'");
var DC = form.findField('DC').getValue();
feesql = feesql + getAndConSql(feesql, DC, "f.FEETYPE=" + DC);
var Currency = form.findField('Currency').getValue();
feesql = feesql + getAndConSql(feesql, Currency, "f.Currency='" + Currency + "'");
var FeeName = form.findField('FeeName').getValue();
feesql = feesql + getAndConSql(feesql, FeeName, "f.FeeName='" + FeeName + "'");
var InvNo = form.findField('InvNo').getValue();
feesql = feesql + getAndConSql(feesql, InvNo, " f.GID IN (SELECT FEEID FROM ch_fee_do_invoice WHERE BILLNO='" + InvNo + "')");
//var ISINVOICE = form.findField('ISINVOICE').getValue();
//feesql = feesql + getAndConSql(feesql, ISINVOICE, "f.ISINVOICE=" + ISINVOICE);
//var ISADVANCEDPAY = form.findField('ISADVANCEDPAY').getValue();
//feesql = feesql + getAndConSql(feesql, ISADVANCEDPAY, "f.ISADVANCEDPAY=" + ISADVANCEDPAY);
//var DuiNo = form.findField('DuiNo').getValue();
//feesql = feesql + getAndConSql(feesql, DuiNo, " f.GID IN (SELECT GID FROM V_DUI_FEE WHERE DUINO like '%" + DuiNo + "%')");
//var InvNo = form.findField('InvNo').getValue();
//feesql = feesql + getAndConSql(feesql, InvNo, " f.GID IN (SELECT FEEID FROM ch_fee_do_invoice WHERE BILLNO='" + InvNo + "')");
return feesql;
},
ExrateConversion: function (bfcurr, afcurr, fntype, dfexrate) {
var EXRATE = 0;
var achange = true;
var bchange = true;
formExrateConversion = Ext.widget('form', {
frame: true,
region: 'center',
bodyPadding: 5,
fieldDefaults: {
margins: '2 2 2 2',
labelAlign: 'right',
flex: 1,
labelWidth: 90,
msgTarget: 'qtip'
},
items: [
{//fieldset 1
xtype: 'container',
defaultType: 'textfield',
layout: 'anchor',
defaults: {
anchor: '100%'
},
items: [{
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [{
fieldLabel: '1' + bfcurr + '=',
xtype: 'numberfield',
name: 'bfcurr',
decimalPrecision: 10,
value: 0,
renderer: function (value, cellmeta, record, rowIndex, columnIndex, store) {
try {
var lsValue = usMoney(value, 10, '', false);
if (lsValue != "NaN") {
value = lsValue; if (parseFloat(lsValue) < 0) {
return '<SPAN style="COLOR: red">' + lsValue + '</SPAN>';
}
}
else {
return value;
}
}
catch (e) {
return value;
}
return value;
},
listeners: {
change: function () {
if (bchange) {
var bfcurr = formExrateConversion.getForm().findField('bfcurr').getValue();
var field = formExrateConversion.getForm().findField('afcurr');
if (bfcurr == 0) { field.setValue(0); } else {
var taxrate = (parseFloat(1).div(parseFloat(bfcurr))).toFixed(10);
achange = false;
field.setValue(taxrate);
}
}
achange = true;
}
}
}, {
xtype: 'label',
width: 120,
text: afcurr,
name: 'bfcurr2'
}
]
}, {
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [{
fieldLabel: '1' + afcurr + '=',
xtype: 'numberfield',
name: 'afcurr',
decimalPrecision: 10,
value: 0,
renderer: function (value, cellmeta, record, rowIndex, columnIndex, store) {
try {
var lsValue = usMoney(value, 10, '', false);
if (lsValue != "NaN") {
value = lsValue; if (parseFloat(lsValue) < 0) {
return '<SPAN style="COLOR: red">' + lsValue + '</SPAN>';
}
}
else {
return value;
}
}
catch (e) {
return value;
}
return value;
},
listeners: {
change: function () {
if (achange) {
var afcurr = formExrateConversion.getForm().findField('afcurr').getValue();
var field = formExrateConversion.getForm().findField('bfcurr');
if (afcurr == 0) { field.setValue(0); } else {
var taxrate = (parseFloat(1).div(parseFloat(afcurr))).toFixed(10);
bchange = false;
field.setValue(taxrate);
}
}
bchange = true;
}
}
}, {
xtype: 'label',
width: 120,
text: bfcurr,
name: 'afcurr2'
}
]
}
]//end items(fieldset 1)
}//end fieldset 1
]//end root items
});
me = this;
winExrateShow = Ext.create('Ext.window.Window', {
title: Zi.LAN.bibiezesuan, //币别汇率折算
width: 450,
iconCls: "addicon",
resizable: false,
collapsible: true, // 允许缩放条
closeAction: 'close',
closable: true,
modal: 'true',
buttonAlign: "center",
bodyStyle: "padding:0 0 0 0",
items: [formExrateConversion],
buttons: [{
text: Zi.LAN.asure, //确定
minWidth: 70,
handler: function () {
var form = formExrateConversion.getForm();
var UsdExrate = form.findField('bfcurr').getValue();
if (UsdExrate == '' || UsdExrate == null || UsdExrate == undefined) {//提示', msg: '必须填折算汇率!
Ext.Msg.show({ title: Zi.LAN.Prompt, msg: Zi.LAN.surezesuanhuil, icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
return;
};
var recs = DsStoreQueryBy(me.storeCurrExrate, 'CURR', bfcurr);
if (recs.getCount() > 0) {
for (var i = 0; i < me.storeCurrExrate.getCount(); i += 1) {
var member = me.storeCurrExrate.getAt(i);
if (member.data.CURR == bfcurr) {
member.set('EXRATE', UsdExrate);
member.commit();
}
}
} else {
me.storeCurrExrate.add({ "CURR": bfcurr, "EXRATE": UsdExrate })
}
winExrateShow.close();
if (fntype == 'detail') {
me.addDetail();
}
if (fntype == 'bill') {
me.addBill();
}
return;
}
}, {
text: Zi.LAN.close, //关闭
minWidth: 70,
handler: function () {
winExrateShow.close();
me.GetEditStatus();
return;
}
}]
});
if (bfcurr == LOCALCURR) {
var FFrecords = DsStoreQueryBy(this.StoreDateCurr, 'CURR', afcurr);
if (FFrecords.getCount() > 0) {
var ffdata = FFrecords.getAt(0).data;
var DEFRATE = ffdata.DEFRATE;
} else {
var DFrecords = DsStoreQueryBy(this.StoreCurr, 'CURR', afcurr);
if (DFrecords.getCount() > 0) {
var dfdata = DFrecords.getAt(0).data;
var DEFRATE = dfdata.DEFRATE;
} else {
var DEFRATE = 1;
}
}
var field = formExrateConversion.getForm().findField('afcurr');
achange = true;
field.setValue(DEFRATE);
} else {
var field = formExrateConversion.getForm().findField('bfcurr');
var recs = DsStoreQueryBy(me.storeCurrExrate, 'CURR', bfcurr);
if (recs.getCount() > 0) {
var dfdata = recs.getAt(0).data;
var DEFRATE = dfdata.DFEXRATE;
} else var DEFRATE = dfexrate;
bchange = true;
field.setValue(DEFRATE);
}
winExrateShow.show();
},
GetGroupCorp: function (custname) {
_this = this;
var records = DsStoreQueryBy(_this.StoreClientGroup, 'SHORTNAME', custname);
if (records.getCount() > 0) {
return records.getAt(0).data.PCORPNAME;
} else {
return '';
}
},
//#region 必填字段
LoadMustBe: function () {
this.storeMustBe.load({ params: { condition: "BSTYPE='付费申请'" }, //付费申请
callback: function (r, options, success) {
if (success) {
if (this.storeMustBe.getCount() > 0) {
for (var j = 0; j < this.storeMustBe.getCount(); j += 1) {
var member = this.storeMustBe.getAt(j);
var headfield = this.formEdit.getForm().findField(member.data.FIELDNAME);
if (headfield != NaN && headfield != null) {
if (member.data.ISMUST == "1")
headfield.allowBlank = false;
if (member.data.ISCOLOR == "1")
headfield.setFieldStyle({ background: '#ffc' });
}
};
} else {
}
}
},
scope: this
});
},
//#endregion
// #region 根据权限和状态判断是否允许修改
GetEditStatus: function () {
var canedit = false;
var btnESubmitAudit = Ext.getCmp('btnSubmitAudit');
var btnESubmitAuditBack = Ext.getCmp('btnSubmitAuditBack');
this.formEdit.getForm().findField('BILLSTATUS').setDisabled(false);
var bsStatus = this.formEdit.getForm().findField('BILLSTATUS').getValue();
var op = this.formEdit.getForm().findField('APPLICANTNAME').getValue();
this.formEdit.getForm().findField('BILLSTATUS').setDisabled(true);
_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;
if (bsStatus == 1 || bsStatus == 6)
btnESubmitAudit.enable();
else
btnESubmitAudit.disable();
if (bsStatus == 2)
btnESubmitAuditBack.enable();
else
btnESubmitAuditBack.disable();
} else {
canedit = false;
btnESubmitAudit.disable();
btnESubmitAuditBack.disable();
}
if ((bsStatus != 1) && (bsStatus != 6)) {
_this.setSaveBtnStatus(false);
} else {
_this.setSaveBtnStatus(canedit);
}
}
}
}
});
},
setSaveBtnStatus: function (enable) {
var btnESave = Ext.getCmp('btnESave');
var btnESaveAndClose = Ext.getCmp('btnESaveAndClose');
var btnESaveAndNew = Ext.getCmp('btnESaveAndNew');
var btnEAddDetail = Ext.getCmp('btnadddetail');
var btnEAddbill = Ext.getCmp('btnaddbill');
var btnEDeleteDetail = Ext.getCmp('btndeldetail');
var wxpush = Ext.getCmp('wxpush');
this.canedit = enable;
if (enable) {
btnESave.enable();
btnESaveAndClose.enable();
btnESaveAndNew.enable();
btnEAddDetail.enable();
btnEDeleteDetail.enable();
btnEAddbill.enable();
wxpush.enable();
} else {
btnESave.disable();
btnESaveAndClose.disable();
btnESaveAndNew.disable();
btnEAddDetail.disable();
btnEDeleteDetail.disable();
btnEAddbill.disable();
wxpush.disable();
}
},
// #endregion
onExportClick: function (button, event) {
GridExportExcelPage(this.gridList);
},
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) {//警告', msg: '已是最前一票'
Ext.Msg.show({ title: Zi.LAN.Caveat, msg: Zi.LAN.islast, icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK });
return;
}
if (j == this.StoreList.count) {//警告', msg: '已是最后一票'
Ext.Msg.show({ title: Zi.LAN.Caveat, msg: Zi.LAN.islast, 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: Zi.LAN.Caveat, 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)) {//警告', msg: '已是最后一票
Ext.Msg.show({ title: Zi.LAN.Caveat, msg: Zi.LAN.islast, 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 BILLSTATUSREF = basicForm.findField('BILLSTATUSREF').value;
if (billNo == '*' || billNo == '') {//错误', msg: '单据还没有保存,请保存后再打印
Ext.Msg.show({ title: Zi.LAN.Error, msg: Zi.LAN.djnotsave, icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK });
return;
}
var billNo = basicForm.findField('BILLNO').value;
var sortstr = ' b.VESSEL,b.VOYNO,b.MBLNO ';
if (this.sortfield != '' && this.sortdire != '') {
sortstr = this.sortfield + ' ' + this.sortdire;
}
var printType = 'MSCHFEEPAYAPPLICATION';
var sql1 = "SELECT p.*,(select ShowName from [user] where GID=p.APPLICANT) as APPLICANTNAME,(select bankname from info_client_bank where gid=p.CUSTACCOUNTGID) CUSTBANKNAME,";
sql1 = sql1 + "(select ACCOUNT from info_client_bank where gid=p.CUSTACCOUNTGID) CUSTACCOUNT,(select top 1 DESCRIPTION from info_client where SHORTNAME=p.CUSTOMERNAME) CUSTFULLNAME FROM ch_fee_payapplication p 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,b.CUSTNO"
sql2 = sql2 + " FROM ch_fee_do c left join v_op_bill b on (b.bsno=c.bsno)";
sql2 = sql2 + " WHERE C.BILLNO='" + billNo + "' ORDER BY " + sortstr;
var sql3 = "";
var sql4 = "";
var sql5 = "";
var sql6 = "";
Ext.Ajax.request({
waitMsg: '',
url: '/Account/Chfee_payapplication/GetPrint',
params: {
billno: billNo
},
callback: function (options, success, response) {
if (success) {
var jsonresult = Ext.JSON.decode(response.responseText);
if (jsonresult.Success) {
PrintComm(printType, sql1, sql2, sql3, sql4, sql5, sql6);
Ext.Ajax.request({
waitMsg: '',
url: '/Account/Chfee_payapplication/UpdatePrint',
params: {
billnos: "'" + billNo + "'"
},
callback: function (options, success, response) {
if (success) {
} else {
}
},
scope: this
});
} else {//错误
Ext.Msg.show({ title: Zi.LAN.Error, msg: jsonresult.Message, icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK });
}
} else {
}
},
scope: this
});
}
, 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("StlAmount");
}
sum = sum.toFixed(2); //选中金额
Ext.getCmp("zongshu").setText(Zi.LAN.selectmoney + " :" + sum);
}, onAddFileClick: function () {
if (BillState != '未提交') {//未提交
Ext.MessageBox.alert(Zi.LAN.Prompt, Zi.LAN.noallowxiugai); //提示', '当前状态不允许修改附件列表
return;
}
if (BillNo == '' || BillNo == '*') {
Ext.MessageBox.alert(Zi.LAN.Prompt, Zi.LAN.pscnum); //提示', '请先生成申请编号!
return;
}
var winAccess = new Shipping.FileUpload({});
winAccess.BillNo = BillNo;
winAccess.show();
}, onDelFileClick: function () {
if (BillState != '未提交') {//未提交
Ext.MessageBox.alert(Zi.LAN.Prompt, Zi.LAN.noallowxiugai); //提示', '当前状态不允许修改附件列表!
return;
}
var selections = this.fileGrid.getSelectionModel().getSelection();
if (selections.length == 0) {//提示', msg: '请先选择要删除的数据!
Ext.Msg.show({ title: Zi.LAN.Prompt, msg: Zi.LAN.selectdelete, icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
return;
}
var record = new Array();
for (var i = 0; i < selections.length; i++) {
record.push(selections[i].data);
} //提示', '确定删除该记录吗?'
Ext.MessageBox.confirm(Zi.LAN.Prompt, Zi.LAN.suredelete, function (btn) {
if (btn == 'yes') {
Ext.Msg.wait(Zi.LAN.nowdelete); //正在删除数据
Ext.Ajax.request({
waitMsg: Zi.LAN.nowdelete,
url: '/Account/Chfee_payapplication/CertDel',
params: {
data: Ext.JSON.encode(record)
},
callback: function (options, success, response) {
if (success) {
var jsonresult = Ext.JSON.decode(response.responseText);
if (jsonresult.Success) {
panelEdit.LoadData('edit', "BILLNO='" + BillNo + "'");
Ext.Msg.show({ title: Zi.LAN.Prompt, msg: jsonresult.Message, icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
} //提示
else {
Ext.Msg.show({ title: Zi.LAN.Prompt, msg: jsonresult.Message, icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK });
}
}
},
failure: function (response, options) {//'警告', msg: '服务器响应出错,请重试'
Ext.Msg.show({ title: Zi.LAN.Caveat, msg: Zi.LAN.FuWuQiError, icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
},
success: function (response, options) {
},
scope: this
}); //end Ext.Ajax.request
}
}, this);
}
});