search($taxationId); $vendorModel = new VendorModel(); if (!($to = $vendorModel->getUserEmails($taxation['vendorId']))) { return false; } $vendor = $vendorModel->get(['id' => $taxation['vendorId']], VendorModel::MAIN_DATA); $placeholders = [ 'id' => $taxation['id'], 'fromDate' => self::toFriendlyDate($taxation['start']), 'toDate' => self::toFriendlyDate($taxation['end']), 'dueDate' => self::toFriendlyDate($taxation['dueDate']), 'total' => Number::toMoney($taxation['total']), 'vendorDbaName' => htmlspecialchars($vendor['dbaName']), 'vendorSoleProprietorName' => htmlspecialchars($vendor['soleProprietorName']), 'vendorFederalId' => htmlspecialchars($vendor['federalId']), 'vendorPhone' => htmlspecialchars($vendor['phone']), 'N' => $dayMark, 'detailsUrl' => TaxationUserView::getPage('url') . '?id=' . $taxationId['id'], ]; return Qs_Mail::sendTemplate($template, $placeholders, $to); } public static function sendTaxationInDisputeToAdmin($taxationId) { $taxation = (new Qs_Db_Table('Taxation'))->search($taxationId); $vendor = (new VendorModel())->get(['id' => $taxation['vendorId']], VendorModel::MAIN_DATA); $placeholders = [ 'id' => $taxation['id'], 'fromDate' => self::toFriendlyDate($taxation['start']), 'toDate' => self::toFriendlyDate($taxation['end']), 'dueDate' => self::toFriendlyDate($taxation['dueDate']), 'total' => Number::toMoney($taxation['total']), 'vendorDbaName' => htmlspecialchars($vendor['dbaName']), 'vendorSoleProprietorName' => htmlspecialchars($vendor['soleProprietorName']), 'vendorFederalId' => htmlspecialchars($vendor['federalId']), 'vendorPhone' => htmlspecialchars($vendor['phone']), 'detailsUrl' => TaxationAdminView::getPage('url') . '?action=edit&id=' . $taxation['id'], ]; $template = 'taxationInvoiceDisputeAdmin'; $to = App_Settings_Obj::getFormEmails($template . 'To', false); if (empty($to)) { $to = App_Settings_Obj::getAdminEmails(); } return Qs_Mail::sendTemplate($template, $placeholders, $to); } public static function sendTaxationInvoicePaidToUser($taxationId) { $taxation = (new Qs_Db_Table('Taxation'))->search($taxationId); $vendorModel = new VendorModel(); if (!($to = $vendorModel->getUserEmails($taxation['vendorId']))) { return false; } $vendor = $vendorModel->get(['id' => $taxation['vendorId']], VendorModel::MAIN_DATA); $placeholders = [ 'id' => $taxation['id'], 'fromDate' => self::toFriendlyDate($taxation['start']), 'toDate' => self::toFriendlyDate($taxation['end']), 'dueDate' => self::toFriendlyDate($taxation['dueDate']), 'total' => Number::toMoney($taxation['total']), 'vendorDbaName' => htmlspecialchars($vendor['dbaName']), 'vendorSoleProprietorName' => htmlspecialchars($vendor['soleProprietorName']), 'vendorFederalId' => htmlspecialchars($vendor['federalId']), 'vendorPhone' => htmlspecialchars($vendor['phone']), 'detailsUrl' => TaxationUserView::getPage('url') . '?id=' . $taxation['id'], 'invoiceUrl' => Qs_FileFs::getUrl($taxation['invoiceFile']), 'receiptUrl' => TaxationPdfView::getReceiptUrl($taxation['id']), ]; $mail = Qs_Mail::fromTemplate('taxationInvoicePaidUser', $placeholders, $to); return $mail->send(); } public static function sendTaxationInvoicePaidToAdmin($taxationId) { $taxation = (new Qs_Db_Table('Taxation'))->search($taxationId); $vendor = (new VendorModel())->get(['id' => $taxation['vendorId']], VendorModel::MAIN_DATA); $placeholders = [ 'id' => $taxation['id'], 'fromDate' => self::toFriendlyDate($taxation['start']), 'toDate' => self::toFriendlyDate($taxation['end']), 'dueDate' => self::toFriendlyDate($taxation['dueDate']), 'total' => Number::toMoney($taxation['total']), 'vendorDbaName' => htmlspecialchars($vendor['dbaName']), 'vendorSoleProprietorName' => htmlspecialchars($vendor['soleProprietorName']), 'vendorFederalId' => htmlspecialchars($vendor['federalId']), 'vendorPhone' => htmlspecialchars($vendor['phone']), 'detailsUrl' => TaxationAdminView::getPage('url') . '?action=edit&id=' . $taxation['id'], ]; $templateId = 'taxationInvoicePaidAdmin'; $to = App_Settings_Obj::getFormEmails($templateId . 'To'); return Qs_Mail::sendTemplate($templateId, $placeholders, $to); } private static function toFriendlyDate($date) { if (($time = strtotime($date))) { return date('m/d/Y', $time); } return ''; } }