Skip to content

Kassekladde behavior

Documented against app commit ed7d6935. The same text lives in docs/agent/kassekladde.md in the app repo.

Import of a journal CSV (posteringer) and export of existing bogføringer to CSV. Bank CSV is docs/agent/rules.md. The rows this import creates are the posting shape in docs/agent/transactions.md.

Middleware: auth.check, module:bogforing, account, year.

PathViewWhat it is
GET /bogforings/import and POST /bogforings/importresources/views/pages/imports/bogforings/index.blade.phpUpload a kassekladde CSV and preview the rows. GET shows the form. POST parses the file into the preview.
POST /bogforings/import/storesame preview, then redirectWrites the previewed rows.
GET /bogforings/export and POST /bogforings/exportresources/views/pages/exports/bogforings/index.blade.phpFilter by date and bilagsnr. POST fills the table. The page does not insert rows.

Import regions: file input, category, the preview table (date, text, beløb, type, konto, moms, modkonto), and the save button. Export regions: from and to dates, from and to bilagsnr, and the result table of folded konto and modkonto columns.

Imports\BogforingController@index on POST reads the CSV and builds the preview. It does not write bogføringer. store JSON-decodes bogforings from the preview and, for each row:

  • Resolves kontoplan and momskode maps for the row’s year. The maps are the active company’s kontoplan, not a second chart.
  • Uses inputBelob when the user typed one, otherwise UtilityService::getBogforingAmount.
  • If the momskode is in momskodeDoubleMap, flips momskodeBelob with currencyFlipValue. The matching flip for modkonto moms is intentionally not applied. A comment in store records that the base amount and the document amount were ending up with different signs.
  • When fromImportKasse is set, the bilagsnr is the CSV bilag. Otherwise the next number is assigned.
  • Calls BogforingService::store and BogforingTransactionService::store with the same line fields as a manual bilag.

If removeExistingBankCsv is set, the previous bank_csvs row and its bogføringer are deleted first and a new bank-csv id is stored on the headers. That flag is only for a re-import of a file that was already tied to a bank_csv_id. A normal kassekladde import leaves bank_csv_id as sent by the form.

Exports\BogforingController@index on POST calls BogforingService::getAllFilteredByDateAndNumber with from, to, fromBilag, and toBilag. It then runs transformTransactions with the company currency and the conversion map for those dates. The table and the CSV download are that folded result: konto is types 1+3, modkonto is types 2+4. Export does not read bogforings.amount as the column total.

Both screens require a year and a company. An empty kontoplan for that year cannot resolve line konti, and store will skip or fail the moms lookup the same way BogforingTransactionService::store does.