Ejemplo n.º 1
1
 function display($tpl = null)
 {
     $mainframe =& JFactory::getApplication();
     $dispatcher =& JDispatcher::getInstance();
     /* Load the event details */
     $course = $this->get('Details');
     $venue = $this->get('Venue');
     $pdf = new TCPDF("P", "mm", "A4", true);
     $pdf->SetCreator($mainframe->getCfg('sitename'));
     $pdf->SetAuthor($mainframe->getCfg('sitename'));
     $pdf->SetTitle($course->title);
     $pdf->SetSubject($course->title);
     $pdf->setHeaderFont(array('freesans', '', 8));
     $pdf->setFooterFont(array('freesans', '', 8));
     $pdf->setFont('freesans');
     // disable header and footer
     $pdf->setPrintHeader(false);
     $pdf->setPrintFooter(true);
     //set the display mode
     $pdf->SetDisplayMode('default');
     //initialize document
     $pdf->AliasNbPages();
     // add a page
     $pdf->AddPage();
     $pdf->SetFontSize(10);
     /* This loads the tags replacer */
     JView::loadHelper('tags');
     $tags = new redEVENT_tags();
     $tags->setXref(JRequest::getInt('xref'));
     $message = $tags->ReplaceTags($course->submission_type_email_pdf);
     // convert urls
     $htmlmsg = REOutput::ImgRelAbs($message);
     $pdf->WriteHTML($message, true);
     // add the form data if requested
     if ($course->pdf_form_data) {
         JRequest::setVar('pdfform', $pdf);
         JPluginHelper::importPlugin('content');
         $form = new stdClass();
         $form->text = '{redform}' . $course->redform_id . ',1{/redform}';
         $form->eventid = $course->did;
         $form->task = 'userregister';
         $results = $dispatcher->trigger('onPrepareEvent', array(&$form, array(), 0));
         $pdf->WriteHTML($form->text, true);
     }
     // output the file
     $pdf->Output($course->title . ".pdf", "I");
     exit;
 }
Ejemplo n.º 2
0
 public function fake_pdf()
 {
     $this->load->helper('pdf_helper');
     $this->load->library('users/auth');
     $html_content = '<h4>Le FAKE EN PDF</h4>';
     tcpdf();
     $obj_pdf = new TCPDF('P', PDF_UNIT, PDF_PAGE_FORMAT, true, 'UTF_8', false);
     $obj_pdf->SetCreator(PDF_CREATOR);
     $title = 'Export PDF';
     $obj_pdf->SetTitle($title);
     $obj_pdf->SetHeaderData(PDF_HEADER_LOGO, PDF_HEADER_LOGO_WIDTH, $title, PDF_HEADER_STRING);
     $obj_pdf->setHeaderFont(array(PDF_FONT_NAME_MAIN, '', PDF_FONT_SIZE_MAIN));
     $obj_pdf->setFooterFont(array(PDF_FONT_NAME_DATA, '', PDF_FONT_SIZE_DATA));
     $obj_pdf->SetDefaultMonospacedFont('helvetica');
     $obj_pdf->SetHeaderMargin(PDF_MARGIN_HEADER);
     $obj_pdf->SetFooterMargin(PDF_MARGIN_FOOTER);
     $obj_pdf->SetMargins(PDF_MARGIN_LEFT, PDF_MARGIN_TOP, PDF_MARGIN_RIGHT);
     $obj_pdf->SetAutoPageBreak(TRUE, PDF_MARGIN_BOTTOM);
     $obj_pdf->SetFont('helvetica', '', 9);
     $obj_pdf->setFontSubsetting(false);
     $obj_pdf->AddPage();
     ob_start();
     // we can have any view part here like HTML, PHP etc
     $content = $html_content;
     ob_end_clean();
     $obj_pdf->writeHTML($content, true, false, true, false, '');
     $obj_pdf->SetDisplayMode('real', 'default');
     $obj_pdf->Output('output.pdf', 'D');
     //$this->output->set_content_type('application/json')->set_output(json_encode($html_content));
     //Template::render();
 }
 /**
  * Class constructor
  *
  * @param mixed  $paper       The size of paper to use either a string (see {@link CPDF_Adapter::$PAPER_SIZES}) or
  *                            an array(xmin,ymin,xmax,ymax)
  * @param string $orientation The orientation of the document (either 'landscape' or 'portrait')
  * @param DOMPDF $dompdf
  */
 function __construct($paper = "letter", $orientation = "portrait", DOMPDF $dompdf)
 {
     //***
     if (is_array($paper)) {
         $size = $paper;
     } else {
         if (isset(self::$PAPER_SIZES[mb_strtolower($paper)])) {
             $size = self::$PAPER_SIZES[mb_strtolower($paper)];
         } else {
             $size = self::$PAPER_SIZES["letter"];
         }
     }
     $ori = 'P';
     // ***
     if (mb_strtolower($orientation) === "landscape") {
         list($size[2], $size[3]) = array($size[3], $size[2]);
         $ori = 'L';
         // ***
     }
     $this->_width = $size[2] - $size[0];
     $this->_height = $size[3] - $size[1];
     $this->_dompdf = $dompdf;
     //***$this->_pdf = new My_TCPDF('P', 'pt', $paper, true, 'UTF-8', false);
     $this->_pdf = new My_TCPDF($ori, 'pt', $paper, true, 'UTF-8', false);
     // ***
     $this->_pdf->SetCreator("DOMPDF Converter");
     // CreationDate and ModDate info are added by TCPDF itself
     // don't use TCPDF page defaults
     $this->_pdf->SetAutoPageBreak(false);
     $this->_pdf->SetMargins(0, 0, 0, true);
     $this->_pdf->setPrintHeader(false);
     // remove default header/footer
     $this->_pdf->setPrintFooter(false);
     $this->_pdf->setHeaderMargin(0);
     $this->_pdf->setFooterMargin(0);
     $this->_pdf->SetCellPadding(0);
     $this->_pdf->AddPage();
     $this->_pdf->SetDisplayMode('fullpage', 'continuous');
     $this->_page_number = $this->_page_count = 1;
     $this->_page_text = array();
     $this->_pages = array($this->_pdf->PageNo());
     $this->_image_cache = array();
     // other TCPDF stuff...
     $this->_objs = array();
     // for templating support
     $this->_nameddest = array();
     // for internal link support
     $this->_internal_links = array();
     //		"	"	"
     $this->_pdf->setAlpha(1.0);
     $this->_currentLineTransparency = array("mode" => "Normal", "opacity" => 1.0);
     $this->_currentFillTransparency = array("mode" => "Normal", "opacity" => 1.0);
     $this->_last_fill_color = $this->_last_stroke_color = null;
     //dompdf_debug("trace", "Exit");
 }
Ejemplo n.º 4
0
    $hasil = $key->status;
}
$obj_pdf->SetTitle($toko);
$obj_pdf->SetHeaderData("", "", "", "");
$obj_pdf->SetPrintHeader(FALSE);
$obj_pdf->SetPrintFooter(FALSE);
$obj_pdf->setHeaderFont(array(PDF_FONT_NAME_MAIN, '', 9));
$obj_pdf->setFooterFont(array(PDF_FONT_NAME_DATA, '', PDF_FONT_SIZE_DATA));
$obj_pdf->SetDefaultMonospacedFont('helvetica');
$obj_pdf->SetHeaderMargin(PDF_MARGIN_HEADER);
$obj_pdf->SetFooterMargin(PDF_MARGIN_FOOTER);
$obj_pdf->SetMargins(10, 34, 10);
$obj_pdf->SetAutoPageBreak(FALSE, PDF_MARGIN_BOTTOM);
$obj_pdf->SetFont('helvetica', '', 10);
$obj_pdf->setFontSubsetting(FALSE);
$obj_pdf->SetDisplayMode('fullpage', 'SinglePage', 'UseNone');
$obj_pdf->AddPage();
$obj_pdf->SetFont("helvetica", '', 20);
$obj_pdf->Ln(107);
$obj_pdf->MultiCell(180, 10, $no, 0, 'C', 0, 1, '', '', true, 0, false, true, 10, 'B');
$obj_pdf->Ln(30);
$obj_pdf->SetFont($fontnama, '', 22);
$obj_pdf->MultiCell(220, 10, $nama, 0, 'C', 0, 1, '', '', true, 0, false, true, 10, 'B');
$obj_pdf->Ln(5);
$obj_pdf->SetFont('helvetica', '', 12);
$obj_pdf->MultiCell(75, 8, "", 0, 'L', 0, 0, '', '', true, 0, false, true, 8, 'B');
$obj_pdf->MultiCell(50, 8, $tgl, 0, 'L', 0, 0, '', '', true, 0, false, true, 8, 'B');
$obj_pdf->MultiCell(20, 8, "", 0, 'L', 0, 0, '', '', true, 0, false, true, 8, 'B');
$obj_pdf->MultiCell(40, 8, strtoupper($tempat), 0, 'L', 0, 1, '', '', true, 0, false, true, 9, 'B');
$obj_pdf->Ln(7);
$obj_pdf->MultiCell(120, 8, "", 0, 'L', 0, 0, '', '', true, 0, false, true, 8, 'B');
Ejemplo n.º 5
0
                        $cadena .= "<tr><td>" . $p['u'] . "</td><td>" . $p['uni'] . "</td><td>" . $p['respondidas'] . "</td><td>" . $p['no_respondidas'] . "</td><td>" . $p['sin_responder'] . "</td><td>" . $p['cant'] . "</td></tr>";
                    }
                }
            }
            break;
        case "usc":
            //$cadena .= "<tr><td>".$p['pin']."</td><td>Universidad Santiago de Cali</td><td>".$p['fecha_de_creacion_pin']."</td><td>".$p['fecha_de_fin_de_diligenciada_la_encuesta']."</td></tr>";
            if ($p['fecha_de_creacion_pin'] != '') {
                $cadena .= "<tr><td>" . $p['pin'] . "</td><td>Universidad Santiago de Cali</td><td>" . $p['fecha_de_creacion_pin'] . "</td><td>" . $p['fecha_de_fin_de_diligenciada_la_encuesta'] . "</td></tr>";
            } else {
                if ($p['tipo'] == 'f1') {
                    $cadena .= "<tr><td>" . $p['u'] . "</td><td>" . $p['f'] . "</td><td>" . $p['respondidas'] . "</td><td>" . $p['no_respondidas'] . "</td><td>" . $p['sin_responder'] . "</td><td>" . $p['cant'] . "</td></tr>";
                } else {
                    if ($p['tipo'] == 'p1') {
                        $cadena .= "<tr><td>" . $p['f'] . "</td><td>" . $p['p'] . "</td><td>" . $p['respondidas'] . "</td><td>" . $p['no_respondidas'] . "</td><td>" . $p['sin_responder'] . "</td><td>" . $p['cant'] . "</td></tr>";
                    } else {
                        $cadena .= "<tr><td>" . $p['u'] . "</td><td>" . $p['uni'] . "</td><td>" . $p['respondidas'] . "</td><td>" . $p['no_respondidas'] . "</td><td>" . $p['sin_responder'] . "</td><td>" . $p['cant'] . "</td></tr>";
                    }
                }
            }
            break;
    }
}
$cadena .= "</tbody></table>";
//$cadena .= '<center><div><img src="img20.png" alt="attribute" width="500" height="70" border="0" ></div></center>';
$pdf->writeHTML($cadena, false, false, false, true, '');
$pdf->SetDisplayMode('fullpage');
$pdf->Output('codigos_de_acceso.pdf', 'I');
//    $pdf->SetFont('Arial', 'I', 12);
//$pdf->Output('prueba.pdf', 'd');
//    $pdf->Output();
Ejemplo n.º 6
0
 /**
  * function name : salary_emp
  * get data รวมเงินเดือน ลูกจ้างชั่วคราว-พกส.(ปฏิบัติงาน) รายคน
  * 
  */
 public function salary_emp()
 {
     if (Session::get('level') != '') {
         $pdf = new TCPDF();
         $pdf->SetPrintHeader(false);
         $pdf->SetPrintFooter(false);
         $pdf->SetDisplayMode('fullpage', 'SinglePage', 'UseNone');
         $n = DB::select('select * from s_general_data');
         foreach ($n as $k) {
             $name = $k->name;
         }
         $sql = ' select concat(n.pname,"",n.fname," ",n.lname) as name,salary, salary_other ';
         $sql .= ' , salary_sso, salary_cpk ';
         $sql .= ' , save, shop, rice ';
         $sql .= ' , water, elec, other ';
         $sql .= ' from n_datageneral n ';
         $sql .= ' inner join  s_salary_detail s on s.cid=n.cid where month(s.order_date)=' . $this->max_month() . ' and year(s.order_date)=' . $this->max_year() . ' order by n.datainfoID asc';
         $result = DB::select($sql);
         $i = 0;
         $n = 0;
         foreach ($result as $key) {
             $i++;
             $n++;
             if ($i == 5) {
                 $i = 0;
                 $i++;
             }
             if ($i == 1) {
                 $pdf->AddPage('L', 'letter');
             }
             $linestyle03 = array('width' => 0.1, 'cap' => 'butt', 'join' => 'miter', 'dash' => '5,10,5,10', 'phase' => 0, 'color' => array(0, 0, 0));
             $pdf->Line(0.4, 210, 0.4, 0, $linestyle03);
             $linestyle00 = array('width' => 0.1, 'cap' => 'butt', 'join' => 'miter', 'dash' => '5,10,5,10', 'phase' => 0, 'color' => array(0, 0, 0));
             $pdf->Line(68, 210, 68, 0, $linestyle00);
             $linestyle01 = array('width' => 0.1, 'cap' => 'butt', 'join' => 'miter', 'dash' => '5,10,5,10', 'phase' => 0, 'color' => array(0, 0, 0));
             $pdf->Line(136, 210, 136, 0, $linestyle01);
             $linestyle02 = array('width' => 0.1, 'cap' => 'butt', 'join' => 'miter', 'dash' => '5,10,5,10', 'phase' => 0, 'color' => array(0, 0, 0));
             $pdf->Line(204, 210, 204, 0, $linestyle02);
             $linestyle04 = array('width' => 0.1, 'cap' => 'butt', 'join' => 'miter', 'dash' => '5,10,5,10', 'phase' => 0, 'color' => array(0, 0, 0));
             $pdf->Line(272, 210, 272, 0, $linestyle04);
             if ($i == 1) {
                 $pdf->SetY(9);
                 $pdf->SetX(1);
             }
             if ($i == 2) {
                 $pdf->SetY(9);
                 $pdf->SetX(69);
             }
             if ($i == 3) {
                 $pdf->SetY(9);
                 $pdf->SetX(137);
             }
             if ($i == 4) {
                 $pdf->SetY(9);
                 $pdf->SetX(205);
             }
             $pdf->SetFont('freeserif', '', 14, '', true);
             $pdf->MultiCell(66, 5, $name, 0, 'C', 0, 1, '', '', true);
             if ($i == 1) {
                 $pdf->SetY(15);
                 $pdf->SetX(1);
             }
             if ($i == 2) {
                 $pdf->SetY(15);
                 $pdf->SetX(69);
             }
             if ($i == 3) {
                 $pdf->SetY(15);
                 $pdf->SetX(137);
             }
             if ($i == 4) {
                 $pdf->SetY(15);
                 $pdf->SetX(205);
             }
             $pdf->MultiCell(66, 5, 'ประจำเดือน ' . $this->get_monthyearThai($this->max_month(), $this->max_year()), 0, 'L', 0, 1, '', '', true);
             if ($i == 1) {
                 $pdf->SetY(18);
                 $pdf->SetX(1);
             }
             if ($i == 2) {
                 $pdf->SetY(18);
                 $pdf->SetX(69);
             }
             if ($i == 3) {
                 $pdf->SetY(18);
                 $pdf->SetX(137);
             }
             if ($i == 4) {
                 $pdf->SetY(18);
                 $pdf->SetX(205);
             }
             $pdf->MultiCell(70, 5, '__________________________', 0, 'L', 0, 1, '', '', true);
             $pdf->SetFont('freeserif', '', 12, '', true);
             if ($i == 1) {
                 $pdf->SetY(25);
                 $pdf->SetX(1);
             }
             if ($i == 2) {
                 $pdf->SetY(25);
                 $pdf->SetX(69);
             }
             if ($i == 3) {
                 $pdf->SetY(25);
                 $pdf->SetX(137);
             }
             if ($i == 4) {
                 $pdf->SetY(25);
                 $pdf->SetX(205);
             }
             $pdf->MultiCell(69, 5, '(' . $n . ')' . ' ชื่อ  ' . $key->name, 0, 'L', 0, 1, '', '', true);
             $pdf->Ln(2);
             if ($i == 1) {
                 $pdf->SetY(35);
                 $pdf->SetX(1);
             }
             if ($i == 2) {
                 $pdf->SetY(35);
                 $pdf->SetX(69);
             }
             if ($i == 3) {
                 $pdf->SetY(35);
                 $pdf->SetX(137);
             }
             if ($i == 4) {
                 $pdf->SetY(35);
                 $pdf->SetX(205);
             }
             $pdf->MultiCell(40, 5, 'เงินเดือนรวม', 0, 'L', 0, 0, '', '', true);
             $pdf->MultiCell(26, 5, number_format($key->salary, 2), 0, 'R', 0, 1, '', '', true);
             if ($i == 1) {
                 $pdf->SetY(42);
                 $pdf->SetX(1);
             }
             if ($i == 2) {
                 $pdf->SetY(42);
                 $pdf->SetX(69);
             }
             if ($i == 3) {
                 $pdf->SetY(42);
                 $pdf->SetX(137);
             }
             if ($i == 4) {
                 $pdf->SetY(42);
                 $pdf->SetX(205);
             }
             $pdf->MultiCell(40, 5, 'รับอื่น ๆ รวม', 0, 'L', 0, 0, '', '', true);
             $pdf->MultiCell(26, 5, number_format($key->salary_other, 2), 0, 'R', 0, 1, '', '', true);
             if ($i == 1) {
                 $pdf->SetY(49);
                 $pdf->SetX(1);
             }
             if ($i == 2) {
                 $pdf->SetY(49);
                 $pdf->SetX(69);
             }
             if ($i == 3) {
                 $pdf->SetY(49);
                 $pdf->SetX(137);
             }
             if ($i == 4) {
                 $pdf->SetY(49);
                 $pdf->SetX(205);
             }
             $pdf->MultiCell(40, 5, 'ประกันสังคม', 0, 'L', 0, 0, '', '', true);
             $pdf->MultiCell(26, 5, number_format($key->salary_sso, 2), 0, 'R', 0, 1, '', '', true);
             if ($i == 1) {
                 $pdf->SetY(56);
                 $pdf->SetX(1);
             }
             if ($i == 2) {
                 $pdf->SetY(56);
                 $pdf->SetX(69);
             }
             if ($i == 3) {
                 $pdf->SetY(56);
                 $pdf->SetX(137);
             }
             if ($i == 4) {
                 $pdf->SetY(56);
                 $pdf->SetX(205);
             }
             $pdf->MultiCell(40, 5, 'ฌกส', 0, 'L', 0, 0, '', '', true);
             $pdf->MultiCell(26, 5, number_format($key->salary_cpk, 2), 0, 'R', 0, 1, '', '', true);
             if ($i == 1) {
                 $pdf->SetY(63);
                 $pdf->SetX(1);
             }
             if ($i == 2) {
                 $pdf->SetY(63);
                 $pdf->SetX(69);
             }
             if ($i == 3) {
                 $pdf->SetY(63);
                 $pdf->SetX(137);
             }
             if ($i == 4) {
                 $pdf->SetY(63);
                 $pdf->SetX(205);
             }
             $pdf->MultiCell(40, 5, 'ค่าธรรมเนียมธนาคาร', 0, 'L', 0, 0, '', '', true);
             $pdf->MultiCell(26, 5, number_format($key->save, 2), 0, 'R', 0, 1, '', '', true);
             if ($i == 1) {
                 $pdf->SetY(70);
                 $pdf->SetX(1);
             }
             if ($i == 2) {
                 $pdf->SetY(70);
                 $pdf->SetX(69);
             }
             if ($i == 3) {
                 $pdf->SetY(70);
                 $pdf->SetX(137);
             }
             if ($i == 4) {
                 $pdf->SetY(70);
                 $pdf->SetX(205);
             }
             $pdf->MultiCell(40, 5, 'สหกรณ์ร้านค้า', 0, 'L', 0, 0, '', '', true);
             $pdf->MultiCell(26, 5, number_format($key->shop, 2), 0, 'R', 0, 1, '', '', true);
             if ($i == 1) {
                 $pdf->SetY(77);
                 $pdf->SetX(1);
             }
             if ($i == 2) {
                 $pdf->SetY(77);
                 $pdf->SetX(69);
             }
             if ($i == 3) {
                 $pdf->SetY(77);
                 $pdf->SetX(137);
             }
             if ($i == 4) {
                 $pdf->SetY(77);
                 $pdf->SetX(205);
             }
             $pdf->MultiCell(40, 5, 'ลากิจ', 0, 'L', 0, 0, '', '', true);
             $pdf->MultiCell(26, 5, number_format($key->rice, 2), 0, 'R', 0, 1, '', '', true);
             if ($i == 1) {
                 $pdf->SetY(84);
                 $pdf->SetX(1);
             }
             if ($i == 2) {
                 $pdf->SetY(84);
                 $pdf->SetX(69);
             }
             if ($i == 3) {
                 $pdf->SetY(84);
                 $pdf->SetX(137);
             }
             if ($i == 4) {
                 $pdf->SetY(84);
                 $pdf->SetX(205);
             }
             $pdf->MultiCell(40, 5, 'ค่าน้ำประปา', 0, 'L', 0, 0, '', '', true);
             $pdf->MultiCell(26, 5, number_format($key->water, 2), 0, 'R', 0, 1, '', '', true);
             if ($i == 1) {
                 $pdf->SetY(91);
                 $pdf->SetX(1);
             }
             if ($i == 2) {
                 $pdf->SetY(91);
                 $pdf->SetX(69);
             }
             if ($i == 3) {
                 $pdf->SetY(91);
                 $pdf->SetX(137);
             }
             if ($i == 4) {
                 $pdf->SetY(91);
                 $pdf->SetX(205);
             }
             $pdf->MultiCell(40, 5, 'ค่าไฟฟ้า', 0, 'L', 0, 0, '', '', true);
             $pdf->MultiCell(26, 5, number_format($key->elec, 2), 0, 'R', 0, 1, '', '', true);
             if ($i == 1) {
                 $pdf->SetY(98);
                 $pdf->SetX(1);
             }
             if ($i == 2) {
                 $pdf->SetY(98);
                 $pdf->SetX(69);
             }
             if ($i == 3) {
                 $pdf->SetY(98);
                 $pdf->SetX(137);
             }
             if ($i == 4) {
                 $pdf->SetY(98);
                 $pdf->SetX(205);
             }
             $pdf->MultiCell(40, 5, 'ค่าใช้จ่ายอื่น ๆ', 0, 'L', 0, 0, '', '', true);
             $pdf->MultiCell(26, 5, number_format($key->other, 2), 0, 'R', 0, 1, '', '', true);
             if ($i == 1) {
                 $pdf->SetY(105);
                 $pdf->SetX(1);
             }
             if ($i == 2) {
                 $pdf->SetY(105);
                 $pdf->SetX(69);
             }
             if ($i == 3) {
                 $pdf->SetY(105);
                 $pdf->SetX(137);
             }
             if ($i == 4) {
                 $pdf->SetY(105);
                 $pdf->SetX(205);
             }
             $pdf->MultiCell(70, 5, '______________________________', 0, 'L', 0, 1, '', '', true);
             $pdf->Ln(2);
             if ($i == 1) {
                 $pdf->SetY(112);
                 $pdf->SetX(1);
             }
             if ($i == 2) {
                 $pdf->SetY(112);
                 $pdf->SetX(69);
             }
             if ($i == 3) {
                 $pdf->SetY(112);
                 $pdf->SetX(137);
             }
             if ($i == 4) {
                 $pdf->SetY(112);
                 $pdf->SetX(205);
             }
             $pdf->MultiCell(40, 5, 'รวมรับ', 0, 'L', 0, 0, '', '', true);
             $pdf->MultiCell(26, 5, number_format($key->salary + $key->salary_other, 2), 0, 'R', 0, 1, '', '', true);
             $pdf->Ln(4);
             if ($i == 1) {
                 $pdf->SetY(121);
                 $pdf->SetX(1);
             }
             if ($i == 2) {
                 $pdf->SetY(121);
                 $pdf->SetX(69);
             }
             if ($i == 3) {
                 $pdf->SetY(121);
                 $pdf->SetX(137);
             }
             if ($i == 4) {
                 $pdf->SetY(121);
                 $pdf->SetX(205);
             }
             $pdf->MultiCell(40, 5, 'รวมหัก', 0, 'L', 0, 0, '', '', true);
             $pdf->MultiCell(26, 5, number_format($key->salary_sso + $key->salary_cpk + $key->save + $key->shop + $key->rice + $key->water + $key->elec + $key->other, 2), 0, 'R', 0, 1, '', '', true);
             if ($i == 1) {
                 $linestyle2 = array('width' => 0.5, 'cap' => 'butt', 'join' => 'miter', 'dash' => '', 'phase' => 0, 'color' => array(0, 0, 0));
                 $pdf->Line(1, 126, 66, 126, $linestyle2);
             }
             if ($i == 2) {
                 $linestyle2 = array('width' => 0.5, 'cap' => 'butt', 'join' => 'miter', 'dash' => '', 'phase' => 0, 'color' => array(0, 0, 0));
                 $pdf->Line(69, 126, 134, 126, $linestyle2);
             }
             if ($i == 3) {
                 $linestyle2 = array('width' => 0.5, 'cap' => 'butt', 'join' => 'miter', 'dash' => '', 'phase' => 0, 'color' => array(0, 0, 0));
                 $pdf->Line(137, 126, 202, 126, $linestyle2);
             }
             if ($i == 4) {
                 $linestyle2 = array('width' => 0.5, 'cap' => 'butt', 'join' => 'miter', 'dash' => '', 'phase' => 0, 'color' => array(0, 0, 0));
                 $pdf->Line(205, 126, 270, 126, $linestyle2);
             }
             $pdf->Ln(4);
             if ($i == 1) {
                 $pdf->SetY(130);
                 $pdf->SetX(1);
             }
             if ($i == 2) {
                 $pdf->SetY(130);
                 $pdf->SetX(69);
             }
             if ($i == 3) {
                 $pdf->SetY(130);
                 $pdf->SetX(137);
             }
             if ($i == 4) {
                 $pdf->SetY(130);
                 $pdf->SetX(205);
             }
             $pdf->MultiCell(40, 1, 'รับจริง', 0, 'L', 0, 0, '', '', true);
             $pdf->MultiCell(26, 1, number_format($key->salary + $key->salary_other - ($key->salary_sso + $key->salary_cpk + $key->save + $key->shop + $key->rice + $key->water + $key->elec + $key->other), 2), 0, 'R', 0, 1, '', '', true);
             if ($i == 1) {
                 $linestyle3 = array('width' => 0.5, 'cap' => 'butt', 'join' => 'miter', 'dash' => '', 'phase' => 0, 'color' => array(0, 0, 0));
                 $pdf->Line(1, 135, 66, 135, $linestyle3);
             }
             if ($i == 2) {
                 $linestyle3 = array('width' => 0.5, 'cap' => 'butt', 'join' => 'miter', 'dash' => '', 'phase' => 0, 'color' => array(0, 0, 0));
                 $pdf->Line(69, 135, 134, 135, $linestyle3);
             }
             if ($i == 3) {
                 $linestyle3 = array('width' => 0.5, 'cap' => 'butt', 'join' => 'miter', 'dash' => '', 'phase' => 0, 'color' => array(0, 0, 0));
                 $pdf->Line(137, 135, 202, 135, $linestyle3);
             }
             if ($i == 4) {
                 $linestyle3 = array('width' => 0.5, 'cap' => 'butt', 'join' => 'miter', 'dash' => '', 'phase' => 0, 'color' => array(0, 0, 0));
                 $pdf->Line(205, 135, 270, 135, $linestyle3);
             }
             $pdf->Ln(4);
             if ($i == 1) {
                 $pdf->SetY(140);
                 $pdf->SetX(1);
             }
             if ($i == 2) {
                 $pdf->SetY(140);
                 $pdf->SetX(69);
             }
             if ($i == 3) {
                 $pdf->SetY(140);
                 $pdf->SetX(137);
             }
             if ($i == 4) {
                 $pdf->SetY(140);
                 $pdf->SetX(205);
             }
             $pdf->MultiCell(33, 5, 'ผู้รับเงิน', 0, 'L', 0, 0, '', '', true);
             $pdf->MultiCell(26, 5, 'ผู้จ่ายเงิน', 0, 'L', 0, 1, '', '', true);
         }
         $filename = storage_path() . '/report_salary_emp1.pdf';
         // Response::download($filename);
         $contents = $pdf->output($filename, 'I');
         $headers = array('Content-Type' => 'application/pdf');
         return Response::make($contents, 200, $headers);
     } else {
         return View::make('login.index');
     }
 }
Ejemplo n.º 7
0
$pdf->setFooterFont(array(PDF_FONT_NAME_DATA, '', PDF_FONT_SIZE_DATA));
// set default monospaced font
$pdf->SetDefaultMonospacedFont(PDF_FONT_MONOSPACED);
//set margins
$pdf->SetMargins(PDF_MARGIN_LEFT, PDF_MARGIN_TOP, PDF_MARGIN_RIGHT);
$pdf->SetHeaderMargin(PDF_MARGIN_HEADER);
$pdf->SetFooterMargin(PDF_MARGIN_FOOTER);
//set auto page breaks
$pdf->SetAutoPageBreak(TRUE, PDF_MARGIN_BOTTOM);
//set image scale factor
$pdf->setImageScale(PDF_IMAGE_SCALE_RATIO);
//set some language-dependent strings
$pdf->setLanguageArray($l);
// ---------------------------------------------------------
// set display mode
$pdf->SetDisplayMode($zoom = 'fullpage', $layout = 'TwoColumnRight', $mode = 'UseNone');
// set pdf viewer preferences
$pdf->setViewerPreferences(array('Duplex' => 'DuplexFlipLongEdge'));
// set booklet mode
$pdf->SetBooklet(true, 10, 30);
// set core font
$pdf->SetFont('helvetica', '', 18);
// add a page (left page)
$pdf->AddPage();
$pdf->Write(0, 'Example of booklet mode', '', 0, 'L', true, 0, false, false, 0);
// print a line using Cell()
$pdf->Cell(0, 0, 'PAGE 1', 1, 1, 'C');
// add a page (right page)
$pdf->AddPage();
// print a line using Cell()
$pdf->Cell(0, 0, 'PAGE 2', 1, 1, 'C');
Ejemplo n.º 8
0
$bank = stripslashes($_POST['bank']);
$bik = stripslashes($_POST['bik']);
$correspondent_account = stripslashes($_POST['correspondent_account']);
$banknote = stripslashes($_POST['banknote']);
$pence = stripslashes($_POST['pence']);
$order_id = stripslashes($_POST['order_id']);
$amount = stripslashes($_POST['amount']);
//set document properties
$pdf->setPrintHeader(false);
$pdf->setPrintFooter(false);
$pdf->setPageOrientation('P');
//set font for the entire document
$pdf->SetTextColor(0, 0, 0);
//set up a page
$pdf->AddPage();
$pdf->SetDisplayMode('real');
$pdf->SetFontSize(8);
// ширина квитанции
$width = 190;
// Высота половинки
$height = 75;
// ширина слушебного поля
$field_width = 80;
// Начальные координаты
$x = 10;
$y = 10;
// Первая рамка
$pdf->SetLineStyle(array('dash' => 2));
$pdf->SetXY($x, $y);
$pdf->Cell($width, $height, '', 1, 0, 'C', 0);
$pdf->SetXY($field_width + $x - 40, $y + 5);
Ejemplo n.º 9
0
$pdf->SetKeywords('TCPDF, PDF, example, test, guide');
// remove default header/footer
$pdf->setPrintHeader(false);
$pdf->setPrintFooter(false);
//set margins
$pdf->SetMargins(10, PDF_MARGIN_TOP, 10);
//set auto page breaks
$pdf->SetAutoPageBreak(TRUE, PDF_MARGIN_BOTTOM);
//set image scale factor
$pdf->setImageScale(PDF_IMAGE_SCALE_RATIO);
//set some language-dependent strings
$pdf->setLanguageArray($l);
//initialize document
$pdf->AliasNbPages();
// ---------------------------------------------------------
$pdf->SetDisplayMode("fullpage", "SinglePage", "UseNone");
// set font
$pdf->SetFont('times', "B", 20);
$pdf->AddPage("P", "A4");
$pdf->Cell(0, 0, "A4 PORTRAIT", 1, 1, 'C');
$pdf->AddPage("L", "A4");
$pdf->Cell(0, 0, "A4 LANDSCAPE", 1, 1, 'C');
$pdf->AddPage("P", "A5");
$pdf->Cell(0, 0, "A5 PORTRAIT", 1, 1, 'C');
$pdf->AddPage("L", "A5");
$pdf->Cell(0, 0, "A5 LANDSCAPE", 1, 1, 'C');
$pdf->AddPage("P", "A6");
$pdf->Cell(0, 0, "A6 PORTRAIT", 1, 1, 'C');
$pdf->AddPage("L", "A6");
$pdf->Cell(0, 0, "A6 LANDSCAPE", 1, 1, 'C');
$pdf->AddPage("P", "A7");
function FacilityDataEntryReportPDF($conn)
{
    global $gTEXT;
    global $SITETITLE;
    $Year = isset($_REQUEST['Year']) ? $_REQUEST['Year'] : '';
    $Month = isset($_REQUEST['Month']) ? $_REQUEST['Month'] : '';
    $RegionId = isset($_REQUEST['RegionId']) ? $_REQUEST['RegionId'] : '';
    $RegionName = isset($_REQUEST['RegionName']) ? $_REQUEST['RegionName'] : '';
    $MonthName = isset($_REQUEST['MonthName']) ? $_REQUEST['MonthName'] : '';
    $ItemGroupName = isset($_REQUEST['ItemGroupName']) ? $_REQUEST['ItemGroupName'] : '';
    $lastyear = getYearForLastMonth($Year, $Month);
    $lastmonth = getLastMonth($Year, $Month);
    $CFMStockId = isset($_REQUEST['CFMStockId']) ? $_REQUEST['CFMStockId'] : '';
    $CountryId = isset($_REQUEST['CountryId']) ? $_REQUEST['CountryId'] : '';
    //$DistrictId = isset($_REQUEST['DistrictId']) ? $_REQUEST['DistrictId'] : '';
    //$OwnerTypeId = isset($_REQUEST['OwnerTypeId']) ? $_REQUEST['OwnerTypeId'] : '';
    $Year = isset($_REQUEST['YearId']) ? $_REQUEST['YearId'] : '';
    $MonthId = isset($_REQUEST['MonthId']) ? $_REQUEST['MonthId'] : '';
    $MonthName = isset($_REQUEST['MonthName']) ? $_REQUEST['MonthName'] : '';
    $FacilityId = isset($_REQUEST['FacilityId']) ? $_REQUEST['FacilityId'] : '';
    require_once 'tcpdf/tcpdf.php';
    $pdf = new TCPDF(PDF_PAGE_ORIENTATION, PDF_UNIT, PDF_PAGE_FORMAT, true, 'UTF-8', false);
    $pdf->SetPrintHeader(false);
    $pdf->SetPrintFooter(false);
    $pdf->SetDefaultMonospacedFont(PDF_FONT_MONOSPACED);
    $pdf->SetMargins(PDF_MARGIN_LEFT, PDF_MARGIN_TOP, PDF_MARGIN_RIGHT);
    $pdf->SetHeaderMargin(PDF_MARGIN_HEADER);
    $pdf->SetFooterMargin(PDF_MARGIN_FOOTER);
    $pdf->SetAutoPageBreak(TRUE, PDF_MARGIN_BOTTOM);
    $pdf->SetMargins(PDF_MARGIN_LEFT, PDF_MARGIN_TOP, PDF_MARGIN_RIGHT);
    $pdf->setImageScale(PDF_IMAGE_SCALE_RATIO);
    if (@file_exists(dirname(__FILE__) . '/lang/eng.php')) {
        require_once dirname(__FILE__) . '/lang/eng.php';
        $pdf->setLanguageArray($l);
    }
    $pdf->SetDisplayMode('fullpage', 'SinglePage', 'UseNone');
    $pdf->SetFont('times', 'B', 20);
    $pdf->AddPage('L', 'A4');
    $sqlf = " SELECT FacilityId, FacilityName FROM t_facility WHERE FacilityId={$FacilityId}";
    $resultf = mysql_query($sqlf);
    $FacilityName = '';
    while ($row = mysql_fetch_array($resultf)) {
        $FacilityName = $row['FacilityName'];
    }
    $html3 = '<div class="padding-md clearfix" style="text-align:center;">
					<h2 style="text-align:center;">' . $SITETITLE . '</h2>
					<h4 style="text-align:center;">' . $gTEXT['Facility Level Patient And Stock Status List'] . '</h4>
					<h5 style="text-align:center;">' . $gTEXT['Facility'] . ': ' . $FacilityName . ',
					' . $gTEXT['Month'] . ': ' . $MonthName . ', 
					' . $gTEXT['Year'] . ': ' . $Year . '<h5>
			  </div>';
    $pdf->SetFont('dejavusans', '', 9);
    $pdf->writeHTMLCell(140, 20, 75, 10, $html3, '', 0, 0, false, 'C', true);
    //===============================facility data entry Table======================================
    function checkNullable($value)
    {
        $retVal = '';
        if ($value == 0) {
            $retVal = '';
        } else {
            $retVal = number_format($value);
        }
        return $retVal;
    }
    function checkNull($value)
    {
        $retVal = '';
        if ($value == 0) {
            $retVal = '';
        } else {
            $retVal = $value;
        }
        return $retVal;
    }
    $sql1 = " SELECT\n\t  b.CFMPOId,\n\t  a.FormulationName    PatientTypeName,\n\t  b.RefillPatient,\n\t  b.NewPatient,\n\t  b.TotalPatient\n\tFROM t_formulation a\n\t  INNER JOIN t_cfm_patientoverview b\n\t\tON a.FormulationId = b.FormulationId\n\tWHERE b.CFMStockId = {$CFMStockId}\n\t\tAND FacilityId = {$FacilityId}\n\t\tAND MonthId = {$MonthId}\n\t\tAND YEAR = '" . $Year . "'\n\t\tAND CountryId = {$CountryId}\n\tORDER BY b.CFMPOId ASC";
    $result = mysql_query($sql1);
    $total = mysql_num_rows($result);
    $sql7 = " SELECT CFMStockId, FacilityId, MonthId, Year, \n\t(SELECT b.name FROM  ykx9st_users b WHERE b.username = a.CreatedBy) CreatedBy, DATE_FORMAT(CreatedDt, '%d-%b-%Y %h:%i %p') CreatedDt,\n\t(SELECT b.name FROM  ykx9st_users b WHERE b.username = a.LastUpdateBy)  LastUpdateBy,\t\n\t(SELECT b.name FROM ykx9st_users b WHERE b.username = a.LastSubmittedBy) LastSubmittedBy ,\n\tc.StatusId, c.StatusName,\n\tDATE_FORMAT(LastUpdateDt, '%d-%b-%Y %h:%i %p') LastUpdateDt,\t\n\tDATE_FORMAT(LastSubmittedDt, '%d-%b-%Y %h:%i %p') LastSubmittedDt,\t\n\tDATE_FORMAT(a.AcceptedDt, '%d-%b-%Y %h:%i %p')  AcceptedDt,\t\n\t(SELECT b.name FROM ykx9st_users b WHERE b.username = a.PublishedBy) PublishedBy ,\n\tDATE_FORMAT(a.PublishedDt, '%d-%b-%Y %h:%i %p')  PublishedDt \t\n\tFROM t_cfm_masterstockstatus a LEFT JOIN t_status c ON a.StatusId = c.StatusId ";
    $sql7 .= " WHERE FacilityId = " . $FacilityId . " and MonthId = " . $MonthId . " and Year = '" . $Year . "' AND CountryId = {$CountryId} ";
    $result7 = mysql_query($sql7);
    $sql = "SELECT a.CFMStockStatusId, a.FacilityId, a.MonthId, a.Year, a.ItemGroupId, b.ItemSL, a.ItemNo, b.ItemName, OpStock OpStock_A, a.OpStock_C, a.ReceiveQty, a.DispenseQty, a.AdjustQty, a.AdjustId AdjustReason";
    $sql .= ",a.StockoutDays, a.StockOutReasonId, a.ClStock ClStock_A, a.ClStock_C, a.ClStockSourceId, a.MOS, a.AMC, a.AMC_C, a.AmcChangeReasonId, a.MaxQty, a.OrderQty, a.ActualQty, a.OUReasonId, \n\t a.UserId, a.LastEditTime, c.ProductSubGroupName FormulationName FROM t_cfm_stockstatus a, t_itemlist b, t_product_subgroup c ";
    $sql .= " WHERE a.CFMStockId = {$CFMStockId}\n\t\t\t\tAND `YEAR` = '{$Year}'\n\t\t\t\tAND MonthId = {$MonthId}\n\t\t\t\tAND CountryId = 1\n\t\t\t\tAND a.FacilityId =  {$FacilityId}\n\t\t\t\tAND a.ItemNo = b.ItemNo\n\t\t\t\tAND b.ProductSubGroupId = c.ProductSubGroupId ";
    $sql .= " ORDER BY b.ItemSL asc";
    $r = mysql_query($sql);
    $total = mysql_num_rows($r);
    if ($total > 0) {
        $data = array();
        $i = 0;
        $getRegimen = '';
        $htmlPrint1 = '';
        while ($row = mysql_fetch_array($result)) {
            $htmlPrint1 .= '<tr nobr="true">
				  <td style="text-align: left; word-wrap: break-word; width:30px;">' . ++$i . '</td>
				  <td style="text-align: left; word-wrap: break-word; width:100px;">' . $row['PatientTypeName'] . '</td>
				  <td style="text-align: right; width:40px;">' . checkNullable($row['TotalPatient']) . '</td>
			 </tr>';
        }
        $htmlC1 = '
	<style>
	.cl{clear:both;}
	.col4 {
		width: 260px;
		height: auto;
		float: left;
		overflow: hidden;
		padding: 20px;
		background: #00CCCC;
		font-size:10px;
		clear: left;
		}
	.col4 table, th, td {
		border: 1px solid black;
		padding: 2px;
	}
        
        .printw {
    height: auto;
    margin: 0 auto 50px;
    overflow: hidden;
    width: 1000px;
	}
	</style>       
	<div class="col4">
		<table  style="width: 200px;">
			<tr>
			 <th style="text-align: left; word-wrap: break-word; width:170px;" colspan="3">
                         ' . $gTEXT['Malaria case summary level'] . '</th> 
			</tr>
			<tr>
				<th style="text-align: left; width:30px;">' . $gTEXT['SL'] . '</th> 
				<th style="text-align: left; width:100px;">' . $gTEXT['Case Type'] . '</th> 
				<th style="text-align: left; width:40px;">' . $gTEXT['Total'] . '</th>
			</tr>
			' . $htmlPrint1 . '
		</table>
	</div>';
        $sql1 = " SELECT\n\t\t\t  b.CFMPatientStatusId,\n\t\t\t  c.FormulationId,\n\t\t\t  c.FormulationName,\n\t\t\t  b.RegimenId,\n\t\t\t  d.RegimenName RegimenMasterName,\n\t\t\t  a.GenderTypeId,\n\t\t\t  b.RefillPatient,\n\t\t\t  b.NewPatient,\n\t\t\t  b.TotalPatient\n\t\t\tFROM t_regimen a\n\t\t\t  INNER JOIN t_cfm_regimenpatient b\n\t\t\t    ON a.RegimenId = b.RegimenId\n\t\t\t  INNER JOIN t_formulation c\n\t\t\t    ON a.FormulationId = c.FormulationId\n\t\t\tINNER JOIN t_regimen_master d\n\t\t\t    ON a.RegMasterId = d.RegMasterId\n\t\t\tWHERE b.CFMStockId = {$CFMStockId}\n\t\t\t\tAND FacilityId = {$FacilityId}\n\t\t\t\tAND MonthId = {$MonthId}\n\t\t\t\tAND `Year` = '{$Year}'\n\t\t\t\tAND CountryId = {$CountryId}\n\t\t\tORDER BY c.FormulationName, b.RegimenId, a.GenderTypeId  desc";
        $result1 = mysql_query($sql1);
        $total = mysql_num_rows($result1);
        $tmpFormulationId = -1;
        $i = 0;
        $htmlPrint2 = '';
        while (@($row = mysql_fetch_array($result1))) {
            if ($tmpFormulationId != @$row['FormulationId']) {
                if ($i > 0) {
                    $htmlPrint2 .= '</tr>';
                }
                $htmlPrint2 .= '<tr nobr="true">
				  <td style="text-align: left; word-wrap: break-word; width:30px;">' . ++$i . '</td>
				  <td style="text-align: left; word-wrap: break-word; width:250px;">' . @$row['FormulationName'] . '</td>';
                $htmlPrint2 .= '<td style="text-align: right; width:70px;">' . checkNullable(@$row['TotalPatient']) . '</td>';
                $tmpFormulationId = @$row['FormulationId'];
            } else {
                $htmlPrint2 .= '<td style="text-align: right; width:70px;">' . checkNullable(@$row['TotalPatient']) . '</td>';
                $tmpFormulationId = @$row['FormulationId'];
            }
        }
        if ($i > 0) {
            $htmlPrint2 .= '</tr>';
        }
        $htmlC2 = '
	<style>
	.cl{clear:both;}
	.col4 {
		width: 300px;
		height: auto;
		float: left;
		overflow: hidden;
		padding: 20px;
		background: #00CCCC;
		font-size:10px;
		clear: left;
		}
	.col4 table, th, td {
		border: 1px solid black;
		padding: 2px;
	}
	</style>
	<div class="col4">
		<table  style="width: 800px;">
                        <tr>
			 <th style="text-align: left; word-wrap: break-word; width:770px;" colspan="9">
                         ' . $gTEXT['Malaria case details'] . '</th> 
			</tr>

			<tr nobr="true">
				<th style="text-align: left; word-wrap: break-word; width:30px;"></th> 
				<th style="text-align: left; word-wrap: break-word; width:250px;"></th> 
				<th style="text-align: center; width:140px;"  colspan="2">' . $gTEXT['0-4 Years'] . '</th>
				<th style="text-align: center; width:140px;"  colspan="2">' . $gTEXT['5-14 Years'] . '</th>
				<th style="text-align: center; width:140px;"  colspan="2">' . $gTEXT['15+ Years'] . '</th>
				<th style="text-align: left; width:70px;"></th>
			</tr>
			<tr nobr="true">
				<th style="text-align: left; word-wrap: break-word; width:30px;">' . $gTEXT['SL'] . '</th> 
				<th style="text-align: left; word-wrap: break-word; width:250px;">' . $gTEXT['Case Type'] . '</th> 
				<th style="text-align: right; width:70px;">' . $gTEXT['M'] . '</th>
				<th style="text-align: right; width:70px;">' . $gTEXT['F'] . '</th>
				<th style="text-align: right; width:70px;">' . $gTEXT['M'] . '</th>
				<th style="text-align: right; width:70px;">' . $gTEXT['F'] . '</th>
				<th style="text-align: right; width:70px;">' . $gTEXT['M'] . '</th>
				<th style="text-align: right; width:70px;">' . $gTEXT['F'] . '</th>
				<th style="text-align: right; width:70px;">' . $gTEXT['Pregnant Women'] . '</th>
			</tr>
			' . $htmlPrint2 . '
		</table>
	</div>';
        $f = 0;
        $tblHTML = '';
        $tempGroupId = '';
        while (@($rec = mysql_fetch_array($r))) {
            $data['SL'][$f] = $f;
            $data['ItemName'][$f] = @$rec['ItemName'];
            $data['OpStock_A'][$f] = checkNullable(@$rec['OpStock_A']);
            $data['ReceiveQty'][$f] = checkNullable(@$rec['ReceiveQty']);
            $data['ActualQty'][$f] = checkNullable(@$rec['ActualQty']);
            $data['DispenseQty'][$f] = checkNullable(@$rec['DispenseQty']);
            $data['AdjustQty'][$f] = checkNullable(@$rec['AdjustQty']);
            $data['AdjustReason'][$f] = @$rec['AdjustReason'];
            $data['StockoutDays'][$f] = @$rec['StockoutDays'];
            $data['StockOutReasonName'][$f] = @$rec['StockOutReasonName'];
            $data['ClStock_A'][$f] = checkNullable(@$rec['ClStock_A']);
            $data['AMC'][$f] = checkNullable(@$rec['AMC']);
            $data['MOS'][$f] = checkNull(number_format(@$rec['MOS'], 1));
            $data['MaxQty'][$f] = checkNullable(@$rec['MaxQty']);
            $data['OrderQty'][$f] = checkNullable(@$rec['OrderQty'] < 0 ? 0 : @$rec['OrderQty']);
            $data['ActualQty'][$f] = checkNullable(@$rec['ActualQty'] < 0 ? 0 : @$rec['ActualQty']);
            $data['OUReason'][$f] = @$rec['OUReason'];
            $tblHTML .= '<tr style="page-break-inside:avoid;">
            				<td align="center" width="30" valign="middle">' . ($data['SL'][$f] + 1) . '</td>  
                            <td align="left" width="157" valign="middle">' . $data['ItemName'][$f] . '</td>
                            <td align="right" width="50" valign="middle">' . $data['OpStock_A'][$f] . '</td>
                            <td align="right" width="50" valign="middle">' . $data['ReceiveQty'][$f] . '</td> 
                            <td align="right" width="50" valign="middle">' . $data['DispenseQty'][$f] . '</td>
                            <td align="right" width="50" valign="middle">' . $data['AdjustQty'][$f] . '</td>
                            <td align="left" width="55" valign="middle">' . $data['AdjustReason'][$f] . '</td> 
							<td align="right" width="50" valign="middle">' . $data['StockoutDays'][$f] . '</td> 
							<td align="left" width="55" valign="middle">' . $data['StockOutReasonName'][$f] . '</td> 
                            <td align="right" width="50" valign="middle">' . $data['ClStock_A'][$f] . '</td> 
                            <td align="right" width="50" valign="middle">' . $data['AMC'][$f] . '</td>
                            <td align="right" width="50" valign="middle">' . $data['MOS'][$f] . '</td>
                            <td align="right" width="50" valign="middle">' . $data['MaxQty'][$f] . '</td> 
							<td align="right" width="50" valign="middle">' . $data['OrderQty'][$f] . '</td> 
							<td align="right" width="60" valign="middle">' . $data['ActualQty'][$f] . '</td>
							<td align="left" width="100" valign="middle">' . $data['OUReason'][$f] . '</td>  
                    </tr>';
            $f++;
        }
        $headertable = '';
        while (@($row = mysql_fetch_array($result7))) {
            $headertable = '<tr>
						<td align="left" width="80" valign="middle">
						' . $gTEXT['Report Id'] . ' : ' . @$row['CFMStockId'] . '</td>
						<td align="left" width="220" valign="middle">
						' . $gTEXT['Created By'] . ' : ' . @$row['CreatedBy'] . '</td> 
						<td align="left" width="220" valign="middle">
						' . $gTEXT['Last Upadated By'] . ' : ' . @$row['LastUpdateBy'] . '</td>
						<td align="left" width="220" valign="middle">
						' . $gTEXT['Submitted By'] . ' : ' . @$row['LastSubmittedBy'] . '</td>
						<td align="left" width="220" valign="middle">
						' . $gTEXT['Published By'] . ' : ' . @$row['PublishedBy'] . '</td>
				  </tr>
				  <tr>
						<td align="left" width="80" valign="middle">
						<b style="font-size:11px;">' . @$row['StatusName'] . '</b></td>
						<td align="left" width="220" valign="middle">
						' . $gTEXT['Created Date'] . ' : ' . @$row['CreatedDt'] . '</td> 
						<td align="left" width="220" valign="middle">
						' . $gTEXT['Last Updated Date'] . ' : ' . @$row['LastUpdateDt'] . '</td>
						<td align="left" width="220" valign="middle">
						' . $gTEXT['Submitted Date'] . ' : ' . @$row['LastSubmittedDt'] . '</td>
						<td align="left" width="220" valign="middle">
						' . $gTEXT['Published Date'] . ' : ' . @$row['PublishedDt'] . '</td>
				  </tr>';
        }
        $htmlHead = '
            <style>
             td{
                 height: 6px;
                 line-height:3px;
             }
            th{
                height: 20;
                font-size:9px;
            }
		
            </style>
			<div style="margin:0 0 10px 0;">
			<table width="100%" border="0.5" style="margin:0 auto;" class="clearfix">
            	  ' . $headertable . '
			</table>
			</div>
			<div class="clearfix"></div>';
        $htmlC5 = '
            <style>
             td{
                 height: 6px;
                 line-height:3px;
             }
            th{
                height: 20;
                font-size:9px;
            }
		
            </style>
			<div class="clearfix"></div>
                          <div class="col-xs-12" style="font-weight:bold; font-size:14px; padding-left:6px; text-align:left;">' . $gTEXT['Stock Information'] . '</div>
            <table width="100%" border="0.5" style="margin:0 auto;">
                       
                                        <tr>
						<th align="center" width="30" valign="middle">' . $gTEXT['SL'] . '#</th>
						<th align="left" width="157" valign="middle">' . $gTEXT['Item'] . '</th> 
						<th align="right" width="50" valign="middle">' . $gTEXT['OBL (A)'] . '</th>
						<th align="right" width="50" valign="middle">' . $gTEXT['Received (B)'] . '</th>
						<th align="right" width="50" valign="middle">' . $gTEXT['Dispensed (C)'] . '</th> 
						<th align="right" width="50" valign="middle">' . $gTEXT['Adjusted (+-D)'] . '</th> 
						<th align="left" width="55" valign="middle">' . $gTEXT['Adjust Reason'] . '</th>
						<th align="right" width="50" valign="middle">' . $gTEXT['Stock Out Days'] . '</th> 
						<th align="left" width="55" valign="middle">' . $gTEXT['Stock Out Reason'] . '</th> 
						<th align="right" width="50" valign="middle">' . $gTEXT['Closing Balance (E)'] . '</th>
						<th align="right" width="50" valign="middle">' . $gTEXT['AMC (F)'] . '</th> 
						<th align="right" width="50" valign="middle">' . $gTEXT['MOS (G)'] . '</th> 
						<th align="right" width="50" valign="middle">' . $gTEXT['Max Qty (H)'] . '</th>
						<th align="right" width="50" valign="middle">' . $gTEXT['Order Qty (I)'] . '</th> 
						<th align="right" width="60" valign="middle">' . $gTEXT['Actual Order Qty (J)'] . '</th>
						<th align="left" width="100" valign="middle">' . $gTEXT['Order Qty Update Reason'] . '</th> 
            	  </tr>' . $tblHTML . '</table>';
        //echo $htmlC2;
        $pdf->SetFont('dejavusans', '', 7);
        $pdf->writeHTMLCell(0, 50, 10, 40, $htmlHead, '', 0, 0, false, 'C', true);
        $pdf->writeHTMLCell(0, 50, 10, 63, $htmlC1, '', 0, 0, false, 'C', true);
        $pdf->writeHTMLCell(0, 50, 63, 63, $htmlC2, '', 0, 0, false, 'C', true);
        //$pdf->writeHTMLCell(0, 50, 132, 60, $htmlC3, '', 0, 0, false, 'C', true);
        //$pdf->writeHTMLCell(0, 50, 208, 60, $htmlC4, '', 0, 0, false, 'C', true);
        $pdf->writeHTMLCell(0, 50, 10, 140, $htmlC5, '', 0, 0, false, 'C', true);
        //$pdf->writeHTMLCell(0, 50, 10, 290, $htmlC5, '', 0, 0, false, 'C', true);
        //$pdf->Cell(0, 0, $htmlC5, 1, 1, 'C');
        $pdf->endPage();
        $filename = 'Facility_Level_Patient_And_Stock_Status_' . $ItemGroupName . '_' . $MonthName . '_' . $Year . '.pdf';
        $filePath = SITEDOCUMENT . 'administrator/components/com_jcode/source/report/pdfslice/' . $filename;
        if (file_exists($filePath)) {
            unlink($filePath);
        }
        $pdf->Output('pdfslice/' . $filename, 'F');
        echo $filename;
    } else {
        echo 'Processing Error';
    }
}
Ejemplo n.º 11
0
 public function testPdfOutput()
 {
     // create new PDF document
     $pdf = new TCPDF(PDF_PAGE_ORIENTATION, PDF_UNIT, PDF_PAGE_FORMAT, true, 'UTF-8', false);
     // set document information
     $pdf->SetCreator(PDF_CREATOR);
     $pdf->SetAuthor('Nicola Asuni');
     $pdf->SetTitle('TCPDF Example 028');
     $pdf->SetSubject('TCPDF Tutorial');
     $pdf->SetKeywords('TCPDF, PDF, example, test, guide');
     // remove default header/footer
     $pdf->setPrintHeader(false);
     $pdf->setPrintFooter(false);
     // set default monospaced font
     $pdf->SetDefaultMonospacedFont(PDF_FONT_MONOSPACED);
     // set margins
     $pdf->SetMargins(10, PDF_MARGIN_TOP, 10);
     // set auto page breaks
     $pdf->SetAutoPageBreak(TRUE, PDF_MARGIN_BOTTOM);
     // set image scale factor
     $pdf->setImageScale(PDF_IMAGE_SCALE_RATIO);
     // set some language-dependent strings (optional)
     $pdf->setLanguageArray($this->langSettings);
     // ---------------------------------------------------------
     $pdf->SetDisplayMode('fullpage', 'SinglePage', 'UseNone');
     // set font
     $pdf->SetFont('times', 'B', 20);
     $pdf->AddPage('P', 'A4');
     $pdf->Cell(0, 0, 'A4 PORTRAIT', 1, 1, 'C');
     $pdf->AddPage('L', 'A4');
     $pdf->Cell(0, 0, 'A4 LANDSCAPE', 1, 1, 'C');
     $pdf->AddPage('P', 'A5');
     $pdf->Cell(0, 0, 'A5 PORTRAIT', 1, 1, 'C');
     $pdf->AddPage('L', 'A5');
     $pdf->Cell(0, 0, 'A5 LANDSCAPE', 1, 1, 'C');
     $pdf->AddPage('P', 'A6');
     $pdf->Cell(0, 0, 'A6 PORTRAIT', 1, 1, 'C');
     $pdf->AddPage('L', 'A6');
     $pdf->Cell(0, 0, 'A6 LANDSCAPE', 1, 1, 'C');
     $pdf->AddPage('P', 'A7');
     $pdf->Cell(0, 0, 'A7 PORTRAIT', 1, 1, 'C');
     $pdf->AddPage('L', 'A7');
     $pdf->Cell(0, 0, 'A7 LANDSCAPE', 1, 1, 'C');
     // --- test backward editing ---
     $pdf->setPage(1, true);
     $pdf->SetY(50);
     $pdf->Cell(0, 0, 'A4 test', 1, 1, 'C');
     $pdf->setPage(2, true);
     $pdf->SetY(50);
     $pdf->Cell(0, 0, 'A4 test', 1, 1, 'C');
     $pdf->setPage(3, true);
     $pdf->SetY(50);
     $pdf->Cell(0, 0, 'A5 test', 1, 1, 'C');
     $pdf->setPage(4, true);
     $pdf->SetY(50);
     $pdf->Cell(0, 0, 'A5 test', 1, 1, 'C');
     $pdf->setPage(5, true);
     $pdf->SetY(50);
     $pdf->Cell(0, 0, 'A6 test', 1, 1, 'C');
     $pdf->setPage(6, true);
     $pdf->SetY(50);
     $pdf->Cell(0, 0, 'A6 test', 1, 1, 'C');
     $pdf->setPage(7, true);
     $pdf->SetY(40);
     $pdf->Cell(0, 0, 'A7 test', 1, 1, 'C');
     $pdf->setPage(8, true);
     $pdf->SetY(40);
     $pdf->Cell(0, 0, 'A7 test', 1, 1, 'C');
     $pdf->lastPage();
     $this->comparePdfs($pdf);
 }
Ejemplo n.º 12
0
function CreatePDF($mysqli, $otchet)
{
    //    $rus = array('А', 'Б', 'В', 'Г', 'Д', 'Е', 'Ё', 'Ж', 'З', 'И', 'Й', 'К', 'Л', 'М', 'Н', 'О', 'П', 'Р', 'С', 'Т', 'У', 'Ф', 'Х', 'Ц', 'Ч', 'Ш', 'Щ', 'Ъ', 'Ы', 'Ь', 'Э', 'Ю', 'Я', 'а', 'б', 'в', 'г', 'д', 'е', 'ё', 'ж', 'з', 'и', 'й', 'к', 'л', 'м', 'н', 'о', 'п', 'р', 'с', 'т', 'у', 'ф', 'х', 'ц', 'ч', 'ш', 'щ', 'ъ', 'ы', 'ь', 'э', 'ю', 'я');
    //    $lat = array('A', 'B', 'V', 'G', 'D', 'E', 'E', 'Gh', 'Z', 'I', 'Y', 'K', 'L', 'M', 'N', 'O', 'P', 'R', 'S', 'T', 'U', 'F', 'H', 'C', 'Ch', 'Sh', 'Sch', 'Y', 'Y', 'Y', 'E', 'Yu', 'Ya', 'a', 'b', 'v', 'g', 'd', 'e', 'e', 'gh', 'z', 'i', 'y', 'k', 'l', 'm', 'n', 'o', 'p', 'r', 's', 't', 'u', 'f', 'h', 'c', 'ch', 'sh', 'sch', 'y', 'y', 'y', 'e', 'yu', 'ya');
    //set document properties
    $pdf = new TCPDF('P', 'mm', 'A4', true, 'utf-8');
    $pdf->SetMargins(20, 30, 20);
    $pdf->AddPage();
    $pdf->SetFont('dejavusans', "", 10);
    $pdf->SetTitle($otchet);
    $pdf->SetXY(20, 50);
    $pdf->SetDrawColor(100, 100, 0);
    $pdf->SetTextColor(0, 0, 0);
    $pdf->SetDisplayMode('real', 'default');
    //insert an image and make it a link
    ///$pdf->Image('logo.png',10,20,33,0,' ','http://www.fpdf.org/');
    //display the title with a border around it
    $pdf->SetXY(50, 20);
    $pdf->Cell(130, 10, $otchet, 1, 0, 'C', 0);
    if ($otchet == 'Отчет по Ключевым словам') {
        $pdf->SetXY(50, 50);
        $pdf->SetFontSize(12);
        $pdf->MultiCell(40, 12, 'Номер категории', 1, 'C', 0);
        $pdf->SetXY(90, 50);
        $pdf->MultiCell(50, 12, 'Категория', 1, 'C', 0);
        $pdf->SetXY(140, 50);
        $pdf->MultiCell(40, 12, 'Количество просмотров', 1, 'C', 0);
        ///Таблица статистики
        $search = array();
        $s = $mysqli->prepare("SELECT * FROM Category1 ORDER BY stat");
        $s->execute();
        $result = $s->get_result();
        $y = 62;
        while ($obj = $result->fetch_assoc()) {
            $pdf->SetXY(50, $y);
            $pdf->SetFontSize(10);
            $pdf->MultiCell(40, 20, $obj['id'] . "_1", 1, 'C', 0);
            $pdf->SetXY(90, $y);
            $pdf->MultiCell(50, 20, $obj['categ'], 1, 'C', 0);
            $pdf->SetXY(140, $y);
            $pdf->MultiCell(40, 20, $obj['stat'], 1, 'C', 0);
            $y += 20;
        }
        $s = $mysqli->prepare("SELECT * FROM Category2 ORDER BY stat");
        $s->execute();
        $result = $s->get_result();
        while ($obj = $result->fetch_assoc()) {
            $pdf->SetXY(50, $y);
            $pdf->SetFontSize(10);
            $pdf->MultiCell(40, 20, $obj['id2'] . "_2", 1, 'C', 0);
            $pdf->SetXY(90, $y);
            $pdf->MultiCell(50, 20, $obj['categ2'], 1, 'C', 0);
            $pdf->SetXY(140, $y);
            $pdf->MultiCell(40, 20, $obj['stat'], 1, 'C', 0);
            $y += 20;
        }
    } else {
        $pdf->SetXY(30, 50);
        $pdf->SetFontSize(12);
        $pdf->MultiCell(40, 10, 'Номер новости', 1, 'C', 0);
        $pdf->SetXY(70, 50);
        $pdf->MultiCell(50, 10, 'Заголовок новости', 1, 'C', 0);
        $pdf->SetXY(120, 50);
        $pdf->MultiCell(40, 10, 'Категория', 1, 'C', 0);
        $pdf->SetXY(160, 50);
        $pdf->MultiCell(30, 10, 'Статистика', 1, 'C', 0);
        ///Таблица статистики
        $sth = $mysqli->prepare("SELECT * FROM News,Category2 WHERE News.id_cat2 = Category2.id2");
        $sth->execute();
        $result = $sth->get_result();
        $y = 60;
        while ($obj = $result->fetch_assoc()) {
            $pdf->SetXY(30, $y);
            $pdf->SetFontSize(10);
            $pdf->MultiCell(40, 20, $obj['id'], 1, 'C', 0);
            $pdf->SetXY(70, $y);
            $pdf->MultiCell(50, 20, $obj['title'] . '...', 1, 'C', 0);
            $pdf->SetXY(120, $y);
            $pdf->MultiCell(40, 20, $obj['categ2'], 1, 'C', 0);
            $pdf->SetXY(160, $y);
            $pdf->MultiCell(30, 20, $obj['colview'], 1, 'C', 0);
            $y += 20;
        }
    }
    //Output the document
    $pdf->OutPut('otchet.pdf');
}
Ejemplo n.º 13
-1
 public function testPdfOutput()
 {
     // create new PDF document
     $pdf = new TCPDF(PDF_PAGE_ORIENTATION, PDF_UNIT, PDF_PAGE_FORMAT, true, 'UTF-8', false);
     // set document information
     $pdf->SetCreator(PDF_CREATOR);
     $pdf->SetAuthor('Nicola Asuni');
     $pdf->SetTitle('TCPDF Example 040');
     $pdf->SetSubject('TCPDF Tutorial');
     $pdf->SetKeywords('TCPDF, PDF, example, test, guide');
     // set default header data
     $pdf->SetHeaderData(PDF_HEADER_LOGO, PDF_HEADER_LOGO_WIDTH, PDF_HEADER_TITLE . ' 040', PDF_HEADER_STRING);
     // set header and footer fonts
     $pdf->setHeaderFont(array(PDF_FONT_NAME_MAIN, '', PDF_FONT_SIZE_MAIN));
     $pdf->setFooterFont(array(PDF_FONT_NAME_DATA, '', PDF_FONT_SIZE_DATA));
     // set default monospaced font
     $pdf->SetDefaultMonospacedFont(PDF_FONT_MONOSPACED);
     // set margins
     $pdf->SetMargins(PDF_MARGIN_LEFT, PDF_MARGIN_TOP, PDF_MARGIN_RIGHT);
     $pdf->SetHeaderMargin(PDF_MARGIN_HEADER);
     $pdf->SetFooterMargin(PDF_MARGIN_FOOTER);
     // set auto page breaks
     $pdf->SetAutoPageBreak(TRUE, PDF_MARGIN_BOTTOM);
     // set image scale factor
     $pdf->setImageScale(PDF_IMAGE_SCALE_RATIO);
     // set some language-dependent strings (optional)
     $pdf->setLanguageArray($this->langSettings);
     // ---------------------------------------------------------
     // set display mode
     $pdf->SetDisplayMode($zoom = 'fullpage', $layout = 'TwoColumnRight', $mode = 'UseNone');
     // set pdf viewer preferences
     $pdf->setViewerPreferences(array('Duplex' => 'DuplexFlipLongEdge'));
     // set booklet mode
     $pdf->SetBooklet(true, 10, 30);
     // set core font
     $pdf->SetFont('helvetica', '', 18);
     // add a page (left page)
     $pdf->AddPage();
     $pdf->Write(0, 'Example of booklet mode', '', 0, 'L', true, 0, false, false, 0);
     // print a line using Cell()
     $pdf->Cell(0, 0, 'PAGE 1', 1, 1, 'C');
     // add a page (right page)
     $pdf->AddPage();
     // print a line using Cell()
     $pdf->Cell(0, 0, 'PAGE 2', 1, 1, 'C');
     // add a page (left page)
     $pdf->AddPage();
     // print a line using Cell()
     $pdf->Cell(0, 0, 'PAGE 3', 1, 1, 'C');
     // add a page (right page)
     $pdf->AddPage();
     // print a line using Cell()
     $pdf->Cell(0, 0, 'PAGE 4', 1, 1, 'C');
     $this->comparePdfs($pdf);
 }