示例#1
3
 public function drawPDF()
 {
     $pdf = new \FPDF('L', 'mm', 'Letter');
     $pdf->SetMargins(3.175, 3.175, 3.175);
     $pdf->SetAutoPageBreak(false);
     if (\COREPOS\Fannie\API\FanniePlugin::isEnabled('CoopDealsSigns')) {
         $this->font = 'Gill';
         $this->alt_font = 'GillBook';
         define('FPDF_FONTPATH', dirname(__FILE__) . '/../../../modules/plugins2.0/CoopDealsSigns/noauto/fonts/');
         $pdf->AddFont('Gill', '', 'GillSansMTPro-Medium.php');
     }
     $pdf->SetFont($this->font, '', 16);
     $data = $this->loadItems();
     $width = 136.52;
     $height = 105;
     $top = 90;
     $left = 15;
     $effective_width = $width - 2 * $left;
     foreach ($data as $item) {
         $pdf->AddPage();
         $column = 1;
         // right aligned
         $price = $this->printablePrice($item);
         $pdf->SetXY($left + $width * $column, $top);
         $pdf->SetFontSize($this->SMALL_FONT);
         $pdf->Cell($effective_width, 10, $item['brand'], 0, 1, 'C');
         $pdf->SetX($left + $width * $column);
         $pdf->SetFontSize($this->MED_FONT);
         $pdf->MultiCell($effective_width, 12, $item['description'], 0, 'C');
         $pdf->SetX($left + $width * $column);
         $pdf->SetFontSize($this->BIG_FONT);
         $pdf->Cell($effective_width, 25, $price, 0, 1, 'C');
         $y_pos = $pdf->GetY();
         if ($item['startDate'] != '' && $item['endDate'] != '') {
             // intl would be nice
             $datestr = $this->getDateString($item['startDate'], $item['endDate']);
             $pdf->SetXY($left + $width * $column, $top + ($height - 40));
             $pdf->SetFontSize($this->SMALL_FONT);
             $pdf->Cell($effective_width, 20, $datestr, 0, 1, 'R');
         }
         if ($item['originName'] != '') {
             $pdf->SetXY($left + $width * $column, $y_pos);
             $pdf->SetFontSize($this->SMALL_FONT);
             if (strlen($item['originName']) < 50) {
                 $pdf->Cell($effective_width, 20, $item['originName'], 0, 1, 'L');
             } else {
                 $pdf->Cell($effective_width, 20, $item['originShortName'], 0, 1, 'L');
             }
         }
     }
     $pdf->Output('WfcProdSingle.pdf', 'I');
 }
示例#2
3
 function export_order($id)
 {
     global $FANNIE_OP_DB, $FANNIE_ROOT;
     $dbc = FannieDB::get($FANNIE_OP_DB);
     $order = new PurchaseOrderModel($dbc);
     $order->orderID($id);
     $order->load();
     $items = new PurchaseOrderItemsModel($dbc);
     $items->orderID($id);
     $vendor = new VendorsModel($dbc);
     $vendor->vendorID($order->vendorID());
     $vendor->load();
     $contact = new VendorContactModel($dbc);
     $contact->vendorID($order->vendorID());
     $contact->load();
     if (!class_exists('FPDF')) {
         include_once $FANNIE_ROOT . 'src/fpdf/fpdf.php';
     }
     $pdf = new FPDF('P', 'mm', 'Letter');
     $pdf->AddPage();
     $pdf->SetFont('Arial', '', '12');
     $pdf->Cell(100, 5, 'Vendor: ' . $vendor->vendorName(), 0, 0);
     $pdf->Cell(100, 5, 'Date: ' . date('Y-m-d'), 0, 0);
     $pdf->Ln();
     $pdf->Cell(100, 5, 'Phone: ' . $contact->phone(), 0, 0);
     $pdf->Cell(100, 5, 'Fax: ' . $contact->fax(), 0, 0);
     $pdf->Ln();
     $pdf->Cell(100, 5, 'Email: ' . $contact->email(), 0, 0);
     $pdf->Cell(100, 5, 'Website: ' . $contact->website(), 0, 0);
     $pdf->Ln();
     $pdf->MultiCell(0, 5, "Ordering Info:\n" . $contact->notes(), 'B');
     $pdf->Ln();
     $cur_page = 0;
     $pdf->SetFontSize(10);
     foreach ($items->find() as $obj) {
         if ($cur_page != $pdf->PageNo()) {
             $cur_page = $pdf->PageNo();
             $pdf->Cell(25, 5, 'SKU', 0, 0);
             $pdf->Cell(20, 5, 'Order Qty', 0, 0);
             $pdf->Cell(30, 5, 'Brand', 0, 0);
             $pdf->Cell(65, 5, 'Description', 0, 0);
             $pdf->Cell(20, 5, 'Case Size', 0, 0);
             $pdf->Cell(20, 5, 'Est. Cost', 0, 0);
             $pdf->Ln();
         }
         $pdf->Cell(25, 5, $obj->sku(), 0, 0);
         $pdf->Cell(20, 5, $obj->quantity(), 0, 0, 'C');
         $pdf->Cell(30, 5, $obj->brand(), 0, 0);
         $pdf->Cell(65, 5, $obj->description(), 0, 0);
         $pdf->Cell(20, 5, $obj->caseSize(), 0, 0, 'C');
         $pdf->Cell(20, 5, sprintf('%.2f', $obj->caseSize() * $obj->unitCost() * $obj->quantity()), 0, 0);
         $pdf->Ln();
     }
     $pdf->Output('order_export.pdf', 'D');
 }
示例#3
2
 public final function generate_attendees_PDF($tickets_list)
 {
     $this->load_pdf_libraries();
     $pdf = new FPDF();
     $ecp = TribeEvents::instance();
     $pdf->AddFont('OpenSans', '', 'opensans.php');
     $pdf->AddFont('SteelFish', '', 'steelfish.php');
     $pdf->SetTitle('EventTicket');
     $pdf->SetAuthor('The Events Calendar');
     $pdf->SetCreator('The Events Calendar');
     $defaults = array('event_id' => 0, 'ticket_name' => '', 'holder_name' => '', 'order_id' => '', 'ticket_id' => '', 'security_code' => '');
     foreach ($tickets_list as $ticket) {
         $ticket = wp_parse_args($ticket, $defaults);
         $event = get_post($ticket['event_id']);
         $venue_id = tribe_get_venue_id($event->ID);
         $venue = !empty($venue_id) ? get_post($venue_id)->post_title : '';
         $address = tribe_get_address($event->ID);
         $zip = tribe_get_zip($event->ID);
         $state = tribe_get_stateprovince($event->ID);
         $city = tribe_get_city($event->ID);
         $pdf->AddPage();
         $pdf->SetDrawColor(28, 166, 205);
         $pdf->SetFillColor(28, 166, 205);
         $pdf->Rect(15, 10, 180, 34, 'F');
         $pdf->SetTextColor(255);
         $pdf->SetFont('OpenSans', '', 10);
         $pdf->SetXY(30, 15);
         $pdf->Write(5, __('EVENT NAME:', 'tribe-events-calendar'));
         $pdf->SetXY(30, 28);
         $pdf->SetFont('SteelFish', '', 53);
         $title = strtoupper(utf8_decode($event->post_title));
         $size = 53;
         while ($pdf->GetStringWidth($title) > 151) {
             $size--;
             $pdf->SetFontSize($size);
         }
         $pdf->Write(5, $title);
         $pdf->SetTextColor(41);
         $pdf->SetFont('OpenSans', '', 10);
         $pdf->SetXY(30, 50);
         $pdf->Write(5, __('TICKET HOLDER:', 'tribe-events-calendar'));
         $pdf->SetXY(104, 50);
         $pdf->Write(5, __('LOCATION:', 'tribe-events-calendar'));
         $pdf->SetFont('SteelFish', '', 30);
         $pdf->SetXY(30, 59);
         $holder = strtoupper(utf8_decode($ticket['holder_name']));
         $size = 30;
         while ($pdf->GetStringWidth($holder) > 70) {
             $size--;
             $pdf->SetFontSize($size);
         }
         $pdf->Write(5, $holder);
         $pdf->SetXY(104, 59);
         $venue = strtoupper(utf8_decode($venue));
         $size = 30;
         while ($pdf->GetStringWidth($venue) > 70) {
             $size--;
             $pdf->SetFontSize($size);
         }
         $pdf->Write(5, $venue);
         $pdf->SetXY(104, 71);
         $address = strtoupper(utf8_decode($address));
         $size = 30;
         while ($pdf->GetStringWidth($address) > 70) {
             $size--;
             $pdf->SetFontSize($size);
         }
         $pdf->Write(5, $address);
         $pdf->SetXY(104, 83);
         $address2 = array($city, $state, $zip);
         $address2 = array_filter($address2);
         $address2 = join(', ', $address2);
         $address2 = strtoupper(utf8_decode($address2));
         $size = 30;
         while ($pdf->GetStringWidth($address2) > 70) {
             $size--;
             $pdf->SetFontSize($size);
         }
         $pdf->Write(5, $address2);
         $pdf->Line(15, 97, 195, 97);
         $pdf->SetFont('OpenSans', '', 10);
         $pdf->SetXY(30, 105);
         $pdf->Write(5, __('ORDER:', 'tribe-events-calendar'));
         $pdf->SetXY(80, 105);
         $pdf->Write(5, __('TICKET:', 'tribe-events-calendar'));
         $pdf->SetXY(120, 105);
         $pdf->Write(5, __('VERIFICATION:', 'tribe-events-calendar'));
         $pdf->SetFont('SteelFish', '', 53);
         $pdf->SetXY(30, 118);
         $pdf->Write(5, $ticket['order_id']);
         $pdf->SetXY(80, 118);
         $pdf->Write(5, $ticket['ticket_id']);
         $pdf->SetXY(120, 118);
         $pdf->Write(5, $ticket['security_code']);
         $pdf->Rect(15, 135, 180, 15, 'F');
         $pdf->SetTextColor(255);
         $pdf->SetFont('OpenSans', '', 10);
         $pdf->SetXY(30, 140);
         $pdf->Write(5, get_bloginfo('name'));
         $pdf->SetXY(104, 140);
         $pdf->Write(5, get_home_url());
     }
     $upload_path = wp_upload_dir();
     $upload_url = $upload_path['url'];
     $upload_path = $upload_path['path'];
     $filename = wp_unique_filename($upload_path, sanitize_file_name(md5(time())) . '.pdf');
     $upload_path = trailingslashit($upload_path) . $filename;
     $upload_url = trailingslashit($upload_url) . $filename;
     $pdf->Output($upload_path, 'F');
     return array($upload_path, $upload_url);
 }
示例#4
1
 public function drawPDF()
 {
     $pdf = new \FPDF('P', 'mm', 'Letter');
     $pdf->SetMargins(0, 3.175, 0);
     $pdf->SetAutoPageBreak(false);
     define('FPDF_FONTPATH', dirname(__FILE__) . '/noauto/fonts/');
     $pdf->AddFont('Gill', '', 'GillSansMTPro-Medium.php');
     $pdf->AddFont('Gill', 'B', 'GillSansMTPro-Heavy.php');
     $pdf->AddFont('GillBook', '', 'GillSansMTPro-Book.php');
     $pdf->SetFont('Gill', '', 16);
     $data = $this->loadItems();
     $count = 0;
     $sign = 0;
     $width = 53.975;
     $height = 68.95999999999999;
     $top = 20;
     $left = 5.175;
     $effective_width = $width - 2 * $left;
     $pdf->SetDrawColor(0, 0, 0);
     $pdf->SetLineWidth(0.2);
     foreach ($data as $item) {
         if ($count % 16 == 0) {
             $pdf->AddPage();
             // draw tick marks for cutting
             $pdf->Line(2, $height + 1.5, 6, $height + 1.5);
             $pdf->Line(2, 2 * $height + 1.5, 6, 2 * $height + 1.5);
             $pdf->Line(2, 3 * $height + 1.5, 6, 3 * $height + 1.5);
             $pdf->Line($width, 2, $width, 6);
             $pdf->Line(2 * $width, 2, 2 * $width, 6);
             $pdf->Line(3 * $width, 2, 3 * $width, 6);
             $pdf->Line($width, 4 * $height - 4, $width, 4 * $height);
             $pdf->Line(2 * $width, 4 * $height - 4, 2 * $width, 4 * $height);
             $pdf->Line(3 * $width, 4 * $height - 4, 3 * $width, 4 * $height);
             $pdf->Line(4 * $width - 6, $height + 1.5, 4 * $width - 2, $height + 1.5);
             $pdf->Line(4 * $width - 6, 2 * $height + 1.5, 4 * $width - 2, 2 * $height + 1.5);
             $pdf->Line(4 * $width - 6, 3 * $height + 1.5, 4 * $width - 2, 3 * $height + 1.5);
             $sign = 0;
         }
         $row = floor($sign / 4);
         $column = $sign % 4;
         $price = $item['normal_price'];
         if ($item['scale']) {
             if (substr($price, 0, 1) != '$') {
                 $price = sprintf('$%.2f', $price);
             }
             $price .= ' /lb.';
         } elseif (isset($item['signMultiplier'])) {
             $price = $this->formatPrice($item['normal_price'], $item['signMultiplier']);
         } else {
             $price = $this->formatPrice($item['normal_price']);
         }
         $pdf->Image(dirname(__FILE__) . '/cd_head_16.png', $left - 2 + $width * $column, $top - 17 + $row * $height, $width - 6);
         $pdf->SetXY($left + $width * $column, $top + $row * $height - 2);
         $pdf->SetFont('Gill', 'B', $this->SMALL_FONT);
         $font_shrink = 0;
         while (true) {
             $pdf->SetX($left + $width * $column);
             $y = $pdf->GetY();
             $pdf->MultiCell($effective_width, 6, strtoupper($item['brand']), 0, 'C');
             if ($pdf->GetY() - $y > 6) {
                 $pdf->SetFillColor(0xff, 0xff, 0xff);
                 $pdf->Rect($left + $width * $column, $y, $left + $width * $column + $effective_width, $pdf->GetY(), 'F');
                 $font_shrink++;
                 if ($font_shrink >= $this->SMALL_FONT) {
                     break;
                 }
                 $pdf->SetFontSize($this->MED_FONT - $font_shrink);
                 $pdf->SetXY($left + $width * $column, $y);
             } else {
                 break;
             }
         }
         $pdf->SetX($left + $width * $column);
         $pdf->SetFont('Gill', '', $this->MED_FONT);
         $font_shrink = 0;
         while (true) {
             $pdf->SetX($left + $width * $column);
             $y = $pdf->GetY();
             $pdf->MultiCell($effective_width, 6, $item['description'], 0, 'C');
             if ($pdf->GetY() - $y > 12) {
                 $pdf->SetFillColor(0xff, 0xff, 0xff);
                 $pdf->Rect($left + $width * $column, $y, $left + $width * $column + $effective_width, $pdf->GetY(), 'F');
                 $font_shrink++;
                 if ($font_shrink >= $this->MED_FONT) {
                     break;
                 }
                 $pdf->SetFontSize($this->MED_FONT - $font_shrink);
                 $pdf->SetXY($left + $width * $column, $y);
             } else {
                 if ($pdf->GetY() - $y < 12) {
                     $words = explode(' ', $item['description']);
                     $multi = '';
                     for ($i = 0; $i < floor(count($words) / 2); $i++) {
                         $multi .= $words[$i] . ' ';
                     }
                     $multi = trim($multi) . "\n";
                     for ($i = floor(count($words) / 2); $i < count($words); $i++) {
                         $multi .= $words[$i] . ' ';
                     }
                     $item['description'] = trim($multi);
                     $pdf->SetFillColor(0xff, 0xff, 0xff);
                     $pdf->Rect($left + $width * $column, $y, $left + $width * $column + $effective_width, $pdf->GetY(), 'F');
                     $pdf->SetXY($left + $width * $column, $y);
                     $pdf->MultiCell($effective_width, 6, $item['description'], 0, 'C');
                 }
                 break;
             }
         }
         $pdf->SetX($left + $width * $column);
         $pdf->SetFont('GillBook', '', $this->SMALLER_FONT);
         $item['size'] = strtolower($item['size']);
         if (substr($item['size'], -1) != '.') {
             $item['size'] .= '.';
             // end abbreviation w/ period
             $item['size'] = str_replace('fz.', 'fl oz.', $item['size']);
         }
         if (substr($item['size'], 0, 1) == '.') {
             $item['size'] = '0' . $item['size'];
             // add leading zero on decimal qty
         }
         if (strlen(ltrim($item['upc'], '0')) < 5 && $item['scale']) {
             $item['size'] = 'PLU# ' . ltrim($item['upc'], '0');
             // show PLU #s on by-weight
         }
         $pdf->Cell($effective_width, 6, $item['size'], 0, 1, 'C');
         $pdf->SetXY($left + $width * $column, $top + $height * $row + ($height - $top - 18));
         $pdf->SetFont('Gill', '', $this->BIG_FONT);
         $pdf->MultiCell($effective_width, 10, $price, 0, 'C');
         if ($item['startDate'] != '' && $item['endDate'] != '') {
             // intl would be nice
             $datestr = date('M d', strtotime($item['startDate'])) . chr(0x96) . date('M d', strtotime($item['endDate']));
             $pdf->SetXY($left + $width * $column, $top + $height * $row + ($height - $top - 7));
             $pdf->SetFont('GillBook', '', $this->SMALLEST_FONT);
             $pdf->Cell($effective_width + 4, 6, strtoupper($datestr), 0, 1, 'R');
         }
         if ($item['upc'] != '') {
             $pdf->SetXY($left - 2 + $width * $column, $top + $height * $row + ($height - $top - 7));
             $pdf->SetFont('GillBook', '', $this->SMALLEST_FONT);
             $pdf->Cell($effective_width, 6, $item['upc'], 0, 1, 'L');
         }
         $pdf->Image(dirname(__FILE__) . '/' . $this->footer_image, $left - 2 + $width * $column, $top + $height * $row + ($height - $top - 2), $width - 6);
         $count++;
         $sign++;
     }
     $pdf->Output('Signage16UpP.pdf', 'I');
 }
示例#5
0
 function pdf()
 {
     $this->load->library('cfpdf');
     $pdf = new FPDF('P', 'mm', 'A4');
     $pdf->AddPage();
     $pdf->SetFont('Arial', 'B', 'L');
     $pdf->SetFontSize(14);
     $pdf->Text(10, 10, 'LAPORAN TRANSAKSI');
     $pdf->SetFont('Arial', 'B', 'L');
     $pdf->SetFontSize(10);
     $pdf->Cell(10, 10, '', '', 1);
     $pdf->Cell(10, 7, 'No', 1, 0);
     $pdf->Cell(27, 7, 'Tanggal', 1, 0);
     $pdf->Cell(30, 7, 'Operator', 1, 0);
     $pdf->Cell(38, 7, 'Total Transaksi', 1, 1);
     // tampilkan dari database
     $pdf->SetFont('Arial', '', 'L');
     $data = $this->model_transaksi->laporan_default();
     $no = 1;
     $total = 0;
     foreach ($data->result() as $r) {
         $pdf->Cell(10, 7, $no, 1, 0);
         $pdf->Cell(27, 7, $r->tanggal_transaksi, 1, 0);
         $pdf->Cell(30, 7, $r->nama_lengkap, 1, 0);
         $pdf->Cell(38, 7, $r->total, 1, 1);
         $no++;
         $total = $total + $r->total;
     }
     // end
     $pdf->Cell(67, 7, 'Total', 1, 0, 'R');
     $pdf->Cell(38, 7, $total, 1, 0);
     $pdf->Output();
 }
示例#6
0
 public function otr_pdf_writer($file, $info)
 {
     $path = getcwd();
     if (!is_dir($path . '/img/')) {
         if (mkdir($path . '/img')) {
             if (!mkdir($path . '/img/otr_pdfs')) {
                 return false;
             }
         } else {
             return false;
         }
     } elseif (!is_dir($path . '/img/otr_pdfs/')) {
         if (!mkdir($path . '/img/otr_pdfs')) {
             return false;
         }
     }
     $url_file_path = '/img/otr_pdfs/' . $file;
     $filename = $path . $url_file_path;
     $info['student_full_name'] = $info['FirstName'] . ' ' . $info['MiddleName'] . ' ' . $info['LastName'];
     $pdf = new FPDF('P', 'mm', array(218, 290));
     $pdf->SetAuthor($info['student_full_name']);
     $pdf->SetTitle('OTR');
     $pdf->SetFont('Helvetica', 'B', 20);
     $pdf->SetTextColor(50, 60, 100);
     $pdf->AddPage('P');
     //$pdf->SetDisplayMode('real','default');
     $pdf->SetFontSize(10);
     // Background image
     $pdf->Image('../resources/otr/otr_multi_form2.png', 0, 0);
     $start_x = 18;
     $start_y = 46;
     for ($i = 0; $i < 3; $i++) {
         // Fill out first form
         // Name
         $pdf->SetFont('Times', 'B', 14);
         $start_address_Y = $start_y - 27;
         foreach ($info['otr_address'] as $otr_address) {
             $pdf->SetXY($start_x + 109, $start_address_Y);
             $pdf->Write(5, $otr_address);
             $start_address_Y += 5;
         }
         $pdf->SetFont('Helvetica', 'B', 10);
         $pdf->SetXY($start_x, $start_y);
         $pdf->Write(5, $info['student_full_name']);
         // Address
         $pdf->SetXY($start_x + 2, $start_y + 6.5);
         $pdf->Write(5, $info['addr_line1_CA']);
         // Years of Attendance (I don't believe we are gathering this information)
         //$pdf->SetXY($start_x+90,$start_y+6.5);
         //$pdf->Write(5,$info['name']);
         //$pdf->SetXY($start_x+115,$start_y+6.5);
         //$pdf->Write(5,$info['name']);
         // City, State
         $pdf->SetXY($start_x + 1, $start_y + 13);
         $pdf->Write(5, $info['city_CA'] . ', ' . $info['st_ca']);
         // Zip Code
         $pdf->SetXY($start_x + 58, $start_y + 13);
         $pdf->Write(5, $info['zip_CA']);
         // Soc. Security Number
         //            $pdf->SetXY($start_x+26,$start_y+19.5);
         //            $pdf->Write(5,$info['SF_NO']);
         // Phone Number & Email
         $pdf->SetXY($start_x + 15, $start_y + 26);
         if ($info['pref_contact'] == 'cell_phone') {
             $pdf->Write(5, $info['ndcellphone']);
         } else {
             $pdf->Write(5, $info['phone']);
         }
         $pdf->SetFontSize(8);
         $pdf->SetXY($start_x + 52, $start_y + 26);
         $pdf->Write(5, $info['line1']);
         $pdf->SetFontSize(10);
         // Birth Date
         $birth_date = explode('/', $info['birth_date']);
         $pdf->SetXY($start_x + 115, $start_y + 26);
         $pdf->Write(5, $birth_date[0]);
         $pdf->SetXY($start_x + 122.5, $start_y + 26);
         $pdf->Write(5, $birth_date[1]);
         $pdf->SetXY($start_x + 130, $start_y + 26);
         $pdf->Write(5, $birth_date[2]);
         // Today's Date
         $pdf->SetXY($start_x + 102, $start_y + 32.5);
         $pdf->Write(5, date('m'));
         $pdf->SetXY($start_x + 109.5, $start_y + 32.5);
         $pdf->Write(5, date('d'));
         $pdf->SetXY($start_x + 117, $start_y + 32.5);
         $pdf->Write(5, date('Y'));
         // Move to the next form:
         $start_y = $start_y + 93;
     }
     $pdf->Output($filename);
     if (file_exists($filename)) {
         //$full_url = 'http://'.$_SERVER['HTTP_HOST'].$url_file_path;
         return $url_file_path;
     } else {
         return false;
     }
 }
示例#7
0
 function exportPdf()
 {
     $db = JFactory::getDBO();
     while (ob_get_level()) {
         ob_end_clean();
     }
     header("Content-Encoding: None", true);
     require JPATH_COMPONENT . DS . 'helpers' . DS . 'fpdf.php';
     include_once JPATH_COMPONENT . DS . 'helpers' . DS . 'font' . DS . 'helvetica.php';
     $quiz_id = intval(JRequest::getVar("id", ""));
     //create a FPDF object
     $pdf = new FPDF();
     //set font for the entire document
     $pdf->SetFont('Arial', 'B', 20);
     $pdf->SetTextColor(50, 60, 100);
     //set up a page
     $pdf->AddPage();
     @$pdf->SetDisplayMode(real, 'default');
     $pdf->SetXY(10, 5);
     $pdf->SetFontSize(8);
     $z = 25;
     $t = $z + 10;
     $pdf->SetXY(10, $t);
     $pdf->SetFontSize(7);
     $pdf->Cell(25, 10, JText::_("GURU_NAME"), 'LRTB', '', 'L', 0);
     $pdf->Cell(39, 10, JText::_("GURU_EMAIL"), 'LRTB', '', 'L', 0);
     $pdf->Cell(100, 10, JText::_("GURU_PROGRAM"), 'LRTB', '', 'L', 0);
     $pdf->Ln();
     $pid = JRequest::getVar("course", 0);
     $result = array();
     $user = JFactory::getUser();
     $sql = "select `id` from #__guru_program where `author` like '%|" . intval($user->id) . "|%' OR `author`='" . intval($user->id) . "'";
     $db->setQuery($sql);
     $db->query();
     $courses_ids = $db->loadColumn();
     $sql = "select `id`, `name` from #__guru_program where `author` like '%|" . intval($user->id) . "|%' OR `author`='" . intval($user->id) . "'";
     $db->setQuery($sql);
     $db->query();
     $courses_names = $db->loadAssocList("id");
     if (!isset($courses_ids) || count($courses_ids) <= 0) {
         $courses_ids = array("0" => "0");
     }
     if (intval($pid) != 0) {
         $courses_ids = array(intval($pid));
     }
     $sql = "select distinct(`userid`) from #__guru_buy_courses where `course_id` in (" . implode(",", $courses_ids) . ")";
     $db->setQuery($sql);
     $db->query();
     $students_ids = $db->loadColumn();
     if (isset($students_ids) && count($students_ids) > 0) {
         $sql = "select distinct(c.`userid`), A.`courses`, u.* from #__guru_buy_courses c, (select `userid`, GROUP_CONCAT(`course_id` SEPARATOR '-') as courses from #__guru_buy_courses where `course_id` in (" . implode(",", $courses_ids) . ") group by `userid`) as A, #__users u, #__guru_customer cust where `course_id` in (" . implode(",", $courses_ids) . ") and c.`userid`=A.`userid` and u.`id`=c.`userid` and cust.`id`=u.`id`";
         $db->setQuery($sql);
         $db->query();
         $result = $db->loadAssocList();
     }
     $new_id = 0;
     $nr = 1;
     for ($i = 0; $i < count($result); $i++) {
         $name = $result[$i]["name"];
         $email = $result[$i]["email"];
         $courses = $result[$i]["courses"];
         $student_courses = array();
         $courses = explode("-", $courses);
         if (isset($courses) && count($courses) > 0) {
             foreach ($courses as $key => $value) {
                 $student_courses[] = $courses_names[$value]["name"];
             }
         }
         $pdf->SetFontSize(7);
         $pdf->Cell(25, 10, $name, 'LRTB', '', 'L', 0);
         $pdf->Cell(39, 10, $email, 'LRTB', '', 'L', 0);
         $pdf->Cell(100, 10, implode(", ", $student_courses), 'LRTB', '', 'L', 0);
         $pdf->Ln();
     }
     //Output the document
     $pdf->Output('ExportResult.pdf', 'I');
 }
示例#8
0
 public function otr_pdf_writer($file, $info)
 {
     // Generate Filename based on Person's & Timestamp
     $path = getcwd();
     if (!is_dir($path . '/img/')) {
         if (mkdir($path . '/img')) {
             if (!mkdir($path . '/img/otr_pdfs')) {
                 return false;
             }
         } else {
             return false;
         }
     } elseif (!is_dir($path . '/img/otr_pdfs/')) {
         if (!mkdir($path . '/img/otr_pdfs')) {
             return false;
         }
     }
     $url_file_path = '/img/otr_pdfs/' . $file;
     $filename = $path . $url_file_path;
     $info['student_full_name'] = $info['first_name'] . ' ' . $info['middle_name'] . ' ' . $info['last_name'];
     $pdf = new FPDF('P', 'mm', array(218, 290));
     $pdf->SetAuthor($info['student_full_name']);
     $pdf->SetTitle('OTR');
     $pdf->SetFont('Helvetica', 'B', 20);
     $pdf->SetTextColor(50, 60, 100);
     $pdf->AddPage('P');
     $pdf->SetFontSize(10);
     // Background image
     $pdf->Image('img/otr_multi_form2.png', 0, 0);
     $start_x = 18;
     $start_y = 46;
     for ($i = 0; $i < 3; $i++) {
         // Fill out first form
         // Name
         $pdf->SetFont('Times', 'B', 14);
         $start_address_Y = $start_y - 27;
         foreach ($info['otr_address'] as $otr_address) {
             $pdf->SetXY($start_x + 109, $start_address_Y);
             $pdf->Write(5, $otr_address);
             $start_address_Y += 5;
         }
         $pdf->SetFont('Helvetica', 'B', 10);
         $pdf->SetXY($start_x, $start_y);
         $pdf->Write(5, $info['student_full_name']);
         // Address
         $pdf->SetXY($start_x + 2, $start_y + 6.5);
         $pdf->Write(5, $info['address1']);
         // City, State
         $pdf->SetXY($start_x + 1, $start_y + 13);
         $pdf->Write(5, $info['city'] . ', ' . $info['state']);
         // Zip Code
         $pdf->SetXY($start_x + 58, $start_y + 13);
         $pdf->Write(5, $info['zip_code']);
         // Phone Number & Email
         $pdf->SetXY($start_x + 15, $start_y + 26);
         $pdf->Write(5, $info['home_phone']);
         $pdf->SetFontSize(8);
         $pdf->SetXY($start_x + 52, $start_y + 26);
         $pdf->Write(5, $info['email']);
         $pdf->SetFontSize(10);
         // Birth Date
         $birth_date = explode('-', $info['dob']);
         $pdf->SetXY($start_x + 115, $start_y + 26);
         $pdf->Write(5, $birth_date[0]);
         $pdf->SetXY($start_x + 122.5, $start_y + 26);
         $pdf->Write(5, $birth_date[1]);
         $pdf->SetXY($start_x + 130, $start_y + 26);
         $pdf->Write(5, $birth_date[2]);
         // Today's Date
         $pdf->SetXY($start_x + 102, $start_y + 32.5);
         $pdf->Write(5, date('m'));
         $pdf->SetXY($start_x + 109.5, $start_y + 32.5);
         $pdf->Write(5, date('d'));
         $pdf->SetXY($start_x + 117, $start_y + 32.5);
         $pdf->Write(5, date('Y'));
         // Move to the next form:
         $start_y = $start_y + 93;
     }
     $pdf->Output($filename);
     if (file_exists($filename)) {
         return $url_file_path;
     } else {
         return false;
     }
 }
示例#9
0
 public function drawPDF()
 {
     $pdf = new \FPDF('L', 'mm', 'Letter');
     $pdf->SetMargins(3.175, 3.175, 3.175);
     $pdf->SetAutoPageBreak(false);
     define('FPDF_FONTPATH', dirname(__FILE__) . '/noauto/fonts/');
     $pdf->AddFont('Gill', '', 'GillSansMTPro-Medium.php');
     $pdf->AddFont('Gill', 'B', 'GillSansMTPro-Heavy.php');
     $pdf->AddFont('GillBook', '', 'GillSansMTPro-Book.php');
     $pdf->SetFont('Gill', '', 16);
     $data = $this->loadItems();
     $count = 0;
     $sign = 0;
     $width = 68.67;
     $height = 71;
     $top = 22;
     $left = 6.0;
     $effective_width = $width - $left;
     foreach ($data as $item) {
         if ($count % 12 == 0) {
             if ($count != 0) {
                 // draw tick marks again
                 // sometimes other content of the page
                 // overwrites them
                 $pdf->Line(2, $height + 0.0, 6, $height + 0.0);
                 $pdf->Line(2, 2 * $height + 1.0, 6, 2 * $height + 1.0);
                 $pdf->Line(4 * $width - 3, $height + 0.0, 4 * $width + 1, $height + 0.0);
                 $pdf->Line(4 * $width - 3, 2 * $height + 1.0, 4 * $width + 1, 2 * $height + 1.0);
                 $pdf->Line($width + 1.5, 2, $width + 1.5, 8);
                 $pdf->Line(2 * $width + 1.5, 2, 2 * $width + 1.5, 8);
                 $pdf->Line(3 * $width + 1.5, 2, 3 * $width + 1.5, 8);
                 $pdf->Line($width + 1.5, 3 * $height - 6, $width + 1.5, 3 * $height);
                 $pdf->Line(2 * $width + 1.5, 3 * $height - 6, 2 * $width + 1.5, 3 * $height);
                 $pdf->Line(3 * $width + 1.5, 3 * $height - 6, 3 * $width + 1.5, 3 * $height);
             }
             $pdf->AddPage();
             // draw tick marks for cutting
             $pdf->Line(2, $height + 0.0, 6, $height + 0.0);
             $pdf->Line(2, 2 * $height + 1.0, 6, 2 * $height + 1.0);
             $pdf->Line(4 * $width - 3, $height + 0.0, 4 * $width + 1, $height + 0.0);
             $pdf->Line(4 * $width - 3, 2 * $height + 1.0, 4 * $width + 1, 2 * $height + 1.0);
             $pdf->Line($width + 1.5, 2, $width + 1.5, 8);
             $pdf->Line(2 * $width + 1.5, 2, 2 * $width + 1.5, 8);
             $pdf->Line(3 * $width + 1.5, 2, 3 * $width + 1.5, 8);
             $pdf->Line($width + 1.5, 3 * $height - 6, $width + 1.5, 3 * $height);
             $pdf->Line(2 * $width + 1.5, 3 * $height - 6, 2 * $width + 1.5, 3 * $height);
             $pdf->Line(3 * $width + 1.5, 3 * $height - 6, 3 * $width + 1.5, 3 * $height);
             $sign = 0;
         }
         $row = floor($sign / 4);
         $column = $sign % 4;
         $price = $item['normal_price'];
         if ($item['scale']) {
             if (substr($price, 0, 1) != '$') {
                 $price = sprintf('$%.2f', $price);
             }
             $price .= ' /lb.';
         } elseif (isset($item['signMultiplier'])) {
             $price = $this->formatPrice($item['normal_price'], $item['signMultiplier']);
         } else {
             $price = $this->formatPrice($item['normal_price']);
         }
         $pdf->Image(dirname(__FILE__) . '/cd_head_16.png', $left - 1 + $width * $column, $top - 19 + $row * $height, $width - 6);
         $pdf->SetXY($left + $width * $column, $top + $row * $height + 1);
         $pdf->SetFont('Gill', 'B', $this->SMALL_FONT);
         $pdf->MultiCell($effective_width, 6, strtoupper($item['brand']), 0, 'C');
         /**
           This block attempts to write the description then
           checks how many lines it took. If the description was
           longer than two lines, it whites the whole thing out,
           drops one font size, and tries again. Calculating
           effective text size with smart line breaks seems
           really tough.
         */
         $pdf->SetFont('Gill', '', $this->MED_FONT);
         $font_shrink = 0;
         while (true) {
             $pdf->SetX($left + $width * $column);
             $y = $pdf->GetY();
             $pdf->MultiCell($effective_width, 7, $item['description'], 0, 'C');
             if ($pdf->GetY() - $y > 14) {
                 $pdf->SetFillColor(0xff, 0xff, 0xff);
                 $pdf->Rect($left + $width * $column, $y, $left + $width * $column + $effective_width, $pdf->GetY(), 'F');
                 $font_shrink++;
                 if ($font_shrink >= $this->MED_FONT) {
                     break;
                 }
                 $pdf->SetFontSize($this->MED_FONT - $font_shrink);
                 $pdf->SetXY($left + $width * $column, $y);
             } else {
                 if ($pdf->GetY() - $y < 14) {
                     $words = explode(' ', $item['description']);
                     $multi = '';
                     for ($i = 0; $i < floor(count($words) / 2); $i++) {
                         $multi .= $words[$i] . ' ';
                     }
                     $multi = trim($multi) . "\n";
                     for ($i = floor(count($words) / 2); $i < count($words); $i++) {
                         $multi .= $words[$i] . ' ';
                     }
                     $item['description'] = trim($multi);
                     $pdf->SetFillColor(0xff, 0xff, 0xff);
                     $pdf->Rect($left + $width * $column, $y, $left + $width * $column + $effective_width, $pdf->GetY(), 'F');
                     $pdf->SetXY($left + $width * $column, $y);
                     $pdf->MultiCell($effective_width, 7, $item['description'], 0, 'C');
                 }
                 break;
             }
         }
         $pdf->SetX($left + $width * $column);
         $pdf->SetFont('GillBook', '', $this->SMALLER_FONT);
         $item['size'] = strtolower($item['size']);
         if (substr($item['size'], -1) != '.') {
             $item['size'] .= '.';
             // end abbreviation w/ period
             $item['size'] = str_replace('fz.', 'fl oz.', $item['size']);
         }
         if (substr($item['size'], 0, 1) == '.') {
             $item['size'] = '0' . $item['size'];
             // add leading zero on decimal qty
         }
         if (strlen(ltrim($item['upc'], '0')) < 5 && $item['scale']) {
             $item['size'] = 'PLU# ' . ltrim($item['upc'], '0');
             // show PLU #s on by-weight
         }
         $pdf->Cell($effective_width, 6, $item['size'], 0, 1, 'C');
         $pdf->SetXY($left + $width * $column, $top + $height * $row + ($height - 42));
         $pdf->SetFont('Gill', '', $this->BIG_FONT);
         $pdf->Cell($effective_width, 12, $price, 0, 1, 'C');
         if ($item['startDate'] != '' && $item['endDate'] != '') {
             // intl would be nice
             $datestr = date('M d', strtotime($item['startDate'])) . chr(0x96) . date('M d', strtotime($item['endDate']));
             $pdf->SetXY($left + $width * $column, $top + $height * $row + ($height - 37));
             $pdf->SetFont('GillBook', '', $this->SMALLEST_FONT);
             $pdf->Cell($effective_width, 20, strtoupper($datestr), 0, 1, 'R');
         }
         if ($item['upc'] != '') {
             $pdf->SetXY($left + $width * $column, $top + $height * $row + ($height - 37));
             $pdf->SetFont('GillBook', '', $this->SMALLEST_FONT);
             $pdf->Cell($effective_width, 20, $item['upc'], 0, 1, 'L');
         }
         $pdf->Image(dirname(__FILE__) . '/' . $this->footer_image, $left - 1 + $width * $column, $top + $height * $row + ($height - $top - 4), $width - 6);
         $count++;
         $sign++;
     }
     $pdf->Output('Signage12UpL.pdf', 'I');
 }
示例#10
0
文件: guruQuiz.php 项目: JozefAB/qk
 function exportFilePdf()
 {
     while (ob_get_level()) {
         ob_end_clean();
     }
     header("Content-Encoding: None", true);
     require JPATH_COMPONENT . DS . 'helpers' . DS . 'fpdf.php';
     include_once JPATH_COMPONENT . DS . 'helpers' . DS . 'font' . DS . 'helvetica.php';
     $quiz_id = intval(JRequest::getVar("id", ""));
     //create a FPDF object
     $pdf = new FPDF();
     //set font for the entire document
     $pdf->SetFont('Arial', 'B', 20);
     $pdf->SetTextColor(50, 60, 100);
     //set up a page
     $pdf->AddPage();
     $pdf->SetDisplayMode(real, 'default');
     $pdf->SetXY(10, 5);
     $pdf->SetFontSize(8);
     $db = JFactory::getDBO();
     $sql = "select name from #__guru_quiz where id=" . $quiz_id;
     $db->setQuery($sql);
     $name = $db->loadColumn();
     $name = $name["0"];
     $pdf->Write(5, 'Student Quiz Result for ' . "'" . $name . "'");
     $pdf->SetXY(10, 15);
     $pdf->SetFontSize(8);
     $pdf->Cell(20, 10, 'Times', 1, 0, 'C', 0);
     $pdf->Cell(20, 10, 'Students', 1, 0, 'C', 0);
     $pdf->Cell(20, 10, 'Avg Score', 1, 0, 'C', 0);
     //display the title with a border around it
     $res = guruAdminModelguruQuiz::NbOfTimesandStudents($quiz_id);
     $z = 25;
     $scoresByUserId = array();
     $maxNoOfTimes = 0;
     for ($i = 0; $i < count($res); $i++) {
         $newElem = new stdClass();
         $newElem->user_id = $res[$i]["user_id"];
         $newElem->scores = explode(",", $res[$i]["score_by_user"]);
         if (count($newElem->scores) > $maxNoOfTimes) {
             $maxNoOfTimes = count($newElem->scores);
         }
         array_push($scoresByUserId, $newElem);
     }
     $newvect = array();
     for ($i = 0; $i < $maxNoOfTimes; $i++) {
         $newElem = new stdClass();
         $newElem->noOfTimes = $i + 1;
         $newElem->noOfStudents = 0;
         $newElem->sumScores = 0;
         for ($j = 0; $j < count($scoresByUserId); $j++) {
             if (count($scoresByUserId[$j]->scores) >= $i + 1) {
                 $newElem->noOfStudents += 1;
                 $newElem->sumScores += $scoresByUserId[$j]->scores[$i];
             }
         }
         $newElem->avgScore = $newElem->sumScores / $newElem->noOfStudents;
         array_push($newvect, $newElem);
     }
     for ($i = 0; $i < count($newvect); $i++) {
         if ($i + 1 == 1) {
             $nboftimes = $i + 1 . "st";
         } elseif ($i + 1 == 2) {
             $nboftimes = $i + 1 . "nd";
         } elseif ($i + 1 == 3) {
             $nboftimes = $i + 1 . "rd";
         } elseif ($i + 1 > 3) {
             $nboftimes = $i + 1 . "th";
         }
         $studtot = $newvect[$i]->noOfStudents;
         $avg = intval($newvect[$i]->avgScore * 100);
         $pdf->SetXY(10, $z);
         $pdf->SetFontSize(7);
         $pdf->Cell(20, 10, $nboftimes, 1, 0, 'C', 0);
         $pdf->Cell(20, 10, $studtot, 1, 0, 'C', 0);
         $pdf->Cell(20, 10, $avg, 1, 0, 'C', 0);
         $z += 10;
     }
     $t = $z + 10;
     $pdf->SetXY(10, $t);
     $pdf->SetFontSize(7);
     $pdf->Cell(25, 10, 'First Name', 'LRTB', '', 'L', 0);
     $pdf->Cell(25, 10, 'Last Name', 'LRTB', '', 'L', 0);
     $pdf->Cell(39, 10, 'Email', 'LRTB', '', 'L', 0);
     $pdf->Cell(15, 10, '#', 'LRTB', '', 'L', 0);
     $pdf->Cell(20, 10, 'Username', 'LRTB', '', 'L', 0);
     $pdf->Cell(20, 10, 'Date Taken', 'LRTB', '', 'L', 0);
     $pdf->Cell(20, 10, 'Score', 'LRTB', '', 'L', 0);
     $pdf->Ln();
     //-----------------------------------------
     $pid = JRequest::getVar("pid", 0, 'post', 'int');
     $db = JFactory::getDBO();
     $sql = "select u.id, u.username, u.email, c.firstname, c.lastname, tq.date_taken_quiz, tq.score_quiz, tq.`id` as tq_id  from #__guru_customer c, #__users u, #__guru_quiz_taken tq where c.id=u.id and c.id = tq.user_id and u.id IN (select  user_id from #__guru_quiz_taken where quiz_id=" . $quiz_id . ") and tq.quiz_id=" . $quiz_id . " order by c.id desc";
     $db->setQuery($sql);
     $tmp = $db->loadObjectList();
     $new_id = 0;
     $nr = 1;
     for ($i = 0; $i < count($tmp); $i++) {
         $firstname = $tmp[$i]->firstname;
         $lastname = $tmp[$i]->lastname;
         $username = $tmp[$i]->username;
         $email = $tmp[$i]->email;
         $date = date("d/n/Y ", strtotime($tmp[$i]->date_taken_quiz));
         $score = $tmp[$i]->score_quiz;
         $score = explode("|", $score);
         $score = intval($score[0] / $score[1] * 100);
         if ($tmp[$i]->id == $new_id) {
             $nr = $nr + 1;
         } else {
             $nr = 1;
         }
         if ($nr == 1) {
             $nr = $nr . "st";
         } elseif ($nr == 2) {
             $nr = $nr . "nd";
         } elseif ($nr == 3) {
             $nr = $nr . "rd";
         } elseif ($nr > 3) {
             $nr = $nr . "td";
         }
         $pdf->SetFontSize(7);
         $pdf->Cell(25, 10, $firstname, 'LRTB', '', 'L', 0);
         $pdf->Cell(25, 10, $lastname, 'LRTB', '', 'L', 0);
         $pdf->Cell(39, 10, $email, 'LRTB', '', 'L', 0);
         $pdf->Cell(15, 10, $nr, 'LRTB', '', 'L', 0);
         $pdf->Cell(20, 10, $username, 'LRTB', '', 'L', 0);
         $pdf->Cell(20, 10, $date, 'LRTB', '', 'L', 0);
         $pdf->Cell(20, 10, $score, 'LRTB', '', 'L', 0);
         $pdf->Ln();
         $new_id = $tmp[$i]->id;
     }
     //Output the document
     $pdf->Output('Scores.pdf', 'I');
 }
require 'fpdf.php';
session_start();
$total = 0;
$date = date("d/m/Y");
$address = isset($_SESSION['address']) ? $_SESSION['address'] : '';
$mail = isset($_SESSION['email']) ? $_SESSION['email'] : '';
$pdf = new FPDF();
$pdf->AddPage();
$pdf->SetFont('Courier', 'b', 30);
$pdf->SetTextColor(254, 152, 15);
//can	put	empty	quotes,	bold,	underline,	italics,
$pdf->Image('./images/home/logo.png', 90, 5, 30);
$pdf->Ln();
$pdf->Cell(80, 20, 'RECEIPT');
$pdf->Ln();
$pdf->SetFontSize(14);
$pdf->SetTextColor(0, 0, 0);
$pdf->Cell(80, 20, 'Trendy-Gear');
$pdf->Ln();
$pdf->SetTextColor(254, 152, 15);
$pdf->Cell(80, 20, 'BILL TO');
$pdf->Cell(100, 20, 'RECEIPT DATE');
$pdf->Ln();
$pdf->SetTextColor(0, 0, 0);
$pdf->SetFontSize(12);
$pdf->Cell(80, 1, $mail);
$pdf->Ln();
$pdf->Cell(80, 10, $address);
$pdf->Cell(100, 1, $date);
$pdf->Ln(10);
$pdf->Cell(80, 5, 'Item', 1, 0, 'C', 0);
示例#12
0
 function SetFontSize($size)
 {
     // not sure why, but seems that UTF fonts are bigger than latin1 fonts
     // so analyze and reduce size when required
     switch (strtolower($this->FontFamily)) {
         // fpdf stores font family in lowercase
         case "dejavu":
             if ($size > 1) {
                 $size -= 0.5;
             }
             // no break;
         // no break;
         case "free":
             if ($size > 0) {
                 $size -= 0.5;
             }
             break;
     }
     parent::SetFontSize($size);
 }
}
$pdf = new FPDF();
//set document properties
$pdf->SetAuthor('Alexandr Slovinskiy');
$pdf->SetTitle('Order Annex');
//set font for the entire document
$pdf->AddFont('Times', '', 'times.php');
$pdf->SetFont('Times', '');
$pdf->SetTextColor(0, 0, 0);
//set up a page
$pdf->AddPage('L');
$pdf->SetDisplayMode(real, 'default');
//display the title with a border around it
//Set x and y position for the main text, reduce font size and write content
$pdf->Image('img/form_1-12-2.jpg', 10, 15, 280);
$pdf->SetFontSize(9);
$pdf->SetXY(261, 29.5);
$pdf->Write(5, $_POST["order_number"]);
$pdf->SetXY(197.5, 37);
$pdf->Write(5, $_POST["day"]);
$pdf->SetXY(205, 37);
$pdf->Write(5, $_POST["month"]);
$pdf->SetXY(225.4, 37);
$pdf->Write(5, substr($_POST["year"], 2, 2));
$pdf->SetXY(196, 63);
if ($_POST["search_finance"] == 'b') {
    $pdf->Write(5, "за державним замовленням");
}
if ($_POST["search_finance"] == 'c') {
    $pdf->Write(5, "за рахунок коштів фізичних, юридичних осіб");
}
示例#14
0
//*************************
//** Images **
$imgScaleBorder = 97;
$imgScaleWatermark = 75;
$imgSpacingBorder = 1.5;
$pdf->Image('resources/certificates/border_L.png', $xMarginLeft + $imgSpacingBorder, $yMarginTop + $imgSpacingBorder, $imgScaleBorder);
$pdf->Image('resources/certificates/watermark_light.png', ($wTextArea - $imgScaleWatermark) / 2 + $xLeftTextMargin, $yMarginTop + 7, $imgScaleWatermark);
$pdf->Image('resources/certificates/border_R.png', $xMarginRight - $imgSpacingBorder - $imgScaleBorder, $yMarginBottom - $imgSpacingBorder - $imgScaleBorder, $imgScaleBorder);
//** Title **
$yLine = $yMarginTop + 16;
$pdf->SetFont('Porcelain', '', 42);
$pdf->SetY($yLine);
$pdf->Cell(0, 10, $textTitle, 0, 1, 'C');
//** Body Lines **
$pdf->SetFont('DemiTasse');
$pdf->SetFontSize(14);
$pdf->SetDrawColor(0, 0, 0);
//** Line 1: Gifts **
$yLine = $yLine + 22;
$wStatic = $pdf->GetStringWidth($textGiftStatic);
// $wDynamic = $pdf->GetStringWidth($textGiftDynamic);
$wAvailForDynaimc = $wTextArea - $wStatic - 2 * $wSpace;
//Case 1: Fits on one line
$wDynamic = $pdf->GetStringWidth($textGiftDynamic);
if ($wDynamic <= $wAvailForDynaimc) {
    // $pdf->SetXY(10,10);
    // $pdf->Cell(20,0, "DEBUG: case 1");
    $wSideSpacing = ($wTextArea - $wStatic - $wDynamic - 2 * $wSpace) / 2;
    $xStatic = $xLeftTextMargin + $wSideSpacing;
    $pdf->SetXY($xStatic, $yLine);
    $pdf->Cell($wStatic, 10, $textGiftStatic, 0, 0, 'L');
示例#15
0
function GeneratePresentation($realty_id)
{
    global $app_list_strings;
    $pdf = new FPDF();
    $pdf->AddFont('TimesNewRomanPSMT', '', 'times.php');
    $pdf->AddFont('Times-Italic', 'I', 'timesi.php');
    $pdf->SetAuthor('OfficeWorld');
    $pdf->SetTitle('Presentation');
    $pdf->SetFont('TimesNewRomanPSMT', '', 25);
    $pdf->SetTextColor(100, 100, 100);
    $pdf->AddPage('L');
    $pdf->SetDisplayMode('real', 'default');
    $realty = new Realty();
    $realty->retrieve($realty_id);
    $image_main = '';
    $image_map = array();
    $image_plan = array();
    $images = array();
    $address = array();
    $currency = $realty->currency == 'RUR' ? 'рублей' : 'долларов';
    $operation_text = $app_list_strings['operation_realty_list'][$realty->operation];
    /*if($realty->address_country!='') $address[]=$realty->address_country;
    	if($realty->address_region!='') $address[]=$realty->address_region;
    	if($realty->address_city!='') $address[]=$realty->address_city;*/
    if ($realty->metro != '') {
        $address[] = $realty->metro;
    }
    if ($realty->address_street != '') {
        $address[] = $realty->address_street;
    }
    if ($realty->address_house != '') {
        $address[] = $realty->address_house;
    }
    if ($realty->address_apartment != '') {
        $address[] = "кв." . $realty->address_apartment;
    }
    $address = implode(', ', $address);
    if (is_dir('upload/gallery_images/' . $realty->id)) {
        $db_img = DBManagerFactory::getInstance();
        $sql_img = "SELECT galleria_c FROM realty_cstm WHERE id_c = '" . $realty->id . "'";
        $result_img = $db_img->query($sql_img);
        $row_img = $db_img->fetchByAssoc($result_img);
        $img_str = $row_img['galleria_c'];
        $image = explode('|', $img_str);
        foreach ($image as $key => $value) {
            $value = str_replace('^,^', '|', $value);
            $value = str_replace('^', '', $value);
            $image_t = explode('|', $value);
            if ($image_t[2] == 'main') {
                $image_main = $image_t[1];
            } elseif ($image_t[8] == 'on') {
                $image_map = $image_t;
            } elseif ($image_t[9] == 'on') {
                $image_plan = $image_t;
            } elseif ($image_t[7] == 'on') {
                $images[] = $image_t;
            }
        }
    }
    $pdf->SetXY(0, 5);
    $text = decode("{$operation_text}\n{$address}");
    $pdf->MultiCell(297, 7, $text, 0, 'C');
    $y = $pdf->GetY() + 5;
    if ($image_main != '') {
        $img = "upload/gallery_images/{$realty->id}/{$image_main}";
        list($w_i, $h_i) = getimagesize($img);
        if ($w_i - $h_i > $w_i * 0.3) {
            $y += (184 - $y - $h_i * 284 / $w_i) / 2;
            $pdf->Image($img, 6, 15 + $y, 284, 0);
        } else {
            $x = (284 - $w_i * (184 - $y) / $h_i) / 2;
            $pdf->Image($img, 6 + $x, $y, 0, 184 - $y);
        }
    }
    //Footer
    $pdf->Image('custom/Presentation/footer_main.png', 0, 172, 297, 0);
    //Page2
    $pdf->SetTextColor(255, 255, 255);
    if (isset($image_map[1])) {
        $pdf->AddPage('L');
        $img = "upload/gallery_images/{$realty->id}/{$image_map[1]}";
        list($w_i, $h_i) = getimagesize($img);
        if ($w_i - $h_i > $w_i * 0.3) {
            $y = (178 - $h_i * 284 / $w_i) / 2;
            $pdf->Image($img, 6, 15 + $y, 284, 0);
        } else {
            $x = (284 - $w_i * 178 / $h_i) / 2;
            $pdf->Image($img, 6 + $x, 15, 0, 178);
        }
        //Header
        $pdf->Image('custom/Presentation/header.png', 0, 0, 297, 0);
        $pdf->SetXY(0, 5);
        $pdf->SetFontSize(30);
        $text = decode($image_map[0]);
        $pdf->MultiCell(297, 7, $text, 0, 'C');
        //Footer
        $pdf->Image('custom/Presentation/footer.png', 0, 187, 297, 0);
    }
    //Page3
    if (isset($image_plan[1])) {
        $pdf->AddPage('L');
        $img = "upload/gallery_images/{$realty->id}/{$image_plan[1]}";
        list($w_i, $h_i) = getimagesize($img);
        if ($w_i - $h_i > $w_i * 0.3) {
            $y = (178 - $h_i * 284 / $w_i) / 2;
            $pdf->Image($img, 6, 15 + $y, 284, 0);
        } else {
            $x = (284 - $w_i * 178 / $h_i) / 2;
            $pdf->Image($img, 6 + $x, 15, 0, 178);
        }
        //Header
        $pdf->Image('custom/Presentation/header.png', 0, 0, 297, 0);
        $pdf->SetXY(0, 5);
        $pdf->SetFontSize(30);
        $text = decode($image_plan[0]);
        $pdf->MultiCell(297, 7, $text, 0, 'C');
        //Footer
        $pdf->Image('custom/Presentation/footer.png', 0, 187, 297, 0);
    }
    //Page OtherImages
    foreach ($images as $image) {
        $pdf->AddPage('L');
        $img = "upload/gallery_images/{$realty->id}/{$image[1]}";
        list($w_i, $h_i) = getimagesize($img);
        if ($w_i - $h_i > $w_i * 0.3) {
            $y = (178 - $h_i * 284 / $w_i) / 2;
            $pdf->Image($img, 6, 15 + $y, 284, 0);
        } else {
            $x = (284 - $w_i * 178 / $h_i) / 2;
            $pdf->Image($img, 6 + $x, 15, 0, 178);
        }
        //Header
        $pdf->Image('custom/Presentation/header.png', 0, 0, 297, 0);
        $pdf->SetXY(0, 5);
        $pdf->SetFontSize(30);
        $text = decode($image[0]);
        $pdf->MultiCell(297, 7, $text, 0, 'C');
        //Footer
        $pdf->Image('custom/Presentation/footer.png', 0, 187, 297, 0);
    }
    //Page last
    $pdf->AddPage('L');
    //Header
    $pdf->Image('custom/Presentation/header.png', 0, 0, 297, 0);
    $pdf->SetXY(0, 5);
    $text = decode("Описание помещения");
    $pdf->MultiCell(297, 7, $text, 0, 'C');
    //Body
    $pdf->SetTextColor(0, 0, 0);
    $pdf->SetFillColor(200, 200, 255);
    $pdf->SetY(40);
    //if($realty->operation=='rent'){
    $pdf->SetFontSize(24);
    drawProp($pdf, "Основная информация", '', true, 8);
    $pdf->SetFontSize(16);
    drawProp($pdf, "Вид объекта", $app_list_strings['kind_of_realty_list'][$realty->kind_of_realty], false, 8);
    drawProp($pdf, "Количество комнат", $realty->rooms_quantity, true, 8);
    drawProp($pdf, "Этаж/Этажность", "{$realty->floor}/{$realty->number_of_floors}", false, 8);
    $pdf->SetFontSize(20);
    drawProp($pdf, "Текущая цена", "{$realty->cost} {$currency}", true, 10);
    $pdf->SetY($pdf->GetY() + 20);
    $pdf->SetFillColor(255, 200, 200);
    $pdf->SetFontSize(24);
    drawProp($pdf, "Параметры объекта:", '', true, 8);
    $pdf->SetFontSize(16);
    drawProp($pdf, "Общая площадь", $realty->square . " кв.м", false, 8);
    drawProp($pdf, "Жилая площадь", $realty->living_square . " кв.м", true, 8);
    drawProp($pdf, "Площадь кухни", $realty->kitchen_square . " кв.м", false, 8);
    drawProp($pdf, "Состояние объекта", $app_list_strings['state_of_object_list'][$realty->state_of_object], true, 8);
    /*}else{
    		$pdf->SetFontSize(18);
    		drawProp($pdf, "Общая площадь", $realty->square_total." кв.м", true);
    		$pdf->SetFontSize(28);
    		$realty->cost_buying=number_format($realty->cost_buying, 0, ',', ' ');
    	}*/
    //Footer
    $pdf->Image('custom/Presentation/footer.png', 0, 187, 297, 0);
    /* $pdf->SetTextColor(255,255,255);
    	$pdf->SetXY(20,190); 
        $pdf->SetFontSize(14);
    	$text=decode("+7 (499) 707-50-57\n+7 (926) 531-09-93");
    	$pdf->MultiCell(100, 1, $text, 0, 'L'); */
    $pdf->Output("custom/Presentation/pdf/ID-{$realty->id}.pdf");
    return "custom/Presentation/pdf/ID-{$realty->id}.pdf";
}
$pdf->AddFont('Times', '', 'times.php');
$pdf->SetFont('Times', '');
$pdf->SetTextColor(0, 0, 0);
//set up a page
$pdf->AddPage('P');
$pdf->SetDisplayMode(real, 'default');
//display the title with a border around it
//Set x and y position for the main text, reduce font size and write content
$pdf->Image('img/form-1-06-1.jpg', 15, 5, 190);
if ($study_type == "Денне") {
    $pdf->Line(96, 37, 109, 37);
}
if ($study_type == "Заочне") {
    $pdf->Line(111, 37, 125, 37);
}
$pdf->SetFontSize(14);
$pdf->SetXY(95, 54);
if ($mag == 1) {
    $pdf->Write(5, "магістр");
}
if ($mag == 0) {
    $pdf->Write(5, "спеціаліст");
}
$pdf->SetXY(174, 80.5);
$pdf->Write(5, date("y", time()));
$pdf->AddPage('P');
$pdf->Image('img/form-1-06-2.jpg', 15, 5, 190);
$pdf->SetXY(45, 193);
$pdf->Write(5, $executive);
$pdf->SetXY(70, 211);
$pdf->Write(5, date("y", time()));
function report_head($report_id)
{
    $q = new mysql_squid_builder();
    $ligne = mysql_fetch_array($q->QUERY_SQL("SELECT * FROM `squid_reports` WHERE ID='{$report_id}'"));
    build_progress($report_id, "Building Report...", 15);
    $pdf = new FPDF();
    $pdf->SetFont('times', '', 12);
    $pdf->SetTextColor(50, 60, 100);
    $linetime = report_by_category_pdf_range_dayz($report_id) . " - ( " . report_by_category_pdf_sumsize($report_id) . " )";
    //set up a page
    $pdf->AddPage('P');
    $pdf->SetTitle($ligne["report_name"]);
    $pdf->SetDisplayMode(real, 'default');
    $pdf->SetXY(5, 10);
    $pdf->SetFontSize(32);
    $pdf->Write(5, $ligne["report_name"]);
    $pdf->Ln();
    $pdf->Ln();
    $pdf->SetFontSize(18);
    $x1 = $pdf->GetX();
    $y1 = $pdf->GetY();
    $pdf->Line(0, $y1, 210, $y1);
    $pdf->SetFont('times', 'I', 12);
    $pdf->Write(15, $ligne["description"] . " {$linetime}");
    $pdf->SetFont('times', 'I', 12);
    $pdf->Write(15, " " . @implode(" and ", $GLOBALS["EXPLAIN_QUERY"]));
    $pdf->Ln();
    $pdf->SetFontSize(16);
    $pdf->SetFont('times', '', 12);
    return $pdf;
}
示例#18
0
 public function post_id_handler()
 {
     global $FANNIE_OP_DB, $FANNIE_TRANS_DB, $FANNIE_ROOT, $FANNIE_ARCHIVE_DB;
     $dbc = FannieDB::get($FANNIE_OP_DB);
     $cards = "(";
     $args = array();
     if (!is_array($this->id)) {
         $this->id = array($this->id);
     }
     foreach ($this->id as $c) {
         $cards .= "?,";
         $args[] = $c;
     }
     $cards = rtrim($cards, ",");
     $cards .= ")";
     $cardsClause = " AND m.card_no IN {$cards} ";
     if ($cards == "(") {
         $cardsClause = "";
     }
     /**
       Look up transactions involving AR over last 90 days
     */
     $transP = $dbc->prepare("\n            SELECT card_no, \n                CASE WHEN trans_subtype='MI' THEN -total ELSE 0 END AS charges,\n                CASE WHEN department=990 then total ELSE 0 END as payments, \n                tdate, \n                trans_num\n            FROM " . $FANNIE_TRANS_DB . $dbc->sep() . "dlog_90_view AS m \n            WHERE m.card_no IN " . $cards . "\n                AND (department=990 OR trans_subtype='MI')\n            ORDER BY card_no, \n                tdate, \n                trans_num");
     $transP = $dbc->prepare("\n            SELECT card_no,\n                charges,\n                payments,\n                tdate,\n                trans_num,\n                'OLD' as timespan\n            FROM " . $FANNIE_TRANS_DB . $dbc->sep() . "ar_history \n            WHERE card_no IN " . $cards . "\n                AND tdate >= ?\n            UNION ALL\n            SELECT card_no,\n                charges,\n                payments,\n                tdate,\n                trans_num,\n                'TODAY' as timespan\n            FROM " . $FANNIE_TRANS_DB . $dbc->sep() . "ar_history_today\n            WHERE card_no IN " . $cards . "\n            ORDER BY tdate");
     $date = date('Y-m-d', mktime(0, 0, 0, date('n'), date('j') - 90, date('Y')));
     $trans_args = $args;
     $trans_args[] = $date;
     foreach ($args as $a) {
         // need cards twice for the union
         $trans_args[] = $a;
     }
     $transR = $dbc->execute($transP, $trans_args);
     $arRows = array();
     while ($w = $dbc->fetch_row($transR)) {
         if (!isset($arRows[$w['card_no']])) {
             $arRows[$w['card_no']] = array();
         }
         $arRows[$w['card_no']][] = $w;
         $date = explode(' ', $w['tdate']);
         $date_id = date('Ymd', strtotime($date[0]));
     }
     /**
       Lookup details of AR related transactions
       Stucture is:
       * card_no
         => trans_num
            => line item description(s)
     */
     $detailsQ = '
         SELECT card_no,
             description,
             department,
             trans_num
         FROM ' . $FANNIE_ARCHIVE_DB . $dbc->sep() . 'dlogBig
         WHERE tdate BETWEEN ? AND ?
             AND trans_num=?
             AND card_no=?
             AND trans_type IN (\'I\', \'D\')
     ';
     $todayQ = str_replace($FANNIE_ARCHIVE_DB . $dbc->sep() . 'dlogBig', $FANNIE_TRANS_DB . $dbc->sep() . 'dlog', $detailsQ);
     $detailsP = $dbc->prepare($detailsQ);
     $todayP = $dbc->prepare($todayQ);
     $details = array();
     foreach ($arRows as $card_no => $trans) {
         $found_charge = false;
         foreach ($trans as $info) {
             if ($info['charges'] != 0) {
                 $found_charge = true;
             }
             $dt = strtotime($info['tdate']);
             $args = array(date('Y-m-d 00:00:00', $dt), date('Y-m-d 23:59:59', $dt), $info['trans_num'], $info['card_no']);
             if ($info['timespan'] == 'TODAY') {
                 $r = $dbc->execute($todayP, $args);
             } else {
                 $r = $dbc->execute($detailsP, $args);
             }
             while ($w = $dbc->fetch_row($r)) {
                 $tn = $w['trans_num'];
                 if (!isset($details[$w['card_no']])) {
                     $details[$w['card_no']] = array();
                 }
                 if (!isset($details[$w['card_no']][$tn])) {
                     $details[$w['card_no']][$tn] = array();
                 }
                 $details[$w['card_no']][$tn][] = $w['description'];
             }
         }
         if ($found_charge) {
             $actual = array();
             $i = 0;
             while ($arRows[$card_no][$i]['charges'] == 0) {
                 $i++;
             }
             for ($i; $i < count($arRows[$card_no]); $i++) {
                 $actual[] = $arRows[$card_no][$i];
             }
             $arRows[$card_no] = $actual;
         }
     }
     $today = date("d-F-Y");
     $month = date("n");
     $year = date("Y");
     $stateDate = date("d F, Y", mktime(0, 0, 0, date('n'), 0, date('Y')));
     $pdf = new FPDF('P', 'mm', 'Letter');
     $pdf->AddFont('Gill', '', 'GillSansMTPro-Medium.php');
     $pdf->SetAutoPageBreak(false);
     //Meat of the statement
     $balP = $dbc->prepare('
         SELECT balance
         FROM ' . $this->config->get('TRANS_DB') . $dbc->sep() . 'ar_live_balance
         WHERE card_no=?');
     $rowNum = 0;
     foreach ($this->id as $card_no) {
         $account = \COREPOS\Fannie\API\member\MemberREST::get($card_no);
         $primary = array();
         foreach ($account['customers'] as $c) {
             if ($c['accountHolder']) {
                 $primary = $c;
                 break;
             }
         }
         $balance = $dbc->getValue($balP, array($card_no));
         $pdf->AddPage();
         $pdf->Image('new_letterhead_horizontal.png', 5, 10, 200);
         $pdf->SetFont('Gill', '', '12');
         $pdf->Ln(45);
         $pdf->Cell(10, 5, sprintf("Invoice #: %s-%s", $card_no, date("ymd")), 0, 1, 'L');
         $pdf->Cell(10, 5, $stateDate, 0);
         $pdf->Ln(8);
         //Member address
         $name = $primary['lastName'];
         if (!empty($primary['firstName'])) {
             $name = $primary['firstName'] . ' ' . $name;
         }
         $pdf->Cell(50, 10, trim($card_no) . ' ' . trim($name), 0);
         $pdf->Ln(5);
         $pdf->Cell(80, 10, $account['addressFirstLine'], 0);
         $pdf->Ln(5);
         if ($account['addressSecondLine']) {
             $pdf->Cell(80, 10, $account['addressSecondLine'], 0);
             $pdf->Ln(5);
         }
         $pdf->Cell(90, 10, $account['city'] . ', ' . $account['state'] . '   ' . $account['zip'], 0);
         $pdf->Ln(25);
         $txt = "If payment has been made or sent, please ignore this invoice. If you have any questions about this invoice or would like to make arrangements to pay your balance, please write or call the Finance Department at the above address or (218) 728-0884.";
         $pdf->MultiCell(0, 5, $txt);
         $pdf->Ln(10);
         $priorQ = $dbc->prepare("\n                SELECT SUM(charges) - SUM(payments) AS priorBalance\n                FROM " . $FANNIE_TRANS_DB . $dbc->sep() . "ar_history\n                WHERE " . $dbc->datediff('tdate', $dbc->now()) . " < -90\n                    AND card_no = ?");
         $priorR = $dbc->execute($priorQ, array($card_no));
         $priorW = $dbc->fetch_row($priorR);
         $priorBalance = is_array($priorW) ? $priorW['priorBalance'] : 0;
         $indent = 10;
         $columns = array(75, 35, 30, 30);
         $pdf->Cell($indent, 8, '');
         $pdf->SetFillColor(200);
         $pdf->Cell(40, 8, 'Balance Forward', 0, 0, 'L', 1);
         $pdf->Cell(25, 8, '$ ' . sprintf("%.2f", $priorBalance), 0, 0, 'L');
         $pdf->Ln(8);
         $pdf->Cell(0, 8, "90-Day Billing History", 0, 1, 'C');
         $pdf->SetFillColor(200);
         $pdf->Cell($indent, 8, '', 0, 0, 'L');
         $pdf->Cell($columns[0], 8, 'Date', 0, 0, 'L', 1);
         $pdf->Cell($columns[1], 8, 'Receipt', 0, 0, 'L', 1);
         $pdf->Cell($columns[2], 8, '', 0, 0, 'L', 1);
         $pdf->Cell($columns[3], 8, 'Amount', 0, 1, 'L', 1);
         $gazette = false;
         if (!isset($arRows[$card_no])) {
             $arRows[$card_no] = array();
         }
         foreach ($arRows[$card_no] as $arRow) {
             $date = $arRow['tdate'];
             $trans = $arRow['trans_num'];
             $charges = $arRow['charges'];
             $payment = $arRow['payments'];
             $detail = $details[$card_no][$trans];
             if (strstr($detail[0], "Gazette Ad")) {
                 $gazette = true;
             }
             $lineitem = count($detail) == 1 ? $detail[0] : '(multiple items)';
             foreach ($detail as $line) {
                 if ($line == 'ARPAYMEN') {
                     $lineitem = 'Payment Received - Thank You';
                 }
             }
             $pdf->Cell($indent, 8, '', 0, 0, 'L');
             $pdf->Cell($columns[0], 8, $date, 0, 0, 'L');
             $pdf->Cell($columns[1], 8, $trans, 0, 0, 'L');
             $pdf->Cell($columns[2], 8, '', 0, 0, 'L');
             if ($payment > $charges) {
                 $pdf->Cell($columns[3], 8, '$ ' . sprintf('%.2f', $payment - $charges), 0, 0, 'L');
             } else {
                 $pdf->Cell($columns[3], 8, '$ ' . sprintf('(%.2f)', abs($payment - $charges)), 0, 0, 'L');
             }
             if ($pdf->GetY() > 245) {
                 $pdf->AddPage();
             } else {
                 $pdf->Ln(5);
             }
             if (!empty($lineitem)) {
                 $pdf->SetFontSize(10);
                 $pdf->Cell($indent + 10, 8, '', 0, 0, 'L');
                 $pdf->Cell(60, 8, $lineitem, 0, 0, 'L');
                 if ($pdf->GetY() > 245) {
                     $pdf->AddPage();
                 } else {
                     $pdf->Ln(5);
                 }
                 $pdf->SetFontSize(12);
             }
         }
         $pdf->Ln(15);
         $pdf->Cell($indent, 8, '');
         $pdf->SetFillColor(200);
         if ($balance >= 0) {
             $pdf->Cell(35, 8, 'Amount Due', 0, 0, 'L', 1);
         } else {
             $pdf->Cell(35, 8, 'Credit Balance', 0, 0, 'L', 1);
         }
         $pdf->Cell(25, 8, '$ ' . sprintf("%.2f", $balance), 0, 0, 'L');
         if ($gazette) {
             $pdf->SetLeftMargin(10);
             $pdf->Image('logo_bw.png', 85, 213, 25);
             $pdf->SetY(205);
             $pdf->Cell(0, 8, '', 'B', 1);
             $pdf->Ln(5);
             $pdf->Cell(30, 5, 'Whole Foods Co-op');
             $pdf->Cell(115, 5, '');
             $pdf->Cell(20, 5, 'Invoice Date:', 0, 0, 'R');
             $pdf->Cell(20, 5, date("m/d/Y"), 0, 1, 'L');
             $pdf->Cell(30, 5, '610 East 4th Street');
             $pdf->Cell(115, 5, '');
             $pdf->Cell(20, 5, 'Customer Number:', 0, 0, 'R');
             $pdf->Cell(20, 5, $card_no, 0, 1, 'L');
             $pdf->Cell(30, 5, 'Duluth, MN 55805');
             $pdf->Cell(115, 5, '');
             $pdf->Cell(20, 5, 'Invoice Total:', 0, 0, 'R');
             $pdf->Cell(20, 5, $balance, 0, 1, 'L');
             $pdf->Ln(5);
             $pdf->Cell(10, 10, trim($card_no), 0);
             $pdf->Ln(5);
             $pdf->Cell(50, 10, trim($primary['lastName']), 0);
             $pdf->Ln(5);
             $pdf->Cell(80, 10, $account['addressFirstLine'], 0);
             if ($account['addressSecondLine']) {
                 $pdf->Ln(5);
                 $pdf->Cell(80, 10, $account['addressSecondLine'], 0);
             }
             $pdf->Ln(5);
             $pdf->Cell(90, 10, $account['city'] . ', ' . $account['state'] . '   ' . $account['zip'], 0);
             $pdf->SetXY(80, 240);
             $pdf->SetFontSize(10);
             $pdf->MultiCell(110, 6, "( ) Please continue this ad in the next issue.\n( ) I would like to make some changes to my ad for the next issue.\n( ) I do not wish to continue an ad in the next issue.\n( ) I will contact you at a later date with my advertising decision.");
             $pdf->Ln(3);
             $pdf->SetFontSize(12);
             $pdf->Cell(0, 8, 'Please Return This Portion With Your Payment', 0, 0, 'C');
         }
     }
     $pdf->Output('makeStatement.pdf', 'D');
     return false;
 }
示例#19
0
 function outputPDF()
 {
     global $FANNIE_PLUGIN_SETTINGS;
     $dbc = FannieDB::get($FANNIE_PLUGIN_SETTINGS['OverShortDatabase']);
     $start = FormLib::get_form_value('startDate');
     $end = FormLib::get_form_value('endDate');
     $fs = 12;
     $pdf = new FPDF("P", "mm", "A4");
     $pdf->SetFont('Arial', '', $fs);
     $pdf->SetMargins(5, 5, 5);
     $pdf->SetAutoPageBreak(True, 5);
     $pdf->AddPage();
     $dateClause = $start;
     if ($start != $end) {
         $dateClause = $start . " " . $end;
     }
     /**
       Print check amounts in vertical columns
       Overly complicated. Bank requirements suck.
     */
     $query = "select checks from dailyChecks where\n            date BETWEEN ? AND ?\n            order by \n              case when id >= 68 then id+1\n              when id = 43 then 68\n              else id end";
     $prep = $dbc->prepare_statement($query);
     $result = $dbc->exec_statement($prep, array($start, $end));
     $acc = array();
     $counts = array();
     $ckSum = 0;
     $width = 30;
     $num = 1;
     $breakon = 1;
     while ($row = $dbc->fetch_row($result)) {
         $real = $num;
         if (($num - 1) % 6 == 0 && $num > 0 && $num != $breakon) {
             $pdf->AddPage();
             $breakon = $num;
         }
         if ($num > 6) {
             $real = $num % 6;
             if ($real == 0) {
                 $real = 6;
             }
         }
         $vals = explode(",", $row[0]);
         $extra = array();
         $vcount = 0;
         foreach ($vals as $v) {
             if (is_numeric($v)) {
                 $vcount++;
             }
         }
         // accumulate up to 57 checks
         // that's max column size
         // put any leftovers in $extra
         if ($vcount + count($acc) <= 57) {
             foreach ($vals as $v) {
                 if (is_numeric($v)) {
                     array_push($acc, $v);
                 }
             }
         } else {
             foreach ($vals as $v) {
                 if (is_numeric($v)) {
                     array_push($extra, $v);
                 }
             }
         }
         // if there are $extra values, then
         // accumulator $acc is full so print
         // a column
         if (count($extra) > 0) {
             $str1 = "WFC #{$num}\n";
             $sum = 0;
             $str = "";
             for ($j = 0; $j < 57; $j++) {
                 if ($j < count($acc)) {
                     $str .= sprintf("%.2f", $acc[$j]);
                     $sum += $acc[$j];
                 }
                 $str .= "\n";
             }
             $str2 = "TTL: " . sprintf("%.2f", $sum);
             $str3 = "CT: " . count($acc);
             array_push($counts, $sum);
             $ckSum += $sum;
             $j = 1;
             if ($real == 1) {
                 $j = 0;
             }
             $k = 6;
             if ($real == 6) {
                 $k = 2;
             }
             $pdf->SetXY(($width - 0) * $j + ($width + 7) * ($real - 1 - $j), 10);
             $pdf->MultiCell($width + ($j == 0 ? -1 : $k), 5, $str1, 'R', 'L');
             $pdf->SetX(($width - 0) * $j + ($width + 7) * ($real - 1 - $j));
             $pdf->SetFontSize($fs - 1);
             $pdf->MultiCell($width + ($j == 0 ? -1 : $k), 4.35, $str, 'R', 'L');
             $pdf->SetX(($width - 0) * $j + ($width + 7) * ($real - 1 - $j));
             $pdf->SetFont('Arial', 'B', $fs - 1);
             $pdf->MultiCell($width + ($j == 0 ? -1 : $k), 5, $str2, 'R', 'L');
             $pdf->SetFont('Arial', '', $fs - 1);
             $pdf->SetX(($width - 0) * $j + ($width + 7) * ($real - 1 - $j));
             $pdf->MultiCell($width + ($j == 0 ? -1 : $k), 5, $str3, 'R', 'L');
             $acc = array();
             $num++;
             // put $extra values into the accumulator
             foreach ($extra as $e) {
                 array_push($acc, $e);
             }
         }
     }
     $str1 = "WFC #{$num}\n";
     $real = $num;
     if ($num % 7 == 0 && $num > 0) {
         $pdf->AddPage();
     }
     if ($num > 6) {
         $real = $num % 6;
         if ($real == 0) {
             $real = 6;
         }
     }
     if (count($acc) > 0) {
         $sum = 0;
         $str = "";
         for ($j = 0; $j < 57; $j++) {
             if ($j < count($acc)) {
                 $str .= sprintf("%.2f", $acc[$j]);
                 $sum += $acc[$j];
             }
             $str .= "\n";
         }
         $str2 = "TTL: " . sprintf("%.2f", $sum);
         $str3 = "CT: " . count($acc);
         array_push($counts, $sum);
         $ckSum += $sum;
         $j = 1;
         if ($real == 1) {
             $j = 0;
         }
         $k = 6;
         if ($real == 6) {
             $k = 2;
         }
         $pdf->SetXY(($width - 0) * $j + ($width + 7) * ($real - 1 - $j), 10);
         $pdf->MultiCell($width + ($j == 0 ? -1 : $k), 5, $str1, 'R', 'L');
         $pdf->SetX(($width - 0) * $j + ($width + 7) * ($real - 1 - $j));
         $pdf->SetFontSize($fs - 1);
         $pdf->MultiCell($width + ($j == 0 ? -1 : $k), 4.35, $str, 'R', 'L');
         $pdf->SetX(($width - 0) * $j + ($width + 7) * ($real - 1 - $j));
         $pdf->SetFont('Arial', 'B', $fs);
         $pdf->MultiCell($width + ($j == 0 ? -1 : $k), 5, $str2, 'R', 'L');
         $pdf->SetFont('Arial', '', $fs);
         $pdf->SetX(($width - 0) * $j + ($width + 7) * ($real - 1 - $j));
         $pdf->MultiCell($width + ($j == 0 ? -1 : $k), 5, $str3, 'R', 'L');
     }
     // seven columns can fit on a full page
     // four columns fit on the page containing the
     // deposit summary
     if ($num % 7 > 4) {
         $pdf->AddPage();
     }
     /* shift last box over a bit */
     $width += 3;
     $pdf->SetXY(($width + 2) * 4 + 5, 10);
     $pdf->SetFillColor(0, 0, 0);
     $pdf->SetTextColor(255, 255, 255);
     $pdf->SetFontSize(12);
     $str = "Whole Foods Community\nCO-OP Deposit Slip\n";
     $str .= trim(file_get_contents("acct"), "\r\n") . "\n\n";
     $str .= "Date\t" . date("m/d/y") . "\n";
     $pdf->MultiCell(55, 5, $str, 0, 'C', 1);
     $pdf->SetTextColor(0, 0, 0);
     $str = "";
     for ($i = 0; $i < 10 || $i < count($counts); $i++) {
         $str .= "Check # " . ($i + 1) . ":";
         if ($i < count($counts)) {
             $str .= "\t\t{$counts[$i]}";
         }
         $str .= "\n";
     }
     $pdf->SetX(($width + 2) * 4 + 5);
     $pdf->MultiCell(55, 7, $str, 'LR', 'L');
     $dbstack = array('buyAmount' => array(), 'depositAmount' => array());
     $dbQ = "SELECT rowName,denomination,amt FROM dailyDeposit WHERE\n            dateStr = ? AND rowName IN ('buyAmount','depositAmount')";
     $dbP = $dbc->prepare_statement($dbQ);
     $dbR = $dbc->exec_statement($dbP, array($dateClause));
     while ($dbW = $dbc->fetch_row($dbR)) {
         $dbstack[$dbW[0]][$dbW[1]] = $dbW[2];
     }
     $coin = 0;
     if (isset($dbstack['depositAmount']['0.01'])) {
         $coin += $dbstack['depositAmount']['0.01'];
     }
     if (isset($dbstack['depositAmount']['0.05'])) {
         $coin += $dbstack['depositAmount']['0.05'];
     }
     if (isset($dbstack['depositAmount']['0.10'])) {
         $coin += $dbstack['depositAmount']['0.10'];
     }
     if (isset($dbstack['depositAmount']['0.25'])) {
         $coin += $dbstack['depositAmount']['0.25'];
     }
     $junk = 0;
     if (isset($dbstack['depositAmount']['Junk'])) {
         $junk += $dbstack['depositAmount']['Junk'];
     }
     $cash = 0;
     if (isset($dbstack['depositAmount']['1.00'])) {
         $cash += $dbstack['depositAmount']['1.00'];
     }
     if (isset($dbstack['depositAmount']['5.00'])) {
         $cash += $dbstack['depositAmount']['5.00'];
     }
     if (isset($dbstack['depositAmount']['10.00'])) {
         $cash += $dbstack['depositAmount']['10.00'];
     }
     if (isset($dbstack['depositAmount']['20.00'])) {
         $cash += $dbstack['depositAmount']['20.00'];
     }
     if (isset($dbstack['depositAmount']['50.00'])) {
         $cash += $dbstack['depositAmount']['50.00'];
     }
     if (isset($dbstack['depositAmount']['100.00'])) {
         $cash += $dbstack['depositAmount']['100.00'];
     }
     $pdf->SetX(($width + 2) * 4 + 5);
     $pdf->Cell(15, 7, 'Checks', 'L', 0, 'L');
     $pdf->Cell(40, 7, "\t\$" . sprintf('%.2f', $ckSum), 'TBR', 1);
     //$pdf->Cell(40,7,"",'TBR',1);
     $pdf->SetX(($width + 2) * 4 + 5);
     $pdf->Cell(15, 7, 'Coin', 'L', 0, 'L');
     $pdf->Cell(40, 7, "\t\$" . sprintf('%.2f', $coin), 'TBR', 1);
     $pdf->SetX(($width + 2) * 4 + 5);
     $pdf->Cell(15, 7, 'Cash', 'L', 0, 'L');
     $pdf->Cell(40, 7, "\t\$" . sprintf('%.2f', $cash), 'TBR', 1);
     $pdf->SetX(($width + 2) * 4 + 5);
     $pdf->Cell(15, 7, 'Other', 'L', 0, 'L');
     $pdf->Cell(40, 7, "\t\$" . sprintf('%.2f', $junk), 'TBR', 1);
     $pdf->SetX(($width + 2) * 4 + 5);
     $pdf->Cell(15, 7, 'Total', 'L', 0, 'L');
     $pdf->Cell(40, 7, "\t\$" . sprintf('%.2f', $junk + $cash + $coin + $ckSum), 'TBR', 1);
     $pdf->SetTextColor(255, 255, 255);
     $pdf->SetX(($width + 2) * 4 + 5);
     $pdf->MultiCell(55, 5, "Change Request", 0, 'C', 1);
     $pdf->SetTextColor(0, 0, 0);
     $denoms = array('0.01', '0.05', '0.10', '0.25', '1.00', '5.00', '10.00');
     $total = array_sum($dbstack['buyAmount']);
     if (!empty($dbstack['buyAmount'])) {
         if ($dbstack['buyAmount']['0.01'] > 50) {
             $total = $dbstack['buyAmount']['0.01'];
         }
         foreach ($denoms as $d) {
             $pdf->SetX(($width + 2) * 4 + 5);
             $pdf->Cell(10, 7, '$', 'L', 0, 'L');
             $pdf->Cell(10, 7, "{$d}", 0, 0, 'R');
             $pdf->Cell(35, 7, $dbstack['buyAmount'][$d], 'RB', 1, 'C');
         }
     }
     $pdf->SetX(($width + 2) * 4 + 5);
     $pdf->Cell(20, 7, "Total:", 'LB', 0, 'R');
     $pdf->Cell(35, 7, sprintf('%.2f', $total), 'RB', 1, 'C');
     $pdf->Output('deposit.pdf', 'I');
 }
示例#20
0
    public static function createEmptyRenderError($filename,$filepath){


        require_once(Yii::app()->basePath.'/extensions/Fpdf/fpdf.php');

        $pdf = new FPDF('P','mm','Letter');

        $pdf->SetAuthor('ASA AP');
        $pdf->SetTitle('Render error');
        //set font for the entire document
        $pdf->SetFont('Helvetica','B',20);
        $pdf->SetTextColor(255,0,0);
        //set up a page
        $pdf->AddPage('P');
        $pdf->SetDisplayMode(90,'default');

        //Set x and y position for the main text, reduce font size and write content
        $pdf->SetXY (30,55);
        $pdf->SetFontSize(15);
        $pdf->Write(5,'Existing document '.$filename.' can\'t be rendered');
        //Output the document
        $pdf->Output($filepath,'F');
        $pdf->Close();

        return $filepath;
    }
示例#21
0
$pdf->SetAutoPageBreak(true, 0);
////////////////////////////////////////////////////////////
// HEADER
$pdf->Image("http://www.coinkeychain.com/wp-content/uploads/2013/12/header-pdf.jpg", 0, 0, 210, 35);
$startY = 45;
// POLICE
$pdf->SetTextColor(0, 0, 0);
$pdf->SetFont('Arial', 'BU', '14');
////////////////////
// POSITION DE DEPART
// $pdf->Ln(10); // Saut de ligne
$pdf->setX(10);
$pdf->setY($startY);
////////////////////
// TITRE
$pdf->SetFontSize('14');
$pdf->Cell(0, 0, $product->post_title, '', 0, 'C');
////////////////////
$images = rwmb_meta('PRODUCT_first_image', 'type=image&size=large', $idProduct);
foreach ($images as $image) {
    $pdf->setX(10);
    $pdf->Image($image['url'], 10, $startY + 5, 75, 75);
}
// DESCRIPTION
//////////////////
$product->post_content = str_replace("<strong>", "", $product->post_content);
$product->post_content = str_replace("</strong>", "", $product->post_content);
$pdf->SetXY(90, $startY + 10);
$pdf->SetFont('Arial', 'B', 12);
$pdf->MultiCell(0, 5, utf8_decode($product->post_content), 0, 1, 'L');
//////////////////
示例#22
0
 public function pdfcreateAction()
 {
     require "lib/fpdf/fpdf.php";
     //Page footer
     function Footer()
     {
         //Position at 1.5 cm from bottom
         $this->SetY(-15);
         //Arial italic 8
         $this->SetFont('Arial', 'I', 8);
         //Page number
         $this->Cell(0, 10, 'Page ' . $this->PageNo() . '/{nb}', 0, 0, 'C');
     }
     $pdf = new FPDF();
     $pdf->AliasNbPages();
     $todate = date("D M j Y");
     $time = date(" G:i:s T");
     $storePhone = Mage::getStoreConfig('general/store_information/phone');
     $store_email = Mage::getStoreConfig('trans_email/ident_support/email');
     $freeSubTotal = Mage::getStoreConfig('carriers/freeshipping/free_shipping_subtotal');
     $session = Mage::getSingleton('checkout/session')->getQuote()->getAllItems();
     //print_r($session);die;
     $img_path = Mage::getBaseUrl() . 'skin/frontend/default/zoffio/images/logo_print.gif';
     $telephone = Mage::getBaseUrl() . 'skin/frontend/default/zoffio/images/telephone.png';
     $mail = Mage::getBaseUrl() . 'skin/frontend/default/zoffio/images/mail.png';
     $indianrupee = Mage::getBaseUrl() . 'skin/frontend/default/zoffio/images/rupee.png';
     $indian_rupee_symbol = Mage::getBaseUrl() . 'skin/frontend/default/zoffio/images/total.png';
     $indian_rupee = Mage::getBaseUrl() . 'skin/frontend/default/zoffio/images/savings.png';
     $sub_total = Mage::getBaseUrl() . 'skin/frontend/default/zoffio/images/sub-total1.png';
     $shipping = Mage::getBaseUrl() . 'skin/frontend/default/zoffio/images/shipping.png';
     $discount_image = Mage::getBaseUrl() . 'skin/frontend/default/zoffio/images/discount.png';
     $store_address = Mage::getStoreConfig('general/store_information/address');
     $split_store_address = explode(',', $store_address);
     $pdf->AddPage();
     $linestyle = array('width' => 0.1, 'cap' => 'butt', 'join' => 'miter', 'dash' => '', 'phase' => 10, 'color' => array(255, 0, 0));
     $pdf->Image($img_path, 10, 20, 31, 20, 'PNG', '', '', false, 300, '', false, false, 0, false, false, false);
     $pdf->SetX(100);
     $pdf->SetY(25);
     $pdf->SetFont('arial', 'B', 13);
     $pdf->Cell(180, 0, 'Quotation', 2, 2, 'C');
     $pdf->Line(90, 27, 110, 27, $linestyle);
     $pdf->SetX(100);
     $pdf->SetY(25);
     $pdf->SetFont('arial', 'B', 11);
     $pdf->Cell(0, 0, $split_store_address[0], 0, 0, 'R');
     $pdf->SetFont('arial', '', 9);
     $pdf->Cell(0, 10, $split_store_address[1] . ',' . $split_store_address[2] . ',' . $split_store_address[3], 0, 0, 'R');
     $pdf->Cell(0, 20, $split_store_address[4] . ',' . $split_store_address[5], 0, 0, 'R');
     $pdf->Cell(0, 30, $split_store_address[6], 0, 0, 'R');
     $pdf->Line(10, 49, 200, 49, $linestyle);
     $pdf->SetX(20);
     $pdf->SetY(38);
     $pdf->SetFont('arial', 'B', 9);
     $pdf->Cell(0, 30, 'VAT/TIN :  ', 0, 0, 'L');
     $pdf->SetX(25);
     $pdf->SetFont('arial', '', 9);
     $pdf->Cell(0, 30, ' 29471119182', 0, 0, 'L');
     $pdf->SetX(85);
     $pdf->SetFont('arial', 'B', 9);
     $pdf->Cell(0, 30, 'CST No:  ', 0, 0, 'L');
     $pdf->SetX(98);
     $pdf->SetFont('arial', '', 9);
     $pdf->Cell(0, 30, ' 29471119182', 0, 0, 'L');
     $pdf->SetX(150);
     $pdf->SetFont('arial', 'B', 9);
     $pdf->Cell(0, 30, 'PAN No :  ', 0, 0, 'L');
     $pdf->SetX(164);
     $pdf->SetFont('arial', '', 9);
     $pdf->Cell(0, 30, ' AALCA1282E', 0, 0, 'L');
     $pdf->Line(10, 57, 200, 57, $linestyle);
     $pdf->Line(10, 72, 200, 72, $linestyle);
     $pdf->SetFont('arial', '', 9);
     $pdf->SetX(20);
     $pdf->SetY(45);
     $pdf->Cell(0, 35, 'QUOTATION DATE : ', 0, 0, 'L');
     $pdf->SetX(125);
     $pdf->Cell(0, 35, 'FOR ANY QUERIES : ', 0, 0, 'L');
     $pdf->SetFont('arial', 'B', 9);
     $pdf->SetX(20);
     $pdf->SetY(50);
     $pdf->Cell(0, 35, $todate . ', ' . $time, 0, 0, 'L');
     $pdf->SetX(127);
     $pdf->Image($telephone, 125, 66, 3, 3, 'PNG', '', '', false, 300, '', false, false, 0, false, false, false);
     $pdf->Cell(0, 35, '+91-' . $storePhone, 0, 0, 'L');
     $pdf->Image($mail, 155, 66, 3, 3, 'PNG', '', '', false, 300, '', false, false, 0, false, false, false);
     $pdf->SetX(157);
     $pdf->Cell(0, 35, ' : ' . $store_email, 0, 0, 'L');
     $pdf->SetX(21);
     $pdf->SetY(60);
     $pdf->SetFont('arial', '', 9);
     if (Mage::getSingleton('customer/session')->isLoggedIn()) {
         $customer = Mage::getSingleton('customer/session')->getCustomer();
         $firstname = $customer->getFirstname();
     } else {
         $firstname = 'Customer';
     }
     $pdf->SetFont('arial', '', 9);
     $pdf->Cell(0, 30, 'Dear ' . $firstname . ',', 0, 0, 'L');
     //$pdf->SetX(20);
     $pdf->SetY(80);
     $pdf->Cell(0, 1, 'Thank you for your interest in buying from us. Please find the below details of your selected products', 0, 0, 'L');
     $pdf->SetFont('arial', 'B', 8);
     //$pdf->SetX(10);
     $pdf->SetY(90);
     //$pdf->SetX(10);
     $pdf->Cell(7, 10, 'S.No', 1, 0, 'C');
     $pdf->Cell(100, 10, 'Products', 1, 0, 'L');
     $pdf->Cell(20, 10, 'SKU', 1, 0, 'C');
     $pdf->Cell(20, 10, 'Price', 1, 0, 'C');
     $pdf->Image($indianrupee, 152, 94, 3, 2, 'PNG', '', '', false, 300, '', false, false, 0, false, false, false);
     $pdf->Image($indianrupee, 197, 94, 3, 2, 'PNG', '', '', false, 300, '', false, false, 0, false, false, false);
     $pdf->Cell(10, 10, 'Qty', 1, 0, 'C');
     $pdf->Cell(15, 10, 'Tax (%)', 1, 0, 'C');
     $pdf->Cell(20, 10, 'Sub Total', 1, 1, 'L');
     $j = 1;
     foreach ($session as $item) {
         if (!$item->getParentItem()) {
             $i = 10;
             $pdf->SetFont('arial', '', 9);
             $product_name = wordwrap($item->getName(), 15, TRUE);
             $font_size = 14;
             $decrement_step = 0.1;
             $line_width = 100;
             while ($pdf->GetStringWidth($item->getName()) > 98) {
                 $pdf->SetFontSize($font_size -= $decrement_step);
             }
             $product = Mage::getModel('catalog/product')->loadByAttribute('sku', $item->getSku());
             $item_total = ceil($item->getPriceInclTax()) * $item->getQty();
             $product_total = ceil($product->getPrice()) * $item->getQty();
             $pdf->SetX(10);
             $pdf->Cell(7, $i, $j, 1, 0, 'C');
             $pdf->Cell($line_width, 10, $item->getName(), 1, 0, 'L');
             //$pdf->Cell(50,$i,$product_name, 1,0,'C');
             $pdf->Cell(20, $i, $item->getSku(), 1, 0, 'C');
             $pdf->Cell(20, $i, number_format($item->getPriceInclTax(), 2), 1, 0, 'C');
             $pdf->Cell(10, $i, $item->getQty(), 1, 0, 'C');
             if ($product->getTypeId() == 'bundle') {
                 $pdf->Cell(15, $i, '-', 1, 0, 'C');
             } else {
                 $pdf->Cell(15, $i, number_format($item['tax_percent'], 1), 1, 0, 'C');
             }
             $pdf->Cell(20, $i, number_format($item->getPriceInclTax() * $item->getQty(), 2), 1, 1, 'C');
             $total = $total + $item->getPriceInclTax() * $item->getQty();
             $saving = $saving + $product_total;
             $j++;
         }
     }
     $totals1 = Mage::getSingleton('checkout/session')->getQuote()->getTotals();
     $subtotal = $totals1["subtotal"]->getValue();
     $grandtotal = $totals1["grand_total"]->getValue();
     if (isset($totals1['discount']) && $totals1['discount']->getValue()) {
         $discount = number_format($totals1['discount']->getValue(), 2);
         //Discount value if applied
     }
     // exit;
     if ($total > $freeSubTotal) {
         $shipping_rate = '0.00';
     } else {
         if ($total < $freeSubTotal) {
             $shipping_rate = Mage::getStoreConfig('carriers/flatrate/price');
             $shipping_rate = number_format($shipping_rate, 2);
             $totals = $grandtotal + $shipping_rate;
         }
     }
     $pdf->SetFont('arial', '', 10);
     $saving_amount = '  ' . $saving - $total;
     $customer_care = Mage::getStoreConfig('general/store_information/phone');
     $pdf->Cell(192, 10, $pdf->Image($sub_total, 150, $pdf->GetY() + 4, 27, 3, 'PNG', '', '', false, 300, '', false, false, 0, false, false, false) . '   ' . number_format($total, 2), 1, 2, 'R');
     //$pdf->Cell(192,10,'Sub Total:'.number_format($total,2), 1,2,'R');
     $pdf->Cell(192, 10, $pdf->Image($shipping, 142, $pdf->GetY() + 4, 27, 3, 'PNG', '', '', false, 300, '', false, false, 0, false, false, false) . '   ' . $shipping_rate, 1, 2, 'R');
     //$pdf->Cell(192,10,'Shipping & Handling:	'.$shipping_rate, 1,2,'R');
     if ($discount != NULL) {
         $pdf->Cell(192, 10, $pdf->Image($discount_image, 142, $pdf->GetY() + 4, 26, 2.5, 'PNG', '', '', false, 300, '', false, false, 0, false, false, false) . '   ' . $discount, 1, 2, 'R');
         //$pdf->Cell(192,10,'Discount Amount:	'.$discount, 1,2,'R');
     }
     $pdf->SetFont('arial', 'B', 12);
     $pdf->Cell(96, 10, $pdf->Image($indian_rupee, 20, $pdf->GetY() + 3, 27, 4, 'PNG', '', '', false, 300, '', false, false, 0, false, false, false) . '   ' . number_format($saving_amount, 2), 1, 0, 'C');
     if ($totals != NULL) {
         $pdf->Cell(96, 10, $pdf->Image($indian_rupee_symbol, 115, $pdf->GetY() + 3, 27, 4, 'PNG', '', '', false, 300, '', false, false, 0, false, false, false) . '  ' . number_format($totals, 2), 1, 0, 'C');
     } else {
         $pdf->Cell(96, 10, $pdf->Image($indian_rupee_symbol, 115, $pdf->GetY() + 3, 27, 4, 'PNG', '', '', false, 300, '', false, false, 0, false, false, false) . '  ' . number_format($grandtotal, 2), 1, 0, 'C');
     }
     $pdf->SetX(5);
     $statement1 = 'We would be happy to fulfill your order at the earliest.';
     $statement1_1 = ' Zoffio helps you save upto 60% on all your office needs and guarantees ';
     $statement1_2 = 'you the best quality original products';
     $statement2 = 'Complete your order today so as not to lose out of the savings!';
     $statement3 = 'You can also contact our customer care support team for more information.';
     $pdf->SetFont('arial', '', 9);
     $pdf->Cell(0, 45, $statement1, 0, 0, 'L');
     $pdf->SetFont('arial', '', 9);
     $pdf->SetX(80);
     $pdf->Cell(0, 45, $statement1_1, 0, 0, 'L');
     $pdf->SetFont('arial', '', 9);
     $pdf->SetX(5);
     $pdf->Cell(0, 55, $statement1_2, 0, 0, 'L');
     $pdf->SetFont('arial', '', 9);
     $pdf->SetX(5);
     $pdf->Cell(0, 70, $statement2, 0, 0, 'L');
     $pdf->SetX(5);
     $pdf->Cell(0, 80, $statement3 . '- +91- ' . $customer_care, 0, 0, 'L');
     $pdf->SetX(5);
     $pdf->Cell(0, 95, 'Best Wishes', 0, 0, 'L');
     $pdf->SetX(5);
     $pdf->Cell(0, 105, 'Zoffio Team', 0, 0, 'L');
     $pdf->SetTextColor(0, 8, 8);
     $pdf->SetFont('arial', '', 7);
     $pdf->SetY(-15);
     $pdf->Cell(0, -10, '(This quotation is generated from the website Zoffio.com in real time. As prices are dynamic, so please recheck the price before confirmation)', 0, 0, 'C');
     $pdf->Output('Zoffio-quotation.pdf', 'D');
 }
示例#23
0
    function Footer()
    {
        $this->SetY(-15);
        // Arial italic 8
        $this->SetFont('Arial', 'I', 8);
        // Page number
        $this->Cell(0, 10, 'Page ' . $this->PageNo() . '/{nb}', 0, 0, 'C');
    }
}
$pdf = new FPDF('L', 'cm', 'A4');
$pdf->AddPage();
$pdf->SetMargins(1.5, 3, 1.75);
$pdf->SetFont('times', '', 14);
$pdf->Cell('', 0.6, 'Kartu Berobat', 0, 1, 'C');
$pdf->Ln();
$pdf->SetFontSize(10);
$pdf->Cell(3, 0.6, 'Antiran No', 1, 0, 'C');
$pdf->Cell(3, 0.6, 'ID Pasien', 1, 0, 'C');
$pdf->Cell(3, 0.6, 'Nama Pasien', 1, 0, 'C');
$pdf->Cell(4, 0.6, 'Alamat', 1, 0, 'C');
$pdf->Cell(2.5, 0.6, 'Jenis Kelamin', 1, 0, 'C');
$pdf->Cell(3, 0.6, 'Usia', 1, 0, 'C');
$pdf->Cell(3, 0.6, 'Golongan Darah', 1, 0, 'C');
$pdf->Cell(2.5, 0.6, 'No Ponsel', 1, 0, 'C');
$sql = "select * from pasien WHERE pasien_id='{$_GET['id']}' ";
foreach ($dbh->query($sql) as $data) {
    $no++;
    $pdf->Ln();
    $pdf->Cell(3, 0.6, $no, 1, 0, 'C');
    $pdf->Cell(3, 0.6, $data['pasien_id'], 1, 0, 'L');
    $pdf->Cell(3, 0.6, $data['pasien_nama'], 1, 0, 'L');
示例#24
0
  $grr = $renkontigxo->datoj[de];
//FLOOR((TO_DAYS('$renkontigxo->datoj[de]') - TO_DAYS(naskigxdato))/365.25)
  $sql  = "Select personanomo,nomo ";
  $sql .= "from partoprenantoj as pa,partoprenoj as pp ";
  $sql .= "where  pa.id = pp.partoprenantoID and pp.vegetare = 'J' and alvenstato='a'";
  $sql .= "order by personanomo";

  sql_farukajmontru($sql);
*/
//echo "</TD></TR></TABLE>\n";
//la diverskategoria ABC statistiko
//$this->agxkategorio = $this->kalkulu_agx_kategorio($agxo,$renkontigxo);
//$this->landakategorio = eltrovu_landakategorio($partoprenanto->datoj[lando]);
//$row = sql_faru("select count(*) from partoprenantoj as p, partoprenoj as pn where p.ID=pn.partoprenantoID and ago<='20' and (");
// echo "<20: ".$row[0];
$pdf->SetFontSize(12);
$pagantoj = array();
//array(array())
$seksagxo = array();
// $rezulto = sql_faru("select p.ID,pn.ID from partoprenantoj as p, partoprenoj as pn where p.ID=pn.partoprenantoID  and alvenstato='a' and renkontigxoID='".$_SESSION["renkontigxo"]->datoj[ID]."' and partoprentipo='t'");
$rezulto = sql_faru(datumbazdemando(array("p.ID", "pn.ID"), array("partoprenantoj" => "p", "partoprenoj" => "pn"), array("alvenstato = 'a'", "partoprentipo = 't'"), "renkontigxoID"));
while ($row = mysql_fetch_array($rezulto, MYSQL_NUM)) {
    $gesamt += 1;
    $partoprenanto = new Partoprenanto($row[0]);
    $seksagxo[$partoprenanto->datoj[sekso]][$partoprenanto->datoj[agxo]] += 1;
    $partopreno = new Partopreno($row[1]);
    $ko = new Kotizo($partopreno, $partoprenanto, $_SESSION["renkontigxo"]);
    $kotizo += $ko->kotizo;
    $pagantoj[$ko->agxkategorio][$ko->aligxkategorio][$ko->landakategorio][$partopreno->datoj[domotipo]] += 1;
    //echo $ko->agxkategorio." / ".$ko->aligxkategorio." / ".$ko->landakategorio." / ".$partopreno->datoj[domotipo]." <BR>";
    //echo "Ko: ".$ko->kotizo;