Skip to content

Commit

Permalink
Formatting adjustment to match Memberships report.
Browse files Browse the repository at this point in the history
  • Loading branch information
kimcoleman committed Jan 21, 2025
1 parent 54b6334 commit 48574d6
Showing 1 changed file with 31 additions and 28 deletions.
59 changes: 31 additions & 28 deletions adminpages/reports/sales.php
Original file line number Diff line number Diff line change
Expand Up @@ -926,37 +926,40 @@ function pmpro_report_title_sales() {
<?php
// Show a table with all of the raw data.
?>
<table class="widefat">
<thead>
<tr>
<th><?php esc_html_e( 'Date', 'paid-memberships-pro' ); ?></th>
<th><?php esc_html_e( 'Total', 'paid-memberships-pro' ); ?></th>
<th><?php esc_html_e( 'New', 'paid-memberships-pro' ); ?></th>
<th><?php esc_html_e( 'Renewals', 'paid-memberships-pro' ); ?></th>
</tr>
</thead>
<tbody>
<?php
foreach ( $csvdata as $row ) {
// round to two decimals.
?>
<div class="pmpro_table_area">
<table class="widefat striped">
<thead>
<tr>
<td><?php echo date_i18n( $tooltip_date_format, strtotime( $row->date ) ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?></td>
<td><?php echo $type === 'revenue' ? pmpro_escape_price( pmpro_formatPrice( $row->total ) ) : esc_html( $row->total ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped?></td>
<td><?php echo $type === 'revenue' ? pmpro_escape_price( pmpro_formatPrice( $row->new ) ) : esc_html( $row->new ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?></td>
<td><?php echo $type === 'revenue' ? pmpro_escape_price( pmpro_formatPrice( $row->renewals ) ) : esc_html( $row->renewals); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?></td>
<th><?php esc_html_e( 'Date', 'paid-memberships-pro' ); ?></th>
<th><?php esc_html_e( 'Total', 'paid-memberships-pro' ); ?></th>
<th><?php esc_html_e( 'New', 'paid-memberships-pro' ); ?></th>
<th><?php esc_html_e( 'Renewals', 'paid-memberships-pro' ); ?></th>
</tr>
</thead>
<tbody>
<?php
}
?>
<tr>
<td><strong><?php esc_html_e( 'Total', 'paid-memberships-pro' ); ?></strong></td>
<td><strong><?php echo $type === 'revenue' ? pmpro_escape_price( pmpro_formatPrice( array_sum( wp_list_pluck( $csvdata, 'total' ) ) ) ) : array_sum( wp_list_pluck( $csvdata, 'total' ) ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?></strong></td>
<td><strong><?php echo $type === 'revenue' ? pmpro_escape_price( pmpro_formatPrice( array_sum( wp_list_pluck( $csvdata, 'new' ) ) ) ) : array_sum( wp_list_pluck( $csvdata, 'new' ) ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?></strong></td>
<td><strong><?php echo $type === 'revenue' ? pmpro_escape_price( pmpro_formatPrice( array_sum( wp_list_pluck( $csvdata, 'renewals' ) ) ) ) : array_sum( wp_list_pluck( $csvdata, 'renewals' ) ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?></strong></td>
</tr>
</tbody>
</table>
foreach ( $csvdata as $row ) {
// round to two decimals.
?>
<th scope="row"><?php echo date_i18n( $tooltip_date_format, strtotime( $row->date ) ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?></th>
<td><?php echo $type === 'revenue' ? pmpro_escape_price( pmpro_formatPrice( $row->total ) ) : esc_html( $row->total ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped?></td>
<td><?php echo $type === 'revenue' ? pmpro_escape_price( pmpro_formatPrice( $row->new ) ) : esc_html( $row->new ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?></td>
<td><?php echo $type === 'revenue' ? pmpro_escape_price( pmpro_formatPrice( $row->renewals ) ) : esc_html( $row->renewals); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?></td>
</tr>
<?php
}
?>
</tbody>
<tfoot>
<tr>
<th scope="row"><?php esc_html_e( 'Total', 'paid-memberships-pro' ); ?></td>
<th><?php echo $type === 'revenue' ? pmpro_escape_price( pmpro_formatPrice( array_sum( wp_list_pluck( $csvdata, 'total' ) ) ) ) : array_sum( wp_list_pluck( $csvdata, 'total' ) ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?></td>
<th><?php echo $type === 'revenue' ? pmpro_escape_price( pmpro_formatPrice( array_sum( wp_list_pluck( $csvdata, 'new' ) ) ) ) : array_sum( wp_list_pluck( $csvdata, 'new' ) ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?></td>
<th><?php echo $type === 'revenue' ? pmpro_escape_price( pmpro_formatPrice( array_sum( wp_list_pluck( $csvdata, 'renewals' ) ) ) ) : array_sum( wp_list_pluck( $csvdata, 'renewals' ) ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?></td>
</tr>
</tfoot>
</table>
</div>
<?php
}

Expand Down

0 comments on commit 48574d6

Please sign in to comment.