public function RenderCount(StewardshipPost $objPost)
 {
     if ($objPost->Id) {
         return $objPost->CountStewardshipPostLineItems();
     } else {
         return StewardshipContribution::CountByStewardshipBatchIdUnpostedFlag($this->objBatch->Id, true);
     }
 }
Esempio n. 2
0
 protected function Form_Create()
 {
     $objContribution = StewardshipContribution::Load(QApplication::PathInfo(0));
     if ($objContribution && is_file($objContribution->Path)) {
         if ($objContribution) {
             $this->imgCheckImage = new TiffImageControl($this);
             $this->imgCheckImage->ImagePath = $objContribution->Path;
             $this->imgCheckImage->Width = '1000';
         }
     }
 }
 protected function SetupPanel()
 {
     $this->objContribution = StewardshipContribution::Load($this->strUrlHashArgument);
     if (!$this->objContribution || $this->objContribution->StewardshipStackId != $this->objStack->Id || $this->objContribution->StewardshipBatchId != $this->objBatch->Id) {
         return $this->ReturnTo('#' . $this->objStack->StackNumber);
     }
     if (is_file($this->objContribution->Path)) {
         $this->imgCheckImage = new TiffImageControl($this);
         $this->imgCheckImage->ImagePath = $this->objContribution->Path;
         $this->imgCheckImage->Width = '390';
         $this->imgCheckImage->AddAction(new QClickEvent(), new QJavaScriptAction("OpenInNewWindow('" . $this->objContribution->ViewLargeUrl . "');"));
     }
 }
Esempio n. 4
0
 /**
  * Performs a Post of any balance on the batch.
  * @param Login $objLogin
  * @return StewardshipPost $objPost the actual post object if posted, or null if nothing was needed to be posted
  */
 public function PostBalance(Login $objLogin)
 {
     $objPost = null;
     $fltBalanceArray = $this->GetUnpostedBalanceByStewardshipFundId();
     if (count($fltBalanceArray) || StewardshipContribution::CountByStewardshipBatchIdUnpostedFlag($this->intId, true)) {
         $objLastPost = StewardshipPost::QuerySingle(QQ::Equal(QQN::StewardshipPost()->StewardshipBatchId, $this->intId), QQ::OrderBy(QQN::StewardshipPost()->PostNumber, false));
         if ($objLastPost) {
             $intPostNumber = $objLastPost->PostNumber + 1;
         } else {
             $intPostNumber = 1;
         }
         $objPost = new StewardshipPost();
         $objPost->StewardshipBatch = $this;
         $objPost->PostNumber = $intPostNumber;
         $objPost->DatePosted = QDateTime::Now();
         $objPost->CreatedByLoginId = $objLogin->Id;
         $objPost->Save();
         // It is possible (Due to status caching) that this can be called when there is actually nothing to post
         // If this happens, we'll want to delete the Post"
         $blnPosted = false;
         $fltTotalAmount = 0;
         foreach ($fltBalanceArray as $intFundId => $fltAmount) {
             $blnPosted = true;
             $objPostAmount = new StewardshipPostAmount();
             $objPostAmount->StewardshipPostId = $objPost->Id;
             $objPostAmount->StewardshipFundId = $intFundId;
             $objPostAmount->Amount = $fltAmount;
             $objPostAmount->Save();
             $fltTotalAmount += $fltAmount;
         }
         $objPost->TotalAmount = $fltTotalAmount;
         $objPost->Save();
         // Add the Line Items
         foreach (StewardshipContribution::LoadArrayByStewardshipBatchIdUnpostedFlag($this->intId, true) as $objContribution) {
             if ($objContribution->PostLineItems($objPost)) {
                 $blnPosted = true;
             }
         }
         // if NOTHING was physically posted, then delete the Post object.
         if (!$blnPosted) {
             $objPost->Delete();
             $objPost = null;
         }
     }
     $this->RefreshStatus();
     // Let's refresh the descriptions
     foreach ($this->GetStewardshipPostArray() as $objPostToRefresh) {
         foreach ($objPostToRefresh->GetStewardshipPostLineItemArray() as $objPostLineItem) {
             $objPostLineItem->RefreshDescription();
         }
     }
     return $objPost;
 }
            $objMonthlyTotal[$iMonth] += $objContributionAmt->Amount;
            if ($objContributionAmt->Amount > 1000) {
                $objOver1000[$iMonth]++;
            }
            if ($objContributionAmt->Amount > 10000) {
                $objOver10000[$iMonth]++;
            }
            $objMonthlyCount[$iMonth]++;
            // Calculate number of givers (as opposed to gifts)
            if (!in_array($objContribution->PersonId, $objGiverList)) {
                $objGiverList[] = $objContribution->PersonId;
            }
            if (!in_array($objContribution->PersonId, $objGiverCount[$iMonth])) {
                $objGiverCount[$iMonth][] = $objContribution->PersonId;
            }
            if (StewardshipContribution::CountByPersonId($objContribution->PersonId) <= 1) {
                $fltTotalAdditionalUniqueGivers++;
                $objUniqueGiver[$iMonth]++;
            }
        }
    }
}
$fltTotalGiftsOver1000 = array_sum($objOver1000);
$fltTotalGiftsOver10000 = array_sum($objOver10000);
$fltTotalAdditionalUniqueGivers = array_sum($objUniqueGiver);
if ($fltTotalGifts != 0) {
    $fltTotalAverageGiftSize = round($fltTotalGiftAmount / $fltTotalGifts, 2);
}
// Now fill in the Datagrid Array
for ($i = 0; $i < 12; $i++) {
    $strMonth = "";
Esempio n. 6
0
 public static function GetSoapObjectFromObject($objObject, $blnBindRelatedObjects)
 {
     if ($objObject->dttDateAuthorized) {
         $objObject->dttDateAuthorized = $objObject->dttDateAuthorized->__toString(QDateTime::FormatSoap);
     }
     if ($objObject->dttDateCaptured) {
         $objObject->dttDateCaptured = $objObject->dttDateCaptured->__toString(QDateTime::FormatSoap);
     }
     if ($objObject->objPaypalBatch) {
         $objObject->objPaypalBatch = PaypalBatch::GetSoapObjectFromObject($objObject->objPaypalBatch, false);
     } else {
         if (!$blnBindRelatedObjects) {
             $objObject->intPaypalBatchId = null;
         }
     }
     if ($objObject->objStewardshipContribution) {
         $objObject->objStewardshipContribution = StewardshipContribution::GetSoapObjectFromObject($objObject->objStewardshipContribution, false);
     } else {
         if (!$blnBindRelatedObjects) {
             $objObject->intStewardshipContributionId = null;
         }
     }
     return $objObject;
 }
 public static function GetSoapObjectFromObject($objObject, $blnBindRelatedObjects)
 {
     if ($objObject->objStewardshipContribution) {
         $objObject->objStewardshipContribution = StewardshipContribution::GetSoapObjectFromObject($objObject->objStewardshipContribution, false);
     } else {
         if (!$blnBindRelatedObjects) {
             $objObject->intStewardshipContributionId = null;
         }
     }
     if ($objObject->objStewardshipFund) {
         $objObject->objStewardshipFund = StewardshipFund::GetSoapObjectFromObject($objObject->objStewardshipFund, false);
     } else {
         if (!$blnBindRelatedObjects) {
             $objObject->intStewardshipFundId = null;
         }
     }
     return $objObject;
 }
 public static function GetSoapArrayFromArray($objArray)
 {
     if (!$objArray) {
         return null;
     }
     $objArrayToReturn = array();
     foreach ($objArray as $objObject) {
         array_push($objArrayToReturn, StewardshipContribution::GetSoapObjectFromObject($objObject, true));
     }
     return unserialize(serialize($objArrayToReturn));
 }
 protected function SetupPanel()
 {
     // /stewardship/batch.php/950#1/edit_contribution/UrlHash/UrlHash2/UrlHash3
     // 950 = BatchId
     // #1 = StackNumber
     // UrlHash can be "New" for new manual entry, an Id # for a ContributionId, or 0 for "Check" entyr
     // UrlHash2 must be the check hash (if applicable)
     // Urlhash3 is a PersonId to automagically select
     $this->blnScanFlag = false;
     // Creating New?
     if ($this->strUrlHashArgument == 'new') {
         // Creating New... Again?
         if ($this->strUrlHashArgument2 == 'again') {
             return $this->ReturnTo(sprintf('#%s/edit_contribution/new', $this->objStack->StackNumber));
         }
         $objContribution = new StewardshipContribution();
         $objContribution->StewardshipBatch = $this->objBatch;
         $objContribution->StewardshipStack = $this->objStack;
         $objContribution->DateEntered = QDateTime::Now();
         $objContribution->CreatedByLogin = QApplication::$Login;
         $objContribution->UnpostedFlag = true;
         $objContribution->DateCredited = new QDateTime($this->objBatch->DateCredited);
         $objContribution->StewardshipContributionTypeId = StewardshipContributionType::Cash;
         // Editing an existing
     } else {
         if ($this->strUrlHashArgument) {
             $objContribution = StewardshipContribution::Load($this->strUrlHashArgument);
             if (!$objContribution || $objContribution->StewardshipStackId != $this->objStack->Id || $objContribution->StewardshipBatchId != $this->objBatch->Id) {
                 $this->ReturnTo('#' . $this->objStack->StackNumber);
             }
             // Scanning?
         } else {
             if ($this->strUrlHashArgument2) {
                 $objContribution = StewardshipContribution::CreateFromCheckImage(QApplication::$Login, $this->objStack, $this->strUrlHashArgument2);
                 $this->blnScanFlag = true;
                 $this->imgCheckImage = new TiffImageControl($this);
                 $this->imgCheckImage->ImagePath = $objContribution->TempPath;
                 $this->imgCheckImage->Width = '390';
                 // Error -- go back
             } else {
                 $this->ReturnTo('#' . $this->objStack->StackNumber);
             }
         }
     }
     // Auto-set a new person (if specified)
     if ($objPerson = Person::Load($this->strUrlHashArgument3)) {
         $objContribution->Person = $objPerson;
     }
     // Setup Fields
     $this->mctContribution = new StewardshipContributionMetaControl($this, $objContribution);
     $this->chkNonDeductibleFlag = $this->mctContribution->chkNonDeductibleFlag_Create();
     $this->chkNonDeductibleFlag->Name = 'Non-Deductibile?';
     $this->chkNonDeductibleFlag->Text = 'Check if contribution is <strong>NOT</strong> deductible';
     $this->chkNonDeductibleFlag->HtmlEntities = false;
     if (!$this->blnScanFlag) {
         $this->lstStewardshipContributionType = $this->mctContribution->lstStewardshipContributionType_Create();
         $this->lstStewardshipContributionType->AddAction(new QChangeEvent(), new QAjaxControlAction($this, 'lstStewardshipContributionType_Change'));
         $this->txtAuthorization = $this->mctContribution->txtAuthorizationNumber_Create();
         $this->txtCheckNumber = $this->mctContribution->txtCheckNumber_Create();
         $this->txtCheckNumber->AddAction(new QEnterKeyEvent(), new QTerminateAction());
         $this->txtAlternateSource = $this->mctContribution->txtAlternateSource_Create();
         $this->lstStewardshipContributionType_Change();
     } else {
         // If we're scanning, then make sure we allow selecti onof Check or ReturnedCheck
         $this->lstStewardshipContributionType = $this->mctContribution->lstStewardshipContributionType_Create();
         $intIndex = 0;
         while ($intIndex < count($this->lstStewardshipContributionType->GetAllItems())) {
             $objListItem = $this->lstStewardshipContributionType->GetItem($intIndex);
             if ($objListItem->Value == StewardshipContributionType::Check || $objListItem->Value == StewardshipContributionType::ReturnedCheck) {
                 $intIndex++;
             } else {
                 $this->lstStewardshipContributionType->RemoveItem($intIndex);
             }
         }
         $this->txtCheckNumber = $this->mctContribution->txtCheckNumber_Create();
         $this->txtCheckNumber->AddAction(new QEnterKeyEvent(), new QTerminateAction());
         $this->txtCheckNumber->Select();
     }
     // Setup Total Amount
     $this->lblTotalAmount = new QLabel($this);
     $this->lblTotalAmount->HtmlEntities = false;
     // Setup Error Panels
     $this->pnlFundingError = new QPanel($this);
     $this->pnlFundingError->Visible = false;
     $this->pnlFundingError->CssClass = 'errorMessage';
     $this->pnlPersonError = new QPanel($this);
     $this->pnlPersonError->Visible = false;
     $this->pnlPersonError->CssClass = 'errorMessage';
     // Setup AmountArray
     $this->mctAmountArray = array();
     $objAmountArray = $this->mctContribution->StewardshipContribution->GetStewardshipContributionAmountArray(QQ::OrderBy(QQN::StewardshipContributionAmount()->Id));
     for ($i = 0; $i < 5; $i++) {
         if (array_key_exists($i, $objAmountArray)) {
             $objAmount = $objAmountArray[$i];
         } else {
             $objAmount = new StewardshipContributionAmount();
         }
         $mctAmount = new StewardshipContributionAmountMetaControl($this, $objAmount);
         $this->mctAmountArray[] = $mctAmount;
         if ($mctAmount->EditMode) {
             $lstFund = $mctAmount->lstStewardshipFund_Create(null, QQ::All(), QQ::OrderBy(QQN::StewardshipFund()->Name));
         } else {
             $lstFund = $mctAmount->lstStewardshipFund_Create(null, QQ::Equal(QQN::StewardshipFund()->ActiveFlag, true), QQ::OrderBy(QQN::StewardshipFund()->Name));
         }
         $lstFund->Required = false;
         $lstFund->ActionParameter = $i;
         $txtAmount = $mctAmount->txtAmount_Create();
         $txtAmount->ActionParameter = $i;
         $txtAmount->Text = sprintf('%.2f', $txtAmount->Text, 2);
         $lstFund->AddAction(new QChangeEvent(), new QAjaxControlAction($this, 'lstFund_Change'));
         $this->lstFund_Change(null, null, $i);
         $txtAmount->AddAction(new QChangeEvent(), new QAjaxControlAction($this, 'lblTotalAmount_Refresh'));
         $txtAmount->AddAction(new QEnterKeyEvent(), new QAjaxControlAction($this, 'txtAmount_Enter'));
         $txtAmount->AddAction(new QEnterKeyEvent(), new QTerminateAction());
         $this->lblTotalAmount_Refresh(null, null, null);
     }
     // Setup ChangePerson Dialog stuff
     $this->dlgChangePerson = new StewardshipSelectPersonDialogBox($this, null, $objContribution, $this, 'dlgChangePerson_Select');
     $this->btnChangePerson = new QButton($this);
     $this->btnChangePerson->Text = 'Change';
     $this->btnChangePerson->CssClass = 'primary';
     $this->btnChangePerson->AddAction(new QClickEvent(), new QAjaxControlAction($this, 'btnChangePerson_Click'));
     if ($this->blnScanFlag) {
         $this->ProcessNewCheck();
         $this->btnSaveAndScanAgain = new QButton($this);
         $this->btnSaveAndScanAgain->CausesValidation = true;
         $this->btnSaveAndScanAgain->Text = 'Save and Scan Next Check';
         $this->btnSaveAndScanAgain->CssClass = 'primary';
         $this->btnSaveAndScanAgain->AddAction(new QClickEvent(), new QAjaxControlAction($this, 'btnSave_Click'));
     } else {
         if (!$this->mctContribution->EditMode) {
             if (!$this->mctContribution->StewardshipContribution->Person) {
                 $this->btnChangePerson_Click(null, null, null);
                 $this->dlgChangePerson->dtgPeople->NoDataHtml = '<div class="section sectionBatchInfo"><strong>Search For Individual</strong><br/><br/>' . 'Use above fields to find the individual for this new entry.</div>';
             } else {
                 $this->mctAmountArray[0]->StewardshipFundIdControl->Focus();
             }
             $this->btnSaveAndScanAgain = new QButton($this);
             $this->btnSaveAndScanAgain->CausesValidation = true;
             $this->btnSaveAndScanAgain->Text = 'Save and Enter Next Entry';
             $this->btnSaveAndScanAgain->ActionParameter = 'new';
             $this->btnSaveAndScanAgain->CssClass = 'primary';
             $this->btnSaveAndScanAgain->AddAction(new QClickEvent(), new QAjaxControlAction($this, 'btnSave_Click'));
         }
     }
     if (!$this->mctContribution->EditMode) {
         $this->LoadSelectedFundsFromSession();
     } else {
         $this->btnSave->Text = 'Update';
     }
 }
Esempio n. 10
0
 public function PostBatch(Login $objLogin, QDateTime $dttDateCredited)
 {
     if ($this->blnReconciledFlag) {
         throw new QCallerException('Cannot post a PayPal Batch that has already been reconciled!');
     }
     // First, create the stewardship stacks into arrays of 100
     $objToBecomeStacksArray = array();
     $fltStackTotalsArray = array();
     $fltRunningTotal = 0;
     $objCurrentStack = array();
     foreach ($this->GetCreditCardPaymentArray(QQ::OrderBy(QQN::CreditCardPayment()->DateCaptured)) as $objCreditCardPayment) {
         if ($objCreditCardPayment->OnlineDonation || $objCreditCardPayment->SignupPayment && $objCreditCardPayment->SignupPayment->AmountDonation) {
             if (count($objCurrentStack) >= 100) {
                 $objToBecomeStacksArray[] = $objCurrentStack;
                 $fltStackTotalsArray[] = $fltRunningTotal;
                 $objCurrentStack = array();
                 $fltRunningTotal = 0;
             }
             $objCurrentStack[] = $objCreditCardPayment;
             if ($objCreditCardPayment->OnlineDonation) {
                 foreach ($objCreditCardPayment->OnlineDonation->GetOnlineDonationLineItemArray() as $objOnlineDonationLineItem) {
                     if ($objOnlineDonationLineItem->DonationFlag) {
                         $fltRunningTotal += $objOnlineDonationLineItem->Amount;
                     }
                 }
             } else {
                 $fltRunningTotal += $objCreditCardPayment->SignupPayment->AmountDonation;
             }
         }
     }
     if (count($objCurrentStack)) {
         $objToBecomeStacksArray[] = $objCurrentStack;
         $fltStackTotalsArray[] = $fltRunningTotal;
     }
     // Start a Transaction
     PaypalBatch::GetDatabase()->TransactionBegin();
     try {
         // Create the Batch
         $objBatch = StewardshipBatch::Create($objLogin, $fltStackTotalsArray, 'Stewardship Entries for PayPal Batch #' . $this->Number, QDateTime::Now(), $dttDateCredited);
         $objStackArray = $objBatch->GetStewardshipStackArray(QQ::OrderBy(QQN::StewardshipStack()->StackNumber));
         if (count($objStackArray) != count($objToBecomeStacksArray)) {
             throw new Exception('Mismatch of Created Stacks vs. Calculated Stacks');
         }
         // Create Each Stack
         for ($intStackIndex = 0; $intStackIndex < count($objStackArray); $intStackIndex++) {
             $objStack = $objStackArray[$intStackIndex];
             $objPaymentArray = $objToBecomeStacksArray[$intStackIndex];
             foreach ($objPaymentArray as $objPayment) {
                 // Create a StewardshipContribution for each OnlineDonation entry
                 if ($objPayment->OnlineDonation) {
                     // First ensure we have a Donation AmountArray
                     $objAmountArray = $objPayment->OnlineDonation->GetAmountArray();
                     if ($objAmountArray) {
                         $objContribution = StewardshipContribution::Create($objLogin, $objPayment->OnlineDonation->Person, $objStack, StewardshipContributionType::CreditCard, $objPayment->TransactionCode, $objAmountArray, null, null, null, null, true);
                     } else {
                         $objContribution = null;
                     }
                     // Create a StewardshipContribution for the donation in a SignupPayment
                 } else {
                     $objContribution = StewardshipContribution::Create($objLogin, $objPayment->SignupPayment->SignupEntry->SignupByPerson, $objStack, StewardshipContributionType::CreditCard, $objPayment->TransactionCode, array(array($objPayment->SignupPayment->DonationStewardshipFundId, $objPayment->SignupPayment->AmountDonation)), null, null, null, null, true);
                 }
                 // Proceed if a Contribution was successfully created
                 if ($objContribution) {
                     // Fixup on the Contribution Object
                     $objContribution->AlternateSource = $objPayment->CreditCardDescription;
                     $objContribution->DateCredited = $dttDateCredited;
                     $objContribution->Save();
                     // Fixup on the CCPayment Object to link back to the contribution object
                     $objPayment->StewardshipContribution = $objContribution;
                     $objPayment->Save();
                 }
             }
         }
         // Cleanup each Payment object
         foreach ($this->GetCreditCardPaymentArray() as $objCreditCardPayment) {
             $objCreditCardPayment->CreditCardStatusTypeId = CreditCardStatusType::Reconciled;
             $objCreditCardPayment->Save();
         }
         // Cleanup this object
         $this->blnReconciledFlag = true;
         $this->dttDateReconciled = QDateTime::Now();
         $this->StewardshipBatch = $objBatch;
         $this->Save();
         // Finally, Post the StewardshipBatch
         $objBatch->PostBalance($objLogin);
         // If we are here, then it was a success!  Commit the Transaction!
         PaypalBatch::GetDatabase()->TransactionCommit();
     } catch (Exception $objExc) {
         PaypalBatch::GetDatabase()->TransactionRollBack();
         throw $objExc;
     }
 }
 /**
  * Static Helper Method to Create using PK arguments
  * You must pass in the PK arguments on an object to load, or leave it blank to create a new one.
  * If you want to load via QueryString or PathInfo, use the CreateFromQueryString or CreateFromPathInfo
  * static helper methods.  Finally, specify a CreateType to define whether or not we are only allowed to 
  * edit, or if we are also allowed to create a new one, etc.
  * 
  * @param mixed $objParentObject QForm or QPanel which will be using this StewardshipContributionMetaControl
  * @param integer $intId primary key value
  * @param QMetaControlCreateType $intCreateType rules governing StewardshipContribution object creation - defaults to CreateOrEdit
  * @return StewardshipContributionMetaControl
  */
 public static function Create($objParentObject, $intId = null, $intCreateType = QMetaControlCreateType::CreateOrEdit)
 {
     // Attempt to Load from PK Arguments
     if (strlen($intId)) {
         $objStewardshipContribution = StewardshipContribution::Load($intId);
         // StewardshipContribution was found -- return it!
         if ($objStewardshipContribution) {
             return new StewardshipContributionMetaControl($objParentObject, $objStewardshipContribution);
         } else {
             if ($intCreateType != QMetaControlCreateType::CreateOnRecordNotFound) {
                 throw new QCallerException('Could not find a StewardshipContribution object with PK arguments: ' . $intId);
             }
         }
         // If EditOnly is specified, throw an exception
     } else {
         if ($intCreateType == QMetaControlCreateType::EditOnly) {
             throw new QCallerException('No PK arguments specified');
         }
     }
     // If we are here, then we need to create a new record
     return new StewardshipContributionMetaControl($objParentObject, new StewardshipContribution());
 }
Esempio n. 12
0
    /**
     * Deletes all associated StewardshipContributions
     * @return void
     */
    public function DeleteAllStewardshipContributions()
    {
        if (is_null($this->intId)) {
            throw new QUndefinedPrimaryKeyException('Unable to call UnassociateStewardshipContribution on this unsaved Person.');
        }
        // Get the Database Object for this Class
        $objDatabase = Person::GetDatabase();
        // Journaling
        if ($objDatabase->JournalingDatabase) {
            foreach (StewardshipContribution::LoadArrayByPersonId($this->intId) as $objStewardshipContribution) {
                $objStewardshipContribution->Journal('DELETE');
            }
        }
        // Perform the SQL Query
        $objDatabase->NonQuery('
				DELETE FROM
					`stewardship_contribution`
				WHERE
					`person_id` = ' . $objDatabase->SqlVariable($this->intId) . '
			');
    }
Esempio n. 13
0
File: batch.php Progetto: alcf/chms
 public function pxyDeleteContribution_Click($strFormId, $strControlId, $strParameter)
 {
     $objContribution = StewardshipContribution::Load($strParameter);
     if (!$objContribution || $objContribution->StewardshipStackId != $this->objStack->Id || $objContribution->StewardshipBatchId != $this->objBatch->Id) {
         return;
     }
     $objContribution->DeleteAllStewardshipContributionAmounts();
     $objContribution->Delete();
     $this->objStack->RefreshActualTotalAmount();
     $this->objBatch->RefreshActualTotalAmount(false);
     $this->objBatch->RefreshStatus();
     $this->pnlStack_Refresh($this->objStack);
     $this->pnlBatchTitle->Refresh();
     $this->dtgContributions->Refresh();
     QApplication::ExecuteJavaScript(sprintf('document.location="#%s";', $this->objStack->StackNumber));
 }
Esempio n. 14
0
                $fltAmount = StewardshipContribution::GetContributionAmountTotalForContributionAmountArray($objContributionAmountArray);
                if ($objParticipation->Person->DeceasedFlag) {
                    StewardshipContribution::GenerateReceiptInPdf($objDeceasedPdf, $objParticipation->Person, $intYear, $blnAnnual, $intQuarter);
                } else {
                    if ($fltAmount > $fltMinimumAmount) {
                        if ($intEntryCount > 38) {
                            StewardshipContribution::GenerateReceiptInPdf($objMultiplePagePdf, $objParticipation->Person, $intYear, $blnAnnual, $intQuarter);
                        } else {
                            if ($intEntryCount) {
                                StewardshipContribution::GenerateReceiptInPdf($objSinglePagePdf, $objParticipation->Person, $intYear, $blnAnnual, $intQuarter);
                            }
                        }
                    }
                }
            } else {
                StewardshipContribution::GenerateReceiptInPdf($objInvalidAddressPdf, $objParticipation->Person, $intYear, $blnAnnual, $intQuarter);
            }
        }
    }
    // Separate into New File?
    if (count($objSinglePagePdf->pages) > 500) {
        $objSinglePagePdf->save(RECEIPT_PDF_PATH . '/ReceiptsFor' . $intYear . $strFileToken . '_Single_' . $intSingplePageCount . '.pdf');
        chmod(RECEIPT_PDF_PATH . '/ReceiptsFor' . $intYear . $strFileToken . '_Single_' . $intSingplePageCount . '.pdf', 0777);
        $objSinglePagePdf = new Zend_Pdf();
        $intSingplePageCount++;
    }
}
QDataGen::DisplayForEachTaskEnd('Generating Receipt for Household');
$objSinglePagePdf->save(RECEIPT_PDF_PATH . '/ReceiptsFor' . $intYear . $strFileToken . '_Single_' . $intSingplePageCount . '.pdf');
chmod(RECEIPT_PDF_PATH . '/ReceiptsFor' . $intYear . $strFileToken . '_Single_' . $intSingplePageCount . '.pdf', 0777);
$objMultiplePagePdf->save(RECEIPT_PDF_PATH . '/ReceiptsFor' . $intYear . $strFileToken . '_Multiple.pdf');
Esempio n. 15
0
File: index.php Progetto: alcf/chms
 public function RenderAmount(StewardshipContribution $objStewardshipContribution)
 {
     if ($this->dtgContributions->CurrentRowIndex == 0) {
         $this->fltTotal = 0;
     }
     if (!$objStewardshipContribution->Id) {
         return QApplication::DisplayCurrency($this->fltTotal);
     }
     // We need to look at a specific fund?
     if ($this->lstFund->SelectedValue) {
         $fltAmount = 0;
         foreach ($objStewardshipContribution->GetStewardshipContributionAmountArray() as $objAmount) {
             if ($objAmount->StewardshipFundId == $this->lstFund->SelectedValue && $objAmount->StewardshipContributionId == $objStewardshipContribution->Id) {
                 $fltAmount = $objAmount->Amount;
                 // Don't display the total. Just the specific ID amount
             }
         }
     } else {
         $fltAmount = $objStewardshipContribution->TotalAmount;
     }
     $this->fltTotal += $fltAmount;
     return sprintf('<a href="/stewardship/batch.php/%s#%s/view_contribution/%s">%s</a>', $objStewardshipContribution->StewardshipBatchId, $objStewardshipContribution->StewardshipStack->StackNumber, $objStewardshipContribution->Id, $this->FormatNumber($fltAmount));
 }
Esempio n. 16
0
 public static function LoadArrayByDateRange($dttAfter, $dttBefore, $objOptionalClauses = null)
 {
     // This will return an array of StewardshipContribution objects
     return StewardshipContribution::QueryArray(QQ::AndCondition(QQ::GreaterOrEqual(QQN::StewardshipContribution()->DateCredited, $dttAfter), QQ::LessOrEqual(QQN::StewardshipContribution()->DateCredited, $dttBefore)), $objOptionalClauses);
 }
 /**
  * Refresh this MetaControl with Data from the local CreditCardPayment object.
  * @param boolean $blnReload reload CreditCardPayment from the database
  * @return void
  */
 public function Refresh($blnReload = false)
 {
     if ($blnReload) {
         $this->objCreditCardPayment->Reload();
     }
     if ($this->lblId) {
         if ($this->blnEditMode) {
             $this->lblId->Text = $this->objCreditCardPayment->Id;
         }
     }
     if ($this->lstCreditCardStatusType) {
         $this->lstCreditCardStatusType->SelectedValue = $this->objCreditCardPayment->CreditCardStatusTypeId;
     }
     if ($this->lblCreditCardStatusTypeId) {
         $this->lblCreditCardStatusTypeId->Text = $this->objCreditCardPayment->CreditCardStatusTypeId ? CreditCardStatusType::$NameArray[$this->objCreditCardPayment->CreditCardStatusTypeId] : null;
     }
     if ($this->lstCreditCardType) {
         $this->lstCreditCardType->SelectedValue = $this->objCreditCardPayment->CreditCardTypeId;
     }
     if ($this->lblCreditCardTypeId) {
         $this->lblCreditCardTypeId->Text = $this->objCreditCardPayment->CreditCardTypeId ? CreditCardType::$NameArray[$this->objCreditCardPayment->CreditCardTypeId] : null;
     }
     if ($this->txtCreditCardLastFour) {
         $this->txtCreditCardLastFour->Text = $this->objCreditCardPayment->CreditCardLastFour;
     }
     if ($this->lblCreditCardLastFour) {
         $this->lblCreditCardLastFour->Text = $this->objCreditCardPayment->CreditCardLastFour;
     }
     if ($this->txtTransactionCode) {
         $this->txtTransactionCode->Text = $this->objCreditCardPayment->TransactionCode;
     }
     if ($this->lblTransactionCode) {
         $this->lblTransactionCode->Text = $this->objCreditCardPayment->TransactionCode;
     }
     if ($this->txtAuthorizationCode) {
         $this->txtAuthorizationCode->Text = $this->objCreditCardPayment->AuthorizationCode;
     }
     if ($this->lblAuthorizationCode) {
         $this->lblAuthorizationCode->Text = $this->objCreditCardPayment->AuthorizationCode;
     }
     if ($this->txtAddressMatchCode) {
         $this->txtAddressMatchCode->Text = $this->objCreditCardPayment->AddressMatchCode;
     }
     if ($this->lblAddressMatchCode) {
         $this->lblAddressMatchCode->Text = $this->objCreditCardPayment->AddressMatchCode;
     }
     if ($this->calDateAuthorized) {
         $this->calDateAuthorized->DateTime = $this->objCreditCardPayment->DateAuthorized;
     }
     if ($this->lblDateAuthorized) {
         $this->lblDateAuthorized->Text = sprintf($this->objCreditCardPayment->DateAuthorized) ? $this->objCreditCardPayment->__toString($this->strDateAuthorizedDateTimeFormat) : null;
     }
     if ($this->calDateCaptured) {
         $this->calDateCaptured->DateTime = $this->objCreditCardPayment->DateCaptured;
     }
     if ($this->lblDateCaptured) {
         $this->lblDateCaptured->Text = sprintf($this->objCreditCardPayment->DateCaptured) ? $this->objCreditCardPayment->__toString($this->strDateCapturedDateTimeFormat) : null;
     }
     if ($this->txtAmountCharged) {
         $this->txtAmountCharged->Text = $this->objCreditCardPayment->AmountCharged;
     }
     if ($this->lblAmountCharged) {
         $this->lblAmountCharged->Text = $this->objCreditCardPayment->AmountCharged;
     }
     if ($this->txtAmountFee) {
         $this->txtAmountFee->Text = $this->objCreditCardPayment->AmountFee;
     }
     if ($this->lblAmountFee) {
         $this->lblAmountFee->Text = $this->objCreditCardPayment->AmountFee;
     }
     if ($this->txtAmountCleared) {
         $this->txtAmountCleared->Text = $this->objCreditCardPayment->AmountCleared;
     }
     if ($this->lblAmountCleared) {
         $this->lblAmountCleared->Text = $this->objCreditCardPayment->AmountCleared;
     }
     if ($this->lstPaypalBatch) {
         $this->lstPaypalBatch->RemoveAllItems();
         $this->lstPaypalBatch->AddItem(QApplication::Translate('- Select One -'), null);
         $objPaypalBatchArray = PaypalBatch::LoadAll();
         if ($objPaypalBatchArray) {
             foreach ($objPaypalBatchArray as $objPaypalBatch) {
                 $objListItem = new QListItem($objPaypalBatch->__toString(), $objPaypalBatch->Id);
                 if ($this->objCreditCardPayment->PaypalBatch && $this->objCreditCardPayment->PaypalBatch->Id == $objPaypalBatch->Id) {
                     $objListItem->Selected = true;
                 }
                 $this->lstPaypalBatch->AddItem($objListItem);
             }
         }
     }
     if ($this->lblPaypalBatchId) {
         $this->lblPaypalBatchId->Text = $this->objCreditCardPayment->PaypalBatch ? $this->objCreditCardPayment->PaypalBatch->__toString() : null;
     }
     if ($this->chkUnlinkedFlag) {
         $this->chkUnlinkedFlag->Checked = $this->objCreditCardPayment->UnlinkedFlag;
     }
     if ($this->lblUnlinkedFlag) {
         $this->lblUnlinkedFlag->Text = $this->objCreditCardPayment->UnlinkedFlag ? QApplication::Translate('Yes') : QApplication::Translate('No');
     }
     if ($this->lstStewardshipContribution) {
         $this->lstStewardshipContribution->RemoveAllItems();
         $this->lstStewardshipContribution->AddItem(QApplication::Translate('- Select One -'), null);
         $objStewardshipContributionArray = StewardshipContribution::LoadAll();
         if ($objStewardshipContributionArray) {
             foreach ($objStewardshipContributionArray as $objStewardshipContribution) {
                 $objListItem = new QListItem($objStewardshipContribution->__toString(), $objStewardshipContribution->Id);
                 if ($this->objCreditCardPayment->StewardshipContribution && $this->objCreditCardPayment->StewardshipContribution->Id == $objStewardshipContribution->Id) {
                     $objListItem->Selected = true;
                 }
                 $this->lstStewardshipContribution->AddItem($objListItem);
             }
         }
     }
     if ($this->lblStewardshipContributionId) {
         $this->lblStewardshipContributionId->Text = $this->objCreditCardPayment->StewardshipContribution ? $this->objCreditCardPayment->StewardshipContribution->__toString() : null;
     }
     if ($this->lstOnlineDonation) {
         $this->lstOnlineDonation->RemoveAllItems();
         $this->lstOnlineDonation->AddItem(QApplication::Translate('- Select One -'), null);
         $objOnlineDonationArray = OnlineDonation::LoadAll();
         if ($objOnlineDonationArray) {
             foreach ($objOnlineDonationArray as $objOnlineDonation) {
                 $objListItem = new QListItem($objOnlineDonation->__toString(), $objOnlineDonation->Id);
                 if ($objOnlineDonation->CreditCardPaymentId == $this->objCreditCardPayment->Id) {
                     $objListItem->Selected = true;
                 }
                 $this->lstOnlineDonation->AddItem($objListItem);
             }
         }
     }
     if ($this->lblOnlineDonation) {
         $this->lblOnlineDonation->Text = $this->objCreditCardPayment->OnlineDonation ? $this->objCreditCardPayment->OnlineDonation->__toString() : null;
     }
     if ($this->lstSignupPayment) {
         $this->lstSignupPayment->RemoveAllItems();
         $this->lstSignupPayment->AddItem(QApplication::Translate('- Select One -'), null);
         $objSignupPaymentArray = SignupPayment::LoadAll();
         if ($objSignupPaymentArray) {
             foreach ($objSignupPaymentArray as $objSignupPayment) {
                 $objListItem = new QListItem($objSignupPayment->__toString(), $objSignupPayment->Id);
                 if ($objSignupPayment->CreditCardPaymentId == $this->objCreditCardPayment->Id) {
                     $objListItem->Selected = true;
                 }
                 $this->lstSignupPayment->AddItem($objListItem);
             }
         }
     }
     if ($this->lblSignupPayment) {
         $this->lblSignupPayment->Text = $this->objCreditCardPayment->SignupPayment ? $this->objCreditCardPayment->SignupPayment->__toString() : null;
     }
 }
Esempio n. 18
0
 /**
  * This will move all the transactions for a given year to be credited to another person
  * @param integer $intYear
  * @param Person $objPerson
  */
 public function MoveStewardshipTransactions($intYear, Person $objPerson)
 {
     StewardshipContribution::GetDatabase()->TransactionBegin();
     $objArray = StewardshipContribution::QueryArray(QQ::AndCondition(QQ::Equal(QQN::StewardshipContribution()->PersonId, $this->intId), QQ::GreaterOrEqual(QQN::StewardshipContribution()->DateCredited, new QDateTime($intYear . '-01-01')), QQ::LessThan(QQN::StewardshipContribution()->DateCredited, new QDateTime($intYear + 1 . '-01-01'))));
     foreach ($objArray as $objContribution) {
         $objContribution->Person = $objPerson;
         $objContribution->Save();
         foreach ($objContribution->GetStewardshipPostLineItemArray() as $objLineItem) {
             $objLineItem->Person = $objPerson;
             $objLineItem->Save();
         }
     }
     StewardshipContribution::GetDatabase()->TransactionCommit();
 }
Esempio n. 19
0
    }
    if (count($objMarriedPersonArray) == 2) {
        $objMarriedPersonArray[0]->DeleteAllMarriages();
        $objMarriedPersonArray[1]->DeleteAllMarriages();
        $objMarriedPersonArray[0]->CreateMarriageWith($objMarriedPersonArray[1]);
    } else {
        if (count($objMarriedPersonArray)) {
            print "\r\nWhat!?  Household " . $objHousehold->Id . " has a marriage count of " . count($objMarriedPersonArray) . "!\r\n";
        }
    }
    $objHousehold->Save();
}
QDataGen::DisplayForEachTaskEnd('Refreshing Household data');
$objStewardshipCursor = StewardshipContribution::QueryCursor(QQ::All());
QDataGEn::DisplayForEachTaskStart('Refreshing Contributions', StewardshipContribution::CountAll());
while ($objContribution = StewardshipContribution::InstantiateCursor($objStewardshipCursor)) {
    QDataGen::DisplayForEachTaskNext('Refreshing Contributions');
    $objContribution->RefreshTotalAmount();
}
QDataGen::DisplayForEachTaskEnd('Refreshing Contributions');
$objStewardshipCursor = StewardshipStack::QueryCursor(QQ::All());
QDataGEn::DisplayForEachTaskStart('Refreshing Stacks', StewardshipStack::CountAll());
while ($objStack = StewardshipStack::InstantiateCursor($objStewardshipCursor)) {
    QDataGen::DisplayForEachTaskNext('Refreshing Stacks');
    $objStack->RefreshActualTotalAmount();
}
QDataGen::DisplayForEachTaskEnd('Refreshing Stacks');
$objStewardshipCursor = StewardshipBatch::QueryCursor(QQ::All());
QDataGEn::DisplayForEachTaskStart('Refreshing Batches', StewardshipBatch::CountAll());
while ($objBatch = StewardshipBatch::InstantiateCursor($objStewardshipCursor)) {
    QDataGen::DisplayForEachTaskNext('Refreshing Batches');
Esempio n. 20
0
 public static function GenerateStewardship()
 {
     $dttDate = new QDateTime('2004-01-05');
     print 'Generating Stewardship... ';
     $objFundArray = StewardshipFund::QueryArray(QQ::NotEqual(QQN::StewardshipFund()->Id, 1));
     while ($dttDate->IsEarlierThan(QDateTime::Now())) {
         print $strDate = '[' . $dttDate->ToString('YYYY-MMM-DD') . ']';
         $intCheckCount = rand(10, 55);
         $arrStack = array();
         for ($i = 0; $i < floor(($intCheckCount - 1) / 25) + 1; $i++) {
             $arrStack[] = null;
         }
         $objBatch = StewardshipBatch::Create(self::GenerateFromArray(self::$StewardshipUserArray), $arrStack, self::GenerateFromArray(array('Weekend T/O', 'Weekend Giving', 'Tithes and Offerings', 'Tithes & Offerings', null)), $dttDate, $dttDate);
         $intStackCount = $objBatch->CountStewardshipStacks();
         $dttStart = new QDateTime($dttDate);
         $dttStart->SetTime(8, 0, 0);
         $dttEnd = new QDateTime($dttDate);
         $dttEnd->SetTime(16, 0, 0);
         for ($i = 0; $i < $intStackCount; $i++) {
             if ($i == $intStackCount - 1) {
                 if ($intCheckCount % 25 == 0) {
                     $intChecksInStackCount = 25;
                 } else {
                     $intChecksInStackCount = $intCheckCount % 25;
                 }
             } else {
                 $intChecksInStackCount = 25;
             }
             $objStack = StewardshipStack::LoadByStewardshipBatchIdStackNumber($objBatch->Id, $i + 1);
             for ($j = 0; $j < $intChecksInStackCount; $j++) {
                 $objHousehold = self::GenerateFromArray(self::$HouseholdArray);
                 $objHouseholdParticipant = self::GenerateFromArray($objHousehold->GetHouseholdParticipationArray());
                 $mixAmountArray = array();
                 if (rand(0, 50)) {
                     $mixAmountArray[] = array(1, rand(1000, 150000) / 100);
                 } else {
                     $mixAmountArray[] = array(self::GenerateFromArray($objFundArray)->Id, rand(1000, 150000) / 100);
                 }
                 if (!rand(0, 20)) {
                     $mixAmountArray[] = array(self::GenerateFromArray($objFundArray)->Id, rand(1000, 150000) / 100);
                 }
                 $objContribution = StewardshipContribution::Create($objBatch->CreatedByLogin, $objHouseholdParticipant->Person, $objStack, StewardshipContributionType::Check, rand(1000, 9999), $mixAmountArray, self::GenerateDateTime($dttStart, $dttEnd), null, null, null, false);
                 if (rand(0, 5)) {
                     $objContribution->SaveImageFile(__DEVTOOLS_CLI__ . '/datagen_file_assets/check.tif');
                 }
             }
             $objStack->RefreshActualTotalAmount();
         }
         if ($intCheckCount != $objBatch->CountStewardshipContributions()) {
             print "\r\n" . 'MISCOUNT: ' . $objBatch->Id . "\r\n";
         }
         $objBatch->RefreshActualTotalAmount();
         $dttDate->Day += 7;
         print str_repeat(chr(8) . ' ' . chr(8), strlen($strDate));
     }
     print "Done.\r\n";
 }
 /**
  * Refresh this MetaControl with Data from the local StewardshipPostLineItem object.
  * @param boolean $blnReload reload StewardshipPostLineItem from the database
  * @return void
  */
 public function Refresh($blnReload = false)
 {
     if ($blnReload) {
         $this->objStewardshipPostLineItem->Reload();
     }
     if ($this->lblId) {
         if ($this->blnEditMode) {
             $this->lblId->Text = $this->objStewardshipPostLineItem->Id;
         }
     }
     if ($this->lstStewardshipPost) {
         $this->lstStewardshipPost->RemoveAllItems();
         if (!$this->blnEditMode) {
             $this->lstStewardshipPost->AddItem(QApplication::Translate('- Select One -'), null);
         }
         $objStewardshipPostArray = StewardshipPost::LoadAll();
         if ($objStewardshipPostArray) {
             foreach ($objStewardshipPostArray as $objStewardshipPost) {
                 $objListItem = new QListItem($objStewardshipPost->__toString(), $objStewardshipPost->Id);
                 if ($this->objStewardshipPostLineItem->StewardshipPost && $this->objStewardshipPostLineItem->StewardshipPost->Id == $objStewardshipPost->Id) {
                     $objListItem->Selected = true;
                 }
                 $this->lstStewardshipPost->AddItem($objListItem);
             }
         }
     }
     if ($this->lblStewardshipPostId) {
         $this->lblStewardshipPostId->Text = $this->objStewardshipPostLineItem->StewardshipPost ? $this->objStewardshipPostLineItem->StewardshipPost->__toString() : null;
     }
     if ($this->lstStewardshipContribution) {
         $this->lstStewardshipContribution->RemoveAllItems();
         if (!$this->blnEditMode) {
             $this->lstStewardshipContribution->AddItem(QApplication::Translate('- Select One -'), null);
         }
         $objStewardshipContributionArray = StewardshipContribution::LoadAll();
         if ($objStewardshipContributionArray) {
             foreach ($objStewardshipContributionArray as $objStewardshipContribution) {
                 $objListItem = new QListItem($objStewardshipContribution->__toString(), $objStewardshipContribution->Id);
                 if ($this->objStewardshipPostLineItem->StewardshipContribution && $this->objStewardshipPostLineItem->StewardshipContribution->Id == $objStewardshipContribution->Id) {
                     $objListItem->Selected = true;
                 }
                 $this->lstStewardshipContribution->AddItem($objListItem);
             }
         }
     }
     if ($this->lblStewardshipContributionId) {
         $this->lblStewardshipContributionId->Text = $this->objStewardshipPostLineItem->StewardshipContribution ? $this->objStewardshipPostLineItem->StewardshipContribution->__toString() : null;
     }
     if ($this->lstPerson) {
         $this->lstPerson->RemoveAllItems();
         if (!$this->blnEditMode) {
             $this->lstPerson->AddItem(QApplication::Translate('- Select One -'), null);
         }
         $objPersonArray = Person::LoadAll();
         if ($objPersonArray) {
             foreach ($objPersonArray as $objPerson) {
                 $objListItem = new QListItem($objPerson->__toString(), $objPerson->Id);
                 if ($this->objStewardshipPostLineItem->Person && $this->objStewardshipPostLineItem->Person->Id == $objPerson->Id) {
                     $objListItem->Selected = true;
                 }
                 $this->lstPerson->AddItem($objListItem);
             }
         }
     }
     if ($this->lblPersonId) {
         $this->lblPersonId->Text = $this->objStewardshipPostLineItem->Person ? $this->objStewardshipPostLineItem->Person->__toString() : null;
     }
     if ($this->lstStewardshipFund) {
         $this->lstStewardshipFund->RemoveAllItems();
         if (!$this->blnEditMode) {
             $this->lstStewardshipFund->AddItem(QApplication::Translate('- Select One -'), null);
         }
         $objStewardshipFundArray = StewardshipFund::LoadAll();
         if ($objStewardshipFundArray) {
             foreach ($objStewardshipFundArray as $objStewardshipFund) {
                 $objListItem = new QListItem($objStewardshipFund->__toString(), $objStewardshipFund->Id);
                 if ($this->objStewardshipPostLineItem->StewardshipFund && $this->objStewardshipPostLineItem->StewardshipFund->Id == $objStewardshipFund->Id) {
                     $objListItem->Selected = true;
                 }
                 $this->lstStewardshipFund->AddItem($objListItem);
             }
         }
     }
     if ($this->lblStewardshipFundId) {
         $this->lblStewardshipFundId->Text = $this->objStewardshipPostLineItem->StewardshipFund ? $this->objStewardshipPostLineItem->StewardshipFund->__toString() : null;
     }
     if ($this->txtDescription) {
         $this->txtDescription->Text = $this->objStewardshipPostLineItem->Description;
     }
     if ($this->lblDescription) {
         $this->lblDescription->Text = $this->objStewardshipPostLineItem->Description;
     }
     if ($this->txtAmount) {
         $this->txtAmount->Text = $this->objStewardshipPostLineItem->Amount;
     }
     if ($this->lblAmount) {
         $this->lblAmount->Text = $this->objStewardshipPostLineItem->Amount;
     }
 }
 public function pxyViewCheckImage_Click($strFormId, $strControlId, $strParameter)
 {
     if (($objContribution = StewardshipContribution::Load($strParameter)) && is_file($objContribution->Path)) {
         $this->imgHistoricCheckImage->ImagePath = $objContribution->Path;
         $this->imgHistoricCheckImage->Height = null;
         $this->imgHistoricCheckImage->AddAction(new QClickEvent(), new QJavaScriptAction("OpenInNewWindow('" . $objContribution->ViewLargeUrl . "');"));
     } else {
         $this->imgHistoricCheckImage->ImagePath = __DOCROOT__ . __IMAGE_ASSETS__ . '/no_check_image.tiff';
         $this->imgHistoricCheckImage->Height = '100';
         $this->imgHistoricCheckImage->RemoveAllActions(QClickEvent::EventName);
     }
 }
Esempio n. 23
0
// Otherwise, if no HouseholdId (e.g. "0"), then it is just a individual statement
$objPerson = Person::Load(QApplication::PathInfo(0));
$objObject = $objPerson;
if (QApplication::PathInfo(1)) {
    $objHousehold = Household::Load(QApplication::PathInfo(1));
    if (!$objHousehold) {
        QApplication::Redirect('/main/');
    }
    if (!HouseholdParticipation::LoadByPersonIdHouseholdId($objPerson->Id, $objHousehold->Id)) {
        QApplication::Redirect('/main/');
    }
    $objObject = $objHousehold;
}
if (!(QApplication::PathInfo(2) >= 1950 && QApplication::PathInfo(2) <= 2500)) {
    QApplication::Redirect('/main/');
}
// Create the PDF Object
$objPdf = new Zend_Pdf();
StewardshipContribution::GenerateReceiptInPdf($objPdf, $objObject, QApplication::PathInfo(2), true);
// Get PDF document as a string
$strData = $objPdf->render();
// Disable strict no-cache for IE due to IE issues with downloading no-cache items
if (QApplication::IsBrowser(QBrowserType::InternetExplorer)) {
    header("Pragma:");
    header("Expires:");
}
if (QApplication::PathInfo(3)) {
    header('Content-Disposition: attachment; filename=' . QApplication::PathInfo(3));
}
header('Content-type: application/x-pdf');
echo $strData;
Esempio n. 24
0
                        if ($objSpouse->DeceasedFlag) {
                            $objSpouse = null;
                        }
                        fwrite($objFile, EscapeCsv($objSpouse ? $objHousehold->HeadPerson->FirstName . ' and ' . $objSpouse->FirstName : $objHousehold->HeadPerson->FirstName) . ',' . EscapeCsv($objHousehold->StewardshipHouseholdName) . ',' . EscapeCsv($objAddress->Address3) . ',' . EscapeCsv($objAddress->Address1) . ',' . EscapeCsv($objAddress->Address2) . ',' . EscapeCsv($objAddress->City) . ',' . EscapeCsv($objAddress->State) . ',' . EscapeCsv($objAddress->ZipCode) . "\r\n");
                    }
                } else {
                    if ($objHousehold->HeadPerson->CanMailFlag && !$objHousehold->HeadPerson->DeceasedFlag) {
                        fwrite($objFile, EscapeCsv($objHousehold->HeadPerson->FirstName) . ',' . EscapeCsv($objHousehold->StewardshipHouseholdName) . ',' . EscapeCsv($objAddress->Address3) . ',' . EscapeCsv($objAddress->Address1) . ',' . EscapeCsv($objAddress->Address2) . ',' . EscapeCsv($objAddress->City) . ',' . EscapeCsv($objAddress->State) . ',' . EscapeCsv($objAddress->ZipCode) . "\r\n");
                    }
                }
            }
        }
        // Generate for each individual in the household
    } else {
        foreach ($objHousehold->GetHouseholdParticipationArray() as $objParticipation) {
            if ($objAddress = $objParticipation->Person->GetStewardshipAddress()) {
                $intPersonIdArray = array($objParticipation->Person->Id);
                $objContributionAmountArray = StewardshipContribution::GetContributionAmountArrayForPersonArray($intPersonIdArray, $intYear);
                $fltAmount = StewardshipContribution::GetContributionAmountTotalForContributionAmountArray($objContributionAmountArray, false);
                if ($fltAmount > $fltMinimumAmount) {
                    $objPerson = $objParticipation->Person;
                    if ($objPerson->CanMailFlag && !$objPerson->DeceasedFlag) {
                        fwrite($objFile, EscapeCsv($objPerson->FirstName) . ',' . EscapeCsv($objPerson->ActiveMailingLabel) . ',' . EscapeCsv($objAddress->Address3) . ',' . EscapeCsv($objAddress->Address1) . ',' . EscapeCsv($objAddress->Address2) . ',' . EscapeCsv($objAddress->City) . ',' . EscapeCsv($objAddress->State) . ',' . EscapeCsv($objAddress->ZipCode) . "\r\n");
                    }
                }
            }
        }
    }
}
fclose($objFile);
QDataGen::DisplayForEachTaskEnd('Generating CSV Row(s) for Household');
 /**
  * Main utility method to aid with data binding.  It is used by the default BindAllRows() databinder but
  * could and should be used by any custom databind methods that would be used for instances of this
  * MetaDataGrid, by simply passing in a custom QQCondition and/or QQClause. 
  *
  * If a paginator is set on this DataBinder, it will use it.  If not, then no pagination will be used.
  * It will also perform any sorting (if applicable).
  *
  * @param QQCondition $objConditions override the default condition of QQ::All() to the query, itself
  * @param QQClause[] $objOptionalClauses additional optional QQClause object or array of QQClause objects for the query		 
  * @return void
  */
 public function MetaDataBinder(QQCondition $objCondition = null, $objOptionalClauses = null)
 {
     // Setup input parameters to default values if none passed in
     if (!$objCondition) {
         $objCondition = QQ::All();
     }
     $objClauses = $objOptionalClauses ? $objOptionalClauses : array();
     // We need to first set the TotalItemCount, which will affect the calcuation of LimitClause below
     if ($this->Paginator) {
         $this->TotalItemCount = StewardshipContribution::QueryCount($objCondition, $objClauses);
     }
     // If a column is selected to be sorted, and if that column has a OrderByClause set on it, then let's add
     // the OrderByClause to the $objClauses array
     if ($objClause = $this->OrderByClause) {
         array_push($objClauses, $objClause);
     }
     // Add the LimitClause information, as well
     if ($objClause = $this->LimitClause) {
         array_push($objClauses, $objClause);
     }
     // Set the DataSource to be a Query result from StewardshipContribution, given the clauses above
     $this->DataSource = StewardshipContribution::QueryArray($objCondition, $objClauses);
 }