RepLienas carga por venta

This commit is contained in:
Oscar Irigoyen
2022-10-05 17:02:37 -07:00
parent ead901254c
commit 9636641f6c
3 changed files with 31 additions and 24 deletions

View File

@@ -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, 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, 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 Dim Retorno As Boolean = False
DataAdapter("PA_Vta_LineasAdicionalesUpdate") DataAdapter("PA_Vta_LineasAdicionalesUpdate")
@@ -5684,7 +5684,7 @@ Public Class ClsVentas
.Add("@CveUsuario", SqlDbType.Int).Value = CveUsuario .Add("@CveUsuario", SqlDbType.Int).Value = CveUsuario
.Add("@CveCategoria", SqlDbType.Int).Value = CveCategoria .Add("@CveCategoria", SqlDbType.Int).Value = CveCategoria
.Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa .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("@DiasVencimiento", SqlDbType.VarChar).Value = DiasVencimiento
.Add("@CveVenta", SqlDbType.VarChar).Value = CveVenta .Add("@CveVenta", SqlDbType.VarChar).Value = CveVenta
.Add("@CveLineaAdicionalEstatus", SqlDbType.Int).Value = CveLineaAdicionalEstatus .Add("@CveLineaAdicionalEstatus", SqlDbType.Int).Value = CveLineaAdicionalEstatus

View File

@@ -89,10 +89,10 @@
<ContentTemplate> <ContentTemplate>
<asp:GridView ID="GvLineasAdicionales" Width="100%" runat="server" GridLines="None" <asp:GridView ID="GvLineasAdicionales" Width="100%" runat="server" GridLines="None"
DataKeyNames="CveLineaAdicional,LineaAdicional,CveCliente,CveProveedor,TipoLinea,Importe,CveMoneda,FechaVencimiento,CveUsuario,CveCategoria,FechaIng,CveLineaAdicionalEstatus,Proveedor,Comprobante,DiasVencimiento,CveVenta" DataKeyNames="CveLineaAdicional,LineaAdicional,CveCliente,CveProveedor,TipoLinea,Importe,CveMoneda,FechaVencimiento,CveUsuario,CveCategoria,FechaIng,CveLineaAdicionalEstatus,Proveedor,LineaAdicionalComprobante,DiasVencimiento,CveVenta"
CssClass="table table-striped table-advance table-hover ScrollAD input-sm " ShowHeader="True" EmptyDataText="No se encontraron resultados." ShowHeaderWhenEmpty="true" CssClass="table table-striped table-advance table-hover ScrollAD input-sm " ShowHeader="True" EmptyDataText="No se encontraron resultados." ShowHeaderWhenEmpty="true"
AutoGenerateColumns="False" AllowPaging="False" ShowFooter="False" AutoGenerateColumns="False" AllowPaging="False" ShowFooter="False"
OnRowCommand ="GvLineasAdicionales_RowCommand" OnRowCommand ="GvLineasAdicionales_RowCommand"
OnRowDataBound="GvLineasAdicionales_RowDataBound"> OnRowDataBound="GvLineasAdicionales_RowDataBound">
<Columns> <Columns>
<asp:BoundField DataField="LineaAdicional" HeaderText="Linea Adicional" /> <asp:BoundField DataField="LineaAdicional" HeaderText="Linea Adicional" />
@@ -109,8 +109,7 @@
<asp:TemplateField HeaderText="Opciones" Visible="false" ItemStyle-Width="120px"> <asp:TemplateField HeaderText="Opciones" Visible="false" ItemStyle-Width="120px">
<ItemTemplate> <ItemTemplate>
<div class="row" style="width:118px" > <div class="row" style="width:118px" >
<asp:LinkButton ID="LnkCargarComprobante" runat="server" AlternateText="Editar" CausesValidation="False" CssClass="btn btn-circle btn-sm green" Text="<i class='fa fa-upload'></i>" OnClick="LnkCargarComprobante_Click" /> <asp:LinkButton ID="LnkCargarComprobante" runat="server" AlternateText="Editar" CausesValidation="False" CssClass="btn btn-circle btn-sm green" Text="<i class='fa fa-upload'></i>" OnClick="LnkCargarComprobante_Click" />
<asp:LinkButton ID="LnkDescargaComprobante" runat="server" AlternateText="Descarga" CausesValidation="False" CssClass="btn btn-circle btn-sm yellow" Text="<i class='fa fa-download'></i>" OnClick="LnkDescargaComprobante_Click" Visible="false" /> <asp:LinkButton ID="LnkDescargaComprobante" runat="server" AlternateText="Descarga" CausesValidation="False" CssClass="btn btn-circle btn-sm yellow" Text="<i class='fa fa-download'></i>" OnClick="LnkDescargaComprobante_Click" Visible="false" />

View File

@@ -7,11 +7,18 @@ using System.Web.UI;
using System.IO; using System.IO;
using ListItem = System.Web.UI.WebControls.ListItem; using ListItem = System.Web.UI.WebControls.ListItem;
using System.Web.UI; using System.Web.UI;
public partial class Ventas_RepLineasAdicionales : ClsPaginas
{ {
#region PROPIEDADES #region PROPIEDADES
private int CveLineaAdicional
{
get { return (ViewState["CveLineaAdicional"] == null) ? 0 : int.Parse(ViewState["CveLineaAdicional"].ToString()); }
set { ViewState["CveLineaAdicional"] = (int)value; }
}
private int CveVenta private int CveVenta
{ {
get { return (ViewState["CveVenta"] == null) ? 0 : int.Parse(ViewState["CveVenta"].ToString()); } get { return (ViewState["CveVenta"] == null) ? 0 : int.Parse(ViewState["CveVenta"].ToString()); }
@@ -33,18 +40,18 @@ public partial class Ventas_RepLineasAdicionales : ClsPaginas
ViewState["DTDatosGvLineasAdicionales"] = new DataTable(); ViewState["DTDatosGvLineasAdicionales"] = new DataTable();
} }
return (DataTable)ViewState["DTDatosGvLineasAdicionales"]; return (DataTable)ViewState["DTDatosGvLineasAdicionales"];
} }
set { ViewState["DTDatosGvLineasAdicionales"] = (DataTable)value; } set { ViewState["DTDatosGvLineasAdicionales"] = (DataTable)value; }
} }
private string Comprobante private string LineaAdicionalComprobante
{ {
get { get {
if(ViewState["LineaAdicionalComprobante"] == null) if(ViewState["LineaAdicionalComprobante"] == null)
{ {
ViewState["LineaAdicionalComprobante"] = ""; ViewState["LineaAdicionalComprobante"] = "";
} }
return ViewState["LineaAdicionalComprobante"].ToString(); return ViewState["LineaAdicionalComprobante"].ToString();
} }
@@ -135,9 +142,10 @@ public partial class Ventas_RepLineasAdicionales : ClsPaginas
UpLineasAdicionales.Update(); UpLineasAdicionales.Update();
} }
protected void LnkCargarComprobante_Click(object sender, EventArgs e) protected void LnkCargarComprobante_Click(object sender, EventArgs e)
{ {
GridViewRow GvRow = (GridViewRow) ((LinkButton) sender).NamingContainer;
CveLineaAdicional = GvRow.DataKey("CveLineaAdicional").ToString().ToEntero(); CveLineaAdicional = GvRow.DataKey("CveLineaAdicional").ToString().ToEntero();
CveVenta = GvRow.DataKey("CveVenta").ToString().ToEntero(); CveVenta = GvRow.DataKey("CveVenta").ToString().ToEntero();
@@ -167,9 +175,9 @@ public partial class Ventas_RepLineasAdicionales : ClsPaginas
catch catch
{ {
errorCargaComprobante = true; errorCargaComprobante = true;
} }
} }
//borrar archivo anterior //borrar archivo anterior
if((!errorCargaComprobante) && LineaAdicionalComprobante.Length > 0) if((!errorCargaComprobante) && LineaAdicionalComprobante.Length > 0)
{ {
@@ -204,12 +212,12 @@ public partial class Ventas_RepLineasAdicionales : ClsPaginas
fiNuevo = new FileInfo(RutaArchivoTemp); fiNuevo = new FileInfo(RutaArchivoTemp);
if (fiNuevo.Exists) if (fiNuevo.Exists)
{ {
try try
{ {
if (File.Exists($@"{df.FullName}\{CveVenta}{fiNuevo.Extension}")) if (File.Exists($@"{df.FullName}\{CveVenta}{fiNuevo.Extension}"))
{ {
File.Delete($@"{df.FullName}\{CveVenta}{fiNuevo.Extension}"); File.Delete($@"{df.FullName}\{CveVenta}{fiNuevo.Extension}");
} }
@@ -220,7 +228,7 @@ public partial class Ventas_RepLineasAdicionales : ClsPaginas
{ {
errorCargaComprobante = true; errorCargaComprobante = true;
} }
if (!errorCargaComprobante) if (!errorCargaComprobante)
{ {
ClsVentas objVentas = new ClsVentas(); ClsVentas objVentas = new ClsVentas();
@@ -287,9 +295,9 @@ public partial class Ventas_RepLineasAdicionales : ClsPaginas
} }
if (e.Row.DataKey("CveLineaAdicionalEstatus").ToEntero() == 2) if (e.Row.DataKey("CveLineaAdicionalEstatus").ToEntero() == 2)
{ {
e.Row.FCLinkButton("LnkCargarComprobante").Visible = false; e.Row.FCLinkButton("LnkCargarComprobante").Visible = false;
} }
if (e.Row.DataKey("LineaAdicionalComprobante").Length > 0 && e.Row.DataKey("CveVenta").ToEntero() > 0 ) if (e.Row.DataKey("LineaAdicionalComprobante").Length > 0 && e.Row.DataKey("CveVenta").ToEntero() > 0 )
{ {
@@ -304,7 +312,7 @@ public partial class Ventas_RepLineasAdicionales : ClsPaginas
} }
} }
} }
protected void LnkDescargaComprobante_Click(object sender, EventArgs e) protected void LnkDescargaComprobante_Click(object sender, EventArgs e)
{ {
GridViewRow GvRow = (GridViewRow)((LinkButton)sender).NamingContainer; GridViewRow GvRow = (GridViewRow)((LinkButton)sender).NamingContainer;