\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 " \n"; echo "
"; if ($pageNo) echo "Page ".($pageNo + 1)." - "; echo $job['jobNo']."
Billing Information {$job['cCode']}Site InformationCID: ".$job['csid']."
".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"; $tableWidth = 800; $q = "fName = '{$_REQUEST['fName']}' and lName = '{$_REQUEST['lName']}'"; $oList = sqlSelect("headers", $q, "", "tid asc", "tid"); while ($thisjob = mysql_fetch_assoc($oList['r'])) { $job = sqlSelect("headers", "tid='".$thisjob['tid']."'"); $job = mysql_fetch_assoc($job['r']); // 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 str_replace(" ", "",$clientdat['pc']) != str_replace(" ", "", $job['pc'])) $ident = false; printHeader($pageNo); echo "
\n"; $nCnt = 0; $nHrs = 0; $nTvl = 0; $q = "linkRef='".$thisjob['tid']."'"; 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; } } echo "\n"; echo " \n"; echo " \n"; 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'].": "; echo "".str_replace("\n", "
\n", stripslashes($note['note']))."
$span2
\n"; echo "
\n"; } } 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"; echo " \n"; if(count($labor)) { 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"; } } 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)) { echo "
Travel

\n"; echo " \n"; echo " \n"; echo " \n"; echo " \n"; echo " \n"; echo " \n"; echo " \n"; echo " \n"; $tTvl = 0; 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; } echo "
DateTechStartEndTotal
".$tvl['wDate']."".$tvl['author']."".$tvl['kmStart']."".$tvl['kmEnd']."".sprintf("%01.2f", $t)."
\n"; } echo "
\n"; // ***************************** Zone List ***************************** if ($zonesNotPrinted) { $zoneList = sqlSelect("zones", "linkRef='".$thisjob['tid']."'", "", "zoneNo"); if ($zoneList['n']) { if ($zoneList < 20) $limit = $zoneList['n']; else $limit = ($zoneList['n'] + 1) / 2; $pageNo++; if (array_key_exists("noprint", $_REQUEST)) { //echo "
\n"; echo "\n"; echo " \n"; echo " \n"; echo " \n"; echo "
"; echo "PAGE ".($pageNo + 1); echo "
\n"; } echo "
\n"; printHeader($pageNo); echo "
\n"; echo " \n"; echo " \n"; echo " \n"; echo " \n"; echo " \n"; echo " \n"; echo " \n"; echo " \n"; echo " \n"; echo " \n"; while ($zone = mysql_fetch_assoc($zoneList['r'])) { echo " \n"; echo " \n"; echo " \n"; echo " \n"; echo " \n"; echo " \n"; echo " \n"; echo " \n"; } echo "
NumParDeviceTypeLoopDescription
".$zone['zoneNo']."".$zone['zonePart']."".$zone['zoneDevice']."".$zone['zoneType']."".$zone['zoneEOL']."".$zone['zoneName']."
\n"; } $zonesNotPrinted = false; } // ***************************** Parts List ***************************** $partsList = sqlSelect("inventory", "workorder='".$thisjob['tid']."' and sof='INS'", "item,iloc,sn", "item,iloc,sn"); if ($partsList['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"; echo "
Installed Parts

\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='".$thisjob['tid']."' and sn='{$parts['sn']}' and item='{$parts['item']}' and iloc='{$parts['iloc']}' and sof='INS'"); echo " \n"; echo " \n"; echo " \n"; echo " \n"; echo " \n"; echo " \n"; echo " \n"; echo " \n"; } echo "
QtyVendItemDescriptionSerialLocation
{$itemCnt['n']}{$pDat['vend']}{$pDat['vsn']}{$pDat['description']}{$parts['sn']}{$parts['iloc']}
\n"; } $partsList = sqlSelect("inventory", "workorder='".$thisjob['tid']."' and sof=''", "item,iloc,sn", "item,iloc,sn"); if ($partsList['n']) { echo "
Pending or Backordered Parts

\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='".$thisjob['tid']."' and sn='{$parts['sn']}' and item='{$parts['item']}' and iloc='{$parts['iloc']}' and sof=''"); echo " \n"; echo " \n"; echo " \n"; echo " \n"; echo " \n"; echo " \n"; echo " \n"; echo " \n"; } echo "
QtyVendItemDescriptionSerialLocation
{$itemCnt['n']}{$pDat['vend']}{$pDat['vsn']}{$pDat['description']}{$parts['sn']}{$parts['iloc']}
\n"; } unset($notes); unset($labor); unset($zoneList); unset($partsList); unset($travel); unset($tTvl); unset($gtLab); unset($gtTvl); } ?>