add close cashier print setting
This commit is contained in:
@@ -273,6 +273,9 @@ For Online Order Receipt Setting
|
||||
1) settings/lookups => { type:order_reservation, name:ReceiptBill, value: {0 or 1} }
|
||||
2) settings/print_settings => {name: ReceiptBillOrder, unique_code: ReceiptBillOrderPdf, ....}
|
||||
|
||||
For Close Cashier Print Settings
|
||||
settings/lookups => {type:close_cashier_print, name:CloseCashierPrint, value: {0 or 1} }
|
||||
|
||||
* ToDo list
|
||||
|
||||
1. Migration
|
||||
@@ -369,5 +372,3 @@ For Online Order Receipt Setting
|
||||
2. Show/Detail Buttons => btn-info
|
||||
3. Delete => btn-delete
|
||||
4. Cancel/Back => btn-default
|
||||
|
||||
|
||||
|
||||
@@ -38,6 +38,8 @@ class Origami::ShiftsController < BaseOrigamiController
|
||||
@shift_sale.create(opening_balance,cashier_terminal_param, current_user)
|
||||
end
|
||||
|
||||
|
||||
|
||||
def update_shift
|
||||
closing_balance = params[:closing_balance]
|
||||
shift_id = params[:shift_id]
|
||||
@@ -66,6 +68,11 @@ class Origami::ShiftsController < BaseOrigamiController
|
||||
|
||||
if ENV["SERVER_MODE"] != "cloud" #no print in cloud server
|
||||
|
||||
|
||||
|
||||
# if !close_cashier_print[0].nil?
|
||||
# @close_cashier_print = close_cashier_print[0][1]
|
||||
# end
|
||||
close_cashier_pdf = Lookup.collection_of("print_settings")
|
||||
unique_code = "CloseCashierPdf"
|
||||
|
||||
@@ -102,9 +109,18 @@ class Origami::ShiftsController < BaseOrigamiController
|
||||
print_settings = PrintSetting.find_by_unique_code(unique_code)
|
||||
printer = Printer::CashierStationPrinter.new(print_settings)
|
||||
|
||||
# print close cashier setting
|
||||
close_cashier_print = Lookup.collection_of('close_cashier_print')
|
||||
if close_cashier_print.empty?
|
||||
@settings_lookup = Lookup.new(lookup_type: "close_cashier_print", name: "CloseCashierPrint", value: "1")
|
||||
@settings_lookup.save
|
||||
end
|
||||
find_close_cashier_print = Lookup.collection_of('close_cashier_print')
|
||||
if find_close_cashier_print[0][1].to_i > 0
|
||||
printer.print_close_cashier(print_settings,cashier_terminal,@shift,shop_details,@sale_taxes,@other_payment,@total_amount_by_account,@total_discount_by_account,@total_member_discount,@total_dinein,@total_takeway,@total_other_charges,@total_waste,@total_spoile,@total_credit_payments)
|
||||
end
|
||||
end
|
||||
end
|
||||
Employee.logout(session[:session_token])
|
||||
session[:session_token] = nil
|
||||
end
|
||||
|
||||
@@ -48,5 +48,63 @@ class Reports::ShiftsaleController < BaseReportController
|
||||
end
|
||||
end
|
||||
|
||||
def print_close_receipt
|
||||
shift_id = params[:id]
|
||||
@shift = ShiftSale.find_by_id(shift_id)
|
||||
shift_obj = ShiftSale.where('id =?',shift_id)
|
||||
puts "shift obj!!!!!"
|
||||
puts shift_obj.to_json
|
||||
|
||||
if ENV["SERVER_MODE"] != "cloud" #no print in cloud server
|
||||
|
||||
close_cashier_pdf = Lookup.collection_of("print_settings")
|
||||
puts "close !!!!"
|
||||
puts close_cashier_pdf
|
||||
|
||||
unique_code = "CloseCashierPdf"
|
||||
|
||||
if !close_cashier_pdf.empty?
|
||||
close_cashier_pdf.each do |close_cashier|
|
||||
if close_cashier[0] == 'CloseCashierCustomisePdf'
|
||||
if close_cashier[1] == '1'
|
||||
unique_code="CloseCashierCustomisePdf"
|
||||
else
|
||||
unique_code="CloseCashierPdf"
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
shop_details = shop_detail
|
||||
cashier_terminal = @shift.cashier_terminal
|
||||
@sale_taxes = Sale.get_separate_tax(shift_obj,from=nil,to=nil,type='')
|
||||
@total_waste = Sale.get_total_waste(shift_id).sum(:grand_total)
|
||||
@total_spoile = Sale.get_total_spoile(shift_id).sum(:grand_total)
|
||||
#other payment details for mpu or visa like card
|
||||
@other_payment = ShiftSale.get_by_shift_other_payment(@shift)
|
||||
|
||||
# Calculate price_by_accounts
|
||||
@total_amount_by_account = ShiftSale.calculate_total_price_by_accounts(@shift,'amount')
|
||||
@total_discount_by_account = ShiftSale.calculate_total_price_by_accounts(@shift,'discount')
|
||||
@total_member_discount = ShiftSale.get_total_member_discount(@shift)
|
||||
@total_dinein = ShiftSale.get_total_dinein(@shift).total_dinein_amount
|
||||
@total_takeway = ShiftSale.get_total_takeway(@shift).total_takeway_amount
|
||||
@total_other_charges = ShiftSale.get_total_other_charges(@shift).total_other_charges_amount
|
||||
@total_credit_payments = ShiftSale.get_shift_sales_with_credit_payment(shift_id).total_credit_payments
|
||||
|
||||
# get printer info
|
||||
print_settings = PrintSetting.find_by_unique_code(unique_code)
|
||||
printer = Printer::CashierStationPrinter.new(print_settings)
|
||||
|
||||
printer.print_close_cashier(print_settings,cashier_terminal,@shift,shop_details,@sale_taxes,@other_payment,@total_amount_by_account,@total_discount_by_account,@total_member_discount,@total_dinein,@total_takeway,@total_other_charges,@total_waste,@total_spoile,@total_credit_payments)
|
||||
|
||||
respond_to do |format|
|
||||
format.html { redirect_to '/en/reports/shiftsale/', notice: 'Printing Completed.'}
|
||||
format
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
end
|
||||
|
||||
@@ -951,6 +951,7 @@ def self.get_by_shiftsales(from,to,shift)
|
||||
end
|
||||
|
||||
shift_sale_data[shift_sale.id] = {
|
||||
:shift_id => shift_sale.id,
|
||||
:cashier_terminal_name => shift_sale.cashier_terminal.name,
|
||||
:employee_name => shift_sale.employee.name,
|
||||
:shift_started_at => shift_sale.shift_started_at,
|
||||
|
||||
@@ -60,6 +60,7 @@
|
||||
<br/>Rounding Adj</th> -->
|
||||
<!-- <th>Rounding Adj</th> -->
|
||||
<th><%= t("views.right_panel.detail.grand_total") %></th>
|
||||
<th>Print</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@@ -89,7 +90,7 @@
|
||||
|
||||
<tr>
|
||||
<td>
|
||||
<%= result[:cashier_terminal_name] rescue '-'%>
|
||||
<%= result[:cashier_terminal_name] rescue '-'%> <%= result[:shift_id].to_i %>
|
||||
</td>
|
||||
<td>
|
||||
<%= result[:employee_name] rescue '-'%>
|
||||
@@ -108,7 +109,9 @@
|
||||
<%= number_with_precision(result[:foc_sales].to_f, precision:precision.to_i,delimiter:delimiter) rescue '-'%>
|
||||
</td>
|
||||
<td><%= number_with_precision(result[:grand_total].to_f, precision:precision.to_i,delimiter:delimiter) rescue '-'%></td>
|
||||
|
||||
<td>
|
||||
<%= link_to "Print", reports_get_shift_id_path(result[:shift_id].to_i), class:"btn btn-info wave-effects" %>
|
||||
</td>
|
||||
<!-- <td><%= sprintf "%.2f",result[:rounding_adj].to_f.to_d rescue '-'%></td> -->
|
||||
<% grand_total = result[:grand_total].to_f %>
|
||||
<!-- <td><%= sprintf "%.2f",grand_tota.to_f.to_d rescue '-'%></td> -->
|
||||
@@ -142,6 +145,13 @@
|
||||
</div>
|
||||
</div>
|
||||
<script>
|
||||
|
||||
$(document).ready(function(){
|
||||
$('#close_cashier').on('click',function(){
|
||||
window.location.href = '/origami/shift/close';
|
||||
})
|
||||
})
|
||||
|
||||
$(function(){
|
||||
|
||||
var check_arr = [];
|
||||
@@ -243,5 +253,3 @@
|
||||
|
||||
});
|
||||
</script>
|
||||
|
||||
|
||||
|
||||
@@ -524,6 +524,7 @@ scope "(:locale)", locale: /en|mm/ do
|
||||
get "receipt_no/get_shift_by_date", to: "receipt_no#get_shift_by_date", as: "get_shift_by_date"
|
||||
get "order_reservation/get_shift_by_date", to: "order_reservation#show", as: "get_shift_by_order_reservation"
|
||||
get "induty/get_shift_by_date", to: "induty#show", as: "get_shift_by_induty"
|
||||
get "shiftsale_print/:id" , to: "shiftsale#print_close_receipt", as: "get_shift_id"
|
||||
|
||||
end
|
||||
|
||||
|
||||
Reference in New Issue
Block a user