Operation Analytic : save_form_plan_vat_nd , check that the total is the same as the VAT ND amount
This commit is contained in:
parent
6b89398bb0
commit
c23357bf32
1 changed files with 12 additions and 13 deletions
|
|
@ -717,16 +717,15 @@ EOF;
|
|||
return $result;
|
||||
}
|
||||
/**
|
||||
* Save the ND VAT with prorata
|
||||
* @brief Save the ND VAT in ANL, and distribute the amount among ANL Axis proportionnaly to the source
|
||||
*
|
||||
* @param $p_array usually $_POST
|
||||
* @param $p_item item of the form
|
||||
* @param $p_j_id jrnx.j_id concerned writing
|
||||
* @param $p_nd amount nd vat
|
||||
* @param $p_array array usually $_POST
|
||||
* @param $p_item int nb of the item of the form
|
||||
* @param $p_j_id int jrnx.j_id concerned writing
|
||||
* @param $p_nd float amount nd vat
|
||||
* @see Anc_Operation::save_form_plan_vat_nd
|
||||
* @return type
|
||||
*/
|
||||
function save_form_plan_vat_nd($p_array,$p_item,$p_j_id,$p_nd)
|
||||
function save_form_plan_vat_nd($p_array,$p_item,$p_j_id,$p_nd):void
|
||||
{
|
||||
bcscale(4);
|
||||
extract($p_array, EXTR_SKIP);
|
||||
|
|
@ -787,12 +786,12 @@ EOF;
|
|||
{
|
||||
$tot=bcadd($tot,$a_Anc_Operation[$i]->oa_amount);
|
||||
}
|
||||
// utilité ???
|
||||
// if ( $tot != $p_nd && count($a_Anc_Operation) > 0 )
|
||||
// {
|
||||
// $diff= bcsub($tot, $p_nd);
|
||||
// $a_Anc_Operation[0]->oa_amount=bcsub($a_Anc_Operation[0]->oa_amount,$diff);
|
||||
// }
|
||||
// security : if tot != nd so the amount is reduced by the difference between computed and max
|
||||
if ( $tot != $p_nd && count($a_Anc_Operation) > 0 )
|
||||
{
|
||||
$diff= bcsub($tot, $p_nd);
|
||||
$a_Anc_Operation[0]->oa_amount=bcsub($a_Anc_Operation[0]->oa_amount,$diff);
|
||||
}
|
||||
for ($i=0;$i<$nb_op;$i++)
|
||||
{
|
||||
$a_Anc_Operation[$i]->add();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue