Improve function to store health care sheet
This commit is contained in:
parent
e3d4fdf83a
commit
d4aafda44e
|
@ -299,8 +299,6 @@ class InsuranceController extends Controller
|
||||||
foreach ($array as $insurance) {
|
foreach ($array as $insurance) {
|
||||||
$monthPrice = $insurance->monthsGrid;
|
$monthPrice = $insurance->monthsGrid;
|
||||||
|
|
||||||
$insurance->state = trans('states.' . $insurance->state);
|
|
||||||
|
|
||||||
if ($type == 'EDITABLE') {
|
if ($type == 'EDITABLE') {
|
||||||
// Nécessaire seulement lors de la modification ( ajout de ayant droit)
|
// Nécessaire seulement lors de la modification ( ajout de ayant droit)
|
||||||
$config = NhNetworksConfig::where('network_id', $insurance->network->id)->firstOrFail();
|
$config = NhNetworksConfig::where('network_id', $insurance->network->id)->firstOrFail();
|
||||||
|
|
|
@ -74,7 +74,7 @@ class InvoiceController extends Controller
|
||||||
}
|
}
|
||||||
|
|
||||||
// executer le script chaque Dimanche a minuit
|
// executer le script chaque Dimanche a minuit
|
||||||
$start_at = new DateTime();
|
$start_at = new DateTime('today midnight');
|
||||||
switch ($config->provider_billing_period) {
|
switch ($config->provider_billing_period) {
|
||||||
case BillingPeriodType::WEEKLY:
|
case BillingPeriodType::WEEKLY:
|
||||||
$start_at->modify('-7 days');
|
$start_at->modify('-7 days');
|
||||||
|
@ -85,11 +85,9 @@ class InvoiceController extends Controller
|
||||||
case BillingPeriodType::MONTHLY:
|
case BillingPeriodType::MONTHLY:
|
||||||
$start_at->modify('-28 days');
|
$start_at->modify('-28 days');
|
||||||
break;
|
break;
|
||||||
default:
|
|
||||||
$start_at = new DateTime();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
$end_at = new DateTime();
|
$end_at = new DateTime('today midnight');
|
||||||
|
|
||||||
|
|
||||||
$invoice_id = $this->generateInvoiceID($agent->code_membre);
|
$invoice_id = $this->generateInvoiceID($agent->code_membre);
|
||||||
|
@ -476,14 +474,18 @@ class InvoiceController extends Controller
|
||||||
$beneficiary->insurance_coverage_amount -= $sheet->insurance_amount;
|
$beneficiary->insurance_coverage_amount -= $sheet->insurance_amount;
|
||||||
$beneficiary->save();
|
$beneficiary->save();
|
||||||
} else {
|
} else {
|
||||||
|
if ($sheetClone->insurance) {
|
||||||
$sheetClone->insurance->insurance_coverage_amount -= $sheet->insurance_amount;
|
$sheetClone->insurance->insurance_coverage_amount -= $sheet->insurance_amount;
|
||||||
$sheetClone->insurance->save();
|
$sheetClone->insurance->save();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($sheetClone->insurance) {
|
||||||
// Verification de la limite de couverture
|
// Verification de la limite de couverture
|
||||||
$this->verifyInsuranceCoverageAmount($nhConfig, $sheetClone->insurance, $sheetClone, $beneficiary ?? null, $currency_code);
|
$this->verifyInsuranceCoverageAmount($nhConfig, $sheetClone->insurance, $sheetClone, $beneficiary ?? null, $currency_code);
|
||||||
// Mettre à jour la couverture d'assurance de l'assuré
|
// Mettre à jour la couverture d'assurance de l'assuré
|
||||||
$this->updateInsuranceCoverageAmount($sheetClone, $sheetClone->insurance, $datetime, $beneficiary ?? null);
|
$this->updateInsuranceCoverageAmount($sheetClone, $sheetClone->insurance, $datetime, $beneficiary ?? null);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
$totalInsuredAmount += $sheetClone->insured_amount;
|
$totalInsuredAmount += $sheetClone->insured_amount;
|
||||||
|
|
|
@ -350,7 +350,7 @@ color:black;margin-left: 45px;'>-------------------</span></p>
|
||||||
none;border-bottom:solid #BFBFBF 1.0pt;border-right:solid #BFBFBF 1.0pt;
|
none;border-bottom:solid #BFBFBF 1.0pt;border-right:solid #BFBFBF 1.0pt;
|
||||||
background:#F2F2F2;padding:0in 5.4pt 0in 5.4pt'>
|
background:#F2F2F2;padding:0in 5.4pt 0in 5.4pt'>
|
||||||
<p class=MsoNormal align=center style='text-align:center'><span
|
<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>
|
</p>
|
||||||
</td>
|
</td>
|
||||||
<td width=35 valign=top style='width:57.55pt;border-top:none;border-left:
|
<td width=35 valign=top style='width:57.55pt;border-top:none;border-left:
|
||||||
|
|
Loading…
Reference in New Issue