diff --git a/Changelog b/Changelog index 9bfc3bf2b..62c870d73 100644 --- a/Changelog +++ b/Changelog @@ -1,5 +1,29 @@ +2005-07-04 stanpinte + + * include/constant.php, include/impress_inc.php, include/user_action_ach.php, include/user_action_fin.php, include/user_action_ods.php, include/user_action_ven.php, include/user_common.php, include/user_menu.php, include/user_update.php, html/annulation.php, html/fiche_new.php, html/fiche_search.php, html/jrn_detail.php, html/jrn_op_detail.php, html/jrn_search.php, html/modify_op.php, html/poste_search.php, html/sec_pdf.php, html/user_jrn.php: + enleve la variable globale g_jrn, remplace par param HTTP p_jrn partout + +2005-07-01 stanpinte + + * html/user_jrn.php: added comment + +2005-06-30 sparkyx + + * doc/manuel-fr.sgml, html/form_csv.php, include/class_poste.php, include/impress_form.php, include/impress_inc.php, include/poste.php: + Task 4331 Improve Formula + +2005-06-29 sparkyx + + * html/form.php: Fix unknown sessid (dependent of php's version) + +2005-06-24 stanpinte + + * include/fiche_inc.php, include/form_input.php: Added comments + 2005-06-22 sparkyx + * Changelog: Changelog + * html/form_csv.php, html/form_pdf.php, include/class_form.php: Task 4301 Form (html, pdf, csv) needs more test diff --git a/doc/function.txt b/doc/function.txt index 47e5fccfb..9340ea2b2 100644 --- a/doc/function.txt +++ b/doc/function.txt @@ -20,6 +20,8 @@ ************************* File = form_csv.php **************** ************************* File = form_pdf.php **************** ************************* File = form.php **************** +************************* File = f.php **************** +************************* File = g.php **************** ************************* File = html_balance.php **************** ************************* File = index.php **************** ************************* File = jrn_add.php **************** @@ -50,6 +52,7 @@ ************************* File = show_tva.php **************** ************************* File = stock.php **************** ************************* File = test.php **************** +************************* File = t.php **************** ************************* File = user_advanced.php **************** ************************* File = user_compta.php **************** ************************* File = user_impress.php **************** @@ -195,6 +198,20 @@ ac_common.php * gen : ac_common.php * - ac_common.php * return: string ac_common.php */ +ac_common.php /* function getPeriodeFromDate +ac_common.php ************************************************** +ac_common.php * Purpose : Return the period corresponding to the +ac_common.php * date +ac_common.php * +ac_common.php * parm : +ac_common.php * - p_cn database connection +ac_common.php * - the date 'MM.YYYY' +ac_common.php * gen : +ac_common.php * - none +ac_common.php * +ac_common.php * return: +ac_common.php * parm_periode.p_id +ac_common.php */ ************************* File = balance.php **************** ************************* File = central_inc.php **************** central_inc.php /* function Centralise @@ -356,6 +373,17 @@ class_poste.php * return: class_poste.php * - none class_poste.php * class_poste.php */ +class_poste.php /* function GetSolde +class_poste.php * Purpose : give the balance of an account +class_poste.php * +class_poste.php * parm : +class_poste.php * - cond +class_poste.php * gen : +class_poste.php * - none +class_poste.php * return: +class_poste.php * - balance of the account +class_poste.php * +class_poste.php */ ************************* File = class_user.php **************** class_user.php /* function CheckAdmin class_user.php ************************************************** @@ -492,6 +520,9 @@ fiche_inc.php * - none fiche_inc.php * return: fiche_inc.php * - none fiche_inc.php * +fiche_inc.php * NOTE STAN: je ne trouve pas le nom "EncodeFiche" super claire pour une fonction qui affiche les détails d'une fiche... +fiche_inc.php * on ne changerait pas en "DisplayFiche" ? +fiche_inc.php * fiche_inc.php */ fiche_inc.php /* function GetBaseFiche fiche_inc.php *************************************************** @@ -1315,6 +1346,19 @@ impress_inc.php * - array sum (deb) sum(cred) impress_inc.php * impress_inc.php */ impress_inc.php /* function ParseFormula +impress_inc.php * Purpose Parse a formula +impress_inc.php * +impress_inc.php * parm : +impress_inc.php * - $p_cn connexion +impress_inc.php * - $p_label +impress_inc.php * - $p_formula +impress_inc.php * gen : +impress_inc.php * - none +impress_inc.php * return: +impress_inc.php * - array +impress_inc.php * +impress_inc.php */ +impress_inc.php /* function GetFormulaValue impress_inc.php * Purpose : Parse the formula contained in the fo_formula impress_inc.php * field and return a array containing all the columns impress_inc.php * @@ -1652,6 +1696,7 @@ poste.php * poste.php * parm : poste.php * - connection poste.php * - account +poste.php * - cond poste.php * gen : poste.php * - none poste.php * return: diff --git a/doc/manuel-fr.sgml b/doc/manuel-fr.sgml index 1538125ce..39e4b6dee 100644 --- a/doc/manuel-fr.sgml +++ b/doc/manuel-fr.sgml @@ -580,7 +580,7 @@ Op Par exemple, le total des ventes, le total encore à payer, la différence entre les entrées et les charges... Il n'y a pas vraiment de limite. -

Les formulaires permettent d'utilisent des formules (round,*,-) +

Les formulaires permettent d'utilisent des formules (mod,round,*,-) sur des soldes de comptes. @@ -592,6 +592,10 @@ sur des soldes de comptes. il faut utiliser le %; Les soldes sont toujours positifs et vous ne savez pas s'ils sont au débit ou au crédit. +Si vous souhaitez commencer à une autre période pour certains +compte et donc avoir plusieurs intervalles pour un formulaire, vous +devez utiliser l'option FROM=MM.YYYY (voir exemple). Ce genre d'option est +très utile pour par exemple les déclarations de TVA.

@@ -600,6 +604,7 @@ Exemples de formule: Bénéfice brute [7%]-[6%] Impot estimé (sans compte les amortissements) ([7%]-[6%])/0.24 Total des comptes en banque [550%] +Total TVA récolté depuis janvier 2005 : [4511] FROM=01.2005 diff --git a/include/ac_common.php b/include/ac_common.php index 4a0f11641..b95f6103d 100644 --- a/include/ac_common.php +++ b/include/ac_common.php @@ -348,5 +348,28 @@ function getPeriodeName($p_cn,$p_id,$pos='p_start') { $a=pg_fetch_array($ret,0); return $a['t']; } +/* function getPeriodeFromDate + ************************************************** + * Purpose : Return the period corresponding to the + * date + * + * parm : + * - p_cn database connection + * - the date 'MM.YYYY' + * gen : + * - none + * + * return: + * parm_periode.p_id + */ +function getPeriodeFromDate($p_cn,$p_date) { + $R=ExecSql($p_cn,"select p_id from parm_periode where + to_char(p_start,'DD.MM.YYYY') = '01.$p_date'"); + if ( pg_NumRows($R) == 0 ) + return -1; + $a=pg_fetch_array($R,0); + + return $a['p_id']; +} ?> diff --git a/include/class_form.php b/include/class_form.php index 26737d27d..e281c259e 100644 --- a/include/class_form.php +++ b/include/class_form.php @@ -35,10 +35,6 @@ class formulaire { return $this->name; } function GetRow($p_start,$p_end) { - if ( $p_start == $p_end ) - $cond=" j_tech_per = $p_start "; - else - $cond = "(j_tech_per >= $p_start and j_tech_per <= $p_end) "; $Res=ExecSql($this->db,"select fo_id , fo_fr_id, @@ -56,7 +52,10 @@ class formulaire { $l_line=pg_fetch_array($Res,$i); $col[]=ParseFormula($this->db, $l_line['fo_label'], - $l_line['fo_formula'],$cond); + $l_line['fo_formula'], + $p_start, + $p_end + ); } //for ($i $this->row=$col; diff --git a/include/impress_inc.php b/include/impress_inc.php index dc0feee53..49dd0381e 100644 --- a/include/impress_inc.php +++ b/include/impress_inc.php @@ -704,6 +704,7 @@ function GetRappel($p_cn,$p_jrnx_id,$p_jrn_id,$p_exercice,$which,$p_type,$p_cent } // if type==0 } + /* function ParseFormula * Purpose Parse a formula * @@ -720,16 +721,38 @@ function GetRappel($p_cn,$p_jrnx_id,$p_jrn_id,$p_exercice,$which,$p_type,$p_cent * NOTE: problem: the formulas don't take date range parameters into account....TODO. * --> I would like to get the sum of operations between two specified dates. */ -function ParseFormula($p_cn,$p_label,$p_formula,$p_cond) { +function ParseFormula($p_cn,$p_label,$p_formula,$p_start,$p_end) { + if ( $p_start == $p_end ) + $cond=" j_tech_per = $p_start "; + else + $cond = "(j_tech_per >= $p_start and j_tech_per <= $p_end) "; + while (ereg("(\[[0-9]*%*\])",$p_formula,$e) == true) { include_once("class_poste.php"); // remove the [ ] $x=$e; $e[0]=str_replace ("[","",$e[0]); $e[0]=str_replace ("]","",$e[0]); + // If there is a FROM clause we must recompute + // the time cond + if ( ereg ("FROM=[0-9]+\.[0-9]+", $p_formula,$afrom) == true ){ + // There is a FROM clause + // then we must modify the cond for the periode + $from=str_replace("FROM=","",$afrom[0]); + // Get the periode + $from=getPeriodeFromDate($p_cn,$from); + + // Compute the cond + if ( $from == $p_end ) + $cond=" j_tech_per = $from "; + else + $cond = "(j_tech_per >= $from and j_tech_per <= $p_end) "; + // We remove FROM out of the p_formula + $p_formula=substr_replace($p_formula,"",strpos($p_formula,"FROM")); + } // Get sum of account $P=new poste($p_cn,$e[0]); - $i=$P->GetSolde($p_cond); + $i=$P->GetSolde($cond); $p_formula=str_replace($x,$i,$p_formula); } $p_formula="\$result=".$p_formula.";";