<?php

  // $text_overview="Quick Links";
$status2='';
$status='';
$pieces='';
$gbad='';
$display_listNotSup1='';
$list_formPO2D='';
$map_id2PRnm1='';
$diplay_uploads='';
$file_name='';
$crit='';
//$status[1]='';
$sec_title1="Overview";
$sec_title2='';
$sec_title3='';
$sec_title4="";
$sec_title5="Quick Links";
$sec_title6="Forms";
$sec_title7='';
$sec_title8='';
$sec_title9='';
$sec_title10='';
$list_formPO2='';
$boom3='';
$mapid='';
$list_formWAR='';
$deldate='';
$num1aa='';
$blink='';
$warnP='';
 $display_listCL='';
$display_notices1='';
$display_listCLim='';
$cust_id='';
$list_formWH2='';
 $prog='';
  $prog1='';
 $i='';
 $prog="forms/forms.php";
  $prog1="report/test_po.php";
  $prog4="report/test_po2.php";
   $prog2="report/test_plain.php";
    $prog3="../../index.php?route=common/home";
       $prog5="report/test_pur.php";
  $list_formPR2='';
$list_formPR='';
$bod3='';
$boom='';
$nonp='000';
$money='';
$display_block44='';
$display_close='';
$boom2='';
$total_pr='';
$list_formWH2='';
 $display_block44PR1='';
  

$total_pr='';

$sql33 ="SELECT * FROM $table_name108 WHERE enable = 1 ";
$result33 = @mysql_query($sql33,$connection) or die(mysql_error());
  $num1aa[0] = mysql_num_rows($result33); //total machines

$sql33 ="SELECT * FROM $table_name96 WHERE status = 3 AND form_id=1 ";
$result33 = @mysql_query($sql33,$connection) or die(mysql_error());
  $num1aa[1] = mysql_num_rows($result33);

$sql33 ="SELECT * FROM $table_name96 WHERE status = 3 AND form_id=2 ";
$result33 = @mysql_query($sql33,$connection) or die(mysql_error());
  $num1aa[2] = mysql_num_rows($result33);

$sql33 ="SELECT * FROM $table_name96 WHERE status = 3 AND form_id=3 ";
$result33 = @mysql_query($sql33,$connection) or die(mysql_error());
  $num1aa[3] = mysql_num_rows($result33);

$sql33 ="SELECT * FROM $table_name96 WHERE status = 3 AND form_id=4 ";
$result33 = @mysql_query($sql33,$connection) or die(mysql_error());
   $num1aa[4] = mysql_num_rows($result33);

$sql33 ="SELECT * FROM $table_name96 WHERE status = 3 AND form_id=5 ";
$result33 = @mysql_query($sql33,$connection) or die(mysql_error());
   $num1aa[5] = mysql_num_rows($result33);

$sql33 ="SELECT * FROM $table_name96 WHERE status = 3 AND form_id=6 ";
$result33 = @mysql_query($sql33,$connection) or die(mysql_error());
  $num1aa[6] = mysql_num_rows($result33);

$sql33 ="SELECT * FROM $table_name96 WHERE status = 3 AND form_id=7 ";
$result33 = @mysql_query($sql33,$connection) or die(mysql_error());
   $num1aa[7] = mysql_num_rows($result33);

$sql33 ="SELECT * FROM $table_name96 WHERE status = 3 AND form_id=8 ";
$result33 = @mysql_query($sql33,$connection) or die(mysql_error());
   $num1aa[8] = mysql_num_rows($result33);

$sql33 ="SELECT * FROM $table_name96 WHERE status = 3 AND form_id=9 ";
$result33 = @mysql_query($sql33,$connection) or die(mysql_error());
 $num1aa[9] = mysql_num_rows($result33);

$sql33 ="SELECT * FROM $table_name96 WHERE status = 3 AND form_id=10 ";
$result33 = @mysql_query($sql33,$connection) or die(mysql_error());
   $num1aa[10] = mysql_num_rows($result33);

$sql33 ="SELECT * FROM $table_name96 WHERE status = 3 AND form_id=11 ";
$result33 = @mysql_query($sql33,$connection) or die(mysql_error());
   $num1aa[11] = mysql_num_rows($result33);


  $result33 = @mysql_query($sql33,$connection) or die(mysql_error());
       // $row22 =mysql_fetch_array($result33,MYSQL_ASSOC);
  while ($row22 = mysql_fetch_array($result33)) {
         $total_pr= $total_pr+ $row22['van47'];
}

include("cust_id.php");

$sql33 ="SELECT * FROM $table_name96 WHERE status = 3 AND form_id=12 ";
$result33 = @mysql_query($sql33,$connection) or die(mysql_error());
  $num1aa[12] = mysql_num_rows($result33);

$sql33 ="SELECT * FROM $table_name96 WHERE status = 3 AND form_id=13 ";
$result33 = @mysql_query($sql33,$connection) or die(mysql_error());
  $num1aa[13] = mysql_num_rows($result33);

$sql33 ="SELECT * FROM $table_name96 WHERE status = 3 AND form_id=14 ";
$result33 = @mysql_query($sql33,$connection) or die(mysql_error());
   $num1aa[14] = mysql_num_rows($result33);

$sql33 ="SELECT * FROM $table_name96 WHERE status = 3 AND form_id=15 ";
$result33 = @mysql_query($sql33,$connection) or die(mysql_error());
   $num1aa[15] = mysql_num_rows($result33);

$sql33 ="SELECT * FROM $table_name96 WHERE status = 3 AND form_id=16 ";
$result33 = @mysql_query($sql33,$connection) or die(mysql_error());
 $num1aa[16] = mysql_num_rows($result33);

$sql33 ="SELECT * FROM $table_name96 WHERE status = 3 AND form_id=17 ";
$result33 = @mysql_query($sql33,$connection) or die(mysql_error());
   $num1aa[17] = mysql_num_rows($result33);

$sql33 ="SELECT * FROM $table_name96 WHERE status = 3 AND form_id=18 ";
$result33 = @mysql_query($sql33,$connection) or die(mysql_error());
  $num1aa[18] = mysql_num_rows($result33);
  
  
$sql33 ="SELECT * FROM $table_name96 WHERE status = 3 AND form_id=13 ";
$result33 = @mysql_query($sql33,$connection) or die(mysql_error());
   $num1aa[13] = mysql_num_rows($result33);


$sql33 ="SELECT * FROM $table_name96 WHERE status = 3 AND form_id=14 ";
$result33 = @mysql_query($sql33,$connection) or die(mysql_error());
   $num1aa[14] = mysql_num_rows($result33);


$sql33 ="SELECT * FROM $table_name96 WHERE status = 3 AND form_id=15 ";
$result33 = @mysql_query($sql33,$connection) or die(mysql_error());
   $num1aa[15] = mysql_num_rows($result33);


$sql33 ="SELECT * FROM $table_name96 WHERE status = 3 AND form_id=16 ";
$result33 = @mysql_query($sql33,$connection) or die(mysql_error());
   $num1aa[16] = mysql_num_rows($result33);


$sql33 ="SELECT * FROM $table_name96 WHERE status = 100 AND form_id=17 ";
$result33 = @mysql_query($sql33,$connection) or die(mysql_error());
   $num1aa[17] = mysql_num_rows($result33);

$sql33 ="SELECT * FROM $table_name96 WHERE status = 3 AND form_id=18 ";
$result33 = @mysql_query($sql33,$connection) or die(mysql_error());
   $num1aa[18] = mysql_num_rows($result33);

$sql33 ="SELECT * FROM $table_name96 WHERE status = 3 AND form_id=19 ";
$result33 = @mysql_query($sql33,$connection) or die(mysql_error());
   $num1aa[19] = mysql_num_rows($result33);



$sql33 ="SELECT * FROM $table_name96 WHERE status = 3 AND form_id=20 ";
$result33 = @mysql_query($sql33,$connection) or die(mysql_error());
   $num1aa[20] = mysql_num_rows($result33);




$sql33 ="SELECT * FROM $table_name96 WHERE status = 3 AND form_id=21 ";
$result33 = @mysql_query($sql33,$connection) or die(mysql_error());
   $num1aa[21] = mysql_num_rows($result33);


$sql33 ="SELECT * FROM $table_name96 WHERE status = 3 AND form_id=22 ";
$result33 = @mysql_query($sql33,$connection) or die(mysql_error());
   $num1aa[22] = mysql_num_rows($result33);


$sql33 ="SELECT * FROM $table_name96 WHERE status = 3 AND form_id=23 ";
$result33 = @mysql_query($sql33,$connection) or die(mysql_error());
   $num1aa[23] = mysql_num_rows($result33);


$sql33 ="SELECT * FROM $table_name96 WHERE status = 3 AND form_id=24 ";
$result33 = @mysql_query($sql33,$connection) or die(mysql_error());
   $num1aa[24] = mysql_num_rows($result33);


$sql33 ="SELECT * FROM $table_name96 WHERE status = 3 AND form_id=25 ";
$result33 = @mysql_query($sql33,$connection) or die(mysql_error());
   $num1aa[25] = mysql_num_rows($result33);


$sql33 ="SELECT * FROM $table_name96 WHERE status = 3 AND form_id=26 ";
$result33 = @mysql_query($sql33,$connection) or die(mysql_error());
   $num1aa[26] = mysql_num_rows($result33);


$sql33 ="SELECT * FROM $table_name96 WHERE status = 3 AND form_id=27 ";
$result33 = @mysql_query($sql33,$connection) or die(mysql_error());
   $num1aa[27] = mysql_num_rows($result33);



$sql33 ="SELECT * FROM $table_name96 WHERE status = 3 AND form_id=28 ";
$result33 = @mysql_query($sql33,$connection) or die(mysql_error());
   $num1aa[28] = mysql_num_rows($result33);


$sql33 ="SELECT * FROM $table_name96 WHERE status = 3 AND form_id=29 ";
$result33 = @mysql_query($sql33,$connection) or die(mysql_error());
   $num1aa[29] = mysql_num_rows($result33);



$sql33 ="SELECT * FROM $table_name96 WHERE status = 3 AND form_id=30 ";
$result33 = @mysql_query($sql33,$connection) or die(mysql_error());
   $num1aa[30] = mysql_num_rows($result33);


$sql33 ="SELECT * FROM $table_name96 WHERE status = 3 AND form_id=31 ";
$result33 = @mysql_query($sql33,$connection) or die(mysql_error());
   $num1aa[31] = mysql_num_rows($result33);


  $result33 = @mysql_query($sql33,$connection) or die(mysql_error());
       // $row22 =mysql_fetch_array($result33,MYSQL_ASSOC);
  while ($row22 = mysql_fetch_array($result33)) {
         $total_pr= $total_pr+ $row22['van47'];
}

$sql33 ="SELECT * FROM $table_name96 WHERE status = 3 AND form_id=12 ";
$result33 = @mysql_query($sql33,$connection) or die(mysql_error());
  $num1aa[12] = mysql_num_rows($result33);

$sql33 ="SELECT * FROM $table_name96 WHERE status = 3 AND form_id=13 ";
$result33 = @mysql_query($sql33,$connection) or die(mysql_error());
  $num1aa[13] = mysql_num_rows($result33);

$sql33 ="SELECT * FROM $table_name96 WHERE status = 3 AND form_id=14 ";
$result33 = @mysql_query($sql33,$connection) or die(mysql_error());
   $num1aa[14] = mysql_num_rows($result33);

$sql33 ="SELECT * FROM $table_name96 WHERE status = 3 AND form_id=15 ";
$result33 = @mysql_query($sql33,$connection) or die(mysql_error());
   $num1aa[15] = mysql_num_rows($result33);

$sql33 ="SELECT * FROM $table_name96 WHERE status = 3 AND form_id=16 ";
$result33 = @mysql_query($sql33,$connection) or die(mysql_error());
 $num1aa[16] = mysql_num_rows($result33);

$sql33 ="SELECT * FROM $table_name96 WHERE status = 100 AND form_id=17 ";
$result33 = @mysql_query($sql33,$connection) or die(mysql_error());
   $num1aa[17] = mysql_num_rows($result33);

$sql33 ="SELECT * FROM $table_name96 WHERE status = 3 AND form_id=18 ";
$result33 = @mysql_query($sql33,$connection) or die(mysql_error());
  $num1aa[18] = mysql_num_rows($result33);




  $sql33 ="SELECT * FROM $table_name93 WHERE (group_owner='$user_gid' OR group_owner=1) AND enabled > 0 ";

  $result33 = @mysql_query($sql33,$connection) or die(mysql_error());
  while ($row22 = mysql_fetch_array($result33)) {
         $form_id=  $row22['form_id'];
          $form_name=  $row22['form_name'];

$display_forms .=" Form ID: $form_id $form_name     -    
<a href=\"$loc2/admin/index.php?route=GoTool/forms&amp;token=$tok&bod2=55&log=$logged&fid=$form_id\"><div class=\"bbutton2\">Start New Forms</div></a> <a href=\"$loc2/admin/index.php?route=GoTool/forms&amp;token=$tok&log=$logged&fid=$form_id\"><div class=\"bbutton2\">View/Edit (Unsubmitted) Forms</div></a><br/><br/>";


//$sql33 ="SELECT * FROM $table_name96 WHERE status = 3 AND form_id='$form_id' ";
//$result33 = @mysql_query($sql33,$connection) or die(mysql_error());
//$num1aa = mysql_num_rows($result33);



$display_notices1 .="

<a href=\"$loc2/admin/index.php?route=GoTool/forms&amp;token=$tok&log=$logged&fid=$form_id&bod2=65\">$form_name</a>:$num1aa[$form_id] <br/>

";



}
$display_notices1 ="";

$display_notices1 .="

Warehouse Entry:$num1aa[1] <br/>
Purchase Order:$num1aa[13] <br/>
Credit Memo:$num1aa[8] <br/>
Production Order:$num1aa[8] <br/>
Bi-Weekly Time sheets:$num1aa[8] <br/>
Warranty Claims:$num1aa[17] <br/>


";




$display_notices .="Awaiting Approval <br/> $display_notices1";



 $hi="$hi3<br/> User ID: $hi2 - Group:$hi1 <br />";
  $hi4="";
  $hi4 .="


  <a href=\"$loc2/admin/index.php?route=GoTool/forms&amp;token=$tok&log=$logged&fid=1\">Warehouse Entries</a> <br/>
  <a href=\"$loc2/admin/index.php?route=GoTool/forms&amp;token=$tok&log=$logged&fid=11\">Purchase Requests</a> <br/>
              <a href=\"$loc2/admin/index.php?route=GoTool/part&amp;token=$tok&log=$logged\">$text_bob5</a> <br/>
             <a href=\"$loc2/admin/index.php?route=GoTool/po&amp;token=$tok&log=$logged\">$text_bob3</a>  <br/>


 ";

 $display_overview .="
  <select size=1 name=cust_idD >
                  <option selected value=$cust_id> Locate Credit Limit</option>
                 $display_listCLim
                  </select><br/>

                  <br/>


      <FORM  name=\"formcheck55\"  METHOD=\"POST\" ACTION=\"GoTool/$prog4?token=$tok&log=$logged\">
                   <input type=\"hidden\" name=\"jedID2\" value=\"22\"  />
  	<input type=\"hidden\" name=\"gbad\" value=\"\">

    <select size=1 name=cust_idD >
                  <option selected value=$cust_id> Update Credit Limit</option>
                 $display_listCLim
                  </select><br/>
	<input type=\"text\" name=\"newlimit\" value=\"\">
<input type=\"submit\" value=\"Update Limit\" name=\"B3\">
              </form>

      ";

 $sql33d ="SELECT * FROM $table_name98 WHERE form_id = '1' Order by create_date DESC limit 5  ";



// $sql33d ="SELECT * FROM $table_name98 WHERE form_id = '1' AND status =3 ";

$result33d = @mysql_query($sql33d,$connection) or die(mysql_error());
    while ($row22 = mysql_fetch_array($result33d)) {
          $map_id=  $row22['map_id'];
          $warehouse=$map_id;
           $customer_id=  $row22['customer_id'];
            $company=  $row22['van4'];
             $agent_id=  $row22['agent_id'];
              $money22= $row22['van17'];
               $vend= $row22['van4'];
                $dateW= $row22['create_date'];
                  $dateW = date("m/d/Y", strtotime($dateW));

    $display_closeC2 ="1-$nonp$map_id <FORM  name=\"formcheck3\"  METHOD=\"POST\" ACTION=\"GoTool/$prog5?token=$tok&log=$logged\"><input type=\"hidden\" name=\"form_id\" value=\"$form_id\" /><input type=\"hidden\" name=\"agent\" value=\"$agent_id\" /><input type=\"hidden\" name=\"map_id\" value=\"$map_id\" size=\"40\" /><input type=\"hidden\" name=\"bod2\" value=\"$bod3\"  size=\"20\" /><input type=\"hidden\" name=\"sbad\"  size=\"20\" /><input type=\"hidden\" name=\"gbad\" value=\"200\" size=\"40\" /><input type=\"hidden\" name=\"sbad\" value=\"0\" size=\"40\" /><input type=\"hidden\" name=\"gbadMod\" value=\"0\"  /><input type=\"hidden\" name=\"jedID2\" value=\"11\"  /><i>Close,Processed <input name=\"button name0\" type=\"image\" src=\"GoTool/image/add.png\" align=\"center\" /></form> ";




              // $vend1 =trim($vend);
               $vend1 = preg_replace( '/\s+/', ' ', $vend );


             //   $money22= number_format($row22['van17'],2);
                $money22=$row22['van17'];

$status= $row22['status'];
      if ($status==0 OR $status==99){
                $status2="Closed";
                }

if ($status==3){
                $status2="OPEN";
                }
if ($status==100){
                $status2="Approved";
                }



                $PO= $row22['van3'];
                if($PO ==$blink){
                $PO="No Match Found";
                $warnP="No Match Found";

                }

      $diplay_uploads='';
 $sql33dr ="SELECT DISTINCT file_name FROM $table_name104 WHERE map_id ='$warehouse' Order by create_date Desc ";
 $result33dr = @mysql_query($sql33dr,$connection) or die(mysql_error());
 while ($row1 = mysql_fetch_array($result33dr)) {

      $file_E=  $row1['file_name'];

   $sql33r ="SELECT * FROM $table_name104 WHERE map_id ='$warehouse' AND file_name='$file_E' limit 1 ";

  $result33r = @mysql_query($sql33r,$connection) or die(mysql_error());
        $row22r =mysql_fetch_array($result33r,MYSQL_ASSOC);
      $user_E=$row22r['user_id'];
      $create_date=$row22r['create_date'];

      $diplay_uploads.="<a href=\"$loc2/admin/GoTool/forms/forms_dep/$file_E\" target=\"blank\">$file_E</a><br />";
 }

 $diplay_uploads=$diplay_uploads;

if($diplay_uploads==$blink){
$diplay_uploads="NA";
}





//$sql33e ="SELECT * FROM $table_name98 WHERE form_id = '13' AND status =3 AND van1='$PO'";
$sql33e ="SELECT * FROM $table_name98 WHERE form_id = '13'  AND van1='$PO'";
 $result33e = @mysql_query($sql33e,$connection) or die(mysql_error());
      $row2 =mysql_fetch_array($result33e,MYSQL_ASSOC);

          $map_id2=  $row2['map_id'];

$i=1;

$form_id=1;
 $display_block34 ="$form_id-$nonp$map_id <FORM  name=\"formcheck3\"  METHOD=\"POST\" ACTION=\"GoTool/$prog?token=$tok&log=$logged\"><input type=\"hidden\" name=\"form_id\" value=\"$form_id\" /><input type=\"hidden\" name=\"agent\" value=\"$agent_id\" /><input type=\"hidden\" name=\"map_id\" value=\"$map_id\" size=\"40\" /><input type=\"hidden\" name=\"bod2\" value=\"105\"  size=\"20\" /><input type=\"hidden\" name=\"gbad\" value=\"0\" size=\"40\" /><input type=\"hidden\" name=\"sbad\" value=\"0\" size=\"40\" /><input type=\"hidden\" name=\"gbadMod\" value=\"0\"  /><input type=\"hidden\" name=\"jedID2\" value=\"6\"  /><i>View<i><input name=\"button name0\" type=\"image\" src=\"GoTool/image/add.png\" align=\"center\" /></form>";



  $display_close ="$form_id-$nonp$map_id <FORM  name=\"formcheck3\"  METHOD=\"POST\" ACTION=\"GoTool/$prog1?token=$tok&log=$logged\"><input type=\"hidden\" name=\"form_id\" value=\"$form_id\" /><input type=\"hidden\" name=\"agent\" value=\"$agent_id\" /><input type=\"hidden\" name=\"map_id\" value=\"$map_id\" size=\"40\" /><input type=\"hidden\" name=\"bod2\" value=\"$bod3\"  size=\"20\" /><input type=\"hidden\" name=\"gbad\" value=\"11\" size=\"40\" /><input type=\"hidden\" name=\"sbad\" value=\"0\" size=\"40\" /><input type=\"hidden\" name=\"gbadMod\" value=\"0\"  /><input type=\"hidden\" name=\"jedID2\" value=\"1\"  /><i>Acknowledge<input name=\"button name0\" type=\"image\" src=\"GoTool/image/add.png\" align=\"center\" /></form> ";

  if ($PO != $warnP){
$form_id=13;

$pieces= explode("-000", $PO,2);

$ellen=count($pieces);

if ($ellen==2){
      $form_id2=$pieces[0];
   $map_id2PO1=$pieces[1];


 $display_block44 ="$PO <FORM  name=\"formcheck3\"  METHOD=\"POST\" ACTION=\"GoTool/$prog?token=$tok&log=$logged\"><input type=\"hidden\" name=\"form_id\" value=\"$form_id2\" /><input type=\"hidden\" name=\"agent\" value=\"$agent_id\" /><input type=\"hidden\" name=\"map_id\" value=\"$map_id2\" size=\"40\" /><input type=\"hidden\" name=\"bod2\" value=\"105\"  size=\"20\" /><input type=\"hidden\" name=\"gbad\" value=\"0\" size=\"40\" /><input type=\"hidden\" name=\"sbad\" value=\"0\" size=\"40\" /><input type=\"hidden\" name=\"gbadMod\" value=\"0\"  /><input type=\"hidden\" name=\"jedID2\" value=\"6\"  /><i>Review Purchase Order <i><input name=\"button name0\" type=\"image\" src=\"GoTool/image/add.png\" align=\"center\" /></form>";
}

  }else{

  $display_block44 =$PO;
  }





//$list_formPR2[$i]='';
 // $boom2 .=" <tr><td>$display_block34</td><td>$money22</td><td>$vend</td><td>$display_block44</td></tr> ";
    $boom2 .=" <tr><td>$display_block34</td><td>$dateW</td><td>$money22</td><td>$vend1</td><td>$status2</td><td>$display_block44</td><td>$diplay_uploads</td><td>$display_closeC2</td></tr> ";

$i=$i+1;
}

for ($j=1; $j<$i; $j++) {
//$boom=$list_formPR2[$j];
}
$form_id2=1;
$list_formWH2 .="
<table><tr><td>

   <FORM  name=\"formcheck55\"  METHOD=\"POST\" ACTION=\"GoTool/$prog4?token=$tok&log=$logged\">
                   <input type=\"hidden\" name=\"jedID2\" value=\"1\"  />
  	<input type=\"hidden\" name=\"gbad\" value=\"\">
	<input type=\"hidden\" name=\"agent\" value=\"$hi2\">
<input type=\"submit\" value=\"Show All\" name=\"B3\">
              </form>    </td>  <td>
   <FORM  name=\"formcheck55\"  METHOD=\"POST\" ACTION=\"GoTool/$prog4?token=$tok&log=$logged\">
                   <input type=\"hidden\" name=\"jedID2\" value=\"1\"  />
  	<input type=\"hidden\" name=\"gbad\" value=\"1\">
	<input type=\"hidden\" name=\"agent\" value=\"$hi2\">
<input type=\"submit\" value=\"Show All Open\" name=\"B4\">
              </form>  </td></tr></table>






<table class=\"list\"> <thead> <tr><td class=\"filterable\">Review Form</td>
<td class=\"filterable\">DATE</td>
<td class=\"filterable\">AMOUNT</td>
<td class=\"filterable\">VENDOR</td>
<td class=\"filterable\">STATUS</td>
<td class=\"filterable\">Review PO</td>
<td>Attachment</td>
<td>Close</td>
</tr></thead>
<tr class=\"filter\">
<td align=\"left\"><input type=\"text\" name=\"filter_req\" value=\"\" size=\"3\" onkeyup=\"Table.filter(this,this)\"/></td>
<td align=\"left\"><input type=\"text\" name=\"filter_dt\" value=\"\" size=\"3\" onkeyup=\"Table.filter(this,this)\"/></td>

<td align=\"left\"><input type=\"text\" name=\"filter_am\" value=\"\" size=\"3\" onkeyup=\"Table.filter(this,this)\"/></td>
 <td align=\"left\"><input type=\"text\" name=\"filter_am1\" value=\"\" size=\"3\" onkeyup=\"Table.filter(this,this)\"/></td>
 <td align=\"left\"><input type=\"text\" name=\"filter_am2\" value=\"\" size=\"3\" onkeyup=\"Table.filter(this,this)\"/></td>
<td align=\"left\"><input type=\"text\" name=\"filter_create\" value=\"\" size=\"10\" onkeyup=\"Table.filter(this,this)\"/></td>
<td></td>  <td></td>
</tr><tbody>$boom2</tbody></table>";








 ///PO-PU-Warehouse         the second won

 $boom3='';

$sql33d ="SELECT * FROM $table_name98 WHERE form_id = '13' AND status>0  Order by create_date DESC  limit 5 ";
//$sql33d ="SELECT * FROM $table_name98 WHERE form_id = '13' AND status =3 Order by create_date DESC ";
$result33d = @mysql_query($sql33d,$connection) or die(mysql_error());
    while ($row22 = mysql_fetch_array($result33d)) {
          $map_id=  $row22['map_id'];
           $customer_id=  $row22['customer_id'];
            $company=  $row22['van4'];
             $agent_id44=  $row22['agent_id'];
             $orig_po=  $row22['lastname'];
              $commentPO=  stripslashes($row22['van55']);
                  $inv_date=  $row22['van54'] ;

$status= $row22['status'];
      if ($status==0 OR $status==99){
                $status2="Closed";
                }

if ($status==1){
                $status2="SUSPEND";
                }

if ($status==3 or $status==101){
                $status2="OPEN";
                }
if ($status==100){
                $status2="Complete";
                }

$poDate=$row22['create_date'];
$poDate=date("m/d/Y",strtotime($poDate));

 $diplay_uploads='';
$sql33dg ="SELECT DISTINCT file_name FROM $table_name104 WHERE map_id ='$map_id' Order by create_date Desc ";
 $result33dg = @mysql_query($sql33dg,$connection) or die(mysql_error());
 while ($row1 = mysql_fetch_array($result33dg)) {

      $file_E=  $row1['file_name'];

   $sql33r ="SELECT * FROM $table_name104 WHERE map_id ='$map_id' AND file_name='$file_E' limit 1 ";

  $result33r = @mysql_query($sql33r,$connection) or die(mysql_error());
        $row22r =mysql_fetch_array($result33r,MYSQL_ASSOC);
      $user_E=$row22r['user_id'];
      $create_date=$row22r['create_date'];

      $diplay_uploads.="<a href=\"$loc2/admin/GoTool/forms/forms_dep/$file_E\" target=\"blank\">$file_E</a><br/>";
 }



 $diplay_uploads=$diplay_uploads;

if($diplay_uploads==$blink){
$diplay_uploads="NA";
}


 $sq112ab="SELECT * FROM $table_name49 WHERE user_id='$agent_id44' ";
$result33db = @mysql_query($sq112ab,$connection) or die(mysql_error());
$row112ab =mysql_fetch_array($result33db,MYSQL_ASSOC);
   $U_userfirstN=$row112ab['firstname'];
  $U_userlastN=$row112ab['lastname'];
$namey="$U_userfirstN $U_userlastN";

//$agent_name= $U_username[$agent_id44];
              $money22= $row22['van17'];
               $vend= $row22['van4'];
$vend=trim($vend);
                //$money22= number_format($row22['van18'],2);
                $money22= $row22['van18'];
                $money22 = str_replace("$", '', $money22);
                $money22=trim($money22);

                //$money22 = preg_replace('$", "", $money22);
              //  $money22 = preg_replace(" ", "", $money22);
                $due= $row22['van7'];
$PRnm= $row22['van2'];
                $PO1="13-000$map_id";

$NA="NA";
if ($PRnm==$blink){
$PRnm="NA";
}



$sql33e ="SELECT * FROM $table_name98 WHERE form_id = '1' AND  van3='$PO1'";
 $result33e = @mysql_query($sql33e,$connection) or die(mysql_error());
     $row2 =mysql_fetch_array($result33e,MYSQL_ASSOC);
$deldate=  $row2['van10'];

$warehouse=$row2['map_id'];

       $Rtoday=date("Y-m-d h:i:s");

        $paydue= strtotime("$deldate + $due days");

         $dayaway2=number_format(($paydue-$Rtoday)/3600/24,0);
        $dayaway=($paydue-$Rtoday)/3600/24;

       // $dayaway=0;

        if ($dayaway<10){
        $colcell="<img border=\"0\" src=\"GoTool/image/red.png\" ><img border=\"0\" src=\"GoTool/image/red.png\" >" ;   //red
        }
         if ($dayaway>9 AND $dayaway<30){
        $colcell="<img border=\"0\" src=\"GoTool/image/yellow.png\" ><img border=\"0\" src=\"GoTool/image/yellow.png\" >";   //yellow
        }

        if ($dayaway>29){
        $colcell="<img border=\"0\" src=\"GoTool/image/green.png\" ><img border=\"0\" src=\"GoTool/image/green.png\" > ";  ///green
        }


        if($dayaway > 100){
        $dayaway22="NA";
        }else{
        $dayaway22=$dayaway2;
        }

     $crit="<img border=\"0\" src=\"GoTool/image/green.png\">: 30 days or more to pay <img border=\"0\" src=\"GoTool/image/yellow.png\" >: 15-30 days to pay  <img border=\"0\" src=\"GoTool/image/red.png\" >: Less than 10 days to pay";

        $diplay_uploads='';
$sql33dr ="SELECT DISTINCT file_name FROM $table_name104 WHERE map_id ='$warehouse' Order by create_date Desc ";
 $result33dr = @mysql_query($sql33dr,$connection) or die(mysql_error());
 while ($row1 = mysql_fetch_array($result33dr)) {

      $file_E=  $row1['file_name'];

   $sql33r ="SELECT * FROM $table_name104 WHERE map_id ='$warehouse' AND file_name='$file_E' limit 1 ";

  $result33r = @mysql_query($sql33r,$connection) or die(mysql_error());
        $row22r =mysql_fetch_array($result33r,MYSQL_ASSOC);
      $user_E=$row22r['user_id'];
      $create_date=$row22r['create_date'];

      $diplay_uploads.="<a href=\"$loc2/admin/GoTool/forms/forms_dep/$file_E\" target=\"blank\">$file_E</a><br />";
 }


 $diplay_uploads=$diplay_uploads;

if($diplay_uploads==$blink){
$diplay_uploads="NA";
}



$i=1;

 $display_block44W ="1-0000$warehouse <FORM  name=\"formcheck3\"  METHOD=\"POST\" ACTION=\"GoTool/$prog?token=$tok&log=$logged\"><input type=\"hidden\" name=\"form_id\" value=\"1\" /><input type=\"hidden\" name=\"agent\" value=\"$agent_id\" /><input type=\"hidden\" name=\"map_id\" value=\"$warehouse\" size=\"40\" /><input type=\"hidden\" name=\"bod2\" value=\"105\"  size=\"20\" /><input type=\"hidden\" name=\"gbad\" value=\"0\" size=\"40\" /><input type=\"hidden\" name=\"sbad\" value=\"0\" size=\"40\" /><input type=\"hidden\" name=\"gbadMod\" value=\"0\"  /><input type=\"hidden\" name=\"jedID2\" value=\"6\"  /><input name=\"button name0\" type=\"image\" src=\"GoTool/image/add.png\" align=\"center\" /></form>";


        if($deldate==$blink){
        $colcell="Not Delivered - Do Not Close<br/><img border=\"0\" src=\"GoTool/image/red.png\" ><img border=\"0\" src=\"GoTool/image/red.png\" >";
$display_block44W="No Warehouse Entry";
        }else{
       $colcell="Delivered - OK To Close<br/> <img border=\"0\" src=\"GoTool/image/green.png\" ><img border=\"0\" src=\"GoTool/image/green.png\" >";
        }



$form_id=13;
 $display_block34 ="$form_id-$nonp$map_id
<FORM  name=\"formcheck3\"  METHOD=\"POST\" ACTION=\"GoTool/$prog?token=$tok&log=$logged\"><input type=\"hidden\" name=\"form_id\" value=\"13\" /><input type=\"hidden\" name=\"agent\" value=\"$agent_id\" /><input type=\"hidden\" name=\"map_id\" value=\"$map_id\" size=\"40\" /><input type=\"hidden\" name=\"bod2\" value=\"105\"  size=\"20\" /><input type=\"hidden\" name=\"gbad\" value=\"0\" size=\"40\" /><input type=\"hidden\" name=\"sbad\" value=\"0\" size=\"40\" /><input type=\"hidden\" name=\"gbadMod\" value=\"0\"  /><input type=\"hidden\" name=\"jedID2\" value=\"6\"  /><i>View <i><input name=\"button name0\" type=\"image\" src=\"GoTool/image/add.png\" align=\"center\" /></form>


";



 // $display_close ="$form_id-$nonp$map_id <FORM  name=\"formcheck3\"  METHOD=\"POST\" ACTION=\"GoTool/$prog1?token=$tok&log=$logged\"><input type=\"hidden\" name=\"form_id\" value=\"$form_id\" /><input type=\"hidden\" name=\"agent\" value=\"$agent_id\" /><input type=\"hidden\" name=\"map_id\" value=\"$map_id\" size=\"40\" /><input type=\"hidden\" name=\"bod2\" value=\"$bod3\"  size=\"20\" /><input type=\"hidden\" name=\"gbad\" value=\"11\" size=\"40\" /><input type=\"hidden\" name=\"sbad\" value=\"0\" size=\"40\" /><input type=\"hidden\" name=\"gbadMod\" value=\"0\"  /><input type=\"hidden\" name=\"jedID2\" value=\"1\"  /><i>Acknowledge<input name=\"button name0\" type=\"image\" src=\"GoTool/image/add.png\" align=\"center\" /></form> ";

   $display_close ="Disable $form_id-$nonp$map_id <FORM  name=\"formcheck3\"  METHOD=\"POST\" ACTION=\"GoTool/$prog5?token=$tok&log=$logged\"><input type=\"hidden\" name=\"form_id\" value=\"$form_id\" /><input type=\"hidden\" name=\"agent\" value=\"$agent_id\" /><input type=\"hidden\" name=\"map_id\" value=\"$map_id\" size=\"40\" /><input type=\"hidden\" name=\"bod2\" value=\"$bod3\"  size=\"20\" /><input type=\"text\" name=\"sbadc\"  size=\"20\" /><input type=\"hidden\" name=\"gbad\" value=\"11\" size=\"40\" /><input type=\"hidden\" name=\"gbadMod\" value=\"0\"  /><input type=\"hidden\" name=\"jedID2\" value=\"11\"  /><i><input name=\"button name0\" type=\"image\" src=\"GoTool/image/add.png\" align=\"center\" /></form>
   <br/>Suspend/Return $form_id-$nonp$map_id <FORM  name=\"formcheck3\"  METHOD=\"POST\" ACTION=\"GoTool/$prog5?token=$tok&log=$logged\"><input type=\"hidden\" name=\"form_id\" value=\"$form_id\" /><input type=\"hidden\" name=\"agent\" value=\"$agent_id\" />
   <select name=\"gbad\">
   <option value=\"1\">Choose where to return form</option>
     $display_listNotSup1
   </select>
   <input type=\"hidden\" name=\"map_id\" value=\"$map_id\" size=\"40\" /><input type=\"hidden\" name=\"bod2\" value=\"$bod3\"  size=\"20\" /><input type=\"text\" name=\"sbadc\"  size=\"20\" /><input type=\"hidden\" name=\"gbadr\" value=\"1\" size=\"40\" /><input type=\"hidden\" name=\"gbadMod\" value=\"5\"  /><input type=\"hidden\" name=\"jedID2\" value=\"11\"  /><i><input name=\"button name0\" type=\"image\" src=\"GoTool/image/add.png\" align=\"center\" /></form>

 <br/><FORM  name=\"formcheck3\"  METHOD=\"POST\" ACTION=\"GoTool/$prog5?token=$tok&log=$logged\">Approve $form_id-$nonp$map_id <input type=\"hidden\" name=\"form_id\" value=\"$form_id\" /><input type=\"hidden\" name=\"agent\" value=\"$agent_id\" /><input type=\"hidden\" name=\"map_id\" value=\"$map_id\" size=\"40\" /><input type=\"hidden\" name=\"bod2\" value=\"$bod3\"  size=\"20\" /><input type=\"hidden\" name=\"sbadc\"  size=\"20\" /><input type=\"hidden\" name=\"gbad\" value=\"101\" size=\"40\" /><input type=\"hidden\" name=\"gbadMod\" value=\"0\"  /><input type=\"hidden\" name=\"jedID2\" value=\"11\"  /><i><input name=\"button name0\" type=\"image\" src=\"GoTool/image/add.png\" align=\"center\" /></form>

  <br/> <FORM  name=\"formcheck3\"  METHOD=\"POST\" ACTION=\"GoTool/$prog5?token=$tok&log=$logged\">Completed $form_id-$nonp$map_id<input type=\"hidden\" name=\"form_id\" value=\"$form_id\" /><input type=\"hidden\" name=\"agent\" value=\"$agent_id\" /><input type=\"hidden\" name=\"map_id\" value=\"$map_id\" size=\"40\" /><input type=\"hidden\" name=\"bod2\" value=\"$bod3\"  size=\"20\" /><input type=\"hidden\" name=\"sbad\"  size=\"20\" /><input type=\"hidden\" name=\"gbad\" value=\"100\" size=\"40\" /><input type=\"hidden\" name=\"gbadMod\" value=\"0\"  /><input type=\"hidden\" name=\"jedID2\" value=\"11\"  /><i><input name=\"button name0\" type=\"image\" src=\"GoTool/image/add.png\" align=\"center\" /></form>

      </form> ";


      $display_close ="<FORM  name=\"formcheck3\"  METHOD=\"POST\" ACTION=\"GoTool/$prog5?token=$tok&log=$logged\">Cancel $form_id-$nonp$map_id <input type=\"hidden\" name=\"form_id\" value=\"$form_id\" /><input type=\"hidden\" name=\"agent\" value=\"$agent_id\" /><input type=\"hidden\" name=\"map_id\" value=\"$map_id\" size=\"40\" /><input type=\"hidden\" name=\"bod2\" value=\"$bod3\"  size=\"20\" /><input type=\"text\" name=\"sbadc\"  size=\"20\" /><input type=\"hidden\" name=\"gbad\" value=\"11\" size=\"40\" /><input type=\"hidden\" name=\"gbadMod\" value=\"0\"  /><input type=\"hidden\" name=\"jedID2\" value=\"11\"  /><i><input name=\"button name0\" type=\"image\" src=\"GoTool/image/add.png\" align=\"center\" /></form>
   <br/>

<FORM  name=\"formcheck3\"  METHOD=\"POST\" ACTION=\"GoTool/$prog5?token=$tok&log=$logged\">Add Note for Purchasing $form_id-$nonp$map_id <input type=\"hidden\" name=\"form_id\" value=\"$form_id\" /><input type=\"hidden\" name=\"agent\" value=\"$agent_id\" /><input type=\"hidden\" name=\"map_id\" value=\"$map_id\" size=\"40\" /><input type=\"hidden\" name=\"bod2\" value=\"$bod3\"  size=\"20\" /><input type=\"text\" name=\"sbadc\"  size=\"20\" /><input type=\"hidden\" name=\"gbad\" value=\"1100\" size=\"40\" /><input type=\"hidden\" name=\"gbadMod\" value=\"0\"  /><input type=\"hidden\" name=\"jedID2\" value=\"11\"  /><i><input name=\"button name0\" type=\"image\" src=\"GoTool/image/add.png\" align=\"center\" /></form>
   <br/>

<FORM  name=\"formcheck3\"  METHOD=\"POST\" ACTION=\"GoTool/$prog5?token=$tok&log=$logged\">ADD Invoice # <input type=\"text\" name=\"invoice\"  /><br/> Amount Paid<input type=\"text\" name=\"amount\"  /> <input type=\"hidden\" name=\"form_id\" value=\"$form_id\" /><input type=\"hidden\" name=\"agent\" value=\"$agent_id\" /><input type=\"hidden\" name=\"map_id\" value=\"$map_id\" size=\"40\" /><input type=\"hidden\" name=\"bod2\" value=\"$bod3\"  size=\"20\" /><input type=\"hidden\" name=\"sbadcR\"  size=\"20\" /><input type=\"hidden\" name=\"gbad\" value=\"1100\" size=\"40\" /><input type=\"hidden\" name=\"gbadMod\" value=\"0\"  /><input type=\"hidden\" name=\"jedID2\" value=\"11\"  /><i><input name=\"button name0\" type=\"image\" src=\"GoTool/image/add.png\" align=\"center\" /></form>
   <br/>


 <br/><FORM  name=\"formcheck3\"  METHOD=\"POST\" ACTION=\"GoTool/$prog5?token=$tok&log=$logged\">Approve Send to Purchasing $form_id-$nonp$map_id <input type=\"hidden\" name=\"form_id\" value=\"$form_id\" /><input type=\"hidden\" name=\"agent\" value=\"$agent_id\" /><input type=\"hidden\" name=\"map_id\" value=\"$map_id\" size=\"40\" /><input type=\"hidden\" name=\"bod2\" value=\"$bod3\"  size=\"20\" /><input type=\"hidden\" name=\"sbadc\"  size=\"20\" /><input type=\"hidden\" name=\"gbad\" value=\"105\" size=\"40\" /><input type=\"hidden\" name=\"gbadMod\" value=\"0\"  /><input type=\"hidden\" name=\"jedID2\" value=\"11\"  /><i><input name=\"button name0\" type=\"image\" src=\"GoTool/image/add.png\" align=\"center\" /></form>
";



  if ($PO != $warnP){
$form_id=13;
$pieces= explode("-000", $PO,2);

$ellen=count($pieces);

if ($ellen==2){
      $form_id2=$pieces[0];
   $map_id2PO1=$pieces[1];


 $display_block44 ="$PO <FORM  name=\"formcheck3\"  METHOD=\"POST\" ACTION=\"GoTool/$prog?token=$tok&log=$logged\"><input type=\"hidden\" name=\"form_id\" value=\"$form_id2\" /><input type=\"hidden\" name=\"agent\" value=\"$agent_id\" /><input type=\"hidden\" name=\"map_id\" value=\"$map_id2PO1\" size=\"40\" /><input type=\"hidden\" name=\"bod2\" value=\"105\"  size=\"20\" /><input type=\"hidden\" name=\"gbad\" value=\"0\" size=\"40\" /><input type=\"hidden\" name=\"sbad\" value=\"0\" size=\"40\" /><input type=\"hidden\" name=\"gbadMod\" value=\"0\"  /><input type=\"hidden\" name=\"jedID2\" value=\"6\"  /><i>Review Purchase Order <i><input name=\"button name0\" type=\"image\" src=\"GoTool/image/add.png\" align=\"center\" /></form>";

}

  }else{

  $display_block44 =$PO;
  }


 if ($PRnm != $NA AND $PRnm != $blink){
$form_id=11;
$pieces= explode("-000", $PRnm,2);
$ellen=1;
$ellen1=count($pieces);

if ($ellen1==2){
      $form_id2=$pieces[0];
   $map_id2PRnm1=$pieces[1];

$display_block44PR1 ="$PRnm <FORM  name=\"formcheck3\"  METHOD=\"POST\" ACTION=\"GoTool/$prog?token=$tok&log=$logged\"><input type=\"hidden\" name=\"form_id\" value=\"$form_id2\" /><input type=\"hidden\" name=\"agent\" value=\"$agent_id\" /><input type=\"hidden\" name=\"map_id\" value=\"$map_id2PRnm1\" size=\"40\" /><input type=\"hidden\" name=\"bod2\" value=\"105\"  size=\"20\" /><input type=\"hidden\" name=\"gbad\" value=\"0\" size=\"40\" /><input type=\"hidden\" name=\"sbad\" value=\"0\" size=\"40\" /><input type=\"hidden\" name=\"gbadMod\" value=\"0\"  /><input type=\"hidden\" name=\"jedID2\" value=\"6\"  /><i>View <i><input name=\"button name0\" type=\"image\" src=\"GoTool/image/add.png\" align=\"center\" /></form>";

$diplay_uploads='';

$sql33dx ="SELECT DISTINCT file_name FROM $table_name104 WHERE map_id ='$map_id2PRnm1' Order by create_date Desc ";
 $result33dx = @mysql_query($sql33dx,$connection) or die(mysql_error());
 while ($row1 = mysql_fetch_array($result33dx)) {

      $file_E=  $row1['file_name'];

   $sql33r ="SELECT * FROM $table_name104 WHERE map_id ='$map_id2PRnm1' AND file_name='$file_E' limit 1 ";

  $result33r = @mysql_query($sql33r,$connection) or die(mysql_error());
        $row22r =mysql_fetch_array($result33r,MYSQL_ASSOC);
      $user_E=$row22r['user_id'];
      $create_date=$row22r['create_date'];

      $diplay_uploads.="<a href=\"$loc2/admin/GoTool/forms/forms_dep/$file_E\" target=\"blank\">$file_E</a><br/>";
 }

}}else{


  $display_block44PR1 =$PRnm;
  }


$diplay_uploads=$diplay_uploads;

if($diplay_uploads==$blink){
$diplay_uploads="NA";
}


//$list_formPR2[$i]='';
  $boom3 .=" <tr><td>$display_block34</td><td>$status2</td><td>$poDate</td><td>$orig_po</td><td>$display_block44W</td><td>$display_block44PR1</td><td>$namey</td><td>$money22</td><td>$vend</td><td>$deldate</td><td>$commentPO</td><td>$inv_date</td><td>$diplay_uploads</td><td>$display_close</td></tr> ";

$i=$i+1;
}

for ($j=1; $j<$i; $j++) {
//$boom=$list_formPR2[$j];
}
$form_id2=13;
$list_formPO2D .="

<table><tr><td>

   <FORM  name=\"formcheck55\"  METHOD=\"POST\" ACTION=\"GoTool/$prog5?token=$tok&log=$logged\">
                   <input type=\"hidden\" name=\"jedID2\" value=\"1\"  />
  	<input type=\"hidden\" name=\"gbad\" value=\"\">
	<input type=\"hidden\" name=\"agent\" value=\"$hi2\">
<input type=\"submit\" value=\"Show All\" name=\"B3\">
              </form>    </td>  <td>
   <FORM  name=\"formcheck55\"  METHOD=\"POST\" ACTION=\"GoTool/$prog5?token=$tok&log=$logged\">
                   <input type=\"hidden\" name=\"jedID2\" value=\"1\"  />
  	<input type=\"hidden\" name=\"gbad\" value=\"1\">
	<input type=\"hidden\" name=\"agent\" value=\"$hi2\">
<input type=\"submit\" value=\"Show All Open\" name=\"B4\">
              </form>  </td></tr></table>


<table class=\"sortable\" id=\"pop\"> <thead> <tr><td class=\"filterable\">PO</td>
<td class=\"filterable\">PO Status</td>
<td class=\"filterable\">PO Origin</td>
<td class=\"filterable\">Original #</td>
<td class=\"filterable\">Warehouse Entry</td>
<td class=\"filterable\">Purchase Request</td>
<td class=\"filterable\">Requester</td>
<td class=\"filterable\">AMOUNT</td>
<td class=\"filterable\">VENDOR</td>
<td class=\"filterable\">Delivery Date</td>


<td class=\"filterable\">Comment</td>
<td class=\"filterable\">Invoice: Date Paid & Amount</td>
<td class=\"filterable\">Attachments</td>
<td></td>
</tr></thead> <tbody>
<tr class=\"filter\">
<td align=\"left\"><input type=\"text\" name=\"filter_req\" value=\"\" size=\"9\" onkeyup=\"Table.filter(this,this)\"/></td>
<td align=\"left\"><input type=\"text\" name=\"filter_reqORs2\" value=\"\" size=\"9\" onkeyup=\"Table.filter(this,this)\"/></td>
<td align=\"left\"><input type=\"text\" name=\"filter_reqPSs2\" value=\"\" size=\"9\" onkeyup=\"Table.filter(this,this)\"/></td>
<td align=\"left\"><input type=\"text\" name=\"filter_req2\" value=\"\" size=\"9\" onkeyup=\"Table.filter(this,this)\"/></td>
<td align=\"left\"><input type=\"text\" name=\"filter_req2a\" value=\"\" size=\"9\" onkeyup=\"Table.filter(this,this)\"/></td>

<td align=\"left\"><input type=\"text\" name=\"filter_PR3\" value=\"\" size=\"9\" onkeyup=\"Table.filter(this,this)\"/></td>
<td align=\"left\"><input type=\"text\" name=\"filter_requestor3\" value=\"\" size=\"3\" onkeyup=\"Table.filter(this,this)\"/></td>
<td align=\"left\"><input type=\"text\" name=\"filter_req3\" value=\"\" size=\"3\" onkeyup=\"Table.filter(this,this)\"/></td>
<td align=\"left\"><input type=\"text\" name=\"filter_req4\" value=\"\" size=\"3\" onkeyup=\"Table.filter(this,this)\"/></td>
<td align=\"left\"><input type=\"text\" name=\"filter_req4a\" value=\"\" size=\"3\" onkeyup=\"Table.filter(this,this)\"/></td>
<td align=\"left\"><input type=\"text\" name=\"filter_req5\" value=\"\" size=\"9\" onkeyup=\"Table.filter(this,this)\"/></td>
<td align=\"left\"><input type=\"text\" name=\"filter_req5a\" value=\"\" size=\"9\" onkeyup=\"Table.filter(this,this)\"/></td>


<td align=\"left\"><input type=\"text\" name=\"filter_req8\" value=\"\" size=\"3\" onkeyup=\"Table.filter(this,this)\"/></td>
<td></td>


</tr>$boom3</tbody></table>";















  //Warranty Claims


 $boom2='';

  $sql33d ="SELECT * FROM $table_name98 WHERE form_id = '17' AND status =100 limit 5 ";
$result33d = @mysql_query($sql33d,$connection) or die(mysql_error());
    while ($row22 = mysql_fetch_array($result33d)) {
          $map_id=  $row22['map_id'];
          $warranty=$map_id;
           $customer_id=  $row22['customer_id'];
            $company=  $row22['van4'];
              $createD=  $row22['create_date'];
                $createD = date("m/d/Y h:i:s", strtotime($createD));
             $agent_id=  $row22['agent_id'];
             $mach_hours= $row22['van18'];
             $prob= $row22['van40'];
             $date_rep= $row22['van20'];
            //  $date_serv= $row22['van5'];
              $serialNum= $row22['van17'];
               $prod= $row22['van15'];
               $mod= $row22['van16'];
               $prob= $row22['van40'];
                $amount=number_format( $row22['van27'],2);


                                $status= $row22['status'];
      if ($status==0 OR $status==99){
                $status2="Closed";
                }

if ($status==3){
                $status2="OPEN";
                }
if ($status==100){
                $status2="Approved";
                }


//$sql33e ="SELECT * FROM $table_name98 WHERE form_id = '13' AND status =3 AND van1='$PO'";
// $result33e = @mysql_query($sql33e,$connection) or die(mysql_error());
 //     $row2 =mysql_fetch_array($result33e,MYSQL_ASSOC);

 //         $map_id2=  $row2['map_id'];

$i=1;

$form_id=17;
 $display_block34 ="$form_id-$nonp$map_id <FORM  name=\"formcheck3\"  METHOD=\"POST\" ACTION=\"GoTool/$prog?token=$tok&log=$logged\"><input type=\"hidden\" name=\"form_id\" value=\"$form_id\" /><input type=\"hidden\" name=\"agent\" value=\"$agent_id\" /><input type=\"hidden\" name=\"map_id\" value=\"$map_id\" size=\"40\" /><input type=\"hidden\" name=\"bod2\" value=\"$bod3\"  size=\"20\" /><input type=\"hidden\" name=\"gbad\" value=\"0\" size=\"40\" /><input type=\"hidden\" name=\"sbad\" value=\"0\" size=\"40\" /><input type=\"hidden\" name=\"gbadMod\" value=\"0\"  /><input type=\"hidden\" name=\"jedID2\" value=\"6\"  /><i>View<i><input name=\"button name0\" type=\"image\" src=\"GoTool/image/add.png\" align=\"center\" /></form>";



  $display_close ="$form_id-$nonp$map_id <FORM  name=\"formcheck3\"  METHOD=\"POST\" ACTION=\"GoTool/$prog1?token=$tok&log=$logged\"><input type=\"hidden\" name=\"form_id\" value=\"$form_id\" /><input type=\"hidden\" name=\"agent\" value=\"$agent_id\" /><input type=\"hidden\" name=\"map_id\" value=\"$map_id\" size=\"40\" /><input type=\"hidden\" name=\"bod2\" value=\"$bod3\"  size=\"20\" /><input type=\"hidden\" name=\"gbad\" value=\"11\" size=\"40\" /><input type=\"hidden\" name=\"sbad\" value=\"0\" size=\"40\" /><input type=\"hidden\" name=\"gbadMod\" value=\"0\"  /><input type=\"hidden\" name=\"jedID2\" value=\"1\"  /><i>Approve<input name=\"button name0\" type=\"image\" src=\"GoTool/image/add.png\" align=\"center\" /></form> <br/>
  $form_id-$nonp$map_id <FORM  name=\"formcheck3\"  METHOD=\"POST\" ACTION=\"GoTool/$prog1?token=$tok&log=$logged\"><input type=\"hidden\" name=\"form_id\" value=\"$form_id\" /><input type=\"hidden\" name=\"agent\" value=\"$agent_id\" /><input type=\"hidden\" name=\"map_id\" value=\"$map_id\" size=\"40\" /><input type=\"hidden\" name=\"bod2\" value=\"$bod3\"  size=\"20\" /><input type=\"hidden\" name=\"gbad\" value=\"11\" size=\"40\" /><input type=\"hidden\" name=\"sbad\" value=\"0\" size=\"40\" /><input type=\"hidden\" name=\"gbadMod\" value=\"0\"  /><input type=\"hidden\" name=\"jedID2\" value=\"1\"  /><i>Reject<input name=\"button name0\" type=\"image\" src=\"GoTool/image/add.png\" align=\"center\" /></form> ";


//$form_id=13;
// $display_block44 ="$PO <FORM  name=\"formcheck3\"  METHOD=\"POST\" ACTION=\"GoTool/$prog?token=$tok&log=$logged\"><input type=\"hidden\" name=\"form_id\" value=\"$form_id\" /><input type=\"hidden\" name=\"agent\" value=\"$agent_id\" /><input type=\"hidden\" name=\"map_id\" value=\"$map_id2\" size=\"40\" /><input type=\"hidden\" name=\"bod2\" value=\"$bod3\"  size=\"20\" /><input type=\"hidden\" name=\"gbad\" value=\"0\" size=\"40\" /><input type=\"hidden\" name=\"sbad\" value=\"0\" size=\"40\" /><input type=\"hidden\" name=\"gbadMod\" value=\"0\"  /><input type=\"hidden\" name=\"jedID2\" value=\"6\"  /><i>Match Purchase Order :Submitted by User: $agent_id <i><input name=\"button name0\" type=\"image\" src=\"GoTool/image/add.png\" align=\"center\" /></form>";

      $diplay_uploads='';

$sql33dr ="SELECT DISTINCT file_name FROM $table_name104 WHERE map_id ='$warranty' Order by create_date Desc ";
 $result33dr = @mysql_query($sql33dr,$connection) or die(mysql_error());
 while ($row1 = mysql_fetch_array($result33dr)) {

      $file_E=  $row1['file_name'];

   $sql33r ="SELECT * FROM $table_name104 WHERE map_id ='$warranty' AND file_name='$file_E' limit 1 ";

  $result33r = @mysql_query($sql33r,$connection) or die(mysql_error());
        $row22r =mysql_fetch_array($result33r,MYSQL_ASSOC);
      $user_E=$row22r['user_id'];
      $create_date=$row22r['create_date'];

      $diplay_uploads.="<a href=\"$loc2/admin/GoTool/forms/forms_dep/$file_E\" target=\"blank\">$file_E</a><br />";
 }


 $diplay_uploads=$diplay_uploads;

if($diplay_uploads==$blink){
$diplay_uploads="NA";
}

   $display_closeC2 ="17-$nonp$map_id <FORM  name=\"formcheck3\"  METHOD=\"POST\" ACTION=\"GoTool/$prog5?token=$tok&log=$logged\"><input type=\"hidden\" name=\"form_id\" value=\"$form_id\" /><input type=\"hidden\" name=\"agent\" value=\"$agent_id\" /><input type=\"hidden\" name=\"map_id\" value=\"$map_id\" size=\"40\" /><input type=\"hidden\" name=\"bod2\" value=\"$bod3\"  size=\"20\" /><input type=\"hidden\" name=\"sbad\"  size=\"20\" /><input type=\"hidden\" name=\"gbad\" value=\"200\" size=\"40\" /><input type=\"hidden\" name=\"sbad\" value=\"0\" size=\"40\" /><input type=\"hidden\" name=\"gbadMod\" value=\"0\"  /><input type=\"hidden\" name=\"jedID2\" value=\"11\"  /><i>Close Claim,Processed <input name=\"button name0\" type=\"image\" src=\"GoTool/image/add.png\" align=\"center\" /></form> ";


 $cred1="  <a href=\"$loc2/admin/index.php?route=GoTool/forms&amp;token=$tok&log=$logged&fid=8&bod2=55\">Credit Memo</a> ";


//$list_formPR2[$i]='';
  $boom2 .=" <tr><td>$display_block34</td><td>$customer_id</td><td>$company</td><td>$createD</td><td>$status2</td><td>$prod</td><td>$mod</td><td>$amount</td><td>$diplay_uploads</td><td>$cred1</td><td>$display_closeC2</td></tr> ";
$i=$i+1;
}

for ($j=1; $j<$i; $j++) {
//$boom=$list_formPR2[$j];
}

$list_formWAR .="
   <table><tr><td>

   <FORM  name=\"formcheck55\"  METHOD=\"POST\" ACTION=\"GoTool/$prog4?token=$tok&log=$logged\">
                   <input type=\"hidden\" name=\"jedID2\" value=\"2\"  />
  	<input type=\"hidden\" name=\"gbad\" value=\"\">
	<input type=\"hidden\" name=\"agent\" value=\"$hi2\">
<input type=\"submit\" value=\"Show All\" name=\"B3\">
              </form>    </td>  <td>
   <FORM  name=\"formcheck55\"  METHOD=\"POST\" ACTION=\"GoTool/$prog4?token=$tok&log=$logged\">
                   <input type=\"hidden\" name=\"jedID5\" value=\"2\"  />
  	<input type=\"hidden\" name=\"gbad\" value=\"1\">
	<input type=\"hidden\" name=\"agent\" value=\"$hi2\">
<input type=\"submit\" value=\"Show All Open\" name=\"B4\">
              </form>  </td></tr></table>



<table class=\"list\"> <thead> <tr><td class=\"filterable\">OPEN REQUESTS</td>
<td class=\"filterable\">Dealer ID</td>
<td class=\"filterable\">Dealer</td>
<td class=\"filterable\">Date</td>
<td class=\"filterable\">Status</td>
<td class=\"filterable\">Product</td>
<td class=\"filterable\">Model</td>
<td class=\"filterable\">Amount</td>
<td>Attachments</td>
<td>Issue Credit Memo</td>
<td> Close Warranty Claim</td>
</tr></thead>
<tr class=\"filter\">
<td align=\"right\"><input type=\"text\" name=\"filter_req\" value=\"\" size=\"3\" onkeyup=\"Table.filter(this,this)\"/></td>
<td align=\"right\"><input type=\"text\" name=\"filter_d\" value=\"\" size=\"3\" onkeyup=\"Table.filter(this,this)\"/></td>
<td align=\"right\"><input type=\"text\" name=\"filter_dd1\" value=\"\" size=\"3\" onkeyup=\"Table.filter(this,this)\"/></td>
<td align=\"right\"><input type=\"text\" name=\"filter_dd12\" value=\"\" size=\"3\" onkeyup=\"Table.filter(this,this)\"/></td>

<td align=\"right\"><input type=\"text\" name=\"filter_dd\" value=\"\" size=\"3\" onkeyup=\"Table.filter(this,this)\"/></td>
<td align=\"right\"><input type=\"text\" name=\"filter_prod\" value=\"\" size=\"3\" onkeyup=\"Table.filter(this,this)\"/></td>
<td align=\"right\"><input type=\"text\" name=\"filter_mod\" value=\"\" size=\"3\" onkeyup=\"Table.filter(this,this)\"/></td>

<td align=\"right\"><input type=\"text\" name=\"filter_amt\" value=\"\" size=\"3\" onkeyup=\"Table.filter(this,this)\"/></td>
   <td></td>      <td></td>  <td></td>
</tr><tbody>$boom2</tbody></table>";










  $heading_title="Accounting";

     $display_block_call=''; //use for special announcements

    $display_block_call55 .="




    <img border=\"0\" src=\"$loc2/admin/GoTool/forms/fill/Sany_horiz_logo.png\" width=\"230\" height=\"67\"> <br/>

     <h3 class=\"collapsible\" id=\"section1\">$sec_title1<span></span><h3>
<div class=\"container\">
    <div class=\"content\">

    <table><tr><td width=\"450\">$display_overview</td> <td width=\"450\">$display_notices</td></tr></table>


    </div>
</div>

  <h3 class=\"collapsible\" id=\"section2\">Last 5 Purchase Orders Approved/Filled<span></span><h3>
<div class=\"container\">
    <div class=\"content\">

$list_formPO2

$list_formPO2D


    </div>
</div>

  <h3 class=\"collapsible\" id=\"section3\">Last 5 Approved Warehouse Entries<span></span><h3>
<div class=\"container\">
    <div class=\"content\">

  $list_formWH2


    </div>
</div>

  <h3 class=\"collapsible\" id=\"section2\">Last 5 Warranty Claims Approved. Ready to Issue Credit<span></span><h3>
<div class=\"container\">
    <div class=\"content\">

$list_formWAR


    </div>
</div>






<h3 class=\"collapsible\" id=\"section6\">$sec_title6<span></span><h3>
<div class=\"container\">
    <div class=\"content\">

        <p>$display_forms</p>
    </div>
</div>


    ";
  







$tabby.="<div class=\"vtabs\"><a href=\"#tab-stat\">Statistics</a><a href=\"#tab-notices\">Latest Notices</a>
<a href=\"#tab-links\">Quick Links</a></div>";

$tabby="";

$tabby.="<div class=\"vtabs\"><a href=\"#tab-stat\">Statistics</a><a href=\"#tab-notices0\">Latest Sales</a><a href=\"#tab-notices1\">Latest Backorders</a> <a href=\"#tab-notices\">Latest Notices</a>
<a href=\"#tab-links\">Quick Links</a></div>";


$display_sales0.="
<div class=\"dashboard-heading\">$text_latest_10_orders</div>
        <div class=\"dashboard-content\">
<table class=\"list\">
            <thead>
              <tr>
                <td class=\"right\">$column_order</td>
                <td class=\"left\">$column_customer</td>
                <td class=\"left\">$column_status</td>
                <td class=\"left\">$column_date_added</td>
                <td class=\"right\">$column_total</td>
                <td class=\"right\">$column_action</td>
              </tr>
            </thead>
            <tbody> ;"










?>



