radiantprestation/Vue/Optique/index.php

334 lines
15 KiB
PHP

<?php
$this->titre = "INTER-SANTE - Prescription Optique";
$numeroBonOptique = $optique['numeroBonOptique'];
$numeroOptique = $optique['numeroOptique'];
$facture = $optique['facture'];
$_SESSION['p_numeroBonOptique_C'] = $numeroBonOptique;
$_SESSION['p_numeroOptique_C'] = $numeroOptique;
$badcodeGestionBon = "1";
$tab_gestion_bon = array("0", "1", "2");
if (in_array($codeGestionBon, $tab_gestion_bon))
{
$badcodeGestionBon = "0";
}
$prescrireVerres = ($_SESSION['p_prescrireVerres_C']==1) ;
$agePrescription = $this->nettoyer($optique['agePrescription']);
$bonCaduc = $this->nettoyer($optique['bonCaduc']);
$modeSaisieFacture = $_SESSION['p_modeSaisieFacture'];
if($modeSaisieFacture=="1")
{
$bonCaduc = "0";
}
?>
<script type="text/javascript">
</script>
<input class="sr-only" id="badcodeGestionBon" name="badcodeGestionBon" type="text" value= "<?= $badcodeGestionBon ?>" >
<input class="sr-only" id="bonCaduc" name="bonCaduc" type="text" value= "<?= $bonCaduc ?>" >
<?php if ($numeroBonOptique<="0" && $badcodeGestionBon=="1") : ?>
<div class="alert alert-danger" style="height:30px; padding:5px; text-align:center;" >
<H4> <?= _("REVOIR LE TYPE DE GESTION DES BONS") ?> </H4>
</div>
<?php else: ?>
<input class="sr-only" id="facture" name="facture" type="text" value= "<?= $facture ?>" >
<input class="sr-only" id="numeroBonOptique" name="numeroBonOptique" type="text" value= "<?= $numeroBonOptique ?>" >
<input class="sr-only" id="codeMedecin" name="codeMedecin" type="text" value= "<?= $optique['codeMedecin'] ?>">
<input class="sr-only" type="text" id="nbBonsOrd" name="nbBonsOrd" Value="<?= $nbBonsOrd ?>" >
<input class="sr-only" type="text" id="codeGestionBon" name="codeGestionBon" Value="<?= $codeGestionBon ?>" >
<?php if ($numeroBonOptique>"0") : ?>
<legend> <?= _("Prescription Optique") ?> </legend>
<?php else: ?>
<legend> <?= _("Nouvelle prescription Optique") ?> </legend>
<?php endif; ?>
<table class="table table-responsive table-condensed" style='font-size:10pt;'>
<tbody>
<tr>
<td width="10%" > Date Prescription </td>
<td width="24%" > <INPUT class="form-control" TYPE="text" value="<?= dateLang($this->nettoyer($optique['datePrescription'])) ?>" readonly style="text-align: center; font-size:10pt;" > </td>
<td width="15%" align="center"> <?= _("Médecin") ?> </td>
<td>
<?php if ($numeroBonOptique>"0" or $facture=="1") : ?>
<INPUT class="form-control" TYPE="text" value="<?= $this->nettoyer($optique['medecinPrescription']) ?>" readonly style='font-size:10pt;'>
<?php else: ?>
<button type="button" class="form-control btn btn-primary" data-toggle="modal" data-target="#popRechercheMedecin" style='font-size:10pt;' ><span id="nomMedecin" name="nomMedecin"> <?= $this->nettoyer($optique['medecinPrescription']) ?> </span></button>
<?php endif; ?>
</td>
</tr>
</tbody>
</table>
<table class="table table-responsive table-condensed" style='font-size:10pt;'>
<tbody>
<tr>
<td width="10%" > <?= _("Bons Disponibles") ?> </td>
<td width="24%" > <input class="form-control" style="text-align: center; font-size:10pt;" Value="<?= $nbBonsOrd ?>" readonly > </td>
<td width="15%" align="center" > <?= _("Gestion") ?> </td>
<td>
<?php if($badcodeGestionBon=="1") : ?>
<input class="form-control" style="text-align: center; font-size:10pt; background-color: red;color:white;" Value="<?= _("INCONNU") ?>" readonly >
<?php else: ?>
<input class="form-control" style="text-align: center; font-size:10pt;" Value="<?= $typeGestionbon ?>" readonly >
<?php endif; ?>
</td>
</tr>
</tbody>
</table>
<div id="infosbon">
<!-- debut new -->
<?php if($codeGestionBon!="0"): ?>
<?php if ($numeroBonOptique>"0") : ?>
<table class="table table-responsive table-condensed" style='font-size:10pt;'>
<tbody>
<tr>
<td width="10%" > <?= _("No Ordonnance") ?> </td>
<td width="24%" > <input class="form-control" style="text-align: center; font-size:10pt; background-color:blue;color:white;" type="number" id="numeroBon" name="numeroBon" value="<?= $numeroBonOptique ?>" readonly > </td>
<td width="15%" > </td>
<?php if ($facture=="1"): ?>
<td align='center' class="alert alert-danger" style="height:30px; padding:5px;" > <?= _("Dejà facturée !") ?> </td>
<?php else: ?>
<?php if ($nbVerres_0=="0" && $prescrireVerres && $bonCaduc!="1"): ?>
<td> <button type="button" class="form-control btn btn-primary" data-toggle="modal" data-target="#popAjoutVerre" style='font-size:10pt;' > <?= _("Ajouter des verres...") ?> </button> </td>
<?php else: ?>
<td> <button disabled type="button" class="form-control btn btn-primary" data-toggle="modal" data-target="#popAjoutVerre" style='font-size:10pt;' > <?= _("Ajouter des verres...") ?> </button> </td>
<?php endif; ?>
<?php endif; ?>
</tr>
</tbody>
</table>
<?php else: ?>
<input class="sr-only" type="text" id="codeEtatBon" name="codeEtatBon" value="1">
<input class="sr-only" type="text" id="numeroBonSave" name="numeroBonSave" value="1">
<input class="sr-only" type="text" id="numeroBon" name="numeroBon" value="1">
<?php if($codeGestionBon=="1" && $nbBonsOrd<1): ?>
<div class="alert alert-danger" style="height:30px; padding:5px; text-align:center;" >
<H4> <?= _("STOCK DE BON EPUISE") ?> </H4>
</div>
<?php else: ?>
<?php if ($facture=="1"): ?>
<input id="btn_enreg" name="btn_enreg" class = "form-control btn btn-primary" type="button" value="<?= _("Enregistrer") ?>" disabled style='font-size:10pt;' >
<?php elseif($bonCaduc!="1"): ?>
<input id="btn_enreg" name="btn_enreg" class = "form-control btn btn-primary" type="button" value="<?= _("Enregistrer") ?>" onClick="javascript:enregistreroptique();" style='font-size:10pt;' >
<?php else: ?>
<input id="btn_enreg" name="btn_enreg" disabled class = "form-control btn btn-primary" type="button" value="<?= _("Enregistrer") ?>" style='font-size:10pt;' >
<?php endif; ?>
<?php endif; ?>
<?php endif; ?>
<?php else: ?>
<!-- Fin new -->
<input class="sr-only" type="text" id="codeEtatBon" name="codeEtatBon" value="">
<input class="sr-only" type="text" id="numeroBonSave" name="numeroBonSave" value="0">
<?php if ($numeroBonOptique>"0") : ?>
<table class="table table-responsive table-condensed" style='font-size:10pt;'>
<tbody>
<tr>
<td width="10%" > <?= _("No Ordonnance") ?> </td>
<td width="24%" > <input class="form-control" style="text-align: center; font-size:10pt; background-color:blue;color:white;" type="number" id="numeroBon" name="numeroBon" value="<?= $numeroBonOptique ?>" readonly > </td>
<td width="15%" > </td>
<?php if ($facture=="1"): ?>
<td align='center' class="alert alert-danger" style="height:30px; padding:5px;" > <?= _("Dejà facturée !") ?> </td>
<?php else: ?>
<?php if ($nbVerres_0=="0" && $prescrireVerres && $bonCaduc!="1"): ?>
<td> <button type="button" class="form-control btn btn-primary" data-toggle="modal" data-target="#popAjoutVerre" style='font-size:10pt;' > <?= _("Ajouter des verres...") ?> </button> </td>
<?php else: ?>
<td> <button disabled type="button" class="form-control btn btn-primary" data-toggle="modal" data-target="#popAjoutVerre" style='font-size:10pt;' > <?= _("Ajouter des verres...") ?> </button> </td>
<?php endif; ?>
<?php endif; ?>
</tr>
</tbody>
</table>
<?php else: ?>
<table class="table table-responsive table-condensed" style='font-size:10pt;'>
<tbody>
<?php if($nbBonsOrd<1): ?>
<tr>
<input class="sr-only" type="number" id="numeroBon" name="numeroBon" required >
<td>
<div class="alert alert-danger" style="height:30px; padding:5px; text-align:center;" >
<H4> <?= _("STOCK DE BON EPUISE") ?> </H4>
</div>
</td>
</tr>
<?php else: ?>
<tr>
<td width="10%" > <?= _("No Ordonnance") ?> </td>
<?php if ($facture=="1"): ?>
<td width="24%" > <input class="form-control" style="text-align: center; font-size:10pt; background-color:blue;color:white;" type="number" id="numeroBon" name="numeroBon" value="<?= $numeroBonOptique ?>" readonly > </td>
<?php elseif($bonCaduc!="1"): ?>
<td width="24%" > <input class="form-control" style="text-align: center; font-size:10pt;" type="number" id="numeroBon" name="numeroBon" required
onChange="ajaxinfosbonoptique();" onkeypress="javascript:ctrlkeypress_numeroBon(event);" autofocus ></td>
<?php else: ?>
<td width="24%" > <input class="form-control" style="text-align: center; font-size:10pt;" type="number" id="numeroBon" name="numeroBon" readonly ></td>
<?php endif; ?>
<td width="15%" > </td>
<td><input id="btn_enreg" name="btn_enreg" class = "form-control btn btn-primary" type="button" value="<?= _("Enregistrer") ?>" disabled style='font-size:10pt;' ></td>
</tr>
<?php endif; ?>
</tbody>
</table>
<?php endif; ?>
<?php endif; ?>
<?php if (isset($msgErreur)): ?>
<div id ="msgErreur" class="alert alert-danger" style="height:30px; padding:5px;" >
<H4><?= $msgErreur ?></H4>
</div>
<?php endif; ?>
</div>
<?php if($bonCaduc=="1") : ?>
<div class="alert alert-danger" style="height:30px; padding:5px; text-align:center; margin-bottom:5px;" >
<H4> <?= " Age => ".$agePrescription . " "._("jours") . " => " . _("BON CADUC") ?> </H4>
</div>
<?php endif; ?>
<div id="verres">
<?php if ($numeroBonOptique>"0") : ?>
<legend> <?= _("Verres prescrits") ?> </legend>
<?php $nbVerres = 0; ?>
<table class="table table-striped table-bordered table-hover table-condensed table-responsive" style="font-size:10pt;">
<thead>
<tr>
<th > <?= _("Libellé") ?> </th>
<th width="5%" style="text-align:center"> <?= _("Suppr") ?> </th>
</tr>
</thead>
<tbody>
<?php foreach ($detailoptiques as $detailoptique):
$idOptique = $this->nettoyer($detailoptique['id']);
$livre = $this->nettoyer($detailoptique['livre']);
$ajoutOpticien = $this->nettoyer($detailoptique['ajoutOpticien']);
$nbVerres++;
?>
<tr valign="top">
<td> <?= $this->nettoyer($detailoptique['libelleOptique']) ?> </td>
<?php if ($facture=="1"): ?>
<td> </td>
<?php else: ?>
<?php if ($livre!="1" && $ajoutOpticien!="1") : ?>
<td> <input class = "form-control btn btn-danger" type="button" value="X" onClick="javascript:supprimer_optique('<?= $idOptique ?>');"> </td>
<?php else: ?>
<td> </td>
<?php endif; ?>
<?php endif; ?>
</tr>
<?php endforeach; ?>
</tbody>
</table>
<input class="sr-only" type="text" id="nbVerres" name="nbVerres" value="<?= $nbVerres ?>" >
<div class="modal fade" id="popAjoutVerre" role="dialog">
<div class="modal-dialog modal-lg">
<div class="modal-content">
<div class="modal-header">
<button id="btn_close_pop" name="btn_close_pop" type="button" class="close" data-dismiss="modal"> <?= _("Fermer") ?> </button>
<h3 class="modal-title"> <?= _("Ajouter des verres") ?> </h3>
</div>
<div class="modal-body">
<div id="div_ajout_chambre">
<form id="frmchambre" name="frmchambre" method="post" >
<input class="sr-only" type="text" id="codeTypePrestation" name="codeTypePrestation" value="OPT">
<table class="table table-responsive table-condensed" style='font-size:10pt;'>
<tbody>
<tr>
<td>
<div id="listeacte">
<SELECT class="form-control" id="codeOptique" NAME="codeOptique" required style='font-size:10pt;' required autofocus >
<?php liste_options($acte,""); ?>
</SELECT>
</div>
</td>
</tr>
<tr>
<td colspan="3"><input id="btn_enreg" name="btn_enreg" class = "form-control btn btn-primary" type="button" value="<?= _("Enregistrer") ?>" onClick="enregistrerverre();" style='font-size:10pt;' ></td>
</tr>
</tbody>
</table>
</form>
</div>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default" data-dismiss="modal"> <?= _("Fermer") ?> </button>
</div>
</div>
</div>
</div>
<?php endif; ?>
</div>
<div class="modal fade" id="popRechercheMedecin" role="dialog">
<div class="modal-dialog modal-lg">
<div class="modal-content">
<div class="modal-header">
<button id="btn_close_pop" name="btn_close_pop" type="button" class="close" data-dismiss="modal"> <?= _("Fermer") ?> </button>
<h4 class="modal-title"><?= _("Rechercher un Médecin...") ?></h4>
</div>
<div class="modal-body">
<div id="div_listemedecins" onkeypress="javascript:ctrlkeypress_medecin(event);">
<table class="table table-striped table-bordered table-hover table-condensed table-responsive" style='font-size:10pt;'>
<thead>
<tr>
<th style="text-align:center" width="15%" > Code </th>
<th width="50%" style="text-align:center" > <?= _("Nom contenant...") ?> </th>
<th style="text-align:center" > <?= _("Spécialité") ?> </th>
</tr>
</thead>
<tbody>
<tr>
<td><input type="text" class="form-control" id="noOrdreMedecin" name="noOrdreMedecin" autofocus style='font-size:10pt;' ></td>
<td><input type="text" class="form-control" id="nomsearch" name="nomsearch" autofocus style='font-size:10pt;' ></td>
<td><input type="button" class = "form-control btn btn-info" style='font-size:10pt;' value="<?= _("Rechercher...") ?>" onclick="javascript:afficher_pop_recherche_medecin();" /></td>
</tr>
</tbody>
</table>
</div>
</div>
<div class="modal-footer">
<button id="close_pop" name="close_pop" type="button" class="btn btn-default" data-dismiss="modal"> <?= _("Fermer") ?> </button>
</div>
</div>
</div>
</div>
<?php endif; ?>