diff --git a/App_Code/CalendarEvent.vb b/App_Code/CalendarEvent.vb index 983cc8a96..9f32f75d6 100644 --- a/App_Code/CalendarEvent.vb +++ b/App_Code/CalendarEvent.vb @@ -29,5 +29,16 @@ Public Class CalendarEvent Public Property CveEmpresaCRM As String Public Property CveContactoCRM As String Public Property CveAcercamientoCRM As String + Public Property NombreCliente As String + Public Property NombreProveedor As String + Public Property NomprePersonal As String + Public Property NombreAcercamiento As String + Public Property CvePersonal As Integer + Public Property CveCliente As Integer + Public Property CveProveedor As Integer + + + + End Class diff --git a/App_Code/ClsCRM.vb b/App_Code/ClsCRM.vb index 1fb7574c9..50c928d51 100644 --- a/App_Code/ClsCRM.vb +++ b/App_Code/ClsCRM.vb @@ -358,7 +358,7 @@ Public Class ClsCRM Return Retorno End Function - Public Function AddEtapaProceso(EtapaProceso As String, Descripcion As String, CveTipoEtapa As Integer, Orden As Integer, CveTipoProceso As Integer, CveEmpresa As Integer, CveUsuarioIng As Integer) As Boolean + Public Function AddEtapaProceso(EtapaProceso As String, Descripcion As String, CveTipoEtapa As Integer, Orden As Integer, CveTipoProceso As Integer, CveEmpresa As Integer, CveUsuarioIng As Integer, Optional EsCotizacion As Boolean = False) As Boolean Dim Retorno As Boolean = False DataAdapter("PA_CRM_EtapaProcesoAdd") With SqlAdapter.SelectCommand.Parameters @@ -371,17 +371,26 @@ Public Class ClsCRM .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa .Add("@CveUsuarioIng", SqlDbType.Int).Value = CveUsuarioIng + .Add("@EsCotizacion", SqlDbType.Bit).Value = EsCotizacion End With Try SqlAdapter.Fill(Data) Retorno = True Catch ex As Exception - OnError("Ocurrió un error al agregar la Etapa al Proceso.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) + + If ex.Message.Contains("Ya existe una cotización en el proceso") Then + Alert("Ya existe una cotización en el proceso", TipoMensaje.MsgAdvertencia) + Else + OnError("Ocurrió un error al agregar la Etapa al Proceso.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) + End If + + + End Try Return Retorno End Function - Public Function UpdateEtapaProceso(EtapaProceso As String, Descripcion As String, CveEstatus As Boolean, CveTipoEtapa As Integer, Orden As Integer, CveEtapaProceso As Integer) As Boolean + Public Function UpdateEtapaProceso(EtapaProceso As String, Descripcion As String, CveEstatus As Boolean, CveTipoEtapa As Integer, Orden As Integer, CveEtapaProceso As Integer, Optional EsCotizacion As Boolean = False) As Boolean Dim Retorno As Boolean = False DataAdapter("PA_CRM_EtapaProcesoUpdate") With SqlAdapter.SelectCommand.Parameters @@ -393,12 +402,19 @@ Public Class ClsCRM .Add("@Orden", SqlDbType.Int).Value = Orden .Add("@CveEtapaProceso", SqlDbType.Int).Value = CveEtapaProceso + .Add("@EsCotizacion", SqlDbType.Bit).Value = EsCotizacion End With Try SqlAdapter.Fill(Data) Retorno = True Catch ex As Exception - OnError("Ocurrió un error al actualizar la Etapa del Proceso.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) + + If ex.Message.Contains("Ya existe una cotización en el proceso") Then + Alert("Ya existe una cotización en el proceso", TipoMensaje.MsgAdvertencia) + Else + OnError("Ocurrió un error al actualizar la Etapa del Proceso.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) + End If + End Try Return Retorno End Function @@ -812,6 +828,26 @@ Public Class ClsCRM Return Retorno End Function + + Public Function UpdateAcercamientoCotizacion(cveAcercamiento As Integer, Importe As Decimal, CveEmpresa As Integer) As Boolean + + Dim Retorno As Boolean = False + DataAdapter("PA_CRM_AcercamientoCotizacionUpdate") + With SqlAdapter.SelectCommand.Parameters + .Add("@CveAcercamiento", SqlDbType.Int).Value = cveAcercamiento + .Add("@Importe", SqlDbType.Money).Value = Importe + .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa + End With + Try + SqlAdapter.Fill(Data) + Retorno = True + Catch ex As Exception + OnError("Ocurrió un error al actualizar el Acercamiento.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) + End Try + Return Retorno + + End Function + Public Function RemoveAcercamiento(CveAcercamiento As Integer, CveEmpresa As Integer) As Boolean Dim Retorno As Boolean = False DataAdapter("PA_CRM_AcercamientoRemove") @@ -1129,6 +1165,41 @@ Public Class ClsCRM End Try Return retorno End Function + + + + + + + + + Public Function RepAgendasBitacoras(CveEmpresa As Integer, CveVendedor As Integer, CveTipoProceso As Integer, FechaInicio As Date, FechaFin As Date) As Boolean + Dim retorno As Boolean = False + DataAdapter("PA_CRM_RepAgendasBitacoras", CommandType.StoredProcedure) + With SqlAdapter.SelectCommand.Parameters + + .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa + .Add("@CveVendedor", SqlDbType.Int).Value = CveVendedor + .Add("@CveTipoProceso", SqlDbType.Int).Value = CveTipoProceso + .Add("@FechaInicio", SqlDbType.Date).Value = FechaInicio + .Add("@FechaFin", SqlDbType.Date).Value = FechaFin + + + End With + Try + SqlAdapter.Fill(Data) + retorno = True + Catch ex As Exception + OnError("Ocurrió un error al obtener el Reporte de Agendas Bitácoras.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) + End Try + Return retorno + End Function + + + + + + #End Region #Region "Asignar Vendedor a Prospectos" @@ -1266,5 +1337,7 @@ Public Class ClsCRM End Try Return Retorno End Function + + #End Region End Class diff --git a/App_Code/ClsPaginas.vb b/App_Code/ClsPaginas.vb index 92608d0ba..c3e21f987 100644 --- a/App_Code/ClsPaginas.vb +++ b/App_Code/ClsPaginas.vb @@ -4919,6 +4919,7 @@ Public Class ClsPaginas 'PaginaDict.Add("/CRM/Acercamiento.aspx".ToUpper(), 1308) PaginaDict.Add("/CRM/Acercamiento.aspx".ToUpper(), 1305) PaginaDict.Add("/CRM/RepAcercamientos.aspx".ToUpper(), 1311) + PaginaDict.Add("/CRM/RepAgendasBitacoras.aspx".ToUpper(), 1333) PaginaDict.Add("/CRM/PopUpBuscarAcercamiento.aspx".ToUpper(), 1312) PaginaDict.Add("/CRM/RepAcercamientosProcesos.aspx".ToUpper(), 1313) PaginaDict.Add("/CRM/RepAcercamientosRechazos.aspx".ToUpper(), 1314) diff --git a/Ashx/CargaEventos.ashx b/Ashx/CargaEventos.ashx index f70089d3d..4c6b6c44b 100644 --- a/Ashx/CargaEventos.ashx +++ b/Ashx/CargaEventos.ashx @@ -133,6 +133,17 @@ Public Class CargaEventos : Implements IHttpHandler, IRequiresSessionState cevent.CveContactoCRM = dr("CveContactoCRM").ToString cevent.CveAcercamientoCRM = dr("CveAcercamientoCRM").ToString + cevent.CvePersonal = dr("CvePersonal").ToString.ToEntero + cevent.CveCliente = dr("CveCliente").ToString.ToEntero + cevent.CveProveedor = dr("CveProveedor").ToString.ToEntero + + + + cevent.NombreCliente = dr("NombreCliente").ToString + cevent.NombreProveedor = dr("NombreProveedor").ToString + cevent.NomprePersonal = dr("NomprePersonal").ToString + + cevent.NombreAcercamiento = dr("NombreAcercamiento").ToString '11/05/2018 - Evento Gasto Recurrente cevent.CveTipoEvento = dr("CveTipoEvento").ToString.ToEntero diff --git a/Bin/ADSNetLibrary.dll b/Bin/ADSNetLibrary.dll index 6f63611e6..91c5f029d 100644 Binary files a/Bin/ADSNetLibrary.dll and b/Bin/ADSNetLibrary.dll differ diff --git a/CRM/Acercamiento.aspx b/CRM/Acercamiento.aspx index 098d2817c..249a0a419 100644 --- a/CRM/Acercamiento.aspx +++ b/CRM/Acercamiento.aspx @@ -417,14 +417,20 @@ -
+
+ +
+ + +
+
- + @@ -877,13 +883,13 @@
- - + diff --git a/CRM/Acercamiento.aspx.cs b/CRM/Acercamiento.aspx.cs index 490cb25e5..7606eebda 100644 --- a/CRM/Acercamiento.aspx.cs +++ b/CRM/Acercamiento.aspx.cs @@ -291,6 +291,25 @@ public partial class CRM_Acercamiento : ClsPaginas //public int RCveEvento { get { return ViewState["RCveEvento"] != null ? ViewState["RCveEvento"].ToString().ToEntero() : 0; } set { ViewState["RCveEvento"] = value; } } public System.Data.DataTable CheckListNew { get { return ViewState["CheckListNew"] != null ? (System.Data.DataTable)ViewState["CheckListNew"] : null; } set { ViewState["CheckListNew"] = value; } } public int chklistitemindex { get { return ViewState["chklistitemindex"] != null ? ViewState["chklistitemindex"].ToString().ToEntero() : 0; } set { ViewState["chklistitemindex"] = value; } } + + + private long CveEtapaProcesoActualVal + { + get + { + if (ViewState["CveEtapaProcesoActualVal"] == null) + { + ViewState["CveEtapaProcesoActualVal"] = -1; + } + return ViewState["CveEtapaProcesoActualVal"].ToString().ToEntero(); + } + + set + { + ViewState["CveEtapaProcesoActualVal"] = value; + } + } + #endregion protected void Page_Load(object sender, EventArgs e) @@ -383,6 +402,9 @@ public partial class CRM_Acercamiento : ClsPaginas //SECCION DATOS DEL PROCESO DdlEtapaProceso.SelectedValueExist(objAcercamiento.Result[0].CveEtapaProcesoActual); + + CveEtapaProcesoActualVal = objAcercamiento.Result[0].CveEtapaProcesoActual; + DdlVendedor.SelectedValueExist(objAcercamiento.Result[0].CveVendedor); DdlMedioCaptacion.SelectedValueExist(objAcercamiento.Result[0].CveMedioCaptacion); @@ -413,6 +435,19 @@ public partial class CRM_Acercamiento : ClsPaginas BtnGuardarAcercamiento.Text = "Actualizar"; BtnGuardarAcercamiento.Visible = true; BtnEliminarAcercamiento.Visible = true; + + + if(DdlEmpresaCRM.SelectedValue.ToEntero() > 0) + { + LnkEmpresaCRM.NavigateUrl = $"~/CRM/EmpresaCRM.aspx?CveEmpresaCRM={DdlEmpresaCRM.SelectedValue}"; + + LnkEmpresaCRM.Text = DdlEmpresaCRM.SelectedItem.Text; + + DVEmpresaDdl.Visible = false; + DVEmpresaLnk.Visible = true; + } + + } else @@ -653,24 +688,90 @@ public partial class CRM_Acercamiento : ClsPaginas } protected void DdlEtapaProceso_SelectedIndexChanged(object sender, EventArgs e) { - if (ActivaFechaCierre(DdlEtapaProceso.SelectedValue.ToEntero())) + + if (ValidaEtapaCotizacion(DdlEtapaProceso.SelectedValue.ToEntero())) { - TxtFechaCierre.Text = DateTime.Now.ToShortDateString(); + if (ActivaFechaCierre(DdlEtapaProceso.SelectedValue.ToEntero())) + { + TxtFechaCierre.Text = DateTime.Now.ToShortDateString(); + } + else + { + TxtFechaCierre.Text = ""; + if (DTEtapasProceso.FiltraParametros(String.Format("CveEtapaProceso = {0} AND CveTipoEtapa = 4", DdlEtapaProceso.SelectedValue.ToEntero())).Rows.Count > 0) + { + LnkCerrarAcercamiento_Click(null, null); + } + } + + //AUTOGUARDADO DE CAMBIO DE ETAPA + if (DTEtapasProceso.FiltroPrimeroValor("CveTipoEtapa", String.Format("CveEtapaProceso = {0}", DdlEtapaProceso.SelectedValue.ToEntero())).Contiene("1", "2", "3")) + GuardarCambioEtapa(); } else { - TxtFechaCierre.Text = ""; - if (DTEtapasProceso.FiltraParametros(String.Format("CveEtapaProceso = {0} AND CveTipoEtapa = 4", DdlEtapaProceso.SelectedValue.ToEntero())).Rows.Count > 0) - { - LnkCerrarAcercamiento_Click(null, null); - } + DdlEtapaProceso.SelectedValueExist(CveEtapaProcesoActualVal); + UPAcercamiento.Update(); } - //AUTOGUARDADO DE CAMBIO DE ETAPA - if (DTEtapasProceso.FiltroPrimeroValor("CveTipoEtapa", String.Format("CveEtapaProceso = {0}", DdlEtapaProceso.SelectedValue.ToEntero())).Contiene("1", "2", "3")) - GuardarCambioEtapa(); + + + } + + private bool ValidaEtapaCotizacion(int CveEtapaProcesoValidar) + { + bool Respuesta = false; + + int OrdenCotizacion = -1; + int OrdenValidar = -1; + + if(DTEtapasProceso.FiltraParametros(" EsCotizacion = 'true' ").Rows.Count == 1) + { + OrdenCotizacion = DTEtapasProceso.FiltroPrimeroValor("Orden", " EsCotizacion = 'true' ").ToEntero(); + OrdenValidar = DTEtapasProceso.FiltroPrimeroValor("Orden", $" CveEtapaProceso = {CveEtapaProcesoValidar} ").ToEntero(); + + if(OrdenValidar > OrdenCotizacion) + { + IVentaService ventaService = new VentaService(System.Configuration.ConfigurationManager.ConnectionStrings["Conexion"].ConnectionString); + RequestVentas requestVentas = new RequestVentas(UsuarioActual.CveEmpresa, TipoDocto: "Cot", CveEmpresaCRM: CveEmpresaCRM, CveUsuarioConsulta: UsuarioActual.CveUsuario, CveAcercamientoCRM: CveAcercamiento); + var objVentas = ventaService.GetVentas(requestVentas); + + if (objVentas.IsSuccess) + { + if(objVentas.Result.Count > 0) + { + CveEtapaProcesoActualVal = CveEtapaProcesoValidar; + Respuesta = true; + } + else + { + Alert("Se require una cotización para continuar a la etapa seleccionada.", ModExtensiones.TipoMensaje.MsgAdvertencia); + Respuesta = false; + } + } + else { + Alert("No se pudo validar el cambio de etapa", ModExtensiones.TipoMensaje.MsgAdvertencia); + Respuesta = false; + } + } + else + { + Respuesta = true; + } + } + else + { + Respuesta = true; + } + + + + + return Respuesta; + } + private void CargarPS() { DdlPS.setEsWebService(true); @@ -1750,7 +1851,7 @@ public partial class CRM_Acercamiento : ClsPaginas #region "TAB COTIZACIONES" protected void CargaCotizaciones() { - ClsVentas ObjVentas = new ClsVentas(); + IVentaService ventaService = new VentaService(System.Configuration.ConfigurationManager.ConnectionStrings["Conexion"].ConnectionString); RequestVentas requestVentas = new RequestVentas(UsuarioActual.CveEmpresa, TipoDocto: "Cot", CveEmpresaCRM: CveEmpresaCRM, CveUsuarioConsulta: UsuarioActual.CveUsuario, CveAcercamientoCRM: CveAcercamiento); var objVentas = ventaService.GetVentas(requestVentas); @@ -1760,7 +1861,7 @@ public partial class CRM_Acercamiento : ClsPaginas GvCotizacion.DataSource = objVentas.Result; TieneCotizacion = objVentas.Result.Count > 0; } - ObjVentas.Dispose(); + GvCotizacion.DataBind(); UpCotizacion.Update(); @@ -1774,6 +1875,7 @@ public partial class CRM_Acercamiento : ClsPaginas if (e.Row.DataKey("CveEstatusFactura").ToEntero() > 0) { e.Row.FCLabel("lblEstatus").Text = String.Format("{0}", e.Row.DataKey("EstatusFactura")); + e.Row.Cells[2].Text = e.Row.DataKey("Total").ToDecimal().ToString("###,###,###.00"); } } } diff --git a/CRM/CatEtapasProceso.aspx b/CRM/CatEtapasProceso.aspx index 1ec7ff0ef..91d50f264 100644 --- a/CRM/CatEtapasProceso.aspx +++ b/CRM/CatEtapasProceso.aspx @@ -73,7 +73,7 @@ " style="display: inline-block; margin-right: -20px; width: 150px;" /> " style="margin-top: -3px;" class="btn btn-circle btn-sm label-info">
- @@ -103,6 +103,13 @@ + + + + + + + @@ -165,6 +172,13 @@
+ +
+ + +
+ +
diff --git a/CRM/CatEtapasProceso.aspx.cs b/CRM/CatEtapasProceso.aspx.cs index 2fc3b29a8..13f128f72 100644 --- a/CRM/CatEtapasProceso.aspx.cs +++ b/CRM/CatEtapasProceso.aspx.cs @@ -152,6 +152,7 @@ public partial class CRM_CatEtapasProceso : ClsPaginas TxtEtapaProceso.Text = ""; TxtDescripcion.Text = ""; ChkEstatus.Checked = true; + ChkEsCotizacion.Checked = false; UPModal.Update(); } @@ -234,6 +235,8 @@ public partial class CRM_CatEtapasProceso : ClsPaginas TxtEtapaProceso.Text = GvRow.DataKey("EtapaProceso").ToString(); TxtDescripcion.Text = GvRow.DataKey("Descripcion").ToString(); ChkEstatus.Checked = GvRow.DataKey("CveEstatus").ToString() == "True" ? true : false; + ChkEsCotizacion.Checked = GvRow.DataKey("EsCotizacion").ToString() == "True" ? true : false; + CargaDdlOrden(GvRow.DataKey("CveTipoProceso").ToEntero()); @@ -293,7 +296,7 @@ public partial class CRM_CatEtapasProceso : ClsPaginas int CveUsuarioIng = UsuarioActual.CveUsuario; if (EsEditar == 0) { - if (ObjCRM.AddEtapaProceso(EtapaProceso, Descripcion, CveTipoEtapa, Orden, CveTipoProceso, UsuarioActual.CveEmpresa, CveUsuarioIng)) + if (ObjCRM.AddEtapaProceso(EtapaProceso, Descripcion, CveTipoEtapa, Orden, CveTipoProceso, UsuarioActual.CveEmpresa, CveUsuarioIng, EsCotizacion:ChkEsCotizacion.Checked)) { Alert(String.Format("La Etapa fue creada correctamente para el proceso {0}.", DdlTipoProceso.SelectedItem), ModExtensiones.TipoMensaje.MsgInformacion); } @@ -302,7 +305,7 @@ public partial class CRM_CatEtapasProceso : ClsPaginas { Orden = Estatus ? DdlOrden.SelectedValue.ToEntero() : -1; - if (ObjCRM.UpdateEtapaProceso(EtapaProceso, Descripcion, Estatus, CveTipoEtapa, Orden, CveEtapaProceso)) + if (ObjCRM.UpdateEtapaProceso(EtapaProceso, Descripcion, Estatus, CveTipoEtapa, Orden, CveEtapaProceso, EsCotizacion: ChkEsCotizacion.Checked)) { Alert("La Etapa fue actualizada correctamente.", ModExtensiones.TipoMensaje.MsgInformacion); } diff --git a/CRM/EmpresaCRM.aspx b/CRM/EmpresaCRM.aspx index 6d388ebd4..7d4d2f15f 100644 --- a/CRM/EmpresaCRM.aspx +++ b/CRM/EmpresaCRM.aspx @@ -8,9 +8,9 @@ resize: none; } - .ADScroller-body { + /* .ADScroller-body { max-height: 140px !important; - } + }*/ .ADScroller-footer { visibility: hidden; @@ -270,29 +270,35 @@
- -   + <%-- --%> +   - +   - + + + + + + @@ -302,6 +308,8 @@ + + @@ -574,13 +582,22 @@
-
- - - <%----%> - +
+
+ + + <%----%> + +
+ +
+ + +
+ +
@@ -602,6 +619,12 @@
+
+ + +
+ +
<%-- FIN MODAL BITACORA --%> + + + <%--INICIO MODAL CONTACTO AGENDA--%> + + + + + + + + <%--FIN MODAL CONTACTO AGENDA--%> + <%-- FIN MODALES --%> diff --git a/CRM/EmpresaCRM.aspx.cs b/CRM/EmpresaCRM.aspx.cs index ffe0303e3..5d694eff3 100644 --- a/CRM/EmpresaCRM.aspx.cs +++ b/CRM/EmpresaCRM.aspx.cs @@ -893,6 +893,7 @@ public partial class CRM_EmpresaCRM : ClsPaginas protected void EliminarEmpresa() { + string ErrorEliminacionEmpresa = ""; Boolean HuboError = true; ClsCRM ObjCRM = new ClsCRM(); @@ -916,12 +917,19 @@ public partial class CRM_EmpresaCRM : ClsPaginas var responseModelRemoveEncuestaAplicada = encuestaService.RemoveEncuestaAplicada(new RequestEncuestaAplicadaRemove() { CveEmpresa = UsuarioActual.CveEmpresa, CveEncuestaAplicada = CveEncuestaAplicada }); if (CveEncuestaAplicada > 0 && !responseModelRemoveEncuestaAplicada.IsSuccess) { - HuboError = true; + HuboError = true; } } else { HuboError = true; + + + if (cRMService.Mensaje != null && cRMService.Mensaje != "") + { + ErrorEliminacionEmpresa = cRMService.Mensaje; + + } } } @@ -943,7 +951,18 @@ public partial class CRM_EmpresaCRM : ClsPaginas else { ObjCRM.RollBack(); - Alert("Ocurrio un error al intentar eliminar la empresa.", ModExtensiones.TipoMensaje.MsgError); + + if(ErrorEliminacionEmpresa.Trim().Length > 0 && ErrorEliminacionEmpresa.Contains("547;")) + { + Alert("No se puede eliminar la empresa debido a que tiene registros realcionados.", ModExtensiones.TipoMensaje.MsgAdvertencia); + + + } + else + { + Alert("Ocurrio un error al intentar eliminar la empresa.", ModExtensiones.TipoMensaje.MsgError); + } + } @@ -1003,6 +1022,8 @@ public partial class CRM_EmpresaCRM : ClsPaginas TempDTContactos = null; ICRMService cRMService = new CRMService(System.Configuration.ConfigurationManager.ConnectionStrings["Conexion"].ConnectionString); RequestContactoEmpresaCRM contactoEmpresaCRM = new RequestContactoEmpresaCRM(CveEmpresaCRM, UsuarioActual.CveEmpresa, -1); + + var objCRM = cRMService.GetContactosEmpresasCRM(contactoEmpresaCRM); if (objCRM.Result.Count > 0) { @@ -1039,9 +1060,11 @@ public partial class CRM_EmpresaCRM : ClsPaginas } TxtNombreContacto.Text = ""; TxtTelefonoOficina.Text = ""; + TxtTelExt.Text = ""; TxtCelular.Text = ""; TxtCorreo.Text = ""; DdlTipocontacto.SelectedValueExist(-1); + DdlContactoSuperior.SelectedValueExist(-1); } protected void BtnAgregarContacto_Click(object sender, EventArgs e) @@ -1051,26 +1074,29 @@ public partial class CRM_EmpresaCRM : ClsPaginas UPModalContacto.Update(); CargaGridTipoContacto(); + CargaContactoSuperior(-1); this.RegistraScript("$('#DivModalContacto').modal();"); } protected void LnkEditarContacto_Click(object sender, EventArgs e) { + GridViewRow GvRow = (GridViewRow)(((LinkButton)sender).NamingContainer); + CveContactoEditado = GvRow.DataKey("CveContacto").ToEntero(); + CargaGridTipoContacto(); + CargaContactoSuperior(CveContactoEditado); EsEditarContacto = true; - limpiarCamposModalContato(); - - GridViewRow GvRow = (GridViewRow)(((LinkButton)sender).NamingContainer); - - CveContactoEditado = GvRow.DataKey("CveContacto").ToEntero(); + limpiarCamposModalContato(); TxtNombreContacto.Text = GvRow.DataKey("Nombre").ToString(); TxtTelefonoOficina.Text = GvRow.DataKey("TelefonoOficina").ToString(); + TxtTelExt.Text = GvRow.DataKey("TelExt").ToString(); TxtCelular.Text = GvRow.DataKey("Celular").ToString(); TxtCorreo.Text = GvRow.DataKey("Correo").ToString(); DdlTipocontacto.SelectedValueExist( GvRow.DataKey("CveTipoContacto").ToString()); + DdlContactoSuperior.SelectedValueExist(GvRow.DataKey("CveContactoSuperior").ToString()); IndexDTContacto = GvRow.RowIndex; @@ -1087,6 +1113,7 @@ public partial class CRM_EmpresaCRM : ClsPaginas String NombreContacto = TxtNombreContacto.Text; String TelefonoOficina = TxtTelefonoOficina.Text == "" ? "-1" : TxtTelefonoOficina.Text; + String TelExt = TxtTelExt.Text == "" ? "-1" : TxtTelExt.Text; String Celular = TxtCelular.Text == "" ? "-1" : TxtCelular.Text; String Correo = TxtCorreo.Text == "" ? "-1" : TxtCorreo.Text; @@ -1107,15 +1134,18 @@ public partial class CRM_EmpresaCRM : ClsPaginas { contacto.Nombre = NombreContacto; contacto.TelefonoOficina = TelefonoOficina; + contacto.TelExt = TelExt; contacto.Celular = Celular; contacto.Correo = Correo; contacto.CveEmpresaCRM = CveEmpresaCRM; contacto.CveUsuarioIng = CveUsuarioIng; contacto.CveTipoContacto = DdlTipocontacto.SelectedValue.ToEntero(); + contacto.CveContactoSuperior = DdlContactoSuperior.SelectedValue.ToEntero(); if (cRMService.EmpresasCRMContactoAdd(contacto)) { TelefonoOficina = (TelefonoOficina != "-1" ? String.Format(", Teléfono de Oficina: {0:(###) ###-####}", Convert.ToInt64(TelefonoOficina)) : ""); + TelExt = (TelExt != "-1" ? String.Format(", Teléfono extensión: {0}", TelExt):""); Celular = (Celular != "-1" ? String.Format(", Celular: {0:(###) ###-####}", Convert.ToInt64(Celular)) : ""); Correo = (Correo != "-1" ? String.Format(", Correo: {0}", Correo) : ""); @@ -1139,11 +1169,13 @@ public partial class CRM_EmpresaCRM : ClsPaginas { contacto.Nombre = NombreContacto; contacto.TelefonoOficina = TelefonoOficina; + contacto.TelExt = TelExt; contacto.Celular = Celular; contacto.Correo = Correo; contacto.CveContacto = CveContactoEditado; contacto.CveUsuarioIng = CveUsuarioIng; contacto.CveTipoContacto = DdlTipocontacto.SelectedValue.ToEntero(); + contacto.CveContactoSuperior = DdlContactoSuperior.SelectedValue.ToEntero(); if (cRMService.EmpresasCRMContactoUpdate(contacto)) { @@ -1265,6 +1297,33 @@ public partial class CRM_EmpresaCRM : ClsPaginas e.Row.FCLabel("lblCelular").Text = String.Format("{0:(###) ###-####}", Convert.ToInt64(e.Row.DataKey("Celular"))); } } + + + protected void LnkNombreContactoAgenda_Click(object sender, EventArgs e) + { + GridViewRow GvRow = (GridViewRow)(((LinkButton)sender).NamingContainer); + //CveContacto,Nombre,TelefonoOficina,Celular,Correo,CveUsuarioIng,FechaIng,CveTipoContacto + int CveContacto = GvRow.DataKey("CveContacto").ToEntero(); + string NombreContacto = GvRow.DataKey("Nombre"); + + TempDTContactos = null; + ICRMService cRMService = new CRMService(System.Configuration.ConfigurationManager.ConnectionStrings["Conexion"].ConnectionString); + RequestContactoEmpresaCRM contactoEmpresaCRM = new RequestContactoEmpresaCRM(CveEmpresaCRM, UsuarioActual.CveEmpresa, CveContacto); + + + var objCRM = cRMService.GetContactosEmpresaAgendaCRM(contactoEmpresaCRM); + + if (objCRM.Result.Count > 0) + { + GvContactoAgenda.DataSource = objCRM.Result.ToDataTable(); + GvContactoAgenda.DataBind(); + + UpModalContactoAgenda.Update(); + LblModalContactoAgendaTitulo.Text = $"Agenda: {NombreContacto}"; + RegistraScript("$('#DVModalContactoAgenda').modal('show');"); + } + } + #endregion #region "BITACORA" @@ -1904,7 +1963,7 @@ public partial class CRM_EmpresaCRM : ClsPaginas protected void LnkAgregartipoContacto_Click(object sender, EventArgs e) { - CargaGridTipoContacto(); + CargaGridTipoContacto(); RegistraScript("$('#DivModalTipoContacto').modal('show');"); } @@ -1943,6 +2002,26 @@ public partial class CRM_EmpresaCRM : ClsPaginas cRMService = null; } + + private void CargaContactoSuperior(int CveConcactoOmitir) + { + + DdlContactoSuperior.Items.Clear(); + ICRMService cRMService = new CRMService(System.Configuration.ConfigurationManager.ConnectionStrings["Conexion"].ConnectionString); + RequestContactoEmpresaCRM contactoEmpresaCRM = new RequestContactoEmpresaCRM(CveEmpresaCRM, UsuarioActual.CveEmpresa,-1); + var objcontactoEmpresa = cRMService.GetContactosEmpresasCRM(contactoEmpresaCRM); + + if (objcontactoEmpresa.Result.Count > 0) + { + DdlContactoSuperior.DataSource = objcontactoEmpresa.Result.ToDataTable().FiltraParametros((CveConcactoOmitir>0 ?$" CveContacto <> {CveConcactoOmitir} ": "" )); + DdlContactoSuperior.DataBind(); + } + DdlContactoSuperior.Items.Insert(0, new ListItem("Sin Asignar ", "-1")); + + UPModalContacto.Update(); + + + } protected void btnAgregarTipoContacto_Click(object sender, EventArgs e) { bool ErrorProceso = false; @@ -1962,7 +2041,7 @@ public partial class CRM_EmpresaCRM : ClsPaginas if (!ErrorProceso) { - CargaGridTipoContacto(); + CargaGridTipoContacto(); LimpiaTipoContacto(); } } @@ -2001,4 +2080,6 @@ public partial class CRM_EmpresaCRM : ClsPaginas + + } \ No newline at end of file diff --git a/CRM/RepAgendasBitacoras.aspx b/CRM/RepAgendasBitacoras.aspx new file mode 100644 index 000000000..0ea6824c0 --- /dev/null +++ b/CRM/RepAgendasBitacoras.aspx @@ -0,0 +1,125 @@ +<%@ Page Title="Reporte de Agendas Bitácoras" Language="C#" MasterPageFile="~/Site.master" AutoEventWireup="true" CodeFile="RepAgendasBitacoras.aspx.cs" Inherits="CRM_AgendasBitacoras" %> + + + + + + + Reporte de Agendas Bitácoras + + + + + + +
  • + +
  • +
    + + + +
    +
    + + + + + +
    +
    +
    + + +
    + +
    +
    + + +
    + + +
    + + +
    + +
    + + +
    +
    + + + + +
    + + +
    + + +
    +
    + + + + +
    + + +
    + + + + + + + +
    +
    +
    + +
    +
    +
    + + + +
    + " style="display: inline-block; margin-right: -20px; width: 150px;" /> + " style="margin-top: -3px;" class="btn btn-circle btn-sm label-info"> +
    + + + + + + + + + + + + + + + + +
    +
    + + +
    + + + diff --git a/CRM/RepAgendasBitacoras.aspx.cs b/CRM/RepAgendasBitacoras.aspx.cs new file mode 100644 index 000000000..3a460798c --- /dev/null +++ b/CRM/RepAgendasBitacoras.aspx.cs @@ -0,0 +1,108 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Web; +using System.Web.UI; +using System.Web.UI.WebControls; +using Extensiones; +using System.Data; +using Microsoft.Reporting.WebForms; + +using ADSNetLibrary.SIGAPI.Services.CRM; +using ADSNetLibrary.SIGAPI.Models.CRM.Request; + +//using ADSNetLibrary.SIGAPI.Helpers; + +public partial class CRM_AgendasBitacoras : ClsPaginas +{ + + + protected void Page_Load(object sender, EventArgs e) + { + if (!IsPostBack) + { + InicializaDatos(); + CargaDatos(); + + } + } + + #region "CARGA DATOS" + protected void BtnConsultar_Click(object sender, EventArgs e) + { + CargaDatos(); + } + + protected void CargaDatos() + { + ClsCRM ObjCRM = new ClsCRM(); + //nt CveEmpresa, int CveVendedor, int CveTipoProceso, DateTime FechaInicio, DateTime FechaFin + + if (ObjCRM.RepAgendasBitacoras(UsuarioActual.CveEmpresa, DdlVendedor.SelectedValue.ToEntero(),DdlTipoProceso.SelectedValue.ToEntero(), TxtFechaInicio.Text.ToDate(), TxtFechaFin.Text.ToDate())) + { + GVDatos.DataSource = ObjCRM.DtResultados; + GVDatos.DataBind(); + } + + ObjCRM.Dispose(); + UPDatos.Update(); + + } + + protected void GVDatos_RowDataBound(object sender, GridViewRowEventArgs e) + { + if (e.Row.RowType == DataControlRowType.DataRow) + { + //if (e.Row.DataKey("CveAcercamiento").ToEntero() > 0) + // e.Row.FCHyperLink("HplNombreAcercamiento").NavigateUrl = String.Format("/CRM/Acercamiento.aspx?CveAcercamiento={0}", e.Row.DataKey("CveAcercamiento")); + } + } + + protected void InicializaDatos() + { + + + DdlVendedor.DataSource = get_GlobalDTVendedores(UsuarioActual.CveEmpresa); + DdlVendedor.Items.Insert(0, new ListItem("Todos ", "-1")); + DdlVendedor.DataBind(); + + DdlVendedor.SelectedValueExist(UsuarioActual.CveVendedor); + + //CALCULAMOS EL INTERVALO DE LA SEMANA ACTUAL + TxtFechaInicio.Text = DateTime.Now.AddDays(-((int)DateTime.Now.DayOfWeek) + 1).ToShortDateString(); + TxtFechaFin.Text = DateTime.Now.AddDays((7 - (int)DateTime.Now.DayOfWeek)).ToShortDateString(); + //DdlPS.setEsWebService(true); + //DdlPS.SelectedValue = "-1"; + //DdlPS.SelectedText = "Todos"; + //DataTable dtGiroClasificaciones = get_GlobalDTClienteClasificaciones(UsuarioActual.CveEmpresa); + //DdlGiroClasificacion.DataSource = dtGiroClasificaciones; + //DdlGiroClasificacion.DataBind(); + //DdlGiroClasificacion.Items.Insert(0, new ListItem("Todos", "-1")); + + ICRMService cRMService = new CRMService(System.Configuration.ConfigurationManager.ConnectionStrings["Conexion"].ConnectionString); + RequestEtapaProceso EtapaProceso = new RequestEtapaProceso(UsuarioActual.CveEmpresa, 1, -1); + RequestMedioCaptacion MedioCaptacion = new RequestMedioCaptacion(UsuarioActual.CveEmpresa); + RequestTipoProceso tipoProceso = new RequestTipoProceso(UsuarioActual.CveEmpresa, 1, -1); + + //DdlEtapaProceso .DataSource = ADSNetLibrary.SIGAPI.Helpers.ExtensionMethods.ToDataTable(cRMService.GetEtapaProcesoCRM(EtapaProceso).Result); + //DdlMedioCaptacion.DataSource = ADSNetLibrary.SIGAPI.Helpers.ExtensionMethods.ToDataTable( cRMService.GetMedioCaptacionCRM(MedioCaptacion).Result); + DdlTipoProceso.DataSource = ADSNetLibrary.SIGAPI.Helpers.ExtensionMethods.ToDataTable(cRMService.GetTipoProcesoCRM(tipoProceso).Result); + + //DdlEtapaProceso.DataBind(); + //DdlMedioCaptacion.DataBind(); + DdlTipoProceso.DataBind(); + + //DdlEtapaProceso.Items.Insert(0,new ListItem("Todas", "-1")); + //DdlMedioCaptacion.Items.Insert(0, new ListItem("Todos", "-1")); + DdlTipoProceso.Items.Insert(0, new ListItem("Todos", "-1")); + } + #endregion + + + + + protected void LnkExcel_Click(object sender, EventArgs e) + { + GVDatos.ExportToExcelx("RepAgendaBiracora.xls"); + } +} \ No newline at end of file diff --git a/Inicio.aspx b/Inicio.aspx index 073e2e4ee..69a8ec09f 100644 --- a/Inicio.aspx +++ b/Inicio.aspx @@ -1322,7 +1322,7 @@