diff options
| author | Anders Betts <anders.betts@gmail.com> | 2026-09-20 20:11:19 +0200 |
|---|---|---|
| committer | Anders Betts <anders.betts@gmail.com> | 2026-09-20 20:11:19 +0200 |
| commit | 8351fa7752bb8341ef405a37ff7c73142715e981 (patch) | |
| tree | dde603d313f4f26934f2ce20a22dfd9b69324cf0 /src/cmd_sru.c | |
| parent | beafdbe0d64340387d619c38554976410129f05b (diff) | |
| download | bokf-8351fa7752bb8341ef405a37ff7c73142715e981.tar.gz bokf-8351fa7752bb8341ef405a37ff7c73142715e981.zip | |
commands: split the command table by domain
Diffstat (limited to 'src/cmd_sru.c')
| -rw-r--r-- | src/cmd_sru.c | 50 |
1 files changed, 50 insertions, 0 deletions
diff --git a/src/cmd_sru.c b/src/cmd_sru.c new file mode 100644 index 0000000..337ef69 --- /dev/null +++ b/src/cmd_sru.c @@ -0,0 +1,50 @@ +#include "commands.h" +#include "cmd_util.h" + +#include <stdio.h> +#include <stdlib.h> +#include <string.h> + +#include "db.h" +#include "sru.h" +#include "util.h" + +static yyjson_mut_val *h_sru_export(struct req *r) +{ + int64_t fy = 0; + if (req_fy(r, &fy) != 0) + return NULL; + char *err = NULL; + yyjson_mut_val *res = + sru_export(r->rdoc, r->db, r->org_id, fy, r->args, &err); + if (!res) { + yyjson_mut_val *e = + fail(r, "INVALID_ARGS", err ? err : "could not build the SRU files"); + free(err); + return e; + } + return res; +} + + +static const struct cmd_arg args_sru_export[] = { + { "fiscal_year", ARG_INT, 0, NULL, NULL, + "Fiscal year id; defaults to the latest" }, + { "adjustments", ARG_JSON, 0, NULL, NULL, + "Array of {code,amount_ore} tax adjustments" }, + { "submitter", ARG_JSON, 0, NULL, NULL, + "Object overriding the INFO.SRU submitter" }, + { "assisted", ARG_BOOL, 0, NULL, NULL, "Assisted declaration" }, + { "audited", ARG_BOOL, 0, NULL, NULL, "Audited declaration" }, + { "ignore_unmapped", ARG_BOOL, 0, "false", NULL, + "Proceed despite unmapped accounts" }, +}; + +const struct command g_cmd_sru[] = { + { "sru.export", "INK2 SRU files (INFO.SRU + BLANKETTER.SRU)", + PERM_READ, 1, 0, 0, h_sru_export, CMD_ARGS(args_sru_export) }, +}; + +const struct cmd_table g_cmd_table_sru = { + g_cmd_sru, sizeof g_cmd_sru / sizeof g_cmd_sru[0] +}; |
