Commit inicial Ventas Productivo
This commit is contained in:
445
CGame/Liquidacion.aspx.cs
Normal file
445
CGame/Liquidacion.aspx.cs
Normal file
@@ -0,0 +1,445 @@
|
||||
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 CGame_Liquidacion : ClsPaginas
|
||||
{
|
||||
#region PROPIEDADES
|
||||
|
||||
private DataTable DtIngresos
|
||||
{
|
||||
get { return DtIngresos = (DataTable)ViewState["DtIngresos"]; }
|
||||
set { ViewState["DtIngresos"] = value; }
|
||||
}
|
||||
|
||||
private DataTable DtEmpaque
|
||||
{
|
||||
get { return DtEmpaque = (DataTable)ViewState["DtEmpaque"]; }
|
||||
set { ViewState["DtEmpaque"] = value; }
|
||||
}
|
||||
|
||||
private DataTable DtGastosTotales
|
||||
{
|
||||
get { return DtGastosTotales = (DataTable)ViewState["DtGastosTotales"]; }
|
||||
set { ViewState["DtGastosTotales"] = value; }
|
||||
}
|
||||
|
||||
private DataTable DtPreEnfriado
|
||||
{
|
||||
get { return DtPreEnfriado = (DataTable)ViewState["DtPreEnfriado"]; }
|
||||
set { ViewState["DtPreEnfriado"] = value; }
|
||||
}
|
||||
private DataTable DtCorte
|
||||
{
|
||||
get { return DtCorte = (DataTable)ViewState["DtCorte"]; }
|
||||
set { ViewState["DtCorte"] = value; }
|
||||
}
|
||||
private DataTable DtCorte2
|
||||
{
|
||||
get { return DtCorte2 = (DataTable)ViewState["DtCorte2"]; }
|
||||
set { ViewState["DtCorte2"] = value; }
|
||||
}
|
||||
private DataTable DtFleteHuertaEmpaque
|
||||
{
|
||||
get { return DtFleteHuertaEmpaque = (DataTable)ViewState["DtFleteHuertaEmpaque"]; }
|
||||
set { ViewState["DtFleteHuertaEmpaque"] = value; }
|
||||
}
|
||||
private DataTable DtFleteEmpaqueUSA
|
||||
{
|
||||
get { return DtFleteEmpaqueUSA = (DataTable)ViewState["DtFleteEmpaqueUSA"]; }
|
||||
set { ViewState["DtFleteEmpaqueUSA"] = value; }
|
||||
}
|
||||
private DataTable DtOtrosGastos
|
||||
{
|
||||
get { return DtOtrosGastos = (DataTable)ViewState["DtOtrosGastos"]; }
|
||||
set { ViewState["DtOtrosGastos"] = value; }
|
||||
}
|
||||
private DataTable DtOtrosGastosAgrupados
|
||||
{
|
||||
get { return DtOtrosGastosAgrupados = (DataTable)ViewState["DtOtrosGastosAgrupados"]; }
|
||||
set { ViewState["DtOtrosGastosAgrupados"] = value; }
|
||||
}
|
||||
private DataTable DtMateriales
|
||||
{
|
||||
get { return DtMateriales = (DataTable)ViewState["DtMateriales"]; }
|
||||
set { ViewState["DtMateriales"] = value; }
|
||||
}
|
||||
private DataTable DtMaterialesAgrupados
|
||||
{
|
||||
get { return DtMaterialesAgrupados = (DataTable)ViewState["DtMaterialesAgrupados"]; }
|
||||
set { ViewState["DtMaterialesAgrupados"] = value; }
|
||||
}
|
||||
private DataTable DtIngresosAgrupados
|
||||
{
|
||||
get { return DtIngresosAgrupados = (DataTable)ViewState["DtIngresosAgrupados"]; }
|
||||
set { ViewState["DtIngresosAgrupados"] = value; }
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
protected void Page_Load(object sender, EventArgs e)
|
||||
{
|
||||
if (!IsPostBack)
|
||||
{
|
||||
InicializaValores();
|
||||
}
|
||||
}
|
||||
|
||||
protected void BtnConsultar_Click(object sender, EventArgs e)
|
||||
{
|
||||
ClsCGame ObjCGame = new ClsCGame();
|
||||
if (ObjCGame.GetLiquidacionIngresosHuerta(DdlHuerta.SelectedValue.ToEntero(), txtFechaI.Text.ToDate(), txtFechaF.Text.ToDate()))
|
||||
{
|
||||
DtIngresos = ObjCGame.DtResultados.Copy();
|
||||
}
|
||||
if (ObjCGame.GetLiquidacionGastosAgrupadosHuerta(DdlHuerta.SelectedValue.ToEntero(), txtFechaI.Text.ToDate(), txtFechaF.Text.ToDate()))
|
||||
{
|
||||
DtGastosTotales = ObjCGame.DtResultados.Copy();
|
||||
}
|
||||
if (ObjCGame.GetProduccion(UsuarioActual.CveEmpresa, CveHuerta: DdlHuerta.SelectedValue.ToEntero(), FechaI: txtFechaI.Text.ToDate(), FechaF: txtFechaF.Text.ToDate(), Opcion: 1))
|
||||
{
|
||||
DtEmpaque = ObjCGame.DtResultados.Copy();
|
||||
}
|
||||
if (ObjCGame.GetRepPreEnfriado(DdlHuerta.SelectedValue.ToEntero(), txtFechaI.Text.ToDate(), txtFechaF.Text.ToDate(), UsuarioActual.CveEmpresa, true))
|
||||
{
|
||||
DtPreEnfriado = ObjCGame.DtResultados.Copy();
|
||||
}
|
||||
if (ObjCGame.GetRepCorte(DdlHuerta.SelectedValue.ToEntero(), txtFechaI.Text.ToDate(), txtFechaF.Text.ToDate(), UsuarioActual.CveEmpresa))
|
||||
{
|
||||
DataTable DtCorteTemp = ObjCGame.DtResultados.Copy();
|
||||
if (DtCorteTemp.Rows.Count > 0)
|
||||
{
|
||||
int NumColumna = 1, ColTotales = 0;
|
||||
ColTotales = DtCorteTemp.Columns.Count;
|
||||
for (int i = 0; i < ColTotales; i++)
|
||||
{
|
||||
if (i >= 2)
|
||||
{
|
||||
if (DtCorteTemp.Rows[0][DtCorteTemp.Columns[i].ColumnName].ToString().ToDouble() < 1)
|
||||
{
|
||||
DtCorteTemp.Columns.Remove(DtCorteTemp.Columns[i]);
|
||||
i--;
|
||||
ColTotales--;
|
||||
}
|
||||
else
|
||||
{
|
||||
DtCorteTemp.Columns.Add("Nom" + NumColumna);
|
||||
DtCorteTemp.Rows[0]["Nom" + NumColumna] = DtCorteTemp.Columns[i].ColumnName;
|
||||
DtCorteTemp.Columns[i].ColumnName = "Col" + NumColumna;
|
||||
NumColumna++;
|
||||
}
|
||||
}
|
||||
}
|
||||
for (int i = NumColumna; i <= 20; i++)
|
||||
{
|
||||
DtCorteTemp.Columns.Add("Nom" + i);
|
||||
DtCorteTemp.Rows[0]["Nom" + i] = "";
|
||||
DtCorteTemp.Columns.Add("Col" + i);
|
||||
DtCorteTemp.Rows[0]["Col" + i] = "";
|
||||
}
|
||||
}
|
||||
string[] str1, str2;
|
||||
str1 = new string[22] { "CveProduccion","Folio", "Nom1", "Col1", "Nom2", "Col2", "Nom3", "Col3", "Nom4", "Col4", "Nom5", "Col5", "Nom6", "Col6", "Nom7", "Col7", "Nom8", "Col8", "Nom9", "Col9", "Nom10", "Col10"};
|
||||
str2 = new string[22] { "CveProduccion", "Folio", "Nom11", "Col11", "Nom12", "Col12", "Nom13", "Col13", "Nom14", "Col14", "Nom15", "Col15", "Nom16", "Col16", "Nom17", "Col17", "Nom18", "Col18", "Nom19", "Col19", "Nom20", "Col20" };
|
||||
DtCorte = DtCorteTemp.FiltraParametros("", "", str1);
|
||||
DtCorte2 = DtCorteTemp.FiltraParametros("", "", str2);
|
||||
}
|
||||
if (ObjCGame.GetRepFleteHuertaEmpaque(DdlHuerta.SelectedValue.ToEntero(), txtFechaI.Text.ToDate(), txtFechaF.Text.ToDate(), UsuarioActual.CveEmpresa))
|
||||
{
|
||||
DtFleteHuertaEmpaque = ObjCGame.DtResultados.Copy();
|
||||
}
|
||||
if (ObjCGame.GetRepFleteEmpaqueUSA(DdlHuerta.SelectedValue.ToEntero(), txtFechaI.Text.ToDate(), txtFechaF.Text.ToDate(), UsuarioActual.CveEmpresa))
|
||||
{
|
||||
DtFleteEmpaqueUSA = ObjCGame.DtResultados.Copy();
|
||||
}
|
||||
if (ObjCGame.GetRepOtrosGastos(DdlHuerta.SelectedValue.ToEntero(), txtFechaI.Text.ToDate(), txtFechaF.Text.ToDate(), UsuarioActual.CveEmpresa))
|
||||
{
|
||||
DtOtrosGastos = ObjCGame.DtResultados.Copy();
|
||||
}
|
||||
if (ObjCGame.GetRepOtrosGastos(DdlHuerta.SelectedValue.ToEntero(), txtFechaI.Text.ToDate(), txtFechaF.Text.ToDate(), UsuarioActual.CveEmpresa,Opcion:2))
|
||||
{
|
||||
DtOtrosGastosAgrupados = ObjCGame.DtResultados.Copy();
|
||||
}
|
||||
if (ObjCGame.GetRepMateriales(DdlHuerta.SelectedValue.ToEntero(), txtFechaI.Text.ToDate(), txtFechaF.Text.ToDate(), UsuarioActual.CveEmpresa))
|
||||
{
|
||||
DtMateriales = ObjCGame.DtResultados.Copy();
|
||||
}
|
||||
if (ObjCGame.GetRepMateriales(DdlHuerta.SelectedValue.ToEntero(), txtFechaI.Text.ToDate(), txtFechaF.Text.ToDate(), UsuarioActual.CveEmpresa,Opcion:2))
|
||||
{
|
||||
DtMaterialesAgrupados = ObjCGame.DtResultados.Copy();
|
||||
}
|
||||
if (ObjCGame.GetIngresosAgrupados(DdlHuerta.SelectedValue.ToEntero(), txtFechaI.Text.ToDate(), txtFechaF.Text.ToDate(), UsuarioActual.CveEmpresa))
|
||||
{
|
||||
DtIngresosAgrupados= ObjCGame.DtResultados;
|
||||
}
|
||||
ObjCGame.Dispose();
|
||||
double TotIngresosPri = 0, TotIngresosSeg = 0, TotIngresosJug = 0, TotPesoPri = 0, TotPesoSeg = 0, TotPesoJug = 0, TotCantidadPri = 0, TotCantidadSeg = 0, TotCantidadJug = 0, Merma = 0;
|
||||
if (DtIngresos.Rows.Count > 0)
|
||||
{
|
||||
TotIngresosPri = DtIngresos.SUM("ImportePrimera");
|
||||
TotIngresosSeg = DtIngresos.SUM("ImporteSegunda");
|
||||
TotIngresosJug = DtIngresos.SUM("ImporteJugo");
|
||||
TotPesoPri = DtIngresos.SUM("PesoPrimera");
|
||||
TotPesoSeg = DtIngresos.SUM("PesoSegunda");
|
||||
TotPesoJug = DtIngresos.SUM("PesoJugo");
|
||||
TotCantidadPri = DtIngresos.SUM("CantidadPrimera");
|
||||
TotCantidadSeg = DtIngresos.SUM("CantidadSegunda");
|
||||
TotCantidadJug = DtIngresos.SUM("CantidadJugo");
|
||||
Merma = DtIngresos.Rows[0]["Merma"].ToString().ToDouble();
|
||||
LblPesoNeto.Text = DtIngresos.Rows[0]["PesoNeto"].ToString().FormatoNumero();
|
||||
HplNumCortes.Text = DtIngresos.Rows[0]["NumCortes"].ToString().FormatoNumero(0);
|
||||
if (DtGastosTotales.Rows.Count > 0)
|
||||
{
|
||||
//DtGastosTotales.Rows[DtGastosTotales.Rows.Count - 1]["Importe"] = 10 * (TotIngresosPri + TotIngresosSeg + TotIngresosJug) / 100;
|
||||
DtGastosTotales.Rows[DtGastosTotales.Rows.Count - 1]["Importe"] = TxtComisionCitrus.Text.ToDouble();
|
||||
}
|
||||
}
|
||||
|
||||
HplNumCortes.NavigateUrl = $"/CGame/RepOrdenCorte.aspx?CveHuerta={DdlHuerta.SelectedValue}&FechaI={txtFechaI.Text}&FechaF={txtFechaF.Text}";
|
||||
LblPrimera.Text = TotPesoPri.FormatoNumero();
|
||||
LblPorcentajePrimera.Text = (TotPesoPri * 100 / (TotPesoPri + TotPesoSeg + TotPesoJug + Merma)).FormatoNumero();
|
||||
LblCantidadPrimera.Text = TotCantidadPri.FormatoNumero();
|
||||
LblPesoPrimera.Text = TotPesoPri.FormatoNumero();
|
||||
LblImportePrimera.Text = TotIngresosPri.FormatoNumero();
|
||||
LblSegunda.Text = TotPesoSeg.FormatoNumero();
|
||||
LblPorcentajeSegunda.Text = (TotPesoSeg * 100 / (TotPesoPri + TotPesoSeg + TotPesoJug + Merma)).FormatoNumero();
|
||||
LblCantidadSegunda.Text = TotCantidadSeg.FormatoNumero();
|
||||
LblPesoSegunda.Text = TotPesoSeg.FormatoNumero();
|
||||
LblImporteSegunda.Text = TotIngresosSeg.FormatoNumero();
|
||||
LblJugo.Text = TotPesoJug.FormatoNumero();
|
||||
LblPorcentajeJugo.Text = (TotPesoJug * 100 / (TotPesoPri + TotPesoSeg + TotPesoJug + Merma)).FormatoNumero();
|
||||
LblCantidadJugo.Text = TotCantidadJug.FormatoNumero();
|
||||
LblPesoJugo.Text = TotPesoJug.FormatoNumero();
|
||||
LblImporteJugo.Text = TotIngresosJug.FormatoNumero();
|
||||
LblMerma.Text = Merma.FormatoNumero();
|
||||
LblPorcentajeMerma.Text = (Merma * 100 / (TotPesoPri + TotPesoSeg + TotPesoJug + Merma)).FormatoNumero();
|
||||
HlIngresos.Text = (TotIngresosPri + TotIngresosSeg + TotIngresosJug).FormatoNumero();
|
||||
HlIngresos.NavigateUrl = $"/CGame/RepIngresos.aspx?CveHuerta={DdlHuerta.SelectedValue}&FechaI={txtFechaI.Text}&FechaF={txtFechaF.Text}";
|
||||
LblCostos.Text = (DtGastosTotales.SUM("Importe")).FormatoNumero();
|
||||
LblRetorno.Text = ((TotIngresosPri + TotIngresosSeg + TotIngresosJug) - DtGastosTotales.SUM("Importe")).FormatoNumero();
|
||||
LblPrecioArbol.Text = (((TotIngresosPri + TotIngresosSeg + TotIngresosJug) - DtGastosTotales.SUM("Importe")) / (TotPesoPri + TotPesoSeg + TotPesoJug + Merma)).FormatoNumero();
|
||||
GvGastos.DataSource = DtGastosTotales;
|
||||
GvGastos.DataBind();
|
||||
UpDatosGenerales.Update();
|
||||
UpGastos.Update();
|
||||
UpUtilidad.Update();
|
||||
}
|
||||
|
||||
private void InicializaValores()
|
||||
{
|
||||
CargaHuerta();
|
||||
txtFechaI.Text = DateTime.Now.FirstDayOfMonth().ToShortDateString();
|
||||
txtFechaF.Text = DateTime.Now.ToShortDateString();
|
||||
UPFiltros.Update();
|
||||
}
|
||||
|
||||
private void CargaHuerta()
|
||||
{
|
||||
ClsCGame ObjCGame = new ClsCGame();
|
||||
if (ObjCGame.GetHuerta(UsuarioActual.CveEmpresa))
|
||||
{
|
||||
DdlHuerta.DataSource = ObjCGame.DtResultados;
|
||||
DdlHuerta.Items.Insert(0, new ListItem("Seleccione", "-1"));
|
||||
}
|
||||
ObjCGame.Dispose();
|
||||
DdlHuerta.DataBind();
|
||||
}
|
||||
|
||||
protected void LnkPdf_Click(object sender, EventArgs e)
|
||||
{
|
||||
GenerarPDF("PDF");
|
||||
}
|
||||
|
||||
protected void LnkExcel_Click(object sender, EventArgs e)
|
||||
{
|
||||
GenerarPDF("EXCEL");
|
||||
}
|
||||
|
||||
private void GenerarPDF(string Opcion)
|
||||
{
|
||||
if ((DtIngresos.Rows.Count > 0 || DtGastosTotales.Rows.Count > 0))
|
||||
{
|
||||
double TotIngresosPri = 0, TotIngresosSeg = 0, TotIngresosJug = 0, TotPesoPri = 0, TotPesoSeg = 0, TotPesoJug = 0, TotCantidadPri = 0, TotCantidadSeg = 0, TotCantidadJug = 0, Merma = 0,PesoNeto=0;
|
||||
if (DtIngresos.Rows.Count > 0)
|
||||
{
|
||||
TotIngresosPri = DtIngresos.SUM("ImportePrimera");
|
||||
TotIngresosSeg = DtIngresos.SUM("ImporteSegunda");
|
||||
TotIngresosJug = DtIngresos.SUM("ImporteJugo");
|
||||
TotPesoPri = DtIngresos.SUM("PesoPrimera");
|
||||
TotPesoSeg = DtIngresos.SUM("PesoSegunda");
|
||||
TotPesoJug = DtIngresos.SUM("PesoJugo");
|
||||
TotCantidadPri = DtIngresos.SUM("CantidadPrimera");
|
||||
TotCantidadSeg = DtIngresos.SUM("CantidadSegunda");
|
||||
TotCantidadJug = DtIngresos.SUM("CantidadJugo");
|
||||
Merma = DtIngresos.Rows[0]["Merma"].ToString().ToDouble();
|
||||
PesoNeto = DtIngresos.Rows[0]["PesoNeto"].ToString().ToDouble();
|
||||
}
|
||||
|
||||
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("Huerta", DdlHuerta.SelectedItem.Text));
|
||||
para.Add(new ReportParameter("TotPrecioPri", TotIngresosPri.FormatoNumero()));
|
||||
para.Add(new ReportParameter("TotPrecioSeg", TotIngresosSeg.FormatoNumero()));
|
||||
para.Add(new ReportParameter("TotPrecioJug", TotIngresosJug.FormatoNumero()));
|
||||
para.Add(new ReportParameter("TotPesoPri", TotPesoPri.FormatoNumero(0)));
|
||||
para.Add(new ReportParameter("TotPesoSeg", TotPesoSeg.FormatoNumero(0)));
|
||||
para.Add(new ReportParameter("TotPesoJug", TotPesoJug.FormatoNumero(0)));
|
||||
para.Add(new ReportParameter("Merma", Merma.FormatoNumero(0)));
|
||||
para.Add(new ReportParameter("TotCantidadPri", TotCantidadPri.FormatoNumero()));
|
||||
para.Add(new ReportParameter("TotCantidadSeg", TotCantidadSeg.FormatoNumero()));
|
||||
para.Add(new ReportParameter("TotCantidadJug", TotCantidadJug.FormatoNumero()));
|
||||
string PorcentajePesoPri = (TotPesoPri * 100 / (TotPesoPri + TotPesoSeg + TotPesoJug + Merma)).FormatoNumero();
|
||||
string PorcentajePesoSeg = (TotPesoSeg * 100 / (TotPesoPri + TotPesoSeg + TotPesoJug + Merma)).FormatoNumero();
|
||||
string PorcentajePesoJug = (TotPesoJug * 100 / (TotPesoPri + TotPesoSeg + TotPesoJug + Merma)).FormatoNumero();
|
||||
string PorcentajeMerma = (Merma * 100 / (TotPesoPri + TotPesoSeg + TotPesoJug + Merma)).FormatoNumero();
|
||||
para.Add(new ReportParameter("PorcentajePesoPri", PorcentajePesoPri));
|
||||
para.Add(new ReportParameter("PorcentajePesoSeg", PorcentajePesoSeg));
|
||||
para.Add(new ReportParameter("PorcentajePesoJug", PorcentajePesoJug));
|
||||
para.Add(new ReportParameter("PorcentajeMerma", PorcentajeMerma));
|
||||
para.Add(new ReportParameter("Fecha", $"Liquidación correspondiente al periodo del {txtFechaI.Text} al {txtFechaF.Text} ({HplNumCortes.Text} Cortes) de la huerta {DdlHuerta.SelectedItem.Text}"));
|
||||
para.Add(new ReportParameter("PesoNeto", PesoNeto.FormatoNumero(0)));
|
||||
para.Add(new ReportParameter("TotIngresos", (TotIngresosPri + TotIngresosSeg + TotIngresosJug).FormatoNumero()));
|
||||
para.Add(new ReportParameter("TotGastos", (DtGastosTotales.SUM("Importe")).FormatoNumero()));
|
||||
para.Add(new ReportParameter("Retorno", ((TotIngresosPri + TotIngresosSeg + TotIngresosJug) - DtGastosTotales.SUM("Importe")).FormatoNumero()));
|
||||
para.Add(new ReportParameter("PrecioArbol", (((TotIngresosPri + TotIngresosSeg + TotIngresosJug) - DtGastosTotales.SUM("Importe")) / (TotPesoPri + TotPesoSeg + TotPesoJug + Merma)).FormatoNumero()));
|
||||
|
||||
DataTable DtGrafica1 = new DataTable();
|
||||
DtGrafica1.Columns.Add("Concepto");
|
||||
DtGrafica1.Columns.Add("Importe");
|
||||
DtGrafica1.Columns.Add("Porcentaje");
|
||||
DataRow DrGrafica1 = DtGrafica1.NewRow();
|
||||
DrGrafica1["Concepto"] = "Primera";
|
||||
DrGrafica1["Importe"] = TotPesoPri.FormatoNumero();
|
||||
DrGrafica1["Porcentaje"] = PorcentajePesoPri;
|
||||
DtGrafica1.Rows.Add(DrGrafica1);
|
||||
DataRow Dr2Grafica1 = DtGrafica1.NewRow();
|
||||
Dr2Grafica1["Concepto"] = "Segunda";
|
||||
Dr2Grafica1["Importe"] = TotPesoSeg.FormatoNumero();
|
||||
Dr2Grafica1["Porcentaje"] = PorcentajePesoSeg;
|
||||
DtGrafica1.Rows.Add(Dr2Grafica1);
|
||||
DataRow Dr3Grafica1 = DtGrafica1.NewRow();
|
||||
Dr3Grafica1["Concepto"] = "Jugo";
|
||||
Dr3Grafica1["Importe"] = TotPesoJug.FormatoNumero();
|
||||
Dr3Grafica1["Porcentaje"] = PorcentajePesoJug;
|
||||
DtGrafica1.Rows.Add(Dr3Grafica1);
|
||||
DataRow Dr4Grafica1 = DtGrafica1.NewRow();
|
||||
Dr4Grafica1["Concepto"] = "Merma";
|
||||
Dr4Grafica1["Importe"] = TotPesoJug.FormatoNumero();
|
||||
Dr4Grafica1["Porcentaje"] = PorcentajeMerma;
|
||||
DtGrafica1.Rows.Add(Dr4Grafica1);
|
||||
|
||||
DataTable DtGrafica2 = new DataTable();
|
||||
DtGrafica2.Columns.Add("Concepto");
|
||||
DtGrafica2.Columns.Add("Importe");
|
||||
DataRow DrGrafica2 = DtGrafica2.NewRow();
|
||||
DrGrafica2["Concepto"] = "Ingresos";
|
||||
DrGrafica2["Importe"] = (TotIngresosPri + TotIngresosSeg + TotIngresosJug).FormatoNumero();
|
||||
DtGrafica2.Rows.Add(DrGrafica2);
|
||||
DataRow Dr2Grafica2 = DtGrafica2.NewRow();
|
||||
Dr2Grafica2["Concepto"] = "Gastos";
|
||||
Dr2Grafica2["Importe"] = (DtGastosTotales.SUM("Importe")).FormatoNumero();
|
||||
DtGrafica2.Rows.Add(Dr2Grafica2);
|
||||
|
||||
if (Imagen.Exists)
|
||||
{
|
||||
para.Add(new ReportParameter("LogoPath", logouri));
|
||||
}
|
||||
else
|
||||
{
|
||||
para.Add(new ReportParameter("LogoPath", ""));
|
||||
}
|
||||
List<ReportDataSource> lrds = new List<ReportDataSource>();
|
||||
ReportDataSource rds5 = new ReportDataSource();
|
||||
rds5.Name = "DataSet5"; rds5.Value = DtGastosTotales;
|
||||
ReportDataSource rds6 = new ReportDataSource();
|
||||
rds6.Name = "DataSet6"; rds6.Value = DtGrafica1;
|
||||
ReportDataSource rds7 = new ReportDataSource();
|
||||
rds7.Name = "DataSet7"; rds7.Value = DtGrafica2;
|
||||
ReportDataSource rds8 = new ReportDataSource();
|
||||
rds8.Name = "DataSet8"; rds8.Value = DtEmpaque;
|
||||
ReportDataSource rds9 = new ReportDataSource();
|
||||
rds9.Name = "DataSet9"; rds9.Value = DtPreEnfriado;
|
||||
ReportDataSource rds10 = new ReportDataSource();
|
||||
rds10.Name = "DataSet10"; rds10.Value = DtCorte;
|
||||
ReportDataSource rds11 = new ReportDataSource();
|
||||
rds11.Name = "DataSet11"; rds11.Value = DtFleteHuertaEmpaque;
|
||||
ReportDataSource rds12 = new ReportDataSource();
|
||||
rds12.Name = "DataSet12"; rds12.Value = DtFleteEmpaqueUSA;
|
||||
ReportDataSource rds13 = new ReportDataSource();
|
||||
rds13.Name = "DataSet13"; rds13.Value = DtOtrosGastos;
|
||||
ReportDataSource rds14 = new ReportDataSource();
|
||||
rds14.Name = "DataSet14"; rds14.Value = DtMateriales;
|
||||
ReportDataSource rds15 = new ReportDataSource();
|
||||
rds15.Name = "DataSet15"; rds15.Value = DtIngresosAgrupados;
|
||||
ReportDataSource rds16 = new ReportDataSource();
|
||||
rds16.Name = "DataSet16"; rds16.Value = DtMaterialesAgrupados;
|
||||
ReportDataSource rds17 = new ReportDataSource();
|
||||
rds17.Name = "DataSet17"; rds17.Value = DtOtrosGastosAgrupados;
|
||||
ReportDataSource rds18 = new ReportDataSource();
|
||||
rds18.Name = "DataSet18"; rds18.Value = DtCorte2;
|
||||
lrds.Add(rds5);
|
||||
lrds.Add(rds6);
|
||||
lrds.Add(rds7);
|
||||
lrds.Add(rds8);
|
||||
lrds.Add(rds9);
|
||||
lrds.Add(rds10);
|
||||
lrds.Add(rds11);
|
||||
lrds.Add(rds12);
|
||||
lrds.Add(rds13);
|
||||
lrds.Add(rds14);
|
||||
lrds.Add(rds15);
|
||||
lrds.Add(rds16);
|
||||
lrds.Add(rds17);
|
||||
lrds.Add(rds18);
|
||||
|
||||
ImprimirPDF("Empresas/Grales/Formatos/Liquidacion.rdlc", lrds, para, "Liquidacion", Opcion);
|
||||
}
|
||||
else
|
||||
{
|
||||
Alert("No se encontraron datos.", TipoMensaje.MsgAdvertencia);
|
||||
}
|
||||
}
|
||||
|
||||
protected void GvGastos_RowDataBound(object sender, GridViewRowEventArgs e)
|
||||
{
|
||||
if (e.Row.RowType == DataControlRowType.DataRow)
|
||||
{
|
||||
String Css = "Texto";
|
||||
String Liga = "";
|
||||
if (e.Row.DBCampo("Orden").ToEntero() == 5)
|
||||
{
|
||||
Liga = $"/CGame/RepPreEnfriado.aspx?&CveHuerta={DdlHuerta.SelectedValue}&FechaI={txtFechaI.Text}&FechaF={txtFechaF.Text}&Liquidado=1";
|
||||
}
|
||||
else if (e.Row.DBCampo("Orden").ToEntero() == 2)
|
||||
{
|
||||
Liga = $"/CGame/RepFletes.aspx?&CveHuerta={DdlHuerta.SelectedValue}&FechaI={txtFechaI.Text}&FechaF={txtFechaF.Text}&Tipo=1";
|
||||
}
|
||||
else if (e.Row.DBCampo("Orden").ToEntero() == 6)
|
||||
{
|
||||
Liga = $"/CGame/RepFletes.aspx?&CveHuerta={DdlHuerta.SelectedValue}&FechaI={txtFechaI.Text}&FechaF={txtFechaF.Text}&Tipo=2";
|
||||
}
|
||||
else if (e.Row.DBCampo("Orden").ToEntero() == 1)
|
||||
{
|
||||
Liga = $"/CGame/RepCorte.aspx?&CveHuerta={DdlHuerta.SelectedValue}&FechaI={txtFechaI.Text}&FechaF={txtFechaF.Text}";
|
||||
}
|
||||
else if (e.Row.DBCampo("Orden").ToEntero() == 3)
|
||||
{
|
||||
Liga = $"/CGame/RepMaquila.aspx?&CveHuerta={DdlHuerta.SelectedValue}&FechaI={txtFechaI.Text}&FechaF={txtFechaF.Text}";
|
||||
}
|
||||
else if (e.Row.DBCampo("Orden").ToEntero() == 4)
|
||||
{
|
||||
Liga = $"/CGame/RepMateriales.aspx?&CveHuerta={DdlHuerta.SelectedValue}&FechaI={txtFechaI.Text}&FechaF={txtFechaF.Text}";
|
||||
}
|
||||
else if (e.Row.DBCampo("Orden").ToEntero() == 7)
|
||||
{
|
||||
Liga = $"/CGame/RepOtrosGastos.aspx?&CveHuerta={DdlHuerta.SelectedValue}&FechaI={txtFechaI.Text}&FechaF={txtFechaF.Text}";
|
||||
Reference in New Issue
Block a user