Desglose de productos al seleccionar RNC de bonificacion
This commit is contained in:
@@ -5083,7 +5083,7 @@ Public Class ClsPaginas
|
|||||||
PaginaDict.Add("/Ventas/RepAuxiliarFacturas.aspx".ToUpper(), 567)
|
PaginaDict.Add("/Ventas/RepAuxiliarFacturas.aspx".ToUpper(), 567)
|
||||||
PaginaDict.Add("/Ventas/CatAutorizacionLimites.aspx".ToUpper(), 781)
|
PaginaDict.Add("/Ventas/CatAutorizacionLimites.aspx".ToUpper(), 781)
|
||||||
PaginaDict.Add("/Ventas/RepComisionesServec.aspx".ToUpper(), 782)
|
PaginaDict.Add("/Ventas/RepComisionesServec.aspx".ToUpper(), 782)
|
||||||
PaginaDict.Add("/Ventas/RepComisionesServecDetalle.aspx".ToUpper(), 783)
|
PaginaDict.Add("/Ventas/RepComisionesServecDetalle.aspx".ToUpper(), 782)
|
||||||
#End Region
|
#End Region
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -5170,7 +5170,7 @@ Public Class ClsVentas
|
|||||||
#End Region
|
#End Region
|
||||||
|
|
||||||
|
|
||||||
Public Function AddAutorizacionLimite(CveEmpresa As Integer, CveCliente As Integer, CveVendedor As Integer, Importe As Decimal, CveEstatus As Integer, CveUsuario As Integer, TipoAutorizacion As Integer, TipoDocumento As String) As Boolean
|
Public Function AddAutorizacionLimite(CveEmpresa As Integer, CveCliente As Integer, CveVendedor As Integer, Importe As Decimal, CveEstatus As Integer, CveUsuario As Integer, TipoAutorizacion As Integer, TipoDocumento As String, Optional DiasVencidos As Integer = 0) As Boolean
|
||||||
Dim Retorno As Boolean = False
|
Dim Retorno As Boolean = False
|
||||||
DataAdapter("PA_Vta_AutorizacionLimitesAdd")
|
DataAdapter("PA_Vta_AutorizacionLimitesAdd")
|
||||||
With SqlAdapter.SelectCommand.Parameters
|
With SqlAdapter.SelectCommand.Parameters
|
||||||
@@ -5182,6 +5182,7 @@ Public Class ClsVentas
|
|||||||
.Add("@CveUsuario", SqlDbType.Int).Value = CveUsuario
|
.Add("@CveUsuario", SqlDbType.Int).Value = CveUsuario
|
||||||
.Add("@TipoAutorizacion", SqlDbType.Int).Value = TipoAutorizacion
|
.Add("@TipoAutorizacion", SqlDbType.Int).Value = TipoAutorizacion
|
||||||
.Add("@TipoDocumento", SqlDbType.VarChar).Value = TipoDocumento
|
.Add("@TipoDocumento", SqlDbType.VarChar).Value = TipoDocumento
|
||||||
|
.Add("@DiasVencidos", SqlDbType.Int).Value = DiasVencidos
|
||||||
End With
|
End With
|
||||||
Try
|
Try
|
||||||
SqlAdapter.Fill(Data)
|
SqlAdapter.Fill(Data)
|
||||||
|
|||||||
@@ -6317,7 +6317,8 @@
|
|||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-md-2">Folio Fiscal</div>
|
<div class="col-md-2">Folio Fiscal</div>
|
||||||
<div class="col-md-10">
|
<div class="col-md-10">
|
||||||
<asp:TextBox ID="TxtModalFolioFiscal" runat="server" Width="100%"></asp:TextBox></div>
|
<asp:TextBox ID="TxtModalFolioFiscal" runat="server" Width="100%"></asp:TextBox>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</ContentTemplate>
|
</ContentTemplate>
|
||||||
</asp:UpdatePanel>
|
</asp:UpdatePanel>
|
||||||
@@ -7322,12 +7323,13 @@
|
|||||||
<a href="javascript:;" class="collapse"></a>
|
<a href="javascript:;" class="collapse"></a>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="portlet-body form-horizontal form-row-sepe formnombottom">
|
<div class="row">
|
||||||
<div class="row" style="margin-right: 10px;" align="right">
|
<div class="col-md-12">
|
||||||
<input type="text" id="TxtBusquedaNCBonificaciones" class="form-control input-sm" onkeyup="<%= String.Format("FiltrarTabla('TxtBusquedaNCBonificaciones','{0}')", GvDescNCBonificaciones.ClientID) %>" style="display: inline-block; margin-right: -20px; width: 150px;" />
|
<asp:CheckBox ID="ChkMostarProductosRNCDesBonificacion" runat="server" AutoPostBack="true" Text="Mostrar Productos" OnCheckedChanged="ChkMostarProductosRNCDesBonificacion_CheckedChanged" />
|
||||||
<a href="javascript:;" onclick="<%= String.Format("FiltrarTabla('TxtBusquedaNCBonificaciones','{0}')", GvDescNCBonificaciones.ClientID) %>" style="margin-top: -3px;" class="btn btn-circle btn-sm label-info"><i class="icon-magnifier"></i></a>
|
|
||||||
</div>
|
</div>
|
||||||
<div class="row">
|
</div>
|
||||||
|
<div class="portlet-body form-horizontal form-row-sepe formnombottom">
|
||||||
|
<div id="DivRNCBonDescTotal" runat="server" visible="false" class="row">
|
||||||
<div class="col-md-12" style="max-height: 440px; overflow: auto">
|
<div class="col-md-12" style="max-height: 440px; overflow: auto">
|
||||||
<asp:GridView ID="GvDescNCBonificaciones" runat="server" AutoGenerateColumns="False"
|
<asp:GridView ID="GvDescNCBonificaciones" runat="server" AutoGenerateColumns="False"
|
||||||
DataKeyNames="CveVenta,CveVentaRNCCargo" CssClass="table table-striped table-advance table-hover Widthall mysmallbtn" GridLines="None">
|
DataKeyNames="CveVenta,CveVentaRNCCargo" CssClass="table table-striped table-advance table-hover Widthall mysmallbtn" GridLines="None">
|
||||||
@@ -7359,19 +7361,37 @@
|
|||||||
</asp:GridView>
|
</asp:GridView>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<%-- <div class="row">
|
<div class="row" id="DivRNCBonDescDetalle" runat="server" visible="false">
|
||||||
<div class="col-md-12">
|
<div class="col-md-12" style="max-height: 440px; overflow: auto">
|
||||||
<table border="0" rules="none" class="well TextTab" style="float: right;" runat="server">
|
<asp:GridView ID="GvDescNCBonDetalle" runat="server" AutoGenerateColumns="False"
|
||||||
<tr align="right">
|
DataKeyNames="CveVenta,CveVentaDetalleRNC,CvePS,PU,PorcentajeIVA" CssClass="table table-striped table-advance table-hover Widthall mysmallbtn" GridLines="None">
|
||||||
<td style="border: 1px none white"><b>Saldo Maximo Utilizable.:</b></td>
|
<Columns>
|
||||||
<td>
|
<asp:TemplateField>
|
||||||
<asp:Label ID="LblSaldoMaximoBonificacion" ClientIDMode="Static" runat="server" Style="text-align: right;" Text="0.00"></asp:Label></td>
|
<ItemTemplate>
|
||||||
<td align="right">
|
<asp:CheckBox ID="ChkAplicar" runat="server" />
|
||||||
</td>
|
<asp:HiddenField ID="HdnPorcentajeIVA" ClientIDMode="Static" runat="server" Value='<%# Eval("PorcentajeIVA").ToString %>' />
|
||||||
</tr>
|
</ItemTemplate>
|
||||||
</table>
|
</asp:TemplateField>
|
||||||
|
<asp:TemplateField HeaderText="Cantidad">
|
||||||
|
<ItemTemplate>
|
||||||
|
<asp:TextBox ID="TxtCantidadRNC" runat="server" Text='<%#Eval("CantidadPendiente").ToString%>' MaxLength="12" Width="46px" Height="24px"></asp:TextBox>
|
||||||
|
<asp:RangeValidator ID="RVCantRNC" runat="server" Type="Double" MinimumValue="0" MaximumValue='<%#Eval("CantidadPendiente").ToString%>' ErrorMessage="Cantidad Excedida" ControlToValidate="TxtCantidadRNC" Display="None" ValidationGroup="VGAplicarRNC"></asp:RangeValidator>
|
||||||
|
<ajax:ValidatorCalloutExtender ID="VCECantidad3" runat="server" HighlightCssClass="vco" TargetControlID="RVCantRNC" Width="300px"></ajax:ValidatorCalloutExtender>
|
||||||
|
</ItemTemplate>
|
||||||
|
</asp:TemplateField>
|
||||||
|
<asp:BoundField HeaderText="Producto" DataField="CodigoPS" ItemStyle-HorizontalAlign="Left" />
|
||||||
|
<asp:HyperLinkField DataNavigateUrlFields="CveVenta" Target="_blank" DataNavigateUrlFormatString="/Ventas/Ventas.aspx?CveVenta={0}" DataTextField="Folio" HeaderText="Folio" ItemStyle-Width="150px" ItemStyle-HorizontalAlign="Left" />
|
||||||
|
<asp:BoundField HeaderText="Fecha" DataField="Fecha" DataFormatString="{0:d}" ItemStyle-HorizontalAlign="Center" />
|
||||||
|
<asp:TemplateField HeaderText="Total" ItemStyle-HorizontalAlign="Right">
|
||||||
|
<ItemTemplate>
|
||||||
|
<asp:HiddenField ID="HdnPU" ClientIDMode="Static" runat="server" Value='<%# Eval("PU").ToString %>' />
|
||||||
|
<asp:Literal ID="TtlTotal" runat="server" Text='<%# Eval("Total", "{0:N2}") %>'></asp:Literal>
|
||||||
|
</ItemTemplate>
|
||||||
|
</asp:TemplateField>
|
||||||
|
</Columns>
|
||||||
|
</asp:GridView>
|
||||||
</div>
|
</div>
|
||||||
</div>--%>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -7748,6 +7768,74 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
function CalculaSaldoRNCChkDetalleBonificacion(TxtCantidad, CantidadPendiente, ImporteTotal, Chk) {
|
||||||
|
//ImportesRNCCargo
|
||||||
|
let Importe = 0;
|
||||||
|
if (Chk.checked) {
|
||||||
|
let SaldoMaximoUtilizable = 999999999;
|
||||||
|
let ImportesAsignados = 0;
|
||||||
|
|
||||||
|
$('.ImportesRNCDetalleBonificacion').each(function () {
|
||||||
|
|
||||||
|
if (Chk.id != $(this).find("td").eq(0).find(":checkbox").attr('id')) {
|
||||||
|
let seleccionado = $(this).find("td").eq(0).find(":checkbox").is(':checked');
|
||||||
|
|
||||||
|
if (seleccionado) {
|
||||||
|
let cantidad = ToDouble($(this).find("td").eq(1).find(":text").val());
|
||||||
|
let porcentajeIVA = ToDouble($(this).find("td").eq(0).find(":hidden").val());
|
||||||
|
let precio = ToDouble($(this).find("td").eq(5).find(":hidden").val());
|
||||||
|
|
||||||
|
let totalcalculableImpuestos = (cantidad * precio);
|
||||||
|
let iva = ToDouble((totalcalculableImpuestos * porcentajeIVA).toFixed(2));
|
||||||
|
|
||||||
|
ImportesAsignados += totalcalculableImpuestos + iva;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
|
Importe = SaldoMaximoUtilizable - ImportesAsignados;
|
||||||
|
|
||||||
|
if (Importe > 0) {
|
||||||
|
|
||||||
|
} else {
|
||||||
|
if (SaldoMaximoUtilizable > 0) {
|
||||||
|
Importe = 0;
|
||||||
|
Chk.checked = false;
|
||||||
|
} else {
|
||||||
|
Importe = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
} else {
|
||||||
|
Importe = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
Importe = ToDouble(Importe.toFixed(2));
|
||||||
|
|
||||||
|
if (Importe > 0) {
|
||||||
|
|
||||||
|
let pu = (ImporteTotal / CantidadPendiente);
|
||||||
|
|
||||||
|
if (pu > 0) {
|
||||||
|
const cantidadSugerida = (Importe / pu);
|
||||||
|
if (cantidadSugerida > CantidadPendiente) {
|
||||||
|
TxtCantidad.value = CantidadPendiente.toString();
|
||||||
|
}else {
|
||||||
|
TxtCantidad.value = cantidadSugerida.toString();
|
||||||
|
}
|
||||||
|
|
||||||
|
}else {
|
||||||
|
TxtCantidad.value = "0";
|
||||||
|
}
|
||||||
|
|
||||||
|
}else {
|
||||||
|
TxtCantidad.value = "0";
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function LimitaSaldoRNCChk(TxtImporte, Saldo) {
|
function LimitaSaldoRNCChk(TxtImporte, Saldo) {
|
||||||
|
|||||||
@@ -160,6 +160,25 @@ Partial Class Ventas
|
|||||||
ViewState("TmpDTRNCDetalleSelecciondas") = value
|
ViewState("TmpDTRNCDetalleSelecciondas") = value
|
||||||
End Set
|
End Set
|
||||||
End Property
|
End Property
|
||||||
|
|
||||||
|
Private Property TmpDTRNCBonificacionDetalle As DataTable
|
||||||
|
Get
|
||||||
|
Return If(IsNothing(ViewState("TmpDTRNCBonificacionDetalle")), Nothing, CType(ViewState("TmpDTRNCBonificacionDetalle"), DataTable))
|
||||||
|
End Get
|
||||||
|
Set(value As DataTable)
|
||||||
|
ViewState("TmpDTRNCBonificacionDetalle") = value
|
||||||
|
End Set
|
||||||
|
End Property
|
||||||
|
|
||||||
|
Private Property TmpDTRNCBonificacionDetalleSeleccionadas As DataTable
|
||||||
|
Get
|
||||||
|
Return If(IsNothing(ViewState("TmpDTRNCBonificacionDetalleSeleccionadas")), Nothing, CType(ViewState("TmpDTRNCBonificacionDetalleSeleccionadas"), DataTable))
|
||||||
|
End Get
|
||||||
|
Set(value As DataTable)
|
||||||
|
ViewState("TmpDTRNCBonificacionDetalleSeleccionadas") = value
|
||||||
|
End Set
|
||||||
|
End Property
|
||||||
|
|
||||||
Private Property TmpDTError As DataTable
|
Private Property TmpDTError As DataTable
|
||||||
Get
|
Get
|
||||||
Return If(IsNothing(ViewState("TmpDTError")), Nothing, CType(ViewState("TmpDTError"), DataTable))
|
Return If(IsNothing(ViewState("TmpDTError")), Nothing, CType(ViewState("TmpDTError"), DataTable))
|
||||||
@@ -1932,6 +1951,14 @@ Partial Class Ventas
|
|||||||
ViewState("AplicaRNCXDetalle") = value
|
ViewState("AplicaRNCXDetalle") = value
|
||||||
End Set
|
End Set
|
||||||
End Property
|
End Property
|
||||||
|
Private Property AplicaRNCBonificacionXDetalle As Boolean
|
||||||
|
Get
|
||||||
|
Return CBool(IfNull(ViewState("AplicaRNCBonificacionXDetalle"), "False", ViewState("AplicaRNCBonificacionXDetalle")))
|
||||||
|
End Get
|
||||||
|
Set(value As Boolean)
|
||||||
|
ViewState("AplicaRNCBonificacionXDetalle") = value
|
||||||
|
End Set
|
||||||
|
End Property
|
||||||
Private Property AplicaRelacionManual As Boolean
|
Private Property AplicaRelacionManual As Boolean
|
||||||
Get
|
Get
|
||||||
Return CBool(IfNull(ViewState("AplicaRelacionManual"), "False", ViewState("AplicaRelacionManual")))
|
Return CBool(IfNull(ViewState("AplicaRelacionManual"), "False", ViewState("AplicaRelacionManual")))
|
||||||
@@ -25054,7 +25081,16 @@ Partial Class Ventas
|
|||||||
Case "2" 'BONIFICACIONES
|
Case "2" 'BONIFICACIONES
|
||||||
DivRNCCargoDesc.Visible = False
|
DivRNCCargoDesc.Visible = False
|
||||||
DivRNCBonDesc.Visible = True
|
DivRNCBonDesc.Visible = True
|
||||||
CargaRNCDesc(True, False)
|
If ChkMostarProductosRNCDesBonificacion.Checked Then
|
||||||
|
DivRNCBonDescTotal.Visible = False
|
||||||
|
DivRNCBonDescDetalle.Visible = True
|
||||||
|
CargaRNCDetalleDescBonificacion()
|
||||||
|
Else
|
||||||
|
DivRNCBonDescTotal.Visible = True
|
||||||
|
DivRNCBonDescDetalle.Visible = False
|
||||||
|
CargaRNCDesc(True, False)
|
||||||
|
End If
|
||||||
|
|
||||||
Case "3" 'AJUSTE/GARANTIAS
|
Case "3" 'AJUSTE/GARANTIAS
|
||||||
LtlCargoDesc.Text = "AJUSTES/GARANTIAS"
|
LtlCargoDesc.Text = "AJUSTES/GARANTIAS"
|
||||||
DivRNCCargoDesc.Visible = True
|
DivRNCCargoDesc.Visible = True
|
||||||
@@ -25091,6 +25127,13 @@ Partial Class Ventas
|
|||||||
|
|
||||||
UpModalRemisionesNC.Update()
|
UpModalRemisionesNC.Update()
|
||||||
End Sub
|
End Sub
|
||||||
|
|
||||||
|
Protected Sub ChkMostarProductosRNCDesBonificacion_CheckedChanged(sender As Object, e As EventArgs)
|
||||||
|
|
||||||
|
RblRNCTipoDesc_SelectedIndexChanged(RblRNCTipo, EventArgs.Empty)
|
||||||
|
|
||||||
|
UpModalRemisionesNC.Update()
|
||||||
|
End Sub
|
||||||
Private Sub CargaRNC(Optional CveVentaUsado As Integer = -1, Optional CargarBonificaciones As Boolean = False, Optional CargarSoloGarantias As Boolean = False)
|
Private Sub CargaRNC(Optional CveVentaUsado As Integer = -1, Optional CargarBonificaciones As Boolean = False, Optional CargarSoloGarantias As Boolean = False)
|
||||||
Dim DtNC As DataTable = Nothing
|
Dim DtNC As DataTable = Nothing
|
||||||
|
|
||||||
@@ -25291,6 +25334,37 @@ Partial Class Ventas
|
|||||||
UpDescNC.Update()
|
UpDescNC.Update()
|
||||||
End Sub
|
End Sub
|
||||||
|
|
||||||
|
Private Sub CargaRNCDetalleDescBonificacion()
|
||||||
|
Dim DtNC As DataTable = Nothing
|
||||||
|
|
||||||
|
Dim ObjMovtos As New ClsMovimientos()
|
||||||
|
If ObjMovtos.GetRemisionesNCCliente(CveCliente, True, CveMoneda:=-1, CveClienteSucursal:=DdlSucursalCliente.SelectedValue.ToEntero()) Then
|
||||||
|
Me.TmpDTRNCBonificacionDetalle = ObjMovtos.DtResultados.Copy()
|
||||||
|
End If
|
||||||
|
ObjMovtos.Dispose()
|
||||||
|
|
||||||
|
Me.TmpDTRNCBonificacionDetalle.Columns.Add(New DataColumn("CveVentaDetalleNCGenerada", GetType(Integer)))
|
||||||
|
|
||||||
|
Me.TmpDTRNCBonificacionDetalleSeleccionadas = Nothing
|
||||||
|
Me.TmpDTRNCBonificacionDetalleSeleccionadas = TmpDTRNCBonificacionDetalle.Clone()
|
||||||
|
Me.TmpDTRNCBonificacionDetalleSeleccionadas.Clear()
|
||||||
|
|
||||||
|
GvDescNCBonDetalle.DataSource = TmpDTRNCBonificacionDetalle.FiltraParametros("TipoRNC = 2")
|
||||||
|
GvDescNCBonDetalle.DataBind()
|
||||||
|
|
||||||
|
'Dim SaldoMaximoUsados As Decimal = Me.TmpDT.SUM("Total", "EsCargo = True").ToDecimal() + Me.TmpDT.SUM("ImporteIVA", "EsCargo = True").ToDecimal()
|
||||||
|
|
||||||
|
'If SaldoMaximoUsados > 0 Then
|
||||||
|
' HdnSaldoMaximoUsados.Value = SaldoMaximoUsados.ToString()
|
||||||
|
' LblSaldoMaximoUsados.Text = String.Format("{0:N2}", SaldoMaximoUsados)
|
||||||
|
'Else
|
||||||
|
' HdnSaldoMaximoUsados.Value = "0"
|
||||||
|
' LblSaldoMaximoUsados.Text = "0"
|
||||||
|
'End If
|
||||||
|
|
||||||
|
UpDescNC.Update()
|
||||||
|
End Sub
|
||||||
|
|
||||||
Private Sub CargaBonificaciones(CveVentaRNCCargo As Integer, AplicarRNC As Boolean)
|
Private Sub CargaBonificaciones(CveVentaRNCCargo As Integer, AplicarRNC As Boolean)
|
||||||
If TmpDTRNCBonificacionesSeleccionadas Is Nothing Then
|
If TmpDTRNCBonificacionesSeleccionadas Is Nothing Then
|
||||||
TmpDTRNCBonificacionesSeleccionadas = Me.TmpDTRNCBonificacionesCliente.Clone()
|
TmpDTRNCBonificacionesSeleccionadas = Me.TmpDTRNCBonificacionesCliente.Clone()
|
||||||
@@ -25409,110 +25483,99 @@ Partial Class Ventas
|
|||||||
|
|
||||||
|
|
||||||
Private Sub CargaBonificacionesDesc(CvesVentaRNCCargo As String, AplicarRNC As Boolean)
|
Private Sub CargaBonificacionesDesc(CvesVentaRNCCargo As String, AplicarRNC As Boolean)
|
||||||
If TmpDTRNCBonificacionesSeleccionadas Is Nothing Then
|
|
||||||
TmpDTRNCBonificacionesSeleccionadas = Me.TmpDTRNCBonificacionesCliente.Clone()
|
If ChkMostarProductosRNCDesBonificacion.Checked Then
|
||||||
|
DivRNCBonDescTotal.Visible = False
|
||||||
|
DivRNCBonDescDetalle.Visible = True
|
||||||
|
CargaRNCDetalleDescBonificacion()
|
||||||
Else
|
Else
|
||||||
TmpDTRNCBonificacionesSeleccionadas.Clear()
|
DivRNCBonDescTotal.Visible = True
|
||||||
End If
|
DivRNCBonDescDetalle.Visible = False
|
||||||
|
|
||||||
Dim ListaVentasRNCCargos As String() = {}
|
If TmpDTRNCBonificacionesSeleccionadas Is Nothing Then
|
||||||
|
TmpDTRNCBonificacionesSeleccionadas = Me.TmpDTRNCBonificacionesCliente.Clone()
|
||||||
|
Else
|
||||||
|
TmpDTRNCBonificacionesSeleccionadas.Clear()
|
||||||
|
End If
|
||||||
|
|
||||||
If CvesVentaRNCCargo <> "-1" OrElse Not String.IsNullOrEmpty(CvesVentaRNCCargo) Then
|
Dim ListaVentasRNCCargos As String() = {}
|
||||||
ListaVentasRNCCargos = CvesVentaRNCCargo.Split(","c)
|
|
||||||
End If
|
|
||||||
|
|
||||||
Dim ListaBon As New List(Of VentasBonificaciones)
|
If CvesVentaRNCCargo <> "-1" OrElse Not String.IsNullOrEmpty(CvesVentaRNCCargo) Then
|
||||||
Dim DtBon As DataTable = Nothing
|
ListaVentasRNCCargos = CvesVentaRNCCargo.Split(","c)
|
||||||
Dim SbFiltro As New StringBuilder()
|
End If
|
||||||
SbFiltro.Append("CveVenta IN(")
|
|
||||||
|
|
||||||
Using ObjAcum As New ClsAcumuladores
|
Dim ListaBon As New List(Of VentasBonificaciones)
|
||||||
For Each CveVentaRNC As String In ListaVentasRNCCargos
|
Dim DtBon As DataTable = Nothing
|
||||||
If ObjAcum.DistribuidorMovtosGet(CveCliente, UsuarioActual.CveEmpresa, CveVentaRNCCargo:=CveVentaRNC.ToEntero()) Then
|
Dim SbFiltro As New StringBuilder()
|
||||||
Dim DtDist = ObjAcum.DtResultados.Copy()
|
SbFiltro.Append("CveVenta IN(")
|
||||||
|
|
||||||
If DtBon Is Nothing Then
|
Using ObjAcum As New ClsAcumuladores
|
||||||
DtBon = DtDist.Clone()
|
For Each CveVentaRNC As String In ListaVentasRNCCargos
|
||||||
|
If ObjAcum.DistribuidorMovtosGet(CveCliente, UsuarioActual.CveEmpresa, CveVentaRNCCargo:=CveVentaRNC.ToEntero()) Then
|
||||||
|
Dim DtDist = ObjAcum.DtResultados.Copy()
|
||||||
|
|
||||||
|
If DtBon Is Nothing Then
|
||||||
|
DtBon = DtDist.Clone()
|
||||||
|
End If
|
||||||
|
|
||||||
|
DtBon.Merge(DtDist)
|
||||||
End If
|
End If
|
||||||
|
Next
|
||||||
|
End Using
|
||||||
|
|
||||||
DtBon.Merge(DtDist)
|
If DtBon IsNot Nothing Then
|
||||||
End If
|
Dim queryBonificacion = From dr In DtBon
|
||||||
Next
|
Group By CveVentaBonificacion = dr("CveVentaBonificacion").ToString().ToEntero, CveVentaRNCCargo = dr("CveVentaRNCCargo").ToString().ToEntero
|
||||||
End Using
|
Into x = Group
|
||||||
|
Select New With {
|
||||||
|
.CveVentaRNCCargo = CveVentaRNCCargo,
|
||||||
|
.CveVentaBonificacion = CveVentaBonificacion,
|
||||||
|
.ImporteBonificacion = x.Sum(Function(s) s("ImporteBonificacion").ToString().ToDecimal),
|
||||||
|
.IVABonificacion = x.Sum(Function(s) s("IVABonificacion").ToString().ToDecimal)
|
||||||
|
}
|
||||||
|
|
||||||
If DtBon IsNot Nothing Then
|
For Each bon In queryBonificacion
|
||||||
Dim queryBonificacion = From dr In DtBon
|
SbFiltro.AppendFormat("'{0}',", bon.CveVentaBonificacion)
|
||||||
Group By CveVentaBonificacion = dr("CveVentaBonificacion").ToString().ToEntero, CveVentaRNCCargo = dr("CveVentaRNCCargo").ToString().ToEntero
|
ListaBon.Add(New VentasBonificaciones() With {.CveVentaRNCCargo = bon.CveVentaRNCCargo, .CveVentaBonificacion = bon.CveVentaBonificacion, .ImporteBonificacion = bon.ImporteBonificacion, .IVABonificacion = bon.IVABonificacion})
|
||||||
Into x = Group
|
Next
|
||||||
Select New With {
|
|
||||||
.CveVentaRNCCargo = CveVentaRNCCargo,
|
|
||||||
.CveVentaBonificacion = CveVentaBonificacion,
|
|
||||||
.ImporteBonificacion = x.Sum(Function(s) s("ImporteBonificacion").ToString().ToDecimal),
|
|
||||||
.IVABonificacion = x.Sum(Function(s) s("IVABonificacion").ToString().ToDecimal)
|
|
||||||
}
|
|
||||||
|
|
||||||
For Each bon In queryBonificacion
|
SbFiltro.Remove(SbFiltro.Length - 1, 1)
|
||||||
SbFiltro.AppendFormat("'{0}',", bon.CveVentaBonificacion)
|
SbFiltro.Append(")")
|
||||||
ListaBon.Add(New VentasBonificaciones() With {.CveVentaRNCCargo = bon.CveVentaRNCCargo, .CveVentaBonificacion = bon.CveVentaBonificacion, .ImporteBonificacion = bon.ImporteBonificacion, .IVABonificacion = bon.IVABonificacion})
|
End If
|
||||||
Next
|
|
||||||
|
|
||||||
SbFiltro.Remove(SbFiltro.Length - 1, 1)
|
If ListaBon.Count > 0 Then
|
||||||
SbFiltro.Append(")")
|
Dim Bonificaciones = Me.TmpDTRNCBonificacionesCliente.Select(SbFiltro.ToString())
|
||||||
End If
|
|
||||||
|
|
||||||
If ListaBon.Count > 0 Then
|
For Each RowBonificacion As DataRow In Bonificaciones
|
||||||
Dim Bonificaciones = Me.TmpDTRNCBonificacionesCliente.Select(SbFiltro.ToString())
|
Dim RNCBonificacion = ListaBon.Where(Function(x) x.CveVentaBonificacion = RowBonificacion("CveVenta").ToString().ToEntero())
|
||||||
|
|
||||||
For Each RowBonificacion As DataRow In Bonificaciones
|
RowBonificacion("ImporteBonificacion") = RNCBonificacion.Sum(Function(x) x.ImporteBonificacion)
|
||||||
Dim RNCBonificacion = ListaBon.Where(Function(x) x.CveVentaBonificacion = RowBonificacion("CveVenta").ToString().ToEntero())
|
RowBonificacion("IVABonificacion") = RNCBonificacion.Sum(Function(x) x.IVABonificacion)
|
||||||
|
RowBonificacion("CveVentaRNCCargo") = RNCBonificacion(0).CveVentaRNCCargo
|
||||||
|
|
||||||
RowBonificacion("ImporteBonificacion") = RNCBonificacion.Sum(Function(x) x.ImporteBonificacion)
|
If AplicarRNC Then
|
||||||
RowBonificacion("IVABonificacion") = RNCBonificacion.Sum(Function(x) x.IVABonificacion)
|
TmpDTRNCBonificacionesSeleccionadas.Rows.Add(RowBonificacion.ItemArray)
|
||||||
RowBonificacion("CveVentaRNCCargo") = RNCBonificacion(0).CveVentaRNCCargo
|
Else
|
||||||
|
For Each RowEliminar In Me.TmpDTRNCBonificacionesSeleccionadas.Select(SbFiltro.ToString())
|
||||||
|
RowEliminar.Delete()
|
||||||
|
Next
|
||||||
|
End If
|
||||||
|
Next
|
||||||
|
|
||||||
If AplicarRNC Then
|
End If
|
||||||
TmpDTRNCBonificacionesSeleccionadas.Rows.Add(RowBonificacion.ItemArray)
|
|
||||||
Else
|
'VERIFICA SI TIENE BONIFICACIONES PARA AGREGARLAS
|
||||||
For Each RowEliminar In Me.TmpDTRNCBonificacionesSeleccionadas.Select(SbFiltro.ToString())
|
If TmpDTRNCBonificacionesSeleccionadas IsNot Nothing AndAlso TmpDTRNCBonificacionesSeleccionadas.Rows.Count > 0 Then
|
||||||
RowEliminar.Delete()
|
DivRNCBonDesc.Visible = True
|
||||||
Next
|
Else
|
||||||
End If
|
DivRNCBonDesc.Visible = False
|
||||||
Next
|
End If
|
||||||
|
|
||||||
|
GvDescNCBonificaciones.DataSource = TmpDTRNCBonificacionesSeleccionadas
|
||||||
|
GvDescNCBonificaciones.DataBind()
|
||||||
|
|
||||||
End If
|
End If
|
||||||
|
|
||||||
'VERIFICA SI TIENE BONIFICACIONES PARA AGREGARLAS
|
|
||||||
If TmpDTRNCBonificacionesSeleccionadas IsNot Nothing AndAlso TmpDTRNCBonificacionesSeleccionadas.Rows.Count > 0 Then
|
|
||||||
DivRNCBonDesc.Visible = True
|
|
||||||
Else
|
|
||||||
DivRNCBonDesc.Visible = False
|
|
||||||
End If
|
|
||||||
|
|
||||||
GvDescNCBonificaciones.DataSource = TmpDTRNCBonificacionesSeleccionadas
|
|
||||||
GvDescNCBonificaciones.DataBind()
|
|
||||||
|
|
||||||
'SI ES CREDITO
|
|
||||||
'If RBLPago.SelectedValue = "1" Then
|
|
||||||
' Dim ImporteUsados As Decimal = Me.TmpDTRNCBonificacionesSeleccionadas.SUM("ImporteBonificacion").ToDecimal() + Me.TmpDTRNCBonificacionesSeleccionadas.SUM("IVABonificacion").ToDecimal()
|
|
||||||
' HdnSMUBonDesc.Value = ImporteUsados.ToString()
|
|
||||||
' LblSaldoMaximoBonificacion.Text = String.Format("{0:N2}", ImporteUsados)
|
|
||||||
' 'SI ES CONTADO
|
|
||||||
'ElseIf RBLPago.SelectedValue = "2" Then
|
|
||||||
' Dim ImporteUsados As Decimal = 0
|
|
||||||
|
|
||||||
' For Each Row As DataRow In Me.TmpDT.FiltraParametros("EsCargo = True").Rows
|
|
||||||
' Dim PUBonificacion As Decimal = GlobalDTAcumTamaños().FiltroPrimeroValor("Bonificacion", $"CvePSCargo={Row("CvePS")}").ToDecimal()
|
|
||||||
|
|
||||||
' Dim TotalBonificacion As Decimal = (Row("Cantidad").ToString().ToDecimal() * PUBonificacion)
|
|
||||||
' Dim IVABonificacion As Decimal = (TotalBonificacion * Row("PorcentajeIVA").ToString().ToDecimal()).RoundSQL(2)
|
|
||||||
|
|
||||||
' ImporteUsados += TotalBonificacion + IVABonificacion
|
|
||||||
' Next
|
|
||||||
' HdnSMUBonDesc.Value = ImporteUsados.ToString()
|
|
||||||
' LblSaldoMaximoBonificacion.Text = String.Format("{0:N2}", ImporteUsados)
|
|
||||||
|
|
||||||
'End If
|
|
||||||
|
|
||||||
UpDescNC.Update()
|
UpDescNC.Update()
|
||||||
End Sub
|
End Sub
|
||||||
|
|
||||||
@@ -25538,6 +25601,22 @@ Partial Class Ventas
|
|||||||
End If
|
End If
|
||||||
End If
|
End If
|
||||||
End Sub
|
End Sub
|
||||||
|
|
||||||
|
Protected Sub GvDescNCBonDetalle_RowDataBound(sender As Object, e As GridViewRowEventArgs) Handles GvDescNCBonDetalle.RowDataBound
|
||||||
|
If e.Row.RowType = DataControlRowType.DataRow Then
|
||||||
|
|
||||||
|
If e.Row.DBCampo("CveVentaDetalleRNC").ToEntero() = 0 Then
|
||||||
|
e.Row.CssClass = "Totales"
|
||||||
|
e.Row.FCCheckBox("ChkAplicar").Visible = False
|
||||||
|
e.Row.FCTextBox("TxtCantidadRNC").Visible = False
|
||||||
|
Else
|
||||||
|
e.Row.CssClass = "ImportesRNCDetalle"
|
||||||
|
e.Row.FCCheckBox("ChkAplicar").Attributes.Add("onclick", $"CalculaSaldoRNCChkDetalleBonificacion({e.Row.FCTextBox("TxtCantidadRNC").ClientID},{e.Row.DBCampo("CantidadPendiente").ToDouble},{e.Row.DBCampo("Total").ToDouble}, this);")
|
||||||
|
'e.Row.FCTextBox("TxtImporte").Attributes.Add("onkeyup", $"LimitaSaldoRNCChk({e.Row.FCTextBox("TxtImporte").ClientID},{e.Row.DBCampo("Saldo").ToDouble});")
|
||||||
|
|
||||||
|
End If
|
||||||
|
End If
|
||||||
|
End Sub
|
||||||
Protected Sub GvRNCDevoluciones_RowDataBound(sender As Object, e As GridViewRowEventArgs) Handles GvRNCDevoluciones.RowDataBound
|
Protected Sub GvRNCDevoluciones_RowDataBound(sender As Object, e As GridViewRowEventArgs) Handles GvRNCDevoluciones.RowDataBound
|
||||||
If e.Row.RowType = DataControlRowType.DataRow Then
|
If e.Row.RowType = DataControlRowType.DataRow Then
|
||||||
e.Row.FCCheckBox("ChkAplicar").Attributes.Add("onclick", $"CalculaSaldoRNCBonChkDesc({e.Row.FCTextBox("TxtImporte").ClientID},{e.Row.DBCampo("Saldo").ToDouble}, this);")
|
e.Row.FCCheckBox("ChkAplicar").Attributes.Add("onclick", $"CalculaSaldoRNCBonChkDesc({e.Row.FCTextBox("TxtImporte").ClientID},{e.Row.DBCampo("Saldo").ToDouble}, this);")
|
||||||
@@ -25866,13 +25945,21 @@ Partial Class Ventas
|
|||||||
NCBonificacion = ArrayNC(4).ToEntero()
|
NCBonificacion = ArrayNC(4).ToEntero()
|
||||||
End If
|
End If
|
||||||
|
|
||||||
|
Dim DrBonRef As DataRow = Nothing
|
||||||
|
|
||||||
'EN LA NC DE BONIFICACION EL CONCEPTO DEBE SER SIEMPRE 'BONIFICACION POR USADO'
|
'EN LA NC DE BONIFICACION EL CONCEPTO DEBE SER SIEMPRE 'BONIFICACION POR USADO'
|
||||||
Dim DrPSBonificacion = GlobalDTPS(UsuarioActual.CveEmpresa, CvePS:=NCBonificacion).FiltroPrimero("")
|
Dim DrPSBonificacion = GlobalDTPS(UsuarioActual.CveEmpresa, CvePS:=NCBonificacion).FiltroPrimero("")
|
||||||
If DrPSBonificacion IsNot Nothing Then
|
If DrPSBonificacion IsNot Nothing Then
|
||||||
CrearDTNCBonificacionDesc(DtImpuestosBonificacion, TmpDTDescNC, DrPSBonificacion, CveProyecto, Proyecto, CveSubProyecto, SubProyecto)
|
DrBonRef = DrPSBonificacion
|
||||||
Else
|
Else
|
||||||
|
DrBonRef = DrPS
|
||||||
Alert("No se encontró el concepto de BONIFICACION POR USADO", TipoMensaje.MsgAdvertencia)
|
Alert("No se encontró el concepto de BONIFICACION POR USADO", TipoMensaje.MsgAdvertencia)
|
||||||
CrearDTNCBonificacionDesc(DtImpuestosBonificacion, TmpDTDescNC, DrPS, CveProyecto, Proyecto, CveSubProyecto, SubProyecto)
|
End If
|
||||||
|
|
||||||
|
If AplicaRNCBonificacionXDetalle Then
|
||||||
|
CrearDTNCBonificacionDescDetalle(ListaNCBonificacion, TmpDTDescNC, DrBonRef, CveProyecto, Proyecto, CveSubProyecto, SubProyecto)
|
||||||
|
Else
|
||||||
|
CrearDTNCBonificacionDesc(DtImpuestosBonificacion, TmpDTDescNC, DrBonRef, CveProyecto, Proyecto, CveSubProyecto, SubProyecto)
|
||||||
End If
|
End If
|
||||||
|
|
||||||
Else
|
Else
|
||||||
@@ -26331,6 +26418,93 @@ Partial Class Ventas
|
|||||||
Next
|
Next
|
||||||
End If
|
End If
|
||||||
End Sub
|
End Sub
|
||||||
|
Private Sub CrearDTNCBonificacionDescDetalle(ListaNC As List(Of Modelos.Factura), ByRef TmpDTCargo As DataTable, DrPS As DataRow, CveProyecto As Integer, Proyecto As String, CveSubProyecto As Integer, SubProyecto As String)
|
||||||
|
|
||||||
|
TmpDTDescNCBonificacion = TmpDTCargo.Clone()
|
||||||
|
TmpDTDescNCBonificacion.Clear()
|
||||||
|
|
||||||
|
For Each RNC In ListaNC
|
||||||
|
Dim UltimoRenglonRNC As Integer = 1
|
||||||
|
Dim TotalAcumuladoRNC As Decimal = 0
|
||||||
|
Dim Terminar As Boolean = False
|
||||||
|
|
||||||
|
For Each RowUsado As DataRow In Me.TmpDTRNCBonificacionDetalleSeleccionadas.FiltraParametros($"CveVenta={RNC.CveVenta}", Orderby:="PU").Rows
|
||||||
|
|
||||||
|
Dim Cantidad As Decimal = RowUsado("Cantidad").ToString().ToDecimal()
|
||||||
|
|
||||||
|
Dim CvePSCargo As Integer = RowUsado("CvePS").ToString().ToEntero()
|
||||||
|
Dim Obs = ""
|
||||||
|
'SI ES ACUMULADOR LAS OBSERVACIOENS DEBEN SER EL NOMBRE DEL ACUMULADOR
|
||||||
|
If GlobalDTAcumTamaños().FiltroPrimero($"CvePSCargo = {CvePSCargo}") IsNot Nothing Then
|
||||||
|
Obs = RowUsado("CodigoPS").ToString()
|
||||||
|
'Else
|
||||||
|
' Obs = RowUsado("Obs").ToString()
|
||||||
|
End If
|
||||||
|
|
||||||
|
If Not String.IsNullOrEmpty(TxtNCObservaciones.Text.Trim()) Then
|
||||||
|
Obs = String.Format("{0} - {1}", Obs, TxtNCObservaciones.Text.Trim())
|
||||||
|
End If
|
||||||
|
|
||||||
|
Dim ImportePU = RowUsado("PU").ToString().ToDecimal
|
||||||
|
|
||||||
|
Dim TotalCalculableImpuestos As Decimal = (Cantidad * ImportePU)
|
||||||
|
|
||||||
|
Dim ImporteIVA = (TotalCalculableImpuestos * RowUsado("PorcentajeIVA").ToString().ToDecimal).RoundSQL(2)
|
||||||
|
Dim ImporteIEPS = 0 '(TotalCalculableImpuestos * RowUsado("PorcentajeIEPS").ToString().ToDecimal).RoundSQL(2)
|
||||||
|
Dim ImporteRetIVA = 0 ' (TotalCalculableImpuestos * RowUsado("PorcentajeRetIVA").ToString().ToDecimal).RoundSQL(2)
|
||||||
|
Dim ImporteRetISR = 0 ' (TotalCalculableImpuestos * RowUsado("PorcentajeRetISR").ToString().ToDecimal).RoundSQL(2)
|
||||||
|
Dim ImporteTotal = TotalCalculableImpuestos
|
||||||
|
|
||||||
|
TotalAcumuladoRNC += (TotalCalculableImpuestos + ImporteIVA)
|
||||||
|
|
||||||
|
|
||||||
|
'SI EL IMPORTE ES MAYOR REALIZA EL AJUSTE
|
||||||
|
If TotalAcumuladoRNC > RNC.TotalRemNCAplicado Then
|
||||||
|
Terminar = True
|
||||||
|
'RESTA LO SUMANDO DEL ACUMULADO
|
||||||
|
TotalAcumuladoRNC -= (TotalCalculableImpuestos + ImporteIVA + ImporteIEPS - ImporteRetIVA - ImporteRetISR)
|
||||||
|
|
||||||
|
Dim Diferencia As Decimal = RNC.TotalRemNCAplicado - TotalAcumuladoRNC
|
||||||
|
|
||||||
|
Dim TotalPartida As Decimal = (TotalCalculableImpuestos + ImporteIVA + ImporteIEPS - ImporteRetIVA - ImporteRetISR)
|
||||||
|
|
||||||
|
Dim PorcentajePorAplicar As Decimal = (Diferencia / TotalPartida)
|
||||||
|
|
||||||
|
Cantidad = Cantidad * PorcentajePorAplicar
|
||||||
|
|
||||||
|
TotalCalculableImpuestos = (Cantidad * ImportePU)
|
||||||
|
ImporteIVA = (TotalCalculableImpuestos * RowUsado("PorcentajeIVA").ToString().ToDecimal).RoundSQL(2)
|
||||||
|
|
||||||
|
|
||||||
|
ImporteTotal = TotalCalculableImpuestos
|
||||||
|
|
||||||
|
TotalAcumuladoRNC += (TotalCalculableImpuestos + ImporteIVA + ImporteIEPS - ImporteRetIVA - ImporteRetISR)
|
||||||
|
End If
|
||||||
|
|
||||||
|
'SI ES EL ULTIMO REGLON REALIZA UN AJUSTE
|
||||||
|
If UltimoRenglonRNC = Me.TmpDTRNCBonificacionDetalleSeleccionadas.FiltraParametros($"CveVenta={RNC.CveVenta}").Rows.Count OrElse Terminar Then
|
||||||
|
Dim Ajuste As Decimal = 0
|
||||||
|
If Math.Abs(RNC.TotalRemNCAplicado - TotalAcumuladoRNC) > 0.00 Then
|
||||||
|
Ajuste = RNC.TotalRemNCAplicado - TotalAcumuladoRNC
|
||||||
|
|
||||||
|
ImporteIVA += Ajuste
|
||||||
|
End If
|
||||||
|
End If
|
||||||
|
UltimoRenglonRNC += 1
|
||||||
|
|
||||||
|
AgregaTempDT(TmpDTDescNCBonificacion, DrPS("CvePS").ToString().ToEntero(), DrPS("PS").ToString(), DrPS("Codigo").ToString(), DrPS("PSCodigo").ToString(), DrPS("CveTipoPS").ToString().ToEntero(), DrPS("Inv_CveMetodoInventario").ToString().ToEntero(),
|
||||||
|
DrPS("CveUM").ToString().ToEntero(), DrPS("UnidadMedida").ToString(), DrPS("CveClasificacion").ToString().ToEntero(), DrPS("Clasificacion").ToString(), CveProyecto, Proyecto, CveSubProyecto, SubProyecto,
|
||||||
|
Obs, Cantidad, ImportePU, RowUsado("PorcentajeIVA").ToString().ToDecimal, ImporteIVA, 0, ImporteRetIVA,
|
||||||
|
0, ImporteRetISR, 0, ImporteIEPS, -1, 0, ImporteTotal, "", "", -1, -1,
|
||||||
|
DrPS("SATClavePS").ToString(), DrPS("SATClaveUnidadMedida").ToString(), -1, -1, -1, -1, -1, -1, CveVentaDetalleRNC:=RowUsado("CveVentaDetalleRNC").ToString().ToEntero())
|
||||||
|
|
||||||
|
If Terminar Then
|
||||||
|
Exit For
|
||||||
|
End If
|
||||||
|
Next
|
||||||
|
|
||||||
|
Next
|
||||||
|
End Sub
|
||||||
|
|
||||||
Private Sub CrearDTNCDevolucion(ListaNC As List(Of Modelos.Factura), ByRef TmpDTCargo As DataTable, CveProyecto As Integer, Proyecto As String, CveSubProyecto As Integer, SubProyecto As String)
|
Private Sub CrearDTNCDevolucion(ListaNC As List(Of Modelos.Factura), ByRef TmpDTCargo As DataTable, CveProyecto As Integer, Proyecto As String, CveSubProyecto As Integer, SubProyecto As String)
|
||||||
For Each RNC In ListaNC
|
For Each RNC In ListaNC
|
||||||
@@ -29829,6 +30003,7 @@ Partial Class Ventas
|
|||||||
#Region "D E S C U E N T O S X R E M I S I O N D E N O T A D E C R E D I T O"
|
#Region "D E S C U E N T O S X R E M I S I O N D E N O T A D E C R E D I T O"
|
||||||
Protected Sub BtnAplicarRemisionNC_Click(sender As Object, e As EventArgs)
|
Protected Sub BtnAplicarRemisionNC_Click(sender As Object, e As EventArgs)
|
||||||
Me.AplicaRNCXDetalle = False
|
Me.AplicaRNCXDetalle = False
|
||||||
|
Me.AplicaRNCBonificacionXDetalle = False
|
||||||
|
|
||||||
If ListaRemisionesNC Is Nothing Then
|
If ListaRemisionesNC Is Nothing Then
|
||||||
ListaRemisionesNC = New List(Of Modelos.Factura)
|
ListaRemisionesNC = New List(Of Modelos.Factura)
|
||||||
@@ -30027,6 +30202,7 @@ Partial Class Ventas
|
|||||||
Protected Sub BtnAplicarDesc_Click(sender As Object, e As EventArgs)
|
Protected Sub BtnAplicarDesc_Click(sender As Object, e As EventArgs)
|
||||||
Try
|
Try
|
||||||
Me.AplicaRNCXDetalle = False
|
Me.AplicaRNCXDetalle = False
|
||||||
|
Me.AplicaRNCBonificacionXDetalle = False
|
||||||
|
|
||||||
Dim DrPS As DataRow = Nothing
|
Dim DrPS As DataRow = Nothing
|
||||||
Dim ArrayNC As String() = UsuarioActual.Empresa.Funcionalidad(591).Split(",".ToCharArray())
|
Dim ArrayNC As String() = UsuarioActual.Empresa.Funcionalidad(591).Split(",".ToCharArray())
|
||||||
@@ -30215,34 +30391,98 @@ Partial Class Ventas
|
|||||||
Exit Sub
|
Exit Sub
|
||||||
End If
|
End If
|
||||||
|
|
||||||
For Each GvRow As GridViewRow In GvDescNCBonificaciones.Rows
|
'BONIFICACIONES
|
||||||
If GvRow.RowType = DataControlRowType.DataRow Then
|
If ChkMostarProductosRNCDesBonificacion.Checked Then
|
||||||
If GvRow.FCCheckBox("ChkAplicar").Checked Then
|
|
||||||
Dim RemNC As New Modelos.Factura(UsuarioActual, GvRow.DataKey("CveVenta").ToEntero(), UsuarioActual.CveEmpresa)
|
|
||||||
RemNC.TotalRemNCAplicado = GvRow.FCTextBox("TxtImporte").Text.ToDecimal()
|
|
||||||
RemNC.CveVentaRNCCargo = GvRow.DataKey("CveVentaRNCCargo").ToEntero()
|
|
||||||
TotalRemNCAplicado += RemNC.TotalRemNCAplicado
|
|
||||||
|
|
||||||
If RemNC.TotalRemNCAplicado <= 0 Then
|
TmpDTRNCBonificacionDetalleSeleccionadas.Clear()
|
||||||
Alert($"Debe asignar un importe en la siguiente remisión: <b>{RemNC.SerieFolio}</b>", TipoMensaje.MsgAdvertencia)
|
Me.AplicaRNCBonificacionXDetalle = True
|
||||||
ListaNCBonificacion.Clear()
|
|
||||||
Exit Sub
|
For Each GvRow As GridViewRow In GvDescNCBonDetalle.Rows
|
||||||
|
If GvRow.RowType = DataControlRowType.DataRow Then
|
||||||
|
If GvRow.FCCheckBox("ChkAplicar").Checked Then
|
||||||
|
Dim Rows = TmpDTRNCBonificacionDetalle.Select($"CveVentaDetalleRNC = {GvRow.DataKey("CveVentaDetalleRNC").ToEntero()}")
|
||||||
|
For Each row In Rows
|
||||||
|
row("Cantidad") = GvRow.FCTextBox("TxtCantidadRNC").Text.ToDecimal()
|
||||||
|
|
||||||
|
Dim TotalCalculableImpuestos As Decimal = row("Cantidad").ToString().ToDecimal() * row("PU").ToString().ToDecimal()
|
||||||
|
Dim IVA As Decimal = (TotalCalculableImpuestos * row("PorcentajeIVA").ToString().ToDecimal()).RoundSQL()
|
||||||
|
|
||||||
|
row("IVA") = IVA
|
||||||
|
row("Total") = (TotalCalculableImpuestos + IVA).RoundSQL
|
||||||
|
|
||||||
|
TmpDTRNCBonificacionDetalleSeleccionadas.Rows.Add(row.ItemArray)
|
||||||
|
Next
|
||||||
End If
|
End If
|
||||||
|
|
||||||
ListaNCBonificacion.Add(RemNC)
|
|
||||||
End If
|
End If
|
||||||
End If
|
Next
|
||||||
Next
|
|
||||||
|
|
||||||
'Dim LimiteBonficaciones As Decimal = LblSaldoMaximoBonificacion.Text.Trim().ToDecimal()
|
Dim TerminarCiclo As Boolean = False
|
||||||
|
|
||||||
''VERIFICA EL LIMITE DE LOS USADOS
|
For Each Dr As DataRow In TmpDTRNCBonificacionDetalleSeleccionadas.FiltraParametros("", DistinctColumns:={"CveVenta"}).Rows
|
||||||
'If ListaNCBonificacion.Sum(Function(x) x.TotalRemNCAplicado) > LimiteBonficaciones Then
|
Dim RemNC As New Modelos.Factura(UsuarioActual, Dr("CveVenta").ToString().ToEntero(), UsuarioActual.CveEmpresa)
|
||||||
' Alert($"La suma de las remisiones de nota de crédito de tipo 'Bonificación' no debe superar el limite.<br/>Total RNC: {ListaNCBonificacion.Sum(Function(x) x.TotalRemNCAplicado):N2}.<br/>Total Usados: {LimiteUsados:N2}", TipoMensaje.MsgAdvertencia)
|
|
||||||
' ListaNCDesc.Clear()
|
Dim TotalRNC As Decimal = 0
|
||||||
' ListaNCBonificacion.Clear()
|
For Each GvRow As GridViewRow In GvDescNCBonDetalle.Rows
|
||||||
' Exit Sub
|
If GvRow.RowType = DataControlRowType.DataRow Then
|
||||||
'End If
|
|
||||||
|
If GvRow.FCCheckBox("ChkAplicar").Checked AndAlso GvRow.DataKey("CveVenta").ToEntero() = Dr("CveVenta").ToString().ToEntero() Then
|
||||||
|
|
||||||
|
Dim Cantidad As Decimal = GvRow.FCTextBox("TxtCantidadRNC").Text.ToDecimal()
|
||||||
|
Dim PU = GvRow.DataKey("PU").ToDecimal()
|
||||||
|
Dim PorcentajeIVA As Decimal = GvRow.DataKey("PorcentajeIVA").ToDecimal()
|
||||||
|
|
||||||
|
Dim TotalCalculableImpuestos As Decimal = (Cantidad * PU)
|
||||||
|
Dim ImporteIVA As Decimal = (TotalCalculableImpuestos * PorcentajeIVA).RoundSQL(2)
|
||||||
|
|
||||||
|
Dim TotalRNCDetalle As Decimal = (TotalCalculableImpuestos + ImporteIVA)
|
||||||
|
|
||||||
|
TotalRNC += TotalRNCDetalle
|
||||||
|
|
||||||
|
If RemNC.CveVentaRNCCargo <= 0 Then
|
||||||
|
RemNC.CveVentaRNCCargo = GvRow.DataKey("CveVenta").ToEntero()
|
||||||
|
End If
|
||||||
|
|
||||||
|
End If
|
||||||
|
|
||||||
|
End If
|
||||||
|
Next
|
||||||
|
|
||||||
|
RemNC.TotalRemNCAplicado = TotalRNC
|
||||||
|
TotalRemNCAplicado += RemNC.TotalRemNCAplicado
|
||||||
|
|
||||||
|
If RemNC.TotalRemNCAplicado <= 0 Then
|
||||||
|
Alert($"Debe asignar un importe en la siguiente remisión: <b>{RemNC.SerieFolio}</b>", TipoMensaje.MsgAdvertencia)
|
||||||
|
ListaNCBonificacion.Clear()
|
||||||
|
Exit Sub
|
||||||
|
End If
|
||||||
|
|
||||||
|
ListaNCBonificacion.Add(RemNC)
|
||||||
|
|
||||||
|
If TerminarCiclo Then
|
||||||
|
Exit For
|
||||||
|
End If
|
||||||
|
Next
|
||||||
|
|
||||||
|
Else
|
||||||
|
For Each GvRow As GridViewRow In GvDescNCBonificaciones.Rows
|
||||||
|
If GvRow.RowType = DataControlRowType.DataRow Then
|
||||||
|
If GvRow.FCCheckBox("ChkAplicar").Checked Then
|
||||||
|
Dim RemNC As New Modelos.Factura(UsuarioActual, GvRow.DataKey("CveVenta").ToEntero(), UsuarioActual.CveEmpresa)
|
||||||
|
RemNC.TotalRemNCAplicado = GvRow.FCTextBox("TxtImporte").Text.ToDecimal()
|
||||||
|
RemNC.CveVentaRNCCargo = GvRow.DataKey("CveVentaRNCCargo").ToEntero()
|
||||||
|
TotalRemNCAplicado += RemNC.TotalRemNCAplicado
|
||||||
|
|
||||||
|
If RemNC.TotalRemNCAplicado <= 0 Then
|
||||||
|
Alert($"Debe asignar un importe en la siguiente remisión: <b>{RemNC.SerieFolio}</b>", TipoMensaje.MsgAdvertencia)
|
||||||
|
ListaNCBonificacion.Clear()
|
||||||
|
Exit Sub
|
||||||
|
End If
|
||||||
|
|
||||||
|
ListaNCBonificacion.Add(RemNC)
|
||||||
|
End If
|
||||||
|
End If
|
||||||
|
Next
|
||||||
|
End If
|
||||||
|
|
||||||
ElseIf RblRNCTipoDesc.SelectedValue.Contiene("2") Then
|
ElseIf RblRNCTipoDesc.SelectedValue.Contiene("2") Then
|
||||||
|
|
||||||
@@ -31112,6 +31352,9 @@ Partial Class Ventas
|
|||||||
DtVentasNC.Rows.Add(Drt)
|
DtVentasNC.Rows.Add(Drt)
|
||||||
DtVentasNC.AcceptChanges()
|
DtVentasNC.AcceptChanges()
|
||||||
|
|
||||||
|
ObjFacturaProntoPago.DtVentasRelacionadas = New DataTable
|
||||||
|
ObjFacturaProntoPago.DtVentasRelacionadas.Columns.Add("CveVenta", GetType(Integer))
|
||||||
|
|
||||||
ObjFacturaProntoPago.DtVentasNC = DtVentasNC
|
ObjFacturaProntoPago.DtVentasNC = DtVentasNC
|
||||||
|
|
||||||
Resp = ObjFacturaProntoPago.EmitirFactura(False, Transac:=SqlTransaccion, ObjContPaqTransac:=ObjConta)
|
Resp = ObjFacturaProntoPago.EmitirFactura(False, Transac:=SqlTransaccion, ObjContPaqTransac:=ObjConta)
|
||||||
|
|||||||
Reference in New Issue
Block a user