OS sms Remision vinculada a movimiento alamcen se agregan parametros a remision CveMedico, CveProcedimiento y CveTipoVenta, EmpresasModulos.aspx filtra
This commit is contained in:
@@ -1278,7 +1278,7 @@
|
||||
<div class="col-md-12">
|
||||
|
||||
<asp:GridView ID="GvMaterialUtilizado" runat="server" AutoGenerateColumns="False" EmptyDataText="No se han capturado Historial"
|
||||
DataKeyNames="CveVentaDetalle,Cantidad,CveAlmacenActual,CvePS,CveUM,PU,CveMovimientoDetalle,Lote,Serie,FechaCaducidad,CodigoPS"
|
||||
DataKeyNames="CveVentaDetalle,Cantidad,CveAlmacenActual,CvePS,CveUM,PU,CveMovimientoDetalle,Lote,Serie,FechaCaducidad,AplicaSerie,AplicaLote,AplicaCaducidad,CodigoPS,Descuento,Observaciones"
|
||||
CssClass="table table-striped table-advance table-hover Widthall" GridLines="None" OnRowDataBound="GvMaterialUtilizado_RowDataBound">
|
||||
<Columns>
|
||||
<asp:TemplateField>
|
||||
|
||||
@@ -3166,11 +3166,19 @@ Partial Class OS_OrdenesServicios
|
||||
|
||||
|
||||
Dim Respuesta As New RespuestaFacturacion()
|
||||
Dim DtVentaDetalle As New DataTable
|
||||
|
||||
If ProcesoOK Then
|
||||
|
||||
Respuesta = GeneraRemision(CveVentaPedido, ObjV.IniciaTransacSQL())
|
||||
If Not Respuesta.CveVenta > 0 Then
|
||||
|
||||
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
|
||||
|
||||
@@ -3185,6 +3193,7 @@ Partial Class OS_OrdenesServicios
|
||||
|
||||
If CveMovimiento > 0 Then
|
||||
|
||||
Dim IndexMov1 As Integer = 0
|
||||
For Each GvRow As GridViewRow In GvMaterialUtilizado.Rows
|
||||
|
||||
Dim Cantidad As Decimal = GvRow.DataKey("Cantidad").ToDecimal
|
||||
@@ -3192,7 +3201,7 @@ Partial Class OS_OrdenesServicios
|
||||
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 Serie As String = GvRow.DataKey("Serie")
|
||||
@@ -3206,6 +3215,7 @@ Partial Class OS_OrdenesServicios
|
||||
Exit For
|
||||
End If
|
||||
End If
|
||||
IndexMov1 = IndexMov1 + 1
|
||||
Next
|
||||
|
||||
If ProcesoOK Then
|
||||
@@ -3214,13 +3224,14 @@ Partial Class OS_OrdenesServicios
|
||||
|
||||
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
|
||||
@@ -3232,12 +3243,13 @@ Partial Class OS_OrdenesServicios
|
||||
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>", CveMovimiento, Folio, "Material utilizado")
|
||||
|
||||
If Not ObjEventos.AddEventoBitacora(LigaVenta, "-1", UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, CveVenta:=CveVentaPedido, CveOS:=CveOS) Then
|
||||
If Not ObjEventos.AddEventoBitacora(LigaVenta, "-1", UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, CveVenta:=Respuesta.CveVenta, CveOS:=CveOS) Then
|
||||
ProcesoOK = False
|
||||
End If
|
||||
End If
|
||||
@@ -3254,7 +3266,7 @@ Partial Class OS_OrdenesServicios
|
||||
If ProcesoOK Then
|
||||
ObjV.Commit()
|
||||
Alert("El material utilizado se guardó correctamente")
|
||||
RegistraScript("$('#DVModalSolicitarDevolucion').modal('hide');")
|
||||
RegistraScript("$('#DivModalMaterialUtilizado').modal('hide');")
|
||||
Else
|
||||
ObjV.RollBack()
|
||||
End If
|
||||
@@ -3283,45 +3295,44 @@ Partial Class OS_OrdenesServicios
|
||||
|
||||
Dim ObjFactura As Modelos.Factura = Modelos.Factura.CrearVentaNueva(UsuarioActual, CveSubProyectoPedido, CveCliente, CveMoneda, "Rem")
|
||||
|
||||
If ObjFactura IsNot Nothing Then
|
||||
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)
|
||||
|
||||
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
|
||||
|
||||
If Resp.CveVenta > 0 Then
|
||||
Respuesta.CveVenta = Resp.CveVenta
|
||||
Respuesta.SerieFolio = Resp.SerieFolio
|
||||
Else
|
||||
ProcesoOK = False
|
||||
End If
|
||||
|
||||
|
||||
End If
|
||||
|
||||
Else
|
||||
|
||||
Reference in New Issue
Block a user