<%@ Page Title="" Language="C#" MasterPageFile="~/Master/Cecam.Master" AutoEventWireup="true" CodeBehind="wfContrato.aspx.cs"
    Inherits="Cecam.PortalTransparencia.Web.Pages.wfContrato" %>

<%@ Register Src="~/UserControls/ucDownload.ascx" TagPrefix="uc" TagName="Download" %>
<%@ Register Src="~/UserControls/ucAnexo.ascx" TagPrefix="uc" TagName="ucAnexo" %>

<asp:Content ID="Content1" ContentPlaceHolderID="cphConteudo" runat="server">
    <div class="cabecalho">
        Contratos
    </div>
    <asp:UpdatePanel ID="uppContrato" runat="server">
        <ContentTemplate>
            <dx:ASPxRoundPanel ID="rpnCadastro" runat="server">
                <PanelCollection>
                    <dx:PanelContent>
                        <ul class="form2col">
                            <li>
                                <span class="titulo">*Exercício:</span>
                                <ccn:ComboBox runat="server" ID="cbxExercicio" OnDataSearch="cbxExercicio_DataSearch" ValidationGroup="Contrato" AutoPostBack="true"
                                    OnValueChanged="cbxExercicio_ValueChanged" IsRequired="true" />
                            </li>
                        </ul>
                        <ul class="form1col">
                            <li>
                                <span class="titulo">*Período:</span>
                                <ccn:DateEdit runat="server" ID="detInicial" ValidationGroup="Contrato" IsRequired="true"
                                    CalendarProperties-EnableYearNavigation="true" AllowNull="false" />
                                <span class="titulo">a</span>
                                <ccn:DateEdit runat="server" ID="detFinal" ValidationGroup="Contrato" IsRequired="true"
                                    CalendarProperties-EnableYearNavigation="true" AllowNull="false" />
                            </li>
                        </ul>
                        <ul class="form1col">
                            <li>
                                <span class="titulo">*Tipo de Contrato:</span>
                                <ccn:ComboBox ID="cbxContrato" runat="server" Width="57.5%" ValidationGroup="Contrato" TextField="Descricao" ValueField="Codigo"
                                    OnDataSearch="cbxContrato_DataSearch" DefaultItem="TODOS" />
                            </li>
                            <li>
                                <ccn:LinkedSearch ID="lksFornecedor" runat="server" LabelCaption="Credor/Fornecedor:" PopupCaption="Credores/Fornecedores" KeyFieldName="Id"
                                    ValueFieldName="CNPJ" Width="20%|15%|40%" TextFieldName="Descricao" ColumnCaption="CNPJ|Descrição" ColumnFieldName="CNPJ|Descricao"
                                    ColumnWidth="20%|80%" OnDataSearch="lksFornecedor_DataSearch" IsAccentInsensitiveFilter="true" />
                                <br />
                                <span style="padding-left: 190px;">*Consulta por CPF/CNPJ/Razão Social</span>
                            </li>
                        </ul>
                    </dx:PanelContent>
                </PanelCollection>
            </dx:ASPxRoundPanel>
            <ul class="botoes">
                <li>
                    <ccn:Button ID="btnPesquisar" SkinID="Pesquisar" runat="server" ValidationGroup="Contrato" OnClick="btnPesquisar_Click" />
                </li>
                <li>
                    <ccn:Button ID="btnLimpar" SkinID="Limpar" runat="server" OnClick="btnLimpar_Click" />
                </li>
            </ul>
            <asp:UpdatePanel runat="server">
                <ContentTemplate>
                    <dx:ASPxRoundPanel ID="ASPxRoundPanel1" runat="server" HeaderText="Contratos">
                        <PanelCollection>
                            <dx:PanelContent>
                                <li style="float: left;">
                                    <asp:Label runat="server" ID="lblFiltro"></asp:Label>
                                </li>
                                <li style="float: right;">
                                    <asp:Label runat="server" Text="Exportar Listagem: pdf, txt, jpg, csv e URI" />
                                    <ccn:Button runat="server" ID="btnExportar" Image-Url="~/UI/img/bt-exportar.png" ToolTip="Exportar" ClientEnabled="false"
                                        OnClick="btnExportar_Click" />
                                </li>
                                <ccn:GridView runat="server" ID="gvwContrato" OnDataSearch="gvwContrato_DataSearch" Width="100%"
                                    OnDataCommand="gvwContrato_DataCommand">
                                    <Columns>
                                        <ccn:GridCommandCustomColumn ButtonId="Detalhes" Name="Detalhes" ButtonType="Image" Width="3%" VisibleIndex="0" ImageUrl="~/UI/img/ico-detalhe.png" Caption="Detalhes" />
                                        <ccn:GridCommandCustomColumn ButtonId="Anexos" Name="Anexos" ButtonType="Image" Width="3%" VisibleIndex="1" ImageUrl="~/UI/img/ico-exportar.png" Caption="Anexos" />
                                        <ccn:GridDataColumn Caption="Número do Contrato" FieldName="Numero" Width="8%" VisibleIndex ="2" />
                                        <ccn:GridDataColumn Caption="Ano" FieldName="Ano" Width="5%" VisibleIndex="3" />
                                        <ccn:GridDataColumn Caption="Credor/Fornecedor" FieldName="NomeFornecedor" Width="30%" />
                                        <ccn:GridDataColumn Caption="Data de Assinatura" FieldName="DataAssinatura" Width="10%" />
                                        <ccn:GridDataColumn Caption="Data de Término" FieldName="DataVencimento" Width="10%" />
                                        <ccn:GridDataSpinTextColumn FieldName="ValorTotal" Caption="Valor (R$)" Width="10%" DisplayFormatString="#,##0.00" Precision="18|2" />
                                        <ccn:GridCommandCustomColumn ButtonId="Aditamentos" Name="Aditamentos" ButtonType="Image" Width="3%" VisibleIndex ="8" ImageUrl="~/UI/img/ico-detalhe.png" Caption="Aditamentos" />
                                    </Columns>
                                    <Settings ShowFooter="True" />
                                    <TotalSummary>
                                        <dx:ASPxSummaryItem FieldName="ValorTotal" DisplayFormat="Valor Total: {0:#,##0.00}" SummaryType="Sum" />
                                    </TotalSummary>
                                </ccn:GridView>
                            </dx:PanelContent>
                        </PanelCollection>
                    </dx:ASPxRoundPanel>
                </ContentTemplate>
            </asp:UpdatePanel>
            <ccn:Popup ID="popArquivo" runat="server" Width="20%" EncodeHtml="false" />
            <uc:Download ID="ucFormatoDownload" runat="server" Titulo="Download" OnSucess="ucFormatoDownload_Sucess" />
            <uc:ucAnexo ID="ucAnexo" runat="server" />
        </ContentTemplate>
    </asp:UpdatePanel>
</asp:Content>