油站财务报表,交易

This commit is contained in:
sw 2024-11-07 15:09:32 +08:00
parent 829d0a9f15
commit 1af2d0861b
7 changed files with 320 additions and 235 deletions

View File

@ -51,3 +51,11 @@ export function handoverShiftPrintingReceipts(data) {
data: data
})
}
export function handoverShiftPrintingReceiptss(data) {
return request({
url: '/business/handoverRecord/handoverShiftPrintingReceiptss',
method: 'post',
data: data
})
}

View File

@ -68,39 +68,39 @@
</div>
<div class="d-s-b">
<div>优惠金额</div>
<div>{{ orderSummary.allDis }}</div>
</div>
<div class="d-s-b">
<div>退款金额</div>
<div>{{ orderSummary.oilRefund }}</div>
</div>
<div class="d-s-b">
<div>退款金额</div>
<div>{{ orderSummary.oilPaid }}</div>
</div>
<div class="d-s-b">
<div>挂账金额</div>
<div>--</div>
<div>{{ orderSummary.onAccount }}</div>
</div>
<div class="d-s-b">
<div>会员消费</div>
<div>{{ orderSummary.allBalanceP }}</div>
<div>{{ orderSummary.consumptionMoney }}</div>
</div>
<div class="d-s-b">
<div>实收金额</div>
<div>{{ orderSummary.allMoney }}</div>
<div>{{ orderSummary.receiptsMoney }}</div>
</div>
<div class="d-s-b">
<div>充值金额</div>
<div>{{ orderSummary.cardPaid }}</div>
<div>{{ orderSummary.onAccount }}</div>
</div>
<div class="d-s-b">
<div>充值赠送</div>
<div>{{ orderSummary.cardGiftPaid }}</div>
<div>{{ orderSummary.giftAccount }}</div>
</div>
<div class="d-s-b">
<div>会员总余额</div>
<div>{{ orderSummary.points }}</div>
<div>{{ orderSummary.memberBalance }}</div>
</div>
<div class="d-s-b">
<div>会员总积分</div>
<div>{{ orderSummary.sumnum }}</div>
<div>{{ orderSummary.memberPoints }}</div>
</div>
<div class="xxing"></div>
<div style="width: 100%; height: 29vh;overflow: auto;scrollbar-width: none; ">
@ -117,18 +117,18 @@
</div>
<div class="d-s-b">
<div class="l-size">营业总额</div>
<div class="s-size">{{ orderSummary.allyingye1 }}</div>
<div class="r-size">{{ orderSummary.allyingye }}</div>
<div class="s-size">{{ orderSummary.oilOrder }}</div>
<div class="r-size">{{ orderSummary.receiptsMoney }}</div>
</div>
<div class="d-s-b">
<div class="l-size">充值总额</div>
<div class="s-size">{{ orderSummary.allchuzhika1 }}</div>
<div class="r-size">{{ orderSummary.allchuzhika }}</div>
<div class="s-size">{{ orderSummary.rechargeAll }}</div>
<div class="r-size">{{ orderSummary.onAccount }}</div>
</div>
<div class="d-s-b">
<div class="l-size">合计</div>
<div class="s-size">{{ orderSummary.allyingye1 + orderSummary.allchuzhika1 }}</div>
<div class="r-size">{{ orderSummary.allyingye + orderSummary.allchuzhika }}</div>
<div class="s-size">{{ orderSummary.orderall}}</div>
<div class="r-size">{{ orderSummary.orderalls}}</div>
</div>
</div>
<div class="for-box">
@ -143,9 +143,9 @@
<div class="r-size">实收金额</div>
</div>
<div class="d-s-b" v-for="item in paymentAggregation" v-if="item.flag == 'all'">
<div class="l-size">{{ calculateThePaymentMethod(item.payType) }}</div>
<div class="s-size">{{ item.numberOfDeals }}</div>
<div class="r-size">{{ item.paidAmount }}</div>
<div class="l-size">{{item.payType}}</div>
<div class="s-size">{{ item.orderNum }}</div>
<div class="r-size">{{ item.truePay }}</div>
</div>
</div>
<div class="for-box">
@ -160,9 +160,9 @@
<div class="r-size">实收金额</div>
</div>
<div class="d-s-b" v-for="item in oilNumberStatistics">
<div class="l-size">{{ item.oilName }}</div>
<div class="s-size">{{ item.numberOfDeals }}</div>
<div class="r-size">{{ item.paidAmount }}</div>
<div class="l-size">{{ item.name }}</div>
<div class="s-size">{{ item.orderNum }}</div>
<div class="r-size">{{ item.payAmount }}</div>
</div>
</div>
<div class="for-box">
@ -176,10 +176,10 @@
<div class="f-size">笔数</div>
<div class="r-size">实收金额</div>
</div>
<div class="d-s-b" v-for="item in oilNumberStatistics">
<div class="l-size">{{ item.oilName }}</div>
<div class="s-size">{{ item.numberOfDeals }}</div>
<div class="r-size">{{ item.paidAmount }}</div>
<div class="d-s-b" v-for="item in discountStatistics">
<div class="l-size">{{ item.name }}</div>
<div class="s-size">{{ item.orderNum }}</div>
<div class="r-size">{{ item.discountAmount }}</div>
</div>
</div>
<div class="for-box">
@ -189,14 +189,14 @@
<div class="x-"></div>
</div>
<div class="d-s-b" style="font-weight: 600">
<div class="l-size">类型</div>
<div class="l-size">油号</div>
<div class="f-size">笔数</div>
<div class="r-size">实收金额</div>
</div>
<div class="d-s-b" v-for="item in oilNumberStatistics">
<div class="l-size">{{ item.oilName }}</div>
<div class="s-size">{{ item.numberOfDeals }}</div>
<div class="r-size">{{ item.paidAmount }}</div>
<div class="d-s-b" v-for="item in backMoneyStatistics">
<div class="l-size">{{ item.name }}</div>
<div class="s-size">{{ item.orderNum }}</div>
<div class="r-size">{{ item.refMoney }}</div>
</div>
</div>
<div class="for-box">
@ -210,10 +210,10 @@
<div class="f-size">笔数</div>
<div class="r-size">实收金额</div>
</div>
<div class="d-s-b" v-for="item in paymentAggregation" v-if="item.flag == 'all' && item.payType == 'balance'">
<div class="d-s-b" v-for="item in billingDetails">
<div class="l-size">{{ item.name }}</div>
<div class="s-size">{{ item.numberOfDeals ? item.numberOfDeals : '--' }}</div>
<div class="r-size">{{ item.paidAmount ? item.paidAmount : '--' }}</div>
<div class="s-size">{{ item.orderNum }}</div>
<div class="r-size">{{ item.amount}}</div>
</div>
</div>
<div class="for-box">
@ -227,10 +227,10 @@
<div class="f-size">笔数</div>
<div class="r-size">实收金额</div>
</div>
<div class="d-s-b" v-for="item in paymentAggregation" v-if="item.flag == 'allbalance'">
<div class="l-size">{{ calculateThePaymentMethod(item.payType) }}</div>
<div class="s-size">{{ item.numberOfDeals ? item.numberOfDeals : '--' }}</div>
<div class="r-size">{{ item.paidAmount ? item.paidAmount : '--' }}</div>
<div class="d-s-b" v-for="item in employeeStatistics">
<div class="l-size">{{item.payType}}</div>
<div class="s-size">{{ item.orderNum}}</div>
<div class="r-size">{{ item.rechargeBalance}}</div>
</div>
</div>
<div class="for-box">
@ -244,10 +244,10 @@
<div class="f-size">笔数</div>
<div class="r-size">实收金额</div>
</div>
<div class="d-s-b" v-for="item in paymentAggregation" v-if="item.flag == 'all' && item.payType == 'balance'">
<div class="l-size">合计</div>
<div class="s-size">{{ item.numberOfDeals ? item.numberOfDeals : '--' }}</div>
<div class="r-size">{{ item.paidAmount ? item.paidAmount : '--' }}</div>
<div class="d-s-b" v-for="item in consumptionStatistics">
<div class="l-size">{{ item.payType}}</div>
<div class="s-size">{{ item.orderNums }}</div>
<div class="r-size">{{item.orderNum}}</div>
</div>
</div>
<div class="for-box">
@ -261,10 +261,10 @@
<div class="f-size">笔数</div>
<div class="r-size">实收金额</div>
</div>
<div class="d-s-b" v-for="item in paymentAggregation" v-if="item.flag == 'goods'">
<div class="l-size">{{ calculateThePaymentMethod(item.payType) }}</div>
<div class="s-size">{{ item.numberOfDeals ? item.numberOfDeals : '--' }}</div>
<div class="r-size">{{ item.paidAmount ? item.paidAmount : '--' }}</div>
<div class="d-s-b" v-for="item in goodsNumberStatistics">
<div class="l-size">{{item.payType}}</div>
<div class="s-size">{{ item.orderNum }}</div>
<div class="r-size">{{ item.payAmount}}</div>
</div>
</div>
<div class="for-box">
@ -278,10 +278,10 @@
<div class="f-size">笔数</div>
<div class="r-size">实收金额</div>
</div>
<div class="d-s-b" v-for="item in paymentAggregation" v-if="item.flag == 'point'">
<div class="l-size">{{ calculateThePaymentMethod(item.payType) }}</div>
<div class="s-size">{{ item.numberOfDeals ? item.numberOfDeals : '--' }}</div>
<div class="r-size">{{ item.paidAmount ? item.paidAmount : '--' }}</div>
<div class="d-s-b" v-for="item in integerNumberStatistics">
<div class="l-size">{{item.payType }}</div>
<div class="s-size">{{ item.orderNum}}</div>
<div class="r-size">{{ item.amount}}</div>
</div>
</div>
<div class="for-box">
@ -293,14 +293,14 @@
<div class="d-s-b" style="font-weight: 600">
<div class="l-size">新增会员数</div>
<!-- <div class="f-size">笔数</div>-->
<div class="r-size">{{ orderSummary.sumnum }}</div>
<div class="r-size">{{ memberStatistics.userNum }}</div>
</div>
</div>
<div class="for-box">
<div class="for-title">
<div class="x-"></div>
<div>挂账归还统计(再处理)</div>
<div>挂账归还统计</div>
<div class="x-"></div>
</div>
<div class="d-s-b" style="font-weight: 600">
@ -309,9 +309,9 @@
<div class="r-size">实收金额</div>
</div>
<div class="d-s-b" v-for="item in returnedToTheAccount">
<div class="l-size">{{ item.name ? item.name : '--' }}</div>
<div class="s-size">{{ item.numberOfDeals ? item.numberOfDeals : '--' }}</div>
<div class="r-size">{{ item.paidAmount ? item.paidAmount : '--' }}</div>
<div class="l-size">{{ item.status }}</div>
<div class="s-size">{{ item.returnNum }}</div>
<div class="r-size">{{ item.amount}}</div>
</div>
</div>
<div class="for-box">
@ -325,10 +325,10 @@
<div class="f-size">笔数</div>
<div class="r-size">实收金额</div>
</div>
<div class="d-s-b" v-for="item in employeeStatistics">
<div class="l-size">{{ item.name ? item.name : '--' }}</div>
<div class="s-size">{{ item.numberOfDeals ? item.numberOfDeals : '--' }}</div>
<div class="r-size">{{ item.paidAmount ? item.paidAmount : '--' }}</div>
<div class="d-s-b" v-for="item in staffStatistics">
<div class="l-size">{{ item.name }}</div>
<div class="s-size">{{ item.staffNum }}</div>
<div class="r-size">{{ item.monye}}</div>
</div>
</div>
</div>
@ -353,7 +353,8 @@ import {
getHandoverApi2,
getHandoverListApi,
printLocallyApi,
handoverShiftPrintingReceipts
handoverShiftPrintingReceipts,
handoverShiftPrintingReceiptss
} from "@/api/handover/handover";
import {getStatisticsApi} from "@/api/order/order";
@ -370,7 +371,33 @@ export default {
data() {
return {
baseInfo : {},
//
orderSummary : {},
//
paymentAggregation :[],
//
oilNumberStatistics:[],
//
discountStatistics:[],
//退
backMoneyStatistics:[],
//
billingDetails :[],
//
employeeStatistics:[],
//
consumptionStatistics:[],
//便
goodsNumberStatistics:[],
//
integerNumberStatistics:[],
//
memberStatistics:{},
//
returnedToTheAccount:[],
//
staffStatistics:[],
tabs: [
"交接班",
// "1",
@ -387,14 +414,7 @@ export default {
shiftHandoverList: '',
handoverList: {},
handoverData: {},
baseInfo: {},
billingDetails: [],
employeeStatistics: [],
greaseGunStatistics: [],
oilNumberStatistics: [],
orderSummary: {},
paymentAggregation: [],
returnedToTheAccount: [],
// base
queryParams: {
@ -423,10 +443,10 @@ export default {
},
created() {
this.getList();
this.getHandover();
this.getStatistics();
this.getStatus();
this.getStaffList();
//this.getHandover();
// this.getStatistics();
// this.getStatus();
// this.getStaffList();
},
mounted() {
this.queryParams.status = '统一交班';
@ -436,8 +456,8 @@ export default {
console.log("getHandover", this.queryParams)
getHandoverApi2(this.queryParams).then(res => {
// this.handoverList = res.data;
this.handoverData = res.data;
this.baseInfo = this.handoverData.baseInfo,
this.handoverData = res.data;
this.baseInfo = this.handoverData.baseInfo,
this.billingDetails = this.handoverData.billingDetails,
this.employeeStatistics = this.handoverData.employeeStatistics,
this.greaseGunStatistics = this.handoverData.greaseGunStatistics,
@ -469,22 +489,53 @@ export default {
this.tabindex = index
},
getList() {
this.dateRange = []
if (this.beginTime && this.endTime) {
this.dateRange.push(this.beginTime.toLocaleDateString())
this.dateRange.push(this.endTime.toLocaleDateString())
}
getHandoverListApi(this.addDateRange(this.queryParams, this.dateRange)).then(res => {
// this.dateRange = []
// if (this.beginTime && this.endTime) {
// this.dateRange.push(this.beginTime.toLocaleDateString())
// this.dateRange.push(this.endTime.toLocaleDateString())
// }
// getHandoverListApi(this.addDateRange(this.queryParams, this.dateRange)).then(res => {
// this.dataList = res.data.records
// this.total = res.data.total
//
// })
handoverShiftPrintingReceiptss(this.queryParams).then(res => {
this.handoverData = res.data;
this.baseInfo = this.handoverData.baseInfo,
//
this.orderSummary = this.handoverData.orderSummary,
//
this.paymentAggregation = this.handoverData.paymentAggregation,
//
this.oilNumberStatistics = this.handoverData.oilNumberStatistics,
//
this.discountStatistics = this.handoverData.discountStatistics,
//退
this.backMoneyStatistics = this.handoverData.backMoneyStatistics,
//
this.billingDetails = this.handoverData.billingDetails,
//
this.employeeStatistics = this.handoverData.employeeStatistics,
//
this.consumptionStatistics = this.handoverData.consumptionStatistics,
//便
this.goodsNumberStatistics = this.handoverData.goodsNumberStatistics,
//
this.integerNumberStatistics = this.handoverData.integerNumberStatistics,
//
this.memberStatistics = this.handoverData.memberStatistics,
//
this.returnedToTheAccount = this.handoverData.returnedToTheAccount,
//
this.staffStatistics = this.handoverData.staffStatistics,
this.dataList = res.data.records
this.total = res.data.total
})
},
getStatistics() {
getStatisticsApi().then(res => {
this.statisticsForm = res.data
})
console.log("123123123", this.statisticsForm)
},
//

View File

@ -200,5 +200,13 @@ public class HandoverRecordController extends BaseController {
Map<String, Object> handAll=handoverRecordService.handover3(staffId);
printerService.handoverShiftPrintingReceipt(handAll);
}
}
/**
* 交接班打印
* @return
*/
@PostMapping("handoverShiftPrintingReceiptss")
public ResponseObject handoverShiftPrintingReceiptss(Integer staffId) {
return getSuccessResult(handoverRecordService.handover3(staffId));
}
}

View File

@ -129,7 +129,7 @@ public interface HandoverRecordMapper {
List<Map<String, Object>> goodsNumberStatistics1(@Param("startTime") String startTime, @Param("endTime") String endTime, @Param("storeId") Integer storeId, @Param("staffId") Integer staffId);
List<Map<String, Object>> IntegerNumberStatistics1(@Param("startTime") String startTime, @Param("endTime") String endTime, @Param("storeId") Integer storeId, @Param("staffId") Integer staffId);
List<Map<String, Object>> memberStatistics1(@Param("startTime") String startTime, @Param("endTime") String endTime, @Param("storeId") Integer storeId, @Param("staffId") Integer staffId);
Map<String, Object> memberStatistics1(@Param("startTime") String startTime, @Param("endTime") String endTime, @Param("storeId") Integer storeId, @Param("staffId") Integer staffId);
List<Map<String, Object>> returnedToTheAccount1(@Param("startTime") String startTime, @Param("endTime") String endTime, @Param("storeId") Integer storeId,@Param("staffId") Integer staffId);
List<Map<String, Object>> staffStatistics(@Param("startTime") String startTime, @Param("endTime") String endTime, @Param("storeId") Integer storeId,@Param("staffId") Integer staffId);

View File

@ -596,7 +596,7 @@ limit 1
and create_time BETWEEN #{startTime} AND #{endTime}) onAccount,<!--挂账金额-->
sum(if(type='3',pay_money,0.00)) consumptionMoney,<!--消费金额-->
IFNULL(sum(pay_money),0.00) receiptsMoney,<!--实收金额-->
(select IFNULL(sum(pay_amount),0.00) from card_value_record where store_id = #{storeId}
(select IFNULL(sum(recharge_balance),0.00) from card_value_record where store_id = #{storeId}
and create_time BETWEEN #{startTime} AND #{endTime}) onAccount,<!--充值金额-->
(select IFNULL(sum(gift_balance),0.00) from card_value_record where store_id = #{storeId}
and create_time BETWEEN #{startTime} AND #{endTime}) giftAccount,<!--赠送金额-->
@ -604,8 +604,8 @@ limit 1
and create_time BETWEEN #{startTime} AND #{endTime}) memberBalance,<!--总余额-->
(select IFNULL(sum(points),0.00) from mt_user_balance where store_id = #{storeId}
and create_time BETWEEN #{startTime} AND #{endTime}) memberPoints,<!--总积分-->
(select IFNULL(sum(amount),0.00) from card_value_record where store_id = #{storeId}
and create_time BETWEEN #{startTime} AND #{endTime}) rechargeAll
(select IFNULL(sum(bid_balance),0.00) from card_value_record where store_id = #{storeId}
and create_time BETWEEN #{startTime} AND #{endTime}) rechargeAll<!--充值金额面额-->
from all_order_info
where store_id = #{storeId}
and create_time BETWEEN #{startTime} AND #{endTime}
@ -627,9 +627,9 @@ limit 1
when pay_type = 'car_card_value' then '车队卡'
when pay_type = 'car_fule_card' then '车队囤油卡'
when pay_type = 'after_pay' then '挂账'
else '未知' end as payType
else '未知' end as payType,
COUNT(id) as orderNum,
IFNULL(sum(pay_money)) as truePay
IFNULL(sum(pay_money),0.00) as truePay
from all_order_info
where store_id = #{storeId}
and create_time BETWEEN #{startTime} AND #{endTime}
@ -640,23 +640,35 @@ limit 1
</select>
<select id="oilNumberStatistics1" resultType="java.util.Map">
select
case when a.`name` is not null then a.`name` else '合计'
end as name,
COUNT(a.orderNum) orderNum,
IFNULL(SUM(a.payAmount),0) payAmount
from(
SELECT
oil_name name,
COUNT(oo.id) orderNum,
SUM(pay_amount) payAmount
oil_name name,
COUNT(oo.id) orderNum,
SUM(pay_amount) payAmount
from
oil_order oo
LEFT JOIN oil_name onn
on onn.id=oo.oils
where onn.store_id = #{storeId}
oil_order oo
LEFT JOIN oil_name onn
on onn.id=oo.oils
where oo.store_id = #{storeId}
and oo.create_time BETWEEN #{startTime} AND #{endTime}
<if test="staffId != null">
and staff_id = #{staffId}
</if>
GROUP BY onn.id with rollup
</if>) a
GROUP BY a.`name` with rollup
</select>
<select id="discountStatistics" resultType="java.util.Map">
select
case when a.`name` is not null then a.`name` else '合计'
end as name,
COUNT(a.orderNum) orderNum,
IFNULL(SUM(a.discountAmount),0) discountAmount
from(
SELECT
oil_name name,
sum(if(oo.discount_amount is not null,1,0)) orderNum,-- 订单金额
@ -665,42 +677,51 @@ limit 1
oil_order oo
LEFT JOIN oil_name onn
on onn.id=oo.oils
where onn.store_id = #{storeId}
where oo.store_id = #{storeId}
and oo.create_time BETWEEN #{startTime} AND #{endTime}
<if test="staffId != null">
and staff_id = #{staffId}
</if>
GROUP BY onn.id with rollup
</if>) a
GROUP BY a.`name` with rollup
</select>
<select id="backMoneyStatistics" resultType="java.util.Map">
SELECT
oil_name name,
sum(if(oo.ref_money is not null,1,0)) orderNum,-- 订单金额
SUM(oo.ref_money) refMoney
from
oil_order oo
LEFT JOIN oil_name onn
on onn.id=oo.oils
where onn.store_id = #{storeId}
and oo.create_time BETWEEN #{startTime} AND #{endTime} and oo.ref_money is not null
<if test="staffId != null">
and staff_id = #{staffId}
</if>
GROUP BY onn.id with rollup
select
case when a.`name` is not null then a.`name` else '合计'
end as name,
COUNT(a.orderNum) orderNum,
IFNULL(SUM(a.refMoney),0) refMoney
from( SELECT
oil_name name,
sum(if(oo.ref_money is not null,1,0)) orderNum,
SUM(oo.ref_money) refMoney
from
oil_order oo
LEFT JOIN oil_name onn
on onn.id=oo.oils
where oo.store_id = 157
and oo.ref_money is not null
) a
GROUP BY a.`name` with rollup
</select>
<select id="billingDetails1" resultType="java.util.Map">
SELECT cu.unit_name name,
COUNT(hb.id) orderNum,
SUM(amount) amount
SELECT
case when a.`name` is not null then a.`name` else '合计'
end as name,
COUNT(a.orderNum) orderNum,
IFNULL(SUM(a.amount),0) amount
from (SELECT
cu.unit_name as `name`,
hb.id orderNum,
amount amount
from hang_bill hb
LEFT JOIN credit_unit cu on cu.id=hb.credit_unit_id
where onn.store_id = #{storeId}
and oo.create_time BETWEEN #{startTime} AND #{endTime}
LEFT JOIN credit_unit cu on cu.id=hb.credit_unit_id
where hb.store_id = #{storeId}
and hb.create_time BETWEEN #{startTime} AND #{endTime}
<if test="staffId != null">
and staff_id = #{staffId}
</if>
GROUP BY cu.id with rollup
</if>) a
GROUP BY a.`name` WITH ROLLUP
</select>
@ -716,9 +737,10 @@ limit 1
when payment_type = 'car_card_value' then '车队卡'
when payment_type = 'car_fule_card' then '车队囤油卡'
when payment_type = 'after_pay' then '挂账'
when payment_type is null then '合计'
else '未知' end as payType,
COUNT(id) orderNum,
SUM(recharge_balance) rechargeBalance
IFNULL(SUM(recharge_balance),0.00) rechargeBalance
from card_value_record
where store_id = #{storeId}
and create_time BETWEEN #{startTime} AND #{endTime}
@ -731,8 +753,8 @@ limit 1
<select id="consumptionStatistics" resultType="java.util.Map">
select * from(SELECT
'储蓄卡' as payType,
COUNT(id),
sum(balance) orderNum
COUNT(id) as orderNums,
IFNULL(sum(balance),0.00) orderNum
from
card_balance_change
where change_type =0
@ -741,8 +763,8 @@ limit 1
union all
SELECT
'燃油卡' as payType,
COUNT(id),
sum(balance) orderNum
COUNT(id) as orderNum,
IFNULL(sum(balance),0.00) orderNum
from
card_fuel_change
where change_type =0
@ -751,15 +773,14 @@ limit 1
union all
SELECT
'车队卡' as payType,
COUNT(id),
sum(adjust_limit) orderNum
COUNT(id) as orderNum,
IFNULL(sum(adjust_limit),0.00) orderNum
from
fleet_lines_change
where adjust_type =0
and store_id = #{storeId}
and create_time BETWEEN #{startTime} AND #{endTime}) a
GROUP BY payType
WITH ROLLUP
</select>
@ -775,9 +796,10 @@ limit 1
when pay_type = 'car_card_value' then '车队卡'
when pay_type = 'car_fule_card' then '车队囤油卡'
when pay_type = 'after_pay' then '挂账'
when pay_type is null then '合计'
else '未知' end as payType,
COUNT(id),
sum(pay_amount) payAmount
COUNT(id) as orderNum,
IFNULL(sum(pay_amount),0.00) payAmount
FROM
mt_order
where
@ -799,9 +821,10 @@ limit 1
when payment_type = 'car_card_value' then '车队卡'
when payment_type = 'car_fule_card' then '车队囤油卡'
when payment_type = 'after_pay' then '挂账'
when payment_type is null then '合计'
else '未知' end as payType,
COUNT(id),
sum(amount) amount
COUNT(id) as orderNum,
IFNULL(sum(amount),0.00) amount
FROM
integral_orders
where
@ -831,9 +854,10 @@ limit 1
when status = 'car_card_value' then '车队卡'
when status = 'car_fule_card' then '车队囤油卡'
when status = 'after_pay' then '挂账'
when status is null then '合计'
else '未知' end as status,
count(id) returnNum,
sum(amount) amount
IFNULL(sum(amount),0.00) amount
from
return_record
where
@ -843,15 +867,22 @@ limit 1
</select>
<select id="staffStatistics" resultType="java.util.Map">
select ta.real_name,
COUNT(aoi.id),
sum(pay_money)
from t_account ta
left join all_order_info aoi on ta.acct_id=aoi.create_by
where
ta.store_id = #{storeId}
and ta.create_time BETWEEN #{startTime} AND #{endTime}
GROUP BY ta.acct_id WITH ROLLUP
</select>
SELECT case
when a.`name` is not null then a.`name`
else '合计'
end as name,
COUNT(a.staffNum) staffNum,
IFNULL(SUM(a.monye), 0) monye
from (select
ta.real_name as name,
COUNT(aoi.id) as staffNum,
IFNULL(sum(pay_money), 0.00) as monye
from t_account ta
left join all_order_info aoi on ta.acct_id = aoi.create_by
where ta.store_id = #{storeId}
and aoi.create_time BETWEEN #{startTime} AND #{endTime}) a
GROUP BY a.`name` WITH ROLLUP
</select>
</mapper>

View File

@ -1218,12 +1218,14 @@ public class HandoverRecordServiceImpl implements HandoverRecordService {
handoverMap.put("baseInfo",baseInfo);
// 获取订单汇总
Map<String, Object> orderSummaryMap = orderSummary1(startTime, formattedEndTime, staffId);
orderSummaryMap.put("orderall",Double.valueOf(orderSummaryMap.get("oilOrder").toString())+Double.valueOf(orderSummaryMap.get("rechargeAll").toString()));
orderSummaryMap.put("orderalls",Double.valueOf(orderSummaryMap.get("receiptsMoney").toString())+Double.valueOf(orderSummaryMap.get("onAccount").toString()));
handoverMap.put("orderSummary",orderSummaryMap);
// 支付方式汇总
List<Map<String, Object>> paymentAggregationMap = paymentAggregation1(startTime, formattedEndTime, staffId);
handoverMap.put("paymentAggregation",paymentAggregationMap);
// 油号统计
List<Map<String, Object>> oilNumberStatisticsMap = oilNumberStatistics(startTime, formattedEndTime, staffId);
List<Map<String, Object>> oilNumberStatisticsMap = oilNumberStatistics1(startTime, formattedEndTime, staffId);
handoverMap.put("oilNumberStatistics",oilNumberStatisticsMap);
// 优惠统计
List<Map<String, Object>> discountStatisticsMap = discountStatistics(startTime, formattedEndTime, staffId);
@ -1245,9 +1247,9 @@ public class HandoverRecordServiceImpl implements HandoverRecordService {
handoverMap.put("goodsNumberStatistics",goodsNumberStatistics);
// 积分商城兑换信息
List<Map<String, Object>> IntegerNumberStatistics = IntegerNumberStatistics1(startTime, formattedEndTime, staffId);
handoverMap.put("IntegerNumberStatistics",IntegerNumberStatistics);
handoverMap.put("integerNumberStatistics",IntegerNumberStatistics);
// 会员新增统计
List<Map<String, Object>> memberStatisticsMap = memberStatistics1(startTime, formattedEndTime, staffId);
Map<String, Object> memberStatisticsMap = memberStatistics1(startTime, formattedEndTime, staffId);
handoverMap.put("memberStatistics",memberStatisticsMap);
// 挂账归还
List<Map<String, Object>> returnedToTheAccountMap = returnedToTheAccount1(startTime, formattedEndTime, staffId) ;
@ -1383,9 +1385,9 @@ public class HandoverRecordServiceImpl implements HandoverRecordService {
* @param staffId
* @return
*/
public List<Map<String, Object>> memberStatistics1 (String startTime, String endTime, Integer staffId) {
public Map<String, Object> memberStatistics1 (String startTime, String endTime, Integer staffId) {
AccountInfo nowAccountInfo = TokenUtil.getNowAccountInfo();
List<Map<String, Object>> oilNumberStatistics = handoverRecordMapper.memberStatistics1(startTime, endTime, nowAccountInfo.getStoreId(), staffId);
Map<String, Object> oilNumberStatistics = handoverRecordMapper.memberStatistics1(startTime, endTime, nowAccountInfo.getStoreId(), staffId);
return oilNumberStatistics;
}

View File

@ -4,6 +4,7 @@ import cn.hutool.core.util.ObjectUtil;
import com.fuint.common.dto.AccountInfo;
import com.fuint.common.util.TokenUtil;
import java.math.BigDecimal;
import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;
import java.util.HashMap;
@ -31,147 +32,131 @@ public class HandoverShiftPrintingReceipt {
sb.append("结束时间:"+o.get("endTime") +"\r\n");
Map<String,String> o1 = (Map<String,String>)handover.get("orderSummary");
sb.append("订单金额:"+String.valueOf(o1.get("oilOrder"))+"\r\n");
sb.append("优惠金额:"+String.valueOf(o1.get("allDis")) +"\r\n");
sb.append("退款金额:"+String.valueOf(o1.get("oilRefund")) +"\r\n");
sb.append("挂账金额:"+String.valueOf(o1.get("startTime")) +"\r\n");
sb.append("消费金额:"+String.valueOf(o1.get("allBalanceP")) +"\r\n");
sb.append("实收金额:"+String.valueOf(o1.get("allMoney")) +"\r\n");
sb.append("充值金额:"+String.valueOf(o1.get("cardPaid")) +"\r\n");
sb.append("充值赠送:"+String.valueOf(o1.get("cardGiftPaid")) +"\r\n");
sb.append("会员总余额:"+String.valueOf(o1.get("points")) +"\r\n");
sb.append("会员总积分:"+String.valueOf(o1.get("sumnum")) +"\r\n");
sb.append("优惠金额:"+String.valueOf(o1.get("oilRefund")) +"\r\n");
sb.append("退款金额:"+String.valueOf(o1.get("oilPaid")) +"\r\n");
sb.append("挂账金额:"+String.valueOf(o1.get("onAccount")) +"\r\n");
sb.append("消费金额:"+String.valueOf(o1.get("consumptionMoney")) +"\r\n");
sb.append("实收金额:"+String.valueOf(o1.get("receiptsMoney")) +"\r\n");
sb.append("充值金额:"+String.valueOf(o1.get("onAccount")) +"\r\n");
sb.append("充值赠送:"+String.valueOf(o1.get("giftAccount")) +"\r\n");
sb.append("会员总余额:"+String.valueOf(o1.get("memberBalance")) +"\r\n");
sb.append("会员总积分:"+String.valueOf(o1.get("memberPoints")) +"\r\n");
sb.append("<center>---------------------------</center>"+"\r\n");
sb.append("<center>------营业收入统计------</center>"+"\r\n");
sb.append("<table><tr><td>类型</td><td>订单金额</td><td>实收金额</td></tr>");
sb.append("<tr><td>营业总额</td>");
sb.append("<td>"+String.valueOf(o1.get("allyingye1"))+"</td>");
sb.append("<td>"+ String.valueOf(o1.get("allyingye"))+"</td></tr>");
sb.append("<td>"+String.valueOf(o1.get("oilOrder"))+"</td>");
sb.append("<td>"+ String.valueOf(o1.get("receiptsMoney"))+"</td></tr>");
sb.append("<tr><td>充值总额</td>");
sb.append("<td>"+String.valueOf(o1.get("allchuzhika1"))+"</td>");
sb.append("<td>"+ String.valueOf(o1.get("allchuzhika"))+"</td></tr>");
sb.append("<td>"+String.valueOf(o1.get("rechargeAll"))+"</td>");
sb.append("<td>"+ String.valueOf(o1.get("onAccount"))+"</td></tr>");
sb.append("<tr><td>合计</td>");
sb.append("<td>"+String.valueOf(o1.get("allyingye1"))+"</td>");
sb.append("<td>"+String.valueOf(o1.get("allchuzhika1"))+"</td></tr>");
sb.append("<td>"+String.valueOf(o1.get("orderall"))+"</td>");
sb.append("<td>"+String.valueOf(o1.get("orderalls"))+"</td></tr>");
sb.append("</table>");
sb.append("<center>------支付方式统计------</center>"+"\r\n");
sb.append("<table><tr><td>支付方式</td><td>笔数</td><td>实收金额</td></tr>");
List<Map<String,String>> o2 = (List<Map<String,String>>)handover.get("paymentAggregation");
for(int i=0;i<o2.size();i++){
if("ALIPAY".equals(o2.get(i).get("payType"))){
sb.append("<tr><td>支付宝</td>");
}else if("WECHAT".equals(o2.get(i).get("payType"))){
sb.append("<tr><td>微信</td>");
}else if("UNIONPAY".equals(o2.get(i).get("payType"))){
sb.append("<tr><td>银联二维码</td>");
}else if("CASH".equals(o2.get(i).get("payType"))){
sb.append("<tr><td>现金</td>");
}else if("balance".equals(o2.get(i).get("payType"))){
sb.append("<tr><td>余额</td>");
}else if("card_value".equals(o2.get(i).get("payType"))){
sb.append("<tr><td>油卡</td>");
}else {
sb.append("<tr><td>其余</td>");
}
sb.append("<td>"+String.valueOf(o2.get(i).get("numberOfDeals"))+"</td>");
sb.append("<td>"+ String.valueOf(o2.get(i).get("paidAmount"))+"</td></tr>");
sb.append("<tr><td>"+String.valueOf(o2.get(i).get("payType"))+"</td>");
sb.append("<td>"+String.valueOf(o2.get(i).get("orderNum"))+"</td>");
sb.append("<td>"+ String.valueOf(o2.get(i).get("truePay"))+"</td></tr>");
}
sb.append("</table>");
sb.append("<center>------油品实收统计------</center>"+"\r\n");
sb.append("<table><tr><td>油号</td><td>笔数</td><td>实收金额</td></tr>");
List<Map<String,String>> o3 = (List<Map<String,String>>)handover.get("oilNumberStatistics");
for(int m=0;m<o3.size();m++){
sb.append("<tr><td>"+String.valueOf(o3.get(m).get("oilName"))+"</td>");
sb.append("<td>"+String.valueOf(o3.get(m).get("numberOfDeals"))+"</td>");
sb.append("<td>"+ String.valueOf(o3.get(m).get("paidAmount"))+"</td></tr>");
sb.append("<tr><td>"+String.valueOf(o3.get(m).get("name"))+"</td>");
sb.append("<td>"+String.valueOf(o3.get(m).get("orderNum"))+"</td>");
sb.append("<td>"+ String.valueOf(o3.get(m).get("payAmount"))+"</td></tr>");
}
sb.append("</table>");
sb.append("<center>------优惠统计------</center>"+"\r\n");
sb.append("<table><tr><td>油号</td><td>笔数</td><td>实收金额</td></tr>");
List<Map<String,String>> o4 = (List<Map<String,String>>)handover.get("oilNumberStatistics");
List<Map<String,String>> o4 = (List<Map<String,String>>)handover.get("discountStatistics");
for(int m=0;m<o4.size();m++){
sb.append("<tr><td>"+String.valueOf(o4.get(m).get("oilName"))+"</td>");
sb.append("<td>"+String.valueOf(o4.get(m).get("numberOfDeals"))+"</td>");
sb.append("<td>"+ String.valueOf(o4.get(m).get("paidAmount"))+"</td></tr>");
sb.append("<tr><td>"+String.valueOf(o4.get(m).get("name"))+"</td>");
sb.append("<td>"+String.valueOf(o4.get(m).get("orderNum"))+"</td>");
sb.append("<td>"+ String.valueOf(o4.get(m).get("discountAmount"))+"</td></tr>");
}
sb.append("</table>");
sb.append("<center>------退款统计------</center>"+"\r\n");
sb.append("<table><tr><td>油号</td><td>笔数</td><td>实收金额</td></tr>");
List<Map<String,String>> o5 = (List<Map<String,String>>)handover.get("oilNumberStatistics");
List<Map<String,String>> o5 = (List<Map<String,String>>)handover.get("backMoneyStatistics");
for(int m=0;m<o5.size();m++){
sb.append("<tr><td>"+String.valueOf(o5.get(m).get("oilName"))+"</td>");
sb.append("<td>"+String.valueOf(o5.get(m).get("numberOfDeals"))+"</td>");
sb.append("<td>"+ String.valueOf(o5.get(m).get("paidAmount"))+"</td></tr>");
sb.append("<tr><td>"+String.valueOf(o5.get(m).get("name"))+"</td>");
sb.append("<td>"+String.valueOf(o5.get(m).get("orderNum"))+"</td>");
sb.append("<td>"+ String.valueOf(o5.get(m).get("refMoney"))+"</td></tr>");
}
sb.append("</table>");
sb.append("<center>------挂账统计------</center>"+"\r\n");
sb.append("<table><tr><td>关账单位</td><td>笔数</td><td>实收金额</td></tr>");
List<Map<String,String>> o6 = (List<Map<String,String>>)handover.get("oilNumberStatistics");
List<Map<String,String>> o6 = (List<Map<String,String>>)handover.get("billingDetails");
for(int m=0;m<o6.size();m++){
sb.append("<tr><td>"+String.valueOf(o6.get(m).get("oilName"))+"</td>");
sb.append("<td>"+String.valueOf(o6.get(m).get("numberOfDeals"))+"</td>");
sb.append("<td>"+ String.valueOf(o6.get(m).get("paidAmount"))+"</td></tr>");
sb.append("<tr><td>"+String.valueOf(o6.get(m).get("name"))+"</td>");
sb.append("<td>"+String.valueOf(o6.get(m).get("orderNum"))+"</td>");
sb.append("<td>"+ String.valueOf(o6.get(m).get("amount"))+"</td></tr>");
}
sb.append("</table>");
sb.append("<center>------会员充值统计------</center>"+"\r\n");
sb.append("<table><tr><td>支付放松</td><td>笔数</td><td>实收金额</td></tr>");
List<Map<String,String>> o7 = (List<Map<String,String>>)handover.get("oilNumberStatistics");
sb.append("<table><tr><td>支付方式</td><td>笔数</td><td>实收金额</td></tr>");
List<Map<String,String>> o7 = (List<Map<String,String>>)handover.get("employeeStatistics");
for(int m=0;m<o7.size();m++){
sb.append("<tr><td>"+String.valueOf(o7.get(m).get("oilName"))+"</td>");
sb.append("<td>"+String.valueOf(o7.get(m).get("numberOfDeals"))+"</td>");
sb.append("<td>"+ String.valueOf(o7.get(m).get("paidAmount"))+"</td></tr>");
sb.append("<tr><td>"+String.valueOf(o7.get(m).get("payType"))+"</td>");
sb.append("<td>"+String.valueOf(o7.get(m).get("orderNum"))+"</td>");
sb.append("<td>"+ String.valueOf(o7.get(m).get("rechargeBalance"))+"</td></tr>");
}
sb.append("</table>");
sb.append("<center>------会员消费统计------</center>"+"\r\n");
sb.append("<table><tr><td>支付放松</td><td>笔数</td><td>实收金额</td></tr>");
List<Map<String,String>> o8 = (List<Map<String,String>>)handover.get("oilNumberStatistics");
sb.append("<table><tr><td>支付方式</td><td>笔数</td><td>实收金额</td></tr>");
List<Map<String,String>> o8 = (List<Map<String,String>>)handover.get("consumptionStatistics");
for(int m=0;m<o8.size();m++){
sb.append("<tr><td>"+String.valueOf(o8.get(m).get("oilName"))+"</td>");
sb.append("<td>"+String.valueOf(o8.get(m).get("numberOfDeals"))+"</td>");
sb.append("<td>"+ String.valueOf(o8.get(m).get("paidAmount"))+"</td></tr>");
sb.append("<tr><td>"+String.valueOf(o8.get(m).get("payType"))+"</td>");
sb.append("<td>"+String.valueOf(o8.get(m).get("orderNums"))+"</td>");
sb.append("<td>"+ String.valueOf(o8.get(m).get("orderNum"))+"</td></tr>");
}
sb.append("</table>");
sb.append("<center>------便利店统计------</center>"+"\r\n");
sb.append("<table><tr><td>支付放松</td><td>笔数</td><td>实收金额</td></tr>");
List<Map<String,String>> o9 = (List<Map<String,String>>)handover.get("oilNumberStatistics");
sb.append("<table><tr><td>支付方式</td><td>笔数</td><td>实收金额</td></tr>");
List<Map<String,String>> o9 = (List<Map<String,String>>)handover.get("goodsNumberStatistics");
for(int m=0;m<o9.size();m++){
sb.append("<tr><td>"+String.valueOf(o9.get(m).get("oilName"))+"</td>");
sb.append("<td>"+String.valueOf(o9.get(m).get("numberOfDeals"))+"</td>");
sb.append("<td>"+ String.valueOf(o9.get(m).get("paidAmount"))+"</td></tr>");
sb.append("<tr><td>"+String.valueOf(o9.get(m).get("payType"))+"</td>");
sb.append("<td>"+String.valueOf(o9.get(m).get("orderNum"))+"</td>");
sb.append("<td>"+ String.valueOf(o9.get(m).get("payAmount"))+"</td></tr>");
}
sb.append("</table>");
sb.append("<center>------积分商城统计------</center>"+"\r\n");
sb.append("<table><tr><td>支付方式</td><td>笔数</td><td>实收金额</td></tr>");
List<Map<String,String>> o10 = (List<Map<String,String>>)handover.get("oilNumberStatistics");
List<Map<String,String>> o10 = (List<Map<String,String>>)handover.get("integerNumberStatistics");
for(int m=0;m<o10.size();m++){
sb.append("<tr><td>"+String.valueOf(o10.get(m).get("oilName"))+"</td>");
sb.append("<td>"+String.valueOf(o10.get(m).get("numberOfDeals"))+"</td>");
sb.append("<td>"+ String.valueOf(o10.get(m).get("paidAmount"))+"</td></tr>");
sb.append("<tr><td>"+String.valueOf(o10.get(m).get("payType"))+"</td>");
sb.append("<td>"+String.valueOf(o10.get(m).get("orderNum"))+"</td>");
sb.append("<td>"+ String.valueOf(o10.get(m).get("amount"))+"</td></tr>");
}
sb.append("</table>");
sb.append("<center>------新增会员统计------</center>"+"\r\n");
sb.append("<table><tr><td>新增会员数</td><td>实收金额</td></tr>");
List<Map<String,String>> o11 = (List<Map<String,String>>)handover.get("oilNumberStatistics");
for(int m=0;m<o11.size();m++){
sb.append("<tr><td>"+String.valueOf(o11.get(m).get("oilName"))+"</td>");
sb.append("<td>"+ String.valueOf(o11.get(m).get("paidAmount"))+"</td></tr>");
}
Map<String,String> o11 = (Map<String,String>)handover.get("memberStatistics");
sb.append("<table><tr><td>新增会员数</td><td>"+ String.valueOf(o11.get("userNum"))+"</td></tr>");
sb.append("</table>");
sb.append("<center>------挂账会换统计(在处理)------</center>"+"\r\n");
sb.append("<table><tr><td>支付放松</td><td>笔数</td><td>实收金额</td></tr>");
List<Map<String,String>> o12 = (List<Map<String,String>>)handover.get("oilNumberStatistics");
sb.append("<center>------挂账归还统计------</center>"+"\r\n");
sb.append("<table><tr><td>支付方式</td><td>笔数</td><td>实收金额</td></tr>");
List<Map<String,String>> o12 = (List<Map<String,String>>)handover.get("returnedToTheAccount");
for(int m=0;m<o12.size();m++){
sb.append("<tr><td>"+String.valueOf(o12.get(m).get("oilName"))+"</td>");
sb.append("<td>"+String.valueOf(o12.get(m).get("numberOfDeals"))+"</td>");
sb.append("<td>"+ String.valueOf(o12.get(m).get("paidAmount"))+"</td></tr>");
sb.append("<tr><td>"+String.valueOf(o12.get(m).get("status"))+"</td>");
sb.append("<td>"+String.valueOf(o12.get(m).get("returnNum"))+"</td>");
sb.append("<td>"+ String.valueOf(o12.get(m).get("amount"))+"</td></tr>");
}
sb.append("</table>");
sb.append("<center>------员工实收统计------</center>"+"\r\n");
sb.append("<table><tr><td>支付放松</td><td>笔数</td><td>实收金额</td></tr>");
List<Map<String,String>> o13 = (List<Map<String,String>>)handover.get("oilNumberStatistics");
sb.append("<table><tr><td>员工</td><td>笔数</td><td>实收金额</td></tr>");
List<Map<String,String>> o13 = (List<Map<String,String>>)handover.get("staffStatistics");
for(int m=0;m<o13.size();m++){
sb.append("<tr><td>"+String.valueOf(o13.get(m).get("oilName"))+"</td>");
sb.append("<td>"+String.valueOf(o13.get(m).get("numberOfDeals"))+"</td>");
sb.append("<td>"+ String.valueOf(o13.get(m).get("paidAmount"))+"</td></tr>");
sb.append("<tr><td>"+String.valueOf(o13.get(m).get("name"))+"</td>");
sb.append("<td>"+String.valueOf(o13.get(m).get("staffNum"))+"</td>");
sb.append("<td>"+ String.valueOf(o13.get(m).get("monye"))+"</td></tr>");
}
sb.append("</table>");
sb.append("--------------------------------\r\n");