scottlaurent / accounting Goto Github PK
View Code? Open in Web Editor NEWUseful Laravel Model functions to help develop debit/credit accounting journals.
License: MIT License
Useful Laravel Model functions to help develop debit/credit accounting journals.
License: MIT License
Dear Developer,
I am using your package in my project, I am facing a value round of issue, Please ASAP fix this issue.
Problem Area:
Model : Journal.php
Line No : 206
$value = (int)($value * 100);
public function creditDollars($value, string $memo = null, Carbon $post_date = null): JournalTransaction { $value = (int)($value * 100); return $this->credit($value, $memo, $post_date); }
$value = 32.66
after multiple of 100
$value = 3266.0
$value = (int)($value * 100);
then Execute this line, I got the output= 3265
Suggestion for solve this isssue:
Thank you
Trying to seed a model with a initJournal returns error
SQLSTATE[23000]: Integrity constraint violation: 1048 Column 'morphed_id' cannot be null (SQL: insert into
accounting_journals (
ledger_id,
currency,
balance,
morphed_id,
morphed_type,
updated_at,
created_at) values (?, USD, 0, ?, App\Models\FundSource, 2023-06-21 10:03:49, 2023-06-21 10:03:49))
Model
`use Scottlaurent\Accounting\ModelTraits\AccountingJournal;
class FundSource extends Model
{
use HasFactory, AccountingJournal;
protected $guarded = ["id"];
public static function boot()
{
parent::boot();
self::creating(function($model) {
$model->initJournal() ;
$model->journal->creditDollars(100);
});
}
`
if run php artisan vendor:publish
i already added use App\Product; in controller but still showing above error.
anyone having any idea ?
Hello,
Nice work! During review I noted however that you are not using DB transactions correctly. You need to add a
DB::beginTransaction();
statement in https://github.com/scottlaurent/accounting/blob/master/src/Services/Accounting.php#L99. Otherwise your DB::commit(); and - the actual problem - DB::rollBack(); is useless as the transactions are stored one by one before already.
You can easily confirm this by adding a die() at the end of the foreach loop. You will see that you end up with the first transaction only being saved in the DB.
Moritz
The library works fine when the when transaction amount is in integer such as 19, 245 etc.
But when the amount is in float such as 2.45, 9.82 etc, in that case I keep getting below error:
"Amount must be an integer(ish) value"
I have implemented this library and love how it works. The only issue I encountered is with floating point numbers.
Is there any way to resolve this error?
Thank you.
Are there plans to tag a new release with the fix to support 5.7+? I switched my composer to "dev-master" for now, but it feels dirty. Thanks!
Hi,
Nice work you got here, just wondering, is there a way to figure out which are the outstanding AR/AP invoices/bills instead of just getting a total due_balance? Thank you.
Hi Scott,
First off, and most importantly, thank you for building and sharing this package with the public.
I've developed a Laravel booking reservation website that the owner would like to be able to integrate with QBO or Xero. I believe it would be helpful to have an accounting database design included to help facilitate the syncing of booking transactions and monthly invoices. Here's the scenario that has prompted that direction:
The website will offer commission-free bookings for the first 3 months to the owners of listings. It also offers a refer-a-friend system that provides a set amount or percentage off discount to the end-user (customer) that has been referred or has referred someone who completed a booking. That set amount or percentage discount is applied to the commission owed the website owner. However, since the bookings are commission-free for the first 3 months, the listing owner will not be able to take advantage of the discount off his/her commission. Therefore, the website owner would like to credit the listing owner that amount, to be redeemed when the listing owner has bookings that occur after the 3-month commission-free period. Invoices are sent out on a monthly basis for bookings completed within the month.
Here's an example (basically said another way):
Listing Owner A signs up to the website and agrees to pay the website owner a 10% commission rate for bookings through the website. Listing Owner A gets a 3-month commission-free period.
Refer-A-Friend offers a $50 discount to the customer with a booking over $500.
Listing Owner A receives a booking for $600 through the Refer-A-Friend promotion during the commission-free period. He pays no commission on the booking, but is credited with $50. The customer only pays $550 for the booking.
Listing Owner A receives a straight booking for $1000 during the period when commission is now at 10%. He owes the website owner $100, but because he has a $50 commission credit, he only has to pay $50. The customer is still paying $1000 for the booking.
Can you explain how this is achieved through an accounting journal-entry system? I debated whether I should post this on stackoverflow.com, or here, but decided on here since I am wanting to utilize your package, and want to make sure it is able to handle this scenario. I hope it is not asking too much, but I must admit: I've never taken an accounting class in college, and haven't found much luck in finding a solution through googling.
Thanks in advance!
Hello, first thank you very much for this package.
I found this, is a small bug, in the accounting journal transactions migration is dropping accounting journals instead of accounting journal transactions.
Best regards,
In my use-case, i periodically import a data file into the system. I wanted to be able to override older import if the new import has some new data.
Is there a way to search and delete an old transaction in order for me to replace it with a new one?
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.