Sp_Cashier_CashJournal.md 2.08 KB

Sp_Cashier_CashJournal (procedure)

现金日记帐

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

Parameters

# Mode Name Type
1 IN tStartDate datetime
2 IN tEndDate datetime
3 IN sBrId varchar(100)
4 IN sSuId varchar(100)
5 IN sLoginId varchar(100)
6 IN bFilter varchar(5000)
7 IN pageNum int
8 IN pageSize int
9 OUT totalCount int
10 IN countCloumn varchar(5000)
11 OUT countMapJson longtext
12 IN sFilterOrderBy varchar(5000)
13 IN sGroupby_select_sql varchar(5000)
14 IN sGroupby_group_sql varchar(5000)

Body

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

Narrative

Business context: 财务管理 → 出纳 → 现金日记账 — paged cash-journal report for the dedicated cash settlement bucket. Cash-side counterpart of Sp_Cashier_BankJournal: same shape, but sSettlementId='cash' is hard-coded.

What it does: Reads the cashier cutoff tCashierDate from SysAccountPeriod and the initial cash balance from CahCashierInit (sSettlementId='cash'). Seeds p_dInitMoney by summing prior CahWasteBook.dInMoney - dOutMoney up to the period start, inserts a "期初余额" row into temp Cash, then cursors CahWasteBook rows in the window and appends each with running balance. Enriches sMemo from CahReceiptMaster+elecustomer (receipts) and CahPaymentMaster+elesupply (payments, plus sExpenseItems). Drops pre-period rows except the carry, then re-uses Sp_Outstanding_Query for pagination/total-count.

Invocation: Bound as the data-source of the 现金日记账 form (sId 15782952160006452847376994410000) via gdsconfigformmaster.sSqlStr. Loaded when the user opens 出纳 → 现金日记账. xly-src ships an optimize/Sp_Cashier_CashJournal.sql patch on top of the base 30100101/ script — verify which is deployed.