Helix Installation   Getting Started   Reference Documentation   Global Functions   Quick Start
ModulesClassesFunctions
 

Function Reference

write_check ( payee , amount , memo )

Description
No description.
 
Parameters
requiredpayee
requiredamount
requiredmemo
 
Code
308  function write_check($payee,$amount,$memo)
309  {
310      $pdf = new Cezpdf;
311      // USE THESE FOR FEEDING ENVELOPES ON RIGHT SIDE OF PRINTER
312      //$offset_left = -195;
313      //$offset_down = -10;
314      $offset_left = 0;
315      $offset_down = 0;
316 
317      $x = 286 + $offset_left;
318      $y = 190 + $offset_down;
319 
320        // SET FONT SIZES FOR THE CHECK TEXT
321      $font_size = 10;
322      $small_font = 9;
323 
324        // DEFINE THE TEXT TO BE PRINTED ON THE CHECK
325        $check_amount = number_format($amount,2);
326        $amount_in_words = num2words($check_amount);
327        $check_date = date("M d, Y",time());
328 
329        // SELECT THE FONT TYPE
330      $pdf->selectFont(MODULES . 'util/resources/fonts/Helvetica.afm');
331 
332        // ADD THE DATE
333      $pdf->addText($x-30,$y+500,$font_size,$check_date,-90,0);
334 
335        // ADD THE "Pay to the order of" LINE
336      $pdf->addText($x-1,$y+57,$font_size,$payee,-90,0);
337      $pdf->line($x+1,$y+57,$x+1,$y+450);
338 
339        // ADD THE CHECK AMOUNT IN THE DOLLAR BOX
340      $pdf->addText($x-4,$y+507,$font_size,$check_amount,-90,0);
341      $pdf->rectangle($x-16,$y+502,16,80);
342 
343        // ADD THE DOLLAR AMOUNT IN WORDS LINE
344      $pdf->addText($x+25,$y,$font_size,$amount_in_words,-90,0);
345      $pdf->line($x+27,$y,$x+27,$y+548);
346 
347        // ADD A MEMO
348      $pdf->addText($x+110,$y,$font_size,substr($memo,0,54),-90,0);
349      $pdf->line($x+112,$y,$x+112,$y+300);
350 
351        // ADD THE SIGNATURE IMAGE
352      $pdf->addJpegFromFile(MODULES . "admin/resources/images/signature.jpg",$x+50,$y+370,100);
353 
354      // ADD A DASHED LINE TO AUTOFILL THE EMPTY SPACE ON THE AMOUNT IN WORDS LINE
355      $pdf->setLineStyle(1,'','',array(2));
356      $w = $pdf->getTextWidth($font_size,$amount_in_words,-90,0);
357      $pdf->line($x+21,$y+$w+3,$x+21,$y+548);
358 
359        // OUTPUT THE FILE TO THE DESIRED LOCATION
360      $pdfcode = $pdf->output();
361      $fp=fopen(MODULES . "admin/resources/docs/check.pdf",'wb');
362      fwrite($fp,$pdfcode);
363      fclose($fp);
364  }
Get Helix PHP Framework at SourceForge.net. Fast, secure and Free Open Source software downloads