UtterAccess.com
X   Site Message
(Message will auto close in 2 seconds)

Welcome to UtterAccess! Please ( Login   or   Register )

Custom Search
 
   Reply to this topicStart new topic
> Help With Html And Adding Custom Fields    
 
   
wornout
post Jul 1 2019, 10:30 PM
Post#1



Posts: 1,305
Joined: 17-November 13
From: Orewa New Zealand


I am not sure if I am allowed to ask this on here because its not about excel or access but this is the only group I belong to
I use manager.io and I am trying to customise a template.
on the document that runs from the template I have 3 custom fields "Number1", "Number2", "Number4"
Some where in the below code I want Custom field Number4 = custom field Number1 + custom field Number2(which both have numbers entered in them)
I dont know where to put it or how to put it. It does have a section on custom fields and as you can see I did try to do it
CODE
<table style="padding: 30px">
    <thead>
        <tr>
            <td colspan="99">
                <table style="margin-bottom: 20px"><tr>
                    <td style="font-weight: bold; font-size: 32px">{{ title }}</td>
                    {% if business.logo != null %}<td style="text-align: right"><img src="{{ business.logo }}" style="max-height: 150px; max-width: 300px" /></td>{% endif %}
                </tr></table>
                
                <table style="margin-bottom: 20px"><tr>
                    <td>
                        <div style="font-weight: bold">{{ recipient.name }}</div>
                        <div>{{ recipient.address | newline_to_br }}</div>
                        <div>{{ recipient.identifier }}</div>
                    </td>
                    <td style="{% if business.address != null %}border-right-width: 1px; padding-right: 20px; {% endif %}text-align: right">
                        {% for field in fields %}
                        <div style="font-weight: bold">{{ field.label }}</div>
                        <div style="margin-bottom: 10px">{{ field.text }}</div>
                        {% endfor %}
                    </td>
                    {% if business.address != null %}
                    <td style="padding-left: 20px; width: 1px; white-space: nowrap">
                        <div style="font-weight: bold">{{ business.name }}</div>
                        <div>{{ business.address | newline_to_br }}</div>
                        {% for field in business.custom_fields %}
                        <div>{{ field.label }} {{ field.text }}</div>
                        {% endfor %}
                    </td>
                    {% endif %}
                </tr></table>

                <div style="font-size: 14px; font-weight: bold; margin-bottom: 20px">{{ description }}</div>
            </td>
        </tr>
        <tr>
            {% for column in table.columns %}
            <td style="font-weight: bold; padding: 5px 10px; text-align: {{ column.align }}; border-left-width: 1px; border-bottom-width: 1px; border-top-width: 1px{% if forloop.last == true %}; border-right-width: 1px{% endif %}{% if column.nowrap %}; width: 80px{% endif %}">{{ column.label }}</td>
            {% endfor %}
        </tr>
    </thead>
    <tbody>
        {% for row in table.rows %}
        <tr>
            {% for cell in row.cells %}
            <td style="padding: 5px 10px; text-align: {{ table.columns[forloop.index0].align }}; border-left-width: 1px{% if forloop.last == true %}; border-right-width: 1px{% endif %}{% if table.columns[forloop.index0].nowrap %}; white-space: nowrap; width: 80px{% endif %}">{{ cell.text | newline_to_br }}</td>
            {% endfor %}
        </tr>
        {% endfor %}
        <tr>
        {% for column in table.columns %}
            <td style="border-bottom-width: 1px; border-left-width: 1px{% if forloop.last == true %}; border-right-width: 1px{% endif %}">&nbsp;</td>
        {% endfor %}
        </tr>
        {% for total in table.totals %}
        <tr>
            <td colspan="{{ table.columns | size | minus:1 }}" style="padding: 5px 10px; text-align: right{% if total.emphasis == true %}; font-weight: bold{% endif %}">{{ total.label }}</td>
            <td style="border-left-width: 1px; white-space: nowrap; border-right-width: 1px; border-bottom-width: 1px; padding: 5px 10px; text-align: right{% if total.emphasis == true %}; font-weight: bold{% endif %}">{{ total.text }}</td>
        </tr>
        {% endfor %}

        {% for field in custom_fields %}
        <tr>
            <td colspan="99">
                <div style="font-weight: bold; padding-top: 20px">{{ field.label }}</div>
                <div>{{ field.text | newline_to_br }}</div>
        
<div>{{custom_fields["Number4"]= Total.custom_fields["Number1"] | plus: custom_fields["Number2"] }}</div> ' This is where I tried to do it but it did not work it just labelled every custom field with one of the numbers I had entered in it


            </td>
        </tr>
        {% endfor %}

        <tr>
            <td colspan="99">
                {% if emphasis.text != null and emphasis.positive %}
                <div style="text-align: center; margin-top: 40px"><span style="color: #006400; border-width: 5px; border-color: #006400; padding: 10px; font-size: 20px">{{ emphasis.text | upcase }}</span></div>
                {% endif %}

                {% if emphasis.text != null and emphasis.negative %}
                <div style="text-align: center; margin-top: 40px"><span style="color: #FF0000; border-width: 5px; border-color: #FF0000; padding: 10px; font-size: 20px">{{ emphasis.text | upcase }}</span></div>
                {% endif %}
            </td>
        </tr>
    </tbody>
</table>

This post has been edited by wornout: Jul 1 2019, 10:34 PM
Go to the top of the page
 
cheekybuddha
post Jul 2 2019, 03:31 AM
Post#2


UtterAccess VIP
Posts: 11,419
Joined: 6-December 03
From: Telegraph Hill


What do you want to see? Do you want the calculation to be performed?

If:
custom_fields["Number1"] = 2
custom_fields["Number2"] = 3
custom_fields["Number4"] = 5

would you want to see:
5 = 5
5 = 3 + 2
True

???

Also, you reference one field as part of 'Total':
Total.custom_fields["Number1"]

Is that correct?

--------------------


Regards,

David Marten
Go to the top of the page
 
GroverParkGeorge
post Jul 2 2019, 09:38 AM
Post#3


UA Admin
Posts: 35,306
Joined: 20-June 02
From: Newcastle, WA


Yes, we're happy to address questions of all types, although our main competencies probably are the Office applications, principally Access.

That said, I'm having trouble following your html. Specifically, the use of curly brackets. (my experience is limited to C# and basic html). Can you expand on which language you use? Thanks.

--------------------
My Real Name Is George. Grover Park Consulting is where I do business.
How to Ask a Good Question
Beginning SQL Server
Go to the top of the page
 
cheekybuddha
post Jul 2 2019, 09:44 AM
Post#4


UtterAccess VIP
Posts: 11,419
Joined: 6-December 03
From: Telegraph Hill


@George,

This is based on an accounting package called Manager.io

It uses html to design invoices/reports etc, but with the additional ability to use variables which are pre-processed in a similar way to php (ie you can mix the non-standard variables in with the html and the program will parse it out at runtime)

hth,

d

--------------------


Regards,

David Marten
Go to the top of the page
 
GroverParkGeorge
post Jul 2 2019, 09:58 AM
Post#5


UA Admin
Posts: 35,306
Joined: 20-June 02
From: Newcastle, WA


Thanks. It's an accounting package with its own php-like language then?

--------------------
My Real Name Is George. Grover Park Consulting is where I do business.
How to Ask a Good Question
Beginning SQL Server
Go to the top of the page
 
cheekybuddha
post Jul 2 2019, 11:47 AM
Post#6


UtterAccess VIP
Posts: 11,419
Joined: 6-December 03
From: Telegraph Hill


Nothing so fancy really.

You can edit templates in html, and add variables (that you have defined via the interface) in the curly brackets, and limited functions within {% ... %}.

The php-like (perhaps php itself) stuff happens under the hood - you can't write your own. It's really just templating/variable replacement.

I looked at Manager.io a while back and liked it (which is why I know what wornout is on about!). It is quite simple with a clean interface, but my wife didn't like it so we didn't go forward with it. frown.gif

It has a desktop and an online version. I think it's free unless you want multi-user or hosted solutions.

I'm beginning to sound like an advert now blush.gif which is not my intent, just trying to provide info! [Please remove the link if I have breached the forum rules].

thumbup.gif

d


--------------------


Regards,

David Marten
Go to the top of the page
 
GroverParkGeorge
post Jul 2 2019, 11:50 AM
Post#7


UA Admin
Posts: 35,306
Joined: 20-June 02
From: Newcastle, WA


No problem. We tend to be too insular and knowing about additional resources is useful.

--------------------
My Real Name Is George. Grover Park Consulting is where I do business.
How to Ask a Good Question
Beginning SQL Server
Go to the top of the page
 
Director29
post Jul 3 2019, 02:53 AM
Post#8



Posts: 1
Joined: 3-July 19



Very interesting article
Go to the top of the page
 
wornout
post Jul 7 2019, 07:44 PM
Post#9



Posts: 1,305
Joined: 17-November 13
From: Orewa New Zealand


cheekybuddha you are correct, I use manager for all my clients it has come a long way in the 5 years I have been using it. I have got through what I was trying to do but now
I am trying to do something I dont think is possible
I am using this as a payslip(and doing my own custom theme) and on the payslip is a set field call Rate which every time you fill out a payslip you have to manually enter the rate.Which times qty by rate to get total gross pay
So I have put a custom field in Called PerHour it is put in the employee custom fields and comes through on the payslip.
I would like to get the PerHour amount upto the rate. The reason I dont think possible is the calculation is not done from this custom theme I dont think unless I can do it another way like on field"Rate" click or something
I have no idea about HTML (Liquid) but below is my code so far
I did try this in all sorts of places but it did not work <div>{{ "Rate".Label.text = Custom.Label."Perhour" }}</div>

CODE
<table style="padding: 30px">
    <thead>
        <tr>
            <td colspan="99">
                <table style="margin-bottom: 20px"><tr>
                    <td style="font-weight: bold; font-size: 32px">{{ title }}</td>
                    {% if business.logo != null %}<td style="text-align: right"><img src="{{ business.logo }}" style="max-height: 150px; max-width: 300px" /></td>{% endif %}
                </tr></table>
                
                <table style="margin-bottom: 20px"><tr>
                    <td>
                        <div style="font-weight: bold">{{ recipient.name }}</div>
                        <div>{{ recipient.address | newline_to_br }}</div>
                        <div>{{ recipient.identifier }}</div>
                       <div>{{  "TaxType".Label.text = "Tax Type" }}</div>
                      <div>{{  custom_fields["TaxType"]   }}</div>
                        
                        
                    
                     </td>
                    <td style="{% if business.address != null %}border-right-width: 1px; padding-right: 20px; {% endif %}text-align: right">
                        {% for field in fields %}
                        <div style="font-weight: bold">{{ field.label }}</div>
                        <div style="margin-bottom: 10px">{{ field.text }}</div>
                        {% endfor %}
                    </td>
                    {% if business.address != null %}
                    <td style="padding-left: 20px; width: 1px; white-space: nowrap">
                        <div style="font-weight: bold">{{ business.name }}</div>
                        <div>{{ business.address | newline_to_br }}</div>
                        {% for field in business.custom_fields %}
                        <div>{{ field.label }} {{ field.text }}</div>
                        {% endfor %}
                    </td>
                    {% endif %}
                </tr></table>

         <div style="font-size: 14px; font-weight: bold; margin-bottom: 20px">{{ description }}</div>
            </td>
        </tr>
        <tr>
            {% for column in table.columns %}
            <td style="font-weight: bold; padding: 5px 10px; text-align: {{ column.align }}; border-left-width: 1px; border-bottom-width: 1px; border-top-width: 1px{% if forloop.last == true %}; border-right-width: 1px{% endif %}{% if column.nowrap %}; width: 80px{% endif %}">{{ column.label }}</td>
            {% endfor %}
        </tr>
    </thead>
    <tbody>
        {% for row in table.rows %}
        <tr>
            {% for cell in row.cells %}
            <td style="padding: 5px 10px; text-align: {{ table.columns[forloop.index0].align }}; border-left-width: 1px{% if forloop.last == true %}; border-right-width: 1px{% endif %}{% if table.columns[forloop.index0].nowrap %}; white-space: nowrap; width: 80px{% endif %}">{{ cell.text | newline_to_br }}</td>
            {% endfor %}
            
        </tr>
        {% endfor %}
        <tr>
        {% for column in table.columns %}
            <td style="border-bottom-width: 1px; border-left-width: 1px{% if forloop.last == true %}; border-right-width: 1px{% endif %}">&nbsp;</td>
            
        {% endfor %}
        </tr>
        {% for total in table.totals %}
        {% if (total.label == 'ESCT') %}{% continue %}{% endif %}
      



      
        <tr>
            <td colspan="{{ table.columns | size | minus:1 }}" style="padding: 5px 10px; text-align: right{% if total.emphasis == true %}; font-weight: bold{% endif %}">{{ total.label }}</td>
            <td style="border-left-width: 1px; white-space: nowrap; border-right-width: 1px; border-bottom-width: 1px; padding: 5px 10px; text-align: right{% if total.emphasis == true %}; font-weight: bold{% endif %}">{{ total.text }}</td>
        </tr>
         {% endfor %}

         {% for field in custom_fields %}
         {% if (field.label == 'TaxType') %}{% continue %}{% endif %}
                {% if (field.label == 'Number1') %}{% continue %}{% endif %}
        {% if (field.label == 'Number2') %}{% continue %}{% endif %}
        {% if (field.label == 'Number5') %}{% continue %}{% endif %}
      
        <tr>
            <td colspan="99">
                

<div style="font-weight: bold; padding-top: 20px">{{ field.label }}</div>

                <div>{{ field.text | newline_to_br }}</div>
  <td>
      
                        
                  
                  
                    </td>        


            </td>
      
    
        {% endfor %}

      </tr>
            <td colspan="99">
                {% if emphasis.text != null and emphasis.positive %}
                <div style="text-align: center; margin-top: 40px"><span style="color: #006400; border-width: 5px; border-color: #006400; padding: 10px; font-size: 20px">{{ emphasis.text | upcase }}</span></div>
                {% endif %}
<div style="font-weight: bold; padding-top: 20px">Number4</div>
        <div>{{  custom_fields["Number1"] | plus: custom_fields["Number2"] }}</div>
                {% if emphasis.text != null and emphasis.negative %}
                <div style="text-align: center; margin-top: 40px"><span style="color: #FF0000; border-width: 5px; border-color: #FF0000; padding: 10px; font-size: 20px">{{ emphasis.text | upcase }}</span></div>
              
                {% endif %}
              
            </td>
        </tr>
    </tbody>
</table>

This post has been edited by wornout: Jul 7 2019, 07:47 PM
Go to the top of the page
 


Custom Search


RSSSearch   Top   Lo-Fi    17th July 2019 - 09:35 PM