Overview
Comment: | Add accounting search in more places, with more useful default queries |
---|---|
Downloads: | Tarball | ZIP archive | SQL archive |
Timelines: | family | ancestors | descendants | both | trunk | stable |
Files: | files | file ages | folders |
SHA1: |
b5cff0c2a664e61fc7db0f9263efbc18 |
User & Date: | bohwaz on 2020-12-07 19:43:49 |
Other Links: | manifest | tags |
Context
2020-12-07
| ||
19:45 | Fix ability to change current year from simple tracking check-in: 9dd7fe3ea8 user: bohwaz tags: trunk, stable | |
19:43 | Add accounting search in more places, with more useful default queries check-in: b5cff0c2a6 user: bohwaz tags: trunk, stable | |
19:26 | Accounting export was breaking multi-line transactions in multiple transactions check-in: c583021c03 user: bohwaz tags: trunk, stable | |
Changes
Modified src/include/lib/Garradin/Accounting/Years.php from [31fc8b31a2] to [f93259774b].
︙ | ︙ | |||
14 15 16 17 18 19 20 21 22 23 24 25 26 27 | return EntityManager::findOneById(Year::class, $year_id); } static public function getCurrentOpenYear() { return EntityManager::findOne(Year::class, 'SELECT * FROM @TABLE WHERE closed = 0 ORDER BY start_date LIMIT 1;'); } static public function listOpen() { $db = EntityManager::getInstance(Year::class)->DB(); return $db->get('SELECT *, (SELECT COUNT(*) FROM acc_transactions WHERE id_year = acc_years.id) AS nb_transactions FROM acc_years WHERE closed = 0 ORDER BY end_date;'); } | > > > > > | 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 | return EntityManager::findOneById(Year::class, $year_id); } static public function getCurrentOpenYear() { return EntityManager::findOne(Year::class, 'SELECT * FROM @TABLE WHERE closed = 0 ORDER BY start_date LIMIT 1;'); } static public function getCurrentOpenYearId() { return EntityManager::getInstance(Year::class)->col('SELECT id FROM @TABLE WHERE closed = 0 ORDER BY start_date LIMIT 1;'); } static public function listOpen() { $db = EntityManager::getInstance(Year::class)->DB(); return $db->get('SELECT *, (SELECT COUNT(*) FROM acc_transactions WHERE id_year = acc_years.id) AS nb_transactions FROM acc_years WHERE closed = 0 ORDER BY end_date;'); } |
︙ | ︙ |
Modified src/templates/acc/accounts/index.tpl from [d00593bab9] to [6db865d25e].
1 2 3 4 5 6 7 8 | {include file="admin/_head.tpl" title="Comptes favoris" current="acc/accounts"} {include file="acc/_year_select.tpl"} <nav class="tabs"> <ul> <li class="current"><a href="{$admin_url}acc/accounts/">Comptes favoris</a></li> <li><a href="{$admin_url}acc/reports/trial_balance.php?year={$current_year.id}">Balance générale (tous les comptes)</a></li> | > > > < | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 | {include file="admin/_head.tpl" title="Comptes favoris" current="acc/accounts"} {include file="acc/_year_select.tpl"} <nav class="tabs"> <aside> {linkbutton shape="search" href="!acc/search.php?year=%d"|args:$current_year.id label="Recherche"} </aside> <ul> <li class="current"><a href="{$admin_url}acc/accounts/">Comptes favoris</a></li> <li><a href="{$admin_url}acc/reports/trial_balance.php?year={$current_year.id}">Balance générale (tous les comptes)</a></li> {if $session->canAccess('compta', Membres::DROIT_ADMIN)} <li><a href="{$admin_url}acc/charts/accounts/all.php?id={$chart_id}">Plan comptable</a></li> {/if} </ul> </nav> {include file="acc/_simple_help.tpl" link="../reports/trial_balance.php?year=%d"|args:$current_year.id type=null} |
︙ | ︙ |
Modified src/templates/acc/accounts/journal.tpl from [eea4b60d81] to [98708499a9].
︙ | ︙ | |||
48 49 50 51 52 53 54 55 56 57 58 59 60 61 | <nav class="tabs"> <aside> {if $session->canAccess('compta', Membres::DROIT_ADMIN)} {linkbutton href="%s&export=csv"|args:$self_url label="Export CSV" shape="export"} {linkbutton href="%s&export=ods"|args:$self_url label="Export tableur" shape="export"} {/if} {if $year.id == CURRENT_YEAR_ID} {linkbutton href="!acc/transactions/new.php?account=%d"|args:$account.id label="Saisir une écriture dans ce compte" shape="plus"} {/if} </aside> <ul> <li{if $simple} class="current"{/if}><a href="?id={$account.id}&simple=1&year={$year.id}">Vue simplifiée</a></li> <li{if !$simple} class="current"{/if}><a href="?id={$account.id}&simple=0&year={$year.id}">Vue comptable</a></li> | > | 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 | <nav class="tabs"> <aside> {if $session->canAccess('compta', Membres::DROIT_ADMIN)} {linkbutton href="%s&export=csv"|args:$self_url label="Export CSV" shape="export"} {linkbutton href="%s&export=ods"|args:$self_url label="Export tableur" shape="export"} {/if} {linkbutton shape="search" href="!acc/search.php?year=%d&account=%s"|args:$year.id,$account.code label="Recherche"} {if $year.id == CURRENT_YEAR_ID} {linkbutton href="!acc/transactions/new.php?account=%d"|args:$account.id label="Saisir une écriture dans ce compte" shape="plus"} {/if} </aside> <ul> <li{if $simple} class="current"{/if}><a href="?id={$account.id}&simple=1&year={$year.id}">Vue simplifiée</a></li> <li{if !$simple} class="current"{/if}><a href="?id={$account.id}&simple=0&year={$year.id}">Vue comptable</a></li> |
︙ | ︙ |
Modified src/templates/acc/accounts/simple.tpl from [d13f106002] to [39a74f4abd].
︙ | ︙ | |||
11 12 13 14 15 16 17 18 19 20 21 22 23 24 | <nav class="tabs"> <aside> {if $session->canAccess('compta', Membres::DROIT_ADMIN)} {linkbutton href="?type=%d&export=csv"|args:$type label="Export CSV" shape="export"} {linkbutton href="?type=%d&export=ods"|args:$type label="Export tableur" shape="export"} {/if} </aside> <ul> {foreach from=$types key="key" item="label"} <li{if $type == $key} class="current"{/if}><a href="?type={$key}">{$label}</a></li> {/foreach} </ul> </nav> | > | 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 | <nav class="tabs"> <aside> {if $session->canAccess('compta', Membres::DROIT_ADMIN)} {linkbutton href="?type=%d&export=csv"|args:$type label="Export CSV" shape="export"} {linkbutton href="?type=%d&export=ods"|args:$type label="Export tableur" shape="export"} {/if} {linkbutton shape="search" href="!acc/search.php?year=%d&type=%d"|args:$year.id,$type label="Recherche"} </aside> <ul> {foreach from=$types key="key" item="label"} <li{if $type == $key} class="current"{/if}><a href="?type={$key}">{$label}</a></li> {/foreach} </ul> </nav> |
︙ | ︙ |
Modified src/templates/acc/index.tpl from [275f4e0a55] to [b029a4865a].
1 2 3 4 5 6 7 8 9 | {include file="admin/_head.tpl" title="Comptabilité" current="acc"} {foreach from=$years item="year"} <section class="year-infos"> <h2 class="ruler">{$year.label} — Du {$year.start_date|date_short} au {$year.end_date|date_short}</h2> <nav class="tabs"> <aside> | < > | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 | {include file="admin/_head.tpl" title="Comptabilité" current="acc"} {foreach from=$years item="year"} <section class="year-infos"> <h2 class="ruler">{$year.label} — Du {$year.start_date|date_short} au {$year.end_date|date_short}</h2> <nav class="tabs"> <aside> {if $session->canAccess('compta', Membres::DROIT_ADMIN)} {linkbutton shape="upload" href="!acc/years/import.php?year=%d"|args:$year.id label="Import & export"} {/if} {linkbutton shape="search" href="!acc/search.php?year=%d"|args:$year.id label="Recherche"} </aside> <ul> <li><a href="{$admin_url}acc/reports/graphs.php?year={$year.id}">Graphiques</a></li> <li><a href="{$admin_url}acc/reports/trial_balance.php?year={$year.id}">Balance générale</a></li> <li><a href="{$admin_url}acc/reports/journal.php?year={$year.id}">Journal général</a></li> <li><a href="{$admin_url}acc/reports/ledger.php?year={$year.id}">Grand livre</a></li> <li><a href="{$admin_url}acc/reports/statement.php?year={$year.id}">Compte de résultat</a></li> |
︙ | ︙ |
Modified src/templates/acc/years/index.tpl from [1a1526a67f] to [a2bc7c5c37].
1 2 3 4 5 6 7 8 9 10 | {include file="admin/_head.tpl" title="Exercices" current="acc/years"} <nav class="tabs"> <ul> <li class="current"><a href="{$self_url}">Exercices</a></li> {if $session->canAccess('compta', Membres::DROIT_ADMIN)} <li><a href="{$admin_url}acc/years/new.php">Nouvel exercice</a></li> {/if} <li><a href="{$admin_url}acc/reports/projects.php">Projets <em>(compta analytique)</em></a></li> </ul> | > > > | 1 2 3 4 5 6 7 8 9 10 11 12 13 | {include file="admin/_head.tpl" title="Exercices" current="acc/years"} <nav class="tabs"> <aside> {linkbutton shape="search" href="!acc/search.php" label="Recherche"} </aside> <ul> <li class="current"><a href="{$self_url}">Exercices</a></li> {if $session->canAccess('compta', Membres::DROIT_ADMIN)} <li><a href="{$admin_url}acc/years/new.php">Nouvel exercice</a></li> {/if} <li><a href="{$admin_url}acc/reports/projects.php">Projets <em>(compta analytique)</em></a></li> </ul> |
︙ | ︙ |
Modified src/www/admin/common/search.php from [19bc74c76e] to [c07c074828].
︙ | ︙ | |||
116 117 118 119 120 121 122 | ], ], ]]; $result = null; } elseif ($target === 'compta') { | | > > > > > | > > > > > > > > > > > > > > > > > | 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 | ], ], ]]; $result = null; } elseif ($target === 'compta') { // Default $query->query = [[ 'operator' => 'AND', 'conditions' => [ [ 'column' => 't.id_year', 'operator' => '= ?', 'values' => [(int)qg('year') ?: Years::getCurrentOpenYearId()], ], [ 'column' => 't.label', 'operator' => 'LIKE %?%', 'values' => '', ], [ 'column' => 't.reference', 'operator' => 'LIKE %?%', 'values' => '', ], ], ]]; if (null !== qg('type')) { $query->query[0]['conditions'][] = [ 'column' => 't.type', 'operator' => '= ?', 'values' => [(int)qg('type')], ]; } if (null !== qg('account')) { $query->query[0]['conditions'][] = [ 'column' => 'a.code', 'operator' => '= ?', 'values' => [qg('account')], ]; } $query->desc = true; $result = null; } $columns = $recherche->getColumns($target); $is_admin = $session->canAccess($target, Membres::DROIT_ADMIN); $schema = $recherche->schema($target); |
︙ | ︙ |