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
| $settlementsByTime = array(); | |
| foreach($responseObject->getSettleDetailResult->Settle as $settlement) { | |
| // if(!in_array($settlement->SettleDate, $settlementDates)) | |
| // array_push($settlementDates, $settlement->SettleDate); | |
| $settlementsByTime[strtotime($settlement->SettleDate)] += $settlement->Transaction->Amount; | |
| } |
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
| /** | |
| * Documents Pagination Class | |
| * @param template | |
| * @param container | |
| * @constructor | |
| */ | |
| function DocumentsPager(template, container) { | |
| this.container = container; | |
| this.template = $(template).html(); | |
| this.data = {}; |
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
| parseUnits = function() { | |
| if(jsonResultsReady == false) return; | |
| if(currentResult && nResults) | |
| if(currentResult >= nResults) return; | |
| //for pager: | |
| var showStart = currentResult + 1, | |
| showEnd = currentResult + itemsPerResponse; | |
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
| parseUnits = function() { | |
| if(jsonResultsReady == false) return; | |
| if(currentResult && nResults) | |
| if(currentResult >= nResults) return; | |
| //for pager: | |
| var showStart = currentResult + 1, | |
| showEnd = currentResult + itemsPerResponse; | |
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
| //query our json | |
| var filterUnits = function(units) { | |
| var json = _.clone(units), | |
| searchPattern = null, | |
| keyValueRegex = /(\w*:\w+)/g, | |
| splitSearch = _.without(searchQuery.split(keyValueRegex), ""); | |
| function match(s) { | |
| return (s) ? s.match(searchPattern) : false; | |
| } |
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
| $transactions->uasort(function($a, $b) { | |
| if($a->getCreatedAt("U") == $b->getCreatedAt("U")) | |
| return 0; | |
| return ($a->getCreatedAt("U") > $b->getCreatedAt("U")) ? -1 : 1; | |
| }); |
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
| SELECT | |
| *, | |
| (@runningTotal := @runningTotal + t1.amount) AS balance | |
| FROM | |
| (SELECT * | |
| FROM `transaction` AS t | |
| WHERE t.company_id = :companyId | |
| AND t.tenant_id = :tenantId | |
| AND t.created_at > :startDate | |
| AND t.deleted_at IS NULL |
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
| SET @runningTotal:=-0.48; | |
| SELECT | |
| t1.*, | |
| (@orunningTotal := @runningTotal + t1.amount) AS balance | |
| FROM | |
| (SELECT * | |
| FROM `transaction` AS t | |
| WHERE t.company_id = 1 | |
| AND t.tenant_id = 2 | |
| AND t.created_at > "2012/01/19 00:00:00" |
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
| -- **************************************************************************************************** | |
| -- DO NOT RUN THE SQL STATEMENT BELOW WHEN DEPLOYING!!! * | |
| -- Use the statements below to quickly restore database address fields to a previous state. * | |
| -- Note, that is you restore database address fields state, then you'll need to reverse PHP code too. * | |
| -- These queries are provided for a 'just in case' event. * | |
| -- **************************************************************************************************** |
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
| uploader.bind('FileUploaded', function(Uploader, file, response) { | |
| //check to see if the response was legit json | |
| try { | |
| $.parseJSON(response.response); | |
| } catch(e) { | |
| var responseError = _.clone(response); | |
| return fireError(responseError.response); | |
| } | |
| function fireError(response) { |