2017 © Pedro Peláez
 

library yii2-d3acc

Yii2 accounting module, accounts and periods

image

d3yii2/yii2-d3acc

Yii2 accounting module, accounts and periods

  • Sunday, July 22, 2018
  • by uldisn
  • Repository
  • 2 Watchers
  • 1 Stars
  • 78 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 3 Versions
  • 4 % Grown

The README.md

Yii2 Latest Stable Version Total Downloads Latest Unstable Version License, (*1)

Accounting

This Yii2 module provides support for balance accounting (bookkeeping) system based on debit and credit principles. Provide additinal functionality: * periods (closing period and period balance) * dynamicly creating accounts attached one or more tables, (*2)

Installation

The preferred way to install this extension is through composer., (*3)

Either run, (*4)

php composer.phar require --prefer-dist d3yii2/yii2-d3acc "*"

or add, (*5)

"d3yii2/yii2-d3acc": "*"

to the require section of your composer.json file., (*6)

push migration, (*7)

DB structure

DB Schema, (*8)

Account definition

Create object acc, (*9)

use \d3acc\models\AcRecAcc;
use Yii;
/**
 * Description of acc
 *
 * @author Dealer
 */
 class acc
{
    const MONTH_PERIOD = 1;

    const PLAYER_ACC        = 4;
    const EXPENSES          = 10;
    const FOND_PLAYGROUND   = 7;

    acc::CODE_CRD_PLAYGROUND = 'CreditPlaygound';

    /**
     * get player  account
     * @param int $personId
     * @return AcRecAcc
     */
    public static function player($personId)
    {
        return AcRecAcc::getAcc(self::PLAYER_ACC, ['person' => $personId]);
    }

    /**
     * get expenses  account
     * @return AcRecAcc
     */
    public static function expenses()
    {
        return AcRecAcc::getAcc(self::EXPENSES);
    }

    /**
     * get for player playground account
     * @param int $personId
     * @param int $playgroundId
     * @return AcRecAcc
     */
    public static function fondPlayground($personId, $playgroundId)
    {
        return AcRecAcc::getAcc(self::FOND_PLAYGROUND,
                ['person' => $personId, 'playground' => $playgroundId]);
    }    
}

Transaction registration


/** * player accounts */ $recAccPPG = acc::playerPlayground($person_id, $playground_id); $recAccPlayer = acc::player($person_id); $day = date('Y-m-d'); $tran = AcTran::registre($recAccPlayer, $recAccPPG, $personAmt, $day, acc::MONTH_PERIOD, acc::CODE_CRD_PLAYGROUND);

Periods

use d3acc\models\AcPeriod;
$acPeriod = AcPeriod::getActivePeriod(acc::MONTH_PERIOD))

//close period
\d3acc\components\PeriodMonth::close(acc::MONTH_PERIOD);


Transactions

 $recAccPlayer = acc::player($person_id);
 $data = AcTran::accPeriodTran($recAccPlayer, $acPeriod);

Balance

 $filter  = ['playground' => $playgroundId]
 $playgroundAllPersonBalance = AcTran::accBalanceFilter(acc::FOND_PLAYGROUND, $acPeriod,$filter);

 $filter  = ['person' => $personId]
 $personAllPlaygroundsBalance = AcTran::accBalanceFilter(acc::FOND_PLAYGROUND, $acPeriod,$filter);

 $allPlaygroundsAllPersonBalance = AcTran::accBalanceFilter(acc::FOND_PLAYGROUND, $acPeriod,[]);


Define account plan by creating acc class, (*10)

Add definition record in tables, (*11)

Migrations with AccConstructor

$constructor = new AccConstructor();

Load existind or create new account (ac_account table) for session, (*12)

$constructor->load($accId);
$constructor->create($code, $name);

Add new account dimension (ac_def table) for loaded/created account, (*13)

$definition = $constructor->addDimension($table, $pkField);

Add new extended-account (ac_rec_acc table) for loaded/created account, (*14)

$extAccount = $constructor->addExtendedAccount();

Add new dimension value (ac_rec_ref table) and recalculate label for given extended-account (ac_rec_acc table), (*15)

$constructor->addDimensionRecAcc($extAccount->id, $definition->id, $pk_value);

The Versions

22/07 2018

dev-master

9999999-dev https://github.com/d3yii2/yii2-d3acc

Yii2 accounting module, accounts and periods

  Sources   Download

BSD-4-Clause

The Requires

 

yii2 accounts periods balance accountig

28/07 2017

dev-add-license-1

dev-add-license-1 https://github.com/d3yii2/yii2-d3acc

Yii2 accounting module, accounts and periods

  Sources   Download

BSD-4-Clause

The Requires

 

yii2 accounts periods balance accountig

07/02 2017

0.4.0

0.4.0.0

Accounting

  Sources   Download

MIT

The Requires

 

accountig