Пример #1
0
    $nb_ngap = count($_facture->_ref_actes_ngap);
    $nb_ccam = count($_facture->_ref_actes_ccam);
    if (!count($_facture->_ref_sejours) && !count($_facture->_ref_consults)) {
        unset($factures[$key]);
    } elseif ($nb_tarmed == 0 && $nb_caisse == 0 && $nb_ngap == 0 && $nb_ccam == 0 && !$etat_cotation && $search_easy != 4 && $search_easy != 0) {
        unset($factures[$key]);
    } elseif (($nb_tarmed != 0 || $nb_caisse != 0 || $nb_ngap != 0 || $nb_ccam != 0) && $search_easy == 4) {
        unset($factures[$key]);
    }
}
if ($facture_id && isset($factures[$facture_id])) {
    $facture->load($facture_id);
    $facture->loadRefPatient();
    $facture->_ref_patient->loadRefsCorrespondantsPatient();
    $facture->loadRefPraticien();
    $facture->loadRefAssurance();
    $facture->loadRefsObjects();
    $facture->loadRefsReglements();
    $facture->loadRefsRelances();
    $facture->loadRefsItems();
    $facture->loadRefsNotes();
}
$reglement = new CReglement();
$banque = new CBanque();
$banques = $banque->loadList(null, "nom");
$filter = new CConsultation();
$filter->_date_min = $date_min;
$filter->_date_max = $date_max;
// Création du template
$smarty = new CSmartyDP();
$smarty->assign("tab", "vw_factures_etab");
Пример #2
0
 /**
  * Edition de la facture
  *
  * @param bool $create création ou non du pdf
  *
  * @return void
  */
 function editFacture($create = true)
 {
     if ($create) {
         $this->createPdf();
     }
     foreach ($this->factures as $the_facture) {
         $this->facture = $the_facture;
         $this->facture->loadRefsItems();
         $this->_no_round = false;
         if ($this->facture->cloture && !count($this->facture->_ref_items)) {
             $this->facture->creationLignesFacture();
         }
         $this->patient = $this->facture->loadRefPatient();
         $this->facture->_ref_patient->loadRefsCorrespondantsPatient();
         $this->praticien = $this->facture->loadRefPraticien();
         $this->facture->loadRefAssurance();
         $this->facture->loadRefsObjects();
         $this->facture->loadRefsReglements();
         if ($this->type_pdf == "relance") {
             $this->facture->loadRefsRelances();
         }
         $this->function_prat = $this->praticien->loadRefFunction();
         $this->group = $this->function_prat->loadRefGroup();
         $adherent = $this->facture->loadNumAdherent($this->praticien->adherent);
         $this->adherent = $adherent["compte"];
         if ($this->type_pdf == "BVR") {
             $this->loadTotaux();
             $this->acompte = 0;
             $this->nb_factures = count($this->facture->_montant_factures_caisse);
             $this->num_fact = 0;
             foreach ($this->facture->_montant_factures_caisse as $cle_facture => $montant_facture) {
                 if ($this->acompte < $this->facture->_montant_avec_remise) {
                     $this->editHautFacture($cle_facture, $montant_facture);
                     $this->editBVR($montant_facture);
                 }
             }
         }
         if ($this->type_pdf == "BVR_TS") {
             $this->loadTotaux();
             $this->acompte = 0;
             $this->nb_factures = count($this->facture->_montant_factures_caisse);
             $this->num_fact = 0;
             $montant = 0;
             if ($this->acompte < $this->facture->_montant_avec_remise) {
                 $montant = $this->facture->_montant_avec_remise - $this->facture->_reglements_total_patient;
                 $montant = $montant - $this->facture->_reglements_total_tiers;
                 $this->editHautFacture(" ", $montant);
                 $this->editBVR($montant);
             }
             $this->type_pdf = "justif_TS";
             $this->function_prat->adresse = str_replace("\r\n", ' ', $this->function_prat->adresse);
             $this->patient->adresse = str_replace("\r\n", ' ', $this->patient->adresse);
             $this->editCenterJustificatif(0, $montant);
         } elseif ($this->type_pdf == "justif") {
             $this->function_prat->adresse = str_replace("\r\n", ' ', $this->function_prat->adresse);
             $this->patient->adresse = str_replace("\r\n", ' ', $this->patient->adresse);
             foreach ($this->facture->_montant_factures_caisse as $cle_facture => $montant_facture) {
                 $this->editCenterJustificatif($cle_facture, $montant_facture);
             }
         } elseif ($this->type_pdf == "relance") {
             $this->editRelanceEntete();
             //$this->editHautFacture(1, $this->relance->_montant, true);
             if (CAppUI::conf("ref_pays") == 2) {
                 $this->editBVR($this->relance->_montant);
             }
         }
     }
 }
 /**
  * Chargement du garant de la facture
  *
  * @param CFactureCabinet|CFactureEtablissement $facture la facture
  *
  * @return string
  */
 function loadGarant($facture)
 {
     $patient = $facture->_ref_patient;
     $facture->loadRefAssurance();
     if (strlen($patient->cp) > 4) {
         $patient->cp = substr($patient->cp, 1);
     }
     $assurance_patient = null;
     $view = "_longview";
     $send_assur = !$facture->send_assur_base && $facture->type_facture == "maladie";
     if ($facture->assurance_maladie && $send_assur && $facture->_ref_assurance_maladie->type_pec != "TG") {
         $assurance_patient = $facture->_ref_assurance_maladie;
     } elseif ($facture->assurance_accident && !$facture->send_assur_compl && $facture->type_facture == "accident") {
         $assurance_patient = $facture->_ref_assurance_accident->type_pec == "TG" ? $patient : $facture->_ref_assurance_accident;
     } else {
         $assurance_patient = $patient;
         $view = "_view";
     }
     return $assurance_patient->{$view};
 }
Пример #4
0
 /**
  * @see parent::completeLabelFields()
  */
 function completeLabelFields(&$fields, $params)
 {
     if (!isset($this->_from_op)) {
         $this->loadRefLastOperation()->_from_sejour = 1;
         $this->_ref_last_operation->completeLabelFields($fields, $params);
     }
     $this->loadRefPatient()->completeLabelFields($fields, $params);
     $this->loadRefPraticien();
     $this->loadNDA();
     $this->loadNRA();
     $now = CMbDT::dateTime();
     $affectation = $this->getCurrAffectation($this->entree > $now ? $this->entree : null);
     $affectation->loadView();
     $affectation->loadRefService();
     $souhaits = array();
     if (CAppUI::conf("dPhospi prestations systeme_prestations", CGroups::loadCurrent()) == "expert") {
         /** @var CItemLiaison[] $items_liaisons */
         $items_liaisons = $this->loadBackRefs("items_liaisons", "date");
         CStoredObject::massLoadFwdRef($items_liaisons, "item_souhait_id");
         CStoredObject::massLoadFwdRef($items_liaisons, "sous_item_id");
         foreach ($items_liaisons as $_liaison) {
             $item_souhait = $_liaison->loadRefItem();
             if ($item_souhait->object_class == "CPrestationPonctuelle") {
                 continue;
             }
             $sous_item = $_liaison->loadRefSousItem();
             $nom = $item_souhait;
             if ($sous_item->_id) {
                 $nom = $sous_item->nom;
             }
             $souhaits[] = $nom;
         }
     }
     $meds_dispenses = array();
     if (isset($params["debut_dispensation"]) && isset($params["fin_dispensation"])) {
         $from = $params["debut_dispensation"];
         $to = $params["fin_dispensation"];
         $delivery = new CProductDelivery();
         $where = array("date_dispensation" => "BETWEEN '{$from}' AND '{$to}'", "sejour_id" => "= '{$this->_id}'");
         $deliveries = $delivery->loadList($where);
         $stocks = CStoredObject::massLoadFwdRef($deliveries, "stock_id");
         $products = CStoredObject::massLoadFwdRef($stocks, "product_id");
         /** @var CProduct $_product */
         foreach ($products as $_product) {
             $meds_dispenses[] = $_product->code . " " . $_product->name;
         }
     }
     $fields_sejour = array("DATE ENT" => CMbDT::dateToLocale(CMbDT::date($this->entree)), "HEURE ENT" => CMbDT::transform($this->entree, null, "%H:%M"), "DATE SORTIE" => CMbDT::dateToLocale(CMbDT::date($this->sortie)), "HEURE SORTIE" => CMbDT::transform($this->sortie, null, "%H:%M"), "PRAT RESPONSABLE" => $this->_ref_praticien->_view, "NDOS" => $this->_NDA, "NRA" => $this->_ref_NRA ? $this->_ref_NRA->id400 : "", "CODE BARRE NDOS" => "@BARCODE_" . $this->_NDA . "@", "CHAMBRE COURANTE" => $affectation->_view, "SERVICE COURANT" => $affectation->_ref_service->_view, "MEDICAMENTS DISPENSES" => implode("\n", $meds_dispenses));
     if (CAppUI::conf("dPhospi prestations systeme_prestations", CGroups::loadCurrent()) == "expert") {
         $fields_sejour["PRESTATIONS SOUHAITEES"] = implode(" - ", $souhaits);
     }
     $fields = array_merge($fields, $fields_sejour);
     if (CAppUI::conf("ref_pays") == 2) {
         $fields["NATURE SEJOUR"] = $this->getFormattedValue("_type_sejour");
         $fields["MODE TRT"] = $this->loadRefChargePriceIndicator()->code;
         $this->loadRefsFactureEtablissement();
         if ($this->_ref_last_facture) {
             $this->_ref_last_facture->loadRefAssurance();
             $fields["ASSUR MALADIE"] = $this->_ref_last_facture->_ref_assurance_maladie->nom;
             $fields["ASSUR ACCIDENT"] = $this->_ref_last_facture->_ref_assurance_accident->nom;
         }
     }
 }