<%@ language = "JavaScript" %>
<% /*
    $Revision$
    $Id$
    File:             care_calc_dist.asp
    Description:      A deeplink call to CALCulate the DISTance of a 'dagroute'
    Parameters:       p_prs_perslid_key
                      p_datum

*/ %>
<%
var JSON_Result = true;
%>
<!-- #include file="../Shared/common.inc" -->
<!-- #include file="../../appl/shared/json2.js" -->

<%
    var mld_opdr_uren_key = getQParamInt("mld_opdr_uren_key", -1);
    //var p_datum = getQParamDate("p_datum", new Date);
    var message = "";

    sql=" select prs_perslid_key, mld_opdr_uren_datum" +
            " from mld_opdr_uren" +
            " where mld_opdr_uren_key = " + mld_opdr_uren_key;
    oRs = Oracle.Execute(sql);
    var l_prs_perslid_key = oRs("prs_perslid_key").Value;
    var l_mld_opdr_uren_datum = new Date(oRs("mld_opdr_uren_datum").Value);
    oRs.Close();

    // Fictieve insert van kilometers van persoon 'p_prs_perslid_key' op datum 'p_datum'
    var hook = custfunc.gethook();
    if (!hook)
        shared.internal_error("custfunctions.wsc niet goed geregistreerd?"); // lastige configuratiefout anders

    var l_result = hook.fclt_calc_dist_from_google (l_prs_perslid_key, l_mld_opdr_uren_datum, "I");
    hook = null; // vrijgeven voor de GC


    sql=" select mld_opdruren_dagkosten_opm" +
            " from mld_opdruren_dagkosten" +
            " where prs_perslid_key = " + l_prs_perslid_key +
            " and mld_opdruren_dagkosten_datum =" + l_mld_opdr_uren_datum.toSQL();
    oRs = Oracle.Execute(sql);

    //Response.Redirect(oRs("mld_opdruren_dagkosten_opm").Value);
   result = { success : true, message : message }

  Response.Write(JSON.stringify(result));
%>
