127 lines
4.1 KiB
C#
127 lines
4.1 KiB
C#
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 = UsuarioActual.Empresa.Ruta;
|
|
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($"{UsuarioActual.Empresa.Ruta}/Logo.png");
|
|
|
|
List<ReportParameter> @params = new List<ReportParameter>();
|
|
|
|
@params.Add(new ReportParameter("pImg", Imagen.Exists ? $"file://{Imagen.FullName}" : ""));
|
|
@params.Add(new ReportParameter("NombreEmpresa", UsuarioActual.Empresa.Empresa));
|
|
@params.Add(new ReportParameter("UsuarioImprimio", UsuarioActual.Nombre));
|
|
@params.Add(new ReportParameter("FechaImpresion", NowADS().ToShortDateString()));
|
|
@params.Add(new ReportParameter("LogoPath", Imagen.Exists ? $"file://{Imagen.FullName}" : ""));
|
|
|
|
ImprimirPDF(RutaPDF, DTDatos, @params, "Lista de Requisicion", Formato);
|
|
}
|
|
#endregion
|
|
} |