\n"); $error_message = getLanguageText('TEXT-INVALID-SCHEDULE-NUMBER'); include "form.messages.php"; return; } $schedule = db_fetch_array($results); $schedule_volunteer_msg = $schedule['schedule_volunteer_message']; // If this is a ScheduleTeam user check if they have permission to access this schedule if (in_array($_SESSION['UserInfo']['type'],array('Schedule Team','Schedule Volunteer'))) { $userNum = intval($_SESSION['UserInfo']['record_num']); $access = db_getVal("SELECT count(*) FROM hotlunch_schedules_people WHERE school_num = $school_num AND schedule_num = $schedule_num AND user_num = $userNum"); if (!$access || $access == 0) { echo("
\n"); $error_message = getLanguageText('TEXT-NO-ACCESS-TO-SCHEDULE'); include "form.messages.php"; return; } } // // Setup the PDF // $document_font = $school_record['document_font']; if (strlen($document_font) == 0) $document_font = "Helvetica"; $document_font_weight = ""; $document_text_color = "#000000"; $document_font_size = 10; $left_col = 15; $middle_col = 100; // Force exact physical page sizes (ignore any invalid values from database) // Letter: 8.5 x 11 inches => 215.9mm x 279.4mm // Legal: 8.5 x 14 inches => 215.9mm x 355.6mm $paperSizeInput = $school_record['paper_order_form_size']; switch ($paperSizeInput) { case 'Letter': $max_rows = 245; $logo_row = $max_rows + 10; $pageFormat = array(215.9, 279.4); // Letter portrait break; case 'Legal': $max_rows = 325; $logo_row = $max_rows + 10; $pageFormat = array(215.9, 355.6); // Legal portrait break; default: // Default to Letter if invalid value $max_rows = 245; $logo_row = $max_rows + 10; $pageFormat = array(215.9, 279.4); // Letter portrait break; } // // Setup PDF document // require("tcpdf/config/lang/eng.php"); require("tcpdf/tcpdf.php"); class PDF extends TCPDF { function Header() { global $curr_row, $start_row, $printNameFields, $document_font, $document_font_size, $title_col, $school_name, $incr, $GlobalText, $page, $school_record, $schedule; $curr_page = $page + 1; $curr_row = $start_row; $this->SetFont($document_font,"B",$document_font_size); $this->SetFillColor(hexdec("bb"),hexdec("bb"),hexdec("bb")); $this->SetXY($title_col,$curr_row); $this->Cell(185,$incr + 1,$school_name,'0',0,'L',true,'',1); if ($page > 0 && $printNameFields == false) { $this->SetXY($title_col + 170,$curr_row); $this->Cell(15,$incr + 1,getLanguageText('TEXT-PAGE').": $curr_page",'0',0,'R',true,'',1); } $curr_row += $incr + 3; $this->SetXY($title_col,$curr_row); if ($printNameFields == false) return; $this->Cell(185,$incr + 1,$schedule['schedule_name'],'0',0,'L',true,'',1); $this->SetXY($title_col + 170,$curr_row); $this->Cell(15,$incr + 1,getLanguageText('TEXT-PAGE').": $curr_page",'0',0,'R',true,'',1); $curr_row += $incr + 3; $this->SetFont($document_font,"B",$document_font_size - 1); $line1 = $title_col + 25; $title2 = $title_col + 105; $line2 = $title_col + 125; $this->SetXY($title_col,$curr_row); $this->Cell(25,$incr + 1,$GlobalText['StudentName'] . ":",'0',0,'L',false,'',1); $this->SetXY($line1,$curr_row); $this->Cell(65,$incr,"",'B',0,'L',false,'',1); $this->SetXY($title2,$curr_row); $this->Cell(20,$incr + 1,getLanguageText('TEXT-HOME-PHONE') . ":",'0',0,'L',false,'',1); $this->SetXY($line2,$curr_row); $this->Cell(60,$incr,"",'B',0,'L',false,'',1); $curr_row += $incr + 2; if ($school_record['orders_for'] == 'Participants') { $this->SetXY($title_col,$curr_row); $this->Cell(25,$incr + 1,getLanguageText('TEXT-PARENT-NAME') . ":",'0',0,'L',false,'',1); $this->SetXY($line1,$curr_row); $this->Cell(65,$incr,"",'B',0,'L',false,'',1); } $this->SetXY($title2,$curr_row); $this->Cell(20,$incr + 1,getLanguageText('TEXT-EMAIL') . ":",'0',0,'L',false,'',1); $this->SetXY($line2,$curr_row); $this->Cell(60,$incr,"",'B',0,'L',false,'',1); if ($school_record['participant_grouping'] != 'None') { $curr_row += $incr + 2; $this->SetXY($title_col,$curr_row); $this->Cell(35,$incr + 1,$GlobalText['Teacher'] . ":",'0',0,'L',false,'',1); $this->SetXY($line1,$curr_row); $this->Cell(65,$incr,"",'B',0,'L',false,'',1); $this->SetXY($title2,$curr_row); $this->Cell(20,$incr + 1,$school_record['division_class_num_text'] . ":",'0',0,'L',false,'',1); $this->SetXY($line2,$curr_row); $this->Cell(35,$incr,"",'B',0,'L',false,'',1); } // Display instructions if there are any if ($page == 0 && strlen(trim($schedule['paper_description'])) > 0) { $curr_row += $incr + 2; $this->SetLineWidth(.2); $this->SetXY($title_col,$curr_row); $this->MultiCell(185,$incr,$schedule['paper_description'],'1','C',false); $curr_row = $this->GetY() - $incr; } $curr_row += $incr; $this->SetXY($title_col,$curr_row); } function Footer() { global $logo_row, $incr, $document_font, $document_font_size, $siteType, $school_record, $school_name; // Add logo to page $this->Image("images/".$school_record['logo_image'],10,$logo_row + 5,50); $this->SetFont($document_font,"",$document_font_size - 1); $this->SetXY(80,$logo_row + 5); $date = dateString('datetime'); $this->Cell(120,$incr - 1,getLanguageText('TEXT-PRINTED') . ": $date",'0',1,'R',false,'',1); $this->SetFont($document_font,"",$document_font_size); $this->SetXY(80,$logo_row + 5 + $incr); $this->Cell(120,$incr - 1,"$school_name",'0',1,'R','',1); if (strlen($school_record['paper_order_form_footer'])) { $this->SetXY(10,$logo_row - 2); $this->SetFont($document_font,"B",$document_font_size - 2); $this->Cell(190,$incr - 1,$school_record['paper_order_form_footer'],'0',1,'C',false,'',1); } } } $pdf= new PDF('P', 'mm', $pageFormat, true, 'UTF-8', false); // set default monospaced font $pdf->SetDefaultMonospacedFont(PDF_FONT_MONOSPACED); //set margins $pdf->SetMargins(PDF_MARGIN_LEFT, PDF_MARGIN_TOP, PDF_MARGIN_RIGHT); //set auto page breaks $pdf->SetAutoPageBreak(TRUE, PDF_MARGIN_BOTTOM); //set image scale factor $pdf->setImageScale(PDF_IMAGE_SCALE_RATIO); $font_red = hexdec("00"); $font_green = hexdec("00"); $font_blue = hexdec("00"); $pdf->SetTextColor($font_red,$font_green,$font_blue); $pdf->SetDrawColor(0,0,0); $school_name = $school_record['school_name']; $title_col = 15; $item_col = 20; $qty_col = 135; $price_col = 140; $extended_col = 160; $multiplier_col = 175; $total_col = 185; $start_row = 8; $incr = 3.2; switch ($school_record['paper_order_form_font_size']) { default: case '10px': $document_font_size = 10; $option_font_size = 7; $incr = 3.2; break; case '11px': $document_font_size = 11; $option_font_size = 7; $incr = 3.4; break; case '12px': $document_font_size = 12; $option_font_size = 7; $incr = 3.6; break; } $option_font_size = 6; $fill = false; $pdf->SetFillColor(hexdec("cc"),hexdec("cc"),hexdec("cc")); $pdf->SetFont($document_font,"B",$document_font_size); // Get menu dates for this schedule $selected_mdate = "and active = 'Y' "; if (isset($selected_menu_num)) $selected_mdate = "and record_num = $selected_menu_num "; $query = "select * from hotlunch_menu_dates " . "where school_num = $school_num " . "and schedule_num = $schedule_num " . "and menu_link not in ('Paper','All') " . $selected_mdate . "order by sequence,menu_date"; $menu_dates = db_query($query); $order_total = 0; $curr_row = $start_row; $srow = $start_row; writeLog("max_rows: $max_rows"); $page = 0; $printNameFields = false; if ($school_record['paper_order_form_name_fields'] == 'First' && $page == 0) $printNameFields = true; if ($school_record['paper_order_form_name_fields'] == 'Alternate' && ($page % 2) == 0) $printNameFields = true; if ($school_record['paper_order_form_name_fields'] == 'All') $printNameFields = true; $pdf->addPage(); $printMenuHeader = true; $page++; $pdf->SetXY(10,$curr_row); while ($menu_date = db_fetch_array($menu_dates)) { $menu_num = $menu_date['record_num']; $menu_title = $menu_date['menu_title']; $menu_instructions = $menu_date['menu_instructions']; $volunteer_msg = trim($menu_date['volunteer_msg']); if (strlen($volunteer_msg) == 0 && strlen($schedule_volunteer_msg) > 0) $volunteer_msg = $schedule_volunteer_msg; if ($schedule['display_menu_date'] == 'Y' && $menu_date['menu_type'] == 'Regular') $menu_title .= " - " . date("D M jS, Y",strtotime($menu_date['menu_date'])); $printMenuHeader = true; // Get dates for linked menus $query = "select * from hotlunch_menu_dates " . "where school_num = $school_num " . "and schedule_num = $schedule_num " . "and source_menu = $menu_num " . "and menu_link in ('Paper','All') " . "order by sequence,menu_date"; $linked_dates = db_query($query); $multiplier = "= "; $linkedDates = ""; $numLinked = db_num_rows($linked_dates); if ($numLinked > 0) { $multiplier = db_num_rows($linked_dates) + 1; $multiplier = "x $multiplier = "; if ($schedule['display_menu_date'] == 'Y') { $nlines = 1; while ($row = db_fetch_array($linked_dates)) { if (strlen($linkedDates) > $nlines * 120) { $linkedDates .= "\n"; $nlines++; } $ldate = date("D M jS, Y",strtotime($row['menu_date'])); $linkedDates .= "+ $ldate "; } } } // Get menu items for this menu date $query = "select * from hotlunch_menu_items " . "where school_num = $school_num " . "and menu_num = $menu_num " . "order by sequence"; $menu_items = db_query($query); $num_items = db_num_rows($menu_items); if ($num_items == 0) { if ($curr_row > $max_rows - 5) { $printNameFields = false; if ($school_record['paper_order_form_name_fields'] == 'First' && $page == 0) $printNameFields = true; if ($school_record['paper_order_form_name_fields'] == 'Alternate' && ($page % 2) == 0) $printNameFields = true; if ($school_record['paper_order_form_name_fields'] == 'All') $printNameFields = true; $curr_row = $start_row; $pdf->addPage(); if (!$printMenuHeader) $continued = ' (' . getLanguageText('TEXT-CONTINUED') . ')'; $printMenuHeader = true; $page++; $pdf->SetXY($title_col,$curr_row); } $pdf->SetFont($document_font,"B",$document_font_size - 1); $pdf->SetFillColor(hexdec("bb"),hexdec("bb"),hexdec("bb")); $curr_row += 1; $pdf->SetXY($title_col,$curr_row); $pdf->MultiCell(185,$incr,$menu_title,'0','L',true); if (strlen($menu_instructions) > 0) { $pdf->SetFont($document_font,"",$document_font_size - 2); $pdf->SetFillColor(hexdec("d8"),hexdec("d8"),hexdec("d8")); $curr_row = $pdf->GetY() + 2; $pdf->SetXY($title_col,$curr_row); $pdf->MultiCell(185,$incr,$menu_instructions,'0','L',true); } $pdf->SetFont($document_font,"",$document_font_size - 1); $pdf->SetFillColor(hexdec("cc"),hexdec("cc"),hexdec("cc")); $curr_row = $pdf->GetY() + 2; continue; } // Get number of items with descriptions $query = "select count(*) from hotlunch_menu_items " . "where school_num = $school_num " . "and menu_num = $menu_num " . "and length(item_description) > 0"; $num_descriptions = db_getVal($query); // Get number of items with options $query = "select count(*) from hotlunch_menu_items " . "where school_num = $school_num " . "and menu_num = $menu_num " . "and length(options) > 0"; $num_options = db_getVal($query); // Get number of items with options2 $query = "select count(*) from hotlunch_menu_items " . "where school_num = $school_num " . "and menu_num = $menu_num " . "and length(options2) > 0"; $num_options += db_getVal($query); // Get number of items with options3 $query = "select count(*) from hotlunch_menu_items " . "where school_num = $school_num " . "and menu_num = $menu_num " . "and length(options3) > 0"; $num_options += db_getVal($query); writeLog("num_items: $num_items"); writeLog("num_descriptions: $num_descriptions"); writeLog("num_options: $num_options"); $menu_length = 10 + intval($incr * 4 + $num_items * $incr + $num_descriptions * $incr + $num_options * $incr * 2.5); if ($school_record['enable_volunteer_signup'] == 'Y' && $schedule['volunteer_signup'] == 'D' || $schedule['volunteer_signup'] == 'Y') $menu_length += $incr * 3; $menu_length1 = $menu_length; $menu_total = 0; $menu_count = 0; $item_count = 0; $item_prices = 0; while ($menu_item = db_fetch_array($menu_items)) { extract($menu_item); if ($menu_length > 0) { writeLog("menu_title: $menu_title"); writeLog("curr_row: $curr_row"); writeLog("menu_length: $menu_length"); writeLog(""); } // Add page if required $addPage = false; if (($curr_row > ($max_rows / 2)) && (($curr_row + $menu_length) >= ($max_rows - 3) && ($start_row + $menu_length) < $max_rows || $heading_page_break == 'Y')) { $addPage = true; } if (($curr_row > ($max_rows / 2)) && (($curr_row + $menu_length) >= ($max_rows - 10) && ($start_row + $menu_length) < $max_rows && ($num_options > 5))) { $addPage = true; } if ($menu_length > $max_rows && $curr_row < (2 * $max_rows / 3)) { $addPage = false; } $continued = ""; if ($addPage) { $printNameFields = false; if ($school_record['paper_order_form_name_fields'] == 'First' && $page == 0) $printNameFields = true; if ($school_record['paper_order_form_name_fields'] == 'Alternate' && ($page % 2) == 0) $printNameFields = true; if ($school_record['paper_order_form_name_fields'] == 'All') $printNameFields = true; $curr_row = $start_row; $pdf->addPage(); if (!$printMenuHeader) $continued = ' (' . getLanguageText('TEXT-CONTINUED') . ')'; $printMenuHeader = true; $page++; $pdf->SetXY($title_col,$curr_row); } if ($printMenuHeader) { $pdf->SetFont($document_font,"B",$document_font_size - 1); $pdf->SetFillColor(hexdec("bb"),hexdec("bb"),hexdec("bb")); $curr_row = $pdf->GetY() + $incr; $pdf->SetXY($title_col,$curr_row); $pdf->MultiCell(185,$incr,$menu_title.$continued,'0','L',true); if (strlen($linkedDates) > 0) { $pdf->SetFont($document_font,"",$document_font_size - 2); $pdf->SetFillColor(hexdec("dd"),hexdec("dd"),hexdec("dd")); $curr_row = $pdf->GetY(); $pdf->SetXY($title_col,$curr_row); $pdf->MultiCell(185,$incr,$linkedDates,'0','L',true); } if (strlen($menu_instructions) > 0) { $pdf->SetFont($document_font,"",$document_font_size - 2); $pdf->SetFillColor(hexdec("ee"),hexdec("ee"),hexdec("ee")); $curr_row = $pdf->GetY() + $incr; $pdf->SetXY($title_col,$curr_row); $pdf->MultiCell(185,$incr,$menu_instructions,'0','L',true); $curr_row = $pdf->GetY() + $incr; } $pdf->SetFont($document_font,"",$document_font_size - 1); $pdf->SetFillColor(hexdec("cc"),hexdec("cc"),hexdec("cc")); $printMenuHeader = false; $curr_row = $pdf->GetY() + 1; } $menu_length = 0; $menu_count++; $fill = false; $border = '0'; $title_width = 110; $pdf->SetFont($document_font,"",$document_font_size - 1); if ($item_type == 'Heading') { $pdf->SetFont($document_font,"B",$document_font_size - 1); $pdf->SetFillColor(hexdec("d8"),hexdec("d8"),hexdec("d8")); $fill = true; $border = '1'; $title_width = 180; $curr_row += 2; } $qfield = 1; $pdf->SetXY($item_col,$curr_row); $pdf->MultiCell($title_width,$incr,$item_title,$border,'L',$fill); $pdf->SetFont($document_font,"",$document_font_size - 1); $new_row = $pdf->GetY(); if ($item_type == 'Heading') { if (strlen(trim($item_description))) { $curr_row = $pdf->GetY(); $pdf->SetFont($document_font,"",$document_font_size - 2); $pdf->SetFillColor(hexdec("ee"),hexdec("ee"),hexdec("ee")); $pdf->SetXY($item_col,$curr_row); $pdf->MultiCell($title_width,$incr - 1,$item_description.' ++','1','L',true); $pdf->SetFont($document_font,"",$document_font_size - 1); $curr_row = $pdf->GetY() - $incr + 1; $pdf->SetXY($item_col,$curr_row); } else { $curr_row += 1; } } if ($item_type != 'Heading') { $curr_row += 1; if ($display_price == 'N') { $pdf->SetXY($extended_col + 5,$curr_row + 1); $pdf->SetFont($document_font,"",$document_font_size - 2); $pdf->Cell(3,$incr - 2,"",'1',0,'L',false,'',1); $pdf->SetFont($document_font,"",$document_font_size - 1); } else { $pdf->SetXY($qty_col,$curr_row); $pdf->SetDrawColor(hexdec("88"),hexdec("88"),hexdec("88")); $pdf->Cell(5,$incr,"",'1',0,'L',false,'',1); $pdf->SetDrawColor(0,0,0); $pdf->SetXY($price_col,$curr_row); $pdf->Cell(20,$incr,"x $currencySymbol" . number_format($offline_price,2) . " =",'0',0,'R',false,'',1); $pdf->SetXY($extended_col,$curr_row); $pdf->Cell(2,$incr,$school_record['currency_symbol'],'0',0,'R',false,'',1); $pdf->SetXY($extended_col + 2,$curr_row); $pdf->Cell(12,$incr,"",'B',0,'R',false,'',1); $item_prices++; } } if ($item_type != 'Heading' && strlen($item_description) > 0) { $curr_row += $incr; if ($new_row > $curr_row) $curr_row = $new_row; // $curr_row = $new_row; $pdf->SetFont($document_font,"I",$document_font_size - 2); $pdf->SetXY($item_col + 5,$curr_row); $pdf->MultiCell(105,$incr - 1,"$item_description",'0','L',false); $pdf->SetFont($document_font,"",$document_font_size - 1); $curr_row = $pdf->GetY() - $incr + .5; } $olength = 105; $owidth = 20; // Print the item options if (strlen(trim($options)) > 0) { $text = "| "; $item_options = explode("\n",trim($options)); $line = 1; for ($i = 0; $i < count($item_options); $i++) { // if ((strlen(trim($text)) + strlen($item_options[$i]) + $owidth) > ($line * $olength)) { // $text = trim($text) . "\n"; // if (strlen($options_title)) $text .= " "; // $line++; // } $text .= $item_options[$i] . " | "; } $text = trim($text); if (strlen($text) && strlen($options_title)) $text = "$options_title: $text"; if (strlen($text)) { $curr_row += $incr + 1; if ($new_row > $curr_row) $curr_row = $new_row + 1; $pdf->SetFont($document_font,"",$option_font_size); $pdf->SetFillColor(hexdec("ee"),hexdec("ee"),hexdec("ee")); $pdf->SetDrawColor(hexdec("88"),hexdec("88"),hexdec("88")); $pdf->SetXY($item_col + 10,$curr_row); $pdf->MultiCell($olength,$incr - 0.5,$text,'1','L',true); $pdf->SetFont($document_font,"",$document_font_size - 1); $pdf->SetFillColor(hexdec("cc"),hexdec("cc"),hexdec("cc")); $pdf->SetDrawColor(0,0,0); $curr_row = $pdf->GetY() - $incr + .5; } } // Print the second item options if (strlen(trim($options2)) > 0) { $text = "| "; $item_options = explode("\n",trim($options2)); $line = 1; for ($i = 0; $i < count($item_options); $i++) { // if ((strlen(trim($text)) + strlen($item_options[$i]) + $owidth) > ($line * $olength)) { // $text = trim($text) . "\n"; // if (strlen($options_title)) $text .= " "; // $line++; // } $text .= $item_options[$i] . " | "; } $text = trim($text); if (strlen($text) && strlen($options2_title)) $text = "$options2_title: $text"; if (strlen($text)) { $curr_row += $incr + .5; $pdf->SetFont($document_font,"",$option_font_size); $pdf->SetFillColor(hexdec("ee"),hexdec("ee"),hexdec("ee")); $pdf->SetDrawColor(hexdec("88"),hexdec("88"),hexdec("88")); $pdf->SetXY($item_col + 10,$curr_row); $pdf->MultiCell($olength,$incr - 0.5,$text,'1','L',true); $pdf->SetFont($document_font,"",$document_font_size - 1); $pdf->SetFillColor(hexdec("cc"),hexdec("cc"),hexdec("cc")); $pdf->SetDrawColor(0,0,0); $curr_row = $pdf->GetY() - $incr + .5; } } // Print the third item options if (strlen(trim($options3)) > 0) { $text = "| "; $item_options = explode("\n",trim($options3)); $line = 1; for ($i = 0; $i < count($item_options); $i++) { // if ((strlen(trim($text)) + strlen($item_options[$i]) + $owidth) > ($line * $olength)) { // $text = trim($text) . "\n"; // if (strlen($options_title)) $text .= " "; // $line++; // } $text .= $item_options[$i] . " | "; } $text = trim($text); if (strlen($text) && strlen($options3_title)) $text = "$options3_title: $text"; if (strlen($text)) { $curr_row += $incr + .5; $pdf->SetFont($document_font,"",$option_font_size); $pdf->SetFillColor(hexdec("ee"),hexdec("ee"),hexdec("ee")); $pdf->SetDrawColor(hexdec("88"),hexdec("88"),hexdec("88")); $pdf->SetXY($item_col + 10,$curr_row); $pdf->MultiCell($olength,$incr - 0.5,$text,'1','L',true); $pdf->SetFont($document_font,"",$document_font_size - 1); $pdf->SetFillColor(hexdec("cc"),hexdec("cc"),hexdec("cc")); $pdf->SetDrawColor(0,0,0); $curr_row = $pdf->GetY() - $incr + .5; } } $curr_row += $incr; if ($new_row > $curr_row) $curr_row = $new_row; $item_count++; } if ($item_count > 0) { // Print Volunteer text if ($school_record['enable_volunteer_signup'] == 'Y' && $schedule['volunteer_signup'] == 'D' || $schedule['volunteer_signup'] == 'Y' || $menu_date['num_volunteer_override'] == 'Y') { if ($menu_date['num_volunteer_override'] != 'N') { $pdf->SetFont($document_font,"B",$document_font_size - 1); $pdf->SetXY($item_col,$curr_row); $pdf->Cell(45,$incr," ==> " . getLanguageText('TEXT-VOLUNTEER-SIGNUP-TITLE') . ": ",'0',0,'R',false,'',1); $pdf->Cell(10,$incr," ",'B',0,'L',false,'',1); $pdf->SetFont($document_font,"",$option_font_size); if (strlen($volunteer_msg) > 0) { $curr_row += $incr + 1; $pdf->SetXY($item_col + 5,$curr_row); $pdf->Cell(115,$incr,"$volunteer_msg",'0',0,'L',false,'',1); $curr_row += 1; } $pdf->SetFont($document_font,"",$document_font_size); } } // Print Subtotal line if ($item_prices > 0) { $curr_row += 1; $pdf->SetXY($price_col - 10,$curr_row); $pdf->Cell(23,$incr,getLanguageText('TEXT-SUBTOTAL') . " :",'0',0,'R',false,'',1); $pdf->SetXY($extended_col,$curr_row); $pdf->Cell(2,$incr,$school_record['currency_symbol'],'0',0,'R',false,'',1); $pdf->SetXY($extended_col + 2,$curr_row); $pdf->Cell(12,$incr,"",'B',0,'R',false,'',1); // Print multiplier and total line $pdf->SetFont($document_font,"B",$document_font_size - 1); $pdf->SetXY($multiplier_col,$curr_row); $pdf->Cell(10,$incr,"$multiplier $currencySymbol",'0',0,'R',false,'',1); $pdf->SetXY($total_col,$curr_row); $pdf->Cell(12,$incr,"",'B',0,'R',false,'',1); $pdf->SetFont($document_font,"",$document_font_size - 1); $curr_row += $incr; $pdf->SetXY($item_col,$curr_row); } } if ($menu_count > 0) $curr_row += 1; } $curr_row += 1; if (($curr_row + $incr * 2) > $max_rows) { $pdf->addPage(); $page++; $curr_row = $start_row; $pdf->SetFont($document_font,"B",$document_font_size); if (isset($name)) { $pdf->SetXY($title_col,$curr_row); $pdf->Cell(80,$incr + 1,$name,'0',0,'L',false,'',1); } if (isset($teacher_info)) { $pdf->SetXY($qty_col,$curr_row); $pdf->Cell(64,$incr + 1,"Page :: $page",'0',0,'R',false,'',1); } $curr_row += $incr; $pdf->SetXY($title_col,$curr_row); $pdf->Cell(80,$incr + 1,$schedule['schedule_name'],'0',0,'L',false,'',1); $curr_row += $incr + 2; } if (($curr_row + $incr * 2) > $max_rows) { $pdf->addPage(); $page++; } $curr_row += 3; // Paper charge if required if ($schedule['paper_order_charge'] > 0) { $pdf->SetFillColor(hexdec("ee"),hexdec("ee"),hexdec("ee")); $pdf->SetFont($document_font,"B",$document_font_size + 1); $pdf->SetXY($left_col,$curr_row); $pdf->Cell(180,$incr + 1,$schedule['paper_order_message'] . " :: ",'0',0,'R',true,'',1); $pdf->SetXY($total_col,$curr_row); $pdf->Cell(20,$incr + 1,'$' . number_format($schedule['paper_order_charge'],2),'1',0,'R',true,'',1); $curr_row += 5; } // Taxable orders if ($schedule['tax_rate'] > 0.00) { $pdf->SetFillColor(hexdec("ee"),hexdec("ee"),hexdec("ee")); $pdf->SetFont($document_font,"B",$document_font_size + 1); $pdf->SetXY($left_col,$curr_row); $pdf->Cell(180,$incr + 1,getLanguageText('TEXT-SUBTOTAL') . " :: ",'0',0,'R',true,'',1); $pdf->SetXY($total_col,$curr_row); $pdf->Cell(20,$incr + 1,' ','1',0,'R',true,'',1); $curr_row += 6; $pdf->SetXY($left_col,$curr_row); $pdf->Cell(180,$incr + 1,$schedule['tax_description'] . ' @ ' . $schedule['tax_rate'] . "% :: ",'0',0,'R',true,'',1); $pdf->SetXY($total_col,$curr_row); $pdf->Cell(20,$incr + 1,' ','1',0,'R',true,'',1); $curr_row += 6; } // Order total line $pdf->SetFillColor(hexdec("ee"),hexdec("ee"),hexdec("ee")); $pdf->SetFont($document_font,"B",$document_font_size + 1); $pdf->SetXY($left_col,$curr_row); $pdf->Cell(180,$incr + 1,getLanguageText('TEXT-ORDER-TOTAL') . " :: ",'0',0,'R',true,'',1); $pdf->SetXY($total_col,$curr_row); $pdf->Cell(20,$incr + 1,"",'1',0,'R',true,'',1); if (($curr_row + 8 + $incr * 2) > $max_rows) { $pdf->addPage(); $page++; } // Display instructions if there are any if (strlen($schedule['paper_footer']) > 0) { if (($curr_row + 5 + $incr * 2) > $max_rows) { $pdf->addPage(); $page++; } $curr_row += $incr + 5; $pdf->SetFont($document_font,"B",$document_font_size - 2); $pdf->SetLineWidth(.2); $pdf->SetXY($title_col,$curr_row); $pdf->MultiCell(190,$incr,$schedule['paper_footer'],'1','C',false); $curr_row = $pdf->GetY(); } $pdf->SetFont($document_font,"",$document_font_size - 1); // Display exclude contact info option if the school displays class lists if ($school_record['display_class_lists'] == 'Y' || $school_record['display_class_lists'] == 'A') { // Exclude from contact list line $curr_row += $incr + 3; $pdf->SetXY($left_col,$curr_row); $pdf->Cell(3,$incr,"",'1',0,'L',false,'',1); $pdf->SetXY($left_col + 4,$curr_row); $url = $school_record['url']; $pdf->Cell(150,$incr,getLanguageText('TEXT-NO-CONTACT-LIST') . " (" . getLanguageText('TEXT-CONTACT-INFO') . ")",'0',0,'L',false,'',1); } // Output the completed PDF $filename = "order-form.pdf"; header('Pragma: public'); header('Expires: 0'); header('Cache-Control: must-revalidate, post-check=0, pre-check=0'); header('Cache-Control: private',false); header('Content-type: application/pdf'); header("Content-Disposition: attachment; filename=$filename"); header('Content-Transfer-Encoding: binary'); $pdf->Output($filename,"D"); ?>