|
@@ 568-583 (lines=16) @@
|
| 565 |
|
* @return \EE_Line_Item of type total |
| 566 |
|
* @throws \EE_Error |
| 567 |
|
*/ |
| 568 |
|
public static function create_total_line_item( $transaction = NULL ){ |
| 569 |
|
$total_line_item = EE_Line_Item::new_instance( array( |
| 570 |
|
'LIN_code' => 'total', |
| 571 |
|
'LIN_name' => __('Grand Total', 'event_espresso'), |
| 572 |
|
'LIN_type' => EEM_Line_Item::type_total, |
| 573 |
|
'OBJ_type' =>'Transaction' |
| 574 |
|
)); |
| 575 |
|
$total_line_item = apply_filters( |
| 576 |
|
'FHEE__EEH_Line_Item__create_total_line_item__total_line_item', |
| 577 |
|
$total_line_item |
| 578 |
|
); |
| 579 |
|
self::set_TXN_ID( $total_line_item, $transaction ); |
| 580 |
|
self::create_pre_tax_subtotal( $total_line_item, $transaction ); |
| 581 |
|
self::create_taxes_subtotal( $total_line_item, $transaction ); |
| 582 |
|
return $total_line_item; |
| 583 |
|
} |
| 584 |
|
|
| 585 |
|
|
| 586 |
|
|
|
@@ 595-609 (lines=15) @@
|
| 592 |
|
* @return EE_Line_Item |
| 593 |
|
* @throws \EE_Error |
| 594 |
|
*/ |
| 595 |
|
protected static function create_pre_tax_subtotal( EE_Line_Item $total_line_item, $transaction = NULL ){ |
| 596 |
|
$pre_tax_line_item = EE_Line_Item::new_instance( array( |
| 597 |
|
'LIN_code' => 'pre-tax-subtotal', |
| 598 |
|
'LIN_name' => __( 'Pre-Tax Subtotal', 'event_espresso' ), |
| 599 |
|
'LIN_type' => EEM_Line_Item::type_sub_total |
| 600 |
|
) ); |
| 601 |
|
$pre_tax_line_item = apply_filters( |
| 602 |
|
'FHEE__EEH_Line_Item__create_pre_tax_subtotal__pre_tax_line_item', |
| 603 |
|
$pre_tax_line_item |
| 604 |
|
); |
| 605 |
|
self::set_TXN_ID( $pre_tax_line_item, $transaction ); |
| 606 |
|
$total_line_item->add_child_line_item( $pre_tax_line_item ); |
| 607 |
|
self::create_event_subtotal( $pre_tax_line_item, $transaction ); |
| 608 |
|
return $pre_tax_line_item; |
| 609 |
|
} |
| 610 |
|
|
| 611 |
|
|
| 612 |
|
|
|
@@ 622-638 (lines=17) @@
|
| 619 |
|
* @return EE_Line_Item |
| 620 |
|
* @throws \EE_Error |
| 621 |
|
*/ |
| 622 |
|
protected static function create_taxes_subtotal( EE_Line_Item $total_line_item, $transaction = NULL ){ |
| 623 |
|
$tax_line_item = EE_Line_Item::new_instance(array( |
| 624 |
|
'LIN_code' => 'taxes', |
| 625 |
|
'LIN_name' => __('Taxes', 'event_espresso'), |
| 626 |
|
'LIN_type' => EEM_Line_Item::type_tax_sub_total, |
| 627 |
|
'LIN_order' => 1000,//this should always come last |
| 628 |
|
)); |
| 629 |
|
$tax_line_item = apply_filters( |
| 630 |
|
'FHEE__EEH_Line_Item__create_taxes_subtotal__tax_line_item', |
| 631 |
|
$tax_line_item |
| 632 |
|
); |
| 633 |
|
self::set_TXN_ID( $tax_line_item, $transaction ); |
| 634 |
|
$total_line_item->add_child_line_item( $tax_line_item ); |
| 635 |
|
//and lastly, add the actual taxes |
| 636 |
|
self::apply_taxes( $total_line_item ); |
| 637 |
|
return $tax_line_item; |
| 638 |
|
} |
| 639 |
|
|
| 640 |
|
|
| 641 |
|
|