-- mejoras en tipos de venta
This commit is contained in:
@@ -454,7 +454,7 @@ Partial Class OS_OrdenesServicios
|
||||
End If
|
||||
End If
|
||||
|
||||
If UsuarioActual.Empresa.Funcionalidad(578).ToEntero = 1 Then
|
||||
If UsuarioActual.Empresa.Funcionalidad(578) = "1" Then
|
||||
|
||||
BtnCancelar.Text = "Cancelar Cirugía"
|
||||
HplRegresar.NavigateUrl = "/OS/RepOSMedicas.aspx"
|
||||
@@ -2980,12 +2980,12 @@ Partial Class OS_OrdenesServicios
|
||||
End Sub
|
||||
|
||||
Protected Sub LnkAccionesMaterialUtilizado_Click(sender As Object, e As EventArgs)
|
||||
If UsuarioActual.Empresa.Funcionalidad(578) = "1" Then
|
||||
|
||||
LnkModalMaterialUtilizado.Visible = True
|
||||
DTSolicitudDev = New DataTable
|
||||
Dim Opcion As Integer = If(DdlTipoVenta.SelectedValue.Contiene("2", "3"), 2, 1)
|
||||
|
||||
|
||||
Select Case DdlTipoVenta.SelectedValue.ToEntero
|
||||
Case 1, 2 ' *Fuera de liena *pago directo
|
||||
Opcion = 1
|
||||
@@ -3000,7 +3000,7 @@ Partial Class OS_OrdenesServicios
|
||||
End Select
|
||||
|
||||
Dim ObjOS As New ClsOS
|
||||
If ObjOS.GetOrdenesServicioDevolucionMaterial(CveOS, If(UsuarioActual.Empresa.Funcionalidad(578).ToEntero = 1, CvePedido, CveVenta), Opcion, UsuarioActual.CveEmpresa) Then
|
||||
If ObjOS.GetOrdenesServicioDevolucionMaterial(CveOS, If(UsuarioActual.Empresa.Funcionalidad(578) = "1", CvePedido, CveVenta), Opcion, UsuarioActual.CveEmpresa) Then
|
||||
DTSolicitudDev = ObjOS.DtResultados
|
||||
GvMU.DataSource = DTSolicitudDev
|
||||
GvMU.Columns(3).Visible = DTSolicitudDev.MIN("Serie") <> ""
|
||||
@@ -3019,18 +3019,16 @@ Partial Class OS_OrdenesServicios
|
||||
LnkModalMaterialUtilizado.Visible = False
|
||||
End If
|
||||
|
||||
If UsuarioActual.Empresa.Funcionalidad(578).ToEntero = 1 Then
|
||||
TxtPacienteModal.Text = TxtPaciente.Text
|
||||
TxtEpisodioModal.Text = TxtIdentificadorCliente.Text
|
||||
TxtFolioRemisionModal.Text = TxtFolioAdicional.Text
|
||||
End If
|
||||
|
||||
If DdlTipoVenta.SelectedValue.ToEntero = 5 Then
|
||||
DvTxtFolioRemisionModal.Visible = False
|
||||
Else
|
||||
DvTxtFolioRemisionModal.Visible = True
|
||||
End If
|
||||
|
||||
End If
|
||||
UpModalMaterialUtilizado.Update()
|
||||
|
||||
End Sub
|
||||
@@ -3048,7 +3046,10 @@ Partial Class OS_OrdenesServicios
|
||||
|
||||
Dim ProcesoOK As Boolean = True
|
||||
|
||||
If UsuarioActual.Empresa.Funcionalidad(578).ToEntero = 1 Then
|
||||
If UsuarioActual.Empresa.Funcionalidad(578) = "1" Then
|
||||
Dim CveAlmacenDestino As Integer = -1
|
||||
Dim CveSubProyectoPedido As Integer
|
||||
'---------------- INICIO VALIDACIONES -----------------
|
||||
If TxtPacienteModal.Text.Trim.Length = 0 Then
|
||||
Alert("Debe de proporcionar el paciente.", TipoMensaje.MsgAdvertencia)
|
||||
Exit Sub
|
||||
@@ -3058,7 +3059,6 @@ Partial Class OS_OrdenesServicios
|
||||
Alert("Debe de proporcionar el episodio.", TipoMensaje.MsgAdvertencia)
|
||||
Exit Sub
|
||||
End If
|
||||
End If
|
||||
|
||||
Dim TieneArchivos As Boolean = False
|
||||
Dim Filesgral As List(Of Archivo) = AnexoManerialUtilizado.getfiles().Archivos
|
||||
@@ -3071,32 +3071,37 @@ Partial Class OS_OrdenesServicios
|
||||
Exit Sub
|
||||
End If
|
||||
|
||||
|
||||
Dim CveAlmacenActual As Integer = DTSolicitudDev.FiltroPrimeroValor("CveAlmacenActual").ToEntero
|
||||
Dim CveMoneda As Integer = DTSolicitudDev.FiltroPrimeroValor("CveMoneda").ToEntero
|
||||
Dim CveSubProyectoPedido As Integer = DTSolicitudDev.FiltroPrimeroValor("CveSubProyecto").ToEntero
|
||||
Dim CveVentaPedido As Integer = DTSolicitudDev.FiltroPrimeroValor("CveVenta").ToEntero
|
||||
Dim CveAlmacenDestino As Integer = GlobalDTAlmacen(UsuarioActual.CveEmpresa, 10).FiltroPrimeroValor("CveAlmacen", $"CveSubProyecto = {CveSubProyectoPedido}").ToEntero
|
||||
Dim CveVentaRemisionGenerada As Integer = -1
|
||||
|
||||
If DdlTipoVenta.SelectedValue.ToEntero = 5 Then
|
||||
Dim TotalSeleccionado As Decimal = 0
|
||||
|
||||
For Each GVRow As GridViewRow In GvMU.Rows
|
||||
TotalSeleccionado = TotalSeleccionado + GVRow.FCTextBox("TxtUtilizado").Text.ToDecimal
|
||||
Next
|
||||
|
||||
If DdlTipoVenta.SelectedValue = "5" Then
|
||||
If TotalSeleccionado = 0 Then
|
||||
Alert("No se seleccionó ningun material", TipoMensaje.MsgAdvertencia)
|
||||
Exit Sub
|
||||
End If
|
||||
Else
|
||||
|
||||
CveSubProyectoPedido = DTSolicitudDev.FiltroPrimeroValor("CveSubProyecto").ToEntero
|
||||
CveAlmacenDestino = GlobalDTAlmacen(UsuarioActual.CveEmpresa, 10).FiltroPrimeroValor("CveAlmacen", $"CveSubProyecto = {CveSubProyectoPedido}").ToEntero
|
||||
If Not CveAlmacenDestino > 0 Then
|
||||
Alert("No se encontró almacen de entrega por adelantado", TipoMensaje.MsgAdvertencia)
|
||||
Exit Sub
|
||||
End If
|
||||
End If
|
||||
|
||||
If TotalSeleccionado > 0 AndAlso Not TxtFolioRemisionModal.Text.Trim.Length > 0 Then
|
||||
Alert("El campo Folio es requerido por favor ingréselo.", TipoMensaje.MsgAdvertencia)
|
||||
Exit Sub
|
||||
End If
|
||||
|
||||
'---------------- FIN VALIDACIONES -----------------
|
||||
|
||||
Dim CveAlmacenActual As Integer = DTSolicitudDev.FiltroPrimeroValor("CveAlmacenActual").ToEntero
|
||||
Dim CveMoneda As Integer = DTSolicitudDev.FiltroPrimeroValor("CveMoneda").ToEntero
|
||||
|
||||
Dim CveVentaPedido As Integer = DTSolicitudDev.FiltroPrimeroValor("CveVenta").ToEntero
|
||||
Dim CveVentaRemisionGenerada As Integer = -1
|
||||
|
||||
Dim ObjV As New ClsVentas
|
||||
Dim ObjOS As New ClsOS(ObjV.IniciaTransacSQL())
|
||||
@@ -3155,28 +3160,27 @@ Partial Class OS_OrdenesServicios
|
||||
End If
|
||||
End If
|
||||
End If
|
||||
'asigno la cveventa, como concluido
|
||||
If ProcesoOK Then
|
||||
If Not ObjOS.UpdateVentaOS(CveVenta, CveOS, UsuarioActual.CveEmpresa, TxtPacienteModal.Text.Trim, TxtEpisodioModal.Text.Trim, FolioAdicional:=TxtFolioRemisionModal.Text.Trim) Then
|
||||
ProcesoOK = False
|
||||
End If
|
||||
End If
|
||||
Else
|
||||
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
|
||||
@@ -3188,14 +3192,16 @@ Partial Class OS_OrdenesServicios
|
||||
End If
|
||||
End If
|
||||
Next
|
||||
|
||||
|
||||
Else
|
||||
'' otros opciones <> 5
|
||||
If ProcesoOK Then
|
||||
|
||||
Dim AplicaDevolucion As Boolean = False
|
||||
Dim StrCveVentasDetalle As New StringBuilder
|
||||
For Each GvRow As GridViewRow In GvMU.Rows
|
||||
Dim CveVentaDetalle As Integer = GvRow.DataKey("CveVentaDetalle").ToEntero
|
||||
Dim CantidadDev As Decimal = GvRow.DataKey("Cantidad").ToDecimal - GvRow.FCTextBox("TxtUtilizado").Text.ToDecimal
|
||||
StrCveVentasDetalle.AppendFormat("{0},", CveVentaDetalle)
|
||||
|
||||
If CantidadDev > 0 AndAlso CveVentaDetalle > 0 Then
|
||||
AplicaDevolucion = True
|
||||
@@ -3206,7 +3212,6 @@ Partial Class OS_OrdenesServicios
|
||||
Exit For
|
||||
End If
|
||||
End If
|
||||
|
||||
If GvRow.FCTextBox("TxtUtilizado").Text.ToDecimal > 0 Then
|
||||
GenerarRemisionMovimientos = True
|
||||
End If
|
||||
@@ -3216,9 +3221,15 @@ Partial Class OS_OrdenesServicios
|
||||
ProcesoOK = False
|
||||
End If
|
||||
End If
|
||||
' obtiene las ventasdetalle del pedido/rem, para recorrerlas y si hay alguna solo solicitada pero no surtida, que no siga pendiente de surtir.
|
||||
If ProcesoOK AndAlso ObjV.GetVentaDetalle(CveVentaPedido) Then
|
||||
Dim DtVentasDetalle As DataTable = ObjV.DtResultados
|
||||
Dim dtt As DataTable = DtVentasDetalle.FiltraParametros($"CveVentaDetalle NOT IN ({StrCveVentasDetalle.ToString} -1)")
|
||||
For Each dr As DataRow In dtt.Rows
|
||||
ObjInventario.UpdateEstatusAlmacen(dr("CveVentaDetalle").ToString.ToEntero, 1) 'para no surtirse
|
||||
Next
|
||||
End If
|
||||
End If
|
||||
|
||||
'ProcesoOK = False
|
||||
|
||||
Dim Respuesta As New RespuestaFacturacion()
|
||||
Dim DtVentaDetalle As New DataTable
|
||||
@@ -3226,14 +3237,6 @@ Partial Class OS_OrdenesServicios
|
||||
Dim ImporteAlmacen As Decimal
|
||||
Dim Fecha As DateTime = ClsPaginas.NowADS()
|
||||
|
||||
If GenerarRemisionMovimientos AndAlso ProcesoOK Then
|
||||
If Not TxtFolioRemisionModal.Text.Trim.Length > 0 Then
|
||||
Alert("El campo Folio es requerido por favor ingréselo.", TipoMensaje.MsgAdvertencia)
|
||||
ProcesoOK = False
|
||||
GenerarRemisionMovimientos = False
|
||||
End If
|
||||
End If
|
||||
|
||||
If GenerarRemisionMovimientos AndAlso ProcesoOK Then
|
||||
Respuesta = GeneraRemision(CveVentaPedido, ObjV.IniciaTransacSQL())
|
||||
|
||||
@@ -3283,7 +3286,6 @@ Partial Class OS_OrdenesServicios
|
||||
ProcesoOK = False
|
||||
Exit For
|
||||
End If
|
||||
|
||||
Dim Serie As String = drr("Serie").ToString
|
||||
Dim Lote As String = drr("Lote").ToString
|
||||
Dim FechaCaducidad As DateTime = drr("FechaCaducidad").ToString.ToDate
|
||||
@@ -3350,7 +3352,6 @@ Partial Class OS_OrdenesServicios
|
||||
ProcesoOK = False
|
||||
End If
|
||||
End If
|
||||
|
||||
End If
|
||||
Else
|
||||
ProcesoOK = False
|
||||
@@ -3368,7 +3369,6 @@ Partial Class OS_OrdenesServicios
|
||||
End If
|
||||
End If
|
||||
|
||||
|
||||
If ProcesoOK Then
|
||||
If Not ObjOS.UpdateVentaOS(-1, CveOS, UsuarioActual.CveEmpresa, TxtPacienteModal.Text.Trim, TxtEpisodioModal.Text.Trim) Then
|
||||
ProcesoOK = False
|
||||
@@ -3401,7 +3401,7 @@ Partial Class OS_OrdenesServicios
|
||||
End If
|
||||
|
||||
ObjV.Dispose()
|
||||
|
||||
End If
|
||||
End Sub
|
||||
|
||||
|
||||
@@ -3609,13 +3609,10 @@ Partial Class OS_OrdenesServicios
|
||||
End Class
|
||||
Protected Sub LnkActualizarUsaurioAtendio_Click(sender As Object, e As EventArgs)
|
||||
|
||||
|
||||
|
||||
If DdlUsuarioAtendio.SelectedValue.ToEntero > 0 Then
|
||||
|
||||
Dim ObjOS As New ClsOS
|
||||
ObjOS.IniciaTransacSQL()
|
||||
|
||||
Dim ProcesoOk As Boolean = True
|
||||
|
||||
For Each GvRow As GridViewRow In GvPS.Rows
|
||||
@@ -3637,13 +3634,10 @@ Partial Class OS_OrdenesServicios
|
||||
Alert($"Se presento un error al actualizar el técnico.")
|
||||
CargaHistorial()
|
||||
End If
|
||||
|
||||
Else
|
||||
Alert("Debe de seleccionar un ténico para actualziar", TipoMensaje.MsgAdvertencia)
|
||||
End If
|
||||
|
||||
|
||||
|
||||
End Sub
|
||||
|
||||
Protected Sub GVEventoBitacora_RowDataBound(sender As Object, e As GridViewRowEventArgs) Handles GvEB.RowDataBound
|
||||
@@ -3692,7 +3686,6 @@ Partial Class OS_OrdenesServicios
|
||||
|
||||
Protected Sub BtnCancelar_Click(sender As Object, e As EventArgs)
|
||||
|
||||
|
||||
Dim CveEstatusOrdenServicioCancelacion As Integer = GlobalDTEstatusOrdenServicios(UsuarioActual.CveEmpresa).FiltroPrimeroValor("CveEstatusOrdenServicio", " TipoEstatus = 5 ").ToEntero
|
||||
Dim CveAlmacenDevolucion As Integer
|
||||
Dim CveMotivoCancelacion As Integer = GlobalDTMotivosCancelacionEmpresa(UsuarioActual.CveEmpresa).FiltroPrimeroValor("CveMotivoCancelacion", "CveSATMotivoCancelacion IN (3)").ToEntero
|
||||
@@ -3710,9 +3703,7 @@ Partial Class OS_OrdenesServicios
|
||||
Dim ObjFacturaCancelacion As New Modelos.Factura(UsuarioActual, CvePedido, UsuarioActual.CveEmpresa, EsCancelacion:=True, VerificaAlmacen:=True)
|
||||
|
||||
Try
|
||||
|
||||
Dim resp As Modelos.Factura.MCancelacionVentaMensaje = Nothing
|
||||
|
||||
If ObjFacturaCancelacion IsNot Nothing AndAlso ObjFacturaCancelacion.CveVenta > 0 Then
|
||||
|
||||
Dim SWatch As New Stopwatch
|
||||
@@ -3728,16 +3719,11 @@ Partial Class OS_OrdenesServicios
|
||||
Alert($"Se presento un error al cancelar la orden de servicio, {resp.Mensaje}".ToString(), TipoMensaje.MsgError)
|
||||
Else
|
||||
Alert($"la orden de servicio se cancelada correctamente, {resp.Mensaje}", resp.TipoMensaje, " location.reload(true); ")
|
||||
|
||||
Dim objGeneral As New ClsGenerales
|
||||
objGeneral.AddHistorialBitacora(256, -1, -1, -1, CveOS, -1, -1, -1, "Cancelada", DdlEstatusOS.SelectedItem.Text, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, 0, "", "", "")
|
||||
objGeneral.Dispose()
|
||||
|
||||
|
||||
End If
|
||||
|
||||
End If
|
||||
|
||||
Catch ex As Exception
|
||||
Alert("Se presento un error al cancelar la orden de servicio")
|
||||
End Try
|
||||
|
||||
Reference in New Issue
Block a user