|
|
///<reference path="../../../../Views/../TruckMng/Scripts/vswd-ext_2.0.2.js" />
|
|
|
Ext.namespace('DsTruck');
|
|
|
|
|
|
DsTruck.GJEdit = function (config) {
|
|
|
Ext.applyIf(this, config);
|
|
|
this.initUIComponents();
|
|
|
window.DsTruck.GJEdit.superclass.constructor.call(this);
|
|
|
};
|
|
|
|
|
|
Date.prototype.format = function (format) {
|
|
|
var o = {
|
|
|
"M+": this.getMonth() + 1, //month
|
|
|
"d+": this.getDate(), //day
|
|
|
"h+": this.getHours(), //hour
|
|
|
"m+": this.getMinutes(), //minute
|
|
|
"s+": this.getSeconds(), //second
|
|
|
"q+": Math.floor((this.getMonth() + 3) / 3), //quarter
|
|
|
"S": this.getMilliseconds() //millisecond
|
|
|
}
|
|
|
if (/(y+)/.test(format)) format = format.replace(RegExp.$1,
|
|
|
(this.getFullYear() + "").substr(4 - RegExp.$1.length));
|
|
|
for (var k in o) if (new RegExp("(" + k + ")").test(format))
|
|
|
format = format.replace(RegExp.$1,
|
|
|
RegExp.$1.length == 1 ? o[k] :
|
|
|
("00" + o[k]).substr(("" + o[k]).length));
|
|
|
return format;
|
|
|
}
|
|
|
|
|
|
var xhr = new XMLHttpRequest();
|
|
|
var currdate = new Date();
|
|
|
if (!xhr) {
|
|
|
//...其他生成xmlhttprequest方法
|
|
|
}
|
|
|
xhr.open("HEAD", location.href, true);
|
|
|
xhr.onreadystatechange = function () {
|
|
|
if (xhr.readyState == 4 && xhr.status == 200) {
|
|
|
var datestr = xhr.getResponseHeader("Date");
|
|
|
currdate = new Date(datestr);
|
|
|
// alert(currdate.format('yyyy-MM-dd'));
|
|
|
}
|
|
|
}
|
|
|
xhr.send(null);
|
|
|
|
|
|
function getSaved() {
|
|
|
var feedirty = DsTruck.GetDirty(panelEdit.storeBodyChfee, panelEdit.storeBodyChfeeDel);
|
|
|
|
|
|
if (panelEdit.formEdit.getForm().isDirty()== true )
|
|
|
{
|
|
|
return true;
|
|
|
}
|
|
|
else return false;
|
|
|
}
|
|
|
|
|
|
Ext.extend(DsTruck.GJEdit, Ext.Panel, {
|
|
|
parentWin: null,
|
|
|
OpStatus: 'add',
|
|
|
StoreList: null,
|
|
|
editRecord: null,
|
|
|
BXSTATUS: 1,
|
|
|
// parentfunction: null,
|
|
|
_First: true,
|
|
|
VISIBLERANGE: 0,
|
|
|
OPERATERANGE: 0,
|
|
|
WorkFlowName: "",
|
|
|
WorkFlowID: "",
|
|
|
initUIComponents: function () {
|
|
|
//this.feeSerialNo = 0;
|
|
|
this.GJDel = [];
|
|
|
//this.PayBodyDel = [];
|
|
|
|
|
|
//枚举参照相关(编辑form)
|
|
|
WorkFlowName = 'BaoxiaoMod';
|
|
|
|
|
|
Ext.define('BodyTypeMd', {
|
|
|
extend: 'Ext.data.Model',
|
|
|
fields: [
|
|
|
{ name: 'BODYTYPE', type: 'string' },
|
|
|
{ name: 'BODYTYPE_REF', type: 'string' }
|
|
|
]
|
|
|
});
|
|
|
var BodyTypeData = [{ "BODYTYPE": "Ctn", "BODYTYPE_REF": "集装箱" },
|
|
|
{ "BODYTYPE": "Other", "BODYTYPE_REF": "杂项" },
|
|
|
{ "BODYTYPE": "RO", "BODYTYPE_REF": "滚装" },
|
|
|
{ "BODYTYPE": "MovCtn", "BODYTYPE_REF": "外部拖箱" },
|
|
|
{ "BODYTYPE": "GJ", "BODYTYPE_REF": "国检"}];
|
|
|
this.storeBodyType = Ext.create('Ext.data.Store', {
|
|
|
model: 'BodyTypeMd',
|
|
|
data: BodyTypeData
|
|
|
});
|
|
|
this.comboxBodyType = Ext.create('DsExt.ux.RefEnumCombox', {
|
|
|
fieldLabel: '业务类型', readOnly: true,
|
|
|
forceSelection: true,
|
|
|
store: this.storeBodyType,
|
|
|
name: 'BODYTYPE',
|
|
|
valueField: 'BODYTYPE',
|
|
|
displayField: 'BODYTYPE_REF',
|
|
|
values: "GJ"
|
|
|
});
|
|
|
|
|
|
this.storeTruckNo = Ext.create('DsExt.ux.RefTableStore', {
|
|
|
model: 'MsWlBsHeadRefMsWlTruck',
|
|
|
proxy: { url: '/TruckMng/MsWlPc/GetTruckNoList' }
|
|
|
});
|
|
|
this.storeTruckNo.load({ params: { condition: ""} });
|
|
|
|
|
|
this.comboxTruckNo = Ext.create('DsExt.ux.RefTableCombox', {
|
|
|
//fieldLabel: '车牌号',
|
|
|
store: this.storeTruckNo,
|
|
|
name: 'TRUCKNO',
|
|
|
valueField: 'TruckNo',
|
|
|
displayField: 'TruckNo',
|
|
|
listeners: {
|
|
|
change: function (field, newValue, oldValue) {
|
|
|
//this.tonAndTruckNoChange(field, newValue, oldValue);
|
|
|
},
|
|
|
scope: this
|
|
|
}
|
|
|
});
|
|
|
|
|
|
this.storeDrvName = Ext.create('DsExt.ux.RefTableStore', {
|
|
|
model: 'MsWlBsHeadRefMsWlDriver',
|
|
|
proxy: { url: '/TruckMng/MsWlPc/GetDrvNameList' }
|
|
|
});
|
|
|
this.storeDrvName.load({ params: { condition: ""} });
|
|
|
|
|
|
this.comboxDrvName = Ext.create('DsExt.ux.RefTableCombox', {
|
|
|
//fieldLabel: '司机',
|
|
|
store: this.storeDrvName,
|
|
|
name: 'DRVCODE',
|
|
|
valueField: 'DrvCode',
|
|
|
displayField: 'CodeAndName',
|
|
|
listeners: {
|
|
|
scope: this,
|
|
|
'select': function (combo, records, eOpts) {
|
|
|
if (records.length > 0) {
|
|
|
//this.setDrvName(records[0].data.DrvCode);
|
|
|
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
});
|
|
|
|
|
|
|
|
|
//////////////////
|
|
|
|
|
|
//编辑form:formEdit
|
|
|
this.formEdit = Ext.widget('form', {
|
|
|
// layout: "border",
|
|
|
region: 'north',
|
|
|
frame: true,
|
|
|
bodyPadding: 1,
|
|
|
trackResetOnLoad: true,
|
|
|
fieldDefaults: {
|
|
|
margins: '1 1 1 1',
|
|
|
labelAlign: 'right',
|
|
|
flex: 1,
|
|
|
labelWidth: 90,
|
|
|
msgTarget: 'qtip'
|
|
|
//,split:true
|
|
|
},
|
|
|
//bodyStyle: 'background:#FFF',
|
|
|
|
|
|
items: [
|
|
|
{//fieldset 1
|
|
|
xtype: 'fieldset',
|
|
|
defaultType: 'textfield',
|
|
|
layout: 'anchor',
|
|
|
defaults: {
|
|
|
anchor: '100%'
|
|
|
},
|
|
|
items: [{//container_1
|
|
|
xtype: 'container',
|
|
|
layout: 'hbox',
|
|
|
defaultType: 'textfield',
|
|
|
items: [{
|
|
|
fieldLabel: '业务序列号',
|
|
|
// allowBlank: false,
|
|
|
//disabled: true,
|
|
|
name: 'GID'
|
|
|
}, this.comboxBodyType,
|
|
|
{
|
|
|
fieldLabel: '制单时间',
|
|
|
format: 'Y-m-d', id: "EXPDATE",
|
|
|
xtype: 'datefield',
|
|
|
renderer: Ext.util.Format.dateRenderer('Y-m-d'),
|
|
|
name: 'EXPDATE'
|
|
|
}, {
|
|
|
xtype: 'hiddenfield',
|
|
|
flex: 1
|
|
|
}
|
|
|
//this.comboxFEENAME,
|
|
|
/*{
|
|
|
fieldLabel: '时间戳',
|
|
|
name: 'TimeMark', flex: 0, hidden: true, margins: '0'
|
|
|
}*/
|
|
|
]
|
|
|
}, //container_1 end
|
|
|
{
|
|
|
xtype: 'container',
|
|
|
layout: 'hbox',
|
|
|
defaultType: 'textfield',
|
|
|
items: [{
|
|
|
fieldLabel: '会计月份',
|
|
|
// allowBlank: false,
|
|
|
//disabled: true,
|
|
|
name: 'ACCDATE'
|
|
|
}, {
|
|
|
fieldLabel: '应收',
|
|
|
name: 'Amount_1', id: "Amount_1",
|
|
|
flex: 1
|
|
|
}, {
|
|
|
fieldLabel: '应付',
|
|
|
name: 'Amount_2', id: "Amount_2",
|
|
|
flex: 1
|
|
|
}/*, {
|
|
|
xtype: 'hiddenfield',
|
|
|
flex: 1
|
|
|
}*/, {
|
|
|
fieldLabel: '时间戳',
|
|
|
name: 'TimeMark', flex: 1, hidden: true, margins: '0'
|
|
|
}, {
|
|
|
xtype: 'checkbox', flex: 1,
|
|
|
fieldLabel: '业务锁定',
|
|
|
name: 'Locked', readOnly: true
|
|
|
}
|
|
|
]
|
|
|
},
|
|
|
{
|
|
|
xtype: 'container',
|
|
|
layout: 'hbox',
|
|
|
defaultType: 'textfield',
|
|
|
items: [{
|
|
|
fieldLabel: '备注',
|
|
|
name: 'REMARK',
|
|
|
flex: 2
|
|
|
}
|
|
|
]
|
|
|
}
|
|
|
|
|
|
]
|
|
|
}
|
|
|
]
|
|
|
});
|
|
|
|
|
|
//////////////////////////////////
|
|
|
//明细
|
|
|
//
|
|
|
Ext.define('BuzTypemd', {
|
|
|
extend: 'Ext.data.Model',
|
|
|
fields: [
|
|
|
{ name: 'BuzType', type: 'string' },
|
|
|
{ name: 'BuzPrice', type: 'string' }
|
|
|
]
|
|
|
});
|
|
|
var BuzTypeData = [{ "BuzType": "倒箱", "BuzPrice": "50" },
|
|
|
{ "BuzType": "熏蒸", "BuzPrice": "70" },
|
|
|
{ "BuzType": "普通", "BuzPrice": "90"}];
|
|
|
this.storeBuzType = Ext.create('Ext.data.Store', {
|
|
|
model: 'BuzTypemd',
|
|
|
data: BuzTypeData
|
|
|
});
|
|
|
this.comboxBuzType = Ext.create('DsExt.ux.RefEnumCombox', {
|
|
|
//fieldLabel: '业务类型',
|
|
|
forceSelection: true,
|
|
|
store: this.storeBuzType,
|
|
|
name: 'GJTYPE',
|
|
|
valueField: 'BuzType',
|
|
|
displayField: 'BuzType'
|
|
|
});
|
|
|
|
|
|
|
|
|
//数据集
|
|
|
this.storeGJ = Ext.create('Ext.data.Store', {
|
|
|
model: 'PortGJmb',
|
|
|
remoteSort: false,
|
|
|
pruneModifiedRecords: true,
|
|
|
proxy: {
|
|
|
type: 'ajax',
|
|
|
url: '/TruckMng/MsWl_Port/GetGJ',
|
|
|
reader: {
|
|
|
id: 'GID',
|
|
|
root: 'data',
|
|
|
totalProperty: 'totalCount'
|
|
|
}
|
|
|
}
|
|
|
});
|
|
|
//表格
|
|
|
this.cellEditing = Ext.create('Ext.grid.plugin.CellEditing', {
|
|
|
clicksToEdit: 1
|
|
|
});
|
|
|
this.CBModel = Ext.create('Ext.selection.CheckboxModel');
|
|
|
|
|
|
this.formGJ = new Ext.grid.GridPanel({
|
|
|
store: this.storeGJ,
|
|
|
enableHdMenu: false,
|
|
|
region: 'center',
|
|
|
title: '集装箱',
|
|
|
loadMask: { msg: "数据加载中,请稍等..." },
|
|
|
trackMouseOver: true,
|
|
|
disableSelection: false,
|
|
|
plugins: [this.cellEditing],
|
|
|
selModel: this.CBModel,
|
|
|
selType: 'cellmodel',
|
|
|
tbar: [{
|
|
|
text: '增加明细', id: "add1",
|
|
|
tooltip: '增加明细',
|
|
|
iconCls: "btnadddetail",
|
|
|
handler: function (button, event) {
|
|
|
this.onAddGJClick(button, event);
|
|
|
},
|
|
|
scope: this
|
|
|
}, '-', {
|
|
|
text: '删除明细', id: "del1",
|
|
|
tooltip: '删除明细',
|
|
|
iconCls: "btndeletedetail",
|
|
|
handler: function (button, event) {
|
|
|
this.onDelGJClick(button, event);
|
|
|
},
|
|
|
scope: this
|
|
|
}],
|
|
|
columns: [
|
|
|
{
|
|
|
sortable: true, hidden: true,
|
|
|
dataIndex: 'GID',
|
|
|
header: 'GID',
|
|
|
width: 80
|
|
|
},
|
|
|
{
|
|
|
sortable: true, hidden: true,
|
|
|
dataIndex: 'LINKID',
|
|
|
header: 'LINKID',
|
|
|
width: 80
|
|
|
},
|
|
|
{
|
|
|
sortable: true,
|
|
|
dataIndex: 'DRVCODE',
|
|
|
header: '驾驶员姓名',
|
|
|
width: 80,
|
|
|
renderer: function (value, p, record) {
|
|
|
if (value == null || value == '') return '';
|
|
|
else return record.data.DRVNAME;
|
|
|
},
|
|
|
width: 80,
|
|
|
editor: this.comboxDrvName
|
|
|
},
|
|
|
{
|
|
|
sortable: true,
|
|
|
dataIndex: 'TRUCKNO',
|
|
|
header: '车号',
|
|
|
width: 80,
|
|
|
editor: this.comboxTruckNo
|
|
|
},
|
|
|
{
|
|
|
sortable: true,
|
|
|
dataIndex: 'Mobile',
|
|
|
header: '手机号',
|
|
|
width: 80
|
|
|
}, {
|
|
|
text: '倒 箱',
|
|
|
columns: [{
|
|
|
sortable: true,
|
|
|
dataIndex: 'DX',
|
|
|
header: '次数',
|
|
|
width: 45,
|
|
|
editor: {
|
|
|
xtype: 'numberfield', //numberfield textfield
|
|
|
selectOnFocus: true
|
|
|
}
|
|
|
},
|
|
|
{
|
|
|
sortable: true,
|
|
|
dataIndex: 'DX_Price_1',
|
|
|
header: '收费费率',
|
|
|
width: 60,
|
|
|
editor: {
|
|
|
xtype: 'numberfield', //numberfield textfield
|
|
|
selectOnFocus: true
|
|
|
}
|
|
|
},
|
|
|
{
|
|
|
sortable: true,
|
|
|
dataIndex: 'DX_Price_2',
|
|
|
header: '付费费率',
|
|
|
width: 60,
|
|
|
editor: {
|
|
|
xtype: 'numberfield', //numberfield textfield
|
|
|
selectOnFocus: true
|
|
|
}
|
|
|
}]
|
|
|
}, {
|
|
|
text: '熏 蒸',
|
|
|
columns: [{
|
|
|
sortable: true,
|
|
|
dataIndex: 'XZ',
|
|
|
header: '次数',
|
|
|
width: 45,
|
|
|
editor: {
|
|
|
xtype: 'numberfield', //numberfield textfield
|
|
|
selectOnFocus: true
|
|
|
}
|
|
|
},
|
|
|
{
|
|
|
sortable: true,
|
|
|
dataIndex: 'XZ_Price_1',
|
|
|
header: '收费费率',
|
|
|
width: 60,
|
|
|
editor: {
|
|
|
xtype: 'numberfield', //numberfield textfield
|
|
|
selectOnFocus: true
|
|
|
}
|
|
|
},
|
|
|
{
|
|
|
sortable: true,
|
|
|
dataIndex: 'XZ_Price_2',
|
|
|
header: '付费费率',
|
|
|
width: 60,
|
|
|
editor: {
|
|
|
xtype: 'numberfield', //numberfield textfield
|
|
|
selectOnFocus: true
|
|
|
}
|
|
|
}]
|
|
|
}, {
|
|
|
text: '普 通',
|
|
|
columns: [{
|
|
|
sortable: true,
|
|
|
dataIndex: 'PT',
|
|
|
header: '次数',
|
|
|
width: 45,
|
|
|
editor: {
|
|
|
xtype: 'numberfield', //numberfield textfield
|
|
|
selectOnFocus: true
|
|
|
}
|
|
|
},
|
|
|
{
|
|
|
sortable: true,
|
|
|
dataIndex: 'PT_Price_1',
|
|
|
header: '收费费率',
|
|
|
width: 60,
|
|
|
editor: {
|
|
|
xtype: 'numberfield', //numberfield textfield
|
|
|
selectOnFocus: true
|
|
|
}
|
|
|
},
|
|
|
{
|
|
|
sortable: true,
|
|
|
dataIndex: 'PT_Price_2',
|
|
|
header: '付费费率',
|
|
|
width: 60,
|
|
|
editor: {
|
|
|
xtype: 'numberfield', //numberfield textfield
|
|
|
selectOnFocus: true
|
|
|
}
|
|
|
}]
|
|
|
},
|
|
|
{
|
|
|
sortable: true,
|
|
|
dataIndex: 'Amount_1',
|
|
|
header: '收费(结算)',
|
|
|
width: 80,
|
|
|
editor: {
|
|
|
xtype: 'numberfield', //numberfield textfield
|
|
|
selectOnFocus: true
|
|
|
}
|
|
|
},
|
|
|
{
|
|
|
sortable: true,
|
|
|
dataIndex: 'Amount_2',
|
|
|
header: '付费(核算)',
|
|
|
width: 80,
|
|
|
editor: {
|
|
|
xtype: 'numberfield', //numberfield textfield
|
|
|
selectOnFocus: true
|
|
|
}
|
|
|
},
|
|
|
{
|
|
|
sortable: true, hidden: true,
|
|
|
dataIndex: 'DRVNAME',
|
|
|
header: 'DRVNAME',
|
|
|
width: 80
|
|
|
}]
|
|
|
});
|
|
|
//////////////////////////////////////////////明细<<<< 集装箱信息 >>>>结束
|
|
|
|
|
|
this.panelBtn = new Ext.Panel({
|
|
|
region: "north",
|
|
|
tbar: [
|
|
|
{
|
|
|
// id: "saveandclose",
|
|
|
text: "保存",
|
|
|
iconCls: "btnsave",
|
|
|
handler: function (button, event) {
|
|
|
this.Save('0');
|
|
|
},
|
|
|
scope: this
|
|
|
}, {
|
|
|
// id: "saveandclose",
|
|
|
text: "保存并关闭",
|
|
|
handler: function (button, event) {
|
|
|
this.Save('1');
|
|
|
},
|
|
|
scope: this
|
|
|
}, '-',
|
|
|
{
|
|
|
// id: "saveandclose",
|
|
|
text: "关闭",
|
|
|
handler: function (button, event) {
|
|
|
window.close();
|
|
|
},
|
|
|
scope: this
|
|
|
}
|
|
|
]
|
|
|
}); //end 按钮Toolbar
|
|
|
|
|
|
//布局
|
|
|
this.panelTop = new Ext.Panel({
|
|
|
layout: "border",
|
|
|
region: "north",
|
|
|
height: 30,
|
|
|
items: [this.panelBtn]
|
|
|
});
|
|
|
|
|
|
this.panelGJ = new Ext.Panel({
|
|
|
layout: "border",
|
|
|
region: 'center',
|
|
|
margin: '1 1',
|
|
|
height: 230,
|
|
|
split: true,
|
|
|
items: [this.formEdit, this.formGJ]
|
|
|
});
|
|
|
|
|
|
|
|
|
Ext.apply(this, {
|
|
|
items: [this.panelTop, this.panelGJ]
|
|
|
});
|
|
|
|
|
|
|
|
|
parentWin = window.parent.opener;
|
|
|
this.InitData();
|
|
|
|
|
|
//集中绑定事件
|
|
|
|
|
|
this.formGJ.on('edit', function (editor, e, eOpts) {
|
|
|
this.GJAfterEdit(editor, e, eOpts);
|
|
|
}, this);
|
|
|
|
|
|
this.cellEditing.on('beforeedit', function (editor, e) {
|
|
|
//Ext.getCmp("zongshu").setText("1234");
|
|
|
return this.GJBeforeEdit(editor, e);
|
|
|
}, this);
|
|
|
|
|
|
}, //end initUIComponents
|
|
|
|
|
|
parentfunction: function (button, event) {
|
|
|
var ret1 = window.parent.opener.OprationSwap();
|
|
|
// alert(this.First);
|
|
|
ret1[3]();
|
|
|
},
|
|
|
|
|
|
onAddGJClick: function (button, event, type) {
|
|
|
//var allow = this.getAllowOperationDetail();
|
|
|
//if (allow == false) {
|
|
|
// return;
|
|
|
//}
|
|
|
|
|
|
var store = null;
|
|
|
|
|
|
store = this.storeGJ;
|
|
|
var DX_Price_1 = 0;
|
|
|
var DX_Price_2 = 0;
|
|
|
var XZ_Price_1 = 0;
|
|
|
var XZ_Price_2 = 0;
|
|
|
var PT_Price_1 = 0;
|
|
|
var PT_Price_2 = 0;
|
|
|
|
|
|
if (store.getCount() > 0) {
|
|
|
DX_Price_1 = store.getAt(0).get("DX_Price_1").toString();
|
|
|
DX_Price_2 = store.getAt(0).get("DX_Price_2").toString();
|
|
|
XZ_Price_1 = store.getAt(0).get("XZ_Price_1").toString();
|
|
|
XZ_Price_2 = store.getAt(0).get("XZ_Price_2").toString();
|
|
|
PT_Price_1 = store.getAt(0).get("PT_Price_1").toString();
|
|
|
PT_Price_2 = store.getAt(0).get("PT_Price_2").toString();
|
|
|
}
|
|
|
|
|
|
var record = null;
|
|
|
|
|
|
record = Ext.create('PortGJmb', {
|
|
|
GID: newGuid(),
|
|
|
LINKID: "",
|
|
|
DRVCODE: "",
|
|
|
DRVNAME: "",
|
|
|
Mobile: "",
|
|
|
TRUCKNO: "",
|
|
|
DX: "0",
|
|
|
DX_Price_1: "0",
|
|
|
DX_Price_2: "0",
|
|
|
XZ: "0",
|
|
|
XZ_Price_1: "0",
|
|
|
XZ_Price_2: "0",
|
|
|
PT: "0",
|
|
|
PT_Price_1: "0",
|
|
|
PT_Price_2: "0",
|
|
|
Amount_1: "0",
|
|
|
Amount_2: "0"
|
|
|
});
|
|
|
|
|
|
store.add(record);
|
|
|
|
|
|
cellediting = this.cellEditing;
|
|
|
|
|
|
var n = store.getCount();
|
|
|
cellediting.startEditByPosition({ row: n - 1, column: 2 });
|
|
|
},
|
|
|
|
|
|
onDelGJClick: function (button, event) {
|
|
|
var selectedRecords = this.formGJ.selModel.getSelection();
|
|
|
Ext.MessageBox.confirm('提示', '确定删除记录吗?', function (btn) {
|
|
|
if (btn == 'yes') {
|
|
|
for (var i = 0; i < selectedRecords.length; i++) {
|
|
|
var rec = selectedRecords[i];
|
|
|
if (rec.GID != "" || rec.GID != "*") //如果是新增但没有保存的数据,没有必要提交到后台
|
|
|
{
|
|
|
this.GJDel.push(rec);
|
|
|
}
|
|
|
this.storeGJ.remove(selectedRecords[i]);
|
|
|
}
|
|
|
}
|
|
|
}, this);
|
|
|
//aftereditform();
|
|
|
var Amount_ALL = 0;
|
|
|
for (var i = 0; i < this.storeGJ.getCount(); i += 1) {
|
|
|
Amount_ALL = Add(Amount_ALL, parseFloat(this.storeGJ.getAt(i).get("Amount")));
|
|
|
}
|
|
|
Ext.getCmp("AMOUNT_ALL").setValue(Amount_ALL + "");
|
|
|
},
|
|
|
GJAfterEdit: function (editor, e, eOpts) {
|
|
|
//需要自己实现里面的事件
|
|
|
if (COMPANYID == "") {
|
|
|
alert("登录信息不全,请退出重新登录");
|
|
|
returen;
|
|
|
}
|
|
|
|
|
|
if (e.field == 'DRVCODE') {
|
|
|
var BSrecords = DsStoreQueryBy(this.storeDrvName, 'DrvCode', e.value);
|
|
|
if (BSrecords.getCount() > 0) {
|
|
|
|
|
|
var BSdata = BSrecords.getAt(0).data;
|
|
|
e.record.set('DRVNAME', BSdata.DrvName);
|
|
|
e.record.set('Mobile', BSdata.Mobile);
|
|
|
} else {
|
|
|
e.record.set('DRVNAME', '');
|
|
|
}
|
|
|
}
|
|
|
|
|
|
if (e.field == 'DX' || e.field == 'DX_Price_1' || e.field == 'DX_Price_2'
|
|
|
|| e.field == 'XZ' || e.field == 'XZ_Price_1' || e.field == 'XZ_Price_2'
|
|
|
|| e.field == 'PT' || e.field == 'PT_Price_1' || e.field == 'PT_Price_2') {
|
|
|
var Amount_1 = 0;
|
|
|
var Amount_2 = 0;
|
|
|
Amount_1 = Mul(parseFloat(e.record.get('DX')), parseFloat(e.record.get('DX_Price_1')));
|
|
|
Amount_1 = Amount_1 + Mul(parseFloat(e.record.get('XZ')), parseFloat(e.record.get('XZ_Price_1')));
|
|
|
Amount_1 = Amount_1 + Mul(parseFloat(e.record.get('PT')), parseFloat(e.record.get('PT_Price_1')));
|
|
|
Amount_2 = Mul(parseFloat(e.record.get('DX')), parseFloat(e.record.get('DX_Price_2')));
|
|
|
Amount_2 = Amount_2 + Mul(parseFloat(e.record.get('XZ')), parseFloat(e.record.get('XZ_Price_2')));
|
|
|
Amount_2 = Amount_2 + Mul(parseFloat(e.record.get('PT')), parseFloat(e.record.get('PT_Price_2')));
|
|
|
e.record.set('Amount_1', Amount_1);
|
|
|
e.record.set('Amount_2', Amount_2);
|
|
|
}
|
|
|
},
|
|
|
GJBeforeEdit: function (editor, e) {
|
|
|
|
|
|
},
|
|
|
InitData: function () {
|
|
|
|
|
|
this.OpStatus = 'add';
|
|
|
var condition = '';
|
|
|
|
|
|
|
|
|
if (parentWin) {
|
|
|
var ret = parentWin.OprationSwap();
|
|
|
this.OpStatus = ret[0];
|
|
|
this.StoreList = ret[1];
|
|
|
this.editRecord = ret[2];
|
|
|
// this.parentfunction = ret[3];
|
|
|
}
|
|
|
|
|
|
if (this.OpStatus == 'edit') {
|
|
|
condition = " P.GID='" + this.editRecord.get('GID') + "'";
|
|
|
}
|
|
|
|
|
|
this.LoadData(this.OpStatus, condition);
|
|
|
|
|
|
|
|
|
//var storeWorkFlowStep = GetWorkFlowStep('')
|
|
|
|
|
|
|
|
|
}, //end InitData
|
|
|
|
|
|
//载入数据
|
|
|
LoadData: function (OpStatus, condition) {
|
|
|
if (COMPANYID == "") {
|
|
|
alert("登录信息不全,请退出重新登录");
|
|
|
return;
|
|
|
}
|
|
|
|
|
|
this.OpStatus = OpStatus;
|
|
|
Ext.Ajax.request({
|
|
|
waitMsg: '正在查询主表数据...',
|
|
|
url: '/TruckMng/MsWl_Port/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;
|
|
|
// this.formEdit.getForm().reset();
|
|
|
if (data.EXPDATE == "") { data.EXPDATE = currdate.format('yyyy-MM-dd') };
|
|
|
data.BODYTYPE = "GJ";
|
|
|
this.formEdit.getForm().setValues(data);
|
|
|
|
|
|
//alert(data.TimeMark);
|
|
|
|
|
|
} else {
|
|
|
Ext.MessageBox.alert('请求出现错误,请重试', response.responseText);
|
|
|
}
|
|
|
},
|
|
|
scope: this
|
|
|
}); //request over
|
|
|
|
|
|
if (this.OpStatus == 'edit') {
|
|
|
|
|
|
//this.formEdit.getForm().findField('BXGID').setDisabled(false);
|
|
|
|
|
|
var GID = this.editRecord.get('GID');
|
|
|
|
|
|
this.storeGJ.load({ params: { GID: GID} });
|
|
|
|
|
|
}
|
|
|
|
|
|
}, // end LoadDate
|
|
|
|
|
|
Save: function (type) {
|
|
|
var Amount_1 = 0;
|
|
|
var Amount_2 = 0;
|
|
|
for (var i = 0; i < this.storeGJ.getCount(); i += 1) {
|
|
|
Amount_1 = Add(Amount_1, parseFloat(this.storeGJ.getAt(i).get("Amount_1")));
|
|
|
Amount_2 = Add(Amount_2, parseFloat(this.storeGJ.getAt(i).get("Amount_2")));
|
|
|
}
|
|
|
Ext.getCmp("Amount_1").setValue(Amount_1 + "");
|
|
|
Ext.getCmp("Amount_2").setValue(Amount_2 + "");
|
|
|
|
|
|
var basicForm = this.formEdit.getForm();
|
|
|
|
|
|
if (!basicForm.isValid()) {
|
|
|
return;
|
|
|
}
|
|
|
|
|
|
|
|
|
var data = this.formEdit.getForm().getValues();
|
|
|
var GID = data.GID;
|
|
|
if (data.Locked == "on") {
|
|
|
alert("请先解除锁定");
|
|
|
return false;
|
|
|
}
|
|
|
data.Locked = this.formEdit.getForm().findField('Locked').getValue() ? 1 : 0;
|
|
|
|
|
|
if (COMPANYID == "") {
|
|
|
alert("登录信息不全,请退出重新登录");
|
|
|
return;
|
|
|
}
|
|
|
|
|
|
var GJs = [];
|
|
|
for (var i = 0; i < this.storeGJ.getCount(); i += 1) {
|
|
|
var member = this.storeGJ.getAt(i);
|
|
|
GJs.push(member);
|
|
|
/*
|
|
|
var Amount = member.data.Amount_1;
|
|
|
|
|
|
if (Amount == 0 || NOTAXAMOUNT == 0) {
|
|
|
Ext.Msg.show({ title: '警告',
|
|
|
msg: '不含税价格和价税合计金额均不允许为0,请修改后再保存',
|
|
|
icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK
|
|
|
});
|
|
|
return;
|
|
|
}*/
|
|
|
}
|
|
|
|
|
|
|
|
|
var GJ = ConvertRecordsToJson(GJs);
|
|
|
var GJDel = ConvertRecordsToJsonAll(this.GJDel);
|
|
|
|
|
|
var _this = this;
|
|
|
Ext.Msg.wait('正在保存数据, 请稍侯..');
|
|
|
Ext.Ajax.request({
|
|
|
waitMsg: '正在保存数据...',
|
|
|
url: '/TruckMng/MsWl_Port/SaveGJ',
|
|
|
scope: this,
|
|
|
async: false,
|
|
|
params: {
|
|
|
OpStatus: this.OpStatus,
|
|
|
data: Ext.JSON.encode(data),
|
|
|
GJ: GJ,
|
|
|
GJDel: GJDel
|
|
|
},
|
|
|
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];
|
|
|
// alert(editRecord.get('ContractNo'));
|
|
|
}
|
|
|
else if (this.OpStatus == 'edit') {
|
|
|
var editp = Ext.create('MsWl_Portmb', returnData);
|
|
|
this.editRecord.fields.each(function (field) {
|
|
|
if (field.persist) {
|
|
|
name = field.name;
|
|
|
//alert(name + ' -- ' + editp.get(name));
|
|
|
if (name != 'GID')
|
|
|
this.editRecord.set(name, editp.get(name));
|
|
|
}
|
|
|
}, this);
|
|
|
this.editRecord.commit();
|
|
|
}
|
|
|
this.storeGJ.commitChanges();
|
|
|
|
|
|
if (type == '0') {
|
|
|
this.OpStatus = 'edit';
|
|
|
//basicForm.findField('Feeid').setDisabled(false);
|
|
|
//this.storeApp.load({ params: { condition: this.editRecord.get('ContractNo')} });
|
|
|
//this.storeCargo.load({ params: { condition: this.editRecord.get('ContractNo')} });
|
|
|
//basicForm.findField('Feeid').setDisabled(true);
|
|
|
var GID = this.editRecord.get('GID');
|
|
|
this.storeGJ.load({ params: { GID: GID} });
|
|
|
} else if (type == '1') {//保存并关闭
|
|
|
|
|
|
window.close();
|
|
|
} else if (type == '2') {//保存并全部新建
|
|
|
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
|
|
|
});
|
|
|
}
|
|
|
//alert('03');
|
|
|
}
|
|
|
});
|
|
|
}
|
|
|
//end save
|
|
|
, DoPrint: function () {
|
|
|
var basicForm = this.formEdit.getForm();
|
|
|
var GID = this.editRecord.get('GID')
|
|
|
/*
|
|
|
if (ContractNo == '*' || ContractNo == '') {
|
|
|
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 needdate = GetDateStr(+5);
|
|
|
var printdate = GetDateStr(0);
|
|
|
var _date = Ext.getCmp("CREATEDATE").getRawValue();
|
|
|
|
|
|
var printType = 'Baoxiao'; //客户对账_KC
|
|
|
//
|
|
|
var sql1 = " select OA_Baoxiao.*,sd.deptname DN ";
|
|
|
var sql1 = sql1 + " from OA_Baoxiao left join [user] U on U.showname=OA_Baoxiao.createuser ";
|
|
|
var sql1 = sql1 + " left join [user_baseinfo] ub on ub.userid=u.gid ";
|
|
|
var sql1 = sql1 + " left join sys_dept sd on sd.gid=OA_Baoxiao.DEPTNAME ";
|
|
|
var sql1 = sql1 + " where BXGID='" + BXGID + "' ";
|
|
|
|
|
|
var sql2 = " select vs.mblno,vs.CUSTNO, c.* from ch_fee c ";
|
|
|
var sql2 = sql2 + " left join vw_settlement vs on vs.bsno=c.bsno ";
|
|
|
var sql2 = sql2 + " where BXGID ='" + BXGID + "' order by c.CHEQUENUM,c.remark";
|
|
|
|
|
|
var sql3 = "select createuser from oa_baoxiao where bxgid ='" + BXGID + "' ";
|
|
|
var sql4 = "select dbo.GetRemain_ZWC ('" + DEPTGID + "','" + _date + "')"; //获取该部门剩余资金
|
|
|
var sql5 = "";
|
|
|
var sql6 = "";
|
|
|
|
|
|
PrintComm(printType, sql1, sql2, sql3, sql4, sql5, sql6);
|
|
|
}
|
|
|
});
|
|
|
|