# `deleteBill` (procedure) - **Type:** PROCEDURE - **Deterministic:** NO - **SQL data access:** CONTAINS SQL ## Parameters | # | Mode | Name | Type | |---|---|---|---| | 1 | IN | `p_sCustomerName` | `varchar(50)` | ## Body _Body is not pre-cached. To inspect: `mysql --defaults-file=~/.my.cnf -e 'SHOW CREATE PROCEDURE `deleteBill`'`._ ## Narrative **Business context:** DBA cleanup — purges every transactional bill tied to a single customer (by 客户名称), then deletes the customer record itself. Defined and invoked once by `xly-src/script/del/Sp_Del_Bill_ByCustomerName.sql`, which ends by dropping the procedure; persistence in the live DB suggests an install ran the create-half but not the drop-half. **What it does:** Resolves `p_sCustomerName` → `sId` via `elecustomer`, then issues child-first `DELETE`s across the 报价单 / 销售订单 / 销售对账 / 销售开票 / 工单 / 排产 / 发外加工 (process+checking+instore+invoice) / 成品入库 / 送货 / 送回通知 / 物料库存 / 投产物料 chains, finally deleting the `elecustomer` row. Early-`LEAVE` guard skips the run if the parameter is empty. **Invocation:** Not wired to any form, gdsmodule hook, or other routine. The install script's own `CALL deleteBill('')` is a no-op. Status: appears orphaned in normal operation — kept around as a DBA escape hatch for manual customer-data wipes; verify against compliance/retention policy before running.