-- nuevo Reporte de vencimientos
This commit is contained in:
@@ -10670,7 +10670,6 @@ Public Class ClsPaginas
|
||||
PaginaDict.Add("/Sistemas/CatProcesos.aspx".ToUpper(), 69)
|
||||
PaginaDict.Add("/Sistemas/CatParametros.aspx".ToUpper(), 143)
|
||||
PaginaDict.Add("/Sistemas/PopUpCargaCertificados.aspx".ToUpper(), 144)
|
||||
PaginaDict.Add("/Sistemas/CatNotificaciones.aspx".ToUpper(), 146)
|
||||
PaginaDict.Add("/Sistemas/EmpresasModulos.aspx".ToUpper(), 346)
|
||||
PaginaDict.Add("/Sistemas/CatSesiones.aspx".ToUpper(), 374)
|
||||
PaginaDict.Add("/Sistemas/CatFuncionalidades.aspx".ToUpper(), 568)
|
||||
@@ -10789,10 +10788,7 @@ Public Class ClsPaginas
|
||||
PaginaDict.Add("/Ventas/CatEspecialidadesSubEspecialidades.aspx".ToUpper(), 1346)
|
||||
PaginaDict.Add("/Ventas/FacturacionGlobal.aspx".ToUpper(), 546)
|
||||
PaginaDict.Add("/Ventas/RepComisionesSMS.aspx".ToUpper(), 1347)
|
||||
|
||||
|
||||
|
||||
|
||||
PaginaDict.Add("/Ventas/RepVencimientosCredito.aspx".ToUpper(), 146)
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -5983,6 +5983,30 @@ Public Class ClsVentas
|
||||
End Function
|
||||
|
||||
|
||||
Public Function GetLineasAdicionalesVencimientos(CveCliente As Integer, TipoLinea As Integer, FechaInicio As Date, FechaFin As Date, CveMoneda As Integer, CveEmpresa As Integer) As Boolean
|
||||
|
||||
Dim Retorno As Boolean = False
|
||||
DataAdapter("PA_Vta_LineasAdicionalesVencimientosGet")
|
||||
With SqlAdapter.SelectCommand.Parameters
|
||||
.Add("@CveCliente", SqlDbType.Int).Value = CveCliente
|
||||
.Add("@FechaInicio", SqlDbType.Date).Value = FechaInicio
|
||||
.Add("@FechaFin", SqlDbType.Date).Value = FechaFin
|
||||
.Add("@TipoLinea", SqlDbType.Int).Value = TipoLinea
|
||||
.Add("@CveMoneda", SqlDbType.Int).Value = CveMoneda
|
||||
.Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa
|
||||
End With
|
||||
Try
|
||||
SqlAdapter.Fill(Data)
|
||||
Retorno = True
|
||||
Catch ex As Exception
|
||||
OnError("Ocurrió un error obtener las lineas de adicionales.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo())
|
||||
End Try
|
||||
Return Retorno
|
||||
|
||||
|
||||
End Function
|
||||
|
||||
|
||||
Public Function CambioClientesVendedor(CveCliente As Integer, CveVendedor As Integer, CveEmpresa As Integer) As Boolean
|
||||
|
||||
Dim Retorno As Boolean = False
|
||||
|
||||
233
Ventas/RepVencimientosCredito.aspx
Normal file
233
Ventas/RepVencimientosCredito.aspx
Normal file
@@ -0,0 +1,233 @@
|
||||
<%@ Page Title="" Language="C#" MasterPageFile="~/Site.master" AutoEventWireup="true" CodeFile="RepVencimientosCredito.aspx.cs" Inherits="Ventas_RepVencimientosCredito" %>
|
||||
|
||||
<asp:Content ID="Content1" ContentPlaceHolderID="CP" Runat="Server">
|
||||
</asp:Content>
|
||||
<asp:Content ID="Content2" ContentPlaceHolderID="Css" Runat="Server">
|
||||
|
||||
</asp:Content>
|
||||
<asp:Content ID="Content3" ContentPlaceHolderID="E" Runat="Server">
|
||||
<asp:Literal runat="server" ID="LtlEncabezado" Text="Reporte Lineas Adicionales"></asp:Literal>
|
||||
</asp:Content>
|
||||
<asp:Content ID="Content4" ContentPlaceHolderID="HB" Runat="Server">
|
||||
</asp:Content>
|
||||
<asp:Content ID="Content5" ContentPlaceHolderID="H" Runat="Server">
|
||||
|
||||
<asp:UpdatePanel ID="UpAcciones" runat="server" UpdateMode="Conditional">
|
||||
<ContentTemplate>
|
||||
<li>
|
||||
<asp:LinkButton ID="LnkDescargaExcel" OnClick="LnkDescargaExcel_Click" runat="server" Visible="false"><i class="fa fa-file-excel-o"></i> Excel</asp:LinkButton>
|
||||
</li>
|
||||
</ContentTemplate>
|
||||
<Triggers>
|
||||
<asp:PostBackTrigger ControlID="LnkDescargaExcel" />
|
||||
</Triggers>
|
||||
</asp:UpdatePanel>
|
||||
|
||||
</asp:Content>
|
||||
<asp:Content ID="Content6" ContentPlaceHolderID="HA" Runat="Server">
|
||||
</asp:Content>
|
||||
<asp:Content ID="Content7" ContentPlaceHolderID="C" Runat="Server">
|
||||
<asp:UpdatePanel ID="UPFiltros" runat="server" UpdateMode="Conditional">
|
||||
<ContentTemplate>
|
||||
|
||||
<div class="portlet solid grey-cascade portlet-filter" style="" id="DivFiltros">
|
||||
<div class="portlet-title portlet-filterT smalltitle " style="">
|
||||
<div class="tools">
|
||||
<asp:Button ID="BtnConsultar" runat="server" OnClick="BtnConsultar_Click" Text="Consultar" class="btn btn-primary" />
|
||||
<a href="javascript:;" class="expand"></a>
|
||||
</div>
|
||||
<div class="titlefiltros caption">
|
||||
<div class="row">
|
||||
|
||||
<div class="col-md-1 truncate" runat="server" id="DVProveedor1" visible="false">Comercializador:</div>
|
||||
<div class="col-md-2" runat="server" id="DVProveedor2" visible="false">
|
||||
<ADS:Dropdownlost ID="DdlProveedor" SelectedText="-" runat="server" CssStyle="width: 100%; selected2me; " Width="100%" DataTextField="RazonSocial" DataValueField="CveProveedor" CssClass="select2me"></ADS:Dropdownlost>
|
||||
</div>
|
||||
|
||||
<div class="col-md-1 truncate" >Cliente:</div>
|
||||
<div class="col-md-2 ">
|
||||
<ADS:Dropdownlost CssClassDdl="select2me" ID="DdlClientes" Width="100%" data-metodo="getcliente" UsaWebService="true" runat="server" DataTextField="NombreComercial" DataValueField="CveCliente" CssStyle="width: 100%;"></ADS:Dropdownlost>
|
||||
</div>
|
||||
|
||||
<div class="col-md-1 truncate" >Estatus:</div>
|
||||
<div class="col-md-1 ">
|
||||
<asp:DropDownList runat="server" ID="DdlEstatus" CssClass="select2me" Width="100%">
|
||||
<asp:ListItem Text="Todos" Value="-1"></asp:ListItem>
|
||||
<%--<asp:ListItem Text="Registrado" Value="0" ></asp:ListItem> --%>
|
||||
<asp:ListItem Text="Pendiente" Value="1" Selected="True"></asp:ListItem>
|
||||
<asp:ListItem Text="Enviado" Value="2"></asp:ListItem>
|
||||
</asp:DropDownList>
|
||||
</div>
|
||||
<div class="col-md-1 truncate" runat="server" id="DVAgrupador1" visible="false">Agrupador:</div>
|
||||
<div class="col-md-1 " runat="server" id="DVAgrupador2" visible="false">
|
||||
<asp:DropDownList runat="server" ID="DdlAgrupador" CssClass="select2me" Width="100%">
|
||||
<asp:ListItem Text="Comercializador" Value="1" Selected="True"></asp:ListItem>
|
||||
<asp:ListItem Text="Cliente" Value="2"></asp:ListItem>
|
||||
</asp:DropDownList>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="portlet-body" style="display: none;">
|
||||
<div class="row">
|
||||
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</ContentTemplate>
|
||||
</asp:UpdatePanel>
|
||||
|
||||
|
||||
<div class="row">
|
||||
<div class="col-md-12">
|
||||
|
||||
<asp:UpdatePanel ID="UpLineasAdicionales" runat="server" RenderMode="Inline" UpdateMode="Conditional">
|
||||
<ContentTemplate>
|
||||
|
||||
<div class="row " runat="server" visible ="false" id="DvLinea">
|
||||
<div class=" col-md-12" style="text-align: right!important">
|
||||
<input type="text" id="TxtBuscarLineaAdicional" class="form-control input-sm" onkeyup="<%= String.Format("FiltrarTabla('TxtBuscarLineaAdicional','{0}')", GvLineasAdicionales.ClientID) %>" style="display: inline-block; margin-right: -20px; width: 150px;" />
|
||||
<a href="javascript:;" onclick="<%= String.Format("FiltrarTabla('TxtBuscarLineaAdicional','{0}')", GvLineasAdicionales.ClientID) %>" style="margin-top: -3px;" class="btn btn-circle btn-sm label-info"><i class="icon-magnifier"></i></a>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row " runat="server" visible ="false" id="DvLineaPO">
|
||||
<div class=" col-md-12" style="text-align: right!important">
|
||||
<input type="text" id="TxtBuscarLineaAdicionalpo" class="form-control input-sm" onkeyup="<%= String.Format("FiltrarTabla('TxtBuscarLineaAdicional','{0}')", GvLAPO.ClientID) %>" style="display: inline-block; margin-right: -20px; width: 150px;" />
|
||||
<a href="javascript:;" onclick="<%= String.Format("FiltrarTabla('TxtBuscarLineaAdicional','{0}')", GvLAPO.ClientID) %>" style="margin-top: -3px;" class="btn btn-circle btn-sm label-info"><i class="icon-magnifier"></i></a>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<div class="row ">
|
||||
<div class="col-md-12">
|
||||
|
||||
<asp:GridView ID="GvLineasAdicionales" Width="100%" runat="server" GridLines="None" Visible="false"
|
||||
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"
|
||||
AutoGenerateColumns="False" AllowPaging="False" ShowFooter="False">
|
||||
<Columns>
|
||||
<asp:BoundField DataField="LineaAdicional" HeaderText="Linea Adicional" />
|
||||
<asp:BoundField DataField="NombreCliente" HeaderText="Cliente" />
|
||||
<asp:BoundField DataField="Proveedor" HeaderText="Comercializador" />
|
||||
<asp:BoundField DataField="Importe" HeaderText="Importe" DataFormatString="{0:n}" ItemStyle-HorizontalAlign="Right" />
|
||||
<asp:BoundField DataField="Abreviatura" HeaderText="Moneda" />
|
||||
<asp:HyperLinkField DataTextField="SerieFolio" DataNavigateUrlFields="CveVenta" DataNavigateUrlFormatString="/Ventas/Ventas.aspx?CveVenta={0}" HeaderText="Serie Folio" />
|
||||
<asp:BoundField DataField="Saldo" HeaderText="Saldo" DataFormatString="{0:n}" ItemStyle-HorizontalAlign="Right" />
|
||||
<asp:BoundField DataField="DiasVencimiento" HeaderText="Dias de Venc." />
|
||||
<asp:BoundField DataField="Estatus" HeaderText="Estatus" />
|
||||
</Columns>
|
||||
</asp:GridView>
|
||||
|
||||
<asp:GridView ID="GvLAPO" Width="100%" runat="server" GridLines="None" Visible="false"
|
||||
DataKeyNames="CveLineaAdicional,TipoLinea,Importe,CveMoneda,FechaVencimiento,CveLineaAdicionalEstatus,LineaAdicionalComprobante,CveVenta,CveCliente,CveProveedor"
|
||||
CssClass="table table-striped table-advance table-hover ScrollAD input-sm mysmallbtn" ShowHeader="True" EmptyDataText="No se encontraron resultados." ShowHeaderWhenEmpty="true"
|
||||
AutoGenerateColumns="False" AllowPaging="False" ShowFooter="False"
|
||||
OnRowCommand="GvLAPO_RowCommand"
|
||||
OnRowDataBound="GvLAPO_RowDataBound">
|
||||
<Columns>
|
||||
<asp:BoundField DataField ="Agrupador" HeaderText="Agrupador" />
|
||||
<asp:BoundField DataField="LineaAdicional" HeaderText="PO" />
|
||||
<asp:BoundField DataField="Importe" HeaderText="Importe PO" DataFormatString="{0:n}" ItemStyle-HorizontalAlign="Right" />
|
||||
<asp:BoundField DataField="Abreviatura" HeaderText="Mon" />
|
||||
<asp:HyperLinkField DataTextField="SerieFolio" DataNavigateUrlFields="CveVenta" DataNavigateUrlFormatString="/Ventas/Ventas.aspx?CveVenta={0}" HeaderText="Serie Folio" />
|
||||
<asp:BoundField DataField="Saldo" HeaderText="Saldo" DataFormatString="{0:n}" ItemStyle-HorizontalAlign="Right" />
|
||||
<asp:BoundField DataField="DiasVencimiento" HeaderText="D.Plazo" ItemStyle-HorizontalAlign="Right" />
|
||||
<asp:BoundField DataField="DiasTranscurridos" HeaderText="D.Trans" ItemStyle-HorizontalAlign="Right" />
|
||||
<asp:BoundField DataField="FechaVenta" HeaderText="F. Venta" DataFormatString="{0:dd/MM/yyyy}" ItemStyle-HorizontalAlign="Center" />
|
||||
<asp:BoundField DataField="FechaVencimientoVenta" HeaderText="F. Venc. Venta" DataFormatString="{0:dd/MM/yyyy}" ItemStyle-HorizontalAlign="Center" />
|
||||
<asp:BoundField DataField="Estatus" HeaderText="Estatus" />
|
||||
<asp:BoundField DataField="FechaEnvio" HeaderText="F. Envío" DataFormatString="{0:dd/MM/yyyy}" ItemStyle-HorizontalAlign="Center" />
|
||||
<asp:TemplateField HeaderText="Opciones" ItemStyle-Width="75px" HeaderStyle-Width="75px">
|
||||
<ItemTemplate>
|
||||
<div class="row" >
|
||||
<div class="col-md-4" style="max-width:26px!important">
|
||||
<asp:LinkButton ID="LnkCargarComprobante" Visible="false" runat="server" AlternateText="Editar" CausesValidation="False"
|
||||
CssClass="btn btn-circle btn-sm green" Text="<i class='fa fa-upload'></i>" OnClick="LnkCargarComprobante_Click"
|
||||
ToolTip="Cargar Comprobante" />
|
||||
<asp:LinkButton ID="LnkDescargaComprobante" Visible="false" runat="server" AlternateText="Descarga" CausesValidation="False"
|
||||
CssClass="btn btn-circle btn-sm yellow" Text="<i class='fa fa-download'></i>" OnClick="LnkDescargaComprobante_Click"
|
||||
ToolTip="Descargar Comprobante" />
|
||||
</div>
|
||||
<div class="col-md-4" style="max-width:26px!important" title="Cambiar estatus a Enviado">
|
||||
<asp:LinkButton ID="LnkCambiarEstatus" runat="server" Visible="false" AlternateText="CambiarEstatus"
|
||||
CommandName="Estatus" CommandArgument='<%# Eval("CveLineaAdicionalEstatus") %>' CausesValidation="False"
|
||||
CssClass="btn btn-circle btn-sm blue" Text="<i class='fa fa-arrow-right'></i>"
|
||||
data-toggle="confirmation" data-popout="true" data-original-title="¿Cambiar Estado?" data-btn-ok-label="si"
|
||||
ToolTip="Cambiar estatus a Enviado" />
|
||||
</div>
|
||||
</div>
|
||||
</ItemTemplate>
|
||||
</asp:TemplateField>
|
||||
|
||||
|
||||
</Columns>
|
||||
</asp:GridView>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
</ContentTemplate>
|
||||
</asp:UpdatePanel>
|
||||
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
|
||||
<%-- MODAL COMPROBANTE --%>
|
||||
<div id="ModalComprobante" class="modal ADS fade" role="dialog">
|
||||
<div class="modal-dialog">
|
||||
|
||||
<!-- Modal content-->
|
||||
<div class="modal-content" style="width: 700px;">
|
||||
<div class="modal-header ">
|
||||
<button type="button" class="close" data-dismiss="modal">×</button>
|
||||
<h4 class="modal-title">Agregar Comprbante</h4>
|
||||
</div>
|
||||
|
||||
<div class="modal-body">
|
||||
<asp:UpdatePanel runat="server" ID="UpAddComprobancte" UpdateMode="Conditional">
|
||||
<ContentTemplate>
|
||||
<div class="row">
|
||||
<div class="col-md-12">
|
||||
<div>
|
||||
<asp:TextBox ID="Anexo" CssClass="ADSdropzone hidden" data-maxFile="1" Text="" runat="server"></asp:TextBox>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</ContentTemplate>
|
||||
</asp:UpdatePanel>
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<asp:UpdatePanel runat="server">
|
||||
<ContentTemplate>
|
||||
<asp:Button ID="BtnAddComprobante" runat="server" ClientIDMode="Static" Text="Guardar" CssClass="btn btn-primary" OnClick="BtnAddComprobante_Click" />
|
||||
<button type="button" class="btn btn-danger" data-dismiss="modal">Cancelar</button>
|
||||
|
||||
</ContentTemplate>
|
||||
</asp:UpdatePanel>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<%-- FIN MODAL COMPROBANTE --%>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</asp:Content>
|
||||
<asp:Content ID="Content8" ContentPlaceHolderID="JS" Runat="Server">
|
||||
|
||||
|
||||
|
||||
</asp:Content>
|
||||
|
||||
409
Ventas/RepVencimientosCredito.aspx.cs
Normal file
409
Ventas/RepVencimientosCredito.aspx.cs
Normal file
@@ -0,0 +1,409 @@
|
||||
using System;
|
||||
using System.Web.UI.WebControls;
|
||||
using Extensiones;
|
||||
using System.Data;
|
||||
using static Extensiones.ModExtensiones;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Web.UI;
|
||||
|
||||
|
||||
public partial class Ventas_RepVencimientosCredito : ClsPaginas
|
||||
{
|
||||
#region PROPIEDADES
|
||||
|
||||
|
||||
private int CveLineaAdicional
|
||||
{
|
||||
get { return (ViewState["CveLineaAdicional"] == null) ? 0 : int.Parse(ViewState["CveLineaAdicional"].ToString()); }
|
||||
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
|
||||
{
|
||||
get { return (ViewState["TipoLinea"] == null) ? 1: int.Parse(ViewState["TipoLinea"].ToString()); }
|
||||
set { ViewState["TipoLinea"] = (int)value; }
|
||||
}
|
||||
|
||||
private DataTable DTDatosGvLineasAdicionales
|
||||
{
|
||||
get
|
||||
{
|
||||
if (ViewState["DTDatosGvLineasAdicionales"] == null)
|
||||
{
|
||||
ViewState["DTDatosGvLineasAdicionales"] = new DataTable();
|
||||
}
|
||||
return (DataTable)ViewState["DTDatosGvLineasAdicionales"];
|
||||
}
|
||||
set { ViewState["DTDatosGvLineasAdicionales"] = (DataTable)value; }
|
||||
}
|
||||
|
||||
private string LineaAdicionalComprobante
|
||||
{
|
||||
get {
|
||||
|
||||
if(ViewState["LineaAdicionalComprobante"] == null)
|
||||
{
|
||||
ViewState["LineaAdicionalComprobante"] = "";
|
||||
}
|
||||
|
||||
return ViewState["LineaAdicionalComprobante"].ToString();
|
||||
}
|
||||
set { ViewState["LineaAdicionalComprobante"] = value; }
|
||||
}
|
||||
|
||||
#endregion
|
||||
protected void Page_Load(object sender, EventArgs e)
|
||||
{
|
||||
if (!IsPostBack)
|
||||
{
|
||||
InicializaValores();
|
||||
CargaDatos();
|
||||
}
|
||||
}
|
||||
|
||||
private void InicializaValores()
|
||||
{
|
||||
|
||||
if (Request["OP"] != null && Request["OP"].ToString() == "PO")
|
||||
{
|
||||
DVProveedor1.Visible = true;
|
||||
DVProveedor2.Visible = true;
|
||||
TipoLinea = 2;
|
||||
LtlEncabezado.Text = "Reporte PO";
|
||||
GvLAPO.Visible = true;
|
||||
DvLineaPO.Visible = true;
|
||||
DVAgrupador1.Visible = true;
|
||||
DVAgrupador2.Visible = true;
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
DvLinea.Visible = true;
|
||||
GvLineasAdicionales.Visible = true;
|
||||
}
|
||||
|
||||
|
||||
if(UsuarioActual.Empresa.Funcionalidad(105) == "1") {
|
||||
DdlProveedor.setEsWebService(true);
|
||||
DdlProveedor.Attributes.Add("data-metodo", "getproveedores");
|
||||
DdlProveedor.SelectedText = "Todos";
|
||||
DdlProveedor.SelectedValue = "-1";
|
||||
}else {
|
||||
DdlProveedor.setEsWebService(false);
|
||||
DdlProveedor.ddl.DataSource = get_GlobalDTCompProveedores(UsuarioActual.CveEmpresa);
|
||||
DdlProveedor.ddl.DataBind();
|
||||
DdlProveedor.ddl.Items.Insert(0, new ListItem("-", "-1"));
|
||||
}
|
||||
|
||||
DdlClientes.setEsWebService(true);
|
||||
DdlClientes.Attributes.Add("data-metodo", "getcliente");
|
||||
DdlClientes.SelectedText = "Todos";
|
||||
DdlClientes.SelectedValue = "-1";
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
protected void BtnConsultar_Click(object sender, EventArgs e)
|
||||
{
|
||||
CargaDatos();
|
||||
}
|
||||
|
||||
private void CargaDatos()
|
||||
{
|
||||
DTDatosGvLineasAdicionales = new DataTable();
|
||||
LnkDescargaExcel.Visible = false;
|
||||
|
||||
ClsVentas objVentas = new ClsVentas();
|
||||
|
||||
int CveProveedor = DdlProveedor.SelectedValue.ToEntero() > 0 ? DdlProveedor.SelectedValue.ToEntero() : -1;
|
||||
|
||||
if(TipoLinea == 1)
|
||||
{
|
||||
if (objVentas.RepLineasAdicionales(-1,-1, DdlClientes.SelectedValue.ToEntero(), CveProveedor, 1, -1, MinFecha, MaxFecha, DdlEstatus.SelectedValue.ToEntero(), UsuarioActual.CveEmpresa))
|
||||
{
|
||||
GvLineasAdicionales.DataSource = objVentas.DtResultados;
|
||||
|
||||
if (objVentas.DtResultados.Rows.Count > 0)
|
||||
{
|
||||
DTDatosGvLineasAdicionales = objVentas.DtResultados;
|
||||
LnkDescargaExcel.Visible = true;
|
||||
UpAcciones.Update();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
GvLineasAdicionales.DataSource = null;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
if (DdlAgrupador.SelectedValue.ToEntero()== 1){
|
||||
GvLAPO.Columns[0].HeaderText = "Comercializador";
|
||||
}
|
||||
else
|
||||
{
|
||||
GvLAPO.Columns[0].HeaderText = "Cliente";
|
||||
}
|
||||
|
||||
if (objVentas.RepLineasAdicionales(DdlAgrupador.SelectedValue.ToEntero(), -1, DdlClientes.SelectedValue.ToEntero(), CveProveedor, 2, -1, MinFecha, MaxFecha, DdlEstatus.SelectedValue.ToEntero(), UsuarioActual.CveEmpresa))
|
||||
{
|
||||
GvLAPO.DataSource = objVentas.DtResultados;
|
||||
|
||||
if (objVentas.DtResultados.Rows.Count > 0)
|
||||
{
|
||||
DTDatosGvLineasAdicionales = objVentas.DtResultados;
|
||||
LnkDescargaExcel.Visible = true;
|
||||
UpAcciones.Update();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
GvLAPO.DataSource = null;
|
||||
}
|
||||
}
|
||||
|
||||
objVentas.Dispose();
|
||||
GvLineasAdicionales.DataBind();
|
||||
GvLAPO.DataBind();
|
||||
UpLineasAdicionales.Update();
|
||||
}
|
||||
|
||||
|
||||
protected void LnkCargarComprobante_Click(object sender, EventArgs e)
|
||||
{
|
||||
GridViewRow GvRow = (GridViewRow) ((LinkButton) sender).NamingContainer;
|
||||
|
||||
CveLineaAdicional = GvRow.DataKey("CveLineaAdicional").ToString().ToEntero();
|
||||
CveVenta = GvRow.DataKey("CveVenta").ToString().ToEntero();
|
||||
LineaAdicionalComprobante = GvRow.DataKey("LineaAdicionalComprobante").ToString();
|
||||
|
||||
RegistraScript("$('#ModalComprobante').modal('show');","");
|
||||
}
|
||||
|
||||
protected void BtnAddComprobante_Click(object sender, EventArgs e)
|
||||
{
|
||||
bool errorCargaComprobante = false;
|
||||
string FileExtension = "-1";
|
||||
List<Archivo> filesgral = Anexo.getfiles().Archivos;
|
||||
string filemove = "";
|
||||
FileInfo fiNuevo;
|
||||
|
||||
DirectoryInfo df = new DirectoryInfo($@"{UsuarioActual.Empresa.Ruta}\LineasAdicionales\");
|
||||
|
||||
//Crea directorio si no existe
|
||||
if (!df.Exists)
|
||||
{
|
||||
try
|
||||
{
|
||||
Directory.CreateDirectory(df.FullName);
|
||||
}
|
||||
catch
|
||||
{
|
||||
errorCargaComprobante = true;
|
||||
}
|
||||
}
|
||||
|
||||
//borrar archivo anterior
|
||||
if((!errorCargaComprobante) && LineaAdicionalComprobante.Length > 0)
|
||||
{
|
||||
FileInfo fiAnterior = new FileInfo($@"{df.FullName}{LineaAdicionalComprobante}");
|
||||
if (fiAnterior.Exists)
|
||||
{
|
||||
try
|
||||
{
|
||||
File.Delete(fiAnterior.FullName);
|
||||
}
|
||||
catch
|
||||
{
|
||||
errorCargaComprobante = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(!errorCargaComprobante){
|
||||
|
||||
string RutaArchivoTemp = "";
|
||||
foreach (Archivo fileItem in filesgral)
|
||||
{
|
||||
FileExtension = System.IO.Path.GetExtension(string.Format(@"{0}Temp\{1}", AppDomain.CurrentDomain.BaseDirectory, fileItem.filename)).Replace(".", "");
|
||||
filemove = fileItem.filename;
|
||||
RutaArchivoTemp = $@"{AppDomain.CurrentDomain.BaseDirectory}\Temp\{fileItem.filename}";
|
||||
break;
|
||||
}
|
||||
|
||||
if((!errorCargaComprobante) && RutaArchivoTemp.Length > 0)
|
||||
{
|
||||
fiNuevo = new FileInfo(RutaArchivoTemp);
|
||||
|
||||
if (fiNuevo.Exists)
|
||||
{
|
||||
try
|
||||
{
|
||||
if (File.Exists($@"{df.FullName}\{CveVenta}{fiNuevo.Extension}"))
|
||||
{
|
||||
File.Delete($@"{df.FullName}\{CveVenta}{fiNuevo.Extension}");
|
||||
}
|
||||
File.Move(fiNuevo.FullName, $@"{df.FullName}\{CveVenta}{fiNuevo.Extension}");
|
||||
errorCargaComprobante = false;
|
||||
}
|
||||
catch
|
||||
{
|
||||
errorCargaComprobante = true;
|
||||
}
|
||||
if (!errorCargaComprobante)
|
||||
{
|
||||
ClsVentas objVentas = new ClsVentas();
|
||||
if (!objVentas.UpdateVentaLineaAdicional(CveLineaAdicional, CveVenta, $@"{CveVenta}{fiNuevo.Extension}", -1, UsuarioActual.CveEmpresa))
|
||||
{
|
||||
errorCargaComprobante = true;
|
||||
}
|
||||
objVentas.Dispose();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!errorCargaComprobante)
|
||||
{
|
||||
CargaDatos();
|
||||
Anexo.Text = "[]";
|
||||
RegistraScript("$('#ModalComprobante').modal('hide');", "");
|
||||
Alert("Comprobante actualizado correctamente.");
|
||||
}
|
||||
UpAddComprobancte.Update();
|
||||
}
|
||||
|
||||
protected void LnkCambiarEstatus_Click(object sender, EventArgs e)
|
||||
{
|
||||
GridViewRow GvRow = (GridViewRow)((LinkButton)sender).NamingContainer;
|
||||
int CveLineaAdicionalActualzarEstatus = GvRow.DataKey("CveLineaAdicional").ToEntero();
|
||||
int CveVenta = GvRow.DataKey("CveVenta").ToEntero();
|
||||
bool errorCambioEstatus = false;
|
||||
ClsVentas objVentas = new ClsVentas();
|
||||
if (!objVentas.UpdateVentaLineaAdicional(CveLineaAdicional, CveVenta, "", 2, UsuarioActual.CveEmpresa))
|
||||
{
|
||||
errorCambioEstatus = true;
|
||||
}
|
||||
if (!errorCambioEstatus)
|
||||
{
|
||||
CargaDatos();
|
||||
}
|
||||
objVentas.Dispose();
|
||||
}
|
||||
|
||||
protected void LnkDescargaExcel_Click(object sender, EventArgs e)
|
||||
{
|
||||
if(TipoLinea == 1)
|
||||
{
|
||||
GridView gvTemp = GvLineasAdicionales;
|
||||
//gvTemp.ExportToExcelX("RepLineasAdicionales" + NowADS().ToShortDateString());
|
||||
gvTemp.ExportToExcelGembox("RepLineasAdicionales", UsuarioActual, "Rep Lineas Adicionales", AnchoImagen: 150);
|
||||
}
|
||||
else if(TipoLinea == 2)
|
||||
{
|
||||
GridView gvTemp = GvLAPO;
|
||||
gvTemp.Columns[12].Visible = false;
|
||||
//gvTemp.ExportToExcelX("ReportePO" + NowADS().ToShortDateString());
|
||||
gvTemp.ExportToExcelGembox( "ReportePO", UsuarioActual, "Reporte PO ", AnchoImagen:150);
|
||||
}
|
||||
}
|
||||
|
||||
protected void GvLAPO_RowDataBound(object sender, GridViewRowEventArgs e)
|
||||
{
|
||||
if (e.Row.RowType == DataControlRowType.DataRow)
|
||||
{
|
||||
|
||||
LinkButton LnkCambiarEstatus = e.Row.FCLinkButton("LnkCambiarEstatus");
|
||||
LinkButton LnkCargarComprobante = e.Row.FCLinkButton("LnkCargarComprobante");
|
||||
LinkButton LnkDescargaComprobante = e.Row.FCLinkButton("LnkDescargaComprobante");
|
||||
|
||||
if (e.Row.DataKey("CveLineaAdicional")=="")
|
||||
{
|
||||
if (e.Row.DataKey("CveLineaAdicional") == "" && e.Row.DataKey("CveCliente") == "")
|
||||
{
|
||||
e.Row.CssClass = "SubTotales2";
|
||||
if (e.Row.DataKey("CveLineaAdicional") == "" && e.Row.DataKey("CveCliente") == "" && e.Row.DataKey("CveProveedor") != "")
|
||||
{
|
||||
e.Row.Cells[0].Text = "<a href='/Compras/Proveedores.aspx?CveProveedor="+ e.Row.DBCampo("CveProveedor") + "' >"+ e.Row.DBCampo("Proveedor") +"</a>";
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
e.Row.CssClass = "SubTotales";
|
||||
}
|
||||
LnkCambiarEstatus.Visible = false;
|
||||
LnkCargarComprobante.Visible = false;
|
||||
LnkDescargaComprobante.Visible = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (e.Row.DataKey("CveVenta").ToEntero() > 0 && e.Row.DataKey("CveLineaAdicionalEstatus").ToEntero() == 1)
|
||||
{
|
||||
|
||||
if (UsuarioActual.TienePermisoProceso(356)) LnkCambiarEstatus.Visible = true;
|
||||
LnkCargarComprobante.Visible = true;
|
||||
}
|
||||
|
||||
if (e.Row.DataKey("LineaAdicionalComprobante").Length > 0 && e.Row.DataKey("CveVenta").ToEntero() > 0)
|
||||
{
|
||||
FileInfo fi = new FileInfo($@"{UsuarioActual.Empresa.Ruta}\LineasAdicionales\{e.Row.DataKey("LineaAdicionalComprobante")}");
|
||||
|
||||
if (fi.Exists)
|
||||
{
|
||||
LnkDescargaComprobante.Visible = true;
|
||||
ScriptManager.GetCurrent(this).RegisterPostBackControl(LnkDescargaComprobante);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
protected void LnkDescargaComprobante_Click(object sender, EventArgs e)
|
||||
{
|
||||
GridViewRow GvRow = (GridViewRow)((LinkButton)sender).NamingContainer;
|
||||
string Comprobante = GvRow.DataKey("LineaAdicionalComprobante");
|
||||
FileInfo fi = new FileInfo($@"{UsuarioActual.Empresa.Ruta}\LineasAdicionales\{Comprobante}");
|
||||
|
||||
if (fi.Exists)
|
||||
{
|
||||
Response.Clear();
|
||||
Response.AddHeader("Content-Disposition", "attachment; filename=" + fi.Name);
|
||||
Response.AddHeader("Content-Length", fi.Length.ToString());
|
||||
Response.ContentType = "text/octet-stream";
|
||||
Response.Flush();
|
||||
Response.TransmitFile(fi.FullName);
|
||||
Response.End();
|
||||
}
|
||||
}
|
||||
|
||||
protected void GvLAPO_RowCommand(object sender, GridViewCommandEventArgs e)
|
||||
{
|
||||
if (e.CommandName == "Estatus")
|
||||
{
|
||||
GridViewRow GvRow = (GridViewRow)((LinkButton)e.CommandSource).NamingContainer;
|
||||
int CveLineaAdicionalActualizarEstatus = GvRow.DataKey("CveLineaAdicional").ToString().ToEntero();
|
||||
int CveVenta = GvRow.DataKey("CveVenta").ToString().ToEntero();
|
||||
|
||||
bool errorCambioEstatus = false;
|
||||
//int cveestatus = e.CommandArgument.ToEntero() + 2; //pasar al siguiente estatus
|
||||
|
||||
ClsVentas objVentas = new ClsVentas();
|
||||
if (!objVentas.UpdateVentaLineaAdicional(CveLineaAdicionalActualizarEstatus, CveVenta,"", 2, UsuarioActual.CveEmpresa))
|
||||
{
|
||||
errorCambioEstatus = true;
|
||||
}
|
||||
objVentas.Dispose();
|
||||
if (!errorCambioEstatus)
|
||||
{
|
||||
CargaDatos();
|
||||
}
|
||||
Reference in New Issue
Block a user