$i = 0; while ($records->have_posts()) { $records->the_post(); // Calculate the percentage $i++; $percent = intval($i / $records->found_posts * 100) . '%'; // Javascript for updating the progress bar and information echo '<script language="javascript" id="progress_js"> document.getElementById("rows_progress").innerHTML="<div style=\\"width:' . $percent . ';background-color:#ddd;\\"> </div>"; document.getElementById("table_progress").innerHTML="' . sprintf(__('%o records(s) of %o added.', 'sprout-invoices'), $i, $records->found_posts) . '"; document.getElementById("progress_js").remove(); </script>'; $table_total_invoiced += si_get_invoice_calculated_total(); $table_total_paid += si_get_invoice_payments_total(); $table_total_balance += si_get_invoice_balance(); $client_name = si_get_invoice_client_id() ? sprintf('<a href="%s">%s</a>', get_edit_post_link(si_get_invoice_client_id()), get_the_title(si_get_invoice_client_id())) : __('N/A', 'sprout-invoices'); ?> <tr> <td><?php echo si_get_invoice_id(get_the_id()); ?> </td> <td><span class="si_status <?php si_invoice_status(); ?> "><?php si_invoice_status(); ?> </span></td> <td><?php si_invoice_issue_date();
</script>'; $payment = SI_Payment::get_instance(get_the_ID()); $invoice_id = $payment->get_invoice_id(); if ($payment->get_status() == SI_Payment::STATUS_VOID) { $table_voided_payment_total += $payment->get_amount(); $payment_total = 0; $payment_void_total = $payment->get_amount(); } else { $table_payment_total += $payment->get_amount(); $payment_total = $payment->get_amount(); $payment_void_total = 0; } $payment_link = sprintf('<a class="payments_link" title="%s" href="%s&s=%s">#%s</a>', self::__('Payment'), get_admin_url('', '/edit.php?post_type=sa_invoice&page=sprout-apps/invoice_payments'), get_the_ID(), get_the_ID()); $payments_link = sprintf('<a class="payments_link" title="%s" href="%s&s=%s">%s</a>', self::__('Invoice Payments'), get_admin_url('', '/edit.php?post_type=sa_invoice&page=sprout-apps/invoice_payments'), $invoice_id, sa_get_formatted_money(si_get_invoice_payments_total($invoice_id))); $invoice_name = $invoice_id ? sprintf('<a href="%s">%s</a>', get_edit_post_link($invoice_id), get_the_title($invoice_id)) : self::__('N/A'); $client_name = si_get_invoice_client_id($invoice_id) ? sprintf('<a href="%s">%s</a>', get_edit_post_link(si_get_invoice_client_id($invoice_id)), get_the_title(si_get_invoice_client_id($invoice_id))) : self::__('N/A'); ?> <tr> <td><?php echo $payment_link; ?> </td> <td><span class="si_status payment_status <?php echo esc_attr($payment->get_status()); ?> "><?php echo str_replace('Publish', 'Complete', ucfirst($payment->get_status())); ?> </span></td> <td><?php echo date(get_option('date_format'), strtotime($payment->get_post_date()));
/** * Echo the invoice client_id * @param integer $id * @return string */ function si_invoice_client_id($id = 0) { if (!$id) { $id = get_the_ID(); } echo apply_filters('si_invoice_client_id', si_get_invoice_client_id($id), $id); }
_e('To', 'sprout-invoices'); ?> </span> </dt> <dd> <b><?php echo get_the_title(si_get_invoice_client_id()); ?> </b> <?php do_action('si_document_client_addy'); ?> <?php si_client_address(si_get_invoice_client_id()); ?> </dd> </dl> <?php } ?> </dl><!-- #doc_address_info --> <?php do_action('si_document_vcards'); ?> </div><!-- #vcards --> <div class="doc_details clearfix"> <?php do_action('si_document_details_pre');
/** * Echo the invoice client_id * @param integer $id * @return string */ function si_invoice_client_id($id = 0) { if (!$id) { global $post; $id = $post->ID; } echo apply_filters('si_invoice_client_id', si_get_invoice_client_id($id), $id); }