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/MvcShipping/Viewsjs/MsRptSaleLiRunTiCheng/MsRptSaleLiRunTiChengIndex.js

1255 lines
52 KiB
JavaScript

This file contains ambiguous Unicode characters!

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

//销售报表_业务员提成
Ext.namespace('Shipping');
Shipping.MsRptSaleLiRunTiChengIndex = function (config) {
Ext.applyIf(this, config);
this.initUIComponents();
window.Shipping.MsRptSaleLiRunTiChengIndex.superclass.constructor.call(this);
};
Ext.extend(Shipping.MsRptSaleLiRunTiChengIndex, Ext.Panel, {
PageSize: 20000,
SelectedRecord: null,
OprationStatus: null,
sqlcontext: '',
strCwSTARTGID: '',
initUIComponents: function () {
this.formname = 'MsRptSaleLiRunTiChengIndex'; //销售报表_业务员提成
//#region 主列表_定义数据集
this.storeList = Ext.create('Ext.data.Store', {
pageSize: this.PageSize,
fields: [
{ name: 'BSNO', type: 'string' }, //编号
{name: 'ISSALEFEE', type: 'string' }, //提成发放
{name: 'SALE', type: 'string' }, //业务员
{name: 'CUSTOMERNAME', type: 'string' }, //委托单位
{name: 'OPLBNAME', type: 'string' }, //业务类型
{name: 'OPTYPE', type: 'string' }, //更改单
{name: 'FEESTATUSREF', type: 'string' }, //费用锁定
{name: 'CUSTNO', type: 'string' }, //委托编号
{name: 'MBLNO', type: 'string' }, //主提单号
{name: 'ETD', type: 'string' }, //开船日期
{name: 'ACCDATE', type: 'string' }, //会计期间
{name: 'RMBDR', type: 'number' }, //RMB应收
{name: 'RMBCR', type: 'number' }, //RMB应付
{name: 'USDDR', type: 'number' }, //USD应收
{name: 'USDCR', type: 'number' }, //USD应付
{name: 'OTDR', type: 'number' }, //其他币别应收
{name: 'OTCR', type: 'number' }, //其他币别应付
{name: 'TTLDR', type: 'number' }, //合计应收
{name: 'TTLCR', type: 'number' }, //合计应付
{name: 'TTLPROFIT', type: 'number' }, //合计毛利润
{name: 'ShuiFei', type: 'number' }, //税费
{name: 'YeWuFeiYong', type: 'number' }, //业务费用
{name: 'JingLiRun', type: 'number' }, //净利润
{name: 'TiChengJiShu', type: 'number' }, //提成基数
{name: 'GeRenFeiYong', type: 'number' }, //个人费用
{name: 'TiChengBiLi', type: 'number' }, //提成比例
{name: 'TiCheng', type: 'number' }, //提成
{name: 'ShiFa', type: 'number' }, //提成
{name: 'YingJieRiQi', type: 'string' }, //应结日期
{name: 'ShiJieRiQi', type: 'string' }, //实结日期
{name: 'CORPID', type: 'string'} //公司GID
],
remoteSort: true,
proxy: {
type: 'ajax',
url: '/MvcShipping/MsRptSaleLiRunTiCheng/GetDataList',
reader: {
id: '',
root: 'data',
totalProperty: 'totalCount'
}
}
});
//#endregion
//#region 主列表_定义Grid列名
this.initgirdcolums = [{
sortable: false,
dataIndex: 'BSNO',
header: '编号',
hidden: true,
width: 130
}, {
sortable: false,
dataIndex: 'ISSALEFEE',
header: '提成发放',
width: 90
}, {
sortable: false,
dataIndex: 'SALE',
header: '业务员',
width: 80
}, {
sortable: false,
dataIndex: 'CUSTOMERNAME',
header: '委托单位',
width: 120
}, {
sortable: false,
dataIndex: 'OPLBNAME',
header: '业务类型',
width: 70
}, {
sortable: false,
dataIndex: 'OPTYPE',
header: '更改单',
width: 70
}, {
sortable: false,
dataIndex: 'FEESTATUSREF',
header: '费用锁定',
width: 70
}, {
sortable: false,
dataIndex: 'CUSTNO',
header: '委托编号',
width: 136
}, {
sortable: false,
dataIndex: 'MBLNO',
header: '主提单号',
width: 136
}, {
sortable: false,
dataIndex: 'ETD',
header: '开船日期',
width: 86
}, {
sortable: true,
dataIndex: 'ACCDATE',
header: '会计期间',
width: 70
}
, {
sortable: false,
dataIndex: 'RMBDR',
header: 'RMB应收',
renderer: function (value, cellmeta, record, rowIndex, columnIndex, store) { try { var lsValue = usMoney(value, 2, '', false); if (lsValue != "NaN") { value = lsValue; if (parseFloat(lsValue) < 0) { return '<SPAN style="COLOR: red">' + lsValue + '</SPAN>'; } } else { return value; } } catch (e) { return value; } return value; },
align: 'right',
width: 80,
renderer: function (value, cellmeta, record, rowIndex, columnIndex, store) {
value = usMoney(value, 2, '', true);
return value;
}
}, {
sortable: false,
dataIndex: 'RMBCR',
header: 'RMB应付',
renderer: function (value, cellmeta, record, rowIndex, columnIndex, store) { try { var lsValue = usMoney(value, 2, '', false); if (lsValue != "NaN") { value = lsValue; if (parseFloat(lsValue) < 0) { return '<SPAN style="COLOR: red">' + lsValue + '</SPAN>'; } } else { return value; } } catch (e) { return value; } return value; },
align: 'right',
width: 80,
renderer: function (value, cellmeta, record, rowIndex, columnIndex, store) {
value = usMoney(value, 2, '', true);
return value;
}
}
, {
sortable: false,
dataIndex: 'USDDR',
header: 'USD应收',
renderer: function (value, cellmeta, record, rowIndex, columnIndex, store) { try { var lsValue = usMoney(value, 2, '', false); if (lsValue != "NaN") { value = lsValue; if (parseFloat(lsValue) < 0) { return '<SPAN style="COLOR: red">' + lsValue + '</SPAN>'; } } else { return value; } } catch (e) { return value; } return value; },
align: 'right',
width: 80,
renderer: function (value, cellmeta, record, rowIndex, columnIndex, store) {
value = usMoney(value, 2, '', true);
return value;
}
}, {
sortable: false,
dataIndex: 'USDCR',
header: 'USD应付',
renderer: function (value, cellmeta, record, rowIndex, columnIndex, store) { try { var lsValue = usMoney(value, 2, '', false); if (lsValue != "NaN") { value = lsValue; if (parseFloat(lsValue) < 0) { return '<SPAN style="COLOR: red">' + lsValue + '</SPAN>'; } } else { return value; } } catch (e) { return value; } return value; },
align: 'right',
width: 80,
renderer: function (value, cellmeta, record, rowIndex, columnIndex, store) {
value = usMoney(value, 2, '', true);
return value;
}
}
, {
sortable: false,
dataIndex: 'OTDR',
header: '其他币别应收',
renderer: function (value, cellmeta, record, rowIndex, columnIndex, store) { try { var lsValue = usMoney(value, 2, '', false); if (lsValue != "NaN") { value = lsValue; if (parseFloat(lsValue) < 0) { return '<SPAN style="COLOR: red">' + lsValue + '</SPAN>'; } } else { return value; } } catch (e) { return value; } return value; },
align: 'right',
width: 80,
renderer: function (value, cellmeta, record, rowIndex, columnIndex, store) {
value = usMoney(value, 2, '', true);
return value;
}
}, {
sortable: false,
dataIndex: 'OTCR',
header: '其他币别应付',
renderer: function (value, cellmeta, record, rowIndex, columnIndex, store) { try { var lsValue = usMoney(value, 2, '', false); if (lsValue != "NaN") { value = lsValue; if (parseFloat(lsValue) < 0) { return '<SPAN style="COLOR: red">' + lsValue + '</SPAN>'; } } else { return value; } } catch (e) { return value; } return value; },
align: 'right',
width: 80,
renderer: function (value, cellmeta, record, rowIndex, columnIndex, store) {
value = usMoney(value, 2, '', true);
return value;
}
}
, {
sortable: false,
dataIndex: 'TTLDR',
header: '合计应收',
renderer: function (value, cellmeta, record, rowIndex, columnIndex, store) { try { var lsValue = usMoney(value, 2, '', false); if (lsValue != "NaN") { value = lsValue; if (parseFloat(lsValue) < 0) { return '<SPAN style="COLOR: red">' + lsValue + '</SPAN>'; } } else { return value; } } catch (e) { return value; } return value; },
align: 'right',
width: 80,
renderer: function (value, cellmeta, record, rowIndex, columnIndex, store) {
value = usMoney(value, 2, '', true);
return value;
}
}, {
sortable: false,
dataIndex: 'TTLCR',
header: '合计应付',
renderer: function (value, cellmeta, record, rowIndex, columnIndex, store) { try { var lsValue = usMoney(value, 2, '', false); if (lsValue != "NaN") { value = lsValue; if (parseFloat(lsValue) < 0) { return '<SPAN style="COLOR: red">' + lsValue + '</SPAN>'; } } else { return value; } } catch (e) { return value; } return value; },
align: 'right',
width: 80,
renderer: function (value, cellmeta, record, rowIndex, columnIndex, store) {
value = usMoney(value, 2, '', true);
return value;
}
}, {
sortable: false,
dataIndex: 'TTLPROFIT',
header: '合计毛利润', //账单毛利润
renderer: function (value, cellmeta, record, rowIndex, columnIndex, store) { try { var lsValue = usMoney(value, 2, '', false); if (lsValue != "NaN") { value = lsValue; if (parseFloat(lsValue) < 0) { return '<SPAN style="COLOR: red">' + lsValue + '</SPAN>'; } } else { return value; } } catch (e) { return value; } return value; },
align: 'right',
width: 80,
renderer: function (value, cellmeta, record, rowIndex, columnIndex, store) {
value = usMoney(value, 2, '', true);
return value;
}
}, {
sortable: false,
dataIndex: 'ShuiFei',
header: '税费', //毛利*税率
renderer: function (value, cellmeta, record, rowIndex, columnIndex, store) { try { var lsValue = usMoney(value, 2, '', false); if (lsValue != "NaN") { value = lsValue; if (parseFloat(lsValue) < 0) { return '<SPAN style="COLOR: red">' + lsValue + '</SPAN>'; } } else { return value; } } catch (e) { return value; } return value; },
align: 'right',
width: 80,
renderer: function (value, cellmeta, record, rowIndex, columnIndex, store) {
if (value == 0) {
return "/";
}
else {
value = usMoney(value, 2, '', true);
return value;
}
}
}, {
sortable: false,
dataIndex: 'YeWuFeiYong',
header: '业务费用', //其他费用模块中部分费用科目
renderer: function (value, cellmeta, record, rowIndex, columnIndex, store) { try { var lsValue = usMoney(value, 2, '', false); if (lsValue != "NaN") { value = lsValue; if (parseFloat(lsValue) < 0) { return '<SPAN style="COLOR: red">' + lsValue + '</SPAN>'; } } else { return value; } } catch (e) { return value; } return value; },
align: 'right',
width: 80,
renderer: function (value, cellmeta, record, rowIndex, columnIndex, store) {
if (value == 0) {
return "/";
}
else {
value = usMoney(value, 2, '', true);
return value;
}
}
}, {
sortable: false,
dataIndex: 'JingLiRun',
header: '净利润', //毛利-税费-业务费用
renderer: function (value, cellmeta, record, rowIndex, columnIndex, store) { try { var lsValue = usMoney(value, 2, '', false); if (lsValue != "NaN") { value = lsValue; if (parseFloat(lsValue) < 0) { return '<SPAN style="COLOR: red">' + lsValue + '</SPAN>'; } } else { return value; } } catch (e) { return value; } return value; },
align: 'right',
width: 80,
renderer: function (value, cellmeta, record, rowIndex, columnIndex, store) {
if (value == 0) {
return "/";
}
else {
value = usMoney(value, 2, '', true);
return value;
}
}
}
//, {
// sortable: false,
// dataIndex: 'TiChengJiShu',
// header: '提成基数', //“部门1=净利-底数1”“部门2=净利-底数2”“其他部门=净利”
// renderer: function (value, cellmeta, record, rowIndex, columnIndex, store) { try { var lsValue = usMoney(value, 2, '', false); if (lsValue != "NaN") { value = lsValue; if (parseFloat(lsValue) < 0) { return '<SPAN style="COLOR: red">' + lsValue + '</SPAN>'; } } else { return value; } } catch (e) { return value; } return value; },
// align: 'right',
// width: 80
//}
, {
sortable: false,
dataIndex: 'GeRenFeiYong',
header: '个人费用', //其他费用模块中部分费用科目(只提取用于出报表,不参与提成统计)
renderer: function (value, cellmeta, record, rowIndex, columnIndex, store) { try { var lsValue = usMoney(value, 2, '', false); if (lsValue != "NaN") { value = lsValue; if (parseFloat(lsValue) < 0) { return '<SPAN style="COLOR: red">' + lsValue + '</SPAN>'; } } else { return value; } } catch (e) { return value; } return value; },
align: 'right',
width: 80,
renderer: function (value, cellmeta, record, rowIndex, columnIndex, store) {
if (value == 0) {
return "/";
}
else {
value = usMoney(value, 2, '', true);
return value;
}
}
}
//, {
// sortable: false,
// dataIndex: 'TiChengBiLi',
// header: '提成比例',//按提成设置分段提取因有多个默认为0暂不显示
// width: 80
//}
, {
sortable: false,
dataIndex: 'TiCheng',
header: '提成', //提成基数*提成比例
renderer: function (value, cellmeta, record, rowIndex, columnIndex, store) { try { var lsValue = usMoney(value, 2, '', false); if (lsValue != "NaN") { value = lsValue; if (parseFloat(lsValue) < 0) { return '<SPAN style="COLOR: red">' + lsValue + '</SPAN>'; } } else { return value; } } catch (e) { return value; } return value; },
align: 'right',
width: 80,
renderer: function (value, cellmeta, record, rowIndex, columnIndex, store) {
if (value == 0) {
return "/";
}
else {
value = usMoney(value, 2, '', true);
return value;
}
}
}, {
sortable: false,
dataIndex: 'ShiFa',
header: '实发提成', //提成基数*提成比例
renderer: function (value, cellmeta, record, rowIndex, columnIndex, store) { try { var lsValue = usMoney(value, 2, '', false); if (lsValue != "NaN") { value = lsValue; if (parseFloat(lsValue) < 0) { return '<SPAN style="COLOR: red">' + lsValue + '</SPAN>'; } } else { return value; } } catch (e) { return value; } return value; },
align: 'right',
width: 80,
renderer: function (value, cellmeta, record, rowIndex, columnIndex, store) {
if (value == 0) {
return "/";
}
else {
value = usMoney(value, 2, '', true);
return value;
}
}
}, {
sortable: false,
dataIndex: 'YingJieRiQi',
header: '应结日期',
width: 86
}, {
sortable: false,
dataIndex: 'ShiJieRiQi',
header: '实结日期',
width: 86
}, {
sortable: false,
dataIndex: 'CORPID',
header: '公司GID',
hidden: true,
width: 0
}
];
//#endregion
//#region 主列表_定义Grid
this.girdcolums = DsTruck.GetGridPanel(USERID, this.formname + 'bs', this.initgirdcolums, 1);
this.GridCheckBoxModel = Ext.create('Ext.selection.CheckboxModel');
this.gridList = new Ext.grid.GridPanel({
store: this.storeList,
enableHdMenu: false,
region: 'center',
loadMask: { msg: "数据加载中,请稍等..." },
trackMouseOver: true,
selModel: this.GridCheckBoxModel,
disableSelection: false,
columns: this.girdcolums,
viewConfig: {
autoFill: true
, getRowClass: function (record, rowIndex, rowParams, store) {
var BILLSTATUSREF = record.get('ISSALEFEE');
if (BILLSTATUSREF.toString().indexOf("合计") > -1) {
return 'feestatus_refer';
}
if (BILLSTATUSREF.toString().indexOf("已发放") > -1) {
return 'feestatus_pass';
}
}
},
bbar: Ext.create('Ext.PagingToolbar', {
store: this.storeList,
displayInfo: true,
displayMsg: '当前显示 {0} - {1}条记录 /共 {2}条记录',
emptyMsg: "没有数据"
})
});
this.gridList.addListener('itemdblclick', function (dataview, record, item, index, e, b) {
this.SelectedRecord = record;
if (record.data.BSNO.toString().indexOf("合计") < 0) {
var openSet = "height=700, width=1024, toolbar=no, menubar=no,scrollbars=1, resizable=1,location=no, status=no,Top= " + (screen.height - 750) / 2 + ",Left= " + (screen.width - 1100) / 2
var openType = "_blank";
var openUrl = "";
if (record.data.OPLBNAME == "报关业务") {
openUrl = "../MvcShipping/MsOpApply/ApplyFeeView?handle=check&bsno=" + record.data.BSNO;
}
else {
openUrl = "../MvcShipping/MsOpBill/MsOpFeeView?handle=check&bsno=" + record.data.BSNO;
}
window.open(openUrl, openType, openSet);
}
else {
var records = this.GridCheckBoxModel.selected.items;
var bodyAddDatasHJ = [];
bodyAddDatasHJ.push(records[0]);
this.SelectedRecord = bodyAddDatasHJ;
this.OprationStatus = 'edit';
DsOpenEditWin('/MvcShipping/MsRptSaleLiRunTiCheng/Edit', "人员提成维护", "500", "940", "10", "10");
}
}, this);
//this.gridList.addListener('sortchange', function (ct, column, direction, eOpts) {
// this.bslistsortfield = column.dataIndex;
// this.bslistsortdire = direction;
//}, this);
//#endregion
//#region formSearch
//#region 加载下拉框
_this = this;
//业务类型
this.StoreOpLb = Ext.create('DsExt.ux.RefEnumStore', {});
this.StoreOpLb.load({ params: { enumTypeId: 96005} });
this.comboxOpLb = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: '业务类型',
store: this.StoreOpLb,
forceSelection: true,
name: 'PS_OPLB',
valueField: 'EnumValueName',
displayField: 'EnumValueName',
enableKeyEvents: true,
listeners: {
keyup: function (field, e) {
if (e.getKey() == e.ENTER) {
_this.onRefreshClick();
}
}
}
});
//揽货人
this.storeSalesCode = Ext.create('DsExt.ux.RefTableStore', {
model: 'DsShipping.ux.UserRefModel',
proxy: { url: '/CommMng/BasicDataRef/GetUserRefList' }
});
this.storeSalesCode.load();
this.comboxSalesCode = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: '揽货人',
store: this.storeSalesCode,
forceSelection: true,
name: 'PS_SALE',
valueField: 'UserName',
displayField: 'CodeAndName',
enableKeyEvents: true,
listeners: {
keyup: function (field, e) {
if (e.getKey() == e.ENTER) {
_this.onRefreshClick();
}
}
}
});
//委托单位
this.storeCustCode = Ext.create('DsExt.ux.RefTableStore', {
model: 'DsShipping.ux.CustomRefModel',
proxy: { url: '/CommMng/BasicDataRef/GetCustomRefList' }
});
this.storeCustCode.load({ params: { condition: "ISCONTROLLER='1'"} });
this.comboxCustCode = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: '委托单位',
store: this.storeCustCode,
name: 'PS_CUSTOMERNAME',
valueField: 'CustName',
displayField: 'CodeAndName',
enableKeyEvents: true,
listeners: {
keyup: function (field, e) {
if (e.getKey() == e.ENTER) {
_this.onRefreshClick();
}
}
}
});
//费用状态
this.StoreFeeLock = Ext.create('Ext.data.Store', {
fields: ['OpLb']
});
this.StoreFeeLock.add({ "OpLb": "全部" });
this.StoreFeeLock.add({ "OpLb": "已锁定" });
this.StoreFeeLock.add({ "OpLb": "未锁定" });
this.comboxFeeLock = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: '费用锁定',
store: this.StoreFeeLock,
forceSelection: true,
name: 'PS_FEELOCK',
valueField: 'OpLb',
displayField: 'OpLb',
enableKeyEvents: true,
listeners: {
keyup: function (field, e) {
if (e.getKey() == e.ENTER) {
_this.onRefreshClick();
}
}
}
});
//提成状态
this.StoreTiCheng = Ext.create('Ext.data.Store', {
fields: ['OpLb']
});
this.StoreTiCheng.add({ "OpLb": "全部" });
this.StoreTiCheng.add({ "OpLb": "已发提成" });
this.StoreTiCheng.add({ "OpLb": "未发提成" });
this.comboxTiCheng = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: '提成状态',
store: this.StoreTiCheng,
forceSelection: true,
name: 'PS_isTiCheng',
valueField: 'OpLb',
displayField: 'OpLb',
value: '未发提成',
enableKeyEvents: true,
listeners: {
keyup: function (field, e) {
if (e.getKey() == e.ENTER) {
_this.onRefreshClick();
}
}
}
});
//统计标准
this.StoreTongJiBiaoZhun = Ext.create('Ext.data.Store', {
fields: ['OpLb']
});
this.StoreTongJiBiaoZhun.add({ "OpLb": "开船日期" });
this.StoreTongJiBiaoZhun.add({ "OpLb": "会计期间" });
this.comboxTongJiBiaoZhun = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: '统计标准',
store: this.StoreTongJiBiaoZhun,
forceSelection: true,
name: 'PS_TongJiBiaoZhun',
valueField: 'OpLb',
displayField: 'OpLb',
value: '开船日期',
enableKeyEvents: true,
listeners: {
keyup: function (field, e) {
if (e.getKey() == e.ENTER) {
_this.onRefreshClick();
}
}
}
});
//所属公司
Ext.define('SubComp', {
extend: 'Ext.data.Model',
fields: [
{ name: 'GID', type: 'string' },
{ name: 'NAME', type: 'string' },
{ name: 'ENNAME', type: 'string' }
]
});
this.StoreSubComp = Ext.create('DsExt.ux.RefTableStore', {
model: 'SubComp',
proxy: { url: '/MvcShipping/MsBaseInfo/GetCompanyEN' }
});
//所属部门
this.storeDept = Ext.create('DsExt.ux.RefTableStore', {
model: 'DsShipping.ux.DeptModel',
proxy: { url: '/CommMng/BasicDataRef/GetDeptList_All_Group' }//proxy: { url: '/CommMng/BasicDataRef/GetDeptList' }
});
this.StoreSubComp.load({ params: { condition: ""} });
this.comboxSubComp = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: '所属公司',
store: this.StoreSubComp,
name: 'SUBCOMP',
valueField: 'GID',
displayField: 'NAME',
value: COMPANYID,
enableKeyEvents: true,
listeners: {
keyup: function (field, e) {
if (e.getKey() == e.ENTER) {
_this.onRefreshClick();
}
},
'select': function (combo, records, eOpts) {
if (combo.value.toString().trim() !== "") {
this.storeDept.load({ params: { condition: "LINKID='" + combo.value.toString().trim() + "'"} });
}
}
}
});
this.storeDept.load({ params: { condition: "LINKID='" + COMPANYID + "'"} });
this.comboxDept = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: '所属部门',
store: this.storeDept,
forceSelection: true,
name: 'SALEDEPT',
valueField: 'DeptName',
displayField: 'DeptName'
});
this.comboxDept1 = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: '部门1',
store: this.storeDept,
forceSelection: true,
name: 'SALEDEPT1',
valueField: 'DeptName',
displayField: 'DeptName'
});
this.comboxDept2 = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: '部门2',
store: this.storeDept,
forceSelection: true,
name: 'SALEDEPT2',
valueField: 'DeptName',
displayField: 'DeptName'
});
//全部结算
this.CheckOnlyStl = new Ext.form.Checkbox({
fieldLabel: '全部结算',
checked: true,
labelAlign: "right",
labelWidth: 60
});
this.CheckAllDR = new Ext.form.Checkbox({
fieldLabel: '包含应收为0业务',
checked: true,
labelAlign: "right",
labelWidth: 120
});
//#endregion
this.formSearch = Ext.widget('form', {
frame: true,
region: 'center',
bodyPadding: 5,
fieldDefaults: {
margins: '2 2 2 2',
labelAlign: 'right',
flex: 1,
labelWidth: 80,
msgTarget: 'qtip'
},
items: [{
xtype: 'container',
defaultType: 'textfield',
layout: 'anchor',
defaults: {
anchor: '100%'
},
items: [{
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [this.comboxOpLb, this.comboxTongJiBiaoZhun, {
fieldLabel: ' → ',
xtype: 'monthfield',
name: 'PS_ACCDATE',
allowBlank: false,
enableKeyEvents: true,
listeners: {
specialkey: function (field, e) {
if (e.getKey() == e.ENTER) {
_this.onRefreshClick();
}
}
}
}, {
fieldLabel: '编号',
name: 'PS_CUSTNO',
enableKeyEvents: true,
listeners: {
specialkey: function (field, e) {
if (e.getKey() == e.ENTER) {
_this.onRefreshClick();
}
}
}
}]
}, {
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [this.comboxCustCode, this.comboxSalesCode, this.comboxTiCheng, this.comboxFeeLock]//, this.comboxSubComp, this.comboxDept, { xtype: 'hiddenfield' }, { xtype: 'hiddenfield'}
}, {
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [
{
fieldLabel: '税率',
name: 'PS_ShuiLv',
allowBlank: false,
value: '0',
enableKeyEvents: true,
listeners: {
specialkey: function (field, e) {
if (e.getKey() == e.ENTER) {
_this.onRefreshClick();
}
}
}
}, {
fieldLabel: '业务费用科目',
name: 'PS_YeWuFeiYong',
enableKeyEvents: true,
listeners: {
specialkey: function (field, e) {
if (e.getKey() == e.ENTER) {
_this.onRefreshClick();
}
}
}
}, {
fieldLabel: '个人费用科目',
name: 'PS_GeRenFeiYong',
enableKeyEvents: true,
listeners: {
specialkey: function (field, e) {
if (e.getKey() == e.ENTER) {
_this.onRefreshClick();
}
}
}
}, this.CheckOnlyStl, this.CheckAllDR
//, { xtype: 'hiddenfield' }
//, this.comboxDept1, {
// fieldLabel: '底数1',
// name: 'PS_DiShu1',
// enableKeyEvents: true,
// listeners: {
// specialkey: function (field, e) {
// if (e.getKey() == e.ENTER) {
// _this.onRefreshClick();
// }
// }
// }
//}, this.comboxDept2, {
// fieldLabel: '底数2',
// name: 'PS_DiShu2',
// enableKeyEvents: true,
// listeners: {
// specialkey: function (field, e) {
// if (e.getKey() == e.ENTER) {
// _this.onRefreshClick();
// }
// }
// }
//}
]
}]//end items(fieldset 1)
}]//end root items
});
//#endregion formSearch
//#region 查询工具条
this.CheckSaveQuery = new Ext.form.Checkbox({
fieldLabel: '记忆查询条件',
checked: true,
width: 120
});
_this = this;
this.SearchBtn = new Ext.Button({
text: '隐藏查询',
handler: function () {
if (_this.SearchBtn.text == '隐藏查询') {
_this.panelSearch.hide();
_this.SearchBtn.setText("显示查询");
} else {
_this.panelSearch.show();
_this.SearchBtn.setText("隐藏查询");
}
}
});
this.panelBtn = new Ext.Panel({
region: "north",
tbar: [{
text: "执行查询",
iconCls: "btnrefresh",
handler: function (button, event) {
this.onRefreshClick(button, event);
var isvisible = true;
var issavevalue = false;
if (_this.SearchBtn.text == '隐藏查询')
isvisible = true
else
isvisible = false;
if (this.CheckSaveQuery.checked)
issavevalue = true
saveQuerySetting(this.formname, this.formSearch, isvisible, issavevalue);
},
scope: this
}, '-', {
text: "导出Excel",
id: "btnExportExcel",
iconCls: 'btnexportexcel',
handler: function (button, event) {
this.onExportClick(button, event);
},
scope: this
}
, {
text: "打印",
iconCls: 'btnprint',
handler: function (button, event) {
this.Print(button, event);
},
scope: this
}
, '-', this.SearchBtn, {
xtype: 'button',
width: 90,
text: "清空条件",
iconCls: "btnreset",
handler: function (button, event) {
this.onClearSql(button, event);
},
scope: this
}, this.CheckSaveQuery, '-', {
text: "保存列表样式",
id: "btntest",
menu: [
{ text: "保存列表",
handler: function (button, event) {
_this.onSaveGridClick(button, event);
}
}, { text: "列表初始化",
handler: function (button, event) {
_this.oninitGridClick(button, event);
}
}],
scope: this
}, '-', {
text: '发放提成',
tooltip: '发放提成',
id: 'btnSubmitAudit',
handler: function (button, event) {
this.onSetFeeClick();
},
scope: this
}, '-', {
text: '取消发放',
tooltip: '取消发放',
id: 'btnSubmitAuditBack',
handler: function (button, event) {
this.onCancelSetFeeClick();
},
scope: this
}]
});
//#endregion
//#region 页面布局
this.panelTop = new Ext.Panel({
layout: "border",
region: "north",
height: 29,
items: [this.panelBtn]
});
this.panelSearch = new Ext.Panel({
layout: "border",
region: "north",
height: 100,
items: [this.formSearch]
});
Ext.apply(this, {
items: [this.panelTop, this.panelSearch, this.gridList]
});
//#endregion
//提取查询条件记忆
LoadQueryData(this.formname, this.formSearch, this.CheckSaveQuery);
}, //end initUIComponents
//#region 查询
onRefreshClick: function (button, event) {
if (!this.checkSearchCondition()) {
return;
}
//税率
var ShuiLv = this.formSearch.getForm().findField('PS_ShuiLv').getValue().toString().trim();
if (ShuiLv == "") {
Ext.Msg.alert('提示', '税率不允许为空,请检查。');
return false;
}
var YeWuFeiYong = this.formSearch.getForm().findField('PS_YeWuFeiYong').getValue().toString().trim(); //业务费用科目
var GeRenFeiYong = this.formSearch.getForm().findField('PS_GeRenFeiYong').getValue().toString().trim(); //个人费用科目
//会计期间
this.accDate = this.formSearch.getForm().findField('PS_ACCDATE').getRawValue();
if (this.accDate == "") {
Ext.Msg.alert('提示', '会计期间不允许为空,请检查。');
return false;
}
//
var sql = this.getCondition();
this.sqlcontext = sql;
this.storeList.load({
params: { start: 0, limit: this.PageSize, condition: sql, ShuiLv: ShuiLv, YeWuFeiYong: YeWuFeiYong, GeRenFeiYong: GeRenFeiYong, accDate: this.accDate, sort: '' },
waitMsg: "正在查询数据...",
scope: this
});
},
getCondition: function () {
var form = this.formSearch.getForm();
var sql = '';
//业务类型
var OPLB = form.findField('PS_OPLB').getValue();
sql = sql + getAndConSql(sql, OPLB, "B.OPLBNAME='" + OPLB + "'");
//揽货人
var SALE = form.findField('PS_SALE').getValue();
sql = sql + getAndConSql(sql, SALE, "B.SALE='" + SALE + "'");
//客户名称
var CUSTOMERNAME = form.findField('PS_CUSTOMERNAME').getValue();
sql = sql + getAndConSql(sql, CUSTOMERNAME, "CUSTOMERNAME='" + CUSTOMERNAME + "'");
//费用状态
var PS_FEELOCK = form.findField('PS_FEELOCK').getValue();
if (PS_FEELOCK == '已锁定')
sql = sql + getAndConSql(sql, PS_FEELOCK, "FEESTATUS=1");
else if (PS_FEELOCK == '未锁定')
sql = sql + getAndConSql(sql, PS_FEELOCK, "FEESTATUS=0");
//提成状态
var PS_isTiCheng = form.findField('PS_isTiCheng').getValue();
if (PS_isTiCheng == '已发提成')
sql = sql + getAndConSql(sql, PS_isTiCheng, "B.bsno in (select bsno from cw_user_ticheng_detail)");
else if (PS_isTiCheng == '未发提成')
sql = sql + getAndConSql(sql, PS_isTiCheng, "B.bsno not in (select bsno from cw_user_ticheng_detail)");
// //所属公司
// var SUBCOMP = form.findField('SUBCOMP').getValue();
// sql = sql + getAndConSql(sql, SUBCOMP, "B.CORPID='" + SUBCOMP + "'");
// //所属部门
// var SALEDEPT = form.findField('SALEDEPT').getValue();
// sql = sql + getAndConSql(sql, SALEDEPT, "B.SALE in (select SHOWNAME from [user] where gid in (select USERID from user_baseinfo where DEPTNAME='" + SALEDEPT + "' and COMPANYNAME=(select top 1 NAME from [company] where GID='" + SUBCOMP + "')))");
//全部结算
if (this.CheckOnlyStl.checked) {
if (this.CheckAllDR.checked) {
sql = sql + getAndConSql(sql, "11", " ((B.TTLDR=B.STLTTLDR AND B.TTLDR<>0) or (B.TTLDR=0)) ");
} else {
sql = sql + getAndConSql(sql, "11", "B.TTLDR=B.STLTTLDR AND B.TTLDR<>0 ");
}
}
//统计标准
var PS_TongJiBiaoZhun = form.findField('PS_TongJiBiaoZhun').getRawValue();
this.accDate = form.findField('PS_ACCDATE').getRawValue();
if (PS_TongJiBiaoZhun == "会计期间") {
//会计期间
sql = sql + getAndConSql(sql, this.accDate, "B.ACCDATE='" + this.accDate + "'");
}
else {
//开船日期
sql = sql + getAndConSql(sql, this.accDate, "SUBSTRING(B.ETD,1,7)='" + this.accDate + "'");
}
//编号
var CUSTNO = form.findField('PS_CUSTNO').getValue();
sql = sql + getAndConSql(sql, CUSTNO, "(B.CUSTNO like '%" + CUSTNO + "%' or B.MBLNO like '%" + CUSTNO + "%' or B.HBLNO like '%" + CUSTNO + "%' or B.CUSTOMNO like '%" + CUSTNO + "%') "); // or B.ORDERNO like '%" + CUSTNO + "%'
////部门1
//var SALEDEPT1 = form.findField('SALEDEPT1').getValue();
//sql = sql + getAndConSql(sql, SALEDEPT1, "SALEDEPT1='" + SALEDEPT1 + "'");
////部门2
//var SALEDEPT2 = form.findField('SALEDEPT2').getValue();
//sql = sql + getAndConSql(sql, SALEDEPT2, "SALEDEPT2='" + SALEDEPT2 + "'");
////底数1
//var PS_DiShu1 = form.findField('PS_DiShu1').getValue();
//sql = sql + getAndConSql(sql, PS_DiShu1, "PS_DiShu1='" + PS_DiShu1 + "'");
////底数2
//var PS_DiShu2 = form.findField('PS_DiShu2').getValue();
//sql = sql + getAndConSql(sql, PS_DiShu2, "PS_DiShu2='" + PS_DiShu2 + "'");
return sql;
},
checkSearchCondition: function () {
var form = this.formSearch.getForm();
if (!form.isValid()) {
Ext.Msg.alert('提示', '查询条件赋值错误,请检查。');
return false;
}
return true;
},
onClearSql: function () {
var form = this.formSearch.getForm();
form.reset();
},
//#endregion
//#region 保存列表样式
onSaveGridClick: function (button, event) {
this.girdcolums = DsTruck.SaveGridPanel(USERID, this.formname + 'bs', this.gridList.columns, this.girdcolums, 1, true);
},
//#endregion
//#region 列表初始化
oninitGridClick: function (button, event) {
var agirdcolums = this.initgirdcolums;
this.gridList.reconfigure(this.storeList, agirdcolums);
this.girdcolums = DsTruck.SaveGridPanel(USERID, this.formname + 'bs', this.gridList.columns, this.initgirdcolums, 1, true);
},
//#endregion
//#region 发放提成
onSetFeeClick: function (button, event) {
var GidStr = '';
var records = this.GridCheckBoxModel.selected.items;
if (records.length == 0) {
Ext.Msg.show({ title: '提示', msg: '请先选择要发放的业务!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
return;
}
//
var bodyAddDatasHJ = [];
var bodyAddDatas = [];
for (var i = 0; i < records.length; i++) {
var rec = records[i];
if (rec.data.SALE.toString().trim() == "") {
continue;
}
if (rec.data.ISSALEFEE.toString().indexOf("已发放") < 0) {
if (rec.data.BSNO.toString().indexOf("合计") < 0) {
bodyAddDatas.push(rec);
}
else {
bodyAddDatasHJ.push(rec);
}
}
}
if (bodyAddDatas.length == 0 || bodyAddDatasHJ.length == 0) {
Ext.Msg.show({ title: '提示', msg: '没有要发放提成的业务(注意:发放提成时,请同时选择人员合计行,且业务员不能为空)!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
return;
} else {
Ext.Msg.wait('正在提取数据...');
var ShuiLv = this.formSearch.getForm().findField('PS_ShuiLv').getValue().toString().trim();
var YeWuFeiYong = this.formSearch.getForm().findField('PS_YeWuFeiYong').getValue().toString().trim(); //业务费用科目
var GeRenFeiYong = this.formSearch.getForm().findField('PS_GeRenFeiYong').getValue().toString().trim(); //个人费用科目
var jsonbodyAddDatas = ConvertRecordsToJsonAll(bodyAddDatas);
var jsonbodyAddDatasHJ = ConvertRecordsToJsonAll(bodyAddDatasHJ);
Ext.Ajax.request({
waitMsg: '正在锁定...',
url: '/MvcShipping/MsRptSaleLiRunTiCheng/SetFee',
params: {
data: jsonbodyAddDatas,
dataHJ: jsonbodyAddDatasHJ,
ShuiLv: ShuiLv,
YeWuFeiYong: YeWuFeiYong,
GeRenFeiYong: GeRenFeiYong,
accDate: this.accDate
},
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 {
//Ext.Msg.show({ title: '提示', msg: result.Message, icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
//
this.SelectedRecord = bodyAddDatasHJ; //record;
this.OprationStatus = 'edit';
DsOpenEditWin('/MvcShipping/MsRptSaleLiRunTiCheng/Edit', "人员提成维护", "500", "940", "10", "10");
Ext.Msg.hide();
//
this.onRefreshClick();
}
} else {
Ext.MessageBox.alert('请求出现错误,请重试', response.responseText);
}
},
scope: this
});
}
},
//#endregion
//#region 取消发放
onCancelSetFeeClick: function (button, event) {
var GidStr = '';
var records = this.GridCheckBoxModel.selected.items;
if (records.length == 0) {
Ext.Msg.show({ title: '提示', msg: '请先选择要发放的业务!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
return;
}
var bodyAddDatasHJ = [];
var bodyAddDatas = [];
for (var i = 0; i < records.length; i++) {
var rec = records[i];
if (rec.data.SALE.toString().trim() == "") {
continue;
}
if (rec.data.ISSALEFEE.toString().indexOf("已发放") > -1) {
if (rec.data.BSNO.toString().indexOf("合计") < 0) {
bodyAddDatas.push(rec);
}
else {
bodyAddDatasHJ.push(rec);
}
}
}
if (bodyAddDatas.length == 0 || bodyAddDatasHJ.length == 0) {
Ext.Msg.show({ title: '提示', msg: '没有要取消发放提成的业务(注意:取消发放提成时,请同时选择人员合计行,且业务员不能为空)!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
return;
} else {
Ext.Msg.wait('正在提取数据...');
var ShuiLv = this.formSearch.getForm().findField('PS_ShuiLv').getValue().toString().trim();
var YeWuFeiYong = this.formSearch.getForm().findField('PS_YeWuFeiYong').getValue().toString().trim(); //业务费用科目
var GeRenFeiYong = this.formSearch.getForm().findField('PS_GeRenFeiYong').getValue().toString().trim(); //个人费用科目
var jsonbodyAddDatas = ConvertRecordsToJsonAll(bodyAddDatas);
var jsonbodyAddDatasHJ = ConvertRecordsToJsonAll(bodyAddDatasHJ);
Ext.Ajax.request({
waitMsg: '正在锁定...',
url: '/MvcShipping/MsRptSaleLiRunTiCheng/CancelSetFee',
params: {
data: jsonbodyAddDatas,
dataHJ: jsonbodyAddDatasHJ,
ShuiLv: ShuiLv,
YeWuFeiYong: YeWuFeiYong,
GeRenFeiYong: GeRenFeiYong,
accDate: this.accDate
},
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 {
Ext.Msg.show({ title: '提示', msg: result.Message, icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
this.onRefreshClick();
}
} else {
Ext.MessageBox.alert('请求出现错误,请重试', response.responseText);
}
},
scope: this
});
}
},
//#endregion
//#region 导出
onExportClick: function (button, event) {
GridExportExcelPage(this.gridList);
},
//#endregion
//#region 打印
Print: function () {
if (this.storeList.getCount() == 0) {
return;
}
if (!this.checkSearchCondition()) {
return;
}
//税率
var ShuiLv = this.formSearch.getForm().findField('PS_ShuiLv').getValue().toString().trim();
if (ShuiLv == "") {
Ext.Msg.alert('提示', '税率不允许为空,请检查。');
return false;
}
var YeWuFeiYong = this.formSearch.getForm().findField('PS_YeWuFeiYong').getValue().toString().trim(); //业务费用科目
var GeRenFeiYong = this.formSearch.getForm().findField('PS_GeRenFeiYong').getValue().toString().trim(); //个人费用科目
//会计期间
this.accDate = this.formSearch.getForm().findField('PS_ACCDATE').getRawValue();
if (this.accDate == "") {
Ext.Msg.alert('提示', '会计期间不允许为空,请检查。');
return false;
}
//
Ext.Msg.wait('正在组织数据, 请稍侯..');
Ext.Ajax.request({
waitMsg: '正在组织数据...',
url: '/MvcShipping/MsRptSaleLiRunTiCheng/GetDataListStr',
scope: this,
params: {
condition: this.sqlcontext,
ShuiLv: ShuiLv,
YeWuFeiYong: YeWuFeiYong,
GeRenFeiYong: GeRenFeiYong,
accDate: this.accDate,
sort: ''
},
callback: function (options, success, response) {
if (success) {
Ext.MessageBox.hide();
var jsonresult = Ext.JSON.decode(response.responseText);
if (jsonresult.Success) {
var returnstr = jsonresult.data;
var printType = 'MsRptSaleLiRunTiChengList';
var sql1 = returnstr;
var sql2 = "";
var sql3 = "";
var sql4 = "";
var sql5 = "";
var sql6 = "";
PrintComm(printType, sql1, sql2, sql3, sql4, sql5, sql6);
} 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 });
}
}
});
},
//#endregion
OprationSwap: function () {
var ret = new Array();
ret[0] = this.OprationStatus;
ret[1] = this.storeList;
ret[2] = this.SelectedRecord;
ret[3] = this.SelectedRecord.data.BSNO;
ret[4] = "MsRptOpProfitIndex";
ret[5] = this.accDate;
return ret;
}
});