Files
Facilitor/APPL/API2/model_bgt_budget.inc
Erik Groener 56019c27c8 FSN#39055 BCS/2000 functionaliteit in FACILITOR - customization
svn path=/Website/branches/v2017.1/; revision=34568
2017-07-07 11:24:32 +00:00

194 lines
5.5 KiB
PHP

<% /*
$Revision$
$Id$
File: model_bgt_budget.inc
Description: Model voor bgt_budget
Context:
Notes:
*/
%>
<!-- #include file="../bgt/bgt_tools.inc" -->
<!-- #include file="../api2/model_bgt_budgetmutatie.inc" -->
<%
function model_bgt_budget()
{
this.records_name = "budgets";
this.record_name = "budget";
this.table = "bgt_budget";
this.primary = "bgt_budget_key";
this.autfunction = "WEB_BGTUSE";
this.record_title = L("bgt_budget");
this.records_title = L("bgt_budget_m");
this.fields = {
"id": {
"dbs": "bgt_budget_key",
"label": L("lcl_key"),
"typ": "key",
"hidden_fld": true,
"required": true,
"filter": "exact",
"seq": "bgt_s_bgt_budget_key"
},
"budgetdiscipline": {
"dbs": "ins_discipline_key",
"label": L("bgt_discipline_omschrijving"),
"typ": "key",
"required": true,
"insertonly": true,
"foreign": bgt_budgetdiscipline_foreign(),
"emptyoption": null
},
"budgetproject": {
"dbs": "bgt_project_key",
"label": L("bgt_project_omschrijving"),
"typ": "key",
"required": true,
"insertonly": true,
"foreign": bgt_budgetproject_foreign(),
"emptyoption": null
},
"budgetcostcategory": {
"dbs": "bgt_kostenrubriek_key",
"label": L("bgt_kostenrubriek_oms"),
"typ": "key",
"required": false,
"insertonly": true,
"foreign": bgt_budgetcostcategory_foreign()
},
"costtypegroup": {
"dbs": "prs_kostensoortgrp_key",
"label": L("prs_kostensoortgrp_key"),
"typ": "key",
"required": false,
"insertonly": true,
"foreign": bgt_costtypegroup_foreign(),
"LOVinit": "",
"filter": "exact"
},
"costtype": {
"dbs": "prs_kostensoort_key",
"label": L("prs_kostensoort_key"),
"typ": "key",
"required": false,
"insertonly": true,
"foreign": bgt_costtype_foreign()
},
"amountoriginal": {
"dbs": "bgt_budget_bedrag_origineel",
"sql": "(BGT.getBudgetOpDatum(bgt_budget.bgt_budget_key, NULL))",
"label": L("bgt_budget_origineel"),
"typ": "float",
"iscurrency": true,
"total": true
},
"amountmutation": {
"dbs": "bgt_budget_bedrag_mutatie",
"sql": "(BGT.getBudgetMutaties(bgt_budget.bgt_budget_key, NULL, NULL))",
"label": L("bgt_budget_mutaties"),
"typ": "float",
"iscurrency": true,
"total": true
},
"amount": {
"dbs": "bgt_budget_bedrag",
"label": L("bgt_budget_bedrag"),
"typ": "float",
"iscurrency": true,
"total": true,
"required": true
},
"vat": {
"dbs": "bgt_budget_btwbedrag",
"label": L("bgt_budget_btwbedrag"),
"typ": "float",
"iscurrency": true,
"total": true,
"required": true
},
"contingency": {
"dbs": "bgt_budget_isreserve",
"label": L("bgt_budget_isreserve"),
"typ": "check0",
"defaultvalue": 0
},
"begin": {
"dbs": "bgt_budget_begin",
"label": L("bgt_budget_begin"),
"typ": "date",
"required": false
},
"end": {
"dbs": "bgt_budget_eind",
"label": L("bgt_budget_eind"),
"typ": "date",
"required": false
},
"costgroup": {
"dbs": "prs_kostenplaatsgrp_key",
"label": L("bgt_budget_accountgrp"),
"typ": "key",
"foreign": {
"tbl": "prs_kostenplaatsgrp",
"key": "prs_kostenplaatsgrp_key",
"desc": "prs_kostenplaatsgrp_oms"
},
"hidden_fld": true
},
"account": {
"dbs": "prs_kostenplaats_key",
"label": L("bgt_budget_account"),
"typ": "key",
"foreign": {
"tbl": "prs_kostenplaats",
"key": "prs_kostenplaats_key",
"desc": "prs_kostenplaats_nr"
}
}
};
this.edit = {
// "modal": true
};
this.list = {
"columns": [
"budgetcostcategory",
"costtypegroup",
"costtype",
"amount",
"vat"
]
};
this.hook_pre_edit = function (obj, fld)
{
if (obj.id > -1)
{
fld.amount.readonly = true;
fld.vat.readonly = true;
}
}
this.hook_pre_post = function(params, obj)
{
// Wordt alleen gebruikt bij toevoegen.
}
this.hook_pre_put = function(params, obj, key)
{ // Zoek bij wijzigen van kostenplaats de kostenplaatsgrp_key op
}
this.REST_GET = generic_REST_GET(this);
this.REST_POST = generic_REST_POST(this);
this.REST_PUT = generic_REST_PUT(this);
this.REST_DELETE = generic_REST_DELETE(this);
}
%>