我對信用卡運行了一些複雜的計算,第一頁是總金額的彙總。 我不想做的是通過所有條款來計算摘要,然後再次運行它們以呈現詳細視圖。 那麼是否有可能定義自定義佔位符,我可以替換後,我添加了詳細視圖? 或者你知道另一種方法來實現想要的結果而不用兩次運行計算?在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中使用自定義佔位符:( –