ylj20011123 e876df2bde update
2025-09-30 14:42:08 +08:00

1654 lines
68 KiB
TypeScript
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

import React, { useRef } from "react";
import type { CurrentUser } from "umi";
import { connect } from "umi";
import numeral from 'numeral';
import type { ConnectState } from "@/models/connect";
import { useState } from "react";
import ProCard from "@ant-design/pro-card";
import { MenuFoldOutlined } from "@ant-design/icons";
import type { FormInstance } from "antd";
import { Modal, Popconfirm } from "antd";
import { Button, Drawer, message, Spin, Tree, Typography, Tooltip } from "antd";
import { getMoney, getServerpartTree, handleFormatNumber } from "@/services/options";
import useRequest from "@ahooksjs/use-request";
import ReactHTMLTableToExcel from "react-html-table-to-excel";
import moment from "moment";
import type { ActionType } from "@ant-design/pro-table";
import ProTable from "@ant-design/pro-table";
import { contractType } from "@/pages/contract/emun";
import session from "@/utils/session";
import { handleGetTableRevenueRecognition, handleGetTableRevenueRecognitionOtherData } from "@/pages/reports/ShopExpenseDetail/service";
import ProjectDetail from "@/pages/BussinessProject/detail";
import type { BusinessProjectModel } from "@/pages/BussinessProject/data";
import RevenueSecondList from "./components/RevenueSecondList";
import './style.less'
import { getProjectDetail } from "@/pages/reports/accountTable/service";
import RevenueList from "@/pages/BussinessProject/components/RevenueList";
import CompareList from "@/pages/reports/revenueConfirmation/components/compareList";
import { handleGetProjectPeriodIncome, handleStorageMonthProjectAccount } from "./components/service";
import { wrapTreeNode } from "@/utils/format";
import { handleGetSERVERPARTCRTList } from "@/pages/basicManage/costing/service";
import { handleHighPrecision } from "@/utils/utils";
import LeftSelectTree from "../settlementAccount/component/leftSelectTree";
const revenueConfirmation: React.FC<{ currentUser: CurrentUser }> = (props) => {
const { currentUser } = props
const actionRef = useRef<ActionType>();
const formRef = useRef<FormInstance>();
const downloadBtnRef = useRef<any>()
const { confirm } = Modal;
const [reqDetailList, setReqDetailList] = useState<any>(); // 合计项数据源
const [printOut, setPrintOut] = useState<any>(); // 打印数据的内容
// 树相关的属性和方法
// 选择的服务区
const [selectedId, setSelectedId] = useState<string>()
// 选择的片区
const [selectedAreaId, setSelectAreaId] = useState<string>()
const [collapsible, setCollapsible] = useState<boolean>(false)
const [treeView, setTreeView] = useState<any>()
// 是否显示打印的表格
const [showExportTable, setShowExportTable] = useState<boolean>(false)
// 统计月份
const [searchMonth, setSearchMonth] = useState<any>()
const [exportDate, setExportDate] = useState<any>()
const [currentRow, setCurrentRow] = useState<BusinessProjectModel | any>(undefined) // 选中的当前行
const [showDetail, setShowDetail] = useState<boolean>(false) // 是否显示详情
const [showMonthDetail, setShowMonthDetail] = useState<boolean>(false) // 是否显示详情
const [showMonthSecondDetail, setShowMonthSecondDetail] = useState<boolean>(false)
// 查询表格接口的时间
const [monthTime, setMonthTime] = useState<any>()
// 累计应确认收入 累计已确认收入 本月应确认 点击进入表格带上的时间
const [drawerSearchTime, setDrawerSearchTime] = useState<any>()
// 加载服务区树
const { loading: treeLoading, data: treeViews } = useRequest(async () => {
const data = await getServerpartTree(currentUser?.ProvinceCode, currentUser?.CityAuthority, true, true, true)
setTreeView(data)
return data
})
// 最近固化时间
const [otherData, setOtherData] = useState<any>()
const [columnsStateMap, setColumnsStateMap] = useState<any>({
CurMonthRevenue: { show: false }
})
// 导出的加载效果
const [showLoading, setShowLoading] = useState<boolean>(false)
const SETTLEMENT_MODESList = session.get('SETTLEMENT_MODESList')
const SETTLEMENT_MODESObj = session.get('SETTLEMENT_MODESObj')
const BUSINESSTYPEObj = session.get('BUSINESSTYPEObj')
// 导出表格的数据
const [exportTableData, setExportTableData] = useState<any>()
// 累计营业额和自然日报表对比的抽屉数据
const [compareCurrent, setCompareCurrent] = useState<any>()
// 累计营业额和自然日报表的抽屉是否显示
const [showCompareDrawer, setShowCompareDrawer] = useState<boolean>(false)
// 搜索参数
const [searchParams, setSearchParams] = useState<any>()
// 拿到列表最初始的数据 用户固化数据
const [defaultTableData, setDefaultTableData] = useState<any>()
// 判断是否有不一样的税率
const [differentRate, setDifferentRate] = useState<any>()
const columns: any = [
// {
// title:<div style={{textAlign:'center'}}>{'序号'}</div>,
// hideInSearch: true,
// dataIndex: 'index',
// width: 90,
// fixed:'left',
// align:'center',
// render:(_,record)=>{
// return record.index?record.index:''
// }
// },
{
title: <div style={{ textAlign: 'center' }}>{'门店名称'}</div>,
dataIndex: 'Name',
hideInSearch: true,
width: 280,
ellipsis: true,
fixed: 'left',
align: 'left',
render: (_, record) => {
return <a style={{ width: '200px', display: 'block', whiteSpace: 'nowrap', textOverflow: 'ellipsis', overflow: 'hidden', color: record?.BUSINESSPROJECT_ID ? '#1890ff' : '#000000', cursor: record?.BUSINESSPROJECT_ID ? 'pointer' : '' }} onClick={() => {
if (record?.BUSINESSPROJECT_ID) {
setCurrentRow(record)
setShowDetail(true)
}
}}>{record.Name}</a>
}
},
{
title: '统计时间',
dataIndex: 'search_months',
valueType: 'date',
initialValue: moment().subtract(1, 'months').format('YYYY-MM'),
search: {
transform: (value) => {
return {
MonthDate: moment(value).startOf("month").format('YYYY-MM'),
};
},
},
hideInTable: true,
fieldProps: {
picker: "month",
format: 'YYYY-MM',
}
},
{
title: '结算模式',
dataIndex: 'SettlementModes',
hideInTable: true,
hideInDescriptions: true,
valueType: 'select',
fieldProps: {
mode: 'multiple'
},
valueEnum: SETTLEMENT_MODESObj
// request: ()=>{
// return SETTLEMENT_MODESList
// }
},
{
title: <div style={{ textAlign: 'center' }}>{'经营商户'}</div>,
dataIndex: 'MERCHANTS_NAME',
align: 'left',
width: 200,
ellipsis: true,
},
{
title: "历史项目",
dataIndex: 'ShowHisProject',
valueType: "select",
valueEnum: {
"true": "包含",
"false": "不含",
},
initialValue: 'false',
hideInTable: true
},
{
title: <div style={{ textAlign: 'center' }}>{'合同起止日期'}</div>,
dataIndex: 'COMPACT_DATE',
align: 'left',
width: 200,
hideInSearch: true,
ellipsis: true,
render: (_, record) => {
return `${record?.COMPACT_STARTDATE ? moment(record?.COMPACT_STARTDATE).format('YYYY/MM/DD') : ''}${record?.COMPACT_ENDDATE ? `-${moment(record?.COMPACT_ENDDATE).format('YYYY/MM/DD')}` : ''}`
}
},
// {
// title:<div style={{textAlign:'center'}}>{'租金类别'}</div>,
// dataIndex: 'BusinessType',
// align:'left',
// hideInSearch: true,
// valueType: 'select',
// width: 90,
// valueEnum: BUSINESSTYPEObj
// },
{
title: <div style={{ textAlign: 'center' }}>{'结算模式'}</div>,
dataIndex: 'SettlementModes',
align: 'left',
hideInSearch: true,
valueType: 'select',
width: 90,
valueEnum: SETTLEMENT_MODESObj
},
{
title: <div style={{ textAlign: 'center' }}></div>,
dataIndex: 'SwitchDate',
width: 110,
align: 'center',
hideInSearch: true,
render: (_, record) => {
return record?.SwitchDate ? moment(record?.SwitchDate).format('YYYY-MM-DD') : '-'
}
},
{
title: '当年基础信息',
dataIndex: '',
hideInSearch: true,
children: [
{
title: <div style={{ textAlign: 'center' }}>{'期数'}</div>,
dataIndex: 'IndexStr',
width: 90,
align: 'left',
hideInSearch: true,
},
{
title: <div style={{ textAlign: 'center' }}>{'履约保证金'}</div>,
dataIndex: 'SECURITYDEPOSIT',
width: 90,
align: 'right',
hideInSearch: true,
render: (_, record) => {
return record?.SECURITYDEPOSIT ? numeral(record?.SECURITYDEPOSIT).format('0,0') : '-'
}
},
{
title: <div style={{ textAlign: 'center' }}>{'期限'}</div>,
dataIndex: 'IndexDesc',
align: 'left',
width: 200,
hideInSearch: true,
},
{
title: <div style={{ textAlign: 'center' }}>{'装修期'}</div>,
dataIndex: 'DecorateDesc',
align: 'left',
width: 180,
hideInSearch: true,
},
{
title: <div style={{ textAlign: 'center' }}>{'保底/固定租金'}</div>,
dataIndex: 'RENTFEE',
valueType: 'digit',
align: 'right',
width: 120,
hideInSearch: true,
},
{
title: <div style={{ textAlign: 'center' }}>{'提成比例'}</div>,
dataIndex: 'GUARANTEERATIO',
align: 'right',
width: 100,
hideInSearch: true,
render: (_, record) => {
return record.GUARANTEERATIO ? `${record.GUARANTEERATIO}%` : '-'
}
},
]
},
{
title: '保底租金应确认收入',
dataIndex: '',
hideInSearch: true,
children: [
{
title: <div style={{ textAlign: 'center' }}>{'税率'}</div>,
dataIndex: 'TaxRate',
align: 'right',
width: 100,
hideInSearch: true,
render: (_, record) => {
const rightTaxRate = record?.errorTaxRate ? `${record?.errorTaxRate}%` : ''
return <div>
{
record?.isErrorTaxRate ?
<Tooltip title={rightTaxRate}>
<span style={{ color: 'red', marginRight: '4px' }}></span>
</Tooltip>
:
''
}
{record?.TaxRate ? `${record?.TaxRate}%` : '-'}
</div>
}
},
{
title: <div style={{ textAlign: 'center' }}>{'期收入'}</div>,
dataIndex: 'MINTURNOVER',
align: 'right',
hideInSearch: true,
width: 110,
valueType: 'digit',
render: (_, record) => {
const title: string = record?.RENTFEE ? `${record?.RENTFEE}(保底租金) /(1 ${record?.TaxRate ? `+${record?.TaxRate}%(税率)` : ''})` : ''
return record?.MINTURNOVER ?
<Tooltip title={title}>
<span>{numeral(record?.MINTURNOVER).format('0,0.00')}</span>
</Tooltip> : '-'
}
},
{
title: <div style={{ textAlign: 'center' }}>{'月收入'}</div>,
dataIndex: 'MonthlyIncome',
align: 'right',
width: 100,
valueType: 'digit',
hideInSearch: true,
render: (_, record) => {
// const title: string = `${record?.MINTURNOVER}(期收入) /12/(1 ${record?.TaxRate?`+${record?.TaxRate}%(税率)`:''})`
const title: string = `${record?.MINTURNOVER}(期收入) /12`
return record?.MonthlyIncome ? <Tooltip title={title}>
<span>{numeral(record?.MonthlyIncome).format('0,0.00')}</span>
</Tooltip> : '-'
}
},
{
title: <div style={{ textAlign: 'center' }}>{'累计月数'}</div>,
dataIndex: 'MonthlyCount',
align: 'right',
width: 100,
hideInSearch: true,
},
{
title: <div style={{ textAlign: 'center' }}>{'累计应确认收入(保底租金)'}</div>,
dataIndex: 'MonthlyTotalIncome',
align: 'right',
width: 200,
valueType: 'digit',
hideInSearch: true,
render: (_, record) => {
// const title: string = `${record?.MonthlyIncome}(月收入) * ${record?.MonthlyCount}(累计月数)`
const title: string = `${record?.Remark}`
return record?.MonthlyTotalIncome && record?.BUSINESSPROJECT_ID ? <Tooltip title={title}>
<span>{record?.MonthlyTotalIncome ? numeral(record?.MonthlyTotalIncome).format('0,0.00') : '-'}</span>
</Tooltip> : record?.MonthlyTotalIncome ? numeral(record?.MonthlyTotalIncome).format('0,0.00') : '-'
}
},
]
},
{
title: '浮动提成应确认收入',
dataIndex: '',
hideInSearch: true,
children: [
{
title: <div style={{ textAlign: 'center' }}>{'当月分润营业额'}</div>,
dataIndex: 'CurMonthRevenue',
width: 130,
valueType: 'digit',
align: 'right',
hideInSearch: true,
},
{
title: <div style={{ textAlign: 'center' }}>{'累计营业额'}</div>,
dataIndex: 'REVENUEDAILY_AMOUNTTotal',
width: 130,
valueType: 'digit',
align: 'right',
hideInSearch: true,
render: (_, record) => {
return record?.REVENUEDAILY_AMOUNTTotal ?
record?.BUSINESSPROJECT_ID ?
<a onClick={() => {
const obj: any = {
...record,
BUSINESSAPPROVAL_ID: record?.BusinessApprovalId
}
let [monthStartTime, monthEndTime] = record?.IndexDesc.split('-')
monthStartTime = moment(monthStartTime).format('YYYY-MM-DD')
monthEndTime = moment(monthEndTime).format('YYYY-MM-DD')
const startDate: any = moment(monthTime).startOf('months').format('YYYY-MM-DD')
const endDate: any = moment(monthTime).endOf('months').format('YYYY-MM-DD')
obj.startTime = monthStartTime
if (new Date(monthEndTime).getTime() < new Date(endDate).getTime()) {
obj.endTime = monthEndTime
} else {
obj.endTime = endDate
}
console.log('obj', obj)
setCompareCurrent(obj)
setShowCompareDrawer(true)
}}>{numeral(record?.REVENUEDAILY_AMOUNTTotal).format('0,0.00')}</a> : <span>{numeral(record?.REVENUEDAILY_AMOUNTTotal).format('0,0.00')}</span>
:
'-'
}
},
{
title: <div style={{ textAlign: 'center' }}>{'自然日营收'}</div>,
dataIndex: 'DailyRevenueAmount',
width: 130,
valueType: 'digit',
align: 'right',
hideInSearch: true,
render: (_, record) => {
return numeral(record?.DailyRevenueAmount).format('0,0.00')
}
},
{
title: <div style={{ textAlign: 'center' }}>{'营收差额'}</div>,
dataIndex: 'DiffRevenueAmount',
width: 130,
valueType: 'digit',
align: 'right',
hideInSearch: true,
render: (_, record) => {
return numeral(record?.DiffRevenueAmount).format('0,0.00')
}
},
{
title: <div style={{ textAlign: 'center' }}>{'提成金额'}</div>,
dataIndex: 'GUARANTEERATIOAMOUNT',
width: 120,
valueType: 'digit',
align: 'right',
hideInSearch: true,
render: (_, record) => {
const title: string = `分润营业额(${record.REVENUEDAILY_AMOUNTTotal}) * 提成比例(${record.GUARANTEERATIO ? `${record.GUARANTEERATIO}%` : ''})`
return record.GUARANTEERATIO ? <Tooltip title={title}>
<span>{numeral(record?.GUARANTEERATIOAMOUNT).format('0,0.00')}</span>
</Tooltip> : <span>{numeral(record?.GUARANTEERATIOAMOUNT).format('0,0.00')}</span>
}
},
{
title: <div style={{ textAlign: 'center' }}>{'提成收入'}</div>,
dataIndex: 'GUARANTEERATIOINCOME',
width: 120,
valueType: 'digit',
align: 'right',
hideInSearch: true,
render: (_, record) => {
const title: string = `提成金额(${record.GUARANTEERATIOAMOUNT}) / 税(1 + ${numeral(record.TaxRate / 100).format('0.00')})`
return record.TaxRate ? <Tooltip title={title}>
<span>{numeral(record?.GUARANTEERATIOINCOME).format('0,0.00')}</span>
</Tooltip> : <span>{numeral(record?.GUARANTEERATIOINCOME).format('0,0.00')}</span>
}
},
]
},
{
title: '本月确认收入',
dataIndex: '',
fixed: 'right',
hideInSearch: true,
children: [
{
title: <div style={{ textAlign: 'center' }}>{'累计应确认收入'}</div>,
dataIndex: 'ROYALTYTHEORYMUST',
width: 130,
valueType: 'digit',
align: 'right',
fixed: 'right',
hideInSearch: true,
render: (_, record) => {
const title: string = record?.GUARANTEERATIOINCOME > record?.MonthlyTotalIncome ?
`${record?.GUARANTEERATIOINCOME}(提成收入)>${record?.MonthlyTotalIncome}(累计应确认收入)=${record?.GUARANTEERATIOINCOME}(提成收入)` :
`${record?.MonthlyTotalIncome}(累计应确认收入)>${record?.GUARANTEERATIOINCOME}(提成收入)=${record?.MonthlyTotalIncome}(累计应确认收入)`
return record?.ROYALTYTHEORYMUST && record?.BUSINESSPROJECT_ID ?
<Tooltip title={title}>
<a style={{ color: record?.BUSINESSPROJECT_ID ? '#1890ff' : '#000000' }} onClick={async () => {
if (record?.BUSINESSPROJECT_ID) {
const req = {
BusinessProjectId: record?.BUSINESSPROJECT_ID
}
const data = await getProjectDetail(req)
const obj: any = {
...record,
endTime: moment(monthTime).endOf('month').format('YYYY-MM-DD'),
startTime: '',
...data
}
setCurrentRow(obj);
setDrawerSearchTime(moment(monthTime).format('YYYYMM'))
// setShowMonthDetail(true);
setShowMonthSecondDetail(true);
}
}}>{record?.ROYALTYTHEORYMUST ? numeral(record?.ROYALTYTHEORYMUST).format('0,0.00') : '-'}</a>
</Tooltip>
: record?.ROYALTYTHEORYMUST ? numeral(record?.ROYALTYTHEORYMUST).format('0,0.00') : '-'
}
},
{
title: <div style={{ textAlign: 'center' }}>{'累计已确认收入'}</div>,
dataIndex: 'ROYALTYTHEORYOK',
width: 130,
valueType: 'digit',
align: 'right',
fixed: 'right',
hideInSearch: true,
render: (_, record) => {
return <a style={{ color: record?.BUSINESSPROJECT_ID ? '#1890ff' : '#000000' }} onClick={async () => {
if (record?.BUSINESSPROJECT_ID) {
const req = {
BusinessProjectId: record?.BUSINESSPROJECT_ID
}
const data = await getProjectDetail(req)
const nowDay: any = moment(monthTime).endOf('month').format('YYYY-MM-DD')
const obj: any = {
...record,
endTime: moment(nowDay).subtract(1, 'months').endOf('month').format('YYYY-MM-DD'),
startTime: '',
...data
}
setCurrentRow(obj);
setDrawerSearchTime(moment(monthTime).subtract(1, 'months').format('YYYYMM'))
setShowMonthSecondDetail(true);
}
}}>{record?.ROYALTYTHEORYOK ? numeral(record?.ROYALTYTHEORYOK).format('0,0.00') : '-'}</a>
}
},
{
title: <div style={{ textAlign: 'center' }}>{'本月应确认'}</div>,
dataIndex: 'ROYALTYTHEORYMONTHLYMUST',
width: 110,
valueType: 'digit',
align: 'right',
fixed: 'right',
hideInSearch: true,
render: (_, record) => {
const title: string = `累计应确认收入(${record.ROYALTYTHEORYMUST}) - 累计已确认收入(${numeral(record?.ROYALTYTHEORYOK).format('0.00')})`
return <Tooltip title={title}><a style={{ color: record?.BUSINESSPROJECT_ID ? '#1890ff' : '#000000' }} onClick={async () => {
if (record?.BUSINESSPROJECT_ID) {
const req = {
BusinessProjectId: record?.BUSINESSPROJECT_ID
}
const data = await getProjectDetail(req)
const obj: any = {
...record,
endTime: moment(monthTime).endOf('month').format('YYYY-MM-DD'),
startTime: moment(monthTime).startOf('month').format('YYYY-MM-DD'),
...data
}
setCurrentRow(obj);
setDrawerSearchTime(moment(monthTime).format('YYYYMM'))
// setShowMonthDetail(true);
setShowMonthSecondDetail(true);
}
}}>{record?.ROYALTYTHEORYMONTHLYMUST ? numeral(record?.ROYALTYTHEORYMONTHLYMUST).format('0,0.00') : '-'}</a></Tooltip>
}
},
]
},
]
// 导出表格的columns
const exportColumns: any = [
{
title: <div style={{ textAlign: 'center' }}>{'序号'}</div>,
hideInSearch: true,
dataIndex: 'index',
width: 90,
fixed: 'left',
align: 'center',
render: (_, record) => {
return record.index ? record.index : ''
}
},
{
title: '管理中心',
dataIndex: 'SPRegionType_Name',
hideInSearch: true,
align: 'center',
// render: (text, record, index) => {
// const obj = {
// children: text !== null ? text : '',
// props: {},
// };
// if (undefined !== text && '' !== text && text === '合计') {
// obj.props.colSpan = 8;
// }
// return obj;
// },
},
{
title: '服务区',
align: 'center',
dataIndex: 'Serverpart_Name',
hideInSearch: true,
},
{
title: '门店名称',
dataIndex: 'Name',
align: 'center',
hideInSearch: true,
render: (_, record) => {
return record?.Name || record?.someName || '-'
}
},
{
title: <div style={{ textAlign: 'center' }}>{'经营商户'}</div>,
dataIndex: 'MERCHANTS_NAME',
align: 'left',
width: 200,
ellipsis: true,
render: (_, record) => {
return record?.MERCHANTS_NAME || record?.sameMERCHANTS_NAME || '-'
}
},
{
title: <div style={{ textAlign: 'center' }}>{'合同起止日期'}</div>,
dataIndex: 'COMPACT_DATE',
align: 'center',
width: 200,
hideInSearch: true,
ellipsis: true,
render: (_, record) => {
return `${record?.COMPACT_STARTDATE ? moment(record?.COMPACT_STARTDATE).format('YYYY/MM/DD') : ''}${record?.COMPACT_ENDDATE ? `-${moment(record?.COMPACT_ENDDATE).format('YYYY/MM/DD')}` : ''}`
}
},
{
title: <div style={{ textAlign: 'center' }}>{'结算模式'}</div>,
dataIndex: 'SettlementModes',
align: 'center',
hideInSearch: true,
valueType: 'select',
width: 90,
valueEnum: SETTLEMENT_MODESObj
},
{
title: <div style={{ textAlign: 'center' }}></div>,
dataIndex: 'SwitchDate',
width: 110,
align: 'center',
hideInSearch: true,
render: (_, record) => {
return record?.SwitchDate ? moment(record?.SwitchDate).format('YYYY-MM-DD') : '-'
}
},
{
title: '当年基础信息',
dataIndex: '',
hideInSearch: true,
children: [
{
title: <div style={{ textAlign: 'center' }}>{'期数'}</div>,
dataIndex: 'IndexStr',
width: 90,
align: 'center',
hideInSearch: true,
},
{
title: <div style={{ textAlign: 'center' }}>{'履约保证金'}</div>,
dataIndex: 'SECURITYDEPOSIT',
width: 90,
align: 'right',
hideInSearch: true,
render: (_, record) => {
// return record?.SECURITYDEPOSIT ? numeral(record?.SECURITYDEPOSIT).format('0,0') : '0'
return record?.SECURITYDEPOSIT ? handleFormatNumber(record?.SECURITYDEPOSIT) : '0.00'
}
},
{
title: <div style={{ textAlign: 'center' }}>{'期限'}</div>,
dataIndex: 'IndexDesc',
align: 'center',
width: 200,
hideInSearch: true,
},
{
title: <div style={{ textAlign: 'center' }}>{'装修期'}</div>,
dataIndex: 'DecorateDesc',
align: 'center',
width: 180,
hideInSearch: true,
},
{
title: <div style={{ textAlign: 'center' }}>{'保底/固定租金'}</div>,
dataIndex: 'RENTFEE',
valueType: 'digit',
align: 'right',
width: 120,
hideInSearch: true,
render: (_, record) => {
return record?.RENTFEE ? handleFormatNumber(record?.RENTFEE) : '0.00'
}
},
{
title: <div style={{ textAlign: 'center' }}>{'提成比例'}</div>,
dataIndex: 'GUARANTEERATIO',
align: 'center',
width: 100,
hideInSearch: true,
render: (_, record) => {
return record.GUARANTEERATIO ? `${record.GUARANTEERATIO}%` : '0'
}
},
]
},
{
title: '保底租金应确认收入',
dataIndex: '',
hideInSearch: true,
children: [
{
title: <div style={{ textAlign: 'center' }}>{'税率'}</div>,
dataIndex: 'TaxRate',
align: 'center',
width: 100,
hideInSearch: true,
render: (_, record) => {
return <span>{record?.TaxRate ? `${record?.TaxRate}%` : '-'}</span>
}
},
{
title: <div style={{ textAlign: 'center' }}>{'期收入'}</div>,
dataIndex: 'MINTURNOVER',
align: 'right',
hideInSearch: true,
width: 110,
valueType: 'digit',
render: (_, record) => {
return record?.MINTURNOVER ? handleFormatNumber(record?.MINTURNOVER) : '0.00'
}
},
{
title: <div style={{ textAlign: 'center' }}>{'月收入'}</div>,
dataIndex: 'MonthlyIncome',
align: 'right',
width: 100,
valueType: 'digit',
hideInSearch: true,
render: (_, record) => {
// const title: string = `${record?.MINTURNOVER}(期收入) /12/(1 ${record?.TaxRate?`+${record?.TaxRate}%(税率)`:''})`
const title: string = `${record?.MINTURNOVER}(期收入) /12`
return record?.MonthlyIncome ? <Tooltip title={title}>
{/* <span>{numeral(record?.MonthlyIncome).format('0,0.00')}</span> */}
<span>{record?.MonthlyIncome ? handleFormatNumber(record?.MonthlyIncome) : '0.00'}</span>
</Tooltip> : '0'
}
},
{
title: <div style={{ textAlign: 'center' }}>{'累计月数'}</div>,
dataIndex: 'MonthlyCount',
align: 'right',
width: 100,
hideInSearch: true,
},
{
title: <div style={{ textAlign: 'center' }}>{'累计应确认收入(保底租金)'}</div>,
dataIndex: 'MonthlyTotalIncome',
align: 'right',
width: 200,
valueType: 'digit',
hideInSearch: true,
render: (_, record) => {
// const title: string = `${record?.MonthlyIncome}(月收入) * ${record?.MonthlyCount}(累计月数)`
const title: string = `${record?.Remark}`
return record?.MonthlyTotalIncome && record?.BUSINESSPROJECT_ID ? <Tooltip title={title}>
{/* <span>{numeral(record?.MonthlyTotalIncome).format('0,0.00')}</span> */}
<span>{record?.MonthlyTotalIncome ? handleFormatNumber(record?.MonthlyTotalIncome) : '0.00'}</span>
</Tooltip> : record?.MonthlyTotalIncome ?
<span>{record?.MonthlyTotalIncome ? handleFormatNumber(record?.MonthlyTotalIncome) : '0.00'}</span>
: '0'
}
},
]
},
{
title: '浮动提成应确认收入',
dataIndex: '',
hideInSearch: true,
children: [
{
title: <div style={{ textAlign: 'center' }}>{'当月分润营业额'}</div>,
dataIndex: 'CurMonthRevenue',
width: 130,
valueType: 'digit',
align: 'right',
hideInSearch: true,
render: (_, record) => {
return record?.CurMonthRevenue ? handleFormatNumber(record?.CurMonthRevenue) : '0.00'
}
},
{
title: <div style={{ textAlign: 'center' }}>{'累计营业额'}</div>,
dataIndex: 'REVENUEDAILY_AMOUNTTotal',
width: 130,
valueType: 'digit',
align: 'right',
hideInSearch: true,
render: (_, record) => {
return record?.REVENUEDAILY_AMOUNTTotal ? handleFormatNumber(record?.REVENUEDAILY_AMOUNTTotal) : '0.00'
}
},
{
title: <div style={{ textAlign: 'center' }}>{'自然日营收'}</div>,
dataIndex: 'DailyRevenueAmount',
width: 130,
valueType: 'digit',
align: 'right',
hideInSearch: true,
render: (_, record) => {
return record?.DailyRevenueAmount ? handleFormatNumber(record?.DailyRevenueAmount) : '0.00'
}
},
{
title: <div style={{ textAlign: 'center' }}>{'营收差额'}</div>,
dataIndex: 'DiffRevenueAmount',
width: 130,
valueType: 'digit',
align: 'right',
hideInSearch: true,
render: (_, record) => {
return record?.DiffRevenueAmount ? handleFormatNumber(record?.DiffRevenueAmount) : '0.00'
}
},
{
title: <div style={{ textAlign: 'center' }}>{'提成金额'}</div>,
dataIndex: 'GUARANTEERATIOAMOUNT',
width: 120,
valueType: 'digit',
align: 'right',
hideInSearch: true,
render: (_, record) => {
const title: string = `分润营业额(${record.REVENUEDAILY_AMOUNTTotal}) * 提成比例(${record.GUARANTEERATIO ? `${record.GUARANTEERATIO}%` : ''})`
return record.GUARANTEERATIO ? <Tooltip title={title}>
<span>
{/* {numeral(record?.GUARANTEERATIOAMOUNT).format('0,0.00')} */}
{record?.GUARANTEERATIOAMOUNT ? handleFormatNumber(record?.GUARANTEERATIOAMOUNT) : '0.00'}
</span>
</Tooltip> : <span>
{/* {numeral(record?.GUARANTEERATIOAMOUNT).format('0,0.00')} */}
{record?.GUARANTEERATIOAMOUNT ? handleFormatNumber(record?.GUARANTEERATIOAMOUNT) : '0.00'}
</span>
}
},
{
title: <div style={{ textAlign: 'center' }}>{'提成收入'}</div>,
dataIndex: 'GUARANTEERATIOINCOME',
width: 120,
valueType: 'digit',
align: 'right',
hideInSearch: true,
render: (_, record) => {
const title: string = `提成金额(${record.GUARANTEERATIOAMOUNT}) / 税(1 + ${numeral(record.TaxRate / 100).format('0.00')})`
return record.TaxRate ? <Tooltip title={title}>
<span>
{/* {numeral(record?.GUARANTEERATIOINCOME).format('0,0.00')} */}
{record?.GUARANTEERATIOINCOME ? handleFormatNumber(record?.GUARANTEERATIOINCOME) : '0.00'}
</span>
</Tooltip> : <span>
{/* {numeral(record?.GUARANTEERATIOINCOME).format('0,0.00')} */}
{record?.GUARANTEERATIOINCOME ? handleFormatNumber(record?.GUARANTEERATIOINCOME) : '0.00'}
</span>
}
},
]
},
{
title: '本月确认收入',
dataIndex: '',
fixed: 'right',
hideInSearch: true,
children: [
{
title: <div style={{ textAlign: 'center' }}>{'累计应确认收入'}</div>,
dataIndex: 'ROYALTYTHEORYMUST',
width: 130,
valueType: 'digit',
align: 'right',
fixed: 'right',
hideInSearch: true,
render: (_, record) => {
const title: string = record?.GUARANTEERATIOINCOME > record?.MonthlyTotalIncome ?
`${record?.GUARANTEERATIOINCOME}(提成收入)>${record?.MonthlyTotalIncome}(累计应确认收入)=${record?.GUARANTEERATIOINCOME}(提成收入)` :
`${record?.MonthlyTotalIncome}(累计应确认收入)>${record?.GUARANTEERATIOINCOME}(提成收入)=${record?.MonthlyTotalIncome}(累计应确认收入)`
return record?.ROYALTYTHEORYMUST && record?.BUSINESSPROJECT_ID ?
<Tooltip title={title}>
<a style={{ color: record?.BUSINESSPROJECT_ID ? '#1890ff' : '#000000' }} onClick={async () => {
if (record?.BUSINESSPROJECT_ID) {
const req = {
BusinessProjectId: record?.BUSINESSPROJECT_ID
}
const data = await getProjectDetail(req)
const obj: any = {
...record,
endTime: moment(monthTime).endOf('month').format('YYYY-MM-DD'),
startTime: '',
...data
}
setCurrentRow(obj);
setDrawerSearchTime(moment(monthTime).format('YYYYMM'))
// setShowMonthDetail(true);
setShowMonthSecondDetail(true);
}
}}>
{/* {record?.ROYALTYTHEORYMUST ? numeral(record?.ROYALTYTHEORYMUST).format('0,0.00') : '0'} */}
{record?.ROYALTYTHEORYMUST ? handleFormatNumber(record?.ROYALTYTHEORYMUST) : '0.00'}
</a>
</Tooltip>
:
record?.ROYALTYTHEORYMUST ? handleFormatNumber(record?.ROYALTYTHEORYMUST) : '0.00'
}
},
{
title: <div style={{ textAlign: 'center' }}>{'累计已确认收入'}</div>,
dataIndex: 'ROYALTYTHEORYOK',
width: 130,
valueType: 'digit',
align: 'right',
fixed: 'right',
hideInSearch: true,
render: (_, record) => {
return <a style={{ color: record?.BUSINESSPROJECT_ID ? '#1890ff' : '#000000' }} onClick={async () => {
if (record?.BUSINESSPROJECT_ID) {
const req = {
BusinessProjectId: record?.BUSINESSPROJECT_ID
}
const data = await getProjectDetail(req)
const nowDay: any = moment(monthTime).endOf('month').format('YYYY-MM-DD')
const obj: any = {
...record,
endTime: moment(nowDay).subtract(1, 'months').endOf('month').format('YYYY-MM-DD'),
startTime: '',
...data
}
setCurrentRow(obj);
setDrawerSearchTime(moment(monthTime).subtract(1, 'months').format('YYYYMM'))
setShowMonthSecondDetail(true);
}
}}>
{/* {record?.ROYALTYTHEORYOK ? numeral(record?.ROYALTYTHEORYOK).format('0,0.00') : '0'} */}
{record?.ROYALTYTHEORYOK ? handleFormatNumber(record?.ROYALTYTHEORYOK) : '0.00'}
</a>
}
},
{
title: <div style={{ textAlign: 'center' }}>{'本月应确认'}</div>,
dataIndex: 'ROYALTYTHEORYMONTHLYMUST',
width: 110,
valueType: 'digit',
align: 'right',
fixed: 'right',
hideInSearch: true,
render: (_, record) => {
const title: string = `累计应确认收入(${record.ROYALTYTHEORYMUST}) - 累计已确认收入(${numeral(record?.ROYALTYTHEORYOK).format('0.00')})`
return <Tooltip title={title}><a style={{ color: record?.BUSINESSPROJECT_ID ? '#1890ff' : '#000000' }} onClick={async () => {
if (record?.BUSINESSPROJECT_ID) {
const req = {
BusinessProjectId: record?.BUSINESSPROJECT_ID
}
const data = await getProjectDetail(req)
const obj: any = {
...record,
endTime: moment(monthTime).endOf('month').format('YYYY-MM-DD'),
startTime: moment(monthTime).startOf('month').format('YYYY-MM-DD'),
...data
}
setCurrentRow(obj);
setDrawerSearchTime(moment(monthTime).format('YYYYMM'))
// setShowMonthDetail(true);
setShowMonthSecondDetail(true);
}
}}>
{/* {record?.ROYALTYTHEORYMONTHLYMUST ? numeral(record?.ROYALTYTHEORYMONTHLYMUST).format('0,0.00') : '0'} */}
{record?.ROYALTYTHEORYMONTHLYMUST ? handleFormatNumber(record?.ROYALTYTHEORYMONTHLYMUST) : '0.00'}
</a></Tooltip>
}
},
]
},
]
// 导出excel方法
const exportTable = (e) => {
e.stopPropagation(); // 防止Collapse组件收起
const main = document.getElementsByClassName('revenueConfirmHideBox')[0]
const thead = main.querySelector('thead').cloneNode(true); // 深克隆DOM节点
const tbody = main.querySelector('tbody').cloneNode(true); // 深克隆DOM节点
const container = document.querySelector('#hiddenBox');
// 加个标题
const tableTop = document.createElement('div')
tableTop.innerText = `${searchParams?.MonthDate ? moment(searchParams?.MonthDate).format('YYYY年MM月') : ''}收入确认表`
tableTop.setAttribute('style', 'font-size:20px;font-weight:600;display:flex;width:100%;justify-content: center;text-align: center;');
const tempTable = document.createElement('table');
tempTable.appendChild(tableTop)
tempTable.appendChild(thead);
tempTable.appendChild(tbody);
tempTable.setAttribute('id', 'table-to-xls-revenueConfirm'); // 给table添加id值与按钮上的table字段对应
container.appendChild(tempTable); // 把创建的节点添加到页面容器中
setShowLoading(false)
console.log('downloadBtnRef', downloadBtnRef);
downloadBtnRef.current.handleDownload();
setShowExportTable(false)
tempTable.remove() // 防止重复打印一个内容
}
// 重新刷新调用表格数据
const handleGetRefreshTableData = () => {
actionRef.current?.reload()
}
// compareList组件跳转月份的方法
const handleGetNewMonth = async (obj: any, time: any) => {
setShowCompareDrawer(false)
console.log('obj', obj);
console.log('time', time);
const req = {
BusinessProjectId: obj?.BUSINESSPROJECT_ID,
StatisticsMonth: moment(time).format('YYYYMM'),
ShopRoyaltyId: obj?.ShopRoyaltyId,
}
const data = await handleGetProjectPeriodIncome(req)
console.log('data', data);
if (data && data.length > 0) {
let obj: any = {}
data.forEach((item: any) => {
if (item.SHOPROYALTY_ID === obj?.ShopRoyaltyId) {
obj = item
}
})
let [monthStartTime, monthEndTime] = obj?.IndexDesc.split('-')
monthStartTime = moment(monthStartTime).format('YYYY-MM-DD')
monthEndTime = moment(monthEndTime).format('YYYY-MM-DD')
const startDate: any = moment(monthTime).startOf('months').format('YYYY-MM-DD')
const endDate: any = moment(monthTime).endOf('months').format('YYYY-MM-DD')
obj.startTime = monthStartTime
obj.STATISTICS_MONTH = time
if (new Date(monthEndTime).getTime() < new Date(endDate).getTime()) {
obj.endTime = monthEndTime
} else {
obj.endTime = endDate
}
setCompareCurrent(obj)
}
setShowCompareDrawer(true)
}
return (
<div ref={(el) => {
// 打印报表
if (!reqDetailList || reqDetailList.length === 0) return;
setPrintOut(el);
}}>
{
showLoading ?
<div
style={{
width: '100%',
height: '100%',
background: 'rgba(0,0,0,0.1)',
position: 'fixed',
zIndex: 5,
display: 'flex',
alignItems: 'center',
justifyContent: 'center'
}}
>
<div style={{
display: 'flex',
alignItems: 'center',
justifyContent: 'center',
padding: '15px 20px 10px',
background: '#fff',
borderRadius: '8px',
width: '200px'
}}>
<Spin />
<span style={{ marginLeft: '5px' }}>...</span>
</div>
</div> : ''
}
<div className={'revenueConfirmHideBox'} style={{ position: 'fixed', zIndex: -1, top: 0, left: 0 }}>
{
showExportTable && exportTableData && exportTableData.length > 0 ?
<ProTable
columns={exportColumns}
dataSource={exportTableData}
pagination={false}
expandable={{
defaultExpandAllRows: true
}}
columnsState={{
value: columnsStateMap,
onChange: setColumnsStateMap,
}}
/> : ''
}
</div>
<div id='hiddenBox' style={{ position: 'fixed', zIndex: -1, top: 0, left: 0 }} />
<div style={{ backgroundColor: '#fff', display: 'flex' }}>
{/* <ProCard
style={{ width: !collapsible ? "300px" : "60px" }}
className="pageTable-leftnav"
bodyStyle={{ padding: 0, paddingTop: 20, paddingLeft: 20, width: !collapsible ? "300px" : "60px" }}
extra={<MenuFoldOutlined onClick={() => {
setCollapsible(!collapsible)
}} />}
colSpan={!collapsible ? "300px" : "60px"}
title={!collapsible ? "请选择服务区" : ""}
headerBordered
collapsed={collapsible}
>
{treeView && treeView.length > 0 ? <Tree
checkable
treeData={[{
label: '全部',
value: 0,
key: '0-0',
children: treeView
}]}
fieldNames={{
title: "label",
key: "key"
}}
blockNode
defaultExpandedKeys={['0-0']}
onCheck={(checkedKeys: React.Key[] | any, info) => {
const selectedIds = info.checkedNodes.filter(n => n?.type === 1)
const selectedAreaIds = info.checkedNodes.filter(n => n?.type === 0)
setSelectedId(selectedIds.map(n => n?.value)?.toString() || '')
console.log('selectedAreaIds', selectedAreaIds.map(n => n?.value)?.toString() || '');
setSelectAreaId(selectedAreaIds.map(n => n?.value)?.toString() || '')
// actionRef?.current?.reload()
// getData(selectedIds.map(n => n?.value)?.toString() || '')
}}
// switcherIcon={<PlusOutlined />}
/> : ''}
</ProCard> */}
<LeftSelectTree setSelectedId={setSelectedId} setCollapsible={setCollapsible} collapsible={collapsible} otherFun={(info: any) => {
const selectedIds = info.checkedNodes.filter(n => n?.type === 1)
const selectedAreaIds = info.checkedNodes.filter(n => n?.type === 0)
setSelectedId(selectedIds.map(n => n?.value)?.toString() || '')
setSelectAreaId(selectedAreaIds.map(n => n?.value)?.toString() || '')
}} />
<div style={{
width: !collapsible ? 'calc(100% - 300px)' : 'calc(100% - 60px)',
paddingTop: 0,
paddingBottom: 0,
paddingRight: 0
}}>
<ProTable
actionRef={actionRef}
formRef={formRef}
columns={columns}
bordered
rowKey={(record) => record?.Name + record?.Id + record?.IndexStr + record?.IndexDesc}
search={{ span: 6 }}
pagination={false}
scroll={{ x: 'max-content', y: 'calc(100vh - 470px)' }}
request={async (params: any) => {
if (!selectedId) {
setReqDetailList([])
return []
}
if (params.MonthDate) {
const date = new Date(params.MonthDate)
const y = date.getFullYear()
const m = date.getMonth() + 1
setSearchMonth(m)
setExportDate(`${y}${m < 10 ? `0${m}` : m}`)
setMonthTime(params.MonthDate)
}
console.log('params', params);
setSearchParams(params)
// let SETTLEMENT_MODESSTR: string = ''
// if (params.SETTLEMENT_MODES && params.SETTLEMENT_MODES.length > 0) {
// params.SETTLEMENT_MODES.forEach((item: any) => {
// if (SETTLEMENT_MODESSTR) {
// SETTLEMENT_MODESSTR += `,${item}`
// } else {
// SETTLEMENT_MODESSTR = item
// }
// })
// }
// 是否只选择了一个服务区
let isOneServerPart: boolean = false
// 是否只选择了一个片区
let isOneArea: boolean = false
if (selectedId.indexOf(',') === -1) {
isOneServerPart = true
}
console.log('selectedAreaId', selectedAreaId);
if (selectedAreaId && selectedAreaId.indexOf(',') === -1) {
isOneArea = true
}
const req = {
ServerpartIds: selectedId,
SETTLEMENT_MODES: params?.SettlementModes && params?.SettlementModes.length > 0 ? params?.SettlementModes.toString() : "",
startDate: params.MonthDate ? moment(params.MonthDate).format('YYYYMM') : '',
endDate: params.MonthDate ? moment(params.MonthDate).format('YYYYMM') : '',
keyword: params.MERCHANTS_NAME,
SolidType: true,
ShowHisProject: params?.ShowHisProject === 'true' ? true : params?.ShowHisProject === 'false' ? false : ''
}
const res = await handleGetTableRevenueRecognitionOtherData(req)
console.log('res', res)
setOtherData(res.OtherData)
const data = res.List
setDefaultTableData(data)
if (data && data.length > 0) {
// 拿到所有服务区的税率
const taxRate: any = await handleGetSERVERPARTCRTList({
SearchParameter: {
},
PageIndex: 1,
PageSize: 999999
})
console.log('taxRate', taxRate);
const taxRateObj: any = {}
if (taxRate && taxRate.length > 0) {
taxRate.forEach((item: any) => {
taxRateObj[item.SERVERPART_ID] = item.ACCOUNTTAX
})
}
const list: any = JSON.parse(JSON.stringify(wrapTreeNode(data)))
console.log('list', list);
console.log('taxRateObj', taxRateObj);
// 下面处理的各种东西太多了 把判断税率是否正确 放在上面 多遍历一遍
list.forEach((item: any) => {
if (item.children && item.children.length > 0) {
item.children.forEach((subItem: any) => {
if (subItem.children && subItem.children.length > 0) {
subItem.children.forEach((thirdItem: any) => {
if (taxRateObj[Number(thirdItem.SERVERPART_ID)]) {
// 正确的税率值
const right: any = taxRateObj[Number(thirdItem.SERVERPART_ID)]
thirdItem.isErrorTaxRate = Number(thirdItem.TaxRate) !== Number(right)
thirdItem.errorTaxRate = Number(right)
if (thirdItem.isErrorTaxRate) {
item.isErrorTaxRate = true
subItem.isErrorTaxRate = true
setDifferentRate(true)
}
subItem.TaxRate = Number(right)
}
})
}
})
}
})
// 当一行数据和上一行的数据 是同一个项目时 省略不显示重复的数据
list.forEach((item: any) => {
if (item.children && item.children.length > 0) {
item.children.forEach((subItem: any) => {
if (subItem.children && subItem.children.length > 0) {
// 当一行数据和上一行的数据 是同一个项目时 省略不显示重复的数据
for (let i = 0; i <= subItem.children.length; i++) {
if (i >= 1) {
if (subItem.children[i] && subItem.children[i - 1]) {
if (subItem.children[i].BUSINESSPROJECT_ID === subItem.children[i - 1].BUSINESSPROJECT_ID) {
subItem.children[i].someName = subItem.children[i].Name
subItem.children[i].Name = ''
subItem.children[i].sameMERCHANTS_NAME = subItem.children[i].MERCHANTS_NAME
subItem.children[i].MERCHANTS_NAME = ''
subItem.children[i].BusinessType = ''
subItem.children[i].indexFlag = true
if (subItem.children[i].SECURITYDEPOSIT === subItem.children[i - 1].SECURITYDEPOSIT) {
subItem.children[i].SECURITYDEPOSIT = ''
}
if (subItem.children[i].RENTFEE === subItem.children[i - 1].RENTFEE) {
subItem.children[i].RENTFEE = ''
}
}
}
}
}
let index: number = 1
// 加序号 同一个项目算一个
subItem.children.forEach((thirdItem: any) => {
if (!thirdItem.indexFlag) {
thirdItem.SERVERPART_ID = subItem.Id
thirdItem.index = index++
}
})
}
})
}
})
setReqDetailList(list)
const exportList: any = []
if (list && list.length > 0) {
let index: number = 1
list.forEach((item: any) => {
if (item.children && item.children.length > 0) {
item.children.forEach((subItem: any) => {
if (subItem.children && subItem.children.length > 0) {
subItem.children.forEach((thirdItem: any) => {
thirdItem.SPRegionType_Name = item.Name
thirdItem.Serverpart_Name = subItem.Name
thirdItem.index = index
exportList.push(thirdItem)
index++
})
}
})
}
})
}
console.log('exportList', exportList);
if (exportList && exportList.length > 0) {
const exportRes: any = JSON.parse(JSON.stringify(exportList))
// 期收入
let MINTURNOVERSUM: number = 0
// 月收入
let MonthlyIncomeSum: number = 0
// 累计应确认收入(保底租金)
let MonthlyTotalIncomeSUM: number = 0
// 累计营业额
let REVENUEDAILY_AMOUNTTotalSUM: number = 0
// 提成金额
let GUARANTEERATIOAMOUNTSUM: number = 0
// 提成收入
let GUARANTEERATIOINCOMESUM: number = 0
// 累计应确认收入
let ROYALTYTHEORYMUSTSUM: number = 0
// 累计已确认收入
let ROYALTYTHEORYOKSUM: number = 0
// 本月应确认
let ROYALTYTHEORYMONTHLYMUSTSUM: number = 0
// 自然日营收合计
let DailyRevenueAmountSum: number = 0
// 营收差额合计
let DiffRevenueAmountSum: number = 0
exportList.forEach((item: any) => {
MINTURNOVERSUM += item.MINTURNOVER * 100
MonthlyTotalIncomeSUM += item.MonthlyTotalIncome * 100
REVENUEDAILY_AMOUNTTotalSUM += item.REVENUEDAILY_AMOUNTTotal * 100
GUARANTEERATIOAMOUNTSUM += item.GUARANTEERATIOAMOUNT * 100
GUARANTEERATIOINCOMESUM += item.GUARANTEERATIOINCOME * 100
ROYALTYTHEORYMUSTSUM += item.ROYALTYTHEORYMUST * 100
ROYALTYTHEORYOKSUM += item.ROYALTYTHEORYOK * 100
ROYALTYTHEORYMONTHLYMUSTSUM += item.ROYALTYTHEORYMONTHLYMUST * 100
DailyRevenueAmountSum += item.DailyRevenueAmount * 100
DiffRevenueAmountSum += item.DiffRevenueAmount * 100
MonthlyIncomeSum += item.MonthlyIncome * 100
})
exportRes.forEach((item: any) => {
item.SPRegionType_Name = item.SPRegionType_Name.split('管理中心')[0]
item.Serverpart_Name = item.Serverpart_Name.split('服务区')[0]
})
exportRes.push({
SPRegionType_Name: '合计',
MINTURNOVER: handleHighPrecision(MINTURNOVERSUM),
MonthlyTotalIncome: handleHighPrecision(MonthlyTotalIncomeSUM),
REVENUEDAILY_AMOUNTTotal: handleHighPrecision(REVENUEDAILY_AMOUNTTotalSUM),
GUARANTEERATIOAMOUNT: handleHighPrecision(GUARANTEERATIOAMOUNTSUM),
GUARANTEERATIOINCOME: handleHighPrecision(GUARANTEERATIOINCOMESUM),
ROYALTYTHEORYMUST: handleHighPrecision(ROYALTYTHEORYMUSTSUM),
ROYALTYTHEORYOK: handleHighPrecision(ROYALTYTHEORYOKSUM),
ROYALTYTHEORYMONTHLYMUST: handleHighPrecision(ROYALTYTHEORYMONTHLYMUSTSUM),
DailyRevenueAmount: handleHighPrecision(DailyRevenueAmountSum),
DiffRevenueAmount: handleHighPrecision(DiffRevenueAmountSum),
MonthlyIncome: handleHighPrecision(MonthlyIncomeSum)
})
console.log('exportRes', exportRes);
setExportTableData(exportRes)
} else {
setExportTableData([])
}
console.log('isOneServerPart', isOneServerPart);
console.log('isOneArea', isOneArea);
const res: any = []
if (isOneServerPart) {
list.forEach((item: any) => {
if (item.children && item.children.length > 0) {
item.children.forEach((subItem: any) => {
res.push(subItem)
})
}
})
console.log('setExportTableData1', res);
return { data: res, success: true }
}
if (!isOneArea) {
console.log('list', list);
if (list && list.length > 0) {
// 期收入
let MINTURNOVERSUM: number = 0
// 累计应确认收入(保底租金)
let MonthlyTotalIncomeSUM: number = 0
// 累计营业额
let REVENUEDAILY_AMOUNTTotalSUM: number = 0
// 提成金额
let GUARANTEERATIOAMOUNTSUM: number = 0
// 提成收入
let GUARANTEERATIOINCOMESUM: number = 0
// 累计应确认收入
let ROYALTYTHEORYMUSTSUM: number = 0
// 累计已确认收入
let ROYALTYTHEORYOKSUM: number = 0
// 本月应确认
let ROYALTYTHEORYMONTHLYMUSTSUM: number = 0
// 自然日营收合计
let DailyRevenueAmountSum: number = 0
// 营收差额合计
let DiffRevenueAmountSum: number = 0
list.forEach((item: any) => {
MINTURNOVERSUM += item.MINTURNOVER * 100
MonthlyTotalIncomeSUM += item.MonthlyTotalIncome * 100
REVENUEDAILY_AMOUNTTotalSUM += item.REVENUEDAILY_AMOUNTTotal * 100
GUARANTEERATIOAMOUNTSUM += item.GUARANTEERATIOAMOUNT * 100
GUARANTEERATIOINCOMESUM += item.GUARANTEERATIOINCOME * 100
ROYALTYTHEORYMUSTSUM += item.ROYALTYTHEORYMUST * 100
ROYALTYTHEORYOKSUM += item.ROYALTYTHEORYOK * 100
ROYALTYTHEORYMONTHLYMUSTSUM += item.ROYALTYTHEORYMONTHLYMUST * 100
DailyRevenueAmountSum += item.DailyRevenueAmount * 100
DiffRevenueAmountSum += item.DiffRevenueAmount * 100
})
list.unshift({
Name: '合计',
MINTURNOVER: handleHighPrecision(MINTURNOVERSUM),
MonthlyTotalIncome: handleHighPrecision(MonthlyTotalIncomeSUM),
REVENUEDAILY_AMOUNTTotal: handleHighPrecision(REVENUEDAILY_AMOUNTTotalSUM),
GUARANTEERATIOAMOUNT: handleHighPrecision(GUARANTEERATIOAMOUNTSUM),
GUARANTEERATIOINCOME: handleHighPrecision(GUARANTEERATIOINCOMESUM),
ROYALTYTHEORYMUST: handleHighPrecision(ROYALTYTHEORYMUSTSUM),
ROYALTYTHEORYOK: handleHighPrecision(ROYALTYTHEORYOKSUM),
ROYALTYTHEORYMONTHLYMUST: handleHighPrecision(ROYALTYTHEORYMONTHLYMUSTSUM),
DailyRevenueAmount: handleHighPrecision(DailyRevenueAmountSum),
DiffRevenueAmount: handleHighPrecision(DiffRevenueAmountSum)
})
console.log('setExportTableData2', list);
return { data: list, success: true }
}
}
console.log('setExportTableData3', list);
return { data: list, success: true }
}
// 都没数据 那导出也没数据
setExportTableData([])
return { data: [], success: true }
}}
headerTitle={<span style={{ color: "#1890ff", fontSize: 14, fontWeight: 600 }}>{`分账收银收入确认表(${searchMonth || '-'}月)`}</span>} // 列表表头
columnsState={{
value: columnsStateMap,
onChange: setColumnsStateMap,
}}
toolbar={{
actions: [
<span style={{ visibility: 'hidden' }}>
<ReactHTMLTableToExcel
buttonText={'导出excel'}
ref={downloadBtnRef}
table="table-to-xls-revenueConfirm"
filename={`分账收银收入确认表(${searchMonth || '-'}_${moment().format('YYYY_MM_DD')}`}
sheet="sheet1"
/>
</span>,
<Typography.Text type="secondary"></Typography.Text>,
<>
{
otherData ?
<Typography.Text type="secondary" > {moment(otherData).format('YYYY-MM-DD')} </Typography.Text>
: ''
}
</>,
<>
{/* 只八月显示 */}
{
moment(searchParams?.MonthDate || '').format('YYYYMM') === moment().subtract(1, 'day').subtract(1, 'm').format('YYYYMM') ?
<Popconfirm title={'确认要固化数据?'} onConfirm={async () => {
if (differentRate) {
confirm({
width: 500,
content: '请检查税率是否一致',
onOk: async () => {
if (defaultTableData && defaultTableData.length > 0) {
const req: any = defaultTableData
setShowLoading(true)
const data = await handleStorageMonthProjectAccount(req)
if (data.Result_Code == 100) {
message.success(data.Result_Desc)
} else {
message.error(data.Result_Desc)
}
setShowLoading(false)
} else {
message.error('请先查询数据需要固化的数据!')
}
}
})
} else {
if (defaultTableData && defaultTableData.length > 0) {
const req: any = defaultTableData
setShowLoading(true)
const data = await handleStorageMonthProjectAccount(req)
if (data.Result_Code == 100) {
message.success(data.Result_Desc)
} else {
message.error(data.Result_Desc)
}
setShowLoading(false)
} else {
message.error('请先查询数据需要固化的数据!')
}
}
}}>
<Button type="primary"></Button>
</Popconfirm> : ''
}
</>
,
<Button
key="new"
type="primary"
onClick={(e) => {
if (exportTableData && exportTableData.length > 0) {
setShowLoading(true)
setTimeout(() => {
setShowExportTable(true)
setTimeout(() => {
exportTable(e)
}, 100)
}, 100)
} else {
message.error('暂无数据可导出!')
}
}}
>
excel
</Button>
]
}}
>
</ProTable>
</div>
</div >
{/* 查看项目详情 右侧弹出的抽屉 */}
< Drawer
width="80%"
className="project-drawer"
visible={showDetail} // 抽屉弹框是否显示状态
onClose={() => { // 关闭抽屉 则在清空选中行数据 并 设置抽屉状态为关闭
setCurrentRow(undefined);
setShowDetail(false);
}}
bodyStyle={{ backgroundColor: "#f9f9f9", padding: 0 }}
closable={false}
>
{/* 抽屉打开时 加载项目详情组件 */}
{showDetail && <ProjectDetail id={currentRow?.BUSINESSPROJECT_ID} showType={'edit'}></ProjectDetail>}
</Drawer >
{/* 月度信息抽屉 */}
< Drawer
width="80%"
className="project-drawer"
visible={showMonthDetail} // 抽屉弹框是否显示状态
onClose={() => { // 关闭抽屉 则在清空选中行数据 并 设置抽屉状态为关闭
setCurrentRow(undefined);
setShowMonthDetail(false);
}}
bodyStyle={{ backgroundColor: "#f9f9f9", padding: 0 }}
closable={false}
>
{/* 抽屉打开时 加载项目详情组件 */}
{
showMonthDetail && <RevenueList BusinessProjectId={currentRow.BUSINESSPROJECT_ID} propsBP={currentRow} propsRC={currentRow}
ShopRoyaltyId={currentRow?.ShopRoyaltyId ? currentRow?.ShopRoyaltyId : 0}
ShopIds={currentRow?.SERVERPARTSHOP_ID ? currentRow?.SERVERPARTSHOP_ID : ''}
StartDate={currentRow?.startTime ? moment(currentRow?.startTime).format('YYYY-MM-DD') : ''}
EndDate={moment(currentRow?.endTime).format('YYYY-MM-DD')}
isComeRevenueConfirm={Boolean(currentRow?.TaxRate)}></RevenueList>
}
</Drawer >
{/* 月度信息抽屉 */}
< Drawer
width="80%"
className="project-drawer"
visible={showMonthSecondDetail} // 抽屉弹框是否显示状态
onClose={() => { // 关闭抽屉 则在清空选中行数据 并 设置抽屉状态为关闭
setCurrentRow(undefined);
setDrawerSearchTime(undefined)
setShowMonthSecondDetail(false);
}}
bodyStyle={{ backgroundColor: "#f9f9f9", padding: 0 }}
closable={false}
>
{/* 抽屉打开时 加载项目详情组件 */}
{
showMonthSecondDetail && <RevenueSecondList BusinessProjectId={currentRow.BUSINESSPROJECT_ID} propsBP={currentRow} propsRC={currentRow}
ShopRoyaltyId={currentRow?.ShopRoyaltyId ? currentRow?.ShopRoyaltyId : 0}
ShopIds={currentRow?.SERVERPARTSHOP_ID ? currentRow?.SERVERPARTSHOP_ID : ''}
StartDate={currentRow?.startTime ? moment(currentRow?.startTime).format('YYYY-MM-DD') : ''}
EndDate={moment(currentRow?.endTime).format('YYYY-MM-DD')}
isComeRevenueConfirm={Boolean(currentRow?.TaxRate)} monthTime={drawerSearchTime}
isHideDescriptions={true}></RevenueSecondList>
}
</Drawer >
{/* 营业额和自然日报表的对比抽屉 */}
< Drawer
width="80%"
className="project-drawer"
visible={showCompareDrawer} // 抽屉弹框是否显示状态
onClose={() => { // 关闭抽屉 则在清空选中行数据 并 设置抽屉状态为关闭
setCompareCurrent(undefined)
setShowCompareDrawer(false);
}}
bodyStyle={{ backgroundColor: "#f9f9f9", padding: 0 }}
closable={false}
>
{showCompareDrawer && <CompareList type={'revenueConfirmation'} handleGetNewMonth={handleGetNewMonth} setShowCompareDrawer={setShowCompareDrawer} fatherActionRef={actionRef} showCompareDrawer={showCompareDrawer} compareCurrent={compareCurrent} onlyRead={compareCurrent?.Approvalstate > 0} monthTime={monthTime} handleGetRefreshTableData={handleGetRefreshTableData} />}
</Drawer >
</div >
)
}
export default connect(({ user }: ConnectState) => ({
currentUser: user.currentUser
}))(revenueConfirmation);