feat:재무 모듈 모델 8종 추가 (Customer, Income, Expense, SalesRecord, Purchase, ConsultingFee, CustomerSettlement, Subscription)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
29
app/Models/Finance/ConsultingFee.php
Normal file
29
app/Models/Finance/ConsultingFee.php
Normal file
@@ -0,0 +1,29 @@
|
||||
<?php
|
||||
namespace App\Models\Finance;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\SoftDeletes;
|
||||
|
||||
class ConsultingFee extends Model
|
||||
{
|
||||
use SoftDeletes;
|
||||
|
||||
protected $table = 'consulting_fees';
|
||||
|
||||
protected $fillable = [
|
||||
'tenant_id', 'date', 'consultant', 'customer', 'service',
|
||||
'hours', 'hourly_rate', 'amount', 'status', 'memo',
|
||||
];
|
||||
|
||||
protected $casts = [
|
||||
'date' => 'date',
|
||||
'hours' => 'integer',
|
||||
'hourly_rate' => 'integer',
|
||||
'amount' => 'integer',
|
||||
];
|
||||
|
||||
public function scopeForTenant($query, $tenantId)
|
||||
{
|
||||
return $query->where('tenant_id', $tenantId);
|
||||
}
|
||||
}
|
||||
23
app/Models/Finance/Customer.php
Normal file
23
app/Models/Finance/Customer.php
Normal file
@@ -0,0 +1,23 @@
|
||||
<?php
|
||||
namespace App\Models\Finance;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\SoftDeletes;
|
||||
|
||||
class Customer extends Model
|
||||
{
|
||||
use SoftDeletes;
|
||||
|
||||
protected $table = 'customers';
|
||||
|
||||
protected $fillable = [
|
||||
'tenant_id', 'name', 'biz_no', 'ceo', 'industry', 'grade',
|
||||
'contact', 'email', 'address', 'manager', 'manager_phone',
|
||||
'status', 'memo',
|
||||
];
|
||||
|
||||
public function scopeForTenant($query, $tenantId)
|
||||
{
|
||||
return $query->where('tenant_id', $tenantId);
|
||||
}
|
||||
}
|
||||
30
app/Models/Finance/CustomerSettlement.php
Normal file
30
app/Models/Finance/CustomerSettlement.php
Normal file
@@ -0,0 +1,30 @@
|
||||
<?php
|
||||
namespace App\Models\Finance;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\SoftDeletes;
|
||||
|
||||
class CustomerSettlement extends Model
|
||||
{
|
||||
use SoftDeletes;
|
||||
|
||||
protected $table = 'customer_settlements';
|
||||
|
||||
protected $fillable = [
|
||||
'tenant_id', 'period', 'customer', 'total_sales', 'commission',
|
||||
'expense', 'net_amount', 'status', 'settled_date', 'memo',
|
||||
];
|
||||
|
||||
protected $casts = [
|
||||
'total_sales' => 'integer',
|
||||
'commission' => 'integer',
|
||||
'expense' => 'integer',
|
||||
'net_amount' => 'integer',
|
||||
'settled_date' => 'date',
|
||||
];
|
||||
|
||||
public function scopeForTenant($query, $tenantId)
|
||||
{
|
||||
return $query->where('tenant_id', $tenantId);
|
||||
}
|
||||
}
|
||||
27
app/Models/Finance/Expense.php
Normal file
27
app/Models/Finance/Expense.php
Normal file
@@ -0,0 +1,27 @@
|
||||
<?php
|
||||
namespace App\Models\Finance;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\SoftDeletes;
|
||||
|
||||
class Expense extends Model
|
||||
{
|
||||
use SoftDeletes;
|
||||
|
||||
protected $table = 'expenses';
|
||||
|
||||
protected $fillable = [
|
||||
'tenant_id', 'date', 'vendor', 'description', 'category',
|
||||
'amount', 'status', 'payment_method', 'invoice_no', 'memo',
|
||||
];
|
||||
|
||||
protected $casts = [
|
||||
'date' => 'date',
|
||||
'amount' => 'integer',
|
||||
];
|
||||
|
||||
public function scopeForTenant($query, $tenantId)
|
||||
{
|
||||
return $query->where('tenant_id', $tenantId);
|
||||
}
|
||||
}
|
||||
27
app/Models/Finance/Income.php
Normal file
27
app/Models/Finance/Income.php
Normal file
@@ -0,0 +1,27 @@
|
||||
<?php
|
||||
namespace App\Models\Finance;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\SoftDeletes;
|
||||
|
||||
class Income extends Model
|
||||
{
|
||||
use SoftDeletes;
|
||||
|
||||
protected $table = 'incomes';
|
||||
|
||||
protected $fillable = [
|
||||
'tenant_id', 'date', 'customer', 'description', 'category',
|
||||
'amount', 'status', 'invoice_no', 'memo',
|
||||
];
|
||||
|
||||
protected $casts = [
|
||||
'date' => 'date',
|
||||
'amount' => 'integer',
|
||||
];
|
||||
|
||||
public function scopeForTenant($query, $tenantId)
|
||||
{
|
||||
return $query->where('tenant_id', $tenantId);
|
||||
}
|
||||
}
|
||||
28
app/Models/Finance/Purchase.php
Normal file
28
app/Models/Finance/Purchase.php
Normal file
@@ -0,0 +1,28 @@
|
||||
<?php
|
||||
namespace App\Models\Finance;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\SoftDeletes;
|
||||
|
||||
class Purchase extends Model
|
||||
{
|
||||
use SoftDeletes;
|
||||
|
||||
protected $table = 'purchases';
|
||||
|
||||
protected $fillable = [
|
||||
'tenant_id', 'date', 'vendor', 'item', 'category',
|
||||
'amount', 'vat', 'status', 'invoice_no', 'memo',
|
||||
];
|
||||
|
||||
protected $casts = [
|
||||
'date' => 'date',
|
||||
'amount' => 'integer',
|
||||
'vat' => 'integer',
|
||||
];
|
||||
|
||||
public function scopeForTenant($query, $tenantId)
|
||||
{
|
||||
return $query->where('tenant_id', $tenantId);
|
||||
}
|
||||
}
|
||||
28
app/Models/Finance/SalesRecord.php
Normal file
28
app/Models/Finance/SalesRecord.php
Normal file
@@ -0,0 +1,28 @@
|
||||
<?php
|
||||
namespace App\Models\Finance;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\SoftDeletes;
|
||||
|
||||
class SalesRecord extends Model
|
||||
{
|
||||
use SoftDeletes;
|
||||
|
||||
protected $table = 'sales_records';
|
||||
|
||||
protected $fillable = [
|
||||
'tenant_id', 'date', 'customer', 'project', 'type',
|
||||
'amount', 'vat', 'status', 'invoice_no', 'memo',
|
||||
];
|
||||
|
||||
protected $casts = [
|
||||
'date' => 'date',
|
||||
'amount' => 'integer',
|
||||
'vat' => 'integer',
|
||||
];
|
||||
|
||||
public function scopeForTenant($query, $tenantId)
|
||||
{
|
||||
return $query->where('tenant_id', $tenantId);
|
||||
}
|
||||
}
|
||||
29
app/Models/Finance/Subscription.php
Normal file
29
app/Models/Finance/Subscription.php
Normal file
@@ -0,0 +1,29 @@
|
||||
<?php
|
||||
namespace App\Models\Finance;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\SoftDeletes;
|
||||
|
||||
class Subscription extends Model
|
||||
{
|
||||
use SoftDeletes;
|
||||
|
||||
protected $table = 'subscriptions';
|
||||
|
||||
protected $fillable = [
|
||||
'tenant_id', 'customer', 'plan', 'monthly_fee', 'billing_cycle',
|
||||
'start_date', 'next_billing', 'status', 'users', 'memo',
|
||||
];
|
||||
|
||||
protected $casts = [
|
||||
'monthly_fee' => 'integer',
|
||||
'users' => 'integer',
|
||||
'start_date' => 'date',
|
||||
'next_billing' => 'date',
|
||||
];
|
||||
|
||||
public function scopeForTenant($query, $tenantId)
|
||||
{
|
||||
return $query->where('tenant_id', $tenantId);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user