TWYN#56304 cijfers kloppen niet bij automatische overboekingen van/naar reserve
svn path=/Website/branches/v2018.2/; revision=40717
This commit is contained in:
@@ -886,15 +886,16 @@ obj._is_clone=2 --> nieuwe sub-opdracht
|
||||
amount_sum_btw = amount_sum_btw - data_vat;
|
||||
}
|
||||
|
||||
var sql = "SELECT SUM(m1.bgt_budget_bedrag_van) reserve_exc"
|
||||
+ " , SUM(m1.bgt_budget_btwbedrag_van) reserve_btw"
|
||||
// Haal het totaal aan mutaties op reserve op bij dit budget.
|
||||
var sql = "SELECT COALESCE(SUM(m1.bgt_budget_bedrag_van), 0) reserve_exc"
|
||||
+ " , COALESCE(SUM(m1.bgt_budget_btwbedrag_van), 0) reserve_btw"
|
||||
+ " FROM bgt_budget b1"
|
||||
+ " , bgt_budget b2"
|
||||
+ " , bgt_budgetmutatie m1"
|
||||
+ " WHERE b2.bgt_budget_isreserve = 1"
|
||||
+ " AND b1.bgt_project_key = b2.bgt_project_key"
|
||||
+ " AND m1.bgt_budget_key_van = b2.bgt_budget_key"
|
||||
+ " AND m1.bgt_budget_Key_naar = b1.bgt_budget_key"
|
||||
+ " AND m1.bgt_budget_key_naar = b1.bgt_budget_key"
|
||||
+ " AND b1.prs_kostensoort_key = " + data_budget.costtype_key;
|
||||
var oRs = Oracle.Execute(sql);
|
||||
var reserve_exc = oRs("reserve_exc").Value;
|
||||
@@ -914,7 +915,22 @@ obj._is_clone=2 --> nieuwe sub-opdracht
|
||||
{
|
||||
// verlaging contractwaarde exc
|
||||
var overschot_exc = reserve_exc - (data_amount - amount_old_exc);
|
||||
bedrag_exc = -1 * (overschot_exc > 0 ? reserve_exc : (data_amount - amount_old_exc) );
|
||||
|
||||
if (overschot_exc > 0)
|
||||
{
|
||||
if (reserve_exc == 0) // reserve_exc is altijd kleiner of gelijk aan nul
|
||||
{
|
||||
bedrag_exc = data_amount - amount_old_exc;
|
||||
}
|
||||
else
|
||||
{
|
||||
bedrag_exc = -1 * reserve_exc;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
bedrag_exc = -1 * (data_amount - amount_old_exc);
|
||||
}
|
||||
}
|
||||
//
|
||||
if (amount_old_btw < data_vat)
|
||||
@@ -944,8 +960,8 @@ obj._is_clone=2 --> nieuwe sub-opdracht
|
||||
var voor_debug = false;
|
||||
if (voor_debug)
|
||||
{
|
||||
__Log("insertMutatie: "+mutatie_soort);
|
||||
__Log(data_mutatie);
|
||||
//__Log("insertMutatie: "+mutatie_soort);
|
||||
//__Log(data_mutatie);
|
||||
var sql_nr = "SELECT COALESCE(MAX(m.bgt_budgetmutatie_volgnr), 0)+1 volgnr"
|
||||
+ " FROM bgt_budgetmutatie m"
|
||||
+ " , bgt_budget b"
|
||||
|
||||
Reference in New Issue
Block a user