public function overwriteForm($return, $returnfull) { $return = parent::overwriteForm($return, $returnfull); $resto = new MasterRestaurantModel(); $res = $resto->getAll(); foreach ($res as $value) { $arrHelp[$value->id_restaurant] = $value->name; } $return['id_restaurant'] = new Leap\View\InputSelect($arrHelp, "id_restaurant", "id_restaurant", $this->id_restaurant); $bank = new BankModel(); $return['end_mr_fee'] = new \Leap\View\InputText("date", "end_mr_fee", "end_mr_fee", $dt); $return['fee'] = new Leap\View\InputTextRightAddOn("text", "fee", "fee", " % ", $this->fee); $return['mr_fee_select'] = new Leap\View\InputRadioButtonHideWhen(array(1 => "Yes", 0 => "No"), "mr_fee_select", "mr_fee_select", $this->mr_fee_select, array(1 => "formgroup_start_mr_fee,formgroup_end_mr_fee", 0 => "formgroup_start_mr_fee,formgroup_end_mr_fee")); if ($this->mr_fee_select == 0) { if (!isset($this->start_mr_fee)) { $dt = leap_mysqldate(); } else { $dt = $this->start_mr_fee; } $return['start_mr_fee'] = new \Leap\View\InputText("date", "start_mr_fee", "start_mr_fee", $dt); if (!isset($this->end_mr_fee)) { $dta = leap_mysqldate(); } else { $dta = $this->end_mr_fee; } $return['end_mr_fee'] = new \Leap\View\InputText("date", "end_mr_fee", "end_mr_fee", $dta); } else { } return $return; }
public function overwriteForm($return, $returnfull) { $return = parent::overwriteForm($return, $returnfull); $resto = new MasterRestaurantModel(); $res = $resto->getAll(); foreach ($res as $value) { $arrHelp[$value->id_restaurant] = $value->name; } $return['id_restaurant'] = new Leap\View\InputSelect($arrHelp, "id_restaurant", "id_restaurant", $this->id_restaurant); $bank = new BankModel(); $arrBank = $bank->getAll(); foreach ($arrBank as $value) { $arrHelpBank[$value->id_bank] = $value->bank_name; } $return['id_bank'] = new Leap\View\InputSelect($arrHelpBank, "id_bank", "id_bank", $this->id_bank); if (!isset($this->start)) { $dt = leap_mysqldate(); } else { $dt = $this->start; } $return['start'] = new \Leap\View\InputText("date", "start", "start", $dt); if (!isset($this->end)) { $dt = leap_mysqldate(); } else { $dt = $this->end; } $return['end'] = new \Leap\View\InputText("date", "end", "end", $dt); return $return; }
public function overwriteForm($return, $returnfull) { $return = parent::overwriteForm($return, $returnfull); $resto = new MasterRestaurantModel(); $res = $resto->getAll(); foreach ($res as $value) { $arrHelp[$value->id_restaurant] = $value->name; } $return['id_restaurant'] = new Leap\View\InputSelect($arrHelp, "id_restaurant", "id_restaurant", $this->id_restaurant); return $return; }
public function overwriteForm($return, $returnfull) { $resto = new MasterRestaurantModel(); $res = $resto->getAll(); foreach ($res as $value) { $arrHelp[$value->id_restaurant] = $value->name; } $return['id_restaurant'] = new Leap\View\InputSelect($arrHelp, "id_restaurant", "id_restaurant", $this->id_restaurant); $return['status'] = new Leap\View\InputSelect(array("1" => "Active", "0" => "Inactive"), "status", "status", $this->status); return $return; }
public function overwriteForm($return, $returnfull) { $return = parent::overwriteForm($return, $returnfull); $userModel = new UserModel(); $arrUser = $userModel->getAll(); foreach ($arrUser as $value) { $arrUserHelp[$value->id_user] = $value->user_name; } $return['inv_from'] = new Leap\View\InputSelect($arrUserHelp, "inv_from", "inv_from", $this->inv_from); $resto = new MasterRestaurantModel(); $res = $resto->getAll(); foreach ($res as $value) { $arrHelp[$value->id_restaurant] = $value->name; } $return['inv_id_resto'] = new Leap\View\InputSelect($arrHelp, "inv_id_resto", "inv_id_resto", $this->inv_id_resto); return $return; }
public function unactivateTag($id_tag) { $r = new MasterRestaurantModel(); $arrResto = $r->getAll(); foreach ($arrResto as $resto) { if ($resto->restaurant_tags == null || $resto->restaurant_tags == "") { continue; } $arrTags = explode(",", $resto->restaurant_tags); for ($i = 0; $i < count($arrTags); $i++) { if ($arrTags[$i] == $id_tag) { unset($arrTags[$i]); $resto->restaurant_tags = implode(",", array_unique($arrTags)); $resto->save(); break; } } } }
public function overwriteForm($return, $returnfull) { $return = parent::overwriteForm($return, $returnfull); $resto = new MasterRestaurantModel(); $res = $resto->getAll(); foreach ($res as $value) { $arrHelp[$value->id_restaurant] = $value->name; } $return['id_restaurant'] = new Leap\View\InputSelect($arrHelp, "id_restaurant", "id_restaurant", $this->id_restaurant); $bank = new BankModel(); $arrBank = $bank->getAll(); foreach ($arrBank as $value) { $arrHelpBank[$value->id_bank] = $value->bank_name; } $return['id_bank'] = new Leap\View\InputSelect($arrHelpBank, "id_bank", "id_bank", $this->id_bank); $return['fee'] = new Leap\View\InputTextRightAddOn("text", "fee", "fee", '%', $this->fee); $return['fee_nominal'] = new Leap\View\InputTextLeftAddOn("text", "fee_nominal", "fee_nominal", 'Rp.', $this->fee_nominal); $return['last_changed'] = new Leap\View\InputText("hidden", "last_changed", "last_changed", leap_mysqldate()); if (!isset($this->start_fee)) { $dt = leap_mysqldate(); } else { $dt = $this->start_fee; } $return['start_fee'] = new \Leap\View\InputText("date", "start_fee", "start_fee", $dt); if (!isset($this->end_fee)) { $dt = leap_mysqldate(); } else { $dt = $this->end_fee; } $return['end_fee'] = new \Leap\View\InputText("date", "end_fee", "end_fee", $dt); ?> <!--<script> $('#formgroup_start_mr_fee').change(function(){ }); </script>--> <?php return $return; }
public function updateRestoMRFee() { $idsResto = Generic::mustCheck($_POST['id_restaurant'], "No Restaurant IDs Found"); $fee = Generic::mustCheck($_POST['fee'], "No Fee Found"); if (!is_numeric($fee)) { Generic::errorMsg("Fee Must Numbers"); } if (doubleval($fee) > 100) { Generic::errorMsg("Fee Max 100%"); } $ids = explode(',', $idsResto); if (count($ids) <= 0) { Generic::errorMsg("Empty Id"); } $updateAll = in_array('0', $ids); if ($updateAll) { $r = new MasterRestaurantModel(); $arrR = $r->getAll(); foreach ($arrR as $singleR) { unset($resto); $resto = new MasterRestaurantModel(); $resto->getByID($singleR->id_restaurant); $log = new LogDiscFeeModel(); $log->id_reference = $singleR->id_restaurant; $log->change_type = "Fee MR"; $log->change_from = Generic::IsNullOrEmptyString($resto->mr_fee) ? "0" : $resto->mr_fee; $log->change_to = $fee; $log->change_date_time = leap_mysqldate(); $log->save(); $resto->mr_fee = $fee; $resto->save(); } } else { foreach ($ids as $id) { unset($resto); $resto = new MasterRestaurantModel(); $resto->getByID($id); $log = new LogDiscFeeModel(); $log->id_reference = $id; $log->change_type = "Fee MR"; $log->change_from = Generic::IsNullOrEmptyString($resto->mr_fee) ? "0" : $resto->mr_fee; $log->change_to = $fee; $log->change_date_time = leap_mysqldate(); $log->save(); $resto->mr_fee = $fee; $resto->save(); } } $json['status_code'] = 1; $json['status_message'] = "success"; echo json_encode($json); die; }
public function reportFee() { $id_restaurant = isset($_GET['id_restaurant']) ? addslashes($_GET['id_restaurant']) : "0"; $type_order = isset($_GET['type_order']) ? addslashes($_GET['type_order']) : "8"; $dateVon = isset($_GET['dateVon']) ? addslashes($_GET['dateVon']) : date('Y-m-d', time()); $dateBis = isset($_GET['dateBis']) ? addslashes($_GET['dateBis']) : date('Y-m-d', time()); // $dateBis = isset($_GET['dateBis']) ? addslashes($_GET['dateBis']) : Generic::setCurrentDate(); $id_server = isset($_GET['id_server']) ? addslashes($_GET['id_server']) : "0"; $status_payment = isset($_GET['status_payment']) ? addslashes($_GET['status_payment']) : 0; $status_progress = isset($_GET['status_progress']) ? addslashes($_GET['status_progress']) : 4; $objResto = new MasterRestaurantModel(); $arrResto = $objResto->getAll(); $arrRestoIndex[0] = "All"; foreach ($arrResto as $resto) { if ($resto->name != "") { $arrRestoIndex[$resto->id_restaurant] = $resto->name; } } $objOrder = new MasterOrderModel(); $first_key = key($arrRestoIndex); $arrOrder = $objOrder->getWhere("id_restaurant='{$id_restaurant}'"); $arrRestoUserIndex[0] = "All"; foreach ($arrOrder as $val) { $user = RestaurantUser::getRestaurantUserName($val->id_server); if ($user != "") { $arrRestoUserIndex[$val->id_server] = $user; } } $arrTypeOrder[0] = "Dine In - Manual"; $arrTypeOrder[1] = "Dine In - Apps"; $arrTypeOrder[2] = "Take Away - Manual"; $arrTypeOrder[3] = "Take Away - Apps"; $arrTypeOrder[4] = "All Manual Order"; $arrTypeOrder[5] = "All Apps Order"; $arrTypeOrder[6] = "All Dine In Order"; $arrTypeOrder[7] = "All Take Away Order"; $arrTypeOrder[8] = "All Order Types"; $arrStatusPaymentMethod[1] = "Cash"; $arrStatusPaymentMethod[2] = "Credit Card"; $arrStatusPaymentMethod[3] = "Others"; $arrStatusPaymentMethod[0] = "All Payment Method"; $arrStatusProgress[4] = "Done"; $arrStatusProgress[9] = "Void"; $t = time(); $where = " "; if ($id_restaurant == 0) { $where = $where; } else { $allResto = false; $where = $where . " resto.id_restaurant='{$id_restaurant}' AND "; } if ($type_order == "8") { } else { $where = $where . " o.type_order='{$type_order}' AND "; } if ($dateVon == "") { ?> <?php $dateVon = Generic::setCurrentDate(); } else { $date = new DateTime($dateVon); // $dateVon = leap_mysqldate_isi(date('Y-m-d H:i:s')); // pr($dateVon); $where = $where . " o.datetime_order >='{$dateVon}' AND "; } if ($dateBis == "") { $dateBis = Generic::setCurrentDate(); } else { $date = new DateTime($dateVon); $where = $where . " o.datetime_order <= '{$dateBis}' AND "; } if ($id_server == "0") { $where = $where; } else { $where = $where . " o.id_server='{$id_server}' AND "; } if ($status_payment == "" | $status_payment == "0") { $where = $where; } else { $where = $where . " o.status_payment='{$status_payment}' AND "; } if ($status_progress == "") { } else { $where = $where . " o.status_progress='{$status_progress}' "; } $objOrder = new MasterOrderModel(); $objResto = new MasterRestaurantModel(); $objOrderDetail = new OrderDetailModel(); $objDish = new MasterDishModel(); global $db; $q = "SELECT o.datetime_order as dateOrder,o.datetime_order as timeOrder , resto.name, o.id_order, o.mr_fee, o.cc_fee, o.mr_fee+o.cc_fee as Total FROM {$objResto->table_name} resto INNER JOIN {$objOrder->table_name} o ON resto.id_restaurant = o.id_restaurant"; // $q = $q . " INNER JOIN {$objOrderDetail->table_name} orderdetail ON o.id_order = orderdetail.id_order "; // $q = $q . " INNER JOIN {$objDish->table_name} dish ON orderdetail.id_dish = dish.id_dish "; $q = $q . " WHERE " . $where; // pr($q); $arrQuery = $db->query($q, 2); // pr($arrQuery); // die(); // $data = json_encode($arrQuery); $data = $arrQuery; // pr($arrRestoIndex); ?> <div class="col-md-12"> <div class="col-sm-12"> <h1>Reporting Fee</h1> </div> <div id="formgroup_selected_restaurant" class="form-group"> <div class='col-sm-6'> <select id = "restoID_<?php echo $t; ?> " class="form-control"> <?php foreach ($arrRestoIndex as $key => $val) { if ($key == $_GET['id_restaurant']) { echo "<option selected='selected' value='" . $key . "'>" . $val . "</option>"; } else { echo "<option value='" . $key . "'>" . $val . "</option>"; } } ?> </select> </div> <div class='col-sm-6'> <select id = "type_order_<?php echo $t; ?> " class="form-control"> <?php foreach ($arrTypeOrder as $key => $val) { if ($key == $_GET['type_order']) { echo "<option selected='selected' value='" . $key . "'>" . $val . "</option>"; } else { echo "<option value='" . $key . "'>" . $val . "</option>"; } } ?> </select> </div> <div class="clearfix"></div> </div> <div id="formgroup_date" class="form-group"> <div class='col-sm-6'> <div class="form-group"> <div class='input-group date' id='datetimepickerFrom_<?php echo $t; ?> ' data-date-format="dd-mm-yyyy"> <input type='text' id= "dateVon_<?php echo $t; ?> "class="form-control" /> <span id = "cobaFrom" class="input-group-addon"> <span class="glyphicon glyphicon-calendar"></span> </span> </div> </div> </div> <div class='col-sm-6'> <div class="form-group"> <div class='input-group date' id='datetimepickerTo_<?php echo $t; ?> '> <input type='text' id= "dateBis_<?php echo $t; ?> " class="form-control" /> <span class="input-group-addon"> <span class="glyphicon glyphicon-calendar"></span> </span> </div> </div> </div> <div class="clearfix"></div> </div> <div id="formgroup_server" class="form-group"> <div class='col-sm-6'> <select id = "selectServer_<?php echo $t; ?> " class="form-control"> <?php foreach ($arrRestoUserIndex as $key => $val) { if ($key == $_GET['id_server']) { echo "<option selected='selected' value='" . $key . "'>" . $val . "</option>"; } else { echo "<option value='" . $key . "'>" . $val . "</option>"; } } ?> </select> </div> <div class='col-sm-6'> <select id = "status_payment_<?php echo $t; ?> " class="form-control"> <?php foreach ($arrStatusPaymentMethod as $key => $val) { if ($key == $_GET['status_payment']) { echo "<option selected='selected' value='" . $key . "'>" . $val . "</option>"; } else { echo "<option value='" . $key . "'>" . $val . "</option>"; } } ?> </select> </div> <div class="clearfix"></div> </div> <div id="formgroup_progress" class="form-group"> <div class='col-sm-6'> <select id = "status_progress_<?php echo $t; ?> " class="form-control"> <?php foreach ($arrStatusProgress as $key => $val) { if ($key == $_GET['status_progress']) { echo "<option selected='selected' value='" . $key . "'>" . $val . "</option>"; } else { echo "<option value='" . $key . "'>" . $val . "</option>"; } } ?> </select> </div> <div class="btn-group col-sm-4" role="group" aria-label="..."> <button type="button" class="btn btn-default" id="export_<?php echo $t; ?> ">Export</button> </div> <div class="clearfix"></div> </div> </div> <script type="text/javascript"> var dateFrom, dateTo; if (dateFrom == null) { var now = new Date(); var day = ("0" + now.getDate()).slice(-2); var month = ("0" + (now.getMonth() + 1)).slice(-2); var dateFrom = now.getFullYear() + "-" + (month) + "-" + (day); } if (dateTo == null) { var now = new Date(); var day = ("0" + now.getDate()).slice(-2); var month = ("0" + (now.getMonth() + 1)).slice(-2); var dateTo = now.getFullYear() + "-" + (month) + "-" + (day); } $('#restoID_<?php echo $t; ?> ').change(function () { var id_restaurant = $('#restoID_<?php echo $t; ?> ').val(); console.log("id_restaurant: " + id_restaurant); openLw("DiscountCC", "<?php echo _SPPATH; ?> Report/reportFee?id_server=0" + "&id_restaurant=" + id_restaurant + "&dateVon=" + dateFrom + "&dateBis=" + dateTo, "fade"); }); $('#type_order_<?php echo $t; ?> ').change(function () { var type_order = $('#type_order_<?php echo $t; ?> ').val(); console.log("type_order: " + type_order); var id_restaurant = $('#restoID_<?php echo $t; ?> ').val(); console.log("id_restaurant: " + id_restaurant); var server = $('#selectServer_<?php echo $t; ?> ').val(); console.log("server: " + server); var status_payment = $('#status_payment_<?php echo $t; ?> ').val(); var status_progress = $('#status_progress_<?php echo $t; ?> ').val(); openLw("DiscountCC", "<?php echo _SPPATH; ?> Report/reportFee?type_order=" + type_order + "&id_restaurant=" + id_restaurant + "&id_server=" + server + "&status_payment=" + status_payment + "&dateVon=" + dateFrom + "&dateBis=" + dateTo + "&status_progress=" + status_progress, "fade"); }); $('#selectServer_<?php echo $t; ?> ').change(function () { var type_order = $('#type_order_<?php echo $t; ?> ').val(); console.log("type_order: " + type_order); var id_restaurant = $('#restoID_<?php echo $t; ?> ').val(); console.log("id_restaurant: " + id_restaurant); var server = $('#selectServer_<?php echo $t; ?> ').val(); console.log("server: " + server); var status_payment = $('#status_payment_<?php echo $t; ?> ').val(); var status_progress = $('#status_progress_<?php echo $t; ?> ').val(); openLw("DiscountCC", "<?php echo _SPPATH; ?> Report/reportFee?type_order=" + type_order + "&id_restaurant=" + id_restaurant + "&id_server=" + server + "&status_payment=" + status_payment + "&dateVon=" + dateFrom + "&dateBis=" + dateTo + "&status_progress=" + status_progress, "fade"); }); $('#status_payment_<?php echo $t; ?> ').change(function () { var type_order = $('#type_order_<?php echo $t; ?> ').val(); console.log("type_order: " + type_order); var id_restaurant = $('#restoID_<?php echo $t; ?> ').val(); console.log("id_restaurant: " + id_restaurant); var server = $('#selectServer_<?php echo $t; ?> ').val(); console.log("server: " + server); var status_payment = $('#status_payment_<?php echo $t; ?> ').val(); var status_progress = $('#status_progress_<?php echo $t; ?> ').val(); openLw("DiscountCC", "<?php echo _SPPATH; ?> Report/reportFee?type_order=" + type_order + "&id_restaurant=" + id_restaurant + "&id_server=" + server + "&status_payment=" + status_payment + "&dateVon=" + dateFrom + "&dateBis=" + dateTo + "&status_progress=" + status_progress, "fade"); }); $('#status_progress_<?php echo $t; ?> ').change(function () { var type_order = $('#type_order_<?php echo $t; ?> ').val(); console.log("type_order: " + type_order); var id_restaurant = $('#restoID_<?php echo $t; ?> ').val(); console.log("id_restaurant: " + id_restaurant); var server = $('#selectServer_<?php echo $t; ?> ').val(); console.log("server: " + server); var status_payment = $('#status_payment_<?php echo $t; ?> ').val(); var status_progress = $('#status_progress_<?php echo $t; ?> ').val(); openLw("DiscountCC", "<?php echo _SPPATH; ?> Report/reportFee?type_order=" + type_order + "&id_restaurant=" + id_restaurant + "&id_server=" + server + "&status_payment=" + status_payment + "&dateVon=" + dateFrom + "&dateBis=" + dateTo + "&status_progress=" + status_progress, "fade"); }); var datetimepickerFrom = $('#datetimepickerFrom_<?php echo $t; ?> '); var datetimepickerTo = $('#datetimepickerTo_<?php echo $t; ?> '); $('#dateVon_<?php echo $t; ?> ').change(function () { var type_order = $('#type_order_<?php echo $t; ?> ').val(); console.log("type_order: " + type_order); var id_restaurant = $('#restoID_<?php echo $t; ?> ').val(); console.log("id_restaurant: " + id_restaurant); var server = $('#selectServer_<?php echo $t; ?> ').val(); console.log("server: " + server); var status_payment = $('#status_payment_<?php echo $t; ?> ').val(); var status_progress = $('#status_progress<?php echo $t; ?> ').val(); openLw("DiscountCC", "<?php echo _SPPATH; ?> Report/reportFee?type_order=" + type_order + "&id_restaurant=" + id_restaurant + "&id_server=" + server + "&status_payment=" + status_payment + "&dateVon=" + dateFrom + "&dateBis=" + dateTo + "&status_progress=" + status_progress, "fade"); }); $('#export_<?php echo $t; ?> ').click(function () { <?php $_SESSION["data"] = $data; ?> // initializes and invokes show immediately window.open('<?php echo _SPPATH; ?> Report/exportIt', "_blank "); }); // $(function () { datetimepickerFrom.datetimepicker({ format: 'DD/MM/YYYY', defaultDate: dateFrom //Im,portant! See issue #1075 }); datetimepickerTo.datetimepicker({ format: 'DD/MM/YYYY', defaultDate: dateTo }); datetimepickerFrom.on("dp.change", function (e) { datetimepickerTo.data("DateTimePicker").minDate(e.date); var type_order = $('#type_order_<?php echo $t; ?> ').val(); console.log("type_order: " + type_order); var id_restaurant = $('#restoID_<?php echo $t; ?> ').val(); console.log("id_restaurant: " + id_restaurant); var server = $('#selectServer_<?php echo $t; ?> ').val(); console.log("server: " + server); var status_payment = $('#status_payment_<?php echo $t; ?> ').val(); dateFrom = new Date(e.date); console.log(e); if (e.oldDate != null) { dateFrom = new Date(); dateFrom = moment().format('DD/MM/YYYY'); } if (e.oldDate != null) { var changed = false; if (e.date != e.oldDate) { changed = true; console.log("olddate: " + e.oldDate.format('Y-M-D')); console.log("Date: " + e.date.format('Y-M-D')); console.log("dateVon_: " + $('#dateVon_<?php echo $t; ?> ').val()); var type_order = $('#type_order_<?php echo $t; ?> ').val(); console.log("type_order: " + type_order); var id_restaurant = $('#restoID_<?php echo $t; ?> ').val(); console.log("id_restaurant: " + id_restaurant); var server = $('#selectServer_<?php echo $t; ?> ').val(); console.log("server: " + server); var status_payment = $('#status_payment_<?php echo $t; ?> ').val(); var tglFrom = e.date.format('Y-M-D'); dateFrom = e.date.format('Y-M-D'); $('#dateVon_<?php echo $t; ?> ').val(dateFrom); var status_progress = $('#status_progress_<?php echo $t; ?> ').val(); if (changed) { openLw("DiscountCC", "<?php echo _SPPATH; ?> Report/reportFee?type_order=" + type_order + "&id_restaurant=" + id_restaurant + "&id_server=" + server + "&status_payment=" + status_payment + "&dateVon=" + dateFrom + "&dateBis=" + dateTo, "fade"); changed = false; } } } }); datetimepickerTo.on("dp.change", function (e) { datetimepickerFrom.data("DateTimePicker").maxDate(e.date); if (e.oldDate != null) { var changed = false; if (e.date != e.oldDate) { changed = true; console.log("olddate: " + e.oldDate.format('Y-M-D')); console.log("Date: " + e.date.format('Y-M-D')); console.log("dateBis_: " + $('#dateBis_<?php echo $t; ?> ').val()); var type_order = $('#type_order_<?php echo $t; ?> ').val(); console.log("type_order: " + type_order); var id_restaurant = $('#restoID_<?php echo $t; ?> ').val(); console.log("id_restaurant: " + id_restaurant); var server = $('#selectServer_<?php echo $t; ?> ').val(); console.log("server: " + server); var status_payment = $('#status_payment_<?php echo $t; ?> ').val(); var tglFrom = e.date.format('Y-M-D'); dateTo = e.date.format('Y-M-D'); var status_progress = $('#status_progress_<?php echo $t; ?> ').val(); $('#dateBis_<?php echo $t; ?> ').val(dateTo); if (changed) { openLw("DiscountCC", "<?php echo _SPPATH; ?> Report/reportFee?type_order=" + type_order + "&id_restaurant=" + id_restaurant + "&id_server=" + server + "&status_payment=" + status_payment + "&dateVon=" + dateFrom + "&dateBis=" + dateTo, "fade"); changed = false; } } } }); }); // $("[name='status_progress_<?php echo $t; ?> ']").bootstrapSwitch('state', true, true); </script> <div class="col-md-12"> <div class="table-responsive"> <table id = "table_report_<?php echo $t; ?> " class="table table-bordered table-striped table-hover crud-table" style="background-color: white;"> <tbody><tr> <th id="h_id_date_<?php echo $t; ?> ">Date</th> <th id="h_id_time_<?php echo $t; ?> ">Time</th> <th id="h_id_restaurant_<?php echo $t; ?> ">Restaurant</th> <th id="h_id_order_<?php echo $t; ?> ">Order No.</th> <th id="h_total_<?php echo $t; ?> ">MR Fee</th> <th id="h_disc_<?php echo $t; ?> ">Credit Card Fee</th> <th id="h_charges_<?php echo $t; ?> ">Total Fee</th> </tr> <?php foreach ($arrQuery as $key => $val) { ?> <tr id="report_<?php echo $t; ?> "> <?php $date = new DateTime($val->datetime_order); ?> <td id="id_date_<?php echo $t . "_" . $val->id_order; ?> "> <?php echo $date->format('d.m.Y'); ?> </td> <td id="id_time_<?php echo $t . "_" . $val->id_order; ?> "> <?php echo $date->format('H:i:s'); ?> </td> <td id="id_restaurant_<?php echo $t . "_" . $val->id_order; ?> "> <?php echo $val->name; ?> </td> <td id="id_order_<?php echo $t . "_" . $val->id_order; ?> "><?php echo $val->id_order; ?> </td> <td id="total_<?php echo $t . "_" . $val->id_order; ?> "><?php echo Generic::formatRupiah($val->mr_fee); ?> </td> <td id="disc_<?php echo $t . "_" . $val->id_order; ?> "><?php echo Generic::formatRupiah($val->cc_fee); ?> </td> <td id="charges_<?php echo $t . "_" . $val->id_order; ?> "><?php echo Generic::formatRupiah($val->Total); ?> </td> </tr> <script> $('#id_order_<?php echo $t . "_" . $val->id_order; ?> ').click(function () { openLw("order_detail", "<?php echo _SPPATH; ?> Report/viewOrderDetail?id_order=" + <?php echo $val->id_order; ?> , "fade"); }); </script> <?php } ?> </tbody> </table> </div> </div> <?php }
function formCreatedQR() { ?> <form class="form_crud" role="form" method="POST" action="<?php echo _SPPATH . "QR/createQRbyRestoID"; ?> "> <div class="form-group"> <label for="quantityQR" class="col-sm-2 control-label">ID-Restaurant</label> <div class="col-sm-10"> <?php $objResto = new MasterRestaurantModel(); $arrResto = $objResto->getAll(); foreach ($arrResto as $resto) { $arrRestoID[] = $resto->id_restaurant; $arrRestoName[] = $resto->name; } $t = time(); ?> <select id="selectresto_<?php echo $t; ?> " name ='id_restaurant' class="form-control"> <?php foreach ($arrRestoID as $n => $name) { ?> <option value="<?php echo $arrRestoID[$n]; ?> "><?php echo $arrRestoName[$n]; ?> </option> <?php } ?> </select> </div> <label for="quantityQR" class="col-sm-2 control-label">Quantity</label> <div class="col-sm-10"> <input type="text" class="form-control" id="quantityQR" name = "quantityQR" placeholder="Quantity" required> </div> </div> <div class="form-group"> <div class="col-sm-offset-2 col-sm-1"> <button type="submit" class="btn btn-default">Submit</button> </div> </div> </form> <?php }
public function updateRestoMRDiscount() { $idsResto = Generic::mustCheck($_POST['id_restaurant'], "No Restaurant IDs Found"); $disc = Generic::mustCheck($_POST['discount'], "No Discount Found"); if (!is_numeric($disc)) { Generic::errorMsg("Discount Must Numbers"); } if (strlen(trim($disc)) > 2) { Generic::errorMsg("Discount Max 2 Digits"); } $ids = explode(',', $idsResto); if (count($ids) <= 0) { Generic::errorMsg("Empty Id"); } $updateAll = in_array('0', $ids); if ($updateAll) { $r = new MasterRestaurantModel(); $arrR = $r->getAll(); foreach ($arrR as $singleR) { unset($resto); $resto = new MasterRestaurantModel(); $resto->getByID($singleR->id_restaurant); unset($logdisc); $logdisc = new LogDiscFeeModel(); $logdisc->id_reference = $resto->id_restaurant; $logdisc->change_type = "Discount MR"; $logdisc->change_from = Generic::IsNullOrEmptyString($resto->disc_mr) ? "0" : $resto->disc_mr; $logdisc->change_to = $disc; $logdisc->change_date_time = leap_mysqldate(); $logdisc->save(); $resto->disc_mr = $disc; $resto->save(); } } else { foreach ($ids as $id) { unset($resto); $resto = new MasterRestaurantModel(); $resto->getByID($id); unset($logdisc); $logdisc = new LogDiscFeeModel(); $logdisc->id_reference = $resto->id_restaurant; $logdisc->change_type = "Discount MR"; $logdisc->change_from = Generic::IsNullOrEmptyString($resto->disc_mr) ? "0" : $resto->disc_mr; $logdisc->change_to = $disc; $logdisc->change_date_time = leap_mysqldate(); $logdisc->save(); $resto->disc_mr = $disc; $resto->save(); } } $json['status_code'] = 1; $json['status_message'] = "success"; echo json_encode($json); die; }
public function clearRestoCats() { $catIdDefault = $this->createCategories("OTHERS"); $rm = new MasterRestaurantModel(); $arrResto = $rm->getAll(); foreach ($arrResto as $r) { $resto = new MasterRestaurantModel(); $resto->getByID($r->id_restaurant); $resto->id_categories = $catIdDefault; $resto->save(); } }
function transaction_dineIn() { $bulan = isset($_GET['m']) ? addslashes($_GET['m']) : $days_now; $id_restaurant = isset($_GET['id_restaurant']) ? addslashes($_GET['id_restaurant']) : "1"; if ($bulan == "") { $bulan = date("F Y"); $days_ago = date('Y-m-01'); // hard-coded '01' for first day $days_now = date('Y-m-t'); } else { $bulan = urldecode($bulan); $days_ago = date('Y-m-01', strtotime($bulan)); // hard-coded '01' for first day $days_now = date('Y-m-t', strtotime($bulan)); } $numberDays = cal_days_in_month(CAL_GREGORIAN, date('n', strtotime($bulan)), date('Y', strtotime($bulan))); $days_ago = date('Y-m-01', strtotime($bulan)); // hard-coded '01' for first day $days_now = date('Y-m-01', strtotime('+1 month', strtotime($bulan))); $t = time(); $arrStatusPaymentMethod[1] = "Cash"; $arrStatusPaymentMethod[2] = "Credit Card"; $arrStatusPaymentMethod[3] = "Others"; $arrStatusPaymentMethod[0] = "All Payment Method"; $arrStatusProgress[4] = "Done"; $arrStatusProgress[9] = "Void"; $t = time(); $where = " "; if ($id_restaurant == 0) { $where = $where; } else { $allResto = false; $where = $where . " o.id_restaurant='{$id_restaurant}' AND "; } $whereDate = " (o.datetime_order >='{$days_ago}' AND o.datetime_order < '{$days_now}') "; $whereAllDineIn = $where . " (o.type_order='0' OR o.type_order='1') AND " . $whereDate; $whereAllDineIn_Apps = $where . " (o.type_order='1' ) AND " . $whereDate; $whereAllDineIn_Manu = $where . " (o.type_order='0' ) AND " . $whereDate; $objOrder = new MasterOrderModel(); $objResto = new MasterRestaurantModel(); $objOrderDetail = new OrderDetailModel(); $objDish = new MasterDishModel(); global $db; global $db; $qAllSum = "SELECT DATE(o.datetime_order) as date, SUM(o.grand_total) as total_sales FROM {$objOrder->table_name} o "; $qAllSum = $qAllSum . " WHERE " . $whereAllDineIn . " GROUP BY DATE(o.datetime_order) "; $arrQueryAllSums = $db->query($qAllSum, 2); $qAllSumTotalDineIn = "SELECT * FROM {$objOrder->table_name} o "; $qAllSumTotalDineIn = $qAllSumTotalDineIn . " WHERE " . $whereAllDineIn; $arrQueryAllSumsTotalDineIn = $db->query($qAllSumTotalDineIn, 2); $qAllSumTotalDineInApps = "SELECT * FROM {$objOrder->table_name} o "; $qAllSumTotalDineInApps = $qAllSumTotalDineInApps . " WHERE " . $whereAllDineIn_Apps; $arrQueryAllSumsTotalDineInApps = $db->query($qAllSumTotalDineInApps, 2); // pr($qAllSumTotalTakeAwayApps); $qAllSumTotalDineInManual = "SELECT * FROM {$objOrder->table_name} o "; $qAllSumTotalDineInManual = $qAllSumTotalDineInManual . " WHERE " . $whereAllDineIn_Manu; $arrQueryAllSumsTotalDineManual = $db->query($qAllSumTotalDineInManual, 2); $qAllLastTransaction = "SELECT * FROM {$objOrder->table_name} o "; $qAllLastTransaction = $qAllLastTransaction . " WHERE " . $whereAllDineIn . " ORDER BY o.datetime_order DESC "; $arrQueryLastTransaction = $db->query($qAllLastTransaction, 2); $qTopDish = "SELECT Distinct d.name FROM `menurevo__ms_order` o Inner Join menurevo__order_detail od ON o.id_order = od.id_order Inner JOIN menurevo__ms_dish d on d.id_dish = od.id_dish WHERE "; $qTopDish = $qTopDish . " o.id_restaurant = " . $id_restaurant . " AND (o.type_order='0' OR o.type_order='0') AND " . $whereDate . " Order By od.quantity DESC"; $arrQueryTopDish = $db->query($qTopDish, 2); ?> <div class="row"> <div class="col-md-12"> <h1> Transaction Dashboard <small><?php echo $bulan; ?> </small> </h1> <ol class="breadcrumb"> <li> <?php echo Lang::t('Restaurant'); ?> </li> <li class="active"> <?php $objResto = new MasterRestaurantModel(); $arrResto = $objResto->getAll(); foreach ($arrResto as $resto) { if ($resto->name != "") { $arrRestoIndex[$resto->id_restaurant] = $resto->name; } } ?> <select id = "restoID_<?php echo $t; ?> " > <?php foreach ($arrRestoIndex as $key => $val) { if ($key == $id_restaurant) { echo "<option selected='selected' value='" . $key . "'>" . $val . "</option>"; } else { echo "<option value='" . $key . "'>" . $val . "</option>"; } } ?> </select> <script> $("#restoID_<?php echo $t; ?> ").change(function () { var slc = $("#restoID_<?php echo $t; ?> ").val(); var m = $("#apptimeselector_<?php echo $t; ?> ").val(); openLw("Transaction", "<?php echo _SPPATH; ?> BIWebTransaction/transaction_dineIn?id_restaurant=" + slc + "&m=" + m, "fade"); }); </script> </li> <li> <?php echo Lang::t('Select Timeframe'); ?> </li> <li class="active"> <?php $start = new DateTime('11 months ago'); // So you don't skip February if today is day the 29th, 30th, or 31st $start->modify('first day of this month'); $end = new DateTime(); $interval = new DateInterval('P1M'); $period = new DatePeriod($start, $interval, $end); ?> <select id="apptimeselector_<?php echo $t; ?> "> <?php foreach ($period as $dt) { ?> <option value="<?php echo urlencode($dt->format('F Y')); ?> " <?php if ($dt->format('F Y') == $bulan) { echo "selected"; } ?> > <?php echo $dt->format('F Y') . "<br>"; ?> </option> <?php } ?> </select> <script> $("#apptimeselector_<?php echo $t; ?> ").change(function () { var slc = $("#restoID_<?php echo $t; ?> ").val(); var m = $("#apptimeselector_<?php echo $t; ?> ").val(); openLw("Transaction", "<?php echo _SPPATH; ?> BIWebTransaction/transaction_dineIn?id_restaurant=" + slc + "&m=" + m, "fade"); }); </script> </li> </ol> </div> </div> <div class="row"> <div class="col-md-4"> <div class="small-box bg-aqua"> <div class="inner"> <h3><small style="color: white;font-weight: bold;"><?php echo count($arrQueryAllSumsTotalDineInApps); ?> </small></h3> <p>Total Dine In Apps</p> </div> <div class="icon"> <i class="ion ion-bag"></i> </div> <!-- <a href="#" class="small-box-footer">More info <i class="fa fa-arrow-circle-right"></i></a>--> </div> </div> <div class="col-md-4"> <div class="small-box bg-green"> <div class="inner"> <h3><small style="color: white;font-weight: bold;"><?php echo count($arrQueryAllSumsTotalDineManual); ?> </small></h3> <p>Total Dine In Manual</p> </div> <div class="icon"> <i class="ion ion-stats-bars"></i> </div> <!-- <a href="#" class="small-box-footer">More info <i class="fa fa-arrow-circle-right"></i></a>--> </div> </div> <div class="col-md-4"> <div class="small-box bg-yellow"> <div class="inner"> <h3><?php echo count($arrQueryAllSumsTotalDineIn); ?> </h3> <p>Total of Transactions</p> </div> <div class="icon"> <i class="ion ion-stats-bars"></i> </div> <!-- <a href="#" class="small-box-footer">More info <i class="fa fa-arrow-circle-right"></i></a>--> </div> </div> </div> <div class="row"> <div class="col-md-12"> <div class="box box-default"> <div class="box-header with-border"> <h3 class="box-title">All Transaction (Apps and Manual)</h3> <div class="box-tools pull-right"> <button type="button" class="btn btn-box-tool" data-widget="collapse"><i class="fa fa-minus"></i> </button> <button type="button" class="btn btn-box-tool" data-widget="remove"><i class="fa fa-times"></i></button> </div> </div> <div class="box-body chart-responsive"> <?php $data = self::getAppStats($arrQueryAllSums, $days_ago, $days_now); ?> </div> <!-- /.box-body --> </div> </div> </div> <div class="row"> <div class="col-md-7"> <div class="box box-info"> <div class="box-header with-border"> <h3 class="box-title">Latest Transactions</h3> <div class="box-tools pull-right"> <button type="button" class="btn btn-box-tool" data-widget="collapse"><i class="fa fa-minus"></i> </button> <button type="button" class="btn btn-box-tool" data-widget="remove"><i class="fa fa-times"></i></button> </div> </div> <!-- /.box-header --> <div class="box-body"> <div class="table-responsive"> <table class="table no-margin"> <thead> <tr> <th>ID Order</th> <th>Table</th> <th>Type Order</th> <th>Status</th> <th>Grand Total</th> </tr> </thead> <tbody> <?php foreach ($arrQueryLastTransaction as $id => $tt) { if ($id >= '9') { exit; } ?> <tr> <td><?php echo $tt->id_order; ?> </td> <td><?php echo $tt->id_table; ?> </td> <td><?php if ($tt->type_order == '0') { echo "Dine In - Manual"; } elseif ($tt->type_order == '1') { echo "Dine In - Apps"; } elseif ($tt->type_order == '2') { echo "Take Away - Manual"; } elseif ($tt->type_order == '3') { echo "Take Away - Apps"; } ?> </td> <td><?php if ($tt->status == '0') { echo "Wait"; } else { if ($tt->status == '1') { echo "Cook"; } else { if ($tt->status == '2') { echo "Done"; } else { if ($tt->status == '3') { echo "Kitchen Done"; } else { if ($tt->status == '4') { echo "Paid"; } else { if ($tt->status == '9') { echo "Void"; } } } } } } $tt->status; ?> </td> <td><?php echo idr($tt->grand_total); ?> </td> </tr> <?php } ?> </tbody> </table> </div> <!-- /.table-responsive --> </div> <!-- /.box-body --> <div class="box-footer clearfix"> <!-- <a href="javascript:openLw('Transaction_Detail', '<?php echo _SPPATH; ?> LLAccWeb/LL_TransactionDetail', 'fade'); activkanMenuKiri('Transaction_Detail');" class="btn btn-sm btn-default btn-flat pull-right">View All Transactions</a>--> </div> <!-- /.box-footer --> </div> </div> <div class="col-md-5"> <div class="box box-success"> <div class="box-header with-border"> <h3 class="box-title">Top Dishes</h3> </div> <!-- /.box-header --> <div class="box-body"> <div class="table-responsive"> <table class="table no-margin"> <thead> <tr> <th>ID</th> <!-- <th>Picture</th>--> <th>Name</th> </tr> </thead> <tbody> <?php foreach ($arrQueryTopDish as $varid => $saledata) { if ($varid >= '9') { exit; } ?> <tr> <td><?php echo $varid + 1; ?> </td> <td><?php echo $saledata->name; ?> </td> </tr> <?php } ?> </tbody> </table> </div> <!-- /.table-responsive --> </div> <!-- /.box-body--> <div class="box-footer clearfix"> <!-- <a href="javascript::;" class="btn btn-sm btn-info btn-flat pull-left">Place New Order</a>--> <!-- <a href="javascript:openLw('LL_Article', '<?php echo _SPPATH; ?> LLProdWeb/LL_Article_WImage', 'fade'); activkanMenuKiri('LL_Article');" class="btn btn-sm btn-default btn-flat pull-right">View All Articles</a>--> </div> <!-- /.box-footer --> </div> </div> </div> <style> ul.legend li{ list-style: none; line-height: 30px; } ul.legend li div{ float: left; margin-top: 10px; margin-right: 15px; } .legend-item{ float: left; margin: 10px; line-height: 30px; margin-right: 5px; } .legend-item div{ float: left; margin-top: 10px; margin-right: 5px; } .breadcrumb { padding: 8px 15px; margin-bottom: 20px; list-style: none; background-color: #f5f5f5; border-radius: 4px; } .breadcrumb { float: right; background: transparent; margin-top: 0; margin-bottom: 0; font-size: 12px; padding: 7px 5px; position: absolute; top: 15px; right: 10px; border-radius: 2px; } .users-list-name{ white-space: nowrap; } </style> <?php }