$where["facture_id"] = " = '{$num_facture}' "; } if ($numero && !CAppUI::conf("dPfacturation Other use_search_easy") && ($etat_relance || $search_easy == 7)) { $where["facture_relance.numero"] = " = '{$numero}'"; } if ($search_easy == 5) { $where["annule"] = " = '1'"; } if ($search_easy == 1) { $where["definitive"] = " = '1'"; } if ($xml_etat != "") { $where["facture"] = " = '{$xml_etat}' "; } $facture = new CFactureEtablissement(); $total_factures = $facture->countList($where, null, $ljoin); $factures = $facture->loadList($where, "ouverture ASC, numero", "{$page}, 25", "facture_id", $ljoin); //Affichage uniquement des factures qui contiennent des séjours foreach ($factures as $key => $_facture) { /** @var CFacture $_facture*/ $_facture->loadRefPatient(); $_facture->loadRefsItems(); $_facture->loadRefsObjects(); $nb_tarmed = count($_facture->_ref_actes_tarmed); $nb_caisse = count($_facture->_ref_actes_caisse); $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]);