263 lines
12 KiB
PHP
263 lines
12 KiB
PHP
<?php
|
|
include('pop_up_top.php');
|
|
$TABLENAME='tbl_firms';
|
|
//$this_script='manage_firms.php';
|
|
?>
|
|
<?php
|
|
$acn=$_REQUEST['acn'];
|
|
if(isset($acn) && $acn=='delete')
|
|
{
|
|
if($firm_id)
|
|
mysqli_query($conn,"DELETE FROM $TABLENAME WHERE firm_id='".$firm_id."'");
|
|
}
|
|
if(isset($hid) && $hid=='1')
|
|
{
|
|
$query_main=" SET firm_name='".addslashes($firm_name)."',firm_location='".addslashes($firm_location)."',firm_location1='".addslashes($firm_location1)."',firm_code='".$firm_code."', remarks='".addslashes($remarks)."', firm_phone='".$firm_phone."', firm_fax='".$firm_fax."', firm_email='".$firm_email."', firm_contact='".$firm_contact."', firm_logo='".$firm_logo."',pan_no='".$pan_no."',tin_no='".$tin_no."',service_no='".$service_no."',central_no='".$central_no."',range1='".$range1."',division='".$division."',colleborate='".$colleborate."',modified_by='".$_SESSION['user_id']."'";
|
|
$query_prefix='';
|
|
$query_suffix="";
|
|
$query_additional="";
|
|
if($frmacn=="Update")
|
|
{
|
|
$query_prefix='UPDATE ';
|
|
$query_suffix=" WHERE firm_id='".$firm_id."'";
|
|
$query_additional="";
|
|
$msg="Firm Updated Successfully";
|
|
}
|
|
elseif($frmacn=="Add")
|
|
{
|
|
$query_prefix='INSERT INTO ';
|
|
$query_suffix="";
|
|
$query_additional="";
|
|
$msg="Firm Added Successfully";
|
|
}
|
|
$sql=$query_prefix.$TABLENAME.$query_main.$query_additional.$query_suffix;
|
|
|
|
//echo "a==".$sql;
|
|
$res=@mysqli_query($conn,$sql);
|
|
if(!$res){
|
|
$msg='Error adding/updating Firm. Please make sure the firm does not already exist.';
|
|
}
|
|
|
|
//echo "<script>location.replace('$this_script?msg=$msg')</script>";
|
|
|
|
}
|
|
|
|
?>
|
|
<link href="includes/css-js/admin.css" rel="stylesheet" type="text/css" />
|
|
|
|
|
|
<tr>
|
|
<td height="350" valign="top" style="padding:10px;"><table width="60%" border="0" cellspacing="0" cellpadding="0">
|
|
<tr>
|
|
|
|
<td><fieldset class="bdr1" >
|
|
|
|
|
|
<center>
|
|
|
|
<?php if($acn=='add' || $acn=='update' || $acn=='view') { ?>
|
|
<?php
|
|
if($acn=='update' || $acn=='view')
|
|
{
|
|
$sql=@mysqli_query($conn,"SELECT * FROM $TABLENAME WHERE firm_id='".$firm_id."'");
|
|
$row=@mysqli_fetch_array($sql);
|
|
@extract($row);
|
|
}
|
|
?>
|
|
<form name="f1" method="post" action="#" onsubmit="return validateForm();">
|
|
<table width="100%" border="0" cellspacing="0" cellpadding="4" class="bdr_table">
|
|
<tr>
|
|
<td colspan="2" align="center" class="bg2">
|
|
<span class="txt">
|
|
<?php
|
|
if($msg)
|
|
echo $msg;
|
|
?>
|
|
</span></td>
|
|
</tr>
|
|
<tr>
|
|
<!-- <td align="right" class="bg3">Firm Name:</td>-->
|
|
<td align="left" class="bdr_td"><input placeholder="FIRM NAME" type="text" class="textbox2" name="firm_name" size="45" value="<?php echo stripslashes($firm_name)?>" /></td>
|
|
</tr>
|
|
<tr>
|
|
<!-- <td align="right" class="bg3">Firm Code:</td>-->
|
|
<td align="left" class="bdr_td"><input placeholder="FIRM CODE" type="text" class="textbox1" name="firm_code" size="45" value="<?php echo stripslashes($firm_code)?>" /></td>
|
|
</tr>
|
|
<tr>
|
|
<!-- <td align="right" class="bg3">Firm Address:</td>-->
|
|
|
|
<td align="left" class="bdr_td">
|
|
<input type="text" placeholder="FIRM ADDRESS (line 1)" class="textbox12" name="firm_location" size="45" value="<?php echo stripslashes($firm_location)?>" /><BR />
|
|
<br />
|
|
<input placeholder="(line 2)" type="text" class="textbox12" name="firm_location1" size="45" value="<?php echo stripslashes($firm_location1)?>" /><BR /></td>
|
|
</tr>
|
|
<tr>
|
|
<!-- <td align="right" class="bg3">Phone No(s) </td>-->
|
|
<td align="left" class="bdr_td"><input placeholder="PHONE No" type="text" class="textbox2" name="firm_phone" size="45" value="<?php echo stripslashes($firm_phone)?>" /></td>
|
|
</tr>
|
|
<tr>
|
|
<!-- <td align="right" class="bg3">Fax</td>-->
|
|
<td align="left" class="bdr_td"><input placeholder="FAX" type="text" class="textbox2" name="firm_fax" size="45" value="<?php echo stripslashes($firm_fax)?>" /></td>
|
|
</tr>
|
|
<tr>
|
|
<!-- <td align="right" class="bg3">Email Address </td>-->
|
|
<td align="left" class="bdr_td"><input placeholder="EMAIL ADDRESS" type="text" class="textbox2" name="firm_email" size="45" value="<?php echo stripslashes($firm_email)?>" /></td>
|
|
</tr>
|
|
<tr>
|
|
<!-- <td align="right" class="bg3">Contact Person </td>-->
|
|
<td align="left" class="bdr_td"><input placeholder="CONTACT PERSON" type="text" class="textbox2" name="firm_contact" size="45" value="<?php echo stripslashes($firm_contact)?>" /></td>
|
|
</tr>
|
|
<tr>
|
|
<!-- <td align="right" class="bg3">Logo Image </td>-->
|
|
<td align="left" class="bdr_td"><input placeholder="LOGO IMAGE" type="text" class="textbox2" id="firm_logo" name="firm_logo" size="45" value="<?php echo stripslashes($firm_logo)?>" />
|
|
<a onclick="window.open('upload_logo.php?acn=select','mywindow','menubar=0,resizable=0,status=0,scrollbars=1,width=500,height=100')" target="_blank">Select</a> /
|
|
<a onclick="window.open('upload_logo.php?acn=upload','mywindow','menubar=0,resizable=0,status=0,scrollbars=1,width=500,height=100')" target="_blank">Upload</a>
|
|
</td>
|
|
</tr>
|
|
|
|
<tr>
|
|
<!-- <td align="right" class="bg3">PAN NO:</td>-->
|
|
<td align="left" class="bdr_td"><input placeholder="PAN No" type="text" class="textbox2" name="pan_no" size="45" value="<?php echo stripslashes($pan_no)?>" /></td>
|
|
</tr>
|
|
|
|
<tr>
|
|
<!-- <td align="right" class="bg3">TIN NO:</td>-->
|
|
<td align="left" class="bdr_td"><input placeholder="TIN No" type="text" class="textbox2" name="tin_no" size="45" value="<?php echo stripslashes($tin_no)?>" /></td>
|
|
</tr>
|
|
|
|
<tr>
|
|
<!-- <td align="right" class="bg3">Service Tax Code NO:</td>-->
|
|
<td align="left" class="bdr_td"><input placeholder="SERVICETAX CODE No" type="text" class="textbox2" name="service_no" size="45" value="<?php echo stripslashes($service_no)?>" /></td>
|
|
</tr>
|
|
|
|
<tr>
|
|
<!-- <td align="right" class="bg3">Central Excise Code NO:</td>-->
|
|
<td align="left" class="bdr_td"><input placeholder="CENTRAL EXCISE CODE No" type="text" class="textbox2" name="central_no" size="45" value="<?php echo stripslashes($central_no)?>" /></td>
|
|
</tr>
|
|
|
|
<tr>
|
|
<!-- <td align="right" class="bg3">Division: </td>-->
|
|
<td align="left" class="bdr_td"><input placeholder="DIVISION" type="text" class="textbox2" name="division" size="45" value="<?php echo stripslashes($division)?>" /></td>
|
|
</tr>
|
|
|
|
<tr>
|
|
<!-- <td align="right" class="bg3">Commissionearte: </td>-->
|
|
<td align="left" class="bdr_td"><input placeholder="COMMISSIONEARTE" type="text" class="textbox2" name="colleborate" size="45" value="<?php echo stripslashes($colleborate)?>" /></td>
|
|
</tr>
|
|
<tr>
|
|
<!-- <td align="right" class="bg3">Range: </td>-->
|
|
<td align="left" class="bdr_td"><input placeholder="RANGE" type="text" class="textbox2" name="range1" size="45" value="<?php echo stripslashes($range1)?>" /></td>
|
|
</tr>
|
|
|
|
|
|
|
|
<tr>
|
|
<!-- <td align="right" class="bg3">Remarks:</td>-->
|
|
<td align="left" class="bdr_td"><textarea placeholder="REMARK" name="remarks" cols="30" rows="6"><?php echo stripslashes($remarks)?></textarea></td>
|
|
</tr>
|
|
<tr>
|
|
<td align="right" class="bg3">
|
|
<input type="hidden" name="firm_id" value="<?php echo $firm_id?>">
|
|
<input type="hidden" name="hid" value="1"> </td>
|
|
</tr><tr>
|
|
<td align="left" class="bdr_td">
|
|
<?php if($acn=='update') { ?>
|
|
<input type="submit" name="frmacn" value="Update" class="submitbutton" style="background-color:#CCFF33;">
|
|
<?php } else if($acn=='add') { ?>
|
|
<input type="submit" name="frmacn" value="Add" class="submitbutton" style="background-color:#CCFF33;">
|
|
<?php } ?>
|
|
<input type="button" value="Close" onclick="window.close();" class="submitbutton" style="background-color:#FF5C33;"></td>
|
|
</tr>
|
|
</table>
|
|
|
|
</form>
|
|
<?php } else { echo "<script>location.href='techsyn_firm_list.php'</script>"; ?>
|
|
<form name="f1" method="post" action="<?php echo $this_script?>">
|
|
|
|
<table width="100%" border="0" cellspacing="0" cellpadding="4" class="bdr_table">
|
|
<tr class="bg2">
|
|
<td colspan="7" align="center"><font color="maroon"><?php echo $msg?></font></td>
|
|
</tr>
|
|
<tr class="bg2">
|
|
<td align="left" ><strong>S.No.</strong></td>
|
|
<td align="center"><strong>Firm Name</strong></td>
|
|
<td align="center"><strong>Firm Code</strong></td>
|
|
<td align="center"><strong>Location</strong></td>
|
|
<td align="center"><strong>View</strong></td>
|
|
<td align="center"><strong>Edit</strong></td>
|
|
<td align="center"><strong>Delete</strong></td>
|
|
</tr>
|
|
<?php
|
|
$sql="SELECT * FROM $TABLENAME WHERE 1";
|
|
$result = mysqli_query($conn,$sql);
|
|
$num_rows=@mysqli_num_rows($result);
|
|
$page=new Page();
|
|
$page->set_page_data($this_script,$num_rows,$records_per_page=100000,$scroll_num=0,$show_prev_next=true,$show_scroll_prev_next=true,$show_first_last=true);
|
|
$page->set_qry_string("");
|
|
$page_order_result=@mysqli_query($conn,$page->get_limit_query($sql));
|
|
$num=@mysqli_num_rows($page_order_result);
|
|
if($num>0)
|
|
{
|
|
$pageon=$_GET['page'];
|
|
$pageon=($pageon)*100000;
|
|
$count=$pageon+1;
|
|
while($row=@mysqli_fetch_array($page_order_result))
|
|
{
|
|
extract($row);
|
|
?>
|
|
<tr class="bdr_td">
|
|
<td align="left" class="bdr_td"> <?php echo $count?></td>
|
|
<td align="center" class="bdr_td"> <?php echo stripslashes($firm_name)?></td>
|
|
<td align="center" class="bdr_td"> <?php echo stripslashes($firm_code)?></td>
|
|
<td align="center" class="bdr_td"> <?php echo stripslashes($firm_location)?> <?php echo stripslashes($firm_location1)?></td>
|
|
<td align="center" class="bdr_td"> <a href="javascript:void(0);" onclick="javascript:sendpage('<?php echo $this_script?>?acn=view&firm_id=<?php echo $firm_id?>');"><img src='images/view.jpg' border="0" /></a></td>
|
|
<td align="center" class="bdr_td"> <a href="javascript:void(0);" onclick="javascript:sendpage('<?php echo $this_script?>?acn=update&firm_id=<?php echo $firm_id?>');"><img src='images/edit.png' border="0" /></a></td>
|
|
<?php
|
|
$sql_check_child="SELECT firm_id FROM tbl_firms WHERE firm_id NOT IN (SELECT firm_id FROM quotation_master) AND firm_id = '".$firm_id."'";
|
|
$res_check_child=@mysqli_query($conn,$sql_check_child);
|
|
$num=@mysqli_num_rows($res_check_child);
|
|
?>
|
|
<td align="center" class="bdr_td"> <?php if($num>0){ ?><a href="javascript:void(0);" onclick="javascript:deleterecord('<?php echo $this_script?>?acn=delete&firm_id=<?php echo $firm_id?>');"><img src='images/drop.png' border="0" /></a><?php } ?></td>
|
|
</tr>
|
|
<?php
|
|
$count++;
|
|
} ?>
|
|
<tr class='bg2'><td colspan='8'><div style="margin-right:10px; ">Page <?php echo "<br>".$page->get_page_nav();?></div></td></tr>
|
|
<?php }
|
|
else
|
|
{
|
|
echo "<tr><td align='center' colspan='8' class='bdr_td'><strong>No Record Found</strong></td></tr>";
|
|
}
|
|
?>
|
|
|
|
<tr><td colspan="8" align="right">
|
|
<span>
|
|
<a href="pdf_firms.php" target="_blank">Print</a>
|
|
</span>
|
|
<input type="button" onclick="window.location.href='manage_firms.php?acn=add'" value="Add New"></td></tr>
|
|
|
|
</table>
|
|
|
|
</form>
|
|
<?php } ?>
|
|
</center>
|
|
</fieldset>
|
|
</td>
|
|
|
|
</tr>
|
|
</table></td>
|
|
</tr>
|
|
|
|
|
|
|
|
|
|
|
|
<script>
|
|
var fieldArray = new Array(
|
|
new Array('firm_name','firm_code','firm_location'), new Array('Please enter firm name.','Please enter firm code.','Please enter firm location.'));
|
|
|
|
function validateForm(){
|
|
|
|
return checkform('f1',fieldArray);
|
|
}
|
|
</script>
|