12005 Hwy 64
Eads, TN 38028 USA

Kumbhabhishekam Pledges

[insert_php]

if ( !is_user_logged_in() && (!current_user_can(‘administrator’) || !current_user_can(‘shop_manager’) ) ){
wp_redirect( site_url() ); exit;
}

[/insert_php]


 

India Cultural Center and Temple
12005 Highway 64 E., Eads, TN 38028-9314
Phone: (901) 202-6070; E-mail: [email protected]
A not-for-profit, section 501(c)(3); Tax Id: 58-1522313

 
2017 Dwiteeya Kumbhabhishekam Account Receivables Report

 [insert_php]echo date(“F j, Y”);[/insert_php]

[insert_php]

$fi_types = “212,213,214,215,216,217,218,219,220,225,226,227,228,229,230,231,232,233,234,235,236,239,240,241,242”;
$pledged_date = “2015-01-01”;
$receive_date = “2015-01-01″;

global $wpdb;

$result = $wpdb->get_results ( ”

select f.id, f.name, count(*) as count, sum(amount) as pledged
FROM civicrm_pledge a, civicrm_financial_type f
where f.id = a.financial_type_id and `status_id` !=3 and create_date>='” . $pledged_date .”‘
and f.id in(“. $fi_types. “)
group by f.id, f.name
order by FIELD(f.id, 232,219,231,218,241,239,228,226,217,236,235,227,216,234,213,214,225) DESC, f.name

” );

$result2 = $wpdb->get_results ( ”

select f.id, f.name, sum(actual_amount) as total_amount
FROM civicrm_pledge a, civicrm_financial_type f, civicrm_pledge_payment p
where a.id=p.`pledge_id` and a.`financial_type_id`=f.id and p.status_id=1
and f.id in(“. $fi_types. “)
group by f.id, f.name
order by f.id, f.name

” );

$payments = array();
foreach ( $result2 as $page )
{
$payments[$page->id] = $page->total_amount;
}

$grand_total_pledge_count = 0;
$grand_total_pledged = 0;
$grand_total_paid = 0;
$grand_total_balance = 0;

foreach ( $result as $page )
{
if (!array_key_exists($page->id, $payments))
$payments[$page->id] = 0;

echo “

“;
echo “

“;
echo “

“;
echo “

“;
echo “

“;
echo “

“;

$grand_total_pledge_count += $page->count;
$grand_total_pledged += $page->pledged;
$grand_total_paid += $payments[$page->id];
$grand_total_balance += $page->pledged – $payments[$page->id];

}

echo “

“;
echo “

“;
echo “

“;
echo “

“;
echo “

“;
echo “

“;

[/insert_php]
Sponsorship Sponsors Pledged Paid Balance
” . str_replace(‘$’, ‘$ ‘, ($page->name)) . “ ” . ($page->count) . “ $ ” . number_format($page->pledged) . “ $ ” . number_format( $payments[$page->id] ) . “ $ ” . number_format( $page->pledged – $payments[$page->id] ) . “
Totals ” . $grand_total_pledge_count . “ $ ” . number_format($grand_total_pledged) . “ $ ” . number_format( $grand_total_paid ) . “ $ ” . number_format( $grand_total_balance ) . “

[insert_php] $query = ”

SELECT first_name as FirstName, last_name as LastName, Email, Phone, f.name as Sponsorship,
sum(amount) as Pledged,
(select sum(actual_amount) from civicrm_pledge_payment where pledge_id=a.id and status_id=1) as Paid,
sum(amount)-(select sum(actual_amount) from civicrm_pledge_payment where pledge_id=a.id and status_id=1) as Balance
FROM civicrm_contact c, civicrm_pledge a, civicrm_financial_type f, civicrm_email e, civicrm_phone ph
WHERE c.id=a.contact_id and a.financial_type_id=f.id and status_id !=3 and create_date>='” . $pledged_date .”‘
and c.id=e.contact_id and c.id=ph.contact_id and e.is_primary=1 and ph.is_primary=1
and f.id in(“. $fi_types. “)
GROUP BY a.contact_id, f.id
ORDER BY display_name, f.name, Balance desc

“;
$_SESSION[“sponsors_query”] = $query;
[/insert_php]

Facebook4k
YouTube2k
YouTube
WhatsApp