Beispiel #1
0
function calculatePrices(\NinjaImg\Model\ModelOrganisation $organisation)
{
    $firstDayPreviousMonth = date('01-m-y', strtotime('-1 month'));
    $lastDayPreviousMonth = date('t-m-y', strtotime('-1 month'));
    $masterImages = \NinjaImg\Model\ModelActivity::getMasterImagesByDate($organisation->id, $firstDayPreviousMonth, $lastDayPreviousMonth);
    $bandwidth = \NinjaImg\Model\ModelActivity::getBandwidthByDate($organisation->id, $firstDayPreviousMonth, $lastDayPreviousMonth);
    $masterImages = $masterImages ? (int) $masterImages : 0;
    $bandwidth = $bandwidth ? (int) $bandwidth : 0;
    $masterImagesPrice = (double) \NinjaImg\Model\ModelSettings::getInstance()->getPriceMasterImage() * $masterImages;
    $bandwidthPrice = (double) \NinjaImg\Model\ModelSettings::getInstance()->getPriceBandwidthGB() / 1024 * $bandwidth;
    return number_format($masterImagesPrice + $bandwidthPrice, 2);
}
Beispiel #2
0
 public function getMasterImages()
 {
     return ModelActivity::getMasterImagesByDate($this->organisation->id, $this->startDate, $this->endDate);
 }