private function getHTML(Sale $sale) { $url = $this->baseUrl . '/license/' . $sale->getLicenseId(); $html = '<p>A license has been sold for <strong>$%s</strong></p>'; $html .= '<p>License details:</p>'; $html .= '<table>' . '<tr><td>Customer</td><td>%s</td></tr>' . '<tr><td>Type</td><td>%s</td></tr>' . '<tr><td>Size</td><td>%s</td></tr>' . '<tr><td>License ID</td><td>%s</td></tr>' . '<tr><td>Add-On</td><td><a href="%s">%s</a></td></tr>' . '<tr><td>Date</td><td>%s</td></tr>' . '<tr><td>Valid until</td><td>%s</td></tr>' . '</table>'; return sprintf($html, $sale->getVendorAmount(), $sale->getOrganisationName(), $sale->getSaleType(), $sale->getLicenseSize(), $sale->getLicenseId(), $url, $sale->getPluginName(), $sale->getDate()->format('Y-m-d'), $sale->getMaintenanceEndDate()->format('Y-m-d')); }
private function addMonltySale(&$groupedSales, Sale $sale) { if (!isset($groupedSales[$sale->getDate()->format('Y-m')])) { $monthlySale = ['new' => 0.0, 'renewal' => 0.0, 'other' => 0.0]; } else { $monthlySale = $groupedSales[$sale->getDate()->format('Y-m')]; } switch ($sale->getSaleType()) { case 'Renewal': $monthlySale['renewal'] += $sale->getVendorAmount(); break; case 'New': $monthlySale['new'] += $sale->getVendorAmount(); break; default: $monthlySale['other'] += $sale->getVendorAmount(); break; } $groupedSales[$sale->getDate()->format('Y-m')] = $monthlySale; }