356 |
echo "<SCRIPT>alert('$msg');</SCRIPT>"; |
echo "<SCRIPT>alert('$msg');</SCRIPT>"; |
357 |
return null; |
return null; |
358 |
} |
} |
359 |
// Periode ferm� |
// Periode fermé |
360 |
if ( PeriodeClosed ($p_cn,$p_periode)=='t' ) |
if ( PeriodeClosed ($p_cn,$p_periode)=='t' ) |
361 |
{ |
{ |
362 |
$msg="This periode is closed please change your preference"; |
$msg="This periode is closed please change your preference"; |
558 |
// Get the default period |
// Get the default period |
559 |
$periode=$p_user->GetPeriode(); |
$periode=$p_user->GetPeriode(); |
560 |
$amount=0.0; |
$amount=0.0; |
561 |
|
$amount_jrn=0.0; |
562 |
// Computing total customer |
// Computing total customer |
563 |
for ($i=0;$i<$nb_item;$i++) { |
for ($i=0;$i<$nb_item;$i++) { |
564 |
// store quantity & goods in array |
// store quantity & goods in array |
576 |
// The price is valid |
// The price is valid |
577 |
$a_price[$i]=${"e_march$i"."_sell"}; |
$a_price[$i]=${"e_march$i"."_sell"}; |
578 |
} |
} |
579 |
$amount+=$a_price[$i]*$a_quant[$i]; |
$cost=$a_price[$i]*$a_quant[$i]; |
580 |
|
$amount+=$cost; |
581 |
|
// if cost < 0 => not added to jrn.jr_amount |
582 |
|
$amount_jrn+=($cost<0)?0:$cost; |
583 |
} |
} |
584 |
$comm=FormatString($e_comm); |
$comm=FormatString($e_comm); |
585 |
$a_vat=ComputeVat($p_cn,$a_good,$a_quant,$a_price,$a_vat); |
$a_vat=ComputeVat($p_cn,$a_good,$a_quant,$a_price,$a_vat); |
633 |
} |
} |
634 |
} |
} |
635 |
echo_debug(__FILE__,__LINE__,"echeance = $e_ech"); |
echo_debug(__FILE__,__LINE__,"echeance = $e_ech"); |
636 |
$r=InsertJrn($p_cn,$e_date,$e_ech,$p_jrn,"Invoice",round($amount,2)+round($sum_vat,2),$seq,$periode); |
$r=InsertJrn($p_cn,$e_date,$e_ech,$p_jrn,"Invoice",round($amount_jrn,2)+round($sum_vat,2),$seq,$periode); |
637 |
if ( $r == false ) { Rollback($p_cn); exit(" Error __FILE__ __LINE__");} |
if ( $r == false ) { Rollback($p_cn); exit(" Error __FILE__ __LINE__");} |
638 |
// Set Internal code and Comment |
// Set Internal code and Comment |
639 |
$internal=SetInternalCode($p_cn,$seq,$p_jrn); |
$internal=SetInternalCode($p_cn,$seq,$p_jrn); |