定制 d3yii2/yii2-d3acc 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

d3yii2/yii2-d3acc

最新稳定版本:0.4.0

Composer 安装命令:

composer require d3yii2/yii2-d3acc

包简介

Yii2 accounting module, accounts and periods

关键字:

README 文档

README

Yii2 Latest Stable Version Total Downloads Latest Unstable Version License

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

Installation

The preferred way to install this extension is through composer.

Either run

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

or add

"d3yii2/yii2-d3acc": "*"

to the require section of your composer.json file.

push migration

DB structure

DB Schema

Account definition

Create object acc

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

Add definition record in tables

Migrations with AccConstructor

$constructor = new AccConstructor();

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

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

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

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

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

$extAccount = $constructor->addExtendedAccount();

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

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

统计信息

  • 总下载量: 359
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 3
  • 点击次数: 4
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 3
  • Watchers: 2
  • Forks: 2
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2016-10-09