0
我在CakePHP中創建了一個可以生成引號的小腳本,但是引號項似乎在我的PDF上以非特定方式排序。按升序排序的最好方法是什麼?sortin cakephp/fpdf
查找下面我相關的代碼片段,將列出在我報價的所有項目:
foreach ($items as $item) {
$itemSubTotal = $item['quantity'] * $item['unit_price'];
$discount_rate=$item['discount_rate'];
$unit_price=$item['unit_price'];
$subTotal += $itemSubTotal;
$itemDiscount=$itemSubTotal*$discount_rate/100;
$discount+=$itemDiscount;
//$itemTax = $itemSubTotal * ($item['tax_rate']/100);
$itemTax = ($itemSubTotal - $itemDiscount) * ($item['tax_rate']/100);
$tax += $itemTax;
$itemSubTotal = $itemSubTotal*((100-$discount_rate)/100);
$itemSubTotal = number_format($itemSubTotal, 2, '.', ',');
$y+=5;
$pdf->setXY(5, $y);
$pdf->MultiCell(10, 5, $i++, 0, 'L');
$pdf->setXY(15, $y);
//$pdf->MultiCell(30, 5, $item['title'], 0, 'L');
$pdf->Cell(30, 5, $item['title'], 0, 2, 'L');
$pdf->setXY(45, $y);
//$pdf->MultiCell(80, 5, $item['details'], 0, 'L');
$pdf->Cell(30, 5, $item['details'], 0, 2, 'L');
$pdf->setXY(125, $y);
$pdf->MultiCell(20, 5, $item['quantity'], 0, 'R');
$pdf->setXY(145, $y);
$pdf->MultiCell(15, 5, number_format($unit_price, 2, '.', ','), 0, 'R');
$pdf->setXY(160, $y);
$pdf->MultiCell(20, 5, number_format($discount_rate, 2, '.', ','), 0, 'R');
$pdf->setXY(180, $y);
$pdf->MultiCell(25, 5, $itemSubTotal, 0, 'R');
}
一些專家的幫助將不勝感激,謝謝
非常感謝您的有益的見解,被欣賞 – Dan
很高興我能幫助丹 –