<%@language = "javascript" %>
<% /*
    $Revision$
    $Id$

    File:           mld_discipline.asp

    Description:    fac_management aanroep van model_mld_discipline

    Context:

    Notes:
*/
%>
<!-- #include file="../scf/scaffolding.inc" -->
<!-- #include file="../api2/model_mld_discipline.inc" -->
<%
var scf_mode = getQParam("mode", "");

var disc_key = getQParamInt("id", -1);
var this_model = new model_mld_discipline();
var objModel =
    {
        "search": {
            "autosearch": true,
            "filters": [
                "name",
                "disciplinetype",
                "srtgroep"
            ],
            "transit": [
                "disciplinetype"
            ]
        },
        "list": {
            "columns": [
                "id",
                "name",
                "disciplinetype",
                "srtgroep",
                "costtype"

            ]
        },
        "wrap": {
            "frames": [
                {
                    url: "fac_functie.asp?mode=list&ins_discipline={0}",
                    title: L("fac_functie_m"),
                    autfunction: "WEB_PRSSYS"
                }
            ]
        },
        "edit": {
            "requires": {
                "js": ["./ins_discipline.js"]
            }
        },
        "layout": {
            "block": [
                {   "blockid": "insIns",
                    "label": L("lcl_mld_vakgroep"),
                    "icon": "fa-tags",
                    "ishtmlsafe": true,
                    "hidden": false,
                    "buttons": [],
                    "fields": [
                        "id",
                        "disciplinetype",
                        "name",
                        "sequence",
                        "module",
                        "adjuststartdate",
                        "foprocess",
                        "forward",
                        "frontendpriority",
                        "canbepublished",
                        "backofficegroup",
                        "backofficeprimary",
                        "srtgroep",
                        "issuegroup",
                        "autooffer",
                        "activity",
                        "fenotes",
                        "satisfactionpercentage",
                        "satisfactionthreshold",
                        "colors",
                        "symbolname",
                        "externnr"
                    ]
                },
                {
                    "blockid": "mldIns",
                    "label": L("mld_discipline_notification"),
                    "icon" : "fa-bell-on",
                    "ishtmlsafe": true,
                    "hidden": false,
                    "buttons": [],
                    "fields": [
                        "emailnew1",
                        "smsnew1",
                        "emailnew2",
                        "smsnew2",
                        "emailnew3",
                        "smsnew3",
                        "notifycust",
                        "notifybo",
                        "notifybht",
                        "notifybe",
                        "notifynob",
                        "reminderdays",
                        "email",
                        "offhours"
                    ]
                },
                {   "blockid": "insIns",
                    "label": L("lcl_facmgt_fin"),
                    "icon" : "fa-coins",
                    "ishtmlsafe": true,
                    "hidden": false,
                    "buttons": [],
                    "fields": [
                        "issuediscipline",
                        "orderlimit1",
                        "orderlimit2",
                        "orderlimit3",
                        "orderlimit4",
                        "orderlimit5",
                        "owncost",
                        "chargebudget",
                        "costtype",
                        "costcentremandatory",
                        "mandatoryfrom"
                    ]
                },
                {   "blockid": "mldIns",
                    "label": L("mld_discipline_match"),
                    "icon" : "fa-tasks",
                    "ishtmlsafe": true,
                    "hidden": false,
                    "buttons": [],
                    "fields": [
                        "invoicemarginpct",
                        "invoicemargin",
                        "invoicematchmode",
                        "invoiceapprove",
                        "invoicebelow"
                    ]
                }
            ]
        }
    };

    if (scf_mode == "wrap" && disc_key > -1)
    {
        var disc_oRs = Oracle.Execute("SELECT 1 "
                                    + " FROM ins_tab_discipline td, mld_disc_params dp "
                                    + "WHERE td.ins_discipline_key = dp.mld_ins_discipline_key"
                                    + "  AND td.ins_discipline_key = " + disc_key
                                    + "  AND BITAND(dp.mld_disc_params_srtgroep, 5) = 5"); // 4+1=primair+kan ik behandelteams hebben, 2=kan ik behandelteam zijn
        if (disc_oRs.EOF)
        {
            delete this_model.includes["disciplines1"];
        }
        disc_oRs.Close();
        var disc_oRs = Oracle.Execute("SELECT 1 "
                                    + " FROM ins_tab_discipline td, mld_disc_params dp "
                                    + "WHERE td.ins_discipline_key = dp.mld_ins_discipline_key"
                                    + "  AND td.ins_discipline_key = " + disc_key
                                    + "  AND BITAND(dp.mld_disc_params_srtgroep, 2) = 2"); // 4+1=primair+kan ik behandelteams hebben, 2=kan ik behandelteam zijn
        if (disc_oRs.EOF)
        {
            delete this_model.includes["disciplines2"];
        }
    }

    scaffolding(this_model, objModel)
%>
<% ASPPAGE_END(); %>
