18 package org.turro.erp.entity;
20 import java.util.Date;
21 import javax.persistence.*;
22 import org.turro.string.Strings;
23 import org.turro.erp.db.ErpPU;
24 import org.turro.financials.db.FinancialsPU;
25 import org.turro.financials.entity.Contract;
26 import org.turro.financials.product.ProductFactory;
27 import org.turro.jpa.Dao;
28 import org.turro.jpa.entity.DaoEntity;
38 @GeneratedValue(strategy=GenerationType.IDENTITY)
39 @Column(name=
"IDENTIFIER")
42 private String customerCode;
46 private String description;
48 @Column(name=
"CONTROL_DATE")
49 @Temporal(value = TemporalType.TIMESTAMP)
50 private Date controlDate;
52 @Column(name=
"DELIVERY_DATE")
53 @Temporal(value = TemporalType.TIMESTAMP)
54 private Date delivery;
56 private boolean wantBudget;
58 private String orderId;
60 @Column(name=
"ORDER_DATE")
61 @Temporal(value = TemporalType.TIMESTAMP)
62 private Date orderDate;
64 private long customerId;
66 private long serviceId;
68 private double quantity, price;
70 private boolean noFraction;
77 this.controlDate = controlDate;
85 this.customerCode = customerCode;
93 this.customerId = customerId;
101 this.orderId = orderId;
109 this.delivery = delivery;
117 this.description = description;
133 this.noFraction = noFraction;
141 this.orderDate = orderDate;
157 this.quantity = quantity;
165 this.serviceId = service;
173 this.wantBudget = wantBudget;
179 return (quantity == 0 ? 1 : quantity) * price;
183 return Strings.isBlank(description) ||
202 "select o from OrderReference as o " +
203 "where o.customerOrder = ?",
204 new Object[] {
this });
212 protected Dao createDao() {
216 protected boolean shouldLog() {
223 if(service !=
null) {
224 serviceId = service.
getId();
233 protected Dao createDao() {
237 protected boolean shouldLog() {
244 if(customer !=
null) {
245 customerId = customer.
getId();
void setServiceId(long service)
void setOrderDate(Date orderDate)
void setPrice(double price)
void setControlDate(Date controlDate)
OrderReference getOrderReference()
void setWantBudget(boolean wantBudget)
void initFrom(OrderReference orderReference)
void setDescription(String description)
void setCustomer(Contract customer)
void setService(Contract service)
void setOrderId(String orderId)
void setCustomerId(long customerId)
void setNoFraction(boolean noFraction)
void setDelivery(Date delivery)
void setCustomerCode(String customerCode)
void setQuantity(double quantity)
String getContractorCode()
ProductByContractor getProductByContractor()
static void setContractorProduct(IProduct product, long contractorId)
Object getSingleResultOrNull(SqlClause sc)