<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="ScostamentoPerformance.aspx.cs" Inherits="OlympiaIntranet.ScostamentoPerformance" %>

<%@ 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>Scostamento Performance</title>
    <style>
        html, body { margin: 0; padding: 0; overflow: hidden; height: 100%; }
    </style>
</head>
<body>
    <form id="form1" runat="server">
        <table style="width:100%">
            <tr>
                <td>
                    <div>
                        <dx:ASPxFormLayout ID="ASPxFormLayout1" runat="server" ColCount="2" EnableTheming="True" Theme="Aqua" ColumnCount="2">
                            <Items>
                                <dx:LayoutGroup Caption="Scostamento Performance" ColCount="5" ColSpan="1" ColumnCount="5">
                                    <Items>
                                        <dx:LayoutItem Caption="Gestore" ColSpan="1">
                                            <LayoutItemNestedControlCollection>
                                                <dx:LayoutItemNestedControlContainer runat="server">
                                                    <dx:ASPxGridLookup ID="gridLookupGestore" runat="server" 
                                                        Theme="Aqua" 
                                                        DataSourceID="SqlDSGestori" 
                                                        DropDownStyle="DropDownList" 
                                                        EnableTheming="True" 
                                                        KeyFieldName="Gestore" 
                                                        TextFormatString="{0}" 
                                                        AutoPostBack="true"
                                                        OnValueChanged="gridLookupGestore_ValueChanged">
                                                        <GridViewProperties>
                                                            <SettingsBehavior AllowFocusedRow="True" AllowSelectSingleRowOnly="True" EnableRowHotTrack="True" />
                                                            <SettingsPager Mode="ShowAllRecords" />
                                                        </GridViewProperties>
                                                        <Columns>
                                                            <dx:GridViewDataTextColumn FieldName="Gestore" Caption="Gestore" />
                                                        </Columns>
                                                    </dx:ASPxGridLookup>
                                                </dx:LayoutItemNestedControlContainer>
                                            </LayoutItemNestedControlCollection>
                                        </dx:LayoutItem>
                                        <dx:LayoutItem Caption="" ColSpan="1" ShowCaption="False">
                                            <LayoutItemNestedControlCollection>
                                                <dx:LayoutItemNestedControlContainer runat="server">
                                                    <dx:ASPxLabel ID="lblMeseRiferimento" runat="server" Text="" Theme="Aqua" Font-Bold="True" Font-Size="Medium" />
                                                </dx:LayoutItemNestedControlContainer>
                                            </LayoutItemNestedControlCollection>
                                        </dx:LayoutItem>
                                    </Items>
                                </dx:LayoutGroup>
                            </Items>
                        </dx:ASPxFormLayout>
                    </div>
                </td>
            </tr>
            <tr>
                <td>
                    <div>
                        <dx:ASPxGridView ID="gvScostamentoPerformance" runat="server" 
                            EnableTheming="True" 
                            Theme="Office2010Blue" 
                            AutoGenerateColumns="False"
                            Width="100%"                          
                            KeyFieldName="Id"
                            OnRowUpdating="gvScostamentoPerformance_RowUpdating"
                            OnCellEditorInitialize="gvScostamentoPerformance_CellEditorInitialize"
                            OnDataBound="gvScostamentoPerformance_DataBound"
                            OnCancelRowEditing="gvScostamentoPerformance_CancelRowEditing"
                            OnHtmlDataCellPrepared="gvScostamentoPerformance_HtmlDataCellPrepared"
                            OnDataBinding="gvScostamentoPerformance_DataBinding">
                            <SettingsPager Mode="ShowAllRecords" />
                            <Settings ShowFilterRow="True" ShowHeaderFilterButton="True" ShowFilterBar="Visible" VerticalScrollBarMode="Visible" VerticalScrollableHeight="750" />
                            <SettingsBehavior FilterRowMode="Auto" AllowFocusedRow="True" />
                            <SettingsEditing Mode="Inline" />

                            <SettingsPopup>
                                <FilterControl AutoUpdatePosition="False" />
                            </SettingsPopup>

                            <SettingsFilterControl ViewMode="VisualAndText" />
                            
                            <Columns>
                                <dx:GridViewCommandColumn ShowEditButton="True" VisibleIndex="0" Width="50px" Caption=" " />
                                <dx:GridViewDataTextColumn FieldName="Id" VisibleIndex="1" Visible="false" ReadOnly="true" />
                                <dx:GridViewDataTextColumn FieldName="Gestore" Caption="Gestore" VisibleIndex="2" ReadOnly="true" Width="6%" />
                                <dx:GridViewDataTextColumn FieldName="Portafoglio" Caption="Portafoglio" VisibleIndex="3" ReadOnly="true" Width="6%" />
                                <dx:GridViewDataTextColumn FieldName="Intestazione" Caption="Intestazione" VisibleIndex="4" ReadOnly="true" Width="10%" />
                                <dx:GridViewDataTextColumn FieldName="Linea" Caption="Linea" VisibleIndex="5" ReadOnly="true" Width="6%" />
                                <dx:GridViewDataTextColumn FieldName="Patrimonio" Caption="Patrimonio" VisibleIndex="6" ReadOnly="true" Width="6%">
                                    <PropertiesTextEdit DisplayFormatString="N0" />
                                </dx:GridViewDataTextColumn>
                                <dx:GridViewDataTextColumn FieldName="DataApertura" Caption="Data Ap." VisibleIndex="7" ReadOnly="true" Width="5%">
                                    <PropertiesTextEdit DisplayFormatString="dd/MM/yyyy" />
                                </dx:GridViewDataTextColumn>
                                <dx:GridViewDataTextColumn FieldName="PerfTWRPtf" Caption="TWR Ptf" VisibleIndex="8" ReadOnly="true" Width="4%">
                                    <PropertiesTextEdit DisplayFormatString="N2" />
                                </dx:GridViewDataTextColumn>
                                <dx:GridViewDataTextColumn FieldName="PerfTWRLinea" Caption="TWR Linea" VisibleIndex="9" ReadOnly="true" Width="5%">
                                    <PropertiesTextEdit DisplayFormatString="N2" />
                                </dx:GridViewDataTextColumn>
                                <dx:GridViewDataTextColumn FieldName="DeltaTWR" Caption="Delta" VisibleIndex="10" ReadOnly="true" Width="4%">
                                    <PropertiesTextEdit DisplayFormatString="N2" />
                                </dx:GridViewDataTextColumn>
                                <dx:GridViewDataTextColumn FieldName="Benchmark" Caption="Benchmark" VisibleIndex="10" ReadOnly="true" Width="4%">
                                    <PropertiesTextEdit DisplayFormatString="N2" />
                                </dx:GridViewDataTextColumn>
                                <dx:GridViewDataTextColumn FieldName="Apporti" Caption="Apporti" VisibleIndex="11" ReadOnly="true" Width="5%">
                                    <PropertiesTextEdit DisplayFormatString="N0" />
                                </dx:GridViewDataTextColumn>
                                <dx:GridViewDataTextColumn FieldName="Prelievi" Caption="Prelievi" VisibleIndex="12" ReadOnly="true" Width="5%">
                                    <PropertiesTextEdit DisplayFormatString="N0" />
                                </dx:GridViewDataTextColumn>
                                <dx:GridViewDataTextColumn FieldName="Addebiti" Caption="Addebiti" VisibleIndex="13" ReadOnly="true" Width="5%">
                                    <PropertiesTextEdit DisplayFormatString="N0" />
                                </dx:GridViewDataTextColumn>
                                <dx:GridViewDataComboBoxColumn FieldName="Commento" Caption="Commento" VisibleIndex="14" Width="16%">
                                    <PropertiesComboBox>
                                        <Items>
                                            <dx:ListEditItem Text="" Value="" />
                                            <dx:ListEditItem Text="Imposte / Commissioni" Value="Imposte / Commissioni" />
                                            <dx:ListEditItem Text="Prelievi/Versamenti nel corso del periodo" Value="Prelievi/Versamenti nel corso del periodo" />
                                            <dx:ListEditItem Text="Presenza titoli illiquidi" Value="Presenza titoli illiquidi" />
                                            <dx:ListEditItem Text="Sottopeso/Sovrappeso asset class" Value="Sottopeso/Sovrappeso asset class" />
                                            <dx:ListEditItem Text="Trasferimento titoli da altro dossier" Value="Trasferimento titoli da altro dossier" />
                                        </Items>
                                    </PropertiesComboBox>
                                </dx:GridViewDataComboBoxColumn>
                                <dx:GridViewDataMemoColumn FieldName="Note" Caption="Note" VisibleIndex="14" Width="12%">
                                    <PropertiesMemoEdit Rows="3" />
                                </dx:GridViewDataMemoColumn>
                                <dx:GridViewDataCheckColumn FieldName="BloccoCommento" Caption="Blocco" VisibleIndex="15" Width="3%" />
                                <dx:GridViewDataTextColumn FieldName="DataRiferimento" Caption="Data Rif." VisibleIndex="16" ReadOnly="true" Visible="false" />
                                <dx:GridViewDataTextColumn FieldName="MeseRiferimento" Caption="Mese" VisibleIndex="17" ReadOnly="true" Visible="false" />
                            </Columns>
                        </dx:ASPxGridView>
                    </div>
                </td>
            </tr>
        </table>
        
        <asp:SqlDataSource ID="SqlDSGestori" runat="server" 
            ConnectionString="<%$ ConnectionStrings:OlympiaIntranet.Properties.Settings.SqlConnection %>"  
            SelectCommand="GDN_ElencoGestoriScostamento" 
            SelectCommandType="StoredProcedure">
            <SelectParameters>
                <asp:SessionParameter Name="IsRiskManager" SessionField="is_risk_sp" DbType="Boolean" />
            </SelectParameters>
        </asp:SqlDataSource>

    </form>
</body>
</html>
