first commit
This commit is contained in:
commit
cf97b64877
27585 changed files with 3281780 additions and 0 deletions
79
rus/WEB-INF/lib/ablia_src/com/ablia/cart/AcCartObject.java
Normal file
79
rus/WEB-INF/lib/ablia_src/com/ablia/cart/AcCartObject.java
Normal file
|
|
@ -0,0 +1,79 @@
|
|||
package com.ablia.cart;
|
||||
|
||||
public class AcCartObject {
|
||||
private Class<CartItemIterface> itemClass;
|
||||
|
||||
private Object id;
|
||||
|
||||
private double quantity;
|
||||
|
||||
private boolean RM;
|
||||
|
||||
public AcCartObject() {}
|
||||
|
||||
public AcCartObject(Class theItemClass, Object theId, double theQuantity) {
|
||||
setItemClass(theItemClass);
|
||||
setId(theId);
|
||||
setQuantity(theQuantity);
|
||||
}
|
||||
|
||||
public AcCartObject(Class theItemClass, long theId, double theQuantity, boolean rm) {
|
||||
setItemClass(theItemClass);
|
||||
setId(new Long(theId));
|
||||
setQuantity(theQuantity);
|
||||
setRM(rm);
|
||||
}
|
||||
|
||||
public AcCartObject(Class theItemClass, long theId, double theQuantity) {
|
||||
setItemClass(theItemClass);
|
||||
setId(new Long(theId));
|
||||
setQuantity(theQuantity);
|
||||
}
|
||||
|
||||
public AcCartObject(Class theItemClass, Object theId, double theQuantity, boolean rm) {
|
||||
setItemClass(theItemClass);
|
||||
setId(theId);
|
||||
setQuantity(theQuantity);
|
||||
setRM(rm);
|
||||
}
|
||||
|
||||
public Object getId() {
|
||||
return this.id;
|
||||
}
|
||||
|
||||
public Class<CartItemIterface> getItemClass() {
|
||||
return this.itemClass;
|
||||
}
|
||||
|
||||
public double getQuantity() {
|
||||
return this.quantity;
|
||||
}
|
||||
|
||||
public void setId(Object newId) {
|
||||
this.id = newId;
|
||||
}
|
||||
|
||||
public void setId(long newId) {
|
||||
this.id = new Long(newId);
|
||||
}
|
||||
|
||||
public void setItemClass(Class<CartItemIterface> newItemClass) {
|
||||
this.itemClass = newItemClass;
|
||||
}
|
||||
|
||||
public void setQuantity(double newQuantity) {
|
||||
this.quantity = newQuantity;
|
||||
}
|
||||
|
||||
public String getItemsKey() {
|
||||
return getId() + " " + getItemClass().toString();
|
||||
}
|
||||
|
||||
public boolean isRM() {
|
||||
return this.RM;
|
||||
}
|
||||
|
||||
public void setRM(boolean rM) {
|
||||
this.RM = rM;
|
||||
}
|
||||
}
|
||||
878
rus/WEB-INF/lib/ablia_src/com/ablia/cart/Cart.java
Normal file
878
rus/WEB-INF/lib/ablia_src/com/ablia/cart/Cart.java
Normal file
|
|
@ -0,0 +1,878 @@
|
|||
package com.ablia.cart;
|
||||
|
||||
import com.ablia.common.Parm;
|
||||
import com.ablia.db.ApplParmFull;
|
||||
import com.ablia.db.DBAdapter;
|
||||
import com.ablia.db.ResParm;
|
||||
import com.ablia.util.DoubleOperator;
|
||||
import com.ablia.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 = 1L;
|
||||
|
||||
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;
|
||||
|
||||
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_RESOMSG = "RESO_MSG";
|
||||
|
||||
public static String P_CHECKOUTMSG = "CHECKOUT_MSG";
|
||||
|
||||
public static String P_USERMSG = "USER_MSG";
|
||||
|
||||
public static String P_DELIVERY_COST = "DELIV_COST";
|
||||
|
||||
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_LOSTPWDMSG = "LOSTPWD_MSG";
|
||||
|
||||
public static String P_MLISTMSG = "MLIST_MSG";
|
||||
|
||||
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("QUANTITA' RICHIESTA NON DISPONIBILE");
|
||||
} 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("QUANTITA' RICHIESTA NON DISPONIBILE");
|
||||
} 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 (getDiscountPerc() == 0L)
|
||||
return getTotPrice();
|
||||
DoubleOperator temp = new DoubleOperator(getTotPrice());
|
||||
temp.setScale(4, 5);
|
||||
temp.subtract(getTotDiscount());
|
||||
return temp.getResult();
|
||||
}
|
||||
|
||||
public double getScontrinoTotPriceWDiscount() {
|
||||
if (getDiscountPerc() == 0L)
|
||||
return getScontrinoTotPriceVAT();
|
||||
DoubleOperator temp = new DoubleOperator(getScontrinoTotPriceVAT());
|
||||
temp.setScale(4, 5);
|
||||
temp.subtract(getScontrinoTotDiscount());
|
||||
return temp.getResult();
|
||||
}
|
||||
|
||||
public double getTotDiscount() {
|
||||
if (getDiscountPerc() == 0L)
|
||||
return 0.0D;
|
||||
DoubleOperator temp = new DoubleOperator(getTotPriceNoSale());
|
||||
temp.setScale(4, 5);
|
||||
temp.multiply(getDiscountPerc());
|
||||
temp.divide(100.0F);
|
||||
return temp.getResult();
|
||||
}
|
||||
|
||||
public double getScontrinoTotDiscount() {
|
||||
if (getDiscountPerc() == 0L)
|
||||
return 0.0D;
|
||||
DoubleOperator temp = new DoubleOperator(getScontrinoTotPriceNoSale());
|
||||
temp.setScale(4, 5);
|
||||
temp.multiply(getDiscountPerc());
|
||||
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 void setDescDiscountPerc(String descDiscount) {
|
||||
this.descDiscountPerc = descDiscount;
|
||||
}
|
||||
|
||||
public long getDiscountPerc() {
|
||||
return this.discountPerc;
|
||||
}
|
||||
|
||||
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(1L);
|
||||
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(P_USERMSG);
|
||||
bean.setFlgAdmin(1L);
|
||||
bean.setTipoParm(l_tipoParm);
|
||||
bean.setCodice(P_USERMSG);
|
||||
bean.setDescrizione(P_USERMSG);
|
||||
bean.setFlgTipo(0L);
|
||||
if (bean.getTesto().isEmpty())
|
||||
bean.setTesto("mailMessage/userMsg.html");
|
||||
bean.setNota("Path relativo a docbase");
|
||||
bean.save();
|
||||
bean.findByCodice(P_LOSTPWDMSG);
|
||||
bean.setFlgAdmin(1L);
|
||||
bean.setTipoParm(l_tipoParm);
|
||||
bean.setCodice(P_LOSTPWDMSG);
|
||||
bean.setDescrizione(P_LOSTPWDMSG);
|
||||
bean.setFlgTipo(0L);
|
||||
if (bean.getTesto().isEmpty())
|
||||
bean.setTesto("/mailMessage/lostPwd.html");
|
||||
bean.setNota("Path relativo a docbase");
|
||||
bean.save();
|
||||
bean.findByCodice(P_MLISTMSG);
|
||||
bean.setFlgAdmin(1L);
|
||||
bean.setTipoParm(l_tipoParm);
|
||||
bean.setCodice(P_MLISTMSG);
|
||||
bean.setDescrizione(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(P_RESOMSG);
|
||||
bean.setFlgAdmin(1L);
|
||||
bean.setTipoParm(l_tipoParm);
|
||||
bean.setCodice(P_RESOMSG);
|
||||
bean.setDescrizione(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_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("QUANTITA' RICHIESTA NON DISPONIBILE");
|
||||
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("QUANTITA' RICHIESTA NON DISPONIBILE");
|
||||
} 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();
|
||||
}
|
||||
}
|
||||
234
rus/WEB-INF/lib/ablia_src/com/ablia/cart/CartItem.java
Normal file
234
rus/WEB-INF/lib/ablia_src/com/ablia/cart/CartItem.java
Normal file
|
|
@ -0,0 +1,234 @@
|
|||
package com.ablia.cart;
|
||||
|
||||
import com.ablia.db.ApplParmFull;
|
||||
import com.ablia.db.DBAdapter;
|
||||
import com.ablia.util.DoubleOperator;
|
||||
import java.io.Serializable;
|
||||
import java.text.NumberFormat;
|
||||
import java.util.Locale;
|
||||
|
||||
public class CartItem implements CartItemIterface, Serializable {
|
||||
private NumberFormat nf2;
|
||||
|
||||
private boolean RM;
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
private String cartItemTag;
|
||||
|
||||
private Object itemId;
|
||||
|
||||
private double quantity;
|
||||
|
||||
private Class<CartItemIterface> itemClass;
|
||||
|
||||
private ApplParmFull applParmFull;
|
||||
|
||||
private DBAdapter dbItem;
|
||||
|
||||
public CartItem() {
|
||||
this.quantity = 1.0D;
|
||||
}
|
||||
|
||||
public CartItem(AcCartObject l_aco, ApplParmFull theApplParmFull, double newQuantity) {
|
||||
setItemId(l_aco.getId());
|
||||
setQuantity(newQuantity);
|
||||
setItemClass(l_aco.getItemClass());
|
||||
setApplParmFull(theApplParmFull);
|
||||
try {
|
||||
CartItemIterface bean = getItemClass().newInstance();
|
||||
this.cartItemTag = bean.getCartItemTag();
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
public ApplParmFull getApplParmFull() {
|
||||
return this.applParmFull;
|
||||
}
|
||||
|
||||
public DBAdapter getDbItem() {
|
||||
if (this.dbItem == null && this.itemId != null)
|
||||
try {
|
||||
DBAdapter bean = (DBAdapter)getItemClass().newInstance();
|
||||
bean.setApFull(getApplParmFull());
|
||||
bean.findByPrimaryKey(getItemId());
|
||||
if (bean.getDBState() == 1)
|
||||
this.dbItem = bean;
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
try {
|
||||
return (this.dbItem == null) ? (DBAdapter)getItemClass().newInstance() : this.dbItem;
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
return this.dbItem;
|
||||
}
|
||||
}
|
||||
|
||||
public Class<CartItemIterface> getItemClass() {
|
||||
return this.itemClass;
|
||||
}
|
||||
|
||||
public Object getItemId() {
|
||||
return this.itemId;
|
||||
}
|
||||
|
||||
public double getQuantity() {
|
||||
return this.quantity;
|
||||
}
|
||||
|
||||
public void setApplParmFull(ApplParmFull newApplParmFull) {
|
||||
this.applParmFull = newApplParmFull;
|
||||
}
|
||||
|
||||
public void setDbItem(DBAdapter newDbItem) {
|
||||
this.dbItem = newDbItem;
|
||||
}
|
||||
|
||||
public void setItemClass(Class<CartItemIterface> newItemClass) {
|
||||
this.itemClass = newItemClass;
|
||||
}
|
||||
|
||||
public void setItemId(Object newItemId) {
|
||||
this.itemId = newItemId;
|
||||
setDbItem(null);
|
||||
}
|
||||
|
||||
public void setQuantity(double newQuantity) {
|
||||
this.quantity = newQuantity;
|
||||
}
|
||||
|
||||
public double getPriceWVat() {
|
||||
return ((CartItemIterface)getDbItem()).getPriceWVat();
|
||||
}
|
||||
|
||||
public double getPrice() {
|
||||
return ((CartItemIterface)getDbItem()).getPrice();
|
||||
}
|
||||
|
||||
public boolean isItemAvailable() {
|
||||
if (getQuantity() <= getAvailItemQty())
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
public double getTotPrice() {
|
||||
DoubleOperator temp = new DoubleOperator(getQuantity());
|
||||
temp.setScale(4, 5);
|
||||
temp.multiply(getPrice());
|
||||
return temp.getResult();
|
||||
}
|
||||
|
||||
public double getAvailItemQty() {
|
||||
double l_dispo = 0.0D;
|
||||
if (this.itemId != null) {
|
||||
this.dbItem = null;
|
||||
l_dispo = ((CartItemIterface)getDbItem()).getAvail();
|
||||
return l_dispo;
|
||||
}
|
||||
return l_dispo;
|
||||
}
|
||||
|
||||
public double getAvail() {
|
||||
return ((CartItemIterface)getDbItem()).getAvail();
|
||||
}
|
||||
|
||||
public String getCartItemDescriptionUrl() {
|
||||
return ((CartItemIterface)getDbItem()).getCartItemDescriptionUrl();
|
||||
}
|
||||
|
||||
public String getCartItemDescription3(String lang) {
|
||||
return ((CartItemIterface)getDbItem()).getCartItemDescription3(lang);
|
||||
}
|
||||
|
||||
public String getCartItemDescription2(String lang) {
|
||||
return ((CartItemIterface)getDbItem()).getCartItemDescription2(lang);
|
||||
}
|
||||
|
||||
public String getCartItemImage() {
|
||||
return ((CartItemIterface)getDbItem()).getCartItemImage();
|
||||
}
|
||||
|
||||
public double getCost() {
|
||||
return ((CartItemIterface)getDbItem()).getCost();
|
||||
}
|
||||
|
||||
public double getDiscount() {
|
||||
return ((CartItemIterface)getDbItem()).getDiscount();
|
||||
}
|
||||
|
||||
public boolean isSale() {
|
||||
return ((CartItemIterface)getDbItem()).isSale();
|
||||
}
|
||||
|
||||
public double getIvaAliquota(long l_id_users) {
|
||||
return ((CartItemIterface)getDbItem()).getIvaAliquota(l_id_users);
|
||||
}
|
||||
|
||||
public Object getId_iva() {
|
||||
return null;
|
||||
}
|
||||
|
||||
public boolean isRM() {
|
||||
return this.RM;
|
||||
}
|
||||
|
||||
public long getIvaItemId(long l_id_users) {
|
||||
return ((CartItemIterface)getDbItem()).getIvaItemId(l_id_users);
|
||||
}
|
||||
|
||||
public long getCartItemUdm() {
|
||||
return ((CartItemIterface)getDbItem()).getCartItemUdm();
|
||||
}
|
||||
|
||||
public double getPrice(long l_id_users) {
|
||||
return ((CartItemIterface)getDbItem()).getPrice(l_id_users);
|
||||
}
|
||||
|
||||
public String getCartItemDescription(String lang) {
|
||||
return ((CartItemIterface)getDbItem()).getCartItemDescription(lang);
|
||||
}
|
||||
|
||||
public double getTotPrice(long l_id_users) {
|
||||
DoubleOperator temp = new DoubleOperator(getQuantity());
|
||||
temp.setScale(4, 5);
|
||||
temp.multiply(getPrice(l_id_users));
|
||||
return temp.getResult();
|
||||
}
|
||||
|
||||
public String getCartItemTag() {
|
||||
return (this.cartItemTag == null) ? "" : this.cartItemTag.trim();
|
||||
}
|
||||
|
||||
public void setRM(boolean rM) {
|
||||
this.RM = rM;
|
||||
}
|
||||
|
||||
public NumberFormat getNf() {
|
||||
if (this.nf2 == null) {
|
||||
this.nf2 = NumberFormat.getInstance(Locale.ITALY);
|
||||
this.nf2.setMaximumFractionDigits(2);
|
||||
this.nf2.setMinimumFractionDigits(2);
|
||||
}
|
||||
return this.nf2;
|
||||
}
|
||||
|
||||
public double getTotPriceWVat() {
|
||||
DoubleOperator temp = new DoubleOperator(getQuantity());
|
||||
temp.setScale(4, 5);
|
||||
temp.multiply(getPriceWVat());
|
||||
return temp.getResult();
|
||||
}
|
||||
|
||||
public double getTotPriceWVat(long l_id_users) {
|
||||
DoubleOperator temp = new DoubleOperator(getQuantity());
|
||||
temp.setScale(4, 5);
|
||||
temp.multiply(getPriceWVat(l_id_users));
|
||||
return temp.getResult();
|
||||
}
|
||||
|
||||
public double getPriceWVat(long l_id_users) {
|
||||
return ((CartItemIterface)getDbItem()).getPriceWVat(l_id_users);
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,41 @@
|
|||
package com.ablia.cart;
|
||||
|
||||
public interface CartItemIterface {
|
||||
Object getItemId();
|
||||
|
||||
double getPrice();
|
||||
|
||||
double getPriceWVat();
|
||||
|
||||
boolean isSale();
|
||||
|
||||
boolean isRM();
|
||||
|
||||
double getDiscount();
|
||||
|
||||
double getCost();
|
||||
|
||||
String getCartItemDescriptionUrl();
|
||||
|
||||
String getCartItemDescription2(String paramString);
|
||||
|
||||
String getCartItemDescription3(String paramString);
|
||||
|
||||
long getCartItemUdm();
|
||||
|
||||
double getAvail();
|
||||
|
||||
double getIvaAliquota(long paramLong);
|
||||
|
||||
long getIvaItemId(long paramLong);
|
||||
|
||||
String getCartItemImage();
|
||||
|
||||
String getCartItemDescription(String paramString);
|
||||
|
||||
String getCartItemTag();
|
||||
|
||||
double getPrice(long paramLong);
|
||||
|
||||
double getPriceWVat(long paramLong);
|
||||
}
|
||||
29
rus/WEB-INF/lib/ablia_src/com/ablia/cart/CartStatus.java
Normal file
29
rus/WEB-INF/lib/ablia_src/com/ablia/cart/CartStatus.java
Normal file
|
|
@ -0,0 +1,29 @@
|
|||
package com.ablia.cart;
|
||||
|
||||
public class CartStatus {
|
||||
private long status = 0L;
|
||||
|
||||
public static final long RES_ADD_ITEM_OK = 21L;
|
||||
|
||||
public static final long RES_ADD_ITEM_KO = 22L;
|
||||
|
||||
public static long ST_CHECK_OUT_ERROR = 9L;
|
||||
|
||||
public static long ST_CHECK_OUT_OK = 1L;
|
||||
|
||||
public static long ST_CHECK_OUT_OK_NO_MAIL = 2L;
|
||||
|
||||
public static long ST_LOSTPWD_SEND_ERROR = 12L;
|
||||
|
||||
public static long ST_OK = 0L;
|
||||
|
||||
public static long ST_LOSTPWD_SEND_OK = 10L;
|
||||
|
||||
public long getStatus() {
|
||||
return this.status;
|
||||
}
|
||||
|
||||
public void setStatus(long status) {
|
||||
this.status = status;
|
||||
}
|
||||
}
|
||||
105
rus/WEB-INF/lib/ablia_src/com/ablia/cart/IvaGroup.java
Normal file
105
rus/WEB-INF/lib/ablia_src/com/ablia/cart/IvaGroup.java
Normal file
|
|
@ -0,0 +1,105 @@
|
|||
package com.ablia.cart;
|
||||
|
||||
import com.ablia.util.DoubleOperator;
|
||||
import java.util.Enumeration;
|
||||
import java.util.Hashtable;
|
||||
|
||||
public class IvaGroup {
|
||||
private Hashtable ri;
|
||||
|
||||
private DoubleOperator totImponibileDO;
|
||||
|
||||
private double importoRM;
|
||||
|
||||
public void addCartRow(double imponibile, long l_iva, double l_aliquota, boolean isRM) {
|
||||
Object theKey = new Long(l_iva);
|
||||
if (!isRM) {
|
||||
IvaGroupItem rii;
|
||||
if (getRi().containsKey(theKey)) {
|
||||
rii = (IvaGroupItem)getRi().get(theKey);
|
||||
} else {
|
||||
rii = new IvaGroupItem(l_iva, l_aliquota);
|
||||
}
|
||||
rii.addImporto(imponibile);
|
||||
getTotImponibileDO().add(imponibile);
|
||||
getRi().put(theKey, rii);
|
||||
} else {
|
||||
synchronized (this) {
|
||||
DoubleOperator dop = new DoubleOperator(this.importoRM);
|
||||
dop.add(imponibile);
|
||||
this.importoRM = dop.getResult();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public Enumeration elements() {
|
||||
return getRi().elements();
|
||||
}
|
||||
|
||||
private Hashtable getRi() {
|
||||
if (this.ri == null)
|
||||
this.ri = new Hashtable();
|
||||
return this.ri;
|
||||
}
|
||||
|
||||
public double getImportoRM() {
|
||||
return this.importoRM;
|
||||
}
|
||||
|
||||
public void setImportoRM(double importoRM) {
|
||||
this.importoRM = importoRM;
|
||||
}
|
||||
|
||||
public void addCartRowRM(double imponibile, long l_iva, double l_aliquota, boolean isRM, double costo) {
|
||||
Object theKey = new Long(l_iva);
|
||||
if (!isRM) {
|
||||
IvaGroupItem rii;
|
||||
if (getRi().containsKey(theKey)) {
|
||||
rii = (IvaGroupItem)getRi().get(theKey);
|
||||
} else {
|
||||
rii = new IvaGroupItem(l_iva, l_aliquota);
|
||||
}
|
||||
rii.addImporto(imponibile);
|
||||
getTotImponibileDO().add(imponibile);
|
||||
getRi().put(theKey, rii);
|
||||
} else {
|
||||
synchronized (this) {
|
||||
IvaGroupItem rii;
|
||||
DoubleOperator dop = new DoubleOperator(this.importoRM);
|
||||
dop.add(imponibile);
|
||||
this.importoRM = dop.getResult();
|
||||
double l_imponibile = 0.0D;
|
||||
if (getRi().containsKey(theKey)) {
|
||||
rii = (IvaGroupItem)getRi().get(theKey);
|
||||
} else {
|
||||
rii = new IvaGroupItem(l_iva, l_aliquota);
|
||||
}
|
||||
rii.addImporto(l_imponibile);
|
||||
getTotImponibileDO().add(l_imponibile);
|
||||
getRi().put(theKey, rii);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private DoubleOperator getTotImponibileDO() {
|
||||
if (this.totImponibileDO == null)
|
||||
this.totImponibileDO = new DoubleOperator();
|
||||
return this.totImponibileDO;
|
||||
}
|
||||
|
||||
public double getTotImponibile() {
|
||||
return getTotImponibileDO().getResult();
|
||||
}
|
||||
|
||||
public double getTotIva() {
|
||||
Enumeration<IvaGroupItem> enu = getRi().elements();
|
||||
DoubleOperator dIva = new DoubleOperator();
|
||||
dIva.setScale(4, 5);
|
||||
while (enu.hasMoreElements()) {
|
||||
IvaGroupItem row = enu.nextElement();
|
||||
dIva.add(row.getImportoIvaCalc());
|
||||
}
|
||||
dIva.setScale(2, 5);
|
||||
return dIva.getResult();
|
||||
}
|
||||
}
|
||||
56
rus/WEB-INF/lib/ablia_src/com/ablia/cart/IvaGroupItem.java
Normal file
56
rus/WEB-INF/lib/ablia_src/com/ablia/cart/IvaGroupItem.java
Normal file
|
|
@ -0,0 +1,56 @@
|
|||
package com.ablia.cart;
|
||||
|
||||
import com.ablia.util.DoubleOperator;
|
||||
|
||||
public class IvaGroupItem {
|
||||
private long iva;
|
||||
|
||||
private double aliquota;
|
||||
|
||||
private double imponibile;
|
||||
|
||||
public IvaGroupItem(long l_iva, double l_aliquota) {
|
||||
setIva(l_iva);
|
||||
setAliquota(l_aliquota);
|
||||
}
|
||||
|
||||
public void addImporto(double l_imponibile) {
|
||||
DoubleOperator dImponibile = new DoubleOperator(getImponibile());
|
||||
dImponibile.add(l_imponibile);
|
||||
dImponibile.setScale(2, 5);
|
||||
setImponibile(dImponibile.getResult());
|
||||
}
|
||||
|
||||
public double getImponibile() {
|
||||
return this.imponibile;
|
||||
}
|
||||
|
||||
public void setImponibile(double d) {
|
||||
this.imponibile = d;
|
||||
}
|
||||
|
||||
public long getIva() {
|
||||
return this.iva;
|
||||
}
|
||||
|
||||
public double getImportoIvaCalc() {
|
||||
DoubleOperator temp = new DoubleOperator(getImponibile());
|
||||
temp.setScale(4, 5);
|
||||
temp.multiply(getAliquota());
|
||||
temp.divide(100.0F);
|
||||
temp.setScale(2, 5);
|
||||
return temp.getResult();
|
||||
}
|
||||
|
||||
public void setIva(long iva) {
|
||||
this.iva = iva;
|
||||
}
|
||||
|
||||
public double getAliquota() {
|
||||
return this.aliquota;
|
||||
}
|
||||
|
||||
public void setAliquota(double aliquota) {
|
||||
this.aliquota = aliquota;
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue