Package net.n3.nanoxml

Examples of net.n3.nanoxml.XMLElement


        return clienXML;
    }

    private IXMLElement createHistEnvios() throws SQLException{
        XMLElement xml = new XMLElement("HistoricosDeEnvios");

        xml.setAttribute("ventas", Shared.round((receiptTotal*(Shared.getIva()+100.0)/100.0),2) + "");
        xml.setAttribute("Observaciones", noteField.getText());

        return xml;
    }
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");
View Full Code Here

    }

    protected static IXMLElement createFiscalData(String day) throws SQLException{

        System.out.println("[" + Shared.now() + "] Driver de conexiones " + Shared.lineNumber() " Crear XML con la informacion fiscal");
        XMLElement xml = new XMLElement("FiscalData");
        Connection c = ConnectionDrivers.cpds.getConnection();
        PreparedStatement stmt = c.prepareStatement("select total_ventas , impresora , numero_reporte_z ,"
                + " codigo_ultima_factura, num_facturas, codigo_ultima_nota_credito, numero_notas_credito, reporteZ, codigo_punto_de_venta "
                + "from dia_operativo where datediff(fecha,?) = 0");

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

        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",""));
            stmtInsert.setString(4, "");
            stmtInsert.executeUpdate();

            stmtUpdateItem.setString(1, xmlI.getAttribute("MAKTG",""));
            stmtUpdateItem.setString(2, xmlI.getAttribute("EAN11",""));
            stmtUpdateItem.setString(3, xmlI.getAttribute("MATKL",""));
            stmtUpdateItem.setString(4, xmlI.getAttribute("MSEH3",""));
            stmtUpdateItem.setString(5, xmlI.getAttribute("DISC",""));
            stmtUpdateItem.setString(6, xmlI.getAttribute("MATNR",""));
            int ans = stmtUpdateItem.executeUpdate();

            if ( ans == 0 ){
                stmtItem.setString(1, xmlI.getAttribute("MATNR",""));
                stmtItem.setString(2, xmlI.getAttribute("MAKTG",""));
                stmtItem.setString(3, xmlI.getAttribute("EAN11",""));
                stmtItem.setString(4, xmlI.getAttribute("MATKL",""));
                stmtItem.setString(5, xmlI.getAttribute("MSEH3",""));
                stmtItem.setString(6, Shared.getConfig("photoDir") + xmlI.getAttribute("MATNR","") + ".JPG");
                stmtItem.setString(7, xmlI.getAttribute("DISC",""));
                stmtItem.executeUpdate();
            }

            stmtUpdatePrice.setString(1, xmlI.getAttribute("",""));
            stmtUpdatePrice.setString(2, xmlI.getAttribute("MATNR",""));
            stmtUpdatePrice.executeUpdate();

            stmtDeletePrice.setString(1, xmlI.getAttribute("MATNR",""));
            stmtDeletePrice.executeUpdate();

            stmtInsertPrice.setString(1, xmlI.getAttribute("MATNR",""));
            stmtInsertPrice.setString(2, xmlI.getAttribute("PRICE",""));
            stmtInsertPrice.executeUpdate();

            stmtBarcode.setString(1, xmlI.getAttribute("MATNR",""));
            stmtBarcode.setString(2, xmlI.getAttribute("EAN11",""));
            stmtBarcode.executeUpdate();

            // TODO QUITAR
            /*if ( !xmlI.getAttribute("MBLNR").equals("4900458135") && !xmlI.getAttribute("MBLNR").equals("4900458134")
                    && !xmlI.getAttribute("MBLNR").equals("4900458133") && !xmlI.getAttribute("MBLNR").equals("4900458130") && !xmlI.getAttribute("MBLNR").equals("4900458129")){
                continue;
            }*/
            /*if (
                    !xmlI.getAttribute("MBLNR").equals("4900447579")&& !xmlI.getAttribute("MBLNR").equals("4900447580")
                    && !xmlI.getAttribute("MBLNR").equals("4900447581")){
                continue;
            }*/
            int reason = Shared.calculateReason(xmlI.getAttribute("BWART",""), xmlI.getAttribute("SHKZG",""));
            // TODO QUITAR
            //reason *= -1;

            System.out.println("MBLNR = " + xmlI.getAttribute("MBLNR","") + " reason = " + reason + " codigo_articulo = " + xmlI.getAttribute("MATNR",""));
           
            stmtDetailsMovements.setString(1, xmlI.getAttribute("MBLNR",""));
            stmtDetailsMovements.setString(2, xmlI.getAttribute("MATNR",""));
            stmtDetailsMovements.setInt(3, reason * Integer.parseInt(xmlI.getAttribute("MENGE","").split("\\.")[0]));
            stmtDetailsMovements.setString(4, xmlI.getAttribute("BWART",""));
            stmtDetailsMovements.executeUpdate();
            System.out.println("Movimiento " + reason + " articulo " + xmlI.getAttribute("MATNR",""));
        }

        xml = null;
       
        return "";
View Full Code Here

  /**
   * Create the implementing object
   */
  public NanoXmlElement()
  {
    element  = new XMLElement();
  }
View Full Code Here

   * name parameter
   * @param name The name to be assigned to the implementing XmlElement
   */
  public NanoXmlElement( String name )
  {
    element = new XMLElement( name );
  }
View Full Code Here

   * Produce a deep copy of this element
   * @return the copy
   */
  public Object clone()
  {
    XMLElement clone = clone( element );
    return new NanoXmlElement( clone );
  }
View Full Code Here

    return new NanoXmlElement( clone );
  }
 
  private XMLElement clone( IXMLElement e )
  {
    XMLElement clone = new XMLElement( e.getName());
    // Setting the content seems to wipe the children    LOC 04/03/2007
    String content = e.getContent();
    if ( content != null ) {
      content.trim();
      if ( content.length() > 0 )
       clone.setContent( content );
    }
   
    Enumeration keys = e.getAttributes().keys();
    while ( keys.hasMoreElements()) {
      String attribName = keys.nextElement().toString();
      clone.setAttribute( attribName, e.getAttribute( attribName ));
    }    
   
    Vector kids = e.getChildren();
    int numKids = kids.size();
    for ( int i = 0; i < numKids; i++ ) {
      XMLElement o = (XMLElement)kids.elementAt( i );
      clone.addChild( clone( o ));
    }
   
    return clone;       
  }
View Full Code Here

  private void writeContent(final ITreeWriter writer, final NodeModel node, final NodeStyleModel style,
                            final boolean forceFormatting) throws IOException {
    if(! NodeWriter.shouldWriteSharedContent(writer))
      return;
    if (forceFormatting || style != null) {
      final XMLElement fontElement = new XMLElement();
      fontElement.setName("font");
      boolean isRelevant = forceFormatting;
      final String fontFamilyName = forceFormatting ? nsc.getFontFamilyName(node) : style.getFontFamilyName();
      if (fontFamilyName != null) {
        fontElement.setAttribute("NAME", fontFamilyName);
        isRelevant = true;
      }
      final Integer fontSize = forceFormatting ? Integer.valueOf(nsc.getFontSize(node)) : style.getFontSize();
      if (fontSize != null) {
        fontElement.setAttribute("SIZE", Integer.toString(fontSize));
        isRelevant = true;
      }
      final Boolean bold = forceFormatting ? Boolean.valueOf(nsc.isBold(node)) : style.isBold();
      if (bold != null) {
        fontElement.setAttribute("BOLD", bold ? "true" : "false");
        isRelevant = true;
      }
      final Boolean italic = forceFormatting ? Boolean.valueOf(nsc.isItalic(node)) : style.isItalic();
      if (italic != null) {
        fontElement.setAttribute("ITALIC", italic ? "true" : "false");
        isRelevant = true;
      }
      if (isRelevant) {
        writer.addElement(style, fontElement);
      }
View Full Code Here

TOP

Related Classes of net.n3.nanoxml.XMLElement

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.