Files
crm.twinpol.com/modules/EcmDocumentTemplates/templates/EcmPrepaymentInvoices/e5/subfooter.php
2025-05-12 15:44:39 +00:00

88 lines
3.4 KiB
PHP
Executable File

<?
//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->Ln(10);
if($pdf->GetY()>240)$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'];
$pdf->Cell(30,4,$string,0,0,'L',1);
$pdf->SetFont('arialpl','B','8');
$pdf->Cell(30,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(30,4,$mod_strings['LBL_PDF_TO_PAID'],0,0,'L',1);
$pdf->SetFont('arialpl','B','8');
$pdf->Cell(30,4,$total,0,0,'L',1);
}
$pdf->Ln(4);
$pdf->SetFont('arialpl','','8');
$pdf->Cell(30,4,$mod_strings['LBL_PDF_TOTAL_BY_WORD'],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(20);
$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,$mod_strings['LBL_PDF_OWNER_SIGNATURE'],0,0,'C',1);
$pdf->SetX(155);
$pdf->Cell(35,1,$mod_strings['LBL_PDF_RECEIVER_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');
?>