You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

2086 lines
69 KiB
JavaScript

12 months ago
Ext.namespace('DsTruck');
var C_feeid = "";
var C_contractno = ""; //用于存储当前选定的合同号/ch_fee.id
var C_Customer = ""; //结算对象
var C_CustomerRef = "";
var M_contractno = ""; //用于存储当前选定的合同号/ch_fee.id
var M_Customer = ""; //结算对象
//var array = [0];
DsTruck.FinanceOut = function (config) {
Ext.applyIf(this, config);
this.initUIComponents();
window.DsTruck.FinanceOut.superclass.constructor.call(this);
};
Ext.extend(DsTruck.FinanceOut, Ext.Panel, {
PageSize: 6,
OprationStatus: null,
//仅当弹出界面时使用
SelectedRecord: null,
OpStatus: null,
ChangePage: false,
//array: new Array(),
initUIComponents: function () {
this.FOBodyDel = [];
this.array = [];
//#region formSearch
//#region formSearch枚举参照相关
//#endregion
//枚举参照
this.storeport = Ext.create('DsExt.ux.RefEnumStore', {});
this.storeport.load({ params: { enumTypeId: 10} });
this.comboxport = Ext.create('DsExt.ux.RefEnumCombox', {
fieldLabel: '目的港',
store: this.storeport,
name: 'port'
});
this.storeMainstate = Ext.create('DsExt.ux.RefEnumStore', {});
this.storeMainstate.load({ params: { enumTypeId: 3} });
this.comboxMainstate = Ext.create('DsExt.ux.RefEnumCombox', {
fieldLabel: '合同状态',
store: this.storeMainstate,
name: 'Mainstate'
});
//表参照
this.storeCountry = Ext.create('DsExt.ux.RefTableStore', {
model: 'ConutryRef',
proxy: {
url: '/CommMng/BasicDataRef/GetCountryRefList'
}
});
this.storeCountry.load({ params: { condition: ""} });
this.comboxCountry = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: '进口国',
store: this.storeCountry,
name: 'countryid',
valueField: 'countryid',
displayField: 'country_idandname'
});
this.storeCompany = Ext.create('DsExt.ux.RefTableStore', {
model: 'companymb',
proxy: {
url: '/CommMng/BasicDataRef/GetcompanyList'
}
});
this.storeCompany.load({ params: { condition: ""} });
this.comboxCompany = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: '用证公司',
store: this.storeCompany,
name: 'company',
valueField: 'gid',
displayField: 'name'
});
this.storeRemind = Ext.create('DsExt.ux.RefTableStore', {
model: 'remind',
proxy: {
url: '/CommMng/BasicDataRef/Getimportremind'
}
});
this.storeRemind.load({ params: { condition: ""} });
this.comboxRemind = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: '业务提醒',
store: this.storeRemind,
name: 'Remind',
valueField: 'RemindSql',
displayField: 'RemindName',
triggerAction: 'all',
selectOnFocus: true,
listeners: {
change: function (field, newValue, oldValue) {
this.onGetremind(field, newValue, oldValue);
},
scope: this
}
});
this.formSearch = 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: '合同序列号',
name: 'ContractNo'
},*/
{
fieldLabel: '合同号',
name: 'HTH'
},
{
fieldLabel: '客户',
name: 'buyer'
}//, this.comboxRemind
//this.comboxCompany
]
}]
},
//end items(fieldset 1)
{ //fieldset 2
xtype: 'container',
defaultType: 'textfield',
layout: 'anchor',
defaults: {
anchor: '100%'
},
items: [{
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [ //this.comboxCountry,
/*{
fieldLabel: '贸易商',
name: 'seller'
},
{
fieldLabel: '客户',
name: 'buyer'
}*/
]
}]
},
//end fieldset 2
{ //fieldset 5
xtype: 'container',
defaultType: 'textfield',
layout: 'anchor',
defaults: {
anchor: '100%'
},
items: [{
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [ //this.comboxport,
{
fieldLabel: '到港日起日期',
format: 'Y-m-d',
xtype: 'datefield',
name: 'ExpDateBgn'
}, {
fieldLabel: '到港日至日期',
format: 'Y-m-d',
xtype: 'datefield',
name: 'ExpDateEnd'
}, {
fieldLabel: '备注中包含',
name: 'remark'
}]
}]
} //end items(fieldset 5)
] //end root items
});
///////////查询条件
//单票融资使用的合同列表
//定义数据集
this.storeList = Ext.create('Ext.data.Store', {
model: 'Mainmb',
remoteSort: false,
pageSize: this.PageSize,
proxy: {
type: 'ajax',
url: '/Import/FinanceOut/GetMainList',
reader: {
idProperty: 'ContractNo' + 'HTH',
root: 'data',
totalProperty: 'totalCount'
}
}
});
this.MainGridCheckBoxModel = new Ext.selection.CheckboxModel({
id: 'MainGridCheckBoxModel',
checkOnly: true
});
//定义Grid
this.gridList = new Ext.grid.GridPanel({
id: 'gridList',
store: this.storeList,
enableHdMenu: false,
region: 'center',
loadMask: {
msg: "数据加载中,请稍等..."
},
trackMouseOver: true,
disableSelection: false,
//selModel: this.MainGridCheckBoxModel,
stripeRows: true,
//height: 150,
viewConfig: {
autoFill: true,
enableTextSelection: true,
getRowClass: function (record, rowIndex, rowParams, store) {
var FinanceStatus = record.get('FinanceStatus');
return DsTruck.FinanceGetRowClass(FinanceStatus);
}
},
columns: [
{ sortable: true, dataIndex: 'ContractNo', header: '合同序列号',
hidden: true, width: 80
},
{ sortable: true, dataIndex: 'Seller', header: '贸易商', width: 80 },
{
sortable: true,
dataIndex: 'Buyer',
header: '客户(购货方)',
width: 80
},{
sortable: true,
dataIndex: 'HTH',
header: '合同号',
width: 80
}, {
sortable: true,
dataIndex: 'FinanceStatusRef',
header: '融资状态',
width: 80
}, {
sortable: true,
dataIndex: 'FinanceStatus',
header: 'FinanceStatus',
hidden: true,
width: 80
}, {
sortable: true,
dataIndex: 'Country',
header: '进口国',
width: 80
},{
sortable: true,
dataIndex: 'portRef',
header: '目的港',
width: 80
},{
sortable: true,
dataIndex: 'boxcount',
header: '箱/件数',
width: 80
},{
sortable: true,
dataIndex: 'price',
header: '单价',
width: 80
},{
sortable: true,
dataIndex: 'weight',
header: '净重',
width: 80
},{
sortable: true,
dataIndex: 'amount',
header: '金额',
width: 80
},{
sortable: true,
dataIndex: 'codename',
header: '币别',
width: 80
},{
sortable: true,
dataIndex: 'MainStateRef',
header: '合同状态',
width: 80
},{
sortable: true,
dataIndex: 'arrivalDate',
header: '到港日',
width: 80
}],
bbar: Ext.create('Ext.PagingToolbar', {
store: this.storeList,
pageSize: this.PageSize,
displayInfo: true,
displayMsg: '当前显示 {0} - {1}条记录 /共 {2}条记录',
emptyMsg: "没有数据"
})
});
/////////////////////////////////////////////////////////
//用于多票融资的合同列表
//定义数据集
this.store_M = Ext.create('Ext.data.Store', {
model: 'Mainmb',
remoteSort: false,
pageSize: this.PageSize,
proxy: {
type: 'ajax',
url: '/Import/FinanceOut/GetMainList',
reader: {
idProperty: 'ContractNo' + 'HTH',
root: 'data',
totalProperty: 'totalCount'
}
}
});
this.CB_M = new Ext.selection.CheckboxModel({
id: 'CB_M',
checkOnly: true
});
//定义Grid
this.grid_M = new Ext.grid.GridPanel({
id: 'grid_M',
store: this.store_M,
enableHdMenu: false,
region: 'center',
loadMask: {
msg: "数据加载中,请稍等..."
},
trackMouseOver: true,
disableSelection: false,
selModel: this.CB_M,
stripeRows: true,
//height: 150,
viewConfig: {
autoFill: true,
enableTextSelection: true,
getRowClass: function (record, rowIndex, rowParams, store) {
var FinanceStatus = record.get('FinanceStatus');
return DsTruck.FinanceGetRowClass(FinanceStatus);
}
},
columns: [
{
sortable: true,
dataIndex: 'ContractNo',
header: '合同序列号',
hidden: true,
width: 80
},
{
sortable: true,
dataIndex: 'Seller',
header: '贸易商',
width: 80
},
{
sortable: true,
dataIndex: 'Buyer',
header: '客户(购货方)',
width: 80
},
{
sortable: true,
dataIndex: 'HTH',
header: '合同号',
width: 80
}, {
sortable: true,
dataIndex: 'FinanceStatusRef',
header: '融资状态',
width: 80
}, {
sortable: true,
dataIndex: 'FinanceStatus',
header: 'FinanceStatus',
hidden: true,
width: 80
}, {
sortable: true,
dataIndex: 'Country',
header: '进口国',
width: 80
},
{
sortable: true,
dataIndex: 'portRef',
header: '目的港',
width: 80
},
{
sortable: true,
dataIndex: 'boxcount',
header: '箱/件数',
width: 80
},
{
sortable: true,
dataIndex: 'price',
header: '单价',
width: 80
},
{
sortable: true,
dataIndex: 'weight',
header: '净重',
width: 80
},
{
sortable: true,
dataIndex: 'amount',
header: '金额',
width: 80
},
{
sortable: true,
dataIndex: 'codename',
header: '币别',
width: 80
},
{
sortable: true,
dataIndex: 'MainStateRef',
header: '合同状态',
width: 80
},
{
sortable: true,
dataIndex: 'arrivalDate',
header: '到港日',
width: 80
}],
bbar: Ext.create('Ext.PagingToolbar', {
store: this.store_M,
pageSize: this.PageSize,
displayInfo: true,
displayMsg: '当前显示 {0} - {1}条记录 /共 {2}条记录',
emptyMsg: "没有数据"
})
});
/////////////////////////////////////////////
//#endregion formSearch
//货物列表----------------------------------------
//#region 货物列表
//明细表表格相关
//枚举参照
//Financestatus
//明细表 Cargo 数据集
this.storeCargo = Ext.create('Ext.data.Store', {
model: 'Cargomb',
remoteSort: true,
proxy: {
type: 'ajax',
url: '/Import/XXH/GetCargoList',
reader: {
id: 'id',
root: 'data',
totalProperty: 'totalCount'
}
}
});
//明细表 cargo 用于选择进行融资的货物
//表格
this.cellEditingCargo = Ext.create('Ext.grid.plugin.CellEditing', {
clicksToEdit: 1
});
this.cargoCheckBoxModel = Ext.create('Ext.selection.CheckboxModel');
this.formCargo = new Ext.grid.GridPanel({
store: this.storeCargo,
enableHdMenu: false,
region: 'north',
//height: 160,
//title: '商品信息',
loadMask: { msg: "数据加载中,请稍等..." },
trackMouseOver: true,
disableSelection: false,
plugins: [this.cellEditingCargo],
tbar: [{
text: '生成新融资记录',
tooltip: '新建',
id: 'btnAdd',
iconCls: "btnadd",
disabled: true,
handler: function (button, event) {
this.onNewClick(button, event);
},
scope: this
},
{
text: '保存',
tooltip: '保存',
id: 'btnSave',
iconCls: "btnsave",
disabled: true,
handler: function (button, event) {
this.onSaveClick(button, event);
},
scope: this
}],
columns: [{
dataIndex: 'id',
header: '自增序列号',
width: 80,
hidden: true,
editor: {
xtype: 'textfield'
}
},
{
dataIndex: 'ContractNo',
header: '合同号',
width: 80,
hidden: true,
editor: {
xtype: 'textfield'
}
},
{
dataIndex: 'name',
header: '货名',
width: 80
},
{
dataIndex: 'cicodeandname',
header: 'HS代码',
hidden: true,
width: 140
},
{
dataIndex: 'price',
header: '单价(kg/$)',
width: 50
},
{
dataIndex: 'weight',
header: '净重(kg)',
width: 50
},
{
dataIndex: 'Amount',
header: '合同金额',
width: 80
},
{
dataIndex: 'Exchangerate',
header: '汇率',
width: 80
},
{
dataIndex: 'codename',
header: '币别',
width: 60
}]
});
//明细表 cargo over----------------------------------------------
//--------------------------------------over
//查询工具条
this.panelBtn = new Ext.Panel({
region: "north",
tbar: [{
text: "执行查询",
iconCls: "btnrefresh",
handler: function (button, event) {
this.onRefreshClick(button, event);
},
scope: this
},
{
text: "重置条件",
iconCls: "btnreset",
handler: function (button, event) { },
scope: this
}]
});
//单纯融入资金列表
this.panelBtn_I = new Ext.Panel({
region: "north",
tbar: [
{
text: "新建",
iconCls: "btnadd",
handler: function (button, event) {
this.OprationStatus = 'add';
DsOpenEditWin("/Import/XXH/Edit", "新建合同", "700", "900");
},
scope: this
},
{
text: "删除",
iconCls: "btndelete",
handler: function (button, event) {
this.onDeleteClick(button, event);
},
scope: this
},
'-',
{
text: "执行查询",
iconCls: "btnrefresh_I",
handler: function (button, event) {
this.onRefreshClick_FI(button, event);
},
scope: this
},
{
text: "重置条件",
iconCls: "btnreset_I",
handler: function (button, event) {
this.onResetClick_FI(button, event);
},
scope: this
}
]
});
//以下是单纯融入资金的数据集和列表
this.storeFI = Ext.create('Ext.data.Store', {
model: 'FinanceInmb',
remoteSort: false,
pageSize: 100,
proxy: {
type: 'ajax',
url: '/Import/FinanceOut/GetFInList',
reader: {
idProperty: 'gid',
root: 'data',
totalProperty: 'totalCount'
}
}
});
//定义Grid
this.gridFI = new Ext.grid.GridPanel({
store: this.storeFI,
enableHdMenu: false,
region: 'center',
loadMask: { msg: "数据加载中,请稍等..." },
trackMouseOver: true,
disableSelection: false,
stripeRows: true,
columns: [
{
sortable: true,
dataIndex: 'Bank',
header: '银行',
width: 80
}, {
sortable: true,
dataIndex: 'RMBAmount',
header: '人民币金额',
width: 80
}, {
sortable: true,
dataIndex: 'Starttime',
header: '开始时间',
width: 80
}, {
sortable: true,
dataIndex: 'Endtime',
header: '结束时间',
width: 80
}, {
sortable: true,
dataIndex: 'Days',
header: '天数',
width: 80
}, {
sortable: true,
dataIndex: 'InterestRate',
header: '月利率 (%)',
width: 80
}, {
sortable: true,
dataIndex: 'Interest',
header: '利息',
width: 80
}, {
sortable: true,
dataIndex: 'PI',
header: '本息合计',
width: 80
}],
bbar: Ext.create('Ext.PagingToolbar', {
store: this.storeFI,
displayInfo: true,
displayMsg: '当前显示 {0} - {1}条记录 /共 {2}条记录',
emptyMsg: "没有数据"
})
});
//融资 融出----------------------------------------
//明细表表格相关
//枚举参照
this.storeFStatus = Ext.create('DsExt.ux.RefEnumStore', {});
this.storeFStatus.load({ params: { enumTypeId: 16} });
this.comboxFStatus = Ext.create('DsExt.ux.RefEnumCombox', {
fieldLabel: '融资状态',
store: this.storeFStatus,
name: 'FinanceStatus'
});
this.storeCurrency = Ext.create('DsExt.ux.RefTableStore', {
model: 'currRef',
proxy: { url: '/CommMng/BasicDataRef/GetcurrRefList' }
});
this.storeCurrency.load({ params: { condition: ""} });
this.comboxCurrency = Ext.create('DsExt.ux.RefTableCombox', {
store: this.storeCurrency,
name: 'Currency',
fieldLabel: '币别',
valueField: 'codename',
displayField: 'codename'
//币别
});
//定义数据集
this.storeFinanceOut = Ext.create('Ext.data.Store', {
model: '',
remoteSort: true,
proxy: {
type: 'ajax',
url: 'Import/Finance/GetFOut',
reader: {
id: 'id',
root: 'data',
totalProperty: 'totalCount'
}
}
});
//编辑form:formFinanceOut
this.formFinanceOut = Ext.widget('form', {
frame: true,
hidden: true,
region: 'north',
bodyPadding: 5,
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: [{ //container_1
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [{
fieldLabel: '融资序列号',
name: 'gid',
//flex: 0,
hidden: true,
disabled: true
//,margins: '5'
},
{
fieldLabel: 'ContractNo',
name: 'ContractNo',
flex: 0,
hidden: true,
margins: '0'
},
{
fieldLabel: '融出资金 客户',
name: 'Customer',
//flex: 0,
disabled: true
//,margins: '5'
}, this.comboxFStatus,
this.comboxCurrency
]
}, {
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [{
fieldLabel: '融出汇率',
name: 'ExchangeRate',
//flex: 0,
//margins: '0',
enableKeyEvents: true, // 要有
listeners: {
keyup: function () {
panelIndex.SetAmount();
}
}
}, {
fieldLabel: '金额',
name: 'Amount',
enableKeyEvents: true, // 要有
listeners: {
keyup: function () {
panelIndex.SetAmount();
}
}
}, {
fieldLabel: '本币金额',
name: 'RMBAmount',
//enableKeyEvents: true, // 要有
listeners: {
change: function () {
//panelIndex.SetAmount();
panelIndex.SetInterest();
}
}
}]
},
{
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [{
fieldLabel: '融资开始时间',
id: 'Starttime1',
format: 'Y-m-d',
xtype: 'datefield',
renderer: Ext.util.Format.dateRenderer('Y-m-d'),
name: 'Starttime',
allowBlank: false,
blankText: "不能为空"
},
{
fieldLabel: '预计还款日期',
id: 'Endtime1',
format: 'Y-m-d',
xtype: 'datefield',
renderer: Ext.util.Format.dateRenderer('Y-m-d'),
name: 'Endtime',
listeners: {
change: function () {
var e = Ext.util.Format.date(Ext.getCmp('Endtime1').getValue(), 'Y-m-d'); //格式化日期控件值
var s = Ext.util.Format.date(Ext.getCmp('Starttime1').getValue(), 'Y-m-d'); //格式化日期控件值
var end = new Date(e);
var start = new Date(s);
var elapsed = Math.round((end.getTime() - start.getTime()) / (86400000)) + 1; // 计算间隔日数
//alert(elapsed);
panelIndex.formFinanceOut.getForm().findField('Days').setValue(elapsed);
panelIndex.SetInterest();
}
}
}, {
fieldLabel: '天数',
name: 'Days',
enableKeyEvents: true, // 要有
listeners: {
keyup: function () {
//alert('days');
panelIndex.SetInterest();
}
}
}]
},
{
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [
{
fieldLabel: '月利率(%)',
name: 'InterestRate',
enableKeyEvents: true, // 要有
listeners: {
keyup: function () {
panelIndex.SetInterest();
}
}
}, {
fieldLabel: '利息',
name: 'Interest'
}, {
fieldLabel: '手续费',
name: 'Shouxu'
}]
},
{
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [{
fieldLabel: '本息合计',
name: 'PI'
}, {
fieldLabel: '备注',
name: 'Remark'
},
{
fieldLabel: '时间戳',
name: 'TimeMark',
flex: 0,
hidden: true,
margins: '0'
}]
}]
}]
}); //end this.formFinanceOut
//融资信息 over----------------------------------------
//融资 融出----------------------------------------
//明细表表格相关
//枚举参照
this.comboxFStatus_2 = Ext.create('DsExt.ux.RefEnumCombox', {
fieldLabel: '融资状态',
store: this.storeFStatus,
name: 'FinanceStatus'
});
this.comboxCurrency_2 = Ext.create('DsExt.ux.RefTableCombox', {
store: this.storeCurrency,
name: 'Currency',
fieldLabel: '币别',
valueField: 'codename',
displayField: 'codename'
//币别
});
this.storeBank = Ext.create('DsExt.ux.RefTableStore', {
model: 'Bankmb',
proxy: { url: '/CommMng/BasicDataRef/GetBank' }
});
this.storeBank.load({ params: { condition: ""} });
this.comboxBank = Ext.create('DsExt.ux.RefTableCombox', {
store: this.storeBank,
name: 'Bank',
fieldLabel: '融入资金 银行',
valueField: 'bankname',
displayField: 'bankname'
//币别
});
//定义数据集
this.storeFinanceIn = Ext.create('Ext.data.Store', {
model: '',
remoteSort: true,
proxy: {
type: 'ajax',
url: 'Import/Finance/GetFIn',
reader: {
id: 'id',
root: 'data',
totalProperty: 'totalCount'
}
}
});
//编辑form:formFinanceOut
this.formFinanceIn = Ext.widget('form', {
frame: true,
hidden: true,
region: 'center',
bodyPadding: 5,
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: [{ //container_1
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [{
fieldLabel: '融资序列号',
name: 'gid',
//flex: 0,
hidden: true
//disabled: true
//,margins: '5'
},
{
fieldLabel: 'ContractNo',
name: 'ContractNo',
flex: 0,
hidden: true,
margins: '0'
},
this.comboxBank
, this.comboxFStatus_2,
this.comboxCurrency_2
]
}, {
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [{
fieldLabel: '融入汇率',
name: 'ExchangeRate',
//flex: 0,
//margins: '0',
enableKeyEvents: true, // 要有
listeners: {
keyup: function () {
panelIndex.SetAmountIn();
}
}
}, {
fieldLabel: '金额',
name: 'Amount',
enableKeyEvents: true, // 要有
listeners: {
keyup: function () {
panelIndex.SetAmountIn();
}
}
}, {
fieldLabel: '本币金额',
name: 'RMBAmount',
//enableKeyEvents: true, // 要有
listeners: {
change: function () {
//panelIndex.SetAmount();
panelIndex.SetInterestIn();
}
}
}]
},
{
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [{
fieldLabel: '融资开始时间',
id: 'Starttime2',
format: 'Y-m-d',
xtype: 'datefield',
renderer: Ext.util.Format.dateRenderer('Y-m-d'),
name: 'Starttime',
allowBlank: false,
blankText: "不能为空"
},
{
fieldLabel: '预计还款日期',
id: 'Endtime2',
format: 'Y-m-d',
xtype: 'datefield',
renderer: Ext.util.Format.dateRenderer('Y-m-d'),
name: 'Endtime',
listeners: {
change: function () {
var e = Ext.util.Format.date(Ext.getCmp('Endtime2').getValue(), 'Y-m-d'); //格式化日期控件值
var s = Ext.util.Format.date(Ext.getCmp('Starttime2').getValue(), 'Y-m-d'); //格式化日期控件值
var end = new Date(e);
var start = new Date(s);
var elapsed = Math.round((end.getTime() - start.getTime()) / (86400000)) + 1; // 计算间隔日数
//alert(elapsed);
panelIndex.formFinanceIn.getForm().findField('Days').setValue(elapsed);
panelIndex.SetInterestIn();
}
}
}, {
fieldLabel: '天数',
name: 'Days',
enableKeyEvents: true, // 要有
listeners: {
keyup: function () {
//alert('days');
panelIndex.SetInterestIn();
}
}
}]
},
{
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [
{
fieldLabel: '月利率(%)',
name: 'InterestRate',
enableKeyEvents: true, // 要有
listeners: {
keyup: function () {
panelIndex.SetInterestIn();
}
}
}, {
fieldLabel: '利息',
name: 'Interest'
}, {
fieldLabel: '本息合计息',
name: 'PI'
}]
},
{
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [{
fieldLabel: '备注',
name: 'Remark'
},
{
fieldLabel: '时间戳',
name: 'TimeMark',
flex: 0,
hidden: true,
margins: '0'
}]
}]
}]
}); //end this.formFinanceOut
//融资信息 融入 over----------------------------------------
////////////////////////////////////////////////
//明细<<<< 融资还款明细 >>>>
//枚举参照
//还款明细 数据集
this.storeFOBody = Ext.create('Ext.data.Store', {
model: 'FOBodymb',
remoteSort: true,
proxy: {
type: 'ajax',
url: '/Import/FinanceOut/GetFOBodyList',
reader: {
id: 'id',
root: 'data',
totalProperty: 'totalCount'
}
}
});
//明细表 cargo 用于选择进行融资的货物
//表格
this.cellEditingFOBody = Ext.create('Ext.grid.plugin.CellEditing', {
clicksToEdit: 1
});
// this.cargoCheckBoxModel = Ext.create('Ext.selection.CheckboxModel');
this.formFOBody = new Ext.grid.GridPanel({
store: this.storeFOBody,
enableHdMenu: false,
region: 'north',
//height: 160,
//title: '商品信息',
loadMask: {
msg: "数据加载中,请稍等..."
},
trackMouseOver: true,
disableSelection: false,
plugins: [this.cellEditingFOBody],
// selModel: this.cargoCheckBoxModel,
// selType: 'cellmodel',
tbar: [{
id: 'addFOBody',
text: '增加明细',
tooltip: '增加明细',
iconCls: "btnadddetail",
disabled: true,
handler: function (button, event) {
this.onaddFOBody();
},
scope: this
}, '-',
{
id: 'delFOBody',
text: '删除明细',
tooltip: '删除明细',
iconCls: "btndeletedetail",
disabled: true,
handler: function (button, event) {
this.onDelFOBody();
},
scope: this
}],
columns: [{
dataIndex: 'id',
header: '自增序列号',
width: 80,
hidden: true
}, {
dataIndex: 'ContractNo',
header: 'ContractNo',
width: 80,
hidden: true
}, {
dataIndex: 'Repaymentdate',
header: '还款时间',
width: 110,
renderer: Ext.util.Format.dateRenderer('Y-m-d'),
editor: {
xtype: 'datefield',
selectOnFocus: true
}
},
{
dataIndex: 'Amount',
header: '金额',
width: 80,
editor: {
xtype: 'textfield',
selectOnFocus: true
}
},
{
dataIndex: 'Remark',
header: '备注',
width: 140,
editor: {
xtype: 'textfield',
selectOnFocus: true
}
}]
});
//#endregion
///////---------------------------------/明细 <<<< 还款明细表 >>>> over
//绑定事件
this.formCargo.on('edit',
function (editor, e, eOpts) {
this.CargoAfterEdit(editor, e, eOpts);
},
this);
//选择load
this.gridList.getSelectionModel().on('select',
function (model, record, index) {
this.C_contractno = record.data.ContractNo;
this.C_Customer = record.data.Buyer;
this.storeCargo.load({ //载入货物列表
params: { condition: this.C_contractno }
});
/*
if (Ext.Array.indexOf(this.array, this.C_contractno, 0) == -1) {
//grid.selModel.select(i, true, false);
this.array.push(this.C_contractno);
}*/
Ext.Ajax.request({
waitMsg: '正载入融资数据...',
url: '/Import/FinanceOut/GetFOut',
params: {
condition: this.C_contractno
},
callback: function (options, success, response) {
if (success) {
var result = Ext.JSON.decode(response.responseText);
if (!result.Success) {
Ext.Msg.show({
title: '提示',
msg: result.Message,
icon: Ext.MessageBox.ERROR,
buttons: Ext.Msg.OK
});
return;
}
this.formFinanceOut.getForm().reset();
var data = result.data;
this.storeFOBody.removeAll();
/* var data = result.data;
this.formEdit.getForm().reset();
if (data.OilLrDate == "") { data.OilLrDate = currdate.format('yyyy-MM-dd') };
if (data.OilUser == "") { data.OilUser = str };*/
//
this.formFinanceOut.getForm().setValues(data);
//alert(data.Financestatus);
if (data.FinanceStatus == "" || data.FinanceStatus == undefined) {
this.formFinanceOut.hide();
this.formFinanceIn.hide();
Ext.getCmp('btnAdd').enable();
Ext.getCmp('btnSave').disable();
Ext.getCmp('addFOBody').disable();
Ext.getCmp('delFOBody').disable();
this.formFinanceOut.getForm().findField('Customer').setValue(this.C_Customer);
this.formFinanceOut.getForm().findField('ContractNo').setValue(this.C_contractno);
//this.formFinanceIn.getForm().findField('Customer').setValue(this.C_Customer);
//this.formFinanceIn.getForm().findField('ContractNo').setValue(this.C_contractno);
this.OpStatus = 'add';
}
else {
this.formFinanceOut.show();
this.formFinanceIn.show();
Ext.getCmp('btnAdd').disable();
Ext.getCmp('btnSave').enable();
Ext.getCmp('addFOBody').enable();
Ext.getCmp('delFOBody').enable();
this.OpStatus = 'edit';
this.storeFOBody.load({
params: {
condition: this.C_contractno
}
});
}
//this.formFinanceOut.getForm().setValue("Customer", this.C_Customer);
//if (data.creator == "") { data.creator = usercode };
} else {
Ext.MessageBox.alert('请求出现错误,请重试', response.responseText);
}
},
scope: this
}); //request over
Ext.Ajax.request({
waitMsg: '正载入融资数据...',
url: '/Import/FinanceOut/GetFIn',
params: {
condition: this.C_contractno
},
callback: function (options, success, response) {
if (success) {
var result = Ext.JSON.decode(response.responseText);
if (!result.Success) {
Ext.Msg.show({
title: '提示',
msg: result.Message,
icon: Ext.MessageBox.ERROR,
buttons: Ext.Msg.OK
});
return;
}
this.formFinanceIn.getForm().reset();
var data = result.data;
this.formFinanceIn.getForm().setValues(data);
//this.formFinanceOut.getForm().setValue("Customer", this.C_Customer);
//if (data.creator == "") { data.creator = usercode };
} else {
Ext.MessageBox.alert('请求出现错误,请重试', response.responseText);
}
},
scope: this
}); //request over
},
this);
var _this = this;
/*
this.grid_M.on('cellclick', function (button, event) {
this.onSelectContractNo(button, event);
}, this);*/
this.grid_M.getSelectionModel().on('deselect', function (sm, rec) {
//alert('取消勾选的name:'+record.data.ContractNo);
//alert(Ext.Array.include(this.array, '100')); undifine
if (!_this.ChangePage) {
Ext.Array.remove(this.array, rec.data.ContractNo);
}
}, this);
this.grid_M.getSelectionModel().on('select',
function (model, record, index) {
this.C_contractno = record.data.ContractNo;
this.C_Customer = record.data.Buyer;
if (Ext.Array.indexOf(this.array, this.C_contractno, 0) == -1) {
//grid.selModel.select(i, true, false);
this.array.push(this.C_contractno);
}
}, this);
//保存复选列表值
this.store_M.addListener('load', function (store, rds, opts) {
var grid = Ext.getCmp('grid_M');
var sm = _this.CB_M;
var total = store.getCount(); //数据行数
for (var i = 0; i < total; i++) {
var row = store.getAt(i);
var contractno = row.get('ContractNo');
if (Ext.Array.indexOf(_this.array, contractno, 0) > -1) {
grid.selModel.select(i, true, false);
}
}
grid.getSelectionModel().addListener('deselect', sm, this); //添加checkboxModel的deselect事件,第三个参数this 可不写,下同
_this.ChangePage = false;
});
this.store_M.addListener('beforeload', function () {
var grid = Ext.getCmp('grid_M');
var sm = _this.CB_M;
_this.ChangePage = true;
grid.getSelectionModel().removeListener('deselect', sm, this);
});
//-----------融出列表--------
//定义数据集
this.storeFOutList = Ext.create('Ext.data.Store', {
model: 'FOutListmb',
remoteSort: false,
proxy: {
type: 'ajax',
url: '/Import/FinanceOut/GetFOutList',
reader: {
idProperty: 'gid',
root: 'data',
totalProperty: 'totalCount'
}
}
});
//定义Grid
this.FOutList = new Ext.grid.GridPanel({
store: this.storeFOutList,
enableHdMenu: false,
region: 'north',
loadMask: { msg: "数据加载中,请稍等..." },
trackMouseOver: true,
disableSelection: false,
stripeRows: true,
//height: 150,
columns: [
{
sortable: true,
dataIndex: 'gid',
header: 'gid',
width: 80,
hidden: true
},
/* {
sortable: true,
dataIndex: 'contractno',
header: 'contractno',
width: 80,
hidden: true
},*/
{
sortable: true,
dataIndex: 'HTH',
header: '合同号',
width: 80
},
{
sortable: true,
dataIndex: 'Starttime',
header: '融资时间',
width: 80
},
{
sortable: true,
dataIndex: 'Endtime',
header: '还款时间',
width: 80
},
{
sortable: true,
dataIndex: 'Customer',
header: '融资人',
width: 80
},
{
sortable: true,
dataIndex: 'FinanceStatus',
header: '状态',
width: 80
},
{
sortable: true,
dataIndex: 'Amount',
header: '金额',
width: 80
},
{
sortable: true,
dataIndex: 'ExchangeRate',
header: '汇率',
width: 80
},
{
sortable: true,
dataIndex: 'RMBAmount',
header: 'RMB金额',
width: 80
}, {
sortable: true,
dataIndex: 'InterestRate',
header: '月利率',
width: 80
},
{
sortable: true,
dataIndex: 'PI',
header: '应还本息',
width: 80
},
{
sortable: true,
dataIndex: 'Interest',
header: '实际还款',
width: 80
},
{
sortable: true,
dataIndex: 'Remark',
header: '备注',
width: 80
}
]
});
//--------------------------
//布局
this.panelTop = new Ext.Panel({
layout: "border",
region: "north",
height: 100,
//split: true,
items: [this.formSearch, this.panelBtn]
});
this.panelContract = new Ext.Panel({
layout: "border",
region: "north",
height: 180,
//split: true,
items: [this.gridList]
});
this.panelMain = new Ext.Panel({
layout: "border",
region: "north",
height: 100,
//split: true,
items: [this.panelTop]
}); //合同查询和结果
this.panelCargo = new Ext.Panel({
//title: '选择融资货物',
layout: "border",
region: 'west',
width: 600,
margin: '1 2',
split: true,
items: [
this.formCargo, this.formFinanceOut, this.formFinanceIn]
});
this.panelChFeeSettlement = new Ext.Panel({
title: '还款明细',
layout: "border",
region: 'center',
margin: '1 2',
items: [this.formFOBody]
});
this.panelFinanceOut = new Ext.Panel({
id: "page_1",
layout: "border",
region: "north",
title: "融出资金管理",
items: [this.panelContract,
this.panelCargo
, this.panelChFeeSettlement
]
});
this.panelFinanceOut_M = new Ext.Panel({
id: "page_2",
layout: "border",
region: "north",
title: "融出资金管理(复选)",
items: [this.grid_M]
});
this.page_3 = new Ext.Panel({
id: "page_3",
title: "融入资金管理",
items: []
});
this.page_4 = new Ext.Panel({
id: "page_4",
title: "融出资金一览",
items: [this.FOutList]
});
this.page_5 = new Ext.Panel({
id: "page_5",
title: "融入资金一览",
items: []
});
this.MainTab = new Ext.tab.Panel({
layout: "border",
region: "center",
items: [this.panelFinanceOut,
this.panelFinanceOut_M,
this.page_2, this.page_3, this.page_4, this.page_5]
});
Ext.apply(this, {
items: [this.panelMain, this.MainTab]
});
this.storeList.on('beforeload', function (store) {
var sql = this.getCondition();
Ext.apply(store.proxy.extraParams, { condition: sql });
}, this);
this.store_M.on('beforeload', function (store) {
var sql = this.getCondition();
Ext.apply(store.proxy.extraParams, { condition: sql });
}, this);
},
//end initUIComponents
onNewClick: function (button, event) {
this.formFinanceOut.show();
this.formFinanceIn.show();
Ext.getCmp('btnAdd').disable();
Ext.getCmp('btnSave').enable();
//alert(this.storeCargo.getCount());
var num = this.storeCargo.getCount();
var Amount = 0;
for (var i = 0; i < num; i++) {
Amount = this.storeCargo.getAt(i).get('Amount');
}
var BB = this.storeCargo.getAt(0).get('codename');
//alert(Amount);
this.formFinanceOut.getForm().findField('gid').setValue(NewGuid());
this.formFinanceOut.getForm().findField('ContractNo').setValue(this.C_contractno);
this.formFinanceOut.getForm().findField('Customer').setValue(this.C_Customer);
this.formFinanceOut.getForm().findField('TimeMark').setValue('0');
this.formFinanceOut.getForm().findField('Amount').setValue(Amount);
this.formFinanceOut.getForm().findField('RMBAmount').setValue('0');
this.formFinanceOut.getForm().findField('ExchangeRate').setValue('1');
this.formFinanceOut.getForm().findField('Days').setValue('0');
this.formFinanceOut.getForm().findField('Interest').setValue('0');
this.formFinanceOut.getForm().findField('InterestRate').setValue('0');
this.formFinanceOut.getForm().findField('PI').setValue('0');
this.formFinanceOut.getForm().findField('Shouxu').setValue('0');
this.formFinanceOut.getForm().findField('Currency').setValue(BB);
this.formFinanceIn.getForm().findField('gid').setValue(NewGuid());
this.formFinanceIn.getForm().findField('ContractNo').setValue(this.C_contractno);
this.formFinanceIn.getForm().findField('TimeMark').setValue('0');
this.formFinanceIn.getForm().findField('Amount').setValue(Amount);
this.formFinanceIn.getForm().findField('RMBAmount').setValue('0');
this.formFinanceIn.getForm().findField('ExchangeRate').setValue('1');
this.formFinanceIn.getForm().findField('Days').setValue('0');
this.formFinanceIn.getForm().findField('Interest').setValue('0');
this.formFinanceIn.getForm().findField('InterestRate').setValue('0');
this.formFinanceIn.getForm().findField('PI').setValue('0');
this.formFinanceIn.getForm().findField('Currency').setValue(BB);
},
onSaveClick: function (button, event) {
this.Save("0");
},
CargoAfterEdit: function (editor, e, eOpts) {
if (e.field == 'Financestatus') {
var Financestatusrecords = DsStoreQueryBy(this.storeFStatus, 'EnumValueId', e.value);
if (Financestatusrecords.getCount() > 0) {
var Financestatusdata = Financestatusrecords.getAt(0).data;
e.record.set('FinancestatusRef', Financestatusdata.EnumValueName);
} else {
e.record.set('FinancestatusRef', '');
}
}
},
onaddFOBody: function () {
// var newSerialno = DsGetNewSerialNo(this.storeBodyList, this.serialNo);
// this.serialNo = newSerialno;
var record = Ext.create('FOBodymb', {
'id': '',
'ContractNo': '',
'Repaymentdate': '',
'Amount': '0',
'Remark': ''
});
this.storeFOBody.add(record);
var n = this.storeFOBody.getCount();
this.cellEditingFOBody.startEditByPosition({
row: n - 1,
column: 2
});
},
onDelFOBody: function (button, event) {
var selectedRecords = this.formFOBody.selModel.getSelection();
Ext.MessageBox.confirm('提示', '确定删除记录吗?',
function (btn) {
if (btn == 'yes') {
for (var i = 0; i < selectedRecords.length; i++) {
var rec = selectedRecords[i];
//alert(rec.gid);
if (rec.gid != "" || rec.gid != "*") //如果是新增但没有保存的数据,没有必要提交到后台
{
this.FOBodyDel.push(rec);
}
this.storeFOBody.remove(selectedRecords[i]);
}
}
},
this);
},
onRefreshClick: function (button, event) {
var _p = this.MainTab.getActiveTab().id;
//alert(this.MainTab.getActiveTab().id);
if (_p == "page_1") {
var sql = this.getCondition();
this.storeList.load({
params: { start: 0, limit: this.PageSize, sort: '', condition: sql },
waitMsg: "正在查询数据...",
scope: this
});
}
if (_p == "page_2") {
var sql = this.getCondition();
this.store_M.load({
params: { start: 0, limit: this.PageSize, sort: '', condition: sql },
waitMsg: "正在查询数据...",
scope: this
});
}
if (_p == "page_3") {
var sql = this.getCondition();
this.storeFOutList.load({
params: {
start: 0,
limit: this.PageSize,
sort: '',
condition: sql
},
waitMsg: "正在查询数据...",
scope: this
});
}
},
getCondition: function () {
var form = this.formSearch.getForm();
if (!form.isValid()) {
Ext.Msg.alert('提示', '查询条件赋值错误,请检查。');
return '';
}
var sql = '';
var Mainstate = " (select distinct bsno from ch_fee where (feename in('购货款','预付款','尾款')) and feestatus<8 )";
sql = sql + getAndConSql(sql, Mainstate, "m.contractno in " + Mainstate + " ");
//合同状态在审单之后,完成之前的。
/*
var ContractNo = form.findField('ContractNo').getValue();
sql = sql + getAndConSql(sql, ContractNo, "M.ContractNo like '%" + ContractNo + "%'");*/
var HTH = form.findField('HTH').getValue();
sql = sql + getAndConSql(sql, HTH, "M.HTH like '%" + HTH + "%'");
/* var company = form.findField('company').getValue();
sql = sql + getAndConSql(sql, company, "M.company = '" + company + "'");
var countryid = form.findField('countryid').getValue();
sql = sql + getAndConSql(sql, countryid, "m.countryid like '%" + countryid + "%'");
var seller = form.findField('seller').getRawValue();
sql = sql + getAndConSql(sql, seller, "M.seller like '%" + seller + "%'");*/
var buyer = form.findField('buyer').getRawValue();
sql = sql + getAndConSql(sql, buyer, "M.buyer like '%" + buyer + "%'");
var _p = this.MainTab.getActiveTab().id;
//alert(this.MainTab.getActiveTab().id);
if (_p == "page_1" || _p == "page_2") {
var custDate_Min = form.findField('ExpDateBgn').getRawValue();
sql = sql + getAndConSql(sql, custDate_Min, "M.ArrivalDate >= '" + custDate_Min + "'");
var custDate_Max = form.findField('ExpDateEnd').getRawValue();
sql = sql + getAndConSql(sql, custDate_Max, "M.ArrivalDate <= '" + custDate_Max + " 23:59:59'");
}
if (_p == "page_3") {
}
/* var port = form.findField('port').getValue();
sql = sql + getAndConSql(sql, port, "m.port = " + port + "");
*/
var remark = form.findField('remark').getValue();
sql = sql + getAndConSql(sql, remark, "m.remark like '%" + remark + "%'");
/*
var Remind = form.findField('Remind').getValue();
sql = sql + getAndConSql(sql, Remind, Remind);
*/
return sql;
},
onGetremind: function (field, newValue, oldValue) {
if (newValue != null) {
this.storeList.load({
params: {
start: 0,
limit: this.PageSize,
sort: '',
condition: newValue
},
waitMsg: "正在查询数据...",
scope: this
});
}
},
OprationSwap: function () {
var ret = new Array();
ret[0] = this.OprationStatus;
ret[1] = this.storeList;
ret[2] = this.SelectedRecord;
return ret;
},
// alert(this.OprationStatus.ToString());
// alert(this.storeList.toString());
// alert(this.SelectedRecord.toString());
onAuditPassClick: function (button, event) {
var records = this.feeGridCheckBoxModel.selected.items;
DsTruck.MsChFeeAudit(records, 0, '正在审核数据, 请稍侯..');
},
//通过
onAuditRefuseClick: function (button, event) {
var records = this.feeGridCheckBoxModel.selected.items;
DsTruck.MsChFeeAudit(records, 6, '正在审核数据, 请稍侯..');
},
//驳回提交
onSettlementClick: function (button, event) {
var records = this.feeGridCheckBoxModel.selected.items;
DsTruck.MsChFeeAudit(records, 8, '正在审核数据, 请稍侯..');
},
//部分结算
onSettlementAllClick: function (button, event) {
var records = this.feeGridCheckBoxModel.selected.items;
DsTruck.MsChFeeAudit(records, 9, '正在审核数据, 请稍侯..');
},
//全部结算
SetAmount: function () {
var Amount = panelIndex.formFinanceOut.getForm().findField('Amount').getValue();
//rll = rll.toFixed(4);
var ExchangeRate = panelIndex.formFinanceOut.getForm().findField('ExchangeRate').getValue();
var RMBAmount = Amount * ExchangeRate;
panelIndex.formFinanceOut.getForm().findField('RMBAmount').setValue(RMBAmount.toFixed(2));
},
SetAmountIn: function () {
var Amount = panelIndex.formFinanceIn.getForm().findField('Amount').getValue();
//rll = rll.toFixed(4);
var ExchangeRate = panelIndex.formFinanceIn.getForm().findField('ExchangeRate').getValue();
var RMBAmount = Amount * ExchangeRate;
panelIndex.formFinanceIn.getForm().findField('RMBAmount').setValue(RMBAmount.toFixed(2));
},
SetInterest: function () {
var InterestRate = panelIndex.formFinanceOut.getForm().findField('InterestRate').getValue() / 30;
InterestRate = InterestRate.toFixed(20);
var Interest = parseFloat(panelIndex.formFinanceOut.getForm().findField('RMBAmount').getValue());
var days = parseFloat(panelIndex.formFinanceOut.getForm().findField('Days').getValue());
var PI = parseFloat(Interest.toFixed(2)) + parseFloat((Interest * InterestRate / 100) * days);
Interest = /*parseFloat(Interest.toFixed(2)) + */parseFloat((Interest * InterestRate / 100) * days);
//alert(Interest + '__' + InterestRate + '__' + days);
panelIndex.formFinanceOut.getForm().findField('Interest').setValue(Interest.toFixed(6));
panelIndex.formFinanceOut.getForm().findField('PI').setValue(PI.toFixed(6));
},
SetInterestIn: function () {
var InterestRate = panelIndex.formFinanceIn.getForm().findField('InterestRate').getValue() / 30;
InterestRate = InterestRate.toFixed(20);
var Interest = parseFloat(panelIndex.formFinanceIn.getForm().findField('RMBAmount').getValue());
var days = parseFloat(panelIndex.formFinanceIn.getForm().findField('Days').getValue());
var PI = parseFloat(Interest.toFixed(2)) + parseFloat((Interest * InterestRate / 100) * days);
Interest = /*parseFloat(Interest.toFixed(2)) + */parseFloat((Interest * InterestRate / 100) * days);
//alert(Interest + '__' + InterestRate + '__' + days);
panelIndex.formFinanceIn.getForm().findField('Interest').setValue(Interest.toFixed(6));
panelIndex.formFinanceIn.getForm().findField('PI').setValue(PI.toFixed(6));
},
Save: function (type) {
//alert(this.opStatus);
var basicForm = this.formFinanceOut.getForm();
if (!basicForm.isValid()) {
return;
}
basicForm.findField('gid').setDisabled(false);
basicForm.findField('Customer').setDisabled(false);
var data = this.formFinanceOut.getForm().getValues();
basicForm.findField('gid').setDisabled(true);
basicForm.findField('Customer').setDisabled(true);
var FOBodydatas = [];
for (var i = 0; i < this.storeFOBody.getCount(); i += 1) {
var member = this.storeFOBody.getAt(i);
FOBodydatas.push(member);
}
//还款明细
var jsonFOBody = ConvertRecordsToJson(FOBodydatas);
var jsonFODelBody = ConvertRecordsToJsonAll(this.FOBodyDel);
//alert(this.OpStatus);
Ext.Msg.wait('正在保存数据, 请稍侯..');
Ext.Ajax.request({
waitMsg: '正在保存数据...',
url: '/Import/FinanceOut/Save',
scope: this,
params: {
opstatus: this.OpStatus,
data: Ext.JSON.encode(data),
FOBody: jsonFOBody,
FODelBody: jsonFODelBody
},
callback: function (options, success, response) {
if (success) {
Ext.MessageBox.hide();
var jsonresult = Ext.JSON.decode(response.responseText);
if (jsonresult.Success) {
this.storeFOBody.commitChanges();
var returnData = jsonresult.Data;
this.formFinanceOut.getForm().setValues(returnData);
if (this.OpStatus == 'add') {
//var arrNewRecords = this.StoreList.add(returnData);
//this.editRecord = arrNewRecords[0];
// alert(editRecord.get('ContractNo'));
/////this.opStatus = 'edit';
}
else if (this.OpStatus == 'edit') {
/* var editp = Ext.create('FOutListmb', returnData);
this.editRecord.fields.each(function (field) {
if (field.persist) {
name = field.name;
//alert(name + ' -- ' + editp.get(name));
if (name != 'id') this.editRecord.set(name, editp.get(name));
}
},
this);
this.editRecord.commit();*/
}
} 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
});
}
//alert('03');
}
});
var dataIn = this.formFinanceIn.getForm().getValues();
//alert(this.OpStatus);
Ext.Msg.wait('正在保存数据, 请稍侯..');
Ext.Ajax.request({
waitMsg: '正在保存数据...',
url: '/Import/FinanceOut/SaveIn',
scope: this,
params: {
opstatus: this.OpStatus,
data: Ext.JSON.encode(dataIn)
},
callback: function (options, success, response) {
if (success) {
Ext.MessageBox.hide();
var jsonresult = Ext.JSON.decode(response.responseText);
if (jsonresult.Success) {
var returnData_2 = jsonresult.Data;
//alert(returnData_2[0].TimeMark);
this.formFinanceIn.getForm().setValues(returnData_2);
this.formFinanceIn.getForm().findField('TimeMark').setValue(returnData_2[0].TimeMark);
if (this.OpStatus == 'add') {
//var arrNewRecords = this.StoreList.add(returnData);
//this.editRecord = arrNewRecords[0];
// alert(editRecord.get('ContractNo'));
/////this.opStatus = 'edit';
}
else if (this.OpStatus == 'edit') {
/* var editp = Ext.create('FOutListmb', returnData);
this.editRecord.fields.each(function (field) {
if (field.persist) {
name = field.name;
//alert(name + ' -- ' + editp.get(name));
if (name != 'id') this.editRecord.set(name, editp.get(name));
}
},
this);
this.editRecord.commit();*/
}
} 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
});
}
//alert('03');
}
});
}
//end save
});