    <? if($_SESSION['page'] == '5' and $_SESSION['section'] == '1') { ?>
<link href="../styles.css" rel="stylesheet" type="text/css" />
<link href="../admin.css" rel="stylesheet" type="text/css" />

	
    <script src="SpryAssets/SpryValidationTextField.js" type="text/javascript"></script>
    <script src="SpryAssets/SpryValidationSelect.js" type="text/javascript"></script>
    <link href="SpryAssets/SpryValidationTextField.css" rel="stylesheet" type="text/css" />
    <link href="SpryAssets/SpryValidationSelect.css" rel="stylesheet" type="text/css" />
<table width="95%" border="1" align="center" cellpadding="0" cellspacing="0" bordercolor="#CCCCCC">
      <tr>
        <td><table width="100%" border="0" align="center" cellpadding="0" cellspacing="0">
          <tr>
            <td class="Main_Text">Payment Managment</td>
            <td width="10%" class="Main_Text"><div align="right"><img src="image/more_info.gif" width="32" height="32" border="0" /></a></div></td>
          </tr>
          <tr>
            <td colspan="2">
            
            <? if ($_GET['stat'] == '') { ?>
            
            <p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<img src="image/subheader_icon.gif" width="12" height="12" /><strong class="text2">&nbsp;&nbsp;&nbsp;The list of all Payment</strong></p>
               <table width="95%" border="0" align="center">

                  <tr>
                    <td height="35" class="Main_Text1">Payment date</td>
                    <td class="Main_Text1">Payment Type</td>
                    <td class="Main_Text1">Payment where</td>
                    <td class="Main_Text1">Receipt ( client )</td>
                    <td class="Main_Text1">Recipt No.</td>
                    <td class="Main_Text1">Amount</td>
                    <td class="Main_Text1">Staff ID</td>
                    <td class="Main_Text1">note</td>
                    <td class="Main_Text1">Change Status</td>
                  </tr>
                  <?
				  $result1 = mysql_query("SELECT * FROM ".$dcm_table_start."call_payment where status=0"); 
						while($row = mysql_fetch_array($result1)){ 
						//	$query1 = mysql_query("SELECT * FROM ".$dcm_table_start."customer where cus_id = ".$row['cus_id']); 		
						//	$query2 = mysql_query("SELECT * FROM ".$dcm_table_start."client where cli_id = ".$row['cli_id']); 	
						//	$query3 = mysql_query("select * from ".$dcm_table_start."bucket	where bid = ".$row['bid']); 	
				?>
                  <tr>
                    <td class="Main_Text"><? echo $row['payment_date'];?></td>
                    <td class="Main_Text"><? if ( $row['payment_type']== 1 ) { echo "Cash"; }
											 if ( $row['payment_type']== 2 ) { echo "Cheque"; }
					?></td>
                    <td class="Main_Text"><? if ( $row['payment_where'] == 1) { echo "Client";}
											 if ( $row['payment_where'] == 2) { echo "Arig";}?></td>
                    <td class="Main_Text"><div align="center"><? echo $row['receipt'];?></div></td>
                    <td class="Main_Text"><div align="center"><? echo $row['invoice'];?></div></td>
                    <td class="Main_Text"><div align="right"><? echo $row['amount'];?> BD</div></td>
                    <td class="Main_Text"><div align="center"><? echo $row['uid'];?></div></td>
                    <td class="Main_Text"><div align="center"><? echo $row['note'];?></div></td>
                    <td class="Main_Text"><a href="index.php?stat=changedb&pid=<? echo $row['pid'];?>" class="text2">Change Status</a></td>
                  </tr>
                  <?
				  	}
					?>
              </table>
              
            <? }  if ($_GET['stat'] == 'change') { 
			
		$query = mysql_query("SELECT * FROM ".$dcm_table_start."call_payment where pid = ".$_SESSION['5_1_pid']); 		
			
		$query1 = mysql_query("SELECT * FROM ".$dcm_table_start."case where case_id = ".mysql_result($query,0,"case_id")); 	
			?>
			  
			  <br />

              <form id="form1" name="form1" method="post" action="index.php?stat=savepayment">
                <div align="center">
                  <table width="80%" border="0">
                    <tr>
                      <td class="Main_Text1">Case ID</td>
                      <td class="Main_SText"><? echo mysql_result($query,0,"case_id")?></td>
                      <td class="Main_Text1">A/C </td>
                      <td class="Main_SText"><? echo mysql_result($query1,0,"account_no");?></td>
                    </tr>
                    <tr>
                      <td width="20%" class="Main_Text1">Payment Date</td>
                      <td class="Main_SText"><span id="sprytextfield5">
                        <label>
                        <input type="text" name="payment_date" id="payment_date" value="<? echo mysql_result($query,0,"payment_date");?>" />
                        </label>
                        <span class="textfieldRequiredMsg">*</span><span class="textfieldInvalidFormatMsg">*</span></span>
                        <input type="hidden" name="collected" id="collected" value="<? echo mysql_result($query1,0,"collected"); ?>" />
                        <input type="hidden" name="case_id" id="case_id" value="<? echo mysql_result($query,0,"case_id"); ?>" /></td>
                      <td width="20%" class="Main_Text1">Payment Type</td>
                      <td class="Main_SText"><select name="payment_type" id="payment_type">
                          <option value="0"></option>
                          <option value="1" <? if (mysql_result($query,0,"payment_type")== 1) { ?>selected="selected"<? } ?>>Cash</option>
                          <option value="2" <? if (mysql_result($query,0,"payment_type")== 2) { ?>selected="selected"<? } ?>>Cheque</option>
                        </select>                      </td>
                    </tr>
                    <tr>
                      <td class="Main_Text1">Payment Where</td>
                      <td class="Main_SText"><span id="spryselect1">
                        <label>
                        <select name="payment_where" id="payment_where">
                          <option value=""></option>
                          <option value="1" <? if (mysql_result($query,0,"payment_where")== 1) { ?>selected="selected"<? } ?>>Client</option>
                          <option value="2" <? if (mysql_result($query,0,"payment_where")== 2) { ?>selected="selected"<? } ?>>Arig</option>
                        </select>
                        </label>
                        <span class="selectRequiredMsg">*</span></span></td>
                      <td class="Main_Text1">Receipt ( client ) </td>
                      <td class="Main_SText"><span id="sprytextfield7">
                        <label>
                        <input type="text" name="receipt" id="receipt" value="<? echo mysql_result($query,0,"receipt");?>" />
                        </label>
                      </span></td>
                    </tr>
                    <tr>
                      <td class="Main_Text1">Recipt No.</td>
                      <td class="Main_SText"><span id="sprytextfield8">
                        <label>
                        <input type="text" name="invoice" id="invoice" value="<? echo mysql_result($query,0,"invoice");?>" />
                        </label>
                      </span></td>
                      <td class="Main_Text1">amount</td>
                      <td class="Main_SText"><span id="sprytextfield9">
                        <label>
                        <input type="text" name="amount" id="amount" value="<? echo mysql_result($query,0,"amount");?>" />
                        </label>
                        <span class="textfieldRequiredMsg">*</span><span class="textfieldInvalidFormatMsg">*</span></span></td>
                    </tr>
                    <tr>
                      <td class="Main_Text1">Status</td>
                      <td class="Main_SText"><span id="spryselect2">
                        <select name="status" id="status">
                          <option value="0">Awaiting Approval</option>
                          <option value="1">Approv</option>
                          <option value="2">Reject</option>
                          <option value="3">Decline</option>
                        </select>
                      <span class="selectRequiredMsg">Please select an item.</span></span></td>
                      <td class="Main_Text1">&nbsp;</td>
                      <td class="Main_SText">&nbsp;</td>
                    </tr>
                    <tr>
                      <td class="Main_Text1">note</td>
                      <td colspan="3" class="Main_SText"><textarea name="note" id="note" cols="70" rows="2"><? echo mysql_result($query,0,"note");?></textarea></td>
                    </tr>
</table>
                </div>
                <p align="center">
                  <input name="Submit2" type="submit" class="Button1" id="Submit2" value="   Save   " />
                </p>
                <div align="center">
                  <table width="80%" border="0">
                  </table>
                </div>
              </form>
              <p align="center">&nbsp;</p>
              
              
            <? } ?>  
      <script type="text/javascript">
<!--
var sprytextfield9 = new Spry.Widget.ValidationTextField("sprytextfield9", "integer", {useCharacterMasking:true});
var sprytextfield8 = new Spry.Widget.ValidationTextField("sprytextfield8", "none", {isRequired:false});
var sprytextfield7 = new Spry.Widget.ValidationTextField("sprytextfield7", "none", {isRequired:false});
var sprytextfield5 = new Spry.Widget.ValidationTextField("sprytextfield5", "date", {useCharacterMasking:true, format:"yyyy-mm-dd"});
//-->
</script>
      <script type="text/javascript">
<!--
var spryselect2 = new Spry.Widget.ValidationSelect("spryselect2");
//-->
      </script>
<? } ?>            
