<%@ Page Title="" Language="C#" MasterPageFile="~/Site.Master" AutoEventWireup="true" Culture="es-MX"
    CodeBehind="frmCredito.aspx.cs" Inherits="bajaWare.Credito.frmCredito" %>

<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="asp" %>
<%@ Register Src="../UserControl/Credito/wucCredEmpresCredito.ascx" TagName="wucCredEmpresCredito"
    TagPrefix="uc1" %>
<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
</asp:Content>

<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolderContenido" runat="server">
    <script language="javascript" type="text/javascript">
    function Validacion(Boton) {
        var tab = $find("<%=Tabs.ClientID%>");

        var Index = tab.get_activeTabIndex();

        if (Index == 0) {

            Boton.ValidationGroup = tab.get_activeTab().get_headerText();
        }
        else {
        }
    }
    function CambiaTab(sender, e) {
        var btn = document.getElementById("<%=btnGuardar.ClientID %>");
     
        //rfvUsername.ValidationGroup = "Demo"; 
        //alert(rfvUsername.ValidationGroup);

        switch (sender.get_activeTabIndex()) {
            case 0:
                btn.onclick = function () {
                    WebForm_DoPostBackWithOptions(new WebForm_PostBackOptions("btnGuardar", "", true, "Credito", "", false, false));
                }
            break;
        case 1:
            btn.onclick = function () {
                WebForm_DoPostBackWithOptions(new WebForm_PostBackOptions("btnGuardar", "", true, "Operaciones", "", false, false));
            }
            break;
        case 2:
            btn.onclick = function () {
                WebForm_DoPostBackWithOptions(new WebForm_PostBackOptions("btnGuardar", "", true, "Contabilidad", "", false, false));
            }
                break;
            case 3:
                btn.onclick = function () {
                    WebForm_DoPostBackWithOptions(new WebForm_PostBackOptions("btnGuardar", "", true, "MesaAuditoria", "", false, false));
                }
                break;
            case 4:
                btn.onclick = function () {
                    WebForm_DoPostBackWithOptions(new WebForm_PostBackOptions("btnGuardar", "", true, "MesaCobranza", "", false, false));
                }
                break;
            case 5:
                btn.onclick = function () {
                    WebForm_DoPostBackWithOptions(new WebForm_PostBackOptions("btnGuardar", "", true, "Promocion", "", false, false));
                }
                break;
            case 6:
                btn.onclick = function () {
                    WebForm_DoPostBackWithOptions(new WebForm_PostBackOptions("btnGuardar", "", true, "Tesoreria", "", false, false));
                }
                break;
            case 7:
                btn.onclick = function () {
                    WebForm_DoPostBackWithOptions(new WebForm_PostBackOptions("btnGuardar", "", true, "Finanzas", "", false, false));
                }
                break;
        }



    }

    function CambiaTabs() {
        var btn = document.getElementById("<%=btnGuardar.ClientID %>");
        var tab = $find("<%=Tabs.ClientID%>");
        //rfvUsername.ValidationGroup = "Demo"; 
        //alert(rfvUsername.ValidationGroup);

      
                btn.onclick = function () {
                    WebForm_DoPostBackWithOptions(new WebForm_PostBackOptions("btnGuardar", "", true, $find("<%=Tabs.ClientID%>").get_activeTab().get_headerText(), "", false, false));
                }
              
        }



    
   
</script>
   
         <table width="100%">
      <tr>
      <td>
            <table>
                <tr>
                    <td>
                        <asp:TabContainer  ID="Tabs" OnClientActiveTabChanged="CambiaTab"  runat="server">
                            <asp:TabPanel runat="Server" ID="tabCredito"  TabIndex="0" HeaderText="Credito" Height="100px"
                                BackColor="Transparent">
                                <ContentTemplate>
                               
                                    <uc1:wucCredEmpresCredito ID="wucCredEmpresCredito1" runat="server" />


                                
</ContentTemplate>
                            
</asp:TabPanel>
                            <asp:TabPanel runat="Server" ID="tabOperaciones" TabIndex="1" Visible="false" HeaderText="Operaciones" Height="400px" Width="500"
                                BackColor="Transparent">
                                <ContentTemplate>
                                    <table>
                                        <tr>
                                            <td class="th">
                                                Tipo de Baja
                                            </td>
                                            <td align="left">
                                                <asp:DropDownList runat="server" ID="ddlTipoBaja" />
                                                <asp:RequiredFieldValidator ID="rfv_TipoBaja" runat="server" ErrorMessage="Tipo de Baja Obligatorio"
                                                    ControlToValidate="ddlTipoBaja" ValidationGroup="Operaciones" Display="None"></asp:RequiredFieldValidator>
                                                <asp:ValidatorCalloutExtender ID="vce_TipoBaja" runat="server" Enabled="True" TargetControlID="rfv_TipoBaja">
                                                </asp:ValidatorCalloutExtender>
                                            </td>
                                            <td class="th">
                                                Periodicidad Capital
                                            </td>
                                            <td align="left">
                                                <asp:DropDownList runat="server" ID="ddlPeriodicidadCapital" />
                                          
                                            </td>
                                        </tr>
                                    </table>
                                
</ContentTemplate>
                            
</asp:TabPanel>
                              <asp:TabPanel runat="Server" ID="tabContabilidad" Visible="false" TabIndex="2" HeaderText="Contabilidad" Height="400px" Width="500"
                                BackColor="Transparent">
                                <ContentTemplate>
                                    <table>
                                        <tr>
                                            <td class="th">
                                                Clasificacion Contable

                                            </td >
                                            <td align="left">
                                                <asp:DropDownList runat="server" ID="ddlClasificacionContable" />
                                               
                                            </td>
                                          
                                        </tr>
                                    </table>
                                
</ContentTemplate>
                            
</asp:TabPanel>
                              <asp:TabPanel runat="Server" ID="tabMesaControlAuditoria"  TabIndex="3" HeaderText="Mesa de Control / Auditoría" Height="400px"
                               Width="500"  BackColor="Transparent">
                                <ContentTemplate>
                                    <table>
                                        <tr>
                                            <td class="th" >
                                                Operacion Formalizada
                                            </td>
                                            <td align="left">
                                                <asp:DropDownList runat="server" Width="200px" ID="ddlOperacionFormalizada" />
                                               
                                            </td>
                                           <td class="th">
                                                ExpedienteCompleto
                                            </td>
                                            <td align="left">
                                                <asp:DropDownList runat="server" ID="ddlExpedienteCompleto" />
                                               
                                            </td>
                                        </tr>
                                    </table>
                                
</ContentTemplate>
                            
</asp:TabPanel>
                              <asp:TabPanel runat="Server" ID="tabMesaControlCobranza" TabIndex="4" HeaderText="Mesa de Control / Cobranza" Height="400px"
                              Width="500"  BackColor="Transparent">
                                <ContentTemplate>
                                    <table>
                                        <tr>
                                            <td class="th">
                                                Informacion Recuperacion

                                            </td>
                                            <td align="left">
                                                <asp:DropDownList runat="server" Width="200" ID="ddlInformacionRecuperacion" />
                                               
                                            </td>
                                          
                                        </tr>
                                    </table>
                                
</ContentTemplate>
                            
</asp:TabPanel>

                             
                 
 <asp:TabPanel runat="Server" ID="tabTesoreria" Visible="false" TabIndex="5" HeaderText="Tesorería" Height="400px"
                               Width="500" BackColor="Transparent">
                                <ContentTemplate>
                                    <table>
                                        <tr>
                                            <td class="th">
                                                Instituto Fondea

                                            </td>
                                            <td align="left">
                                                <asp:DropDownList runat="server" Width="200" ID="ddlInstitutoFondea" />
                                               
                                            </td>
                                          
                                        </tr>
                                    </table>
                                
</ContentTemplate>
                            
</asp:TabPanel>
  <asp:TabPanel runat="Server" ID="tabPromocion" TabIndex="6" HeaderText="Promocion" Height="400px"
                              Width="500"  BackColor="Transparent">
                                <ContentTemplate>
                                    <table>
                                        <tr>
                                            <td class="th">
                                                Tipo Credito

                                            </td>
                                            <td align="left">
                                                <asp:DropDownList runat="server" Width="200" ID="ddlTipoCredito" />
                                               
                                            </td>
                                          
                                        </tr>
                                    </table>
                                
</ContentTemplate>
                            
</asp:TabPanel>
 <asp:TabPanel runat="Server" ID="TabFinanzas" Visible="false" TabIndex="7" HeaderText="Finanzas" Height="400px"
                               Width="500" BackColor="Transparent">
                                <ContentTemplate>
                                    <table>
                                        <tr>
                                            <td  class="th">Porcentaje Garantia de Fondeo
</td>
<td align="left">
    <asp:TextBox ID="txtPorcentajeGarFond" MaxLength="6" CssClass="textbox" runat="server"></asp:TextBox>
     <asp:FilteredTextBoxExtender ValidChars="."  FilterType="Custom,Numbers" runat="server" ID="fte_Porcentaje" TargetControlID="txtPorcentajeGarFond">
            </asp:FilteredTextBoxExtender>
            <asp:RegularExpressionValidator ID="reValPorcentaje"   runat="server" ValidationGroup="Finanzas" ErrorMessage="El porcentaje no es correcto"  ControlToValidate="txtPorcentajeGarFond" ValidationExpression="^100$|^\d{0,2}(\.\d{1,7})? *%?$"></asp:RegularExpressionValidator>
                <asp:ValidatorCalloutExtender ID="vce_Porcentaje" runat="server"
                Enabled="True"   TargetControlID="reValPorcentaje" />
                            <asp:RangeValidator ID="rgv_txtPorcentaje" runat="server" MinimumValue="0.01" MaximumValue="100"  Display="None" Type="Double" CultureInvariantValues="true" ControlToValidate="txtPorcentajeGarFond" ValidationGroup="Finanzas" ErrorMessage="El porcentaje no es correcto"></asp:RangeValidator>
                             <asp:ValidatorCalloutExtender ID="vce_txtPorcentaje3" runat="server"
                Enabled="True"   TargetControlID="rgv_txtPorcentaje" />
</td>
                                          
                                        </tr>
                                    </table>
                                
</ContentTemplate>
                            
</asp:TabPanel>
                        </asp:TabContainer>
                    </td>
                </tr>
                
            </table>
            </td>
            </tr>
            <tr>
               <td align="center">
                        <asp:Button ID="btnGuardar" ValidationGroup="GuardaAccion" CssClass="Boton" runat="server" Text="Guardar" OnClientClick="Validacion(this);" OnClick="btnGuardar_Click" />
                    </td>
            </tr>
            <tr align="center">
      <td> 
       <asp:UpdatePanel ID="upd_general" runat="server">
        <ContentTemplate>
      <asp:Button ID="btnAtras" CssClass="Boton" Text="Atras"
              runat="server" onclick="btnAtras_Click" />
               </ContentTemplate>
        <Triggers>
            <asp:AsyncPostBackTrigger ControlID="btnGuardar" EventName="Click" />
        </Triggers>
       
    </asp:UpdatePanel>
              
              </td>
      </tr>
            </table>
           
       
</asp:Content>
