From b046a71214ea6236ec7a22e603cadcc21e36644a Mon Sep 17 00:00:00 2001 From: Mathis Jacoby Date: Fri, 22 Sep 2023 17:13:51 +0200 Subject: [PATCH] [ADD] generate_xml.sh - bash script to generate the MIS Templates --- l10n_be_mis_reports/script/README.rst | 25 ++++++++++++++++------ l10n_be_mis_reports/script/generate_xml.sh | 16 ++++++++++++++ 2 files changed, 34 insertions(+), 7 deletions(-) create mode 100755 l10n_be_mis_reports/script/generate_xml.sh diff --git a/l10n_be_mis_reports/script/README.rst b/l10n_be_mis_reports/script/README.rst index 96bd68c6a..cb9882edf 100644 --- a/l10n_be_mis_reports/script/README.rst +++ b/l10n_be_mis_reports/script/README.rst @@ -1,7 +1,17 @@ -correct_xml and generate_xml are two scripts that allow to generate a MIS Report Templates for the Balance Sheet and the Profit & Loss +generate_xml.sh is a script that use two python scripts (correct_xml and generate_xml) and +allow to generate a MIS Report Templates for the Balance Sheet and the Profit & Loss -First, use the generate_xml script to generate the template of the model that you need. -Then, use the correct_xml script which will make some modification to the template previously generated. +**USAGE** + +./generate_xml.sh -a AUTHOR_NAME -f XX -y YEAR + +*Options* + +-a : The author name for the copyright + +-f : The file model (see bellow). You only need to specify the two digits of the model (mXX-f) + +-y : The date of the copyright **MODELS** @@ -15,9 +25,10 @@ Then, use the correct_xml script which will make some modification to the templa - Abridged model association [m04-f] - Full model association [m05-f] -**GENERATE_XML** -This script generates the XML MIS Builder template for a specified model (see above) +**GENERATE_XML.py** + +This python script generates the XML MIS Builder template for a specified model (see above) It uses two JSON files. The first one is located in the 'data' folder and contains all the data of an annual account. The second file is located in the 'calc' folder and contains the rubrics' calculations. @@ -30,9 +41,9 @@ python generate_xml.py --filename=FILENAME --author=AUTHOR --year=YEAR data/mXX- Where XX correspond to the model that you want -**CORRECT_XML** +**CORRECT_XML.py** -This script corrects some calculations and styles of the XML MIS Builder template for a specified model. +This python script corrects some calculations and styles of the XML MIS Builder template for a specified model. *USAGE* diff --git a/l10n_be_mis_reports/script/generate_xml.sh b/l10n_be_mis_reports/script/generate_xml.sh new file mode 100755 index 000000000..c7caca2bf --- /dev/null +++ b/l10n_be_mis_reports/script/generate_xml.sh @@ -0,0 +1,16 @@ +#!/bin/bash + +set -eu + +while getopts ":a:f:y:" flag; +do + case "${flag}" in + a) author=${OPTARG};; + f) filename=${OPTARG};; + y) year=${OPTARG};; + esac +done + +python generate_xml.py --filename="m${filename}-f" --author=$author --year=$year data/m${filename}-f.json calc/22_19_m${filename}-f.json +python correct_xml.py ../data/mis_report_bs_m${filename}-f.xml +python correct_xml.py ../data/mis_report_pl_m${filename}-f.xml