205 lines
5.6 KiB
PHP
205 lines
5.6 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()
|
|
},
|
|
"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": 1
|
|
},
|
|
"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.includes = {
|
|
"mutations": {
|
|
"model": new model_bgt_budgetmutatie(),
|
|
"joinfield": "budgetto",
|
|
"enable_update": true
|
|
}
|
|
}
|
|
*/
|
|
|
|
/*
|
|
var budget_key = getQParamInt("budget", -1);
|
|
if (budget_key > 0)
|
|
{
|
|
this.includes = {
|
|
"mutations": {
|
|
"model": new model_bgt_budgetmutatie(),
|
|
"joinfunction": function()
|
|
{
|
|
return "( bgt_budget_key_van = {0} OR bgt_budget_key_naar = {0})".format(budget_key)
|
|
},
|
|
"enable_update": true
|
|
}
|
|
}
|
|
}
|
|
*/
|
|
|
|
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);
|
|
}
|
|
%> |