eFacturas Traslados

This commit is contained in:
rakcsle
2021-11-25 19:21:53 -07:00
parent ad936fd6ee
commit 6dffe35ee2
5 changed files with 513 additions and 16 deletions

View File

@@ -1683,7 +1683,7 @@ Public Class ClsCompras
#Region "F A C T U R A S "
Public Function GetFacturas(CveFactura As Integer, Folio As String, FechaFacturaI As Date, FechaFacturaF As Date, RFC As String, Proveedor As String, FueValidado As Integer, CveResponsable As Integer, CveProveedorClasificacion As Integer, CveTipoProveedor As Integer, TipoComprobante As String, CveEmpresa As Integer) As Boolean
Public Function GetFacturas(CveFactura As Integer, Folio As String, FechaFacturaI As Date, FechaFacturaF As Date, RFC As String, Proveedor As String, FueValidado As Integer, CveResponsable As Integer, CveProveedorClasificacion As Integer, CveTipoProveedor As Integer, TipoComprobante As String, CveEmpresa As Integer, Optional Opcion As Integer = 1) As Boolean
Dim OnError As Boolean = False
'StrSQL.Clear()
@@ -1719,6 +1719,7 @@ Public Class ClsCompras
.Add("@CveProveedorClasificacion", SqlDbType.Int).Value = CveProveedorClasificacion
.Add("@CveTipoProveedor", SqlDbType.Int).Value = CveTipoProveedor
.Add("@TipoComprobante", SqlDbType.VarChar).Value = TipoComprobante
.Add("@Opcion", SqlDbType.Int).Value = Opcion
End With
Try
@@ -2412,6 +2413,47 @@ Public Class ClsCompras
End Function
Public Function AddComplementoTraslado(CveFactura As Integer, CveCompra As Integer, CveUsuario As Integer) As Boolean
Dim Retorno As Boolean = False
DataAdapter("PA_Comp_ComplementoTrasladoAdd")
With SqlAdapter.SelectCommand.Parameters
.Add("@CveFactura", SqlDbType.Int).Value = CveFactura
.Add("@CveCompra", SqlDbType.Int).Value = CveCompra
.Add("@CveUsuario", SqlDbType.Int).Value = CveUsuario
End With
Try
SqlAdapter.Fill(Data)
Retorno = True
Catch ex As Exception
OnError("Ocurrió un error al vincular el traslado.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo)
End Try
Return Retorno
End Function
Public Function RemoveComplementoTraslado(CveComplementoTraslado As Integer, CveEmpresa As Integer) As Boolean
Dim Retorno As Boolean = False
DataAdapter("PA_Comp_ComplementoTrasladoRemove")
With SqlAdapter.SelectCommand.Parameters
.Add("@CveComplementoTraslado", SqlDbType.Int).Value = CveComplementoTraslado
.Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa
End With
Try
SqlAdapter.Fill(Data)
Retorno = True
Catch ex As Exception
OnError("Ocurrió un error al vincular el traslado.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo)
End Try
Return Retorno
End Function
Public Function AddVincularPago(CveFactura As Integer) As Boolean
Dim Retorno As Boolean = False
DataAdapter("PA_Comp_VincularPagoAdd")

View File

@@ -187,6 +187,14 @@
}
function Ir5(CveCompra,FolioCompra) {
window.opener.CargaVinculacionTraslado(CveCompra, FolioCompra);
window.close();
parent.$('#ajax').modal('hide');
}
//$(document).ready(function () {
// $("#TxtFolioFiscal").mask("********-****-****-****-************");
//});

View File

@@ -11,6 +11,15 @@ Partial Class Compras_PopUpBuscarFolioC
End Get
End Property
Private Property Opcion As String
Get
Return ViewState("Opcion").ToString
End Get
Set(value As String)
ViewState("Opcion") = value
End Set
End Property
Protected Sub Page_Load(sender As Object, e As System.EventArgs) Handles Me.Load
If Not IsPostBack Then
CType(Me.Master, BaseMasterPage).EsPopup = True
@@ -24,9 +33,15 @@ Partial Class Compras_PopUpBuscarFolioC
If Request("Opt") = "Fact" Then
ViewState("Opt") = "MandaCveCompra"
ElseIf Request("Opt") = "ComplementosTraslado" Then
ViewState("Opt") = "ComplementosTraslado"
Else
ViewState("Opt") = "RecargaCompra"
End If
End If
End Sub
@@ -91,6 +106,8 @@ Partial Class Compras_PopUpBuscarFolioC
Liga = String.Format("<a class='Texto' href='javascript:Ir3(""{0}"");'>", e.Row.DBCampo("CveCompra"))
Case "FactFlete"
Liga = String.Format("<a class='Texto' href='javascript:Ir4(""{0}"");'>", e.Row.DBCampo("CveCompra"))
Case "ComplementosTraslado"
Liga = String.Format("<a class='Texto' href='javascript:Ir5(""{0}"",""{1}"");'>", e.Row.DBCampo("CveCompra"), e.Row.DBCampo("SerieFolio"))
Case Else
Liga = String.Format("<a class='Texto' href='javascript:Ir(""{0}"");'>", e.Row.DBCampo("CveCompra"))
End Select

View File

@@ -393,7 +393,7 @@
</ItemTemplate>
<ItemStyle HorizontalAlign="Center" />
</asp:TemplateField>
<asp:TemplateField HeaderText="PDF">
<asp:TemplateField HeaderText="PDF" >
<ItemTemplate>
<asp:LinkButton ID="LnkRegenerarPdf" OnClick="LnkRegenerarPdfnew_Click" CssClass="btn btn-circle btn-sm blue" runat="server"><i class="fa fa-refresh" aria-hidden="true"></i></asp:LinkButton>
</ItemTemplate>
@@ -409,6 +409,124 @@
</ContentTemplate>
</ajax:TabPanel>
<ajax:TabPanel ID="TabTraslados" runat="server" HeaderText="Traslados">
<ContentTemplate>
<asp:UpdatePanel runat="server" ID="UpTraslados" UpdateMode="Conditional">
<ContentTemplate>
<table cellpadding="0" border="0" width="100%">
<tr>
<th style="text-align: left;">
<asp:Label ID="LblTotalTraslados" runat="server" Text="Pagos" Font-Bold="True"></asp:Label></th>
<th style="text-align: right">
<%--<asp:LinkButton ID="LinkButton2" CssClass="Texto" runat="server">No Recibidas</asp:LinkButton>--%>
</th>
</tr>
</table>
<asp:GridView ID="GvTraslados" runat="server" Width="100%" AutoGenerateColumns="False" DataKeyNames="CveFactura,CveCompra,CveProveedor,SerieFolio,NombreProveedor,UUID,RFCDe,RFCPara,TipoFactura,FueValidado,TipoComprobante,Version,RFCde,XML,CveComplementoTraslado,PDF,SerieFolioVinculado,CveCompraTraslado"
EmptyDataText="No se encontraron Registros con el filtro actual" CssClass="table table-striped table-hover Widthall ScrollAD mysmallbtn" data-sort="true" GridLines="None">
<Columns>
<asp:TemplateField HeaderText="Tipo">
<ItemTemplate>
<asp:Label ID="LtTipoComprobante" runat="server" Text='<%# Eval("TipoComprobante") %>'></asp:Label>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Folio">
<ItemTemplate>
<asp:Literal ID="LtlFolio" runat="server" Text='<%# Eval("SerieFolio") %>'></asp:Literal>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Fecha Fact">
<ItemTemplate>
<asp:Literal ID="LtlFechaFactura" runat="server" Text='<%# Eval("FechaFactura", "{0:d}") %>'></asp:Literal>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Proveedor">
<ItemTemplate>
<asp:HyperLink ID="HplProveedor" runat="server" CssClass="Texto" Target="_blank" rel="opener" Text='<%# Eval("NombreProveedor") %>'></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:HyperLink ID="HplProv" runat="server" Visible='False' CssClass="btn btn-circle btn-sm blue" ToolTip="Agregar Proveedor" rel="opener" 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:HyperLink ID="HplAgregarT" runat="server" CssClass="btn btn-circle btn-sm green" Visible='<%# Eval("CveProveedor").ToString <> "" %>' data-toggle="tooltip" title="Agregar Factura" Target="_blank" rel="opener"><i class="fa fa-plus"></i></asp:HyperLink>
<asp:LinkButton ID="LnkAgregarTraslado" runat="server" OnClick="LnkAgregarTraslado_Click" CssClass="btn btn-sm blue" Visible="false" data-toggle="tooltip" ></asp:LinkButton>
</ItemTemplate>
<ItemStyle HorizontalAlign="Center" />
</asp:TemplateField>
<asp:TemplateField>
<ItemTemplate>
<asp:LinkButton ID="imgDP" runat="server" OnClick="imgDP_Click" CssClass="btn btn-circle btn-sm red" Text="<i class='fa fa-minus'></i>" data-toggle="confirmation" data-popout="true" data-original-title="¿Está seguro que desea eliminar esta factura?" data-btn-ok-label="si" />
</ItemTemplate>
<ItemStyle HorizontalAlign="Center" />
</asp:TemplateField>
<asp:TemplateField>
<ItemTemplate>
<div>
<asp:LinkButton ID="LnkOP" runat="server" AlternateText="Omitir" ToolTip="Omitir Factura" CommandArgument='<%# Eval("CveFactura") %>' Visible='<%# Eval("CveCompra").ToString = "" AndAlso Eval("CveFactura").ToString <> "" AndAlso Eval("FueValidado").ToString <> "3" %>'
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>
<asp:TemplateField HeaderText="PDF" Visible="false">
<ItemTemplate>
<asp:LinkButton ID="LnkRegenerarPdf" CssClass="btn btn-circle btn-sm blue" runat="server"><i class="fa fa-refresh" aria-hidden="true"></i></asp:LinkButton>
</ItemTemplate>
<ItemStyle HorizontalAlign="Center" />
</asp:TemplateField>
</Columns>
<HeaderStyle CssClass="Titulos" />
</asp:GridView>
</ContentTemplate>
</asp:UpdatePanel>
</ContentTemplate>
</ajax:TabPanel>
</ajax:TabContainer>
@@ -776,6 +894,59 @@
</asp:UpdatePanel>
</div>
<div id="DvModalVincularTrasaldo" class="modal ADS fade" role="dialog">
<asp:UpdatePanel class="modal-dialog" runat="server" ID="UpModalVincularTraslado" UpdateMode="Conditional">
<ContentTemplate>
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">&times;</span>
</button>
<h4 class="modal-title" id="H2" runat="server"><asp:Literal runat="server" ID="LtlModalVincularTrasaldoTitulo">Agregar</asp:Literal></h4>
</div>
<div class="modal-body">
<div class="row" runat="server" id="DvMomdalVincualarTrasladoBusqueda">
<div class="col-md-12" style="text-align:center">
<a onclick="javascript:AbrirVentana('/Compras/PopUpBuscarFolioC.aspx?Opt=ComplementosTraslado');" class="texto" ><i class="fa fa-search" aria-hidden="true"></i> Buscar Compra</a>
</div>
<br />
</div>
<div class="row" runat="server" id="DvModalVincularTrasladoVinculado" visible="false">
<div class="col-md-6" style="text-align:right">
<strong>Folio Compra:</strong>
</div>
<div class="col-md-6" style="text-align:left">
<strong><asp:HyperLink runat="server" ID="LnkModalModalVincularTrasaldoFolio" target="_blanc"></asp:HyperLink></strong>
</div>
<br />
</div>
<asp:HiddenField runat="server" ID="HdnCveCompraComplementoTraslado" ClientIDMode="Static" Value="-1" />
<asp:HiddenField runat="server" ID="HdnFolioCompraComplementoTraslado" ClientIDMode="Static" Value="-1" />
<asp:Button runat="server" ClientIDMode="Static" ID="BtnCargaCompraComplementoTraslado" OnClick="BtnCargaCompraComplementoTraslado_Click" Style="display: none;" class="btn btn-primary" />
</div>
<div class="modal-footer">
<asp:LinkButton ID="LnkVincularTraslado" runat="server" CssClass="btn btn-primary" Visible="false" OnClick="LnkVincularTraslado_Click" >Guardar</asp:LinkButton>
<button type="button" class="btn btn-default" data-dismiss="modal">Cerrar</button>
</div>
</div>
</ContentTemplate>
</asp:UpdatePanel>
</div>
</asp:Content>
<asp:Content ID="Content7" ContentPlaceHolderID="JS" runat="Server">
<script type="text/javascript">
@@ -785,6 +956,15 @@
$('#BtnVincularManualmente').click();
}
function CargaVinculacionTraslado(CveCompra, FolioCompra) {
$('#HdnCveCompraComplementoTraslado').val(CveCompra);
$('#HdnFolioCompraComplementoTraslado').val(FolioCompra ) ;
$('#BtnCargaCompraComplementoTraslado').click();
}
//function VinculacionManual(v) {
// $get("HdnCveIE").value = v;
// $('#BtnVincularManualmente').click();

View File

@@ -668,6 +668,20 @@ Partial Class Compras_eFacturas
End Property
Private Property CveFacturaComplementoTraslado As Integer
Get
If ViewState("CveFacturaComplementoTraslado") Is Nothing Then
Return -1
Else
Return ViewState("CveFacturaComplementoTraslado").ToString.ToEntero
End If
End Get
Set(value As Integer)
ViewState("CveFacturaComplementoTraslado") = value
End Set
End Property
Private Property ComprasEnComplemento As Integer
Get
@@ -682,6 +696,19 @@ Partial Class Compras_eFacturas
End Set
End Property
Private Property SeVinculoConComprasFaltantes As Boolean
Get
If ViewState("SeVinculoConComprasFaltantes") Is Nothing Then
Return False
Else
Return Boolean.Parse(ViewState("SeVinculoConComprasFaltantes").ToString)
End If
End Get
Set(value As Boolean)
ViewState("SeVinculoConComprasFaltantes") = value
End Set
End Property
#End Region
@@ -763,37 +790,55 @@ Partial Class Compras_eFacturas
txtFechaI.Text = MinFecha.ToString
txtFechaF.Text = Now.ToShortDateString
End If
Dim DtPagos As DataTable = Nothing
Dim DTTrasaldos As DataTable = Nothing
Dim ObjDatos As New ClsCompras
If ObjDatos.GetFacturas(-1, Folio, FechaI, FechaF, RFC, Proveedor, DdlValidado.SelectedValue.ToEntero, DdlResponsable.SelectedValue.ToEntero, DdlClasificacionProv.SelectedValue.ToEntero, DdlCveTipoProveedor.SelectedValue.ToEntero, DdlTipoComprobante.SelectedValue.ToString, UsuarioActual.CveEmpresa) Then
If ObjDatos.DtResultados.Rows.Count > 0 Then
GvD.DataSource = ObjDatos.DtResultados.FiltraParametros("TipoComprobante <> 'P'") '.AsEnumerable().Take(100).CopyToDataTable()
GvD.DataSource = ObjDatos.DtResultados.FiltraParametros("TipoComprobante <> 'P' and TipoComprobante <> 'T' ") '.AsEnumerable().Take(100).CopyToDataTable()
DtPagos = ObjDatos.DtResultados.FiltraParametros("TipoComprobante = 'P'")
'Else
' GvD.DataSource = Nothing
End If
End If
If ObjDatos.GetFacturas(-1, Folio, FechaI, FechaF, RFC, Proveedor, DdlValidado.SelectedValue.ToEntero, DdlResponsable.SelectedValue.ToEntero, DdlClasificacionProv.SelectedValue.ToEntero, DdlCveTipoProveedor.SelectedValue.ToEntero, DdlTipoComprobante.SelectedValue.ToString, UsuarioActual.CveEmpresa, Opcion:=2) Then
If ObjDatos.DtResultados.Rows.Count > 0 Then
LblRegistros.Text = String.Format("{0} Registros", ObjDatos.DtResultados.FiltraParametros("TipoComprobante <> 'P'").Rows.Count.ToString("N0"))
DTTrasaldos = ObjDatos.DtResultados.FiltraParametros("TipoComprobante = 'T'")
End If
End If
LblRegistros.Text = String.Format("{0} Registros", ObjDatos.DtResultados.FiltraParametros("TipoComprobante <> 'P' and TipoComprobante <> 'T' ").Rows.Count.ToString("N0"))
LblTotalPagos.Text = String.Format("{0} Pagos", ObjDatos.DtResultados.FiltraParametros("TipoComprobante = 'P'").Rows.Count.ToString("N0"))
LblTotalTraslados.Text = String.Format("{0} Traslados", ObjDatos.DtResultados.FiltraParametros("TipoComprobante = 'T'").Rows.Count.ToString("N0"))
If DtPagos IsNot Nothing AndAlso DtPagos.Rows.Count > 0 Then
GvPagos.DataSource = DtPagos
End If
If DTTrasaldos IsNot Nothing AndAlso DTTrasaldos.Rows.Count > 0 Then
GvTraslados.DataSource = DTTrasaldos
End If
ObjDatos.Dispose()
GvPagos.DataBind()
UpPagos.Update()
GvD.DataBind()
GvPagos.DataBind()
GvTraslados.DataBind()
UpPagos.Update()
UpDatos.Update()
UpTraslados.Update()
UPRegistros.Update()
End Sub
Protected Sub LnkExportar_Click(sender As Object, e As EventArgs) Handles LnkExportar.Click
@@ -2746,7 +2791,7 @@ Partial Class Compras_eFacturas
#Region "V I N C U L A R P A G O"
Protected Sub LnkAgregarPago_Click(sender As Object, e As EventArgs)
SeVinculoConComprasFaltantes = False
Dim sbSinIE As New StringBuilder
Dim TieneCompras As Boolean = False
@@ -3149,17 +3194,40 @@ Partial Class Compras_eFacturas
End If
BtnVincularPago.Attributes.Add("data-toggle", "")
BtnVincularPago.Attributes.Add("data-popout", "")
BtnVincularPago.Attributes.Add("data-original-title", "")
BtnVincularPago.Attributes.Add("data-btn-ok-label", "")
If UsuarioActual.TienePermisoProceso(332) And (BtnVincularPago.Visible = False Or BtnVincularPago.Enabled = False) Then
Dim FaltanCompras As Boolean = False
For Each GvRowVal As GridViewRow In GVPDocumentosRelacionadosPagos.Rows
If GvRowVal.DataKey("CveIE").ToEntero > 0 Then
BtnVincularPago.Enabled = True
BtnVincularPago.Visible = True
If GvRowVal.DataKey("CveCompra").ToEntero > 0 Then
FaltanCompras = True
Exit For
End If
Next
If FaltanCompras Then
For Each GvRowVal As GridViewRow In GVPDocumentosRelacionadosPagos.Rows
If GvRowVal.DataKey("CveIE").ToEntero > 0 Then
BtnVincularPago.Enabled = True
BtnVincularPago.Visible = True
BtnVincularPago.Attributes.Add("data-toggle", "confirmation")
BtnVincularPago.Attributes.Add("data-popout", "true")
BtnVincularPago.Attributes.Add("data-original-title", "Se realizará la vinculación sin tener compras previamente registradas")
BtnVincularPago.Attributes.Add("data-btn-ok-label", "Si")
SeVinculoConComprasFaltantes = True
Exit For
End If
Next
End If
End If
@@ -3171,6 +3239,8 @@ Partial Class Compras_eFacturas
Private Sub BtnVincularPago_Click(sender As Object, e As EventArgs) Handles BtnVincularPago.Click
'VERIFICA QUE HALLA UN PAGO
'Dim Contador = 0
'For Each Gv As GridViewRow In GvVincularPago.Rows
@@ -4185,4 +4255,184 @@ Partial Class Compras_eFacturas
End Sub
#Region "TRASLADOS"
Protected Sub GvTraslados_RowDataBound(sender As Object, e As GridViewRowEventArgs) Handles GvTraslados.RowDataBound
If e.Row.RowType = DataControlRowType.DataRow Then
If e.Row.DBCampo("TipoComprobante") = "T" Then
e.Row.FCLabel("LtTipoComprobante").Text = "Traslado"
e.Row.FCLabel("LtTipoComprobante").CssClass = "label label-sm label-primary"
e.Row.FCLabel("LtTipoComprobante").Attributes.Add("data-toggle", "tooltip")
e.Row.FCLabel("LtTipoComprobante").Attributes.Add("title", "Traslado")
End If
e.Row.Cells(2).Attributes.Add("data-order", e.Row.DBCampo("FechaFactura").ToDate.Ticks.ToString)
Dim RutaXML As String = String.Format("{0}{1}\{2}", Destino, e.Row.DBCampo("RFCDe"), e.Row.DBCampo("XML"))
If File.Exists(String.Format("{0}{1}\{2}", Destino, e.Row.DBCampo("RFCDe"), e.Row.DBCampo("XML"))) Then
e.Row.FCLiteral("LtlXML").Text = String.Format("<a class=""Texto"" href=""/Compras/PopUpVerFactura.aspx?RFC={0}&File={1}"">Ver</a>", HttpUtility.UrlEncode(e.Row.DBCampo("RFCDe")), HttpUtility.UrlEncode(e.Row.DBCampo("XML")))
If e.Row.DBCampo("TipoComprobante") = "T" And e.Row.DBCampo("FueValidado") = "1" Then
e.Row.FCLinkButton("LnkAgregarTraslado").Visible = True
End If
Else
e.Row.FCLiteral("LtlXML").Text = "N/D" ' String.Format("{0}{1}\{2}", Destino, e.Row.DBCampo("RFCDe"), e.Row.DBCampo("XML")) '
If e.Row.DBCampo("TipoComprobante") = "T" Then
e.Row.FCLinkButton("LnkAgregarTraslado").Visible = False
End If
End If
If File.Exists(String.Format("{0}{1}/{2}", Destino, e.Row.DBCampo("RFCDe"), e.Row.DBCampo("PDF"))) Then
e.Row.FCLiteral("LtlPDF").Text = String.Format("<a class=""Texto"" href=""/Compras/PopUpVerFactura.aspx?RFC={0}&File={1}"">Ver</a>", HttpUtility.UrlEncode(e.Row.DBCampo("RFCDe")), HttpUtility.UrlEncode(e.Row.DBCampo("PDF")))
Else
e.Row.FCLiteral("LtlPDF").Text = "N/D" ' String.Format("{0}{1}/{2}", Destino, e.Row.DBCampo("RFCDe"), e.Row.DBCampo("PDF"))
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("CveCompra") <> "" Then
e.Row.FCLiteral("LtlFolio").Text = String.Format("<a class=""Texto"" style=""cursor:pointer;text-decoration: underline;"" href='/Compras/Compras.aspx?CveCompra={0}' target='_blank' rel='opener');"">{1}</a>", e.Row.DBCampo("CveCompra"), e.Row.DBCampo("SerieFolio")) '1\Compras\GAPC480413QL3\A-69.xml
End If
If e.Row.DBCampo("CveProveedor") = "" Then
e.Row.FCHyperLink("HplProv").Visible = True
e.Row.FCHyperLink("HplProv").NavigateUrl = String.Format("/Compras/Proveedores.aspx?CveFactura={0}", e.Row.DBCampo("CveFactura"))
Else
e.Row.FCHyperLink("HplProveedor").NavigateUrl = String.Format("/Compras/Proveedores.aspx?CveProveedor={0}", e.Row.DBCampo("CveProveedor"))
If e.Row.DBCampo("CveCompra") = "" AndAlso (e.Row.DBCampo("FueValidado") = "1") Then
e.Row.FCHyperLink("HplAgregarT").Visible = False
Else
e.Row.FCHyperLink("HplAgregarT").Visible = False
End If
End If
Dim CveComplementoTraslado As Integer = e.Row.DataKey("CveComplementoTraslado").ToString.ToEntero
If CveComplementoTraslado > 0 Then
e.Row.FCLinkButton("LnkAgregarTraslado").CssClass = "btn btn-sm green"
e.Row.FCLinkButton("LnkAgregarTraslado").Text = "<i class='fa fa-info' ></i>"
e.Row.FCLinkButton("LnkAgregarTraslado").Attributes.Add("Title", "Ver vinculación")
Else
e.Row.FCLinkButton("LnkAgregarTraslado").CssClass = "btn btn-sm blue"
e.Row.FCLinkButton("LnkAgregarTraslado").Text = "<i class='fa fa-check'></i>"
e.Row.FCLinkButton("LnkAgregarTraslado").Attributes.Add("Title", "Vincular Traslado")
End If
End If
End Sub
Protected Sub LnkAgregarTraslado_Click(sender As Object, e As EventArgs)
Dim gvRow As GridViewRow = DirectCast((DirectCast(sender, LinkButton)).NamingContainer, GridViewRow)
Dim CveComplementoTraslado As Integer = gvRow.DataKey("CveComplementoTraslado").ToEntero
CveFacturaComplementoTraslado = gvRow.DataKey("CveFactura").ToEntero
Dim SerieFolioTraslado As String = gvRow.DataKey("SerieFolio").ToString
LnkVincularTraslado.Visible = False
If CveComplementoTraslado > 0 Then
DvMomdalVincualarTrasladoBusqueda.Visible = False
DvModalVincularTrasladoVinculado.Visible = True
LtlModalVincularTrasaldoTitulo.Text = "Traslado Vinculado"
LnkModalModalVincularTrasaldoFolio.Text = gvRow.DataKey("SerieFolioVinculado")
LnkModalModalVincularTrasaldoFolio.NavigateUrl = $"~/Compras/Compras.aspx?CveCompra={gvRow.DataKey("CveCompraTraslado")}"
Else
DvMomdalVincualarTrasladoBusqueda.Visible = True
DvModalVincularTrasladoVinculado.Visible = False
LtlModalVincularTrasaldoTitulo.Text = "Vincular Traslado"
End If
UpModalVincularTraslado.Update()
RegistraScript("$('#DvModalVincularTrasaldo').modal('show');")
End Sub
Protected Sub BtnCargaCompraComplementoTraslado_Click(sender As Object, e As EventArgs)
If HdnCveCompraComplementoTraslado.Value.ToString.ToEntero > 0 Then
LnkVincularTraslado.Visible = True
LnkModalModalVincularTrasaldoFolio.Text = HdnFolioCompraComplementoTraslado.Value.ToString
LnkModalModalVincularTrasaldoFolio.NavigateUrl = $"~/Compras/Compras.aspx?CveCompra={HdnCveCompraComplementoTraslado.Value.ToString}"
DvModalVincularTrasladoVinculado.Visible = True
Else
LnkVincularTraslado.Visible = False
LnkModalModalVincularTrasaldoFolio.Text = ""
LnkModalModalVincularTrasaldoFolio.NavigateUrl = ""
DvModalVincularTrasladoVinculado.Visible = False
LnkVincularTraslado.Visible = False
End If
UpModalVincularTraslado.Update()
End Sub
Protected Sub LnkVincularTraslado_Click(sender As Object, e As EventArgs)
Dim ProcesoOk As Boolean = False
If HdnCveCompraComplementoTraslado.Value.ToString.ToEntero > 0 Then
Dim objCompras As New ClsCompras
If objCompras.AddComplementoTraslado(CveFacturaComplementoTraslado, HdnCveCompraComplementoTraslado.Value.ToString.ToEntero, UsuarioActual.CveUsuario) Then
ProcesoOk = True
End If
objCompras.Dispose()
End If
If ProcesoOk Then
RegistraScript("$('#DvModalVincularTrasaldo').modal('hide');")
CargaDatos()
Alert("Traslado Vinculado correctamente.")
End If
End Sub
#End Region
End Class