251 lines
7.9 KiB
PHP
251 lines
7.9 KiB
PHP
|
|
<?php
|
||
|
|
|
||
|
|
$pdf->writeHTML('</table>'); // fix background-color overflowing FROM table ... why ? //
|
||
|
|
|
||
|
|
// Payment conditions.
|
||
|
|
//if (!empty($this->ecmpaymentcondition_text)) {
|
||
|
|
// $pdf->Ln(4);
|
||
|
|
// $pdf->SetFont('arialpl', '', 8);
|
||
|
|
// $pdf->MultiCell(0, 4, $this->ecmpaymentcondition_text, 0, 'L');
|
||
|
|
// $pdf->Ln();
|
||
|
|
//}
|
||
|
|
//
|
||
|
|
//if ($this->type == "correct") {
|
||
|
|
// $pdf->SetFont('arialpl', 'b', '12');
|
||
|
|
// $pdf->Ln(3);
|
||
|
|
// $pdf->MultiCell(0, 4, $mod_strings['LBL_PDF_DOCUMENT_CORRECT_DIFFERENCE'] . " " . format_number(abs(unformat_number($this->total) + unformat_number($this->ecminvoiceout->total))) . ' ' . $this->currency_symbol);
|
||
|
|
// $pdf->Ln(3);
|
||
|
|
//}
|
||
|
|
|
||
|
|
/*
|
||
|
|
if ($this->type == "correct") {
|
||
|
|
$qw = "SELECT price, ecmvat_value, quantity, ecminvoiceoutitem_id FROM ecminvoiceoutitems WHERE ecminvoiceout_id = '" . $this->id . "'";
|
||
|
|
$w = $GLOBALS['db']->query($qw);
|
||
|
|
|
||
|
|
while ($r = $GLOBALS['db']->fetchByAssoc($w)) {
|
||
|
|
$qrr = "SELECT price, quantity, ecmvat_value FROM ecminvoiceoutitems WHERE id = '" . $r['ecminvoiceoutitem_id'] . "'";
|
||
|
|
$rr_prepayment = $GLOBALS['db']->fetchByAssoc($GLOBALS['db']->query($qrr));
|
||
|
|
|
||
|
|
$total += $r['price'] * $r['quantity'] + round($r['price'] * $r['quantity'] * $r['ecmvat_value'] / 100, 2);
|
||
|
|
$total -= $rr_prepayment['price'] * $rr_prepayment['quantity'] + round($rr_prepayment['price'] * $rr_prepayment['quantity'] * $rr_prepayment['ecmvat_value'] / 100, 2);
|
||
|
|
}
|
||
|
|
|
||
|
|
$total -= $this->paid_val;
|
||
|
|
|
||
|
|
if ($total > 0) {
|
||
|
|
$string = $mod_strings['LBL_PDF_TO_PAID'];
|
||
|
|
} else {
|
||
|
|
$string = $mod_strings['LBL_PDF_TO_PAID_BACK'];
|
||
|
|
}
|
||
|
|
|
||
|
|
$total = format_number(abs($total));
|
||
|
|
|
||
|
|
$pdf->SetX(10);
|
||
|
|
|
||
|
|
$pdf->SetFont('arialpl', '', 8);
|
||
|
|
$pdf->Cell(50, 4, 'Razem do zapłaty:', 0, 0, 'L', 1);
|
||
|
|
$pdf->SetFont('arialpl', 'B', 8);
|
||
|
|
$pdf->Cell(30, 4, format_number($brutto) . ' ' . $this->currency_symbol, 0, 0, 'L', 1);
|
||
|
|
} else {
|
||
|
|
$total = 0;
|
||
|
|
|
||
|
|
$qw = "SELECT price, ecmvat_value, quantity, ecminvoiceoutitem_id FROM ecminvoiceoutitems WHERE ecminvoiceout_id = '" . $this->id . "'";
|
||
|
|
$w = $GLOBALS['db']->query($qw);
|
||
|
|
|
||
|
|
while ($r = $GLOBALS['db']->fetchByAssoc($w)) {
|
||
|
|
$total+=$r['price'] * $r['quantity'] + round($r['price'] * $r['quantity'] * $r['ecmvat_value'] / 100, 2);
|
||
|
|
}
|
||
|
|
|
||
|
|
$total-=floatval(str_replace(",", ".", str_replace(".", "", $this->discount)));
|
||
|
|
|
||
|
|
//$total -= $this->paid_val;
|
||
|
|
|
||
|
|
if ($total > 0) {
|
||
|
|
$string = $mod_strings['LBL_PDF_TO_PAID'];
|
||
|
|
} else {
|
||
|
|
$string = $mod_strings['LBL_PDF_TO_PAID_BACK'];
|
||
|
|
}
|
||
|
|
|
||
|
|
$total = format_number(abs($total));
|
||
|
|
|
||
|
|
$pdf->SetX(10);
|
||
|
|
|
||
|
|
$pdf->SetFont('arialpl', '', 8);
|
||
|
|
$pdf->Cell(50, 4, 'Razem do zapłaty:', 0, 0, 'L', 1);
|
||
|
|
$pdf->SetFont('arialpl', 'B', 8);
|
||
|
|
$pdf->Cell(30, 4, format_number($brutto) . ' ' . $this->currency_symbol, 0, 0, 'R', 1);
|
||
|
|
}
|
||
|
|
|
||
|
|
$pdf->Ln(4);
|
||
|
|
|
||
|
|
$pdf->SetFont('arialpl', '', 8);
|
||
|
|
|
||
|
|
if ($this->prepaid) {
|
||
|
|
// $pdf->Cell(50, 4, $mod_strings['LBL_PDF_PREPAID_DOCUMENTS'] . ':', 0, 0, 'L', 1);
|
||
|
|
// $pdf->Cell(30, 4, implode(', ', $rr_prepayment), 0, 0, 'L', 1);
|
||
|
|
//
|
||
|
|
// $pdf->Ln(4);
|
||
|
|
|
||
|
|
$pdf->SetX(10);
|
||
|
|
|
||
|
|
$pdf->Cell(50, 4, $mod_strings['LBL_PDF_PREPAID'] . ':', 0, 0, 'L', 1);
|
||
|
|
$pdf->SetFont('arialpl', 'B', 8);
|
||
|
|
$pdf->Cell(30, 4, format_number($this->prepaid) . ' ' . $this->currency_symbol, 0, 0, 'R', 1);
|
||
|
|
|
||
|
|
$pdf->Ln(4);
|
||
|
|
}
|
||
|
|
|
||
|
|
//$pdf->Ln(4);
|
||
|
|
|
||
|
|
$pdf->SetX(10);
|
||
|
|
$pdf->SetFont('arialpl', '', 8);
|
||
|
|
|
||
|
|
$pdf->Cell(50, 4, $mod_strings['LBL_PDF_PAID'] . ':', 0, 0, 'L', 1);
|
||
|
|
$pdf->SetFont('arialpl', 'B', 8);
|
||
|
|
$pdf->Cell(30, 4, format_number($this->paid_val) . ' ' . $this->currency_symbol, 0, 0, 'R', 1);
|
||
|
|
|
||
|
|
if($this->paid_val > 0) {
|
||
|
|
$pdf->SetX(100);
|
||
|
|
|
||
|
|
$pdf->SetFont('arialpl', '', 8);
|
||
|
|
$pdf->WriteHtml($app_list_strings['payment_method_dom'][$this->payment_method_paid]);
|
||
|
|
}
|
||
|
|
|
||
|
|
$pdf->Ln(4);
|
||
|
|
|
||
|
|
//if ($pdf->GetY() > 240) {
|
||
|
|
// $pdf->AddPage();
|
||
|
|
//}
|
||
|
|
|
||
|
|
$total -= ($this->paid_val);
|
||
|
|
|
||
|
|
if(($pleft = $brutto - $this->prepaid - $this->paid_val) > 0) {
|
||
|
|
$pdf->SetX(10);
|
||
|
|
$pdf->SetFont('arialpl', '', 8);
|
||
|
|
|
||
|
|
$pdf->Cell(50, 4, 'Pozostało do zapłaty:', 0, 0, 'L', 1);
|
||
|
|
$pdf->SetFont('arialpl', 'B', 8);
|
||
|
|
$pdf->Cell(30, 4, format_number($pleft) . ' ' . $this->currency_symbol, 0, 0, 'R', 1);
|
||
|
|
|
||
|
|
$pdf->SetX(100);
|
||
|
|
|
||
|
|
$pdf->SetFont('arialpl', '', 8);
|
||
|
|
$pdf->WriteHtml(sprintf($mod_strings['LBL_PDF_PAYMENT_METHOD_PATTERN'], $this->payment_date_d, $this->payment_date, $app_list_strings['payment_method_dom'][$this->payment_method]));
|
||
|
|
|
||
|
|
//$pdf->Ln(4);
|
||
|
|
|
||
|
|
//$pdf->SetX(90);
|
||
|
|
|
||
|
|
//$pdf->SetFont('arialpl', '', 8);
|
||
|
|
//$pdf->WriteHtml(sprintf($mod_strings2['LBL_PDF_PAYMENT_METHOD_PATTERN'], $this->payment_date_d, $this->payment_date, $this->payment_method));
|
||
|
|
|
||
|
|
//echo '<pre>' . var_export($cx, true) . '</pre>';
|
||
|
|
//echo '<pre>' . var_export($cy, true) . '</pre>'; exit;
|
||
|
|
}
|
||
|
|
*/
|
||
|
|
|
||
|
|
//$pdf->Ln(4);
|
||
|
|
|
||
|
|
//$pdf->SetFont('arialpl', '', 8);
|
||
|
|
//
|
||
|
|
//if (false == is_null($pc)) {
|
||
|
|
// $pdf->Cell(50, 4, $mod_strings['LBL_PDF_PAYMENT_METHOD'] . ':', 0, 0, 'L', 1);
|
||
|
|
// $pdf->Cell(50, 4, $pc->name ? : '-', 0, 0, 'L', 1);
|
||
|
|
//
|
||
|
|
// $pdf->Ln(4);
|
||
|
|
//}
|
||
|
|
//
|
||
|
|
//$pdf->Cell(50, 4, $mod_strings['LBL_PDF_PAYMENT_TERMIN'] . ':', 0, 0, 'L', 1);
|
||
|
|
//$pdf->Cell(50, 4, $this->payment_date ? : '-', 0, 0, 'L', 1);
|
||
|
|
//
|
||
|
|
//$pdf->Ln(4);
|
||
|
|
//
|
||
|
|
//$pdf->SetFont('arialpl', '', 8);
|
||
|
|
//$pdf->Cell(30, 4, "Słownie:", 0, 0, 'L', 1);
|
||
|
|
//$pdf->SetFont('arialpl', 'B', 8);
|
||
|
|
//
|
||
|
|
//if ($this->type == "correct") {
|
||
|
|
// $tot = format_number(abs((float) $total - array_sum($inv_value)));
|
||
|
|
// $tot = str_replace(".", "", $tot);
|
||
|
|
// //$tot=str_replace(",",".",$tot);
|
||
|
|
// $sl = $this->slowniePL($tot);
|
||
|
|
//} else {
|
||
|
|
// $tot = str_replace(".", "", str_replace("PLN", "", $total - array_sum($inv_value)));
|
||
|
|
// $sl = $this->slowniePL($tot);
|
||
|
|
//}
|
||
|
|
//
|
||
|
|
//if ($this->document_no == "FV 1421/10") {
|
||
|
|
// $sl = "one thousand one hundred six EUR 41/100";
|
||
|
|
//}
|
||
|
|
//
|
||
|
|
//$pdf->Cell(150, 4, $sl, 0, 0, 'L', 1);
|
||
|
|
|
||
|
|
//echo '<pre>' . var_export($this->currency_symbol, true); exit;
|
||
|
|
|
||
|
|
|
||
|
|
if ($this->currency_symbol != 'EUR') {
|
||
|
|
|
||
|
|
$r = $GLOBALS['db']->fetchByAssoc($GLOBALS['db']->query("SELECT conversion_rate FROM currencies WHERE id='6336d9a0-ee5f-52e3-7d0c-4e6f1472b2bf'"));
|
||
|
|
$this->currency_value = $r['conversion_rate'];
|
||
|
|
|
||
|
|
//if ($this->invoice_type != 'K') {
|
||
|
|
$pdf->SetFont('arialpl', '', 8);
|
||
|
|
|
||
|
|
//$pdf->Ln(4);
|
||
|
|
|
||
|
|
$pdf->SetX(11);
|
||
|
|
$pdf->WriteHtml(sprintf('Wartość przeliczona na PLN wg aktualnego kursu sprzedaży walut w banku Citi Handlowym: 1 EUR = %s %s.', format_number($this->currency_value, 4, 4), $this->currency_symbol));
|
||
|
|
|
||
|
|
$pdf->Ln(8);
|
||
|
|
}
|
||
|
|
|
||
|
|
$pdf->SetX(10);
|
||
|
|
$pdf->SetFont('arialpl', 'b', 8);
|
||
|
|
$pdf->Cell(25, 4, 'Metoda płatności: ', 0, 0, 'L', 1);
|
||
|
|
|
||
|
|
$pdf->SetFont('arialpl', '', 8);
|
||
|
|
//echo '<pre>' . var_export($this->payment_method, true);exit;
|
||
|
|
if($this->payment_method != '' && $this->payment_method != 'INNY') {
|
||
|
|
$pdf->Cell(50, 4, $app_list_strings['payment_method_dom'][$this->payment_method] . ($this->payment_deadline ? (', ' . $this->payment_deadline . ' dni') : '') , 0, 0, 'L', 1);
|
||
|
|
} else {
|
||
|
|
$pdf->Cell(50, 4, $this->payment_description, 0, 0, 'L', 1);
|
||
|
|
}
|
||
|
|
|
||
|
|
// Signatures.
|
||
|
|
$pdf->Ln(20);
|
||
|
|
|
||
|
|
$pdf->SetFont('arialpl', '', 7);
|
||
|
|
|
||
|
|
$pdf->SetX(12);
|
||
|
|
|
||
|
|
$pdf->Cell(95, 1, '...............................................................', 0, 0, 'L', 1);
|
||
|
|
$pdf->Cell(95, 1, '...............................................................', 0, 0, 'R', 1);
|
||
|
|
|
||
|
|
$pdf->Ln(4);
|
||
|
|
|
||
|
|
$pdf->SetX(10);
|
||
|
|
$pdf->Cell(43, 1, $mod_strings['LBL_PDF_OWNER_SIGNATURE'], 0, 0, 'C', 1);
|
||
|
|
|
||
|
|
$pdf->SetX(162);
|
||
|
|
$pdf->Cell(35, 1, $mod_strings['LBL_PDF_RECEIVER_SIGNATURE'], 0, 0, 'C', 1);
|
||
|
|
|
||
|
|
$pdf->Ln(4);
|
||
|
|
|
||
|
|
$pdf->SetX(10);
|
||
|
|
$pdf->Cell(43, 1, $this->setUser()->full_name, 0, 0, 'C', 1);
|
||
|
|
|
||
|
|
/*
|
||
|
|
// Footer text.
|
||
|
|
$pdf->Ln(18);
|
||
|
|
|
||
|
|
$pdf->SetFont('arialpl', '', 8);
|
||
|
|
$pdf->MultiCell(0, 4, $this->footer_text, 0, 'J');
|
||
|
|
*/
|
||
|
|
|
||
|
|
/*
|
||
|
|
// Ads text.
|
||
|
|
$pdf->Ln(6);
|
||
|
|
|
||
|
|
$pdf->SetFont('arialpl', 'B', 8);
|
||
|
|
$pdf->MultiCell(0, 4, $this->ads_text, 0, 'J');
|
||
|
|
*/
|