diff --git a/.env.example b/.env.example index 1e84e37..3481adc 100644 --- a/.env.example +++ b/.env.example @@ -15,6 +15,13 @@ DB_DATABASE=iLink_prod DB_USERNAME=root DB_PASSWORD=vps@2017GA +MAIL_HOST=mail.ilink-app.com +MAIL_USERNAME=noreply@ilink-app.com +MAIL_PASSWORD=ilink2017GA +MAIL_FROM_ADDRESS=noreply@ilink-app.com +MAIL_FROM_NAME="iLink World" +MAIL_ENCRYPTION=tls + CACHE_DRIVER=file QUEUE_CONNECTION=sync diff --git a/.gitignore b/.gitignore index 5cf2731..446ec14 100644 --- a/.gitignore +++ b/.gitignore @@ -9,4 +9,5 @@ Homestead.yaml /public/swagger-ui-assets /public/insurances-subscriptions-docs /public/qrcodes +/public/invoices composer.lock diff --git a/app/BillingPeriodType.php b/app/BillingPeriodType.php new file mode 100644 index 0000000..f818416 --- /dev/null +++ b/app/BillingPeriodType.php @@ -0,0 +1,11 @@ +input('performances', []) as $p) { + $fees = !empty($p['home_visit_fees']) ? $p['home_visit_fees'] : 0; $performance = NhPerformance::create([ 'act_id' => $p['act_id'], 'amount' => $p['amount'], - 'home_visit_fees' => !empty($p['home_visit_fees']) ? $p['home_visit_fees'] : null, - 'moderator_ticket' => $parts->insured_part * $p['amount'], // to calculate, - 'insurance_amount' => $parts->insurer_part * $p['amount'], // to calculate, montant de l'assurance + 'home_visit_fees' => $fees != 0 ? $fees : null, + 'moderator_ticket' => $parts->insured_part * ($p['amount'] + $fees), // to calculate, + 'insurance_amount' => $parts->insurer_part * ($p['amount'] + $fees), // to calculate, montant de l'assurance 'created_at' => $datetime, 'updated_at' => $datetime, ]); @@ -1599,10 +1597,11 @@ class HealthCareSheetController extends Controller $performance->act_id = !empty($p['act_id']) ? $p['act_id'] : $performance->act_id; $performance->home_visit_fees = !empty($p['home_visit_fees']) ? $p['home_visit_fees'] : $performance->home_visit_fees; + $fees = !empty($performance->home_visit_fees) ? $performance->home_visit_fees : 0; if (!empty($p['amount'])) { $performance->amount = $p['amount']; - $performance->moderator_ticket = $parts->insured_part * $p['amount']; // to calculate, - $performance->insurance_amount = $parts->insurer_part * $p['amount']; // to calculate, montant de l'assurance + $performance->moderator_ticket = $parts->insured_part * ($p['amount'] + $fees); // to calculate, + $performance->insurance_amount = $parts->insurer_part * ($p['amount'] + $fees); // to calculate, montant de l'assurance } $performance->updated_at = $datetime; $performance->save(); diff --git a/app/Http/Controllers/InsuranceController.php b/app/Http/Controllers/InsuranceController.php index d572cc0..1e08a53 100644 --- a/app/Http/Controllers/InsuranceController.php +++ b/app/Http/Controllers/InsuranceController.php @@ -20,7 +20,6 @@ use Throwable; class InsuranceController extends Controller { - use Helper; /** * Create a new controller instance. diff --git a/app/Http/Controllers/InsuranceSubscriptionController.php b/app/Http/Controllers/InsuranceSubscriptionController.php index 5179f74..9e6bff8 100644 --- a/app/Http/Controllers/InsuranceSubscriptionController.php +++ b/app/Http/Controllers/InsuranceSubscriptionController.php @@ -32,8 +32,6 @@ use Throwable; class InsuranceSubscriptionController extends Controller { - use Helper; - /** * Create a new controller instance. * diff --git a/app/Http/Controllers/InsuredController.php b/app/Http/Controllers/InsuredController.php index 6bbfe8b..05ce1a1 100755 --- a/app/Http/Controllers/InsuredController.php +++ b/app/Http/Controllers/InsuredController.php @@ -18,9 +18,6 @@ use stdClass; class InsuredController extends Controller { - use ApiResponser; - use Helper; - /** * @OA\Get( * path="/insured", diff --git a/app/Http/Controllers/InvoiceController.php b/app/Http/Controllers/InvoiceController.php new file mode 100755 index 0000000..33109f2 --- /dev/null +++ b/app/Http/Controllers/InvoiceController.php @@ -0,0 +1,241 @@ +validate($request, [ + 'network_agent_id' => 'required|integer|exists:networks_agents,id' + ]); + $network_agent_id = $request->input('network_agent_id'); + $agent = AgentPlus::where('network_agent_id', $network_agent_id)->first(); + $hyper = AgentPlus::where('network_id', $agent->network_id)->where('category', 'hyper')->first(); + $config = NhNetworksConfig::where('network_id', $agent->network_id)->first(); + if (!isset($config)) { + return $this->errorResponse("Le nano sante n'est pas actif pour ce reseau"); + } + + // executer le script chaque Dimanche a minuit + $start_at = new DateTime(); + switch ($config->provider_billing_period) { + case BillingPeriodType::WEEKLY: + $start_at->modify('-7 days'); + break; + case BillingPeriodType::BIMONTHLY: + $start_at->modify('-14 days'); + break; + case BillingPeriodType::MONTHLY: + $start_at->modify('-28 days'); + break; + default: + $start_at = new DateTime(); + } + + $end_at = new DateTime(); + + + $invoice_id = $this->generateInvoiceID($agent->code_membre); + $country = CountriesCurrency::findOrFail($agent->country_id); + $datetime = $this->getCurrentTimeByCountryCode($country->code_country); + + $totalInsurerAmount = 0; + $totalInsuredAmount = 0; + $sheets = NhHealthCareSheet::with(['insurance'])->where('network_agent_id', $network_agent_id)->where('state', InsuranceSubscriptionState::ACCEPTED) + ->where('created_at', '>=', $start_at)->where('created_at', '<=', $end_at)->get(); + + if (sizeof($sheets) == 0) { + return $this->errorResponse("Aucune feuille de soins acceptée"); + } + + foreach ($sheets as $sheet) { + $insurerAmount = 0; + $insuredAmount = 0; + + foreach ($sheet->performances as $p) { + $insurerAmount += ($p->moderator_ticket ?? 0); + $insuredAmount += ($p->insurance_amount ?? 0); + } + + foreach ($sheet->performances as $p) { + $insurerAmount += ($p->insured_paid_amount ?? 0); + $insuredAmount += ($p->insurer_paid_amount ?? 0); + } + + foreach ($sheet->performances as $p) { + $insurerAmount += ($p->insured_paid_amount ?? 0); + $insuredAmount += ($p->insurer_paid_amount ?? 0); + } + + $sheet->insurer_amount = $insurerAmount; + $sheet->insured_amount = $insuredAmount; + + $totalInsuredAmount += $insuredAmount; + $totalInsurerAmount += $insurerAmount; + + $sheet->date = $sheet->created_at->format('d/m/Y'); + } + + try { + DB::beginTransaction(); + + $directoryName = '/invoices/'; + $filename = $start_at->format('dmY') . '_' . $end_at->format('dmY') . '_' . $agent->code_membre . '.pdf'; + + $invoice = NhInvoice::create([ + 'invoice_id' => $invoice_id, + 'network_agent_id' => $agent->network_agent_id, + 'amount' => $totalInsuredAmount + $totalInsurerAmount, + 'insured_amount' => $totalInsuredAmount, + 'insurer_amount' => $totalInsurerAmount, + 'period_start_at' => $start_at, + 'period_end_at' => $end_at, + 'file_url' => config('services.app_url') . $directoryName . $filename, + 'created_at' => $datetime, + 'updated_at' => $datetime + ]); + + $invoice->amount = $this->toMoneyWithCurrencyCode($invoice->amount, $country->currency_code); + $invoice->insured_amount = $this->toMoneyWithCurrencyCode($invoice->insured_amount, $country->currency_code); + $invoice->insurer_amount = $this->toMoneyWithCurrencyCode($invoice->insurer_amount, $country->currency_code); + $invoice->home_visit_fees = $this->toMoneyWithCurrencyCode($invoice->home_visit_fees, $country->currency_code); + + $ids = array_map(function ($r) { + return $r['id']; + }, $sheets->toArray()); + + DB::update("UPDATE nh_health_care_sheets SET state = :state_ , invoice_id = :id WHERE id IN (" . implode(',', $ids) . ")", + ['id' => $invoice->id, 'state_' => InsuranceSubscriptionState::INVOICE_ISSUED]); + + $invoice->sheets = $sheets; + $invoice->agent = $agent; + $invoice->hyper = $hyper; + $invoice->period = $start_at->format('d/m/Y') . ' ' . trans('messages.to') . ' ' . $end_at->format('d/m/Y'); + + //Check if the directory already exists. + if (!is_dir(public_path($directoryName))) { + //Directory does not exist, so lets create it. + mkdir($directoryName, 0755); + } + + $title = trans('messages.invoice') . ' ' . $invoice->period; + $message = ""; + + $file = PDF::loadView('emails.invoice', $invoice->toArray())->setPaper('a4', 'landscape')->setWarnings(false)->save(public_path($directoryName . $filename)); + + DB::commit(); + $recipients = [preg_replace("/\s+/", "", $hyper->email)]; // Supprimer les espaces dans le mail + Mail::mailer('smtp')->raw($message, function ($message) use ($recipients, $title, $file) { + $message->subject($title) + ->to($recipients) + ->attachData($file->output(), $title . '.pdf'); + }); + + } catch (\Throwable $t) { + DB::rollBack(); + Log::error('-------- Mail not sent -----------'); + Log::error($t->getMessage() . " :\n" . $t->getTraceAsString()); + } + + return $this->successResponse("Invoice generated"); + } + + private function generateInvoiceID($agent_code) + { + return date('d') . '/' . date('m') . '/' . date('Y') . '/' . $agent_code; + } +} diff --git a/app/Http/Controllers/QRCodeController.php b/app/Http/Controllers/QRCodeController.php deleted file mode 100755 index 1666123..0000000 --- a/app/Http/Controllers/QRCodeController.php +++ /dev/null @@ -1,138 +0,0 @@ - $user->lastname, 'data' => $user->id]) - ->setPaper('a4', 'portrait')->setWarnings(false)->save(public_path($directoryName . $user->id . '.pdf')); -// $recipients = [preg_replace("/\s+/", "", $email)]; // Supprimer les espaces dans le mail -// Mail::mailer('smtp')->raw($messageText, function ($message) use ($recipients, $title, $pdf, $notice) { -// $message->subject($title) -// ->to($recipients) -// ->attachData($pdf->output(), $title . ' - ' . $notice->id_tax_notice . ".pdf"); -// }); - - $user->has_qr_code = 1; - $user->save(); - return $this->successResponse(trans('messages.successful_transaction')); - } catch (\Throwable $t) { - Log::error('-------- Mail not sent -----------'); - Log::error($t->getMessage()); - return $this->errorResponse(trans('errors.unexpected_error')); - } - } - - /** - * @OA\Get( - * path="/qrcode/read/{id_user}", - * summary="Lire les informations à partir de l'id de l'utilisateur obtenu en scanant le QRCode", - * tags={"QRCode"}, - * security={{"api_key":{}}}, - * @OA\Parameter( - * parameter="id_user", - * name="id_user", - * description="ID de l'utilisateur", - * @OA\Schema( - * type="integer" - * ), - * in="path", - * required=true - * ), - * @OA\Response( - * response=200, - * description="OK", - * @OA\JsonContent( - * ref="#/components/schemas/ApiResponse", - * example = { - * "status" : 200, - * "response" : {"id":349,"uid":"5fcb90ab7197f8.26608831", - * "firstname":null,"lastname":"Tom Di","phone":"+237690716648","email":"ddoubletom@gmail.com","user_code":"vdVtq7ym9S","numero_carte":null, - * "expiration_date":null,"adresse":"kotto","solde":0,"salt":"dbbaea33d9","validation_code":"xuty8dbq","active":1,"date_modified":"2020-12-05T14:52:43.000000Z", - * "date_created":"2020-12-05T14:52:43.000000Z","network_id":185,"group_id":null,"balance_credit":0,"balance_epargne":0,"balance_nano_health":11335000, - * "date_adhesion":null,"id_bank_country":null,"iban":null}, - * "error":null - * } - * ) - * ) - * ) - */ - //Lire les infos d'un utilisateur à partir de son id - public function read($id_user) - { - $user = User::findOrFail($id_user); - return $this->successResponse($user); - } - - /** - * @OA\Get( - * path="/qrcode/image/{id_user}", - * summary="Generer l'image du QRCode d'un utilisateur à partir de son id", - * tags={"QRCode"}, - * security={{"api_key":{}}}, - * @OA\Parameter( - * parameter="id_user", - * name="id_user", - * description="ID de l'utilisateur", - * @OA\Schema( - * type="integer" - * ), - * in="path", - * required=true - * ), - * @OA\Response( - * response=200, - * description="OK", - * @OA\JsonContent( - * ref="#/components/schemas/ApiResponse", - * example = { - * "status" : 200, - * "response" : "image en base64", - * "error":null - * } - * ) - * ) - * ) - */ - //Generer l'image du QRCode d'un utilisateur à partir de son id - public function image($id_user) - { - $user = User::findOrFail($id_user); - return $this->successResponse(base64_encode(\SimpleSoftwareIO\QrCode\Facades\QrCode::format('svg') - ->size(300)->errorCorrection('H') - ->generate($user->id))); - } -} diff --git a/app/InsuranceSubscriptionState.php b/app/InsuranceSubscriptionState.php index 44b3a89..ccbf3c5 100644 --- a/app/InsuranceSubscriptionState.php +++ b/app/InsuranceSubscriptionState.php @@ -8,4 +8,5 @@ abstract class InsuranceSubscriptionState const AWAITING_FURTHER_INFORMATION = 'AWAITING_FURTHER_INFORMATION'; const ACCEPTED = 'ACCEPTED'; const REJECTED = 'REJECTED'; + const INVOICE_ISSUED = 'INVOICE_ISSUED'; } diff --git a/app/Models/NhHealthCareSheet.php b/app/Models/NhHealthCareSheet.php index fa7cf5c..9783be8 100644 --- a/app/Models/NhHealthCareSheet.php +++ b/app/Models/NhHealthCareSheet.php @@ -30,6 +30,7 @@ use Illuminate\Database\Eloquent\Model; * @property string $type * @property string $state * @property int $prescription_sheet_id + * @property int $invoice_id * @property Carbon $created_at * @property Carbon $updated_at * @@ -69,7 +70,8 @@ class NhHealthCareSheet extends Model 'pregnancy_end_at', 'type', 'state', - 'prescription_sheet_id' + 'prescription_sheet_id', + 'invoice_id' ]; public function institution() diff --git a/app/Models/NhInvoice.php b/app/Models/NhInvoice.php new file mode 100644 index 0000000..c674c93 --- /dev/null +++ b/app/Models/NhInvoice.php @@ -0,0 +1,54 @@ + 'int', + ]; + + protected $dates = [ + 'period_start_at', + 'period_end_at' + ]; + + protected $fillable = [ + 'invoice_id', + 'network_agent_id', + 'amount', + 'insured_amount', + 'insurer_amount', + 'period_start_at', + 'period_end_at', + 'file_url', + 'created_at', + 'updated_at' + ]; +} diff --git a/bootstrap/app.php b/bootstrap/app.php index 8dee8e8..98328bf 100644 --- a/bootstrap/app.php +++ b/bootstrap/app.php @@ -64,6 +64,10 @@ $app->configure('swagger-lume'); $app->configure('services'); $app->configure('sentry'); $app->configure('dompdf'); +$app->configure('mail'); +$app->alias('mailer', Illuminate\Mail\Mailer::class); +$app->alias('mailer', Illuminate\Contracts\Mail\Mailer::class); +$app->alias('mailer', Illuminate\Contracts\Mail\MailQueue::class); /* |-------------------------------------------------------------------------- @@ -105,6 +109,7 @@ $app->register(\MigrationsGenerator\MigrationsGeneratorServiceProvider::class); $app->register('Sentry\Laravel\ServiceProvider'); $app->register('Sentry\Laravel\Tracing\ServiceProvider'); $app->register(\Barryvdh\DomPDF\ServiceProvider::class); +$app->register(Illuminate\Mail\MailServiceProvider::class); /* |-------------------------------------------------------------------------- diff --git a/composer.json b/composer.json index be28a44..eeccfa5 100644 --- a/composer.json +++ b/composer.json @@ -7,15 +7,17 @@ "require": { "php": "^7.3|^8.0", "ext-gd": "*", + "ext-intl": "*", "ext-json": "*", "barryvdh/laravel-dompdf": "^0.9.0", "brick/money": "^0.5.2", "darkaonline/swagger-lume": "^8.0", + "fightbulc/moment": "^1.33", "guzzlehttp/guzzle": "^7.3", + "illuminate/mail": "^8.80", "kitloong/laravel-migrations-generator": "^5.0", "laravel/lumen-framework": "^8.0", - "sentry/sentry-laravel": "^2.9", - "simplesoftwareio/simple-qrcode": "^4.2" + "sentry/sentry-laravel": "^2.9" }, "require-dev": { "fakerphp/faker": "^1.9.1", diff --git a/config/mail.php b/config/mail.php new file mode 100644 index 0000000..54299aa --- /dev/null +++ b/config/mail.php @@ -0,0 +1,110 @@ + env('MAIL_MAILER', 'smtp'), + + /* + |-------------------------------------------------------------------------- + | Mailer Configurations + |-------------------------------------------------------------------------- + | + | Here you may configure all of the mailers used by your application plus + | their respective settings. Several examples have been configured for + | you and you are free to add your own as your application requires. + | + | Laravel supports a variety of mail "transport" drivers to be used while + | sending an e-mail. You will specify which one you are using for your + | mailers below. You are free to add additional mailers as required. + | + | Supported: "smtp", "sendmail", "mailgun", "ses", + | "postmark", "log", "array" + | + */ + + 'mailers' => [ + 'smtp' => [ + 'transport' => 'smtp', + 'host' => env('MAIL_HOST', 'smtp.mailgun.org'), + 'port' => env('MAIL_PORT', 587), + 'encryption' => env('MAIL_ENCRYPTION', 'tls'), + 'username' => env('MAIL_USERNAME'), + 'password' => env('MAIL_PASSWORD'), + 'timeout' => null, + 'auth_mode' => null, + ], + + 'ses' => [ + 'transport' => 'ses', + ], + + 'mailgun' => [ + 'transport' => 'mailgun', + ], + + 'postmark' => [ + 'transport' => 'postmark', + ], + + 'sendmail' => [ + 'transport' => 'sendmail', + 'path' => '/usr/sbin/sendmail -bs', + ], + + 'log' => [ + 'transport' => 'log', + 'channel' => env('MAIL_LOG_CHANNEL'), + ], + + 'array' => [ + 'transport' => 'array', + ], + ], + + /* + |-------------------------------------------------------------------------- + | Global "From" Address + |-------------------------------------------------------------------------- + | + | You may wish for all e-mails sent by your application to be sent from + | the same address. Here, you may specify a name and address that is + | used globally for all e-mails that are sent by your application. + | + */ + + 'from' => [ + 'address' => env('MAIL_FROM_ADDRESS', 'hello@example.com'), + 'name' => env('MAIL_FROM_NAME', 'Example'), + ], + + /* + |-------------------------------------------------------------------------- + | Markdown Mail Settings + |-------------------------------------------------------------------------- + | + | If you are using Markdown based email rendering, you may configure your + | theme and component paths here, allowing you to customize the design + | of the emails. Or, you may simply stick with the Laravel defaults! + | + */ + + 'markdown' => [ + 'theme' => 'default', + + 'paths' => [ + resource_path('views/vendor/mail'), + ], + ], + +]; diff --git a/config/services.php b/config/services.php index 5f43c97..6f959ad 100755 --- a/config/services.php +++ b/config/services.php @@ -5,5 +5,6 @@ return [ 'notification_service' => [ 'base_uri' => env('NOTIFICATION_SERVICE_URL'), 'key' => env('NOTIFICATION_SERVICE_KEY') - ] + ], + 'app_url' => env('APP_URL') ]; diff --git a/database/migrations/2021_11_04_144019_create_nh_infos_insurances_view.php b/database/migrations/2021_11_04_144019_create_nh_infos_insurances_view.php index f4385e4..1f3294e 100644 --- a/database/migrations/2021_11_04_144019_create_nh_infos_insurances_view.php +++ b/database/migrations/2021_11_04_144019_create_nh_infos_insurances_view.php @@ -2,6 +2,7 @@ use Illuminate\Database\Migrations\Migration; use Illuminate\Database\Schema\Blueprint; +use Illuminate\Support\Facades\DB; use Illuminate\Support\Facades\Schema; class CreateNhInfosInsurancesView extends Migration diff --git a/database/migrations/2022_01_18_154629_create_nh_invoices_table.php b/database/migrations/2022_01_18_154629_create_nh_invoices_table.php new file mode 100644 index 0000000..b000d74 --- /dev/null +++ b/database/migrations/2022_01_18_154629_create_nh_invoices_table.php @@ -0,0 +1,40 @@ +id(); + $table->string('invoice_id'); + $table->integer('network_agent_id'); + $table->decimal('amount', 12, 2); + $table->decimal('insured_amount', 10, 2)->comment("Part à payer par assuré"); + $table->decimal('insurer_amount', 10, 2)->comment("Part à la charge assureur"); + $table->date('period_start_at'); + $table->date('period_end_at'); + $table->string('file_url')->nullable(); + $table->timestamp('created_at')->useCurrent(); + $table->timestamp('updated_at')->useCurrent(); + }); + } + + /** + * Reverse the migrations. + * + * @return void + */ + public function down() + { + Schema::dropIfExists('nh_invoices'); + } +} diff --git a/database/migrations/2022_01_18_160934_add_invoice_id_to_nh_health_care_sheets_table.php b/database/migrations/2022_01_18_160934_add_invoice_id_to_nh_health_care_sheets_table.php new file mode 100644 index 0000000..0911f70 --- /dev/null +++ b/database/migrations/2022_01_18_160934_add_invoice_id_to_nh_health_care_sheets_table.php @@ -0,0 +1,35 @@ +integer('invoice_id')->after('prescription_sheet_id')->nullable(); + DB::statement("ALTER TABLE nh_health_care_sheets MODIFY state + ENUM('UNDER_VALIDATION', 'ACCEPTED', 'REJECTED', 'INVOICE_ISSUED') DEFAULT 'UNDER_VALIDATION' NOT NULL;"); + }); + } + + /** + * Reverse the migrations. + * + * @return void + */ + public function down() + { + Schema::table('nh_health_care_sheets', function (Blueprint $table) { + $table->dropColumn('invoice_id'); + }); + } +} diff --git a/database/migrations/2022_01_21_162807_create_nh_infos_invoices_view.php b/database/migrations/2022_01_21_162807_create_nh_infos_invoices_view.php new file mode 100644 index 0000000..215f47d --- /dev/null +++ b/database/migrations/2022_01_21_162807_create_nh_infos_invoices_view.php @@ -0,0 +1,38 @@ + "The care sheet has been resubmitted", 'execution_carried_out' => "Execution of prescription carried out", 'consultation_or_prescription_updated' => "Consultation or prescription updated", + 'amount' => 'Amount', + 'total_amount' => 'Total Amount', + 'insured_part' => 'Insured Part', + 'total_insured_part' => 'Total Insured Part', + 'insurance_part' => 'Insurance_part', + 'total_insurance_part' => 'Total Insurance Part', + 'to' => 'to', + 'invoice' => 'Invoice', + 'provider_institution_code' => 'provider_institution_code', + 'insurance_name' => 'Insurance name', + 'institution_name' => "Institution name", + 'phone' => "Telephone", + 'transmitter' => "Transmitter", + 'recipient' => "Recipient" ]; diff --git a/resources/lang/en/states.php b/resources/lang/en/states.php index 34645ce..7ca150d 100755 --- a/resources/lang/en/states.php +++ b/resources/lang/en/states.php @@ -24,5 +24,6 @@ return [ 'LONG_TERM_AFFECTION' => "LONG TERM AFFECTION", 'EXONERATION' => "EXONERATION", 'HAVING_RIGHT' => "HAVING RIGHT", - 'INSURED' => 'INSURED' + 'INSURED' => 'INSURED', + 'INVOICE_ISSUED' => 'INVOICE ISSUED' ]; diff --git a/resources/lang/fr/messages.php b/resources/lang/fr/messages.php index e6dc951..cba8f19 100755 --- a/resources/lang/fr/messages.php +++ b/resources/lang/fr/messages.php @@ -130,4 +130,18 @@ Une nouvelle execution de prescription vient d'etre effectuée sur votre assuran Connectez-vous à l'application pour avoir plus de details et valider cette opération. ", 'consultation_or_prescription_updated' => "Consultation ou prescription mise à jour", + 'amount' => 'Montant', + 'total_amount' => 'Total Montant', + 'insured_part' => 'Part assuré', + 'total_insured_part' => 'Total Part assuré', + 'insurance_part' => 'Part assurance', + 'total_insurance_part' => 'Total Part assurance', + 'to' => 'au', + 'invoice' => 'Facture', + 'provider_institution_code' => 'Code établissement prestataire', + 'insurance_name' => 'Nom assurance', + 'institution_name' => "Nom établissement", + 'phone' => "Téléphone", + 'transmitter' => "Émetteur", + 'recipient' => "Destinataire" ]; diff --git a/resources/lang/fr/states.php b/resources/lang/fr/states.php index 0c2b54d..0d61c2e 100755 --- a/resources/lang/fr/states.php +++ b/resources/lang/fr/states.php @@ -24,5 +24,6 @@ return [ 'LONG_TERM_AFFECTION' => "AFFECTION LONGUE DURÉE", 'EXONERATION' => "EXONERATION", 'HAVING_RIGHT' => "AYANT DROIT", - 'INSURED' => 'ASSURÉ' + 'INSURED' => 'ASSURÉ', + 'INVOICE_ISSUED' => 'FACTURE ÉMISE' ]; diff --git a/resources/views/emails/invoice.blade.php b/resources/views/emails/invoice.blade.php new file mode 100755 index 0000000..2f1193e --- /dev/null +++ b/resources/views/emails/invoice.blade.php @@ -0,0 +1,437 @@ + + +
+ + + + + + + + +-------------------
+ +Le numérique au service de l'inclusion financière
+ +
+
+ {{__('messages.invoice')}} N° {{$invoice_id}}
+
{{$period}}
+
--}} + {{-- En application de la loi des finances rectificative 2009, Titre III relatives aux ressources des collectivités--}} + {{-- locales en son article 15--}} + {{-- et de la Délibération n°006/PE/DKM/CA/CM/SG du 26 juin 2014 portant prélèvement des droits et taxes sur--}} + {{-- le territoire de la Commune d’Akanda.--}} + {{--
--}} + +
+ {{__('messages.transmitter')}} + + |
+
+ {{__('messages.recipient')}} + + |
+ ||
+ {{__('messages.provider_institution_code')}} + + |
+
+ {{$agent->code_membre}} + |
+
+ {{__('messages.insurance_name')}} + |
+
+ {{$hyper->lastname}} + + |
+
+ {{__('messages.insurance_name')}} + + |
+
+ {{$agent->lastname}} + |
+ {{-- --}}
+ {{-- Quartier --}} + {{-- | --}}
+ {{-- --}}
+ {{-- | --}}
+
+ {{__('messages.phone')}} + + |
+
+ {{$agent->phone}} + |
+ {{-- --}}
+ {{-- Année N-1 {{$registration_year-1}} --}} + {{-- | --}}
+ {{-- --}}
+ {{-- | --}}
+
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- +
+ +Détail des feuilles de soins pour la période: +
+ +
+ N° Feuille + + |
+
+ Type + + |
+
+ Patient + |
+
+ Praticien + |
+
+ N° Assuré + + |
+
+ {{__('messages.amount')}} + + |
+
+ {{__('messages.insured_part')}} + + |
+
+ {{__('messages.insurance_part')}} + + |
+
+ Date + + |
+
+ {{$sheet->health_care_sheet_id}} + |
+
+ {{$sheet->type}} + |
+
+ {{$sheet->patient_lastname.' '.$sheet->patient_firstname}} + |
+
+ {{$sheet->practitioner_lastname.' '.$sheet->practitioner_firstname}} + |
+
+ {{$sheet->insurance->insured_id}} + + |
+
+ {{$fmt->format($sheet->insured_amount + $sheet->insurer_amount)}} + + |
+
+ {{$fmt->format($sheet->insured_amount)}} + + |
+
+ {{$fmt->format($sheet->insurer_amount)}} + + |
+
+ {{$sheet->date}} + + |
+
+
+ {{strtoupper(__('messages.total_amount'))}} + |
+
+ {{$amount}} + + |
+
+ {{mb_strtoupper(__('messages.total_insured_part'),'UTF-8')}} + |
+
+ {{$insured_amount}} + + |
+
+ {{strtoupper(__('messages.total_insurance_part'))}} + |
+
+ {{$insurer_amount}} + + |
+
- REPUBLIQUE GABONAISE - - ------------------- - - Union-Travail-Justice - - PROVINCE -DE L’ESTUAIRE
- --------------------
- -DEPARTEMENT DU KOMO-MONDAH
- ------------------
- -COMMUNE D’AKANDA
- ----------------
- -SECRETARIAT GENERAL
- ------------------
- -SERVICE FISCALITE ET RECOUVREMENT
- -QR CODE - {{$lastname}} -
- -- REPUBLIQUE GABONAISE - - ------------------- - - Union-Travail-Justice - - PROVINCE -DE L’ESTUAIRE
- --------------------
- -DEPARTEMENT DU KOMO-MONDAH
- ------------------
- -COMMUNE D’AKANDA
- ----------------
- -SECRETARIAT GENERAL
- ------------------
- -SERVICE FISCALITE ET RECOUVREMENT
- -AVIS -DE RECOUVREMENT N° {{$id_tax_notice}}
- -- En application de la loi des finances rectificative 2009, Titre III relatives aux ressources des collectivités - locales en son article 15 - et de la Délibération n°006/PE/DKM/CA/CM/SG du 26 juin 2014 portant prélèvement des droits et taxes sur - le territoire de la Commune d’Akanda. -
- - -Il est établi un avis de recouvrement relatif à vos activités ci-après défini : -
- - -
- Opérateur - économique d’Akanda - |
-
- Administration - Municipale - |
- ||
- Nom/Identifiant - OPEC - |
-
- {{$lastname}} - |
-
- Arrondissement - |
-
- {{$district}} - - |
-
- Non du - Responsable - |
-
- {{$responsable_name}} - |
-
- Quartier - |
-
- {{$neighborhood}} - - |
-
- N° RCCM - - |
-
- {{$trade_registry}} - |
-
- Activité - |
-
- {{$activity_type}} - - |
-
- NIF - - |
-
- {{$identification_number}} - |
-
- Année N-1 {{$registration_year-1}} - |
-
- {{ $year_tax_paid_N_1 ? 'Payé' : 'Non Payé' }} - - |
-
- Patente - - |
-
- {{ isset($id_patente) ? 'N° '.$id_patente : 'Non' }} - |
-
- Année N-2 {{$registration_year-2}} - |
-
- {{ $year_tax_paid_N_2 ? 'Payé' : 'Non Payé' }} - - |
-
- Agrément - - |
-
- {{ isset($technical_approval) ? 'N° '.$technical_approval : 'Non' }} - |
-
- Année N-3 {{$registration_year-3}} - |
-
- {{ $year_tax_paid_N_3 ? 'Payé' : 'Non Payé' }} - - |
-
- TVA - - |
-
- {{ $TVA ? 'Oui' : 'Non' }} - |
-
- - |
-
- - - |
-
- IRPP - - |
-
- {{ $IRPP ? 'Oui' : 'Non' }} - |
-
- - |
-
- - - |
-
- Localisation - - |
-
- N_____E_____O_____S_____ - |
-
- - |
-
- - - |
-
- {{ $adresse }} - |
-
- Pénalité d’office - |
-
- {{$office_penalties}} - - |
- |
- Contact(s) - - |
-
- {{$phone}} - |
-
- Pénalités par mois de retard - |
-
- {{$month_delay_penalties}} - - |
-
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- -
- -
- Imputation - - |
-
- Libellé - taxe(s) ou redevance(s) - |
-
- Unité - - |
-
- Qté - - |
-
- Prix - Unitaire - |
-
- Total - - |
-
- {{$tax->imputation}} - |
-
- {{$tax->name}} - |
-
- {{$unit}} - - |
-
- {{$quantity}} - - |
-
- {{$unit_price}} - - |
-
- {{$tax_amount}} - - |
-
- @if(isset($penalties) and sizeof($penalties) > 0) -
- Imputation - - |
-
- Libellé pénalité(s) - - |
-
- Unité - - |
-
- Qté - - |
-
- Prix - Unitaire - |
-
- Taux - |
-
- Total - - |
-
- {{$penalty->imputation}} - |
-
- {{$penalty->name}} - |
-
-
- {{$penalty->n_order == 2 ? $penalty->unit : ''}} - - |
-
- {{$penalty->n_order == 2 ? $penalty->quantity : ''}} - - |
-
- {{$penalty->n_order == 2 ? $fmt->format($penalty->unit_price_no_formatted) : ''}} - - |
-
- {{$penalty->n_order == 1 ?$penalty->rate.'%' : ''}} - - |
-
- {{$penalty->n_order == 1 ? $fmt->format($penalty->amount) : $fmt->format($penalty->tax_amount)}} - - |
-
- @endif -
- TOTAL A PAYER - |
-
- {{$amount}} - - |
-
- -
- -
Arrêté le présent avis à la -somme de {{$amount}}
- -Date limite de paiement : {{$payment_deadline_date}}
- -- -
Les règlements s’effectuent à la Perception Municipale d’Okala -sur présentation d’un(es) ordre(s) de recette(s) préalablement établi(s) au -Service Finances et Comptabilité à l’Hôtel de Ville de la Mairie d’Akanda (heures -d’ouverture de 09H-15H). En cas de règlement par chèque (CERTIFIE), le -libeller au nom du Receveur municipale.
- -- -
Toute infraction aux -dispositions de la présente délibération entraine l’application des sanctions -prévues au code des impôts relatives à l’application des pénalités :
- -- -
- -Pénalité d’office de {{$officePenaltyPercent ?? 10}} % des droits éludés passé le délai de -paiement ;
- -- -{{$monthDelayPenaltyPercent ?? 3}} % par mois de retard ;
- -- -Enfin, en cas de contestation ou de réclamation, vous munir des -pièces justificatives.
- -- -
- -
_____________________________________________________________________________________________________________________ -
-Service Comptabilité, Fiscalité et recouvrement I Mairie d’Akanda-Hôtel de Ville
-Contacts : +241 00 000 000 0 / +241 002 6660 50
-