当前位置: 首页>>代码示例>>PHP>>正文


PHP calendar::add_days方法代码示例

本文整理汇总了PHP中calendar::add_days方法的典型用法代码示例。如果您正苦于以下问题:PHP calendar::add_days方法的具体用法?PHP calendar::add_days怎么用?PHP calendar::add_days使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在calendar的用法示例。


在下文中一共展示了calendar::add_days方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: do_retour


//.........这里部分代码省略.........
    if ($stuff->pret_idempr) {
        // l'exemplaire était effectivement emprunté
        // calcul du retard éventuel
        $rqt_date = "select ((TO_DAYS(CURDATE()) - TO_DAYS('{$stuff->pret_retour}'))) as retard ";
        $resultatdate = mysql_query($rqt_date);
        $resdate = mysql_fetch_object($resultatdate);
        $retard = $resdate->retard;
        if ($retard > 0) {
            //Calcul du vrai nombre de jours
            $date_debut = explode("-", $stuff->pret_retour);
            $ndays = calendar::get_open_days($date_debut[2], $date_debut[1], $date_debut[0], date("d"), date("m"), date("Y"));
            if ($ndays > 0) {
                $retard = (int) $ndays;
                print "<br /><div class='erreur'>" . $msg[369] . "&nbsp;: " . $retard . " " . $msg[370] . "</div>";
                $alert_sound_list[] = "critique";
            }
        }
        //Calcul du blocage
        if ($pmb_blocage_retard) {
            $date_debut = explode("-", $stuff->pret_retour);
            $ndays = calendar::get_open_days($date_debut[2], $date_debut[1], $date_debut[0], date("d"), date("m"), date("Y"));
            if ($ndays > $pmb_blocage_delai) {
                $ndays = $ndays * $pmb_blocage_coef;
                if ($ndays > $pmb_blocage_max && $pmb_blocage_max != 0) {
                    $ndays = $pmb_blocage_max;
                }
            } else {
                $ndays = 0;
            }
            if ($ndays > 0) {
                //Le lecteur est-il déjà bloqué ?
                $date_fin_blocage_empr = mysql_result(mysql_query("select date_fin_blocage from empr where id_empr='" . $stuff->pret_idempr . "'"), 0, 0);
                //Calcul de la date de fin
                $date_fin = calendar::add_days(date("d"), date("m"), date("Y"), $ndays);
                if ($date_fin > $date_fin_blocage_empr) {
                    //Mise à jour
                    mysql_query("update empr set date_fin_blocage='" . $date_fin . "' where id_empr='" . $stuff->pret_idempr . "'");
                    print "<br /><div class='erreur'>" . sprintf($msg["blocage_retard_pret"], formatdate($date_fin)) . "</div>";
                    $alertsound_list[] = "critique";
                } else {
                    print "<br /><div class='erreur'>" . sprintf($msg["blocage_already_retard_pret"], formatdate($date_fin_blocage_empr)) . "</div>";
                    $alertsound_list[] = "critique";
                }
            }
        }
        //Vérification des amendes
        if ($pmb_gestion_financiere && $pmb_gestion_amende) {
            $amende = new amende($stuff->pret_idempr);
            $amende_t = $amende->get_amende($stuff->pret_idexpl);
            //Si il y a une amende, je la débite
            if ($amende_t["valeur"]) {
                print pmb_bidi("<br /><div class='erreur'>" . $msg["finance_retour_amende"] . "&nbsp;: " . comptes::format($amende_t["valeur"]));
                $alert_sound_list[] = "critique";
                $compte_id = comptes::get_compte_id_from_empr($stuff->pret_idempr, 2);
                if ($compte_id) {
                    $cpte = new comptes($compte_id);
                    if ($cpte->id_compte) {
                        $cpte->record_transaction("", $amende_t["valeur"], -1, sprintf($msg["finance_retour_amende_expl"], $stuff->pret_idexpl), 0);
                        print " " . $msg["finance_retour_amende_recorded"];
                    }
                }
                print "</div>";
            }
        }
        // zone du dernier emrunteur
        print pmb_bidi($dernier_empr);
开发者ID:bouchra012,项目名称:PMB,代码行数:67,代码来源:pret_func.inc.php

示例2: del_pret

 function del_pret()
 {
     global $dbh;
     global $msg, $pmb_blocage_retard, $pmb_blocage_delai, $pmb_blocage_coef, $pmb_blocage_max, $pmb_gestion_financiere, $pmb_gestion_amende;
     global $selfservice_retour_retard_msg, $selfservice_retour_blocage_msg, $selfservice_retour_amende_msg;
     global $alertsound_list;
     if (!$this->expl->pret_idempr) {
         return '';
     }
     // calcul du retard éventuel
     $rqt_date = "select ((TO_DAYS(CURDATE()) - TO_DAYS('" . $this->expl->pret_retour . "'))) as retard ";
     $resultatdate = pmb_mysql_query($rqt_date);
     $resdate = pmb_mysql_fetch_object($resultatdate);
     $retard = $resdate->retard;
     if ($retard > 0) {
         //Calcul du vrai nombre de jours
         $date_debut = explode("-", $this->expl->pret_retour);
         $ndays = calendar::get_open_days($date_debut[2], $date_debut[1], $date_debut[0], date("d"), date("m"), date("Y"));
         if ($ndays > 0) {
             $retard = (int) $ndays;
             $message .= "<br /><div class='erreur'>" . $msg[369] . "&nbsp;: " . $retard . " " . $msg[370] . "</div>";
             $alertsound_list[] = "critique";
             $this->message_retard = $selfservice_retour_retard_msg . " " . $msg[369] . " : " . $retard . " " . $msg[370];
         }
     }
     //Calcul du blocage
     if ($pmb_blocage_retard) {
         $date_debut = explode("-", $this->expl->pret_retour);
         $ndays = calendar::get_open_days($date_debut[2], $date_debut[1], $date_debut[0], date("d"), date("m"), date("Y"));
         if ($ndays > $pmb_blocage_delai) {
             $ndays = $ndays * $pmb_blocage_coef;
             if ($ndays > $pmb_blocage_max && $pmb_blocage_max != 0) {
                 $ndays = $pmb_blocage_max;
             }
         } else {
             $ndays = 0;
         }
         if ($ndays > 0) {
             //Le lecteur est-il déjà bloqué ?
             $date_fin_blocage_empr = pmb_mysql_result(pmb_mysql_query("select date_fin_blocage from empr where id_empr='" . $this->expl->pret_idempr . "'"), 0, 0);
             //Calcul de la date de fin
             $date_fin = calendar::add_days(date("d"), date("m"), date("Y"), $ndays);
             if ($date_fin > $date_fin_blocage_empr) {
                 //Mise à jour
                 pmb_mysql_query("update empr set date_fin_blocage='" . $date_fin . "' where id_empr='" . $this->expl->pret_idempr . "'");
                 $message .= "<br /><div class='erreur'>" . sprintf($msg["blocage_retard_pret"], formatdate($date_fin)) . "</div>";
                 $alertsound_list[] = "critique";
                 $this->message_blocage = sprintf($selfservice_retour_blocage_msg, formatdate($date_fin));
             } else {
                 $message .= "<br /><div class='erreur'>" . sprintf($msg["blocage_already_retard_pret"], formatdate($date_fin_blocage_empr)) . "</div>";
                 $alertsound_list[] = "critique";
                 $this->message_blocage = sprintf($selfservice_retour_blocage_msg, formatdate($date_fin_blocage_empr));
             }
         }
     }
     //Vérification des amendes
     if ($pmb_gestion_financiere && $pmb_gestion_amende) {
         $amende = new amende($this->expl->pret_idempr);
         $amende_t = $amende->get_amende($this->expl_id);
         //Si il y a une amende, je la débite
         if ($amende_t["valeur"]) {
             $message .= pmb_bidi("<br /><div class='erreur'>" . $msg["finance_retour_amende"] . "&nbsp;: " . comptes::format($amende_t["valeur"]));
             $this->message_amende = $selfservice_retour_amende_msg . " : " . comptes::format($amende_t["valeur"]);
             $alertsound_list[] = "critique";
             $compte_id = comptes::get_compte_id_from_empr($this->expl->pret_idempr, 2);
             if ($compte_id) {
                 $cpte = new comptes($compte_id);
                 if ($cpte->id_compte) {
                     $cpte->record_transaction("", $amende_t["valeur"], -1, sprintf($msg["finance_retour_amende_expl"], $this->expl_id), 0);
                     $message .= " " . $msg["finance_retour_amende_recorded"];
                 }
             }
             $message .= "</div>";
             $req = "delete from cache_amendes where id_empr=" . $this->expl->pret_idempr;
             pmb_mysql_query($req);
         }
     }
     $query = "delete from pret where pret_idexpl=" . $this->expl_id;
     if (!pmb_mysql_query($query, $dbh)) {
         return '';
     }
     $query = "update empr set last_loan_date=sysdate() where id_empr='" . $this->expl->pret_idempr . "' ";
     @pmb_mysql_query($query, $dbh);
     $query = "update exemplaires set expl_lastempr='" . $this->expl->pret_idempr . "', last_loan_date=sysdate() where expl_id='" . $this->expl->expl_id . "' ";
     if (!pmb_mysql_query($query, $dbh)) {
         return '';
     }
     $this->maj_stat_pret();
     $this->empr = new emprunteur($this->expl->pret_idempr, $erreur_affichage, FALSE, 2);
     $this->expl->pret_idempr = 0;
     $this->flag_rendu = 1;
     return $message;
 }
开发者ID:noble82,项目名称:proyectos-ULS,代码行数:93,代码来源:expl_to_do.class.php

示例3: do_retour_doc

 function do_retour_doc()
 {
     global $dbh;
     global $msg;
     global $pmb_gestion_amende, $pmb_gestion_financiere, $pmb_blocage_retard, $pmb_blocage_max, $pmb_blocage_delai, $pmb_blocage_coef;
     // récupération localisation exemplaire
     $query = "select t.tdoc_libelle as type_doc";
     $query .= ", l.location_libelle as location";
     $query .= ", s.section_libelle as section";
     $query .= " from docs_type t";
     $query .= ", docs_location l";
     $query .= ", docs_section s";
     $query .= " where t.idtyp_doc=" . $this->expl_typdoc;
     $query .= " and l.idlocation=" . $this->expl_location;
     $query .= " and s.idsection=" . $this->expl_section;
     $query .= " limit 1";
     $result = pmb_mysql_query($query, $dbh);
     $info_doc = pmb_mysql_fetch_object($result);
     $this->type_doc = $info_doc->type_doc;
     if ($this->nbparts > 1) {
         $this->type_doc .= " (" . $this->nbparts . ")";
     }
     $this->location = $info_doc->location;
     $this->section = $info_doc->section;
     if ($this->expl_note) {
         $this->error_message = $msg[377];
     }
     if ($this->pret_idempr) {
         // calcul du retard éventuel
         $rqt_date = "select ((TO_DAYS(CURDATE()) - TO_DAYS('{$this->pret_retour}'))) as retard ";
         $resultatdate = pmb_mysql_query($rqt_date);
         $resdate = pmb_mysql_fetch_object($resultatdate);
         $retard = $resdate->retard;
         if ($retard > 0) {
             //Calcul du vrai nombre de jours
             $date_debut = explode("-", $this->pret_retour);
             $ndays = calendar::get_open_days($date_debut[2], $date_debut[1], $date_debut[0], date("d"), date("m"), date("Y"));
             if ($ndays > 0) {
                 $retard = (int) $ndays;
                 $this->error_message = $msg[369] . " : " . $retard . " " . $msg[370];
             } else {
                 $this->error_message = $msg["calendrier_active_aucun_retard"];
             }
         }
         //Calcul du blocage
         if ($pmb_blocage_retard) {
             $date_debut = explode("-", $this->pret_retour);
             $ndays = calendar::get_open_days($date_debut[2], $date_debut[1], $date_debut[0], date("d"), date("m"), date("Y"));
             if ($ndays > $pmb_blocage_delai) {
                 $ndays = $ndays * $pmb_blocage_coef;
                 if ($ndays > $pmb_blocage_max && $pmb_blocage_max != 0) {
                     $ndays = $pmb_blocage_max;
                 }
             } else {
                 $ndays = 0;
             }
             if ($ndays > 0) {
                 //Le lecteur est-il déjà bloqué ?
                 $date_fin_blocage_empr = pmb_mysql_result(pmb_mysql_query("select date_fin_blocage from empr where id_empr='" . $this->pret_idempr . "'"), 0, 0);
                 //Calcul de la date de fin
                 $date_fin = calendar::add_days(date("d"), date("m"), date("Y"), $ndays);
                 if ($date_fin > $date_fin_blocage_empr) {
                     //Mise à jour
                     pmb_mysql_query("update empr set date_fin_blocage='" . $date_fin . "' where id_empr='" . $this->pret_idempr . "'");
                     $this->error_message = sprintf($msg["blocage_retard_pret"], formatdate($date_fin));
                 } else {
                     $this->error_message = sprintf($msg["blocage_already_retard_pret"], formatdate($date_fin_blocage_empr));
                 }
             }
         }
         //Vérification des amendes
         if ($pmb_gestion_financiere && $pmb_gestion_amende) {
             $amende = new amende($this->pret_idempr);
             $amende_t = $amende->get_amende($this->pret_idexpl);
             //Si il y a une amende, je la débite
             if ($amende_t["valeur"]) {
                 $this->error_message = $msg["finance_retour_amende"] . "&nbsp;: " . comptes::format($amende_t["valeur"]);
                 $compte_id = comptes::get_compte_id_from_empr($this->pret_idempr, 2);
                 if ($compte_id) {
                     $cpte = new comptes($compte_id);
                     if ($cpte->id_compte) {
                         $cpte->record_transaction("", $amende_t["valeur"], -1, sprintf($msg["finance_retour_amende_expl"], $this->pret_idexpl), 0);
                         $this->error_message .= " " . $msg["finance_retour_amende_recorded"];
                     }
                 }
             }
         }
         // Suppression prêt et la mise en table de stat
         $query = "delete from pret where pret_idexpl = '" . $this->pret_idexpl . "' ";
         $result = pmb_mysql_query($query, $dbh);
         if ($result) {
             $this->retour_message = $msg["retour_ok"];
             if (!$this->maj_stat_pret()) {
                 // impossible de maj en table stat
                 $this->error_message = $msg[371];
             }
         } else {
             // impossible de supprimer en table pret
             $this->error_message = $msg[372];
         }
//.........这里部分代码省略.........
开发者ID:noble82,项目名称:proyectos-ULS,代码行数:101,代码来源:ajax_retour_class.php

示例4: get_amende

 function get_amende($id_expl)
 {
     global $pmb_amende_comptabilisation;
     $requete = "select pret_date, pret_retour, niveau_relance, date_relance from pret where pret_idexpl={$id_expl}";
     $resultat = pmb_mysql_query($requete);
     $amende = array();
     $amende["valeur"] = 0;
     $amende["recouvrement"] = false;
     if (@pmb_mysql_num_rows($resultat)) {
         $r = pmb_mysql_fetch_object($resultat);
         $dr = explode("-", $r->pret_retour);
         //$calendar=new calendar();
         $njours = calendar::get_open_days($dr[2], $dr[1], $dr[0], date("d"), date("m"), date("Y"));
         $amende_param = $this->get_parameters($id_expl);
         if ($njours > 0) {
             $amende["njours"] = $njours;
             if ($njours > $amende_param["delai_avant_amende"]) {
                 //En recouvrement ?
                 if ($r->niveau_relance == 3) {
                     $drel = explode("-", $r->date_relance);
                     $njours_recouvrement = calendar::get_open_days($drel[2], $drel[1], $drel[0], date("d"), date("m"), date("Y"));
                     if ($njours_recouvrement > $amende_param["delai_recouvrement"]) {
                         $amende["recouvrement"] = true;
                         $njours = calendar::get_open_days($dr[2], $dr[1], $dr[0], $drel[2], $drel[1], $drel[0]);
                     }
                 }
                 //Calcul de l'amende à partir du délai de grâce ?
                 if ($pmb_amende_comptabilisation) {
                     $amende["njours"] = $njours - $amende_param["delai_avant_amende"];
                 }
                 //Montant maximum dépassé ?
                 $amende["valeur"] = $amende["njours"] * $amende_param["amende_jour"];
                 if ($amende["valeur"] > $amende_param["amende_maximum"] && $amende_param["amende_maximum"] > 0) {
                     $amende["valeur"] = $amende_param["amende_maximum"];
                 }
             }
         }
         //Calcul du niveau théorique de l'exemplaire
         //calcul de Date retour+delai_avant_amende
         $date_1 = calendar::add_days($dr[2], $dr[1], $dr[0], $amende_param["delai_avant_amende"]);
         //calcul de Date retour+delai_avant_amende+delai_1_2
         $dr1 = explode("-", $date_1);
         $date_2 = calendar::add_days($dr1[2], $dr1[1], $dr1[0], $amende_param["delai_1_2"]);
         //calcul de Date retour+delai_avant_amende+delai_1_2+delai_2_3
         $dr2 = explode("-", $date_2);
         $date_3 = calendar::add_days($dr2[2], $dr2[1], $dr2[0], $amende_param["delai_2_3"]);
         //calcul de Date retour+delai_avant_amende+delai_1_2+delai_2_3+delai_recouvrement
         $dr3 = explode("-", $date_3);
         $date_recouvrement = calendar::add_days($dr3[2], $dr3[1], $dr3[0], $amende_param["delai_recouvrement"]);
         $time = mktime(0, 0, 0, date("m"), date("d"), date("Y"));
         $niveau = 0;
         if ($time > calendar::maketime($date_1) && $time <= calendar::maketime($date_2)) {
             $niveau = 1;
         } else {
             if ($time > calendar::maketime($date_2) && $time <= calendar::maketime($date_3)) {
                 $niveau = 2;
             } else {
                 if ($time > calendar::maketime($date_3) && $time <= calendar::maketime($date_recouvrement)) {
                     $niveau = 3;
                 } else {
                     if ($time > calendar::maketime($date_recouvrement)) {
                         $niveau = 4;
                     }
                 }
             }
         }
         $amende["niveau"] = $niveau;
         $amende["date_pret"] = $r->pret_date;
         $amende["date_retour"] = $r->pret_retour;
         $amende["niveau_relance"] = $r->niveau_relance;
         $amende["date_relance"] = $r->date_relance;
     }
     return $amende;
 }
开发者ID:noble82,项目名称:proyectos-ULS,代码行数:74,代码来源:amende.class.php


注:本文中的calendar::add_days方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。