Last active
September 29, 2016 17:39
-
-
Save dancameron/438f7d63f35e5c85769f2d1627a23a25 to your computer and use it in GitHub Desktop.
Create Sprout Invoices
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$line_items = array(); | |
if ( !empty( $invoice_itemized_list ) ) { | |
foreach ( $invoice_itemized_list as $key => $item ) { | |
$line_items[] = array( | |
'rate' => ( isset( $item['price'] ) ) ? $item['price'] : '', | |
'qty' => ( isset( $item['quantity'] ) ) ? $item['quantity'] : '', | |
'desc' => ( ! isset( $item['description'] ) || ! isset( $item['name'] ) ) ? "missing name or description" : '<strong>'.$item['name'].'</strong><br/>'.$item['description'], | |
'type' => 'task', // task, service, product, or time | |
'total' => ( isset( $item['line_total_after_tax'] ) ) ? $item['line_total_after_tax'] : '', | |
'tax' => ( isset( $item['tax_rate'] ) ) ? $item['tax_rate'] : '', | |
); | |
} | |
} | |
$invoice->set_line_items( $line_items ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment