<% /*
    $Revision$
    $Id$

    File:           model_mld_opdr_materiaal.inc

    Description:

    Context:        Alleen voor gebruik als include.

    Notes:
*/
%>
<%

function model_mld_opdr_materiaal()
{
    this.records_name = "issueordermaterials";
    this.record_name = "issueordermaterial";
    this.table = "mld_opdr_materiaal";
    this.primary = "mld_opdr_materiaal_key";
    this.record_title = L("mld_opdr_materiaal");
    this.records_title = L("mld_opdr_materiaal_m");


    this.fields = {
        "id": {
            "dbs": "mld_opdr_materiaal_key",
            "label": L("lcl_key"),
            "typ": "key",
            "required": true,
            "seq": "mld_s_mld_opdr_materiaal_key"
        },
        "order": {
            "dbs": "mld_opdr_key",
            "label": L("lcl_mld_opdr"),
            "typ": "key"
        },
        "seq": {
            "dbs": "mld_opdr_materiaal_id",  // materiaal volgnummer binnen opdracht
            "label": L("lcl_mld_opdr_id"),
            "typ": "number"
        },
        "code": {
            "dbs": "mld_opdr_materiaal_code",
            "label": L("lcl_mld_opdr_code"),
            "typ": "varchar"
        },
        "group": {
            "dbs": "mld_opdr_materiaal_groep",
            "label": L("lcl_mld_opdr_groep"),
            "typ": "varchar"
        },
        "listdefined": {
            "dbs": "fac_usrdata_key",
            "label": L("mld_opdr_materiaal_oms"),
            "typ": "key",
            "foreign": {
                "tbl": "fac_usrdata",
                "key": "fac_usrdata_key",
                "desc": "fac_usrdata_omschr"
            }
        },
        "userdefined": {
            "dbs": "mld_opdr_materiaal_omschr",
            "label": L("lcl_mld_opdr_omschr"),
            "typ": "varchar",
            "required": true
        },
        "price": {
            "dbs": "mld_opdr_materiaal_prijs",
            "label": L("lcl_mld_opdr_prijs"),
            "typ": "currency"
        },
        "vat_perc": {
            "dbs": "fin_btwtabelwaarde_key",
            "sql": "(SELECT fin_btwtabelwaarde_perc FROM fin_btwtabelwaarde where fin_btwtabelwaarde_key = mld_opdr_materiaal.fin_btwtabelwaarde_key)",
            "label": L("lcl_fin_btwtabelwaarde_perc"),
            "typ": "float"
        },
        "quantity": {
            "dbs": "mld_opdr_materiaal_aantal",
            "label": L("lcl_mld_opdr_aantal"),
            "typ": "float"
        },
        "unit": {
            "dbs": "mld_opdr_materiaal_eenheid",
            "label": L("lcl_mld_opdr_eenheid"),
            "typ": "varchar"
        },
        "unitcode": {
            "dbs": "mld_opdr_materiaal_eenheidcode",
            "label": L("lcl_mld_opdr_eenheidcode"),
            "typ": "varchar"
        },
        "info": {
            "dbs": "mld_opdr_materiaal_info",
            "label": L("lcl_mld_opdr_info"),
            "typ": "memo"
        },
        "extra1": {
            "dbs": "mld_opdr_materiaal_extra1",
            "label": L("lcl_mld_opdr_extra1"),
            "typ": "varchar"
        },
        "extra2": {
            "dbs": "mld_opdr_materiaal_extra2",
            "label": L("lcl_mld_opdr_extra2"),
            "typ": "varchar"
        },
        "extra3": {
            "dbs": "mld_opdr_materiaal_extra3",
            "label": L("lcl_mld_opdr_extra3"),
            "typ": "memo"
        },
        "extra4": {
            "dbs": "mld_opdr_materiaal_extra4",
            "label": L("lcl_mld_opdr_extra4"),
            "typ": "memo"
        },
        "externnr": {
            "dbs": "mld_opdr_materiaal_externnr",
            "label": L("extern_nr"),
            "typ": "varchar",
            "readonly": !(user.has("WEB_FACTAB") || user.has("WEB_FACXNR"))
        },
        "externsyncdate": {
            "dbs": "mld_opdr_materiaal_extsyncdate",
            "label": L("extern_syncdate"),
            "typ": "datetime",
            "readonly": !(user.has("WEB_FACTAB") || user.has("WEB_FACXNR"))
        }
    };


    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);
}
%>