From 5340800a5b487a4424d772ec02857f5138c82b94 Mon Sep 17 00:00:00 2001 From: Erik Groener Date: Fri, 20 Jul 2018 10:37:39 +0000 Subject: [PATCH] TWYN#54070 filters budgetmutatie doorgeven aan toevoegen mutatie svn path=/Website/branches/v2018.1/; revision=38593 --- APPL/API2/model_bgt_budgetmutatie.inc | 40 +++++++++++++++++---------- APPL/BGT/bgt_budgetmutatie.asp | 3 +- 2 files changed, 27 insertions(+), 16 deletions(-) diff --git a/APPL/API2/model_bgt_budgetmutatie.inc b/APPL/API2/model_bgt_budgetmutatie.inc index 3d63a069b0..2849ed2e90 100644 --- a/APPL/API2/model_bgt_budgetmutatie.inc +++ b/APPL/API2/model_bgt_budgetmutatie.inc @@ -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); } diff --git a/APPL/BGT/bgt_budgetmutatie.asp b/APPL/BGT/bgt_budgetmutatie.asp index a1c905349a..b5f4d2bb6e 100644 --- a/APPL/BGT/bgt_budgetmutatie.asp +++ b/APPL/BGT/bgt_budgetmutatie.asp @@ -44,8 +44,7 @@ scaffolding(this_model, "budgetfrom", "budgetto", "amountexc", - "amountvat", - "amountdifference" + "amountvat" ], "orderby": [ "code",