function amenagement_budget($paragraphe_s, $article_s, $chapitre_s, $paragraphe_d, $article_d, $chapitre_d, $mont) { global $db; if (!$db->Query("update paragraphe set montant = montant + {$mont}, mont_disp = montant - mont_use where id = {$paragraphe_d}")) { $db->Kill($db->Error()); } if (!$db->Query("update paragraphe set montant = montant - {$mont}, mont_disp = montant - mont_use where id = {$paragraphe_s}")) { $db->Kill($db->Error()); } if (!update_budget($paragraphe_s, $chapitre_s, $article_s)) { } if (!update_budget($paragraphe_d, $chapitre_d, $article_d)) { } return true; }
function delet_lin_depense($id_lin_depense, $id_depense, $montant, $chapitre, $article, $paragraphe) { global $db; if (!$db->Query("delete from depense_lines where id = {$id_lin_depense}")) { $db->Kill($db->Error()); return false; } else { //Delet depens_lines if (!$db->Query("update depense set nbr_lignes= nbr_lignes-1 ,montant=montant-montant where id = {$id_depense}")) { return false; } //Update Budget model::load('budget', 'budget'); update_paragraphe($paragraphe, 0, $montant); update_budget($paragraphe, $chapitre, $article); } return true; }