Skip to content

Commit

Permalink
Merge branch 'develop'
Browse files Browse the repository at this point in the history
  • Loading branch information
hillelcoren committed Jul 8, 2022
2 parents a369cfc + 71bdac1 commit ac9dba5
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
12 changes: 6 additions & 6 deletions lib/data/models/mixins/invoice_mixin.dart
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,7 @@ abstract class CalculateInvoiceTotal {
InvoiceItemEntity item, double invoiceTotal, int precision) {
final double qty = round(item.quantity, 5);
final double cost = round(item.cost, 5);
final double itemDiscount = round(item.discount, precision);
final double itemDiscount = round(item.discount, 5);
double lineTotal = qty * cost;

if (discount != 0) {
Expand Down Expand Up @@ -216,7 +216,7 @@ abstract class CalculateInvoiceTotal {
lineItems.forEach((item) {
final double qty = round(item.quantity, 5);
final double cost = round(item.cost, 5);
final double itemDiscount = round(item.discount, precision);
final double itemDiscount = round(item.discount, 5);
final double taxRate1 = round(item.taxRate1, 3);
final double taxRate2 = round(item.taxRate2, 3);
final double taxRate3 = round(item.taxRate3, 3);
Expand All @@ -226,14 +226,14 @@ abstract class CalculateInvoiceTotal {
if (isAmountDiscount) {
lineTotal -= itemDiscount;
} else {
lineTotal -= round(lineTotal * itemDiscount / 100, 4);
lineTotal -= round(lineTotal * itemDiscount / 100, precision);
}
}

if (discount != 0) {
if (isAmountDiscount) {
if (total != 0) {
lineTotal -= round(lineTotal / total * discount, 4);
lineTotal -= round(lineTotal / total * discount, precision);
}
}
}
Expand Down Expand Up @@ -305,15 +305,15 @@ abstract class CalculateInvoiceTotal {
lineItems.forEach((item) {
final double qty = round(item.quantity, 5);
final double cost = round(item.cost, 5);
final double discount = round(item.discount, precision);
final double discount = round(item.discount, 5);

double lineTotal = qty * cost;

if (discount != 0) {
if (isAmountDiscount) {
lineTotal -= discount;
} else {
lineTotal -= round(lineTotal * discount / 100, 4);
lineTotal -= round(lineTotal * discount / 100, precision);
}
}

Expand Down
2 changes: 1 addition & 1 deletion lib/data/models/models.dart
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ class EntityAction extends EnumClass {
String toApiParam() {
final value = toString();

if (value.startsWith('email')) {
if (value.endsWith('email')) {
return 'email';
}

Expand Down

0 comments on commit ac9dba5

Please sign in to comment.