mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2024-11-09 20:52:56 +01:00
Show taxes if name is blank
This commit is contained in:
parent
29b2d409f6
commit
49da93f318
@ -154,13 +154,15 @@ class CheckData extends Command
|
|||||||
$invoices = Invoice::with('invitations')
|
$invoices = Invoice::with('invitations')
|
||||||
->where('created_at', '>', $date)
|
->where('created_at', '>', $date)
|
||||||
->orderBy('id')
|
->orderBy('id')
|
||||||
->get(['id', 'balance']);
|
->get();
|
||||||
|
|
||||||
foreach ($invoices as $invoice) {
|
foreach ($invoices as $invoice) {
|
||||||
$link = $invoice->getInvitationLink('view', true, true);
|
$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 = CurlUtils::phantom('GET', $link . '?phantomjs=true&phantomjs_balances=true&phantomjs_secret=' . env('PHANTOMJS_SECRET'));
|
||||||
$result = floatval(strip_tags($result));
|
$result = floatval(strip_tags($result));
|
||||||
|
$invoice->fresh();
|
||||||
|
|
||||||
|
//$this->logMessage('Checking invoice: ' . $invoice->id . ' - ' . $invoice->balance);
|
||||||
//$this->logMessage('Result: ' . $result);
|
//$this->logMessage('Result: ' . $result);
|
||||||
|
|
||||||
if ($result && $result != $invoice->balance) {
|
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
@ -514,10 +514,10 @@ NINJA.invoiceLines = function(invoice, isSecondTable) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (showItemTaxes) {
|
if (showItemTaxes) {
|
||||||
if (item.tax_name1) {
|
if (parseFloat(item.tax_rate1) != 0) {
|
||||||
tax1 = parseFloat(item.tax_rate1);
|
tax1 = parseFloat(item.tax_rate1);
|
||||||
}
|
}
|
||||||
if (item.tax_name2) {
|
if (parseFloat(item.tax_rate2) != 0) {
|
||||||
tax2 = parseFloat(item.tax_rate2);
|
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() + '%';
|
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']}]);
|
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() + '%';
|
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']}]);
|
data.push([{text: taxStr, style: ['subtotalsLabel', 'tax2Label']}, {text: formatMoneyInvoice(invoice.tax_amount2, invoice), style: ['subtotals', 'tax2']}]);
|
||||||
}
|
}
|
||||||
|
@ -698,12 +698,12 @@ function calculateAmounts(invoice) {
|
|||||||
invoice.has_product_key = true;
|
invoice.has_product_key = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (item.tax_name1) {
|
if (parseFloat(item.tax_rate1) != 0) {
|
||||||
taxRate1 = parseFloat(item.tax_rate1);
|
taxRate1 = parseFloat(item.tax_rate1);
|
||||||
taxName1 = item.tax_name1;
|
taxName1 = item.tax_name1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (item.tax_name2) {
|
if (parseFloat(item.tax_rate2) != 0) {
|
||||||
taxRate2 = parseFloat(item.tax_rate2);
|
taxRate2 = parseFloat(item.tax_rate2);
|
||||||
taxName2 = item.tax_name2;
|
taxName2 = item.tax_name2;
|
||||||
}
|
}
|
||||||
@ -719,7 +719,7 @@ function calculateAmounts(invoice) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
var taxAmount1 = roundToTwo(lineTotal * taxRate1 / 100);
|
var taxAmount1 = roundToTwo(lineTotal * taxRate1 / 100);
|
||||||
if (taxName1) {
|
if (taxAmount1 != 0) {
|
||||||
var key = taxName1 + taxRate1;
|
var key = taxName1 + taxRate1;
|
||||||
if (taxes.hasOwnProperty(key)) {
|
if (taxes.hasOwnProperty(key)) {
|
||||||
taxes[key].amount += taxAmount1;
|
taxes[key].amount += taxAmount1;
|
||||||
@ -729,7 +729,7 @@ function calculateAmounts(invoice) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
var taxAmount2 = roundToTwo(lineTotal * taxRate2 / 100);
|
var taxAmount2 = roundToTwo(lineTotal * taxRate2 / 100);
|
||||||
if (taxName2) {
|
if (taxAmount2 != 0) {
|
||||||
var key = taxName2 + taxRate2;
|
var key = taxName2 + taxRate2;
|
||||||
if (taxes.hasOwnProperty(key)) {
|
if (taxes.hasOwnProperty(key)) {
|
||||||
taxes[key].amount += taxAmount2;
|
taxes[key].amount += taxAmount2;
|
||||||
@ -742,7 +742,6 @@ function calculateAmounts(invoice) {
|
|||||||
hasTaxes = true;
|
hasTaxes = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
invoice.subtotal_amount = total;
|
invoice.subtotal_amount = total;
|
||||||
|
|
||||||
var discount = 0;
|
var discount = 0;
|
||||||
@ -765,10 +764,10 @@ function calculateAmounts(invoice) {
|
|||||||
|
|
||||||
taxRate1 = 0;
|
taxRate1 = 0;
|
||||||
taxRate2 = 0;
|
taxRate2 = 0;
|
||||||
if (invoice.tax_rate1 && parseFloat(invoice.tax_rate1)) {
|
if (parseFloat(invoice.tax_rate1) != 0) {
|
||||||
taxRate1 = parseFloat(invoice.tax_rate1);
|
taxRate1 = parseFloat(invoice.tax_rate1);
|
||||||
}
|
}
|
||||||
if (invoice.tax_rate2 && parseFloat(invoice.tax_rate2)) {
|
if (parseFloat(invoice.tax_rate2) != 0) {
|
||||||
taxRate2 = parseFloat(invoice.tax_rate2);
|
taxRate2 = parseFloat(invoice.tax_rate2);
|
||||||
}
|
}
|
||||||
taxAmount1 = roundToTwo(total * taxRate1 / 100);
|
taxAmount1 = roundToTwo(total * taxRate1 / 100);
|
||||||
|
Loading…
Reference in New Issue
Block a user