This commit is contained in:
2024-03-04 18:17:13 -07:00
12 changed files with 354 additions and 283 deletions

View File

@@ -7378,50 +7378,56 @@ Partial Class PV
Dim strDate As Date = ($"20{TxtEtiqueta.Text.Substring(2, 2)}/{TxtEtiqueta.Text.Substring(0, 2)}/01").ToDate
Dim drg As DataRow = dtt.FiltroPrimero($" #{strDate.ToString("yyyy/MM/dd")}# >= FechaInicioVigencia ", "FechaInicioVigencia DESC")
If drg IsNot Nothing Then
TxtPorcentajeAjuste.Text = (drg("Valor").ToString.ToDouble / 100).ToString
Dim PorcentajeAjuste As Decimal = drg("Valor").ToString.ToDecimal
TxtPorcentajeAjuste.Text = (PorcentajeAjuste / 100).ToString
TxtImporteAjuste.Text = (TxtPorcentajeAjuste.Text.ToDecimal * TxtPUFactura.Text.ToDecimal).FormatoNumero
ImportePagarCliente = TxtImporteAjuste.Text.ToDecimal
''ajustar un centavo
If PorcentajeAjuste = 0 Then 'PONE UN PAGO DE UN CENTAVO, PARA EL TIMBRADO
' TxtImporteAjuste.Text = (TxtImporteAjuste.Text.ToDecimal - 0.01D).FormatoNumero
TxtImporteAjuste.Text = "0.01"
End If
Dim CargoVendido As Decimal = 0
Dim CargoGarantia As Decimal = 0
Dim CargoGarantia As Decimal = 0
Dim CveTamaño As Integer = 0
If DdlPSAjuste.SelectedValue.ToEntero > 0 Then
Dim Dr As DataRow = GlobalDTPS(UsuarioActual.CveEmpresa, DdlPSAjuste.SelectedValue.ToEntero).FiltroPrimero("")
If Dr IsNot Nothing Then
CargoGarantia = Dr("Cargo").ToString.ToDecimal
Dim Dr As DataRow = GlobalDTPS(UsuarioActual.CveEmpresa, DdlPSAjuste.SelectedValue.ToEntero).FiltroPrimero("")
If Dr IsNot Nothing Then
CargoGarantia = Dr("Cargo").ToString.ToDecimal
End If
End If
End If
If DdlPS.SelectedValue.ToEntero > 0 Then
Dim Dr As DataRow = GlobalDTPSSimplificado(UsuarioActual.CveEmpresa, CvePS:=DdlPS.SelectedValue.ToEntero).FiltroPrimero("")
If Dr IsNot Nothing Then
CveTamaño = Dr("CveTamaño").ToString.ToEntero
If DdlPS.SelectedValue.ToEntero > 0 Then
Dim Dr As DataRow = GlobalDTPSSimplificado(UsuarioActual.CveEmpresa, CvePS:=DdlPS.SelectedValue.ToEntero).FiltroPrimero("")
If Dr IsNot Nothing Then
CveTamaño = Dr("CveTamaño").ToString.ToEntero
End If
End If
End If
Dim DrCargo As DataRow = GlobalDTAcumTamaños(UsuarioActual.CveEmpresa).FiltroPrimero($" CveTamaño = {CveTamaño}")
If DrCargo IsNot Nothing Then
Dim DrCargo As DataRow = GlobalDTAcumTamaños(UsuarioActual.CveEmpresa).FiltroPrimero($" CveTamaño = {CveTamaño}")
If DrCargo IsNot Nothing Then
CargoVendido = DrCargo("Cargo").ToString.ToDecimal
CargoVendido = DrCargo("Cargo").ToString.ToDecimal
End If
End If
'el ajuste no puede ser mayor al precio de lo vendido de nuevo
If (TxtPrecio.Text.ToDouble - ((TxtPUFactura.Text.ToDouble - TxtImporteAjuste.Text.ToDouble) - (CargoVendido - CargoGarantia))) < 0 Then
'el ajuste no puede ser mayor al precio de lo vendido de nuevo
If (TxtPrecio.Text.ToDouble - ((TxtPUFactura.Text.ToDouble - TxtImporteAjuste.Text.ToDouble) - (CargoVendido - CargoGarantia))) < 0 Then
TxtImporteAjuste.Text = "0.00"
CargoGarantia = CargoVendido
ImportePagarCliente = 0
End If
ImportePagarCliente = (TxtPrecio.Text.ToDouble - ((TxtPUFactura.Text.ToDouble - TxtImporteAjuste.Text.ToDouble) - (CargoVendido - CargoGarantia))).ToDecimal
TxtImporteAjuste.Text = "0.00"
CargoGarantia = CargoVendido
ImportePagarCliente = 0
End If
ImportePagarCliente = (TxtPrecio.Text.ToDouble - ((TxtPUFactura.Text.ToDouble - TxtImporteAjuste.Text.ToDouble) - (CargoVendido - CargoGarantia))).ToDecimal
TxtImporteAjuste.ToolTip = $"La diferencia de ajuste fue: {(TxtPrecio.Text.ToDouble - TxtImporteAjuste.Text.ToDouble).FormatoNumero()}. La diferencia de tamaños fue: {(CargoVendido - CargoGarantia).FormatoNumero}."
TxtImporteAjuste.Text = ((TxtPUFactura.Text.ToDouble - TxtImporteAjuste.Text.ToDouble) - (CargoVendido - CargoGarantia)).FormatoNumero
'TxtPagarCliente.Text = ImportePagarCliente.FormatoNumero
Else
Alert("El producto no tiene ajuste en ese periodo", TipoMensaje.MsgAdvertencia)
TxtImporteAjuste.ToolTip = $"La diferencia de ajuste fue: {(TxtPrecio.Text.ToDouble - TxtImporteAjuste.Text.ToDouble).FormatoNumero()}. La diferencia de tamaños fue: {(CargoVendido - CargoGarantia).FormatoNumero}."
TxtImporteAjuste.Text = ((TxtPUFactura.Text.ToDouble - TxtImporteAjuste.Text.ToDouble) - (CargoVendido - CargoGarantia)).FormatoNumero
'TxtPagarCliente.Text = ImportePagarCliente.FormatoNumero
Else
Alert("El producto no tiene ajuste en ese periodo", TipoMensaje.MsgAdvertencia)
'cuando no está registrada, no da ajuste
TxtImporteAjuste.ToolTip = "El producto no tiene ajuste en ese periodo"
TxtImporteAjuste.Text = "0.00"

View File

@@ -14982,6 +14982,7 @@ Partial Class Ventas
DT = TmpDTDetalle.FiltraParametros($"CvePS <> {CvePSAmortizacion}", "", {"CveClasificacion", "CveSubProyecto", "PorcentajeIVA", "CveActivoFijo"})
If DT.Rows.Count > 0 Then
'Se agrega movimiento separado por la cuenta de ventas (ER)
For Each Row2 As DataRow In DT.Rows
importeMovimiento = (TmpDTDetalle.SUM("TotalImporte", String.Format("CveClasificacion = {0} And CveSubProyecto = {1} AND PorcentajeIVA = {2} AND ISNULL(CveActivoFijo,-1) = {3}", Row2("CveClasificacion"), Row2("CveSubProyecto"), Row2("PorcentajeIVA"), If(Row2("CveActivoFijo").ToString().ToEntero() > 0, Row2("CveActivoFijo").ToString().ToEntero(), -1))).ToString().ToDecimal()) * ValorMultiplicador
@@ -18131,15 +18132,30 @@ Partial Class Ventas
End If
' NO VALIDA EXISTENCIAS NI COSTO - PERMISO PARA NO VALIDAR
If Not UsuarioActual.TienePermisoProceso(169) Then
If Not UsuarioActual.TienePermisoProceso(169) AndAlso RBLTipoVenta.SelectedValue.ToEntero <> 5 Then
'SOLO VALIDA EXISTENCIAS Y COSTO: SI USA INVENTARIOS, SOLO PRODUCTOS TIPO PRODUCTO, SOLO REMISIONES E INGRESOS
If UsuarioActual.Empresa.UsaInventarios AndAlso CveTipoPS = 2 AndAlso (DdlTipoComprobante.SelectedValue.Contiene("Rem", "Ing", "PA") OrElse ((DdlTipoComprobante.SelectedValue.Contiene("Cot") And UsuarioActual.CveEmpresa.Contiene(119)) OrElse (DdlTipoComprobante.SelectedValue.Contiene("Ped") And UsuarioActual.CveEmpresa.Contiene(186)))) Then
Dim ObjInventarios As New ClsInventarios
Dim BuscarEnTabla As Boolean = If(UsuarioActual.Empresa.Funcionalidad(715) = "1", True, False)
Dim Existencia As Decimal = ObjInventarios.GetExistenciasPS(CvePS, CveUM, UsuarioActual.CveEmpresa, -1, FechaMovto:=DateTime.Today.AddDays(1).ToString("yyyy/MM/dd HH:mm"), CveSubProyecto:=DdlSubProyectoDatos.SelectedValue.ToEntero(),
CveVendedor:=DdlVendedor.SelectedValue.ToEntero(), CveCliente:=If(UsuarioActual.Empresa.Funcionalidad(146) = "1", -1, CveCliente), ExcluyeAdelantado:=1, PendientePorSurtir:=1,
RestringirAlmacenes:=1, ExcluyeApartados:=-1, BuscarEnTabla:=BuscarEnTabla)
Dim Existencia As Decimal = 0D
''CveAlamcenFiltroDdl
If RBLTipoVenta.SelectedValue.ToEntero = 6 Then
Existencia = ObjInventarios.GetExistenciasPS(CvePS, CveUM, UsuarioActual.CveEmpresa, CveAlamcenFiltroDdl, FechaMovto:=DateTime.Today.AddDays(1).ToString("yyyy/MM/dd HH:mm"), CveSubProyecto:=-1,
CveVendedor:=DdlVendedor.SelectedValue.ToEntero(), CveCliente:=If(UsuarioActual.Empresa.Funcionalidad(146) = "1", -1, CveCliente), ExcluyeAdelantado:=0, PendientePorSurtir:=1,
RestringirAlmacenes:=1, ExcluyeApartados:=-1, BuscarEnTabla:=BuscarEnTabla)
Else
Existencia = ObjInventarios.GetExistenciasPS(CvePS, CveUM, UsuarioActual.CveEmpresa, -1, FechaMovto:=DateTime.Today.AddDays(1).ToString("yyyy/MM/dd HH:mm"), CveSubProyecto:=DdlSubProyectoDatos.SelectedValue.ToEntero(),
CveVendedor:=DdlVendedor.SelectedValue.ToEntero(), CveCliente:=If(UsuarioActual.Empresa.Funcionalidad(146) = "1", -1, CveCliente), ExcluyeAdelantado:=1, PendientePorSurtir:=1,
RestringirAlmacenes:=1, ExcluyeApartados:=-1, BuscarEnTabla:=BuscarEnTabla)
End If
Dim Costo As Decimal = ObjInventarios.GetCostoPS(CvePS, TxtCantidad.Text.Trim.ToDecimal, -1, "-1", TxtFecha.Text.ToDate, DdlSubProyectoDatos.SelectedValue.ToEntero(), CveTipoAlmacen:=1)
'si el costo es cero, puede ser que no halla movimientos del producto, en esa sucursal. y se volverá a sacar sin especificar sucursal
@@ -23323,7 +23339,12 @@ Partial Class Ventas
'VALIDA PAGOS EN FACTURAS DE ING,ANT NUEVAS O FACTURACION DE REM O COTIZACIONES
If UsuarioActual.Empresa.Funcionalidad(531) = "1" AndAlso RBLPago.SelectedValue = "2" AndAlso ((CveVenta <= 0 AndAlso DdlTipoComprobante.SelectedValue.Contiene("Ing", "Ant")) OrElse TipoDoctoViejo.Contiene("Rem", "Cot")) Then
Dim TotalPagadoGarantia As Decimal = 0
If TxtTotal.Text.ToDecimal = 0.01 AndAlso Me.EsGarantia = True Then
TotalPagadoGarantia = 0.01D
TienePagos = True
ViewState("SaldoVenta") = SaldoVenta - TotalPagadoGarantia
End If
If Not TienePagos AndAlso TxtTotal.Text.ToDecimal > 0 Then
If MostrarAlertas Then
Alert("Es necesario especificar un pago.", TipoMensaje.MsgAdvertencia)
@@ -23341,7 +23362,7 @@ Partial Class Ventas
Dim TotalRNC As Decimal = If((ListaNCDesc IsNot Nothing AndAlso ListaNCDesc.Count > 0) OrElse (ListaNCBonificacion IsNot Nothing AndAlso ListaNCBonificacion.Count > 0), LblDescuentosRNC.Text.Trim().ToDecimal(), 0)
Dim ImporteTotal As Decimal = (TxtTotal.Text.ToDecimal).RoundSQL(2)
Dim TotalPagado As Decimal = (TotalPagoContado + TotalRNC + TotalProntoPago).RoundSQL(2)
Dim TotalPagado As Decimal = (TotalPagoContado + TotalRNC + TotalProntoPago + TotalPagadoGarantia).RoundSQL(2)
If TotalPagado <> ImporteTotal Then
If MostrarAlertas Then
@@ -23363,10 +23384,7 @@ Partial Class Ventas
Return Retorno
End If
End If
End If
End If
'SI TIENE SALDO PENDIENTE VALIDA SI TIENE PAGOS