forked from erp-dev/erp
feat: add discount_amount to payment_order and receipt_order, and change total_amount logic
This commit is contained in:
@@ -159,13 +159,22 @@
|
||||
```json
|
||||
{
|
||||
"supplier": 12,
|
||||
"bank_account": 3,
|
||||
"payment_date": "2025-11-30",
|
||||
"amount": "5000.00",
|
||||
"remarks": ""
|
||||
"discount_amount": "120.00",
|
||||
"remarks": "",
|
||||
"markup": "审批备注"
|
||||
}
|
||||
```
|
||||
|
||||
`amount` 必须大于 0。返回 201 + 创建的记录。
|
||||
字段说明:
|
||||
|
||||
- `bank_account`:可选,引用 `basic_info.BankAccount`,用于记录具体的付款账户。
|
||||
- `markup`:可选字符串,用于记录票据附言;与 `remarks`(内部备注)区分。
|
||||
- `discount_amount`:可选,默认 0,允许大于 `amount`(表示折扣大于实付);必须 ≥ 0。
|
||||
- `settlement_amount = amount + discount_amount`,所有余额、对账及汇总均基于结算金额。
|
||||
- `amount` 必须大于 0。返回 201 + 创建的记录,响应中会包含 `discount_amount` 与 `settlement_amount`。
|
||||
|
||||
### 4.2 审批逻辑
|
||||
|
||||
@@ -187,12 +196,22 @@
|
||||
```json
|
||||
{
|
||||
"customer": 6,
|
||||
"bank_account": 3,
|
||||
"receipt_date": "2025-11-30",
|
||||
"amount": "3200.00",
|
||||
"remarks": ""
|
||||
"discount_amount": "50.00",
|
||||
"remarks": "",
|
||||
"markup": "回单附言"
|
||||
}
|
||||
```
|
||||
|
||||
字段说明:
|
||||
|
||||
- `bank_account`:可选,引用到账银行账户。
|
||||
- `discount_amount`:可选,默认 0,可大于 `amount`,但必须 ≥ 0。
|
||||
- `markup`:可选,记录回单附言,默认留空。
|
||||
- `settlement_amount` 为响应只读字段(`amount + discount_amount`),对账及余额只会计算结算金额。
|
||||
|
||||
### 5.2 审批
|
||||
|
||||
- `approve`:状态改为 `APPROVED`,客户余额 **减少** 对应金额(冲减欠款)。若已取消则拒绝再次审批。
|
||||
@@ -261,12 +280,14 @@
|
||||
|-----|------|------|
|
||||
| `/customers/<id>/statements/` | GET | 指定客户的销售 / 销退 / 收款对账单 |
|
||||
| `/suppliers/<id>/statements/` | GET | 指定供应商的采购 / 采退 / 付款对账单 |
|
||||
| `/statements/record/` | GET | 通过主体与单据参数获取单条对账记录 |
|
||||
|
||||
关键特性:
|
||||
|
||||
- 固定按 `occurred_at -> recorded_at -> source_id` 倒序输出,不提供排序参数。
|
||||
- `positive_amount` / `negative_amount` 统一表示余额增减;`cumulative_amount`、`current_balance`、`arrears_amount` 均冗余在每条记录中,前端可直接使用。
|
||||
- 余额快照来自 `BalanceService`,每次请求只查询一次,保证与审批事务一致。
|
||||
- 单条查询接口需提供 `counterparty_type`、`counterparty_id`、`order_type`、`order_id` 四个 Query 参数,返回 schema 与列表一致,仅 `records` 中包含匹配记录。
|
||||
|
||||
---
|
||||
|
||||
|
||||
Reference in New Issue
Block a user