Commit inicial Ventas Productivo
This commit is contained in:
136
OC/ListaRequisicion.aspx.cs
Normal file
136
OC/ListaRequisicion.aspx.cs
Normal file
@@ -0,0 +1,136 @@
|
||||
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 System.IO;
|
||||
using System.Text;
|
||||
|
||||
|
||||
public partial class OC_ListaRequisicion : ClsPaginas
|
||||
{
|
||||
#region "PROPIEDADES"
|
||||
private DataTable DTDatos
|
||||
{
|
||||
get
|
||||
{
|
||||
return (DataTable)ViewState["DTDatos"];
|
||||
}
|
||||
|
||||
set
|
||||
{
|
||||
ViewState["DTDatos"] = value;
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
protected void Page_Load(object sender, EventArgs e)
|
||||
{
|
||||
if (!IsPostBack)
|
||||
{
|
||||
CargaDatos();
|
||||
}
|
||||
}
|
||||
|
||||
#region "CARGA DATOS"
|
||||
protected void CargaDatos()
|
||||
{
|
||||
ClsProductosServicios ObjPS = new ClsProductosServicios();
|
||||
if (ObjPS.GetPSClasificados(UsuarioActual.CveEmpresa))
|
||||
{
|
||||
DTDatos = ObjPS.DtResultados;
|
||||
GVDatos.DataSource = DTDatos;
|
||||
GVDatos.DataBind();
|
||||
}
|
||||
ObjPS.Dispose();
|
||||
UPDatos.Update();
|
||||
}
|
||||
|
||||
protected void GVDatos_RowDataBound(object sender, GridViewRowEventArgs e)
|
||||
{
|
||||
if (e.Row.RowType == DataControlRowType.DataRow)
|
||||
{
|
||||
if ((e.Row.DataKey("CvePS1").ToString() == ""))
|
||||
{
|
||||
//e.Row.CssClass = "Totales";
|
||||
e.Row.Cells[0].BackColor = System.Drawing.ColorTranslator.FromHtml("#9cacc1");
|
||||
e.Row.Cells[1].BackColor = System.Drawing.ColorTranslator.FromHtml("#9cacc1");
|
||||
e.Row.FCTextBox("TxtCantidad1").Visible = false;
|
||||
}
|
||||
if ((e.Row.DataKey("CvePS2").ToString() == ""))
|
||||
{
|
||||
//e.Row.CssClass = "Totales";
|
||||
e.Row.Cells[3].BackColor = System.Drawing.ColorTranslator.FromHtml("#9cacc1");
|
||||
e.Row.Cells[4].BackColor = System.Drawing.ColorTranslator.FromHtml("#9cacc1");
|
||||
e.Row.FCTextBox("TxtCantidad2").Visible = false;
|
||||
}
|
||||
if ((e.Row.DataKey("CvePS3").ToString() == ""))
|
||||
{
|
||||
//e.Row.CssClass = "Totales";
|
||||
|
||||
if ((e.Row.DataKey("CveClasificacion3").ToEntero() > 0))
|
||||
{
|
||||
e.Row.Cells[6].BackColor = System.Drawing.ColorTranslator.FromHtml("#9cacc1");
|
||||
e.Row.Cells[7].BackColor = System.Drawing.ColorTranslator.FromHtml("#9cacc1");
|
||||
e.Row.FCTextBox("TxtCantidad3").Visible = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
e.Row.FCTextBox("TxtCantidad3").Visible = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region "IMPRESION"
|
||||
|
||||
protected void LnkImprimirPDF_Click(object sender, EventArgs e)
|
||||
{
|
||||
ImprimiReporte();
|
||||
}
|
||||
|
||||
protected void LnkImprimirExcel_Click(object sender, EventArgs e)
|
||||
{
|
||||
ImprimiReporte("Excel");
|
||||
}
|
||||
|
||||
protected void ImprimiReporte(string Formato = "PDF")
|
||||
{
|
||||
string Ruta = string.Format("{0}Empresas/{1}/", AppDomain.CurrentDomain.BaseDirectory, UsuarioActual.CveEmpresa);
|
||||
string RutaPDF = string.Format("{0}/Formatos/ListaRequisicion.rdlc", Ruta);
|
||||
|
||||
if (!File.Exists(RutaPDF))
|
||||
{
|
||||
RutaPDF = "Empresas/Grales/Formatos/ListaRequisicion.rdlc";
|
||||
}
|
||||
|
||||
var logouri = string.Format("{0}://{1}:{2}/Empresas/{3}/Logo.png", Request.Url.Scheme, Request.Url.Host, Request.Url.Port, UsuarioActual.CveEmpresa);
|
||||
System.IO.FileInfo Imagen = new System.IO.FileInfo(string.Format("{0}/Logo.png", UsuarioActual.Empresa.Ruta));
|
||||
|
||||
List<ReportParameter> @params = new List<ReportParameter>();
|
||||
|
||||
@params.Add(new ReportParameter("pImg", new Uri(Server.MapPath(string.Format("~/Empresas/{0}/Logo.png", UsuarioActual.CveEmpresa))).AbsoluteUri));
|
||||
@params.Add(new ReportParameter("NombreEmpresa", UsuarioActual.Empresa.Empresa));
|
||||
|
||||
@params.Add(new ReportParameter("UsuarioImprimio", UsuarioActual.Nombre));
|
||||
@params.Add(new ReportParameter("FechaImpresion", DateTime.Now.ToShortDateString()));
|
||||
|
||||
if (Imagen.Exists)
|
||||
{
|
||||
@params.Add(new ReportParameter("LogoPath", logouri));
|
||||
}
|
||||
else
|
||||
{
|
||||
@params.Add(new ReportParameter("LogoPath", ""));
|
||||
}
|
||||
|
||||
ImprimirPDF(RutaPDF, DTDatos, @params, "Lista de Requisicion", Formato);
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
Reference in New Issue
Block a user