feat(StoreFinanceFlow): 修改财务流水的统计方式,按年份和月份或按周显示收入和支出

This commit is contained in:
mkm 2024-06-27 15:13:54 +08:00
parent 3a80a09c83
commit eff3a9a2c6
2 changed files with 2 additions and 2 deletions

View File

@ -46,7 +46,7 @@ class StoreFinanceFlowMonthLists extends BaseAdminDataLists implements ListsSear
return StoreFinanceFlow::where($this->searchWhere) return StoreFinanceFlow::where($this->searchWhere)
->field(' ->field('
CONCAT(YEAR(FROM_UNIXTIME(create_time, "%Y-%m-%d")), "", MONTH(FROM_UNIXTIME(create_time, "%Y-%m-%d")), "") as date, CONCAT(YEAR(FROM_UNIXTIME(create_time, "%Y-%m-%d")), "", MONTH(FROM_UNIXTIME(create_time, "%Y-%m-%d")), "") as date,
SUM(CASE WHEN financial_pm = 1 THEN number ELSE 0 END) as income, SUM(CASE WHEN financial_pm = 1 AND financial_type = 1 THEN number ELSE 0 END) as income,
SUM(CASE WHEN financial_pm = 0 THEN number ELSE 0 END) as expenditure SUM(CASE WHEN financial_pm = 0 THEN number ELSE 0 END) as expenditure
') ')
->limit($this->limitOffset, $this->limitLength) ->limit($this->limitOffset, $this->limitLength)

View File

@ -46,7 +46,7 @@ class StoreFinanceFlowWeekLists extends BaseAdminDataLists implements ListsSearc
return StoreFinanceFlow::where($this->searchWhere) return StoreFinanceFlow::where($this->searchWhere)
->field(' ->field('
CONCAT("", LPAD(YEAR(FROM_UNIXTIME(create_time, "%Y-%m-%d")), 4, "0"), "-", LPAD(WEEK(FROM_UNIXTIME(create_time, "%Y-%m-%d"), 3), 2, "0"), "周(", LPAD(MONTH(FROM_UNIXTIME(create_time, "%Y-%m-%d")), 2, "0"), "月)") as date, CONCAT("", LPAD(YEAR(FROM_UNIXTIME(create_time, "%Y-%m-%d")), 4, "0"), "-", LPAD(WEEK(FROM_UNIXTIME(create_time, "%Y-%m-%d"), 3), 2, "0"), "周(", LPAD(MONTH(FROM_UNIXTIME(create_time, "%Y-%m-%d")), 2, "0"), "月)") as date,
SUM(CASE WHEN financial_pm = 1 THEN number ELSE 0 END) as income, SUM(CASE WHEN financial_pm = 1 AND financial_type = 1 THEN number ELSE 0 END) as income,
SUM(CASE WHEN financial_pm = 0 THEN number ELSE 0 END) as expenditure SUM(CASE WHEN financial_pm = 0 THEN number ELSE 0 END) as expenditure
') ')
->limit($this->limitOffset, $this->limitLength) ->limit($this->limitOffset, $this->limitLength)