Пример #1
0
// Montant total des cheques
$montantTotal = 0;
$where = array();
$ljoin = array();
// Chargement des règlements via les factures
$ljoin["facture_cabinet"] = "facture_cabinet.facture_id = reglement.object_id";
$where["object_class"] = " = 'CFactureCabinet'";
$where['facture_cabinet.praticien_id'] = "= '{$praticien->_id}'";
if (!$all_group_compta) {
    $where["facture_cabinet.group_id"] = "= '" . CGroups::loadCurrent()->_id . "'";
}
$where['reglement.mode'] = "= 'cheque' ";
$where['reglement.date'] = "BETWEEN '{$date_min}' AND '{$date_max} 23:59:59' ";
$order = "reglement.date ASC";
$reglement = new CReglement();
$reglements = $reglement->loadList($where, $order, null, "reglement.reglement_id", $ljoin);
// Chargements des consultations
$montantTotal = 0.0;
foreach ($reglements as $_reglement) {
    /** @var CReglement $_reglement*/
    $_reglement->loadTargetObject()->loadRefPatient();
    $_reglement->loadRefBanque();
    $montantTotal += $_reglement->montant;
}
$nbRemise = count($reglements);
// Création du template
$smarty = new CSmartyDP();
$smarty->assign("praticien", $praticien);
$smarty->assign("reglements", $reglements);
$smarty->assign("date", CMbDT::date());
$smarty->assign("compte_banque", $compte_banque);
Пример #2
0
if ($filter->_mode_reglement) {
    $where["reglement.mode"] = "= '{$filter->_mode_reglement}'";
}
// Filtre sur les praticiens
$chir_id = CValue::getOrSession("chir");
$listPrat = CConsultation::loadPraticiensCompta($chir_id);
// Chargement des règlements via les factures
$ljoin["facture_cabinet"] = "reglement.object_id = facture_cabinet.facture_id";
if (!$all_group_compta) {
    $where["facture_cabinet.group_id"] = "= '" . CGroups::loadCurrent()->_id . "'";
}
$where["facture_cabinet.praticien_id"] = CSQLDataSource::prepareIn(array_keys($listPrat));
$where["reglement.object_class"] = " = 'CFactureCabinet'";
$reglement = new CReglement();
/** @var CReglement[] $reglements */
$reglements = $reglement->loadList($where, " facture_cabinet.facture_id, reglement.date", null, null, $ljoin);
$reglement = new CReglement();
// Calcul du récapitulatif
// Initialisation du tableau de reglements
$recapReglement["total"] = array("nb_consultations" => "0", "du_patient" => "0", "du_tiers" => "0", "nb_reglement_patient" => "0", "nb_reglement_tiers" => "0", "secteur1" => "0", "secteur2" => "0", "secteur3" => "0", "du_tva" => "0");
foreach (array_merge($reglement->_specs["mode"]->_list, array("")) as $_mode) {
    $recapReglement[$_mode] = array("du_patient" => "0", "du_tiers" => "0", "nb_reglement_patient" => "0", "nb_reglement_tiers" => "0");
}
$listReglements = array();
$listConsults = array();
$factures = CStoredObject::massLoadFwdRef($reglements, "object_id");
$patients = CStoredObject::massLoadFwdRef($factures, "patient_id");
CStoredObject::massCountBackRefs($factures, "notes");
foreach ($reglements as $_reglement) {
    $facture = $_reglement->loadRefFacture();
    $facture->loadRefGroup();
Пример #3
0
$date_min = CValue::get("_date_min");
$date_max = CValue::get("_date_max");
$journal_pdf = new CEditJournal();
$journal_pdf->type_pdf = $type == "all-paiement" ? "paiement" : $type;
$journal_pdf->date_min = $date_min;
$journal_pdf->date_max = $date_max;
$where = array();
if ($type == "paiement" || $type == "all-paiement") {
    if ($type == "all-paiement") {
        $where["lock"] = " = '0'";
    } else {
        $where["date"] = "BETWEEN '{$date_min} 00:00:00' AND '{$date_max} 23:59:00'";
    }
    $where["object_class"] = " = 'CFactureEtablissement'";
    $reglement = new CReglement();
    $journal_pdf->reglements = $reglement->loadList($where, "debiteur_id, debiteur_desc, date");
    foreach ($journal_pdf->reglements as $_reglement) {
        /** @var CReglement $_reglement */
        $fact = $_reglement->loadRefFacture();
        $fact->loadRefsReglements();
        if (!$fact->_id) {
            unset($journal_pdf->reglements[$_reglement->_id]);
        } elseif ($type == "all-paiement") {
            $_reglement->lock = "1";
            if ($msg = $_reglement->store()) {
                mbTrace($msg);
            }
        }
    }
}
if ($type == "rappel") {