/**
  * 	_tax_row
  *
  * @param EE_Line_Item $line_item
  * @param array        $options
  * @return mixed
  */
 private function _tax_row(EE_Line_Item $line_item, $options = array())
 {
     // start of row
     $html = EEH_HTML::tr('', 'item sub-item tax-total');
     // name td
     $html .= EEH_HTML::td($line_item->name(), '', 'item_l sub-item');
     // desc td
     $html .= $options['show_desc'] ? EEH_HTML::td($line_item->desc(), '', 'item_l') : '';
     // percent td
     $html .= EEH_HTML::td($line_item->percent() . '%', '', 'item_c', '', ' colspan="2"');
     // total td
     $html .= EEH_HTML::td($line_item->total_no_code(), '', 'item_r');
     // end of row
     $html .= EEH_HTML::trx();
     return $html;
 }
コード例 #2
0
/**
 * 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;
            ?>
">&nbsp;</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;
            ?>
">&nbsp;</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;
            ?>
">&nbsp;</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;
    }
}
 /**
  * 	_tax_row
  *
  * @param EE_Line_Item $line_item
  * @param array        $options
  * @return mixed
  */
 private function _tax_row(EE_Line_Item $line_item, $options = array())
 {
     // start of row
     $html = EEH_HTML::tr('', 'item sub-item tax-total');
     // name && desc
     $name_and_desc = $line_item->name();
     $name_and_desc .= '<span class="smaller-text lt-grey-text" style="margin:0 0 0 2em;">' . __(' * taxable items', 'event_espresso') . '</span>';
     $name_and_desc .= $options['show_desc'] ? '<br/>' . $line_item->desc() : '';
     // name td
     $html .= EEH_HTML::td($name_and_desc, '', 'item_l sub-item');
     // percent td
     $html .= EEH_HTML::td($line_item->percent() . '%', '', ' jst-rght', '');
     // empty td (price)
     $html .= EEH_HTML::td(EEH_HTML::nbsp());
     // total td
     $html .= EEH_HTML::td(EEH_Template::format_currency($line_item->total(), false, false), '', 'item_r jst-rght');
     // end of row
     $html .= EEH_HTML::trx();
     return $html;
 }
コード例 #4
0
 /**
  * Checks if this line item, or any of its children, actually has a description.
  * If none do, then the template can decide to not show any description column
  * @param EE_Line_Item $line_item
  * @return boolean
  */
 function check_if_any_line_items_have_a_description(EE_Line_Item $line_item)
 {
     if ($line_item->desc()) {
         return true;
     } else {
         foreach ($line_item->children() as $child_line_item) {
             if ($this->check_if_any_line_items_have_a_description($child_line_item)) {
                 return true;
             }
         }
         //well, if I and my children don't have descriptions, I guess not
         return false;
     }
 }
 /**
  * 	_sub_item_row
  *
  * @param EE_Line_Item $line_item
  * @param array        $options
  * @return mixed
  */
 private function _sub_item_row(EE_Line_Item $line_item, $options = array())
 {
     // start of row
     $html = EEH_HTML::tr('', 'item sub-item-row');
     // name && desc
     $name_and_desc = $line_item->name();
     $name_and_desc .= $options['show_desc'] ? '<span class="line-sub-item-desc-spn smaller-text">: ' . $line_item->desc() . '</span>' : '';
     // name td
     $html .= EEH_HTML::td($name_and_desc, '', 'item_l sub-item');
     // discount/surcharge td
     if ($line_item->is_percent()) {
         $html .= EEH_HTML::td($line_item->percent() . '%', '', 'item_c');
     } else {
         $html .= EEH_HTML::td($line_item->unit_price_no_code(), '', 'item_c jst-rght');
     }
     // total td
     $html .= EEH_HTML::td(EEH_Template::format_currency($line_item->total(), false, false), '', 'item_r 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%;');
 }