- limpieza de módulo

This commit is contained in:
2023-02-01 10:56:11 -07:00
parent b1330fe410
commit 1c2d564f8f
2 changed files with 0 additions and 774 deletions

View File

@@ -1,279 +0,0 @@
<%@ Page Title="Ventas - eFacturas" Language="VB" MasterPageFile="~/Site.master" AutoEventWireup="false" CodeFile="eFacturas.aspx.vb" Inherits="Ventas_eFacturas" %>
<asp:Content ID="Content1" ContentPlaceHolderID="CP" runat="Server">
<link href="/Metronic/assets/global/plugins/datatables/plugins/bootstrap/dataTables.bootstrap.css" rel="stylesheet" />
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="Css" runat="Server">
<style>
.dataTables_scrollBody table th {
padding:0px !important;
padding-right:4px !important;
padding-left:4px !important;
}
.table-scrollable{
margin:0px !important;
}
.dataTables_scrollFoot{
display: none;
}
.dataTables_scroll{
margin-bottom: 0px;
}
.table.dataTable{
margin-top: 0px !important
}
.table table-striped table-hover dataTable no-footer{
margin-top:0px !important;
}
</style>
</asp:Content>
<asp:Content ID="Content4" ContentPlaceHolderID="E" runat="Server">
Reporte de Facturas de Ventas
</asp:Content>
<asp:Content ID="Content5" ContentPlaceHolderID="H" runat="Server">
<li>
<asp:LinkButton ID="LnkPdf" runat="server"><i class="fa fa-ad-pdf"></i> Genera PDF</asp:LinkButton>
</li>
<li>
<asp:LinkButton ID="LnkExportar" runat="server"><i class="fa fa-ad-excel"></i> Genera Excel</asp:LinkButton>
</li>
<li>
<asp:UpdatePanel ID="UpdatePanel3" runat="server" UpdateMode="Conditional">
<ContentTemplate>
<asp:LinkButton ID="lbDescargar" runat="server"><%--<img src="/Metronic/assets/global/img/portlet-reload-icon.png" />--%><i class="fa fa-download"></i>
Descarga Facturas SAT</asp:LinkButton>
</ContentTemplate>
</asp:UpdatePanel>
</li>
</asp:Content>
<asp:Content ID="Content6" ContentPlaceHolderID="C" runat="Server">
<asp:UpdatePanel ID="UpdatePanel1" runat="server" UpdateMode="Conditional">
<ContentTemplate>
<div class="portlet solid grey-cascade portlet-filter" style="">
<div class="portlet-title portlet-filterT" style="">
<div class="titlefiltros caption ">
<ul class="list-inline text-size-12">
<li>Folio:
<asp:TextBox ID="TxtFolio" runat="server" MaxLength="50" Width="70px"></asp:TextBox>
</li>
<li>Receptor:
<asp:TextBox ID="TxtReceptor" runat="server" MaxLength="50" Width="110px"></asp:TextBox>
</li>
<li>Fecha I.:
<div class="input-group input-sm date date-picker " data-date-format="dd/mm/yyyy" style="display: inline-block;">
<asp:TextBox ID="txtFechaI" runat="server" CssClass="form-control input-sm" CausesValidation="true" MaxLength="10" Width="82px "></asp:TextBox>
<span class="input-group-btn ">
<asp:LinkButton ID="imgCalendario" class="btn default " Text="<i class='fa fa-calendar'></i>" runat="server"></asp:LinkButton>
</span>
</div>
<ajax:MaskedEditExtender ID="MEEFechaI" runat="server" TargetControlID="txtFechaI" Mask="99/99/9999" MaskType="Date" DisplayMoney="Left" AcceptNegative="Left"></ajax:MaskedEditExtender>
<ajax:CalendarExtender runat="server" ID="Calendario" TargetControlID="txtFechaI" PopupButtonID="ImgCalendario" PopupPosition="BottomRight" Enabled="True"></ajax:CalendarExtender>
<asp:RequiredFieldValidator ID="rfvFechaI" runat="server" ControlToValidate="txtFechaI" Display="None" ErrorMessage="El campo <b>''Fecha Inicial''</b> es requerido por la aplicación, por favor ingrese una fecha." ValidationGroup="Valida"></asp:RequiredFieldValidator>
<asp:CompareValidator ID="cvFechaI" runat="server" ControlToValidate="txtFechaI" Display="None" ErrorMessage="El campo <b>''Fecha Inicial''</b> no tienes el formato correcto, por favor intente de nuevo con el siguiente formato: (dd/mm/yyyy)." Operator="DataTypeCheck" Type="Date" ValidationGroup="Valida"></asp:CompareValidator>
<ajax:ValidatorCalloutExtender ID="vcoFfvFI" runat="server" HighlightCssClass="vco" TargetControlID="rfvFechaI" Width="350px"></ajax:ValidatorCalloutExtender>
<ajax:ValidatorCalloutExtender ID="vcoCvFI" runat="server" HighlightCssClass="vco" TargetControlID="cvFechaI" Width="350px"></ajax:ValidatorCalloutExtender>
</li>
<li>Fecha F.:
<div class="input-group input-sm date date-picker " data-date-format="dd/mm/yyyy" style="display: inline-block;">
<asp:TextBox ID="txtFechaF" runat="server" CssClass="form-control input-sm" CausesValidation="true" MaxLength="10" Width="82px "></asp:TextBox>
<span class="input-group-btn ">
<asp:LinkButton ID="imgCalendarioF" class="btn default " Text="<i class='fa fa-calendar'></i>" runat="server"></asp:LinkButton>
</span>
</div>
<ajax:MaskedEditExtender ID="MEEFechaF" runat="server" TargetControlID="txtFechaF" Mask="99/99/9999" MaskType="Date" DisplayMoney="Left" AcceptNegative="Left"></ajax:MaskedEditExtender>
<ajax:CalendarExtender runat="server" ID="Calendario2" TargetControlID="txtFechaF" PopupButtonID="imgCalendarioF" PopupPosition="BottomRight" Enabled="True"></ajax:CalendarExtender>
<asp:RequiredFieldValidator ID="rfvFechaF" runat="server" ControlToValidate="txtFechaF" Display="None" ErrorMessage="El campo <b>''Fecha Final''</b> es requerido por la aplicación, por favor ingrese una fecha." ValidationGroup="Valida"></asp:RequiredFieldValidator>
<asp:CompareValidator ID="cvFechaF" runat="server" ControlToValidate="txtFechaF" Display="None" ErrorMessage="El campo <b>''Fecha Final''</b> no tienes el formato correcto, por favor intente de nuevo con el siguiente formato: (dd/mm/yyyy)." Operator="DataTypeCheck" Type="Date" ValidationGroup="Valida"></asp:CompareValidator>
<ajax:ValidatorCalloutExtender ID="vcoRfvFF" runat="server" HighlightCssClass="vco" TargetControlID="rfvFechaF" Width="350px"></ajax:ValidatorCalloutExtender>
<ajax:ValidatorCalloutExtender ID="vcoCvFF" runat="server" HighlightCssClass="vco" TargetControlID="cvFechaF" Width="350px"></ajax:ValidatorCalloutExtender>
</li>
</ul>
</div>
<div class="tools">
<asp:Button ID="BtnConsultar" runat="server" Text="Consultar" class="btn btn-primary" />
<a href="javascript:;" class="expand"></a>
</div>
</div>
<div class="portlet-body" style="display: none;">
<ul class="list-inline">
<li>Responsable:
<asp:DropDownList ID="DdlResponsable" runat="server" DataTextField="Nombre" DataValueField="CveUsuario" MaxLength="50" Class="table-group-action-input form-control input-inline input-small input-sm"></asp:DropDownList>
</li>
</ul>
</div>
</div>
</ContentTemplate>
</asp:UpdatePanel>
<asp:UpdatePanel ID="UPRegistros" runat="server" UpdateMode="Conditional">
<ContentTemplate>
<table cellpadding="0" border="0" width="100%">
<tr>
<th style="text-align: left;">
<asp:Label ID="LblRegistros" runat="server" Text="" Font-Bold="True"></asp:Label></th>
<th style="text-align: right">
<asp:LinkButton ID="LnkNoRecibias" CssClass="Texto" runat="server">No Recibidas</asp:LinkButton></th>
</tr>
</table>
</ContentTemplate>
</asp:UpdatePanel>
<asp:UpdatePanel ID="UpDatos" runat="server" UpdateMode="Conditional">
<ContentTemplate>
<%-- <div class="Widthall " style="min-width: 1082px;">
<div class="table-VH">
<div id="gv-container" class="table-VH-container">--%>
<asp:GridView ID="GvD" ClientIDMode="Static" runat="server" Width="100%" AutoGenerateColumns="False" DataKeyNames="CveFactura,UUID,RFCDe,RFCPara,TipoFactura,FueValidado"
EmptyDataText="No se encontraron Registros con el filtro actual" CssClass="table table-striped table-hover Widthall" GridLines="None">
<Columns>
<asp:TemplateField HeaderText="Folio">
<ItemTemplate>
<asp:Literal ID="LtlFolio" runat="server" Text='<%# Eval("SerieFolio") %>'></asp:Literal>
</ItemTemplate>
<ItemStyle HorizontalAlign="Left" />
</asp:TemplateField>
<asp:TemplateField HeaderText="Fecha Fact">
<ItemTemplate>
<asp:Literal ID="LtlFechaFactura" runat="server" Text='<%# Eval("FechaFactura", "{0:d}") %>'></asp:Literal>
</ItemTemplate>
<ItemStyle HorizontalAlign="Center" />
</asp:TemplateField>
<asp:TemplateField HeaderText="Receptor">
<ItemTemplate>
<asp:HyperLink ID="HplProveedor" runat="server" CssClass="Texto" Target="_newtab" Text='<%# Eval("NombreReceptor") %>'></asp:HyperLink>
</ItemTemplate>
<ItemStyle HorizontalAlign="Left" />
</asp:TemplateField>
<asp:TemplateField HeaderText="Importe">
<ItemTemplate>
<asp:Literal ID="LtlTotal" runat="server" Text='<%# Eval("Total", "{0:N2}") %>'></asp:Literal>
</ItemTemplate>
<ItemStyle HorizontalAlign="Right" />
</asp:TemplateField>
<asp:TemplateField HeaderText="XML">
<ItemTemplate>
<asp:Literal ID="LtlXML" runat="server"></asp:Literal>
</ItemTemplate>
<ItemStyle HorizontalAlign="Center" />
</asp:TemplateField>
<asp:TemplateField HeaderText="PDF">
<ItemTemplate>
<asp:Literal ID="LtlPDF" runat="server"></asp:Literal>
</ItemTemplate>
<ItemStyle HorizontalAlign="Center" />
</asp:TemplateField>
<asp:TemplateField HeaderText="Prov">
<ItemTemplate>
<%--<asp:Literal ID="LtlProv" runat="server"></asp:Literal>--%>
<asp:HyperLink ID="HplProv" runat="server" Visible='False' CssClass="btn btn-circle btn-sm blue" ToolTip="Agregar Proveedor" Target="_blank"><i class="fa fa-pencil"></i></asp:HyperLink>
</ItemTemplate>
<ItemStyle HorizontalAlign="Center" />
</asp:TemplateField>
<asp:TemplateField HeaderText="Estatus SAT">
<ItemTemplate>
<asp:Literal ID="LtlValidado" runat="server" Text="Validada" Visible="false"></asp:Literal>
<asp:LinkButton ID="ImgValidarCFDi" runat="server" CssClass="btn btn-xs btn-success" Text="Validar" Visible="false" CommandName="ValidarCFDi" CommandArgument='<%# Eval("CveFactura") %>' />
</ItemTemplate>
<ItemStyle HorizontalAlign="Center" />
</asp:TemplateField>
<asp:TemplateField HeaderText="Agregar">
<ItemTemplate>
<%--<asp:Image ID="ImgAgregar" runat="server" Style="cursor: pointer;" Visible='<%# Eval("CveProveedor").ToString <> "" %>' ToolTip="Agregar Factura" ImageUrl="/Imagenes/Nota.gif" Height="18px" />--%>
<asp:HyperLink ID="HplAgregar" runat="server" CssClass="btn btn-circle btn-sm green" Visible='<%# Eval("CveCliente").ToString <> "" %>' ToolTip="Agregar Factura" Target="_blank"><i class="fa fa-plus"></i></asp:HyperLink>
</ItemTemplate>
<ItemStyle HorizontalAlign="Center" />
</asp:TemplateField>
<asp:TemplateField Visible="False">
<ItemTemplate>
<div>
<%--<asp:ImageButton ID="imgD" runat="server" AlternateText="Eliminar" CommandArgument='<%# Eval("CveFactura") %>' Visible='<%# Eval("CveCompra").ToString = "" AndAlso Eval("CveFactura").tostring <>""%>' CausesValidation="False" CommandName="Delete" OnClientClick="javascript:return confirm('¿Está seguro que desea eliminar la factura?');" />--%>
<asp:LinkButton ID="LnkD" runat="server" CommandArgument='<%# Eval("CveFactura") %>' Visible='<%# Eval("CveVenta").ToString = "" AndAlso Eval("CveFactura").ToString <> ""%>'
CssClass="btn btn-circle btn-sm red" CausesValidation="False" CommandName="Delete" OnClientClick="javascript:return confirm('¿Está seguro que desea eliminar la factura?');">
<i class='fa fa-minus'></i>
</asp:LinkButton>
</div>
</ItemTemplate>
<ItemStyle HorizontalAlign="Center" />
</asp:TemplateField>
<asp:TemplateField Visible="False">
<ItemTemplate>
<div>
<%--<asp:ImageButton ID="imgO" runat="server" AlternateText="Omitir" Width="17px" ToolTip="Omitir Factura" CommandArgument='<%# Eval("CveFactura") %>' Visible='<%# Eval("CveCompra").ToString = "" AndAlso Eval("CveFactura").tostring <>"" AndAlso Eval("FueValidado").tostring <>"3" %>' CausesValidation="False" CommandName="Omitir" ImageUrl="/Imagenes/ImgIgnorar.png" OnClientClick="javascript:return confirm('¿Está seguro que desea omitir la factura?');" />--%>
<asp:LinkButton ID="LnkO" runat="server" AlternateText="Omitir" ToolTip="Omitir Factura" CommandArgument='<%# Eval("CveFactura") %>' Visible='<%# Eval("CveVenta").ToString = "" AndAlso Eval("CveFactura").ToString <> "" %>'
CssClass="btn btn-circle btn-sm grey-cascade" CausesValidation="False" CommandName="Omitir" OnClientClick="javascript:return confirm('¿Está seguro que desea omitir la factura?');">
<i class='fa fa-eye-slash fa-2x'></i>
</asp:LinkButton>
</div>
</ItemTemplate>
<ItemStyle HorizontalAlign="Center" />
</asp:TemplateField>
</Columns>
<HeaderStyle CssClass="Titulos" />
</asp:GridView>
</ContentTemplate>
</asp:UpdatePanel>
</asp:Content>
<asp:Content ID="Content7" ContentPlaceHolderID="JS" runat="Server">
<script src="/Metronic/assets/global/scripts/datatable.js"></script>
<script src="/Metronic/assets/global/plugins/datatables/all.min.js"></script>
<script type="text/javascript">
var Recarga = false;
//jQuery(document).ready(function () {
// Sys.Application.add_load(function (s, e) {
// if (Recarga) {
// OrdenarGV();
// }
// Recarga = false;
// });
//});
//Sys.Application.add_load(function (s, e) {
function OrdenarGV() {
//if ($.fn.dataTable.isDataTable('#GvD')) {
// table = $('#GvD').DataTable();
//}
//else {
// table = $('#GvD').DataTable({
// paging: false
// });
//}
//debugger;
var Tam = TamañoVentana();
var Alto = Tam.height - 330;
if (Alto < 100) {
Alto = 100;
}
//$("#GvD").prepend($("<thead></thead>").append($("#GvD").find("tr:first")));
//var currenttehead = $("<thead></thead>");
//$('#GvD').prepend(currenttehead);
//currenttehead.append($('#GvD tr:first'));
$('#GvD').DataTable({
retrieve: true,
scrollY: Alto + 'px',
scrollCollapse: true,
paging: false,
searching: false,
info: false
});
}
</script>
</asp:Content>

View File

@@ -1,495 +0,0 @@
Option Strict On
Option Explicit On
Imports System.Data
Imports Extensiones
Imports System.Diagnostics
Imports System.IO
Imports Microsoft.Reporting.WebForms
Imports System.Globalization
Partial Class Ventas_eFacturas
Inherits ClsPaginas
Private Property Destino As String
Set(value As String)
ViewState("Destino") = value
End Set
Get
Return ViewState("Destino").ToString
End Get
End Property
Private Property Ejecutable As String
Set(value As String)
ViewState("Ejecutable") = value
End Set
Get
Return ViewState("Ejecutable").ToString
End Get
End Property
Private Property ChecandoCorreo As Boolean
Set(value As Boolean)
ViewState("ChecandoCorreo") = value
End Set
Get
Return CType(ViewState("ChecandoCorreo"), Boolean)
End Get
End Property
Protected Sub Page_Load(sender As Object, e As System.EventArgs) Handles Me.Load
If Not Page.IsPostBack Then
ChecandoCorreo = False
ViewState("Orden") = String.Empty
txtFechaI.Text = Now.AddMonths(-1).FirstDayOfMonth().ToShortDateString ' String.Format("01/01/{0}", If(Now.Month > 6, Now.Year, Now.Year - 1))
' If UsuarioActual.CveEmpresa = 66 Then txtFechaI.Text = Now.AddDays(-7).ToShortDateString
txtFechaF.Text = Now.ToShortDateString 'txtFechaI.Text.ToDate.AddMonths(1).AddDays(-1).ToShortDateString
Destino = String.Format("{0}Ventas\", UsuarioActual.Empresa.Ruta)
Ejecutable = String.Format("{0}\Utilerias\eeeFacturas.exe", AppDomain.CurrentDomain.BaseDirectory)
Form.DefaultButton = BtnConsultar.UniqueID
DdlResponsable.DataSource = GlobalDTUsuarioResponsable.FiltraParametros(String.Format("CveEmpresa = {0}", UsuarioActual.CveEmpresa))
DdlResponsable.DataBind()
DdlResponsable.Items.Insert(0, New ListItem("Todos", "-1"))
TxtFolio.Focus()
If UsuarioActual.Sesion("eFact-Proveedor").ToString <> "" Then TxtReceptor.Text = UsuarioActual.Sesion("eFact-Proveedor").ToString.Trim
If UsuarioActual.Sesion("eFact-FI").ToString <> "" Then txtFechaI.Text = UsuarioActual.Sesion("eFact-FI").ToString.Trim
If UsuarioActual.Sesion("eFact-FF").ToString <> "" Then txtFechaF.Text = UsuarioActual.Sesion("eFact-FF").ToString.Trim
'If Session("Folio") IsNot Nothing Then TxtFolio.Text = Session("Folio").ToString.Trim
'If Session("Proveedor") IsNot Nothing Then TxtProveedor.Text = Session("Proveedor").ToString.Trim
' RegistraScript("$(document).ready(function() { var table = $('#GvDatos').DataTable({""paging"": false, ""info"": false, ""searching"": false, ""order"": [[ 1, ""desc"" ]]} ); new $.fn.dataTable.FixedHeader( table, { bottom: false } ); } );")
If UsuarioActual.TienePermisoProceso(81) Then GvD.Columns(9).Visible = True : GvD.Columns(10).Visible = True
CargaDatos()
OrdenaDatos()
End If
End Sub
Protected Sub GvDatos_RowCommand(sender As Object, e As GridViewCommandEventArgs) Handles GvD.RowCommand
If e.CommandName = "ValidarCFDi" Then
Dim a = e.CommandSource
Dim ImgBtn As LinkButton = DirectCast(e.CommandSource, LinkButton)
Dim gvr As GridViewRow = DirectCast(ImgBtn.BindingContainer, GridViewRow)
Dim Valida As New ClsValidaCFDi(gvr.DataKey("UUID"), gvr.DataKey("RFCDe"), gvr.DataKey("RFCPara"))
If Valida.EsValida > 0 Then
Dim ObjDatos As New ClsCompras
If Valida.EsValida = 2 Then
Alert("La factura está cancelada ante el SAT.", TipoMensaje.MsgInformacion)
End If
If ObjDatos.UpdateEstatus(Valida.EsValida, gvr.DataKey("CveFactura").ToEntero, UsuarioActual.CveEmpresa) Then
BtnConsultar_Click(sender, e)
End If
ObjDatos.Dispose()
Else
Alert("La Factura no se pudo validar.", TipoMensaje.MsgAdvertencia)
End If
Valida.Dispose()
ElseIf e.CommandName = "ValidarCFD" Then
Dim a = e.CommandSource
Dim ImgBtn As LinkButton = DirectCast(e.CommandSource, LinkButton)
Dim gvr As GridViewRow = DirectCast(ImgBtn.BindingContainer, GridViewRow)
Dim ObjDatos As New ClsCompras
If ObjDatos.UpdateEstatus(1, gvr.DataKey("CveFactura").ToEntero, UsuarioActual.CveEmpresa) Then
BtnConsultar_Click(sender, e)
End If
ObjDatos.Dispose()
ElseIf e.CommandName = "Omitir" Then
Dim a = e.CommandSource
'Dim ImgBtn As ImageButton = DirectCast(e.CommandSource, ImageButton)
'Dim gvr As GridViewRow = DirectCast(ImgBtn.BindingContainer, GridViewRow)
Dim LnkBtn As LinkButton = DirectCast(e.CommandSource, LinkButton)
Dim gvr As GridViewRow = DirectCast(LnkBtn.BindingContainer, GridViewRow)
Dim ObjDatos As New ClsCompras
If ObjDatos.UpdateEstatus(3, gvr.DataKey("CveFactura").ToEntero, UsuarioActual.CveEmpresa) Then
BtnConsultar_Click(sender, e)
End If
ObjDatos.Dispose()
End If
End Sub
Protected Sub BtnConsultar_Click(sender As Object, e As System.EventArgs) Handles BtnConsultar.Click
CargaDatos()
'OrdenaDatos()
End Sub
Private Sub CargaDatos()
Dim Folio, RFC, Proveedor As String
Folio = If(TxtFolio.Text.Trim.Length > 0, String.Format("%{0}%", TxtFolio.Text.Trim.ToUpper), "-1")
RFC = "-1" 'If(TxtRFC.Text.Trim.Length > 0, TxtRFC.Text.Trim, "-1")
Proveedor = If(TxtReceptor.Text.Trim.Length > 0, String.Format("%{0}%", TxtReceptor.Text.Trim.ToUpper.Replace(" ", "%")), "-1")
Dim FechaI, FechaF As Date
'UsuarioActual.Sesion("Folio") = TxtFolio.Text.Trim
UsuarioActual.Sesion("eFact-Proveedor") = TxtReceptor.Text.Trim
UsuarioActual.Sesion("eFact-FI") = txtFechaI.Text
UsuarioActual.Sesion("eFact-FF") = txtFechaF.Text
If txtFechaI.Text.Trim = "" Then FechaI = MinFecha
If txtFechaF.Text.Trim = "" Then FechaF = MaxFecha
Dim ObjDatos As New ClsVentas
If ObjDatos.GetFacturas(-1, Folio, MinFecha, MaxFecha, RFC, Proveedor, 1, DdlResponsable.SelectedValue.ToEntero, UsuarioActual.CveEmpresa) Then
If ObjDatos.DtResultados.Rows.Count > 0 Then
GvD.DataSource = ObjDatos.DtResultados '.AsEnumerable().Take(100).CopyToDataTable()
Else
GvD.DataSource = Nothing
End If
End If
LblRegistros.Text = String.Format("{0} Registros", ObjDatos.DtResultados.Rows.Count.ToString("N0"))
ObjDatos.Dispose()
GvD.DataBind()
If (GvD.Rows.Count > 0) Then
GvD.UseAccessibleHeader = True
GvD.HeaderRow.TableSection = TableRowSection.TableHeader
RegistraScript("OrdenarGV();")
End If
If GvD.Rows.Count = 0 Then
Alert("No se encontraron Registros con el filtro actual", TipoMensaje.MsgAdvertencia)
End If
UpDatos.Update()
UPRegistros.Update()
End Sub
Protected Sub LnkExportar_Click(sender As Object, e As EventArgs) Handles LnkExportar.Click
GvD.Columns(4).Visible = False
GvD.Columns(5).Visible = False
GvD.Columns(6).Visible = False
GvD.Columns(8).Visible = False
GvD.Columns(9).Visible = False
' GvD.DataSource = ViewState("DTCompleta")
' GvD.DataBind()
GvD.ExportToExcel("RepFacturas_" & Now.ToShortDateString())
' GvD.DataSource = ViewState("DT")
'GvD.DataBind()
GvD.Columns(4).Visible = False
GvD.Columns(5).Visible = False
GvD.Columns(6).Visible = True
GvD.Columns(8).Visible = True
GvD.Columns(9).Visible = True
End Sub
#Region "G V D A T O S"
Protected Sub GvDatos_RowDataBound(sender As Object, e As GridViewRowEventArgs) Handles GvD.RowDataBound
If e.Row.RowType = DataControlRowType.DataRow Then
'e.Row.Cells(0).Width = 100
'e.Row.Cells(1).Width = 80
'e.Row.Cells(2).Width = 400
'e.Row.Cells(3).Width = 80
'e.Row.Cells(4).Width = 40
'e.Row.Cells(5).Width = 40
If e.Row.RowIndex = 0 Then
'e.Row.Cells(1).ColumnSpan = 8
'e.Row.Cells(2).Visible = False : e.Row.Cells(3).Visible = False : e.Row.Cells(4).Visible = False : e.Row.Cells(5).Visible = False
'e.Row.Cells(6).Visible = False : e.Row.Cells(7).Visible = False : e.Row.Cells(8).Visible = False
'e.Row.Font.Bold = True
'e.Row.FCLiteral("LtlFolio").Text &= " Registros"
End If
e.Row.Cells(1).Attributes.Add("data-order", e.Row.DBCampo("FechaFactura").ToDate.Ticks.ToString)
If File.Exists(String.Format("{0}{1}\{2}", Destino, e.Row.DBCampo("RFCPara"), e.Row.DBCampo("XML"))) Then
e.Row.FCLiteral("LtlXML").Text = String.Format("<a class=""Texto"" href=""/Compras/PopUpVerFactura.aspx?RFC={0}&FileV={1}"">Ver</a>", HttpUtility.UrlEncode(e.Row.DBCampo("RFCDe")), HttpUtility.UrlEncode(e.Row.DBCampo("XML")))
Else
e.Row.FCLiteral("LtlXML").Text = "N/D"
End If
If File.Exists(String.Format("{0}{1}/{2}", Destino, e.Row.DBCampo("RFCPara"), e.Row.DBCampo("PDF"))) Then
e.Row.FCLiteral("LtlPDF").Text = String.Format("<a class=""Texto"" href=""/Compras/PopUpVerFactura.aspx?RFC={0}&FileV={1}"">Ver</a>", HttpUtility.UrlEncode(e.Row.DBCampo("RFCDe")), HttpUtility.UrlEncode(e.Row.DBCampo("PDF")))
Else
e.Row.FCLiteral("LtlPDF").Text = "N/D"
End If
If e.Row.DBCampo("FueValidado").Contiene("1", "2", "3") Then
e.Row.FCLinkButton("ImgValidarCFDi").Visible = False
e.Row.FCLiteral("LtlValidado").Visible = True
If e.Row.DBCampo("FueValidado") = "2" Then
e.Row.FCLiteral("LtlValidado").Text = "Cancelada"
e.Row.ForeColor = Drawing.Color.Red
e.Row.FCHyperLink("HplProveedor").ForeColor = Drawing.Color.Red
ElseIf e.Row.DBCampo("FueValidado") = "3" Then
e.Row.FCLiteral("LtlValidado").Text = "Omitida"
e.Row.ForeColor = Drawing.Color.Gray
e.Row.FCHyperLink("HplProveedor").ForeColor = Drawing.Color.Gray
End If
Else
If e.Row.DBCampo("TipoFactura") = "CFD" Then
e.Row.FCLinkButton("ImgValidarCFDi").CommandName = "ValidarCFD"
e.Row.FCLinkButton("ImgValidarCFDi").OnClientClick = "return confirm('La factura se validó en el sitio del SAT de comprobantes fiscales?');"
End If
e.Row.FCLinkButton("ImgValidarCFDi").Visible = True
e.Row.FCLiteral("LtlValidado").Visible = False
End If
If e.Row.DBCampo("CveVenta") <> "" Then
e.Row.FCLiteral("LtlFolio").Text = String.Format("<a class=""Texto"" style=""cursor:pointer;text-decoration: underline;"" href='/Ventas/Ventas.aspx?CveVenta={0}' target='_newtab');"">{1}</a>", e.Row.DBCampo("CveVenta"), e.Row.DBCampo("SerieFolio")) '1\Compras\GAPC480413QL3\A-69.xml
End If
If e.Row.DBCampo("CveCliente") = "" Then
'liga para guardar el proveedor
'e.Row.FCLiteral("LtlProv").Text = String.Format("<a class=""Texto"" style=""cursor:pointer;"" onclick=""window.open('/Compras/Proveedores.aspx?CveFactura={0}','_newtab');""><img src='/Imagenes/BotonAgregar.gif' alt='Agregar Proveedor' width='18px'></a>", e.Row.DBCampo("CveFactura")) '1\Compras\GAPC480413QL3\A-69.xml
e.Row.FCHyperLink("HplProv").Visible = True
e.Row.FCHyperLink("HplProv").NavigateUrl = String.Format("/Ventas/Clientes.aspx?CveFactura={0}", e.Row.DBCampo("CveFactura"))
' e.Row.FCLiteral("LtlAgregar").Text = ""
Else
e.Row.FCHyperLink("HplProveedor").NavigateUrl = String.Format("/Ventas/Clientes.aspx?CveCliente={0}", e.Row.DBCampo("CveCliente"))
If e.Row.DBCampo("CveVenta") = "" AndAlso (e.Row.DBCampo("FueValidado") = "1") AndAlso e.Row.DBCampo("CveCliente") <> "" Then ' OrElse UsuarioActual.CveEmpresa = 66
'e.Row.FCImage("ImgAgregar").Attributes.Add("onclick", String.Format("window.open('/Compras/Compras.aspx?CveFactura={0}&RFC={1}','_newtab')", e.Row.DBCampo("CveFactura"), e.Row.DBCampo("RFCDe")))
e.Row.FCHyperLink("HplAgregar").NavigateUrl = String.Format("/Ventas/Ventas.aspx?CveFactura={0}&RFC={1}&CVECLIENTE={2}", e.Row.DBCampo("CveFactura"), e.Row.DBCampo("RFCPara"), e.Row.DBCampo("CveCliente"))
Else
'si ya tiene cvecompra es que ya está validada
'e.Row.FCImage("ImgAgregar").Visible = False
e.Row.FCHyperLink("HplAgregar").Visible = False
End If
End If
If e.Row.RowState = DataControlRowState.Edit OrElse e.Row.RowState = 5 Then
End If
End If
End Sub
Protected Sub GvDatos_RowUpdating(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.GridViewUpdateEventArgs) Handles GvD.RowUpdating
Dim ObjDatos As New ClsCompras
Dim FueValidado As Integer = 0
If GvD.Rows(e.RowIndex).FCCheckBox("ChkFueValidado").Checked Then FueValidado = 1
If ObjDatos.UpdateEstatus(FueValidado, GvD.DataKeys(e.RowIndex).Value.ToString.ToEntero, UsuarioActual.CveEmpresa) Then
GvD.EditIndex = -1
BtnConsultar_Click(sender, e)
End If
ObjDatos.Dispose()
'If ViewState("Orden").ToString() <> String.Empty Then
'CargaGrid(ViewState("Orden").ToString())
'Else
CargaDatos()
OrdenaDatos()
'End If
End Sub
Protected Sub GvDatos_RowCancelingEdit(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.GridViewCancelEditEventArgs) Handles GvD.RowCancelingEdit
GvD.EditIndex = -1
'If ViewState("Orden").ToString() <> String.Empty Then
' CargaGrid(ViewState("Orden").ToString())
'Else
CargaDatos()
OrdenaDatos()
'End If
End Sub
Protected Sub GvDatos_RowDeleting(sender As Object, e As System.Web.UI.WebControls.GridViewDeleteEventArgs) Handles GvD.RowDeleting
Dim Fact As New ClsCompras
If Fact.DeleteFactura(e.Keys("CveFactura").ToString.ToEntero, UsuarioActual.CveEmpresa) Then
GvD.EditIndex = -1
Alert("La factura se eliminó correctamente.", TipoMensaje.MsgInformacion)
CargaDatos()
OrdenaDatos()
End If
Fact.Dispose()
'If ViewState("Orden").ToString() <> String.Empty Then
' CargaGrid(ViewState("Orden").ToString())
'Else
'End If
End Sub
Protected Sub GvDatos_RowEditing(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.GridViewEditEventArgs) Handles GvD.RowEditing
GvD.EditIndex = e.NewEditIndex
'If ViewState("Orden").ToString() <> String.Empty Then
' CargaGrid(ViewState("Orden").ToString())
'Else
CargaDatos()
OrdenaDatos()
'End If
End Sub
#End Region
Protected Sub LnkNoRecibidas_Click(sender As Object, e As EventArgs) Handles LnkNoRecibias.Click
Dim dt As New DataTable
Dim Ruta As String = String.Format("{0}Compras\NoRecibidas-{1}.xml", UsuarioActual.Empresa.Ruta, UsuarioActual.CveEmpresa)
Dim Str As New StringBuilder
If IO.File.Exists(Ruta) Then
dt.ReadXml(Ruta)
Dim conta As Integer = 1
Str.Append("Se encontraron las siguientes facturas con problema:<br/> <table width='900px'><tr class='Titulos'><td>Serie</td><td>Folio</td><td>Fecha</td><td>Proveedor</td><td>Importe</td><td>Motivo</td><td>Correo</td><td>F. Recepción</td></tr>")
For Each dr As DataRow In dt.FiltraParametros("", "Fecha DESC").Rows
Str.AppendFormat("<tr class='{0}'>", If(conta Mod 2 = 0, "TextoAlterno", "Texto"))
Str.AppendFormat("<td style='width:100px'>{0}</td>", dr("Serie"))
Str.AppendFormat("<td style='width:80px'>{0}</td>", dr("Folio"))
Str.AppendFormat("<td style='width:400px'>{0}</td>", If(dr("Fecha").ToString <> "", dr("Fecha").ToString.ToDate.ToShortDateString, ""))
Str.AppendFormat("<td style='width:80px'>{0}</td>", dr("Proveedor"))
Str.AppendFormat("<td style='width:40px'>{0}</td>", dr("Importe").ToString.ToDouble.FormatoNumero)
Str.AppendFormat("<td style='width:40px'>{0}</td>", dr("Motivo"))
Str.AppendFormat("<td style='width:500px'>{0}</td>", If(dr("Correo").ToString.Length > 20, dr("Correo").ToString.Substring(0, 20), dr("Correo").ToString()))
Str.AppendFormat("<td style='width:80px'>{0}</td>", dr("FechaRecepcion").ToString.ToDate.ToShortDateString)
Str.Append("</tr>")
conta += 1
Next
Str.Append("</table>")
Else
Str.Append("No se encontraron facturas pendientes de recibir.")
End If
Alert(Str.ToString, TipoMensaje.MsgInformacion)
CargaDatos()
OrdenaDatos()
End Sub
#Region "G E N E R A P D F "
Private Sub GenerarPDF()
'Dim ObjDatos As New ClsCompras
'Dim FechaI As String = txtFechaI.Text
'Dim FechaF As String = txtFechaF.Text
'If txtFechaI.Text = "" Then FechaI = "-1"
'If txtFechaF.Text = "" Then FechaF = "-1"
'Dim Folio = If(TxtFolio.Text.Trim.Length > 0, String.Format("%{0}%", TxtFolio.Text.Trim.ToUpper), "-1")
'Dim Proveedor = If(TxtProveedor.Text.Trim.Length > 0, String.Format("%{0}%", TxtProveedor.Text.Trim.ToUpper.Replace(" ", "%")), "-1")
'If ObjDatos.GetFacturas(-1, Folio, txtFechaI.Text.Trim.ToDate, txtFechaF.Text.Trim.ToDate, "-1", Proveedor, DdlValidado.SelectedValue.ToEntero, DdlResponsable.SelectedValue.ToEntero, UsuarioActual.CveEmpresa) Then
' Dim Imagen As New System.IO.FileInfo($"{UsuarioActual.Empresa.Ruta}/Logo.png")
' Dim logouri = String.Format("{0}://{1}:{2}/Empresas/{3}/Logo.png", Request.Url.Scheme, Request.Url.Host, Request.Url.Port, UsuarioActual.CveEmpresa)
' Dim dt As DataTable = ObjDatos.DtResultados
' Dim params As New List(Of ReportParameter)
' params.Add(New ReportParameter("NombreEmpresa", UsuarioActual.Empresa.Empresa))
' params.Add(New ReportParameter("FechaInicio", FechaI))
' params.Add(New ReportParameter("FechaFin", FechaF))
' params.Add(New ReportParameter("UsuarioImprimio", UsuarioActual.Nombre))
' params.Add(New ReportParameter("FechaImpresion", Now.ToDateTime.ToShortDateString))
' If Imagen.Exists Then
' params.Add(New ReportParameter("LogoPath", $"file://{Imagen.FullName}"))
' Else
' params.Add(New ReportParameter("LogoPath", ""))
' End If
' ImprimirPDF("Empresas/Grales/Formatos/RepFacturas.rdlc", dt, params, "ReporteCxC")
'Else
' Alert("No hay datos consultados", TipoMensaje.MsgAdvertencia)
'End If
End Sub
Protected Sub LnkPdf_Click(sender As Object, e As EventArgs) Handles LnkPdf.Click
GenerarPDF()
End Sub
#End Region
#Region "O R D E N A M I E N T O"
Private Sub OrdenaDatos()
If (GvD.Rows.Count > 0) Then
GvD.UseAccessibleHeader = True
GvD.HeaderRow.TableSection = TableRowSection.TableHeader
RegistraScript("OrdenarGV();")
End If
End Sub
#End Region
#Region "descargar factura "
Protected Sub lbDescargar_Click(sender As Object, e As EventArgs) Handles lbDescargar.Click
Dim Retorno As Boolean = False
'Dim ObjProcess As Process = Nothing
'Dim Mensajes As String = ""
'Dim EjecutableUtilerias = Path.Combine(ModExtensiones.DirectorioBaseEmpresas, "Utilerias\UtileriasAD.exe")
'Dim Folder = Path.Combine(ModExtensiones.DirectorioBaseEmpresas, "Empresas\")
'Dim error1 As Boolean = False
'Dim en As New CultureInfo("en-US")
'Dim fechai = txtFechaI.Text.Trim.ToDate.ToString("d", en)
'Dim fechaf = txtFechaF.Text.Trim.ToDate.ToString("d", en)
'Try
' ObjProcess = New Process()
' ObjProcess.StartInfo.RedirectStandardOutput = True
' ObjProcess.StartInfo.FileName = EjecutableUtilerias
' ObjProcess.StartInfo.Verb = "runas"
' ObjProcess.StartInfo.Arguments = $"{UsuarioActual.CveEmpresa} {Folder} 2 {fechai} {fechaf}"
' ObjProcess.StartInfo.UseShellExecute = False
' ObjProcess.StartInfo.WindowStyle = ProcessWindowStyle.Normal
' ObjProcess.Start()
' ObjProcess.WaitForExit()
' ObjProcess.Close()
'Catch ex As Exception
' error1 = True
' OnError("Ocurrió un error al ejecutar el actualizador.", ex)
'End Try
Dim ObjProcess As Process = Nothing
Dim Mensajes As String = ""
Dim EjecutableUtilerias = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "Utilerias\ADSUtilerias.exe")
Dim Folder = UsuarioActual.Empresa.Ruta.Replace($"{UsuarioActual.CveEmpresa.ToString()}\", "") 'Path.Combine(ModExtensiones.DirectorioBaseEmpresas, "Empresas\")
Dim error1 As Boolean = False
Dim en As New CultureInfo("en-US")
Dim fechai = txtFechaI.Text.Trim.ToDate.ToString("d", en)
Dim fechaf = txtFechaF.Text.Trim.ToDate.ToString("d", en)
Try
ObjProcess = New Process()
ObjProcess.StartInfo.RedirectStandardOutput = True
ObjProcess.StartInfo.FileName = EjecutableUtilerias
ObjProcess.StartInfo.Verb = "runas"
ObjProcess.StartInfo.Arguments = $"--mod dsat --e {UsuarioActual.CveEmpresa} --op 2 --fd {Folder} --fi {fechai} --ff {fechaf}"
ObjProcess.StartInfo.UseShellExecute = False
ObjProcess.StartInfo.WindowStyle = ProcessWindowStyle.Normal
ObjProcess.Start()
ObjProcess.WaitForExit()
ObjProcess.Close()
Catch ex As Exception
error1 = True
OnError("Ocurrió un error al ejecutar el actualizador.", ex)
End Try
End Sub
#End Region
End Class