Note that there are some explanatory texts on larger screens.

plurals
  1. POUse placeholder in TCPDF
    primarykey
    data
    text
    <p>I run some complex calculations for a creditnote and the first page is a summary of the overall amount. What i do not want to do is run through all provisions to calculate the summary and afterwards run through them again to render the detail view. So is it possible to define custom placeholders that i can replace after i added the detail view? Or do you know another way to achieve the wanted result without running the calculations twice?</p> <p>Edit:</p> <p>This is how i render the detail view:</p> <pre><code> foreach($this-&gt;_creditNote-&gt;provisioningClient-&gt;customers as $customer) { $provisions = $customer-&gt;getProvisionsByBillingPeriodSum($this-&gt;_creditNote-&gt;billingPeriod); if((count($provisions) &gt;= 3 &amp;&amp; $this-&gt;y &gt; 230) || $this-&gt;y &gt; 250) { $this-&gt;AddPage(); $this-&gt;SetFillColor(240); $this-&gt;SetDrawColor(0); $this-&gt;SetFont('Helvetica', 'B', 10); $this-&gt;Cell(140, 6, 'Die Provisionen im Einzelnen', 'TB', 0, 'L', 1); $this-&gt;Cell(30, 6, "Beträge", 'TB', 1, 'R', 1); $this-&gt;SetXY(25, $this-&gt;y-11.5); $this-&gt;SetTextColor(170,170,170); $this-&gt;SetFont('Helvetica', '', 7); $this-&gt;Cell(175, 6, 'Seite ' . $this-&gt;getAliasNumPage() . ' von ' . $this-&gt;getAliasNbPages(), '', 2, 'R'); $this-&gt;SetY($this-&gt;y+6); $this-&gt;SetFont('Helvetica', '', 9); $this-&gt;SetTextColor(0,0,0); } if(count($provisions) &gt; 0) { $customerData = array(); $this-&gt;SetXY(20, $this-&gt;y+1); $this-&gt;SetFont('Helvetica', 'B', 10); $this-&gt;Cell(140, 0, $customer-&gt;contact-&gt;name . " (" . $customer-&gt;customerNumber . ")"); //add customer $amount = 0; $rows = array(); foreach($provisions as $provision) { $text = $provision-&gt;description; $description = ""; if($provision-&gt;period != "onetime") { if($provision-&gt;isPartial($this-&gt;_creditNote-&gt;billingPeriod)) $text .= ", anteilig"; $description = $provision-&gt;periodName . ", " . $provision-&gt;getRuntime($this-&gt;_creditNote-&gt;billingPeriod); } if($description == "") $description = null; $temp = array($text, $provision-&gt;isPartial($this-&gt;_creditNote-&gt;billingPeriod) ? round($provision-&gt;getPartialAmount($this-&gt;_creditNote-&gt;billingPeriod)/100, 2) : $provision-&gt;amount / 100, $description); $amount += $temp[1]; $rows[] = $temp; } $this-&gt;Cell(30, 0, number_format($amount, 2, ",", ".") . " €", 0, 1, 'R'); foreach($rows as $row) { $this-&gt;SetXY(23, $this-&gt;y+1); $this-&gt;SetFont('Helvetica', '', 8); $this-&gt;Cell(137, 0, $row[0]); $this-&gt;Cell(30, 0, number_format($row[1], 2, ",", ".") . " €", 0, 1, 'R'); if($row[2]) { $this-&gt;SetXY(26, $this-&gt;y + 1); $this-&gt;SetFont('Helvetica', 'I', 8); $this-&gt;MultiCell(140, 0, $row[2], 0, 'L'); } } } } </code></pre> <p>Thanks in advance, Tobias</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload