// Send output to browser immediately flush(); } // Remove progress row echo '<script language="javascript">document.getElementById("progress_row").remove();</script>'; ?> </tbody> <tfoot> <tr> <th colspan="5"><?php _e('Totals', 'sprout-invoices'); ?> </th> <th><?php sa_formatted_money($table_total_invoiced); ?> </th> <th><?php sa_formatted_money($table_total_paid); ?> </th> <th><?php sa_formatted_money($table_total_balance); ?> </th> </tr> </tfoot> </table> </div> </div>
?> </td> </tr> <?php // Send output to browser immediately flush(); } // Remove progress row echo '<script language="javascript">document.getElementById("progress_row").remove();</script>'; ?> </tbody> <tfoot> <tr> <th colspan="9"><?php _e('Totals', 'sprout-invoices'); ?> </th> <th><?php sa_formatted_money($table_payment_total); ?> </th> <th><?php sa_formatted_money($table_voided_payment_total); ?> </th> </tr> </tfoot> </table> </div> </div>
?> </td> </tr> <?php // Send output to browser immediately flush(); } // Remove progress row echo '<script language="javascript">document.getElementById("progress_row").remove();</script>'; ?> </tbody> <tfoot> <tr> <th colspan="6"><?php self::_e('Totals'); ?> </th> <th><?php sa_formatted_money($table_total_estimated); ?> </th> <th><?php sa_formatted_money($table_subtotal); ?> </th> </tr> </tfoot> </table> </div> </div>
function si_line_item_build_option($position = 1.0, $items = array(), $children = array()) { $data = !empty($items) && isset($items[$position]) ? $items[$position] : array(); $desc = isset($data['desc']) ? $data['desc'] : ''; $rate = isset($data['rate']) ? $data['rate'] : ''; $qty = isset($data['qty']) ? $data['qty'] : ''; $tax = isset($data['tax']) ? $data['tax'] : ''; $total = isset($data['total']) ? $data['total'] : ''; ob_start(); ?> <div class="item_action_column"> <div class="item_action dd-handle"></div> <!--<div class="item_action item_clone"></div>--> <div class="item_action item_delete"></div> <?php do_action('si_line_item_build_option_action_row', $data, $items, $position, $children); ?> </div><!-- / item_action_column --> <div class="line_item<?php if (!empty($children)) { echo ' has_children'; } ?> "> <div class="column column_desc"> <textarea name="line_item_desc[]"><?php esc_attr_e($desc); ?> </textarea> <!-- desc --> </div><!-- / column_desc --> <div class="column parent_hide column_rate"> <span></span> <input class="totalled_input" type="text" name="line_item_rate[]" value="<?php esc_attr_e($rate); ?> " placeholder="80" size="3"> <!-- rate --> </div><!-- / column_rate --> <div class="column parent_hide column_qty"> <span></span> <input class="totalled_input" type="text" name="line_item_qty[]" value="<?php esc_attr_e($qty); ?> " placeholder="1" size="2"> <!-- qty --> </div><!-- / column_qty --> <div class="column parent_hide column_tax"> <span></span> <input class="totalled_input" type="text" name="line_item_tax[]" value="<?php esc_attr_e($tax); ?> " placeholder="" size="1" max="100"> <!-- tax --> </div><!-- / column_tax --> <div class="column column_total"> <?php sa_formatted_money($total); ?> <input class="totalled_input" type="hidden" name="line_item_total[]" value="<?php esc_attr_e($total); ?> "> <!-- total --> </div><!-- / column_total --> <input class="line_item_index" type="hidden" name="line_item_key[]" value="<?php echo esc_attr($position); ?> "> <!-- hidden --> </div> <?php $data = ob_get_contents(); ob_end_clean(); return apply_filters('si_line_item_build_option', $data, $position, $items, $children); }
?> </div> <?php } ?> <div id="line_total"> <b title="<?php si_e('Total includes discounts and other fees.'); ?> " class="helptip"><?php si_e('Total'); ?> </b> <?php sa_formatted_money(si_get_estimate_total()); ?> </div> </div> </footer> </div><!-- #doc_line_items --> </section> <section id="doc_notes"> <?php do_action('si_document_notes_pre'); ?> <?php if (strlen(si_get_estimate_notes()) > 1) { ?>
<dd><?php sa_formatted_money(si_get_invoice_total()); ?> </dd> </dl> <?php } ?> <dl class="doc_total doc_balance"> <dt><span class="dt_heading"><?php _e('Balance', 'sprout-invoices'); ?> </span></dt> <dd><?php sa_formatted_money(si_get_invoice_balance()); ?> </dd> </dl> <?php do_action('si_document_details'); ?> </div><!-- #doc_details --> </section> <section id="doc_line_items_wrap" class="clearfix"> <div id="doc_line_items" class="clearfix">
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 self::_e('Paid (last week)'); ?>
<?php } ?> </tbody> <tfoot> <tr> <td colspan="3" class="tfoot_total_desc"> <?php $create_invoice = add_query_arg(array('post_type' => SI_Invoice::POST_TYPE, SI_Time_Tracking_Premium::IMPORT_QUERY_VAR => (int) $project->get_id()), admin_url('post-new.php')); ?> <a href="<?php echo esc_url($create_invoice); ?> " title="<?php _e('Import Time into an Invoice', 'sprout-invoices'); ?> " class="si_tooltip"><span class="icon-sproutapps-invoices"></span></a> </td> <td><?php si_number_format((double) $unbilled_total_time); ?> </td> <td><b><?php sa_formatted_money($unbilled_total_cost); ?> </b></td> </tr> </tfoot> </table> </div><!-- #time_tracker_wrap -->
<dt><?php _e('Paid (year to date)', 'sprout-invoices'); ?> </dt> <dd><?php sa_formatted_money($year_payment_data['totals']); ?> </dd> <dt><?php _e('Paid (last year)', 'sprout-invoices'); ?> </dt> <dd><?php sa_formatted_money($last_year_payment_data['totals']); ?> </dd> </dl> <?php $args = array('orderby' => 'modified', 'post_type' => SI_Invoice::POST_TYPE, 'post_status' => 'any', 'posts_per_page' => 5, 'fields' => 'ids'); $invoices = new WP_Query($args); ?> <?php if (!empty($invoices->posts)) { ?> <b><?php _e('Latest Updates', 'sprout-invoices'); ?>
<?php $create_invoice = add_query_arg(array('post_type' => SI_Invoice::POST_TYPE, SI_Time_Tracking_Premium::IMPORT_QUERY_VAR => $project->get_id()), admin_url('post-new.php')); ?> <td><a href="<?php echo esc_url($create_invoice); ?> "><span class="icon-sproutapps-invoices"></span></a></td> </tr> <?php } ?> <tr> <td colspan="3" class="tfoot_total_desc"><?php _e('Totals', 'sprout-invoices'); ?> </td> <td><?php si_number_format((double) $total_time); ?> </td> <td colspan="2"><b><?php sa_formatted_money($total_cost); ?> </b></td> </tr> </tfoot> <?php } ?> </table> </div><!-- #time_tracker_wrap -->
?> </th> <th><?php echo (int) $table_total_invoice_count; ?> </th> <th><?php echo (int) $table_total_invoices_complete_count; ?> </th> <th><?php sa_formatted_money($table_total_invoiced); ?> </th> <th><?php sa_formatted_money($table_total_payments); ?> </th> <th><?php sa_formatted_money($table_total_outstanding); ?> </th> <th><?php sa_formatted_money($table_total_written_off); ?> </th> </tr> </tfoot> </table> </div> </div>
sa_formatted_money($subtotal, $doc_id); ?> </td> </tr> <?php } ?> <tr class="total" style="font-family: 'Helvetica Neue', 'Helvetica', Helvetica, Arial, sans-serif; box-sizing: border-box; font-size: 14px; margin: 0; padding: 0;"><td class="alignleft" width="80%" style="font-family: 'Helvetica Neue', 'Helvetica', Helvetica, Arial, sans-serif; box-sizing: border-box; font-size: 14px; vertical-align: top; text-align: right; border-bottom-color: #333; border-bottom-width: 2px; border-bottom-style: solid; font-weight: 700; margin: 0; padding: 5px 0;" align="left" valign="top"><?php si_e('Total'); ?> </td> <td class="alignright" style="font-family: 'Helvetica Neue', 'Helvetica', Helvetica, Arial, sans-serif; box-sizing: border-box; font-size: 14px; vertical-align: top; text-align: right; border-bottom-color: #333; border-bottom-width: 2px; border-bottom-style: solid; font-weight: 700; margin: 0; padding: 5px 0;" align="right" valign="top"><?php sa_formatted_money($total, $doc_id); ?> </td> <?php if ($due) { ?> <tr class="total" style="font-family: 'Helvetica Neue', 'Helvetica', Helvetica, Arial, sans-serif; box-sizing: border-box; font-size: 14px; margin: 0; padding: 0;"><td class="alignright" width="80%" style="font-family: 'Helvetica Neue', 'Helvetica', Helvetica, Arial, sans-serif; box-sizing: border-box; font-size: 14px; vertical-align: top; text-align: right; font-weight: 700; margin: 0; padding: 5px 0;" align="right" valign="top"><?php si_e('Total Due'); ?> </td> <td class="alignright" style="font-family: 'Helvetica Neue', 'Helvetica', Helvetica, Arial, sans-serif; box-sizing: border-box; font-size: 14px; vertical-align: top; text-align: right; font-weight: 700; margin: 0; padding: 5px 0;" align="right" valign="top"><?php sa_formatted_money($due, $doc_id); ?> </td> </tr> <?php } ?> </table>
?> </b> <?php sa_formatted_money($subtotal); ?> </div> <div id="line_total"> <b title="<?php si_e('Total includes tax and discount.'); ?> " class="helptip"><?php si_e('Total'); ?> </b> <?php sa_formatted_money($total); ?> </div> </div> <div id="status_updates" class="sticky_save"> <div id="publishing-action"> <?php $post_type = $post->post_type; $post_type_object = get_post_type_object($post_type); $can_publish = current_user_can($post_type_object->cap->publish_posts); if (0 == $post->ID || $status == 'auto-draft') { if ($can_publish) { ?> <input name="original_publish" type="hidden" id="original_publish" value="<?php esc_attr_e('Publish');
/** * Return the line items within an html table. * * @param array $atts * @param string $content * @param string $code * @param array $data * @return string filtered */ public static function shortcode_line_item_table($atts, $content, $code, $data) { $doc_id = 0; if (isset($data['invoice']) && is_a($data['invoice'], 'SI_Invoice')) { $line_items = $data['invoice']->get_line_items(); $doc_id = $data['invoice']->get_id(); } else { if (isset($data['estimate']) && is_a($data['estimate'], 'SI_Estimate')) { $line_items = $data['estimate']->get_line_items(); $doc_id = $data['estimate']->get_id(); } } if ($doc_id) { // Set the global post to pass the doc id around town global $post; if (!is_a($post, 'Post')) { $post = new stdClass(); $post->ID = $doc_id; $post = new WP_Post((object) $post); } } if (empty($line_items)) { return ''; } ob_start(); ?> <table> <thead> <tr> <th><?php si_e('#'); ?> </th> <th><?php si_e('Description'); ?> </th> <th><?php si_e('Rate'); ?> </th> <th><?php si_e('Quantity'); ?> </th> <th><?php si_e('% Adjustment'); ?> </th> <th><?php si_e('Total'); ?> </th> </tr> </thead> <tbody> <?php foreach ($line_items as $position => $ldata) { ?> <tr class="item" data-id="<?php echo (double) $position; ?> "> <td><?php esc_attr_e($position + 1); ?> </td> <td><?php echo apply_filters('the_content', $ldata['desc']); ?> </td> <td><?php esc_attr_e($ldata['rate']); ?> </td> <td><?php esc_attr_e($ldata['qty']); ?> </td> <td><?php esc_attr_e($ldata['tax']); ?> %</td> <td><?php sa_formatted_money($ldata['total'], $doc_id); ?> </td> </tr> <?php } ?> </tbody> </table> <?php $table = ob_get_clean(); return apply_filters('shortcode_line_item_table', $table, $line_items, $data); }