# `Sp_Calc_sCcp` (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_sCcp`'`._

## Narrative

**Business context:** 质量管理 → 质量管理单据 → 内部质量投诉单据 — internal-quality-complaint check / uncheck on `ComComplaint`. Approves an internal complaint write-up (defect / process / supplier issue raised by a downstream department) so it appears in quality dashboards.

**What it does:** Validates `sGuid`. Reads `ComComplaint.bInvalid`; refuses if invalid. With `iFlag=1`: refuses if already checked, otherwise sets master `bCheck=1`, `sCheckPerson=sLoginId`, `tCheckDate=tCheckTime`, `sStatus=1`. With `iFlag=0`: refuses if already unchecked, then clears the same fields.

**Invocation:** Bound to `gdsmodule.sProcName` on:
- `内部质量投诉单据` (sId `15831246720003184823218709145600`) — 质量管理 → 质量管理单据
- `文件管理列表` (sId `101251240115016170698509870`) — 人事行政 → 文件管理 (reuses this proc as its check hook — likely an unintentional copy-paste; the file-management module's audit shouldn't normally touch `ComComplaint`)

Flag: the `文件管理列表` binding is suspect — operating on `ComComplaint` from a 文件管理 menu makes no business sense. Verify with the maintainer.
