Improve invoice generation
This commit is contained in:
parent
23f8d79ff9
commit
8c0f090035
|
@ -103,7 +103,7 @@ class Kernel extends ConsoleKernel
|
||||||
DB::beginTransaction();
|
DB::beginTransaction();
|
||||||
|
|
||||||
$directoryName = '/invoices-docs/';
|
$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 = NhInvoice::create([
|
||||||
'invoice_id' => $invoice_id,
|
'invoice_id' => $invoice_id,
|
||||||
|
|
|
@ -1278,20 +1278,18 @@ class HealthCareSheetController extends Controller
|
||||||
|
|
||||||
if ($action == 'ACCEPT') {
|
if ($action == 'ACCEPT') {
|
||||||
$sheet->state = InsuranceSubscriptionState::ACCEPTED;
|
$sheet->state = InsuranceSubscriptionState::ACCEPTED;
|
||||||
$sheet->updated_at = $datetime;
|
$message = trans('messages.care_sheet_accepted');
|
||||||
$sheet->save();
|
|
||||||
return $this->successResponse(trans('messages.care_sheet_accepted'));
|
|
||||||
} else if ($action == 'REJECT') {
|
} else if ($action == 'REJECT') {
|
||||||
$sheet->state = InsuranceSubscriptionState::REJECTED;
|
$sheet->state = InsuranceSubscriptionState::REJECTED;
|
||||||
$sheet->updated_at = $datetime;
|
$message = trans('messages.care_sheet_rejected');
|
||||||
$sheet->save();
|
|
||||||
return $this->successResponse(trans('messages.care_sheet_rejected'));
|
|
||||||
} else {
|
} else {
|
||||||
$sheet->state = InsuranceSubscriptionState::UNDER_VALIDATION;
|
$sheet->state = InsuranceSubscriptionState::UNDER_VALIDATION;
|
||||||
$sheet->updated_at = $sheet->created_at = $datetime;
|
$sheet->created_at = $datetime;
|
||||||
$sheet->save();
|
$message = trans('messages.care_sheet_resubmitted');
|
||||||
return $this->successResponse(trans('messages.care_sheet_resubmitted'));
|
|
||||||
}
|
}
|
||||||
|
$sheet->updated_at = $datetime;
|
||||||
|
$sheet->save();
|
||||||
|
return $this->successResponse($message);
|
||||||
}
|
}
|
||||||
|
|
||||||
private function getConfigInsuranceParts(NhNetworksConfig $nhConfig, $care_condition): stdClass
|
private function getConfigInsuranceParts(NhNetworksConfig $nhConfig, $care_condition): stdClass
|
||||||
|
|
|
@ -78,7 +78,7 @@ class InvoiceController extends Controller
|
||||||
DB::beginTransaction();
|
DB::beginTransaction();
|
||||||
|
|
||||||
$directoryName = '/invoices-docs/';
|
$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 = NhInvoice::create([
|
||||||
'invoice_id' => $invoice_id,
|
'invoice_id' => $invoice_id,
|
||||||
|
|
|
@ -173,8 +173,8 @@ trait Helper
|
||||||
->groupBy('nh_health_care_sheets_performances.id')->groupBy('nh_health_care_sheets_performances.sheet_id')->first();
|
->groupBy('nh_health_care_sheets_performances.id')->groupBy('nh_health_care_sheets_performances.sheet_id')->first();
|
||||||
|
|
||||||
if (isset($sum)) {
|
if (isset($sum)) {
|
||||||
$insurerAmount += $sum->moderator_ticket;
|
$insuredAmount += $sum->moderator_ticket;
|
||||||
$insuredAmount += $sum->insurance_amount;
|
$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();
|
->groupBy('nh_health_care_sheets_prescriptions.id')->groupBy('nh_health_care_sheets_prescriptions.sheet_id')->first();
|
||||||
|
|
||||||
if (isset($sum)) {
|
if (isset($sum)) {
|
||||||
$insurerAmount += $sum->insured_paid_amount;
|
$insuredAmount += $sum->insured_paid_amount;
|
||||||
$insuredAmount += $sum->insurer_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')
|
$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)) {
|
if (isset($sum)) {
|
||||||
$insurerAmount += $sum->insured_paid_amount;
|
$insuredAmount += $sum->insured_paid_amount;
|
||||||
$insuredAmount += $sum->insurer_paid_amount;
|
$insurerAmount += $sum->insurer_paid_amount;
|
||||||
}
|
}
|
||||||
|
|
||||||
$sheet->insurer_amount = $insurerAmount;
|
$sheet->insurer_amount = $insurerAmount;
|
||||||
|
|
Loading…
Reference in New Issue