我对信用卡运行了一些复杂的计算,第一页是总金额的汇总。 我不想做的是通过所有条款来计算摘要,然后再次运行它们以呈现详细视图。 那么是否有可能定义自定义占位符,我可以替换后,我添加了详细视图? 或者你知道另一种方法来实现想要的结果而不用两次运行计算?在TCPDF中使用占位符
编辑:
我这是怎么呈现详细信息视图:
foreach($this->_creditNote->provisioningClient->customers as $customer)
{
$provisions = $customer->getProvisionsByBillingPeriodSum($this->_creditNote->billingPeriod);
if((count($provisions) >= 3 && $this->y > 230) || $this->y > 250)
{
$this->AddPage();
$this->SetFillColor(240);
$this->SetDrawColor(0);
$this->SetFont('Helvetica', 'B', 10);
$this->Cell(140, 6, 'Die Provisionen im Einzelnen', 'TB', 0, 'L', 1);
$this->Cell(30, 6, "Beträge", 'TB', 1, 'R', 1);
$this->SetXY(25, $this->y-11.5);
$this->SetTextColor(170,170,170);
$this->SetFont('Helvetica', '', 7);
$this->Cell(175, 6, 'Seite ' . $this->getAliasNumPage() . ' von ' . $this->getAliasNbPages(), '', 2, 'R');
$this->SetY($this->y+6);
$this->SetFont('Helvetica', '', 9);
$this->SetTextColor(0,0,0);
}
if(count($provisions) > 0)
{
$customerData = array();
$this->SetXY(20, $this->y+1);
$this->SetFont('Helvetica', 'B', 10);
$this->Cell(140, 0, $customer->contact->name . " (" . $customer->customerNumber . ")");
//add customer
$amount = 0;
$rows = array();
foreach($provisions as $provision)
{
$text = $provision->description;
$description = "";
if($provision->period != "onetime")
{
if($provision->isPartial($this->_creditNote->billingPeriod))
$text .= ", anteilig";
$description = $provision->periodName . ", " . $provision->getRuntime($this->_creditNote->billingPeriod);
}
if($description == "")
$description = null;
$temp = array($text, $provision->isPartial($this->_creditNote->billingPeriod) ? round($provision->getPartialAmount($this->_creditNote->billingPeriod)/100, 2) : $provision->amount/100, $description);
$amount += $temp[1];
$rows[] = $temp;
}
$this->Cell(30, 0, number_format($amount, 2, ",", ".") . " €", 0, 1, 'R');
foreach($rows as $row)
{
$this->SetXY(23, $this->y+1);
$this->SetFont('Helvetica', '', 8);
$this->Cell(137, 0, $row[0]);
$this->Cell(30, 0, number_format($row[1], 2, ",", ".") . " €", 0, 1, 'R');
if($row[2])
{
$this->SetXY(26, $this->y + 1);
$this->SetFont('Helvetica', 'I', 8);
$this->MultiCell(140, 0, $row[2], 0, 'L');
}
}
}
}
由于提前, 托比亚斯
结束我做了你的方式。我计算了总数,并循环了我存储它们以供以后在渲染时访问的条款。多谢! 虽然真的很伤心,但没有办法在tcpdf中使用自定义占位符:( –