# `Sp_Calc_sCno` (procedure)

> 客户审核


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

## Parameters

| # | Mode | Name | Type |
|---|---|---|---|
| 1 | IN | `iFlag` | `int` |
| 2 | IN | `iTmpCheck` | `int` |
| 3 | IN | `sFormGuid` | `varchar(100)` |
| 4 | IN | `sGuid` | `varchar(100)` |
| 5 | IN | `sLoginId` | `varchar(100)` |
| 6 | OUT | `sReturn` | `varchar(5000)` |
| 7 | IN | `sBrId` | `varchar(100)` |
| 8 | IN | `sSuId` | `varchar(100)` |
| 9 | OUT | `sCode` | `int` |

## Body

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

## Narrative

**Business context:** 客户审核 — alternative customer-audit check / uncheck on `elenewcustomer`. Variant of the customer-master audit that targets the 新客户 (new-customer-application) staging table rather than the live `elecustomer` table; approval also runs the `SysSystemSettings.CkxDefineCheck=1` replace-field cursor over `SalSalesOrderSlave` to fold customer-derived defaults into open sales orders.

**What it does:** Validates `sGuid`. Reads `SysSystemSettings.CkxDefineCheck`. With `iFlag=1`: refuses if `elenewcustomer.bCheck=1`; when `CkxDefineCheck=1` and `iTmpCheck<>1`, opens a cursor over `SalSalesOrderSlave JOIN salsalesordermaster JOIN eleproduct` keyed on the customer's open orders, then loops applying replace-field substitutions per slave. Finally sets master `bCheck=1` (continued in untruncated body). With `iFlag=0`: symmetric uncheck.

**Invocation:** Status: appears orphaned. No `gdsmodule` hook, no form-master, no other procedure caller, no xly-src reference. The `elenewcustomer` table exists but the audit handler is unwired — sibling `Sp_Calc_sCio` is the bound 客户信息 audit. Candidate for maintainer audit; likely a deprecated alternate of the customer-approval workflow.
