<?php

namespace Database\Seeders;

use App\Models\Accounting\ChartOfAccount;
use Illuminate\Database\Seeder;

class ChartOfAccountSeeder extends Seeder
{

    // php artisan db:seed --class=ChartOfAccountSeeder
    public function run()
    {
       $chart_of_accounts = [
            ['id' => '1',  'type_of_acc_detail_id' => '1','chart_code' => '10001','chart_name' => 'Cash On Hand','desc' => 'សាច់ប្រាក់ក្នុងដៃ','payment' => '1'],
            ['id' => '2',  'type_of_acc_detail_id' => '1','chart_code' => '10002','chart_name' => 'Cash In Bank (ABA)','desc' => 'សាច់ប្រាក់ក្នុងធនាគារ (ABA)','payment' => '2'],
            ['id' => '3',  'type_of_acc_detail_id' => '1','chart_code' => '10003','chart_name' => 'Cash In Bank (ACLIDA)','desc' => 'សាច់ប្រាក់ក្នុងធនាគារ (ACLIDA)','payment' => '2'],
            ['id' => '4',  'type_of_acc_detail_id' => '1','chart_code' => '10004','chart_name' => 'Cash In Bank (Wing)','desc' => 'សាច់ប្រាក់ក្នុងធនាគារ (Wing)','payment' => '2'],
            ['id' => '5',  'type_of_acc_detail_id' => '1','chart_code' => '10005','chart_name' => 'Other Current Assets','desc' => 'ទ្រព្យសកម្មផ្សេងៗ','payment' => NULL],
            ['id' => '6',  'type_of_acc_detail_id' => '1','chart_code' => '10006','chart_name' => 'Loan Out Standing','desc' => 'ប្រាក់ដើមអតិថិជនជំពាក់​','payment' => NULL],
            ['id' => '7',  'type_of_acc_detail_id' => '2','chart_code' => '11000','chart_name' => 'OFFICE Equipment','desc' => 'ឧបករណ៍​ការិយាល័យ','payment' => NULL],
            ['id' => '8',  'type_of_acc_detail_id' => '2','chart_code' => '12000','chart_name' => 'Printer','desc' => 'ម៉ាសុីនព្រីន','payment' => NULL],
            ['id' => '9',  'type_of_acc_detail_id' => '2','chart_code' => '12001','chart_name' => 'Depreciation-Computer','desc' => 'រំលស់កុំព្យូទ័រ','payment' => NULL],
            ['id' => '10', 'type_of_acc_detail_id' => '3','chart_code' => '20001','chart_name' => 'Salary Payable','desc' => 'ការជំពាក់លើប្រាក់ខែមន្រ្តីឥណទាន','payment' => NULL],
            ['id' => '11', 'type_of_acc_detail_id' => '3','chart_code' => '20002','chart_name' => 'Unearned Revenues','desc' => 'ទឹកប្រាក់ទទួលបានពីអតិថិជនដែលមិនទាន់បានបំពេញសេវាកម្ម','payment' => NULL],
            ['id' => '12', 'type_of_acc_detail_id' => '3','chart_code' => '20003','chart_name' => 'Account Payable','desc' => 'សាច់ប្រាក់ដែលស្ថាប័នជំពាក់អ្នកផ្គត់ផ្គង់','payment' => NULL],
            ['id' => '13', 'type_of_acc_detail_id' => '3','chart_code' => '20004','chart_name' => 'Other Current Liabilities','desc' => 'បំណុលសកម្មផ្សេង','payment' => NULL],
            ['id' => '14', 'type_of_acc_detail_id' => '4','chart_code' => '30001','chart_name' => "Owner\'s Capital Contribution",'desc' => 'ដើមទុនម្ចាស់ភាគហ៊ុនដាក់បន្ថែម','payment' => NULL],
            ['id' => '15', 'type_of_acc_detail_id' => '4','chart_code' => '30002','chart_name' => 'Paid up Share Capital','desc' => 'ដើមទុនចុះបញ្ជី','payment' => NULL,],
            ['id' => '16', 'type_of_acc_detail_id' => '4','chart_code' => '30003','chart_name' => 'Dividend','desc' => 'បែងចែកភាគលាភ','payment' => NULL],
            ['id' => '17', 'type_of_acc_detail_id' => '4','chart_code' => '30004','chart_name' => 'Owner\'s Capital Drawing','desc' => 'ការដកដើមទុនរបស់ម្ចាស់ភាគហ៊ុន','payment' => NULL],
            ['id' => '18', 'type_of_acc_detail_id' => '5','chart_code' => '40001','chart_name' => 'Principal income','desc' => 'ចំណូលបានមកពីប្រាក់ដើម','payment' => NULL],
            ['id' => '19', 'type_of_acc_detail_id' => '5','chart_code' => '40002','chart_name' => 'Interest income','desc' => 'ចំណូលបានមកពីការប្រាក់','payment' => NULL],
            // ['id' => '20', 'type_of_acc_detail_id' => '5','chart_code' => '40003','chart_name' => 'Risk service income','desc' => 'ចំណូលបានមកពីសេវាហានិភ័យ','payment' => NULL],
            ['id' => '20', 'type_of_acc_detail_id' => '5','chart_code' => '40003','chart_name' => 'Other Income','desc' => 'ចំណូលផ្សែងៗ','payment' => NULL],
            ['id' => '21', 'type_of_acc_detail_id' => '5','chart_code' => '40004','chart_name' => 'Administrative service income','desc' => 'ចំណូលបានមកពីសេវារដ្ឋបាល','payment' => NULL],
            ['id' => '22', 'type_of_acc_detail_id' => '5','chart_code' => '40005','chart_name' => 'Security service income','desc' => 'ចំណូលបានមកពីសេវាសុវត្ថិភាព','payment' => NULL],
            ['id' => '23', 'type_of_acc_detail_id' => '5','chart_code' => '40006','chart_name' => 'Penalty income','desc' => 'ចំណូលបានមកពីប្រាក់ពិន័យ','payment' => NULL],
            ['id' => '24', 'type_of_acc_detail_id' => '5','chart_code' => '40007','chart_name' => 'Operating Services income','desc' => 'ចំណូលបានមកពីសេវាប្រតិបត្តិការ','payment' => NULL],
            ['id' => '25', 'type_of_acc_detail_id' => '5','chart_code' => '40008','chart_name' => 'Insurance income','desc' => 'ចំណូលបានមកពីសេវាធានារ៉ាប់រង','payment' => NULL],
            ['id' => '26', 'type_of_acc_detail_id' => '8','chart_code' => '50001','chart_name' => 'Loan Disbursed expense','desc' => 'ចំណាយលើប្រាក់កម្ចីទៅអោយអតិថិជន','payment' => NULL],
            ['id' => '27', 'type_of_acc_detail_id' => '8','chart_code' => '50002','chart_name' => 'Office Rental','desc' => 'ចំណាយលើការជួលការិយាល័យ','payment' => NULL],
            ['id' => '28', 'type_of_acc_detail_id' => '8','chart_code' => '50003','chart_name' => 'Utilities','desc' => 'ចំណាយលើការប្រើប្រាស់ទឹក ភ្លើង','payment' => NULL],
            ['id' => '29', 'type_of_acc_detail_id' => '8','chart_code' => '50004','chart_name' => 'Salary Expense','desc' => 'ចំណាយលើប្រាក់បៀវត្សន៍មន្រ្តីឥណទាន','payment' => NULL],
            ['id' => '30', 'type_of_acc_detail_id' => '8','chart_code' => '50005','chart_name' => 'Stationary Expense','desc' => 'ចំណាយលើសម្ភារៈការិយាល័យ','payment' => NULL],
            ['id' => '31', 'type_of_acc_detail_id' => '8','chart_code' => '50006','chart_name' => 'Maintenance','desc' => 'ចំណាយលើការថែទាំ និងជួសជុល','payment' => NULL],
            ['id' => '32', 'type_of_acc_detail_id' => '8','chart_code' => '50007','chart_name' => 'Travel Expense','desc' => 'ចំណាយលើមធ្យោបាយធ្វើដំណើរ','payment' => NULL],
            ['id' => '33', 'type_of_acc_detail_id' => '8','chart_code' => '50008','chart_name' => 'Other Operating Expense','desc' => 'ចំណាយប្រតិបត្តិការផ្សេងៗ','payment' => NULL],
            ['id' => '34', 'type_of_acc_detail_id' => '1','chart_code' => '10007','chart_name' => 'Cash In Bank (KB)','desc' => 'សាច់ប្រាក់ក្នុងធនាគារ (KB)','payment' => '2'],
            ['id' => '35', 'type_of_acc_detail_id' => '4','chart_code' => '30005','chart_name' => 'Capital Sharing (ដើមទុនម្ចាស់)','desc' => NULL,'payment' => NULL],
            ['id' => '36', 'type_of_acc_detail_id' => '3','chart_code' => '20005','chart_name' => 'Loan ABA Bank','desc' => NULL,'payment' => NULL],
            ['id' => '37', 'type_of_acc_detail_id' => '8','chart_code' => '50009','chart_name' => 'Bonus & Compensatio','desc' => 'ប្រាក់លើកទឹកចិត្ត','payment' => NULL],
            ['id' => '38', 'type_of_acc_detail_id' => '8','chart_code' => '50010','chart_name' => 'Office Supplies','desc' => 'ចំណាយលើសម្ភារៈការិយាល័យ','payment' => NULL],
            ['id' => '39', 'type_of_acc_detail_id' => '8','chart_code' => '50011','chart_name' => 'Medical & Health Care','desc' => 'ចំណាយលើថ្នាំពេទ្យ និងសុខភាព','payment' => NULL],
            ['id' => '40', 'type_of_acc_detail_id' => '2','chart_code' => '12002','chart_name' => 'Accumulated Depreciation-Equipment','desc' => NULL,'payment' => NULL],
            ['id' => '41', 'type_of_acc_detail_id' => '2','chart_code' => '12003','chart_name' => 'Accumulated Depreciation-Furniture and Fixtures','desc' => NULL,'payment' => NULL],
            ['id' => '42', 'type_of_acc_detail_id' => '2','chart_code' => '12004','chart_name' => 'Accumulated Depreciation-Buildings','desc' => NULL,'payment' => NULL],
            ['id' => '43', 'type_of_acc_detail_id' => '2','chart_code' => '12005','chart_name' => 'Accumulated Depreciation-Motor Vehicles and Car','desc' => NULL,'payment' => NULL],
            ['id' => '44', 'type_of_acc_detail_id' => '2','chart_code' => '12006','chart_name' => 'Accumulated Depreciation-Intangible Assets','desc' => NULL,'payment' => NULL],
            ['id' => '45', 'type_of_acc_detail_id' => '8','chart_code' => '50012','chart_name' => 'Depreciation Expenses-Intangible Assets','desc' => NULL,'payment' => NULL],
            ['id' => '46', 'type_of_acc_detail_id' => '8','chart_code' => '50013','chart_name' => 'Depreciation Expenses-Building','desc' => NULL,'payment' => NULL],
            ['id' => '47', 'type_of_acc_detail_id' => '8','chart_code' => '50014','chart_name' => 'Depreciation Expenses-Furniture and Fixtures','desc' => NULL,'payment' => NULL],
            ['id' => '48', 'type_of_acc_detail_id' => '8','chart_code' => '50015','chart_name' => 'Depreciation Expenses-Computer Equipment','desc' => NULL,'payment' => NULL],
            ['id' => '49', 'type_of_acc_detail_id' => '8','chart_code' => '50016','chart_name' => 'Depreciation Expenses-Equipment','desc' => NULL,'payment' => NULL],
            ['id' => '50', 'type_of_acc_detail_id' => '8','chart_code' => '50017','chart_name' => 'Depreciation Expenses-Motor Vehicle and Car','desc' => NULL,'payment' => NULL],
            ['id' => '51', 'type_of_acc_detail_id' => '2','chart_code' => '12007','chart_name' => 'Accumulated Depreciation of New Systems','desc' => NULL,'payment' => NULL],
            ['id' => '52', 'type_of_acc_detail_id' => '8','chart_code' => '50018','chart_name' => 'Accumulated Expenses Intangible Assets','desc' => NULL,'payment' => NULL],
            ['id' => '53', 'type_of_acc_detail_id' => '8','chart_code' => '50020','chart_name' => 'Fuel Consumable','desc' => 'ចំណាយលើសាំងយានយន្ត','payment' => NULL],
            ['id' => '54', 'type_of_acc_detail_id' => '8','chart_code' => '50018','chart_name' => 'Operating Expense','desc' => 'ចំណាយប្រតិបត្តិការ','payment' => NULL],
            ['id' => '55', 'type_of_acc_detail_id' => '8','chart_code' => '50019','chart_name' => 'Office Consumable','desc' => 'ចំណាយប្រើប្រាស់លើការិយាល័យ','payment' => NULL],
            ['id' => '56', 'type_of_acc_detail_id' => '8','chart_code' => '50021','chart_name' => 'Financial Cost','desc' => 'ចំណាយការបង់ការប្រាក់','payment' => NULL],
            ['id' => '57', 'type_of_acc_detail_id' => '7','chart_code' => '50022','chart_name' => 'Other Cash Outflow','desc' => 'ចំណាយផ្សេងៗ','payment' => NULL],
            ['id' => '58', 'type_of_acc_detail_id' => '5','chart_code' => '40009','chart_name' => 'Borrowing Loan Fund','desc' => 'ប្រាក់កម្ចី','payment' => NULL],
            ['id' => '59', 'type_of_acc_detail_id' => '6','chart_code' => '40010','chart_name' => 'Other Cash Inflows','desc' => 'ចំណូលផ្សេងៗ','payment' => NULL],
            ['id' => '60', 'type_of_acc_detail_id' => '7','chart_code' => '50023','chart_name' => 'Dividend Paid','desc' => 'ចំណាយភាគលាភ','payment' => NULL],
            ['id' => '61', 'type_of_acc_detail_id' => '7','chart_code' => '50024','chart_name' => 'Principle Repayment for Fund Borrowing','desc' => 'ការសងត្រឡប់ប្រាក់ដើមទៅកម្ចីវិញ','payment' => NULL],
            ['id' => '62', 'type_of_acc_detail_id' => '7','chart_code' => '50025','chart_name' => 'Cash Investment','desc' => 'ការវិនិយោគ','payment' => NULL],
            ['id' => '63', 'type_of_acc_detail_id' => '2','chart_code' => '12008','chart_name' => 'Cash Booking Rental','desc' => NULL,'payment' => NULL],
            ['id' => '64', 'type_of_acc_detail_id' => '8','chart_code' => '50026','chart_name' => 'Cash Booking Rental Expense','desc' => NULL,'payment' => NULL],
            ['id' => '65', 'type_of_acc_detail_id' => '8','chart_code' => '50027','chart_name' => 'Loan Write-off Expense','desc' => NULL,'payment' => NULL],
            ['id' => '66', 'type_of_acc_detail_id' => '5','chart_code' => '40011','chart_name' => 'Recovery on Loans Write-Off','desc' => NULL,'payment' => NULL],
        ];

        foreach ($chart_of_accounts as  $value) {
            ChartOfAccount::updateOrCreate(['id' => $value['id']],[
                'created_by' => 1,
                'chart_code' => $value['chart_code'],
                'chart_name' => $value['chart_name'],
                'payment'    => $value['payment'],
                'desc'       => $value['desc'],
                'type_of_acc_detail_id' => $value['type_of_acc_detail_id'],
            ]);
        }
    }
}
