From 490269ad63e31a5fe548b3dbb972991d01a5802f Mon Sep 17 00:00:00 2001 From: Hillel Coren Date: Sun, 5 Nov 2017 14:17:02 +0200 Subject: [PATCH] Add back commented out balance check code --- resources/views/invoices/edit.blade.php | 25 ++++++++++++++++++++++--- 1 file changed, 22 insertions(+), 3 deletions(-) diff --git a/resources/views/invoices/edit.blade.php b/resources/views/invoices/edit.blade.php index 3b1bff9e0221..7ff14fbdf28a 100644 --- a/resources/views/invoices/edit.blade.php +++ b/resources/views/invoices/edit.blade.php @@ -1191,6 +1191,8 @@ } var origInvoiceNumber = false; + var checkedInvoiceBalances = false; + function getPDFString(cb, force) { @if (! $invoice->id && $account->credit_number_counter > 0) var total = model.invoice().totals.rawTotal(); @@ -1204,13 +1206,30 @@ } @endif + var invoice = createInvoiceModel(); + var design = getDesignJavascript(); + + /* + @if ($invoice->exists) + if (! checkedInvoiceBalances) { + checkedInvoiceBalances = true; + var phpBalance = roundSignificant(invoice.balance); + var koBalance = roundSignificant(model.invoice().totals.rawTotal()); + var jsBalance = roundSignificant(calculateAmounts(invoice).total_amount); + if (phpBalance == koBalance && koBalance == jsBalance) { + // do nothing + } else { + var invitationKey = invoice.invitations[0].invitation_key; + window.onerror(invitationKey + ': Balances do not match | PHP: ' + phpBalance + ', JS: ' + jsBalance + ', KO: ' + koBalance); + } + } + @endif + */ + @if ( ! $account->live_preview) return; @endif - var invoice = createInvoiceModel(); - var design = getDesignJavascript(); - if (! design) { return; }