mirror of
https://github.com/klmp200/PQT_Gestionnaire_vente_stock.git
synced 2024-12-22 15:31:08 +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() {
|
||||
double totalPrice = 0;
|
||||
if(type.getPriceMultiplier()==0)
|
||||
return 0;
|
||||
return getTotalWorth()*type.getPriceMultiplier();
|
||||
}
|
||||
|
||||
public double getTotalWorth(){
|
||||
double totalWorth = 0;
|
||||
for(Product product : this.products.keySet()){
|
||||
totalPrice+=product.getPrice()*(double)this.products.get(product);
|
||||
totalWorth+=product.getPrice()*(double)this.products.get(product);
|
||||
}
|
||||
return totalPrice;
|
||||
return totalWorth;
|
||||
}
|
||||
}
|
||||
|
@ -4,5 +4,15 @@ package com.pqt.core.entities.sale;
|
||||
* Created by Notmoo on 18/07/2017.
|
||||
*/
|
||||
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