Change centralize and jr_internal rule
This commit is contained in:
parent
fef14b4077
commit
fb2c7d9233
3 changed files with 8 additions and 5 deletions
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue