prestation/Vue/Ajaxdetailpharmacie/index.php
2025-12-05 10:42:46 +00:00

419 lines
21 KiB
PHP
Executable File

<?php
$nbMedicament = $prescription['nbMedicament'];
$nbRestantALivrer = $prescription['nbRestantALivrer'];
$prixMedicamentModifiable = $prescription['prixMedicamentModifiable'];
$interdirVentePartielleMedicament = $prescription['interdirVentePartielleMedicament'];
?>
<div id="livraison">
<input class="sr-only" type="text" id="margePrixMedicament" name="margePrixMedicament" value="<?= $this->nettoyer($marges['margePrixMedicament']) ?>">
<input class="sr-only" type="text" id="appliquerMargePrixMedicament" name="appliquerMargePrixMedicament" value="<?= $this->nettoyer($marges['appliquerMargePrixMedicament']) ?>">
<input class="sr-only" type="text" id="devise" name="devise" value="<?= $_SESSION['p_devise_C'] ?>">
<div id="div_statutacte">
</div>
<div id="div_messages">
</div>
<div id="non_livre">
<div id="recap">
<table class="table table-responsive table-condensed" style='font-size:12pt;' >
<tbody>
<tr>
<td align="center"> <?= _("Réclamé") ?> </td>
<td > <INPUT class="form-control" TYPE="text" value="<?= format_N($prescription['fraisReelLivre']) ?>" readonly style="text-align: center; font-size:14pt; font-weight:bold; background-color:#5f9ea0 !important; color:white;"> </td>
<td align="center" width="13%"> <?= _("Part Assuré") ?> </td>
<td > <INPUT class="form-control" TYPE="text" value="<?= format_N($prescription['montantTmLivre']+$prescription['depassement']) ?>" readonly style="text-align: center; font-size:14pt; font-weight:bold; background-color:#ba74d4 !important; color:white;"> </td>
<td align="center" > <?= _("A Rembourser") ?> </td>
<td > <INPUT class="form-control" TYPE="text" value="<?= format_N($prescription['montantArembourserLivre']) ?>" readonly style="text-align: center; font-size:14pt; font-weight:bold; background-color:rgba(255, 0, 127) !important; color:white;"> </td>
</tr>
</tbody>
</table>
</div>
<table class="table table-striped table-bordered table-hover table-condensed table-responsive" style='font-size:9pt;'>
<thead>
<tr>
<th rowspan="2" width="5%" style="text-align:center" > <input class="form-control btn btn-primary" type="button" value=" + + " onClick="javascript:ajoutermedicament_tous();" style='font-size:10pt;' > </th>
<th colspan="2" width="40%" style="text-align:center"> <?= _("Médicaments non livrés") ?> </th>
<th rowspan="2" width="5%" style="text-align:center"> <?= _("Forme") ?> </th>
<th rowspan="2" width="10%" style="text-align:center"> <?= _("Prix Unitaire") ?> </th>
<th colspan="3" width="5%" style="text-align:center"> <?= _("Quantité") ?> </th>
<th rowspan="2" width="10%" style="text-align:center"> <?= _("Prix Total") ?> </th>
<th rowspan="2" width="5%" style="text-align:center"> <?= _("T M") ?> </th>
<th rowspan="2" width="10%" style="text-align:center"> <?= _("A Remb") ?> </th>
<th rowspan="2" width="10%" style="text-align:center"> <?= _("Dépass") ?> </th>
</tr>
<tr>
<th width="20%" style="text-align:center"> <?= _("Prescrits") ?> </th>
<th width="20%" style="text-align:center"> <?= _("Substitution") ?> </th>
<th width="5%" style="text-align:center"> <?= _("Prescrite") ?> </th>
<th width="5%" style="text-align:center"> <?= _("Servie") ?> </th>
<th width="5%" style="text-align:center"> <?= _("Restante") ?> </th>
</tr>
</thead>
<tbody>
<?php
$i = 0;
foreach ($detailnonlivres as $detailnonlivre):
$idNonLivre=$this->nettoyer($detailnonlivre['id']);
$valeurActe = $this->nettoyer($detailnonlivre['valeurActe']);
$ententePrealable2=$this->nettoyer($detailnonlivre['ententePrealable']);
$forme = $this->nettoyer($detailnonlivre['forme']);
if (est_anglophone()){$forme = $this->nettoyer($detailnonlivre['formeEng']);}
$exclu = $this->nettoyer($detailnonlivre['exclu']);
$substituable = $this->nettoyer($detailnonlivre['substituable']);
$substitue = $this->nettoyer($detailnonlivre['substitue']);
$nomSubstitut = $this->nettoyer($detailnonlivre['nomSubstitut']);
$libelleMedicament = $this->nettoyer($detailnonlivre['libelleMedicament']);
if($substituable=="1")
{
$libelleMedicament = $libelleMedicament . " <=> " . $nomSubstitut;
}
$quantiteRestante = $this->nettoyer($detailnonlivre['quantiteRestante']);
$codeMedicament = $this->nettoyer($detailnonlivre['codeMedicament']);
$substitution = $this->nettoyer($detailnonlivre['substitution']);
$codeMedicamentSubstitut = $this->nettoyer($detailnonlivre['codeMedicamentSubstitut']);
$libelleMedicamentSubstitut = $this->nettoyer($detailnonlivre['libelleMedicamentSubstitut']);
$valeurMedicamentSubstitut = $this->nettoyer($detailnonlivre['valeurMedicamentSubstitut']);
$fraisReelMedicamentSubstitut = $this->nettoyer($detailnonlivre['fraisReelMedicamentSubstitut']);
$montantTmMedicamentSubstitut = $this->nettoyer($detailnonlivre['montantTmMedicamentSubstitut']);
$montantArembourserMedicamentSubstitut = $this->nettoyer($detailnonlivre['montantArembourserMedicamentSubstitut']);
$fraisExcluMedicamentSubstitut = $this->nettoyer($detailnonlivre['fraisExcluMedicamentSubstitut']);
$fraisRetenuMedicamentSubstitut = $this->nettoyer($detailnonlivre['fraisRetenuMedicamentSubstitut']);
$excluMedicamentSubstitut = $this->nettoyer($detailnonlivre['excluMedicamentSubstitut']);
$ententePrealableMedicamentSubstitut = $this->nettoyer($detailnonlivre['ententePrealableMedicamentSubstitut']);
$valeurActe = ($substitution=="1") ? $valeurMedicamentSubstitut : $this->nettoyer($detailnonlivre['valeurActe']);
$fraisReel = ($substitution=="1") ? $fraisReelMedicamentSubstitut : $this->nettoyer($detailnonlivre['fraisReel']);
$montantTm = ($substitution=="1") ? $montantTmMedicamentSubstitut : $this->nettoyer($detailnonlivre['montantTm']);
$montantArembourser = ($substitution=="1") ? $montantArembourserMedicamentSubstitut : $this->nettoyer($detailnonlivre['montantArembourser']);
$ententePrealable2 = ($substitution=="1") ? $ententePrealableMedicamentSubstitut : $this->nettoyer($detailnonlivre['ententePrealable']);
$i++;
?>
<?php if($ententePrealable2=='2' || $ententePrealable2=='3'): ?>
<tr valign="top" style="background-color: yellow;">
<?php elseif($ententePrealable2=='1'): ?>
<tr valign="top" style="background-color: #00ff00;">
<?php elseif($ententePrealable2=='9' || $exclu=="1"): ?>
<tr valign="top" style="background-color: red;color:white;">
<?php else: ?>
<tr valign="top">
<?php endif; ?>
<?php if($valeurActe=="0") : ?>
<td width="5%" align='center'> </td>
<?php else: ?>
<?php if($ententePrealable2=='2'): ?>
<td width="5%" align='center'> <input type="button" value=" ? " onClick="javascript:demander_accord_pha_cso('<?= $idNonLivre ?>');" ></td>
<?php elseif($ententePrealable2=='3'): ?>
<td width="5%" align='center'> W </td>
<?php elseif($ententePrealable2=='9'): ?>
<td width="5%" align='center'> R </td>
<?php else: ?>
<td width="5%" align='center'> <input type="button" value=" + " onClick="javascript:ajoutermedicament('<?= $idNonLivre ?>');" ></td>
<?php endif; ?>
<?php endif; ?>
<?php if($substituable=="1") : ?>
<td style="background-color: yellow;"> <?= $libelleMedicament ?> </td>
<td>
<input id="searchInput<?= $i ?>" style="font-size:7pt;" class="form-control recherche" type="text" value="<?= $libelleMedicamentSubstitut ?>" placeholder="Recherche..."
onkeyup="javascript:listemedicamentsubstitue(<?= $i; ?>,<?= $quantiteRestante; ?>,<?= $_SESSION['p_tm_C']; ?>,'<?= $codeMedicament; ?>');" >
<div id="div_selection<?= $i ?>" class="div_selection_list">
</div>
</td>
<?php else: ?>
<td> <?= $libelleMedicament ?> </td>
<td>
<input id="searchInput<?= $i ?>" style="font-size:7pt;" class="form-control recherche" type="text" value="<?= $libelleMedicamentSubstitut ?>" placeholder="Recherche..."
onkeyup="javascript:listemedicamentsubstitue(<?= $i; ?>,<?= $quantiteRestante; ?>,<?= $_SESSION['p_tm_C']; ?>,'<?= $codeMedicament; ?>');" >
<div id="div_selection<?= $i ?>" class="div_selection_list">
</div>
</td>
<?php endif; ?>
<td align='center'> <?= $forme ?> </td>
<td align='center'>
<INPUT class="form-control" id="valeurActe<?= $i ?>" style="text-align: center; font-size:7pt;" TYPE="text" value="<?= format_N($this->nettoyer($detailnonlivre['valeurActe'])) ?>" readonly > </td>
</td>
<td align='center'> <?= $this->nettoyer($detailnonlivre['quantitePrescrite']) ?> </td>
<td align='center'> <?= $this->nettoyer($detailnonlivre['quantiteLivree']) ?> </td>
<td align='center'> <?= $quantiteRestante ?> </td>
<td align='center'>
<INPUT class="form-control" id="fraisReel<?= $i ?>" style="text-align: center; font-size:7pt;" TYPE="text" value="<?= format_N($this->nettoyer($detailnonlivre['fraisReel'])) ?>" readonly > </td>
</td>
<td align='center'>
<INPUT class="form-control" id="montantTm<?= $i ?>" style="text-align: center; font-size:7pt;" TYPE="text" value="<?= format_N($this->nettoyer($detailnonlivre['montantTm'])) ?>" readonly > </td>
</td>
<td align='center'>
<INPUT class="form-control" id="montantArembourser<?= $i ?>" style="text-align: center; font-size:7pt;" TYPE="text" value="<?= format_N($this->nettoyer($detailnonlivre['montantArembourser'])) ?>" readonly > </td>
</td>
<td align='center'>
<INPUT class="form-control" id="fraisExclu<?= $i ?>" style="text-align: center; font-size:7pt;" TYPE="text" value="<?= format_N($this->nettoyer($detailnonlivre['fraisExclu'])) ?>" readonly > </td>
</td>
</tr>
<?php endforeach; ?>
</tbody>
</table>
</div>
<div id="livre">
<?php $nbLivre = 0; ?>
<table class="table table-striped table-bordered table-hover table-condensed table-responsive" style='font-size:9pt;'>
<thead>
<tr>
<?php if($factures_toal['fraisReel'] == "0") : ?>
<th rowspan="2" width="5%" style="text-align:center" > <input class="form-control btn btn-primary" type="button" value=" - - " onClick="javascript:retirermedicament_pha_tous();" style='font-size:9pt;' > </th>
<th rowspan="2" width="40%" > <?= _("Médicaments à livrer") ?> </th>
<?php else: ?>
<th rowspan="2" width="40%" > <?= _("Médicaments livrés") ?> </th>
<?php endif; ?>
<th rowspan="2" width="5%" style="text-align:center"> <?= _("Forme") ?> </th>
<th rowspan="2" width="10%" style="text-align:center"> <?= _("Prix Unitaire") ?> </th>
<th colspan="3" width="5%" style="text-align:center"> <?= _("Quantité") ?> </th>
<th rowspan="2" width="10%" style="text-align:center"> <?= _("Prix Total") ?> </th>
<th rowspan="2" width="5%" style="text-align:center"> <?= _("T M") ?> </th>
<th rowspan="2" width="10%" style="text-align:center"> <?= _("A Remb") ?> </th>
<th rowspan="2" width="10%" style="text-align:center"> <?= _("Dépass") ?> </th>
<th rowspan="2" style="text-align:center"> <?= _("Motif") ?> </th>
</tr>
<tr>
<th width="5%" style="text-align:center"> <?= _("Prescrite") ?> </th>
<th width="5%" style="text-align:center"> <?= _("Servie") ?> </th>
<th width="5%" style="text-align:center"> <?= _("Restante") ?> </th>
</tr>
</thead>
<tfoot>
<tr>
<?php if($factures_toal['fraisReel'] == "0") : ?>
<td colspan="7" style='text-align:center'> Total </td>
<?php else: ?>
<td colspan="6" style='text-align:center'> Total </td>
<?php endif; ?>
<td align='center'><?= format_N($this->nettoyer($prescription['fraisReelLivre'])) ?></td>
<td align='center'><?= format_N($this->nettoyer($prescription['montantTmLivre'])) ?></td>
<td align='center'><?= format_N($this->nettoyer($prescription['montantArembourserLivre'])) ?></td>
<td align='center'><?= format_N($this->nettoyer($prescription['depassement'])) ?></td>
<td > </td>
</tr>
</tfoot>
<?php
$gar_codePeriodicite;
$gar_periodicite;
$gar_periodiciteEng;
$act_codePeriodicite;
$act_periodicite;
$act_periodiciteEng;
$gar_nbreTransaction;
$act_nbreTransaction;
?>
<tbody>
<?php
$i = 0;
$quantiteTotalLivree = 0;
foreach ($detaillivres as $detaillivre):
$idLivre=$this->nettoyer($detaillivre['id']);
$ententePrealable3=$this->nettoyer($detaillivre['ententePrealable']);
$nbLivre++;
$forme = $this->nettoyer($detaillivre['forme']);
$formeSubstitut = $this->nettoyer($detaillivre['formeSubstitut']);
$tarifPublic = $this->nettoyer($detaillivre['tarifPublic']);
$exclu = $this->nettoyer($detaillivre['exclu']);
$valeurActeManuel = $this->nettoyer($detaillivre['valeurActeManuel']);
$valeurActe = $this->nettoyer($detaillivre['valeurActe']);
if($valeurActeManuel>"0"){
$valeurActe = $valeurActeManuel;
}
$prixManuel = $this->nettoyer($detaillivre['prixManuel']);
$fraisReel = $this->nettoyer($detaillivre['fraisReel']);
$montantTm = $this->nettoyer($detaillivre['montantTm']);
$montantArembourser = $this->nettoyer($detaillivre['montantArembourser']);
if($valeurActeManuel>"0"){
$fraisReel = $prixManuel;
$montantTm = $this->nettoyer($detaillivre['montantTmTemp']);
$montantArembourser = $this->nettoyer($detaillivre['montantArembourserTemp']);
}
$codeMotifDepassement = $this->nettoyer($detaillivre['codeMotifDepassement']);
$motif = $this->nettoyer($detaillivre['motif']);
if (est_anglophone()){
$forme = $this->nettoyer($detaillivre['formeEng']);
$motif = $this->nettoyer($detaillivre['motifEng']);
$gar_periodicitePlafond = $gar_periodicitePlafondEng;
$act_periodicitePlafond = $act_periodicitePlafondEng;
$formeSubstitut = $this->nettoyer($detaillivre['formeSubstitutEng']);
}
if($gar_codePeriodicitePlafond=="L" && $codeMotifDepassement=="PLF")
{
$motif = $motif." ".$gar_forfaitPlafond." ".$_SESSION['p_devise_C']." ".strtolower($gar_periodicitePlafond).".";
}elseif($act_codePeriodicitePlafond=="L" && $codeMotifDepassement=="PLF")
{
$motif = $motif." ".$act_forfaitPlafond." ".$_SESSION['p_devise_C']." ".strtolower($act_periodicitePlafond).".";
}else{
$motif = $motif;
}
$quantitePrescrite = $this->nettoyer($detaillivre['quantitePrescrite']);
$quantiteLivree = $this->nettoyer($detaillivre['quantiteLivree']);
$quantiteRestanteInitiale = $this->nettoyer($detaillivre['quantiteRestanteInitiale']);
$quantite = $this->nettoyer($detaillivre['quantite']);
$quantiteTotalLivree = $quantiteTotalLivree + $quantiteLivree;
$substituable = $this->nettoyer($detaillivre['substituable']);
$substitue = $this->nettoyer($detaillivre['substitue']);
$ajPharmacie = $this->nettoyer($detaillivre['ajPharmacie']);
$typeSysteme = $this->nettoyer($detaillivre['typeSysteme']);
$pharmacieInterne = $this->nettoyer($detaillivre['pharmacieInterne']);
$substitution = $this->nettoyer($detaillivre['substitution']);
$codeMedicamentSubstitut = $this->nettoyer($detaillivre['codeMedicamentSubstitut']);
$libelleMedicamentSubstitut = $this->nettoyer($detaillivre['libelleMedicamentSubstitut']);
$valeurMedicamentSubstitut = $this->nettoyer($detaillivre['valeurMedicamentSubstitut']);
$fraisReelMedicamentSubstitut = $this->nettoyer($detaillivre['fraisReelMedicamentSubstitut']);
$montantTmMedicamentSubstitut = $this->nettoyer($detaillivre['montantTmMedicamentSubstitut']);
$montantArembourserMedicamentSubstitut = $this->nettoyer($detaillivre['montantArembourserMedicamentSubstitut']);
$fraisExcluMedicamentSubstitut = $this->nettoyer($detaillivre['fraisExcluMedicamentSubstitut']);
$fraisRetenuMedicamentSubstitut = $this->nettoyer($detaillivre['fraisRetenuMedicamentSubstitut']);
$excluMedicamentSubstitut = $this->nettoyer($detaillivre['excluMedicamentSubstitut']);
$ententePrealableMedicamentSubstitut = $this->nettoyer($detaillivre['ententePrealableMedicamentSubstitut']);
$libelleMedicament = $this->nettoyer($detaillivre['libelleMedicament']);
$quantiteRestante = $this->nettoyer($detaillivre['quantiteRestante']);
$codeMedicament = ($substitution=="1") ? $codeMedicamentSubstitut : $this->nettoyer($detaillivre['codeMedicament']);
$forme = ($substitution=="1") ? $formeSubstitut : $forme;
$libelleMedicament = ($substitution=="1") ? $libelleMedicament." => <span style='color:red;'> ".$libelleMedicamentSubstitut."</span>" : $libelleMedicament;
$valeurActe = ($substitution=="1") ? $valeurMedicamentSubstitut : $this->nettoyer($detaillivre['valeurActe']);
$fraisReel = ($substitution=="1") ? $fraisReelMedicamentSubstitut : $this->nettoyer($detaillivre['fraisReel']);
$montantTm = ($substitution=="1") ? $montantTmMedicamentSubstitut : $this->nettoyer($detaillivre['montantTm']);
$montantArembourser = ($substitution=="1") ? $montantArembourserMedicamentSubstitut : $this->nettoyer($detaillivre['montantArembourser']);
$ententePrealable3 = ($substitution=="1") ? $ententePrealableMedicamentSubstitut : $this->nettoyer($detaillivre['ententePrealable']);
$nbLivre++;
$i++;
?>
<?php if($ententePrealable3=='2' || $ententePrealable3=='3'): ?>
<tr valign="top" style="background-color: yellow;">
<?php elseif($ententePrealable3=='1'): ?>
<tr valign="top" style="background-color: #00ff00;">
<?php elseif($ententePrealable3=='9' || $exclu=="1"): ?>
<tr valign="top" style="background-color: red;color:white;">
<?php else: ?>
<tr valign="top">
<?php endif; ?>
<?php if($factures_toal['fraisReel'] == "0") : ?>
<td align='center'> <input type="button" value=" - " onClick="javascript:retirermedicament('<?= $idLivre ?>');"></td>
<td> <?= $libelleMedicament ?> </td>
<?php else: ?>
<td> <?= $libelleMedicament ?> </td>
<?php endif; ?>
<td align='center'> <?= $forme ?> </td>
<td align='center'>
<?php if($factures_toal['fraisReel'] == "0" && $prixMedicamentModifiable=='1'): ?>
<INPUT style='text-align:center; font-size:9pt;' id="valeurActeManuel<?=$nbLivre?>" class="form-control" TYPE="text" value="<?= format_N($valeurActe); ?>"
onChange="ajax_maj_prix_medicament_cso('<?=$idLivre?>', '<?=$tarifPublic?>', this.value, this);" onBlur="formatMonetaire(this);" onFocus="formatNumerique(this)" onkeyup="controle_numerique(this);">
<?php else: ?>
<?= format_N($valeurActe); ?>
<?php endif; ?>
</td>
<td align='center'> <?= $quantitePrescrite ?> </td>
<?php if($factures_toal['fraisReel'] == "0" && $quantitePrescrite > "1" && $interdirVentePartielleMedicament=="0") : ?>
<td align='center'>
<INPUT style='text-align:center; font-size:9pt;' class="form-control" TYPE="text" value="<?= $this->nettoyer($detaillivre['quantite']) ?>"
onBlur="ajax_maj_qte_medicament_cso('<?=$idLivre?>', this.value, this,<?=$quantiteRestante?>,<?=$i?>, <?=$quantiteRestanteInitiale?>);">
</td>
<?php else: ?>
<td align='center'> <?= $this->nettoyer($detaillivre['quantiteRestante']) ?> </td>
<?php endif; ?>
<td align='center'> <?= $this->nettoyer($detaillivre['quantiteRestante']) ?> </td>
<td align='center'> <?= format_N($this->nettoyer($fraisReel)) ?> </td>
<td align='center'> <?= format_N($this->nettoyer($montantTm)) ?> </td>
<td align='center'> <?= format_N($this->nettoyer($montantArembourser)) ?> </td>
<td align='center'> <?= format_N($this->nettoyer($detaillivre['depassement'])) ?> </td>
<?php if($codeMotifDepassement!=''): ?>
<td align='center'>
<button type="button" class="btn btn-info" title="Voir le motif du dépassement..." onClick='javascript:alert_ebene("<?= $motif ?>","<?= $motif ?>");'>
<?= $codeMotifDepassement ?>
</button>
</td>
<?php else: ?>
<td > </td>
<?php endif; ?>
</tr>
<?php endforeach; ?>
<tr style='background-color:white'>
<td colspan="11" height="5"></td>
</tr>
</tbody>
</table>
<input class="sr-only" type="text" id="nbLivre" name="nbLivre" value="<?= $nbLivre ?>" >
<input class="sr-only" type="text" id="quantiteTotalLivree" name="quantiteTotalLivree" value="<?= $quantiteTotalLivree ?>" >
<input class="sr-only" type="text" id="interdirVentePartielleMedicament" name="interdirVentePartielleMedicament" value="<?= $interdirVentePartielleMedicament ?>" >
</div>
<div id="div_fraisExclu">
<input class="sr-only" type="text" id="fraisExclu" name="fraisExclu" value="0" >
</div>
</div>