Giter Club home page Giter Club logo

accounting's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

accounting's Issues

Not rolling back accounting_journal_transactions

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,

Seeder Column 'morphed_id' cannot be null

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);
    });
    
}

`

Getting error on credit transaction having value in float

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.

How do I correctly create a deferred credit journal entry?

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!

New Release

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!

Aging

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.

Deleting a transaction ?

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?

creditDollars function Round of issue

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:

  1. First float value convert to string type -strval(), then convert integer int(), intval()
    $value = (int) strval($value * 100);
  2. Using round() function, then convert to integer
    $value = (int) round($value * 100, 0);

Thank you

DB Transactions not used correctly

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

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.