85 |
// Periode fermée |
// Periode fermée |
86 |
if ( PeriodeClosed ($cn,$userPref)=='t' ) |
if ( PeriodeClosed ($cn,$userPref)=='t' ) |
87 |
{ |
{ |
88 |
$msg="This periode is closed please change your preference"; |
$msg="Votre periode par defaut est fermee, changez vos preferences"; |
89 |
echo_error($msg); |
echo_error($msg); |
90 |
echo "<SCRIPT>alert('$msg');</SCRIPT>"; |
echo "<SCRIPT>alert('$msg');</SCRIPT>"; |
91 |
// set an incorrect pid to get out from here |
// set an incorrect pid to get out from here |
100 |
// if the operation is in a closed or centralized period |
// if the operation is in a closed or centralized period |
101 |
// the operation is voided thanks the opposite operation |
// the operation is voided thanks the opposite operation |
102 |
StartSql($cn); |
StartSql($cn); |
103 |
$p_internal=SetInternalCode($cn,$p_id,$l_array['jr_id']); |
$p_internal=SetInternalCode($cn,$p_id,$l_array['jr_def_id']); |
104 |
$grp_new=NextSequence($cn,'s_grpt'); |
$grp_new=NextSequence($cn,'s_grpt'); |
105 |
$sql= "insert into jrn ( |
$sql= "insert into jrn ( |
106 |
jr_def_id,jr_montant,jr_comment, |
jr_def_id,jr_montant,jr_comment, |
115 |
$Res=ExecSql($cn,$sql); |
$Res=ExecSql($cn,$sql); |
116 |
// Check return code |
// Check return code |
117 |
if ( $Res == false ) { Rollback($cn);exit(-1);} |
if ( $Res == false ) { Rollback($cn);exit(-1);} |
|
// Mark the operation invalid into the ledger |
|
|
// to avoid to nullify twice the same op. |
|
|
$sql="update jrn set jr_valid=false where jr_grpt_id=".$_POST['p_id']; |
|
|
$Res=ExecSql($cn,$sql); |
|
|
// Check return code |
|
|
if ( $Res == false ) { Rollback($cn);exit(-1);} |
|
118 |
|
|
119 |
// Make also the change into jrnx |
// Make also the change into jrnx |
120 |
$sql= "insert into jrnx ( |
$sql= "insert into jrnx ( |
128 |
$Res=ExecSql($cn,$sql); |
$Res=ExecSql($cn,$sql); |
129 |
// Check return code |
// Check return code |
130 |
if ( $Res == false ) { Rollback($cn);exit(-1);} |
if ( $Res == false ) { Rollback($cn);exit(-1);} |
131 |
|
// Mark the operation invalid into the ledger |
132 |
|
// to avoid to nullify twice the same op. |
133 |
|
$sql="update jrn set jr_comment='Annule : '||jr_comment where jr_grpt_id=".$_POST['p_id']; |
134 |
|
$Res=ExecSql($cn,$sql); |
135 |
|
// Check return code |
136 |
|
if ( $Res == false ) { Rollback($cn);exit(-1);} |
137 |
|
|
138 |
// the table stock must updated |
// the table stock must updated |
139 |
// also in the stock table |
// also in the stock table |