D7net
Home
Console
Upload
information
Create File
Create Folder
About
Tools
:
/
home3
/
encodto1
/
salvation.incrediblebengal.com
/
admin
/
Filename :
restro_account.php
back
Copy
<?php include'config.php'; include'get_session_access.php'; $page_title = "Restro Accounting"; ?> <!DOCTYPE html> <html lang="en"> <head> <title>Encode Restaurent - Admin Dashboard </title> <?php include'style.php'; ?> </head> <body> <div id="main-wrapper"> <?php include'header.php'; ?> <?php include'sidebar.php'; ?> <div class="content-body"> <div class="container-fluid"> <div class="row"> <div class="col-xl-12"> <div class="inventory_div"> <ul class="nav nav-tabs mb-1"> <li><a data-toggle="tab" href="#sales">Sales</a></li> <li><a data-toggle="tab" href="#purchase_expenses">Purchase Expenses</a></li> <li><a data-toggle="tab" href="#add_expenses">Additional Expenses</a></li> </ul> <div class="tab-content"> <div id="sales" class="tab-pane fade in active show"> <div class="row"> <div class="col-lg-6 col-sm-12 col-xs-12"> <div class="dine_div"> <h4>Dine In Order Transaction</h4> <div class="clearfix"></div> <div class="row"> <div class="col-lg-6 col-sm-6 col-xs-6"> <div class="transaction_block bg-white p-3 mb-3 text-center"> <h5 class="mb-0">Today's total: <?php $order_date = date("Y-m-d"); $sql_today = "SELECT DATE(order_date) AS o_date, SUM(total_payment) AS t_payment FROM dinein_order WHERE DATE(order_date) = '$order_date'"; $run_today = mysqli_query($conn, $sql_today) or die(); while($rec = $run_today->fetch_assoc()) { echo "<span> ".$rec['t_payment']."</span>"; } ?> </h5> </div> </div> <div class="col-lg-6 col-sm-6 col-xs-6"> <div class="transaction_block bg-white p-3 mb-3 text-center"> <h5 class="mb-0">Last Day's total: <?php $p_date = date('Y-m-d', strtotime($order_date .' -1 day')); $sql_prev = "SELECT DATE(order_date) AS o_date, SUM(total_payment) AS t_payment FROM dinein_order WHERE DATE(order_date) = '$p_date'"; $run_prev = mysqli_query($conn, $sql_prev) or die(); while($prev = $run_prev->fetch_assoc()) { echo "<span> ".$prev['t_payment']."</span>"; } ?> </h5> </div> </div> <div class="col-lg-12 col-sm-12 col-xs-12"> <div class="transaction_block bg-white p-3 mb-3 text-center border-0"> <h5 class="text-left mb-3">Weekly Transaction of Dine In Order</h5> <table class="w-100"> <tr> <th>S No.</th> <th>Year</th> <th>Month</th> <th>Week</th> <th>Sales(Income)</th> </tr> <?php $p_date = date('Y-m-d', strtotime($order_date .' -1 day')); $sql_weekly = "select year(order_date) AS Year,month(order_date) AS Month,week(order_date) as Week,sum(total_payment) AS Income from dinein_order group by year(order_date),month(order_date),week(order_date) order by year(order_date),month(order_date),week(order_date);"; $run_weekly = mysqli_query($conn, $sql_weekly) or die(); $sn = 0; while($weekly = $run_weekly->fetch_assoc()) { $sn++; ?> <tr> <td><?php echo $sn; ?></td> <td><?php echo $weekly['Year']; ?></td> <td><?php echo $weekly['Month']; ?></td> <td><?php echo $weekly['Week']; ?></td> <td><i class="fa fa-inr"></i> <?php echo $weekly['Income']; ?></td> </tr> <?php } ?> </table> </div> </div> </div> </div> </div> <div class="col-lg-6 col-sm-12 col-xs-12"> <div class="dine_div"> <h4>Take Away Order Transaction</h4> <div class="clearfix"></div> <div class="row"> <div class="col-lg-6 col-sm-6 col-xs-6"> <div class="transaction_block bg-white p-3 mb-3 text-center"> <h5 class="mb-0">Today's total: <?php $order_date = date("Y-m-d"); $sql_today = "SELECT DATE(order_date) AS o_date, SUM(total_payment) AS t_payment FROM delivery_order WHERE DATE(order_date) = '$order_date'"; $run_today = mysqli_query($conn, $sql_today) or die(); while($rec = $run_today->fetch_assoc()) { echo "<span> ".$rec['t_payment']."</span>"; } ?> </h5> </div> </div> <div class="col-lg-6 col-sm-6 col-xs-6"> <div class="transaction_block bg-white p-3 mb-3 text-center"> <h5 class="mb-0">Last Day's total: <?php $p_date = date('Y-m-d', strtotime($order_date .' -1 day')); $sql_prev = "SELECT DATE(order_date) AS o_date, SUM(total_payment) AS t_payment FROM delivery_order WHERE DATE(order_date) = '$p_date'"; $run_prev = mysqli_query($conn, $sql_prev) or die(); while($prev = $run_prev->fetch_assoc()) { echo "<span> ".$prev['t_payment']."</span>"; } ?> </h5> </div> </div> <div class="col-lg-12 col-sm-12 col-xs-12"> <div class="transaction_block bg-white p-3 mb-3 text-center border-0"> <h5 class="text-left mb-3">Weekly Transaction of Dine In Order</h5> <table class="w-100"> <tr> <th>S No.</th> <th>Year</th> <th>Month</th> <th>Week</th> <th>Sales(Income)</th> </tr> <?php $sql_weekly = "select year(order_date) AS Year,month(order_date) AS Month,week(order_date) as Week,sum(total_payment) AS Income from delivery_order group by year(order_date),month(order_date),week(order_date) order by year(order_date) DESC,month(order_date) DESC,week(order_date) DESC"; $run_weekly = mysqli_query($conn, $sql_weekly) or die(); $sn = 0; while($weekly = $run_weekly->fetch_assoc()) { $sn++; ?> <tr> <td><?php echo $sn; ?></td> <td><?php echo $weekly['Year']; ?></td> <td><?php echo $weekly['Month']; ?></td> <td><?php echo $weekly['Week']; ?></td> <td><i class="fa fa-inr"></i> <?php echo $weekly['Income']; ?></td> </tr> <?php } ?> </table> </div> </div> </div> </div> </div> </div> </div> <div id="add_expenses" class="tab-pane fade"> <button type="button" class="btn btn-primary" data-toggle="modal" data-target=".bd-example-modal-lg">Add Expenses</button> <div class="table-responsive"> <table class="example4 display mb-4 dataTablesCard"> <thead> <tr> <th><strong class="font-w600">ID</strong></th> <th><strong class="font-w600">Food Name</strong></th> <th><strong class="font-w600">Price</strong></th> <th><strong class="font-w600">Qty</strong></th> <th><strong class="font-w600">Food Stock</strong></th> <th><strong class="font-w600">Status</strong></th> <th><strong class="font-w600">Action</strong></th> </tr> </thead> <tbody> <?php $show_items = "SELECT * FROM additional_expenses ORDER BY DATE(exp_date) DESC"; $run_query = mysqli_query($conn, $show_items); if($run_query-> num_rows > 0){ while($row = mysqli_fetch_assoc($run_query)) { $exp_id = $row['exp_id']; $exp_date = $row['exp_date']; $exp_type = $row['exp_type']; $exp_purpose = $row['exp_purpose']; $exp_amount = $row['exp_amount']; $exp_mode = $row['exp_mode']; $status = ""; echo "<tr> <td>".$exp_id.".</td> <td>".$exp_date."</td> <td>".$exp_type."</td> <td>".$exp_purpose."</td> <td><i class='fa fa-inr'></i>".$exp_amount."</td> <td>".$exp_mode."</td> <td> <div class='dropdown ml-auto'> <div class='btn-link' data-toggle='dropdown'> <svg width='24' height='24' viewBox='0 0 24 24' fill='none' xmlns='http://www.w3.org/2000/svg'> <path d='M11.0005 12C11.0005 12.5523 11.4482 13 12.0005 13C12.5528 13 13.0005 12.5523 13.0005 12C13.0005 11.4477 12.5528 11 12.0005 11C11.4482 11 11.0005 11.4477 11.0005 12Z' stroke='#3E4954' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/> <path d='M18.0005 12C18.0005 12.5523 18.4482 13 19.0005 13C19.5528 13 20.0005 12.5523 20.0005 12C20.0005 11.4477 19.5528 11 19.0005 11C18.4482 11 18.0005 11.4477 18.0005 12Z' stroke='#3E4954' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/> <path d='M4.00049 12C4.00049 12.5523 4.4482 13 5.00049 13C5.55277 13 6.00049 12.5523 6.00049 12C6.00049 11.4477 5.55277 11 5.00049 11C4.4482 11 4.00049 11.4477 4.00049 12Z' stroke='#3E4954' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/> </svg> </div> <div class='dropdown-menu dropdown-menu-right'> <a class='dropdown-item text-info' href='edit-additional-expense.php?id=$exp_id'> <svg class='mr-3' width='24' height='24' viewBox='0 0 24 24' fill='none' xmlns='http://www.w3.org/2000/svg'> <path d='M22 11.08V12C21.9988 14.1564 21.3005 16.2547 20.0093 17.9818C18.7182 19.709 16.9033 20.9725 14.8354 21.5839C12.7674 22.1953 10.5573 22.1219 8.53447 21.3746C6.51168 20.6273 4.78465 19.2461 3.61096 17.4371C2.43727 15.628 1.87979 13.4881 2.02168 11.3363C2.16356 9.18457 2.99721 7.13633 4.39828 5.49707C5.79935 3.85782 7.69279 2.71538 9.79619 2.24015C11.8996 1.76491 14.1003 1.98234 16.07 2.86' stroke='#2F4CDD' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/> <path d='M22 4L12 14.01L9 11.01' stroke='#2F4CDD' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/> </svg> Edit Item </a> <a class='dropdown-item text-black' href='delete-additional-expense.php?id=$exp_id'> <svg class='mr-3' width='24' height='24' viewBox='0 0 24 24' fill='none' xmlns='http://www.w3.org/2000/svg'> <path d='M12 22C17.5228 22 22 17.5228 22 12C22 6.47715 17.5228 2 12 2C6.47715 2 2 6.47715 2 12C2 17.5228 6.47715 22 12 22Z' stroke='#F24242' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'></path> <path d='M15 9L9 15' stroke='#F24242' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'></path> <path d='M9 9L15 15' stroke='#F24242' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'></path> </svg> Delete Item </a> </div> </div> </td> </tr>"; } } else{ echo "<span style='color:#fe0002;font-size:15px;'>Banner list is Empty.</span>"; } ?> </tbody> </table> </div> </div> </div> </div> </div> </div> </div> </div> <div class="modal fade bd-example-modal-lg" tabindex="-1" role="dialog" aria-hidden="true"> <div class="modal-dialog modal-lg"> <div class="modal-content"> <div class="modal-body"> <h5 class="modal-title"><u>Add Expenses</u></h5> <button type="button" class="close" data-dismiss="modal"> <span>×</span> </button> <div class="addExpense mt-3"> <form action="restro_account.php" method="POST"> <div class="row form-material"> <div class="col-lg-6 col-md-6 colsm-12 col-xs-12"> <div class="form-group"> <input type="datetime-local" class="form-control" name="exp_date" placeholder="Date of Expense"> </div> </div> <div class="col-lg-6 col-md-6 colsm-12 col-xs-12"> <div class="form-group"> <input type="text" class="form-control" name="exp_type" placeholder="Type of Expense"> </div> </div> <div class="col-lg-6 col-md-6 colsm-12 col-xs-12"> <div class="form-group"> <input type="text" class="form-control" name="exp_purpose" placeholder="Purpose"> </div> </div> <div class="col-lg-6 col-md-6 colsm-12 col-xs-12"> <div class="form-group"> <input type="text" class="form-control" name="exp_amount" placeholder="Amount"> </div> </div> <div class="col-lg-6 col-md-6 colsm-12 col-xs-12"> <div class="form-group"> <select class="form-control" name="exp_mode"> <option value="cash">Cash</option> <option value="cheque">Cheque</option> <option value="online">Online</option> </select> </div> </div> <div class="col-lg-6 col-md-6 colsm-12 col-xs-12"> <div class="form-group"> <input type="submit" name="addExpense" class="btn btn-primary w-50" value="Submit"> </div> </div> </div> </form> </div> </div> </div> </div> </div> <?php include'footer.php'; ?> </body> </html> <?php if (isset($_POST['addExpense'])) { $exp_date = $_POST['exp_date']; $exp_type = $_POST['exp_type']; $exp_purpose = $_POST['exp_purpose']; $exp_amount = $_POST['exp_amount']; $exp_mode = $_POST['exp_mode']; $insert_exp = mysqli_query($conn, "INSERT INTO additional_expenses(exp_id, exp_date, exp_type, exp_purpose, exp_amount,exp_mode) VALUES('', '$exp_date', '$exp_type', '$exp_purpose', '$exp_amount', '$exp_mode')"); if ($insert_exp) { echo "<script>alert('additional expenses data inserted.')</script>"; echo '<script>window.location.href="restro_account.php";</script>'; } else{ echo "<script>alert('additional expenses data not inserted.')</script>"; } } ?>