Sunnysideup\EcommerceTax\Modifiers\GSTTaxModifier
- Author: Nicolaas [at] sunnysideup.co.nz
Synopsis
class GSTTaxModifier
extends OrderModifier
{
- // members
- protected string $debugMessage = '';
- private static bool $show_in_cart_table = true;
- private static string $based_on_country_note = '';
- private static string $table_name = 'GSTTaxModifier';
- private static array $db = ;
- private static array $defaults = ;
- private static array $many_many = ;
- private static string $singular_name = 'Tax Charge';
- private static string $plural_name = 'Tax Charges';
- private static string $default_country_code = '';
- private static string $exclusive_explanation = '';
- private static string $inclusive_explanation = '';
- private static string $refund_title = 'Tax Exemption';
- private static string $no_tax_description = 'Tax-exempt';
- private static string $order_item_function_for_tax_exclusive_portion = 'portionWithoutTax';
- private static bool $alternative_country_prices_already_include_their_own_tax = false;
- private static DataList $default_tax_objects;
- private static $default_tax_objects_rate;
- private static DataList $current_tax_objects;
- private static $current_tax_objects_rate;
- private static array $temp_raw_table_value = ;
- private static string $field_or_method_to_use_for_sub_title = '';
- // methods
- public void i18n_singular_name()
- public void i18n_plural_name()
- public FieldList getCMSFields()
- public void runUpdate()
- public bool CanBeRemoved()
- public void ShowInTable()
- public void dealWithProductVariationException()
- public void getTableSubTitle()
- public void simpleTaxCalculation()
- public void getTotalTaxPerLineItem()
- protected static void get_default_country_code_combined()
- protected DataList defaultTaxObjects()
- protected DataList currentTaxObjects()
- protected float workOutSumRate()
- protected bool isExclusive()
- protected bool isInclusive()
- protected float turnRateIntoCalculationRate()
- protected float workoutOrderItemsTax()
- protected void workoutActualRateForOneBuyable()
- protected void workoutTheTotalAmountPerItem()
- protected float workoutModifiersTax()
- protected bool hasExceptionTaxes()
- protected string LiveDefaultCountry()
- protected string LiveCountry()
- protected float LiveDefaultRate()
- protected float LiveCurrentRate()
- protected string LiveTaxType()
- protected float LiveRawTableValue()
- protected string LiveDebugString()
- protected float LiveTableValue()
- protected string LiveName()
- protected DBCurrency LiveCalculatedTotal()
- protected void LiveType()
Hierarchy
Extends
- Sunnysideup\Ecommerce\Model\OrderModifier
Members
private
- $alternative_country_prices_already_include_their_own_tax
—
Sunnysideup\EcommerceTax\Modifiers\bool
Use this variable IF:. - $based_on_country_note
—
string
message explaining how GST is based on a sale to a particular country ... - $current_tax_objects
—
\SilverStripe\ORM\DataList
contains all the applicable tax objects for the current order. - $current_tax_objects_rate
—
float
tells us the current tax objects tax rate. - $db
- $default_country_code
—
string
default country for tax calculations IMPORTANT: we need this variable - because in case of INCLUSIVE prices, we need to know on what country the prices are based as to be able to remove the tax for other countries. - $default_tax_objects
—
\SilverStripe\ORM\DataList
contains all the applicable DEFAULT tax objects. - $default_tax_objects_rate
—
float
tells us the default tax objects tax rate. - $defaults
- $exclusive_explanation
—
string
wording in cart for prices that are tax exclusive (tax added on top of prices). - $field_or_method_to_use_for_sub_title
- $inclusive_explanation
—
string
wording in cart for prices that are tax inclusive (tax is part of the prices). - $many_many
- $no_tax_description
—
string
wording in cart for prices that are tax exempt (no tax applies). - $order_item_function_for_tax_exclusive_portion
—
string
name of the method in the buyable OrderItem that works out the portion without tax. You can use this method by creating your own OrderItem class and adding a method there. This is by far the most flexible way to work out the tax on products with complex tax rules. - $plural_name
—
string
standard SS variable. - $refund_title
—
string
wording in cart for prices that are include a tax refund. - $show_in_cart_table — Sunnysideup\EcommerceTax\Modifiers\bool
- $singular_name
—
string
standard SS variable. - $table_name
—
string
standard SS variable. - $temp_raw_table_value
—
array
temporary store of data for additional speed.
protected
- $debugMessage
—
string
any calculation messages are added to the Debug Message.
Methods
protected
- LiveCalculatedTotal() — Used to save CalculatedTotal to database.
- LiveCountry() — Used to save Country to database.
- LiveCurrentRate() — Used to save CurrentRate to database.
- LiveDebugString() — Used to save DebugString to database.
- LiveDefaultCountry() — Used to save DefaultCountry to database.
- LiveDefaultRate() — determines value for the default rate.
- LiveName() — Used to save Name to database.
- LiveRawTableValue() — Used to save RawTableValue to database.
- LiveTableValue() — Used to save TableValue to database.
- LiveTaxType() — Used to save TaxType to database.
- LiveType()
- currentTaxObjects() — returns an ArrayList of all applicable tax options.
- defaultTaxObjects() — works out what taxes apply in the default setup.
- get_default_country_code_combined()
- hasExceptionTaxes() — Are there Any taxes that do not apply to all products.
- isExclusive() — tells us if the tax for the current order is exclusive default: false.
- isInclusive() — tells us if the tax for the current order is inclusive default: true.
- turnRateIntoCalculationRate() — turns a standard rate into a calculation rate.
- workOutSumRate() — returns the sum of rates for the given taxObjects.
- workoutActualRateForOneBuyable()
- workoutModifiersTax() — works out the tax to pay for the order modifiers, based on a rate.
- workoutOrderItemsTax() — works out the tax to pay for the order items, based on a rate and a country.
- workoutTheTotalAmountPerItem()
public
- CanBeRemoved() — Can the user remove this modifier? standard OrderModifier Method.
- ShowInTable() — Show the GSTTaxModifier in the Cart? standard OrderModifier Method.
- dealWithProductVariationException() — this method is a bit of a hack.
- getCMSFields() — standard SS method.
- getTableSubTitle()
- getTotalTaxPerLineItem()
- i18n_plural_name()
- i18n_singular_name()
- runUpdate() — updates database fields.
- simpleTaxCalculation()