-
+
Cant.
@@ -1288,7 +1288,7 @@
- Dev
+ Utilizado
@@ -1300,37 +1300,22 @@
-
-
- Lote
-
-
-
-
-
Serie
-
+
+
+
+
+ Lote
+
+
-
Fecha Cad.
-
- <%-- --%>
+
@@ -1346,8 +1331,8 @@
diff --git a/OS/OrdenesServicios.aspx.vb b/OS/OrdenesServicios.aspx.vb
index 08b091a33..c6b9bed20 100644
--- a/OS/OrdenesServicios.aspx.vb
+++ b/OS/OrdenesServicios.aspx.vb
@@ -5,6 +5,8 @@ Imports Extensiones
Imports System.IO
Imports System.Data
Imports Telerik.Web.UI
+Imports System.Data.SqlClient
+Imports Stimulsoft.Report.StiOptions.Export
Partial Class OS_OrdenesServicios
Inherits ClsPaginas
@@ -703,8 +705,8 @@ Partial Class OS_OrdenesServicios
CargaHistorial()
- If CveVenta > 0 And TipoEstatus.Contiene(1, 2, 3) Then
- LnkAccionesDevolucion.Visible = True
+ If TipoEstatus.Contiene(1, 2, 3) Then
+ LnkAccionesMaterialUtilizado.Visible = True
End If
Else
Alert("La Orden de Servicio Solicitado no existe, por favor revise su búsqueda.", TipoMensaje.MsgAdvertencia)
@@ -837,7 +839,7 @@ Partial Class OS_OrdenesServicios
Private Sub CargaMaterialesDetalle(CveOsDetalle As Integer, Consecutivo As Integer, CveConsecutivoDetalle As Integer)
Dim ObjMateriales As New ClsOS
- If ObjMateriales.GetDetalleMateriales(CveOsDetalle, CveOS, -1) Then
+ If ObjMateriales.GetDetalleMateriales(CveOsDetalle, CveOS) Then
For Each RowE As DataRow In ObjMateriales.DtResultados.Rows
@@ -868,8 +870,8 @@ Partial Class OS_OrdenesServicios
End Sub
Private Sub CargaMateriales()
Dim objOS As New ClsOS
- Dim Opcion As Integer = If(DdlTipoVenta.SelectedValue.Contiene("2", "3"), 2, 1)
- If objOS.GetDetalleMateriales(-1, CveOS, Opcion, True) Then
+
+ If objOS.GetDetalleMateriales(-1, CveOS) Then
GvMateriales.DataSource = objOS.DtResultados
End If
objOS.Dispose()
@@ -1195,7 +1197,7 @@ Partial Class OS_OrdenesServicios
#Region "P E R M I S O S"
Private Sub PermisosSegunEstatus()
- Dim TipoEstatus = GlobalDTEstatusOrdenServicios(UsuarioActual.CveEmpresa).FiltroPrimeroValor(String.Format("TipoEstatus", "CveEstatusOrdenServicio = {0}", "CveEstatusOrdenServicio ASC", DdlEstatusOS.SelectedValue.ToEntero))
+ Dim TipoEstatus As String = GlobalDTEstatusOrdenServicios(UsuarioActual.CveEmpresa).FiltroPrimeroValor(String.Format("TipoEstatus", "CveEstatusOrdenServicio = {0}", "CveEstatusOrdenServicio ASC", DdlEstatusOS.SelectedValue.ToEntero))
Select Case TipoEstatus.ToEntero
Case 1
@@ -1261,7 +1263,7 @@ Partial Class OS_OrdenesServicios
Dim Errores As Boolean = False
Dim EstatusOrdenServicio As Integer = GlobalDTEstatusOrdenServicios(UsuarioActual.CveEmpresa).FiltroPrimeroValor("CveEstatusOrdenServicio", "TipoEstatus = 1").ToEntero
- Dim DirectorioEmpresa = UsuarioActual.Empresa.Ruta
+ Dim DirectorioEmpresa As String = UsuarioActual.Empresa.Ruta
If Not CveOS > 0 Then
@@ -1357,8 +1359,7 @@ Partial Class OS_OrdenesServicios
MensajeAlert.AppendFormat(String.Format("
La Orden de Servicio:
{0} se generó correctamente.
", ObjOrdenServicio.Folio))
MensajeAlert.AppendFormat("
", Encripta(String.Format("OP=OS&CVEOS={0}", ObjOrdenServicio.CveOS)))
-
- Dim Liga = $"document.location.href=""/OS/RepOrdenesServicios.aspx"";"
+ Dim Liga As String = $"document.location.href=""/OS/RepOrdenesServicios.aspx"";"
ObjOrdenServicio.Commit()
@@ -1606,7 +1607,7 @@ Partial Class OS_OrdenesServicios
Protected Sub imgEstatus_Click(sender As Object, e As EventArgs)
Dim Row As GridViewRow = DirectCast(DirectCast(sender, Control).NamingContainer, GridViewRow)
- Dim Estatus = TmpDT(Row.RowIndex)("Estatus").ToString
+ Dim Estatus As String = TmpDT(Row.RowIndex)("Estatus").ToString
If Estatus = "False" Then
TmpDT.Rows(Row.RowIndex)("Estatus") = "True"
@@ -1619,7 +1620,7 @@ Partial Class OS_OrdenesServicios
End Sub
Private Sub BtnAddGvDetalle_Click(sender As Object, e As EventArgs) Handles BtnAddGvDetalle.Click
Dim ObjOS As New ClsOS
- Dim TieneError = False
+ Dim TieneError As Boolean = False
If CveCliente > 0 Then
If DdlPSDetalle.SelectedValue.ToEntero > 0 Then
@@ -2975,7 +2976,7 @@ Partial Class OS_OrdenesServicios
End Sub
Private Sub BtnCambiarTecnico_Click(sender As Object, e As EventArgs) Handles BtnCambiarTecnico.Click
Dim ObjOS As New ClsOS
- Dim TieneError = False
+ Dim TieneError As Boolean = False
If UsuarioActual.Empresa.Funcionalidad(151).ToString = "1" Then
If Not ObjOS.UpdateTecnicoOS(DdlTecnico.SelectedValue.ToEntero, CveOS) Then
@@ -3040,87 +3041,56 @@ Partial Class OS_OrdenesServicios
Alert("Orden Finalizada Correctamente", TipoMensaje.MsgInformacion, "location.reload(true);")
RegistraScript("$('#DVModalFinalizarOrden').modal('hide');")
End If
-
-
End Sub
- Protected Sub LnkAccionesDevolucion_Click(sender As Object, e As EventArgs)
+ Protected Sub LnkAccionesMaterialUtilizado_Click(sender As Object, e As EventArgs)
- LnkModalSolicitarDevolucion.Visible = True
-
- GvSolicitarDevolucion.DataSource = Nothing
+ LnkModalMaterialUtilizado.Visible = True
+ GvMaterialUtilizado.DataSource = Nothing
DTSolicitudDev = New DataTable
-
- GvSolicitarDevolucion.Columns(3).Visible = False 'Lote
- GvSolicitarDevolucion.Columns(4).Visible = False 'Serie
- GvSolicitarDevolucion.Columns(5).Visible = False 'Fecha Caducidad
-
+ Dim Opcion As Integer = If(DdlTipoVenta.SelectedValue.Contiene("2", "3"), 2, 1)
Dim ObjOS As New ClsOS
-
- If ObjOS.GetOrdenesServicioDevolucionMaterial(CveOS, CveVenta, UsuarioActual.CveEmpresa) Then
+ If ObjOS.GetOrdenesServicioDevolucionMaterial(CveOS, CveVenta, Opcion, UsuarioActual.CveEmpresa) Then
DTSolicitudDev = ObjOS.DtResultados
- GvSolicitarDevolucion.DataSource = DTSolicitudDev
+ GvMaterialUtilizado.DataSource = DTSolicitudDev
+ GvMaterialUtilizado.Columns(3).Visible = DTSolicitudDev.MIN("Serie") <> ""
+ GvMaterialUtilizado.Columns(4).Visible = DTSolicitudDev.MIN("Lote") <> ""
+ GvMaterialUtilizado.Columns(5).Visible = DTSolicitudDev.MIN("FechaCaducidad") <> ""
End If
-
- GvSolicitarDevolucion.Columns(3).Visible = DTSolicitudDev.MAX("Lote").ToString.Trim().Length > 0
- GvSolicitarDevolucion.Columns(4).Visible = DTSolicitudDev.MAX("Serie").ToString.Trim().Length > 0
- GvSolicitarDevolucion.Columns(5).Visible = DTSolicitudDev.MAX("FechaCaducidad").ToString.Trim().Length > 0
-
-
ObjOS.Dispose()
- GvSolicitarDevolucion.DataBind()
+ GvMaterialUtilizado.DataBind()
Dim EsDevolucionVenta As Boolean = (DTSolicitudDev.FiltroPrimeroValor("EsDevolucionVenta", "").ToEntero > 0)
- RegistraScript("$('#DVModalSolicitarDevolucion').modal();")
+ RegistraScript("$('#DivModalMaterialUtilizado').modal();")
If EsDevolucionVenta Then
- Alert("Ya existe una solicitud de devolución", TipoMensaje.MsgAdvertencia)
- LnkModalSolicitarDevolucion.Visible = False
+ Alert("En la orden de servicio ya se determinó el material utilizado.", TipoMensaje.MsgAdvertencia)
+ LnkModalMaterialUtilizado.Visible = False
End If
- UpModalSolicitarDevolucion.Update()
+ UpModalMaterialUtilizado.Update()
End Sub
- Protected Sub GvSolicitarDevolucion_RowDataBound(sender As Object, e As GridViewRowEventArgs)
+ Protected Sub GvMaterialUtilizado_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")))
- 'AplicaSerie, AplicaLote, AplicaCaducidad
- 'If Boolean.Parse(e.Row.DataKey("AplicaSerie")) Then
- ' e.Row.FCTextBox("TxtSerie").Visible = True
- 'End If
-
- 'If Boolean.Parse(e.Row.DataKey("AplicaLote")) Then
- ' e.Row.FCTextBox("TxtLote").Visible = True
- 'End If
-
- 'If Boolean.Parse(e.Row.DataKey("AplicaCaducidad")) Then
-
- ' e.Row.FCHtmlGenericControl("DVFechaCaducidad").Visible = True
- ' 'e.Row.FCTextBox("TxtFechaCaducidad").Visible = True
- ' 'e.Row.FCMaskedEditExtender("METxtFechaCaducidad").Visible = True
- ' 'e.Row.FCCalendarExtender("CCTxtFechaCaducidad").Visible = True
- ' 'e.Row.FCCompareValidator("CVTxtFechaCaducidad").Visible = True
- ' 'e.Row.FCValidatorCalloutExtender("VCTxtFechaCaducidad").Visible = True
-
- 'End If
-
-
-
End If
End Sub
- Protected Sub LnkModalSolicitarDevolucion_Click(sender As Object, e As EventArgs)
+ Protected Sub LnkModalMaterialUtilizado_Click(sender As Object, e As EventArgs)
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
If Not CveAlmacenDestino > 0 Then
@@ -3129,130 +3099,139 @@ Partial Class OS_OrdenesServicios
End If
-
Dim SbErroresDev As New StringBuilder
- For Each GvRow As GridViewRow In GvSolicitarDevolucion.Rows
-
+ For Each GvRow As GridViewRow In GvMaterialUtilizado.Rows
If GvRow.DataKey("Cantidad").ToDecimal > 0 Then
Dim sbTemperror As New StringBuilder
Dim ErrorCountDev As Integer = 0
+ 'sbTemperror.Append($"Producto: {GvRow.DataKey("CodigoPS") } requiere: ")
+ 'If Boolean.Parse(GvRow.DataKey("AplicaSerie")) Then
+ ' If GvRow.FCTextBox("TxtSerie").Text.Trim = String.Empty Then
+ ' sbTemperror.Append($" Serie, ")
+ ' ErrorCountDev = ErrorCountDev + 1
+ ' End If
+ 'End If
- sbTemperror.Append($"Producto: {GvRow.DataKey("CodigoPS") } requiere: ")
-
-
- If Boolean.Parse(GvRow.DataKey("AplicaSerie")) Then
- If GvRow.FCTextBox("TxtSerie").Text.Trim = String.Empty Then
- sbTemperror.Append($" Serie, ")
- ErrorCountDev = ErrorCountDev + 1
- End If
- End If
-
- If Boolean.Parse(GvRow.DataKey("AplicaLote")) Then
- If GvRow.FCTextBox("TxtLote").Text = String.Empty Then
- sbTemperror.Append($" Lote, ")
- ErrorCountDev = ErrorCountDev + 1
- End If
- End If
-
- If Boolean.Parse(GvRow.DataKey("AplicaCaducidad")) Then
- If Not IsDate(GvRow.FCTextBox("TxtFechaCaducidad").Text) Then
- sbTemperror.Append($" Fecha de caducidad")
- ErrorCountDev = ErrorCountDev + 1
- End If
- End If
-
- If ErrorCountDev > 0 Then
- sbTemperror.Append($"
")
- SbErroresDev.AppendLine(sbTemperror.ToString)
- End If
+ 'If Boolean.Parse(GvRow.DataKey("AplicaLote")) Then
+ ' If GvRow.FCTextBox("TxtLote").Text = String.Empty Then
+ ' sbTemperror.Append($" Lote, ")
+ ' ErrorCountDev = ErrorCountDev + 1
+ ' End If
+ 'End If
+ 'If Boolean.Parse(GvRow.DataKey("AplicaCaducidad")) Then
+ ' If Not IsDate(GvRow.FCTextBox("TxtFechaCaducidad").Text) Then
+ ' sbTemperror.Append($" Fecha de caducidad")
+ ' ErrorCountDev = ErrorCountDev + 1
+ ' End If
+ 'End If
+ 'If ErrorCountDev > 0 Then
+ ' sbTemperror.Append($"
")
+ ' SbErroresDev.AppendLine(sbTemperror.ToString)
+ 'End If
End If
-
Next
+ 'If SbErroresDev.ToString.Length > 0 Then
+ ' Alert($"Se encontraron los siguientes errores:
{SbErroresDev.ToString}", TipoMensaje.MsgAdvertencia)
+ ' Exit Sub
+ 'End If
- If SbErroresDev.ToString.Length > 0 Then
- Alert($"Se encontraron los siguientes errores:
{SbErroresDev.ToString}", TipoMensaje.MsgAdvertencia)
- Exit Sub
- End If
-
- Dim PropcesoOK As Boolean = True
+ Dim ProcesoOK As Boolean = True
Dim ObjV As New ClsVentas
ObjV.IniciaTransacSQL()
If Not ObjV.UpdateVentasDevolucionAlmacen(1, CveVenta) Then
- PropcesoOK = False
+ ProcesoOK = False
End If
- If PropcesoOK Then
- For Each GvRow As GridViewRow In GvSolicitarDevolucion.Rows
+ If ProcesoOK Then
+ For Each GvRow As GridViewRow In GvMaterialUtilizado.Rows
Dim CveVentaDetalle As Integer = GvRow.DataKey("CveVentaDetalle").ToEntero
- Dim CantidadDev As Decimal = GvRow.FCTextBox("TxtDev").Text.ToDecimal
+ Dim CantidadDev As Decimal = GvRow.DataKey("Cantidad").ToDecimal - GvRow.FCTextBox("TxtDev").Text.ToDecimal
If CantidadDev > 0 Then
If Not ObjV.UpdateVentasDetalleCantidadDevolucion(CveVentaDetalle, CantidadDev) Then
- PropcesoOK = False
+ ProcesoOK = False
Exit For
End If
End If
-
Next
End If
- If PropcesoOK Then
+
+ Dim Respuesta As New RespuestaFacturacion()
+ Dim DtVentaDetalle As New DataTable
+
+ If 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()
+ End If
+ Else
+ ProcesoOK = False
+ End If
+
+ End If
+
+ If ProcesoOK Then
Dim ObjInventario As New ClsInventarios(ObjV.IniciaTransacSQL())
- Dim CveMovimiento As Integer = ObjInventario.AddMovimiento(CveAlmacenActual, 8, CveMoneda, ClsPaginas.NowADS(), -1, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, -1, CveVentaPedido, CveSubProyectoPedido, -1, CveOS:=CveOS, CveAlmacenDestino:=CveAlmacenDestino)
+ Dim CveMovimiento As Integer = ObjInventario.AddMovimiento(CveAlmacenActual, 8, CveMoneda, ClsPaginas.NowADS(), -1, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, -1, Respuesta.CveVenta, CveSubProyectoPedido, -1, CveOS:=CveOS, CveAlmacenDestino:=CveAlmacenDestino)
Dim Folio As Integer = ObjInventario.Folio
If CveMovimiento > 0 Then
- For Each GvRow As GridViewRow In GvSolicitarDevolucion.Rows
+ Dim IndexMov1 As Integer = 0
+ For Each GvRow As GridViewRow In GvMaterialUtilizado.Rows
Dim Cantidad As Decimal = GvRow.DataKey("Cantidad").ToDecimal
- Dim CantidadDev As Decimal = GvRow.FCTextBox("TxtDev").Text.ToDecimal
- Dim CantidadRegistro = Cantidad - CantidadDev
+ Dim CantidadRegistro As Decimal = GvRow.FCTextBox("TxtDev").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 CveVentaDetalle As Integer = GvRow.DataKey("CveVentaDetalle").ToEntero
+ Dim CveVentaDetalle As Integer = DtVentaDetalle.Rows(IndexMov1)("CveVentaDetalle").ToString.ToEntero
Dim CveMovimientoDetalle As Integer = GvRow.DataKey("CveMovimientoDetalle").ToEntero
- Dim Lote As String = GvRow.DataKey("Lote")
Dim Serie As String = GvRow.DataKey("Serie")
+ Dim Lote As String = GvRow.DataKey("Lote")
Dim FechaCaducidad As DateTime = GvRow.DataKey("FechaCaducidad").ToDate
-
-
If CantidadRegistro > 0 Then
If Not ObjInventario.AddMovimientoDetalle(CveMovimiento, CantidadRegistro, CveUM, CvePS, PU, CveVentaDetalle:=CveVentaDetalle, CveMovimientoDetalleEntrada:=CveMovimientoDetalle, Lote:=Lote, Serie:=Serie, FechaCaducidad:=FechaCaducidad) Then
Alert("Error al agregar detalle de movimiento.", TipoMensaje.MsgAdvertencia)
- PropcesoOK = False
+ ProcesoOK = False
Exit For
End If
End If
-
+ IndexMov1 = IndexMov1 + 1
Next
- If PropcesoOK Then
+ If ProcesoOK Then
- Dim CveMovimientoSalida As Integer = ObjInventario.AddMovimiento(CveAlmacenDestino, 9, CveMoneda, ClsPaginas.NowADS(), -1, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, -1, CveVentaPedido, CveSubProyectoPedido, -1, CveOS:=CveOS, CveMovimientoRelacionado:=CveMovimiento)
+ Dim CveMovimientoSalida As Integer = ObjInventario.AddMovimiento(CveAlmacenDestino, 9, CveMoneda, ClsPaginas.NowADS(), -1, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, -1, Respuesta.CveVenta, CveSubProyectoPedido, -1, CveOS:=CveOS, CveMovimientoRelacionado:=CveMovimiento)
If ObjInventario.GetMovimientosDetalle(CveMovimiento, UsuarioActual.CveEmpresa) AndAlso ObjInventario.DtResultados.Rows.Count > 0 Then
+ 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 CveVentaDetalle As Integer = DtVentaDetalle.Rows(IndexMov2)("CveVentaDetalle").ToString.ToEntero
Dim CveMovimientoDetalle As Integer = dRow("CveMovimientoDetalle").ToString.ToEntero
Dim Lote As String = dRow("Lote").ToString
@@ -3261,50 +3240,115 @@ Partial Class OS_OrdenesServicios
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)
- PropcesoOK = False
+ ProcesoOK = False
Exit For
End If
-
+ IndexMov2 = IndexMov2 + 1
Next
-
- If PropcesoOK Then
-
+ If ProcesoOK Then
Dim ObjEventos As New ClsOIEventos(ObjInventario.IniciaTransacSQL)
Dim LigaVenta As String = String.Format("Venta {2} en Folio:
{1}", CveMovimiento, Folio, "Material utilizado")
- If Not ObjEventos.AddEventoBitacora(LigaVenta, "-1", UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, CveVenta:=CveVentaPedido, CveOS:=CveOS) Then
- PropcesoOK = False
+ If Not ObjEventos.AddEventoBitacora(LigaVenta, "-1", UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, CveVenta:=Respuesta.CveVenta, CveOS:=CveOS) Then
+ ProcesoOK = False
End If
-
End If
-
-
Else
- PropcesoOK = False
+ ProcesoOK = False
End If
-
End If
-
- Else
- PropcesoOK = False
+ Else
+ ProcesoOK = False
End If
-
End If
- If PropcesoOK Then
- 'ObjV.RollBack()
+ If ProcesoOK Then
ObjV.Commit()
- Alert("La solicitud de Devolución de Almacén se guardó correctamente")
- RegistraScript("$('#DVModalSolicitarDevolucion').modal('hide');")
+ Alert("El material utilizado se guardó correctamente")
+ RegistraScript("$('#DivModalMaterialUtilizado').modal('hide');")
Else
ObjV.RollBack()
End If
-
-
ObjV.Dispose()
End Sub
+ Private Function GeneraRemision(CveVentaPedido As Integer, ByRef TransaccionSQL As SqlTransaction) As RespuestaFacturacion
+
+ Dim Respuesta As New RespuestaFacturacion()
+
+ Dim CveRemiocionGenerada As Integer = -1
+
+ Dim ObjVentas As New ClsVentas(TransaccionSQL)
+ Dim ProcesoOK As Boolean = True
+
+ Dim CveSubProyectoPedido As Integer = -1
+ Dim CveMoneda As Integer = -1
+
+ If ObjVentas.GetVenta(CveVenta, UsuarioActual.CveEmpresa, VerificaAlmacen:=False) Then
+ Dim DbRowVenta As DataRow = ObjVentas.DtResultados.Copy().Rows(0)
+ CveMoneda = DbRowVenta("CveMoneda").ToString.ToEntero
+ CveSubProyectoPedido = DbRowVenta("CveSubProyecto").ToString().ToEntero()
+ End If
+
+ Dim ObjFactura As Modelos.Factura = Modelos.Factura.CrearVentaNueva(UsuarioActual, CveSubProyectoPedido, CveCliente, CveMoneda, "Rem")
+
+ If ObjFactura IsNot Nothing AndAlso ProcesoOK Then
+
+
+
+ ObjFactura.CveMedico = DdlMedico.SelectedValue.ToEntero
+ ObjFactura.CveProcedimiento = DdlProcedimiento.SelectedValue.ToEntero
+ ObjFactura.CveTipoVenta = DdlTipoVenta.SelectedValue.ToEntero
+
+ For Each GvRow As GridViewRow In GvMaterialUtilizado.Rows
+
+ Dim CvePS As Integer = GvRow.DataKey("CvePS").ToEntero
+ Dim Cantidad As Decimal = GvRow.DataKey("Cantidad").ToDecimal
+ Dim CantidadDev As Decimal = GvRow.FCTextBox("TxtDev").Text.ToDecimal
+ Dim CantidadRegistro As Decimal = Cantidad - CantidadDev
+ Dim PU As Decimal = GvRow.DataKey("PU").ToDecimal
+ Dim Descuento As Decimal = GvRow.DataKey("Descuento").ToDecimal
+ Dim Obs As String = GvRow.DataKey("Observaciones")
+
+ If Not ObjFactura.AgregarPS(CvePS, CantidadRegistro, PU, Descuento, Obs, CveSubProyecto:=CveSubProyectoPedido) Then
+ Alert("Error al agregar producto", TipoMensaje.MsgAdvertencia)
+ ProcesoOK = False
+ Exit For
+ End If
+ Next
+
+
+ If ProcesoOK Then
+ ObjFactura.CalculaTotales()
+ Dim Resp As New Modelos.Factura.MMensajeFactura
+ Resp = ObjFactura.EmitirFactura(False, Transac:=TransaccionSQL)
+
+ If Resp.CveVenta > 0 Then
+ Respuesta.CveVenta = Resp.CveVenta
+ Respuesta.SerieFolio = Resp.SerieFolio
+ Else
+ ProcesoOK = False
+ End If
+
+ End If
+
+ Else
+ ProcesoOK = False
+ End If
+
+ Return Respuesta
+
+ End Function
+
+ Friend Class RespuestaFacturacion
+ Public Property CveVenta As Integer = -1
+ Public Property SerieFolio As String = "-1"
+ Public Sub New()
+
+ End Sub
+ End Class
+
End Class
\ No newline at end of file
diff --git a/OS/RepOSMedicas.aspx b/OS/RepOSMedicas.aspx
index a1c88c61a..94589e95c 100644
--- a/OS/RepOSMedicas.aspx
+++ b/OS/RepOSMedicas.aspx
@@ -1,4 +1,4 @@
-<%@ Page Title="Reporte de Ordenes de Servicio Medicas" Language="VB" MasterPageFile="~/Site.master" AutoEventWireup="false" CodeFile="RepOSMedicas.aspx.vb" Inherits="OS_RepOSMedicas" %>
+<%@ Page Title="Reporte de Ordenes de Servicio Médicas" Language="VB" MasterPageFile="~/Site.master" AutoEventWireup="false" CodeFile="RepOSMedicas.aspx.vb" Inherits="OS_RepOSMedicas" %>
@@ -12,7 +12,7 @@
- Reporte de Ordenes de Servicio Medicas
+ Reporte de Ordenes de Servicio Médicas
@@ -169,11 +169,11 @@
<%----%>
<%--1--%>
-
+
<%--2--%>
<%--3--%>
-
+
<%--4--%>
<%--5--%>
diff --git a/OS/RepOSMedicas.aspx.vb b/OS/RepOSMedicas.aspx.vb
index ec06bffbd..537378182 100644
--- a/OS/RepOSMedicas.aspx.vb
+++ b/OS/RepOSMedicas.aspx.vb
@@ -2,18 +2,11 @@
Option Strict On
Imports System.Data
-Imports System.Web.Compilation
Imports Extensiones
-Imports Microsoft.Reporting.WebForms
-Imports System.Xml.Serialization
-Imports System.IO
-Imports System.Xml
Partial Class OS_RepOSMedicas
Inherits ClsPaginas
-
-
Protected Sub Page_Load(sender As Object, e As System.EventArgs) Handles Me.Load
If Not IsPostBack Then
If UsuarioActual.CveEmpresa = 2 AndAlso UsuarioActual.CveUsuario.Contiene(77, 21) Then Response.Redirect("/Inicio.aspx")
@@ -28,21 +21,15 @@ Partial Class OS_RepOSMedicas
#Region " CARGA COMBOS "
-
-
Private Sub CargaCombos()
CargarCentrosDeCosto(DdlProyecto, DdlSubProyecto, LblProyecto, LblSubProyecto, divProyecto:=DivProyecto)
-
'CargaEstatus
DdlEstatusOS.DataSource = GlobalDTEstatusOrdenServicios(UsuarioActual.CveEmpresa)
DdlEstatusOS.DataBind()
DdlEstatusOS.Items.Insert(0, New ListItem("Todos", "-1"))
-
-
- Dim DTTecnicos = New DataTable
-
+ Dim DTTecnicos As New DataTable
Dim ObjUsuarios As New ClsSisUsuarios
If ObjUsuarios.GetPermisosPorUsuarioProcesos(-1, -1, -1, -1, 351, UsuarioActual.CveUsuario, CveEmpresa:=UsuarioActual.CveEmpresa) Then
@@ -134,7 +121,6 @@ Partial Class OS_RepOSMedicas
#End Region
-
Private Sub CargaClientes()
DdlClientes.ddl.Items.Clear()
DdlClientes.DataSource = GlobalDTCliente(UsuarioActual.CveEmpresa, -1) '.FiltraParametros($"CveClienteClasificacion = {DdlClienteClasificacion.SelectedValue.ToEntero} OR {DdlClienteClasificacion.SelectedValue.ToEntero} = -1")
@@ -147,8 +133,6 @@ Partial Class OS_RepOSMedicas
End Sub
-
-
#Region " GV DATOS - ROW DATABOUND "
Protected Sub GvDatos_RowDataBound(sender As Object, e As System.Web.UI.WebControls.GridViewRowEventArgs) Handles GvDatos.RowDataBound
If e.Row.RowType = DataControlRowType.DataRow Then
@@ -172,18 +156,9 @@ Partial Class OS_RepOSMedicas
GvDatos.ExportToExcelGembox("OrdenesServicio", UsuarioActual, "Ordenes de Servicio Medicas", DatoTituloExtra:=$"", DatosFiltros:=SbFiltros.ToString())
-
End Sub
Public Overrides Sub VerifyRenderingInServerForm(ByVal control As Control)
End Sub
-
-
-
-
-
-
-
-
End Class
diff --git a/Planeacion/CatSubProyectos.aspx b/Planeacion/CatSubProyectos.aspx
index 677baa2bc..d308ceb0d 100644
--- a/Planeacion/CatSubProyectos.aspx
+++ b/Planeacion/CatSubProyectos.aspx
@@ -402,8 +402,11 @@