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

2081 lines
74 KiB
JavaScript

2 years ago
Ext.namespace('DsTruck');
DsTruck.MsWl_HH_ZY = function (config) {
Ext.applyIf(this, config);
this.initUIComponents();
window.DsTruck.MsWl_HH_ZY.superclass.constructor.call(this);
};
Ext.extend(DsTruck.MsWl_HH_ZY, Ext.Panel, {
PageSize: 200,
OprationStatus: null, //仅当弹出界面时使用
SelectedRecord: null,
VISIBLERANGE: 4,
OPERATERANGE: 4,
initUIComponents: function () {
this.bodyDel = [];
this.Amount_ALL = 0;
this.SettlementType = "";
//////////////定义下拉菜单 计费方式BillingType
Ext.define('BillingTypeMd', {
extend: 'Ext.data.Model',
fields: [
{ name: 'BillingType', type: 'string' },
{ name: 'BillingTypeREF', type: 'string' }
]
});
var BillingTypeData = [{ "BillingType": "0", "BillingTypeREF": "吨/公里" },
{ "BillingType": "1", "BillingTypeREF": "车/公里" }
];
this.storeBillingType = Ext.create('Ext.data.Store', {
model: 'BillingTypeMd',
data: BillingTypeData
});
this.comboxBillingType = Ext.create('DsExt.ux.RefEnumCombox', {
//fieldLabel: '收付类型',
forceSelection: true,
store: this.storeBillingType,
name: 'BillingType',
valueField: 'BillingType',
displayField: 'BillingTypeREF'
});
//////////////
//定义数据集
this.storeList = Ext.create('Ext.data.Store', {
pageSize: this.PageSize,
model: 'HH_ZYmb',
remoteSort: true,
proxy: {
type: 'ajax',
url: '/TruckMng/MsWl_HH_ZY/GetDataList',
reader: {
id: 'GID',
root: 'data',
totalProperty: 'totalCount'
}
}
});
this.storeList_2 = Ext.create('Ext.data.Store', {
pageSize: this.PageSize,
model: 'HH_ZYmb',
groupField: 'TruckNo',
remoteSort: true,
//groupField: 'HTH',
proxy: {
type: 'ajax',
url: '/TruckMng/MsWl_HH_ZY/GetDataList_2',
reader: {
id: 'GID',
root: 'data',
totalProperty: 'totalCount'
}
}
});
this.cellEditing = Ext.create('Ext.grid.plugin.CellEditing', {
clicksToEdit: 1
});
this.MainCB = Ext.create('Ext.selection.CheckboxModel', { checkOnly: true });
Ext.grid.RowNumberer = Ext.extend(Ext.grid.RowNumberer, {
width: 50
});
//定义Grid
this.gridList = new Ext.grid.GridPanel({
store: this.storeList,
enableHdMenu: false,
region: 'center',
loadMask: { msg: "数据加载中,请稍等..." },
trackMouseOver: true,
disableSelection: false,
selModel: this.MainCB,
stripeRows: true,
viewConfig: {
enableTextSelection: true,
getRowClass: function (record, rowIndex, rowParams, store) {
var feeStatus = record.get('HZSTATUS');
return DsTruck.MsChFeeGetRowClass(feeStatus);
}
},
stateful: true,
plugins: [this.cellEditing],
columns: [new Ext.grid.RowNumberer()
,
{
sortable: true, hidden: true,
dataIndex: 'GID',
header: 'GID',
width: 80
},
{
sortable: true, hidden: true,
dataIndex: 'OrgCode',
header: 'OrgCode',
width: 80
},
{
sortable: true,
dataIndex: 'HZSTATUS_REF',
header: '业务状态',
width: 60/*,
editor: {
xtype: 'textfield'
}*/
}, {
sortable: true, align: 'right',
dataIndex: 'AmountPaid_1_Ref',
header: '已收款',
width: 60
}, {
sortable: true, align: 'right',
dataIndex: 'AmountPaid_2_Ref',
header: '已付款',
width: 60
},
{
sortable: true,
dataIndex: 'Destination',
header: '目的地',
width: 80,
editor: {
xtype: 'textfield',
selectOnFocus: true
}
},
{
sortable: true,
dataIndex: 'ExpDate',
header: '发车日期',
width: 80,
renderer: Ext.util.Format.dateRenderer('Y-m-d'),
editor: {
format: 'Y-m-d',
xtype: 'datefield',
selectOnFocus: true
}
},
{
sortable: true,
dataIndex: 'TruckNo',
header: '车号',
width: 80,
editor: {
xtype: 'textfield',
selectOnFocus: true
}
},
{
sortable: true,
dataIndex: 'ContractNo',
header: '合同号',
width: 80,
editor: {
xtype: 'textfield',
selectOnFocus: true
}
},
{
sortable: true, //hidden: true,
dataIndex: 'MBLNO',
header: '装运单号',
width: 100,
editor: {
xtype: 'textfield',
selectOnFocus: true
}
},
{
sortable: true,
dataIndex: 'CargoQty',
header: '货物数量',
width: 80,
editor: {
xtype: 'textfield',
selectOnFocus: true
}, align: 'right'
},
{
sortable: true,
dataIndex: 'Tons',
header: '吨数(折合)',
width: 80, align: 'right'
},
{
sortable: true,
dataIndex: 'Distance',
header: '中烟运行距离',
width: 90,
editor: {
xtype: 'textfield',
selectOnFocus: true
}, align: 'right'
},
{
sortable: true,
dataIndex: 'Pay_Distance',
header: '结算距离',
width: 90,
editor: {
xtype: 'textfield',
selectOnFocus: true
}, align: 'right'
},
{
sortable: true,
dataIndex: 'BillingType',
header: '计费方式',
width: 90,
renderer: function (value, p, record) {
if (value == null || value == '') return '';
else return record.data.BillingTypeREF;
},
editor: this.comboxBillingType
},
{
sortable: true,
dataIndex: 'Price_1', //原收费费率
header: '物流部费率(元/吨公里)',
tooltip: "中烟业务操作部从物流公司收费的收费费率",
width: 80,
editor: {
xtype: 'textfield',
selectOnFocus: true
}, align: 'right'
},
{
sortable: true,
dataIndex: 'Price_2', //原付费费率
header: '操作部费率(元/吨公里)',
tooltip: "中烟业务操作部向车队付费的付费费率",
width: 80,
renderer: function (value, cellmeta, record, rowIndex, columnIndex, store) {
value = usMoney(value, 4, '', true);
return value;
},
editor: {
xtype: 'textfield',
selectOnFocus: true
}, align: 'right'
},
{
sortable: true,
dataIndex: 'Price_3', //新增加
header: '中烟公司费率(元/吨公里)',
tooltip: "中烟公司向物流部付费的付费费率",
width: 80,
editor: {
xtype: 'textfield',
selectOnFocus: true
}, align: 'right'
},
{
sortable: true,
dataIndex: 'Amount_1',
header: '操作应收物流',
width: 80,
editor: {
xtype: 'textfield',
selectOnFocus: true
}, align: 'right'
},
{
sortable: true,
dataIndex: 'agio_Amount_1',
header: '操作收物流考核金额',
width: 80,
editor: {
xtype: 'textfield',
selectOnFocus: true
}, align: 'right'
},
{
sortable: true, hidden: true,
dataIndex: 'TaxAmount_1',
header: '含税收款金额',
width: 80,
editor: {
xtype: 'textfield',
selectOnFocus: true
}, align: 'right'
},
{
sortable: true, hidden: true,
dataIndex: 'Paid_Amount_1',
header: '已收',
width: 80,
editor: {
xtype: 'textfield',
selectOnFocus: true
}, align: 'right'
},
{
sortable: true, hidden: true,
dataIndex: 'Remain_Amount_1',
header: '未收',
width: 80,
editor: {
xtype: 'textfield',
selectOnFocus: true
}, align: 'right'
},
{
sortable: true, hidden: true,
dataIndex: 'Tax',
header: '税款',
width: 80, align: 'right'
},
{
sortable: true,
dataIndex: 'Amount_2',
header: '操作应付车队',
width: 80, align: 'right'
},
{
sortable: true,
dataIndex: 'agio_Amount_2',
header: '操作付车队考核金额',
width: 80,
editor: {
xtype: 'textfield',
selectOnFocus: true
}, align: 'right'
},
{
sortable: true,
dataIndex: 'Amount_3',
header: '中烟应付物流',
width: 80, align: 'right'
},
{
sortable: true,
dataIndex: 'agio_Amount_3',
header: '中烟应付物流考核金额',
width: 80,
editor: {
xtype: 'textfield',
selectOnFocus: true
}, align: 'right'
},
{
sortable: true, hidden: true,
dataIndex: 'TaxAmount_2',
header: '含税实际应付',
width: 80
},
{
sortable: true, hidden: true,
dataIndex: 'Pay_Amount_2',
header: '业务应付',
width: 80,
editor: {
xtype: 'textfield',
selectOnFocus: true
}
},
{
sortable: true, hidden: true,
dataIndex: 'Paid_Amount_2',
header: '已付',
width: 80,
editor: {
xtype: 'textfield',
selectOnFocus: true
}
},
{
sortable: true, hidden: true,
dataIndex: 'Remain_Amount_2',
header: '未付',
width: 80,
editor: {
xtype: 'textfield'
}
},
{
sortable: true, hidden: true,
dataIndex: 'In_Province',
header: 'In_Province',
width: 80
},
{
sortable: true,
dataIndex: 'In_Province_REF',
header: '省内/省外',
width: 80
},
{
sortable: true,
dataIndex: 'PROVINCENAME',
header: '省名',
width: 80
},
{
sortable: true,
dataIndex: 'AreaName',
header: '隶属区域',
width: 80
},
{
sortable: true,
dataIndex: 'Remark',
header: '备注',
width: 180,
editor: {
xtype: 'textfield'
}
},
{
sortable: true, hidden: true,
dataIndex: 'HZSTATUS',
header: 'HZSTATUS',
width: 180
},
{
sortable: true, hidden: true,
dataIndex: 'Property',
header: 'Property',
width: 180
}],
// paging bar on the bottom
bbar: Ext.create('Ext.PagingToolbar', {
store: this.storeList,
displayInfo: true,
displayMsg: '当前显示 {0} - {1}条记录 /共 {2}条记录',
emptyMsg: "没有数据"
})
});
this.cellEditing_2 = Ext.create('Ext.grid.plugin.CellEditing', {
clicksToEdit: 1
});
this.MainCB_2 = Ext.create('Ext.selection.CheckboxModel', { checkOnly: true });
Ext.grid.RowNumberer_2 = Ext.extend(Ext.grid.RowNumberer, {
width: 50
});
var _this = this;
var groupingFeature = Ext.create('Ext.grid.feature.Grouping');
var SummaryFeature = Ext.create('Ext.grid.feature.Summary');
this.gridList_2 = new Ext.grid.GridPanel({
store: this.storeList_2,
enableHdMenu: false,
region: 'center',
loadMask: { msg: "数据加载中,请稍等..." },
trackMouseOver: true,
disableSelection: false,
selModel: this.MainCB_2,
plugins: [this.cellEditing_2],
features: [{
id: 'group',
//ftype: 'grouping',
ftype: 'groupingsummary',
groupHeaderTpl: '{name}',
hideGroupedHeader: false,
enableGroupingMenu: true
}],
columns: [new Ext.grid.RowNumberer_2()
,
{
sortable: true, hidden: true,
dataIndex: 'GID',
header: 'GID',
width: 80
},
{
sortable: true, hidden: true,
dataIndex: 'OrgCode',
header: 'OrgCode',
width: 80
},
{
sortable: true,
dataIndex: 'Destination',
header: '目的地',
width: 80/*,
editor: {
xtype: 'textfield'
}*/
},
{
sortable: true,
dataIndex: 'ExpDate',
header: '发车日期',
width: 80,
renderer: Ext.util.Format.dateRenderer('Y-m-d')
},
{
sortable: true,
dataIndex: 'TruckNo',
header: '车号',
width: 80/*,
editor: {
xtype: 'textfield'
}*/
},
{
sortable: true,
dataIndex: 'BizProperty_REF',
header: '运营模式',
width: 80/*,
editor: {
xtype: 'textfield'
}*/
},
{
sortable: true,
dataIndex: 'OWNER_REF',
header: '拥有者',
width: 80/*,
editor: {
xtype: 'textfield'
}*/
},
{
sortable: true,
dataIndex: 'ContractNo',
header: '合同号',
width: 80/*,
editor: {
xtype: 'textfield'
}*/
},
{
sortable: true, hidden: true,
dataIndex: 'MBLNO',
header: '装运号',
width: 80/*,
editor: {
xtype: 'textfield'
}*/
},
{
sortable: true,
dataIndex: 'CargoQty',
header: '货物数量',
width: 80,
summaryType: 'sum', align: 'right',
summaryRenderer: function (value, cellmeta, record, rowIndex, columnIndex, store) {
value = usMoney(value, 2, '', true);
return value;
},
renderer: function (value, cellmeta, record, rowIndex, columnIndex, store) {
value = usMoney(value, 2, '', true);
return value;
}
},
{
sortable: true,
dataIndex: 'Tons',
header: '吨数(折合)',
width: 80,
summaryType: 'sum', align: 'right',
summaryRenderer: function (value, cellmeta, record, rowIndex, columnIndex, store) {
value = usMoney(value, 2, '', true);
return value;
},
renderer: function (value, cellmeta, record, rowIndex, columnIndex, store) {
value = usMoney(value, 2, '', true);
return value;
}
},
{
sortable: true,
dataIndex: 'Distance',
header: '中烟运行距离',
width: 80,
summaryType: 'sum', align: 'right',
summaryRenderer: function (value, cellmeta, record, rowIndex, columnIndex, store) {
value = usMoney(value, 2, '', true);
return value;
},
renderer: function (value, cellmeta, record, rowIndex, columnIndex, store) {
value = usMoney(value, 2, '', true);
return value;
}
},
{
sortable: true,
dataIndex: 'Pay_Distance',
header: '结算距离',
width: 80,
summaryType: 'sum', align: 'right',
summaryRenderer: function (value, cellmeta, record, rowIndex, columnIndex, store) {
value = usMoney(value, 2, '', true);
return value;
},
renderer: function (value, cellmeta, record, rowIndex, columnIndex, store) {
value = usMoney(value, 2, '', true);
return value;
}
},
{
sortable: true,
dataIndex: 'Price_1',
header: '收款费率(元/吨公里)',
width: 80,
editor: {
xtype: 'textfield'
}
},
{
sortable: true,
dataIndex: 'Price_2',
header: '付款费率(元/吨公里)',
width: 80,
editor: {
xtype: 'textfield'
}
},
{
sortable: true,
dataIndex: 'Amount_1',
header: '收款金额',
width: 110,
editor: {
xtype: 'textfield'
},
summaryType: 'sum', align: 'right',
summaryRenderer: function (value, cellmeta, record, rowIndex, columnIndex, store) {
value = usMoney(value, 2, '', true);
return value;
},
renderer: function (value, cellmeta, record, rowIndex, columnIndex, store) {
value = usMoney(value, 2, '', true);
return value;
}
},
{
sortable: true, hidden: true,
dataIndex: 'Tax_Amount_1',
header: '含税收款金额',
width: 80,
editor: {
xtype: 'textfield'
},
summaryType: 'sum', align: 'right',
summaryRenderer: function (value, cellmeta, record, rowIndex, columnIndex, store) {
value = usMoney(value, 2, '', true);
return value;
},
renderer: function (value, cellmeta, record, rowIndex, columnIndex, store) {
value = usMoney(value, 2, '', true);
return value;
}
},
{
sortable: true,
dataIndex: 'Amount_2',
header: '付款金额',
width: 110,
editor: {
xtype: 'textfield'
},
summaryType: 'sum', align: 'right',
summaryRenderer: function (value, cellmeta, record, rowIndex, columnIndex, store) {
value = usMoney(value, 2, '', true);
return value;
},
renderer: function (value, cellmeta, record, rowIndex, columnIndex, store) {
value = usMoney(value, 2, '', true);
return value;
}
},
{
sortable: true, hidden: true,
dataIndex: 'Tax_Amount_2',
header: '含税付款金额',
width: 80,
editor: {
xtype: 'textfield'
},
summaryType: 'sum', align: 'right',
summaryRenderer: function (value, cellmeta, record, rowIndex, columnIndex, store) {
value = usMoney(value, 2, '', true);
return value;
},
renderer: function (value, cellmeta, record, rowIndex, columnIndex, store) {
value = usMoney(value, 2, '', true);
return value;
}
},
{
sortable: true, hidden: true,
dataIndex: 'In_Province',
header: 'In_Province',
width: 80
},
{
sortable: true,
dataIndex: 'In_Province_REF',
header: '省内/省外',
width: 80
},
{
sortable: true,
dataIndex: 'PROVINCENAME',
header: '省名',
width: 80
},
{
sortable: true,
dataIndex: 'AreaName',
header: '隶属区域',
width: 80
},
{
sortable: true,
dataIndex: 'Remark',
header: '备注',
width: 180,
editor: {
xtype: 'textfield'
}
}],
// paging bar on the bottom
bbar: Ext.create('Ext.PagingToolbar', {
store: this.storeList_2,
displayInfo: true,
displayMsg: '当前显示 {0} - {1}条记录 /共 {2}条记录',
emptyMsg: "没有数据"
})
});
/*
this.gridList.addListener('itemdblclick', function (dataview, record, item, index, e, b) {
this.SelectedRecord = record;
this.OprationStatus = 'edit';
DsOpenEditWin('/TruckMng/MsWlTruck/Edit');
}, this);
*/
//#region formSearch
this.storeCompany = Ext.create('DsExt.ux.RefTableStore', {
model: 'companymb', proxy: { url: '/CommMng/BasicDataRef/GetcompanyList' }
});
this.storeCompany.load({ params: { condition: ""} });
this.comboxCompany = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: '所属分公司',
forceSelection: true,
store: this.storeCompany,
name: 'OrgCode', id: "Company",
valueField: 'code',
displayField: 'name'
});
this.storeProperty = Ext.create('DsExt.ux.RefEnumStore', {});
this.storeProperty.load({ params: { enumTypeId: 99033} });
this.comboxProperty = Ext.create('DsExt.ux.RefEnumCombox', {
fieldLabel: '车辆性质', id: "Property",
store: this.storeProperty,
name: 'Property'
});
this.formSearch = Ext.widget('form', {
frame: true,
region: 'center',
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: [{
fieldLabel: '车牌号',
name: 'TruckNo'
}, {
fieldLabel: '从..发车日',
format: 'Y-m-d', id: "EXPDATE_min",
xtype: 'datefield',
name: 'EXPDATE_min'
}, {
fieldLabel: '到..发车日',
format: 'Y-m-d',
xtype: 'datefield',
name: 'EXPDATE_max'
}, {
fieldLabel: '合同号',
name: 'ContractNo'
}, {
fieldLabel: '装运号',
name: 'MBLNO'
}
]
}, {
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [this.comboxCompany,
this.comboxProperty
, {
fieldLabel: '目的地',
name: 'TARGET'
}, {
fieldLabel: '省名',
name: 'PROVINCENAME'
}
, {
fieldLabel: '隶属区域',
name: 'AREANAME'
}
]
}
]
}
]
});
//#endregion formSearch
me = this;
this.formSetPrice = Ext.widget('form', {
frame: true,
region: 'center',
bodyPadding: 5,
fieldDefaults: {
margins: '2 2 2 2',
labelAlign: 'right',
flex: 2,
labelWidth: 90,
msgTarget: 'qtip'
},
items: [
{//fieldset 1
xtype: 'container',
defaultType: 'textfield',
layout: 'anchor',
defaults: {
anchor: '100%'
},
items: [{
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [{
fieldLabel: '操作部收物流费率',
//format: 'Y-m',
xtype: 'textfield',
name: 'Price_1'
}, {
fieldLabel: '中烟付物流费率',
//format: 'Y-m',
xtype: 'textfield',
name: 'Price_3'
}]
}, {
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [{
fieldLabel: '操作部付车队费率',
//format: 'Y-m',
xtype: 'textfield',
name: 'Price_2'
}, {
fieldLabel: '业务应付',
//format: 'Y-m',
xtype: 'textfield',
name: 'Pay_Amount_2'
}]
}
]//end items(fieldset 1)
}//end fieldset 1
]//end root items
});
this.winSetPrice = Ext.create('Ext.window.Window', {
title: "设定费率",
width: 450,
//height : 120,
//plain : true,
iconCls: "addcomm",
resizable: false,
// 是否可以拖动
// draggable:false,
collapsible: true, // 允许缩放条
closeAction: 'close',
closable: true,
modal: 'true',
buttonAlign: "center",
bodyStyle: "padding:0 0 0 0",
items: [this.formSetPrice],
buttons: [{
text: "设定费率(空白项不变)",
minWidth: 70,
handler: function () {
me.onSetPriceClick();
}
}, {
text: "关闭",
minWidth: 70,
handler: function () {
me.winSetPrice.close();
}
}]
});
this.formSettlement = Ext.widget('form', {
frame: true,
region: 'center',
bodyPadding: 5,
fieldDefaults: {
margins: '2 2 2 2',
labelAlign: 'right',
flex: 2,
labelWidth: 90,
msgTarget: 'qtip'
},
items: [
{//fieldset 1
xtype: 'container',
defaultType: 'textfield',
layout: 'anchor',
defaults: {
anchor: '100%'
},
items: [{
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [{
fieldLabel: '结算费用',
//format: 'Y-m',
xtype: 'textfield',
name: 'Amount_ALL',
values: "0"
}]
}/*, {
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [{
fieldLabel: '付费费率',
//format: 'Y-m',
xtype: 'textfield',
name: 'Price_2'
}]
}*/
]//end items(fieldset 1)
}//end fieldset 1
]//end root items
});
this.winSettlement = Ext.create('Ext.window.Window', {
title: "费用结算",
width: 400,
//height : 120,
//plain : true,
iconCls: "addcomm",
resizable: false,
// 是否可以拖动
// draggable:false,
collapsible: true, // 允许缩放条
closeAction: 'close',
closable: true,
modal: 'true',
buttonAlign: "center",
bodyStyle: "padding:0 0 0 0",
items: [this.formSettlement],
buttons: [{
text: "结算",
id: "BUTTON",
minWidth: 70,
handler: function () {
me.onSettlementClick();
}
}, {
text: "取消",
minWidth: 70,
handler: function () {
me.winSettlement.close();
}
}]
});
var menu1 = new Ext.menu.Menu({
id: 'basicMenu',
items: [{
text: '运费审核汇总表',
handler: clickHandler
}, {
text: '应付车队表',
handler: clickHandler_YFCD
}
]
});
function clickHandler() {
panelTest.Print();
};
function clickHandler_YFCD() {
panelTest.Print_YFCD();
};
var menu_Settlement = new Ext.menu.Menu({
id: 'PriceMenu',
items: [{
text: '收费结算',
handler: clickHandler_1
}, {
text: '付费结算',
handler: clickHandler_2
}, {
text: '收费反结算',
handler: clickHandler_3
}, {
text: '付费反结算',
handler: clickHandler_4
}]
});
var _this = this;
function clickHandler_1() {
SetPaid('AmountPaid_1', 'AmountPaid_1_Ref', "1", "是");
};
function clickHandler_2() {
SetPaid('AmountPaid_2', 'AmountPaid_2_Ref', "1", "是");
};
function clickHandler_3() {
SetPaid('AmountPaid_1', 'AmountPaid_1_Ref', "0", "否");
};
function clickHandler_4() {
SetPaid('AmountPaid_2', 'AmountPaid_2_Ref', "0", "否");
};
function SetPaid(sf, sf_Ref, paid, paid_Ref) {
selectedRecords = _this.gridList.selModel.getSelection();
for (var i = 0; i < selectedRecords.length; i++) {
var rec = selectedRecords[i];
rec.set(sf, paid);
rec.set(sf_Ref, paid_Ref);
}
}
/*
function clickHandler_1() {
me.SettlementType = "1";
var form = me.formSettlement.getForm();
var edt_Amount_ALL = form.findField('Amount_ALL');
var Amount_ALL = me.GetAmount_ALL("Remain_Amount_1");
if (Amount_ALL == "" || Amount_ALL == undefined) {
Amount_ALL = "0";
}
me.Amount_ALL = Amount_ALL;
edt_Amount_ALL.setRawValue(Amount_ALL);
edt_Amount_ALL.setFieldLabel("应收金额");
Ext.getCmp("BUTTON").setText("结算应收");
//form.findField('Type').setRawValue(me.Type); ;
me.winSettlement.show();
};
function clickHandler_2() {
me.SettlementType = "2";
var form = me.formSettlement.getForm();
var edt_Amount_ALL = form.findField('Amount_ALL');
var Amount_ALL = me.GetAmount_ALL("Remain_Amount_2");
if (Amount_ALL == "" || Amount_ALL == undefined) {
Amount_ALL = "0";
}
me.Amount_ALL = Amount_ALL;
edt_Amount_ALL.setRawValue(Amount_ALL);
edt_Amount_ALL.setFieldLabel("应付金额");
Ext.getCmp("BUTTON").setText("结算应付");
//form.findField('Type').setRawValue(me.Type); ;
me.winSettlement.show();
};
function clickHandler_3() {
me.SettlementType = "3";
var form = me.formSettlement.getForm();
var edt_Amount_ALL = form.findField('Amount_ALL');
var Amount_ALL = me.GetAmount_ALL("Paid_Amount_1");
if (Amount_ALL == "" || Amount_ALL == undefined) {
Amount_ALL = "0";
}
me.Amount_ALL = Amount_ALL;
edt_Amount_ALL.setRawValue(Amount_ALL);
edt_Amount_ALL.setFieldLabel("反结算应收金额");
Ext.getCmp("BUTTON").setText("反结算应收");
//form.findField('Type').setRawValue(me.Type); ;
me.winSettlement.show();
};
function clickHandler_4() {
me.SettlementType = "4";
var form = me.formSettlement.getForm();
var edt_Amount_ALL = form.findField('Amount_ALL');
var Amount_ALL = me.GetAmount_ALL("Paid_Amount_2");
if (Amount_ALL == "" || Amount_ALL == undefined) {
Amount_ALL = "0";
}
me.Amount_ALL = Amount_ALL;
edt_Amount_ALL.setRawValue(Amount_ALL);
edt_Amount_ALL.setFieldLabel("反结算应付金额");
Ext.getCmp("BUTTON").setText("反结算应付");
//form.findField('Type').setRawValue(me.Type); ;
me.winSettlement.show();
};*/
//查询工具条
//var me = this;
this.panelBtn = new Ext.Panel({
region: "north",
tbar: [{
text: "设定费率", hidden: true,
iconCls: "btncomm",
handler: function (button, event) {
var form = this.formSetPrice.getForm();
this.winSetPrice.show();
},
scope: this
}, { text: "结算", iconCls: "img_money_yen", hidden: true,
menu: menu_Settlement, scope: this
}/*, {
text: "结算",
iconCls: "img_money_yen",
handler: function (button, event) {
var form = this.formSettlement.getForm();
var Amount_ALL = form.findField('Amount_ALL');
//_Amount_ALL = 0;
Amount_ALL.setRawValue(this.Amount_ALL)
this.winSettlement.show();
},
scope: this
}*/, '-', //img_money_yen
{
text: "新建", hidden: true,
iconCls: "btnadd",
handler: function (button, event) {
this.onAddClick(button, event);
},
scope: this
},
{
text: "删除",
iconCls: "btndelete",
handler: function (button, event) {
this.onDeleteClick(button, event);
},
scope: this
}, {
text: "保存修改",
iconCls: "btnsave",
handler: function (button, event) {
this.Save(button, event);
},
scope: this
},
'-',
{
text: "执行查询",
iconCls: "btnrefresh",
handler: function (button, event) {
this.onRefreshClick(button, event);
},
scope: this
},
{
text: "重置条件",
iconCls: "btnreset",
handler: function (button, event) {
this.onResetClick(button, event);
},
scope: this
}, '-',
{
text: "提交审核",
iconCls: "btnoperation",
handler: function (button, event) {
this.onSubmitClick("提交审核");
},
scope: this
}, {
text: "撤回提交",
iconCls: "btncancel",
handler: function (button, event) {
this.onSubmitClick("撤回提交");
},
scope: this
}, '-', {
text: "导入路单",
iconCls: "btnexportexcel",
handler: function (button, event) {
var winAccess = new DsTruck.FileImport({});
winAccess.StoreList = this.storeList;
winAccess.show();
},
scope: this
}, {
text: "导出Excel",
id: "btnExportExcel",
iconCls: 'btnexportexcel',
handler: function (button, event) {
this.onExportClick(button, event);
},
scope: this
}, '-',
{ text: "打印报表", menu: menu1, scope: this }
]
});
this.panelTop = new Ext.Panel({
layout: "border",
region: "north",
height: 100,
items: [this.formSearch, this.panelBtn]
});
this.page_1 = new Ext.Panel({
id: "page_1",
title: "路单信息",
//autoScroll: true,
layout: "border",
region: 'center',
items: [this.gridList]
});
this.page_2 = new Ext.Panel({
id: "page_2",
title: "单车业务小计",
layout: "border",
region: 'center',
items: [this.gridList_2]
});
this.MainTab = new Ext.tab.Panel({
//layout: "border",
region: "center", //split: true,
items: [this.page_1, this.page_2
]
});
Ext.apply(this, {
items: [this.panelTop, this.MainTab]
});
//集中绑定 事件
this.storeList.on('beforeload', function (store) {
var sql = this.getCondition();
Ext.apply(store.proxy.extraParams, { condition: sql });
}, this);
this.storeList_2.on('beforeload', function (store) {
var sql = this.getCondition();
Ext.apply(store.proxy.extraParams, { condition: sql });
}, this);
this.cellEditing.on('beforeedit', function (editor, e) {
return this.HZBeforeEdit(editor, e);
}, this);
this.gridList.on('edit', function (editor, e, eOpts) {
this.HZAfterEdit(editor, e, eOpts);
}, this);
/*
this.gridList.getSelectionModel().on('select', function (button, event) {
this.onSelectFee(button, event);
}, this);*/
var sql = this.getCondition();
this.storeList.load({
params: { start: 0, limit: this.PageSize, sort: '', condition: sql },
waitMsg: "正在查询数据...",
scope: this
});
this.storeList_2.load({
params: { start: 0, limit: this.PageSize, sort: '', condition: sql },
waitMsg: "正在查询数据...",
scope: this
});
var me = this;
Ext.Ajax.request({
waitMsg: '正在查询用户权限...',
async: false,
url: '/CommMng/BasicDataRef/GetAuthorityRange',
params: {
modName: "modJY_ZY",
USERID: USERID
},
callback: function (options, success, response) {
if (success) {
var result = Ext.JSON.decode(response.responseText);
rec = result.data;
//alert(rec.VISIBLERANGE);
//alert(rec.OPERATERANGE);
//可操作为0则全都不可操作
//1 只能修改操作收物流应收考核
//2 只能修改操作付车队应付考核
me.VISIBLERANGE = rec.VISIBLERANGE;
me.OPERATERANGE = rec.OPERATERANGE;
/*
if (this.OPERATERANGE == '0') {
canedit = true;
} else
if (this.OPERATERANGE == '1') {
if (e.field == 'agio_Amount_1')
canedit = true;
if (e.field == 'agio_Amount_2')
canedit = false;
if (e.field == 'agio_Amount_3')
canedit = true;
} else
if (this.OPERATERANGE == '2') {
if (e.field == 'agio_Amount_1')
canedit = false;
if (e.field == 'agio_Amount_2')
canedit = true;
if (e.field == 'agio_Amount_3')
canedit = false;
}*/
}
else
Ext.MessageBox.alert('请求出现错误,请重试', response.responseText);
},
scope: this
}); //request over
}, //end initUIComponents
onRefreshClick: function (button, event) {
this.storeList.removeAll();
this.storeList_2.removeAll();
var sql = this.getCondition();
this.storeList.load({
params: { start: 0, limit: this.PageSize, sort: '', condition: sql },
waitMsg: "正在查询数据...",
scope: this
});
this.storeList_2.load({
params: { start: 0, limit: this.PageSize, sort: '', condition: sql },
waitMsg: "正在查询数据...",
scope: this
});
},
onResetClick: function (button, event) {
this.formSearch.getForm().reset();
},
onAddClick: function (button, event) {
function newID() {
var guid = "";
for (var i = 1; i <= 32; i++) {
var n = Math.floor(Math.random() * 16.0).toString(16);
guid += n;
if ((i == 8) || (i == 12) || (i == 16) || (i == 20))
guid += "-";
}
return guid.toUpperCase();
}
var newid = newID();
var record = Ext.create('HH_ZYmb', {
'GID': '',
'OrgCode': '',
'Destination': '',
'ExpDate': '',
'TruckNo': '',
'ContractNo': '',
'MBLNO': '',
'CargoQty': '0',
'Tons': '0',
'Distance': '0',
'Pay_Distance': '0',
'Price_1': '0',
'Price_2': '0',
'Amount_1': '0',
'Amount_2': '0',
'In_Province': '1',
'In_Province_REF': '',
'Remark': '',
'Paid_Amount_1': '0',
'Paid_Amount_2': '0',
'Remain_Amount_1': '0',
'Remain_Amount_2': '0',
'HZSTATUS': '1',
'HZSTATUS_REF': '',
'BizProperty_REF': '',
'OWNER_REF': ''
});
this.storeList.add(record);
var n = this.storeList.getCount();
this.cellEditing.startEditByPosition({ row: n - 1, column: 2 });
},
onDeleteClick: function (button, event) {
var selectedRecords = this.gridList.selModel.getSelection();
Ext.MessageBox.confirm('提示', '确定删除记录吗?', function (btn) {
if (btn == 'yes') {
for (var i = 0; i < selectedRecords.length; i++) {
var rec = selectedRecords[i];
if (rec.id != "") //如果是新增但没有保存的数据,没有必要提交到后台
{
this.bodyDel.push(rec);
}
this.storeList.remove(selectedRecords[i]);
}
}
}, this);
}, //onDeleteClick
Save: function (button, event) {
//费用
var bodyList = [];
for (i = 0; i < this.storeList.getCount(); i += 1) {
var member = this.storeList.getAt(i);
bodyList.push(member);
};
var jsonBody = ConvertRecordsToJson(bodyList);
var jsonDelBody = ConvertRecordsToJsonAll(this.bodyDel);
if (jsonBody == '' && jsonDelBody == '') {
return;
}
Ext.Msg.wait('正在保存数据, 请稍侯..');
Ext.Ajax.request({
waitMsg: '正在保存数据...',
url: '/TruckMng/MsWl_HH_ZY/Save',
scope: this,
params: {
body: jsonBody,
delbody: jsonDelBody
},
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.storeList.commitChanges();
} 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');
}
});
},
getCondition: function () {
var form = this.formSearch.getForm();
if (!form.isValid()) {
Ext.Msg.alert('提示', '查询条件赋值错误,请检查。');
return '';
}
var sql = '';
var truckNo = form.findField('TruckNo').getValue();
sql = sql + getAndConSql(sql, truckNo, "TruckNo like '%" + truckNo + "%'");
var EXPDATE_min = form.findField('EXPDATE_min').getRawValue();
sql = sql + getAndConSql(sql, EXPDATE_min, "EXPDATE >= '" + EXPDATE_min + "'");
var EXPDATE_max = form.findField('EXPDATE_max').getRawValue();
sql = sql + getAndConSql(sql, EXPDATE_max, "EXPDATE <= '" + EXPDATE_max + " 23:59:59'");
var ContractNo = form.findField('ContractNo').getValue();
sql = sql + getAndConSql(sql, ContractNo, "ContractNo like '%" + ContractNo + "%'");
var MBLNO = form.findField('MBLNO').getValue();
sql = sql + getAndConSql(sql, MBLNO, "MBLNO like '%" + MBLNO + "%'");
var OrgCode = form.findField('OrgCode').getValue();
sql = sql + getAndConSql(sql, OrgCode, " TruckNo in( select truckno from tmswltruck where OrgCode= '" + OrgCode + "') ");
var Property = form.findField('Property').getValue();
sql = sql + getAndConSql(sql, Property, " TruckNo in( select truckno from tmswltruck where Property= '" + Property + "') ");
var AREANAME = form.findField('AREANAME').getValue();
sql = sql + getAndConSql(sql, AREANAME, " Destination in(select name from City_Distance where areaname like '%" + AREANAME + "%') ");
var TARGET = form.findField('TARGET').getValue();
sql = sql + getAndConSql(sql, TARGET, " Destination like '%" + TARGET + "%'");
var PROVINCENAME = form.findField('PROVINCENAME').getValue();
sql = sql + getAndConSql(sql, PROVINCENAME, " Destination in(select name from City_Distance where ProvinceName like '%" + PROVINCENAME + "%' or name like '" + AREANAME + "') ");
return sql;
},
onImportBsClick: function (button, event) {
var winAccess = new DsTruck.FileImport({
});
winAccess.StoreList = this.storeList;
winAccess.show();
return;
},
OprationSwap: function () {
var ret = new Array();
ret[0] = this.OprationStatus;
ret[1] = this.storeList;
ret[2] = this.SelectedRecord;
return ret;
},
onSetPriceClick: function (button, event) {
var GIdSql = '';
var selectedRecords = this.gridList.selModel.getSelection();
var form = this.formSetPrice.getForm();
for (var i = 0; i < selectedRecords.length; i++) {
var rec = selectedRecords[i];
if (rec.data.HZSTATUS == "1" || rec.data.HZSTATUS == "6") {
var GID = "'" + rec.data.GID + "'";
if (GIdSql == '') {
GIdSql = GID;
} else {
GIdSql = GIdSql + "," + GID;
}
} else {
alert("不能为提交审核/审核通过的业务设定费率");
return;
}
}
if (GIdSql == '') {
Ext.Msg.show({ title: '提示', msg: '没有选择要设定费率的业务!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
return;
};
GIdSql = " (" + GIdSql + ")";
var Price_1 = form.findField('Price_1').getValue();
var Price_2 = form.findField('Price_2').getValue();
var Price_3 = form.findField('Price_3').getValue();
if (Price_2 = "") {
Price_2 = Cut(parseFloat(Price_1), "0.01", 2);
}
var Pay_Amount_2 = form.findField('Pay_Amount_2').getValue();
if (Price_1 != "") {
if (parseFloat(Price_1) < 0) {
alert("请输入正数");
return;
}
}
if (Price_2 != "") {
if (parseFloat(Price_2) < 0) {
alert("请输入正数");
return;
}
}
if (Pay_Amount_2 != "") {
if (parseFloat(Pay_Amount_2) < 0) {
alert("请输入正数");
return;
}
}
Ext.Ajax.request({
waitMsg: '正在添加数据...',
url: '/TruckMng/MsWl_HH_ZY/SetPrice',
params: {
Price_1: Price_1,
Price_2: Price_2,
Price_3: Price_3,
Pay_Amount_2: Pay_Amount_2,
GIdSql: GIdSql
},
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;
} else {
this.winSetPrice.close();
this.onRefreshClick();
}
} else {
Ext.MessageBox.alert('请求出现错误,请重试', response.responseText);
}
},
scope: this
});
},
onSettlementClick: function (button, event) {
var GIdSql = '';
var selectedRecords = this.gridList.selModel.getSelection();
var form = this.formSettlement.getForm();
for (var i = 0; i < selectedRecords.length; i++) {
var rec = selectedRecords[i];
if (rec.data.HZSTATUS == "0") {
var GID = "'" + rec.data.GID + "'";
if (GIdSql == '') {
GIdSql = GID;
} else {
GIdSql = GIdSql + "," + GID;
}
} else {
alert("请先审核通过");
return;
}
}
if (GIdSql == '') {
Ext.Msg.show({ title: '提示', msg: '没有选择要结算的业务!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
return;
};
var Amount_Settlement = form.findField('Amount_ALL').getRawValue();
if (parseFloat(Amount_Settlement) > parseFloat(this.Amount_ALL)) {
alert("结算金额大于选定业务的可结算金额,请重新填写");
return;
}
Ext.Ajax.request({
waitMsg: '正在添加数据...',
url: '/TruckMng/MsWl_HH_ZY/SetSettlement',
params: {
GIDList: GIdSql,
Amount_Settlement: Amount_Settlement,
Type: this.SettlementType
},
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;
} else {
this.winSettlement.close();
this.onRefreshClick();
}
} else {
Ext.MessageBox.alert('请求出现错误,请重试', response.responseText);
}
},
scope: this
});
},
onSubmitClick: function (Operation) {
var GIdSql = '';
var selectedRecords = this.gridList.selModel.getSelection();
var form = this.formSettlement.getForm();
for (var i = 0; i < selectedRecords.length; i++) {
var rec = selectedRecords[i];
/*
if (rec.data.HZSTATUS != "1") {
alert("只能提交录入状态的业务");
return;
}*/
if (rec.data.ISVOU != '是') {
var GID = "'" + rec.data.GID + "'";
if (GIdSql == '') {
GIdSql = GID;
} else {
GIdSql = GIdSql + "," + GID;
}
}
}
if (GIdSql == '') {
Ext.Msg.show({ title: '提示', msg: '没有选择业务!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
return;
};
var _U = "";
if (Operation == "提交审核") {
_U = '/TruckMng/MsWl_HH_ZY/Submit';
}
if (Operation == "撤回提交") {
_U = '/TruckMng/MsWl_HH_ZY/Repeal';
}
Ext.Ajax.request({
waitMsg: '正在添加数据...',
url: _U,
params: {
GIDList: GIdSql
},
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;
} else {
this.winSettlement.close();
this.onRefreshClick();
}
} else {
Ext.MessageBox.alert('请求出现错误,请重试', response.responseText);
}
},
scope: this
});
},
onExportClick: function (button, event) {
var _p = this.MainTab.getActiveTab().id;
if (_p == "page_1") {
GridExportExcelPage(this.gridList);
}
if (_p == "page_2") {
GridExportExcelPage(this.gridList_2);
}
},
GetAmount_ALL: function (FieldName) {
//Ext.getCmp("zongshu").setText("1234");
var selectedRecords = this.gridList.selModel.getSelection();
var sum = 0;
for (var i = 0; i < selectedRecords.length; i++) {
var rec = selectedRecords[i];
if (rec.get(FieldName) != "") {
sum = sum + parseFloat(rec.get(FieldName));
}
}
return sum.toString();
//sum = sum.toFixed(2);
//Ext.getCmp("zongshu").setText(" 选中金额:" + sum);
},
HZBeforeEdit: function (editor, e) {
var canedit = true;
var HZSTATUS = e.record.get('HZSTATUS');
if (HZSTATUS == "1" || HZSTATUS == "6") {
canedit = true;
}
else {
canedit = false;
}
if (e.field == 'agio_Amount_1' || e.field == 'agio_Amount_2' || e.field == 'agio_Amount_3') {
if (this.OPERATERANGE == '0') {
canedit = false;
} else
if (this.OPERATERANGE == '1') {
if (e.field == 'agio_Amount_1')
canedit = true;
if (e.field == 'agio_Amount_2')
canedit = false;
if (e.field == 'agio_Amount_3')
canedit = true;
} else
if (this.OPERATERANGE == '2') {
if (e.field == 'agio_Amount_1')
canedit = false;
if (e.field == 'agio_Amount_2')
canedit = true;
if (e.field == 'agio_Amount_3')
canedit = true;
}
}
if (e.field == 'Price_1' || e.field == 'Remark' || e.field == 'MBLNO' || e.field == 'agio_Amount_1' || e.field == 'agio_Amount_2' || e.field == 'agio_Amount_3') {
}
else {
var HZSTATUS = e.record.get('HZSTATUS');
if (HZSTATUS == "1" || HZSTATUS == "6") {
canedit = true;
}
else {
canedit = false;
}
}
if (e.field == 'Paid_Amount_1' || e.field == 'Paid_Amount_2') {
var HZSTATUS = e.record.get('HZSTATUS');
if (HZSTATUS == "0") {
canedit = true;
}
else {
canedit = false;
}
}
return canedit;
},
HZAfterEdit: function (editor, e, eOpts) {
//需要自己实现里面的事件
if (e.value == e.originalValue) { return; }
if (e.field == 'CargoQty') {
if (e.value != "") {
CargoQty = parseFloat(e.record.get('CargoQty'));
Tons = CargoQty / 50;
e.record.set('Tons', Tons);
}
this.SetAmount(e);
}
if (e.field == 'Distance' || e.field == 'Pay_Distance') {
this.SetAmount(e);
}
if (e.field == 'Price_1' || e.field == 'agio_Amount_1') {
this.SetAmount(e);
}
if (e.field == 'Price_2' || e.field == 'agio_Amount_2') {
this.SetAmount(e);
}
if (e.field == 'Price_3' || e.field == 'agio_Amount_3') {
this.SetAmount(e);
}
if (e.field == 'Pay_Amount_2') {
if (e.value == "") Pay_Amount_2 = 0;
if (e.value != "") {
if (Property == '2') {
var Tax = Mul(parseFloat(e.record.get('Price_2')), 0.045);
Amount_2 = parseFloat(e.value) - Tax;
e.record.set('Tax', Tax);
e.record.set('Amount_2', Amount_2);
if (Paid_Amount_2 == 0) {
e.record.set('Remain_Amount_2', Amount_2);
}
} else {
var Tax = 0;
Amount_2 = parseFloat(e.value);
e.record.set('Tax', Tax);
e.record.set('Amount_2', Amount_2);
if (Paid_Amount_2 == 0) {
e.record.set('Remain_Amount_2', Amount_2);
}
}
}
}
if (e.field == 'BillingType') {
var BSrecords = DsStoreQueryBy(this.storeBillingType, 'BillingType', e.value);
if (BSrecords.getCount() > 0) {
var BSdata = BSrecords.getAt(0).data;
e.record.set('BillingTypeREF', BSdata.BillingTypeREF);
this.SetAmount(e);
} else {
e.record.set('BillingTypeREF', '');
}
}
},
SetAmount: function (e) {
var CargoQty = parseFloat(e.record.get('CargoQty'));
var Tons = parseFloat(e.record.get('Tons'));
var Price_1 = parseFloat(e.record.get('Price_1'));
var Price_2 = parseFloat(e.record.get('Price_2'));
var Price_3 = parseFloat(e.record.get('Price_3'));
var Distance = parseFloat(e.record.get('Distance'));
var Pay_Distance = parseFloat(e.record.get('Pay_Distance'));
var Amount_1 = parseFloat(e.record.get('Amount_1'));
var Amount_2 = parseFloat(e.record.get('Amount_2'));
var Paid_Amount_1 = parseFloat(e.record.get('Paid_Amount_1'));
var Paid_Amount_2 = parseFloat(e.record.get('Paid_Amount_2'));
var Remain_Amount_1 = parseFloat(e.record.get('Remain_Amount_1'));
var Remain_Amount_2 = parseFloat(e.record.get('Remain_Amount_2'));
var BillingType = parseFloat(e.record.get('BillingType'));
var Pay_Amount_2 = parseFloat(e.record.get('Pay_Amount_2'));
var Property = parseFloat(e.record.get('Property'));
var agio_Amount_1 = parseFloat(e.record.get('agio_Amount_1'));
var agio_Amount_2 = parseFloat(e.record.get('agio_Amount_2'));
var TaxAmount_1 = parseFloat(e.record.get('TaxAmount_1'));
var TaxAmount_2 = parseFloat(e.record.get('TaxAmount_2'));
if (e.value != "") {
Price_1 = parseFloat(e.record.get('Price_1'));
if (BillingType == "0") {
Amount_1 = Mul3(Tons, Distance, Price_1);
e.record.set('Amount_1', Amount_1);
if (Paid_Amount_1 == 0) {
e.record.set('Remain_Amount_1', Amount_1);
}
} else if (BillingType == "1") {
Amount_1 = Mul(Distance, Price_1);
e.record.set('Amount_1', Amount_1);
if (Paid_Amount_1 == 0) {
e.record.set('Remain_Amount_1', Amount_1);
}
}
e.record.set('Amount_1', Amount_1);
if (Paid_Amount_1 == 0) {
e.record.set('Remain_Amount_1', Amount_1);
}
//TaxAmount_1 = Mul(Mul((Amount_1 + agio_Amount_1), 0.93), 1.11);
//e.record.set('TaxAmount_1', TaxAmount_1);
}
if (e.value != "") {
Price_2 = parseFloat(e.record.get('Price_2'));
if (BillingType == "0") {
Amount_2 = Mul3(Tons, Distance, Price_2);
e.record.set('Amount_2', Amount_2);
if (Paid_Amount_2 == 0) {
e.record.set('Remain_Amount_2', Amount_2);
}
} else if (BillingType == "1") {
Amount_2 = Mul(Distance, Price_2);
e.record.set('Amount_2', Amount_2);
if (Paid_Amount_2 == 0) {
e.record.set('Remain_Amount_2', Amount_2);
}
}
e.record.set('Amount_2', Amount_2);
if (Paid_Amount_2 == 0) {
e.record.set('Remain_Amount_2', Amount_2);
}
//TaxAmount_2 = Mul(Mul((Amount_2 + agio_Amount_2), 0.93), 1.11);
//e.record.set('TaxAmount_2', TaxAmount_2);
}
if (e.value != "") {
Price_3 = parseFloat(e.record.get('Price_3'));
if (BillingType == "0") {
Amount_3 = Mul3(Tons, Distance, Price_3);
e.record.set('Amount_3', Amount_3);
} else if (BillingType == "1") {
Amount_3 = Mul(Distance, Price_3);
e.record.set('Amount_3', Amount_3);
}
e.record.set('Amount_3', Amount_3);
}
},
Print: function () {
//alert("print");
var printType = 'YFSHHZB'; //运费审核汇总表
var T = this.getCondition();
if (T != "") { T = " where " + T; }
var sql1 = " select Destination,orgcode,dbo.trimdate(expdate) expdate,TruckNo,dbo.[ZY_GetContractNo](TruckNo,expdate,Destination) contractno ";
sql1 = sql1 + " ,(select AreaName from City_Distance WHERE Name LIKE hz.Destination) as AreaName ";
sql1 = sql1 + " ,(select ProvinceName from City_Distance WHERE Name LIKE hz.Destination) as 省名 ";
sql1 = sql1 + " ,dbo.[ZY_GetMBLNO](TruckNo,expdate,Destination) MBLNO,Price_1,sum(Amount_1) Amount_1,Price_2,sum(Amount_2) Amount_2 ";
sql1 = sql1 + " ,case in_Province when 0 then '省外' else '省内' end in_Province_ref ";
sql1 = sql1 + " ,sum(CargoQty) CargoQty,sum(tons) tons,Distance,sum(Paid_Amount_1) [Paid_Amount_1] ";
sql1 = sql1 + " ,sum(Paid_Amount_2) [Paid_Amount_2],sum([Amount_1]-[Paid_Amount_1]) Remain_Amount_1,sum([Amount_2]-[Paid_Amount_2]) Remain_Amount_2 ,HZSTATUS ";
sql1 = sql1 + " ,(select EnumValueName from tSysEnumValue where LangId=0 and EnumTypeID=99024 and EnumValueID=HZSTATUS) as HZSTATUS_REF ";
sql1 = sql1 + " ,(select EnumValueName from tSysEnumValue where LangId=0 and EnumTypeID=99033 and EnumValueID=( ";
sql1 = sql1 + " select BizProperty from tMsWlTruck where truckno=hz.truckno)) as BizProperty_REF ";
sql1 = sql1 + " ,(select shortname from info_client where gid=( ";
sql1 = sql1 + " select owner from tMsWlTruck where truckno=hz.truckno)) as OWNER_REF,sum(tax) tax,sum(Pay_Amount_2) Pay_Amount_2 ";
sql1 = sql1 + " FROM [tMsWl_HH_ZY] hz " + T;
sql1 = sql1 + " group by Destination,expdate,TruckNo,Price_1,Price_2,orgcode,in_Province,Distance,HZSTATUS,tax,Pay_Amount_2 ";
sql1 = sql1 + " order by expdate"
var sql2 = " select Destination 城市,orgcode,dbo.trimdate(expdate) 发运日期,TruckNo 车号,dbo.[ZY_GetContractNo](TruckNo,expdate,Destination) 合同号 ";
sql2 = sql2 + " ,(select AreaName from City_Distance WHERE Name LIKE hz.Destination) as AreaName ";
sql2 = sql2 + " ,(select ProvinceName from City_Distance WHERE Name LIKE hz.Destination) as 省名 ";
sql2 = sql2 + " ,dbo.[ZY_GetMBLNO](TruckNo,expdate,Destination) 装运号,Price_1,sum(Amount_1) Amount_1,Price_2 ";
sql2 = sql2 + " ,sum(Amount_2) Amount_2,Price_3 运价标准,sum(isnull(Amount_3,0)+isnull(agio_amount_3,0)) 运费总额 ";
sql2 = sql2 + " ,case in_Province when 0 then '省外' else '省内' end 省际 ";
sql2 = sql2 + " ,case BillingType when 0 then '吨公里' else '车公里' end 计费方式 ";
sql2 = sql2 + " ,sum(CargoQty) [运量(万支)],sum(tons) 计费吨数,Distance 计费里程 ";
sql2 = sql2 + " ,(select EnumValueName from tSysEnumValue where LangId=0 and EnumTypeID=99033 and EnumValueID=( ";
sql2 = sql2 + " select BizProperty from tMsWlTruck where truckno=hz.truckno)) as 车辆性质 ";
sql2 = sql2 + " ,(select shortname from info_client where gid=( ";
sql2 = sql2 + " select owner from tMsWlTruck where truckno=hz.truckno)) as 车辆所属 ";
sql2 = sql2 + " FROM [tMsWl_HH_ZY] hz " + T;
sql2 = sql2 + " group by Destination,expdate,TruckNo,Price_1,Price_2,Price_3,orgcode,in_Province,Distance,BillingType ";
sql2 = sql2 + " order by expdate"
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 printdate = GetDateStr(0);
//var getmoneydate = GetDateStr(5);
var sql3 = "select '" + printdate + "'";
var sql4 = "";
var sql5 = "";
var sql6 = "";
PrintComm(printType, sql1, sql2, sql3, sql4, sql5, sql6);
}
,
Print_YFCD: function () {
//alert("print");
var printType = 'ZY_Print_YFCD'; //应付车队表
var T = this.getCondition();
if (T != "") { T = " where " + T; }
var sql1 = " select expdate 派车日期,truckno 车号,Destination 目的地,sum(CargoQty) 数量,sum(Tons) 吨数 ";
sql1 = sql1 + " ,(select name from company where codename=(select orgcode from tmswltruck tt where tt.truckno=hz.truckno)) 车辆所属分公司";
sql1 = sql1 + " ,Distance 里程,Price_2 费率,sum(Amount_2+agio_Amount_2) 应付运费,case sum(isnull(agio_Amount_2,0)) when 0 then '' else convert(varchar,sum(isnull(agio_Amount_2,0))) end 备注 from tMsWl_HH_ZY hz " + T;
sql1 = sql1 + " group by expdate ,truckno,Destination,Distance,Price_2 ";
sql1 = sql1 + " order by expdate"
var sql2 = "";
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 printdate = GetDateStr(0);
//var getmoneydate = GetDateStr(5);
var _date = Ext.getCmp("EXPDATE_min").getRawValue();
var _y = _date.substr(0, 4);
var _m = _date.substr(5, 2);
var _company = Ext.getCmp("Company").getRawValue();
var _Property = Ext.getCmp("Property").getRawValue();
var sql3 = "select '" + SHOWNAME + "' 姓名,'" + printdate + "' 打印日期,'" + _y + "' 年,'" + _m + "' 月,'" + _company + _Property + "' 性质";
var sql4 = "";
var sql5 = "";
var sql6 = "";
PrintComm(printType, sql1, sql2, sql3, sql4, sql5, sql6);
}
});