当前位置: 首页>>代码示例>>PHP>>正文


PHP Invoice::getRequestedAmount方法代码示例

本文整理汇总了PHP中app\models\Invoice::getRequestedAmount方法的典型用法代码示例。如果您正苦于以下问题:PHP Invoice::getRequestedAmount方法的具体用法?PHP Invoice::getRequestedAmount怎么用?PHP Invoice::getRequestedAmount使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在app\models\Invoice的用法示例。


在下文中一共展示了Invoice::getRequestedAmount方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: sendInvoice

 public function sendInvoice(Invoice $invoice)
 {
     $invoice->load('invitations', 'client', 'account');
     $entityType = $invoice->getEntityType();
     $view = 'invoice';
     $subject = trans("texts.{$entityType}_subject", ['invoice' => $invoice->invoice_number, 'account' => $invoice->account->getDisplayName()]);
     $accountName = $invoice->account->getDisplayName();
     $emailTemplate = $invoice->account->getEmailTemplate($entityType);
     $invoiceAmount = Utils::formatMoney($invoice->getRequestedAmount(), $invoice->client->currency_id);
     foreach ($invoice->invitations as $invitation) {
         if (!$invitation->user || !$invitation->user->email) {
             return false;
         }
         if (!$invitation->contact || !$invitation->contact->email) {
             return false;
         }
         $invitation->sent_date = \Carbon::now()->toDateTimeString();
         $invitation->save();
         $variables = ['$footer' => $invoice->account->getEmailFooter(), '$link' => $invitation->getLink(), '$client' => $invoice->client->getDisplayName(), '$account' => $accountName, '$contact' => $invitation->contact->getDisplayName(), '$amount' => $invoiceAmount];
         $data['body'] = str_replace(array_keys($variables), array_values($variables), $emailTemplate);
         $data['link'] = $invitation->getLink();
         $data['entityType'] = $entityType;
         $data['invoice_id'] = $invoice->id;
         $fromEmail = $invitation->user->email;
         $this->sendTo($invitation->contact->email, $fromEmail, $accountName, $subject, $view, $data);
         Activity::emailInvoice($invitation);
     }
     if (!$invoice->isSent()) {
         $invoice->invoice_status_id = INVOICE_STATUS_SENT;
         $invoice->save();
     }
     Event::fire(new InvoiceSent($invoice));
 }
开发者ID:biggtfish,项目名称:invoiceNinja-1,代码行数:33,代码来源:ContactMailer.php

示例2: sendNotification

 public function sendNotification(User $user, Invoice $invoice, $notificationType, Payment $payment = null)
 {
     if (!$user->email) {
         return;
     }
     $entityType = $notificationType == 'approved' ? ENTITY_QUOTE : ENTITY_INVOICE;
     $view = "{$entityType}_{$notificationType}";
     $data = ['entityType' => $entityType, 'clientName' => $invoice->client->getDisplayName(), 'accountName' => $invoice->account->getDisplayName(), 'userName' => $user->getDisplayName(), 'invoiceAmount' => Utils::formatMoney($invoice->getRequestedAmount(), $invoice->client->getCurrencyId()), 'invoiceNumber' => $invoice->invoice_number, 'invoiceLink' => SITE_URL . "/{$entityType}s/{$invoice->public_id}"];
     if ($payment) {
         $data['paymentAmount'] = Utils::formatMoney($payment->amount, $invoice->client->getCurrencyId());
     }
     $subject = trans("texts.notification_{$entityType}_{$notificationType}_subject", ['invoice' => $invoice->invoice_number, 'client' => $invoice->client->getDisplayName()]);
     $this->sendTo($user->email, CONTACT_EMAIL, CONTACT_NAME, $subject, $view, $data);
 }
开发者ID:saratonite,项目名称:invoiceninja,代码行数:14,代码来源:UserMailer.php

示例3: sendInvoice

 public function sendInvoice(Invoice $invoice)
 {
     $invoice->load('invitations', 'client.language', 'account');
     $entityType = $invoice->getEntityType();
     $client = $invoice->client;
     $account = $invoice->account;
     $account->loadLocalizationSettings($client);
     $view = 'invoice';
     $subject = trans("texts.{$entityType}_subject", ['invoice' => $invoice->invoice_number, 'account' => $invoice->account->getDisplayName()]);
     $accountName = $invoice->account->getDisplayName();
     $emailTemplate = $invoice->account->getEmailTemplate($entityType);
     $invoiceAmount = Utils::formatMoney($invoice->getRequestedAmount(), $client->getCurrencyId());
     $this->initClosure($invoice);
     foreach ($invoice->invitations as $invitation) {
         if (!$invitation->user || !$invitation->user->email || $invitation->user->trashed()) {
             return false;
         }
         if (!$invitation->contact || !$invitation->contact->email || $invitation->contact->trashed()) {
             return false;
         }
         $invitation->sent_date = \Carbon::now()->toDateTimeString();
         $invitation->save();
         $variables = ['$footer' => $invoice->account->getEmailFooter(), '$link' => $invitation->getLink(), '$client' => $client->getDisplayName(), '$account' => $accountName, '$contact' => $invitation->contact->getDisplayName(), '$amount' => $invoiceAmount, '$advancedRawInvoice->' => '$'];
         // Add variables for available payment types
         foreach (Gateway::getPaymentTypeLinks() as $type) {
             $variables["\${$type}_link"] = URL::to("/payment/{$invitation->invitation_key}/{$type}");
         }
         $data['body'] = str_replace(array_keys($variables), array_values($variables), $emailTemplate);
         $data['body'] = preg_replace_callback('/\\{\\{\\$?(.*)\\}\\}/', $this->advancedTemplateHandler, $data['body']);
         $data['link'] = $invitation->getLink();
         $data['entityType'] = $entityType;
         $data['invoice_id'] = $invoice->id;
         $fromEmail = $invitation->user->email;
         $response = $this->sendTo($invitation->contact->email, $fromEmail, $accountName, $subject, $view, $data);
         if ($response !== true) {
             return $response;
         }
         Activity::emailInvoice($invitation);
     }
     if (!$invoice->isSent()) {
         $invoice->invoice_status_id = INVOICE_STATUS_SENT;
         $invoice->save();
     }
     $account->loadLocalizationSettings();
     Event::fire(new InvoiceSent($invoice));
     return $response;
 }
开发者ID:jorisvandesande,项目名称:invoice-ninja,代码行数:47,代码来源:ContactMailer.php

示例4: sendInvitation

 /**
  * @param Invitation $invitation
  * @param Invoice $invoice
  * @param $body
  * @param $subject
  * @param $pdfString
  * @param $documentStrings
  * @return bool|string
  * @throws \Laracasts\Presenter\Exceptions\PresenterException
  */
 private function sendInvitation(Invitation $invitation, Invoice $invoice, $body, $subject, $pdfString, $documentStrings)
 {
     $client = $invoice->client;
     $account = $invoice->account;
     if (Auth::check()) {
         $user = Auth::user();
     } else {
         $user = $invitation->user;
         if ($invitation->user->trashed()) {
             $user = $account->users()->orderBy('id')->first();
         }
     }
     if (!$user->email || !$user->registered) {
         return trans('texts.email_error_user_unregistered');
     } elseif (!$user->confirmed) {
         return trans('texts.email_error_user_unconfirmed');
     } elseif (!$invitation->contact->email) {
         return trans('texts.email_error_invalid_contact_email');
     } elseif ($invitation->contact->trashed()) {
         return trans('texts.email_error_inactive_contact');
     }
     $variables = ['account' => $account, 'client' => $client, 'invitation' => $invitation, 'amount' => $invoice->getRequestedAmount()];
     // Let the client know they'll be billed later
     if ($client->autoBillLater()) {
         $variables['autobill'] = $invoice->present()->autoBillEmailMessage();
     }
     if (empty($invitation->contact->password) && $account->hasFeature(FEATURE_CLIENT_PORTAL_PASSWORD) && $account->enable_portal_password && $account->send_portal_password) {
         // The contact needs a password
         $variables['password'] = $password = $this->generatePassword();
         $invitation->contact->password = bcrypt($password);
         $invitation->contact->save();
     }
     $data = ['body' => $this->templateService->processVariables($body, $variables), 'link' => $invitation->getLink(), 'entityType' => $invoice->getEntityType(), 'invoiceId' => $invoice->id, 'invitation' => $invitation, 'account' => $account, 'client' => $client, 'invoice' => $invoice, 'documents' => $documentStrings];
     if ($account->attachPDF()) {
         $data['pdfString'] = $pdfString;
         $data['pdfFileName'] = $invoice->getFileName();
     }
     $subject = $this->templateService->processVariables($subject, $variables);
     $fromEmail = $user->email;
     $view = $account->getTemplateView(ENTITY_INVOICE);
     $response = $this->sendTo($invitation->contact->email, $fromEmail, $account->getDisplayName(), $subject, $view, $data);
     if ($response === true) {
         return true;
     } else {
         return $response;
     }
 }
开发者ID:hillelcoren,项目名称:invoice-ninja,代码行数:57,代码来源:ContactMailer.php


注:本文中的app\models\Invoice::getRequestedAmount方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。