Sp_financialClosing_BtnEventEstimation (procedure)
- Type: PROCEDURE
- Deterministic: NO
- SQL data access: CONTAINS SQL
Parameters
| # | Mode | Name | Type |
|---|---|---|---|
| 1 | IN | sProInParam |
longtext |
| 2 | IN | sMakePerson |
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 PROCEDURESpfinancialClosing_BtnEventEstimation'._
Narrative
Business context: 系统设置 → 系统参数 → 财务结账 — generates 本期材料暂估入库 (this-period material estimate-instore) rows during month-end close. Combines the prior-period estimate carry-over, this-period 采购入库, 寄售仓 (consignment) movement adjustments, line-side warehouse transfers, and this-period purchase invoices into the accmaterialsstore ledger under sFormId='192116810113315220315711060'.
What it does: Parses sCostPeriod from sProInParam. Reads sysaccountperiod.bCalMaterials and refuses (sBtnDepartFinished) if the period is already finalised. Refuses if any prior-period estimate (sFormId='16655716110009059536847895097000') or current-period purchase invoice (sFormId='192116810113315220489243410') is not yet bConfirm=1. Deletes the existing estimate rows for the period, then rebuilds them through temp tables Sp_instore and Sp_instoreSum populated from viw_purpurchasecheck, viw_purpurchaseinstore, accmaterialsstore (prior-period balance + this-period invoice), and purpurchasecheckingslave. Resolves dMaterialsPrice from prior-period estimate, then from viw_purpurchaseorder.dMaterialsNoTaxPrice, then from purpurchasecheckingslave. Skips rows whose sBillNo contains GXKK. Finally inserts the summed estimate rows into accmaterialsstore and back-fills sSupplyId, tCreateDate from the source documents.
Invocation: Dispatched dynamically by GenericProcedureCallServiceImpl.doGenericProcedureCall() from the 财务结帐 form's 本期暂估 toolbar button. Other DB callers: Sp_System_MaterialsAllSure (the unified 一键确认 driver) chains it. xly-src ships script/标版/30100101/cost/Sp_financialClosing_BtnEventEstimation.sql.