diff --git a/app/controllers/reports/order_reservation_controller.rb b/app/controllers/reports/order_reservation_controller.rb new file mode 100644 index 00000000..fb9517e4 --- /dev/null +++ b/app/controllers/reports/order_reservation_controller.rb @@ -0,0 +1,63 @@ +class Reports::OrderReservationController < BaseReportController +# authorize_resource :class => false + def index + @payments = [["All Payment",''], ["Cash Payment","cash"], ["Credit Payment","creditnote"], ["FOC Payment","foc"], ["Other Payment","card"]] + + from, to = get_date_range_from_params + + @shift_sale_range = Sale.get_by_shift_sale(from,to,Sale::SALE_STATUS_COMPLETED) + + @shift = '' + if params[:shift_name].to_i != 0 + shift_sale = ShiftSale.find(params[:shift_name]) + if to.blank? + @shift = ShiftSale.where('shift_started_at = ? and shift_closed_at is NULL ',shift_sale.shift_started_at) + else + + @shift = ShiftSale.where('shift_started_at = ? and shift_closed_at = ? ',shift_sale.shift_started_at, shift_sale.shift_closed_at) + end + end + payment_type = params[:payment_type] + @sale_data = Sale.get_sales_by_order_reservation(@shift_sale_range,@shift,from,to,payment_type) + @from = from + @to = to + # get printer info + @print_settings = PrintSetting.get_precision_delimiter() + if @shift.present? + @shift.each do |sh| + @shift_from = sh.shift_started_at.nil? ? '-' : sh.shift_started_at.utc.getlocal.strftime("%e %b %I:%M%p") + @shift_to = sh.shift_closed_at.nil? ? '-' : sh.shift_closed_at.utc.getlocal.strftime("%e %b %I:%M%p") + @shift_data = sh + end + end + + respond_to do |format| + format.html + format.xls + end + end + + def show + from, to = get_date_range_from_params + + @sale_data = Sale.get_by_shift_sale(from,to,Sale::SALE_STATUS_COMPLETED) + + date_arr = Array.new + @sale_data.each do |sale| + local_opening_date = sale.opening_date.nil? ? '-' : sale.opening_date.utc.getlocal.strftime("%e %b %I:%M%p") + local_closing_date = sale.closing_date.nil? ? '-' : sale.closing_date.utc.getlocal.strftime("%e %b %I:%M%p") + opening_date = sale.opening_date.nil? ? '-' : sale.opening_date.utc + closing_date = sale.closing_date.nil? ? '-' : sale.closing_date.utc + shift_id = sale.id.nil? ? '-' : sale.id + str = {:shift_id => shift_id, :local_opening_date => local_opening_date, :local_closing_date => local_closing_date, :opening_date => opening_date, :closing_date => closing_date} + date_arr.push(str) + end + + out = {:status => 'ok', :message => date_arr} + + respond_to do |format| + format.json { render json: out } + end + end + +end \ No newline at end of file diff --git a/app/views/origami/home/show.html.erb b/app/views/origami/home/show.html.erb index 9e6cb2f9..cc5e0f2f 100755 --- a/app/views/origami/home/show.html.erb +++ b/app/views/origami/home/show.html.erb @@ -826,7 +826,7 @@ $.ajax({ type: "POST", url: "/origami/" + sale_id + "/member_discount", - data: {'sale_id':sale_id, 'sub_total':sub_total,'is_card':is_card }, + data: {'sale_id':sale_id, 'sub_total':sub_total,'is_card':is_card,'cashier_type':'cashier' }, async: false, success:function(result){ } diff --git a/app/views/origami/payments/show.html.erb b/app/views/origami/payments/show.html.erb index 100b1425..d1a9eef4 100755 --- a/app/views/origami/payments/show.html.erb +++ b/app/views/origami/payments/show.html.erb @@ -530,7 +530,6 @@ var customer_name = "<%= @customer.name %>"; } else{ $("#credit_payment").show(); } -console.log(jQuery.inArray("Master", payment_type)) if(parseInt(jQuery.inArray("MPU", payment_type)) != -1 || parseInt(jQuery.inArray("VISA", payment_type)) != -1 || parseInt(jQuery.inArray("JCB", payment_type)) != -1 || @@ -1020,7 +1019,7 @@ console.log(jQuery.inArray("Master", payment_type)) $.ajax({ type: "POST", url: "/origami/" + sale_id + "/member_discount", - data: {'sale_id':sale_id, 'sub_total':sub_total,'is_card':is_card }, + data: {'sale_id':sale_id, 'sub_total':sub_total,'is_card':is_card,'cashier_type':cashier_type }, async: false, success:function(result){ } diff --git a/app/views/reports/order_reservation/_shift_sale_report_filter.html.erb b/app/views/reports/order_reservation/_shift_sale_report_filter.html.erb new file mode 100755 index 00000000..a1db6824 --- /dev/null +++ b/app/views/reports/order_reservation/_shift_sale_report_filter.html.erb @@ -0,0 +1,128 @@ +
| <%= t("views.right_panel.detail.from_date") %> : <%= @from.utc.getlocal.strftime("%Y-%b-%d") rescue '-' %> - <%= t("views.right_panel.detail.to_date") %> : <%= @to.utc.getlocal.strftime("%Y-%b-%d") rescue '-'%> | +||||||||
|---|---|---|---|---|---|---|---|---|
| <%= t("views.right_panel.detail.shift_name") %> = <%= @shift_from %> - <%= @shift_to %> ( <%= cashier_name %> ) | +||||||||
| <%= t("views.right_panel.detail.receipt_no") %> | +<%= t :cashier %> <%= t("views.right_panel.detail.name") %> | +<%= t("views.right_panel.detail.total") %> <%= t("views.right_panel.detail.amount") %> | +<%= t("views.right_panel.detail.discount") %> <%= t("views.right_panel.detail.amount") %> | + <% @tax_profiles.each do |tax| %> +<%= tax.name %> | + <% end %> + +<%= t("views.right_panel.detail.grand_total") %> | +<%= t("views.right_panel.detail.rnd_adj_sh") %> | +<%= t("views.right_panel.detail.grand_total") %> + + <%= t("views.right_panel.detail.rnd_adj_sh") %> + |
+ |
| <%= result.receipt_no rescue '-' %> | +<%= result.cashier_name rescue '-' %> | +<%= number_with_precision(result.total_amount, precision: precision.to_i ,delimiter: delimiter) %> | +<%= number_with_precision(result.total_discount, precision: precision.to_i ,delimiter: delimiter) %> | + <%if result.customer.customer_type == "Takeaway"%> +<%= number_with_precision(0, precision: precision.to_i ,delimiter: delimiter) %> | + <%end%> + <% result.sale_taxes.each do |tax| %> +<%= number_with_precision(tax.tax_payable_amount, precision: precision.to_i ,delimiter: delimiter) rescue '-' %> | + <%end%> + +<%= number_with_precision(result.grand_total, precision: precision.to_i ,delimiter: delimiter) %> | +<%= result.rounding_adjustment.to_f rescue '-' %> | +<%= number_with_precision(result.grand_total_after_rounding(), precision: precision.to_i ,delimiter: delimiter) rescue '-' %> | +
| + | <%= number_with_precision(total_sum, precision: precision.to_i ,delimiter: delimiter) rescue '-' %> | +<%= number_with_precision(discount_amt, precision: precision.to_i ,delimiter: delimiter) rescue '-' %> | + <% @sale_taxes.each do |tax| %> +<%= number_with_precision(tax.st_amount, precision: precision.to_i ,delimiter: delimiter) rescue '-' %> | + <% end %> +<%= number_with_precision(grand_total.to_f, precision: precision.to_i ,delimiter: delimiter) rescue '-' %> | +<%= rounding_adj.to_f rescue '-' %> | +<%= number_with_precision(grand_total.to_f.round + rounding_adj, precision: precision.to_i ,delimiter: delimiter) %> | +||
| + | <%= t("views.right_panel.detail.total") %> <%= t("views.right_panel.detail.amount") %> | +<%= t("views.right_panel.detail.discount") %> <%= t("views.right_panel.detail.amount") %> | + + <% @tax_profiles.each do |tax| %> +<%= tax.name %> | + <% end %> +<%= t("views.right_panel.detail.grand_total") %> | +<%= t("views.right_panel.detail.rnd_adj_sh") %> | +<%= t("views.right_panel.detail.grand_total") %> + + <%= t("views.right_panel.detail.rnd_adj_sh") %> + |
+ ||
| <%= t("views.right_panel.detail.from_date") %> : <%= @from.utc.getlocal.strftime("%Y-%b-%d") rescue '-' %> - <%= t("views.right_panel.detail.to_date") %> : <%= @to.utc.getlocal.strftime("%Y-%b-%d") rescue '-'%> | +||||||||
|---|---|---|---|---|---|---|---|---|
| <%= t("views.right_panel.detail.shift_name") %> = <%= @shift_from %> - <%= @shift_to %> ( <%= cashier_name %> ) | +||||||||
| <%= t("views.right_panel.detail.receipt_no") %> | +<%= t :cashier %> <%= t("views.right_panel.detail.name") %> | +<%= t("views.right_panel.detail.total") %> <%= t("views.right_panel.detail.amount") %> | +<%= t("views.right_panel.detail.discount") %> <%= t("views.right_panel.detail.amount") %> | + <% @tax_profiles.each do |tax| %> +<%= tax.name %> | + <% end %> + +<%= t("views.right_panel.detail.grand_total") %> | +<%= t("views.right_panel.detail.rnd_adj_sh") %> | +<%= t("views.right_panel.detail.grand_total") %> + + <%= t("views.right_panel.detail.rnd_adj_sh") %> + |
+ |
| <%= result.receipt_no rescue '-' %> | +<%= result.cashier_name rescue '-' %> | +<%= result.total_amount rescue '-' %> | +<%= result.total_discount rescue '-' %> | + <%if result.customer.customer_type == "Takeaway"%> +0.0 | + <%end%> + <% result.sale_taxes.each do |tax| %> +<%= tax.tax_payable_amount rescue '-' %> | + <%end%> + +<%= result.grand_total %> | +<%= result.rounding_adjustment.to_f rescue '-' %> | +<%= result.grand_total_after_rounding() rescue '-'%> | +
| + | <%= total_sum rescue '-'%> | +<%= discount_amt rescue '-'%> | + <% @sale_taxes.each do |tax| %> +<%= tax.st_amount.round(2) %> | + <% end %> +<%= grand_total.to_f.round(2) rescue '-'%> | +<%= rounding_adj rescue '-'%> | +<%= grand_total.to_f.round + rounding_adj %> | +||
| + | <%= t("views.right_panel.detail.total") %> <%= t("views.right_panel.detail.amount") %> | +<%= t("views.right_panel.detail.discount") %> <%= t("views.right_panel.detail.amount") %> | + + <% @tax_profiles.each do |tax| %> +<%= tax.name %> | + <% end %> +<%= t("views.right_panel.detail.grand_total") %> | +<%= t("views.right_panel.detail.rnd_adj_sh") %> | +<%= t("views.right_panel.detail.grand_total") %> + + <%= t("views.right_panel.detail.rnd_adj_sh") %> + |
+ ||