<?php require('header.php'); ?>
<div class="row">
    <div class="box col-md-12">
        <div class="box-inner">
            <div class="box-header well" data-original-title="">
                <h2><i class="glyphicon glyphicon-edit"></i>Cari Sorgula</h2>

                <div class="box-icon">
                    <a href="#" class="btn btn-setting btn-round btn-default"><i
                            class="glyphicon glyphicon-cog"></i></a>
                    <a href="#" class="btn btn-minimize btn-round btn-default"><i
                            class="glyphicon glyphicon-chevron-up"></i></a>
                    <a href="#" class="btn btn-close btn-round btn-default"><i
                            class="glyphicon glyphicon-remove"></i></a>
                </div>
            </div>
            <div class="box-content">
			 &nbsp&nbsp&nbsp <label><center>Lütfen Cari Kodu veya Cari Adı Giriniz </center></label>
                <form name="form" method="post" action="cariliste.php?ck=sor" role="form">
                    <div class="form-group has-success col-md-4">
                        
                        <input type="Text" class="form-control" name="araa" placeholder="Cari Kodu">
                    </div>
                    <div class="form-group has-success col-md-4">
                      
                        <input type="Text" class="form-control" name="ara" placeholder="Cari Adı">
                    </div>
                   
               
                   &nbsp&nbsp&nbsp <button type="submit" class="btn btn-default"> &nbsp&nbsp&nbsp Listele &nbsp&nbsp&nbsp</button>
                </form>

            </div>
        </div>
    </div>
    <!--/span-->

	<?php if ($_POST){
    $ara=$_POST["ara"];
	$araa=$_POST["araa"];
	$say=$_POST["say"]; 
	
	?>
	
</div><!--/row-->

<div class="row">
        <div class="box col-md-12">
            <div class="box-inner">
                <div class="box-header well" data-original-title="">
                    <h2><i class="glyphicon glyphicon-user"></i> Cari Listesi</h2>

                    <div class="box-icon">
                        <a href="#" class="btn btn-minimize btn-round btn-default"><i
                                class="glyphicon glyphicon-chevron-up"></i></a>
                        <a href="#" class="btn btn-close btn-round btn-default"><i
                                class="glyphicon glyphicon-remove"></i></a>
                    </div>
                </div>
                <div class="box-content">
                    <table class="table table-striped table-bordered responsive">
                        <thead>
                        <tr>
                            <th>Cari Adı</th>

                            <th>Tel</th>
                            <th>Vd / Vn</th>
                            <th>Durum</th>
                        </tr>
                        </thead>
<?php
$conn = pg_connect("host=localhost dbname=posnet user=postgres password=3641a3641") 
        or die("Failed to create connection to database: ". pg_last_error(). "<br/>");



	
	if(empty($ara) && empty($araa)) {
      echo '    <div class="alert alert-danger">
                    <button type="button" class="close" data-dismiss="alert">&times;</button>
                    <strong>Hata</strong> Lütfen Boş Bırakmayınız
                </div>';
	 
   } else {
	
	$tarih = date("Y-m-d"); 
	
	$sql_check = pg_query($conn,"SELECT id, cari_tipi_id, cari_durum, cari_kod, cari_yetkili_adisoyadi, cari_unvan, cari_vergi_daire, cari_vergi_no, cari_adres, cari_fatura_adres, cari_sevk_adres, cari_gsm, cari_telefon, cari_faks, cari_email, cari_anagrup_id, cari_altgrup_id, cari_detaygrup_id, cari_satistoplam_limiti, cari_satishesap_limiti, cari_alistoplam_limiti, cari_alishesap_limiti, cari_iskonto, cari_aylikvade, cari_para_birimi, update_date, update_time, update_user
	FROM posnetshema.cari_tanim where  cari_unvan ILIKE '%$ara%' OR cari_kod ILIKE '$araa' ");
//$satiar= pg_fetch_array($sql_check);
 while($satir = pg_fetch_assoc($sql_check)) { 
	
	
	$cari = $satir['cari_unvan'];;
 $vn = $satir["cari_vergi_no"];
$vd = $satir["cari_vergi_daire"];
$fiya1 = number_format($fiy1, 2, ',', '.');
$unvan =$satir["cari_unvan"];
 

?>








                        <tbody>


                        <tr>
                            <td><?php echo $unvan; ?></td>
                            
                            <td class="center"><?php echo $satir["cari_telefon"]; ?></td>
                            <td class="center"><?php echo  $satir["cari_vergi_no"]; ?><BR><?php echo  $satir["cari_vergi_daire"]; ?></td>
                          
                            <td class="center">
                                <a class="btn btn-success" href="#">
                                    <i class="glyphicon glyphicon-zoom-in icon-white"></i>
                                    Detay
                                </a>
                      
                            </td>
                        </tr>
                       <?php } }  } ?>
                        </tbody>
                    </table>
                </div>
            </div>
        </div>
        <!--/span-->

    </div><!--/row-->

<?php require('footer.php'); ?>