<%@ LANGUAGE = JavaScript %>

<% /*
     $Revision$
     $Id$

    File:               mld_opdr_xml.asp
    Description:        XML converter for meldingen and opdrachten
    Parameters:         at least on of the opdr_key or mld_key should be supplied
        opdr_key        optional, key of the order to convert into XML
        mld_key         optional, to indicate that the order has to be printed
    Context:            Called from order_insert.asp and complains.asp
    Note:
*/ %>

<!-- #include file="../Shared/common.inc"-->
<!-- #include file="../Shared/xml_converter.inc" -->
<!-- #include file="./mld.inc" -->

<%
    var mld_key     = getQParamInt("mld_key",-1);
    var opdr_key    = getQParamInt("opdr_key",-1);
    var bedrijf_key = getQParamInt("bedrijf_key",-1);

    if (mld_key == -1)
    {
        var this_mld = mld.func_enabled_opdracht(opdr_key); // faalt wel als zelfs geen leesrechten
        FCLT2XMLResponse({xmlnode: 'opdracht', key: opdr_key, company: bedrijf_key});

        sql = "UPDATE mld_opdr SET mld_opdr_geprint = 1 WHERE mld_opdr_geprint IS NULL AND mld_opdr_key = " + opdr_key;
        Oracle.Execute( sql);

        mld.auto_set_uitgegeven(opdr_key);
    }
    else
    {
        var this_mld = mld.func_enabled_melding(mld_key); // faalt wel als zelfs geen leesrechten

        FCLT2XMLResponse({xmlnode: 'melding', key: mld_key, company: bedrijf_key});

        sql = "UPDATE mld_melding SET mld_melding_geprint = 1 WHERE  mld_melding_geprint IS NULL AND mld_melding_key = " + mld_key;
        Oracle.Execute( sql);
    }
%>
