Pull from master

This commit is contained in:
San Wai Lwin
2018-06-12 14:10:15 +06:30
15 changed files with 155 additions and 53 deletions

View File

@@ -81,7 +81,7 @@
<% @response["data"].each do |transaction| %>
<tr>
<td><%= transaction["date"]%></td>
<% if transaction["status"] == 'Rebate' || transaction["status"] == 'Discount'%>
<% if transaction["status"] == 'Rebate' || transaction["status"] == 'Discount' || transaction["status"] == 'Reversal'%>
<td><%= transaction["deposit"] %></td>
<% else %>
<td>(<%= transaction["withdraw"] %>)</td>
@@ -95,7 +95,11 @@
<tr style="border-top:2px solid #666;">
<th>Balance</th>
<th colspan="4">
<%= @response["data"].first["balance"] %>
<% if @response["data"].first["status"] == 'Reversal'%>
<%= @response["data"].first["balance"] + @response["data"][1]["balance"]%>
<%else%>
<%= @response["data"].first["balance"] %>
<%end%>
</th>
</tr>
<%end%>

View File

@@ -205,7 +205,8 @@ $('#junction_pay').on('click',function(){
var com_port = '/dev/' + $("#com_port_name").val();
var is_rebate=false;
//alert(cashier_id + amount + com_port);
code2lab.reqJunctionPay(true, cashier_id, parseFloat(amount), receipt_no, com_port);
code2lab.reqJunctionPay(true, cashier_id, parseFloat(amount), receipt_no, com_port);
resJunctionPayUpdate = function(totalBillAmount , finalBillAmt,giftCardAmount, voucherAmount,voucherNumber,receiptNumber){
$("#loading_wrapper").hide();
@@ -241,10 +242,25 @@ $('#junction_pay').on('click',function(){
};
resJunctionPay = function(memberno,transactionNo,finalBillingAmt){
if(memberno != ''){ is_rebate = true; }
if(memberno != ''){ is_rebate = true; }
};
resError = function(err_message){
if(err_message != "ERROR: Verification cancelled"){
$("#loading_wrapper").hide();
swal({
title: "Oops!",
text: err_message,
type: "error",
html: true,
closeOnConfirm: false,
closeOnCancel: false,
allowOutsideClick: false
}, function () {
window.location.href = '/origami/sale/'+ sale_id +"/"+cashier_type+"/payment/others_payment";
});
}
};
// $("#loading_wrapper").hide();
// $.ajax({type: "POST",
// url: "/origami/payment/"+payment_type,

View File

@@ -79,13 +79,20 @@
<td width ="20%" class="align-center">
<%= order.created_at.utc.getlocal.strftime("%Y-%m-%d") %>
</td>
<td width ="20%" class="align-center">
<%= order.created_at.utc.getlocal.strftime("%I:%M %p") %>
<td width ="15%" class="align-center">
<%= order.created_at.utc.getlocal.strftime("%I:%M %p") %>
</td>
<td width ="20%" class="align-center">
<%=order.grand_total%>
</td>
<td width ="30%" class="align-center">
<td width ="20%" class="align-center col-blue">
<% if order.payment_type == 'cash_on_delivery' %>
COD
<% elsif order.payment_type == 'dinga' %>
DINGA
<% end %>
</td>
<td width ="20%" class="align-center">
<span class="font-10 col-blue">
<% if order.delivery.delivery_type == 'service' %>
DELIVERY
@@ -122,13 +129,20 @@
<td width ="20%" class="align-center">
<%= order.created_at.utc.getlocal.strftime("%Y-%m-%d") %>
</td>
<td width ="20%" class="align-center">
<%= order.created_at.utc.getlocal.strftime("%I:%M %p") %>
<td width ="15%" class="align-center">
<%= order.created_at.utc.getlocal.strftime("%I:%M %p") %>
</td>
<td width ="20%" class="align-center">
<%=order.grand_total%>
<%=order.grand_total%>
</td>
<td width ="30%" class="align-center">
<td width ="20%" class="align-center col-blue">
<% if order.payment_type == 'cash_on_delivery' %>
COD
<% elsif order.payment_type == 'dinga' %>
DINGA
<% end %>
</td>
<td width ="20%" class="align-center">
<span class="font-10 col-blue">
<% if order.delivery.delivery_type == 'service' %>
DELIVERY
@@ -164,13 +178,20 @@
<td width ="20%" class="align-center">
<%= order.created_at.utc.getlocal.strftime("%Y-%m-%d") %>
</td>
<td width ="20%" class="align-center">
<%= order.created_at.utc.getlocal.strftime("%I:%M %p") %>
<td width ="15%" class="align-center">
<%= order.created_at.utc.getlocal.strftime("%I:%M %p") %>
</td>
<td width ="20%" class="align-center">
<%=order.grand_total%>
</td>
<td width ="30%" class="align-center">
<td width ="20%" class="align-center col-blue">
<% if order.payment_type == 'cash_on_delivery' %>
COD
<% elsif order.payment_type == 'dinga' %>
DINGA
<% end %>
</td>
<td width ="20%" class="align-center">
<span class="font-10 col-blue">
<% if order.delivery.delivery_type == 'service' %>
DELIVERY
@@ -206,13 +227,20 @@
<td width ="20%" class="align-center">
<%= order.created_at.utc.getlocal.strftime("%Y-%m-%d") %>
</td>
<td width ="20%" class="align-center">
<%= order.created_at.utc.getlocal.strftime("%I:%M %p") %>
<td width ="15%" class="align-center">
<%= order.created_at.utc.getlocal.strftime("%I:%M %p") %>
</td>
<td width ="20%" class="align-center">
<%=order.grand_total%>
</td>
<td width ="30%" class="align-center">
<td width ="20%" class="align-center col-blue">
<% if order.payment_type == 'cash_on_delivery' %>
COD
<% elsif order.payment_type == 'dinga' %>
DINGA
<% end %>
</td>
<td width ="20%" class="align-center">
<span class="font-10 col-blue">
<% if order.delivery.delivery_type == 'service' %>
DELIVERY
@@ -248,13 +276,20 @@
<td width ="20%" class="align-center">
<%= order.created_at.utc.getlocal.strftime("%Y-%m-%d") %>
</td>
<td width ="20%" class="align-center">
<%= order.created_at.utc.getlocal.strftime("%I:%M %p") %>
<td width="15%" class="align-center">
<%= order.created_at.utc.getlocal.strftime("%I:%M %p") %>
</td>
<td width ="20%" class="align-center">
<%=order.grand_total%>
</td>
<td width ="30%" class="align-center">
<td width ="10%" class="align-center col-blue">
<% if order.payment_type == 'cash_on_delivery' %>
COD
<% elsif order.payment_type == 'dinga' %>
DINGA
<% end %>
</td>
<td width ="20%" class="align-center">
<span class="font-10 col-blue">
<% if order.delivery.delivery_type == 'service' %>
DELIVERY
@@ -353,7 +388,7 @@
<tbody>
<tr>
<td width ="70%" class="footer-td align-left col-blue">
GRAND TOTAL
GRAND TOTAL
</td>
<td width ="30%" class="footer-td align-right col-blue" id="grand_total">0.00</td>
</tr>
@@ -398,10 +433,14 @@
<table class="table tbl_customer">
<tbody>
<tr>
<td colspan="2" class="body-td align-left">
<td class="body-td align-left">
<span class="font-13">REF.</span><br>
<b id="trans_ref"></b>
</td>
<td class="body-td align-right order_payment_type">
<span class="font-13">PAYMENT</span><br>
<b id="payment_type"></b>
</td>
</tr>
<tr>
<td class="body-td align-left">

View File

@@ -626,6 +626,10 @@
</div>
<script type="text/javascript">
// //control borwser back
window.location.hash="no-back-button";
window.location.hash="Again-No-back-button";//again because google chrome don't insert first hash into history
window.onhashchange=function(){window.location.hash="";}
var cashier_type = "<%= @cashier_type %>";
var customer_id = "<%= @customer.id %>";
var customer_name = "<%= @customer.name %>";

View File

@@ -169,13 +169,16 @@
<!-- Column Three -->
<div class="col-lg-2 col-md-2 col-sm-2">
<button type="button" class="btn btn-default btn-block" id='back'><i class="material-icons">reply</i>Back</button>
<button type="button" id="reprint" class="btn bg-blue btn-block">Reprint</button>
<% if current_user.role != "waiter" %>
<% if @sale.sale_status != 'void' && @sale.sale_status != 'waste' && @sale.sale_status != 'spoile' %>
<% if current_user.role == "cashier" %>
<a class="btn btn-block bg-red waves-effect access_modal" data-toggle="modal" data-type="void"> Void</a>
<a class="btn btn-block bg-blue waves-effect access_modal" data-toggle="modal" data-type="reprints"> Re.Print</a>
<% else %>
<button type="button" class="btn bg-red btn-block" data-toggle="modal" data-target="#voidModal" <%= (can? :overall_void, :void)? ' ': 'disabled=' %> > Void </button>
<button type="button" id="reprint" class="btn bg-blue btn-block">Reprint</button>
<% end %>
<% end %>
<button id="close_cashier" type="button" class="btn btn-block btn-lg bg-blue waves-effect"> <%= t("views.btn.close_cashier") %></button>
@@ -340,9 +343,12 @@ function check_emp_access_code(access_code,type) {
// console.log(result);
if (result.status == true) {
createAccessCode(code);
$('#AccessCodeModal').modal('hide');
if(type == "void"){
$('#AccessCodeModal').modal('hide');
$('#voidModal').modal('show');
}else if(type=='reprint'){
var sale_id = $('#sale_id').val();
window.location.href = '/origami/'+ sale_id + "/reprint"
}
}else{
swal("Opps",result.message,"warning")

View File

@@ -240,7 +240,7 @@ var access_code = localStorage.getItem("access_code");
$.ajax({
type: "POST",
url: ajax_url,
data: 'sale_item_id=' + sale_item_id + "&update_qty=" + qty + "&update_price=" + price+ "&access_code=" + access_code,
data: 'sale_item_id=' + sale_item_id + "&update_qty=" + qty + "&update_price=" + price+ "&access_code=" + access_code + "&type=" + cashier_type,
success: function (result) {
swal({
title: "Information!",
@@ -294,7 +294,7 @@ var access_code = localStorage.getItem("access_code");
$.ajax({
type: "POST",
url: ajax_url,
data: 'sale_item_id=' + sale_item_id + "&remark=" + remark+ "&access_code=" + access_code,
data: 'sale_item_id=' + sale_item_id + "&remark=" + remark+ "&access_code=" + access_code + "&type=" + cashier_type,
success: function (result) {
location.reload();
}
@@ -307,7 +307,7 @@ var access_code = localStorage.getItem("access_code");
$.ajax({
type: "POST",
url: ajax_url,
data: 'sale_item_id=' + sale_item_id + '&access_code=' + access_code,
data: 'sale_item_id=' + sale_item_id + '&access_code=' + access_code + "&type=" + cashier_type,
success: function (result) {
location.reload();
}

View File

@@ -216,12 +216,14 @@
<button type="button" class="btn btn-default btn-block" id='back'><i class="material-icons">reply</i>Back</button>
<% if @sale.sale_status != 'void' && @sale.sale_status != 'waste' && @sale.sale_status != 'spoile' %>
<% if current_login_employee.role == "cashier" %>
<a class="btn btn-block bg-red waves-effect access_modal" data-toggle="modal" data-type="void"> Void</a>
<a class="btn btn-block bg-danger waves-effect access_modal" data-toggle="modal" data-type="void"> Void</a>
<a class="btn btn-block bg-red waves-effect access_modal" data-toggle="modal" data-type="reprint"> Re.Print</a>
<% else %>
<button type="button" id="void" class="btn bg-danger btn-block">VOID</button>
<button type="button" id="void" class="btn bg-danger btn-block">VOID</button>
<button type="button" id="re-print" class="btn bg-blue btn-block">Re.Print</button>
<% end %>
<% end %>
<button type="button" id="re-print" class="btn bg-blue btn-block">Re.Print</button>
</div>
</div>
@@ -258,7 +260,7 @@
<button type="button" class="close" id="close" data-dismiss="modal" aria-hidden="true" style="font-size: 20px;color:#111;">&times;</button>
</div>
<div class="modal-body" style="padding: 0px 25px 15px 25px !important">
<input type="text" id="access_code" class="access_code form-control col-md-12 ">
<input type="password" id="access_code" class="access_code form-control col-md-12 ">
<div class="row bottom p-l-15 p-r-15 m-t-10">
<div class="col-md-3 access_number border-top border-left" data-value="1" data-type="num">1</div>
<div class="col-md-3 access_number border-top border-left" data-value="2" data-type="num">2</div>
@@ -406,10 +408,14 @@ $(document).on('click', '.access_modal', function(event){
// $('#AccessCodeModal').modal('hide');
// $('#focModal').modal('show');
waste_and_spoilage("waste")
}else if(type == "spoile") {
}else if(type == "waste") {
// $('#AccessCodeModal').modal('hide');
// $('#voidModal').modal('show');
waste_and_spoilage("spoile")
// $('#focModal').modal('show');
waste_and_spoilage("waste")
}else if(type == "reprint") {
$('#AccessCodeModal').modal('hide');
var sale_id = $('#sale_id').val();
window.location.href = '/origami/'+ sale_id + "/reprint"
}else if(type == "foc"){
$('#AccessCodeModal').modal('hide');
$('#focModal').modal('show');

View File

@@ -19,7 +19,7 @@
<div class="row clearfix">
<div class="col-lg-2 col-md-2 col-sm-2 col-xs-2">
<label><%= t("views.right_panel.detail.enter_keyboards") %></label>
<input type="text" id="filter" name="filter" class="form-control" placeholder="Status" style="margin-right: 10px;height: 34px;">
<input type="text" id="filter" name="filter" class="form-control" placeholder="Status/Payment Type" style="margin-right: 10px;height: 34px;">
</div>
<div class="col-lg-2 col-md-2 col-sm-2">

View File

@@ -48,6 +48,7 @@
<th><%= t("views.right_panel.detail.requested_time") %></th>
<th><%= t("views.right_panel.detail.cooking_time") %></th>
<th><%= t("views.right_panel.detail.status") %></th>
<th><%= t :payment %> <%= t("views.right_panel.detail.type") %></th>
<th><%= t("views.right_panel.detail.remark") %></th>
</tr>
</thead>
@@ -58,6 +59,7 @@
<td><%= @order_reservation.requested_time.utc.getlocal.strftime("%Y-%m-%d %I:%M %p") %></td>
<td><%= @order_reservation.expected_waiting_time rescue '-' %></td>
<td><%= @order_reservation.status %></td>
<td><%= @order_reservation.payment_type %></td>
<td><%= @order_reservation.order_remark ? @order_reservation.order_remark : @order_reservation.reservation_remark %></td>
</tr>
<tr style="border-top:2px solid #000">
@@ -67,6 +69,7 @@
<th><%= t("views.right_panel.detail.total_price") %></th>
<th><%= t("views.right_panel.detail.created_at") %></th>
<th></th>
<th></th>
</tr>
<% @order_reservation.order_reservation_items.each do |item| %>
<tr>
@@ -76,6 +79,7 @@
<td><%= number_with_precision(item.price > 0 ? item.qty * item.price : item.qty * item.unit_price, precision:precision.to_i, delimiter:delimiter) rescue ' '%></td>
<td><%=l item.created_at.utc.getlocal , :format => :short rescue ' ' %></td>
<td></td>
<td></td>
</tr>
<% end %>
<%
@@ -123,27 +127,27 @@
<tr style="border-top:2px solid #000">
<td colspan=2 style="text-align:center"></td>
<td><%= t("views.right_panel.detail.sub_total") %></td>
<td colspan="3"><%= number_with_precision(total_amount, precision:precision.to_i, delimiter:delimiter) rescue ' '%></td>
<td colspan="4"><%= number_with_precision(total_amount, precision:precision.to_i, delimiter:delimiter) rescue ' '%></td>
</tr>
<% if total_discount_amount > 0 %>
<tr style="border-top:2px solid #000">
<td colspan=2 style="text-align:center"></td>
<td><%= t("views.right_panel.detail.discount_amount") %></td>
<td colspan="3"><%= number_with_precision(total_discount_amount, precision:precision.to_i, delimiter:delimiter) rescue ' '%></td>
<td colspan="4"><%= number_with_precision(total_discount_amount, precision:precision.to_i, delimiter:delimiter) rescue ' '%></td>
</tr>
<% end %>
<% if total_delivery_fee > 0 %>
<tr style="border-top:2px solid #000">
<td colspan=2 style="text-align:center"></td>
<td><%= t("views.right_panel.detail.delivery_fee") %></td>
<td colspan="3"><%= number_with_precision(total_delivery_fee, precision:precision.to_i, delimiter:delimiter) rescue ' '%></td>
<td colspan="4"><%= number_with_precision(total_delivery_fee, precision:precision.to_i, delimiter:delimiter) rescue ' '%></td>
</tr>
<% end %>
<% if total_convenience_charge > 0 %>
<tr style="border-top:2px solid #000">
<td colspan=2 style="text-align:center"></td>
<td><%= t("views.right_panel.detail.convenience_charge") %></td>
<td colspan="3"><%= number_with_precision(total_convenience_charge, precision:precision.to_i, delimiter:delimiter) rescue ' '%></td>
<td colspan="4"><%= number_with_precision(total_convenience_charge, precision:precision.to_i, delimiter:delimiter) rescue ' '%></td>
</tr>
<% end %>
<!-- <% if total_delivery_tax > 0 %>
@@ -171,14 +175,14 @@
<tr style="border-top:2px solid #000">
<td colspan=2 style="text-align:center"></td>
<td><%= t("views.right_panel.detail.total") %> <%= t("views.right_panel.detail.tax") %></td>
<td colspan="3"><%= number_with_precision(total_tax, precision:precision.to_i, delimiter:delimiter) rescue ' '%></td>
<td colspan="4"><%= number_with_precision(total_tax, precision:precision.to_i, delimiter:delimiter) rescue ' '%></td>
</tr>
<% end %>
<% if grand_total > 0 %>
<tr style="border-top:2px solid #000">
<td colspan=2 style="text-align:center"></td>
<td colspan="2" style="text-align:center"></td>
<td><%= t("views.right_panel.detail.grand_total") %> </td>
<td colspan="3"><%= number_with_precision(grand_total, precision:precision.to_i, delimiter:delimiter) rescue ' '%></td>
<td colspan="4"><%= number_with_precision(grand_total, precision:precision.to_i, delimiter:delimiter) rescue ' '%></td>
</tr>
<% end %>
</tbody>