Ext.namespace('Shipping');
Shipping.MsChPayapplicationBLEdit = function (config) {
Ext.applyIf(this, config);
this.initUIComponents();
window.Shipping.MsChPayapplicationBLEdit.superclass.constructor.call(this);
};
Ext.extend(Shipping.MsChPayapplicationBLEdit, Ext.Panel, {
ParentWin: null,
OpStatus: 'add',
StoreList: null,
EditRecord: null,
addstore: false,
PageSize: 30,
VISIBLERANGE: 4,
OPERATERANGE: 4,
sqlcontext:"",
initUIComponents: function () {
this.serialNo = 0;
this.workSerialNo = 0;
this.bodyDel = [];
this.FeeSql = '';
this.BillSql = '';
this.DuiBillSql = '';
this.IsDebit = '0';
this.ACCOUNT1="";
this.ACCOUNT2="";
this.ACCOUNT3="";
this.bank_first=true;
this.ACCOUNT1_first=true;
this.ACCOUNT2_first=true;
this.ACCOUNT3_first=true;
this.ACCOUNT1_edit=false;
this.ACCOUNT2_edit=false;
this.ACCOUNT3_edit=false;
this.sqlcontext="";
//#region 编辑form
//枚举参照相关(编辑form)
//#region 表参照相关(编辑form)
this.formname = "formChForeignPayBLEdit"; //页面名称
this.formname_DO = "formChForeignPayBLEdit_DO"; //页面名称
this.formname_AP = "formChForeignPayBLEdit_AP"; //页面名称
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);
}
}
}
});
var _this=this;
this.storeCompany = Ext.create('DsExt.ux.RefTableStore', {
model: 'companymb',proxy: { url: '/CommMng/BasicDataRef/GetcompanyList' } });
this.storeCompany.load({params: {condition: " ISDISABLE=0 "}});
this.comboxCompany = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: '付款公司',
allowBlank: false,
forceSelection: true,
store: this.storeCompany,
name: 'COMPANYID',id:"COMPANYID",
valueField: 'gid',
displayField: 'name',
listeners: {
change: function (field, eOpts) {
//change时load三个银行帐号combox
var COMPANYID = _this.formEdit.getForm().findField('COMPANYID').getValue();
_this.storeBank.load({ params: { condition: " select distinct bankname2 as GVALUE,'' as GID from sys_bank where linkid='"+COMPANYID+"' " }});
//_this.LoadBankAccount();
}
}
});
this.storeBank = Ext.create('DsExt.ux.RefTableStore', {
model: 'DsTruckMng.ux.GeneralValue',proxy: { url: '/CommMng/BasicDataRef/GeneralSelect' } });
this.storeBank.load({params: {condition: "select distinct bankname2 as GVALUE,'' as GID from sys_bank"}});
this.comboxBank = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: '付款银行',
forceSelection: true,
store: this.storeBank,
name: 'PAYBANK',
valueField: 'GVALUE',
displayField: 'GVALUE',
listeners: {
change: function (field, eOpts) {
//失去焦点时load三个银行帐号combox
var PAYBANK = _this.formEdit.getForm().findField('PAYBANK').getValue();
if (PAYBANK=="" && _this.bank_first!=true){
//alert("请选择付款公司!");
}
if (PAYBANK!=""){
_this.ACCOUNT1_first=true;
_this.ACCOUNT2_first=true;
_this.ACCOUNT3_first=true;
_this.LoadBankAccount();
}
this.bank_first=false;
}
}
});
this.comboxStlMode = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: '结算方式',
store: this.StoreStlMode,
forceSelection: true,
name: 'SETTLETYPE',
valueField: 'STLCODE',
displayField: 'STLNAME'
});
this.storeCustCode = Ext.create('DsExt.ux.RefTableStore', {
model: 'DsShipping.ux.CustomRefModel',
proxy: { url: '/CommMng/BasicDataRef/GetCustomRefList' }
});
this.storeCustCode.load({ params: { condition: ""} });
this.comboxCustCode = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: '结算单位',
store: this.storeCustCode,
allowBlank: false,
forceSelection: true,
name: 'CUSTOMERNAME',
valueField: 'CustName',
displayField: 'CodeAndName',
listeners: {
scope: this,
'select': function (combo, records, eOpts) {
if (records.length > 0) {
var CUSTOMERNAME = this.formEdit.getForm().findField('CUSTOMERNAME').getValue();
if (CUSTOMERNAME == '') {return;}
else {
var CUSTNAME = this.formSearch.getForm().findField('CUSTNAME');
var tmpcust = CUSTNAME.getValue();
if (tmpcust == '' || tmpcust == null || tmpcust == undefined) {
CUSTNAME.setValue(CUSTOMERNAME);
}
this.LoadCustACCOUNT(CUSTOMERNAME);
}
}
}
}
});
this.storeInfoClientContact = Ext.create('DsExt.ux.RefTableStore', {
model: 'DsShipping.ux.InfoClientContactModel',
proxy: { url: '/CommMng/BasicDataRef/GetInfoClientContactList' }
});
this.comboxInfoClientContact = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: '收款人',
store: this.storeInfoClientContact,
forceSelection: true,
name: 'ContactGID',
valueField: 'GID',
displayField: 'SHOWNAME'
});
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: '币别',id:"CURR",
allowBlank: false,
store: this.StoreCurr,
forceSelection: true,
emptyText: '原币申请',
name: 'CURR',
valueField: 'CURR',
displayField: 'CURR',
listeners: {
scope: this,
'select': function (combo, records, eOpts) {
if (records.length > 0) {
var CUSTOMERNAME = this.formEdit.getForm().findField('CUSTOMERNAME').getValue();
if (CUSTOMERNAME == '') {return;}
else {
this.LoadCustACCOUNT(CUSTOMERNAME);
}
}
}
}
});
var record = Ext.create('MsFeeCurr', {
'CURR':''
});
var _this=this;
this.StoreCurr1 = Ext.create('DsExt.ux.RefTableStore', {
model: 'MsFeeCurr',
proxy: { url: '/MvcShipping/MsChFee/GetFeeCurrList' }
});
this.StoreCurr1.load({ params: { condition: ""}
,callback: function(_count) {_this.StoreCurr1.add(record);}});
this.comboxCurr1 = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: '币别1',id:"CURR1",
allowBlank: true,
store: this.StoreCurr1,
forceSelection: true,
//emptyText: '原币申请',
name: 'CURR1',
valueField: 'CURR',
displayField: 'CURR'
});
this.StoreCurr2 = Ext.create('DsExt.ux.RefTableStore', {
model: 'MsFeeCurr',
proxy: { url: '/MvcShipping/MsChFee/GetFeeCurrList' }
});
this.StoreCurr2.load({ params: { condition: ""}
,callback: function(_count) {_this.StoreCurr2.add(record);}});
this.comboxCurr2 = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: '币别2',id:"CURR2",
allowBlank: true,
store: this.StoreCurr2,
forceSelection: true,
//emptyText: '原币申请',
name: 'CURR2',
valueField: 'CURR',
displayField: 'CURR'
});
this.StoreCurr3 = Ext.create('DsExt.ux.RefTableStore', {
model: 'MsFeeCurr',
proxy: { url: '/MvcShipping/MsChFee/GetFeeCurrList' }
});
this.StoreCurr3.load({ params: { condition: ""}
,callback: function(_count) {_this.StoreCurr3.add(record);}});
this.comboxCurr3 = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: '币别3',id:"CURR3",
allowBlank: true,
store: this.StoreCurr3,
forceSelection: true,
//emptyText: '原币申请',
name: 'CURR3',
valueField: 'CURR',
displayField: 'CURR'
});
this.StoreBANK1 = Ext.create('DsExt.ux.RefTableStore', {
model: 'BANK',
proxy: { url: '/MvcShipping/MsBaseInfo/GetAllBANKList' },
listeners: {
load: function (field, newValue, oldValue) {
if (this.ACCOUNT1_first==true){
this.ACCOUNT1_first=false;
if (this.StoreBANK1.getCount()>1){
this.comboxBANK1.setValue(this.StoreBANK1.getAt(1).get('GID'));
}else{
this.comboxBANK1.setValue(this.StoreBANK1.getAt(0).get('GID'));
}
for (var i = 0; i < this.StoreBANK1.getCount(); i += 1) {
var member = this.StoreBANK1.getAt(i);
if (member.data.CURRENCY == "USD") {
this.comboxBANK1.setValue(member.data.GID);
}
}
}
},
scope: this
}
});
//this.StoreBANK1.load({ params: { condition: ""} });
this.comboxBANK1 = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: '银行账号1',flex:2,
store: this.StoreBANK1,
forceSelection: true,
name: 'ACCOUNT1',
valueField: 'GID',
displayField: 'BANKNAME',
listeners: {
change: function (field, newValue, oldValue) {
if (_this.ACCOUNT1_edit==true)
_this.ACCOUNT1 = field.value;
//alert("select "+_this.ACCOUNT1);
},
focus: function (field, newValue, oldValue) {
var COMPANYID = _this.formEdit.getForm().findField('COMPANYID').getValue();
var PAYBANK = _this.formEdit.getForm().findField('PAYBANK').getValue();
_this.ACCOUNT1 = field.value;
_this.StoreBANK1.load({ params: { condition: " linkid='"+COMPANYID+"' and bankname2='"+PAYBANK+"' and isnull(isstop,0)=0 "} });
_this.ACCOUNT1_edit=true;
},
blur: function (field, newValue, oldValue) {
//alert("blur "+field.value);
var COMPANYID = _this.formEdit.getForm().findField('COMPANYID').getValue();
var PAYBANK = _this.formEdit.getForm().findField('PAYBANK').getValue();
_this.StoreBANK1.load({ async: false, params: { condition: " linkid='"+COMPANYID+"' and bankname2='"+PAYBANK+"'"} });
if (field.value == "") {
//alert("blur_set "+_this.ACCOUNT1);
field.value = _this.ACCOUNT1;
}
if (field.displayTplData[0].ISSTOP == "True") {
alert("该往来单位已经停用");
}
_this.ACCOUNT1_edit=false;
},
scope: this
}
});
this.StoreBANK2 = Ext.create('DsExt.ux.RefTableStore', {
model: 'BANK',
proxy: { url: '/MvcShipping/MsBaseInfo/GetAllBANKList' },
listeners: {
load: function (field, newValue, oldValue) {
if (this.ACCOUNT2_first==true){
this.ACCOUNT2_first=false;
if (this.StoreBANK2.getCount()>1){
this.comboxBANK2.setValue(this.StoreBANK2.getAt(1).get('GID'));
}else{
this.comboxBANK2.setValue(this.StoreBANK2.getAt(0).get('GID'));
}
for (var i = 0; i < this.StoreBANK2.getCount(); i += 1) {
var member = this.StoreBANK2.getAt(i);
if (member.data.CURRENCY == "RMB") {
this.comboxBANK2.setValue(member.data.GID);
}
}
}
},
scope: this
}
});
//this.StoreBANK2.load({ params: { condition: ""} });
this.comboxBANK2 = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: '银行账号2',flex:2,
store: this.StoreBANK2,
forceSelection: true,
name: 'ACCOUNT2',
valueField: 'GID',
displayField: 'BANKNAME',
listeners: {
change: function (field, newValue, oldValue) {
if (_this.ACCOUNT2_edit==true)
_this.ACCOUNT2 = field.value;
//alert("select "+_this.ACCOUNT1);
},
focus: function (field, newValue, oldValue) {
var COMPANYID = _this.formEdit.getForm().findField('COMPANYID').getValue();
var PAYBANK = _this.formEdit.getForm().findField('PAYBANK').getValue();
_this.ACCOUNT2 = field.value;
_this.StoreBANK2.load({ params: { condition: " linkid='"+COMPANYID+"' and bankname2='"+PAYBANK+"' and isnull(isstop,0)=0 "} });
_this.ACCOUNT2_edit=true;
},
blur: function (field, newValue, oldValue) {
var COMPANYID = _this.formEdit.getForm().findField('COMPANYID').getValue();
var PAYBANK = _this.formEdit.getForm().findField('PAYBANK').getValue();
_this.StoreBANK2.load({ async: false, params: { condition: " linkid='"+COMPANYID+"' and bankname2='"+PAYBANK+"'"} });
if (field.value == "") {
field.value = _this.ACCOUNT2;
}
if (field.displayTplData[0].ISSTOP == "True") {
alert("该往来单位已经停用");
}
_this.ACCOUNT2_edit=false;
},
scope: this
}
});
this.StoreBANK3 = Ext.create('DsExt.ux.RefTableStore', {
model: 'BANK',
proxy: { url: '/MvcShipping/MsBaseInfo/GetAllBANKList' },
listeners: {
load: function (field, newValue, oldValue) {
if (this.ACCOUNT3_first==true){
this.ACCOUNT3_first=false;
if (this.StoreBANK3.getCount()>1){
this.comboxBANK3.setValue(this.StoreBANK3.getAt(1).get('GID'));
}else{
this.comboxBANK3.setValue(this.StoreBANK3.getAt(0).get('GID'));
}
for (var i = 0; i < this.StoreBANK3.getCount(); i += 1) {
var member = this.StoreBANK3.getAt(i);
if (member.data.CURRENCY == "RMB") {
this.comboxBANK3.setValue(member.data.GID);
}
}
}
},
scope: this
}
});
//this.StoreBANK3.load({ params: { condition: ""} });
this.comboxBANK3 = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: '银行账号3',flex:2,
store: this.StoreBANK3,
forceSelection: true,
name: 'ACCOUNT3',
valueField: 'GID',
displayField: 'BANKNAME',
listeners: {
change: function (field, newValue, oldValue) {
if (_this.ACCOUNT3_edit==true)
_this.ACCOUNT3 = field.value;
//alert("select "+_this.ACCOUNT1);
},
focus: function (field, newValue, oldValue) {
var COMPANYID = _this.formEdit.getForm().findField('COMPANYID').getValue();
var PAYBANK = _this.formEdit.getForm().findField('PAYBANK').getValue();
_this.ACCOUNT3 = field.value;
_this.StoreBANK3.load({ params: { condition: " linkid='"+COMPANYID+"' and bankname2='"+PAYBANK+"' and isnull(isstop,0)=0 "} });
_this.ACCOUNT3_edit=true;
},
blur: function (field, newValue, oldValue) {
var COMPANYID = _this.formEdit.getForm().findField('COMPANYID').getValue();
var PAYBANK = _this.formEdit.getForm().findField('PAYBANK').getValue();
_this.StoreBANK3.load({ async: false, params: { condition: " linkid='"+COMPANYID+"' and bankname2='"+PAYBANK+"'"} });
if (field.value == "") {
field.value = _this.ACCOUNT3;
}
if (field.displayTplData[0].ISSTOP == "True") {
alert("该往来单位已经停用");
}
_this.ACCOUNT3_edit=false;
},
scope: this
}
});
this.StoreStlMode = Ext.create('DsExt.ux.RefTableStore', {
model: 'STLMODE',
proxy: { url: '/MvcShipping/MsBaseInfo/GetStlModeList' }
});
this.StoreStlMode.load({ params: { condition: ""} });
this.comboxStlMode = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: '结算方式',
store: this.StoreStlMode,
forceSelection: true,
name: 'SETTLETYPE',
valueField: 'STLCODE',
displayField: 'STLNAME'
});
//#endregion
//编辑form
this.formEdit = Ext.widget('form', {
region: 'center',
frame: true,
bodyPadding: 3,
trackResetOnLoad: true,
// autoScroll: true,
fieldDefaults: {
margins: '2 2 2 2',
labelAlign: 'right',
flex: 1,
labelWidth: 90,
msgTarget: 'qtip'
},
items: [
{//fieldset 1
xtype: 'fieldset',
defaultType: 'textfield',
layout: 'anchor',
defaults: {
anchor: '100%'
},
items: [{
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [{
fieldLabel: 'GID',
name: 'GID', flex: 0, hidden: true, margins: '0'
}, {
fieldLabel: 'BILLSTATUS',
name: 'BILLSTATUS', flex: 0, hidden: true, margins: '0'
}, {
fieldLabel: 'APPLICANT',id:"APPLICANT",
name: 'APPLICANT', flex: 0, hidden: true, margins: '0'
},
{
fieldLabel: '申请编号',
readOnly: true,
name: 'BILLNO'
}, {
fieldLabel: '状态',
readOnly: true,
name: 'BILLSTATUSREF'
}, this.comboxCustCode
,this.comboxCustACCOUNT
]
}, {
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [this.comboxCurr, {
fieldLabel: 'RMB金额',
name: 'AMOUNTRMB'
}, {
fieldLabel: '外币金额',
name: 'AMOUNTUSD'
}, {
fieldLabel: '申请支付日期',
format: 'Y-m-d',// H:i:s
xtype: 'datefield',
allowBlank: false,
name: 'PAYABLETIME'
}, this.comboxStlMode]
}, {
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [
this.comboxCompany,
this.comboxBank,
{
fieldLabel: '支票抬头',
name: 'CHEQUEPAYABLE'
}, {
fieldLabel: '支票备注',
name: 'CHEQUENUMREMARK'
},
{
fieldLabel: '申请人',
readOnly: true,
allowBlank:false,
name: 'APPLICANTNAME',
id:"APPLICANTNAME"
}]
}, {
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [{
fieldLabel: '发票号',
flex: 1,
name: 'INVNO'
}, {
fieldLabel: '发票日期',
flex: 1,
format: 'Y-m-d',
xtype: 'datefield',
name: 'INVDATE'
}, {
fieldLabel: '备注',
flex: 2,
name: 'REMARK'
},
{
fieldLabel: '申请日期',
readOnly: true,
name: 'APPLYTIME'
}]
}
////////////////////
, {
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [this.comboxCurr1, {
fieldLabel: '金额1',
flex: 1,value:"0",
name: 'AMOUNT1'
},this.comboxBANK1
,this.comboxInfoClientContact]
}
, {
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [this.comboxCurr2, {
fieldLabel: '金额2',
flex: 1,value:"0",
name: 'AMOUNT2'
},this.comboxBANK2,{xtype:'hiddenfield',flex:1}]
}
, {
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [this.comboxCurr3, {
fieldLabel: '金额3',
flex: 1,value:"0",
name: 'AMOUNT3'
},this.comboxBANK3,{xtype:'hiddenfield',flex:1}
, {
fieldLabel: 'EXCHANGERATE1',
flex: 1,hidden:true,
name: 'Exchangerate1'
}, {
fieldLabel: 'EXCHANGERATE2',
flex: 1,hidden:true,
name: 'Exchangerate2'
}, {
fieldLabel: 'EXCHANGERATE3',
flex: 1,hidden:true,
name: 'Exchangerate3'
}
]
}
]//end items(fieldset 1)
}//end fieldset 1
]//end root items
}); //end this.formEdit
//#endregion
//#region 按钮Toolbar
var menu1 = new Ext.menu.Menu({
id: 'basicMenu',
items: [{
text: "付费申请单",
handler: function (button, event) {
this.Print();
},
scope: this
}, {
text: '付汇申请套打',
handler: function (button, event) {
this.Print2();
},
scope: this
}]
});
this.panelBtn = new Ext.Panel({
region: "north",
tbar: [
{
id: 'btnESave',
text: "保存",
iconCls: "btnsave",
handler: function (button, event) {
this.Save('0');
},
scope: this
}, '-',
{
text: "打印", menu: menu1, scope: this
},
'-',
{
id: 'btnESaveAndClose',
text: "保存并关闭",
handler: function (button, event) {
this.Save('1');
},
scope: this
},
'-',
{
id: 'btnESaveAndNew',
text: "保存并新建",
handler: function (button, event) {
this.Save('2');
this.GetEditStatus();
},
scope: this
},
'-',
{
id: 'btnENew',
text: "新建",
handler: function (button, event) {
this.LoadData('add', '*');
},
scope: this
}, '-', {
id: 'btnSubmitAudit',
text: '提交审核',
tooltip: '提交审核',
handler: function (button, event) {
this.onSubmitAuditClick();
},
scope: this
}, {
id: 'btnSubmitAuditBack',
text: '撤销审核',
tooltip: '撤销审核',
handler: function (button, event) {
this.onSubmitAuditBackClick();
},
scope: this
},'-',{
id: 'btnAudit',hidden:true,
text: '审核通过',
tooltip: '审核通过',
handler: function (button, event) {
this.onAuditClick();
},
scope: this
}, {
id: 'btnAuditBack',hidden:true,
text: '审核驳回',
tooltip: '审核审核驳回',
handler: function (button, event) {
this.onAuditBackClick();
},
scope: this
}
]
}); //end 按钮Toolbar
//#endregion
//#region 明细表
//明细表表格相关
this.GridCheckBoxModel = Ext.create('Ext.selection.CheckboxModel');
//明细表-数据集
this.storeBodyList = Ext.create('Ext.data.Store', {
model: 'Chfee_do_detail_Import',
remoteSort: true,
proxy: {
type: 'ajax',
url: '/Account/Chfee_ForeignPay/GetBillList',
reader: {
id: 'BSNO,FEEDOID',
root: 'data',
totalProperty: 'totalCount'
}
}
});
//明细表表格
this.gridListCellEditing = Ext.create('Ext.grid.plugin.CellEditing', {
clicksToEdit: 1
});
this.initgirdcolums= [{
sortable: true,
dataIndex: 'BILLNO',
header: 'BILL',
hidden: true,
width: 100
}, {
sortable: true,
dataIndex: 'BSNO',
header: 'BSNO',
hidden: true,
width: 100
}, {
sortable: true,
dataIndex: 'FEEDOID',
header: 'FEEDOID',
hidden: true,
width: 100
}, {
sortable: true,
dataIndex: 'CUSTNO',
header: '合同号',
width: 120,
renderer: function (value, p, record) {
return value + ' ' + record.data.ORDERNO;
}
}, {
sortable: true,hidden:true,
dataIndex: 'ORDERNO',
header: 'ORDERNO',
width: 108
}, {
sortable: true,
dataIndex: 'MBLNO',
header: '主提单号',
width: 120
}, {
sortable: true,
dataIndex: 'CUSTOMERNAME',
header: '委托单位',
width: 100
}, {
sortable: true,hidden: true,
dataIndex: 'ETD',
header: '开船日期',
renderer: Ext.util.Format.dateRenderer('Y-m-d'),
width: 100
}, {
sortable: true,
dataIndex: 'PORTDISCHARGE',
header: '目的港',
width: 80
}, {
sortable: true,
dataIndex: 'FEENAME',
header: '费用名称',
width: 80
}, {
sortable: true,
dataIndex: 'FEETYPEREF',
header: '收付',
width: 40
}, {
sortable: true,
dataIndex: 'AMOUNT',
header: '申请金额',
width: 80
}, {
sortable: true,
dataIndex: 'ORIGCURRENCY',
header: '原始币别',
width: 80
}, {
sortable: true,
dataIndex: 'ORIGAMOUNT',
header: '原始金额',
width: 80
}, {
sortable: true,hidden: true,
dataIndex: 'SALE',
header: '揽货人',
width: 80
}, {
sortable: true,
dataIndex: 'COMPANYNAME',
header: '用证公司',
width: 80
}, {
sortable: true,
dataIndex: 'OPDATE',
header: '到港日',
width: 80
}
];
this.girdcolums= this.initgirdcolums;
this.gridList = new Ext.grid.GridPanel({
store: this.storeBodyList,
enableHdMenu: false,
region: 'center',
loadMask: { msg: "数据加载中,请稍等..." },
trackMouseOver: true,
disableSelection: false,
selModel: this.GridCheckBoxModel,
tbar: [{
text: '删除申请明细',
tooltip: '删除申请明细',
id: 'btndeldetail',
iconCls: "btndeletedetail",
handler: function (button, event) {
this.onDeleteClick(button, event, 1);
},
scope: this
}, {
text: "保存列表样式",
id: "btntest",
menu: [
{ text: "保存",
handler: function (button, event) {
this.girdcolums = DsTruck.SaveGridPanel(USERID, _this.formname_DO, _this.gridList.columns, _this.girdcolums, 1, true);
}
}, { text: "初始化",
handler: function (menu, event) {
//_this.InitGrid(_this.initgirdcolums);
_this.girdcolums = DsTruck.SaveGridPanel(USERID, _this.formname_DO, _this.gridList.columns, _this.initgirdcolums, 1, true);
}
}],
scope: this
}],
columns: this.girdcolums
});
/////////////以下部分为获取存储的gridpanel显示样式
this.girdcolums = DsTruck.GetGridPanel(USERID, this.formname_DO, this.girdcolums);
//使用者id,表名 ,中间column数组
this.girdcolums.unshift(new Ext.grid.RowNumberer());
this.gridList.reconfigure(this.storeBodyList, this.girdcolums);
////////////////////////////
//////
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.storeBodySum = Ext.create('Ext.data.Store', {
model: 'Chfee_do_sum',
remoteSort: true,
proxy: {
type: 'ajax',
url: '/Account/Chfee_ForeignPay/GetBillSum',
reader: {
root: 'data',
totalProperty: 'totalCount'
}
}
});
this.gridSum = new Ext.grid.GridPanel({
store: this.storeBodySum,
enableHdMenu: false,
region: 'center',
loadMask: { msg: "数据加载中,请稍等..." },
trackMouseOver: true,
disableSelection: false,
tbar: [{
xtype: 'label',
width: 120,
height: 22,
text: '申请金额合计'
}],
columns: [{
sortable: true,
dataIndex: 'FEETYPEREF',
header: '收付',
width: 40
}, {
sortable: true,
dataIndex: 'CURRENCY',
header: '币 别',
width: 80
}, {
sortable: true,
dataIndex: 'AMOUNT',
header: '金额',
width: 80
}
]
});
//#region 添加业务列表
this.storeBodyAddList = Ext.create('Ext.data.Store', {
pageSize: this.PageSize,
model: 'MsAddBillCustFee_Import',
remoteSort: true,
proxy: {
type: 'ajax',
url: '/Account/Chfee_ForeignPay/GetBillDataList',
reader: {
id: 'BSNO',
root: 'data',
totalProperty: 'totalCount'
}
}
});
this.initgirdcolums_AP= [{
sortable: true,
dataIndex: 'BSNO',
header: 'BSNO',
hidden: true,
width: 100
}, {
sortable: true,
dataIndex: 'CUSTNO',
header: '合同号',
width: 130,
renderer: function (value, p, record) {
return value + ' ' + record.data.ORDERNO;
}
}, {
sortable: true,hidden:true,
dataIndex: 'ORDERNO',
header: 'ORDERNO',
width: 108
}, {
sortable: true,
dataIndex: 'MBLNO',
header: '主提单号',
width: 108
}, {
sortable: true,
dataIndex: 'FEEOBJNAME',
header: '结算对象',
width: 90
}, {
sortable: true,
dataIndex: 'RMBCrBalAmount',
header: 'RMB未付',
width: 100
}, {
sortable: true,
dataIndex: 'USDCrBalAmount',
header: 'USD未付',
width: 100
}, {
sortable: true,
dataIndex: 'OTCrBalAmount',
header: '其他未付',
width: 100
}, {
sortable: true,
dataIndex: 'RMBDrBalAmount',
header: 'RMB未收',
width: 100
}, {
sortable: true,
dataIndex: 'USDDrBalAmount',
header: 'USD未收',
width: 100
}, {
sortable: true,
dataIndex: 'OTDrBalAmount',
header: '其他未收',
width: 100
}, {
sortable: true,
dataIndex: 'BALRMBINVCR',
header: 'RMB付未开票',
width: 70
}, {
sortable: true,
dataIndex: 'BALUSDINVCR',
header: 'USD付未开票',
width: 70
}, {
sortable: true,hidden:true,
dataIndex: 'OPLBNAME',
header: '业务类别',
width: 80
}, {
sortable: true,
dataIndex: 'CUSTOMERNAME',
header: '委托单位',
width: 100
},{
sortable: true,
dataIndex: 'COMPANYNAME',
header: '用证公司',
width: 100
}, {
sortable: true,
dataIndex: 'ORDERNO',
header: '业务编号',
width: 100
}, {
hidden: true,
dataIndex: 'COMPANYID',
header: 'COMPANYID',
width: 80
}, {
sortable: true,hidden:true,
dataIndex: 'ETD',
header: '开船日期',
renderer: Ext.util.Format.dateRenderer('Y-m-d'),
width: 100
},{
sortable: true,
dataIndex: 'OPDATE',
header: '到港日期',
renderer: Ext.util.Format.dateRenderer('Y-m-d'),
width: 100
}, {
sortable: true,hidden:true,
dataIndex: 'SALE',
header: '揽货人',
width: 80
}, {
sortable: true,hidden:true,
dataIndex: 'ACCDATE',
header: '会计期间',
width: 80
}, {
sortable: true,
dataIndex: 'OP',
header: '操作',
width: 80
}, {
sortable: true,hidden:true,
dataIndex: 'INPUTBY',
header: '录入人',
width: 80
}, {
sortable: true,
dataIndex: 'PORTLOAD',
header: '起运港',
width: 120
}, {
sortable: true,
dataIndex: 'PORTDISCHARGE',
header: '目的港',
width: 120
}, {
sortable: true,
dataIndex: 'VESSEL',
header: '船名',
width: 150
}, {
sortable: true,
dataIndex: 'VOYNO',
header: '航次',
width: 60
}
];
this.girdcolums_AP=this.initgirdcolums_AP;
_this=this;
this.AddGridCheckBoxModel = Ext.create('Ext.selection.CheckboxModel');
this.gridAddList = new Ext.grid.GridPanel({
store: this.storeBodyAddList,
enableHdMenu: false,
region: 'center',
loadMask: { msg: "数据加载中,请稍等..." },
trackMouseOver: true,
disableSelection: false,
selModel: this.AddGridCheckBoxModel,
tbar: [{
text: '添加申请明细',
tooltip: '添加申请明细',
id: 'btnaddbill',
iconCls: "btnadddetail",
handler: function (button, event) {
this.onAddClick(button, event);
},
scope: this
}, {
text: "保存列表样式",
id: "btntest2",
menu: [
{ text: "保存",
handler: function (button, event) {
_this.girdcolums_AP = DsTruck.SaveGridPanel(USERID, _this.formname_AP, _this.gridAddList.columns, _this.girdcolums_AP, 1, true);
}
}, { text: "初始化",
handler: function (menu, event) {
//_this.InitGrid(_this.initgirdcolums);
_this.girdcolums_AP = DsTruck.SaveGridPanel(USERID, _this.formname_AP, _this.gridAddList.columns, _this.initgirdcolums_AP, 1, true);
}
}],
scope: this
}],
columns: this.girdcolums_AP,
// paging bar on the bottom
bbar: Ext.create('Ext.PagingToolbar', {
store: this.storeBodyAddList,
displayInfo: true,
displayMsg: '当前显示 {0} - {1}条记录 /共 {2}条记录',
emptyMsg: "没有数据"
})
});
/////////////以下部分为获取存储的gridpanel显示样式
this.girdcolums_AP = DsTruck.GetGridPanel(USERID, this.formname_AP, this.girdcolums_AP);
//使用者id,表名 ,中间column数组
this.girdcolums_AP.unshift(new Ext.grid.RowNumberer());
this.gridAddList.reconfigure(this.storeBodyAddList, this.girdcolums_AP);
////////////////////////////
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 = "";
if (record.data.OPLBNAME == "海运出口") {
openUrl = "/baseinfo/opseaebaseinfo.aspx?handle=check&bsno=" + record.data.BSNO;
}
else if (record.data.OPLBNAME == "海运进口" || record.data.OPLBNAME == "海运进口散货") {
openUrl = "/baseinfo/opseaibaseinfo.aspx?handle=check&bsno=" + record.data.BSNO;
} else if (record.data.OPLBNAME == "报关业务") {
openUrl = "/MvcShipping/MsOpApply/ApplyFeeView?handle=check&bsno=" + record.data.BSNO;
} else if (record.data.OPLBNAME == "进口贸易") {
this.BSNO = record.data.BSNO;
this.OprationStatus = 'view';
DsOpenEditWin('/Import/PortOperate/Edit', this.BSNO, "750", "1000");
}
if (record.data.OPLBNAME != "进口贸易" && record.data.OPLBNAME != "贸易融资")
window.open(openUrl, openType, openSet);
}, this);
_this = this;
this.CurrGroup = new Ext.form.RadioGroup({
id: 'CurrGroup',
xtype: 'radiogroup',
fieldLabel: '折算币别',
columns: 2,
items: [
{ boxLabel: 'RMB', name: 'Curr', inputValue: 'RMB', checked: true },
{ boxLabel: 'USD', name: 'Curr', inputValue: 'USD' }
]
});
//#endregion
//#region 添加费用列表
this.storeAddFeeList = Ext.create('Ext.data.Store', {
pageSize: this.PageSize,
model: 'Chfee_add_detail',
remoteSort: true,
proxy: {
type: 'ajax',
url: '/Account/Chfee_ForeignPay/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.gridAddFeeList = new Ext.grid.GridPanel({
store: this.storeAddFeeList,
enableHdMenu: false,
region: 'center',
loadMask: { msg: "数据加载中,请稍等..." },
trackMouseOver: true,
disableSelection: false,
plugins: [this.cellEditingFee],
selModel: this.AddFeeGridCheckBoxModel,
tbar: [{
text: '添加申请费用明细',
tooltip: '添加申请费用明细',
iconCls: "btnadddetail",
id: "btnadddetail",
handler: function (button, event) {
this.onAddDetailClick(button, event);
},
scope: this
}, { xtype: "label", id: "zongshu", text: ""
}],
columns: [{
sortable: true,
dataIndex: 'CH_ID',
header: 'CH_ID',
hidden: true,
width: 100
}, {
sortable: true,
dataIndex: 'BSNO',
header: 'BSNO',
hidden: true,
width: 100
}, {
sortable: false,
dataIndex: 'CustomerName',
header: '客户名称',
width: 90
}, {
sortable: false,
dataIndex: 'FeeType_Ref',
header: '收付',
width: 40
}, {
sortable: false,
dataIndex: 'FeeName',
header: '费用名称',
width: 90
}, {
sortable: false,
dataIndex: 'Amount',
header: '金额',
width: 70,
renderer: function (value, cellmeta, record, rowIndex, columnIndex, store) {
try {
var lsValue = usMoney(value, 2, '', false);
if (lsValue != "NaN") {
value = lsValue; if (parseFloat(lsValue) < 0) {
return '' + lsValue + '';
}
}
else {
return value;
}
}
catch (e) {
return value;
}
return value;
}
}, {
sortable: false,
dataIndex: 'Currency',
header: '币别',
width: 40
}, {
sortable: false,
dataIndex: 'BalAmount',
header: '未结金额',
width: 70,
renderer: function (value, cellmeta, record, rowIndex, columnIndex, store) {
try {
var lsValue = usMoney(value, 2, '', false);
if (lsValue != "NaN") {
value = lsValue; if (parseFloat(lsValue) < 0) {
return '' + lsValue + '';
}
}
else {
return value;
}
}
catch (e) {
return value;
}
return value;
}
}, {
sortable: false,
dataIndex: 'StlAmount',
header: '本次结算金额',
editor: {
xtype: 'numberfield',
allowDecimals: true, //允许输入小数
decimalPrecision: 2,
nanText: '请输入有效小数',
keyNavEnabled: false,
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 '' + lsValue + '';
}
}
else {
return value;
}
}
catch (e) {
return value;
}
return value;
},
width: 70
}, {
sortable: false,
dataIndex: 'ExChangerate',
header: '原始汇率',
width: 60
}, {
sortable: false,
dataIndex: 'Invoice',
header: '开票金额',
width: 60,
renderer: function (value, cellmeta, record, rowIndex, columnIndex, store) {
try {
var lsValue = usMoney(value, 2, '', false);
if (lsValue != "NaN") {
value = lsValue; if (parseFloat(lsValue) < 0) {
return '' + lsValue + '';
}
}
else {
return value;
}
}
catch (e) {
return value;
}
return value;
}
}
],
// paging bar on the bottom
bbar: Ext.create('Ext.PagingToolbar', {
store: this.storeAddFeeList,
displayInfo: true,
displayMsg: '当前显示 {0} - {1}条记录 /共 {2}条记录',
emptyMsg: "没有数据"
})
});
this.gridAddFeeList.on('edit', function (editor, e, eOpts) {
this.gridAddFeeListAfterEdit(editor, e, eOpts);
}, this);
this.storeSelectSum = Ext.create('Ext.data.Store', {
model: 'Chfee_do_selectsum'
});
this.gridSelectSum = new Ext.grid.GridPanel({
store: this.storeSelectSum,
enableHdMenu: false,
// anchor: '100% 50%',
region: 'south',
height: 80,
loadMask: { msg: "数据加载中,请稍等..." },
trackMouseOver: true,
disableSelection: false,
tbar: [{
xtype: 'label',
width: 220,
id: 'SelectGrid',
height: 22,
text: '所选费用合计'
}],
columns: [{
sortable: true,
dataIndex: 'RMBDRAMOUNT',
header: 'RMB未收',
width: 80,
renderer: function (value, cellmeta, record, rowIndex, columnIndex, store) {
try {
var lsValue = usMoney(value, 2, '', false);
if (lsValue != "NaN") {
value = lsValue; if (parseFloat(lsValue) < 0) {
return '' + lsValue + '';
}
}
else {
return value;
}
}
catch (e) {
return value;
}
return value;
}
}, {
sortable: true,
dataIndex: 'RMBCRAMOUNT',
header: 'RMB未付',
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 '' + lsValue + '';
}
}
else {
return value;
}
}
catch (e) {
return value;
}
return value;
}
}, {
sortable: true,
dataIndex: 'USDDRAMOUNT',
header: 'USD未收',
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 '' + lsValue + '';
}
}
else {
return value;
}
}
catch (e) {
return value;
}
return value;
}
}, {
sortable: true,
dataIndex: 'USDCRAMOUNT',
header: 'USD未付',
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 '' + lsValue + '';
}
}
else {
return value;
}
}
catch (e) {
return value;
}
return value;
}
}, {
sortable: true,
dataIndex: 'OTDRAMOUNT',
header: '其他未收',
width: 80,
renderer: function (value, cellmeta, record, rowIndex, columnIndex, store) {
try {
var lsValue = usMoney(value, 2, '', false);
if (lsValue != "NaN") {
value = lsValue; if (parseFloat(lsValue) < 0) {
return '' + lsValue + '';
}
}
else {
return value;
}
}
catch (e) {
return value;
}
return value;
}
}, {
sortable: true,
dataIndex: 'OTCRAMOUNT',
header: '其他未付',
width: 80,
renderer: function (value, cellmeta, record, rowIndex, columnIndex, store) {
try {
var lsValue = usMoney(value, 2, '', false);
if (lsValue != "NaN") {
value = lsValue; if (parseFloat(lsValue) < 0) {
return '' + lsValue + '';
}
}
else {
return value;
}
}
catch (e) {
return value;
}
return value;
}
}
]
});
//#endregion
_this = this;
this.storeCustCodefee = Ext.create('DsExt.ux.RefTableStore', {
model: 'DsShipping.ux.CustomInvRefModel',
proxy: { url: '/CommMng/BasicDataRef/GetCustomInvRefList' }
});
this.storeCustCodefee.load({ params: { condition: ""} });
this.comboxAddCustCode = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: '费用对象',
store: this.storeCustCodefee,
forceSelection: true,
name: 'CUSTNAME',
valueField: 'CustName',
displayField: 'CodeAndName',
enableKeyEvents: true,
listeners: {
keyup: function (field, e) {
if (e.getKey() == e.ENTER) {
_this.onRefreshClick();
}
}
}
});
this.StoreOpLb = Ext.create('Ext.data.Store', {
fields: ['OPLBNAME']
});
this.StoreOpLb.add({ "OPLBNAME": "海运出口" });
this.StoreOpLb.add({ "OPLBNAME": "海运进口" });
this.StoreOpLb.add({ "OPLBNAME": "报关业务" });
this.StoreOpLb.add({ "OPLBNAME": "进口贸易" });
this.StoreOpLb.add({ "OPLBNAME": "大宗散货" });
this.StoreOpLb.add({ "OPLBNAME": "综合业务" });
this.comboxOpLb = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: '业务类别',
store: this.StoreOpLb,
valueField: 'OPLBNAME',
displayField: 'OPLBNAME',
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: '收/付',
store: this.storeAddDCType,
valueField: 'DC',
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: '币别',
store: this.StoreCurr,
forceSelection: true,
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.storeFeeNameRef.load({ params: { condition: ""} });
this.comboxFeeNameRef = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: '费用名称',
store: this.storeFeeNameRef,
forceSelection: true,
name: 'FeeName',
valueField: 'Name',
displayField: 'CodeAndName',
enableKeyEvents: true,
listeners: {
keyup: function (field, e) {
if (e.getKey() == e.ENTER) {
_this.onRefreshClick();
}
}
}
});
this.storeFeeCheck = Ext.create('DsExt.ux.RefTableStore', {
model: 'DsShipping.ux.FeeTypeRefModel',
proxy: { url: '/MvcShipping/MsChFee/GetFeeTypeRefList' }
});
this.storeFeeCheck.load({ params: { condition: " name in ( select name from code_fee where feegroup in(select feeName from code_PROFIT where FEEGROUP='冷藏')) "} });
this.storeCompany2 = Ext.create('DsExt.ux.RefTableStore', {
model: 'companymb', proxy: { url: '/CommMng/BasicDataRef/GetcompanyList'}
});
this.storeCompany2.load({ params: { condition: ""} });
this.comboxCompany2 = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: '分公司',
forceSelection: true,
store: this.storeCompany2,
name: 'company',
valueField: 'gid',
displayField: 'name'
});
this.storeport = Ext.create('DsExt.ux.RefEnumStore', {});
this.storeport.load({ params: { enumTypeId: 10} });
this.comboxport = Ext.create('DsExt.ux.RefEnumCombox', {
fieldLabel: '目的港',
forceSelection: true,
store: this.storeport,
name: 'port',
valueField: 'EnumValueName',
displayField: 'EnumValueName',
});
this.storeCurrExrate = Ext.create('Ext.data.Store', {
fields: ['CURR', 'EXRATE', 'DFEXRATE']
});
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, this.comboxOpLb, {
fieldLabel: '编号检索',
name: 'CustomNo',
enableKeyEvents: true,
listeners: {
specialkey: function (field, e) {
if (e.getKey() == e.ENTER) {
_this.onRefreshClick();
}
}
}
}, {
fieldLabel: '从业务日期',
format: 'Y-m-d',
xtype: 'datefield',
name: 'ExpDateBgn',
enableKeyEvents: true,
listeners: {
specialkey: function (field, e) {
if (e.getKey() == e.ENTER) {
_this.onRefreshClick();
}
}
}
}, {
fieldLabel: '到业务日期',
format: 'Y-m-d',
xtype: 'datefield',
name: 'ExpDateEnd',
enableKeyEvents: true,
listeners: {
specialkey: function (field, e) {
if (e.getKey() == e.ENTER) {
_this.onRefreshClick();
}
}
}
},{
xtype: 'button',
flex:0.5,
text: "执行查询",
iconCls: "btnrefresh",
handler: function (button, event) {
this.onRefreshClick(button, event);
},
scope: this
}, {
xtype: 'button',
flex:0.5,
text: "重置条件",
iconCls: "btnreset",
handler: function (button, event) {
this.onClearSql(button, event);
},
scope: this
}
]
},
{
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [this.comboxaddDCType, this.comboxCurr2, this.comboxFeeNameRef,
this.comboxCompany2,this.comboxport,
{
xtype: 'button',
flex:0.5,
text: "高级查询",
iconCls: "btnmore",
handler: function (button, event) {
var sql = this.getCondition();
if (this.winAccess == '' || typeof (this.winAccess) == "undefined") {
this.winAccess = new Shipping.DsQuery({});
} else {
this.winAccess.destroy();
this.winAccess = new Shipping.DsQuery({});
}
this.winAccess.StoreList = this.storeList;
this.winAccess.formname = this.formname;
this.winAccess.condition = sql;
this.winAccess.LoadQueryData_self(this.formname);
this.winAccess.show();
return;
},
scope: this
},{xtype:'hiddenfield',flex:0.5}
]
}
]//end items(fieldset 1)
}//end fieldset 1
]//end root items
});
this.panelService = new Ext.Panel({
layout: "border",
region: 'center',
margin: '2 2',
items: [this.gridList]
});
this.panelSum = new Ext.Panel({
layout: "border",
region: 'east',
width: 260,
split: true,
margin: '2 2',
items: [this.gridSum]
});
this.paneldetail = new Ext.Panel({
title: '申请明细',
layout: "border",
height: 240,
region: "north",
split: true,
items: [
this.panelService, this.panelSum
]
});
this.panelAddService = new Ext.Panel({
layout: "border",
region: 'center',
margin: '2 2',
items: [this.gridAddList]
});
this.panelAddfee = new Ext.Panel({
layout: "border",
region: 'east',
width: 550,
split: true,
margin: '2 2',
items: [this.gridAddFeeList, this.gridSelectSum]
});
this.paneladddetail = new Ext.Panel({
layout: "border",
region: 'north',
height:300,
items: [this.panelAddService, this.panelAddfee
]
});
this.paneladd = new Ext.Panel({
title: '添加支付结算明细',
layout: "border",
region: "center",
autoScroll: true,
items: [
this.formSearch, this.paneladddetail
]
});
//#endregion 明细表
//#region 布局
//控件布局
this.panelTop = new Ext.Panel({
layout: "border",
region: "north",
height: 250,
items: [this.panelBtn, this.formEdit]
});
Ext.apply(this, {
items: [this.panelTop, this.paneldetail, this.paneladd]
});
//#endregion
//绑定查询窗体
this.ParentWin = window.parent.opener;
//初始化数据
this.InitData();
//绑定事件
var billno = '*';
if (this.opStatus == 'edit') {
billno = this.editRecord.get('BILLNO');
};
this.storeBodyList.on('beforeload', function (store) {
var sql = " BILLNO='" + billno + "'";
Ext.apply(store.proxy.extraParams, { condition: sql });
}, this);
this.storeBodyList.on('load', function (store, records) {
if (store.getCount() > 0) {
this.gridList.getSelectionModel().select(0);
}
}, this);
this.storeBodyAddList.on('beforeload', function (store) {
var sql = this.getCondition();
Ext.apply(store.proxy.extraParams, { condition: this.BillSql });
}, this);
this.storeBodyAddList.on('load', function (store, records) {
if (store.getCount() > 0) {
this.gridAddList.getSelectionModel().select(0);
} else {
this.storeAddFeeList.removeAll();
}
}, this);
this.gridAddList.getSelectionModel().on('select', function (model, record, index) {
var bsno = record.data.BSNO;
var feeobjname = record.data.FEEOBJNAME;
var sql = "";
sql = " BSNO='" + bsno + "' AND CUSTOMERNAME='" + feeobjname + "'";
sql = sql + getAndConSql(sql, this.FeeSqlStr, this.FeeSqlStr);
this.storeAddFeeList.load({ params: { condition: sql} });
}, this);
_this = this;
this.gridAddList.on({
selectionchange: function (sm, selections) {
_this.onSelectFee();
var SelectGridtext = Ext.getCmp('SelectGrid');
_this.storeSelectSum.removeAll();
SelectGridtext.setText('所选费用合计');
if (selections.length == 0) {
return;
}
_this.storeSelectSum.add({ "RMBDRAMOUNT": 0, "RMBCRAMOUNT": 0, "USDDRAMOUNT": 0, "USDCRAMOUNT": 0, "OTDRAMOUNT": 0, "OTCRAMOUNT": 0 });
var R = selections.length;
for (var i = 0; i < selections.length; i++) {
var rec = selections[i];
var memberyf = _this.storeSelectSum.getAt(0);
var amount = memberyf.data.RMBDRAMOUNT;
var cramount = memberyf.data.RMBCRAMOUNT;
amount = (parseFloat(amount).add(parseFloat(rec.data.RMBDrBalAmount))).toFixed(2);
cramount = (parseFloat(cramount).add(parseFloat(rec.data.RMBCrBalAmount))).toFixed(2);
var usdamount = memberyf.data.USDDRAMOUNT;
var usdcramount = memberyf.data.USDCRAMOUNT;
usdamount = (parseFloat(usdamount).add(parseFloat(rec.data.USDDrBalAmount))).toFixed(2);
usdcramount = (parseFloat(usdcramount).add(parseFloat(rec.data.USDCrBalAmount))).toFixed(2);
var otamount = memberyf.data.OTDRAMOUNT;
var otcramount = memberyf.data.OTCRAMOUNT;
otamount = (parseFloat(otamount).add(parseFloat(rec.data.OTDrBalAmount))).toFixed(2);
otcramount = (parseFloat(otcramount).add(parseFloat(rec.data.OTCrBalAmount))).toFixed(2);
memberyf.set("RMBDRAMOUNT", amount);
memberyf.set("RMBCRAMOUNT", cramount);
memberyf.set("USDDRAMOUNT", usdamount);
memberyf.set("USDCRAMOUNT", usdcramount);
memberyf.set("OTDRAMOUNT", otamount);
memberyf.set("OTCRAMOUNT", otcramount);
memberyf.commit();
}
SelectGridtext.setText('所选费用合计(选中' + R + '票业务)');
}
});
this.gridAddFeeList.getSelectionModel().on('select', function (button, event) {
//Ext.getCmp("zongshu").setText("1234");
this.onSelectFee(button, event);
}, this);
this.gridAddFeeList.on('cellclick', function (button, event) {
//Ext.getCmp("zongshu").setText("1234");
this.onSelectFee(button, event);
}, this);
///////////////////增加可操作性限制
//0全部 除了审核通过状态 任何时候都可以保存
//1业务 未提交可以保存 提交之后即不可保存
//2财务 提交审核可以保存 未提交和审核通过都不能保存
var me = this;
Ext.Ajax.request({
waitMsg: '正在查询用户权限...',
url: '/CommMng/BasicDataRef/GetAuthorityRange',
params: {
modName: "modPaySettleAppList",
USERID: USERID
},
callback: function (options, success, response) {
if (success) {
var result = Ext.JSON.decode(response.responseText);
rec = result.data;
this.VISIBLERANGE = rec.VISIBLERANGE;
this.OPERATERANGE = rec.OPERATERANGE;
//this.setBtnEnable();
}
else
Ext.MessageBox.alert('请求出现错误,请重试', response.responseText);
},
scope: this
}); //request over
}, //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 = " cm.BILLNO='" + this.editRecord.get('BILLNO') + "'";
this.LoadData(this.opStatus, condition);
}, //end InitData
LoadData: function (opstatus, condition) {
this.serialNo = 0;
this.workSerialNo = 0;
this.bodyDel = [];
this.opStatus = opstatus;
_this = this;
Ext.Ajax.request({
waitMsg: '正在查询主表数据...',
url: '/Account/Chfee_ForeignPay/GetData',
params: {
handle: opstatus,
condition: condition
},
callback: function (options, success, response) {
if (success) {
var result = Ext.JSON.decode(response.responseText);
if (!result.Success) {
Ext.Msg.show({
title: '提示',
msg: result.Message,
icon: Ext.MessageBox.ERROR,
buttons: Ext.Msg.OK
});
return;
}
var data = result.data;
Ext.getCmp("CURR").setValue(data.CURR);
if (data.CUSTOMERNAME!="")
{
/*this.storeCustACCOUNT.load({
async: false,
params: { condition: " LINKID=(select GID from info_client where shortname='"+data.CUSTOMERNAME+"') "}
});*/
this.LoadCustACCOUNT(data.CUSTOMERNAME);
}
_this.formEdit.getForm().findField('BILLSTATUS').setDisabled(false);
_this.formEdit.getForm().reset();
_this.formEdit.getForm().setValues(data);
if (data.APPLICANTNAME==""||data.APPLICANT==""){
//20160518 增强的防止申请人丢失
data.APPLICANTNAME=SHOWNAME;
data.APPLICANT=USERID;
Ext.getCmp("APPLICANTNAME").setValue(SHOWNAME);
Ext.getCmp("APPLICANT").setValue(USERID);
}
if (data.APPLICANTNAME==""){
Ext.MessageBox.alert('未能正确取得申请人信息,请退出重新登录', response.responseText);
return;
}
_this.formEdit.getForm().findField('BILLSTATUS').setDisabled(true);
_this.GetEditStatus();
var CUSTOMERNAME = this.formEdit.getForm().findField('CUSTOMERNAME').getValue();
if (CUSTOMERNAME == '') {return;}
else {
var CUSTNAME = this.formSearch.getForm().findField('CUSTNAME');
var tmpcust = CUSTNAME.getValue();
if (tmpcust == '' || tmpcust == null || tmpcust == undefined) {
CUSTNAME.setValue(CUSTOMERNAME);
}
this.LoadCustACCOUNT(CUSTOMERNAME);
}
var COMPANYID = this.formEdit.getForm().findField('COMPANYID').getValue();
this.storeBank.load({ params: { condition: " select distinct bankname2 as GVALUE,'' as GID from sys_bank where linkid='"+COMPANYID+"' " }});
this.LoadAllBankAccount();
_this.formEdit.getForm().setValues(data);
} else {
Ext.MessageBox.alert('请求出现错误,请重试', response.responseText);
}
},
scope: this
});
var billno = '*';
if (this.opStatus == 'edit') {
billno = this.editRecord.get('BILLNO');
};
this.storeBodyList.load({ params: { 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
OprationSwap: function () {
var ret = new Array();
ret[0] = 'view';
ret[1] = this.SelectedRecord.get('BSNO');
//ret[2] = this.SelectedRecord;
return ret;
},
LoadBankAccount:function(){
var COMPANYID = this.formEdit.getForm().findField('COMPANYID').getValue();
var PAYBANK = this.formEdit.getForm().findField('PAYBANK').getValue();
this.StoreBANK1.load({ params: { condition: " linkid='"+COMPANYID+"' and bankname2='"+PAYBANK+"' and isnull(isstop,0)=0"} });
this.StoreBANK2.load({ params: { condition: " linkid='"+COMPANYID+"' and bankname2='"+PAYBANK+"' and isnull(isstop,0)=0"} });
this.StoreBANK3.load({ params: { condition: " linkid='"+COMPANYID+"' and bankname2='"+PAYBANK+"' and isnull(isstop,0)=0"} });
},
LoadAllBankAccount:function(){
var COMPANYID = this.formEdit.getForm().findField('COMPANYID').getValue();
var PAYBANK = this.formEdit.getForm().findField('PAYBANK').getValue();
this.StoreBANK1.load({ params: { condition: " linkid='"+COMPANYID+"' and bankname2='"+PAYBANK+"'"} });
this.StoreBANK2.load({ params: { condition: " linkid='"+COMPANYID+"' and bankname2='"+PAYBANK+"'"} });
this.StoreBANK3.load({ params: { condition: " linkid='"+COMPANYID+"' and bankname2='"+PAYBANK+"'"} });
},
Save: function (type) {
var basicForm = this.formEdit.getForm();
if (!basicForm.isValid()) {
return;
}
///
basicForm = this.formEdit.getForm();
var ACCOUNT1=basicForm.findField('ACCOUNT1').getValue();
var ACCOUNT2=basicForm.findField('ACCOUNT2').getValue();
var ACCOUNT3=basicForm.findField('ACCOUNT3').getValue();
var _ACCOUNT = DsStoreQueryBy(this.StoreBANK1, 'GID',ACCOUNT1 );
if (_ACCOUNT.getCount() > 0) {
var _ACCOUNTdata = _ACCOUNT.getAt(0).data;
if (_ACCOUNTdata.ISSTOP=="True"){
alert("你选择的银行帐户1已经停用");
}
}
_ACCOUNT = DsStoreQueryBy(this.StoreBANK2, 'GID',ACCOUNT2 );
if (_ACCOUNT.getCount() > 0) {
var _ACCOUNTdata = _ACCOUNT.getAt(0).data;
if (_ACCOUNTdata.ISSTOP=="True"){
alert("你选择的银行帐户2已经停用");
}
}
_ACCOUNT = DsStoreQueryBy(this.StoreBANK3, 'GID',ACCOUNT3 );
if (_ACCOUNT.getCount() > 0) {
var _ACCOUNTdata = _ACCOUNT.getAt(0).data;
if (_ACCOUNTdata.ISSTOP=="True"){
alert("你选择的银行帐户3已经停用");
}
}
///
//alert(Ext.getCmp("CUSTACCOUNTGID").getValue());
this.formEdit.getForm().findField('BILLSTATUS').setDisabled(false);
this.formEdit.getForm().findField('APPLICANT').setDisabled(false);
//this.formEdit.getForm().findField('COMPANYID').setDisabled(false);
var data = basicForm.getValues();
this.formEdit.getForm().findField('BILLSTATUS').setDisabled(true);
this.formEdit.getForm().findField('APPLICANT').setDisabled(true);
//this.formEdit.getForm().findField('COMPANYID').setDisabled(true);
Ext.Msg.wait('正在保存数据, 请稍侯..');
Ext.Ajax.request({
waitMsg: '正在保存数据...',
url: '/Account/Chfee_ForeignPay/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.add(returnData);
this.editRecord = arrNewRecords[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', '');
}
} else {
Ext.Msg.show({ title: '错误', msg: jsonresult.Message, icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK });
}
} else {
Ext.Msg.show({ title: '请重试',
msg: '服务器响应出错',
icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK
});
}
}
});
}, //end save
onAddDetailClick: function (button, event) {
this.addstore = true;
this.addDetail();
}, //end onAddDetailClick
onAddBillClick: function (button, event) {
this.addstore = true;
this.addBill();
}, //end onAddDetailClick
onDelDetailClick: function (button, event, type) {
this.deleteDetail();
}, //onDelDetailClick
onAddClick: function (button, event) {
this.addstore = true;
this.addBill();
}, //end onAddDetailClick
onDeleteClick: function (button, event) {
this.deleteBill();
}, //end onAddDetailClick
gridAddFeeListAfterEdit: function (editor, e, eOpts) {
//需要自己实现里面的事件
if (e.value == e.originalValue) return;
if (e.field == 'StlAmount') {
var BalAmount = e.record.data['BalAmount'];
var StlAmount = e.record.data['StlAmount'];
if (BalAmount >= 0) {
if (StlAmount > BalAmount) {
e.record.set('StlAmount', BalAmount);
Ext.Msg.show({ title: '提示', msg: '申请金额不能大于未申金额!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
}
} else {
if (StlAmount < BalAmount) {
e.record.set('StlAmount', BalAmount);
Ext.Msg.show({ title: '提示', msg: '申请金额不能大于未申金额!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
}
}
}
},
onNextKeyClick: function (col) {
var rows = this.gridAddFeeList.getSelectionModel().getSelection();
var row = rows[rows.length - 1];
var s = this.gridAddFeeList.getStore();
var number = s.indexOf(row) + 1;
this.cellEditingFee.startEditByPosition({ row: number, column: col });
},
onUpKeyClick: function (col) {
var rows = this.gridAddFeeList.getSelectionModel().getSelection();
var row = rows[rows.length - 1];
var s = this.gridAddFeeList.getStore();
var number = s.indexOf(row) - 1;
if (number < 0) number = 0;
this.cellEditingFee.startEditByPosition({ row: number, column: col });
},
addDetail: function () {
var basicForm = this.formEdit.getForm();
var Duino = this.formEdit.getForm().findField('BILLNO').getValue();
var BodyRecords = this.gridAddList.selModel.getSelection();
var rec = BodyRecords[0];
var _COMPANYID = rec.data.COMPANYID;
this.SetCompany(_COMPANYID);
_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);
if ((CURR == '') || (CURR == null))
this.formEdit.getForm().findField('CURR').setValue(curr);
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()) {
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('正在保存数据, 请稍侯..');
Ext.Ajax.request({
waitMsg: '正在保存数据...',
url: '/Account/Chfee_ForeignPay/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.add(returnData);
this.editRecord = arrNewRecords[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 {
Ext.Msg.show({ title: '错误', msg: jsonresult.Message, icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK });
}
} else {
Ext.Msg.show({ title: '请重试',
msg: '服务器响应出错',
icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK
});
}
}
});
} else {
this.addDetailfn();
}
},
addDetailfn: function () {
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)) {
Ext.Msg.show({ title: '提示', msg: '当前状态无法添加付费申请明细!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
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 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 bsno = rec.data.BSNO;
var curr = rec.data.Currency;
var ExChangerate = rec.data.ExChangerate;
var CURR = this.formEdit.getForm().findField('CURR').getValue();
if ((CURR == '') || (CURR == null))
{
this.formEdit.getForm().findField('CURR').setValue(curr);
this.formSearch.getForm().findField('Currency').setValue(curr);
}
if (cust == billcust) {
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.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 });
}
}
if (bodyAddDatas.length == 0) {
Ext.Msg.show({ title: '提示', msg: '没有要添加的费用明细!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
return;
};
var jsonbodyAddDatas = ConvertRecordsToJsonAll(bodyAddDatas);
Ext.Ajax.request({
waitMsg: '正在添加数据...',
url: '/Account/Chfee_ForeignPay/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: '提示',
msg: result.Message,
icon: Ext.MessageBox.ERROR,
buttons: Ext.Msg.OK
});
return;
} else {
var sql = this.BillSql;
this.storeBodyAddList.load({ params: { start: 0, limit: _this.PageSize, sort: '', condition: sql} });
_this.storeBodyList.load({ params: { 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: '正在查询主表数据...',
url: '/Account/Chfee_ForeignPay/GetData',
params: {
handle: 'edit',
condition: " cm.BILLNO='" + billno + "'"
},
callback: function (options, success, response) {
if (success) {
var result = Ext.JSON.decode(response.responseText);
if (!result.Success) {
Ext.Msg.show({
title: '提示',
msg: result.Message,
icon: Ext.MessageBox.ERROR,
buttons: Ext.Msg.OK
});
return;
}
var data = result.data;
this.formEdit.getForm().reset();
this.formEdit.getForm().setValues(data);
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('请求出现错误,请重试', response.responseText);
}
},
scope: this
});
}
} else {
Ext.MessageBox.alert('请求出现错误,请重试', response.responseText);
}
},
scope: this
});
},
addBill: function () {
var basicForm = this.formEdit.getForm();
var Duino = this.formEdit.getForm().findField('BILLNO').getValue();
_this = this;
var BodyRecords = this.gridAddList.selModel.getSelection();
var recBody = BodyRecords[0];
//this.formEdit.getForm().findField('COMPANYID').setValue(recBody.data.COMPANYID);
this.SetCompany(recBody.data.COMPANYID);
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);
/*
this.storeCustACCOUNT.load({
async: false,
params: { condition: " LINKID=(select GID from info_client where shortname='"+cust+"') "}
});*/
this.LoadCustACCOUNT(cust);
} else {
Ext.Msg.show({ title: '提示', msg: '核算客户不能为空!', 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);
}
if (!basicForm.isValid()) {
return;
}
var type = 0;
var data = basicForm.getValues();
Ext.Msg.wait('正在保存数据, 请稍侯..');
Ext.Ajax.request({
waitMsg: '正在保存数据...',
url: '/Account/Chfee_ForeignPay/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.add(returnData);
this.editRecord = arrNewRecords[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 {
Ext.Msg.show({ title: '错误', msg: jsonresult.Message, icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK });
}
} else {
Ext.Msg.show({ title: '请重试',
msg: '服务器响应出错',
icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK
});
}
}
});
} else {
this.addBillfn();
}
}, //end save
addBillfn: function () {
var billstatus = this.formEdit.getForm().findField('BILLSTATUS').getValue();
if ((billstatus != 1) && (billstatus != 6)) {
Ext.Msg.show({ title: '提示', msg: '当前状态无法添加付费申请明细!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
return;
}
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 feeBSNOSql = '';
var sql = '';
var selectedRecords = this.gridAddList.selModel.getSelection();
var BodyRecords = this.gridAddList.selModel.getSelection();
var recBody = BodyRecords[0];
this.SetCompany(recBody.data.COMPANYID);
//this.formEdit.getForm().findField('COMPANYID').setValue(recBody.data.COMPANYID);
if (selectedRecords.length == 0) {
Ext.Msg.show({ title: '提示', msg: '没有选择要添加的业务!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
return;
};
var bodyAddDatas = [];
for (var i = 0; i < selectedRecords.length; i++) {
var rec = selectedRecords[i];
var feeBSNO = "'" + rec.data.BSNO + "'";
if (feeBSNOSql == '') {
feeBSNOSql = feeBSNO;
} else {
feeBSNOSql = feeBSNOSql + "," + feeBSNO;
}
}
if (feeBSNOSql == '') {
sql = "";
}
else {
sql = " BSNO IN (" + 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: '正在添加数据...',
url: '/Account/Chfee_ForeignPay/AddBill',
params: {
billno: billno,
billcust: billcust,
billcurr: billcurr,
feesql: sql,
storeCurrExrate: currBody
},
callback: function (options, success, response) {
if (success) {
var result = Ext.JSON.decode(response.responseText);
if (!result.Success) {
Ext.Msg.show({
title: '提示',
msg: result.Message,
icon: Ext.MessageBox.ERROR,
buttons: Ext.Msg.OK
});
return;
} else {
dataList = result.Data;
if (dataList == null) {
var sql = this.BillSql;
this.storeBodyAddList.load({ params: { start: 0, limit: _this.PageSize, sort: '', condition: sql} });
_this.storeBodyList.load({ params: { 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: '正在查询主表数据...',
url: '/Account/Chfee_ForeignPay/GetData',
params: {
handle: 'edit',
condition: " cm.BILLNO='" + billno + "'"
},
callback: function (options, success, response) {
if (success) {
var result = Ext.JSON.decode(response.responseText);
if (!result.Success) {
Ext.Msg.show({
title: '提示',
msg: result.Message,
icon: Ext.MessageBox.ERROR,
buttons: Ext.Msg.OK
});
return;
}
var data = result.data;
this.formEdit.getForm().reset();
this.formEdit.getForm().setValues(data);
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('请求出现错误,请重试', response.responseText);
}
},
scope: this
});
} else {
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 {
Ext.MessageBox.alert('请求出现错误,请重试', response.responseText);
}
},
scope: this
});
},
deleteBill: function (type) {
var billno = this.formEdit.getForm().findField('BILLNO').getValue();
var selectedRecords = this.gridList.selModel.getSelection();
if (selectedRecords.length == 0) {
Ext.Msg.show({ title: '提示', msg: '没有要删除的费用明细!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
return;
};
var billstatus = this.formEdit.getForm().findField('BILLSTATUS').getValue();
if ((billstatus != 1) && (billstatus != 6)) {
Ext.Msg.show({ title: '提示', msg: '当前状态无法删除付费申请明细!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
return;
}
var bodyAddDatas = [];
for (var i = 0; i < selectedRecords.length; i++) {
var rec = selectedRecords[i];
bodyAddDatas.push(rec);
}
var jsonbodyAddDatas = ConvertRecordsToJsonAll(bodyAddDatas);
var sql = this.BillSql;
_this = this;
Ext.Ajax.request({
waitMsg: '正在删除数据...',
url: '/Account/Chfee_ForeignPay/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: '提示',
msg: result.Message,
icon: Ext.MessageBox.ERROR,
buttons: Ext.Msg.OK
});
return;
} else {
var sql = this.getCondition();//this.BillSql;
this.storeBodyAddList.load({ params: { start: 0, limit: _this.PageSize, sort: '', condition: sql} });
_this.storeBodyList.load({ params: { 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: '正在查询主表数据...',
url: '/Account/Chfee_ForeignPay/GetData',
params: {
handle: 'edit',
condition: " cm.BILLNO='" + billno + "'"
},
callback: function (options, success, response) {
if (success) {
var result = Ext.JSON.decode(response.responseText);
if (!result.Success) {
Ext.Msg.show({
title: '提示',
msg: result.Message,
icon: Ext.MessageBox.ERROR,
buttons: Ext.Msg.OK
});
return;
}
var data = result.data;
this.formEdit.getForm().reset();
this.formEdit.getForm().setValues(data);
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('请求出现错误,请重试', response.responseText);
}
},
scope: this
});
}
} else {
Ext.MessageBox.alert('请求出现错误,请重试', response.responseText);
}
},
scope: this
});
},
onSubmitAuditClick: function () {
var Duino = this.formEdit.getForm().findField('BILLNO').getValue();
var billstatus = this.formEdit.getForm().findField('BILLSTATUS').getValue();
var APPLICANTNAME = this.formEdit.getForm().findField('APPLICANTNAME').getValue();
if (Duino == '*') {
Ext.Msg.show({ title: '提示', msg: '请先保存付费申请,然后才能提交审核!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
return;
};
if (APPLICANTNAME == "") {
Ext.Msg.show({ title: '提示', msg: '无申请人!请删除此票并退出重新登录重新录入。', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
return;
};
if ((billstatus != 1) && (billstatus != 6)) {
Ext.Msg.show({ title: '提示', msg: '当前状态无法提交审核!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
return;
}
if (this.storeBodyList.getCount() == 0) {
Ext.Msg.show({ title: '提示', msg: '没有付费明细,无法提交审核!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
return;
}
var companyname="";
var cando=true;
var isLC=true;
var companysame=true;
//storeFeeCheck
var _this=this;
this.storeBodyList.each(function(record) {
var FeeNameRecords = DsStoreQueryBy(_this.storeFeeCheck, 'Name', record.get('FEENAME'));
if (FeeNameRecords.getCount() > 0) {
//就是费用名称属于冷藏费类
} else {
isLC=false;
}
if (companyname==""){
companyname=record.get('COMPANYNAME');
//alert(record.get('COMPANYNAME'));
} else
if (companyname!=record.get('COMPANYNAME'))
{
cando=false;
//alert(record.get('COMPANYNAME'));
}
if (_this.formEdit.getForm().findField('COMPANYID').getRawValue() != record.get('COMPANYNAME')){
companysame=false;
}
});
if (isLC==false && cando==false){
Ext.Msg.show({ title: '提示', msg: '除冷藏费外的用证公司不唯一,无法提交! 注意,查询条件中的分公司就是“用证公司”', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
return;
}
_this = this;
if (companysame==false)
{
Ext.MessageBox.confirm('提示', '申请费用的用证公司与申请的付费公司并不完全一致。确定提交吗?',
function(btn) {
if (btn == 'yes') {
Ext.Ajax.request({
waitMsg: '正在添加数据...',
url: '/Account/Chfee_ForeignPay/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: '提示',
msg: result.Message,
icon: Ext.MessageBox.ERROR,
buttons: Ext.Msg.OK
});
return;
} else {
Ext.Ajax.request({
waitMsg: '正在查询主表数据...',
url: '/Account/Chfee_ForeignPay/GetData',
params: {
handle: 'edit',
condition: " cm.BILLNO='" + Duino + "'"
},
callback: function (options, success, response) {
if (success) {
var result = Ext.JSON.decode(response.responseText);
if (!result.Success) {
Ext.Msg.show({
title: '提示',
msg: result.Message,
icon: Ext.MessageBox.ERROR,
buttons: Ext.Msg.OK
});
return;
}
var data = result.data;
_this.formEdit.getForm().findField('BILLSTATUS').setDisabled(false);
_this.formEdit.getForm().reset();
_this.formEdit.getForm().setValues(data);
_this.formEdit.getForm().findField('BILLSTATUS').setDisabled(true);
var editp = Ext.create('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('请求出现错误,请重试', response.responseText);
}
},
scope: this
});
}
} else {
Ext.MessageBox.alert('请求出现错误,请重试', response.responseText);
}
},
scope: this
});
}else{
return;
}
});
}
else
{
Ext.Ajax.request({
waitMsg: '正在添加数据...',
url: '/Account/Chfee_ForeignPay/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: '提示',
msg: result.Message,
icon: Ext.MessageBox.ERROR,
buttons: Ext.Msg.OK
});
return;
} else {
Ext.Ajax.request({
waitMsg: '正在查询主表数据...',
url: '/Account/Chfee_ForeignPay/GetData',
params: {
handle: 'edit',
condition: " cm.BILLNO='" + Duino + "'"
},
callback: function (options, success, response) {
if (success) {
var result = Ext.JSON.decode(response.responseText);
if (!result.Success) {
Ext.Msg.show({
title: '提示',
msg: result.Message,
icon: Ext.MessageBox.ERROR,
buttons: Ext.Msg.OK
});
return;
}
var data = result.data;
_this.formEdit.getForm().findField('BILLSTATUS').setDisabled(false);
_this.formEdit.getForm().reset();
_this.formEdit.getForm().setValues(data);
_this.formEdit.getForm().findField('BILLSTATUS').setDisabled(true);
var editp = Ext.create('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('请求出现错误,请重试', response.responseText);
}
},
scope: this
});
}
} else {
Ext.MessageBox.alert('请求出现错误,请重试', response.responseText);
}
},
scope: this
});
}
},
onSubmitAuditBackClick: function () {
var Duino = this.formEdit.getForm().findField('BILLNO').getValue();
var billstatus = this.formEdit.getForm().findField('BILLSTATUS').getValue();
if (Duino == '*') {
Ext.Msg.show({ title: '提示', msg: '请先保存付费申请,然后才能提交审核!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
return;
};
if (billstatus != 2) {
Ext.Msg.show({ title: '提示', msg: '当前状态无法撤销提交!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
return;
}
_this = this;
Ext.Ajax.request({
waitMsg: '正在添加数据...',
url: '/Account/Chfee_ForeignPay/SubmitResetList',
params: {
bills: Duino
},
callback: function (options, success, response) {
if (success) {
var result = Ext.JSON.decode(response.responseText);
if (!result.Success) {
Ext.Msg.show({
title: '提示',
msg: result.Message,
icon: Ext.MessageBox.ERROR,
buttons: Ext.Msg.OK
});
return;
} else {
Ext.Ajax.request({
waitMsg: '正在查询主表数据...',
url: '/Account/Chfee_ForeignPay/GetData',
params: {
handle: 'edit',
condition: " cm.BILLNO='" + Duino + "'"
},
callback: function (options, success, response) {
if (success) {
var result = Ext.JSON.decode(response.responseText);
if (!result.Success) {
Ext.Msg.show({
title: '提示',
msg: result.Message,
icon: Ext.MessageBox.ERROR,
buttons: Ext.Msg.OK
});
return;
}
var data = result.data;
_this.formEdit.getForm().findField('BILLSTATUS').setDisabled(false);
_this.formEdit.getForm().reset();
_this.formEdit.getForm().setValues(data);
_this.formEdit.getForm().findField('BILLSTATUS').setDisabled(true);
var editp = Ext.create('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('请求出现错误,请重试', response.responseText);
}
},
scope: this
});
}
} else {
Ext.MessageBox.alert('请求出现错误,请重试', response.responseText);
}
},
scope: this
});
},
onAuditClick: function () {
var Duino = this.formEdit.getForm().findField('BILLNO').getValue();
var billstatus = this.formEdit.getForm().findField('BILLSTATUS').getValue();
var APPLICANTNAME = this.formEdit.getForm().findField('APPLICANTNAME').getValue();
if (billstatus != 2) {
Ext.Msg.show({ title: '提示', msg: '当前状态无法审核通过!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
return;
}
_this = this;
Ext.Ajax.request({
waitMsg: '正在添加数据...',
url: '/Account/Chfee_ForeignPay/AuditPass',
params: {
bill: Duino
},
callback: function (options, success, response) {
if (success) {
var result = Ext.JSON.decode(response.responseText);
if (!result.Success) {
Ext.Msg.show({
title: '提示',
msg: result.Message,
icon: Ext.MessageBox.ERROR,
buttons: Ext.Msg.OK
});
return;
} else {
Ext.Ajax.request({
waitMsg: '正在查询主表数据...',
url: '/Account/Chfee_ForeignPay/GetData',
params: {
handle: 'edit',
condition: " cm.BILLNO='" + Duino + "'"
},
callback: function (options, success, response) {
if (success) {
var result = Ext.JSON.decode(response.responseText);
if (!result.Success) {
Ext.Msg.show({
title: '提示',
msg: result.Message,
icon: Ext.MessageBox.ERROR,
buttons: Ext.Msg.OK
});
return;
}
var data = result.data;
_this.formEdit.getForm().findField('BILLSTATUS').setDisabled(false);
_this.formEdit.getForm().reset();
_this.formEdit.getForm().setValues(data);
_this.formEdit.getForm().findField('BILLSTATUS').setDisabled(true);
var editp = Ext.create('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('请求出现错误,请重试', response.responseText);
}
},
scope: this
});
}
} else {
Ext.MessageBox.alert('请求出现错误,请重试', response.responseText);
}
},
scope: this
});
},
onRefreshClick: function (button, event) {
var sql = this.getCondition();
this.storeBodyAddList.load({ params: { start: 0, limit: this.PageSize, sort: '', condition: sql} });
},
onDsQuery: function () {
var sql = this.sqlcontext;
this.storeBodyAddList.load({
params: { start: 0, limit: this.PageSize, sort: '', condition: sql },
waitMsg: "正在查询数据...",
scope: this
});
//this.onRefreshSumClick(sql);
},
onClearSql: function () {
var form = this.formSearch.getForm();
form.reset();
},
LoadCustACCOUNT: function (CUSTOMERNAME) {
var CURR=Ext.getCmp("CURR").getValue();
var condition=" LINKID=(select GID from info_client where shortname='" + CUSTOMERNAME + "') ";
if (CURR!="" && CURR != undefined){
condition=condition+" and CURRENCY='"+CURR+"'";
}
this.storeCustACCOUNT.load({
async: false,
params: { condition:condition }
});
//增加载入往来单位联系人
var s = " LINKID in (select gid from [info_client] where SHORTNAME='" + CUSTOMERNAME + "')";
this.storeInfoClientContact.load({ params: { condition: s }});
},
getCondition: function () {
var form = this.formSearch.getForm();
if (!form.isValid()) {
Ext.Msg.alert('提示', '查询条件赋值错误,请检查。');
return '';
}
var sql = '';
var customNo = form.findField('CustomNo').getValue();
sql = sql + getAndConSql(sql, customNo, " (b.CUSTNO like '%" + customNo + "%' or b.MBLNO like '%" + customNo + "%' or b.HBLNO like '%" + customNo + "%' or b.CUSTOMNO like '%" + customNo + "%' or b.ORDERNO like '%" + customNo + "%')");
var OPLBNAME = form.findField('OPLBNAME').getValue();
sql = sql + getAndConSql(sql, OPLBNAME, "b.OPLBNAME='" + OPLBNAME + "'");
var expDateBgn = form.findField('ExpDateBgn').getRawValue();
sql = sql + getAndConSql(sql, expDateBgn, "b.ETD >='" + expDateBgn + "'");
var expDateEnd = form.findField('ExpDateEnd').getRawValue();
sql = sql + getAndConSql(sql, expDateEnd, "b.ETD <='" + expDateEnd + "'");
/*
var ACCDATE = form.findField('ACCDATEFR').getRawValue();
sql = sql + getAndConSql(sql, ACCDATE, "b.ACCDATE>='" + ACCDATE + "'");
var ACCDATETO = form.findField('ACCDATETO').getRawValue();
sql = sql + getAndConSql(sql, ACCDATETO, "b.ACCDATE<='" + ACCDATETO + "'");
*/
var company = form.findField('company').getValue();
sql = sql + getAndConSql(sql, company, "exists (select 1 from vw_user where userid=f.enteroperator and companyid= '" + company + "')");
var port = form.findField('port').getRawValue();
sql = sql + getAndConSql(sql, port, " b.PortDischarge='" + port + "'" );
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.FEESTATUS IN (0,8,9) and (f.AMOUNT<>(f.SETTLEMENT+f.ORDERAMOUNT-ISNULL(f.ORDERSETTLEMENT,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 + "'");
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: 4,
value: 0,
renderer: function (value, cellmeta, record, rowIndex, columnIndex, store) {
value = usMoney(value, 4, '', false);
if (parseFloat(value) < 0) {
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(4);
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: 4,
value: 0,
renderer: function (value, cellmeta, record, rowIndex, columnIndex, store) {
value = usMoney(value, 4, '', false);
if (parseFloat(value) < 0) {
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(4);
bchange = false;
field.setValue(taxrate);
}
}
bchange = true;
}
}
}, {
xtype: 'label',
width: 120,
text: bfcurr,
name: 'afcurr2'
}
]
}
]//end items(fieldset 1)
}//end fieldset 1
]//end root items
});
me = this;
winExrateShow = Ext.create('Ext.window.Window', {
title: "币别汇率折算",
width: 450,
iconCls: "addicon",
resizable: false,
collapsible: true, // 允许缩放条
closeAction: 'close',
closable: true,
modal: 'true',
buttonAlign: "center",
bodyStyle: "padding:0 0 0 0",
items: [formExrateConversion],
buttons: [{
text: "确定",
minWidth: 70,
handler: function () {
var form = formExrateConversion.getForm();
var UsdExrate = form.findField('bfcurr').getValue();
if (UsdExrate == '' || UsdExrate == null || UsdExrate == undefined) {
Ext.Msg.show({ title: '提示', msg: '必须填折算汇率!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
return;
};
var recs = DsStoreQueryBy(me.storeCurrExrate, 'CURR', bfcurr);
if (recs.getCount() > 0) {
for (var i = 0; i < me.storeCurrExrate.getCount(); i += 1) {
var member = me.storeCurrExrate.getAt(i);
if (member.data.CURR == bfcurr) {
member.set('EXRATE', UsdExrate);
member.commit();
}
}
} else {
me.storeCurrExrate.add({ "CURR": bfcurr, "EXRATE": UsdExrate })
}
winExrateShow.close();
if (fntype == 'detail') {
me.addDetail();
}
if (fntype == 'bill') {
me.addBill();
}
return;
}
}, {
text: "关闭",
minWidth: 70,
handler: function () {
winExrateShow.close();
return;
}
}]
});
if (bfcurr == 'RMB') {
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();
},
// #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(true,false,false);
} else
if ((bsStatus == 2) ) {
_this.setSaveBtnStatus(false,true,false);
}else
if ((bsStatus == 0) ) {
_this.setSaveBtnStatus(false,false,true);
} else {
_this.setSaveBtnStatus(false,false,false);
}
}
}
}
});
},
setSaveBtnStatus: function (YWenable,CWenable,AuditBack) {
var btnESave = Ext.getCmp('btnESave');
var btnESaveAndClose = Ext.getCmp('btnESaveAndClose');
var btnESaveAndNew = Ext.getCmp('btnESaveAndNew');
var btnEAddDetail = Ext.getCmp('btnadddetail');
var btnEDeleteDetail = Ext.getCmp('btndeldetail');
///////////////////增加可操作性限制
//0全部 除了审核通过状态 任何时候都可以保存
//1业务 未提交可以保存 提交之后即不可保存
//2财务 提交审核可以保存 未提交和审核通过都不能保存
if (this.OPERATERANGE=="1")
if (YWenable) {
btnESave.enable();
btnESaveAndClose.enable();
btnESaveAndNew.enable();
btnEAddDetail.enable();
btnEDeleteDetail.enable();
} else {
btnESave.disable();
btnESaveAndClose.disable();
btnESaveAndNew.disable();
btnEAddDetail.disable();
btnEDeleteDetail.disable();
}
if (this.OPERATERANGE=="2")
if (CWenable) {
btnESave.enable();
btnESaveAndClose.enable();
btnESaveAndNew.enable();
btnEAddDetail.enable();
btnEDeleteDetail.enable();
} else {
btnESave.disable();
btnESaveAndClose.disable();
btnESaveAndNew.disable();
btnEAddDetail.disable();
btnEDeleteDetail.disable();
}
if (this.OPERATERANGE=="0")
if (CWenable||YWenable) {
btnESave.enable();
btnESaveAndClose.enable();
btnESaveAndNew.enable();
btnEAddDetail.enable();
btnEDeleteDetail.enable();
} else {
btnESave.disable();
btnESaveAndClose.disable();
btnESaveAndNew.disable();
btnEAddDetail.disable();
btnEDeleteDetail.disable();
}
},
// #endregion
//合计选中的费用数字和
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];
if (rec.get("FeeType_Ref")=="应付"){
sum = sum + rec.get("Amount");
}else{
sum = sum - rec.get("Amount");
}
}
sum = sum.toFixed(2);
Ext.getCmp("zongshu").setText(" 选中金额:" + sum);
},
Print: function () {
var basicForm = this.formEdit.getForm();
var billNo = basicForm.findField('BILLNO').value;
if (billNo == '*' || billNo == '') {
Ext.Msg.show({ title: '错误', msg: '单据还没有保存,请保存后再打印', icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK });
return;
}
var billstatus = this.formEdit.getForm().findField('BILLSTATUS').getValue();
/*
if (billstatus != 2) {
Ext.Msg.show({ title: '提示', msg: '只有在已提交状态才能打印!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
return;
}*/
function GetDateStr(AddDayCount) {
var dd = new Date();
dd.setDate(dd.getDate() + AddDayCount); //获取AddDayCount天后的日期
var y = dd.getFullYear();
var m = dd.getMonth() + 1; //获取当前月份的日期
var d = dd.getDate();
return y + "-" + m + "-" + d;
}
//alert(GetDateStr(+5));
var madedate = GetDateStr(0);
var CUSTOMERNAME=basicForm.findField('CUSTOMERNAME').value;
var printType = 'MSCHFEEPAYAPPLICATION';
var sql1 = "SELECT s.*,(select ShowName from [user] where GID=s.APPLICANT) as APPLICANTNAME ";
sql1 = sql1 + " ,icb.BANKAGENTNAME 收款银行代理行,icb.SWIFT 收款银行代理行SWIFT ";
sql1 = sql1 + " ,icb.BANKACNO 收款银行在代理行账号,icb.BANKNAME 收款银行名称 ";
sql1 = sql1 + " ,icb.BANKADDR 收款银行地址,icb.ACCOUNT 收款人账户 ";
sql1 = sql1+ " ,ic.description 客户全称 ";
sql1 = sql1+ " FROM ch_fee_payapplication s ";
sql1 = sql1+ " left join info_client_bank icb on icb.GID=s.CUSTACCOUNTGID ";
sql1 = sql1+ " left join info_client ic on ic.shortname=s.CUSTOMERNAME ";
sql1 = sql1+ " WHERE s.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,(select amount from ch_fee where gid=c.feeid) oldamount";
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 b.VESSEL,b.VOYNO,b.MBLNO";
// var sql3 = " select * from company where gid=(select top 1 companyid from ch_fee_do where BILLNO='" + billNo + "') ";
var sql3 = " select enname 公司英文名称,ENADDRESS 公司英文地址,ORGANIZATIONCODE 组织机构代码 ";
sql3 = sql3 + " ,* from company where gid=(select CORPID from v_op_bs where bsno= (select top 1 bsno from ch_fee_do where BILLNO='" + billNo + "')) ";
var sql4 = "select '" + madedate + "' as madedate,'" + CUSTOMERNAME + "' as CUSTOMERNAME,'" + SHOWNAME + "' as SHOWNAME,(select deptname from vw_user where showname='" + SHOWNAME + "') 录入人部门";
var sql5 = "select custno+' '+ORDERNO 合同号 , dbo.f_str(bsno) 货物名称,PORTDISCHARGE 目的港,dbo.trimdate(ETD) 到港日,(select dbo.trimdate(ex_Sailingdate) from import_main where contractno=v.bsno) 开船日 ";
sql5 = sql5 + " ,case isnull(m.LOCK_EXCHANGERATE,0) when 0 then '否' else '是' end 是否锁汇,m.EXCHANGERATE 锁汇汇率 ";
sql5 = sql5 + " ,(select sum(amount) from ch_fee_do where Billno='" + billNo + "' and bsno=v.bsno) 付费金额原币 ";
sql5 = sql5 + " ,(select sum(amount*EXCHANGERATE) from ch_fee_do where Billno='" + billNo + "' and bsno=v.bsno) 付费金额rmb ";
sql5 = sql5 + " ,substring(cc.country,0,(charindex('(',cc.country)) ) 国家 ";
sql5 = sql5 + " ,dbo.F_factoryno(m.contractno) 厂号 ";
sql5 = sql5 + " ,dbo.F_ChFeeDo_FeeName(m.contractno,'" + billNo + "') 费用摘要 ";
sql5 = sql5 + " from v_op_bs v left join import_main m on m.contractno=v.bsno ";
sql5 = sql5 + " left join code_country cc on cc.countryid=m.countryid ";
sql5 = sql5 + " where bsno in(select distinct bsno from ch_fee_do where BILLNO='" + billNo + "')";
var sql6 = "";
PrintComm(printType, sql1, sql2, sql3, sql4, sql5, sql6);
}
,
Print2: function () {
var basicForm = this.formEdit.getForm();
var billNo = basicForm.findField('BILLNO').value;
if (billNo == '*' || billNo == '') {
Ext.Msg.show({ title: '错误', msg: '单据还没有保存,请保存后再打印', icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK });
return;
}
function GetDateStr(AddDayCount) {
var dd = new Date();
dd.setDate(dd.getDate() + AddDayCount); //获取AddDayCount天后的日期
var y = dd.getFullYear();
var m = dd.getMonth() + 1; //获取当前月份的日期
var d = dd.getDate();
return y + "-" + m + "-" + d;
}
//alert(GetDateStr(+5));
var madedate = GetDateStr(0);
var CUSTOMERNAME=basicForm.findField('CUSTOMERNAME').value;
var printType = 'ForeignPaySettlement';
var sql1 = " SELECT s.CURR 币别 ";
sql1 = sql1 + " ,(select description from code_currency where codename=s.curr) 币别大写 ";
sql1 = sql1 + " ,(select sum(amount) from ch_fee_do d where d.BILLNO=s.BILLNO) 金额 ";
sql1 = sql1 + " ,(select ShowName from [user] where GID=s.SETTLEUSER) as SETTLEUSERREF ";
//sql1 = sql1 + " ,(select ACCOUNT from sys_bank where gid =s.PAYACCOUNTGID) 付款账号 ";
sql1 = sql1 + " ,c.enname 汇款人名称,c.ENADDRESS 汇款人地址 ";
sql1 = sql1 + " ,substring(replace(c.ORGANIZATIONCODE,' ',''),1,1) z1 ";
sql1 = sql1 + " ,substring(replace(c.ORGANIZATIONCODE,' ',''),2,1) z2 ";
sql1 = sql1 + " ,substring(replace(c.ORGANIZATIONCODE,' ',''),3,1) z3 ";
sql1 = sql1 + " ,substring(replace(c.ORGANIZATIONCODE,' ',''),4,1) z4 ";
sql1 = sql1 + " ,substring(replace(c.ORGANIZATIONCODE,' ',''),5,1) z5 ";
sql1 = sql1 + " ,substring(replace(c.ORGANIZATIONCODE,' ',''),6,1) z6 ";
sql1 = sql1 + " ,substring(replace(c.ORGANIZATIONCODE,' ',''),7,1) z7 ";
sql1 = sql1 + " ,substring(replace(c.ORGANIZATIONCODE,' ',''),8,1) z8 ";
sql1 = sql1 + " ,substring(replace(c.ORGANIZATIONCODE,' ',''),9,1) z9 ";
sql1 = sql1 + " ,icb.BANKAGENTNAME 收款银行代理行,icb.SWIFT 收款银行代理行SWIFT ";
sql1 = sql1 + " ,icb.BANKACNO 收款银行在代理行账号,icb.BANKNAME 收款银行名称 ";
sql1 = sql1 + " ,icb.BANKADDR 收款银行地址,icb.ACCOUNT 收款人账户 ";
sql1 = sql1 + " ,ic.EnFullName 收款人名称,ic.addr 收款人地址 ";
sql1 = sql1 + " ,dbo.F_PayAppCUSTNO(s.BILLNO) 合同号,ic.ORGANIZATIONCODE 结算对象组织机构代码 ";
sql1 = sql1 + " ,substring(cc.country,0,(charindex('(',cc.country)) ) 账户所在国 ";
sql1 = sql1 + " FROM ch_fee_payapplication s ";
//sql1 = sql1 + " left join sys_bank sb on sb.gid=s.PAYACCOUNTGID ";
sql1 = sql1 + " left join company c on c.gid=s.companyid ";
sql1 = sql1 + " left join info_client ic on ic.SHORTNAME=s.CUSTOMERNAME ";
sql1 = sql1 + " left join info_client_bank icb on icb.GID=s.CUSTACCOUNTGID ";
sql1 = sql1 + " left join code_country cc on cc.COUNTRYID=icb.COUNTRYID ";
sql1 = sql1 + " WHERE BILLNO='" + billNo + "' ";
var sql2 = "select c.ContractNo ch_fee_do_bsno,c.gid import_cargo_gid,case c.CargoType when '猪' then 'PORK PRODUCTS' ";
sql2 = sql2 + " when '牛' then 'BEEF PRODUCTS' ";
sql2 = sql2 + " when '鸡' then 'CHICKEN PRODUCTS' ";
sql2 = sql2 + " when '火鸡' then 'TURKEY PRODUCTS' ";
sql2 = sql2 + " when '羊' then 'MUTTON PRODUCTS' else '' end 货物类型 ";
sql2 = sql2 + " ,sum(c.weight) weight,price,sum(c.pay_Amount) Amount,sum(c.pay_prepayments) pay_prepayments,sum(c.pay_balance) pay_balance";
sql2 = sql2 + " ,m.hth 合同号,m.creattime 接单日期,c.PreProportion 预付比例 ";
sql2 = sql2 + " ,substring(cc.country,charindex('(',cc.country)+1,charindex(')',cc.country)-charindex('(',cc.country)-1 ) 进口国 ";
sql2 = sql2 + " from import_cargo c ";
sql2 = sql2 + " left join import_main m on m.contractno=c.contractno ";
sql2 = sql2 + " left join code_country cc on cc.COUNTRYID=m.countryid ";
sql2 = sql2 + " where c.ContractNo in( ";
sql2 = sql2 + " select bsno from ch_fee_do where billno='" + billNo + "' ";
sql2 = sql2 + " )group by CargoType,price,hth,creattime,PreProportion,cc.country,c.ContractNo,c.gid";
var sql3 = " select fd.*,(select IMGFILE from info_files where PID=fd.ContactGID) ";
sql3 = sql3 + " ,s1.ACCOUNT 账户1,s2.ACCOUNT 账户2,s3.ACCOUNT 账户3 from ch_fee_ForeignpayDetail fd ";
sql3 = sql3 + " left join sys_bank s1 on s1.gid= fd.ACCOUNT1 ";
sql3 = sql3 + " left join sys_bank s2 on s2.gid= fd.ACCOUNT2 ";
sql3 = sql3 + " left join sys_bank s3 on s3.gid= fd.ACCOUNT3 ";
sql3 = sql3 + " where billno='" + billNo + "' ";
var sql4 = "SELECT c.GID,c.BSNO,c.FEEID,c.FEENAME,c.CURRENCY,c.AMOUNT,c.DOAMOUNT,c.ORIGCURRENCY,c.ORIGAMOUNT,c.EXCHANGERATE,FEETYPE ";
sql4 = sql4+ ",b.CUSTOMERNAME,b.VESSEL,b.VOYNO,b.ETD,b.PORTLOAD";
sql4 = sql4 + " ,b.PORTDISCHARGE,b.INPUTBY,b.OP,b.CUSTSERVICE,b.DOC,b.SALE,b.MBLNO,b.CUSTNO"
sql4= sql4 + " FROM ch_fee_do c left join v_op_bill b on (b.bsno=c.bsno)";
sql4 = sql4 + " WHERE C.BILLNO='" + billNo + "' ";
var sql5 = "";
var sql6 = "";
PrintComm(printType, sql1, sql2, sql3, sql4, sql5, sql6);
}
,
SetCompany: function (_COMPANYID){
//var _COMPANYID = rec.data.COMPANYID;
var company = DsStoreQueryBy(this.storeCompany, 'gid', _COMPANYID);
if (company.getCount() > 0) {
this.formEdit.getForm().findField('COMPANYID').setValue(_COMPANYID);
}
}
});