This commit is contained in:
2024-08-21 07:11:21 -07:00
8 changed files with 345 additions and 7 deletions

View File

@@ -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