diff --git a/app/Console/Kernel.php b/app/Console/Kernel.php index 87584ac..00477d5 100644 --- a/app/Console/Kernel.php +++ b/app/Console/Kernel.php @@ -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, diff --git a/app/Http/Controllers/HealthCareSheetController.php b/app/Http/Controllers/HealthCareSheetController.php index 5c27579..c181722 100755 --- a/app/Http/Controllers/HealthCareSheetController.php +++ b/app/Http/Controllers/HealthCareSheetController.php @@ -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 diff --git a/app/Http/Controllers/InvoiceController.php b/app/Http/Controllers/InvoiceController.php index 364c5b0..e296d92 100755 --- a/app/Http/Controllers/InvoiceController.php +++ b/app/Http/Controllers/InvoiceController.php @@ -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, diff --git a/app/Traits/Helper.php b/app/Traits/Helper.php index 77ae44b..28d2d55 100644 --- a/app/Traits/Helper.php +++ b/app/Traits/Helper.php @@ -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;