Implements insurance coverage amount limit

This commit is contained in:
Djery-Tom 2022-02-17 15:05:47 +01:00
parent f32d4c55c5
commit a0858d891d
15 changed files with 346 additions and 63 deletions

View File

@ -94,10 +94,8 @@ class Kernel extends ConsoleKernel
}
foreach ($sheets as $sheet) {
$this->fetchHealthCareSheetAmounts($sheet);
$totalInsuredAmount += $sheet->insured_amount;
$totalInsurerAmount += $sheet->insurer_amount;
$totalInsurerAmount += $sheet->insurance_amount;
$sheet->date = $sheet->created_at->format('d/m/Y');
}

View File

@ -4,6 +4,7 @@ namespace App\Http\Controllers;
use App\Events\InsuredConsultation;
use App\Exceptions\AppException;
use App\HealthCareSheetType;
use App\InsuranceState;
use App\InsuranceSubscriptionState;
@ -12,6 +13,7 @@ use App\Models\NhAct;
use App\Models\NhAuthorizationOfCareRequest;
use App\Models\NhDrugsAndDevice;
use App\Models\NhExam;
use App\Models\NhHavingRight;
use App\Models\NhHealthCareSheet;
use App\Models\NhHealthCareSheetsExam;
use App\Models\NhHealthCareSheetsHistory;
@ -642,7 +644,6 @@ class HealthCareSheetController extends Controller
}
$parts = $this->getConfigInsuranceParts($nhConfig, $request->input('care_condition'));
try {
DB::beginTransaction();
@ -694,6 +695,11 @@ class HealthCareSheetController extends Controller
$this->useAuthorizationRequest($p['act_id'], $insurance->id, $beneficiary_id, $healthCareSheet->id, $datetime);
}
// Calculer les parts de l'assurance et l'assuré pour cette feuille de soins
$this->calculateInsuranceAmounts($healthCareSheet);
// Verification de la limite de couverture
$this->verifyInsuranceCoverageAmount($nhConfig, $insurance, $healthCareSheet, $beneficiary ?? null);
foreach ($request->input('prescriptions', []) as $p) {
$prescription = NhMedicalPrescription::create($p);
$prescription->created_at = $prescription->updated_at = $datetime;
@ -741,6 +747,8 @@ class HealthCareSheetController extends Controller
DB::commit();
return $this->successResponse(trans('messages.consultation_or_prescription_carried_out'));
} catch (AppException $e) {
return $this->errorResponse($e->getMessage(), $e->getCode());
} catch (Throwable $e) {
Log::error($e->getMessage() . '\n' . $e->getTraceAsString());
DB::rollBack();
@ -748,6 +756,34 @@ class HealthCareSheetController extends Controller
}
}
/**
* @throws AppException
*/
// Verification de la limite de couverture
private function verifyInsuranceCoverageAmount(NhNetworksConfig $nhConfig, NhInsurance $insurance, NhHealthCareSheet $sheet, NhHavingRight $beneficiary = null)
{
$insurance_coverage_amount = isset($beneficiary) ? $beneficiary->insurance_coverage_amount : $insurance->insurance_coverage_amount;
$insurance_amount = $sheet->insurance_amount;
if (!$nhConfig->family_coverage_sharing) {
$total_insurance_amount = $insurance_coverage_amount + $insurance_amount;
if ($total_insurance_amount > $nhConfig->coverage_limit_per_insured_per_year) {
DB::rollBack();
throw new AppException("La limite de couverture a été atteinte pour cet assuré");
}
} else {
$total_insurance_amount = $insurance_amount + $insurance->insurance_coverage_amount;
foreach ($insurance->beneficiaries as $b) {
$total_insurance_amount += $b->insurance_coverage_amount;
}
if ($total_insurance_amount > ($nhConfig->coverage_limit_per_insured_per_year * ($insurance->number_of_beneficiaries + 1))) {
DB::rollBack();
throw new AppException("La mutualisation familiale a été atteinte pour cet assuré");
}
}
}
private function useAuthorizationRequest($act_id, $insurance_id, $beneficiary_id, $sheet_id, $datetime): void
{
$authorization_request = NhAuthorizationOfCareRequest::where('act_id', $act_id)->where('insurance_id', $insurance_id);
@ -990,6 +1026,12 @@ class HealthCareSheetController extends Controller
}
}
// Calculer les parts de l'assurance et l'assuré pour cette feuille de soins
$this->calculateInsuranceAmounts($healthCareSheet);
// Verification de la limite de couverture
$this->verifyInsuranceCoverageAmount($nhConfig, $sheet->insurance, $healthCareSheet, $sheet->beneficiary);
#Clone pivots
// $performances = NhHealthCareSheetsPerformance::where('sheet_id', $sheet->id)->get();
// foreach ($performances as $pf) {
@ -1016,6 +1058,8 @@ class HealthCareSheetController extends Controller
DB::commit();
return $this->successResponse(trans('messages.execution_carried_out'));
} catch (AppException $e) {
return $this->errorResponse($e->getMessage(), $e->getCode());
} catch (Throwable $e) {
Log::error($e->getMessage() . '\n' . $e->getTraceAsString());
DB::rollBack();
@ -1386,20 +1430,38 @@ class HealthCareSheetController extends Controller
$datetime = $this->getCurrentTimeByCountryCode($sheet->insurance->network->country->code_country);
if ($action == 'ACCEPT') {
$sheet->state = InsuranceSubscriptionState::ACCEPTED;
$message = trans('messages.care_sheet_accepted');
} else if ($action == 'REJECT') {
$sheet->state = InsuranceSubscriptionState::REJECTED;
$message = trans('messages.care_sheet_rejected');
} else {
$sheet->state = InsuranceSubscriptionState::UNDER_VALIDATION;
$sheet->created_at = $datetime;
$message = trans('messages.care_sheet_resubmitted');
try {
DB::beginTransaction();
if ($action == 'ACCEPT') {
$sheet->state = InsuranceSubscriptionState::ACCEPTED;
$message = trans('messages.care_sheet_accepted');
// Mettre à jour lq couverture d'assurance de chaque assuré
$sheet->insurance_consumed_at = $datetime;
if (!empty($sheet->beneficiary)) {
$sheet->beneficiary->insurance_coverage_amount += $sheet->insurance_amount;
$sheet->beneficiary->save();
} else {
$sheet->insurance->insurance_coverage_amount += $sheet->insurance_amount;
$sheet->insurance->save();
}
} else if ($action == 'REJECT') {
$sheet->state = InsuranceSubscriptionState::REJECTED;
$message = trans('messages.care_sheet_rejected');
} else {
$sheet->state = InsuranceSubscriptionState::UNDER_VALIDATION;
$sheet->created_at = $datetime;
$message = trans('messages.care_sheet_resubmitted');
}
$sheet->updated_at = $datetime;
$sheet->save();
DB::commit();
return $this->successResponse($message);
} catch (Throwable $e) {
Log::error($e->getMessage() . '\n' . $e->getTraceAsString());
DB::rollBack();
return $this->errorResponse(trans('errors.unexpected_error'), 500);
}
$sheet->updated_at = $datetime;
$sheet->save();
return $this->successResponse($message);
}
private function getConfigInsuranceParts(NhNetworksConfig $nhConfig, $care_condition): stdClass
@ -1773,8 +1835,15 @@ class HealthCareSheetController extends Controller
]);
}
}
// Calculer les parts de l'assurance et l'assuré pour cette feuille de soins
$this->calculateInsuranceAmounts($sheet);
// Verification de la limite de couverture
$this->verifyInsuranceCoverageAmount($nhConfig, $sheet->insurance, $sheet, $beneficiary ?? null);
}
$_prescriptions = [];
foreach ($request->input('prescriptions', []) as $p) {
if (!empty($p['to_delete'])) {
NhMedicalPrescription::find($p['id'])->delete();
@ -1806,6 +1875,7 @@ class HealthCareSheetController extends Controller
}
$prescription->updated_at = $datetime;
$prescription->save();
$_prescriptions[] = $prescription;
if (empty($p['id'])) {
NhHealthCareSheetsPrescription::create([
@ -1857,10 +1927,19 @@ class HealthCareSheetController extends Controller
}
}
if ($sheet->type == HealthCareSheetType::EXECUTION) {
// Calculer les parts de l'assurance et l'assuré pour cette feuille de soins
$this->calculateInsuranceAmounts($sheet);
// Verification de la limite de couverture
$this->verifyInsuranceCoverageAmount($nhConfig, $sheet->insurance, $sheet, $sheet->beneficiary);
}
$sheet->save();
DB::commit();
return $this->successResponse(trans('messages.consultation_or_prescription_updated'));
} catch (AppException $e) {
return $this->errorResponse($e->getMessage(), $e->getCode());
} catch (Throwable $e) {
Log::error($e->getMessage() . '\n' . $e->getTraceAsString());
DB::rollBack();
@ -1887,10 +1966,8 @@ class HealthCareSheetController extends Controller
$sheet->patient_situation = trans('states.' . $sheet->patient_situation);
$sheet->_care_condition = $sheet->care_condition;
$sheet->care_condition = trans('states.' . $sheet->care_condition);
$this->fetchHealthCareSheetAmounts($sheet);
$sheet->insurance_amount = $this->toMoneyWithCurrencyCode($sheet->insurer_amount, $sheet->currency_code);
$sheet->insurance_amount = $this->toMoneyWithCurrencyCode($sheet->insurance_amount, $sheet->currency_code);
$sheet->insured_amount = $this->toMoneyWithCurrencyCode($sheet->insured_amount, $sheet->currency_code);
unset($sheet->insurer_amount);
foreach ($sheet->performances as $p) {
$p->amount_formatted = $this->toMoneyWithCurrencyCode($p->amount, $sheet->currency_code);
$p->moderator_ticket_formatted = $this->toMoneyWithCurrencyCode($p->moderator_ticket, $sheet->currency_code);

View File

@ -204,8 +204,10 @@ class InsuranceController extends Controller
$insurance->state = trans($insurance->state);
$insurance->bonus_amount = $this->toMoneyWithCurrencyCode($insurance->bonus_amount, $currency_code);
$insurance->total_bonus_amount = $this->toMoneyWithCurrencyCode($insurance->total_bonus_amount, $currency_code);
$insurance->insurance_coverage_amount = $this->toMoneyWithCurrencyCode($insurance->insurance_coverage_amount, $currency_code);
foreach ($insurance->beneficiaries as $b) {
$b->bonus_amount = $this->toMoneyWithCurrencyCode($b->bonus_amount, $currency_code);
$b->insurance_coverage_amount = $this->toMoneyWithCurrencyCode($b->insurance_coverage_amount, $currency_code);
}
}
@ -654,11 +656,16 @@ class InsuranceController extends Controller
'number_of_beneficiaries' => sizeof($insurance->beneficiaries),
'total_bonus_amount' => $amountToPaid,
'bonus_amount' => $bonus_amount,
'insurance_coverage_amount' => 0,
'updated_at' => $datetime,
'state' => InsuranceState::PAID,
'start_at' => $datetime,
'end_at' => DateTime::createFromFormat('Y-m-d H:i:s', $datetime)->modify('+' . $insurance->number_of_months . 'months')
]);
// Reinitialiser les montants de couvertures de l'assurance
$insurance->beneficiaries->each->update([
'insurance_coverage_amount' => 0
]);
NhInsurancesPayment::create([
'insured_id' => $insurance->insured_id,

View File

@ -99,10 +99,8 @@ class InvoiceController extends Controller
}
foreach ($sheets as $sheet) {
$this->fetchHealthCareSheetAmounts($sheet);
$totalInsuredAmount += $sheet->insured_amount;
$totalInsurerAmount += $sheet->insurer_amount;
$totalInsurerAmount += $sheet->insurance_amount;
$sheet->date = $sheet->created_at->format('d/m/Y');
}
@ -262,10 +260,8 @@ class InvoiceController extends Controller
foreach ($i->health_care_sheets as $sheet) {
$this->fetchHealthCareSheetAmounts($sheet);
$sheet->amount = $this->toMoneyWithCurrencyCode($sheet->insured_amount + $sheet->insurer_amount, $i->currency_code);
$sheet->insurerAmount = $this->toMoneyWithCurrencyCode($sheet->insurer_amount, $i->currency_code);
$sheet->amount = $this->toMoneyWithCurrencyCode($sheet->insured_amount + $sheet->insurance_amount, $i->currency_code);
$sheet->insurerAmount = $this->toMoneyWithCurrencyCode($sheet->insurance_amount, $i->currency_code);
$sheet->insuredAmount = $this->toMoneyWithCurrencyCode($sheet->insured_amount, $i->currency_code);
}

View File

@ -20,6 +20,7 @@ use Illuminate\Database\Eloquent\SoftDeletes;
* @property Carbon $birthdate
* @property string $affiliation
* @property float $bonus_amount
* @property float $insurance_coverage_amount
* @property string|null $birthdate_proof
* @property string|null $birthdate_proof_doc
* @property string|null $justice_doc
@ -49,6 +50,7 @@ class NhHavingRight extends Model
'birthdate',
'affiliation',
'bonus_amount',
'insurance_coverage_amount',
'birthdate_proof',
'birthdate_proof_doc',
'justice_doc',

View File

@ -31,6 +31,9 @@ use Illuminate\Database\Eloquent\Model;
* @property string $state
* @property int $prescription_sheet_id
* @property int $invoice_id
* @property float $insurance_amount
* @property float $insured_amount
* @property float $insurance_consumed_at
* @property Carbon $created_at
* @property Carbon $updated_at
*
@ -71,7 +74,10 @@ class NhHealthCareSheet extends Model
'type',
'state',
'prescription_sheet_id',
'invoice_id'
'invoice_id',
'insurance_amount',
'insured_amount',
'insurance_consumed_at'
];
public function institution()

View File

@ -20,6 +20,7 @@ use Illuminate\Database\Eloquent\Model;
* @property float $bonus_amount
* @property int $number_of_beneficiaries
* @property float $total_bonus_amount
* @property float $insurance_coverage_amount
* @property Carbon|null $start_at
* @property Carbon|null $end_at
* @property string $state
@ -43,6 +44,7 @@ class NhInsurance extends Model
'insured_id',
'number_of_months',
'total_bonus_amount',
'insurance_coverage_amount',
'number_of_beneficiaries',
'bonus_amount',
'start_at',

View File

@ -19,6 +19,7 @@ use Illuminate\Database\Eloquent\Model;
* @property int $age_limit_of_child_beneficiary
* @property int $age_limit_of_insured_and_spouse
* @property float $coverage_limit_per_insured_per_year
* @property boolean $family_coverage_sharing
* @property float $current_affection_percentage_insurer
* @property float $current_affection_percentage_insured
* @property float $long_term_affection_percentage_insurer
@ -40,6 +41,7 @@ class NhNetworksConfig extends Model
'age_limit_of_insured_and_spouse' => 'int',
'age_limit_of_child_beneficiary' => 'int',
'coverage_limit_per_insured_per_year' => 'float',
'family_coverage_sharing' => 'boolean',
'current_affection_percentage_insurer' => 'float',
'current_affection_percentage_insured' => 'float',
'long_term_affection_percentage_insurer' => 'float',
@ -55,6 +57,7 @@ class NhNetworksConfig extends Model
'age_limit_of_insured_and_spouse',
'age_limit_of_child_beneficiary',
'coverage_limit_per_insured_per_year',
'family_coverage_sharing',
'current_affection_percentage_insurer',
'current_affection_percentage_insured',
'long_term_affection_percentage_insurer',

View File

@ -19,6 +19,7 @@ use App\Models\NhInsurance;
use App\Models\NhInsurancesHavingRight;
use App\Models\NhInsurancesSubscription;
use App\Models\NhMonthsPricesGrid;
use App\Models\NhNetworksConfig;
use App\Models\User;
use Brick\Money\Context\AutoContext;
use Brick\Money\Money;
@ -32,6 +33,7 @@ use Illuminate\Support\Facades\DB;
use Illuminate\Support\Facades\Log;
use Illuminate\Support\Facades\Storage;
use Illuminate\Support\Str;
use stdClass;
trait Helper
{
@ -171,39 +173,6 @@ trait Helper
return date('d') . '/' . date('m') . '/' . date('Y') . '/' . $agent_code;
}
public function fetchHealthCareSheetAmounts($sheet)
{
$insurerAmount = 0;
$insuredAmount = 0;
if ($sheet->type == HealthCareSheetType::CONSULTATION) {
$sum = current(DB::select("SELECT SUM(moderator_ticket) as moderator_ticket , SUM(insurance_amount) as insurance_amount FROM nh_performances p INNER JOIN
nh_health_care_sheets_performances hp ON p.id = hp.performance_id WHERE hp.sheet_id = :sheet_id LIMIT 1", ['sheet_id' => $sheet->id]));
if (isset($sum)) {
$insuredAmount += $sum->moderator_ticket;
$insurerAmount += $sum->insurance_amount;
}
} else {
$sum = current(DB::select("SELECT SUM(insured_paid_amount) as insured_paid_amount , SUM(insurer_paid_amount) as insurer_paid_amount FROM nh_medical_prescriptions p INNER JOIN
nh_health_care_sheets_prescriptions hp ON p.id = hp.prescription_id WHERE hp.sheet_id = :sheet_id LIMIT 1", ['sheet_id' => $sheet->id]));
if (isset($sum)) {
$insuredAmount += $sum->insured_paid_amount;
$insurerAmount += $sum->insurer_paid_amount;
}
$sum = current(DB::select("SELECT SUM(insured_paid_amount) as insured_paid_amount , SUM(insurer_paid_amount) as insurer_paid_amount FROM nh_exams e INNER JOIN
nh_health_care_sheets_exams he ON e.id = he.exam_id WHERE he.sheet_id = :sheet_id LIMIT 1", ['sheet_id' => $sheet->id]));
if (isset($sum)) {
$insuredAmount += $sum->insured_paid_amount;
$insurerAmount += $sum->insurer_paid_amount;
}
}
$sheet->insurer_amount = $insurerAmount;
$sheet->insured_amount = $insuredAmount;
}
/**
* @throws AppException
*/
@ -248,4 +217,38 @@ trait Helper
if (!checkPassword($password, $agent->encrypted_password, $agent->salt))
throw new AppException(trans('messages.incorrect_user_password'));
}
public function calculateInsuranceAmounts(NhHealthCareSheet $sheet)
{
$insuranceAmount = 0;
$insuredAmount = 0;
if ($sheet->type == HealthCareSheetType::CONSULTATION) {
$sum = current(DB::select("SELECT SUM(moderator_ticket) as moderator_ticket , SUM(insurance_amount) as insurance_amount FROM nh_performances p INNER JOIN
nh_health_care_sheets_performances hp ON p.id = hp.performance_id WHERE hp.sheet_id = :sheet_id LIMIT 1", ['sheet_id' => $sheet->id]));
if (isset($sum)) {
$insuredAmount += $sum->moderator_ticket;
$insuranceAmount += $sum->insurance_amount;
}
} else {
$sum = current(DB::select("SELECT SUM(insured_paid_amount) as insured_paid_amount , SUM(insurer_paid_amount) as insurer_paid_amount FROM nh_medical_prescriptions p INNER JOIN
nh_health_care_sheets_prescriptions hp ON p.id = hp.prescription_id WHERE hp.sheet_id = :sheet_id LIMIT 1", ['sheet_id' => $sheet->id]));
if (isset($sum)) {
$insuredAmount += $sum->insured_paid_amount;
$insuranceAmount += $sum->insurer_paid_amount;
}
$sum = current(DB::select("SELECT SUM(insured_paid_amount) as insured_paid_amount , SUM(insurer_paid_amount) as insurer_paid_amount FROM nh_exams e INNER JOIN
nh_health_care_sheets_exams he ON e.id = he.exam_id WHERE he.sheet_id = :sheet_id LIMIT 1", ['sheet_id' => $sheet->id]));
if (isset($sum)) {
$insuredAmount += $sum->insured_paid_amount;
$insuranceAmount += $sum->insurer_paid_amount;
}
}
$sheet->insurance_amount = $insuranceAmount;
$sheet->insured_amount = $insuredAmount;
$sheet->save();
}
}

View File

@ -0,0 +1,42 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class AddInsuranceCoverageAmountToInsured extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('nh_having_rights', function (Blueprint $table) {
$table->decimal('insurance_coverage_amount', 10, 2)->default(0)->after('bonus_amount')
->comment("Montant de la couverture de l'assurance de l'ayant droit, deja utilisé");
});
Schema::table('nh_insurances', function (Blueprint $table) {
$table->decimal('insurance_coverage_amount', 10, 2)->default(0)->after('total_bonus_amount')
->comment("Montant de la couverture de l'assurance de l'assuré principal, deja utilisé");
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::table('nh_having_rights', function (Blueprint $table) {
$table->dropColumn(['insurance_coverage_amount']);
});
Schema::table('nh_insurances', function (Blueprint $table) {
$table->dropColumn(['insurance_coverage_amount']);
});
}
}

View File

@ -0,0 +1,33 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class AddFamilyCoverageSharingToNhNetworksConfigs extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('nh_networks_configs', function (Blueprint $table) {
$table->boolean('family_coverage_sharing')->default(0)->after('coverage_limit_per_insured_per_year')
->comment("Mutualisation ou partage de couverture familiale");
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::table('nh_networks_configs', function (Blueprint $table) {
$table->dropColumn(['family_coverage_sharing']);
});
}
}

View File

@ -0,0 +1,35 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class AddInsurancesAmountsToNhHealthCareSheetsTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('nh_health_care_sheets', function (Blueprint $table) {
$table->decimal('insurance_amount', 10)->nullable()->after('invoice_id');
$table->decimal('insured_amount', 10)->nullable()->after('insurance_amount');
$table->dateTime('insurance_consumed_at')->nullable()->after('insured_amount')
->comment("Date de consommation de la couverture d'assurance");
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::table('nh_health_care_sheets', function (Blueprint $table) {
$table->dropColumn(['insurance_amount', 'insured_amount', 'insurance_consumed_at']);
});
}
}

View File

@ -0,0 +1,54 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\DB;
use Illuminate\Support\Facades\Schema;
class UpdateNhInfosHealthCareSheetsView4 extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
DB::statement("CREATE OR REPLACE VIEW `nh_infos_health_care_sheets` AS
SELECT nhi.insured_id,
nhi.network_id,
nhi.user_id,
u.phone as insured_phone,
u.email as insured_email,
nhcs.*,
nhpc.name as practitioner_provider_class,
ag.lastname as institution_name,
ag.code_membre as institution_code,
cc.currency_code,
p_nhcs.health_care_sheet_id as consultation_health_care_sheet_id,
p_nhcs.practitioner_lastname as consultation_practitioner_lastname,
p_nhcs.practitioner_firstname as consultation_practitioner_firstname,
p_ag.lastname as consultation_institution_name,
p_nhpc.name as consultation_practitioner_provider_class
FROM nh_health_care_sheets nhcs
INNER JOIN nh_insurances nhi ON nhi.id = nhcs.insurance_id
INNER JOIN users u ON u.id = nhi.user_id
INNER JOIN agent_plus ag ON ag.network_agent_id = nhcs.network_agent_id
INNER JOIN countries_currencies cc ON cc.id = ag.country_id
INNER JOIN nh_provider_classes nhpc ON nhpc.id = nhcs.practitioner_provider_class_id
LEFT JOIN nh_health_care_sheets p_nhcs ON p_nhcs.id = nhcs.prescription_sheet_id
LEFT JOIN agent_plus p_ag ON p_nhcs.network_agent_id = p_ag.network_agent_id
LEFT JOIN nh_provider_classes p_nhpc ON p_nhpc.id = p_nhcs.practitioner_provider_class_id
ORDER BY nhcs.created_at DESC");
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
//
}
}

View File

@ -0,0 +1,25 @@
<?php
namespace Database\Seeders;
use App\Models\NhHealthCareSheet;
use App\Traits\Helper;
use Illuminate\Database\Seeder;
class FixNullableInsuranceAmountInNhHealthCareSheetsTable extends Seeder
{
use Helper;
/**
* Run the database seeds.
*
* @return void
*/
public function run()
{
$sheets = NhHealthCareSheet::whereNull('insurance_amount')->get();
foreach ($sheets as $sheet) {
$this->calculateInsuranceAmounts($sheet);
}
}
}

View File

@ -357,7 +357,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'>{{$fmt->format($sheet->insured_amount + $sheet->insurer_amount)}}</span>
style='font-size:9.0pt;font-family:"Garamond",serif;color:black'>{{$fmt->format($sheet->insured_amount + $sheet->insurance_amount)}}</span>
</p>
</td>
<td width=98 valign=top style='width:68.3pt;border-top:none;border-left:none;
@ -371,7 +371,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'>{{$fmt->format($sheet->insurer_amount)}}</span>
style='font-size:9.0pt;font-family:"Garamond",serif;color:black'>{{$fmt->format($sheet->insurance_amount)}}</span>
</p>
</td>
<td width=113 valign=top style='width:49.65pt;border-top:none;border-left: