From 0ebb63f0ad73205961fab4a9da3ca8e9e9bc3836 Mon Sep 17 00:00:00 2001 From: rakcsle Date: Wed, 21 Aug 2024 00:24:48 -0700 Subject: [PATCH] SMS OS Remisiones en 0 --- App_Code/ClsInventarios.vb | 3 +- Inventarios/RepNotasSinAlmacen.aspx | 17 ++++-- Inventarios/RepNotasSinAlmacen.aspx.vb | 1 + OS/OrdenesServicios.aspx.vb | 74 ++++++++++++++++++++++++++ 4 files changed, 89 insertions(+), 6 deletions(-) diff --git a/App_Code/ClsInventarios.vb b/App_Code/ClsInventarios.vb index fd14b2e9a..0813ad5c8 100644 --- a/App_Code/ClsInventarios.vb +++ b/App_Code/ClsInventarios.vb @@ -6247,13 +6247,14 @@ Public Class ClsInventarios Return Retorno End Function - Public Function UpdatePedidoDetalleCantidad(CveVentaDetalle As Integer, Cantidad As Decimal) As Boolean + Public Function UpdatePedidoDetalleCantidad(CveVentaDetalle As Integer, Cantidad As Decimal, Optional Opcion As Integer = 1) As Boolean Dim Retorno As Boolean = False DataAdapter("PA_Vta_VentasDetalleCantidadUpdate") With SqlAdapter.SelectCommand.Parameters .Add("@CveVentaDetalle", SqlDbType.Int).Value = CveVentaDetalle .Add("@Cantidad", SqlDbType.Money).Value = Cantidad + .Add("@Opcion", SqlDbType.Int).Value = Opcion End With Try diff --git a/Inventarios/RepNotasSinAlmacen.aspx b/Inventarios/RepNotasSinAlmacen.aspx index e6270a0dd..bbe1ffb73 100644 --- a/Inventarios/RepNotasSinAlmacen.aspx +++ b/Inventarios/RepNotasSinAlmacen.aspx @@ -170,23 +170,30 @@ DataKeyNames="EsDevolucionVenta" data-sort="true" EmptyDataText="No se encontraron resultados." AutoGenerateColumns="False" > + <%--0--%> - - - <%-- --%> - + <%--1--%> + - + <%--2--%> + <%--3--%> + <%--4--%> + <%--5--%> + <%--6--%> + <%--7--%> + <%--8--%> + + <%--9--%> diff --git a/Inventarios/RepNotasSinAlmacen.aspx.vb b/Inventarios/RepNotasSinAlmacen.aspx.vb index bf204bdb0..e7d5a7c78 100644 --- a/Inventarios/RepNotasSinAlmacen.aspx.vb +++ b/Inventarios/RepNotasSinAlmacen.aspx.vb @@ -88,6 +88,7 @@ Partial Class RepNotasSinAlmacen GvVentas.Columns(6).Visible = True GvVentas.Columns(7).Visible = True GvVentas.Columns(8).Visible = True + GvVentas.Columns(9).Visible = True TxtFechaF.Text = NowADS.AddDays(3).ToShortDateString GvVentas.Columns(4).Visible = False diff --git a/OS/OrdenesServicios.aspx.vb b/OS/OrdenesServicios.aspx.vb index c19e0616e..b5ae93825 100644 --- a/OS/OrdenesServicios.aspx.vb +++ b/OS/OrdenesServicios.aspx.vb @@ -7,6 +7,11 @@ Imports System.Data Imports System.Data.SqlClient Imports System.Diagnostics Imports System.ServiceModel.Security +Imports RVCFDI.RVLTimbrado +Imports Microsoft.Owin.Security.Provider +Imports Telerik.Web.UI + + Partial Class OS_OrdenesServicios Inherits ClsPaginas @@ -3139,6 +3144,37 @@ Partial Class OS_OrdenesServicios ProcesoOK = False End If + + Dim DT_Ventas_Detalles As DataTable = DTSolicitudDev.FiltraParametros("", "", {"CantidadPedido", "CvePS", "CveVentaDetalle"}) + DT_Ventas_Detalles.Columns.Add("CantidadUsada", GetType(Decimal)) + DT_Ventas_Detalles.AcceptChanges() + + For Each dRow As DataRow In DT_Ventas_Detalles.Rows + + For Each gvRow As GridViewRow In GvMU.Rows + + Dim CantidadUsada As Decimal = gvRow.FCTextBox("TxtUtilizado").Text.ToDecimal + + If dRow("CvePS").ToString.ToDecimal = gvRow.DataKey("CvePS").ToDecimal AndAlso CantidadUsada > 0 Then + + dRow("CantidadUsada") = dRow("CantidadUsada").ToString.ToDecimal + CantidadUsada + + End If + Next + + Next + + For Each dRow As DataRow In DT_Ventas_Detalles.Rows + Dim CantidadUsada As Decimal = dRow("CantidadUsada").ToString.ToDecimal + If dRow("CantidadUsada").ToString.ToDecimal < dRow("CantidadPedido").ToString.ToDecimal Then + If Not ObjInventario.UpdatePedidoDetalleCantidad(dRow("CveVentaDetalle").ToString.ToEntero, CantidadUsada, 2) Then + ProcesoOK = False + Exit For + End If + End If + Next + + Else If ProcesoOK Then Dim AplicaDevolucion As Boolean = False @@ -3424,6 +3460,44 @@ Partial Class OS_OrdenesServicios Dim CveMoneda As Integer = -1 Dim tCveVendedor As Integer = -1 + + Dim CountDetalles As Integer = 0 + Dim PuEnCero As Boolean = False + + For Each GvRow As GridViewRow In GvMU.Rows + + Dim CantidadRegistro As Decimal = GvRow.FCTextBox("TxtUtilizado").Text.ToDecimal + Dim PU As Decimal = GvRow.DataKey("PU").ToDecimal + Dim CodigoPS As String = GvRow.DataKey("CodigoPS") + + If CantidadRegistro > 0 Then + If PU > 0 Then + CountDetalles = CountDetalles + 1 + Else + Alert($"Prodcuto {CodigoPS} con precio unitario en cero.", TipoMensaje.MsgAdvertencia) + PuEnCero = True + End If + End If + + Next + + If PuEnCero Then + Respuesta.CveVenta = -1 + Respuesta.SerieFolio = "" + Respuesta.dtdetalle = New DataTable + Return Respuesta + End If + + If CountDetalles = 0 Then + Respuesta.CveVenta = -1 + Respuesta.SerieFolio = "" + Respuesta.dtdetalle = New DataTable + Alert("Remision sin detalles.", TipoMensaje.MsgAdvertencia) + Return Respuesta + End If + + + If ObjVentas.GetVenta(CvePedido, UsuarioActual.CveEmpresa, VerificaAlmacen:=False) Then Dim DbRowVenta As DataRow = ObjVentas.DtResultados.Copy().Rows(0) CveMoneda = DbRowVenta("CveMoneda").ToString.ToEntero