// uniCenta oPOS - Touch Friendly Point Of Sale // Copyright (c) 2009-2013 uniCenta & previous Openbravo POS works // http://www.unicenta.net/unicentaopos // // This file is part of uniCenta oPOS // // uniCenta oPOS is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // uniCenta oPOS is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // // You should have received a copy of the GNU General Public License // along with uniCenta oPOS. If not, see <http://www.gnu.org/licenses/>. package com.openbravo.pos.customers; import com.openbravo.basic.BasicException; import com.openbravo.data.loader.DataRead; import com.openbravo.data.loader.SerializerRead; import com.openbravo.pos.forms.DataLogicSales; import java.text.ParseException; import java.text.SimpleDateFormat; import java.util.Date; import java.util.logging.Level; import java.util.logging.Logger; /** * * @author Jack Gerrard 1 Nov 12 * for later release * Customer Tranx tab */ public class CustomerTransaction { String ticketId; String productName; String unit; Double amount; Double total; Date transactionDate; String customerName; public CustomerTransaction() { } public CustomerTransaction(String ticketId, String productName, String unit, Double amount, Double total, Date transactionDate, String name) { this.ticketId = ticketId; this.productName = productName; this.unit = unit; this.amount = amount; this.total = total; this.transactionDate = transactionDate; this.customerName = name; } public String getTicketId() { return ticketId; } public void setTicketId(String ticketId) { this.ticketId = ticketId; } public Double getAmount() { return amount; } public void setAmount(Double amount) { this.amount = amount; } public void setTotal(Double total) { this.total = total; } public Double getTotal() { return total; } public String getProductName() { return productName; } public void setProductName(String productName) { this.productName = productName; } public Date getTransactionDate() { return transactionDate; } public void setTransactionDate(Date transactionDate) { this.transactionDate = transactionDate; } public String getUnit() { return unit; } public void setUnit(String unit) { this.unit = unit; } public String getCustomerName() { return customerName; } public void setCustomerName(String customerName) { this.customerName = customerName; } public static SerializerRead getSerializerRead() { return new SerializerRead() { @Override public Object readValues(DataRead dr) throws BasicException { String ticketId = dr.getString(1); String productName = dr.getString(2); String unit = dr.getString(3); Double amount = dr.getDouble(4); Double total = dr.getDouble(5); String dateValue = dr.getString(6); String customerName = dr.getString(7); SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd hh:mm:ss"); Date date = null; try { date = formatter.parse(dateValue); } catch (ParseException ex) { Logger.getLogger(DataLogicSales.class.getName()).log(Level.SEVERE, null, ex); } return new CustomerTransaction(ticketId, productName, unit, amount, total, date, customerName); } }; } }