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

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