Blame view

项目文档相关/sql/事业部总经理经理工资表新增毛利相关字段.sql 2.54 KB
d8035736   “wangming”   Refactor project ...
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
  -- ============================================
  -- 事业部总经理/经理工资表新增毛利相关字段
  -- 表名:lq_business_unit_manager_salary_statistics
  -- 说明:为事业部总经理/经理工资计算添加毛利相关字段,用于计算基于毛利的提成
  -- 执行时间:2025
  -- ============================================
  
  -- 1. 销售业绩(开单业绩-退款业绩)
  ALTER TABLE lq_business_unit_manager_salary_statistics 
  ADD COLUMN F_SalesPerformance DECIMAL(18,2) DEFAULT 0.00 COMMENT '销售业绩(开单业绩-退款业绩)' AFTER F_StorePerformanceDetail;
  
  -- 2. 产品物料(仓库领用金额)
  ALTER TABLE lq_business_unit_manager_salary_statistics 
  ADD COLUMN F_ProductMaterial DECIMAL(18,2) DEFAULT 0.00 COMMENT '产品物料(仓库领用金额,注意11月特殊规则:11月工资算10月数据)' AFTER F_SalesPerformance;
  
  -- 3. 合作项目成本
  ALTER TABLE lq_business_unit_manager_salary_statistics 
  ADD COLUMN F_CooperationCost DECIMAL(18,2) DEFAULT 0.00 COMMENT '合作项目成本' AFTER F_ProductMaterial;
  
  -- 4. 店内支出
  ALTER TABLE lq_business_unit_manager_salary_statistics 
  ADD COLUMN F_StoreExpense DECIMAL(18,2) DEFAULT 0.00 COMMENT '店内支出' AFTER F_CooperationCost;
  
  -- 5. 洗毛巾费用
  ALTER TABLE lq_business_unit_manager_salary_statistics 
  ADD COLUMN F_LaundryCost DECIMAL(18,2) DEFAULT 0.00 COMMENT '洗毛巾费用(只统计送出的记录,F_FlowType = 0)' AFTER F_StoreExpense;
  
  -- 6. 毛利(销售业绩-产品物料-合作项目成本-店内支出-洗毛巾)
  ALTER TABLE lq_business_unit_manager_salary_statistics 
  ADD COLUMN F_GrossProfit DECIMAL(18,2) DEFAULT 0.00 COMMENT '毛利(销售业绩-产品物料-合作项目成本-店内支出-洗毛巾)' AFTER F_LaundryCost;
  
  -- ============================================
  -- 字段说明
  -- ============================================
  -- F_SalesPerformance: 销售业绩 = 开单业绩 - 退款业绩
  -- F_ProductMaterial: 产品物料 = 仓库领用金额合计(注意11月特殊规则:11月工资算10月数据)
  -- F_CooperationCost: 合作项目成本 = 合作成本表合计金额
  -- F_StoreExpense: 店内支出 = 店内支出表合计金额
  -- F_LaundryCost: 洗毛巾费用 = 送洗记录总费用(只统计送出的记录,F_FlowType = 0
  -- F_GrossProfit: 毛利 = 销售业绩 - 产品物料 - 合作项目成本 - 店内支出 - 洗毛巾
  -- 
  -- 重要说明:
  -- 1. 提成计算基于毛利,而不是开单业绩
  -- 2. 必须满足提成阶梯1才能有提成资格
  -- 3. 提成计算方式:分段累进式