scale cfdocument with table - coldfusion

I am trying to scale a cfdocument item using the scale attribute but it doesn't seem to use the number passed. The end goal is to get this cfdocument to scale to a single page when exported to pdf.
I tried using the method shown here: scale PDF to single page
It just kept looping until the scale value was negative and that threw an error.
I haven't been able to find anything online and am expecting that the scale attribute doesn't work with tables or something like that.
<cfdocument localUrl="no" format="PDF" scale="10" fontembed="false">
<cfoutput>
<body>
<cfdocumentitem type="header">
<img id="logo" style="display:inline-block;float:left;margin-bottom:5px;" src="/images/logo206x40.jpg">
<div style="font-size:20px;display:inline-block;float:right;"> Rubric: #qryRubric.rubric_name#</div>
<div style="width:100%;border-bottom:1px solid black;"></div>
</cfdocumentitem>
<div id="rubric1">
<div style="margin-left: 10%;">
<table class=" table table-hover blue-rubric table-bordered" cellspacing="1">
<thead>
<tr>
<th style="border-right:1px solid #fff"></th>
<th colspan="1000">Achievement Levels</th>
</tr>
<tr>
<th scope="col" class="rounded-firstcol" style="border-right:1px solid #fff;">Criteria Groups</th>
<th scope="col">1</th>
<th scope="col">2</th>
<th scope="col">3</th>
<th scope="col" class="rounded-lastcol">4</th>
</tr>
</thead>
<tbody>
<tr class="col_A">
<td>something</td>
<td>something</td>
<td>something</td>
<td>something</td>
<td>something</td>
</tr>
<tr class="col_A">
<td>something</td>
<td>something</td>
<td>something</td>
<td>something</td>
<td>something</td>
</tr>
</tbody>
<tfoot>
<tr></tr>
</tfoot>
</table>
</div>
</div>
<cfdocumentitem type="footer">
<div style="width:100%;border-top:1px solid black;font-size:10px;font:Arial;text-align:right;"> #cfdocument.currentpagenumber# of #cfdocument.totalpagecount#</div>
</cfdocumentitem>
</body>
</cfoutput>
I read somewhere that scale changes the size of thumbnails relative to the document or something like that, can anyone confirm or deny this? Any help would be appreciated, thanks.

I haven't used that attribute in quite some time, but if memory serves, I believe that value should be a percentage. For example scale="10%".

Related

How to Integrate Google Charts in HTML Template?

I have a Django Template with a table - result of an iteration.
I am trying to integrate Google Charts in my HTML page for every record, eg. Google Pie Chart.
https://developers-dot-devsite-v2-prod.appspot.com/chart/interactive/docs/gallery/piechart.html
It works, but the Google chart appears only once irrespective of number of iterations in a loop. And it appears on the same place
Is there a way to display different charts for every row in a loop, using Google Charts?
Is Google Charts the proper solution for such a task? Which simple visualization package could be a solution.
Thank you.
Have just got it.
The values in the fuction must be changed in every iteration
This is a template, which is responsible for charting.
<html>
<head>
<script type="text/javascript" src="https://www.gstatic.com/charts/loader.js"></script>
<script type="text/javascript">
// Load Charts and the corechart and barchart packages.
google.charts.load('current', {'packages':['corechart']});
google.charts.setOnLoadCallback(drawChart_Absatz);
function drawChart_Absatz() {
var data = new google.visualization.DataTable();
data.addColumn('string', 'Topping');
data.addColumn('number', 'Slices');
data.addRows([
['2016', {{c.abs_2016__sum}}],
['2017', {{c.abs_2017__sum}}],
['2018', {{c.abs_2018__sum}}],
['2019', {{c.abs_2019__sum}}],
]);
var barchart_options = {title:'Absatz, Stueck',
width:300,
height:200,
colors: ['#A52A2A', '#A52A2A', '#A52A2A', '#A52A2A'],
legend: 'none'};
var barchart = new google.visualization.BarChart(document.getElementById('a{{c.tmp_code}}'));
barchart.draw(data, barchart_options);
}
</script>
<body>
<!--Table and divs that hold the pie charts-->
<table class="columns">
<tr>
<td><div id="b{{a.tmp_code}}" style="border: 1px solid #ccc"></div></td>
</tr>
</table>
</body>
</html>
Please pay attention that the function must be renamed for every iteration.
This is a newly generated name of the draw() function: a{{c.tmp_code}}. I add a letter "a" in front of the function name, because I have three columns in my table. The draw() function for the second column gets "b", and the third one "c".
And here is the template, which prints the table with embedded charts after every row. I have actually 3 charts after every row, because I have three columns of data.
<div class="table-responsive-sm">
<table class="table table-sm" >
<thead>
<tr class="bg-primary text-white">
<th>Code</th>
<th>Bezeichnung</th>
<th class="bg-dark text-right scope="col">Abs.16</th>
<th class="bg-dark text-right scope="col">Abs.17</th>
<th class="bg-dark text-right scope="col">Abs.18</th>
<th class="bg-dark text-right scope="col">Abs.19</th>
<th class="text-right scope="col">N.erl.16</th>
<th class="text-right scope="col">N.erl.17</th>
<th class="text-right scope="col">N.erl.18</th>
<th class="text-right scope="col">N.erl.19</th>
<th class="bg-dark text-right scope="col">DB2 16</th>
<th class="bg-dark text-right scope="col">DB2 17</th>
<th class="bg-dark text-right scope="col">DB2 18</th>
<th class="bg-dark text-right scope="col">DB2 19</th>
</tr>
</thead>
{% for c in qset %}
<tr class="bg-light">
<td>{{c.tmp_code}}</td>
<td>{{c.tmp_descr}}</td>
<td class="bg-secondary text-white text-right">{{c.abs_2016__sum}}</td>
<td class="bg-secondary text-white text-right">{{c.abs_2017__sum}}</td>
<td class="bg-secondary text-white text-right">{{c.abs_2018__sum}}</td>
<td class="bg-secondary text-white text-right">{{c.abs_2019__sum}}</td>
<td class="text-right">{{c.nerl_2016__sum|floatformat}}</td>
<td class="text-right">{{c.nerl_2017__sum|floatformat}}</td>
<td class="text-right">{{c.nerl_2018__sum|floatformat}}</td>
<td class="text-right">{{c.nerl_2019__sum|floatformat}}</td>
<td class="bg-secondary text-white text-right">{{c.db2_2016__sum|floatformat}}</td>
<td class="bg-secondary text-white text-right">{{c.db2_2017__sum|floatformat}}</td>
<td class="bg-secondary text-white text-right">{{c.db2_2018__sum|floatformat}}</td>
<td class="bg-secondary text-white text-right">{{c.db2_2019__sum|floatformat}}</td>
</tr>
{% block pic1 %}
{% include 'auswertung/chart1.html' %}
{% endblock %}
{% endfor %}
<tr class="bg-primary text-white">
<td class="text-white"></td>
<td class="text-white">TOTAL:</td>
<td class="bg-dark text-right">{{gqset.abs_2016__gsum}}</td>
<td class="bg-dark text-right">{{gqset.abs_2017__gsum}}</td>
<td class="bg-dark text-right">{{gqset.abs_2018__gsum}}</td>
<td class="bg-dark text-right">{{gqset.abs_2019__gsum}}</td>
<td class="text-right text-white">{{gqset.nerl_2016__gsum|floatformat}}</td>
<td class="text-right text-white"">{{gqset.nerl_2017__gsum|floatformat}}</td>
<td class="text-right text-white"">{{gqset.nerl_2018__gsum|floatformat}}</td>
<td class="text-right text-white"">{{gqset.nerl_2019__gsum|floatformat}}</td>
<td class="bg-dark text-right">{{gqset.db2_2016__gsum|floatformat}}</td>
<td class="bg-dark text-right">{{gqset.db2_2017__gsum|floatformat}}</td>
<td class="bg-dark text-right">{{gqset.db2_2018__gsum|floatformat}}</td>
<td class="bg-dark text-right">{{gqset.db2_2019__gsum|floatformat}}</td>
</tr>
{% block pic2 %}
{% include 'auswertung/chart1.html' %}
{% endblock %}
</table>
</div>

Django creating table with hyperlink in cells

I want to display table with basic informations about products, and add hyperlink to cells in column "Product name" after clicking which you will be redirected to more detailed description of product with possibility to edtiing, deleting it etc.
<table class="table table-striped table-dark">
<thead>
<tr>
<th scope="col">Product name</th>
<th scope="col">Price</th>
</tr>
</thead>
<tbody>
{% for element in object %}
<tr>
<td><div class="btn active"><i class="fa fa-check"></i></div></td>
<td>
<a href="{% url 'prod_desc' pk:element.pk %}">
{{element.name|lower|capfirst}}
</a>
</td>
<td>
{{element.price}}
</td>
</tr>
{% endfor %}
</tbody>
</table>
How can I connect hiperlink with product name in table?
In case is there any walk-around solution ?
Is there any restriction about inserting hyperlink in html in general or it's a "Django thing" ?
The problem was in passing primary key of element I used ":" like in dictionary key:value instead of "="
<a href="{% url 'prod_desc' pk=element.pk %}">
{{element.name|lower|capfirst}}
</a>

Cypress Drag and drop test

I would like to test the sortable table with Cypress.io
I follow their page instruction: https://docs.cypress.io/api/commands/trigger.html#Mouse-Events
and it doesn't work...
First: it doesn't move the element
Second: when I see the step by step test on the left side, mouse down and mouse move are located in the same position...
my test
cy.get('.resource-filter-table')
.trigger('mousedown', {witch:1, pageX:188, pageY:196})
.trigger('mousemove', {witch:1, pageX:188, pageY:261})
.trigger('mouseup')
my html
<table class="table table-borderless resource-filter-table">
<thead>
<th scope="col"><input type="checkbox" checked=True class="resourceFilterElementAll" onchange="checkAllResources(this)"></th>
<th scope="col">Line</th>
</thead>
<tbody>
{% for linija in user_lines %}
<tr>
<th><input type="checkbox" checked=True class="resourceFilterElement" onchange="filterOfResources()" id="{{linija.pk}}"></th>
<th class="filter-list-element">{{ linija.line_name}} <i class="filter-list-icon material-icons">drag_handle</i></th>
</tr>
{% endfor %}
</tbody>
</table>

How to display product variant in report?

I have create a custom module for sale order report . In my case, articles have attributes that have more then one value for example color: red, blue. I want to display in the article description the value of the variants. I tried several code but I did not get the right result either it displays all the value of an attribute.Any idea for help please?
report_saleorder.xml
<?xml version="1.0" encoding="utf-8"?>
<openerp>
<data> ...
<table class="table table-condensed" style="margin-top:25px;">
<thead>
<tr>
<th>N°</th>
<th>REFERENCE</th>
<th>DESCRIPTION</th>
<th class="text-left">QTE</th>
<th class="text-left">PRIX UHT</th>
<th t-if="display_discount" class="text-left"
groups="sale.group_discount_per_so_line">
REMISE (%)
</th>
<th>TOTAL NET HT</th>
<th class="text-left">TVA</th>
</tr>
</thead>
<tbody class="sale_tbody">
<t t-foreach="doc.order_line" t-as="l">
<tr t-if="l.product_uom_qty">
<td>
<span t-esc="str(l_index+1)"/>
</td>
<td>
<span t-field="l.product_id.default_code"/>
</td>
<span t-field="value.name"/>
<td style="width:50%;">
[<span t-field="l.product_id.name"/>]
<br/>
<t t-foreach="l.product_id.attribute_line_ids" t-as="variant">
<!-- - -->
<strong><span t-field="variant.attribute_id"/>:
</strong>
<t t-foreach="variant.value_ids" t-as="value">
<!--<span t-field="variant.value_ids.name"/>-->
<span t-field="value.name"/>
<!--<br/>-->
</t>
</t>
<span t-field="l.product_id.description_sale"/>
<td class="text-left" style="width:7%;">
<span t-esc="'%.f'%(l.product_uom_qty)"/>
<!--<span groups="product.group_uom" t-field="l.product_uom"/>-->
</td>
<td class="text-left" style="width:12%;">
<span t-field="l.price_unit"/>
</td>
<td t-if="display_discount" class="text-left"
groups="sale.group_discount_per_so_line" style="width:11%;">
<span t-esc="'%.f'%(l.discount)"/>
</td>
<td style="width:15%;">
<span t-field="l.price_subtotal"/>
</td>
<td class="text-left" style="width:9%">
<span t-esc="', '.join(map(lambda x: (x.description or x.name), l.tax_id))"/>
</td>
</tr>
</t>
</tbody>
</table>
This question is similar and somehow a duplicate of:
(odoo10) how to add product attributes in pdf invoice
See how to do it there

TBODY templates in dart webui

I understand the restriction in dart webui and <template> items.
I.E: one can get around this restriction to use templates for tables thusly:
<table>
<tbody iterate="row in rows">
<tr iterate="cell in row">
<td> {{cell}} </td>
</tr>
</tbody>
</table>
However. How is one supposed to use templates when the table should have mutiple tbody sections (e.g: http://jsfiddle.net/umRJr/ )
I.E:
<table>
<thead><tr><td>title</td></tr></thead>
<template iterate="section in sections"> <!-- can't do this... :-( -->
<tbody iterate="row in section">
<tr iterate="cell in row">
<td> {{cell}} </td>
</tr>
</tbody>
</template>
</table>
Because we want something like
<table>
<thead> ... some headers here </thead>
<tbody> .. content1 .. </tbody>
<tbody> .. content2 .. </tbody>
...
<tbody> .. content N .. </tbody>
</table>
?
To officially answer, "soon". :) See https://github.com/dart-lang/html5lib/issues/46