Location: PHPKode > projects > Simple E-document > simple_e_document_v_1_3/main_in.php
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>simple e-document</title>
<style type="text/css">
<!--
.style7 {font-family: Verdana, Arial, Helvetica, sans-serif; font-size: x-small; }
-->
</style>
</head>
<body class="style7">
<?php


if (($_COOKIE['access'] == "1") ||  ($_COOKIE['access'] == "2") || ($_COOKIE['access'] == "3")){

include("settings.php");
include("header_in.php");
$dbc = mysql_connect($databasehost, $databaseuname, $databasepass, $databasename);
$dbcs = mysql_select_db($databasename,$dbc);


if(!isset($_POST['op'])) $_POST['op']='';
if(!isset($op)) $op='';
if(!isset($_POST['Search_For'])) $_POST['Search_For']='';
if(!isset($_POST['Search_For1'])) $_POST['Search_For1']='';
if(!isset($_POST['IN_Document_Search_Day1'])) $_POST['IN_Document_Search_Day1']='';
if(!isset($_POST['IN_Document_Search_Month1'])) $_POST['IN_Document_Search_Month1']='';
if(!isset($_POST['IN_Document_Search_Year1'])) $_POST['IN_Document_Search_Year1']='';
if(!isset($_POST['IN_Document_Search_Day2'])) $_POST['IN_Document_Search_Day2']='';
if(!isset($_POST['IN_Document_Search_Month2'])) $_POST['IN_Document_Search_Month2']='';
if(!isset($_POST['IN_Document_Search_Year2'])) $_POST['IN_Document_Search_Year2']='';

if(!isset($_POST['search_view_type'])) $_POST['search_view_type']='';
if(!isset($_POST['id'])) $_POST['id']='';
if(!isset($_POST['IN_Document_U_No'])) $_POST['IN_Document_U_No']='';
if(!isset($_POST['IN_Document_Type'])) $_POST['IN_Document_Type']='';
if(!isset($_POST['IN_Document_From'])) $_POST['IN_Document_From']='';
if(!isset($_POST['IN_Document_From2'])) $_POST['IN_Document_From2']='';
if(!isset($_POST['IN_Document_Subject'])) $_POST['IN_Document_Subject']='';
if(!isset($_POST['IN_Document_To1'])) $_POST['IN_Document_To1']='';
if(!isset($_POST['IN_Document_To2'])) $_POST['IN_Document_To2']='';
if(!isset($_POST['IN_Document_To3'])) $_POST['IN_Document_To3']='';
if(!isset($_POST['IN_Document_To4'])) $_POST['IN_Document_To4']='';
if(!isset($_POST['IN_Document_To5'])) $_POST['IN_Document_To5']='';
if(!isset($_POST['IN_Document_Received_Day'])) $_POST['IN_Document_Received_Day']='';
if(!isset($_POST['IN_Document_Received_Month'])) $_POST['IN_Document_Received_Month']='';
if(!isset($_POST['IN_Document_Received_Year'])) $_POST['IN_Document_Received_Year']='';
if(!isset($_POST['IN_Document_Received_Hour'])) $_POST['IN_Document_Received_Hour']='';
if(!isset($_POST['IN_Document_Received_Minute'])) $_POST['IN_Document_Received_Minute']='';
if(!isset($_POST['IN_Document_Issued_Day'])) $_POST['IN_Document_Issued_Day']='';
if(!isset($_POST['IN_Document_Issued_Month'])) $_POST['IN_Document_Issued_Month']='';
if(!isset($_POST['IN_Document_Issued_Year'])) $_POST['IN_Document_Issued_Year']='';
if(!isset($_POST['IN_Document_Issued_Hour'])) $_POST['IN_Document_Issued_Hour']='';
if(!isset($_POST['IN_Document_Issued_Minute'])) $_POST['IN_Document_Issued_Minute']='';

if(!isset($_POST['IN_Document_Stored_Day1'])) $_POST['IN_Document_Stored_Day1']='';
if(!isset($_POST['IN_Document_Stored_Month1'])) $_POST['IN_Document_Stored_Month1']='';
if(!isset($_POST['IN_Document_Stored_Year1'])) $_POST['IN_Document_Stored_Year1']='';
if(!isset($_POST['IN_Document_Stored_Hour1'])) $_POST['IN_Document_Stored_Hour1']='';
if(!isset($_POST['IN_Document_Stored_Minute1'])) $_POST['IN_Document_Stored_Minute1']='';
if(!isset($_POST['IN_Document_Physical_File'])) $_POST['IN_Document_Physical_File']='';
if(!isset($_POST['IN_Document_Path'])) $_POST['IN_Document_Path']='';
if(!isset($_POST['IN_Document_Details'])) $_POST['IN_Document_Details']='';
if(!isset($_POST['IN_Document_Actions_Needed'])) $_POST['IN_Document_Actions_Needed']='';
if(!isset($_POST['IN_Document_Actions_Performed'])) $_POST['IN_Document_Actions_Performed']='';
if(!isset($_POST['IN_Document_All_Actions_Completed'])) $_POST['IN_Document_All_Actions_Completed']='';
if(!isset($_POST['IN_Document_Comments'])) $_POST['IN_Document_Comments']='';
if(!isset($_POST['IN_Document_Related'])) $_POST['IN_Document_Related']='';
if(!isset($_POST['IN_Document_Removed'])) $_POST['IN_Document_Removed']='';
if(!isset($_POST['IN_Document_Removed_Reason'])) $_POST['IN_Document_Removed_Reason']='';

//geting variable values
$op = $_POST['op'];

$Search_For = stripslashes($_POST['Search_For']);
$Search_For1 = stripslashes($_POST['Search_For1']);
$IN_Document_Search_Day1 = stripslashes($_POST['IN_Document_Search_Day1']);
$IN_Document_Search_Month1 = stripslashes($_POST['IN_Document_Search_Month1']);
$IN_Document_Search_Year1 = stripslashes($_POST['IN_Document_Search_Year1']);
$IN_Document_Search_Day2 = stripslashes($_POST['IN_Document_Search_Day2']);
$IN_Document_Search_Month2 = stripslashes($_POST['IN_Document_Search_Month2']);
$IN_Document_Search_Year2 = stripslashes($_POST['IN_Document_Search_Year2']);

$search_view_type = $_POST['search_view_type'];
$id = stripslashes($_POST['id']);
$IN_Document_U_No = stripslashes($_POST['IN_Document_U_No']);
$IN_Document_Type = stripslashes($_POST['IN_Document_Type']);
$IN_Document_From = stripslashes($_POST['IN_Document_From']);
$IN_Document_From2 = stripslashes($_POST['IN_Document_From2']);
$IN_Document_Subject = stripslashes($_POST['IN_Document_Subject']);
$IN_Document_To1 = stripslashes($_POST['IN_Document_To1']);
$IN_Document_To2 = stripslashes($_POST['IN_Document_To2']);
$IN_Document_To3 = stripslashes($_POST['IN_Document_To3']);
$IN_Document_To4 = stripslashes($_POST['IN_Document_To4']);
$IN_Document_To5 = stripslashes($_POST['IN_Document_To5']);
$IN_Document_Received_Day = stripslashes($_POST['IN_Document_Received_Day']);
$IN_Document_Received_Month = stripslashes($_POST['IN_Document_Received_Month']);
$IN_Document_Received_Year = stripslashes($_POST['IN_Document_Received_Year']);
$IN_Document_Received_Hour = stripslashes($_POST['IN_Document_Received_Hour']);
$IN_Document_Received_Minute = stripslashes($_POST['IN_Document_Received_Minute']);
$IN_Document_Issued_Day = stripslashes($_POST['IN_Document_Issued_Day']);
$IN_Document_Issued_Month = stripslashes($_POST['IN_Document_Issued_Month']);
$IN_Document_Issued_Year = stripslashes($_POST['IN_Document_Issued_Year']);
$IN_Document_Issued_Hour = stripslashes($_POST['IN_Document_Issued_Hour']);
$IN_Document_Issued_Minute = stripslashes($_POST['IN_Document_Issued_Minute']);
$IN_Document_Stored_Date = $NOW_TIME;
$IN_Document_Removed_Date = $NOW_TIME;
$IN_Document_Stored_Day1 = stripslashes($_POST['IN_Document_Stored_Day1']);
$IN_Document_Stored_Month1 = stripslashes($_POST['IN_Document_Stored_Month1']);
$IN_Document_Stored_Year1 = stripslashes($_POST['IN_Document_Stored_Year1']);
$IN_Document_Stored_Hour1 = stripslashes($_POST['IN_Document_Stored_Hour1']);
$IN_Document_Stored_Minute1 = stripslashes($_POST['IN_Document_Stored_Minute1']);
$IN_Document_Physical_File = stripslashes($_POST['IN_Document_Physical_File']);
$IN_Document_Path = stripslashes($_POST['IN_Document_Path']);
$IN_Document_Details = stripslashes($_POST['IN_Document_Details']);
$IN_Document_Actions_Needed = stripslashes($_POST['IN_Document_Actions_Needed']);
$IN_Document_Actions_Performed = stripslashes($_POST['IN_Document_Actions_Performed']);
$IN_Document_All_Actions_Completed = stripslashes($_POST['IN_Document_All_Actions_Completed']);
$IN_Document_Comments = stripslashes($_POST['IN_Document_Comments']);
$IN_Document_Related = stripslashes($_POST['IN_Document_Related']);
$IN_Document_Removed = stripslashes($_POST['IN_Document_Removed']);
$IN_Document_Removed_Reason = stripslashes($_POST['IN_Document_Removed_Reason']);

//the first thing you see
function mainselect(){
echo '<br><br><br>Please select from above actions.<br><br><br><br>';
}

// search main page
function searchin(){
echo '<br><b>Search/Edit/Remove - Incoming:</b><br><br><table width="100%" border="0" bgcolor="#FFFFCC"><tr><td><form id="form1" name="form1" method="post" action="main_in.php">
  <p align="center"><strong>Search in Specific Field</strong></p>
  <table width="100%" border="0" >
    <tr >
      <td>
        <div align="center">
          <input name="op" type="radio" value="searchin_U_No" />
        </div></td>
      <td>
        <div align="center">
          <input name="op" type="radio" value="searchin_Subject" />
        </div></td>
       <td>
        <div align="center">
          <input name="op" type="radio" value="searchin_To1" />
        </div></td>
		 <td>
        <div align="center">
          <input name="op" type="radio" value="searchin_To2" />
        </div></td>
		 <td>
        <div align="center">
          <input name="op" type="radio" value="searchin_From" />
        </div></td>
		 <td>
        <div align="center">
          <input name="op" type="radio" value="searchin_All_Actions_Completed" />
        </div></td>
		<td>
		 <div align="center">
          <input name="op" type="radio" value="searchin_Type" />
        </div></td>
		<td>
		 <div align="center">
          <input name="op" type="radio" value="searchin_Physical_File" />
        </div></td>
    </tr>
    <tr>
	  <td><div align="center">Document Unique No</div></td>
      <td><div align="center">Subject</div></td>
	  <td><div align="center">To (Recipient) 1</div></td>
	  <td><div align="center">To (Recipient) 2</div></td>
      <td><div align="center">From </div></td>
      <td><div align="center">All Actions Completed</div></td>
	  <td><div align="center">Type</div></td>
	  <td><div align="center">Physical File</div></td>
	 </tr>
  </table>
  <p align="center">
     Search For: <input type="text" name="Search_For" /> Want Full-Edit/Remove View?<select name="search_view_type" size="1">
    <option value="1">YES</option>
    <option value="0" selected="selected">NO</option>
  </select> <input type="submit" name="Submit" value="GO" />
</p>
</form></td></tr></table><br><br>';

echo '<table width="100%" border="0" bgcolor="#FFFFCC"><tr><td><form id="form1" name="form1" method="post" action="main_in.php">
  <p align="center"><strong>Search by Dates</strong></p>
  <table width="100%" border="0">
    <tr>
      <td>
        <div align="center">
          <input name="op" type="radio" value="searchin_Stored_Date" />
        </div></td>
      	 <td>
        <div align="center">
          <input name="op" type="radio" value="searchin_Received_Date" />
        </div></td>
		<td>
        <div align="center">
          <input name="op" type="radio" value="searchin_Issued_Date" />
        </div></td>
    </tr>
    <tr>
	  <td><div align="center">Document Stored Date</div></td>
      <td><div align="center">Document Received Date</div></td>
	  <td><div align="center">Document Issued Date</div></td>
	  </tr>
  </table>
  <p align="center">
    Search For: <input name="IN_Document_Search_Day1" type="text" size="2" maxlength="2" />/<input name="IN_Document_Search_Month1" type="text" size="2" maxlength="2" />/<input name="IN_Document_Search_Year1" type="text" size="4" maxlength="4" /> Want Full-Edit/Remove View?<select name="search_view_type" size="1">
    <option value="1">YES</option>
    <option value="0" selected="selected">NO</option>
  </select> <input type="submit" name="Submit" value="GO" />
</p>
</form></td></tr></table><br><br>';


echo '<table width="100%" border="0" bgcolor="#FFFFCC"><tr><td><br><form id="form1" name="form1" method="post" action="">
<p align="center"><strong>Combined Search</strong></p>
  <p>From Stored Date
    <input name="IN_Document_Search_Day1" type="text" size="2" maxlength="2" />/<input name="IN_Document_Search_Month1" type="text" size="2" maxlength="2" />/<input name="IN_Document_Search_Year1" type="text" size="4" maxlength="4" />
  To Stored Date 
  <input name="IN_Document_Search_Day2" type="text" size="2" maxlength="2" />/<input name="IN_Document_Search_Month2" type="text" size="2" maxlength="2" />/<input name="IN_Document_Search_Year2" type="text" size="4" maxlength="4" />
  <input type="hidden" name="op" value="combined_search_1"> Want Full-Edit/Remove View?<select name="search_view_type" size="1">
    <option value="1">YES</option>
    <option value="0" selected="selected">NO</option>
  </select> <input type="submit" name="Submit" value="Submit" /><hr>
  </p>
</form>
<form id="form1" name="form1" method="post" action="">
  <p>From Stored Date
    <input name="IN_Document_Search_Day1" type="text" size="2" maxlength="2" />/<input name="IN_Document_Search_Month1" type="text" size="2" maxlength="2" />/<input name="IN_Document_Search_Year1" type="text" size="4" maxlength="4" />
    To Stored Date
    <input name="IN_Document_Search_Day2" type="text" size="2" maxlength="2" />/<input name="IN_Document_Search_Month2" type="text" size="2" maxlength="2" />/<input name="IN_Document_Search_Year2" type="text" size="4" maxlength="4" />
  AND From 
  <input type="text" name="Search_For" />
  <input type="hidden" name="op" value="combined_search_2">
   Want Full-Edit/Remove View?<select name="search_view_type" size="1">
    <option value="1">YES</option>
    <option value="0" selected="selected">NO</option>
  </select> <input type="submit" name="Submit2" value="Submit" /><hr>
  </p>
</form>
<form id="form1" name="form1" method="post" action="">
  <p>From Stored Date
    <input name="IN_Document_Search_Day1" type="text" size="2" maxlength="2" />/<input name="IN_Document_Search_Month1" type="text" size="2" maxlength="2" />/<input name="IN_Document_Search_Year1" type="text" size="4" maxlength="4" />
    To Stored Date
    <input name="IN_Document_Search_Day2" type="text" size="2" maxlength="2" />/<input name="IN_Document_Search_Month2" type="text" size="2" maxlength="2" />/<input name="IN_Document_Search_Year2" type="text" size="4" maxlength="4" />
  AND To (Recipient) 1
    <input type="text" name="Search_For" />
	<input type="hidden" name="op" value="combined_search_3">
     Want Full-Edit/Remove View?<select name="search_view_type" size="1">
    <option value="1">YES</option>
    <option value="0" selected="selected">NO</option>
  </select> <input type="submit" name="Submit22" value="Submit" /><hr>
  </p>
</form>
<form id="form1" name="form1" method="post" action="">
  <p>From Stored Date
    <input name="IN_Document_Search_Day1" type="text" size="2" maxlength="2" />/<input name="IN_Document_Search_Month1" type="text" size="2" maxlength="2" />/<input name="IN_Document_Search_Year1" type="text" size="4" maxlength="4" />
    To Stored Date
    <input name="IN_Document_Search_Day2" type="text" size="2" maxlength="2" />/<input name="IN_Document_Search_Month2" type="text" size="2" maxlength="2" />/<input name="IN_Document_Search_Year2" type="text" size="4" maxlength="4" />
    AND Type 
    <input type="text" name="Search_For" />
	<input type="hidden" name="op" value="combined_search_4">
     Want Full-Edit/Remove View?<select name="search_view_type" size="1">
    <option value="1">YES</option>
    <option value="0" selected="selected">NO</option>
  </select> <input type="submit" name="Submit222" value="Submit" /><hr>
  </p>
</form>
<form id="form1" name="form1" method="post" action="">
  <p>From
    <input type="text" name="Search_For" />
AND To (Recipient) 1
    <input type="text" name="Search_For1" />
	<input type="hidden" name="op" value="combined_search_5">
     Want Full-Edit/Remove View?<select name="search_view_type" size="1">
    <option value="1">YES</option>
    <option value="0" selected="selected">NO</option>
  </select> <input type="submit" name="Submit2222" value="Submit" /><hr>
  </p>
</form>
<form id="form1" name="form1" method="post" action="">
  <p>From
    <input type="text" name="Search_For" />
    AND Type
    <input type="text" name="Search_For1" />
	<input type="hidden" name="op" value="combined_search_6">
     Want Full-Edit/Remove View?<select name="search_view_type" size="1">
    <option value="1">YES</option>
    <option value="0" selected="selected">NO</option>
  </select> <input type="submit" name="Submit22222" value="Submit" /><hr>
  </p>
</form>
<form id="form1" name="form1" method="post" action="">
  <p>From Stored Date
    <input name="IN_Document_Search_Day1" type="text" size="2" maxlength="2" />/<input name="IN_Document_Search_Month1" type="text" size="2" maxlength="2" />/<input name="IN_Document_Search_Year1" type="text" size="4" maxlength="4" />
    To Stored Date
    <input name="IN_Document_Search_Day2" type="text" size="2" maxlength="2" />/<input name="IN_Document_Search_Month2" type="text" size="2" maxlength="2" />/<input name="IN_Document_Search_Year2" type="text" size="4" maxlength="4" />
  AND Removed
    <input type="text" name="Search_For" />
	<input type="hidden" name="op" value="combined_search_7">
     Want Full-Edit/Remove View?<select name="search_view_type" size="1">
    <option value="1">YES</option>
    <option value="0" selected="selected">NO</option>
  </select> <input type="submit" name="Submit3" value="Submit" /><hr>
  </p>
</form></td></tr></table><br><br>';
echo '<hr> *Instructions: Possible search terms for "All Actions Completed" field: NO, YES, NOACTION.';
}


//adds a new record in income documents table
function newin() {
global $path_in, $no_init_in, $dbc;

$sql= "Select id From edocphp_main_in";
$sql_res = mysql_query($sql,$dbc);
$no_of_rows = mysql_num_rows($sql_res);
$no_in=$no_of_rows+1;

$IN_Document_U_No="$no_init_in$no_in";

echo '<br><b>Submit New Incoming Document:</b><br><br><form id="form" name="form" method="post" action="main_in.php">
  <table width="100%" border="0">
    <tr bgcolor="#FFFFCC">
      <td valign="top"><span class="style7">Document Unique No</span></td>
      <td valign="top"><b>'.$IN_Document_U_No.'</b><input name="IN_Document_U_No" type="hidden" id="IN_Document_U_No" value="'.$IN_Document_U_No.'"/></td>
      <td valign="top">&nbsp;</td>
      <td valign="top"><span class="style7">Type</span></td>
      <td valign="top"><span class="style7">
        <select name="IN_Document_Type" size="1" id="IN_Document_Type">
          <option value="LETTER">Letter</option>
          <option value="FAX">FAX</option>
          <option value="EMAIL">EMail</option>
          <option value="OTHER">Other</option>
        </select>
      </span></td>
    </tr>
    <tr>
      <td valign="top"><span class="style7">From</span></td>
      <td valign="top"><input name="IN_Document_From" type="text" id="IN_Document_From" /></td>
      <td valign="top">&nbsp;</td>
      <td valign="top"><span class="style7">From (2)</span></td>
      <td valign="top"><input name="IN_Document_From2" type="text" id="IN_Document_From2" /></td>
    </tr>
    <tr bgcolor="#FFFFCC">
      <td valign="top"><span class="style7">Subject</span></td>
      <td valign="top"><input name="IN_Document_Subject" type="text" id="IN_Document_Subject" /></td>
      <td valign="top">&nbsp;</td>
      <td valign="top"><span class="style7">To (Recipient)1</span></td>
      <td valign="top"><input name="IN_Document_To1" type="text" id="IN_Document_To1" /></td>
    </tr>
    <tr>
      <td valign="top" nowrap="nowrap"><span class="style7">To (Recipient) (2)</span></td>
      <td valign="top"><input name="IN_Document_To2" type="text" id="IN_Document_To2" /></td>
      <td valign="top">&nbsp;</td>
      <td valign="top"><span class="style7">To(Recipient) 3</span></td>
      <td valign="top"><input name="IN_Document_To3" type="text" id="IN_Document_To3" /></td>
    </tr>
    <tr bgcolor="#FFFFCC">
      <td valign="top"><span class="style7">
            To (Recipient) (4) </span></td>
      <td valign="top"><input name="IN_Document_To4" type="text" id="IN_Document_To4" /></td>
      <td valign="top">&nbsp;</td>
      <td valign="top"><span class="style7">To (Recipient) 5<br />
      (If it has more than 4  <br />
      recipients put the rest <br />
      here separated by comma)</span></td>
      <td valign="top"><span class="style7">
        <textarea name="IN_Document_To5" cols="40" rows="5" id="IN_Document_To5"></textarea>
      </span></td>
    </tr>
    <tr>
      <td valign="top"><span class="style7">Issued Date<br>(Type the date and time the document Issued (created) with the following      format dd/mm/yyyy :: hh:mm  e.g. 20/12/2006 :: 18:20)</span></td>
      <td valign="top"><input name="IN_Document_Issued_Day" type="text" size="2" maxlength="2" id="IN_Document_Issued_Day" />/<input name="IN_Document_Issued_Month" type="text" size="2" maxlength="2" id="IN_Document_Issued_Month" />/<input 	   		name="IN_Document_Issued_Year" type="text" size="4" maxlength="4" id="IN_Document_Issued_Year" /> :: <input 		  		name="IN_Document_Issued_Hour" type="text" size="2" maxlength="2" id="IN_Document_Issued_Hour" />:<input 	  name="IN_Document_Issued_Minute" type="text" size="2" maxlength="2" id="IN_Document_Issued_Minute" /></td>
      <td valign="top">&nbsp;</td>
      <td valign="top"><span class="style7">Received Date<br>(Type the date and time you received the document with the following      format dd/mm/yyyy :: hh:mm  e.g. 20/12/2006 :: 18:20)
		</span></td>
      <td valign="top"><input name="IN_Document_Received_Day" type="text" size="2" maxlength="2" id="IN_Document_Received_Day" />/<input name="IN_Document_Received_Month" type="text" size="2" maxlength="2" id="IN_Document_Received_Month" />/<input 	   		name="IN_Document_Received_Year" type="text" size="4" maxlength="4" id="IN_Document_Received_Year" /> :: <input 		  		name="IN_Document_Received_Hour" type="text" size="2" maxlength="2" id="IN_Document_Received_Hour" />:<input 	  name="IN_Document_Received_Minute" type="text" size="2" maxlength="2" id="IN_Document_Received_Minute" /></td>
    </tr>
    <tr bgcolor="#FFFFCC">
      <td valign="top"><span class="style7">Stored Date</span></td>
      <td valign="top">-This will be automatically filled when you submit this form-</td>
      <td valign="top">&nbsp;</td>
      <td valign="top"><span class="style7">Physical File</span></td>
      <td valign="top"><input name="IN_Document_Physical_File" type="text" id="IN_Document_Physical_File" /></td>
    </tr>
    <tr>
      <td valign="top"><span class="style7">Path</span></td>
      <td valign="top"><input name="IN_Document_Path" value="'.$path_in.' "type="text" size="40" id="IN_Document_Path" /><br><a href="upload.php" target="_blank"><br><b>Upload File</b></a></td>
      <td valign="top">&nbsp;</td>
      <td valign="top"><span class="style7">
              </span></td>
      <td valign="top"><span class="style7">
        <textarea name="IN_Document_Details" cols="40" rows="5" id="IN_Document_Details"></textarea>
      </span></td>
    </tr>
    <tr bgcolor="#FFFFCC">
      <td valign="top"><span class="style7">Actions Needed</span></td>
      <td valign="top"><span class="style7">
        <textarea name="IN_Document_Actions_Needed" cols="40" rows="5" id="IN_Document_Actions_Needed"></textarea>
      </span></td>
      <td valign="top">&nbsp;</td>
      <td valign="top"><span class="style7">Actions Performed</span></td>
      <td valign="top"><span class="style7">
        <textarea name="IN_Document_Actions_Performed" cols="40" rows="5" id="IN_Document_Actions_Performed"></textarea>
      </span></td>
    </tr>
    <tr>
      <td valign="top"><span class="style7"> All Actions Completed</span></td>
      <td valign="top"><span class="style7">
        <select name="IN_Document_All_Actions_Completed" size="1" id="IN_Document_All_Actions_Completed">
          <option value="NO">NO</option>
          <option value="YES">YES</option>
          <option value="NOACTION" selected="selected">NO ACTION REQUIRED</option>
          </select>
      </span> </td>
      <td valign="top">&nbsp;</td>
      <td valign="top"><span class="style7">Comments</span></td>
      <td valign="top"><span class="style7">
        <textarea name="IN_Document_Comments" cols="40" rows="5" id="IN_Document_Comments"></textarea>
      </span></td>
    </tr>
    <tr bgcolor="#FFFFCC">
      <td valign="top"><span class="style7">Related Documents</span></td>
      <td valign="top"><span class="style7">
        <textarea name="IN_Document_Related" cols="40" rows="5" id="IN_Document_Related"></textarea>
      </span></td>
    </tr>
  </table>
  <input type="hidden" name="op" value="save_newin">
  <br><div align="center"><input type="submit" value="Submit"><input type="reset" value="Reset"></div>
</form>';
}



//saves a new record in incoming documets table
function save_newin() {
global $dbcs, $dbc;
global $IN_Document_U_No, $IN_Document_Type, $IN_Document_From, $IN_Document_From2, $IN_Document_Subject, $IN_Document_To1,  $IN_Document_To2, $IN_Document_To3, $IN_Document_To4, $IN_Document_To5, $IN_Document_Received_Hour, $IN_Document_Received_Minute, $IN_Document_Received_Month, $IN_Document_Received_Day, $IN_Document_Received_Year, $IN_Document_Issued_Hour, $IN_Document_Issued_Minute, $IN_Document_Issued_Month, $IN_Document_Issued_Day, $IN_Document_Issued_Year, $IN_Document_Stored_Date, $IN_Document_Physical_File, $IN_Document_Path, $IN_Document_Details, $IN_Document_Actions_Needed, $IN_Document_Actions_Performed, $IN_Document_All_Actions_Completed, $IN_Document_Comments, $IN_Document_Related;

//check for document Issued date
If (!empty($IN_Document_Issued_Minute) && !empty($IN_Document_Issued_Hour) &&  !empty($IN_Document_Issued_Month) &&  !empty($IN_Document_Issued_Day) &&  !empty($IN_Document_Issued_Year)){
$IN_Document_Issued_Date = mktime ($IN_Document_Issued_Hour, $IN_Document_Issued_Minute, 00, $IN_Document_Issued_Month, $IN_Document_Issued_Day,$IN_Document_Issued_Year);
}else{
if (empty($IN_Document_Issued_Hour) AND ( !empty($IN_Document_Issued_Month) && !empty($IN_Document_Issued_Day) && !empty($IN_Document_Issued_Year))){
$IN_Document_Issued_Date = mktime (00, 00, 00, $IN_Document_Issued_Month, $IN_Document_Issued_Day, $IN_Document_Issued_Year);
echo " Issued Date Will be Stored without hour and minute details becouse you did not set Issued Hour.<br>"; 
}else{
if ( empty($IN_Document_Issued_Minute) AND ( !empty($IN_Document_Issued_Month) && !empty($IN_Document_Issued_Day) && !empty($IN_Document_Issued_Year))){
$IN_Document_Issued_Date = mktime (00, 00, 00, $IN_Document_Issued_Month, $IN_Document_Issued_Day,$IN_Document_Issued_Year);
echo " Issued Date Will be Stored without hour and minute details becouse you did not set Issued Minute.<br>"; 
}else{
if (empty($IN_Document_Issued_Month) || empty($IN_Document_Issued_Day) || empty($IN_Document_Issued_Year)){
echo '<font color="FF0000"><b>Error</b>:</font>You must set correctly at least the day - month - year of Document Issued Date';
echo "<br><br><center>[ <b><a href=\"javascript:history.go(-1);\">Go Back</a></b> ]</center>";
include ("footer.php");
die();
			}
		}
	}
}

//check for document received date
If (!empty($IN_Document_Received_Minute) && !empty($IN_Document_Received_Hour) &&  !empty($IN_Document_Received_Month) &&  !empty($IN_Document_Received_Day) &&  !empty($IN_Document_Received_Year)){
$IN_Document_Received_Date = mktime ($IN_Document_Received_Hour, $IN_Document_Received_Minute, 00, $IN_Document_Received_Month, $IN_Document_Received_Day,$IN_Document_Received_Year);
}else{
if (empty($IN_Document_Received_Hour) AND ( !empty($IN_Document_Received_Month) && !empty($IN_Document_Received_Day) && !empty($IN_Document_Received_Year))){
$IN_Document_Received_Date = mktime (00, 00, 00, $IN_Document_Received_Month, $IN_Document_Received_Day, $IN_Document_Received_Year);
echo " Received Date Will be Stored without hour and minute details becouse you did not set Received Hour.<br>"; 
}else{
if ( empty($IN_Document_Received_Minute) AND ( !empty($IN_Document_Received_Month) && !empty($IN_Document_Received_Day) && !empty($IN_Document_Received_Year))){
$IN_Document_Received_Date = mktime (00, 00, 00, $IN_Document_Received_Month, $IN_Document_Received_Day,$IN_Document_Received_Year);
echo " Received Date Will be Stored without hour and minute details becouse you did not set Received Minute.<br>"; 
}else{
if (empty($IN_Document_Received_Month) || empty($IN_Document_Received_Day) || empty($IN_Document_Received_Year)){
echo '<font color="FF0000"><b>Error</b>:</font>You must set correctly at least the day - month - year of Document Received Date';
echo "<br><br><center>[ <b><a href=\"javascript:history.go(-1);\">Go Back</a></b> ]</center>";
include ("footer.php");
die();
			}
		}
	}
}

$sql = "insert into edocphp_main_in values('','$IN_Document_U_No', '$IN_Document_Type', '$IN_Document_From', '$IN_Document_From2', '$IN_Document_Subject', '$IN_Document_To1', '$IN_Document_To2', '$IN_Document_To3', '$IN_Document_To4', '$IN_Document_To5', '$IN_Document_Issued_Date','$IN_Document_Received_Date','$IN_Document_Stored_Date','$IN_Document_Physical_File','$IN_Document_Path','$IN_Document_Details','$IN_Document_Actions_Needed','$IN_Document_Actions_Performed','$IN_Document_All_Actions_Completed','$IN_Document_Comments','','','','$IN_Document_Related')";

if (mysql_query($sql,$dbc)){
echo '<b><font color="#0000FF">Information Stored!</font></b><br><br>Select New Action from the panel above.';
} else {
$mysqlerror = mysql_error();
echo'<font color="FF0000"><b>Error</b>:</font> '.$mysqlerror.'';

echo "<br><br><center>[ <b><a href=\"javascript:history.go(-1);\">Go Back</a></b> ]</center>";
include ("footer.php");
die();
}
}


//functions for searching in specific fields

function searchin_U_No(){ 
global $dbcs, $search_view_type, $dbc;
global $Search_For, $IN_Document_U_No, $IN_Document_Type, $IN_Document_From, $IN_Document_From2, $IN_Document_Subject, $IN_Document_To1,  $IN_Document_To2, $IN_Document_To3, $IN_Document_To4, $IN_Document_To5, $IN_Document_Received_Hour, $IN_Document_Received_Minute, $IN_Document_Received_Month, $IN_Document_Received_Day, $IN_Document_Received_Year, $IN_Document_Issued_Hour, $IN_Document_Issued_Minute, $IN_Document_Issued_Month, $IN_Document_Issued_Day, $IN_Document_Issued_Year, $IN_Document_Stored_Date, $IN_Document_Physical_File, $IN_Document_Path, $IN_Document_Details, $IN_Document_Actions_Needed, $IN_Document_Actions_Performed, $IN_Document_All_Actions_Completed, $IN_Document_Comments, $IN_Document_Related, $IN_Document_Removed,$IN_Document_Removed_Reason, $IN_Document_Removed_Date;

$sql = "SELECT * FROM edocphp_main_in WHERE Document_U_No ='$Search_For' AND Document_Removed!='YES'";

$sql_res = mysql_query($sql,$dbc) or die(mysql_error());

if ($search_view_type == "0"){
search_result_in_show($sql_res);
}

if ($search_view_type == "1"){
search_result_in_show_full($sql_res);
}


}

function searchin_Subject(){ 
global $dbcs, $search_view_type, $dbc;
global $Search_For, $IN_Document_U_No, $IN_Document_Type, $IN_Document_From, $IN_Document_From2, $IN_Document_Subject, $IN_Document_To1,  $IN_Document_To2, $IN_Document_To3, $IN_Document_To4, $IN_Document_To5, $IN_Document_Received_Hour, $IN_Document_Received_Minute, $IN_Document_Received_Month, $IN_Document_Received_Day, $IN_Document_Received_Year, $IN_Document_Issued_Hour, $IN_Document_Issued_Minute, $IN_Document_Issued_Month, $IN_Document_Issued_Day, $IN_Document_Issued_Year, $IN_Document_Stored_Date, $IN_Document_Physical_File, $IN_Document_Path, $IN_Document_Details, $IN_Document_Actions_Needed, $IN_Document_Actions_Performed, $IN_Document_All_Actions_Completed, $IN_Document_Comments, $IN_Document_Related, $IN_Document_Removed,$IN_Document_Removed_Reason, $IN_Document_Removed_Date;

$sql = "SELECT * FROM edocphp_main_in WHERE Document_Subject LIKE '%$Search_For%' AND Document_Removed!='YES'";

$sql_res = mysql_query($sql,$dbc) or die(mysql_error());

if ($search_view_type == "0"){
search_result_in_show($sql_res);
}

if ($search_view_type == "1"){
search_result_in_show_full($sql_res);
}

}


function searchin_To1(){ 
global $dbcs, $search_view_type, $dbc;
global $Search_For, $IN_Document_U_No, $IN_Document_Type, $IN_Document_From, $IN_Document_From2, $IN_Document_Subject, $IN_Document_To1,  $IN_Document_To2, $IN_Document_To3, $IN_Document_To4, $IN_Document_To5, $IN_Document_Received_Hour, $IN_Document_Received_Minute, $IN_Document_Received_Month, $IN_Document_Received_Day, $IN_Document_Received_Year, $IN_Document_Issued_Hour, $IN_Document_Issued_Minute, $IN_Document_Issued_Month, $IN_Document_Issued_Day, $IN_Document_Issued_Year, $IN_Document_Stored_Date, $IN_Document_Physical_File, $IN_Document_Path, $IN_Document_Details, $IN_Document_Actions_Needed, $IN_Document_Actions_Performed, $IN_Document_All_Actions_Completed, $IN_Document_Comments, $IN_Document_Related, $IN_Document_Removed,$IN_Document_Removed_Reason, $IN_Document_Removed_Date;

$sql = "SELECT * FROM edocphp_main_in WHERE Document_To1 LIKE '%$Search_For%' AND Document_Removed!='YES'";

$sql_res = mysql_query($sql,$dbc) or die(mysql_error());

if ($search_view_type == "0"){
search_result_in_show($sql_res);
}

if ($search_view_type == "1"){
search_result_in_show_full($sql_res);
}
}
	
function searchin_To2(){ 
global $dbcs, $search_view_type, $dbc;
global $Search_For, $IN_Document_U_No, $IN_Document_Type, $IN_Document_From, $IN_Document_From2, $IN_Document_Subject, $IN_Document_To1,  $IN_Document_To2, $IN_Document_To3, $IN_Document_To4, $IN_Document_To5, $IN_Document_Received_Hour, $IN_Document_Received_Minute, $IN_Document_Received_Month, $IN_Document_Received_Day, $IN_Document_Received_Year, $IN_Document_Issued_Hour, $IN_Document_Issued_Minute, $IN_Document_Issued_Month, $IN_Document_Issued_Day, $IN_Document_Issued_Year, $IN_Document_Stored_Date, $IN_Document_Physical_File, $IN_Document_Path, $IN_Document_Details, $IN_Document_Actions_Needed, $IN_Document_Actions_Performed, $IN_Document_All_Actions_Completed, $IN_Document_Comments, $IN_Document_Related, $IN_Document_Removed,$IN_Document_Removed_Reason, $IN_Document_Removed_Date;

$sql = "SELECT * FROM edocphp_main_in WHERE Document_To2 LIKE '%$Search_For%' AND Document_Removed!='YES'";

$sql_res = mysql_query($sql,$dbc) or die(mysql_error());

if ($search_view_type == "0"){
search_result_in_show($sql_res);
}

if ($search_view_type == "1"){
search_result_in_show_full($sql_res);
}
}
	
function searchin_From(){ 
global $dbcs, $dbc, $search_view_type;
global $Search_For, $IN_Document_U_No, $IN_Document_Type, $IN_Document_From, $IN_Document_From2, $IN_Document_Subject, $IN_Document_To1,  $IN_Document_To2, $IN_Document_To3, $IN_Document_To4, $IN_Document_To5, $IN_Document_Received_Hour, $IN_Document_Received_Minute, $IN_Document_Received_Month, $IN_Document_Received_Day, $IN_Document_Received_Year, $IN_Document_Issued_Hour, $IN_Document_Issued_Minute, $IN_Document_Issued_Month, $IN_Document_Issued_Day, $IN_Document_Issued_Year, $IN_Document_Stored_Date, $IN_Document_Physical_File, $IN_Document_Path, $IN_Document_Details, $IN_Document_Actions_Needed, $IN_Document_Actions_Performed, $IN_Document_All_Actions_Completed, $IN_Document_Comments, $IN_Document_Related, $IN_Document_Removed,$IN_Document_Removed_Reason, $IN_Document_Removed_Date;

$sql = "SELECT * FROM edocphp_main_in WHERE Document_From LIKE '%$Search_For%' AND Document_Removed!='YES'";

$sql_res = mysql_query($sql,$dbc) or die(mysql_error());

if ($search_view_type == "0"){
search_result_in_show($sql_res);
}

if ($search_view_type == "1"){
search_result_in_show_full($sql_res);
}

}
	
function searchin_All_Actions_Completed(){ 
global $dbcs, $search_view_type, $dbc;
global $Search_For, $IN_Document_U_No, $IN_Document_Type, $IN_Document_From, $IN_Document_From2, $IN_Document_Subject, $IN_Document_To1,  $IN_Document_To2, $IN_Document_To3, $IN_Document_To4, $IN_Document_To5, $IN_Document_Received_Hour, $IN_Document_Received_Minute, $IN_Document_Received_Month, $IN_Document_Received_Day, $IN_Document_Received_Year, $IN_Document_Issued_Hour, $IN_Document_Issued_Minute, $IN_Document_Issued_Month, $IN_Document_Issued_Day, $IN_Document_Issued_Year, $IN_Document_Stored_Date, $IN_Document_Physical_File, $IN_Document_Path, $IN_Document_Details, $IN_Document_Actions_Needed, $IN_Document_Actions_Performed, $IN_Document_All_Actions_Completed, $IN_Document_Comments, $IN_Document_Related, $IN_Document_Removed,$IN_Document_Removed_Reason, $IN_Document_Removed_Date;

$sql = "SELECT * FROM edocphp_main_in WHERE Document_All_Actions_Completed ='$Search_For' AND Document_Removed!='YES'";

$sql_res = mysql_query($sql,$dbc) or die(mysql_error());

if ($search_view_type == "0"){
search_result_in_show($sql_res);
}

if ($search_view_type == "1"){
search_result_in_show_full($sql_res);
}
}
	
function searchin_Type(){ 
global $dbcs, $search_view_type, $dbc;
global $Search_For, $IN_Document_U_No, $IN_Document_Type, $IN_Document_From, $IN_Document_From2, $IN_Document_Subject, $IN_Document_To1,  $IN_Document_To2, $IN_Document_To3, $IN_Document_To4, $IN_Document_To5, $IN_Document_Received_Hour, $IN_Document_Received_Minute, $IN_Document_Received_Month, $IN_Document_Received_Day, $IN_Document_Received_Year, $IN_Document_Issued_Hour, $IN_Document_Issued_Minute, $IN_Document_Issued_Month, $IN_Document_Issued_Day, $IN_Document_Issued_Year, $IN_Document_Stored_Date, $IN_Document_Physical_File, $IN_Document_Path, $IN_Document_Details, $IN_Document_Actions_Needed, $IN_Document_Actions_Performed, $IN_Document_All_Actions_Completed, $IN_Document_Comments, $IN_Document_Related, $IN_Document_Removed,$IN_Document_Removed_Reason, $IN_Document_Removed_Date;

$sql = "SELECT * FROM edocphp_main_in WHERE Document_All_Actions_Completed ='$Search_For' AND Document_Removed!='YES'";

$sql_res = mysql_query($sql,$dbc) or die(mysql_error());

if ($search_view_type == "0"){
search_result_in_show($sql_res);
}

if ($search_view_type == "1"){
search_result_in_show_full($sql_res);
}
}

function searchin_Physical_File(){ 
global $dbcs, $search_view_type, $dbc;
global $Search_For, $IN_Document_U_No, $IN_Document_Type, $IN_Document_From, $IN_Document_From2, $IN_Document_Subject, $IN_Document_To1,  $IN_Document_To2, $IN_Document_To3, $IN_Document_To4, $IN_Document_To5, $IN_Document_Received_Hour, $IN_Document_Received_Minute, $IN_Document_Received_Month, $IN_Document_Received_Day, $IN_Document_Received_Year, $IN_Document_Issued_Hour, $IN_Document_Issued_Minute, $IN_Document_Issued_Month, $IN_Document_Issued_Day, $IN_Document_Issued_Year, $IN_Document_Stored_Date, $IN_Document_Physical_File, $IN_Document_Path, $IN_Document_Details, $IN_Document_Actions_Needed, $IN_Document_Actions_Performed, $IN_Document_All_Actions_Completed, $IN_Document_Comments, $IN_Document_Related, $IN_Document_Removed,$IN_Document_Removed_Reason, $IN_Document_Removed_Date;

$sql = "SELECT * FROM edocphp_main_in WHERE Document_Physical_File LIKE '%$Search_For%' AND Document_Removed!='YES'";

$sql_res = mysql_query($sql,$dbc) or die(mysql_error());

if ($search_view_type == "0"){
search_result_in_show($sql_res);
}

if ($search_view_type == "1"){
search_result_in_show_full($sql_res);
}
}


//functions for searching by date

function searchin_Stored_Date(){ 
global $dbcs, $search_view_type, $dbc;
global $Search_For, $IN_Document_Search_Day1, $IN_Document_Search_Month1, $IN_Document_Search_Year1, $IN_Document_U_No, $IN_Document_Type, $IN_Document_From, $IN_Document_From2, $IN_Document_Subject, $IN_Document_To1,  $IN_Document_To2, $IN_Document_To3, $IN_Document_To4, $IN_Document_To5, $IN_Document_Received_Hour, $IN_Document_Received_Minute, $IN_Document_Received_Month, $IN_Document_Received_Day, $IN_Document_Received_Year, $IN_Document_Issued_Hour, $IN_Document_Issued_Minute, $IN_Document_Issued_Month, $IN_Document_Issued_Day, $IN_Document_Issued_Year, $IN_Document_Stored_Date, $IN_Document_Physical_File, $IN_Document_Path, $IN_Document_Details, $IN_Document_Actions_Needed, $IN_Document_Actions_Performed, $IN_Document_All_Actions_Completed, $IN_Document_Comments, $IN_Document_Related, $IN_Document_Removed,$IN_Document_Removed_Reason, $IN_Document_Removed_Date;

if (empty($IN_Document_Search_Day1) || empty($IN_Document_Search_Month1) || empty($IN_Document_Search_Year1)){
echo '<font color="FF0000"><b>Error:</font></b> Please complete search Day, Month and Year.';
echo '<br><br><center>[ <b><a href="javascript:history.go(-1);">Go Back</a></b> ]</center>';
include ("footer.php");
die();
}

$IN_Document_Date_Min = mktime (00, 00, 00, $IN_Document_Search_Month1, $IN_Document_Search_Day1, $IN_Document_Search_Year1);

$IN_Document_Date_Max = mktime (24, 59, 59, $IN_Document_Search_Month1, $IN_Document_Search_Day1, $IN_Document_Search_Year1);

$sql = "SELECT * FROM edocphp_main_in WHERE Document_Stored_Date >='$IN_Document_Date_Min' AND Document_Stored_Date <='$IN_Document_Date_Max' AND Document_Removed!='YES'";

$sql_res = mysql_query($sql,$dbc) or die(mysql_error());

if ($search_view_type == "0"){
search_result_in_show($sql_res);
}

if ($search_view_type == "1"){
search_result_in_show_full($sql_res);
}
}

function searchin_Received_Date(){ 
global $dbcs, $search_view_type, $dbc;
global $Search_For, $IN_Document_Search_Day1, $IN_Document_Search_Month1, $IN_Document_Search_Year1, $IN_Document_U_No, $IN_Document_Type, $IN_Document_From, $IN_Document_From2, $IN_Document_Subject, $IN_Document_To1,  $IN_Document_To2, $IN_Document_To3, $IN_Document_To4, $IN_Document_To5, $IN_Document_Received_Hour, $IN_Document_Received_Minute, $IN_Document_Received_Month, $IN_Document_Received_Day, $IN_Document_Received_Year, $IN_Document_Issued_Hour, $IN_Document_Issued_Minute, $IN_Document_Issued_Month, $IN_Document_Issued_Day, $IN_Document_Issued_Year, $IN_Document_Stored_Date, $IN_Document_Physical_File, $IN_Document_Path, $IN_Document_Details, $IN_Document_Actions_Needed, $IN_Document_Actions_Performed, $IN_Document_All_Actions_Completed, $IN_Document_Comments, $IN_Document_Related, $IN_Document_Removed,$IN_Document_Removed_Reason, $IN_Document_Removed_Date;

$IN_Document_Date_Min = mktime (00, 00, 00, $IN_Document_Search_Month1, $IN_Document_Search_Day1, $IN_Document_Search_Year1);

$IN_Document_Date_Max = mktime (24, 59, 59, $IN_Document_Search_Month1, $IN_Document_Search_Day1, $IN_Document_Search_Year1);

$sql = "SELECT * FROM edocphp_main_in WHERE Document_Received_Date >='$IN_Document_Date_Min' AND Document_Received_Date <='$IN_Document_Date_Max' AND Document_Removed!='YES'";

$sql_res = mysql_query($sql,$dbc) or die(mysql_error());

if ($search_view_type == "0"){
search_result_in_show($sql_res);
}

if ($search_view_type == "1"){
search_result_in_show_full($sql_res);
}
}

function searchin_Issued_Date(){ 
global $dbcs, $search_view_type, $dbc;
global $Search_For, $IN_Document_Search_Day1, $IN_Document_Search_Month1, $IN_Document_Search_Year1, $IN_Document_U_No, $IN_Document_Type, $IN_Document_From, $IN_Document_From2, $IN_Document_Subject, $IN_Document_To1,  $IN_Document_To2, $IN_Document_To3, $IN_Document_To4, $IN_Document_To5, $IN_Document_Received_Hour, $IN_Document_Received_Minute, $IN_Document_Received_Month, $IN_Document_Received_Day, $IN_Document_Received_Year, $IN_Document_Issued_Hour, $IN_Document_Issued_Minute, $IN_Document_Issued_Month, $IN_Document_Issued_Day, $IN_Document_Issued_Year, $IN_Document_Stored_Date, $IN_Document_Physical_File, $IN_Document_Path, $IN_Document_Details, $IN_Document_Actions_Needed, $IN_Document_Actions_Performed, $IN_Document_All_Actions_Completed, $IN_Document_Comments, $IN_Document_Related, $IN_Document_Removed,$IN_Document_Removed_Reason, $IN_Document_Removed_Date;

$IN_Document_Date_Min = mktime (00, 00, 00, $IN_Document_Search_Month1, $IN_Document_Search_Day1, $IN_Document_Search_Year1);

$IN_Document_Date_Max = mktime (24, 59, 59, $IN_Document_Search_Month1, $IN_Document_Search_Day1, $IN_Document_Search_Year1);

$sql = "SELECT * FROM edocphp_main_in WHERE Document_Issued_Date >='$IN_Document_Date_Min' AND Document_Issued_Date <='$IN_Document_Date_Max' AND Document_Removed!='YES'";

$sql_res = mysql_query($sql,$dbc) or die(mysql_error());

if ($search_view_type == "0"){
search_result_in_show($sql_res);
}

if ($search_view_type == "1"){
search_result_in_show_full($sql_res);
}
}

//functions for searching whith combined search

function combined_search_1(){ 
global $dbcs, $search_view_type, $dbc;
global $Search_For, $Search_For1, $IN_Document_Search_Day2, $IN_Document_Search_Month2, $IN_Document_Search_Year2, $IN_Document_Search_Day1, $IN_Document_Search_Month1, $IN_Document_Search_Year1, $IN_Document_U_No, $IN_Document_Type, $IN_Document_From, $IN_Document_From2, $IN_Document_Subject, $IN_Document_To1,  $IN_Document_To2, $IN_Document_To3, $IN_Document_To4, $IN_Document_To5, $IN_Document_Received_Hour, $IN_Document_Received_Minute, $IN_Document_Received_Month, $IN_Document_Received_Day, $IN_Document_Received_Year, $IN_Document_Issued_Hour, $IN_Document_Issued_Minute, $IN_Document_Issued_Month, $IN_Document_Issued_Day, $IN_Document_Issued_Year, $IN_Document_Stored_Date, $IN_Document_Physical_File, $IN_Document_Path, $IN_Document_Details, $IN_Document_Actions_Needed, $IN_Document_Actions_Performed, $IN_Document_All_Actions_Completed, $IN_Document_Comments, $IN_Document_Related, $IN_Document_Removed,$IN_Document_Removed_Reason, $IN_Document_Removed_Date;

$IN_Document_Date_Min = mktime (00, 00, 00, $IN_Document_Search_Month1, $IN_Document_Search_Day1, $IN_Document_Search_Year1);

$IN_Document_Date_Max = mktime (24, 59, 59, $IN_Document_Search_Month2, $IN_Document_Search_Day2, $IN_Document_Search_Year2);

$sql = "SELECT * FROM edocphp_main_in WHERE ((Document_Issued_Date >='$IN_Document_Date_Min' AND Document_Issued_Date <='$IN_Document_Date_Max') AND Document_Removed!='YES')";

$sql_res = mysql_query($sql,$dbc) or die(mysql_error());

if ($search_view_type == "0"){
search_result_in_show($sql_res);
}

if ($search_view_type == "1"){
search_result_in_show_full($sql_res);
}
}

function combined_search_2(){ 
global $dbcs, $search_view_type, $dbc;
global $Search_For, $Search_For1, $IN_Document_Search_Day2, $IN_Document_Search_Month2, $IN_Document_Search_Year2, $IN_Document_Search_Day1, $IN_Document_Search_Month1, $IN_Document_Search_Year1, $IN_Document_U_No, $IN_Document_Type, $IN_Document_From, $IN_Document_From2, $IN_Document_Subject, $IN_Document_To1,  $IN_Document_To2, $IN_Document_To3, $IN_Document_To4, $IN_Document_To5, $IN_Document_Received_Hour, $IN_Document_Received_Minute, $IN_Document_Received_Month, $IN_Document_Received_Day, $IN_Document_Received_Year, $IN_Document_Issued_Hour, $IN_Document_Issued_Minute, $IN_Document_Issued_Month, $IN_Document_Issued_Day, $IN_Document_Issued_Year, $IN_Document_Stored_Date, $IN_Document_Physical_File, $IN_Document_Path, $IN_Document_Details, $IN_Document_Actions_Needed, $IN_Document_Actions_Performed, $IN_Document_All_Actions_Completed, $IN_Document_Comments, $IN_Document_Related, $IN_Document_Removed,$IN_Document_Removed_Reason, $IN_Document_Removed_Date;

$IN_Document_Date_Min = mktime (00, 00, 00, $IN_Document_Search_Month1, $IN_Document_Search_Day1, $IN_Document_Search_Year1);

$IN_Document_Date_Max = mktime (24, 59, 59, $IN_Document_Search_Month2, $IN_Document_Search_Day2, $IN_Document_Search_Year2);

$sql = "SELECT * FROM edocphp_main_in WHERE ((Document_Issued_Date >='$IN_Document_Date_Min' AND Document_Issued_Date <='$IN_Document_Date_Max') AND Document_From LIKE '%$Search_For%' AND Document_Removed!='YES' AND Document_Removed!='YES')";

$sql_res = mysql_query($sql,$dbc) or die(mysql_error());

if ($search_view_type == "0"){
search_result_in_show($sql_res);
}

if ($search_view_type == "1"){
search_result_in_show_full($sql_res);
}
}

function combined_search_3(){ 
global $dbcs, $search_view_type, $dbc;
global $Search_For, $Search_For1, $IN_Document_Search_Day2, $IN_Document_Search_Month2, $IN_Document_Search_Year2, $IN_Document_Search_Day1, $IN_Document_Search_Month1, $IN_Document_Search_Year1, $IN_Document_U_No, $IN_Document_Type, $IN_Document_From, $IN_Document_From2, $IN_Document_Subject, $IN_Document_To1,  $IN_Document_To2, $IN_Document_To3, $IN_Document_To4, $IN_Document_To5, $IN_Document_Received_Hour, $IN_Document_Received_Minute, $IN_Document_Received_Month, $IN_Document_Received_Day, $IN_Document_Received_Year, $IN_Document_Issued_Hour, $IN_Document_Issued_Minute, $IN_Document_Issued_Month, $IN_Document_Issued_Day, $IN_Document_Issued_Year, $IN_Document_Stored_Date, $IN_Document_Physical_File, $IN_Document_Path, $IN_Document_Details, $IN_Document_Actions_Needed, $IN_Document_Actions_Performed, $IN_Document_All_Actions_Completed, $IN_Document_Comments, $IN_Document_Related, $IN_Document_Removed,$IN_Document_Removed_Reason, $IN_Document_Removed_Date;

$IN_Document_Date_Min = mktime (00, 00, 00, $IN_Document_Search_Month1, $IN_Document_Search_Day1, $IN_Document_Search_Year1);

$IN_Document_Date_Max = mktime (24, 59, 59, $IN_Document_Search_Month2, $IN_Document_Search_Day2, $IN_Document_Search_Year2);

$sql = "SELECT * FROM edocphp_main_in WHERE ((Document_Issued_Date >='$IN_Document_Date_Min' AND Document_Issued_Date <='$IN_Document_Date_Max') AND Document_To1 LIKE '%$Search_For%' AND Document_Removed!='YES')";

$sql_res = mysql_query($sql,$dbc) or die(mysql_error());

if ($search_view_type == "0"){
search_result_in_show($sql_res);
}

if ($search_view_type == "1"){
search_result_in_show_full($sql_res);
}
}

function combined_search_4(){ 
global $dbcs, $search_view_type, $dbc;
global $Search_For, $Search_For1, $IN_Document_Search_Day2, $IN_Document_Search_Month2, $IN_Document_Search_Year2, $IN_Document_Search_Day1, $IN_Document_Search_Month1, $IN_Document_Search_Year1, $IN_Document_U_No, $IN_Document_Type, $IN_Document_From, $IN_Document_From2, $IN_Document_Subject, $IN_Document_To1,  $IN_Document_To2, $IN_Document_To3, $IN_Document_To4, $IN_Document_To5, $IN_Document_Received_Hour, $IN_Document_Received_Minute, $IN_Document_Received_Month, $IN_Document_Received_Day, $IN_Document_Received_Year, $IN_Document_Issued_Hour, $IN_Document_Issued_Minute, $IN_Document_Issued_Month, $IN_Document_Issued_Day, $IN_Document_Issued_Year, $IN_Document_Stored_Date, $IN_Document_Physical_File, $IN_Document_Path, $IN_Document_Details, $IN_Document_Actions_Needed, $IN_Document_Actions_Performed, $IN_Document_All_Actions_Completed, $IN_Document_Comments, $IN_Document_Related, $IN_Document_Removed,$IN_Document_Removed_Reason, $IN_Document_Removed_Date;

$IN_Document_Date_Min = mktime (00, 00, 00, $IN_Document_Search_Month1, $IN_Document_Search_Day1, $IN_Document_Search_Year1);

$IN_Document_Date_Max = mktime (24, 59, 59, $IN_Document_Search_Month2, $IN_Document_Search_Day2, $IN_Document_Search_Year2);

$sql = "SELECT * FROM edocphp_main_in WHERE ((Document_Issued_Date >='$IN_Document_Date_Min' AND Document_Issued_Date <='$IN_Document_Date_Max') AND Document_Type='$Search_For' AND Document_Removed!='YES')";

$sql_res = mysql_query($sql,$dbc) or die(mysql_error());

if ($search_view_type == "0"){
search_result_in_show($sql_res);
}

if ($search_view_type == "1"){
search_result_in_show_full($sql_res);
}
}

function combined_search_5(){ 
global $dbcs, $search_view_type, $dbc;
global $Search_For, $Search_For1, $IN_Document_Search_Day2, $IN_Document_Search_Month2, $IN_Document_Search_Year2, $IN_Document_Search_Day1, $IN_Document_Search_Month1, $IN_Document_Search_Year1, $IN_Document_U_No, $IN_Document_Type, $IN_Document_From, $IN_Document_From2, $IN_Document_Subject, $IN_Document_To1,  $IN_Document_To2, $IN_Document_To3, $IN_Document_To4, $IN_Document_To5, $IN_Document_Received_Hour, $IN_Document_Received_Minute, $IN_Document_Received_Month, $IN_Document_Received_Day, $IN_Document_Received_Year, $IN_Document_Issued_Hour, $IN_Document_Issued_Minute, $IN_Document_Issued_Month, $IN_Document_Issued_Day, $IN_Document_Issued_Year, $IN_Document_Stored_Date, $IN_Document_Physical_File, $IN_Document_Path, $IN_Document_Details, $IN_Document_Actions_Needed, $IN_Document_Actions_Performed,$IN_Document_All_Actions_Completed, $IN_Document_Comments, $IN_Document_Related, $IN_Document_Removed,$IN_Document_Removed_Reason, $IN_Document_Removed_Date;

$sql = "SELECT * FROM edocphp_main_in WHERE (Document_From LIKE '%$Search_For%' AND Document_To1 LIKE '%$Search_For%' AND Document_Removed!='YES')";

$sql_res = mysql_query($sql,$dbc) or die(mysql_error());

if ($search_view_type == "0"){
search_result_in_show($sql_res);
}

if ($search_view_type == "1"){
search_result_in_show_full($sql_res);
}
}

function combined_search_6(){ 
global $dbcs, $search_view_type, $dbc;
global $Search_For, $Search_For1, $IN_Document_Search_Day2, $IN_Document_Search_Month2, $IN_Document_Search_Year2, $IN_Document_Search_Day1, $IN_Document_Search_Month1, $IN_Document_Search_Year1, $IN_Document_U_No, $IN_Document_Type, $IN_Document_From, $IN_Document_From2, $IN_Document_Subject, $IN_Document_To1,  $IN_Document_To2, $IN_Document_To3, $IN_Document_To4, $IN_Document_To5, $IN_Document_Received_Hour, $IN_Document_Received_Minute, $IN_Document_Received_Month, $IN_Document_Received_Day, $IN_Document_Received_Year, $IN_Document_Issued_Hour, $IN_Document_Issued_Minute, $IN_Document_Issued_Month, $IN_Document_Issued_Day, $IN_Document_Issued_Year, $IN_Document_Stored_Date, $IN_Document_Physical_File, $IN_Document_Path, $IN_Document_Details, $IN_Document_Actions_Needed, $IN_Document_Actions_Performed,$IN_Document_All_Actions_Completed, $IN_Document_Comments, $IN_Document_Related, $IN_Document_Removed,$IN_Document_Removed_Reason, $IN_Document_Removed_Date;

$sql = "SELECT * FROM edocphp_main_in WHERE (Document_From LIKE '%$Search_For%' AND Document_Type='$Search_For1' AND Document_Removed!='YES')";

$sql_res = mysql_query($sql,$dbc) or die(mysql_error());

if ($search_view_type == "0"){
search_result_in_show($sql_res);
}

if ($search_view_type == "1"){
search_result_in_show_full($sql_res);
}
}

function combined_search_7(){ 
global $dbcs, $search_view_type, $dbc;
global $Search_For, $Search_For1, $IN_Document_Search_Day2, $IN_Document_Search_Month2, $IN_Document_Search_Year2, $IN_Document_Search_Day1, $IN_Document_Search_Month1, $IN_Document_Search_Year1, $IN_Document_U_No, $IN_Document_Type, $IN_Document_From, $IN_Document_From2, $IN_Document_Subject, $IN_Document_To1,  $IN_Document_To2, $IN_Document_To3, $IN_Document_To4, $IN_Document_To5, $IN_Document_Received_Hour, $IN_Document_Received_Minute, $IN_Document_Received_Month, $IN_Document_Received_Day, $IN_Document_Received_Year, $IN_Document_Issued_Hour, $IN_Document_Issued_Minute, $IN_Document_Issued_Month, $IN_Document_Issued_Day, $IN_Document_Issued_Year, $IN_Document_Stored_Date, $IN_Document_Physical_File, $IN_Document_Path, $IN_Document_Details, $IN_Document_Actions_Needed, $IN_Document_Actions_Performed, $IN_Document_All_Actions_Completed, $IN_Document_Comments, $IN_Document_Related, $IN_Document_Removed,$IN_Document_Removed_Reason, $IN_Document_Removed_Date;

$IN_Document_Date_Min = mktime (00, 00, 00, $IN_Document_Search_Month1, $IN_Document_Search_Day1, $IN_Document_Search_Year1);

$IN_Document_Date_Max = mktime (24, 59, 59, $IN_Document_Search_Month2, $IN_Document_Search_Day2, $IN_Document_Search_Year2);

$sql = "SELECT * FROM edocphp_main_in WHERE ((Document_Issued_Date >='$IN_Document_Date_Min' AND Document_Issued_Date <='$IN_Document_Date_Max') AND Document_Removed='$Search_For' AND Document_Removed!='YES')";

$sql_res = mysql_query($sql,$dbc) or die(mysql_error());

if ($search_view_type == "0"){
search_result_in_show($sql_res);
}

if ($search_view_type == "1"){
search_result_in_show_full($sql_res);
}
}


//global functions to show search results

function search_result_in_show($sql_res){

$no_of_records = mysql_num_rows($sql_res);
 
echo '<br><b>Search/Edit/Remove - Incoming:</b><br><br>Records Found:'.$no_of_records.'<br><br>';

echo "<center>[ <b><a href=\"javascript:history.go(-1);\">Go Back</a></b> ]</center><br><br>";

echo '<table width="100%" border="0">
  <tr>
    <th scope="col">Unique No</th>
    <th scope="col">Type</th>
    <th scope="col">From</th>
    <th scope="col">Subject</th>
    <th scope="col">To 1</th>
    <th scope="col">To 2</th>
    <th scope="col">Received</th>
	<th scope="col">Physical File</th>
	<th scope="col">Comments</th>
  </tr>';
  
while ($record = mysql_fetch_array($sql_res)) {

$IN_Document_U_No = $record['Document_U_No'];
$IN_Document_Type = $record['Document_Type'];
$IN_Document_From = $record['Document_From'];
$IN_Document_From2 = $record['Document_From2'];
$IN_Document_Subject = $record['Document_Subject'];
$IN_Document_To1 = $record['Document_To1'];
$IN_Document_To2 = $record['Document_To2'];
$IN_Document_To3 = $record['Document_To3'];
$IN_Document_To4 = $record['Document_To4'];
$IN_Document_To5 = $record['Document_To5'];
$IN_Document_Received_Date = $record['Document_Received_Date'];
$IN_Document_Issued_Date = $record['Document_Issued_Date'];
$IN_Document_Stored_Date = date("d/m/y :: H:i",$record['Document_Stored_Date']);
$IN_Document_Physical_File = $record['Document_Physical_File'];
$IN_Document_Details = $record['Document_Details'];
$IN_Document_Actions_Needed = $record['Document_Actions_Needed'];
$IN_Document_Actions_Performed = $record['Document_Actions_Performed'];
$IN_Document_All_Actions_Completed = $record['Document_All_Actions_Completed'];
$IN_Document_Path = $record['Document_Path'];
$IN_Document_Comments = $record['Document_Comments'];
$IN_Document_Related = $record['Document_Related'];
$IN_Document_Removed = $record['Document_Removed'];
$IN_Document_Removed_Reason = $record['Document_Removed_Reason'];
$IN_Document_Removed_Date = $record['Document_Removed_Date'];

if (!empty($IN_Document_Received_Date)){
$IN_Document_Received_Month = date("m",$IN_Document_Received_Date);
$IN_Document_Received_Day = date("d",$IN_Document_Received_Date);
$IN_Document_Received_Year = date("y",$IN_Document_Received_Date);
$IN_Document_Received_Hour = date("H",$IN_Document_Received_Date);
$IN_Document_Received_Minute = date("i",$IN_Document_Received_Date);
$IN_Document_Received_Full = date("d/m/y",$IN_Document_Received_Date);
}

if (!empty($IN_Document_Issued_Date)){
$IN_Document_Issued_Month = date("m",$IN_Document_Issued_Date);
$IN_Document_Issued_Day = date("d",$IN_Document_Issued_Date);
$IN_Document_Issued_Year = date("y",$IN_Document_Issued_Date);
$IN_Document_Issued_Hour = date("H",$IN_Document_Issued_Date);
$IN_Document_Issued_Minute = date("i",$IN_Document_Issued_Date);
}

echo '<tr><td colspan="9"></td><tr>
  <tr>
    <th scope="col">'.$IN_Document_U_No.'</th>
    <th scope="col">'.$IN_Document_Type.'</th>
    <th scope="col">'.$IN_Document_From.'</th>
    <th scope="col">'.$IN_Document_Subject.'</th>
    <th scope="col">'.$IN_Document_To1.'</th>
    <th scope="col">'.$IN_Document_To2.'</th>
    <th scope="col">'.$IN_Document_Received_Full.'</th>
	<th scope="col">'.$IN_Document_Physical_File.'</th>
	<th scope="col">'.$IN_Document_Comments.'</th>
  </tr>';


		}
echo "</table><br><br><center>[ <b><a href=\"javascript:history.go(-1);\">Go Back</a></b> ]</center><br>";	
	}
	
function search_result_in_show_full($sql_res){


$no_of_records = mysql_num_rows($sql_res);
 
echo '<br><b>Search/Edit/Remove - Incoming:</b><br><br>Records Found:'.$no_of_records.'<br><br>';
echo "<center>[ <b><a href=\"javascript:history.go(-1);\">Go Back</a></b> ]</center><br><br>";

  
while ($record = mysql_fetch_array($sql_res)) {
$id=$record['id'];
$IN_Document_U_No = $record['Document_U_No'];
$IN_Document_Type = $record['Document_Type'];
$IN_Document_From = $record['Document_From'];
$IN_Document_From2 = $record['Document_From2'];
$IN_Document_Subject = $record['Document_Subject'];
$IN_Document_To1 = $record['Document_To1'];
$IN_Document_To2 = $record['Document_To2'];
$IN_Document_To3 = $record['Document_To3'];
$IN_Document_To4 = $record['Document_To4'];
$IN_Document_To5 = $record['Document_To5'];
$IN_Document_Received_Date = $record['Document_Received_Date'];
$IN_Document_Issued_Date = $record['Document_Issued_Date'];
$IN_Document_Stored_Day1 = date("d",$record['Document_Stored_Date']);
$IN_Document_Stored_Month1 = date("m",$record['Document_Stored_Date']);
$IN_Document_Stored_Year1 = date("y",$record['Document_Stored_Date']);
$IN_Document_Stored_Hour1 = date("H",$record['Document_Stored_Date']);
$IN_Document_Stored_Minute1 = date("i",$record['Document_Stored_Date']);
$IN_Document_Physical_File = $record['Document_Physical_File'];
$IN_Document_Details = $record['Document_Details'];
$IN_Document_Actions_Needed = $record['Document_Actions_Needed'];
$IN_Document_Actions_Performed = $record['Document_Actions_Performed'];
$IN_Document_All_Actions_Completed = $record['Document_All_Actions_Completed'];
$IN_Document_Path = $record['Document_Path'];
$IN_Document_Comments = $record['Document_Comments'];
$IN_Document_Related = $record['Document_Related'];
$IN_Document_Removed = $record['Document_Removed'];
$IN_Document_Removed_Reason = $record['Document_Removed_Reason'];
$IN_Document_Removed_Date = $record['Document_Removed_Date'];

if (!empty($IN_Document_Received_Date)){
$IN_Document_Received_Month = date("m",$IN_Document_Received_Date);
$IN_Document_Received_Day = date("d",$IN_Document_Received_Date);
$IN_Document_Received_Year = date("y",$IN_Document_Received_Date);
$IN_Document_Received_Hour = date("H",$IN_Document_Received_Date);
$IN_Document_Received_Minute = date("i",$IN_Document_Received_Date);
$IN_Document_Received_Full = date("d/m/y",$IN_Document_Received_Date);
}

if (!empty($IN_Document_Issued_Date)){
$IN_Document_Issued_Month = date("m",$IN_Document_Issued_Date);
$IN_Document_Issued_Day = date("d",$IN_Document_Issued_Date);
$IN_Document_Issued_Year = date("y",$IN_Document_Issued_Date);
$IN_Document_Issued_Hour = date("H",$IN_Document_Issued_Date);
$IN_Document_Issued_Minute = date("i",$IN_Document_Issued_Date);
}


echo '<table width="100%" border="0" bgcolor="#FFFF66">
  <tr>
    <th scope="col">&nbsp;</th>
  </tr>
</table><form id="form" name="form" method="post" action="main_in.php">
  <table width="100%" border="0">
    <tr bgcolor="#FFFFCC">
      <td valign="top"><span class="style7">Document Unique No</span></td>
      <td valign="top">';
	  if (($_COOKIE['access'] == "2") || ($_COOKIE['access'] == "3")){
	  echo'<input name="IN_Document_U_No" value="'.$IN_Document_U_No.'" type="text" id="IN_Document_U_No" />';
	  }else{
	  echo'<b>'.$IN_Document_U_No.'</b>';
	  }
	  echo'<br>(to prevent mistakes, only admins can edit this field, changing this without reason may cause problems)</td>
      <td valign="top">&nbsp;</td>
      <td valign="top"><span class="style7">Type</span></td>
      <td valign="top"><span class="style7">
        <select name="IN_Document_Type"  size="1" id="IN_Document_Type">';
          if ($IN_Document_Type=="LETTER"){
		  echo'<option value="LETTER" selected="selected">Letter</option>
          <option value="FAX">FAX</option>
          <option value="EMAIL">EMail</option>
          <option value="OTHER">Other</option>';
		  }
		     if ($IN_Document_Type=="FAX"){
		  echo'<option value="LETTER">Letter</option>
          <option value="FAX" selected="selected">FAX</option>
          <option value="EMAIL">EMail</option>
          <option value="OTHER">Other</option>';
		  }
		     if ($IN_Document_Type=="EMAIL"){
		  echo'<option value="LETTER">Letter</option>
          <option value="FAX" >FAX</option>
          <option value="EMAIL" selected="selected">EMail</option>
          <option value="OTHER">Other</option>';
		  }
		       if ($IN_Document_Type=="OTHER"){
		  echo'<option value="LETTER">Letter</option>
          <option value="FAX" >FAX</option>
          <option value="EMAIL" >EMail</option>
          <option value="OTHER" selected="selected">Other</option>';
		  }
        echo'</select>
      </span></td>
    </tr>
    <tr>
      <td valign="top"><span class="style7">From</span></td>
      <td valign="top"><input name="id" value="'.$id.'" type="hidden" /><input name="IN_Document_From" value="'.$IN_Document_From.'" type="text" id="IN_Document_From" /></td>
      <td valign="top">&nbsp;</td>
      <td valign="top"><span class="style7">From (2)</span></td>
      <td valign="top"><input name="IN_Document_From2" value="'.$IN_Document_From2.'" type="text" id="IN_Document_From2" /></td>
    </tr>
    <tr bgcolor="#FFFFCC">
      <td valign="top"><span class="style7">Subject</span></td>
      <td valign="top"><input name="IN_Document_Subject" value="'.$IN_Document_Subject.'" type="text" id="IN_Document_Subject" /></td>
      <td valign="top">&nbsp;</td>
      <td valign="top"><span class="style7">To (Recipient)1</span></td>
      <td valign="top"><input name="IN_Document_To1" value="'.$IN_Document_To1.'" type="text" id="IN_Document_To1" /></td>
    </tr>
    <tr>
      <td valign="top"><span class="style7">To (Recipient) (2)</span></td>
      <td valign="top"><input name="IN_Document_To2" value="'.$IN_Document_To2.'" type="text" id="IN_Document_To2" /></td>
      <td valign="top">&nbsp;</td>
      <td valign="top" nowrap="nowrap"><span class="style7">To(Recipient) 3</span></td>
      <td valign="top"><input name="IN_Document_To3" value="'.$IN_Document_To3.'" type="text" id="IN_Document_To3" /></td>
    </tr>
    <tr bgcolor="#FFFFCC">
      <td valign="top"><span class="style7">
             To(Recipient) 4</span></td>
      <td valign="top"><input name="IN_Document_To4" value="'.$IN_Document_To4.'" type="text" id="IN_Document_To4" /></td>
      <td valign="top">&nbsp;</td>
      <td valign="top"><span class="style7" >To (Recipient) 5</span></td>
      <td valign="top"><span class="style7">
        <textarea name="IN_Document_To5" cols="40" rows="5" id="IN_Document_To5">'.$IN_Document_To5.'</textarea>
      </span></td>
    </tr>
    <tr>
      <td valign="top"><span class="style7">Issued Date</span></td>
      <td valign="top"><input name="IN_Document_Issued_Day" value="'.$IN_Document_Issued_Day.'" type="text" size="2" maxlength="2" id="IN_Document_Issued_Day" />/<input name="IN_Document_Issued_Month" value="'.$IN_Document_Issued_Month.'" type="text" size="2" maxlength="2" id="IN_Document_Issued_Month" />/<input 	   		name="IN_Document_Issued_Year" value="'.$IN_Document_Issued_Year.'" type="text" size="4" maxlength="4" id="IN_Document_Issued_Year" /> :: <input 		  		name="IN_Document_Issued_Hour" value="'.$IN_Document_Issued_Hour.'" type="text" size="2" maxlength="2" id="IN_Document_Issued_Hour" />:<input 	  name="IN_Document_Issued_Minute" value="'.$IN_Document_Issued_Minute.'" type="text"  size="2" maxlength="2" id="IN_Document_Issued_Minute" /></td>
      <td valign="top">&nbsp;</td>
      <td valign="top"><span class="style7">Received Date
		</span></td>
      <td valign="top"><input name="IN_Document_Received_Day" value="'.$IN_Document_Received_Day.'" type="text" size="2" maxlength="2" id="IN_Document_Received_Day" />/<input name="IN_Document_Received_Month" value="'.$IN_Document_Received_Month.'" type="text" size="2" maxlength="2" id="IN_Document_Received_Month" />/<input 	   		name="IN_Document_Received_Year" value="'.$IN_Document_Received_Year.'" type="text" size="4" maxlength="4" id="IN_Document_Received_Year" /> :: <input 		  		name="IN_Document_Received_Hour" value="'.$IN_Document_Received_Hour.'" type="text" size="2" maxlength="2" id="IN_Document_Received_Hour" />:<input 	  name="IN_Document_Received_Minute" value="'.$IN_Document_Received_Minute.'" type="text" size="2" maxlength="2" id="IN_Document_Received_Minute" /></td>
    </tr>
    <tr  bgcolor="#FFFFCC">
      <td valign="top"><span class="style7">Stored Date</span></td>
      <td valign="top"><input name="IN_Document_Stored_Day1" type="text" size="2" maxlength="2" value="'.$IN_Document_Stored_Day1.'"/>/<input name="IN_Document_Stored_Month1" type="text" size="2" maxlength="2" value="'.$IN_Document_Stored_Month1.'"/>/<input name="IN_Document_Stored_Year1" type="text" size="4" maxlength="4" value="'.$IN_Document_Stored_Year1.'"/> :: <input name="IN_Document_Stored_Hour1" type="text" size="2" maxlength="2" value="'.$IN_Document_Stored_Hour1.'"/>:<input name="IN_Document_Stored_Minute1" type="text" size="2" maxlength="2" value="'.$IN_Document_Stored_Minute1.'"/></td>
      <td valign="top">&nbsp;</td>
      <td valign="top"><span class="style7">Physical File</span></td>
      <td valign="top"><input name="IN_Document_Physical_File" value="'.$IN_Document_Physical_File.'" type="text" id="IN_Document_Physical_File" /></td>
    </tr>
    <tr>
      <td valign="top"><span class="style7">Path</span></td>
      <td valign="top"><input name="IN_Document_Path" value="'.$IN_Document_Path.'" size="40" type="text" id="IN_Document_Path" /><br> <a href="'.$IN_Document_Path.'" target="_blank"><br><b>Open File</b></a></td>
      <td valign="top">&nbsp;</td>
      <td valign="top"><span class="style7">
              </span></td>
      <td valign="top"><span class="style7">
        <textarea name="IN_Document_Details"  cols="40" rows="5" id="IN_Document_Details">'.$IN_Document_Details.'</textarea>
      </span></td>
    </tr>
    <tr bgcolor="#FFFFCC">
      <td valign="top"><span class="style7">Actions Needed</span></td>
      <td valign="top"><span class="style7">
        <textarea name="IN_Document_Actions_Needed"  cols="40" rows="5" id="IN_Document_Actions_Needed">'.$IN_Document_Actions_Needed.'</textarea>
      </span></td>
      <td valign="top">&nbsp;</td>
      <td valign="top"><span class="style7">Actions Performed</span></td>
      <td valign="top"><span class="style7">
        <textarea name="IN_Document_Actions_Performed" cols="40" rows="5" id="IN_Document_Actions_Performed">'.$IN_Document_Actions_Performed.'</textarea>
      </span></td>
    </tr>
    <tr>
      <td valign="top"><span class="style7"> All Actions Completed</span></td>
      <td valign="top"><span class="style7">
        <select name="IN_Document_All_Actions_Completed" size="1" id="IN_Document_All_Actions_Completed">';
		if ($IN_Document_All_Actions_Completed=="NO"){
          echo'<option value="NO" selected="selected">NO</option>
          <option value="YES">YES</option>
          <option value="NOACTION" >NO ACTION REQUIRED</option>';
		  }
		  if ($IN_Document_All_Actions_Completed=="YES"){
          echo'<option value="NO" >NO</option>
          <option value="YES" selected="selected">YES</option>
          <option value="NOACTION" >NO ACTION REQUIRED</option>';
		  }
		  if ($IN_Document_All_Actions_Completed=="NOACTION"){
          echo'<option value="NO" >NO</option>
          <option value="YES" selected="selected">YES</option>
          <option value="NOACTION" selected="selected">NO ACTION REQUIRED</option>';
		  }
          echo '</select>
      </span> </td>
      <td valign="top">&nbsp;</td>
      <td valign="top"><span class="style7">Comments</span></td>
      <td valign="top"><span class="style7">
        <textarea name="IN_Document_Comments" cols="40" rows="5" id="IN_Document_Comments">'.$IN_Document_Comments.'</textarea>
      </span></td>
    </tr>
	
    <tr>
	<td valign="top" bgcolor="#FFFFCC"><span class="style7" >Related Documents
              </span></td>
      <td valign="top" bgcolor="#FFFFCC"><span class="style7"><textarea name="IN_Document_Related" cols="40" rows="5" id="IN_Document_Related">'.$IN_Document_Related.'</textarea></td> 
      <td valign="top" bgcolor="#FFFF66">&nbsp;</td>
      <td valign="top" bgcolor="#FFFF66"><span class="style7"><font color="FF0000"><b>Remove</b></font> <br> (Set this to <i>Yes</i> if you want this document to be removed.)</span></td>
      <td valign="top" bgcolor="#FFFF66"><span class="style7"><select name="IN_Document_Removed" size="1" >';
	  if ($IN_Document_Removed=="NO"){
          echo '<option value="NO" selected="selected">NO</option>
          <option value="YES">YES</option>';
		  }
		  if (empty($IN_Document_Removed)){
          echo '<option value="NO" selected="selected">NO</option>
          <option value="YES">YES</option>';
		  }
		  if ($IN_Document_Removed=="YES"){
          echo '<option value="NO" >NO</option>
          <option value="YES" selected="selected">YES</option>';
		  }
           echo'</select><br>(If you set this to YES and save the form, this file will not appear again in any future search. You will not be able to bring back this document. This can be done only from Administration Page. The record will not be deleted (for no reason should anyone delete a record, this may cause also software malfunction), but it will marked as Removed and will not appear anywhere.)
		  
        
      </span></td>
    </tr>
    <tr bgcolor="#FFFF66">
      <td valign="top"><span class="style7">Removed Reason</span></td>
      <td valign="top"><div align="center"><textarea name="IN_Document_Removed_Reason" cols="40" rows="5" id="IN_Document_Removed_Reason">'.$IN_Document_Removed_Reason.'</textarea></div></td>
      <td valign="top">&nbsp;</td>
      <td valign="top"><span class="style7">Removed Date</span></td>
      <td valign="middle"><span class="style7"><div align="center">-This will be automatically filled when you Save this form in the case you have choose to remove this document-</div>
      </span></td>
    </tr>
  </table>
  <input type="hidden" name="op" value="update_in">
  <br><div align="center"><input type="submit" value="If you have Changed or Removed this Record Click Here to Save your Changes"></div>
</form>';
echo "<br><br><center>[ <b><a href=\"javascript:history.go(-1);\">Go Back</a></b> ]</center><br>";	
		}

	}
	

function update_in(){
global $dbcs, $dbc;
global $id, $IN_Document_U_No, $IN_Document_Type, $IN_Document_From, $IN_Document_From2, $IN_Document_Subject, $IN_Document_To1, $IN_Document_To2, $IN_Document_To3, $IN_Document_To4, $IN_Document_To5, $IN_Document_Received_Hour, $IN_Document_Received_Minute,$IN_Document_Received_Month, $IN_Document_Received_Day, $IN_Document_Received_Year, $IN_Document_Issued_Hour, $IN_Document_Issued_Minute, $IN_Document_Issued_Month, $IN_Document_Issued_Day, $IN_Document_Issued_Year, $IN_Document_Stored_Day1, $IN_Document_Stored_Month1, $IN_Document_Stored_Year1, $IN_Document_Stored_Hour1, $IN_Document_Stored_Minute1, $IN_Document_Physical_File, $IN_Document_Path, $IN_Document_Details, $IN_Document_Actions_Needed, $IN_Document_Actions_Performed, $IN_Document_All_Actions_Completed, $IN_Document_Comments, $IN_Document_Related, $IN_Document_Removed, $IN_Document_Removed_Reason, $IN_Document_Removed_Date;

//check for document Issued date
If (!empty($IN_Document_Issued_Minute) && !empty($IN_Document_Issued_Hour) &&  !empty($IN_Document_Issued_Month) &&  !empty($IN_Document_Issued_Day) &&  !empty($IN_Document_Issued_Year)){
$IN_Document_Issued_Date = mktime ($IN_Document_Issued_Hour, $IN_Document_Issued_Minute, 00, $IN_Document_Issued_Month, $IN_Document_Issued_Day,$IN_Document_Issued_Year);
}else{
if (empty($IN_Document_Issued_Hour) AND ( !empty($IN_Document_Issued_Month) && !empty($IN_Document_Issued_Day) && !empty($IN_Document_Issued_Year))){
$IN_Document_Issued_Date = mktime (00, 00, 00, $IN_Document_Issued_Month, $IN_Document_Issued_Day, $IN_Document_Issued_Year);
echo " Issued Date Will be Stored without hour and minute details becouse you did not set Issued Hour.<br>"; 
}else{
if ( empty($IN_Document_Issued_Minute) AND ( !empty($IN_Document_Issued_Month) && !empty($IN_Document_Issued_Day) && !empty($IN_Document_Issued_Year))){
$IN_Document_Issued_Date = mktime (00, 00, 00, $IN_Document_Issued_Month, $IN_Document_Issued_Day,$IN_Document_Issued_Year);
echo " Issued Date Will be Stored without hour and minute details becouse you did not set Issued Minute.<br>"; 
}else{
if (empty($IN_Document_Issued_Month) || empty($IN_Document_Issued_Day) || empty($IN_Document_Issued_Year)){
echo '<font color="FF0000"><b>Error</b>:</font>You must set correctly at least the day - month - year of Document Issued Date';
echo "<br><br><center>[ <b><a href=\"javascript:history.go(-1);\">Go Back</a></b> ]</center>";
include ("footer.php");
die();
			}
		}
	}
}

//check for document received date
If (!empty($IN_Document_Received_Minute) && !empty($IN_Document_Received_Hour) &&  !empty($IN_Document_Received_Month) &&  !empty($IN_Document_Received_Day) &&  !empty($IN_Document_Received_Year)){
$IN_Document_Received_Date = mktime ($IN_Document_Received_Hour, $IN_Document_Received_Minute, 00, $IN_Document_Received_Month, $IN_Document_Received_Day,$IN_Document_Received_Year);
}else{
if (empty($IN_Document_Received_Hour) AND ( !empty($IN_Document_Received_Month) && !empty($IN_Document_Received_Day) && !empty($IN_Document_Received_Year))){
$IN_Document_Received_Date = mktime (00, 00, 00, $IN_Document_Received_Month, $IN_Document_Received_Day, $IN_Document_Received_Year);
echo " Received Date Will be Stored without hour and minute details becouse you did not set Received Hour.<br>"; 
}else{
if ( empty($IN_Document_Received_Minute) AND ( !empty($IN_Document_Received_Month) && !empty($IN_Document_Received_Day) && !empty($IN_Document_Received_Year))){
$IN_Document_Received_Date = mktime (00, 00, 00, $IN_Document_Received_Month, $IN_Document_Received_Day,$IN_Document_Received_Year);
echo " Received Date Will be Stored without hour and minute details becouse you did not set Received Minute.<br>"; 
}else{
if (empty($IN_Document_Received_Month) || empty($IN_Document_Received_Day) || empty($IN_Document_Received_Year)){
echo '<font color="FF0000"><b>Error</b>:</font>You must set correctly at least the day - month - year of Document Received Date';
echo "<br><br><center>[ <b><a href=\"javascript:history.go(-1);\">Go Back</a></b> ]</center>";
include ("footer.php");
die();
			}
		}
	}
}


//check for document stored date
If (!empty($IN_Document_Stored_Minute1) && !empty($IN_Document_Stored_Hour1) &&  !empty($IN_Document_Stored_Month1) &&  !empty($IN_Document_Stored_Day1) &&  !empty($IN_Document_Stored_Year1)){
$IN_Document_Stored_Date1 = mktime ($IN_Document_Stored_Hour1, $IN_Document_Stored_Minute1, 00, $IN_Document_Stored_Month1, $IN_Document_Stored_Day1,$IN_Document_Stored_Year1);
}else{
if (empty($IN_Document_Stored_Hour1) AND ( !empty($IN_Document_Stored_Month1) && !empty($IN_Document_Stored_Day1) && !empty($IN_Document_Stored_Year))){
$IN_Document_Stored_Date1 = mktime (00, 00, 00, $IN_Document_Stored_Month1, $IN_Document_Stored_Day1, $IN_Document_Stored_Year1);
echo " Stored Date Will be Stored without hour and minute details becouse you did not set Stored Hour.<br>"; 
}else{
if ( empty($IN_Document_Stored_Minute1) AND ( !empty($IN_Document_Stored_Month1) && !empty($IN_Document_Stored_Day1) && !empty($IN_Document_Stored_Year1))){
$IN_Document_Stored_Date1 = mktime (00, 00, 00, $IN_Document_Stored_Month1, $IN_Document_Stored_Day1,$IN_Document_Stored_Year1);
echo " Stored Date Will be Stored without hour and minute details becouse you did not set Stored Minute.<br>"; 
}else{
if (empty($IN_Document_Stored_Month1) || empty($IN_Document_Stored_Day1) || empty($IN_Document_Stored_Year1)){
echo '<font color="FF0000"><b>Error</b>:</font>You must set correctly at least the day - month - year of Document Stored Date';
echo "<br><br><center>[ <b><a href=\"javascript:history.go(-1);\">Go Back</a></b> ]</center>";
include ("footer.php");
die();
			}
		}
	}
}

$sql = " UPDATE edocphp_main_in SET Document_U_No='$IN_Document_U_No', Document_Type='$IN_Document_Type', Document_From='$IN_Document_From', Document_From2='$IN_Document_From2', Document_Subject='$IN_Document_Subject', Document_To1='$IN_Document_To1', Document_To2='$IN_Document_To2', Document_To3='$IN_Document_To3', Document_To4='$IN_Document_To4', Document_To5='$IN_Document_To5', Document_Issued_Date='$IN_Document_Issued_Date', Document_Received_Date='$IN_Document_Received_Date', Document_Stored_Date='$IN_Document_Stored_Date1', Document_Physical_File='$IN_Document_Physical_File', Document_Path='$IN_Document_Path', Document_Details='$IN_Document_Details', Document_Actions_Needed='$IN_Document_Actions_Needed', Document_Actions_Performed='$IN_Document_Actions_Performed', Document_All_Actions_Completed='$IN_Document_All_Actions_Completed', Document_Comments='$IN_Document_Comments', Document_Removed='$IN_Document_Removed', Document_Removed_Reason='$IN_Document_Removed_Reason', Document_Removed_Date='$IN_Document_Removed_Date', Document_Related='$IN_Document_Related' WHERE id='$id'";

if (mysql_query($sql,$dbc)){
echo '<b><font color="#0000FF">Information Stored!</font></b><br><br>Select New Action from the panel above.';
} else {
$mysqlerror = mysql_error();
echo'<font color="FF0000"><b>Error</b>:</font> '.$mysqlerror.'';

echo "<br><br><center>[ <b><a href=\"javascript:history.go(-1);\">Go Back</a></b> ]</center>";
include ("footer.php");
die();
}
}




//navigation
switch($op) {
    case "save_newin":
    save_newin();
    break;

	case "newin":
    newin();
    break;
	
	case "update_in":
    update_in();
    break;
		
	case "search_result_in":
    search_result_in();
    break;
	
	case "searchin":
    searchin();
    break;
	
	case "searchin_U_No":
    searchin_U_No();
    break;
	
	case "searchin_Subject":
    searchin_Subject();
    break;
	
	case "searchin_To1":
    searchin_To1();
    break;
	
    case "searchin_To2":
    searchin_To2();
    break;
	
	case "searchin_From":
    searchin_From();
    break;
	
    case "searchin_All_Actions_Completed":
    searchin_All_Actions_Completed();
    break;
         
	case "searchin_Type":
    searchin_Type();
    break;
	
	case "searchin_Physical_File":
    searchin_Physical_File();
    break;
	
	case "searchin_Stored_Date":
    searchin_Stored_Date();
    break;
	
	case "searchin_Received_Date":
    searchin_Received_Date();
    break;
	
	case "searchin_Issued_Date":
    searchin_Issued_Date();
    break;
	
	case "combined_search_1":
    combined_search_1();
    break;
	
	case "combined_search_2":
    combined_search_2();
    break;
		
	case "combined_search_3":
    combined_search_3();
    break;
		
	case "combined_search_4":
    combined_search_4();
    break;
	
	case "combined_search_5":
    combined_search_5();
    break;
	
	case "combined_search_6":
    combined_search_6();
    break;
	
	case "combined_search_7":
    combined_search_7();
    break;
	
    default:
    mainselect();
    break;
		
}

include("footer.php");

} else {
//redirect back to login form if not authorized
echo "<META HTTP-EQUIV=\"refresh\" content=\"1;URL=index.php\">";
exit;
}

?>
</body>
</html>
Return current item: Simple E-document