ck 4 năm trước cách đây
mục cha
commit
dc96bbb83b
1 tập tin đã thay đổi với 17 bổ sung2 xóa
  1. 17 2
      data_manage/pitcher_panel.py

+ 17 - 2
data_manage/pitcher_panel.py

@@ -54,7 +54,7 @@ def get_pitcher_panel_daily(pitcher, start, end, page, page_size, order_by, orde
     sql=f"""
             select dt date,
             pitcher,cost,
-            first_reg_amount first_order_amount,
+            first_reg_amount first_order_amount,reg_amount,
             round(if(cost=0,0,first_reg_amount/cost),4) first_roi,
             amount order_amount,
             round(if(cost=0,0,reg_amount/cost),4)  today_roi,
@@ -65,7 +65,22 @@ def get_pitcher_panel_daily(pitcher, start, end, page, page_size, order_by, orde
             from dw_pitcher_daily where 1=1 {op1} {op2} {op3} {op4}
 """
     print(sql)
-    return getLimitData(db.quchen_text,sql,page,page_size)
+
+    sumSql=f"""
+           select '总计' date,sum(cost) cost,
+           sum(first_order_amount) first_order_amount,sum(reg_amount)  reg_amount, 
+           round(if(sum(cost)=0,0,sum(first_order_amount)/sum(cost)),4) first_roi,
+           sum(order_amount) order_amount,
+           round(if(sum(cost)=0,0,sum(reg_amount)/sum(cost)),4)  today_roi, 
+           sum(total_amount) total_amount,
+           sum(total_cost) total_cost,
+           sum(total_profit) total_profit,
+           if(sum(total_cost)=0,0,sum(total_amount)/sum(total_cost)) total_roi 
+            from ({sql}) b  """
+
+    print(sumSql)
+
+    return getLimitSumData(db.quchen_text,sql,sumSql,page,page_size)
 
 
 def get_pitcher_panel_overview(pitcher):