mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-05-24 02:14:21 -04:00
fix for calculating invoice payments (include partial and full refunds).
This commit is contained in:
parent
fe457537b6
commit
df55785df9
@ -325,8 +325,8 @@ class CheckData extends Command
|
||||
// $total_amount = $invoice->payments->whereNull('deleted_at')->sum('pivot.amount');
|
||||
// $total_refund = $invoice->payments->whereNull('deleted_at')->sum('pivot.refunded');
|
||||
|
||||
$total_amount = $invoice->payments->where('is_deleted', false)->whereIn('status_id', [Payment::STATUS_COMPLETED, Payment:: STATUS_PENDING, Payment::STATUS_PARTIALLY_REFUNDED])->sum('pivot.amount');
|
||||
$total_refund = $invoice->payments->where('is_deleted', false)->whereIn('status_id', [Payment::STATUS_COMPLETED, Payment:: STATUS_PENDING, Payment::STATUS_PARTIALLY_REFUNDED])->sum('pivot.refunded');
|
||||
$total_amount = $invoice->payments->where('is_deleted', false)->whereIn('status_id', [Payment::STATUS_COMPLETED, Payment:: STATUS_PENDING, Payment::STATUS_PARTIALLY_REFUNDED, Payment::STATUS_REFUNDED])->sum('pivot.amount');
|
||||
$total_refund = $invoice->payments->where('is_deleted', false)->whereIn('status_id', [Payment::STATUS_COMPLETED, Payment:: STATUS_PENDING, Payment::STATUS_PARTIALLY_REFUNDED, Payment::STATUS_REFUNDED])->sum('pivot.refunded');
|
||||
|
||||
$total_invoice_payments += ($total_amount - $total_refund);
|
||||
}
|
||||
|
@ -12,7 +12,6 @@
|
||||
* @OA\Property(property="project_id", type="string", example="", description="________"),
|
||||
* @OA\Property(property="number", type="string", example="", description="________"),
|
||||
* @OA\Property(property="time_log", type="string", example="", description="________"),
|
||||
* @OA\Property(property="start_time", type="integer", example="", description="________"),
|
||||
* @OA\Property(property="is_running", type="boolean", example=true, description="________"),
|
||||
* @OA\Property(property="is_deleted", type="boolean", example=true, description="________"),
|
||||
* @OA\Property(property="task_status_id", type="string", example="", description="________"),
|
||||
|
@ -65,15 +65,8 @@ class Gateway extends StaticModel
|
||||
$link = 'https://dashboard.stripe.com/account/apikeys';
|
||||
}
|
||||
|
||||
// $key = 'texts.gateway_help_'.$this->id;
|
||||
// $str = trans($key, [
|
||||
// 'link' => "<a href='$link' >Click here</a>",
|
||||
// 'complete_link' => url('/complete'),
|
||||
// ]);
|
||||
|
||||
return $link;
|
||||
|
||||
//return $key != $str ? $str : '';
|
||||
}
|
||||
|
||||
|
||||
@ -93,7 +86,7 @@ class Gateway extends StaticModel
|
||||
break;
|
||||
case 20:
|
||||
return [GatewayType::CREDIT_CARD => ['refund' => true, 'token_billing' => true],
|
||||
GatewayType::BANK_TRANSFER => ['refund' => true, 'token_billing' => true],
|
||||
GatewayType::BANK_TRANSFER => ['refund' => true, 'token_billing' => true, 'webhooks' => ['source.chargeable']],
|
||||
GatewayType::ALIPAY => ['refund' => false, 'token_billing' => false],
|
||||
GatewayType::APPLE_PAY => ['refund' => false, 'token_billing' => false]]; //Stripe
|
||||
break;
|
||||
|
@ -75,8 +75,8 @@ class TaskRepository extends BaseRepository
|
||||
}
|
||||
|
||||
$task->time_log = json_encode($time_log);
|
||||
$task->start_time = $task->start_time ?: $task->calcStartTime();
|
||||
$task->duration = $task->calcDuration();
|
||||
// $task->start_time = $task->start_time ?: $task->calcStartTime();
|
||||
// $task->duration = $task->calcDuration();
|
||||
|
||||
$task->save();
|
||||
|
||||
|
@ -47,7 +47,7 @@ class TaskTransformer extends EntityTransformer
|
||||
'user_id' => (string) $this->encodePrimaryKey($task->user_id),
|
||||
'assigned_user_id' => (string) $this->encodePrimaryKey($task->assigned_user_id),
|
||||
'number' => (string) $task->number ?: '',
|
||||
'start_time' => (int) $task->start_time,
|
||||
// 'start_time' => (int) $task->start_time,
|
||||
'description' => (string) $task->description ?: '',
|
||||
'duration' => (int) $task->duration ?: 0,
|
||||
'rate' => (float) $task->rate ?: 0,
|
||||
|
@ -0,0 +1,50 @@
|
||||
<?php
|
||||
|
||||
use App\Models\Company;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class FixCompanySettingsUrl extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
|
||||
Company::all()->each(function ($company){
|
||||
|
||||
$settings = $company->settings;
|
||||
|
||||
$company_logo = $settings->company_logo;
|
||||
$company_logo = str_replace(config('ninja.app_url'), '', $company_logo);
|
||||
|
||||
$settings->company_logo = $company_logo;
|
||||
|
||||
$company->settings = $settings;
|
||||
$company->save();
|
||||
|
||||
});
|
||||
|
||||
Schema::table('companies', function (Blueprint $table) {
|
||||
$table->dropColumn('logo');
|
||||
});
|
||||
|
||||
Schema::table('tasks', function (Blueprint $table) {
|
||||
$table->dropColumn('start_time');
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
//
|
||||
}
|
||||
}
|
8374
swagger.json
8374
swagger.json
File diff suppressed because it is too large
Load Diff
Loading…
x
Reference in New Issue
Block a user