style: Pint 포맷팅 적용
This commit is contained in:
@@ -19,8 +19,8 @@ public function index(Request $request): JsonResponse
|
||||
if ($search = $request->input('search')) {
|
||||
$query->where(function ($q) use ($search) {
|
||||
$q->where('merchant', 'like', "%{$search}%")
|
||||
->orWhere('memo', 'like', "%{$search}%")
|
||||
->orWhere('approval_no', 'like', "%{$search}%");
|
||||
->orWhere('memo', 'like', "%{$search}%")
|
||||
->orWhere('approval_no', 'like', "%{$search}%");
|
||||
});
|
||||
}
|
||||
|
||||
@@ -72,7 +72,7 @@ public function index(Request $request): JsonResponse
|
||||
'total' => $transactions->count(),
|
||||
'totalAmount' => $transactions->sum('amount'),
|
||||
'approvedAmount' => $transactions->where('status', 'approved')->sum('amount'),
|
||||
'cancelledAmount' => $transactions->where('status', 'cancelled')->sum(fn($t) => abs($t['amount'])),
|
||||
'cancelledAmount' => $transactions->where('status', 'cancelled')->sum(fn ($t) => abs($t['amount'])),
|
||||
];
|
||||
|
||||
// 카드 목록
|
||||
|
||||
@@ -17,14 +17,16 @@ public function index(Request $request): JsonResponse
|
||||
if ($search = $request->input('search')) {
|
||||
$query->where(function ($q) use ($search) {
|
||||
$q->where('consultant', 'like', "%{$search}%")
|
||||
->orWhere('customer', 'like', "%{$search}%");
|
||||
->orWhere('customer', 'like', "%{$search}%");
|
||||
});
|
||||
}
|
||||
if ($status = $request->input('status')) {
|
||||
if ($status !== 'all') $query->where('status', $status);
|
||||
if ($status !== 'all') {
|
||||
$query->where('status', $status);
|
||||
}
|
||||
}
|
||||
|
||||
$fees = $query->orderBy('date', 'desc')->get()->map(fn($item) => [
|
||||
$fees = $query->orderBy('date', 'desc')->get()->map(fn ($item) => [
|
||||
'id' => $item->id, 'date' => $item->date?->format('Y-m-d'),
|
||||
'consultant' => $item->consultant, 'customer' => $item->customer,
|
||||
'service' => $item->service, 'hours' => $item->hours,
|
||||
@@ -82,6 +84,7 @@ public function destroy(int $id): JsonResponse
|
||||
{
|
||||
$tenantId = session('selected_tenant_id', 1);
|
||||
ConsultingFee::forTenant($tenantId)->findOrFail($id)->delete();
|
||||
|
||||
return response()->json(['success' => true, 'message' => '컨설팅비가 삭제되었습니다.']);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -227,7 +227,7 @@ public function summary(): JsonResponse
|
||||
$adjustedDate = $this->getAdjustedPaymentDate($tenantId, $nextMonth->year, $nextMonth->month, $paymentDay);
|
||||
}
|
||||
|
||||
$isAdjusted = !$originalDate->isSameDay($adjustedDate);
|
||||
$isAdjusted = ! $originalDate->isSameDay($adjustedDate);
|
||||
|
||||
// 청구기간: 결제일 기준 전월 1일 ~ 결제일
|
||||
$billingStart = $adjustedDate->copy()->subMonth()->startOfMonth();
|
||||
@@ -283,7 +283,7 @@ public function updatePrepayment(Request $request): JsonResponse
|
||||
$tenantId = session('selected_tenant_id', 1);
|
||||
$yearMonth = $this->getBillingYearMonth($tenantId);
|
||||
|
||||
$items = collect($request->input('items', []))->filter(fn($item) => ($item['amount'] ?? 0) > 0)->values()->toArray();
|
||||
$items = collect($request->input('items', []))->filter(fn ($item) => ($item['amount'] ?? 0) > 0)->values()->toArray();
|
||||
$amount = collect($items)->sum('amount');
|
||||
|
||||
$prepayment = CorporateCardPrepayment::updateOrCreate(
|
||||
@@ -328,6 +328,7 @@ private function getBillingYearMonth(int $tenantId): string
|
||||
private function createPaymentDate(int $year, int $month, int $day): Carbon
|
||||
{
|
||||
$maxDay = Carbon::create($year, $month)->daysInMonth;
|
||||
|
||||
return Carbon::create($year, $month, min($day, $maxDay));
|
||||
}
|
||||
|
||||
@@ -367,7 +368,7 @@ private function getAdjustedPaymentDate(int $tenantId, int $year, int $month, in
|
||||
private function calculateBillingUsage(int $tenantId, string $startDate, string $endDate, array $cardNumbers): array
|
||||
{
|
||||
// 카드번호 정규화 (하이픈 제거) + 원본↔정규화 매핑
|
||||
$normalizedNums = array_map(fn($num) => str_replace('-', '', $num), $cardNumbers);
|
||||
$normalizedNums = array_map(fn ($num) => str_replace('-', '', $num), $cardNumbers);
|
||||
|
||||
if (empty($normalizedNums)) {
|
||||
return ['total' => 0, 'perCard' => []];
|
||||
|
||||
@@ -45,8 +45,8 @@ public function list(Request $request): JsonResponse
|
||||
$search = $request->search;
|
||||
$query->where(function ($q) use ($search) {
|
||||
$q->where('plate_number', 'like', "%{$search}%")
|
||||
->orWhere('model', 'like', "%{$search}%")
|
||||
->orWhere('driver', 'like', "%{$search}%");
|
||||
->orWhere('model', 'like', "%{$search}%")
|
||||
->orWhere('driver', 'like', "%{$search}%");
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@@ -19,18 +19,22 @@ public function index(Request $request): JsonResponse
|
||||
if ($search = $request->input('search')) {
|
||||
$query->where(function ($q) use ($search) {
|
||||
$q->where('name', 'like', "%{$search}%")
|
||||
->orWhere('ceo', 'like', "%{$search}%")
|
||||
->orWhere('manager', 'like', "%{$search}%");
|
||||
->orWhere('ceo', 'like', "%{$search}%")
|
||||
->orWhere('manager', 'like', "%{$search}%");
|
||||
});
|
||||
}
|
||||
if ($status = $request->input('status')) {
|
||||
if ($status !== 'all') $query->where('status', $status);
|
||||
if ($status !== 'all') {
|
||||
$query->where('status', $status);
|
||||
}
|
||||
}
|
||||
if ($grade = $request->input('grade')) {
|
||||
if ($grade !== 'all') $query->where('grade', $grade);
|
||||
if ($grade !== 'all') {
|
||||
$query->where('grade', $grade);
|
||||
}
|
||||
}
|
||||
|
||||
$customers = $query->orderBy('created_at', 'desc')->get()->map(fn($item) => [
|
||||
$customers = $query->orderBy('created_at', 'desc')->get()->map(fn ($item) => [
|
||||
'id' => $item->id, 'name' => $item->name, 'bizNo' => $item->biz_no,
|
||||
'ceo' => $item->ceo, 'industry' => $item->industry, 'grade' => $item->grade,
|
||||
'contact' => $item->contact, 'email' => $item->email, 'address' => $item->address,
|
||||
@@ -90,6 +94,7 @@ public function destroy(int $id): JsonResponse
|
||||
{
|
||||
$tenantId = session('selected_tenant_id', 1);
|
||||
Customer::forTenant($tenantId)->findOrFail($id)->delete();
|
||||
|
||||
return response()->json(['success' => true, 'message' => '고객사가 삭제되었습니다.']);
|
||||
}
|
||||
|
||||
@@ -130,13 +135,14 @@ function ($attribute, $value, $fail) {
|
||||
return response()->json(['ok' => false, 'message' => $e->getMessage()], 500);
|
||||
} catch (\Throwable $e) {
|
||||
Log::error('고객사 OCR 예상치 못한 오류', ['error' => $e->getMessage()]);
|
||||
|
||||
return response()->json(['ok' => false, 'message' => 'OCR 처리 중 오류가 발생했습니다.'], 500);
|
||||
}
|
||||
}
|
||||
|
||||
private function matchIndustry(string $bizType, string $bizItem): string
|
||||
{
|
||||
$text = $bizType . ' ' . $bizItem;
|
||||
$text = $bizType.' '.$bizItem;
|
||||
|
||||
$keywords = [
|
||||
'IT/소프트웨어' => ['소프트웨어', 'IT', '정보통신', '전산', '컴퓨터', '인터넷', '데이터', '프로그램'],
|
||||
@@ -162,8 +168,13 @@ private function buildCustomerMemo(array $raw): string
|
||||
$parts = [];
|
||||
$bizType = trim($raw['biz_type'] ?? '');
|
||||
$bizItem = trim($raw['biz_item'] ?? '');
|
||||
if ($bizType) $parts[] = "[업태] {$bizType}";
|
||||
if ($bizItem) $parts[] = "[종목] {$bizItem}";
|
||||
if ($bizType) {
|
||||
$parts[] = "[업태] {$bizType}";
|
||||
}
|
||||
if ($bizItem) {
|
||||
$parts[] = "[종목] {$bizItem}";
|
||||
}
|
||||
|
||||
return implode(' / ', $parts);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -20,10 +20,12 @@ public function index(Request $request): JsonResponse
|
||||
});
|
||||
}
|
||||
if ($status = $request->input('status')) {
|
||||
if ($status !== 'all') $query->where('status', $status);
|
||||
if ($status !== 'all') {
|
||||
$query->where('status', $status);
|
||||
}
|
||||
}
|
||||
|
||||
$settlements = $query->orderBy('created_at', 'desc')->get()->map(fn($item) => [
|
||||
$settlements = $query->orderBy('created_at', 'desc')->get()->map(fn ($item) => [
|
||||
'id' => $item->id, 'period' => $item->period,
|
||||
'customer' => $item->customer, 'totalSales' => $item->total_sales,
|
||||
'commission' => $item->commission, 'expense' => $item->expense,
|
||||
@@ -85,6 +87,7 @@ public function destroy(int $id): JsonResponse
|
||||
{
|
||||
$tenantId = session('selected_tenant_id', 1);
|
||||
CustomerSettlement::forTenant($tenantId)->findOrFail($id)->delete();
|
||||
|
||||
return response()->json(['success' => true, 'message' => '정산이 삭제되었습니다.']);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,13 +3,12 @@
|
||||
namespace App\Http\Controllers\Finance;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Models\Finance\DailyFundTransaction;
|
||||
use App\Models\Finance\DailyFundMemo;
|
||||
use App\Models\Barobill\BankTransaction as BarobillBankTransaction;
|
||||
use App\Models\Barobill\BankTransactionOverride;
|
||||
use App\Models\Finance\DailyFundMemo;
|
||||
use App\Models\Finance\DailyFundTransaction;
|
||||
use Illuminate\Http\JsonResponse;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
|
||||
class DailyFundController extends Controller
|
||||
{
|
||||
@@ -179,14 +178,14 @@ public function periodReport(Request $request): JsonResponse
|
||||
->whereBetween('trans_date', [$startDateYmd, $endDateYmd])
|
||||
->orderBy('id', 'desc') // 최신 ID 우선 (올바른 잔액)
|
||||
->get()
|
||||
->unique(fn($tx) => $tx->unique_key)
|
||||
->unique(fn ($tx) => $tx->unique_key)
|
||||
->sortByDesc('trans_date')
|
||||
->sortByDesc(fn($tx) => $tx->trans_date . $tx->trans_time)
|
||||
->sortByDesc(fn ($tx) => $tx->trans_date.$tx->trans_time)
|
||||
->values();
|
||||
|
||||
// 오버라이드 데이터 병합 (수정된 적요/내용)
|
||||
if ($transactions->isNotEmpty()) {
|
||||
$uniqueKeys = $transactions->map(fn($t) => $t->unique_key)->toArray();
|
||||
$uniqueKeys = $transactions->map(fn ($t) => $t->unique_key)->toArray();
|
||||
$overrides = BankTransactionOverride::getByUniqueKeys($tenantId, $uniqueKeys);
|
||||
|
||||
$transactions = $transactions->map(function ($tx) use ($overrides) {
|
||||
@@ -199,6 +198,7 @@ public function periodReport(Request $request): JsonResponse
|
||||
$tx->cast = $override->modified_cast;
|
||||
}
|
||||
}
|
||||
|
||||
return $tx;
|
||||
});
|
||||
}
|
||||
@@ -211,7 +211,7 @@ public function periodReport(Request $request): JsonResponse
|
||||
$date = $tx->trans_date;
|
||||
$accountNum = $tx->bank_account_num;
|
||||
|
||||
if (!isset($dailyData[$date])) {
|
||||
if (! isset($dailyData[$date])) {
|
||||
$dailyData[$date] = [
|
||||
'date' => $date,
|
||||
'dateFormatted' => $this->formatDateKorean($date),
|
||||
@@ -224,7 +224,7 @@ public function periodReport(Request $request): JsonResponse
|
||||
}
|
||||
|
||||
// 계좌별 데이터 집계
|
||||
if (!isset($dailyData[$date]['accounts'][$accountNum])) {
|
||||
if (! isset($dailyData[$date]['accounts'][$accountNum])) {
|
||||
$dailyData[$date]['accounts'][$accountNum] = [
|
||||
'bankName' => $tx->bank_name,
|
||||
'accountNum' => $accountNum,
|
||||
|
||||
@@ -17,17 +17,21 @@ public function index(Request $request): JsonResponse
|
||||
if ($search = $request->input('search')) {
|
||||
$query->where(function ($q) use ($search) {
|
||||
$q->where('vendor', 'like', "%{$search}%")
|
||||
->orWhere('description', 'like', "%{$search}%");
|
||||
->orWhere('description', 'like', "%{$search}%");
|
||||
});
|
||||
}
|
||||
if ($status = $request->input('status')) {
|
||||
if ($status !== 'all') $query->where('status', $status);
|
||||
if ($status !== 'all') {
|
||||
$query->where('status', $status);
|
||||
}
|
||||
}
|
||||
if ($category = $request->input('category')) {
|
||||
if ($category !== 'all') $query->where('category', $category);
|
||||
if ($category !== 'all') {
|
||||
$query->where('category', $category);
|
||||
}
|
||||
}
|
||||
|
||||
$expenses = $query->orderBy('date', 'desc')->get()->map(fn($item) => [
|
||||
$expenses = $query->orderBy('date', 'desc')->get()->map(fn ($item) => [
|
||||
'id' => $item->id, 'date' => $item->date?->format('Y-m-d'),
|
||||
'vendor' => $item->vendor, 'description' => $item->description,
|
||||
'category' => $item->category, 'amount' => $item->amount,
|
||||
@@ -87,6 +91,7 @@ public function destroy(int $id): JsonResponse
|
||||
{
|
||||
$tenantId = session('selected_tenant_id', 1);
|
||||
Expense::forTenant($tenantId)->findOrFail($id)->delete();
|
||||
|
||||
return response()->json(['success' => true, 'message' => '지출이 삭제되었습니다.']);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -7,7 +7,6 @@
|
||||
use App\Models\Barobill\BankTransactionOverride;
|
||||
use App\Models\Barobill\CardTransaction as BarobillCardTransaction;
|
||||
use App\Models\Finance\BankAccount;
|
||||
use App\Models\Finance\FundSchedule;
|
||||
use App\Services\BankAccountService;
|
||||
use App\Services\FundScheduleService;
|
||||
use Illuminate\Contracts\View\View;
|
||||
@@ -53,7 +52,7 @@ public function index(): View
|
||||
|
||||
// 오버라이드 데이터 병합 (수정된 적요/내용)
|
||||
if ($recentTransactions->isNotEmpty()) {
|
||||
$uniqueKeys = $recentTransactions->map(fn($t) => $t->unique_key)->toArray();
|
||||
$uniqueKeys = $recentTransactions->map(fn ($t) => $t->unique_key)->toArray();
|
||||
$overrides = BankTransactionOverride::getByUniqueKeys($tenantId, $uniqueKeys);
|
||||
|
||||
$recentTransactions = $recentTransactions->map(function ($transaction) use ($overrides) {
|
||||
@@ -71,6 +70,7 @@ public function index(): View
|
||||
} else {
|
||||
$transaction->is_overridden = false;
|
||||
}
|
||||
|
||||
return $transaction;
|
||||
});
|
||||
}
|
||||
|
||||
@@ -17,13 +17,21 @@ public function index(Request $request): JsonResponse
|
||||
if ($search = $request->input('search')) {
|
||||
$query->where(function ($q) use ($search) {
|
||||
$q->where('customer', 'like', "%{$search}%")
|
||||
->orWhere('description', 'like', "%{$search}%");
|
||||
->orWhere('description', 'like', "%{$search}%");
|
||||
});
|
||||
}
|
||||
if ($status = $request->input('status')) { if ($status !== 'all') $query->where('status', $status); }
|
||||
if ($category = $request->input('category')) { if ($category !== 'all') $query->where('category', $category); }
|
||||
if ($status = $request->input('status')) {
|
||||
if ($status !== 'all') {
|
||||
$query->where('status', $status);
|
||||
}
|
||||
}
|
||||
if ($category = $request->input('category')) {
|
||||
if ($category !== 'all') {
|
||||
$query->where('category', $category);
|
||||
}
|
||||
}
|
||||
|
||||
$incomes = $query->orderBy('date', 'desc')->get()->map(fn($item) => [
|
||||
$incomes = $query->orderBy('date', 'desc')->get()->map(fn ($item) => [
|
||||
'id' => $item->id, 'date' => $item->date?->format('Y-m-d'),
|
||||
'customer' => $item->customer, 'description' => $item->description,
|
||||
'category' => $item->category, 'amount' => $item->amount,
|
||||
@@ -80,6 +88,7 @@ public function destroy(int $id): JsonResponse
|
||||
{
|
||||
$tenantId = session('selected_tenant_id', 1);
|
||||
Income::forTenant($tenantId)->findOrFail($id)->delete();
|
||||
|
||||
return response()->json(['success' => true, 'message' => '수입이 삭제되었습니다.']);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -17,17 +17,21 @@ public function index(Request $request): JsonResponse
|
||||
if ($search = $request->input('search')) {
|
||||
$query->where(function ($q) use ($search) {
|
||||
$q->where('vendor', 'like', "%{$search}%")
|
||||
->orWhere('item', 'like', "%{$search}%");
|
||||
->orWhere('item', 'like', "%{$search}%");
|
||||
});
|
||||
}
|
||||
if ($status = $request->input('status')) {
|
||||
if ($status !== 'all') $query->where('status', $status);
|
||||
if ($status !== 'all') {
|
||||
$query->where('status', $status);
|
||||
}
|
||||
}
|
||||
if ($category = $request->input('category')) {
|
||||
if ($category !== 'all') $query->where('category', $category);
|
||||
if ($category !== 'all') {
|
||||
$query->where('category', $category);
|
||||
}
|
||||
}
|
||||
|
||||
$purchases = $query->orderBy('date', 'desc')->get()->map(fn($item) => [
|
||||
$purchases = $query->orderBy('date', 'desc')->get()->map(fn ($item) => [
|
||||
'id' => $item->id, 'date' => $item->date?->format('Y-m-d'),
|
||||
'vendor' => $item->vendor, 'item' => $item->item,
|
||||
'category' => $item->category, 'amount' => $item->amount,
|
||||
@@ -85,6 +89,7 @@ public function destroy(int $id): JsonResponse
|
||||
{
|
||||
$tenantId = session('selected_tenant_id', 1);
|
||||
Purchase::forTenant($tenantId)->findOrFail($id)->delete();
|
||||
|
||||
return response()->json(['success' => true, 'message' => '매입이 삭제되었습니다.']);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -18,7 +18,7 @@ public function index(Request $request): JsonResponse
|
||||
if ($search = $request->input('search')) {
|
||||
$query->where(function ($q) use ($search) {
|
||||
$q->where('customer_name', 'like', "%{$search}%")
|
||||
->orWhere('product_name', 'like', "%{$search}%");
|
||||
->orWhere('product_name', 'like', "%{$search}%");
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@@ -27,7 +27,7 @@ public function __construct(
|
||||
public function index(Request $request): View|Response
|
||||
{
|
||||
// HTMX 요청 시 전체 페이지로 리다이렉트 (JavaScript 필요)
|
||||
if ($request->header('HX-Request') && !$request->header('HX-Boosted')) {
|
||||
if ($request->header('HX-Request') && ! $request->header('HX-Boosted')) {
|
||||
return response('', 200)->header('HX-Redirect', route('finance.sales-commissions.index'));
|
||||
}
|
||||
|
||||
@@ -77,7 +77,7 @@ public function show(int $id): JsonResponse
|
||||
{
|
||||
$commission = $this->service->getCommissionById($id);
|
||||
|
||||
if (!$commission) {
|
||||
if (! $commission) {
|
||||
return response()->json([
|
||||
'success' => false,
|
||||
'message' => '정산 정보를 찾을 수 없습니다.',
|
||||
@@ -377,9 +377,9 @@ public function export(Request $request)
|
||||
// 전체 데이터 조회 (페이지네이션 없이)
|
||||
$commissions = SalesCommission::query()
|
||||
->with(['tenant', 'partner.user', 'manager'])
|
||||
->when(!empty($filters['status']), fn($q) => $q->where('status', $filters['status']))
|
||||
->when(!empty($filters['payment_type']), fn($q) => $q->where('payment_type', $filters['payment_type']))
|
||||
->when(!empty($filters['partner_id']), fn($q) => $q->where('partner_id', $filters['partner_id']))
|
||||
->when(! empty($filters['status']), fn ($q) => $q->where('status', $filters['status']))
|
||||
->when(! empty($filters['payment_type']), fn ($q) => $q->where('payment_type', $filters['payment_type']))
|
||||
->when(! empty($filters['partner_id']), fn ($q) => $q->where('partner_id', $filters['partner_id']))
|
||||
->forScheduledMonth($year, $month)
|
||||
->orderBy('scheduled_payment_date')
|
||||
->get();
|
||||
@@ -402,7 +402,7 @@ public function export(Request $request)
|
||||
fputcsv($file, [
|
||||
'번호', '테넌트', '입금구분', '입금액', '입금일',
|
||||
'기준액', '영업파트너', '파트너수당', '매니저', '매니저수당',
|
||||
'지급예정일', '상태', '실제지급일'
|
||||
'지급예정일', '상태', '실제지급일',
|
||||
]);
|
||||
|
||||
// 데이터
|
||||
|
||||
@@ -17,17 +17,21 @@ public function index(Request $request): JsonResponse
|
||||
if ($search = $request->input('search')) {
|
||||
$query->where(function ($q) use ($search) {
|
||||
$q->where('customer', 'like', "%{$search}%")
|
||||
->orWhere('project', 'like', "%{$search}%");
|
||||
->orWhere('project', 'like', "%{$search}%");
|
||||
});
|
||||
}
|
||||
if ($status = $request->input('status')) {
|
||||
if ($status !== 'all') $query->where('status', $status);
|
||||
if ($status !== 'all') {
|
||||
$query->where('status', $status);
|
||||
}
|
||||
}
|
||||
if ($type = $request->input('type')) {
|
||||
if ($type !== 'all') $query->where('type', $type);
|
||||
if ($type !== 'all') {
|
||||
$query->where('type', $type);
|
||||
}
|
||||
}
|
||||
|
||||
$records = $query->orderBy('date', 'desc')->get()->map(fn($item) => [
|
||||
$records = $query->orderBy('date', 'desc')->get()->map(fn ($item) => [
|
||||
'id' => $item->id, 'date' => $item->date?->format('Y-m-d'),
|
||||
'customer' => $item->customer, 'project' => $item->project,
|
||||
'type' => $item->type, 'taxType' => $item->tax_type ?? 'taxable',
|
||||
@@ -93,6 +97,7 @@ public function destroy(int $id): JsonResponse
|
||||
{
|
||||
$tenantId = session('selected_tenant_id', 1);
|
||||
SalesRecord::forTenant($tenantId)->findOrFail($id)->delete();
|
||||
|
||||
return response()->json(['success' => true, 'message' => '매출이 삭제되었습니다.']);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -20,10 +20,12 @@ public function index(Request $request): JsonResponse
|
||||
});
|
||||
}
|
||||
if ($status = $request->input('status')) {
|
||||
if ($status !== 'all') $query->where('status', $status);
|
||||
if ($status !== 'all') {
|
||||
$query->where('status', $status);
|
||||
}
|
||||
}
|
||||
|
||||
$subscriptions = $query->orderBy('created_at', 'desc')->get()->map(fn($item) => [
|
||||
$subscriptions = $query->orderBy('created_at', 'desc')->get()->map(fn ($item) => [
|
||||
'id' => $item->id, 'customer' => $item->customer,
|
||||
'plan' => $item->plan, 'monthlyFee' => $item->monthly_fee,
|
||||
'billingCycle' => $item->billing_cycle,
|
||||
@@ -87,6 +89,7 @@ public function destroy(int $id): JsonResponse
|
||||
{
|
||||
$tenantId = session('selected_tenant_id', 1);
|
||||
Subscription::forTenant($tenantId)->findOrFail($id)->delete();
|
||||
|
||||
return response()->json(['success' => true, 'message' => '구독이 삭제되었습니다.']);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -19,8 +19,8 @@ public function index(Request $request): JsonResponse
|
||||
if ($search = $request->input('search')) {
|
||||
$query->where(function ($q) use ($search) {
|
||||
$q->where('name', 'like', "%{$search}%")
|
||||
->orWhere('ceo', 'like', "%{$search}%")
|
||||
->orWhere('manager', 'like', "%{$search}%");
|
||||
->orWhere('ceo', 'like', "%{$search}%")
|
||||
->orWhere('manager', 'like', "%{$search}%");
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@@ -3,11 +3,11 @@
|
||||
namespace App\Http\Controllers\Finance;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Models\Finance\VatRecord;
|
||||
use App\Models\Barobill\CardTransaction as BarobillCardTransaction;
|
||||
use App\Models\Barobill\CardTransactionSplit;
|
||||
use App\Models\Barobill\CardTransactionHide;
|
||||
use App\Models\Barobill\CardTransactionSplit;
|
||||
use App\Models\Barobill\HometaxInvoice;
|
||||
use App\Models\Finance\VatRecord;
|
||||
use Illuminate\Http\JsonResponse;
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
@@ -43,7 +43,7 @@ public function index(Request $request): JsonResponse
|
||||
|
||||
$hometaxSalesRecords = $hometaxSales->map(function ($inv) use ($period, $taxTypeMap) {
|
||||
return [
|
||||
'id' => 'hometax_' . $inv->id,
|
||||
'id' => 'hometax_'.$inv->id,
|
||||
'period' => $period,
|
||||
'type' => 'sales',
|
||||
'taxType' => $taxTypeMap[$inv->tax_type] ?? 'taxable',
|
||||
@@ -69,7 +69,7 @@ public function index(Request $request): JsonResponse
|
||||
|
||||
$hometaxPurchaseRecords = $hometaxPurchases->map(function ($inv) use ($period, $taxTypeMap) {
|
||||
return [
|
||||
'id' => 'hometax_' . $inv->id,
|
||||
'id' => 'hometax_'.$inv->id,
|
||||
'period' => $period,
|
||||
'type' => 'purchase',
|
||||
'taxType' => $taxTypeMap[$inv->tax_type] ?? 'taxable',
|
||||
@@ -104,7 +104,7 @@ public function index(Request $request): JsonResponse
|
||||
foreach ($splitsByKey as $fullKey => $splits) {
|
||||
$parts = explode('|', $fullKey);
|
||||
if (count($parts) >= 3) {
|
||||
$partialKey = $parts[0] . '|' . $parts[1] . '|' . $parts[2];
|
||||
$partialKey = $parts[0].'|'.$parts[1].'|'.$parts[2];
|
||||
$splitsByPartialKey[$partialKey] = $splits;
|
||||
}
|
||||
}
|
||||
@@ -117,8 +117,8 @@ public function index(Request $request): JsonResponse
|
||||
|
||||
// 분개 매칭: 정확한 키 → 부분키(금액 제외) 순으로 시도
|
||||
$splits = $splitsByKey[$card->unique_key] ?? null;
|
||||
if (!$splits) {
|
||||
$cardPartialKey = $card->card_num . '|' . $card->use_dt . '|' . $card->approval_num;
|
||||
if (! $splits) {
|
||||
$cardPartialKey = $card->card_num.'|'.$card->use_dt.'|'.$card->approval_num;
|
||||
$splits = $splitsByPartialKey[$cardPartialKey] ?? null;
|
||||
}
|
||||
|
||||
@@ -127,7 +127,7 @@ public function index(Request $request): JsonResponse
|
||||
foreach ($splits as $split) {
|
||||
if ($split->deduction_type === 'deductible') {
|
||||
$cardRecords->push([
|
||||
'id' => 'card_split_' . $split->id,
|
||||
'id' => 'card_split_'.$split->id,
|
||||
'period' => $period,
|
||||
'type' => 'purchase',
|
||||
'taxType' => 'taxable',
|
||||
@@ -153,7 +153,7 @@ public function index(Request $request): JsonResponse
|
||||
$effectiveTax = $card->modified_tax ?? $card->tax;
|
||||
|
||||
$cardRecords->push([
|
||||
'id' => 'card_' . $card->id,
|
||||
'id' => 'card_'.$card->id,
|
||||
'period' => $period,
|
||||
'type' => 'purchase',
|
||||
'taxType' => 'taxable',
|
||||
@@ -269,13 +269,13 @@ public function index(Request $request): JsonResponse
|
||||
// 확정(C) 기간이면 대응하는 예정(P)의 netVat를 계산
|
||||
if ($period && str_ends_with($period, 'C')) {
|
||||
try {
|
||||
$prelimPeriod = substr($period, 0, -1) . 'P';
|
||||
$prelimPeriod = substr($period, 0, -1).'P';
|
||||
$stats['preliminaryVat'] = $this->calculatePeriodNetVat($tenantId, $prelimPeriod);
|
||||
} catch (\Throwable $e) {
|
||||
\Log::error('예정 세액 계산 실패', [
|
||||
'message' => $e->getMessage(),
|
||||
'file' => $e->getFile() . ':' . $e->getLine(),
|
||||
'trace' => array_slice(array_map(fn($t) => ($t['file'] ?? '') . ':' . ($t['line'] ?? '') . ' ' . ($t['function'] ?? ''), $e->getTrace()), 0, 5),
|
||||
'file' => $e->getFile().':'.$e->getLine(),
|
||||
'trace' => array_slice(array_map(fn ($t) => ($t['file'] ?? '').':'.($t['line'] ?? '').' '.($t['function'] ?? ''), $e->getTrace()), 0, 5),
|
||||
'tenant_id' => $tenantId,
|
||||
'period' => $prelimPeriod ?? null,
|
||||
]);
|
||||
@@ -385,7 +385,7 @@ public function destroy(int $id): JsonResponse
|
||||
private function calculatePeriodNetVat(int $tenantId, string $period): int
|
||||
{
|
||||
[$startDate, $endDate] = $this->periodToDateRange($period);
|
||||
if (!$startDate || !$endDate) {
|
||||
if (! $startDate || ! $endDate) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -422,7 +422,7 @@ private function calculatePeriodNetVat(int $tenantId, string $period): int
|
||||
foreach ($splitsByKey as $fullKey => $splits) {
|
||||
$parts = explode('|', $fullKey);
|
||||
if (count($parts) >= 3) {
|
||||
$partialKey = $parts[0] . '|' . $parts[1] . '|' . $parts[2];
|
||||
$partialKey = $parts[0].'|'.$parts[1].'|'.$parts[2];
|
||||
$splitsByPartialKey[$partialKey] = $splits;
|
||||
}
|
||||
}
|
||||
@@ -433,8 +433,8 @@ private function calculatePeriodNetVat(int $tenantId, string $period): int
|
||||
}
|
||||
|
||||
$splits = $splitsByKey[$card->unique_key] ?? null;
|
||||
if (!$splits) {
|
||||
$cardPartialKey = $card->card_num . '|' . $card->use_dt . '|' . $card->approval_num;
|
||||
if (! $splits) {
|
||||
$cardPartialKey = $card->card_num.'|'.$card->use_dt.'|'.$card->approval_num;
|
||||
$splits = $splitsByPartialKey[$cardPartialKey] ?? null;
|
||||
}
|
||||
|
||||
|
||||
@@ -71,10 +71,10 @@ public function list(Request $request): JsonResponse
|
||||
$search = $request->search;
|
||||
$query->where(function ($q) use ($search) {
|
||||
$q->where('driver_name', 'like', "%{$search}%")
|
||||
->orWhere('department', 'like', "%{$search}%")
|
||||
->orWhere('departure_name', 'like', "%{$search}%")
|
||||
->orWhere('arrival_name', 'like', "%{$search}%")
|
||||
->orWhere('note', 'like', "%{$search}%");
|
||||
->orWhere('department', 'like', "%{$search}%")
|
||||
->orWhere('departure_name', 'like', "%{$search}%")
|
||||
->orWhere('arrival_name', 'like', "%{$search}%")
|
||||
->orWhere('note', 'like', "%{$search}%");
|
||||
});
|
||||
}
|
||||
|
||||
@@ -233,9 +233,9 @@ public function summary(Request $request): JsonResponse
|
||||
COUNT(*) as count,
|
||||
SUM(distance_km) as total_distance
|
||||
')
|
||||
->groupBy('trip_type')
|
||||
->get()
|
||||
->keyBy('trip_type');
|
||||
->groupBy('trip_type')
|
||||
->get()
|
||||
->keyBy('trip_type');
|
||||
|
||||
$tripTypes = VehicleLog::getTripTypes();
|
||||
$result = [];
|
||||
|
||||
@@ -71,8 +71,8 @@ public function list(Request $request): JsonResponse
|
||||
$search = $request->search;
|
||||
$query->where(function ($q) use ($search) {
|
||||
$q->where('description', 'like', "%{$search}%")
|
||||
->orWhere('vendor', 'like', "%{$search}%")
|
||||
->orWhere('memo', 'like', "%{$search}%");
|
||||
->orWhere('vendor', 'like', "%{$search}%")
|
||||
->orWhere('memo', 'like', "%{$search}%");
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user