cleanup code
This commit is contained in:
@@ -59,23 +59,17 @@ class Carton {
|
||||
List<Carton> mixCartons;
|
||||
List<String> mixCartonIDs;
|
||||
|
||||
int get amount => rate != null && weight != null ? (rate * weight) : 0;
|
||||
int get amount => (rate * weight);
|
||||
|
||||
// String get packageNumber =>
|
||||
// shipmentNumber + "-" + receiverNumber + " #" + boxNumber;
|
||||
|
||||
double get actualWeight =>
|
||||
cargoTypes == null ? 0 : cargoTypes.fold(0, (p, e) => e.weight + p);
|
||||
cargoTypes.isEmpty ? 0 : cargoTypes.fold(0, (p, e) => e.weight + p);
|
||||
|
||||
int getShipmentWeight(double volumetricRatio) {
|
||||
if (length == null ||
|
||||
length <= 0 ||
|
||||
width == null ||
|
||||
width <= 0 ||
|
||||
height == null ||
|
||||
height <= 0 ||
|
||||
volumetricRatio == null ||
|
||||
volumetricRatio <= 0) return 0;
|
||||
if (length <= 0 || width <= 0 || height <= 0 || volumetricRatio <= 0)
|
||||
return 0;
|
||||
|
||||
return ((length * width * height) / volumetricRatio).round();
|
||||
}
|
||||
@@ -113,8 +107,7 @@ class Carton {
|
||||
|
||||
double total = 0;
|
||||
cargoTypes.forEach((e) {
|
||||
double r =
|
||||
e.rate - (discountByWeight != null ? (discountByWeight.discount) : 0);
|
||||
double r = e.rate - (discountByWeight.discount);
|
||||
double amount = e.weight * r;
|
||||
total += amount;
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user