<?php 
session_start();
?>
<head>
	<title>Visualsoft Office Manager - Ταμειακές</title>
	<link href="logos/ofm1.ico" rel="shortcut icon" type="image/x-icon"> 
	<meta name="viewport" content="width=device-width, initial-scale=1">
	<meta name="description" content="">
	<meta http-equiv="content-type" content="text/html; charset=UTF-8">	
</head>
<?php   
if($_SESSION['CheckPWD']==false){ header("Location: login.php"); }
	
$myTopCaption_Text="ΔΙΑΧΕΙΡΙΣΗ ΤΑΜΕΙΑΚΩΝ";
$MyFormName=str_replace('.php', '', basename($_SERVER['PHP_SELF']));
$MyADDFormName="tameiakes_add";
$tblName="tameiakes_kai_pos";
$MyIDFieldName="IDTameiakis";
$ListExist=true;
$prefix=$MyFormName."@";
$frmOpenNew='"'.$MyIDFieldName.'","0","'.$MyADDFormName.'",0,0' ;
 
include 'include/top_vars.php';  
include_once 'include/header.php';
 
$simera2=date_olografos($now); 

?> 
<style>
.red {background: #FF5733;color:white;}
.green {background: #52BE80;color:white;}
.normal { }
</style>
 
<form id="<?php echo $MyFormName;?>" name="<?php echo $MyFormName;?>" autocomplete="off">
 <body OnLoad="document.<?php echo $MyFormName.'.'.$prefix ?>FindWhat.focus();">
 
 <div class="vsboxDetail hide1" >
	<h1> ΚΑΤΑΣΤΑΣΗ ΤΑΜΕΙΑΚΩΝ & POS</h1>
 </div>
 <?php include 'include/top_grid_list_buttons.php';  ?>

<div class="scroll" style="margin-bottom:0px;padding-bottom:0px;width:100%;" > 
<div class="sticky">
  <table id="CustomerList" class="gridList" > 
   <tr  >
	<td class="r w50" >A/A<a onclick="grdsrt('IDTameiakis');" class="sortpic"/></td>
	<td>ΕΠΩΝΥΜΙΑ<a onclick="grdsrt('Pelatis_Eponymia');" class="sortpic"/></td>
	<td class="c w80 hide1">ΤΗΛ </td>
	<td class="c w100     ">ΤΑΜΕΙΑΚΗ<a onclick="grdsrt('Tameiaki_Model');" class="sortpic"/></td>
	<td class="c w80 hide1">Voucher<a onclick="grdsrt('Tameiaki_Voucher');" class="sortpic"/></td> 
	<td class="c w80 hide1">Updated<a onclick="grdsrt('Tameiaki_Updated');" class="sortpic"/></td> 
    <td class="c w100 hide1">ΗΜΕΡ/ΝΙΑ<a onclick="grdsrt('Tameiaki_Updated_Date');" class="sortpic"/></td>
	<td class="c w80 hide1">POS<a onclick="grdsrt('POS_Model');" class="sortpic"/></td>
	<td class="c w80 hide1">Connected<a onclick="grdsrt('POS_Connected');" class="sortpic"/></td>
	<td class="c w100 hide1">ΗΜΕΡ/ΝΙΑ <a onclick="grdsrt('POS_Connected_Date');" class="sortpic"/></td>
	<td class='hide1'>ΠΑΡΑΤΗΡΗΣΕΙΣ</a></td>
  </tr> 
</table>
</div>
 
 <table class="gridListNoCaption"  > 
<?php
 $HmniaSimera= date_create('now')->format('d/m/Y'); 
 $HmniaSimeraNum=formatMyDate($HmniaSimera,"GrTo_YYYYMMDD");
 
    $flds="Pelatis_Eponymia, Pelatis_AFM, Tameiaki_SN, Pelatis_Phone, Tameiaki_Model, Pos_Model, Sxolia";
 $filter=filter_make($flds, $FindWhat);
 $query=" SELECT * FROM ". $tblName . " " . $filter ; 
 
 //mysqli_query("SET character_set_results = 'utf8mb4', character_set_client = 'utf8mb4', character_set_connection = 'utf8mb4', character_set_database = 'utf8mb4', character_set_server = 'utf8mb4'", $conn);
 
 #	if($filter=='') {
#		 $query.=" WHERE ActivateEndDate BETWEEN '" . $start_date . "' AND '" . $end_date . "' ";
#	   }

  if($SortValue==''){$query=$query ." ORDER BY Pelatis_Eponymia ";} else {$query=$query." ORDER BY " . $SortValue . " ";}
 
 $_SESSION['EXCEL_SQL']=$query;
 

  $num_rows=RecordsCount($conn,$query);
     $RecNo=$num_rows;
   $FromRec=($pgNo-1)*$RecsPP ;
     $pgMax=intval($num_rows/$RecsPP)+1;
  
    $query=$query.' LIMIT '.$FromRec . ', ' . $RecsPP ;
   $result=mysqli_query($conn, $query);
 
$iRow=$FromRec;

 while ($rs = mysqli_fetch_array($result)) {

$iRow +=1;
 
$IDTameiakis = $rs['IDTameiakis'];
$Pelatis_Eponymia=$rs['Pelatis_Eponymia'];
$Pelatis_Phone=$rs['Pelatis_Phone'];

$Tameiaki_Model = $rs['Tameiaki_Model'];
$Tameiaki_SN = $rs['Tameiaki_SN'];
$Tameiaki_Voucher= $rs['Tameiaki_Voucher'];
$Tameiaki_Updated= $rs['Tameiaki_Updated'];
$Tameiaki_Updated_Date=formatMyDate($rs['Tameiaki_Updated_Date'],"MySqlToGr");

$POS_Model = $rs['POS_Model'];
$POS_SN = $rs['POS_SN'];
$POS_Trapeza= $rs['POS_Trapeza'];
$POS_Manual= $rs['POS_Manual']; 
$POS_Connected= $rs['POS_Connected'];
$POS_Connected_Date=formatMyDate($rs['POS_Connected_Date'],"MySqlToGr");

$KostosMeFPA =  $rs['KostosMeFPA'];
$Sxolia=$rs['Sxolia'];
 
$Tameiaki_Voucher_Chk='unckecked'; if($Tameiaki_Voucher==-1){$Tameiaki_Voucher_Chk='checked';} 
$Tameiaki_Updated_Chk='unckecked'; if($Tameiaki_Updated==-1){$Tameiaki_Updated_Chk='checked';} 
$POS_Connected_Chk='unckecked';    if($POS_Connected==-1){$POS_Connected_Chk='checked';} 

$frmOpen='"'.$MyIDFieldName.'","'.$IDTameiakis.'","'.$MyADDFormName.'",' ;
$BackColorF="";
if($Tameiaki_Updated==-1 && $POS_Connected==-1) { 
	$BackColorF='style="background:#66BB7A;color:white;"'; 
};

if($Tameiaki_Updated==-1 && !$POS_Connected==-1) { 
	$BackColorF='style="background:#ffff99;"'; 
}; 
// ========================================
//  Tameiakes List
// ========================================
 
    echo "<tr class='tablerowdata' $BackColorF onclick='javascript:OpenFormADD($frmOpen);'> ";
	echo "<td class='r w50'>$iRow</td>";
	echo "<td> $Pelatis_Eponymia </td>";
	echo "<td class='c w80 hide1'> $Pelatis_Phone </td>";
	echo "<td class='c w100 '>$Tameiaki_Model</td>";
	echo "<td class='c w80 hide1'><input size ='1' type='checkbox' $Tameiaki_Voucher_Chk ></td>";
	echo "<td class='c w80 hide1'><input size ='1' type='checkbox' $Tameiaki_Updated_Chk ></td>";
    echo "<td class='c w100 hide1'>$Tameiaki_Updated_Date</td>";
	
	echo "<td class='c w80 hide1'>$POS_Model</td>";
	echo "<td class='c w80 hide1'><input size ='1' type='checkbox' $POS_Connected_Chk ></td>";
	echo "<td class='c w100 hide1'>$POS_Connected_Date</td>";
 
	echo "<td class='hide1'>$Sxolia</td>";
    echo "</tr>";   
 }
  
 
for ($x = $iRow+1; $x <= $pgNo*$RecsPP; $x++) {
    echo "<tr class='tablerowdata' onclick='javascript:OpenFormADD($frmOpenNew);'> ";
	echo "<td class='r w50'></td>";
	echo "<td> </td>";
	echo "<td class='c w80 hide1'></td>";
	echo "<td class='c w80 '></td>";
	echo "<td class='c w100 hide1'></td>";
	echo "<td class='c w80 hide1'></td>";
    echo "<td class='c w100 hide1'></td>";
	
	echo "<td class='c w80 hide1'></td>";
	echo "<td class='c w80 hide1'></td>";
	echo "<td class='c w100 hide1'></td>";
 
	echo "<td class='hide1'></td>";
    echo "</tr>";
 }	
 

?>
</table>


<?php include 'include/recs_div_bottom.php'; ?>
 
</div>	
 
</body>
 
</form> 

<script type="text/javascript" src="js/mycheck.js"></script>  
<?php 
  include 'include/footer2020.php';
?>
 
<script language="JavaScript" type="text/JavaScript">

function export_to_excel() {

var mSQL="<?php echo $query; ?>";


	export_excel(mSQL);
	
}
</script>
