Hi, I have the below coding for a stock rec I am working on. I am hoping to have the stock sheet in sections, e.g. Raw Materials, Cattle, Pigs (we deal with agricultural clients). I like the layout I have set up but am not sure how to make each section independent? I assume it is something I have not done with the fori’s. I tried to add a break but lost everything below it.
Thanks in advance.
I hope I have shared the coding in a reasonable state.
Cheers
`{% stripnewlines %}
|Stock type
|
|Workings
|Number
|Market Value
|% of MV
|Final amount
|
|
{% newline %}
|----20%----
|-----2%----
|-----20%----
|----10%----:
|----10%----:
|----10%----:
|----10%----:
|----10%----
|----5%----:+
{% newline %}
|{% input custom.choice.template.1 as:select options:“Raw Materials|Work In Progress|Finshed Goods|Cattle” option_values:“1|2|3|4” default:1 %}
|
|{% input custom.tick.workings1 as:boolean %}
|
|
|
|
|
|
{% endstripnewlines %}
{% if custom.choice.template.1 == 1 and custom.tick.workings1 %}
{% assign $0 = 0 %}{% assign $1 = 0 %}{% assign $2 = 0 %}
{% assign stock_types = “Raw Materials” %}
{% stripnewlines %}
{% fori detail in current_account.details %}
{% if forloop.first %}
| {% t “Stock type” %}
|
| {% t “Stock description” %}
| {% t “Number” %}
| {% t “Market Value” %}
|
| {% t “Final amount” %}
| {% t “Notes” %}
|
{% newline %}
|----20%----
|-----2%----
|-----20%----
|----10%----:
|----10%----:
|----10%----:
|----10%----:
|----10%—:
|----5%----+
{% endif %}
{% newline %}
| {% input detail.custom.type as:select options:stock_types %} {% if custom.check.comments == true %}
{% input custom.comments placeholder:“Comments” as:text size:mini %}
{% endif %}
| {% input detail.custom.annex as:file_collection %}
| {% input detail.custom.description %}
| {% $0+input detail.custom.number %}
| {% $1+input detail.custom.marketvalue as:currency_dc %}
|
{% assign total_stock = (detail.custom.number*detail.custom.marketvalue) %}
| {%=$2+ total_stock | currency_dc %}
| {% ic %}{% input detail.custom.extra_comment placeholder:“Comment” %}{% endic %}{% nic %}{{ detail.custom.extra_comment | multiline_table }}{% endnic %}
|
{% if forloop.last %}
{% endif %}
{% endfori %}
{% endstripnewlines %}
{% endif %}
{% stripnewlines %}
|----20%----
|-----2%----
|-----20%----
|----10%----:
|----10%----:
|----10%----:
|----10%----:
|----10%—:
|----5%----+
{% newline %}
|^ Total ^
|^ ^
|^ ^
|^ {{ $0 | currency_dc}}^
|^ {{ $1 | currency_dc}}^
|^ ^
|^ {{ $2 | currency_dc}} ^
|^ ^
|^ ^
{% endstripnewlines %}
{% stripnewlines %}
|Stock type
|
|Workings
|Number
|Market Value
|% of MV
|Final amount
|
|
{% newline %}
|----20%----
|-----2%----
|-----20%----
|----10%----:
|----10%----:
|----10%----:
|----10%----:
|----10%----
|----5%----:+
{% newline %}
|{% input custom.choice.template.2 as:select options:“Raw Materials|Work In Progress|Finshed Goods|Cattle” option_values:“1|2|3|4” default:1 %}
|
|{% input custom.tick.workings2 as:boolean %}
|
|
|
|
|
|
{% endstripnewlines %}
{% if custom.choice.template.2 == 2 and custom.tick.workings2 %}
{% assign $4 = 0 %}{% assign $5 = 0 %}{% assign $6 = 0 %}
{% assign stock_types2 = “Work In Progress” %}
{% stripnewlines %}
{% fori detail in current_account.details %}
{% if forloop.first %}
| {% t “Stock type” %}
|
| {% t “Stock description” %}
| {% t “Number” %}
| {% t “Market Value” %}
|
| {% t “Final amount” %}
| {% t “Notes” %}
|
{% newline %}
|----20%----
|-----2%----
|-----20%----
|----10%----:
|----10%----:
|----10%----:
|----10%----:
|----10%—:
|----5%----+
{% endif %}
{% newline %}
| {% input detail.custom.type2 as:select options:stock_types2 %} {% if custom.check.comments2 == true %}
{% input custom.comments2 placeholder:“Comments” as:text size:mini %}
{% endif %}
| {% input detail.custom.annex as:file_collection %}
| {% input detail.custom.description2 %}
| {% $4+input detail.custom.number2 %}
| {% $5+input detail.custom.marketvalue2 as:currency_dc %}
|
{% assign total_stock2 = (detail.custom.number2*detail.custom.marketvalue2) %}
| {%=$6+ total_stock2 | currency_dc %}
| {% ic %}{% input detail.custom.extra_comment2 placeholder:“Comment” %}{% endic %}{% nic %}{{ detail.custom.extra_comment2 | multiline_table }}{% endnic %}
|
{% if forloop.last %}
{% endif %}
{% endfori %}
{% endstripnewlines %}
{% endif %}
{% stripnewlines %}
|----20%----
|-----2%----
|-----20%----
|----10%----:
|----10%----:
|----10%----:
|----10%----:
|----10%—:
|----5%----+
{% newline %}
|^ Total ^
|^ ^
|^ ^
|^ {{ $4 | currency_dc}}^
|^ {{ $5 | currency_dc}}^
|^ ^
|^ {{ $6 | currency_dc}} ^
|^ ^
|^ ^
{% endstripnewlines %}
{% stripnewlines %}
{% newline %}
|----20%----
|-----2%----
|-----20%----
|----10%----:
|----10%----:
|----10%----:
|----10%----:
|----10%----
|----5%----:+
{% newline %}
|{% input custom.choice.template.3 as:select options:“Raw Materials|Work In Progress|Finshed Goods|Cattle” option_values:“1|2|3|4” default:1 %}
|
|{% input custom.tick.workings3 as:boolean %}
|
|
|
|
|
|
{% endstripnewlines %}
{% if custom.choice.template.3 == 3 and custom.tick.workings3 %}
{% assign $7 = 0 %}{% assign $8 = 0 %}{% assign $9 = 0 %}
{% assign stock_types3 = “Finished Goods” %}
{% stripnewlines %}
{% fori detail in current_account.details %}
{% if forloop.first %}
| {% t “Stock type” %}
|
| {% t “Stock description” %}
| {% t “Number” %}
| {% t “Market Value” %}
|
| {% t “Final amount” %}
| {% t “Notes” %}
|
{% newline %}
|----20%----
|-----2%----
|-----20%----
|----10%----:
|----10%----:
|----10%----:
|----10%----:
|----10%—:
|----5%----+
{% endif %}
{% newline %}
| {% input detail.custom.type3 as:select options:stock_types3 %} {% if custom.check.comments3 == true %}
{% input custom.comments3 placeholder:“Comments” as:text size:mini %}
{% endif %}
| {% input detail.custom.annex as:file_collection %}
| {% input detail.custom.description3 %}
| {% $4+input detail.custom.number3 %}
| {% $5+input detail.custom.marketvalue3 as:currency_dc %}
|
{% assign total_stock3 = (detail.custom.number3*detail.custom.marketvalue3) %}
| {%=$6+ total_stock3 | currency_dc %}
| {% ic %}{% input detail.custom.extra_comment3 placeholder:“Comment” %}{% endic %}{% nic %}{{ detail.custom.extra_comment3 | multiline_table }}{% endnic %}
|
{% if forloop.last %}
{% endif %}
{% endfori %}
{% endstripnewlines %}
{% endif %}
{% stripnewlines %}
|----20%----
|-----2%----
|-----20%----
|----10%----:
|----10%----:
|----10%----:
|----10%----:
|----10%—:
|----5%----+
{% newline %}
|^ Total ^
|^ ^
|^ ^
|^ {{ $7 | currency_dc}}^
|^ {{ $8 | currency_dc}}^
|^ ^
|^ {{ $9 | currency_dc}} ^
|^ ^
|^ ^
{% endstripnewlines %}
{% stripnewlines %}
{% newline %}
|----20%----
|-----2%----
|-----20%----
|----10%----:
|----10%----:
|----10%----:
|----10%----:
|----10%----
|----5%----:+
{% newline %}
|{% input custom.choice.template.4 as:select options:“Raw Materials|Work In Progress|Finshed Goods|Cattle” option_values:“1|2|3|4” default:1 %}
|
|{% input custom.tick.workings4 as:boolean %}
|
|
|
|
|
|
{% endstripnewlines %}
{% if custom.choice.template.4 == 4 and custom.tick.workings4 %}
{% assign $10 = 0 %}{% assign $11 = 0 %}{% assign $12 = 0 %}
{% assign stock_types4 = “Bulls|Cows|Barreners|Heifers incalf|Heifers over 25 months|Heifers 19 to 24 months|Heifers 13 to 18 months|Heifers 7 to 12 months|Heifers 0 to 6 months|Beef Male cattle over 24 months|Beef Female cattle over 24 months|Beef Male cattle 19 to 24 months|Beef Female cattle 19 to 24 months|Beef Male cattle 13 to 18 months|Beef Female cattle 13 to 18 months|Beef Male cattle 7 to 12 months|Beef Female cattle 7 to 12 months|Beef Male cattle 0 to 6 months|Beef Female cattle 0 to 6 months” %}
{% stripnewlines %}
{% fori detail in current_account.details %}
{% if forloop.first %}
| {% t “Stock type” %}
|
| {% t “Stock description” %}
| {% t “Number” %}
| {% t “Market Value” %}
| {% t “60% of MV” %}
| {% t “Final amount” %}
| {% t “Notes” %}
|
{% newline %}
|----20%----
|-----2%----
|-----20%----
|----10%----:
|----10%----:
|----10%----:
|----10%----:
|----10%—:
|----5%----+
{% endif %}
{% newline %}
| {% input detail.custom.type4 as:select options:stock_types %} {% if custom.check.comments4 == true %}
{% input custom.comments4 placeholder:“Comments” as:text size:mini %}
{% endif %}
| {% input detail.custom.annex as:file_collection %}
| {% input detail.custom.description4 %}
| {% $10+input detail.custom.number4 %}
| {% $11+input detail.custom.marketvalue4 as:currency_dc %}
| 60%
{% assign total_stock4 = (detail.custom.number4*detail.custom.marketvalue4)*0.6 %}
| {%=$12+ total_stock4 | currency_dc %}
| {% ic %}{% input detail.custom.extra_comment4 placeholder:“Comment” %}{% endic %}{% nic %}{{ detail.custom.extra_comment4 | multiline_table }}{% endnic %}
|
{% if forloop.last %}
{% endif %}
{% endfori %}
{% endstripnewlines %}
{% endif %}
{% stripnewlines %}
|----20%----
|-----2%----
|-----20%----
|----10%----:
|----10%----:
|----10%----:
|----10%----:
|----10%—:
|----5%----+
{% newline %}
|^ Total ^
|^ ^
|^ ^
|^ {{ $10 | currency_dc}}^
|^ {{ $11 | currency_dc}}^
|^ ^
|^ {{ $12 | currency_dc}}^
|^ ^
|^ ^
{% endstripnewlines %}
{% stripnewlines %}
{% newline %}
|----20%----
|-----2%----
|-----20%----
|----10%----:
|----10%----:
|----10%----:
|----10%----:
|----10%----
|----5%----:+
{% newline %}
|{% input custom.choice.template.5 as:select options:“Raw Materials|Work In Progress|Finshed Goods|Cattle” option_values:“1|2|3|4” default:1 %}
|
|{% input custom.tick.workings5 as:boolean %}
|
|
|
|
|
|
{% endstripnewlines %}
{% if custom.choice.template.5 == 5 and custom.tick.workings5 %}
{% assign $13 = 0 %}{% assign $14 = 0 %}{% assign $15 = 0 %}
{% assign stock_types5 = “Rams|Ewes|Barren ewes|Young ewes|Sheraling/tups|Gimmer|Hogget|Ram lambs|Store lambs|Lambs” %}
{% stripnewlines %}
{% fori detail in current_account.details %}
{% if forloop.first %}
| {% t “Stock type” %}
|
| {% t “Stock description” %}
| {% t “Number” %}
| {% t “Market Value” %}
| {% t “60% of MV” %}
| {% t “Final amount” %}
| {% t “Notes” %}
|
{% newline %}
|----20%----
|-----2%----
|-----20%----
|----10%----:
|----10%----:
|----10%----:
|----10%----:
|----10%—:
|----5%----+
{% endif %}
{% newline %}
| {% input detail.custom.type5 as:select options:stock_types %} {% if custom.check.comments5 == true %}
{% input custom.comments5 placeholder:“Comments” as:text size:mini %}
{% endif %}
| {% input detail.custom.annex as:file_collection %}
| {% input detail.custom.description5 %}
| {% $13+input detail.custom.number5 %}
| {% $14+input detail.custom.marketvalue5 as:currency_dc %}
| 75%
{% assign total_stock5 = (detail.custom.number5*detail.custom.marketvalue5)*0.75 %}
| {%=$15+ total_stock5 | currency_dc %}
| {% ic %}{% input detail.custom.extra_comment5 placeholder:“Comment” %}{% endic %}{% nic %}{{ detail.custom.extra_comment5 | multiline_table }}{% endnic %}
|
{% if forloop.last %}
{% endif %}
{% endfori %}
{% endstripnewlines %}
{% endif %}
{% stripnewlines %}
|----20%----
|-----2%----
|-----20%----
|----10%----:
|----10%----:
|----10%----:
|----10%----:
|----10%—:
|----5%----+
{% newline %}
|^ Total ^
|^ ^
|^ ^
|^ {{ $13 | currency_dc}}^
|^ {{ $14 | currency_dc}}^
|^ ^
|^ {{ $15 | currency_dc}}^
|^ ^
|^ ^
{% endstripnewlines %}
{% stripnewlines %}
{% newline %}
|----20%----
|-----2%----
|-----20%----
|----10%----:
|----10%----:
|----10%----:
|----10%----:
|----10%----
|----5%----:+
{% newline %}
|{% input custom.choice.template.6 as:select options:“Raw Materials|Work In Progress|Finshed Goods|Cattle|Sheep|Pigs” option_values:“1|2|3|4|5|6” default:1 %}
|
|{% input custom.tick.workings6 as:boolean %}
|
|
|
|
|
|
{% endstripnewlines %}
{% if custom.choice.template.6 == 6 and custom.tick.workings6 %}
{% assign $16 = 0 %}{% assign $17 = 0 %}{% assign $18 = 0 %}
{% assign stock_types6 = “Boars|Sows|Barren sows|Gilts|Store pigs|Porkers|Piglets” %}
{% stripnewlines %}
{% fori detail in current_account.details %}
{% if forloop.first %}
| {% t “Stock type” %}
|
| {% t “Stock description” %}
| {% t “Number” %}
| {% t “Market Value” %}
| {% t “60% of MV” %}
| {% t “Final amount” %}
| {% t “Notes” %}
|
{% newline %}
|----20%----
|-----2%----
|-----20%----
|----10%----:
|----10%----:
|----10%----:
|----10%----:
|----10%—:
|----5%----+
{% endif %}
{% newline %}
| {% input detail.custom.type6 as:select options:stock_types %} {% if custom.check.comments6 == true %}
{% input custom.comments6 placeholder:“Comments” as:text size:mini %}
{% endif %}
| {% input detail.custom.annex as:file_collection %}
| {% input detail.custom.description6 %}
| {% $13+input detail.custom.number6 %}
| {% $14+input detail.custom.marketvalue6 as:currency_dc %}
| 75%
{% assign total_stock6 = (detail.custom.number6*detail.custom.marketvalue6)*0.75 %}
| {%=$15+ total_stock6 | currency_dc %}
| {% ic %}{% input detail.custom.extra_comment6 placeholder:“Comment” %}{% endic %}{% nic %}{{ detail.custom.extra_comment6 | multiline_table }}{% endnic %}
|
{% if forloop.last %}
{% endif %}
{% endfori %}
{% endstripnewlines %}
{% endif %}
{% stripnewlines %}
|----20%----
|-----2%----
|-----20%----
|----10%----:
|----10%----:
|----10%----:
|----10%----:
|----10%—:
|----5%----+
{% newline %}
|^ Total ^
|^ ^
|^ ^
|^ {{ $16 | currency_dc}}^
|^ {{ $17 | currency_dc}}^
|^ ^
|^ {{ $18 | currency_dc}}^
|^ ^
|^ ^
{% endstripnewlines %}
{% stripnewlines %}
{% newline %}
|----20%----
|-----2%----
|-----20%----
|----10%----:
|----10%----:
|----10%----:
|----10%----:
|----10%----
|----5%----:+
{% newline %}
|
|
|
|
|
|
|
|
{% newline %}
|^Grand Total^
|^^
|^^
|^^
|^^
|^^
|^{{ $2+$6 | currency_dc}}{% unexplained $2+$6-current_account.value as:indicator %}^
|^^
|^^
{% endstripnewlines %}`