Ver Mensaje Individual
  #1 (permalink)  
Antiguo 29/01/2014, 21:45
rudolfcruz
 
Fecha de Ingreso: enero-2014
Mensajes: 14
Antigüedad: 10 años, 3 meses
Puntos: 1
como agregar mas nodos "concepto" en un ciclo for??

hola programadores necesito saber como agregar mas conceptos para el cfdi xml, por ejemplo para agregar estos 3 conceptos.

<cfdi:Conceptos>
<cfdi:Concepto cantidad="1.00" unidad="Pieza" noIdentificacion="Butterfly4" descripcion="Butterfly Valve 4in 175 PSI Ductile iron wafer body buna-n seats ductile iron Weco(FMC) 3245819" valorUnitario="190.0000" importe="190.0000" />
<cfdi:Concepto cantidad="1.00" unidad="Pieza" noIdentificacion="Butterfly4" descripcion="Butterfly Valve 4in 175 PSI Ductile iron wafer body buna-n seats ductile iron Weco(FMC) 3245819" valorUnitario="190.0000" importe="190.0000" />
<cfdi:Concepto cantidad="1.00" unidad="Pieza" noIdentificacion="Butterfly4" descripcion="Butterfly Valve 4in 175 PSI Ductile iron wafer body buna-n seats ductile iron Weco(FMC) 3245819" valorUnitario="190.0000" importe="190.0000" />
</cfdi:Conceptos>

dejo el codigo en c# trabajo la creacion del xml con inq
public static void CrearArchivoCFDI()
{
try
{
string selloDigital_Certificado = "resultado";
string otro = "otro";
string Resultado = CrearSelloDigitalEmisor(ref selloDigital_Certificado, ref otro);

using (var context = new PL_Datos.DatosBDContext())
{
PL_Datos.PLcat_Cotizacion cotizacion = (from co in context.PLcat_Cotizacion
where co.Id_PLcatCotizacion == 1
select co).Single();
foreach (PL_Datos.PLtrn_PartidasCotizacion partidas in cotizacion.PLtrn_PartidasCotizacion)
{
}
XNamespace cfdi = XNamespace.Get("http://www.sat.gob.mx/cfd/3");
XNamespace xsi = XNamespace.Get("http://www.w3.org/2001/XMLSchema-instance");
XDocument xmlFactura = new XDocument(
new XDeclaration("1.0", "utf-8", "yes"),
new XComment("DATOS DE FACTURACION ELECTRONICA"),
new XElement(cfdi + "Comprobante",
new XAttribute(XNamespace.Xmlns + "cfdi", "http://www.sat.gob.mx/cfd/3"),
new XAttribute(XNamespace.Xmlns + "xsi", "http://www.w3.org/2001/XMLSchema-instance"),
new XAttribute(xsi + "schemaLocation", "http://www.sat.gob.mx/cfd/3 http://www.sat.gob.mx/sitio_internet/cfd/3/cfdv32.xsd"),
new XAttribute("version", "3.2"),
new XAttribute("serie", ""),
new XAttribute("folio", "00001"),
new XAttribute("fecha", ""),
new XAttribute("sello", ""),
new XAttribute("formaDePago", ""),
new XAttribute("noCertificado", ""),
new XAttribute("certificado", ""),
new XAttribute("condicionesDePago", ""),
new XAttribute("subTotal", ""),
new XAttribute("TipoCambio", ""),
new XAttribute("Moneda", ""),
new XAttribute("total", ""),
new XAttribute("metodoDePago", ""),
new XAttribute("tipoDeComprobante", ""),
new XAttribute("LugarExpedicion", "Ciudad del Carmen, Campeche, México"),
new XElement(cfdi + "Emisor",
new XAttribute("rfc", "GAIL810405RU6"),
new XAttribute("nombre", "LAZARO GARCIA IZQUIERDO"),
new XElement(cfdi + "DomicilioFiscal",
new XAttribute("calle", "40"),
new XAttribute("noExterior", "85"),
new XAttribute("colonia", "CUAUHTEMOC CIUDAD DEL CAMREN"),
new XAttribute("municipio", "CARMEN"),
new XAttribute("estado", "CAMPECHE"),
new XAttribute("pais", "MÉXICO"),
new XAttribute("codigoPostal", "24170")),
new XElement(cfdi + "RegimenFiscal",
new XAttribute("Regimen", ""))),
new XElement(cfdi + "Receptor",
new XAttribute("rfc", ""),
new XAttribute("nombre", ""),
new XElement(cfdi + "Domicilio",
new XAttribute("pais", ""),
new XAttribute("calle", ""),
new XAttribute("estado", ""),
new XAttribute("colonia", ""),
new XAttribute("municipio", ""),
new XAttribute("noExterior", ""),
new XAttribute("noInterior", ""),
new XAttribute("codigoPostal", ""))),
new XElement(cfdi + "Conceptos",
new XElement(cfdi + "Concepto",
new XAttribute("cantidad", ""),
new XAttribute("unidad", ""),
new XAttribute("noIdentificacion", ""),
new XAttribute("descripcion", ""),
new XAttribute("valorUnitario", ""),
new XAttribute("importe", ""))),
new XElement(cfdi + "Impuestos",
new XAttribute("totalImpuestosTrasladados", ""),
new XElement(cfdi + "Traslados",
new XElement(cfdi + "Traslado",
new XAttribute("impuesto", "IVA"),
new XAttribute("tasa", ""),
new XAttribute("importe", "")))),
new XElement(cfdi + "Complemento")));

xmlFactura.Save(@"c:\PartesEnLinea\PL_Presentacion \facturacion\prueba.xml");
}
}
catch (Exception ex)
{
throw ex;
}
}
espero proporcionen ayuda
saludos, Grcaias.