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/WMS/Viewsjs/WMS/WMSEdit.js

1723 lines
60 KiB
JavaScript

This file contains ambiguous Unicode characters!

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

Ext.namespace('Shipping');
Shipping.MsOp_YAXIANGEdit = function (config) {
Ext.applyIf(this, config);
this.initUIComponents();
window.Shipping.MsOp_YAXIANGEdit.superclass.constructor.call(this);
};
Ext.extend(Shipping.MsOp_YAXIANGEdit, Ext.Panel, {
parentWin: null,
OpStatus: 'add',
StoreList: null,
editRecord: null,
Editdata: null,
MainEditRecord: null,
stroplb: '',
isfen: false,
initUIComponents: function () {
this.serialNo = 0;
//this.bodyDel = [];
this.itemindex = 1;
this.initloaddata = 0;
this.accdatesameetd = 0;
this.MsPeriod = null;
this.SALEORDERDEPTBYOP = 0;
this.formname = "MsOp_YAXIANGEdit";
//#region 信息加载
this.storeDefValue = Ext.create('Ext.data.Store', {
model: 'DsShipping.ux.OpDefValue',
remoteSort: true,
proxy: {
type: 'ajax',
url: '/MvcShipping/MsCodeOpDef/GetDataList',
reader: {
id: 'GID',
root: 'data',
totalProperty: 'totalCount'
}
}
});
this.storeMustBe = Ext.create('Ext.data.Store', {
model: 'DsShipping.ux.OpDefValue',
remoteSort: true,
proxy: {
type: 'ajax',
url: '/MvcShipping/MsCodeOpMustField/GetDataList',
reader: {
id: 'GID',
root: 'data',
totalProperty: 'totalCount'
}
}
});
this.storecodeservice = Ext.create('DsExt.ux.RefTableStore', {
model: 'MsCodeOpService',
proxy: { url: '/MvcShipping/MsCodeOpService/GetDataList' }
});
//权限范围
this.StoreOpRange = Ext.create('DsExt.ux.RefTableStore', {
model: 'MsOP',
proxy: { url: '/MvcShipping/MsBaseInfo/GetOpIDRang' }
});
//this.StoreOpRange.load({ params: { optype: "modOrderManagement" } });
//客户加载_场站 押箱单位
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: '押箱单位', matchFieldWidth: false,
store: this.storeCustCode,
forceSelection: true,
queryMode: 'local',
flex: 1,
//queryParam: 'CODENAME',
name: 'CUSTOMERNAME',
valueField: 'CustName',
displayField: 'CodeAndName',
listeners: {
scope: this,
'beforequery': function (e) {
return FilterCombox(e);//在beforequery使用此方法
},
'select': function (combo, records, eOpts) {
if (records.length > 0) {
var CUSTOMERFULLNAME = this.formEdit.getForm().findField('CUSTOMERFULLNAME');
CUSTOMERFULLNAME.setValue(records[0].data.DESCRIPTION);
LoadCombox(this.comboxCustACCOUNT, " LINKID='" + records[0].data.GId+"' ");
}
}
}
});
this.storeCustACCOUNT = Ext.create('DsExt.ux.RefTableStore', {
model: 'DsShipping.ux.CustomACCOUNTModel',
proxy: { url: '/CommMng/BasicDataRef/GetCustomACCOUNTList' }
});
this.comboxCustACCOUNT = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: "押箱单位账户",
labelWidth:80,flex:2,
store: this.storeCustACCOUNT,
forceSelection: true,
name: 'CUSTOMERBANK',
valueField: 'GID',
displayField: 'BANKNAME',
listeners: {
scope: this,
'select': function (combo, records, eOpts) {
if (records.length > 0) {
var ACCOUNT = this.formEdit.getForm().findField('CUSTOMERACCOUNT');
ACCOUNT.setValue(records[0].data.ACCOUNT);
}
}
}
});
this.StoreStlMode = Ext.create('DsExt.ux.RefTableStore', {
model: 'STLMODE2',
proxy: { url: '/MvcShipping/MsBaseInfo/GetStlModeList' }
});
this.comboxStlMode = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: '支付方式', id: "cmbPAYMENTTYPE",
store: this.StoreStlMode,
forceSelection: true,
queryMode: 'local',
name: 'PAYMENTTYPE',
valueField: 'STLCODE',
displayField: 'STLNAME'
});
this.StoreStlMode2 = Ext.create('DsExt.ux.RefTableStore', {
model: 'STLMODE2',
proxy: { url: '/MvcShipping/MsBaseInfo/GetStlModeList' }
});
this.comboxStlMode2 = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: '收回方式',
store: this.StoreStlMode2,
forceSelection: true,
queryMode: 'local',
minChars: 1,
name: 'RETURNTYPE',
valueField: 'STLCODE',
displayField: 'STLNAME'
});
this.StoreBANK = Ext.create('DsExt.ux.RefTableStore', {
model: 'BANK',
proxy: { url: '/MvcShipping/MsBaseInfo/GetBANKList' }
});
this.comboxBANK = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: '支付银行',
store: this.StoreBANK,
forceSelection: true, //matchFieldWidth: false,
queryMode: 'local',
name: 'PAYMENTBANK', id: "cmbPAYMENTBANK",
valueField: 'GID',
displayField: 'BANKNAME',
listeners: {
scope: this,
'select': function (combo, records, eOpts) {
if (records.length > 0) {
var PAYMENTFINANCESOFTCODE = this.formZHIFU.getForm().findField('PAYMENTFINANCESOFTCODE');
PAYMENTFINANCESOFTCODE.setValue(records[0].data.ACCOUNT);
}
}
}
});
this.StoreBANK2 = Ext.create('DsExt.ux.RefTableStore', {
model: 'BANK',
proxy: { url: '/MvcShipping/MsBaseInfo/GetBANKList' }
});
this.comboxBANK2 = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: '收回银行', //matchFieldWidth: false,
store: this.StoreBANK2,flex:2,
forceSelection: true,
queryMode: 'local',
name: 'RETURNBANK',
valueField: 'GID',
displayField: 'BANKNAME',
listeners: {
scope: this,
'select': function (combo, records, eOpts) {
if (records.length > 0) {
var RETURNFINANCESOFTCODE = this.formSHOUHUI.getForm().findField('RETURNFINANCESOFTCODE');
RETURNFINANCESOFTCODE.setValue(records[0].data.ACCOUNT);
}
}
}
});
//加载业务信息
//#endregion
//#region 主表信息
this.formEdit = Ext.widget('form', {
//layout: "border",
region: 'north',
title:'押箱单信息',
//height:300,
frame: true,
bodyPadding: 5,
//collapsed: false,
//collapsible: true,
trackResetOnLoad: true,
fieldDefaults: {
margins: '2 2 2 2',
labelAlign: 'right',
flex: 1,
labelWidth: 80,
msgTarget: 'qtip'
},
items: [
{
xtype: 'container',
layout: 'hbox', hidden: true,
defaultType: 'textfield',
items: [
{
fieldLabel: 'GID',
name: 'GID'
}, {
fieldLabel: 'YXSTATE',
name: 'YXSTATE', hidden: true
}, {
fieldLabel: 'CREATEUSER',
name: 'CREATEUSER', hidden: true
}, {
fieldLabel: 'AUDITOR',
name: 'AUDITOR', hidden: true
}, {
fieldLabel: 'COMPANYID',
name: 'COMPANYID', hidden: true
}, {
fieldLabel: 'DEPTID',
name: 'DEPTID', hidden: true
}, {
fieldLabel: 'TIMEMARK',
name: 'TIMEMARK', hidden: true
}
]
}
,
{
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [
{
fieldLabel: '押箱单号',
name: 'YXNO', flex: 1
}, this.comboxCustCode//押箱单位
, {
fieldLabel: '押箱日期',
format: 'Y-m-d',
flex: 1,
//labelWidth: 55,
xtype: 'datefield',
name: 'YXDATE'
}, {
fieldLabel: '预计回款日',
format: 'Y-m-d',
flex: 1,
//labelWidth: 55,
xtype: 'datefield',
name: 'PATMENTDATE_EX'
}, {
fieldLabel: '押箱单状态',
name: 'YXSTATEREF', flex: 1, readOnly: true
}
]
}
, {
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [
{
fieldLabel: '创建人',
name: 'CREATEUSERREF',
flex: 1, readOnly: true
}, {
fieldLabel: '创建日期',
format: 'Y-m-d H:i:s',
xtype: 'datetimefield',
name: 'CREATETIME',
flex: 1,readOnly:true
}, {
fieldLabel: '审核人',
name: 'AUDITORREF',
flex: 1, readOnly: true
}, {
fieldLabel: '审核日期',
//xtype: 'datetimefield',
name: 'AUDITTIME',
flex: 1, readOnly: true
}, {
fieldLabel: '押箱金额', id:"YXMONEY",
xtype: 'numberfield',
selectOnFocus: true, //得到焦点时自动选择文本
allowDecimals: true, //允许输入小数
decimalPrecision: 2, //允许保留的小数位数,并四舍五入
name: 'YXMONEY',
flex: 1
}
]
}
, {
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [
{
fieldLabel: '押箱单位全称',
labelWidth: 80,
name: 'CUSTOMERFULLNAME',
flex: 2, readOnly: true
}
, this.comboxCustACCOUNT
, {
fieldLabel: '押箱单位账号',
labelWidth: 80,
name: 'CUSTOMERACCOUNT',
flex: 1, readOnly: true
}
//, {xtype:"hiddenfield",flex:1}
]
}
]//end items(fieldset 1)
}); //end this.formEdit
_this = this;
this.formZHIFU = Ext.widget('form', {
anchor: '40% 100%',
columnWidth: .40,
frame: true,
trackResetOnLoad: true,
bodyPadding: 5,
title: '支付信息',
fieldDefaults: {
margins: '3 3 3 3',
labelAlign: 'right',
flex: 1,
labelWidth: 55,
msgTarget: 'qtip'
},
items: [
{
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [
{
xtype: 'hiddenfield', flex: 0.5
}, {
text: '确认支付', minWidth: 80, flex: 1,
xtype: 'button', id: "btnQRZF"
,style: {
marginBottom: '8px'//,//距底部高度
//marginLeft: '10px',//距左边宽度
//marginRight: '10px'//距右边宽度
}, handler:
function (button, event) {
_this.PushState("3002");
}
}, {
xtype: 'hiddenfield', flex: 0.5
}, {
text: '撤销支付', minWidth: 80, flex: 1,
xtype: 'button', id: "btnCXZF"
, style: {
marginBottom: '8px'//,//距底部高度
//marginLeft: '10px',//距左边宽度
//marginRight: '10px'//距右边宽度
}, handler:
function (button, event) {
_this.PushState("30021");
}
}, {
xtype: 'hiddenfield', flex: 0.5
}
]//end items(fieldset 1)
}
, {
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [
this.comboxStlMode,
{
fieldLabel: '支付日期',
xtype: 'datefield',
format:'Y-m-d',
name:'PAYMENTDATE'
}
]//end items(fieldset 1)
}
, {
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [
this.comboxBANK
]
}
, {
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [
{
fieldLabel: '银行账号',
name: 'PAYMENTFINANCESOFTCODE',
readOnly: true
}
]
}
, {
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [
{
fieldLabel: '支付备注',
name: 'PAYMENTREMARK'
}
]
}
]//end root items
});
this.formSHOUHUI = Ext.widget('form', {
anchor: '60% 100%',
columnWidth: .60,
frame: true,
trackResetOnLoad: true,
bodyPadding: 5,
title: '收回信息',
fieldDefaults: {
margins: '3 3 3 3',
labelAlign: 'right',
flex: 1,
labelWidth: 55,
msgTarget: 'qtip'
},
items: [
{
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [
{
xtype: 'hiddenfield', flex: 0.5
}, {
text: '确认收回', minWidth: 80, flex: 1,
xtype: 'button', id: "btnQRSH"
, style: {
marginBottom: '8px'//,//距底部高度
//marginLeft: '10px',//距左边宽度
//marginRight: '10px'//距右边宽度
}
//,listeners: {
// click: function () {
// alert(123456);
// }
//}
, handler:
function (button, event) {
_this.PushState("3003");
}
}, {
xtype: 'hiddenfield', flex: 0.5
}, {
text: '取消收回', minWidth: 80, flex: 1,
xtype: 'button', id: "btnQXSH"
, style: {
marginBottom: '8px'//,//距底部高度
//marginLeft: '10px',//距左边宽度
//marginRight: '10px'//距右边宽度
}, handler:
function (button, event) {
_this.PushState("30031");
}
}, {
xtype: 'hiddenfield', flex: 2.5
}
]//end items(fieldset 1)
}
, {
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [
this.comboxStlMode2
, {
fieldLabel: '收回日期',
labelwidth: 55,
xtype: 'datefield',
format: 'Y-m-d',
name: 'RETURNDATE'
}
, {
fieldLabel: '实际收回',
labelwidth: 55,
name: 'RETURNMONEY',
value:0,
readOnly: true
}
]//end items(fieldset 1)
}
, {
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [
this.comboxBANK2
, {
fieldLabel: '总计扣款',
labelwidth: 55,
name: 'SPENDMONEY',
readOnly: true
}
]
}
, {
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [
{
fieldLabel: '银行账号',flex:2,
name: 'RETURNFINANCESOFTCODE',
readOnly:true
}, {xtype:'hiddenfield',flex:1}
]
}
, {
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [
{
fieldLabel: '支付备注',flex:2,
name: 'RETURNREMARK'
}, { xtype: 'hiddenfield', flex: 1 }
]
}
]//end root items
});
//#endregion
//#region 押箱明细
this.cellEditing = Ext.create('Ext.grid.plugin.CellEditing', {
clicksToEdit: 1
});
//this.cargoCheckBoxModel = Ext.create('Ext.selection.CheckboxModel');
this.column = [
{
dataIndex: 'GID',
header: 'GID',
width: 80,
hidden: true
}, {
dataIndex: 'YXNO',
header: 'YXNO',
width: 80,
hidden: true
},
{
sortable: true,
dataIndex: 'YXNO',
header: '押箱单号',
width: 80, hidden: true
},
{
sortable: true,
dataIndex: 'SORT',
header: '顺序号',
width: 80, hidden: true
},
{
sortable: true,
dataIndex: 'BSNO',
header: 'BSNO',
width: 80, hidden: true
},
{
sortable: true,
dataIndex: 'CUSTNO',
header: '业务编号',
width: 80
},
{
sortable: true,
dataIndex: 'MBLNO',
header: '主提单号',
width: 80
},
{
sortable: true,
dataIndex: 'CUSTOMERNAME',
header: '委托单位',
width: 80
},
{
sortable: true,
dataIndex: 'OP',
header: '操作',
width: 80
},
{
sortable: true,
dataIndex: 'SALE',
header: '销售',
width: 80
},
{
sortable: true,
dataIndex: 'CNTRTOTAL',
header: '集装箱',
width: 80
},
{
sortable: true,
dataIndex: 'FIXFEE',
header: '修箱费',
summaryType: 'sum',
summaryRenderer: function (value) {
// SumGongShiFei = value;
return Ext.util.Format.number(value, '0.00');
},
editor: {
xtype: 'numberfield'//,
//selectOnFocus: true, //得到焦点时自动选择文本
//allowDecimals: true, //允许输入小数
//decimalPrecision: 2 //允许保留的小数位数,并四舍五入
},
width: 80
},
{
sortable: true,
dataIndex: 'WASHFEE',
header: '洗箱费',
summaryType: 'sum',
editor: {
xtype: 'numberfield',
selectOnFocus: true, //得到焦点时自动选择文本
allowDecimals: true, //允许输入小数
decimalPrecision: 2 //允许保留的小数位数,并四舍五入
},
width: 80
},
{
sortable: true,
dataIndex: 'FWFEE',
header: '修洗箱费',
summaryType: 'sum',
editor: {
xtype: 'numberfield',
selectOnFocus: true, //得到焦点时自动选择文本
allowDecimals: true, //允许输入小数
decimalPrecision: 2 //允许保留的小数位数,并四舍五入
},
width: 80
},
{
sortable: true,
dataIndex: 'OVERFEE',
header: '超期箱使费',
summaryType: 'sum',
editor: {
xtype: 'numberfield',
selectOnFocus: true, //得到焦点时自动选择文本
allowDecimals: true, //允许输入小数
decimalPrecision: 2 //允许保留的小数位数,并四舍五入
},
width: 80
},
{
sortable: true,
dataIndex: 'LATEFEE',
header: '滞纳金',
summaryType: 'sum',
editor: {
xtype: 'numberfield',
selectOnFocus: true, //得到焦点时自动选择文本
allowDecimals: true, //允许输入小数
decimalPrecision: 2 //允许保留的小数位数,并四舍五入
},
width: 80
},
{
sortable: true,
dataIndex: 'TOTALFEE',
header: '扣款小计',
summaryType: 'sum',
width: 80
},
{
sortable: true,
dataIndex: 'REMARK',
header: '备注',
width: 80
}
];
this.storeBody = Ext.create('Ext.data.Store', {
pageSize: this.PageSize,
model: 'YXDetailmb',
remoteSort: false,
//groupField: 'GroupDate',
proxy: {
type: 'ajax',
//url: '/TruckMng/MsRptPcHeadOperate/QryData_ADL',
url: '/MvcShipping/MsOp_YAXIANG/GetBodyList',
//this.storeList.proxy.url = '/TruckMng/MsRptPcHeadOperate/QryData_ADL';
reader: {
id: 'GID',
root: 'data',
totalProperty: 'totalCount'
}
}
});
this.formDetail = new Ext.grid.GridPanel({
store: this.storeBody,
enableHdMenu: false,
region: 'center',
//height: 160,
title: '押箱业务信息',
loadMask: { msg: "数据加载中,请稍等..." },
trackMouseOver: true,
disableSelection: false,
plugins: [this.cellEditing],
//selModel: //this.cargoCheckBoxModel,
selType: 'cellmodel',
features: [{
ftype: 'summary'//Ext.grid.feature.Summary表格汇总特性
}],
tbar: [
// {
// text: '增加明细',
// tooltip: '增加明细',
// iconCls: "btnadddetail",
// handler: function (button, event) {
// this.onAddCargoClick(button, event);
// },
// },
// scope: this
//}, '-',
{
id:'btndeletedetail',
text: '删除明细',
tooltip: '删除明细',
iconCls: "btndeletedetail",
handler: function (button, event) {
this.onDelDetailClick(button, event);
},
scope: this
}
],
columns: this.column
});
this.column = DsTruck.GetGridPanel(USERID, this.formname, this.column);
//使用者id表名 中间column数组跳过一开始的几列
this.formDetail.reconfigure(this.storeBody, this.column);
//#endregion
//#region 按钮Toolbar
this.panelBtn = new Ext.Panel({
region: "north",
tbar: [
{
id: 'btnESave',
text: "保存",
iconCls: "btnsave",
handler: function (button, event) {
this.Save('0');
},
scope: this
},
{
id: 'btnESaveAndClose',
text: "保存并关闭",
handler: function (button, event) {
this.Save('1');
},
scope: this
},
{
text: "关闭",
handler: function (button, event) {
window.close();
},
scope: this
}
, '-',
{
id: 'btnSubmit',
text: "提交审核",
iconCls: "btnprint",
handler: function (button, event) {
//this.PushState("3000");
this.Submit();
},
scope: this
}, {
id: 'btnSubmitBack',
text: "撤回提交",
iconCls: "btnprint",
handler: function (button, event) {
this.PushState("30011");
},
scope: this
}, {
text: "驳回提交",
iconCls: "btnprint",
handler: function (button, event) {
this.PushState("30011");
},
scope: this
}, {
text: "审核通过",
iconCls: "btnprint",
handler: function (button, event) {
this.PushState("3001");
},
scope: this
}, '-',
{
text: "生成费用",id:"btnMAKEFEE",
handler: function (button, event) {
this.MakeFee();
},
scope: this
}, '-',
{
text: "打印",
iconCls: "btnprint",
handler: function (button, event) {
this.Print();
},
scope: this
}]
}); //end 按钮Toolbar
//#endregion
//#region 框架结构
this.panelmid = new Ext.Panel({
//title: '添加支付结算明细',
//layout: "border",
layout: "column",//列模式
region: "north",
// height: 420,
items: [
this.formZHIFU, this.formSHOUHUI
]
});
Ext.apply(this, {
items: [
this.panelBtn,
this.formEdit,
this.panelmid,
this.formDetail
]
});
//#endregion
parentWin = window.parent.opener;
this.LoadInitData();
this.InitData();
//#region 其他
this.formDetail.on('edit', function (editor, e, eOpts) {
this.AfterEdit(editor, e, eOpts);
}, this);
//#endregion
}, //end initUIComponents
//#region 加载事件
InitData: function () {
this.opStatus = 'add';
var condition = '';
_this = this;
if (parentWin) {
var ret = parentWin.OprationSwap();
this.opStatus = ret[0];
this.StoreList = ret[1];
this.editRecord = ret[2];
if (this.isfen) this.MainEditRecord = ret[3];
}
if (this.opStatus == 'edit') {
condition = "YXNO='" + this.editRecord.get('YXNO') + "'";
//this.storeBodyList.load({ params: { condition: condition} });
}
this.LoadData(this.opStatus, condition);
}, //end InitData
LoadData: function (opstatus, condition) {
this.serialNo = 0;
//this.bodyDel = [];
this.opStatus = opstatus;
if (this.opStatus == 'edit') {
var YXNO = this.editRecord.get('YXNO').toString().trim();
if (YXNO != "") {
document.title = "押箱单号:" + this.editRecord.get('YXNO').toString().trim();
}
} else {
}
Ext.Ajax.request({
waitMsg: '正在查询主表数据...',
url: '/MvcShipping/MsOp_YAXIANG/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;
}
this.Editdata = result.data;
this.formEdit.getForm().reset();
this.formEdit.getForm().setValues(this.Editdata);
this.formZHIFU.getForm().reset();
this.formZHIFU.getForm().setValues(this.Editdata);
this.formSHOUHUI.getForm().reset();
this.formSHOUHUI.getForm().setValues(this.Editdata);
this.GetEditStatus();
var _this = this;
this.storeCustACCOUNT.load({
params: { condition: " LINKID = (select top 1 gid from info_client where shortname='" + this.Editdata.CUSTOMERNAME + "') " }
, callback: function (options, success, response) {
_this.formEdit.getForm().setValues(_this.Editdata);
}
});
//LoadCombox(this.comboxCustACCOUNT, " LINKID = (select top 1 gid from info_client where shortname='" + result.data.CUSTOMERNAME + "') ");
//this.LoadPeriod(this.opStatus);
} else {
Ext.MessageBox.alert('请求出现错误,请重试', response.responseText);
}
},
scope: this
});
this.loadBody(condition);
var billno = '*';
var gid = '*';
this.setEditable();
},
loadBody: function (condition) {
this.storeBody.load({ params: { condition: condition } });
},
setEditable: function () {
var ZF = "";
Ext.Ajax.request({
waitMsg: '正在查询用户权限...',
url: '/CommMng/BasicDataRef/GetAuthorityRange',
params: {
modName: "modYAXIANG_ZF",
USERID: USERID
},
async: false,
callback: function (options, success, response) {
if (success) {
var result = Ext.JSON.decode(response.responseText);
ZF = result.data;
}
else
Ext.MessageBox.alert('请求出现错误,请重试', response.responseText);
},
scope: this
}); //request over
var SH = "";
Ext.Ajax.request({
waitMsg: '正在查询用户权限...',
url: '/CommMng/BasicDataRef/GetAuthorityRange',
params: {
modName: "modYAXIANG_SH",
USERID: USERID
},
async: false,
callback: function (options, success, response) {
if (success) {
var result = Ext.JSON.decode(response.responseText);
SH = result.data;
}
else
Ext.MessageBox.alert('请求出现错误,请重试', response.responseText);
},
scope: this
}); //request over
if (isNullorEmpty(ZF.OPERATERANGE))
this.setZF(false);
else {
if (ZF.OPERATERANGE == "0") {
this.setZF(true);
} else this.setZF(false);
}
if (isNullorEmpty(SH.OPERATERANGE))
this.setSH(false);
{
if (SH.OPERATERANGE == "0") {
this.setSH(true);
} else this.setSH(false);
}
},
setZF: function (enable) {
//设置支付部分的控件readonly
var ZFForm = this.formZHIFU;
ZFForm.items.each(function (item, index, length) {
item.items.each(function (item, index, length) {
item.setDisabled(!enable);
});
});
},
setSH: function (enable) {
var SHForm = this.formSHOUHUI;
SHForm.items.each(function (item, index, length) {
item.items.each(function (item, index, length) {
item.setDisabled(!enable);
});
});
},
// end LoadDate
//#endregion
LoadInitData: function () {
this.storeCustCode.load({ params: { condition: "" } });
this.StoreStlMode.load({ params: { condition: "" } });
this.StoreStlMode2.load({ params: { condition: "" } });
this.StoreBANK.load({ params: { condition: "" } });
this.StoreBANK2.load({ params: { condition: "" } });
},
//#region 保存/删除
Save: function (type) {
var Form1 = this.formEdit.getForm();
var Form2 = this.formZHIFU.getForm();
var Form3 = this.formSHOUHUI.getForm();
if (!Form1.isValid() || !Form2.isValid() || !Form3.isValid()) {
return;
}
this.setZF(true);
this.setSH(true);
var data1 = Form1.getValues(false, false, false);
var data2 = Form2.getValues(false, false, false);
var data3 = Form3.getValues(false, false, false);
this.setEditable();
//只有这些字段可能被修改
this.Editdata.CUSTOMERNAME = data1.CUSTOMERNAME;
this.Editdata.YXDATE = data1.YXDATE;
this.Editdata.PATMENTDATE_EX = data1.PATMENTDATE_EX;
this.Editdata.YXMONEY = data1.YXMONEY;
this.Editdata.CUSTOMERBANK = data1.CUSTOMERBANK;
//this.Editdata.YXMONEY = data2.YXMONEY;
this.Editdata.PAYMENTTYPE = data2.PAYMENTTYPE;
this.Editdata.PAYMENTDATE = data2.PAYMENTDATE;
this.Editdata.PAYMENTBANK = data2.PAYMENTBANK;
this.Editdata.PAYMENTREMARK = data2.PAYMENTREMARK;
//this.Editdata.YXMONEY = data3.YXMONEY;
this.Editdata.RETURNTYPE = data3.RETURNTYPE;
this.Editdata.RETURNDATE = data3.RETURNDATE;
this.Editdata.RETURNBANK = data3.RETURNBANK;
this.Editdata.RETURNREMARK = data3.RETURNREMARK;
var Bodydatas = [];
for (var i = 0; i < this.storeBody.getCount(); i += 1) {
var member = this.storeBody.getAt(i);
Bodydatas.push(member);
}
var jsonBody = ConvertRecordsToJson(Bodydatas);
Ext.Msg.wait('正在保存数据, 请稍侯..');
Ext.Ajax.request({
waitMsg: '正在保存数据...',
url: '/MvcShipping/MsOp_YAXIANG/Save',
scope: this,
params: {
opstatus: this.opStatus,
data: Ext.JSON.encode(this.Editdata),
Body: jsonBody
},
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.Editdata = returnData;
this.formEdit.getForm().reset();
this.formEdit.getForm().setValues(this.Editdata);
this.formZHIFU.getForm().reset();
this.formZHIFU.getForm().setValues(this.Editdata);
this.formSHOUHUI.getForm().reset();
this.formSHOUHUI.getForm().setValues(this.Editdata);
if (this.opStatus == 'add') {
//var arrNewRecords = this.StoreList.insert(0, returnData);
//this.editRecord = this.StoreList.getAt(0);
//if (type == '0') {
// this.opStatus = 'edit';
// basicForm2.findField('BSNO').setDisabled(true);
// this.LoadPeriodStatus(this.opStatus);
//} else if (type == '1') {
// window.close();
//} else if (type == '2') {
// this.LoadData('add', '');
//}
//if (type == '0') {
// this.opStatus = 'edit';
// basicForm2.findField('BSNO').setDisabled(true);
//} else if (type == '1') {
// window.close();
//} else if (type == '2') {
// this.LoadData('add', '');
//}
}
else if (this.opStatus == 'edit') {
var editp = Ext.create('YXmb', returnData);
this.editRecord.fields.each(function (field) {
if (field.persist) {
name = field.name;
if (name != 'GID')
this.editRecord.set(name, editp.get(name));
}
}, this);
this.editRecord.commit();
//this.Editdata = result.data;
this.loadBody(" YXNO='" + this.editRecord.get('YXNO').toString().trim()+"'");
//this.LoadInit(data);
this.GetEditStatus();
if (type == '0') {
//this.opStatus = 'edit';
} else if (type == '1') {
window.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
});
}
}
});
}, //end save
MakeFee: function () {
var Form1 = this.formEdit.getForm();
var Form2 = this.formZHIFU.getForm();
var Form3 = this.formSHOUHUI.getForm();
if (!Form1.isValid() || !Form2.isValid() || !Form3.isValid()) {
return;
}
var data1 = Form1.getValues(false, false, false);
var data2 = Form2.getValues(false, false, false);
var data3 = Form3.getValues(false, false, false);
//只有这些字段可能被修改
this.Editdata.CUSTOMERNAME = data1.CUSTOMERNAME;
this.Editdata.YXDATE = data1.YXDATE;
this.Editdata.PATMENTDATE_EX = data1.PATMENTDATE_EX;
this.Editdata.YXMONEY = data1.YXMONEY;
this.Editdata.CUSTOMERBANK = data1.CUSTOMERBANK;
//this.Editdata.YXMONEY = data2.YXMONEY;
this.Editdata.PAYMENTTYPE = data2.PAYMENTTYPE;
this.Editdata.PAYMENTDATE = data2.PAYMENTDATE;
this.Editdata.PAYMENTBANK = data2.PAYMENTBANK;
this.Editdata.PAYMENTREMARK = data2.PAYMENTREMARK;
//this.Editdata.YXMONEY = data3.YXMONEY;
this.Editdata.RETURNTYPE = data3.RETURNTYPE;
this.Editdata.RETURNDATE = data3.RETURNDATE;
this.Editdata.RETURNBANK = data3.RETURNBANK;
this.Editdata.RETURNREMARK = data3.RETURNREMARK;
var Bodydatas = [];
for (var i = 0; i < this.storeBody.getCount(); i += 1) {
var member = this.storeBody.getAt(i);
Bodydatas.push(member);
}
var jsonBody = ConvertRecordsToJsonAll(Bodydatas);
Ext.Msg.wait('正在保存数据, 请稍侯..');
Ext.Ajax.request({
waitMsg: '正在保存数据...',
url: '/MvcShipping/MsOp_YAXIANG/MakeFee',
scope: this,
params: {
Head: Ext.JSON.encode(this.Editdata),
Body: jsonBody
},
callback: function (options, success, response) {
if (success) {
Ext.MessageBox.hide();
var jsonresult = Ext.JSON.decode(response.responseText);
if (jsonresult.Success) {
var returnData = jsonresult.Data;
alert("费用生成成功");
} 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
onDelDetailClick: function (button, event) {
var selectedRecords = this.formDetail.selModel.getSelection();
Ext.MessageBox.confirm('提示', '确定删除记录吗?', function (btn) {
if (btn == 'yes') {
var GIDList = "";
for (var i = 0; i < selectedRecords.length; i++) {
var rec = selectedRecords[i];
if (GIDList != "") {
GIDList += ",";
}
GIDList += "'" + rec.data.GID + "'";
}
Ext.Msg.wait('正在保存数据, 请稍侯..');
Ext.Ajax.request({
waitMsg: '正在保存数据...',
url: '/MvcShipping/MsOp_YAXIANG/DelDetail',
scope: this,
params: {
data: Ext.JSON.encode(this.Editdata),
GID: GIDList
},
callback: function (options, success, response) {
Ext.MessageBox.hide();
var jsonresult = Ext.JSON.decode(response.responseText);
if (jsonresult.Success)
{
var returnData = jsonresult.Data;
this.Editdata = returnData;
this.loadBody("YXNO='" + this.editRecord.get('YXNO') + "'");
var editp = Ext.create('YXmb', returnData);
this.editRecord.fields.each(function (field) {
if (field.persist) {
name = field.name;
if (name != 'GID')
this.editRecord.set(name, editp.get(name));
}
}, this);
this.editRecord.commit();
this.formEdit.getForm().reset();
this.formEdit.getForm().setValues(this.Editdata);
this.formZHIFU.getForm().reset();
this.formZHIFU.getForm().setValues(this.Editdata);
this.formSHOUHUI.getForm().reset();
this.formSHOUHUI.getForm().setValues(this.Editdata);
this.loadBody(" YXNO='" + this.editRecord.get('YXNO').toString().trim() + "'");
} else {
Ext.Msg.show({
title: '请重试',
msg: jsonresult.Message,
icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK
});
}
}
});
}
}, this);
},
//#endregion
//#region 载入初始信息
LoadInit: function (data) {
},
//#endregion
//#region 编辑时按钮等的状态
//根据权限决定能否显示
GetEditStatus: function () {
var canedit = false;
_this = this;
var op = this.Editdata.CREATEUSER;
this.StoreOpRange.load({
params: { optype: "modYAXIANG" },
callback: function (r, options, success) {
if (success) {
if (r.length != 0) {
var records = DsStoreQueryBy(_this.StoreOpRange, 'OPID', op);
if (records.getCount() > 0) {
canedit = true;
}
} else { canedit = false; }
_this.setSaveBtnStatus(canedit);
}
}
});
},
GetStringNum: function (str) {
var num = 0;
if (str == null || str == '') return num;
if (str.length == 0) return num;
var if_find = false;
var str_num = '';
for (var i = 0; i < str.length; i += 1) {
var member = str.substr(i, 1);
if ((member == '0') || (member == '1') || (member == '2') || (member == '3')
|| (member == '4') || (member == '5') || (member == '6') || (member == '7')
|| (member == '8') || (member == '9') || (member == '.') || (member == '-')) {
if (!if_find) {
str_num = str_num + member;
}
} else {
if_find = true;
}
}
return str_num;
},
setSaveBtnStatus: function (enable) {
var btnESave = Ext.getCmp('btnESave');
var btnESaveAndClose = Ext.getCmp('btnESaveAndClose');
var btnSubmit = Ext.getCmp('btnSubmit');
var btnSubmitBack = Ext.getCmp('btnSubmitBack');
var btndeletedetail = Ext.getCmp('btndeletedetail');
var btnMAKEFEE = Ext.getCmp('btnMAKEFEE');
if (enable) {
btnESave.enable();
btnESaveAndClose.enable();
btnSubmit.enable();
btnSubmitBack.enable();
btndeletedetail.enable();
btnMAKEFEE.enable();
} else {
btnESave.disable();
btnESaveAndClose.disable();
btnSubmit.disable();
btnSubmitBack.disable();
btndeletedetail.disable();
btnMAKEFEE.disable();
}
//SR2020032000001 如果状态YXSTATE为
if (this.Editdata.YXSTATE == '3005') {
btnESave.disable();
btnESaveAndClose.disable();
btnSubmit.disable();
btnSubmitBack.disable();
btndeletedetail.disable();
btnMAKEFEE.disable();
}
},
//#endregion
//#region 打印
Print: function () {
var basicForm = this.formEdit.getForm();
var YXNO = basicForm.findField('YXNO').value;
if (YXNO == '*' || YXNO == '') {
Ext.Msg.show({ title: '错误', msg: '单据还没有保存,请保存后再打印', icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK });
return;
}
var printType = 'MSOP_YAXIANG';
var sql1 = "";
var sql2 = "";
var sql3 = "";
var sql4 = "";
var sql5 = "";
var sql6 = "";
Ext.Ajax.request({
waitMsg: '正在查询主表数据...',
url: '/MvcShipping/MsOp_YAXIANG/GetPrintSql',
params: {
printname: "Print1",
YXNOList: "'" + YXNO+"'"
},
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.Editdata = result.data;
//this.LoadInit(data);
sql1 = result.Data.sql1;
sql2 = result.Data.sql2;
PrintComm(printType, sql1, sql2, sql3, sql4, sql5, sql6);
} else {
Ext.MessageBox.alert('请求出现错误,请重试', response.responseText);
}
},
scope: this
});
},
//#endregion
AfterEdit: function (editor, e, eOpts) {
//if (e.value==e.originalValue){return;}
function decimal(str, length) {
var _r = round2(str, length);
return (_r);
}
if (e.field == 'FIXFEE' || e.field == 'WASHFEE' || e.field == 'FWFEE' || e.field == 'OVERFEE' || e.field == 'LATEFEE') {
var FIXFEE = parseFloat(e.record.get('FIXFEE'));
var WASHFEE = parseFloat(e.record.get('WASHFEE'));
var FWFEE = parseFloat(e.record.get('FWFEE'));
var OVERFEE = parseFloat(e.record.get('OVERFEE'));
var LATEFEE = parseFloat(e.record.get('LATEFEE'));
e.record.set('TOTALFEE', FIXFEE + WASHFEE + FWFEE + OVERFEE + LATEFEE);
}
}
, PushState: function (execution) {
var Form1 = this.formEdit.getForm();
var Form2 = this.formZHIFU.getForm();
var Form3 = this.formSHOUHUI.getForm();
if (!Form1.isValid() || !Form2.isValid() || !Form3.isValid()) {
return;
}
var data1 = Form1.getValues(false, false, false);
var data2 = Form2.getValues(false, false, false);
var data3 = Form3.getValues(false, false, false);
//只有这些字段可能被修改
this.Editdata.CUSTOMERNAME = data1.CUSTOMERNAME;
this.Editdata.YXDATE = data1.YXDATE;
this.Editdata.PATMENTDATE_EX = data1.PATMENTDATE_EX;
this.Editdata.YXMONEY = data1.YXMONEY;
this.Editdata.CUSTOMERBANK = data1.CUSTOMERBANK;
//this.Editdata.YXMONEY = data2.YXMONEY;
this.Editdata.PAYMENTTYPE = data2.PAYMENTTYPE;
this.Editdata.PAYMENTDATE = data2.PAYMENTDATE;
this.Editdata.PAYMENTBANK = data2.PAYMENTBANK;
this.Editdata.PAYMENTREMARK = data2.PAYMENTREMARK;
//this.Editdata.YXMONEY = data3.YXMONEY;
this.Editdata.RETURNTYPE = data3.RETURNTYPE;
this.Editdata.RETURNDATE = data3.RETURNDATE;
this.Editdata.RETURNBANK = data3.RETURNBANK;
this.Editdata.RETURNREMARK = data3.RETURNREMARK;
var Head = Ext.JSON.encode(this.Editdata);
Ext.Msg.wait('正在保存数据, 请稍侯..');
Ext.Ajax.request({
waitMsg: '正在保存数据...',
url: '/MvcShipping/MsOp_YAXIANG/PushState',
scope: this,
params: {
data: Head,
Execution: execution
},
callback: function (options, success, response) {
if (success) {
Ext.MessageBox.hide();
var jsonresult = Ext.JSON.decode(response.responseText);
if (jsonresult.Success) {
condition = "YXNO='" + this.editRecord.get('YXNO') + "'";
this.LoadData(this.opStatus, condition);
} 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
});
}
}
});
}
, Submit: function () {
this.Audit('SubmitAudit');
}
, Audit: function (AuditType) {
var Form1 = this.formEdit.getForm();
var Form2 = this.formZHIFU.getForm();
var Form3 = this.formSHOUHUI.getForm();
if (!Form1.isValid() || !Form2.isValid() || !Form3.isValid()) {
return;
}
var data1 = Form1.getValues(false, false, false);
var data2 = Form2.getValues(false, false, false);
var data3 = Form3.getValues(false, false, false);
//只有这些字段可能被修改
this.Editdata.CUSTOMERNAME = data1.CUSTOMERNAME;
this.Editdata.YXDATE = data1.YXDATE;
this.Editdata.PATMENTDATE_EX = data1.PATMENTDATE_EX;
this.Editdata.YXMONEY = data1.YXMONEY;
this.Editdata.CUSTOMERBANK = data1.CUSTOMERBANK;
//this.Editdata.YXMONEY = data2.YXMONEY;
this.Editdata.PAYMENTTYPE = data2.PAYMENTTYPE;
this.Editdata.PAYMENTDATE = data2.PAYMENTDATE;
this.Editdata.PAYMENTBANK = data2.PAYMENTBANK;
this.Editdata.PAYMENTREMARK = data2.PAYMENTREMARK;
//this.Editdata.YXMONEY = data3.YXMONEY;
this.Editdata.RETURNTYPE = data3.RETURNTYPE;
this.Editdata.RETURNDATE = data3.RETURNDATE;
this.Editdata.RETURNBANK = data3.RETURNBANK;
this.Editdata.RETURNREMARK = data3.RETURNREMARK;
var Head = "["+ Ext.JSON.encode(this.Editdata)+"]";
Ext.Msg.wait('正在保存数据, 请稍侯..');
Ext.Ajax.request({
waitMsg: '正在保存数据...',
url: '/MvcShipping/MsOp_YAXIANG/' + AuditType,
scope: this,
params: {
dataList: Head
},
callback: function (options, success, response) {
if (success) {
Ext.MessageBox.hide();
var jsonresult = Ext.JSON.decode(response.responseText);
if (jsonresult.Success) {
condition = "YXNO='" + this.editRecord.get('YXNO') + "'";
this.LoadData(this.opStatus, condition);
} 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
});
}
}
});
}
});