Error al timbrar la primera vez un ingreso cuando tiene impuestos locales

This commit is contained in:
2020-02-12 18:05:10 -07:00
parent 7d907ebb3e
commit 6fc5f29b71
2 changed files with 39 additions and 27 deletions

View File

@@ -7444,8 +7444,8 @@ Partial Class Ventas
For Each gvr As GridViewRow In GvImpuestosLocales2.Rows
If gvr.RowType = DataControlRowType.DataRow Then
Dim Orden As Integer = 80
If gvr.FCTextBox("TxtImpuestoLocalPS").Text.ToDouble > 0 Then
DR("ImpuestoLocal") = gvr.DataKey("ImpuestoLocal").ToString : DR("Importe") = gvr.FCTextBox("TxtImpuestoLocalPS").Text.ToDouble : DR("Orden") = Orden : DR("Porcentaje") = gvr.DataKey("Porcentaje").ToString : DR("TipoImpuesto") = gvr.DataKey("TipoImpuesto").ToString : DR("IdCtaContable") = gvr.DataKey("IdCtaContable").ToString.ToEntero : TmpDTImpuestos.Rows.Add(DR)
If gvr.FCTextBox("TxtImpuestoLocalPS").Text.ToDecimal > 0 Then
DR("ImpuestoLocal") = gvr.DataKey("ImpuestoLocal").ToString : DR("Importe") = gvr.FCTextBox("TxtImpuestoLocalPS").Text.ToDecimal.RoundSQL(2) : DR("Orden") = Orden : DR("Porcentaje") = gvr.DataKey("Porcentaje").ToString : DR("TipoImpuesto") = gvr.DataKey("TipoImpuesto").ToString : DR("IdCtaContable") = gvr.DataKey("IdCtaContable").ToString.ToEntero : TmpDTImpuestos.Rows.Add(DR)
DR = TmpDTImpuestos.NewRow()
Orden = Orden + 1
End If
@@ -8266,7 +8266,12 @@ Partial Class Ventas
For Each DrImpuestosLocales As DataRow In TmpDTImpuestos.FiltraParametros("TipoImpuesto = 1").Rows
If DrImpuestosLocales("Importe").ToString.ToDecimal > 0 Then
Dim ret As New CFDIRetencionesLocales With {.TasaRetencion = DrImpuestosLocales("Porcentaje").ToString.ToDecimal, .ImpuestoLocalRetenido = DrImpuestosLocales("ImpuestoLocal").ToString, .Importe = DrImpuestosLocales("Importe").ToString.ToDecimal(If(ObjFactura.ConvertirPesos, ObjFactura.TipoCambio, 1))}
Dim ret As New CFDIRetencionesLocales With
{
.TasaRetencion = DrImpuestosLocales("Porcentaje").ToString.ToDecimal,
.ImpuestoLocalRetenido = DrImpuestosLocales("ImpuestoLocal").ToString,
.Importe = DrImpuestosLocales("Importe").ToString.ToDecimal(If(ObjFactura.ConvertirPesos, ObjFactura.TipoCambio, 1)).RoundSQL(2)
}
ObjFactura.Timbre.RetencionesLocales.Add(ret)
End If
Next
@@ -18429,39 +18434,44 @@ Partial Class Ventas
'Else
'End If
If DdlTipoComprobante.SelectedValue.Contiene("Ing", "Ant", "Dev", "Egs", "RNC") Then
Dim sb As New StringBuilder()
sb.Append("La factura se encuentra en el siguiente estatus del SAT:<br/>")
Dim TotalT As Decimal = TxtTotal.Text.ToDecimal
Dim RFCReceptor As String = LblRFC.Text.Trim
Dim Vigencia = Timbrado.VerificarVigenciaSAT(FolioFiscal, UsuarioActual.Empresa.RFC, RFCReceptor, TotalT.ToString(), True)
If Vigencia IsNot Nothing Then
If Vigencia.EsCancelable.ToUpper() = "NO CANCELABLE" Then
Alert("Esta factura no es cancelable.", TipoMensaje.MsgAdvertencia)
Exit Sub
End If
If String.IsNullOrEmpty(Vigencia.EsCancelable) Then
If Not String.IsNullOrEmpty(FolioFiscal) Then
Alert("No se pudo encontrar el estatus de la factura en el SAT.", TipoMensaje.MsgAdvertencia)
'SI ES PRODUCCION VERIFICA EL ESTATUS ANTE EL SAT
If UsuarioActual.Empresa.FacturaProduccion AndAlso Not FolioFiscal.Contains("test") Then
Dim sb As New StringBuilder()
sb.Append("La factura se encuentra en el siguiente estatus del SAT:<br/>")
Dim TotalT As Decimal = TxtTotal.Text.ToDecimal
Dim RFCReceptor As String = LblRFC.Text.Trim
Dim Vigencia = Timbrado.VerificarVigenciaSAT(FolioFiscal, UsuarioActual.Empresa.RFC, RFCReceptor, TotalT.ToString(), True)
If Vigencia IsNot Nothing Then
If Vigencia.EsCancelable.ToUpper() = "NO CANCELABLE" Then
Alert("Esta factura no es cancelable.", TipoMensaje.MsgAdvertencia)
Exit Sub
End If
sb.Append("<b>No encontrado</b> <br/>")
If String.IsNullOrEmpty(Vigencia.EsCancelable) Then
If Not String.IsNullOrEmpty(FolioFiscal) Then
Alert("No se pudo encontrar el estatus de la factura en el SAT.", TipoMensaje.MsgAdvertencia)
Exit Sub
End If
sb.Append("<b>No encontrado</b> <br/>")
Else
sb.AppendFormat("<b>{0}</b> <br/>", Vigencia.EsCancelable)
End If
Else
sb.AppendFormat("<b>{0}</b> <br/>", Vigencia.EsCancelable)
sb.Append("<b>No encontrado</b> <br/>")
End If
sb.Append("Está seguro de cancelar el documento?.")
LblCancelarDocumento.Text = sb.ToString()
RegistraScript("$('#ModalCancelarDocumento').modal();")
UpCancelarDocumento.Update()
Else
sb.Append("<b>No encontrado</b> <br/>")
CancelarDocumento()
End If
sb.Append("Está seguro de cancelar el documento?.")
LblCancelarDocumento.Text = sb.ToString()
RegistraScript("$('#ModalCancelarDocumento').modal();")
UpCancelarDocumento.Update()
Else
CancelarDocumento()
End If

View File

@@ -15,6 +15,8 @@
<Service ID="{C0C07587-41A7-46C8-8FBD-3F9C8EBE2DDC}"/>
</StartupServices>
</VisualWebDeveloper>