/** * Recursive function for traversing all the sub-items of each line item * and displaying them in the table * @param EE_Line_Item $line_item * @param boolean $odd for indicating whether to style this line item as an 'odd' or 'even' */ function ee_invoice_display_line_item(EE_Line_Item $line_item, $show_line_item_description, $odd = false) { switch ($line_item->type()) { case EEM_Line_Item::type_total: foreach ($line_item->children() as $child_line_item) { ee_invoice_display_line_item($child_line_item, $show_line_item_description); } ?> <tr><td colspan="<?php echo $show_line_item_description ? 5 : 4; ?> "><hr></td></tr> <tr class="total_tr odd"> <td colspan="<?php echo $show_line_item_description ? 2 : 1; ?> "> </td> <td colspan="2" class="total" id="total_currency"><?php _e('Total', 'event_espresso'); ?> </td> <td class="total"><?php echo $line_item->total_no_code(); ?> </td> </tr> <?php break; case EEM_Line_Item::type_sub_total: foreach ($line_item->children() as $child_line_item) { //$odd = !$odd; ee_invoice_display_line_item($child_line_item, $show_line_item_description, $odd); } ?> <tr class="total_tr odd"> <td colspan="<?php echo $show_line_item_description ? 2 : 1; ?> "> </td> <td colspan="2" class="total" id="total_currency"><?php _e('Sub-Total', 'event_espresso'); ?> </td> <td class="total"><?php echo $line_item->total_no_code(); ?> </td> </tr> <?php break; case EEM_Line_Item::type_tax_sub_total: foreach ($line_item->children() as $child_line_item) { $odd = !$odd; ee_invoice_display_line_item($child_line_item, $show_line_item_description, $odd); } ?> <tr class="total_tr odd"> <td colspan="<?php echo $show_line_item_description ? 2 : 1; ?> "> </td> <td colspan="2" class="total" id="total_currency"><?php _e('Tax Total', 'event_espresso'); ?> </td> <td class="total"><?php echo $line_item->total_no_code(); ?> </td> </tr> <?php break; case EEM_Line_Item::type_line_item: $subitems = $line_item->children(); $has_subitems = count($subitems) > 1; if ($has_subitems) { ?> <tr class="item <?php echo $odd ? 'odd' : ''; ?> "> <td class="item_l"><?php echo $line_item->name(); ?> </td> <?php if ($show_line_item_description) { ?> <td class="item_l"><?php echo $line_item->desc(); ?> </td><?php } ?> <td class="item_l"><?php echo $line_item->quantity(); ?> </td> <td class="item_c"><?php echo $line_item->unit_price_no_code(); ?> </td> <td class="item_r"> <?php echo $line_item->total_no_code(); echo $line_item->is_taxable() ? '*' : ''; ?> </td> <?php //<td class="item_l"><?php $datetimes_strings = array(); foreach($datetimes as $datetime){ $datetimes_strings[]= $datetime->start_date_and_time();} echo implode(", ",$datetimes_strings); ?> </tr> <?php if ($has_subitems) { foreach ($line_item->children() as $child_line_item) { ee_invoice_display_line_item($child_line_item, $show_line_item_description, $odd); } } } else { //no subitems - just show this line item ?> <tr class="item <?php echo $odd ? 'odd' : ''; ?> "> <td class="item_l"><?php echo $line_item->name(); ?> </td> <?php if ($show_line_item_description) { ?> <td class="item_l"><?php echo $line_item->desc(); ?> </td><?php } ?> <td class="item_l"><?php echo $line_item->quantity(); ?> </td> <td class="item_c"><?php echo $line_item->unit_price_no_code(); ?> </td> <td class="item_r"> <?php echo $line_item->total_no_code(); echo $line_item->is_taxable() ? '*' : ''; ?> </td> <?php //<td class="item_l"><?php $datetimes_strings = array(); foreach($datetimes as $datetime){ $datetimes_strings[]= $datetime->start_date_and_time();} echo implode(", ",$datetimes_strings); ?> </tr> <?php } break; case EEM_Line_Item::type_sub_line_item: ?> <tr class="item subitem-row"> <td class="item_l subitem"><?php echo $line_item->name(); ?> </td> <?php if ($show_line_item_description) { ?> <td class="item_l"><?php echo $line_item->desc(); ?> </td><?php } ?> <?php if ($line_item->is_percent()) { ?> <td></td> <td class="item_c"><?php echo $line_item->percent(); ?> %</td> <?php } else { //flat discount/surcharge ?> <td></td> <td class="item_c"><?php echo $line_item->unit_price_no_code(); ?> </td> <?php } ?> <td class="item_r"><?php echo $line_item->total_no_code(); ?> </td> </tr> <?php break; case EEM_Line_Item::type_tax: ?> <tr class="item sub-item tax-total"> <td class="item_l"><?php echo $line_item->name(); ?> </td> <?php if ($show_line_item_description) { ?> <td class="item_l"><?php echo $line_item->desc(); ?> </td><?php } ?> <td colspan="2" class="item_c"><?php echo $line_item->percent(); ?> %</td> <td class="item_r"><?php echo $line_item->total_no_code(); ?> </td> </tr><?php break; } }
/** * _total_row * * @param EE_Line_Item $line_item * @param string $text * @param array $options * @return mixed */ private function _total_row(EE_Line_Item $line_item, $text = '', $options = array()) { // colspan $colspan = $options['show_desc'] ? ' colspan="2"' : ''; // start of row $html = EEH_HTML::tr('', '', 'total_tr odd'); // empty td $html .= EEH_HTML::td(EEH_HTML::nbsp(), '', '', '', $colspan); // total td $html .= EEH_HTML::td($text, '', 'total_currency total', '', $colspan); // total td $html .= EEH_HTML::td($line_item->total_no_code(), '', 'total'); // end of row $html .= EEH_HTML::trx(); return $html; }
/** * _total_row * * @param EE_Line_Item $line_item * @param string $text * @param int $total_items * @return mixed */ private function _total_row(EE_Line_Item $line_item, $text = '', $total_items = 0) { //EE_Registry::instance()->load_helper('Money'); // start of row $html = EEH_HTML::tr('', 'event-cart-total-row-' . $line_item->ID(), 'event-cart-total-row-' . $line_item->type() . ' event-cart-total-row total_tr'); // total td $html .= EEH_HTML::td(EEH_HTML::strong($text), '', 'total_currency total jst-rght', '', ' colspan="2"'); // total qty $total_items = $total_items ? $total_items : ''; $html .= EEH_HTML::td(EEH_HTML::strong('<span class="total">' . $total_items . '</span>'), '', 'total jst-cntr'); // total td $html .= EEH_HTML::td(EEH_HTML::strong($line_item->total_no_code()), '', 'total jst-rght'); // end of row $html .= EEH_HTML::trx(); return $html; }
/** * _total_row * * @param EE_Line_Item $line_item * @param string $text * @param bool $tax_total * @return mixed */ private function _total_row(EE_Line_Item $line_item, $text = '', $tax_total = false) { if ($tax_total && $this->_tax_count < 2) { return ''; } //EE_Registry::instance()->load_helper('Money'); //if ( ) // start of row $html = EEH_HTML::tr('', 'event-cart-total-row', 'total_tr odd'); // total td $html .= EEH_HTML::td(EEH_HTML::strong(EED_Multi_Event_Registration::$event_cart_name . ' ' . $line_item->desc() . ' ' . $text), '', 'total_currency total jst-rght', '', ' colspan="2"'); // total qty $total_qty = $tax_total ? '' : EE_Registry::instance()->CART->all_ticket_quantity_count(); $html .= EEH_HTML::td(EEH_HTML::strong($total_qty), '', 'mini-cart-tbl-qty-td total jst-cntr'); // total td $html .= EEH_HTML::td(EEH_HTML::strong($line_item->total_no_code()), '', 'total jst-rght'); // end of row $html .= EEH_HTML::trx(); return $html; }
/** * _total_row * * @param EE_Line_Item $line_item * @param string $text * @param bool $tax_total * @return mixed */ private function _total_row(EE_Line_Item $line_item, $text = '', $tax_total = false) { if ($tax_total && $this->_tax_count < 2) { return ''; } // total td $content = EEH_HTML::strong($line_item->desc() . ' ' . $text); // total td $content .= ' ' . EEH_HTML::strong($line_item->total_no_code()); return EEH_HTML::li($content, '', 'event-cart-total-list total-list', 'text-align:right; width:100%;'); }