mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-07-09 03:14:30 -04:00
Fixes for amounts when formatted with comma's
This commit is contained in:
parent
a2fbfbac10
commit
02e8e6e000
@ -20,7 +20,9 @@ use App\Utils\Number;
|
|||||||
use App\Utils\TempFile;
|
use App\Utils\TempFile;
|
||||||
use App\Utils\Traits\MakesDates;
|
use App\Utils\Traits\MakesDates;
|
||||||
use App\Utils\Traits\MakesHash;
|
use App\Utils\Traits\MakesHash;
|
||||||
|
use Illuminate\Contracts\Container\BindingResolutionException;
|
||||||
use Illuminate\Contracts\View\Factory;
|
use Illuminate\Contracts\View\Factory;
|
||||||
|
use Illuminate\Http\RedirectResponse;
|
||||||
use Illuminate\View\View;
|
use Illuminate\View\View;
|
||||||
use ZipStream\Option\Archive;
|
use ZipStream\Option\Archive;
|
||||||
use ZipStream\ZipStream;
|
use ZipStream\ZipStream;
|
||||||
@ -86,6 +88,10 @@ class InvoiceController extends Controller
|
|||||||
->with('message', ctrans('texts.no_action_provided'));
|
->with('message', ctrans('texts.no_action_provided'));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param array $ids
|
||||||
|
* @return Factory|View|RedirectResponse
|
||||||
|
*/
|
||||||
private function makePayment(array $ids)
|
private function makePayment(array $ids)
|
||||||
{
|
{
|
||||||
$invoices = Invoice::whereIn('id', $ids)
|
$invoices = Invoice::whereIn('id', $ids)
|
||||||
@ -119,8 +125,8 @@ class InvoiceController extends Controller
|
|||||||
//format data
|
//format data
|
||||||
$invoices->map(function ($invoice) {
|
$invoices->map(function ($invoice) {
|
||||||
$invoice->service()->removeUnpaidGatewayFees()->save();
|
$invoice->service()->removeUnpaidGatewayFees()->save();
|
||||||
$invoice->balance = Number::formatValue($invoice->balance, $invoice->client->currency());
|
$invoice->balance = $invoice->balance > 0 ? Number::formatValue($invoice->balance, $invoice->client->currency()) : 0;
|
||||||
$invoice->partial = Number::formatValue($invoice->partial, $invoice->client->currency());
|
$invoice->partial = $invoice->partial > 0 ? Number::formatValue($invoice->partial, $invoice->client->currency()) : 0;
|
||||||
|
|
||||||
return $invoice;
|
return $invoice;
|
||||||
});
|
});
|
||||||
|
@ -56,8 +56,8 @@ class AutoBillCron
|
|||||||
|
|
||||||
nlog($auto_bill_partial_invoices->count(). " partial invoices to auto bill");
|
nlog($auto_bill_partial_invoices->count(). " partial invoices to auto bill");
|
||||||
|
|
||||||
$auto_bill_partial_invoices->cursor()->each(function ($invoice) use($db){
|
$auto_bill_partial_invoices->cursor()->each(function ($invoice){
|
||||||
$this->runAutoBiller($invoice, $db);
|
$this->runAutoBiller($invoice, false);
|
||||||
});
|
});
|
||||||
|
|
||||||
$auto_bill_invoices = Invoice::whereDate('due_date', '<=', now())
|
$auto_bill_invoices = Invoice::whereDate('due_date', '<=', now())
|
||||||
@ -69,8 +69,8 @@ class AutoBillCron
|
|||||||
|
|
||||||
nlog($auto_bill_invoices->count(). " full invoices to auto bill");
|
nlog($auto_bill_invoices->count(). " full invoices to auto bill");
|
||||||
|
|
||||||
$auto_bill_invoices->cursor()->each(function ($invoice) use($db){
|
$auto_bill_invoices->cursor()->each(function ($invoice){
|
||||||
$this->runAutoBiller($invoice, $db);
|
$this->runAutoBiller($invoice, false);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
@ -115,8 +115,12 @@ class AutoBillCron
|
|||||||
info("Firing autobill for {$invoice->company_id} - {$invoice->number}");
|
info("Firing autobill for {$invoice->company_id} - {$invoice->number}");
|
||||||
|
|
||||||
try{
|
try{
|
||||||
MultiDB::setDB($db);
|
|
||||||
|
if($db)
|
||||||
|
MultiDB::setDB($db);
|
||||||
|
|
||||||
$invoice->service()->autoBill()->save();
|
$invoice->service()->autoBill()->save();
|
||||||
|
|
||||||
}
|
}
|
||||||
catch(\Exception $e) {
|
catch(\Exception $e) {
|
||||||
nlog("Failed to capture payment for {$invoice->company_id} - {$invoice->number} ->" . $e->getMessage());
|
nlog("Failed to capture payment for {$invoice->company_id} - {$invoice->number} ->" . $e->getMessage());
|
||||||
|
@ -147,6 +147,8 @@ class SendRecurring implements ShouldQueue
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//important catch all here - we should never leave contacts send_email to false incase they are permanently set to false in the future.
|
||||||
|
$this->recurring_invoice->client->contacts()->update(['send_email' => true]);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -28,7 +28,8 @@ class BaseRepository
|
|||||||
{
|
{
|
||||||
use MakesHash;
|
use MakesHash;
|
||||||
use SavesDocuments;
|
use SavesDocuments;
|
||||||
public $import_mode = false;
|
|
||||||
|
public $import_mode = false;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param $entity
|
* @param $entity
|
||||||
|
@ -170,10 +170,10 @@ class PaymentRepository extends BaseRepository {
|
|||||||
event( new PaymentWasCreated( $payment, $payment->company, Ninja::eventVars(auth()->user() ? auth()->user()->id : null) ) );
|
event( new PaymentWasCreated( $payment, $payment->company, Ninja::eventVars(auth()->user() ? auth()->user()->id : null) ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
nlog("payment amount = {$payment->amount}");
|
// nlog("payment amount = {$payment->amount}");
|
||||||
nlog("payment applied = {$payment->applied}");
|
// nlog("payment applied = {$payment->applied}");
|
||||||
nlog("invoice totals = {$invoice_totals}");
|
// nlog("invoice totals = {$invoice_totals}");
|
||||||
nlog("credit totals = {$credit_totals}");
|
// nlog("credit totals = {$credit_totals}");
|
||||||
|
|
||||||
$payment->applied += ($invoice_totals - $credit_totals); //wont work because - check tests
|
$payment->applied += ($invoice_totals - $credit_totals); //wont work because - check tests
|
||||||
// $payment->applied += $invoice_totals; //wont work because - check tests
|
// $payment->applied += $invoice_totals; //wont work because - check tests
|
||||||
|
Loading…
x
Reference in New Issue
Block a user