SIG. Cambios en acuse de validacion del SAT
This commit is contained in:
@@ -724,7 +724,7 @@ Public Class ClsVentas
|
||||
Public Function UpdateEstatusFactura(Estatus As Integer, FolioFiscal As String, SelloSAT As String, FechaCancelacion As DateTime, CveVenta As Integer,
|
||||
Optional IdPolizaCancelacion As Integer = -1, Optional CvePAC As Integer = -1, Optional CveEstatusRefacturacion As Integer = 0,
|
||||
Optional CveUsuarioCambiaEstatus As Integer = -1, Optional FechaCambioEstatus As String = "-1", Optional RFCReceptor As String = "-1",
|
||||
Optional CveMotivoCancelacion As Integer = -1, Optional MotivoCancelacion As String = "") As Boolean
|
||||
Optional CveMotivoCancelacion As Integer = -1, Optional MotivoCancelacion As String = "", Optional EstadoCancelacion As String = "") As Boolean
|
||||
Dim Retorno As Boolean = False
|
||||
|
||||
DataAdapter("PA_VentasUpdateEstatus")
|
||||
@@ -743,6 +743,7 @@ Public Class ClsVentas
|
||||
.Add("@RFCReceptor", SqlDbType.VarChar).Value = RFCReceptor
|
||||
.Add("@CveMotivoCancelacion", SqlDbType.Int).Value = CveMotivoCancelacion
|
||||
.Add("@MotivoCancelacion", SqlDbType.VarChar).Value = MotivoCancelacion
|
||||
.Add("@EstadoCancelacion", SqlDbType.VarChar).Value = EstadoCancelacion
|
||||
End With
|
||||
|
||||
Try
|
||||
@@ -833,7 +834,7 @@ Public Class ClsVentas
|
||||
|
||||
Return Retorno
|
||||
End Function
|
||||
Public Function UpdateCancelaVenta(CveVenta As Integer, FechaCancelacion As DateTime, SelloCancelacionSAT As String, CveEmpresa As Integer, Optional CvePAC As Integer = -1, Optional CveEstatusRefacturacion As Integer = 0) As Boolean
|
||||
Public Function UpdateCancelaVenta(CveVenta As Integer, FechaCancelacion As DateTime, SelloCancelacionSAT As String, CveEmpresa As Integer, Optional CvePAC As Integer = -1, Optional CveEstatusRefacturacion As Integer = 0, Optional EstadoCancelacion As String = "") As Boolean
|
||||
Dim Retorno As Boolean = False
|
||||
|
||||
DataAdapter("PA_Vta_VentasCancelacion")
|
||||
@@ -845,6 +846,7 @@ Public Class ClsVentas
|
||||
.Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa
|
||||
.Add("@CvePAC", SqlDbType.SmallInt).Value = CvePAC
|
||||
.Add("@CveEstatusRefacturacion", SqlDbType.TinyInt).Value = CveEstatusRefacturacion
|
||||
.Add("@EstadoCancelacion", SqlDbType.VarChar).Value = EstadoCancelacion
|
||||
.Add("@Cancelada", SqlDbType.SmallInt).Direction = ParameterDirection.Output
|
||||
End With
|
||||
|
||||
|
||||
@@ -4763,6 +4763,7 @@ Namespace Modelos
|
||||
Dim CancelacionFecha As Date
|
||||
Dim FolioFiscal As String = ObjFactura.FolioFiscal
|
||||
Dim CancelacionAcuse As String = ""
|
||||
Dim EstadoCancelacion As String = ""
|
||||
Dim MensajeError As String = ""
|
||||
Dim ObjCancelacion As New Timbrado
|
||||
Dim TotalT As Decimal = ObjFactura.Total
|
||||
@@ -4810,6 +4811,9 @@ Namespace Modelos
|
||||
Dim Vigencia = Timbrado.VerificarVigenciaSAT(FolioFiscal, UsuarioActual.Empresa.RFC, RFCReceptor, TotalT.ToString(), UsuarioActual.Empresa.FacturaProduccion)
|
||||
|
||||
If Vigencia IsNot Nothing Then
|
||||
|
||||
EstadoCancelacion = Vigencia.EsCancelable
|
||||
|
||||
If Vigencia.EsCancelable.ToUpper() = "NO CANCELABLE" Then
|
||||
Retorno.Mensaje = "Esta factura no es cancelable."
|
||||
Retorno.TipoMensaje = TipoMensaje.MsgAdvertencia
|
||||
@@ -5508,13 +5512,13 @@ Namespace Modelos
|
||||
|
||||
|
||||
If CveEstatus.Contiene(4, 5) Then
|
||||
If Not ObjVentas.UpdateCancelaVenta(CveVenta, CancelacionFecha, CancelacionAcuse, UsuarioActual.CveEmpresa, CvePACCancelacion, CveEstatusRefacturacion) Then
|
||||
If Not ObjVentas.UpdateCancelaVenta(CveVenta, CancelacionFecha, CancelacionAcuse, UsuarioActual.CveEmpresa, CvePACCancelacion, CveEstatusRefacturacion, EstadoCancelacion:=EstadoCancelacion) Then
|
||||
ErrorCancelar = True
|
||||
MensajeError = "Ocurrió un error al guardar el estatus de cancelación."
|
||||
End If
|
||||
Else
|
||||
If Not ObjVentas.UpdateEstatusFactura(CveEstatus, FolioFiscal, CancelacionAcuse, CancelacionFecha, CveVenta, IDPoliza, CvePAC:=CvePACCancelacion, CveEstatusRefacturacion:=CveEstatusRefacturacion,
|
||||
CveUsuarioCambiaEstatus:=UsuarioActual.CveUsuario, FechaCambioEstatus:=Now.ToString("yyyy-MM-dd HH:mm:ss.mmm"), CveMotivoCancelacion:=CveMotivoCancelacion, MotivoCancelacion:=MotivoCancelacion) Then
|
||||
CveUsuarioCambiaEstatus:=UsuarioActual.CveUsuario, FechaCambioEstatus:=Now.ToString("yyyy-MM-dd HH:mm:ss.mmm"), CveMotivoCancelacion:=CveMotivoCancelacion, MotivoCancelacion:=MotivoCancelacion, EstadoCancelacion:=EstadoCancelacion) Then
|
||||
ErrorCancelar = True
|
||||
MensajeError = "Ocurrió un error al guardar el estatus de cancelación."
|
||||
End If
|
||||
|
||||
@@ -488,7 +488,8 @@ Public Class Timbrado
|
||||
Dim UrlServicio As String = "" ' Produccion
|
||||
|
||||
'UrlServicio = "http://juancalderon-001-site1.ftempurl.com/timbrado.asmx?WSDL"
|
||||
UrlServicio = "http://alterno.gofac.com.mx/cfdi/timbrado.asmx?WSDL" ' alterno
|
||||
'UrlServicio = "http://alterno.gofac.com.mx/cfdi/timbrado.asmx?WSDL" ' alterno
|
||||
UrlServicio = "https://cfdi.gofac.com.mx/timbrado.asmx?WSDL"
|
||||
|
||||
If Not Empresa.FacturaProduccion Then
|
||||
ArchivoLLave = $"{Empresa.Ruta}Certificados\CSD01_ZUÑ920208KL4.key"
|
||||
@@ -1905,7 +1906,8 @@ Public Class Timbrado
|
||||
UrlServicio = "http://generacfdi.com.mx/rvltimbrado/service1.asmx?WSDL" 'productivo
|
||||
Case 4
|
||||
'UrlServicio = "http://juancalderon-001-site1.ftempurl.com/timbrado.asmx?WSDL"
|
||||
UrlServicio = "http://alterno.gofac.com.mx/cfdi/timbrado.asmx?WSDL" ' alterno
|
||||
'UrlServicio = "http://alterno.gofac.com.mx/cfdi/timbrado.asmx?WSDL" ' alterno
|
||||
UrlServicio = "https://cfdi.gofac.com.mx/timbrado.asmx?WSDL"
|
||||
End Select
|
||||
|
||||
If Not UsuarioActual.Empresa.FacturaProduccion OrElse UsuarioActual.CveEmpresa = 1 Then
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -5725,7 +5725,7 @@
|
||||
<asp:Button ID="BtnRefacturacionConfirmarAceptacion" runat="server" ClientIDMode="Static" Text="Refacturacion Aceptacion Documento" Style="display: none;" />
|
||||
<asp:Button ID="BtnRefrescarPagina" runat="server" ClientIDMode="Static" Text="Refrescar" Style="display: none;" />
|
||||
<asp:Button ID="BtnAplicaNuevaNC" runat="server" ClientIDMode="Static" Text="AplicarNC" Style="display: none;" />
|
||||
|
||||
<asp:HiddenField ID="HdnCveVentaAcuse" runat="server" ClientIDMode="Static" Value="0" />
|
||||
<%--FLETES--%>
|
||||
<div id="ModalFletes" class="modal ADS fade" role="dialog">
|
||||
<asp:UpdatePanel ID="UpFletes" class="modal-dialog rowpadding" tabindex="-1" runat="server" UpdateMode="Conditional">
|
||||
@@ -7080,10 +7080,10 @@
|
||||
</div>
|
||||
|
||||
<div class="row" id="DivRelacionadasCancelacion" runat="server" visible="false">
|
||||
<div class="col-md-6">
|
||||
<div class="col-md-12">
|
||||
<div class="row">
|
||||
<div class="col-md-12">
|
||||
Facturas Padre
|
||||
Facturas que impiden su cancelación
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
@@ -7097,9 +7097,8 @@
|
||||
</asp:GridView>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<div class="col-md-6">
|
||||
<%-- <div class="col-md-6">
|
||||
<div class="row">
|
||||
<div class="col-md-12">
|
||||
Facturas Hijo
|
||||
@@ -7117,7 +7116,7 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>--%>
|
||||
</div>
|
||||
<br />
|
||||
<div class="row" id="DivMotivoCancelacion" runat="server">
|
||||
@@ -7803,24 +7802,54 @@
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-md-2">
|
||||
<label>Motivo:</label>
|
||||
</div>
|
||||
<div class="col-md-10">
|
||||
<asp:DropDownList ID="DdlMotivoRefacturacion" CssClass=" form-control input-sm select2me" runat="server" Width="100%" DataTextField="MotivoCancelacion" DataValueField="CveMotivoCancelacion">
|
||||
</asp:DropDownList>
|
||||
<asp:RequiredFieldValidator ID="RFVDdlMotivoRefac" runat="server" CssClass="help-block errorimput" Display="Dynamic" InitialValue="-1" ControlToValidate="DdlMotivoRefacturacion" ErrorMessage="<b><span style='text-decoration: underline'>ERROR:</span></b><br />El campo <b>''Motivo''</b> es necesario, por favor ingréselo." ValidationGroup="GrpMotivo"></asp:RequiredFieldValidator>
|
||||
<div class="col-md-12">
|
||||
<asp:Label ID="LbExtraRefacturacion" runat="server"></asp:Label>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-md-2">
|
||||
<label>Descripción:</label>
|
||||
</div>
|
||||
<div class="col-md-10">
|
||||
<asp:TextBox ID="TxtMotivoRefac" runat="server" Height="100" Width="100%" TextMode="MultiLine" CausesValidation="true" MaxLength="500"></asp:TextBox>
|
||||
<asp:RequiredFieldValidator ID="RFVTxtMotivoRefac" runat="server" Display="Dynamic" CssClass="help-block errorimput" ControlToValidate="TxtMotivoRefac" ErrorMessage="<b><span style='text-decoration: underline'>ERROR:</span></b><br />El campo <b>''Descripción''</b> es necesario, por favor ingréselo." ValidationGroup="GrpMotivo"></asp:RequiredFieldValidator>
|
||||
<div class="row" id="DivRelacionadasRefacturacion" runat="server" visible="false">
|
||||
<div class="col-md-12">
|
||||
<div class="row">
|
||||
<div class="col-md-12">
|
||||
Facturas que impiden su cancelación
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-md-12">
|
||||
<asp:GridView ID="GvFacturasPadreRefacturar" runat="server" DataKeyNames="CveVenta" CssClass="table table-striped table-hover Widthall" AutoGenerateColumns="False" ClientIDMode="Static" EmptyDataText="" GridLines="None">
|
||||
<Columns>
|
||||
<asp:HyperLinkField DataTextField="SerieFolio" HeaderText="Serie Folio" Target="_blank" DataNavigateUrlFields="CveVenta" DataNavigateUrlFormatString="/Ventas/Ventas.aspx?CveVenta={0}" />
|
||||
<asp:BoundField DataField="TipoDocto" HeaderText="Tipo" />
|
||||
<asp:BoundField DataField="FolioFiscal" HeaderText="Folio Fiscal" />
|
||||
</Columns>
|
||||
</asp:GridView>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row" id="DivMotivoRefacturacionTexto" runat="server">
|
||||
<div class="col-md-12">
|
||||
<div class="row">
|
||||
<div class="col-md-2">
|
||||
<label>Motivo:</label>
|
||||
</div>
|
||||
<div class="col-md-10">
|
||||
<asp:DropDownList ID="DdlMotivoRefacturacion" CssClass=" form-control input-sm select2me" runat="server" Width="100%" DataTextField="MotivoCancelacion" DataValueField="CveMotivoCancelacion">
|
||||
</asp:DropDownList>
|
||||
<asp:RequiredFieldValidator ID="RFVDdlMotivoRefac" runat="server" CssClass="help-block errorimput" Display="Dynamic" InitialValue="-1" ControlToValidate="DdlMotivoRefacturacion" ErrorMessage="<b><span style='text-decoration: underline'>ERROR:</span></b><br />El campo <b>''Motivo''</b> es necesario, por favor ingréselo." ValidationGroup="GrpMotivo"></asp:RequiredFieldValidator>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-md-2">
|
||||
<label>Descripción:</label>
|
||||
</div>
|
||||
<div class="col-md-10">
|
||||
<asp:TextBox ID="TxtMotivoRefac" runat="server" Height="100" Width="100%" TextMode="MultiLine" CausesValidation="true" MaxLength="500"></asp:TextBox>
|
||||
<asp:RequiredFieldValidator ID="RFVTxtMotivoRefac" runat="server" Display="Dynamic" CssClass="help-block errorimput" ControlToValidate="TxtMotivoRefac" ErrorMessage="<b><span style='text-decoration: underline'>ERROR:</span></b><br />El campo <b>''Descripción''</b> es necesario, por favor ingréselo." ValidationGroup="GrpMotivo"></asp:RequiredFieldValidator>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<asp:LinkButton ID="BtnMotivoRefacturacion" runat="server" CssClass="btn btn-primary" ValidationGroup="GrpMotivo"> Refacturar</asp:LinkButton>
|
||||
@@ -9285,7 +9314,8 @@
|
||||
$('#BtnMateriales').click();
|
||||
}
|
||||
|
||||
function BtnEnviarMailCancelacion() {
|
||||
function BtnEnviarMailCancelacion(CveVenta) {
|
||||
HdnCveVentaAcuse.value = CveVenta;
|
||||
$('#BtnEnviarMailCancelacion').click();
|
||||
}
|
||||
function BtnRefacturacionConfirmar() {
|
||||
@@ -9304,6 +9334,10 @@
|
||||
$('#BtnAplicaNuevaNC').click();
|
||||
}
|
||||
|
||||
function BtnAplicaNuevaNC() {
|
||||
$('#BtnAplicaNuevaNC').click();
|
||||
}
|
||||
|
||||
$('.DdlPS').on("select2:open", function (e) { $('.select2-container.select2-container--default .select2-dropdown .select2anothertable').remove(); });
|
||||
$('.DdlPSPyME').on("select2:open", function (e) { $('.select2-container.select2-container--default .select2-dropdown .select2anothertable').remove(); });
|
||||
|
||||
|
||||
@@ -1310,14 +1310,7 @@ Partial Class Ventas
|
||||
ViewState("CveVentaUsadoDevolucionEfectivo") = value
|
||||
End Set
|
||||
End Property
|
||||
Private Property CveFormaPago33Cliente As Integer
|
||||
Get
|
||||
Return If(IsNothing(ViewState("CveFormaPago33Cliente")), -1, ViewState("CveFormaPago33Cliente")).ToString().ToEntero
|
||||
End Get
|
||||
Set(value As Integer)
|
||||
ViewState("CveFormaPago33Cliente") = value
|
||||
End Set
|
||||
End Property
|
||||
|
||||
|
||||
Private Property RFCReceptorVenta As String
|
||||
Get
|
||||
@@ -1887,6 +1880,22 @@ Partial Class Ventas
|
||||
ViewState("CveFormaPago33Venta") = value
|
||||
End Set
|
||||
End Property
|
||||
Private Property CveMetodoPago33Cliente As Integer
|
||||
Get
|
||||
Return If(IsNothing(ViewState("CveMetodoPago33Cliente")), -1, ViewState("CveMetodoPago33Cliente")).ToString().ToEntero
|
||||
End Get
|
||||
Set(value As Integer)
|
||||
ViewState("CveMetodoPago33Cliente") = value
|
||||
End Set
|
||||
End Property
|
||||
Private Property CveFormaPago33Cliente As Integer
|
||||
Get
|
||||
Return If(IsNothing(ViewState("CveFormaPago33Cliente")), -1, ViewState("CveFormaPago33Cliente")).ToString().ToEntero
|
||||
End Get
|
||||
Set(value As Integer)
|
||||
ViewState("CveFormaPago33Cliente") = value
|
||||
End Set
|
||||
End Property
|
||||
|
||||
Private Property CveVendedorVenta As Integer
|
||||
Get
|
||||
@@ -2068,6 +2077,15 @@ Partial Class Ventas
|
||||
End Set
|
||||
End Property
|
||||
|
||||
Private Property EsGarantia As Boolean
|
||||
Get
|
||||
Return CBool(IfNull(ViewState("EsGarantia"), False, ViewState("EsGarantia")))
|
||||
End Get
|
||||
Set(value As Boolean)
|
||||
ViewState("EsGarantia") = value
|
||||
End Set
|
||||
End Property
|
||||
|
||||
#End Region
|
||||
|
||||
'#Region "AuxiliarConta"
|
||||
@@ -2159,6 +2177,7 @@ Partial Class Ventas
|
||||
ViewState("CvePrecioLista") = 0
|
||||
ViewState("CvePrecioListaCliente") = 0
|
||||
Me.CveVendedorVenta = -1
|
||||
Me.EsGarantia = False
|
||||
idCuentaContabilizacion = 1
|
||||
CveEmpresaCRM = 0
|
||||
CveAcercamientoCRM = 0
|
||||
@@ -3057,6 +3076,15 @@ Partial Class Ventas
|
||||
|
||||
End If
|
||||
|
||||
'QUITAR ESTAS OPCIONES SI LA FACTURA VA SER CANCELADA O ESTA CANCELADA
|
||||
If CveEstatus.Contiene(4, 5, 12, 13, 20, 23) Then
|
||||
LBNotaCredito.Visible = False
|
||||
LnkAplicarRNCDevolucion.Visible = False
|
||||
HLPagar.Visible = False
|
||||
HLSaldarVenta.Visible = False
|
||||
HlFacturasRelaciondas.Visible = False
|
||||
End If
|
||||
|
||||
End If
|
||||
|
||||
''EN REALIDAD SE OCUPAN ESTAS COSAS DENTRO DEL POSTABCK ???
|
||||
@@ -3108,8 +3136,6 @@ Partial Class Ventas
|
||||
|
||||
'End If
|
||||
|
||||
'UNA VEZ CARGADA LAS CONDICIONES DE PAGO INICIALMENTE, NO VUELVE A SOBREESCRIBIR EL VALOR
|
||||
CveFormaPago33Cliente = -1
|
||||
|
||||
If UsuarioActual.Empresa.Funcionalidad(558) = "1" Then
|
||||
trRotacion.Visible = True
|
||||
@@ -4197,6 +4223,8 @@ Partial Class Ventas
|
||||
|
||||
ViewState("CveSubProyectoVenta") = DbRowVenta("CveSubProyecto").ToString().ToEntero()
|
||||
|
||||
Me.EsGarantia = CBool(DbRowVenta("EsGarantia"))
|
||||
|
||||
Me.CveEstatusFacturaPadre = DbRowVenta("CveEstatusFacturaPadre").ToString().ToEntero()
|
||||
'CargaEncabezado
|
||||
If Not (CveRemision > 0 Or CveCotizacion > 0) Then
|
||||
@@ -4224,7 +4252,7 @@ Partial Class Ventas
|
||||
'End If
|
||||
|
||||
|
||||
If Not CveEstatus.Contiene(4, 5, 12, 13, 20) AndAlso DdlTipoComprobante.SelectedValue.Contiene("Ing", "Egs", "Ant") AndAlso UsuarioActual.TienePermisoProceso(159) Then
|
||||
If Not CveEstatus.Contiene(4, 5, 12, 13, 20, 23) AndAlso DdlTipoComprobante.SelectedValue.Contiene("Ing", "Egs", "Ant") AndAlso UsuarioActual.TienePermisoProceso(159) Then
|
||||
Dim TienePermiso As String = GlobalDTSubProyectosUsuarios(UsuarioActual.CveUsuario, -1, UsuarioActual.CveEmpresa, -1, -1).FiltroPrimeroValor("CveSubProyecto", String.Format("CveSubProyecto = {0}", DbRowVenta("CveSubProyecto")))
|
||||
If TienePermiso <> "" Then
|
||||
LkRefacturacion.Visible = True
|
||||
@@ -5859,16 +5887,27 @@ Partial Class Ventas
|
||||
|
||||
Dim CveCotizacion As Integer = IfNull(ViewState("CveCotizacion"), 0).ToString().ToEntero()
|
||||
|
||||
Me.CveMetodoPago33Cliente = ObjCliente.CveMetodoPago33
|
||||
Me.CveFormaPago33Cliente = ObjCliente.CveFormaPago33
|
||||
|
||||
If (CveVenta <= 0 AndAlso CveCotizacion <= 0) Or EsCreaApartirDe Or NuevaFactura = 1 OrElse ModalidadEdicion Then
|
||||
'CveMetodoPagoCliente = ObjCliente.CveMetodoPago
|
||||
|
||||
|
||||
DdlMetodoPago33.SelectedValueExist(ObjCliente.CveMetodoPago33)
|
||||
CambiaMetodoPago33()
|
||||
DdlFormaPago33.SelectedValueExist(ObjCliente.CveFormaPago33)
|
||||
If UsuarioActual.Empresa.Funcionalidad(589) = "1" Then
|
||||
'SI EL METODO DE PAGO ES PUE, SELECCIONA CONTADO
|
||||
If Me.CveMetodoPago33Cliente = 1 Then
|
||||
RBLPago.SelectedValue = "2"
|
||||
ElseIf Me.CveMetodoPago33Cliente = 3 Then
|
||||
RBLPago.SelectedValue = "1"
|
||||
End If
|
||||
RBLPago_SelectedIndexChanged(RBLPago, Nothing)
|
||||
UPCondicionesPago.Update()
|
||||
Else
|
||||
DdlMetodoPago33.SelectedValueExist(ObjCliente.CveMetodoPago33)
|
||||
CambiaMetodoPago33()
|
||||
DdlFormaPago33.SelectedValueExist(ObjCliente.CveFormaPago33)
|
||||
End If
|
||||
DdlUsoCFDI.SelectedValueExist(ObjCliente.CveUsoCFDI)
|
||||
|
||||
End If
|
||||
|
||||
PlazoCobranza = ObjCliente.PlazoCobranza
|
||||
@@ -6397,9 +6436,21 @@ Partial Class Ventas
|
||||
If ((DdlTipoComprobante.SelectedValue.Contiene("Ing", "Ant", "Rem", "Cot", "PA") AndAlso CveVenta <= 0) OrElse (DdlTipoComprobante.SelectedValue.Contiene("Cot") AndAlso CveVenta > 0)) AndAlso RBLPago.SelectedValue = "1" AndAlso PermiteCredito Then
|
||||
'FUNCIONALIDAD 702 - NO VERIFICAR LIMITE DE CRÉDITO Y CANDADOS DE VENTA
|
||||
If Not UsuarioActual.Empresa.Funcionalidad(702) = "1" Then
|
||||
RBLPago.SelectedValue = "1"
|
||||
RBLPago_SelectedIndexChanged(Nothing, Nothing)
|
||||
UPCondicionesPago.Update()
|
||||
If UsuarioActual.Empresa.Funcionalidad(589) = "1" Then
|
||||
'SI EL METODO DE PAGO ES PUE, SELECCIONA CONTADO
|
||||
If Me.CveMetodoPago33Cliente = 1 Then
|
||||
RBLPago.SelectedValue = "2"
|
||||
ElseIf Me.CveMetodoPago33Cliente = 3 Then
|
||||
RBLPago.SelectedValue = "1"
|
||||
End If
|
||||
RBLPago_SelectedIndexChanged(RBLPago, Nothing)
|
||||
UPCondicionesPago.Update()
|
||||
Else
|
||||
RBLPago.SelectedValue = "1"
|
||||
RBLPago_SelectedIndexChanged(RBLPago, Nothing)
|
||||
UPCondicionesPago.Update()
|
||||
End If
|
||||
|
||||
|
||||
Dim CreditoDispo As Decimal = CargaCreditoDisponible(CveCliente, DdlSucursalCliente.SelectedValue.ToEntero())
|
||||
|
||||
@@ -8774,6 +8825,8 @@ Partial Class Ventas
|
||||
Dim SeTimbroNC As Boolean = False
|
||||
Dim EstatusSMS = 0
|
||||
|
||||
Dim MsgCancelacionRefacturacion As Modelos.Factura.MCancelacionVentaMensaje = Nothing
|
||||
|
||||
'TIMBRADO Y CASO ESPECIAL NOTA DE CREDITO
|
||||
If (TipoDoctoDevolucion = "" OrElse Not TipoDoctoDevolucion.Contiene("Rem", "RNC", "Cot", "Ped", "DPe", "PA", "Pd2")) Then
|
||||
|
||||
@@ -8790,12 +8843,14 @@ Partial Class Ventas
|
||||
DebeTimbrar = False
|
||||
End If
|
||||
|
||||
If UsuarioActual.TienePermisoProceso(335) Then
|
||||
DebeTimbrar = False
|
||||
End If
|
||||
|
||||
If ObjFactura.TipoDocto.Contiene("Ing", "Egs", "Ant", "Dev") Then
|
||||
If DebeTimbrar AndAlso ObjFactura.TipoDocto.Contiene("Ing", "Egs", "Ant", "Dev") Then
|
||||
If UsuarioActual.Empresa.TipoFacturacion = "CFDi" AndAlso (UsuarioActual.Empresa.FacturaProduccion OrElse UsuarioActual.CveEmpresa = 1) Then
|
||||
|
||||
'FACTURA INGRESO/EGRESO
|
||||
|
||||
Dim FM As New Modelos.FemsaFactura
|
||||
Dim TmpDT7Eleven As New DataTable
|
||||
Dim TmpDTComplementosTimbrado As New DataTable
|
||||
@@ -8804,64 +8859,50 @@ Partial Class Ventas
|
||||
PrepararTimbrado(FM, TmpDT7Eleven, TmpDTComplementosTimbrado)
|
||||
End If
|
||||
|
||||
'DOCUMENTO ACTUAL
|
||||
If DebeTimbrar Then
|
||||
Dim ObjTimbrado As New Timbrado
|
||||
SeTimbro = ObjTimbrado.TimbrarFactura(UsuarioActual, ObjFactura)
|
||||
Dim FolioFiscalFactura As String = ObjTimbrado.UUID
|
||||
Dim MsgErrorTimbrado = ObjTimbrado.MensajeErrorCFDI
|
||||
ObjTimbrado = Nothing
|
||||
|
||||
Dim ObjTimbrado As New Timbrado
|
||||
SeTimbro = ObjTimbrado.TimbrarFactura(UsuarioActual, ObjFactura)
|
||||
Dim FolioFiscalFactura As String = ObjTimbrado.UUID
|
||||
Dim MsgErrorTimbrado = ObjTimbrado.MensajeErrorCFDI
|
||||
ObjTimbrado = Nothing
|
||||
'NOTA DE CREDITO - REFACTURADA - CASO ESPECIAL, TIMBRADO E IMPRESION
|
||||
If DebeTimbrar AndAlso ListaNotasCreditoGeneradas.Count > 0 Then
|
||||
Try
|
||||
For Each NCGenerada In ListaNotasCreditoGeneradas
|
||||
If NCGenerada.Timbre IsNot Nothing Then
|
||||
NCGenerada.Timbre.CFDIRelacionados.UUID.Clear()
|
||||
NCGenerada.Timbre.CFDIRelacionados.UUID.Add(FolioFiscalFactura)
|
||||
|
||||
Dim ObjTimbradoNC As New Timbrado
|
||||
Dim TimbroNC = ObjTimbradoNC.TimbrarFactura(UsuarioActual, NCGenerada)
|
||||
|
||||
'NOTA DE CREDITO - REFACTURADA - CASO ESPECIAL, TIMBRADO E IMPRESION
|
||||
If ListaNotasCreditoGeneradas.Count > 0 Then
|
||||
Try
|
||||
For Each NCGenerada In ListaNotasCreditoGeneradas
|
||||
If NCGenerada.Timbre IsNot Nothing Then
|
||||
NCGenerada.Timbre.CFDIRelacionados.UUID.Clear()
|
||||
NCGenerada.Timbre.CFDIRelacionados.UUID.Add(FolioFiscalFactura)
|
||||
|
||||
Dim ObjTimbradoNC As New Timbrado
|
||||
Dim TimbroNC = ObjTimbradoNC.TimbrarFactura(UsuarioActual, NCGenerada)
|
||||
|
||||
If Not TimbroNC Then
|
||||
Alert(ObjTimbradoNC.MensajeErrorCFDI, TipoMensaje.MsgError)
|
||||
End If
|
||||
ObjTimbradoNC = Nothing
|
||||
If Not TimbroNC Then
|
||||
Alert(ObjTimbradoNC.MensajeErrorCFDI, TipoMensaje.MsgError)
|
||||
End If
|
||||
Next
|
||||
Catch ex As Exception
|
||||
OnError("Ocurrió un error al timbrar la NC.", ex)
|
||||
End Try
|
||||
|
||||
End If
|
||||
|
||||
If SeTimbro AndAlso ObjFactura.TipoDocto.Contiene("Ing") Then
|
||||
EstatusSMS = EnviarSMSTimbrado(ObjEventos)
|
||||
End If
|
||||
|
||||
If Not SeTimbro Then
|
||||
Alert(MsgErrorTimbrado, TipoMensaje.MsgError)
|
||||
End If
|
||||
|
||||
'CANCELAR FACTURA ANTERIOR
|
||||
If SeTimbro AndAlso (Me.CveDevolucion > 0 AndAlso Me.NuevaFactura = 1) Then
|
||||
If Me.ObjFacturaNC IsNot Nothing Then
|
||||
Me.ObjFacturaNC.CveEstatusRefacturacion = 2 'MARCAR COMO REFACTURADA
|
||||
Me.ObjFacturaNC.CancelarPorRefacturacion(Me.ObjFacturaNC.CveMotivoCancelacion, Me.ObjFacturaNC.MotivoCancelacion, FolioFiscalFactura)
|
||||
End If
|
||||
End If
|
||||
ObjTimbradoNC = Nothing
|
||||
End If
|
||||
Next
|
||||
Catch ex As Exception
|
||||
OnError("Ocurrió un error al timbrar la NC.", ex)
|
||||
End Try
|
||||
|
||||
End If
|
||||
|
||||
''NOTA DE CREDITO DE REFACTURACION
|
||||
'If RefacturacionGeneroNC Then
|
||||
' If Not IsNothing(ObjNC) AndAlso ObjNC.Count > 0 Then
|
||||
' Dim ofa As Modelos.Factura = CType(ObjNC(0), Modelos.Factura)
|
||||
' SeTimbroNC = ObjTimbrado.TimbrarFactura(UsuarioActual, ofa)
|
||||
' End If
|
||||
'End If
|
||||
If SeTimbro AndAlso ObjFactura.TipoDocto.Contiene("Ing") Then
|
||||
EstatusSMS = EnviarSMSTimbrado(ObjEventos)
|
||||
End If
|
||||
|
||||
If Not SeTimbro Then
|
||||
Alert(MsgErrorTimbrado, TipoMensaje.MsgError)
|
||||
End If
|
||||
|
||||
'CANCELAR FACTURA ANTERIOR
|
||||
If SeTimbro AndAlso (Me.CveDevolucion > 0 AndAlso Me.NuevaFactura = 1) Then
|
||||
If Me.ObjFacturaNC IsNot Nothing Then
|
||||
Me.ObjFacturaNC.CveEstatusRefacturacion = 2 'MARCAR COMO REFACTURADA
|
||||
MsgCancelacionRefacturacion = Me.ObjFacturaNC.CancelarPorRefacturacion(Me.ObjFacturaNC.CveMotivoCancelacion, Me.ObjFacturaNC.MotivoCancelacion, FolioFiscalFactura)
|
||||
End If
|
||||
End If
|
||||
End If
|
||||
End If
|
||||
|
||||
@@ -9008,6 +9049,17 @@ Partial Class Ventas
|
||||
MensajeAlert.AppendFormat(String.Format("<br/>La nota de crédito <b>{0}</b> por descuento pronto pago se generó correctamente.<br/><br/>", SerieFolioNCProntoPago))
|
||||
End If
|
||||
|
||||
If MsgCancelacionRefacturacion IsNot Nothing Then
|
||||
If Not MsgCancelacionRefacturacion.HuboError Then
|
||||
If MsgCancelacionRefacturacion.CveEstatus = 5 Then
|
||||
MensajeAlert.AppendFormat("<br/>El folio <b>{0}</b> fue cancelado. <b><a target='_blank' class='Texto' href=""/Compras/PopUpVerFactura.aspx?P={1}"">Descargar Acuse</a></b>", Me.ObjFacturaNC.SerieFolio, Encripta(String.Format("OP=CAN&CVEVTA={0}", Me.ObjFacturaNC.CveVenta)))
|
||||
ElseIf MsgCancelacionRefacturacion.CveEstatus = 20 Then
|
||||
MensajeAlert.AppendFormat("<br/>El folio <b>{0}</b> esta en proceso de cancelación. <b><a target='_blank' class='Texto' href=""/Compras/PopUpVerFactura.aspx?P={1}"">Descargar Acuse</a></b>", Me.ObjFacturaNC.SerieFolio, Encripta(String.Format("OP=CAN&CVEVTA={0}", Me.ObjFacturaNC.CveVenta)))
|
||||
End If
|
||||
MensajeAlert.AppendFormat(" <a target='_self' class='Texto' href=""javascript:BtnEnviarMailCancelacion({0});"">Enviar Acuse</a>.<br/><br/>", Me.ObjFacturaNC.CveVenta)
|
||||
End If
|
||||
End If
|
||||
|
||||
'MUESTA ALERT OK
|
||||
' si es elrol 1165-Ventas,EMp:80, o la empresa 119, recarga ventas, para seguir registrando-.
|
||||
'Dim Liga = If(UsuarioActual.CveRol = 1165 Or UsuarioActual.CveEmpresa = 119, "document.location.href=""/Ventas/Ventas.aspx?CveVenta=-1"";", If(CveEmpresaCRM > 0, $"document.location.href=""/CRM/EmpresaCRM.aspx?CveEmpresaCRM={CveEmpresaCRM}"";", $"document.location.href=""/Ventas/Ventas.aspx?CveVenta=-1"";"))
|
||||
@@ -10526,6 +10578,8 @@ Partial Class Ventas
|
||||
|
||||
ObjFactura.NuevaFactura = Me.NuevaFactura
|
||||
|
||||
ObjFactura.EsGarantia = Me.EsGarantia
|
||||
|
||||
'ASIGNAR RFC RECEPTOR
|
||||
If ObjFactura.Timbre IsNot Nothing Then
|
||||
If ObjFactura.Timbre.Receptor IsNot Nothing Then
|
||||
@@ -11690,7 +11744,16 @@ Partial Class Ventas
|
||||
ErrorList.Add("Ocurrió un error al agregar un Producto o Servicio a la Factura.<br />Revise su factura y cualquier detalle comuníquese a Soporte Técnico")
|
||||
Exit For
|
||||
Else
|
||||
|
||||
'VERIFICAR QUE EL DESCUENTO NO PASE EL 40%
|
||||
If UsuarioActual.Empresa.Funcionalidad(531) = "1" AndAlso Row("CveClasificacion").ToString().ToEntero() <> 20519 AndAlso (Not Row("Obs").ToString().Contains("Descuento por garantía")) Then
|
||||
Dim TotalDetalle = Math.Round((Row("Total").ToString().ToDouble(If(factura.ConvertirPesos, factura.TipoCambio, 1)) * (1 + Row("PorcentajeIVA").ToString().ToDouble(If(factura.ConvertirPesos, factura.TipoCambio, 1)))), 6)
|
||||
Dim DescuentoDetalle = Row("Descuento").ToString().ToDouble(If(factura.ConvertirPesos, factura.TipoCambio, 1))
|
||||
Dim PorcentajeDescuento As Double = (DescuentoDetalle / TotalDetalle) * 100D
|
||||
If PorcentajeDescuento > 40 Then
|
||||
ErrorList.Add(String.Format("El descuento del producto/servicio {0} no puede ser mayor al 40%. Porcentaje Actual: {1}%", Row("CodigoPS"), PorcentajeDescuento.RoundSQL(2)))
|
||||
Exit For
|
||||
End If
|
||||
End If
|
||||
'Agregamos el gasto de contrato
|
||||
If CveContrato > 0 AndAlso factura.TipoDocto = "Rem" AndAlso AplicaGastoContrato Then
|
||||
|
||||
@@ -16409,6 +16472,7 @@ Partial Class Ventas
|
||||
TrRFC.Visible = False
|
||||
'RBLPago.Enabled = False
|
||||
RBLPago.SelectedValue = "2"
|
||||
RBLPago_SelectedIndexChanged(RBLPago, EventArgs.Empty)
|
||||
TxtFechaVencimientoCotizacion.Text = Now.ToString()
|
||||
GvPS.Columns(5).Visible = True
|
||||
ThTiempoEntrega.Visible = True
|
||||
@@ -20373,8 +20437,66 @@ Partial Class Ventas
|
||||
If Vigencia IsNot Nothing Then
|
||||
|
||||
If Vigencia.EsCancelable.ToUpper() = "NO CANCELABLE" Then
|
||||
Alert("Esta factura no es cancelable.", TipoMensaje.MsgAdvertencia)
|
||||
Exit Sub
|
||||
sb.AppendFormat("<b>{0}</b> <br/>", Vigencia.EsCancelable)
|
||||
|
||||
DivRelacionadasRefacturacion.Visible = True
|
||||
BtnMotivoRefacturacion.Visible = False
|
||||
DivMotivoRefacturacionTexto.Visible = False
|
||||
|
||||
Dim Relacionados = Timbrado.ConsultarUUIDRelacionados(UsuarioActual.Empresa, FolioFiscal, UsuarioActual.Empresa.FacturaProduccion)
|
||||
If Relacionados IsNot Nothing Then
|
||||
Dim sbExtra As New StringBuilder()
|
||||
If Relacionados.Codigo = 500 Then
|
||||
sbExtra.Append("El servicio de verificación de documentos relacionados no esta disponible.")
|
||||
Else
|
||||
sbExtra.Append(Relacionados.Mensaje)
|
||||
|
||||
Dim SbHijos = New StringBuilder()
|
||||
Dim SbPadres = New StringBuilder()
|
||||
|
||||
'If Relacionados.RelacionadosHijo IsNot Nothing Then
|
||||
' For Each hijo In Relacionados.RelacionadosHijo
|
||||
' SbHijos.AppendFormat("{0};", hijo.Uuid)
|
||||
' Next
|
||||
' If SbHijos.Length > 0 Then
|
||||
' SbHijos.Remove(SbHijos.Length - 1, 1)
|
||||
' End If
|
||||
'End If
|
||||
|
||||
If Relacionados.RelacionadosPadre IsNot Nothing Then
|
||||
For Each padre In Relacionados.RelacionadosPadre
|
||||
SbPadres.AppendFormat("{0};", padre.Uuid)
|
||||
Next
|
||||
If SbPadres.Length > 0 Then
|
||||
SbPadres.Remove(SbPadres.Length - 1, 1)
|
||||
End If
|
||||
End If
|
||||
|
||||
Using ObjVentas As New ClsVentas
|
||||
|
||||
'If SbHijos.Length > 0 Then
|
||||
' If ObjVentas.GetFacturasRelacionadasPorFolioFiscal(SbHijos.ToString(), UsuarioActual.CveEmpresa) Then
|
||||
' GvFacturasHijosCancelar.DataSource = ObjVentas.DtResultados.Copy()
|
||||
' End If
|
||||
'End If
|
||||
|
||||
If SbPadres.Length > 0 Then
|
||||
If ObjVentas.GetFacturasRelacionadasPorFolioFiscal(SbPadres.ToString(), UsuarioActual.CveEmpresa) Then
|
||||
GvFacturasPadreRefacturar.DataSource = ObjVentas.DtResultados.FiltraParametros($"CveVenta <> {CveVenta}")
|
||||
End If
|
||||
End If
|
||||
|
||||
End Using
|
||||
|
||||
'GvFacturasHijosCancelar.DataBind()
|
||||
GvFacturasPadreRefacturar.DataBind()
|
||||
End If
|
||||
|
||||
If sbExtra.Length > 0 Then
|
||||
LbExtraRefacturacion.Text = $"<br><b>*{sbExtra.ToString()}</b>"
|
||||
End If
|
||||
|
||||
End If
|
||||
End If
|
||||
|
||||
If Vigencia.EsCancelable = "Cancelable sin aceptación" Then
|
||||
@@ -21049,6 +21171,12 @@ Partial Class Ventas
|
||||
|
||||
CargaFormaPago(DdlMetodoPago33.SelectedValue.ToEntero())
|
||||
|
||||
'SI ES VENTA NUEVA, ASIGNA LA DEL CLIENTE
|
||||
If (Me.CveVenta <= 0 OrElse Me.EsCreaApartirDe) AndAlso Me.CveFormaPago33Cliente > 0 Then
|
||||
DdlFormaPago33.SelectedValueExist(Me.CveFormaPago33Cliente)
|
||||
End If
|
||||
|
||||
'SI ES VENTA EXISTENTE, ASIGNA LA GUARDADA
|
||||
If Me.CveVenta > 0 AndAlso (Not Me.EsCreaApartirDe) AndAlso Me.CveFormaPago33Venta > 0 Then
|
||||
DdlFormaPago33.SelectedValueExist(Me.CveFormaPago33Venta)
|
||||
End If
|
||||
@@ -21080,6 +21208,11 @@ Partial Class Ventas
|
||||
End If
|
||||
CargaFormaPago(DdlMetodoPago33.SelectedValue.ToEntero())
|
||||
|
||||
'SI ES VENTA NUEVA, ASIGNA LA DEL CLIENTE
|
||||
If (Me.CveVenta <= 0 OrElse Me.EsCreaApartirDe) AndAlso Me.CveFormaPago33Cliente > 0 Then
|
||||
DdlFormaPago33.SelectedValueExist(Me.CveFormaPago33Cliente)
|
||||
End If
|
||||
'SI ES VENTA EXISTENTE, ASIGNA LA GUARDADA
|
||||
If Me.CveVenta > 0 AndAlso (Not Me.EsCreaApartirDe) AndAlso (Not Me.ModalidadEdicion) AndAlso Me.CveFormaPago33Venta > 0 Then
|
||||
DdlFormaPago33.SelectedValueExist(Me.CveFormaPago33Venta)
|
||||
End If
|
||||
@@ -22851,86 +22984,107 @@ Partial Class Ventas
|
||||
|
||||
#Region "Cancelar, Generar y mandar por correo el acuse de cancelación."
|
||||
Private Sub BtnEnviarMailCancelacion_Click(sender As Object, e As EventArgs) Handles BtnEnviarMailCancelacion.Click
|
||||
ImprimeCancelacion(CveVenta)
|
||||
EnviarPDFCancelacion(HdnCveVentaAcuse.Value.ToEntero())
|
||||
HdnCveVentaAcuse.Value = "0"
|
||||
End Sub
|
||||
Public Sub ImprimeCancelacion(CveVenta As Integer)
|
||||
Dim ObjVentas As New ClsVentas
|
||||
If ObjVentas.GetVenta(CveVenta, UsuarioActual.CveEmpresa) Then
|
||||
Dim drv As DataRow = ObjVentas.DtResultados.Rows(0)
|
||||
Dim FolioFiscal = drv("FolioFiscal").ToString()
|
||||
Dim SelloCancelacion = drv("SelloCancelacion").ToString()
|
||||
Dim FechaCancelacion = drv("FechaCancelacion").ToString().ToDateTime.ToString("dd/MM/yyyy HH:mm:ss")
|
||||
Dim RFC = UsuarioActual.Empresa.RFC
|
||||
Dim Archivo As New System.IO.FileInfo("Empresas\Grales\Formatos\AcuseCancelacion.rdlc")
|
||||
Dim params As New List(Of ReportParameter)
|
||||
params.Add(New ReportParameter("FechaCancelacion", FechaCancelacion.ToString()))
|
||||
params.Add(New ReportParameter("FolioFiscal", FolioFiscal))
|
||||
params.Add(New ReportParameter("RFCEmisor", RFC))
|
||||
params.Add(New ReportParameter("SelloCancelacion", SelloCancelacion))
|
||||
Private Function DescargarPDF(Parametros As String) As Byte()
|
||||
Dim Url = New Uri(String.Format("{0}Compras/PopUpVerFactura.aspx?P={1}", ClsPaginas.UrlSitio, Parametros))
|
||||
Dim File As Byte() = Nothing
|
||||
Try
|
||||
Using httpClient = New HttpClient()
|
||||
httpClient.Timeout = New TimeSpan(0, 15, 0)
|
||||
Using request = New HttpRequestMessage(HttpMethod.Get, Url)
|
||||
request.Headers.Add("ADSToken", Encripta(String.Format("CVEEMPRESA={0}&TICKS={1}&CVEUSUARIO={2}", UsuarioActual.CveEmpresa, DateTime.UtcNow.Ticks, UsuarioActual.CveUsuario)))
|
||||
Dim response = httpClient.SendAsync(request).Result
|
||||
If response.StatusCode = Net.HttpStatusCode.OK Then
|
||||
File = response.Content.ReadAsByteArrayAsync().Result
|
||||
End If
|
||||
End Using
|
||||
End Using
|
||||
Catch ex As Exception
|
||||
File = Nothing
|
||||
OnError("Ocurrió un error al descargar la factura", ex)
|
||||
End Try
|
||||
|
||||
Dim ObjetoPDF As Byte() = StreamPDF("Empresas\Grales\Formatos\AcuseCancelacion.rdlc", ObjVentas.DtResultados, params, "AcuseCancelacion" & CveVenta)
|
||||
Dim ObjMail As New ClsSisMail
|
||||
Dim LSRutasMail As New List(Of ClsSisMail.ArchivoMail)
|
||||
Dim Asunto As String = String.Empty
|
||||
Dim Cuerpo As String = String.Empty
|
||||
Dim ResultadoMail As Integer
|
||||
Dim sb As New StringBuilder()
|
||||
If UsuarioActual.CveEmpresa = 119 Then
|
||||
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>{NombreCliente}</b>,<br /><br />")
|
||||
sb.Append($" Le informamos que Agroquímicos JAM, S.A. DE C.V ha cancelado el CFDI <b>{Serie}-{Folio}</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>{NombreCliente}</b>,<br /><br />")
|
||||
sb.Append($" A través del presente medio la Empresa <b>{UsuarioActual.Empresa.Empresa} - {RFC}</b>, canceló el documento tipo <b>{DdlTipoComprobante.SelectedItem.Text}</b> <br />")
|
||||
sb.Append($" con folio <b>{Serie}-{Folio}</b> y el Importe de <b>${TxtTotal.Text}</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>")
|
||||
Return File
|
||||
End Function
|
||||
Public Sub EnviarPDFCancelacion(CveVenta As Integer)
|
||||
|
||||
Dim FacturaRef As New Modelos.Factura(UsuarioActual, CveVenta, UsuarioActual.CveEmpresa)
|
||||
|
||||
If FacturaRef IsNot Nothing Then
|
||||
Dim ObjetoPDF As Byte() = DescargarPDF(Encripta(String.Format("OP=CAN&CVEVTA={0}", CveVenta)))
|
||||
|
||||
If ObjetoPDF IsNot Nothing Then
|
||||
Dim RFC = UsuarioActual.Empresa.RFC
|
||||
Dim ObjMail As New ClsSisMail
|
||||
Dim LSRutasMail As New List(Of ClsSisMail.ArchivoMail)
|
||||
Dim Asunto As String = String.Empty
|
||||
Dim Cuerpo As String = String.Empty
|
||||
Dim ResultadoMail As Integer
|
||||
Dim sb As New StringBuilder()
|
||||
If UsuarioActual.CveEmpresa = 119 Then
|
||||
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>{FacturaRef.Cliente.Nombre}</b>,<br /><br />")
|
||||
sb.Append($" Le informamos que Agroquímicos JAM, S.A. DE C.V ha cancelado el CFDI <b>{FacturaRef.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>{FacturaRef.Cliente.Nombre}</b>,<br /><br />")
|
||||
sb.Append($" A través del presente medio la Empresa <b>{UsuarioActual.Empresa.Empresa} - {RFC}</b>, canceló el documento tipo <b>{FacturaRef.TipodeComprobante}</b> <br />")
|
||||
sb.Append($" con folio <b>{FacturaRef.SerieFolio}</b> y el Importe de <b>${FacturaRef.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>")
|
||||
End If
|
||||
Asunto = $"Acuse de Cancelación {FacturaRef.SerieFolio}"
|
||||
Cuerpo = sb.ToString()
|
||||
Dim DisplayName As String = ""
|
||||
If UsuarioActual.CveEmpresa = 119 Then DisplayName = "Facturación Agroquímicos JAM"
|
||||
LSRutasMail.Add(New ClsSisMail.ArchivoMail With {.ArchivoBinario = ObjetoPDF, .NombreArchivo = $"AcuseCancelacion{FacturaRef.SerieFolio}.pdf"})
|
||||
If ObjMail.SendMail(EmpresaActual, Mail, Asunto, Cuerpo, MailCC, LSRutasMail, Displayname:=DisplayName) Then
|
||||
ResultadoMail = 1
|
||||
Alert("El acuse de cancelación ha sido envíado correctamente.", JSBtnAceptar:="BtnRefrescarPagina();", ShowCloseButton:=False)
|
||||
Else
|
||||
ResultadoMail = 0
|
||||
End If
|
||||
sb.Clear()
|
||||
|
||||
FacturaRef.Dispose()
|
||||
FacturaRef = Nothing
|
||||
End If
|
||||
Asunto = $"Acuse de Cancelacion {Serie}-{Folio}"
|
||||
Cuerpo = sb.ToString()
|
||||
Dim DisplayName As String = ""
|
||||
If UsuarioActual.CveEmpresa = 119 Then DisplayName = "Facturación Agroquímicos JAM"
|
||||
LSRutasMail.Add(New ClsSisMail.ArchivoMail With {.ArchivoBinario = ObjetoPDF, .NombreArchivo = $"AcuseCancelacion{Serie}-{Folio}.pdf"})
|
||||
If ObjMail.SendMail(EmpresaActual, Mail, Asunto, Cuerpo, MailCC, LSRutasMail, Displayname:=DisplayName) Then
|
||||
ResultadoMail = 1
|
||||
Alert("El acuse de cancelación ha sido envíado correctamente.", JSBtnAceptar:="BtnRefrescarPagina();")
|
||||
Else
|
||||
ResultadoMail = 0
|
||||
End If
|
||||
sb.Clear()
|
||||
Else
|
||||
Alert("No se pudo enviar el acuse de cancelación", TipoMensaje.MsgAdvertencia)
|
||||
End If
|
||||
ObjVentas.Dispose()
|
||||
|
||||
End Sub
|
||||
|
||||
Private Sub MostrarCondicionesCancelacion(Optional Extra As String = "")
|
||||
@@ -22957,11 +23111,6 @@ Partial Class Ventas
|
||||
|
||||
Private Sub LbCancelarDocumento_Click(sender As Object, e As EventArgs) Handles LbCancelarDocumento.Click
|
||||
|
||||
'If VentaSaldoAlmacen <> 0 Then
|
||||
' Alert("El pedido no se puede cancelar ya que tiene movimientos de almacén.<br/>Nota: Primero hay que hacer la devolución al almacén", TipoMensaje.MsgAdvertencia)
|
||||
'Else
|
||||
|
||||
'End If
|
||||
If DdlTipoComprobante.SelectedValue.Contiene("Ing", "Ant", "Dev", "Egs") Then
|
||||
|
||||
Dim sb As New StringBuilder()
|
||||
@@ -23010,50 +23159,55 @@ Partial Class Ventas
|
||||
|
||||
Dim Relacionados = Timbrado.ConsultarUUIDRelacionados(UsuarioActual.Empresa, FolioFiscal, UsuarioActual.Empresa.FacturaProduccion)
|
||||
If Relacionados IsNot Nothing Then
|
||||
sbExtra.Append(Relacionados.Mensaje)
|
||||
If Relacionados.Codigo = 500 Then
|
||||
sbExtra.Append("El servicio de verificación de documentos relacionados no esta disponible.")
|
||||
Else
|
||||
sbExtra.Append(Relacionados.Mensaje)
|
||||
|
||||
Dim SbHijos = New StringBuilder()
|
||||
Dim SbPadres = New StringBuilder()
|
||||
Dim SbHijos = New StringBuilder()
|
||||
Dim SbPadres = New StringBuilder()
|
||||
|
||||
If Relacionados.RelacionadosHijo IsNot Nothing Then
|
||||
For Each hijo In Relacionados.RelacionadosHijo
|
||||
SbHijos.AppendFormat("{0};", hijo.Uuid)
|
||||
Next
|
||||
If SbHijos.Length > 0 Then
|
||||
SbHijos.Remove(SbHijos.Length - 1, 1)
|
||||
End If
|
||||
End If
|
||||
'If Relacionados.RelacionadosHijo IsNot Nothing Then
|
||||
' For Each hijo In Relacionados.RelacionadosHijo
|
||||
' SbHijos.AppendFormat("{0};", hijo.Uuid)
|
||||
' Next
|
||||
' If SbHijos.Length > 0 Then
|
||||
' SbHijos.Remove(SbHijos.Length - 1, 1)
|
||||
' End If
|
||||
'End If
|
||||
|
||||
If Relacionados.RelacionadosPadre IsNot Nothing Then
|
||||
For Each padre In Relacionados.RelacionadosPadre
|
||||
SbPadres.AppendFormat("{0};", padre.Uuid)
|
||||
Next
|
||||
If SbPadres.Length > 0 Then
|
||||
SbPadres.Remove(SbPadres.Length - 1, 1)
|
||||
End If
|
||||
End If
|
||||
|
||||
Using ObjVentas As New ClsVentas
|
||||
|
||||
If SbHijos.Length > 0 Then
|
||||
If ObjVentas.GetFacturasRelacionadasPorFolioFiscal(SbHijos.ToString(), UsuarioActual.CveEmpresa) Then
|
||||
GvFacturasHijosCancelar.DataSource = ObjVentas.DtResultados.Copy()
|
||||
If Relacionados.RelacionadosPadre IsNot Nothing Then
|
||||
For Each padre In Relacionados.RelacionadosPadre
|
||||
SbPadres.AppendFormat("{0};", padre.Uuid)
|
||||
Next
|
||||
If SbPadres.Length > 0 Then
|
||||
SbPadres.Remove(SbPadres.Length - 1, 1)
|
||||
End If
|
||||
End If
|
||||
|
||||
If SbPadres.Length > 0 Then
|
||||
If ObjVentas.GetFacturasRelacionadasPorFolioFiscal(SbPadres.ToString(), UsuarioActual.CveEmpresa) Then
|
||||
GvFacturasPadreCancelar.DataSource = ObjVentas.DtResultados.Copy()
|
||||
Using ObjVentas As New ClsVentas
|
||||
|
||||
'If SbHijos.Length > 0 Then
|
||||
' If ObjVentas.GetFacturasRelacionadasPorFolioFiscal(SbHijos.ToString(), UsuarioActual.CveEmpresa) Then
|
||||
' GvFacturasHijosCancelar.DataSource = ObjVentas.DtResultados.Copy()
|
||||
' End If
|
||||
'End If
|
||||
|
||||
If SbPadres.Length > 0 Then
|
||||
If ObjVentas.GetFacturasRelacionadasPorFolioFiscal(SbPadres.ToString(), UsuarioActual.CveEmpresa) Then
|
||||
GvFacturasPadreCancelar.DataSource = ObjVentas.DtResultados.FiltraParametros($"CveVenta <> {CveVenta}")
|
||||
End If
|
||||
End If
|
||||
End If
|
||||
|
||||
End Using
|
||||
End Using
|
||||
|
||||
GvFacturasHijosCancelar.DataBind()
|
||||
GvFacturasPadreCancelar.DataBind()
|
||||
'GvFacturasHijosCancelar.DataBind()
|
||||
GvFacturasPadreCancelar.DataBind()
|
||||
End If
|
||||
End If
|
||||
|
||||
End If
|
||||
|
||||
If String.IsNullOrEmpty(Vigencia.EsCancelable) Then
|
||||
If UsuarioActual.Empresa.FacturaProduccion AndAlso Not String.IsNullOrEmpty(FolioFiscal) Then
|
||||
Alert("No se pudo encontrar el estatus de la factura en el SAT.", TipoMensaje.MsgAdvertencia)
|
||||
@@ -23279,7 +23433,7 @@ Partial Class Ventas
|
||||
Alert(resp.Mensaje, resp.TipoMensaje, JSBtnAceptar:="BtnRefrescarPagina();")
|
||||
Else
|
||||
If resp.CveEstatus = 5 AndAlso Not EsRefacturacion Then
|
||||
Alert(resp.Mensaje, resp.TipoMensaje, JSBtnAceptar:="BtnEnviarMailCancelacion();", TextoConfirmacion:=" Si ", TextoCancelacion:=" <a onclick='Recargar()'>No</> ")
|
||||
Alert(resp.Mensaje, resp.TipoMensaje, JSBtnAceptar:=$"BtnEnviarMailCancelacion({CveVenta});", TextoConfirmacion:=" Si ", TextoCancelacion:=" <a onclick='Recargar()'>No</> ")
|
||||
Else
|
||||
If EsRefacturacion Then
|
||||
If resp.CveEstatus = 20 Then
|
||||
@@ -25917,7 +26071,10 @@ Partial Class Ventas
|
||||
|
||||
'sino tiene el permiso de peude generar NC
|
||||
If Not UsuarioActual.TienePermisoProceso(175) Then
|
||||
Exit Sub
|
||||
'sino tiene el permiso de peude generar NC no directas, solo relacionadas por proceso
|
||||
If Not UsuarioActual.TienePermisoProceso(334) Then 'sino tiene el 175 y tampoco el 334, que se salga
|
||||
Exit Sub
|
||||
End If
|
||||
End If
|
||||
|
||||
AplicaNCMasiva = True
|
||||
@@ -26793,7 +26950,7 @@ Partial Class Ventas
|
||||
|
||||
CveVentaUsadoDevolucionEfectivo = -1
|
||||
|
||||
DdlTipoComprobante.SelectedValue = "Egs"
|
||||
DdlTipoComprobante.SelectedValueExistInsert("Egs", "Egresos")
|
||||
Dim AplicaImpuestosLocales As Boolean = False
|
||||
|
||||
'Dim ObjCliente As New ClsClientes
|
||||
@@ -31862,6 +32019,10 @@ Partial Class Ventas
|
||||
End Sub
|
||||
Protected Sub GeneraPolizaVentaWS(ObjFactura As Modelos.Factura)
|
||||
Try
|
||||
If UsuarioActual.CveUsuario.Contiene(3033, 3491) Then
|
||||
Exit Sub
|
||||
End If
|
||||
|
||||
'TipoPoliza: 01 Venta, 02 Ajuste, 03 Garantía
|
||||
Dim TipoPoliza As Integer = 0
|
||||
For Each Row As GridViewRow In GvCodigosUnicos.Rows
|
||||
|
||||
Reference in New Issue
Block a user