Eco-$mart Quotes

Could not complete authorization."); //echo mysql_error(); exit(); } $rowa = mysql_fetch_array($passem); $pswcon = $rowa[1]; if($pswcon != 'RD' and $pswcon != 'All'){ echo("

<<<<Restricted Area>>>>" . "
Sorry, you must have clearance to view Regional Quotes

"); exit(); }else{ //////////get region $splitem = explode(" ",$usrn); $getreg=mysql_query("SELECT region FROM repcon WHERE name_1='$splitem[0]' AND name_2='$splitem[1]'"); if(!$getreg){ echo("Could not get region. Cannot continue."); echo mysql_error(); exit(); }else{ $regger=mysql_fetch_array($getreg); $region=$regger[0]; if($region !=""){ echo("

$region - Director: $usrn

"); }else{ echo("Problems with region selection. Cannot Continue."); exit(); } }//gotreg }//passed ////////////////////////////////////////GET usrn ARRAY mysql_select_db('ecosmar_website', $dbcnx); $getreps=mysql_query("SELECT last_name,usrn FROM psw WHERE psw_rd='$usrn' ORDER BY last_name"); if(!$getreps){ $air[]="Could not get Representative List. Error:
".mysql_error(); }else{ while($rps = mysql_fetch_array($getreps)){ $usrns[]=$rps[1]; } /////////////////////////////GET QUOTES USING ORDERED usrn ARRAY if(!empty($usrns)){ mysql_select_db('ecosmar_inv', $dbcnx); foreach($usrns as $value){//foreach usrns $getquote = mysql_query("SELECT ID,CID,usrn,started,printed FROM quotes WHERE usrn='$value' ORDER BY started "); if(!$getquote){ $air[]="Could not get ".$usrn." Quotes. Error:
".mysql_error(); }else{//got quote $numrows=mysql_num_rows($getquote); if($numrows > 0){//numrows is greater then 0 echo("

$value

"); while($qrows = mysql_fetch_array($getquote)){ $QIDs[]=$qrows['ID']; $CIDs[]=$qrows['CID']; $start=$qrows['started']; $starts[]=$start; $chunk_start = chunk_split($start, 2, ':'); $chunk_arrs = explode(":", $chunk_start); $starteds[] = $chunk_arrs[2].'/'.$chunk_arrs[3].'/'.$chunk_arrs[0].$chunk_arrs[1]; $printo=$qrows['printed']; $printos[]=$printo; $chunk_printo = chunk_split($printo, 2, ':'); $chunk_arrp = explode(":", $chunk_printo); $printeds[]= $chunk_arrp[2].'/'.$chunk_arrp[3].'/'.$chunk_arrp[0].$chunk_arrp[1]; $addQID[]=1; }//while getting quote rows if(!empty($QIDs)){ mysql_select_db('ecosmar_contacts', $dbcnx); $i=0; $rowcount=count($QIDs); while($i < $rowcount){ $getcontact=mysql_query("SELECT first_Name,Name,Company FROM con_main WHERE ID='$CIDs[$i]'"); if(!$getcontact){ $air[]="Could not get Contact Info for CID: ".$CIDs[$i].". Error:
".mysql_error(); }else{ $con=mysql_fetch_array($getcontact); $namely=$con['first_Name']." ".$con['Name']." — ".$con['Company']; }//got contact echo("

[ EDIT ]" . "   Started: $starteds[$i]  To: $namely  "); if($printos[$i] > 0){ echo("Last Printed: $printeds[$i]"); } echo("

"); $i=$i+1; }//while counting down QIDs }//QIDs is not empty }//numrowsisgreaterthan0 else{ $noquotes='on'; }//numrows is not greater than 0 }//got quote }//4each usrn }//usrn array is not emptyy else{ echo("

There are no representatives listed for this region."); exit(); }//usrn array is empty seems to be a prb }//got reps $addemup = array_sum($addQID); if($addemup < 1){ echo("

No Quotes for $region

"); } ?>
Back to Administration