Commit inicial Ventas Productivo
This commit is contained in:
495
Ventas/eFacturas.aspx.vb
Normal file
495
Ventas/eFacturas.aspx.vb
Normal file
@@ -0,0 +1,495 @@
|
||||
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) 'string.format("{0}Empresas\{1}\Compras\", AppDomain.CurrentDomain.BaseDirectory ,UsuarioActual.CveEmpresa & "\Compras\"
|
||||
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) 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) 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) 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) 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) 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}\Empresas\{1}\Compras\NoRecibidas-{1}.xml", AppDomain.CurrentDomain.BaseDirectory, 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(String.Format("{0}/Logo.png", UsuarioActual.Empresa.Ruta))
|
||||
' 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", logouri))
|
||||
' 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(AppDomain.CurrentDomain.BaseDirectory, "Utilerias\UtileriasAD.exe")
|
||||
'Dim Folder = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "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 = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "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
|
||||
Reference in New Issue
Block a user