Esempio n. 1
0
function receipt_data($x, $y)
{
    global $receipt, $pdf;
    $font_size = 12;
    $yy = $y;
    $xmax = $x + 420;
    $pdf->line($x, $y, $xmax, $y);
    $y -= 8;
    text_align_center($x + 140, $y, 8, iconv("UTF-8", "ISO-8859-2", trans('For what')));
    text_align_center($x + 315, $y, 8, iconv("UTF-8", "ISO-8859-2", trans('Value')));
    text_align_center($x + 385, $y, 8, iconv("UTF-8", "ISO-8859-2", trans('Number')));
    $y -= 2;
    $pdf->line($x, $y, $xmax, $y);
    $y -= $font_size;
    $i = 0;
    if ($receipt['contents']) {
        foreach ($receipt['contents'] as $item) {
            $i++;
            text_align_left($x + 2, $y, $font_size - 2, '<b>' . $i . '.</b>');
            $y = text_wrap($x + 15, $y, 270, $font_size - 2, iconv("UTF-8", "ISO-8859-2", $item['description']), '');
            text_align_right($x + 345, $y + $font_size, $font_size - 2, iconv("UTF-8", "ISO-8859-2", moneyf($item['value'])));
        }
    }
    $y += $font_size / 2;
    $pdf->line($x, $y, $xmax, $y);
    $y -= $font_size;
    text_align_right($x + 275, $y - 6, $font_size - 2, '<b>' . iconv("UTF-8", "ISO-8859-2", trans('Total:')) . '</b>');
    text_align_right($x + 345, $y - 6, $font_size - 2, '<b>' . iconv("UTF-8", "ISO-8859-2", moneyf($receipt['total'])) . '</b>');
    $y -= text_align_center($x + 385, $y, 8, 'Symbole');
    $y -= text_align_center($x + 385, $y, 8, 'PL. KAS. Nr');
    $pdf->line($x, $yy, $x, $y);
    $pdf->line($x + 280, $yy, $x + 280, $y);
    $pdf->line($x + 350, $yy, $x + 350, $y);
    $pdf->line($xmax, $yy, $xmax, $y);
    $pdf->line($x, $y, $xmax, $y);
    $y -= 16;
    text_align_left($x + 2, $y, 8, iconv("UTF-8", "ISO-8859-2", trans('In words:')));
    $y = text_wrap($x + 40, $y, 300, $font_size - 2, iconv("UTF-8", "ISO-8859-2", trans('$a dollars $b cents', to_words(floor($receipt['total'])), to_words($receipt['totalg']))), '');
    $y -= 8;
    $y += $font_size / 2;
    $pdf->line($x, $yy, $x, $y);
    $pdf->line($x + 350, $yy, $x + 350, $y);
    $pdf->line($xmax, $yy, $xmax, $y);
    $pdf->line($x, $y, $xmax, $y);
    return $y;
}
Esempio n. 2
0
function new_invoice_data($x, $y, $width, $font_size, $margin)
{
    global $invoice, $pdf;
    $pdf->setlinestyle(0.5);
    $data = array();
    $cols = array();
    $params = array('fontSize' => $font_size, 'xPos' => $x, 'xOrientation' => 'right', 'rowGap' => 2, 'colGap' => 2, 'showHeadings' => 0, 'cols' => array());
    // tabelka glowna
    $cols['no'] = '<b>' . iconv("UTF-8", "ISO-8859-2//TRANSLIT", trans('No.')) . '</b>';
    $cols['name'] = '<b>' . iconv("UTF-8", "ISO-8859-2//TRANSLIT", trans('Name of Product, Commodity or Service:')) . '</b>';
    $cols['prodid'] = '<b>' . iconv("UTF-8", "ISO-8859-2//TRANSLIT", trans('Product ID:')) . '</b>';
    $cols['content'] = '<b>' . iconv("UTF-8", "ISO-8859-2//TRANSLIT", trans('Unit:')) . '</b>';
    $cols['count'] = '<b>' . iconv("UTF-8", "ISO-8859-2//TRANSLIT", trans('Amount:')) . '</b>';
    if (!empty($invoice['pdiscount']) || !empty($invoice['vdiscount'])) {
        $cols['discount'] = '<b>' . iconv("UTF-8", "ISO-8859-2//TRANSLIT", trans('Discount:')) . '</b>';
    }
    $cols['basevalue'] = '<b>' . iconv("UTF-8", "ISO-8859-2//TRANSLIT", trans('Unitary Net Value:')) . '</b>';
    $cols['totalbase'] = '<b>' . iconv("UTF-8", "ISO-8859-2//TRANSLIT", trans('Net Value:')) . '</b>';
    $cols['taxlabel'] = '<b>' . iconv("UTF-8", "ISO-8859-2//TRANSLIT", trans('Tax Rate:')) . '</b>';
    $cols['totaltax'] = '<b>' . iconv("UTF-8", "ISO-8859-2//TRANSLIT", trans('Tax Value:')) . '</b>';
    $cols['total'] = '<b>' . iconv("UTF-8", "ISO-8859-2//TRANSLIT", trans('Gross Value:')) . '</b>';
    foreach ($cols as $name => $text) {
        $params['cols'][$name] = array('justification' => 'center', 'width' => getWrapTextWidth($font_size, $text) + 2 * $margin + 2);
    }
    // tutaj jeszcze trzeba będzie sprawdzić jaką szerokość mają pola w tabelce później
    if ($invoice['content']) {
        foreach ($invoice['content'] as $item) {
            $tt_width['name'] = $pdf->getTextWidth($font_size, iconv("UTF-8", "ISO-8859-2//TRANSLIT", $item['description']));
            $tt_width['prodid'] = $pdf->getTextWidth($font_size, $item['prodid']);
            $tt_width['content'] = $pdf->getTextWidth($font_size, $item['content']);
            $tt_width['count'] = $pdf->getTextWidth($font_size, sprintf('%.2f', $item['count']));
            if (!empty($invoice['pdiscount'])) {
                $tt_width['discount'] = $pdf->getTextWidth($font_size, sprintf('%.2f %%', $item['pdiscount']));
            }
            if (!empty($invoice['vdiscount'])) {
                $tmp_width = $pdf->getTextWidth($font_size, iconv("UTF-8", "ISO-8859-2//TRANSLIT", moneyf($item['vdiscount'])));
                if ($tmp_width > $tt_width['discount']) {
                    $tt_width['discount'] = $tmp_width;
                }
            }
            $tt_width['basevalue'] = $pdf->getTextWidth($font_size, iconv("UTF-8", "ISO-8859-2//TRANSLIT", moneyf($item['basevalue']))) + 6;
            $tt_width['totalbase'] = $pdf->getTextWidth($font_size, iconv("UTF-8", "ISO-8859-2//TRANSLIT", moneyf($item['totalbase']))) + 6;
            $tt_width['taxlabel'] = $pdf->getTextWidth($font_size, iconv("UTF-8", "ISO-8859-2//TRANSLIT", $item['taxlabel'])) + 6;
            $tt_width['totaltax'] = $pdf->getTextWidth($font_size, iconv("UTF-8", "ISO-8859-2//TRANSLIT", moneyf($item['totaltax']))) + 6;
            $tt_width['total'] = $pdf->getTextWidth($font_size, iconv("UTF-8", "ISO-8859-2//TRANSLIT", moneyf($item['total']))) + 6;
            foreach ($tt_width as $name => $w) {
                if ($w + 2 * $margin + 2 > $params['cols'][$name]['width']) {
                    $params['cols'][$name]['width'] = $w + 2 * $margin + 2;
                }
            }
        }
    }
    if (isset($invoice['invoice']['content'])) {
        foreach ($invoice['invoice']['content'] as $item) {
            $tt_width['name'] = $pdf->getTextWidth($font_size, iconv("UTF-8", "ISO-8859-2//TRANSLIT", $item['description']));
            $tt_width['prodid'] = $pdf->getTextWidth($font_size, $item['prodid']);
            $tt_width['content'] = $pdf->getTextWidth($font_size, $item['content']);
            $tt_width['count'] = $pdf->getTextWidth($font_size, sprintf('%.2f', $item['count']));
            if (!empty($invoice['pdiscount'])) {
                $tt_width['discount'] = $pdf->getTextWidth($font_size, sprintf('%.2f %%', $item['pdiscount']));
            }
            if (!empty($invoice['vdiscount'])) {
                $tmp_width = $pdf->getTextWidth($font_size, iconv("UTF-8", "ISO-8859-2//TRANSLIT", moneyf($item['vdiscount'])));
                if ($tmp_width > $tt_width['discount']) {
                    $tt_width['discount'] = $tmp_width;
                }
            }
            $tt_width['basevalue'] = $pdf->getTextWidth($font_size, iconv("UTF-8", "ISO-8859-2//TRANSLIT", moneyf($item['basevalue']))) + 6;
            $tt_width['totalbase'] = $pdf->getTextWidth($font_size, iconv("UTF-8", "ISO-8859-2//TRANSLIT", moneyf($item['totalbase']))) + 6;
            $tt_width['taxlabel'] = $pdf->getTextWidth($font_size, iconv("UTF-8", "ISO-8859-2//TRANSLIT", $item['taxlabel'])) + 6;
            $tt_width['totaltax'] = $pdf->getTextWidth($font_size, iconv("UTF-8", "ISO-8859-2//TRANSLIT", moneyf($item['totaltax']))) + 6;
            $tt_width['total'] = $pdf->getTextWidth($font_size, iconv("UTF-8", "ISO-8859-2//TRANSLIT", moneyf($item['total']))) + 6;
            foreach ($tt_width as $name => $w) {
                if ($w + 2 * $margin + 2 > $params['cols'][$name]['width']) {
                    $params['cols'][$name]['width'] = $w + 2 * $margin + 2;
                }
            }
        }
    }
    // Kolumna 'name' bedzie miala rozmiar ustalany dynamicznie
    $sum = 0;
    foreach ($params['cols'] as $name => $col) {
        if ($name != 'name') {
            $sum += $col['width'];
        }
    }
    $params['cols']['name']['width'] = $width - $sum;
    // table header
    $pdf->ezSetY($y);
    $data = array(0 => $cols);
    $y = $pdf->ezTable($data, $cols, '', $params);
    $data = array();
    foreach ($cols as $name => $text) {
        switch ($name) {
            case 'no':
                $params['cols'][$name]['justification'] = 'center';
                break;
            case 'name':
                $params['cols'][$name]['justification'] = 'left';
                break;
            default:
                $params['cols'][$name]['justification'] = 'right';
                break;
        }
    }
    // size of taxes summary table
    $xx = $x;
    foreach ($params['cols'] as $name => $value) {
        if (in_array($name, array('no', 'name', 'prodid', 'content', 'count', 'discount', 'basevalue'))) {
            $xx += $params['cols'][$name]['width'];
        } else {
            $cols2[$name] = $params['cols'][$name];
        }
    }
    $data2 = array();
    $params2 = array('fontSize' => $font_size, 'xPos' => $xx, 'xOrientation' => 'right', 'rowGap' => 2, 'colGap' => 2, 'showHeadings' => 0, 'cols' => $cols2);
    if (isset($invoice['invoice'])) {
        // we have credit note, so first print corrected invoice data
        $y -= 20;
        check_page_length($y);
        $y = $y - text_align_left($x, $y, $font_size, '<b>' . iconv("UTF-8", "ISO-8859-2//TRANSLIT", trans('Was:')) . '</b>');
        $i = 0;
        if ($invoice['invoice']['content']) {
            foreach ($invoice['invoice']['content'] as $item) {
                $data[$i]['no'] = $i + 1;
                $data[$i]['name'] = iconv("UTF-8", "ISO-8859-2//TRANSLIT", $item['description']);
                $data[$i]['prodid'] = $item['prodid'];
                $data[$i]['content'] = $item['content'];
                $data[$i]['count'] = sprintf('%.2f', $item['count']);
                $item['pdiscount'] = floatval($item['pdiscount']);
                $item['vdiscount'] = floatval($item['vdiscount']);
                if (!empty($item['pdiscount'])) {
                    $data[$i]['discount'] = sprintf('%.2f %%', $item['pdiscount']);
                } elseif (!empty($item['vdiscount'])) {
                    $data[$i]['discount'] = iconv("UTF-8", "ISO-8859-2//TRANSLIT", moneyf($item['vdiscount']));
                }
                $data[$i]['basevalue'] = iconv("UTF-8", "ISO-8859-2//TRANSLIT", moneyf($item['basevalue']));
                $data[$i]['totalbase'] = iconv("UTF-8", "ISO-8859-2//TRANSLIT", moneyf($item['totalbase']));
                $data[$i]['taxlabel'] = iconv("UTF-8", "ISO-8859-2//TRANSLIT", $item['taxlabel']);
                $data[$i]['totaltax'] = iconv("UTF-8", "ISO-8859-2//TRANSLIT", moneyf($item['totaltax']));
                $data[$i]['total'] = iconv("UTF-8", "ISO-8859-2//TRANSLIT", moneyf($item['total']));
                $i++;
            }
        }
        $pdf->ezSetY($y);
        $y = $pdf->ezTable($data, $cols, '', $params);
        $data = array();
        $y -= 10;
        check_page_length($y);
        $data2[0]['totalbase'] = iconv("UTF-8", "ISO-8859-2//TRANSLIT", moneyf($invoice['invoice']['totalbase']));
        $data2[0]['taxlabel'] = "<b>x</b>";
        $data2[0]['totaltax'] = iconv("UTF-8", "ISO-8859-2//TRANSLIT", moneyf($invoice['invoice']['totaltax']));
        $data2[0]['total'] = iconv("UTF-8", "ISO-8859-2//TRANSLIT", moneyf($invoice['invoice']['total']));
        $pdf->ezSetY($y);
        $y = $pdf->ezTable($data2, NULL, '', $params2);
        $data2 = array();
        $fy = $y + $pdf->GetFontHeight($font_size) / 2;
        text_align_right($xx - 5, $fy, $font_size, '<b>' . iconv("UTF-8", "ISO-8859-2//TRANSLIT", trans('Total:')) . '</b>');
        check_page_length($y);
        $fy = $y - $margin - $pdf->GetFontHeight($font_size);
        text_align_right($xx - 5, $fy, $font_size, '<b>' . iconv("UTF-8", "ISO-8859-2//TRANSLIT", trans('in it:')) . '</b>');
        if ($invoice['invoice']['taxest']) {
            $i = 0;
            foreach ($invoice['invoice']['taxest'] as $item) {
                $data2[$i]['totalbase'] = iconv("UTF-8", "ISO-8859-2//TRANSLIT", moneyf($item['base']));
                $data2[$i]['taxlabel'] = iconv("UTF-8", "ISO-8859-2//TRANSLIT", $item['taxlabel']);
                $data2[$i]['totaltax'] = iconv("UTF-8", "ISO-8859-2//TRANSLIT", moneyf($item['tax']));
                $data2[$i]['total'] = iconv("UTF-8", "ISO-8859-2//TRANSLIT", moneyf($item['total']));
                $i++;
            }
            $pdf->ezSetY($y);
            $y = $pdf->ezTable($data2, NULL, '', $params2);
            $data2 = array();
        }
        $y -= 20;
        if ($invoice['reason'] != '') {
            check_page_length($y);
            $y = text_wrap($x, $y, $width, $font_size, '<b>' . iconv("UTF-8", "ISO-8859-2//TRANSLIT", trans('Reason:') . ' ' . $invoice['reason']) . '</b>', 'left');
            $y -= 10;
        }
        check_page_length($y);
        $y = $y - text_align_left($x, $y, $font_size, '<b>' . iconv("UTF-8", "ISO-8859-2//TRANSLIT", trans('Corrected to:')) . '</b>');
    }
    // pozycje faktury
    $i = 0;
    if (isset($invoice['content'])) {
        foreach ($invoice['content'] as $item) {
            $data[$i]['no'] = $i + 1;
            $data[$i]['name'] = iconv("UTF-8", "ISO-8859-2//TRANSLIT", $item['description']);
            $data[$i]['prodid'] = $item['prodid'];
            $data[$i]['content'] = $item['content'];
            $data[$i]['count'] = sprintf('%.2f', $item['count']);
            $item['pdiscount'] = floatval($item['pdiscount']);
            $item['vdiscount'] = floatval($item['vdiscount']);
            if (!empty($item['pdiscount'])) {
                $data[$i]['discount'] = sprintf('%.2f %%', $item['pdiscount']);
            } elseif (!empty($item['vdiscount'])) {
                $data[$i]['discount'] = iconv("UTF-8", "ISO-8859-2//TRANSLIT", moneyf($item['vdiscount']));
            }
            $data[$i]['basevalue'] = iconv("UTF-8", "ISO-8859-2//TRANSLIT", moneyf($item['basevalue']));
            $data[$i]['totalbase'] = iconv("UTF-8", "ISO-8859-2//TRANSLIT", moneyf($item['totalbase']));
            $data[$i]['taxlabel'] = iconv("UTF-8", "ISO-8859-2//TRANSLIT", $item['taxlabel']);
            $data[$i]['totaltax'] = iconv("UTF-8", "ISO-8859-2//TRANSLIT", moneyf($item['totaltax']));
            $data[$i]['total'] = iconv("UTF-8", "ISO-8859-2//TRANSLIT", moneyf($item['total']));
            $i++;
        }
    }
    $pdf->ezSetY($y);
    $y = $pdf->ezTable($data, $cols, '', $params);
    $y -= 10;
    check_page_length($y);
    // podsumowanie podatku
    $data2[0]['totalbase'] = iconv("UTF-8", "ISO-8859-2//TRANSLIT", moneyf($invoice['totalbase']));
    $data2[0]['taxlabel'] = "<b>x</b>";
    $data2[0]['totaltax'] = iconv("UTF-8", "ISO-8859-2//TRANSLIT", moneyf($invoice['totaltax']));
    $data2[0]['total'] = iconv("UTF-8", "ISO-8859-2//TRANSLIT", moneyf($invoice['total']));
    $pdf->ezSetY($y);
    $y = $pdf->ezTable($data2, NULL, '', $params2);
    $data2 = array();
    $fy = $y + $pdf->GetFontHeight($font_size) / 2;
    text_align_right($xx - 5, $fy, $font_size, '<b>' . iconv("UTF-8", "ISO-8859-2//TRANSLIT", trans('Total:')) . '</b>');
    $return[1] = $y;
    check_page_length($y);
    $fy = $y - $margin - $pdf->GetFontHeight($font_size);
    text_align_right($xx - 5, $fy, $font_size, '<b>' . iconv("UTF-8", "ISO-8859-2//TRANSLIT", trans('in it:')) . '</b>');
    if (isset($invoice['taxest'])) {
        $i = 0;
        foreach ($invoice['taxest'] as $item) {
            $data2[$i]['totalbase'] = iconv("UTF-8", "ISO-8859-2//TRANSLIT", moneyf($item['base']));
            $data2[$i]['taxlabel'] = iconv("UTF-8", "ISO-8859-2//TRANSLIT", $item['taxlabel']);
            $data2[$i]['totaltax'] = iconv("UTF-8", "ISO-8859-2//TRANSLIT", moneyf($item['tax']));
            $data2[$i]['total'] = iconv("UTF-8", "ISO-8859-2//TRANSLIT", moneyf($item['total']));
            $i++;
        }
        $pdf->ezSetY($y);
        $y = $pdf->ezTable($data2, NULL, '', $params2);
        $data2 = array();
    }
    if (isset($invoice['invoice'])) {
        $total = $invoice['total'] - $invoice['invoice']['total'];
        $totalbase = $invoice['totalbase'] - $invoice['invoice']['totalbase'];
        $totaltax = $invoice['totaltax'] - $invoice['invoice']['totaltax'];
        $y -= 10;
        $fy = $y - $margin - $pdf->GetFontHeight($font_size);
        text_align_right($xx - 5, $fy, $font_size, '<b>' . iconv("UTF-8", "ISO-8859-2//TRANSLIT", trans('Difference value:')) . '</b>');
        $data2[0]['totalbase'] = ($totalbase > 0 ? '+' : '') . iconv("UTF-8", "ISO-8859-2//TRANSLIT", moneyf($totalbase));
        $data2[0]['taxlabel'] = "<b>x</b>";
        $data2[0]['totaltax'] = ($totaltax > 0 ? '+' : '') . iconv("UTF-8", "ISO-8859-2//TRANSLIT", moneyf($totaltax));
        $data2[0]['total'] = ($total > 0 ? '+' : '') . iconv("UTF-8", "ISO-8859-2//TRANSLIT", moneyf($total));
        $pdf->ezSetY($y);
        $y = $pdf->ezTable($data2, NULL, '', $params2);
        $data2 = array();
    }
    $return[2] = $y;
    return $return;
}
Esempio n. 3
0
function invoice_data($x, $y, $width, $font_size, $margin)
{
    global $invoice, $pdf;
    $pdf->setlinestyle(0.5);
    $pdf->line($x, $y, $x + $width, $y);
    $t_data[1] = '<b>' . iconv("UTF-8", "ISO-8859-2", trans('No.')) . '</b>';
    $t_data[2] = '<b>' . iconv("UTF-8", "ISO-8859-2", trans('Name of Product, Commodity or Service:')) . '</b>';
    $t_data[3] = '<b>' . iconv("UTF-8", "ISO-8859-2", trans('Product ID:')) . '</b>';
    $t_data[4] = '<b>' . iconv("UTF-8", "ISO-8859-2", trans('Unit:')) . '</b>';
    $t_data[5] = '<b>' . iconv("UTF-8", "ISO-8859-2", trans('Amount:')) . '</b>';
    $t_data[6] = '<b>' . iconv("UTF-8", "ISO-8859-2", trans('Unitary Net Value:')) . '</b>';
    $t_data[7] = '<b>' . iconv("UTF-8", "ISO-8859-2", trans('Net Value:')) . '</b>';
    $t_data[8] = '<b>' . iconv("UTF-8", "ISO-8859-2", trans('Tax Rate:')) . '</b>';
    $t_data[9] = '<b>' . iconv("UTF-8", "ISO-8859-2", trans('Tax Value:')) . '</b>';
    $t_data[10] = '<b>' . iconv("UTF-8", "ISO-8859-2", trans('Gross Value:')) . '</b>';
    for ($i = 1; $i <= 10; $i++) {
        $t_justify[$i] = "left";
    }
    for ($i = 1; $i <= 10; $i++) {
        $t_width[$i] = $pdf->getTextWidth($font_size, $t_data[$i]) + 2 * $margin + 1;
    }
    // tutaj jeszcze trzeba b�dzie sprawdzi� jak� szeroko�� maj� pola w tabelce pu�niej
    if ($invoice['content']) {
        foreach ($invoice['content'] as $item) {
            $tt_width[2] = $pdf->getTextWidth($font_size, iconv("UTF-8", "ISO-8859-2", $item['description']));
            $tt_width[3] = $pdf->getTextWidth($font_size, $item['prodid']);
            $tt_width[4] = $pdf->getTextWidth($font_size, $item['content']);
            $tt_width[5] = $pdf->getTextWidth($font_size, $item['count']);
            $tt_width[6] = $pdf->getTextWidth($font_size, iconv("UTF-8", "ISO-8859-2", moneyf($item['basevalue'])));
            $tt_width[7] = $pdf->getTextWidth($font_size, iconv("UTF-8", "ISO-8859-2", moneyf($item['totalbase'])));
            $tt_width[8] = $pdf->getTextWidth($font_size, iconv("UTF-8", "ISO-8859-2", $item['taxlabel']));
            $tt_width[9] = $pdf->getTextWidth($font_size, iconv("UTF-8", "ISO-8859-2", moneyf($item['totaltax'])));
            $tt_width[10] = $pdf->getTextWidth($font_size, iconv("UTF-8", "ISO-8859-2", moneyf($item['total'])));
            for ($i = 2; $i <= 5; $i++) {
                if ($tt_width[$i] + 2 * margin + 2 > $t_width[$i]) {
                    $t_width[$i] = $tt_width[$i] + 2 * margin + 2;
                }
            }
        }
    }
    // Kolumna 2 b�dzie mia�a rozmiar ustalany dynamicznie
    $t_width[2] = $width - ($t_width[1] + $t_width[3] + $t_width[4] + $t_width[5] + $t_width[6] + $t_width[7] + $t_width[8] + $t_width[9] + $t_width[10] + 20 * $margin);
    $y = invoice_data_row($x, $y, $width, $font_size, $margin, $t_data, $t_width, $t_justify);
    $t_justify[10] = $t_justify[9] = $t_justify[8] = $t_justify[7] = $t_justify[6] = $t_justify[5] = "right";
    $lp = 1;
    if ($invoice['content']) {
        foreach ($invoice['content'] as $item) {
            $t_data[1] = $lp;
            $t_data[2] = iconv("UTF-8", "ISO-8859-2", $item['description']);
            $t_data[3] = $item['prodid'];
            $t_data[4] = $item['content'];
            $t_data[5] = $item['count'];
            $t_data[6] = iconv("UTF-8", "ISO-8859-2", moneyf($item['basevalue']));
            $t_data[7] = iconv("UTF-8", "ISO-8859-2", moneyf($item['totalbase']));
            $t_data[8] = iconv("UTF-8", "ISO-8859-2", $item['taxlabel']);
            $t_data[9] = iconv("UTF-8", "ISO-8859-2", moneyf($item['totaltax']));
            $t_data[10] = iconv("UTF-8", "ISO-8859-2", moneyf($item['total']));
            $lp++;
            $y = invoice_data_row($x, $y, $width, $font_size, $margin, $t_data, $t_width, $t_justify);
        }
    }
    $return[1] = $y;
    $x = $x + 12 * $margin + $t_width[1] + $t_width[2] + $t_width[3] + $t_width[4] + $t_width[5] + $t_width[6];
    $fy = $y - $margin - $pdf->GetFontHeight($font_size);
    text_align_right($x - $margin, $fy, $font_size, '<b>' . iconv("UTF-8", "ISO-8859-2", trans('Total:')) . '</b>');
    $t_data[7] = iconv("UTF-8", "ISO-8859-2", moneyf($invoice['totalbase']));
    $t_data[8] = "<b>x</b>";
    $t_data[9] = iconv("UTF-8", "ISO-8859-2", moneyf($invoice['totaltax']));
    $t_data[10] = iconv("UTF-8", "ISO-8859-2", moneyf($invoice['total']));
    $y = invoice_short_data_row($x, $y, $width, $font_size, $margin, $t_data, $t_width, $t_justify);
    $y = $y - 5;
    $fy = $y - $margin - $pdf->GetFontHeight($font_size);
    text_align_right($x - $margin, $fy, $font_size, '<b>' . iconv("UTF-8", "ISO-8859-2", trans('in it:')) . '</b>');
    $pdf->line($x, $y, $x + $t_width[7] + $t_width[8] + $t_width[9] + $t_width[10] + 8 * $margin, $y);
    if ($invoice['taxest']) {
        foreach ($invoice['taxest'] as $item) {
            $t_data[7] = iconv("UTF-8", "ISO-8859-2", moneyf($item['base']));
            $t_data[8] = iconv("UTF-8", "ISO-8859-2", $item['taxlabel']);
            $t_data[9] = iconv("UTF-8", "ISO-8859-2", moneyf($item['tax']));
            $t_data[10] = iconv("UTF-8", "ISO-8859-2", moneyf($item['total']));
            $y = invoice_short_data_row($x, $y, $width, $font_size, $margin, $t_data, $t_width, $t_justify);
        }
    }
    $return[2] = $y;
    return $return;
}