Add amount filters for expense
This commit is contained in:
parent
8764a4e4c0
commit
0745dfaa3d
|
|
@ -177,6 +177,15 @@ class ExpenseFilters extends QueryFilters
|
|||
return $this->builder->whereIn('category_id', $categories_keys);
|
||||
}
|
||||
|
||||
public function amount(string $amount = ''): Builder
|
||||
{
|
||||
if (strlen($amount) == 0) {
|
||||
return $this->builder;
|
||||
}
|
||||
|
||||
return $this->builder->where('amount', $amount);
|
||||
}
|
||||
|
||||
public function number(string $number = ''): Builder
|
||||
{
|
||||
if (strlen($number) == 0) {
|
||||
|
|
|
|||
|
|
@ -16,6 +16,7 @@ use App\Models\Document;
|
|||
use App\Models\Expense;
|
||||
use App\Models\ExpenseCategory;
|
||||
use App\Models\Invoice;
|
||||
use App\Models\Project;
|
||||
use App\Models\Vendor;
|
||||
use App\Utils\Traits\MakesHash;
|
||||
use Illuminate\Database\Eloquent\SoftDeletes;
|
||||
|
|
@ -41,6 +42,7 @@ class ExpenseTransformer extends EntityTransformer
|
|||
'vendor',
|
||||
'category',
|
||||
'invoice',
|
||||
'project',
|
||||
];
|
||||
|
||||
public function includeDocuments(Expense $expense)
|
||||
|
|
@ -50,6 +52,17 @@ class ExpenseTransformer extends EntityTransformer
|
|||
return $this->includeCollection($expense->documents, $transformer, Document::class);
|
||||
}
|
||||
|
||||
public function includeProject(Expense $expense): ?Item
|
||||
{
|
||||
$transformer = new ProjectTransformer($this->serializer);
|
||||
|
||||
if (!$expense->project) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return $this->includeItem($expense->project, $transformer, Project::class);
|
||||
}
|
||||
|
||||
public function includeClient(Expense $expense): ?Item
|
||||
{
|
||||
$transformer = new ClientTransformer($this->serializer);
|
||||
|
|
|
|||
|
|
@ -0,0 +1,56 @@
|
|||
<?php
|
||||
|
||||
use App\Models\Currency;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*/
|
||||
public function up(): void
|
||||
{
|
||||
|
||||
Model::unguard();
|
||||
|
||||
$currencies = [
|
||||
['id' => 124, 'name' => 'Bermudian Dollar', 'code' => 'BMD', 'symbol' => '$', 'precision' => '2', 'thousand_separator' => ',', 'decimal_separator' => '.'],
|
||||
['id' => 125, 'name' => 'Central African CFA Franc', 'code' => 'XAF', 'symbol' => 'Fr', 'precision' => '0', 'thousand_separator' => ',', 'decimal_separator' => '.'],
|
||||
['id' => 126, 'name' => 'Congolese Franc', 'code' => 'CDF', 'symbol' => 'Fr', 'precision' => '2', 'thousand_separator' => ',', 'decimal_separator' => '.'],
|
||||
['id' => 127, 'name' => 'Djiboutian Franc', 'code' => 'DJF', 'symbol' => 'Fr', 'precision' => '0', 'thousand_separator' => ',', 'decimal_separator' => '.'],
|
||||
['id' => 128, 'name' => 'Eritrean Nakfa', 'code' => 'ERN', 'symbol' => 'Nfk', 'precision' => '2', 'thousand_separator' => ',', 'decimal_separator' => '.'],
|
||||
['id' => 129, 'name' => 'Falkland Islands Pound', 'code' => 'FKP', 'symbol' => '£', 'precision' => '2', 'thousand_separator' => ',', 'decimal_separator' => '.'],
|
||||
['id' => 130, 'name' => 'Guinean Franc', 'code' => 'GNF', 'symbol' => 'Fr', 'precision' => '0', 'thousand_separator' => ',', 'decimal_separator' => ''],
|
||||
['id' => 131, 'name' => 'Iraqi Dinar', 'code' => 'IQD', 'symbol' => 'ع.د', 'precision' => '3', 'thousand_separator' => ',', 'decimal_separator' => '.'],
|
||||
['id' => 132, 'name' => 'Lesotho Loti', 'code' => 'LSL', 'symbol' => 'L', 'precision' => '2', 'thousand_separator' => ',', 'decimal_separator' => '.'],
|
||||
['id' => 133, 'name' => 'Mongolian Tugrik', 'code' => 'MNT', 'symbol' => '₮', 'precision' => '2', 'thousand_separator' => ',', 'decimal_separator' => '.'],
|
||||
['id' => 134, 'name' => 'Seychellois Rupee', 'code' => 'SCR', 'symbol' => '₨', 'precision' => '2', 'thousand_separator' => ',', 'decimal_separator' => '.'],
|
||||
['id' => 135, 'name' => 'Solomon Islands Dollar', 'code' => 'SBD', 'symbol' => '$', 'precision' => '2', 'thousand_separator' => ',', 'decimal_separator' => '.'],
|
||||
['id' => 136, 'name' => 'Somali Shilling', 'code' => 'SOS', 'symbol' => 'Sh', 'precision' => '2', 'thousand_separator' => ',', 'decimal_separator' => '.'],
|
||||
['id' => 137, 'name' => 'South Sudanese Pound', 'code' => 'SSP', 'symbol' => '£', 'precision' => '2', 'thousand_separator' => ',', 'decimal_separator' => '.'],
|
||||
['id' => 138, 'name' => 'Sudanese Pound', 'code' => 'SDG', 'symbol' => '£', 'precision' => '2', 'thousand_separator' => ',', 'decimal_separator' => '.'],
|
||||
['id' => 139, 'name' => 'Tajikistani Somoni', 'code' => 'TJS', 'symbol' => 'ЅM', 'precision' => '2', 'thousand_separator' => ',', 'decimal_separator' => '.'],
|
||||
['id' => 140, 'name' => 'Turkmenistani Manat', 'code' => 'TMT', 'symbol' => 'T', 'precision' => '2', 'thousand_separator' => ',', 'decimal_separator' => '.'],
|
||||
['id' => 141, 'name' => 'Uzbekistani Som', 'code' => 'UZS', 'symbol' => 'so\'m', 'precision' => '2', 'thousand_separator' => ',', 'decimal_separator' => '.'],
|
||||
];
|
||||
|
||||
foreach ($currencies as $currency) {
|
||||
$record = Currency::where('code', $currency['code'])->first();
|
||||
if (!$record) {
|
||||
Currency::create($currency);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
//
|
||||
}
|
||||
};
|
||||
|
|
@ -146,6 +146,25 @@ class CurrenciesSeeder extends Seeder
|
|||
['id' => 121, 'name' => "Lao kip", 'code' => 'LAK', 'symbol' => '₭', 'precision' => '2', 'thousand_separator' => ',', 'decimal_separator' => '.'],
|
||||
['id' => 122, 'name' => "Bhutan Ngultrum", 'code' => 'BTN', 'symbol' => 'Nu', 'precision' => '2', 'thousand_separator' => ',', 'decimal_separator' => '.'],
|
||||
['id' => 123, 'name' => "Mauritanian Ouguiya", 'code' => 'MRU', 'symbol' => 'UM', 'precision' => '2', 'thousand_separator' => ',', 'decimal_separator' => '.'],
|
||||
['id' => 124, 'name' => 'Bermudian Dollar', 'code' => 'BMD', 'symbol' => '$', 'precision' => '2', 'thousand_separator' => ',', 'decimal_separator' => '.'],
|
||||
['id' => 125, 'name' => 'Central African CFA Franc', 'code' => 'XAF', 'symbol' => 'Fr', 'precision' => '0', 'thousand_separator' => ',', 'decimal_separator' => '.'],
|
||||
['id' => 126, 'name' => 'Congolese Franc', 'code' => 'CDF', 'symbol' => 'Fr', 'precision' => '2', 'thousand_separator' => ',', 'decimal_separator' => '.'],
|
||||
['id' => 127, 'name' => 'Djiboutian Franc', 'code' => 'DJF', 'symbol' => 'Fr', 'precision' => '0', 'thousand_separator' => ',', 'decimal_separator' => '.'],
|
||||
['id' => 128, 'name' => 'Eritrean Nakfa', 'code' => 'ERN', 'symbol' => 'Nfk', 'precision' => '2', 'thousand_separator' => ',', 'decimal_separator' => '.'],
|
||||
['id' => 129, 'name' => 'Falkland Islands Pound', 'code' => 'FKP', 'symbol' => '£', 'precision' => '2', 'thousand_separator' => ',', 'decimal_separator' => '.'],
|
||||
['id' => 130, 'name' => 'Guinean Franc', 'code' => 'GNF', 'symbol' => 'Fr', 'precision' => '0', 'thousand_separator' => ',', 'decimal_separator' => ''],
|
||||
['id' => 131, 'name' => 'Iraqi Dinar', 'code' => 'IQD', 'symbol' => 'ع.د', 'precision' => '3', 'thousand_separator' => ',', 'decimal_separator' => '.'],
|
||||
['id' => 132, 'name' => 'Lesotho Loti', 'code' => 'LSL', 'symbol' => 'L', 'precision' => '2', 'thousand_separator' => ',', 'decimal_separator' => '.'],
|
||||
['id' => 133, 'name' => 'Mongolian Tugrik', 'code' => 'MNT', 'symbol' => '₮', 'precision' => '2', 'thousand_separator' => ',', 'decimal_separator' => '.'],
|
||||
['id' => 134, 'name' => 'Seychellois Rupee', 'code' => 'SCR', 'symbol' => '₨', 'precision' => '2', 'thousand_separator' => ',', 'decimal_separator' => '.'],
|
||||
['id' => 135, 'name' => 'Solomon Islands Dollar', 'code' => 'SBD', 'symbol' => '$', 'precision' => '2', 'thousand_separator' => ',', 'decimal_separator' => '.'],
|
||||
['id' => 136, 'name' => 'Somali Shilling', 'code' => 'SOS', 'symbol' => 'Sh', 'precision' => '2', 'thousand_separator' => ',', 'decimal_separator' => '.'],
|
||||
['id' => 137, 'name' => 'South Sudanese Pound', 'code' => 'SSP', 'symbol' => '£', 'precision' => '2', 'thousand_separator' => ',', 'decimal_separator' => '.'],
|
||||
['id' => 138, 'name' => 'Sudanese Pound', 'code' => 'SDG', 'symbol' => '£', 'precision' => '2', 'thousand_separator' => ',', 'decimal_separator' => '.'],
|
||||
['id' => 139, 'name' => 'Tajikistani Somoni', 'code' => 'TJS', 'symbol' => 'ЅM', 'precision' => '2', 'thousand_separator' => ',', 'decimal_separator' => '.'],
|
||||
['id' => 140, 'name' => 'Turkmenistani Manat', 'code' => 'TMT', 'symbol' => 'T', 'precision' => '2', 'thousand_separator' => ',', 'decimal_separator' => '.'],
|
||||
['id' => 141, 'name' => 'Uzbekistani Som', 'code' => 'UZS', 'symbol' => 'so\'m', 'precision' => '2', 'thousand_separator' => ',', 'decimal_separator' => '.'],
|
||||
|
||||
];
|
||||
|
||||
foreach ($currencies as $currency) {
|
||||
|
|
|
|||
|
|
@ -5364,7 +5364,25 @@ $lang = array(
|
|||
'merged_vendors' => 'Successfully merged vendors',
|
||||
'hidden_taxes_warning' => 'Somes taxes are hidden due to current tax settings. :link',
|
||||
'tax3' => 'Third Tax',
|
||||
'negative_payment_warning' => 'Are you sure you want to create a negative payment? This cannot be used as a credit or payment.'
|
||||
'negative_payment_warning' => 'Are you sure you want to create a negative payment? This cannot be used as a credit or payment.',
|
||||
'currency_Bermudian_Dollar' => 'Bermudian Dollar',
|
||||
'currency_Central_African_CFA_Franc' => 'Central African CFA Franc',
|
||||
'currency_Congolese_Franc' => 'Congolese Franc',
|
||||
'currency_Djiboutian_Franc' => 'Djiboutian Franc',
|
||||
'currency_Eritrean_Nakfa' => 'Eritrean Nakfa',
|
||||
'currency_Falkland_Islands_Pound' => 'Falklan IslandsPound',
|
||||
'currency_Guinean_Franc' => 'Guinean Franc',
|
||||
'currency_Iraqi_Dinar' => 'Iraqi Dinar',
|
||||
'currency_Lesotho_Loti' => 'Lesotho Loti',
|
||||
'currency_Mongolian_Tugrik' => 'Mongolian Tugrik',
|
||||
'currency_Seychellois_Rupee' => 'Seychellois Rupee',
|
||||
'currency_Solomon_Islands_Dollar' => 'Solomon Islands Dollar',
|
||||
'currency_Somali_Shilling' => 'Somali Shilling',
|
||||
'currency_South_Sudanese_Pound' => 'South Sudanese Pound',
|
||||
'currency_Sudanese_Pound' => 'Sudanese Pound',
|
||||
'currency_Tajikistani_Somoni' => 'Tajikistani Somoni',
|
||||
'currency_Turkmenistani_Manat' => 'Turkmenistani Manat',
|
||||
'currency_Uzbekistani_Som' => 'Uzbekistani Som',
|
||||
);
|
||||
|
||||
return $lang;
|
||||
|
|
|
|||
|
|
@ -5357,7 +5357,8 @@ Développe automatiquement la section des notes dans le tableau de produits pour
|
|||
'updated_records' => 'Enregistrements mis à jour',
|
||||
'vat_not_registered' => 'Vendeur non enregistré aux taxes',
|
||||
'small_company_info' => 'Aucune déclaration de taxe de vente conformément à l\'article 19 UStG',
|
||||
'log_duration_words' => 'Durée du journal en mots'
|
||||
'log_duration_words' => 'Durée du journal de temps exprimée en mots',
|
||||
'log_duration' => 'Durée du journal de temps'
|
||||
);
|
||||
|
||||
return $lang;
|
||||
|
|
|
|||
|
|
@ -5357,9 +5357,10 @@ E-mail: :email<b><br><b>',
|
|||
'quick_actions' => 'Snelle acties',
|
||||
'end_all_sessions_help' => 'Logt alle gebruikers uit en vereist dat alle actieve gebruikers opnieuw inloggen.',
|
||||
'updated_records' => 'Items bijgewerkt',
|
||||
'vat_not_registered' => 'Seller not VAT registered',
|
||||
'small_company_info' => 'No disclosure of sales tax in accordance with § 19 UStG',
|
||||
'log_duration_words' => 'Log duration in words'
|
||||
'vat_not_registered' => 'Verkoper is niet btw-plichtig',
|
||||
'small_company_info' => 'Geen openbaarmaking van omzetbelasting in overeenstemming met § 19 UStG',
|
||||
'log_duration_words' => 'Maximale lengte logboek in woorden',
|
||||
'log_duration' => 'Maximale lengte logboek'
|
||||
);
|
||||
|
||||
return $lang;
|
||||
|
|
|
|||
|
|
@ -5359,7 +5359,8 @@ $lang = array(
|
|||
'updated_records' => 'Hồ sơ đã cập nhật',
|
||||
'vat_not_registered' => 'Người bán không đăng ký VAT',
|
||||
'small_company_info' => 'Không tiết lộ thuế bán hàng theo § 19 UStG',
|
||||
'log_duration_words' => 'Thời lượng ghi nhật ký bằng từ'
|
||||
'log_duration_words' => 'Thời gian ghi nhật ký bằng từ',
|
||||
'log_duration' => 'Thời gian ghi nhật ký'
|
||||
);
|
||||
|
||||
return $lang;
|
||||
|
|
|
|||
Loading…
Reference in New Issue