}
if ( rs.getSize() > 0 ){
CreditNoteGroup.add(rs);
}
IXMLElement xmlCN = new XMLElement("NotasDeCredito");
for (ReceiptSap receiptSap : CreditNoteGroup) {
IXMLElement child = xmlCN.createElement("CN");
xmlCN.addChild(child);
child.setAttribute("getId", receiptSap.getId());
child.setAttribute("getKind", receiptSap.getKind());
child.setAttribute("getClient", receiptSap.getClient());
child.setAttribute("range", receiptSap.getMinFiscalId() + "-" + receiptSap.getMaxFiscalId());
child.setAttribute("getZ", receiptSap.getZ());
child.setAttribute("getPrinterId", receiptSap.getPrinterId());
int position = 1;
for (Receipt receipt : receiptSap.receipts) {
for (Item2Receipt item2Receipt : receipt.getItems()) {
IXMLElement childchild = child.createElement("CND");
child.addChild(childchild);
childchild.setAttribute("id", "D" + receiptSap.getId());
childchild.setAttribute("position", Shared.df2intSAP.format(position++));
childchild.setAttribute("barcode", item2Receipt.getItem().getMainBarcode());
childchild.setAttribute("quant", item2Receipt.getQuant().toString());
childchild.setAttribute("sellUnits", item2Receipt.getItem().getSellUnits());
childchild.setAttribute("sellPrice", item2Receipt.getSellPrice()+"");
childchild.setAttribute("discount", (item2Receipt.getSellDiscount()/100.0)*item2Receipt.getSellPrice()+"");
}
}
System.out.println("[" + Shared.now() + "] " + this.getClass().getName() + " " + Shared.lineNumber() + " Creando Grupo = " + receiptSap.getMinFiscalId() + "-" + receiptSap.getMaxFiscalId());
}