From 2e76b947c99d84511434a80aa98e11d3a131a985 Mon Sep 17 00:00:00 2001 From: Jonathan Alexis Perez Morales Date: Tue, 13 Feb 2024 03:20:53 -0700 Subject: [PATCH 1/7] --Al crear/actualizar ps, precios, clientes a la otra empresa FUNC 563 --- App_Code/ClsClientes.vb | 26 +++ App_Code/ClsVentas.vb | 6 +- Ventas/CatPreciosLista.aspx.vb | 357 ++++++++++++++++-------------- Ventas/Clientes.aspx.vb | 27 ++- Ventas/ProductosServicios.aspx.vb | 2 +- 5 files changed, 248 insertions(+), 170 deletions(-) diff --git a/App_Code/ClsClientes.vb b/App_Code/ClsClientes.vb index 54fe23b28..bd5384c25 100644 --- a/App_Code/ClsClientes.vb +++ b/App_Code/ClsClientes.vb @@ -890,6 +890,32 @@ Public Class ClsClientes ' Return Retorno 'End Function + Public Function UpdateClienteFranquicia(CveCliente As Integer, CveEmpresaActual As Integer, CveEmpresaFranquicia As Integer) As Boolean + Dim Retorno As Boolean = False + + DataAdapter("PA_Vta_ClientesFranquiciaUpdate") + + With SqlAdapter.SelectCommand.Parameters + .Add("@CveCliente", SqlDbType.Int).Value = CveCliente + .Add("@CveEmpresaActual", SqlDbType.Int).Value = CveEmpresaActual + .Add("@CveEmpresaFranquicia", SqlDbType.Int).Value = CveEmpresaFranquicia + End With + + Try + SqlAdapter.Fill(Data) + Retorno = True + Catch Ex1 As SqlException + If Ex1.Message.Contains("Número: 2627;") Then + Alert("El Cliente no se guardo debido a que actualmente se encuentra registrado", TipoMensaje.MsgAdvertencia) + Else + Me.OnError("Ocurrió un error al intentar Actualizar los datos del Cliente.", Ex1, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) + End If + Catch ex As Exception + OnError("Ocurrió un error al intentar Actualizar los datos del Cliente.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) + End Try + Return Retorno + End Function + Public Function UpdateClientePersonaFisica(CveCliente As Integer, ApellidoPaterno As String, ApellidoMaterno As String, Nombres As String) As Boolean Dim Retorno As Boolean = False diff --git a/App_Code/ClsVentas.vb b/App_Code/ClsVentas.vb index 6f7c546d5..dec991bdb 100644 --- a/App_Code/ClsVentas.vb +++ b/App_Code/ClsVentas.vb @@ -2052,7 +2052,7 @@ Public Class ClsVentas Return Retorno End Function - Public Function AddPrecioLista(CveUsuario As Integer, CveEmpresa As Integer, PrecioLista As String, Predeterminada As Boolean, Porcentaje As Double, Optional CvePrecioListaClonar As Integer = -1) As Integer + Public Function AddPrecioLista(CveUsuario As Integer, CveEmpresa As Integer, PrecioLista As String, Predeterminada As Boolean, Porcentaje As Double, Optional CvePrecioListaClonar As Integer = -1, Optional UpdateFranquicia As Boolean = False) As Integer Dim Retorno As Integer = -1 DataAdapter("PA_Vta_PrecioListaAdd") @@ -2064,6 +2064,7 @@ Public Class ClsVentas .Add("@Porcentaje", SqlDbType.SmallMoney).Value = Porcentaje .Add("@Predeterminada", SqlDbType.Bit).Value = Predeterminada .Add("@CvePrecioListaClonar", SqlDbType.Int).Value = CvePrecioListaClonar + .Add("@UpdateFranquicia", SqlDbType.Bit).Value = UpdateFranquicia .Add("@CvePrecioLista", SqlDbType.Int).Direction = ParameterDirection.Output End With @@ -2084,7 +2085,7 @@ Public Class ClsVentas End Function Public Function UpdatePrecioLista(PrecioLista As String, Estatus As Boolean, CveUsuario As Integer, Porcentaje As Double, - Predeterminada As Boolean, CvePrecioLista As Integer) As Boolean + Predeterminada As Boolean, CvePrecioLista As Integer, Optional UpdateFranquicia As Boolean = False) As Boolean Dim Retorno As Boolean = False DataAdapter("PA_Vta_PrecioListaUpdate") @@ -2096,6 +2097,7 @@ Public Class ClsVentas .Add("@Porcentaje", SqlDbType.SmallMoney).Value = Porcentaje .Add("@Predeterminada", SqlDbType.Bit).Value = Predeterminada .Add("@CvePrecioLista", SqlDbType.Int).Value = CvePrecioLista + .Add("@UpdateFranquicia", SqlDbType.Bit).Value = UpdateFranquicia End With Try diff --git a/Ventas/CatPreciosLista.aspx.vb b/Ventas/CatPreciosLista.aspx.vb index 2d3069d5b..70a637066 100644 --- a/Ventas/CatPreciosLista.aspx.vb +++ b/Ventas/CatPreciosLista.aspx.vb @@ -65,25 +65,44 @@ Partial Class Ventas_CatPreciosLista End Sub Protected Sub BtnAgregarCatalogo_Click(sender As Object, e As EventArgs) Handles BtnAgregarCatalogo.Click - Dim ObjVta As New ClsVentas + Dim ActualizarFranquicias As Boolean = False - If EsEditar = 0 Then - If ObjVta.AddPrecioLista(UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, TxtPrecioLista.Text, ChkPredeterminada.Checked, 0) > 0 Then - Alert("El Precio de Lista se agregó correctamente", TipoMensaje.MsgInformacion) - Else - Alert("Ocurrió un error al agregar el Precio de Lista", TipoMensaje.MsgError) - End If - ElseIf EsEditar = 1 Then - If ObjVta.UpdatePrecioLista(TxtPrecioLista.Text, chkEstatus.Checked, UsuarioActual.CveUsuario, 0, ChkPredeterminada.Checked, CvePrecioLista) Then - Alert("El Precio de Lista se editó correctamente", TipoMensaje.MsgInformacion) - Else - Alert("Ocurrió un error al editar al Precio de Lista", TipoMensaje.MsgError) - End If - EsEditar = 0 - dvEstatus.Visible = False - BtnAgregarCatalogo.Text = "Agregar" + If UsuarioActual.Empresa.Funcionalidad(563) <> "" AndAlso UsuarioActual.Empresa.Funcionalidad(109) = "1" Then + ActualizarFranquicias = True + End If + + Dim ObjVta As New ClsVentas + ObjVta.IniciaTransacSQL() + Dim TieneError As Boolean = False + Try + If EsEditar = 0 Then + If ObjVta.AddPrecioLista(UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, TxtPrecioLista.Text, ChkPredeterminada.Checked, 0, UpdateFranquicia:=ActualizarFranquicias) > 0 Then + Alert("El Precio de Lista se agregó correctamente", TipoMensaje.MsgInformacion) + Else + Alert("Ocurrió un error al agregar el Precio de Lista", TipoMensaje.MsgError) + TieneError = True + End If + ElseIf EsEditar = 1 Then + If ObjVta.UpdatePrecioLista(TxtPrecioLista.Text, chkEstatus.Checked, UsuarioActual.CveUsuario, 0, ChkPredeterminada.Checked, CvePrecioLista, UpdateFranquicia:=ActualizarFranquicias) Then + Alert("El Precio de Lista se editó correctamente", TipoMensaje.MsgInformacion) + Else + Alert("Ocurrió un error al editar al Precio de Lista", TipoMensaje.MsgError) + TieneError = True + End If + EsEditar = 0 + dvEstatus.Visible = False + BtnAgregarCatalogo.Text = "Agregar" + End If + Catch ex As Exception + TieneError = True + GuardaLog(ex.ToString()) + End Try + + If TieneError Then + ObjVta.RollBack() + Else + ObjVta.Commit() End If - GlobalDTPrecioListas(UsuarioActual.CveEmpresa) = Nothing RegistraScript("$('#divAgregar').modal('hide')") ObjVta.Dispose() @@ -94,6 +113,7 @@ Partial Class Ventas_CatPreciosLista UpDatos.Update() UpBodyCo.Update() + RecargaGlobal() End Sub Protected Sub GvDatos_RowDeleting(sender As Object, e As System.Web.UI.WebControls.GridViewDeleteEventArgs) Handles GvDatos.RowDeleting @@ -105,6 +125,8 @@ Partial Class Ventas_CatPreciosLista ObjPrecioLista.Dispose() CargaDatos() UpDatos.Update() + + RecargaGlobal() End Sub Protected Sub GvDatos_RowDataBound(sender As Object, e As System.Web.UI.WebControls.GridViewRowEventArgs) Handles GvDatos.RowDataBound @@ -131,155 +153,158 @@ Partial Class Ventas_CatPreciosLista dvEstatus.Visible = False UpBodyCo.Update() UpFooter.Update() - End Sub - + End Sub + Private Sub RecargaGlobal() + GlobalDTPrecioListas(UsuarioActual.CveEmpresa) = Nothing + End Sub + #Region "VIEJO" - ' Public Property PuedeEliminar As Boolean - ' Get - ' Return CBool(ViewState("PuedeEditar")) - ' End Get - ' Set(value As Boolean) - ' ViewState("PuedeEditar") = value - ' End Set - ' End Property - - ' Protected Sub Page_Load(sender As Object, e As System.EventArgs) Handles Me.Load - ' If Not Page.IsPostBack Then - - ' CargaDatos() - - ' 'Permiso Registro - ' If UsuarioActual.TienePermisoProceso(132) Then LbAgregar.Enabled = True Else LbAgregar.Enabled = False - - ' 'Permiso Eliminar - ' If UsuarioActual.TienePermisoProceso(134) Then GvDatos.Columns(5).Visible = True Else GvDatos.Columns(6).Visible = False - ' End If - ' End Sub - - ' Private Sub CargaDatos() - ' Dim ObjListas As New ClsVentas - ' If ObjListas.GetPrecioListas(CveEmpresa:=UsuarioActual.CveEmpresa) Then - ' GvDatos.DataSource = ObjListas.DtResultados - ' GvDatos.DataBind() - ' Else - ' Me.GvDatos.DataSource = Nothing - ' End If - - ' If ObjListas.GetPrecioListas(-1) Then - ' GlobalDTPrecioListas(-1) = ObjListas.DtResultados - ' End If - - ' ObjListas.Dispose() - ' OrdenaDatos() - ' End Sub - - ' Protected Sub LbAgregar_Click(sender As Object, e As System.EventArgs) Handles LbAgregar.Click - ' Dim ObjListas As New ClsVentas - - ' If HdnModalidad.Value = "I" Then - ' If ObjListas.AddPrecioLista(UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, TxtPrecioLista.Text.Trim, TxtPorcentaje.Text.Trim.ToDouble) Then - ' TxtPrecioLista.Text = "" - ' TxtPorcentaje.Text = "" - ' Alert("La nueva Lista se guardó correctamente.", TipoMensaje.MsgInformacion) - ' UpTitulos.Update() - ' CargaDatos() - ' UpDatos.Update() - ' OcultaDiv() - ' End If - ' ObjListas.Dispose() - ' Else - ' If HdnID.Value.ToEntero <> -1 Then - ' If ObjListas.UpdatePrecioLista(TxtPrecioLista.Text.Trim, True, UsuarioActual.CveUsuario, TxtPorcentaje.Text.Trim.ToDouble, HdnID.Value.ToEntero) Then - ' TxtPrecioLista.Text = "" - ' TxtPorcentaje.Text = "" - ' Alert("La lista se actualizó correctamente.", TipoMensaje.MsgInformacion) - ' UpTitulos.Update() - ' CargaDatos() - ' UpDatos.Update() - ' OcultaDiv() - ' End If - ' End If - ' End If - - ' End Sub - - '#Region "G V D A T O S" - ' Protected Sub GvDatos_RowDataBound(sender As Object, e As System.Web.UI.WebControls.GridViewRowEventArgs) Handles GvDatos.RowDataBound - ' If e.Row.RowType = DataControlRowType.DataRow Then - - - ' Dim URL As String = String.Format("javascript:CleanObjects();SetValue('HdnModalidad', 'U');SetValue('HdnID', '{0}'); SetObjects('{1}','{2}');ShowDivRegistro();return false;", e.Row.DBCampo("CvePrecioLista").ToEntero, e.Row.DBCampo("PrecioLista"), e.Row.DBCampo("Porcentaje")) - - ' 'GeneroLigas - ' Dim Liga As String = String.Format("", URL) - ' e.Row.VerticalAlign = VerticalAlign.Middle - ' e.Row.FCLinkButton("ImgE").OnClientClick = URL - ' End If - - - - ' End Sub - - ' Protected Sub GvDatos_RowDeleting(sender As Object, e As System.Web.UI.WebControls.GridViewDeleteEventArgs) Handles GvDatos.RowDeleting - ' Dim ObjListas As New ClsVentas - ' If ObjListas.RemovePrecioLista(GvDatos.DataKeys(e.RowIndex).Value.ToString.ToEntero) Then - ' GvDatos.EditIndex = -1 - ' ViewState("DTPrecioListas") = ObjListas.DtResultados.FiltraParametros("CveEmpresa = " & UsuarioActual.CveEmpresa) - ' Alert("La Lista se eliminó correctamente.", TipoMensaje.MsgInformacion) - ' End If - - ' If ObjListas.GetPrecioListas(-1) Then - ' GlobalDTPrecioListas(-1) = ObjListas.DtResultados - ' End If - - ' ObjListas.Dispose() - - ' CargaDatos() - ' UpDatos.Update() - ' End Sub - - - - ' Protected Sub GvDatos_RowUpdating(sender As Object, e As System.Web.UI.WebControls.GridViewUpdateEventArgs) Handles GvDatos.RowUpdating - ' Dim ObjListas As New ClsVentas - ' Dim PrecioLista As String = DirectCast(GvDatos.Rows(e.RowIndex).FindControl("TxtPrecioLista"), TextBox).Text.Trim - ' Dim Porcentaje As Double = DirectCast(GvDatos.Rows(e.RowIndex).FindControl("TxtPorcentaje"), TextBox).Text.Trim.ToDouble - ' Dim Estatus As Boolean = GvDatos.Rows(e.RowIndex).FCCheckBox("ChkEstatus").Checked - ' Dim CvePrecioLista As Integer = GvDatos.DataKeys(e.RowIndex).Value.ToString.ToEntero - - ' If ObjListas.UpdatePrecioLista(PrecioLista, Estatus, UsuarioActual.CveUsuario, Porcentaje, CvePrecioLista) Then - ' GvDatos.EditIndex = -1 - ' ViewState("DTPrecioListas") = ObjListas.DtResultados.FiltraParametros("CveEmpresa = " & UsuarioActual.CveEmpresa) - ' Alert("Los cambios se guardaron correctamente.", TipoMensaje.MsgInformacion) - ' End If - - ' If ObjListas.GetPrecioListas(-1) Then - ' GlobalDTPrecioListas(-1) = ObjListas.DtResultados - ' End If - - ' ObjListas.Dispose() - - ' OrdenaDatos() - ' End Sub - - '#End Region - - - '#Region " O R D E N A M I E N T O JAVASCRIPT" - ' Private Sub OrdenaDatos() - ' If (GvDatos.Rows.Count > 0) Then - ' GvDatos.UseAccessibleHeader = True - ' GvDatos.HeaderRow.TableSection = TableRowSection.TableHeader - ' RegistraScript("OrdenarGV();") - ' End If - ' End Sub - '#End Region - - - - ' Private Sub OcultaDiv() - ' ScriptManager.RegisterStartupScript(Me, Me.GetType, "Llave", "HideDivRegistro();", True) - ' End Sub + ' Public Property PuedeEliminar As Boolean + ' Get + ' Return CBool(ViewState("PuedeEditar")) + ' End Get + ' Set(value As Boolean) + ' ViewState("PuedeEditar") = value + ' End Set + ' End Property + + ' Protected Sub Page_Load(sender As Object, e As System.EventArgs) Handles Me.Load + ' If Not Page.IsPostBack Then + + ' CargaDatos() + + ' 'Permiso Registro + ' If UsuarioActual.TienePermisoProceso(132) Then LbAgregar.Enabled = True Else LbAgregar.Enabled = False + + ' 'Permiso Eliminar + ' If UsuarioActual.TienePermisoProceso(134) Then GvDatos.Columns(5).Visible = True Else GvDatos.Columns(6).Visible = False + ' End If + ' End Sub + + ' Private Sub CargaDatos() + ' Dim ObjListas As New ClsVentas + ' If ObjListas.GetPrecioListas(CveEmpresa:=UsuarioActual.CveEmpresa) Then + ' GvDatos.DataSource = ObjListas.DtResultados + ' GvDatos.DataBind() + ' Else + ' Me.GvDatos.DataSource = Nothing + ' End If + + ' If ObjListas.GetPrecioListas(-1) Then + ' GlobalDTPrecioListas(-1) = ObjListas.DtResultados + ' End If + + ' ObjListas.Dispose() + ' OrdenaDatos() + ' End Sub + + ' Protected Sub LbAgregar_Click(sender As Object, e As System.EventArgs) Handles LbAgregar.Click + ' Dim ObjListas As New ClsVentas + + ' If HdnModalidad.Value = "I" Then + ' If ObjListas.AddPrecioLista(UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, TxtPrecioLista.Text.Trim, TxtPorcentaje.Text.Trim.ToDouble) Then + ' TxtPrecioLista.Text = "" + ' TxtPorcentaje.Text = "" + ' Alert("La nueva Lista se guardó correctamente.", TipoMensaje.MsgInformacion) + ' UpTitulos.Update() + ' CargaDatos() + ' UpDatos.Update() + ' OcultaDiv() + ' End If + ' ObjListas.Dispose() + ' Else + ' If HdnID.Value.ToEntero <> -1 Then + ' If ObjListas.UpdatePrecioLista(TxtPrecioLista.Text.Trim, True, UsuarioActual.CveUsuario, TxtPorcentaje.Text.Trim.ToDouble, HdnID.Value.ToEntero) Then + ' TxtPrecioLista.Text = "" + ' TxtPorcentaje.Text = "" + ' Alert("La lista se actualizó correctamente.", TipoMensaje.MsgInformacion) + ' UpTitulos.Update() + ' CargaDatos() + ' UpDatos.Update() + ' OcultaDiv() + ' End If + ' End If + ' End If + + ' End Sub + + '#Region "G V D A T O S" + ' Protected Sub GvDatos_RowDataBound(sender As Object, e As System.Web.UI.WebControls.GridViewRowEventArgs) Handles GvDatos.RowDataBound + ' If e.Row.RowType = DataControlRowType.DataRow Then + + + ' Dim URL As String = String.Format("javascript:CleanObjects();SetValue('HdnModalidad', 'U');SetValue('HdnID', '{0}'); SetObjects('{1}','{2}');ShowDivRegistro();return false;", e.Row.DBCampo("CvePrecioLista").ToEntero, e.Row.DBCampo("PrecioLista"), e.Row.DBCampo("Porcentaje")) + + ' 'GeneroLigas + ' Dim Liga As String = String.Format("", URL) + ' e.Row.VerticalAlign = VerticalAlign.Middle + ' e.Row.FCLinkButton("ImgE").OnClientClick = URL + ' End If + + + + ' End Sub + + ' Protected Sub GvDatos_RowDeleting(sender As Object, e As System.Web.UI.WebControls.GridViewDeleteEventArgs) Handles GvDatos.RowDeleting + ' Dim ObjListas As New ClsVentas + ' If ObjListas.RemovePrecioLista(GvDatos.DataKeys(e.RowIndex).Value.ToString.ToEntero) Then + ' GvDatos.EditIndex = -1 + ' ViewState("DTPrecioListas") = ObjListas.DtResultados.FiltraParametros("CveEmpresa = " & UsuarioActual.CveEmpresa) + ' Alert("La Lista se eliminó correctamente.", TipoMensaje.MsgInformacion) + ' End If + + ' If ObjListas.GetPrecioListas(-1) Then + ' GlobalDTPrecioListas(-1) = ObjListas.DtResultados + ' End If + + ' ObjListas.Dispose() + + ' CargaDatos() + ' UpDatos.Update() + ' End Sub + + + + ' Protected Sub GvDatos_RowUpdating(sender As Object, e As System.Web.UI.WebControls.GridViewUpdateEventArgs) Handles GvDatos.RowUpdating + ' Dim ObjListas As New ClsVentas + ' Dim PrecioLista As String = DirectCast(GvDatos.Rows(e.RowIndex).FindControl("TxtPrecioLista"), TextBox).Text.Trim + ' Dim Porcentaje As Double = DirectCast(GvDatos.Rows(e.RowIndex).FindControl("TxtPorcentaje"), TextBox).Text.Trim.ToDouble + ' Dim Estatus As Boolean = GvDatos.Rows(e.RowIndex).FCCheckBox("ChkEstatus").Checked + ' Dim CvePrecioLista As Integer = GvDatos.DataKeys(e.RowIndex).Value.ToString.ToEntero + + ' If ObjListas.UpdatePrecioLista(PrecioLista, Estatus, UsuarioActual.CveUsuario, Porcentaje, CvePrecioLista) Then + ' GvDatos.EditIndex = -1 + ' ViewState("DTPrecioListas") = ObjListas.DtResultados.FiltraParametros("CveEmpresa = " & UsuarioActual.CveEmpresa) + ' Alert("Los cambios se guardaron correctamente.", TipoMensaje.MsgInformacion) + ' End If + + ' If ObjListas.GetPrecioListas(-1) Then + ' GlobalDTPrecioListas(-1) = ObjListas.DtResultados + ' End If + + ' ObjListas.Dispose() + + ' OrdenaDatos() + ' End Sub + + '#End Region + + + '#Region " O R D E N A M I E N T O JAVASCRIPT" + ' Private Sub OrdenaDatos() + ' If (GvDatos.Rows.Count > 0) Then + ' GvDatos.UseAccessibleHeader = True + ' GvDatos.HeaderRow.TableSection = TableRowSection.TableHeader + ' RegistraScript("OrdenarGV();") + ' End If + ' End Sub + '#End Region + + + + ' Private Sub OcultaDiv() + ' ScriptManager.RegisterStartupScript(Me, Me.GetType, "Llave", "HideDivRegistro();", True) + ' End Sub #End Region - + End Class diff --git a/Ventas/Clientes.aspx.vb b/Ventas/Clientes.aspx.vb index 0f3a7df60..34288b8e0 100644 --- a/Ventas/Clientes.aspx.vb +++ b/Ventas/Clientes.aspx.vb @@ -781,7 +781,7 @@ Partial Class Clientes 'JM 05-02-19: CRM 'If UsuarioActual.Empresa.UsaCRM Then - If GlobalDTCRMTipoProceso(UsuarioActual.CveEmpresa).Rows.Count > 0 Then + If GlobalDTCRMTipoProceso(UsuarioActual.CveEmpresa) IsNot Nothing AndAlso GlobalDTCRMTipoProceso(UsuarioActual.CveEmpresa).Rows.Count > 0 Then VerificaVinculacion() UpAccionesCRM.Update() End If @@ -2618,6 +2618,10 @@ Partial Class Clientes Next End If + If Not ErrorProceso AndAlso UsuarioActual.Empresa.Funcionalidad(563) <> "" AndAlso UsuarioActual.Empresa.Funcionalidad(109) = "1" Then + ErrorProceso = Not ActualizarClienteFranquicia(ObjClientes, CveClienteNuevo) + End If + Else ErrorProceso = True End If @@ -2671,6 +2675,10 @@ Partial Class Clientes If Not ErrorProceso AndAlso Not GuardarDocumentosClientes(objDoc, Me.CveCliente) Then ErrorProceso = True End If + + If Not ErrorProceso AndAlso UsuarioActual.Empresa.Funcionalidad(563) <> "" AndAlso UsuarioActual.Empresa.Funcionalidad(109) = "1" Then + ErrorProceso = Not ActualizarClienteFranquicia(ObjClientes, Me.CveCliente) + End If Else ErrorProceso = True End If @@ -2773,6 +2781,23 @@ Partial Class Clientes End Sub + + Private Function ActualizarClienteFranquicia(ByRef ObjClientes As ClsClientes, CveClienteRef As Integer) As Boolean + Dim TieneError As Boolean = False + Dim FranquiciasStr As String = UsuarioActual.Empresa.Funcionalidad(563) + + Dim Franquicias As String() = FranquiciasStr.Split(","c) + + For Each Franquicia As String In Franquicias + Dim CveEmpresaFranquicia As Integer = Franquicia.ToEntero + If Not ObjClientes.UpdateClienteFranquicia(CveClienteRef, UsuarioActual.CveEmpresa, CveEmpresaFranquicia) Then + TieneError = True + Exit For + End If + Next + + Return Not TieneError + End Function #End Region diff --git a/Ventas/ProductosServicios.aspx.vb b/Ventas/ProductosServicios.aspx.vb index 4e568ad27..a0ee834f0 100644 --- a/Ventas/ProductosServicios.aspx.vb +++ b/Ventas/ProductosServicios.aspx.vb @@ -3194,7 +3194,7 @@ Partial Class ProductosyServicios Dim CvePS As Integer = ObjPS.DtResultados.FiltroPrimeroValor("CvePS", String.Format(" Codigo = '{0}'", TxtCodigo.Text.Trim.ToUpper)).ToEntero() If Not ObjPS.UpdatePS(CveClasificacion, -1, CveUnidadMedida, TxtCodigo.Text.Trim, TxtNumeroParte.Text.Trim, TxtCodigoBarras.Text.Trim, PSS, TxtPrecio.Text.Trim.ToDouble, DdlIVA.SelectedValue.ToDouble, (TxtRetIVA.Text.Trim.ToDouble / 100), ChkInventariable.Checked, -1, True, ChkAplicaParaVenta.Checked, ChkEstado.Checked, UsuarioActual.CveUsuario, CvePS, CveMetodoInv, - EsPaquete, DdlSATPS.SelectedValue.ToEntero, UsuarioActual.CveEmpresa, CveTipoPS:=DdlTipoPS.SelectedValue.ToEntero, TipoServicio:=-1, CveClasificacion2:=CveClasificacion2, CveMarca:=CveMarcaFranquicia, + EsPaquete, DdlSATPS.SelectedValue.ToEntero, CveEmpresaFranquicia, CveTipoPS:=DdlTipoPS.SelectedValue.ToEntero, TipoServicio:=-1, CveClasificacion2:=CveClasificacion2, CveMarca:=CveMarcaFranquicia, AlmacenSeccion:=TxtAlmacenSeccion.Text.Trim, AplicaIEPS:=ChkAplicaIeps.Checked, IEPSPorcentaje:=DdlIEPSPorcentaje.SelectedValue.ToDecimal, CveCompuesto:=DdlCompuesto.SelectedValue.ToEntero, IEPSGrabaIVA:=ChkIepsIVA.Checked, VentaMinima:=TxtVentaMinima.Text.ToDecimal, CveMoneda:=DdlMoneda.SelectedValue.ToEntero, RetISR:=(TxtRetISR.Text.Trim.ToDouble / 100), PrecioMinimo:=TxtPrecioMinimo.Text.ToDecimal, From 389c32a7ae5a3d0fc9f89831a563cd80e7bca7da Mon Sep 17 00:00:00 2001 From: AbrahamCastilloV Date: Tue, 13 Feb 2024 03:56:57 -0700 Subject: [PATCH 2/7] =?UTF-8?q?-Se=20agregaron=20las=20propiedades=20de=20?= =?UTF-8?q?viajes=20a=20contratos=20y=20se=20alteraron=20los=20m=C3=A9todo?= =?UTF-8?q?s=20Add,=20Get=20y=20Update=20de=20Contratos.=20Se=20agrega=20e?= =?UTF-8?q?l=20folio=20a=20RepContratos.=20Se=20le=20agrega=20la=20funcion?= =?UTF-8?q?alidad=20para=20imprimir=20PDF=20y=20se=20aumentan=20el=20n?= =?UTF-8?q?=C3=BAmero=20de=20campos=20para=20las=20consultas.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- App_Code/ClsContratos.vb | 80 +++-- Transportes/RepContratos.aspx | 158 ++++++--- Transportes/RepContratos.aspx.vb | 89 ++++- Transportes/RepContratosCalendario.aspx | 183 ++++++---- Transportes/RepContratosCalendario.aspx.vb | 146 ++++++-- Transportes/RepViajes.aspx | 383 +++++++++------------ Transportes/RepViajes.aspx.vb | 40 +-- 7 files changed, 641 insertions(+), 438 deletions(-) diff --git a/App_Code/ClsContratos.vb b/App_Code/ClsContratos.vb index c56dffb17..bc3794d36 100644 --- a/App_Code/ClsContratos.vb +++ b/App_Code/ClsContratos.vb @@ -38,7 +38,6 @@ Public Class ClsContratos Public Property NumeroEstimacionNueva As Integer Public Property CveEstimacionNueva As Integer - Public Property CveChofer As Integer @@ -135,7 +134,6 @@ Public Class ClsContratos Public Property NumeroLicitacion As String Public Property Observaciones As String Public Property CveDireccionEnvio As Integer - Public Property CveProveedor As Integer Public Property RazonSocial As String Public Property CveCliente As Integer @@ -186,11 +184,16 @@ Public Class ClsContratos Public Property AplicaImpuestosLocales As Boolean Public Property CveEstimacionActual As Integer Public Property NumeroEstimacionActual As Integer - - - - - + 'Viajes + Public Property CveTipoAF As Integer + Public Property CveChofer As Integer + Public Property CveChofer2 As Integer + Public Property CveAF As Integer + Public Property CantidadPasajeros As Integer + Public Property CveRuta As Integer + Public Property CvePartida As Integer + Public Property CveDestino As Integer + Public Property CveMasivo As Integer #End Region #Region " C O N T R A T O S " @@ -227,8 +230,7 @@ Public Class ClsContratos End Try Return Retorno - End Function - + End Function Public Function GetContratos(CveContrato As Integer, CveEmpresa As Integer, Optional CveCliente As Integer = -1, Optional CveEstatus As Integer = -1, Optional TipoEstatus As Integer = -1, Optional TipoContrato As Integer = -1, Optional EstatusFianza As Integer = -1, Optional CveVendedor As Integer = -1) As Boolean @@ -299,30 +301,37 @@ Public Class ClsContratos Me.CveVendedor = Data.Rows(0)("CveVendedor").ToString.ToEntero Me.ImporteTotal = Data.Rows(0)("ImporteTotal").ToString.ToDecimal Me.Lugar = Data.Rows(0)("Lugar").ToString - Me.LimiteDeGasto = Data.Rows(0)("LimiteDeGasto").ToString.ToDouble - CveChofer = Data.Rows(0)("CveChofer").ToString.ToEntero - + Me.LimiteDeGasto = Data.Rows(0)("LimiteDeGasto").ToString.ToDouble Observaciones = Data.Rows(0)("Observaciones").ToString CveDireccionEnvio = Data.Rows(0)("CveDireccionEnvio").ToString.ToEntero AplicaImpuestosLocales = CBool(Data.Rows(0)("AplicaImpuestosLocales")) + 'Viajes + Me.CveTipoAF = Data.Rows(0)("CveTipoAF").ToString.ToEntero + Me.CveChofer = Data.Rows(0)("CveChofer").ToString.ToEntero + Me.CveChofer2 = Data.Rows(0)("CveChofer2").ToString.ToEntero + Me.CveAF = Data.Rows(0)("CveAF").ToString.ToEntero + Me.CantidadPasajeros = Data.Rows(0)("CantidadPasajeros").ToString.ToEntero + Me.CveRuta = Data.Rows(0)("CveRuta").ToString.ToEntero + Me.CvePartida = Data.Rows(0)("CvePartida").ToString.ToEntero + Me.CveDestino = Data.Rows(0)("CveDestino").ToString.ToEntero + Me.CveMasivo = Data.Rows(0)("CveMasivo").ToString.ToEntero - End If + End If Retorno = True Catch ex As Exception OnError("Ocurrió un error al obtener el Catálogo de Contratos.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) End Try Return Retorno - End Function - - Public Function AddContratos(NumeroContrato As String, DescripcionContrato As String, NumeroLicitacion As String, CveProveedor As Integer, CveCliente As Integer, CveProspecto As Integer, FechaInicial As DateTime, FechaFinal As DateTime, - Ubicacion As String, Responsable As String, CveSubProyecto As Integer, PorIVA As Double, PorAnticipo As Double, PorAmortizacionAnticipo As Double, PorGarantia As Double, Archivo As String, - Geom As String, CveContratoPadre As Integer, CveUsuario As Integer, CveEmpresa As Integer, EsPresupuestal As Boolean, Minimo As Double, Maximo As Double, Importe As Double, CveMoneda As Integer, ModalidadDetalle As Integer, - Optional CveContratosEstatus As Integer = -1, Optional CveContratoTipo As Integer = -1, Optional TipoCambio As Double = 1, Optional CveSucursalCliente As Integer = -1, Optional CveAlmacenOrigen As Integer = -1, Optional CveAlmacenDestino As Integer = -1, Optional PorcentajeComision As Integer = -1, - Optional TipoGarantia As Integer = -1, Optional Folio As Integer = -1, Optional FechaVenc As Date = Nothing, Optional EstatusFianza As Integer = -1, Optional CvePeriodo As Integer = -1, Optional CveContratoPlantilla As Integer = -1, Optional CveCuentaEquipo As Integer = -1, - Optional CveVendedor As Integer = -1, Optional Observaciones As String = "", Optional CveDireccionEnvio As Integer = -1, Optional AplicaImpuestosLocales As Boolean = False, Optional CorreoNotificacionPedDev As String = "", - Optional FacturacionCicilica As Boolean = False, Optional FacturacionCiclicaAutomatico As Boolean = False, Optional DiaMesFacturacion As Integer = 1, Optional ObservacionesGenerales As String = "", - Optional CveTipoAF As Integer = -1, Optional CveChofer As Integer = -1, Optional CveAF As Integer = -1, Optional CantidadPasajeros As Integer = -1) As Integer + End Function + Public Function AddContratos(NumeroContrato As String, DescripcionContrato As String, NumeroLicitacion As String, CveProveedor As Integer, CveCliente As Integer, CveProspecto As Integer, FechaInicial As DateTime, FechaFinal As DateTime, + Ubicacion As String, Responsable As String, CveSubProyecto As Integer, PorIVA As Double, PorAnticipo As Double, PorAmortizacionAnticipo As Double, PorGarantia As Double, Archivo As String, + Geom As String, CveContratoPadre As Integer, CveUsuario As Integer, CveEmpresa As Integer, EsPresupuestal As Boolean, Minimo As Double, Maximo As Double, Importe As Double, CveMoneda As Integer, ModalidadDetalle As Integer, + Optional CveContratosEstatus As Integer = -1, Optional CveContratoTipo As Integer = -1, Optional TipoCambio As Double = 1, Optional CveSucursalCliente As Integer = -1, Optional CveAlmacenOrigen As Integer = -1, Optional CveAlmacenDestino As Integer = -1, Optional PorcentajeComision As Integer = -1, + Optional TipoGarantia As Integer = -1, Optional Folio As Integer = -1, Optional FechaVenc As Date = Nothing, Optional EstatusFianza As Integer = -1, Optional CvePeriodo As Integer = -1, Optional CveContratoPlantilla As Integer = -1, Optional CveCuentaEquipo As Integer = -1, + Optional CveVendedor As Integer = -1, Optional Observaciones As String = "", Optional CveDireccionEnvio As Integer = -1, Optional AplicaImpuestosLocales As Boolean = False, Optional CorreoNotificacionPedDev As String = "", + Optional FacturacionCicilica As Boolean = False, Optional FacturacionCiclicaAutomatico As Boolean = False, Optional DiaMesFacturacion As Integer = 1, Optional ObservacionesGenerales As String = "", + Optional CveTipoAF As Integer = Nothing, Optional CveChofer As Integer = Nothing, Optional CveChofer2 As Integer = Nothing, Optional CveAF As Integer = Nothing, Optional CantidadPasajeros As Integer = Nothing, Optional CveRuta As Integer = Nothing, Optional CvePartida As Integer = Nothing, Optional CveDestino As Integer = Nothing, Optional CveMasivo As Integer = Nothing) As Integer Dim Retorno As Integer = -1 DataAdapter("PA_Con_ContratosAdd") @@ -378,11 +387,16 @@ Public Class ClsContratos .Add("@FacturacionCiclicaAutomatico", SqlDbType.Bit).Value = FacturacionCiclicaAutomatico .Add("@DiaMesFacturacion", SqlDbType.TinyInt).Value = DiaMesFacturacion .Add("@ObservacionesGenerales", SqlDbType.VarChar).Value = ObservacionesGenerales - .Add("@CveTipoAF", SqlDbType.Int).Value = CveTipoAF - .Add("@CveChofer", SqlDbType.Int).Value = CveChofer + 'Viajes + .Add("@CveTipoAF", SqlDbType.Int).Value = CveTipoAF + .Add("@CveChofer", SqlDbType.Int).Value = CveChofer + .Add("@CveChofer2", SqlDbType.Int).Value = CveChofer2 .Add("@CveAF", SqlDbType.Int).Value = CveAF .Add("@CantidadPasajeros", SqlDbType.Int).Value = CantidadPasajeros - + .Add("@CveRuta", SqlDbType.Int).Value = CveRuta + .Add("@CvePartida", SqlDbType.Int).Value = CvePartida + .Add("@CveDestino", SqlDbType.Int).Value = CveDestino + .Add("@CveMasivo", SqlDbType.Int).Value = CveMasivo End With Try @@ -400,14 +414,13 @@ Public Class ClsContratos Return Retorno End Function - Public Function UpdateContratos(CveContrato As Integer, NumeroContrato As String, DescripcionContrato As String, NumeroLicitacion As String, CveProveedor As Integer, CveCliente As Integer, CveProspecto As Integer, FechaInicial As DateTime, FechaFinal As DateTime, Ubicacion As String, Responsable As String, CveSubProyecto As Integer, PorIVA As Double, PorAnticipo As Double, PorAmortizacionAnticipo As Double, PorGarantia As Double, Archivo As String, Geom As String, CveContratoPadre As Integer, CveUsuario As Integer, CveEmpresa As Integer, EsPresupuestal As Boolean, Minimo As Double, Maximo As Double, Importe As Double, CveMoneda As Integer, ModalidadDetalle As Integer, Optional CveContratosEstatus As Integer = -1, Optional CveContratoTipo As Integer = -1, Optional TipoCambio As Double = 1.0, Optional CveSucursalCliente As Integer = -1, Optional CveAlmacenOrigen As Integer = -1, Optional CveAlmacenDestino As Integer = -1, Optional PorcentajeComision As Integer = -1, Optional TipoGarantia As Integer = -1, Optional Folio As Integer = -1, Optional FechaVenc As Date = Nothing, Optional EstatusFianza As Integer = -1, Optional CveContratoPlantilla As Integer = -1, Optional CveCuentaEquipo As Integer = -1, Optional CveVendedor As Integer = -1, Optional Observaciones As String = "", Optional CveDireccionEnvio As Integer = -1, Optional AplicaImpuestosLocales As Boolean = False, Optional CorreoNotificacionPedDev As String = "", Optional FacturacionCicilica As Boolean = False, Optional FacturacionCiclicaAutomatico As Boolean = False, - Optional DiaMesFacturacion As Integer = 1, Optional CvePeriodo As Integer = -1, Optional ObservacionesGenerales As String = "", Optional CveTipoAF As Integer = -1, Optional CveChofer As Integer = -1, Optional EstatusContrato As Integer = -1, Optional CveAF As Integer = -1) As Boolean + Optional DiaMesFacturacion As Integer = 1, Optional CvePeriodo As Integer = -1, Optional ObservacionesGenerales As String = "", Optional CveTipoAF As Integer = Nothing, Optional CveChofer As Integer = Nothing, Optional CveChofer2 As Integer = Nothing, Optional CveAF As Integer = Nothing, Optional CantidadPasajeros As Integer = Nothing, Optional CveRuta As Integer = Nothing, Optional CvePartida As Integer = Nothing, Optional CveDestino As Integer = Nothing, Optional CveMasivo As Integer = Nothing) As Boolean Dim Retorno As Boolean = False DataAdapter("PA_Con_ContratosUpdate") @@ -462,12 +475,17 @@ Public Class ClsContratos .Add("@DiaMesFacturacion", SqlDbType.TinyInt).Value = DiaMesFacturacion .Add("@CvePeriodo", SqlDbType.Int).Value = CvePeriodo .Add("@ObservacionesGenerales", SqlDbType.VarChar).Value = ObservacionesGenerales - .Add("@CveTipoAF", SqlDbType.Int).Value = CveTipoAF + 'Viajes + .Add("@CveTipoAF", SqlDbType.Int).Value = CveTipoAF .Add("@CveChofer", SqlDbType.Int).Value = CveChofer - .Add("@EstatusContrato", SqlDbType.Int).Value = EstatusContrato + .Add("@CveChofer2", SqlDbType.Int).Value = CveChofer2 .Add("@CveAF", SqlDbType.Int).Value = CveAF + .Add("@CantidadPasajeros", SqlDbType.Int).Value = CantidadPasajeros + .Add("@CveRuta", SqlDbType.Int).Value = CveRuta + .Add("@CvePartida", SqlDbType.Int).Value = CvePartida + .Add("@CveDestino", SqlDbType.Int).Value = CveDestino + .Add("@CveMasivo", SqlDbType.Int).Value = CveMasivo End With - Try SqlAdapter.Fill(Data) Retorno = True diff --git a/Transportes/RepContratos.aspx b/Transportes/RepContratos.aspx index 9f4d4df89..146ab1b88 100644 --- a/Transportes/RepContratos.aspx +++ b/Transportes/RepContratos.aspx @@ -14,85 +14,131 @@ } .consulta { - padding: 1rem 2rem; background-color: #95A5A6; - display: flex; - justify-content: space-around; - align-items: center; + padding: 1rem 1rem; margin-bottom: 1rem; } + .consulta_linea { + display: flex; + justify-content: space-between; + align-items: center; + margin-block: .5rem; + gap: 1rem; + } + .consulta_campo { display: flex; gap: 1rem; align-items: center; - width: 100%; } .consulta_campo label { color: white; } + + .expandir { + width: 2.5rem; + font-size: 2.5rem; + font-weight: 900; + color: white; + } - -
  • Agregar Contrato
  • - Generar Excel + Generar PDF +
  • +
  • + Generar Excel
  • -
    - - - -
    <%-- Filtros --%>
    -
    - +
    +
    + + +
    - +
    + + +
    -
    +
    + + +
    -
    - - - - -
    - -
    - - -
    - -
    - -
    - - +
    + +
    + + +
    +
    +
    + +
    - + +
    + +
    + + +
    +
    + +
    + +
    + + +
    +
    + +
    + +
    + + +
    +
    +
    <%-- Listado de Contratos --%> @@ -101,9 +147,9 @@ CssClass="table table-striped table-hover Widthall ScrollAD mysmallbtn" GridLines="None" data-sort="true" DataKeyNames="CveContrato, DescripcionContrato, Ubicacion, FechaInicial, FechaFinal, CveCliente, CveTipoAF, Importe, ImporteMin, ImporteMax,CveChofer, Observaciones, CveContratosEstatus, CveAF"> - + - + @@ -170,7 +216,11 @@