<style>
.doc{background-image: url('filebrowse/images/document.png'); background-size: contain; height:65px; width:70px; float: left; display: inline-block; position: relative}
.thumbnail {
    display: inline-block;
    border: #e8e8e8 1px solid;
    width: 150px;
    height: 120px;
    overflow: hidden;
    margin: 4px;
    position: relative;
    overflow: hidden;
    cursor: pointer;
    font-size: 11px;
    border-radius: 6px;
    background-color: #f4f4f4;
}
a.thumbitem {
    display: block;
    border: none;
    width: 100%;
    height: 100%;
    text-align: center;
}
.thumbfooter {
    position: absolute;
    bottom: 0px;
    width: 100%;
    padding: 5px 0px;
    background-color: rgba(0,0,0,0.6);
    text-align: center;
	color:#fff
}
.thumbtype {
    position: absolute;
    top: 25%;
    left: 15px;
    background-color: rgba(50,163,167,0.8);
    padding: 5px 0px;
    font-size: 1.1em;
    color: #ffffff;
    width: 40px;
    text-align: center;
    /* box-shadow: 2px 2px 5px #888888; */
}

</style>
<?php
$dir="output/reps/";
$files = glob("output/reps/*.pdf");
$fileNames=array('expenses'=>'/Expenses/','outstanding'=>'/Invoice Outstanding/','paid'=>'/Invoice Paid/','outgoings_cat'=>'/Outgoings by Category/','reciepts_cat'=>'/Receipts by Category/','reciepts'=>'/Receipts/i','vi'=>'/VAT In/','vo'=>'/VAT Out/');

function getName($n,$t){
$name=str_replace('output/reps/000_','',$n);
$name=str_replace('.pdf','',$name);
$name=str_replace($t."_",'',$name);
$name=str_replace('_',' / ',$name);
return $name;
}

foreach($fileNames as $k=>$v){
$$k = preg_grep($v, $files);
}
?>

<div class="row"><h4>Expenses</h4></div>
<div class="row">
<?php foreach($expenses as $v){?>
<div class="thumbnail">
<a href="<?php echo $v?>" class="thumbitem" target="_blank"><img src="filebrowse/images/document.png"></a>
<div class="thumbtype">PDF</div>
<div class="thumbfooter"><?php echo getName($v, 'Expenses')?></div>
</div>
<?php }?>
</div>

<hr class="clearfix" />

<div class="row"><h4>Invoice Outstanding</h4></div>
<div class="row">
<?php foreach($outstanding as $v){?>
<div class="thumbnail">
<a href="<?php echo $v?>" class="thumbitem" target="_blank"><img src="filebrowse/images/document.png"></a>
<div class="thumbtype">PDF</div>
<div class="thumbfooter"><?php echo getName($v, 'Invoice Outstanding')?></div>
</div>
<?php }?>
</div>

<hr class="clearfix" />

<div class="row"><h4>Invoice Paid</h4></div>
<div class="row">
<?php foreach($paid as $v){?>
<div class="thumbnail">
<a href="<?php echo $v?>" class="thumbitem" target="_blank"><img src="filebrowse/images/document.png"></a>
<div class="thumbtype">PDF</div>
<div class="thumbfooter"><?php echo getName($v, 'Invoice Paid')?></div>
</div>
<?php }?>
</div>

<hr class="clearfix" />

<div class="row"><h4>Outgoings by Category</h4></div>
<div class="row">
<?php foreach($outgoings_cat as $v){?>
<div class="thumbnail">
<a href="<?php echo $v?>" class="thumbitem" target="_blank"><img src="filebrowse/images/document.png"></a>
<div class="thumbtype">PDF</div>
<div class="thumbfooter"><?php echo getName($v, 'Outgoings by Category')?></div>
</div>
<?php }?>
</div>

<hr class="clearfix" />

<div class="row"><h4>Receipts by Category</h4></div>
<div class="row">
<?php foreach($reciepts_cat as $v){?>
<div class="thumbnail">
<a href="<?php echo $v?>" class="thumbitem" target="_blank"><img src="filebrowse/images/document.png"></a>
<div class="thumbtype">PDF</div>
<div class="thumbfooter"><?php echo getName($v, 'Receipts by Category')?></div>
</div>
<?php }?>
</div>

<hr class="clearfix" />

<div class="row"><h4>Receipts</h4></div>
<div class="row">
<?php foreach($reciepts as $v){
if(strpos($v,'Receipts by Category')){}
else{
?>
<div class="thumbnail">
<a href="<?php echo $v?>" class="thumbitem" target="_blank"><img src="filebrowse/images/document.png"></a>
<div class="thumbtype">PDF</div>
<div class="thumbfooter"><?php echo getName($v, 'Receipts')?></div>
</div>
<?php }}?>
</div>

<hr class="clearfix" />

<div class="row"><h4>VAT In</h4></div>
<div class="row">
<?php foreach($vi as $v){?>
<div class="thumbnail">
<a href="<?php echo $v?>" class="thumbitem" target="_blank"><img src="filebrowse/images/document.png"></a>
<div class="thumbtype">PDF</div>
<div class="thumbfooter"><?php echo getName($v, 'VAT In')?></div>
</div>
<?php }?>
</div>

<hr class="clearfix" />

<div class="row"><h4>VAT Out</h4></div>
<div class="row">
<?php foreach($vo as $v){?>
<div class="thumbnail">
<a href="<?php echo $v?>" class="thumbitem" target="_blank"><img src="filebrowse/images/document.png"></a>
<div class="thumbtype">PDF</div>
<div class="thumbfooter"><?php echo getName($v, 'VAT Out')?></div>
</div>
<?php }?>
</div>
<div class="clearfix"></div>

<script>

$('.kv-file-remove').css('display','none');
$('.fileinput-remove').css('display','none');
$('.file-caption-main').css('display','none');
$('.file-drag-handle').css('display','none');


</script>