From de2a614d070926a51dc4b5769e277ee478490d0c Mon Sep 17 00:00:00 2001 From: Jonathan Alexis Perez Morales Date: Mon, 18 Dec 2023 18:22:08 -0700 Subject: [PATCH 1/4] --regenerar codigo QR en pdf --- App_Code/ClsPaginas.vb | 17 +++++++++++++---- Compras/PopUpVerFactura.aspx.vb | 2 +- 2 files changed, 14 insertions(+), 5 deletions(-) diff --git a/App_Code/ClsPaginas.vb b/App_Code/ClsPaginas.vb index 87369aa67..156d4f212 100644 --- a/App_Code/ClsPaginas.vb +++ b/App_Code/ClsPaginas.vb @@ -5187,7 +5187,7 @@ Public Class ClsPaginas #End Region #Region "IMPRIMIR FACTURA" - Public Function PdfFactura(ByRef Vta As Modelos.Factura, Optional AplicaPagare As String = "0", Optional Guardar As Boolean = True, Optional SubReportData As Modelos.MSubReportData = Nothing, Optional UsarStimul As Boolean = False) As Byte() + Public Function PdfFactura(ByRef Vta As Modelos.Factura, Optional AplicaPagare As String = "0", Optional Guardar As Boolean = True, Optional SubReportData As Modelos.MSubReportData = Nothing, Optional UsarStimul As Boolean = False, Optional RegenerarQR As Boolean = False) As Byte() Dim retorno As Byte() = Nothing ' Dim ObjVentas As New ClsVentas 'DATOS GENERALES @@ -5489,9 +5489,18 @@ Public Class ClsPaginas End If End If 'Si no tiene CBB, SE GENERA - If Not ImagenCBB.Exists AndAlso Vta.FolioFiscal <> "" Then - Dim CBB As New ClbNegBICFDv3_2.ClsNegCBBGenerar() - CBB.GenerarCBB(UsuarioActual.Empresa.RFC, RFCReceptor, Vta.Total, Vta.FolioFiscal, RutaCBB) + If (Not ImagenCBB.Exists OrElse RegenerarQR) AndAlso Vta.FolioFiscal <> "" Then + 'Dim CBB As New ClbNegBICFDv3_2.ClsNegCBBGenerar() + 'CBB.GenerarCBB(UsuarioActual.Empresa.RFC, RFCReceptor, Vta.Total, Vta.FolioFiscal, RutaCBB) + Dim LigaVerificacionSAT As String = "https://verificacfdi.facturaelectronica.sat.gob.mx/default.aspx" + Try + Dim qrCode As New GoFac.QrCode() + Dim bCBB As Byte() = qrCode.GenerarQrCode($"{LigaVerificacionSAT}?re={UsuarioActual.Empresa.RFC}&rr={RFCReceptor}&tt={String.Format("{0,12:F6}", Vta.Total).Trim()}&id={Vta.FolioFiscal}&fe={Vta.SelloCFDi.Substring(Vta.SelloCFDi.Length - 8, 8)}") + File.WriteAllBytes(RutaCBB, bCBB) + bCBB = Nothing + Catch ex As Exception + GuardaLog("Ocurrió un error al generar el QR." + ex.ToString()) + End Try End If 'ImgCBB = String.Format("{0}://{1}:{2}/Empresas/{3}/CBB/{4}.jpg", Request.Url.Scheme.Replace("https", "http"), Request.Url.Host, Request.Url.Port, UsuarioActual.CveEmpresa, Vta.SerieFolio) diff --git a/Compras/PopUpVerFactura.aspx.vb b/Compras/PopUpVerFactura.aspx.vb index 3c5d123cc..c996c2303 100644 --- a/Compras/PopUpVerFactura.aspx.vb +++ b/Compras/PopUpVerFactura.aspx.vb @@ -3297,7 +3297,7 @@ Partial Class PopUpVerFactura If UsuarioActual.Empresa.CvePlataforma = 2 Then GeneraPDFVtaPyMe(Vta, "PDF") Else - ImprimirbytesPDF(PdfFactura(Vta, AplicaPagare:=AplicaPagare, Guardar:=True, SubReportData:=CartaPorte), Vta.SerieFolio, "PDF") + ImprimirbytesPDF(PdfFactura(Vta, AplicaPagare:=AplicaPagare, Guardar:=True, SubReportData:=CartaPorte, RegenerarQR:=True), Vta.SerieFolio, "PDF") Vta = Nothing End If Else From 8fb1a4f86630484a52e23486838ea854f7a999cc Mon Sep 17 00:00:00 2001 From: rakcsle Date: Tue, 19 Dec 2023 09:05:56 -0700 Subject: [PATCH 2/4] Cat Medicos Cambio Especialidad a Catalogo --- App_Code/ClsVentas.vb | 101 ++++++++++++++++++++-- Ventas/CatMedicos.aspx | 142 ++++++++++++++++++++++++------- Ventas/CatMedicos.aspx.vb | 155 ++++++++++++++++++++++++++++++++-- Ventas/CatProcedimientos.aspx | 2 + 4 files changed, 355 insertions(+), 45 deletions(-) diff --git a/App_Code/ClsVentas.vb b/App_Code/ClsVentas.vb index 0a2e40488..c80e830ff 100644 --- a/App_Code/ClsVentas.vb +++ b/App_Code/ClsVentas.vb @@ -5975,7 +5975,7 @@ Public Class ClsVentas #End Region -#Region "AGENTES" +#Region "MEDICOS" Public Function GetMedicos(CveMedico As Integer, CveEmpresa As Integer, Estatus As Integer, Optional Mes As Integer = -1) As Boolean @@ -6004,7 +6004,7 @@ Public Class ClsVentas Public Function AddMedico(Medico As String, CedulaProfesional As String, FechaNacimiento As Date, Notas As String, DiasAtencion As String, Horario As String, Lugar As String, Estatus As Boolean, CveUsuario As Integer, - CveEmpresa As Integer, Telefono As String, Mail As String, Especialidad As String, Celular As String, Consultorio As String) As Boolean + CveEmpresa As Integer, Telefono As String, Mail As String, CveMedicoEspecialidad As Integer, Celular As String, Consultorio As String) As Boolean Dim Retorno As Boolean = False DataAdapter("PA_Vta_MedicosAdd") @@ -6022,7 +6022,7 @@ Public Class ClsVentas .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa .Add("@Telefono", SqlDbType.VarChar).Value = Telefono .Add("@Mail", SqlDbType.VarChar).Value = Mail - .Add("@Especialidad", SqlDbType.VarChar).Value = Especialidad + .Add("@CveMedicoEspecialidad", SqlDbType.Int).Value = CveMedicoEspecialidad .Add("@Celular", SqlDbType.VarChar).Value = Celular .Add("@Consultorio", SqlDbType.VarChar).Value = Consultorio @@ -6039,7 +6039,7 @@ Public Class ClsVentas End Function Public Function UpdateMedico(CveMedico As Integer, Medico As String, CedulaProfesional As String, FechaNacimiento As Date, Notas As String, DiasAtencion As String, Horario As String, Lugar As String, Estatus As Boolean, CveUsuario As Integer, - CveEmpresa As Integer, Telefono As String, Mail As String, Especialidad As String, Celular As String, Consultorio As String) As Boolean + CveEmpresa As Integer, Telefono As String, Mail As String, CveMedicoEspecialidad As Integer, Celular As String, Consultorio As String) As Boolean Dim Retorno As Boolean = False DataAdapter("PA_Vta_MedicosUpdate") @@ -6057,7 +6057,7 @@ Public Class ClsVentas .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa .Add("@Telefono", SqlDbType.VarChar).Value = Telefono .Add("@Mail", SqlDbType.VarChar).Value = Mail - .Add("@Especialidad", SqlDbType.VarChar).Value = Especialidad + .Add("@CveMedicoEspecialidad", SqlDbType.Int).Value = CveMedicoEspecialidad .Add("@Celular", SqlDbType.VarChar).Value = Celular .Add("@Consultorio", SqlDbType.VarChar).Value = Consultorio @@ -6092,6 +6092,97 @@ Public Class ClsVentas #End Region + + +#Region "ESPECIALIDADES" + + Public Function GetMedicosEspecialidades(CveMedicoEspecialidad As Integer, CveEmpresa As Integer, Estatus As Integer) As Boolean + + Dim Retorno As Boolean = False + DataAdapter("PA_Vta_MedicosEspecialidadesGet") + + With SqlAdapter.SelectCommand.Parameters + .Add("@CveMedicoEspecialidad", SqlDbType.Int).Value = CveMedicoEspecialidad + .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa + .Add("@Estatus", SqlDbType.Int).Value = Estatus + End With + + Try + SqlAdapter.Fill(Data) + Retorno = True + Catch ex As Exception + OnError("Ocurrió un error al obtener las especialidades.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) + End Try + + Return Retorno + + End Function + + + + + Public Function AddMedicoEspecialidad(Especialidad As String, Estatus As Boolean, CveUsuario As Integer, CveEmpresa As Integer) As Boolean + + Dim Retorno As Boolean = False + DataAdapter("PA_Vta_MedicosEspecialidadesAdd") + + With SqlAdapter.SelectCommand.Parameters + .Add("@Especialidad", SqlDbType.VarChar).Value = Especialidad + .Add("@Estatus", SqlDbType.Bit).Value = Estatus + .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 guardar la especialidad.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) + End Try + Return Retorno + + End Function + + Public Function UpdateMedicoEspecialidad(CveMedicoEspecialidad As Integer, Especialidad As String, Estatus As Boolean, CveUsuario As Integer, CveEmpresa As Integer) As Boolean + + Dim Retorno As Boolean = False + DataAdapter("PA_Vta_MedicosEspecialidadesUpdate") + With SqlAdapter.SelectCommand.Parameters + .Add("@CveMedicoEspecialidad", SqlDbType.Int).Value = CveMedicoEspecialidad + .Add("@Especialidad", SqlDbType.VarChar).Value = Especialidad + .Add("@Estatus", SqlDbType.Bit).Value = Estatus + .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 actualizar la especialidad.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) + End Try + Return Retorno + + End Function + + Public Function RemoveMedicoEspecialidad(CveMedicoEspecialidad As Integer, CveEmpresa As Integer) As Boolean + + Dim Retorno As Boolean = False + DataAdapter("PA_Vta_MedicosEspecialidadesRemove") + With SqlAdapter.SelectCommand.Parameters + .Add("@CveMedicoEspecialidad", SqlDbType.Int).Value = CveMedicoEspecialidad + .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa + End With + Try + SqlAdapter.Fill(Data) + Retorno = True + Catch ex As Exception + OnError("Ocurrió un error al eliminar la especialidad.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) + End Try + Return Retorno + + End Function + +#End Region + #Region "PRODEDIMIENTOS" Public Function GetProcedimientos(CveProcedimiento As Integer, CveEmpresa As Integer, Estatus As Integer) As Boolean diff --git a/Ventas/CatMedicos.aspx b/Ventas/CatMedicos.aspx index 34d173a10..43dac9df2 100644 --- a/Ventas/CatMedicos.aspx +++ b/Ventas/CatMedicos.aspx @@ -19,6 +19,10 @@
  • +
  • + +
  • +
  • Excel
  • @@ -220,7 +224,7 @@
    @@ -305,6 +309,69 @@ + + + + + + + +
    + " style="display: inline-block; margin-right: -20px; width: 150px;" /> + " style="margin-top: -3px;" class="btn btn-circle btn-sm label-info"> +
    +
    +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    +
    + + +
    +
    + +
    +
    + @@ -343,7 +410,7 @@
    -
    +
    @@ -361,10 +428,6 @@
    - - - -
    @@ -372,7 +435,6 @@
    -
    @@ -406,18 +468,13 @@
    - - + +
    - - - - -
    @@ -468,19 +525,56 @@
    -
    +
    +
    + + -
    - <%----%> -
    -<%-- --%> - diff --git a/Ventas/CatMedicos.aspx.vb b/Ventas/CatMedicos.aspx.vb index e295a7207..419d38669 100644 --- a/Ventas/CatMedicos.aspx.vb +++ b/Ventas/CatMedicos.aspx.vb @@ -19,10 +19,29 @@ Partial Class Ventas_CatMedicos End Set End Property + + + Public Property CveMedicoEspecialidad As Integer + Get + If ViewState("CveMedicoEspecialidad") Is Nothing Then + ViewState("CveMedicoEspecialidad") = -1 + End If + Return ViewState("CveMedicoEspecialidad").ToString.ToEntero + End Get + Set(value As Integer) + ViewState("CveMedicoEspecialidad") = value + End Set + End Property + + + + + Protected Sub Page_Load(sender As Object, e As System.EventArgs) Handles Me.Load If Not Page.IsPostBack Then CargaCombos() CargaDatos() + CargaEspecialidad() BtnConsultar_Click(Nothing, Nothing) End If End Sub @@ -61,12 +80,12 @@ Partial Class Ventas_CatMedicos If CveMedico > 0 Then If ObjVentas.UpdateMedico(CveMedico, TxtMedico.Text.Trim, TxtCedulaProfecional.Text.Trim, TxtFechaNacimiento.Text.ToDate, TxtNotas.Text.Trim, TxtDiasAtencion.Text.Trim, TxtHorario.Text.Trim, TxtLugar.Text.Trim, ChkEstatus.Checked, - UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, Telefono, TxtMail.Text, TxtEspecialidad.Text, Celular, TxtConsultorio.Text.Trim) Then + UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, Telefono, TxtMail.Text, DdlEspecialidad.SelectedValue.ToEntero, Celular, TxtConsultorio.Text.Trim) Then ProcesoOK = True End If Else If ObjVentas.AddMedico(TxtMedico.Text.Trim, TxtCedulaProfecional.Text.Trim, TxtFechaNacimiento.Text.ToDate, TxtNotas.Text.Trim, TxtDiasAtencion.Text.Trim, TxtHorario.Text.Trim, TxtLugar.Text.Trim, ChkEstatus.Checked, UsuarioActual.CveUsuario, - UsuarioActual.CveEmpresa, Telefono, TxtMail.Text, TxtEspecialidad.Text, Celular, TxtConsultorio.Text.Trim) Then + UsuarioActual.CveEmpresa, Telefono, TxtMail.Text, DdlEspecialidad.SelectedValue.ToEntero, Celular, TxtConsultorio.Text.Trim) Then ProcesoOK = True End If End If @@ -138,7 +157,7 @@ Partial Class Ventas_CatMedicos TxtMail.Text = "" TxtTelefono.Text = "" TxtCelular.Text = "" - TxtEspecialidad.Text = "" + DdlEspecialidad.SelectedValueExist(-1) DVEstatus.Visible = False ChkEstatus.Checked = True @@ -168,7 +187,8 @@ Partial Class Ventas_CatMedicos TxtMail.Text = GvRow.DataKey("Mail") TxtTelefono.Text = GvRow.DataKey("Telefono") TxtCelular.Text = GvRow.DataKey("Celular") - TxtEspecialidad.Text = GvRow.DataKey("Especialidad") + DdlEspecialidad.SelectedValueExist(-1) + DdlEspecialidad.SelectedValueExist(GvRow.DataKey("CveMedicoEspecialidad").ToEntero) DVEstatus.Visible = True LbAgregar.Text = "Actualizar" @@ -244,12 +264,18 @@ Partial Class Ventas_CatMedicos SbFiltros.AppendFormat($"Fecha Inicio: {txtFechaI.Text} Fecha Fin: {txtFechaF.Text}|") SbFiltros.Append($"Grupo:{DdlGrupo.SelectedItem.Text}, Médico: {DdlMedico.SelectedItem.Text}, Procedimiento: {DdlProcedimiento.SelectedItem.Text}") GvIndicadores.ExportToExcelGembox("IndicadoresMedicos", UsuarioActual, "Indicadores Médicos", DatoTituloExtra:=$"", DatosFiltros:=SbFiltros.ToString()) - Else + ElseIf Tabs.ActiveTabIndex = 1 Then GvDatos.Columns(10).Visible = False Dim SbFiltros As New StringBuilder() SbFiltros.AppendFormat($"Fecha Inicio: {txtFechaI.Text} Fecha Fin: {txtFechaF.Text}|") GvDatos.ExportToExcelGembox("CatMedicos", UsuarioActual, "Catálogo de Médicos", DatoTituloExtra:=$"", DatosFiltros:=SbFiltros.ToString()) GvDatos.Columns(10).Visible = True + ElseIf Tabs.ActiveTabIndex = 2 Then + GvEspecialidad.Columns(4).Visible = False + Dim SbFiltros As New StringBuilder() + SbFiltros.AppendFormat($"Fecha Inicio: {txtFechaI.Text} Fecha Fin: {txtFechaF.Text}|") + GvEspecialidad.ExportToExcelGembox("CatEspecialidades", UsuarioActual, "Catálogo de Especialidades", DatoTituloExtra:=$"", DatosFiltros:=SbFiltros.ToString()) + GvEspecialidad.Columns(4).Visible = True End If @@ -299,12 +325,125 @@ Partial Class Ventas_CatMedicos RegistraScript("$('#DVModalCumple').modal();") End Sub + Protected Sub btnConsultarcumpleAnios_Click(sender As Object, e As EventArgs) + CargaCyumpleAnios() + End Sub + +#End Region + + +#Region "Especialidad" + + + Protected Sub LnkAgregarEspecialidad_Click(sender As Object, e As EventArgs) + CveMedicoEspecialidad = -1 + DVEstatusEspecialidad.Visible = False + LimpiarModalEspecialdiad() + RegistraScript("$('#DVAgregarEspecialidad').modal();") + + End Sub + + Protected Sub BtnAgergarEspecialidad_Click(sender As Object, e As EventArgs) + + Dim ObjVentas As New ClsVentas + Dim ProcesoOK As Boolean = True + + If CveMedicoEspecialidad > 0 Then + If Not ObjVentas.UpdateMedicoEspecialidad(CveMedicoEspecialidad, TxtEspecialidad.Text.Trim, ChkEstatusEspecialidad.Checked, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa) Then + ProcesoOK = False + End If + Else + If Not ObjVentas.AddMedicoEspecialidad(TxtEspecialidad.Text.Trim, True, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa) Then + ProcesoOK = False + End If + End If + + ObjVentas.Dispose() + + If ProcesoOK Then + CargaEspecialidad() + Alert($"Especialidad {If(CveMedicoEspecialidad > 0, "actualizada", "agregada")} correctamente.") + RegistraScript("$('#DVAgregarEspecialidad').modal('hide');") + End If + + End Sub + + Sub LimpiarModalEspecialdiad() + TxtEspecialidad.Text = "" + ChkEstatusEspecialidad.Checked = True + UpModalEspecialidad.Update() + End Sub + Sub CargaEspecialidad() + Dim ObjVentas As New ClsVentas + + If ObjVentas.GetMedicosEspecialidades(-1, UsuarioActual.CveEmpresa, -1) Then + GvEspecialidad.DataSource = ObjVentas.DtResultados + DdlEspecialidad.DataSource = ObjVentas.DtResultados + Else + GvEspecialidad.DataSource = Nothing + End If + + ObjVentas.Dispose() + + GvEspecialidad.DataBind() + + DdlEspecialidad.DataBind() + DdlEspecialidad.Items.Insert(0, New ListItem("Seleccione uno", "-1")) + + UpModal.Update() + UpEspecialidad.Update() + + End Sub + + Protected Sub LnkEditarEspecialidad_Click(sender As Object, e As EventArgs) + + Dim GvRow As GridViewRow = DirectCast(DirectCast(sender, LinkButton).NamingContainer, GridViewRow) + + + CveMedicoEspecialidad = GvRow.DataKey("CveMedicoEspecialidad").ToEntero + TxtEspecialidad.Text = GvRow.DataKey("Especialidad") + ChkEstatusEspecialidad.Checked = Boolean.Parse(GvRow.DataKey("Estatus").ToString) + DVEstatusEspecialidad.Visible = True + UpModalEspecialidad.Update() + + RegistraScript("$('#DVAgregarEspecialidad').modal();") + + + + End Sub + + Protected Sub LnkEliminarEspecialidad_Click(sender As Object, e As EventArgs) + + Dim ProcesoOK As Boolean = True + + Dim GvRow As GridViewRow = DirectCast(DirectCast(sender, LinkButton).NamingContainer, GridViewRow) + + Dim CveMedicoEspecialidadEliminar As Integer = GvRow.DataKey("CveMedicoEspecialidad").ToEntero + + Dim ObjVentas As New ClsVentas + + If Not ObjVentas.RemoveMedicoEspecialidad(CveMedicoEspecialidadEliminar, UsuarioActual.CveEmpresa) Then + ProcesoOK = False + End If + + ObjVentas.Dispose() + + If ProcesoOK Then + CargaEspecialidad() + Alert("Especialidad eliminada correctamente") + End If + + + End Sub #End Region - Protected Sub btnConsultarcumpleAnios_Click(sender As Object, e As EventArgs) - CargaCyumpleAnios() - End Sub + + + + + + End Class diff --git a/Ventas/CatProcedimientos.aspx b/Ventas/CatProcedimientos.aspx index 83fe3f29a..aca7cafe3 100644 --- a/Ventas/CatProcedimientos.aspx +++ b/Ventas/CatProcedimientos.aspx @@ -276,6 +276,8 @@ + + From 8ddf496444d6aa369a955c355333e82f79cac064 Mon Sep 17 00:00:00 2001 From: rakcsle Date: Tue, 19 Dec 2023 10:18:35 -0700 Subject: [PATCH 3/4] ClsClientes CveAlmacenAsignado --- App_Code/ClsClientes.vb | 2 + Inventarios/EntradasSalidas.aspx | 157 ++++++++++++++++++------------- Ventas/CatMedicos.aspx | 9 +- 3 files changed, 100 insertions(+), 68 deletions(-) diff --git a/App_Code/ClsClientes.vb b/App_Code/ClsClientes.vb index 5dc696c7b..93410cced 100644 --- a/App_Code/ClsClientes.vb +++ b/App_Code/ClsClientes.vb @@ -161,6 +161,7 @@ Public Class ClsClientes Public Property RegimenFiscal As String Public Property RepresentanteLegal As String Public Property UsaProductoAlterno As Boolean = False + Public Property CveAlmacenAsignado As Integer = -1 #End Region @@ -408,6 +409,7 @@ Public Class ClsClientes _CodigoRegimenFiscal = Data(0)("CodigoRegimenFiscal").ToString _RepresentanteLegal = Data(0)("RepresentanteLegal").ToString _UsaProductoAlterno = CBool(Data(0)("UsaProductoAlterno")) + Me.CveAlmacenAsignado = Data(0)("CveAlmacenAsignado").ToString.ToEntero End If Retorno = True diff --git a/Inventarios/EntradasSalidas.aspx b/Inventarios/EntradasSalidas.aspx index 676e02e1a..399ce3807 100644 --- a/Inventarios/EntradasSalidas.aspx +++ b/Inventarios/EntradasSalidas.aspx @@ -1655,69 +1655,94 @@