|
@@ 557-572 (lines=16) @@
|
| 554 |
|
* @return \EE_Line_Item of type total |
| 555 |
|
* @throws \EE_Error |
| 556 |
|
*/ |
| 557 |
|
public static function create_total_line_item( $transaction = NULL ){ |
| 558 |
|
$total_line_item = EE_Line_Item::new_instance( array( |
| 559 |
|
'LIN_code' => 'total', |
| 560 |
|
'LIN_name' => __('Grand Total', 'event_espresso'), |
| 561 |
|
'LIN_type' => EEM_Line_Item::type_total, |
| 562 |
|
'OBJ_type' =>'Transaction' |
| 563 |
|
)); |
| 564 |
|
$total_line_item = apply_filters( |
| 565 |
|
'FHEE__EEH_Line_Item__create_total_line_item__total_line_item', |
| 566 |
|
$total_line_item |
| 567 |
|
); |
| 568 |
|
self::set_TXN_ID( $total_line_item, $transaction ); |
| 569 |
|
self::create_pre_tax_subtotal( $total_line_item, $transaction ); |
| 570 |
|
self::create_taxes_subtotal( $total_line_item, $transaction ); |
| 571 |
|
return $total_line_item; |
| 572 |
|
} |
| 573 |
|
|
| 574 |
|
|
| 575 |
|
|
|
@@ 584-598 (lines=15) @@
|
| 581 |
|
* @return EE_Line_Item |
| 582 |
|
* @throws \EE_Error |
| 583 |
|
*/ |
| 584 |
|
protected static function create_pre_tax_subtotal( EE_Line_Item $total_line_item, $transaction = NULL ){ |
| 585 |
|
$pre_tax_line_item = EE_Line_Item::new_instance( array( |
| 586 |
|
'LIN_code' => 'pre-tax-subtotal', |
| 587 |
|
'LIN_name' => __( 'Pre-Tax Subtotal', 'event_espresso' ), |
| 588 |
|
'LIN_type' => EEM_Line_Item::type_sub_total |
| 589 |
|
) ); |
| 590 |
|
$pre_tax_line_item = apply_filters( |
| 591 |
|
'FHEE__EEH_Line_Item__create_pre_tax_subtotal__pre_tax_line_item', |
| 592 |
|
$pre_tax_line_item |
| 593 |
|
); |
| 594 |
|
self::set_TXN_ID( $pre_tax_line_item, $transaction ); |
| 595 |
|
$total_line_item->add_child_line_item( $pre_tax_line_item ); |
| 596 |
|
self::create_event_subtotal( $pre_tax_line_item, $transaction ); |
| 597 |
|
return $pre_tax_line_item; |
| 598 |
|
} |
| 599 |
|
|
| 600 |
|
|
| 601 |
|
|
|
@@ 611-627 (lines=17) @@
|
| 608 |
|
* @return EE_Line_Item |
| 609 |
|
* @throws \EE_Error |
| 610 |
|
*/ |
| 611 |
|
protected static function create_taxes_subtotal( EE_Line_Item $total_line_item, $transaction = NULL ){ |
| 612 |
|
$tax_line_item = EE_Line_Item::new_instance(array( |
| 613 |
|
'LIN_code' => 'taxes', |
| 614 |
|
'LIN_name' => __('Taxes', 'event_espresso'), |
| 615 |
|
'LIN_type' => EEM_Line_Item::type_tax_sub_total, |
| 616 |
|
'LIN_order' => 1000,//this should always come last |
| 617 |
|
)); |
| 618 |
|
$tax_line_item = apply_filters( |
| 619 |
|
'FHEE__EEH_Line_Item__create_taxes_subtotal__tax_line_item', |
| 620 |
|
$tax_line_item |
| 621 |
|
); |
| 622 |
|
self::set_TXN_ID( $tax_line_item, $transaction ); |
| 623 |
|
$total_line_item->add_child_line_item( $tax_line_item ); |
| 624 |
|
//and lastly, add the actual taxes |
| 625 |
|
self::apply_taxes( $total_line_item ); |
| 626 |
|
return $tax_line_item; |
| 627 |
|
} |
| 628 |
|
|
| 629 |
|
|
| 630 |
|
|