<?php ob_start(); include("../db/cn.php"); // Check if the user is logged in if(isset($_SESSION['user_name']) && isset($_SESSION['user_role']) && isset($_SESSION['outlet_name']) && isset($_SESSION['outlet_address'])) { $userName = $_SESSION['user_name']; $userRole = $_SESSION['user_role']; $outlet_address = $_SESSION['outlet_address']; $outlet_name = $_SESSION['outlet_name']; // Display the user's name and role if($_SERVER['REQUEST_METHOD'] == "POST" && isset($_POST['expence_add'])){ $userName1 = $_SESSION['user_name']; $userRole1 = $_SESSION['user_role']; @$name_detail = $_POST['desc']; @$amount = $_POST["amount"]; $date_time122 = date("Y-m-d"); mysqli_query($connection,"insert into incash(name_detail,amount,login_user,user_role,outlet_name,outlet_address,date_time) values('".$name_detail."','".$amount."','".$userName1."','".$userRole1."','".$outlet_name."','".$outlet_address."','".$date_time122."')"); } //----------------------------------------------------------------------------------------- //opening Amount $date_time = date("Y-m-d"); $record_opening = mysqli_query($connection,"select * from opening_amount where login_user = '$userName' && role = '$userRole' && date_time = '$date_time'"); $row_amount = mysqli_fetch_array($record_opening); @$open_cash = $row_amount["open_cash"]; //--------------------------------------------------------------- // sales Sum $date_time1 = date("Y-m-d"); $rec10 = mysqli_query($connection, "SELECT order_id, discount_amount FROM log_user_sales WHERE login_user = '$userName' AND user_role = '$userRole' AND date_time = '$date_time1' && paid_by ='cash' GROUP BY order_id"); if ($rec10) { $total_sales = 0; while ($row3 = mysqli_fetch_array($rec10)) { @$total_sales += $row3['discount_amount']; } echo ""; if (mysqli_num_rows($rec10) == 0) { echo ""; } } else { echo "Error executing query: " . mysqli_error($connection); } //-------------------------------------------------------------------------------- $date_time11 = date("Y-m-d"); $query = " SELECT order_id, SUM(total_amount) AS sale_return_cash FROM order_detail WHERE sale_by = '$userName' AND user_role = '$userRole' AND date_time = '$date_time11' AND paid_by = 'cash' GROUP BY order_id"; $rec11 = mysqli_query($connection, $query); //-------------------------------------------------------------------------------- $date_time12 = date("Y-m-d"); $rec12 = mysqli_query($connection, "SELECT * FROM purchases_r WHERE user_name = '$userName' AND user_role = '$userRole' AND date_time = '$date_time12' && paid_by ='cash' "); if ($rec12) { $cash_purchase_return = 0; while ($row32 = mysqli_fetch_array($rec12)) { @$cash_purchase_return += $row32['total_amount']; } echo ""; if (mysqli_num_rows($rec12) == 0) { echo ""; } } else { echo "Error executing query: " . mysqli_error($connection); } //-------------------------------------------------------------------------------- $date_time1211 = date("Y-m-d"); $rec12m = mysqli_query($connection, "SELECT * FROM m_order WHERE login_user = '$userName' AND user_role = '$userRole' AND date_time = '$date_time1211' && paid_by ='cash' GROUP BY order_id "); if ($rec12m) { $cash_purchase_m = 0; while ($row32m = mysqli_fetch_array($rec12m)) { @$cash_purchase_m += $row32m['total_amount']; } echo ""; if (mysqli_num_rows($rec12m) == 0) { echo ""; } } else { echo "Error executing query: " . mysqli_error($connection); } //-------------------------------------------------------------------------------- // incash Sum cash expense $date_time21 = date("Y-m-d"); $cash_out = mysqli_query($connection, "SELECT SUM(amount) AS total_amount FROM incash where date_time = '$date_time21' && login_user = '$userName' && user_role = '$userRole' && date_time = '$date_time21' "); if ($cash_out) { $cash_outdata = mysqli_fetch_array($cash_out); if ($cash_outdata && isset($cash_outdata['total_amount'])) { $totalAmount_cashexpense = $cash_outdata['total_amount']; echo ""; } else { echo ""; } } else { echo "Error executing query: " . mysqli_error($connection); } //----------------------------------------------------------------------------------------- //credit get cash recieved $date_time212 = date("Y-m-d"); $credit_get = mysqli_query($connection, "SELECT SUM(amount) AS total_amounts FROM credit_paid where date_time = '$date_time212' && user_name = '$userName' && user_role = '$userRole'"); if ($credit_get) { $credit_data = mysqli_fetch_array($credit_get); if ($credit_data && isset($credit_data['total_amounts'])) { $credit_cashrecievable = $credit_data['total_amounts']; echo ""; } else { echo ""; } } else { echo "Error executing query: " . mysqli_error($connection); } //----------------------------------------------------------------------------------------- //cash paid // cash paid to supplier $date_time2121 = date("Y-m-d"); $cash_paid = mysqli_query($connection, "SELECT SUM(supplier_amount) AS total_amounts FROM supplier_paid where date_time = '$date_time2121' && status = 'cash'"); if ($credit_get) { $cash_paid_data = mysqli_fetch_array($cash_paid); if ($cash_paid_data && isset($cash_paid_data['total_amounts'])) { $credit_done = $cash_paid_data['total_amounts']; echo ""; } else { echo ""; } } else { echo "Error executing query: " . mysqli_error($connection); } //----------------------------------------------------------------------------------------- //cash purchase /*$credit_purchase = mysqli_query($connection, "SELECT SUM(total_amount) AS total_amounts FROM purchase where date_time = '$date_time2122' && user_name = '$userName' && user_role = '$userRole' && paid_by = 'cash'" ); if ($credit_purchase) { $credit_purchase_data = mysqli_fetch_array($credit_purchase); if ($credit_purchase_data && isset($credit_purchase_data['total_amounts'])) { $credit_cash_purchase1 = $credit_purchase_data['total_amounts']; echo ""; } else { echo ""; } } else { echo "Error executing query: " . mysqli_error($connection); }*/ $date_time2122 = date("Y-m-d"); $credit_purchase = mysqli_query($connection, "SELECT * FROM purchase WHERE date_time = '$date_time2122' && paid_by ='cash' GROUP BY inv_id "); if ($credit_purchase) { $credit_cash_purchase1 = 0; while ($row32m = mysqli_fetch_array($credit_purchase)) { @$credit_cash_purchase1 += $row32m['discount_amount']; } echo ""; if (mysqli_num_rows($credit_purchase) == 0) { echo ""; } } else { echo "Error executing query: " . mysqli_error($connection); } //----------------------------------------------------------------------------------------- $amount_addtion = @$total_sales + @$credit_cashrecievable + @$cash_purchase_return; $amount_sub = @$credit_cash_purchase1 ; $new_final_end = $open_cash + $amount_addtion -$amount_sub; $new_final_end1 =$new_final_end - @$credit_done + @$cash_purchase_m; $new_final_end2 = $new_final_end1 - @$totalAmount_cashexpense - @$total_sales_return; //calculation //----------------------------------------------------------------------------------------- //opening_amount if ($_SERVER["REQUEST_METHOD"] == "POST" && isset($_POST['open_submit'])){ $open_amount = $_POST["open_amount"]; mysqli_query($connection,"insert into opening_amount(open_cash,login_user,outlet_name,outlet_address,date_time,role) values('".$open_amount."','".$userName."','".$outlet_name."','".$outlet_address."','".$date_time2122."','".$userRole."')"); // Redirect to logout.php echo '<script type="text/javascript">window.location.href="cashinout.php";</script>'; //header("Location: cashinout.php"); exit(); } //---------------------------------------------------------------------------------------- //closing Drawer if ($_SERVER["REQUEST_METHOD"] == "POST" && isset($_POST['closedrawer'])){ $open_cash_f = $_POST["open_cash_f"]; $sale_cash_f = $_POST["sale_cash_f"]; $sale_cash_r = $_POST["sale_cash_r"]; $cash_purchase_f = $_POST["cash_purchase_f"]; $cash_purchase_r = $_POST["cash_purchase_r"]; $cash_recieved_f = $_POST["cash_recieved_f"]; $cash_paid_f = $_POST["cash_paid_f"]; $cash_expence_f = $_POST["cash_expence_f"]; $cash_full_f = $_POST["cash_full_f"]; $drawer_amount = $_POST["drawer_amount"]; $remarks = $_POST["remarks"]; $user = $userName; $role = $userRole; $outlet = $outlet_name; $address = $outlet_address; $date_time = date('Y-m-d'); $query = "INSERT INTO closing_amount ( open_cash, cash_sales, cash_sales_return, cash_purchase, cash_purchase_return, cash_recieved, cash_paid, cash_expence, cash_close, drawer_amount, login_user, outlet_name, outlet_address, role, date_time, remarks ) VALUES ( '$open_cash_f', '$sale_cash_f', '$sale_cash_r', '$cash_purchase_f', '$cash_purchase_r', '$cash_recieved_f', '$cash_paid_f', '$cash_expence_f', '$cash_full_f', '$drawer_amount', '$user', '$outlet', '$address', '$role', '$date_time', '$remarks' )"; mysqli_query($connection, $query); // Redirect to logout.php echo '<script type="text/javascript">window.location.href="logout.php";</script>'; //header("Location: logout.php"); exit(); // Ensure script execution stops after redirection } //----------------------------------------------------------------------------------------- ob_end_flush(); ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>Cash ~ IN & OUT ~ </title> <!-- Latest compiled and minified CSS --> <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0-alpha1/dist/css/bootstrap.min.css" rel="stylesheet"> <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.15.4/css/all.min.css"> <link rel="stylesheet" href="css/custom_css.css" /> <!-- QRCode.js --> </head> <style> #table-container-wrapper { max-height: 400px; /* Adjust the maximum height as needed */ overflow-y: auto; /* Enable vertical scroll when content overflows */ } @media (max-width: 880px) { .col-4 { width: 33.33% !important; } .fa-wifi { display: none !important; } .col-6 { width: 50% !important; } } @media (min-width: 880px) { .sidebar { width: 100%; /* Change sidebar width to 100% on mobile */ max-width: 120px; /* Set maximum width for the sidebar */ } } @media (min-width: 880px) { .main-content { margin-left: ; /* Width of the sidebar */ } } /* Added new class to control overlay */ .overlay { position: fixed; width: 100%; height: 100%; top: 0; left: 0; background-color: rgba(0, 0, 0, 0.6); z-index: 999; display: none; /* Initially hidden */ } /* Custom styles for sidebar */ .sidebar { width: 100px; background: linear-gradient(360deg, #060606, #3C2F23); position: fixed; bottom: 0; top: 60px; transition: transform 0.3s ease-in-out; transform: translateX(0); z-index: 1; height: 100%; border-radius: 0px; transition: transform 0.3s ease-in-out, width 0.3s ease-in-out; } .sidebar.hide { transform: translateX(-100px); /* Move sidebar out of the viewport when it is hidden */ } .sidebar .nav-item { padding: 10px 0; text-align: center; position: relative; font-size: 12px; } .sidebar .nav-link { color: #fff; position: relative; /* Ensure icon and text are positioned relative to the nav link */ z-index: 2; /* Ensure the text and icon are above the hover background */ } .sidebar .nav-link i { margin-bottom: 5px; /* Adjust the margin of the icon */ } /* Custom styles for hover effect */ .sidebar .nav-item:hover:after { background-color: #fff; content: ''; position: absolute; left: 0; bottom: 0; width: 100%; height: 100%; z-index: 1; /* Ensure the hover background is below the text and icon */ } .sidebar .nav-item:hover .nav-link { color: #503F2E; } /* Custom styles for divider */ .sidebar .nav-item:after { content: ""; position: absolute; left: 0; bottom: 0; width: 100%; height: 1px; background-color: #fff; transition: height 0.3s ease-in-out; /* Transition effect for smooth animation */ } /* Custom styles for header */ .header { background: linear-gradient(90deg, #3C2F23, #060606); color: #fff; padding: 10px; position: fixed; top: 0; width: 100%; z-index: 2; height: 69px; box-shadow: #FFF 2px 0px 0px 0px; /* Ensure header appears above sidebar */ } .header .navbar-toggler { color: #fff; } .header .navbar-toggler-icon { color: #fff; /* Set the color of the toggle button to white */ } .header .navbar-toggler.white { color: #fff !important; /* Ensure the toggle button is white */ } .header .navbar-brand { color: #fff; /* Set navbar brand text color to white */ } .header .nav-item .nav-link { color: #fff; /* Set nav link text color to white */ } .main-content { margin-top: 50px; /* Height of fixed header */ margin-left: 100px; /* Initially, set margin-left to 0 */ padding-top: 30px; /* Height of fixed header */ transition: margin-left 0.3s ease-in-out; /* Add transition for smoother animation */ } /* Custom styles for search bar */ .search-container { display: flex; align-items: center; width:100%; margin: 2px auto; float:left; } /* Updated hide class to apply to the overlay */ .sidebar.hide, .overlay.hide { transform: translateX(-100%); } .search-input { width: 100%; padding: 10px 30px 10px 10px; /* Adjust padding to accommodate the icon */ border: 1px solid #ccc; border-radius: 20px; font-size: 16px; } .search-icon { position: relative; left: -25px; /* Adjust the position of the icon */ color: #aaa; } .search-icon i { position: absolute; top: 50%; transform: translateY(-50%); } .btn-dark { background: #503F2E; color: #fff; border: 1px solid #503F2E; } .btn-dark:hover { background: #fff; color: #503F2E; border: 1px solid #503F2E; } .bg-dark2 { background: #503F2E; color: #fff; } .modal-content { animation: modal-animation 0.5s; } @keyframes modal-animation { from { opacity: 0; transform: scale(0.8); } to { opacity: 1; transform: scale(1); } } /* Basic styling */ .tab { display: none; padding: 20px; } .active { display: block; } .tab-buttons { display: flex; } .tab-button { cursor: pointer; padding: 10px 10px; background-color: #ffff; border: 1px solid #0A5064; border-radius: 5px 5px 0 0; margin-right: 5px; color:#212529; font-size:13px; } .tab-button.active { background-color: #212529; color:#fff; } /* Background colors for tab content */ #tab1 { background-color: #fff; color:#212529; padding:20px; } #tab2 { color:#212529; background-color: #; } #tab3 { color:#212529; background-color: #; } </style> <body> <?php include("common/hd.php");?> <!-- Sidebar --> <?php include("common/sd.php"); ?> <div class="main-content"> <div class="container-fluid"> <div class="row"> <div class="col-sm-6 text-capitalize"> <h3 style="color:#212529;">Cash Drawer</h3> </div> <div class="col-sm-6" > <br /> <button type="button" class="btn btn-dark btn-sm" data-toggle="modal" data-target="#addOpenModal" >Add Opening Amount</button>&nbsp;&nbsp; <button type="button" class="btn btn-dark btn-sm" data-toggle="modal" data-target="#addPurchaseModal">Add Cash Expense</button> <!--<a href="pos.php"><button type="button" class="btn btn-dark" ><i class="fa fa-arrow-left"></i></button></a>--> <span style=" float:right; margin-top:-7px; padding:11px;background:#524C42; box-shadow: 0px 0px 1px 1px #CECECE; border-radius:5px; color:#fff; text-transform:capitalize; font-size:14px;"><?php echo $userName;?></span> </div> </div> </div> <?php ?> <br /> <div class="container"> <div class="tab-buttons"> <div class="tab-button active" onclick="openTab(event, 'tab1')">Overview</div> <div class="tab-button" onclick="openTab(event, 'tab3')">Cash Sales</div> <!--<div class="tab-button" onclick="openTab(event, 'tab7')">Cash Sales Return</div> <div class="tab-button" onclick="openTab(event, 'tab9')">Cash Sales Adj</div> <div class="tab-button" onclick="openTab(event, 'tab6')">Cash Purchases</div> <div class="tab-button" onclick="openTab(event, 'tab8')">Cash Purchases Return</div> <div class="tab-button" onclick="openTab(event, 'tab4')">Cash Recieved</div> <div class="tab-button" onclick="openTab(event, 'tab5')">Cash Paid</div>--> <div class="tab-button" onclick="openTab(event, 'tab2')">Cash Expense</div> </div> <div class="tab-container"> <div id="tab1" class="tab active"> <h4>Overview</h4> <form method="post" action="<?php echo $_SERVER['PHP_SELF']; ?>"> <div class="container-fluid"> <div class="row" style="padding:20px;background:#fff; box-shadow: 0px 0px 5px 2px #CCC; border-radius:10px;"> <div class="col-sm-12" style="padding:20px;"> <table class="table table-hover" > <tr style="color:#8A1218;padding:20px;"> <td style="font-weight:600;">Opening Cash</td> <td style="text-align:right; font-size:19px; font-weight:600;"><?php echo isset($open_cash) ? "Rs ".$open_cash."" : ""; ?> <input type="hidden" name="open_cash_f" value="<?php echo $open_cash ?>"> </td> </tr> <tr> <td style="font-weight:600;">Cash Sales</td> <td style="text-align:right; font-size:19px; font-weight:600;"><?php echo isset($total_sales) ? "Rs ".$total_sales."" : ""; ?> <input type="hidden" name="sale_cash_f" value="<?php echo $total_sales ?>"> </td> </tr> <tr> <tr> <td style="font-weight:600;">Cash Sales Return</td> <td style="text-align:right; font-size:19px; font-weight:600;"><?php if ($rec11) { $total_sales_return = 0; while ($row31 = mysqli_fetch_array($rec11)) { $total_sales_return += $row31['sale_return_cash']; } echo "Rs ".$total_sales_return; if (mysqli_num_rows($rec11) == 0) { echo ""; } } else { echo "Error executing query: " . mysqli_error($connection); } ?> <input type="hidden" name="sale_cash_r" value="<?php echo $total_sales_return; ?>"> </td> </tr> <tr> <!--<tr> <td style="font-weight:600;">Cash Sales Adj</td> <td style="text-align:right; font-size:19px; font-weight:600;"><?php echo isset($cash_purchase_m) ? "Rs ".$cash_purchase_m."" : ""; ?></td> </tr>--> <tr> <td style="font-weight:600;">Cash Purchase</td> <td style="text-align:right; font-size:19px; font-weight:600;"> <?php echo isset($credit_cash_purchase1) ? "Rs ".$credit_cash_purchase1."" : ""; ?></td> <input type="hidden" name="cash_purchase_f" value="<?php echo $credit_cash_purchase1 ?>"> </tr> <tr> <td style="font-weight:600;">Cash Purchase Return</td> <td style="text-align:right; font-size:19px; font-weight:600;"><?php echo isset($cash_purchase_return) ? "Rs ".$cash_purchase_return."" : ""; ?> <input type="hidden" name="cash_purchase_r" value="<?php echo $cash_purchase_return ?>"> </td> </tr> <tr> <td style="font-weight:600;">Cash Recieved</td> <td style="text-align:right; font-size:19px; font-weight:600;"><?php echo isset($credit_cashrecievable) ? "Rs ".$credit_cashrecievable."" : ""; ?> <input type="hidden" name="cash_recieved_f" value="<?php echo $credit_cashrecievable ?>"> </td> </tr> <tr> <td style="font-weight:600;">Cash Paid</td> <td style="text-align:right; font-size:19px; font-weight:600;"><?php echo isset($credit_done) ? "Rs ".$credit_done."" : ""; ?> <input type="hidden" name="cash_paid_f" value="<?php echo $credit_done ?>"> </td> </tr> <tr> <td style="font-weight:600;">Cash Expense</td> <td style="text-align:right; font-size:19px; font-weight:600;"><?php echo isset($totalAmount_cashexpense) ? "Rs ".$totalAmount_cashexpense."" : ""; ?> <input type="hidden" name="cash_expence_f" value="<?php echo $totalAmount_cashexpense ?>"> </td> </tr> <tr> <td style="font-weight:600;">Closing Cash</td> <td style="text-align:right; font-size:19px; font-weight:600;"> <?php echo isset($new_final_end2) ? "Rs ".$new_final_end2."" : ""; ?> <input type="hidden" name="cash_full_f" value="<?php echo $new_final_end2 ?>"> </td> </tr> <td style="font-weight:600;">Cash Drawer Amount</td> <td style="text-align:right; font-size:19px; font-weight:600;"><input type="text" name="drawer_amount" placeholder="Rs" style="width:220px; height:35px; border:1px solid #999;box-shadow: 0px 0px 4px 1px #CCC; border-radius:5px;"></td> </tr> </table> </div> </div> <br /> <div class="row"> <div class="col-sm-12"> <textarea placeholder="'Remarks:'" name="remarks" class="form-control" style="height:150px;"></textarea> <br /> <button class="btn btn-dark" type="submit" name="closedrawer"> <i class="fa fa-cash-register"></i>&nbsp;Close Cash Drawer </button> </div> </div> </div> </form> <p></p> </div> <div id="tab2" class="tab"> <h4>Cash Expense</h4> <div class="container-fluid" id="table-container-wrapper"> <div class="row"> </div> <br /> <div class="col-sm-12"> <table class="table table-stripped text-center"> <tr style="background:#212529; color:#fff;"> <td>Date</td> <th>Name</th> <td>Amount</td> <td> Paid By</td> </tr> <?php $date_time2111 = date("Y-m-d"); $rec2 = mysqli_query($connection,"select * from incash where date_time = '$date_time2111'"); while($row2 = mysqli_fetch_array($rec2)){ ?> <tr> <td><?php echo $row2["date_time"]; ?></td> <td class="text-capitalize" style="font-weight:600;"><?php echo $row2["name_detail"]; ?></td> <td>Rs <?php echo $row2["amount"]; ?></td> <td style="text-transform:capitalize;"><?php echo $row2["login_user"]."";?></td> </tr> <?php } ?> </table> </div> </div> </div> <div id="tab7" class="tab"> <h4>Cash Sales Return</h4> <div class="container-fluid" id="table-container-wrapper"> <div class="row"> </div> <br /> <div class="col-sm-12"> <table class="table table-stripped text-center" > <tr style="background:#212529; color:#fff;" > <!-- <td>ID</td>--> <td>Date</td> <td>Order ID</td> <td>Sub Total</td> <td>Discount</td> <td>Amount</td> </tr> <?php $date_time = date("Y-m-d"); $rec = mysqli_query($connection, "SELECT *, SUM(total_amount) AS total_product FROM order_detail WHERE sale_by = '$userName' && user_role = '$userRole' && date_time = '$date_time' GROUP BY order_id"); // Check if any records were found if (mysqli_num_rows($rec) > 0) { // Loop through results and display them while ($row = mysqli_fetch_array($rec)) { ?> <tr> <td><?php echo $row["date_time"];?></td> <td style="font-weight:600;"><?php echo $row["order_id"]; ?></td> <td>Rs <?php echo $row["discounted"]; ?>.00</td> <td>Rs <?php echo $row["discount_amount"]; ?> </td> <td>Rs <?php echo $row["total_product"]; ?></td> </tr> <?php } } else { echo "No records found."; } ?> </table> </div> </div> </div> <!--<div id="tab9" class="tab"> <h4>Cash Sales Adjustment</h4> <div class="container-fluid" id="table-container-wrapper"> <div class="row"> </div> <br /> <div class="col-sm-12"> <table class="table table-stripped text-center" > <tr style="background:#212529; color:#fff;" > <!-- <td>ID</td> <td>Date</td> <td>Order ID</td> <td>Sub Total</td> <td>Discount</td> <td>Amount</td> </tr> <?php $date_time = date("Y-m-d"); $rec = mysqli_query($connection, "SELECT *, SUM(total_amount) AS total_product FROM m_order WHERE login_user = '$userName' && user_role = '$userRole' && date_time = '$date_time' GROUP BY order_id"); // Check if any records were found if (mysqli_num_rows($rec) > 0) { // Loop through results and display them while ($row = mysqli_fetch_array($rec)) { ?> <tr> <td><?php echo $row["date_time"];?></td> <td style="font-weight:600;"><?php echo $row["order_id"]; ?></td> <td>Rs <?php echo $row["discount_amount"]; ?>.00</td> <td>Rs <?php echo $row["discounted"]; ?> </td> <td>Rs <?php echo $row["total_amount"]; ?></td> </tr> <?php } } else { echo "No records found."; } ?> </table> </div> </div> </div>--> <div id="tab8" class="tab"> <h4>Cash Purchase Return</h4> <div class="container-fluid" id="table-container-wrapper"> <div class="row"> </div> <br /> <table class="table table-stripped text-center"> <tr style="background:#212529; color:#fff;"> <td>Date</td> <td>Supplier Name</td> <th> Name</th> <td>No of Unit</td> <td>Unit Price</td> <td>Amount</td> </tr> <?php $date_time11 = date("Y-m-d"); $rec5 = mysqli_query($connection, "select * from purchases_r where user_name = '$userName' && user_role = '$userRole' && outlet_name = '$outlet_name' && outlet_address = '$outlet_address' && date_time = '$date_time11' && paid_by = 'cash'"); while($row6 = mysqli_fetch_array($rec5)){ ?> <tr> <td><?php echo $row6["date_time"]; ?></td> <td class="text-capitalize" style="font-weight:600;"><?php echo $row6["supplier_name"]; ?></td> <td class="text-capitalize" style="font-weight:600;"><?php echo $row6["product_name"];?></td> <td class="text-capitalize"><?php echo $row6["total_quantity"]; ?></td> <td>Rs <?php echo $row6["retail_price"]; ?></td> <td>Rs <?php echo $row6["total_amount"]; ?></td> </tr> <?php } ?> </table> <br /> <div class="col-sm-12"> </div> </div> </div> </div> <div id="tab3" class="tab"> <h4> Cash Sales</h2> <div class="container-fluid" id="table-container-wrapper"> <div class="row"> </div> <br /> <div class="col-sm-12"> <table class="table table-stripped text-center" > <tr style="background:#212529; color:#fff;" > <!-- <td>ID</td>--> <td>Date</td> <td>Order ID</td> <td>Sub Total</td> <td>Discount</td> <td>Amount</td> </tr> <?php $date_time = date("Y-m-d"); $rec = mysqli_query($connection, "SELECT order_id,total_amount,discounted,discount_amount,date_time, SUM(net_amount) AS total_product FROM log_user_sales WHERE login_user = '$userName' && user_role = '$userRole' && date_time = '$date_time' && paid_by = 'cash' GROUP BY order_id"); // Check if any records were found if (mysqli_num_rows($rec) > 0) { // Loop through results and display them while ($row = mysqli_fetch_array($rec)) { ?> <tr> <td><?php echo $row["date_time"];?></td> <td style="font-weight:600;"><?php echo $row["order_id"]; ?></td> <td>Rs <?php echo $row["total_product"]; ?></td> <td>Rs <?php echo $row["discounted"]; ?> </td> <td>Rs <?php echo $row["discount_amount"]; ?></td> </tr> <?php } } else { echo ""; } ?> </table> </div> </div> </div> <div id="tab4" class="tab"> <h4 style="color:#212529;">Cash Recieved</h4> <div class="container-fluid" id="table-container-wrapper"> <div class="row"> </div> <br /> <div class="col-sm-12"> <table class="table table-stripped text-center"> <tr style="background:#212529; color:#fff;"> <td>Date</td> <th>Name</th> <td>Amount</td> <td>Status</td> <td> By</td> </tr> <?php $date_time11 = date("Y-m-d"); $rec5 = mysqli_query($connection, "select * from credit_paid where user_name = '$userName' && user_role = '$userRole' && outlet_name = '$outlet_name' && outlet_address = '$outlet_address' && date_time = '$date_time11'"); while($row6 = mysqli_fetch_array($rec5)){ ?> <tr> <td><?php echo $row6["date_time"]; ?></td> <td class="text-capitalize" style="font-weight:600;"><?php echo $row6["cr_name"]; ?></td> <td>Rs <?php echo $row6["amount"]; ?></td> <td class="text-capitalize"><?php echo $row6["paid_by"]; ?></td> <td class="text-capitalize"><?php echo $row6["user_name"]; ?></td> </tr> <?php } ?> </table> </div> </div> </div> <div id="tab5" class="tab"> <h4 style="color:#212529;">Cash Paid</h4> <div class="container-fluid" id="table-container-wrapper"> <div class="row"> </div> <br /> <div class="col-sm-12"> <table class="table table-stripped text-center"> <tr style="background:#212529; color:#fff;"> <td>Date</td> <th>Name</th> <td>Amount</td> <td>Status</td> <td>By</td> </tr> <?php $date_time11 = date("Y-m-d"); $rec51 = mysqli_query($connection, "select * from supplier_paid where user_name = '$userName' && user_role = '$userRole' && outlet_name = '$outlet_name' && outlet_address = '$outlet_address' && date_time = '$date_time11'"); while($row69 = mysqli_fetch_array($rec51)){ ?> <tr> <td><?php echo $row69["date_time"]; ?></td> <td class="text-capitalize" style="font-weight:600;"><?php echo $row69["supplier_name"]; ?></td> <td>Rs <?php echo $row69["supplier_amount"]; ?></td> <td class="text-capitalize"> <?php echo $row69["status"]; ?></td> <td class="text-capitalize"><?php echo $row69["user_name"];?></td> </tr> <?php } ?> </table> </div> </div> </div> <div id="tab6" class="tab"> <h4 style="color:#212529;">Cash Purchases</h4> <div class="container-fluid" id="table-container-wrapper"> <div class="row"> </div> <br /> <div class="col-sm-12"> <table class="table table-stripped text-center"> <tr style="background:#212529; color:#fff;"> <td>Date</td> <td>Order ID</td> <td>Sub Total</td> <td>Discount</td> <td>Amount</td> </tr> <?php $date_time11 = date("Y-m-d"); $rec5 = mysqli_query($connection, "select * from purchase where date_time = '$date_time11' && paid_by = 'cash' GROUP BY inv_id"); while($row6 = mysqli_fetch_array($rec5)){ ?> <tr> <td><?php echo $row6["date_time"];?></td> <td style="font-weight:600;"><?php echo $row6["inv_id"]; ?></td> <td>Rs <?php echo $row6["discount_amount"]; ?></td> <td>Rs <?php echo $row6["discounted"]; ?> </td> <td>Rs <?php echo $row6["discount_amount"]; ?></td> </tr> <?php } ?> </table> </div> </div> </div> </div> </div> </div> <!-- Modal HTML --> <!-- Modal for adding purchases --> <div class="modal fade" id="addPurchaseModal" tabindex="-1" role="dialog" aria-labelledby="addPurchaseModalLabel" aria-hidden="true" style="margin-top:80px;"> <div class="modal-dialog" role="document"> <div class="modal-content"> <div class="modal-header"> <h5 class="modal-title text-capitalize" id="addPurchaseModalLabel">Add Cash Expense</h5> <button type="button" class="close" data-dismiss="modal" aria-label="Close"> <span aria-hidden="true">&times;</span> </button> </div> <div class="modal-body"> <!-- Form for adding purchase --> <form method="post" action="<?php echo $_SERVER['PHP_SELF']; ?>" enctype="multipart/form-data"> <input type="text" name="desc" placeholder="Description / Name" class="form-control" /> <br /> <input type="text" name="amount" placeholder="Amount" class="form-control" /> <br /> <button type="submit" class="btn btn-dark" name="expence_add">Enter</button> </form> </div> </div> </div> </div> <div class="modal fade" id="addOpenModal" tabindex="-1" role="dialog" aria-labelledby="addOpenModalLabel" aria-hidden="true" style="margin-top:80px;"> <div class="modal-dialog" role="document"> <div class="modal-content"> <div class="modal-header"> <h5 class="modal-title text-capitalize" id="addOpenModalLabel">Add Opening Amount</h5> <button type="button" class="close" data-dismiss="modal" aria-label="Close"> <span aria-hidden="true">&times;</span> </button> </div> <div class="modal-body"> <!-- Form for adding purchase --> <form method="post" action="<?php echo $_SERVER['PHP_SELF']; ?>" enctype="multipart/form-data"> <input type="text" name="open_amount" placeholder="Amount" class="form-control" /> <br /> <button type="submit" name="open_submit" class="btn btn-dark">Enter</button> </form> </div> </div> </div> </div> </div> </body> <!-- JavaScript libraries --> <!-- jQuery library --> <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js"></script> <!-- Latest compiled and minified Bootstrap JavaScript --> <script src="https://stackpath.bootstrapcdn.com/bootstrap/4.5.2/js/bootstrap.min.js"></script> <!-- Popper JS --> <script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.16.0/umd/popper.min.js"></script> <!-- FileSaver.js --> <script> document.addEventListener("DOMContentLoaded", function () { var sidebar = document.getElementById("sidebar"); var overlay = document.createElement("div"); overlay.classList.add("overlay"); document.body.appendChild(overlay); function toggleSidebar() { sidebar.classList.toggle("hide"); overlay.classList.toggle("hide"); var mainContent = document.querySelector(".main-content"); if (sidebar.classList.contains("hide")) { mainContent.style.marginLeft = "0"; } else { mainContent.style.marginLeft = "100px"; // Width of the sidebar } } overlay.addEventListener("click", function () { toggleSidebar(); }); // Add toggle functionality to navbar toggler var navbarToggler = document.querySelector(".navbar-toggler"); navbarToggler.addEventListener("click", function () { toggleSidebar(); }); // Automatically hide sidebar on all screen sizes // sidebar.classList.add("hide"); // overlay.classList.add("hide"); // Add class to body to prevent scrolling when sidebar is open // document.body.classList.add("noscroll"); // Check if screen size is larger than a certain threshold (e.g., 768px for desktop screens) function checkScreenSize() { if (window.innerWidth > 768) { sidebar.classList.remove("hide"); overlay.classList.remove("hide"); } else { sidebar.classList.add("hide"); overlay.classList.add("hide"); } } // Check screen size on initial load and whenever the window is resized checkScreenSize(); window.addEventListener("resize", checkScreenSize); }); // Live search functionality document.getElementById('searchInput').addEventListener('input', function() { var filter, table, tr, td, i, txtValue; filter = this.value.toUpperCase(); table = document.getElementById("overviewTable"); tr = table.getElementsByTagName("tr"); for (i = 0; i < tr.length; i++) { td = tr[i].getElementsByTagName("td")[0]; // Change index based on column position if (td) { txtValue = td.textContent || td.innerText; if (txtValue.toUpperCase().indexOf(filter) > -1) { tr[i].style.display = ""; } else { tr[i].style.display = "none"; } } } }); // Function to switch between tabs function openTab(evt, tabName) { // Get all elements with class="tab" and hide them var tabs = document.getElementsByClassName("tab"); for (var i = 0; i < tabs.length; i++) { tabs[i].style.display = "none"; } // Get all elements with class="tab-button" and remove the class "active" var tabButtons = document.getElementsByClassName("tab-button"); for (var i = 0; i < tabButtons.length; i++) { tabButtons[i].classList.remove("active"); } // Show the current tab, and add an "active" class to the button that opened the tab document.getElementById(tabName).style.display = "block"; evt.currentTarget.classList.add("active"); } </script> </html> <?php } ?>