UserWageMinidaoDao_getMoneyViewSUM.sql 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. select
  2. COUNT(w.id) as sumcount,
  3. SUM(w.basic_wage) as basic_wage,
  4. SUM(w.duties_allowance) as duties_allowance,
  5. SUM(IFNULL(w.certificate_subsidy,0.00)+IFNULL(w.traffic_subsidy,0.00)+IFNULL(w.megathermal_subsidy,0.00)
  6. +IFNULL(w.only_child_cost,0.00)+IFNULL(w.other_subsidy,0.00)) as certificate_subsidy,
  7. SUM(IFNULL(w.project_performance,0.00)+IFNULL(w.bonus,0.00)) as project_performance,
  8. SUM(IFNULL(w.meals_subsidy_day,0.00)+IFNULL(w.meals_subsidy_night,0.00)+IFNULL(w.meals_subsidy,0.00)) as meals_subsidy,
  9. sum(IFNULL(w.overtimepay_timeout,0.00)+IFNULL(w.overtimepay_fixed,0.00)+IFNULL(w.duty+w.special_overtime,0.00)) as special_overtime,
  10. SUM(IFNULL(w.absence_debit,0.00)+IFNULL(w.sick_leave_debit,0.00)+IFNULL(w.thing_leave_debit,0.00)) as absence_debit,
  11. SUM(IFNULL(w.payment_subsidy,0.00)) as payment_subsidy,
  12. SUM(IFNULL(w.social_security_debit,0.00)+IFNULL(w.provident_fund_debit,0.00)) as deductions,
  13. SUM(IFNULL(w.com_social_security_debit,0.00)+IFNULL(w.com_provident_fund_debit,0.00)) as comDeductions,
  14. SUM(IFNULL(w.comcost,0.00)) as comCost,
  15. SUM(daikou_debit) daikouDebit,
  16. SUM(w.other_debit) as other_debit,
  17. SUM(w.reissue) as reissue ,
  18. SUM(w.pre_tax_mone) as pre_tax_mone,
  19. SUM(w.tax_money) as tax_money,
  20. SUM(w.actual_money) as actual_money
  21. from t_bus_user_wage w LEFT JOIN t_s_base_user u on w.userid= u.ID and u.delete_flag='0'
  22. left join t_s_user_org uo on u.id = uo.user_id and uo.ifpluralism and uo.status
  23. LEFT JOIN t_s_depart d on uo.org_id = d.ID where 1=1 and u.delete_flag='0'
  24. <#if ( userWageViewDto.orgIdList )?? && userWageViewDto.orgIdList ?size gt 0>
  25. /* 所属单位*/
  26. and w.pjt_id in(
  27. <#list userWageViewDto.orgIdList as item>
  28. '${item}'
  29. <#if item_has_next>,</#if>
  30. </#list>
  31. )
  32. </#if>
  33. <#if ( userWageViewDto.monthly )?? && userWageViewDto.monthly ?length gt 0>
  34. /* 申请状态*/
  35. and w.monthly = :userWageViewDto.monthly
  36. </#if>
  37. <#if ( uidList )?? && uidList ?size gt 0>
  38. /* 可见的用户id */
  39. and u.id in(
  40. <#list uidList as item>
  41. '${item}'
  42. <#if item_has_next>,</#if>
  43. </#list>
  44. )
  45. </#if>