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->ecmlanguage!='en_us'){ $pdf->writeHTML(''); // fix background-color overflowing FROM table ... why ? // if ($this->type == "correct") { $brutto -= $this->paid_val; if ($brutto > 0) { $string = 'Do zapłaty:'; } else { $string = 'Do zwrotu:'; } $tmp = $brutto; $brutto = format_number(abs($brutto)); $pdf->SetX(10); $pdf->SetFont('arialpl', '', '8'); $pdf->Cell(50, 4, $string, 0, 0, 'L', 1); $pdf->SetFont('arialpl', 'B', '8'); $pdf->Cell(30, 4, $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); } if (!isset($tmp) || $tmp > 0) { $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); //var_export($numberLength); //var_export($fNumber); //var_export(str_pad(format_number($this->paid_val), $numberLength, '_', STR_PAD_LEFT)); //var_export(implode(array_fill(0, 10 - 5, ' ')) . format_number($pleft));exit; $pleft = $brutto - $this->prepaid - $this->paid_val; $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 < 0) ? 0 : $pleft) . ' ' . $this->currency_symbol, 0, 0, 'R', 1); $pdf->writeHTML(''); } //$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 '
' . var_export(format_number('9.9999', 4, 4), true) . ''; exit;
//echo '' . var_export(gettype((double)$this->currency_value_nbp), true) . ''; exit; if ($this->currency_value_nbp > 1 && $this->currency_symbol != 'EUR') { $pdf->Ln(8); $pdf->SetX(10); $pdf->WriteHtml(sprintf('Ceny wyliczono wg kursu sprzedaży walut banku Citi Handlowego z dn. %s: 1 %s = %s %s', date('d.m.Y'), 'EUR', format_number($this->currency_value_nbp, 4, 4), $this->currency_symbol)); //$pdf->Cell(50, 4, 'Ceny wyliczono wg kursu sprzedaży walut banku Citi Handlowego z dn. wystawienia faktury: ' , 0, 0, 'L', 1); // $mod_strings['LBL_CURRENCY_VALUE'] . ':' //$pdf->Cell(30, 4, '1 ' . $this->currency_symbol . ' = ' . format_number($this->currency_value_nbp, 4, 4) . ' zł', 0, 0, 'R', 1); } //echo '
' . var_export($calc, true) . ''; exit; //$cvatpln = ''; if($this->currency_value_nbp > 1 && $this->currency_symbol != 'PLN') { $pdf->Ln(8); $pdf->Cell(85, 1, "Kurs 1 EUR = " . format_number($this->currency_value_nbp, 4, 4) . ' PLN', 0, 0, 'L', 1); $pdf->Ln(4); $pdf->Cell(85, 1, "Wartość VAT = " . format_number($cVatPln) . ' PLN', 0, 0, 'L', 1); // $pdf->Ln(8); // $pdf->SetX(10); // $pdf->WriteHtml(sprintf('Wartość VAT: %s PLN', format_number($cVatPln))); } $pdf->Ln(18); $pdf->SetX(10); $pdf->SetFont('arialpl', '', '7'); $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(1); //$pdf->SetFont('arialpl', '', '8'); //$pdf->MultiCell(0, 4, $this->footer_text, 0, 'J'); //header text $pdf->Ln(5); $pdf->SetFont('arialpl', 'B', '8'); $pdf->MultiCell(0, 4, $this->ads_text, 0, 'J'); /* error_reporting(E_ALL); ini_set('display_errors', 1); $pdf->DeletePage(6);exit; */ } else { //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); } */ $pdf->writeHTML(''); // fix background-color overflowing from table ... why ? // $pdf->Ln(2); $pdf->SetFont('arialpl', '', '8'); $pdf->Cell(50, 4, 'Zapłacono/Paid:', 0, 0, 'L', 1); $pdf->Cell(50, 4, format_number($this->paid_val) . ' ' . $this->currency_symbol, 0, 0, 'L', 1); $pdf->Ln(4); if ($pdf->GetY() > 250) $pdf->AddPage(); if ($this->type == "correct") { $pdf->SetFont('arialpl', '', '8'); $w = $GLOBALS['db']->query("select price,ecmvat_value,quantity,ecminvoiceoutitem_id from ecminvoiceoutitems where ecminvoiceout_id='" . $this->id . "'"); while ($r = $GLOBALS['db']->fetchByAssoc($w)) { $total+=$r['price'] * $r['quantity'] + round($r['price'] * $r['quantity'] * $r['ecmvat_value'] / 100, 2); $rr = $GLOBALS['db']->fetchByAssoc($GLOBALS['db']->query("select price,quantity,ecmvat_value from ecminvoiceoutitems where id='" . $r['ecminvoiceoutitem_id'] . "'")); $total-=$rr['price'] * $rr['quantity'] + round($rr['price'] * $rr['quantity'] * $rr['ecmvat_value'] / 100, 2); } //if($total>0)$string=$mod_strings['LBL_PDF_TO_PAID']; //else $string=$mod_strings['LBL_PDF_TO_PAID_BACK']; $string = "Pozostało do zapłaty/To pay:"; $pdf->Cell(50, 4, $string, 0, 0, 'L', 1); $pdf->SetFont('arialpl', 'B', '8'); $pdf->Cell(50, 4, format_number(abs($total)) . ' ' . $this->currency_symbol, 0, 0, 'L', 1); } else { $total = 0; $pdf->SetFont('arialpl', '', '8'); $w = $GLOBALS['db']->query("select price,ecmvat_value,quantity,ecminvoiceoutitem_id from ecminvoiceoutitems where ecminvoiceout_id='" . $this->id . "'"); 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 = format_number($total); $pdf->Cell(50, 4, "Pozostało do zapłaty/To pay: ", 0, 0, 'L', 1); $pdf->SetFont('arialpl', 'B', '8'); $pdf->Cell(50, 4, format_number($sum_total-$this->paid_val) . ' ' . $this->currency_symbol, 0, 0, 'L', 1); } //$pdf->Ln(8); $pdf->SetFont('arialpl', '', '8'); /* $paymentCondition = new EcmPaymentCondition(); $paymentCondition->retrieve($this->ecmpaymentcondition_id); $pdf->Cell(50, 4, 'Metoda płątności/Payment method:', 0, 0, 'L', 1); $pdf->Cell(50, 4, $this->payment_method ? : '-', 0, 0, 'L', 1); $pdf->Ln(4); $pdf->Cell(50, 4, 'Termin płatności/Payment date:', 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)); $tot = str_replace(".", "", $tot); //$tot=str_replace(",",".",$tot); $sl = $this->slowniePL($tot); } else { $tot = str_replace(".", "", str_replace("PLN", "", $total)); $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); $pdf->Ln(8); //$pdf->Cell(50, 4, 'Kurs waluty/Rate of exchange', 0, 0, 'L', 1); //$pdf->Cell(50, 4, '1 '.$this->currency_symbol.' = ' . format_number($this->currency_value_nbp ? : 1, 4, 4) . ' PLN', 0, 0, 'L', 1); // $pdf->Cell(50, 4, format_number($this->currency_value_nbp ? : 1, 4, 4), 0, 0, 'L', 1); $pdf->Ln(10); $pdf->Ln(10);$pdf->Ln(10); $pdf->SetFont('arialpl', '', '7'); $pdf->Cell(85, 1, "...............................................................", 0, 0, 'L', 1); $pdf->Cell(85, 1, "...............................................................", 0, 0, 'R', 1); $pdf->Ln(4); $pdf->Cell(43, 1, "Seller signature", 0, 0, 'C', 1); $pdf->SetX(155); $pdf->Cell(35, 1, "Buyer signature", 0, 0, 'C', 1); $pdf->Ln(4); $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'); //header text //$pdf->Ln(6); //$pdf->SetFont('arialpl', 'B', '8'); //$pdf->MultiCell(0, 4, $this->ads_text, 0, 'J'); }