Commit inicial Ventas Productivo
This commit is contained in:
219
Compras/RepGastosSemanal.aspx.cs
Normal file
219
Compras/RepGastosSemanal.aspx.cs
Normal file
@@ -0,0 +1,219 @@
|
||||
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;
|
||||
|
||||
public partial class Compras_RepGastosSemanal : ClsPaginas
|
||||
{
|
||||
|
||||
#region PROPIEDADES
|
||||
|
||||
private DataTable DtPagos
|
||||
{
|
||||
get { return DtPagos = (DataTable)ViewState["DtPagos"]; }
|
||||
set { ViewState["DtPagos"] = value; }
|
||||
}
|
||||
private DataTable DtPrestamo
|
||||
{
|
||||
get { return DtPrestamo = (DataTable)ViewState["DtPrestamo"]; }
|
||||
set { ViewState["DtPrestamo"] = value; }
|
||||
}
|
||||
private DataTable DtTraspaso
|
||||
{
|
||||
get { return DtTraspaso = (DataTable)ViewState["DtTraspaso"]; }
|
||||
set { ViewState["DtTraspaso"] = value; }
|
||||
}
|
||||
private DataTable DtFondo
|
||||
{
|
||||
get { return DtFondo = (DataTable)ViewState["DtFondo"]; }
|
||||
set { ViewState["DtFondo"] = value; }
|
||||
}
|
||||
|
||||
#endregion
|
||||
protected void Page_Load(object sender, EventArgs e)
|
||||
{
|
||||
if (!IsPostBack)
|
||||
{
|
||||
InicializaValores();
|
||||
}
|
||||
}
|
||||
|
||||
#region CARGAS
|
||||
|
||||
private void InicializaValores()
|
||||
{
|
||||
txtFechaI.Text = DateTime.Now.FirstDayOfMonth().ToShortDateString();
|
||||
txtFechaF.Text = DateTime.Now.ToShortDateString();
|
||||
}
|
||||
|
||||
private void Consulta()
|
||||
{
|
||||
ClsCompras ObjComp = new ClsCompras();
|
||||
if (ObjComp.GetRepGastosSemanal(txtFechaI.Text.ToDate(), txtFechaF.Text.ToDate(), UsuarioActual.CveEmpresa))
|
||||
{
|
||||
GvDatos.DataSource = ObjComp.DtResultados;
|
||||
DtPagos = ObjComp.DtResultados;
|
||||
}
|
||||
if (ObjComp.GetRepGastosSemanalPrestamosDeudor(txtFechaI.Text.ToDate(), txtFechaF.Text.ToDate(), UsuarioActual.CveEmpresa))
|
||||
{
|
||||
GvDatosPrestamoDeudor.DataSource = ObjComp.DtResultados;
|
||||
DtPrestamo = ObjComp.DtResultados;
|
||||
}
|
||||
if (ObjComp.GetRepGastosSemanalTraspasosCuenta(txtFechaI.Text.ToDate(), txtFechaF.Text.ToDate(), UsuarioActual.CveEmpresa, Tipo: 1))
|
||||
{
|
||||
GvDatosTraspaso.DataSource = ObjComp.DtResultados;
|
||||
DtTraspaso = ObjComp.DtResultados;
|
||||
}
|
||||
if (ObjComp.GetRepGastosSemanalTraspasosCuenta(txtFechaI.Text.ToDate(), txtFechaF.Text.ToDate(), UsuarioActual.CveEmpresa, Tipo: 2))
|
||||
{
|
||||
GvFondoInversion.DataSource = ObjComp.DtResultados;
|
||||
DtFondo = ObjComp.DtResultados;
|
||||
}
|
||||
ObjComp.Dispose();
|
||||
GvDatos.DataBind();
|
||||
GvDatosPrestamoDeudor.DataBind();
|
||||
GvDatosTraspaso.DataBind();
|
||||
GvFondoInversion.DataBind();
|
||||
DivDatos.Visible = true;
|
||||
DivPrestamoTraspaso.Visible = true;
|
||||
UpDatos.Update();
|
||||
}
|
||||
|
||||
protected void BtnConsultar_Click(object sender, EventArgs e)
|
||||
{
|
||||
Consulta();
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region GRIDVIEW
|
||||
protected void GvDatos_RowDataBound(object sender, GridViewRowEventArgs e)
|
||||
{
|
||||
if (e.Row.RowType == DataControlRowType.DataRow)
|
||||
{
|
||||
if (e.Row.DBCampo("CveSubProyecto").ToEntero() < 1)
|
||||
{
|
||||
e.Row.Cells[0].Text = "Total";
|
||||
e.Row.CssClass = "Totales";
|
||||
e.Row.Cells[1].Text = "";
|
||||
}
|
||||
else if (e.Row.DBCampo("Fecha").ToString() == "")
|
||||
{
|
||||
e.Row.Cells[0].Text = e.Row.DBCampo("SubProyecto").ToString();
|
||||
e.Row.CssClass = "SubTotales2";
|
||||
e.Row.Cells[1].Text = "";
|
||||
}
|
||||
else if (e.Row.DBCampo("RazonSocial").ToString() == "")
|
||||
{
|
||||
e.Row.Cells[0].Text = e.Row.DBCampo("Fecha").ToString();
|
||||
e.Row.CssClass = "SubTotales";
|
||||
e.Row.Cells[1].Text = "";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
protected void GvDatosPrestamoDeudor_RowDataBound(object sender, GridViewRowEventArgs e)
|
||||
{
|
||||
if (e.Row.RowType == DataControlRowType.DataRow)
|
||||
{
|
||||
if (e.Row.DBCampo("Fecha").ToString() == "")
|
||||
{
|
||||
e.Row.Cells[0].Text = "Total";
|
||||
e.Row.CssClass = "Totales";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
protected void GvDatosTraspaso_RowDataBound(object sender, GridViewRowEventArgs e)
|
||||
{
|
||||
if (e.Row.RowType == DataControlRowType.DataRow)
|
||||
{
|
||||
if (e.Row.DBCampo("Fecha").ToString() == "")
|
||||
{
|
||||
e.Row.Cells[0].Text = "Total";
|
||||
e.Row.CssClass = "Totales";
|
||||
}
|
||||
else if (e.Row.DBCampo("CveCuenta").ToEntero() < 1)
|
||||
{
|
||||
e.Row.Cells[0].Text = e.Row.DBCampo("Fecha").ToString();
|
||||
e.Row.CssClass = "SubTotales";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
protected void GvFondoInversion_RowDataBound(object sender, GridViewRowEventArgs e)
|
||||
{
|
||||
if (e.Row.RowType == DataControlRowType.DataRow)
|
||||
{
|
||||
if (e.Row.DBCampo("Fecha").ToString() == "")
|
||||
{
|
||||
e.Row.Cells[0].Text = "Total";
|
||||
e.Row.CssClass = "Totales";
|
||||
}
|
||||
else if (e.Row.DBCampo("CveCuenta").ToEntero() < 1)
|
||||
{
|
||||
e.Row.Cells[0].Text = e.Row.DBCampo("Fecha").ToString();
|
||||
e.Row.CssClass = "SubTotales";
|
||||
}
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region PDF
|
||||
|
||||
protected void GenerarPDF(String Opcion)
|
||||
{
|
||||
|
||||
if (DtPagos.Rows.Count > 0 || DtPrestamo.Rows.Count > 0 || DtTraspaso.Rows.Count > 0 || DtFondo.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",$"Semana del {txtFechaI.Text} al {txtFechaF.Text}"));
|
||||
|
||||
if (Imagen.Exists)
|
||||
{
|
||||
para.Add(new ReportParameter("LogoPath", logouri));
|
||||
}
|
||||
else
|
||||
{
|
||||
para.Add(new ReportParameter("LogoPath", ""));
|
||||
}
|
||||
List<ReportDataSource> lrds = new List<ReportDataSource>();
|
||||
ReportDataSource rds = new ReportDataSource();
|
||||
rds.Name = "DataSet1"; rds.Value = DtPagos;
|
||||
ReportDataSource rds2 = new ReportDataSource();
|
||||
rds2.Name = "DataSet2"; rds2.Value = DtPrestamo;
|
||||
ReportDataSource rds3 = new ReportDataSource();
|
||||
rds3.Name = "DataSet3"; rds3.Value = DtTraspaso;
|
||||
ReportDataSource rds4 = new ReportDataSource();
|
||||
rds4.Name = "DataSet4"; rds4.Value = DtFondo;
|
||||
lrds.Add(rds);
|
||||
lrds.Add(rds2);
|
||||
lrds.Add(rds3);
|
||||
lrds.Add(rds4);
|
||||
|
||||
ImprimirPDF("Empresas/Grales/Formatos/RepGastosSemanal.rdlc", lrds, para, "Rep. Gastos Semanal", 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)
|
||||
Reference in New Issue
Block a user