abivia / ledger Goto Github PK
View Code? Open in Web Editor NEWGeneral Ledger and Journal Accounting Package and API for Laravel
License: MIT License
General Ledger and Journal Accounting Package and API for Laravel
License: MIT License
I note you can only get a single item (resource) using the /get API routes. Is this deliberate?
After giving code and uuid still return this error
errors
:
[["Request requires an account code or uuid."], "Bad request.",…]
0: ["Request requires an account code or uuid."]
1:"Bad request."
2:"Request requires an account code or uuid."
time:"2023-02-24T03:35:34.008077Z"
If the business purchases a box of paper for $100 with cash (a debit account), then the account representing cash decreases by $100 and the account representing office expenses (a credit account) increases by $100.
Saw this in your docs, and thought your starting accounting example can be refined:
As I understand it with Abivia Ledger, a credit is always a positive ve amount whilst a debit is always a negative.
Consistent with this, In your example here, Inventory was debited (-150) when stock was bought.
Therefore, if I’m not muddling things up, when moving the sold value to COGS, it should be a credit (I.e. +10 not -10) to reduce Inventory. Given it’s a debit balance account, the Inventory account should show -140 not -160 after the transaction. COGS should normally carry a debit balance (an expense account) therefore it should be debited (-10 not +10) to increase expense.
Please confirm.
Testing some of the APIs, I note the responses are not as described in the docs. Specifically calling domain/add and currency/add gets a reply with only "time" in the response whilst the docs show a fuller response.
Do I have a wrong config somewhere?
Hello!
I encountered an error while creating a report with the name "trialBalance"
Unable to assign null to property Abivia\Ledger\Models\ReportData::$journalEntryId of type int
This happened because the table named "journal_entries" was empty and JournalEntry::query()->max('journalEntryId')
returned null and tried to put it in $reportData->journalEntryId
which is of type int.
As a quick fix, I used ?? 0
here https://github.com/abivia/ledger/blob/main/src/Reports/TrialBalanceReport.php#L55.
[2022-11-18 17:13:25] local.ERROR: Cannot assign null to property Abivia\Ledger\Models\ReportData::$journalEntryId of type int {"exception":"[object] (TypeError(code: 0): Cannot assign null to property Abivia\\Ledger\\Models\\ReportData::$journalEntryId of type int at /var/www/html/vendor/abivia/ledger/src/Reports/TrialBalanceReport.php:57)
[stacktrace]
#0 /var/www/html/vendor/abivia/ledger/src/Http/Controllers/ReportController.php(83): Abivia\\Ledger\\Reports\\TrialBalanceReport->collect()
#1 /var/www/html/vendor/abivia/ledger/src/Http/Controllers/Api/ReportApiController.php(33): Abivia\\Ledger\\Http\\Controllers\\ReportController->generate()
#2 /var/www/html/vendor/laravel/framework/src/Illuminate/Routing/ControllerDispatcher.php(46): Abivia\\Ledger\\Http\\Controllers\\Api\\ReportApiController->run()
#3 /var/www/html/vendor/laravel/framework/src/Illuminate/Routing/Route.php(260): Illuminate\\Routing\\ControllerDispatcher->dispatch()
#4 /var/www/html/vendor/laravel/framework/src/Illuminate/Routing/Route.php(205): Illuminate\\Routing\\Route->runController()
#5 /var/www/html/vendor/laravel/framework/src/Illuminate/Routing/Router.php(727): Illuminate\\Routing\\Route->run()
#6 /var/www/html/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(141): Illuminate\\Routing\\Router->Illuminate\\Routing\\{closure}()
#7 /var/www/html/vendor/laravel/framework/src/Illuminate/Routing/Middleware/SubstituteBindings.php(50): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}()
#8 /var/www/html/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(180): Illuminate\\Routing\\Middleware\\SubstituteBindings->handle()
#9 /var/www/html/vendor/laravel/framework/src/Illuminate/Routing/Middleware/ThrottleRequests.php(126): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}()
#10 /var/www/html/vendor/laravel/framework/src/Illuminate/Routing/Middleware/ThrottleRequests.php(102): Illuminate\\Routing\\Middleware\\ThrottleRequests->handleRequest()
#11 /var/www/html/vendor/laravel/framework/src/Illuminate/Routing/Middleware/ThrottleRequests.php(54): Illuminate\\Routing\\Middleware\\ThrottleRequests->handleRequestUsingNamedLimiter()
#12 /var/www/html/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(180): Illuminate\\Routing\\Middleware\\ThrottleRequests->handle()
#13 /var/www/html/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(116): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}()
#14 /var/www/html/vendor/laravel/framework/src/Illuminate/Routing/Router.php(728): Illuminate\\Pipeline\\Pipeline->then()
#15 /var/www/html/vendor/laravel/framework/src/Illuminate/Routing/Router.php(705): Illuminate\\Routing\\Router->runRouteWithinStack()
#16 /var/www/html/vendor/laravel/framework/src/Illuminate/Routing/Router.php(669): Illuminate\\Routing\\Router->runRoute()
#17 /var/www/html/vendor/laravel/framework/src/Illuminate/Routing/Router.php(658): Illuminate\\Routing\\Router->dispatchToRoute()
#18 /var/www/html/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php(190): Illuminate\\Routing\\Router->dispatch()
#19 /var/www/html/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(141): Illuminate\\Foundation\\Http\\Kernel->Illuminate\\Foundation\\Http\\{closure}()
#20 /var/www/html/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/TransformsRequest.php(21): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}()
#21 /var/www/html/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/ConvertEmptyStringsToNull.php(31): Illuminate\\Foundation\\Http\\Middleware\\TransformsRequest->handle()
#22 /var/www/html/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(180): Illuminate\\Foundation\\Http\\Middleware\\ConvertEmptyStringsToNull->handle()
#23 /var/www/html/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/TransformsRequest.php(21): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}()
#24 /var/www/html/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/TrimStrings.php(40): Illuminate\\Foundation\\Http\\Middleware\\TransformsRequest->handle()
#25 /var/www/html/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(180): Illuminate\\Foundation\\Http\\Middleware\\TrimStrings->handle()
#26 /var/www/html/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/ValidatePostSize.php(27): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}()
#27 /var/www/html/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(180): Illuminate\\Foundation\\Http\\Middleware\\ValidatePostSize->handle()
#28 /var/www/html/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/PreventRequestsDuringMaintenance.php(86): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}()
#29 /var/www/html/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(180): Illuminate\\Foundation\\Http\\Middleware\\PreventRequestsDuringMaintenance->handle()
#30 /var/www/html/vendor/laravel/framework/src/Illuminate/Http/Middleware/HandleCors.php(62): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}()
#31 /var/www/html/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(180): Illuminate\\Http\\Middleware\\HandleCors->handle()
#32 /var/www/html/vendor/laravel/framework/src/Illuminate/Http/Middleware/TrustProxies.php(39): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}()
#33 /var/www/html/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(180): Illuminate\\Http\\Middleware\\TrustProxies->handle()
#34 /var/www/html/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(116): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}()
#35 /var/www/html/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php(165): Illuminate\\Pipeline\\Pipeline->then()
#36 /var/www/html/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php(134): Illuminate\\Foundation\\Http\\Kernel->sendRequestThroughRouter()
#37 /var/www/html/public/index.php(52): Illuminate\\Foundation\\Http\\Kernel->handle()
#38 /var/www/html/vendor/laravel/framework/src/Illuminate/Foundation/resources/server.php(16): require_once('...')
#39 {main}
I can see the 2 currencies I created in the ledger_currencies, table yet a get request with the json body below gives an error:
{
"code": "CAD"
}
CAD is one of the currencies in the table.
After installation and adding several accounts, the /account/query together with all the endpoints that are suffixed by '/query' such as /currency/query and journal/query return the following exception instead of an empty result when I don't have anything under it TypeError: Abivia\Ledger\Messages\AccountQuery::fromArray(): Argument #1 ($data) must be of type array, null given, called in /var/www/vendor/abivia/ledger/src/Messages/Message.php on line 121 in file var/www/vendor/abivia/ledger/src/Messages/AccountQuery.php on line 29.
Did I miss a configuration?
Originally posted by @instancezero in #21
Given the PHP API is more complete than the JSON API, please confirm: does it mean ALL functionality in the PHP is NOT yet available in the JSON?
Or is it the case that JSON has all functionality already and only the documentation is WIP?
array:2 [▼ // platform/plugins/accounting/src/Http/Controllers/AccountController.php:74
"errors" => array:2 [▼
0 => "Feature is not yet implemented."
1 => "Account closing not yet implemented."
]
"time" =>
Illuminate\Support
Carbon @1704729191 {#3862 ▼
#endOfTime: false
#startOfTime: false
#constructedObjectId: "0000000000000f160000000000000000"
#localMonthsOverflow: null
#localYearsOverflow: null
#localStrictModeEnabled: null
#localHumanDiffOptions: null
#localToStringFormat: null
#localSerializer: null
#localMacros: null
#localGenericMacros: null
#localFormatFunction: null
#localTranslator: null
#dumpProperties: array:3 [▶]
#dumpLocale: null
#dumpDateProperties: null
date: 2024-01-08 15:53:11.203817 UTC (+00:00)
}
]
what does that mean ??
Hello,
Thank you for your wonderful work. I am trying to integrate it into a multitenant set-up through Filament V3 where a Ledger would belong to a company.
I have extended the LedgerName model to add the relationship to the company as follows:
<?php
namespace App\Models\Ledger;
use Abivia\Ledger\Models\LedgerName;
use Illuminate\Database\Eloquent\Relations\BelongsTo;
use Wallo\FilamentCompanies\FilamentCompanies;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\SoftDeletes;
class Ledger extends LedgerName {
use SoftDeletes;
protected $table = 'ledger_names';
public function company(): BelongsTo
{
return $this->belongsTo(FilamentCompanies::companyModel(), 'company_id');
}
public function createdBy(): BelongsTo
{
return $this->belongsTo(FilamentCompanies::userModel(), 'created_by');
}
public function updatedBy(): BelongsTo
{
return $this->belongsTo(FilamentCompanies::userModel(), 'updated_by');
}
}
I am looking for a best practise recommendation being new to Laravel while also trying to avoid redoing most of the work which the API already has done when persisting the relationships such as currency, accounts etc.
Best,
N
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.