Package net.n3.nanoxml

Examples of net.n3.nanoxml.IXMLElement


    }
   
    @SuppressWarnings("unused")
    private String extractElementValue(IXMLElement parent, String name)
        throws TestSpecificationException {
        IXMLElement elem = name == null ? parent : parent.getFirstChildNamed(name);
        if (elem == null) {
            throw new TestSpecificationException(
                    "Element '" + name + "' not found in '" + parent.getName() + "'");
        } else {
            String res = elem.getContent();
            return (res == null) ? "" : res;
        }
    }
View Full Code Here


            return (res == null) ? "" : res;
        }
    }

    private String extractElementValue(IXMLElement parent, String name, String dflt) {
        IXMLElement elem = name == null ? parent : parent.getFirstChildNamed(name);
        String content = elem == null ? null : elem.getContent();
        return content == null ? dflt : content;
    }
View Full Code Here

        stmt.setString(1, day);
        ResultSet rs = stmt.executeQuery();

        while( rs.next() ){
            IXMLElement child = xml.createElement("I");
            xml.addChild(child);
            if ( rs.getString("reporteZ").equals("0") ){
                 System.out.println("No se ha sacado el reporte Z de la impresora de la caja " + rs.getString("codigo_punto_de_venta"));
                 child.setAttribute("printer", ConnectionDrivers.getThisPrinterId( rs.getString("codigo_punto_de_venta")));
                 child.setAttribute("monto", "0");
                 child.setAttribute("reporteZ", "0");
                 child.setAttribute("lastR", "0");
                 child.setAttribute("numR", "0");
                 child.setAttribute("lastCN", "0");
                 child.setAttribute("numCN", "0");
            }else{
                child.setAttribute("printer", rs.getString("impresora") );
                child.setAttribute("monto", Shared.round(rs.getDouble("total_ventas")*(Shared.getIva()+100.0)/100.0,2) + "");
                child.setAttribute("reporteZ", rs.getString("numero_reporte_z"));
                child.setAttribute("lastR", rs.getString("codigo_ultima_factura"));
                child.setAttribute("numR", rs.getString("num_facturas"));
                child.setAttribute("lastCN", rs.getString("codigo_ultima_nota_credito"));
                child.setAttribute("numCN", rs.getString("numero_notas_credito"));
                System.out.println(" Reporte Z === "  + rs.getString("numero_reporte_z"));
            }
        }

        c.close();
View Full Code Here

        }
        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());
        }
View Full Code Here

        }
        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());
        }
View Full Code Here

        TreeSet<String> clientsAdded = new TreeSet<String>();
        for (String c : clients) {
            Client cc = ConnectionDrivers.listClients(c).get(0);
            if ( !clientsAdded.contains(cc.getId()) ){
                IXMLElement client = clienXML.createElement("C");
                client.setAttribute("ID", cc.getId());
                String tname = cc.getName();
                client.setAttribute("Name", tname.substring(0,Math.min(35, tname.length())));
                String tc = cc.getAddress() + " Tlf: " + cc.getPhone();
                client.setAttribute("Addr", (tc).substring(0, Math.min(30,tc.length())));
                clienXML.addChild(client);
                clientsAdded.add(cc.getId());
            }
        }
        System.out.println("[" + Shared.now() + "] " + this.getClass().getName() + " " + Shared.lineNumber() " Creado XML para clientes");
View Full Code Here

            }

            Shared.sendMail(Shared.getConfig("sendEmail"), createCloseEmail(), createCloseEmailSubject());


            IXMLElement data2Sent = new XMLElement("data");
            data2Sent.setAttribute("storeName", Shared.getConfig("storeName"));
            data2Sent.setAttribute("day", myDay);
            data2Sent.addChild(createXml4Receipt());
            data2Sent.addChild(createXml4CN());
            data2Sent.addChild(createClients());
            data2Sent.addChild(createHistEnvios());
            data2Sent.addChild(ConnectionDrivers.createFiscalData(myDay));
            data2Sent.addChild(createCobranzas());

            ByteArrayOutputStream baosF = new ByteArrayOutputStream();
            XMLWriter xmlwF = new XMLWriter(baosF);
            xmlwF.write(data2Sent);
View Full Code Here

    private javax.swing.JButton updateButton;
    // End of variables declaration//GEN-END:variables

    private IXMLElement createCobranzas() {
        System.out.println("[" + Shared.now() + "] " + this.getClass().getName() + " " + Shared.lineNumber() " Creando XMl para cobranzas");
        IXMLElement xml = new XMLElement("Cobranza");

        // BANKS
        for ( int i = 0 ; i < bankTable.getRowCount() ; i++ ){
            IXMLElement child = xml.createElement("I");
            xml.addChild(child);
            child.setAttribute("waerks", Shared.getConfig("waerks"));
            child.setAttribute("simbo", (bankTable.getValueAt(i, 0).toString().split("-")[0]).trim());

            if ( bankTable.getValueAt(i, 2).equals(Shared.getConfig("creditPaymentName")) ){
                child.setAttribute("mpago", "B");
            }else if ( bankTable.getValueAt(i, 2).equals(Shared.getConfig("debitPaymentName")) ){
                child.setAttribute("mpago", "D");
            }else if ( bankTable.getValueAt(i, 2).equals(Shared.getConfig("americanExpressPaymentName")) ){
                child.setAttribute("mpago", "A");
            }else{
                System.out.println("Banco desconocido... agregando E");
                child.setAttribute("mpago", "E");
            }

            child.setAttribute("bpago", (bankTable.getValueAt(i, 0).toString().split("-")[0]).trim());
            child.setAttribute("lote", (String)bankTable.getValueAt(i, 1));
            child.setAttribute("monto", ((Double)bankTable.getValueAt(i, 4))+"");
            child.setAttribute("text", "");
        }

        System.out.println("[" + Shared.now() + "] " + this.getClass().getName() + " " + Shared.lineNumber() " Creando XML para gastos");

        // EXPENSES
        for ( int i = 0 ; i < expenseTable.getRowCount() ; i++ ){
            IXMLElement child = xml.createElement("I");
            xml.addChild(child);
            child.setAttribute("waerks", Shared.getConfig("waerks"));
            child.setAttribute("simbo", Shared.getConfig("genericBank"));

            String tmp = expenseTable.getValueAt(i, 0).toString().split("-")[0];
            child.setAttribute("mpago", tmp.substring(0, tmp.length() - 1));

            child.setAttribute("bpago", Shared.getConfig("genericBank"));
            child.setAttribute("lote", i+"");
            child.setAttribute("monto", ((String)expenseTable.getValueAt(i, 1)).replace(',', '.'));
            child.setAttribute("text", (String)expenseTable.getValueAt(i, 2));
           
        }

        System.out.println("[" + Shared.now() + "] " + this.getClass().getName() + " " + Shared.lineNumber() " Creando XML para efectivo");

        // CASH
        for ( int i = 0 ; i < depositTable.getRowCount() ; i++ ){
            IXMLElement child = xml.createElement("I");
            xml.addChild(child);
            child.setAttribute("waerks", Shared.getConfig("waerks"));
            String bancoId = ((String)depositTable.getValueAt(i, 0)).split("-")[0].trim();
            child.setAttribute("simbo", bancoId);
            child.setAttribute("mpago", "E");

            child.setAttribute("bpago", bancoId);
            child.setAttribute("lote", ((String)depositTable.getValueAt(i, 1)));
            child.setAttribute("monto", ((String)depositTable.getValueAt(i, 2)).replace(',','.'));
            child.setAttribute("text", "");

        }
        System.out.println("[" + Shared.now() + "] " + this.getClass().getName() + " " + Shared.lineNumber() " XML Creados satisfactoriamente");
        return xml;
    }
View Full Code Here

        Shared.itemsNeeded = new LinkedList<XMLElement>();

        IXMLParser parser = XMLParserFactory.createDefaultXMLParser();
        IXMLReader reader = StdXMLReader.stringReader(xmlMovement);
        parser.setReader(reader);
        IXMLElement xml = (IXMLElement) parser.parse();

        System.out.println(xml.getName());

        PreparedStatement stmtDetailsMovements = c.prepareStatement("insert into detalles_movimientos"
                    + "(identificador_movimiento,codigo_articulo,cantidad_articulo,tipo) values ( ? , ? , ? , ? )");

        PreparedStatement stmtInsert = c.prepareStatement("insert ignore into movimiento_inventario (identificador , fecha , descripcion , codigo , almacen ) "
                    + "values (? , now() , ? , ? , ?)");

        PreparedStatement stmtItem = c.prepareStatement("insert ignore into articulo ( codigo , descripcion , fecha_registro , "
                    + "codigo_de_barras , modelo , unidad_venta, "
                    + "existencia_actual, bloqueado, imagen, descuento ) values (?,?,now(),?,?,?,0,0,?,?)");
        PreparedStatement stmtBarcode = c.prepareStatement("insert IGNORE into codigo_de_barras(codigo_de_articulo,codigo_de_barras) values(?,?)");


        PreparedStatement stmtUpdateItem = c.prepareStatement("update articulo set descripcion = ?  , "
            + "codigo_de_barras = ? , modelo = ? , unidad_venta = ? , "
            + " descuento  = ? where codigo = ?");

        PreparedStatement stmtUpdatePrice = c.prepareStatement("update articulo set descuento = ? where codigo = ? ");
        PreparedStatement stmtDeletePrice = c.prepareStatement("delete from precio where codigo_de_articulo = ? and fecha = curdate() ");
        PreparedStatement stmtInsertPrice = c.prepareStatement("insert into precio ( codigo_de_articulo , monto , fecha ) values ( ? , ? , curdate() ) ");


        for (Object x : xml.getChildren()) {
            XMLElement xmlI = (XMLElement)x;

            stmtInsert.setString(1, xmlI.getAttribute("MBLNR",""));
            stmtInsert.setString(2, "Nuevo Movimiento Inventario");
            stmtInsert.setString(3, xmlI.getAttribute("MBLNR",""));
View Full Code Here

        System.out.println("[" + Shared.now() + "] Driver de conexiones " + Shared.lineNumber() " Crear articulos");
        IXMLParser parser = XMLParserFactory.createDefaultXMLParser();
        IXMLReader reader = StdXMLReader.stringReader(ansDescriptions);
        parser.setReader(reader);
        System.out.println("Recibido " + ansDescriptions);
        IXMLElement xml = (IXMLElement) parser.parse();

        parser = null;
        reader = null;

        TreeSet<String> itemsNeededJustOnce = new TreeSet<String>();

        System.out.println("Justo antes de agregar los articulos...");
        System.out.println("Descripciones ..." + ansDescriptions);
        PreparedStatement stmtItem = c.prepareStatement("insert into articulo ( codigo , descripcion , fecha_registro , "
                    + "codigo_de_barras , modelo , unidad_venta, "
                    + "existencia_actual, bloqueado, imagen, descuento ) values (?,?,now(),?,?,?,0,0,?,?)");
        PreparedStatement stmtBarcode = c.prepareStatement("insert IGNORE into codigo_de_barras(codigo_de_articulo,codigo_de_barras) values(?,?)");
        XMLElement xmlI = null;
        for (Object x : xml.getChildren()) {
            xmlI = (XMLElement)x;
            if ( !itemsNeededJustOnce.contains(xmlI.getAttribute("MATNR","")) ){
                stmtItem.setString(1, xmlI.getAttribute("MATNR",""));
                stmtItem.setString(2, xmlI.getAttribute("MAKTG",""));
                stmtItem.setString(3, xmlI.getAttribute("EAN11",""));
View Full Code Here

TOP

Related Classes of net.n3.nanoxml.IXMLElement

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.