# `Sp_chart_expenses` (procedure)

> PLC数据同步


- **Type:** PROCEDURE
- **Deterministic:** NO
- **SQL data access:** CONTAINS SQL

## Parameters

| # | Mode | Name | Type |
|---|---|---|---|
| 1 | IN | `sLoginId` | `varchar(100)` |
| 2 | IN | `sBrId` | `varchar(100)` |
| 3 | IN | `sSuId` | `varchar(100)` |
| 4 | IN | `bFilter` | `varchar(5000)` |
| 5 | OUT | `sCode` | `int` |
| 6 | OUT | `sReturn` | `varchar(5000)` |

## Body

_Body is not pre-cached. To inspect: `mysql --defaults-file=~/.my.cnf -e 'SHOW CREATE PROCEDURE `Sp_chart_expenses`'`._

## Narrative

**Business context:** 财务 / 仪表盘 — today's-expenses pie/bar tile. Sums payment-master `dTotalMoney` for today, grouped by 费用类别 (`sisexpense.sName`), and emits the JSON envelope a front-end chart tile expects (unit "元", legend on, ordered by total descending).

**What it does:** Single aggregation over `cahpaymentmaster` joined to `sisexpense` (by `sExpenseId`), restricted to checked rows where `tCreateDate` falls on today's date and tenant matches `sBrId`/`sSuId`. Wraps the `GROUP_CONCAT('{"x":"<name>","y":<money>}')` output into `{"data":[...], "hasLegend":true, "subTitle":"单位:元", "valueFormat":false, "lineWidth":5}` and assigns to OUT `sReturn`.

**Invocation:** Status: appears orphaned. No form-master, gdsmodule hook, other-routine caller, or Java caller — only its install script `script/标版/30100101/Sp_chart_expenses.sql`. Belongs to the dashboard-tile family whose bindings, if any, live in front-end config; the caption "PLC数据同步" shown above (auto-pulled from a sibling proc's `sChinese`) is misleading.
