<?php if(!defined('ADMIN_INCLUDED')) { exit; } ?>
<?php
if(!m_authority(m_admin('authoritys'),'reports'))
{
m_redirect(ADMIN_URL);
}
?>
<div class="card mt-2 mb-3">
<div class="card-header fw-bold">Satış Raporları</div>
<div class="card-body">
<table class="table align-middle table-nowrap table-striped datatable">
<thead class="table-light">
<tr>
<th>Müşteri</th>
<th>Toplam Ürün</th>
<th>Tutar</th>
<th>İskonto</th>
<th>İskonto Tutarı</th>
<th>Toplam</th>
<th>Tarih</th>
<th>İşlemler</th>
<th>Yazdır</th> <!-- Yeni sütun başlığı -->
</tr>
</thead>
<tbody>
<?php
$informations = $db->table('sales')->order('id','desc')->get();
foreach($informations['data'] as $info)
{
$products = $db->select('sum(quantity) as total')->table('sales_products')->where('s_id','=',$info['id'])->order('id','desc')->get();
$products = $products['data'][0]['total'];
echo
'
<tr>
<td>'.$info['customer'].'</td>
<td>'.$products.'</td>
<td>'.m_currency($info['total']).' €</td>
<td>%'.$info['discount'].'</td>
<td>'.m_currency($info['discounted']).' €</td>
<td>'.m_currency($info['total_price']).' €</td>
<td data-order="'.strtotime($info['date']).'">'.m_date_to_tr($info['date']).'</td>
<td>
<a href="'.SITE_DOMAIN.'/index.php?page=sale&id='.$info['id'].'"><span class="btn btn-primary btn-sm"><i class="fa fa-pen-square"></i></span></a>
<a href="'.SITE_DOMAIN.'/index.php?page=delete&table=sales&id='.$info['id'].'" class="delete"><span class="btn btn-danger btn-sm"><i class="fa fa-trash"></i></span></a>
</td>
<td>
<button class="btn btn-success btn-sm" onclick="printSale('.$info['id'].')"><i class="fa fa-print"></i></button>
</td>
</tr>
';
}
?>
</tbody>
</table>
</div>
</div> |