diff --git a/App_Code/ClsMovimientos.vb b/App_Code/ClsMovimientos.vb index 56829dfa0..5caa49efb 100644 --- a/App_Code/ClsMovimientos.vb +++ b/App_Code/ClsMovimientos.vb @@ -152,7 +152,8 @@ Public Class ClsMovimientos .Add("@FechaVencimientoF", SqlDbType.Date).Value = FechaVencimientoF End With - Try + Try + SqlAdapter.SelectCommand.CommandTimeout = 0 SqlAdapter.Fill(Data) Retorno = True Catch ex As SqlException diff --git a/Bin/ADSNetLibrary.dll b/Bin/ADSNetLibrary.dll index 8071a9a71..90c5f7b0f 100644 Binary files a/Bin/ADSNetLibrary.dll and b/Bin/ADSNetLibrary.dll differ diff --git a/CRM/Acercamiento.aspx b/CRM/Acercamiento.aspx index c1345f8ca..f75e9a814 100644 --- a/CRM/Acercamiento.aspx +++ b/CRM/Acercamiento.aspx @@ -419,7 +419,7 @@
- + @@ -534,7 +534,36 @@
-
+ + + + + + + + + <%--END DATOS DE EMPRESA CRM --%> + +
+ +
+ +
+ +
+
+
+ + Check List +
+
+
+
+
+
+ +
+ @@ -557,7 +586,7 @@
- @@ -603,7 +632,9 @@
- <%--END DATOS DE EMPRESA CRM --%> + +
+
@@ -978,9 +1009,7 @@ <%----%> - - + + + + <%--
+
+ + + --%> +
diff --git a/CRM/Acercamiento.aspx.cs b/CRM/Acercamiento.aspx.cs index 97a6fe078..59a3b88dc 100644 --- a/CRM/Acercamiento.aspx.cs +++ b/CRM/Acercamiento.aspx.cs @@ -14,6 +14,7 @@ using System.Collections.Generic; using System.Data; using System.Data.SqlClient; using System.IO; +using System.IO.Packaging; using System.Linq; using System.Web; using System.Web.UI; @@ -421,6 +422,11 @@ public partial class CRM_Acercamiento : ClsPaginas DivBitacora.Visible = true; CargaEventoBitacora(HdfEtapaSeleccionada.Value.ToEntero()); } + else + { + CargaEventoBitacora(-1); + } + } CargaImagenes(); @@ -843,7 +849,8 @@ public partial class CRM_Acercamiento : ClsPaginas } objBitacora.Dispose(); - } + } + #endregion #region "FINALIZACION DE ACERCAMIENTO" @@ -1076,16 +1083,16 @@ public partial class CRM_Acercamiento : ClsPaginas if (ObjEventoBitacora.GetAgendaBitacora(UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, CveAcercamientoCRM: CveAcercamiento)) { - DTEventosBitacora = ObjEventoBitacora.DtResultados.FiltraParametros("CveTipoEvento = 6 OR CveTipoEvento = 2"); + DTEventosBitacora = ObjEventoBitacora.DtResultados.FiltraParametros("[CveTipoEvento] = 6 OR [CveTipoEvento] = 2"); if (CveEtapa == -1) { - GVEventoBitacora.DataSource = DTEventosBitacora.FiltraParametros(String.Format("Archivo = '' OR Archivo IS NULL", CveEtapa)); - RptArchivosBitacora.DataSource = DTEventosBitacora.FiltraParametros(String.Format("Archivo <> ''", CveEtapa)); + GVEventoBitacora.DataSource = DTEventosBitacora.FiltraParametros(String.Format("[Archivo] = '' OR [Archivo] IS NULL OR CONVERT([Descripcion],System.String) LIKE 'Check List%'", CveEtapa)); + RptArchivosBitacora.DataSource = DTEventosBitacora.FiltraParametros(String.Format("[Archivo] <> ''", CveEtapa)); } else { - GVEventoBitacora.DataSource = DTEventosBitacora.FiltraParametros(String.Format("CveEtapaProcesoCRM = {0} AND ( Archivo = '' OR Archivo IS NULL)", CveEtapa)); - RptArchivosBitacora.DataSource = DTEventosBitacora.FiltraParametros(String.Format("CveEtapaProcesoCRM = {0} AND Archivo <> ''", CveEtapa)); + GVEventoBitacora.DataSource = DTEventosBitacora.FiltraParametros(String.Format("[CveEtapaProcesoCRM] = {0} AND ( [Archivo] = '' OR [Archivo] IS NULL ) OR CONVERT([Descripcion],System.String) LIKE 'Check List%'", CveEtapa)); + RptArchivosBitacora.DataSource = DTEventosBitacora.FiltraParametros(String.Format("[CveEtapaProcesoCRM] = {0} AND [Archivo] <> '' OR CONVERT([Descripcion],System.String) LIKE 'Check List%'", CveEtapa)); } } else @@ -1097,6 +1104,8 @@ public partial class CRM_Acercamiento : ClsPaginas GVEventoBitacora.DataBind(); RptArchivosBitacora.DataBind(); + + UPBitacora.Update(); } protected void GVEventoBitacora_RowDataBound(object sender, GridViewRowEventArgs e) @@ -1182,7 +1191,10 @@ public partial class CRM_Acercamiento : ClsPaginas int CveEmpresaCRM = DdlEmpresaCRM.SelectedValue.ToEntero(); int CveEtapa = HdfEtapaSeleccionada.Value.ToEntero() == -1 ? CveEtapaActual : HdfEtapaSeleccionada.Value.ToEntero(); - if (ObjEventos.AddEventoAgenda(DdlTipoAgenda.SelectedValue.ToEntero(), TxtAsuntoAgenda.Text, TxtDescripcionAgenda.Text, DdlPrioridadAgenda.SelectedValue.ToEntero(), FechaInicio, FechaInicio, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, CveTipoProcesoCRM: CveTipoProceso, CveAcercamientoCRM: CveAcercamiento, CveContactoCRM: CveContactoAgendar, CveEtapaProcesoCRM: CveEtapa, CveEmpresaCRM: CveEmpresaCRM)) + + string AgendaDescripcion = $"{ TxtNombreAcercamiento.Text.Trim()} {TxtDescripcionAgenda.Text.Trim()}"; + + if (ObjEventos.AddEventoAgenda(DdlTipoAgenda.SelectedValue.ToEntero(), TxtAsuntoAgenda.Text, AgendaDescripcion, DdlPrioridadAgenda.SelectedValue.ToEntero(), FechaInicio, FechaInicio, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, CveTipoProcesoCRM: CveTipoProceso, CveAcercamientoCRM: CveAcercamiento, CveContactoCRM: CveContactoAgendar, CveEtapaProcesoCRM: CveEtapa, CveEmpresaCRM: CveEmpresaCRM)) { limpiarModalAgendar(); RegistraScript("$('#ModalAgenda').modal('hide')"); @@ -1845,12 +1857,15 @@ public partial class CRM_Acercamiento : ClsPaginas protected void LnkAgregarchklistitem_Click(object sender, EventArgs e) { + bool procesoOk = false; + if (TxtActividad.Text.Trim().Length > 0) { if (CveAcercamiento > 0) { using (ClsOIEventos objOI = new ClsOIEventos()) { + objOI.IniciaTransacSQL(); if (objOI.Addcheklist(-1, TxtActividad.Text, UsuarioActual.CveUsuario, CveAcercamiento: CveAcercamiento)) { Alert("Se agregó la actividad", ModExtensiones.TipoMensaje.ToastInformacion); @@ -1858,8 +1873,24 @@ public partial class CRM_Acercamiento : ClsPaginas { GVcheklist.DataSource = objOI.DtResultados; GVcheklist.DataBind(); + if (BitacoraCheckList(objOI.IniciaTransacSQL(), $"Check List se agrega actividad {TxtActividad.Text}", CveAcercamiento)) + { + procesoOk = true; + } } + } + + + if (procesoOk) + { + objOI.Commit(); + CargaEventoBitacora((CveEtapaActual > 0 ? HdfEtapaSeleccionada.Value.ToEntero() : -1)); } + else + { + objOI.RollBack(); + } + } } else @@ -1883,25 +1914,48 @@ public partial class CRM_Acercamiento : ClsPaginas { CheckBox chk = (CheckBox)sender; GridViewRow gvrow = (GridViewRow)chk.NamingContainer; + bool procesoOk = false; + using (ClsOIEventos objOI = new ClsOIEventos()) { + string EventoComentario = gvrow.DataKey("EventoComentario"); + + objOI.IniciaTransacSQL(); if (objOI.Upcheklist(gvrow.DataKey("CveEventoCheckList").ToEntero(), gvrow.DataKey("CveEvento").ToEntero(), gvrow.DataKey("EventoComentario"), chk.Checked, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, CveAcercamiento: CveAcercamiento)) { - //ObjEventosCorreo o = objOI.objCorreo; + Alert("Se actualizó el estatus de la actividad", ModExtensiones.TipoMensaje.ToastInformacion); if (objOI.Getcheklist(-1, CveAcercamiento: CveAcercamiento)) { GVcheklist.DataSource = objOI.DtResultados; - GVcheklist.DataBind(); + GVcheklist.DataBind(); + + if (BitacoraCheckList(objOI.IniciaTransacSQL(), $"Check List {(chk.Checked == true ? "Se termina actividad ":" se retorna actividad") } {EventoComentario}", CveAcercamiento)) + { + procesoOk = true; + } } } + + + if (procesoOk) + { + objOI.Commit(); + CargaEventoBitacora((CveEtapaActual > 0 ? HdfEtapaSeleccionada.Value.ToEntero() : -1)); + } + else + { + objOI.RollBack(); + } } } protected void LnkEliminarchek_Click(object sender, EventArgs e) { + bool procesoOk = false; + GridViewRow gvrow = (GridViewRow)((LinkButton)sender).NamingContainer; if(!(CveAcercamiento > 0)) @@ -1914,6 +1968,9 @@ public partial class CRM_Acercamiento : ClsPaginas { using (ClsOIEventos objOI = new ClsOIEventos()) { + objOI.IniciaTransacSQL(); + string EventoComentario = gvrow.DataKey("EventoComentario"); + if (objOI.Removecheklist(gvrow.DataKey("CveEventoCheckList").ToEntero(), gvrow.DataKey("CveEvento").ToEntero(), UsuarioActual.CveUsuario, CveAcercamiento: CveAcercamiento)) { Alert("Se ha eliminadó la actividad", ModExtensiones.TipoMensaje.ToastInformacion); @@ -1921,12 +1978,43 @@ public partial class CRM_Acercamiento : ClsPaginas { GVcheklist.DataSource = objOI.DtResultados; GVcheklist.DataBind(); - } + + if (BitacoraCheckList(objOI.IniciaTransacSQL(), $"Check List se elimina actividad {EventoComentario}", CveAcercamiento)) + { + procesoOk = true; + } + } + } + + if(procesoOk) + { + objOI.Commit(); + + CargaEventoBitacora((CveEtapaActual > 0? HdfEtapaSeleccionada.Value.ToEntero():-1)); + } + else + { + objOI.RollBack(); } } } } + + private bool BitacoraCheckList(SqlTransaction sqlTransaction, string TextoRegistroBitacora, int CveAcercamientoBitacora) + { + bool respuesta = false; + + ClsOIEventos objBitacora = new ClsOIEventos(sqlTransaction); + + if (objBitacora.AddEventoBitacora(TextoRegistroBitacora, "", UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, CveAcercamientoCRM: CveAcercamientoBitacora)) + { + respuesta = true; + } + + return respuesta; + } + protected void LnkSinfuncion_Click(object sender, EventArgs e) { // es para mandar llamar el ChkEstatus_CheckedChanged diff --git a/CRM/RepAcercamientos.aspx b/CRM/RepAcercamientos.aspx index 0fab43eb1..c4666c501 100644 --- a/CRM/RepAcercamientos.aspx +++ b/CRM/RepAcercamientos.aspx @@ -18,12 +18,18 @@
  • +
  • + + Personalizar +
  • + + @@ -68,12 +74,15 @@ - -
    -
    - -
    -
    + + +
    + + +
    + + + @@ -93,14 +102,7 @@ Activos En Pausa - - - - -
    - - -
    +
    @@ -114,6 +116,14 @@
    + + +
    +
    + +
    +
    + @@ -131,46 +141,162 @@ AutoGenerateColumns="False" EmptyDataText="No se encontraron Registros con los filtros especificados" CssClass="table table-striped table-advance table-hover Widthall mysmallbtn ScrollAD" data-sort="true" GridLines="None" EmptyDataRowStyle-HorizontalAlign="Center" OnRowDataBound="GVDatos_RowDataBound"> - + <%--0--%> +   - - + <%--1--%> + - - + <%--2--%> + - - + <%--3--%> + - - + <%--4--%> + + <%--5--%> + + + + + + <%--6--%> + + + + + + <%--7--%> + + + + + + <%--8--%> + + + + + + <%--10--%> + + + + + + <%--11--%> + + + + + + - - - + + + + + + + diff --git a/CRM/RepAcercamientos.aspx.cs b/CRM/RepAcercamientos.aspx.cs index d94cf2787..438ab2bbe 100644 --- a/CRM/RepAcercamientos.aspx.cs +++ b/CRM/RepAcercamientos.aspx.cs @@ -10,6 +10,7 @@ using Microsoft.Reporting.WebForms; using ADSNetLibrary.SIGAPI.Services.CRM; using ADSNetLibrary.SIGAPI.Models.CRM.Request; + //using ADSNetLibrary.SIGAPI.Helpers; public partial class CRM_RepAcercamientos : ClsPaginas @@ -47,6 +48,7 @@ public partial class CRM_RepAcercamientos : ClsPaginas { InicializaDatos(); CargaDatos(); + } } @@ -156,4 +158,37 @@ public partial class CRM_RepAcercamientos : ClsPaginas ImprimirPDF("Empresas/Grales/Formatos/RepAcercamientos.rdlc", DtDatos, @params, "Reporte de Acercamientos", formato); } + + protected void LnkPersonalizar_Click(object sender, EventArgs e) + { + PersonalizarColumnas(); + } + + + private void PersonalizarColumnas() + { + + GVDatos.Columns[0].Visible = ChkProceso.Checked; + GVDatos.Columns[1].Visible = ChkAcercamiento.Checked; + GVDatos.Columns[2].Visible = ChkEtapa.Checked; + GVDatos.Columns[3].Visible = ChkMedioCaptacion.Checked; + GVDatos.Columns[4].Visible = ChkVendedor.Checked; + GVDatos.Columns[5].Visible = ChkImporte.Checked; + GVDatos.Columns[6].Visible = ChkApertura.Checked; + GVDatos.Columns[7].Visible = ChkCierre.Checked; + GVDatos.Columns[8].Visible = ChkPS.Checked; + GVDatos.Columns[9].Visible = ChkEnPausa.Checked; + GVDatos.Columns[10].Visible = ChkGiro.Checked; + + + UPDatos.Update(); + + RegistraScript("$('#DivPersonalizar').modal('hide')"); + + + + + } + + } \ No newline at end of file diff --git a/Ventas/ClientesAbonar.aspx b/Ventas/ClientesAbonar.aspx index cb3cafa40..8b2b40ae8 100644 --- a/Ventas/ClientesAbonar.aspx +++ b/Ventas/ClientesAbonar.aspx @@ -18,6 +18,11 @@
  • Vincular Intermediario
  • + +
  • + Cargar Layout +
  • + @@ -636,6 +641,54 @@ + + diff --git a/Ventas/ClientesAbonar.aspx.vb b/Ventas/ClientesAbonar.aspx.vb index f1aa365e7..fa2856ef1 100644 --- a/Ventas/ClientesAbonar.aspx.vb +++ b/Ventas/ClientesAbonar.aspx.vb @@ -302,6 +302,11 @@ Partial Class Ventas_ClientesAbonar RVTxtFechaDocumento.MaximumValue = Now.ToString("dd/MM/yyyy") + If UsuarioActual.CveEmpresa.Contiene(13, 83) Then + LnkAccionesModalSeleccionLayout.Visible = True + + End If + End If If (CveMonedaFiltro = 2 And ChkPagarPesos.Checked) Then @@ -3133,4 +3138,208 @@ Partial Class Ventas_ClientesAbonar #End Region + + + + Protected Sub LnkAccionesModalSeleccionLayout_Click(sender As Object, e As EventArgs) + + + TxtModalLayoutExcel.Text = "[]" + UpModalSeleccionLayout.Update() + RegistraScript("$('#ModalSeleccionLayout').modal('show');") + + End Sub + + + Protected Sub LnkSeleccionLayout_Click(sender As Object, e As EventArgs) + + Dim ProcesoOK As Boolean = True + Dim CountRegistros As Integer = 0 + Dim TotalSeleccion As Decimal = 0D + + Dim SBNoEncotradosEnLista As New StringBuilder + Dim SBPagoMAyorASaldo As New StringBuilder + + If TxtModalLayoutExcel.getfiles().Archivos.Count > 0 Then + Dim file As Archivo = TxtModalLayoutExcel.getfiles().Archivos(0) + Dim Directorio As String = Server.MapPath("~") & file.path + Dim Tipo As String = If(file.Extension.Contiene("xlsx", "xlsx", "xlsm", "xlsb"), "EXCEL", "CSV") + + + + Dim DT As New DataTable + Dim ErrorArchivo = False + Dim ErrorExcel = False + + + + DT = ReadSeleccionExcelFile(Directorio + file.filename, True) + + If Not dt.Columns(0).ColumnName.ToUpper = "FOLIO" Then + Alert("El nombre de la primera columna debe ser 'Folio'. Favor de corregirlo", TipoMensaje.MsgAdvertencia) + Exit Sub + End If + + If Not dt.Columns(1).ColumnName.ToUpper = "IMPORTE PAGO" Then + Alert("El nombre de la segunda columna debe ser 'Importe Pago'.Favor de corregirlo", TipoMensaje.MsgAdvertencia) + Exit Sub + End If + + For Each Drow As DataRow In DT.Rows + + Dim SerieFolioBusqueda As String = Drow("Folio").ToString.Trim.ToUpper + Dim ImportePago As Decimal = Drow("Importe Pago").ToString.ToDecimal.RoundSQL(2) + Dim SerieFolioEncontrado As Boolean = False + + If ImportePago > 0 Then + + For Each GvRow As GridViewRow In GvCxC.Rows + + Dim SerieFolioGv As String = GvRow.DataKey("SerieFolio").Trim.ToUpper + + + If SerieFolioBusqueda = SerieFolioGv Then + SerieFolioEncontrado = True + Dim SaldoGV As Decimal = GvRow.DataKey("Saldo").ToDecimal + + Dim Diferencia As Decimal = SaldoGV - ImportePago + + If Diferencia < 0 Then + + If Math.Abs(Diferencia) > 0.01 Then + SBPagoMAyorASaldo.AppendLine($"Factura: {SerieFolioBusqueda} Importe de pago {ImportePago.ToString("###,###,###.00")} es mayor al saldo {SaldoGV.ToString("###,###,###.00")}
    ") + ProcesoOK = False + Exit For + Else + ImportePago = SaldoGV + End If + End If + + + + Dim ChkGv As CheckBox = GvRow.FCCheckBox("Chk") + Dim TxtAbonarGv As TextBox = GvRow.FCTextBox("TxtAbonar") + + ChkGv.Checked = True + TxtAbonarGv.Text = ImportePago.ToString("###,###,###.00") + + TotalSeleccion = TotalSeleccion + ImportePago + + + + CountRegistros = CountRegistros + 1 + + Exit For + End If + Next + + + If Not SerieFolioEncontrado Then + SBNoEncotradosEnLista.AppendLine($"{SerieFolioBusqueda}
    ") + End If + + + End If + Next + + Else + Alert("Se debe seleccionar un archivo", TipoMensaje.MsgError) + End If + + + + + If ProcesoOK Then + + Alert($"Facturas seleccionadas: {CountRegistros}
    {SBNoEncotradosEnLista.ToString}") + RegistraScript("$('#ModalSeleccionLayout').modal('hide');") + TxtImporte.Text = TotalSeleccion.ToString("###,###,###.00") + + UPVentas.Update() + UpDatos.Update() + Else + + If SBPagoMAyorASaldo.ToString.Length > 0 Then + Alert($"Facturas con pagos mayores a saldo:
    {SBPagoMAyorASaldo.ToString}", TipoMensaje.MsgAdvertencia) + End If + + End If + + + End Sub + + + Public Function ReadSeleccionExcelFile(ByVal flatFilePath As String, ByVal firstRowHasHeaders As Boolean, Optional curRow As Integer = 0) As DataTable + GemBox.Spreadsheet.SpreadsheetInfo.SetLicense(ModExtensiones.SerialGemBoxSpreadsheet) + Dim excelFile As GemBox.Spreadsheet.ExcelFile = GemBox.Spreadsheet.ExcelFile.Load(flatFilePath) + + Dim unnamed As Integer = 0 + Dim cols As Integer + Dim columns As String() + 'Dim curRow As Integer = 0 + Dim curCol As Integer = 0 + Dim dataTable As DataTable = New DataTable() + Dim worksheet As GemBox.Spreadsheet.ExcelWorksheet = excelFile.Worksheets(0) + + For cols = 0 To worksheet.Rows(0).AllocatedCells.Count - 1 + + If firstRowHasHeaders Then + + If worksheet.Rows(curRow).Cells(cols).Value IsNot Nothing Then + dataTable.Columns.Add(worksheet.Rows(curRow).Cells(cols).Value.ToString()) + Else + dataTable.Columns.Add("Unnamed Column " & (System.Threading.Interlocked.Increment(unnamed))) + End If + + + Else + dataTable.Columns.Add("Column " & (cols + 1)) + End If + Next + + curRow = 1 + + While curRow < worksheet.Rows.Count + columns = New String(cols - 1) {} + + For curCol = 0 To cols - 1 + + If worksheet.Rows(curRow).Cells(curCol).Value Is Nothing Then + columns(curCol) = "" + Else + columns(curCol) = worksheet.Rows(curRow).Cells(curCol).Value.ToString() + End If + Next + + dataTable.Rows.Add(columns) + curRow += 1 + End While + + Return dataTable + End Function + + + + Protected Sub LnkDescargaFormato_Click(sender As Object, e As EventArgs) + + Dim Directorio As String = "" + Directorio = ModExtensiones.DirectorioBaseEmpresas & "Empresas\Grales\LayoutSeleccion.xlsx" + + If Not (Directorio = "") Then + + Dim Archivo As New IO.FileInfo(Directorio) + If Archivo.Exists Then + Response.Clear() + Response.ClearHeaders() + Response.ClearContent() + Response.AddHeader("Content-Disposition", "attachment; filename=" + Archivo.Name) + Response.AddHeader("Content-Length", Archivo.Length.ToString()) + Response.ContentType = "text/plain" + Response.Flush() + Response.TransmitFile(Archivo.FullName) + Response.End() + End If + End If + + End Sub End Class diff --git a/Ventas/Promociones.aspx.vb b/Ventas/Promociones.aspx.vb index 1ed054fee..45514ef77 100644 --- a/Ventas/Promociones.aspx.vb +++ b/Ventas/Promociones.aspx.vb @@ -558,8 +558,11 @@ Partial Class Ventas_Promociones TieneError = True End If + If UsuarioActual.Empresa.Funcionalidad(563) <> "" Then - TieneError = ObjVentas.SincronizarPromocionesClonar(CvePromocion, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, 1) + If Not ObjVentas.SincronizarPromocionesClonar(CvePromocion, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, 1) Then + TieneError = True + End If End If