* @return array
*/
public static function getSoftContributionTotals($contact_id, $isTest = 0) {
-
+
$whereClause = "AND cc.cancel_date IS NULL";
-
+
$query = "
SELECT SUM(amount) as amount, AVG(total_amount) as average, cc.currency
FROM civicrm_contribution_soft ccs
$currency[] = $cs->currency;
}
}
-
+
//to get cancel amount
$cancelAmountWhereClause = "AND cc.cancel_date IS NOT NULL";
$query = str_replace($whereClause, $cancelAmountWhereClause, $query);
$cancelAmountSQL = CRM_Core_DAO::executeQuery($query, $params);
while ($cancelAmountSQL->fetch()) {
if ($cancelAmountSQL->amount > 0) {
+ $count++;
$cancelAmount[] = $cancelAmountSQL->amount;
}
}
-
+
if ($count > 0) {
return array(
implode(', ', $amount),
{if $context neq 'membership'}
<table class="form-layout-compressed">
<tr>
+ {if $softCreditTotals.amount}
<th class="contriTotalLeft">{ts}Total Soft Credits{/ts} - {$softCreditTotals.amount|crmMoney:$softCreditTotals.currency}</th>
<th class="right" width="10px"> </th>
<th class="right contriTotalRight"> {ts}Avg Soft Credits{/ts} - {$softCreditTotals.avg|crmMoney:$softCreditTotals.currency}</th>
-
- {if $softCreditTotals.cancelAmount}
+ {/if}
+ {if $softCreditTotals.cancelAmount}
<th class="right contriTotalRight"> {ts}Total Cancelled Soft Credits{/ts} - {$softCreditTotals.cancelAmount|crmMoney:$softCreditTotals.currency}</th>
- {/if}
-
+ {/if}
</tr>
</table>
<p></p>