<?php if(!defined('ADMIN_INCLUDED')) { exit; } ?>
<?php
if(!m_authority(m_admin('authoritys'),'products'))
{
m_redirect(ADMIN_URL);
}
?>
<div class="card mt-2 mb-3">
<div class="card-header fw-bold">Stok Hareketleri</div>
<div class="card-body">
<div class="text-end">
<a href="<?php echo SITE_DOMAIN; ?>/index.php?page=stock_add"><span class="btn btn-success btn-sm"><i class="fa fa-plus-circle"></i> Stok Ekle</span></a>
</div>
<table class="table align-middle table-nowrap table-striped datatable">
<thead class="table-light">
<tr>
<th>Ürün Adı</th>
<th>Ürün Barkodu</th>
<th>Stok Girişi</th>
<th>Alış Fiyatı</th>
<th>Tarih</th>
<th>İşlemler</th>
</tr>
</thead>
<tbody>
<?php
$informations = $db->table('product_stocks')->order('id','desc')->get();
foreach($informations['data'] as $info)
{
$product = $db->table('products')->where('id','=',$info['p_id'])->get_vars();
echo
'
<tr>
<td>'.$product['name'].'</td>
<td>'.$product['barcode'].'</td>
<td data-order="'.$info['stock'].'">'.$info['stock'].'</td>
<td data-order="'.$info['buy_price'].'">'.m_currency($info['buy_price']).' '.$info['price_type'].'</td>
<td data-order="'.strtotime($info['date']).'">'.m_date_to_tr($info['date']).'</td>
<td>
<a href="'.SITE_DOMAIN.'/index.php?page=delete&table=stocks&id='.$info['id'].'" class="delete"><span class="btn btn-danger btn-sm"><i class="fa fa-trash"></i></span></a>
</td>
</tr>
';
}
?>
</tbody>
</table>
</div>
</div>