From c05938c335867cf2a27ff89a4fabe6372b2416b0 Mon Sep 17 00:00:00 2001 From: janeth arvizu Date: Wed, 4 Sep 2019 13:55:40 -0700 Subject: [PATCH] --- App_Code/ClsCRM.vb | 47 ++++++ CRM/Acercamiento.aspx | 98 ++++++++++--- CRM/Acercamiento.aspx.cs | 142 +++++++++++++++++- Sistemas/ConfiguracionEmpresa.aspx | 36 ++--- Sistemas/ConfiguracionEmpresa.aspx.vb | 200 ++++++++++++++------------ 5 files changed, 387 insertions(+), 136 deletions(-) diff --git a/App_Code/ClsCRM.vb b/App_Code/ClsCRM.vb index 6a8ad9f77..841e0b7c3 100644 --- a/App_Code/ClsCRM.vb +++ b/App_Code/ClsCRM.vb @@ -873,6 +873,53 @@ Public Class ClsCRM End Try Return Retorno End Function + Public Function AddAcercamientosGastos(CveAcercamiento As Integer, Descripcion As String, Importe As Decimal, CveUsuario As Integer) As Boolean + Dim Retorno As Boolean = False + DataAdapter("PA_CRM_AcercamientosGastosAdd") + With SqlAdapter.SelectCommand.Parameters + .Add("@CveAcercamiento", SqlDbType.Int).Value = CveAcercamiento + .Add("@Descripcion", SqlDbType.VarChar).Value = Descripcion + .Add("@Importe", SqlDbType.Money).Value = Importe + .Add("@CveUsuario", SqlDbType.Int).Value = CveUsuario + End With + Try + SqlAdapter.Fill(Data) + Retorno = True + Catch ex As Exception + OnError("Ocurrió un error al agregar los Gastos del Acercamiento.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) + End Try + Return Retorno + End Function + Public Function UpdateAcercamientosGastos(CveAcercamientoGasto As Integer, Descripcion As String, Importe As Decimal) As Boolean + Dim Retorno As Boolean = False + DataAdapter("PA_CRM_AcercamientosGastosUpdate") + With SqlAdapter.SelectCommand.Parameters + .Add("@CveAcercamientoGasto", SqlDbType.Int).Value = CveAcercamientoGasto + .Add("@Descripcion", SqlDbType.VarChar).Value = Descripcion + .Add("@Importe", SqlDbType.Money).Value = Importe + End With + Try + SqlAdapter.Fill(Data) + Retorno = True + Catch ex As Exception + OnError("Ocurrió un error al actualizar los Gastos del Acercamiento.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) + End Try + Return Retorno + End Function + Public Function RemoveAcercamientosGastos(CveAcercamientoGasto As Integer) As Boolean + Dim Retorno As Boolean = False + DataAdapter("PA_CRM_AcercamientosGastosRemove") + With SqlAdapter.SelectCommand.Parameters + .Add("@CveAcercamientoGasto", SqlDbType.Int).Value = CveAcercamientoGasto + End With + Try + SqlAdapter.Fill(Data) + Retorno = True + Catch ex As Exception + OnError("Ocurrió un error al eliminar los Gastos del Acercamiento.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) + End Try + Return Retorno + End Function #End Region diff --git a/CRM/Acercamiento.aspx b/CRM/Acercamiento.aspx index 03d84df03..8cfb6f104 100644 --- a/CRM/Acercamiento.aspx +++ b/CRM/Acercamiento.aspx @@ -718,8 +718,8 @@
- - + +
@@ -736,10 +736,10 @@ EmptyDataRowStyle-HorizontalAlign="Center" ToolTip="Listado de Cotizaciones" CssClass="table table-striped table-advance table-hover ScrollAD Widthall mysmallbtn" AlternatingRowStyle-BorderStyle="None" GridLines="None" BorderColor="#D3D3D3" BorderWidth="1" AutoGenerateColumns="false" OnRowDataBound="GvCotizacion_RowDataBound"> - + - + @@ -767,15 +767,15 @@ GASTOS -<%--
+
- + - - + +
-
--%> +
@@ -785,15 +785,43 @@
- + GridLines="None" BorderColor="#D3D3D3" BorderWidth="1" AutoGenerateColumns="false" OnRowDataBound="GvGastos_RowDataBound"> - <%----%> - - - - + <%----%> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -1176,6 +1204,44 @@
+ <%-- FIN MODAL VER UBICACION --%> + + <%-- MODAL AGREGAR GASTO--%> + + <%-- FIN MODAL AGREGAR GASTO --%> diff --git a/CRM/Acercamiento.aspx.cs b/CRM/Acercamiento.aspx.cs index 39b9a8e20..069fe6c19 100644 --- a/CRM/Acercamiento.aspx.cs +++ b/CRM/Acercamiento.aspx.cs @@ -210,6 +210,30 @@ public partial class CRM_Acercamiento : ClsPaginas { return ModExtensiones.Encripta(param); } + private Boolean Actualizar + { + get + { + return (Boolean)ViewState["Actualizar"]; + } + + set + { + ViewState["Actualizar"] = value; + } + } + private int CveAcercamientoGasto + { + get + { + return ViewState["CveAcercamientoGasto"].ToString().ToEntero(); + } + + set + { + ViewState["CveAcercamientoGasto"] = value; + } + } #endregion protected void Page_Load(object sender, EventArgs e) @@ -531,7 +555,7 @@ public partial class CRM_Acercamiento : ClsPaginas } //AUTOGUARDADO DE CAMBIO DE ETAPA - if (DTEtapasProceso.FiltroPrimeroValor("CveTipoEtapa", String.Format("CveEtapaProceso = {0}", DdlEtapaProceso.SelectedValue.ToEntero())).Contiene("1","2","3")) + if (DTEtapasProceso.FiltroPrimeroValor("CveTipoEtapa", String.Format("CveEtapaProceso = {0}", DdlEtapaProceso.SelectedValue.ToEntero())).Contiene("1", "2", "3")) GuardarCambioEtapa(); } #endregion @@ -653,7 +677,7 @@ public partial class CRM_Acercamiento : ClsPaginas { CveEtapaActual = CveEtapaProcesoActualActualizar; HdfEtapaSeleccionada.Value = CveEtapaProcesoActualActualizar.ToString(); - + } ObjCRM.Dispose(); @@ -1419,7 +1443,7 @@ public partial class CRM_Acercamiento : ClsPaginas if (TieneError) { ObjCRM.RollBack(); - Alert("El archivo el eliminó correctamente.",ModExtensiones.TipoMensaje.MsgError); + Alert("El archivo el eliminó correctamente.", ModExtensiones.TipoMensaje.MsgError); } else { @@ -1427,11 +1451,11 @@ public partial class CRM_Acercamiento : ClsPaginas Alert("El archivo se agregó correctamente"); } ObjCRM.Dispose(); - + CargaImagenes(); UpGaleria.Update(); RegistraScript("$('#Modalupfotos').modal('hide');clickgaleria();"); - } + } } protected void BtnEliminarFoto_Click(object sender, EventArgs e) @@ -1493,5 +1517,113 @@ public partial class CRM_Acercamiento : ClsPaginas GvGastos.DataBind(); UpGastos.Update(); } + + protected void LbAddGastos_Click(object sender, EventArgs e) + { + LtlTituloModalGasto.Text = "Agregar Gasto"; + BtnAgregarGastoModal.Text = "Agregar"; + + UpModalGastos.Update(); + + TxtDescripcionGasto.Text = ""; + TxtImporteGasto.Text = ""; + + Actualizar = false; + + RegistraScript(String.Format("$('#{0}').modal();", "DivAgregarGasto")); + } + + protected void BtnAgregarGastoModal_Click(object sender, EventArgs e) + { + ClsCRM ObjCRM = new ClsCRM(); + + if(!Actualizar) + { + if (ObjCRM.AddAcercamientosGastos(CveAcercamiento, TxtDescripcionGasto.Text, TxtImporteGasto.Text.ToDecimal(), UsuarioActual.CveUsuario)) + { + CargaGastos(); + + RegistraScript(String.Format("$('#{0}').modal('hide');", "DivAgregarGasto"), "jsHideModalFolioGarantia"); + Alert("Gasto Agregado Correctamente", ModExtensiones.TipoMensaje.MsgInformacion); + } + else + { + Alert("Ocurrió un error al guardar el Gasto", ModExtensiones.TipoMensaje.MsgError); + } + } + else + { + if (ObjCRM.UpdateAcercamientosGastos(CveAcercamientoGasto, TxtDescripcionGasto.Text, TxtImporteGasto.Text.ToDecimal())) + { + CargaGastos(); + + RegistraScript(String.Format("$('#{0}').modal('hide');", "DivAgregarGasto"), "jsHideModalFolioGarantia"); + Alert("Gasto Actualizado Correctamente", ModExtensiones.TipoMensaje.MsgInformacion); + } + else + { + Alert("Ocurrió un error al actualizar el Gasto", ModExtensiones.TipoMensaje.MsgError); + } + } + + Actualizar = false; + CveAcercamientoGasto = -1; + + ObjCRM.Dispose(); + } + + protected void GvGastos_RowDataBound(object sender, GridViewRowEventArgs e) + { + if (e.Row.RowType == DataControlRowType.DataRow) + { + if (e.Row.DBCampo("CveAcercamiento").ToEntero() < 1) + { + e.Row.CssClass = "Totales"; + e.Row.Cells[0].Text = "Total"; + e.Row.FCLinkButton("ImgE").Visible = false; + e.Row.FCLinkButton("imgD").Visible = false; + } + } + } + + protected void ImgE_Click(object sender, EventArgs e) + { + GridViewRow GvRow = (GridViewRow)((LinkButton)sender).NamingContainer; + LtlTituloModalGasto.Text = "Editar Gasto"; + BtnAgregarGastoModal.Text = "Actualizar"; + Actualizar = true; + + CveAcercamientoGasto = GvRow.DataKey("CveAcercamientoGasto").ToEntero(); + + TxtDescripcionGasto.Text = GvRow.DataKey("Descripcion"); + TxtImporteGasto.Text = GvRow.DataKey("Importe"); + + UpModalGastos.Update(); + + RegistraScript(String.Format("$('#{0}').modal();", "DivAgregarGasto")); + } + + protected void imgD_Click(object sender, EventArgs e) + { + + ClsCRM ObjCRM = new ClsCRM(); + GridViewRow GvRow = (GridViewRow)((LinkButton)sender).NamingContainer; + CveAcercamientoGasto = GvRow.DataKey("CveAcercamientoGasto").ToEntero(); + + if (ObjCRM.RemoveAcercamientosGastos(CveAcercamientoGasto)) + { + CargaGastos(); + Alert("Gasto eliminado Correctamente", ModExtensiones.TipoMensaje.MsgInformacion); + } + else + { + Alert("Ocurrió un error al eliminar el Gasto", ModExtensiones.TipoMensaje.MsgError); + } + + ObjCRM.Dispose(); + + CveAcercamientoGasto = -1; + } + #endregion } \ No newline at end of file diff --git a/Sistemas/ConfiguracionEmpresa.aspx b/Sistemas/ConfiguracionEmpresa.aspx index 6f466baf7..4d55ec0e0 100644 --- a/Sistemas/ConfiguracionEmpresa.aspx +++ b/Sistemas/ConfiguracionEmpresa.aspx @@ -58,6 +58,8 @@ + + @@ -69,9 +71,11 @@ - + + + @@ -83,9 +87,11 @@ - + + + @@ -97,9 +103,11 @@ - + + + @@ -111,27 +119,13 @@ - + + + - <%-- - Clave de Empresa: - - - - - - - - Razón Social: - - - - - - --%>
@@ -196,7 +190,7 @@ -
+
diff --git a/Sistemas/ConfiguracionEmpresa.aspx.vb b/Sistemas/ConfiguracionEmpresa.aspx.vb index a38edceea..9726e9958 100644 --- a/Sistemas/ConfiguracionEmpresa.aspx.vb +++ b/Sistemas/ConfiguracionEmpresa.aspx.vb @@ -17,134 +17,146 @@ Partial Class Sistemas_ConfiguracionEmpresa Protected Sub Page_Load(sender As Object, e As System.EventArgs) Handles Me.Load If Not IsPostBack Then - CargaCuentasClientesSIG() + CargaCuentasClientesSIG(DdlCtaContableClientes) + CargaCuentasClientesSIG(DdlCtaContableProveedores) + CargaCuentasClientesSIG(DdlCtaContableDeudores) + CargaCuentasClientesSIG(DdlCtaContableAlmacen) + CargaCuentasClientesSIG(DdlCtaContableCosto) End If End Sub #Region "Carga Cuentas" - Private Sub CargaCuentasClientesSIG() + Private Sub CargaCuentasClientesSIG(ddl As DropDownList) Dim ObjContabilidad As New ClsContabilidad If ObjContabilidad.GetCuentas(-1, "-1", 1, UsuarioActual.CveEmpresa) Then - DdlCtaContableClientes.Items.Clear() - DdlCtaContableClientes.Items.Add(New ListItem("Seleccione", "0")) - DdlCtaContableClientes.DataSource = ObjContabilidad.DtResultados - DdlCtaContableClientes.DataBind() + ddl.Items.Clear() + ddl.Items.Add(New ListItem("Seleccione", "0")) + ddl.DataSource = ObjContabilidad.DtResultados + ddl.DataBind() End If ObjContabilidad.Dispose() End Sub - Private Sub CargaCuentasClientesCompaq() + Private Sub CargaCuentasClientesCompaq(ddl As DropDownList) Dim ObjCompaq As New ClsContPAQi(UsuarioActual.Empresa) If ObjCompaq.GetCuentas(-1, "-1", 1) Then - DdlCtaContableClientes.Items.Clear() - DdlCtaContableClientes.Items.Add(New ListItem("Seleccione", "0")) - DdlCtaContableClientes.DataSource = ObjCompaq.DtResultados - DdlCtaContableClientes.DataBind() + ddl.Items.Clear() + ddl.Items.Add(New ListItem("Seleccione", "0")) + ddl.DataSource = ObjCompaq.DtResultados + ddl.DataBind() End If ObjCompaq.Dispose() End Sub - Private Sub CargaCuentasProveedoresSIG() - Dim ObjContabilidad As New ClsContabilidad + 'Private Sub CargaCuentasProveedoresSIG() + ' Dim ObjContabilidad As New ClsContabilidad - If ObjContabilidad.GetCuentas(-1, "-1", 1, UsuarioActual.CveEmpresa) Then - DdlCtaContableClientes.Items.Clear() - DdlCtaContableClientes.Items.Add(New ListItem("Seleccione", "0")) - DdlCtaContableClientes.DataSource = ObjContabilidad.DtResultados - DdlCtaContableClientes.DataBind() - End If - ObjContabilidad.Dispose() - End Sub - Private Sub CargaCuentasProveedoresCompaq() - Dim ObjCompaq As New ClsContPAQi(UsuarioActual.Empresa) + ' If ObjContabilidad.GetCuentas(-1, "-1", 1, UsuarioActual.CveEmpresa) Then + ' DdlCtaContableClientes.Items.Clear() + ' DdlCtaContableClientes.Items.Add(New ListItem("Seleccione", "0")) + ' DdlCtaContableClientes.DataSource = ObjContabilidad.DtResultados + ' DdlCtaContableClientes.DataBind() + ' End If + ' ObjContabilidad.Dispose() + 'End Sub + 'Private Sub CargaCuentasProveedoresCompaq() + ' Dim ObjCompaq As New ClsContPAQi(UsuarioActual.Empresa) - If ObjCompaq.GetCuentas(-1, "-1", 1) Then - DdlCtaContableClientes.Items.Clear() - DdlCtaContableClientes.Items.Add(New ListItem("Seleccione", "0")) - DdlCtaContableClientes.DataSource = ObjCompaq.DtResultados - DdlCtaContableClientes.DataBind() - End If - ObjCompaq.Dispose() - End Sub + ' If ObjCompaq.GetCuentas(-1, "-1", 1) Then + ' DdlCtaContableClientes.Items.Clear() + ' DdlCtaContableClientes.Items.Add(New ListItem("Seleccione", "0")) + ' DdlCtaContableClientes.DataSource = ObjCompaq.DtResultados + ' DdlCtaContableClientes.DataBind() + ' End If + ' ObjCompaq.Dispose() + 'End Sub - Private Sub CargaCuentasDeudoresSIG() - Dim ObjContabilidad As New ClsContabilidad + 'Private Sub CargaCuentasDeudoresSIG() + ' Dim ObjContabilidad As New ClsContabilidad - If ObjContabilidad.GetCuentas(-1, "-1", 1, UsuarioActual.CveEmpresa) Then - DdlCtaContableClientes.Items.Clear() - DdlCtaContableClientes.Items.Add(New ListItem("Seleccione", "0")) - DdlCtaContableClientes.DataSource = ObjContabilidad.DtResultados - DdlCtaContableClientes.DataBind() - End If - ObjContabilidad.Dispose() - End Sub - Private Sub CargaCuentassDeudoresCompaq() - Dim ObjCompaq As New ClsContPAQi(UsuarioActual.Empresa) + ' If ObjContabilidad.GetCuentas(-1, "-1", 1, UsuarioActual.CveEmpresa) Then + ' DdlCtaContableClientes.Items.Clear() + ' DdlCtaContableClientes.Items.Add(New ListItem("Seleccione", "0")) + ' DdlCtaContableClientes.DataSource = ObjContabilidad.DtResultados + ' DdlCtaContableClientes.DataBind() + ' End If + ' ObjContabilidad.Dispose() + 'End Sub + 'Private Sub CargaCuentassDeudoresCompaq() + ' Dim ObjCompaq As New ClsContPAQi(UsuarioActual.Empresa) - If ObjCompaq.GetCuentas(-1, "-1", 1) Then - DdlCtaContableClientes.Items.Clear() - DdlCtaContableClientes.Items.Add(New ListItem("Seleccione", "0")) - DdlCtaContableClientes.DataSource = ObjCompaq.DtResultados - DdlCtaContableClientes.DataBind() - End If - ObjCompaq.Dispose() - End Sub + ' If ObjCompaq.GetCuentas(-1, "-1", 1) Then + ' DdlCtaContableClientes.Items.Clear() + ' DdlCtaContableClientes.Items.Add(New ListItem("Seleccione", "0")) + ' DdlCtaContableClientes.DataSource = ObjCompaq.DtResultados + ' DdlCtaContableClientes.DataBind() + ' End If + ' ObjCompaq.Dispose() + 'End Sub - Private Sub CargaCuentasAlmacenSIG() - Dim ObjContabilidad As New ClsContabilidad + 'Private Sub CargaCuentasAlmacenSIG() + ' Dim ObjContabilidad As New ClsContabilidad - If ObjContabilidad.GetCuentas(-1, "-1", 1, UsuarioActual.CveEmpresa) Then - DdlCtaContableClientes.Items.Clear() - DdlCtaContableClientes.Items.Add(New ListItem("Seleccione", "0")) - DdlCtaContableClientes.DataSource = ObjContabilidad.DtResultados - DdlCtaContableClientes.DataBind() - End If - ObjContabilidad.Dispose() - End Sub - Private Sub CargaCuentasAlmacenCompaq() - Dim ObjCompaq As New ClsContPAQi(UsuarioActual.Empresa) + ' If ObjContabilidad.GetCuentas(-1, "-1", 1, UsuarioActual.CveEmpresa) Then + ' DdlCtaContableClientes.Items.Clear() + ' DdlCtaContableClientes.Items.Add(New ListItem("Seleccione", "0")) + ' DdlCtaContableClientes.DataSource = ObjContabilidad.DtResultados + ' DdlCtaContableClientes.DataBind() + ' End If + ' ObjContabilidad.Dispose() + 'End Sub + 'Private Sub CargaCuentasAlmacenCompaq() + ' Dim ObjCompaq As New ClsContPAQi(UsuarioActual.Empresa) - If ObjCompaq.GetCuentas(-1, "-1", 1) Then - DdlCtaContableClientes.Items.Clear() - DdlCtaContableClientes.Items.Add(New ListItem("Seleccione", "0")) - DdlCtaContableClientes.DataSource = ObjCompaq.DtResultados - DdlCtaContableClientes.DataBind() - End If - ObjCompaq.Dispose() - End Sub + ' If ObjCompaq.GetCuentas(-1, "-1", 1) Then + ' DdlCtaContableClientes.Items.Clear() + ' DdlCtaContableClientes.Items.Add(New ListItem("Seleccione", "0")) + ' DdlCtaContableClientes.DataSource = ObjCompaq.DtResultados + ' DdlCtaContableClientes.DataBind() + ' End If + ' ObjCompaq.Dispose() + 'End Sub - Private Sub CargaCuentasCostoSIG() - Dim ObjContabilidad As New ClsContabilidad + 'Private Sub CargaCuentasCostoSIG() + ' Dim ObjContabilidad As New ClsContabilidad - If ObjContabilidad.GetCuentas(-1, "-1", 1, UsuarioActual.CveEmpresa) Then - DdlCtaContableClientes.Items.Clear() - DdlCtaContableClientes.Items.Add(New ListItem("Seleccione", "0")) - DdlCtaContableClientes.DataSource = ObjContabilidad.DtResultados - DdlCtaContableClientes.DataBind() - End If - ObjContabilidad.Dispose() - End Sub - Private Sub CargaCuentasCostoCompaq() - Dim ObjCompaq As New ClsContPAQi(UsuarioActual.Empresa) + ' If ObjContabilidad.GetCuentas(-1, "-1", 1, UsuarioActual.CveEmpresa) Then + ' DdlCtaContableClientes.Items.Clear() + ' DdlCtaContableClientes.Items.Add(New ListItem("Seleccione", "0")) + ' DdlCtaContableClientes.DataSource = ObjContabilidad.DtResultados + ' DdlCtaContableClientes.DataBind() + ' End If + ' ObjContabilidad.Dispose() + 'End Sub + 'Private Sub CargaCuentasCostoCompaq() + ' Dim ObjCompaq As New ClsContPAQi(UsuarioActual.Empresa) - If ObjCompaq.GetCuentas(-1, "-1", 1) Then - DdlCtaContableClientes.Items.Clear() - DdlCtaContableClientes.Items.Add(New ListItem("Seleccione", "0")) - DdlCtaContableClientes.DataSource = ObjCompaq.DtResultados - DdlCtaContableClientes.DataBind() - End If - ObjCompaq.Dispose() - End Sub + ' If ObjCompaq.GetCuentas(-1, "-1", 1) Then + ' DdlCtaContableClientes.Items.Clear() + ' DdlCtaContableClientes.Items.Add(New ListItem("Seleccione", "0")) + ' DdlCtaContableClientes.DataSource = ObjCompaq.DtResultados + ' DdlCtaContableClientes.DataBind() + ' End If + ' ObjCompaq.Dispose() + 'End Sub #End Region Protected Sub RblTipo_SelectedIndexChanged(sender As Object, e As EventArgs) Handles RblTipo.SelectedIndexChanged If RblTipo.SelectedValue = "SIG" Then DvServidorConta.Visible = False - CargaCuentasClientesSIG() + CargaCuentasClientesSIG(DdlCtaContableClientes) + CargaCuentasClientesSIG(DdlCtaContableProveedores) + CargaCuentasClientesSIG(DdlCtaContableDeudores) + CargaCuentasClientesSIG(DdlCtaContableAlmacen) + CargaCuentasClientesSIG(DdlCtaContableCosto) Else DvServidorConta.Visible = True - CargaCuentasClientesCompaq() + CargaCuentasClientesCompaq(DdlCtaContableClientes) + CargaCuentasClientesCompaq(DdlCtaContableProveedores) + CargaCuentasClientesCompaq(DdlCtaContableDeudores) + CargaCuentasClientesCompaq(DdlCtaContableAlmacen) + CargaCuentasClientesCompaq(DdlCtaContableCosto) End If End Sub @@ -152,7 +164,7 @@ Partial Class Sistemas_ConfiguracionEmpresa Dim ObjEmpresas As New ClsSisEmpresas ObjEmpresas.IniciaTransacSQL() - + Alert("sdfsz")