TWYN#53208 Aanpassen budget reserve
svn path=/Website/branches/v2017.3/; revision=37932
This commit is contained in:
@@ -237,6 +237,42 @@ function model_bgt_budget()
|
||||
{ // Zoek bij wijzigen van kostenplaats de kostenplaatsgrp_key op
|
||||
}
|
||||
|
||||
this.hook_pre_delete = function(params, key)
|
||||
{
|
||||
var key_arr = getFParamIntArray("id");
|
||||
|
||||
var sql_c = "SELECT COUNT(*) aantal"
|
||||
+ " FROM mld_opdr"
|
||||
+ " WHERE prs_kostensoort_key IN"
|
||||
+ " (SELECT prs_kostensoort_key"
|
||||
+ " FROM bgt_budget"
|
||||
+ " WHERE bgt_budget_key IN (" + key_arr.join(",") + ")"
|
||||
+ " )";
|
||||
var oRs_c = Oracle.Execute(sql_c);
|
||||
var nr_mld_opdr = oRs_c("aantal").Value;
|
||||
oRs_c.Close();
|
||||
if (nr_mld_opdr > 0)
|
||||
{
|
||||
// abort_with_warning(L("bgt_budget_delete_val1").format(L("lcl_fin_contracten"))); // De geselecteerde budgetten hebben contracten. Verwijder deze eerst.
|
||||
abort_with_warning("De geselecteerde budgetten hebben contracten. Verwijder deze eerst.");
|
||||
}
|
||||
|
||||
var sql_m = "SELECT COUNT(*) aantal"
|
||||
+ " FROM bgt_budgetmutatie"
|
||||
+ " WHERE bgt_budget_key_naar IN (" + key_arr.join(",") + ")"
|
||||
+ " OR bgt_budget_key_van IN (" + key_arr.join(",") + ")";
|
||||
var oRs_m = Oracle.Execute(sql_m);
|
||||
var nr_mutatie = oRs_m("aantal").Value;
|
||||
oRs_m.Close();
|
||||
if (nr_mutatie > 0)
|
||||
{
|
||||
// abort_with_warning(L("bgt_budget_delete_val1").format(L("bgt_budget_mutaties"))); // De geselecteerde budgetten hebben mutaties. Verwijder deze eerst.
|
||||
abort_with_warning("De geselecteerde budgetten hebben mutaties. Verwijder deze eerst.");
|
||||
}
|
||||
// Er zijn geen contracten of budgetmutaties bij de geselecteerde budget(ten) bekend.
|
||||
// Verwijderen is geen probleem meer.
|
||||
}
|
||||
|
||||
var v_budgetdiscipline = getQParamInt("budgetdiscipline", -1);
|
||||
if (v_budgetdiscipline == -1)
|
||||
{
|
||||
|
||||
@@ -3,6 +3,7 @@ $(document).ready(function () {
|
||||
});
|
||||
|
||||
var kostensoort_btw = 0;
|
||||
var last_account_key = -1;
|
||||
|
||||
function init_budget()
|
||||
{
|
||||
@@ -18,6 +19,7 @@ function init_budget()
|
||||
$("#amount").change( change_amount );
|
||||
$("#vat").change( change_vat );
|
||||
$("#account").change( change_account );
|
||||
$("input#contingency").change( change_contingency );
|
||||
|
||||
|
||||
// budgetdiscipline en budgetproject kunnen ook als gekozen filter worden meegegeven
|
||||
@@ -127,8 +129,9 @@ function change_rubriek()
|
||||
function change_groep()
|
||||
{
|
||||
var groep_key = $("#costtypegroup").val();
|
||||
var is_reserve = !(groep_key > 0); // Als het budget een kostensoortgroep heeft dan is het geen reserve.
|
||||
fill_rubriekselector("S", groep_key);
|
||||
use_contingency(false);
|
||||
use_contingency(is_reserve); // als groep weer leeg is gemaakt mag het budget wel weer reserve zijn/
|
||||
|
||||
fill_opdrachtselector("OP", groep_key);
|
||||
}
|
||||
@@ -212,6 +215,17 @@ function change_account()
|
||||
// Vul de prs_kostenplaatsgrp_key
|
||||
var costgrp_key = $("#account option:selected").attr("par_key");
|
||||
$("#costgroup").val(costgrp_key);
|
||||
|
||||
var account_key = $("#account").val();
|
||||
if (account_key > 0)
|
||||
last_account_key = account_key;
|
||||
}
|
||||
|
||||
function change_contingency()
|
||||
{
|
||||
var is_reserve = $("input#contingency").prop('checked');
|
||||
$("#account").val( is_reserve ? -1 : last_account_key);
|
||||
$("#account").prop("disabled", is_reserve);
|
||||
}
|
||||
|
||||
function fill_opdrachtselector(niveau, parent_key, init_key)
|
||||
@@ -251,6 +265,7 @@ function fill_plaatsselector(niveau, parent_key, init_key)
|
||||
|
||||
function use_contingency(contingency_mode)
|
||||
{
|
||||
// is reservebudget, kan aangezet worden als alleen kostenrubriek is gekozen.
|
||||
if (contingency_mode)
|
||||
{
|
||||
$("input#contingency").prop("disabled", false );
|
||||
@@ -260,6 +275,7 @@ function use_contingency(contingency_mode)
|
||||
$("input#contingency").prop('checked', false);
|
||||
$("input#contingency").prop("disabled", true );
|
||||
}
|
||||
change_contingency();
|
||||
}
|
||||
|
||||
function process_info(data)
|
||||
@@ -307,7 +323,10 @@ function process_info(data)
|
||||
}
|
||||
select.empty().append(new_lov);
|
||||
if (sel_key > -1)
|
||||
{
|
||||
select.val(sel_key);
|
||||
|
||||
if (data.niveau == "KP")
|
||||
last_account_key = sel_key;
|
||||
}
|
||||
//$("input#contingency").prop("disabled", true );
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user