Exemple #1
0
        $rest2 = $depot_garantie % $cycle_v;
        for ($i = 0; $i < $nbr_collecte; $i++) {
            $j = $cycle_v * $i;
            $month_fin = $cycle_v - 1;
            $date_start = date('01-m-Y', strtotime("+{$j} months", strtotime($dat1)));
            $date_end = date('t-m-Y', strtotime("+{$month_fin} months", strtotime($date_start)));
            $var = $depot_garantie - 1;
            $datee = date('t-m-Y', strtotime("+{$var} months", strtotime($dat1)));
            $datetime3 = new DateTime($datee);
            $datetime4 = new DateTime($date_end);
            $datetime5 = new DateTime($date_start);
            $montant = $cycle_v * $array['montant'];
            if ($datetime3 > $datetime4 or $datetime3 == $datetime4) {
                addcollecte($id_contrat, date('Y-m-d-', strtotime($date_start)), date('Y-m-d-', strtotime($date_end)), $montant, "Payé", date('Y-m-d-', strtotime($date_start)));
            } else {
                addcollecte($id_contrat, date('Y-m-d-', strtotime($date_start)), date('Y-m-d-', strtotime($date_end)), $montant, "Non Payé", '');
            }
        }
        // $reponse = 'ok';
        exit("1#Opération réussie");
        //Success Opération
    }
}
if (tp('del') == 1) {
    global $db;
    $id_contrat = tp('lin');
    $idvil = tg('id');
    $nbr_collecte = $db->QuerySingleValue0("select count(id) from collecte where id_location={$id_contrat}");
    model::load('gestionvilla', 'contralocatvila');
    if ($nbr_collecte > 0) {
        if (!deletcollecte($id_contrat)) {
Exemple #2
0
<?php

if (tp('verif') == 1) {
    $nextid = getnextidtable('collecte');
    model::load('collecte', 'addcollecte');
    if (!addcollecte($nextid, tp('location_villa'), tp('prix'), tp('paiement'), tp('pjid'))) {
        exit("0");
    } else {
        exit("1");
    }
} else {
    view::load('collecte', 'addcollecte');
}