Eloquent Double Entry Accounting with focus on IFRS Compliant Reporting
7
0
0
Package Data
Maintainer Username: miladghorbani1999
Maintainer Contact: bavan@example.com (Bavan)
Package Create Date: 2025-11-15
Package Last Update: 2025-12-15
Language: PHP
License: MIT
Last Refreshed: 2025-12-29 15:00:04
Package Statistics
Total Downloads: 7
Monthly Downloads: 7
Daily Downloads: 2
Total Stars: 0
Total Watchers: 0
Total Forks: 0
Total Open Issues: 2

فهرست مطالب


ویژگی‌ها

✔ پشتیبانی چندشرکتی (Entity)
✔ حسابداری دفتردوبل کامل
✔ حساب‌های چندارزی + تفاوت نرخ ارز
✔ محافظت در برابر تغییرات مستقیم DB
✔ VAT ورودی، خروجی، ترکیبی
✔ گزارش‌های کامل IFRS شامل:

  • Income Statement
  • Balance Sheet
  • Cash Flow
  • Trial Balance

✔ زمان‌بندی بدهکار/بستانکار (Aging)
✔ ثبت‌های نقدی و اعتباری برای فروش/خرید
✔ گزارش Account Statement و Account Schedule


نصب

composer require "bavan/eloquent-ifrs"
php artisan migrate

اگر از Lumen استفاده می‌کنید:

$app->register(IFRS\IFRSServiceProvider::class);

پیکربندی

انتشار فایل config:

php artisan vendor:publish --provider="IFRS\IFRSServiceProvider"

این فایل ایجاد می‌شود:

config/ifrs.php

مهم‌ترین تنظیمات

  • user_model → مدل User پروژه
  • locales → زبان‌ها
  • forex_scale → دقت نرخ ارز
  • single_currency → حساب‌های محدود به یک ارز
  • aging_schedule_brackets → بازه‌های زمانی بدهکار/بستانکار
  • ساختار درآمد، هزینه، دارایی، بدهی، حقوق صاحبان سهام
  • تنظیمات Cashflow

شروع کار

افزودن خصوصیات به مدل User:

use IFRS\Traits\IFRSUser;
use IFRS\Traits\Recycling;

class User extends Authenticatable
{
    use IFRSUser, Recycling;
}

مثال‌های عملی

۱. ساخت شرکت و ارز

$entity = Entity::create(['name' => 'شرکت نمونه']);

$currency = Currency::create([
    'name' => 'Euro',
    'currency_code' => 'EUR'
]);

$entity->currency_id = $currency->id;
$entity->save();

۲. تعریف VAT

$outputVat = Vat::create([
    'name' => "Standard Output Vat",
    'code' => "O",
    'rate' => 20,
    'account_id' => Account::create([
        'name' => "Sales VAT Account",
        'account_type' => Account::CONTROL,
    ])
]);

۳. تعریف حساب‌ها

$bank = Account::create([
    'name' => "Bank Account",
    'account_type' => Account::BANK,
]);

$revenue = Account::create([
    'name' => "Sales Revenue",
    'account_type' => Account::OPERATING_REVENUE,
]);

۴. ساخت دوره مالی

$period = ReportingPeriod::create([
    'period_count' => 1,
    'calendar_year' => 2024,
]);

۵. ثبت فروش نقدی (Cash Sale)

$cashSale = CashSale::create([
    'account_id' => $bank->id,
    'date' => now(),
    'narration' => "Example Cash Sale",
]);

ایجاد Line Item

$item = LineItem::create([
    'account_id' => $revenue->id,
    'narration' => "Sale Item",
    'quantity' => 1,
    'amount' => 100,
]);

$item->addVat($outputVat);

$cashSale->addLineItem($item);
$cashSale->post(); // ثبت در دفتر کل

ثبت‌های دیگر

$clientInvoice = ClientInvoice::create([...]);
$cashPurchase = CashPurchase::create([...]);
$supplierBill = SupplierBill::create([...]);
$clientReceipt = ClientReceipt::create([...]);

تخصیص (Assignment)

Assignment::create([
    'assignment_date'=> now(),
    'transaction_id' => $clientReceipt->id,
    'cleared_id' => $clientInvoice->id,
    'cleared_type'=> $clientInvoice->clearedType,
    'amount' => 50,
]);

گزارش‌گیری

صورت سود و زیان (Income Statement)

$income = new IncomeStatement("2021-01-01","2021-12-31");
echo $income->toString();

ترازنامه (Balance Sheet)

$bs = new BalanceSheet("2021-12-31");
echo $bs->toString();

Cash Flow

$cf = new CashFlowStatement("2021-12-31");

گزارش‌های میانی

Account Statement

$statement = new AccountStatement($clientAccount)->getTransactions();

Account Schedule

$schedule = new AccountSchedule($clientAccount, $currency)->getTransactions();

نقشه راه

  • [x] Cashflow Statement
  • [x] Laravel 8–12 Compatibility
  • [x] Multicurrency
  • [x] VAT پیشرفته
  • [x] گزارش‌های تلفیقی
  • [x] پشتیبانی کامل لاراول 12+
  • [x] ماژول دارایی ثابت

لایسنس

انتشار تحت مجوز MIT.


تغییرات نسخه‌ها

از CHANGELOG رسمی پکیج

  • Laravel 12 Compatibility
  • Laravel 11 Compatibility
  • Attachments to Transactions
  • Laravel 10 Compatibility
  • Laravel 9 Compatibility
  • Compound VAT
  • Forex Difference هنگام تسویه
  • Forex Translation
  • پشتیبانی Lumen
  • Cash Flow Statement
  • گزارش Aging
  • اصلاحات پایدار

legers: 
post_account = حسابی که خودش Debit یا Credit می‌شود.
folio_account = حساب طرف مقابل.
entry_type = نوع بدهکار یا بستانکار بودن.
line_item_id = اگر برای آیتم خاص است، این‌جاست؛ بانک همیشه null.
amount = مبلغ واقعی ثبت‌شده.
rate = نرخ ارز.
transaction_id = به کدام ClientReceipt/Invoice/Bill تعلق دارد.

 post_account = حسابی که در همان Ledger در نقش D یا C قرار دارد
در پرداخت:

Ledger بانک → post_account = bank
Ledger آیتم → post_account = service/patientShare/etc
✔ folio_account = حساب طرف مقابل در همان ثبت دوبل
در پرداخت:

Ledger بانک → folio_account = account of first LineItem
Ledger آیتم → folio_account = bank