From 9636641f6cfe54973df52df843e35211dbd00e06 Mon Sep 17 00:00:00 2001 From: Oscar Irigoyen Date: Wed, 5 Oct 2022 17:02:37 -0700 Subject: [PATCH] RepLienas carga por venta --- App_Code/ClsVentas.vb | 4 +-- Ventas/RepLineasAdicionales.aspx | 7 ++--- Ventas/RepLineasAdicionales.aspx.cs | 44 +++++++++++++++++------------ 3 files changed, 31 insertions(+), 24 deletions(-) diff --git a/App_Code/ClsVentas.vb b/App_Code/ClsVentas.vb index 7378428ee..9b748d07f 100644 --- a/App_Code/ClsVentas.vb +++ b/App_Code/ClsVentas.vb @@ -5667,7 +5667,7 @@ Public Class ClsVentas Public Function UpdateLineasAdicionales(CveLineaAdicional As Integer, LineaAdicional As String, CveCliente As Integer, CveProveedor As Integer, TipoLinea As Integer, Importe As Decimal, CveMoneda As Integer, FechaVencimiento As Date, CveUsuario As Integer, CveCategoria As Integer, CveEmpresa As Integer, - Optional Comprobante As String = "-1", Optional DiasVencimiento As Integer = -1, Optional CveVenta As Integer = -1, Optional CveLineaAdicionalEstatus As Integer = -1) As Boolean + Optional LineaAdicionalComprobante As String = "-1", Optional DiasVencimiento As Integer = -1, Optional CveVenta As Integer = -1, Optional CveLineaAdicionalEstatus As Integer = -1) As Boolean Dim Retorno As Boolean = False DataAdapter("PA_Vta_LineasAdicionalesUpdate") @@ -5684,7 +5684,7 @@ Public Class ClsVentas .Add("@CveUsuario", SqlDbType.Int).Value = CveUsuario .Add("@CveCategoria", SqlDbType.Int).Value = CveCategoria .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa - .Add("@Comprobante", SqlDbType.VarChar).Value = Comprobante + .Add("@LineaAdicionalComprobante", SqlDbType.VarChar).Value = LineaAdicionalComprobante .Add("@DiasVencimiento", SqlDbType.VarChar).Value = DiasVencimiento .Add("@CveVenta", SqlDbType.VarChar).Value = CveVenta .Add("@CveLineaAdicionalEstatus", SqlDbType.Int).Value = CveLineaAdicionalEstatus diff --git a/Ventas/RepLineasAdicionales.aspx b/Ventas/RepLineasAdicionales.aspx index 4c38cc00b..bfe5ef7aa 100644 --- a/Ventas/RepLineasAdicionales.aspx +++ b/Ventas/RepLineasAdicionales.aspx @@ -89,10 +89,10 @@ @@ -109,8 +109,7 @@ -
- +
diff --git a/Ventas/RepLineasAdicionales.aspx.cs b/Ventas/RepLineasAdicionales.aspx.cs index c154e960b..7340a5449 100644 --- a/Ventas/RepLineasAdicionales.aspx.cs +++ b/Ventas/RepLineasAdicionales.aspx.cs @@ -7,11 +7,18 @@ using System.Web.UI; public partial class Ventas_RepLineasAdicionales : ClsPaginas { #region PROPIEDADES - + + private int CveLineaAdicional { get { return (ViewState["CveLineaAdicional"] == null) ? 0 : int.Parse(ViewState["CveLineaAdicional"].ToString()); } - set { ViewState["CveLineaAdicional"] =(int) value; } + set { ViewState["CveLineaAdicional"] = (int)value; } + } + + private int CveVenta + { + get { return (ViewState["CveVenta"] == null) ? 0 : int.Parse(ViewState["CveVenta"].ToString()); } + set { ViewState["CveVenta"] =(int) value; } } private int TipoLinea @@ -33,18 +40,18 @@ public partial class Ventas_RepLineasAdicionales : ClsPaginas set { ViewState["DTDatosGvLineasAdicionales"] = (DataTable)value; } } - private string Comprobante + private string LineaAdicionalComprobante { get { - if(ViewState["Comprobante"] == null) + if(ViewState["LineaAdicionalComprobante"] == null) { - ViewState["Comprobante"] = ""; + ViewState["LineaAdicionalComprobante"] = ""; } - return ViewState["Comprobante"].ToString(); + return ViewState["LineaAdicionalComprobante"].ToString(); } - set { ViewState["Comprobante"] = value; } + set { ViewState["LineaAdicionalComprobante"] = value; } } #endregion @@ -135,9 +142,10 @@ public partial class Ventas_RepLineasAdicionales : ClsPaginas protected void LnkCargarComprobante_Click(object sender, EventArgs e) { GridViewRow GvRow = (GridViewRow) ((LinkButton) sender).NamingContainer; - + CveLineaAdicional = GvRow.DataKey("CveLineaAdicional").ToString().ToEntero(); - Comprobante = GvRow.DataKey("Comprobante").ToString(); + CveVenta = GvRow.DataKey("CveVenta").ToString().ToEntero(); + LineaAdicionalComprobante = GvRow.DataKey("LineaAdicionalComprobante").ToString(); RegistraScript("$('#ModalComprobante').modal('show');",""); } @@ -167,9 +175,9 @@ public partial class Ventas_RepLineasAdicionales : ClsPaginas } //borrar archivo anterior - if((!errorCargaComprobante) && Comprobante.Length > 0) + if((!errorCargaComprobante) && LineaAdicionalComprobante.Length > 0) { - FileInfo fiAnterior = new FileInfo($@"{df.FullName}{Comprobante}"); + FileInfo fiAnterior = new FileInfo($@"{df.FullName}{LineaAdicionalComprobante}"); if (fiAnterior.Exists) { try @@ -204,12 +212,12 @@ public partial class Ventas_RepLineasAdicionales : ClsPaginas try { - if (File.Exists($@"{df.FullName}\{CveLineaAdicional}{fiNuevo.Extension}")) + if (File.Exists($@"{df.FullName}\{CveVenta}{fiNuevo.Extension}")) { - File.Delete($@"{df.FullName}\{CveLineaAdicional}{fiNuevo.Extension}"); + File.Delete($@"{df.FullName}\{CveVenta}{fiNuevo.Extension}"); } - File.Move(fiNuevo.FullName, $@"{df.FullName}\{CveLineaAdicional}{fiNuevo.Extension}"); + File.Move(fiNuevo.FullName, $@"{df.FullName}\{CveVenta}{fiNuevo.Extension}"); errorCargaComprobante = false; } catch @@ -220,7 +228,7 @@ public partial class Ventas_RepLineasAdicionales : ClsPaginas if (!errorCargaComprobante) { ClsVentas objVentas = new ClsVentas(); - if (!objVentas.UpdateLineasAdicionales(CveLineaAdicional, "-1", -1, -1, -1, -1, -1, MinFecha, 100, -1, UsuarioActual.CveEmpresa, Comprobante: $@"{CveLineaAdicional}{fiNuevo.Extension}")) + if (!objVentas.UpdateLineasAdicionales(CveLineaAdicional, "-1", -1, -1, -1, -1, -1, MinFecha, 100, -1, UsuarioActual.CveEmpresa, LineaAdicionalComprobante: $@"{CveVenta}{fiNuevo.Extension}",CveVenta:CveVenta)) { errorCargaComprobante = true; } @@ -287,9 +295,9 @@ public partial class Ventas_RepLineasAdicionales : ClsPaginas e.Row.FCLinkButton("LnkCargarComprobante").Visible = false; } - if (e.Row.DataKey("Comprobante").Length > 0) + if (e.Row.DataKey("LineaAdicionalComprobante").Length > 0 && e.Row.DataKey("CveVenta").ToEntero() > 0 ) { - FileInfo fi = new FileInfo($@"{UsuarioActual.Empresa.Ruta}\LineasAdicionales\{e.Row.DataKey("Comprobante")}"); + FileInfo fi = new FileInfo($@"{UsuarioActual.Empresa.Ruta}\LineasAdicionales\{e.Row.DataKey("LineaAdicionalComprobante")}"); LinkButton LnkDescargaComprobante = e.Row.FCLinkButton("LnkDescargaComprobante"); if (fi.Exists) @@ -304,7 +312,7 @@ public partial class Ventas_RepLineasAdicionales : ClsPaginas protected void LnkDescargaComprobante_Click(object sender, EventArgs e) { GridViewRow GvRow = (GridViewRow)((LinkButton)sender).NamingContainer; - string Comprobante = GvRow.DataKey("Comprobante"); + string Comprobante = GvRow.DataKey("LineaAdicionalComprobante"); FileInfo fi = new FileInfo($@"{UsuarioActual.Empresa.Ruta}\LineasAdicionales\{Comprobante}"); if (fi.Exists)