This commit is contained in:
@@ -1192,6 +1192,37 @@ Public Class ClsBancos
|
||||
Return Retorno
|
||||
End Function
|
||||
|
||||
Public Function BlockComplementodePAgo(CveIE As Integer, CveComplementoPago As Integer) As Boolean
|
||||
Dim Retorno As Boolean = False
|
||||
DataAdapter("PA_Banc_ComplementoPagoBlock")
|
||||
With SqlAdapter.SelectCommand.Parameters
|
||||
.Add("@CveIE", SqlDbType.Int).Value = CveIE
|
||||
.Add("@CveComplementoPago", SqlDbType.Int).Value = CveComplementoPago
|
||||
End With
|
||||
Try
|
||||
Retorno = (SqlAdapter.SelectCommand.ExecuteNonQuery() > 0)
|
||||
Catch ex As Exception
|
||||
Retorno = False
|
||||
OnError("Ocurrió un error al Guardar complemento de pago", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo)
|
||||
End Try
|
||||
Return Retorno
|
||||
End Function
|
||||
|
||||
Public Function DropComplementodePago(CveIE As Integer, CveComplementoPago As Integer) As Boolean
|
||||
Dim Retorno As Boolean = False
|
||||
DataAdapter("PA_Banc_ComplementoPagoremove")
|
||||
With SqlAdapter.SelectCommand.Parameters
|
||||
.Add("@CveIE", SqlDbType.Int).Value = CveIE
|
||||
.Add("@CveComplementoPago", SqlDbType.Int).Value = CveComplementoPago
|
||||
End With
|
||||
Try
|
||||
Retorno = (SqlAdapter.SelectCommand.ExecuteNonQuery() > 0)
|
||||
Catch ex As Exception
|
||||
Retorno = False
|
||||
OnError("Ocurrió un error al Guardar complemento de pago", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo)
|
||||
End Try
|
||||
Return Retorno
|
||||
End Function
|
||||
Public Function AddComplementoPago(CveIE As Integer, CveVenta As Integer, Serie As String, Folio As Integer, CveUsuario As Integer, CveEmpresa As Integer, Optional CvePrePoliza As Integer = -1, Optional Estatus As Integer = 1) As Integer
|
||||
Dim Retorno As Integer = 0
|
||||
DataAdapter("PA_Banc_ComplementoPagoAdd")
|
||||
|
||||
@@ -5159,6 +5159,7 @@ Public Class ClsPaginas
|
||||
Dim ds As New DataSet
|
||||
For Each rpds As ReportDataSource In DataSource
|
||||
Dim dt As DataTable = DirectCast(rpds.Value, Data.DataTable)
|
||||
dt = dt.Copy()
|
||||
dt.TableName = rpds.Name
|
||||
ds.Tables.Add(dt)
|
||||
Next
|
||||
|
||||
25
App_Code/WS/WSApiController.vb
Normal file
25
App_Code/WS/WSApiController.vb
Normal file
@@ -0,0 +1,25 @@
|
||||
Imports System.Web.Http
|
||||
Imports Extensiones
|
||||
Imports Microsoft.VisualBasic
|
||||
|
||||
Public Class WSApiController
|
||||
Inherits ApiController
|
||||
|
||||
Public ReadOnly Property CveUsuario As Integer
|
||||
Get
|
||||
Return Decripta(Request.Headers.Authorization.Parameter).Split("|"c)(0).ToEntero()
|
||||
End Get
|
||||
End Property
|
||||
Public ReadOnly Property CveEmpresa As Integer
|
||||
Get
|
||||
Return Decripta(Request.Headers.Authorization.Parameter).Split("|"c)(4).ToEntero()
|
||||
End Get
|
||||
End Property
|
||||
|
||||
Public ReadOnly Property RutaEmpresa As String
|
||||
Get
|
||||
Return String.Format("{0}Empresas\{1}\", AppDomain.CurrentDomain.BaseDirectory, Decripta(Request.Headers.Authorization.Parameter).Split("|"c)(4))
|
||||
End Get
|
||||
End Property
|
||||
'
|
||||
End Class
|
||||
@@ -8,7 +8,7 @@ Namespace SIG
|
||||
<Extensiones.BasicAuthentication()>
|
||||
<RoutePrefix("api/SIGVentas")>
|
||||
Public Class SIGVentasController
|
||||
Inherits ApiController
|
||||
Inherits WSApiController
|
||||
|
||||
<Route("creartrama")>
|
||||
<HttpPost>
|
||||
@@ -59,10 +59,82 @@ Namespace SIG
|
||||
If Banco.GetComplementoPagosRep(CveCliente, FechaI, FechaF, CveIE, CveVenta, opcion, CveEmpresa, Estatus:=status) Then
|
||||
respuesta = Banco.DtResultados
|
||||
End If
|
||||
Dim Serie As String = "Pag"
|
||||
Dim CveComplementoPagoTimbre As Integer = -1
|
||||
Dim Folio As Integer = -1
|
||||
respuesta.Columns.Add("CveComplementoPagoTimbre", GetType(Int32))
|
||||
respuesta.Columns.Add("FolioTimbre", GetType(String))
|
||||
respuesta.AcceptChanges()
|
||||
Dim thencommit As Boolean = True
|
||||
Banco.IniciaTransacSQL()
|
||||
For Each dr As System.Data.DataRow In respuesta.Select("CveVenta Is NULL")
|
||||
CveComplementoPagoTimbre = Banco.AddComplementoPago(dr("CveIE").ToString().ToEntero(), -1, Serie, Folio, Me.CveUsuario, CveEmpresa, CvePrePoliza:=-1, Estatus:=1)
|
||||
Folio = Banco.FActual
|
||||
dr("CveComplementoPagoTimbre") = CveComplementoPagoTimbre
|
||||
dr("FolioTimbre") = Folio
|
||||
If Banco.BlockComplementodePAgo(dr("CveIE").ToString().ToEntero(), CveComplementoPagoTimbre) Then
|
||||
thencommit = False
|
||||
Exit For
|
||||
End If
|
||||
Next
|
||||
respuesta.AcceptChanges()
|
||||
If thencommit Then
|
||||
Banco.Commit()
|
||||
Else
|
||||
respuesta = New System.Data.DataTable
|
||||
Banco.RollBack()
|
||||
End If
|
||||
End Using
|
||||
|
||||
Return JSutil.strresponse(respuesta, (Not IsNothing(respuesta)), "")
|
||||
End Function
|
||||
|
||||
|
||||
<Route("SincronizarComplementoPago")>
|
||||
<HttpPost>
|
||||
Public Function SincronizarComplementoPago(<FromBody()> params As WsBody) As Object
|
||||
Dim dt As System.Data.DataTable = Newtonsoft.Json.JsonConvert.DeserializeObject(Of System.Data.DataTable)(Decripta(params.Datos))
|
||||
Dim CveEmpresa As Integer = 119
|
||||
Dim rutaxml As String = String.Format("{0}xml", RutaEmpresa)
|
||||
If Not System.IO.Directory.Exists(rutaxml) Then
|
||||
System.IO.Directory.CreateDirectory(rutaxml)
|
||||
End If
|
||||
|
||||
Using objbancos As New ClsBancos()
|
||||
dt.AcceptChanges()
|
||||
For Each dr As System.Data.DataRow In dt.Rows
|
||||
If dr("Sincronizado").ToString() <> "1" Then
|
||||
If dr("SeTimbro").ToString() = 1 Then
|
||||
|
||||
Dim continuar As Boolean = True
|
||||
Try
|
||||
Using ArchivoW As New IO.StreamWriter(String.Format("{0}\{1}.xml", rutaxml, dr("FolioFiscalTimbre").ToString()), True, System.Text.Encoding.UTF8)
|
||||
Try
|
||||
ArchivoW.Write(dr("timbreXml").ToString())
|
||||
Catch
|
||||
continuar = False
|
||||
End Try
|
||||
End Using
|
||||
Catch
|
||||
continuar = False
|
||||
End Try
|
||||
If continuar AndAlso objbancos.UpdateComplementoPago(dr("CveComplementoPagoTimbre").ToString().ToEntero(), dr("FolioFiscalTimbre").ToString(), dr("CvePAC").ToString().ToEntero(), CveEmpresa) Then
|
||||
dr("Sincronizado") = 1
|
||||
End If
|
||||
Else
|
||||
|
||||
If objbancos.DropComplementodePago(dr("CveComplementoPagoTimbre").ToString().ToEntero(), dr("CveIE").ToString().ToEntero()) Then
|
||||
dr("Sincronizado") = 1
|
||||
End If
|
||||
End If
|
||||
|
||||
End If
|
||||
Next
|
||||
End Using
|
||||
dt.AcceptChanges()
|
||||
Return JSutil.strresponse(dt, (Not IsNothing(dt)), "")
|
||||
End Function
|
||||
|
||||
' GET api/<controller>
|
||||
Public Function GetValues() As IEnumerable(Of String)
|
||||
Return New String() {"value1", "value2"}
|
||||
|
||||
@@ -1069,9 +1069,9 @@ Partial Class PopUpVerFactura
|
||||
If ObjVentas.DtResultados IsNot Nothing AndAlso ObjVentas.DtResultados.Rows.Count > 0 Then
|
||||
ObjVentas.DtResultados.Columns.Add("Importe", GetType(Decimal))
|
||||
ObjVentas.DtResultados.Rows(0)("Importe") = ObjVentas.DtResultados.Rows(0)("Total")
|
||||
Vta.DtDocumentosRelacionados = ObjVentas.DtResultados.FiltraParametros("FolioFiscal IS NOT NULL")
|
||||
Vta.DtDocumentosRelacionados = ObjVentas.DtResultados.Copy().FiltraParametros("FolioFiscal IS NOT NULL")
|
||||
If ObjVentas.GetVentasRelacionadas(CveVenta, UsuarioActual.CveEmpresa) Then
|
||||
Vta.DtNCVinculadas = ObjVentas.DtResultados
|
||||
Vta.DtNCVinculadas = ObjVentas.DtResultados.Copy()
|
||||
Vta.DtDocumentosRelacionados = ObjVentas.DtResultados.FiltraParametros("FolioFiscal IS NOT NULL")
|
||||
If Vta.DtDocumentosRelacionados.Rows.Count > 0 Then
|
||||
If Vta.TipoDocto.Contiene("Dev") Then
|
||||
|
||||
@@ -10,7 +10,7 @@ using System.Xml;
|
||||
using Extensiones;
|
||||
using System.Data;
|
||||
using System.Text;
|
||||
using ADSistemaLibrary.SatXml;
|
||||
using ADSistemaLibrary2.SatXml;
|
||||
|
||||
//using ADS_CFDI_SAT;
|
||||
|
||||
@@ -187,7 +187,11 @@ public partial class Ventas_RepConciliacionEmitidosSat : ClsPaginas
|
||||
{
|
||||
|
||||
{
|
||||
string ruta = string.Format("{0}\\{1}", UsuarioActual.Empresa.Ruta.Trim(), gvrow.DataKey("RutaXml").Trim()).Replace("/", "\\"); //gvrow.DataKey("RutaXml");
|
||||
string rutaempresa = UsuarioActual.Empresa.Ruta.Trim().Replace("/", "\\");
|
||||
string rutafile = gvrow.DataKey("RutaXml").Trim().Replace("/", "\\");
|
||||
rutaempresa = rutaempresa.Substring(rutaempresa.Length - 1, 1) == "\\" ? rutaempresa.Substring(0, rutaempresa.Length - 1): rutaempresa;
|
||||
rutafile = rutafile.Substring(0, 1) == "\\" ? rutafile.Substring(1): rutafile;
|
||||
string ruta = string.Format("{0}\\{1}", rutaempresa, rutafile); //gvrow.DataKey("RutaXml");
|
||||
//Alert(ruta);
|
||||
|
||||
//return false;
|
||||
@@ -798,4 +802,953 @@ public partial class Ventas_RepConciliacionEmitidosSat : ClsPaginas
|
||||
}
|
||||
//String.Format("/Compras/PopUpVerFactura.aspx?P={0}", Encripta(String.Format("OP=FactVta&CVEVENTA={0}&EXT={1}&SERIEFOLIO={2}&TIPODOCTO={3}", CveVenta, "XML", DbRowVenta("SerieFolio"), DbRowVenta("TipoDocto"))))
|
||||
}
|
||||
}
|
||||
namespace ADSistemaLibrary2.SatXml
|
||||
{
|
||||
public class XmlSatCFDI
|
||||
{
|
||||
public XmlSatCFDI()
|
||||
{
|
||||
comprobante = new CFDIComprobante();
|
||||
emisor = new CFDIEmisor();
|
||||
receptor = new CFDIReceptor();
|
||||
complemento = new CFDIComplemento();
|
||||
cFDIRelacionados = new List<CFDIRelacionado>();
|
||||
conceptos = new List<CFDIConcepto>();
|
||||
Impuestos = new List<CFDIImpuesto>();
|
||||
}
|
||||
public CFDIComprobante comprobante;
|
||||
public CFDIEmisor emisor;
|
||||
public CFDIReceptor receptor;
|
||||
public CFDIComplemento complemento;
|
||||
public List<CFDIRelacionado> cFDIRelacionados;
|
||||
public List<CFDIConcepto> conceptos;
|
||||
public List<CFDIImpuesto> Impuestos;
|
||||
public List<CFDIConcepto_I> GetConceptosforpdf()
|
||||
{
|
||||
List<CFDIConcepto_I> lcon = new List<CFDIConcepto_I>();
|
||||
if (conceptos != null)
|
||||
{
|
||||
int _orden = 0;
|
||||
foreach (CFDIConcepto item in conceptos)
|
||||
{
|
||||
_orden += 1;
|
||||
CFDIConcepto_I con = new CFDIConcepto_I
|
||||
{
|
||||
tipo = 1,
|
||||
orden = _orden,
|
||||
ClaveProdServ = item.ClaveProdServ,
|
||||
NoIdentificacion = item.NoIdentificacion,
|
||||
Cantidad = item.Cantidad,
|
||||
ClaveUnidad = item.ClaveUnidad,
|
||||
Unidad = item.Unidad,
|
||||
ValorUnitario = item.ValorUnitario,
|
||||
Importe = item.Importe,
|
||||
Descuento = item.Descuento,
|
||||
NumeroPedimento = item.NumeroPedimento,
|
||||
CuentaPredial = item.CuentaPredial,
|
||||
Descripcion = item.Descripcion
|
||||
};
|
||||
int index = 0;
|
||||
foreach (CFDIConceptoImpuesto Imp in item.Impuestos)
|
||||
{
|
||||
index++;
|
||||
if (index > 1)
|
||||
{
|
||||
lcon.Add(con);
|
||||
con = new CFDIConcepto_I
|
||||
{
|
||||
tipo = 2,
|
||||
orden = _orden,
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
con.Impuesto = Imp.ImpuestoTexto;
|
||||
con.Impuesto_Tipo = Imp.Tipo;
|
||||
con.Impuesto_Base = Imp.Base;
|
||||
con.Impuesto_TipoFactor = Imp.TipoFactor;
|
||||
con.Impuesto_TasaOCuota = Imp.TasaOCuota;
|
||||
con.Impuesto_Importe = Imp.Importe;
|
||||
}
|
||||
lcon.Add(con);
|
||||
}
|
||||
}
|
||||
|
||||
return lcon;
|
||||
}
|
||||
|
||||
public static XmlSatCFDI readXML(string fileUrl)
|
||||
{
|
||||
XmlSatCFDI xmlCFDI = new XmlSatCFDI();
|
||||
bool canread = true;
|
||||
//keys
|
||||
string keyComprobante = "Comprobante";
|
||||
string keyCfdiRelacionados = "CfdiRelacionados";
|
||||
string keyEmisor = "Emisor";
|
||||
string keyReceptor = "Receptor";
|
||||
string keyConceptos = "Conceptos";
|
||||
string keyImpuestos = "Impuestos";
|
||||
string keyComplemento = "Complemento";
|
||||
//endkeys
|
||||
string[] PrimerNivel = new string[] { keyCfdiRelacionados, keyEmisor, keyReceptor, keyConceptos, keyImpuestos, keyComplemento };
|
||||
//(canread = xtr.Read()) para evitar ciclos infinitos, todos los .Read() los guardo en la variable Canread y en los while reviso primero esta variable
|
||||
if (File.Exists(fileUrl))
|
||||
{
|
||||
XmlReaderSettings settings = new XmlReaderSettings();
|
||||
settings.ConformanceLevel = ConformanceLevel.Fragment;
|
||||
settings.IgnoreWhitespace = true;
|
||||
settings.IgnoreComments = true;
|
||||
using (XmlReader xtr = XmlReader.Create(fileUrl, settings))
|
||||
{
|
||||
|
||||
while ((canread = xtr.Read()) && !(xtr.NodeType == XmlNodeType.Element && xtr.Name.Replace("cfdi:","") == keyComprobante))
|
||||
{
|
||||
//if (xtr.NodeType != XmlNodeType.Element) { while (xtr.Read() && xtr.NodeType != XmlNodeType.Element) { } }
|
||||
}
|
||||
if (xtr.NodeType == XmlNodeType.Element && xtr.Name.Replace("cfdi:", "") == keyComprobante)
|
||||
{
|
||||
int Nivel = xtr.Depth;
|
||||
bool cont = xtr.MoveToFirstAttribute();
|
||||
while (cont)
|
||||
{
|
||||
|
||||
switch (xtr.Name.ToUpper())
|
||||
{
|
||||
case "XMLNS:CFDI": xmlCFDI.comprobante.xmlns_cfdi = xtr.Value; break;
|
||||
case "XMLNS:XSI": xmlCFDI.comprobante.xmlns_xsi = xtr.Value; break;
|
||||
case "XSI:SCHEMALOCATION": xmlCFDI.comprobante.xsi_schemaLocation = xtr.Value; break;
|
||||
case "VERSION": xmlCFDI.comprobante.Version = xtr.Value; break;
|
||||
case "SERIE": xmlCFDI.comprobante.Serie = xtr.Value; break;
|
||||
case "FOLIO": xmlCFDI.comprobante.Folio = xtr.Value; break;
|
||||
case "FECHA": xmlCFDI.comprobante.Fecha = xtr.Value; break;
|
||||
case "MONEDA": xmlCFDI.comprobante.Moneda = xtr.Value; break;
|
||||
case "SUBTOTAL": decimal SubTotal = 0; decimal.TryParse(xtr.Value, out SubTotal); xmlCFDI.comprobante.SubTotal = SubTotal; break;
|
||||
case "TOTAL": decimal Total = 0; decimal.TryParse(xtr.Value, out Total); xmlCFDI.comprobante.Total = Total; break;
|
||||
case "DESCUENTO": decimal Descuento = 0; decimal.TryParse(xtr.Value, out Descuento); xmlCFDI.comprobante.Descuento = Descuento; break;
|
||||
case "TIPOCAMBIO": decimal TipoCambio = 0; decimal.TryParse(xtr.Value, out TipoCambio); xmlCFDI.comprobante.TipoCambio = TipoCambio; break;
|
||||
case "TIPODECOMPROBANTE": xmlCFDI.comprobante.TipoDeComprobante = xtr.Value; break;
|
||||
case "FORMAPAGO": xmlCFDI.comprobante.FormaPago = xtr.Value; break;
|
||||
case "FORMADEPAGO": xmlCFDI.comprobante.FormaPago = xtr.Value; break;
|
||||
case "METODOPAGO": xmlCFDI.comprobante.MetodoPago = xtr.Value; break;
|
||||
case "METODODEPAGO": xmlCFDI.comprobante.MetodoPago = xtr.Value; break;
|
||||
case "CONDICIONESDEPAGO": xmlCFDI.comprobante.CondicionesDePago = xtr.Value; break;
|
||||
case "LUGAREXPEDICION": xmlCFDI.comprobante.LugarExpedicion = xtr.Value; break;
|
||||
case "CONFIRMACION": xmlCFDI.comprobante.Confirmacion = xtr.Value; break;
|
||||
case "NOCERTIFICADO": xmlCFDI.comprobante.NoCertificado = xtr.Value; break;
|
||||
case "SELLO": xmlCFDI.comprobante.Sello = xtr.Value; break;
|
||||
case "CERTIFICADO": xmlCFDI.comprobante.Certificado = xtr.Value; break;
|
||||
}
|
||||
cont = xtr.MoveToNextAttribute();
|
||||
}
|
||||
cont = xtr.MoveToFirstAttribute();
|
||||
while ((canread = xtr.Read()) && xtr.NodeType != XmlNodeType.Element) { }
|
||||
while (canread && xtr.Depth > Nivel)
|
||||
{
|
||||
if (PrimerNivel.Contains(xtr.Name.Replace("cfdi:", "")))
|
||||
{
|
||||
if (xtr.NodeType == XmlNodeType.Element && xtr.Name.Replace("cfdi:", "") == keyCfdiRelacionados)
|
||||
{
|
||||
int cDepth = xtr.Depth;
|
||||
|
||||
string TipoRelacion = null;
|
||||
cont = xtr.MoveToFirstAttribute();
|
||||
while (cont)
|
||||
{
|
||||
switch (xtr.Name.ToUpper())
|
||||
{
|
||||
case "TIPORELACION": TipoRelacion = xtr.Value; break;
|
||||
}
|
||||
cont = xtr.MoveToNextAttribute();
|
||||
}
|
||||
while ((canread = xtr.Read()) && xtr.NodeType != XmlNodeType.Element) { }
|
||||
while (canread && xtr.Depth > cDepth)
|
||||
{
|
||||
if (xtr.Name.Replace("cfdi:", "") == "CfdiRelacionado")
|
||||
{
|
||||
CFDIRelacionado cfdir = new CFDIRelacionado();
|
||||
cfdir.TipoRelacion = TipoRelacion;
|
||||
cfdir.UUID = xtr.GetAttribute("UUID");
|
||||
xmlCFDI.cFDIRelacionados.Add(cfdir);
|
||||
}
|
||||
while ((canread = xtr.Read()) && xtr.NodeType != XmlNodeType.Element) { }
|
||||
}
|
||||
|
||||
}
|
||||
if (xtr.NodeType == XmlNodeType.Element && xtr.Name.Replace("cfdi:", "") == keyEmisor)
|
||||
{
|
||||
|
||||
|
||||
int curentNivel = xtr.Depth;
|
||||
cont = xtr.MoveToFirstAttribute();
|
||||
while (cont)
|
||||
{
|
||||
switch (xtr.Name.ToUpper())
|
||||
{
|
||||
case "REGIMENFISCAL": xmlCFDI.emisor.RegimenFiscal = xtr.Value; break;
|
||||
case "NOMBRE": xmlCFDI.emisor.Nombre = xtr.Value; break;
|
||||
case "RFC": xmlCFDI.emisor.Rfc = xtr.Value; break;
|
||||
}
|
||||
cont = xtr.MoveToNextAttribute();
|
||||
}
|
||||
while ((canread = xtr.Read()) && !(xtr.NodeType == XmlNodeType.Element && curentNivel >= xtr.Depth)) { }//continua hasta que no tenga nodos y (el nodo sea tipo elemnto y ete en el mismo nivel)
|
||||
}
|
||||
if (xtr.NodeType == XmlNodeType.Element && xtr.Name.Replace("cfdi:", "") == keyReceptor)
|
||||
{
|
||||
int curentNivel = xtr.Depth;
|
||||
cont = xtr.MoveToFirstAttribute();
|
||||
while (cont)
|
||||
{
|
||||
switch (xtr.Name.ToUpper())
|
||||
{
|
||||
case "RFC": xmlCFDI.receptor.Rfc = xtr.Value; break;
|
||||
case "NOMBRE": xmlCFDI.receptor.Nombre = xtr.Value; break;
|
||||
case "RESIDENCIAFISCAL": xmlCFDI.receptor.ResidenciaFiscal = xtr.Value; break;
|
||||
case "NUMREGIDTRIB": xmlCFDI.receptor.NumRegIdTrib = xtr.Value; break;
|
||||
case "USOCFDI": xmlCFDI.receptor.UsoCFDI = xtr.Value; break;
|
||||
}
|
||||
cont = xtr.MoveToNextAttribute();
|
||||
}
|
||||
|
||||
while ((canread = xtr.Read()) && !(xtr.NodeType == XmlNodeType.Element && curentNivel >= xtr.Depth)) { }//continua hasta que no tenga nodos y (el nodo sea tipo elemnto y ete en el mismo nivel)
|
||||
}
|
||||
if (xtr.NodeType == XmlNodeType.Element && xtr.Name.Replace("cfdi:", "") == keyConceptos)
|
||||
{
|
||||
int cDepth = xtr.Depth;
|
||||
while ((canread = xtr.Read()) && xtr.NodeType != XmlNodeType.Element) { }
|
||||
while (canread && xtr.Depth > cDepth)
|
||||
{
|
||||
if (xtr.Name.Replace("cfdi:", "") == "Concepto")
|
||||
{
|
||||
int cDepthb = xtr.Depth;
|
||||
CFDIConcepto concepto = new CFDIConcepto();
|
||||
|
||||
cont = xtr.MoveToFirstAttribute();
|
||||
while (cont)
|
||||
{
|
||||
switch (xtr.Name.ToUpper())
|
||||
{
|
||||
case "CLAVEPRODSERV": concepto.ClaveProdServ = xtr.Value; break;
|
||||
case "NOIDENTIFICACION": concepto.NoIdentificacion = xtr.Value; break;
|
||||
case "CANTIDAD": concepto.Cantidad = xtr.Value; break;
|
||||
case "CLAVEUNIDAD": concepto.ClaveUnidad = xtr.Value; break;
|
||||
case "UNIDAD": concepto.Unidad = xtr.Value; break;
|
||||
case "VALORUNITARIO": decimal ValorUnitario = 0; decimal.TryParse(xtr.Value, out ValorUnitario); concepto.ValorUnitario = ValorUnitario; ; break;
|
||||
case "IMPORTE": decimal Importe = 0; decimal.TryParse(xtr.Value, out Importe); concepto.Importe = Importe; ; break;
|
||||
case "DESCUENTO": decimal DDescuento = 0; decimal.TryParse(xtr.Value, out DDescuento); concepto.Descuento = DDescuento; ; break;
|
||||
case "DESCRIPCION": concepto.Descripcion = xtr.Value; break;
|
||||
}
|
||||
cont = xtr.MoveToNextAttribute();
|
||||
}
|
||||
xtr.MoveToFirstAttribute();
|
||||
while ((canread = xtr.Read()) && xtr.NodeType != XmlNodeType.Element) { }
|
||||
while (canread && xtr.Depth > cDepthb)
|
||||
{
|
||||
if (xtr.NodeType == XmlNodeType.Element && xtr.Name.Replace("cfdi:", "") == "Impuestos")
|
||||
{
|
||||
int cDepthc = xtr.Depth;
|
||||
while ((canread = xtr.Read()) && xtr.NodeType != XmlNodeType.Element) { }
|
||||
while (canread && xtr.Depth > cDepthc)
|
||||
{
|
||||
if (xtr.Name.Replace("cfdi:", "") == "Traslado" || xtr.Name.Replace("cfdi:", "") == "Retencion")
|
||||
{
|
||||
CFDIConceptoImpuesto impuesto = new CFDIConceptoImpuesto();
|
||||
impuesto.Impuesto = xtr.GetAttribute("Impuesto");
|
||||
impuesto.Tipo = xtr.LocalName;
|
||||
decimal Base = 0;
|
||||
decimal.TryParse(xtr.GetAttribute("Base"), out Base);
|
||||
impuesto.Base = Base;
|
||||
impuesto.TipoFactor = xtr.GetAttribute("TipoFactor");
|
||||
decimal tasaOCuota = 0;
|
||||
decimal.TryParse(xtr.GetAttribute("TasaOCuota"), out tasaOCuota);
|
||||
impuesto.TasaOCuota = impuesto.TipoFactor == "Tasa" ? (tasaOCuota * 100).ToString("N4") : xtr.GetAttribute("TasaOCuota");
|
||||
decimal ImImporte = 0;
|
||||
decimal.TryParse(xtr.GetAttribute("Importe"), out ImImporte);
|
||||
impuesto.Importe = ImImporte;
|
||||
|
||||
concepto.Impuestos.Add(impuesto);
|
||||
}
|
||||
while ((canread = xtr.Read()) && xtr.NodeType != XmlNodeType.Element) { }
|
||||
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
bool rednew = true;
|
||||
if (xtr.NodeType == XmlNodeType.Element && xtr.Name.Replace("cfdi:", "") == "InformacionAduanera")
|
||||
{
|
||||
concepto.NumeroPedimento = xtr.GetAttribute("NumeroPedimento");
|
||||
rednew = false; while ((canread = xtr.Read()) && xtr.NodeType != XmlNodeType.Element) { }
|
||||
}
|
||||
if (xtr.NodeType == XmlNodeType.Element && xtr.Name.Replace("cfdi:", "") == "CuentaPredial")
|
||||
{
|
||||
concepto.CuentaPredial = xtr.GetAttribute("CuentaPredial");
|
||||
rednew = false; while ((canread = xtr.Read()) && xtr.NodeType != XmlNodeType.Element) { }
|
||||
}
|
||||
if (rednew) { while ((canread = xtr.Read()) && xtr.NodeType != XmlNodeType.Element) { } }
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
xmlCFDI.conceptos.Add(concepto);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (xtr.NodeType == XmlNodeType.Element && xtr.Name.Replace("cfdi:", "") == keyImpuestos)
|
||||
{
|
||||
int cDepth = xtr.Depth;
|
||||
|
||||
while ((canread = xtr.Read()) && xtr.NodeType != XmlNodeType.Element) { }
|
||||
while (canread && xtr.Depth > cDepth)
|
||||
{
|
||||
CFDIImpuesto impuest = new CFDIImpuesto();
|
||||
if (xtr.Name.Replace("cfdi:", "") == "Traslado" || xtr.Name.Replace("cfdi:", "") == "Retencion" && xmlCFDI.comprobante.Version != null)
|
||||
{
|
||||
impuest.Tipo = xtr.LocalName == "Traslado" ? "Traslados" : (xtr.LocalName == "Retencion" ? "Retenciones" : "");
|
||||
impuest.Impuesto = xmlCFDI.comprobante.Version == "3.3" ? xtr.GetAttribute("Impuesto") : xtr.GetAttribute("impuesto");
|
||||
impuest.TipoFactor = xtr.GetAttribute("TipoFactor");
|
||||
impuest.TasaOCuota = xmlCFDI.comprobante.Version == "3.3" ? xtr.GetAttribute("TasaOCuota") : xtr.GetAttribute("tasa");
|
||||
decimal ImImporte = 0;
|
||||
decimal.TryParse((xmlCFDI.comprobante.Version == "3.3" ? xtr.GetAttribute("Importe") : xtr.GetAttribute("importe")), out ImImporte);
|
||||
impuest.Importe = ImImporte;
|
||||
xmlCFDI.Impuestos.Add(impuest);
|
||||
}
|
||||
while ((canread = xtr.Read()) && xtr.NodeType != XmlNodeType.Element) { }
|
||||
|
||||
}
|
||||
}
|
||||
if (xtr.NodeType == XmlNodeType.Element && xtr.Name.Replace("cfdi:", "") == keyComplemento)
|
||||
{
|
||||
int cDepth = xtr.Depth;
|
||||
while ((canread = xtr.Read()) && xtr.NodeType != XmlNodeType.Element) { }
|
||||
while (canread && xtr.Depth > cDepth)
|
||||
{
|
||||
if (xtr.NodeType == XmlNodeType.Element && xtr.LocalName == "TimbreFiscalDigital" && xmlCFDI.comprobante.Version != null)
|
||||
{
|
||||
xmlCFDI.complemento.xmlns_tfd = xtr.GetAttribute("xmlns:tfd");
|
||||
xmlCFDI.complemento.xsi_schemaLocation = xtr.GetAttribute("xsi:schemaLocation");
|
||||
xmlCFDI.complemento.Version = xtr.GetAttribute("Version");
|
||||
xmlCFDI.complemento.UUID = xtr.GetAttribute("UUID");
|
||||
xmlCFDI.complemento.FechaTimbrado = xtr.GetAttribute("FechaTimbrado");
|
||||
xmlCFDI.complemento.RfcProvCertif = xtr.GetAttribute("RfcProvCertif");
|
||||
xmlCFDI.complemento.SelloCFD = xmlCFDI.comprobante.Version == "3.3" ? xtr.GetAttribute("SelloCFD") : xtr.GetAttribute("selloCFD");
|
||||
xmlCFDI.complemento.NoCertificadoSAT = xmlCFDI.comprobante.Version == "3.3" ? xtr.GetAttribute("NoCertificadoSAT") : xtr.GetAttribute("noCertificadoSAT");
|
||||
xmlCFDI.complemento.SelloSAT = xmlCFDI.comprobante.Version == "3.3" ? xtr.GetAttribute("SelloSAT") : xtr.GetAttribute("selloSAT");
|
||||
|
||||
}
|
||||
|
||||
if (xtr.NodeType == XmlNodeType.Element && xtr.LocalName == "Pagos" && xmlCFDI.comprobante.Version != null)
|
||||
{
|
||||
while ((canread = xtr.Read()) && xtr.NodeType != XmlNodeType.Element) { }
|
||||
xmlCFDI.complemento.Pagos = new CFDIPago();
|
||||
int depthpagos = xtr.Depth;
|
||||
bool conts = xtr.MoveToFirstAttribute();
|
||||
while (conts)
|
||||
{
|
||||
|
||||
decimal Base = 0;
|
||||
switch (xtr.Name.ToUpper())
|
||||
{
|
||||
case "FECHAPAGO": xmlCFDI.complemento.Pagos.FechaPago = xtr.Value; break;
|
||||
case "FORMADEPAGOP": xmlCFDI.complemento.Pagos.FormaDePagoP = xtr.Value; break;
|
||||
case "FORMADEPAGOPTEXT": xmlCFDI.complemento.Pagos.FormaDePagoPText = xtr.Value; break;
|
||||
case "MONEDAP": xmlCFDI.complemento.Pagos.MonedaP = xtr.Value; break;
|
||||
case "MONTO": decimal.TryParse(xtr.Value, out Base); xmlCFDI.complemento.Pagos.Monto = Base; break;
|
||||
case "TIPOCAMBIOP": decimal.TryParse(xtr.Value, out Base); xmlCFDI.complemento.Pagos.TipoCambioP = Base; break;
|
||||
case "NUMOPERACION": xmlCFDI.complemento.Pagos.NumOperacion = xtr.Value; break;
|
||||
case "NOMBANCOORDEXT": xmlCFDI.complemento.Pagos.NomBancoOrdExt = xtr.Value; break;
|
||||
case "RFCEMISORCTAORD": xmlCFDI.complemento.Pagos.RfcEmisorCtaOrd = xtr.Value; break;
|
||||
case "CTAORDENANTE": xmlCFDI.complemento.Pagos.CtaOrdenante = xtr.Value; break;
|
||||
case "RFCEMISORCTABEN": xmlCFDI.complemento.Pagos.RfcEmisorCtaBen = xtr.Value; break;
|
||||
case "CTABENEFICIARIO": xmlCFDI.complemento.Pagos.CtaBeneficiario = xtr.Value; break;
|
||||
}
|
||||
conts = xtr.MoveToNextAttribute();
|
||||
}
|
||||
conts = xtr.MoveToFirstAttribute();
|
||||
while ((canread = xtr.Read()) && xtr.NodeType != XmlNodeType.Element) { }
|
||||
while (canread && xtr.Depth > depthpagos)
|
||||
{
|
||||
CFDIPagoDoctoRelacionado objpago = new CFDIPagoDoctoRelacionado();
|
||||
conts = xtr.MoveToFirstAttribute();
|
||||
while (conts)
|
||||
{
|
||||
|
||||
decimal Basep = 0;
|
||||
switch (xtr.Name.ToUpper())
|
||||
{
|
||||
case "IDDOCUMENTO": objpago.IdDocumento = xtr.Value; break;
|
||||
case "SERIE": objpago.Serie = xtr.Value; break;
|
||||
case "FOLIO": objpago.Folio = xtr.Value; break;
|
||||
case "MONEDADR": objpago.MonedaDR = xtr.Value; break;
|
||||
case "METODODEPAGODR": objpago.MetodoDePagoDR = xtr.Value; break;
|
||||
case "NUMPARCIALIDAD": objpago.NumParcialidad = xtr.Value; break;
|
||||
case "IMPSALDOANT": decimal.TryParse(xtr.Value, out Basep); objpago.ImpSaldoAnt = Basep; break;
|
||||
case "IMPPAGADO": decimal.TryParse(xtr.Value, out Basep); objpago.ImpPagado = Basep; break;
|
||||
case "IMPSALDOINSOLUTO": decimal.TryParse(xtr.Value, out Basep); objpago.ImpSaldoInsoluto = Basep; break;
|
||||
|
||||
}
|
||||
conts = xtr.MoveToNextAttribute();
|
||||
}
|
||||
conts = xtr.MoveToFirstAttribute();
|
||||
xmlCFDI.complemento.Pagos.doctosRelacionados.Add(objpago);
|
||||
while ((canread = xtr.Read()) && xtr.NodeType != XmlNodeType.Element) { }
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
while ((canread = xtr.Read()) && xtr.NodeType != XmlNodeType.Element) { }
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
//si no entro en ninguna de los anteriores no se debe ciclar
|
||||
while ((canread = xtr.Read()) && xtr.NodeType != XmlNodeType.Element) { }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
if (xmlCFDI.comprobante.Version == "3.3" || xmlCFDI.comprobante.Version == "3.2")
|
||||
{
|
||||
return xmlCFDI;
|
||||
}
|
||||
else
|
||||
{
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
public class utilValores
|
||||
{
|
||||
public utilValores(string nombre, string valor)
|
||||
{
|
||||
Nombre = nombre;
|
||||
Valor = valor;
|
||||
}
|
||||
public string Nombre { get; set; }
|
||||
public string Valor { get; set; }
|
||||
}
|
||||
public class utilImage
|
||||
{
|
||||
public utilImage(byte[] imagenByte)
|
||||
{
|
||||
ImagenByte = imagenByte;
|
||||
}
|
||||
public byte[] ImagenByte { get; set; }
|
||||
}
|
||||
}
|
||||
|
||||
public class CFDIComplemento
|
||||
{
|
||||
public string xmlns_tfd { get; set; }
|
||||
public string xsi_schemaLocation { get; set; }
|
||||
public string Version { get; set; }
|
||||
public string UUID { get; set; }
|
||||
public string FechaTimbrado { get; set; }
|
||||
public string RfcProvCertif { get; set; }
|
||||
public string SelloCFD { get; set; }
|
||||
public string NoCertificadoSAT { get; set; }
|
||||
public string SelloSAT { get; set; }
|
||||
public CFDIPago Pagos { get; set; }
|
||||
public string CadenaOriginal
|
||||
{
|
||||
get
|
||||
{
|
||||
return string.Format("||{0}|{1}|{2}|{3}|{4}|{5}||", Version, UUID, FechaTimbrado, RfcProvCertif, SelloCFD, NoCertificadoSAT);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
public class CFDIComprobante
|
||||
{
|
||||
public string xmlns_cfdi { get; set; }
|
||||
public string xmlns_xsi { get; set; }
|
||||
public string xsi_schemaLocation { get; set; }
|
||||
public string Version { get; set; }
|
||||
public string Serie { get; set; }
|
||||
public string Folio { get; set; }
|
||||
public string Fecha { get; set; }
|
||||
public string Moneda { get; set; }
|
||||
public decimal SubTotal { get; set; }
|
||||
public decimal Total { get; set; }
|
||||
public decimal Descuento { get; set; }
|
||||
public decimal TipoCambio { get; set; }
|
||||
public string TipoDeComprobante { get; set; }
|
||||
|
||||
public string TipoDeComprobanteSIG
|
||||
{
|
||||
get
|
||||
{
|
||||
string retorno = "";
|
||||
if (Version == "3.3")
|
||||
{
|
||||
switch (TipoDeComprobante)
|
||||
{
|
||||
case "I":
|
||||
retorno = "Ing";
|
||||
break;
|
||||
case "E":
|
||||
retorno = "Egs";
|
||||
break;
|
||||
case "P":
|
||||
retorno = "PA";
|
||||
break;
|
||||
//case "T":
|
||||
// retorno = "Traslado";
|
||||
// break;
|
||||
//case "N":
|
||||
// retorno = "Nómina";
|
||||
// break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
else if (Version == "3.2")
|
||||
{
|
||||
switch (TipoDeComprobante)
|
||||
{
|
||||
case "ingreso":
|
||||
retorno = "Ing";
|
||||
break;
|
||||
case "egreso":
|
||||
retorno = "Egs";
|
||||
break;
|
||||
case "P":
|
||||
retorno = "PA";
|
||||
break;
|
||||
//case "T":
|
||||
// retorno = "Traslado";
|
||||
// break;
|
||||
//case "N":
|
||||
// retorno = "Nómina";
|
||||
// break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
else { retorno = TipoDeComprobante; }
|
||||
return retorno;
|
||||
}
|
||||
}
|
||||
public string TipoDeComprobanteTexto
|
||||
{
|
||||
get
|
||||
{
|
||||
string retorno = "";
|
||||
|
||||
if (Version == "3.3")
|
||||
{
|
||||
switch (TipoDeComprobante)
|
||||
{
|
||||
case "I":
|
||||
retorno = "Ingreso";
|
||||
break;
|
||||
case "E":
|
||||
retorno = "Egreso";
|
||||
break;
|
||||
case "P":
|
||||
retorno = "Pago";
|
||||
break;
|
||||
case "T":
|
||||
retorno = "Traslado";
|
||||
break;
|
||||
case "N":
|
||||
retorno = "Nómina";
|
||||
break;
|
||||
|
||||
default:
|
||||
retorno = TipoDeComprobante;
|
||||
break;
|
||||
}
|
||||
}
|
||||
else if (Version == "3.2")
|
||||
{
|
||||
switch (TipoDeComprobante)
|
||||
{
|
||||
case "ingreso":
|
||||
retorno = "Ing";
|
||||
break;
|
||||
case "egreso":
|
||||
retorno = "Egs";
|
||||
break;
|
||||
case "P":
|
||||
retorno = "PA";
|
||||
break;
|
||||
//case "T":
|
||||
// retorno = "Traslado";
|
||||
// break;
|
||||
//case "N":
|
||||
// retorno = "Nómina";
|
||||
// break;
|
||||
|
||||
default:
|
||||
retorno = TipoDeComprobante;
|
||||
break;
|
||||
}
|
||||
}
|
||||
else { retorno = TipoDeComprobante; }
|
||||
return retorno;
|
||||
}
|
||||
}
|
||||
public string FormaPago { get; set; }
|
||||
|
||||
public string FormaPagoTexto
|
||||
{
|
||||
get
|
||||
{
|
||||
string retorno = "";
|
||||
|
||||
switch (FormaPago)
|
||||
{
|
||||
case "01": retorno = "Efectivo"; break;
|
||||
case "02": retorno = "Cheque nominativo"; break;
|
||||
case "03": retorno = "Transferencia electrónica de fondos"; break;
|
||||
case "04": retorno = "Tarjeta de crédito"; break;
|
||||
case "05": retorno = "Monedero electrónico"; break;
|
||||
case "06": retorno = "Dinero electrónico"; break;
|
||||
case "08": retorno = "Vales de despensa"; break;
|
||||
case "12": retorno = "Dación en pago"; break;
|
||||
case "13": retorno = "Pago por subrogación"; break;
|
||||
case "14": retorno = "Pago por consignación"; break;
|
||||
case "15": retorno = "Condonación"; break;
|
||||
case "17": retorno = "Compensación"; break;
|
||||
case "23": retorno = "Novación"; break;
|
||||
case "24": retorno = "Confusión"; break;
|
||||
case "25": retorno = "Remisión de deuda"; break;
|
||||
case "26": retorno = "Prescripción o caducidad"; break;
|
||||
case "27": retorno = "A satisfacción del acreedor"; break;
|
||||
case "28": retorno = "Tarjeta de débito"; break;
|
||||
case "29": retorno = "Tarjeta de servicios"; break;
|
||||
case "30": retorno = "Aplicación de anticipos"; break;
|
||||
case "31": retorno = "Intermediario pagos"; break;
|
||||
case "99": retorno = "Por definir"; break;
|
||||
default: retorno = FormaPago; break;
|
||||
}
|
||||
return retorno;
|
||||
}
|
||||
}
|
||||
public string MetodoPago { get; set; }
|
||||
public string MetodoPagoTexto
|
||||
{
|
||||
get
|
||||
{
|
||||
string retorno = "";
|
||||
|
||||
switch (MetodoPago)
|
||||
{
|
||||
case "PUE": retorno = "Pago en una sola exhibición"; break;
|
||||
case "PPD": retorno = "Pago en parcialidades o diferido"; break;
|
||||
default: retorno = MetodoPago; break;
|
||||
}
|
||||
return retorno;
|
||||
}
|
||||
}
|
||||
public string CondicionesDePago { get; set; }
|
||||
public string LugarExpedicion { get; set; }
|
||||
public string Confirmacion { get; set; }
|
||||
public string NoCertificado { get; set; }
|
||||
public string Sello { get; set; }
|
||||
public string Certificado { get; set; }
|
||||
|
||||
}
|
||||
|
||||
public class CFDIConcepto
|
||||
{
|
||||
public CFDIConcepto()
|
||||
{
|
||||
Impuestos = new List<CFDIConceptoImpuesto>();
|
||||
}
|
||||
public string ClaveProdServ { get; set; }
|
||||
public string NoIdentificacion { get; set; }
|
||||
public string Cantidad { get; set; }
|
||||
public string ClaveUnidad { get; set; }
|
||||
public string Unidad { get; set; }
|
||||
public decimal ValorUnitario { get; set; }
|
||||
public decimal Importe { get; set; }
|
||||
public decimal Descuento { get; set; }
|
||||
public string NumeroPedimento { get; set; }
|
||||
public string CuentaPredial { get; set; }
|
||||
public string Descripcion { get; set; }
|
||||
public List<CFDIConceptoImpuesto> Impuestos { get; set; }
|
||||
}
|
||||
|
||||
public class CFDIConcepto_I
|
||||
{
|
||||
public int tipo { get; set; }
|
||||
public int orden { get; set; }
|
||||
public string ClaveProdServ { get; set; }
|
||||
public string NoIdentificacion { get; set; }
|
||||
public string Cantidad { get; set; }
|
||||
public string ClaveUnidad { get; set; }
|
||||
public string Unidad { get; set; }
|
||||
public decimal ValorUnitario { get; set; }
|
||||
public decimal Importe { get; set; }
|
||||
public decimal Descuento { get; set; }
|
||||
public string NumeroPedimento { get; set; }
|
||||
public string CuentaPredial { get; set; }
|
||||
public string Descripcion { get; set; }
|
||||
|
||||
|
||||
public string Impuesto { get; set; }
|
||||
|
||||
public string Impuesto_Tipo { get; set; }
|
||||
public decimal Impuesto_Base { get; set; }
|
||||
public string Impuesto_TipoFactor { get; set; }
|
||||
public string Impuesto_TasaOCuota { get; set; }
|
||||
public decimal Impuesto_Importe { get; set; }
|
||||
}
|
||||
|
||||
public class CFDIConceptoImpuesto
|
||||
{
|
||||
public string Impuesto { get; set; }
|
||||
public string ImpuestoTexto
|
||||
{
|
||||
get
|
||||
{
|
||||
string retorno = "";
|
||||
|
||||
switch (Impuesto)
|
||||
{
|
||||
case "001": retorno = "ISR"; break;
|
||||
case "002": retorno = "IVA"; break;
|
||||
case "003": retorno = "IEPS"; break;
|
||||
}
|
||||
return retorno;
|
||||
}
|
||||
}
|
||||
public string Tipo { get; set; }
|
||||
public decimal Base { get; set; }
|
||||
public string TipoFactor { get; set; }
|
||||
public string TasaOCuota { get; set; }
|
||||
public decimal Importe { get; set; }
|
||||
|
||||
}
|
||||
|
||||
public class CFDIEmisor
|
||||
{
|
||||
public string RegimenFiscal { get; set; }
|
||||
|
||||
public string RegimenFiscalTexto
|
||||
{
|
||||
get
|
||||
{
|
||||
string retorno = "";
|
||||
|
||||
switch (RegimenFiscal)
|
||||
{
|
||||
case "601": retorno = "General de Ley Personas Morales"; break;
|
||||
case "603": retorno = "Personas Morales con Fines no Lucrativos"; break;
|
||||
case "605": retorno = "Sueldos y Salarios e Ingresos Asimilados a Salarios"; break;
|
||||
case "606": retorno = "Arrendamiento"; break;
|
||||
case "608": retorno = "Demás ingresos"; break;
|
||||
case "609": retorno = "Consolidación"; break;
|
||||
case "610": retorno = "Residentes en el Extranjero sin Establecimiento Permanente en México"; break;
|
||||
case "611": retorno = "Ingresos por Dividendos (socios y accionistas)"; break;
|
||||
case "612": retorno = "Personas Físicas con Actividades Empresariales y Profesionales"; break;
|
||||
case "614": retorno = "Ingresos por intereses"; break;
|
||||
case "616": retorno = "Sin obligaciones fiscales"; break;
|
||||
case "620": retorno = "Sociedades Cooperativas de Producción que optan por diferir sus ingresos"; break;
|
||||
case "621": retorno = "Incorporación Fiscal"; break;
|
||||
case "622": retorno = "Actividades Agrícolas, Ganaderas, Silvícolas y Pesqueras"; break;
|
||||
case "623": retorno = "Opcional para Grupos de Sociedades"; break;
|
||||
case "624": retorno = "Coordinados"; break;
|
||||
case "628": retorno = "Hidrocarburos"; break;
|
||||
case "607": retorno = "Régimen de Enajenación o Adquisición de Bienes"; break;
|
||||
case "629": retorno = "De los Regímenes Fiscales Preferentes y de las Empresas Multinacionales"; break;
|
||||
case "630": retorno = "Enajenación de acciones en bolsa de valores"; break;
|
||||
case "615": retorno = "Régimen de los ingresos por obtención de premios"; break;
|
||||
|
||||
}
|
||||
return retorno;
|
||||
}
|
||||
}
|
||||
public string Nombre { get; set; }
|
||||
public string Rfc { get; set; }
|
||||
|
||||
}
|
||||
|
||||
public class CFDIImpuesto
|
||||
{
|
||||
public string Tipo { get; set; }
|
||||
public string Impuesto { get; set; }
|
||||
public string ImpuestoTexto
|
||||
{
|
||||
get
|
||||
{
|
||||
string retorno = "";
|
||||
|
||||
switch (Impuesto)
|
||||
{
|
||||
case "001": retorno = "ISR"; break;
|
||||
case "002": retorno = "IVA"; break;
|
||||
case "003": retorno = "IEPS"; break;
|
||||
}
|
||||
return retorno;
|
||||
}
|
||||
}
|
||||
public string TipoFactor { get; set; }
|
||||
public string TasaOCuota { get; set; }
|
||||
public decimal Importe { get; set; }
|
||||
}
|
||||
|
||||
public class CFDIPago
|
||||
{
|
||||
public CFDIPago()
|
||||
{
|
||||
doctosRelacionados = new List<CFDIPagoDoctoRelacionado>();
|
||||
}
|
||||
public string FechaPago { get; set; }
|
||||
public string FormaDePagoP { get; set; }
|
||||
public string FormaDePagoPText { get; set; }
|
||||
public string MonedaP { get; set; }
|
||||
public decimal Monto { get; set; }
|
||||
public decimal TipoCambioP { get; set; }
|
||||
public string NumOperacion { get; set; }
|
||||
public string NomBancoOrdExt { get; set; }
|
||||
public string RfcEmisorCtaOrd { get; set; }
|
||||
public string CtaOrdenante { get; set; }
|
||||
public string RfcEmisorCtaBen { get; set; }
|
||||
public string CtaBeneficiario { get; set; }
|
||||
public List<CFDIPagoDoctoRelacionado> doctosRelacionados { get; set; }
|
||||
}
|
||||
|
||||
public class CFDIPagoDoctoRelacionado
|
||||
{
|
||||
public string IdDocumento { get; set; }
|
||||
public string Serie { get; set; }
|
||||
public string Folio { get; set; }
|
||||
public string MonedaDR { get; set; }
|
||||
public string MetodoDePagoDR { get; set; }
|
||||
public string NumParcialidad { get; set; }
|
||||
public decimal ImpSaldoAnt { get; set; }
|
||||
public decimal ImpPagado { get; set; }
|
||||
public decimal ImpSaldoInsoluto { get; set; }
|
||||
}
|
||||
|
||||
public class CFDIReceptor
|
||||
{
|
||||
public string Rfc { get; set; }
|
||||
public string Nombre { get; set; }
|
||||
public string ResidenciaFiscal { get; set; }
|
||||
public string NumRegIdTrib { get; set; }
|
||||
public string UsoCFDI { get; set; }
|
||||
public string UsoCFDITexto
|
||||
{
|
||||
get
|
||||
{
|
||||
string retorno = "N/A";
|
||||
|
||||
switch (UsoCFDI)
|
||||
{
|
||||
case "G01":
|
||||
retorno = "Adquisición de mercancías";
|
||||
break;
|
||||
case "G02":
|
||||
retorno = "Devoluciones, descuentos o bonificaciones";
|
||||
break;
|
||||
case "G03":
|
||||
retorno = "Gastos en general";
|
||||
break;
|
||||
case "I01":
|
||||
retorno = "Construcciones";
|
||||
break;
|
||||
case "I02":
|
||||
retorno = "Mobiliario y equipo de oficina por inversiones";
|
||||
break;
|
||||
case "I03":
|
||||
retorno = "Equipo de transporte";
|
||||
break;
|
||||
case "I04":
|
||||
retorno = "Equipo de cómputo y accesorios";
|
||||
break;
|
||||
case "I05":
|
||||
retorno = "Dados, troqueles, moldes, matrices y herramental";
|
||||
break;
|
||||
case "I06":
|
||||
retorno = "Comunicaciones telefónicas";
|
||||
break;
|
||||
case "I07":
|
||||
retorno = "Comunicaciones satelitales";
|
||||
break;
|
||||
case "I08":
|
||||
retorno = "Otra maquinaria y equipo";
|
||||
break;
|
||||
case "D01":
|
||||
retorno = "Honorarios médicos, dentales y gastos hospitalarios.";
|
||||
break;
|
||||
case "D02":
|
||||
retorno = "Gastos médicos por incapacidad o discapacidad";
|
||||
break;
|
||||
case "D03":
|
||||
retorno = "Gastos funerales.";
|
||||
break;
|
||||
case "D04":
|
||||
retorno = "Donativos.";
|
||||
break;
|
||||
case "D05":
|
||||
retorno = "Intereses reales efectivamente pagados por créditos hipotecarios (casa habitación).";
|
||||
break;
|
||||
case "D06":
|
||||
retorno = "Aportaciones voluntarias al SAR.";
|
||||
break;
|
||||
case "D07":
|
||||
retorno = "Primas por seguros de gastos médicos.";
|
||||
break;
|
||||
case "D08":
|
||||
retorno = "Gastos de transportación escolar obligatoria.";
|
||||
break;
|
||||
case "D09":
|
||||
retorno = "Depósitos en cuentas para el ahorro, primas que tengan como base planes de pensiones.";
|
||||
break;
|
||||
case "D10":
|
||||
retorno = "Pagos por servicios educativos (colegiaturas)";
|
||||
break;
|
||||
case "P01":
|
||||
retorno = "Por definir";
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
return retorno;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public class CFDIRelacionado
|
||||
{
|
||||
public string TipoRelacion { get; set; }
|
||||
public string TipoRelacionTexto
|
||||
{
|
||||
|
||||
get
|
||||
{
|
||||
string retorno;
|
||||
|
||||
switch (TipoRelacion)
|
||||
{
|
||||
case "01": retorno = "Nota de crédito de los documentos relacionados"; break;
|
||||
case "02": retorno = "Nota de débito de los documentos relacionados"; break;
|
||||
case "03": retorno = "Devolución de mercancía sobre facturas o traslados previos"; break;
|
||||
case "04": retorno = "Sustitución de los CFDI previos"; break;
|
||||
case "05": retorno = "Traslados de mercancias facturados previamente"; break;
|
||||
case "06": retorno = "Factura generada por los traslados previos"; break;
|
||||
case "07": retorno = "CFDI por aplicación de anticipo"; break;
|
||||
default:
|
||||
retorno = "Por definir";
|
||||
break;
|
||||
}
|
||||
return retorno;
|
||||
}
|
||||
}
|
||||
public string UUID { get; set; }
|
||||
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user