Crm terminado

This commit is contained in:
Antonio Gonzalez
2021-01-22 20:53:26 -07:00
parent e1d793ac73
commit 17b0f4824f
4 changed files with 225 additions and 15 deletions

View File

@@ -7475,11 +7475,11 @@ Public Class ClsPaginas
' nombreautorizo = "Lic. LUIS JORGE CONTRERAS LANDGRAVE" ' nombreautorizo = "Lic. LUIS JORGE CONTRERAS LANDGRAVE"
'End If 'End If
Dim Archivo As New System.IO.FileInfo(String.Format("{0}Formatos\OC.rdlc", EmpresaActual.Ruta)) Dim Archivo As New System.IO.FileInfo(String.Format("{0}Formatos\OC.rdlc", EmpresaActual.Ruta))
If Not Archivo.Exists OrElse EmpresaActual.CveEmpresa.Contiene(4, 145, 7, 11, 12, 13, 72, 80, 83, 122, 126) Then If Not Archivo.Exists OrElse EmpresaActual.CveEmpresa.Contiene(4, 145, 7, 11, 12, 13, 72, 80, 83, 122, 126, 158) Then
params.Add(New ReportParameter("Descuento", DtDetalle.SUM("Descuento").ToString.FormatoNumero(2))) params.Add(New ReportParameter("Descuento", DtDetalle.SUM("Descuento").ToString.FormatoNumero(2)))
End If End If
'DATOS PARA DESCUENTO 'DATOS PARA DESCUENTO
If EmpresaActual.CveEmpresa.Contiene(4, 145, 7, 11, 12, 13, 72, 80, 83, 119, 122, 126) Then 'EMPRESAS QUE YA TIENEN EL AJUSTE EN EL FORMATO If EmpresaActual.CveEmpresa.Contiene(4, 145, 7, 11, 12, 13, 72, 80, 83, 119, 122, 126, 158) Then 'EMPRESAS QUE YA TIENEN EL AJUSTE EN EL FORMATO
params.Add(New ReportParameter("SubTotal", ObjOC.SubTotal.ToString)) params.Add(New ReportParameter("SubTotal", ObjOC.SubTotal.ToString))
params.Add(New ReportParameter("SubTotal2", DtDetalle.SUM("Total").ToString)) params.Add(New ReportParameter("SubTotal2", DtDetalle.SUM("Total").ToString))
Else Else

View File

@@ -13,11 +13,14 @@
<li> <li>
<asp:HyperLink ID="LnkAgregar" NavigateUrl="/CRM/EmpresaCRM.aspx" runat="server" Target="_blank"><i class="fa fa-plus"></i><span style="padding-left:5px;">Agregar</span></asp:HyperLink> <asp:HyperLink ID="LnkAgregar" NavigateUrl="/CRM/EmpresaCRM.aspx" runat="server" Target="_blank"><i class="fa fa-plus"></i><span style="padding-left:5px;">Agregar</span></asp:HyperLink>
</li> </li>
<li>
<asp:LinkButton ID="LnkCargaProspectos" runat="server" OnClick="LnkCargaProspectos_Click"><i class="fa fa-plus"></i><span style="padding-left:5px;">Cargar Prospectos</span></asp:LinkButton>
</li>
</asp:Content> </asp:Content>
<asp:Content ID="Content6" ContentPlaceHolderID="HA" runat="Server"> <asp:Content ID="Content6" ContentPlaceHolderID="HA" runat="Server">
</asp:Content> </asp:Content>
<asp:Content ID="Content7" ContentPlaceHolderID="C" runat="Server"> <asp:Content ID="Content7" ContentPlaceHolderID="C" runat="Server">
<asp:UpdatePanel ID="UPFiltros" runat="server" UpdateMode="Conditional"> <asp:UpdatePanel ID="UPFiltros" runat="server" UpdateMode="Conditional">
<ContentTemplate> <ContentTemplate>
<div id="PFiltros" class="portlet solid grey-cascade portlet-filter"> <div id="PFiltros" class="portlet solid grey-cascade portlet-filter">
<div class="portlet-title portlet-filterT smalltitle"> <div class="portlet-title portlet-filterT smalltitle">
@@ -47,9 +50,9 @@
</ContentTemplate> </ContentTemplate>
</asp:UpdatePanel> </asp:UpdatePanel>
<asp:UpdatePanel ID="UPDatos" runat="server" UpdateMode="Conditional"> <asp:UpdatePanel ID="UPDatos" runat="server" UpdateMode="Conditional">
<ContentTemplate> <ContentTemplate>
<div class="row" style="margin-right: 10px; margin-top: 18px;margin-bottom: 5px;" align="right"> <div class="row" style="margin-right: 10px; margin-top: 18px; margin-bottom: 5px;" align="right">
<input type="text" id="TxtBusqueda" class="form-control input-sm" onkeyup="<%= String.Format("FiltrarTabla('TxtBusqueda','{0}')", GVDatos.ClientID) %>" style="display: inline-block; margin-right: -20px; width: 150px;" /> <input type="text" id="TxtBusqueda" class="form-control input-sm" onkeyup="<%= String.Format("FiltrarTabla('TxtBusqueda','{0}')", GVDatos.ClientID) %>" style="display: inline-block; margin-right: -20px; width: 150px;" />
<a href="javascript:;" onclick="<%= String.Format("FiltrarTabla('TxtBusqueda','{0}')", GVDatos.ClientID) %>" style="margin-top: -3px;" class="btn btn-circle btn-sm label-info"><i class="icon-magnifier"></i></a> <a href="javascript:;" onclick="<%= String.Format("FiltrarTabla('TxtBusqueda','{0}')", GVDatos.ClientID) %>" style="margin-top: -3px;" class="btn btn-circle btn-sm label-info"><i class="icon-magnifier"></i></a>
</div> </div>
@@ -59,7 +62,7 @@
<Columns> <Columns>
<asp:TemplateField HeaderText="Empresa" ItemStyle-Width="25%" ItemStyle-HorizontalAlign="Left"> <asp:TemplateField HeaderText="Empresa" ItemStyle-Width="25%" ItemStyle-HorizontalAlign="Left">
<ItemTemplate> <ItemTemplate>
<asp:HyperLink ID="HplEmpresa" Target="_blank" runat="server" Text='<%# Eval("Empresa")%>' data-toggle="tooltip" title="Ir a Detalle"> </asp:HyperLink> <asp:HyperLink ID="HplEmpresa" Target="_blank" runat="server" Text='<%# Eval("Empresa")%>' data-toggle="tooltip" title="Ir a Detalle"> </asp:HyperLink>
</ItemTemplate> </ItemTemplate>
</asp:TemplateField> </asp:TemplateField>
<asp:TemplateField HeaderText="RFC" ItemStyle-Width="10%" ItemStyle-HorizontalAlign="Left"> <asp:TemplateField HeaderText="RFC" ItemStyle-Width="10%" ItemStyle-HorizontalAlign="Left">
@@ -72,17 +75,17 @@
<asp:Label ID="lblVendedor" runat="server" Text='<%# Eval("Vendedor")%>'> </asp:Label> <asp:Label ID="lblVendedor" runat="server" Text='<%# Eval("Vendedor")%>'> </asp:Label>
</ItemTemplate> </ItemTemplate>
</asp:TemplateField> </asp:TemplateField>
<asp:TemplateField HeaderText="Medio de Captacion" ItemStyle-Width="15%" ItemStyle-HorizontalAlign="Left"> <asp:TemplateField HeaderText="Medio de Captacion" ItemStyle-Width="15%" ItemStyle-HorizontalAlign="Left">
<ItemTemplate> <ItemTemplate>
<asp:Label ID="lblMedioCaptacion" runat="server" Text='<%# Eval("MedioCaptacion")%>'> </asp:Label> <asp:Label ID="lblMedioCaptacion" runat="server" Text='<%# Eval("MedioCaptacion")%>'> </asp:Label>
</ItemTemplate> </ItemTemplate>
</asp:TemplateField> </asp:TemplateField>
<asp:TemplateField HeaderText="Contactos" ItemStyle-Width="5%" ItemStyle-Font-Bold="true" ItemStyle-HorizontalAlign="Right"> <asp:TemplateField HeaderText="Contactos" ItemStyle-Width="5%" ItemStyle-Font-Bold="true" ItemStyle-HorizontalAlign="Right">
<ItemTemplate> <ItemTemplate>
<asp:Label ID="lblNoContactos" runat="server" Text='<%# Eval("NoContactos")%>'> </asp:Label> <asp:Label ID="lblNoContactos" runat="server" Text='<%# Eval("NoContactos")%>'> </asp:Label>
</ItemTemplate> </ItemTemplate>
</asp:TemplateField> </asp:TemplateField>
<asp:TemplateField HeaderText="Acercamientos" ItemStyle-Width="5%" ItemStyle-Font-Bold="true" ItemStyle-HorizontalAlign="Right"> <asp:TemplateField HeaderText="Acercamientos" ItemStyle-Width="5%" ItemStyle-Font-Bold="true" ItemStyle-HorizontalAlign="Right">
<ItemTemplate> <ItemTemplate>
<asp:Label ID="lblNoAcercamientos" runat="server" Text='<%# Eval("NoAcercamientos")%>'> </asp:Label> <asp:Label ID="lblNoAcercamientos" runat="server" Text='<%# Eval("NoAcercamientos")%>'> </asp:Label>
</ItemTemplate> </ItemTemplate>
@@ -95,14 +98,49 @@
</asp:TemplateField> </asp:TemplateField>
<asp:TemplateField ItemStyle-HorizontalAlign="Center" Visible="false" ItemStyle-Width="10%" HeaderText="Comandos"> <asp:TemplateField ItemStyle-HorizontalAlign="Center" Visible="false" ItemStyle-Width="10%" HeaderText="Comandos">
<ItemTemplate> <ItemTemplate>
<asp:HyperLink ID="HplEditar" Target="_blank" runat="server" data-toggle="tooltip" CssClass="btn btn-circle btn-sm green" title="Editar" Text="<i class='fa fa-pencil'></i>"></asp:HyperLink> <asp:HyperLink ID="HplEditar" Target="_blank" runat="server" data-toggle="tooltip" CssClass="btn btn-circle btn-sm green" title="Editar" Text="<i class='fa fa-pencil'></i>"></asp:HyperLink>
<asp:LinkButton ID="LnkEliminar" runat="server" CommandName="Delete" AlternateText="Eliminar" data-toggle="confirmation" CssClass="btn btn-circle btn-sm red" Text="<i class='icon-trash'></i>" data-popout="true" data-original-title="¿Eliminar la Empresa tambien eliminara los Contacto de esta, seguro que desea continuar?" data-btn-ok-label="Sí" /> <asp:LinkButton ID="LnkEliminar" runat="server" CommandName="Delete" AlternateText="Eliminar" data-toggle="confirmation" CssClass="btn btn-circle btn-sm red" Text="<i class='icon-trash'></i>" data-popout="true" data-original-title="¿Eliminar la Empresa tambien eliminara los Contacto de esta, seguro que desea continuar?" data-btn-ok-label="Sí" />
</ItemTemplate> </ItemTemplate>
</asp:TemplateField> </asp:TemplateField>
</Columns> </Columns>
</asp:GridView> </asp:GridView>
</ContentTemplate> </ContentTemplate>
</asp:UpdatePanel> </asp:UpdatePanel>
<div id="DivCargasMasivas" class="modal ADS fade" role="dialog">
<div class="modal-dialog" style="width: 450px;">
<asp:UpdatePanel runat="server" class="modal-content" ID="UpCargasMasivas" UpdateMode="Conditional">
<ContentTemplate>
<div class="modal-header ">
<button type="button" class="close" data-dismiss="modal">×</button>
<h4 class="modal-title">
<asp:Literal ID="LtlTituloModalTiposD" runat="server">Cargar Prospectos</asp:Literal></h4>
</div>
<div class="modal-body">
<div class="row">
<div class="col-md-2" style="margin-left: 30px;text-align: left">
<asp:Button ID="BtnDescargar" runat="server" OnClick="BtnDescargar_Click" CssClass="btn btn-warning" Text="Descargar Formato" />
</div>
</div>
<br />
<div class="row">
<div class="col-md-11" style="margin-left: 30px; margin-right: 30px; margin-bottom: 50px;">
<asp:TextBox ID="TxtExcel" CssClass="ADSdropzone hidden" Text="" data-maxFile="1" runat="server"></asp:TextBox>
</div>
</div>
<div class="modal-footer">
<asp:Button ID="BtnAgregarProspectos" OnClick="BtnAgregarProspectos_Click" runat="server" class="btn btn-success" Text="Agregar" ValidationGroup="GrpTiposD" />
<button id="Button3" runat="server" type="button" class="btn default" data-dismiss="modal">Cancelar</button>
</div>
</ContentTemplate>
<Triggers>
<asp:PostBackTrigger ControlID="BtnDescargar"/>
</Triggers>
</asp:UpdatePanel>
</div>
</div>
</asp:Content> </asp:Content>
<asp:Content ID="Content8" ContentPlaceHolderID="JS" runat="Server"> <asp:Content ID="Content8" ContentPlaceHolderID="JS" runat="Server">
</asp:Content> </asp:Content>

View File

@@ -1,11 +1,12 @@
using System; using System;
using System.IO;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
using System.Web; using System.Web;
using System.Web.UI; using System.Web.UI;
using System.Web.UI.WebControls; using System.Web.UI.WebControls;
using System.Data; using System.Data;
using GemBox.Spreadsheet;
using Extensiones; using Extensiones;
public partial class CRM_CatEmpresasCRM : ClsPaginas public partial class CRM_CatEmpresasCRM : ClsPaginas
@@ -124,4 +125,172 @@ public partial class CRM_CatEmpresasCRM : ClsPaginas
CargaMediosCaptacion(); CargaMediosCaptacion();
UPFiltros.Update(); UPFiltros.Update();
} }
protected void LnkCargaProspectos_Click(object sender, EventArgs e)
{
RegistraScript(String.Format("$('#{0}').modal();", "DivCargasMasivas"));
}
protected void BtnDescargar_Click(object sender, EventArgs e)
{
string Directorio = ModExtensiones.DirectorioBaseEmpresas + "Empresas\\Grales\\Formatos\\FormatoDeProspectos.xlsx";
FileInfo Archivo = new FileInfo(Directorio);
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();
}
protected void BtnAgregarProspectos_Click(object sender, EventArgs e)
{
if( TxtExcel.getfiles().Archivos.Count > 0 )
{
Archivo file = TxtExcel.getfiles().Archivos[0];
string Directorio = Server.MapPath("~") + file.patch;
DataTable dt = ReadExcelFile(Directorio + file.filename, true);
DataRowCollection Rows = dt.Rows;
ClsCRM ObjCRM = new ClsCRM();
ObjCRM.IniciaTransacSQL();
bool TieneError = false;
foreach (DataRow row in Rows)
{
string Proceso = row["Proceso"].ToString();
string NombreEmpresa = row["Nombre de la empresa"].ToString();
string RFC = row["RFC"].ToString();
string Mail = row["Mail"].ToString();
string MedioCaptacion = row["Medio de Captación"].ToString();
string Agente = row["Agente"].ToString();
string Sucursal = row["Sucursal"].ToString();
string Giro = row["Giro"].ToString();
string ContactoPrincipal = row["Contacto Principal"].ToString();
string TelOficina = row["Teléfono de Oficina"].ToString();
string Celular = row["Celular"].ToString();
string Correo = row["Correo"].ToString();
int CveMedioCaptacion = -1;
if (ObjCRM.GetMedioCaptacion(UsuarioActual.CveEmpresa))
{
DataRow MediosCaptacion = ObjCRM.DtResultados.FiltroPrimero(String.Format("MedioCaptacion = '{0}'",MedioCaptacion));
if(MediosCaptacion != null)
{
CveMedioCaptacion = MediosCaptacion["CveMedioCaptacion"].ToString().ToEntero();
}else
{
Alert(String.Format("El medio de captación '{0}' no fue encontrado", MedioCaptacion), ModExtensiones.TipoMensaje.MsgAdvertencia);
TieneError = true;
break;
}
}
int CveVendedor = -1;
DataRow Vendedor = get_GlobalDTVendedores(UsuarioActual.CveEmpresa).FiltroPrimero(String.Format("Vendedor = '{0}'",Agente));
if (Vendedor != null)
{
CveVendedor = Vendedor["CveVendedor"].ToString().ToEntero();
}else
{
Alert(String.Format("El vendedor '{0}' no fue encontrado", MedioCaptacion), ModExtensiones.TipoMensaje.MsgAdvertencia);
TieneError = true;
break;
}
int CveSubProyecto = -1;
DataRow SubProyecto = get_GlobalDTSubProyectos(-1,CveEmpresa:UsuarioActual.CveEmpresa).FiltroPrimero(String.Format("SubProyecto = '{0}'",Sucursal));
if(SubProyecto != null)
{
CveSubProyecto = SubProyecto["CveSubProyecto"].ToString().ToEntero();
}else
{
Alert(String.Format("El SubProyecto '{0}'", Sucursal), ModExtensiones.TipoMensaje.MsgAdvertencia);
TieneError = true;
break;
}
int CveGiro = -1;
DataRow GiroDt = get_GlobalDTClienteClasificaciones(UsuarioActual.CveEmpresa).FiltroPrimero(String.Format("ClienteClasificacion = '{0}'", Giro));
if (GiroDt != null)
{
CveGiro = GiroDt["CveClienteClasificacion"].ToString().ToEntero();
}
else
{
Alert(String.Format("El Giro de Empresa '{0}'", Giro), ModExtensiones.TipoMensaje.MsgAdvertencia);
TieneError = true;
break;
}
TieneError = (!(ObjCRM.AddEmpresaCRM(NombreEmpresa, RFC, CveMedioCaptacion, UsuarioActual.CveEmpresa, UsuarioActual.CveUsuario, -1, CveVendedor, CveSubProyecto, Mail, CveGiro) > 0));
}
if (TieneError)
{
ObjCRM.RollBack();
}else
{
ObjCRM.Commit();
Alert("Prospectos agregados correctamente");
TxtExcel.Text = "";
RegistraScript(String.Format("$('#{0}').modal('hide');", "DivCargasMasivas"));
}
ObjCRM.Dispose();
}
}
private DataTable ReadExcelFile(string flatFilePath, bool firstRowHasHeaders)
{
SpreadsheetInfo.SetLicense(ModExtensiones.SerialGemBoxSpreadsheet());
ExcelFile excelFile = ExcelFile.Load(flatFilePath);
int unnamed = 0;
int cols;
string[] columns;
int curRow = 0;
int curCol = 0;
DataTable dataTable = new DataTable();
ExcelWorksheet worksheet = excelFile.Worksheets[0];
for (cols = 0; cols <= worksheet.Rows[0].AllocatedCells.Count - 1; cols++)
{
if (firstRowHasHeaders)
{
if (worksheet.Rows[0].Cells[cols].Value != null)
dataTable.Columns.Add(worksheet.Rows[0].Cells[cols].Value.ToString().Trim());
else
dataTable.Columns.Add("Unnamed Column " + (System.Threading.Interlocked.Increment(ref unnamed)));
curRow = 1;
}
else
dataTable.Columns.Add("Column " + (cols + 1));
}
while (curRow < worksheet.Rows.Count)
{
columns = new string[cols - 1 + 1];
for (curCol = 0; curCol <= cols - 1; curCol++)
{
if (worksheet.Rows[curRow].Cells[curCol].Value == null)
columns[curCol] = "";
else
columns[curCol] = worksheet.Rows[curRow].Cells[curCol].Value.ToString();
}
dataTable.Rows.Add(columns);
curRow += 1;
}
return dataTable;
}
} }

View File

@@ -252,6 +252,8 @@ public partial class CRM_EmpresaCRM : ClsPaginas
VerificaPermisos(); VerificaPermisos();
CargaClasificaciones(); CargaClasificaciones();
DdlPS.setEsWebService(true); DdlPS.setEsWebService(true);
DdlPS.SelectedText = "Seleccione";
DdlPS.SelectedValue = "-1";
} }
} }
@@ -1516,6 +1518,7 @@ public partial class CRM_EmpresaCRM : ClsPaginas
if ((UsuarioActual.CveVendedor != CveVendedor)) if ((UsuarioActual.CveVendedor != CveVendedor))
{ {
BtnGuardarEmpresa.Visible = false; BtnGuardarEmpresa.Visible = false;
BtnEliminarEmpresa.Visible = false;
BtnAgregarContacto.Visible = false; BtnAgregarContacto.Visible = false;
//LnkAgregarAcercamiento.Visible = false; //LnkAgregarAcercamiento.Visible = false;
DivAccionesBitacora.Visible = false; DivAccionesBitacora.Visible = false;