Skip to content

Instantly share code, notes, and snippets.

View oojacoboo's full-sized avatar

Jacob Thomason oojacoboo

View GitHub Profile
$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;
}
/**
* Documents Pagination Class
* @param template
* @param container
* @constructor
*/
function DocumentsPager(template, container) {
this.container = container;
this.template = $(template).html();
this.data = {};
parseUnits = function() {
if(jsonResultsReady == false) return;
if(currentResult && nResults)
if(currentResult >= nResults) return;
//for pager:
var showStart = currentResult + 1,
showEnd = currentResult + itemsPerResponse;
parseUnits = function() {
if(jsonResultsReady == false) return;
if(currentResult && nResults)
if(currentResult >= nResults) return;
//for pager:
var showStart = currentResult + 1,
showEnd = currentResult + itemsPerResponse;
//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;
}
$transactions->uasort(function($a, $b) {
if($a->getCreatedAt("U") == $b->getCreatedAt("U"))
return 0;
return ($a->getCreatedAt("U") > $b->getCreatedAt("U")) ? -1 : 1;
});
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
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"
-- ****************************************************************************************************
-- 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. *
-- ****************************************************************************************************
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) {