Warning, /office/skrooge/tests/input/template.txt is written in an unsupported language. File is not indexed.

0001 <!--
0002 /***************************************************************************
0003  * SPDX-FileCopyrightText: 2022 S. MANKOWSKI stephane@mankowski.fr
0004  * SPDX-FileCopyrightText: 2022 G. DE BURE support@mankowski.fr
0005  * SPDX-License-Identifier: GPL-3.0-or-later
0006  ***************************************************************************/
0007 -->
0008 <?xml version="1.0" encoding="utf-8"?>
0009 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "https://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
0010 <html xmlns="https://www.w3.org/1999/xhtml">
0011   <head>
0012     <meta http-equiv="content-type" content="text/html;charset=utf-8" />
0013     <meta http-equiv="Content-Style-Type" content="text/css" />
0014     <link rel="stylesheet" href="http://getbootstrap.com/dist/css/bootstrap.min.css">   
0015   </head>
0016   <body>
0017   <h1>Introduction</h1>
0018   Welcome to this tutorial. You will learn how to develop a template to personalize your how report.<br>
0019   The template engine is based on <a href="http://www.grantlee.org/apidox/">Grantlee</a>.<br>
0020   <br>
0021   You can find information here:<br>
0022   <a href="http://www.grantlee.org/apidox/for_themers.html">http://www.grantlee.org/apidox/for_themers.html</a><br>
0023   <a href="https://docs.djangoproject.com/en/dev/ref/templates/builtins/">https://docs.djangoproject.com/en/dev/ref/templates/builtins/</a><br>
0024 
0025   <h1>The main variables</h1>  
0026   <h2>The simple values:</h2>
0027 You can have access to simple values:
0028 <div class="panel panel-primary">
0029   <div class="panel-heading">Code</div>
0030   <div class="panel-body">
0031 color_negativetext: &#123;{ color_negativetext }}<br/>
0032 color_positivetext: &#123;{ color_positivetext }}<br/>
0033 color_neutraltext: &#123;{ color_neutraltext }}<br/>
0034 color_normaltext: &#123;{ color_normaltext }}<br/>
0035 color_inactivetext: &#123;{ color_inactivetext }}<br/>
0036 color_activetext: &#123;{ color_activetext }}<br/>
0037 color_linktext: &#123;{ color_linktext }}<br/>
0038 color_visitedtext: &#123;{ color_visitedtext }}<br/>
0039 color_activebackground: &#123;{ color_activebackground }}<br/>
0040 
0041 font_family: &#123;{ font_family }}<br/>
0042 
0043 logo: &#123;{ logo }} &lt;img src="&#123;{ logo }}" /><br/>
0044 logo_black: &#123;{ logo_black }} &lt;img src="&#123;{ logo_black }}" /><br/>
0045 
0046 title_main: &#123;{ title_main }}<br/>
0047 title_budget: &#123;{ title_budget }}<br/>
0048 title_main_categories: &#123;{ title_main_categories }}<br/>
0049 title_variations: &#123;{ title_variations }}<br/>
0050 title_account: &#123;{ title_account }}<br/>
0051 title_unit: &#123;{ title_unit }}<br/>
0052 title_advice: &#123;{ title_advice }}<br/>
0053 title_portfolio: &#123;{ title_portfolio }}<br/>
0054 title_highlighted: &#123;{ title_highlighted }}<br/>
0055 title_networth: &#123;{ title_networth }}<br/>
0056 title_annual_spending: &#123;{ title_annual_spending }}<br/>
0057 title_personal_finance_score: &#123;{ title_personal_finance_score }}<br/>
0058 
0059 msg_no_variation: &#123;{ msg_no_variation|safe }}<br/>
0060 msg_no_scheduled: &#123;{ msg_no_scheduled|safe }}<br/>
0061 msg_no_highlighted: &#123;{ msg_no_highlighted|safe }}<br/>
0062 msg_no_budget: &#123;{ msg_no_budget|safe }}<br/>
0063 msg_no_share: &#123;{ msg_no_share|safe }}<br/>
0064 msg_amount_unit_date: &#123;{ msg_amount_unit_date|safe }}<br/>
0065 
0066 about_welcome: &#123;{ about_welcome|safe }}<br/>
0067 about_programname: &#123;{ about_programname|safe }}<br/>
0068 about_version: &#123;{ about_version|safe }}<br/>
0069 about_bugaddress: &#123;{ about_bugaddress|safe }}<br/>
0070 about_copyrightstatement: &#123;{ about_copyrightstatement|safe }}<br/>
0071 about_homepage: &#123;{ about_homepage|safe }}<br/>
0072 about_forumpage: &#123;{ about_forumpage|safe }}<br/>
0073 about_newspage: &#123;{ about_newspage|safe }}<br/>
0074 about_operationpage: &#123;{ about_operationpage|safe }}<br/>
0075 about_accountpage: &#123;{ about_accountpage|safe }}<br/>
0076 about_shortdescription: &#123;{ about_shortdescription|safe }}<br/>
0077 about_othertext: &#123;{ about_othertext|safe }}<br/>
0078 about_maintext: &#123;{ about_maintext|safe }}<br/>
0079   </div>
0080 </div>
0081   
0082 <div class="panel panel-primary">
0083   <div class="panel-heading">Result</div>
0084   <div class="panel-body">
0085 color_negativetext: {{ color_negativetext }}<br/>
0086 color_positivetext: {{ color_positivetext }}<br/>
0087 color_neutraltext: {{ color_neutraltext }}<br/>
0088 color_normaltext: {{ color_normaltext }}<br/>
0089 color_inactivetext: {{ color_inactivetext }}<br/>
0090 color_activetext: {{ color_activetext }}<br/>
0091 color_linktext: {{ color_linktext }}<br/>
0092 color_visitedtext: {{ color_visitedtext }}<br/>
0093 color_activebackground: {{ color_activebackground }}<br/>
0094 
0095 font_family: {{ font_family }}<br/>
0096 
0097 logo: {{ logo }} <img src="{{ logo }}" /><br/>
0098 logo_black: {{ logo_black }} <img src="{{ logo_black }}" /><br/>
0099 
0100 title_main: {{ title_main }}<br/>
0101 title_budget: {{ title_budget }}<br/>
0102 title_main_categories: {{ title_main_categories }}<br/>
0103 title_variations: {{ title_variations }}<br/>
0104 title_account: {{ title_account }}<br/>
0105 title_unit: {{ title_unit }}<br/>
0106 title_advice: {{ title_advice }}<br/>
0107 title_portfolio: {{ title_portfolio }}<br/>
0108 title_highlighted: {{ title_highlighted }}<br/>
0109 title_networth: {{ title_networth }}<br/>
0110 title_annual_spending: {{ title_annual_spending }}<br/>
0111 title_personal_finance_score: {{ title_personal_finance_score }}<br/>
0112 
0113 msg_no_variation: {{ msg_no_variation|safe }}<br/>
0114 msg_no_scheduled: {{ msg_no_scheduled|safe }}<br/>
0115 msg_no_highlighted: {{ msg_no_highlighted|safe }}<br/>
0116 msg_no_budget: {{ msg_no_budget|safe }}<br/>
0117 msg_no_share: {{ msg_no_share|safe }}<br/>
0118 msg_amount_unit_date: {{ msg_amount_unit_date|safe }}<br/>
0119 
0120 about_welcome: {{ about_welcome|safe }}<br/>
0121 about_programname: {{ about_programname|safe }}<br/>
0122 about_version: {{ about_version|safe }}<br/>
0123 about_bugaddress: {{ about_bugaddress|safe }}<br/>
0124 about_copyrightstatement: {{ about_copyrightstatement|safe }}<br/>
0125 about_homepage: {{ about_homepage|safe }}<br/>
0126 about_forumpage: {{ about_forumpage|safe }}<br/>
0127 about_newspage: {{ about_newspage|safe }}<br/>
0128 about_operationpage: {{ about_operationpage|safe }}<br/>
0129 about_accountpage: {{ about_accountpage|safe }}<br/>
0130 about_shortdescription: {{ about_shortdescription|safe }}<br/>
0131 about_othertext: {{ about_othertext|safe }}<br/>
0132 about_maintext: {{ about_maintext|safe }}<br/>
0133   </div>
0134 </div>  
0135 
0136   <h2>The report:</h2>  
0137 From this object you can have access to more complex values:
0138 <div class="panel panel-primary">
0139   <div class="panel-heading">Code</div>
0140   <div class="panel-body">
0141 report.period=&#123;{ report.period }}<br/>
0142 report.previous_period=&#123;{ report.previous_period }}<br/>
0143 report.previous.period=&#123;{ report.previous.period }}<br/>
0144 report.previous.previous_period=&#123;{ report.previous.previous_period }}<br/>
0145 
0146 report.budget_table=&#123;{ report.budget_table|dump|safe }}<br/>
0147 report.unit_table=&#123;{ report.unit_table|dump|safe }}<br/>
0148 report.portfolio=&#123;{ report.portfolio|dump|safe }}<br/>
0149 report.account_table=&#123;{ report.account_table|dump|safe }}<br/>
0150 report.bank_table=&#123;{ report.bank_table|dump|safe }}<br/>
0151 report.scheduled_operations=&#123;{ report.scheduled_operations|dump|safe }}<br/>
0152 report.categories_period=&#123;{ report.categories_period|dump|safe }}<br/>
0153 report.categories_previous_period=&#123;{ report.categories_previous_period|dump|safe }}<br/>
0154 report.income_vs_expenditure=&#123;{ report.income_vs_expenditure|dump|safe }}<br/>
0155 report.networth=&#123;{ report.networth|money|safe }}<br/>
0156 report.annual_spending=&#123;{ report.annual_spending|money|safe }}<br/>
0157 report.personal_finance_score=&#123;{ report.personal_finance_score }}<br/>
0158 report.categories_variations=&#123;{ report.categories_variations|dump|safe }}<br/>
0159 report.categories_variations_issues=&#123;{ report.categories_variations_issues|dump|safe }}<br/>
0160   </div>
0161 </div>
0162   
0163 <div class="panel panel-primary">
0164   <div class="panel-heading">Result</div>
0165   <div class="panel-body">
0166 report.period={{ report.period }}<br/>
0167 report.previous_period={{ report.previous_period }}<br/>
0168 report.previous.period={{ report.previous.period }}<br/>
0169 report.previous.previous_period={{ report.previous.previous_period }}<br/>
0170 
0171 report.budget_table={{ report.budget_table|dump|safe }}<br/>
0172 report.unit_table={{ report.unit_table|dump|safe }}<br/>
0173 report.portfolio={{ report.portfolio|dump|safe }}<br/>
0174 report.account_table={{ report.account_table|dump|safe }}<br/>
0175 report.bank_table={{ report.bank_table|dump|safe }}<br/>
0176 report.scheduled_operations={{ report.scheduled_operations|dump|safe }}<br/>
0177 report.categories_period={{ report.categories_period|dump|safe }}<br/>
0178 report.categories_previous_period={{ report.categories_previous_period|dump|safe }}<br/>
0179 report.income_vs_expenditure={{ report.income_vs_expenditure|dump|safe }}<br/>
0180 report.networth={{ report.networth|money|safe }}<br/>
0181 report.annual_spending={{ report.annual_spending|money|safe }}<br/>
0182 report.personal_finance_score={{ report.personal_finance_score }}<br/>
0183 report.categories_variations={{ report.categories_variations|dump|safe }}<br/>
0184 report.categories_variations_issues={{ report.categories_variations_issues|dump|safe }}<br/>
0185   </div>
0186 </div> 
0187 
0188   <h2>The document:</h2>  
0189 From this object you can have access to more complex values:
0190 <div class="panel panel-primary">
0191   <div class="panel-heading">Code</div>
0192   <div class="panel-body">
0193 &#123;{ document|dump|safe }}
0194   </div>
0195 </div>
0196 <div class="alert alert-success" role="alert">The "dump" filter allows to dump the object</div>
0197   
0198 <div class="panel panel-primary">
0199   <div class="panel-heading">Result</div>
0200   <div class="panel-body">
0201 {{ document|dump|safe }}
0202   </div>
0203 </div>  
0204 
0205  <h1>The filters</h1>
0206   In addition of standard filters, you can the following filters developed for Skrooge.
0207 <div class="panel panel-primary">
0208   <div class="panel-heading">Code</div>
0209   <div class="panel-body">
0210 &#123;{ 10.1|money|safe }}<br/>
0211 &#123;{ -10.2|money|safe }}<br/>
0212 &#123;{ -10.2|money:"nocolor" }}<br/>
0213 
0214 &#123;{ 10.1|money:"1"|safe }}<br/>
0215 &#123;{ -10.2|money:"1"|safe }}<br/>
0216 
0217 &#123;{ 10.1|money:"2"|safe }}<br/>
0218 &#123;{ -10.2|money:"2"|safe }}<br/>
0219 &#123;{ -10.2|money:"2;nocolor" }}<br/>
0220 
0221 &#123;{ 10.1|percent|safe }}<br/>
0222 &#123;{ -10.2|percent|safe }}<br/>
0223 
0224 &#123;{ 70000|filesizeformat }}<br/>
0225   </div>
0226 </div>
0227 <div class="alert alert-success" role="alert">The "money" filter display a numerical value as a money. With "1", in primary money. With "2", in secondary money</div>
0228 <div class="alert alert-success" role="alert">The "percent" filter display a numerical value as a percent</div>
0229 <div class="alert alert-success" role="alert">The "filesizeformat" filter display a numerical value as a file size format</div>
0230 
0231 <div class="panel panel-primary">
0232   <div class="panel-heading">Result</div>
0233   <div class="panel-body">
0234 {{ 10.1|money|safe }}<br/>
0235 {{ -10.2|money|safe }}<br/>
0236 {{ -10.2|money:"nocolor" }}<br/>
0237 
0238 {{ 10.1|money:"1"|safe }}<br/>
0239 {{ -10.2|money:"1"|safe }}<br/>
0240 
0241 {{ 10.1|money:"2"|safe }}<br/>
0242 {{ -10.2|money:"2"|safe }}<br/>
0243 {{ -10.2|money:"2;nocolor" }}<br/>
0244 
0245 {{ 10.1|percent|safe }}<br/>
0246 {{ -10.2|percent|safe }}<br/>
0247 
0248 {{ 70000|filesizeformat }}<br/>
0249   </div>
0250 </div>  
0251 
0252 The following code will display the list of opened accounts with current amount:<br/>
0253 <div class="panel panel-primary">
0254   <div class="panel-heading">Code</div>
0255   <div class="panel-body">
0256 &#123;% for item in document|table:"v_account_display,t_close='N' ORDER BY t_name" %}<br/>
0257 &#123;{ item|att:"t_name" }}:&#123;{ item|att:"f_CURRENTAMOUNT"|money|safe }}&lt;br/&gt;<br/>
0258 &#123;% endfor %} 
0259   </div>
0260 </div>
0261 <div class="alert alert-success" role="alert">The "table" filter allows to search objects</div>
0262 <div class="alert alert-success" role="alert">The "att" filter allows to get an attribute of an object</div>
0263 
0264 <div class="panel panel-primary">
0265   <div class="panel-heading">Result</div>
0266   <div class="panel-body">
0267 {% for item in document|table:"v_account_display,t_close='N' ORDER BY t_name" %}
0268 {{ item|att:"t_name" }}:{{ item|att:"f_CURRENTAMOUNT"|money|safe }}<br/>
0269 {% endfor %} 
0270   </div>
0271 </div>
0272 
0273 The following code will execute a sql order and display the result:<br/>
0274 <div class="panel panel-primary">
0275   <div class="panel-heading">Code</div>
0276   <div class="panel-body">
0277 &#123;% for item in document|query:"select t_name as name, (select count(1) from operation where rd_account_id=account.id) as id from account" %}<br/>
0278 &#123;{ item.0 }}:&#123;{ item.1 }}&lt;br/&gt;<br/> 
0279 &#123;% endfor %} 
0280   </div>
0281 </div>
0282 <div class="alert alert-success" role="alert">The "query" filter allows to execute the sql order you want</div>
0283 
0284 <div class="panel panel-primary">
0285   <div class="panel-heading">Result</div>
0286   <div class="panel-body">
0287 {% for item in document|query:"select t_name as name, (select count(1) from operation where rd_account_id=account.id) as id from account" %}
0288 {{ item.0 }}:{{ item.1 }}<br/>
0289 {% endfor %} 
0290   </div>
0291 </div>
0292 
0293 
0294 You can also use external libraries to display values as you want:
0295 <div class="panel panel-primary">
0296   <div class="panel-heading">Code</div>
0297   <div class="panel-body">
0298   &lt;img src="https://chart.apis.google.com/chart?cht=bvs&chxs=0,&#123;{ color_normaltext }}|1,&#123;{ color_normaltext }}&chbh=100&chxt=x,y&chxr=1,0,&#123;{ report.income_vs_expenditure.4.3 }}&chf=bg,s,&#123;{ color_normalbackground }}&chco=&#123;{ color_negativetext }}|&#123;{ color_positivetext }}&chd=t:&#123;{ report.income_vs_expenditure.2.3 }},&#123;{ report.income_vs_expenditure.1.3 }}&chds=0,&#123;{ report.income_vs_expenditure.4.3 }}&chs=300x200&chl=&#123;{ document|display:"f_CURRENTAMOUNT_EXPENSE" }}|&#123;{ document|display:"f_CURRENTAMOUNT_INCOME" }}&chts=&#123;{ color_normaltext }}&chtt=&#123;{ document|display:"f_CURRENTAMOUNT_EXPENSE" }} vs &#123;{ document|display:"f_CURRENTAMOUNT_INCOME" }}|&#123;{ report.period }}"/> 
0299   </div>
0300 </div>   
0301 <div class="panel panel-primary">
0302   <div class="panel-heading">Result</div>
0303   <div class="panel-body">
0304   <img src="https://chart.apis.google.com/chart?cht=bvs&chxs=0,{{ color_normaltext }}|1,{{ color_normaltext }}&chbh=100&chxt=x,y&chxr=1,0,{{ report.income_vs_expenditure.4.3 }}&chf=bg,s,{{ color_normalbackground }}&chco={{ color_negativetext }}|{{ color_positivetext }}&chd=t:{{ report.income_vs_expenditure.2.3 }},{{ report.income_vs_expenditure.1.3 }}&chds=0,{{ report.income_vs_expenditure.4.3 }}&chs=300x200&chl={{ document|display:"f_CURRENTAMOUNT_EXPENSE" }}|{{ document|display:"f_CURRENTAMOUNT_INCOME" }}&chts={{ color_normaltext }}&chtt={{ document|display:"f_CURRENTAMOUNT_EXPENSE" }} vs {{ document|display:"f_CURRENTAMOUNT_INCOME" }}|{{ report.period }}"/> 
0305   </div>
0306 </div> 
0307   
0308   </body>
0309 </html>