radiantassure/Vue/Ajaxfactures/index.php
2025-12-07 09:35:13 +00:00

250 lines
14 KiB
PHP
Executable File

<div id="div_dossiers">
<!-- Tableau desktop (affiché sur les écrans moyens et grands) -->
<div class="card-header bg-light py-3 d-flex justify-content-between align-items-center">
<h5 class="mb-0 text-dark"><i class="fas fa-list me-2"></i><?= _("Liste des factures")?></h5>
<span class="badge bg-secondary" id="counter"><?= format_N(count($factures)).' '._("factures") ?> </span>
</div>
<div class="d-none d-md-block">
<div class="table-responsive">
<table class="table table-striped table-bordered table-hover" style="font-size:0.85rem;">
<thead class="table-dark">
<tr>
<th style='text-align:center' data-priority="1">Type</th>
<th style='text-align:center' data-priority="2"><?= _("N° Bon") ?></th>
<th style='text-align:center' data-priority="1"><?= _("Id Fact") ?></th>
<th style='text-align:center' data-priority="2">Date</th>
<th><?= _("Prestataire") ?></th>
<th style='text-align:center' data-hide="phone"><?= _("Frais") ?></th>
<th style='text-align:center' data-hide="phone"><?= _("T M") ?></th>
<th style='text-align:center' data-hide="phone"><?= _("A Rmb") ?></th>
<th style='text-align:center' data-hide="phone"><?= _("Dépas.") ?></th>
<th style='text-align:center' data-hide="phone"><?= _("Ret.") ?></th>
<th style='text-align:center'>TP</th>
<th style='text-align:center' data-priority="3"><?= _("Remb.") ?></th>
</tr>
</thead>
<tbody>
<?php foreach ($factures as $facture):
$idFacture = $this->nettoyer($facture['idFacture']);
$numeroFeuilleMaladie = $this->nettoyer($facture['numeroFeuilleMaladie']);
$tiersPayant = $facture['tiersPayant'];
$codeTypeFacture = $this->nettoyer($facture['codeTypeFacture']);
$numeroBon = $this->nettoyer($facture['numeroBonConsultation']);
if($codeTypeFacture=="PHAR") {
$numeroBon = $this->nettoyer($facture['numeroBonOrdonnance']);
} elseif($codeTypeFacture=="OPT") {
$numeroBon = $this->nettoyer($facture['numeroBonOptique']);
} elseif($codeTypeFacture=="LAB") {
$numeroBon = $this->nettoyer($facture['numeroBonExamen']);
} elseif($codeTypeFacture=="SEA") {
$numeroBon = $this->nettoyer($facture['numeroBonKine']);
}
?>
<tr>
<td align='center' data-label="Type"><?= $codeTypeFacture ?></td>
<td align='center' data-label="N° Bon"><?= $numeroBon ?></td>
<td align='center' data-label="Id Fact">
<button class="btn btn-info btn-sm w-100"
onClick="javascript:consulter_facture_pop('<?= $idFacture ?>');">
<?= $idFacture ?>
</button>
</td>
<td align='center' data-label="Date">
<?= dateheureFr($this->nettoyer($facture['dateSysteme'])) ?>
</td>
<td data-label="Prestataire">
<?= $this->nettoyer($facture['prestataire']) ?>
</td>
<td align='center' data-label="Frais" class="d-none d-md-table-cell">
<?= format_N($this->nettoyer($facture['fraisReel'])) ?>
</td>
<td align='center' data-label="T M" class="d-none d-md-table-cell">
<?= format_N($this->nettoyer($facture['montantTm'])) ?>
</td>
<td align='center' data-label="A Rembourser" class="d-none d-md-table-cell">
<?= format_N($this->nettoyer($facture['montantArembourser'])) ?>
</td>
<td align='center' data-label="Dépassement" class="d-none d-md-table-cell">
<?= format_N($this->nettoyer($facture['fraisExclu'])) ?>
</td>
<td align='center' data-label="Retenu" class="d-none d-md-table-cell">
<?= format_N($this->nettoyer($facture['fraisRetenu'])) ?>
</td>
<td align='center' data-label="Tiers payant">
<?php if ($tiersPayant=="1"): ?>
<i class="bi bi-check-circle-fill text-success" title="<?= _("Tiers payant")?>"></i>
<?php else: ?>
<i class="bi bi-x-circle-fill text-secondary" title="<?= _("Sans tiers payant")?>"></i>
<?php endif; ?>
</td>
<td align='center' data-label="Remboursement">
<?= format_N($this->nettoyer($facture['montantRembourse'])) ?>
</td>
</tr>
<?php endforeach; ?>
</tbody>
</table>
</div>
</div>
<!-- Affichage mobile (cartes) -->
<div class="d-md-none">
<?php foreach ($factures as $facture):
$idFacture = $this->nettoyer($facture['idFacture']);
$numeroFeuilleMaladie = $this->nettoyer($facture['numeroFeuilleMaladie']);
$tiersPayant = $facture['tiersPayant'];
$codeTypeFacture = $this->nettoyer($facture['codeTypeFacture']);
$numeroBon = $this->nettoyer($facture['numeroBonConsultation']);
if($codeTypeFacture=="PHAR") {
$numeroBon = $this->nettoyer($facture['numeroBonOrdonnance']);
} elseif($codeTypeFacture=="OPT") {
$numeroBon = $this->nettoyer($facture['numeroBonOptique']);
} elseif($codeTypeFacture=="LAB") {
$numeroBon = $this->nettoyer($facture['numeroBonExamen']);
} elseif($codeTypeFacture=="SEA") {
$numeroBon = $this->nettoyer($facture['numeroBonKine']);
}
// Déterminer le libellé du type de facture
$libelleType = $codeTypeFacture;
switch($codeTypeFacture) {
case "PHAR": $libelleType = "Pharmacie"; break;
case "OPT": $libelleType = "Optique"; break;
case "LAB": $libelleType = "Laboratoire"; break;
case "SEA": $libelleType = "Kinésithérapie"; break;
default: $libelleType = $codeTypeFacture;
}
?>
<div class="card mb-3 shadow-sm">
<div class="card-header bg-light d-flex justify-content-between align-items-center py-2">
<div>
<span class="badge bg-primary me-2"><?= $libelleType ?></span>
<strong style="font-size:1.8rem !important;"><?= $numeroBon ?></strong>
</div>
<small class="text-muted"><?= dateheureLang($this->nettoyer($facture['dateSysteme']), $_SESSION['lang']) ?></small>
</div>
<div class="card-body py-2">
<!-- Informations principales -->
<div class="row mb-2">
<div class="col-12 mb-2">
<div class="d-flex justify-content-between align-items-center">
<span class="text-muted small"><?= _("Prestataire") ?></span>
<span class="text-end"><?= $this->nettoyer($facture['prestataire']) ?></span>
</div>
</div>
<div class="col-6">
<div class="d-flex justify-content-between align-items-center">
<span class="text-muted small"><?= _("Frais") ?></span>
<span class="fw-bold"><?= format_N($this->nettoyer($facture['fraisReel'])) ?></span>
</div>
</div>
<div class="col-6">
<div class="d-flex justify-content-between align-items-center">
<span class="text-muted small"><?= _("Rembourser") ?></span>
<span class="fw-bold text-success"><?= format_N($this->nettoyer($facture['montantRembourse'])) ?></span>
</div>
</div>
</div>
<!-- Informations secondaires -->
<div class="row mb-2">
<div class="col-6">
<div class="d-flex justify-content-between align-items-center">
<span class="text-muted small"><?= _("Tiers payant") ?></span>
<?php if ($tiersPayant=="1"): ?>
<i class="bi bi-check-circle-fill text-success" title="<?= _("Tiers payant")?>"></i>
<?php else: ?>
<i class="bi bi-x-circle-fill text-secondary" title="<?= _("Sans tiers payant")?>"></i>
<?php endif; ?>
</div>
</div>
<div class="col-6">
<div class="d-flex justify-content-between align-items-center">
<span class="text-muted small"><?= _("Id Facture") ?></span>
<button class="btn btn-info btn-sm py-0 px-2"
onClick="javascript:consulter_facture_pop('<?= $idFacture ?>');"
style="font-size: 1.8rem !important;">
<?= substr($idFacture, 0, 8) ?>...
</button>
</div>
</div>
</div>
<!-- Détails supplémentaires (accordéon) -->
<div class="accordion" id="accordionFacture<?= $idFacture ?>">
<div class="accordion-item border-0">
<h2 class="accordion-header" id="heading<?= $idFacture ?>">
<button class="accordion-button collapsed py-1" type="button" data-bs-toggle="collapse"
data-bs-target="#collapse<?= $idFacture ?>" aria-expanded="false"
aria-controls="collapse<?= $idFacture ?>" style="font-size: 1.5rem !important;">
<i class="bi bi-chevron-down me-2"></i><?= _("Plus de détails...") ?>
</button>
</h2>
<div id="collapse<?= $idFacture ?>" class="accordion-collapse collapse"
aria-labelledby="heading<?= $idFacture ?>" data-bs-parent="#accordionFacture<?= $idFacture ?>">
<div class="accordion-body p-2">
<div class="row">
<div class="col-6 mb-1">
<div class="d-flex justify-content-between">
<span class="text-muted small"><?= _("Montant TM") ?></span>
<span class="fw-bold text-success"><?= format_N($this->nettoyer($facture['montantTm'])) ?></span>
</div>
</div>
<div class="col-6 mb-1">
<div class="d-flex justify-content-between">
<span class="text-muted small"><?= _("A Rembourser") ?></span>
<span class="fw-bold"><?= format_N($this->nettoyer($facture['montantArembourser'])) ?></span>
</div>
</div>
<div class="col-6 mb-1">
<div class="d-flex justify-content-between">
<span class="text-muted small"><?= _("Dépassement") ?></span>
<span class="fw-bold text-danger"><?= format_N($this->nettoyer($facture['fraisExclu'])) ?></span>
</div>
</div>
<div class="col-6 mb-1">
<div class="d-flex justify-content-between">
<span class="text-muted small"><?= _("Retenu") ?></span>
<span class="fw-bold"><?= format_N($this->nettoyer($facture['fraisRetenu'])) ?></span>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<?php endforeach; ?>
<?php if (empty($factures)): ?>
<div class="alert alert-info text-center">
<small>
<i class="bi bi-info-circle me-2"></i>
<?= _("Aucune facture trouvée pour cette période") ?>
</small>
</div>
<?php endif; ?>
</div>
</div>