1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
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]
};
|