\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"; $hasPrinted = false; foreach ($serialJobList as $serialJob) { if ($hasPrinted) { echo "
\n"; unset($clientdat); unset($comments); unset($comment); unset($lines); unset($job); unset($jobRef); unset($notes); } $hasPrinted = true; $job = sqlSelect("headers", "jobNo='$serialJob'"); $job = mysql_fetch_assoc($job['r']); $jRef = $job['tid']; // in theory, the clientdat info is billing and headers has the site info. $clientdat = sqlSelect("clientdat", "cCode='".$job['cCode']."'"); $clientdat = mysql_fetch_assoc($clientdat['r']); $pageNo = 0; $ident = true; if ($clientdat['lName'] == $job['lName']) { if (empty($clientdat['fName']) and !empty($job['fName'])) { $clientdat['fName'] = $job['fName']; $chg = 1; } if (empty($clientdat['address']) and !empty($job['address'])) { $clientdat['address'] = $job['address']; $chg = 1; } if (empty($clientdat['city']) and !empty($job['city'])) { $clientdat['city'] = $job['city']; $chg = 1; } if (empty($clientdat['pc']) and !empty($job['pc'])) { $clientdat['pc'] = $job['pc']; $chg = 1; } // if $chg is set.. update client file?? } if (!empty($clientdat['fName']) and !empty($job['fName']) and $clientdat['fName'] != $job['fName']) $ident = false; if (!empty($clientdat['address']) and !empty($job['address']) and $clientdat['address'] != $job['address']) $ident = false; if (!empty($clientdat['city']) and !empty($job['city']) and $clientdat['city'] != $job['city']) $ident = false; if (!empty($clientdat['pc']) and !empty($job['pc']) and $clientdat['pc'] != $job['pc']) $ident = false; printHeader($pageNo); echo "
\n"; $nCnt = 0; $nHrs = 0; $nTvl = 0; $q = "linkRef='$jRef' and eType = ''"; $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"; 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"; $tTvl = 0; $tLab = 0; $gtTvl = 0; $gtLab = 0; 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"; // ***************************** 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; } } } // ***************************** 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"; } } ?>