function disp_dpt($reg, $a, $total, $dept) { //this is the function which places the comma, hyphen and period where-ever necessary global $print_hal, $curhal, $pdf, $width, $height, $curdpt, $curtotal, $curdpt_no, $hall_no, $hallwise, $dptinc_glbl; //global $w, $strmax, $tempreg, $printd_no, $firstloop, $symbol, $hyprint; //$in, $n, $temp104; $curdpt = dpt($dept); //$dptinc_glbl;//1 represents new dept for hallwiser $print_dpt = 1; $tempreg; $print = 0; $islast = 0; $first_line = 1; $curtotal = $total - $a; //echo 'total = '.$total.' a = '.$a.' & real total = <b>'.($total - $a).'</b><br>';//for check!!!! $tmpcounter = 0; //if this reaches 3 then the 3 reg nos are printed $eq_b4 = -1; //if -1 remains then only one number is being printed //UPDATE 2014.06.24// //UPDATE 2014.07.19// $tmpcounter = 0; $equal = 0; $incr = 0; //$position = 'first'; $tempreg = ''; $skipp = 'off'; for ($i = $a; $i < $total; $i++) { if (isset($reg[$i])) { //this block stores the register numbers in an array hallwise hallwiser($reg[$i], $dept); //$dp/tinc_glbl = 0; intval($reg[$i]); $p = $reg[$i]; //present (current) used reg no. $in = $reg[$i] + 1; //imaginary next reg no. adds one to $p $inn = $reg[$i] + 2; /*/$wait = 1000; //echo 'entering at i='.$i.' '.$p.'<br>';// for check!!!! //$printed = 'no'; /if($tmpcounter == 0) { $tempreg = ''.$p; $tmpcounter += 1; $printed = 'yes';/* if($i != $a) $center = 'center'; } elseif ($center == 'center') { $tempreg = ', '.$p; $center != 'not';/ $somemore = 'notanymore'; } elseif ( ($i + 1) == $total ) { goto notequallabel; } if($somemore == 'work'){ $tempreg .= ', '.$p;//.'c='.($tmpcounter+1); $tmpcounter += 1; $somemore = 'notanymore'; }elseif( isset($reg[$i+1]) ){ $rn = $reg[$i+1]; $equal = nxtchk($rn, $in); if($equal == 1){ $incr += 1; } elseif($equal == 0 && $tmpcounter != 0) { notequallabel: if($printed != 'yes' && $tmpcounter == 1 && $incr == 0) { $tempreg .= ', '.$p; } elseif($printed != 'yes' && $tmpcounter == 1 && $incr == 1) { $tempreg .= ', '.$p; } elseif($printed != 'yes' && $incr == 0) { $tempreg .= ', '.$p; } elseif($printed != 'yes' && $incr == 1) { $tempreg .= ' - '.$p; } elseif($incr > 1) { $tempreg .= ' - '.$p; } $tmpcounter += 1; if($tmpcounter == 2){ $somemore = 'work'; if($printed == 'yes') $tmpcounter = 1; } $incr = 0; } if($printed != 'yes'){ $printed = 'yes'; } }*/ if ($i + 1 == $total) { $tempreg .= $p . '.'; goto printlabel; } elseif ($skipp != 'on') { if ($equal == 0) { $tempreg .= $p; $tmpcounter = $tmpcounter + 1; $skipp = 'off'; if ($tmpcounter == 3) { goto printlabel; } } if (isset($reg[$i + 1]) && $reg[$i + 1] == $in) { $equal = $equal + 1; if (isset($reg[$i + 2]) && $reg[$i + 2] == $inn) { $equal = $equal + 1; if ($equal == 2) { $tempreg .= ' - '; $skipp = 'on'; } } else { if ($equal == 1) { $tempreg .= ', '; } $equal = 0; } } elseif ($skipp == 'oner') { $equal = 0; $skipp = 'off'; $tempreg .= $p; $tmpcounter = $tmpcounter + 1; if ($tmpcounter == 2) { $tempreg .= ', '; } } else { $tempreg .= ', '; $equal = 0; $skipp = 'off'; } } elseif ($skipp == 'on') { $skipp = 'oner'; } if ($tmpcounter == 3) { printlabel: if ($i + 1 != $total) { $tempreg .= ','; } $printreg = $tempreg; $tempreg = ''; $tmpcounter = 0; $print = 1; } /* $curhal for current hall $print_hal $printreg for regnos in current line $curdpt for department name $print_dpt $curtotal for total dept wise $print_dpt */ //$prev = $p; NOT USED IN UPDATE 2014.06.24 if ($print == 1) { /*if($print_hal == 1) { echo '<b>'.$curhal.'</b><br>';//for check!!!! $print_hal = 0; } if($first_line == 1) { echo 'Dept: '.dpt($dept).' Total: '.$curtotal.'<br>'; $first_line = 0; } echo ''.$printreg.'<br>'; $print = 0;*/ //for GREAT CHECK! if ($print_hal == 1) { //prints hall name $pdf->SetFont('', 'B'); $pdf->myCell($width[0], $height[1], $curhal, 'TLR'); $pdf->SetFont(''); add('h', 1); $print_hal = 0; } else { //prints blank cell instead of hall name $pdf->myCell($width[0], $height[1], '', 'LR'); } if ($print_dpt == 1) { //prints dept name and total $pdf->myCell($width[1], $height[1], $curdpt, 'TLR'); $pdf->SetFont('Helvetica', '', 7); $pdf->myCell($width[2], $height[1], ' ' . $curtotal, 'TLR'); $pdf->SetFont('Helvetica', '', 14); $print_dpt = 0; /*//department numbering $pdf->Cell($width[2], $height[2], ' ', 'TLR'); $pdf->Ln(); $pdf->SetFont('Helvetica', 'I', 9); $pdf->Cell($width[0], $height[1], '', 'TLR'); $pdf->Cell($width[1], $height[1], "set".$curdpt_no, 'TLR', 0, 'R'); $pdf->Cell($width[1], $height[2], '', 'TLR'); $pdf->Ln(); $pdf->Cell($width[0], $height[1], '', 'TLR'); $pdf->Cell($width[1], $height[1], '', 'TLR'); $pdf->Cell($width[2], $height[1], '', 'TLR'); $pdf->SetFont('Helvetica', '', 14); */ } else { //places blanks for dept name and total $pdf->myCell($width[1], $height[1], '', 'LR'); $pdf->myCell($width[2], $height[1], '', 'LR'); } if ($first_line == 1) { $pdf->myCell($width[3], $height[1], $printreg, 'TLR'); $first_line = 0; } else { $pdf->myCell($width[3], $height[1], $printreg, 'LR'); } $print = 0; $pdf->Ln(); } } } }
//$dptinc_glbl;//1 represents new dept for hallwiser $print_dpt = 1; $tempreg; $print = 0; $islast = 0; $first_line = 1; $curtotal = $total - $a; //echo 'total = '.$total.' a = '.$a.' & real total = <b>'.($total - $a).'</b><br>';//for check!!!! $tmpcounter = 1; //if this reaches 3 then the 3 reg nos are printed $eq_b4 = -1; //if -1 remains then only one number is being printed for ($i = $a; $i < $total; $i++) { if (isset($reg[$i])) { //this block stores the register numbers in an array hallwise hallwiser($reg[$i], $dept); //$dp/tinc_glbl = 0; intval($reg[$i]); $p = $reg[$i]; //present (current) used reg no. $in = $reg[$i] + 1; //imaginary next reg no. adds one to $p $wait = 1000; //echo 'entering at i='.$i.' '.$p.'<br>';// for check!!!! if ($i + 1 != $total && isset($reg[$i + 1])) { intval($reg[$i + 1]); $n = $reg[$i + 1]; if ($i == $a) { $tempreg = $p; $w = 0; $tmpcounter = 1;