Improve invoice generation

This commit is contained in:
Djery-Tom 2022-01-28 19:25:18 +01:00
parent 23f8d79ff9
commit 8c0f090035
4 changed files with 15 additions and 17 deletions

View File

@ -103,7 +103,7 @@ class Kernel extends ConsoleKernel
DB::beginTransaction();
$directoryName = '/invoices-docs/';
$filename = $start_at->format('dmY') . '_' . $end_at->format('dmY') . '_' . $agent->code_membre . '.pdf';
$filename = $start_at->format('dmY') . '_' . $end_at->format('dmY') . '_' . $agent->code_membre . '_' . time() . '.pdf';
$invoice = NhInvoice::create([
'invoice_id' => $invoice_id,

View File

@ -1278,20 +1278,18 @@ class HealthCareSheetController extends Controller
if ($action == 'ACCEPT') {
$sheet->state = InsuranceSubscriptionState::ACCEPTED;
$sheet->updated_at = $datetime;
$sheet->save();
return $this->successResponse(trans('messages.care_sheet_accepted'));
$message = trans('messages.care_sheet_accepted');
} else if ($action == 'REJECT') {
$sheet->state = InsuranceSubscriptionState::REJECTED;
$sheet->updated_at = $datetime;
$sheet->save();
return $this->successResponse(trans('messages.care_sheet_rejected'));
$message = trans('messages.care_sheet_rejected');
} else {
$sheet->state = InsuranceSubscriptionState::UNDER_VALIDATION;
$sheet->updated_at = $sheet->created_at = $datetime;
$sheet->save();
return $this->successResponse(trans('messages.care_sheet_resubmitted'));
$sheet->created_at = $datetime;
$message = trans('messages.care_sheet_resubmitted');
}
$sheet->updated_at = $datetime;
$sheet->save();
return $this->successResponse($message);
}
private function getConfigInsuranceParts(NhNetworksConfig $nhConfig, $care_condition): stdClass

View File

@ -78,7 +78,7 @@ class InvoiceController extends Controller
DB::beginTransaction();
$directoryName = '/invoices-docs/';
$filename = $start_at->format('dmY') . '_' . $end_at->format('dmY') . '_' . $agent->code_membre . '.pdf';
$filename = $start_at->format('dmY') . '_' . $end_at->format('dmY') . '_' . $agent->code_membre . '_' . time() . '.pdf';
$invoice = NhInvoice::create([
'invoice_id' => $invoice_id,

View File

@ -173,8 +173,8 @@ trait Helper
->groupBy('nh_health_care_sheets_performances.id')->groupBy('nh_health_care_sheets_performances.sheet_id')->first();
if (isset($sum)) {
$insurerAmount += $sum->moderator_ticket;
$insuredAmount += $sum->insurance_amount;
$insuredAmount += $sum->moderator_ticket;
$insurerAmount += $sum->insurance_amount;
}
@ -182,8 +182,8 @@ trait Helper
->groupBy('nh_health_care_sheets_prescriptions.id')->groupBy('nh_health_care_sheets_prescriptions.sheet_id')->first();
if (isset($sum)) {
$insurerAmount += $sum->insured_paid_amount;
$insuredAmount += $sum->insurer_paid_amount;
$insuredAmount += $sum->insured_paid_amount;
$insurerAmount += $sum->insurer_paid_amount;
}
$sum = $sheet->exams()->selectRaw('SUM(insured_paid_amount) as insured_paid_amount , SUM(insurer_paid_amount) as insurer_paid_amount')
@ -191,8 +191,8 @@ trait Helper
if (isset($sum)) {
$insurerAmount += $sum->insured_paid_amount;
$insuredAmount += $sum->insurer_paid_amount;
$insuredAmount += $sum->insured_paid_amount;
$insurerAmount += $sum->insurer_paid_amount;
}
$sheet->insurer_amount = $insurerAmount;