[16.11.1] Added new themes for invoices, quotes, orders, receipts etc

@lubos It’s possible to have access to specific custom fields?

I need to show e.g. the “Time” custom field in specific place on the invoice. With templates was {{ custom_fields[‘Time’] }}.

Can we use something like: {{ custom_fields[3].text }} ?

List of variables?

You can loop through custom fields and skip all except the one that is called Time. Like this:

{% for field in custom_fields %}
  {% if field.label != 'Time' %}{% continue %}{% endif %}
  <div>{{ field.label }}</div>
  <div>{{ field.text }}</div>
{% endfor %}
1 Like

I have been giving this a good go, but I’m obviously missing something with liquid and manager’s custom fields integration. I’m not getting any result so any help would be appreciated.

My suppliers have 2 particular custom fields (BPay Code, BPay Reference).
My invoices have one custom field (test)

I am trying to print all the custom fields for the supplier on the invoice. I know from other posts they are called recipient now, at least in as far as the theme is concerned, and accrording also to the line immediately above where I’m trying to inject my code.

This is what I have:

            <table style="margin-bottom: 20px"><tr>
                <td>
                    <div style="font-weight: bold">{{ recipient.name }}</div>
                    <div>{{ recipient.address | newline_to_br }}</div>
                    <div>{{ recipient.email | newline_to_br }}</div>
                    {% for field in recipient.custom_fields %}
                        <div>{{ forloop.length }}</div>   <-- never enters for loop
                        <div>{{ field.label }}</div>   <--- biller info doesn't print
                        <div>{{ field.text }}</div>
                    {% endfor %}
                </td>
                <td style="padding-right: 20px; text-align: right">
                    {% for field in fields %}
                    <div style="font-weight: bold">{{ field.label }}</div>
                    <div style="margin-bottom: 10px">{{ field.text }}</div>
                    {% endfor %}
                    {% for field in custom_fields %}
                    <div style="font-weight: bold">{{ field.label }}</div>   <--- Test custom field does not print
                    <div style="margin-bottom: 10px">{{ field.text }}</div>   <--- Test custom text does not print
                    {% endfor %}
                </td>
            </tr></table>

on the line:

                    {% for field in recipient.custom_fields %}

I have tried:

recipient.custom_fields
recipient.fields
recipient.custom_fields[0]
custom_fields
fields

The only thing that results in any printed content is fields which takes the date, invoice and purchase number from the current invoice.

I can seem to print other recipient info including email but not custom fields.

I would like the suppliers payment details (which I have in custom fields in the suppliers records) to be printed on the purchase invoice so that I no longer need to refer to the paper document once entered. I don’t want to have to re-enter these details into each and ever invoice as they don’t change.

Notwithstanding that, my purchase invoice custom field (test) does not print either.

I also tried:

{% else %} 

in the for loop I can’t get the else clause to work as indicated here (fourth last code sample at the bottom of the page) in this code:

# items => []
{% for item in items %}
   {{ item.title }}
{% else %}
   There are no items!
{% endfor %}

Trying else results in:

DotLiquid.Exceptions.SyntaxException: for tag does not expect else tag
  at DotLiquid.Block.UnknownTag (System.String tag, System.String markup, System.Collections.Generic.List`1[T] tokens) [0x0003f] in <6f84214986e446799758da986789ce21>:0 
  at DotLiquid.Block.Parse (System.Collections.Generic.List`1[T] tokens) [0x000f9] in <6f84214986e446799758da986789ce21>:0

Are those custom fields configured to be shown on printed document?

Or do those custom fields show on any default theme at least?

I haven’t been able to get them to display in any theme on any page.

Their “show custom field as column” is checked, both for a supplier custom field and a purchase invoice custom field. neither of them are printing on a purchase invoice regardless of a custom or default theme.

I just noticed when you create custom field on Supplier level, there is no option to check Show on printed documents.

The checkbox has been added to the latest version (16.11.55) so edit those custom fields under Settings tab to make sure the checkbox is checked. Then look at your purchase invoice again.

:thumbsup:

that fixed the purchase invoice for the supplier details, but the purchase invoice custom fields aren’t appearing. the show on printed documents is not available to purchase order custom fields:


OK, check the latest version (16.11.56). Should be there now.

:thumbsup:

cheers!

yes it is.

Is there a way to determine where the custom field comes from? Because they’re specific I can loop through looking for the one I’m after, but I thought the supplier’s custom fields would be seperate to the purchase invoice custom fields. Is there a way to loop through one but not the other? As you can see they all appear under the local custom fields and not back referenced to the supplier/recipient (this one’s not a big deal, just thought I would ask)

The following code:

                <td>
                    <div style="font-weight: bold">{{ recipient.name }}</div>
                    <div>{{ recipient.address | newline_to_br }}</div>
                    <div style="font-weight: bold; font-size:1.5em">recipient</div>
                    {% for field in recipient.custom_fields %}
                        <div style="font-weight: bold">{{ field.label }}</div>
                        <div style="margin-bottom: 10px">{{ field.text }}</div>
                    {% endfor %}
                    <div style="font-weight: bold; font-size:1.5em">local</div>
                    {% for field in custom_fields %}
                        <div style="font-weight: bold">{{ field.label }}</div>
                        <div style="margin-bottom: 10px">{{ field.label }}</div>
                    {% endfor %}
                </td>

results in:

I would have thought the bpay codes would appear under recipient

The Business Identifier field is disappearing in ALL themes (Even in the old theme). Its NOT a custom field. Its a mandatory field on Tax Invoice as it contains your Tax Regn No. or VAT or GST numbers.

@Prasanna, this has been already fixed. Business identifier shows on all themes now.

1 Like

Very thanks for nice updates. But for my side I fix my Invoice format as per “Customize view templates”.
So If possible then please provide option to default view of “Customize view templates themes” OR “New updated Ready themes”
Please provide select option or default view option to view it.

And when I open my customize view templates there are “No option to Email” it directly from the software. So if possible, then please provide as previous version to Email it directly.
[By the way Inbuilt PDF generate function is working very fine And Have No issue to generate accurate Invoice PDF File.] Very thanks.

I cannot find the themes I created on Friday! Are they put somewhere else that i can not locate them?

@IKey, could you check again?

perfect, thanks

@lubos this is a really nice advancement:-P

I have a question though. I have some custom HTML that generates pay now buttons and snapScan codes for invoices, per invoice.

Would it be as simple as adding if {title=invoice} like elsewhere in this thread?

Once I figure it out, I can maybe plonk the code somewhere for people to use?

@procsum, what variables do you need to construct proper URL for snapScan? Only Balance due amount, right?

Hey @lubos

I use the reference and the total, as per below. This allows me to then track payment per invoice nicely.

Not 100% on my html though:-P

<a href="https://pos.snapscan.io/qr/#####?id={{ reference }}&amount={{ total | times:100 | round:0 }}">
  <img src="https://pos.snapscan.io/qr/#####.svg?id={{ reference }}&amount={{ total | times:100 | round:0 }}&snap_code_size=100">
</a>
<a href="https://www.payfast.co.za/eng/process?cmd=_paynow&amp;receiver=#######&amp;item_name={{ reference }}&amp;amount={{ total | round:0 }}">
  <img src="https://www.payfast.co.za/images/buttons/light-small-paynow.png" width="165" height="36" alt="Pay" title="Pay Now with PayFast" />
</a>
{% if title == 'Invoice' %}
    {% for total in table.totals %}
        {% if total.label == 'Total' %}
            {% assign total = total.text | remove:'.' %}
            <a href="https://pos.snapscan.io/qr/#####?id={{ reference }}&amount={{ total }}">
                <img src="https://pos.snapscan.io/qr/#####.svg?id={{ reference }}&amount={{ total }}&snap_code_size=100">
            </a>
        {% endif %}
    {% endfor %}
{% endif %}

Themes make it a bit more complicated because they are more generic.

  1. First you need to test whether theme is used within Invoice context. (line 1)
  2. Then you need to loop through table.totals variables to find the one which has Total label.
  3. Then assign amount to {{ total }} variable so you can use it in your HTML code like before.
1 Like

Hey,

Okay that looks great. I am having trouble figuring out how to get it to go to the bottom of the page, but I’m sure i’ll figure that out.

I found something weird though. The place where you assign total = total.text doesn’t stick. i.e. total is still total afterward, not total.text. However if I create a new variable, totalN, that then takes on the value of total.

Will carry on playing round. I like this.

* EDIT

I changed my code to the below, but this does not solve the positioning on the form. I will convert this to a table and include EFT details in the final version.

{% if title == 'Invoice' %}
  {% for total in table.totals %}
    {% if total.label == 'Total' %}
      {% assign totalN = total.text %}
        <a href="https://pos.snapscan.io/qr/######?id={{ reference }}&amount={{ totalN | remove:'.' | remove:'R'}}">
          <img src="https://pos.snapscan.io/qr/######.svg?id={{ reference }}&amount={{ totalN | remove:'.' | remove:'R'}}&snap_code_size=100">
        </a>
        <a href="https://www.payfast.co.za/eng/process?cmd=_paynow&amp;receiver=####&amp;item_name={{ reference }}&amp;amount={{ totalN | remove:'R'}}">
          <img src="https://www.payfast.co.za/images/buttons/light-small-paynow.png">
        </a>
      {% endif %}
   {% endfor %}
{% endif %}