Commit inicial Ventas Productivo

This commit is contained in:
JORGE LUIS CAUDILLO ESPARZA
2019-08-14 16:40:54 -07:00
commit c35cf91883
13328 changed files with 3711549 additions and 0 deletions

126
Ventas/RepPedidos2.aspx.cs Normal file
View File

@@ -0,0 +1,126 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI.WebControls;
using System.Data;
using static Extensiones.ModExtensiones;
using Microsoft.Reporting.WebForms;
public partial class Ventas_RepPedidos2 : ClsPaginas
{
#region PROPIEDADES
private DataTable DtDatos
{
get { return DtDatos = (DataTable)ViewState["DtDatos"]; }
set { ViewState["DtDatos"] = value; }
}
#endregion
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
InicializaValores();
}
}
private void InicializaValores()
{
DdlClientes.setEsWebService(true);
DdlClientes.Attributes.Add("data-metodo", "getcliente");
DdlClientes.SelectedText = "Todos";
DdlClientes.SelectedValue = "-1";
DdlSubProyectos.DataSource = get_GlobalDTSubProyectosUsuarios(UsuarioActual.CveUsuario, -1, UsuarioActual.CveEmpresa, -1, 1);
DdlSubProyectos.DataBind();
DdlVendedor.DataSource = get_GlobalDTVendedores(UsuarioActual.CveEmpresa);
DdlVendedor.DataBind();
if (UsuarioActual.CveVendedor > 0) { DdlVendedor.SelectedValuesIfExistM(UsuarioActual.CveVendedor.ToString()); }
txtFechaI.Text = DateTime.Now.AddMonths(-6).ToShortDateString();
txtFechaF.Text = DateTime.Now.AddMonths(6).ToShortDateString();
//TxtFechaVencimiento.Text = DateTime.Now.ToShortDateString();
}
protected void GenerarPDF(String Opcion)
{
String FechaF;
if (txtFechaF.Text == "" || txtFechaF.Text == "__/__/____") { FechaF = "-1"; } else { FechaF = $"&emsp;<b>Fecha Final:</b> {txtFechaF.Text}"; }
String FechaI;
if (txtFechaI.Text == "" || txtFechaI.Text == "__/__/____") { FechaI = "-1"; } else { FechaI = $"&emsp;<b>Fecha Inicial:</b> {txtFechaI.Text}"; }
String FechaV;
if (TxtFechaVencimiento.Text == "" || TxtFechaVencimiento.Text == "__/__/____") { FechaV = "-1"; } else { FechaV = $"&emsp;<b>Fecha Vencimiento:</b> {TxtFechaVencimiento.Text}"; }
String Cliente;
if (DdlClientes.SelectedValue != "-1") { Cliente = $"&emsp;<b>Cliente:</b> {DdlClientes.SelectedText}"; } else { Cliente = ""; }
String SubProyectos;
if (DdlSubProyectos.GetSelectedText() != "") { SubProyectos = $"&emsp;<b>SubProyecto:</b> {DdlSubProyectos.GetSelectedText()}"; } else { SubProyectos = ""; }
String Vendedores;
if (DdlVendedor.GetSelectedText() != "") { Vendedores = $"&emsp;<b>Vendedor:</b> {DdlVendedor.GetSelectedText()}"; } else { Vendedores = ""; }
if (DtDatos.Rows.Count > 0)
{
System.IO.FileInfo Imagen = new System.IO.FileInfo(String.Format("{0}/Logo.png", UsuarioActual.Empresa.Ruta));
String logouri = String.Format("{0}://{1}:{2}/Empresas/{3}/Logo.png", Request.Url.Scheme, Request.Url.Host, Request.Url.Port, UsuarioActual.CveEmpresa);
List<ReportParameter> para = new List<ReportParameter>();
para.Add(new ReportParameter("NombreEmpresa", UsuarioActual.Empresa.Empresa));
para.Add(new ReportParameter("UsuarioImprimio", UsuarioActual.Nombre));
para.Add(new ReportParameter("FechaImpresion", DateTime.Now.ToString()));
para.Add(new ReportParameter("Filtros", $"<b>Filtros:</b> {FechaI}{FechaF}{FechaV}{Cliente}{SubProyectos}{Vendedores}"));
if (Imagen.Exists)
{
para.Add(new ReportParameter("LogoPath", logouri));
}
else
{
para.Add(new ReportParameter("LogoPath", ""));
}
ImprimirPDF("Empresas/Grales/Formatos/RepPedidos2.rdlc", DtDatos, para, "Reporte de Pedidos2", Opcion);
}
else
{
Alert("No hay datos consultados", TipoMensaje.MsgAdvertencia);
}
}
protected void LnkPdf_Click(object sender, EventArgs e)
{
GenerarPDF("PDF");
}
protected void LnkExcel_Click(object sender, EventArgs e)
{
GenerarPDF("EXCEL");
}
protected void BtnConsultar_Click(object sender, EventArgs e)
{
string SubProyectos = "";
string Vendedores = "";
if (DdlSubProyectos.GetSelectedText() != "") { SubProyectos = DdlSubProyectos.GetSelectedValuesM(); } else { SubProyectos = "-1"; }
if (DdlVendedor.GetSelectedText() != "") { Vendedores = DdlVendedor.GetSelectedValuesM(); } else { Vendedores = "-1"; }
DateTime FechaV = MaxFecha;
if (TxtFechaVencimiento.Text != "")
{
FechaV = TxtFechaVencimiento.Text.ToDate();
}
ClsVentas ObjVentas = new ClsVentas();
if (ObjVentas.GetRepPedidos2SinFacturar(txtFechaI.Text.ToDate(),txtFechaF.Text.ToDate(), FechaV,
SubProyectos, DdlClientes.SelectedValue.ToEntero(), Vendedores, UsuarioActual.CveEmpresa, UsuarioActual.CveUsuario))
{
GvDatos.DataSource = ObjVentas.DtResultados;
DtDatos= ObjVentas.DtResultados;
}
ObjVentas.Dispose();
GvDatos.DataBind();
UpDatos.Update();
}
protected void GvDatos_RowDataBound(object sender, GridViewRowEventArgs e)
{
if (e.Row.RowType == DataControlRowType.DataRow)
{
if (e.Row.DBCampo("FechaVencimiento").ToDate() < DateTime.Now)
{
e.Row.Cells[2].ForeColor = System.Drawing.Color.Red;