Improve function to store health care sheet

This commit is contained in:
Djery-Tom 2022-06-02 16:02:06 +01:00
parent e3d4fdf83a
commit d4aafda44e
3 changed files with 13 additions and 13 deletions

View File

@ -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();

View File

@ -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;

View File

@ -350,7 +350,7 @@ color:black;margin-left: 45px;'>-------------------</span></p>
none;border-bottom:solid #BFBFBF 1.0pt;border-right:solid #BFBFBF 1.0pt;
background:#F2F2F2;padding:0in 5.4pt 0in 5.4pt'>
<p class=MsoNormal align=center style='text-align:center'><span
style='font-size:9.0pt;font-family:"Garamond",serif;color:black'>{{$sheet->insurance->insured_id}}</span>
style='font-size:9.0pt;font-family:"Garamond",serif;color:black'>{{$sheet->insurance->insured_id ?? ''}}</span>
</p>
</td>
<td width=35 valign=top style='width:57.55pt;border-top:none;border-left: