Package com.openbravo.data.loader

Examples of com.openbravo.data.loader.PreparedSentence


                 , SerializerWriteString.INSTANCE
                , new SerializerReadClass(TicketInfo.class)).list(hostname);
    }

    public List getTicketsPayments() throws BasicException {
        return new PreparedSentence(s
                    , "SELECT STATUS FROM TICKETS WHERE TICKETTYPE = 2 AND DATERETURN IS NULL GROUP BY STATUS "
                    , null
                    , SerializerReadInteger.INSTANCE).list();
    }
View Full Code Here


                    , null
                    , SerializerReadInteger.INSTANCE).list();
    }

    public List getTicketsReturned() throws BasicException {
        return new PreparedSentence(s
                    //, "SELECT STATUS FROM TICKETS WHERE DATERENDU IS NOT NULL AND TICKETTYPE = 0 AND DATERENDU>=(SELECT DATESTART FROM CLOSEDCASH WHERE DATEEND IS NULL AND HOST LIKE ? )"
                        , "SELECT T.ID, T.TICKETTYPE, T.TICKETID, R.DATENEW, R.MONEY, R.ATTRIBUTES, P.ID, P.NAME, T.CUSTOMER, T.DATERETURN, T.DATERENDU, T.STATUS "
                        + "FROM CLOSEDCASH C, RECEIPTS R JOIN TICKETS T ON R.ID = T.ID LEFT OUTER JOIN PEOPLE P ON T.PERSON = P.ID "
                        + "WHERE C.MONEY=R.MONEY AND C.HOST LIKE ? AND ( T.DATERENDU IS NOT NULL AND T.TICKETTYPE = 0 AND T.STATUS > 0 ) "
                        + "OR ( T.DATERETURN IS NOT NULL AND T.TICKETTYPE > 0 AND T.STATUS > 0 )"
View Full Code Here

//                    , "SELECT P.TOTAL FROM TICKETS T LEFT JOIN PAYMENTS P ON P.RECEIPT = T.ID WHERE T.STATUS = ? AND T.TICKETTYPE = 0 AND P.PAYMENT LIKE 'debt' "
//                    , SerializerWriteString.INSTANCE
//                    , SerializerReadInteger.INSTANCE).list();
//    }
    public double getDebt(String status) throws BasicException {
       PreparedSentence p = new PreparedSentence(s
                    , "SELECT SUM(P.TOTAL) FROM TICKETS T LEFT JOIN PAYMENTS P ON P.RECEIPT = T.ID WHERE T.STATUS = ? AND T.TICKETTYPE = 0 AND P.PAYMENT LIKE 'debt' GROUP BY STATUS"
                    , SerializerWriteString.INSTANCE
                    , SerializerReadDouble.INSTANCE);
        Double d = (Double) p.find(status);
        return d == null ? 0.0 : d.doubleValue();
    }
View Full Code Here

        return d == null ? 0.0 : d.doubleValue();
    }

    public double getPaid(String status) throws BasicException {
        //System.out.println(status);
        PreparedSentence p = new PreparedSentence(s
                    , "SELECT SUM(P.TOTAL) FROM TICKETS T LEFT JOIN PAYMENTS P ON P.RECEIPT = T.ID WHERE T.STATUS = ? AND ( T.TICKETTYPE = 2 OR T.TICKETTYPE = 1 ) AND P.TOTAL < 0.0 "
                        , SerializerWriteString.INSTANCE
                    , SerializerReadDouble.INSTANCE);
        Double d = (Double) p.find(status);
        return d == null ? 0.0 : d.doubleValue();
    }
View Full Code Here

        Double d = (Double) p.find(status);
        return d == null ? 0.0 : d.doubleValue();
    }
   
    public List getUsers() throws BasicException {
        return new PreparedSentence(s
                    , "SELECT ID, TAXID FROM CUSTOMERS "              
                    , null
                    , new SerializerReadClass(UserInfo.class)).list();
    }   
View Full Code Here

                    , null
                    , new SerializerReadClass(UserInfo.class)).list();
    }   
   
    public List getTicketLines(final String ticket) throws BasicException {
        return new PreparedSentence(s
//                , "SELECT L.TICKET, L.LINE, L.PRODUCT, L.UNITS, L.PRICE, T.ID, T.NAME, T.CATEGORY, T.CUSTCATEGORY, T.PARENTID, T.RATE, T.RATECASCADE, T.RATEORDER, L.ATTRIBUTES " +
//                  "FROM TICKETLINES L, TAXES T WHERE L.TAXID = T.ID AND L.TICKET = ?"
                 , "SELECT L.TICKET, L.LINE, L.PRODUCT, L.ATTRIBUTESETINSTANCE_ID, L.UNITS, L.PRICE, T.ID, T.NAME, T.CATEGORY, T.CUSTCATEGORY, T.PARENTID, T.RATE, T.RATECASCADE, T.RATEORDER, L.ATTRIBUTES " +
                  "FROM TICKETLINES L, TAXES T WHERE L.TAXID = T.ID AND L.TICKET = ? ORDER BY L.LINE"
                , SerializerWriteString.INSTANCE
View Full Code Here

                , SerializerWriteString.INSTANCE
                , new SerializerReadClass(TicketLineInfo.class)).list(ticket);
    }
   
    public List getTicketPayments(final String ticket) throws BasicException {
        return new PreparedSentence(s
                , "SELECT TOTAL, PAYMENT FROM PAYMENTS WHERE RECEIPT = ?"            
                , SerializerWriteString.INSTANCE
                , new SerializerRead() {
                    public Object readValues(DataRead dr) throws BasicException {
                        return new PaymentInfoTicket(
View Full Code Here

   
  }

  public void execUpdateTicket(final String ticketid, final String orderID ) throws BasicException {
   
    new PreparedSentence(s, "UPDATE  TICKETS SET STATUS = ? WHERE STATUS = 0 AND TICKETID = ?",
                SerializerWriteParams.INSTANCE
                ).exec(new DataParams() {
                  public void writeValues() throws BasicException {
                    setString(1, orderID);
                    setString(2, ticketid);
View Full Code Here

                final Date date = new Date();
                final SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
                final String dateReturn = sdf.format(date);

    new PreparedSentence(s, "UPDATE  TICKETS SET DATERETURN = ? WHERE STATUS = ? AND TICKETTYPE = ? ",
                SerializerWriteParams.INSTANCE
                ).exec(new DataParams() {
                  public void writeValues() throws BasicException {
                    setString(1, dateReturn);
                    setString(2, orderID);
View Full Code Here

//        }
//    }
   
    public double getCategoryCount(String name) {
       try {
            PreparedSentence p = new PreparedSentence(s
                        //   , "SELECT SUM(P.TOTAL) FROM TICKETS T LEFT JOIN PAYMENTS P ON P.RECEIPT = T.ID WHERE T.STATUS = ? AND T.TICKETTYPE = 0 AND P.PAYMENT LIKE 'debt' GROUP BY STATUS"
                     "SELECT COUNT(P.ID) FROM CATEGORIES C INNER JOIN PRODUCTS P ON P.CATEGORY = C.ID AND C.NAME = ? "
                            , SerializerWriteString.INSTANCE
                            , SerializerReadDouble.INSTANCE);
            Double d = (Double) p.find(name);
           
            return d == null ? 0.0 : d.doubleValue();
           
        } catch (BasicException ex) {
           
View Full Code Here

TOP

Related Classes of com.openbravo.data.loader.PreparedSentence

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.