\n"; $line = $words[$i]." "; } } $nRows += 2; echo "$line
\n"; return $nRows; } function printHeader($pageNo = 0) { GLOBAL $ident, $job, $clientdat, $tableWidth; echo "\n"; // order information echo " \n"; echo " \n"; echo " \n"; echo " \n"; echo " \n"; echo " \n"; echo " \n"; echo " \n"; echo " \n"; echo " \n"; echo " \n"; echo " \n"; echo " \n"; echo " \n"; echo " \n"; echo " \n"; echo "
"; if ($pageNo) echo "Page ".($pageNo + 1)." - "; echo $job['jobNo']."
Billing InformationSite Information"; echo ""; echo ""; echo "
CID: ".$job['csid'].""; echo $job['status']; echo "
\n"; echo "
".fixName($clientdat['fName'], $clientdat['lName']).""; if (!$ident) echo fixName($job['fName'], $job['lName']); echo ""; if (!empty($job['protectron'])) echo "Serv Req ".$job['protectron']; echo "
".$clientdat['address'].""; if (!$ident) echo $job['address']; echo "\n"; if (!empty($job['protectron'])) echo "Workorder "; if (!empty($job['pwoNo'])) echo $job['pwoNo']; echo "
".$clientdat['city'].", ".$clientdat['prov']." ".$clientdat['pc'].""; if (!$ident) echo $job['city'].", ".$job['prov']." ".$job['pc']; echo "
\n"; } include_once 'header.html'; ?> \n"; printHeader($pageNo); echo "
\n"; $nCnt = 0; $nHrs = 0; $nTvl = 0; $q = "linkRef='$jRef'"; if (!array_key_exists("audit", $_REQUEST)) $q .= " and eType = ''"; else $q .= " and eType != 'd' and (eType != 'p' or empNo='".$_SESSION['user']['empNo']."')"; $comments = sqlSelect("logents", $q, "", "wDate, sortBy", "*, left(CONCAT(tStart, wStart, MID(tid, 8, 4)), 4) AS sortBy"); while ($comment = mysql_fetch_assoc($comments['r'])) { if (!empty($comment['note'])) { $notes[$nCnt]['wDate'] = formatDate($comment['wDate']); $notes[$nCnt]['author'] = getEmployeeName($comment['empNo']); $notes[$nCnt]['note'] = str_replace(array("\n\n\n","\n\n"), "\n", $comment['note']); $notes[$nCnt]['eType'] = $comment['eType']; $nCnt += 1; } if ((!empty($comment['wStart']) and !empty($comment['wEnd'])) or (!empty($comment['tStart']) and !empty($comment['tEnd']))) { $labor[$nHrs]['wDate'] = formatDate($comment['wDate']); $labor[$nHrs]['author'] = getEmployeeName($comment['empNo']); $labor[$nHrs]['tStart'] = $comment['tStart']; $labor[$nHrs]['wStart'] = $comment['wStart']; $labor[$nHrs]['wEnd'] = $comment['wEnd']; $labor[$nHrs]['tEnd'] = $comment['tEnd']; $nHrs += 1; } if (($comment['kmStart'] * 1) and ($comment['kmEnd'] * 1)) { $travel[$nHrs]['wDate'] = formatDate($comment['wDate']); $travel[$nHrs]['author'] = getEmployeeName($comment['empNo']); $travel[$nHrs]['kmStart'] = $comment['kmStart']; $travel[$nHrs]['kmEnd'] = $comment['kmEnd']; $nTvl += 1; } } $nRows = 1; // this is set to 1 to allow for the title line "Notes" below echo "\n"; echo " \n"; echo " \n"; // second column: labor and parts echo " \n";//width=\"49%\" echo " \n"; echo " \n"; // signiture block echo " \n"; echo " \n"; echo " \n"; echo "
\n"; // output assignment here if (!empty($job['assignment'])) { $nRows += 2; echo "
Task Description

\n"; $lines = explode("\n", $job['assignment']); foreach ($lines as $line) $nRows += outLine($line); echo "
\n"; } echo "
Notes

\n"; if (count($notes)) { foreach ($notes as $note) { if ($note['eType'] == "s") { $span1 = ""; $span2 = ""; } else { $span1 = ""; $span2 = ""; } echo "$span1By ".$note['author']." on ".$note['wDate'].":
\n"; $nRows += 1; echo "\n"; $note['note'] = str_replace("\n", "
\n", stripslashes($note['note'])); $noteLines = explode("\n", $note['note']); foreach ($noteLines as $noteLine) $nRows += outLine($noteLine); echo "
$span2
\n"; } } $nRows = intval($nRows * 0.75); if ($nRows & 0x01) $nRows -= 1; while ($nRows < 50) { if (array_key_exists("worksheet", $_REQUEST)) { echo str_repeat("_", 58); } echo "

\n"; $nRows += 2; } echo "
 \n"; // labor echo "
Labor

\n"; echo " \n"; echo " \n"; echo " \n"; echo " \n"; echo " \n"; echo " \n"; echo " \n"; echo " \n"; echo " \n"; echo " \n"; echo " \n"; if(count($labor)) { $lCnt = 0; foreach ($labor as $lab) { $tvl = 0; $tTvl = 0; echo " \n"; echo " \n"; echo " \n"; echo " \n"; echo " \n"; echo " \n"; echo " \n"; if (!empty($lab['tStart']) and !empty($lab['wStart'])) $tTvl = processTimeDif($lab['tStart'], $lab['wStart']); if (!empty($lab['wEnd']) and !empty($lab['tEnd'])) $tTvl += processTimeDif($lab['wEnd'], $lab['tEnd']); if (empty($lab['wStart']) and empty($lab['wEnd']) and !empty($lab['tStart']) and !empty($lab['tEnd'])) $tTvl += processTimeDif($lab['tStart'], $lab['tEnd']); $tLab = processTimeDif($lab['wStart'], $lab['wEnd']); $gtTvl += $tTvl; $gtLab += $tLab; echo " \n"; echo " \n"; echo " \n"; $lCnt += 1; } } if (array_key_exists("worksheet", $_REQUEST)) { while ($lCnt < 10) { echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo "\n"; $lCnt += 2; } } else { echo " \n"; echo " \n"; echo " \n"; echo " \n"; echo " \n"; } echo "
DateTechTvlStartEndTvlLabTvl
".$lab['wDate']."".$lab['author']."".$lab['tStart']."".$lab['wStart']."".$lab['wEnd']."".$lab['tEnd']."".sprintf("%01.2f", $tLab)."".sprintf("%01.2f", $tTvl)."

 
       
Totals".sprintf("%01.2f", $gtLab)."".sprintf("%01.2f", $gtTvl)."

\n"; if(count($travel) or array_key_exists("worksheet", $_REQUEST)) { echo "
Travel (km)

\n"; echo " \n"; echo " \n"; echo " \n"; echo " \n"; echo " \n"; echo " \n"; echo " \n"; echo " \n"; $tTvl = 0; $lCnt = 0; if(count($travel)) { foreach ($travel as $tvl) { $t = $tvl['kmEnd'] - $tvl['kmStart']; echo " \n"; echo " \n"; echo " \n"; echo " \n"; echo " \n"; echo " \n"; echo " \n"; $tTvl += $t; $lCnt += 1; } } if (array_key_exists("worksheet", $_REQUEST)) { while ($lCnt < 10) { echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo "\n"; $lCnt += 2; } } echo "
DateTechStartEndTotal
".$tvl['wDate']."".$tvl['author']."".$tvl['kmStart']."".$tvl['kmEnd']."".sprintf("%01.2f", $t)."

 
    
\n"; } echo "
\n"; echo "

Signiture __________________________________   Print Name"; if (!empty($_SESSION['signer'])) { //if (strlen($_SESSION['signer']) < 32) // str_repeat("_", intval((32 - strlen($_SESSION['signer'])) / 2)); echo ": ".$_SESSION['signer'].""; //if (strlen($_SESSION['signer']) < 32) // str_repeat("_", intval((32 - strlen($_SESSION['signer'])) / 2)); } else echo " ____________________________"; echo "  Date"; if (empty($_SESSION['usePrintDate'])) echo "___________________________"; else echo ": ___".date("Y-m-d")."___"; echo "

"; echo "
\n"; // ***************************** Zone List ***************************** $zoneList = sqlSelect("zones", "linkRef='$jRef'", "", "zoneNo"); $locs = sqlSelect("locations", "linkref='$jRef'"); if ($zoneList['n'] or $locs['n']) { if (array_key_exists("noprint", $_REQUEST)) { echo "\n"; echo " \n"; echo " \n"; echo " \n"; echo "
PAGE BREAK
\n"; } if ($zoneList < 20) $limit = $zoneList['n']; else $limit = ($zoneList['n'] + 1) / 2; echo "
\n"; $pageNo++; printHeader($pageNo); echo "
\n"; echo "
Zones
\n"; echo " \n"; echo " \n"; echo " \n"; echo " \n"; echo " \n"; echo " \n"; echo " \n"; echo " \n"; echo " \n"; echo " \n"; $lCnt = 0; while ($zone = mysql_fetch_assoc($zoneList['r'])) { echo " \n"; echo " \n"; echo " \n"; echo " \n"; echo " \n"; echo " \n"; echo " \n"; echo " \n"; $lCnt += 1; } echo "
NumParDeviceTypeLoopDescription
".$zone['zoneNo']."".$zone['zonePart']."".$zone['zoneDevice']."".$zone['zoneType']."".$zone['zoneEOL']."".$zone['zoneName']."
\n"; if ($locs['n']) { if ($zoneList['n']) echo "
Locations
\n"; while ($l = mysql_fetch_assoc($locs['r'])) { echo " {$l['ilocation']}
\n"; $lCnt += 1; } } // if (array_key_exists("worksheet", $_REQUEST)) // { // while ($lCnt < 25) // { // echo ""; // echo "
 "; // echo " "; // echo " "; // echo " "; // echo " "; // echo " "; // echo "\n"; // $lCnt += 2; // } // } } // ***************************** Parts List ***************************** $partsList = sqlSelect("inventory", "workorder='$jRef' and status='INS'", "item,iloc,sn", "item,iloc,sn"); $partsList2 = sqlSelect("inventory", "workorder='$jRef' and status=''", "item,iloc,sn", "item,iloc,sn"); if ($partsList['n'] or $partsList2['n']) { $pageNo++; if (array_key_exists("noprint", $_REQUEST)) { echo "\n"; echo " \n"; echo " \n"; echo " \n"; echo "
"; echo "PAGE ".($pageNo + 1); echo "
\n"; } echo "
\n"; printHeader($pageNo); echo "
\n"; } if ($partsList['n']) { echo "
Installed Parts

\n"; echo "\n"; echo " \n"; echo " \n"; echo " \n"; echo " \n"; echo " \n"; echo " \n"; echo " \n"; echo " \n"; echo " \n"; echo "\n"; while ($parts = mysql_fetch_assoc($partsList['r'])) { $pDat = getProductInfo($parts['item']); $itemCnt = sqlSelect("inventory", "workorder='$jRef' and sn='{$parts['sn']}' and item='{$parts['item']}' and iloc='{$parts['iloc']}' and status='INS'"); debugDump($pDat, "pDat"); echo " \n"; echo " \n"; echo " \n"; echo " \n"; echo " \n"; echo " \n"; echo " \n"; echo " \n"; echo " \n"; echo " \n"; } echo "
QtyVendItemOwnerDescriptionSerialLocationDate
{$itemCnt['n']}{$pDat['vend']}{$pDat['vsn']}".strtoupper($parts['owner'])."{$pDat['description']}{$parts['sn']}{$parts['iloc']}".formatDate(substr($parts['lastmod'],0,8))."
\n"; $lCnt = 0; //$partsList = sqlSelect("inventory", "workorder='$jRef' and status=''", "item,iloc,sn", "item,iloc,sn"); if ($partsList2['n']) { echo "
Pending Parts

\n"; echo "\n"; echo " \n"; echo " \n"; echo " \n"; echo " \n"; echo " \n"; echo " \n"; echo " \n"; echo " \n"; echo " \n"; while ($parts = mysql_fetch_assoc($partsList2['r'])) { $pDat = getProductInfo($parts['item']); $itemCnt = sqlSelect("inventory", "workorder='$jRef' and sn='{$parts['sn']}' and item='{$parts['item']}' and iloc='{$parts['iloc']}' and sof=''"); debugDump($pDat, "pDat"); echo " \n"; echo " \n"; echo " \n"; echo " \n"; echo " \n"; echo " \n"; echo " \n"; echo " \n"; echo " \n"; $lCnt += 1; } echo "
QtyVendItemOwnerDescriptionSerialLocation
{$itemCnt['n']}{$pDat['vend']}{$pDat['vsn']}".strtoupper($parts['owner'])."{$pDat['description']}{$parts['sn']}{$parts['iloc']}
\n"; } } if (array_key_exists("worksheet", $_REQUEST)) { echo "
Additional Parts

\n"; echo "
\n"; echo " \n"; echo " \n"; echo " \n"; echo " \n"; echo " \n"; echo " \n"; echo " \n"; echo " \n"; while ($lCnt < 25) { echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo "\n"; $lCnt += 2; } echo "
QtyVendItemDescriptionSerialLocation

 
     
\n"; } ?>