Acuse de cancelacion del sat, en cancelaciones por respuesta
This commit is contained in:
@@ -4217,16 +4217,14 @@ Namespace Modelos
|
||||
'GENERAMOS EL ACUSE Y MANDAMOS MAIL DE CON EL ACUSE DE CANCELACIÓN
|
||||
If RequiereAceptacion Then
|
||||
CancelacionFecha = Now.Date
|
||||
CancelacionAcuse = ""
|
||||
CveEstatus = 20
|
||||
|
||||
Else
|
||||
CancelacionFecha = ObjCancelacion.CancelacionFecha
|
||||
CancelacionAcuse = ObjCancelacion.CancelacionAcuse
|
||||
CveEstatus = 5
|
||||
End If
|
||||
CancelacionAcuse = ObjCancelacion.CancelacionAcuse
|
||||
Else
|
||||
Retorno.Mensaje = "La factura no se pudo cancelar ante el SAT."
|
||||
Retorno.Mensaje = "Los servicios de cancelación del SAT no se encuentran disponibles o presentan time out. Intente de nuevo en unos minutos.<br/>Origen del error: WebService www.sat.gob.mx"
|
||||
Retorno.TipoMensaje = TipoMensaje.MsgError
|
||||
|
||||
Return Retorno
|
||||
@@ -4568,22 +4566,21 @@ Namespace Modelos
|
||||
'SI EXISTEN HAY EXISTENCIA EN (ENTREGA POR ADELANTADO) SE TIENE QUE REGRESAR AL ALMACEN GENERAL
|
||||
If Not ErrorCancelar AndAlso ListaRemisionesCancelar IsNot Nothing AndAlso ListaRemisionesCancelar.Count > 0 Then
|
||||
For Each CveRemision As Integer In ListaRemisionesCancelar
|
||||
For Each RowDevolucion As DataRow In DtDevoluciones.FiltraParametros($"CveRemision={CveRemision}", DistinctColumns:={"CveRemision", "CveAlmacen", "CveAlmacenDestino"}).Rows
|
||||
Dim DtDevRemision As DataTable = DtDevoluciones.FiltraParametros($"CveRemision={CveRemision}")
|
||||
|
||||
Dim DtDevRemision As DataTable = DtDevoluciones.FiltraParametros($"CveRemision={CveRemision}")
|
||||
Dim RowDevolucion As DataRow = DtDevRemision.FiltraParametros("", DistinctColumns:={"CveRemision", "CveAlmacen", "CveAlmacenDestino"}).Rows(0)
|
||||
|
||||
CveAlmacen = RowDevolucion("CveAlmacen").ToString().ToEntero()
|
||||
CveAlmacenDevolucion = RowDevolucion("CveAlmacenDestino").ToString().ToEntero()
|
||||
CveAlmacen = RowDevolucion("CveAlmacen").ToString().ToEntero()
|
||||
CveAlmacenDevolucion = RowDevolucion("CveAlmacenDestino").ToString().ToEntero()
|
||||
|
||||
'DEBE REGRESAR LA EXISTENCIA DE (ENTREGA POR ADELANTADO) AL ALMACEN GENERAL
|
||||
If Not CancelarMovimientosRemision(CveRemision, CveAlmacen, CveAlmacenDevolucion, DtDevRemision, ObjVentas, ObjInventario) Then
|
||||
ErrorCancelar = True
|
||||
MensajeError = "Ocurrió un error al cancelar los movimientos de la remisión."
|
||||
Exit For
|
||||
End If
|
||||
'DEBE REGRESAR LA EXISTENCIA DE (ENTREGA POR ADELANTADO) AL ALMACEN GENERAL
|
||||
If Not CancelarMovimientosRemision(CveRemision, CveAlmacen, CveAlmacenDevolucion, DtDevRemision, ObjVentas, ObjInventario) Then
|
||||
ErrorCancelar = True
|
||||
MensajeError = "Ocurrió un error al cancelar los movimientos de la remisión."
|
||||
Exit For
|
||||
End If
|
||||
|
||||
DtDevRemision.Dispose()
|
||||
Next
|
||||
DtDevRemision.Dispose()
|
||||
Next
|
||||
End If
|
||||
|
||||
@@ -5030,22 +5027,34 @@ Namespace Modelos
|
||||
End If
|
||||
|
||||
'ENTRADA A (ALMACEN GENERAL)
|
||||
Dim DtEntradaDetalle As DataTable = Nothing
|
||||
|
||||
If Not ErrorCancelar Then
|
||||
If ObjInventario.GetMovimientosDetalle(CveMovimientoSalidaDevRem, UsuarioActual.CveEmpresa) Then
|
||||
For Each Dr As DataRow In ObjInventario.DtResultados.Rows
|
||||
DtEntradaDetalle = ObjInventario.DtResultados.Copy()
|
||||
End If
|
||||
End If
|
||||
|
||||
If Not ErrorCancelar Then
|
||||
If DtEntradaDetalle IsNot Nothing Then
|
||||
For Each Dr As DataRow In DtEntradaDetalle.Rows
|
||||
If Not ObjInventario.AddMovimientoDetalle(CveMovimientoEntradaDevRem, Dr("Cantidad").ToString.ToDecimal, Dr("CveUM").ToString.ToEntero, Dr("CvePS").ToString.ToEntero, Dr("PU").ToString.ToDecimal, CveAF:=Dr("CveAF").ToString.ToEntero, Serie:=Dr("Serie").ToString, CveMovimientoDetalleEntrada:=Dr("CveMovimientoDetalle").ToString().ToEntero(), CveVentaDetalle:=Dr("CveVentaDetalle").ToString.ToEntero, Lote:=Dr("Lote").ToString) Then
|
||||
ErrorCancelar = True
|
||||
Exit For
|
||||
End If
|
||||
Next
|
||||
Else
|
||||
ErrorCancelar = True
|
||||
End If
|
||||
End If
|
||||
|
||||
|
||||
If Not ObjVentas.UpdateVentasDevolucionAlmacen(2, CveRemision) Then
|
||||
ErrorCancelar = True
|
||||
If Not ErrorCancelar Then
|
||||
If Not ObjVentas.UpdateVentasDevolucionAlmacen(2, CveRemision) Then
|
||||
ErrorCancelar = True
|
||||
End If
|
||||
End If
|
||||
|
||||
|
||||
Return Not ErrorCancelar
|
||||
End Function
|
||||
|
||||
|
||||
@@ -1,134 +1,161 @@
|
||||
<%@ Page Title="" Language="C#" MasterPageFile="~/Site.master" AutoEventWireup="true" CodeFile="RepCancelacionesPorRespuesta.aspx.cs" Inherits="Ventas_RepCancelacionesPorRespuesta" %>
|
||||
|
||||
<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">
|
||||
Reporte de Cancelaciones por Respuesta
|
||||
</asp:Content>
|
||||
<asp:Content ID="Content4" ContentPlaceHolderID="HB" runat="Server">
|
||||
<asp:UpdatePanel ID="UpAcciones" runat="server" UpdateMode="Conditional">
|
||||
<ContentTemplate>
|
||||
<li>
|
||||
<asp:LinkButton ID="LnkValidar" OnClick="LnkValidar_Click" runat="server"><i class="fa fa-check"></i>Verificar Cancelaciones</asp:LinkButton></li>
|
||||
</ContentTemplate>
|
||||
</asp:UpdatePanel>
|
||||
</asp:Content>
|
||||
<asp:Content ID="Content5" ContentPlaceHolderID="H" runat="Server">
|
||||
</asp:Content>
|
||||
<asp:Content ID="Content6" ContentPlaceHolderID="HA" runat="Server">
|
||||
</asp:Content>
|
||||
<asp:Content ID="Content7" ContentPlaceHolderID="C" runat="Server">
|
||||
<asp:UpdatePanel ID="UPDatos" runat="server" UpdateMode="Conditional">
|
||||
<ContentTemplate>
|
||||
<div class="portlet light smmallpadding traspasorow bordered">
|
||||
<div class="portlet-title">
|
||||
<div class="caption font-green">
|
||||
<span class="caption-subject bold uppercase" style="line-height: 2;">Facturas Pendientes Por Respuesta</span>
|
||||
</div>
|
||||
<div class="actions">
|
||||
<div class="btn-group">
|
||||
</div>
|
||||
</div>
|
||||
<div class="tools">
|
||||
<a href="javascript:;" class="collapse"></a>
|
||||
</div>
|
||||
</div>
|
||||
<div class="portlet-body rowpadding">
|
||||
<div class="row">
|
||||
<div class="col-md-12">
|
||||
<div class="row" style="margin-left: 0px; margin-top: 5px; margin-bottom: 5px; text-align: right" align="left">
|
||||
<div style="margin-right: 15px">
|
||||
<input type="text" id="TxtBusqueda1" class="form-control input-sm" onkeyup="<%= String.Format("FiltrarTabla('TxtBusqueda1','{0}')", GvDatos.ClientID) %>" style="display: inline-block; margin-right: -20px; width: 150px;" />
|
||||
<a href="javascript:;" onclick="<%= String.Format("FiltrarTabla('TxtBusqueda','{0}')", GvDatos.ClientID) %>" style="margin-top: -3px;" class="btn btn-circle btn-sm label-info"><i class="icon-magnifier"></i></a>
|
||||
</div>
|
||||
</div>
|
||||
<asp:GridView ID="GvDatos" runat="server" AutoGenerateColumns="false" EmptyDataText="No se encontraron solicitudes de cancelación"
|
||||
DataKeyNames="CveVenta,CveCliente,Folio,TipoDocto,Nombre,FolioFiscal,Total,SubTotal,RFCCliente"
|
||||
CssClass="table table-striped table-advance table-hover Widthall ScrollAD mysmallbtn" data-sort="true" GridLines="None" Width="99%">
|
||||
<Columns>
|
||||
<asp:BoundField HeaderText="Cliente" DataField="Nombre" ItemStyle-Width="25%" />
|
||||
<asp:BoundField HeaderText="Folio Fiscal" DataField="FolioFiscal" ItemStyle-Width="265px" />
|
||||
<asp:HyperLinkField HeaderText="Serie Folio" DataTextField="SerieFolio" DataNavigateUrlFields="CveVenta" ItemStyle-Width="100px" DataNavigateUrlFormatString="/Ventas/Ventas.aspx?CveVenta={0}" />
|
||||
<asp:BoundField HeaderText="Fecha" DataField="Fecha" DataFormatString="{0:dd/MM/yyyy}" ItemStyle-Width="80px" />
|
||||
<asp:BoundField HeaderText="Importe" DataField="Total" DataFormatString="{0:N2}" ItemStyle-Width="90px" ItemStyle-HorizontalAlign="Right" />
|
||||
<asp:BoundField HeaderText="Mon" DataField="Abreviatura" ItemStyle-Width="30px" />
|
||||
<asp:BoundField HeaderText="Estatus" DataField="EstatusFactura" ItemStyle-Width="160px" />
|
||||
<asp:TemplateField ItemStyle-Width="35px" HeaderText="Verificar">
|
||||
<ItemTemplate>
|
||||
<asp:LinkButton runat="server" OnClick="BtnValidar_Click" CssClass="btn btn-circle btn-sm green" Text="<i class='fa fa-check'></i>" data-toggle="confirmation" data-popout="true" data-original-title="¿Está seguro que desea verificar la cancelación?" data-btn-ok-label="si"></asp:LinkButton>
|
||||
</ItemTemplate>
|
||||
</asp:TemplateField>
|
||||
</Columns>
|
||||
<RowStyle CssClass="Texto" />
|
||||
<HeaderStyle CssClass="Titulos" />
|
||||
</asp:GridView>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div id="DivRefacturar" runat="server" visible="false" class="portlet light smmallpadding traspasorow bordered">
|
||||
<div class="portlet-title">
|
||||
<div class="caption font-green">
|
||||
<span class="caption-subject bold uppercase" style="line-height: 2;">Facturas Pendientes Por Refacturar</span>
|
||||
</div>
|
||||
<div class="actions">
|
||||
<div class="btn-group">
|
||||
</div>
|
||||
</div>
|
||||
<div class="tools">
|
||||
<a href="javascript:;" class="collapse"></a>
|
||||
</div>
|
||||
</div>
|
||||
<div class="portlet-body rowpadding">
|
||||
<div class="row">
|
||||
<div class="col-md-12">
|
||||
<div class="row" style="margin-left: 0px; margin-top: 5px; margin-bottom: 5px; text-align: right" align="left">
|
||||
<div style="margin-right: 15px">
|
||||
<input type="text" id="TxtBusqueda2" class="form-control input-sm" onkeyup="<%= String.Format("FiltrarTabla('TxtBusqueda2','{0}')", GvRefacturaciones.ClientID) %>" style="display: inline-block; margin-right: -20px; width: 150px;" />
|
||||
<a href="javascript:;" onclick="<%= String.Format("FiltrarTabla('TxtBusqueda','{0}')", GvRefacturaciones.ClientID) %>" style="margin-top: -3px;" class="btn btn-circle btn-sm label-info"><i class="icon-magnifier"></i></a>
|
||||
</div>
|
||||
</div>
|
||||
<asp:GridView ID="GvRefacturaciones" runat="server" AutoGenerateColumns="false" EmptyDataText="No se encontraron solicitudes de cancelación"
|
||||
DataKeyNames="CveVenta,CveCliente,Folio,TipoDocto,Nombre,FolioFiscal,Total,SubTotal,RFCCliente"
|
||||
CssClass="table table-striped table-advance table-hover Widthall ScrollAD mysmallbtn" data-sort="true" GridLines="None" Width="99%" OnRowDataBound="GvDatos_RowDataBound">
|
||||
<Columns>
|
||||
<asp:BoundField HeaderText="Cliente" DataField="Nombre" ItemStyle-Width="25%" />
|
||||
<asp:BoundField HeaderText="Folio Fiscal" DataField="FolioFiscal" ItemStyle-Width="265px" />
|
||||
<asp:HyperLinkField HeaderText="Serie Folio" DataTextField="SerieFolio" DataNavigateUrlFields="CveVenta" ItemStyle-Width="100px" DataNavigateUrlFormatString="/Ventas/Ventas.aspx?CveVenta={0}" />
|
||||
<asp:BoundField HeaderText="Fecha" DataField="Fecha" DataFormatString="{0:dd/MM/yyyy}" ItemStyle-Width="80px" />
|
||||
<asp:BoundField HeaderText="Importe" DataField="Total" DataFormatString="{0:N2}" ItemStyle-Width="90px" ItemStyle-HorizontalAlign="Right" />
|
||||
<asp:BoundField HeaderText="Mon" DataField="Abreviatura" ItemStyle-Width="30px" />
|
||||
<asp:BoundField HeaderText="Estatus" DataField="EstatusFactura" ItemStyle-Width="160px" />
|
||||
<asp:TemplateField ItemStyle-Width="35px" HeaderText="Verificar">
|
||||
<ItemTemplate>
|
||||
<asp:LinkButton runat="server" OnClick="BtnValidarRefacturacion_Click" CssClass="btn btn-circle btn-sm green" Text="<i class='fa fa-check'></i>" data-toggle="confirmation" data-popout="true" data-original-title="¿Está seguro que desea verificar la cancelación?" data-btn-ok-label="si"></asp:LinkButton>
|
||||
</ItemTemplate>
|
||||
</asp:TemplateField>
|
||||
<asp:HyperLinkField HeaderText="Refacturación" Text="Refacturar" DataNavigateUrlFields="CveVenta" ItemStyle-Width="100px" DataNavigateUrlFormatString="/Ventas/Ventas.aspx?CveDevolucion={0}&NuevaFactura=1" />
|
||||
<%-- <asp:TemplateField ItemStyle-Width="35px" HeaderText="Refacturar">
|
||||
<ItemTemplate>
|
||||
<asp:LinkButton runat="server" OnClick="BtnRefacturar_Click" CssClass="btn btn-circle btn-sm green" Text="<i class='fa fa-check'></i>" data-toggle="confirmation" data-popout="true" data-original-title="¿Está seguro que desea verificar la cancelación?" data-btn-ok-label="si"></asp:LinkButton>
|
||||
</ItemTemplate>
|
||||
</asp:TemplateField>--%>
|
||||
</Columns>
|
||||
<RowStyle CssClass="Texto" />
|
||||
<HeaderStyle CssClass="Titulos" />
|
||||
</asp:GridView>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<asp:Button ID="BtnRefacturarDocumento" runat="server" ClientIDMode="Static" Text="Refacturar Documento" Style="display: none;" />
|
||||
</ContentTemplate>
|
||||
</asp:UpdatePanel>
|
||||
</asp:Content>
|
||||
<asp:Content ID="Content8" ContentPlaceHolderID="JS" runat="Server">
|
||||
<%@ Page Title="" Language="C#" MasterPageFile="~/Site.master" AutoEventWireup="true" CodeFile="RepCancelacionesPorRespuesta.aspx.cs" Inherits="Ventas_RepCancelacionesPorRespuesta" %>
|
||||
|
||||
<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">
|
||||
Reporte de Cancelaciones por Respuesta
|
||||
</asp:Content>
|
||||
<asp:Content ID="Content4" ContentPlaceHolderID="HB" runat="Server">
|
||||
<asp:UpdatePanel ID="UpAcciones" runat="server" UpdateMode="Conditional">
|
||||
<ContentTemplate>
|
||||
<li>
|
||||
<asp:LinkButton ID="LnkValidar" OnClick="LnkValidar_Click" runat="server"><i class="fa fa-check"></i>Verificar Cancelaciones</asp:LinkButton></li>
|
||||
</ContentTemplate>
|
||||
</asp:UpdatePanel>
|
||||
</asp:Content>
|
||||
<asp:Content ID="Content5" ContentPlaceHolderID="H" runat="Server">
|
||||
</asp:Content>
|
||||
<asp:Content ID="Content6" ContentPlaceHolderID="HA" runat="Server">
|
||||
</asp:Content>
|
||||
<asp:Content ID="Content7" ContentPlaceHolderID="C" runat="Server">
|
||||
<asp:UpdatePanel ID="UPDatos" runat="server" UpdateMode="Conditional">
|
||||
<ContentTemplate>
|
||||
<div class="row">
|
||||
<div class="col-md-12" style="vertical-align: middle;" align="center">
|
||||
<div style="z-index: 5; position: relative;">
|
||||
<div id="DivAdvertencia" clientidmode="Static" runat="server" class="alert alert-warning" style="padding: 5px; margin-bottom: 5px; padding-right: 25px;">
|
||||
<button type="button" class="close" data-dismiss="alert" style="margin-top: 5px;" aria-hidden="true"></button>
|
||||
<strong style="font-size: 20px; margin-right: 25px;">Información: </strong>
|
||||
<asp:Literal Text="Para que el documento se cancele sin aceptación por parte del cliente tendrá que transcurrir 72 horas hábiles" runat="server" ID="LtlAdvertencia"></asp:Literal>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="portlet light smmallpadding traspasorow bordered">
|
||||
<div class="portlet-title">
|
||||
<div class="caption font-green">
|
||||
<span class="caption-subject bold uppercase" style="line-height: 2;">Facturas Pendientes Por Respuesta</span>
|
||||
</div>
|
||||
<div class="actions">
|
||||
<div class="btn-group">
|
||||
</div>
|
||||
</div>
|
||||
<div class="tools">
|
||||
<a href="javascript:;" class="collapse"></a>
|
||||
</div>
|
||||
</div>
|
||||
<div class="portlet-body rowpadding">
|
||||
<div class="row">
|
||||
<div class="col-md-12">
|
||||
<div class="row" style="margin-left: 0px; margin-top: 5px; margin-bottom: 5px; text-align: right" align="left">
|
||||
<div style="margin-right: 15px">
|
||||
<input type="text" id="TxtBusqueda1" class="form-control input-sm" onkeyup="<%= String.Format("FiltrarTabla('TxtBusqueda1','{0}')", GvDatos.ClientID) %>" style="display: inline-block; margin-right: -20px; width: 150px;" />
|
||||
<a href="javascript:;" onclick="<%= String.Format("FiltrarTabla('TxtBusqueda','{0}')", GvDatos.ClientID) %>" style="margin-top: -3px;" class="btn btn-circle btn-sm label-info"><i class="icon-magnifier"></i></a>
|
||||
</div>
|
||||
</div>
|
||||
<asp:GridView ID="GvDatos" runat="server" AutoGenerateColumns="false" EmptyDataText="No se encontraron solicitudes de cancelación"
|
||||
DataKeyNames="CveVenta,CveCliente,Folio,TipoDocto,Nombre,FolioFiscal,Total,SubTotal,RFCCliente"
|
||||
CssClass="table table-striped table-advance table-hover Widthall ScrollAD mysmallbtn" data-sort="true" GridLines="None" Width="99%">
|
||||
<Columns>
|
||||
<asp:BoundField HeaderText="Cliente" DataField="Nombre" ItemStyle-Width="25%" />
|
||||
<asp:BoundField HeaderText="Folio Fiscal" DataField="FolioFiscal" ItemStyle-Width="265px" />
|
||||
<asp:HyperLinkField HeaderText="Serie Folio" DataTextField="SerieFolio" DataNavigateUrlFields="CveVenta" ItemStyle-Width="100px" DataNavigateUrlFormatString="/Ventas/Ventas.aspx?CveVenta={0}" />
|
||||
<asp:BoundField HeaderText="Fecha" DataField="Fecha" DataFormatString="{0:dd/MM/yyyy}" ItemStyle-Width="80px" />
|
||||
<asp:BoundField HeaderText="Importe" DataField="Total" DataFormatString="{0:N2}" ItemStyle-Width="90px" ItemStyle-HorizontalAlign="Right" />
|
||||
<asp:BoundField HeaderText="Mon" DataField="Abreviatura" ItemStyle-Width="30px" />
|
||||
<asp:BoundField HeaderText="Estatus" DataField="EstatusFactura" ItemStyle-Width="160px" />
|
||||
<asp:BoundField HeaderText="Fecha Solicitud" DataField="FechaCambioEstatus" ItemStyle-Width="160px" />
|
||||
<asp:BoundField HeaderText="Fecha Cancelacion" DataField="FechaCancelacion" ItemStyle-Width="160px" />
|
||||
<asp:TemplateField ItemStyle-Width="35px" HeaderText="Verificar">
|
||||
<ItemTemplate>
|
||||
<asp:LinkButton runat="server" OnClick="BtnValidar_Click" CssClass="btn btn-circle btn-sm green" Text="<i class='fa fa-check'></i>" data-toggle="confirmation" data-popout="true" data-original-title="¿Está seguro que desea verificar la cancelación?" data-btn-ok-label="si"></asp:LinkButton>
|
||||
</ItemTemplate>
|
||||
</asp:TemplateField>
|
||||
</Columns>
|
||||
<RowStyle CssClass="Texto" />
|
||||
<HeaderStyle CssClass="Titulos" />
|
||||
</asp:GridView>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div id="DivRefacturar" runat="server" visible="false" class="portlet light smmallpadding traspasorow bordered">
|
||||
<div class="portlet-title">
|
||||
<div class="caption font-green">
|
||||
<span class="caption-subject bold uppercase" style="line-height: 2;">Facturas Pendientes Por Refacturar</span>
|
||||
</div>
|
||||
<div class="actions">
|
||||
<div class="btn-group">
|
||||
</div>
|
||||
</div>
|
||||
<div class="tools">
|
||||
<a href="javascript:;" class="collapse"></a>
|
||||
</div>
|
||||
</div>
|
||||
<div class="portlet-body rowpadding">
|
||||
<div class="row">
|
||||
<div class="col-md-12">
|
||||
<div class="row" style="margin-left: 0px; margin-top: 5px; margin-bottom: 5px; text-align: right" align="left">
|
||||
<div style="margin-right: 15px">
|
||||
<input type="text" id="TxtBusqueda2" class="form-control input-sm" onkeyup="<%= String.Format("FiltrarTabla('TxtBusqueda2','{0}')", GvRefacturaciones.ClientID) %>" style="display: inline-block; margin-right: -20px; width: 150px;" />
|
||||
<a href="javascript:;" onclick="<%= String.Format("FiltrarTabla('TxtBusqueda','{0}')", GvRefacturaciones.ClientID) %>" style="margin-top: -3px;" class="btn btn-circle btn-sm label-info"><i class="icon-magnifier"></i></a>
|
||||
</div>
|
||||
</div>
|
||||
<asp:GridView ID="GvRefacturaciones" runat="server" AutoGenerateColumns="false" EmptyDataText="No se encontraron solicitudes de cancelación"
|
||||
DataKeyNames="CveVenta,CveCliente,Folio,TipoDocto,Nombre,FolioFiscal,Total,SubTotal,RFCCliente"
|
||||
CssClass="table table-striped table-advance table-hover Widthall ScrollAD mysmallbtn" data-sort="true" GridLines="None" Width="99%" OnRowDataBound="GvDatos_RowDataBound">
|
||||
<Columns>
|
||||
<asp:BoundField HeaderText="Cliente" DataField="Nombre" ItemStyle-Width="25%" />
|
||||
<asp:BoundField HeaderText="Folio Fiscal" DataField="FolioFiscal" ItemStyle-Width="265px" />
|
||||
<asp:HyperLinkField HeaderText="Serie Folio" DataTextField="SerieFolio" DataNavigateUrlFields="CveVenta" ItemStyle-Width="100px" DataNavigateUrlFormatString="/Ventas/Ventas.aspx?CveVenta={0}" />
|
||||
<asp:BoundField HeaderText="Fecha" DataField="Fecha" DataFormatString="{0:dd/MM/yyyy}" ItemStyle-Width="80px" />
|
||||
<asp:BoundField HeaderText="Importe" DataField="Total" DataFormatString="{0:N2}" ItemStyle-Width="90px" ItemStyle-HorizontalAlign="Right" />
|
||||
<asp:BoundField HeaderText="Mon" DataField="Abreviatura" ItemStyle-Width="30px" />
|
||||
<asp:BoundField HeaderText="Fecha Solicitud" DataField="FechaCambioEstatus" ItemStyle-Width="160px" />
|
||||
<asp:BoundField HeaderText="Fecha Cancelacion" DataField="FechaCancelacion" ItemStyle-Width="160px" />
|
||||
<asp:BoundField HeaderText="Estatus" DataField="EstatusFactura" ItemStyle-Width="160px" />
|
||||
<asp:TemplateField ItemStyle-Width="35px" HeaderText="Verificar">
|
||||
<ItemTemplate>
|
||||
<asp:LinkButton runat="server" OnClick="BtnValidarRefacturacion_Click" CssClass="btn btn-circle btn-sm green" Text="<i class='fa fa-check'></i>" data-toggle="confirmation" data-popout="true" data-original-title="¿Está seguro que desea verificar la cancelación?" data-btn-ok-label="si"></asp:LinkButton>
|
||||
</ItemTemplate>
|
||||
</asp:TemplateField>
|
||||
<asp:HyperLinkField HeaderText="Refacturación" Text="Refacturar" DataNavigateUrlFields="CveVenta" ItemStyle-Width="100px" DataNavigateUrlFormatString="/Ventas/Ventas.aspx?CveDevolucion={0}&NuevaFactura=1" />
|
||||
</Columns>
|
||||
<RowStyle CssClass="Texto" />
|
||||
<HeaderStyle CssClass="Titulos" />
|
||||
</asp:GridView>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<asp:Button ID="BtnRefacturarDocumento" runat="server" ClientIDMode="Static" Text="Refacturar Documento" Style="display: none;" />
|
||||
</ContentTemplate>
|
||||
</asp:UpdatePanel>
|
||||
<asp:Button ID="BtnEnviarMailCancelacion" runat="server" ClientIDMode="Static" Text="Enviar Mail Cliente" Style="display: none;" OnClick="BtnEnviarMailCancelacion_Click" />
|
||||
</asp:Content>
|
||||
<asp:Content ID="Content8" ContentPlaceHolderID="JS" runat="Server">
|
||||
<script src="/Metronic/assets/global/plugins/jquery.pulsate.min.js"></script>
|
||||
<script type="text/javascript">
|
||||
function BtnRefacturarDocumento() {
|
||||
$('#BtnRefacturarDocumento').click();
|
||||
function BtnRefacturarDocumento() {
|
||||
$('#BtnRefacturarDocumento').click();
|
||||
}
|
||||
</script>
|
||||
</asp:Content>
|
||||
|
||||
function BtnEnviarMailCancelacion() {
|
||||
$('#BtnEnviarMailCancelacion').click();
|
||||
}
|
||||
|
||||
$(document).ready(function () {
|
||||
if ($('#DivAdvertencia')) {
|
||||
$("#DivAdvertencia").pulsate("destroy");
|
||||
jQuery('#DivAdvertencia').pulsate({
|
||||
color: "#faebcc"
|
||||
});
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
</script>
|
||||
</asp:Content>
|
||||
|
||||
|
||||
@@ -10,7 +10,8 @@ using System.Web.UI;
|
||||
using System.Web.UI.WebControls;
|
||||
using Extensiones;
|
||||
using static Extensiones.ModExtensiones;
|
||||
|
||||
using Microsoft.Reporting.WebForms;
|
||||
|
||||
public partial class Ventas_RepCancelacionesPorRespuesta : ClsPaginas
|
||||
{
|
||||
private DataTable DtVentas
|
||||
@@ -75,7 +76,16 @@ public partial class Ventas_RepCancelacionesPorRespuesta : ClsPaginas
|
||||
string Nombre = GvRow.DataKey("Nombre");
|
||||
if (CveVenta > 0)
|
||||
{
|
||||
Alert(VerificarVigenciaSAT(CveVenta, CveCliente, Folio, TipoDocto, Uuid, UsuarioActual.Empresa.RFC, RFCCliente, Total));
|
||||
var resp = VerificarVigenciaSAT(CveVenta, CveCliente, Folio, TipoDocto, Uuid, UsuarioActual.Empresa.RFC, RFCCliente, Total);
|
||||
if (resp.EnviarAcuse)
|
||||
{
|
||||
Alert(resp.Mensaje,TipoMensaje.MsgConfirmacion,"BtnEnviarMailCancelacion();");
|
||||
}
|
||||
else
|
||||
{
|
||||
Alert(resp.Mensaje);
|
||||
}
|
||||
|
||||
}
|
||||
CargaDatos();
|
||||
}
|
||||
@@ -92,28 +102,53 @@ public partial class Ventas_RepCancelacionesPorRespuesta : ClsPaginas
|
||||
string Folio = GvRow.DataKey("Folio");
|
||||
string TipoDocto = GvRow.DataKey("TipoDocto");
|
||||
string Nombre = GvRow.DataKey("Nombre");
|
||||
|
||||
if (CveVenta > 0)
|
||||
{
|
||||
Alert(VerificarVigenciaSAT(CveVenta, CveCliente, Folio, TipoDocto, Uuid, UsuarioActual.Empresa.RFC, RFCCliente, Total, true));
|
||||
var respuesta = VerificarVigenciaSAT(CveVenta, CveCliente, Folio, TipoDocto, Uuid, UsuarioActual.Empresa.RFC, RFCCliente, Total, true);
|
||||
|
||||
Alert(respuesta.Mensaje);
|
||||
CargaDatos();
|
||||
|
||||
//if (respuesta.IrARefacturar)
|
||||
//{
|
||||
// Server.Transfer(respuesta.LigaRefacturacion);
|
||||
//}
|
||||
//else
|
||||
//{
|
||||
// Alert(respuesta.Mensaje);
|
||||
// CargaDatos();
|
||||
//}
|
||||
}
|
||||
CargaDatos();
|
||||
|
||||
}
|
||||
private string VerificarVigenciaSAT(int CveVenta, int CveCliente, string Folio, string TipoDocto, string uuid, string emisor, string receptor, string total, bool EsRefacturacion = false)
|
||||
private MRespuestaSAT VerificarVigenciaSAT(int CveVenta, int CveCliente, string Folio, string TipoDocto, string uuid, string emisor, string receptor, string total, bool EsRefacturacion = false)
|
||||
{
|
||||
var retorno = new MRespuestaSAT()
|
||||
{
|
||||
Mensaje = "",
|
||||
EnviarAcuse = false,
|
||||
LigaRefacturacion = "",
|
||||
IrARefacturar = false
|
||||
};
|
||||
|
||||
var sb = new StringBuilder();
|
||||
var CancelacionAcuse = "";
|
||||
var CancelacionFecha = DateTime.Now;
|
||||
|
||||
string CancelacionAcuse = "";
|
||||
DateTime CancelacionFecha = DateTime.Now;
|
||||
int CveEstatus = 4;
|
||||
|
||||
try
|
||||
{
|
||||
var resp = Timbrado.VerificarVigenciaSAT(uuid, UsuarioActual.Empresa.RFC, receptor, total, UsuarioActual.Empresa.FacturaProduccion);
|
||||
var resp = Timbrado.VerificarVigenciaSAT(uuid, UsuarioActual.Empresa.RFC, receptor, total, true);
|
||||
if (resp != null)
|
||||
{
|
||||
|
||||
if (resp.Estado == null)
|
||||
{
|
||||
sb.Append("No se pudo comprobar el estado de la factura. El servicio del sat no esta disponible");
|
||||
return sb.ToString();
|
||||
retorno.Mensaje = sb.ToString();
|
||||
return retorno;
|
||||
}
|
||||
|
||||
sb.AppendFormat("Folio Fiscal: {0} <br/>", uuid);
|
||||
@@ -124,12 +159,22 @@ public partial class Ventas_RepCancelacionesPorRespuesta : ClsPaginas
|
||||
|
||||
if (!UsuarioActual.Empresa.FacturaProduccion && (string.IsNullOrEmpty(uuid) || uuid.Contains("test")))
|
||||
{
|
||||
var FueCancelado = CancelarDocumento(CveVenta, CveEstatus, CveCliente, Folio, uuid, CancelacionAcuse, CancelacionFecha, TipoDocto, total.ToDouble(), UsuarioActual.Empresa.CvePAC).Mensaje;
|
||||
var respCancelacion = CancelarDocumento(CveVenta, CveEstatus, CveCliente, Folio, uuid, CancelacionAcuse, CancelacionFecha, TipoDocto, total.ToDouble(), UsuarioActual.Empresa.CvePAC, EsRefacturacion: EsRefacturacion);
|
||||
|
||||
sb.AppendFormat("{0} <br/>", FueCancelado);
|
||||
if (CveEstatus.Contiene(4, 5) && EsRefacturacion)
|
||||
sb.AppendFormat("{0} <br/>", respCancelacion.Mensaje);
|
||||
if (!respCancelacion.HuboError)
|
||||
{
|
||||
Response.Redirect(string.Format("Ventas.aspx?CveDevolucion={0}&NuevaFactura=1", CveVenta));
|
||||
retorno.EnviarAcuse = true;
|
||||
|
||||
sb.Append("El Documento se canceló correctamente.");
|
||||
sb.Append($"</br> <a href='/Compras/PopUpVerFactura.aspx?P={Encripta($"OP=CAN&CVEVTA={CveVenta}")}' class='Texto' target='_blank'>Imprimir Acuse</a>");
|
||||
sb.Append("</br></br> ¿Desea enviar el Acuse de Cancelación al Cliente?");
|
||||
}
|
||||
|
||||
if (respCancelacion.CveEstatus.Contiene(4, 5) && EsRefacturacion)
|
||||
{
|
||||
retorno.IrARefacturar = true;
|
||||
retorno.LigaRefacturacion = string.Format("Ventas.aspx?CveDevolucion={0}&NuevaFactura=1", CveVenta);
|
||||
}
|
||||
}
|
||||
else
|
||||
@@ -137,30 +182,28 @@ public partial class Ventas_RepCancelacionesPorRespuesta : ClsPaginas
|
||||
if ((resp.EsCancelable.ToUpper() == "NO CANCELABLE"))
|
||||
{
|
||||
sb.Append("Esta factura no es cancelable.");
|
||||
return sb.ToString();
|
||||
retorno.Mensaje = sb.ToString();
|
||||
return retorno;
|
||||
}
|
||||
|
||||
if (resp.Estado.ToUpper().Trim() == "CANCELADO" || resp.EstatusCancelacion.ToUpper() == "PLAZO VENCIDO")
|
||||
{
|
||||
CveEstatus = 5;
|
||||
var solicitud = new WSGF.Service1SoapClient();
|
||||
var acuse = solicitud.GetAcuse(emisor, "rene.molina@adsistemas.mx", "rene2018", uuid);
|
||||
|
||||
if (acuse.Estado == 0)
|
||||
var respCancelacion = CancelarDocumento(CveVenta, CveEstatus, CveCliente, Folio, uuid, CancelacionAcuse, CancelacionFecha, TipoDocto, total.ToDouble(), UsuarioActual.Empresa.CvePAC, EsRefacturacion: EsRefacturacion);
|
||||
|
||||
sb.AppendFormat("{0} <br/>", respCancelacion.Mensaje);
|
||||
if (!respCancelacion.HuboError)
|
||||
{
|
||||
var xmlAcuse = new System.Xml.XmlDocument();
|
||||
xmlAcuse.LoadXml(DecodeBase64(acuse.CfdiB64));
|
||||
|
||||
CancelacionAcuse = xmlAcuse.GetElementsByTagName("SignatureValue")[0].InnerText;
|
||||
CancelacionFecha = xmlAcuse.SelectSingleNode("Acuse").Attributes["Fecha"].Value.ToDate();
|
||||
sb.Append("El Documento se canceló correctamente.");
|
||||
sb.Append($"</br> <a href='/Compras/PopUpVerFactura.aspx?P={Encripta($"OP=CAN&CVEVTA={CveVenta}")}' class='Texto' target='_blank'>Imprimir Acuse</a>");
|
||||
sb.Append("</br></br> ¿Desea enviar el Acuse de Cancelación al Cliente?");
|
||||
}
|
||||
|
||||
var FueCancelado = CancelarDocumento(CveVenta, CveEstatus, CveCliente, Folio, uuid, CancelacionAcuse, CancelacionFecha, TipoDocto, total.ToDouble(), UsuarioActual.Empresa.CvePAC, EsRefacturacion: EsRefacturacion).Mensaje;
|
||||
|
||||
sb.AppendFormat("{0} <br/>", FueCancelado);
|
||||
if (CveEstatus.Contiene(4, 5) && EsRefacturacion)
|
||||
if (respCancelacion.CveEstatus.Contiene(4, 5) && EsRefacturacion)
|
||||
{
|
||||
Response.Redirect(string.Format("Ventas.aspx?CveDevolucion={0}&NuevaFactura=1", CveVenta));
|
||||
retorno.IrARefacturar = true;
|
||||
retorno.LigaRefacturacion = string.Format("Ventas.aspx?CveDevolucion={0}&NuevaFactura=1", CveVenta);
|
||||
}
|
||||
}
|
||||
else if (resp.EstatusCancelacion.ToUpper() == "SOLICITUD RECHAZADA")
|
||||
@@ -183,16 +226,19 @@ public partial class Ventas_RepCancelacionesPorRespuesta : ClsPaginas
|
||||
else
|
||||
{
|
||||
sb.Append("No se pudo comprobar la vigencia de la factura.");
|
||||
return sb.ToString();
|
||||
retorno.Mensaje = sb.ToString();
|
||||
return retorno;
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
sb.Append("Error al consumir el servicio: " + ex.Message);
|
||||
return sb.ToString();
|
||||
sb.Append("Error al consumir el servicio: " + ex.Message);
|
||||
retorno.Mensaje = sb.ToString();
|
||||
return retorno;
|
||||
}
|
||||
|
||||
return sb.ToString();
|
||||
retorno.Mensaje = sb.ToString();
|
||||
return retorno;
|
||||
}
|
||||
private Modelos.Factura.MCancelacionVentaMensaje CancelarDocumento(int CveVenta, int CveEstatus, int CveCliente, string Folio, string FolioFiscal, string CancelacionAcuse, DateTime CancelacionFecha, string TipoComprobante, double Total, int CvePACCancelacion, bool EsRefacturacion = false)
|
||||
{
|
||||
@@ -209,181 +255,7 @@ public partial class Ventas_RepCancelacionesPorRespuesta : ClsPaginas
|
||||
|
||||
return retorno;
|
||||
}
|
||||
|
||||
//private int GenerarPolizaAC(ClsContPAQi ObjAC, int CveVenta, string Folio, int CveCliente, string TipoComprobante, DateTime Fecha, bool CancelacionIngreso = false)
|
||||
//{
|
||||
// int CtaCliente = 0;
|
||||
// int OrdenPago = 0;
|
||||
// string NombreCliente = "";
|
||||
|
||||
// var ObjClientes = new ClsClientes();
|
||||
// if (ObjClientes.GetClientes(CveCliente, "-1", "-1", "-1", "-1", "-1", "-1", -1, UsuarioActual.CveEmpresa))
|
||||
// {
|
||||
// CtaCliente = ObjClientes.IdCtaContClientes;
|
||||
// NombreCliente = ObjClientes.NombreComercial;
|
||||
// }
|
||||
// ObjClientes.Dispose();
|
||||
|
||||
// var ObjVentas = new ClsVentas();
|
||||
// if (ObjVentas.GetVenta(CveVenta, UsuarioActual.CveEmpresa))
|
||||
// {
|
||||
// if (ObjVentas.DtResultados.Rows.Count > 0)
|
||||
// {
|
||||
// OrdenPago = ObjVentas.DtResultados.Rows[0]["Num3"].ToEntero();
|
||||
// }
|
||||
// }
|
||||
|
||||
// int Retorno = 0;
|
||||
// int IDPoliza = 0;
|
||||
// bool ErrorAC = false;
|
||||
// string Concepto = string.Format("GD {0}", NombreCliente);
|
||||
// int Paridad = 1;
|
||||
// bool TipoMovto = false;
|
||||
// if (CancelacionIngreso)
|
||||
// {
|
||||
// Concepto = string.Format("Cancelación GD {0}", NombreCliente);
|
||||
// Paridad = -1;
|
||||
// TipoMovto = true;
|
||||
// }
|
||||
// var TipoPoliza = TipoComprobante.Contiene("OP", "Com") ? 3 : 1;
|
||||
// DataRow dr = null;
|
||||
// int CtaISSSTESON = 643;
|
||||
// int CtaISPT = 1745;
|
||||
// var AC = new ClsAC();
|
||||
|
||||
// //var ObjAC = new ClsContPAQi(UsuarioActual.Empresa);
|
||||
// //ObjAC.IniciaTransacSQL();
|
||||
|
||||
// IDPoliza = ObjAC.AddPoliza(TipoPoliza, Concepto, 0, 0, UsuarioActual.CveUsuario, Fecha);
|
||||
|
||||
// if (IDPoliza > 0)
|
||||
// {
|
||||
// if (TipoComprobante == "OP")
|
||||
// {
|
||||
// //Orden de PAGO
|
||||
// if (OrdenPago == 1)
|
||||
// {
|
||||
// //ISSSTESON
|
||||
// if (ObjAC.AddMovimiento(IDPoliza, CtaCliente, false, (Paridad * 0d), "", Concepto, 0, Fecha, ""))
|
||||
// {
|
||||
// if (!ObjAC.AddMovimiento(IDPoliza, CtaISSSTESON, true, (Paridad * 0d), "", Concepto, 0, Fecha, ""))
|
||||
// {
|
||||
// ErrorAC = true;
|
||||
// }
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// ErrorAC = true;
|
||||
// }
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// //ISPT
|
||||
// if (ObjAC.AddMovimiento(IDPoliza, CtaCliente, false, (Paridad * 0d), "", Concepto, 0, Fecha, ""))
|
||||
// {
|
||||
// if (!ObjAC.AddMovimiento(IDPoliza, CtaISPT, true, (Paridad * 0d), "", Concepto, 0, Fecha, ""))
|
||||
// {
|
||||
// ErrorAC = true;
|
||||
// }
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// ErrorAC = true;
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// //NORMAL
|
||||
// DataTable Detalles = null;
|
||||
// DataTable DTPresupuestoIngresos = null;
|
||||
// if (ObjVentas.GetVentaDetalle(CveVenta))
|
||||
// {
|
||||
// Detalles = ObjVentas.DtResultados.Copy();
|
||||
// }
|
||||
// if (AC.GetPresupuestoIngresos(-1, DateTime.Now.Year, true, UsuarioActual.CveEmpresa))
|
||||
// {
|
||||
// DTPresupuestoIngresos = AC.DtResultados.Copy();
|
||||
// }
|
||||
|
||||
// if (Detalles != null && DTPresupuestoIngresos != null)
|
||||
// {
|
||||
// var query = from gvr in Detalles.AsEnumerable()
|
||||
// group gvr by gvr["CvePresupuestoIngreso"].ToString().ToEntero() into g
|
||||
// select new { TotalImporte = g.Sum((x) => x["Total"].ToString().ToDouble()), CvePresupuestoIngreso = g.Key };
|
||||
|
||||
// foreach (var item in query)
|
||||
// {
|
||||
// dr = DTPresupuestoIngresos.FiltroPrimero(string.Format("CvePresupuestoIngreso = {0}", item.CvePresupuestoIngreso));
|
||||
// if (dr != null)
|
||||
// {
|
||||
// Concepto = string.Format("{0} - {1}: {2}", NombreCliente, TipoComprobante, Folio);
|
||||
// if (ObjAC.AddMovimiento(IDPoliza, dr["IdCuentaPorEjecutar"].ToString().ToEntero(), false, (Paridad * item.TotalImporte), "", Concepto, 0, Fecha, ""))
|
||||
// {
|
||||
// if (ObjAC.AddMovimiento(IDPoliza, dr["IdCuentaDevengado"].ToString().ToEntero(), true, (Paridad * item.TotalImporte), "", Concepto, 0, Fecha, ""))
|
||||
// {
|
||||
// // CARGO la deuda del cliente
|
||||
// if (ObjAC.AddMovimiento(IDPoliza, CtaCliente, TipoMovto, item.TotalImporte, "", Concepto, 0, Fecha, ""))
|
||||
// {
|
||||
// // abono,
|
||||
// if (!ObjAC.AddMovimiento(IDPoliza, dr["IdCuentaMatriz"].ToString().ToEntero(), !TipoMovto, item.TotalImporte, "", Concepto, 0, Fecha, ""))
|
||||
// {
|
||||
// ErrorAC = true;
|
||||
// break;
|
||||
// }
|
||||
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// ErrorAC = true;
|
||||
// break;
|
||||
// }
|
||||
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// ErrorAC = true;
|
||||
// break;
|
||||
// }
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// ErrorAC = true;
|
||||
// break;
|
||||
// }
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// ErrorAC = true;
|
||||
// break;
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// ErrorAC = true;
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// ErrorAC = true;
|
||||
// }
|
||||
|
||||
// if (!ErrorAC)
|
||||
// {
|
||||
// ObjAC.AjustaPoliza(IDPoliza);
|
||||
// Retorno = IDPoliza;
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// Alert("Error al Agregar la Póliza de AC.", TipoMensaje.MsgError);
|
||||
// }
|
||||
// AC.Dispose();
|
||||
// ObjVentas.Dispose();
|
||||
|
||||
// return Retorno;
|
||||
//}
|
||||
|
||||
private string DecodeBase64(string strXMLCodificado)
|
||||
{
|
||||
try
|
||||
@@ -429,8 +301,124 @@ public partial class Ventas_RepCancelacionesPorRespuesta : ClsPaginas
|
||||
{
|
||||
if (e.Row.DBCampo("PuedeRefacturar").ToString().ToEntero() == 0)
|
||||
{
|
||||
e.Row.Cells[8].Text = "";
|
||||
e.Row.Cells[10].Text = "";
|
||||
}
|
||||
}
|
||||
}
|
||||
public void BtnEnviarMailCancelacion_Click(object sender, EventArgs e)
|
||||
{
|
||||
ImprimeCancelacion(CveVenta);
|
||||
}
|
||||
|
||||
public void ImprimeCancelacion(int CveVenta)
|
||||
{
|
||||
var Archivo = new System.IO.FileInfo(ModExtensiones.DirectorioBaseEmpresas + @"Empresas\Grales\Formatos\AcuseCancelacion.rdlc");
|
||||
if (Archivo.Exists)
|
||||
{
|
||||
var ObjFactura = new Modelos.Factura(UsuarioActual, CveVenta, UsuarioActual.CveEmpresa);
|
||||
|
||||
string SelloCancelacion = "";
|
||||
string FechaCancelacion = "";
|
||||
DataTable DtDatos = null;
|
||||
|
||||
using (ClsVentas ObjVentas = new ClsVentas())
|
||||
{
|
||||
if (ObjVentas.GetVenta(CveVenta, UsuarioActual.CveEmpresa))
|
||||
{
|
||||
DtDatos = ObjVentas.DtResultados.Copy();
|
||||
|
||||
DataRow drv = DtDatos.Rows[0];
|
||||
SelloCancelacion = drv["SelloCancelacion"].ToString();
|
||||
FechaCancelacion = drv["FechaCancelacion"].ToString().ToDateTime().ToString("dd/MM/yyyy HH:mm:ss");
|
||||
}
|
||||
}
|
||||
|
||||
List<ReportParameter> parametros = new List<ReportParameter>();
|
||||
parametros.Add(new ReportParameter("FechaCancelacion", FechaCancelacion.ToString()));
|
||||
parametros.Add(new ReportParameter("FolioFiscal", ObjFactura.FolioFiscal));
|
||||
parametros.Add(new ReportParameter("RFCEmisor", UsuarioActual.Empresa.RFC));
|
||||
parametros.Add(new ReportParameter("SelloCancelacion", SelloCancelacion));
|
||||
|
||||
byte[] ObjetoPDF = StreamPDF(@"Empresas\Grales\Formatos\AcuseCancelacion.rdlc", DtDatos, parametros, "AcuseCancelacion" + CveVenta);
|
||||
|
||||
|
||||
List<ClsSisMail.ArchivoMail> LSRutasMail = new List<ClsSisMail.ArchivoMail>();
|
||||
string Asunto = string.Empty;
|
||||
string Cuerpo = string.Empty;
|
||||
|
||||
StringBuilder sb = new StringBuilder();
|
||||
if (UsuarioActual.CveEmpresa == 119)
|
||||
{
|
||||
sb.Append("<!DOCTYPE html>");
|
||||
sb.Append("<html>");
|
||||
sb.Append("<head>");
|
||||
sb.Append("<meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\"/>");
|
||||
sb.Append(" <title>Acuse De Cancelación</title>");
|
||||
sb.Append(" <meta charset=\"utf-8\" />");
|
||||
sb.Append("</head>");
|
||||
sb.Append("<body>");
|
||||
sb.Append(" <font face=\"calibri\">");
|
||||
sb.Append($" Estimado Cliente <b>{ObjFactura.Cliente.Nombre}</b>,<br /><br />");
|
||||
sb.Append($" Le informamos que Agroquímicos JAM, S.A. DE C.V ha cancelado el CFDI <b>{ObjFactura.SerieFolio}</b>, el cual ha quedado sin Efectos Fiscales y encontrará adjunto en este correo el Acuse de <br />");
|
||||
sb.Append($" cancelación del SAT.<br />");
|
||||
sb.Append(" POR LO QUE PEDIMOS ELIMINARLO Y NO INCLUIRLO EN SU CONTABILIDAD, YA QUE PUEDE REPRESENTAR UN PROBLEMA FISCAL PARA USTED O SU EMPRESA CUANDO EL SAT REALICE UNA FUTURA AUDITORIA <br /> ");
|
||||
sb.Append(" EN SU CONTABILIDAD. </font> ");
|
||||
sb.Append(" <font face=\"calibri\" size=\"2\">");
|
||||
sb.Append(" <br /><br /><br /><br /><br />");
|
||||
sb.Append(" <i>Este correo se generó automaticamente, favor de no responder este mensaje.</i>");
|
||||
sb.Append(" </font>");
|
||||
sb.Append("</body>");
|
||||
sb.Append("</html>");
|
||||
}
|
||||
else
|
||||
{
|
||||
sb.Append("<!DOCTYPE html>");
|
||||
sb.Append("<html>");
|
||||
sb.Append("<head>");
|
||||
sb.Append("<meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\"/>");
|
||||
sb.Append(" <title>Acuse De Cancelación</title>");
|
||||
sb.Append(" <meta charset=\"utf-8\" />");
|
||||
sb.Append("</head>");
|
||||
sb.Append("<body>");
|
||||
sb.Append(" <font face=\"calibri\">");
|
||||
sb.Append($" Estimado Cliente <b>{ObjFactura.Cliente.Nombre}</b>,<br /><br />");
|
||||
sb.Append($" A través del presente medio la Empresa <b>{UsuarioActual.Empresa.Empresa} - {UsuarioActual.Empresa.RFC}</b>, canceló el documento tipo <b>{ObjFactura.TipodeComprobante}</b> <br />");
|
||||
sb.Append($" con folio <b>{ObjFactura.SerieFolio}</b> y el Importe de <b>${ObjFactura.Total}</b>. <br /><br />");
|
||||
sb.Append(" Le hacemos llegar el acuse de cancelación. </font> ");
|
||||
sb.Append(" <font face=\"calibri\" size=\"2\">");
|
||||
sb.Append(" <br /><br /><br /><br /><br />");
|
||||
sb.Append(" <i>Este correo se generó automaticamente, favor de no responder este mensaje.</i>");
|
||||
sb.Append(" </font>");
|
||||
sb.Append("</body>");
|
||||
sb.Append("</html>");
|
||||
}
|
||||
Asunto = $"Acuse de Cancelacion {ObjFactura.SerieFolio}";
|
||||
Cuerpo = sb.ToString();
|
||||
string DisplayName = "";
|
||||
if (UsuarioActual.CveEmpresa == 119)
|
||||
DisplayName = "Facturación Agroquímicos JAM";
|
||||
|
||||
LSRutasMail.Add(new ClsSisMail.ArchivoMail() { ArchivoBinario = ObjetoPDF, NombreArchivo = $"AcuseCancelacion{ObjFactura.SerieFolio}.pdf" });
|
||||
|
||||
ClsSisMail ObjMail = new ClsSisMail();
|
||||
if (ObjMail.SendMail(UsuarioActual.Empresa, ObjFactura.Cliente.Mail, Asunto, Cuerpo, "", LSRutasMail, Displayname: DisplayName))
|
||||
{
|
||||
Alert("El acuse de cancelación ha sido envíado correctamente.");
|
||||
}
|
||||
else
|
||||
{
|
||||
Alert("El acuse de cancelación no pudo ser enviado.",TipoMensaje.MsgError);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
public class MRespuestaSAT
|
||||
{
|
||||
public bool EnviarAcuse { get; set; }
|
||||
public string LigaRefacturacion { get; set; }
|
||||
public bool IrARefacturar { get; set; }
|
||||
public string Mensaje { get; set; }
|
||||
}
|
||||
Reference in New Issue
Block a user