Dobrý den,
v mé verzi presty vypadá kod trochu jinak,můžete se prosím podívat jak kod upravit?
Děkuji
Kód:
public function TaxTab(&$priceBreakDown)
{
$invoiceAddress = new Address(self::$order->id_address_invoice);
if (Configuration::get('VATNUMBER_MANAGEMENT') AND !empty($invoiceAddress->vat_number) AND $invoiceAddress->id_country != Configuration::get('VATNUMBER_COUNTRY'))
{
$this->Ln();
$this->Cell(30, 0, self::l('Exempt of VAT according section 259B of the General Tax Code.'), 0, 0, 'L');
return;
}
if (self::$order->total_paid == '0.00' OR (!(int)(Configuration::get('PS_TAX')) AND self::$order->total_products == self::$order->total_products_wt))
return ;
$carrier_tax_rate = (float)self::$order->carrier_tax_rate;
if (($priceBreakDown['totalsWithoutTax'] == $priceBreakDown['totalsWithTax']) AND (!$carrier_tax_rate OR $carrier_tax_rate == '0.00') AND (!self::$order->total_wrapping OR self::$order->total_wrapping == '0.00'))
return ;
// Displaying header tax
if ($priceBreakDown['hasEcotax'])
{
$header = array(self::l('Tax detail'), self::l('Tax'), self::l('Pre-Tax Total'), self::l('Total Tax'), self::l('Ecotax (Tax Incl.)'), self::l('Total with Tax'));
$w = array(60, 20, 40, 20, 30, 20);
}
else
{
$header = array(self::l('Tax detail'), self::l('Tax'), self::l('Pre-Tax Total'), self::l('Total Tax'), self::l('Total with Tax'));
$w = array(60, 30, 40, 30, 30);
}
$this->SetFont(self::fontname(), 'B', 8);
for($i = 0; $i < sizeof($header); $i++)
$this->Cell($w[$i], 5, $header[$i], 0, 0, 'R');
$this->Ln();
$this->SetFont(self::fontname(), '', 7);
$nb_tax = 0;
// Display product tax
foreach ($priceBreakDown['taxes'] AS $tax_rate => $vat)
{
if ($tax_rate != '0.00' AND $priceBreakDown['totalsProductsWithTax'][$tax_rate] != '0.00')
{
$nb_tax++;
$before = $this->GetY();
$lineSize = $this->GetY() - $before;
$this->SetXY($this->GetX(), $this->GetY() - $lineSize + 3);
$this->Cell($w[0], $lineSize, self::l('Products'), 0, 0, 'R');
$this->Cell($w[1], $lineSize, number_format($tax_rate, 3, ',', ' ').' %', 0, 0, 'R');
$this->Cell($w[2], $lineSize, (self::$orderSlip ? '-' : '').self::convertSign(Tools::displayPrice($priceBreakDown['totalsProductsWithoutTaxAndReduction'][$tax_rate], self::$currency, true)), 0, 0, 'R');
$this->Cell($w[3], $lineSize, (self::$orderSlip ? '-' : '').self::convertSign(Tools::displayPrice($priceBreakDown['totalsProductsWithTaxAndReduction'][$tax_rate] - $priceBreakDown['totalsProductsWithoutTaxAndReduction'][$tax_rate], self::$currency, true)), 0, 0, 'R');
if ($priceBreakDown['hasEcotax'])
$this->Cell($w[4], $lineSize, (self::$orderSlip ? '-' : '').self::convertSign(Tools::displayPrice($priceBreakDown['totalsEcotax'][$tax_rate], self::$currency, true)), 0, 0, 'R');
$this->Cell($w[$priceBreakDown['hasEcotax'] ? 5 : 4], $lineSize, (self::$orderSlip ? '-' : '').self::convertSign(Tools::displayPrice($priceBreakDown['totalsProductsWithTaxAndReduction'][$tax_rate], self::$currency, true)), 0, 0, 'R');
$this->Ln();
}
}
// Display carrier tax
if ($carrier_tax_rate AND $carrier_tax_rate != '0.00' AND ((self::$order->total_shipping != '0.00' AND !self::$orderSlip) OR (self::$orderSlip AND self::$orderSlip->shipping_cost)))
{
$nb_tax++;
$before = $this->GetY();
$lineSize = $this->GetY() - $before;
$this->SetXY($this->GetX(), $this->GetY() - $lineSize + 3);
$this->Cell($w[0], $lineSize, self::l('Carrier'), 0, 0, 'R');
$this->Cell($w[1], $lineSize, number_format($carrier_tax_rate, 3, ',', ' ').' %', 0, 0, 'R');
$this->Cell($w[2], $lineSize, (self::$orderSlip ? '-' : '').self::convertSign(Tools::displayPrice($priceBreakDown['shippingCostWithoutTax'], self::$currency, true)), 0, 0, 'R');
$this->Cell($w[3], $lineSize, (self::$orderSlip ? '-' : '').self::convertSign(Tools::displayPrice(self::$order->total_shipping - $priceBreakDown['shippingCostWithoutTax'], self::$currency, true)), 0, 0, 'R');
if ($priceBreakDown['hasEcotax'])
$this->Cell($w[4], $lineSize, (self::$orderSlip ? '-' : '').'', 0, 0, 'R');
$this->Cell($w[$priceBreakDown['hasEcotax'] ? 5 : 4], $lineSize, (self::$orderSlip ? '-' : '').self::convertSign(Tools::displayPrice(self::$order->total_shipping, self::$currency, true)), 0, 0, 'R');
$this->Ln();
}
// Display wrapping tax
if (self::$order->total_wrapping AND self::$order->total_wrapping != '0.00')
{
$tax = new Tax((int)(Configuration::get('PS_GIFT_WRAPPING_TAX')));
$taxRate = $tax->rate;