This commit is contained in:
babak alizadeh 2024-10-25 20:16:26 +03:30
parent 1f97352d2b
commit c417aadee4

View file

@ -96,9 +96,15 @@ class SellController extends AbstractController
$avg = $avg + $last->getBd();
$count = $count + $last->getCommdityCount();
}
if ($count != 0) {
$price = $avg / $count;
$profit = $profit + ((($item->getBs() / $item->getCommdityCount()) - $price) * $item->getCommdityCount());
}
else{
$profit = $profit + $item->getBs();
}
}
//round output
$profit = round($profit);
@ -419,9 +425,14 @@ class SellController extends AbstractController
$avg = $avg + $last->getBd();
$count = $count + $last->getCommdityCount();
}
if ($count != 0) {
$price = $avg / $count;
$temp['profit'] = $temp['profit'] + ((($item->getBs() / $item->getCommdityCount()) - $price) * $item->getCommdityCount());
}
else{
$temp['profit'] = $temp['profit'] + $item->getBs();
}
}
//round output
$temp['profit'] = round($temp['profit']);