diff --git a/app/controllers/api/bill_controller.rb b/app/controllers/api/bill_controller.rb index 9ad9c5ee..d98e25e0 100755 --- a/app/controllers/api/bill_controller.rb +++ b/app/controllers/api/bill_controller.rb @@ -45,21 +45,21 @@ class Api::BillController < Api::ApiController @sale_id = booking.sale_id @sale_data = Sale.find_by_sale_id(@sale_id) end + + if ENV["SERVER_MODE"] != "cloud" #no print in cloud server + + unique_code = "CheckInOutPdf" + printer = PrintSetting.find_by_unique_code(unique_code) + + # print when complete click + order_queue_printer = Printer::OrderQueuePrinter.new(printer) + + if !printer.nil? + order_queue_printer.print_check_in_out(printer, booking, table) + end + end end - if ENV["SERVER_MODE"] != "cloud" #no print in cloud server - - printer = PrintSetting.find_by_unique_code("CheckInOutPdf") - unique_code = "CheckInOutPdf" - booking = Booking.find_by_booking_id(booking.booking_id) - - # print when complete click - order_queue_printer = Printer::OrderQueuePrinter.new(printer) - - if !printer.nil? - order_queue_printer.print_check_in_out(printer, booking, table) - end - end elsif (params[:order_id]) order = Order.find(params[:order_id]) diff --git a/app/controllers/origami/request_bills_controller.rb b/app/controllers/origami/request_bills_controller.rb index 961fc855..8cf0b07b 100755 --- a/app/controllers/origami/request_bills_controller.rb +++ b/app/controllers/origami/request_bills_controller.rb @@ -69,16 +69,15 @@ class Origami::RequestBillsController < ApplicationController else if ENV["SERVER_MODE"] != "cloud" #no print in cloud server - - printer = PrintSetting.find_by_unique_code("CheckInOutPdf") - unique_code = "CheckInOutPdf" - booking = Booking.find_by_booking_id(bk_order.booking_id) + + unique_code = "CheckInOutPdf" + printer = PrintSetting.find_by_unique_code(unique_code) # print when complete click order_queue_printer = Printer::OrderQueuePrinter.new(printer) if !printer.nil? - order_queue_printer.print_check_in_out(printer, booking, table) + order_queue_printer.print_check_in_out(printer, check_booking, table) end end end diff --git a/app/controllers/reports/card_sale_tran_controller.rb b/app/controllers/reports/card_sale_tran_controller.rb new file mode 100644 index 00000000..44caf53b --- /dev/null +++ b/app/controllers/reports/card_sale_tran_controller.rb @@ -0,0 +1,69 @@ +class Reports::CardSaleTranController < BaseReportController + authorize_resource :class => false + + # GET /transactions/sales + # GET /transactions/sales.json + def index + @payment_method = [["All Payments",''],["MPU Payment","mpu"], ["Visa Payment","visa"], + ["Master Payment","master"], ["JCB Payment","jcb"],["UnionPay Payment","cup"], + ["Alipay Payment","alipay"]] + @sales = Sale.all + + payment_type = params[:payment_type] + + from, to = get_date_range_from_params + status = 'Approved' + @shift_sale_range = '' + @shift = '' + + if params[:shift_name].to_i != 0 + + @shift_sale_range = CardSaleTran.get_by_shift_sale_by_card(from,to,status) + + @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 + if @shift_sale.shift_closed_at.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 + end + + if from.nil? && to.nil? && payment_method.nil? && @shift.nil? + + @cardSales = CardSaleTran.where("status = 'Approved'").order("sale_id desc") + + @cardSales = Kaminari.paginate_array(@cardSales).page(params[:page]).per(20) + else + cardSale = CardSaleTran.searchReport(from,to,payment_type,@shift_sale_range,@shift) + if cardSale.count > 0 + @cardSales = cardSale + @cardSales = Kaminari.paginate_array(@cardSales).page(params[:page]).per(20) + else + @cardSales = 0 + end + end + + @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 + +end diff --git a/app/controllers/reports/card_settle_tran_controller.rb b/app/controllers/reports/card_settle_tran_controller.rb new file mode 100644 index 00000000..1d71d4d8 --- /dev/null +++ b/app/controllers/reports/card_settle_tran_controller.rb @@ -0,0 +1,68 @@ +class Reports::CardSettleTranController < BaseReportController + authorize_resource :class => false + + # GET /transactions/sales + # GET /transactions/sales.json + def index + @payment_method = [["All Payments",''],["MPU Payment","mpu"], ["Visa & Master Payment","vmj"], + ["JCB Payment","jcb"],["UnionPay Payment","cup"], + ["Alipay Payment","alipay"]] + @sales = Sale.all + payment_type = params[:payment_type] + + from, to = get_date_range_from_params + status = 'Approved' + @shift_sale_range = '' + @shift = '' + + if params[:shift_name].to_i != 0 + + @shift_sale_range = CardSettleTran.get_by_shift_sale_by_card(from,to,status) + + @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 + if @shift_sale.shift_closed_at.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 + end + + if from.nil? && to.nil? && payment_method.nil? && @shift.nil? + + @cardSettles = CardSettleTran.order("sale_id desc") + + @cardSettles = Kaminari.paginate_array(@cardSettles).page(params[:page]).per(20) + else + cardSettle = CardSettleTran.searchReport(from,to,payment_type,@shift_sale_range,@shift) + if cardSettle.count > 0 + @cardSettles = cardSettle + @cardSettles = Kaminari.paginate_array(@cardSettles).page(params[:page]).per(20) + else + @cardSettles = 0 + end + end + + @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 + +end diff --git a/app/controllers/transactions/card_sale_trans_controller.rb b/app/controllers/transactions/card_sale_trans_controller.rb new file mode 100644 index 00000000..352e4f30 --- /dev/null +++ b/app/controllers/transactions/card_sale_trans_controller.rb @@ -0,0 +1,103 @@ +class Transactions::CardSaleTransController < ApplicationController + authorize_resource :class => false + + # GET /transactions/sales + # GET /transactions/sales.json + def index + @status = [["All Status",''], ["Approved","Approved"], ["Declined","Declined"]] + @payment_method =[["All Payments",''],["MPU Payment","mpu"], ["Visa Payment","visa"], + ["Master Payment","master"], ["JCB Payment","jcb"],["UnionPay Payment","cup"], + ["Alipay Payment","alipay"]] + @sales = Sale.all + + payment_type = params[:payment_type] + sale_id = params[:sale_id] + status_type = params[:status_type] + + from, to = get_date_range_from_params + + if sale_id.nil? && from.nil? && to.nil? && payment_method.nil? && status_type.nil? + + @cardSales = CardSaleTran.where("status IS NOT NULL").order("sale_id desc") + + @cardSales = Kaminari.paginate_array(@cardSales).page(params[:page]).per(20) + else + cardSale = CardSaleTran.search(sale_id,from,to,payment_type,status_type) + if cardSale.count > 0 + @cardSales = cardSale + @cardSales = Kaminari.paginate_array(@cardSales).page(params[:page]).per(20) + else + @cardSales = 0 + end + end + + end + + # date range + PERIOD = { + "today" => 0, + "yesterday" => 1, + "this_week" => 2, + "last_week" => 3, + "last_7" => 4, + "this_month" => 5, + "last_month" => 6, + "last_30" => 7, + "this_year" => 8, + "last_year" => 9 + } + + def get_date_range_from_params + period_type = params[:period_type] + period = params[:period] + from = params[:from] + to = params[:to] + day_ref = Time.now.utc.getlocal + if from.present? && to.present? + f_date = DateTime.parse(from) + t_date = DateTime.parse(to) + f_time = Time.mktime(f_date.year,f_date.month,f_date.day,f_date.hour,f_date.min,f_date.sec) + t_time = Time.mktime(t_date.year,t_date.month,t_date.day,t_date.hour,t_date.min,t_date.sec) + from = f_time.beginning_of_day.utc.getlocal + to = t_time.end_of_day.utc.getlocal + else + case period.to_i + when PERIOD["today"] + from = day_ref.beginning_of_day.utc + to = day_ref.end_of_day.utc + + when PERIOD["yesterday"] + from = (day_ref - 1.day).beginning_of_day.utc + to = (day_ref - 1.day).end_of_day.utc + + when PERIOD["this_week"] + from = Time.now.beginning_of_week.utc + to = Time.now.utc + when PERIOD["last_week"] + from = (day_ref - 7.day).beginning_of_week.utc + to = (day_ref - 7.day).end_of_week.utc + when PERIOD["last_7"] + from = (day_ref - 7.day).utc + to = Time.now.utc + when PERIOD["this_month"] + from = Time.now.beginning_of_month.utc + to = Time.now.utc + when PERIOD["last_month"] + from = (day_ref - 1.month).beginning_of_month.utc + to = (day_ref - 1.month).end_of_month.utc + when PERIOD["last_30"] + from = (day_ref - 30.day).utc + to = Time.now.utc + when PERIOD["this_year"] + from = Time.now.beginning_of_year.utc + to = Time.now.utc + when PERIOD["last_year"] + from = (day_ref - 1.year).beginning_of_year.utc + to = (day_ref - 1.year).end_of_year.utc + end + end + + return from, to + end + +end diff --git a/app/controllers/transactions/card_settle_trans_controller.rb b/app/controllers/transactions/card_settle_trans_controller.rb new file mode 100644 index 00000000..e2b70c7e --- /dev/null +++ b/app/controllers/transactions/card_settle_trans_controller.rb @@ -0,0 +1,104 @@ +class Transactions::CardSettleTransController < ApplicationController + authorize_resource :class => false + + # GET /transactions/sales + # GET /transactions/sales.json + def index + @status = [["All Status",''], ["Approved","Approved"], ["Declined","Declined"]] + @payment_method = [["All Payments",''],["MPU Payment","mpu"], ["Visa & Master Payment","vmj"], + ["JCB Payment","jcb"],["UnionPay Payment","cup"], + ["Alipay Payment","alipay"]] + @sales = Sale.all + + payment_type = params[:payment_type] + cashier_name = params[:cashier_name] + status_type = params[:status_type] + + + from, to = get_date_range_from_params + + if cashier_name.nil? && from.nil? && to.nil? && payment_method.nil? && status_type.nil? + + @cardSettles = CardSettleTran.order("sale_id desc") + + @cardSettles = Kaminari.paginate_array(@cardSettles).page(params[:page]).per(20) + else + cardSettle = CardSettleTran.search(cashier_name,from,to,payment_type,status_type) + if cardSettle.count > 0 + @cardSettles = cardSettle + @cardSettles = Kaminari.paginate_array(@cardSettles).page(params[:page]).per(20) + else + @cardSettles = 0 + end + end + + end + + # date range + PERIOD = { + "today" => 0, + "yesterday" => 1, + "this_week" => 2, + "last_week" => 3, + "last_7" => 4, + "this_month" => 5, + "last_month" => 6, + "last_30" => 7, + "this_year" => 8, + "last_year" => 9 + } + + def get_date_range_from_params + period_type = params[:period_type] + period = params[:period] + from = params[:from] + to = params[:to] + day_ref = Time.now.utc.getlocal + if from.present? && to.present? + f_date = DateTime.parse(from) + t_date = DateTime.parse(to) + f_time = Time.mktime(f_date.year,f_date.month,f_date.day,f_date.hour,f_date.min,f_date.sec) + t_time = Time.mktime(t_date.year,t_date.month,t_date.day,t_date.hour,t_date.min,t_date.sec) + from = f_time.beginning_of_day.utc.getlocal + to = t_time.end_of_day.utc.getlocal + else + case period.to_i + when PERIOD["today"] + from = day_ref.beginning_of_day.utc + to = day_ref.end_of_day.utc + + when PERIOD["yesterday"] + from = (day_ref - 1.day).beginning_of_day.utc + to = (day_ref - 1.day).end_of_day.utc + + when PERIOD["this_week"] + from = Time.now.beginning_of_week.utc + to = Time.now.utc + when PERIOD["last_week"] + from = (day_ref - 7.day).beginning_of_week.utc + to = (day_ref - 7.day).end_of_week.utc + when PERIOD["last_7"] + from = (day_ref - 7.day).utc + to = Time.now.utc + when PERIOD["this_month"] + from = Time.now.beginning_of_month.utc + to = Time.now.utc + when PERIOD["last_month"] + from = (day_ref - 1.month).beginning_of_month.utc + to = (day_ref - 1.month).end_of_month.utc + when PERIOD["last_30"] + from = (day_ref - 30.day).utc + to = Time.now.utc + when PERIOD["this_year"] + from = Time.now.beginning_of_year.utc + to = Time.now.utc + when PERIOD["last_year"] + from = (day_ref - 1.year).beginning_of_year.utc + to = (day_ref - 1.year).end_of_year.utc + end + end + + return from, to + end + +end diff --git a/app/models/card_sale_tran.rb b/app/models/card_sale_tran.rb index 7c496b56..04ec5155 100644 --- a/app/models/card_sale_tran.rb +++ b/app/models/card_sale_tran.rb @@ -1,2 +1,76 @@ class CardSaleTran < ApplicationRecord -end + + belongs_to :sale + + def self.search(filter,from,to,payment_type,status_type) + if filter.blank? + keyword = '' + else + keyword = " s.cashier_name LIKE ? OR c.name LIKE ? OR s.sale_id LIKE ?","%#{filter}%","%#{filter}%","%#{filter}%" + end + + if payment_type.blank? + payment = '' + else + payment = " app LIKE '#{payment_type}'" + end + + if status_type.blank? + status = '' + else + status = " status = '#{status_type}'" + end + + if from.present? && to.present? + + # cardSale = CardSaleTran.where("DATE_FORMAT(req_date,'%Y-%m-%d') >= ?" + " AND DATE_FORMAT(req_date,'%Y-%m-%d') <= ? and status IS NULL ", from,to) + from_date = from.strftime("%Y-%m-%d") + to_date = to.strftime("%Y-%m-%d") + query = CardSaleTran.joins("Join sales s ON s.sale_id = card_sale_trans.sale_id"+ + " JOIN customers c ON c.customer_id = s.customer_id") + cardSale = query.where("req_date >= ? and req_date <= ? and status is not null",from_date,to_date) + query1 = cardSale.where(keyword) + query2 = query1.where(payment) + query3 = query2.where(status) + + end + end + + def self.searchReport(from,to,payment_type,shift_sale_range,shift) + + if payment_type.blank? + payment = '' + else + payment = " app LIKE '#{payment_type}'" + end + + if from.present? && to.present? + + # cardSale = CardSaleTran.where("DATE_FORMAT(req_date,'%Y-%m-%d') >= ?" + " AND DATE_FORMAT(req_date,'%Y-%m-%d') <= ? and status IS NULL ", from,to) + from_date = from.strftime("%Y-%m-%d") + to_date = to.strftime("%Y-%m-%d") + query = CardSaleTran.joins("Join sales s ON s.sale_id = card_sale_trans.sale_id"+ + " JOIN customers c ON c.customer_id = s.customer_id") + cardSale = query.where("req_date >= ? and req_date <= ? and status = 'Approved'",from_date,to_date) + + if shift.present? + query1 = cardSale.where("s.shift_sale_id in (?)", shift.to_a) + elsif shift_sale_range.present? + query1 = cardSale.where("s.shift_sale_id in (?)",shift_sale_range.to_a) + else + query1 = cardSale.where("s.receipt_date between ? and ?",from,to) + end + query2 = query1.where(payment) + + end + end + + def self.get_by_shift_sale_by_card(from,to,status) + query = ShiftSale.select("shift_sales.id ,shift_started_at AS opening_date, + shift_closed_at As closing_date,") + .order("shift_sales.id DESC") + return query = query.where("shift_sales.shift_started_at >= ?" , from) + byebug + end + +end \ No newline at end of file diff --git a/app/models/card_settle_tran.rb b/app/models/card_settle_tran.rb index 29670946..8e2cafb8 100644 --- a/app/models/card_settle_tran.rb +++ b/app/models/card_settle_tran.rb @@ -1,2 +1,73 @@ class CardSettleTran < ApplicationRecord + + belongs_to :shift_sale + + def self.search(filter,from,to,payment_type,status_type) + if filter.blank? + keyword = '' + else + keyword = " e.name LIKE ?","%#{filter}%" + end + + if payment_type.blank? + payment = '' + else + payment = " req_type LIKE '#{payment_type}'" + end + + if status_type.blank? + status = '' + else + status = " status = '#{status_type}'" + end + + if from.present? && to.present? + + from_date = from.strftime("%Y-%m-%d") + to_date = to.strftime("%Y-%m-%d") + query = CardSettleTran.joins("Join shift_sales ss ON ss.id = card_settle_trans.shift_sale_id"+ + " JOIN employees e ON e.id = ss.employee_id") + cardSettle = query.where("req_date >= ? and req_date <= ?",from_date,to_date) + query1 = cardSettle.where(keyword) + query2 = query1.where(payment) + query3 = query2.where(status) + + end + end + + def self.searchReport(from,to,payment_type,shift_sale_range,shift) + + if payment_type.blank? + payment = '' + else + payment = " req_type LIKE '#{payment_type}'" + end + + if from.present? && to.present? + + from_date = from.strftime("%Y-%m-%d") + to_date = to.strftime("%Y-%m-%d") + query = CardSettleTran.joins("Join shift_sales ss ON ss.id = card_settle_trans.shift_sale_id"+ + " JOIN employees e ON e.id = ss.employee_id") + cardSettle = query.where("req_date >= ? and req_date <= ? and status = 'Approved'",from_date,to_date) + + if shift.present? + query1 = cardSettle.where("ss.id in (?)", shift.to_a) + elsif shift_sale_range.present? + query1 = cardSettle.where("ss.id in (?)",shift_sale_range.to_a) + else + query1 = cardSettle.where("req_date between ? and ?",from,to) + end + query2 = query1.where(payment) + + end + end + + def self.get_by_shift_sale_by_card(from,to,status) + query = ShiftSale.select("shift_sales.id ,shift_started_at AS opening_date, + shift_closed_at As closing_date,") + .order("shift_sales.id DESC") + return query = query.where("shift_sales.shift_started_at >= ?" , from) + byebug + end end diff --git a/app/models/sale.rb b/app/models/sale.rb index 31b16253..a5858544 100644 --- a/app/models/sale.rb +++ b/app/models/sale.rb @@ -6,6 +6,7 @@ class Sale < ApplicationRecord #before_create :generate_receipt_no belongs_to :cashier, :optional => true belongs_to :customer, :optional => true + belongs_to :employees has_many :sale_items has_many :sale_discount_items has_many :sale_discounts @@ -96,7 +97,6 @@ class Sale < ApplicationRecord end end end - else open_cashier = Employee.where("role = 'cashier' AND token_session <> ''") current_shift = ShiftSale.current_shift diff --git a/app/views/layouts/_left_sidebar.html.erb b/app/views/layouts/_left_sidebar.html.erb index 69021cc2..caadda69 100644 --- a/app/views/layouts/_left_sidebar.html.erb +++ b/app/views/layouts/_left_sidebar.html.erb @@ -125,6 +125,16 @@ <% end %> <% end %> + <% if can? :menage, Sale %> +
  • + <%= t :cb_payments %> +
  • + <% end %> + <% if can? :menage, Sale %> +
  • + <%= t :cb_settlement %> +
  • + <% end %> <% if can? :index, :dailysale %> @@ -178,6 +188,12 @@
  • Stock Check
  • +
  • + CB Payments +
  • +
  • + CB Settlement +
  • <%end%> diff --git a/app/views/reports/card_sale_tran/_shift_card_sale_tran_report_filter.html.erb b/app/views/reports/card_sale_tran/_shift_card_sale_tran_report_filter.html.erb new file mode 100644 index 00000000..0d70fe4f --- /dev/null +++ b/app/views/reports/card_sale_tran/_shift_card_sale_tran_report_filter.html.erb @@ -0,0 +1,144 @@ +
    + <%= form_tag report_path, :method => :get, :id=>"frm_report", :class => "form" do %> + <% if period_type != false %> +
    + + <% if defined? @payment_method %> +
    + + <%= select_tag "payment_type", options_for_select(@payment_method, :selected => params[:payment_type]), :class => "form-control" %> +
    + <% end %> +
    + + +
    + <% if not defined? payments %> + +
    + + + +
    + <% end %> +
    + + + +
    +
    + + +
    +
    + + +
    +
    +
    + +
    +
    + <% end %> + + <% end %> +
    + + diff --git a/app/views/reports/card_sale_tran/index.html.erb b/app/views/reports/card_sale_tran/index.html.erb new file mode 100644 index 00000000..218b0b7d --- /dev/null +++ b/app/views/reports/card_sale_tran/index.html.erb @@ -0,0 +1,199 @@ + +
    +
    + + <%= render :partial=>'shift_card_sale_tran_report_filter', + :locals=>{ :period_type => true, :shift_name => true,:payments => true, :report_path =>reports_card_sale_tran_index_path} %> +
    + + + +
    +
    + + + + + + + <% if @shift_from %> + + <% if @shift_data.employee %> + <% cashier_name = !@shift_data.nil? ? @shift_data.employee.name : '-' %> + <% end %> + + + <% end %> + + + + + + + + + + + + + + + + <% if @cardSales != 0 %> + <% @cardSales.each do |cardSale| %> + + + + + + + + + + + + + <% end %> + <% else %> + + <% end %> + +
    <%= 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.req_date") %><%= t("views.right_panel.detail.req_no") %><%= t("views.right_panel.detail.req_amount") %><%= t("views.right_panel.detail.res_date") %><%= t("views.right_panel.detail.ref_no") %><%= t("views.right_panel.detail.res_amount") %><%= t("views.right_panel.detail.payment_type") %><%= t("views.right_panel.detail.Customer_name") %><%= t("views.right_panel.detail.Cashier_name") %><%= t("views.right_panel.detail.detail") %>
    <%= cardSale.req_date %> <%= cardSale.req_time.utc.getlocal.strftime("%I:%M %p") %><%= cardSale.req_inv_no %><%= cardSale.req_amt %><%= cardSale.res_date %> <%= cardSale.res_time.utc.getlocal.strftime("%I:%M %p") %><%= cardSale.ref_no %><%= cardSale.res_amt %> + <% if cardSale.app == 'cup' %> + UnionPay + <% else %> + <%= cardSale.app %> + <% end %> + <%= cardSale.sale.customer.name rescue '-' %><%= cardSale.sale.cashier_name rescue '-' %> + <% if cardSale.terminal_id != '' %> + TID : <%= cardSale.terminal_id %> +
    + <% end %> + <% if cardSale.merchant_id != '' %> + MID : <%= cardSale.merchant_id %> +
    + <% end %> + <% if cardSale.batch_no != '' %> + Batch : <%= cardSale.batch_no %> +
    + <% end %> + <% if cardSale.trace != '' %> + Trace : <%= cardSale.trace %> + <% end %> +

    There is no data for search....

    +
    +
    +
    +
    + + \ No newline at end of file diff --git a/app/views/reports/card_sale_tran/index.xls.erb b/app/views/reports/card_sale_tran/index.xls.erb new file mode 100644 index 00000000..83eea675 --- /dev/null +++ b/app/views/reports/card_sale_tran/index.xls.erb @@ -0,0 +1,87 @@ + + + + + + + +
    +
    +
    +
    + + + + + + <% if @shift_from %> + + <% if @shift_data.employee %> + <% cashier_name = !@shift_data.nil? ? @shift_data.employee.name : '-' %> + <% end %> + + + <% end %> + + + + + + + + + + + + + + + + <% if @cardSales != 0 %> + <% @cardSales.each do |cardSale| %> + + + + + + + + + + + + + <% end %> + <% else %> + + <% end %> + +
    <%= t("views.right_panel.detail.from_date") %> : <%= @from.utc.getlocal.strftime("%Y-%b-%d") rescue '-' %> - <%= t("views.right_panel.detail.to_date") %> : <%= @to ? @to.utc.getlocal.strftime("%Y-%b-%d") : '-'%>
    <%= t("views.right_panel.detail.shift_name") %> = <%= @shift_from %> - <%= @shift_to %> ( <%= cashier_name %> )
    <%= t("views.right_panel.detail.req_date") %><%= t("views.right_panel.detail.req_no") %><%= t("views.right_panel.detail.req_amount") %><%= t("views.right_panel.detail.res_date") %><%= t("views.right_panel.detail.ref_no") %><%= t("views.right_panel.detail.res_amount") %><%= t("views.right_panel.detail.payment_type") %><%= t("views.right_panel.detail.Customer_name") %><%= t("views.right_panel.detail.Cashier_name") %><%= t("views.right_panel.detail.detail") %>
    <%= cardSale.req_date %> <%= cardSale.req_time.utc.getlocal.strftime("%I:%M %p") %><%= cardSale.req_inv_no %><%= cardSale.req_amt %><%= cardSale.res_date %> <%= cardSale.res_time.utc.getlocal.strftime("%I:%M %p") %><%= cardSale.ref_no %><%= cardSale.res_amt %> + <% if cardSale.app == 'cup' %> + UnionPay + <% else %> + <%= cardSale.app %> + <% end %> + <%= cardSale.sale.customer.name rescue '-' %><%= cardSale.sale.cashier_name rescue '-' %> + <% if cardSale.terminal_id != '' %> + TID : <%= cardSale.terminal_id %> +
    + <% end %> + <% if cardSale.merchant_id != '' %> + MID : <%= cardSale.merchant_id %> +
    + <% end %> + <% if cardSale.batch_no != '' %> + Batch : <%= cardSale.batch_no %> +
    + <% end %> + <% if cardSale.trace != '' %> + Trace : <%= cardSale.trace %> + <% end %> +

    There is no data for search....

    +
    +
    +
    +
    + + \ No newline at end of file diff --git a/app/views/reports/card_settle_tran/_shift_card_settle_tran_report_filter.html.erb b/app/views/reports/card_settle_tran/_shift_card_settle_tran_report_filter.html.erb new file mode 100644 index 00000000..0d70fe4f --- /dev/null +++ b/app/views/reports/card_settle_tran/_shift_card_settle_tran_report_filter.html.erb @@ -0,0 +1,144 @@ +
    + <%= form_tag report_path, :method => :get, :id=>"frm_report", :class => "form" do %> + <% if period_type != false %> +
    + + <% if defined? @payment_method %> +
    + + <%= select_tag "payment_type", options_for_select(@payment_method, :selected => params[:payment_type]), :class => "form-control" %> +
    + <% end %> +
    + + +
    + <% if not defined? payments %> + +
    + + + +
    + <% end %> +
    + + + +
    +
    + + +
    +
    + + +
    +
    +
    + +
    +
    + <% end %> + + <% end %> +
    + + diff --git a/app/views/reports/card_settle_tran/index.html.erb b/app/views/reports/card_settle_tran/index.html.erb new file mode 100644 index 00000000..0272db0a --- /dev/null +++ b/app/views/reports/card_settle_tran/index.html.erb @@ -0,0 +1,178 @@ + +
    +
    + + <%= render :partial=>'shift_card_settle_tran_report_filter', + :locals=>{ :period_type => true, :shift_name => true,:payments => true, :report_path =>reports_card_settle_tran_index_path} %> +
    + + + +
    +
    + + + + + + + <% if @shift_from %> + + <% if @shift_data.employee %> + <% cashier_name = !@shift_data.nil? ? @shift_data.employee.name : '-' %> + <% end %> + + + <% end %> + + + + + + + + + + + + + + + + <% if @cardSettles != 0 %> + <% @cardSettles.each do |cardSettle| %> + + + + + + + + + + + + + <% end %> + <% else %> + + <% end %> + +
    <%= 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.shift_sale_id") %><%= t("views.right_panel.detail.req_date") %><%= t("views.right_panel.detail.req_type") %><%= t("views.right_panel.detail.res_date") %><%= t("views.right_panel.detail.res_type") %><%= t("views.right_panel.detail.employee_name") %><%= t("views.right_panel.detail.sale_cnt") %><%= t("views.right_panel.detail.sale_amount") %><%= t("views.right_panel.detail.void_cnt") %><%= t("views.right_panel.detail.void_amount") %>
    <%= cardSettle.shift_sale.shift_started_at.strftime("%e %b %I:%M%p") rescue '-' %> - <%= cardSettle.shift_sale.shift_closed_at ? cardSettle.shift_sale.shift_closed_at.strftime("%e %b %I:%M%p") : '-' %><%= cardSettle.req_date %> <%= cardSettle.req_time.utc.getlocal.strftime("%I:%M %p") %><%= cardSettle.req_type %> + <%= cardSettle.res_date %> <%= cardSettle.res_time.utc.getlocal.strftime("%I:%M %p") %><%= cardSettle.res_type %><%= cardSettle.shift_sale.employee.name %><%= cardSettle.sale_cnt %><%= cardSettle.sale_amt %><%= cardSettle.void_cnt %><%= cardSettle.void_amt %>

    There is no data for search....

    +
    +
    +
    +
    + + \ No newline at end of file diff --git a/app/views/reports/card_settle_tran/index.xls.erb b/app/views/reports/card_settle_tran/index.xls.erb new file mode 100644 index 00000000..0f6e84c0 --- /dev/null +++ b/app/views/reports/card_settle_tran/index.xls.erb @@ -0,0 +1,65 @@ + + + + + + + +
    +
    +
    +
    + + + + + + <% if @shift_from %> + + <% if @shift_data.employee %> + <% cashier_name = !@shift_data.nil? ? @shift_data.employee.name : '-' %> + <% end %> + + + <% end %> + + + + + + + + + + + + + + + + <% if @cardSettles != 0 %> + <% @cardSettles.each do |cardSettle| %> + + + + + + + + + + + + + <% end %> + <% else %> + + <% end %> + +
    <%= t("views.right_panel.detail.from_date") %> : <%= @from.utc.getlocal.strftime("%Y-%b-%d") rescue '-' %> - <%= t("views.right_panel.detail.to_date") %> : <%= @to ? @to.utc.getlocal.strftime("%Y-%b-%d") : '-'%>
    <%= t("views.right_panel.detail.shift_name") %> = <%= @shift_from %> - <%= @shift_to %> ( <%= cashier_name %> )
    <%= t("views.right_panel.detail.shift_sale_id") %><%= t("views.right_panel.detail.req_date") %><%= t("views.right_panel.detail.req_type") %><%= t("views.right_panel.detail.res_date") %><%= t("views.right_panel.detail.res_type") %><%= t("views.right_panel.detail.employee_name") %><%= t("views.right_panel.detail.sale_cnt") %><%= t("views.right_panel.detail.sale_amount") %><%= t("views.right_panel.detail.void_cnt") %><%= t("views.right_panel.detail.void_amount") %>
    <%= cardSettle.shift_sale.shift_started_at.strftime("%e %b %I:%M%p") rescue '-' %> - <%= cardSettle.shift_sale.shift_closed_at ? cardSettle.shift_sale.shift_closed_at.strftime("%e %b %I:%M%p") : '-' %><%= cardSettle.req_date %> <%= cardSettle.req_time.utc.getlocal.strftime("%I:%M %p") %><%= cardSettle.req_type %><%= cardSettle.res_date %> <%= cardSettle.res_time.utc.getlocal.strftime("%I:%M %p") %><%= cardSettle.res_type %><%= cardSettle.shift_sale.employee.name %><%= cardSettle.sale_cnt %><%= cardSettle.sale_amt %><%= cardSettle.void_cnt %><%= cardSettle.void_amt %>

    There is no data for search....

    +
    +
    +
    +
    + + \ No newline at end of file diff --git a/app/views/reports/receipt_no/_shift_sale_report_filter.html.erb b/app/views/reports/receipt_no/_shift_sale_report_filter.html.erb index 1d7c2a94..6cf8ce02 100755 --- a/app/views/reports/receipt_no/_shift_sale_report_filter.html.erb +++ b/app/views/reports/receipt_no/_shift_sale_report_filter.html.erb @@ -18,7 +18,7 @@ - <% if defined? payments %> + <% if not defined? payments %>
    @@ -47,7 +47,7 @@
    -
    +

    diff --git a/app/views/transactions/card_sale_trans/index.html.erb b/app/views/transactions/card_sale_trans/index.html.erb new file mode 100644 index 00000000..d35ef116 --- /dev/null +++ b/app/views/transactions/card_sale_trans/index.html.erb @@ -0,0 +1,252 @@ + +
    +
    +
    +
    + + + + + + + + + +
    + <%= form_tag transactions_card_sale_trans_path, :method => :get do %> +
    +
    + + +
    + + <% if defined? @payment_method %> +
    + + <%= select_tag "payment_type", options_for_select(@payment_method, :selected => params[:payment_type]), :class => "form-control" %> +
    + <% end %> + + <% if not defined? status %> + +
    + + + +
    + <% end %> +
    + + +
    +
    + + +
    + +
    + +
    +
    +
    + <% end %> +
    + +
    +
    +
    + + + + + + + + + + + + + + + + + + + + <% if @cardSales != 0 %> + <% @cardSales.each do |cardSale| %> + + + + + + + + + + + + + + + + <% end %> + <% else %> + + <% end %> + +
    <%= t("views.right_panel.detail.sale_id") %><%= t("views.right_panel.detail.req_date") %><%= t("views.right_panel.detail.req_no") %><%= t("views.right_panel.detail.req_amount") %><%= t("views.right_panel.detail.res_date") %><%= t("views.right_panel.detail.ref_no") %><%= t("views.right_panel.detail.res_amount") %><%= t("views.right_panel.detail.payment_type") %><%= t("views.right_panel.detail.Customer_name") %><%= t("views.right_panel.detail.Cashier_name") %><%= t("views.right_panel.detail.detail") %><%= t("views.right_panel.detail.status") %>
    <%= link_to cardSale.sale_id, transactions_sale_path(cardSale.sale_id) rescue '-' %><%= cardSale.req_date %> <%= cardSale.req_time.utc.getlocal.strftime("%I:%M %p") %><%= cardSale.req_inv_no %><%= cardSale.req_amt %><%= cardSale.res_date %> <%= cardSale.res_time.utc.getlocal.strftime("%I:%M %p") %><%= cardSale.ref_no %><%= cardSale.res_amt %> + <% if cardSale.app == 'cup' %> + UnionPay + <% else %> + <%= cardSale.app %> + <% end %> + <%= cardSale.sale.customer.name rescue '-' %><%= cardSale.sale.cashier_name rescue '-' %> + <% if cardSale.terminal_id != '' %> + TID : <%= cardSale.terminal_id %> +
    + <% end %> + <% if cardSale.merchant_id != '' %> + MID : <%= cardSale.merchant_id %> +
    + <% end %> + <% if cardSale.batch_no != '' %> + Batch : <%= cardSale.batch_no %> +
    + <% end %> + <% if cardSale.trace != '' %> + Trace : <%= cardSale.trace %> + <% end %> +
    <%= cardSale.status %>

    There is no data for search....

    +
    + <% if @cardSales != 0 %> + <%= paginate @cardSales %> + <% end %> +
    +
    +
    + +
    +
    + + \ No newline at end of file diff --git a/app/views/transactions/card_settle_trans/index.html.erb b/app/views/transactions/card_settle_trans/index.html.erb new file mode 100644 index 00000000..7cbc3573 --- /dev/null +++ b/app/views/transactions/card_settle_trans/index.html.erb @@ -0,0 +1,226 @@ + +
    +
    +
    +
    + + + + + + + + + +
    + <%= form_tag transactions_card_settle_trans_path, :method => :get do %> +
    +
    + + +
    + + <% if defined? @payment_method %> +
    + + <%= select_tag "payment_type", options_for_select(@payment_method, :selected => params[:payment_type]), :class => "form-control" %> +
    + <% end %> + + <% if not defined? status %> + +
    + + + +
    + <% end %> +
    + + +
    +
    + + +
    + +
    + +
    +
    +
    + <% end %> +
    + +
    +
    +
    + + + + + + + + + + + + + + + + + + + <% if @cardSettles != 0 %> + <% @cardSettles.each do |cardSettle| %> + + + + + + + + + + + + + + <% end %> + <% else %> + + <% end %> + +
    <%= t("views.right_panel.detail.shift_sale_id") %><%= t("views.right_panel.detail.req_date") %><%= t("views.right_panel.detail.req_type") %><%= t("views.right_panel.detail.res_date") %><%= t("views.right_panel.detail.res_type") %><%= t("views.right_panel.detail.employee_name") %><%= t("views.right_panel.detail.sale_cnt") %><%= t("views.right_panel.detail.sale_amount") %><%= t("views.right_panel.detail.void_cnt") %><%= t("views.right_panel.detail.void_amount") %><%= t("views.right_panel.detail.status") %>
    <%= cardSettle.shift_sale.shift_started_at.strftime("%e %b %I:%M%p") rescue '-' %> - <%= cardSettle.shift_sale.shift_closed_at ? cardSettle.shift_sale.shift_closed_at.strftime("%e %b %I:%M%p") : '-' %><%= cardSettle.req_date %> <%= cardSettle.req_time.utc.getlocal.strftime("%I:%M %p") %><%= cardSettle.req_type %><%= cardSettle.res_date %> <%= cardSettle.res_time.utc.getlocal.strftime("%I:%M %p") %><%= cardSettle.res_type %><%= cardSettle.shift_sale.employee.name %><%= cardSettle.sale_cnt %><%= cardSettle.sale_amt %><%= cardSettle.void_cnt %><%= cardSettle.void_amt %><%= cardSettle.status %>

    There is no data for search....

    +
    + <% if @cardSettles != 0 %> + <%= paginate @cardSettles %> + <% end %> +
    +
    +
    + +
    +
    + + \ No newline at end of file diff --git a/app/views/transactions/sales/index.html.erb b/app/views/transactions/sales/index.html.erb index 26fbbcc5..8e815b32 100644 --- a/app/views/transactions/sales/index.html.erb +++ b/app/views/transactions/sales/index.html.erb @@ -243,11 +243,4 @@ } }); - - - - - - - - + \ No newline at end of file diff --git a/config/locales/en.yml b/config/locales/en.yml index 689a1890..3d99a17d 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -29,6 +29,8 @@ en: top: "Top" orders: "Orders" shiftsale: "ShiftSale" + cb_payments: "CB Payments" + cb_settlement: "CB Settlement" credit: "Credit" bookings: "Booking" home: "Home" diff --git a/config/locales/mm.yml b/config/locales/mm.yml index 111cca55..10e105d1 100644 --- a/config/locales/mm.yml +++ b/config/locales/mm.yml @@ -26,6 +26,8 @@ mm: top: "အရောင်းရဆုံး" orders: "အော်ဒါများ" credit: "အကြွေး" + cb_payments: "CB Payments" + cb_settlement: "CB Settlement" bookings: "ကြိုတင်စာရင်းသွင်းခြင်း" home: "မူလစာမျက်နှာ" simple_menu_item: "ဟင်းလျာများ" diff --git a/config/routes.rb b/config/routes.rb index 2926ab5c..4d4585eb 100755 --- a/config/routes.rb +++ b/config/routes.rb @@ -466,6 +466,8 @@ scope "(:locale)", locale: /en|mm/ do resources :shift_sales resources :surveys resources :order_reservations + resources :card_sale_trans + resources :card_settle_trans get "/sales/:sale_id/manual_complete_sale" => "manual_sales#manual_complete_sale", :as => "manual_complete_sale" get "/sales/:sale_id/void" => "manual_sales#void", :as => "void" @@ -489,6 +491,8 @@ scope "(:locale)", locale: /en|mm/ do resources :product_sale, :only => [:index, :show] resources :order_reservation, :only => [:index, :show] resources :induty, :only => [:index, :show] + resources :card_sale_tran + resources :card_settle_tran get "saleitem/get_shift_by_date", to: "saleitem#show", as: "get_shift_by_sale_item" get "receipt_no/get_shift_by_date", to: "receipt_no#get_shift_by_date", as: "get_shift_by_date"