You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
DS7/DSWeb/Areas/Import/Viewsjs/Finance/FinanceAdd.js

337 lines
11 KiB
JavaScript

3 years ago
Ext.namespace('DsTruck');
DsTruck.FinanceAdd = function (config) {
Ext.applyIf(this, config);
this.initUIComponents();
DsTruck.FinanceAdd.superclass.constructor.call(this);
};
Ext.extend(DsTruck.FinanceAdd, Ext.Window, {
StoreList: null,
CONTRACTNO: '',
start: 0,
limit: 100,
condition: '',
returnsql: null,
initUIComponents: function () {
// BEGIN OF CODE GENERATION PARTS, DON'T DELETE CODE BELOW
this.storeBuyer_F = Ext.create('DsExt.ux.RefTableStore', {
model: 'Tradermb',
proxy: { url: '/CommMng/BasicDataRef/GetTrader' }
});
this.storeBuyer_F.load({ params: { condition: " 1=1"} });
this.comboxBuyer_F = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: '融资客户',
forceSelection: true,
allowBlank: false,
store: this.storeBuyer_F,
name: 'CUSTOMER',
valueField: 'name',
displayField: 'codename'
});
this.storeBank_F = Ext.create('DsExt.ux.RefTableStore', {
model: 'Tradermb',
proxy: { url: '/CommMng/BasicDataRef/GetTrader' }
});
this.storeBank_F.load({ params: { condition: " isother=1"} });
this.comboxBank_F = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: '融资银行',
forceSelection: true,
store: this.storeBank_F,
name: 'FINANCE_BANK',
valueField: 'name',
displayField: 'codename'
});
this.panelBodyMY = new Ext.Panel({
height: 60,
frame: true,
fieldDefaults: {
margins: '2 2 2 2',
labelAlign: 'right',
flex: 1,
labelWidth: 70,
msgTarget: 'qtip'
},
items: [{
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [{
fieldLabel: '贸易商',
name: 'seller'
}, {
fieldLabel: '购货方',
name: 'buyer'
}, {
fieldLabel: '合同号',
name: 'HTH'
}, {
fieldLabel: '用证公司',
name: 'companyname'
}]
}, {
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [{
fieldLabel: '提单号',
name: 'BillNo'
}, {
fieldLabel: '目的港',
name: 'portRef'
}, {
fieldLabel: '到港日期',
name: 'ArrivalDate'
}, { xtype: 'hiddenfield'}]
}]
});
Ext.define('MsFeeCurr', {
extend: 'Ext.data.Model',
idProperty: 'CURR',
fields: [
{ name: 'CURR', type: 'string' },
{ name: 'DEFRATE', type: 'number' }
]
});
this.StoreCurr = Ext.create('DsExt.ux.RefTableStore', {
model: 'MsFeeCurr',
proxy: { url: '/MvcShipping/MsChFee/GetFeeCurrList' }
});
this.StoreCurr.load({ params: { condition: ""} });
this.comboxCurr = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: '融资币别',
store: this.StoreCurr,
forceSelection: true,
allowBlank: false,
name: 'F_CURRENCY',
valueField: 'CURR',
displayField: 'CURR'
});
this.formAdd = Ext.widget('form', {
frame: true,
region: 'center',
bodyPadding: 5,
fieldDefaults: {
margins: '2 2 2 2',
labelAlign: 'right',
flex: 1,
labelWidth: 70,
msgTarget: 'qtip'
},
items: [{
xtype: 'container',
defaultType: 'textfield',
layout: 'anchor',
defaults: {
anchor: '100%'
},
items: [{
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [{
fieldLabel: '业务编号',
name: 'MAINNO', hidden: true
}, {
fieldLabel: '操作代码',
name: 'OP', hidden: true
}, {
fieldLabel: '融资编号',
name: 'F_NO', readOnly: true, hidden: false
}, this.comboxBuyer_F, this.comboxCurr, {
fieldLabel: '融资金额',
allowBlank: false,
name: 'F_AMOUNT', value: 0
}]
}, {
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [this.comboxBank_F, {
fieldLabel: '融资时间',
id: 'STARTDATE',
format: 'Y-m-d',
xtype: 'datefield',
renderer: Ext.util.Format.dateRenderer('Y-m-d'),
name: 'STARTDATE'
},
{
fieldLabel: '预计还款日',
id: 'ENDDATE',
format: 'Y-m-d',
xtype: 'datefield',
renderer: Ext.util.Format.dateRenderer('Y-m-d'),
name: 'ENDDATE',
listeners: {
change: function () {
}
}
}, {
fieldLabel: '融资状态',
name: 'F_STATUS', readOnly: true, hidden: false
}]
}, {
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [{
fieldLabel: '操作人',
readOnly: true, flex: 1,
name: 'OPREF'
}, {
fieldLabel: '建立时间',
format: 'Y-m-d H:i:s',
xtype: 'datefield',
renderer: Ext.util.Format.dateRenderer('Y-m-d H:i:s'),
name: 'ENTERDATE'
}, {
fieldLabel: '备注', flex: 2,
name: 'REMARK'
}]
}, this.panelBodyMY
]
}],
buttons: [{
text: "确认申请",
id: 'btnQuery',
handler: function (button, event) {
this.execSql();
},
scope: this
}, {
text: "关闭",
handler: function (button, event) {
var win = this.up("window");
win.close();
}
}]
});
Ext.apply(this, {
height: 250,
closable: true,
draggable: true,
title: '申请融资',
defaultButton: 'btnQuery',
resizable: false,
items: [this.formAdd],
layout: "border",
width: 800,
xtype: "window",
id: "DsQueryWin",
listeners: {
scope: this,
'beforeshow': function (thewin, eOpts) {
this.LoadData("add", this.CONTRACTNO);
}
}
});
}, //onDeleteClick
LoadData: function (opstatus, contractno) {
this.serialNo = 0;
this.workSerialNo = 0;
this.bodyDel = [];
this.opStatus = opstatus;
Ext.Ajax.request({
waitMsg: '正在查询主表数据...',
url: '/Import/Finance/NewData',
async: false,
params: {
contractno: 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;
}
var data = result.data;
this.formAdd.getForm().reset();
this.formAdd.getForm().setValues(data);
var myDate = new Date();
var mydatestr = Ext.util.Format.date(myDate, 'Y-m-d H:i:s');
this.formAdd.getForm().findField('ENTERDATE').setValue(mydatestr)
this.formAdd.getForm().findField('OP').setValue(USERID)
this.formAdd.getForm().findField('OPREF').setValue(SHOWNAME)
} else {
Ext.MessageBox.alert('请求出现错误,请重试', response.responseText);
}
},
scope: this
});
//this.SetInterest();
}, // end LoadDate
execSql: function () {
var basicForm = this.formAdd.getForm();
if (!basicForm.isValid()) {
return;
}
var data = basicForm.getValues();
Ext.Msg.wait('正在保存数据, 请稍侯..');
Ext.Ajax.request({
waitMsg: '正在保存数据...',
url: '/Import/Finance/SaveNew',
scope: this,
params: {
opstatus:'add',
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) {
parentWin = window.panelEdit;
parentWin.editRecord.data.FinanceStatus = "1";
parentWin.formEdit.getForm().findField('FinanceStatus').setValue("1")
var win = Ext.getCmp("DsQueryWin");
win.close();
} 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
});
}
}
});
}
});