1
0
mirror of https://github.com/invoiceninja/invoiceninja.git synced 2024-09-19 16:01:34 +02:00

Show taxes if name is blank

This commit is contained in:
Hillel Coren 2017-08-09 14:31:57 +03:00
parent 29b2d409f6
commit 49da93f318
5 changed files with 22 additions and 21 deletions

View File

@ -154,13 +154,15 @@ class CheckData extends Command
$invoices = Invoice::with('invitations')
->where('created_at', '>', $date)
->orderBy('id')
->get(['id', 'balance']);
->get();
foreach ($invoices as $invoice) {
$link = $invoice->getInvitationLink('view', true, true);
//$this->logMessage('Checking invoice: ' . $invoice->id . ' - ' . $invoice->balance);
$result = CurlUtils::phantom('GET', $link . '?phantomjs=true&phantomjs_balances=true&phantomjs_secret=' . env('PHANTOMJS_SECRET'));
$result = floatval(strip_tags($result));
$invoice->fresh();
//$this->logMessage('Checking invoice: ' . $invoice->id . ' - ' . $invoice->balance);
//$this->logMessage('Result: ' . $result);
if ($result && $result != $invoice->balance) {

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -514,10 +514,10 @@ NINJA.invoiceLines = function(invoice, isSecondTable) {
}
if (showItemTaxes) {
if (item.tax_name1) {
if (parseFloat(item.tax_rate1) != 0) {
tax1 = parseFloat(item.tax_rate1);
}
if (item.tax_name2) {
if (parseFloat(item.tax_rate2) != 0) {
tax2 = parseFloat(item.tax_rate2);
}
}
@ -675,11 +675,11 @@ NINJA.subtotals = function(invoice, hideBalance)
}
}
if (invoice.tax_name1) {
if (parseFloat(invoice.tax_rate1) != 0) {
var taxStr = invoice.tax_name1 + ' ' + (invoice.tax_rate1*1).toString() + '%';
data.push([{text: taxStr, style: ['subtotalsLabel', 'tax1Label']}, {text: formatMoneyInvoice(invoice.tax_amount1, invoice), style: ['subtotals', 'tax1']}]);
}
if (invoice.tax_name2) {
if (parseFloat(invoice.tax_rate2) != 0) {
var taxStr = invoice.tax_name2 + ' ' + (invoice.tax_rate2*1).toString() + '%';
data.push([{text: taxStr, style: ['subtotalsLabel', 'tax2Label']}, {text: formatMoneyInvoice(invoice.tax_amount2, invoice), style: ['subtotals', 'tax2']}]);
}

View File

@ -698,12 +698,12 @@ function calculateAmounts(invoice) {
invoice.has_product_key = true;
}
if (item.tax_name1) {
if (parseFloat(item.tax_rate1) != 0) {
taxRate1 = parseFloat(item.tax_rate1);
taxName1 = item.tax_name1;
}
if (item.tax_name2) {
if (parseFloat(item.tax_rate2) != 0) {
taxRate2 = parseFloat(item.tax_rate2);
taxName2 = item.tax_name2;
}
@ -719,7 +719,7 @@ function calculateAmounts(invoice) {
}
var taxAmount1 = roundToTwo(lineTotal * taxRate1 / 100);
if (taxName1) {
if (taxAmount1 != 0) {
var key = taxName1 + taxRate1;
if (taxes.hasOwnProperty(key)) {
taxes[key].amount += taxAmount1;
@ -729,7 +729,7 @@ function calculateAmounts(invoice) {
}
var taxAmount2 = roundToTwo(lineTotal * taxRate2 / 100);
if (taxName2) {
if (taxAmount2 != 0) {
var key = taxName2 + taxRate2;
if (taxes.hasOwnProperty(key)) {
taxes[key].amount += taxAmount2;
@ -742,7 +742,6 @@ function calculateAmounts(invoice) {
hasTaxes = true;
}
}
invoice.subtotal_amount = total;
var discount = 0;
@ -765,10 +764,10 @@ function calculateAmounts(invoice) {
taxRate1 = 0;
taxRate2 = 0;
if (invoice.tax_rate1 && parseFloat(invoice.tax_rate1)) {
if (parseFloat(invoice.tax_rate1) != 0) {
taxRate1 = parseFloat(invoice.tax_rate1);
}
if (invoice.tax_rate2 && parseFloat(invoice.tax_rate2)) {
if (parseFloat(invoice.tax_rate2) != 0) {
taxRate2 = parseFloat(invoice.tax_rate2);
}
taxAmount1 = roundToTwo(total * taxRate1 / 100);