Change centralize and jr_internal rule

This commit is contained in:
sparkyx 2004-04-02 12:19:41 +00:00
parent fef14b4077
commit fb2c7d9233
3 changed files with 8 additions and 5 deletions

View file

@ -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

View file

@ -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);

View file

@ -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);