-- mejora para SMS
This commit is contained in:
@@ -2991,19 +2991,14 @@ Partial Class OS_OrdenesServicios
|
||||
Select Case DdlTipoVenta.SelectedValue.ToEntero
|
||||
Case 1, 2 ' *Fuera de liena *pago directo
|
||||
Opcion = 1
|
||||
Exit Select
|
||||
Case 3 ' por el momento ya no se usa
|
||||
Opcion = 2
|
||||
Exit Select
|
||||
Case 5 ' consignacion uso
|
||||
Opcion = 3
|
||||
Exit Select
|
||||
Case 6 ' a vista uso de material
|
||||
Opcion = 4
|
||||
Exit Select
|
||||
Case Else
|
||||
Opcion = 1
|
||||
Exit Select
|
||||
End Select
|
||||
|
||||
Dim ObjOS As New ClsOS
|
||||
@@ -3080,7 +3075,7 @@ Partial Class OS_OrdenesServicios
|
||||
TotalSeleccionado = TotalSeleccionado + GVRow.FCTextBox("TxtUtilizado").Text.ToDecimal
|
||||
Next
|
||||
If TotalSeleccionado = 0 Then
|
||||
Alert("No se selecciono ningun material", TipoMensaje.MsgAdvertencia)
|
||||
Alert("No se seleccionó ningun material", TipoMensaje.MsgAdvertencia)
|
||||
Exit Sub
|
||||
End If
|
||||
Else
|
||||
@@ -3096,38 +3091,45 @@ Partial Class OS_OrdenesServicios
|
||||
Dim ObjOS As New ClsOS(ObjV.IniciaTransacSQL())
|
||||
Dim ObjInventario As New ClsInventarios(ObjV.IniciaTransacSQL())
|
||||
Dim ObjConta As New ClsContabilidad(ObjV.IniciaTransacSQL())
|
||||
Dim GenrarRemisionMovimientos As Boolean = False
|
||||
Dim GenerarRemisionMovimientos As Boolean = False
|
||||
|
||||
If DdlTipoVenta.SelectedValue.ToEntero = 5 Then
|
||||
If DdlTipoVenta.SelectedValue = "5" Then 'Consignación - Uso Material
|
||||
'genera una salida de almacen.
|
||||
Dim CveMovimientoSalida As Integer = ObjInventario.AddMovimiento(CveAlmacenActual, 8, CveMoneda, ClsPaginas.NowADS(), -1, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, -1, CveVenta, CveSubProyectoPedido, -1, CveOS:=CveOS, CveAlmacenDestino:=CveAlmacenDestino, Modulo:="OS/MatUtilConsig")
|
||||
Dim Folio As Integer = ObjInventario.Folio
|
||||
|
||||
For Each GVRow As GridViewRow In GvMU.Rows
|
||||
Dim CantidadRegistro As Decimal = GVRow.FCTextBox("TxtUtilizado").Text.ToDecimal
|
||||
Dim CvePS As Integer = GVRow.DataKey("CvePS").ToEntero
|
||||
If CveMovimientoSalida > 0 Then
|
||||
For Each GVRow As GridViewRow In GvMU.Rows
|
||||
Dim CantidadRegistro As Decimal = GVRow.FCTextBox("TxtUtilizado").Text.ToDecimal
|
||||
Dim CvePS As Integer = GVRow.DataKey("CvePS").ToEntero
|
||||
|
||||
If CantidadRegistro > 0 Then
|
||||
Dim Serie As String = If(GVRow.DataKey("Serie") = "", "-1", GVRow.DataKey("Serie"))
|
||||
Dim Lote As String = If(GVRow.DataKey("Lote") = "", "-1", GVRow.DataKey("Lote"))
|
||||
Dim FechaCaducidad As DateTime = If(GVRow.DataKey("FechaCaducidad") = "", MinFecha, GVRow.DataKey("FechaCaducidad").ToDate)
|
||||
If Not ObjOS.AddOrdenesServicioMateriales(CveOS, CvePS, CantidadRegistro, Serie, Lote, FechaCaducidad, UsuarioActual.CveUsuario) Then
|
||||
Alert("Ocurrió un error al guardar el material.", TipoMensaje.MsgAdvertencia)
|
||||
ProcesoOK = False
|
||||
Exit For
|
||||
If CantidadRegistro > 0 Then
|
||||
Dim Serie As String = GVRow.DataKey("Serie")
|
||||
Dim Lote As String = GVRow.DataKey("Lote")
|
||||
Dim CveUM As Integer = GVRow.DataKey("CveUM").ToEntero
|
||||
Dim FechaCaducidad As DateTime = GVRow.DataKey("FechaCaducidad").ToDate
|
||||
If Not ObjInventario.AddMovimientoDetalle(CveMovimientoSalida, CantidadRegistro, CveUM, CvePS, 0, Lote:=Lote, Serie:=Serie, FechaCaducidad:=FechaCaducidad) Then
|
||||
Alert("Error al agregar detalle de movimiento.", TipoMensaje.MsgAdvertencia)
|
||||
ProcesoOK = False
|
||||
Exit For
|
||||
End If
|
||||
End If
|
||||
End If
|
||||
Next
|
||||
If ProcesoOK Then
|
||||
Dim CveOSEstatusFinalizada As Integer = GlobalDTEstatusOrdenServicios(UsuarioActual.CveEmpresa).FiltroPrimeroValor("CveEstatusOrdenServicio", "TipoEstatus = 4").ToEntero
|
||||
If CveOSEstatusFinalizada > 0 Then
|
||||
If Not ObjOS.UpdateOrdenesServiciosEstatus(CveOSEstatusFinalizada, UsuarioActual.CveUsuario, CveOS) Then
|
||||
Next
|
||||
If ProcesoOK Then
|
||||
Dim CveOSEstatusFinalizada As Integer = GlobalDTEstatusOrdenServicios(UsuarioActual.CveEmpresa).FiltroPrimeroValor("CveEstatusOrdenServicio", "TipoEstatus = 4").ToEntero
|
||||
If CveOSEstatusFinalizada > 0 Then
|
||||
If Not ObjOS.UpdateOrdenesServiciosEstatus(CveOSEstatusFinalizada, UsuarioActual.CveUsuario, CveOS) Then
|
||||
ProcesoOK = False
|
||||
End If
|
||||
Else
|
||||
Alert("No se pudo obtener el estado para finalizar la orden de servicio.")
|
||||
ProcesoOK = False
|
||||
End If
|
||||
Else
|
||||
Alert("No se pudo obtener el estado para finalizar la orden de servicio.")
|
||||
ProcesoOK = False
|
||||
End If
|
||||
|
||||
|
||||
Else
|
||||
ProcesoOK = False
|
||||
End If
|
||||
|
||||
Else
|
||||
If ProcesoOK Then
|
||||
Dim AplicaDevolucion As Boolean = False
|
||||
@@ -3135,20 +3137,19 @@ Partial Class OS_OrdenesServicios
|
||||
Dim CveVentaDetalle As Integer = GvRow.DataKey("CveVentaDetalle").ToEntero
|
||||
Dim CantidadDev As Decimal = GvRow.DataKey("Cantidad").ToDecimal - GvRow.FCTextBox("TxtUtilizado").Text.ToDecimal
|
||||
|
||||
If CantidadDev > 0 Then
|
||||
If CantidadDev > 0 AndAlso CveVentaDetalle > 0 Then
|
||||
AplicaDevolucion = True
|
||||
If Not ObjV.UpdateVentasDetalleCantidadDevolucion(CveVentaDetalle, CantidadDev) Then
|
||||
ProcesoOK = False
|
||||
GenrarRemisionMovimientos = False
|
||||
GenerarRemisionMovimientos = False
|
||||
AplicaDevolucion = False
|
||||
Exit For
|
||||
End If
|
||||
End If
|
||||
|
||||
If GvRow.FCTextBox("TxtUtilizado").Text.ToDecimal > 0 Then
|
||||
GenrarRemisionMovimientos = True
|
||||
GenerarRemisionMovimientos = True
|
||||
End If
|
||||
|
||||
Next
|
||||
If AplicaDevolucion Then
|
||||
If Not ObjV.UpdateVentasDevolucionAlmacen(1, CveVentaPedido) Then
|
||||
@@ -3162,29 +3163,36 @@ Partial Class OS_OrdenesServicios
|
||||
Dim ImporteAlmacen As Decimal
|
||||
Dim Fecha As DateTime = ClsPaginas.NowADS()
|
||||
|
||||
If GenrarRemisionMovimientos AndAlso ProcesoOK Then
|
||||
If GenerarRemisionMovimientos AndAlso ProcesoOK Then
|
||||
If Not TxtFolioRemisionModal.Text.Trim.Length > 0 Then
|
||||
Alert("El campo Folio es requerido por favor ingreselo.", TipoMensaje.MsgAdvertencia)
|
||||
Alert("El campo Folio es requerido por favor ingréselo.", TipoMensaje.MsgAdvertencia)
|
||||
ProcesoOK = False
|
||||
GenrarRemisionMovimientos = False
|
||||
GenerarRemisionMovimientos = False
|
||||
End If
|
||||
End If
|
||||
|
||||
If GenrarRemisionMovimientos AndAlso ProcesoOK Then
|
||||
If GenerarRemisionMovimientos AndAlso ProcesoOK Then
|
||||
Respuesta = GeneraRemision(CveVentaPedido, ObjV.IniciaTransacSQL())
|
||||
|
||||
If Respuesta.CveVenta > 0 Then
|
||||
If ObjV.GetVentaDetalle(Respuesta.CveVenta) Then
|
||||
Dim dtClon As DataTable = ObjV.DtResultados.Copy
|
||||
dtClon.DefaultView.Sort = "CveVentaDetalle ASC"
|
||||
DtVentaDetalle = dtClon.DefaultView.ToTable()
|
||||
Dim dtmat As DataTable = dtClon.DefaultView.ToTable()
|
||||
'una vez registrada, asocia los lotes/cad con el cveventadetalle para que se surta así
|
||||
DtVentaDetalle = Respuesta.dtdetalle
|
||||
For i = 0 To dtmat.Rows.Count - 1
|
||||
If DtVentaDetalle.Rows(i)("CvePS").ToString = dtmat.Rows(i)("CvePS").ToString Then
|
||||
DtVentaDetalle.Rows(i)("CveVentaDetalle") = dtmat.Rows(i)("CveVentaDetalle")
|
||||
End If
|
||||
Next
|
||||
End If
|
||||
Else
|
||||
ProcesoOK = False
|
||||
End If
|
||||
End If
|
||||
|
||||
If GenrarRemisionMovimientos AndAlso ProcesoOK Then
|
||||
If GenerarRemisionMovimientos AndAlso ProcesoOK Then
|
||||
|
||||
CveMovimientoSalida = ObjInventario.AddMovimiento(CveAlmacenActual, 8, CveMoneda, Fecha, -1, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, -1, Respuesta.CveVenta, CveSubProyectoPedido, -1, CveOS:=CveOS, CveAlmacenDestino:=CveAlmacenDestino, Modulo:="OS/MatUtil")
|
||||
Dim Folio As Integer = ObjInventario.Folio
|
||||
@@ -3192,17 +3200,17 @@ Partial Class OS_OrdenesServicios
|
||||
If CveMovimientoSalida > 0 Then
|
||||
|
||||
Dim IndexMov1 As Integer = 0
|
||||
For Each GvRow As GridViewRow In GvMU.Rows
|
||||
For Each drr As DataRow In DtVentaDetalle.Rows
|
||||
|
||||
Dim Cantidad As Decimal = GvRow.DataKey("Cantidad").ToDecimal
|
||||
Dim CantidadRegistro As Decimal = GvRow.FCTextBox("TxtUtilizado").Text.ToDecimal
|
||||
Dim CvePS As Integer = GvRow.DataKey("CvePS").ToEntero
|
||||
Dim CveUM As Integer = GvRow.DataKey("CveUM").ToEntero
|
||||
Dim PU As Decimal = GvRow.DataKey("PU").ToDecimal
|
||||
Dim Cantidad As Decimal = drr("Cantidad").ToString.ToDecimal
|
||||
'Dim CantidadRegistro As Decimal = GvRow.FCTextBox("TxtUtilizado").Text.ToDecimal
|
||||
Dim CvePS As Integer = drr("CvePS").ToString.ToEntero
|
||||
Dim CveUM As Integer = drr("CveUM").ToString.ToEntero
|
||||
Dim PU As Decimal = drr("PU").ToString.ToDecimal
|
||||
|
||||
If CantidadRegistro > 0 Then
|
||||
Dim CveVentaDetalle As Integer = DtVentaDetalle.FiltroPrimeroValor("CveVentaDetalle", $"CveVentaDetallePadre = {GvRow.DataKey("CveVentaDetalle")}").ToEntero
|
||||
Dim CveMovimientoDetalle As Integer = GvRow.DataKey("CveMovimientoDetalle").ToEntero
|
||||
If Cantidad > 0 Then
|
||||
Dim CveVentaDetalle As Integer = drr("CveVentaDetalle").ToString.ToEntero 'DtVentaDetalle.FiltroPrimeroValor("CveVentaDetalle", $"CveVentaDetallePadre = {GvRow.DataKey("CveVentaDetalle")}").ToEntero
|
||||
Dim CveMovimientoDetalle As Integer = -1 'GvRow.DataKey("CveMovimientoDetalle").ToEntero
|
||||
|
||||
If CveVentaDetalle <= 0 Then
|
||||
Alert("Error al agregar detalle de movimiento.", TipoMensaje.MsgAdvertencia)
|
||||
@@ -3210,10 +3218,10 @@ Partial Class OS_OrdenesServicios
|
||||
Exit For
|
||||
End If
|
||||
|
||||
Dim Serie As String = GvRow.DataKey("Serie")
|
||||
Dim Lote As String = GvRow.DataKey("Lote")
|
||||
Dim FechaCaducidad As DateTime = GvRow.DataKey("FechaCaducidad").ToDate
|
||||
If Not ObjInventario.AddMovimientoDetalle(CveMovimientoSalida, CantidadRegistro, CveUM, CvePS, PU, CveVentaDetalle:=CveVentaDetalle, CveMovimientoDetalleEntrada:=CveMovimientoDetalle, Lote:=Lote, Serie:=Serie, FechaCaducidad:=FechaCaducidad) Then
|
||||
Dim Serie As String = "" 'GvRow.DataKey("Serie")
|
||||
Dim Lote As String = drr("Lote").ToString
|
||||
Dim FechaCaducidad As DateTime = drr("FechaCaducidad").ToString.ToDate
|
||||
If Not ObjInventario.AddMovimientoDetalle(CveMovimientoSalida, Cantidad, CveUM, CvePS, PU, CveVentaDetalle:=CveVentaDetalle, CveMovimientoDetalleEntrada:=CveMovimientoDetalle, Lote:=Lote, Serie:=Serie, FechaCaducidad:=FechaCaducidad) Then
|
||||
Alert("Error al agregar detalle de movimiento.", TipoMensaje.MsgAdvertencia)
|
||||
ProcesoOK = False
|
||||
Exit For
|
||||
@@ -3312,7 +3320,7 @@ Partial Class OS_OrdenesServicios
|
||||
Dim Liga As String = $" document.location.href=""/OS/OrdenesServicios.aspx?CveOS={CveOS}""; "
|
||||
Alert("El material utilizado se guardó correctamente", TipoMensaje.MsgInformacion, Liga)
|
||||
Else
|
||||
If GenrarRemisionMovimientos = False Then
|
||||
If GenerarRemisionMovimientos = False Then
|
||||
Alert("El material sera recibido en almacén.")
|
||||
Else
|
||||
Alert("El material utilizado se guardó correctamente")
|
||||
@@ -3401,6 +3409,16 @@ Partial Class OS_OrdenesServicios
|
||||
ObjFactura.Episodio = TxtEpisodioModal.Text.Trim
|
||||
ObjFactura.Alfa1 = TxtFolioRemisionModal.Text.Trim
|
||||
|
||||
Dim TmpDTMat As New DataTable
|
||||
TmpDTMat.Columns.Add("Consec", GetType(Integer))
|
||||
TmpDTMat.Columns.Add("CvePS", GetType(Integer))
|
||||
TmpDTMat.Columns.Add("CveUM", GetType(Integer))
|
||||
TmpDTMat.Columns.Add("Cantidad", GetType(Integer))
|
||||
TmpDTMat.Columns.Add("PU", GetType(Decimal))
|
||||
TmpDTMat.Columns.Add("Lote", GetType(String))
|
||||
TmpDTMat.Columns.Add("FechaCaducidad", GetType(Date))
|
||||
TmpDTMat.Columns.Add("CveVentaDetalle", GetType(Integer))
|
||||
|
||||
For Each GvRow As GridViewRow In GvMU.Rows
|
||||
|
||||
Dim CvePS As Integer = GvRow.DataKey("CvePS").ToEntero
|
||||
@@ -3409,8 +3427,17 @@ Partial Class OS_OrdenesServicios
|
||||
Dim Descuento As Decimal = GvRow.DataKey("Descuento").ToDecimal
|
||||
Dim Obs As String = GvRow.DataKey("Observaciones")
|
||||
|
||||
|
||||
If CantidadRegistro > 0 Then
|
||||
If Not ObjFactura.AgregarPS(CvePS, CantidadRegistro, PU, Descuento, Obs, CveSubProyecto:=CveSubProyectoPedido, CveVentaDetallePadre:=GvRow.DataKey("CveVentaDetalle").ToEntero) Then
|
||||
If ObjFactura.AgregarPS(CvePS, CantidadRegistro, PU, Descuento, Obs, CveSubProyecto:=CveSubProyectoPedido, CveVentaDetallePadre:=GvRow.DataKey("CveVentaDetalle").ToEntero) Then
|
||||
Dim drp As DataRow = TmpDTMat.NewRow
|
||||
drp("CvePS") = CvePS
|
||||
drp("Cantidad") = CantidadRegistro
|
||||
drp("PU") = PU
|
||||
drp("Lote") = GvRow.DataKey("Lote")
|
||||
drp("FechaCaducidad") = GvRow.DataKey("FechaCaducidad").ToDate
|
||||
TmpDTMat.Rows.Add(drp)
|
||||
Else
|
||||
Alert("Error al agregar producto", TipoMensaje.MsgAdvertencia)
|
||||
ProcesoOK = False
|
||||
Exit For
|
||||
@@ -3426,6 +3453,7 @@ Partial Class OS_OrdenesServicios
|
||||
If Resp.CveVenta > 0 Then
|
||||
Respuesta.CveVenta = Resp.CveVenta
|
||||
Respuesta.SerieFolio = Resp.SerieFolio
|
||||
Respuesta.dtdetalle = TmpDTMat
|
||||
Else
|
||||
ProcesoOK = False
|
||||
End If
|
||||
@@ -3442,6 +3470,7 @@ Partial Class OS_OrdenesServicios
|
||||
Friend Class RespuestaFacturacion
|
||||
Public Property CveVenta As Integer = -1
|
||||
Public Property SerieFolio As String = "-1"
|
||||
Public Property dtdetalle As DataTable = Nothing
|
||||
Public Sub New()
|
||||
|
||||
End Sub
|
||||
|
||||
@@ -13691,14 +13691,14 @@ Partial Class Ventas
|
||||
Else
|
||||
CveAlmacenTraspasoDestino = drr("CveAlmacenAsignado").ToString.ToEntero '' cuando Fuera de Línea
|
||||
End If
|
||||
End If
|
||||
End If
|
||||
End If
|
||||
|
||||
If Not CveAlmacenTraspasoDestino > 0 Then
|
||||
If Not CveAlmacenTraspasoDestino > 0 Then ' para consignación es salida directa
|
||||
CveAlmacenTraspasoDestino = CveAlmacenAsignado
|
||||
End If
|
||||
|
||||
If RBLTipoVenta.SelectedValue.ToEntero = 2 Then
|
||||
If RBLTipoVenta.SelectedValue = "2" Then
|
||||
If Not ChkRequiereTecnico.Checked Then
|
||||
CveAlmacenTraspasoDestino = GlobalDTAlmacen(UsuarioActual.CveEmpresa).FiltroPrimeroValor("CveAlmacen", $"CveTipoAlmacen = 10 AND CveSubProyecto = {DdlSubProyectoDatos.SelectedValue}").ToString().ToEntero()
|
||||
End If
|
||||
@@ -13712,6 +13712,7 @@ Partial Class Ventas
|
||||
ErrorList.Add("Ocurrió un error al seleccionar el almacen de resguardo del cliente.")
|
||||
End If
|
||||
End If
|
||||
|
||||
End If
|
||||
|
||||
Dim TotalImpuestoLocal As Double = 0
|
||||
|
||||
Reference in New Issue
Block a user