From 779285ee69618ada717ea1033adb598ff40c3070 Mon Sep 17 00:00:00 2001 From: sparkyx Date: Mon, 3 Dec 2007 21:56:55 +0000 Subject: [PATCH] Fix bug and add verification --- html/index.php | 2 +- html/js/search_card.js | 5 ++- html/user_advanced.php | 73 +++++++++++++++++++++++++++++++++++++++ include/impress_bilan.php | 7 ++++ include/impress_jrn.php | 2 ++ include/modele.inc.php | 8 ++++- include/user_menu.php | 3 +- 7 files changed, 96 insertions(+), 4 deletions(-) diff --git a/html/index.php b/html/index.php index 13f544b0d..f131f7b08 100644 --- a/html/index.php +++ b/html/index.php @@ -76,7 +76,7 @@ BODY { -Version 3.0.2 +Version 3.0.3

Il est conseillé de ne PAS utiliser Internet Explorer.

diff --git a/html/js/search_card.js b/html/js/search_card.js index bcd6dab6e..80a17b5d0 100644 --- a/html/js/search_card.js +++ b/html/js/search_card.js @@ -28,7 +28,7 @@ function showfiche(p_sessid,p_qcode) { p_dossier=document.getElementById("gDossier").value; var a=window.open('show_fiche.php?PHPSESSID='+p_sessid+'&gDossier='+p_dossier+'&q='+p_qcode,'','toolbar=no,width=350,height=450,scrollbar=yes,statusbar=no'); - + return false; } /* type must be cred or deb and name is @@ -40,6 +40,7 @@ function SearchCard(p_sessid,type,name,jrn) var search=document.getElementById(name).value; var gDossier=document.getElementById('gDossier').value; var a=window.open('fiche_search.php?first&search&fic_search='+search+'&p_jrn='+jrn+'&PHPSESSID='+p_sessid+'&type='+type+'&name='+name+'&gDossier='+gDossier,'item','toolbar=no,width=350,height=450,scrollbars=yes,statusbar=no'); + return false; } function NewCard(p_sessid,type,name,jrn) { @@ -47,6 +48,8 @@ function SearchCard(p_sessid,type,name,jrn) var gDossier=document.getElementById('gDossier').value; var a=window.open('fiche_new.php?p_jrn='+jrn+'&PHPSESSID='+p_sessid+'&type='+type+'&name='+name+'&gDossier='+gDossier,'item','toolbar=no,width=350,height=450,scrollbars=yes,statusbar=no'); + return false; + } /* SetValue( p_ctl,p_value ) /* p_ctl is the name of the control diff --git a/html/user_advanced.php b/html/user_advanced.php index 060e09bbc..33cf29d9a 100644 --- a/html/user_advanced.php +++ b/html/user_advanced.php @@ -62,6 +62,10 @@ switch ($p_action) { case 'periode'; $high=2; break; + case 'verif'; + $high=10; + break; + default: $high=0; @@ -158,8 +162,77 @@ if ($p_action=="preod") { echo ''; } echo '

'; + exit(); } +//---------------------------------------------------------------------- +// Verification solde +//---------------------------------------------------------------------- +if ( $p_action=='verif' ) { + echo '
'; + $User->db=$cn; + $sql_year=" and c_periode in (select p_id from parm_periode where p_exercice='".$User->GetExercice()."')"; + echo '
    '; + $deb=getDbValue($cn,"select sum (c_montant) from centralized where c_debit='t' $sql_year "); + $cred=getDbValue($cn,"select sum (c_montant) from centralized where c_debit='f' $sql_year "); + + if ( $cred == $deb ) { + $result =' OK ';} + else { + $result =' NON OK ';} + + printf ('
  1. Solde Grand Livre centralisé: debit %f credit %f %s
  2. ',$deb,$cred,$result); + + $sql="select jrn_def_id,jrn_def_name from jrn_def"; + $res=ExecSql($cn,$sql); + $jrn=pg_fetch_all($res); + foreach ($jrn as $l) { + $id=$l['jrn_def_id']; + $name=$l['jrn_def_name']; + $deb=getDbValue($cn,"select sum (c_montant) from centralized where c_debit='t' and c_jrn_def=$id $sql_year "); + $cred=getDbValue($cn,"select sum (c_montant) from centralized where c_debit='f' and c_jrn_def=$id $sql_year "); + + if ( $cred == $deb ) { + $result =' OK ';} + else { + $result =' NON OK ';} + + printf ('
  3. Journal %s Solde centralisé: debit %f credit %f %s
  4. ',$name,$deb,$cred,$result); + + } + echo '
'; + echo '
    '; + $sql_year=" and j_tech_per in (select p_id from parm_periode where p_exercice='".$User->GetExercice()."')"; + + $deb=getDbValue($cn,"select sum (j_montant) from jrnx where j_debit='t' $sql_year "); + $cred=getDbValue($cn,"select sum (j_montant) from jrnx where j_debit='f' $sql_year "); + + if ( $cred == $deb ) { + $result =' OK ';} + else { + $result =' NON OK ';} + + printf ('
  1. Solde Grand Livre non centralisé: debit %f credit %f %s
  2. ',$deb,$cred,$result); + $sql="select jrn_def_id,jrn_def_name from jrn_def"; + $res=ExecSql($cn,$sql); + $jrn=pg_fetch_all($res); + foreach ($jrn as $l) { + $id=$l['jrn_def_id']; + $name=$l['jrn_def_name']; + $deb=getDbValue($cn,"select sum (j_montant) from jrnx where j_debit='t' and j_jrn_def=$id $sql_year "); + $cred=getDbValue($cn,"select sum (j_montant) from jrnx where j_debit='f' and j_jrn_def=$id $sql_year "); + + if ( $cred == $deb ) { + $result =' OK ';} + else { + $result =' NON OK ';} + + printf ('
  3. Journal %s Solde non centralisé: debit %f credit %f %s
  4. ',$name,$deb,$cred,$result); + + } + + echo '
'; + } html_page_stop(); diff --git a/include/impress_bilan.php b/include/impress_bilan.php index efbcc3207..0873de7c6 100644 --- a/include/impress_bilan.php +++ b/include/impress_bilan.php @@ -42,5 +42,12 @@ echo '
'; echo '
'; echo $bilan->display_form ($filter_year); echo '
'; +echo ' Attention : si le bilan n\'est pas équilibré.
Vérifiez
    +
  • L\'affectation du résultat est fait
  • +
  • Vos comptes actifs ont un solde débiteur (sauf les comptes dit inversés)
  • +
  • les comptes passifs ont un solde créditeur (sauf les comptes dit inversés)
  • +
+Utilisez la balance des comptes pour vérifier.
'; + echo '
'; ?> diff --git a/include/impress_jrn.php b/include/impress_jrn.php index 111b934dd..677034d57 100644 --- a/include/impress_jrn.php +++ b/include/impress_jrn.php @@ -242,5 +242,7 @@ echo ''; print $w->Submit('bt_html','Impression'); echo ''; + echo ' Attention : en-cas d\'impression de journaux centralisés, dans le PDF, les montants débit et crédit calculés par page sont la somme des montants de la page uniquement. Si une opération est sur 2 pages ces montants diffèreront évidemment. Ces montants doivent être égaux sur la dernière page. Pour vérifier la balance, utilisez la balance des comptes ou Avancé->Vérification'; + echo ''; ?> diff --git a/include/modele.inc.php b/include/modele.inc.php index 0f2bfbeed..472f0b328 100644 --- a/include/modele.inc.php +++ b/include/modele.inc.php @@ -73,6 +73,7 @@ if ( isset ($_POST["FMOD_NAME"]) ) { $Res=ExecSql($cn_mod,"truncate table stock_goods"); $Res=ExecSql($cn_mod,"truncate table jrn"); $Res=ExecSql($cn_mod,"delete from jrnx"); + $Res=ExecSql($cn_mod,'delete from operation_analytique'); // TODO // Nettoyage table quant_* @@ -140,7 +141,10 @@ if ( isset ($_POST["FMOD_NAME"]) ) { } - + if ( isset($_POST['CANAL'])) { + $Res=ExecSql($cn_mod,'delete from poste_analytique'); + $Res=ExecSql($cn_mod,'delete from plan_analytique'); + } } // Show all available templates @@ -214,6 +218,8 @@ if ( $count != 0 ) { Nettoyage des Documents et courriers (ce qui n'effacera pas les modèles de documents) Nettoyage de toutes les fiches (ce qui effacera client, opérations prédéfinies fournisseurs et documents) +Nettoyage de la comptabilité analytique : effacement des plans et des postes, les opérations sont de toute façon effacées + diff --git a/include/user_menu.php b/include/user_menu.php index 61d7f1519..96ebd9f11 100644 --- a/include/user_menu.php +++ b/include/user_menu.php @@ -553,7 +553,8 @@ function ShowMenuAdvanced($default="") { array('compta.php?p_action=stock&'.$str_dossier,'Stock',"Gestion des stocks",5), array('form.php?'.$str_dossier,'Rapport',"Rapport",6), array('import.php?'.$str_dossier,'Import Banque',"Banque",7), - array('ecrit_ouv.php?'.$str_dossier,'Ecriture ouverture',"",8) + array('ecrit_ouv.php?'.$str_dossier,'Ecriture ouverture',"",8), + array('user_advanced.php?p_action=verif&'.$str_dossier,'Vérification',"",10) ), 'H',"mtitle","mtitle",$default); $r='
'.$left_menu."
";