Created
February 18, 2013 15:48
-
-
Save connors511/4978339 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
protected static $tax_cache = array(); | |
public function get_tax($start,$end) | |
{ | |
if (!isset(self::$tax_cache[$start->get_timestamp()][$end->get_timestamp()])) { | |
// This should account for multiple users, kitchen->tax_interval and temporal edits | |
$days = \Date::range_to_array($start, $end, "+1 day"); | |
$tax_days = 0; | |
foreach($days as $d) { | |
if (((int)$d->format('%d')) == $this->kitchen->report_day) | |
$tax_days++; | |
} | |
self::$tax_cache[$start->get_timestamp()][$end->get_timestamp()] = $tax_days; | |
} | |
return $this->kitchen->tax * self::$tax_cache[$start->get_timestamp()][$end->get_timestamp()] * $this->tax_payers * -1; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment