if ( !is_user_logged_in() && (!current_user_can(‘administrator’) || !current_user_can(‘shop_manager’) ) ){
wp_redirect( site_url() ); exit;
}
Yagnam 2018 Account Receivables Report
[insert_php]echo date(“F j, Y”);[/insert_php]
Last, First | Phone/Email | Pledged | Paid | Balance |
---|---|---|---|---|
” . str_replace(‘$’, ‘$ ‘, ($page->LastName)) . “, ” . str_replace(‘$’, ‘$ ‘, ($page->FirstName)) . “ | ” . ($page->Phone) . ““. ($page->Email) . “ | $ ” . number_format($page->Pledged) . “ | $ ” . number_format( $paid) . “ | $ ” . number_format( $page->Pledged- $paid ) . “ |
Totals | ” . $grand_total_pledge_count . “ | $ ” . number_format($grand_total_pledged) . “ | $ ” . number_format( $grand_total_paid ) . “ | $ ” . number_format( $grand_total_balance ) . “ |
select
(select last_name from civicrm_contact c where p.contact_id = c.id) as LastName,
(select first_name from civicrm_contact c where p.contact_id = c.id) as FirstName,
(select email from civicrm_email e where p.contact_id = e.contact_id and e.is_primary=1) as Email,
(select phone from civicrm_phone ph where p.contact_id = ph.contact_id and ph.is_primary=1) as Phone,
p.amount as Pledged,
(select sum(total_amount) from civicrm_contribution b where p.contact_id = b.contact_id and financial_type_id=p.financial_type_id and contribution_status_id=1) as Paid,
(select p.amount – (select sum(total_amount) from civicrm_contribution b where p.contact_id = b.contact_id and financial_type_id=p.financial_type_id and contribution_status_id=1)) as Balance
from civicrm_pledge p
where financial_type_id=265
order by pledged desc,lastname,firstname
“;
$_SESSION[“sponsors_query”] = $query;
[/insert_php]