echo si_line_item_build($position, $line_items, $children);
        ?>

											<?php 
        if (!empty($children)) {
            // if has children, loop and show
            ?>
												<ol class="items_list">
													<?php 
            foreach ($children as $child_position) {
                ?>
														<li class="item" data-id="<?php 
                echo (double) $child_position;
                ?>
"><?php 
                echo si_line_item_build($child_position, $line_items);
                ?>
</li>
													<?php 
            }
            ?>
												</ol>
											<?php 
        }
        ?>
										</li>
									<?php 
    }
    ?>
								<?php 
}
    /**
     * Return the line items within an html list.
     *
     * @param  array $atts
     * @param  string $content
     * @param  string $code
     * @param  array $data
     * @return string          filtered
     */
    public static function shortcode_line_item_list($atts, $content, $code, $data)
    {
        if (isset($data['invoice']) && is_a($data['invoice'], 'SI_Invoice')) {
            $line_items = $data['invoice']->get_line_items();
        } else {
            if (isset($data['estimate']) && is_a($data['estimate'], 'SI_Estimate')) {
                $line_items = $data['estimate']->get_line_items();
            }
        }
        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();
        ?>
			<ol>
				<?php 
        foreach ($line_items as $position => $data) {
            ?>
					<?php 
            if (is_int($position)) {
                // is not a child
                ?>
						<li class="item" data-id="<?php 
                echo (double) $position;
                ?>
">
							<?php 
                // get the children of this top level item
                $children = si_line_item_get_children($position, $line_items);
                ?>

							<?php 
                // build single item
                echo si_line_item_build($position, $line_items, $children);
                ?>

							<?php 
                if (!empty($children)) {
                    // if has children, loop and show
                    ?>
								<ol class="items_list">
									<?php 
                    foreach ($children as $child_position) {
                        ?>
										<li class="item" data-id="<?php 
                        echo (double) $child_position;
                        ?>
"><?php 
                        echo si_line_item_build($child_position, $line_items);
                        ?>
</li>
									<?php 
                    }
                    ?>
								</ol>
							<?php 
                }
                ?>
						</li>
					<?php 
            }
            ?>
				<?php 
        }
        ?>
			</ol>
			
		<?php 
        $table = ob_get_clean();
        return apply_filters('shortcode_line_item_list', $table, $line_items, $data);
    }