merge with aung myo

This commit is contained in:
Yan
2017-11-06 13:45:26 +06:30
6 changed files with 60 additions and 16 deletions

View File

@@ -46,6 +46,44 @@ class Origami::VoidController < BaseOrigamiController
remark = "Void Sale ID #{sale_id} | Receipt No #{sale.receipt_no} | Receipt No #{sale.receipt_no} | Table ->#{table.name}" remark = "Void Sale ID #{sale_id} | Receipt No #{sale.receipt_no} | Receipt No #{sale.receipt_no} | Table ->#{table.name}"
sale_audit = SaleAudit.record_audit_for_edit(sale_id,sale.cashier_id, action_by,remark,"SALEVOID" ) sale_audit = SaleAudit.record_audit_for_edit(sale_id,sale.cashier_id, action_by,remark,"SALEVOID" )
# For Print
member_info = nil
rebate_amount = nil
# For Cashier by Zone
bookings = Booking.where("sale_id='#{sale_id}'")
if bookings.count > 1
# for Multiple Booking
table = DiningFacility.find(bookings[0].dining_facility_id)
else
table = DiningFacility.find(bookings[0].dining_facility_id)
end
cashier_zone = CashierTerminalByZone.find_by_zone_id(table.zone_id)
cashier_terminal = CashierTerminal.find(cashier_zone.cashier_terminal_id)
unique_code = "ReceiptBillPdf"
customer= Customer.find(sale.customer_id)
#shop detail
shop_details = Shop.find(1)
# get member information
rebate = MembershipSetting.find_by_rebate(1)
if customer.membership_id != nil && rebate
member_info = Customer.get_member_account(customer)
rebate_amount = Customer.get_membership_transactions(customer,saleObj.receipt_no)
end
# get printer info
print_settings=PrintSetting.find_by_unique_code(unique_code)
# Calculate Food and Beverage Total
item_price_by_accounts = SaleItem.calculate_price_by_accounts(sale.sale_items)
discount_price_by_accounts = SaleItem.get_discount_price_by_accounts(sale.sale_items)
printer = Printer::ReceiptPrinter.new(print_settings)
printer.print_receipt_bill(print_settings,cashier_terminal,sale.sale_items,sale,customer.name, item_price_by_accounts, discount_price_by_accounts, member_info,rebate_amount,shop_details, "VOID")
#end print
# update complete order items in oqs # update complete order items in oqs
SaleOrder.where("sale_id = '#{ sale_id }'").find_each do |sodr| SaleOrder.where("sale_id = '#{ sale_id }'").find_each do |sodr|

View File

@@ -7,8 +7,8 @@ class Transactions::SalesController < ApplicationController
def index def index
receipt_no = params[:receipt_no] receipt_no = params[:receipt_no]
from = params[:from] from = params[:from]
to = params[:to] to = params[:to]
if receipt_no.nil? && from.nil? && to.nil? if receipt_no.nil? && from.nil? && to.nil?
@sales = Sale.where("NOT sale_status = 'void' " ).order("sale_id desc").limit(500) @sales = Sale.where("NOT sale_status = 'void' " ).order("sale_id desc").limit(500)

View File

@@ -614,6 +614,7 @@ def self.get_item_query()
" JOIN shift_sales sh ON sh.`id` = sales.shift_sale_id" + " JOIN shift_sales sh ON sh.`id` = sales.shift_sale_id" +
" JOIN menu_categories mc ON mc.id = mi.menu_category_id ") " JOIN menu_categories mc ON mc.id = mi.menu_category_id ")
# "JOIN employee_accesses ea ON ea.`employee_id` = sales.cashier_id ") # "JOIN employee_accesses ea ON ea.`employee_id` = sales.cashier_id ")
query = query.joins(" JOIN accounts acc ON acc.id = mi.account_id") query = query.joins(" JOIN accounts acc ON acc.id = mi.account_id")
query = query.where("i.unit_price > 0") query = query.where("i.unit_price > 0")
query = query.group('i.product_code ').order("mi.account_id, mi.menu_category_id") query = query.group('i.product_code ').order("mi.account_id, mi.menu_category_id")

View File

@@ -17,6 +17,7 @@
<thead> <thead>
<tr> <tr>
<th><%= t("views.right_panel.detail.name") %></th> <th><%= t("views.right_panel.detail.name") %></th>
<th><%= t("views.right_panel.detail.printer_name") %></th>
<th><%= t("views.right_panel.detail.active") %></th> <th><%= t("views.right_panel.detail.active") %></th>
<th><%= t("views.right_panel.detail.login") %>?</th> <th><%= t("views.right_panel.detail.login") %>?</th>
<th><%= t("views.right_panel.detail.auto_print") %></th> <th><%= t("views.right_panel.detail.auto_print") %></th>
@@ -32,6 +33,7 @@
<% @settings_cashier_terminals.each do |settings_cashier_terminal| %> <% @settings_cashier_terminals.each do |settings_cashier_terminal| %>
<tr> <tr>
<td><%= settings_cashier_terminal.name%></td> <td><%= settings_cashier_terminal.name%></td>
<td><%= settings_cashier_terminal.printer_name%></td>
<td><%= settings_cashier_terminal.is_active %></td> <td><%= settings_cashier_terminal.is_active %></td>
<td><%= settings_cashier_terminal.is_currently_login %></td> <td><%= settings_cashier_terminal.is_currently_login %></td>
<td><%= settings_cashier_terminal.auto_print_receipt %></td> <td><%= settings_cashier_terminal.auto_print_receipt %></td>

View File

@@ -28,11 +28,11 @@
</div> --> </div> -->
<div class="col-lg-2 col-md-2 col-sm-2 col-xs-2"> <div class="col-lg-2 col-md-2 col-sm-2 col-xs-2">
<label class="form-control-label"><%= t("views.right_panel.detail.from") %></label> <label class="form-control-label"><%= t("views.right_panel.detail.from") %></label>
<input class="form-control datepicker" name="from" id="date" type="text" placeholder="From date"> <input class="form-control datepicker" name="from" id="date from" type="text" placeholder="From date">
</div> </div>
<div class="col-lg-2 col-md-2 col-sm-2 col-xs-2"> <div class="col-lg-2 col-md-2 col-sm-2 col-xs-2">
<label class="form-control-label"><%= t("views.right_panel.detail.to") %></label> <label class="form-control-label"><%= t("views.right_panel.detail.to") %></label>
<input class="form-control datepicker" name="to" id="date" type="text" placeholder="To date"> <input class="form-control datepicker" name="to" id="date to" type="text" placeholder="To date">
</div> </div>
<div class="form-group col-lg-1 col-md-1 col-sm-1 col-xs-1"> <div class="form-group col-lg-1 col-md-1 col-sm-1 col-xs-1">
@@ -83,6 +83,14 @@
</div> </div>
</div> </div>
<script type="text/javascript">
$(function(){
$("#from").val("<%=params[:from] rescue '-'%>");
$("#to").val("<%=params[:to] rescue '-'%>");
});
</script>
<!-- <style type="text/css"> <!-- <style type="text/css">

View File

@@ -23,11 +23,11 @@
</div> </div>
<div class="col-lg-3 col-md-3 col-sm-3 col-xs-3"> <div class="col-lg-3 col-md-3 col-sm-3 col-xs-3">
<label class=""><%= t("views.right_panel.detail.from") %></label> <label class=""><%= t("views.right_panel.detail.from") %></label>
<input class="form-control datepicker" name="from" id="date" type="text" placeholder="From date"> <input class="form-control datepicker" name="from" id="from date" type="text" placeholder="From date">
</div> </div>
<div class="col-lg-3 col-md-3 col-sm-3 col-xs-3"> <div class="col-lg-3 col-md-3 col-sm-3 col-xs-3">
<label class=""><%= t("views.right_panel.detail.to") %></label> <label class=""><%= t("views.right_panel.detail.to") %></label>
<input class="form-control datepicker" name="to" id="date" type="text" placeholder="To date"> <input class="form-control datepicker" name="to" id="to date" type="text" placeholder="To date">
</div> </div>
<div class="col-lg-1 col-md-1 col-sm-1 col-xs-1"> <div class="col-lg-1 col-md-1 col-sm-1 col-xs-1">
@@ -90,18 +90,13 @@
</div> </div>
</div> </div>
<script type="text/javascript"> <script type="text/javascript">
$(function () { $(function(){
$("#from").val("<%=params[:from] rescue '-'%>");
$("#to").val("<%=params[:to] rescue '-'%>");
});
$('.datepicker').datepicker({
format : 'dd-mm-yyyy',
autoclose: true
});
$('.datepicker').attr('ReadOnly','true');
$('.datepicker').css('cursor','pointer');
});
</script> </script>