<%@ Page Language="C#" Culture="de-DE" AutoEventWireup="true" CodeBehind="VaR.aspx.cs" Inherits="OlympiaIntranet.VaR" %>

<%@ Register Assembly="DevExpress.Web.v23.2, Version=23.2.3.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a" Namespace="DevExpress.Data.Linq" TagPrefix="dx" %>
<%@ Register Assembly="DevExpress.Web.v23.2, Version=23.2.3.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a" Namespace="DevExpress.Web" TagPrefix="dx" %>
<!DOCTYPE html>

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title></title>
</head>
<body>
    <form id="form1" runat="server">
        <div>
            <dx:ASPxFormLayout ID="formLayoutTitoli" runat="server" ColCount="1" EnableTheming="True" Theme="Aqua">
                <Items>
                    <dx:LayoutGroup Caption="VaR Titoli" ColCount="4" GroupBoxDecoration="Box">
                        <Items>
                            <dx:LayoutItem Caption="Titolo" ColSpan="1">
                                <LayoutItemNestedControlCollection>
                                    <dx:LayoutItemNestedControlContainer runat="server">
                                        <dx:ASPxGridLookup ID="gridlookupTitoli" runat="server" Theme="Aqua" AutoGenerateColumns="False" DataSourceID="SqlDSTitoli" IncrementalFilteringDelay="200" IncrementalFilteringMode="Contains" KeyFieldName="cod_tit" TextFormatString="{0} {2}">
                                            <GridViewProperties>
                                                <SettingsBehavior AllowFocusedRow="True" AllowSelectSingleRowOnly="True" />
                                                <EditFormLayoutProperties ColCount="1">
                                                </EditFormLayoutProperties>
                                            </GridViewProperties>
                                            <Columns>
                                                <dx:GridViewDataTextColumn FieldName="cod_tit" Caption="Titolo" ShowInCustomizationForm="True" VisibleIndex="0">
                                                </dx:GridViewDataTextColumn>
                                                <dx:GridViewDataTextColumn FieldName="des_tit" Caption="Descrizione" ShowInCustomizationForm="True" VisibleIndex="2">
                                                </dx:GridViewDataTextColumn>
                                                <dx:GridViewDataTextColumn Caption="ISIN" FieldName="cod_isin" ShowInCustomizationForm="True" VisibleIndex="1">
                                                </dx:GridViewDataTextColumn>
                                            </Columns>
                                        </dx:ASPxGridLookup>
                                    </dx:LayoutItemNestedControlContainer>
                                </LayoutItemNestedControlCollection>
                            </dx:LayoutItem>
                            <dx:LayoutItem Caption="" ColSpan="1">
                                <LayoutItemNestedControlCollection>
                                    <dx:LayoutItemNestedControlContainer runat="server">
                                        <dx:ASPxButton ID="btnQueryVarTitolo" runat="server" Theme="Aqua" OnClick="btnQueryVarTitolo_Click">
                                            <Image IconID="functionlibrary_lookupreference_16x16">
                                            </Image>
                                        </dx:ASPxButton>
                                    </dx:LayoutItemNestedControlContainer>
                                </LayoutItemNestedControlCollection>
                            </dx:LayoutItem>
                            <dx:LayoutItem Caption="VaR (95%)" ColSpan="1">
                                <LayoutItemNestedControlCollection>
                                    <dx:LayoutItemNestedControlContainer runat="server">
                                        <dx:ASPxTextBox ID="tbVar95Titolo" runat="server" Theme="Aqua" ReadOnly="True" DisplayFormatString="n2">
                                        </dx:ASPxTextBox>
                                    </dx:LayoutItemNestedControlContainer>
                                </LayoutItemNestedControlCollection>
                            </dx:LayoutItem>
                            <dx:LayoutItem Caption="VaR (99%)" ColSpan="1">
                                <LayoutItemNestedControlCollection>
                                    <dx:LayoutItemNestedControlContainer runat="server">
                                        <dx:ASPxTextBox ID="tbVar99Titolo" runat="server" Theme="Aqua" ReadOnly="True" DisplayFormatString="n2">
                                        </dx:ASPxTextBox>
                                    </dx:LayoutItemNestedControlContainer>
                                </LayoutItemNestedControlCollection>
                            </dx:LayoutItem>
                            <dx:LayoutItem Caption="Status" ColSpan="4">
                                <LayoutItemNestedControlCollection>
                                    <dx:LayoutItemNestedControlContainer runat="server">
                                        <dx:ASPxMemo ID="memoStatusTitolo" runat="server" Width="100%" Rows="4" Theme="Aqua" ReadOnly="True">
                                        </dx:ASPxMemo>
                                    </dx:LayoutItemNestedControlContainer>
                                </LayoutItemNestedControlCollection>
                            </dx:LayoutItem>
                        </Items>
                    </dx:LayoutGroup>
                </Items>
            </dx:ASPxFormLayout>
            <dx:ASPxFormLayout ID="formLayoutPortafogli" runat="server" EnableTheming="True" Theme="Aqua">
                <Items>
                    <dx:LayoutGroup Caption="VaR Portafoglio" ColCount="6" GroupBoxDecoration="Box" ColumnCount="6">
                        <Items>
                            <dx:LayoutItem Caption="Portafoglio" ColSpan="1" HorizontalAlign="Left" VerticalAlign="Middle" RequiredMarkDisplayMode="Hidden">
                                <LayoutItemNestedControlCollection>
                                    <dx:LayoutItemNestedControlContainer runat="server">
                                        <dx:ASPxGridLookup ID="gridlookupPortafogli" runat="server" Theme="Aqua" AutoGenerateColumns="False" DataSourceID="SqlDSPortafogli" IncrementalFilteringDelay="200" IncrementalFilteringMode="StartsWith" KeyFieldName="cod_rap" TextFormatString="{0}" OnValueChanged="gridlookupPortafogli_ValueChanged">
                                            <GridViewProperties>
                                                <SettingsBehavior AllowFocusedRow="True" AllowSelectSingleRowOnly="True" />
                                                <EditFormLayoutProperties ColCount="1">
                                                </EditFormLayoutProperties>
                                            </GridViewProperties>
                                            <Columns>
                                                <dx:GridViewDataTextColumn FieldName="cod_rap" Caption="Portafoglio" ShowInCustomizationForm="True" VisibleIndex="0">
                                                </dx:GridViewDataTextColumn>
                                                <dx:GridViewDataTextColumn FieldName="des_rap" Caption="Descrizione" ShowInCustomizationForm="True" VisibleIndex="1">
                                                </dx:GridViewDataTextColumn>
                                            </Columns>
                                            <ValidationSettings Display="Dynamic" ValidationGroup="VaRPortafoglioGroup" RequiredField-IsRequired="true" ErrorDisplayMode="Text" SetFocusOnError="true" ErrorTextPosition="Top" ErrorText="Selezionare Portafoglio" ErrorFrameStyle-Wrap="true">
                                                <ErrorFrameStyle Wrap="True"></ErrorFrameStyle>
                                                <RequiredField IsRequired="True" ErrorText="Selezionare Portafoglio" />
                                            </ValidationSettings>
                                        </dx:ASPxGridLookup>
                                    </dx:LayoutItemNestedControlContainer>
                                </LayoutItemNestedControlCollection>
                            </dx:LayoutItem>
                            <dx:LayoutItem Caption="Tipo VaR" ColSpan="1" HorizontalAlign="Left" VerticalAlign="Middle" RequiredMarkDisplayMode="Hidden">
                                <LayoutItemNestedControlCollection>
                                    <dx:LayoutItemNestedControlContainer runat="server">
                                        <dx:ASPxRadioButtonList ID="rblTipoVar" runat="server" RepeatDirection="Horizontal" Style="margin-left: 0px" AutoPostBack="True" OnSelectedIndexChanged="rblTipoVar_SelectedIndexChanged" Theme="Aqua" ClientInstanceName="rblClientTipoVar">
                                            <Items>
                                                <dx:ListEditItem Text="Ex-Ante" Value="0" />
                                                <dx:ListEditItem Text="Ex-Post" Value="1" />
                                            </Items>
                                            <ValidationSettings Display="Dynamic" ValidationGroup="VaRPortafoglioGroup" RequiredField-IsRequired="true" ErrorDisplayMode="Text" SetFocusOnError="true" ErrorTextPosition="Top" ErrorText="Selezionare Tipo VaR" ErrorFrameStyle-Wrap="true">
                                                <ErrorFrameStyle Wrap="True"></ErrorFrameStyle>

                                                <RequiredField IsRequired="True" ErrorText="Selezionare Tipo VaR" />
                                            </ValidationSettings>
                                        </dx:ASPxRadioButtonList>
                                    </dx:LayoutItemNestedControlContainer>
                                </LayoutItemNestedControlCollection>
                            </dx:LayoutItem>
                            <dx:LayoutItem Caption="Richiesta #" ColSpan="1" HorizontalAlign="Left" Name="Richiesta" ShowCaption="False" VerticalAlign="Middle">
                                <LayoutItemNestedControlCollection>
                                    <dx:LayoutItemNestedControlContainer runat="server">
                                        <dx:ASPxTextBox ID="tbRichiesta" runat="server" Theme="Aqua" Visible="False">
                                        </dx:ASPxTextBox>
                                    </dx:LayoutItemNestedControlContainer>
                                </LayoutItemNestedControlCollection>
                            </dx:LayoutItem>
                            <dx:LayoutItem Caption="Show Json" ColSpan="1" HorizontalAlign="Left" Name="ShowJson" VerticalAlign="Middle">
                                <LayoutItemNestedControlCollection>
                                    <dx:LayoutItemNestedControlContainer runat="server">
                                        <dx:ASPxCheckBox ID="cbShowJson" runat="server" CheckState="Unchecked" Theme="Aqua">
                                        </dx:ASPxCheckBox>
                                    </dx:LayoutItemNestedControlContainer>
                                </LayoutItemNestedControlCollection>
                            </dx:LayoutItem>
                            <dx:LayoutItem Caption="" ColSpan="1" HorizontalAlign="Left" VerticalAlign="Middle">
                                <LayoutItemNestedControlCollection>
                                    <dx:LayoutItemNestedControlContainer runat="server">
                                        <dx:ASPxButton ID="btnQueryVarPortafoglio" runat="server" Theme="Aqua" OnClick="btnQueryVarPortafoglio_Click">
                                            <ClientSideEvents Click="function(s, e) {
	ASPxClientEdit.ValidateGroup('VaRPortafoglioGroup');

}" />
                                            <Image IconID="find_find_32x32">
                                            </Image>
                                        </dx:ASPxButton>
                                    </dx:LayoutItemNestedControlContainer>
                                </LayoutItemNestedControlCollection>
                            </dx:LayoutItem>
                            <dx:LayoutItem Caption="" ColSpan="1" HorizontalAlign="Left" VerticalAlign="Middle">
                                <LayoutItemNestedControlCollection>
                                    <dx:LayoutItemNestedControlContainer runat="server">
                                        <dx:ASPxButton ID="btnPdfVarPortafoglio" runat="server" OnClick="btnPdfVarPortafoglio_Click" Visible="False">
                                            <Image IconID="print_printviapdf_32x32">
                                            </Image>
                                        </dx:ASPxButton>
                                    </dx:LayoutItemNestedControlContainer>
                                </LayoutItemNestedControlCollection>
                            </dx:LayoutItem>
                            <dx:LayoutGroup Caption="VaR Percentuale" ColCount="3" ColSpan="5" ColumnCount="3" ColumnSpan="5">
                                <Items>
                                    <dx:LayoutItem Caption="VaR (95%)" ColSpan="1">
                                        <LayoutItemNestedControlCollection>
                                            <dx:LayoutItemNestedControlContainer runat="server">
                                                <dx:ASPxTextBox ID="tbVar95PtfPerc" runat="server" DisplayFormatString="n2" ReadOnly="True" Theme="Aqua">
                                                </dx:ASPxTextBox>
                                            </dx:LayoutItemNestedControlContainer>
                                        </LayoutItemNestedControlCollection>
                                    </dx:LayoutItem>
                                    <dx:LayoutItem Caption="VaR (99%)" ColSpan="1">
                                        <LayoutItemNestedControlCollection>
                                            <dx:LayoutItemNestedControlContainer runat="server">
                                                <dx:ASPxTextBox ID="tbVar99PtfPerc" runat="server" DisplayFormatString="n2" ReadOnly="True" Theme="Aqua">
                                                </dx:ASPxTextBox>
                                            </dx:LayoutItemNestedControlContainer>
                                        </LayoutItemNestedControlCollection>
                                    </dx:LayoutItem>
                                    <dx:LayoutItem Caption="Account Balance" ColSpan="1">
                                        <LayoutItemNestedControlCollection>
                                            <dx:LayoutItemNestedControlContainer runat="server">
                                                <dx:ASPxTextBox ID="tbAccBalance" runat="server" DisplayFormatString="n2" ReadOnly="True" Theme="Aqua">
                                                </dx:ASPxTextBox>
                                            </dx:LayoutItemNestedControlContainer>
                                        </LayoutItemNestedControlCollection>
                                    </dx:LayoutItem>
                                </Items>
                            </dx:LayoutGroup>
                            <dx:LayoutGroup Caption="VaR Monetario" ColCount="3" ColSpan="5" ColumnCount="3" ColumnSpan="5" GroupBoxDecoration="Box">
                                <Items>
                                    <dx:LayoutItem Caption="VaR (95%)" ColSpan="1">
                                        <LayoutItemNestedControlCollection>
                                            <dx:LayoutItemNestedControlContainer runat="server">
                                                <dx:ASPxTextBox ID="tbVar95Portafoglio" runat="server" DisplayFormatString="n2" ReadOnly="True" Theme="Aqua">
                                                </dx:ASPxTextBox>
                                            </dx:LayoutItemNestedControlContainer>
                                        </LayoutItemNestedControlCollection>
                                    </dx:LayoutItem>
                                    <dx:LayoutItem Caption="VaR  (99%)" ColSpan="1">
                                        <LayoutItemNestedControlCollection>
                                            <dx:LayoutItemNestedControlContainer runat="server">
                                                <dx:ASPxTextBox ID="tbVar99Portafoglio" runat="server" DisplayFormatString="n2" ReadOnly="True" Theme="Aqua">
                                                </dx:ASPxTextBox>
                                            </dx:LayoutItemNestedControlContainer>
                                        </LayoutItemNestedControlCollection>
                                    </dx:LayoutItem>
                                    <dx:LayoutItem Caption="Covered Exposure" ColSpan="1">
                                        <LayoutItemNestedControlCollection>
                                            <dx:LayoutItemNestedControlContainer runat="server">
                                                <dx:ASPxTextBox ID="tbCovExpPortafoglio" runat="server" DisplayFormatString="n2" ReadOnly="True" Theme="Aqua">
                                                </dx:ASPxTextBox>
                                            </dx:LayoutItemNestedControlContainer>
                                        </LayoutItemNestedControlCollection>
                                    </dx:LayoutItem>
                                </Items>
                            </dx:LayoutGroup>
                            <dx:LayoutGroup Caption="Status" ColCount="1" ColSpan="5" ColumnSpan="5" GroupBoxDecoration="Box">
                                <Items>
                                    <dx:LayoutItem Caption="Status" ColSpan="1" ShowCaption="False">
                                        <LayoutItemNestedControlCollection>
                                            <dx:LayoutItemNestedControlContainer runat="server">
                                                <dx:ASPxMemo ID="memoStatusPortafoglio" runat="server" ReadOnly="True" Rows="4" Theme="Aqua" Width="100%" Height="400px">
                                                </dx:ASPxMemo>
                                            </dx:LayoutItemNestedControlContainer>
                                        </LayoutItemNestedControlCollection>
                                    </dx:LayoutItem>
                                </Items>
                            </dx:LayoutGroup>
                        </Items>
                    </dx:LayoutGroup>
                </Items>
            </dx:ASPxFormLayout>

        </div>
        <asp:SqlDataSource ID="SqlDSTitoli" runat="server" ConnectionString="<%$ ConnectionStrings:OlympiaIntranet.Properties.Settings.SqlConnection %>" ProviderName="<%$ ConnectionStrings:OlympiaIntranet.Properties.Settings.SqlConnection.ProviderName %>" SelectCommand="VaR_ElencoTitoli_LS" SelectCommandType="StoredProcedure"></asp:SqlDataSource>
        <asp:SqlDataSource ID="SqlDSPortafogli" runat="server" ConnectionString="<%$ ConnectionStrings:OlympiaIntranet.Properties.Settings.SqlConnection %>" ProviderName="<%$ ConnectionStrings:OlympiaIntranet.Properties.Settings.SqlConnection.ProviderName %>" SelectCommand="VaR_ElencoPortafogli_LS" SelectCommandType="StoredProcedure">
            <SelectParameters>
                <asp:SessionParameter Name="user" SessionField="user" />
            </SelectParameters>
        </asp:SqlDataSource>
    </form>
</body>
</html>
