<?php
Route::group(['middleware' => 'Administrator', ['auth']], function () {
//=============================== Accounting ============================================

    Route::GET('/account-type', 'AccountTypeController@account_type')->name('account.type');
    Route::resource('/account-chart', 'AccountChartController');
    Route::get('/get-account-code/{acc_type}', 'AccountChartController@get_account_code');

    Route::POST('account-chart/delete', 'AccountChartController@confirm_delete')->name('account-chart.delete');
    Route::GET('/datatable_get_account_chart', 'AccountChartController@datatable_get_account_chart')->name('datatable.datatable_get_account_chart');


    route::resource('accounting-dashboard', 'AccountingDashboardController');
    Route::resource('journal', 'JournalController');
    Route::match(['get', 'post'], '/get-journal', 'JournalController@get_journal')->name('datatable.get-journal');
    Route::POST('search/account-code', 'JournalController@query_account_code')->name('search-account-code');
    Route::POST('/journal-confirm-delete', 'JournalController@journal_confirm_delete')->name('journal_confirm_delete');
    Route::get('/print/voucher', 'JournalController@print_voucher')->name('voucher.print');

    //*********************************** Ledger *******************************************//
    //*************************************************************************************//
    Route::get('/ledger/{id?}/{start?}/{end?}', 'AccountingReportsController@ledger')->name('accounting-report.ledger');
    Route::match(['get', 'post'], '/get-accounting-report/ledger', 'AccountingReportsController@get_ledger')->name('get-accounting-report.ledger');

    //*********************************** Trial Balance *******************************************//
    //*************************************************************************************//
    Route::get('/get-accounting-report/trail-balance', 'AccountingReportsController@trial_balance')->name('accounting-report.trail-balance');
    Route::match(['get', 'post'], '/get-accounting-report/get-trail-balance', 'AccountingReportsController@get_trial_balance')->name('accounting-report.get-trail-balance');
    Route::POST('print-accounting-report/trial-balance', 'AccountingReportsController@print_trial_balance')->name('print.trial-balance');

    //*********************************** Balance Sheet *******************************************//
    //********************************************************************************************//
    Route::get('/get-accounting-report/balance-sheet', 'AccountingReportsController@balance_sheet')->name('accounting-report.balance-sheet');
    Route::match(['get', 'post'], '/get-accounting-report/get-balance-sheet', 'AccountingReportsController@get_balance_sheet')->name('accounting-report.get-balance-sheet');
    Route::POST('/print-accounting-report/balance-sheet', 'AccountingReportsController@print_balance_sheet')->name('print.balance-sheet');

    //*********************************** Income Statement *******************************************//
    //*************************************************************************************************************//
    Route::get('/accounting-report/income-statement', 'AccountingReportsController@income_statement')->name('accounting-report.income-statement');
    Route::match(['get', 'post'], '/accounting-report/get-income-statement', 'AccountingReportsController@get_income_statement')->name('accounting-report.get-income-statement');
    Route::POST('/print-accounting-report/income-statement', 'AccountingReportsController@print_income_statement')->name('print.income-statement');
    //  Run Audit
    Route::post('/accounting-run-audit', 'AccountingReportsController@run_trial_balance')->name('run_trial_balance');
    //*************************************************************************************************************//

    Route::get('select2-search-account-chart', 'AccountChartController@search_acc_chart')->name('select2-search-account-chart');
    Route::get('get-account-code', 'AccountChartController@get_account_code')->name('get-account-code');

});
