158 lines
5.6 KiB
C#
158 lines
5.6 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Web;
|
|
using System.Web.UI.WebControls;
|
|
using Extensiones;
|
|
using System.Data;
|
|
using static Extensiones.ModExtensiones;
|
|
using Microsoft.Reporting.WebForms;
|
|
using System.Activities.Expressions;
|
|
|
|
public partial class CGame_RepOrdenProduccion :ClsPaginas
|
|
{
|
|
|
|
#region PROPIEDADES
|
|
private DataTable DtDatos
|
|
{
|
|
get { return DtDatos = (DataTable)ViewState["DtDatos"]; }
|
|
set { ViewState["DtDatos"] = value; }
|
|
}
|
|
|
|
private int Opcion
|
|
{
|
|
get { return (ViewState["Opcion"] == null) ? 0 : Convert.ToInt32(ViewState["Opcion"]); }
|
|
set { ViewState["Opcion"] = value; }
|
|
}
|
|
|
|
#endregion
|
|
|
|
protected void Page_Load(object sender, EventArgs e)
|
|
{
|
|
if (!IsPostBack)
|
|
{
|
|
CargaCliente();
|
|
CargaEstatus();
|
|
Opcion = Request["Opcion"] == null ? 0 : Request["Opcion"].ToString().ToEntero();
|
|
if (Opcion > 0)
|
|
{
|
|
txtFechaI.Text = MinFecha.ToShortDateString();
|
|
txtFechaF.Text = MaxFecha.ToShortDateString();
|
|
Consulta();
|
|
}
|
|
else
|
|
{
|
|
txtFechaI.Text = DateTime.Now.ToString();
|
|
txtFechaF.Text = DateTime.Now.ToString();
|
|
}
|
|
|
|
}
|
|
}
|
|
|
|
protected void CargaCliente()
|
|
{
|
|
ClsCGame ObjCGame = new ClsCGame();
|
|
if (ObjCGame.GetCliente(-1,-1,UsuarioActual.CveEmpresa))
|
|
{
|
|
DdlCliente.DataSource = ObjCGame.DtResultados;
|
|
DdlCliente.Items.Insert(0, new ListItem("Todos", "-1"));
|
|
DdlCliente.DataBind();
|
|
}
|
|
ObjCGame.Dispose();
|
|
UPFiltros.Update();
|
|
}
|
|
|
|
protected void CargaEstatus()
|
|
{
|
|
ClsCGame ObjCGame = new ClsCGame();
|
|
if (ObjCGame.GetEstatus(UsuarioActual.CveEmpresa))
|
|
{
|
|
DdlEstatus.DataSource = ObjCGame.DtResultados;
|
|
DdlEstatus.Items.Insert(0, new ListItem("Todos", "-1"));
|
|
DdlEstatus.DataBind();
|
|
}
|
|
ObjCGame.Dispose();
|
|
UPFiltros.Update();
|
|
}
|
|
|
|
protected void Consultar_Click(object sender, EventArgs e)
|
|
{
|
|
Consulta();
|
|
}
|
|
|
|
private void Consulta()
|
|
{
|
|
String Folio;
|
|
if (TxtFolio.Text != "") { Folio = TxtFolio.Text; } else { Folio = "-1"; }
|
|
ClsCGame ObjCGame = new ClsCGame();
|
|
if (ObjCGame.GetOrdenProduccion(-1, UsuarioActual.CveEmpresa, DdlEstatus.SelectedValue.ToEntero(), Folio, txtFechaI.Text.ToDate(), txtFechaF.Text.ToDate(), DdlCliente.SelectedValue.ToEntero()))
|
|
{
|
|
GvOP.DataSource = ObjCGame.DtResultados;
|
|
GvOP.DataBind();
|
|
DtDatos = ObjCGame.DtResultados;
|
|
if (ObjCGame.DtResultados.Rows.Count < 1)
|
|
{
|
|
Alert("No se encontraron resultados con los filtros seleccionados", TipoMensaje.MsgAdvertencia);
|
|
}
|
|
}
|
|
ObjCGame.Dispose();
|
|
UPDatos.Update();
|
|
}
|
|
|
|
protected void GvOP_RowDataBound(object sender, GridViewRowEventArgs e)
|
|
{
|
|
if (e.Row.RowType == DataControlRowType.DataRow)
|
|
{
|
|
String Css = "Texto";
|
|
String Liga = $"/CGame/OrdenProduccion.aspx?&CveOrdenProduccion={e.Row.DataKey("CveOrdenProduccion")}";
|
|
e.Row.FCLabel("LblFolio").Text = "<a class="+"" + Css + ""+" href="+"" + Liga + ""+">" + e.Row.FCLabel("LblFolio").Text + "</a>";
|
|
}
|
|
}
|
|
|
|
protected void GenerarPDF(String Opcion)
|
|
{
|
|
String FechaF;
|
|
if (txtFechaF.Text==""||txtFechaF.Text== "__/__/____") { FechaF = "-1"; } else { FechaF = $" <b>Fecha Entrega Final:</b> {txtFechaF.Text}"; }
|
|
String FechaI;
|
|
if (txtFechaI.Text == "" || txtFechaI.Text == "__/__/____") { FechaI = "-1"; } else { FechaI = $" <b>Fecha Entrega Inicial:</b> {txtFechaI.Text}"; }
|
|
String Cliente;
|
|
if (DdlCliente.SelectedValue != "-1") { Cliente = $" <b>Cliente:</b> {DdlCliente.SelectedItem.Text}"; } else { Cliente=""; }
|
|
String Estatus;
|
|
if (DdlEstatus.SelectedValue != "-1") { Estatus = $" <b>Estatus:</b> {DdlEstatus.SelectedItem.Text}"; } else { Estatus = ""; }
|
|
String Folio;
|
|
if (TxtFolio.Text != "") { Folio = $" <b>Folio:</b> {TxtFolio.Text}"; } else { Folio = ""; }
|
|
if (DtDatos.Rows.Count > 0)
|
|
{
|
|
System.IO.FileInfo Imagen = new System.IO.FileInfo($"{UsuarioActual.Empresa.Ruta}/Logo.png");
|
|
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("AgrupadoPor", $"<b>Agrupado Por:</b> {Folio}{Estatus}{Cliente}{FechaI}{FechaF}"));
|
|
if (Imagen.Exists)
|
|
{
|
|
para.Add(new ReportParameter("LogoPath", logouri));
|
|
}else
|
|
{
|
|
para.Add(new ReportParameter("LogoPath", ""));
|
|
}
|
|
ImprimirPDF("Empresas/Grales/Formatos/RepOP.rdlc", DtDatos, para, "Reporte de Orden de Produccion",Opcion);
|
|
}
|
|
else
|
|
{
|
|
Alert("No hay datos consultados", TipoMensaje.MsgAdvertencia);
|
|
}
|
|
}
|
|
|
|
|
|
protected void LnkPdf_Click(object sender, EventArgs e)
|
|
{
|
|
GenerarPDF("PDF");
|
|
}
|
|
|
|
protected void ImgExcel_Click(object sender, EventArgs e)
|
|
{
|
|
GenerarPDF("EXCEL");
|
|
}
|
|
} |