HOME


Mini Shell 1.0
DIR: /proc/self/root/proc/self/root/home/kerimkazan/dvf/inc/
Upload File :
Current File : //proc/self/root/proc/self/root/home/kerimkazan/dvf/inc/products.php
<?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">Ürünler</div>
		<div class="card-body">
		<div class="text-end">
			<a href="<?php echo SITE_DOMAIN; ?>/index.php?page=product_add"><span class="btn btn-success btn-sm"><i class="fa fa-plus-circle"></i> Ürün 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>Barkod</th>
					<th>Satış Fiyatı</th>
					<th>Stok</th>
					<th>Satış</th>
					<th>Durum</th>
					<th>İşlemler</th>
				</tr>
			</thead>
			<tbody>
			<?php
			$informations = $db->table('products')->order('id','desc')->get();
			foreach($informations['data'] as $info)
			{
				$sale = $db->select('SUM(quantity) as total')->table('sales_products')->where('p_id','=',$info['id'])->get();
			
				if($sale['total_count']>0)
				{
					$sales = $sale['data'][0]['total'];
				}
				else
				{
					$sales = 0;
				}
				
				if($sales=='')
			    {
			        $sales=0;
			    }
				
				$stock = $db->select('sum(variant_stock) as stock,id')->table('product_variants')->where('p_id','=',$info['id'])->get();
    			$stock_id = $stock['data'][0]['id'];
    			$stock = $stock['data'][0]['stock'];
				
				if($stock=='')
			    {
			        $stock=0;
			    }
				
				echo 
				'
				<tr>
				<td>'.$info['name'].'</td>
				<td>'.$info['barcode'].'</td>
				<td>'.m_currency($info['sale_price']).' '.$info['price_type'].'</td>
				<td>'.$stock.'</td>
				<td>'.$sales.'</td>
				<td>'.m_status($info['status']).'</td>
				<td>
				<a href="'.SITE_DOMAIN.'/index.php?page=product&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=products&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>