├── runtime └── .gitignore ├── tests ├── codeception │ ├── unit │ │ ├── fixtures │ │ │ ├── .gitkeep │ │ │ └── data │ │ │ │ └── .gitkeep │ │ ├── templates │ │ │ └── fixtures │ │ │ │ └── .gitkeep │ │ ├── _bootstrap.php │ │ └── models │ │ │ ├── UserTest.php │ │ │ ├── LoginFormTest.php │ │ │ └── ContactFormTest.php │ ├── _output │ │ └── .gitignore │ ├── fixtures │ │ └── .gitignore │ ├── templates │ │ └── .gitignore │ ├── acceptance │ │ ├── _bootstrap.php │ │ ├── AboutCept.php │ │ ├── HomeCept.php │ │ ├── LoginCept.php │ │ └── ContactCept.php │ ├── functional │ │ ├── _bootstrap.php │ │ ├── AboutCept.php │ │ ├── HomeCept.php │ │ ├── LoginCept.php │ │ └── ContactCept.php │ ├── .gitignore │ ├── unit.suite.yml │ ├── config │ │ ├── unit.php │ │ ├── acceptance.php │ │ ├── config.php │ │ └── functional.php │ ├── _pages │ │ ├── AboutPage.php │ │ ├── LoginPage.php │ │ └── ContactPage.php │ ├── bin │ │ ├── _bootstrap.php │ │ ├── yii │ │ └── yii.bat │ ├── functional.suite.yml │ ├── acceptance.suite.yml │ └── _bootstrap.php └── codeception.yml ├── web ├── assets │ └── .gitignore ├── robots.txt ├── favicon.ico ├── .htaccess ├── index.php ├── index-test.php └── css │ └── site.css ├── .bowerrc ├── views ├── report │ ├── index.php │ ├── balance-trial.php │ ├── balance-sheet.php │ └── income-statement.php ├── account │ ├── create.php │ ├── update.php │ ├── _search.php │ ├── _form.php │ ├── index.php │ └── view.php ├── project │ ├── create.php │ ├── update.php │ ├── _search.php │ ├── index.php │ ├── _form.php │ └── view.php ├── currency │ ├── create.php │ ├── update.php │ ├── _search.php │ ├── _form.php │ ├── index.php │ └── view.php ├── department │ ├── create.php │ ├── update.php │ ├── _search.php │ ├── index.php │ ├── _form.php │ └── view.php ├── payment │ ├── create.php │ ├── update.php │ └── _search.php ├── receive │ ├── create.php │ ├── update.php │ └── _search.php ├── site │ ├── error.php │ ├── login.php │ ├── about.php │ ├── index.php │ └── contact.php └── journal │ ├── create.php │ ├── update.php │ ├── _search.php │ ├── unbalanced.php │ └── _details.php ├── config ├── db.php ├── params.php └── console.php ├── models ├── AccountsChecking.php ├── ProjectsQuery.php ├── JournalsQuery.php ├── AccountsPathQuery.php ├── CurrenciesQuery.php ├── DepartmentsQuery.php ├── JournalTypesQuery.php ├── JournalDetailsQuery.php ├── AccountsQuery.php ├── Model.php ├── ContactForm.php ├── CurrenciesSearch.php ├── JournalTypesSearch.php ├── JournalTypes.php ├── DepartmentsSearch.php ├── Currencies.php ├── LoginForm.php ├── Departments.php ├── AccountsSearch.php ├── User.php ├── JournalDetailsSearch.php ├── JournalsSearch.php ├── ProjectsSearch.php ├── ReceiveSearch.php ├── PaymentSearch.php ├── Accounts.php ├── Projects.php └── JournalDetails.php ├── .gitignore ├── yii.bat ├── yii ├── assets └── AppAsset.php ├── mail └── layouts │ └── html.php ├── commands └── HelloController.php ├── migrations ├── m150505_125813_create_departments_table.php ├── m151109_021305_create_currencies_table.php ├── m150505_125803_create_projects_table.php ├── m160629_093144_create_journal_denormalized_view.php ├── m151109_231542_create_journal_details_table.php ├── m160630_045430_create_accounts_path_view.php ├── m151109_231530_create_journals_table.php └── m151109_021214_create_journal_types_table.php ├── README.md ├── LICENSE.md ├── controllers ├── ReportController.php ├── SiteController.php ├── ProjectController.php ├── CurrencyController.php └── DepartmentController.php └── composer.json /runtime/.gitignore: -------------------------------------------------------------------------------- 1 | * 2 | !.gitignore -------------------------------------------------------------------------------- /tests/codeception/unit/fixtures/.gitkeep: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /web/assets/.gitignore: -------------------------------------------------------------------------------- 1 | * 2 | !.gitignore 3 | -------------------------------------------------------------------------------- /web/robots.txt: -------------------------------------------------------------------------------- 1 | User-agent: * 2 | Disallow: -------------------------------------------------------------------------------- /tests/codeception/unit/fixtures/data/.gitkeep: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /tests/codeception/_output/.gitignore: -------------------------------------------------------------------------------- 1 | * 2 | !.gitignore -------------------------------------------------------------------------------- /tests/codeception/unit/templates/fixtures/.gitkeep: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /.bowerrc: -------------------------------------------------------------------------------- 1 | { 2 | "directory" : "vendor/bower" 3 | } 4 | -------------------------------------------------------------------------------- /tests/codeception/fixtures/.gitignore: -------------------------------------------------------------------------------- 1 | * 2 | !.gitignore -------------------------------------------------------------------------------- /tests/codeception/templates/.gitignore: -------------------------------------------------------------------------------- 1 | * 2 | !.gitignore -------------------------------------------------------------------------------- /web/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hidayat365/yii2-accounting/HEAD/web/favicon.ico -------------------------------------------------------------------------------- /tests/codeception/unit/_bootstrap.php: -------------------------------------------------------------------------------- 1 | 4 |

report/index

5 | 6 |

7 | You may change the content of this page by modifying 8 | the file . 9 |

10 | -------------------------------------------------------------------------------- /config/db.php: -------------------------------------------------------------------------------- 1 | 'yii\db\Connection', 5 | 'dsn' => 'mysql:host=localhost;dbname=accounting', 6 | 'username' => 'demo', 7 | 'password' => '123456', 8 | 'charset' => 'utf8', 9 | ]; 10 | -------------------------------------------------------------------------------- /models/AccountsChecking.php: -------------------------------------------------------------------------------- 1 | checking()->orderBy('code'); 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /tests/codeception/config/unit.php: -------------------------------------------------------------------------------- 1 | wantTo('ensure that about works'); 9 | AboutPage::openBy($I); 10 | $I->see('About', 'h1'); 11 | -------------------------------------------------------------------------------- /tests/codeception/functional/AboutCept.php: -------------------------------------------------------------------------------- 1 | wantTo('ensure that about works'); 9 | AboutPage::openBy($I); 10 | $I->see('About', 'h1'); 11 | -------------------------------------------------------------------------------- /tests/codeception/_pages/AboutPage.php: -------------------------------------------------------------------------------- 1 | 'admin@example.com', 5 | 'productName' => 'BiruniLabs Accounting', 6 | 'companyName' => 'BiruniLabs', 7 | 'companyEmail' => 'birunilabs@gmail.com', 8 | 'developerName' => 'Nur Hidayat', 9 | 'developerEmail' => 'hidayat365@gmail.com' 10 | ]; 11 | -------------------------------------------------------------------------------- /tests/codeception/acceptance/HomeCept.php: -------------------------------------------------------------------------------- 1 | wantTo('ensure that home page works'); 7 | $I->amOnPage(Yii::$app->homeUrl); 8 | $I->see('My Company'); 9 | $I->seeLink('About'); 10 | $I->click('About'); 11 | $I->see('This is the About page.'); 12 | -------------------------------------------------------------------------------- /tests/codeception/functional/HomeCept.php: -------------------------------------------------------------------------------- 1 | wantTo('ensure that home page works'); 7 | $I->amOnPage(Yii::$app->homeUrl); 8 | $I->see('My Company'); 9 | $I->seeLink('About'); 10 | $I->click('About'); 11 | $I->see('This is the About page.'); 12 | -------------------------------------------------------------------------------- /web/index.php: -------------------------------------------------------------------------------- 1 | run(); 13 | -------------------------------------------------------------------------------- /tests/codeception/unit/models/UserTest.php: -------------------------------------------------------------------------------- 1 | loadFixtures(['user']); 14 | } 15 | 16 | // TODO add test methods here 17 | } 18 | -------------------------------------------------------------------------------- /tests/codeception/bin/_bootstrap.php: -------------------------------------------------------------------------------- 1 | title = Yii::t('app', 'Create Account'); 10 | $this->params['breadcrumbs'][] = ['label' => Yii::t('app', 'Accounts'), 'url' => ['index']]; 11 | $this->params['breadcrumbs'][] = $this->title; 12 | ?> 13 |
14 | 15 |

title) ?>

16 | 17 | render('_form', [ 18 | 'model' => $model, 19 | ]) ?> 20 | 21 |
22 | -------------------------------------------------------------------------------- /views/project/create.php: -------------------------------------------------------------------------------- 1 | title = Yii::t('app', 'Create Project'); 10 | $this->params['breadcrumbs'][] = ['label' => Yii::t('app', 'Projects'), 'url' => ['index']]; 11 | $this->params['breadcrumbs'][] = $this->title; 12 | ?> 13 |
14 | 15 |

title) ?>

16 | 17 | render('_form', [ 18 | 'model' => $model, 19 | ]) ?> 20 | 21 |
22 | -------------------------------------------------------------------------------- /views/currency/create.php: -------------------------------------------------------------------------------- 1 | title = Yii::t('app', 'Create Currency'); 10 | $this->params['breadcrumbs'][] = ['label' => Yii::t('app', 'Currencies'), 'url' => ['index']]; 11 | $this->params['breadcrumbs'][] = $this->title; 12 | ?> 13 |
14 | 15 |

title) ?>

16 | 17 | render('_form', [ 18 | 'model' => $model, 19 | ]) ?> 20 | 21 |
22 | -------------------------------------------------------------------------------- /views/department/create.php: -------------------------------------------------------------------------------- 1 | title = Yii::t('app', 'Create Department'); 10 | $this->params['breadcrumbs'][] = ['label' => Yii::t('app', 'Departments'), 'url' => ['index']]; 11 | $this->params['breadcrumbs'][] = $this->title; 12 | ?> 13 |
14 | 15 |

title) ?>

16 | 17 | render('_form', [ 18 | 'model' => $model, 19 | ]) ?> 20 | 21 |
22 | -------------------------------------------------------------------------------- /views/payment/create.php: -------------------------------------------------------------------------------- 1 | title = Yii::t('app', 'Create Expense'); 10 | $this->params['breadcrumbs'][] = ['label' => Yii::t('app', 'Expenses'), 'url' => ['index']]; 11 | $this->params['breadcrumbs'][] = $this->title; 12 | ?> 13 |
14 | 15 |

title) ?>

16 | 17 | render('_form', [ 18 | 'model' => $model, 19 | 'details' => $details, 20 | ]) ?> 21 | 22 |
23 | -------------------------------------------------------------------------------- /views/receive/create.php: -------------------------------------------------------------------------------- 1 | title = Yii::t('app', 'Create Revenue'); 10 | $this->params['breadcrumbs'][] = ['label' => Yii::t('app', 'Revenues'), 'url' => ['index']]; 11 | $this->params['breadcrumbs'][] = $this->title; 12 | ?> 13 |
14 | 15 |

title) ?>

16 | 17 | render('_form', [ 18 | 'model' => $model, 19 | 'details' => $details, 20 | ]) ?> 21 | 22 |
23 | -------------------------------------------------------------------------------- /yii.bat: -------------------------------------------------------------------------------- 1 | @echo off 2 | 3 | rem ------------------------------------------------------------- 4 | rem Yii command line bootstrap script for Windows. 5 | rem 6 | rem @author Qiang Xue 7 | rem @link http://www.yiiframework.com/ 8 | rem @copyright Copyright (c) 2008 Yii Software LLC 9 | rem @license http://www.yiiframework.com/license/ 10 | rem ------------------------------------------------------------- 11 | 12 | @setlocal 13 | 14 | set YII_PATH=%~dp0 15 | 16 | if "%PHP_COMMAND%" == "" set PHP_COMMAND=php.exe 17 | 18 | "%PHP_COMMAND%" "%YII_PATH%yii" %* 19 | 20 | @endlocal 21 | -------------------------------------------------------------------------------- /tests/codeception/bin/yii: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env php 2 | run(); 20 | exit($exitCode); 21 | -------------------------------------------------------------------------------- /web/index-test.php: -------------------------------------------------------------------------------- 1 | run(); 17 | -------------------------------------------------------------------------------- /tests/codeception/bin/yii.bat: -------------------------------------------------------------------------------- 1 | @echo off 2 | 3 | rem ------------------------------------------------------------- 4 | rem Yii command line bootstrap script for Windows. 5 | rem 6 | rem @author Qiang Xue 7 | rem @link http://www.yiiframework.com/ 8 | rem @copyright Copyright (c) 2008 Yii Software LLC 9 | rem @license http://www.yiiframework.com/license/ 10 | rem ------------------------------------------------------------- 11 | 12 | @setlocal 13 | 14 | set YII_PATH=%~dp0 15 | 16 | if "%PHP_COMMAND%" == "" set PHP_COMMAND=php.exe 17 | 18 | "%PHP_COMMAND%" "%YII_PATH%yii" %* 19 | 20 | @endlocal 21 | -------------------------------------------------------------------------------- /yii: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env php 2 | run(); 21 | exit($exitCode); 22 | -------------------------------------------------------------------------------- /views/site/error.php: -------------------------------------------------------------------------------- 1 | title = $name; 11 | ?> 12 |
13 | 14 |

title) ?>

15 | 16 |
17 | 18 |
19 | 20 |

21 | The above error occurred while the Web server was processing your request. 22 |

23 |

24 | Please contact us if you think this is a server error. Thank you. 25 |

26 | 27 |
28 | -------------------------------------------------------------------------------- /assets/AppAsset.php: -------------------------------------------------------------------------------- 1 | 14 | * @since 2.0 15 | */ 16 | class AppAsset extends AssetBundle 17 | { 18 | public $basePath = '@webroot'; 19 | public $baseUrl = '@web'; 20 | public $css = [ 21 | 'css/site.css', 22 | ]; 23 | public $js = [ 24 | ]; 25 | public $depends = [ 26 | 'yii\web\YiiAsset', 27 | 'yii\bootstrap\BootstrapAsset', 28 | ]; 29 | } 30 | -------------------------------------------------------------------------------- /tests/codeception/_pages/LoginPage.php: -------------------------------------------------------------------------------- 1 | actor->fillField('input[name="LoginForm[username]"]', $username); 22 | $this->actor->fillField('input[name="LoginForm[password]"]', $password); 23 | $this->actor->click('login-button'); 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /views/account/update.php: -------------------------------------------------------------------------------- 1 | title = Yii::t('app', 'Update {modelClass}: ', [ 9 | 'modelClass' => 'Accounts', 10 | ]) . ' ' . $model->name; 11 | $this->params['breadcrumbs'][] = ['label' => Yii::t('app', 'Accounts'), 'url' => ['index']]; 12 | $this->params['breadcrumbs'][] = ['label' => $model->name, 'url' => ['view', 'id' => $model->id]]; 13 | $this->params['breadcrumbs'][] = Yii::t('app', 'Update'); 14 | ?> 15 |
16 | 17 |

title) ?>

18 | 19 | render('_form', [ 20 | 'model' => $model, 21 | ]) ?> 22 | 23 |
24 | -------------------------------------------------------------------------------- /views/project/update.php: -------------------------------------------------------------------------------- 1 | title = Yii::t('app', 'Update {modelClass}: ', [ 9 | 'modelClass' => 'Projects', 10 | ]) . ' ' . $model->name; 11 | $this->params['breadcrumbs'][] = ['label' => Yii::t('app', 'Projects'), 'url' => ['index']]; 12 | $this->params['breadcrumbs'][] = ['label' => $model->name, 'url' => ['view', 'id' => $model->id]]; 13 | $this->params['breadcrumbs'][] = Yii::t('app', 'Update'); 14 | ?> 15 |
16 | 17 |

title) ?>

18 | 19 | render('_form', [ 20 | 'model' => $model, 21 | ]) ?> 22 | 23 |
24 | -------------------------------------------------------------------------------- /models/ProjectsQuery.php: -------------------------------------------------------------------------------- 1 | andWhere('[[status]]=1'); 15 | return $this; 16 | }*/ 17 | 18 | /** 19 | * @inheritdoc 20 | * @return Projects[]|array 21 | */ 22 | public function all($db = null) 23 | { 24 | return parent::all($db); 25 | } 26 | 27 | /** 28 | * @inheritdoc 29 | * @return Projects|array|null 30 | */ 31 | public function one($db = null) 32 | { 33 | return parent::one($db); 34 | } 35 | } -------------------------------------------------------------------------------- /models/JournalsQuery.php: -------------------------------------------------------------------------------- 1 | andWhere('[[status]]=1'); 15 | return $this; 16 | }*/ 17 | 18 | /** 19 | * @inheritdoc 20 | * @return Journals[]|array 21 | */ 22 | public function all($db = null) 23 | { 24 | return parent::all($db); 25 | } 26 | 27 | /** 28 | * @inheritdoc 29 | * @return Journals|array|null 30 | */ 31 | public function one($db = null) 32 | { 33 | return parent::one($db); 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /views/currency/update.php: -------------------------------------------------------------------------------- 1 | title = Yii::t('app', 'Update {modelClass}: ', [ 9 | 'modelClass' => 'Currencies', 10 | ]) . ' ' . $model->name; 11 | $this->params['breadcrumbs'][] = ['label' => Yii::t('app', 'Currencies'), 'url' => ['index']]; 12 | $this->params['breadcrumbs'][] = ['label' => $model->name, 'url' => ['view', 'id' => $model->id]]; 13 | $this->params['breadcrumbs'][] = Yii::t('app', 'Update'); 14 | ?> 15 |
16 | 17 |

title) ?>

18 | 19 | render('_form', [ 20 | 'model' => $model, 21 | ]) ?> 22 | 23 |
24 | -------------------------------------------------------------------------------- /models/AccountsPathQuery.php: -------------------------------------------------------------------------------- 1 | andWhere('[[status]]=1'); 15 | }*/ 16 | 17 | /** 18 | * @inheritdoc 19 | * @return AccountsPath[]|array 20 | */ 21 | public function all($db = null) 22 | { 23 | return parent::all($db); 24 | } 25 | 26 | /** 27 | * @inheritdoc 28 | * @return AccountsPath|array|null 29 | */ 30 | public function one($db = null) 31 | { 32 | return parent::one($db); 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /models/CurrenciesQuery.php: -------------------------------------------------------------------------------- 1 | andWhere('[[status]]=1'); 15 | return $this; 16 | }*/ 17 | 18 | /** 19 | * @inheritdoc 20 | * @return Currencies[]|array 21 | */ 22 | public function all($db = null) 23 | { 24 | return parent::all($db); 25 | } 26 | 27 | /** 28 | * @inheritdoc 29 | * @return Currencies|array|null 30 | */ 31 | public function one($db = null) 32 | { 33 | return parent::one($db); 34 | } 35 | } -------------------------------------------------------------------------------- /views/department/update.php: -------------------------------------------------------------------------------- 1 | title = Yii::t('app', 'Update {modelClass}: ', [ 9 | 'modelClass' => 'Departments', 10 | ]) . ' ' . $model->name; 11 | $this->params['breadcrumbs'][] = ['label' => Yii::t('app', 'Departments'), 'url' => ['index']]; 12 | $this->params['breadcrumbs'][] = ['label' => $model->name, 'url' => ['view', 'id' => $model->id]]; 13 | $this->params['breadcrumbs'][] = Yii::t('app', 'Update'); 14 | ?> 15 |
16 | 17 |

title) ?>

18 | 19 | render('_form', [ 20 | 'model' => $model, 21 | ]) ?> 22 | 23 |
24 | -------------------------------------------------------------------------------- /models/DepartmentsQuery.php: -------------------------------------------------------------------------------- 1 | andWhere('[[status]]=1'); 15 | return $this; 16 | }*/ 17 | 18 | /** 19 | * @inheritdoc 20 | * @return Departments[]|array 21 | */ 22 | public function all($db = null) 23 | { 24 | return parent::all($db); 25 | } 26 | 27 | /** 28 | * @inheritdoc 29 | * @return Departments|array|null 30 | */ 31 | public function one($db = null) 32 | { 33 | return parent::one($db); 34 | } 35 | } -------------------------------------------------------------------------------- /models/JournalTypesQuery.php: -------------------------------------------------------------------------------- 1 | andWhere('[[status]]=1'); 15 | return $this; 16 | }*/ 17 | 18 | /** 19 | * @inheritdoc 20 | * @return JournalTypes[]|array 21 | */ 22 | public function all($db = null) 23 | { 24 | return parent::all($db); 25 | } 26 | 27 | /** 28 | * @inheritdoc 29 | * @return JournalTypes|array|null 30 | */ 31 | public function one($db = null) 32 | { 33 | return parent::one($db); 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /tests/codeception/_pages/ContactPage.php: -------------------------------------------------------------------------------- 1 | $value) { 21 | $inputType = $field === 'body' ? 'textarea' : 'input'; 22 | $this->actor->fillField($inputType . '[name="ContactForm[' . $field . ']"]', $value); 23 | } 24 | $this->actor->click('contact-button'); 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /models/JournalDetailsQuery.php: -------------------------------------------------------------------------------- 1 | andWhere('[[status]]=1'); 15 | return $this; 16 | }*/ 17 | 18 | /** 19 | * @inheritdoc 20 | * @return JournalDetails[]|array 21 | */ 22 | public function all($db = null) 23 | { 24 | return parent::all($db); 25 | } 26 | 27 | /** 28 | * @inheritdoc 29 | * @return JournalDetails|array|null 30 | */ 31 | public function one($db = null) 32 | { 33 | return parent::one($db); 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /views/receive/update.php: -------------------------------------------------------------------------------- 1 | title = Yii::t('app', 'Update {modelClass}: ', [ 9 | 'modelClass' => 'Revenue', 10 | ]) . $model->journal_num; 11 | $this->params['breadcrumbs'][] = ['label' => Yii::t('app', 'Revenues'), 'url' => ['index']]; 12 | $this->params['breadcrumbs'][] = ['label' => $model->journal_num, 'url' => ['view', 'id' => $model->id]]; 13 | $this->params['breadcrumbs'][] = Yii::t('app', 'Update'); 14 | ?> 15 |
16 | 17 |

title) ?>

18 | 19 | render('_form', [ 20 | 'model' => $model, 21 | 'details' => $details, 22 | ]) ?> 23 | 24 |
25 | -------------------------------------------------------------------------------- /views/payment/update.php: -------------------------------------------------------------------------------- 1 | title = Yii::t('app', 'Update {modelClass}: ', [ 9 | 'modelClass' => 'Expense', 10 | ]) . ' ' . $model->journal_num; 11 | $this->params['breadcrumbs'][] = ['label' => Yii::t('app', 'Expenses'), 'url' => ['index']]; 12 | $this->params['breadcrumbs'][] = ['label' => $model->journal_num, 'url' => ['view', 'id' => $model->id]]; 13 | $this->params['breadcrumbs'][] = Yii::t('app', 'Update'); 14 | ?> 15 |
16 | 17 |

title) ?>

18 | 19 | render('_form', [ 20 | 'model' => $model, 21 | 'details' => $details, 22 | ]) ?> 23 | 24 |
25 | -------------------------------------------------------------------------------- /mail/layouts/html.php: -------------------------------------------------------------------------------- 1 | 8 | beginPage() ?> 9 | 10 | 11 | 12 | 13 | <?= Html::encode($this->title) ?> 14 | head() ?> 15 | 16 | 17 | beginBody() ?> 18 | 19 | endBody() ?> 20 | 21 | 22 | endPage() ?> 23 | -------------------------------------------------------------------------------- /models/AccountsQuery.php: -------------------------------------------------------------------------------- 1 | andWhere('[[active]]=1'); 15 | return $this; 16 | } 17 | 18 | public function checking() 19 | { 20 | $this->andWhere('[[checking]]=1'); 21 | return $this; 22 | } 23 | 24 | /** 25 | * @inheritdoc 26 | * @return Accounts[]|array 27 | */ 28 | public function all($db = null) 29 | { 30 | return parent::all($db); 31 | } 32 | 33 | /** 34 | * @inheritdoc 35 | * @return Accounts|array|null 36 | */ 37 | public function one($db = null) 38 | { 39 | return parent::one($db); 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /tests/codeception/config/config.php: -------------------------------------------------------------------------------- 1 | 'en-US', 7 | 'controllerMap' => [ 8 | 'fixture' => [ 9 | 'class' => 'yii\faker\FixtureController', 10 | 'fixtureDataPath' => '@tests/codeception/fixtures', 11 | 'templatePath' => '@tests/codeception/templates', 12 | 'namespace' => 'tests\codeception\fixtures', 13 | ], 14 | ], 15 | 'components' => [ 16 | 'db' => [ 17 | 'dsn' => 'mysql:host=localhost;dbname=yii2_basic_tests', 18 | ], 19 | 'mailer' => [ 20 | 'useFileTransport' => true, 21 | ], 22 | 'urlManager' => [ 23 | 'showScriptName' => true, 24 | ], 25 | ], 26 | ]; 27 | -------------------------------------------------------------------------------- /commands/HelloController.php: -------------------------------------------------------------------------------- 1 | 18 | * @since 2.0 19 | */ 20 | class HelloController extends Controller 21 | { 22 | /** 23 | * This command echoes what you have entered as the message. 24 | * @param string $message the message to be echoed. 25 | */ 26 | public function actionIndex($message = 'hello world') 27 | { 28 | echo $message . "\n"; 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /tests/codeception/config/functional.php: -------------------------------------------------------------------------------- 1 | [ 13 | 'request' => [ 14 | // it's not recommended to run functional tests with CSRF validation enabled 15 | 'enableCsrfValidation' => false, 16 | // but if you absolutely need it set cookie domain to localhost 17 | /* 18 | 'csrfCookie' => [ 19 | 'domain' => 'localhost', 20 | ], 21 | */ 22 | ], 23 | ], 24 | ] 25 | ); 26 | -------------------------------------------------------------------------------- /tests/codeception/functional/LoginCept.php: -------------------------------------------------------------------------------- 1 | wantTo('ensure that login works'); 9 | 10 | $loginPage = LoginPage::openBy($I); 11 | 12 | $I->see('Login', 'h1'); 13 | 14 | $I->amGoingTo('try to login with empty credentials'); 15 | $loginPage->login('', ''); 16 | $I->expectTo('see validations errors'); 17 | $I->see('Username cannot be blank.'); 18 | $I->see('Password cannot be blank.'); 19 | 20 | $I->amGoingTo('try to login with wrong credentials'); 21 | $loginPage->login('admin', 'wrong'); 22 | $I->expectTo('see validations errors'); 23 | $I->see('Incorrect username or password.'); 24 | 25 | $I->amGoingTo('try to login with correct credentials'); 26 | $loginPage->login('admin', 'admin'); 27 | $I->expectTo('see user info'); 28 | $I->see('Logout (admin)'); 29 | -------------------------------------------------------------------------------- /views/journal/create.php: -------------------------------------------------------------------------------- 1 | title = Yii::t('app', 'Create Journal'); 10 | $this->params['breadcrumbs'][] = ['label' => Yii::t('app', 'Journals'), 'url' => ['index']]; 11 | $this->params['breadcrumbs'][] = $this->title; 12 | ?> 13 |
14 | 15 |

title) ?>

16 | 17 | errors)>0): ?> 19 | 22 | 23 | */ ?> 24 | 25 | render('_form', [ 26 | 'model' => $model, 27 | 'details' => $details, 28 | 'accounts' => $accounts, 29 | ]) ?> 30 | 31 |
32 | 33 | 35 |
36 |
37 |
38 | 39 | */ ?> 40 | -------------------------------------------------------------------------------- /migrations/m150505_125813_create_departments_table.php: -------------------------------------------------------------------------------- 1 | createTable('departments', [ 11 | 'id' => $this->primaryKey(), 12 | 'code' => $this->string()->notNull(), 13 | 'name' => $this->string()->notNull(), 14 | 'active' => $this->integer()->defaultValue(1), 15 | 'parent_id' => $this->integer(), 16 | 'created_by' => $this->integer(), 17 | 'created_on' => $this->integer(), 18 | 'modified_by' => $this->integer(), 19 | 'modified_on' => $this->integer(), 20 | ]); 21 | 22 | // foreign keys 23 | $this->addForeignKey( 24 | 'fk_departments_parent', 25 | 'departments', 'parent_id', 26 | 'departments', 'id', 27 | 'restrict', 'cascade' 28 | ); 29 | } 30 | 31 | public function safeDown() 32 | { 33 | $this->dropTable('departments'); 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /views/currency/_search.php: -------------------------------------------------------------------------------- 1 | 10 | 11 | 36 | -------------------------------------------------------------------------------- /tests/codeception.yml: -------------------------------------------------------------------------------- 1 | actor: Tester 2 | #coverage: 3 | # #c3_url: http://localhost:8080/index-test.php/ 4 | # enabled: true 5 | # #remote: true 6 | # #remote_config: '../tests/codeception.yml' 7 | # white_list: 8 | # include: 9 | # - ../models/* 10 | # - ../controllers/* 11 | # - ../commands/* 12 | # - ../mail/* 13 | # blacklist: 14 | # include: 15 | # - ../assets/* 16 | # - ../config/* 17 | # - ../runtime/* 18 | # - ../vendor/* 19 | # - ../views/* 20 | # - ../web/* 21 | # - ../tests/* 22 | paths: 23 | tests: codeception 24 | log: codeception/_output 25 | data: codeception/_data 26 | helpers: codeception/_support 27 | settings: 28 | bootstrap: _bootstrap.php 29 | suite_class: \PHPUnit_Framework_TestSuite 30 | memory_limit: 1024M 31 | log: true 32 | colors: true 33 | config: 34 | # the entry script URL (with host info) for functional and acceptance tests 35 | # PLEASE ADJUST IT TO THE ACTUAL ENTRY SCRIPT URL 36 | test_entry_url: http://localhost:8080/index-test.php -------------------------------------------------------------------------------- /tests/codeception/acceptance/LoginCept.php: -------------------------------------------------------------------------------- 1 | wantTo('ensure that login works'); 9 | 10 | $loginPage = LoginPage::openBy($I); 11 | 12 | $I->see('Login', 'h1'); 13 | 14 | $I->amGoingTo('try to login with empty credentials'); 15 | $loginPage->login('', ''); 16 | if (method_exists($I, 'wait')) { 17 | $I->wait(3); // only for selenium 18 | } 19 | $I->expectTo('see validations errors'); 20 | $I->see('Username cannot be blank.'); 21 | $I->see('Password cannot be blank.'); 22 | 23 | $I->amGoingTo('try to login with wrong credentials'); 24 | $loginPage->login('admin', 'wrong'); 25 | if (method_exists($I, 'wait')) { 26 | $I->wait(3); // only for selenium 27 | } 28 | $I->expectTo('see validations errors'); 29 | $I->see('Incorrect username or password.'); 30 | 31 | $I->amGoingTo('try to login with correct credentials'); 32 | $loginPage->login('admin', 'admin'); 33 | if (method_exists($I, 'wait')) { 34 | $I->wait(3); // only for selenium 35 | } 36 | $I->expectTo('see user info'); 37 | $I->see('Logout (admin)'); 38 | -------------------------------------------------------------------------------- /tests/codeception/acceptance.suite.yml: -------------------------------------------------------------------------------- 1 | # Codeception Test Suite Configuration 2 | 3 | # suite for acceptance tests. 4 | # perform tests in browser using the Selenium-like tools. 5 | # powered by Mink (http://mink.behat.org). 6 | # (tip: that's what your customer will see). 7 | # (tip: test your ajax and javascript by one of Mink drivers). 8 | 9 | # RUN `build` COMMAND AFTER ADDING/REMOVING MODULES. 10 | 11 | class_name: AcceptanceTester 12 | modules: 13 | enabled: 14 | - PhpBrowser 15 | # you can use WebDriver instead of PhpBrowser to test javascript and ajax. 16 | # This will require you to install selenium. See http://codeception.com/docs/03-AcceptanceTests#selenium-webdriver 17 | # "restart" option is used by the WebDriver to start each time per test-file new session and cookies, 18 | # it is useful if you want to login in your app in each test. 19 | # - WebDriver 20 | config: 21 | PhpBrowser: 22 | # PLEASE ADJUST IT TO THE ACTUAL ENTRY POINT WITHOUT PATH INFO 23 | url: http://localhost:8080 24 | # WebDriver: 25 | # url: http://localhost:8080 26 | # browser: firefox 27 | # restart: true 28 | -------------------------------------------------------------------------------- /views/department/_search.php: -------------------------------------------------------------------------------- 1 | 10 | 11 | 37 | -------------------------------------------------------------------------------- /migrations/m151109_021305_create_currencies_table.php: -------------------------------------------------------------------------------- 1 | createTable('currencies', [ 11 | 'id' => $this->primaryKey(), 12 | 'code' => $this->string()->notNull(), 13 | 'name' => $this->string()->notNull(), 14 | 'active' => $this->integer()->defaultValue(1), 15 | 'created_by' => $this->integer(), 16 | 'created_on' => $this->integer(), 17 | 'modified_by' => $this->integer(), 18 | 'modified_on' => $this->integer(), 19 | ]); 20 | 21 | // default data 22 | $this->insert('currencies', [ 23 | 'id' => 10, 24 | 'code' => 'IDR', 25 | 'name' => 'Indonesia Rupiah', 26 | ]); 27 | $this->insert('currencies', [ 28 | 'id' => 12, 29 | 'code' => 'USD', 30 | 'name' => 'United States Dollar', 31 | ]); 32 | } 33 | 34 | public function safeDown() 35 | { 36 | $this->dropTable('currencies'); 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /tests/codeception/_bootstrap.php: -------------------------------------------------------------------------------- 1 | 'basic-console', 10 | 'basePath' => dirname(__DIR__), 11 | 'bootstrap' => ['log'], 12 | 'controllerNamespace' => 'app\commands', 13 | 'components' => [ 14 | 'cache' => [ 15 | 'class' => 'yii\caching\FileCache', 16 | ], 17 | 'log' => [ 18 | 'targets' => [ 19 | [ 20 | 'class' => 'yii\log\FileTarget', 21 | 'levels' => ['error', 'warning'], 22 | ], 23 | ], 24 | ], 25 | 'db' => $db, 26 | ], 27 | 'params' => $params, 28 | /* 29 | 'controllerMap' => [ 30 | 'fixture' => [ // Fixture generation command line. 31 | 'class' => 'yii\faker\FixtureController', 32 | ], 33 | ], 34 | */ 35 | ]; 36 | 37 | if (YII_ENV_DEV) { 38 | // configuration adjustments for 'dev' environment 39 | $config['bootstrap'][] = 'gii'; 40 | $config['modules']['gii'] = [ 41 | 'class' => 'yii\gii\Module', 42 | ]; 43 | } 44 | 45 | return $config; 46 | -------------------------------------------------------------------------------- /views/journal/update.php: -------------------------------------------------------------------------------- 1 | title = Yii::t('app', 'Update {modelClass}: ', [ 10 | 'modelClass' => 'Journals', 11 | ]) . ' ' . $model->journal_num; 12 | $this->params['breadcrumbs'][] = ['label' => Yii::t('app', 'Journals'), 'url' => ['index']]; 13 | $this->params['breadcrumbs'][] = ['label' => $model->id, 'url' => ['view', 'id' => $model->id]]; 14 | $this->params['breadcrumbs'][] = Yii::t('app', 'Update'); 15 | 16 | ?> 17 |
18 | 19 |

title) ?>

20 | 21 | errors)>0): ?> 23 | 26 | 27 | */ ?> 28 | 29 | render('_form', [ 30 | 'model' => $model, 31 | 'details' => $details, 32 | 'accounts' => $accounts, 33 | ]) ?> 34 | 35 |
36 | 37 | 39 |
40 |
41 |
42 | 43 | */ 44 | -------------------------------------------------------------------------------- /models/Model.php: -------------------------------------------------------------------------------- 1 | formName(); 20 | $post = Yii::$app->request->post($formName); 21 | $models = []; 22 | 23 | if (! empty($multipleModels)) { 24 | $keys = array_keys(ArrayHelper::map($multipleModels, 'id', 'id')); 25 | $multipleModels = array_combine($keys, $multipleModels); 26 | } 27 | 28 | if ($post && is_array($post)) { 29 | foreach ($post as $i => $item) { 30 | if (isset($item['id']) && !empty($item['id']) && isset($multipleModels[$item['id']])) { 31 | $models[] = $multipleModels[$item['id']]; 32 | } else { 33 | $models[] = new $modelClass; 34 | } 35 | } 36 | } 37 | 38 | unset($model, $formName, $post); 39 | return $models; 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | BiruniLabs Accounting 2 | ============================ 3 | 4 | BiruniLabs Accounting is a simple General Ledger Application, developed as a proof of concept for larger project. Currently only supports double entry, single entry, multi currency, and project and department allocation. 5 | 6 | Developed using Yii 2 Framework and PostgreSQL database. Currently only PostgreSQL is supported since some of the reports is using *Common Table Expression* (*CTE*) which MySQL does not support. 7 | 8 | DIRECTORY STRUCTURE 9 | ------------------- 10 | 11 | assets/ contains assets definition 12 | commands/ contains console commands (controllers) 13 | config/ contains application configurations 14 | controllers/ contains Web controller classes 15 | mail/ contains view files for e-mails 16 | models/ contains model classes 17 | runtime/ contains files generated during runtime 18 | tests/ contains various tests for the basic application 19 | vendor/ contains dependent 3rd-party packages 20 | views/ contains view files for the Web application 21 | web/ contains the entry script and Web resources 22 | 23 | 24 | 25 | REQUIREMENTS 26 | ------------ 27 | 28 | The minimum requirement by this project template that your Web server supports PHP 5.4.0. 29 | -------------------------------------------------------------------------------- /views/account/_search.php: -------------------------------------------------------------------------------- 1 | 10 | 11 | 42 | -------------------------------------------------------------------------------- /LICENSE.md: -------------------------------------------------------------------------------- 1 | The Yii framework is free software. It is released under the terms of 2 | the following BSD License. 3 | 4 | Copyright © 2008 by Yii Software LLC (http://www.yiisoft.com) 5 | All rights reserved. 6 | 7 | Redistribution and use in source and binary forms, with or without 8 | modification, are permitted provided that the following conditions 9 | are met: 10 | 11 | * Redistributions of source code must retain the above copyright 12 | notice, this list of conditions and the following disclaimer. 13 | * Redistributions in binary form must reproduce the above copyright 14 | notice, this list of conditions and the following disclaimer in 15 | the documentation and/or other materials provided with the 16 | distribution. 17 | * Neither the name of Yii Software LLC nor the names of its 18 | contributors may be used to endorse or promote products derived 19 | from this software without specific prior written permission. 20 | 21 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 22 | "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 23 | LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS 24 | FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE 25 | COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, 26 | INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, 27 | BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 28 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 29 | CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 30 | LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN 31 | ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 32 | POSSIBILITY OF SUCH DAMAGE. 33 | -------------------------------------------------------------------------------- /migrations/m150505_125803_create_projects_table.php: -------------------------------------------------------------------------------- 1 | createTable('projects', [ 11 | 'id' => $this->primaryKey(), 12 | 'code' => $this->string()->notNull(), 13 | 'name' => $this->string()->notNull(), 14 | 'value' => $this->decimal(15,2), 15 | 'description' => $this->string() , 16 | 'location' => $this->string() , 17 | 'status' => $this->string() , 18 | 'active' => $this->integer()->defaultValue(1), 19 | 'parent_id' => $this->integer(), 20 | 'contract_num' => $this->string(), 21 | 'contact_person' => $this->string(), 22 | 'contact_phone' => $this->string(), 23 | 'date_start_est' => $this->integer(), 24 | 'date_finish_est' => $this->integer(), 25 | 'date_start_actual' => $this->integer(), 26 | 'date_finish_actual' => $this->integer(), 27 | 'progress_pct' => $this->decimal(5,2), 28 | 'created_by' => $this->integer(), 29 | 'created_on' => $this->integer(), 30 | 'modified_by' => $this->integer(), 31 | 'modified_on' => $this->integer(), 32 | ]); 33 | 34 | // foreign keys 35 | $this->addForeignKey( 36 | 'fk_projects_parent', 37 | 'projects', 'parent_id', 38 | 'projects', 'id', 39 | 'restrict', 'cascade' 40 | ); 41 | } 42 | 43 | public function safeDown() 44 | { 45 | $this->dropTable('projects'); 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /tests/codeception/functional/ContactCept.php: -------------------------------------------------------------------------------- 1 | wantTo('ensure that contact works'); 9 | 10 | $contactPage = ContactPage::openBy($I); 11 | 12 | $I->see('Contact', 'h1'); 13 | 14 | $I->amGoingTo('submit contact form with no data'); 15 | $contactPage->submit([]); 16 | $I->expectTo('see validations errors'); 17 | $I->see('Contact', 'h1'); 18 | $I->see('Name cannot be blank'); 19 | $I->see('Email cannot be blank'); 20 | $I->see('Subject cannot be blank'); 21 | $I->see('Body cannot be blank'); 22 | $I->see('The verification code is incorrect'); 23 | 24 | $I->amGoingTo('submit contact form with not correct email'); 25 | $contactPage->submit([ 26 | 'name' => 'tester', 27 | 'email' => 'tester.email', 28 | 'subject' => 'test subject', 29 | 'body' => 'test content', 30 | 'verifyCode' => 'testme', 31 | ]); 32 | $I->expectTo('see that email address is wrong'); 33 | $I->dontSee('Name cannot be blank', '.help-inline'); 34 | $I->see('Email is not a valid email address.'); 35 | $I->dontSee('Subject cannot be blank', '.help-inline'); 36 | $I->dontSee('Body cannot be blank', '.help-inline'); 37 | $I->dontSee('The verification code is incorrect', '.help-inline'); 38 | 39 | $I->amGoingTo('submit contact form with correct data'); 40 | $contactPage->submit([ 41 | 'name' => 'tester', 42 | 'email' => 'tester@example.com', 43 | 'subject' => 'test subject', 44 | 'body' => 'test content', 45 | 'verifyCode' => 'testme', 46 | ]); 47 | $I->dontSeeElement('#contact-form'); 48 | $I->see('Thank you for contacting us. We will respond to you as soon as possible.'); 49 | -------------------------------------------------------------------------------- /models/ContactForm.php: -------------------------------------------------------------------------------- 1 | 'Verification Code', 42 | ]; 43 | } 44 | 45 | /** 46 | * Sends an email to the specified email address using the information collected by this model. 47 | * @param string $email the target email address 48 | * @return boolean whether the model passes validation 49 | */ 50 | public function contact($email) 51 | { 52 | if ($this->validate()) { 53 | Yii::$app->mailer->compose() 54 | ->setTo($email) 55 | ->setFrom([$this->email => $this->name]) 56 | ->setSubject($this->subject) 57 | ->setTextBody($this->body) 58 | ->send(); 59 | 60 | return true; 61 | } 62 | return false; 63 | } 64 | } 65 | -------------------------------------------------------------------------------- /views/currency/_form.php: -------------------------------------------------------------------------------- 1 | 10 | 11 |
12 | 13 | 14 | 15 |
16 |
17 |

18 | isNewRecord ? Yii::t('app', 'Create') : Yii::t('app', 'Update') ?> 19 | Currency Details 20 |

21 |
22 | 23 |
24 | 25 |
26 | 27 | 35 |
36 | 37 | field($model, 'active')->checkBox() ?> 38 | 39 | field($model, 'code')->textInput(['maxlength' => true]) ?> 40 | field($model, 'name')->textInput(['maxlength' => true]) ?> 41 | 42 |
43 | isNewRecord ? Yii::t('app', 'Create') : Yii::t('app', 'Update'), ['class' => $model->isNewRecord ? 'btn btn-success' : 'btn btn-primary']) ?> 44 | 'btn btn-success']) ?> 45 |
46 | 47 | 48 | 49 |
50 | -------------------------------------------------------------------------------- /views/site/login.php: -------------------------------------------------------------------------------- 1 | title = 'Login'; 11 | $this->params['breadcrumbs'][] = $this->title; 12 | ?> 13 | 48 | -------------------------------------------------------------------------------- /views/currency/index.php: -------------------------------------------------------------------------------- 1 | title = Yii::t('app', 'Currencies'); 11 | $this->params['breadcrumbs'][] = $this->title; 12 | ?> 13 |
14 | 15 |

title) ?>

16 | render('_search', ['model' => $searchModel]); ?> 17 | 18 | $dataProvider, 20 | 'filterModel' => $searchModel, 21 | 'showPageSummary' => false, 22 | 'condensed' => true, 23 | 'panel' => [ 24 | 'type' => GridView::TYPE_PRIMARY, 25 | 'heading' => ' Currencies List', 26 | ], 27 | 'toolbar' => [ 28 | ['content'=> 29 | Html::a('  '.Yii::t('app', 'Create Currency'), ['create'], ['data-pjax'=>0, 'class' => 'btn btn-success', 'title'=>Yii::t('app', 'Create Journal')]) 30 | ], 31 | '{export}', 32 | '{toggleData}' 33 | ], 34 | 'columns' => [ 35 | ['class' => 'kartik\grid\SerialColumn'], 36 | 37 | // 'id', 38 | 'code', 39 | 'name', 40 | [ 41 | 'class' => '\kartik\grid\BooleanColumn', 42 | 'attribute' => 'active', 43 | 'trueLabel' => 'Yes', 44 | 'falseLabel' => 'No' 45 | ], 46 | // 'created_by', 47 | // 'created_on', 48 | // 'modified_by', 49 | // 'modified_on', 50 | 51 | ['class' => 'kartik\grid\ActionColumn'], 52 | ], 53 | ]); ?> 54 | 55 |
56 | -------------------------------------------------------------------------------- /views/project/_search.php: -------------------------------------------------------------------------------- 1 | 10 | 11 | 50 | -------------------------------------------------------------------------------- /views/journal/_search.php: -------------------------------------------------------------------------------- 1 | 10 | 11 | 50 | -------------------------------------------------------------------------------- /views/department/index.php: -------------------------------------------------------------------------------- 1 | title = Yii::t('app', 'Departments'); 11 | $this->params['breadcrumbs'][] = $this->title; 12 | ?> 13 |
14 | 15 |

title) ?>

16 | render('_search', ['model' => $searchModel]); ?> 17 | 18 | $dataProvider, 20 | 'filterModel' => $searchModel, 21 | 'showPageSummary' => false, 22 | 'condensed' => true, 23 | 'panel' => [ 24 | 'type' => GridView::TYPE_PRIMARY, 25 | 'heading' => ' Departments List', 26 | ], 27 | 'toolbar' => [ 28 | ['content'=> 29 | Html::a('  '.Yii::t('app', 'Create Department'), ['create'], ['data-pjax'=>0, 'class' => 'btn btn-success', 'title'=>Yii::t('app', 'Create Journal')]) 30 | ], 31 | '{export}', 32 | '{toggleData}' 33 | ], 34 | 'columns' => [ 35 | ['class' => 'kartik\grid\SerialColumn'], 36 | 37 | // 'id', 38 | 'code', 39 | 'name', 40 | [ 41 | 'class' => '\kartik\grid\BooleanColumn', 42 | 'attribute' => 'active', 43 | 'trueLabel' => 'Yes', 44 | 'falseLabel' => 'No' 45 | ], 46 | // 'parent_id', 47 | // 'created_by', 48 | // 'created_on', 49 | // 'modified_by', 50 | // 'modified_on', 51 | 52 | ['class' => 'kartik\grid\ActionColumn'], 53 | ], 54 | ]); ?> 55 | 56 |
57 | -------------------------------------------------------------------------------- /tests/codeception/acceptance/ContactCept.php: -------------------------------------------------------------------------------- 1 | wantTo('ensure that contact works'); 9 | 10 | $contactPage = ContactPage::openBy($I); 11 | 12 | $I->see('Contact', 'h1'); 13 | 14 | $I->amGoingTo('submit contact form with no data'); 15 | $contactPage->submit([]); 16 | if (method_exists($I, 'wait')) { 17 | $I->wait(3); // only for selenium 18 | } 19 | $I->expectTo('see validations errors'); 20 | $I->see('Contact', 'h1'); 21 | $I->see('Name cannot be blank'); 22 | $I->see('Email cannot be blank'); 23 | $I->see('Subject cannot be blank'); 24 | $I->see('Body cannot be blank'); 25 | $I->see('The verification code is incorrect'); 26 | 27 | $I->amGoingTo('submit contact form with not correct email'); 28 | $contactPage->submit([ 29 | 'name' => 'tester', 30 | 'email' => 'tester.email', 31 | 'subject' => 'test subject', 32 | 'body' => 'test content', 33 | 'verifyCode' => 'testme', 34 | ]); 35 | if (method_exists($I, 'wait')) { 36 | $I->wait(3); // only for selenium 37 | } 38 | $I->expectTo('see that email address is wrong'); 39 | $I->dontSee('Name cannot be blank', '.help-inline'); 40 | $I->see('Email is not a valid email address.'); 41 | $I->dontSee('Subject cannot be blank', '.help-inline'); 42 | $I->dontSee('Body cannot be blank', '.help-inline'); 43 | $I->dontSee('The verification code is incorrect', '.help-inline'); 44 | 45 | $I->amGoingTo('submit contact form with correct data'); 46 | $contactPage->submit([ 47 | 'name' => 'tester', 48 | 'email' => 'tester@example.com', 49 | 'subject' => 'test subject', 50 | 'body' => 'test content', 51 | 'verifyCode' => 'testme', 52 | ]); 53 | if (method_exists($I, 'wait')) { 54 | $I->wait(3); // only for selenium 55 | } 56 | $I->dontSeeElement('#contact-form'); 57 | $I->see('Thank you for contacting us. We will respond to you as soon as possible.'); 58 | -------------------------------------------------------------------------------- /views/payment/_search.php: -------------------------------------------------------------------------------- 1 | 10 | 11 | 51 | -------------------------------------------------------------------------------- /views/receive/_search.php: -------------------------------------------------------------------------------- 1 | 10 | 11 | 53 | -------------------------------------------------------------------------------- /models/CurrenciesSearch.php: -------------------------------------------------------------------------------- 1 | $query, 48 | ]); 49 | 50 | $this->load($params); 51 | 52 | if (!$this->validate()) { 53 | // uncomment the following line if you do not want to return any records when validation fails 54 | // $query->where('0=1'); 55 | return $dataProvider; 56 | } 57 | 58 | $query->andFilterWhere([ 59 | 'id' => $this->id, 60 | 'active' => $this->active, 61 | 'created_by' => $this->created_by, 62 | 'created_on' => $this->created_on, 63 | 'modified_by' => $this->modified_by, 64 | 'modified_on' => $this->modified_on, 65 | ]); 66 | 67 | $query->andFilterWhere(['like', 'code', $this->code]) 68 | ->andFilterWhere(['like', 'name', $this->name]); 69 | 70 | return $dataProvider; 71 | } 72 | } 73 | -------------------------------------------------------------------------------- /models/JournalTypesSearch.php: -------------------------------------------------------------------------------- 1 | $query, 48 | ]); 49 | 50 | $this->load($params); 51 | 52 | if (!$this->validate()) { 53 | // uncomment the following line if you do not want to return any records when validation fails 54 | // $query->where('0=1'); 55 | return $dataProvider; 56 | } 57 | 58 | $query->andFilterWhere([ 59 | 'id' => $this->id, 60 | 'active' => $this->active, 61 | 'created_by' => $this->created_by, 62 | 'created_on' => $this->created_on, 63 | 'modified_by' => $this->modified_by, 64 | 'modified_on' => $this->modified_on, 65 | ]); 66 | 67 | $query->andFilterWhere(['like', 'code', $this->code]) 68 | ->andFilterWhere(['like', 'name', $this->name]); 69 | 70 | return $dataProvider; 71 | } 72 | } 73 | -------------------------------------------------------------------------------- /models/JournalTypes.php: -------------------------------------------------------------------------------- 1 | 255] 40 | ]; 41 | } 42 | 43 | /** 44 | * @inheritdoc 45 | */ 46 | public function attributeLabels() 47 | { 48 | return [ 49 | 'id' => Yii::t('app', 'Type ID'), 50 | 'code' => Yii::t('app', 'Type Code'), 51 | 'name' => Yii::t('app', 'Type Name'), 52 | 'active' => Yii::t('app', 'Active'), 53 | 'created_by' => Yii::t('app', 'Created By'), 54 | 'created_on' => Yii::t('app', 'Created On'), 55 | 'modified_by' => Yii::t('app', 'Modified By'), 56 | 'modified_on' => Yii::t('app', 'Modified On'), 57 | ]; 58 | } 59 | 60 | /** 61 | * @return \yii\db\ActiveQuery 62 | */ 63 | public function getJournals() 64 | { 65 | return $this->hasMany(Journals::className(), ['type_id' => 'id']); 66 | } 67 | 68 | /** 69 | * @inheritdoc 70 | * @return JournalTypesQuery the active query used by this AR class. 71 | */ 72 | public static function find() 73 | { 74 | return new JournalTypesQuery(get_called_class()); 75 | } 76 | } 77 | -------------------------------------------------------------------------------- /views/journal/unbalanced.php: -------------------------------------------------------------------------------- 1 | title = Yii::t('app', 'Unbalanced Journals'); 11 | $this->params['breadcrumbs'][] = $this->title; 12 | ?> 13 |
14 | 15 |

title) ?>

16 | render('_search', ['model' => $searchModel]); ?> 17 | 18 | $dataProvider, 20 | 'filterModel' => $searchModel, 21 | 'columns' => [ 22 | ['class' => 'kartik\grid\SerialColumn'], 23 | 24 | 'journal_num', 25 | 'journal_date', 26 | 'journal_value', 27 | 'journal_value_real', 28 | 29 | [ 30 | 'class' => '\kartik\grid\BooleanColumn', 31 | 'attribute' => 'posted', 32 | 'trueLabel' => 'Yes', 33 | 'falseLabel' => 'No' 34 | ], 35 | [ 36 | 'class' => '\kartik\grid\BooleanColumn', 37 | 'attribute' => 'payment', 38 | 'trueLabel' => 'Yes', 39 | 'falseLabel' => 'No' 40 | ], 41 | [ 42 | 'class' => '\kartik\grid\BooleanColumn', 43 | 'attribute' => 'closing', 44 | 'trueLabel' => 'Yes', 45 | 'falseLabel' => 'No' 46 | ], 47 | // 'type_id', 48 | // 'account_id', 49 | // 'currency_id', 50 | // 'currency_rate1', 51 | // 'currency_rate2', 52 | // 'currency_reval', 53 | // 'reference_id', 54 | // 'reference_num', 55 | // 'reference_date', 56 | // 'created_by', 57 | // 'created_on', 58 | // 'modified_by', 59 | // 'modified_on', 60 | 61 | ['class' => 'kartik\grid\ActionColumn'], 62 | ], 63 | ]); ?> 64 | 65 |
66 | -------------------------------------------------------------------------------- /models/DepartmentsSearch.php: -------------------------------------------------------------------------------- 1 | $query, 48 | ]); 49 | 50 | $this->load($params); 51 | 52 | if (!$this->validate()) { 53 | // uncomment the following line if you do not want to return any records when validation fails 54 | // $query->where('0=1'); 55 | return $dataProvider; 56 | } 57 | 58 | $query->andFilterWhere([ 59 | 'id' => $this->id, 60 | 'active' => $this->active, 61 | 'parent_id' => $this->parent_id, 62 | 'created_by' => $this->created_by, 63 | 'created_on' => $this->created_on, 64 | 'modified_by' => $this->modified_by, 65 | 'modified_on' => $this->modified_on, 66 | ]); 67 | 68 | $query->andFilterWhere(['like', 'code', $this->code]) 69 | ->andFilterWhere(['like', 'name', $this->name]); 70 | 71 | return $dataProvider; 72 | } 73 | } 74 | -------------------------------------------------------------------------------- /models/Currencies.php: -------------------------------------------------------------------------------- 1 | 255] 41 | ]; 42 | } 43 | 44 | /** 45 | * @inheritdoc 46 | */ 47 | public function attributeLabels() 48 | { 49 | return [ 50 | 'id' => Yii::t('app', 'Currency ID'), 51 | 'code' => Yii::t('app', 'Currency Code'), 52 | 'name' => Yii::t('app', 'Currency Name'), 53 | 'active' => Yii::t('app', 'Active'), 54 | 'created_by' => Yii::t('app', 'Created By'), 55 | 'created_on' => Yii::t('app', 'Created On'), 56 | 'modified_by' => Yii::t('app', 'Modified By'), 57 | 'modified_on' => Yii::t('app', 'Modified On'), 58 | ]; 59 | } 60 | 61 | /** 62 | * @return \yii\db\ActiveQuery 63 | */ 64 | public function getJournals() 65 | { 66 | return $this->hasMany(Journals::className(), ['currency_id' => 'id']); 67 | } 68 | 69 | /** 70 | * @inheritdoc 71 | * @return CurrenciesQuery the active query used by this AR class. 72 | */ 73 | public static function find() 74 | { 75 | return new CurrenciesQuery(get_called_class()); 76 | } 77 | } 78 | -------------------------------------------------------------------------------- /tests/codeception/unit/models/LoginFormTest.php: -------------------------------------------------------------------------------- 1 | user->logout(); 17 | parent::tearDown(); 18 | } 19 | 20 | public function testLoginNoUser() 21 | { 22 | $model = new LoginForm([ 23 | 'username' => 'not_existing_username', 24 | 'password' => 'not_existing_password', 25 | ]); 26 | 27 | $this->specify('user should not be able to login, when there is no identity', function () use ($model) { 28 | expect('model should not login user', $model->login())->false(); 29 | expect('user should not be logged in', Yii::$app->user->isGuest)->true(); 30 | }); 31 | } 32 | 33 | public function testLoginWrongPassword() 34 | { 35 | $model = new LoginForm([ 36 | 'username' => 'demo', 37 | 'password' => 'wrong_password', 38 | ]); 39 | 40 | $this->specify('user should not be able to login with wrong password', function () use ($model) { 41 | expect('model should not login user', $model->login())->false(); 42 | expect('error message should be set', $model->errors)->hasKey('password'); 43 | expect('user should not be logged in', Yii::$app->user->isGuest)->true(); 44 | }); 45 | } 46 | 47 | public function testLoginCorrect() 48 | { 49 | $model = new LoginForm([ 50 | 'username' => 'demo', 51 | 'password' => 'demo', 52 | ]); 53 | 54 | $this->specify('user should be able to login with correct credentials', function () use ($model) { 55 | expect('model should login user', $model->login())->true(); 56 | expect('error message should not be set', $model->errors)->hasntKey('password'); 57 | expect('user should be logged in', Yii::$app->user->isGuest)->false(); 58 | }); 59 | } 60 | 61 | } 62 | -------------------------------------------------------------------------------- /views/department/_form.php: -------------------------------------------------------------------------------- 1 | 12 | 13 |
14 | 15 | 16 | 17 |
18 |
19 |

20 | isNewRecord ? Yii::t('app', 'Create') : Yii::t('app', 'Update') ?> 21 | Department Details 22 |

23 |
24 | 25 |
26 | 27 | field($model, 'code')->textInput(['maxlength' => true]) ?> 28 | field($model, 'name')->textInput(['maxlength' => true]) ?> 29 | field($model, 'parent_id') 30 | ->widget(Select2::classname(), [ 31 | 'data' => ArrayHelper::map(Departments::find()->all(), 'id', 'name'), 32 | 'options' => [ 33 | 'placeholder' => 'Select Department ...' 34 | ], 35 | 'pluginOptions' => [ 36 | 'allowClear' => true 37 | ], 38 | ]); ?> 39 | 40 |
41 | 42 | 50 |
51 | 52 | field($model, 'created_by')->textInput() ?> 54 | field($model, 'created_on')->textInput() ?> 55 | field($model, 'modified_by')->textInput() ?> 56 | field($model, 'modified_on')->textInput() ?> 57 | */ ?> 58 | 59 | 60 | 61 |
62 | -------------------------------------------------------------------------------- /models/LoginForm.php: -------------------------------------------------------------------------------- 1 | hasErrors()) { 48 | $user = $this->getUser(); 49 | 50 | if (!$user || !$user->validatePassword($this->password)) { 51 | $this->addError($attribute, 'Incorrect username or password.'); 52 | } 53 | } 54 | } 55 | 56 | /** 57 | * Logs in a user using the provided username and password. 58 | * @return boolean whether the user is logged in successfully 59 | */ 60 | public function login() 61 | { 62 | if ($this->validate()) { 63 | return Yii::$app->user->login($this->getUser(), $this->rememberMe ? 3600*24*30 : 0); 64 | } 65 | return false; 66 | } 67 | 68 | /** 69 | * Finds user by [[username]] 70 | * 71 | * @return User|null 72 | */ 73 | public function getUser() 74 | { 75 | if ($this->_user === false) { 76 | $this->_user = User::findByUsername($this->username); 77 | } 78 | 79 | return $this->_user; 80 | } 81 | } 82 | -------------------------------------------------------------------------------- /tests/codeception/unit/models/ContactFormTest.php: -------------------------------------------------------------------------------- 1 | mailer->fileTransportCallback = function ($mailer, $message) { 18 | return 'testing_message.eml'; 19 | }; 20 | } 21 | 22 | protected function tearDown() 23 | { 24 | unlink($this->getMessageFile()); 25 | parent::tearDown(); 26 | } 27 | 28 | public function testContact() 29 | { 30 | /** @var ContactForm $model */ 31 | $model = $this->getMockBuilder('app\models\ContactForm') 32 | ->setMethods(['validate']) 33 | ->getMock(); 34 | $model->expects($this->once())->method('validate')->will($this->returnValue(true)); 35 | 36 | $model->attributes = [ 37 | 'name' => 'Tester', 38 | 'email' => 'tester@example.com', 39 | 'subject' => 'very important letter subject', 40 | 'body' => 'body of current message', 41 | ]; 42 | 43 | $this->specify('email should be send', function () use ($model) { 44 | expect('ContactForm::contact() should return true', $model->contact('admin@example.com'))->true(); 45 | expect('email file should exist', file_exists($this->getMessageFile()))->true(); 46 | }); 47 | 48 | $this->specify('message should contain correct data', function () use ($model) { 49 | $emailMessage = file_get_contents($this->getMessageFile()); 50 | 51 | expect('email should contain user name', $emailMessage)->contains($model->name); 52 | expect('email should contain sender email', $emailMessage)->contains($model->email); 53 | expect('email should contain subject', $emailMessage)->contains($model->subject); 54 | expect('email should contain body', $emailMessage)->contains($model->body); 55 | }); 56 | } 57 | 58 | private function getMessageFile() 59 | { 60 | return Yii::getAlias(Yii::$app->mailer->fileTransportPath) . '/testing_message.eml'; 61 | } 62 | 63 | } 64 | -------------------------------------------------------------------------------- /views/site/about.php: -------------------------------------------------------------------------------- 1 | title = 'About'; 8 | $this->params['breadcrumbs'][] = $this->title; 9 | ?> 10 |
11 |

title) ?>

12 | 13 |
14 |
15 |
16 |
17 |

About BiruniLabs Accounting

18 |
19 |
20 |

21 | BiruniLabs Accounting is a simple General Ledger Application, 22 | developed as a proof of concept for larger project. 23 | Currently only supports double entry for general journals, 24 | single entry for expenses and revenues journals, 25 | multi currency, and project and department allocation. 26 |

27 |

28 | Developed using Yii 2 Framework and PostgreSQL database. 29 | Currently only PostgreSQL is supported since some of the reports 30 | is using Common Table Expression (CTE) which MySQL does not support. 31 |

32 |

33 | . 34 |

35 |
36 |
37 |
38 |
39 |
40 |
41 |

Contact Developer

42 |
43 |
44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 |
DeveloperNur Hidayat
Emailhidayat365@gmail.com
Websitepojokprogrammer.net
Phone/WA+62 855-9910-165
62 |
63 |
64 |
65 |
66 | 67 |
68 | -------------------------------------------------------------------------------- /migrations/m160629_093144_create_journal_denormalized_view.php: -------------------------------------------------------------------------------- 1 | execute(' 20 | create view journal_denormalized1 as 21 | select a.id, b.id detail_id, a.journal_num 22 | , a.journal_date, a.journal_value, a.journal_value_real 23 | , a.posted, a.payment, a.closing, a.remarks, b.remarks detail_remarks 24 | , a.type_id, t.code type_code, t.name type_name 25 | , a.currency_id, cr.code currency_code, cr.name currency_name 26 | , a.currency_rate1, a.currency_rate2 27 | , a.reference_id, a.reference_num, a.reference_date 28 | , b.department_id, dp.code department_code, dp.name department_name 29 | , b.project_id, pr.code project_code, pr.name project_name 30 | , b.account_id, b.debet, b.debet_real, b.credit, b.credit_real 31 | from journals as a 32 | join journal_details as b on a.id = b.journal_id 33 | join journal_types as t on a.type_id = t.id 34 | left join projects pr on b.project_id = pr.id 35 | left join departments dp on b.department_id = dp.id 36 | left join currencies cr on a.currency_id = cr.id 37 | '); 38 | /** 39 | * journals denormalized 40 | * includes all (left) joins 41 | */ 42 | $this->execute(' 43 | create view journal_denormalized2 as 44 | select a.id, b.id detail_id, a.journal_num 45 | , a.journal_date, a.journal_value, a.journal_value_real 46 | , a.posted, a.payment, a.closing, a.remarks, b.remarks detail_remarks 47 | , a.type_id, a.currency_id, a.currency_rate1, a.currency_rate2 48 | , a.reference_id, a.reference_num, a.reference_date 49 | , b.department_id, b.project_id, b.account_id 50 | , b.debet, b.debet_real, b.credit, b.credit_real 51 | from journals as a 52 | join journal_details as b on a.id = b.journal_id 53 | '); 54 | } 55 | 56 | /** 57 | * @inheritdoc 58 | */ 59 | public function down() 60 | { 61 | $this->execute('drop view journal_denormalized1'); 62 | $this->execute('drop view journal_denormalized2'); 63 | } 64 | } 65 | -------------------------------------------------------------------------------- /models/Departments.php: -------------------------------------------------------------------------------- 1 | 255] 42 | ]; 43 | } 44 | 45 | /** 46 | * @inheritdoc 47 | */ 48 | public function attributeLabels() 49 | { 50 | return [ 51 | 'id' => Yii::t('app', 'Department'), 52 | 'code' => Yii::t('app', 'Department Code'), 53 | 'name' => Yii::t('app', 'Department Name'), 54 | 'active' => Yii::t('app', 'Active?'), 55 | 'parent_id' => Yii::t('app', 'Sub Department of'), 56 | 'created_by' => Yii::t('app', 'Created By'), 57 | 'created_on' => Yii::t('app', 'Created On'), 58 | 'modified_by' => Yii::t('app', 'Modified By'), 59 | 'modified_on' => Yii::t('app', 'Modified On'), 60 | ]; 61 | } 62 | 63 | /** 64 | * @return \yii\db\ActiveQuery 65 | */ 66 | public function getParent() 67 | { 68 | return $this->hasOne(Departments::className(), ['id' => 'parent_id']); 69 | } 70 | 71 | /** 72 | * @return \yii\db\ActiveQuery 73 | */ 74 | public function getDepartments() 75 | { 76 | return $this->hasMany(Departments::className(), ['parent_id' => 'id']); 77 | } 78 | 79 | /** 80 | * @inheritdoc 81 | * @return DepartmentsQuery the active query used by this AR class. 82 | */ 83 | public static function find() 84 | { 85 | return new DepartmentsQuery(get_called_class()); 86 | } 87 | } 88 | -------------------------------------------------------------------------------- /migrations/m151109_231542_create_journal_details_table.php: -------------------------------------------------------------------------------- 1 | createTable('journal_details', [ 11 | 'id' => $this->primaryKey(), 12 | 'journal_id' => $this->integer()->notNull(), 13 | 'debet' => $this->decimal(15,2)->notNull()->defaultValue(0), 14 | 'debet_real' => $this->decimal(15,2)->notNull()->defaultValue(0), 15 | 'credit' => $this->decimal(15,2)->notNull()->defaultValue(0), 16 | 'credit_real' => $this->decimal(15,2)->notNull()->defaultValue(0), 17 | 'currency_rate1' => $this->decimal(15,2)->notNull()->defaultValue(0), 18 | 'currency_rate2' => $this->decimal(15,2)->notNull()->defaultValue(0), 19 | 'account_id' => $this->integer()->notNull(), 20 | 'department_id' => $this->integer(), 21 | 'project_id' => $this->integer(), 22 | 'reference_id' => $this->integer(), 23 | 'reference_num' => $this->string(), 24 | 'reference_date' => $this->integer(), 25 | 'remarks' => $this->string(), 26 | 'created_by' => $this->integer(), 27 | 'created_on' => $this->integer(), 28 | 'modified_by' => $this->integer(), 29 | 'modified_on' => $this->integer(), 30 | ]); 31 | 32 | // foreign keys 33 | $this->addForeignKey( 34 | 'fk_journal_details_accounts', 35 | 'journal_details', 'account_id', 36 | 'accounts', 'id', 37 | 'restrict', 'cascade' 38 | ); 39 | $this->addForeignKey( 40 | 'fk_journal_details_projects', 41 | 'journal_details', 'project_id', 42 | 'projects', 'id', 43 | 'restrict', 'cascade' 44 | ); 45 | $this->addForeignKey( 46 | 'fk_journal_details_departments', 47 | 'journal_details', 'department_id', 48 | 'departments', 'id', 49 | 'restrict', 'cascade' 50 | ); 51 | $this->addForeignKey( 52 | 'fk_journal_details_reference', 53 | 'journal_details', 'reference_id', 54 | 'journals', 'id', 55 | 'restrict', 'cascade' 56 | ); 57 | } 58 | 59 | public function safeDown() 60 | { 61 | $this->dropTable('journal_details'); 62 | } 63 | } 64 | -------------------------------------------------------------------------------- /views/account/_form.php: -------------------------------------------------------------------------------- 1 | 13 | 14 |
15 | 16 | 17 | 18 |
19 |
20 |

21 | isNewRecord ? Yii::t('app', 'Create') : Yii::t('app', 'Update') ?> 22 | Account Details 23 |

24 |
25 | 26 |
27 | 28 | field($model, 'active')->checkBox() ?> 29 | field($model, 'checking')->checkBox() ?> 30 | field($model, 'code')->textInput(['maxlength' => true]) ?> 31 | field($model, 'name')->textInput(['maxlength' => true]) ?> 32 | 33 | field($model, 'parent_id') 34 | ->widget(Select2::classname(), [ 35 | 'data' => ArrayHelper::map(Accounts::find()->all(), 'id', 'name'), 36 | 'options' => [ 37 | 'placeholder' => 'Select Account ...' 38 | ], 39 | 'pluginOptions' => [ 40 | 'allowClear' => true 41 | ], 42 | ]); ?> 43 |
44 | 45 | 53 |
54 | 55 | field($model, 'bank_name')->textInput(['maxlength' => true]) ?> 57 | field($model, 'bank_address')->textInput(['maxlength' => true]) ?> 58 | field($model, 'bank_accnum')->textInput(['maxlength' => true]) ?> 59 | field($model, 'bank_accname')->textInput(['maxlength' => true]) ?> 60 | */ ?> 61 | 62 | 63 | 64 | 65 |
66 | -------------------------------------------------------------------------------- /views/journal/_details.php: -------------------------------------------------------------------------------- 1 | 15 | 58 | 59 | -------------------------------------------------------------------------------- /views/site/index.php: -------------------------------------------------------------------------------- 1 | title = 'BiruniLabs'; 6 | ?> 7 |
8 | 9 |
10 |

Congratulations!

11 | 12 |

You have successfully created your Yii-powered application.

13 | 14 |

Get started with Yii

15 |
16 | 17 |
18 | 19 |
20 |
21 |

Heading

22 | 23 |

Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et 24 | dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip 25 | ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu 26 | fugiat nulla pariatur.

27 | 28 |

Yii Documentation »

29 |
30 |
31 |

Heading

32 | 33 |

Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et 34 | dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip 35 | ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu 36 | fugiat nulla pariatur.

37 | 38 |

Yii Forum »

39 |
40 |
41 |

Heading

42 | 43 |

Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et 44 | dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip 45 | ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu 46 | fugiat nulla pariatur.

47 | 48 |

Yii Extensions »

49 |
50 |
51 | 52 |
53 |
54 | -------------------------------------------------------------------------------- /controllers/ReportController.php: -------------------------------------------------------------------------------- 1 | [ 26 | 'class' => VerbFilter::className(), 27 | 'actions' => [ 28 | 'delete' => ['post'], 29 | ], 30 | ], 31 | 'access' => [ 32 | 'class' => AccessControl::className(), 33 | 'only' => [ 34 | 'index', 35 | 'balance-sheet', 36 | 'balance-trial', 37 | 'income-statement', 38 | 'general-ledger', 39 | ], 40 | 'rules' => [ 41 | [ 42 | 'allow' => true, 43 | 'actions' => [ 44 | 'index', 45 | 'balance-sheet', 46 | 'balance-trial', 47 | 'income-statement', 48 | 'general-ledger', 49 | ], 50 | 'roles' => ['@'], 51 | ], 52 | ], 53 | ], 54 | ]; 55 | } 56 | 57 | public function actionIndex() 58 | { 59 | return $this->render('index'); 60 | } 61 | 62 | public function actionBalanceSheet() 63 | { 64 | // render view 65 | return $this->render('balance-sheet', [ 66 | 'date1' => $this->dev_date1, 67 | 'date2' => $this->dev_date2, 68 | 'dataProvider' => Journals::getBalanceSheet($this->dev_start,$this->dev_date1,$this->dev_date2), 69 | ]); 70 | } 71 | 72 | public function actionBalanceTrial() 73 | { 74 | // render view 75 | return $this->render('balance-trial', [ 76 | 'date1' => $this->dev_date1, 77 | 'date2' => $this->dev_date2, 78 | 'dataProvider' => Journals::getTrialBalance($this->dev_start,$this->dev_date1,$this->dev_date2), 79 | ]); 80 | } 81 | 82 | public function actionIncomeStatement() 83 | { 84 | // render view 85 | return $this->render('income-statement', [ 86 | 'date1' => $this->dev_date1, 87 | 'date2' => $this->dev_date2, 88 | 'dataProvider' => Journals::getIncomeStatement($this->dev_start,$this->dev_date1,$this->dev_date2), 89 | ]); 90 | } 91 | 92 | } 93 | -------------------------------------------------------------------------------- /models/AccountsSearch.php: -------------------------------------------------------------------------------- 1 | $query, 48 | ]); 49 | 50 | $this->load($params); 51 | 52 | if (!$this->validate()) { 53 | // uncomment the following line if you do not want to return any records when validation fails 54 | // $query->where('0=1'); 55 | return $dataProvider; 56 | } 57 | 58 | $query->andFilterWhere([ 59 | 'id' => $this->id, 60 | 'checking' => $this->checking, 61 | 'active' => $this->active, 62 | 'parent_id' => $this->parent_id, 63 | 'created_by' => $this->created_by, 64 | 'created_on' => $this->created_on, 65 | 'modified_by' => $this->modified_by, 66 | 'modified_on' => $this->modified_on, 67 | ]); 68 | 69 | $query->andFilterWhere(['like', 'code', $this->code]) 70 | ->andFilterWhere(['like', 'name', $this->name]) 71 | ->andFilterWhere(['like', 'bank_name', $this->bank_name]) 72 | ->andFilterWhere(['like', 'bank_address', $this->bank_address]) 73 | ->andFilterWhere(['like', 'bank_accnum', $this->bank_accnum]) 74 | ->andFilterWhere(['like', 'bank_accname', $this->bank_accname]); 75 | 76 | $query->orderBy('code'); 77 | 78 | return $dataProvider; 79 | } 80 | } 81 | -------------------------------------------------------------------------------- /migrations/m160630_045430_create_accounts_path_view.php: -------------------------------------------------------------------------------- 1 | execute(" 16 | CREATE VIEW accounts_path AS 17 | WITH RECURSIVE q AS ( 18 | SELECT h, 1 AS level 19 | , array[]::integer[] || id AS id_breadcrumb 20 | , array[]::varchar[] || code AS code_breadcrumb 21 | , array[]::varchar[] || name AS name_breadcrumb 22 | FROM accounts h 23 | WHERE parent_id is null 24 | UNION ALL 25 | SELECT hi, q.level + 1 AS level 26 | , id_breadcrumb || id 27 | , code_breadcrumb || code 28 | , name_breadcrumb::varchar(255)[] || name 29 | FROM q 30 | JOIN accounts hi 31 | ON hi.parent_id = (q.h).id 32 | ) 33 | SELECT (q.h).id id 34 | , id_breadcrumb[1] id_level1 35 | , id_breadcrumb[2] id_level2 36 | , id_breadcrumb[3] id_level3 37 | , id_breadcrumb[4] id_level4 38 | , id_breadcrumb::varchar AS id_path 39 | , (q.h).code 40 | , code_breadcrumb[1] code_level1 41 | , code_breadcrumb[2] code_level2 42 | , code_breadcrumb[3] code_level3 43 | , code_breadcrumb[4] code_level4 44 | , code_breadcrumb::varchar AS code_path 45 | , REPEAT(' ', level) || (q.h).code code_indented 46 | , (q.h).name 47 | , name_breadcrumb[1] name_level1 48 | , name_breadcrumb[2] name_level2 49 | , name_breadcrumb[3] name_level3 50 | , name_breadcrumb[4] name_level4 51 | , name_breadcrumb::varchar AS name_path 52 | , REPEAT(' ', level) || (q.h).name name_indented 53 | , level, (q.h).active, (q.h).checking 54 | , (q.h).parent_id 55 | , (q.h).bank_name 56 | , (q.h).bank_address 57 | , (q.h).bank_accnum 58 | , (q.h).bank_accname 59 | , (q.h).created_by 60 | , (q.h).created_on 61 | , (q.h).modified_by 62 | , (q.h).modified_on 63 | FROM q 64 | ORDER BY code_breadcrumb 65 | "); 66 | } 67 | 68 | /** 69 | * @inheritdoc 70 | */ 71 | public function down() 72 | { 73 | $this->execute('DROP VIEW accounts_path CASCADE'); 74 | } 75 | } 76 | -------------------------------------------------------------------------------- /migrations/m151109_231530_create_journals_table.php: -------------------------------------------------------------------------------- 1 | createTable('journals', [ 11 | 'id' => $this->primaryKey(), 12 | 'journal_num' => $this->string()->notNull(), 13 | 'journal_date' => $this->integer()->defaultValue(0), 14 | 'journal_value' => $this->decimal(15,2)->notNull()->defaultValue(0), 15 | 'journal_value_real' => $this->decimal(15,2)->notNull()->defaultValue(0), 16 | 'posted' => $this->integer()->defaultValue(0), 17 | 'payment' => $this->integer()->defaultValue(0), 18 | 'closing' => $this->integer()->defaultValue(0), 19 | 'remarks' => $this->string(), 20 | 'type_id' => $this->integer()->notNull(), 21 | 'account_id' => $this->integer(), 22 | 'currency_id' => $this->integer()->notNull(), 23 | 'currency_rate1' => $this->decimal(15,2)->notNull()->defaultValue(0), 24 | 'currency_rate2' => $this->decimal(15,2)->notNull()->defaultValue(0), 25 | 'currency_reval' => $this->decimal(15,2)->notNull()->defaultValue(0), 26 | 'reference_id' => $this->integer(), 27 | 'reference_num' => $this->string(), 28 | 'reference_date' => $this->integer(), 29 | 'created_by' => $this->integer(), 30 | 'created_on' => $this->integer(), 31 | 'modified_by' => $this->integer(), 32 | 'modified_on' => $this->integer(), 33 | ]); 34 | 35 | // foreign keys 36 | $this->addForeignKey( 37 | 'fk_journals_accounts', 38 | 'journals', 'account_id', 39 | 'accounts', 'id', 40 | 'restrict', 'cascade' 41 | ); 42 | $this->addForeignKey( 43 | 'fk_journals_types', 44 | 'journals', 'type_id', 45 | 'journal_types', 'id', 46 | 'restrict', 'cascade' 47 | ); 48 | $this->addForeignKey( 49 | 'fk_journals_currencies', 50 | 'journals', 'currency_id', 51 | 'currencies', 'id', 52 | 'restrict', 'cascade' 53 | ); 54 | $this->addForeignKey( 55 | 'fk_journals_reference', 56 | 'journals', 'reference_id', 57 | 'journals', 'id', 58 | 'restrict', 'cascade' 59 | ); 60 | 61 | } 62 | 63 | public function safeDown() 64 | { 65 | $this->dropTable('journals'); 66 | } 67 | } 68 | -------------------------------------------------------------------------------- /views/project/index.php: -------------------------------------------------------------------------------- 1 | title = Yii::t('app', 'Projects'); 11 | $this->params['breadcrumbs'][] = $this->title; 12 | ?> 13 |
14 | 15 |

title) ?>

16 | render('_search', ['model' => $searchModel]); ?> 17 | 18 | $dataProvider, 20 | 'filterModel' => $searchModel, 21 | 'showPageSummary' => false, 22 | 'condensed' => true, 23 | 'panel' => [ 24 | 'type' => GridView::TYPE_PRIMARY, 25 | 'heading' => ' Projects List', 26 | ], 27 | 'toolbar' => [ 28 | ['content'=> 29 | Html::a('  '.Yii::t('app', 'Create Project'), ['create'], ['data-pjax'=>0, 'class' => 'btn btn-success', 'title'=>Yii::t('app', 'Create Journal')]) 30 | ], 31 | '{export}', 32 | '{toggleData}' 33 | ], 34 | 'columns' => [ 35 | ['class' => 'kartik\grid\SerialColumn'], 36 | 37 | // 'id', 38 | 'code', 39 | 'name', 40 | [ 41 | 'class' => '\kartik\grid\BooleanColumn', 42 | 'attribute' => 'active', 43 | 'trueLabel' => 'Yes', 44 | 'falseLabel' => 'No' 45 | ], 46 | 'location', 47 | [ 48 | 'attribute' => 'value', 49 | 'format' => ['decimal', 2], 50 | 'headerOptions' => [ 'class' => 'kv-align-middle kv-align-right' ], 51 | 'contentOptions' => [ 'class' => 'kv-align-middle kv-align-right', 'width' => '15%' ], 52 | ], 53 | 'parent.name', 54 | // 'description', 55 | // 'contract_num', 56 | // 'contact_person', 57 | // 'contact_phone', 58 | // 'date_start_est', 59 | // 'date_finish_est', 60 | // 'date_start_actual', 61 | // 'date_finish_actual', 62 | // 'status', 63 | // 'progress_pct', 64 | // 'created_by', 65 | // 'created_on', 66 | // 'modified_by', 67 | // 'modified_on', 68 | 69 | ['class' => 'kartik\grid\ActionColumn'], 70 | ], 71 | ]); ?> 72 | 73 |
74 | -------------------------------------------------------------------------------- /views/site/contact.php: -------------------------------------------------------------------------------- 1 | title = 'Contact'; 12 | $this->params['breadcrumbs'][] = $this->title; 13 | ?> 14 |
15 |

title) ?>

16 | 17 | session->hasFlash('contactFormSubmitted')): ?> 18 | 19 |
20 | Thank you for contacting us. We will respond to you as soon as possible. 21 |
22 | 23 |

24 | Note that if you turn on the Yii debugger, you should be able 25 | to view the mail message on the mail panel of the debugger. 26 | mailer->useFileTransport): ?> 27 | Because the application is in development mode, the email is not sent but saved as 28 | a file under mailer->fileTransportPath) ?>. 29 | Please configure the useFileTransport property of the mail 30 | application component to be false to enable email sending. 31 | 32 |

33 | 34 | 35 | 36 |

37 | If you have business inquiries or other questions, please fill out the following form to contact us. 38 | Thank you. 39 |

40 | 41 |
42 |
43 | 44 | 'contact-form']); ?> 45 | 46 | field($model, 'name')->textInput(['autofocus' => true]) ?> 47 | 48 | field($model, 'email') ?> 49 | 50 | field($model, 'subject') ?> 51 | 52 | field($model, 'body')->textArea(['rows' => 6]) ?> 53 | 54 | field($model, 'verifyCode')->widget(Captcha::className(), [ 55 | 'template' => '
{image}
{input}
', 56 | ]) ?> 57 | 58 |
59 | 'btn btn-primary', 'name' => 'contact-button']) ?> 60 |
61 | 62 | 63 | 64 |
65 |
66 | 67 | 68 |
69 | -------------------------------------------------------------------------------- /web/css/site.css: -------------------------------------------------------------------------------- 1 | html, 2 | body { 3 | height: 100%; 4 | } 5 | h1, h2, h3, h4, h5 { 6 | font-weight: bold; 7 | margin: 20px 0; 8 | } 9 | .panel h1, .panel h2, .panel h3, .panel h4, .panel h5 { 10 | margin: 2px 0; 11 | } 12 | 13 | .wrap { 14 | min-height: 100%; 15 | height: auto; 16 | margin: 0 auto -45px; 17 | padding: 0 0 45px; 18 | } 19 | 20 | .wrap > .container { 21 | padding: 70px 15px 20px; 22 | } 23 | 24 | .breadcrumb { 25 | padding: 8px 15px; 26 | margin-bottom: 30px; 27 | margin-top: 70px; 28 | } 29 | 30 | .panel-heading .summary { 31 | padding-top: 3px; 32 | } 33 | .panel-footer .form-group { 34 | margin-bottom: 0; 35 | } 36 | 37 | .container-fluid .site-index, 38 | .container-fluid .site-error { 39 | margin-top: 50px; 40 | } 41 | .container-fluid .site-error { 42 | margin-top: 50px; 43 | padding: 30px 15px; 44 | } 45 | 46 | .footer { 47 | height: 45px; 48 | background-color: #f5f5f5; 49 | border-top: 1px solid #ddd; 50 | padding-top: 15px; 51 | } 52 | 53 | .jumbotron { 54 | text-align: center; 55 | background-color: transparent; 56 | } 57 | 58 | .jumbotron .btn { 59 | font-size: 21px; 60 | padding: 14px 24px; 61 | } 62 | 63 | .not-set { 64 | color: #c55; 65 | font-style: italic; 66 | } 67 | 68 | /* add sorting icons to gridview sort links */ 69 | a.asc:after, a.desc:after { 70 | position: relative; 71 | top: 1px; 72 | display: inline-block; 73 | font-family: 'Glyphicons Halflings'; 74 | font-style: normal; 75 | font-weight: normal; 76 | line-height: 1; 77 | padding-left: 5px; 78 | } 79 | 80 | a.asc:after { 81 | content: /*"\e113"*/ "\e151"; 82 | } 83 | 84 | a.desc:after { 85 | content: /*"\e114"*/ "\e152"; 86 | } 87 | 88 | .sort-numerical a.asc:after { 89 | content: "\e153"; 90 | } 91 | 92 | .sort-numerical a.desc:after { 93 | content: "\e154"; 94 | } 95 | 96 | .sort-ordinal a.asc:after { 97 | content: "\e155"; 98 | } 99 | 100 | .sort-ordinal a.desc:after { 101 | content: "\e156"; 102 | } 103 | 104 | .grid-view th { 105 | white-space: nowrap; 106 | } 107 | 108 | .hint-block { 109 | display: block; 110 | margin-top: 5px; 111 | color: #999; 112 | } 113 | 114 | .error-summary { 115 | color: #a94442; 116 | background: #fdf7f7; 117 | border-left: 3px solid #eed3d7; 118 | padding: 10px 20px; 119 | margin: 0 0 15px 0; 120 | } 121 | 122 | .kv-view-mode .kv-panel-before { 123 | padding: 0; 124 | border-bottom: none; 125 | } 126 | 127 | tr.table-primary { 128 | background-color: #efefef; 129 | } -------------------------------------------------------------------------------- /models/User.php: -------------------------------------------------------------------------------- 1 | [ 15 | 'id' => '100', 16 | 'username' => 'admin', 17 | 'password' => 'admin', 18 | 'authKey' => 'test100key', 19 | 'accessToken' => '100-token', 20 | ], 21 | '101' => [ 22 | 'id' => '101', 23 | 'username' => 'demo', 24 | 'password' => 'demo', 25 | 'authKey' => 'test101key', 26 | 'accessToken' => '101-token', 27 | ], 28 | ]; 29 | 30 | /** 31 | * @inheritdoc 32 | */ 33 | public static function findIdentity($id) 34 | { 35 | return isset(self::$users[$id]) ? new static(self::$users[$id]) : null; 36 | } 37 | 38 | /** 39 | * @inheritdoc 40 | */ 41 | public static function findIdentityByAccessToken($token, $type = null) 42 | { 43 | foreach (self::$users as $user) { 44 | if ($user['accessToken'] === $token) { 45 | return new static($user); 46 | } 47 | } 48 | 49 | return null; 50 | } 51 | 52 | /** 53 | * Finds user by username 54 | * 55 | * @param string $username 56 | * @return static|null 57 | */ 58 | public static function findByUsername($username) 59 | { 60 | foreach (self::$users as $user) { 61 | if (strcasecmp($user['username'], $username) === 0) { 62 | return new static($user); 63 | } 64 | } 65 | 66 | return null; 67 | } 68 | 69 | /** 70 | * @inheritdoc 71 | */ 72 | public function getId() 73 | { 74 | return $this->id; 75 | } 76 | 77 | /** 78 | * @inheritdoc 79 | */ 80 | public function getAuthKey() 81 | { 82 | return $this->authKey; 83 | } 84 | 85 | /** 86 | * @inheritdoc 87 | */ 88 | public function validateAuthKey($authKey) 89 | { 90 | return $this->authKey === $authKey; 91 | } 92 | 93 | /** 94 | * Validates password 95 | * 96 | * @param string $password password to validate 97 | * @return boolean if password provided is valid for current user 98 | */ 99 | public function validatePassword($password) 100 | { 101 | return $this->password === $password; 102 | } 103 | } 104 | -------------------------------------------------------------------------------- /views/account/index.php: -------------------------------------------------------------------------------- 1 | title = Yii::t('app', 'Accounts'); 13 | $this->params['breadcrumbs'][] = $this->title; 14 | 15 | // ambil list jenis transaksi untuk filtering 16 | $typeList = ArrayHelper::map(Accounts::find()->asArray()->all(), 'id', 'name'); 17 | 18 | ?> 19 |
20 | 21 |

title) ?>

22 | render('_search', ['model' => $searchModel]); ?> 23 | 24 | $dataProvider, 26 | 'filterModel' => $searchModel, 27 | 'showPageSummary' => false, 28 | 'condensed' => true, 29 | 'panel' => [ 30 | 'type' => GridView::TYPE_PRIMARY, 31 | 'heading' => ' Chart of Accounts', 32 | ], 33 | 'toolbar' => [ 34 | ['content'=> 35 | Html::a('  '.Yii::t('app', 'Create Account'), ['create'], ['data-pjax'=>0, 'class' => 'btn btn-success', 'title'=>Yii::t('app', 'Create Journal')]) 36 | ], 37 | '{export}', 38 | '{toggleData}' 39 | ], 40 | 'columns' => [ 41 | ['class' => 'kartik\grid\SerialColumn'], 42 | 43 | 'code', 44 | 'name', 45 | [ 'class' => '\kartik\grid\BooleanColumn', 46 | 'attribute' => 'checking', 47 | 'trueLabel' => 'Yes', 48 | 'falseLabel' => 'No' 49 | ], 50 | [ 'class' => '\kartik\grid\BooleanColumn', 51 | 'attribute' => 'active', 52 | 'trueLabel' => 'Yes', 53 | 'falseLabel' => 'No' 54 | ], 55 | [ 'attribute' => 'parent_id', 56 | 'filter' => $typeList, 57 | 'label' => 'Parent Account', 58 | 'value' => function ($model, $index, $widget) { return $model->parent==null ? "" : $model->parent->name; } 59 | ], 60 | // 'bank_name', 61 | // 'bank_address', 62 | // 'bank_accnum', 63 | // 'bank_accname', 64 | // 'created_by', 65 | // 'created_on', 66 | // 'modified_by', 67 | // 'modified_on', 68 | 69 | ['class' => 'kartik\grid\ActionColumn'], 70 | ], 71 | ]); ?> 72 | 73 |
74 | -------------------------------------------------------------------------------- /composer.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "yiisoft/yii2-app-basic", 3 | "description": "Yii 2 Basic Project Template", 4 | "keywords": ["yii2", "framework", "basic", "project template"], 5 | "homepage": "http://www.yiiframework.com/", 6 | "type": "project", 7 | "license": "BSD-3-Clause", 8 | "support": { 9 | "issues": "https://github.com/yiisoft/yii2/issues?state=open", 10 | "forum": "http://www.yiiframework.com/forum/", 11 | "wiki": "http://www.yiiframework.com/wiki/", 12 | "irc": "irc://irc.freenode.net/yii", 13 | "source": "https://github.com/yiisoft/yii2" 14 | }, 15 | "minimum-stability": "stable", 16 | "require": { 17 | "php": ">=5.4.0", 18 | "yiisoft/yii2": "~2.0.14", 19 | "yiisoft/yii2-bootstrap": "*", 20 | "yiisoft/yii2-swiftmailer": "*", 21 | "yiithings/yii2-dotenv": "^1.0", 22 | "mdmsoft/yii2-widgets": "~1.0", 23 | "mdmsoft/yii2-ar-behaviors": "~1.0", 24 | "kartik-v/yii2-widgets": "*", 25 | "kartik-v/yii2-grid": "@dev", 26 | "kartik-v/yii2-mpdf": "@dev", 27 | "kartik-v/yii2-detail-view": "~1.7", 28 | "kartik-v/yii2-datecontrol": "@dev", 29 | "kartik-v/yii2-number": "dev-master" 30 | }, 31 | "require-dev": { 32 | "yiisoft/yii2-debug": "*", 33 | "yiisoft/yii2-gii": "*", 34 | "yiisoft/yii2-faker": "*", 35 | "codeception/base": "^2.2.3", 36 | "codeception/verify": "~0.3.1", 37 | "codeception/specify": "~0.4.3" 38 | }, 39 | "config": { 40 | "process-timeout": 1800, 41 | "fxp-asset": { 42 | "enabled": false 43 | } 44 | }, 45 | "scripts": { 46 | "post-install-cmd": [ 47 | "yii\\composer\\Installer::postInstall" 48 | ], 49 | "post-create-project-cmd": [ 50 | "yii\\composer\\Installer::postCreateProject", 51 | "yii\\composer\\Installer::postInstall" 52 | ] 53 | }, 54 | "extra": { 55 | "yii\\composer\\Installer::postCreateProject": { 56 | "setPermission": [ 57 | { 58 | "runtime": "0777", 59 | "web/assets": "0777", 60 | "yii": "0755" 61 | } 62 | ], 63 | "generateCookieValidationKey": [ 64 | "config/web.php" 65 | ], 66 | "asset-installer-paths": { 67 | "npm-asset-library": "vendor/npm", 68 | "bower-asset-library": "vendor/bower" 69 | } 70 | } 71 | }, 72 | "repositories": [ 73 | { 74 | "type": "composer", 75 | "url": "https://asset-packagist.org" 76 | } 77 | ] 78 | } 79 | -------------------------------------------------------------------------------- /views/currency/view.php: -------------------------------------------------------------------------------- 1 | title = $model->name; 11 | $this->params['breadcrumbs'][] = ['label' => Yii::t('app', 'Currencies'), 'url' => ['index']]; 12 | $this->params['breadcrumbs'][] = $this->title; 13 | ?> 14 |
15 | 16 |

title) ?>

17 | 18 |

19 | $model->id], ['class' => 'btn btn-primary']) ?> 20 | $model->id], [ 21 | 'class' => 'btn btn-danger', 22 | 'data' => [ 23 | 'confirm' => Yii::t('app', 'Are you sure you want to delete this item?'), 24 | 'method' => 'post', 25 | ], 26 | ]) ?> 27 | 'btn btn-warning', 'title'=>Yii::t('app', 'Create New')]) ?> 28 | 'btn btn-success']) ?> 29 |

30 | 31 | $model, 33 | 'bordered' => true, 34 | 'striped' => true, 35 | 'condensed' => false, 36 | 'responsive' => true, 37 | 'hover' => true, 38 | 'mode' => DetailView::MODE_VIEW, 39 | 'hAlign' => DetailView::ALIGN_RIGHT, 40 | 'vAlign' => DetailView::ALIGN_MIDDLE, 41 | 'panel' => [ 42 | 'type' => DetailView::TYPE_INFO, 43 | 'heading' => ' '.Yii::t('app', 'Currency Information').'', 44 | 'footer' => '
'. $model->code . ': ' . $model->name .'
' 45 | ], 46 | 'buttons1' => '', 47 | 'buttons2' => '', 48 | 'attributes' => [ 49 | //'id', 50 | [ 51 | 'attribute'=>'code', 52 | 'labelColOptions' => [ 'style'=>'width:20%; text-align:right;' ], 53 | 'valueColOptions' => [ 'style'=>'width:80%' ], 54 | ], 55 | 'name', 56 | [ 57 | 'attribute'=>'active', 58 | 'format'=>'raw', 59 | 'value' => $model->active 60 | ? 'Yes' 61 | : 'No', 62 | 'labelColOptions' => [ 'style'=>'width:20%; text-align:right;' ], 63 | 'valueColOptions' => [ 'style'=>'width:80%' ], 64 | ], 65 | 'created_by', 66 | 'created_on', 67 | 'modified_by', 68 | 'modified_on', 69 | ], 70 | ]) ?> 71 | 72 |
73 | -------------------------------------------------------------------------------- /models/JournalDetailsSearch.php: -------------------------------------------------------------------------------- 1 | $query, 47 | ]); 48 | 49 | $this->load($params); 50 | 51 | if (!$this->validate()) { 52 | // uncomment the following line if you do not want to return any records when validation fails 53 | // $query->where('0=1'); 54 | return $dataProvider; 55 | } 56 | 57 | $query->andFilterWhere([ 58 | 'id' => $this->id, 59 | 'journal_id' => $this->journal_id, 60 | 'debet' => $this->debet, 61 | 'debet_real' => $this->debet_real, 62 | 'credit' => $this->credit, 63 | 'credit_real' => $this->credit_real, 64 | 'currency_rate1' => $this->currency_rate1, 65 | 'currency_rate2' => $this->currency_rate2, 66 | 'account_id' => $this->account_id, 67 | 'department_id' => $this->department_id, 68 | 'project_id' => $this->project_id, 69 | 'reference_id' => $this->reference_id, 70 | 'reference_date' => $this->reference_date, 71 | 'created_by' => $this->created_by, 72 | 'created_on' => $this->created_on, 73 | 'modified_by' => $this->modified_by, 74 | 'modified_on' => $this->modified_on, 75 | ]); 76 | 77 | $query->andFilterWhere(['like', 'reference_num', $this->reference_num]) 78 | ->andFilterWhere(['like', 'remarks', $this->remarks]); 79 | 80 | return $dataProvider; 81 | } 82 | 83 | } 84 | -------------------------------------------------------------------------------- /views/project/_form.php: -------------------------------------------------------------------------------- 1 | 14 | 15 |
16 | 17 | 18 | 19 |
20 |
21 |

22 | isNewRecord ? Yii::t('app', 'Create') : Yii::t('app', 'Update') ?> 23 | Project Details 24 |

25 |
26 | 27 |
28 | field($model, 'active')->checkBox() ?> 29 | field($model, 'code')->textInput(['maxlength' => true]) ?> 30 | field($model, 'name')->textInput(['maxlength' => true]) ?> 31 | field($model, 'value')->widget(NumberControl::classname()) ?> 32 | field($model, 'location')->textInput(['maxlength' => true]) ?> 33 | field($model, 'parent_id') 34 | ->widget(Select2::classname(), [ 35 | 'data' => ArrayHelper::map(Projects::find()->all(), 'id', 'name'), 36 | 'options' => [ 37 | 'placeholder' => 'Select Project ...' 38 | ], 39 | 'pluginOptions' => [ 40 | 'allowClear' => true 41 | ], 42 | ]); ?> 43 |
44 | 45 | 53 |
54 | 55 | 56 | field($model, 'description')->textInput(['maxlength' => true]) ?> 58 | field($model, 'contract_num')->textInput(['maxlength' => true]) ?> 59 | field($model, 'contact_person')->textInput(['maxlength' => true]) ?> 60 | field($model, 'contact_phone')->textInput(['maxlength' => true]) ?> 61 | field($model, 'date_start_est')->textInput() ?> 62 | field($model, 'date_finish_est')->textInput() ?> 63 | field($model, 'date_start_actual')->textInput() ?> 64 | field($model, 'date_finish_actual')->textInput() ?> 65 | field($model, 'status')->textInput(['maxlength' => true]) ?> 66 | field($model, 'progress_pct')->textInput(['maxlength' => true]) ?> 67 | */ ?> 68 | 69 | 70 | 71 |
72 | -------------------------------------------------------------------------------- /models/JournalsSearch.php: -------------------------------------------------------------------------------- 1 | $query, 49 | ]); 50 | 51 | $this->load($params); 52 | 53 | if (!$this->validate()) { 54 | // uncomment the following line if you do not want to return any records when validation fails 55 | // $query->where('0=1'); 56 | return $dataProvider; 57 | } 58 | 59 | $query->andFilterWhere([ 60 | 'id' => $this->id, 61 | 'journal_date' => $this->journal_date, 62 | 'journal_value' => $this->journal_value, 63 | 'journal_value_real' => $this->journal_value_real, 64 | 'posted' => $this->posted, 65 | 'payment' => $this->payment, 66 | 'closing' => $this->closing, 67 | 'type_id' => 10, 68 | 'account_id' => $this->account_id, 69 | 'currency_id' => $this->currency_id, 70 | 'currency_rate1' => $this->currency_rate1, 71 | 'currency_rate2' => $this->currency_rate2, 72 | 'currency_reval' => $this->currency_reval, 73 | 'reference_id' => $this->reference_id, 74 | 'reference_date' => $this->reference_date, 75 | 'created_by' => $this->created_by, 76 | 'created_on' => $this->created_on, 77 | 'modified_by' => $this->modified_by, 78 | 'modified_on' => $this->modified_on, 79 | ]); 80 | 81 | $query->andFilterWhere(['like', 'journal_num', $this->journal_num]) 82 | ->andFilterWhere(['like', 'remarks', $this->remarks]) 83 | ->andFilterWhere(['like', 'reference_num', $this->reference_num]); 84 | 85 | return $dataProvider; 86 | } 87 | } 88 | -------------------------------------------------------------------------------- /views/department/view.php: -------------------------------------------------------------------------------- 1 | title = $model->name; 11 | $this->params['breadcrumbs'][] = ['label' => Yii::t('app', 'Departments'), 'url' => ['index']]; 12 | $this->params['breadcrumbs'][] = $this->title; 13 | ?> 14 |
15 | 16 |

title) ?>

17 | 18 |

19 | $model->id], ['class' => 'btn btn-primary']) ?> 20 | $model->id], [ 21 | 'class' => 'btn btn-danger', 22 | 'data' => [ 23 | 'confirm' => Yii::t('app', 'Are you sure you want to delete this item?'), 24 | 'method' => 'post', 25 | ], 26 | ]) ?> 27 | 'btn btn-warning', 'title'=>Yii::t('app', 'Create New')]) ?> 28 | 'btn btn-success']) ?> 29 |

30 | 31 | $model, 33 | 'bordered' => true, 34 | 'striped' => true, 35 | 'condensed' => false, 36 | 'responsive' => true, 37 | 'hover' => true, 38 | 'mode' => DetailView::MODE_VIEW, 39 | 'hAlign' => DetailView::ALIGN_RIGHT, 40 | 'vAlign' => DetailView::ALIGN_MIDDLE, 41 | 'panel' => [ 42 | 'type' => DetailView::TYPE_INFO, 43 | 'heading' => ' '.Yii::t('app', 'Department Information').'', 44 | 'footer' => '
'. $model->code . ': ' . $model->name .'
' 45 | ], 46 | 'buttons1' => '', 47 | 'buttons2' => '', 48 | 'attributes' => [ 49 | 'code', 50 | 'name', 51 | [ 52 | 'attribute'=>'active', 53 | 'format'=>'raw', 54 | 'value' => $model->active 55 | ? 'Yes' 56 | : 'No', 57 | 'labelColOptions' => [ 'style'=>'width:20%; text-align:right;' ], 58 | 'valueColOptions' => [ 'style'=>'width:80%' ], 59 | ], 60 | [ 61 | 'attribute' => 'parent_id', 62 | 'format' => 'raw', 63 | 'value' => isset($model->parent) 64 | ? Html::a($model->parent->name, 65 | Url::to(['/department/view','id' => $model->parent_id]), 66 | ['class' => 'kv-author-link']) 67 | : "-", 68 | 'label' => 'Parent Department' 69 | ], 70 | 'created_by', 71 | 'created_on', 72 | 'modified_by', 73 | 'modified_on', 74 | ], 75 | ]) ?> 76 | 77 |
78 | -------------------------------------------------------------------------------- /models/ProjectsSearch.php: -------------------------------------------------------------------------------- 1 | $query, 49 | ]); 50 | 51 | $this->load($params); 52 | 53 | if (!$this->validate()) { 54 | // uncomment the following line if you do not want to return any records when validation fails 55 | // $query->where('0=1'); 56 | return $dataProvider; 57 | } 58 | 59 | $query->andFilterWhere([ 60 | 'id' => $this->id, 61 | 'value' => $this->value, 62 | 'active' => $this->active, 63 | 'parent_id' => $this->parent_id, 64 | 'date_start_est' => $this->date_start_est, 65 | 'date_finish_est' => $this->date_finish_est, 66 | 'date_start_actual' => $this->date_start_actual, 67 | 'date_finish_actual' => $this->date_finish_actual, 68 | 'progress_pct' => $this->progress_pct, 69 | 'created_by' => $this->created_by, 70 | 'created_on' => $this->created_on, 71 | 'modified_by' => $this->modified_by, 72 | 'modified_on' => $this->modified_on, 73 | ]); 74 | 75 | $query->andFilterWhere(['like', 'code', $this->code]) 76 | ->andFilterWhere(['like', 'name', $this->name]) 77 | ->andFilterWhere(['like', 'description', $this->description]) 78 | ->andFilterWhere(['like', 'location', $this->location]) 79 | ->andFilterWhere(['like', 'contract_num', $this->contract_num]) 80 | ->andFilterWhere(['like', 'contact_person', $this->contact_person]) 81 | ->andFilterWhere(['like', 'contact_phone', $this->contact_phone]) 82 | ->andFilterWhere(['like', 'status', $this->status]); 83 | 84 | return $dataProvider; 85 | } 86 | } 87 | -------------------------------------------------------------------------------- /models/ReceiveSearch.php: -------------------------------------------------------------------------------- 1 | $query, 52 | ]); 53 | 54 | $this->load($params); 55 | 56 | if (!$this->validate()) { 57 | // uncomment the following line if you do not want to return any records when validation fails 58 | // $query->where('0=1'); 59 | return $dataProvider; 60 | } 61 | 62 | // grid filtering conditions 63 | $query->andFilterWhere([ 64 | 'id' => $this->id, 65 | 'journal_date' => $this->journal_date, 66 | 'journal_value' => $this->journal_value, 67 | 'journal_value_real' => $this->journal_value_real, 68 | 'posted' => $this->posted, 69 | 'payment' => $this->payment, 70 | 'closing' => $this->closing, 71 | 'type_id' => JournalTypes::find()->where(['code' => 'BRV'])->one()->id, 72 | 'account_id' => $this->account_id, 73 | 'currency_id' => $this->currency_id, 74 | 'currency_rate1' => $this->currency_rate1, 75 | 'currency_rate2' => $this->currency_rate2, 76 | 'currency_reval' => $this->currency_reval, 77 | 'reference_id' => $this->reference_id, 78 | 'reference_date' => $this->reference_date, 79 | 'created_by' => $this->created_by, 80 | 'created_on' => $this->created_on, 81 | 'modified_by' => $this->modified_by, 82 | 'modified_on' => $this->modified_on, 83 | ]); 84 | 85 | $query->andFilterWhere(['like', 'journal_num', $this->journal_num]) 86 | ->andFilterWhere(['like', 'remarks', $this->remarks]) 87 | ->andFilterWhere(['like', 'reference_num', $this->reference_num]); 88 | 89 | return $dataProvider; 90 | } 91 | } 92 | -------------------------------------------------------------------------------- /models/PaymentSearch.php: -------------------------------------------------------------------------------- 1 | $query, 52 | ]); 53 | 54 | $this->load($params); 55 | 56 | if (!$this->validate()) { 57 | // uncomment the following line if you do not want to return any records when validation fails 58 | // $query->where('0=1'); 59 | return $dataProvider; 60 | } 61 | 62 | // grid filtering conditions 63 | $query->andFilterWhere([ 64 | 'id' => $this->id, 65 | 'journal_date' => $this->journal_date, 66 | 'journal_value' => $this->journal_value, 67 | 'journal_value_real' => $this->journal_value_real, 68 | 'posted' => $this->posted, 69 | 'payment' => $this->payment, 70 | 'closing' => $this->closing, 71 | 'type_id' => JournalTypes::find()->where(['code' => 'BPV'])->one()->id, 72 | 'account_id' => $this->account_id, 73 | 'currency_id' => $this->currency_id, 74 | 'currency_rate1' => $this->currency_rate1, 75 | 'currency_rate2' => $this->currency_rate2, 76 | 'currency_reval' => $this->currency_reval, 77 | 'reference_id' => $this->reference_id, 78 | 'reference_date' => $this->reference_date, 79 | 'created_by' => $this->created_by, 80 | 'created_on' => $this->created_on, 81 | 'modified_by' => $this->modified_by, 82 | 'modified_on' => $this->modified_on, 83 | ]); 84 | 85 | $query->andFilterWhere(['like', 'journal_num', $this->journal_num]) 86 | ->andFilterWhere(['like', 'remarks', $this->remarks]) 87 | ->andFilterWhere(['like', 'reference_num', $this->reference_num]); 88 | 89 | return $dataProvider; 90 | } 91 | } 92 | -------------------------------------------------------------------------------- /controllers/SiteController.php: -------------------------------------------------------------------------------- 1 | [ 22 | 'class' => VerbFilter::className(), 23 | 'actions' => [ 24 | 'logout' => ['post'], 25 | ], 26 | ], 27 | 'access' => [ 28 | 'class' => AccessControl::className(), 29 | 'only' => ['logout'], 30 | 'rules' => [ 31 | [ 32 | 'actions' => ['logout'], 33 | 'allow' => true, 34 | 'roles' => ['@'], 35 | ], 36 | ], 37 | ], 38 | ]; 39 | } 40 | 41 | /** 42 | * @inheritdoc 43 | */ 44 | public function actions() 45 | { 46 | return [ 47 | 'error' => [ 48 | 'class' => 'yii\web\ErrorAction', 49 | ], 50 | 'captcha' => [ 51 | 'class' => 'yii\captcha\CaptchaAction', 52 | 'fixedVerifyCode' => YII_ENV_TEST ? 'testme' : null, 53 | ], 54 | ]; 55 | } 56 | 57 | /** 58 | * Displays homepage. 59 | * 60 | * @return string 61 | */ 62 | public function actionIndex() 63 | { 64 | return $this->render('index'); 65 | } 66 | 67 | /** 68 | * Login action. 69 | * 70 | * @return string 71 | */ 72 | public function actionLogin() 73 | { 74 | if (!Yii::$app->user->isGuest) { 75 | return $this->goHome(); 76 | } 77 | 78 | $model = new LoginForm(); 79 | if ($model->load(Yii::$app->request->post()) && $model->login()) { 80 | return $this->goBack(); 81 | } 82 | return $this->render('login', [ 83 | 'model' => $model, 84 | ]); 85 | } 86 | 87 | /** 88 | * Logout action. 89 | * 90 | * @return string 91 | */ 92 | public function actionLogout() 93 | { 94 | Yii::$app->user->logout(); 95 | 96 | return $this->goHome(); 97 | } 98 | 99 | /** 100 | * Displays contact page. 101 | * 102 | * @return string 103 | */ 104 | public function actionContact() 105 | { 106 | $model = new ContactForm(); 107 | if ($model->load(Yii::$app->request->post()) && $model->contact(Yii::$app->params['adminEmail'])) { 108 | Yii::$app->session->setFlash('contactFormSubmitted'); 109 | 110 | return $this->refresh(); 111 | } 112 | return $this->render('contact', [ 113 | 'model' => $model, 114 | ]); 115 | } 116 | 117 | /** 118 | * Displays about page. 119 | * 120 | * @return string 121 | */ 122 | public function actionAbout() 123 | { 124 | return $this->render('about'); 125 | } 126 | } 127 | -------------------------------------------------------------------------------- /views/account/view.php: -------------------------------------------------------------------------------- 1 | title = Yii::t('app', 'View {modelClass}: ', [ 11 | 'modelClass' => 'Accounts', 12 | ]) . ' ' . $model->name; 13 | $this->params['breadcrumbs'][] = ['label' => Yii::t('app', 'Accounts'), 'url' => ['index']]; 14 | $this->params['breadcrumbs'][] = $this->title; 15 | ?> 16 |
17 | 18 |

title) ?>

19 | 20 |

21 | level > 2): ?> 22 | $model->id], ['class' => 'btn btn-primary']) ?> 23 | $model->id], [ 24 | 'class' => 'btn btn-danger', 25 | 'data' => [ 26 | 'confirm' => Yii::t('app', 'Are you sure you want to delete this item?'), 27 | 'method' => 'post', 28 | ], 29 | ]) ?> 30 | 31 | 'btn btn-warning', 'title' => Yii::t('app', 'Create New')]) ?> 32 | 'btn btn-success']) ?> 33 |

34 | 35 | $model, 37 | 'bordered' => true, 38 | 'striped' => true, 39 | 'condensed' => false, 40 | 'responsive' => true, 41 | 'hover' => true, 42 | 'mode' => DetailView::MODE_VIEW, 43 | 'hAlign' => DetailView::ALIGN_RIGHT, 44 | 'vAlign' => DetailView::ALIGN_MIDDLE, 45 | 'panel' => [ 46 | 'type' => DetailView::TYPE_INFO, 47 | 'heading' => ' '.Yii::t('app','Account Information').'', 48 | 'footer' => '
'. $model->code . ': ' . $model->name .'
' 49 | ], 50 | 'buttons1' => '', 51 | 'buttons2' => '', 52 | 'attributes' => [ 53 | //'id', 54 | 'code', 55 | 'name', 56 | [ 57 | 'attribute' => 'checking', 58 | 'format' => 'raw', 59 | 'value' => $model->checking 60 | ? 'Yes' 61 | : 'No', 62 | 'labelColOptions' => [ 'style' => 'width:30%; text-align:right;' ] 63 | ], 64 | [ 65 | 'attribute' => 'active', 66 | 'format' => 'raw', 67 | 'value' => $model->active 68 | ? 'Yes' 69 | : 'No', 70 | 'labelColOptions' => [ 'style' => 'width:30%; text-align:right;' ] 71 | ], 72 | 'level', 73 | [ 74 | 'attribute' => 'parent_id', 75 | 'format' => 'raw', 76 | 'value' => isset($model->parent) 77 | ? Html::a($model->parent->name, 78 | Url::to(['/account/view','id' => $model->parent_id]), 79 | ['class' => 'kv-author-link']) 80 | : "-", 81 | 'label' => 'Parent Account' 82 | ], 83 | /* 84 | 'bank_name', 85 | 'bank_address', 86 | 'bank_accnum', 87 | 'bank_accname', 88 | */ 89 | 'created_by', 90 | 'created_on', 91 | 'modified_by', 92 | 'modified_on', 93 | ], 94 | ]) ?> 95 | 96 |
97 | -------------------------------------------------------------------------------- /views/project/view.php: -------------------------------------------------------------------------------- 1 | title = $model->name; 11 | $this->params['breadcrumbs'][] = ['label' => Yii::t('app', 'Projects'), 'url' => ['index']]; 12 | $this->params['breadcrumbs'][] = $this->title; 13 | ?> 14 |
15 | 16 |

title) ?>

17 | 18 |

19 | $model->id], ['class' => 'btn btn-primary']) ?> 20 | $model->id], [ 21 | 'class' => 'btn btn-danger', 22 | 'data' => [ 23 | 'confirm' => Yii::t('app', 'Are you sure you want to delete this item?'), 24 | 'method' => 'post', 25 | ], 26 | ]) ?> 27 | 'btn btn-warning', 'title'=>Yii::t('app', 'Create New')]) ?> 28 | 'btn btn-success']) ?> 29 |

30 | 31 | $model, 33 | 'bordered' => true, 34 | 'striped' => true, 35 | 'condensed' => false, 36 | 'responsive' => true, 37 | 'hover' => true, 38 | 'mode' => DetailView::MODE_VIEW, 39 | 'hAlign' => DetailView::ALIGN_RIGHT, 40 | 'vAlign' => DetailView::ALIGN_MIDDLE, 41 | 'panel' => [ 42 | 'type' => DetailView::TYPE_INFO, 43 | 'heading' => ' '.Yii::t('app', 'Project Information').'', 44 | 'footer' => '
'. $model->code . ': ' . $model->name .'
' 45 | ], 46 | 'buttons1' => '', 47 | 'buttons2' => '', 48 | 'attributes' => [ 49 | // 'id', 50 | 'code', 51 | 'name', 52 | [ 53 | 'attribute' => 'parent_id', 54 | 'format' => 'raw', 55 | 'value' => isset($model->parent) 56 | ? Html::a($model->parent->name, 57 | Url::to(['/project/view','id' => $model->parent_id]), 58 | ['class' => 'kv-author-link']) 59 | : "-", 60 | 'label' => 'Parent Project' 61 | ], 62 | [ 'attribute' => 'value', 63 | 'format' => ['decimal', 2], 64 | ], 65 | // 'description', 66 | 'location', 67 | [ 68 | 'attribute'=>'active', 69 | 'format'=>'raw', 70 | 'value' => $model->active 71 | ? 'Yes' 72 | : 'No', 73 | 'labelColOptions' => [ 'style'=>'width:20%; text-align:right;' ], 74 | 'valueColOptions' => [ 'style'=>'width:80%' ], 75 | ], 76 | // 'status', 77 | // 'contract_num', 78 | // 'contact_person', 79 | // 'contact_phone', 80 | // 'date_start_est', 81 | // 'date_finish_est', 82 | // 'date_start_actual', 83 | // 'date_finish_actual', 84 | // 'progress_pct', 85 | 'created_by', 86 | 'created_on', 87 | 'modified_by', 88 | 'modified_on', 89 | ], 90 | ]) ?> 91 | 92 |
93 | -------------------------------------------------------------------------------- /models/Accounts.php: -------------------------------------------------------------------------------- 1 | 255] 49 | ]; 50 | } 51 | 52 | /** 53 | * @inheritdoc 54 | */ 55 | public function attributeLabels() 56 | { 57 | return [ 58 | 'id' => Yii::t('app', 'Account ID'), 59 | 'code' => Yii::t('app', 'Account Code'), 60 | 'name' => Yii::t('app', 'Account Name'), 61 | 'checking' => Yii::t('app', 'Checking'), 62 | 'active' => Yii::t('app', 'Active'), 63 | 'parent_id' => Yii::t('app', 'Parent'), 64 | 'bank_name' => Yii::t('app', 'Bank Name'), 65 | 'bank_address' => Yii::t('app', 'Bank Address'), 66 | 'bank_accnum' => Yii::t('app', 'Bank Accnum'), 67 | 'bank_accname' => Yii::t('app', 'Bank Accname'), 68 | 'created_by' => Yii::t('app', 'Created By'), 69 | 'created_on' => Yii::t('app', 'Created On'), 70 | 'modified_by' => Yii::t('app', 'Modified By'), 71 | 'modified_on' => Yii::t('app', 'Modified On'), 72 | ]; 73 | } 74 | 75 | /** 76 | * @return \yii\db\ActiveQuery 77 | */ 78 | public function getParent() 79 | { 80 | return $this->hasOne(Accounts::className(), ['id' => 'parent_id']); 81 | } 82 | 83 | /** 84 | * @return \yii\db\ActiveQuery 85 | */ 86 | public function getAccounts() 87 | { 88 | return $this->hasMany(Accounts::className(), ['parent_id' => 'id']); 89 | } 90 | 91 | /** 92 | * @return \yii\db\ActiveQuery 93 | */ 94 | public function getJournalDetails() 95 | { 96 | return $this->hasMany(JournalDetails::className(), ['account_id' => 'id']); 97 | } 98 | 99 | /** 100 | * @return \yii\db\ActiveQuery 101 | */ 102 | public function getJournals() 103 | { 104 | return $this->hasMany(Journals::className(), ['account_id' => 'id']); 105 | } 106 | 107 | /** 108 | * @inheritdoc 109 | * @return AccountsQuery the active query used by this AR class. 110 | */ 111 | public static function find() 112 | { 113 | return new AccountsQuery(get_called_class()); 114 | } 115 | } 116 | -------------------------------------------------------------------------------- /migrations/m151109_021214_create_journal_types_table.php: -------------------------------------------------------------------------------- 1 | createTable('journal_types', [ 11 | 'id' => $this->primaryKey(), 12 | 'code' => $this->string()->notNull(), 13 | 'name' => $this->string()->notNull(), 14 | 'active' => $this->integer()->defaultValue(1), 15 | 'created_by' => $this->integer(), 16 | 'created_on' => $this->integer(), 17 | 'modified_by' => $this->integer(), 18 | 'modified_on' => $this->integer(), 19 | ]); 20 | 21 | // default data 22 | $this->insert('journal_types', [ 23 | 'id' => 10, 24 | 'code' => 'GJV', 25 | 'name' => 'General Journal', 26 | ]); 27 | $this->insert('journal_types', [ 28 | 'id' => 11, 29 | 'code' => 'BPV', 30 | 'name' => 'Bank Payment Journal', 31 | ]); 32 | $this->insert('journal_types', [ 33 | 'id' => 12, 34 | 'code' => 'BRV', 35 | 'name' => 'Bank Receive Journal', 36 | ]); 37 | $this->insert('journal_types', [ 38 | 'id' => 13, 39 | 'code' => 'CLS', 40 | 'name' => 'Closing Journal', 41 | ]); 42 | $this->insert('journal_types', [ 43 | 'id' => 14, 44 | 'code' => 'INV', 45 | 'name' => 'Inventory Journal', 46 | ]); 47 | $this->insert('journal_types', [ 48 | 'id' => 15, 49 | 'code' => 'JCV', 50 | 'name' => 'Job Costing Journal', 51 | ]); 52 | $this->insert('journal_types', [ 53 | 'id' => 16, 54 | 'code' => 'PCD', 55 | 'name' => 'Petty Cash Payment Journal', 56 | ]); 57 | $this->insert('journal_types', [ 58 | 'id' => 17, 59 | 'code' => 'PCR', 60 | 'name' => 'Petty Cash Receive Journal', 61 | ]); 62 | $this->insert('journal_types', [ 63 | 'id' => 18, 64 | 'code' => 'PIJ', 65 | 'name' => 'Purchase Invoice Journal', 66 | ]); 67 | $this->insert('journal_types', [ 68 | 'id' => 19, 69 | 'code' => 'PJC', 70 | 'name' => 'Purchase Cancel Journal', 71 | ]); 72 | $this->insert('journal_types', [ 73 | 'id' => 20, 74 | 'code' => 'PRT', 75 | 'name' => 'Purchase Return Journal', 76 | ]); 77 | $this->insert('journal_types', [ 78 | 'id' => 21, 79 | 'code' => 'PPJ', 80 | 'name' => 'Purchase Payment Journal', 81 | ]); 82 | $this->insert('journal_types', [ 83 | 'id' => 22, 84 | 'code' => 'SIJ', 85 | 'name' => 'Sales Invoice Journal', 86 | ]); 87 | $this->insert('journal_types', [ 88 | 'id' => 23, 89 | 'code' => 'SLC', 90 | 'name' => 'Sales Cancel Journal', 91 | ]); 92 | $this->insert('journal_types', [ 93 | 'id' => 24, 94 | 'code' => 'SRT', 95 | 'name' => 'Sales Return Journal', 96 | ]); 97 | $this->insert('journal_types', [ 98 | 'id' => 25, 99 | 'code' => 'SPJ', 100 | 'name' => 'Sales Payment Journal', 101 | ]); 102 | 103 | } 104 | 105 | public function safeDown() 106 | { 107 | $this->dropTable('journal_types'); 108 | } 109 | } 110 | -------------------------------------------------------------------------------- /views/report/balance-trial.php: -------------------------------------------------------------------------------- 1 | title = Yii::t('app', 'Trial Balance'); 8 | $tanggal1 = date_format(new DateTime($date1), 'd M Y'); 9 | $tanggal2 = date_format(new DateTime($date2), 'd M Y'); 10 | 11 | ?> 12 | 13 |

title ?> - to

14 | 15 | $dataProvider, 17 | 'showPageSummary' => true, 18 | 'condensed' => true, 19 | 'panel' => [ 20 | 'type' => GridView::TYPE_SUCCESS, 21 | 'heading' => ' Trial Balance', 22 | ], 23 | 'columns' => [ 24 | ['class' => 'kartik\grid\SerialColumn'], 25 | [ 26 | 'attribute' => 'name_level1', 27 | 'vAlign' => 'middle', 28 | 'group' => true, // enable grouping, 29 | 'groupedRow' => true, // move grouped column to a single grouped row 30 | 'groupOddCssClass' => 'kv-grouped-row', // configure odd group cell css class 31 | 'groupEvenCssClass' => 'kv-grouped-row', // configure even group cell css class 32 | 'groupFooter'=>function ($model, $key, $index, $widget) { // Closure method 33 | return [ 34 | 'mergeColumns'=>[[0,1,2,3]], // columns to merge in summary 35 | 'content'=>[ // content to show in each summary cell 36 | 2=>'Summary', 37 | 4=>GridView::F_SUM, 38 | 5=>GridView::F_SUM, 39 | 6=>GridView::F_SUM, 40 | 7=>GridView::F_SUM, 41 | ], 42 | 'contentFormats'=>[ // content reformatting for each summary cell 43 | 4=>['format'=>'number', 'decimals'=>2], 44 | 5=>['format'=>'number', 'decimals'=>2], 45 | 6=>['format'=>'number', 'decimals'=>2], 46 | 7=>['format'=>'number', 'decimals'=>2], 47 | ], 48 | 'contentOptions'=>[ // content html attributes for each summary cell 49 | 1=>['style'=>'font-variant:small-caps'], 50 | 4=>['style'=>'text-align:right'], 51 | 5=>['style'=>'text-align:right'], 52 | 6=>['style'=>'text-align:right'], 53 | 7=>['style'=>'text-align:right'], 54 | ], 55 | // html attributes for group summary row 56 | 'options'=>['class'=>'info','style'=>'font-weight:bold;'] 57 | ]; 58 | } 59 | ], 60 | [ 61 | 'attribute' => 'account_code', 62 | 'vAlign' => 'middle', 63 | ], 64 | [ 65 | 'attribute' => 'account_name', 66 | 'vAlign' => 'middle', 67 | ], 68 | [ 69 | 'attribute' => 'begin_balance', 70 | 'vAlign' => 'middle', 71 | 'hAlign' => 'right', 72 | 'format' => ['decimal', 2], 73 | 'pageSummary' => true 74 | ], 75 | [ 76 | 'attribute' => 'debet', 77 | 'vAlign' => 'middle', 78 | 'hAlign' => 'right', 79 | 'format' => ['decimal', 2], 80 | 'pageSummary' => true 81 | ], 82 | [ 83 | 'attribute' => 'credit', 84 | 'vAlign' => 'middle', 85 | 'hAlign' => 'right', 86 | 'format' => ['decimal', 2], 87 | 'pageSummary' => true 88 | ], 89 | [ 90 | 'attribute' => 'end_balance', 91 | 'vAlign' => 'middle', 92 | 'hAlign' => 'right', 93 | 'format' => ['decimal', 2], 94 | 'pageSummary' => true 95 | ], 96 | ], 97 | ]); ?> 98 | -------------------------------------------------------------------------------- /models/Projects.php: -------------------------------------------------------------------------------- 1 | 255] 56 | ]; 57 | } 58 | 59 | /** 60 | * @inheritdoc 61 | */ 62 | public function attributeLabels() 63 | { 64 | return [ 65 | 'id' => Yii::t('app', 'Project'), 66 | 'code' => Yii::t('app', 'Project Code'), 67 | 'name' => Yii::t('app', 'Project Name'), 68 | 'value' => Yii::t('app', 'Project Value'), 69 | 'description' => Yii::t('app', 'Description'), 70 | 'location' => Yii::t('app', 'Location'), 71 | 'active' => Yii::t('app', 'Active'), 72 | 'status' => Yii::t('app', 'Status'), 73 | 'parent_id' => Yii::t('app', 'Sub Project of'), 74 | 'contract_num' => Yii::t('app', 'Contract Num'), 75 | 'contact_person' => Yii::t('app', 'Contact Person'), 76 | 'contact_phone' => Yii::t('app', 'Contact Phone'), 77 | 'date_start_est' => Yii::t('app', 'Date Start Est'), 78 | 'date_finish_est' => Yii::t('app', 'Date Finish Est'), 79 | 'date_start_actual' => Yii::t('app', 'Date Start Actual'), 80 | 'date_finish_actual' => Yii::t('app', 'Date Finish Actual'), 81 | 'progress_pct' => Yii::t('app', 'Progress Pct'), 82 | 'created_by' => Yii::t('app', 'Created By'), 83 | 'created_on' => Yii::t('app', 'Created On'), 84 | 'modified_by' => Yii::t('app', 'Modified By'), 85 | 'modified_on' => Yii::t('app', 'Modified On'), 86 | ]; 87 | } 88 | 89 | /** 90 | * @return \yii\db\ActiveQuery 91 | */ 92 | public function getParent() 93 | { 94 | return $this->hasOne(Projects::className(), ['id' => 'parent_id']); 95 | } 96 | 97 | /** 98 | * @return \yii\db\ActiveQuery 99 | */ 100 | public function getProjects() 101 | { 102 | return $this->hasMany(Projects::className(), ['parent_id' => 'id']); 103 | } 104 | 105 | /** 106 | * @inheritdoc 107 | * @return ProjectsQuery the active query used by this AR class. 108 | */ 109 | public static function find() 110 | { 111 | return new ProjectsQuery(get_called_class()); 112 | } 113 | } 114 | -------------------------------------------------------------------------------- /views/report/balance-sheet.php: -------------------------------------------------------------------------------- 1 | title = Yii::t('app', 'Balance Sheet'); 8 | $tanggal1 = date_format(new DateTime($date1), 'd M Y'); 9 | $tanggal2 = date_format(new DateTime($date2), 'd M Y'); 10 | 11 | ?> 12 | 13 |

title ?> - to

14 | 15 | $dataProvider, 17 | 'showPageSummary' => true, 18 | 'condensed' => true, 19 | 'panel' => [ 20 | 'type' => GridView::TYPE_SUCCESS, 21 | 'heading' => ' Balance Sheet', 22 | ], 23 | 'columns' => [ 24 | ['class' => 'kartik\grid\SerialColumn'], 25 | [ 26 | 'attribute' => 'name_level1', 27 | 'vAlign' => 'middle', 28 | 'group' => true, // enable grouping, 29 | 'groupedRow' => true, // move grouped column to a single grouped row 30 | 'groupOddCssClass' => 'kv-grouped-row', // configure odd group cell css class 31 | 'groupEvenCssClass' => 'kv-grouped-row', // configure even group cell css class 32 | 'groupFooter'=>function ($model, $key, $index, $widget) { // Closure method 33 | return [ 34 | 'mergeColumns'=>[[0,1,2,3]], // columns to merge in summary 35 | 'content'=>[ // content to show in each summary cell 36 | 2=>'Summary', 37 | 4=>GridView::F_SUM, 38 | 5=>GridView::F_SUM, 39 | 6=>GridView::F_SUM, 40 | 7=>GridView::F_SUM, 41 | ], 42 | 'contentFormats'=>[ // content reformatting for each summary cell 43 | 4=>['format'=>'number', 'decimals'=>2], 44 | 5=>['format'=>'number', 'decimals'=>2], 45 | 6=>['format'=>'number', 'decimals'=>2], 46 | 7=>['format'=>'number', 'decimals'=>2], 47 | ], 48 | 'contentOptions'=>[ // content html attributes for each summary cell 49 | 1=>['style'=>'font-variant:small-caps'], 50 | 4=>['style'=>'text-align:right'], 51 | 5=>['style'=>'text-align:right'], 52 | 6=>['style'=>'text-align:right'], 53 | 7=>['style'=>'text-align:right'], 54 | ], 55 | // html attributes for group summary row 56 | 'options'=>['class'=>'info','style'=>'font-weight:bold;'] 57 | ]; 58 | } 59 | ], 60 | [ 61 | 'attribute' => 'account_code', 62 | 'vAlign' => 'middle', 63 | ], 64 | [ 65 | 'attribute' => 'account_name', 66 | 'vAlign' => 'middle', 67 | ], 68 | [ 69 | 'attribute' => 'begin_balance', 70 | 'vAlign' => 'middle', 71 | 'hAlign' => 'right', 72 | 'format' => ['decimal', 2], 73 | 'pageSummary' => true, 74 | 'header' => 'Previous Balance', 75 | ], 76 | /* 77 | [ 78 | 'attribute' => 'debet', 79 | 'vAlign' => 'middle', 80 | 'hAlign' => 'right', 81 | 'format' => ['decimal', 2], 82 | 'pageSummary' => true 83 | ], 84 | [ 85 | 'attribute' => 'credit', 86 | 'vAlign' => 'middle', 87 | 'hAlign' => 'right', 88 | 'format' => ['decimal', 2], 89 | 'pageSummary' => true 90 | ], 91 | */ 92 | [ 93 | 'attribute' => 'end_balance', 94 | 'vAlign' => 'middle', 95 | 'hAlign' => 'right', 96 | 'format' => ['decimal', 2], 97 | 'pageSummary' => true, 98 | 'header' => 'Current Balance', 99 | ], 100 | ], 101 | ]); ?> 102 | -------------------------------------------------------------------------------- /views/report/income-statement.php: -------------------------------------------------------------------------------- 1 | title = Yii::t('app', 'Income Statement'); 8 | $tanggal1 = date_format(new DateTime($date1), 'd M Y'); 9 | $tanggal2 = date_format(new DateTime($date2), 'd M Y'); 10 | 11 | ?> 12 | 13 |

title ?> - to

14 | 15 | $dataProvider, 17 | 'showPageSummary' => true, 18 | 'condensed' => true, 19 | 'panel' => [ 20 | 'type' => GridView::TYPE_SUCCESS, 21 | 'heading' => ' Income Statement', 22 | ], 23 | 'columns' => [ 24 | ['class' => 'kartik\grid\SerialColumn'], 25 | [ 26 | 'attribute' => 'name_level1', 27 | 'vAlign' => 'middle', 28 | 'group' => true, // enable grouping, 29 | 'groupedRow' => true, // move grouped column to a single grouped row 30 | 'groupOddCssClass' => 'kv-grouped-row', // configure odd group cell css class 31 | 'groupEvenCssClass' => 'kv-grouped-row', // configure even group cell css class 32 | 'groupFooter'=>function ($model, $key, $index, $widget) { // Closure method 33 | return [ 34 | 'mergeColumns'=>[[0,1,2,3]], // columns to merge in summary 35 | 'content'=>[ // content to show in each summary cell 36 | 2=>'Summary', 37 | 4=>GridView::F_SUM, 38 | 5=>GridView::F_SUM, 39 | 6=>GridView::F_SUM, 40 | 7=>GridView::F_SUM, 41 | ], 42 | 'contentFormats'=>[ // content reformatting for each summary cell 43 | 4=>['format'=>'number', 'decimals'=>2], 44 | 5=>['format'=>'number', 'decimals'=>2], 45 | 6=>['format'=>'number', 'decimals'=>2], 46 | 7=>['format'=>'number', 'decimals'=>2], 47 | ], 48 | 'contentOptions'=>[ // content html attributes for each summary cell 49 | 1=>['style'=>'font-variant:small-caps'], 50 | 4=>['style'=>'text-align:right'], 51 | 5=>['style'=>'text-align:right'], 52 | 6=>['style'=>'text-align:right'], 53 | 7=>['style'=>'text-align:right'], 54 | ], 55 | // html attributes for group summary row 56 | 'options'=>['class'=>'info','style'=>'font-weight:bold;'] 57 | ]; 58 | } 59 | ], 60 | [ 61 | 'attribute' => 'account_code', 62 | 'vAlign' => 'middle', 63 | ], 64 | [ 65 | 'attribute' => 'account_name', 66 | 'vAlign' => 'middle', 67 | ], 68 | [ 69 | 'attribute' => 'begin_balance', 70 | 'vAlign' => 'middle', 71 | 'hAlign' => 'right', 72 | 'format' => ['decimal', 2], 73 | 'pageSummary' => true, 74 | 'header' => 'Previous Balance', 75 | ], 76 | /* 77 | [ 78 | 'attribute' => 'debet', 79 | 'vAlign' => 'middle', 80 | 'hAlign' => 'right', 81 | 'format' => ['decimal', 2], 82 | 'pageSummary' => true 83 | ], 84 | [ 85 | 'attribute' => 'credit', 86 | 'vAlign' => 'middle', 87 | 'hAlign' => 'right', 88 | 'format' => ['decimal', 2], 89 | 'pageSummary' => true 90 | ], 91 | */ 92 | [ 93 | 'attribute' => 'end_balance', 94 | 'vAlign' => 'middle', 95 | 'hAlign' => 'right', 96 | 'format' => ['decimal', 2], 97 | 'pageSummary' => true, 98 | 'header' => 'Current Balance', 99 | ], 100 | ], 101 | ]); ?> 102 | -------------------------------------------------------------------------------- /controllers/ProjectController.php: -------------------------------------------------------------------------------- 1 | [ 23 | 'class' => VerbFilter::className(), 24 | 'actions' => [ 25 | 'delete' => ['post'], 26 | ], 27 | ], 28 | 'access' => [ 29 | 'class' => AccessControl::className(), 30 | 'only' => ['index', 'view', 'create', 'update', 'delete'], 31 | 'rules' => [ 32 | [ 33 | 'allow' => true, 34 | 'actions' => ['index', 'view', 'create', 'update', 'delete'], 35 | 'roles' => ['@'], 36 | ], 37 | ], 38 | ], 39 | ]; 40 | } 41 | 42 | /** 43 | * Lists all Projects models. 44 | * @return mixed 45 | */ 46 | public function actionIndex() 47 | { 48 | $searchModel = new ProjectsSearch(); 49 | $dataProvider = $searchModel->search(Yii::$app->request->queryParams); 50 | 51 | return $this->render('index', [ 52 | 'searchModel' => $searchModel, 53 | 'dataProvider' => $dataProvider, 54 | ]); 55 | } 56 | 57 | /** 58 | * Displays a single Projects model. 59 | * @param integer $id 60 | * @return mixed 61 | */ 62 | public function actionView($id) 63 | { 64 | return $this->render('view', [ 65 | 'model' => $this->findModel($id), 66 | ]); 67 | } 68 | 69 | /** 70 | * Creates a new Projects model. 71 | * If creation is successful, the browser will be redirected to the 'view' page. 72 | * @return mixed 73 | */ 74 | public function actionCreate() 75 | { 76 | $model = new Projects(); 77 | $model->active = 1; 78 | 79 | if ($model->load(Yii::$app->request->post()) && $model->save()) { 80 | return $this->redirect(['view', 'id' => $model->id]); 81 | } else { 82 | return $this->render('create', [ 83 | 'model' => $model, 84 | ]); 85 | } 86 | } 87 | 88 | /** 89 | * Updates an existing Projects model. 90 | * If update is successful, the browser will be redirected to the 'view' page. 91 | * @param integer $id 92 | * @return mixed 93 | */ 94 | public function actionUpdate($id) 95 | { 96 | $model = $this->findModel($id); 97 | 98 | if ($model->load(Yii::$app->request->post()) && $model->save()) { 99 | return $this->redirect(['view', 'id' => $model->id]); 100 | } else { 101 | return $this->render('update', [ 102 | 'model' => $model, 103 | ]); 104 | } 105 | } 106 | 107 | /** 108 | * Deletes an existing Projects model. 109 | * If deletion is successful, the browser will be redirected to the 'index' page. 110 | * @param integer $id 111 | * @return mixed 112 | */ 113 | public function actionDelete($id) 114 | { 115 | $this->findModel($id)->delete(); 116 | 117 | return $this->redirect(['index']); 118 | } 119 | 120 | /** 121 | * Finds the Projects model based on its primary key value. 122 | * If the model is not found, a 404 HTTP exception will be thrown. 123 | * @param integer $id 124 | * @return Projects the loaded model 125 | * @throws NotFoundHttpException if the model cannot be found 126 | */ 127 | protected function findModel($id) 128 | { 129 | if (($model = Projects::findOne($id)) !== null) { 130 | return $model; 131 | } else { 132 | throw new NotFoundHttpException('The requested page does not exist.'); 133 | } 134 | } 135 | } 136 | -------------------------------------------------------------------------------- /controllers/CurrencyController.php: -------------------------------------------------------------------------------- 1 | [ 23 | 'class' => VerbFilter::className(), 24 | 'actions' => [ 25 | 'delete' => ['post'], 26 | ], 27 | ], 28 | 'access' => [ 29 | 'class' => AccessControl::className(), 30 | 'only' => ['index', 'view', 'create', 'update', 'delete'], 31 | 'rules' => [ 32 | [ 33 | 'allow' => true, 34 | 'actions' => ['index', 'view', 'create', 'update', 'delete'], 35 | 'roles' => ['@'], 36 | ], 37 | ], 38 | ], 39 | ]; 40 | } 41 | 42 | /** 43 | * Lists all Currencies models. 44 | * @return mixed 45 | */ 46 | public function actionIndex() 47 | { 48 | $searchModel = new CurrenciesSearch(); 49 | $dataProvider = $searchModel->search(Yii::$app->request->queryParams); 50 | 51 | return $this->render('index', [ 52 | 'searchModel' => $searchModel, 53 | 'dataProvider' => $dataProvider, 54 | ]); 55 | } 56 | 57 | /** 58 | * Displays a single Currencies model. 59 | * @param integer $id 60 | * @return mixed 61 | */ 62 | public function actionView($id) 63 | { 64 | return $this->render('view', [ 65 | 'model' => $this->findModel($id), 66 | ]); 67 | } 68 | 69 | /** 70 | * Creates a new Currencies model. 71 | * If creation is successful, the browser will be redirected to the 'view' page. 72 | * @return mixed 73 | */ 74 | public function actionCreate() 75 | { 76 | $model = new Currencies(); 77 | $model->active = 1; 78 | 79 | if ($model->load(Yii::$app->request->post()) && $model->save()) { 80 | return $this->redirect(['view', 'id' => $model->id]); 81 | } else { 82 | return $this->render('create', [ 83 | 'model' => $model, 84 | ]); 85 | } 86 | } 87 | 88 | /** 89 | * Updates an existing Currencies model. 90 | * If update is successful, the browser will be redirected to the 'view' page. 91 | * @param integer $id 92 | * @return mixed 93 | */ 94 | public function actionUpdate($id) 95 | { 96 | $model = $this->findModel($id); 97 | 98 | if ($model->load(Yii::$app->request->post()) && $model->save()) { 99 | return $this->redirect(['view', 'id' => $model->id]); 100 | } else { 101 | return $this->render('update', [ 102 | 'model' => $model, 103 | ]); 104 | } 105 | } 106 | 107 | /** 108 | * Deletes an existing Currencies model. 109 | * If deletion is successful, the browser will be redirected to the 'index' page. 110 | * @param integer $id 111 | * @return mixed 112 | */ 113 | public function actionDelete($id) 114 | { 115 | $this->findModel($id)->delete(); 116 | 117 | return $this->redirect(['index']); 118 | } 119 | 120 | /** 121 | * Finds the Currencies model based on its primary key value. 122 | * If the model is not found, a 404 HTTP exception will be thrown. 123 | * @param integer $id 124 | * @return Currencies the loaded model 125 | * @throws NotFoundHttpException if the model cannot be found 126 | */ 127 | protected function findModel($id) 128 | { 129 | if (($model = Currencies::findOne($id)) !== null) { 130 | return $model; 131 | } else { 132 | throw new NotFoundHttpException('The requested page does not exist.'); 133 | } 134 | } 135 | } 136 | -------------------------------------------------------------------------------- /controllers/DepartmentController.php: -------------------------------------------------------------------------------- 1 | [ 23 | 'class' => VerbFilter::className(), 24 | 'actions' => [ 25 | 'delete' => ['post'], 26 | ], 27 | ], 28 | 'access' => [ 29 | 'class' => AccessControl::className(), 30 | 'only' => ['index', 'view', 'create', 'update', 'delete'], 31 | 'rules' => [ 32 | [ 33 | 'allow' => true, 34 | 'actions' => ['index', 'view', 'create', 'update', 'delete'], 35 | 'roles' => ['@'], 36 | ], 37 | ], 38 | ], 39 | ]; 40 | } 41 | 42 | /** 43 | * Lists all Departments models. 44 | * @return mixed 45 | */ 46 | public function actionIndex() 47 | { 48 | $searchModel = new DepartmentsSearch(); 49 | $dataProvider = $searchModel->search(Yii::$app->request->queryParams); 50 | 51 | return $this->render('index', [ 52 | 'searchModel' => $searchModel, 53 | 'dataProvider' => $dataProvider, 54 | ]); 55 | } 56 | 57 | /** 58 | * Displays a single Departments model. 59 | * @param integer $id 60 | * @return mixed 61 | */ 62 | public function actionView($id) 63 | { 64 | return $this->render('view', [ 65 | 'model' => $this->findModel($id), 66 | ]); 67 | } 68 | 69 | /** 70 | * Creates a new Departments model. 71 | * If creation is successful, the browser will be redirected to the 'view' page. 72 | * @return mixed 73 | */ 74 | public function actionCreate() 75 | { 76 | $model = new Departments(); 77 | $model->active = 1; 78 | 79 | if ($model->load(Yii::$app->request->post()) && $model->save()) { 80 | return $this->redirect(['view', 'id' => $model->id]); 81 | } else { 82 | return $this->render('create', [ 83 | 'model' => $model, 84 | ]); 85 | } 86 | } 87 | 88 | /** 89 | * Updates an existing Departments model. 90 | * If update is successful, the browser will be redirected to the 'view' page. 91 | * @param integer $id 92 | * @return mixed 93 | */ 94 | public function actionUpdate($id) 95 | { 96 | $model = $this->findModel($id); 97 | 98 | if ($model->load(Yii::$app->request->post()) && $model->save()) { 99 | return $this->redirect(['view', 'id' => $model->id]); 100 | } else { 101 | return $this->render('update', [ 102 | 'model' => $model, 103 | ]); 104 | } 105 | } 106 | 107 | /** 108 | * Deletes an existing Departments model. 109 | * If deletion is successful, the browser will be redirected to the 'index' page. 110 | * @param integer $id 111 | * @return mixed 112 | */ 113 | public function actionDelete($id) 114 | { 115 | $this->findModel($id)->delete(); 116 | 117 | return $this->redirect(['index']); 118 | } 119 | 120 | /** 121 | * Finds the Departments model based on its primary key value. 122 | * If the model is not found, a 404 HTTP exception will be thrown. 123 | * @param integer $id 124 | * @return Departments the loaded model 125 | * @throws NotFoundHttpException if the model cannot be found 126 | */ 127 | protected function findModel($id) 128 | { 129 | if (($model = Departments::findOne($id)) !== null) { 130 | return $model; 131 | } else { 132 | throw new NotFoundHttpException('The requested page does not exist.'); 133 | } 134 | } 135 | } 136 | -------------------------------------------------------------------------------- /models/JournalDetails.php: -------------------------------------------------------------------------------- 1 | 255], 65 | [['debet','debet_real','credit','credit_real'], 'default', 'value' => 0], 66 | ]; 67 | } 68 | 69 | /** 70 | * @inheritdoc 71 | */ 72 | public function attributeLabels() 73 | { 74 | return [ 75 | 'id' => Yii::t('app', 'ID'), 76 | 'journal_id' => Yii::t('app', 'Journal ID'), 77 | 'debet' => Yii::t('app', 'Debet'), 78 | 'debet_real' => Yii::t('app', 'Debet Real'), 79 | 'credit' => Yii::t('app', 'Credit'), 80 | 'credit_real' => Yii::t('app', 'Credit Real'), 81 | 'currency_rate1' => Yii::t('app', 'Currency Rate1'), 82 | 'currency_rate2' => Yii::t('app', 'Currency Rate2'), 83 | 'account_id' => Yii::t('app', 'Account ID'), 84 | 'department_id' => Yii::t('app', 'Department ID'), 85 | 'project_id' => Yii::t('app', 'Project ID'), 86 | 'reference_id' => Yii::t('app', 'Reference ID'), 87 | 'reference_num' => Yii::t('app', 'Reference Num'), 88 | 'reference_date' => Yii::t('app', 'Reference Date'), 89 | 'remarks' => Yii::t('app', 'Remarks'), 90 | 'created_by' => Yii::t('app', 'Created By'), 91 | 'created_on' => Yii::t('app', 'Created On'), 92 | 'modified_by' => Yii::t('app', 'Modified By'), 93 | 'modified_on' => Yii::t('app', 'Modified On'), 94 | ]; 95 | } 96 | 97 | /** 98 | * @return \yii\db\ActiveQuery 99 | */ 100 | public function getAccount() 101 | { 102 | return $this->hasOne(Accounts::className(), ['id' => 'account_id']); 103 | } 104 | 105 | /** 106 | * @return \yii\db\ActiveQuery 107 | */ 108 | public function getDepartment() 109 | { 110 | return $this->hasOne(Departments::className(), ['id' => 'department_id']); 111 | } 112 | 113 | /** 114 | * @return \yii\db\ActiveQuery 115 | */ 116 | public function getProject() 117 | { 118 | return $this->hasOne(Projects::className(), ['id' => 'project_id']); 119 | } 120 | 121 | /** 122 | * @return \yii\db\ActiveQuery 123 | */ 124 | public function getReference() 125 | { 126 | return $this->hasOne(Journals::className(), ['id' => 'reference_id']); 127 | } 128 | 129 | /** 130 | * @inheritdoc 131 | * @return JournalDetailsQuery the active query used by this AR class. 132 | */ 133 | public static function find() 134 | { 135 | return new JournalDetailsQuery(get_called_class()); 136 | } 137 | } 138 | --------------------------------------------------------------------------------