Package com.openbravo.data.loader

Examples of com.openbravo.data.loader.PreparedSentence


//                    , "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

                });
    }
   
    public int updateCustomerExt(final CustomerInfoExt customer) throws BasicException {
    
        return new PreparedSentence(s
                , "UPDATE CUSTOMERS SET NOTES = ? WHERE ID = ?"
                , SerializerWriteParams.INSTANCE     
                ).exec(new DataParams() { public void writeValues() throws BasicException {
                        setString(1, customer.getNotes());
                        setString(2, customer.getId());
View Full Code Here

                        setString(2, customer.getId());
                }});       
    }
   
    public final SentenceList getReservationsList() {
        return new PreparedSentence(s
            , "SELECT R.ID, R.CREATED, R.DATENEW, C.CUSTOMER, CUSTOMERS.TAXID, CUSTOMERS.SEARCHKEY, COALESCE(CUSTOMERS.NAME, R.TITLE),  R.CHAIRS, R.ISDONE, R.DESCRIPTION " +
              "FROM RESERVATIONS R LEFT OUTER JOIN RESERVATION_CUSTOMERS C ON R.ID = C.ID LEFT OUTER JOIN CUSTOMERS ON C.CUSTOMER = CUSTOMERS.ID " +
              "WHERE R.DATENEW >= ? AND R.DATENEW < ?"
            , new SerializerWriteBasic(new Datas[] {Datas.TIMESTAMP, Datas.TIMESTAMP})
            , new SerializerReadBasic(customerdatas));            
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.