}
if ( rs.getSize() > 0 ){
receiptGroup.add(rs);
}
IXMLElement xmlRe = new XMLElement("Facturas");
for (ReceiptSap receiptSap : receiptGroup) {
IXMLElement child = xmlRe.createElement("Re");
xmlRe.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) {
Double gDisc = receipt.getGlobalDiscount();
for (Item2Receipt item2Receipt : receipt.getItems()) {
IXMLElement childchild = child.createElement("CND");
child.addChild(childchild);
childchild.setAttribute("id", "F" + 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()+"");
Double tmpD = (item2Receipt.getSellDiscount()/100.0)*item2Receipt.getSellPrice();
childchild.setAttribute("discount", tmpD + gDisc*(item2Receipt.getSellPrice()-tmpD) +"");
}
}
System.out.println("[" + Shared.now() + "] " + this.getClass().getName() + " " + Shared.lineNumber() + " child = " +receiptSap.getMinFiscalId() + "-" + receiptSap.getMaxFiscalId());
}