cleanup code

This commit is contained in:
tzw
2024-01-23 16:28:08 +06:30
parent a1e87cdbf6
commit f3f75a80c6
96 changed files with 232 additions and 439 deletions

View File

@@ -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;
});