From be9c52f5c6d310d52cd49fc0410ed9d201b439b6 Mon Sep 17 00:00:00 2001 From: janeth arvizu Date: Thu, 7 Nov 2019 14:15:15 -0700 Subject: [PATCH] Pago contado cuado Total sea mayor a cero --- OC/RepSolicitudesAnticipo.aspx | 14 ++++---- OC/RepSolicitudesAnticipo.aspx.cs | 57 ++++++++++++++++++++++++++++++- Ventas/Ventas.aspx.vb | 2 +- 3 files changed, 63 insertions(+), 10 deletions(-) diff --git a/OC/RepSolicitudesAnticipo.aspx b/OC/RepSolicitudesAnticipo.aspx index acd8fd09e..7b3187682 100644 --- a/OC/RepSolicitudesAnticipo.aspx +++ b/OC/RepSolicitudesAnticipo.aspx @@ -10,14 +10,12 @@ -<%-- - -
  • - - Generar PDF -
  • -
    -
    --%> +
  • + Generar PDF +
  • +
  • + Exporta Excel +
  • diff --git a/OC/RepSolicitudesAnticipo.aspx.cs b/OC/RepSolicitudesAnticipo.aspx.cs index 69d5fd3fe..b8cc189ea 100644 --- a/OC/RepSolicitudesAnticipo.aspx.cs +++ b/OC/RepSolicitudesAnticipo.aspx.cs @@ -1,11 +1,13 @@ using System; using System.Collections.Generic; +using System.Data; using System.Linq; using System.Web; using System.Web.UI; using System.Web.UI.WebControls; using Extensiones; +using Microsoft.Reporting.WebForms; using static Extensiones.ModExtensiones; public partial class OC_RepSolicitudesAnticipo : ClsPaginas @@ -47,6 +49,11 @@ public partial class OC_RepSolicitudesAnticipo : ClsPaginas ViewState["FechaF"] = value; } } + private DataTable DtDatos + { + get { return DtDatos = (DataTable)ViewState["DtDatos"]; } + set { ViewState["DtDatos"] = value; } + } #endregion protected void Page_Load(object sender, EventArgs e) @@ -82,7 +89,8 @@ public partial class OC_RepSolicitudesAnticipo : ClsPaginas if (ObjOC.GetRepSolicitudAnticipos(UsuarioActual.CveEmpresa, CveProveedor, FechaI, FechaF, DdlEstatus.SelectedValue.ToEntero())) { - GvSolicitudes.DataSource = ObjOC.DtResultados; + DtDatos = ObjOC.DtResultados; + GvSolicitudes.DataSource = DtDatos; } ObjOC.Dispose(); @@ -106,4 +114,51 @@ public partial class OC_RepSolicitudesAnticipo : ClsPaginas } CargaDatos(); } + + protected void LnkExcel_Click(object sender, EventArgs e) + { + GenerarPDF("EXCEL"); + } + + protected void LnkPdf_Click(object sender, EventArgs e) + { + GenerarPDF("PDF"); + } + + protected void GenerarPDF(String Opcion) + { + String FechaI; + if (txtFechaI.Text == "" || txtFechaI.Text == "__/__/____") { FechaI = ""; } else { FechaI = $" Fecha Inicial: {txtFechaI.Text}"; } + String FechaF; + if (txtFechaF.Text == "" || txtFechaF.Text == "__/__/____") { FechaF = ""; } else { FechaF = $" Fecha Final: {txtFechaF.Text}"; } + String Proveedor; + if (DdlProveedor.SelectedValue != "-1") { Proveedor = $" Proveedor: {DdlProveedor.SelectedItem.Text}"; } else { Proveedor = ""; } + String Estatus; + if (DdlEstatus.SelectedValue != "1") { Estatus = $" Estatus: {DdlEstatus.SelectedItem.Text}"; } else { Estatus = ""; } + + if (DtDatos.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 para = new List(); + para.Add(new ReportParameter("NombreEmpresa", UsuarioActual.Empresa.Empresa)); + para.Add(new ReportParameter("UsuarioImprimio", UsuarioActual.Nombre)); + para.Add(new ReportParameter("Estatus", DdlEstatus.SelectedValue)); + String Agrupadores = $"{Proveedor}{FechaI}{FechaF}{Estatus}"; + para.Add(new ReportParameter("AgrupadoPor", (Agrupadores == "" ? "": $"Agrupado Por: {Agrupadores}"))); + if (Imagen.Exists) + { + para.Add(new ReportParameter("LogoPath", logouri)); + } + else + { + para.Add(new ReportParameter("LogoPath", "")); + } + ImprimirPDF("Empresas/Grales/Formatos/RepSolicitudAnticipo.rdlc", DtDatos, para, "Reporte de Solicitudes de Anticipos", Opcion); + } + else + { + Alert("No hay datos consultados", ModExtensiones.TipoMensaje.MsgAdvertencia); + } + } } \ No newline at end of file diff --git a/Ventas/Ventas.aspx.vb b/Ventas/Ventas.aspx.vb index a6ba4ad0a..fac523585 100644 --- a/Ventas/Ventas.aspx.vb +++ b/Ventas/Ventas.aspx.vb @@ -16679,7 +16679,7 @@ Partial Class Ventas Private Function ValidaPagosContado() As Boolean Dim Retorno = False - If (UsuarioActual.CveEmpresa = 140) AndAlso (Not PermiteCredito) AndAlso (DtPagos Is Nothing OrElse DtPagos.Rows.Count = 0) Then + If (UsuarioActual.CveEmpresa = 140) AndAlso (Not PermiteCredito) AndAlso (DtPagos Is Nothing OrElse DtPagos.Rows.Count = 0) And TxtTotal.Text.ToDecimal > 0 Then Alert("Es necesario especificar un pago.", TipoMensaje.MsgAdvertencia) Retorno = True End If