From ae5c5ad0f29f965687ea7965932ed8a9ba2e6529 Mon Sep 17 00:00:00 2001 From: AbrahamCastilloV Date: Wed, 6 Dec 2023 09:54:01 -0700 Subject: [PATCH 1/6] =?UTF-8?q?Creaci=C3=B3n=20de=20p=C3=A1gina=20CrearVia?= =?UTF-8?q?je?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Transportes/CrearViaje.aspx | 124 +++++++++++++++++++++++++++++++++ Transportes/CrearViaje.aspx.vb | 65 +++++++++++++++++ 2 files changed, 189 insertions(+) create mode 100644 Transportes/CrearViaje.aspx create mode 100644 Transportes/CrearViaje.aspx.vb diff --git a/Transportes/CrearViaje.aspx b/Transportes/CrearViaje.aspx new file mode 100644 index 000000000..6dd2878c9 --- /dev/null +++ b/Transportes/CrearViaje.aspx @@ -0,0 +1,124 @@ +<%@ Page Language="VB" AutoEventWireup="false" MasterPageFile="~/Site.master" CodeFile="CrearViaje.aspx.vb" + Inherits="CrearViaje" %> + + + + Crear Viaje + + + + + +
+ +
+
+ + + + + + + +
+
+ +
+
+ + + + + + +
+
+
+
+ + + + + + +
+
+
+
+ + + + + + +
+
+
+
+ + + + + + +
+
+
+ +
+
+ + + + + +
+
+
+ + +
+
+ +
diff --git a/Transportes/CrearViaje.aspx.vb b/Transportes/CrearViaje.aspx.vb new file mode 100644 index 000000000..c64594b95 --- /dev/null +++ b/Transportes/CrearViaje.aspx.vb @@ -0,0 +1,65 @@ +Partial Class CrearViaje + Inherits ClsPaginas + + Protected Sub Page_Load(sender As Object, e As System.EventArgs) Handles Me.Load + + If Not IsPostBack Then + CargaDatos() + End If + End Sub + + Private Sub CargaDatos() + 'Lista Activos Fijos' + Dim ObjAF As New ClsAF() + If ObjAF.GetActivosFijos(-1, 13, "-1", "-1", -1, -1, "-1", -1, -1, -1, -1, 1, "-1", -1, -1, -1) Then + If ObjAF.DtResultados.Rows.Count > 0 Then + DdlTransporte.DataSource = ObjAF.DtResultados + DdlTransporte.DataBind() + + DdlTransporte.Items.Insert(0, New ListItem("<--Seleccione Transporte-->", "")) + End If + End If + ObjAF.Dispose() + + 'Lista Rutas' + Dim ObjRutas As New ClsRH() + If ObjRutas.GetRutas(7) Then + Page.Response.Write("") + + If ObjRutas.DtResultados.Rows.Count > 0 Then + DdlRutas.DataSource = ObjRutas.DtResultados + DdlRutas.DataBind() + DdlRutas.Items.Insert(0, New ListItem("<--Seleccione Ruta-->", "")) + + DdlPartida.DataSource = ObjRutas.DtResultados + DdlPartida.DataBind() + DdlPartida.Items.Insert(0, New ListItem("<--Seleccione Partida-->", "")) + + DdlDestino.DataSource = ObjRutas.DtResultados + DdlDestino.DataBind() + DdlDestino.Items.Insert(0, New ListItem("<--Seleccione Destino-->", "")) + + End If + End If + ObjRutas.Dispose() + + 'Lista Chofer' + 'GlobalDTRHPersonal()' + 'CvePersonal - Text Nombre COmpleto' + Dim ObjAcar As New ClsAcarreos() + If ObjAcar.GetChofer(-1, UsuarioActual.CveEmpresa, 1, -1) Then + DdlChofer.DataSource = ObjAcar.DtResultados + DdlChofer.DataBind() + DdlChofer.Items.Insert(0, New ListItem("<--Seleccione Chofer-->", "")) + End If + ObjAcar.Dispose() + End Sub + + Protected Sub AddViaje(sender As Object, e As EventArgs) + 'Dónde están los PA para agregar viajes?' + 'Dónde están los PA para consultar Destinos y rutas viajes?' + 'Por qué siempre cambia el aside de Transportes V&A?' + Page.Response.Write("") + End Sub + +End Class \ No newline at end of file From 4c3eae82dd2c5a155d1bf21dce82c70c693506b0 Mon Sep 17 00:00:00 2001 From: rakcsle Date: Wed, 6 Dec 2023 10:54:34 -0700 Subject: [PATCH 2/6] Procedimientos medicos cat detalles --- App_Code/ClsPaginas.vb | 1 + App_Code/ClsVentas.vb | 136 ++++++++++++ Ventas/CatProcedimientoDetalle.aspx | 260 ++++++++++++++++++++++ Ventas/CatProcedimientoDetalle.aspx.vb | 285 +++++++++++++++++++++++++ Ventas/CatProcedimientos.aspx | 69 +++--- 5 files changed, 718 insertions(+), 33 deletions(-) create mode 100644 Ventas/CatProcedimientoDetalle.aspx create mode 100644 Ventas/CatProcedimientoDetalle.aspx.vb diff --git a/App_Code/ClsPaginas.vb b/App_Code/ClsPaginas.vb index d63910d2f..e974a2f66 100644 --- a/App_Code/ClsPaginas.vb +++ b/App_Code/ClsPaginas.vb @@ -9371,6 +9371,7 @@ Public Class ClsPaginas PaginaDict.Add("/Ventas/RepIndicadoresPorProyecto.aspx".ToUpper(), 617) PaginaDict.Add("/Ventas/CatMedicos.aspx".ToUpper(), 1343) PaginaDict.Add("/Ventas/CatProcedimientos.aspx".ToUpper(), 1344) + PaginaDict.Add("/Ventas/CatProcedimientoDetalle.aspx".ToUpper(), 1344) PaginaDict.Add("/Ventas/VentasMedicas.aspx".ToUpper(), 1345) diff --git a/App_Code/ClsVentas.vb b/App_Code/ClsVentas.vb index 6f2f06af9..11e958064 100644 --- a/App_Code/ClsVentas.vb +++ b/App_Code/ClsVentas.vb @@ -6149,9 +6149,16 @@ Public Class ClsVentas .Add("@CveProcedimiento", SqlDbType.Int).Value = CveProcedimiento .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa End With + Try SqlAdapter.Fill(Data) Retorno = True + Catch Ex1 As SqlException + If Ex1.Message.Contains("Número: 547;") Then + Alert("La Procedimiento no se pudo eliminar porque está siendo usado por un registro.", TipoMensaje.MsgAdvertencia) + Else + OnError("Ocurrió un error al eliminar el Procedimiento.", Ex1, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) + End If Catch ex As Exception OnError("Ocurrió un error al eliminar el Procedimiento.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) End Try @@ -6159,6 +6166,135 @@ Public Class ClsVentas End Function + + Public Function AddProcedimientoProducto(CveProcedimiento As Integer, CvePS As Integer, Autogenerado As Boolean, Estatus As Boolean, CveUsuario As Integer) As Boolean + + Dim Retorno As Boolean = False + DataAdapter("PA_Vta_ProcedimientosProductosAdd") + With SqlAdapter.SelectCommand.Parameters + + .Add("@CveProcedimiento", SqlDbType.Int).Value = CveProcedimiento + .Add("@CvePS", SqlDbType.Int).Value = CvePS + .Add("@Autogenerado", SqlDbType.Bit).Value = Autogenerado + .Add("@Estatus", SqlDbType.Bit).Value = Estatus + .Add("@CveUsuario", SqlDbType.Int).Value = CveUsuario + End With + Try + SqlAdapter.Fill(Data) + Retorno = True + Catch ex As Exception + OnError("Ocurrió un error al guardar el producto.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) + End Try + Return Retorno + + End Function + + + Public Function UpdateProcedimientoProducto(CveProcedimientoProducto As Integer, CvePS As Integer, Autogenerado As Boolean, Estatus As Boolean, CveUsuario As Integer) As Boolean + + Dim Retorno As Boolean = False + DataAdapter("PA_Vta_ProcedimientosProductosUpdate") + With SqlAdapter.SelectCommand.Parameters + + .Add("@CveProcedimientoProducto", SqlDbType.Int).Value = CveProcedimientoProducto + .Add("@CvePS", SqlDbType.Int).Value = CvePS + .Add("@Autogenerado", SqlDbType.Bit).Value = Autogenerado + .Add("@Estatus", SqlDbType.Bit).Value = Estatus + .Add("@CveUsuario", SqlDbType.Int).Value = CveUsuario + End With + Try + SqlAdapter.Fill(Data) + Retorno = True + Catch ex As Exception + OnError("Ocurrió un error al actualizar el producto.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) + End Try + Return Retorno + + End Function + + + Public Function SincronizacionProcedimientoProducto(CveProcedimiento As Integer, CveVenta As Integer, CveUsuario As Integer, CveEmpresa As Integer) As Boolean + + Dim Retorno As Boolean = False + DataAdapter("PA_Vta_ProcedimientosProductosSincronizacion") + With SqlAdapter.SelectCommand.Parameters + + .Add("@CveProcedimiento", SqlDbType.Int).Value = CveProcedimiento + .Add("@CveVenta", SqlDbType.Int).Value = CveVenta + .Add("@CveUsuario", SqlDbType.Int).Value = CveUsuario + .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa + End With + Try + SqlAdapter.Fill(Data) + Retorno = True + Catch ex As Exception + OnError("Ocurrió un error al sincronizar los Productos.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) + End Try + Return Retorno + + End Function + + Public Function GetProcedimientoProducto(CveProcedimiento As Integer, Estatus As Integer, CveEmpresa As Integer) As Boolean + + Dim Retorno As Boolean = False + DataAdapter("PA_Vta_ProcedimientosProductosGet") + With SqlAdapter.SelectCommand.Parameters + + .Add("@CveProcedimiento", SqlDbType.Int).Value = CveProcedimiento + .Add("@Estatus", SqlDbType.Int).Value = Estatus + .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.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) + End Try + Return Retorno + + End Function + + Public Function RemoveProcedimientoProducto(CveProcedimientoProducto As Integer, CveEmpresa As Integer) As Boolean + + Dim Retorno As Boolean = False + DataAdapter("PA_Vta_ProcedimientosProductosRemove") + With SqlAdapter.SelectCommand.Parameters + .Add("@CveProcedimientoProducto", SqlDbType.Int).Value = CveProcedimientoProducto + .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa + End With + Try + SqlAdapter.Fill(Data) + Retorno = True + Catch ex As Exception + OnError("Ocurrió un error al eliminar los Productos.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) + End Try + Return Retorno + + End Function + + + + + Public Function GetProcedimientoVentas(CveProcedimiento As Integer, CveEmpresa As Integer) As Boolean + + Dim Retorno As Boolean = False + DataAdapter("PA_Vta_ProcedimientosVentasGet") + With SqlAdapter.SelectCommand.Parameters + + .Add("@CveProcedimiento", SqlDbType.Int).Value = CveProcedimiento + .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa + End With + Try + SqlAdapter.Fill(Data) + Retorno = True + Catch ex As Exception + OnError("Ocurrió un error al obtener las ventas.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) + End Try + Return Retorno + + End Function + + #End Region #Region "IDisposable Support" diff --git a/Ventas/CatProcedimientoDetalle.aspx b/Ventas/CatProcedimientoDetalle.aspx new file mode 100644 index 000000000..6191532b1 --- /dev/null +++ b/Ventas/CatProcedimientoDetalle.aspx @@ -0,0 +1,260 @@ +<%@ Page Title="" Language="VB" MasterPageFile="~/Site.master" AutoEventWireup="false" CodeFile="CatProcedimientoDetalle.aspx.vb" Inherits="Ventas_CatProcedimientoDetalle" %> + + + + + + + + + + + + + + + +
  • + +
  • + +
    +
    + +
    + + + + + + + + + + + + + +
    +
    +
    +
    +
    + + General +
    +
    +
    +
    +
    +
    + +
    +
    +
    + +
    + + + +
    +
    + + +
    +
    + + +
    +
    + + +
    +
    +
    +
    +
    +
    +
    +
    +
    + + + + + + + +
    + " style="display: inline-block; margin-right: -20px; width: 150px;" /> + " class="btn btn-circle btn-sm label-info"> +
    + +
    +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    +
    +
    +
    +
    +
    + + + + + + + + +
    + " style="display: inline-block; margin-right: -20px; width: 150px;" /> + " class="btn btn-circle btn-sm label-info"> +
    + +
    +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    +
    +
    +
    +
    +
    + + +
    +
    + + + + + +
    + + + + + +
    + +
    +
    + + + + + + + + + +
    + + + diff --git a/Ventas/CatProcedimientoDetalle.aspx.vb b/Ventas/CatProcedimientoDetalle.aspx.vb new file mode 100644 index 000000000..5663495a2 --- /dev/null +++ b/Ventas/CatProcedimientoDetalle.aspx.vb @@ -0,0 +1,285 @@ +Imports System.Data +Imports System.Drawing +Imports Extensiones +Imports Microsoft.Owin.Security.Provider +Imports Microsoft.Reporting.WebForms +Partial Class Ventas_CatProcedimientoDetalle + Inherits ClsPaginas +#Region "Propiedades" + Private Property CveProcedimiento As Integer + Get + + If ViewState("CveProcedimiento") Is Nothing Then + ViewState("CveProcedimiento") = -1 + End If + + Return ViewState("CveProcedimiento").ToString.ToEntero + + End Get + Set(value As Integer) + ViewState("CveProcedimiento") = value + End Set + End Property + + Private Property CveProcedimientoProducto As Integer + Get + + If ViewState("CveProcedimientoProducto") Is Nothing Then + ViewState("CveProcedimientoProducto") = -1 + End If + + Return ViewState("CveProcedimientoProducto").ToString.ToEntero + + End Get + Set(value As Integer) + ViewState("CveProcedimientoProducto") = value + End Set + End Property +#End Region + + + Protected Sub Page_Load(sender As Object, e As System.EventArgs) Handles Me.Load + If Not IsPostBack Then + + CveProcedimiento = If(Request("CveProcedimiento") <> "", Request("CveProcedimiento").ToString.ToEntero, "-1".ToEntero) + + If CveProcedimiento > 0 Then + CargaDatos() + CargaProductos() + CargaVentas() + End If + + + DdlProducto.setEsWebService(UsuarioActual.Empresa.Funcionalidad(105) = "1") + + If Not DdlProducto.UsaWebService AndAlso CType(DdlProducto.DataSource, DataTable) Is Nothing Then + DdlProducto.DataSource = GlobalDTPSSimplificado(UsuarioActual.CveEmpresa).FiltraParametros("CveTipoPS = 2") + DdlProducto.DataBind() + DdlProducto.ddl.Items.Insert(0, New ListItem("Seleccione", "-1")) + End If + + + End If + End Sub + + Private Sub CargaVentas() + + + Dim objVenta As New ClsVentas + + If objVenta.GetProcedimientoVentas(CveProcedimiento, UsuarioActual.CveEmpresa) Then + GvVentas.DataSource = objVenta.DtResultados + End If + + objVenta.Dispose() + + GvVentas.DataBind() + + UpTabVentas.Update() + End Sub + + Private Sub CargaDatos() + + + If CveProcedimiento > 0 Then + + Dim DTProcedimiento As New DataTable + Dim Objeto As New ClsVentas + If Objeto.GetProcedimientos(CveProcedimiento, UsuarioActual.CveEmpresa, -1) Then + + DTProcedimiento = Objeto.DtResultados + + If DTProcedimiento.Rows.Count > 0 Then + LblProcedimiento.Text = DTProcedimiento.FiltroPrimeroValor("Procedimiento") + TxtProcedimiento.Text = DTProcedimiento.FiltroPrimeroValor("Procedimiento") + + ChkEstatus.Checked = Boolean.Parse(DTProcedimiento.FiltroPrimeroValor("Estatus")) + + LblFecha.Text = DTProcedimiento.FiltroPrimeroValor("FechaIng").ToDate.ToShortDateString + LblUsuario.Text = DTProcedimiento.FiltroPrimeroValor("Usuario") + Else + Dim Liga As String = $"document.location.href=""/Ventas/CatProcedimientos.aspx"";" + Alert("El Procedimiento solicitado no existe.", TipoMensaje.MsgAdvertencia, Liga) + End If + + Objeto.Dispose() + End If + Else + + LblFechaAlta.Visible = False + LblUsuarioAlta.Visible = False + + End If + + + End Sub + + + + Private Sub BtnGuardar_Click(sender As Object, e As EventArgs) Handles BtnGuardar.Click + + Dim ProcesoOK = False + Dim ObjVentas As New ClsVentas + + + If CveProcedimiento > 0 Then + If ObjVentas.UpdateProcedimiento(CveProcedimiento, TxtProcedimiento.Text.Trim, ChkEstatus.Checked, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa) Then + ProcesoOK = True + End If + 'Else + ' If ObjVentas.AddProcedimiento(TxtProcedimiento.Text.Trim, ChkEstatus.Checked, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa) Then + ' ProcesoOK = True + ' End If + End If + + ObjVentas.Dispose() + + If ProcesoOK Then + Alert($"Procedimiento {If(CveProcedimiento > 0, "Actualizado", "Guardado")} Correctamente.") + RegistraScript("$('#DVAgregarProcedimiento').modal('hide');") + CargaDatos() + CargaGlobal() + UpDatos.Update() + End If + + End Sub + + Protected Sub LnkEliminar_Click(sender As Object, e As EventArgs) + + 'Dim GvRow As GridViewRow = DirectCast(DirectCast(sender, LinkButton).NamingContainer, GridViewRow) + 'CveProcedimiento = GvRow.DataKey("CveProcedimiento").ToEntero + + Dim ObjVentas As New ClsVentas + Dim ProcesoOK = False + + If ObjVentas.RemoveProcedimiento(CveProcedimiento, UsuarioActual.CveEmpresa) Then + ProcesoOK = True + End If + + ObjVentas.Dispose() + + + If ProcesoOK Then + CargaGlobal() + Dim Liga As String = $"document.location.href=""/Ventas/CatProcedimientos.aspx"";" + Alert("Procedimiento eliminando correctamente.", TipoMensaje.MsgInformacion, Liga) + End If + End Sub + + + Private Sub CargaGlobal() + GlobalDTProcedimientos(UsuarioActual.CveEmpresa) = Nothing + End Sub + + Protected Sub LnkAgregarProducto_Click() Handles LnkAgregarProducto.Click + + limpiarModal() + UpAgregar.Update() + RegistraScript("$('#ModalAgregar').modal()") + + End Sub + + Private Sub limpiarModal() + + LtlTituloAgregar.Text = "Agregar Producto" + CveProcedimientoProducto = -1 + DdlProducto.SelectedValue = "-1" + DdlProducto.SelectedText = "" + DVProdcutoEstatus.Visible = False + UpAgregar.Update() + + End Sub + + Protected Sub LkAgregarProducto_Click(sender As Object, e As EventArgs) + + Dim ProcesoOK As Boolean = False + + Dim objVenta As New ClsVentas + + If CveProcedimientoProducto > 0 Then + + If objVenta.UpdateProcedimientoProducto(CveProcedimientoProducto, DdlProducto.SelectedValue.ToEntero, False, True, UsuarioActual.CveUsuario) Then + ProcesoOK = True + End If + + Else + + If objVenta.AddProcedimientoProducto(CveProcedimiento, DdlProducto.SelectedValue.ToEntero, False, True, UsuarioActual.CveUsuario) Then + ProcesoOK = True + End If + + End If + + objVenta.Dispose() + + If ProcesoOK Then + RegistraScript("$('#ModalAgregar').modal('hide')") + + Alert($"Producto {If(CveProcedimientoProducto > 0, "actualizado", "agregado")} correctamente.") + + CargaProductos() + End If + + End Sub + + Private Sub CargaProductos() + + Dim objVenta As New ClsVentas + + If objVenta.GetProcedimientoProducto(CveProcedimiento, -1, UsuarioActual.CveEmpresa) Then + GvProductos.DataSource = objVenta.DtResultados + End If + + objVenta.Dispose() + + GvProductos.DataBind() + + UpTabProductos.Update() + + End Sub + + Protected Sub LnkEditarProducto_Click(sender As Object, e As EventArgs) + + Dim GvRow As GridViewRow = DirectCast(DirectCast(sender, LinkButton).NamingContainer, GridViewRow) + + CveProcedimientoProducto = GvRow.DataKey("CveProcedimientoProducto").ToEntero + Dim CvePS As String = GvRow.DataKey("CvePS") + Dim CodigoPS As String = GvRow.DataKey("CodigoPS") + Dim Estatus As Boolean = Boolean.Parse(GvRow.DataKey("Estatus")) + + DdlProducto.ddl.SelectedValueExist(CvePS) + DdlProducto.txtText.Value = CodigoPS + DdlProducto.txtValue.Value = CvePS + ChkEstatusProducto.Checked = Estatus + LtlTituloAgregar.Text = "Actualizar producto" + + DVProdcutoEstatus.Visible = True + UpAgregar.Update() + + RegistraScript("$('#ModalAgregar').modal()") + + End Sub + + Protected Sub LnkEliminarProducto_Click(sender As Object, e As EventArgs) + Dim GvRow As GridViewRow = DirectCast(DirectCast(sender, LinkButton).NamingContainer, GridViewRow) + + Dim CveProcedimientoProductoEliminar = GvRow.DataKey("CveProcedimientoProducto").ToEntero + + Dim ObjVentas As New ClsVentas + Dim ProcesoOK = False + + If ObjVentas.RemoveProcedimientoProducto(CveProcedimientoProductoEliminar, UsuarioActual.CveEmpresa) Then + ProcesoOK = True + End If + + ObjVentas.Dispose() + + If ProcesoOK Then + Alert("Producto eliminando correctamente.") + CargaProductos() + End If + + End Sub + + +End Class diff --git a/Ventas/CatProcedimientos.aspx b/Ventas/CatProcedimientos.aspx index d50048c14..e47af474b 100644 --- a/Ventas/CatProcedimientos.aspx +++ b/Ventas/CatProcedimientos.aspx @@ -34,44 +34,47 @@
    -
    - - - +
    + + + + + + <%-- - - - - - - - + --%> - - - - - + + + + + - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + +
    From 97b3a4a72a73306b88a040fab4b156a5f045d8ae Mon Sep 17 00:00:00 2001 From: rakcsle Date: Wed, 6 Dec 2023 11:00:22 -0700 Subject: [PATCH 3/6] Ventas autoguadardo de productos en procedimiento --- Ventas/Ventas.aspx.vb | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/Ventas/Ventas.aspx.vb b/Ventas/Ventas.aspx.vb index c80df0e69..8b3a784ff 100644 --- a/Ventas/Ventas.aspx.vb +++ b/Ventas/Ventas.aspx.vb @@ -13499,6 +13499,7 @@ Partial Class Ventas End If If EsVentaMedica AndAlso ErrorList.Count = 0 AndAlso ChkRequiereTecnico.Checked Then + GeneraOS(ObjVentas.IniciaTransacSQL, ErrorList) If ErrorList.Count = 0 Then @@ -13507,6 +13508,10 @@ Partial Class Ventas End If End If + If ObjVentas.SincronizacionProcedimientoProducto(DdlProcedimiento.SelectedValue.ToEntero, factura.CveVenta, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa) Then + ErrorList.Add("Ocurrió un error al guardar la los productos al procedimiento") + End If + End If From 8e49cdfd2afee3d1d059acbbce1d0b66ead389a5 Mon Sep 17 00:00:00 2001 From: rakcsle Date: Wed, 6 Dec 2023 12:19:25 -0700 Subject: [PATCH 4/6] Ventas medicas sugerir productos de procedimiento --- Ventas/Ventas.aspx | 50 ++++++++++++++++++++++++++++++++- Ventas/Ventas.aspx.vb | 64 +++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 113 insertions(+), 1 deletion(-) diff --git a/Ventas/Ventas.aspx b/Ventas/Ventas.aspx index dcc9544ea..84675133f 100644 --- a/Ventas/Ventas.aspx +++ b/Ventas/Ventas.aspx @@ -8460,7 +8460,8 @@
    Procedimiento: - + Seleccione uno + +
    +
    + + + + + + + + + + + + + + + + + + + + + + + + + <%-- + + --%> + + + + + + + + + + + + +
    +
    + + diff --git a/Ventas/Ventas.aspx.vb b/Ventas/Ventas.aspx.vb index 8b3a784ff..04c334b26 100644 --- a/Ventas/Ventas.aspx.vb +++ b/Ventas/Ventas.aspx.vb @@ -35618,6 +35618,9 @@ Partial Class Ventas DdlMedicoModal.SelectedValueExist(-1) DdlProcedimientoModal.SelectedValueExist(-1) + GvProductosProcedimiento.DataSource = Nothing + GvProductosProcedimiento.DataBind() + UpDvModalTipoVenta.Update() End Sub @@ -35676,6 +35679,44 @@ Partial Class Ventas RegistraScript("$('#DvModalTipoVenta').modal('hide');") + + + Dim CountPsAgregados As Integer = 0 + + For Each GvRow As GridViewRow In GvProductosProcedimiento.Rows + + Dim Chk As CheckBox = GvRow.FCCheckBox("Chk") + Dim Cantidad As Decimal = GvRow.FCTextBox("TxtCantidad").Text.ToDecimal + + If Chk.Checked AndAlso Cantidad > 0 Then + + + Dim CveUnidadMedida As Integer = GvRow.DataKey("CveUnidadMedida").ToEntero + Dim Abreviatura As String = GvRow.DataKey("Abreviatura").ToString + Dim PU As Decimal = GvRow.FCTextBox("TxtPrecio").Text.ToDecimal + Dim CveClasificacion As Integer = GvRow.DataKey("CveClasificacion").ToEntero + Dim Clasificacion As String = GvRow.DataKey("Clasificacion").ToString + + Dim CvePS As Integer = GvRow.DataKey("CvePS").ToEntero + + + If AgregarProductoServicio(Cantidad, CveUnidadMedida, Abreviatura, CveClasificacion, Clasificacion, + CvePS, "", TxtObsPS.Text.TrimEnd, PU, 0, + DdlProyecto.SelectedValue.ToEntero(), DdlProyecto.SelectedItem.Text, DdlSubProyecto.SelectedValue.ToEntero(), DdlSubProyecto.SelectedItem.Text, + Serie:=If(DIVCod.Visible, TxtCodigoSerie.Text.Trim, ""), TiempoEntrega:=TxtTiempoEntrega.Text, CuentaPredial:=TxtCuentaPredial.Text.Trim, RegeneraIEPS:=ClienteDesglosaIEPS, CvePromocionDetalle:=-1, + ImporteProntoPago:=0, ObjDescuento:=Nothing, CvePrecioLista:=-1, PrecioLista:="", NumTurnos:=0) Then + CountPsAgregados = CountPsAgregados + 1 + Else + Exit For + End If + End If + + Next + + If CountPsAgregados > 0 Then + CalculaTotalesVenta() + End If + UpCliente.Update() End Sub @@ -35687,6 +35728,27 @@ Partial Class Ventas End Sub + Protected Sub DdlProcedimientoModal_SelectedIndexChanged(sender As Object, e As EventArgs) + + + If DdlProcedimientoModal.SelectedValue.ToEntero > 0 Then + Dim objVenta As New ClsVentas + + If objVenta.GetProcedimientoProducto(DdlProcedimientoModal.SelectedValue.ToEntero, -1, UsuarioActual.CveEmpresa) Then + GvProductosProcedimiento.DataSource = objVenta.DtResultados + End If + + objVenta.Dispose() + + Else + GvProductosProcedimiento.DataSource = Nothing + End If + + GvProductosProcedimiento.DataBind() + + UpDvModalTipoVenta.Update() + + End Sub Private Function GeneraOS(ByRef TransacSQL As SqlTransaction, ByRef errorList As List(Of String)) As Boolean @@ -35772,5 +35834,7 @@ Partial Class Ventas 'End Sub + + End Class From ee59eb1d7d3bf59acdefda870dbff530a58a42d4 Mon Sep 17 00:00:00 2001 From: rakcsle Date: Wed, 6 Dec 2023 18:42:47 -0700 Subject: [PATCH 5/6] Correciones CatProcedmientos Detalles --- App_Code/ClsVentas.vb | 9 ++++++--- Inventarios/EntradasSalidas.aspx.vb | 3 +++ Ventas/CatProcedimientoDetalle.aspx | 10 ++++----- Ventas/CatProcedimientoDetalle.aspx.vb | 28 +++++++++++++++++++------- Ventas/CatProcedimientos.aspx | 3 ++- Ventas/CatProcedimientos.aspx.vb | 2 +- Ventas/Ventas.aspx | 20 +++++++++--------- Ventas/Ventas.aspx.vb | 6 +++--- 8 files changed, 52 insertions(+), 29 deletions(-) diff --git a/App_Code/ClsVentas.vb b/App_Code/ClsVentas.vb index 11e958064..a3217200f 100644 --- a/App_Code/ClsVentas.vb +++ b/App_Code/ClsVentas.vb @@ -6100,22 +6100,25 @@ Public Class ClsVentas End Function - Public Function AddProcedimiento(Procedimiento As String, Estatus As Boolean, CveUsuario As Integer, CveEmpresa As Integer) As Boolean + Public Function AddProcedimiento(Procedimiento As String, Estatus As Boolean, CveUsuario As Integer, CveEmpresa As Integer) As Integer - Dim Retorno As Boolean = False + Dim Retorno As Integer = -1 DataAdapter("PA_Vta_ProcedimientosAdd") With SqlAdapter.SelectCommand.Parameters .Add("@Procedimiento", SqlDbType.VarChar).Value = Procedimiento .Add("@Estatus", SqlDbType.Int).Value = Estatus .Add("@CveUsuario", SqlDbType.Int).Value = CveUsuario .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa + .Add("@CveProcedimiento", SqlDbType.Int).Direction = ParameterDirection.Output End With Try SqlAdapter.Fill(Data) - Retorno = True + Retorno = SqlAdapter.SelectCommand.Parameters("@CveProcedimiento").Value.ToString.ToEntero + Catch ex As Exception OnError("Ocurrió un error al guardar el Procedimiento.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) End Try + Return Retorno End Function diff --git a/Inventarios/EntradasSalidas.aspx.vb b/Inventarios/EntradasSalidas.aspx.vb index 5c0405d79..a67cae929 100644 --- a/Inventarios/EntradasSalidas.aspx.vb +++ b/Inventarios/EntradasSalidas.aspx.vb @@ -5528,6 +5528,9 @@ Partial Class Inventarios_EntradasSalidas End If End If + End If + End If + Catch ex As Exception ErrorMovInv = True End Try diff --git a/Ventas/CatProcedimientoDetalle.aspx b/Ventas/CatProcedimientoDetalle.aspx index 6191532b1..34d26b50e 100644 --- a/Ventas/CatProcedimientoDetalle.aspx +++ b/Ventas/CatProcedimientoDetalle.aspx @@ -11,11 +11,11 @@ - +
  • - +
  • @@ -61,7 +61,7 @@
    - +
    @@ -81,7 +81,7 @@ - + @@ -148,7 +148,7 @@ - + diff --git a/Ventas/CatProcedimientoDetalle.aspx.vb b/Ventas/CatProcedimientoDetalle.aspx.vb index 5663495a2..d666e49bd 100644 --- a/Ventas/CatProcedimientoDetalle.aspx.vb +++ b/Ventas/CatProcedimientoDetalle.aspx.vb @@ -44,12 +44,17 @@ Partial Class Ventas_CatProcedimientoDetalle CveProcedimiento = If(Request("CveProcedimiento") <> "", Request("CveProcedimiento").ToString.ToEntero, "-1".ToEntero) If CveProcedimiento > 0 Then + CargaDatos() CargaProductos() CargaVentas() + TabProductos.Visible = True + TabVentas.Visible = True + LnkAgregarProducto.Visible = True + Else + ChkEstatus.Checked = True End If - DdlProducto.setEsWebService(UsuarioActual.Empresa.Funcionalidad(105) = "1") If Not DdlProducto.UsaWebService AndAlso CType(DdlProducto.DataSource, DataTable) Is Nothing Then @@ -124,19 +129,28 @@ Partial Class Ventas_CatProcedimientoDetalle If CveProcedimiento > 0 Then If ObjVentas.UpdateProcedimiento(CveProcedimiento, TxtProcedimiento.Text.Trim, ChkEstatus.Checked, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa) Then + Alert($"Procedimiento Actualizado Correctamente.") ProcesoOK = True End If - 'Else - ' If ObjVentas.AddProcedimiento(TxtProcedimiento.Text.Trim, ChkEstatus.Checked, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa) Then - ' ProcesoOK = True - ' End If + Else + + CveProcedimiento = ObjVentas.AddProcedimiento(TxtProcedimiento.Text.Trim, ChkEstatus.Checked, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa) + If CveProcedimiento > 0 Then + ProcesoOK = True + TabProductos.Visible = True + TabVentas.Visible = True + LnkAgregarProducto.Visible = True + UpDatos.Update() + Alert($"Procedimiento Guardado Correctamente.") + End If + End If ObjVentas.Dispose() If ProcesoOK Then - Alert($"Procedimiento {If(CveProcedimiento > 0, "Actualizado", "Guardado")} Correctamente.") - RegistraScript("$('#DVAgregarProcedimiento').modal('hide');") + + 'RegistraScript("$('#DVAgregarProcedimiento').modal('hide');") CargaDatos() CargaGlobal() UpDatos.Update() diff --git a/Ventas/CatProcedimientos.aspx b/Ventas/CatProcedimientos.aspx index e47af474b..90624dd83 100644 --- a/Ventas/CatProcedimientos.aspx +++ b/Ventas/CatProcedimientos.aspx @@ -17,7 +17,8 @@
  • - + Agregar Procedimiento
  • diff --git a/Ventas/CatProcedimientos.aspx.vb b/Ventas/CatProcedimientos.aspx.vb index aeffa4613..038380e6e 100644 --- a/Ventas/CatProcedimientos.aspx.vb +++ b/Ventas/CatProcedimientos.aspx.vb @@ -56,7 +56,7 @@ Partial Class Ventas_CatProcedimientos ProcesoOK = True End If Else - If ObjVentas.AddProcedimiento(TxtProcedimiento.Text.Trim, ChkEstatus.Checked, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa) Then + If ObjVentas.AddProcedimiento(TxtProcedimiento.Text.Trim, ChkEstatus.Checked, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa) > 0 Then ProcesoOK = True End If End If diff --git a/Ventas/Ventas.aspx b/Ventas/Ventas.aspx index 84675133f..112dd042c 100644 --- a/Ventas/Ventas.aspx +++ b/Ventas/Ventas.aspx @@ -8428,7 +8428,7 @@
    - +
    @@ -8449,24 +8449,26 @@ <%--Medico Procedimiento--%>
    -
    - Médico: + +
    Seleccione uno - - + + Médico:
    -
    - Procedimiento: +
    Seleccione uno - + + Procedimiento:
    diff --git a/Ventas/Ventas.aspx.vb b/Ventas/Ventas.aspx.vb index 04c334b26..ae1336765 100644 --- a/Ventas/Ventas.aspx.vb +++ b/Ventas/Ventas.aspx.vb @@ -13508,8 +13508,8 @@ Partial Class Ventas End If End If - If ObjVentas.SincronizacionProcedimientoProducto(DdlProcedimiento.SelectedValue.ToEntero, factura.CveVenta, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa) Then - ErrorList.Add("Ocurrió un error al guardar la los productos al procedimiento") + If Not ObjVentas.SincronizacionProcedimientoProducto(DdlProcedimiento.SelectedValue.ToEntero, factura.CveVenta, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa) Then + ErrorList.Add("Ocurrió un error al guardar los productos al procedimiento") End If End If @@ -35734,7 +35734,7 @@ Partial Class Ventas If DdlProcedimientoModal.SelectedValue.ToEntero > 0 Then Dim objVenta As New ClsVentas - If objVenta.GetProcedimientoProducto(DdlProcedimientoModal.SelectedValue.ToEntero, -1, UsuarioActual.CveEmpresa) Then + If objVenta.GetProcedimientoProducto(DdlProcedimientoModal.SelectedValue.ToEntero, 1, UsuarioActual.CveEmpresa) Then GvProductosProcedimiento.DataSource = objVenta.DtResultados End If From 7c4837305612b90e83d85b2fc8c7f0835eee5628 Mon Sep 17 00:00:00 2001 From: rakcsle Date: Thu, 7 Dec 2023 09:58:42 -0700 Subject: [PATCH 6/6] Ventas Medicas correcion eliminacion de procedimiento --- App_Code/ClsVentas.vb | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/App_Code/ClsVentas.vb b/App_Code/ClsVentas.vb index a3217200f..5fc67aa40 100644 --- a/App_Code/ClsVentas.vb +++ b/App_Code/ClsVentas.vb @@ -6155,10 +6155,11 @@ Public Class ClsVentas Try SqlAdapter.Fill(Data) + 'SqlAdapter.SelectCommand.ExecuteNonQuery() Retorno = True Catch Ex1 As SqlException If Ex1.Message.Contains("Número: 547;") Then - Alert("La Procedimiento no se pudo eliminar porque está siendo usado por un registro.", TipoMensaje.MsgAdvertencia) + Alert("El procedimiento no se pudo eliminar porque está siendo usado por un registro.", TipoMensaje.MsgAdvertencia) Else OnError("Ocurrió un error al eliminar el Procedimiento.", Ex1, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) End If