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

View File

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