From fb2c7d9233b85d82b03cddd7de02d05e300bf038 Mon Sep 17 00:00:00 2001 From: sparkyx Date: Fri, 2 Apr 2004 12:19:41 +0000 Subject: [PATCH] Change centralize and jr_internal rule --- html/annulation.php | 7 ++++--- include/central_inc.php | 4 +++- include/jrn.php | 2 +- 3 files changed, 8 insertions(+), 5 deletions(-) diff --git a/html/annulation.php b/html/annulation.php index 7180fd515..5ab76c79a 100644 --- a/html/annulation.php +++ b/html/annulation.php @@ -78,14 +78,15 @@ if ( isset ($annul) ) { $sql= "insert into jrn ( jr_def_id,jr_montant,jr_comment, jr_date,jr_grpt_id,jr_internal ,jr_tech_per ) select - jr_def_id,jr_montant,'Annulation '||jr_comment,jr_date,$seq ,'ANNUL', $period + jr_def_id,jr_montant,'Annulation '||jr_comment,jr_date,$seq ,'ANNULE', $period from jrn where jr_grpt_id=".$_POST['p_id']; $Res=ExecSql($cn,$sql); - // Get the internal code - $internalcode=SetInternalCode($cn,$seq,$g_jrn); + // Set internal code to ANNULE + $Res=ExecSql($cn,"update jrn set jr_internal='ANNULE' where jr_grpt_id=".$_POST['p_id']); + // also in the stock table $sql="insert into stock_goods ( j_id,f_id,sg_quantity,sg_type diff --git a/include/central_inc.php b/include/central_inc.php index 96cbee7ca..a9ade418b 100644 --- a/include/central_inc.php +++ b/include/central_inc.php @@ -61,7 +61,9 @@ $sql="insert into centralized( c_j_id, j_rapt, j_tech_per from jrnx left join jrn on jr_grpt_id=j_grpt - where j_tech_per =".$p_periode." and j_tech_user not in ( select c_j_id from centralized) + where + j_tech_per =".$p_periode." + and jr_internal != 'ANNULE' order by j_date,j_grpt,j_debit desc "; $Res=StartSql($p_cn); $Res=ExecSql($p_cn,$sql); diff --git a/include/jrn.php b/include/jrn.php index a9229cf6f..10ffffe06 100644 --- a/include/jrn.php +++ b/include/jrn.php @@ -968,7 +968,7 @@ function NextJrn($p_cn,$p_type) */ function SetInternalCode($p_cn,$p_grpt,$p_jrn) { - $num=CountSql($p_cn,"select * from jrn where jr_def_id=$p_jrn"); + $num=CountSql($p_cn,"select * from jrn where jr_def_id=$p_jrn where jr_internal != 'ANNULE'"); $atype=GetJrnProperty($p_cn,$p_jrn); $type=$atype['jrn_def_code']; $internal_code=sprintf("%s-%05d",$type,$num);