--- selección multiple de devolución

This commit is contained in:
2025-01-20 09:07:41 -07:00
parent 3396f67ff7
commit c678d0e061
2 changed files with 403 additions and 140 deletions

View File

@@ -351,10 +351,14 @@
<asp:LinkButton ID="LnkAgregarLineaAdicional" data-toggle="tooltip" runat="server" Text="<i class='fa fa-plus'></i> Agregar Linea Adicional" Visible="false" OnClick="LnkAgregarLineaAdicional_Click"></asp:LinkButton>
</li>
</ContentTemplate>
</asp:UpdatePanel>
<asp:UpdatePanel runat="server" ID="UpdatePanel11" RenderMode="Inline">
<ContentTemplate>
<li>
<asp:LinkButton ID="LnkDevolucionMasiva" runat="server" OnClick="LnkDevolucionMasiva_Click"><i class="fa fa-minus"></i>Devolución</asp:LinkButton>
</li>
</ContentTemplate>
</asp:UpdatePanel>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="E" runat="Server">
@@ -543,8 +547,6 @@
<i></i>
</div>
</div>
<div class="form-group form-md-line-input input-iconright" runat="server" visible="False" id="dvZH">
<asp:DropDownList ID="DdlZonaHoraria" DataTextField="DisplayText" DataValueField="CveZonaHoraria" runat="server" CssClass="form-control input-sm select2me">
<asp:ListItem Selected="True" Text="Seleccione" Value="-1"></asp:ListItem>
@@ -566,7 +568,6 @@
</div>
<div class="row" id="divRegimen" runat="server" visible="false">
<div class="col-md-12">
<div class="form-group form-md-line-input input-iconright">
<asp:DropDownList ID="DdlRegimenFiscal" DataTextField="CodigoRegimenFiscalTexto" AutoPostBack="true" Width="100%" DataValueField="CveRegimenFiscal" runat="server" CssClass="form-control input-sm select2me">
@@ -589,13 +590,7 @@
<asp:RequiredFieldValidator ID="RfvDdlGeneroCliente" runat="server" InitialValue="-1" ControlToValidate="DdlGeneroCliente" CssClass="help-block errorimput" ErrorMessage="<b><span style='text-decoration: underline'>ERROR:</span></b><br />El campo <b>''Género''</b> es necesario, por favor ingréselo." ValidationGroup="GrpGuardar"></asp:RequiredFieldValidator>
<label for="<%= DdlGeneroCliente.ClientID.ToString()%>">Género:</label>
</div>
</div>
</div>
</div>
</div>
<div class="portlet light xspadding bordered">
@@ -2294,8 +2289,6 @@
<ContentTemplate>
<asp:Button ID="BtnCargaAnticipos" runat="server" ClientIDMode="Static" Text="CargaAnt" Style="display: none;" OnClick="BtnCargaAnticipos_Click" />
<div class="row col-md-12" align="right">
<input type="text" id="TxtBusquedaAnticipos" class="form-control input-sm" onkeyup="<%= String.Format("FiltrarTabla('TxtBusquedaAnticipos','{0}')", GVAnticipos.ClientID) %>" style="display: inline-block; margin-right: -20px; width: 150px;" />
<a href="javascript:;" onclick="<%= String.Format("FiltrarTabla('TxtBusquedaAnticipos','{0}')", GVAnticipos.ClientID) %>" style="margin-top: -3px;" class="btn btn-circle btn-sm label-info"><i class="icon-magnifier"></i></a>
</div>
<div class="portlet light xspadding bordered">
@@ -2310,6 +2303,9 @@
<ContentTemplate>
<asp:LinkButton ID="LnkAnticipoClientePDF" runat="server" data-toggle="tooltip" Title="PDF"> <i class="fa fa-file-pdf-o" style="margin-right: 10px; font-size:15px; font-weight:bold; color:dimgray;"></i> </asp:LinkButton>
<asp:LinkButton ID="LnkAnticipoClienteExcel" runat="server" data-toggle="tooltip" Title="Excel"><i class="fa fa-file-excel-o" style="margin-right: 10px; font-size:15px; font-weight:bold; color:dimgray;"></i> </asp:LinkButton>
<input type="text" id="TxtBusquedaAnticipos" class="form-control input-sm" onkeyup="<%= String.Format("FiltrarTabla('TxtBusquedaAnticipos','{0}')", GVAnticipos.ClientID) %>" style="display: inline-block; margin-right: -20px; width: 125px;" />
<a href="javascript:;" onclick="<%= String.Format("FiltrarTabla('TxtBusquedaAnticipos','{0}')", GVAnticipos.ClientID) %>" style="margin-top: -3px;" class="btn btn-circle btn-sm label-info"><i class="icon-magnifier"></i></a>
</ContentTemplate>
<Triggers>
<asp:PostBackTrigger ControlID="LnkAnticipoClientePDF" />
@@ -2320,8 +2316,110 @@
</div>
</div>
<div class="portlet-body">
<div runat="server" id="divDevolverAnticipos" visible="False">
<div class="row">
<div class="col-md-6">
<div class="row">
<div class="col-md-4">
<label>Tipo Movimiento:</label>
</div>
<div class="col-md-8">
<asp:DropDownList ID="DdlTipoTransaccion" runat="server" CssClass="form-control input-sm select2me" AppendDataBoundItems="true" DataTextField="TipoTransaccion" DataValueField="CveTipoTransaccion" ValidationGroup="GrpGuardar" Width="100%" >
</asp:DropDownList>
<asp:RequiredFieldValidator ID="RFVTipoTransaccion" runat="server" ControlToValidate="DdlTipoTransaccion" InitialValue="-1" Display="None" ErrorMessage="<b><span style='text-decoration: underline'>ERROR:</span></b><br />El campo <b>''Tipo Movimiento''</b> es necesario, por favor seleccione uno." ValidationGroup="GrpGuardar"></asp:RequiredFieldValidator>
<ajax:ValidatorCalloutExtender ID="VceTipoTransancion" runat="server" HighlightCssClass="vco" TargetControlID="RFVTipoTransaccion" Width="300px"></ajax:ValidatorCalloutExtender>
</div>
</div>
<div class="row" style="padding-bottom: 5px;">
<div class="col-md-4">
<label>Cuenta:</label>
</div>
<div class="col-md-8">
<asp:DropDownList ID="DdlCuenta" runat="server" CssClass="form-control input-sm select2me" AppendDataBoundItems="true" AutoPostBack="true" DataTextField="NumCuentaMoneda" DataValueField="CveCuenta" ValidationGroup="GrpGuardar" Width="100%" >
</asp:DropDownList>
<asp:RequiredFieldValidator ID="RFVCuenta" runat="server" ControlToValidate="DdlCuenta" InitialValue="-1" Display="None" ErrorMessage="<b><span style='text-decoration: underline'>ERROR:</span></b><br />El campo <b>''Cuenta''</b> es necesario, por favor seleccione uno." ValidationGroup="GrpGuardar"></asp:RequiredFieldValidator>
<ajax:ValidatorCalloutExtender ID="VCECuenta" runat="server" HighlightCssClass="vco" TargetControlID="RFVCuenta" Width="300px"></ajax:ValidatorCalloutExtender>
</div>
</div>
</div>
<div class="col-md-6">
<div class="row" style="padding-bottom: 5px;">
<div class="col-md-4">
<label>Fecha:</label>
</div>
<div class="col-md-4">
<div class="input-group input-sm input-small date date-picker " data-date-format="dd/mm/yyyy" style="width: 110px !important; padding: 0px;">
<asp:TextBox ID="TxtFechaDocumento" runat="server" CssClass="form-control"></asp:TextBox>
<span class="input-group-btn ">
<asp:LinkButton runat="server" ID="imgCalendarioDev" class="btn default" type="button">
<i class="fa fa-calendar"></i>
</asp:LinkButton>
</span>
</div>
<ajax:MaskedEditExtender ID="MEEFecha" runat="server" UserDateFormat="DayMonthYear" TargetControlID="TxtFechaDocumento" Mask="99/99/9999" MaskType="Date" DisplayMoney="Left" AcceptNegative="Left"></ajax:MaskedEditExtender>
<ajax:CalendarExtender ID="CalendarExtender2" runat="server" TargetControlID="TxtFechaDocumento" PopupButtonID="imgCalendarioDev" PopupPosition="BottomRight" Enabled="True"></ajax:CalendarExtender>
<ajax:MaskedEditValidator ID="MEVCalendario" runat="server" ControlExtender="MEEFecha" ControlToValidate="TxtFechaDocumento" Display="None" IsValidEmpty="False" MaximumValueMessage="Fecha Excedida" ErrorMessage="*" InvalidValueMessage="Fecha Invalida" InvalidValueBlurredMessage="b" MinimumValueMessage="Fecha Menor a la permitida" Enabled="False" ValidationGroup="GrpGuardar"></ajax:MaskedEditValidator>
<asp:RequiredFieldValidator ID="RFVFechaDocumento" runat="server" ControlToValidate="TxtFechaDocumento" Display="None" ErrorMessage="El campo <b>''Fecha Documento''</b> es requerido por la aplicación, por favor ingrese una fecha." ValidationGroup="GrpGuardar"></asp:RequiredFieldValidator>
<asp:CompareValidator ID="CVFechaDocumento" runat="server" ControlToValidate="TxtFechaDocumento" Display="None" ErrorMessage="El campo <b>''Fecha Documento''</b> no tienes el formato correcto, por favor intente de nuevo con el siguiente formato: (dd/mm/yyyy)." Operator="DataTypeCheck" Type="Date" ValidationGroup="GrpGuardar"></asp:CompareValidator>
<ajax:ValidatorCalloutExtender ID="VCOFechaDocumento1" runat="server" HighlightCssClass="vco" TargetControlID="RFVFechaDocumento" Width="350px"></ajax:ValidatorCalloutExtender>
<ajax:ValidatorCalloutExtender ID="VCOFechaDocumento2" runat="server" HighlightCssClass="vco" TargetControlID="CVFechaDocumento" Width="350px"></ajax:ValidatorCalloutExtender>
<ajax:ValidatorCalloutExtender ID="ValidatorCalloutExtender8" runat="server" HighlightCssClass="vco" TargetControlID="MEVCalendario" Width="350px"></ajax:ValidatorCalloutExtender>
</div>
</div>
<div class="row" style="padding-bottom: 5px;">
<div class="col-md-4">
<label>Importe:</label>
</div>
<div class="col-md-8">
<asp:TextBox ID="TxtImporteDev" runat="server" MaxLength="12" CssClass="input-sm" ClientIDMode="Static" Style="text-align: right;" AutoComplete="off" Width="145px"></asp:TextBox>
<%--<ajax:FilteredTextBoxExtender ID="ftbe" runat="server" TargetControlID="TxtImporteDev" FilterType="Custom, Numbers" ValidChars="+-.," />
<asp:RangeValidator ID="RVImporte" runat="server" Enabled="false" Type="Currency" MinimumValue="0" MaximumValue="0" ErrorMessage="Importe Excedido" ControlToValidate="TxtImporteDev" Display="Dynamic" ValidationGroup="GrpGuardar"></asp:RangeValidator>--%>
</div>
</div>
<div class="row" style="padding-bottom: 5px;" id="DivTotal" runat="server" visible="false">
<div class="col-md-4">
<label></label>
</div>
<div class="col-md-8">
<asp:TextBox ID="TxtTotal" runat="server" MaxLength="12" CssClass="input-sm" ClientIDMode="Static" Style="text-align: right;" onkeyup="FormatoMoneda(this)" AutoComplete="off" Width="145px"></asp:TextBox>
</div>
</div>
</div>
</div>
<div class="row" style="margin-bottom: 10px;">
<div class="col-md-2">
<label>Observaciones:</label>
</div>
<div class="col-md-4">
<asp:TextBox ID="TxtDevObs" runat="server" MaxLength="500" CssClass="form-control input-sm" Rows="2" TextMode="MultiLine" ClientIDMode="Static" Width="100%"></asp:TextBox>
</div>
<div class="col-md-2">
<label>Redondeo:</label>
</div>
<div class="col-md-4">
<asp:TextBox ID="TxtDevRedondeo" runat="server" MaxLength="12" CssClass="input-sm" ClientIDMode="Static" Style="text-align: right;" onkeyup="FCSumaTotalesNCAnticipos()" AutoComplete="off" Width="125px"></asp:TextBox>
</div>
</div>
<div class="row">
<div class="col-md-2">
<label>Cta Depósito:</label>
</div>
<div class="col-md-8">
<asp:DropDownList ID="DdlCuentaDeposito" runat="server" DataTextField="CuentaDeposito" DataValueField="CveCuentaDeposito" CssClass="form-control input-sm select2me" Width="400px" AppendDataBoundItems="True"></asp:DropDownList>
<asp:LinkButton ID="LnkAplicaDevolucion" CssClass="btn btn-primary" runat="server" OnClick="LnkAplicaDevolucion_Click">Guardar Devolución</asp:LinkButton>
<asp:LinkButton ID="LnkDevolucionCerrar" CssClass="btn default" runat="server" OnClick="LnkDevolucionCerrar_Click">Cerrar </asp:LinkButton>
</div>
</div>
</div>
<div class="table-scrollable">
<asp:GridView ID="GVAnticipos" runat="server" ClientIDMode="Static" AutoGenerateColumns="False" EmptyDataText="No se encontraron Anticipos del Cliente" ToolTip="Listado de Anticipos" CssClass="GVAnticipos table table-striped table-hover Widthall mysmallbtn" GridLines="None" DataKeyNames="ISTotal,Saldo,Total,CveIE,Folio,Tipo,CveVenta,CveConceptoContable" Style="text-align: center; min-width: 783px; width: 100%;">
<asp:GridView ID="GVAnticipos" runat="server" ClientIDMode="Static" AutoGenerateColumns="False" EmptyDataText="No se encontraron Anticipos del Cliente" CssClass="GVAnticipos table table-striped table-hover Widthall mysmallbtn" GridLines="None" DataKeyNames="ISTotal,Saldo,Total,CveIE,Folio,Tipo,CveVenta,CveConceptoContable,IVA,IEPS,RetIVA,RetISR,PorcentajeIVA" Style="text-align: center; min-width: 783px; width: 100%;">
<Columns>
<asp:TemplateField HeaderText="Folio" ItemStyle-HorizontalAlign="Center">
<ItemTemplate>
@@ -2339,10 +2437,11 @@
<asp:BoundField HeaderText="Saldo" DataField="Saldo" DataFormatString="{0:N2}" ItemStyle-HorizontalAlign="Right" />
<asp:TemplateField HeaderText="Devolución" ItemStyle-HorizontalAlign="Center" Visible="false">
<ItemTemplate>
<asp:CheckBox ID="chkDevolver" runat="server" Visible="false" CssClass="CssSelector" onclick="FCSumaTotalesNCAnticipos()" />
<asp:HyperLink ID="HLDevolverDinero" Visible="false" NavigateUrl="#" CssClass="btn btn-circle btn-sm green" Text="<i class='fa fa-usd'></i>" runat="server" />
</ItemTemplate>
</asp:TemplateField>
<%-- <asp:TemplateField HeaderText="Autorización" ItemStyle-HorizontalAlign="Center" Visible="false">
<%-- <asp:TemplateField HeaderText="Autorización" ItemStyle-HorizontalAlign="Center" Visible="false">
<ItemTemplate>
<asp:LinkButton ID="LnkAutorizar" Visible="false" NavigateUrl="#" CssClass="btn btn-circle btn-sm green" Text="<i class='fa fa-check'></i>" ToolTip="Autorizar Anticipo" runat="server" OnClick="LnkAutorizarAnticipo_Click" />
<asp:LinkButton ID="LnkCancelar" Visible="false" NavigateUrl="#" CssClass="btn btn-circle btn-sm red" Text="<i class='fa fa-ban'></i>" ToolTip="Bloquear Anticipo" runat="server" OnClick="LnkCancelarAnticipo_Click" />
@@ -2355,10 +2454,6 @@
</div>
<br />
<div class="row col-md-12" align="right">
<input type="text" id="TxtBusquedaAnticiposHistorial" class="form-control input-sm" onkeyup="<%= String.Format("FiltrarTabla('TxtBusquedaAnticiposHistorial','{0}')", GVAnticiposHistorial.ClientID) %>" style="display: inline-block; margin-right: -20px; width: 150px;" />
<a href="javascript:;" onclick="<%= String.Format("FiltrarTabla('TxtBusquedaAnticiposHistorial','{0}')", GVAnticiposHistorial.ClientID) %>" style="margin-top: -3px;" class="btn btn-circle btn-sm label-info"><i class="icon-magnifier"></i></a>
</div>
<div class="portlet light xspadding bordered">
<div class="portlet-title">
@@ -2372,6 +2467,8 @@
<ContentTemplate>
<asp:LinkButton ID="LnkAnticipoHistorialPDF" runat="server" data-toggle="tooltip" Title="PDF"> <i class="fa fa-file-pdf-o" style="margin-right: 10px; font-size:15px; font-weight:bold; color:dimgray;"></i> </asp:LinkButton>
<asp:LinkButton ID="LnkAnticipoHistorialExcel" runat="server" data-toggle="tooltip" Title="Excel"><i class="fa fa-file-excel-o" style="margin-right: 10px; font-size:15px; font-weight:bold; color:dimgray;"></i> </asp:LinkButton>
<input type="text" id="TxtBusquedaAnticiposHistorial" class="form-control input-sm" onkeyup="<%= String.Format("FiltrarTabla('TxtBusquedaAnticiposHistorial','{0}')", GVAnticiposHistorial.ClientID) %>" style="display: inline-block; margin-right: -20px; width: 125px;" />
<a href="javascript:;" onclick="<%= String.Format("FiltrarTabla('TxtBusquedaAnticiposHistorial','{0}')", GVAnticiposHistorial.ClientID) %>" style="margin-top: -3px;" class="btn btn-circle btn-sm label-info"><i class="icon-magnifier"></i></a>
</ContentTemplate>
<Triggers>
<asp:PostBackTrigger ControlID="LnkAnticipoHistorialPDF" />
@@ -2408,8 +2505,8 @@
</div>
</ContentTemplate>
</asp:UpdatePanel>
</asp:UpdatePanel>
</ContentTemplate>
</ajax:TabPanel>
@@ -3627,14 +3724,14 @@
<asp:UpdatePanel ID="UpContratosInactivos" runat="server" UpdateMode="Conditional">
<ContentTemplate>
<div id="dvCa" style="width: 100%; top: 30px">
<table id="dTable" class="table Widthall ">
<div id="dvCon" style="width: 100%; top: 30px">
<table id="dTablecon" class="table Widthall ">
<tr>
<td width="40%" id="TH1" style="font-size: medium; text-align: center!important; background-color: #b9b9b9;"><strong>Clasificación</strong> </td>
<td width="10%" id="TH2" style="font-size: medium; text-align: center!important; background-color: #dddddd;"><strong>Contratado</strong> </td>
<td width="20%" id="TH3" style="font-size: medium; text-align: center!important; background-color: #b9b9b9;"><strong>Avance</strong> </td>
<td width="20%" id="TH4" style="font-size: medium; text-align: center!important; background-color: #dddddd;"><strong>Faltante</strong> </td>
<td width="10%" id="TH5" style="font-size: medium; text-align: center!important; background-color: #b9b9b9;"><strong>Avance Por Facturar</strong> </td>
<td width="40%" id="THcon1" style="font-size: medium; text-align: center!important; background-color: #b9b9b9;"><strong>Clasificación</strong> </td>
<td width="10%" id="THcon2" style="font-size: medium; text-align: center!important; background-color: #dddddd;"><strong>Contratado</strong> </td>
<td width="20%" id="THcon3" style="font-size: medium; text-align: center!important; background-color: #b9b9b9;"><strong>Avance</strong> </td>
<td width="20%" id="THcon4" style="font-size: medium; text-align: center!important; background-color: #dddddd;"><strong>Faltante</strong> </td>
<td width="10%" id="THcon5" style="font-size: medium; text-align: center!important; background-color: #b9b9b9;"><strong>Avance Por Facturar</strong> </td>
</tr>
</table>
</div>
@@ -5642,14 +5739,14 @@
Importe total:
<asp:TextBox Text="" ID="TxtSaldoImportar" ClientIDMode="Static" Enabled="false" runat="server" />
</div>
</div>
</div>
<div class="row" style="margin-right: 10px; margin-top: 18px;" align="right" runat="server" id="DVBusquedaImportarSaldos" visible="false">
<input type="text" id="TxtBusquedaImportarSaldos" class="form-control input-sm" onkeyup="<%= String.Format("FiltrarTabla('TxtBusquedaImportarSaldos','{0}')", GvImportarSaldos.ClientID) %>" style="display: inline-block; margin-right: -20px; width: 150px;" />
<a href="javascript:;" onclick="<%= String.Format("FiltrarTabla('TxtBusquedaImportarSaldos','{0}')", GvImportarSaldos.ClientID) %>" style="margin-top: -3px;" class="btn btn-circle btn-sm label-info"><i class="icon-magnifier"></i></a>
</div>
<div class="row">
<div style="height: 300px; overflow-y: auto;">
<asp:GridView ID="GvImportarSaldos" DataKeyNames="CveIE, CveCliente,Total,IVA,Original,PorcentajeIVA,Tipo,CveVenta" AutoGenerateColumns="false" GridLines="None"
<asp:GridView ID="GvImportarSaldos" DataKeyNames="CveIE, CveCliente,Total,IVA,Original,PorcentajeIVA,Tipo,CveVenta" AutoGenerateColumns="false" GridLines="None"
CssClass="table table-striped table-hover Widthall" runat="server">
<Columns>
<asp:TemplateField ItemStyle-Width="5%">
@@ -7979,7 +8076,30 @@
$("#BtnDirClienteValidar").click();
}
function FCSumaTotalesNCAnticipos() {
var Total = 0.0;
debugger;
$(`.CssSelector input[type=checkbox]`).each(function () {
if ($(this).is(":checked")) {
Total += parseFloat($(this).attr("data-saldo"));
}
});
if (Total > 0) {
if ($(`#TxtDevRedondeo`).val() != '') {
Total += parseFloat($(`#TxtDevRedondeo`).val());
}
$(`#TxtImporteDev`).val(Total);
FormatoMoneda($get("TxtImporteDev"));
} else {
$(`#TxtImporteDev`).val("");
}
}
</script>

View File

@@ -101,6 +101,19 @@ Partial Class Clientes
End Set
End Property
Property ModalidadSelecionDevAnticipos As Boolean
Get
If ViewState("ModalidadSelecionDevAnticipos") Is Nothing Then
Return False
Else
Return CBool(ViewState("ModalidadSelecionDevAnticipos").ToString())
End If
End Get
Set(value As Boolean)
ViewState("ModalidadSelecionDevAnticipos") = value
End Set
End Property
Private Property Existe As Boolean
Get
Return Convert.ToBoolean(ViewState("Existe"))
@@ -3005,11 +3018,8 @@ Partial Class Clientes
If e.Row.DataKey("ISTotal") = "1" Then
e.Row.FCLiteral("LtlFecha").Text = String.Format("Total {0} ", e.Row.DataKey("Tipo"))
e.Row.BackColor = Drawing.Color.LightGray
End If
'If e.Row.DataKey("Saldo").ToDouble < 0 Then e.Row.Cells(2).ForeColor = Drawing.Color.Red
'If e.Row.DataKey("Saldo").ToDouble = 0 Then DirectCast(e.Row.FindControl("LtlAnticipos"), Literal).Text = ""
End If
If e.Row.RowIndex > -1 Then
If e.Row.DBCampo("Folio") = "N/D" Then
e.Row.FCLiteral("LtlFactura").Text = e.Row.DataKey("Folio")
@@ -3023,118 +3033,31 @@ Partial Class Clientes
End If
If UsuarioActual.TienePermisoProceso(247) Then
If CType(sender, GridView).ID = "GVAnticipos" And e.Row.DBCampo("CveVenta").ToEntero() > 0 And e.Row.DBCampo("Tipo") = "NC" Then
Dim Parametros As String = Encripta($"CveVenta={e.Row.DBCampo("CveVenta").ToEntero()}&SerieFolio={e.Row.DBCampo("Folio")}&CveMoneda={e.Row.DBCampo("CveMoneda")}&CveCliente={CveCliente}&Saldo={e.Row.DBCampo("Saldo")}&Original={e.Row.DBCampo("Original")}&CvePrePoliza={e.Row.DBCampo("CvePrePoliza")}")
e.Row.FCHyperLink("HLDevolverDinero").Visible = True
e.Row.FCHyperLink("HLDevolverDinero").NavigateUrl = $"/Bancos/IE.aspx?Opcion=DevDinV&P={Parametros}"
If CType(sender, GridView).ID = "GVAnticipos" Then ' And e.Row.DBCampo("CveVenta").ToEntero() > 0 And e.Row.DBCampo("Tipo") = "NC" Then
If (e.Row.DBCampo("CveVenta").ToEntero() > 0 AndAlso e.Row.DBCampo("Tipo").Contiene("Ant", "NC", "Dev")) OrElse (e.Row.DBCampo("CveIE").ToEntero() > 0 AndAlso e.Row.DBCampo("Tipo") = "IxC") Then
If ModalidadSelecionDevAnticipos Then
e.Row.FCCheckBox("chkDevolver").Visible = True
e.Row.FCCheckBox("chkDevolver").InputAttributes.Add("data-saldo", e.Row.DataKey("Saldo"))
End If
If e.Row.DBCampo("CveVenta").ToEntero() > 0 AndAlso e.Row.DBCampo("Tipo") = "NC" Then
Dim Parametros As String = Encripta($"CveVenta={e.Row.DBCampo("CveVenta").ToEntero()}&SerieFolio={e.Row.DBCampo("Folio")}&CveMoneda={e.Row.DBCampo("CveMoneda")}&CveCliente={CveCliente}&Saldo={e.Row.DBCampo("Saldo")}&Original={e.Row.DBCampo("Original")}&CvePrePoliza={e.Row.DBCampo("CvePrePoliza")}")
e.Row.FCHyperLink("HLDevolverDinero").Visible = True
e.Row.FCHyperLink("HLDevolverDinero").NavigateUrl = $"/Bancos/IE.aspx?Opcion=DevDinV&P={Parametros}"
End If
End If
End If
End If
If UsuarioActual.Empresa.Funcionalidad(185) = "1" AndAlso UsuarioActual.TienePermisoProceso(379) AndAlso CType(sender, GridView).ID = "GVAnticipos" Then
If e.Row.DBCampo("CveVenta").ToString().ToEntero() > 0 AndAlso e.Row.DBCampo("Tipo").ToString().Contiene("NC", "Ant") Then
If Not CBool(e.Row.DBCampo("AnticipoAutorizado")) Then
e.Row.FCLinkButton("LnkAutorizar").Visible = True
e.Row.FCLinkButton("LnkCancelar").Visible = False
Else
e.Row.FCLinkButton("LnkAutorizar").Visible = False
e.Row.FCLinkButton("LnkCancelar").Visible = True
End If
End If
If e.Row.DBCampo("CveIE").ToString().ToEntero() > 0 AndAlso e.Row.DBCampo("Tipo").ToString().Contiene("IxC") Then
If Not CBool(e.Row.DBCampo("AnticipoAutorizado")) Then
e.Row.FCLinkButton("LnkAutorizar").Visible = True
e.Row.FCLinkButton("LnkCancelar").Visible = False
Else
e.Row.FCLinkButton("LnkAutorizar").Visible = False
e.Row.FCLinkButton("LnkCancelar").Visible = True
End If
End If
End If
End If
End Sub
#End Region
#Region "R H"
Private Sub CargaPersonalAsignado()
Dim ObjPersonal As New ClsRH
If ObjPersonal.GetPersonal(-1, "-1", "-1", "-1", "-1", -1, -1, -1, -1, -1, -1, -1, -1, -1, CveCliente, "-1", -1, -1, -1, -1, -1, -1, "-1", "-1", "-1", "-1", UsuarioActual.CveEmpresa) Then
GVPersonal.DataSource = ObjPersonal.DtResultados
Else
GVPersonal.DataSource = Nothing
End If
ObjPersonal.Dispose()
GVPersonal.DataBind()
End Sub
Protected Sub GVPersonal_RowDataBound(sender As Object, e As System.Web.UI.WebControls.GridViewRowEventArgs) Handles GVPersonal.RowDataBound
If e.Row.RowType = DataControlRowType.DataRow Then
If e.Row.RowIndex = 0 Then
e.Row.Cells(0).Width = Unit.Pixel(70)
e.Row.Cells(1).Width = Unit.Pixel(300)
e.Row.Cells(2).Width = Unit.Pixel(80)
e.Row.Cells(3).Width = Unit.Pixel(80)
e.Row.Cells(4).Width = Unit.Pixel(120)
e.Row.Cells(5).Width = Unit.Pixel(120)
e.Row.Cells(6).Width = Unit.Pixel(60)
End If
e.Row.Cells(1).HorizontalAlign = HorizontalAlign.Left
e.Row.Cells(2).HorizontalAlign = HorizontalAlign.Left
e.Row.Cells(3).HorizontalAlign = HorizontalAlign.Left
e.Row.Cells(4).HorizontalAlign = HorizontalAlign.Left
e.Row.Cells(5).HorizontalAlign = HorizontalAlign.Left
Dim Liga As String = "<a class=""Texto"" href=""/RH/Personal.aspx?CvePersonal=" & e.Row.DBCampo("CvePersonal") & """>"
e.Row.FCLiteral("LtlCodigo").Text = Liga & e.Row.FCLiteral("LtlCodigo").Text & "</a>"
e.Row.FCLiteral("LtlPersonal").Text = Liga & e.Row.FCLiteral("LtlPersonal").Text & "</a>"
End If
End Sub
Protected Sub BtnConsultarAsistencia_Click(sender As Object, e As System.EventArgs) Handles BtnConsultarAsistencia.Click
Dim objpersonal As New ClsRH
If objpersonal.GetAsistencias(-1, CveCliente, -1, -1, -1, 1, -1, txtFechaI.Text.Trim.ToDate(), txtFechaF.Text.Trim.ToDate(), UsuarioActual.CveEmpresa) Then
GVAsistencia.DataSource = objpersonal.DtResultados.FiltraParametros("Fecha IS NOT NULL")
Else
GVAsistencia.DataSource = Nothing
End If
objpersonal.Dispose()
GVAsistencia.DataBind()
UpDatos.Update()
End Sub
Protected Sub GVAsistencia_RowDataBound(sender As Object, e As System.Web.UI.WebControls.GridViewRowEventArgs) Handles GVAsistencia.RowDataBound
If e.Row.RowType = DataControlRowType.DataRow Then
If e.Row.RowIndex = 0 Then
e.Row.Cells(0).Width = Unit.Pixel(75)
e.Row.Cells(1).Width = Unit.Pixel(145)
e.Row.Cells(2).Width = Unit.Pixel(70)
e.Row.Cells(3).Width = Unit.Pixel(100)
e.Row.Cells(4).Width = Unit.Pixel(100)
e.Row.Cells(5).Width = Unit.Pixel(145)
e.Row.Cells(6).Width = Unit.Pixel(220)
End If
e.Row.Cells(1).HorizontalAlign = HorizontalAlign.Left
e.Row.Cells(5).HorizontalAlign = HorizontalAlign.Left
e.Row.Cells(6).HorizontalAlign = HorizontalAlign.Left
If IsDate(e.Row.DBCampo("Fecha")) Then e.Row.FCLiteral("LtlFecha").Text = e.Row.DBCampo("Fecha").ToDate().ToShortDateString()
If e.Row.DBCampo("SeModifico") = "0" Then
e.Row.BackColor = Drawing.Color.LightBlue
ElseIf e.Row.DBCampo("SeModifico") = "1" Then
e.Row.ForeColor = Drawing.Color.Red
End If
End If
End Sub
#End Region
#Region "S U C U R S A L E S"
Private Sub LbAgregarSucursal_Click(sender As Object, e As EventArgs) Handles LbAgregarSucursal.Click
@@ -10829,6 +10752,226 @@ Partial Class Clientes
' End If
'End Sub
#Region "D E V O L U C I O N D E D I N E R O "
Protected Sub LnkDevolucionMasiva_Click(sender As Object, e As EventArgs)
TxtFechaDocumento.Text = Now.ToShortDateString
ModalidadSelecionDevAnticipos = True
divDevolverAnticipos.Visible = True
DdlCuenta.DataSource = GlobalDTBancosCuentas(UsuarioActual.CveUsuario, CveEmpresa:=UsuarioActual.CveEmpresa)
DdlCuenta.DataBind()
DdlTipoTransaccion.DataSource = GlobalDTTipoTransacciones.FiltraParametros("Tipo='Egs' AND Estatus = 1 ")
DdlTipoTransaccion.DataBind()
TxtImporteDev.Attributes.Add(“readonly”, “readonly”)
TxtImporteDev.Text = ""
TxtDevRedondeo.Text = ""
DdlCuentaDeposito.DataSource = GlobalDTCuentasDepositosClientes(UsuarioActual.CveEmpresa, CveCliente:=CveCliente)
DdlCuentaDeposito.DataBind()
'Dim Dep As New ClsGenerales
'If Dep.GetCuentasDepositos(CveCliente:=CveCliente, CveEmpresa:=UsuarioActual.CveEmpresa) Then
' DdlCuentaDeposito.DataSource = Dep.DtResultados
'End If
'Dep.Dispose()
DdlCuentaDeposito.Items.Insert(Opcion, New ListItem("-", "-1"))
CargaAnticipos()
End Sub
Protected Sub LnkDevolucionCerrar_Click(sender As Object, e As EventArgs)
ModalidadSelecionDevAnticipos = False
divDevolverAnticipos.Visible = False
CargaAnticipos()
End Sub
Protected Sub LnkAplicaDevolucion_Click(sender As Object, e As EventArgs)
If TxtImporteDev.Text.ToDecimal <= 0 Then
Alert("No se tiene importe a devolver.", TipoMensaje.MsgAdvertencia)
Exit Sub
End If
Dim ObjIE As New ClsBancos()
Dim ObjMov As New ClsContabilidad(ObjIE.IniciaTransacSQL)
Dim CveIE, CvePrePoliza As Integer
Dim tCveMoneda As Integer = 1
Dim tTipoCambio As Decimal = 1
Dim PagueseA As String = TxtNombre.Text
Dim MsgError As String = ""
Dim tImporteDev As Decimal = TxtImporteDev.Text.ToDecimal
Dim tCveCorte As Integer = -1
Dim tFolio As String = "1"
Dim tObs As String = TxtDevObs.Text.Trim
tCveMoneda = GlobalDTBancosCuentasGral(UsuarioActual.CveEmpresa, -1).FiltroPrimeroValor("CveMoneda", $"CveCuenta={DdlCuenta.SelectedValue}").ToEntero
CvePrePoliza = ObjMov.AddPrePolizas("Clientes/IE/DEV ", 1, tImporteDev, tImporteDev, tCveMoneda, TxtFechaDocumento.Text.ToDate, PagueseA, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, CveTipoPoliza:=2)
'valida prepoliza
If CvePrePoliza > 0 Then
tFolio = ObjIE.GetNextFolio(DdlCuenta.SelectedValue.ToEntero, DdlTipoTransaccion.SelectedValue.ToEntero).ToString
CveIE = ObjIE.AddBancos_IE(DdlCuenta.SelectedValue.ToEntero, DdlTipoTransaccion.SelectedValue.ToEntero, TxtFechaDocumento.Text.Trim.ToDate, tFolio, PagueseA, tImporteDev, tCveMoneda,
tTipoCambio, tObs, "", False, True, -1, CvePrePoliza, "", UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, CveCorte:=tCveCorte, CveCuentaDeposito:=DdlCuentaDeposito.SelectedValue.ToEntero)
If CveIE > 0 Then
Dim ImporteAplicar As Decimal = 0.0D
Dim ImporteAplicarMN As Decimal = 0.0D
Dim ImporteAplicarME As Decimal = 0.0D
Dim ReferenciaAplicar As String = ObjIE.Folio
Dim ConceptoAplicar As String = $"Devolución al cliente {PagueseA} {tImporteDev} "
ImporteAplicar = tImporteDev
ImporteAplicarME = ImporteAplicar
'CONSIDERA COMPLEMENTARIA
If tCveMoneda > 1 Then
ImporteAplicarMN = ImporteAplicar
Else
ImporteAplicarMN = (ImporteAplicar * If(tCveMoneda = 1, 1, tTipoCambio)).RoundSQL()
End If
'BANCOS
If Not ObjMov.AddPrePolizasDetalle(CvePrePoliza, True, ImporteAplicar, ImporteAplicarMN, 30, ReferenciaAplicar, ConceptoAplicar, CveIE:=CveIE, CveVenta:=-1, CveCliente:=CveCliente, ImporteME:=ImporteAplicarME) Then
MsgError = "Ocurrió un error al registrar el asiento de bancos de devolución"
End If
'BANCOS COMPLEMENTARIAs
If tCveMoneda > 1 Then
ImporteAplicarMN = ((ImporteAplicar * If(tCveMoneda = 1, 1, tTipoCambio)) - ImporteAplicar).RoundSQL()
If Not ObjMov.AddPrePolizasDetalle(CvePrePoliza, True, ImporteAplicar, ImporteAplicarMN, 204, ReferenciaAplicar, ConceptoAplicar, CveIE:=CveIE, CveVenta:=-1, CveCliente:=CveCliente, ImporteME:=ImporteAplicarME) Then
MsgError = "Ocurrió un error al registrar el asiento de bancos complementaria de devolución"
End If
End If
'OTROS INGRESOS/EGRESOS
Dim ImpOtros As Decimal = TxtDevRedondeo.Text.ToDecimal
If ImpOtros <> 0 Then
Dim TipoMovtoIE As Boolean = False
Dim CveConcIE As Integer = 78
Dim tCveSub As Integer = GlobalDTSubProyectos(UsuarioActual.CveEmpresa).FiltroPrimeroValor("CveSubProyecto").ToEntero
If ImpOtros < 0 Then
TipoMovtoIE = True : ImpOtros = Math.Abs(ImpOtros) : CveConcIE = 78
Else
TipoMovtoIE = False : ImpOtros = Math.Abs(ImpOtros) : CveConcIE = 211
End If
If Not ObjMov.AddPrePolizasDetalle(CvePrePoliza, TipoMovtoIE, ImpOtros, ImpOtros, CveConcIE, ReferenciaAplicar, ConceptoAplicar, CveIE:=CveIE, CveCliente:=CveCliente, ImporteME:=0, CveSubProyecto:=tCveSub) Then
MsgError = "Ocurrió un error al registrar el asiento de pago de devolución"
End If
End If
Dim tImporte As Decimal = 0
Dim tTipoMovto As Boolean = True
For Each gvr As GridViewRow In GVAnticipos.Rows
If gvr.FCCheckBox("chkDevolver").Checked Then
Dim PorcentajePagoDevDin As Decimal = (gvr.DataKey("Saldo").ToDecimal / gvr.DataKey("Total").ToDecimal).RoundSQL(6)
Dim tCveConcepto As Integer
ImporteAplicar = gvr.DataKey("Saldo").ToDecimal
If gvr.DataKey("Tipo") = "IxC" Then
tCveConcepto = 92 : tTipoMovto = False
ElseIf gvr.DataKey("Tipo").Contiene("Dev", "NC") Then
tCveConcepto = 12 : ImporteAplicar = -ImporteAplicar : tTipoMovto = True
ElseIf gvr.DataKey("Tipo").Contiene("Ant") Then
tCveConcepto = 11 : ImporteAplicar = ImporteAplicar : tTipoMovto = False
End If
ImporteAplicarMN = (ImporteAplicar * If(tCveMoneda = 1, 1, tTipoCambio)).RoundSQL()
If Not ObjMov.AddPrePolizasDetalle(CvePrePoliza, tTipoMovto, ImporteAplicar, ImporteAplicarMN, tCveConcepto, ReferenciaAplicar, ConceptoAplicar, CveIE:=gvr.DataKey("CveIE").ToEntero, CveVenta:=gvr.DataKey("CveVenta").ToEntero, CveCliente:=CveCliente, ImporteME:=ImporteAplicarME) Then
MsgError = "Ocurrió un error al registrar el asiento de pago de devolución"
Exit For
End If
'IMPUESTOS
If gvr.DataKey("IVA").ToDecimal > 0 Then
tImporte = -(gvr.DataKey("IVA").ToDecimal * PorcentajePagoDevDin).RoundSQL
If Not ObjMov.AddPrePolizasDetalle(CvePrePoliza, False, tImporte, tImporte, 13, ReferenciaAplicar, ConceptoAplicar, CveIE:=CveIE, CveVenta:=gvr.DataKey("CveVenta").ToEntero, CveCliente:=CveCliente, ImporteME:=ImporteAplicarME, PorcentajeImpuesto:=gvr.DataKey("PorcentajeIVA").ToDecimal) Then
MsgError = "Ocurrió un error al registrar el asiento de impuestos de devolución"
Exit For
End If
If Not ObjMov.AddPrePolizasDetalle(CvePrePoliza, True, tImporte, tImporte, 61, ReferenciaAplicar, ConceptoAplicar, CveIE:=CveIE, CveVenta:=gvr.DataKey("CveVenta").ToEntero, CveCliente:=CveCliente, ImporteME:=ImporteAplicarME, PorcentajeImpuesto:=gvr.DataKey("PorcentajeIVA").ToDecimal) Then
MsgError = "Ocurrió un error al registrar el asiento de impuestos de devolución"
Exit For
End If
End If
If gvr.DataKey("IEPS").ToDecimal > 0 Then
tImporte = (gvr.DataKey("IEPS").ToDecimal * PorcentajePagoDevDin).RoundSQL
If Not ObjMov.AddPrePolizasDetalle(CvePrePoliza, True, tImporte, tImporte, 39, ReferenciaAplicar, ConceptoAplicar, CveIE:=CveIE, CveVenta:=gvr.DataKey("CveVenta").ToEntero, CveCliente:=CveCliente, ImporteME:=ImporteAplicarME) Then
MsgError = "Ocurrió un error al registrar el asiento de impuestos de devolución"
Exit For
End If
End If
If gvr.DataKey("RetIVA").ToDecimal > 0 Then
tImporte = (gvr.DataKey("RetIVA").ToDecimal * PorcentajePagoDevDin).RoundSQL
If Not ObjMov.AddPrePolizasDetalle(CvePrePoliza, False, tImporte, tImporte, 62, ReferenciaAplicar, ConceptoAplicar, CveIE:=CveIE, CveVenta:=gvr.DataKey("CveVenta").ToEntero, CveCliente:=CveCliente, ImporteME:=ImporteAplicarME) Then
MsgError = "Ocurrió un error al registrar el asiento de impuestos de devolución"
Exit For
End If
End If
If gvr.DataKey("RetISR").ToDecimal > 0 Then
tImporte = (gvr.DataKey("RetISR").ToDecimal * PorcentajePagoDevDin).RoundSQL
If Not ObjMov.AddPrePolizasDetalle(CvePrePoliza, False, tImporte, tImporte, 63, ReferenciaAplicar, ConceptoAplicar, CveIE:=CveIE, CveVenta:=gvr.DataKey("CveVenta").ToEntero, CveCliente:=CveCliente, ImporteME:=ImporteAplicarME) Then
MsgError = "Ocurrió un error al registrar el asiento de impuestos de devolución"
Exit For
End If
End If
End If
Next
If MsgError = "" Then
If ObjMov.ValidacionesPrePoliza(CvePrePoliza, UsuarioActual) Then
If ObjMov.ValorPolizaDescuadre > 0 Then
' MsgError = ObjMov.MensajePolizaDescuadre
GuardaLogAD($"Bancos/IE | Error:{ObjMov.MensajePolizaDescuadre} Diferencia:{ObjMov.ValorDiferencia} | CvePrePoliza:{CvePrePoliza}", "LogPrePolizas")
End If
Else
MsgError = "No se pudo validar la prepoliza de cuadre."
End If
End If
If MsgError = "" Then
ObjIE.Commit()
Dim Msg As New StringBuilder
If Msg.ToString = "" Then
Msg.Append("El Documento se guardo correctamente")
End If
Dim Archivo As System.IO.FileInfo = Nothing
'VERIFICA SI EXISTE EL FORMATO
If DdlTipoTransaccion.SelectedValue.ToEntero.Contiene(2, 8, 9) Then
Archivo = New System.IO.FileInfo(String.Format("{0}Formatos/Transferencia.rdlc", UsuarioActual.Empresa.Ruta))
ElseIf DdlTipoTransaccion.SelectedValue.ToEntero.Contiene(1) Then
Archivo = New System.IO.FileInfo(String.Format("{0}Formatos/CHQ-{1}.rdlc", UsuarioActual.Empresa.Ruta, DdlCuenta.SelectedValue.ToEntero))
If Not Archivo.Exists Then
Archivo = New System.IO.FileInfo(String.Format("{0}\Empresas\Grales\Formatos\CHQ.rdlc", ModExtensiones.DirectorioBaseEmpresas))
End If
'ElseIf DdlTipoTransaccion.SelectedValue.ToEntero.Contiene(6) And UsuarioActual.CveEmpresa = 72 Then
' Archivo = New System.IO.FileInfo(String.Format("{0}Formatos/ComprobanteEgreso.rdlc", UsuarioActual.Empresa.Ruta, DdlCuenta.SelectedValue.ToEntero))
End If
If Archivo IsNot Nothing AndAlso Archivo.Exists Then
Msg.AppendFormat("<br/><br/> <a class=""Texto"" target='_blank' href=""/Compras/PopUpVerFactura.aspx?P={0}"">{1}</a> ", Encripta(String.Format("OP=IECHEQUE&CVEIE={0}", CveIE)), String.Format("Imprimir {0}", DdlTipoTransaccion.SelectedItem))
End If
ModalidadSelecionDevAnticipos = False
divDevolverAnticipos.Visible = False
CargaAnticipos()
If UsuarioActual.Empresa.TipoContabilidad = 1 Then
Msg.AppendFormat("<br/><br/><a class=""Texto"" target='_blank' href=""/Contabilidad/RegPrePolizas.aspx?CvePrePoliza={0}"">Ver Póliza</a>", CvePrePoliza)
End If
Alert(Msg.ToString)
Else
ObjIE.RollBack()
Alert(MsgError, TipoMensaje.MsgAdvertencia)
End If
End If
End If
ObjIE.Dispose()
ObjMov.Dispose()
End Sub
#End Region
End Class