/**
  * 	_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;
 }
 /**
  * 	_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;
 }
 /**
  *    _payments_and_amount_owing_rows
  *
  * @param EE_Line_Item $line_item
  * @param array        $options
  * @return mixed
  */
 private function _payments_and_amount_owing_rows(EE_Line_Item $line_item, $options = array())
 {
     $html = '';
     $owing = $line_item->total();
     $transaction = EEM_Transaction::instance()->get_one_by_ID($line_item->TXN_ID());
     if ($transaction instanceof EE_Transaction) {
         $registration_payments = array();
         $registrations = !empty($options['registrations']) ? $options['registrations'] : $transaction->registrations();
         foreach ($registrations as $registration) {
             if ($registration instanceof EE_Registration && $registration->owes_monies_and_can_pay()) {
                 $registration_payments = $registration_payments + $registration->registration_payments();
             }
         }
         if (!empty($registration_payments)) {
             foreach ($registration_payments as $registration_payment) {
                 if ($registration_payment instanceof EE_Registration_Payment) {
                     $owing = $owing - $registration_payment->amount();
                     $payment = $registration_payment->payment();
                     if ($payment instanceof EE_Payment) {
                         $payment_desc = sprintf(__('Payment%1$s Received: %2$s', 'event_espresso'), $payment->txn_id_chq_nmbr() != '' ? ' <span class="small-text">(#' . $payment->txn_id_chq_nmbr() . ')</span> ' : '', $payment->timestamp());
                     } else {
                         $payment_desc = '';
                     }
                     // start of row
                     $html .= EEH_HTML::tr('', '', 'total_tr odd');
                     // payment desc
                     $html .= EEH_HTML::td($payment_desc, '', '', '', ' colspan="3"');
                     // total td
                     $html .= EEH_HTML::td(EEH_Template::format_currency($registration_payment->amount(), false, false), '', 'total jst-rght');
                     // end of row
                     $html .= EEH_HTML::trx();
                 }
             }
             if ($line_item->total()) {
                 // start of row
                 $html .= EEH_HTML::tr('', '', 'total_tr odd');
                 // total td
                 $html .= EEH_HTML::td(__('Amount Owing', 'event_espresso'), '', 'total_currency total jst-rght', '', ' colspan="3"');
                 // total td
                 $html .= EEH_HTML::td(EEH_Template::format_currency($owing, false, false), '', 'total jst-rght');
                 // end of row
                 $html .= EEH_HTML::trx();
             }
         }
     }
     $this->_grand_total = $owing;
     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 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;
 }
 /**
  * 	_payments_and_amount_owing_rows
  *
  * @param EE_Line_Item $line_item
  * @return mixed
  */
 private function _payments_and_amount_owing_rows(EE_Line_Item $line_item)
 {
     $html = '';
     $transaction = EEM_Transaction::instance()->get_one_by_ID($line_item->TXN_ID());
     if ($transaction instanceof EE_Transaction) {
         $payments = $transaction->approved_payments();
         if (!empty($payments)) {
             foreach ($payments as $payment) {
                 if ($payment instanceof EE_Payment) {
                     //$owing = $owing - $payment->amount();
                     $payment_desc = sprintf(__('Payment%1$s Received: %2$s', 'event_espresso'), $payment->txn_id_chq_nmbr() != '' ? ' <span class="small-text">(#' . $payment->txn_id_chq_nmbr() . ')</span> ' : '', $payment->timestamp());
                     // start of row
                     $html .= EEH_HTML::tr('', '', 'total_tr odd');
                     // payment desc
                     $html .= EEH_HTML::td($payment_desc, '', '', '', ' colspan="3"');
                     // total td
                     $html .= EEH_HTML::td(EEH_Template::format_currency($payment->amount(), false, false), '', 'total jst-rght');
                     // end of row
                     $html .= EEH_HTML::trx();
                 }
             }
             //if ( $line_item->total() ) {
             //	// start of row
             //	$html .= EEH_HTML::tr( '', '', 'total_tr odd' );
             //	// total td
             //	$html .= EEH_HTML::td( __('Amount Owing', 'event_espresso'), '',  'total_currency total jst-rght',  '',  ' colspan="3"' );
             //	// total td
             //	$html .= EEH_HTML::td( EEH_Template::format_currency( $this->grand_total(), false, false ), '',  'total jst-rght' );
             //	// end of row
             //	$html .= EEH_HTML::trx();
             //}
         }
     }
     return $html;
 }
 /**
  * 	_total_row
  *
  * @param EE_Line_Item $line_item
  * @param array        $options
  * @return mixed
  */
 protected function _total_row(EE_Line_Item $line_item, $options = array())
 {
     $registration = isset($options['EE_Registration']) ? $options['EE_Registration'] : null;
     $registration_total = $registration instanceof EE_Registration ? $registration->pretty_final_price() : 0;
     //if no valid registration object then we're not going to show the approximate text.
     $total_match = $registration instanceof EE_Registration ? $registration->final_price() == $line_item->total() : true;
     // start of row
     $html = EEH_HTML::tr('', '', 'admin-primary-mbox-total-tr');
     // Total th label
     if ($total_match) {
         $total_label = sprintf(__('This registration\'s total %s:', 'event_espresso'), '(' . EE_Registry::instance()->CFG->currency->code . ')');
     } else {
         $total_label = sprintf(__('This registration\'s approximate total %s', 'event_espresso'), '(' . EE_Registry::instance()->CFG->currency->code . ')');
         $total_label .= '<br>';
         $total_label .= '<p class="ee-footnote-text">' . sprintf(__('The registrations\' share of the transaction total is approximate because it might not be possible to evenly divide the transaction total among each registration, and so some registrations may need to pay a penny more than others.  This registration\'s final share is actually %1$s%2$s%3$s.', 'event_espresso'), '<strong>', $registration_total, '</strong>') . '</p>';
     }
     $html .= EEH_HTML::th($total_label, '', 'jst-rght', '', ' colspan="3"');
     // total th
     $html .= EEH_HTML::th(EEH_Template::format_currency($line_item->total(), false, false), '', 'jst-rght');
     // end of row
     $html .= EEH_HTML::trx();
     return $html;
 }
 /**
  * 	_total_row
  *
  * @param EE_Line_Item $line_item
  * @param array        $options
  * @return mixed
  */
 protected function _total_row(EE_Line_Item $line_item, $options = array())
 {
     // start of row
     $html = EEH_HTML::tr('', '', 'admin-primary-mbox-total-tr');
     // Total th label
     $total_label = sprintf(__('Transaction Total %s', 'event_espresso'), '(' . EE_Registry::instance()->CFG->currency->code . ')');
     $html .= EEH_HTML::th($total_label, '', 'jst-rght', '', ' colspan="4"');
     // total th
     $html .= EEH_HTML::th(EEH_Template::format_currency($line_item->total(), false, false), '', 'jst-rght');
     // end of row
     $html .= EEH_HTML::trx();
     return $html;
 }