Part Number Index
Sorted by Old Part Number
|
Sorted by New Part Number
|
|
$value) {
$ele = explode(';',$value);
$link = $ele[0];
$oldpn = $ele[1];
$newpn = $ele[2];
$sold[$i] = $ele[1].';'.$ele[2].';'.$ele[0];
$snew[$i] = $ele[2].';'.$ele[1].';'.$ele[0];
$i++;
}
// Read the file names into an array
$path = 'engineering';
$d = opendir($path) or die($php_errormsg);
while (false !== ($f = readdir($d))) {
if ($path !== '.') { $ffile = $path . '/' . $f; }
else { $ffile = $f; }
if (is_file($ffile)) {
$point = strpos($f,'.');
$suffix = substr($f,$point);
if ($suffix === '.pdf') { // We are only interested in .pdf files
$part = substr($f,1,$point - 5);
$snew[] = $part . ' ==>;(Engineering Drawing);' . $ffile; // Add the part to the list
}
}
}
closedir($d);
sort($sold);
sort($snew);
$holdStart = ' ';
print '';
print 'Old Part Number | New Part Number | ';
foreach ($sold as $entry => $value) {
// [0] = Old Part Number
// [1] = New Part Number
// [2] = Link
$ele = explode(';',$value);
// Get the starting character of the Old Part Number
$workPart = substr($ele[0],0,1);
if ($workPart != $holdStart) {
// Insert a "break" between the starting characters
print ' Return to Top ';
$holdStart = $workPart;
}
// If I do not have a link, insert the part number with a note "Special Part"
if ($ele[2] == "") {
print '' . $ele[0] .
' * | ' . $ele[1] .
' * | ' . "\n";
} else { // Otherwise insert the part with the link
print ' ' .
'' . $ele[0] . ' | ' .
'' . $ele[1] . ' | ' .
' ' . "\n";
}
}
print ' ';
?>
|
';
print ' | New Part Number | Old Part Number | ';
foreach ($snew as $entry => $value) {
// [0] = New Part Number
// [1] = Old Part Number
// [2] = Link
$ele = explode(';',$value);
$workPart = substr($ele[0],0,1);
if ($workPart != $holdStart) {
print ' Return to Top ';
$holdStart = $workPart;
}
if ($ele[2] == "") {
print '' . $ele[0] .
' * | ' . $ele[1] .
' * | ' . "\n";
} else {
print '' .
'' . $ele[0] . ' | ' .
'' . $ele[1] . ' | ' .
' ' . "\n";
}
}
print ' ';
?>
|