<?php
session_start();
include('config.php');
if(isset($_REQUEST['idVal']))
{
$id = $_REQUEST['idVal'];
$Sql = "update customer set status=0 where id = '$id'";
$db->sql_query($Sql);
}
$tableTitleList = array('SlNo.','Type','Organisation','Contact Person','Designation', 'Address','Phone','Email','Website','Option');
$widthVal = array(4,10,10,10,10,15,8,10,8,6);
$display = array(0,1,2,3,4,5,6,7,8,9);
// search
$data = array();
$sIn = $_REQUEST['sIn'];
$sFor = $_REQUEST['sFor'];
$sTo = $_REQUEST['sTo'];
$operator = $_REQUEST['operator'];
$searchList = array('Organisation','Contact Person','Designation','Address','City','State','Country','Phone','Website');
$fldList = array('org','cname','desig','address','city','state','country','ph','web');
$dateFld = array();
$search = new mySearch($fldList,$dateFld);
$sqlAdd = $search -> getSearch($sIn,$sFor,$operator,$sTo);
$wVal = 145;
$status = ($_REQUEST['status'] != "") ? $_REQUEST['status'] : "1";
$ctype = $_REQUEST['ctype'];
$sqlAdd .= ($ctype != "") ? " and ctype = '$ctype' " : "";
$sql = "select * from customer where status='$status' $sqlAdd order by org";
$Result_Set = (isset($_REQUEST['Result_Set']))? $_REQUEST['Result_Set'] : 0;
$page = new myPager($sql,$Result_Set,$perpage);
$data = $page->getData();
$links = "";
?>
<!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><?=$title?></title>
<link rel="stylesheet" href="css/style.css" type="text/css" />
<style>
.data-outer{ margin-bottom:20px; clear:both; border:1px #CCCCCC solid; width:100%; height:320px;overflow:auto;}
.data-outer-search{ margin-bottom:20px; clear:both; border:1px #CCCCCC solid; width:100%; height:100%;overflow:auto;}
.title-outer{border-top:1px #ffffff solid; float:left; width:<?=$wVal?>%;background-color:#F1F1F1; border-bottom:1px #CCCCCC solid;}
.col-outer{ border-bottom:1px #CCCCCC solid; float:left; width:<?=$wVal?>%; overflow:hidden; clear:both; }
.title-1{ padding:4px; float:left; border-right:1px #CCCCCC solid; font-weight:bold;}
.col-1{ padding:4px; float:left; border-right:1px #CCCCCC solid;margin-bottom:-300px; padding-bottom:300px;}
</style>
<script language="javascript" src="js/jquery.js"></script>
<script language="javascript" src="js/search_js.js"></script>
</head>
<body>
<form name="frmEdit" method="post">
<input type="hidden" value="" name="idVal" id="idVal"/>
</form>
<div id="container">
<div class="content">
<h1>Contacts</h1>
<div class="search">
<a href="#" class="link-blue" rel="toggle[alerts]">Search</a>| <a href="customer-new.php" class="link-blue">New</a> | <a href="customer-view.php" class="link-blue">View
</a>
</div>
<div id="alerts">
<form method="post" name="paging" action="customer-view.php" enctype="multipart/form-data" >
<input type="hidden" name="Result_Set" value=""/>
<div class="data-outer-search" >
<?php include_once('inc/s_filter.php') ?>
</div>
<p style="float:left; padding-left:5px; padding-top:10px;">
<div style="float:left; padding-right:5px;"> Status : </div>
<div style="float:left; padding-right:5px;">
<select name="status" class="select" style="width:80px;">
<option value="1" selected="selected"> Active </option>
<option value="0" <? if($status == 0) {echo "selected='selected'"; }?> > Inactive </option>
</select>
</div>
<div style="float:left; padding-right:5px;"> Type : </div>
<div style="float:left; padding-right:5px;">
<select name="ctype" class="select" style="width:100px;">
<option value="" selected="selected"> Type </option>
<option value="1" <? if($ctype == 1 ) {echo "selected='selected'"; }?>> Customer </option>
<option value="2" <? if($ctype == 2 ) {echo "selected='selected'"; }?> >
Contact </option>
<option value="3" <? if($ctype == 3 ) {echo "selected='selected'"; }?> >
Vendor </option>
</select>
</div>
<div style="float:left; padding-right:5px;">
<input type="submit" class="button" value="Submit" name="Submit" />
<input type="reset" class="button" value="Reset" />
</div>
</p>
</form>
</div>
<form name="report" id="report" method="post" action="<?=$_SERVER['PHP_SELF']?>" >
<div class="data-outer">
<div class="title-outer">
<?php for($i=0;$i<count($display);$i++)
{
$styleLast = ($i == (count($display)-1)) ? "border-right:0px;" : "";
?>
<div class="title-1" style="width:<?=$widthVal[$display[$i]]?>%;<?=$styleLast?>">
<?=$tableTitleList[$display[$i]]?></div>
<?php } ?>
</div>
<?php
$slNo = $Result_Set;
foreach($data as $row)
{
$slNo++;
$org = $row['org'];
$conPer = $row['cname'];
$desig = $row['desig'];
$addr = $row['address'];
if($row['city']!="")
{
$addr.="\n" .$row['city'];
if($row['pin']!="")
$addr.="-" .$row['pin'];
}
if($row['state']!="")
$addr.="\t\t" .$row['state'];
if($row['country']!="")
$addr.=", " .$row['country'];
if($row['ph']!="")
$phone = $row['ph'];
if($row['mob']!="")
$phone.="\nMob :" .$row['mob'];
$email = $row['email'];
$webst = $row['web'];
$optVal = "<a href=\"javascript:editData('customer-new.php','".$row['id']."')\">
Edit</a> | ";
$optVal .= "<a href=\"javascript:delData('customer-view.php','".$row['id']."')\">
Del</a> ";
$ctypeVal = "Customer";
if($row['ctype'] == 2) { $ctypeVal = "Conatact";}
if($row['ctype'] == 3) { $ctypeVal = "Vendor";}
$dataList = array($slNo,$ctypeVal,$org,$conPer,$desig,$addr,$phone,$email,$webst,$optVal);
?>
<div class="col-outer">
<?php for($i=0;$i<count($display);$i++){
$styleLast = ($i == (count($display)-1)) ? "border-right:0px;" : "";
?>
<div class="col-1" style="width:<?=$widthVal[$display[$i]]?>%; <?=$styleLast?>">
<?=$dataList[$display[$i]]?>
</div>
<?php } ?>
</div>
<?php } ?>
</div>
<div class="paging-outer">
<?=$page->showLinksForm(10,$links);?>
</div>
</form>
</div>
</div>
<script type="text/javascript" src="js/jquery.min.js"></script>
<script type="text/javascript" src="js/animatedcollapse.js"></script>
<script type="text/javascript" src="js/fade.js"></script>
</body>
</html>
|