# `Sp_chart_MonthOrder` (procedure)

> 本月订单


- **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_MonthOrder`'`._

## Narrative

**Business context:** 销售 / 仪表盘 — 本月订单 (this-month-orders chart). Pie-chart tile showing the top-7 product-classifications by current-month sales-order foreign-currency value plus an aggregated "其他" slice for everything else, scaled to thousands of yuan.

**What it does:** Aggregates checked `viw_salsalesorder` rows where `date_format(tCreateDate,'%Y-%m') = date_format(SYSDATE(),'%Y-%m')` joined to `eleproduct` → `sisproductclassify`. Picks the top 7 classifications by `dProductForeignMoney` (each `{"x":"<name>","y":<money*0.001>}`) into `p_sReturn`, then sums the remaining classifications (`LIMIT 7, 18446744073709551615`) into a single `{"x":"其他","y":<sum*0.001>}` `p_sReturn2`, concatenates, and wraps in `{"data":[...], "hasLegend":true, "subTitle":"单位:千元", "valueFormat":false, "lineWidth":5}` for 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_MonthOrder.sql`. Belongs to the dashboard-tile family whose bindings, if any, live in front-end config.
