From 9bf9fbbd5a626eb210c18589017aba770da6e174 Mon Sep 17 00:00:00 2001 From: Jonathan Alexis Perez Morales Date: Fri, 16 Jun 2023 20:46:16 -0700 Subject: [PATCH 1/2] Correciones y redondeos para aplicacion de NC por anticipos con descuentos --- Ventas/Ventas.aspx.vb | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/Ventas/Ventas.aspx.vb b/Ventas/Ventas.aspx.vb index b3aca70b0..dfed40166 100644 --- a/Ventas/Ventas.aspx.vb +++ b/Ventas/Ventas.aspx.vb @@ -14287,6 +14287,7 @@ Partial Class Ventas If DdlTipoAmortizacionAnticipo.SelectedValue = "2" Then Dim DescuentosAnticipos As Decimal = row2.DataKey("Descuentos").ToDecimal ImporteAnticipo = row2.FCTextBox("TxtAnticipo" & row2.RowIndex).Text.ToDecimal / (row2.DataKey("TotalAnticipo").ToDecimal - DescuentosAnticipos) * row2.DataKey("SubTotalAnticipo").ToDecimal + ImporteAnticipo = ImporteAnticipo.RoundSQL(2) End If Dim Importe11MX As Decimal = ImporteAnticipo @@ -30167,6 +30168,11 @@ Partial Class Ventas Dim importePuTemp As Decimal = 0 importePuTemp = (Porcentaje * (TmpDT.SUMD("TotalImporte", FiltroStr) - TmpDT.SUMD("Descuento", FiltroStr))) + Dim DescuentoAplicado As Decimal = 0 + If AplicaDescuentos Then + DescuentoAplicado = Porcentaje * TmpDT.SUMD("Descuento", FiltroStr) + End If + If Not AplicaImpuestosLocales Then importePuTemp = importePuTemp - TotalImpuestosLocalesVentaOriginal End If @@ -30186,8 +30192,8 @@ Partial Class Ventas Dr("ImporteRetISR") = (importePuTemp * Dr("PorcentajeRetISR").ToString().ToDecimal()) If AplicaDescuentos Then - Dr("ImportePU") = importePuTemp + TmpDT.SUMD("Descuento", FiltroStr) - Dr("Descuento") = Porcentaje * TmpDT.SUMD("Descuento", FiltroStr) + Dr("ImportePU") = importePuTemp + DescuentoAplicado + Dr("Descuento") = DescuentoAplicado Dr("ImporteTotal") = Dr("ImportePU").ToString().ToDecimal().RoundSQL(2) Else Dr("ImportePU") = importePuTemp From ea5ea34ad06007e579b0199901e24ee9693a888a Mon Sep 17 00:00:00 2001 From: Oscar Irigoyen Date: Sat, 17 Jun 2023 12:27:10 -0700 Subject: [PATCH 2/2] RecepcionAlmacen.aspx.vb igualar a productivo --- Inventarios/RecepcionAlmacen.aspx.vb | 50 ++++++++++++++++------------ 1 file changed, 28 insertions(+), 22 deletions(-) diff --git a/Inventarios/RecepcionAlmacen.aspx.vb b/Inventarios/RecepcionAlmacen.aspx.vb index 3ce600fa2..cff3c95ad 100644 --- a/Inventarios/RecepcionAlmacen.aspx.vb +++ b/Inventarios/RecepcionAlmacen.aspx.vb @@ -3,6 +3,7 @@ Option Explicit On Imports System.Data Imports System.IO +Imports System.Text Imports Extensiones Imports GemBox.Spreadsheet Imports Microsoft.Reporting.WebForms @@ -2299,36 +2300,41 @@ Partial Class Inventarios_RecepcionAlmacen 'VERIFICA EXISTENCIAS If TipoMovimiento > 1 Then - Dim MensajeExistencias As New StringBuilder - Dim ObjInventarios As New ClsInventarios - For Each gvr As GridViewRow In GvInv.Rows - Dim ExistenciaActual = DtInv.SUM("CantidadSurtidaPantalla", $"CvePS = {gvr.DataKey("CvePS").ToEntero} AND CveUM = {gvr.DataKey("CveUM").ToEntero} ") + Dim CveTipoAlmacen As Integer = GlobalDTAlmacen(UsuarioActual.CveEmpresa, CveAlmacen:=DdlAlmacen.SelectedValue.ToEntero).FiltroPrimeroValor("CveTipoAlmacen", "").ToEntero + Dim ValidaExistencia As Boolean = True + If CveTipoAlmacen.Contiene(6, 21) AndAlso UsuarioActual.CveEmpresa = 140 Then ValidaExistencia = False ' si es garantia no valida existencia + If ValidaExistencia Then + Dim MensajeExistencias As New StringBuilder + Dim ObjInventarios As New ClsInventarios + For Each gvr As GridViewRow In GvInv.Rows + Dim ExistenciaActual = DtInv.SUM("CantidadSurtidaPantalla", $"CvePS = {gvr.DataKey("CvePS").ToEntero} AND CveUM = {gvr.DataKey("CveUM").ToEntero} ") - If TipoMovimiento = 2 Then - 'If gvr.DataKey("CantidadC").ToString.ToDecimal <> ExistenciaActual Then - ' Alert("La devolución debe de ser completa.", TipoMensaje.MsgAdvertencia) - ' Exit Sub - 'End If + If TipoMovimiento = 2 Then + 'If gvr.DataKey("CantidadC").ToString.ToDecimal <> ExistenciaActual Then + ' Alert("La devolución debe de ser completa.", TipoMensaje.MsgAdvertencia) + ' Exit Sub + 'End If - If DtExistencias.SUM("Existencia", $"CvePS = {gvr.DataKey("CvePS").ToEntero} AND CveUM = {gvr.DataKey("CveUM").ToEntero}") < ExistenciaActual Then + If DtExistencias.SUM("Existencia", $"CvePS = {gvr.DataKey("CvePS").ToEntero} AND CveUM = {gvr.DataKey("CveUM").ToEntero}") < ExistenciaActual Then + MensajeExistencias.Append($"Producto: {GlobalDTPS(UsuarioActual.CveEmpresa, CvePS:=gvr.DataKey("CvePS").ToString.ToEntero).FiltroPrimeroValor("PSCodigo")}.
") + Continue For + End If + End If + + Dim Existencia = ObjInventarios.GetExistenciasPS(gvr.DataKey("CvePS").ToEntero, gvr.DataKey("CveUM").ToEntero, UsuarioActual.CveEmpresa, DdlAlmacen.SelectedValue.ToEntero, FechaMovto:=(TxtFecha.Text & " " & Now.ToShortTimeString).ToDateTime.ToString("yyyy/MM/dd HH:mm")) + If Existencia < ExistenciaActual Then MensajeExistencias.Append($"Producto: {GlobalDTPS(UsuarioActual.CveEmpresa, CvePS:=gvr.DataKey("CvePS").ToString.ToEntero).FiltroPrimeroValor("PSCodigo")}.
") Continue For End If + Next + ObjInventarios.Dispose() + + If MensajeExistencias.ToString <> "" Then + Alert($"Los siguientes productos no cuentan con la existencia suficiente para hacer la devolución.

{MensajeExistencias.ToString}", TipoMensaje.MsgAdvertencia) + Return False End If - Dim Existencia = ObjInventarios.GetExistenciasPS(gvr.DataKey("CvePS").ToEntero, gvr.DataKey("CveUM").ToEntero, UsuarioActual.CveEmpresa, DdlAlmacen.SelectedValue.ToEntero, FechaMovto:= (TxtFecha.Text & " " & Now.ToShortTimeString).ToDateTime.ToString("yyyy/MM/dd HH:mm")) - If Existencia < ExistenciaActual Then - MensajeExistencias.Append($"Producto: {GlobalDTPS(UsuarioActual.CveEmpresa, CvePS:=gvr.DataKey("CvePS").ToString.ToEntero).FiltroPrimeroValor("PSCodigo")}.
") - Continue For - End If - Next - ObjInventarios.Dispose() - - If MensajeExistencias.ToString <> "" Then - Alert($"Los siguientes productos no cuentan con la existencia suficiente para hacer la devolución.

{MensajeExistencias.ToString}", TipoMensaje.MsgAdvertencia) - Return False End If - End If Return True