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/TruckMng/Viewsjs/TMSRPT/TMSRPT_MONTHView.js

2437 lines
85 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('DsTruck');
DsTruck.TMSRPT_MONTHView = function (config) {
Ext.applyIf(this, config);
this.initUIComponents();
window.DsTruck.TMSRPT_MONTHView.superclass.constructor.call(this);
};
var RPTLINKGID = '';
Ext.extend(DsTruck.TMSRPT_MONTHView, Ext.Panel, {
ParentWin: null,
OpStatus: 'add',
StoreList: null,
EditRecord: null,
initUIComponents: function () {
this.serialNo = 0;
this.bodyDel = [];
this.cardDel = [];
this.carduseDel = [];
this.TruckMonthDel = [];
this.CARDGID = "";
this.PageSize = 2000;
this.Pagenum = Ext.create('Ext.form.field.Number', {
name: 'bottles',
fieldLabel: '每页记录数',
labelAlign: 'right',
value: this.PageSize,
maxValue: 10000,
width: 180,
minValue: 0,
listeners: {
specialkey: function (field, e) {
if (e.getKey() == e.ENTER) {
_this.onRefreshClick();
}
}
}
});
//#region 枚举参照相关
this.storeCompany = Ext.create('DsExt.ux.RefTableStore', {
model: 'companymb', proxy: { url: '/CommMng/BasicDataRef/GetcompanyList' }
});
this.storeCompany.load({ params: { condition: "" }
, callback: function (options, success, response) {
if (success) {
var record = Ext.create('companymb', {
'gid': '',
'code': '',
'name': ''
});
_this.storeCompany.add(record);
}
}
});
this.comboxCompany = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: '分公司',
forceSelection: true,
allowBlank: false,
store: this.storeCompany,
name: 'COMPANYID',
valueField: 'gid',
displayField: 'name', flex: 1,
listeners: {
change: function (field, eOpts) {
if (field.lastValue != "") {
//this.storeTruckNo.load({ params: { condition: " ORGCODE=(select CODENAME from company where GID='" + field.lastValue + "') "} });
//this.formEdit.getForm().findField('COMPANYNAME').setValue(field.rawValue);
}
this.Cansearch = false;
},
scope: this
}
});
//表参照相关
this.storeDrvCode = Ext.create('DsExt.ux.RefTableStore', {
model: 'MsWlTruckRefMsWlDriver',
proxy: { url: '/TruckMng/MsWlTruck/GetDrvCodeList' }
});
this.storeDrvCode.load();
this.comboxDrvCode = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: '驾驶员编码',
store: this.storeDrvCode,
name: 'DrvCode',
valueField: 'DrvCode',
displayField: 'CodeAndName'
});
this.storeCustomerNameRef = Ext.create('DsExt.ux.RefTableStore', {
model: 'DsTruckMng.ux.CustomRefModel',
proxy: { url: '/CommMng/BasicDataRef/GetCustomRefList' }
});
this.storeCustomerNameRef.load({ params: { condition: ""} });
this.comboxCustomerNameRef = Ext.create('DsExt.ux.RefTableCombox', {
store: this.storeCustomerNameRef,
fieldLabel: '所有者',
//forceSelection: true,
allowBlank: true,
name: 'OWNER',
valueField: 'GId',
displayField: 'CodeAndName'
});
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
}
});
//#endregion
this.formSearch = Ext.widget('form', {
frame: true,
region: 'north',
height: 50,
bodyPadding: 5,
fieldDefaults: {
margins: '2 2 2 2',
labelAlign: 'right',
flex: 1,
labelWidth: 90,
msgTarget: 'qtip'
},
items: [
{//fieldset 1
xtype: 'container',
defaultType: 'textfield',
layout: 'anchor',
defaults: {
anchor: '100%'
},
items: [
{
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [
{
xtype: 'button',
width: 90,
text: "执行查询",
iconCls: "btnrefresh",
handler: function (button, event) {
this.onRefreshClick(button, event);
},
scope: this
},
this.comboxCompany
, {
fieldLabel: '统计期间',
xtype: 'monthfield',
name: 'ACCDATE'
}, {
fieldLabel: '车牌号',
name: 'TRUCKNO'
}, {
xtype: 'button',
width: 90,
text: "打印",
iconCls: "btnprint",
handler: function (button, event) {
this.Print();
},
scope: this
}
]
}
]//end items(fieldset 1)
}//end fieldset 1
]//end root items
});
//编辑form
this.formEdit = Ext.widget('form', {
region: 'center', hidden: true,
frame: true,
bodyPadding: 5,
fieldDefaults: {
margins: '2 2 2 2',
labelAlign: 'right',
flex: 1,
labelWidth: 100,
msgTarget: 'qtip'
},
items: [
{//fieldset 1
xtype: 'fieldset',
defaultType: 'textfield',
layout: 'anchor',
defaults: {
anchor: '100%'
},
items: [
{
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [{
fieldLabel: 'GID',
name: 'GID', flex: 0, hidden: true, margins: '0'
}, {
fieldLabel: 'TimeMark', values: 0,
name: 'TimeMark', flex: 0, hidden: true, margins: '0'
}
//, this.comboxCompany
, {
sortable: true, hidden: true,
fieldLabel: 'COMPANYNAME',
allowBlank: false,
name: 'COMPANYNAME'
}, {
sortable: true,
xtype: 'monthfield',
format: 'Y-m',
fieldLabel: '统计期间',
allowBlank: false,
name: 'ACCDATE', flex: 1
}, {
fieldLabel: '从..日期',
format: 'Y-m-d',
xtype: 'datefield',
allowBlank: false,
name: 'EXPDATEBGN', flex: 1
}, {
fieldLabel: '到..日期',
format: 'Y-m-d',
xtype: 'datefield',
allowBlank: false,
name: 'EXPDATEEND', flex: 1
}, { xtype: 'hiddenfield', flex: 1 }
]
}
, {
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [{
fieldLabel: '统计燃油价格', flex: 1,
xtype: 'numberfield',
minValue: 0,
name: 'FUELPRICE'
}, {
fieldLabel: '备注', flex: 4,
name: 'REMARK'
}
]
}
]//end items(fieldset 1)
}//end fieldset 1
]//end root items
}); //end this.formEdit
//按钮Toolbar
this.panelBtn = new Ext.Panel({
region: "north",
tbar: [
{
text: "保存",
iconCls: "btnsave",
handler: function (button, event) {
this.Save('0');
},
scope: this
},
{
text: "保存并关闭",
handler: function (button, event) {
this.Save('1');
},
scope: this
},
'-',
{
text: "保存并新建",
handler: function (button, event) {
this.Save('2');
},
scope: this
}, '-', {
text: "生成报表内容",
disabled: true, id: "SCBB",
handler: function (button, event) {
this.StartAudit(button, event);
},
scope: this
}, '-',
{
text: "提交审核",
disabled: true, id: "StartAudit",
handler: function (button, event) {
this.StartAudit(button, event);
},
scope: this
},
{
text: "撤回提交",
disabled: true, id: "ResetAudit",
handler: function (button, event) {
this.ResetAudit(button, event);
},
scope: this
},
{
text: "审核通过", disabled: true,
//iconCls: "btnreset",
id: "Audit",
handler: function (button, event) {
this.Audit(button, event);
},
scope: this
},
{
text: "驳回提交", disabled: true,
//iconCls: "btnreset",
id: "AuditBack",
handler: function (button, event) {
this.AuditBack(button, event);
},
scope: this
},
{
text: "",
iconCls: "btn_wenhao",
id: "SHUOMING",
handler: function (button, event) {
var _readme = "总收入目前来自于指定统计期间的业务当中的所有应收;\n";
_readme = _readme + "折旧费和保险费来自于 安全管理-车辆管理 里面的 车辆月度费用管理 选项卡;\n"
_readme = _readme + "工资奖金、社保费、公积金来自于人工录入;\n"
_readme = _readme + "燃油价格目前为本单内总数据中制单人录入的数值燃油费为该价格x额定油耗\n"
_readme = _readme + "修理费、轮胎费、修理车日来自于<机务管理-维修管理-维修派工>当中记录的该车该统计期间的修理费、轮胎费、修理车日;\n"
_readme = _readme + "行车杂支为:路单下的应付当中除了燃油费、路桥费之外的其他费用;\n"
_readme = _readme + "税金为总路单收入减支出x13%\n"
alert(_readme);
},
scope: this
},
{
text: "打印", hidden: true,
iconCls: 'btnprint',
menu: [
{ text: "全部",
handler: function (menu, event) {
_this.Print();
}
}, { text: "选择打印",
handler: function (menu, event) {
_this.PrintSelect();
}
}],
scope: this
},
{
text: "重新生成数据",
ooltip: '注意,将会将所有数据删除后重新计算,手工填写的数据需要重新填写',
handler: function (button, event) {
this.ReMake(button, event);
},
scope: this
}
]
}); //end 按钮Toolbar
//#region 明细表
//明细表表格相关
this.storeLoadTypeRef = Ext.create('DsExt.ux.RefEnumStore', {});
this.storeLoadTypeRef.load({ params: { enumTypeId: 99030} });
this.comboxLoadTypeRef = Ext.create('DsExt.ux.RefEnumCombox', {
store: this.storeLoadTypeRef,
name: 'LoadType'
});
//#region 明细表 车辆统计
this.storeBodyList = Ext.create('Ext.data.Store', {
model: 'TMSRPT_MONTH_TRUCKDETAILmb',
remoteSort: false,
groupField: 'COMPANYNAME',
proxy: {
type: 'ajax',
url: '/TruckMng/TMSRPT/GetBodyList',
reader: {
id: 'GID',
root: 'data',
totalProperty: 'totalCount'
}
}
});
//明细表表格
//this.gridListCellEditing = Ext.create('Ext.grid.plugin.CellEditing', {
// clicksToEdit: 1
//});
Ext.grid.RowNumberer = Ext.extend(Ext.grid.RowNumberer, {
width: 50
});
this.gridList = new Ext.grid.GridPanel({
store: this.storeBodyList,
enableHdMenu: false,
layout: 'border',
region: 'center',
loadMask: { msg: "数据加载中,请稍等..." },
trackMouseOver: true,
disableSelection: false,
//plugins: [this.gridListCellEditing],
selType: 'cellmodel',
autoScroll: true,
//features: [{
// ftype: 'groupsummary'//Ext.grid.feature.Summary表格汇总特性
//}],
features: [{
id: 'group',
ftype: 'groupingsummary',
groupHeaderTpl: '{name}',
hideGroupedHeader: false,
enableGroupingMenu: true
}],
viewConfig: {
enableTextSelection: true,
autoFill: true
},
/*tbar: [{
text: '增加明细',hidden:true,
tooltip: '增加明细',
iconCls: "btnadddetail",
handler: function (button, event) {
this.onAddDetailClick(button, event);
},
scope: this
}, '-', {
text: '删除明细',
tooltip: '删除明细', hidden: true,
iconCls: "btndeletedetail",
handler: function (button, event) {
this.onDelDetailClick(button, event);
},
scope: this
}],*/
columns: [
new Ext.grid.RowNumberer(),
{
sortable: true, hidden: true,
dataIndex: 'GID',
header: 'GID',
width: 80
},
{
sortable: true, hidden: true,
dataIndex: 'LINKGID',
header: 'LINKGID',
width: 80
},
{
sortable: true, hidden: true,
dataIndex: 'COMPANYID',
header: 'COMPANYID',
width: 80
},
{
sortable: true,
dataIndex: 'COMPANYNAME',
header: '分公司',
width: 80
},
{
sortable: true,
dataIndex: 'ACCDATE',
header: '统计期间',
width: 80
},
{
sortable: true,
dataIndex: 'TRUCKNO',
header: '车号',
width: 95
},
{
sortable: true,
dataIndex: 'LoadCount',
header: '载重量',
width: 80
},
{
sortable: true,
dataIndex: 'TruckSpec',
header: '车型',
width: 80
},
{
text: '运营核算(单位:元)',
columns: [
{
sortable: true,
dataIndex: 'AMOUNT',
header: '单车总收入',
width: 80,
summaryType: 'sum',
summaryRenderer: Ext.util.Format.numberRenderer('00.00')
}, {
text: '固定成本',
columns: [
{
sortable: true,
dataIndex: 'ZJF',
header: '折旧费',
width: 80,
summaryType: 'sum',
summaryRenderer: Ext.util.Format.numberRenderer('00.00')
},
{
sortable: true,
dataIndex: 'BXF',
header: '车辆保险费',
width: 80,
summaryType: 'sum',
summaryRenderer: Ext.util.Format.numberRenderer('00.00')
}]
}, {
text: '变动成本',
columns: [
{
sortable: true,
dataIndex: 'GZJZ',
header: '工资奖金',
width: 80,
summaryType: 'sum',
summaryRenderer: Ext.util.Format.numberRenderer('00.00')
},
{
sortable: true,
dataIndex: 'SBF',
header: '社保费',
width: 80,
summaryType: 'sum',
summaryRenderer: Ext.util.Format.numberRenderer('00.00')
},
{
sortable: true,
dataIndex: 'GJJ',
header: '公积金',
width: 80,
summaryType: 'sum',
summaryRenderer: Ext.util.Format.numberRenderer('00.00')
},
{
sortable: true,
dataIndex: 'FUELPRICE',
header: '燃油价格',
width: 80
},
{
sortable: true,
dataIndex: 'FUELAMOUNT',
header: '燃油费',
width: 80,
summaryType: 'sum',
summaryRenderer: Ext.util.Format.numberRenderer('00.00')
},
{
sortable: true,
dataIndex: 'LQF',
header: '路桥费',
width: 80,
summaryType: 'sum',
summaryRenderer: Ext.util.Format.numberRenderer('00.00')
},
{
sortable: true,
dataIndex: 'REPAIRAMOUNT',
header: '修理费',
width: 80,
summaryType: 'sum',
summaryRenderer: Ext.util.Format.numberRenderer('00.00')
},
{
sortable: true,
dataIndex: 'TYREAMOUNT',
header: '轮胎费',
width: 80,
summaryType: 'sum',
summaryRenderer: Ext.util.Format.numberRenderer('00.00')
},
{
sortable: true,
dataIndex: 'OTHERAMOUNT',
header: '行车杂支',
width: 80,
summaryType: 'sum',
summaryRenderer: Ext.util.Format.numberRenderer('00.00')
},
{
sortable: true,
dataIndex: 'TAX',
header: '税金',
width: 80,
summaryType: 'sum',
summaryRenderer: Ext.util.Format.numberRenderer('00.00')
}]
},
{
sortable: true,
dataIndex: 'TRUCKCOST',
header: '单车成本合计',
width: 80,
summaryType: 'sum',
summaryRenderer: Ext.util.Format.numberRenderer('00.00')
},
{
sortable: true,
dataIndex: 'TRUCKPROFIT_M',
header: '单车毛利润',
width: 80,
summaryType: 'sum',
summaryRenderer: Ext.util.Format.numberRenderer('00.00')
}]
}, {
text: '工作',
columns: [
{
sortable: true,
dataIndex: 'CARDAYS',
header: '总车日',
width: 80,
summaryType: 'sum',
summaryRenderer: Ext.util.Format.numberRenderer('00.00')
},
{
sortable: true,
dataIndex: 'WORKDAYS',
header: '工作车日',
width: 80,
summaryType: 'sum',
summaryRenderer: Ext.util.Format.numberRenderer('00.00')
},
{
sortable: true,
dataIndex: 'USABLEDAYS',
header: '完好车日',
width: 80,
summaryType: 'sum',
summaryRenderer: Ext.util.Format.numberRenderer('00.00')
},
{
sortable: true,
dataIndex: 'USABLERATE',
header: '完好率',
width: 80
},
{
sortable: true,
dataIndex: 'WORKRATE',
header: '工作率',
width: 80
}]
}, {
text: '停驶',
columns: [
{
sortable: true,
dataIndex: 'REPAIRDAYS',
header: '修理日',
width: 80,
summaryType: 'sum',
summaryRenderer: Ext.util.Format.numberRenderer('00.00')
},
{
sortable: true,
dataIndex: 'NOGOODDAYS',
header: '无货日',
width: 80,
summaryType: 'sum',
summaryRenderer: Ext.util.Format.numberRenderer('00.00')
},
{
sortable: true,
dataIndex: 'NODRVDAYS',
header: '无人日',
width: 80,
summaryType: 'sum',
summaryRenderer: Ext.util.Format.numberRenderer('00.00')
}]
}, {
text: '行程、运量、费率',
columns: [
{
sortable: true,
dataIndex: 'RATEDMIL',
header: '行驶总里程',
width: 80,
summaryType: 'sum',
summaryRenderer: Ext.util.Format.numberRenderer('00.00')
},
{
sortable: true,
dataIndex: 'OVERLOADMIL',
header: '重驶里程',
width: 80,
summaryType: 'sum',
summaryRenderer: Ext.util.Format.numberRenderer('00.00')
},
{
sortable: true,
dataIndex: 'TEU',
header: '集装箱运量TEU',
width: 80,
summaryType: 'sum',
summaryRenderer: Ext.util.Format.numberRenderer('00.00')
},
{
sortable: true,
dataIndex: 'TONS',
header: '普货运量',
width: 80,
summaryType: 'sum',
summaryRenderer: Ext.util.Format.numberRenderer('00.00')
},
{
sortable: true,
dataIndex: 'MILPERDAY',
header: '车日行程',
width: 80,
summaryType: 'sum',
summaryRenderer: Ext.util.Format.numberRenderer('00.00')
}]
}, {
text: '燃料控制情况',
columns: [
{
sortable: true,
dataIndex: 'REALFUEL',
header: '燃料实耗',
width: 80,
summaryType: 'sum',
summaryRenderer: Ext.util.Format.numberRenderer('00.00')
},
{
sortable: true,
dataIndex: 'RATEDFUEL',
header: '燃料定额',
width: 80,
summaryType: 'sum',
summaryRenderer: Ext.util.Format.numberRenderer('00.00')
},
{
sortable: true,
dataIndex: 'REMAINFUEL',
header: '节约/超额',
width: 80,
summaryType: 'sum',
summaryRenderer: Ext.util.Format.numberRenderer('00.00')
},
{
sortable: true,
dataIndex: 'FUELAMOUNTRATE',
header: '燃料费占收入比',
width: 80
}]
},
{
sortable: true,
dataIndex: 'OTHERPAY',
header: '其他费用',
width: 80,
summaryType: 'sum',
summaryRenderer: Ext.util.Format.numberRenderer('00.00')
},
{
sortable: true,
dataIndex: 'OTHERPAYREMARK',
header: '其他费用说明',
width: 200
},
{
sortable: true,
dataIndex: 'REMARK',
header: '备注',
width: 200
}
]
, bbar: [Ext.create('Ext.PagingToolbar', {
id: "bbar_MONTHView",
store: this.storeBodyList,
displayInfo: true,
displayMsg: '当前显示 {0} - {1}条记录 /共 {2}条记录',
emptyMsg: "没有数据"
}), this.Pagenum]
});
//#endregion
//#region 明细表 按公司汇总
this.storeCompanyDetailList = Ext.create('Ext.data.Store', {
model: 'TMSRPT_MONTH_COMPANYDETAILmb',
remoteSort: false,
groupField: 'ACCDATE',
proxy: {
type: 'ajax',
url: '/TruckMng/TMSRPT/GetCompanyDetailList',
reader: {
id: '',
root: 'data',
totalProperty: 'totalCount'
}
}
});
this.gridCompanyDetailList = new Ext.grid.GridPanel({
store: this.storeCompanyDetailList,
enableHdMenu: false,
layout: 'border',
region: 'center',
loadMask: { msg: "数据加载中,请稍等..." },
trackMouseOver: true,
disableSelection: false,
//plugins: [this.gridListCellEditing],
selType: 'cellmodel',
autoScroll: true,
//features: [{
// ftype: 'groupsummary'//Ext.grid.feature.Summary表格汇总特性
//}],
features: [{
id: 'group',
ftype: 'groupingsummary',
groupHeaderTpl: '{name}',
hideGroupedHeader: false,
enableGroupingMenu: true
}],
viewConfig: {
enableTextSelection: true,
autoFill: true
},
columns: [
new Ext.grid.RowNumberer(),
{
sortable: true,
dataIndex: 'COMPANYNAME',
header: '单位名称',
width: 80
},
{
sortable: true,
dataIndex: 'ACCDATE',
header: '统计期间',
width: 80
}, {
text: '自营车运营核算(汇总)',
columns: [
{
sortable: true,
dataIndex: 'TRUCKCOUNT',
header: '车辆数',
width: 80
},
{
sortable: true,
dataIndex: 'AMOUNT',
header: '运营 收入',
width: 80
},
{
sortable: true,
dataIndex: 'TRUCKCOST',
header: '运营 成本',
width: 80
},
{
sortable: true,
dataIndex: 'TRUCKPROFIT_M',
header: '利润',
width: 80
}]
}, {
text: '车辆工作状态',
columns: [
{
sortable: true,
dataIndex: 'CARDAYS',
header: '总工作车日',
width: 80
},
{
sortable: true,
dataIndex: 'RATEDMIL',
header: '总里程',
width: 80
},
{
sortable: true,
dataIndex: 'OVERLOADMIL',
header: '总重载里程',
width: 80
}]
}, {
text: '当月物流作业总量',
columns: [
{
sortable: true,
dataIndex: 'TEU',
header: '集装箱运输量(TEU)',
width: 80
},
{
sortable: true,
dataIndex: 'TONS',
header: '其他货物运输量(吨)',
width: 80
}]
}, {
text: '当月营收情况',
columns: [
{
sortable: true,
dataIndex: 'AMOUNT',
header: '当月收入汇总',
width: 80
},
{
text: '集装箱车辆收入',
columns: [
{
sortable: true,
dataIndex: 'CTN_TEU',
header: '箱量',
width: 80
},
{
sortable: true,
dataIndex: 'CTN_AMOUNT',
header: '收入',
width: 80
}]
}, {
text: '集装箱危险品',
columns: [
{
sortable: true,
dataIndex: 'WXP_TEU',
header: '箱量',
width: 80
},
{
sortable: true,
dataIndex: 'WXP_AMOUNT',
header: '收入',
width: 80
}]
}, {
text: '码头倒箱业务',
columns: [
{
sortable: true,
dataIndex: 'PORTCTN_TEU',
header: '箱量',
width: 80
},
{
sortable: true,
dataIndex: 'PORTCTN_AMOUNT',
header: '收入',
width: 80
}]
}, {
text: '大件运输收入',
columns: [
{
sortable: true,
dataIndex: 'DJ_TONS',
header: '运量',
width: 80
},
{
sortable: true,
dataIndex: 'DJ_AMOUNT',
header: '收入',
width: 80
}]
}, {
text: '散货业务',
columns: [
{
sortable: true,
dataIndex: 'SH_TONS',
header: '运量',
width: 80
},
{
sortable: true,
dataIndex: 'SH_AMOUNT',
header: '收入',
width: 80
}]
}, {
text: '物流托管',
columns: [
{
sortable: true,
dataIndex: 'WLTG_AMOUNT',
header: '综合收入',
width: 80
}]
}, {
text: '三方业务',
columns: [
{
sortable: true,
dataIndex: 'DSF_AMOUNT',
header: '三方收入',
width: 80
}, {
sortable: true,
dataIndex: 'DSFDL_AMOUNT',
header: '代理收入',
width: 80
}]
}, {
sortable: true,
dataIndex: 'OTHER_AMOUNT',
header: '其他业务收入',
width: 80
}
]
}//////
]
, bbar: [Ext.create('Ext.PagingToolbar', {
id: "bbar_MONTHView_Company",
store: this.storeCompanyDetailList,
displayInfo: true,
displayMsg: '当前显示 {0} - {1}条记录 /共 {2}条记录',
emptyMsg: "没有数据"
}), this.Pagenum]
});
//#endregion
//#region 明细表 经营情况汇总
this.storeTruckFee = Ext.create('Ext.data.Store', {
pageSize: 50,
model: 'MsWlTruckFeemb',
remoteSort: false,
proxy: {
type: 'ajax',
url: '/TruckMng/MsWlTruckFee/GetDataList',
reader: {
id: 'GID',
root: 'data',
totalProperty: 'totalCount'
}
}
});
this.gridTruckFee = new Ext.grid.GridPanel({
store: this.storeTruckFee,
enableHdMenu: false,
region: 'center',
loadMask: { msg: "数据加载中,请稍等..." },
trackMouseOver: true,
disableSelection: false,
stripeRows: true,
features: [{
ftype: 'summary'//Ext.grid.feature.Summary表格汇总特性
}],
//selModel: this.PCCB,
//plugins: [this.cellEditing],
columns: [new Ext.grid.RowNumberer(), {
sortable: true,
dataIndex: 'GID', hidden: true,
header: 'GID',
width: 130
}, {
sortable: true,
dataIndex: 'TruckNo',
header: '车号',
width: 85
},
{
sortable: true,
dataIndex: 'FeeDate',
header: '费用日期',
width: 85,
renderer: Ext.util.Format.dateRenderer('Y-m-d')
},
{
sortable: true,
dataIndex: 'FeeName',
header: '费用名称',
editor: this.comboxFeeName,
width: 80
},
{
sortable: true,
dataIndex: 'Amount',
header: '金额',
summaryType: 'sum',
width: 70
},
{
sortable: true,
dataIndex: 'Remark',
header: '备注',
width: 120
},
{
sortable: true, hidden: true,
dataIndex: 'Inserted',
header: 'Inserted',
width: 80
}],
// paging bar on the bottom
bbar: Ext.create('Ext.PagingToolbar', {
store: this.storeTruckFee,
displayInfo: true,
displayMsg: '当前显示 {0} - {1}条记录 /共 {2}条记录',
emptyMsg: "没有数据"
})
});
//#endregion 明细表
//#region 充值卡
this.storeCardType = Ext.create('DsExt.ux.RefEnumStore', {});
this.storeCardType.load({ params: { enumTypeId: 99045} });
this.comboxCardType = Ext.create('DsExt.ux.RefTableCombox', {
//fieldLabel: '充值卡类型',
forceSelection: true,
store: this.storeCardType,
name: 'CARDTYPE',
valueField: 'EnumValueName',
displayField: 'EnumValueName',
//triggerAction: 'all',
selectOnFocus: true
});
this.storeCard = Ext.create('Ext.data.Store', {
model: 'DsTruckMng.ux.CardModel',
remoteSort: false,
pruneModifiedRecords: true,
proxy: {
type: 'ajax',
url: '/TruckMng/Card/GetDataList',
reader: {
id: 'GID',
root: 'data',
totalProperty: 'totalCount'
}
}
});
//表格
this.CardColumns = [
{
sortable: true, hidden: true,
dataIndex: 'GID',
header: 'GID',
width: 80
},
{
sortable: true,
dataIndex: 'CARDNO',
header: '卡号',
editor: {
xtype: 'textfield',
allowBlank: false,
selectOnFocus: true
},
width: 170
},
{
sortable: true,
dataIndex: 'CARDTYPE',
header: '卡类型',
editor: this.comboxCardType
/*
xtype: 'textfield',
allowBlank: false,
selectOnFocus: true
}*/,
width: 70
},
{
sortable: true, hidden: true,
dataIndex: 'OP',
header: '所有者',
width: 80
},
{
sortable: true, hidden: true,
dataIndex: 'OWNGID',
header: 'OWNGID',
width: 80
},
{
sortable: true, hidden: true,
dataIndex: 'ISDELETE',
header: 'ISDELETE',
width: 80
},
{
sortable: true,
dataIndex: 'REMAIN',
header: '剩余金额',
width: 80
}
];
this.cellEditingCard = Ext.create('Ext.grid.plugin.CellEditing', {
clicksToEdit: 1
});
this.cardCheckBoxModel = Ext.create('Ext.selection.CheckboxModel');
var _this = this;
this.formCard = new Ext.grid.GridPanel({
store: this.storeCard,
enableHdMenu: false,
layout: 'border',
region: 'center',
loadMask: { msg: "数据加载中,请稍等..." },
trackMouseOver: true,
disableSelection: false,
plugins: [this.cellEditingCard],
selModel: this.cardCheckBoxModel,
multiSelect: false,
selType: 'cellmodel',
tbar: [{
text: '增加明细',
tooltip: '增加明细',
iconCls: "btnadddetail",
handler: function (button, event) {
this.onAddCardClick(button, event);
},
scope: this
}, '-', {
text: '删除明细',
tooltip: '删除明细',
iconCls: "btndeletedetail",
handler: function (button, event) {
this.onDelCardClick(button, event);
},
scope: this
}, '-', {
text: "保存",
iconCls: "btnsave",
handler: function (button, event) {
this.Save('0');
},
scope: this
}],
columns: this.CardColumns
});
//#endregion
//选择load
this.formCard.getSelectionModel().on('select', function (model, record, index) {
var CARDGID = record.data.GID;
this.CARDGID = CARDGID;
this.storeCardUse.load({ params: { CARDGID: CARDGID} });
}, this);
//#region 充值卡使用
this.storeCardUse = Ext.create('Ext.data.Store', {
model: 'DsTruckMng.ux.CardUseModel',
remoteSort: false,
pruneModifiedRecords: true,
proxy: {
type: 'ajax',
url: '/TruckMng/Card/GetUseList',
reader: {
id: 'GID',
root: 'data',
totalProperty: 'totalCount'
}
}
});
//表格
this.CardUseColumns = [
{
sortable: true, hidden: true,
dataIndex: 'GID',
header: 'GID',
width: 80
},
{
sortable: true, hidden: true,
dataIndex: 'CARDNO',
header: 'CARDNO',
width: 80
},
{
sortable: true, hidden: true,
dataIndex: 'CARDGID',
header: 'CARDGID',
width: 80
},
{
sortable: true,
dataIndex: 'BILLNO',
header: '业务编号',
width: 150
},
{
sortable: true,
dataIndex: 'OPERATE',
header: '业务操作',
width: 80,
editor: {
xtype: 'textfield',
allowBlank: false,
selectOnFocus: true
}
},
{
sortable: true,
dataIndex: 'INNUM',
header: '充入',
width: 80,
editor: {
xtype: 'numberfield',
allowBlank: false,
selectOnFocus: true
}
},
{
sortable: true,
dataIndex: 'OUTNUM',
header: '支出',
width: 80,
editor: {
xtype: 'numberfield',
allowBlank: false,
selectOnFocus: true
}
},
{
sortable: true,
dataIndex: 'OPTIME',
header: '操作时间',
width: 140,
renderer: Ext.util.Format.dateRenderer('Y-m-d H:i:s'),
editor: {
xtype: 'datetimefield',
selectOnFocus: true
}
},
{
sortable: true,
dataIndex: 'REMARK',
header: '备注',
width: 80,
editor: {
xtype: 'textfield',
allowBlank: false,
selectOnFocus: true
}
}];
this.cellEditingCardUse = Ext.create('Ext.grid.plugin.CellEditing', {
clicksToEdit: 1
});
this.CardUseCheckBoxModel = Ext.create('Ext.selection.CheckboxModel');
var _this = this;
this.formCardUse = new Ext.grid.GridPanel({
store: this.storeCardUse,
enableHdMenu: false,
region: 'center',
loadMask: { msg: "数据加载中,请稍等..." },
trackMouseOver: true,
disableSelection: false,
plugins: [this.cellEditingCardUse],
selModel: this.CardUseCheckBoxModel,
selType: 'cellmodel',
tbar: [{
text: '增加明细',
tooltip: '增加明细',
iconCls: "btnadddetail",
handler: function (button, event) {
var CARDGID = "";
var records = this.formCard.selModel.getSelection();
if (records.length == 0) {
alert("请先选中一个充值卡");
return;
}
OWNGID = records[0].data.OWNGID;
if (OWNGID == "") {
alert("请先保存充值卡信息");
return;
}
this.onAddCardUseClick(records[0].data.GID);
},
scope: this
}, {
text: '删除明细',
tooltip: '删除明细',
iconCls: "btndeletedetail",
handler: function (button, event) {
var records = this.formCard.selModel.getSelection();
var OWNGID = records[0].data.OWNGID;
var CARDGID = records[0].data.GID;
this.onDelCardUseClick(CARDGID, OWNGID);
},
scope: this
}, '-', {
text: '保存充值卡使用信息',
tooltip: '仅可保存修改充值卡的充值信息。',
iconCls: "btnsave",
handler: function (button, event) {
var CARDGID = "";
var records = this.formCard.selModel.getSelection();
var CARDGID = records[0].data.GID;
var OWNGID = records[0].data.OWNGID;
if (OWNGID == "") {
alert("请先保存充值卡信息");
return;
}
this.onSaveCardUseClick(CARDGID, OWNGID);
},
scope: this
}],
columns: this.CardUseColumns
});
//#endregion
//#region 车辆月度信息
this.storeTruckMonth = Ext.create('Ext.data.Store', {
model: 'TruckMonthmb',
remoteSort: false,
proxy: {
type: 'ajax',
url: '/TruckMng/MsWlTruck/GetTruckMonthList',
reader: {
id: 'GID',
root: 'data',
totalProperty: 'totalCount'
}
}
});
//表格
this.TruckMonthColumns = [
{
sortable: true, hidden: true,
dataIndex: 'GID', readOnly: true,
header: 'GID',
width: 80
},
{
sortable: true, hidden: true,
dataIndex: 'TRUCKNO', readOnly: true,
header: 'TRUCKNO',
width: 80
},
{
sortable: true,
dataIndex: 'ACCDATE',
header: '统计期间',
width: 80,
renderer: Ext.util.Format.dateRenderer('Y-m'),
editor: {
xtype: 'monthfield',
selectOnFocus: true,
renderer: Ext.util.Format.dateRenderer('Y-m')
}
},
{
sortable: true,
dataIndex: 'ZJF',
header: '折旧费',
width: 80,
editor: {
xtype: 'numberfield',
allowBlank: false,
selectOnFocus: true,
minValue: 0
}
},
{
sortable: true,
dataIndex: 'BXF',
header: '车辆保险',
width: 80,
editor: {
xtype: 'numberfield',
allowBlank: false,
selectOnFocus: true,
minValue: 0
}
},
{
sortable: true,
dataIndex: 'GZCR',
header: '工作车日',
width: 80,
editor: {
xtype: 'numberfield',
allowBlank: false,
selectOnFocus: true,
minValue: 0
}
},
{
sortable: true,
dataIndex: 'XLCR',
header: '修理车日',
width: 80
},
{
sortable: true,
dataIndex: 'ZCR',
header: '总车日',
width: 80,
editor: {
xtype: 'numberfield',
allowBlank: false,
selectOnFocus: true,
minValue: 0
}
}
];
this.cellEditingTruckMonth = Ext.create('Ext.grid.plugin.CellEditing', {
clicksToEdit: 1
});
this.TruckMonthCheckBoxModel = Ext.create('Ext.selection.CheckboxModel');
var _this = this;
this.formTruckMonth = new Ext.grid.GridPanel({
store: this.storeTruckMonth,
enableHdMenu: false,
layout: 'border',
region: 'center',
loadMask: { msg: "数据加载中,请稍等..." },
trackMouseOver: true,
disableSelection: false,
plugins: [this.cellEditingTruckMonth],
selModel: this.TruckMonthCheckBoxModel,
multiSelect: false,
selType: 'cellmodel',
tbar: [{
text: '增加明细',
tooltip: '增加明细',
iconCls: "btnadddetail",
handler: function (button, event) {
this.onAddTruckMonthClick(button, event);
},
scope: this
}, '-', {
text: '删除明细',
tooltip: '删除明细',
iconCls: "btndeletedetail",
handler: function (button, event) {
this.onDelTruckMonthClick(button, event);
},
scope: this
}, '-', {
text: "保存",
iconCls: "btnsave",
handler: function (button, event) {
this.Save('0');
},
scope: this
}],
columns: this.TruckMonthColumns
});
//#endregion
//#region 布局
//控件布局
this.panelTop = new Ext.Panel({
layout: "border",
region: 'north',
margin: '1 1',
height: 55,
//split: true,
items: [
///this.panelBtn
this.formSearch
, this.formEdit]
});
this.panelCardList = new Ext.Panel({
// title: '货物信息和许可证使用',
layout: "border",
region: 'west',
margin: '0 0',
//height: 450,
width: 330,
//split: true,
items: [this.formCard]
});
this.panelCardUse = new Ext.Panel({
// title: '货物信息和许可证使用',
layout: "border",
region: 'center',
margin: '0 0',
//height: 450,
width: 450,
//split: true,
items: [this.formCardUse]
});
this.panelCard = new Ext.Panel({
//
layout: "border",
region: 'center',
margin: '0 0',
//height: 260, //width: 450,
//split: true,
items: [this.panelCardList, this.panelCardUse]
});
this.page_1 = new Ext.Panel({
id: "page_1",
title: "车辆汇总",
//autoScroll: true,
layout: "border",
region: 'center',
//closable:true,
items: [this.gridList]
});
this.page_2 = new Ext.Panel({
id: "page_2",
title: "分公司汇总",
layout: "border",
region: 'center',
items: [this.gridCompanyDetailList]
});
this.page_3 = new Ext.Panel({
id: "page_3",
title: "按客户汇总",
layout: "border",
region: 'center',
items: [this.gridCustomer]
});
/*
this.page_4 = new Ext.Panel({
id: "page_4",
title: "车辆月度费用管理",
layout: "border",
region: 'center',
items: [this.formTruckMonth]
});*/
this.MainTab = new Ext.tab.Panel({
layout: "border",
region: "center", //split: true,
items: [
this.page_1, this.page_2//, this.page_3, this.page_4
]
});
Ext.apply(this, {
items: [this.panelTop, this.MainTab]
});
//#endregion
//绑定查询窗体
this.ParentWin = window.parent.opener;
//初始化数据
this.InitData();
//绑定事件
this.gridList.on('edit', function (editor, e, eOpts) {
this.gridAfterEdit(editor, e, eOpts);
}, this);
this.cellEditingCardUse.on('beforeedit', function (editor, e) {
return this.CardUseBeforeEdit(editor, e);
}, this);
/*
this.storeBodyList.on('refresh', function (store) {
mergeCells(this.gridList, [4, 5]);
//alert('refresh');
}, this);*/
}, //end initUIComponents
InitData: function () {
this.opStatus = 'add';
var condition = '';
if (this.ParentWin) {
var ret = this.ParentWin.OprationSwap();
this.opStatus = ret[0];
this.StoreList = ret[1];
this.editRecord = ret[2];
}
if (this.opStatus == 'edit')
condition = " GID='" + this.editRecord.get('GID') + "'";
this.LoadData(this.opStatus, condition);
}, //end InitData
LoadData: function (opstatus, condition) {
this.serialNo = 0;
this.bodyDel = [];
this.opStatus = opstatus;
Ext.Ajax.request({
waitMsg: '正在查询主表数据...',
url: '/TruckMng/TMSRPT/MONTH_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();
this.formEdit.getForm().setValues(data);
} else {
Ext.MessageBox.alert('请求出现错误,请重试', response.responseText);
}
},
scope: this
});
var LINKGID = '*';
if (this.opStatus == 'edit') {
LINKGID = this.editRecord.get('GID');
//this.formEdit.getForm().findField('TruckNo').setDisabled(true);
this.storeTruckFee.load({
params: { start: 0, limit: 50, sort: '', condition: "TruckNo='" + this.editRecord.get('TruckNo') + "'" },
waitMsg: "正在查询数据...",
scope: this
});
this.storeTruckMonth.load({
params: { condition: "TruckNo='" + this.editRecord.get('TruckNo') + "'" },
waitMsg: "正在查询数据...",
scope: this
});
}
RPTLINKGID = LINKGID;
this.storeBodyList.load({ params: { start: 0, limit: this.PageSize, condition: "LINKGID='" + LINKGID + "'"} });
this.storeCompanyDetailList.load({ params: { start: 0, limit: this.PageSize, condition: "LINKGID='" + LINKGID + "'"} });
//this.storeCard.load({ params: { OWNGID: billno} });
//显示充值卡剩余数量
}, // end LoadDate
Save: function (type) {
var basicForm = this.formEdit.getForm();
if (!basicForm.isValid()) {
return;
}
//basicForm.findField('TruckNo').setDisabled(false);
var data = basicForm.getValues();
//basicForm.findField('TruckNo').setDisabled(true);
if (data.TimeMark == "") {
TimeMark = 0;
}
var bodydatas = [];
for (var i = 0; i < this.storeBodyList.getCount(); i += 1) {
var member = this.storeBodyList.getAt(i);
bodydatas.push(member);
}
var jsonBody = ConvertRecordsToJson(bodydatas);
var jsonDelBody = ConvertRecordsToJsonAll(this.bodyDel);
/*
var Carddatas = [];
for (var i = 0; i < this.storeCard.getCount(); i += 1) {
var member = this.storeCard.getAt(i);
Carddatas.push(member);
}
var CardjsonBody = ConvertRecordsToJson(Carddatas);
var CardjsonDelBody = ConvertRecordsToJsonAll(this.cardDel);
var TruckMonthdatas = [];
for (var i = 0; i < this.storeTruckMonth.getCount(); i += 1) {
var member = this.storeTruckMonth.getAt(i);
var Y = member.data.ACCDATE.getFullYear();
var M = member.data.ACCDATE.getMonth() + 1;
member.data.ACCDATE = Y + '-' + M;
TruckMonthdatas.push(member);
}
var TruckMonthjsonBody = ConvertRecordsToJson(TruckMonthdatas);
var TruckMonthjsonDelBody = ConvertRecordsToJsonAll(this.TruckMonthDel);
*/
Ext.Msg.wait('正在保存数据, 请稍侯..');
Ext.Ajax.request({
waitMsg: '正在保存数据...',
url: '/TruckMng/TMSRPT/Save',
scope: this,
params: {
opstatus: this.opStatus,
data: Ext.JSON.encode(data),
body: jsonBody,
delbody: jsonDelBody
},
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];
}
else if (this.opStatus == 'edit') {
var editp = Ext.create('TMSRPT_MONTHmb', 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();
}
if (type == '0') {
this.opStatus = 'edit';
//basicForm.findField('TruckNo').setDisabled(true);
this.storeBodyList.commitChanges();
/*
for (var j = 0; j < this.storeBodyList.getCount(); j += 1) {
var memberbody = this.storeBodyList.getAt(j);
memberbody.set("TruckNo", this.editRecord.get('TruckNo'));
memberbody.commit();
};*/
} else if (type == '1') {
window.close();
} else {
this.LoadData('add', '');
basicForm.findField('TruckNo').setDisabled(false);
}
} 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) {
this.deleteDetail();
}, //onDelDetailClick
gridAfterEdit: function (editor, e, eOpts) {
//需要自己实现里面的事件
if (e.field == 'LoadType') {
var records = DsStoreQueryBy(this.storeLoadTypeRef, 'EnumValueId', e.value);
if (records.getCount() > 0) {
var data = records.getAt(0).data;
e.record.set('LoadType_Ref', data.EnumValueName);
} else {
e.record.set('LoadType_Ref', '');
}
}
},
onAddDetailClick: function () {
var basicForm = this.formEdit.getForm();
if (!basicForm.isValid()) {
return;
}
//basicForm.findField('TruckNo').setDisabled(false);
var data = basicForm.getValues();
var record = Ext.create('TMSRPT_MONTH_TRUCKDETAILmb', {
GID: NewGuid(),
COMPANYID: data.COMPANYID,
COMPANYNAME: data.COMPANYNAME,
TRUCKNO: "",
AMOUNT: "0",
ZJF: "0",
BXF: "0",
GZJZ: "0",
SBF: "0",
GJJ: "0",
FUELPRICE: "0",
FUELAMOUNT: "0",
REPAIRAMOUNT: "0",
TYREAMOUNT: "0",
OTHERAMOUNT: "0",
TAX: "0",
TRUCKCOST: "0",
TRUCKPROFIT_M: "0",
CARDAYS: "0",
WORKDAYS: "0",
USABLEDAYS: "0",
USABLERATE: "0",
WORKRATE: "0",
REPAIRDAYS: "0",
NOGOODDAYS: "0",
NODRVDAYS: "0",
RATEDMIL: "0",
OVERLOADMIL: "0",
TEU: "0",
TONS: "0",
MILPERDAY: "0",
FUEL: "0",
RATEDFUEL: "0",
REMAINFUEL: "0",
FUELAMOUNTRATE: "0",
OTHERPAY: "0",
OTHERPAYREMARK: "无",
REMARK: ""
});
this.storeBodyList.add(record);
var n = this.storeBodyList.getCount();
this.gridListCellEditing.startEditByPosition({ row: n - 1, column: 2 });
},
deleteDetail: function () {
this.serialNo = DsGetCurSerialNo(this.storeBodyList, this.serialNo);
var selectedRecords = this.gridList.selModel.getSelection();
for (var i = 0; i < selectedRecords.length; i++) {
var rec = selectedRecords[i];
if (rec.BillNo != "" || rec.BillNo != "*") //如果是新增但没有保存的数据,没有必要提交到后台
{
this.bodyDel.push(rec);
}
this.storeBodyList.remove(selectedRecords[i]);
}
},
onAddCardClick: function () {
var record = Ext.create('DsTruckMng.ux.CardModel', {
GID: NewGuid(),
CARDNO: "",
CARDTYPE: "",
OP: "",
OWNGID: "",
ISDELETE: "0"
});
this.storeCard.add(record);
var n = this.storeCard.getCount();
this.cellEditingCard.startEditByPosition({ row: n - 1, column: 2 });
},
onDelCardClick: function () {
/*
var selectedRecords = this.formCard.selModel.getSelection();
if (this.storeCardUse.getCount()>0){
alert("包含充值或使用明细的卡片不能删除");
return;
}
*/
var selections = this.formCard.getSelectionModel().getSelection();
if (selections.length == 0) {
Ext.Msg.show({ title: '提示', msg: '请先选择卡片!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
return;
}
var _L = selections.length;
var UseCount = "0";
var OWNGID = this.editRecord.get('TruckNo');
Ext.MessageBox.confirm('提示', '确定删除这' + _L + '条记录吗?', function (btn) {
if (btn == 'yes') {
//var record = selections[0];
for (var i = 0; i < _L; i++) {
var record = selections[i];
var GID = record.data.GID;
Ext.Ajax.request({
waitMsg: '正在查询数据...',
url: '/TruckMng/Card/SearchCardUse',
scope: this,
async: false,
params: { GID: GID },
waitMsg: "正在查询数据...",
callback: function (options, success, response) {
if (success) {
var jsonresult = Ext.JSON.decode(response.responseText);
var returnData = jsonresult.data;
//alert(returnData);
UseCount = returnData;
} else {
Ext.Msg.show({ title: '请重试',
msg: '服务器响应出错',
icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK
});
return;
}
}
});
if (UseCount != "0") {
alert("该卡片下包含未删除的使用/充值明细,不能删除");
return;
} else {
//Ext.Msg.wait('正在删除数据...');
Ext.Ajax.request({
waitMsg: '正在删除数据...',
url: '/TruckMng/Card/DeleteCard',
params: {
GID: GID
},
callback: function (options, success, response) {
if (success) {
var jsonresult = Ext.JSON.decode(response.responseText);
if (jsonresult.Success) {
//this.storeCard.remove(record);
//Ext.Msg.show({ title: '提示', msg: jsonresult.Message, icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
}
else {
Ext.Msg.show({ title: '错误', msg: jsonresult.Message, icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK });
}
}
},
failure: function (response, options) {
Ext.Msg.show({ title: '警告', msg: '服务器响应出错,请重试', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
},
success: function (response, options) {
},
scope: this
}); //end Ext.Ajax.request
}
}
//this.storeList.remove(record);
//if (i >= _L ) {
// Ext.Msg.show({ title: '提示', msg: "数据删除结束", icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
//}
this.storeCard.load({ params: { OWNGID: OWNGID} });
};
//Ext.Msg.show({ title: '提示', msg: "数据删除结束", icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
//this.onRefreshClick(button, event);
}, this);
}
,
onAddCardUseClick: function (CARDGID) {
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;
}
var EnterDate = GetDateStr(0);
var record = Ext.create('DsTruckMng.ux.CardUseModel', {
GID: NewGuid(),
CARDNO: "",
CARDGID: "",
BILLNO: "",
OPERATE: "充值",
INNUM: "0",
OUTNUM: "0",
OPTIME: EnterDate,
REMARK: ""
});
this.storeCardUse.add(record);
var n = this.storeCardUse.getCount();
this.cellEditingCardUse.startEditByPosition({ row: n - 1, column: 2 });
},
onDelCardUseClick: function (CARDGID, OWNGID) {
var selectedRecords = this.formCardUse.selModel.getSelection();
var selections = this.formCardUse.getSelectionModel().getSelection();
if (selections.length == 0) {
Ext.Msg.show({ title: '提示', msg: '请先选择充值卡使用明细!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
return;
}
var _L = selections.length;
for (var i = 0; i < _L; i++) {
var record = selections[i];
if (record.data.OPERATE == "路单使用") {
alert("不能删除由路单生成的充值卡使用明细");
return;
}
}
Ext.MessageBox.confirm('提示', '确定删除这' + _L + '条记录吗?', function (btn) {
if (btn == 'yes') {
//var record = selections[0];
for (var i = 0; i < _L; i++) {
var record = selections[i];
var GID = record.data.GID;
//Ext.Msg.wait('正在删除数据...');
Ext.Ajax.request({
waitMsg: '正在删除数据...',
async: false,
url: '/TruckMng/Card/DeleteCardUse',
params: {
GID: GID
},
callback: function (options, success, response) {
if (success) {
var jsonresult = Ext.JSON.decode(response.responseText);
if (jsonresult.Success) {
this.storeCardUse.remove(record);
//Ext.Msg.show({ title: '提示', msg: jsonresult.Message, icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
}
else {
Ext.Msg.show({ title: '错误', msg: jsonresult.Message, icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK });
}
}
},
failure: function (response, options) {
Ext.Msg.show({ title: '警告', msg: '服务器响应出错,请重试', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
},
success: function (response, options) {
},
scope: this
}); //end Ext.Ajax.request
}
};
//Ext.Msg.show({ title: '提示', msg: "数据删除结束", icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
var _this = this;
this.storeCard.load({
async: false,
params: { OWNGID: OWNGID },
callback: function (options, success, response) {
for (var i = 0; i < _this.storeCard.getCount(); i += 1) {
var member = _this.storeCard.getAt(i);
if (member.data.GID == CARDGID) {
_this.formCard.getSelectionModel().select(member);
}
}
}
});
}, this);
},
onSaveCardUseClick: function (CARDGID, OWNGID) {
var bodyCardUse = [];
for (i = 0; i < this.storeCardUse.getCount(); i += 1) {
var memberyf = this.storeCardUse.getAt(i);
bodyCardUse.push(memberyf);
};
var jsonCardUseBody = ConvertRecordsToJson(bodyCardUse);
var jsonCardUseDelBody = ConvertRecordsToJsonAll(this.carduseDel);
if (jsonCardUseBody == "" && jsonCardUseDelBody == "") {
return;
}
Ext.Msg.wait('正在保存数据, 请稍侯..');
Ext.Ajax.request({
waitMsg: '正在保存数据...',
url: '/TruckMng/Card/SaveCardUse',
scope: this,
params: {
CARDGID: CARDGID
, CardUsebody: jsonCardUseBody
, CardUseDelbody: jsonCardUseDelBody
},
callback: function (options, success, response) {
if (success) {
Ext.MessageBox.hide();
var jsonresult = Ext.JSON.decode(response.responseText);
if (jsonresult.Success) {
//alert("保存成功");
var returnData = jsonresult.Data;
this.storeCardUse.commitChanges();
var _this = this;
this.storeCard.load({
async: false,
params: { OWNGID: OWNGID },
callback: function (options, success, response) {
for (var i = 0; i < _this.storeCard.getCount(); i += 1) {
var member = _this.storeCard.getAt(i);
if (member.data.GID == CARDGID) {
_this.formCard.getSelectionModel().select(member);
}
}
}
});
} 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');
}
});
},
CardUseBeforeEdit: function (editor, e) {
var OPERATE = e.record.get('OPERATE');
var canedit = true;
if (OPERATE == "路单使用") {
canedit = false;
}
return canedit;
}
, onRefreshClick: function (button, event) {
this.PageSize = this.Pagenum.getValue();
var sql = this.getCondition();
if (sql == "") {
Ext.Msg.alert('注意', '完全无条件的查询可能需要的时间很长,或无法完成。');
}
this.storeBodyList.load({
params: { start: 0, limit: this.PageSize, condition: sql },
waitMsg: "正在查询数据...",
scope: this
});
this.storeCompanyDetailList.load({
params: { start: 0, limit: this.PageSize, condition: sql },
waitMsg: "正在查询数据...",
scope: this
});
}
, getCondition: function () {
var form = this.formSearch.getForm();
/*
if (!form.isValid()) {
Ext.Msg.alert('提示', '完全无条件查询可能需要的时间很长,或无法完成。');
//return "false";
}*/
var sql = " exists (select 1 from TMSRPT_MONTH where GID=LINKGID and isnull(isdelete,0)=0 )";
var COMPANYID = form.findField('COMPANYID').getValue();
sql = sql + getAndConSql(sql, COMPANYID, " COMPANYID = '" + COMPANYID + "'");
var TRUCKNO = form.findField('TRUCKNO').getValue();
sql = sql + getAndConSql(sql, TRUCKNO, " ( TRUCKNO like '%" + TRUCKNO + "%' )");
var ACCDATE = form.findField('ACCDATE').getRawValue();
sql = sql + getAndConSql(sql, ACCDATE, " LINKGID in(select GID from TMSRPT_MONTH where ACCDATE='" + ACCDATE + "')");
return sql;
}
, onAddTruckMonthClick: function () {
var record = Ext.create('TruckMonthmb', {
GID: NewGuid(),
TRUCKNO: "",
ACCDATE: "",
ZJF: "0",
BXF: "0",
GZCR: "0",
XLCR: "0",
ZCR: "0"
});
this.storeTruckMonth.add(record);
var n = this.storeTruckMonth.getCount();
this.cellEditingTruckMonth.startEditByPosition({ row: n - 1, column: 2 });
}
, onDelTruckMonthClick: function () {
var selectedRecords = this.formTruckMonth.selModel.getSelection();
for (var i = 0; i < selectedRecords.length; i++) {
var rec = selectedRecords[i];
if (rec.TRUCKNO != "" || rec.TRUCKNO != "*") //如果是新增但没有保存的数据,没有必要提交到后台
{
this.TruckMonthDel.push(rec);
}
this.storeTruckMonth.remove(selectedRecords[i]);
}
}
, ReMake: function () {
var basicForm = this.formEdit.getForm();
if (!basicForm.isValid()) {
return;
}
var GID = this.formEdit.getForm().findField('GID').getValue();
var COMPANYID = this.formEdit.getForm().findField('COMPANYID').getValue();
var FUELPRICE = this.formEdit.getForm().findField('FUELPRICE').getValue();
var ACCDATE = this.formEdit.getForm().findField('ACCDATE').getRawValue();
Ext.Ajax.request({
waitMsg: '正在删除数据...',
url: '/TruckMng/TMSRPT/ReMake',
params: {
GID: GID,
COMPANYID: COMPANYID,
FUELPRICE: FUELPRICE,
ACCDATE: ACCDATE
},
callback: function (options, success, response) {
if (success) {
this.storeBodyList.load({ params: { strat: 0, limit: this.PageSize, condition: "LINKGID='" + GID + "'"} });
this.storeCompanyDetailList.load({ params: { strat: 0, limit: this.PageSize, condition: "LINKGID='" + GID + "'"} });
}
},
failure: function (response, options) {
Ext.Msg.show({ title: '警告', msg: '服务器响应出错,请重试', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
},
success: function (response, options) { },
scope: this
}); //end Ext.Ajax.request
}, Print: function () {
var sql = this.getCondition();
var printType = 'TRUCKRPT2';
var sql1 = " select GID,LINKGID,COMPANYID,(select name from company where GID=COMPANYID) COMPANYNAME";
sql1 += ",(select ACCDATE from TMSRPT_MONTH where GID=LINKGID) ACCDATE ";
sql1 += ",TRUCKNO,(select LoadCount from tmswltruck where truckno=TMSRPT_MONTH_TRUCKDETAIL.TRUCKNO) LoadCount ";
sql1 += ",(select trunkbrand from tmswltruck where truckno=TMSRPT_MONTH_TRUCKDETAIL.TRUCKNO) TruckSpec ";
sql1 += ",AMOUNT,ZJF,BXF,GZJZ,SBF,GJJ,FUELPRICE,FUELAMOUNT,LQF,REPAIRAMOUNT,TYREAMOUNT,OTHERAMOUNT,TAX,TRUCKCOST,TRUCKPROFIT_M ";
sql1 += " ,CARDAYS,WORKDAYS,USABLEDAYS,USABLERATE,WORKRATE,REPAIRDAYS,NOGOODDAYS,NODRVDAYS,RATEDMIL,OVERLOADMIL,TEU,TONS ";
sql1 += " ,MILPERDAY,REALFUEL,RATEDFUEL,REMAINFUEL,FUELAMOUNTRATE,OTHERPAY,OTHERPAYREMARK,REMARK ";
sql1 += " from TMSRPT_MONTH_TRUCKDETAIL where " + sql;
var sql2 = "";
sql2 = sql2 + " select (select name from company c where c.gid=md.COMPANYID) companyname ";
sql2 = sql2 + " ,(select accdate from TMSRPT_MONTH where gid=md.LINKGID) accdate ";
sql2 = sql2 + " ,(select count(*) from (select distinct truckno from TMSRPT_MONTH_TRUCKDETAIL where linkgid=md.LINKGID)t) TRUCKCOUNT ";
sql2 = sql2 + " ,sum(amount) AMOUNT,sum(TRUCKCOST) TRUCKCOST,sum(md.TRUCKPROFIT_M) TRUCKPROFIT_M ";
sql2 = sql2 + " ,sum(md.CARDAYS) CARDAYS,sum(md.RATEDMIL) RATEDMIL,sum(md.OVERLOADMIL) OVERLOADMIL ";
sql2 = sql2 + " ,sum(md.TEU) TEU,sum(md.TONS) TONS ";
sql2 = sql2 + " ,isnull((select sum(TEU) from TMSRPT_MONTH_TRUCKDETAIL t1 where t1.PcBillType='集运' and t1.COMPANYID=md.COMPANYID and t1.LINKGID=md.LINKGID ),0) CTN_TEU ";
sql2 = sql2 + " ,isnull((select sum(AMOUNT) from TMSRPT_MONTH_TRUCKDETAIL t1 where t1.PcBillType='集运' and t1.COMPANYID=md.COMPANYID and t1.LINKGID=md.LINKGID ),0) CTN_AMOUNT ";
sql2 = sql2 + " ,isnull((select sum(TONS) from TMSRPT_MONTH_TRUCKDETAIL t1 where t1.PcBillType='散货' and t1.COMPANYID=md.COMPANYID and t1.LINKGID=md.LINKGID ),0) SH_TONS ";
sql2 = sql2 + " ,isnull((select sum(AMOUNT) from TMSRPT_MONTH_TRUCKDETAIL t1 where t1.PcBillType='散货' and t1.COMPANYID=md.COMPANYID and t1.LINKGID=md.LINKGID ),0) SH_AMOUNT ";
sql2 = sql2 + " ,isnull((select sum(TEU) from TMSRPT_MONTH_TRUCKDETAIL t1 where t1.PcBillType='码头倒箱' and t1.COMPANYID=md.COMPANYID and t1.LINKGID=md.LINKGID ),0) PORTCTN_TEU ";
sql2 = sql2 + " ,isnull((select sum(AMOUNT) from TMSRPT_MONTH_TRUCKDETAIL t1 where t1.PcBillType='码头倒箱' and t1.COMPANYID=md.COMPANYID and t1.LINKGID=md.LINKGID ),0) PORTCTN_AMOUNT ";
sql2 = sql2 + " ,isnull((select sum(TONS) from TMSRPT_MONTH_TRUCKDETAIL t1 where t1.PcBillType='大件' and t1.COMPANYID=md.COMPANYID and t1.LINKGID=md.LINKGID ),0) DJ_TONS ";
sql2 = sql2 + " ,isnull((select sum(AMOUNT) from TMSRPT_MONTH_TRUCKDETAIL t1 where t1.PcBillType='大件' and t1.COMPANYID=md.COMPANYID and t1.LINKGID=md.LINKGID ),0) DJ_AMOUNT ";
sql2 = sql2 + " ,isnull((select sum(TONS) from TMSRPT_MONTH_TRUCKDETAIL t1 where t1.PcBillType='危险品' and t1.COMPANYID=md.COMPANYID and t1.LINKGID=md.LINKGID ),0) WXP_TEU ";
sql2 = sql2 + " ,isnull((select sum(AMOUNT) from TMSRPT_MONTH_TRUCKDETAIL t1 where t1.PcBillType='危险品' and t1.COMPANYID=md.COMPANYID and t1.LINKGID=md.LINKGID ),0) WXP_AMOUNT ";
sql2 = sql2 + " ,isnull((select sum(AMOUNT) from TMSRPT_MONTH_TRUCKDETAIL t1 where t1.PcBillType='危险品' and t1.COMPANYID=md.COMPANYID and t1.LINKGID=md.LINKGID ),0) WXP_AMOUNT ";
sql2 = sql2 + " ,isnull((select sum(AMOUNT) from TMSRPT_MONTH_TRUCKDETAIL t1 where t1.PcBillType='物流托管' and t1.COMPANYID=md.COMPANYID and t1.LINKGID=md.LINKGID ),0) WLTG_AMOUNT ";
sql2 = sql2 + " ,isnull((select sum(AMOUNT) from TMSRPT_MONTH_TRUCKDETAIL t1 where t1.PcBillType='第三方' and t1.COMPANYID=md.COMPANYID and t1.LINKGID=md.LINKGID ),0) DSF_AMOUNT ";
sql2 = sql2 + " ,isnull((select sum(AMOUNT) from TMSRPT_MONTH_TRUCKDETAIL t1 where t1.PcBillType='第三方代理' and t1.COMPANYID=md.COMPANYID and t1.LINKGID=md.LINKGID ),0) DSFDL_AMOUNT ";
sql2 = sql2 + " ,isnull((select sum(AMOUNT) from TMSRPT_MONTH_TRUCKDETAIL t1 where t1.PcBillType='其他' and t1.COMPANYID=md.COMPANYID and t1.LINKGID=md.LINKGID ),0) OTHER_AMOUNT ";
sql2 = sql2 + " from TMSRPT_MONTH_TRUCKDETAIL md where " + sql;
sql2 = sql2 + " group by COMPANYID,LINKGID ";
var sql3 = "";
var sql4 = "";
var sql5 = "";
var sql6 = "";
PrintComm(printType, sql1, sql2, sql3, sql4, sql5, sql6);
}
});