diff --git a/App_Code/ClsOS.vb b/App_Code/ClsOS.vb
index b158a0930..ec92c6dcc 100644
--- a/App_Code/ClsOS.vb
+++ b/App_Code/ClsOS.vb
@@ -70,6 +70,7 @@ Public Class ClsOS
Public Property CveMedico As Integer = -1
Public Property CveProcedimiento As Integer = -1
Public Property CveTipoVenta As Integer = -1
+ Public Property CveVenta As Integer = -1
Public Property Paciente As String
Public Property IdentificadorCliente As String
@@ -591,6 +592,7 @@ Public Class ClsOS
Me.CveTipoVenta = Data.Rows(0)("CveTipoVenta").ToString.ToEntero
Me.Paciente = Data.Rows(0)("Paciente").ToString
Me.IdentificadorCliente = Data.Rows(0)("IdentificadorCliente").ToString
+ Me.CveVenta = Data.Rows(0)("CveVenta").ToString.ToEntero
End If
Retorno = True
@@ -1323,6 +1325,29 @@ Public Class ClsOS
Return Retorno
End Function
+
+ Public Function GetOrdenesServicioDevolucionMaterial(CveOS As Integer, CveVenta As Integer, CveEmpresa As Integer) As Boolean
+ Dim Retorno As Boolean = False
+
+ DataAdapter("PA_OS_OrdenesServicioDevolucionMaterialGet")
+
+ With SqlAdapter.SelectCommand.Parameters
+ .Add("@CveOS", SqlDbType.Int).Value = CveOS
+ .Add("@CveVenta", SqlDbType.Int).Value = CveVenta
+ .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa
+ End With
+
+ Try
+ SqlAdapter.Fill(Data)
+ Retorno = True
+
+ Catch ex As Exception
+ OnError("Ocurrió un error al obtener los productos de devolución.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo)
+ End Try
+
+ Return Retorno
+ End Function
+
Public Function GetCotizacionOS(CveCotizacion As Integer) As Boolean
Dim Retorno As Boolean = False
DataAdapter("PA_OS_GetCotizacionOS")
diff --git a/Empresas/141/Formatos/CHQ-7452.rdlc b/Empresas/141/Formatos/CHQ-7452.rdlc
index a069ae2db..8dd5107aa 100644
--- a/Empresas/141/Formatos/CHQ-7452.rdlc
+++ b/Empresas/141/Formatos/CHQ-7452.rdlc
@@ -84,7 +84,7 @@
=Parameters!Beneficiario.Value
diff --git a/Inventarios/EntregaAlmacen.aspx.vb b/Inventarios/EntregaAlmacen.aspx.vb
index a0c94bd2c..499a952eb 100644
--- a/Inventarios/EntregaAlmacen.aspx.vb
+++ b/Inventarios/EntregaAlmacen.aspx.vb
@@ -3010,6 +3010,15 @@ Partial Class Inventarios_EntregaAlmacen
OnError("Ocurrió un error al guardar", ex)
End Try
+
+
+ If EsDevolucionVenta = 1 AndAlso CveOSSurtir > 0 AndAlso TipoMovimiento = 2 Then
+ If Not CierreOS(CveOSSurtir) Then
+ ErrorMovInv = True
+ Alert("Error al finalizar orden de servicio", TipoMensaje.MsgError)
+ End If
+ End If
+
If Not ErrorMovInv Then
ObjInventario.Commit()
@@ -4217,5 +4226,25 @@ Partial Class Inventarios_EntregaAlmacen
End If
- End Sub
+ End Sub
+
+ Private Function CierreOS(CveOSCerrar As Integer) As Boolean
+
+ Dim Respuesta As Boolean = True
+
+ Dim CveOSEstatusFinalizada As Integer = GlobalDTEstatusOrdenServicios(UsuarioActual.CveEmpresa).FiltroPrimeroValor("CveEstatusOrdenServicio", "TipoEstatus = 4").ToEntero
+
+ If CveOSEstatusFinalizada > 0 Then
+ Dim ObjOS As New ClsOS()
+ Respuesta = ObjOS.UpdateOrdenesServiciosEstatus(CveOSEstatusFinalizada, UsuarioActual.CveUsuario, CveOSCerrar)
+ ObjOS.Dispose()
+ Else
+ Alert("No se pudo obtener el estado para finalizar la orden de servicio.")
+ Respuesta = False
+ End If
+
+ Return Respuesta
+
+ End Function
+
End Class
diff --git a/OS/OrdenesServicios.aspx b/OS/OrdenesServicios.aspx
index 7f384d130..77742a9bf 100644
--- a/OS/OrdenesServicios.aspx
+++ b/OS/OrdenesServicios.aspx
@@ -13,6 +13,9 @@
Imprimir Orden
+
+ Devolución Material
+
@@ -1259,6 +1262,67 @@
<%--MODAL FINALIZAR ORDEN INICIO --%>
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Cant.
+
+
+
+
+
+ Dev
+
+
+
+
+
+
+ Concepto
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ <%--MODAL FINALIZAR ORDEN INICIO --%>
+
+
@@ -1405,5 +1469,15 @@
});
$('#GvMateriales').parent().parent().children().first().css("position", "static");
}
+
+
+
+ function ValidarCantidad(t, c) {
+ if (t.value > c) {
+ t.value = c;
+ }
+ }
+
+
diff --git a/OS/OrdenesServicios.aspx.vb b/OS/OrdenesServicios.aspx.vb
index 8abda6546..5dcc1b11f 100644
--- a/OS/OrdenesServicios.aspx.vb
+++ b/OS/OrdenesServicios.aspx.vb
@@ -7,6 +7,10 @@ Imports System.Data
Imports Microsoft.Reporting.WebForms
Imports ADSNetLibrary.SIGAPI.Models.Sistema
Imports Telerik.Charting.Styles
+Imports Telerik.Web.UI
+Imports DocumentFormat.OpenXml.Drawing.Diagrams
+Imports Profact.TimbraCFDI.Complementos.InstitucionesEducativas
+
'Imports msExcel = Microsoft.Office.Interop.Excel
'Imports VBIDE
@@ -84,6 +88,22 @@ Partial Class OS_OrdenesServicios
ViewState("CveOS") = value
End Set
End Property
+
+
+ Private Property CveVenta As Integer
+ Get
+ If ViewState("CveVenta") Is Nothing Then
+ ViewState("CveVenta") = -1
+ End If
+
+ Return ViewState("CveVenta").ToString.ToEntero
+ End Get
+ Set(value As Integer)
+ ViewState("CveVenta") = value
+ End Set
+ End Property
+
+
Private Property CveOsDetalle As Integer
Get
Return ViewState("CveOsDetalle").ToString.ToEntero
@@ -286,6 +306,7 @@ Partial Class OS_OrdenesServicios
TipoEstatus = 1
CveConsecutivo = 0
CveOsDetalle = -1
+ CveVenta = -1
CveUsuarioAtendioCount = 0
ImgImprimir.Visible = False
@@ -613,6 +634,7 @@ Partial Class OS_OrdenesServicios
SeFacturara = GlobalDTTipoOrdenServicios(UsuarioActual.CveEmpresa).FiltroPrimeroValor("SeFacturara", String.Format("CveOrdenServicioTipo = {0}", ObjOS.CveOSTipo))
CveTecnico = ObjOS.CveUsuarioAtendio
CargarEstatusDelUsuario(TipoEstatus)
+ CveVenta = ObjOS.CveVenta
'Dim validacionTieneEstatus As Integer = EstatusOSDelUsuario.FiltraParametros(String.Format("CveEstatusOrdenServicio = {0}", ObjOS.CveEstatusOrdenServicio)).Rows.Count
@@ -677,6 +699,11 @@ Partial Class OS_OrdenesServicios
CargaEventoBitacora()
CargaHistorial()
+
+
+ If CveVenta > 0 And TipoEstatus.Contiene(1, 2, 3) Then
+ LnkAccionesDevolucion.Visible = True
+ End If
Else
Alert("La Orden de Servicio Solicitado no existe, por favor revise su búsqueda.", TipoMensaje.MsgAdvertencia)
BtnGuardar.Enabled = False
@@ -3003,4 +3030,91 @@ Partial Class OS_OrdenesServicios
End Sub
+
+
+
+
+
+
+
+ Protected Sub LnkAccionesDevolucion_Click(sender As Object, e As EventArgs)
+
+ LnkModalSolicitarDevolucion.Visible = True
+
+ GvSolicitarDevolucion.DataSource = Nothing
+
+ Dim ObjOS As New ClsOS
+ Dim DTTemp As New DataTable
+
+
+ If ObjOS.GetOrdenesServicioDevolucionMaterial(CveOS, CveVenta, UsuarioActual.CveEmpresa) Then
+ DTTemp = ObjOS.DtResultados
+ GvSolicitarDevolucion.DataSource = DTTemp
+ End If
+
+ ObjOS.Dispose()
+ GvSolicitarDevolucion.DataBind()
+
+ Dim EsDevolucionVenta As Boolean = (DTTemp.FiltroPrimeroValor("EsDevolucionVenta", "").ToEntero > 0)
+
+ RegistraScript("$('#DVModalSolicitarDevolucion').modal();")
+
+ If EsDevolucionVenta Then
+ Alert("Ya existe una solicitud de devolución", TipoMensaje.MsgAdvertencia)
+ LnkModalSolicitarDevolucion.Visible = False
+ End If
+
+ UpModalSolicitarDevolucion.Update()
+
+ End Sub
+
+ Protected Sub GvSolicitarDevolucion_RowDataBound(sender As Object, e As GridViewRowEventArgs)
+
+ If e.Row.RowType = DataControlRowType.DataRow Then
+ e.Row.FCTextBox("TxtDev").Attributes.Add("onblur", String.Format("ValidarCantidad(this, {0})", e.Row.DataKey("Cantidad")))
+ End If
+ End Sub
+
+ Protected Sub LnkModalSolicitarDevolucion_Click(sender As Object, e As EventArgs)
+
+ Dim PropcesoOK As Boolean = True
+ Dim ObjV As New ClsVentas
+ ObjV.IniciaTransacSQL()
+
+ If Not ObjV.UpdateVentasDevolucionAlmacen(1, CveVenta) Then
+ PropcesoOK = False
+ End If
+
+ If PropcesoOK Then
+ For Each GvRow As GridViewRow In GvSolicitarDevolucion.Rows
+
+ Dim CveVentaDetalle As Integer = GvRow.DataKey("CveVentaDetalle").ToEntero
+ Dim CantidadDev As Decimal = GvRow.FCTextBox("TxtDev").Text.ToDecimal
+
+ If CantidadDev > 0 Then
+ If Not ObjV.UpdateVentasDetalleCantidadDevolucion(CveVentaDetalle, CantidadDev) Then
+ PropcesoOK = False
+ Exit For
+ End If
+ End If
+
+ Next
+ End If
+
+
+ If PropcesoOK Then
+ 'ObjV.RollBack()
+ ObjV.Commit()
+ Alert("La solicitud de Devolución de Almacén se guardó correctamente")
+ RegistraScript("$('#DVModalSolicitarDevolucion').modal('hide');")
+ Else
+ ObjV.RollBack()
+ End If
+
+
+
+ ObjV.Dispose()
+
+ End Sub
+
End Class
\ No newline at end of file
diff --git a/Ventas/Ventas.aspx.vb b/Ventas/Ventas.aspx.vb
index 25e522fb5..747a7d7e9 100644
--- a/Ventas/Ventas.aspx.vb
+++ b/Ventas/Ventas.aspx.vb
@@ -13145,6 +13145,11 @@ Partial Class Ventas
End If
End If
+
+ If UsuarioActual.CveEmpresa.Contiene(186) AndAlso EsVentaMedica AndAlso RBLTipoVenta.SelectedValue.ToEntero <> 2 Then
+ CveAlmacenTraspasoDestino = 1031 'FIXME OIC 2023-12-12 Por definir almacen
+ End If
+
Dim TotalImpuestoLocal As Double = 0
If GvImpuestosLocales2.Rows.Count > 0 Then
For Each gvr As GridViewRow In GvImpuestosLocales2.Rows