From d4aafda44ef0ee60947cf7efdd27f0991e408e9e Mon Sep 17 00:00:00 2001
From: Djery-Tom
Date: Thu, 2 Jun 2022 16:02:06 +0100
Subject: [PATCH] Improve function to store health care sheet
---
app/Http/Controllers/InsuranceController.php | 2 --
app/Http/Controllers/InvoiceController.php | 22 +++++++++++---------
resources/views/emails/invoice.blade.php | 2 +-
3 files changed, 13 insertions(+), 13 deletions(-)
diff --git a/app/Http/Controllers/InsuranceController.php b/app/Http/Controllers/InsuranceController.php
index 56867ae..cd5e919 100644
--- a/app/Http/Controllers/InsuranceController.php
+++ b/app/Http/Controllers/InsuranceController.php
@@ -299,8 +299,6 @@ class InsuranceController extends Controller
foreach ($array as $insurance) {
$monthPrice = $insurance->monthsGrid;
- $insurance->state = trans('states.' . $insurance->state);
-
if ($type == 'EDITABLE') {
// Nécessaire seulement lors de la modification ( ajout de ayant droit)
$config = NhNetworksConfig::where('network_id', $insurance->network->id)->firstOrFail();
diff --git a/app/Http/Controllers/InvoiceController.php b/app/Http/Controllers/InvoiceController.php
index 42e5f46..32a13ef 100755
--- a/app/Http/Controllers/InvoiceController.php
+++ b/app/Http/Controllers/InvoiceController.php
@@ -74,7 +74,7 @@ class InvoiceController extends Controller
}
// executer le script chaque Dimanche a minuit
- $start_at = new DateTime();
+ $start_at = new DateTime('today midnight');
switch ($config->provider_billing_period) {
case BillingPeriodType::WEEKLY:
$start_at->modify('-7 days');
@@ -85,11 +85,9 @@ class InvoiceController extends Controller
case BillingPeriodType::MONTHLY:
$start_at->modify('-28 days');
break;
- default:
- $start_at = new DateTime();
}
- $end_at = new DateTime();
+ $end_at = new DateTime('today midnight');
$invoice_id = $this->generateInvoiceID($agent->code_membre);
@@ -476,14 +474,18 @@ class InvoiceController extends Controller
$beneficiary->insurance_coverage_amount -= $sheet->insurance_amount;
$beneficiary->save();
} else {
- $sheetClone->insurance->insurance_coverage_amount -= $sheet->insurance_amount;
- $sheetClone->insurance->save();
+ if ($sheetClone->insurance) {
+ $sheetClone->insurance->insurance_coverage_amount -= $sheet->insurance_amount;
+ $sheetClone->insurance->save();
+ }
}
- // Verification de la limite de couverture
- $this->verifyInsuranceCoverageAmount($nhConfig, $sheetClone->insurance, $sheetClone, $beneficiary ?? null, $currency_code);
- // Mettre à jour la couverture d'assurance de l'assuré
- $this->updateInsuranceCoverageAmount($sheetClone, $sheetClone->insurance, $datetime, $beneficiary ?? null);
+ if ($sheetClone->insurance) {
+ // Verification de la limite de couverture
+ $this->verifyInsuranceCoverageAmount($nhConfig, $sheetClone->insurance, $sheetClone, $beneficiary ?? null, $currency_code);
+ // Mettre à jour la couverture d'assurance de l'assuré
+ $this->updateInsuranceCoverageAmount($sheetClone, $sheetClone->insurance, $datetime, $beneficiary ?? null);
+ }
$totalInsuredAmount += $sheetClone->insured_amount;
diff --git a/resources/views/emails/invoice.blade.php b/resources/views/emails/invoice.blade.php
index 41d5a97..8cf7473 100755
--- a/resources/views/emails/invoice.blade.php
+++ b/resources/views/emails/invoice.blade.php
@@ -350,7 +350,7 @@ color:black;margin-left: 45px;'>-------------------
none;border-bottom:solid #BFBFBF 1.0pt;border-right:solid #BFBFBF 1.0pt;
background:#F2F2F2;padding:0in 5.4pt 0in 5.4pt'>
{{$sheet->insurance->insured_id}}
+ style='font-size:9.0pt;font-family:"Garamond",serif;color:black'>{{$sheet->insurance->insured_id ?? ''}}
|