public function FormatNumber($fltAmount) { if ($fltAmount < 0) { return '<span style="color: #933;">' . QApplication::DisplayCurrency($fltAmount) . '</span>'; } if ($fltAmount > 0) { return QApplication::DisplayCurrency($fltAmount); } return '<span style="color: #999;">$0.00</span>'; }
public function lblTotal_Refresh() { $this->lblTotal->Text = QApplication::DisplayCurrency($this->GetAmount(), ' '); }
/** * This will send a confirmation email for the OnlineDonation item * @param string $strToAddress an explicitly set EmailAddress to send, or if null, it will try and deduce it from the attached person record */ public function SendConfirmationEmail($strToAddress = null) { // Template $strTemplateName = 'online_donation'; // Calculate Email Address - THIS WILL RETURN if none is found $strFromAddress = 'ALCF Online Donation <*****@*****.**>'; if (!$strToAddress) { $strToAddress = $this->CalculateConfirmationEmailAddress(); } if (!$strToAddress) { return; } $strSubject = 'Your Online Donation'; // Setup the SubstitutionArray $strArray = array(); // Setup Always-Used Fields $strArray['PERSON_NAME'] = $this->Person->Name; $strArray['ONLINE_DONATION_ID'] = sprintf('%05s', $this->Id); // Add Payment Info $strArray['AMOUNT'] = QApplication::DisplayCurrency($this->Amount); $strArray['CREDIT_CARD'] = $this->CreditCardPayment->CreditCardDescription; $strProductArray = array(); foreach ($this->GetOnlineDonationLineItemArray() as $objLineItem) { $strProductArray[] = sprintf('%s - %s', $objLineItem->StewardshipFund ? $objLineItem->StewardshipFund->ExternalName : $objLineItem->Other, QApplication::DisplayCurrency($objLineItem->Amount)); } $strArray['PAYMENT_ITEMS'] = implode("\r\n", $strProductArray); OutgoingEmailQueue::QueueFromTemplate($strTemplateName, $strArray, $strToAddress, $strFromAddress, $strSubject, null, trim(Registry::GetValue('donation_receipt_bcc'))); }
/** * Queues a "confirmation email" to be sent out to the person signing up * @param SignupPayment $objSignupPayment an OPTIONAL SignupPayment for the payment that was "just submitted" and to be incorporated into the email message */ public function SendConfirmationEmail(SignupPayment $objSignupPayment = null) { // Setup the SubstitutionArray $strArray = array(); // Setup Always-Used Fields if (!$this->PersonId) { $strArray['PERSON_NAME'] = sprintf("%s %s", $this->CommunicationsEntry->FirstName, $this->CommunicationsEntry->LastName); } else { $strArray['PERSON_NAME'] = $this->Person->Name; } $strArray['SIGNUP_FORM_NAME'] = $this->SignupForm->Name; $strArray['SIGNUP_ENTRY_ID'] = sprintf('%05s', $this->Id); $strArray['SUPPORT_EMAIL'] = $this->SignupForm->SupportEmail; // Add a Description $strArray['SIGNUP_DESCRIPTION'] = null; if ($strDescription = trim($this->SignupForm->Description)) { $strArray['SIGNUP_DESCRIPTION'] = $strDescription; } else { switch ($this->SignupForm->SignupFormTypeId) { case SignupFormType::Event: if ($strDescription = $this->SignupForm->EventSignupForm->GeneratedDescription) { $strArray['SIGNUP_DESCRIPTION'] = 'Event ' . trim(substr($strDescription, 1)) . '.'; } break; } } // Add URL to the Description (if applicable) if ($strUrl = trim($this->SignupForm->InformationUrl)) { $strArray['SIGNUP_DESCRIPTION'] = trim($strArray['SIGNUP_DESCRIPTION'] . ' For more information, please go to ' . $strUrl); } // Add Payment Info (if applicable) if ($objSignupPayment) { $strArray['AMOUNT'] = QApplication::DisplayCurrency($objSignupPayment->Amount); $strArray['CREDIT_CARD'] = $objSignupPayment->TransactionDescription; $strProductArray = array(); foreach ($this->GetSignupProductArray(QQ::OrderBy(QQN::SignupProduct()->FormProduct->FormProductTypeId, QQN::SignupProduct()->FormProduct->OrderNumber)) as $objSignupProduct) { $strProductArray[] = sprintf('%s - Qty %s - %s', $objSignupProduct->FormProduct->Name, $objSignupProduct->Quantity, QApplication::DisplayCurrency($objSignupProduct->Quantity * $objSignupProduct->Amount)); } $strArray['PAYMENT_ITEMS'] = implode("\r\n", $strProductArray); $strTemplateName = 'signup_entry_paid'; } else { $strTemplateName = 'signup_entry_unpaid'; } // Calculate Email Address $strFromAddress = 'ALCF Signup System <*****@*****.**>'; if (!($strToAddress = $this->CalculateConfirmationEmailAddress())) { $strToAddress = $strFromAddress; } $strBccAddress = trim($this->SignupForm->EmailNotification); $strSubject = 'Your Signup for ' . $this->SignupForm->Name; OutgoingEmailQueue::QueueFromTemplate($strTemplateName, $strArray, $strToAddress, $strFromAddress, $strSubject, null, $strBccAddress); }
$intY -= 10.2; $objPage->setFont(Zend_Pdf_Font::fontWithName(Zend_Pdf_Font::FONT_HELVETICA), 8); $objPage->drawText("Yearly Average Gift Size: ", 36, $intY, 'UTF-8'); $objPage->drawText(QApplication::DisplayCurrency($fltTotalAverageGiftSize), 310, $intY, 'UTF-8'); $intY -= 10.2; $objPage->setFont(Zend_Pdf_Font::fontWithName(Zend_Pdf_Font::FONT_HELVETICA), 8); $objPage->drawText("Yearly Number Of Gifts Over \$1000: ", 36, $intY, 'UTF-8'); $objPage->drawText($fltTotalGiftsOver1000, 310, $intY, 'UTF-8'); $intY -= 10.2; $objPage->setFont(Zend_Pdf_Font::fontWithName(Zend_Pdf_Font::FONT_HELVETICA), 8); $objPage->drawText("Yearly Number Of Gifts Over \$10000: ", 36, $intY, 'UTF-8'); $objPage->drawText($fltTotalGiftsOver10000, 310, $intY, 'UTF-8'); $intY -= 10.2; $objPage->setFont(Zend_Pdf_Font::fontWithName(Zend_Pdf_Font::FONT_HELVETICA), 8); $objPage->drawText("Total Yearly Giving: ", 36, $intY, 'UTF-8'); $objPage->drawText(QApplication::DisplayCurrency($fltTotalGiftAmount), 310, $intY, 'UTF-8'); // Print the table $intY -= 15.2; $intXArray = array(20, 80, 150, 210, 260, 312, 398, 498); $objPage->setLineColor(new Zend_Pdf_Color_GrayScale(0.2)); $objPage->setFillColor(new Zend_Pdf_Color_GrayScale(0.2)); $objPage->drawRectangle($intXArray[0] - 6, $intY, $intXArray[7] + 90, $intY - 10); $intY -= 7.5; $objPage->setFillColor(new Zend_Pdf_Color_GrayScale(1)); $objPage->setFont(Zend_Pdf_Font::fontWithName(Zend_Pdf_Font::FONT_HELVETICA), 8); $objPage->drawText("Month", $intXArray[0], $intY, 'UTF-8'); $objPage->drawText("Average Gift Size", $intXArray[1], $intY, 'UTF-8'); $objPage->drawText("Total", $intXArray[2], $intY, 'UTF-8'); $objPage->drawText("# Gifts", $intXArray[3], $intY, 'UTF-8'); $objPage->drawText("# Givers", $intXArray[4], $intY, 'UTF-8'); $objPage->drawText("New Givers", $intXArray[5], $intY, 'UTF-8');
public function RenderProductCost(FormProduct $objProduct) { if (!$this->objSignupProduct) { return null; } return QApplication::DisplayCurrency($this->objSignupProduct->TotalAmount); }
foreach ($objSignupForm->GetFormProductArray(QQ::OrderBy(QQN::FormProduct()->FormProductTypeId, QQN::FormProduct()->OrderNumber)) as $objFormProduct) { if ($objFormProduct->ViewFlag) { $objSignupProduct = SignupProduct::LoadBySignupEntryIdFormProductId($objSignupEntry->Id, $objFormProduct->Id); if ($objSignupProduct) { print QApplication::DisplayCurrency($objSignupProduct->Amount); } else { print " "; } print ","; } } print QApplication::DisplayCurrency($objSignupEntry->AmountTotal); print ","; print QApplication::DisplayCurrency($objSignupEntry->AmountPaid); print ","; print QApplication::DisplayCurrency($objSignupEntry->AmountBalance); print ","; $strReturn = ''; if ($objSignupEntry->CountSignupPayments()) { $objArray = $objSignupEntry->GetSignupPaymentArray(); $strReturn .= SignupPaymentType::ToString($objArray[0]->SignupPaymentTypeId); } else { $strReturn = 'No payment'; } print EscapeCsv($strReturn); print ","; } if ($objSignupEntry->DateSubmitted) { print EscapeCsv($objSignupEntry->DateSubmitted->ToString('M/D/YYYY')); } print "\r\n";
public function dtgFunding_Bind() { $objDataSource = array(); $fltTotalDonation = 0; $fltTotalNonDonation = 0; foreach ($this->objPaymentArray as $objPayment) { if ($objPayment->OnlineDonation) { foreach ($objPayment->OnlineDonation->GetOnlineDonationLineItemArray() as $objLineItem) { // We've explicitly selected a Stewardship / Donation Fund if ($objLineItem->StewardshipFundId) { if (!array_key_exists($objLineItem->StewardshipFundId, $objDataSource)) { $objDataSource[$objLineItem->StewardshipFundId] = array(QApplication::HtmlEntities($objLineItem->StewardshipFund->Name), $objLineItem->StewardshipFund->AccountNumber, 0); } $objDataSource[$objLineItem->StewardshipFundId][2] += $objLineItem->Amount; $fltTotalDonation += $objLineItem->Amount; // We're explicilty looking at a NON DONATION } else { if (!$objLineItem->DonationFlag) { $strKey = 'Non-Donation: ' . $objLineItem->Other; if (!array_key_exists($strKey, $objDataSource)) { $objDataSource[$strKey] = array('Non-Donation / Payment', $objLineItem->Other, 0); } $objDataSource[$strKey][2] += $objLineItem->Amount; $fltTotalNonDonation += $objLineItem->Amount; // We have not yet specified it, but we're assuming this to be a donation of some sort } else { if (!array_key_exists(0, $objDataSource)) { $objDataSource[0] = array('<span style="color: #888;">(Not Yet Specified)</span>', '---', 0); } $objDataSource[0][2] += $objLineItem->Amount; $fltTotalDonation += $objLineItem->Amount; } } } } else { if ($objPayment->SignupPayment) { if ($fltAmount = $objPayment->SignupPayment->AmountNonDonation) { if (!array_key_exists($objPayment->SignupPayment->FundingAccountLabel, $objDataSource)) { $objDataSource[$objPayment->SignupPayment->FundingAccountLabel] = array(QApplication::HtmlEntities($objPayment->SignupPayment->SignupEntry->SignupForm->Name), strlen(trim($objPayment->SignupPayment->FundingAccount)) ? QApplication::HtmlEntities($objPayment->SignupPayment->FundingAccount) : 'Unspecified', 0); } $objDataSource[$objPayment->SignupPayment->FundingAccountLabel][2] += $fltAmount; $fltTotalNonDonation += $fltAmount; } if ($fltAmount = $objPayment->SignupPayment->AmountDonation) { if (!array_key_exists($objPayment->SignupPayment->DonationStewardshipFundId, $objDataSource)) { $objDataSource[$objPayment->SignupPayment->DonationStewardshipFundId] = array(QApplication::HtmlEntities($objPayment->SignupPayment->DonationStewardshipFund->Name), $objPayment->SignupPayment->DonationStewardshipFund->AccountNumber, 0); } $objDataSource[$objPayment->SignupPayment->DonationStewardshipFundId][2] += $fltAmount; $fltTotalDonation += $fltAmount; } } else { throw new Exception('Cannot figure out linked record to this credit card payment entry: ' . $objPayment->Id); } } } // Make sure the amount shown is displayed as "currency" for each row foreach ($objDataSource as $intId => $arrArray) { $objDataSource[$intId][2] = QApplication::DisplayCurrency($objDataSource[$intId][2]); if ($intId == 0) { $objDataSource[$intId][2] = '<span style="color: #888;">' . $objDataSource[$intId][2] . '</span>'; } } usort($objDataSource, array($this, 'dtgFunding_Sort')); $objDataSource[99997] = array('<strong style="color: #888;">TOTAL in DONATIONS</strong>', null, '<strong style="color: #888;">' . QApplication::DisplayCurrency($fltTotalDonation) . '</strong>'); $objDataSource[99998] = array('<strong style="color: #888;">TOTAL in NON-DONATIONS</strong>', null, '<strong style="color: #888;">' . QApplication::DisplayCurrency($fltTotalNonDonation) . '</strong>'); $objDataSource[99999] = array('<strong>GRAND TOTAL AMOUNT</strong>', null, '<strong>' . QApplication::DisplayCurrency($fltTotalDonation + $fltTotalNonDonation) . '</strong>'); $this->dtgFunding->DataSource = $objDataSource; }
” <br/> <span style="font-size: 10px; font-weight: normal; font-style: italic; color: #666;"> This batch has <strong><?php _p($this->objBatch->ItemCount); ?> </strong> items for a total amount of <strong><?php _p(QApplication::DisplayCurrency($this->objBatch->ActualTotalAmount)); ?> </strong> </span> <button class="primary">Close Window</button> </h1> <h3> <?php printf('Post #%s :: %s<br/><span style="font-size: 10px; font-weight: normal; font-style: italic; color: #666;">Posted on %s by %s</span>', $this->objPost->PostNumber, QApplication::DisplayCurrency($this->objPost->TotalAmount), $this->objPost->DatePosted->ToString('MMMM D, YYYY'), $this->objPost->CreatedByLogin->Name); ?> </h3> <h3> <?php _p(QApplication::PathInfo(0) == 'funds' ? 'Overview' : 'Details of Changes'); ?> </h3> <?php $this->dtgReport->Render(); ?> <?php $this->RenderEnd(); ?>
public function pnlStack_Refresh(StewardshipStack $objStack) { $strControlId = 'pnlStack' . $objStack->Id; $pnlStack = $this->GetControl($strControlId); if (!$pnlStack) { return; } $strClassName = null; if ($this->objStack && $this->objStack->Id == $objStack->Id) { $strClassName = 'selected'; // Since there are so many calculated values in the HTML, we'll store the template as a // sprintf-formatted string (e.g. with a bunch of %s) as a textfile and use sprintf to manually set the text of the // pnlStack, instead of doing a full fledged QPanel template if ($objStack->ReportedTotalAmount) { $strSprintfTemplate = file_get_contents(dirname(__FILE__) . '/pnlStack_WithReportedAmount.txt'); $pnlStack->Text = sprintf($strSprintfTemplate, $objStack->StackNumber, $strClassName, $objStack->StackNumber, number_format($objStack->ItemCount, 0), QApplication::DisplayCurrency($objStack->ActualTotalAmount), QApplication::DisplayCurrency($objStack->ReportedTotalAmount), QApplication::DisplayCurrencyHtml($objStack->ActualTotalAmount - $objStack->ReportedTotalAmount)); } else { $strSprintfTemplate = file_get_contents(dirname(__FILE__) . '/pnlStack_WithoutReportedAmount.txt'); $pnlStack->Text = sprintf($strSprintfTemplate, $objStack->StackNumber, $strClassName, $objStack->StackNumber, number_format($objStack->ItemCount, 0), QApplication::DisplayCurrency($objStack->ActualTotalAmount)); } // For "Unselected" } else { $strSprintfTemplate = file_get_contents(dirname(__FILE__) . '/pnlStack_Unselected.txt'); $pnlStack->Text = sprintf($strSprintfTemplate, $objStack->StackNumber, $strClassName, $objStack->StackNumber, number_format($objStack->ItemCount, 0), QApplication::DisplayCurrency($objStack->ActualTotalAmount)); } }
public function RenderProductAmount(SignupEntry $objSignupEntry, $intFormProductId) { $objSignupProduct = SignupProduct::LoadBySignupEntryIdFormProductId($objSignupEntry->Id, $intFormProductId); if (!$objSignupProduct) { return; } return QApplication::DisplayCurrency($objSignupProduct->Amount); }
public function RenderAmount($fltAmount, $blnDisplayNullAsZero = true) { if ($blnDisplayNullAsZero || !is_null($fltAmount)) { return QApplication::DisplayCurrency($fltAmount); } }
<?php require __INCLUDES__ . '/header_my.inc.php'; ?> <h1>Give Online</h1> <h4>Thank you for your online contribution!</h4> <p style="font-size: 14px;">We have successfully received your contribution of <strong><?php _p(QApplication::DisplayCurrency($this->objOnlineDonation->Amount)); ?> </strong>. Your confirmation number is <strong><?php _p(sprintf('%05s', $this->objOnlineDonation->Id)); ?> </strong>.<br/> <?php if (QApplication::$PublicLogin && ($strEmail = $this->objOnlineDonation->CalculateConfirmationEmailAddress())) { ?> <br/>A confirmation email has been sent out to <strong><?php _p($strEmail); ?> </strong>. <?php } else { if (array_key_exists('onlineDonationEmailAddress' . $this->objOnlineDonation->Id, $_SESSION)) { ?> <br/>A confirmation email has been sent out to <strong><?php _p($_SESSION['onlineDonationEmailAddress' . $this->objOnlineDonation->Id]); ?>
protected static function DrawItems(Zend_Pdf_Page $objPage, $objContributionAmountArray, $intY) { $intXArray = array(20, 92, 200, 308, 465); $objPage->setLineColor(new Zend_Pdf_Color_GrayScale(0.2)); $objPage->setFillColor(new Zend_Pdf_Color_GrayScale(0.2)); $objPage->drawRectangle($intXArray[0] - 6, $intY, $intXArray[4] + 6, $intY - 10); $intY -= 7.5; $objPage->setFillColor(new Zend_Pdf_Color_GrayScale(1)); $objPage->setFont(Zend_Pdf_Font::fontWithName(Zend_Pdf_Font::FONT_HELVETICA_BOLD), 7); $objPage->drawText('POSTED DATE', $intXArray[0], $intY, 'UTF-8'); $objPage->drawText('CONTRIBUTED BY', $intXArray[1], $intY, 'UTF-8'); $objPage->drawText('FUND', $intXArray[2], $intY, 'UTF-8'); $objPage->drawText('TRANSACTION', $intXArray[3], $intY, 'UTF-8'); self::DrawTextRight($objPage, $intXArray[4], $intY, 'AMOUNT'); $objPage->setFillColor(new Zend_Pdf_Color_GrayScale(0)); $intY -= 3.5; $objPage->setFont(Zend_Pdf_Font::fontWithName(Zend_Pdf_Font::FONT_HELVETICA), 9); foreach ($objContributionAmountArray as $objAmount) { $intY -= 10; $objPage->drawText($objAmount->StewardshipContribution->DateCredited->ToString('MMM D YYYY'), $intXArray[0], $intY, 'UTF-8'); $objPage->drawText($objAmount->StewardshipContribution->Person->Name, $intXArray[1], $intY, 'UTF-8'); $objPage->drawText($objAmount->StewardshipFund->Name, $intXArray[2], $intY, 'UTF-8'); $objPage->setFont(Zend_Pdf_Font::fontWithName(Zend_Pdf_Font::FONT_HELVETICA), 7.5); $objPage->drawText($objAmount->StewardshipContribution->TransactionShort, $intXArray[3], $intY, 'UTF-8'); $objPage->setFont(Zend_Pdf_Font::fontWithName(Zend_Pdf_Font::FONT_HELVETICA), 9); $strAmount = QApplication::DisplayCurrency($objAmount->Amount); if ($objAmount->StewardshipContribution->NonDeductibleFlag) { $strAmount = $strAmount . ' (*)'; } self::DrawTextRight($objPage, $intXArray[4], $intY, $strAmount); } }
?> <?php $this->lstYear->Render(); ?> </div> <div class="cleaner"> </div> </div> <h3>Totals</h3> <div class="section"> <p style="float: left;">Total: <strong><?php _p(QApplication::DisplayCurrency($this->fltTotal)); ?> </strong></p> <p style="float: right;">Total YTD: <strong><?php _p(QApplication::DisplayCurrency($this->fltTotalYtd)); ?> </strong></p> <div class="cleaner"> </div> </div> <h3>Breakdown by Stewardship Fund</h3> <div class="section"> <?php $this->dtgReport->Render(); ?> </div> <?php require __INCLUDES__ . '/footer.inc.php';
<?php if ($this->objBatch->ReportedTotalAmount) { ?> <div class="batchLabel">Reported</div><div class="batchValue"><?php _p(QApplication::DisplayCurrency($this->objBatch->ReportedTotalAmount)); ?> </div> <div class="cleaner"></div> <div class="batchLabel">Difference</div><div class="batchValue"><?php _p(QApplication::DisplayCurrencyHtml($this->objBatch->ActualTotalAmount - $this->objBatch->ReportedTotalAmount), false); ?> </div> <div class="cleaner"></div> <?php } if ($this->objBatch->PostedTotalAmount) { ?> <div class="batchLabel">Posted</div><div class="batchValue"><?php _p(QApplication::DisplayCurrency($this->objBatch->PostedTotalAmount)); ?> </div> <?php } else { ?> <div class="batchLabel">Posted</div><div class="batchValue">n/a</div> <?php } ?> </div> <div class="cleaner"></div> </div>
public function RenderTotal($objItem) { // Required and Optional Products if ($objItem instanceof FormProduct) { $objSignupProduct = SignupProduct::LoadBySignupEntryIdFormProductId($this->objSignupEntry->Id, $objItem->Id); if ($objSignupProduct) { return QApplication::DisplayCurrency($objSignupProduct->TotalAmount); } return null; // Payment Entries } else { if ($objItem instanceof SignupPayment) { return QApplication::DisplayCurrency(-1 * $objItem->Amount); // "Required with Choice" Products } else { if ($objItem == -1) { if ($intFormProductId = $this->lstRequiredWithChoice->SelectedValue) { $objSignupProduct = SignupProduct::LoadBySignupEntryIdFormProductId($this->objSignupEntry->Id, $intFormProductId); if ($objSignupProduct) { return QApplication::DisplayCurrency($objSignupProduct->TotalAmount); } } return null; // Balance Entry } else { if (is_null($objItem)) { return '<strong>' . QApplication::DisplayCurrency(-1 * $this->objSignupEntry->AmountBalance) . '</strong>'; } } } } }
public function RenderAmount(StewardshipContributionAmount $objAmount) { if (!$objAmount->Id) { return '<span style="font-weight: normal;">' . QApplication::DisplayCurrency($this->fltTotal, 10) . '</span>'; } $this->fltTotal += $objAmount->Amount; $strToReturn = QApplication::DisplayCurrencyHtml($objAmount->Amount, true); if ($objAmount->StewardshipContribution->NonDeductibleFlag) { $strToReturn .= '<br/><span style="color: #666; font-size: 10px;">Non-Deductible</span>'; } return $strToReturn; }