setlinestyle(1); $pdf->line(7*$scale+$x,724*$scale+$y,7*$scale+$x,694*$scale+$y); $pdf->line(7*$scale+$x,724*$scale+$y,37*$scale+$x,724*$scale+$y); $pdf->line(370*$scale+$x,724*$scale+$y,370*$scale+$x,694*$scale+$y); $pdf->line(370*$scale+$x,724*$scale+$y,340*$scale+$x,724*$scale+$y); $pdf->line(7*$scale+$x,197*$scale+$y,7*$scale+$x,227*$scale+$y); $pdf->line(7*$scale+$x,197*$scale+$y,37*$scale+$x,197*$scale+$y); $pdf->line(370*$scale+$x,197*$scale+$y,370*$scale+$x,227*$scale+$y); $pdf->line(370*$scale+$x,197*$scale+$y,340*$scale+$x,197*$scale+$y); */ $shortname = $invoice['division_shortname']; $address = $invoice['division_address']; $zip = $invoice['division_zip']; $city = $invoice['division_city']; $account = bankaccount($invoice['customerid'], $invoice['account']); text_autosize(15*$scale+$x,588*$scale+$y,30*$scale, iconv("UTF-8","ISO-8859-2//TRANSLIT", $shortname),350*$scale); text_autosize(15*$scale+$x,554*$scale+$y,30*$scale, iconv("UTF-8","ISO-8859-2//TRANSLIT", $address),350*$scale); text_autosize(15*$scale+$x,520*$scale+$y,30*$scale, iconv("UTF-8","ISO-8859-2//TRANSLIT", $zip.' '.$city),350*$scale); //text_autosize(15*$scale+$x,683*$scale+$y,30*$scale, substr($tmp,0,17),350*$scale); //text_autosize(15*$scale+$x,626*$scale+$y,30*$scale, substr($tmp,18,200),350*$scale); text_autosize(15*$scale+$x,663*$scale+$y,30*$scale, $account, 350*$scale); text_autosize(15*$scale+$x,445*$scale+$y,30*$scale,"*".number_format($invoice['total'],2,',','')."*",350*$scale); text_autosize(15*$scale+$x,390*$scale+$y,30*$scale, iconv("UTF-8","ISO-8859-2//TRANSLIT",$invoice['name']),300*$scale); text_autosize(15*$scale+$x,356*$scale+$y,30*$scale, iconv("UTF-8","ISO-8859-2//TRANSLIT",$invoice['address']),350*$scale); text_autosize(15*$scale+$x,322*$scale+$y,30*$scale, iconv("UTF-8","ISO-8859-2//TRANSLIT",$invoice['zip'].' '.$invoice['city']),350*$scale); $tmp = docnumber($invoice['number'], $invoice['template'], $invoice['cdate']); text_autosize(15*$scale+$x,215*$scale+$y,30*$scale,iconv("UTF-8","ISO-8859-2//TRANSLIT",trans('Payment for invoice No. $0', $tmp)),350*$scale); } function invoice_main_form_fill($x,$y,$scale) { global $pdf,$invoice; /* $pdf->setlinestyle(1); $pdf->line(7*$scale+$x,724*$scale+$y,7*$scale+$x,694*$scale+$y); $pdf->line(7*$scale+$x,724*$scale+$y,37*$scale+$x,724*$scale+$y); $pdf->line(970*$scale+$x,724*$scale+$y,970*$scale+$x,694*$scale+$y); $pdf->line(970*$scale+$x,724*$scale+$y,940*$scale+$x,724*$scale+$y); $pdf->line(7*$scale+$x,172*$scale+$y,7*$scale+$x,202*$scale+$y); $pdf->line(7*$scale+$x,172*$scale+$y,37*$scale+$x,172*$scale+$y); */ $name = $invoice['division_name']; $address = $invoice['division_address']; $zip = $invoice['division_zip']; $city = $invoice['division_city']; $account = bankaccount($invoice['customerid'], $invoice['account']); text_autosize(15*$scale+$x,680*$scale+$y,30*$scale,iconv("UTF-8","ISO-8859-2//TRANSLIT",$name),860*$scale); text_autosize(15*$scale+$x,622*$scale+$y,30*$scale,iconv("UTF-8","ISO-8859-2//TRANSLIT",$address." ".$zip." ".$city),860*$scale); text_autosize(15*$scale+$x,570*$scale+$y,30*$scale,$account,950*$scale); text_autosize(500*$scale+$x,515*$scale+$y,30*$scale,"*".number_format($invoice['total'],2,',','')."*",400*$scale); text_autosize(15*$scale+$x,465*$scale+$y,30*$scale,iconv("UTF-8","ISO-8859-2//TRANSLIT",trans('$0 dollars $1 cents',to_words(floor($invoice['total'])),to_words(round(($invoice['total']-floor($invoice['total']))*100)))),860*$scale); text_autosize(15*$scale+$x,410*$scale+$y,30*$scale, iconv("UTF-8","ISO-8859-2//TRANSLIT",$invoice['name']),860*$scale); text_autosize(15*$scale+$x,354*$scale+$y,30*$scale, iconv("UTF-8","ISO-8859-2//TRANSLIT",$invoice['address']." ".$invoice['zip']." ".$invoice['city']),860*$scale); $tmp = docnumber($invoice['number'], $invoice['template'], $invoice['cdate']); text_autosize(15*$scale+$x,305*$scale+$y,30*$scale,iconv("UTF-8","ISO-8859-2//TRANSLIT",trans('Payment for invoice No. $0',$tmp)),860*$scale); } function invoice_dates($x,$y) { global $invoice,$pdf; $font_size=11; $y=$y-text_align_left($x,$y,$font_size,iconv("UTF-8","ISO-8859-2//TRANSLIT",trans('Settlement date:')).' '.date("Y/m/d",$invoice['cdate'])); $y=$y-text_align_left($x,$y,$font_size,iconv("UTF-8","ISO-8859-2//TRANSLIT",trans('Sale date:')).' '.date("Y/m/d",$invoice['cdate'])); return $y; } function company($x,$y) { global $pdf; $font_size=8; $y=$y-text_align_left($x,$y,$font_size,iconv("UTF-8","ISO-8859-2//TRANSLIT",'PROMEDIA s.c. K.Nowicki D.Weso��owski')); $y=$y-text_align_left($x,$y,$font_size,iconv("UTF-8","ISO-8859-2//TRANSLIT",'ul. Chopina 11, 46-200 Kluczbork')); $y=$y-text_align_left($x,$y,$font_size,iconv("UTF-8","ISO-8859-2//TRANSLIT",'NIP: 751-172-58-54, REGON: 160169120')); $y=$y-text_align_left($x,$y,$font_size,iconv("UTF-8","ISO-8859-2//TRANSLIT",'Tel. 503 108 176, 606 629 275')); $y=$y-text_align_left($x,$y,$font_size,iconv("UTF-8","ISO-8859-2//TRANSLIT",'promedia@ipv.net.pl, www.ipv.net.pl')); $y=$y-text_align_left($x,$y,$font_size,iconv("UTF-8","ISO-8859-2//TRANSLIT",'Konto bankowe: 92 1140 2004 0000 3102 5121 5078')); return $y; } function invoice_buyer($x,$y) { global $invoice,$pdf; $font_size=10; $y=$y-text_align_left($x,$y,$font_size,''.iconv("UTF-8","ISO-8859-2//TRANSLIT",trans('Purchaser:')).''); $y=text_wrap($x,$y,250,$font_size,iconv("UTF-8","ISO-8859-2//TRANSLIT",$invoice['name']),'left'); $y=$y-text_align_left($x,$y,$font_size,iconv("UTF-8","ISO-8859-2//TRANSLIT",$invoice['address'])); $y=$y-text_align_left($x,$y,$font_size,iconv("UTF-8","ISO-8859-2//TRANSLIT",$invoice['zip']." ".$invoice['city'])); if ($invoice['division_countryid'] && $invoice['countryid'] && $invoice['division_countryid'] != $invoice['countryid']) $y=$y-text_align_left($x,$y,$font_size,iconv("UTF-8","ISO-8859-2//TRANSLIT",trans($invoice['country']))); if ($invoice['ten']) $y=$y-text_align_left($x,$y,$font_size,iconv("UTF-8","ISO-8859-2//TRANSLIT",trans('TEN')).' '.$invoice['ten']); else if ($invoice['ssn']) $y=$y-text_align_left($x,$y,$font_size,iconv("UTF-8","ISO-8859-2//TRANSLIT",trans('SSN')).' '.$invoice['ssn']); $y=$y-text_align_left($x,$y,$font_size,''.iconv("UTF-8","ISO-8859-2//TRANSLIT",trans('Customer No.: $0',sprintf('%04d',$invoice['customerid']))).''); return $y; } function invoice_seller($x,$y) { global $pdf, $invoice; $font_size=10; $y=$y-text_align_left($x,$y,$font_size,''.iconv("UTF-8","ISO-8859-2//TRANSLIT",trans('Seller:')).''); $tmp = iconv("UTF-8","ISO-8859-2//TRANSLIT", $invoice['division_header']); $tmp = preg_split('/\r?\n/', $tmp); foreach ($tmp as $line) $y=$y-text_align_left($x,$y,$font_size,$line); return $y; } function invoice_title($x,$y) { global $invoice,$pdf,$type; $font_size = 14; $tmp = docnumber($invoice['number'], $invoice['template'], $invoice['cdate']); if(isset($invoice['invoice'])) $y=$y-text_align_left($x,$y,$font_size,''.iconv("UTF-8","ISO-8859-2//TRANSLIT",trans('Credit Note No. $0',$tmp)).''); else $y=$y-text_align_left($x,$y,$font_size,''.iconv("UTF-8","ISO-8859-2//TRANSLIT",trans('Invoice No. $0',$tmp)).''); if(isset($invoice['invoice'])) { $font_size = 12; $y += 6; $tmp = docnumber($invoice['invoice']['number'], $invoice['invoice']['template'], $invoice['invoice']['cdate']); $y=$y-text_align_left($x,$y,$font_size,''.iconv("UTF-8","ISO-8859-2//TRANSLIT",trans('for Invoice No. $0',$tmp)).''); $y -= 5; } $font_size = 12; $y=$y-text_align_left($x,$y,$font_size,iconv("UTF-8","ISO-8859-2//TRANSLIT",$type)); if($type==trans('DUPLICATE')) { $font_size = 12; $y=$y-text_align_left($x,$y+4,$font_size,iconv("UTF-8","ISO-8859-2//TRANSLIT",trans('Duplicate draw-up date:').' '.date('Y/m/d'))); } if(isset($invoice['invoice'])) $y += 10; return $y; } function invoice_address_box($x,$y) { global $invoice,$pdf; $font_size=12; /* $invoice_name = $invoice['name']; if (strlen($invoice_name)>25) $invoice_name = preg_replace('/(.{25})/',"$1>\n",$invoice_name); $tmp = preg_split('/\r?\n/', iconv("UTF-8","ISO-8859-2",$invoice_name)); foreach ($tmp as $line) $y=$y-text_align_left($x,$y,$font_size,"".$line.""); */ $y = text_wrap($x, $y, 250, $font_size, ''.iconv("UTF-8","ISO-8859-2//TRANSLIT",$invoice['name'].''), 'left'); if ($invoice['post_address']) { $y=$y-text_align_left($x,$y,$font_size,''.iconv('UTF-8','ISO-8859-2//TRANSLIT',$invoice['post_address']).''); $y=$y-text_align_left($x,$y,$font_size,''.iconv('UTF-8','ISO-8859-2//TRANSLIT',$invoice['post_zip']." ".$invoice['post_city']).''); } else { $y=$y-text_align_left($x,$y,$font_size,''.iconv('UTF-8','ISO-8859-2//TRANSLIT',$invoice['address']).''); $y=$y-text_align_left($x,$y,$font_size,''.iconv('UTF-8','ISO-8859-2//TRANSLIT',$invoice['zip']." ".$invoice['city']).''); } return $y; } function invoice_data_row($x,$y,$width,$font_size,$margin,$data,$t_width,$t_justify) { global $pdf; $fy=$y-$margin-$pdf->GetFontHeight($font_size); $left = $x+$margin; $ny = $fy; $cols = sizeof($data); for ($i = 1; $i <= $cols; $i++) { $ly = text_wrap($left+$margin, $fy, $t_width[$i]-2*$margin, $font_size,$data[$i],$t_justify[$i]); $left = $left + $t_width[$i]+2*$margin; if ($ly<$ny) $ny=$ly; } $left = $x; for ($i = 1; $i <= $cols; $i++) { $pdf->line($left, $y, $left, $ny+$font_size/2); $left = $left + $t_width[$i]+2*$margin; } $pdf->line($left, $y, $left, $ny+$font_size/2); $y=$ny+$font_size/2; $pdf->line($x,$y,$x+$width,$y); return($y); } function invoice_short_data_row($x,$y,$width,$font_size,$margin,$data,$t_width,$t_justify) { global $pdf; $fy=$y-$margin-$pdf->GetFontHeight($font_size); $left = $x+$margin; $ny = $fy; $cols = sizeof($data); for ($i = $cols-3; $i <= $cols; $i++) { $ly = text_wrap($left+$margin, $fy, $t_width[$i]-2*$margin, $font_size,$data[$i],$t_justify[$i]); $left = $left + $t_width[$i]+2*$margin; if ($ly<$ny) $ny=$ly; } $left = $x; for ($i = $cols-3; $i <= $cols; $i++) { $pdf->line($left, $y, $left, $ny+$font_size/2); $left = $left + $t_width[$i]+2*$margin; } $pdf->line($left, $y, $left, $ny+$font_size/2); $y=$ny+$font_size/2; //$pdf->line($x,$y,$x+$width,$y); $v = $cols-3; $pdf->line($x,$y,$x+$t_width[$v++]+$t_width[$v++]+$t_width[$v++]+$t_width[$v++]+8*$margin,$y); return($y); } function invoice_data($x,$y,$width,$font_size,$margin) { global $invoice,$pdf; $pdf->setlinestyle(0.5); $pdf->line($x,$y,$x+$width,$y); $v = 1; $t_data[$v++] = ''.iconv("UTF-8","ISO-8859-2//TRANSLIT",trans('No.')).''; $t_data[$v++] = ''.iconv("UTF-8","ISO-8859-2//TRANSLIT",trans('Name of Product, Commodity or Service:')).''; $t_data[$v++] = ''.iconv("UTF-8","ISO-8859-2//TRANSLIT",trans('Product ID:')).''; $t_data[$v++] = ''.iconv("UTF-8","ISO-8859-2//TRANSLIT",trans('Unit:')).''; $t_data[$v++] = ''.iconv("UTF-8","ISO-8859-2//TRANSLIT",trans('Amount:')).''; if($invoice['discount']) $t_data[$v++] = ''.iconv("UTF-8","ISO-8859-2//TRANSLIT",trans('Discount:')).''; $t_data[$v++] = ''.iconv("UTF-8","ISO-8859-2//TRANSLIT",trans('Unitary Net Value:')).''; $t_data[$v++] = ''.iconv("UTF-8","ISO-8859-2//TRANSLIT",trans('Net Value:')).''; $t_data[$v++] = ''.iconv("UTF-8","ISO-8859-2//TRANSLIT",trans('Tax Rate:')).''; $t_data[$v++] = ''.iconv("UTF-8","ISO-8859-2//TRANSLIT",trans('Tax Value:')).''; $t_data[$v++] = ''.iconv("UTF-8","ISO-8859-2//TRANSLIT",trans('Gross Value:')).''; for ($i = 1; $i < $v; $i++) $t_justify[$i]="center"; for ($i = 1; $i < $v; $i++) $t_width[$i] = getWrapTextWidth($font_size,$t_data[$i])+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) { $v = 2; $tt_width[$v++] = $pdf->getTextWidth($font_size,iconv("UTF-8","ISO-8859-2//TRANSLIT",$item['description'])); $tt_width[$v++] = $pdf->getTextWidth($font_size,$item['prodid']); $tt_width[$v++] = $pdf->getTextWidth($font_size,$item['content']); $tt_width[$v++] = $pdf->getTextWidth($font_size,sprintf('%.2f',$item['count'])); if($invoice['discount']) $tt_width[$v++] = $pdf->getTextWidth($font_size,sprintf('%.2f%%',$item['discount'])); $tt_width[$v++] = $pdf->getTextWidth($font_size,iconv("UTF-8","ISO-8859-2//TRANSLIT",moneyf($item['basevalue'])))+6; $tt_width[$v++] = $pdf->getTextWidth($font_size,iconv("UTF-8","ISO-8859-2//TRANSLIT",moneyf($item['totalbase'])))+6; $tt_width[$v++] = $pdf->getTextWidth($font_size,iconv("UTF-8","ISO-8859-2//TRANSLIT",$item['taxlabel']))+6; $tt_width[$v++] = $pdf->getTextWidth($font_size,iconv("UTF-8","ISO-8859-2//TRANSLIT",moneyf($item['totaltax'])))+6; $tt_width[$v++] = $pdf->getTextWidth($font_size,iconv("UTF-8","ISO-8859-2//TRANSLIT",moneyf($item['total'])))+6; for ($i = 2; $i < $v; $i++) if(($tt_width[$i]+2*$margin+2)>$t_width[$i]) $t_width[$i] = $tt_width[$i]+2*$margin+2; } if(isset($invoice['invoice']['content'])) foreach ($invoice['invoice']['content'] as $item) { $v = 2; $tt_width[$v++] = $pdf->getTextWidth($font_size,iconv("UTF-8","ISO-8859-2//TRANSLIT",$item['description'])); $tt_width[$v++] = $pdf->getTextWidth($font_size,$item['prodid']); $tt_width[$v++] = $pdf->getTextWidth($font_size,$item['content']); $tt_width[$v++] = $pdf->getTextWidth($font_size,sprintf('%.2f',$item['count'])); if($invoice['discount']) $tt_width[$v++] = $pdf->getTextWidth($font_size,sprintf('%.2f%%',$item['discount'])); $tt_width[$v++] = $pdf->getTextWidth($font_size,iconv("UTF-8","ISO-8859-2//TRANSLIT",moneyf($item['basevalue'])))+6; $tt_width[$v++] = $pdf->getTextWidth($font_size,iconv("UTF-8","ISO-8859-2//TRANSLIT",moneyf($item['totalbase'])))+6; $tt_width[$v++] = $pdf->getTextWidth($font_size,iconv("UTF-8","ISO-8859-2//TRANSLIT",$item['taxlabel']))+6; $tt_width[$v++] = $pdf->getTextWidth($font_size,iconv("UTF-8","ISO-8859-2//TRANSLIT",moneyf($item['totaltax'])))+6; $tt_width[$v++] = $pdf->getTextWidth($font_size,iconv("UTF-8","ISO-8859-2//TRANSLIT",moneyf($item['total'])))+6; for ($i = 2; $i < $v; $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]+($invoice['discount'] ? $t_width[11] : 0)+ 2*$margin*($invoice['discount'] ? 11 : 10)); $y = invoice_data_row($x,$y,$width,$font_size,$margin,$t_data,$t_width,$t_justify); $t_justify[11] = $t_justify[10] = $t_justify[9] = $t_justify[8] = $t_justify[7] = $t_justify[6] = $t_justify[5] = "right"; $t_justify[2] = 'left'; if(isset($invoice['invoice'])) { // we have credit note, so first print corrected invoice data $xx = $x; $y = $y-text_align_left($x,$y-10,$font_size,''.iconv("UTF-8","ISO-8859-2//TRANSLIT",trans('Was:')).''); $y -= 6; $pdf->line($x,$y,$x+$width,$y); $lp = 1; if ($invoice['invoice']['content']) foreach ($invoice['invoice']['content'] as $item) { $v = 1; $t_data[$v++] = $lp; $t_data[$v++] = iconv("UTF-8","ISO-8859-2//TRANSLIT",$item['description']); $t_data[$v++] = $item['prodid']; $t_data[$v++] = $item['content']; $t_data[$v++] = sprintf('%.2f',$item['count']); if($invoice['discount']) $t_data[$v++] = sprintf('%.2f%%',$item['discount']); $t_data[$v++] = iconv("UTF-8","ISO-8859-2//TRANSLIT",moneyf($item['basevalue'])); $t_data[$v++] = iconv("UTF-8","ISO-8859-2//TRANSLIT",moneyf($item['totalbase'])); $t_data[$v++] = iconv("UTF-8","ISO-8859-2//TRANSLIT",$item['taxlabel']); $t_data[$v++] = iconv("UTF-8","ISO-8859-2//TRANSLIT",moneyf($item['totaltax'])); $t_data[$v++] = iconv("UTF-8","ISO-8859-2//TRANSLIT",moneyf($item['total'])); $lp++; $y = invoice_data_row($x,$y,$width,$font_size,$margin,$t_data,$t_width,$t_justify); } $x = $x + ($invoice['discount'] ? 7 : 6)*2*$margin + $t_width[1] + $t_width[2] + $t_width[3] + $t_width[4] + $t_width[5] + $t_width[6] + ($invoice['discount'] ? $t_width[7] : 0); $fy=$y-$margin-$pdf->GetFontHeight($font_size); text_align_right($x-$margin,$fy,$font_size,''.iconv("UTF-8","ISO-8859-2//TRANSLIT",trans('Total:')).''); $v = $invoice['discount'] ? 8 : 7; $t_data[$v++] = iconv("UTF-8","ISO-8859-2//TRANSLIT",moneyf($invoice['invoice']['totalbase'])); $t_data[$v++] = "x"; $t_data[$v++] = iconv("UTF-8","ISO-8859-2//TRANSLIT",moneyf($invoice['invoice']['totaltax'])); $t_data[$v++] = iconv("UTF-8","ISO-8859-2//TRANSLIT",moneyf($invoice['invoice']['total'])); $y = invoice_short_data_row($x,$y,$width,$font_size,$margin,$t_data,$t_width,$t_justify); $y -= 5; $fy=$y-$margin-$pdf->GetFontHeight($font_size); text_align_right($x-$margin,$fy,$font_size,''.iconv("UTF-8","ISO-8859-2//TRANSLIT",trans('in it:')).''); $v = $invoice['discount'] ? 8 : 7; $pdf->line($x,$y,$x+$t_width[$v++]+$t_width[$v++]+$t_width[$v++]+$t_width[$v++]+8*$margin,$y); if ($invoice['invoice']['taxest']) foreach ($invoice['invoice']['taxest'] as $item) { $v = $invoice['discount'] ? 8 : 7; $t_data[$v++] = iconv("UTF-8","ISO-8859-2//TRANSLIT",moneyf($item['base'])); $t_data[$v++] = iconv("UTF-8","ISO-8859-2//TRANSLIT",$item['taxlabel']); $t_data[$v++] = iconv("UTF-8","ISO-8859-2//TRANSLIT",moneyf($item['tax'])); $t_data[$v++] = iconv("UTF-8","ISO-8859-2//TRANSLIT",moneyf($item['total'])); $y = invoice_short_data_row($x,$y,$width,$font_size,$margin,$t_data,$t_width,$t_justify); } $x = $xx; if ($invoice['reason'] != '') { $y = $y-text_align_left($x,$y-10,$font_size,''.iconv("UTF-8","ISO-8859-2//TRANSLIT",trans('Reason:').' '.$invoice['reason']).''); $y -= 10; } $y = $y-text_align_left($x,$y-10,$font_size,''.iconv("UTF-8","ISO-8859-2//TRANSLIT",trans('Corrected to:')).''); $y -= 5; $pdf->line($x,$y,$x+$width,$y); } $lp = 1; if($invoice['content']) foreach ($invoice['content'] as $item) { $v = 1; $t_data[$v++] = $lp; $t_data[$v++] = iconv("UTF-8","ISO-8859-2//TRANSLIT",$item['description']); $t_data[$v++] = $item['prodid']; $t_data[$v++] = $item['content']; $t_data[$v++] = sprintf('%.2f',$item['count']); if($invoice['discount']) $t_data[$v++] = sprintf('%.2f%%',$item['discount']); $t_data[$v++] = iconv("UTF-8","ISO-8859-2//TRANSLIT",moneyf($item['basevalue'])); $t_data[$v++] = iconv("UTF-8","ISO-8859-2//TRANSLIT",moneyf($item['totalbase'])); $t_data[$v++] = iconv("UTF-8","ISO-8859-2//TRANSLIT",$item['taxlabel']); $t_data[$v++] = iconv("UTF-8","ISO-8859-2//TRANSLIT",moneyf($item['totaltax'])); $t_data[$v++] = iconv("UTF-8","ISO-8859-2//TRANSLIT",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 + ($invoice['discount'] ? 7 : 6)*2*$margin + $t_width[1] + $t_width[2] + $t_width[3] + $t_width[4] + $t_width[5] + $t_width[6] + ($invoice['discount'] ? $t_width[7] : 0); $fy=$y-$margin-$pdf->GetFontHeight($font_size); text_align_right($x-$margin,$fy,$font_size,''.iconv("UTF-8","ISO-8859-2//TRANSLIT",trans('Total:')).''); $v = $invoice['discount'] ? 8 : 7; $t_data[$v++] = iconv("UTF-8","ISO-8859-2//TRANSLIT",moneyf($invoice['totalbase'])); $t_data[$v++] = "x"; $t_data[$v++] = iconv("UTF-8","ISO-8859-2//TRANSLIT",moneyf($invoice['totaltax'])); $t_data[$v++] = iconv("UTF-8","ISO-8859-2//TRANSLIT",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,''.iconv("UTF-8","ISO-8859-2//TRANSLIT",trans('in it:')).''); $v = $invoice['discount'] ? 8 : 7; $pdf->line($x,$y,$x+$t_width[$v++]+$t_width[$v++]+$t_width[$v++]+$t_width[$v++]+8*$margin,$y); if ($invoice['taxest']) foreach ($invoice['taxest'] as $item) { $v = $invoice['discount'] ? 8 : 7; $t_data[$v++] = iconv("UTF-8","ISO-8859-2//TRANSLIT",moneyf($item['base'])); $t_data[$v++] = iconv("UTF-8","ISO-8859-2//TRANSLIT",$item['taxlabel']); $t_data[$v++] = iconv("UTF-8","ISO-8859-2//TRANSLIT",moneyf($item['tax'])); $t_data[$v++] = iconv("UTF-8","ISO-8859-2//TRANSLIT",moneyf($item['total'])); $y = invoice_short_data_row($x,$y,$width,$font_size,$margin,$t_data,$t_width,$t_justify); } if(isset($invoice['invoice'])) { $total = $invoice['total'] - $invoice['invoice']['total']; $totalbase = $invoice['totalbase'] - $invoice['invoice']['totalbase']; $totaltax = $invoice['totaltax'] - $invoice['invoice']['totaltax']; $y = $y - 5; $fy=$y-$margin-$pdf->GetFontHeight($font_size); $v = $invoice['discount'] ? 8 : 7; $pdf->line($x,$y,$x+$t_width[$v++]+$t_width[$v++]+$t_width[$v++]+$t_width[$v++]+8*$margin,$y); text_align_right($x-$margin,$fy,$font_size,''.iconv("UTF-8","ISO-8859-2//TRANSLIT", trans('Difference value:')).''); $v = $invoice['discount'] ? 8 : 7; $t_data[$v++] = ($totalbase>0 ? '+' : '') . iconv("UTF-8","ISO-8859-2//TRANSLIT", moneyf($totalbase)); $t_data[$v++] = "x"; $t_data[$v++] = ($totaltax>0 ? '+' : '') . iconv("UTF-8","ISO-8859-2//TRANSLIT", moneyf($totaltax)); $t_data[$v++] = ($total>0 ? '+' : '') . iconv("UTF-8","ISO-8859-2//TRANSLIT", moneyf($total)); $y = invoice_short_data_row($x,$y,$width,$font_size,$margin,$t_data,$t_width,$t_justify); } $return[2] = $y; return $return; } 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', // I think it should be left here (bug?) 'rowGap' => 2, 'colGap' => 2, 'showHeadings' => 0, 'cols' => array(), ); // tabelka glowna $cols['no'] = ''.iconv("UTF-8","ISO-8859-2//TRANSLIT",trans('No.')).''; $cols['name'] = ''.iconv("UTF-8","ISO-8859-2//TRANSLIT",trans('Name of Product, Commodity or Service:')).''; $cols['prodid'] = ''.iconv("UTF-8","ISO-8859-2//TRANSLIT",trans('Product ID:')).''; $cols['content'] = ''.iconv("UTF-8","ISO-8859-2//TRANSLIT",trans('Unit:')).''; $cols['count'] = ''.iconv("UTF-8","ISO-8859-2//TRANSLIT",trans('Amount:')).''; if($invoice['discount']) $cols['discount'] = ''.iconv("UTF-8","ISO-8859-2//TRANSLIT",trans('Discount:')).''; $cols['basevalue'] = ''.iconv("UTF-8","ISO-8859-2//TRANSLIT",trans('Unitary Net Value:')).''; $cols['totalbase'] = ''.iconv("UTF-8","ISO-8859-2//TRANSLIT",trans('Net Value:')).''; $cols['taxlabel'] = ''.iconv("UTF-8","ISO-8859-2//TRANSLIT",trans('Tax Rate:')).''; $cols['totaltax'] = ''.iconv("UTF-8","ISO-8859-2//TRANSLIT",trans('Tax Value:')).''; $cols['total'] = ''.iconv("UTF-8","ISO-8859-2//TRANSLIT",trans('Gross Value:')).''; 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($invoice['discount']) $tt_width['discount'] = $pdf->getTextWidth($font_size,sprintf('%.2f%%',$item['discount'])); $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($invoice['discount']) $tt_width['discount'] = $pdf->getTextWidth($font_size,sprintf('%.2f%%',$item['discount'])); $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,''.iconv("UTF-8","ISO-8859-2//TRANSLIT",trans('Was:')).''); $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']); if($invoice['discount']) $data[$i]['discount'] = sprintf('%.2f%%',$item['discount']); $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'] = "x"; $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, ''.iconv("UTF-8","ISO-8859-2//TRANSLIT",trans('Total:')).''); check_page_length($y); $fy = $y - $margin - $pdf->GetFontHeight($font_size); text_align_right($xx-5,$fy,$font_size,''.iconv("UTF-8","ISO-8859-2//TRANSLIT",trans('in it:')).''); 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,''.iconv("UTF-8","ISO-8859-2//TRANSLIT",trans('Reason:').' '.$invoice['reason']).'','left'); $y -= 10; } check_page_length($y); $y = $y-text_align_left($x,$y,$font_size,''.iconv("UTF-8","ISO-8859-2//TRANSLIT",trans('Corrected to:')).''); } // 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']); if($invoice['discount']) $data[$i]['discount'] = sprintf('%.2f%%',$item['discount']); $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'] = "x"; $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, ''.iconv("UTF-8","ISO-8859-2//TRANSLIT",trans('Total:')).''); $return[1] = $y; check_page_length($y); $fy = $y - $margin - $pdf->GetFontHeight($font_size); text_align_right($xx-5,$fy,$font_size,''.iconv("UTF-8","ISO-8859-2//TRANSLIT",trans('in it:')).''); 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,''.iconv("UTF-8","ISO-8859-2//TRANSLIT", trans('Difference value:')).''); $data2[0]['totalbase'] = ($totalbase>0 ? '+' : '') . iconv("UTF-8","ISO-8859-2//TRANSLIT", moneyf($totalbase)); $data2[0]['taxlabel'] = "x"; $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; } function invoice_to_pay($x,$y) { global $pdf, $invoice; $font_size=10; $account = bankaccount($invoice['customerid'], $invoice['account']); if(isset($invoice['rebate'])) $y = $y - text_align_left($x,$y,14,iconv("UTF-8","ISO-8859-2//TRANSLIT",trans('To repay:')).' '.iconv("UTF-8","ISO-8859-2//TRANSLIT",moneyf($invoice['value']))); else $y = $y - text_align_left($x,$y,14,''.iconv("UTF-8","ISO-8859-2//TRANSLIT",trans('To pay:')).' '.iconv("UTF-8","ISO-8859-2//TRANSLIT",moneyf($invoice['value'])).''); $y = $y - 5 - text_align_left($x,$y,8,iconv("UTF-8","ISO-8859-2//TRANSLIT",trans('In words:')).' '.iconv("UTF-8","ISO-8859-2//TRANSLIT",trans('$0 dollars $1 cents',to_words(floor($invoice['value'])),to_words(round(($invoice['value']-floor($invoice['value']))*100))))); $y = $y - 2 - text_align_left($x,$y,$font_size,''.iconv("UTF-8","ISO-8859-2//TRANSLIT",trans('Deadline:')).' '.date("Y/m/d",$invoice['pdate']).''); $y = $y - 2 - text_align_left($x,$y,$font_size,iconv("UTF-8","ISO-8859-2//TRANSLIT",trans('Payment type:')).' '.iconv("UTF-8","ISO-8859-2//TRANSLIT",$invoice['paytypename'])); $y = $y - text_align_left($x,$y,$font_size,iconv("UTF-8","ISO-8859-2//TRANSLIT",trans('Bank account:')).' '.$account); return $y; } function invoice_expositor ($x,$y) { global $pdf, $invoice; $expositor = isset($invoice['user']) ? $invoice['user'] : $invoice['division_author']; if ($expositor) { $y = $y - text_align_left($x,$y,10,iconv("UTF-8","ISO-8859-2//TRANSLIT",trans('Expositor:')).' '.iconv("UTF-8","ISO-8859-2//TRANSLIT",$expositor)); } return $y; } function invoice_footnote($x, $y, $width, $font_size) { global $pdf, $invoice; if(!empty($invoice['division_footer'])) { $y = $y - $pdf->getFontHeight($font_size); $y = $y - text_align_left($x,$y,$font_size,''.iconv("UTF-8","ISO-8859-2//TRANSLIT",trans('Notes:')).''); $tmp = iconv("UTF-8","ISO-8859-2//TRANSLIT", $invoice['division_footer']); $tmp = preg_split('/\r?\n/', $tmp); foreach ($tmp as $line) $y = text_wrap($x,$y,$width,$font_size,$line,"full"); } } function print_balance_history($x,$y, $width, $font_size, $margin) { global $pdf, $invoice, $CONFIG; if(!empty($invoice['balance_history'])) { $y = $y - $pdf->getFontHeight($font_size); $y = $y - text_align_left($x,$y,$font_size+6,''.iconv("UTF-8","ISO-8859-2//TRANSLIT",'Historia ostatnich operacji finansowych na koncie klienta:').''); $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'] = ''.iconv("UTF-8","ISO-8859-2//TRANSLIT",trans('No.')).''; $cols['date'] = ''.iconv("UTF-8","ISO-8859-2//TRANSLIT",trans('Date')).''; $cols['value'] = ''.iconv("UTF-8","ISO-8859-2//TRANSLIT",trans('Value')).''; $cols['typ'] = ''.iconv("UTF-8","ISO-8859-2//TRANSLIT",'Operacja').''; $cols['after'] = ''.iconv("UTF-8","ISO-8859-2//TRANSLIT",'Saldo '.trans('After')).''; $cols['description'] = ''.iconv("UTF-8","ISO-8859-2//TRANSLIT",trans('Description')).''; foreach($cols as $name => $text) { $params['cols'][$name] = array( 'justification' => 'center', 'width' => getWrapTextWidth($font_size,$text)+2*$margin+2, ); } $tt_width['description'] = 315; $tt_width['date'] = 50; $tt_width['value'] = 45; $tt_width['typ'] = 45; $tt_width['after'] = 45; foreach($tt_width as $name => $w) if(($w+2*$margin+2) > $params['cols'][$name]['width']) $params['cols'][$name]['width'] = $w+2*$margin+2; // 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 'description': $params['cols'][$name]['justification'] = 'left'; break; default: $params['cols'][$name]['justification'] = 'center'; break; } } if(isset($invoice['balance_history'])) { //$y -= 20; //check_page_length($y); if(is_array($invoice['balance_history'])) if($invoice['balance_history']) $count = count($invoice['balance_history']['date']); $idx=1; for($i=$count-1; $count-$i+1<$CONFIG['invoices']['print_balance_history_limit'];$i--) { if($i >= 0) { $data[$i]['no'] = $idx++; $data[$i]['date'] = iconv("UTF-8","ISO-8859-2//TRANSLIT",$invoice['balance_history']['date'][$i]); $data[$i]['value'] = iconv("UTF-8","ISO-8859-2//TRANSLIT",moneyf($invoice['balance_history']['value'][$i])); switch($invoice['balance_history']['type'][$i]) { case 0: if($invoice['balance_history']['value'][$i] > 0) $typ = "Korekta"; else $typ = "Faktura"; break; case 1: $typ = "Wp��ata"; break; } $data[$i]['typ'] = iconv("UTF-8","ISO-8859-2//TRANSLIT",$typ); $data[$i]['after'] = iconv("UTF-8","ISO-8859-2//TRANSLIT",moneyf($invoice['balance_history']['after'][$i])); $data[$i]['description'] = iconv("UTF-8","ISO-8859-2//TRANSLIT",$invoice['balance_history']['comment'][$i]); } } $pdf->ezSetY($y); $y = $pdf->ezTable($data, $cols, '', $params); $data = array(); } $y -=20; $y = $y - text_align_left($x,$y,$font_size+4,iconv("UTF-8","ISO-8859-2//TRANSLIT",'Aktualne saldo konta wraz z bie����c�� faktur��: '.moneyf($invoice['balance_history']['balance']).'')); if($invoice['balance_history']['balance'] < -100) $pdf->addJpegFromFile('/var/www/html/lms/img/krd.jpg',$pdf->ez['pageWidth']/2-100,$y-85,200); } $return[1] = $y; return $return; } function invoice_body_standard() { global $pdf; $page = $pdf->ezStartPageNumbers($pdf->ez['pageWidth']/2+10,$pdf->ez['pageHeight']-30,8,'',trans('Page $0 of $1', '{PAGENUM}','{TOTALPAGENUM}'),1); $top=$pdf->ez['pageHeight']-65; $pdf->addPngFromFile('/var/www/html/lms/img/promedialogolms.png',$pdf->ez['pageWidth']-220,$pdf->ez['pageHeight']-100,200); $top=company(30,$top); $top=$top-0; invoice_address_box(400,700); $top=invoice_title(30,700); $top=$top-10; $top=invoice_dates(30,$top); $top=$top-45; $buysell=$top; $top=invoice_seller(30,$top); $top=$top-10; invoice_buyer($pdf->ez['pageWidth']/2,$buysell); $top=$top-10; invoice_footnote(470,$top,90,8); $return=new_invoice_data(30,$top,430,6,1); $top=$return[2]-10; invoice_expositor(30,$return[1]); invoice_to_pay(30,$top); check_page_length($top, 200); $page = $pdf->ezStopPageNumbers(1,1,$page); } function invoice_body_ft0100() { global $pdf,$invoice,$CONFIG; //$page = $pdf->ezStartPageNumbers($pdf->ez['pageWidth']/2+10,$pdf->ez['pageHeight']-30,8,'',trans('Page $0 of $1', '{PAGENUM}','{TOTALPAGENUM}'),1); $top=$pdf->ez['pageHeight']-65; $pdf->addPngFromFile('/var/www/html/lms/img/promedialogolms.png',$pdf->ez['pageWidth']-220,$pdf->ez['pageHeight']-100,200); $pdf->addInfo(array("Author" => "PROMEDIA s.c. ul.Chopina 11, 46-200 Kluczbork", "Title" => "Faktura VAT: ".docnumber($invoice['number'], $invoice['template'], $invoice['cdate']))); $top=company(30,$top); $top=$top-0; invoice_address_box(350,700); $top=invoice_title(30,700); $top=invoice_dates(30,$top); $top=$top-65; $buysell=$top; $top=invoice_seller(30,$top); $top=$top-10; invoice_buyer($pdf->ez['pageWidth']/2,$buysell); $top=$top-10; invoice_footnote(470,$top,90,8); $return=new_invoice_data(30,$top,530,6,1); $top=$return[2]-10; invoice_expositor(30,$return[1]); invoice_to_pay(30,$top); check_page_length($top, 200); $pdf->addPngFromFile('/var/www/html/lms/img/druk06.png',35,30,499); invoice_main_form_fill(187,3,0.4); invoice_simple_form_fill(42,45,0.35); $code='ID:'.sprintf('%04d',$invoice['customerid']).' FV:'.date('Ym',$invoice['cdate']).sprintf('%06d',$invoice['number']); $pdf->Code128(193,105,$code,260,15); $rest_code = $pdf->addTextWrap(465,115,80,7,$code); $rest_code = $pdf->addTextWrap(465,105,80,7,$rest_code); if(isset($CONFIG['invoices']['print_balance_history']) && ($CONFIG['invoices']['print_balance_history'] == 'true' || $CONFIG['invoices']['print_balance_history'] == 'TRUE')) { $page = $pdf->ezNewPage(); $top = $pdf->ez['pageHeight']-80; $return=print_balance_history(30,$top,530,6,1); $top = $return[1]; } // Reklama //$pdf->addJpegFromFile('/var/www/html/lms/fv12.jpg',35,$top-10-372,499); //$page = $pdf->ezStopPageNumbers(1,1,$page); } ?>