Sp_DailyStatisticalSalary (procedure)
- Type: PROCEDURE
- Deterministic: NO
- SQL data access: CONTAINS SQL
Parameters
| # | Mode | Name | Type |
|---|---|---|---|
| 1 | IN | sProInParam |
varchar(10000) |
| 2 | IN | sLoginId |
varchar(100) |
| 3 | IN | sBrId |
varchar(100) |
| 4 | IN | sSuId |
varchar(100) |
| 5 | OUT | sReturn |
varchar(1000) |
| 6 | OUT | sCode |
int |
Body
Body is not pre-cached. To inspect: mysql --defaults-file=~/.my.cnf -e 'SHOW CREATE PROCEDURESpDailyStatisticalSalary'._
Narrative
Business context: 生产管理 → 工资结算 / 计件工资 — month-scope salary computation driver. For the chosen 年月 (tYearMonth), walks every active 日统计 row in sissalarystructureplan (sCycle='1') and applies its sFormulaId to roll wage figures from mftproductionreportslave (and its employee split table) into per-row dWageMoney<iOrder> columns, materialising a snapshot in mftpayrollstatementcalc and back-writing into mftDaySumReport.
What it does: Validates sProInParam, parses tYearMonth from $.changeValue[0].tYearMonth. Cursors sissalarystructureplan rows for the tenant where sCycle='1' ordered by iOrder; for each plan:
- If
bCalcType=0(per-team), inserts a grouped snapshot intomftpayrollstatementcalcfrommftproductionreportslavefor the year-month, decorates with machine/team names, then cursors back through and for each row callsSp_System_ReplaceField(sId, 'mftpayrollstatementcalc', 'billSlave', p_sFormulaId, @awardMoney, …)to evaluate the formula. The dynamic UPDATE then writes the resulting money intomftProductionReportSlave.dWageMoney<iOrder>proportional todProcessQty, splits it tomftproductionreportemployee.dWageMoney<iOrder>bydProportion, and finally rolls a per-employee total intomftDaySumReport.dWageMoney<iOrder>. - If
bCalcType=1(per-employee/direct), copies the rows frommftDaySumReportstraight intomftpayrollstatementcalcand updatesmftDaySumReport.dWageMoney<iOrder>directly with the formula output. AnySp_System_ReplaceFieldfailure aborts viaLEAVE topwithsCode=-1.
Invocation: Status: appears orphaned in production hooks. No caller in any channel — no form-master, no gdsmodule hook, no other routine. xly-src has install scripts at script/标版/30100101/Sp_DailyStatisticalSalary.sql, the doubled-name Sp_Sp_DailyStatisticalSalary.sql, and a customer override script/客户/金九/Sp_DailyStatisticalSalary.sql — confirming it has a customer-side use history (金九 印务) but no live button binding in the standard 30100101 deployment. The JSON $.changeValue[0].tYearMonth shape is sp_btn_action-style, so binding probably lived on a removed wage-calc button. Candidate for maintainer audit.