From feaf5eb957b5747bfea92c6b96062a8239bbc97f Mon Sep 17 00:00:00 2001 From: weiz <736250432@qq.com> Date: Wed, 15 May 2024 10:29:42 +0800 Subject: [PATCH] update --- .../CostApprovedProjectController.php | 10 +++++++--- .../lists/financial/FinancialInvoiceLists.php | 15 ++++++++++----- 2 files changed, 17 insertions(+), 8 deletions(-) diff --git a/app/adminapi/controller/cost_project/CostApprovedProjectController.php b/app/adminapi/controller/cost_project/CostApprovedProjectController.php index 099c5fbe3..584cf3900 100644 --- a/app/adminapi/controller/cost_project/CostApprovedProjectController.php +++ b/app/adminapi/controller/cost_project/CostApprovedProjectController.php @@ -90,13 +90,17 @@ $data['total_refund_amount'] = FinancialRefund::where('contract_id', $data['id'])->sum('amount'); //未到账金额 $data['not_total_refund_amount'] = bcsub($data['signed_amount'], $data['total_refund_amount'], 2); + //开票已回款金额 + $data['invoice_has_refund_amount'] = FinancialRefund::where('contract_id', $data['id'])->where('invoice_id', 'in', $invoice_ids)->sum('amount'); //开票未回款金额 - $invoice_has_refund_amount = FinancialRefund::where('contract_id', $data['id'])->where('invoice_id', 'in', $invoice_ids)->sum('amount'); - $data['invoice_not_refund_amount'] = bcsub($data['total_invoice_amount'], $invoice_has_refund_amount, 2); + $data['invoice_not_refund_amount'] = bcsub($data['total_invoice_amount'], $data['invoice_has_refund_amount'], 2); //回款未开票金额 - $data['refund_not_invoice_amount'] = bcsub($data['total_refund_amount'], $invoice_has_refund_amount, 2); + $data['refund_not_invoice_amount'] = bcsub($data['total_refund_amount'], $data['invoice_has_refund_amount'], 2); //结算金额 $data['total_settlement_amount'] = FinancialSettlement::where('contract_id', $data['id'])->sum('amount'); + //到账日期 + $last_refund = FinancialRefund::where('contract_id', $data['id'])->order('id desc')->findOrEmpty(); + $data['refund_date'] = $last_refund['create_time'] ?? ''; $financial_settlement = FinancialSettlement::where('contract_id', $data['id'])->order('id desc')->findOrEmpty(); if ($financial_settlement->isEmpty()) { $data['is_settlement'] = 0; //未结算 diff --git a/app/adminapi/lists/financial/FinancialInvoiceLists.php b/app/adminapi/lists/financial/FinancialInvoiceLists.php index b8ba158d0..672b3d22d 100644 --- a/app/adminapi/lists/financial/FinancialInvoiceLists.php +++ b/app/adminapi/lists/financial/FinancialInvoiceLists.php @@ -77,12 +77,17 @@ $data['sign_time'] = $contract['create_time']; $data['invoice_type_text'] = $data->invoice_type_text; $data['refund_amount'] = FinancialRefund::where('invoice_id', $data['id'])->sum('amount') ?? 0.00; - if ($data['refund_amount'] <= 0) { - $data['is_refund'] = '未到账'; - } elseif ($data['refund_amount'] < $data['apply_amount']) { - $data['is_refund'] = '部分到账'; + $rate = bcdiv($data['refund_amount'], $data['apply_amount'], 2); + if (($rate * 100) <= 0) { + $data['is_refund'] = '未到账(设定0%)'; + } elseif (($rate * 100) <= 30) { + $data['is_refund'] = '一般到账(设定30%以下)'; + } elseif (($rate * 100) <= 60) { + $data['is_refund'] = '部分到账(设定60%以下)'; + } elseif (($rate * 100) < 100) { + $data['is_refund'] = '大额到账(设定100%以下)'; } else { - $data['is_refund'] = '已到账'; + $data['is_refund'] = '已到账(设定100%)'; } $last_refund = FinancialRefund::where('invoice_id', $data['id'])->order('id desc')->findOrEmpty(); $data['refund_date'] = $last_refund['create_time'] ?? '';