<%@ LANGUAGE = JavaScript %>
<% /*
     $Revision$
     $Id$

    File:        bes_assmon_search.asp
    Description: Assortiment monitoring artikelen
    Parameters:
    Context:
    Note:

*/ %>

<!-- #include file="../Shared/common.inc" -->
<!-- #include file="../Shared/iface.inc" -->
<!-- #include file="../Shared/plaatsselector.inc" -->
<!-- #include file="../Shared/bedrijfselector.inc" -->
<!-- #include file="../Shared/selector.inc" -->
<!-- #include file="../Shared/calendar.inc" -->
<!-- #include file="bes.inc" -->

<%
FCLTHeader.Requires({ plugins:["jQuery"] });

var authparams = user.checkAutorisation("WEB_BESMSU");

var disc_key = getQParamInt("disc_key", -1); // Discipline
var srtgroep_key = getQParamInt("srtgroep_key", -1);
%>

<html>
  <head>
    <%  FCLTHeader.Generate(); %>
      <script type="text/javascript">
          function doSubmit()
            {
                if (!validateForm("u2"))
                    return false;
                document.forms.u2.submit();
            }
      </script>
  </head>
  <body id="searchbody">
    <div id="search">
      <form name="u2" target="workFrame" action="bes_klantmon_search_list.asp" method="get">
<%    BLOCK_START("searchtable", L("lcl_filterblok"));%>
          <tr>
            <td class="searchkolom1">
              <table><!-- x rijen, 2 kolommen: label + veld -->
<%
              sql = "SELECT prs_bedrijf_key, prs_bedrijf_naam||' '||prs_bedrijf_bezoek_plaats prs_bedrijf_naam"
                  + "  FROM prs_v_aanwezigbedrijf b"
                  + " WHERE prs_bedrijf_intern=1"  // of contract=1?
                  + " ORDER BY b.prs_bedrijf_naam_upper";
              FCLTselector("klant_key",
                           sql,
                           { label: L("lcl_company"),
                             trclass: "primsearch",
                             emptyOption: L("lcl_select_bedrijf"),
                             required: true
                           });
             RWCHECKBOXTR( "matchonly", "fldmatchonly", L("lcl_bes_assortiment_matchonly"), true, { trclass: "primsearch" });
%>
              <tr class="primsearch">
                <td class="label"><label for="searchtext"><%=L("lcl_bes_srtprod")%>:</label></td>
                <td><input type="text" class="fldsrch" name="searchtext" id="searchtext"></td>
              </tr>
<%

              sql = "SELECT bsg.bes_srtgroep_key, "
                  + "       bsg.bes_srtgroep_omschrijving"  // LCL
                  + "  FROM ins_tab_discipline b, bes_srtgroep bsg"
                  + " WHERE ins_discipline_module = 'PRD'"
                  + "   AND ins_discipline_verwijder IS NULL"
                  + "   AND b.ins_discipline_key=bsg.ins_discipline_key"
                  + " ORDER BY bsg.bes_srtgroep_omschrijving";  // LCL

              FCLTselector("srtgroep",      // Suggest maken
                           sql,
                           { initKey: srtgroep_key,
                             label: L("lcl_bes_srtgroup"),
                             trclass: "primsearch",
                             multi: true,
                             emptyOption: L("lcl_search_generic")
                           });

              FCLTcalendar( "bes_peildat1",
                            { label  : L("lcl_bes_peildatum1")
                            });
              FCLTcalendar( "bes_peildat2",
                            { label  : L("lcl_bes_peildatum2"),
                              initEmpty: true
                            });

             RWCHECKBOXTR("pctkolom",  "fldpctkolom",L("lcl_bes_metverschil"), false, { trclass: "secsearch" });
             RWCHECKBOXTR("brutokolom", "fldbrutokolom", L("lcl_bes_metbruto"), false, { trclass: "secsearch" });

%>
              </table>
            </td><!-- end column 1 -->

            <td class="searchkolom2">
              <table><!-- x rijen, 2 kolommen: label + veld -->
<%
             RWCHECKBOXTR("huidigfact", "fldhuidigfact", L("lcl_bes_huidigfact"), false, { trclass: "primsearch" });

              sql = "SELECT prs_bedrijf_key, prs_bedrijf_naam||' '||prs_bedrijf_bezoek_plaats prs_bedrijf_naam"
                  + "  FROM prs_v_aanwezigbedrijf b"
                  + " WHERE b.prs_bedrijf_key IN (SELECT prs_bedrijf_key FROM bes_srtdeel)"
                  + " ORDER BY b.prs_bedrijf_naam_upper";
              FCLTselector("lev_keys",
                           sql,
                           { label: L("lcl_bes_Supplier"),
                             trclass: "primsearch",
                             emptyOption: L("lcl_none"),
                             multi: true,
                             size: 7
                           });
             RWCHECKBOXTR("compleetonly", "fldcompleetonly", L("lcl_bes_compleetonly"), false, { trclass: "primsearch" });
             RWCHECKBOXTR("prijspeil", "fldprijspeil",L("lcl_bes_metprijspeil"), false, { trclass: "primsearch" });

%>
              </table>
            </td><!-- end column 1 -->
          </tr>
<%    BLOCK_END();

  var buttons =  [ {title: L("lcl_search"), action: "doSubmit()", id: "bSearch" } ];
  buttons.push ( {title: L("lcl_shared_more"),  action:"iface_toggleSecondarySearchblock()", id : "btnMoreLess" } );
  CreateButtons(buttons, { entersubmit: true});
%>
      </form>
    </div> <!-- search -->

    <div id="result">
      <iframe width="100%" height="100%"
              src="../Shared/empty.asp"
              name="workFrame" id="workFrame"
              onload="FcltMgr.iframeLoaded(this)"
              frameborder="0" scrolling="no">
      </iframe>
    </div>
  </body>
</html>
