<?php
if($_REQUEST['save'])
{
	//print_r($_REQUEST); exit;
	if($_REQUEST['sub_bill_deletion']['contractor']!='')
	
	{	
		
			extract($_REQUEST['sub_bill_deletion']);
			
		if($s->RecordInsert('sub_bill_deletion',$_REQUEST['sub_bill_deletion']))
		{
		
		}
				unset($_REQUEST['sub_bill_deletion']);	
				//print_r($_REQUEST); exit;
				$_SESSION['success_msg']="Saved Successfully";	
				echo "<script>location.href='index.php?route=SubContractors/RaBill/verified_bill_deletion_index&modid=".$_REQUEST['modid']."&frmid=".$_REQUEST['frmid']."'</script>";

	}
	else
	{
		echo "<script>alert('Try Again');</script>";
	}

}


	if($_REQUEST['action']=='edit' && !empty($_REQUEST['del']))
	{	
		$recEdit=DB_fetch_array($s->GetRecordById('sub_bill_deletion','id='.$_REQUEST['del']));
		extract($recEdit);
		
	}

if(isset($_REQUEST['update']))
{
	
	 $s->RecordEdit('sub_bill_deletion',$_REQUEST['sub_bill_deletion'],"id=".$_REQUEST['del']);
		$_SESSION['success_msg']="Update Successfully";
		
		echo "<script>location.href='index.php?route=SubContractors/RaBill/verified_bill_deletion_index&modid=".$_REQUEST['modid']."&frmid=".$_REQUEST['frmid']."'</script>";
}



?>
<h3>Verified Bill Deletion</h3>
<form action="" method="post">
<table width="80%" border="0" cellspacing="2" cellpadding="2" align="center">
  <tr>
    <td width="25%"><input type="radio" name="sub_bill_deletion[payment_mode]" value="Yes" <?php if($payment_mode=='Yes'){ echo "checked"; }?> /> <strong>Delete Bill and Mbook</strong></td>
    <td width="75%"><input type="radio" name="sub_bill_deletion[payment_mode]" value="No" <?php if($payment_mode=='No'){ echo "checked"; }?> /> 
    <strong>Delete Bill and Edit Mbook</strong></td>
  </tr>
  <tr>
    <td class="label"><strong>Project</strong></td>
    <td><select name="sub_bill_deletion[project]" id="project" style="width:300px">
      <option value="">Select Project</option>
    </select></td>
  </tr>
  <tr>
    <td class="label"><strong>Block</strong></td>
    <td><select name="sub_bill_deletion[block]" id="block" style="width:300px">
      <option value="">Select Block</option>
    </select></td>
  </tr>
  <tr>
    <td class="label"><strong>Contractor</strong></td>
    <td><select name="sub_bill_deletion[contractor]" id="contractor" style="width:300px">
      <option value="">Select Contractor </option>
      <?php
		$sqlcategory=DB_query("select * from sub_contractor_definition",$db);
		while($category_row=DB_fetch_array($sqlcategory))
		{
				$s='';
				if($contractor==$category_row['id'])
				$s="selected";
		?>
      <option value="<?php echo $category_row['id'];?>" <?php echo $s;?>><?php echo $category_row['contractor_name'];?></option>
      <?php } ?>
    </select></td>
  </tr>
  <tr>
    <td class="label"><strong>Work Order No.</strong></td>
    <td><select name="sub_bill_deletion[work_order_no]" id="work_order_no" style="width:300px">
      <option value="">Select Work Order No</option>
    </select></td>
  </tr>
  <tr>
    <td class="label"><strong> Bill No.</strong></td>
    <td><input type="text" name="sub_bill_deletion[bill_no]" id="bill_no" value="<?php echo $bill_no; ?>" style="width:300px"/></td>
  </tr>
 
</table>
<p align="center"> <input type="submit" value="Save" name="<?php if($_REQUEST['action']=='edit') echo 'update'; else echo 'save'; ?>"><input type="reset" name="cancel" value="Reset" /><a href="index.php?route=SubContractors/RaBill/verified_bill_deletion_index&modid=<?php echo $_REQUEST['modid'];?>&frmid=<?php echo $_REQUEST['frmid'];?>"><input type="button" name="back" value="Cancel" /></a></p>
</form>