void GerarPag(NFe nfe, XmlElement root)
{
foreach (pag pagItem in nfe.pag)
{
XmlElement nodePag = doc.CreateElement("pag"); //YA01
nodeCurrent = nodePag;
root.AppendChild(nodePag);
wCampo((int)pagItem.tPag, TpcnTipoCampo.tcInt, TpcnResources.tPag, ObOp.Obrigatorio, 2); //YA02
wCampo(pagItem.vPag, TpcnTipoCampo.tcDec2, TpcnResources.vPag, ObOp.Obrigatorio); //YA03
if (!string.IsNullOrEmpty(pagItem.CNPJ))
{
XmlElement xnodePag = doc.CreateElement("card"); //YA04
nodeCurrent = xnodePag;
nodePag.AppendChild(xnodePag);
wCampo((int)pagItem.tpIntegra, TpcnTipoCampo.tcInt, TpcnResources.tpIntegra, ObOp.Opcional);
wCampo(pagItem.CNPJ, TpcnTipoCampo.tcStr, TpcnResources.CNPJ, ObOp.Obrigatorio); //YA05
wCampo((int)pagItem.tBand, TpcnTipoCampo.tcInt, TpcnResources.tBand, ObOp.Obrigatorio, 2); //YA06
wCampo(pagItem.cAut, TpcnTipoCampo.tcStr, TpcnResources.cAut, ObOp.Obrigatorio); //YA07
}
nodeCurrent = nodePag;
}
}