-- 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,57 +2980,55 @@ 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)
|
||||
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
|
||||
Case 3 ' por el momento ya no se usa
|
||||
Opcion = 2
|
||||
Case 5 ' consignacion uso
|
||||
Opcion = 3
|
||||
Case 6 ' a vista uso de material
|
||||
Opcion = 4
|
||||
Case Else
|
||||
Opcion = 1
|
||||
End Select
|
||||
|
||||
Select Case DdlTipoVenta.SelectedValue.ToEntero
|
||||
Case 1, 2 ' *Fuera de liena *pago directo
|
||||
Opcion = 1
|
||||
Case 3 ' por el momento ya no se usa
|
||||
Opcion = 2
|
||||
Case 5 ' consignacion uso
|
||||
Opcion = 3
|
||||
Case 6 ' a vista uso de material
|
||||
Opcion = 4
|
||||
Case Else
|
||||
Opcion = 1
|
||||
End Select
|
||||
Dim ObjOS As New ClsOS
|
||||
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") <> ""
|
||||
GvMU.Columns(4).Visible = DTSolicitudDev.MIN("Lote") <> ""
|
||||
GvMU.Columns(5).Visible = DTSolicitudDev.MIN("FechaCaducidad") <> ""
|
||||
End If
|
||||
ObjOS.Dispose()
|
||||
GvMU.DataBind()
|
||||
|
||||
Dim ObjOS As New ClsOS
|
||||
If ObjOS.GetOrdenesServicioDevolucionMaterial(CveOS, If(UsuarioActual.Empresa.Funcionalidad(578).ToEntero = 1, CvePedido, CveVenta), Opcion, UsuarioActual.CveEmpresa) Then
|
||||
DTSolicitudDev = ObjOS.DtResultados
|
||||
GvMU.DataSource = DTSolicitudDev
|
||||
GvMU.Columns(3).Visible = DTSolicitudDev.MIN("Serie") <> ""
|
||||
GvMU.Columns(4).Visible = DTSolicitudDev.MIN("Lote") <> ""
|
||||
GvMU.Columns(5).Visible = DTSolicitudDev.MIN("FechaCaducidad") <> ""
|
||||
End If
|
||||
ObjOS.Dispose()
|
||||
GvMU.DataBind()
|
||||
Dim EsDevolucionVenta As Boolean = (DTSolicitudDev.FiltroPrimeroValor("EsDevolucionVenta", "").ToEntero > 0)
|
||||
|
||||
Dim EsDevolucionVenta As Boolean = (DTSolicitudDev.FiltroPrimeroValor("EsDevolucionVenta", "").ToEntero > 0)
|
||||
RegistraScript("$('#DivModalMaterialUtilizado').modal();")
|
||||
|
||||
RegistraScript("$('#DivModalMaterialUtilizado').modal();")
|
||||
If EsDevolucionVenta Then
|
||||
Alert("En la orden de servicio ya se determinó el material utilizado.", TipoMensaje.MsgAdvertencia)
|
||||
LnkModalMaterialUtilizado.Visible = False
|
||||
End If
|
||||
|
||||
If EsDevolucionVenta Then
|
||||
Alert("En la orden de servicio ya se determinó el material utilizado.", TipoMensaje.MsgAdvertencia)
|
||||
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
|
||||
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,350 +3059,349 @@ 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
|
||||
For Each fileItem As Archivo In Filesgral
|
||||
TieneArchivos = True
|
||||
Exit For
|
||||
Next
|
||||
If Not TieneArchivos Then
|
||||
Alert("Debe de agregar un documento de confirmación (5 máximo).")
|
||||
Exit Sub
|
||||
End If
|
||||
Dim TieneArchivos As Boolean = False
|
||||
Dim Filesgral As List(Of Archivo) = AnexoManerialUtilizado.getfiles().Archivos
|
||||
For Each fileItem As Archivo In Filesgral
|
||||
TieneArchivos = True
|
||||
Exit For
|
||||
Next
|
||||
If Not TieneArchivos Then
|
||||
Alert("Debe de agregar un documento de confirmación (5 máximo).")
|
||||
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 TotalSeleccionado = 0 Then
|
||||
Alert("No se seleccionó ningun material", TipoMensaje.MsgAdvertencia)
|
||||
Exit Sub
|
||||
End If
|
||||
Else
|
||||
|
||||
If Not CveAlmacenDestino > 0 Then
|
||||
Alert("No se encontró almacen de entrega por adelantado", TipoMensaje.MsgAdvertencia)
|
||||
Exit Sub
|
||||
End If
|
||||
End If
|
||||
|
||||
|
||||
Dim ObjV As New ClsVentas
|
||||
Dim ObjOS As New ClsOS(ObjV.IniciaTransacSQL())
|
||||
Dim ObjInventario As New ClsInventarios(ObjV.IniciaTransacSQL())
|
||||
Dim ObjConta As New ClsContabilidad(ObjV.IniciaTransacSQL())
|
||||
Dim GenerarRemisionMovimientos As Boolean = False
|
||||
|
||||
If DdlTipoVenta.SelectedValue = "5" Then 'Consignación - Uso Material
|
||||
'genera una salida de almacen.
|
||||
Dim Fecha As DateTime = ClsPaginas.NowADS()
|
||||
Dim CveMovimientoSalida As Integer = ObjInventario.AddMovimiento(CveAlmacenActual, 8, CveMoneda, Fecha, -1, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, -1, CveVenta, CveSubProyectoPedido, -1, CveOS:=CveOS, CveAlmacenDestino:=CveAlmacenDestino, Modulo:="OS/MatUtilConsig")
|
||||
Dim Folio As Integer = ObjInventario.Folio
|
||||
|
||||
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 = 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
|
||||
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
|
||||
End If
|
||||
If ProcesoOK Then
|
||||
Dim Contabilizable As Boolean = False
|
||||
Dim Concepto As String = "Material utilizado Consigna"
|
||||
Dim CvePrePoliza As Integer = ObjConta.AddPrePolizas("OS-MatUtil5", 53, 0, 0, 1, Fecha, Concepto, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa)
|
||||
Dim ImporteAlmacen As Decimal = 0
|
||||
If CveMovimientoSalida > 0 Then
|
||||
If ObjInventario.GetMovimientosDetalle(CveMovimientoSalida, UsuarioActual.CveEmpresa) AndAlso ObjInventario.DtResultados.Rows.Count > 0 Then
|
||||
ImporteAlmacen = ObjInventario.DtResultados.SUM("Total")
|
||||
End If
|
||||
If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, True, ImporteAlmacen, ImporteAlmacen, 68, "", Concepto, CveMovimientoAlmacen:=CveMovimientoSalida, Contabilizable:=Contabilizable) Then
|
||||
ProcesoOK = False
|
||||
End If
|
||||
If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, False, ImporteAlmacen, ImporteAlmacen, 95, "", Concepto, CveMovimientoAlmacen:=CveMovimientoSalida, Contabilizable:=Contabilizable) Then
|
||||
ProcesoOK = False
|
||||
End If
|
||||
End If
|
||||
If DdlTipoVenta.SelectedValue = "5" Then
|
||||
If TotalSeleccionado = 0 Then
|
||||
Alert("No se seleccionó ningun material", TipoMensaje.MsgAdvertencia)
|
||||
Exit Sub
|
||||
End If
|
||||
Else
|
||||
ProcesoOK = False
|
||||
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
|
||||
|
||||
Dim DT_Ventas_Detalles As DataTable = DTSolicitudDev.FiltraParametros("", "", {"CantidadPedido", "CvePS", "CveVentaDetalle"})
|
||||
DT_Ventas_Detalles.Columns.Add("CantidadUsada", GetType(Decimal))
|
||||
DT_Ventas_Detalles.AcceptChanges()
|
||||
'---------------- FIN VALIDACIONES -----------------
|
||||
|
||||
For Each dRow As DataRow In DT_Ventas_Detalles.Rows
|
||||
Dim CveAlmacenActual As Integer = DTSolicitudDev.FiltroPrimeroValor("CveAlmacenActual").ToEntero
|
||||
Dim CveMoneda As Integer = DTSolicitudDev.FiltroPrimeroValor("CveMoneda").ToEntero
|
||||
|
||||
For Each gvRow As GridViewRow In GvMU.Rows
|
||||
Dim CveVentaPedido As Integer = DTSolicitudDev.FiltroPrimeroValor("CveVenta").ToEntero
|
||||
Dim CveVentaRemisionGenerada As Integer = -1
|
||||
|
||||
Dim CantidadUsada As Decimal = gvRow.FCTextBox("TxtUtilizado").Text.ToDecimal
|
||||
Dim ObjV As New ClsVentas
|
||||
Dim ObjOS As New ClsOS(ObjV.IniciaTransacSQL())
|
||||
Dim ObjInventario As New ClsInventarios(ObjV.IniciaTransacSQL())
|
||||
Dim ObjConta As New ClsContabilidad(ObjV.IniciaTransacSQL())
|
||||
Dim GenerarRemisionMovimientos As Boolean = False
|
||||
|
||||
If dRow("CvePS").ToString.ToDecimal = gvRow.DataKey("CvePS").ToDecimal AndAlso CantidadUsada > 0 Then
|
||||
If DdlTipoVenta.SelectedValue = "5" Then 'Consignación - Uso Material
|
||||
'genera una salida de almacen.
|
||||
Dim Fecha As DateTime = ClsPaginas.NowADS()
|
||||
Dim CveMovimientoSalida As Integer = ObjInventario.AddMovimiento(CveAlmacenActual, 8, CveMoneda, Fecha, -1, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, -1, CveVenta, CveSubProyectoPedido, -1, CveOS:=CveOS, CveAlmacenDestino:=CveAlmacenDestino, Modulo:="OS/MatUtilConsig")
|
||||
Dim Folio As Integer = ObjInventario.Folio
|
||||
|
||||
dRow("CantidadUsada") = dRow("CantidadUsada").ToString.ToDecimal + CantidadUsada
|
||||
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
|
||||
|
||||
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
|
||||
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
|
||||
|
||||
If CantidadDev > 0 AndAlso CveVentaDetalle > 0 Then
|
||||
AplicaDevolucion = True
|
||||
If Not ObjV.UpdateVentasDetalleCantidadDevolucion(CveVentaDetalle, CantidadDev) Then
|
||||
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
|
||||
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
|
||||
GenerarRemisionMovimientos = False
|
||||
AplicaDevolucion = False
|
||||
Exit For
|
||||
End If
|
||||
End If
|
||||
|
||||
If GvRow.FCTextBox("TxtUtilizado").Text.ToDecimal > 0 Then
|
||||
GenerarRemisionMovimientos = True
|
||||
End If
|
||||
Next
|
||||
If AplicaDevolucion Then
|
||||
If Not ObjV.UpdateVentasDevolucionAlmacen(1, CveVentaPedido) Then
|
||||
ProcesoOK = False
|
||||
End If
|
||||
End If
|
||||
End If
|
||||
|
||||
'ProcesoOK = False
|
||||
|
||||
Dim Respuesta As New RespuestaFacturacion()
|
||||
Dim DtVentaDetalle As New DataTable
|
||||
Dim CveMovimientoSalida, CveMovimientoEntrada As Integer
|
||||
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())
|
||||
|
||||
If Respuesta.CveVenta > 0 Then
|
||||
|
||||
CveVentaRemisionGenerada = Respuesta.CveVenta
|
||||
If ObjV.GetVentaDetalle(Respuesta.CveVenta) Then
|
||||
Dim dtClon As DataTable = ObjV.DtResultados.Copy
|
||||
dtClon.DefaultView.Sort = "CveVentaDetalle ASC"
|
||||
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")
|
||||
DtVentaDetalle.Rows(i)("CveUM") = dtmat.Rows(i)("CveUM")
|
||||
If ProcesoOK Then
|
||||
Dim Contabilizable As Boolean = False
|
||||
Dim Concepto As String = "Material utilizado Consigna"
|
||||
Dim CvePrePoliza As Integer = ObjConta.AddPrePolizas("OS-MatUtil5", 53, 0, 0, 1, Fecha, Concepto, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa)
|
||||
Dim ImporteAlmacen As Decimal = 0
|
||||
If CveMovimientoSalida > 0 Then
|
||||
If ObjInventario.GetMovimientosDetalle(CveMovimientoSalida, UsuarioActual.CveEmpresa) AndAlso ObjInventario.DtResultados.Rows.Count > 0 Then
|
||||
ImporteAlmacen = ObjInventario.DtResultados.SUM("Total")
|
||||
End If
|
||||
Next
|
||||
If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, True, ImporteAlmacen, ImporteAlmacen, 68, "", Concepto, CveMovimientoAlmacen:=CveMovimientoSalida, Contabilizable:=Contabilizable) Then
|
||||
ProcesoOK = False
|
||||
End If
|
||||
If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, False, ImporteAlmacen, ImporteAlmacen, 95, "", Concepto, CveMovimientoAlmacen:=CveMovimientoSalida, Contabilizable:=Contabilizable) Then
|
||||
ProcesoOK = False
|
||||
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
|
||||
End If
|
||||
|
||||
If GenerarRemisionMovimientos AndAlso ProcesoOK Then
|
||||
Dim DT_Ventas_Detalles As DataTable = DTSolicitudDev.FiltraParametros("", "", {"CantidadPedido", "CvePS", "CveVentaDetalle"})
|
||||
DT_Ventas_Detalles.Columns.Add("CantidadUsada", GetType(Decimal))
|
||||
DT_Ventas_Detalles.AcceptChanges()
|
||||
|
||||
CveMovimientoSalida = ObjInventario.AddMovimiento(CveAlmacenActual, 8, CveMoneda, Fecha, -1, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, -1, Respuesta.CveVenta, CveSubProyectoPedido, -1, CveOS:=CveOS, CveAlmacenDestino:=CveAlmacenDestino, Modulo:="OS/MatUtil3")
|
||||
Dim Folio As Integer = ObjInventario.Folio
|
||||
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
|
||||
|
||||
If CveMovimientoSalida > 0 Then
|
||||
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
|
||||
'' otros opciones <> 5
|
||||
If ProcesoOK Then
|
||||
|
||||
Dim IndexMov1 As Integer = 0
|
||||
For Each drr As DataRow In DtVentaDetalle.Rows
|
||||
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)
|
||||
|
||||
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 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)
|
||||
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
|
||||
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)
|
||||
If CantidadDev > 0 AndAlso CveVentaDetalle > 0 Then
|
||||
AplicaDevolucion = True
|
||||
If Not ObjV.UpdateVentasDetalleCantidadDevolucion(CveVentaDetalle, CantidadDev) Then
|
||||
ProcesoOK = False
|
||||
GenerarRemisionMovimientos = False
|
||||
AplicaDevolucion = False
|
||||
Exit For
|
||||
End If
|
||||
End If
|
||||
IndexMov1 = IndexMov1 + 1
|
||||
If GvRow.FCTextBox("TxtUtilizado").Text.ToDecimal > 0 Then
|
||||
GenerarRemisionMovimientos = True
|
||||
End If
|
||||
Next
|
||||
If AplicaDevolucion Then
|
||||
If Not ObjV.UpdateVentasDevolucionAlmacen(1, CveVentaPedido) Then
|
||||
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
|
||||
|
||||
If ProcesoOK Then
|
||||
Dim Respuesta As New RespuestaFacturacion()
|
||||
Dim DtVentaDetalle As New DataTable
|
||||
Dim CveMovimientoSalida, CveMovimientoEntrada As Integer
|
||||
Dim ImporteAlmacen As Decimal
|
||||
Dim Fecha As DateTime = ClsPaginas.NowADS()
|
||||
|
||||
CveMovimientoEntrada = ObjInventario.AddMovimiento(CveAlmacenDestino, 9, CveMoneda, Fecha, -1, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, -1, Respuesta.CveVenta, CveSubProyectoPedido, -1, CveOS:=CveOS, CveMovimientoRelacionado:=CveMovimientoSalida, Modulo:="OS/MatUtil2")
|
||||
If GenerarRemisionMovimientos AndAlso ProcesoOK Then
|
||||
Respuesta = GeneraRemision(CveVentaPedido, ObjV.IniciaTransacSQL())
|
||||
|
||||
If ObjInventario.GetMovimientosDetalle(CveMovimientoSalida, UsuarioActual.CveEmpresa) AndAlso ObjInventario.DtResultados.Rows.Count > 0 Then
|
||||
ImporteAlmacen = ObjInventario.DtResultados.SUM("Total")
|
||||
Dim IndexMov2 As Integer = 0
|
||||
For Each dRow As DataRow In ObjInventario.DtResultados.Rows
|
||||
If Respuesta.CveVenta > 0 Then
|
||||
|
||||
Dim Cantidad As Decimal = dRow("Cantidad").ToString.ToDecimal
|
||||
Dim CvePS As Integer = dRow("CvePS").ToString.ToEntero
|
||||
Dim CveUM As Integer = dRow("CveUM").ToString.ToEntero
|
||||
Dim PU As Decimal = dRow("PU").ToString.ToDecimal
|
||||
Dim CveVentaDetalle As Integer = dRow("CveVentaDetalle").ToString.ToEntero
|
||||
Dim CveMovimientoDetalle As Integer = dRow("CveMovimientoDetalle").ToString.ToEntero
|
||||
CveVentaRemisionGenerada = Respuesta.CveVenta
|
||||
If ObjV.GetVentaDetalle(Respuesta.CveVenta) Then
|
||||
Dim dtClon As DataTable = ObjV.DtResultados.Copy
|
||||
dtClon.DefaultView.Sort = "CveVentaDetalle ASC"
|
||||
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")
|
||||
DtVentaDetalle.Rows(i)("CveUM") = dtmat.Rows(i)("CveUM")
|
||||
End If
|
||||
Next
|
||||
End If
|
||||
Else
|
||||
ProcesoOK = False
|
||||
End If
|
||||
End If
|
||||
|
||||
Dim Lote As String = dRow("Lote").ToString
|
||||
Dim Serie As String = dRow("Serie").ToString
|
||||
Dim FechaCaducidad As DateTime = dRow("FechaCaducidad").ToString.ToDateTime
|
||||
If GenerarRemisionMovimientos AndAlso ProcesoOK Then
|
||||
|
||||
If Not ObjInventario.AddMovimientoDetalle(CveMovimientoEntrada, Cantidad, CveUM, CvePS, PU, CveVentaDetalle:=CveVentaDetalle, CveMovimientoDetalleEntrada:=CveMovimientoDetalle, Lote:=Lote, Serie:=Serie, FechaCaducidad:=FechaCaducidad) Then
|
||||
CveMovimientoSalida = ObjInventario.AddMovimiento(CveAlmacenActual, 8, CveMoneda, Fecha, -1, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, -1, Respuesta.CveVenta, CveSubProyectoPedido, -1, CveOS:=CveOS, CveAlmacenDestino:=CveAlmacenDestino, Modulo:="OS/MatUtil3")
|
||||
Dim Folio As Integer = ObjInventario.Folio
|
||||
|
||||
If CveMovimientoSalida > 0 Then
|
||||
|
||||
Dim IndexMov1 As Integer = 0
|
||||
For Each drr As DataRow In DtVentaDetalle.Rows
|
||||
|
||||
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 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)
|
||||
ProcesoOK = False
|
||||
Exit For
|
||||
End If
|
||||
IndexMov2 = IndexMov2 + 1
|
||||
Next
|
||||
If ProcesoOK Then
|
||||
Dim ObjEventos As New ClsOIEventos(ObjInventario.IniciaTransacSQL)
|
||||
Dim LigaVenta As String = String.Format("Venta {2} en Folio: <a href=""/Inventarios/EntradasSalidas.aspx?CveMovimiento={0}"" target=""_blank"">{1}</a>", CveMovimientoEntrada, Folio, "Material utilizado")
|
||||
Dim Serie As String = drr("Serie").ToString
|
||||
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
|
||||
End If
|
||||
End If
|
||||
IndexMov1 = IndexMov1 + 1
|
||||
Next
|
||||
|
||||
If Not ObjEventos.AddEventoBitacora(LigaVenta, "-1", UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, CveVenta:=Respuesta.CveVenta, CveOS:=CveOS) Then
|
||||
If ProcesoOK Then
|
||||
|
||||
CveMovimientoEntrada = ObjInventario.AddMovimiento(CveAlmacenDestino, 9, CveMoneda, Fecha, -1, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, -1, Respuesta.CveVenta, CveSubProyectoPedido, -1, CveOS:=CveOS, CveMovimientoRelacionado:=CveMovimientoSalida, Modulo:="OS/MatUtil2")
|
||||
|
||||
If ObjInventario.GetMovimientosDetalle(CveMovimientoSalida, UsuarioActual.CveEmpresa) AndAlso ObjInventario.DtResultados.Rows.Count > 0 Then
|
||||
ImporteAlmacen = ObjInventario.DtResultados.SUM("Total")
|
||||
Dim IndexMov2 As Integer = 0
|
||||
For Each dRow As DataRow In ObjInventario.DtResultados.Rows
|
||||
|
||||
Dim Cantidad As Decimal = dRow("Cantidad").ToString.ToDecimal
|
||||
Dim CvePS As Integer = dRow("CvePS").ToString.ToEntero
|
||||
Dim CveUM As Integer = dRow("CveUM").ToString.ToEntero
|
||||
Dim PU As Decimal = dRow("PU").ToString.ToDecimal
|
||||
Dim CveVentaDetalle As Integer = dRow("CveVentaDetalle").ToString.ToEntero
|
||||
Dim CveMovimientoDetalle As Integer = dRow("CveMovimientoDetalle").ToString.ToEntero
|
||||
|
||||
Dim Lote As String = dRow("Lote").ToString
|
||||
Dim Serie As String = dRow("Serie").ToString
|
||||
Dim FechaCaducidad As DateTime = dRow("FechaCaducidad").ToString.ToDateTime
|
||||
|
||||
If Not ObjInventario.AddMovimientoDetalle(CveMovimientoEntrada, 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
|
||||
End If
|
||||
IndexMov2 = IndexMov2 + 1
|
||||
Next
|
||||
If ProcesoOK Then
|
||||
Dim ObjEventos As New ClsOIEventos(ObjInventario.IniciaTransacSQL)
|
||||
Dim LigaVenta As String = String.Format("Venta {2} en Folio: <a href=""/Inventarios/EntradasSalidas.aspx?CveMovimiento={0}"" target=""_blank"">{1}</a>", CveMovimientoEntrada, Folio, "Material utilizado")
|
||||
|
||||
If Not ObjEventos.AddEventoBitacora(LigaVenta, "-1", UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, CveVenta:=Respuesta.CveVenta, CveOS:=CveOS) Then
|
||||
ProcesoOK = False
|
||||
End If
|
||||
End If
|
||||
Else
|
||||
ProcesoOK = False
|
||||
End If
|
||||
End If
|
||||
|
||||
If ProcesoOK Then
|
||||
Dim Contabilizable As Boolean = False
|
||||
Dim Concepto As String = "Material utilizado"
|
||||
Dim CvePrePoliza As Integer = ObjConta.AddPrePolizas("OS-MatUtil", 53, 0, 0, 1, Fecha, Concepto, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa)
|
||||
If CveMovimientoSalida > 0 Then
|
||||
If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, True, ImporteAlmacen, ImporteAlmacen, 68, "", Concepto, CveMovimientoAlmacen:=CveMovimientoSalida, Contabilizable:=Contabilizable) Then
|
||||
ProcesoOK = False
|
||||
End If
|
||||
End If
|
||||
Else
|
||||
If CveMovimientoEntrada > 0 Then
|
||||
If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, False, ImporteAlmacen, ImporteAlmacen, 68, "", Concepto, CveMovimientoAlmacen:=CveMovimientoEntrada, Contabilizable:=Contabilizable) Then
|
||||
ProcesoOK = False
|
||||
End If
|
||||
End If
|
||||
End If
|
||||
Else
|
||||
ProcesoOK = False
|
||||
End If
|
||||
If ProcesoOK Then
|
||||
If Not ObjOS.UpdateVentaOS(Respuesta.CveVenta, CveOS, UsuarioActual.CveEmpresa, TxtPacienteModal.Text.Trim, TxtEpisodioModal.Text.Trim, FolioAdicional:=TxtFolioRemisionModal.Text.Trim) Then
|
||||
ProcesoOK = False
|
||||
End If
|
||||
End If
|
||||
|
||||
If ProcesoOK Then
|
||||
Dim Contabilizable As Boolean = False
|
||||
Dim Concepto As String = "Material utilizado"
|
||||
Dim CvePrePoliza As Integer = ObjConta.AddPrePolizas("OS-MatUtil", 53, 0, 0, 1, Fecha, Concepto, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa)
|
||||
If CveMovimientoSalida > 0 Then
|
||||
If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, True, ImporteAlmacen, ImporteAlmacen, 68, "", Concepto, CveMovimientoAlmacen:=CveMovimientoSalida, Contabilizable:=Contabilizable) Then
|
||||
ProcesoOK = False
|
||||
End If
|
||||
End If
|
||||
If CveMovimientoEntrada > 0 Then
|
||||
If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, False, ImporteAlmacen, ImporteAlmacen, 68, "", Concepto, CveMovimientoAlmacen:=CveMovimientoEntrada, Contabilizable:=Contabilizable) Then
|
||||
ProcesoOK = False
|
||||
End If
|
||||
End If
|
||||
|
||||
End If
|
||||
Else
|
||||
ProcesoOK = False
|
||||
End If
|
||||
If ProcesoOK Then
|
||||
If Not ObjOS.UpdateVentaOS(Respuesta.CveVenta, CveOS, UsuarioActual.CveEmpresa, TxtPacienteModal.Text.Trim, TxtEpisodioModal.Text.Trim, FolioAdicional:=TxtFolioRemisionModal.Text.Trim) Then
|
||||
If Not ObjOS.UpdateOrdenesServiciosFinaliza(CveOS, -1, -1, UsuarioActual.CveEmpresa, Observaciones:=TxtObservacionModal.Text.Trim) Then
|
||||
ProcesoOK = False
|
||||
End If
|
||||
End If
|
||||
End If
|
||||
|
||||
If ProcesoOK Then
|
||||
If Not ObjOS.UpdateOrdenesServiciosFinaliza(CveOS, -1, -1, UsuarioActual.CveEmpresa, Observaciones:=TxtObservacionModal.Text.Trim) Then
|
||||
If Not ObjOS.UpdateVentaOS(-1, CveOS, UsuarioActual.CveEmpresa, TxtPacienteModal.Text.Trim, TxtEpisodioModal.Text.Trim) Then
|
||||
ProcesoOK = False
|
||||
End If
|
||||
End If
|
||||
End If
|
||||
|
||||
|
||||
If ProcesoOK Then
|
||||
If Not ObjOS.UpdateVentaOS(-1, CveOS, UsuarioActual.CveEmpresa, TxtPacienteModal.Text.Trim, TxtEpisodioModal.Text.Trim) Then
|
||||
ProcesoOK = False
|
||||
If ProcesoOK Then
|
||||
ProcesoOK = GuardarArchivoConfirmacion(ObjV.IniciaTransacSQL, CveOS, CveVentaRemisionGenerada)
|
||||
End If
|
||||
End If
|
||||
|
||||
If ProcesoOK Then
|
||||
ProcesoOK = GuardarArchivoConfirmacion(ObjV.IniciaTransacSQL, CveOS, CveVentaRemisionGenerada)
|
||||
End If
|
||||
If ProcesoOK Then
|
||||
|
||||
If ProcesoOK Then
|
||||
|
||||
ObjV.Commit()
|
||||
If DdlTipoVenta.SelectedValue.ToEntero = 5 Then
|
||||
Dim Liga As String = $" document.location.href=""/OS/OrdenesServicios.aspx?CveOS={CveOS}""; "
|
||||
Alert("El material utilizado se guardó correctamente", TipoMensaje.MsgInformacion, Liga)
|
||||
Else
|
||||
If GenerarRemisionMovimientos = False Then
|
||||
Alert("El material sera recibido en almacén.")
|
||||
ObjV.Commit()
|
||||
If DdlTipoVenta.SelectedValue.ToEntero = 5 Then
|
||||
Dim Liga As String = $" document.location.href=""/OS/OrdenesServicios.aspx?CveOS={CveOS}""; "
|
||||
Alert("El material utilizado se guardó correctamente", TipoMensaje.MsgInformacion, Liga)
|
||||
Else
|
||||
Alert("El material utilizado se guardó correctamente")
|
||||
If GenerarRemisionMovimientos = False Then
|
||||
Alert("El material sera recibido en almacén.")
|
||||
Else
|
||||
Alert("El material utilizado se guardó correctamente")
|
||||
End If
|
||||
End If
|
||||
|
||||
RegistraScript("$('#DivModalMaterialUtilizado').modal('hide');")
|
||||
CargaEventoBitacora()
|
||||
Else
|
||||
ObjV.RollBack()
|
||||
Alert("Se presento un error al guardar el material", TipoMensaje.MsgAdvertencia)
|
||||
End If
|
||||
|
||||
RegistraScript("$('#DivModalMaterialUtilizado').modal('hide');")
|
||||
CargaEventoBitacora()
|
||||
Else
|
||||
ObjV.RollBack()
|
||||
Alert("Se presento un error al guardar el material", TipoMensaje.MsgAdvertencia)
|
||||
ObjV.Dispose()
|
||||
End If
|
||||
|
||||
ObjV.Dispose()
|
||||
|
||||
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