Regalamiunsorriso/decompiled-libs/www/acxent-common-1.0.1/it/acxent/cart/Cart.java

1051 lines
29 KiB
Java
Raw Normal View History

2026-04-22 18:41:37 +02:00
package it.acxent.cart;
import it.acxent.anag.Users;
import it.acxent.brt.api.json.PudoAddress;
import it.acxent.common.Parm;
import it.acxent.db.ApplParmFull;
import it.acxent.db.DBAdapter;
import it.acxent.db.ResParm;
import it.acxent.util.DoubleOperator;
import it.acxent.util.Vectumerator;
import java.io.Serializable;
import java.sql.Date;
import java.text.NumberFormat;
import java.util.Calendar;
import java.util.Enumeration;
import java.util.Hashtable;
public class Cart implements Serializable, Cloneable {
private static final long serialVersionUID = -9088974146772197119L;
private static final String MSG_QTA_NON_DISP0 = "Quantita' richiesta non disponibile";
private Hashtable<String, CartItem> items = null;
private long numberOfItems = 0L;
private Date dataNoleggioStart;
private Date dataNoleggioEnd;
private long flgCartType;
private String id_cart;
private boolean usePriceWithVat = true;
private long id_ivaDelivery;
private double aliquotaIvaDelivery;
private String descDiscountPerc;
private long discountPerc;
private String promotionCode;
private boolean deliveryCostSetted = false;
private ApplParmFull applParmFull;
private double deliveryWarnCost;
private double moreCost;
private String note;
private IvaGroup rri;
private IvaGroup rriCompleto;
private String giftAddress;
private long flgGift;
private long flgPayment;
private String giftText;
private long flgShipping;
private String descShipping;
private long flgStatus;
private double deliveryCost;
private String descMoreCost;
private long id_users;
private long flgPickup;
private double discount;
private String descDiscount;
private String descPayment;
private String codPromo;
private double percDiscountPay;
private double percCommissionPay;
private String descDiscountPay;
private String descCommissionPay;
private boolean isDeliveryCostSetted = false;
private boolean costoSpedizionePreventivo;
private long flgDeliveryType;
private String pudoDesc;
private String pudoId;
public static final long DELIVERY_TYPE_STD = 0L;
public static final long DELIVERY_TYPE_NEGOZIO = 1L;
public static final long DELIVERY_TYPE_PUDO = 2L;
public static final String P_CC_COSTO_SPED_FULL = "CC_COSTO_SPED_FULL";
public static String P_CART_WITH_VAT = "CART_WITH_VAT";
public static String P_DELIVERY_WARN_COST = "DELIV_WARN_COST";
public static String P_ID_IVA_CEE = "ID_IVA_CEE";
public static String P_DELIVERY_IVA_ID = "DELIV_IVA_ID";
public static String P_CHECKOUTMSG = "CHECKOUT_MSG";
public static String P_DELIVERY_COST = "DELIV_COST";
public static String P_DELIVERY_COST_PUDO = "DELIV_COST_PUDO";
public static String P_USE_PRICE_WITH_VAT = "PRICE_W_VAT";
public static String P_DELIVERY_IVA_ALIQUOTA = "DELIV_IVA_ALIQUOTA";
public static String P_ID_IVA_EXTRACEE = "ID_IVA_EXTRACEE";
public static String P_MORE_COST = "MORE_COST";
public static String P_DELIVERY_FREE_ABOVE = "DELIVERY_FREE_ABOVE";
public static String P_PROCEDI_PAGAMENTO = "PROCEDI_PAGAMENTO";
public Cart() {
this.items = new Hashtable<>();
this.id_users = 0L;
createCartId();
}
public Cart(ApplParmFull theApplParmFull) {
this.items = new Hashtable<>();
this.id_users = 0L;
setApplParmFull(theApplParmFull);
createCartId();
}
@Deprecated
public ResParm add(AcCartObject l_aco) {
return add(l_aco, true);
}
public void clear() {
this.items.clear();
this.numberOfItems = 0L;
}
private void createCartId() {
if (getId_cart().isEmpty()) {
Calendar cal = Calendar.getInstance();
setId_cart(String.valueOf(cal.getTimeInMillis()));
}
}
protected void finalize() throws Throwable {
this.items.clear();
}
public ApplParmFull getApplParmFull() {
return this.applParmFull;
}
public double getDeliveryCost() {
return this.deliveryCost;
}
public boolean areAllItemsAvailable() {
Enumeration<CartItem> enu = getItems();
while (enu.hasMoreElements()) {
CartItem ci = enu.nextElement();
if (!ci.isItemAvailable())
return false;
}
return true;
}
public Enumeration<CartItem> getItems() {
return new Vectumerator(this.items.elements());
}
public long getNumberOfItems() {
return this.numberOfItems;
}
public double getQuantityOfItems() {
Enumeration<CartItem> enu = getItems();
double quantityOfItems = 0.0D;
while (enu.hasMoreElements()) {
CartItem row = enu.nextElement();
quantityOfItems += row.getQuantity();
}
return quantityOfItems;
}
public double xgetAvailItemQty(long theId, double l_dispo) {
Long itemPrimaryKey = new Long(theId);
if (this.items.containsKey(itemPrimaryKey)) {
CartItem cartItem = this.items.get(itemPrimaryKey);
DoubleOperator dispo = new DoubleOperator(l_dispo);
dispo.subtract(cartItem.getQuantity());
return dispo.getResult();
}
return l_dispo;
}
public ResParm quantityDecrement(AcCartObject l_aco) {
ResParm rp = new ResParm(true);
if (this.items.containsKey(l_aco.getItemsKey())) {
CartItem cartItem = this.items.get(l_aco.getItemsKey());
if (cartItem.getQuantity() - 1.0D == 0.0D) {
remove(l_aco);
} else {
cartItem.setQuantity(cartItem.getQuantity() - 1.0D);
}
}
setRri(null);
setRriCompleto(null);
return rp;
}
public ResParm quantityIncrement(AcCartObject l_aco, boolean checkAvail) {
ResParm rp = new ResParm(true);
if (this.items.containsKey(l_aco.getItemsKey())) {
CartItem cartItem = this.items.get(l_aco.getItemsKey());
if (checkAvail) {
double l_avail = cartItem.getAvailItemQty();
if (cartItem.getQuantity() >= l_avail) {
rp.setStatus(false);
rp.setMsg(getApplParmFull().translate("Quantita' richiesta non disponibile", l_aco.getLang()));
} else {
cartItem.setQuantity(cartItem.getQuantity() + 1.0D);
}
} else {
cartItem.setQuantity(cartItem.getQuantity() + 1.0D);
}
} else {
CartItem newItem = new CartItem(l_aco, getApplParmFull(), 1.0D);
if (checkAvail) {
double l_avail = newItem.getAvailItemQty();
if (newItem.getQuantity() > l_avail) {
rp.setStatus(false);
rp.setMsg(getApplParmFull().translate("Quantita' richiesta non disponibile", l_aco.getLang()));
} else {
this.items.put(l_aco.getItemsKey(), newItem);
this.numberOfItems++;
}
} else {
this.items.put(l_aco.getItemsKey(), newItem);
this.numberOfItems++;
}
}
setRri(null);
setRriCompleto(null);
return rp;
}
public void remove(AcCartObject l_aco) {
if (this.items.containsKey(l_aco.getItemsKey())) {
this.items.remove(l_aco.getItemsKey());
this.numberOfItems--;
setRri(null);
setRriCompleto(null);
}
}
public void setApplParmFull(ApplParmFull newApplParmFull) {
this.applParmFull = newApplParmFull;
}
public void setDeliveryCost(double newDeliveryCost) {
this.deliveryCost = newDeliveryCost;
}
public double getTotPrice() {
DoubleOperator temp = new DoubleOperator();
Enumeration<CartItem> enu = getItems();
while (enu.hasMoreElements()) {
CartItem row = enu.nextElement();
temp.setScale(4, 5);
temp.add(row.getTotPrice(getId_users()));
}
return temp.getResult();
}
public double getScontrinoTotPriceVAT() {
DoubleOperator temp = new DoubleOperator();
Enumeration<CartItem> enu = getItems();
while (enu.hasMoreElements()) {
CartItem row = enu.nextElement();
temp.setScale(4, 5);
temp.add(row.getTotPriceWVat(getId_users()));
}
return temp.getResult();
}
public double getImportoIvaTotale() {
return getRriCompleto().getTotIva();
}
public double getImportoIva() {
return getRri().getTotIva();
}
public double getTotPriceNoSale() {
DoubleOperator temp = new DoubleOperator();
Enumeration<CartItem> enu = getItems();
while (enu.hasMoreElements()) {
CartItem row = enu.nextElement();
if (!row.isSale()) {
temp.setScale(4, 5);
temp.add(row.getTotPrice(getId_users()));
}
}
return temp.getResult();
}
public double getScontrinoTotPriceNoSale() {
DoubleOperator temp = new DoubleOperator();
Enumeration<CartItem> enu = getItems();
while (enu.hasMoreElements()) {
CartItem row = enu.nextElement();
if (!row.isSale()) {
temp.setScale(4, 5);
temp.add(row.getTotPriceWVat(getId_users()));
}
}
return temp.getResult();
}
public double getTotPriceWDiscount() {
if (getDiscountPercTot() == 0.0D)
return getTotPrice();
DoubleOperator temp = new DoubleOperator(getTotPrice());
temp.setScale(4, 5);
temp.subtract(getTotDiscount());
return temp.getResult();
}
public double getScontrinoTotPriceWDiscount() {
if (getDiscountPercTot() == 0.0D)
return getScontrinoTotPriceVAT();
DoubleOperator temp = new DoubleOperator(getScontrinoTotPriceVAT());
temp.setScale(4, 5);
temp.subtract(getScontrinoTotDiscount());
return temp.getResult();
}
public double getTotDiscount() {
if (getDiscountPercTot() == 0.0D)
return 0.0D;
DoubleOperator temp = new DoubleOperator(getTotPriceNoSale());
temp.setScale(4, 5);
temp.multiply(getDiscountPercTot());
temp.divide(100.0F);
return temp.getResult();
}
public double getScontrinoTotDiscount() {
if (getDiscountPercTot() == 0.0D)
return 0.0D;
DoubleOperator temp = new DoubleOperator(getScontrinoTotPriceNoSale());
temp.setScale(4, 5);
temp.multiply(getDiscountPercTot());
temp.divide(100.0F);
return temp.getResult();
}
public double getTotCart() {
DoubleOperator temp = new DoubleOperator(getTotPriceWDiscount());
temp.setScale(4, 5);
temp.add(getDeliveryCost());
temp.add(getDeliveryWarnCost());
temp.add(getMoreCost());
temp.subtract(getDiscount());
return temp.getResult();
}
public double getTotCartVAT() {
DoubleOperator temp = new DoubleOperator(getTotCart());
temp.setScale(4, 5);
temp.add(getImportoIvaTotale());
return temp.getResult();
}
public double getTotPriceVAT() {
DoubleOperator temp = new DoubleOperator(getTotPrice());
temp.setScale(4, 5);
temp.add(getImportoIva());
return temp.getResult();
}
public String getId_cart() {
return (this.id_cart == null) ? "" : this.id_cart;
}
public void setId_cart(String id_cart) {
this.id_cart = id_cart;
}
public boolean isDeliveryCostSetted() {
return this.deliveryCostSetted;
}
public void setDeliveryCostSetted(boolean deliveryCostSetted) {
this.deliveryCostSetted = deliveryCostSetted;
}
public String getDescDiscountPerc() {
return (this.descDiscountPerc == null) ? "" : this.descDiscountPerc;
}
public String getDescDiscountPercTot() {
StringBuilder sb = new StringBuilder();
if (getDiscountPerc() > 0L) {
sb.append(getDescDiscountPerc());
if (getPercDiscountPay() > 0.0D)
sb.append(" + ");
}
if (getPercDiscountPay() > 0.0D)
sb.append(getDescDiscountPay());
return sb.toString().trim();
}
public double getCommissionPayValue() {
if (getPercCommissionPay() > 0.0D) {
DoubleOperator temp = new DoubleOperator(getTotPriceWDiscount());
temp.setScale(4, 5);
temp.add(getDeliveryCost());
temp.add(getDeliveryWarnCost());
temp.subtract(getDiscount());
temp.multiply(getPercCommissionPay());
temp.divide(100.0F);
temp.setScale(2, 5);
return temp.getResult();
}
return 0.0D;
}
public void setDescDiscountPerc(String descDiscount) {
this.descDiscountPerc = descDiscount;
}
public long getDiscountPerc() {
return this.discountPerc;
}
public double getDiscountPercTot() {
DoubleOperator dop = new DoubleOperator((float)getDiscountPerc());
dop.add(getPercDiscountPay());
return dop.getResult();
}
public void setDiscountPerc(long discount) {
this.discountPerc = discount;
}
public String getPromotionCode() {
return (this.promotionCode == null) ? "" : this.promotionCode;
}
public void setPromotionCode(String promotionCode) {
this.promotionCode = promotionCode;
}
public IvaGroup getRri() {
Enumeration<CartItem> vecRighe = getItems();
this.rri = new IvaGroup();
while (vecRighe.hasMoreElements()) {
CartItem row = vecRighe.nextElement();
double imponibile = row.getTotPrice(getId_users());
this.rri.addCartRowRM(imponibile, row.getIvaItemId(getId_users()), row.getIvaAliquota(getId_users()), row.isRM(), row.getCost());
}
return this.rri;
}
public boolean isUsePriceWithVat() {
return this.usePriceWithVat;
}
public void setRriCompleto(IvaGroup rriCompleto) {
this.rriCompleto = rriCompleto;
}
public void setRri(IvaGroup rri) {
this.rri = rri;
}
public IvaGroup getRriCompleto() {
Enumeration<CartItem> vecRighe = getItems();
this.rriCompleto = new IvaGroup();
while (vecRighe.hasMoreElements()) {
CartItem row = vecRighe.nextElement();
double imponibile = row.getTotPrice(getId_users());
this.rriCompleto.addCartRowRM(imponibile, row.getIvaItemId(getId_users()), row.getIvaAliquota(getId_users()), row.isRM(),
row.getCost());
}
this.rriCompleto.addCartRowRM(getDeliveryCost(), getId_ivaDelivery(), getAliquotaIvaDelivery(), false, 0.0D);
this.rriCompleto.addCartRowRM(getDeliveryWarnCost(), getId_ivaDelivery(), getAliquotaIvaDelivery(), false, 0.0D);
this.rriCompleto.addCartRowRM(getMoreCost(), getId_ivaDelivery(), getAliquotaIvaDelivery(), false, 0.0D);
return this.rriCompleto;
}
public long getId_ivaDelivery() {
return (this.id_ivaDelivery == 0L) ? 1L : this.id_ivaDelivery;
}
public void setId_ivaDelivery(long id_ivaDelivery) {
this.id_ivaDelivery = id_ivaDelivery;
}
public double getAliquotaIvaDelivery() {
return this.aliquotaIvaDelivery;
}
public void setAliquotaIvaDelivery(double aliquotaIvaDelivery) {
this.aliquotaIvaDelivery = aliquotaIvaDelivery;
}
public double getMoreCost() {
return this.moreCost;
}
public double getMoreCostWVat() {
return DBAdapter.conIva(this.moreCost, getAliquotaIvaDelivery());
}
public void setMoreCost(double moreCost) {
this.moreCost = moreCost;
}
public long getFlgPayment() {
return this.flgPayment;
}
public void setFlgPayment(long flgPayment) {
this.flgPayment = flgPayment;
}
public String getDescMoreCost() {
return (this.descMoreCost == null) ? "" : this.descMoreCost.trim();
}
public void setDescMoreCost(String moreCostDescription) {
this.descMoreCost = moreCostDescription;
}
public double getAvailItemQty(long theId, double l_dispo) {
Long itemPrimaryKey = new Long(theId);
if (this.items.containsKey(itemPrimaryKey)) {
CartItem cartItem = this.items.get(itemPrimaryKey);
DoubleOperator dispo = new DoubleOperator(l_dispo);
dispo.subtract(cartItem.getQuantity());
return dispo.getResult();
}
return l_dispo;
}
public void setUsePriceWithVat(boolean usePriceWithVat) {
this.usePriceWithVat = usePriceWithVat;
}
public String getGiftAddress() {
return (this.giftAddress == null) ? "" : this.giftAddress.trim();
}
public void setGiftAddress(String giftAddress) {
this.giftAddress = giftAddress;
}
public long getFlgGift() {
return this.flgGift;
}
public void setFlgGift(long flgGift) {
this.flgGift = flgGift;
}
public String getGiftText() {
return (this.giftText == null) ? "" : this.giftText.trim();
}
public void setGiftText(String giftText) {
this.giftText = giftText;
}
public static final void initCartParms(ApplParmFull ap) {
if (ap != null) {
Parm bean = new Parm(ap);
String l_tipoParm = "CART";
bean.findByCodice(P_PROCEDI_PAGAMENTO);
bean.setFlgAdmin(1L);
bean.setTipoParm(l_tipoParm);
bean.setCodice(P_PROCEDI_PAGAMENTO);
bean.setDescrizione(P_PROCEDI_PAGAMENTO);
bean.setFlgTipo(5L);
bean.setNota("Quando registro l'ordine, imposta il procedi con il pagamento:0:no,1:si");
bean.save();
bean.findByCodice(P_USE_PRICE_WITH_VAT);
bean.setFlgAdmin(1L);
bean.setTipoParm(l_tipoParm);
bean.setCodice(P_USE_PRICE_WITH_VAT);
bean.setDescrizione(P_USE_PRICE_WITH_VAT);
bean.setFlgTipo(1L);
bean.setNota("Prezzi con iva:0:no,1:si");
bean.save();
bean.findByCodice(P_CHECKOUTMSG);
bean.setFlgAdmin(1L);
bean.setTipoParm(l_tipoParm);
bean.setCodice(P_CHECKOUTMSG);
bean.setDescrizione(P_CHECKOUTMSG);
bean.setFlgTipo(0L);
if (bean.getTesto().isEmpty())
bean.setTesto("mailMessage/checkOut.html");
bean.setNota("Path relativo a docbase");
bean.save();
bean.findByCodice(Parm.P_USERMSG);
bean.setFlgAdmin(1L);
bean.setTipoParm(l_tipoParm);
bean.setCodice(Parm.P_USERMSG);
bean.setDescrizione(Parm.P_USERMSG);
bean.setFlgTipo(0L);
if (bean.getTesto().isEmpty())
bean.setTesto("mailMessage/userMsg.html");
bean.setNota("Path relativo a docbase");
bean.save();
bean.findByCodice(Parm.P_LOSTPWDMSG);
bean.setFlgAdmin(1L);
bean.setTipoParm(l_tipoParm);
bean.setCodice(Parm.P_LOSTPWDMSG);
bean.setDescrizione(Parm.P_LOSTPWDMSG);
bean.setFlgTipo(0L);
if (bean.getTesto().isEmpty())
bean.setTesto("/mailMessage/lostPwd.html");
bean.setNota("Path relativo a docbase");
bean.save();
bean.findByCodice(Parm.P_MLISTMSG);
bean.setFlgAdmin(1L);
bean.setTipoParm(l_tipoParm);
bean.setCodice(Parm.P_MLISTMSG);
bean.setDescrizione(Parm.P_MLISTMSG);
bean.setFlgTipo(0L);
if (bean.getTesto().isEmpty())
bean.setTesto("/relativo a docbasemailMessage/ml.txt");
bean.setNota("Path relativo a docbase. Registrazione Mailing List");
bean.save();
bean.findByCodice(Parm.P_RESOMSG);
bean.setFlgAdmin(1L);
bean.setTipoParm(l_tipoParm);
bean.setCodice(Parm.P_RESOMSG);
bean.setDescrizione(Parm.P_RESOMSG);
bean.setFlgTipo(0L);
if (bean.getTesto().isEmpty())
bean.setTesto("mailMessage/reso.html");
bean.setNota("Path relativo a docbase. Reso merce");
bean.save();
bean.findByCodice(P_DELIVERY_COST);
bean.setFlgAdmin(1L);
bean.setTipoParm(l_tipoParm);
bean.setCodice(P_DELIVERY_COST);
bean.setDescrizione(P_DELIVERY_COST);
bean.setFlgTipo(1L);
bean.setNota("Costo spedizione standard.");
bean.save();
bean.findByCodice(P_DELIVERY_COST_PUDO);
bean.setFlgAdmin(1L);
bean.setTipoParm(l_tipoParm);
bean.setCodice(P_DELIVERY_COST_PUDO);
bean.setDescrizione(P_DELIVERY_COST_PUDO);
bean.setFlgTipo(1L);
bean.setNota("Costo spedizione al punto di raccolta.");
bean.save();
bean.findByCodice(P_CART_WITH_VAT);
bean.setFlgAdmin(1L);
bean.setTipoParm(l_tipoParm);
bean.setCodice(P_CART_WITH_VAT);
bean.setDescrizione(P_CART_WITH_VAT);
bean.setFlgTipo(5L);
bean.setNota("CARRELLO SENZA EVIDENZA DELL'IVA.");
bean.save();
bean.findByCodice(P_DELIVERY_FREE_ABOVE);
bean.setFlgAdmin(1L);
bean.setTipoParm(l_tipoParm);
bean.setCodice(P_DELIVERY_FREE_ABOVE);
bean.setDescrizione(P_DELIVERY_FREE_ABOVE);
bean.setFlgTipo(1L);
if (bean.getId_parm() == 0L)
bean.setNumero(9000000.0D);
bean.setNota("TOT CARRELLO (COMPRESO IVA) OLTRE IL QUALE LA SPEDIZIONE DIVENTA GRATIS");
bean.save();
bean.findByCodice(P_DELIVERY_WARN_COST);
bean.setFlgAdmin(1L);
bean.setTipoParm(l_tipoParm);
bean.setCodice(P_DELIVERY_WARN_COST);
bean.setDescrizione(P_DELIVERY_WARN_COST);
bean.setFlgTipo(1L);
bean.setNota("Costo avviso spedizione standard.");
bean.save();
bean.findByCodice(P_MORE_COST);
bean.setFlgAdmin(1L);
bean.setTipoParm(l_tipoParm);
bean.setCodice(P_MORE_COST);
bean.setDescrizione(P_MORE_COST);
bean.setFlgTipo(1L);
bean.setNota("Costo aggiuntivo tipo per contrassegno.");
bean.save();
bean.findByCodice(P_DELIVERY_IVA_ALIQUOTA);
bean.setFlgAdmin(1L);
bean.setTipoParm(l_tipoParm);
bean.setCodice(P_DELIVERY_IVA_ALIQUOTA);
bean.setDescrizione(P_DELIVERY_IVA_ALIQUOTA);
bean.setFlgTipo(1L);
bean.setNota("Aliquota standard spese spedizione. DEVE COINCIDERE CON LA PERCENTUALE IVA DI DELIVERY_IVA_ID.");
bean.save();
bean.findByCodice(P_DELIVERY_IVA_ID);
bean.setFlgAdmin(1L);
bean.setTipoParm(l_tipoParm);
bean.setCodice(P_DELIVERY_IVA_ID);
bean.setDescrizione(P_DELIVERY_IVA_ID);
bean.setFlgTipo(1L);
bean.setNota("ID iva aliquota spese di spedizione. VERIFICA DELIVERY_IVA_ALIQUOTA CHE LA PERCENTUALE COINCIDA.");
bean.save();
bean.findByCodice(P_ID_IVA_CEE);
bean.setFlgAdmin(1L);
bean.setTipoParm(l_tipoParm);
bean.setCodice(P_ID_IVA_CEE);
bean.setDescrizione(P_ID_IVA_CEE);
bean.setFlgTipo(1L);
bean.setNota("ID iva aliquota articoli in caso di esenzione per paese CEE.");
bean.save();
bean.findByCodice(P_ID_IVA_EXTRACEE);
bean.setFlgAdmin(1L);
bean.setTipoParm(l_tipoParm);
bean.setCodice(P_ID_IVA_EXTRACEE);
bean.setDescrizione(P_ID_IVA_EXTRACEE);
bean.setFlgTipo(1L);
bean.setNota("ID iva aliquota articoli in caso di esenzione per paese EXTRA-CEE.");
bean.save();
}
}
public long getFlgShipping() {
return this.flgShipping;
}
public void setFlgShipping(long flgShipping) {
this.flgShipping = flgShipping;
}
public String getDescShipping() {
return (this.descShipping == null) ? "" : this.descShipping.trim();
}
public void setDescShipping(String descShipping) {
this.descShipping = descShipping;
}
public long getFlgStatus() {
return this.flgStatus;
}
public void setFlgStatus(long flgStatus) {
this.flgStatus = flgStatus;
}
public double getDeliveryWarnCost() {
return this.deliveryWarnCost;
}
public double getDeliveryWarnCostWVat() {
return DBAdapter.conIva(this.deliveryWarnCost, getAliquotaIvaDelivery());
}
public void setDeliveryWarnCost(double deliveryWarnCost) {
this.deliveryWarnCost = deliveryWarnCost;
}
public String getNote() {
return (this.note == null) ? "" : this.note.trim();
}
public void setNote(String note) {
this.note = note;
}
public long getId_users() {
return this.id_users;
}
public void setId_users(long l_id_users) {
if (l_id_users != this.id_users) {
setRri(null);
setRriCompleto(null);
}
this.id_users = l_id_users;
}
public boolean hasItemKey(String l_itemKey) {
if (l_itemKey == null || l_itemKey.isEmpty())
return false;
if (this.items.containsKey(l_itemKey))
return true;
return false;
}
public long getFlgPickup() {
return this.flgPickup;
}
public void setFlgPickup(long flgPickup) {
this.flgPickup = flgPickup;
}
public ResParm add(AcCartObject l_aco, boolean checkAvail) {
ResParm rp = new ResParm(true);
if (this.items.containsKey(l_aco.getItemsKey())) {
CartItem cartItem = this.items.get(l_aco.getItemsKey());
if (checkAvail) {
double l_avail = cartItem.getAvailItemQty();
if (l_aco.getQuantity() > l_avail) {
rp.setStatus(false);
rp.setMsg(getApplParmFull().translate("Quantita' richiesta non disponibile", l_aco.getLang()));
cartItem.setQuantity(l_avail);
} else {
cartItem.setQuantity(l_aco.getQuantity());
}
} else {
cartItem.setQuantity(l_aco.getQuantity());
}
cartItem.setDbItem(null);
if (cartItem.getQuantity() == 0.0D) {
this.items.remove(l_aco.getItemsKey());
} else {
this.items.put(l_aco.getItemsKey(), cartItem);
}
} else {
CartItem newItem = new CartItem(l_aco, getApplParmFull(), l_aco.getQuantity());
if (checkAvail) {
double l_avail = newItem.getAvailItemQty();
if (l_aco.getQuantity() > l_avail) {
rp.setStatus(false);
rp.setMsg(getApplParmFull().translate("Quantita' richiesta non disponibile", l_aco.getLang()));
} else {
newItem.setRM(l_aco.isRM());
this.items.put(l_aco.getItemsKey(), newItem);
this.numberOfItems++;
}
} else {
newItem.setRM(l_aco.isRM());
this.items.put(l_aco.getItemsKey(), newItem);
this.numberOfItems++;
}
}
setRri(null);
setRriCompleto(null);
return rp;
}
public Date getDataNoleggioStart() {
return this.dataNoleggioStart;
}
public void setDataNoleggioStart(Date dataHireStart) {
this.dataNoleggioStart = dataHireStart;
}
public Date getDataNoleggioEnd() {
return this.dataNoleggioEnd;
}
public void setDataNoleggioEnd(Date dataHireEnd) {
this.dataNoleggioEnd = dataHireEnd;
}
public long getFlgCartType() {
return this.flgCartType;
}
public void setFlgCartType(long flgCartType) {
this.flgCartType = flgCartType;
}
public double getDiscount() {
return this.discount;
}
public void setDiscount(double discount) {
this.discount = discount;
}
public String getDescDiscount() {
return (this.descDiscount == null) ? "" : this.descDiscount;
}
public void setDescDiscount(String descDiscount) {
this.descDiscount = descDiscount;
}
public Object clone() throws CloneNotSupportedException {
return super.clone();
}
public CartItem getItem(String itemKey) {
if (this.items.containsKey(itemKey))
return this.items.get(itemKey);
return null;
}
public double getDeliveryCostWVat() {
return DBAdapter.conIva(getDeliveryCost(), getAliquotaIvaDelivery());
}
public double getScontrinoTotCartVAT() {
DoubleOperator temp = new DoubleOperator(getScontrinoTotPriceWDiscount());
temp.setScale(4, 5);
temp.add(getDeliveryCostWVat());
temp.add(getDeliveryWarnCostWVat());
temp.add(getMoreCostWVat());
temp.subtract(getDiscount());
return temp.getResult();
}
public NumberFormat getNf2() {
return getApplParmFull().getAp().getNf2();
}
public NumberFormat getNf() {
return getNf2();
}
public String getCodPromo() {
return (this.codPromo == null) ? "" : this.codPromo.trim();
}
public void setCodPromo(String codPromo) {
this.codPromo = codPromo;
}
public double getPercDiscountPay() {
return this.percDiscountPay;
}
public void setPercDiscountPay(double percDiscountPay) {
this.percDiscountPay = percDiscountPay;
}
public double getPercCommissionPay() {
return this.percCommissionPay;
}
public void setPercCommissionPay(double percCommissionPay) {
this.percCommissionPay = percCommissionPay;
}
public String getDescDiscountPay() {
return (this.descDiscountPay == null) ? "" : this.descDiscountPay.trim();
}
public void setDescDiscountPay(String descDiscountPay) {
this.descDiscountPay = descDiscountPay;
}
public String getDescCommissionPay() {
return (this.descCommissionPay == null) ? "" : this.descCommissionPay.trim();
}
public void setDescCommissionPay(String descCommissionPay) {
this.descCommissionPay = descCommissionPay;
}
public void setCostoSpedizionePreventivo(boolean costoSpedizionePreventivo) {
this.costoSpedizionePreventivo = costoSpedizionePreventivo;
}
public boolean isCostoSpedizionePreventivo() {
return this.costoSpedizionePreventivo;
}
public String getDescPayment() {
return (this.descPayment == null) ? "" : this.descPayment.trim();
}
public void setDescPayment(String descPayment) {
this.descPayment = descPayment;
}
public long getNumberTotOfItems() {
long numberTotOfItems = 0L;
if (this.items != null)
for (String key : this.items.keySet())
numberTotOfItems += (long)this.items.get(key).getQuantity();
return numberTotOfItems;
}
public boolean hasItemConScontoTroppoAlto() {
Enumeration<CartItem> enu = getItems();
while (enu.hasMoreElements()) {
CartItem ci = enu.nextElement();
if (ci.isScontoTroppoAlto())
return true;
}
return false;
}
public long getFlgDeliveryType() {
return this.flgDeliveryType;
}
public void setFlgDeliveryType(long flgDeliveryType) {
this.flgDeliveryType = flgDeliveryType;
}
public String getPudoDesc() {
return (this.pudoDesc == null) ? "" : this.pudoDesc.trim();
}
public PudoAddress getPudoAddress() {
Users user = new Users(getApplParmFull());
user.findByPrimaryKey(getId_users());
return user.getClifor().getPudoAddress();
}
public void setPudoDesc(String pudoDesc) {
this.pudoDesc = pudoDesc;
}
public String getPudoId() {
return this.pudoId;
}
public void setPudoId(String pudoId) {
this.pudoId = pudoId;
}
}