TWYN#54070 filters budgetmutatie doorgeven aan toevoegen mutatie

svn path=/Website/branches/v2018.1/; revision=38593
This commit is contained in:
Erik Groener
2018-07-20 10:37:39 +00:00
parent 431ef76939
commit 5340800a5b
2 changed files with 27 additions and 16 deletions

View File

@@ -90,7 +90,8 @@ function model_bgt_budgetmutatie()
"sequence": {
"dbs": "bgt_budgetmutatie_volgnr",
"label": L("bgt_budgetmutatie_volgnr"),
"typ": "number"
"typ": "number",
"readonly": true
},
"ident": {
"dbs": "bgt_budgetmutatie_identity",
@@ -198,14 +199,6 @@ function model_bgt_budgetmutatie()
"iscurrency": true,
"total": true
},
"amountdifference": {
"dbs": "bgt_budget_bedrag_verschil",
"sql": "BGT.getSoortMutatie(bgt_budgetmutatie_key)",
"label": L("bgt_budgetmutatie"),
"typ": "float",
"readonly": true,
"iscurrency": true
},
"budgetdiscipline": {
"dbs": "bgt_budget.ins_discipline_key",
"label": L("bgt_discipline_omschrijving"),
@@ -243,8 +236,7 @@ function model_bgt_budgetmutatie()
"amountto",
"vatto",
"amountexc",
"amountvat",
"amountdifference"
"amountvat"
]
};
@@ -315,6 +307,26 @@ function model_bgt_budgetmutatie()
this.hook_post_post = function (params, jsondata, key)
{
// Alleen handmatig toegevoegde mutatie krijgen een volgnummer.
// Deze zijn uniek binnen het subproject.
var sql = "UPDATE bgt_budgetmutatie"
+ " SET bgt_budgetmutatie_volgnr ="
+ " (SELECT COALESCE(MAX(bgt_budgetmutatie_volgnr),0) + 1"
+ " FROM bgt_budget b"
+ " , bgt_budgetmutatie m"
+ " WHERE ( b.bgt_budget_key = m.bgt_budget_key_naar"
+ " OR b.bgt_budget_key = m.bgt_budget_key_van"
+ " )"
+ " AND b.bgt_project_key = (SELECT bs.bgt_project_key"
+ " FROM bgt_budget bs"
+ " , bgt_budgetmutatie ms"
+ " WHERE bs.bgt_budget_key = ms.bgt_budget_key_van"
+ " AND ms.bgt_budgetmutatie_key = " + key
+ ")"
+ " )"
+ " WHERE bgt_budgetmutatie_key = " + key;
Oracle.Execute(sql);
// Haal de budget-keys voor correctie uit het mutatierecord.
var sql = "SELECT bgt_budget_key_van"
+ " , bgt_budget_key_naar"
@@ -467,7 +479,7 @@ function model_bgt_budgetmutatie()
}
}
function insertMutatie(data_mutatie, mutatie_code)
function insertMutatie(data_mutatie, mutatie_soort)
{
if (data_mutatie.bedrag_exc != 0 || data_mutatie.bedrag_btw != 0)
{
@@ -484,7 +496,7 @@ function model_bgt_budgetmutatie()
var mutatie_omschr = "";
var mutatie_code = "";
switch (mutatie_code)
switch (mutatie_soort)
{
case "AO": mutatie_omschr = "AO Automatische overboeking";
mutatie_code = "A";
@@ -517,7 +529,7 @@ function model_bgt_budgetmutatie()
+ ", " + (-1 * data_mutatie.bedrag_exc)
+ ", " + (-1 * data_mutatie.bedrag_btw)
+ ", 1"
+ ", " + mutatie_code
+ ", " + safe.quoted_sql(mutatie_code)
+ ")";
Oracle.Execute(sql_m);
}

View File

@@ -44,8 +44,7 @@ scaffolding(this_model,
"budgetfrom",
"budgetto",
"amountexc",
"amountvat",
"amountdifference"
"amountvat"
],
"orderby": [
"code",