init
This commit is contained in:
110
119/view-product.php
Normal file
110
119/view-product.php
Normal file
@@ -0,0 +1,110 @@
|
||||
<table>
|
||||
<tr>
|
||||
<th style="border: 1px solid #1d1d1d; padding: 4px;">Bar Code</th>
|
||||
<th style="border: 1px solid #1d1d1d; padding: 4px;">ID</th>
|
||||
<th style="border: 1px solid #1d1d1d; padding: 4px;">Product Name</th>
|
||||
<th style="border: 1px solid #1d1d1d; padding: 4px;">HSN</th>
|
||||
<?php
|
||||
if(isset($_SESSION['email']) && $_SESSION['email']=='mousumi@fashionavenueonline.com'){
|
||||
|
||||
echo '<th style="border: 1px solid #1d1d1d; padding: 4px;">Cost</th>';
|
||||
}
|
||||
?>
|
||||
<th style="border: 1px solid #1d1d1d; padding: 4px;">MRP</th>
|
||||
<th style="border: 1px solid #1d1d1d; padding: 4px;">Discount</th>
|
||||
<th style="border: 1px solid #1d1d1d; padding: 4px;">Price</th>
|
||||
<th style="border: 1px solid #1d1d1d; padding: 4px;">Stock</th>
|
||||
<th style="border: 1px solid #1d1d1d; padding: 4px;">BarCode</th>
|
||||
<?php
|
||||
if(isset($_SESSION['email']) && $_SESSION['email']=='mousumi@fashionavenueonline.com'){
|
||||
echo '<th style="border: 1px solid #1d1d1d; padding: 4px;">Action</th>';
|
||||
}
|
||||
?>
|
||||
</tr>
|
||||
<?php
|
||||
// if(isset($_SESSION['email']) && $_SESSION['email']=='mousumi@email.siliconpin.com'){
|
||||
// echo '<a href="view-bills-cost?payment=paid">Bill Costing</a>';
|
||||
// }
|
||||
$link = new mysqli(MYSQL_HOST, MYSQL_USER, MYSQL_PASS, MYSQL_DB);
|
||||
$query = "SELECT * FROM `" . SHOP_ID . "_product` ORDER BY `id` DESC";
|
||||
$result = mysqli_query($link, $query);
|
||||
while ($row = mysqli_fetch_assoc($result)) {
|
||||
?>
|
||||
<?php
|
||||
if(isset($_SESSION['email']) && $_SESSION['email']==='mousumi@fashionavenueonline.com'){
|
||||
$edit_page_url = 'edit-product-cost?code='.$row['id'].'-' .$row['cat'].'';
|
||||
} else{
|
||||
$edit_page_url = 'edit-product?code='.$row['id'].'-' .$row['cat'].'';
|
||||
}
|
||||
?>
|
||||
<tr>
|
||||
<td style="border: 1px solid #1d1d1d; padding: 4px; text-align:center;">
|
||||
<input type="checkbox" class="checkbox" value="<?php echo $row['id']; ?>" name="<?php echo $row['id']; ?>" id="<?php echo $row['id']; ?>" />
|
||||
<input type="hidden" >
|
||||
</td>
|
||||
<td style="border: 1px solid #1d1d1d; padding: 4px; text-align:center;"><?php echo $row['id']; ?></td>
|
||||
<td style="border: 1px solid #1d1d1d; padding: 4px; text-align:left;"><?php echo $row['name']; ?></td>
|
||||
<td style="border: 1px solid #1d1d1d; padding: 4px; text-align:center;"><?php echo $row['hsn']?></td>
|
||||
|
||||
<?php
|
||||
if(isset($_SESSION['email']) && $_SESSION['email']=='mousumi@fashionavenueonline.com'){
|
||||
echo '<td style="border: 1px solid #1d1d1d; padding: 4px; text-align:center;">'.$row['cost'].'</td>';
|
||||
}
|
||||
?>
|
||||
<td style="border: 1px solid #1d1d1d; padding: 4px; text-align:center;"><?php echo $row['mrp']; ?></td>
|
||||
<td style="border: 1px solid #1d1d1d; padding: 4px; text-align:center;"><span style="color:green;"><?php echo $row['mrp'] - $row['price']; ?></span></td>
|
||||
<td style="border: 1px solid #1d1d1d; padding: 4px; text-align:center;"><?php echo $row['price']; ?></td>
|
||||
<td style="border: 1px solid #1d1d1d; padding: 4px; text-align:center;"><?php echo $row['stock']; ?></td>
|
||||
<td style="border: 1px solid #1d1d1d; padding: 4px; text-align:center;"><a href="view-barcode?code=<?php echo $row['id'] . '-' . $row['cat']; ?>">Print</a></td>
|
||||
<?php
|
||||
if(isset($_SESSION['email']) && $_SESSION['email']=='mousumi@fashionavenueonline.com'){
|
||||
echo '<td style="border: 1px solid #1d1d1d; padding: 4px; text-align:center;"><a href="'.$edit_page_url.'">Edit</a></td>';
|
||||
}
|
||||
?>
|
||||
</tr>
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
</table><br>
|
||||
<div style="display: flex; flex-direction: row;">
|
||||
<form id="barcodeForm" method="post" action="./print-barcode" style="padding-right: 20px;">
|
||||
<input type="hidden" name="products" id="barcodeProductsID" />
|
||||
<input type="submit" value="Generate BarCode" style="background-color: #780a0a; color: #fff; padding: 10px 20px 10px 20px; font-size: 16px; cursor: pointer;">
|
||||
</form>
|
||||
<?php if(isset($_SESSION['email']) && $_SESSION['email']=='mousumi@fashionavenueonline.com'){ ?>
|
||||
<form id="deleteForm" method="post" action="./delete-barcode.php" onsubmit="return confirm('Are you sure you want to delete selected products?')">
|
||||
<input type="hidden" name="productsids" id="deleteProductsID" />
|
||||
<button type="button" onclick="submitDeleteForm()" style="background-color: #780a0a; color: #fff; padding: 10px 20px 10px 20px; font-size: 16px; cursor: pointer;">Delete</button>
|
||||
</form>
|
||||
<?php }?>
|
||||
</div>
|
||||
<script>
|
||||
function submitBarcodeForm() {
|
||||
document.getElementById("barcodeForm").submit();
|
||||
}
|
||||
function submitDeleteForm() {
|
||||
if (confirm('Are you sure you want to delete selected products?')) {
|
||||
document.getElementById('deleteForm').submit();
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
document.getElementById("deleteForm").submit();
|
||||
}
|
||||
var checkedValues = [];
|
||||
|
||||
document.querySelectorAll('.checkbox').forEach(function(checkbox) {
|
||||
checkbox.addEventListener('change', function() {
|
||||
if (this.checked) {
|
||||
checkedValues.push(this.value);
|
||||
} else {
|
||||
var index = checkedValues.indexOf(this.value);
|
||||
if (index !== -1) {
|
||||
checkedValues.splice(index, 1);
|
||||
}
|
||||
}
|
||||
document.getElementById('barcodeProductsID').value = checkedValues;
|
||||
document.getElementById('deleteProductsID').value = checkedValues;
|
||||
console.log(checkedValues);
|
||||
});
|
||||
});
|
||||
</script>
|
||||
Reference in New Issue
Block a user