mirror of
https://github.com/klmp200/PQT_Gestionnaire_vente_stock.git
synced 2024-12-22 23:41:09 +00:00
Module Core : ajout du coefficient multiplicateur de prix à chaque valeur de l'enum SaleType; ajout méthd getTotalWorth à la clss Sale
This commit is contained in:
parent
5a84ed76a1
commit
ee6aa6e70b
@ -102,10 +102,16 @@ public class Sale implements ILoggable, Serializable{
|
|||||||
}
|
}
|
||||||
|
|
||||||
public double getTotalPrice() {
|
public double getTotalPrice() {
|
||||||
double totalPrice = 0;
|
if(type.getPriceMultiplier()==0)
|
||||||
for(Product product : this.products.keySet()){
|
return 0;
|
||||||
totalPrice+=product.getPrice()*(double)this.products.get(product);
|
return getTotalWorth()*type.getPriceMultiplier();
|
||||||
}
|
}
|
||||||
return totalPrice;
|
|
||||||
|
public double getTotalWorth(){
|
||||||
|
double totalWorth = 0;
|
||||||
|
for(Product product : this.products.keySet()){
|
||||||
|
totalWorth+=product.getPrice()*(double)this.products.get(product);
|
||||||
|
}
|
||||||
|
return totalWorth;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -4,5 +4,15 @@ package com.pqt.core.entities.sale;
|
|||||||
* Created by Notmoo on 18/07/2017.
|
* Created by Notmoo on 18/07/2017.
|
||||||
*/
|
*/
|
||||||
public enum SaleType {
|
public enum SaleType {
|
||||||
CASH, BANK_CHECK, STUDENT_ASSOCIATION_ACCOUNT, OFFERED_GUEST, OFFERED_STAFF_MEMBER
|
CASH(1), BANK_CHECK(1), STUDENT_ASSOCIATION_ACCOUNT(1), OFFERED_GUEST(0), OFFERED_STAFF_MEMBER(0);
|
||||||
|
|
||||||
|
private double priceMultiplier;
|
||||||
|
|
||||||
|
SaleType(double priceMultiplier) {
|
||||||
|
this.priceMultiplier = priceMultiplier;
|
||||||
|
}
|
||||||
|
|
||||||
|
public double getPriceMultiplier() {
|
||||||
|
return priceMultiplier;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user