<?php require_once('../auth/auth.php');
// mysqli_query($conn,"UPDATE `item` SET `item_qty`=(SELECT SUM(COALESCE(CASE WHEN plus = '+' THEN qty END,0)) - SUM(COALESCE(CASE WHEN plus = '-' THEN qty END,0)) FROM order_list WHERE pro_id=item.pro_id GROUP BY pro_id),`avg_cost`=(SELECT SUM(COALESCE(CASE WHEN plus = '+' THEN t_amount END,0)) / SUM(COALESCE(CASE WHEN plus = '+' THEN qty END,0)) FROM order_list WHERE  pro_id=item.pro_id AND item.coid='$coid' AND item.bid='$bid' AND item.brid='$brid' GROUP BY pro_id)") or die (mysqli_error($conn));

?>
<?php $c_acid = mysqli_fetch_assoc(mysqli_query($conn,"SELECT acid FROM accounts WHERE coid='$coid' AND bid='$bid' AND brid='$brid' AND active=1 AND ac_type = 'wcustomer' LIMIT 1"))['acid'];
?>
<section class="content pb-1">
   <ul class="nav nav-pills" style="background-color: honeydew;padding: 2px 0;border-bottom:1px solid #dee2e6;margin-left: 2px;">
     <?php if(per('g_sale')==1){ ?> 
      <!--<li class="nav-item"><a style="padding: 0px 8px;" class="nav-link" href="#" data-toggle="tab" onclick="pagecall('../sales/gsales_index.ph?c_acid=<?php echo $c_acid;?>'+'&sltype=ECSL','#salmview');"><i class="fas fa-shopping-cart"></i> <?php echo language(327);?> </a></li>|-->
     <?php } if(per('ecash_sale')==1){ ?> 
      <li class="nav-item"><a style="padding: 0px 8px;" class="nav-link" href="#" data-toggle="tab" onclick="pagecall('../sales/sales_index.php?c_acid=<?php echo $c_acid;?>'+'&sltype=ECSL','#salmview');"><i class="fas fa-shopping-cart"></i> <?php echo language(62);?> </a></li>|
     <?php } if(per('eretail_sale')==1){ ?> 
      <li class="nav-item"><a style="padding: 0px 8px;" class="nav-link" href="#" data-toggle="tab" onclick="pagecall('../sales/cus_select.php?sltype=ERSL','#salmview');"><i class="fas fa-shopping-cart"></i> <?php echo language(63);?> </a></li>|
     <?php } if(per('eretail_sale')==1){ ?> 
      <li class="nav-item"><a style="padding: 0px 8px;" class="nav-link" href="#" data-toggle="tab" onclick="pagecall('../sales/cus_select.php?sltype=INSL','#salmview');"><i class="fas fa-shopping-cart"></i> <?php echo language(375);?> </a></li>|
     <?php } if(per('esale_retrun')==1){ ?> 
         <li class="nav-item"><a style="padding: 0px 8px;" class="nav-link" href="#" data-toggle="tab" onclick="pagecall('../sales_retrun/re_cus_select_live.php','#salmview');"><i class="fas fa-cart-arrow-down"></i> <?php echo language(64); ?></a></li>|
     <?php } if(per('esale_list')==1){ ?> 
      <li class="nav-item"><a style="padding: 0px 8px;" class="nav-link" href="#" data-toggle="tab" onclick="pagecall('../display_report/sales_register.php','#salmview');"><i class="fas fa-list"></i> <?php echo language(186);?></a></li>|
     <?php } if(per('esale_draft')==1){ ?> 
      <li class="nav-item"><a style="padding: 0px 8px;" class="nav-link" href="#" data-toggle="tab" onclick="pagecall('../sales/draft_list.php','#salmview');"><i class="fas fa-list"></i> <?php echo language(66);?></a></li>|
     <?php } if(per('esale_sett')==1){ ?> 
      <li class="nav-item"><a style="padding: 0px 8px;" class="nav-link" href="#" data-toggle="tab" onclick="pagecall('../sales/setting.php','#salmview');"><i class="fas fa-eye-slash"></i></i> <?php echo language(67);?> </a></li>|
     <?php } ?>   
  </ul>
</section>
<section class="content">
   <div id="salmview"></div>
</section>