-- 4 CyC: Poder aplicar una NC/ANT/IxC al mismo tiempo.

This commit is contained in:
2025-02-04 19:22:17 -07:00
parent f2e01602ad
commit 24d5972c2e
2 changed files with 423 additions and 545 deletions

View File

@@ -399,7 +399,7 @@
<div class="portlet light xspadding traspasorow bordered" runat="server" visible="false" id="DivCancelacionesPendientes">
<div class="portlet-title">
<div class="caption font-green">
<span class="caption-subject bold uppercase" style="line-height: 1; color: #ff6000;">Cancelaciones en proceso</span>
<span class="caption-subject bold uppercase" style="line-height: 1; color: #ff6000;">Cancelaciones en proceso</span>
</div>
<div class="actions">
@@ -423,11 +423,11 @@
CssClass="table table-striped table-advance table-hover Widthall ScrollAD mysmallbtn" GridLines="None" Width="100%">
<Columns>
<asp:BoundField HeaderText="Cliente" DataField="Nombre" ItemStyle-Width="25%" />
<asp:HyperLinkField HeaderText="Serie Folio" DataTextField="SerieFolio" DataNavigateUrlFields="CveVenta" ItemStyle-Width="15%" DataNavigateUrlFormatString="/Ventas/Ventas.aspx?CveVenta={0}" />
<asp:HyperLinkField HeaderText="Serie Folio" DataTextField="SerieFolio" DataNavigateUrlFields="CveVenta" ItemStyle-Width="15%" DataNavigateUrlFormatString="/Ventas/Ventas.aspx?CveVenta={0}" />
<asp:BoundField HeaderText="Importe" DataField="Total" DataFormatString="{0:N2}" ItemStyle-Width="15%" ItemStyle-HorizontalAlign="Right" />
<asp:BoundField HeaderText="Fecha Solicitud" DataField="FechaCambioEstatus" ItemStyle-Width="15%" />
<asp:BoundField HeaderText="Motivo" DataField="MotivoCancelacion" ItemStyle-Width="25%" />
<asp:TemplateField ItemStyle-Width="5%" >
<asp:TemplateField ItemStyle-Width="5%">
<ItemTemplate>
<asp:LinkButton runat="server" ID="BtnValidar" OnClick="BtnValidar_Click" CssClass="btn btn-circle btn-sm green" Text="<i class='fa fa-check'></i>" data-toggle="confirmation" data-popout="true" data-original-title="¿Está seguro que desea verificar la cancelación?" data-btn-ok-label="si"></asp:LinkButton>
</ItemTemplate>
@@ -444,7 +444,7 @@
<div class="col-md-6">
<asp:Panel runat="server" ID="PnlContado" DefaultButton="BtnPagar" Visible="false">
<div class="row">
<div class="note note-success">
<div class="row">
<div class="col-md-2">
@@ -465,11 +465,11 @@
</b>
</div>
<div class="col-md-1" style="text-align: right;">
<asp:LinkButton ID="LnkLiberar" runat="server" CssClass="btn btn-xs btn-success" Text="Liberar" OnClick="LnkLiberar_Click" />
<asp:LinkButton ID="LnkLiberar" runat="server" CssClass="btn btn-xs btn-success" Text="Liberar" OnClick="LnkLiberar_Click" />
</div>
</div>
</div>
</div>
</div>
<div class="row">
<div>
@@ -585,7 +585,6 @@
<div class="row">
<div class="col-md-2">
<label>Anticipos:</label><asp:LinkButton ID="ImgAntiPend" Visible="false" OnClick="ImgAntiPend_Click" runat="server" Text=" <i class='fa fa-money' style='font-size: 18px !important; color: #3c763d !important;'></i> " AlternateText="Aplicación de anticipos" Style="cursor: pointer;" />
</div>
<div class="col-md-4 input-icon">
<i style="margin: 0px;">$</i>
@@ -595,19 +594,19 @@
<div class="col-md-6">
<label>
<asp:UpdatePanel ID="UPPCobranza" runat="server" UpdateMode="Conditional">
<ContentTemplate>
<ContentTemplate>
<div class="row">
<div class="col-md-6">
<asp:Literal ID="LtlTipoAnticipo" runat="server"></asp:Literal></label>
<asp:HiddenField ID="HdnTipoAmortizacion" runat="server" Value="" />
<asp:LinkButton ID="LnkCxC" runat="server" CssClass="btn btn-xs btn-success" Text="Cobranza" OnClick="LnkCxC_Click" />
<asp:Literal ID="LtlTipoAnticipo" runat="server"></asp:Literal></label>
<%--<asp:HiddenField ID="HdnTipoAmortizacion" runat="server" Value="" />--%>
<asp:LinkButton ID="LnkCxC" runat="server" CssClass="btn btn-xs btn-success" Text="Cobranza" OnClick="LnkCxC_Click" />
</div>
<div class="col-md-6">
<asp:TextBox ID="TxtCxCAplicado" CssClass="form-control input-sm TextBoxAsLabel" runat="server" MaxLength="12" Width="100px" Enabled="false" ClientIDMode="Static" Style="text-align: right;"></asp:TextBox>
<asp:TextBox ID="TxtCxCAplicado" CssClass="form-control input-sm TextBoxAsLabel" runat="server" MaxLength="12" Width="100px" Enabled="false" ClientIDMode="Static" Style="text-align: right;"></asp:TextBox>
</div>
</div>
</div>
</ContentTemplate>
</asp:UpdatePanel>
</div>
@@ -641,35 +640,35 @@
</ContentTemplate>
</asp:UpdatePanel>
<asp:UpdatePanel runat="server" ID="UPPTotalesContado" UpdateMode="Conditional">
<asp:UpdatePanel runat="server" ID="UPPTotalesContado" UpdateMode="Conditional">
<ContentTemplate>
<div class="chequesie2">
<div class="row">
<label class="col-md-1">Total:</label>
<div class="col-md-3 input-icon">
<i style="margin: 0px;">$</i>
<asp:TextBox ID="TxtImporteContado" CssClass="form-control input-sm " runat="server" MaxLength="12" Width="100px" ReadOnly="true" ClientIDMode="Static" Style="text-align: right;"></asp:TextBox>
<ajax:FilteredTextBoxExtender ID="FilteredTextBoxExtender3" runat="server" TargetControlID="TxtImporteContado" FilterType="Custom, Numbers" ValidChars=".," />
<div class="chequesie2">
<div class="row">
<label class="col-md-1">Total:</label>
<div class="col-md-3 input-icon">
<i style="margin: 0px;">$</i>
<asp:TextBox ID="TxtImporteContado" CssClass="form-control input-sm " runat="server" MaxLength="12" Width="100px" ReadOnly="true" ClientIDMode="Static" Style="text-align: right;"></asp:TextBox>
<ajax:FilteredTextBoxExtender ID="FilteredTextBoxExtender3" runat="server" TargetControlID="TxtImporteContado" FilterType="Custom, Numbers" ValidChars=".," />
</div>
<label id="lblCambio" class="col-md-1">Cambio:</label>
<div class="col-md-3 input-icon">
<i style="margin: 0px;">$</i>
<asp:TextBox ID="TxtCambio" CssClass="form-control input-sm " Enabled="false" runat="server" MaxLength="12" Width="100px" ClientIDMode="Static" Style="text-align: right;"></asp:TextBox>
<ajax:FilteredTextBoxExtender ID="FTBECambio" runat="server" TargetControlID="TxtCambio" FilterType="Custom, Numbers" ValidChars=".," />
<br />
</div>
<label id="lblCambio2" class="col-md-1">Sob/falt:</label>
<div class="col-md-3 input-icon">
<i style="margin: 0px;">$</i>
<asp:TextBox ID="TxtFaltante" CssClass="form-control input-sm " runat="server" MaxLength="12" Width="100px" ClientIDMode="Static" Style="text-align: right;"></asp:TextBox>
<ajax:FilteredTextBoxExtender ID="FilteredTextBoxExtender4" runat="server" TargetControlID="TxtCambio" FilterType="Custom, Numbers" ValidChars=".," />
<br />
</div>
<label id="lblCambio" class="col-md-1">Cambio:</label>
<div class="col-md-3 input-icon">
<i style="margin: 0px;">$</i>
<asp:TextBox ID="TxtCambio" CssClass="form-control input-sm " Enabled="false" runat="server" MaxLength="12" Width="100px" ClientIDMode="Static" Style="text-align: right;"></asp:TextBox>
<ajax:FilteredTextBoxExtender ID="FTBECambio" runat="server" TargetControlID="TxtCambio" FilterType="Custom, Numbers" ValidChars=".," />
<br />
</div>
<label id="lblCambio2" class="col-md-1">Sob/falt:</label>
<div class="col-md-3 input-icon">
<i style="margin: 0px;">$</i>
<asp:TextBox ID="TxtFaltante" CssClass="form-control input-sm " runat="server" MaxLength="12" Width="100px" ClientIDMode="Static" Style="text-align: right;"></asp:TextBox>
<ajax:FilteredTextBoxExtender ID="FilteredTextBoxExtender4" runat="server" TargetControlID="TxtCambio" FilterType="Custom, Numbers" ValidChars=".," />
<br />
</div>
</div>
</div>
</div>
</ContentTemplate>
</asp:UpdatePanel>
</ContentTemplate>
</asp:UpdatePanel>
</div>
</div>
<div class="chequesie2" id="divPagar">
@@ -679,7 +678,7 @@
<asp:HiddenField ID="HdnCveCliente" runat="server" />
<asp:HiddenField ID="HdnPlazoCobranza" runat="server" />
<asp:HiddenField ID="HdnVentaCondicionesPago" runat="server" />
<asp:HiddenField ID="HdnCveIE" runat="server" />
<asp:HiddenField ID="HdnCveIE" runat="server" />
<asp:HiddenField ID="HdnTotal" runat="server" ClientIDMode="Static" />
<asp:Button ID="BtnPagar" CssClass="btn btn-large btn-success e-big-btn" runat="server" Text="Pagar" />
</div>
@@ -1184,67 +1183,7 @@
</h4>
</div>
<div class="modal-body">
<div class="row" runat="server" id="divAmortizacionTipo" visible="false">
<div class="col-md-4">
Tipo Amortización:
</div>
<div class="col-md-8">
<asp:DropDownList ID="DdlTipoAmortizacionAnticipo" runat="server" AutoPostBack="true" Width="250px" CssClass="select2me" CausesValidation="true" OnSelectedIndexChanged="DdlTipoAmortizacionAnticipo_SelectedIndexChanged">
<asp:ListItem Text="Seleccionar" Value="-1"></asp:ListItem>
<asp:ListItem Text="Amortización anticipo con nota de crédito" Value="2"></asp:ListItem>
</asp:DropDownList>
</div>
<asp:RequiredFieldValidator ID="RfvDdlTipoAmortizacionAnticipo" runat="server" Display="None" ControlToValidate="DdlTipoAmortizacionAnticipo" InitialValue="-1" ErrorMessage="Debe Seleccionarse un tipo" ValidationGroup="VGAnticiposClientes"></asp:RequiredFieldValidator>
<ajax:ValidatorCalloutExtender ID="CEDdlTipoAmortizacionAnticipo" runat="server" HighlightCssClass="vco" TargetControlID="RfvDdlTipoAmortizacionAnticipo" Width="300px"></ajax:ValidatorCalloutExtender>
<div class="row" style="text-align: center;" runat="server" id="divAnticipoMsg" visible="false">
<asp:Label ID="Label2" runat="server" Text="Se aplicará descuento por el total de las amortizaciones en los productos" CssClass="alert alert-warning" Style="padding: 5px; margin-bottom: 5px; padding-right: 25px;"></asp:Label>
</div>
</div>
<div class="row" id="divAmortizacionTipoRelacion" runat="server" visible="false">
<div class="col-md-4">
Tipo Relación:
</div>
<div class="col-md-8">
<asp:DropDownList ID="DdlTipoRelacionAnticipo" runat="server" Width="250px" CssClass="select2me">
<asp:ListItem Text="07 - CFDI por aplicación de anticipo" Value="7"></asp:ListItem>
</asp:DropDownList>
</div>
</div>
<div class="row" id="DivConceptoNC" runat="server" visible="false">
<div class="col-md-4">
Concepto:
</div>
<div class="col-md-8">
<asp:DropDownList ID="DdlNCPSAnt" runat="server" DataTextField="PSCodigo" DataValueField="CvePS" Width="250px" CssClass="select2me"></asp:DropDownList>
<asp:RequiredFieldValidator ID="RFVNCPSAnt" runat="server" InitialValue="-1" ControlToValidate="DdlNCPSAnt" Display="None" ErrorMessage="<b><span style='text-decoration: underline'>ERROR:</span></b><br />El campo <b>''Concepto''</b> es necesario, por favor ingréselo." ValidationGroup="VGAnticiposClientes"></asp:RequiredFieldValidator>
<ajax:ValidatorCalloutExtender ID="VCERFVNCPSAnt" runat="server" HighlightCssClass="vco" TargetControlID="RFVNCPSAnt" Width="350px"></ajax:ValidatorCalloutExtender>
</div>
</div>
<div class="row" id="DivFechaAnticipoCliente" runat="server" visible="false">
<b>
<label class="col-md-2">Fecha:</label></b>
<div class="col-md-4">
<div class="input-group input-sm input-small date date-picker " data-date-format="dd/mm/yyyy" style="width: 80% !important; padding: 0px;">
<asp:TextBox ID="TxtFechaAnticipoCliente" runat="server" ClientIDMode="Static" CssClass="form-control" CausesValidation="true" MaxLength="10" AutoPostBack="true" OnTextChanged="TxtFechaAnticipoCliente_TextChanged"></asp:TextBox>
<span class="input-group-btn ">
<asp:LinkButton ID="ImgFechaAnticipoCliente" class="btn default " Text="<i class='fa fa-calendar'></i>" runat="server"></asp:LinkButton>
</span>
<ajax:MaskedEditExtender ID="MEEFechaAnticipoCliente" runat="server" TargetControlID="TxtFechaAnticipoCliente" Mask="99/99/9999" MaskType="Date" DisplayMoney="Left" AcceptNegative="Left"></ajax:MaskedEditExtender>
<ajax:CalendarExtender runat="server" ID="CEFechaAnticipoCliente" TargetControlID="TxtFechaAnticipoCliente" PopupButtonID="ImgFechaAnticipoCliente" PopupPosition="BottomRight" Enabled="True"></ajax:CalendarExtender>
<asp:CompareValidator ID="CvFechaAnticipoCliente" runat="server" ControlToValidate="TxtFechaAnticipoCliente" Display="None" Operator="DataTypeCheck" Type="Date" ValidationGroup="VGAnticiposClientes" ErrorMessage="<b><span style='text-decoration: underline'>ERROR:</span></b><br />El campo <b>''Fecha''</b> no tiene el formato correcto, por favor intente de nuevo con el siguiente formato: (dd/mm/yyyy)."></asp:CompareValidator>
<ajax:ValidatorCalloutExtender ID="VcoFechaAnticipoCliente" runat="server" Enabled="True" HighlightCssClass="vco" TargetControlID="CvFechaAnticipoCliente" Width="300px"></ajax:ValidatorCalloutExtender>
</div>
</div>
</div>
<br />
<div style="max-height: 300px; overflow-y: auto;">
<div style="max-height: 700px; overflow-y: auto;">
<div class="row" style="margin-left: 0px; text-align: right" align="left">
<div class="col-md-2">
<asp:LinkButton ID="LnkRecargaAnticipos" NavigateUrl="#" CssClass="btn btn-circle btn-sm green" Text="<i class='fa fa-refresh'></i> Actualizar" runat="server" OnClick="LnkRecargaAnticipos_Click" />
@@ -1255,6 +1194,13 @@
</div>
</div>
<br />
<div class="row">
<div class="col-md-12" style="display:flex; justify-content:end; font-size:16px; font-weight: bold;">
<span> Total: </span>
<asp:Label ID="LblTotalAnticipos" runat="server" ClientIDMode="Static" Text="0.00"></asp:Label>
</div>
</div>
<asp:GridView ID="GVAnticipos" runat="server" AutoGenerateColumns="False" ClientIDMode="Static" EmptyDataText="No se encontraron Anticipos del Cliente"
ToolTip="Listado de Anticipos" CssClass="GVAnticipos table table-striped table-hover Widthall mysmallbtn" data-height="300" GridLines="None"
DataKeyNames="ISTotal,Saldo,CveIE,Folio,Tipo,CveVenta,CveConceptoContable,CveConceptoContableAmor, TotalAnticipo, SubTotalAnticipo, IVAAnticipo,IEPS, ImpuestosLocalesAnticipo, SubTotalAmortizacion, SubTotal, Original, IVA, RetIVA, RetISR, FolioFiscal, CveClasificacionNC, TipoCambio,TipoCambioPago,TipoCambioHoy, CveMoneda,Fecha,SaldoSubTotal,SaldoConImpuestos,RegresarImpuesto,DevolucionImportePagado,CveCliente,Descuentos">
@@ -1283,6 +1229,12 @@
<asp:Literal ID="LtlAnticipos" runat="server" Text='<%# Eval("Saldo", "{0:N2}") %>'></asp:Literal>&nbsp;
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField>
<HeaderTemplate>Tipo</HeaderTemplate>
<ItemTemplate>
<asp:Literal ID="LtlTipo" runat="server" Text='<%# Eval("Tipo") %>'></asp:Literal>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField Visible="false">
<HeaderTemplate>Moneda Venta</HeaderTemplate>
<ItemTemplate>
@@ -1304,7 +1256,6 @@
<asp:TemplateField>
<HeaderTemplate>Amort. Ant.</HeaderTemplate>
<ItemTemplate>
<asp:Label ID="LblTotalAnticipos" runat="server" ClientIDMode="Static" Text="0.00" Visible="false"></asp:Label>
<asp:TextBox ID="TxtAnticipo" CssClass="CSGATxtAnticipo" runat="server" CausesValidation="true" MaxLength="12" Width="76px"></asp:TextBox>
<asp:CompareValidator ID="CVAmortAnti" runat="server" ControlToValidate="TxtAnticipo" Display="None" ErrorMessage="El campo <b>''Amortización de Anticipos''</b> no tiene el formato correcto, por favor corrija e intente de nuevo (Solo formato numérico)." Operator="DataTypeCheck" Type="Currency" ValidationGroup="VGAnticiposClientes"></asp:CompareValidator>
<ajax:ValidatorCalloutExtender ID="VCOAmortAnti" runat="server" HighlightCssClass="vco" TargetControlID="CVAmortAnti" Width="300px"></ajax:ValidatorCalloutExtender>
@@ -1340,14 +1291,13 @@
<div class="modal-content">
<div class="modal-header ">
<button type="button" class="close" data-dismiss="modal">&times;</button>
<h4 class="modal-title">
Estados de Cajas
<h4 class="modal-title">Estados de Cajas
</h4>
</div>
<div class="modal-body">
<div class="row">
<div class="col-md-12" >
<div class="col-md-12">
<asp:GridView ID="GvEstadoCajas" runat="server" AutoGenerateColumns="true" ClientIDMode="Static" EmptyDataText=""
OnRowDataBound="GvEstadoCajas_RowDataBound"
@@ -1358,9 +1308,9 @@
</asp:GridView>
</div>
</div>
</div>
</div>
<div class="modal-footer">
<%--<asp:Button ID="Button1" runat="server" Text="Aceptar" class="btn btn-primary" ValidationGroup="VGAnticiposClientes" />
@@ -1375,81 +1325,81 @@
<asp:Button ID="BtnEnviarMailCancelacion" runat="server" ClientIDMode="Static" Text="Enviar Mail Cliente" Style="display: none;" OnClick="BtnEnviarMailCancelacion_Click" />
<asp:UpdatePanel runat="server" ID="UPPCxC" UpdateMode="Conditional" RenderMode="Inline">
<ContentTemplate>
<div id="divCxC" class="modal ADS fade" role="dialog">
<div class="modal-dialog" style="width: 700px;">
<div class="modal-content">
<div class="modal-header ">
<button type="button" class="close" data-dismiss="modal">&times;</button>
<h4 class="modal-title">
<asp:Label runat="server">Cuentas por cobrar:&nbsp;<asp:Literal ID="Literal1" runat="server"></asp:Literal></asp:Label>
</h4>
</div>
<div class="modal-body">
<div style="max-height: 300px; overflow-y: auto;">
<div class="row" style="margin-left: 0px; text-align: right" align="left">
<div style="margin-right: 15px">
<input type="text" id="TxtBusquedaCxC" class="form-control input-sm" onkeyup="<%= String.Format("FiltrarTabla('TxtBusquedaCxC','{0}')", GvCxC.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>
<asp:GridView ID="GvCxC" runat="server" AutoGenerateColumns="False" ClientIDMode="Static" EmptyDataText="No se encontró cobranza pendiente del cliente"
CssClass=" table table-striped table-hover Widthall mysmallbtn" data-height="300" GridLines="None"
DataKeyNames=" CveVenta,PorcentajeIVA,TipoDocto,CveSubProyecto,CveMoneda,TipoCambio, Fecha,SerieFolio, SubTotal,IVA,Total,IEPS,RetIVA,RetISR, CveCliente,Saldo">
<Columns>
<asp:TemplateField>
<ItemTemplate>
<asp:CheckBox ID="Chk" runat="server" />
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField>
<HeaderTemplate>Folio</HeaderTemplate>
<ItemTemplate>
<asp:Literal ID="LtlFactura" runat="server" Text='<%# Eval("SerieFolio") %>'></asp:Literal>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField>
<HeaderTemplate>Fecha</HeaderTemplate>
<ItemTemplate>
<asp:Literal ID="LtlFecha" runat="server" Text='<%# Eval("Fecha", "{0:d}") %>'></asp:Literal>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField>
<HeaderTemplate>Saldo</HeaderTemplate>
<ItemTemplate>
<asp:Literal ID="LtlAnticipos" runat="server" Text='<%# Eval("Saldo", "{0:N2}") %>'></asp:Literal>&nbsp;
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField Visible="false">
<HeaderTemplate>Moneda Venta</HeaderTemplate>
<ItemTemplate>
<asp:Literal ID="MonedaVenta" runat="server"></asp:Literal>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField>
<HeaderTemplate>Moneda</HeaderTemplate>
<ItemTemplate>
<asp:Literal ID="LtlAbreviatura" runat="server" Text='<%# Eval("Abreviatura") %>'></asp:Literal>
</ItemTemplate>
</asp:TemplateField>
</Columns>
</asp:GridView>
<asp:UpdatePanel runat="server" ID="UPPCxC" UpdateMode="Conditional" RenderMode="Inline">
<ContentTemplate>
<div id="divCxC" class="modal ADS fade" role="dialog">
<div class="modal-dialog" style="width: 700px;">
<div class="modal-content">
<div class="modal-header ">
<button type="button" class="close" data-dismiss="modal">&times;</button>
<h4 class="modal-title">
<asp:Label runat="server">Cuentas por cobrar:&nbsp;<asp:Literal ID="Literal1" runat="server"></asp:Literal></asp:Label>
</h4>
</div>
<div class="modal-body">
<div style="max-height: 300px; overflow-y: auto;">
<div class="row" style="margin-left: 0px; text-align: right" align="left">
<div style="margin-right: 15px">
<input type="text" id="TxtBusquedaCxC" class="form-control input-sm" onkeyup="<%= String.Format("FiltrarTabla('TxtBusquedaCxC','{0}')", GvCxC.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>
</div>
<div class="modal-footer">
<asp:Button ID="BtnAplicarCxC" runat="server" Text="Aceptar" class="btn btn-primary" OnClick="BtnAplicarCxC_Click" />
<button type="button" class="btn btn-default" data-dismiss="modal">Cancelar</button>
<asp:GridView ID="GvCxC" runat="server" AutoGenerateColumns="False" ClientIDMode="Static" EmptyDataText="No se encontró cobranza pendiente del cliente"
CssClass=" table table-striped table-hover Widthall mysmallbtn" data-height="300" GridLines="None"
DataKeyNames=" CveVenta,PorcentajeIVA,TipoDocto,CveSubProyecto,CveMoneda,TipoCambio, Fecha,SerieFolio, SubTotal,IVA,Total,IEPS,RetIVA,RetISR, CveCliente,Saldo">
<Columns>
<asp:TemplateField>
<ItemTemplate>
<asp:CheckBox ID="Chk" runat="server" />
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField>
<HeaderTemplate>Folio</HeaderTemplate>
<ItemTemplate>
<asp:Literal ID="LtlFactura" runat="server" Text='<%# Eval("SerieFolio") %>'></asp:Literal>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField>
<HeaderTemplate>Fecha</HeaderTemplate>
<ItemTemplate>
<asp:Literal ID="LtlFecha" runat="server" Text='<%# Eval("Fecha", "{0:d}") %>'></asp:Literal>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField>
<HeaderTemplate>Saldo</HeaderTemplate>
<ItemTemplate>
<asp:Literal ID="LtlAnticipos" runat="server" Text='<%# Eval("Saldo", "{0:N2}") %>'></asp:Literal>&nbsp;
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField Visible="false">
<HeaderTemplate>Moneda Venta</HeaderTemplate>
<ItemTemplate>
<asp:Literal ID="MonedaVenta" runat="server"></asp:Literal>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField>
<HeaderTemplate>Moneda</HeaderTemplate>
<ItemTemplate>
<asp:Literal ID="LtlAbreviatura" runat="server" Text='<%# Eval("Abreviatura") %>'></asp:Literal>
</ItemTemplate>
</asp:TemplateField>
</Columns>
</asp:GridView>
</div>
</div>
<div class="modal-footer">
<asp:Button ID="BtnAplicarCxC" runat="server" Text="Aceptar" class="btn btn-primary" OnClick="BtnAplicarCxC_Click" />
<button type="button" class="btn btn-default" data-dismiss="modal">Cancelar</button>
</div>
</div>
</div>
</ContentTemplate>
</asp:UpdatePanel>
</div>
</div>
</ContentTemplate>
</asp:UpdatePanel>
</asp:Content>
<asp:Content ID="Content7" ContentPlaceHolderID="JS" runat="Server">
@@ -1466,8 +1416,6 @@
function chkAnt(t, txt, importe, AmorContrato = 0) {
let totalAnt = 0;
let TipoAnticipo = $('#<%= DdlTipoAmortizacionAnticipo.ClientID %>').val();
//si es con.nc,es.el.total
let Total = ToDouble($get("C_LtlSaldo").value.replace(",", ""));
@@ -1486,8 +1434,12 @@
totalAnt = FnSumaValoresAnt();
if (totalAnt > SaldoCompra) {
txt.value = FormatoNumero(importe - (totalAnt - SaldoCompra), 2);
//$get('HdnVentaSaldo').value = 0.00;
let valor = FormatoNumero(importe - (totalAnt - SaldoCompra), 2);
if (valor == 'NaN') {
txt.value = "0.00";
} else {
txt.value = valor;
}
alert("El Importe no debe de exceder a el saldo");
}
@@ -1508,13 +1460,8 @@
let Total = ToDouble($get("C_LtlSaldo").value.replace(",", ""));// ToDouble($get('TxtSubTotal').value);
let TipoAnticipo = $('#<%= DdlTipoAmortizacionAnticipo.ClientID %>').val();
let importeTxt = parseFloat(txt.value.replace(/,/g, ''));
if (TipoAnticipo == '4') {
Total = ToDouble($get("C_LtlSaldo").value.replace(",", ""));
}
if (isNaN(importeTxt)) {
importeTxt = 0;
} else {

View File

@@ -673,7 +673,9 @@ Partial Class Ventas_PVCobranza
Dim ObjOIEventos As New ClsOIEventos(ObjVentas2.IniciaTransacSQL())
Dim respFactura As Modelos.Factura.MMensajeFactura = Nothing
Dim respNC As Modelos.Factura.MMensajeFactura = Nothing
Dim ListaNC As New List(Of Modelos.Factura.MMensajeFactura)
'Dim respNC As Modelos.Factura.MMensajeFactura = Nothing
Dim RegistrarPago As Boolean = True
Dim PlazoCobranza As Integer = HdnPlazoCobranza.Value.ToEntero
Try
@@ -693,44 +695,12 @@ Partial Class Ventas_PVCobranza
If respFactura IsNot Nothing AndAlso Not respFactura.TieneError Then
CveVenta = respFactura.CveVenta
If HdnTipoAmortizacion.Value = "4" Then
If respFactura.Factura.DtAnticiposAplicados IsNot Nothing Then
PagoAplicado += respFactura.Factura.DtAnticiposAplicados.SUM("Importe")
SaldoPendienteVenta = SaldoPendienteVenta - PagoAplicado
SaldoPendientePagos = SaldoPendientePagos - PagoAplicado
For Each RowAnt As DataRow In respFactura.Factura.DtAnticiposAplicados.Rows
If Not ActualizaAnticipos(RowAnt("CveIE").ToString().ToEntero(), RowAnt("CveVenta").ToString().ToEntero(), RowAnt("Tipo").ToString(), RowAnt("Folio").ToString(), ObjVentas2, ObjOIEventos) Then
MsgError = "Ocurrió un error al actualizar los anticipos"
Exit For
End If
Next
End If
End If
End If
End If
'GENERAR NC PARA AMORTIZACION
If MsgError = "" AndAlso UsuarioActual.CveEmpresa.Contiene(189) AndAlso HdnTipoAmortizacion.Value = "2" Then
respNC = GenerarNC(CveVendedor, VentaActual, ObjVentas2)
If respNC IsNot Nothing Then
If respNC.TieneError Then
CveVenta = -1
If respNC.Mensajes.Count > 0 Then
MsgError = respNC.Mensajes(0)
Else
MsgError = "Ocurrió un error al generar la nota de crédito"
End If
Else
PagoAplicado += respNC.Factura.Total
If respFactura.Factura.DtAnticiposAplicados IsNot Nothing Then
PagoAplicado += respFactura.Factura.DtAnticiposAplicados.SUM("Importe")
SaldoPendienteVenta = SaldoPendienteVenta - PagoAplicado
SaldoPendientePagos = SaldoPendientePagos - PagoAplicado
For Each RowAnt As DataRow In respNC.Factura.DtAnticiposAplicados.Rows
For Each RowAnt As DataRow In respFactura.Factura.DtAnticiposAplicados.Rows
If Not ActualizaAnticipos(RowAnt("CveIE").ToString().ToEntero(), RowAnt("CveVenta").ToString().ToEntero(), RowAnt("Tipo").ToString(), RowAnt("Folio").ToString(), ObjVentas2, ObjOIEventos) Then
MsgError = "Ocurrió un error al actualizar los anticipos"
Exit For
@@ -738,11 +708,53 @@ Partial Class Ventas_PVCobranza
Next
End If
Else
MsgError = "Ocurrió un error al generar la nota de crédito"
End If
End If
'GENERAR NC PARA AMORTIZACION
If ListaAnticiposAplicados.Where(Function(x) x.Tipo = "Ant").Any() Then
For Each gvr As GridViewRow In GVAnticipos.Rows
If gvr.DataKey("Tipo") = "Ant" AndAlso gvr.FCCheckBox("Chk" & gvr.RowIndex) IsNot Nothing AndAlso gvr.FCCheckBox("Chk" & gvr.RowIndex).Checked Then
Dim ImporteAnticipo As Decimal = gvr.FCTextBox(String.Format("TxtAnticipo{0}", gvr.RowIndex)).Text.ToDecimal
Dim RespNC = GenerarNC(ImporteAnticipo, CveVendedor, VentaActual, gvr, ObjVentas2)
If RespNC IsNot Nothing Then
If RespNC.TieneError Then
CveVenta = -1
If RespNC.Mensajes.Count > 0 Then
MsgError = RespNC.Mensajes(0)
Else
MsgError = "Ocurrió un error al generar la nota de crédito"
End If
Exit For
Else
PagoAplicado += RespNC.Factura.Total
SaldoPendienteVenta = SaldoPendienteVenta - PagoAplicado
SaldoPendientePagos = SaldoPendientePagos - PagoAplicado
For Each RowAnt As DataRow In RespNC.Factura.DtAnticiposAplicados.Rows
If Not ActualizaAnticipos(RowAnt("CveIE").ToString().ToEntero(), RowAnt("CveVenta").ToString().ToEntero(), RowAnt("Tipo").ToString(), RowAnt("Folio").ToString(), ObjVentas2, ObjOIEventos) Then
MsgError = "Ocurrió un error al actualizar los anticipos"
Exit For
End If
Next
ListaNC.Add(RespNC)
End If
Else
MsgError = "Ocurrió un error al generar la nota de crédito"
End If
End If
Next
End If
If MsgError = "" Then
If SaldoPendienteVenta > 0 AndAlso VentaContado Then
@@ -906,25 +918,19 @@ Partial Class Ventas_PVCobranza
Dim msBuild As New StringBuilder()
Try
Dim MsgTimbrado As String = ""
Dim FolioFiscalFactura = ""
Dim DebeTimbrar As Boolean = True
Dim SeTimbro As Boolean = False
Dim SeTimbroNC As Boolean = False
'SI SE GENERO FACTURA DE INGRESO, TIMBRARLA DESPUES DE REALIZAR EL PAGO
If DebeTimbrar AndAlso respFactura IsNot Nothing Then
Try
'VERIFICA SI SE GENERO NC
If respNC IsNot Nothing Then
AjustarTimbre(respFactura.Factura, respNC.Factura)
MsgTimbrado = TimbrarFactura(respFactura.Factura, respNC.Factura, SeTimbro, SeTimbroNC)
Else
AjustarTimbre(respFactura.Factura, Nothing)
MsgTimbrado = TimbrarFactura(respFactura.Factura, Nothing, SeTimbro, SeTimbroNC)
End If
AjustarTimbreFactura(respFactura.Factura)
Dim ObjTimbre = TimbrarFactura(respFactura.Factura, SeTimbro)
MsgTimbrado = ObjTimbre.MensajeErrorCFDI
FolioFiscalFactura = ObjTimbre.UUID
If Not String.IsNullOrEmpty(MsgTimbrado) Then
Dim StrEr As String = $"<br/><div id = 'DivTipoCambioAdvertencia' class='alert alert-danger' style='padding: 5px; margin-bottom: 5px; padding-right: 25px;'><strong style = 'font-size: 20px; margin-right: 25px;' > Comprobante no emitido : </strong><br/> {MsgTimbrado}<br/>Por favor inténtelo de nuevo a través del botón 'Emitir' en ventas.</div>"
@@ -932,55 +938,34 @@ Partial Class Ventas_PVCobranza
End If
Catch ex As Exception
GuardaLogAD(ex.ToString())
msBuild.AppendFormat("<br/>{0}<br/>", MsgTimbrado)
End Try
End If
If respFactura IsNot Nothing Then
If RegistrarPago Then
msBuild.Append("<span style=""font-size:14px;"">Pago Registrado correctamente. </span> <br/><br/>")
End If
Try
If RegistrarPago Then
msBuild.Append("<span style=""font-size:14px;"">Pago Registrado correctamente. </span> <br/><br/>")
End If
msBuild.AppendFormat("<span style=""font-size:14px;""> La factura <a class=""Texto"" target=""_blank"" style=""font-size:18px;font-weight:bold;"" href=""/Ventas/Ventas.aspx?CveVenta={0}"">{1}</a> se genero correctamente. </span> <br/>", respFactura.CveVenta, respFactura.SerieFolio)
msBuild.AppendFormat("<span style=""font-size:14px;""> La factura <a class=""Texto"" target=""_blank"" style=""font-size:18px;font-weight:bold;"" href=""/Ventas/Ventas.aspx?CveVenta={0}"">{1}</a> se genero correctamente. </span> <br/>", respFactura.CveVenta, respFactura.SerieFolio)
If SeTimbro Then
Dim xml = String.Format("<ul><li><a class=""Texto"" target=""_blank"" href=""/Compras/PopUpVerFactura.aspx?P={0}"">Descargar XML</a></li></ul>", Encripta(String.Format("OP=FactVta&CVEVENTA={0}&EXT={1}&SERIEFOLIO={2}&TIPODOCTO={3}", respFactura.CveVenta, "XML", respFactura.SerieFolio, respFactura.Factura.TipoDocto)))
msBuild.AppendFormat("{0}", xml)
End If
Dim pdf = String.Format("<ul><li><a class=""Texto"" href=""/Compras/PopUpVerFactura.aspx?P={0}"">Descargar PDF</a></li></ul>", Encripta(String.Format("OP=VTA&CVEVENTA={0}&PAG=1", respFactura.CveVenta)))
msBuild.AppendFormat("{0}", pdf)
If respFactura.Factura.Inv_CveMovimiento > 0 Then
msBuild.AppendFormat("<b><a target='_blank' class='Texto' href=""/Inventarios/EntradasSalidas.aspx?CveMovimiento={0}"">Movimiento de Almacén</a></b><br/>", respFactura.Factura.Inv_CveMovimiento)
End If
If respNC IsNot Nothing Then
msBuild.AppendFormat("<span style=""font-size:14px;""> La nota de crédito <a class=""Texto"" target=""_blank"" style=""font-size:18px;font-weight:bold;"" href=""/Ventas/Ventas.aspx?CveVenta={0}"">{1}</a> se genero correctamente.</span> <br/>", respNC.CveVenta, respNC.SerieFolio)
If SeTimbroNC Then
Dim xml = String.Format("<ul><li><a class=""Texto"" target=""_blank"" href=""/Compras/PopUpVerFactura.aspx?P={0}"">Descargar XML</a></li></ul>", Encripta(String.Format("OP=FactVta&CVEVENTA={0}&EXT={1}&SERIEFOLIO={2}&TIPODOCTO={3}", respNC.CveVenta, "XML", respNC.SerieFolio, respNC.Factura.TipoDocto)))
If SeTimbro Then
Dim xml = String.Format("<ul><li><a class=""Texto"" target=""_blank"" href=""/Compras/PopUpVerFactura.aspx?P={0}"">Descargar XML</a></li></ul>", Encripta(String.Format("OP=FactVta&CVEVENTA={0}&EXT={1}&SERIEFOLIO={2}&TIPODOCTO={3}", respFactura.CveVenta, "XML", respFactura.SerieFolio, respFactura.Factura.TipoDocto)))
msBuild.AppendFormat("{0}", xml)
Else
If Not String.IsNullOrEmpty(MsgTimbrado) Then
msBuild.AppendFormat("<br/>{0}<br/>", MsgTimbrado)
End If
End If
Dim pdfNC = String.Format("<ul><li><a class=""Texto"" href=""/Compras/PopUpVerFactura.aspx?P={0}"">Descargar PDF</a></li></ul>", Encripta(String.Format("OP=VTA&CVEVENTA={0}&PAG=1", respNC.CveVenta)))
msBuild.AppendFormat("{0}", pdfNC)
End If
Dim pdf = String.Format("<ul><li><a class=""Texto"" href=""/Compras/PopUpVerFactura.aspx?P={0}"">Descargar PDF</a></li></ul>", Encripta(String.Format("OP=VTA&CVEVENTA={0}&PAG=1", respFactura.CveVenta)))
msBuild.AppendFormat("{0}", pdf)
If respNC IsNot Nothing Then
If respNC IsNot Nothing AndAlso respNC.Factura IsNot Nothing AndAlso respNC.Factura.DtAnticiposAplicados IsNot Nothing Then
For Each dr As DataRow In respNC.Factura.DtAnticiposAplicados.Rows
msBuild.AppendLine($"<br><a class=""Texto"" target='_blank' href=""/Compras/PopUpVerFactura.aspx?P={Encripta(String.Format("OP=AMORTIZACIONHIS&CVEIE={0}&CVEVENTA={1}&CVECLIENTE={2}&CVEVENTAAMORTIZADA={3}&MONTO={4}",
dr("CveIE").ToString,
dr("CveVenta").ToString,
respNC.Factura.CveCliente,
respNC.CveVenta,
respNC.Factura.Total))}"">Imprimir Saldo Aplicado {dr("Folio").ToString}</a><br/>")
Next
If respFactura.Factura.Inv_CveMovimiento > 0 Then
msBuild.AppendFormat("<b><a target='_blank' class='Texto' href=""/Inventarios/EntradasSalidas.aspx?CveMovimiento={0}"">Movimiento de Almacén</a></b><br/>", respFactura.Factura.Inv_CveMovimiento)
End If
Else
If respFactura IsNot Nothing AndAlso respFactura.Factura IsNot Nothing AndAlso respFactura.Factura.DtAnticiposAplicados IsNot Nothing Then
For Each dr As DataRow In respFactura.Factura.DtAnticiposAplicados.Rows
msBuild.AppendLine($"<br><a class=""Texto"" target='_blank' href=""/Compras/PopUpVerFactura.aspx?P={Encripta(String.Format("OP=AMORTIZACIONHIS&CVEIE={0}&CVEVENTA={1}&CVECLIENTE={2}&CVEVENTAAMORTIZADA={3}&MONTO={4}",
@@ -991,11 +976,62 @@ Partial Class Ventas_PVCobranza
respFactura.Factura.Total))}"">Imprimir Saldo Aplicado {dr("Folio").ToString}</a><br/>")
Next
End If
End If
If Not String.IsNullOrEmpty(MsgTimbrado) Then
If ListaNC.Count > 0 Then
For Each respNC In ListaNC
Dim MsgTimbradoNC As String = ""
msBuild.AppendFormat("<span style=""font-size:14px;""> La nota de crédito <a class=""Texto"" target=""_blank"" style=""font-size:18px;font-weight:bold;"" href=""/Ventas/Ventas.aspx?CveVenta={0}"">{1}</a> se genero correctamente.</span> <br/>", respNC.CveVenta, respNC.SerieFolio)
Dim SeTimbroNC As Boolean = False
If SeTimbro Then
'PONER LA RELACION CON LA FACTURA CREADA
AjustarTimbreNC(respNC.Factura, FolioFiscalFactura)
Dim ObjTimbreNC = TimbrarFactura(respNC.Factura, SeTimbroNC)
If Not String.IsNullOrEmpty(ObjTimbreNC.MensajeErrorCFDI) Then
MsgTimbradoNC = ObjTimbreNC.MensajeErrorCFDI
End If
Else
MsgTimbradoNC = $"No se pudo timbrar la NC porque la factura de ingreso no ha sido timbrada previamente"
End If
If SeTimbroNC Then
Dim xml = String.Format("<ul><li><a class=""Texto"" target=""_blank"" href=""/Compras/PopUpVerFactura.aspx?P={0}"">Descargar XML</a></li></ul>", Encripta(String.Format("OP=FactVta&CVEVENTA={0}&EXT={1}&SERIEFOLIO={2}&TIPODOCTO={3}", respNC.CveVenta, "XML", respNC.SerieFolio, respNC.Factura.TipoDocto)))
msBuild.AppendFormat("{0}", xml)
End If
Dim pdfNC = String.Format("<ul><li><a class=""Texto"" href=""/Compras/PopUpVerFactura.aspx?P={0}"">Descargar PDF</a></li></ul>", Encripta(String.Format("OP=VTA&CVEVENTA={0}&PAG=1", respNC.CveVenta)))
msBuild.AppendFormat("{0}", pdfNC)
If respNC IsNot Nothing AndAlso respNC.Factura IsNot Nothing AndAlso respNC.Factura.DtAnticiposAplicados IsNot Nothing Then
For Each dr As DataRow In respNC.Factura.DtAnticiposAplicados.Rows
msBuild.AppendLine($"<br><a class=""Texto"" target='_blank' href=""/Compras/PopUpVerFactura.aspx?P={Encripta(String.Format("OP=AMORTIZACIONHIS&CVEIE={0}&CVEVENTA={1}&CVECLIENTE={2}&CVEVENTAAMORTIZADA={3}&MONTO={4}",
dr("CveIE").ToString,
dr("CveVenta").ToString,
respNC.Factura.CveCliente,
respNC.CveVenta,
respNC.Factura.Total))}"">Imprimir Saldo Aplicado {dr("Folio").ToString}</a><br/>")
Next
End If
If Not String.IsNullOrEmpty(MsgTimbradoNC) Then
Dim StrEr As String = $"<br/><div id = 'DivTipoCambioAdvertencia' class='alert alert-danger' style='padding: 5px; margin-bottom: 5px; padding-right: 25px;'><strong style = 'font-size: 20px; margin-right: 25px;' > Comprobante no emitido : </strong><br/> {MsgTimbradoNC}<br/>Por favor inténtelo de nuevo a través del botón 'Emitir' en ventas.</div>"
MsgTimbradoNC = StrEr
msBuild.AppendFormat("<br/>{0}<br/>", MsgTimbradoNC)
End If
Next
End If
Catch ex As Exception
GuardaLogAD(ex.ToString())
msBuild.AppendFormat("<br/>{0}<br/>", MsgTimbrado)
End If
End Try
Else
msBuild.Append($"Pago Registrado correctamente.<br/><br/> <a href=""/Compras/PopUpVerFactura.aspx?P={Encripta(String.Format("OP=VTA&CVEVENTA={0}&PAG=1&GUARDAR=1&TICKET=1&REGENERAR=1", CveVenta))}"" class='Texto'>Imprimir ticket</a>")
@@ -1047,6 +1083,51 @@ Partial Class Ventas_PVCobranza
Alert("Ocurrió un error al cargar la venta", TipoMensaje.MsgError)
End If
End Sub
Private Sub AjustarTimbreFactura(ByRef ObjFactura As Modelos.Factura)
ObjFactura.Timbre.CFDIRelacionados.UUID.Clear()
'SI TIENE RELACIONADOS ANTICIPOS PONER TIPO RELACION 7
If ListaAnticiposAplicados.Where(Function(x) x.Tipo = "Ant").Any() Then
Dim Anticipos = ListaAnticiposAplicados.Where(Function(Obj) Obj.Tipo = "Ant")
If Anticipos IsNot Nothing AndAlso Anticipos.Count() > 0 Then
For Each Ant As Modelos.MAnticipoRelacionado In Anticipos
ObjFactura.Timbre.CFDIRelacionados.UUID.Add(Ant.FolioFiscal)
Next
ObjFactura.Timbre.CFDIRelacionados.TipoRelacion = "07"
ObjFactura.Timbre.CFDIRelacionados.TipoRelacionTexto = "07-CFDI por aplicación de anticipo"
End If
End If
'SI TIENE NC/DEV PONER TIPO RELACION 1
If Not ListaAnticiposAplicados.Where(Function(x) x.Tipo = "Ant").Any() AndAlso ListaAnticiposAplicados.Where(Function(x) x.Tipo = "NC").Any() Then
Dim DevolucionesNC = ListaAnticiposAplicados.Where(Function(Obj) Obj.Tipo = "NC")
If DevolucionesNC IsNot Nothing AndAlso DevolucionesNC.Count() > 0 Then
For Each NC As Modelos.MAnticipoRelacionado In DevolucionesNC
ObjFactura.Timbre.CFDIRelacionados.UUID.Add(NC.FolioFiscal)
Next
Dim RowTipoRelacion As DataRow = GlobalDTVtaTiposRelacion().FiltroPrimero($"CveTipoRelacion = {ObjFactura.CveTipoRelacion}")
ObjFactura.Timbre.CFDIRelacionados.TipoRelacion = RowTipoRelacion("SATClaveTipoRelacion").ToString()
ObjFactura.Timbre.CFDIRelacionados.TipoRelacionTexto = RowTipoRelacion("SATTipoRelacion").ToString()
End If
End If
End Sub
Private Sub AjustarTimbreNC(ByRef ObjNC As Modelos.Factura, FolioFiscalFactura As String)
ObjNC.Timbre.CFDIRelacionados.UUID.Clear()
ObjNC.Timbre.CFDIRelacionados.UUID.Add(FolioFiscalFactura)
ObjNC.Timbre.CFDIRelacionados.TipoRelacion = "07"
ObjNC.Timbre.CFDIRelacionados.TipoRelacionTexto = "07-CFDI por aplicación de anticipo"
ObjNC.Timbre.Comprobante.MetodoPago = GlobalDTVtaMetodoPago.FiltroPrimeroValor("ClaveMetodoPagoSAT", $"CveMetodoPago = {ObjNC.CveMetodoPago}") ' Obj.ClaveMetodoPagoSAT
ObjNC.Timbre.Comprobante.FormadePago = GlobalDTVtaFormaPago.FiltroPrimeroValor("ClaveFormaPagoSAT", $"CveFormaPago = {ObjNC.CveFormaPago}") 'Obj.ClaveFormaPagoSAT
ObjNC.Timbre.Receptor.UsoCFDI = GlobalDTSATUsosCFDI.FiltroPrimeroValor("UsoCFDI", $"CveUsoCFDI = {ObjNC.CveUsoCFDI}")
End Sub
Private Function ActualizaAnticipos(CveIE As Integer, CveVenta As Integer, Tipo As String, Folio As String, ByRef ObjVentas As ClsVentas, ByRef ObjEventoBitacora As ClsOIEventos) As Boolean
@@ -1086,7 +1167,7 @@ Partial Class Ventas_PVCobranza
TxtAutorizo.Text = ""
TxtNCDev.Text = ""
LtlTipoAnticipo.Text = ""
HdnTipoAmortizacion.Value = ""
'HdnTipoAmortizacion.Value = ""
CveCliente = -1
CveVendedor = -1
@@ -1213,45 +1294,44 @@ Partial Class Ventas_PVCobranza
ObjFactura.PreparaTimbre()
If HdnTipoAmortizacion.Value = "4" Then
DtAnticipos.Columns.Add("CveVenta", GetType(Integer))
DtAnticipos.Columns.Add("Importe", GetType(Decimal))
DtAnticipos.Columns.Add("CveConceptoContable", GetType(Integer))
DtAnticipos.Columns.Add("CveIE", GetType(Integer))
DtAnticipos.Columns.Add("FolioFiscal", GetType(String))
DtAnticipos.Columns.Add("Descuentos", GetType(Decimal))
DtAnticipos.Columns.Add("TotalAnticipo", GetType(Decimal))
DtAnticipos.Columns.Add("SubTotalAnticipo", GetType(Decimal))
DtAnticipos.Columns.Add("CveMoneda", GetType(Decimal))
DtAnticipos.Columns.Add("Fecha", GetType(DateTime))
DtAnticipos.Columns.Add("TipoCambioPago", GetType(Decimal))
DtAnticipos.Columns.Add("Folio", GetType(String))
DtAnticipos.Columns.Add("Tipo", GetType(String))
DtAnticipos.Columns.Add("CveVenta", GetType(Integer))
DtAnticipos.Columns.Add("Importe", GetType(Decimal))
DtAnticipos.Columns.Add("CveConceptoContable", GetType(Integer))
DtAnticipos.Columns.Add("CveIE", GetType(Integer))
DtAnticipos.Columns.Add("FolioFiscal", GetType(String))
DtAnticipos.Columns.Add("Descuentos", GetType(Decimal))
DtAnticipos.Columns.Add("TotalAnticipo", GetType(Decimal))
DtAnticipos.Columns.Add("SubTotalAnticipo", GetType(Decimal))
DtAnticipos.Columns.Add("CveMoneda", GetType(Decimal))
DtAnticipos.Columns.Add("Fecha", GetType(DateTime))
DtAnticipos.Columns.Add("TipoCambioPago", GetType(Decimal))
DtAnticipos.Columns.Add("Folio", GetType(String))
DtAnticipos.Columns.Add("Tipo", GetType(String))
For Each GvRow As GridViewRow In GVAnticipos.Rows
If GvRow.DataKey("Tipo").Contiene("NC", "IxC") AndAlso GvRow.FCCheckBox("Chk" & GvRow.RowIndex) IsNot Nothing AndAlso GvRow.FCCheckBox("Chk" & GvRow.RowIndex).Checked Then
For Each GvRow As GridViewRow In GVAnticipos.Rows
If GvRow.FCCheckBox("Chk" & GvRow.RowIndex) IsNot Nothing AndAlso GvRow.FCCheckBox("Chk" & GvRow.RowIndex).Checked Then
Dim CveVenta = GvRow.DataKey("CveVenta").ToEntero()
Dim Importe = GvRow.FCTextBox(String.Format("TxtAnticipo{0}", GvRow.RowIndex)).Text.ToDecimal()
Dim CveConceptoContable = GvRow.DataKey("CveConceptoContable").ToEntero()
Dim CveIE = GvRow.DataKey("CveIE").ToEntero()
Dim CveVenta = GvRow.DataKey("CveVenta").ToEntero()
Dim Importe = GvRow.FCTextBox(String.Format("TxtAnticipo{0}", GvRow.RowIndex)).Text.ToDecimal()
Dim CveConceptoContable = GvRow.DataKey("CveConceptoContable").ToEntero()
Dim CveIE = GvRow.DataKey("CveIE").ToEntero()
Dim FolioFiscal = GvRow.DataKey("FolioFiscal")
Dim Descuentos As Decimal = GvRow.DataKey("Descuentos").ToDecimal()
Dim TotalAnticipo As Decimal = GvRow.DataKey("TotalAnticipo").ToDecimal()
Dim SubTotalAnticipo As Decimal = GvRow.DataKey("SubTotalAnticipo").ToDecimal()
Dim CveMoneda As Integer = GvRow.DataKey("CveMoneda").ToEntero()
Dim Fecha As DateTime = GvRow.DataKey("Fecha").ToDateTime()
Dim TipoCambioPago As Decimal = GvRow.DataKey("TipoCambioPago").ToDecimal()
Dim Folio = GvRow.DataKey("Folio")
Dim Tipo = GvRow.DataKey("Tipo")
Dim FolioFiscal = GvRow.DataKey("FolioFiscal")
Dim Descuentos As Decimal = GvRow.DataKey("Descuentos").ToDecimal()
Dim TotalAnticipo As Decimal = GvRow.DataKey("TotalAnticipo").ToDecimal()
Dim SubTotalAnticipo As Decimal = GvRow.DataKey("SubTotalAnticipo").ToDecimal()
Dim CveMoneda As Integer = GvRow.DataKey("CveMoneda").ToEntero()
Dim Fecha As DateTime = GvRow.DataKey("Fecha").ToDateTime()
Dim TipoCambioPago As Decimal = GvRow.DataKey("TipoCambioPago").ToDecimal()
Dim Folio = GvRow.DataKey("Folio")
Dim Tipo = GvRow.DataKey("Tipo")
DtAnticipos.Rows.Add(CveVenta, Importe, CveConceptoContable, CveIE, FolioFiscal, Descuentos, TotalAnticipo, SubTotalAnticipo, CveMoneda, Fecha, TipoCambioPago, Folio, Tipo)
DtAnticipos.Rows.Add(CveVenta, Importe, CveConceptoContable, CveIE, FolioFiscal, Descuentos, TotalAnticipo, SubTotalAnticipo, CveMoneda, Fecha, TipoCambioPago, Folio, Tipo)
End If
Next
End If
Next
If DtAnticipos.Rows.Count > 0 Then
ObjFactura.EsNCAmortizacion = True
ObjFactura.CveTipoAmortizacionAnticipo = 4
ObjFactura.DtAnticiposAplicados = DtAnticipos
@@ -1264,6 +1344,16 @@ Partial Class Ventas_PVCobranza
ObjFactura.PedidoContrato = PedidoContrato
ObjFactura.OrdenCompra = OrdenCompra
'SI TIENE RELACIONADOS ANTICIPOS PONER TIPO RELACION 7
If ListaAnticiposAplicados.Where(Function(x) x.Tipo = "Ant").Any() Then
ObjFactura.CveTipoRelacion = 7
End If
'SI TIENE NC/DEV PONER TIPO RELACION 1
If Not ListaAnticiposAplicados.Where(Function(x) x.Tipo = "Ant").Any() AndAlso ListaAnticiposAplicados.Where(Function(x) x.Tipo = "NC").Any() Then
ObjFactura.CveTipoRelacion = 1
End If
Retorno = ObjFactura.EmitirFactura(False, Transac:=ObjVentas.IniciaTransacSQL(), Modulo:="Cobranza/GuardarVenta", MostrarURL:=True)
Retorno.Factura = ObjFactura
@@ -1326,6 +1416,7 @@ Partial Class Ventas_PVCobranza
VentaActual.PorcentajeIVA = DbRowVenta("PorcentajeIVA").ToString.ToDecimal
VentaActual.UsuarioActual = UsuarioActual
VentaActual.CveSubProyecto = DbRowVenta("CveSubProyecto").ToString.ToEntero
VentaActual.CveUsoCFDI = DbRowVenta("CveUsoCFDI").ToString.ToEntero
VentaRemision = VentaActual
End If
@@ -1352,7 +1443,7 @@ Partial Class Ventas_PVCobranza
Return (regex.IsMatch(texto))
End Function
Private Function GenerarNC(CveVendedor As Integer, ByRef Venta As Venta, ByRef ObjVentas As ClsVentas) As Modelos.Factura.MMensajeFactura
Private Function GenerarNC(ImporteTotal As Decimal, CveVendedor As Integer, ByRef Venta As Venta, GvRowAnticipo As GridViewRow, ByRef ObjVentas As ClsVentas) As Modelos.Factura.MMensajeFactura
Dim Retorno As Modelos.Factura.MMensajeFactura = Nothing
Dim SbAlert As New StringBuilder()
@@ -1365,7 +1456,7 @@ Partial Class Ventas_PVCobranza
ObjNC.TipoCambio = 1
End If
Dim Total As Decimal = TxtNCDev.Text.ToDecimal()
Dim Total As Decimal = ImporteTotal
Dim subTotal As Decimal = (Total / (1D + Venta.PorcentajeIVA))
'Dim IVA = (subTotal * Factura.PorcentajeIVA).RoundSQL(2)
Dim PU As Decimal = subTotal
@@ -1373,7 +1464,13 @@ Partial Class Ventas_PVCobranza
Dim Descuento As Decimal = 0
Dim Obs = ""
ObjNC.AgregarPS(DdlNCPSAnt.SelectedValue.ToEntero(), Cantidad, PU, Descuento, Obs, CveSubProyecto:=Venta.CveSubProyecto, PorcentajeIVA:=Venta.PorcentajeIVA)
Dim CvePSAnticipo As Integer = 1
Dim DatarowPS = GlobalDTPS(UsuarioActual.CveEmpresa, SATClavePS:="84111506").FiltroPrimero("CodigoPS LIKE '%ANTICIPO%' OR CodigoPS LIKE '%anticipo%' OR CodigoPS LIKE '%Anticipo%'")
If DatarowPS IsNot Nothing Then
CvePSAnticipo = DatarowPS("CvePS").ToString().ToEntero()
End If
ObjNC.AgregarPS(CvePSAnticipo, Cantidad, PU, Descuento, Obs, CveSubProyecto:=Venta.CveSubProyecto, PorcentajeIVA:=Venta.PorcentajeIVA)
ObjNC.CalculaTotales()
Dim DtVentasNC = New DataTable
@@ -1410,46 +1507,43 @@ Partial Class Ventas_PVCobranza
DtAnticipos.Columns.Add("Folio", GetType(String))
DtAnticipos.Columns.Add("Tipo", GetType(String))
For Each GvRow As GridViewRow In GVAnticipos.Rows
If GvRow.FCCheckBox("Chk" & GvRow.RowIndex) IsNot Nothing AndAlso GvRow.FCCheckBox("Chk" & GvRow.RowIndex).Checked Then
Dim CveVenta = GvRow.DataKey("CveVenta").ToEntero()
Dim Importe = GvRow.FCTextBox(String.Format("TxtAnticipo{0}", GvRow.RowIndex)).Text.ToDecimal()
Dim CveConceptoContable = GvRow.DataKey("CveConceptoContable").ToEntero()
Dim CveIE = GvRow.DataKey("CveIE").ToEntero()
If GvRowAnticipo IsNot Nothing Then
Dim CveVenta = GvRowAnticipo.DataKey("CveVenta").ToEntero()
Dim Importe = GvRowAnticipo.FCTextBox(String.Format("TxtAnticipo{0}", GvRowAnticipo.RowIndex)).Text.ToDecimal()
Dim CveConceptoContable = GvRowAnticipo.DataKey("CveConceptoContable").ToEntero()
Dim CveIE = GvRowAnticipo.DataKey("CveIE").ToEntero()
Dim FolioFiscal = GvRow.DataKey("FolioFiscal")
Dim Descuentos As Decimal = GvRow.DataKey("Descuentos").ToDecimal()
Dim TotalAnticipo As Decimal = GvRow.DataKey("TotalAnticipo").ToDecimal()
Dim SubTotalAnticipo As Decimal = GvRow.DataKey("SubTotalAnticipo").ToDecimal()
Dim CveMoneda As Integer = GvRow.DataKey("CveMoneda").ToEntero()
Dim Fecha As DateTime = GvRow.DataKey("Fecha").ToDateTime()
Dim TipoCambioPago As Decimal = GvRow.DataKey("TipoCambioPago").ToDecimal()
Dim Folio = GvRow.DataKey("Folio")
Dim Tipo = GvRow.DataKey("Tipo")
Dim FolioFiscal = GvRowAnticipo.DataKey("FolioFiscal")
Dim Descuentos As Decimal = GvRowAnticipo.DataKey("Descuentos").ToDecimal()
Dim TotalAnticipo As Decimal = GvRowAnticipo.DataKey("TotalAnticipo").ToDecimal()
Dim SubTotalAnticipo As Decimal = GvRowAnticipo.DataKey("SubTotalAnticipo").ToDecimal()
Dim CveMoneda As Integer = GvRowAnticipo.DataKey("CveMoneda").ToEntero()
Dim Fecha As DateTime = GvRowAnticipo.DataKey("Fecha").ToDateTime()
Dim TipoCambioPago As Decimal = GvRowAnticipo.DataKey("TipoCambioPago").ToDecimal()
Dim Folio = GvRowAnticipo.DataKey("Folio")
Dim Tipo = GvRowAnticipo.DataKey("Tipo")
DtAnticipos.Rows.Add(CveVenta, Importe, CveConceptoContable, CveIE, FolioFiscal, Descuentos, TotalAnticipo, SubTotalAnticipo, CveMoneda, Fecha, TipoCambioPago, Folio, Tipo)
End If
Next
DtAnticipos.Rows.Add(CveVenta, Importe, CveConceptoContable, CveIE, FolioFiscal, Descuentos, TotalAnticipo, SubTotalAnticipo, CveMoneda, Fecha, TipoCambioPago, Folio, Tipo)
End If
ObjNC.EsNCAmortizacion = True
ObjNC.CveTipoAmortizacionAnticipo = 2
ObjNC.DtAnticiposAplicados = DtAnticipos
ObjNC.PreparaTimbre()
ObjNC.CveFormaPago = 21 'Aplicación de anticipos
ObjNC.CveMetodoPago = 1
ObjNC.CveMetodoPago = 1
ObjNC.CveUsoCFDI = Venta.CveUsoCFDI
ObjNC.CveVendedor = CveVendedor
ObjNC.CveTipoRelacion = 7
ObjNC.PreparaTimbre()
'AjustarTimbreNC(ObjNC)
Retorno = ObjNC.EmitirFactura(False, Transac:=ObjVentas.IniciaTransacSQL(), Modulo:="Cobranza/GuardarVenta", MostrarURL:=True)
Retorno.Factura = ObjNC
If Retorno IsNot Nothing AndAlso Retorno.CveVenta > 0 Then
For Each msg In Retorno.Mensajes
SbAlert.AppendFormat("{0} <br/>", msg)
Next
@@ -1465,80 +1559,15 @@ Partial Class Ventas_PVCobranza
Return Retorno
End Function
Private Sub AjustarTimbre(ByRef ObjFactura As Modelos.Factura, ByRef ObjNC As Modelos.Factura)
ObjFactura.Timbre.CFDIRelacionados.UUID.Clear()
If HdnTipoAmortizacion.Value = "2" Then
Dim Anticipos = ListaAnticiposAplicados.Where(Function(Obj) Obj.Tipo = "Ant")
If Anticipos IsNot Nothing AndAlso Anticipos.Count() > 0 Then
For Each Ant As Modelos.MAnticipoRelacionado In Anticipos
ObjFactura.Timbre.CFDIRelacionados.UUID.Add(Ant.FolioFiscal)
Next
ObjFactura.Timbre.CFDIRelacionados.TipoRelacion = "07"
ObjFactura.Timbre.CFDIRelacionados.TipoRelacionTexto = "07-CFDI por aplicación de anticipo"
'AJUSTAR NC
If ObjNC IsNot Nothing Then
ObjNC.Timbre.CFDIRelacionados.UUID.Clear()
ObjNC.Timbre.CFDIRelacionados.TipoRelacion = "07"
ObjNC.Timbre.CFDIRelacionados.TipoRelacionTexto = "07-CFDI por aplicación de anticipo"
End If
End If
End If
'DEVOLUCIONES DE OTRA VENTA, APLICADAS EN UNA NUEVA
If HdnTipoAmortizacion.Value = "4" Then
Dim DevolucionesNC = ListaAnticiposAplicados.Where(Function(Obj) Obj.Tipo = "NC")
If DevolucionesNC IsNot Nothing AndAlso DevolucionesNC.Count() > 0 Then
For Each Ant As Modelos.MAnticipoRelacionado In DevolucionesNC
ObjFactura.Timbre.CFDIRelacionados.UUID.Add(Ant.FolioFiscal)
Next
'TEMPORAL- DEBE SER TIPO RELACION "01 - Nota de crédito de los documentos relacionados"
Dim CveTipoRelacion As Integer = 1
ObjFactura.CveTipoRelacion = CveTipoRelacion
Dim RowTipoRelacion As DataRow = GlobalDTVtaTiposRelacion().FiltroPrimero($"CveTipoRelacion = {CveTipoRelacion}")
ObjFactura.Timbre.CFDIRelacionados.TipoRelacion = RowTipoRelacion("SATClaveTipoRelacion").ToString()
ObjFactura.Timbre.CFDIRelacionados.TipoRelacionTexto = RowTipoRelacion("SATTipoRelacion").ToString()
End If
End If
End Sub
Private Function TimbrarFactura(ByRef ObjFactura As Modelos.Factura, ByRef ObjNC As Modelos.Factura, ByRef SeTimbro As Boolean, ByRef SeTimbroNC As Boolean) As String
Private Function TimbrarFactura(ByRef ObjFactura As Modelos.Factura, ByRef SeTimbro As Boolean) As Timbrado
Dim MsgErrorTimbrado As String = ""
'Dim SeTimbro As Boolean = False
'Dim TimbroNC As Boolean = False
Dim ObjTimbrado As New Timbrado
Try
SeTimbro = ObjTimbrado.TimbrarFactura(UsuarioActual, ObjFactura)
Dim FolioFiscalFactura As String = ObjTimbrado.UUID
MsgErrorTimbrado = ObjTimbrado.MensajeErrorCFDI
ObjTimbrado = Nothing
If SeTimbro AndAlso ObjNC IsNot Nothing Then
If ObjNC.Timbre IsNot Nothing Then
ObjNC.Timbre.CFDIRelacionados.UUID.Clear()
ObjNC.Timbre.CFDIRelacionados.UUID.Add(FolioFiscalFactura)
Dim ObjTimbradoNC As New Timbrado
SeTimbroNC = ObjTimbradoNC.TimbrarFactura(UsuarioActual, ObjNC)
If Not SeTimbroNC Then
MsgErrorTimbrado = $"{MsgErrorTimbrado} {ObjTimbradoNC.MensajeErrorCFDI}"
End If
ObjTimbradoNC = Nothing
End If
End If
Catch ex As Exception
OnError("Ocurrió un error al generar el timbrado", ex)
End Try
@@ -1547,7 +1576,7 @@ Partial Class Ventas_PVCobranza
GuardaLogAD(MsgErrorTimbrado, Archivo:="LogTimbrado")
End If
Return MsgErrorTimbrado
Return ObjTimbrado
End Function
Private Function RegistraIE(Metodo As Integer, CveBancoCuenta As Integer, ImporteAbonoVenta As Decimal, ImporteBancos As Decimal, Fecha As Date, CvePrePoliza As Integer, VentaActual As Venta, ByRef ObjIE As ClsBancos, ByRef ObjConta As ClsContabilidad, ByRef ObjVentas As ClsVentas, tCveCorte As Integer, Optional Obs As String = "", Optional CveAutorizacion As String = "", Optional CveSubProyecto As Integer = -1) As String
@@ -2070,18 +2099,18 @@ Partial Class Ventas_PVCobranza
Dim CveVenta As Integer = HdnCveVenta.Value.ToEntero()
If UsuarioActual.Empresa.Funcionalidad(382) = "1" Then
If DdlTipoAmortizacionAnticipo.Items.FindByValue("4") Is Nothing Then
DdlTipoAmortizacionAnticipo.Items.Insert(1, New ListItem("Pago con devolución", "4"))
End If
DdlTipoAmortizacionAnticipo.SelectedValueExist("4")
'If UsuarioActual.Empresa.Funcionalidad(382) = "1" Then
' If DdlTipoAmortizacionAnticipo.Items.FindByValue("4") Is Nothing Then
' DdlTipoAmortizacionAnticipo.Items.Insert(1, New ListItem("Pago con devolución", "4"))
' End If
' DdlTipoAmortizacionAnticipo.SelectedValueExist("4")
DdlTipoRelacionAnticipo.SelectedValueExist("-1")
' DdlTipoRelacionAnticipo.SelectedValueExist("-1")
divAmortizacionTipoRelacion.Visible = False
' divAmortizacionTipoRelacion.Visible = False
DdlTipoAmortizacionAnticipo_SelectedIndexChanged(DdlTipoAmortizacionAnticipo, EventArgs.Empty)
End If
' DdlTipoAmortizacionAnticipo_SelectedIndexChanged(DdlTipoAmortizacionAnticipo, EventArgs.Empty)
'End If
Dim DbRowVenta As DataRow = Nothing
Dim ObjVentas As New ClsVentas
@@ -2106,84 +2135,35 @@ Partial Class Ventas_PVCobranza
Private Sub CargaAnticipos(CveCliente As Integer)
If CveCliente > 0 Then
'QUE NO SE PUEDA REALIZAR AMORTIZACIÓN DE ANTICIPO POR DESCUENTO
If UsuarioActual.Empresa.Funcionalidad(382) = "1" Then
If DdlTipoAmortizacionAnticipo.Items.FindByValue("1") IsNot Nothing Then
DdlTipoAmortizacionAnticipo.Items.Remove(DdlTipoAmortizacionAnticipo.Items.FindByValue("1"))
End If
End If
Dim ObjMovtos As New ClsMovimientos()
If ObjMovtos.GetAnticiposNCIxCCliente(CveCliente) Then
Me.TmpDTAnticiposNCIxCCliente = ObjMovtos.DtResultados.Copy()
End If
''AGREGAR LOS ANTICIPOS, DEV, IxC QUE ESTEN EN PUBLICO GENERAL
'If Me.TmpDTAnticiposNCIxCCliente IsNot Nothing AndAlso UsuarioActual.CveEmpresa.Contiene(189, 190, 192, 195, 197) Then
' Dim CveClientePublicoGeneral = UsuarioActual.Empresa.Funcionalidad(714).ToEntero()
' If CveClientePublicoGeneral > 0 Then
' If CveCliente <> CveClientePublicoGeneral Then
' If ObjMovtos.GetAnticiposNCIxCCliente(CveClientePublicoGeneral) Then
' For Each DrGeneral As DataRow In ObjMovtos.DtResultados.Rows
' Me.TmpDTAnticiposNCIxCCliente.Rows.Add(DrGeneral.ItemArray)
' Next
' End If
' End If
' End If
'End If
ObjMovtos.Dispose()
If Me.TmpDTAnticiposNCIxCCliente IsNot Nothing Then
Dim DtMovtos As DataTable = Me.TmpDTAnticiposNCIxCCliente.FiltraParametros($"Saldo > 0 AND Tipo IN('NC','IxC','Ant') ")
If DdlTipoAmortizacionAnticipo.SelectedValue = "4" Then
GVAnticipos.DataSource = DtMovtos.FiltraParametros("Tipo IN('NC','IxC')")
Else
GVAnticipos.DataSource = DtMovtos.FiltraParametros("Tipo IN('Ant')")
End If
GVAnticipos.DataSource = Me.TmpDTAnticiposNCIxCCliente.FiltraParametros($"ISTotal = 0 AND Saldo > 0 AND Tipo IN('NC','IxC','Ant') ")
Else
GVAnticipos.DataSource = Nothing
End If
divAmortizacionTipo.Visible = True
If UsuarioActual.Empresa.Funcionalidad(343) = "1" Then
DdlTipoAmortizacionAnticipo.Items.Remove(DdlTipoAmortizacionAnticipo.Items.FindByValue("1"))
End If
GVAnticipos.Columns(4).Visible = False
GVAnticipos.Columns(8).Visible = False
GVAnticipos.Columns(5).Visible = False
GVAnticipos.Columns(9).Visible = False
If UsuarioActual.Empresa.Funcionalidad(109) = "1" Then
GVAnticipos.Columns(6).Visible = True
GVAnticipos.Columns(7).Visible = True
End If
GVAnticipos.DataBind()
If ListaAnticiposAplicados IsNot Nothing Then
ListaAnticiposAplicados.Clear()
End If
TxtNCDev.Text = "0.00"
End If
UpAnticipos.Update()
End Sub
Protected Sub TxtFechaAnticipoCliente_TextChanged(sender As Object, e As EventArgs)
Dim CveVenta As Integer = HdnCveVenta.Value.ToEntero()
If CveCliente <= 0 Then
Dim DbRowVenta As DataRow = Nothing
Dim ObjVentas As New ClsVentas
If ObjVentas.GetVenta(CveVenta, UsuarioActual.CveEmpresa) Then
DbRowVenta = ObjVentas.DtResultados.Copy().FiltroPrimero("")
End If
ObjVentas.Dispose()
If DbRowVenta IsNot Nothing Then
CveCliente = DbRowVenta("CveCliente").ToString().ToEntero()
End If
End If
If CveCliente > 0 Then
CargaAnticipos(CveCliente)
End If
End Sub
Protected Sub LnkRecargaAnticipos_Click(sender As Object, e As EventArgs)
Dim CveVenta As Integer = HdnCveVenta.Value.ToEntero()
@@ -2283,11 +2263,11 @@ Partial Class Ventas_PVCobranza
DirectCast(e.Row.FindControl("VCOAmortAnti"), AjaxControlToolkit.ValidatorCalloutExtender).TargetControlID = "CVAmortAnti" & e.Row.RowIndex
'SI NO TIENE PERMISO, NO PERMITIR APLICAR ANTICIPOS PUNTUALES
If GVAnticipos.DataSource IsNot Nothing Then
If CBool(e.Row.DBCampo("AnticipoPuntual")) AndAlso Not UsuarioActual.TienePermisoProceso(377) Then
e.Row.FCCheckBox("Chk").Enabled = False
End If
End If
'If GVAnticipos.DataSource IsNot Nothing Then
' If CBool(e.Row.DBCampo("AnticipoPuntual")) AndAlso Not UsuarioActual.TienePermisoProceso(377) Then
' e.Row.FCCheckBox("Chk").Enabled = False
' End If
'End If
End If
End Sub
@@ -2311,12 +2291,10 @@ Partial Class Ventas_PVCobranza
Dim tipoCambio As Decimal = 0
Dim total As Decimal = LtlSaldo.Text.ToDecimal() '- PagadoSinEfectivo
saldo = e.Row.DataKey("Saldo").ToString().ToDecimal
If DdlTipoAmortizacionAnticipo.SelectedValue.Contiene("4") Then
saldo = e.Row.DataKey("Saldo").ToString().ToDecimal
Else
If e.Row.DBCampo("Tipo").Contiene("Ant") Then
saldo = e.Row.DataKey("SaldoConImpuestos").ToString().ToDecimal
Else
saldo = e.Row.DataKey("Saldo").ToString().ToDecimal
End If
e.Row.FCLiteral("LtlAnticipos").Text = saldo.FormatoNumero
@@ -2356,8 +2334,14 @@ Partial Class Ventas_PVCobranza
e.Row.Cells(5).HorizontalAlign = HorizontalAlign.Right
End If
Dim AnticipoAutorizado = CBool(e.Row.DBCampo("AnticipoAutorizado"))
If Not EsProduccion AndAlso UsuarioActual.CveRol = 1 Then
AnticipoAutorizado = True
End If
If UsuarioActual.Empresa.Funcionalidad(185) = "1" Then
If e.Row.DBCampo("Tipo").ToString().Contiene("NC", "Ant", "IxC") AndAlso Not CBool(e.Row.DBCampo("AnticipoAutorizado")) Then
If e.Row.DBCampo("Tipo").ToString().Contiene("NC", "Ant", "IxC") AndAlso Not AnticipoAutorizado Then
e.Row.FCCheckBox("Chk" & e.Row.RowIndex).Enabled = False
e.Row.FCCheckBox("Chk" & e.Row.RowIndex).ToolTip = "Anticipo Bloqueado"
e.Row.FCLinkButton("LnkSolicitarActivarAnticipo").Visible = True
@@ -2373,10 +2357,10 @@ Partial Class Ventas_PVCobranza
Protected Sub BtnAceptarAnticipos_Click(sender As Object, e As System.EventArgs) Handles BtnAceptarAnticipos.Click
If DdlTipoAmortizacionAnticipo.SelectedValue.ToEntero() <= 0 Then
Alert("Debe seleccionar un tipo de amortización", TipoMensaje.MsgAdvertencia)
Exit Sub
End If
'If DdlTipoAmortizacionAnticipo.SelectedValue.ToEntero() <= 0 Then
' Alert("Debe seleccionar un tipo de amortización", TipoMensaje.MsgAdvertencia)
' Exit Sub
'End If
Dim Amortizacion As Decimal = 0
@@ -2392,78 +2376,25 @@ Partial Class Ventas_PVCobranza
If gvr.FCCheckBox("Chk" & gvr.RowIndex) IsNot Nothing AndAlso gvr.FCCheckBox("Chk" & gvr.RowIndex).Checked Then
If gvr.FCTextBox(String.Format("TxtAnticipo{0}", gvr.RowIndex)).Text.ToDecimal > 0 Then
Amortizacion += gvr.FCTextBox(String.Format("TxtAnticipo{0}", gvr.RowIndex)).Text.ToDecimal()
If DdlTipoAmortizacionAnticipo.SelectedValue = "2" Then
ListaAnticiposAplicados.Add(New Modelos.MAnticipoRelacionado() With {.CveVenta = gvr.DataKey("CveVenta").ToEntero(), .FolioFiscal = gvr.DataKey("FolioFiscal"), .Tipo = gvr.DataKey("Tipo")})
End If
If DdlTipoAmortizacionAnticipo.SelectedValue = "4" Then
ListaAnticiposAplicados.Add(New Modelos.MAnticipoRelacionado() With {.CveVenta = gvr.DataKey("CveVenta").ToEntero(), .FolioFiscal = gvr.DataKey("FolioFiscal"), .Tipo = gvr.DataKey("Tipo")})
End If
ListaAnticiposAplicados.Add(New Modelos.MAnticipoRelacionado() With {.CveVenta = gvr.DataKey("CveVenta").ToEntero(), .FolioFiscal = gvr.DataKey("FolioFiscal"), .Tipo = gvr.DataKey("Tipo")})
End If
End If
Next
If Amortizacion > 0 Then
TxtNCDev.Text = Amortizacion.ToString()
LtlTipoAnticipo.Text = DdlTipoAmortizacionAnticipo.SelectedItem.Text
HdnTipoAmortizacion.Value = DdlTipoAmortizacionAnticipo.SelectedValue
'LtlTipoAnticipo.Text = DdlTipoAmortizacionAnticipo.SelectedItem.Text
'HdnTipoAmortizacion.Value = DdlTipoAmortizacionAnticipo.SelectedValue
Else
TxtNCDev.Text = ""
LtlTipoAnticipo.Text = ""
HdnTipoAmortizacion.Value = ""
'HdnTipoAmortizacion.Value = ""
End If
RegistraScript("$('#DivAnticipos').modal('hide');CalculaTotalPagoContado()", "AE")
UpL.Update()
End Sub
Protected Sub DdlTipoAmortizacionAnticipo_SelectedIndexChanged(sender As Object, e As EventArgs)
divAmortizacionTipoRelacion.Visible = DdlTipoAmortizacionAnticipo.SelectedValue = "2"
If DdlTipoAmortizacionAnticipo.SelectedValue = "2" Then
CargaDdlNCPS()
DivConceptoNC.Visible = True
Else
DivConceptoNC.Visible = False
End If
Dim CveVenta As Integer = HdnCveVenta.Value.ToEntero
Dim DbRowVenta As DataRow = Nothing
Dim ObjVentas As New ClsVentas
If ObjVentas.GetVenta(CveVenta, UsuarioActual.CveEmpresa) Then
DbRowVenta = ObjVentas.DtResultados.Copy().FiltroPrimero("")
End If
ObjVentas.Dispose()
If DbRowVenta IsNot Nothing Then
CveCliente = DbRowVenta("CveCliente").ToString().ToEntero()
CveVendedor = DbRowVenta("CveVendedor").ToString().ToEntero()
End If
If CveCliente > 0 Then
CargaAnticipos(CveCliente)
End If
UpAnticipos.Update()
End Sub
Public Sub CargaDdlNCPS()
Dim CveSATNC As String = "84111506"
Dim dtt As New DataTable
dtt = GlobalDTPSSimplificado(UsuarioActual.CveEmpresa, CodigoSATPS:=CveSATNC, AplicaParaVenta:=1) ', SATClavePS:=CveSATNC
If dtt IsNot Nothing Then
DdlNCPSAnt.DataSource = dtt
DdlNCPSAnt.Items.Insert(0, New ListItem("Seleccione", "-1"))
DdlNCPSAnt.DataBind()
dtt.Dispose()
End If
End Sub
Protected Sub DdlOtroFormaPago_SelectedIndexChanged(sender As Object, e As EventArgs)
Dim DtCC As DataTable = GlobalDTBancosCuentas(UsuarioActual.CveUsuario, CveEmpresa:=UsuarioActual.CveEmpresa)
Dim CveMon As Integer = 1