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

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

}


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

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



?>
<style>
.label{
background-color: #B7B7B7;
    color: #000000;
    font-size: 10.5px;
    font-weight: bold !important;
    padding: 5px 10px;
    text-align: left;
}
</style>
<h1>Contractor Definition</h1>
<form method="post" action="">
<table width="80%" border="0" cellspacing="2" cellpadding="2" align="center">
  <tr>
 
    <th class="tabledata">Contractor<font color="#FF0000" size="3"> * </font></th>
    <td width="25%"><input type="text" name="sub_contractor_definition[contractor_name]" id="contractor" value="<?php echo $contractor_name;?>" size="30" /></td>
    <th class="tabledata"><strong>Short Name</strong></th>
    <td width="34%"><input type="text" name="sub_contractor_definition[short_name]" id="short_name" value="<?php echo $short_name;?>" size="30" /></td>
  </tr>
  <tr>
    <th class="tabledata"><strong>Class <font color="#FF0000" size="3"> * </font></strong></th>
    <td><select name="sub_contractor_definition[class]" id="class">
		<option value="">Select Class</option>
	</select>	</td>
    <th class="tabledata"><strong>User Code</strong></th>
    <td><input type="text" name="sub_contractor_definition[user_code]" id="user_code" value="<?php echo $user_code;?>" size="30" /></td>
  </tr>
  <tr>
    <th class="tabledata"><strong>Credit Days</strong></th>
    <td><input type="text" name="sub_contractor_definition[credit_days]" id="credit_days" value="<?php echo $credit_days;?>" size="30" /></td>
    <th class="tabledata"><strong>Bank</strong></th>
    <td><input type="text" name="sub_contractor_definition[bank]" id="bank" value="<?php echo $bank;?>" size="30" /></td>
  </tr>
  <tr>
    <th class="tabledata"><strong>Ledger Advance</strong></th>
    <td><select name="sub_contractor_definition[ledger_advance]" id="ledger_advance" >
		<option value="">Select Ledger Advance</option>
	</select>	</td>
    <th class="tabledata"><strong>Ledger Retention</strong></th>
    <td><select name="sub_contractor_definition[ledger_retention]" id="ledger_retention" >
		<option value="">Ledger Retention</option>
	</select>	</td>
  </tr>
  <tr>
    <th class="tabledata"><strong>Bank Account No.</strong></th>
    <td><input type="text" name="sub_contractor_definition[bank_account_no]" id="bank_account_no" value="<?php echo $bank_account_no;?>" size="30" /></td>
    <th class="tabledata"><strong>Ledger Payable</strong></th>
    <td><select name="sub_contractor_definition[ledger_payable]" id="ledger_payable" >
		<option value="">Ledger Payable</option>
	</select>	</td>
  </tr>
  <tr>
    <td colspan="4">&nbsp;</td>
    
  </tr>
  <tr>
    <td colspan="4"><strong>Previous Exp Details</strong></td>
   
  </tr>
  <tr>
    <td colspan="4">&nbsp;</td>
    
  </tr>
  <tr>
    <th class="tabledata"><strong>Remarks</strong></th>
    <td colspan="6"><textarea name="sub_contractor_definition[remarks]" style="width:400; height:80;"><?php echo $remarks;?></textarea></td>
  </tr>
  <tr>
    <th class="tabledata"><strong>Contractor Category</strong></th>
    <td>
	<select name="sub_contractor_definition[contractor_category]" id="contractor_category">
		<option value="">Contractor Category</option>
		<?php
		$sqlcategory=DB_query("select * from tbl_subcontractor_contractor_category",$db);
		while($category_row=DB_fetch_array($sqlcategory))
		{
				$s='';
				if($contractor_category==$category_row['id'])
				$s="selected";
		?>
		 <option value="<?php echo $category_row['id'];?>" <?php echo $s;?>><?php echo $category_row['Contractor_category_name'];?></option>
		<?php } ?>
		</select>
	</td>
    <th class="tabledata"><strong>Contact Person</strong></th>
    <td><input type="text" name="sub_contractor_definition[contact_person]" id="contact_person" value="<?php echo $contact_person;?>" size="30" /></td>
  </tr>
   <tr>
      
    <td colspan="2" align="center"></td>
	<td><input type="checkbox" name="sub_contractor_definition[active]" id="active" /> <strong>Is Active</strong></td>
  </tr>
   <tr>
    <td colspan="4"><strong>Address and Other Details</strong></td>
    
  </tr>
  <tr>
    <td colspan="4">&nbsp;</td>
    
  </tr>
  <tr>
    <th class="tabledata"><strong>State  <font color="#FF0000" size="3"> * </font> </strong></th>
    <td width="25%"><select name="sub_contractor_definition[state]" id="state">
		<option value="">Select State</option>
	</select></td>
    <th class="tabledata"><strong>Tin</strong></td>
    <td width="34%"><input type="text" name="sub_contractor_definition[tin]" id="tin" value="<?php echo $tin;?>" size="30" /></td>
  </tr>
  <tr>
    <th class="tabledata"><strong>Location<font color="#FF0000" size="3"> * </font></strong></th>
    <td><select name="sub_contractor_definition[location]" id="location">
		<option value="">Select Location</option>
	</select>	</td>
	<th class="tabledata"><strong>CST</strong></th>
    <td><input type="text" name="sub_contractor_definition[cst]" id="cst" value="<?php echo $cst;?>" size="30" /></td>
    
  </tr>
  <tr>
    <th class="tabledata"><strong>Address <font color="#FF0000" size="3"> * </font></strong></th>
    <td><textarea name="sub_contractor_definition[address]"><?php echo $address;?></textarea></td>
    <th class="tabledata"><strong>PAN <font color="#FF0000" size="3"> * </font></strong></th>
    <td><input type="text" name="sub_contractor_definition[pan]" id="pan" value="<?php echo $pan;?>" size="30" /></td>
  </tr>
  <tr>
    <th class="tabledata"><strong>Email Id</strong></th>
    <td><input type="text" name="sub_contractor_definition[email_id]" id="email_id" value="<?php echo $email_id;?>" size="30" /></td>
    <th class="tabledata"><strong>Office Mobile</strong></th>
    <td><input type="text" name="sub_contractor_definition[office_mobile]" id="office_mobile" value="<?php echo $office_mobile;?>" size="30" /></td>
  </tr>
  <tr>
    <th class="tabledata"><strong>VAT / TIN</strong></th>
    <td><input type="text" name="sub_contractor_definition[vat_tin]" id="vat_tin" value="<?php echo $vat_tin;?>" size="30" /></td>
    <th class="tabledata"><strong>Service Tax No.</strong></th>
    <td><input type="text" name="sub_contractor_definition[service_tax_no]" id="service_tax_no" value="<?php echo $service_tax_no;?>" size="30" />
	</td>
  </tr>
  <tr>
    <th class="tabledata"><strong>Fax</strong></th>
    <td><input type="text" name="sub_contractor_definition[fax]" id="fax" value="<?php echo $fax;?>" size="30" /></td>
    <th class="tabledata"><strong>TDS Account No.</strong></th>
    <td><input type="text" name="sub_contractor_definition[tds_account_no]" id="tds_account_no" value="<?php echo $tds_account_no;?>" size="30" />
	</td>
  </tr>
  <tr><td>&nbsp;</td></tr>
  <tr><td>&nbsp;</td><td colspan="3" align="center"><input type="submit" value="Save" name="<?php if($_REQUEST['action']=='edit') echo 'update'; else echo 'save'; ?>" class="add"><input type="reset" name="cancel" value="Reset" /><a href="index.php?route=SubContractors/Masters/Contractor_Definition_index&modid=<?php echo $_REQUEST['modid'];?>&frmid=<?php echo $_REQUEST['frmid'];?>"><input type="button" name="back" value="Cancel" /></a></td></tr>
</table>
</form>