diff --git a/app/Console/Commands/FixLiabilitiesSpent.php b/app/Console/Commands/FixLiabilitiesSpent.php new file mode 100644 index 00000000..43b1da49 --- /dev/null +++ b/app/Console/Commands/FixLiabilitiesSpent.php @@ -0,0 +1,28 @@ +getCreditCardSpentTransactions($this->argument('teamId')); + dd($transactions->sum('total')); + foreach ($transactions as $transaction) { + $transactions->id; + } + } +} diff --git a/app/Domains/AppCore/Policies/FinanceAccountPolicy.php b/app/Domains/AppCore/Policies/FinanceAccountPolicy.php index ca2115f1..6e6b0d2c 100644 --- a/app/Domains/AppCore/Policies/FinanceAccountPolicy.php +++ b/app/Domains/AppCore/Policies/FinanceAccountPolicy.php @@ -8,9 +8,9 @@ class FinanceAccountPolicy { - public function show(User $user, Account $account) + public function show(User $user) { - return $user->current_team_id === $account->team_id + return $user->current_team_id ? Response::allow() : Response::deny('You do not own this account.'); } diff --git a/app/Domains/Journal/Actions/AccountStatementShow.php b/app/Domains/Journal/Actions/AccountStatementShow.php index e5ccfa1a..4e7a6c0e 100644 --- a/app/Domains/Journal/Actions/AccountStatementShow.php +++ b/app/Domains/Journal/Actions/AccountStatementShow.php @@ -4,19 +4,20 @@ use Illuminate\Foundation\Auth\User; use Illuminate\Support\Facades\Gate; -use Insane\Journal\Contracts\AccountStatementShows; -use Insane\Journal\Helpers\ReportHelper; use Insane\Journal\Models\Core\Account; +use Insane\Journal\Helpers\ReportHelper; +use Insane\Journal\Contracts\AccountStatementShows; class AccountStatementShow implements AccountStatementShows { public function show(User $user, string $reportName, ?int $accountId): array { $this->validate($user); + $filters= [ + 'account_id' => $accountId + ]; - return ReportHelper::getGeneralLedger($user->current_team_id, $reportName, [ - 'account_id' => $accountId, - ]); + return ReportHelper::getGeneralLedger($user->current_team_id, $reportName, $filters); } public function validate(mixed $user) diff --git a/app/Domains/Transaction/Services/TransactionService.php b/app/Domains/Transaction/Services/TransactionService.php index 7e0cd347..8f5b4bf6 100644 --- a/app/Domains/Transaction/Services/TransactionService.php +++ b/app/Domains/Transaction/Services/TransactionService.php @@ -244,7 +244,6 @@ public static function getNetWorth($teamId, $startDate, $endDate) ", [ 'teamId' => $teamId, 'monthDate' => $endDate - // 'detailTypes' => implode(',', AccountDetailType::ALL) ]); } @@ -432,4 +431,37 @@ public static function getBareSplits($teamId, $options) ->whereBetween('date', [$options['startDate'], $options['endDate']]) ->when(isset($options['limit']), fn ($query) => $query->limit($options['limit'])); } + + public function getCreditCardSpentTransactions(int $teamId) { + return DB::table(DB::raw('categories g')) + ->selectRaw('SUM(transaction_lines.amount * transaction_lines.type) as total, + accounts.id account_id, + date_format(transactions.date, "%Y-%m-01") as date, + accounts.display_id account_display_id, + accounts.name account_name, + accounts.alias account_alias, + categories.name, + categories.id, + categories.display_id, + categories.alias, + g.display_id groupName, + g.alias groupAlias, + MONTH(transactions.date) as months' + ) + ->groupByRaw('transactions.id') + ->join('categories', 'g.id', '=', 'categories.parent_id') + ->join('accounts', 'accounts.category_id', '=', 'categories.id') + ->join('transaction_lines', 'transaction_lines.account_id', '=', 'accounts.id') + ->join('transactions', fn ($q)=> $q->on('transactions.id', 'transaction_lines.transaction_id')) + ->orderByRaw('g.index,categories.index, accounts.index,accounts.number') + ->where(fn ($q) => $q->where([ + 'transactions.status' => Transaction::STATUS_VERIFIED, + 'accounts.team_id' => $teamId + ])->orWhereNull('transactions.status') + ) + ->where([ + 'g.display_id' => 'liabilities', + ]) + ->get(); + } } diff --git a/components.d.ts b/components.d.ts index c48e99ae..d237a09e 100644 --- a/components.d.ts +++ b/components.d.ts @@ -30,6 +30,7 @@ declare module 'vue' { IMdiMinus: typeof import('~icons/mdi/minus')['default'] IMdiPencil: typeof import('~icons/mdi/pencil')['default'] IMdiPlus: typeof import('~icons/mdi/plus')['default'] + IMdiPrinter: typeof import('~icons/mdi/printer')['default'] IMdiSearch: typeof import('~icons/mdi/search')['default'] IMdiSort: typeof import('~icons/mdi/sort')['default'] IMdiStar: typeof import('~icons/mdi/star')['default'] diff --git a/package.json b/package.json index efd00591..3be3e462 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "private": true, "engines": { - "node": "^18.x" + "node": ">=18" }, "scripts": { "dev": "vite", diff --git a/resources/js/Pages/Journal/Accounts/Index.vue b/resources/js/Pages/Journal/Accounts/Index.vue new file mode 100644 index 00000000..8672c396 --- /dev/null +++ b/resources/js/Pages/Journal/Accounts/Index.vue @@ -0,0 +1,195 @@ + + + + + diff --git a/resources/js/Pages/Journal/Accounts/cols.ts b/resources/js/Pages/Journal/Accounts/cols.ts new file mode 100644 index 00000000..8670a5f6 --- /dev/null +++ b/resources/js/Pages/Journal/Accounts/cols.ts @@ -0,0 +1,28 @@ +export default name => { + return [ + { + label: name || "Account Name", + name: "display_id", + width: 200, + type: "custom", + render(row) { + return `${row.number} - ${row.alias || row.name}` + } + }, + { + label: "", + name: "display_id", + width: 300 + }, + { + label: "", + name: "description" + }, + { + label: "", + name: "actions", + width: 300, + type: "custom" + } + ]; + }; diff --git a/resources/js/Pages/Journal/Invoices/Create.vue b/resources/js/Pages/Journal/Invoices/Create.vue new file mode 100644 index 00000000..15d14144 --- /dev/null +++ b/resources/js/Pages/Journal/Invoices/Create.vue @@ -0,0 +1,32 @@ + + + diff --git a/resources/js/Pages/Journal/Invoices/Edit.vue b/resources/js/Pages/Journal/Invoices/Edit.vue new file mode 100644 index 00000000..aeff86fc --- /dev/null +++ b/resources/js/Pages/Journal/Invoices/Edit.vue @@ -0,0 +1,50 @@ + + + diff --git a/resources/js/Pages/Journal/Invoices/Index.vue b/resources/js/Pages/Journal/Invoices/Index.vue new file mode 100644 index 00000000..03e62fd8 --- /dev/null +++ b/resources/js/Pages/Journal/Invoices/Index.vue @@ -0,0 +1,147 @@ + + + + + diff --git a/resources/js/Pages/Journal/Invoices/Partials/InvoiceEmail.vue b/resources/js/Pages/Journal/Invoices/Partials/InvoiceEmail.vue new file mode 100644 index 00000000..197433e4 --- /dev/null +++ b/resources/js/Pages/Journal/Invoices/Partials/InvoiceEmail.vue @@ -0,0 +1,135 @@ + + + diff --git a/resources/js/Pages/Journal/Invoices/Partials/InvoiceGrid.vue b/resources/js/Pages/Journal/Invoices/Partials/InvoiceGrid.vue new file mode 100644 index 00000000..b1f8cf97 --- /dev/null +++ b/resources/js/Pages/Journal/Invoices/Partials/InvoiceGrid.vue @@ -0,0 +1,289 @@ + + + +> + + + + diff --git a/resources/js/Pages/Journal/Invoices/Partials/InvoiceModal.vue b/resources/js/Pages/Journal/Invoices/Partials/InvoiceModal.vue new file mode 100644 index 00000000..52a22ede --- /dev/null +++ b/resources/js/Pages/Journal/Invoices/Partials/InvoiceModal.vue @@ -0,0 +1,214 @@ + + + + + diff --git a/resources/js/Pages/Journal/Invoices/Partials/InvoiceTotalItem.vue b/resources/js/Pages/Journal/Invoices/Partials/InvoiceTotalItem.vue new file mode 100644 index 00000000..7d0533cb --- /dev/null +++ b/resources/js/Pages/Journal/Invoices/Partials/InvoiceTotalItem.vue @@ -0,0 +1,65 @@ + + + + + diff --git a/resources/js/Pages/Journal/Invoices/Partials/InvoiceTotalPayment.vue b/resources/js/Pages/Journal/Invoices/Partials/InvoiceTotalPayment.vue new file mode 100644 index 00000000..37ccdf46 --- /dev/null +++ b/resources/js/Pages/Journal/Invoices/Partials/InvoiceTotalPayment.vue @@ -0,0 +1,77 @@ +/* eslint-disable vue/valid-v-on */ + + + + + diff --git a/resources/js/Pages/Journal/Invoices/Partials/InvoiceTotals.vue b/resources/js/Pages/Journal/Invoices/Partials/InvoiceTotals.vue new file mode 100644 index 00000000..617fbfb5 --- /dev/null +++ b/resources/js/Pages/Journal/Invoices/Partials/InvoiceTotals.vue @@ -0,0 +1,195 @@ +/* eslint-disable vue/valid-v-on */ + + + diff --git a/resources/js/Pages/Journal/Invoices/Partials/PropertyChargeModal.vue b/resources/js/Pages/Journal/Invoices/Partials/PropertyChargeModal.vue new file mode 100644 index 00000000..f0fc1d11 --- /dev/null +++ b/resources/js/Pages/Journal/Invoices/Partials/PropertyChargeModal.vue @@ -0,0 +1,322 @@ + + +