|
|
|
|
///<reference path="../../../../Views/../TruckMng/Scripts/vswd-ext_2.0.2.js" />
|
|
|
|
|
Ext.namespace('DsTruck');
|
|
|
|
|
|
|
|
|
|
DsTruck.MovCtnEdit = function (config) {
|
|
|
|
|
Ext.applyIf(this, config);
|
|
|
|
|
this.initUIComponents();
|
|
|
|
|
window.DsTruck.MovCtnEdit.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.MovCtnEdit, 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.MovCtnDel = [];
|
|
|
|
|
//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": "外部拖箱"}];
|
|
|
|
|
this.storeBodyType = Ext.create('Ext.data.Store', {
|
|
|
|
|
model: 'BodyTypeMd',
|
|
|
|
|
data: BodyTypeData
|
|
|
|
|
});
|
|
|
|
|
this.comboxBodyType = Ext.create('DsExt.ux.RefEnumCombox', {
|
|
|
|
|
fieldLabel: '业务类型',
|
|
|
|
|
forceSelection: true,
|
|
|
|
|
store: this.storeBodyType,
|
|
|
|
|
name: 'BODYTYPE',
|
|
|
|
|
valueField: 'BODYTYPE',
|
|
|
|
|
displayField: 'BODYTYPE_REF',
|
|
|
|
|
readOnly: true
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
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, forceSelection: true,
|
|
|
|
|
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
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
]
|
|
|
|
|
}, //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
|
|
|
|
|
}
|
|
|
|
|
]
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
]
|
|
|
|
|
}
|
|
|
|
|
]
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
//////////////////////////////////
|
|
|
|
|
//明细 <<<< 收支费用明细 >>>>
|
|
|
|
|
//
|
|
|
|
|
/*
|
|
|
|
|
this.storeAccitems = Ext.create('DsExt.ux.RefTableStore', {
|
|
|
|
|
model: 'Accitemsmb',
|
|
|
|
|
proxy: { url: '/CommMng/BasicDataRef/GetAccitems' }
|
|
|
|
|
});
|
|
|
|
|
this.storeAccitems.load({ params: { condition: ""} });
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//数据集
|
|
|
|
|
this.storeMovCtn = Ext.create('Ext.data.Store', {
|
|
|
|
|
model: 'PortMovCtnmb',
|
|
|
|
|
remoteSort: false,
|
|
|
|
|
pruneModifiedRecords: true,
|
|
|
|
|
proxy: {
|
|
|
|
|
type: 'ajax',
|
|
|
|
|
url: '/TruckMng/MsWl_Port/GetMovCtn',
|
|
|
|
|
reader: {
|
|
|
|
|
id: 'GID',
|
|
|
|
|
root: 'data',
|
|
|
|
|
totalProperty: 'totalCount'
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
//表格
|
|
|
|
|
this.cellEditing = Ext.create('Ext.grid.plugin.CellEditing', {
|
|
|
|
|
clicksToEdit: 1
|
|
|
|
|
});
|
|
|
|
|
this.CBModel = Ext.create('Ext.selection.CheckboxModel');
|
|
|
|
|
Ext.grid.RowNumberer = Ext.extend(Ext.grid.RowNumberer, {
|
|
|
|
|
width: 50
|
|
|
|
|
});
|
|
|
|
|
this.formMovCtn = new Ext.grid.GridPanel({
|
|
|
|
|
store: this.storeMovCtn,
|
|
|
|
|
enableHdMenu: false,
|
|
|
|
|
region: 'center',
|
|
|
|
|
title: '集装箱',
|
|
|
|
|
loadMask: { msg: "数据加载中,请稍等..." },
|
|
|
|
|
trackMouseOver: true,
|
|
|
|
|
disableSelection: false,
|
|
|
|
|
features: [{
|
|
|
|
|
ftype: 'summary'//Ext.grid.feature.Summary表格汇总特性
|
|
|
|
|
}],
|
|
|
|
|
plugins: [this.cellEditing],
|
|
|
|
|
selModel: this.CBModel,
|
|
|
|
|
selType: 'cellmodel',
|
|
|
|
|
tbar: [{
|
|
|
|
|
text: '增加明细', id: "add1",
|
|
|
|
|
tooltip: '增加明细',
|
|
|
|
|
iconCls: "btnadddetail",
|
|
|
|
|
handler: function (button, event) {
|
|
|
|
|
this.onAddMovCtnClick(button, event);
|
|
|
|
|
},
|
|
|
|
|
scope: this
|
|
|
|
|
}, '-', {
|
|
|
|
|
text: '删除明细', id: "del1",
|
|
|
|
|
tooltip: '删除明细',
|
|
|
|
|
iconCls: "btndeletedetail",
|
|
|
|
|
handler: function (button, event) {
|
|
|
|
|
this.onDelMovCtnClick(button, event);
|
|
|
|
|
},
|
|
|
|
|
scope: this
|
|
|
|
|
}],
|
|
|
|
|
columns: [
|
|
|
|
|
new Ext.grid.RowNumberer(),
|
|
|
|
|
{
|
|
|
|
|
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, hidden: true,
|
|
|
|
|
dataIndex: 'DRVNAME',
|
|
|
|
|
header: 'DRVNAME'
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
sortable: true,
|
|
|
|
|
dataIndex: 'Mobile',
|
|
|
|
|
header: '电话',
|
|
|
|
|
width: 80,
|
|
|
|
|
editor: {
|
|
|
|
|
xtype: 'textfield', //numberfield textfield
|
|
|
|
|
selectOnFocus: true
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
sortable: true,
|
|
|
|
|
dataIndex: 'TRUCKNO',
|
|
|
|
|
header: '车号',
|
|
|
|
|
width: 80,
|
|
|
|
|
editor: this.comboxTruckNo
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
sortable: true,
|
|
|
|
|
dataIndex: 'Emp',
|
|
|
|
|
header: '空箱',
|
|
|
|
|
width: 50,
|
|
|
|
|
editor: {
|
|
|
|
|
xtype: 'numberfield', //numberfield textfield
|
|
|
|
|
selectOnFocus: true
|
|
|
|
|
},
|
|
|
|
|
summaryType: 'sum',
|
|
|
|
|
summaryRenderer: Ext.util.Format.numberRenderer('00.00')
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
sortable: true,
|
|
|
|
|
dataIndex: 'Single',
|
|
|
|
|
header: '重箱',
|
|
|
|
|
width: 50,
|
|
|
|
|
editor: {
|
|
|
|
|
xtype: 'textfield', //numberfield
|
|
|
|
|
selectOnFocus: true
|
|
|
|
|
},
|
|
|
|
|
summaryType: 'sum',
|
|
|
|
|
summaryRenderer: Ext.util.Format.numberRenderer('00.00')
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
sortable: true,
|
|
|
|
|
dataIndex: 'Double',
|
|
|
|
|
header: '双背',
|
|
|
|
|
width: 50,
|
|
|
|
|
editor: {
|
|
|
|
|
xtype: 'textfield', //numberfield
|
|
|
|
|
selectOnFocus: true
|
|
|
|
|
},
|
|
|
|
|
summaryType: 'sum',
|
|
|
|
|
summaryRenderer: Ext.util.Format.numberRenderer('00.00')
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
sortable: true,
|
|
|
|
|
dataIndex: 'BG',
|
|
|
|
|
header: '大柜',
|
|
|
|
|
width: 50,
|
|
|
|
|
editor: {
|
|
|
|
|
xtype: 'numberfield', //numberfield textfield
|
|
|
|
|
selectOnFocus: true
|
|
|
|
|
},
|
|
|
|
|
summaryType: 'sum',
|
|
|
|
|
summaryRenderer: Ext.util.Format.numberRenderer('00.00')
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
sortable: true,
|
|
|
|
|
dataIndex: 'Mov',
|
|
|
|
|
header: '次数',
|
|
|
|
|
width: 50,
|
|
|
|
|
editor: {
|
|
|
|
|
xtype: 'numberfield', //numberfield textfield
|
|
|
|
|
selectOnFocus: true
|
|
|
|
|
},
|
|
|
|
|
summaryType: 'sum',
|
|
|
|
|
summaryRenderer: Ext.util.Format.numberRenderer('00.00')
|
|
|
|
|
}, /*
|
|
|
|
|
{
|
|
|
|
|
sortable: true,
|
|
|
|
|
dataIndex: 'TEU',
|
|
|
|
|
header: 'TEU',
|
|
|
|
|
width: 50,
|
|
|
|
|
editor: {
|
|
|
|
|
xtype: 'numberfield', //numberfield textfield
|
|
|
|
|
selectOnFocus: true
|
|
|
|
|
}
|
|
|
|
|
},*/
|
|
|
|
|
{
|
|
|
|
|
sortable: true, hidden: true,
|
|
|
|
|
dataIndex: 'AvrOil',
|
|
|
|
|
header: '平均油价',
|
|
|
|
|
width: 80,
|
|
|
|
|
editor: {
|
|
|
|
|
xtype: 'numberfield', //numberfield textfield
|
|
|
|
|
selectOnFocus: true
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
sortable: true, hidden: true,
|
|
|
|
|
dataIndex: 'Factor',
|
|
|
|
|
header: '系数',
|
|
|
|
|
width: 80,
|
|
|
|
|
editor: {
|
|
|
|
|
xtype: 'numberfield', //numberfield textfield
|
|
|
|
|
selectOnFocus: true
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
sortable: true, hidden: true,
|
|
|
|
|
dataIndex: 'Plus',
|
|
|
|
|
header: '尾数',
|
|
|
|
|
width: 80,
|
|
|
|
|
editor: {
|
|
|
|
|
xtype: 'numberfield', //numberfield textfield
|
|
|
|
|
selectOnFocus: true
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
sortable: true,
|
|
|
|
|
dataIndex: 'Amount_1',
|
|
|
|
|
header: '应收(结算)',
|
|
|
|
|
width: 80,
|
|
|
|
|
editor: {
|
|
|
|
|
xtype: 'numberfield', //numberfield textfield
|
|
|
|
|
selectOnFocus: true
|
|
|
|
|
},
|
|
|
|
|
summaryType: 'sum',
|
|
|
|
|
summaryRenderer: Ext.util.Format.numberRenderer('00.00')
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
sortable: true,
|
|
|
|
|
dataIndex: 'Amount_2',
|
|
|
|
|
header: '应付(核算)',
|
|
|
|
|
width: 80,
|
|
|
|
|
editor: {
|
|
|
|
|
xtype: 'numberfield', //numberfield textfield
|
|
|
|
|
selectOnFocus: true
|
|
|
|
|
},
|
|
|
|
|
summaryType: 'sum',
|
|
|
|
|
summaryRenderer: Ext.util.Format.numberRenderer('00.00')
|
|
|
|
|
}]
|
|
|
|
|
});
|
|
|
|
|
//////////////////////////////////////////////明细<<<< 集装箱信息 >>>>结束
|
|
|
|
|
|
|
|
|
|
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.panelMovCtn = new Ext.Panel({
|
|
|
|
|
layout: "border",
|
|
|
|
|
region: 'center',
|
|
|
|
|
margin: '1 1',
|
|
|
|
|
height: 230,
|
|
|
|
|
split: true,
|
|
|
|
|
items: [this.formEdit, this.formMovCtn]
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Ext.apply(this, {
|
|
|
|
|
items: [this.panelTop, this.panelMovCtn]
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
parentWin = window.parent.opener;
|
|
|
|
|
this.InitData();
|
|
|
|
|
|
|
|
|
|
//集中绑定事件
|
|
|
|
|
|
|
|
|
|
this.formMovCtn.on('edit', function (editor, e, eOpts) {
|
|
|
|
|
this.MovCtnAfterEdit(editor, e, eOpts);
|
|
|
|
|
}, this);
|
|
|
|
|
|
|
|
|
|
this.cellEditing.on('beforeedit', function (editor, e) {
|
|
|
|
|
//Ext.getCmp("zongshu").setText("1234");
|
|
|
|
|
return this.MovCtnBeforeEdit(editor, e);
|
|
|
|
|
}, this);
|
|
|
|
|
|
|
|
|
|
}, //end initUIComponents
|
|
|
|
|
|
|
|
|
|
parentfunction: function (button, event) {
|
|
|
|
|
var ret1 = window.parent.opener.OprationSwap();
|
|
|
|
|
// alert(this.First);
|
|
|
|
|
ret1[3]();
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
onAddMovCtnClick: function (button, event, type) {
|
|
|
|
|
//var allow = this.getAllowOperationDetail();
|
|
|
|
|
//if (allow == false) {
|
|
|
|
|
// return;
|
|
|
|
|
//}
|
|
|
|
|
|
|
|
|
|
var store = null;
|
|
|
|
|
|
|
|
|
|
store = this.storeMovCtn;
|
|
|
|
|
|
|
|
|
|
//var newSerialno = this.GetHandleSerialNo(store, type);
|
|
|
|
|
|
|
|
|
|
var record = null;
|
|
|
|
|
|
|
|
|
|
record = Ext.create('PortMovCtnmb', {
|
|
|
|
|
GID: newGuid(),
|
|
|
|
|
LINKID: "",
|
|
|
|
|
DRVCODE: "",
|
|
|
|
|
DRVNAME: "",
|
|
|
|
|
Mobile: "",
|
|
|
|
|
TRUCKNO: "",
|
|
|
|
|
Emp: "0",
|
|
|
|
|
Single: "0",
|
|
|
|
|
Double: "0",
|
|
|
|
|
BG: "0",
|
|
|
|
|
Mov: "0",
|
|
|
|
|
//TEU: "0",
|
|
|
|
|
//Price_1: "2",
|
|
|
|
|
//Price_2: "1.2",
|
|
|
|
|
AvrOil: "6",
|
|
|
|
|
Factor: "0.7",
|
|
|
|
|
Plus: "11.5",
|
|
|
|
|
Amount_1: "0",
|
|
|
|
|
Amount_2: "0"
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
store.add(record);
|
|
|
|
|
|
|
|
|
|
cellediting = this.cellEditing;
|
|
|
|
|
|
|
|
|
|
var n = store.getCount();
|
|
|
|
|
cellediting.startEditByPosition({ row: n - 1, column: 2 });
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
onDelMovCtnClick: function (button, event) {
|
|
|
|
|
var selectedRecords = this.formMovCtn.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.MovCtnDel.push(rec);
|
|
|
|
|
}
|
|
|
|
|
this.storeMovCtn.remove(selectedRecords[i]);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}, this);
|
|
|
|
|
//aftereditform();
|
|
|
|
|
var Amount_ALL = 0;
|
|
|
|
|
for (var i = 0; i < this.storeMovCtn.getCount(); i += 1) {
|
|
|
|
|
Amount_ALL = Add(Amount_ALL, parseFloat(this.storeMovCtn.getAt(i).get("Amount")));
|
|
|
|
|
}
|
|
|
|
|
Ext.getCmp("AMOUNT_ALL").setValue(Amount_ALL + "");
|
|
|
|
|
},
|
|
|
|
|
MovCtnAfterEdit: 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 == 'Emp' || e.field == 'Single' || e.field == 'Double' || e.field == 'BG') {
|
|
|
|
|
//var TEU = 0;
|
|
|
|
|
var Emp = parseFloat(e.record.get('Emp'));
|
|
|
|
|
|
|
|
|
|
var Single = parseFloat(e.record.get('Single'));
|
|
|
|
|
|
|
|
|
|
var Double = parseFloat(e.record.get('Double'));
|
|
|
|
|
|
|
|
|
|
var BG = parseFloat(e.record.get('BG'));
|
|
|
|
|
|
|
|
|
|
var Mov = Add(Add(Emp, Single), Add(Double, BG));
|
|
|
|
|
|
|
|
|
|
Emp = Mul(Emp, 55);
|
|
|
|
|
Single = Mul(Single, 60);
|
|
|
|
|
Double = Mul(Double, 70);
|
|
|
|
|
BG = Mul(BG, 65);
|
|
|
|
|
|
|
|
|
|
var Amount_1 = Add(Add(Emp, Single), Add(Double, BG));
|
|
|
|
|
var Amount_2 = Mul(Mov, 6);
|
|
|
|
|
//var Mov = Add(Add(_20, _40), _45);
|
|
|
|
|
//e.record.set('TEU', TEU);
|
|
|
|
|
e.record.set('Amount_1', Amount_1);
|
|
|
|
|
e.record.set('Amount_2', Amount_2);
|
|
|
|
|
e.record.set('Mov', Mov);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
},
|
|
|
|
|
MovCtnBeforeEdit: 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 = "MovCtn";
|
|
|
|
|
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.storeMovCtn.load({ params: { GID: GID} });
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}, // end LoadDate
|
|
|
|
|
|
|
|
|
|
Save: function (type) {
|
|
|
|
|
var Amount_1 = 0;
|
|
|
|
|
var Amount_2 = 0;
|
|
|
|
|
for (var i = 0; i < this.storeMovCtn.getCount(); i += 1) {
|
|
|
|
|
Amount_1 = Add(Amount_1, parseFloat(this.storeMovCtn.getAt(i).get("Amount_1")));
|
|
|
|
|
Amount_2 = Add(Amount_2, parseFloat(this.storeMovCtn.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 MovCtns = [];
|
|
|
|
|
for (var i = 0; i < this.storeMovCtn.getCount(); i += 1) {
|
|
|
|
|
var member = this.storeMovCtn.getAt(i);
|
|
|
|
|
MovCtns.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 MovCtn = ConvertRecordsToJson(MovCtns);
|
|
|
|
|
var MovCtnDel = ConvertRecordsToJsonAll(this.MovCtnDel);
|
|
|
|
|
|
|
|
|
|
var _this = this;
|
|
|
|
|
Ext.Msg.wait('正在保存数据, 请稍侯..');
|
|
|
|
|
Ext.Ajax.request({
|
|
|
|
|
waitMsg: '正在保存数据...',
|
|
|
|
|
url: '/TruckMng/MsWl_Port/SaveMovCtn',
|
|
|
|
|
scope: this,
|
|
|
|
|
async: false,
|
|
|
|
|
params: {
|
|
|
|
|
OpStatus: this.OpStatus,
|
|
|
|
|
data: Ext.JSON.encode(data),
|
|
|
|
|
MovCtn: MovCtn,
|
|
|
|
|
MovCtnDel: MovCtnDel
|
|
|
|
|
},
|
|
|
|
|
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.storeMovCtn.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.storeMovCtn.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);
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
|