Sp_thisworkcost.md 2.08 KB

Sp_thisworkcost (procedure)

  • Type: PROCEDURE
  • Deterministic: NO
  • SQL data access: CONTAINS SQL

Parameters

# Mode Name Type
1 IN sCostPeriod varchar(100)
2 IN iType int
3 IN sBrId varchar(100)
4 IN sSuId varchar(100)
5 OUT sReturn varchar(1000)
6 OUT totalCount int
7 OUT countMapJson longtext
8 OUT sCode int

Body

Body is not pre-cached. To inspect: mysql --defaults-file=~/.my.cnf -e 'SHOW CREATE PROCEDURESpthisworkcost'._

Narrative

Business context: Cost-accounting (成本核算) helper — pivots accordercostanalysis (per-order cost-element ledger) into a flattened Tmpaccordercostanalysis keyed by 产品/客户/成本科目 (sCostFrameName, sSortName2, sAccountNo, sAccountName). Loops over every row in elecostframe (the configured cost-element schema) and emits one dynamic INSERT INTO Tmpaccordercostanalysis per element so a downstream report can pivot per iType (0 in-period, 1 end-of-period, 2/3 研发订单 variants, 5 cost-account summary).

What it does: Validates inputs, builds a cursor over elecostframe joined to udfaccountno (development + cost accounting subjects), iterates p_iOrder 1..N and for each branch builds a dynamic Insert Into Tmpaccordercostanalysis … SQL block aggregating dExpense{N}Money / dEndExpense{N}Money from accordercostanalysis (with salsalesorderslave join for 研发订单 to fetch sRDNo). Concatenates all branches into p_sSql, then executes them in sequence via prepared statements (the accordercostanalysis per-period cost-element fact table → flattened pivot).

Invocation: No callers found in any channel — gdsmodule, form-master, other routines, and full xly-src grep all empty (only the two install scripts script/标版/30100101/Sp_thisworkcost.sql and script/标版/30100101/cost/Sp_thisworkcost.sql). Status: appears orphaned — likely an in-progress / experimental cost-analysis helper. Candidate for maintainer audit.