<h3 class="dashboard_widget_title"> <span><?php self::_e('Invoice Dashboard'); ?> </span> </h3> <div class="dashboard_widget inside"> <div class="main"> <?php $invoice_data = SI_Reporting::total_invoice_data(); $week_payment_data = SI_Reporting::total_payment_data('week'); $last_week_payment_data = SI_Reporting::total_payment_data('lastweek'); $month_payment_data = SI_Reporting::total_payment_data('month'); $last_month_payment_data = SI_Reporting::total_payment_data('lastmonth'); $year_payment_data = SI_Reporting::total_payment_data('year'); $last_year_payment_data = SI_Reporting::total_invoice_data('lastyear'); ?> <dl> <dt><?php self::_e('Outstanding'); ?> </dt> <dd><?php sa_formatted_money($invoice_data['balance']); ?> </dd> <dt><?php self::_e('Paid (this week)'); ?>
<h3 class="dashboard_widget_title"> <span><?php self::_e('Invoice Dashboard'); ?> </span> </h3> <div class="dashboard_widget inside"> <div class="main"> <?php $invoice_data = SI_Reporting::total_invoice_data(); ?> <dl> <dt><?php self::_e('Outstanding'); ?> </dt> <dd><?php sa_formatted_money($invoice_data['balance']); ?> </dd> <dt><?php self::_e('Paid (this week)'); ?> </dt> <dd>N/A<span title="<?php self::esc_e('Data available with upgraded version of Sprout Invoices'); ?> " class="helptip add_item_help"></span></dd> <dt><?php
function test_total_invoice_data_balances() { $invoice_totaled = 0; $payment_totaled = 0; $invoice_totals = array(1000, 1000, 1000, 1000, 1000, 2000); $payment_totals = array(500, 200, 400, 50, 700, 100.75); foreach ($invoice_totals as $key => $total) { $id = $this->build_test_invoice($total); $this->build_test_payment($id, $payment_totals[$key]); $invoice_totaled += (double) $total; $payment_totaled += (double) $payment_totals[$key]; } // Build some invoices with voided payments foreach ($invoice_totals as $key => $total) { $id = $this->build_test_invoice($total); $this->build_test_payment($id, $total, false, SI_Payment::STATUS_VOID); // tally the invoice balances $invoice_totaled += (double) $total; } $invoice_data = SI_Reporting::total_invoice_data(); // Total balance should equal $invoice_totals-$payment_totals $this->assertEquals($invoice_data['balance'], $invoice_totaled - $payment_totaled); }