<?php 
define('DOCUMENT_ROOT_CLASS','../../');
define('DOCUMENT_ROOT_INC_FOLDER','inc/');
$filepath = realpath(dirname(__FILE__));
require "../../inc/header.php";
$msg = Session::get('msg');
Session::set("msg", NULL);
$productData = $commonFunctions->getRowData('invty_pdt_details'," WHERE id = '".@$_GET['product_id']."' ");
?>

    <!-- Page-Title -->
    <div class="row">
        <div class="col-sm-12">
            <div class="page-title-box">
                <div class="row">
                    <div class="col"> 
                        <h4 class="page-title"><?php echo @$productData['label'];?></h4>
                        <ol class="breadcrumb">
                            <li class="breadcrumb-item"><a href="javascript:void(0);">Products & Services</a></li>
                            <li class="breadcrumb-item"><a href="javascript:void(0);">Products</a></li>
                            <li class="breadcrumb-item active">Products Details</li>
                        </ol> 
                    </div><!--end col-->
                    <div class="col-auto align-self-center">
                        <a href="product.php?state=edit&product_id=<?php echo $productData['id'];?>">
                            <button type="button" class="btn btn-sm btn-primary"> <i class="fas fa-edit align-self-center icon-xs"></i> Edit</button>
                        </a>
                        <a href="product.php?state=copy&product_id=<?php echo $productData['id'];?>">
                            <button type="button"class="btn btn-sm btn-warning"> <i class="fas fa-copy align-self-center icon-xs"></i> Duplicate</button>
                        </a>
                        <a href="product.php?state=list"><button type="button" class="btn btn-sm btn-secondary clear_form"> <i class="fas fa-angle-double-left align-self-center icon-xs"></i> Back to Products List</button></a>
                    </div>

                </div><!--end row-->                                                              
            </div><!--end page-title-box-->
        </div><!--end col-->
    </div><!--end row-->
    <!-- end page title end breadcrumb -->

    <div class="row">
        <div class="col-12">
            <div class="card">
                <!--div class="card-body p-0">
                    <div id="user_map" class="pro-map" style="height: 220px"></div>                                     
                </div--><!--end card-body-->                                
                <div class="card-body">
                    <div class="dastone-profile">
                        <div class="row">
                            <div class="col-lg-3 align-self-center mb-3 mb-lg-0">
                                <div class="dastone-profile-main">
                                    <div class="dastone-profile-main-pic">
                                        <img src="../../uploads/product-services/product-images/<?php echo @$productData['product_images'];?>" alt="" height="70" class="thumb-lx rounded">
                                    </div>
                                </div>                                                
                            </div><!--end col-->
                            <div class="col-lg-3 align-self-center mb-3 mb-lg-0">
                                <div class="dastone-profile-main">
                                    <div class="dastone-profile-main-pic">
                                         <?php 
                                        $barcode_type = $commonFunctions->getname($productData['barcode_type'],'sys_erp_adm_barcode_type','label','id');
                                        $barcode_type = @str_replace(" ", "", $barcode_type);
                                        echo "<img alt='barcode' src='".DOCUMENT_ROOT_CLASS."lib/barcode.php?codetype=".$barcode_type."&size=40&text=".@$productData['barcode_value']."&print=true'/>";?>
                                    </div>
                                </div>                                                
                            </div><!--end col-->
                            <div class="col-lg-5 align-self-center mb-3 mb-lg-0">
                                <div class="dastone-profile-main">     
                                    <div class="dastone-profile_user-detail">
                                        <h5 class="dastone-user-name"><?php echo @$productData['label'];?></h5>
                                        <p class="mt-0 mb-0"><i class="text-secondary font-22 align-middle"></i> <b> Barcode :</b>  <?php echo @$productData['barcode_value'];?></p>
                                        <p class="mt-0 mb-0"><i class="text-secondary font-22 align-middle"></i> <b> Ref ID  :</b>  <?php echo @$productData['reference_number'];?></p>
                                    </div>
                                </div>                                                
                            </div> 

                        </div>
                    </div>                                                                                
                </div>
            </div>
        </div>
        <!-- <div class="col-12">
            <div class="card">
                <div class="card-body">
                    <div class="dastone-profile">
                        <div class="row">
                            <div class="col-lg-3 align-self-center mb-lg-0">
                                <div class="dastone-profile-main">
                                    <div class="dastone-profile_user-detail">
                                        <img src="../../uploads/product-services/product-images/<?php echo @$productData['product_images'];?>" width="80px">                                              
                                    </div>
                                </div>                                                
                            </div>
                            <div class="col-lg-4 align-self-center mb-lg-0">
                                <div class="dastone-profile-main">
                                    <div class="dastone-profile_user-detail">
                                        <?php 
                                        $barcode_type = $commonFunctions->getname($productData['barcode_type'],'sys_erp_adm_barcode_type','label','id');
                                        //echo "<img alt='testing' src='../../lib/barcode.php?codetype=".$barcode_type."&size=40&text=".@$productData['barcode_value']."&print=true'/>";
                                        ?>
                                        <div id="barcodeTarget" class="barcodeTarget"></div>
										<canvas id="canvasTarget" width="150" height="150"></canvas>
                                    </div>
                                </div>                                                
                            </div> 
                            <div class="col-lg-5 align-self-center mb-lg-0">
                                <div class="dastone-profile-main">
                                    <div class="dastone-profile_user-detail">
                                    	<b><?php echo @$productData['label'];?></b><br>
                                    	<?php 
                                    	$stock = $commonFunctions->getname($productData['id'],"invty_pdt_stock_mgt","SUM(stock_count)","product_id");

                                    	if(@$stock != 0 OR $productData['virtual_stock'] != 0): ?>
                                        	<span style="color: green;">IN STOCK</span>
                                        <?php else: ?>
                                        	<span style="color: red;">OUT OF STOCK</span>
                                        <?php endif; ?>
                                    </div>
                                </div>                                                
                            </div> 

                        </div>
                    </div>                                                                                
                </div>    
            </div> 
        </div> -->
    </div>
    <div class="pb-4">
        <ul class="nav-border nav nav-pills mb-0" id="pills-tab" role="tablist">
            <li class="nav-item">
                <a class="nav-link active" id="product_details_tab" data-toggle="pill" href="#product_details">Product Details</a>
            </li>
            <li class="nav-item">
                <a class="nav-link" id="purchase_details_tab" data-toggle="pill" href="#purchase_details">Purchase Statistics</a>
            </li>
            <li class="nav-item">
                <a class="nav-link" id="related_invoice_tab" data-toggle="pill" href="#related_invoice">Sales Statistics</a>
            </li>
            <li class="nav-item">
                <a class="nav-link" id="stock_statistics_tab" data-toggle="pill" href="#stock_statistics">Stock Statistics</a>
            </li>
            <li class="nav-item">
                <a class="nav-link" id="stock_mov_statistics_tab" data-toggle="pill" href="#stock_mov_statistics">Stock Movements Statistics</a>
            </li>
            <!-- <li class="nav-item">
                <a class="nav-link" id="statistics_tab" data-toggle="pill" href="#statistics">Statistics</a>
            </li> -->
            <li class="nav-item">
                <a class="nav-link" id="note_tab" data-toggle="pill" href="#note">Note</a>
            </li>
        </ul>        
    </div><!--end card-body-->
    <style type="text/css">
    	label.form-control1 {display: block;}
    	label.label-title {font-weight: 600;}
    </style>
    <div class="row">
        <div class="col-12">
            <div class="tab-content" id="pills-tabContent">
                <div class="tab-pane fade show active" id="product_details" role="tabpanel" aria-labelledby="product_details_tab">
                	<div class="row">
                        <div class="col-12">
                            <div class="tab-content" id="pills-tabContent">

                                <!-- User Profile - Start --->
                                <div class="tab-pane fade show active" id="Product_Details" role="tabpanel" aria-labelledby="settings_detail_tab">
                                    <div class="row">
                                        
                                        <!-- Personal Information Card - Start --->
                                        <div class="col-lg-6 col-xl-6">
                                            <div class="card">
                                                <div class="card-header">
                                                    <div class="row align-items-center">
                                                        <div class="col-11">                      
                                                            <h4 class="card-title text-left">Product Details <label class="col-xl-3 col-lg-3 mb-lg-0 align-self-center">( Basic )</label></h4>                      
                                                        </div><!--end col-->                                                 
                                                    </div>  <!--end row-->                                  
                                                </div><!--end card-header-->
                                                <div class="card-body">                                                                          
                                                    <div class="form-group row">                                         
                                                        <label class="col-xl-3 col-lg-3 text-left mb-lg-0 align-self-center">Label / Product Name</label>
                                                        <div class="col-lg-9 col-xl-8">
                                                            <h5 class="card-title"> <?php echo @$productData['label'];?> </h5>
                                                        </div>
                                                    </div>
                                                    <div class="form-group row">                                         
                                                        <label class="col-xl-3 col-lg-3 text-left mb-lg-0 align-self-center">Barcode Value</label>
                                                        <div class="col-lg-9 col-xl-8">
                                                            <h5 class="card-title"> <?php echo @$productData['barcode_value'];?> </h5>
                                                        </div>
                                                    </div>
                                                    <div class="form-group row">                                         
                                                        <label class="col-xl-3 col-lg-3 text-left mb-lg-0 align-self-center">Description</label>
                                                        <div class="col-lg-9 col-xl-8">
                                                            <h5 class="card-title"> <?php echo @$productData['description'];?> </h5>
                                                        </div>
                                                    </div>                                    
                                                    <div class="form-group row">                                         
                                                        <label class="col-xl-3 col-lg-3 text-left mb-lg-0 align-self-center">Product Image</label>
                                                        <div class="col-lg-9 col-xl-8">
                                                            <h5 class="card-title"> <?php echo @$productData['product_images'];?> </h5>
                                                        </div>
                                                    </div>  
                                                    <div class="form-group row">                                         
                                                        <label class="col-xl-3 col-lg-3 text-left mb-lg-0 align-self-center">Nature of Product</label>
                                                        <div class="col-lg-9 col-xl-8">
                                                            <h5 class="card-title"> <?php echo (@$productData['nature'] == "1")?"Manufactured Product":"Raw Material";?> </h5>
                                                        </div>
                                                    </div>
                                                    <div class="form-group row">                                         
                                                        <label class="col-xl-3 col-lg-3 text-left mb-lg-0 align-self-center">Country of Origin</label>
                                                        <div class="col-lg-9 col-xl-8">
                                                            <h5 class="card-title"> <?php echo $commonFunctions->getName(@$productData['country_id'],'sys_erp_adm_countries','label','rowid');?> </h5>
                                                        </div>
                                                    </div>
                                                    <div class="form-group row">                                         
                                                        <label class="col-xl-3 col-lg-3 text-left mb-lg-0 align-self-center">Public URL</label>
                                                        <div class="col-lg-9 col-xl-8">
                                                            <h5 class="card-title"> <?php echo @$productData['public_url'];?> </h5>
                                                        </div>
                                                    </div>
                                                </div>                                            
                                            </div>

                                            <div class="card">
                                                <div class="card-header">
                                                    <div class="row align-items-center">
                                                        <div class="col-11">                      
                                                            <h4 class="card-title text-left">Stock &amp; Inventory </h4>                      
                                                        </div><!--end col-->                                                   
                                                    </div>  <!--end row-->                                  
                                                </div><!--end card-header-->
                                                <div class="card-body">                                                                          
                                                    <div class="form-group row">                                         
                                                        <label class="col-xl-3 col-lg-3 text-left mb-lg-0 align-self-center">Default Warehouse</label>
                                                        <div class="col-lg-9 col-xl-8">
                                                           <h5 class="card-title"> <?php $warehouseData = $commonFunctions->getData('invty_wrhus',' WHERE status = 0 '); ?>
                                                    <?php foreach ($warehouseData as $rw) { ?>
                                                        <?php echo (@$productData['default_warehouse_id'] == $rw['id'])?$rw['short_name_location']:"";?>
                                                    <?php } ?> </h5>
                                                        </div>
                                                    </div>
                                                    <div class="form-group row">                                         
                                                        <label class="col-xl-3 col-lg-3 text-left mb-lg-0 align-self-center"> Stock Limit for Alert</label>
                                                        <div class="col-lg-9 col-xl-8">
                                                            <h5 class="card-title"> <?php echo (empty(@$productData['stock_limit_alert']))?0:@$productData['stock_limit_alert'];?> </h5>
                                                        </div>
                                                    </div>
                                                    <div class="form-group row">                                         
                                                        <label class="col-xl-3 col-lg-3 text-left mb-lg-0 align-self-center">Desired Optimal Stock</label>
                                                        <div class="col-lg-9 col-xl-8">
                                                            <h5 class="card-title"> <?php echo (empty(@$productData['desired_optimal_stock']))?0:@$productData['desired_optimal_stock'];?> </h5>
                                                        </div>
                                                    </div>                                                                                             
                                                </div><!--end card-body-->
                                            </div><!--end card-->

                                        </div> <!--end col--> 
                                        <!-- Contact Information Personal  Card - End --->

                                        <!-- Contact Information Card Official - Start --->
                                        <div class="col-lg-6 col-xl-6">

                                            <div class="card">
                                                <div class="card-header">
                                                    <div class="row align-items-center">
                                                        <div class="col-12">                      
                                                            <h4 class="card-title text-left">Barcode / Ref Details <label class="col-xl-8 col-lg-8 mb-lg-0 align-self-center">( Barcode Value helps in tracking the Product )</label></h4>
                                                        </div><!--end col-->                                                      
                                                    </div>  <!--end row-->                                  
                                                </div><!--end card-header-->
                                                <div class="card-body">   
                                                    <div class="form-group row">                                         
                                                        <label class="col-xl-3 col-lg-3 text-left mb-lg-0 align-self-center"> Reference ID / Number</label>
                                                        <div class="col-lg-9 col-xl-8">
                                                            <h5 class="card-title"> <?php echo @$productData['reference_number'];?></h5>
                                                        </div>
                                                    </div>                                                                       
                                                    <div class="form-group row">                                         
                                                        <label class="col-xl-3 col-lg-3 text-left mb-lg-0 align-self-center">Barcode Type</label>
                                                        <div class="col-lg-9 col-xl-8">
                                                            <h5 class="card-title"> <?php
                                                $barcodeArr = $commonFunctions->getData('sys_erp_adm_barcode_type',' WHERE active = 1 ');
                                                foreach ($barcodeArr as $row) { ?>
                                                    <?php echo (@$productData['barcode_type'] == $row['id'])?$row['label']:"";?>
                                                <?php } ?> </h5>
                                                        </div>
                                                    </div>
                                                    <div class="form-group row">                                         
                                                        <label class="col-xl-3 col-lg-3 text-left mb-lg-0 align-self-center">Barcode Value</label>
                                                        <div class="col-lg-9 col-xl-8">
                                                            <h5 class="card-title"> <?php echo @$productData['barcode_value'];?></h5>
                                                        </div>
                                                    </div>
                                                </div><!--end card-body-->
                                            </div><!--end card-->

                                            <div class="card">
                                                <div class="card-header">
                                                    <div class="row align-items-center">
                                                        <div class="col-11">                      
                                                            <h4 class="card-title text-left">Sales &amp; Purchase</h4>
                                                        </div><!--end col-->                                                      
                                                    </div>  <!--end row-->                                  
                                                </div><!--end card-header-->
                                                <div class="card-body">                                                                          
                                                    <div class="form-group row">                                         
                                                        <label class="col-xl-5 col-lg-3 text-left mb-lg-0 align-self-center">Sales Status</label>
                                                        <div class="col-lg-3 col-xl-7">
                                                            <h5 class="card-title"> <?php echo (@$productData['sales_status'] == "1")?"For Sale":"";?><?php echo (!empty($productData) and @$productData['sales_status'] == "0")?"Not For Sale":"";?></h5>
                                                        </div>
                                                    </div>
                                                    <div class="form-group row">                                         
                                                        <label class="col-xl-5 col-lg-3 text-left mb-lg-0 align-self-center">Purchase Status</label>
                                                        <div class="col-lg-3 col-xl-7">
                                                            <h5 class="card-title"> <?php echo (@$productData['purchase_status'] == "1")?"For Purchase":"";?>
                                                    <?php echo (!empty($productData) and @$productData['purchase_status'] == "0")?"Not For Purchase":"";?> </h5>
                                                        </div>
                                                    </div>
                                                    <div class="form-group row">                                         
                                                        <label class="col-xl-5 col-lg-3 text-left mb-lg-0 align-self-center">Selling Price</label>
                                                        <div class="col-lg-3 col-xl-3">
                                                           <h5 class="card-title"> <?php echo (empty(@$productData['price']))?0:@$productData['price'];?> /- QAR </h5>
                                                        </div>
                                                        <div class="col-lg-3 col-xl-3">
                                                           <h5 class="card-title"> <?php echo @$productData['selling_price_type'];?></h5>
                                                        </div>
                                                    </div>
                                                    <div class="form-group row">                                         
                                                        <label class="col-xl-5 col-lg-3 text-left mb-lg-0 align-self-center">Min. Selling Price</label>
                                                        <div class="col-lg-3 col-xl-3">
                                                           <h5 class="card-title"> <?php echo @$productData['min_price'];?>/- QAR </h5>
                                                        </div>
                                                        <div class="col-lg-3 col-xl-3">
                                                           <h5 class="card-title"> <?php echo @$productData['min_selling_price_type'];?></h5>
                                                        </div>
                                                    </div>
                                                    <div class="form-group row">                                         
                                                        <label class="col-xl-5 col-lg-3 text-left mb-lg-0 align-self-center">Buying Price</label>
                                                        <div class="col-lg-3 col-xl-3">
                                                           <h5 class="card-title"> <?php echo @$productData['buying_price'];?>/- QAR</h5>
                                                        </div>
                                                        <div class="col-lg-3 col-xl-3">
                                                           <h5 class="card-title"> <?php echo @$productData['buying_price_type'];?></h5>
                                                        </div>
                                                    </div>
                                                    <div class="form-group row">                                         
                                                        <label class="col-xl-5 col-lg-3 text-left mb-lg-0 align-self-center">Cost Price</label>
                                                        <div class="col-lg-3 col-xl-3">
                                                           <h5 class="card-title"> <?php echo @$productData['cost_price'];?>/- QAR </h5>
                                                        </div>
                                                        <div class="col-lg-3 col-xl-3">
                                                           <h5 class="card-title"> <?php echo @$productData['cost_price_type'];?></h5>
                                                        </div>
                                                    </div>
                                                    <div class="form-group row">                                         
                                                        <label class="col-xl-5 col-lg-3 text-left mb-lg-0 align-self-center">Selling Type</label>
                                                        <div class="col-lg-3 col-xl-7">
                                                           <h5 class="card-title"> <?php echo (@$productData['selling_type'] == 0)?"Fixed Amount":"";?><?php echo (@$productData['selling_type'] == 1)?"Recurring Amount":"";?> </h5>
                                                        </div>
                                                    </div>
                                                    <div class="form-group row">                                         
                                                        <label class="col-xl-5 col-lg-3 text-left mb-lg-0 align-self-center">Accounting Code (Sale)</label>
                                                        <div class="col-lg-3 col-xl-7">
                                                           <h5 class="card-title"> <?php echo @$productData['accountancy_code_sell'];?> </h5>
                                                        </div>
                                                    </div>
                                                    <div class="form-group row">                                         
                                                        <label class="col-xl-5 col-lg-3 text-left mb-lg-0 align-self-center"> Accounting Code (Purchase)</label>
                                                        <div class="col-lg-3 col-xl-7">
                                                           <h5 class="card-title"> <?php echo @$productData['accountancy_code_purchase'];?> </h5>
                                                        </div>
                                                    </div>
                                                    <div class="form-group row">                                         
                                                        <label class="col-xl-5 col-lg-3 text-left mb-lg-0 align-self-center"> Product Tags / Categories </label>
                                                        <div class="col-lg-3 col-xl-7">
                                                            <h5 class="card-title"> <?php $TagData = $commonFunctions->getData('invty_pdt_tag',''); ?>
                                        
                                                    <?php foreach ($TagData as $rw) { ?>
                                                        <?php if(@$productData['tag_id'] == $rw['id']){
                                                            if($rw['parent_id'] > 0){
                                                                echo $commonFunctions->getName($rw['parent_id'],'crm_cust_tag','label','id')." >> ";           
                                                            }
                                                            echo $rw['label']; 
                                                        } ?>
                                                    <?php } ?> </h5>
                                                        </div>
                                                    </div>
                                                </div><!--end card-body-->
                                            </div><!--end card-->
                                            
                                        </div> <!-- end col -->
                                        <!-- Contact Information Official Card - End --->
                                                                              
                                    </div><!--end row-->
                                </div>
                                <!-- Product Details - End --->

                                <!-- Purchase Statistics - Start --->
                                <div class="tab-pane fade" id="Purchase_Statistics" role="tabpanel" aria-labelledby="contact_persons_tab">
                                    <div class="row">
                                        <div class="col-lg-12 col-xl-12">
                                            <div class="card">
                                                <div class="card-header">
                                                    <div class="row align-items-center">
                                                        <div class="col-lg-5">                      
                                                            <a href="sales-invoices-create-invoice.html"><button type="button" class="btn btn-outline-primary">Add Contact</button></a>                     
                                                        </div><!--end col--> 
                                                        <div class="col-lg-7">
                                                            <div class="input-group">
                                                                <input type="text" class="form-control" placeholder="Search" aria-label="Recipient's username" aria-describedby="basic-addon2">
                                                                <button class="btn btn-soft-secondary" type="button" id="button-addon2"><i class="fas fa-search"></i></button>
                                                            </div>                        
                                                        </div><!--end col-->                                        
                                                    </div>  <!--end row-->                                  
                                                </div><!--end card-header-->
                                                <div class="card-body">
                                                    <div class="table-responsive browser_users">
                                                        <table class="table table-hover mb-0">
                                                            <thead class="thead-light">
                                                                <tr>
                                                                    <th class="border-top-0">Name</th>
                                                                    <th class="border-top-0">Phone No</th>                                                    
                                                                    <th class="border-top-0">Mobile No</th>
                                                                    <th class="border-top-0">Email Address</th>
                                                                    <th class="border-top-0">Designation</th>
                                                                    <th class="border-top-0">Status</th>
                                                                </tr><!--end tr-->
                                                            </thead>
                                                            <tbody>

                                                                <tr>                                                                                             
                                                                    <td><a href="settings-erp-user-administrator-card.html" class="text-primary"> System Administrator</a></td>
                                                                    <td>+974 12345678</td>
                                                                    <td>+974 12345678</td>
                                                                    <td><a href="mailto:admin@infidux.com" class="text-primary">admin@infidux.com</a></td>
                                                                    <td>System Administrator</td>
                                                                    <td>
                                                                        <span class="badge badge-soft-success">Active</span>
                                                                    </td>                                                
                                                                </tr><!--end tr-->     
                                                                
                                                                <tr>                                                                                             
                                                                    <td><a href="settings-erp-user-ismail-parkar-card.html" class="text-primary"> Ismail Parkar</a></td>
                                                                    <td>+974 12345678</td>
                                                                    <td>+974 12345678</td>
                                                                    <td><a href="mailto:ismail.parkar@infidux.com" class="text-primary">ismail.parkar@infidux.com</a></td>
                                                                    <td>System Administrator</td>
                                                                    <td>
                                                                        <span class="badge badge-soft-success">Active</span>
                                                                    </td>                                                
                                                                </tr><!--end tr-->    

                                                                <tr>                                                                                             
                                                                    <td><a href="settings-erp-user-muntazim-nazir-card.html" class="text-primary"> Muntazim Nazir</a></td>
                                                                    <td>+974 12345678</td>
                                                                    <td>+974 12345678</td>
                                                                    <td><a href="mailto:muntazim.nazir@infidux.com" class="text-primary">muntazim.nazir@infidux.com</a></td>
                                                                    <td>Accounts Manager</td>
                                                                    <td>
                                                                        <span class="badge badge-soft-danger">In-Active</span>
                                                                    </td>                                                
                                                                </tr><!--end tr--> 

                                                                <tr>                                                                                             
                                                                    <td><a href="settings-erp-user-muntazim-nazir-card.html" class="text-primary"> Muntazim Nazir</a></td>
                                                                    <td>+974 12345678</td>
                                                                    <td>+974 12345678</td>
                                                                    <td><a href="mailto:muntazim.nazir@infidux.com" class="text-primary">muntazim.nazir@infidux.com</a></td>
                                                                    <td>Sales Manager</td>
                                                                    <td>
                                                                        <span class="badge badge-soft-success">Active</span>
                                                                    </td>                                                
                                                                </tr><!--end tr--> 

                                                            </tbody>
                                                        </table> <!--end table-->                                               
                                                    </div><!--end /div-->
                                                </div><!--end card-body--> 
                                            </div><!--end card-->
                                        </div> <!-- end col -->                                                                              
                                    </div><!--end row-->
                                    <!-- Numbering  -->
                                    <div class="row">
                                        <div class="col-sm-12">
                                            <div class="page-title-box pt-0">
                                                <div class="row">
                                                    <div class="col">
                                                        <ul class="pagination">
                                                            <li class="page-item">
                                                                <a class="page-link" href="#">Listing</a>
                                                            </li>
                                                            <li class="page-item">
                                                                <a class="page-link" href="#">50 - 99</a>
                                                            </li>
                                                        </ul>
                                                    </div><!--end col-->
                                                    <div class="col-auto align-self-center">
                                                        <ul class="pagination">
                                                            <li class="page-item disabled">
                                                                <a class="page-link" href="#" tabindex="-1">Previous</a>
                                                            </li>
                                                            <li class="page-item"><a class="page-link" href="#">1</a></li>
                                                            <li class="page-item active">
                                                                <a class="page-link" href="#">2 <span class="sr-only">(current)</span></a>
                                                            </li>
                                                            <li class="page-item"><a class="page-link" href="#">3</a></li>
                                                            <li class="page-item">
                                                                <a class="page-link" href="#">Next</a>
                                                            </li>
                                                        </ul>
                                                    </div><!--end col-->  
                                                </div><!--end row-->                                                              
                                            </div><!--end page-title-box-->
                                        </div><!--end col-->
                                    </div><!--end row-->
                                    <!-- end page title end breadcrumb -->
                                </div>
                                <!-- Purchase Statistics - End --->

                                <!-- Sales Statistics - Start --->
                                <div class="tab-pane fade" id="Sales_Statistics" role="tabpanel" aria-labelledby="branch_shipping_address_tab">
                                    <div class="row">
                                        <div class="col-lg-12 col-xl-12">
                                            <div class="card">
                                                <div class="card-header">
                                                    <div class="row align-items-center">
                                                        <div class="col-lg-5">                      
                                                            <a href="sales-invoices-create-invoice.html"><button type="button" class="btn btn-outline-primary">Add Branch</button></a>                     
                                                        </div><!--end col--> 
                                                        <div class="col-lg-7">
                                                            <div class="input-group">
                                                                <input type="text" class="form-control" placeholder="Search" aria-label="Recipient's username" aria-describedby="basic-addon2">
                                                                <button class="btn btn-soft-secondary" type="button" id="button-addon2"><i class="fas fa-search"></i></button>
                                                            </div>                        
                                                        </div><!--end col-->                                        
                                                    </div>  <!--end row-->                                  
                                                </div><!--end card-header-->
                                                <div class="card-body">
                                                    <div class="table-responsive browser_users">
                                                        <table class="table table-hover mb-0">
                                                            <thead class="thead-light">
                                                                <tr>
                                                                    <th class="border-top-0">Beanch Name</th>
                                                                    <th class="border-top-0">Customer ID#</th>
                                                                    <th class="border-top-0">Phone No</th>
                                                                    <th class="border-top-0">Email Address</th>
                                                                    <th class="border-top-0">City</th>                                                    
                                                                    <th class="border-top-0">Country</th>
                                                                    <th class="border-top-0">Status</th>
                                                                </tr><!--end tr-->
                                                            </thead>
                                                            <tbody>
                                                                <tr>                                             
                                                                    <td><a href="crm-customer-card-como-facilities-management-services.html" class="text-primary">Como Facilities Management Services</a></td>
                                                                    <td><a href="crm-customer-card-como-facilities-management-services.html" class="text-primary">CUS-202100003BR001</a></td>
                                                                    <td>+974 44352253</td>
                                                                    <td>info@comofms.com</td>
                                                                    <td>Doha</td>
                                                                    <td>State of Qatar</td>
                                                                    <td>
                                                                        <span class="badge badge-soft-success">Active</span>
                                                                    </td>
                                                                </tr><!--end tr-->     
                                                                <tr>                                             
                                                                    <td><a href="crm-customer-card-como-facilities-management-services.html" class="text-primary">Como Facilities Management Services</a></td>
                                                                    <td><a href="crm-customer-card-como-facilities-management-services.html" class="text-primary">CUS-202100003BR002</a></td>
                                                                    <td>+974 44693800</td>
                                                                    <td>qatarcement@qatar.net.qa</td>
                                                                    <td>Doha</td>
                                                                    <td>State of Qatar</td>
                                                                    <td>
                                                                        <span class="badge badge-soft-danger">Inactive</span>
                                                                    </td>
                                                                </tr><!--end tr-->  
                                                                <tr>                                             
                                                                    <td><a href="crm-customer-card-como-facilities-management-services.html" class="text-primary">Como Facilities Management Services</a></td>
                                                                    <td><a href="crm-customer-card-como-facilities-management-services.html" class="text-primary">CUS-202100003BR003</a></td>
                                                                    <td>+974 44117255</td>
                                                                    <td>info@tornadoqatar.com</td>
                                                                    <td>Doha</td>
                                                                    <td>State of Qatar</td>
                                                                    <td>
                                                                        <span class="badge badge-soft-success">Active</span>
                                                                    </td>
                                                                </tr><!--end tr-->                      
                                                            </tbody>
                                                        </table> <!--end table-->                                               
                                                    </div><!--end /div-->
                                                </div><!--end card-body--> 
                                            </div><!--end card-->
                                        </div> <!-- end col -->                                                                              
                                    </div><!--end row-->
                                    <!-- Numbering  -->
                                    <div class="row">
                                        <div class="col-sm-12">
                                            <div class="page-title-box pt-0">
                                                <div class="row">
                                                    <div class="col">
                                                        <ul class="pagination">
                                                            <li class="page-item">
                                                                <a class="page-link" href="#">Listing</a>
                                                            </li>
                                                            <li class="page-item">
                                                                <a class="page-link" href="#">50 - 99</a>
                                                            </li>
                                                        </ul>
                                                    </div><!--end col-->
                                                    <div class="col-auto align-self-center">
                                                        <ul class="pagination">
                                                            <li class="page-item disabled">
                                                                <a class="page-link" href="#" tabindex="-1">Previous</a>
                                                            </li>
                                                            <li class="page-item"><a class="page-link" href="#">1</a></li>
                                                            <li class="page-item active">
                                                                <a class="page-link" href="#">2 <span class="sr-only">(current)</span></a>
                                                            </li>
                                                            <li class="page-item"><a class="page-link" href="#">3</a></li>
                                                            <li class="page-item">
                                                                <a class="page-link" href="#">Next</a>
                                                            </li>
                                                        </ul>
                                                    </div><!--end col-->  
                                                </div><!--end row-->                                                              
                                            </div><!--end page-title-box-->
                                        </div><!--end col-->
                                    </div><!--end row-->
                                    <!-- end page title end breadcrumb -->
                                </div>
                                <!-- Sales Statistics - End --->

                                <!-- Stock Statistics - Start --->
                                <div class="tab-pane fade" id="Stock_Statistics" role="tabpanel" aria-labelledby="invoices_tab">
                                    <div class="row">
                                        <div class="col-lg-12 col-xl-12">
                                            <div class="card">
                                                <div class="card-header">
                                                    <div class="row align-items-center">
                                                        <div class="col">                      
                                                            <a href="sales-invoices-create-invoice.html"><button type="button" class="btn btn-outline-dark">Creat Invoice</button></a>                     
                                                        </div><!--end col--> 
                                                        <div class="col">                      
                                                            <div class="input-group">
                                                                        <input type="text" class="form-control" placeholder="Search" aria-label="Recipient's username" aria-describedby="basic-addon2">
                                                                        <button class="btn btn-soft-secondary" type="button" id="button-addon2"><i class="fas fa-search"></i></button>
                                                                    </div>                     
                                                        </div><!--end col-->                                        
                                                    </div>  <!--end row-->                                  
                                                </div><!--end card-header-->
                                                <div class="card-body">
                                                    <div class="table-responsive browser_users">
                                                        <table class="table table-hover mb-0">
                                                            <thead class="thead-light">
                                                                <tr>
                                                                    <th class="border-top-0">Invoice #</th>
                                                                    <th class="border-top-0">Customer</th>
                                                                    <th class="border-top-0">Invoice Date</th>
                                                                    <th class="border-top-0">Amount</th>
                                                                    <th class="border-top-0">Status</th>
                                                                    <th class="border-top-0">Created by</th>
                                                                </tr><!--end tr-->
                                                            </thead>
                                                            <tbody>
                                                                <tr>                                                      
                                                                    <td><a href="sales-invoices-INV-20210623001.html" class="text-primary">INV-20210626001</a></td>
                                                                    <td>Como Facilities Management Services</td>
                                                                    <td>26 June 2021</td>
                                                                    <td> 1,078.00 QAR</td>
                                                                    <td>
                                                                        <span class="badge badge-soft-danger">Unpaid</span>
                                                                    </td>
                                                                    <td>Ismail Parkar</td>
                                                                </tr><!--end tr-->     
                                                                <tr>                                                        
                                                                    <td><a href="sales-invoices-INV-20210623001.html" class="text-primary">INV-20210624013</a></td>
                                                                    <td>Como Facilities Management Services</td>
                                                                    <td>24 June 2021</td>
                                                                    <td> 2,000.00 QAR</td>
                                                                    <td>
                                                                        <span class="badge badge-soft-warning">Overdue</span> <span class="badge badge-soft-danger">Unpaid</span> <span class="badge badge-soft-primary">Goods Deivered</span>
                                                                    </td>
                                                                    <td>Ismail Parkar</td>
                                                                    
                                                                </tr><!--end tr-->    
                                                                <tr>                                                        
                                                                    <td><a href="sales-invoices-INV-20210623001.html" class="text-primary">INV-20210623051</a></td>
                                                                    <td>Como Facilities Management Services</td> 
                                                                    <td>23 June 2021</td>
                                                                    <td> 560.00 QAR</td>
                                                                    <td>
                                                                        <span class="badge badge-soft-success">Paid</span>
                                                                    </td>
                                                                    <td>Ismail Parkar</td>
                                                                    
                                                                </tr><!--end tr-->    
                                                                <tr>                                                        
                                                                    <td><a href="sales-invoices-INV-20210623001.html" class="text-primary">INV-20210620001</a></td>
                                                                    <td>Como Facilities Management Services</td> 
                                                                    <td>20 June 2021</td>
                                                                    <td> 10,600.00 QAR</td>
                                                                    <td>
                                                                        <span class="badge badge-soft-success">Paid</span>
                                                                    </td>
                                                                    <td>Ismail Parkar</td>
                                                                </tr><!--end tr-->    
                                                                <tr>                                                        
                                                                    <td><a href="sales-invoices-INV-20210623001.html" class="text-primary">INV-20210619001</a></td>
                                                                    <td>Como Facilities Management Services</td> 
                                                                    <td>19 June 2021</td>
                                                                    <td> 56.00 QAR</td>
                                                                    <td>
                                                                        <span class="badge badge-soft-success">Paid</span>
                                                                    </td>
                                                                    <td>Ismail Parkar</td>
                                                                </tr><!--end tr-->                            
                                                            </tbody>
                                                        </table> <!--end table-->                                               
                                                    </div><!--end /div-->
                                                </div><!--end card-body--> 
                                            </div><!--end card-->
                                        </div> <!-- end col -->                                                                              
                                    </div><!--end row-->
                                    <!-- Numbering  -->
                                    <div class="row">
                                        <div class="col-sm-12">
                                            <div class="page-title-box pt-0">
                                                <div class="row">
                                                    <div class="col">
                                                        <ul class="pagination">
                                                            <li class="page-item">
                                                                <a class="page-link" href="#">Listing</a>
                                                            </li>
                                                            <li class="page-item">
                                                                <a class="page-link" href="#">50 - 99</a>
                                                            </li>
                                                        </ul>
                                                    </div><!--end col-->
                                                    <div class="col-auto align-self-center">
                                                        <ul class="pagination">
                                                            <li class="page-item disabled">
                                                                <a class="page-link" href="#" tabindex="-1">Previous</a>
                                                            </li>
                                                            <li class="page-item"><a class="page-link" href="#">1</a></li>
                                                            <li class="page-item active">
                                                                <a class="page-link" href="#">2 <span class="sr-only">(current)</span></a>
                                                            </li>
                                                            <li class="page-item"><a class="page-link" href="#">3</a></li>
                                                            <li class="page-item">
                                                                <a class="page-link" href="#">Next</a>
                                                            </li>
                                                        </ul>
                                                    </div><!--end col-->  
                                                </div><!--end row-->                                                              
                                            </div><!--end page-title-box-->
                                        </div><!--end col-->
                                    </div><!--end row-->
                                    <!-- end page title end breadcrumb -->
                                </div>
                                <!-- Stock Statistics - End --->

                                <!-- Stock Movements Statistics - Start --->
                                <div class="tab-pane fade" id="Stock_Movements_Statistics" role="tabpanel" aria-labelledby="delivery_notes_tab">
                                    <div class="row">
                                        <div class="col-lg-12 col-xl-12">
                                            <div class="card">
                                                <div class="card-header">
                                                    <div class="row align-items-center">
                                                        <div class="col">                      
                                                            <a href="sales-invoices-create-invoice.html"><button type="button" class="btn btn-outline-dark">Creat Delivery Note</button></a>                     
                                                        </div><!--end col--> 
                                                        <div class="col">                      
                                                            <div class="input-group">
                                                                        <input type="text" class="form-control" placeholder="Search" aria-label="Recipient's username" aria-describedby="basic-addon2">
                                                                        <button class="btn btn-soft-secondary" type="button" id="button-addon2"><i class="fas fa-search"></i></button>
                                                                    </div>                     
                                                        </div><!--end col-->                                        
                                                    </div>  <!--end row-->                                  
                                                </div><!--end card-header-->
                                                <div class="card-body">
                                                    <div class="table-responsive browser_users">
                                                        <table class="table table-hover mb-0">
                                                            <thead class="thead-light">
                                                                <tr>
                                                                    <th class="border-top-0">Delivery Note #</th>
                                                                    <th class="border-top-0">Invoice #</th>
                                                                    <th class="border-top-0">Customer</th>
                                                                    <th class="border-top-0">DN Date</th>
                                                                    <th class="border-top-0">Status</th>
                                                                    <th class="border-top-0">Received By</th>
                                                                </tr><!--end tr-->
                                                            </thead>
                                                            <tbody>
                                                                <tr>                                                        
                                                                    <td><a href="sales-invoices-DLN-20210623001.html" class="text-primary">DLN-20210626002</a></td> 
                                                                    <td><a href="sales-invoices-INV-20210623001.html" class="text-primary">INV-20210624013</a></td>
                                                                    <td>Como Facilities Management Services</td>
                                                                    <td>26 June 2021</td>
                                                                    <td>
                                                                        <span class="badge badge-soft-danger">Partial Delived</span>
                                                                    </td>
                                                                    <td>Ismail Parkar</td>                                                    
                                                                </tr><!--end tr-->
                                                                <tr>
                                                                    <td><a href="sales-invoices-DLN-20210623001.html" class="text-primary">DLN-20210626001</a></td>                                                      
                                                                    <td><a href="sales-invoices-INV-20210623001.html" class="text-primary">INV-20210626001</a></td>
                                                                    <td>Como Facilities Management Services</td>
                                                                    <td>26 June 2021</td>
                                                                    <td>
                                                                        <span class="badge badge-soft-success">Delivered</span>
                                                                    </td>
                                                                    <td>Ismail Parkar</td>
                                                                </tr><!--end tr-->     
                                                                <tr>                                                        
                                                                    <td><a href="sales-invoices-DLN-20210623001.html" class="text-primary">DLN-20210625001</a></td> 
                                                                    <td><a href="sales-invoices-INV-20210623001.html" class="text-primary">INV-20210624013</a></td>
                                                                    <td>Como Facilities Management Services</td>
                                                                    <td>25 June 2021</td>
                                                                    <td>
                                                                        <span class="badge badge-soft-danger">Partial Delived</span>
                                                                    </td>
                                                                    <td>Ismail Parkar</td>
                                                                    
                                                                </tr><!--end tr--> 
                                                                <tr>                                                        
                                                                    <td><a href="sales-invoices-DLN-20210623001.html" class="text-primary">DLN-20210624013</a></td> 
                                                                    <td><a href="sales-invoices-INV-20210623001.html" class="text-primary">INV-20210624013</a></td>
                                                                    <td>Como Facilities Management Services</td>
                                                                    <td>24 June 2021</td>
                                                                    <td>
                                                                        <span class="badge badge-soft-danger">Partial Delived</span>
                                                                    </td>
                                                                    <td>Ismail Parkar</td>
                                                                    
                                                                </tr><!--end tr-->    
                                                                <tr>                                                        
                                                                    <td><a href="sales-invoices-DLN-20210623001.html" class="text-primary">DLN-20210623051</a></td>
                                                                    <td><a href="sales-invoices-INV-20210623001.html" class="text-primary">INV-20210623051</a></td>
                                                                    <td>Como Facilities Management Services</td> 
                                                                    <td>23 June 2021</td>
                                                                    <td>
                                                                        <span class="badge badge-soft-primary">In Progress</span>
                                                                    </td>
                                                                    <td>Ismail Parkar</td>
                                                                    
                                                                </tr><!--end tr-->    
                                                                <tr>                                                        
                                                                    <td><a href="sales-invoices-DLN-20210623001.html" class="text-primary">DLN-20210620001</a></td>
                                                                    <td><a href="sales-invoices-INV-20210623001.html" class="text-primary">INV-20210620001</a></td>
                                                                    <td>Como Facilities Management Services</td> 
                                                                    <td>20 June 2021</td>
                                                                    <td>
                                                                        <span class="badge badge-soft-primary">In Progress</span>
                                                                    </td>
                                                                    <td>Ismail Parkar</td>
                                                                </tr><!--end tr-->    
                                                                <tr>                                                        
                                                                    <td><a href="sales-invoices-DLN-20210623001.html" class="text-primary">DLN-20210619001</a></td>
                                                                    <td><a href="sales-invoices-INV-20210623001.html" class="text-primary">INV-20210619001</a></td>
                                                                    <td>Como Facilities Management Services</td> 
                                                                    <td>19 June 2021</td>
                                                                    <td>
                                                                        <span class="badge badge-soft-success">Delivered</span>
                                                                    </td>
                                                                    <td>Ismail Parkar</td>
                                                                </tr><!--end tr-->                            
                                                            </tbody>
                                                        </table> <!--end table-->                                               
                                                    </div><!--end /div-->
                                                </div><!--end card-body--> 

                                            </div><!--end card-->
                                        </div> <!-- end col -->                                                                              
                                    </div><!--end row-->
                                    <!-- Numbering  -->
                                    <div class="row">
                                        <div class="col-sm-12">
                                            <div class="page-title-box pt-0">
                                                <div class="row">
                                                    <div class="col">
                                                        <ul class="pagination">
                                                            <li class="page-item">
                                                                <a class="page-link" href="#">Listing</a>
                                                            </li>
                                                            <li class="page-item">
                                                                <a class="page-link" href="#">50 - 99</a>
                                                            </li>
                                                        </ul>
                                                    </div><!--end col-->
                                                    <div class="col-auto align-self-center">
                                                        <ul class="pagination">
                                                            <li class="page-item disabled">
                                                                <a class="page-link" href="#" tabindex="-1">Previous</a>
                                                            </li>
                                                            <li class="page-item"><a class="page-link" href="#">1</a></li>
                                                            <li class="page-item active">
                                                                <a class="page-link" href="#">2 <span class="sr-only">(current)</span></a>
                                                            </li>
                                                            <li class="page-item"><a class="page-link" href="#">3</a></li>
                                                            <li class="page-item">
                                                                <a class="page-link" href="#">Next</a>
                                                            </li>
                                                        </ul>
                                                    </div><!--end col-->  
                                                </div><!--end row-->                                                              
                                            </div><!--end page-title-box-->
                                        </div><!--end col-->
                                    </div><!--end row-->
                                    <!-- end page title end breadcrumb -->
                                </div>
                                <!-- Stock Movements Statistics - End --->

                                

                            </div>
                        </div>
                    </div>

                </div>
                <div class="tab-pane" id="purchase_details" role="tabpanel" aria-labelledby="purchase_details_tab">
                    <div class="card">
                		<div class="card-body">
                        	Purchase Statistics
                    	</div><!--end row-->    
                    </div>
                </div>
                <div class="tab-pane" id="related_invoice" role="tabpanel" aria-labelledby="related_invoice_tab">
                    <div class="card">
                		<div class="card-body">
                        	Sales Statistics
                    	</div><!--end row-->    
                    </div> <!--end row-->
				</div>
				<div class="tab-pane" id="stock_mov_statistics" role="tabpanel" aria-labelledby="stock_mov_statistics_tab">
                    <div class="card">
                		<div class="card-body">
                        	<?php 
                        	$where1 = " WHERE product_id = '".@$_GET["product_id"]."' ";
                        	$invtData1 = $commonFunctions->getData('invty_pdt_stock_mgt_mov',$where1); ?>
                        	<table style="margin-top: 10px;width: 100% !important;" class="table datatable_t table-hover table-striped table-bordered">
                                <thead>
                                    <tr>
                                        <th class="text-center">Current Warehouse</th>
                                        <th class="text-center">Current Stock</th>
                                        <th class="text-center">Destination Warehouse</th>
                                        <th class="text-center">Move Stock</th>
                                        <th class="text-center">Stock Movements Status</th>
                                        <th class="text-center">Status</th>
                                    </tr>
                                </thead>
                                <tbody>
                                    <?php 
                                    foreach ($invtData1 as $row) { 
                                        $stock_id = $row["stock_id"];
                                    ?>
                                        <tr>
                                            <th class="text-center">
                                                <?php echo $commonFunctions->getname($row['current_warehouse_id'],"invty_wrhus","short_name_location","id");
                                                ?>
                                            </th>
                                            <th class="text-center">
                                                <?php echo $row['current_stock']; ?>
                                            </th>
                                            <th class="text-center">
                                                <?php echo $commonFunctions->getname($row['move_warehouse_id'],"invty_wrhus","short_name_location","id");
                                                ?>
                                            </th>
                                            <th class="text-center">
                                                <?php echo $row['move_stock_count']; ?>
                                            </th>
                                            <th class="text-center">
                                            	<?php 
			                                	$whereLog1 = " WHERE product_id = '".@$_GET["product_id"]."' and warehouse_id = '".$row['current_warehouse_id']."' ";
			                                	$invtDataLogs1 = $commonFunctions->getData('invty_pdt_stock_mgt_logs',$whereLog1); 
			                                	foreach ($invtDataLogs1 as $r)
			                                	{
			                                		if($r["stock_mvt_status"] < 3){
			                                			echo $r["message"]." By <b style='color:purple;'>".$commonFunctions->getname($r['added_by'],"sys_erp_adm_user","erp_sys_user_name_first","id")." ".$commonFunctions->getname($r['added_by'],"sys_erp_adm_user","erp_sys_user_name_last","id")."</b> On <b style='color:purple;'>".date("d-m-Y h:i:s",strtotime($r['added_date']))."</b><br>";
			                                		}
			                                		if($r["stock_mvt_status"] == 4 OR $r["stock_mvt_status"] == 3){
			                                			echo "Approved By <b style='color:purple;'>".$commonFunctions->getname($r['appr_staff_id'],"sys_erp_adm_user","erp_sys_user_name_first","id")." ".$commonFunctions->getname($r['appr_staff_id'],"sys_erp_adm_user","erp_sys_user_name_last","id")."</b> On <b style='color:purple;'>".date("d-m-Y h:i:s",strtotime($r['added_date']))."</b><br>";
			                                		}
			                                		if($r["stock_mvt_status"] == 4){
			                                			echo "Completed By <b style='color:purple;'>".$commonFunctions->getname($r['accept_staff_id'],"sys_erp_adm_user","erp_sys_user_name_first","id")." ".$commonFunctions->getname($r['accept_staff_id'],"sys_erp_adm_user","erp_sys_user_name_last","id")."</b> On <b style='color:purple;'>".date("d-m-Y h:i:s",strtotime($r['added_date']))."</b><br>";
			                                		}
			                                	}
			                                	?>
                                            </th>
                                            <th class="text-center">
                                                <?php 
                                                if($row['stock_mvt_status'] == 1){
                                                    echo "<span class='btn btn-danger'>Drafted</span>";
                                                }
                                                if($row['stock_mvt_status'] == 2){
                                                    echo "<span class='btn btn-warning'>Inprogress</span>";
                                                }
                                                if($row['stock_mvt_status'] == 3){
                                                    echo "<span class='btn btn-primary'>Approved</span>";
                                                }
                                                if($row['stock_mvt_status'] == 4){
                                                    echo "<span class='btn btn-success'>Completed</span>";
                                                }
                                                ?>
                                            </th>
                                        </tr>
                                    <?php } ?>
                                </tbody>
                            </table>
                    	</div><!--end row-->    
                    </div> <!--end row-->
				</div>
                <div class="tab-pane" id="stock_statistics" role="tabpanel" aria-labelledby="stock_statistics_tab">
                    <div class="card">
                		<div class="card-body">
                        	<?php 
                        	$where = " WHERE product_id = '".@$_GET["product_id"]."' ";
                        	$invtData = $commonFunctions->getData('invty_pdt_stock_mgt',$where); ?>
                        	<table style="margin-top: 10px;width: 100% !important;" class="table datatable_t table-hover table-striped table-bordered">
                                <thead>
                                    <tr>
                                        <th class="text-center">Warehouse</th>
                                        <th class="text-center">Physical Stock</th>
                                        <th class="text-center">Virtual Stock</th>
                                        <th class="text-center">Total Stock</th>
                                        <th class="text-center">Selling Price</th>
                                        <th class="text-center">Total Value</th>
                                    </tr>
                                </thead>
                                <tbody>
                                    <?php 
                                    foreach ($invtData as $row) { 
                                        $stock_id = $row["stock_id"];
                                    ?>
                                        <tr>
                                        	<th class="text-center">
                                                <?php echo $commonFunctions->getname($row['warehouse_id'],"invty_wrhus","short_name_location","id");
                                                ?>
                                            </th>
                                            <th class="text-center">
                                            	<?php echo $row['stock_count'];?>
                                            </th>
                                            <th class="text-center">
                                            	0
                                            </th>
                                            <th class="text-center"><?php echo $row['stock_count'];?></th>
                                            <th class="text-center">
                                                <?php
                                                echo $commonFunctions->getname($row['product_id'],"invty_pdt_details","price","id"); ?>
                                            </th>
                                            <th class="text-center"><?php 
                                                $stock_count = (int)$row['stock_count'];
                                                $selling_price = (int)$commonFunctions->getname($row['product_id'],"invty_pdt_details","price","id");
                                                echo $stock_count * $selling_price;
                                            ?></th>
                                        </tr>
                                    <?php } ?>
                                </tbody>
                            </table>
                    	</div><!--end row-->    
                    </div>
                </div>
                <div class="tab-pane" id="statistics" role="tabpanel" aria-labelledby="statistics_tab">
                    <div class="card">
                		<div class="card-body">
                        	Statistics
                    	</div><!--end row-->    
                    </div>
                </div>
                <div class="tab-pane" id="note" role="tabpanel" aria-labelledby="note_tab">
                    <div class="card">
                		<div class="card-body">
                        	<div class="form-row">
                        		<div class="col-md-12 position-relative form-group">
                        			<?php echo @$productData['description'];?>
                        		</div>
                        	</div>
                        </div>
                    </div><!--end row-->
                </div>
            </div>
        </div>
    </div>


<?php require "../../inc/footer.php"; ?>
<script type="text/javascript" src="https://www.jqueryscript.net/demo/Simple-jQuery-Based-Barcode-Generator-Barcode/jquery-barcode.js"></script>
<script type="text/javascript">
    
  	function generateBarcode(){
	    var value = "<?php echo strtolower(@$productData['barcode_value']); ?>";
	    var btype = "<?php echo strtolower(@$barcode_type); ?>";
	    var renderer = "css";
    	var quietZone = false;
	    
	    var settings = {
	      	output:renderer,
	      	bgColor: "#FFFFFF",
	      	color: "#000000",
	      	barWidth: "2",
	     	barHeight: "50",
	      	moduleSize: "5",
	      	posX: "10",
	      	posY: "20",
	      	addQuietZone: "1"
	    };
    	if (renderer == 'canvas'){
      		clearCanvas();
	      	$("#barcodeTarget").hide();
	      	$("#canvasTarget").show().barcode(value, btype, settings);
    	} else {
      		$("#canvasTarget").hide();
      		$("#barcodeTarget").html("").show().barcode(value, btype, settings);
    	}
  	}
      
  	function showConfig1D(){
	    $('.config .barcode1D').show();
	    $('.config .barcode2D').hide();
  	}
  
  	function showConfig2D(){
	    $('.config .barcode1D').hide();
	    $('.config .barcode2D').show();
  	}
  
  	function clearCanvas(){
	    var canvas = $('#canvasTarget').get(0);
	    var ctx = canvas.getContext('2d');
	    ctx.lineWidth = 1;
	    ctx.lineCap = 'butt';
	    ctx.fillStyle = '#FFFFFF';
	    ctx.strokeStyle  = '#000000';
	    ctx.clearRect (0, 0, canvas.width, canvas.height);
	    ctx.strokeRect (0, 0, canvas.width, canvas.height);
  	}
  
  	$(function(){
    	generateBarcode();
  	});

</script>