571 |
// Get the default period |
// Get the default period |
572 |
$periode=$p_user->GetPeriode(); |
$periode=$p_user->GetPeriode(); |
573 |
$amount=0.0; |
$amount=0.0; |
574 |
|
$amount_jrn=0.0; |
575 |
// Computing total customer |
// Computing total customer |
576 |
//-- |
//-- |
577 |
for ($i=0;$i<$nb_item;$i++) { |
for ($i=0;$i<$nb_item;$i++) { |
590 |
// The price is valid |
// The price is valid |
591 |
$a_price[$i]=${"e_march$i"."_sell"}; |
$a_price[$i]=${"e_march$i"."_sell"}; |
592 |
} |
} |
593 |
$amount+=$a_price[$i]*$a_quant[$i]; |
$cost=$a_price[$i]*$a_quant[$i]; |
594 |
|
$amount+=$cost; |
595 |
|
// if cost < 0 not added to jr_montant |
596 |
|
$amount_jrn+=($cost<0)?0:$cost; |
597 |
}// for |
}// for |
598 |
|
|
599 |
$comm=FormatString($e_comm); |
$comm=FormatString($e_comm); |
649 |
} |
} |
650 |
} |
} |
651 |
echo_debug(__FILE__,__LINE__,"echeance = $e_ech"); |
echo_debug(__FILE__,__LINE__,"echeance = $e_ech"); |
652 |
$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); |
653 |
if ( $r == false ) { Rollback($p_cn); exit(" Error __FILE__ __LINE__");} |
if ( $r == false ) { Rollback($p_cn); exit(" Error __FILE__ __LINE__");} |
654 |
// Set Internal code and Comment |
// Set Internal code and Comment |
655 |
$internal=SetInternalCode($p_cn,$seq,$p_jrn); |
$internal=SetInternalCode($p_cn,$seq,$p_jrn); |