From 072f9d7e60bfeefb8b44cf186a9e5446b1c2f9c8 Mon Sep 17 00:00:00 2001 From: Brad Gearon Date: Wed, 15 Mar 2017 00:24:21 -0500 Subject: [PATCH] Option to hide bill counts in deposit reports #1941 (#1982) * resolves ChurchCRM/CRM#1941 * reverted changes to deposit slip editor added bDisplayBillCounts to system config using bDisplayBillCounts in deposit slip report * using SystemConfig static function instead of storing parameter removed extra space in config options --- src/ChurchCRM/dto/SystemConfig.php | 7 ++++--- src/ChurchCRM/model/ChurchCRM/Deposit.php | 17 ++++++++++------- 2 files changed, 14 insertions(+), 10 deletions(-) diff --git a/src/ChurchCRM/dto/SystemConfig.php b/src/ChurchCRM/dto/SystemConfig.php index 96439e5d77..a58b19bb34 100644 --- a/src/ChurchCRM/dto/SystemConfig.php +++ b/src/ChurchCRM/dto/SystemConfig.php @@ -161,8 +161,9 @@ private static function buildConfigs() "googleTrackingID" => new ConfigItem(1050, "googleTrackingID", "text", "", gettext("Google Analytics Tracking Code")), "mailChimpApiKey" => new ConfigItem(2000, "mailChimpApiKey", "text", "", gettext("see http://kb.mailchimp.com/accounts/management/about-api-keys")), "sDepositSlipType" => new ConfigItem(2001, "sDepositSlipType", "choice", "QBDT", gettext("Deposit ticket type. QBDT - Quickbooks"), '{"Choices":["QBDT"]}'), - "bAllowEmptyLastName" => new ConfigItem(2010, "bAllowEmptyLastName", "boolean", "0", gettext("Set true to allow empty lastname in Person Editor. Set false to validate last name and inherit from family when left empty.")) - ); + "bAllowEmptyLastName" => new ConfigItem(2010, "bAllowEmptyLastName", "boolean", "0", gettext("Set true to allow empty lastname in Person Editor. Set false to validate last name and inherit from family when left empty.")), + "bDisplayBillCounts" => new ConfigItem(2002, "bDisplayBillCounts", "boolean", "1", gettext("Display bill counts on deposit slip")) + ); } private static function buildCategories() @@ -176,7 +177,7 @@ private static function buildCategories() gettext('Map Settings') => ["sGoogleMapKey","bUseGoogleGeocode","sGMapIcons","sISTusername","sISTpassword","sGeocoderID","sGeocoderPW"], gettext('Report Settings') => ["sQBDTSettings","leftX","incrementY","sTaxReport1","sTaxReport2","sTaxReport3","sTaxSigner","sReminder1","sReminderSigner","sReminderNoPledge","sReminderNoPayments","sConfirm1","sConfirm2","sConfirm3","sConfirm4","sConfirm5","sConfirm6","sConfirmSincerely","sConfirmSigner","sPledgeSummary1","sPledgeSummary2","sDirectoryDisclaimer1","sDirectoryDisclaimer2","bDirLetterHead","sZeroGivers","sZeroGivers2","sZeroGivers3"], gettext('Localization') => ["sLanguage","sDistanceUnit","sPhoneFormat","sPhoneFormatWithExt","sDateFormatLong","sDateFormatNoYear","sDateFormatShort","sDateTimeFormat","sDateFilenameFormat"], - gettext('Financial Settings') => ["sDepositSlipType","iChecksPerDepositForm","bUseScannedChecks","sElectronicTransactionProcessor","bEnableNonDeductible","iFYMonth","bUseDonationEnvelopes","aFinanceQueries"], + gettext('Financial Settings') => ["sDepositSlipType","iChecksPerDepositForm","bDisplayBillCounts","bUseScannedChecks","sElectronicTransactionProcessor","bEnableNonDeductible","iFYMonth","bUseDonationEnvelopes","aFinanceQueries"], gettext('Other Settings') => ["iPDFOutputType","googleTrackingID"] ); } diff --git a/src/ChurchCRM/model/ChurchCRM/Deposit.php b/src/ChurchCRM/model/ChurchCRM/Deposit.php index 45c6f42e22..7347d51329 100644 --- a/src/ChurchCRM/model/ChurchCRM/Deposit.php +++ b/src/ChurchCRM/model/ChurchCRM/Deposit.php @@ -203,14 +203,18 @@ private function generateQBDepositSlip($thisReport) $thisReport->curX = $thisReport->QBDepositTicketParameters->date1->x; $thisReport->curY += 2 * $thisReport->QBDepositTicketParameters->lineItemInterval->y; - $this->generateCashDenominations($thisReport); + + if (SystemConfig::getBooleanValue('bDisplayBillCounts')) { + $this->generateCashDenominations($thisReport); + } + $thisReport->curX = $thisReport->QBDepositTicketParameters->date1->x + 125; $this->generateTotalsByCurrencyType($thisReport); $thisReport->curX = $thisReport->QBDepositTicketParameters->date1->x + 125; $thisReport->curY = $thisReport->QBDepositTicketParameters->perforationY + 30; $this->generateTotalsByFund($thisReport); - + $thisReport->curY += $thisReport->QBDepositTicketParameters->lineItemInterval->y; $thisReport->pdf->SetXY($thisReport->curX, $thisReport->curY); $thisReport->pdf->SetFont('Times', 'B', 10); @@ -235,7 +239,6 @@ private function generateDepositSummary($thisReport) $thisReport->depositSummaryParameters->summary->MemoX = 120; $thisReport->depositSummaryParameters->summary->AmountX = 185; $thisReport->depositSummaryParameters->aggregateX = 135; - $thisReport->depositSummaryParameters->displayBillCounts = false; $thisReport->pdf->AddPage(); $thisReport->pdf->SetXY($thisReport->depositSummaryParameters->date->x, $thisReport->depositSummaryParameters->date->y); @@ -333,9 +336,9 @@ private function generateDepositSummary($thisReport) $grandTotalStr = sprintf('%.2f', $this->getTotalAmount()); $thisReport->pdf->PrintRightJustified($thisReport->curX + $thisReport->depositSummaryParameters->summary->AmountX, $thisReport->curY, $grandTotalStr); - // Now print deposit totals by fund - $thisReport->curY += 2 * $thisReport->depositSummaryParameters->summary->intervalY; - if ($thisReport->depositSummaryParameters->displayBillCounts) { + // Now print deposit totals by fund + $thisReport->curY += 2 * $thisReport->depositSummaryParameters->summary->intervalY; + if (SystemConfig::getBooleanValue('bDisplayBillCounts')) { $this->generateCashDenominations($thisReport); } $thisReport->curX = $thisReport->depositSummaryParameters->aggregateX; @@ -462,7 +465,7 @@ public function getFundTotals() ->orderBy(DonationFundTableMap::COL_FUN_NAME) ->select(['Name', 'Total']) ->find(); - + return $funds; }