From 308d9eefdefb61b6778ea4932b027810f10ba043 Mon Sep 17 00:00:00 2001 From: Aung Myo Date: Wed, 15 Nov 2017 13:40:09 +0630 Subject: [PATCH 01/14] update booking search --- app/controllers/transactions/bookings_controller.rb | 10 +++++----- app/models/booking.rb | 8 ++++---- app/views/transactions/bookings/index.html.erb | 2 +- 3 files changed, 10 insertions(+), 10 deletions(-) diff --git a/app/controllers/transactions/bookings_controller.rb b/app/controllers/transactions/bookings_controller.rb index b826cd52..66418caa 100644 --- a/app/controllers/transactions/bookings_controller.rb +++ b/app/controllers/transactions/bookings_controller.rb @@ -10,12 +10,12 @@ class Transactions::BookingsController < ApplicationController if filter.nil? && from.nil? && to.nil? @bookings = Booking.all.order("sale_id desc") - @bookings = Kaminari.paginate_array(@bookings).page(params[:page]).per(2) + @bookings = Kaminari.paginate_array(@bookings).page(params[:page]).per(20) else - sale = Sale.search(filter,from,to) - if sale.count > 0 - @bookings = sale - @bookings = Kaminari.paginate_array(@bookings).page(params[:page]).per(2) + booking = Booking.search(filter,from,to) + if booking.count > 0 + @bookings = booking + @bookings = Kaminari.paginate_array(@bookings).page(params[:page]).per(20) else @bookings = 0 end diff --git a/app/models/booking.rb b/app/models/booking.rb index b65063a4..826d585d 100755 --- a/app/models/booking.rb +++ b/app/models/booking.rb @@ -45,14 +45,14 @@ class Booking < ApplicationRecord if filter.blank? keyword = '' else - keyword = "booking_id LIKE ? OR cashier_name LIKE ? OR sale_status ='#{filter}'","%#{filter}%","%#{filter}%" + keyword = "booking_id LIKE ? OR checkin_by LIKE ? OR booking_status LIKE? OR checkout_by LIKE? OR sale_id ='#{filter}'","%#{filter}%","%#{filter}%","%#{filter}%","%#{filter}%" end if from.present? && to.present? - sale = Sale.where("DATE_FORMAT(receipt_date,'%d-%m-%Y') >= ?" + " AND DATE_FORMAT(receipt_date,'%d-%m-%Y') <= ? and NOT sale_status = 'void' ", from,to) - query = sale.where(keyword) + booking = Booking.where("DATE_FORMAT(created_at,'%d-%m-%Y') >= ?" + " AND DATE_FORMAT(created_at,'%d-%m-%Y') <= ? and NOT booking_status = 'void' ", from,to) + query = booking.where(keyword) else - where("receipt_no LIKE ? OR cashier_name LIKE ? OR sale_status ='#{filter}'","%#{filter}%","%#{filter}%",) + where("booking_id LIKE ? OR checkin_by LIKE ? OR booking_status LIKE? OR checkout_by LIKE? OR sale_id ='#{filter}'","%#{filter}%","%#{filter}%","%#{filter}%","%#{filter}%") end end diff --git a/app/views/transactions/bookings/index.html.erb b/app/views/transactions/bookings/index.html.erb index 997d18b5..99eccc45 100755 --- a/app/views/transactions/bookings/index.html.erb +++ b/app/views/transactions/bookings/index.html.erb @@ -15,7 +15,7 @@ - <%= form_tag transactions_orders_path, :method => :get do %> + <%= form_tag transactions_bookings_path, :method => :get do %>
From bf0a8135f607886f18afece76191eee28253421e Mon Sep 17 00:00:00 2001 From: Aung Myo Date: Wed, 15 Nov 2017 17:54:59 +0630 Subject: [PATCH 02/14] update rebate for credit and redeem --- app/assets/stylesheets/origami.scss | 7 +++++ app/models/sale_payment.rb | 26 +++++++++++-------- app/views/origami/payments/show.html.erb | 10 +++---- .../origami/redeem_payments/index.html.erb | 3 ++- .../_shift_sale_report_filter.html.erb | 2 +- .../membership_actions/_form.html.erb | 1 + 6 files changed, 31 insertions(+), 18 deletions(-) diff --git a/app/assets/stylesheets/origami.scss b/app/assets/stylesheets/origami.scss index 8b269d92..9f7de6dd 100755 --- a/app/assets/stylesheets/origami.scss +++ b/app/assets/stylesheets/origami.scss @@ -139,6 +139,13 @@ select.form-control { background-color:#795548; } +.others-color{ + background-color:#E1BEE7; + height: 30px !important; + line-height: 30px !important; +} + + .cashier_number:hover{ background:#A9F5F2; } diff --git a/app/models/sale_payment.rb b/app/models/sale_payment.rb index b4b29303..e712ed9d 100755 --- a/app/models/sale_payment.rb +++ b/app/models/sale_payment.rb @@ -264,8 +264,6 @@ class SalePayment < ApplicationRecord end def sale_update_payment_status(paid_amount) - puts paid_amount - puts "parid Masssssssssssssssssssssssssssssssssssssssss" #update amount_outstanding self.sale.amount_received = self.sale.amount_received.to_f + paid_amount.to_f self.sale.save! @@ -316,8 +314,6 @@ class SalePayment < ApplicationRecord self.sale.rebate_status = nil end end - puts "rrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrr" - puts response.to_json end self.sale.save! @@ -375,7 +371,8 @@ class SalePayment < ApplicationRecord paypar.each do |pp| if pp.payment_method == "paypar" payparcost = payparcost + pp.payment_amount - elsif pp.payment_method == "creditnote" + end + if pp.payment_method == "creditnote" credit = 1 end end @@ -410,7 +407,9 @@ class SalePayment < ApplicationRecord rescue SocketError response = { "status": false, "message": "Can't connect server"} end - + puts response.to_json + puts payparcost + puts overall_dis redeem_amount = payparcost + overall_dis total_percentage = 0 @@ -431,15 +430,19 @@ class SalePayment < ApplicationRecord data = {:type => a[:type], :amount => a[:amount]} type_arr.each do |si| if si[:type] == a[:type] - amount = (redeem_amount / total_percentage)*si[:percentage] - actual = a[:amount] - amount - data[:amount] = actual + if credit == 1 + data[:amount] = 0 + else + amount = (redeem_amount / total_percentage)*si[:percentage] + actual = a[:amount] - amount + data[:amount] = actual + end + end - end rebate_arr.push(data) end - + total_amount = rebate_prices - payparcost - overall_dis if credit == 1 @@ -485,6 +488,7 @@ class SalePayment < ApplicationRecord response = { "status": "no_member", "message": "Not membership"} end + end diff --git a/app/views/origami/payments/show.html.erb b/app/views/origami/payments/show.html.erb index 846487be..a911acf4 100755 --- a/app/views/origami/payments/show.html.erb +++ b/app/views/origami/payments/show.html.erb @@ -148,7 +148,7 @@
<% if @other != 0.0 %> -
+
MPU
<%= @other %>
@@ -162,7 +162,7 @@ <% end %> <% if @ppamount != 0.0 %> -
+
Redeem
<%= @ppamount %>
@@ -176,7 +176,7 @@ <% end %> <% if @visacount != 0.0 %> -
+
Visa
<%= @visacount %>
@@ -190,7 +190,7 @@ <% end %> <% if @jcbcount != 0.0 %> -
+
JCB
<%= @jcbcount %>
@@ -204,7 +204,7 @@ <% end %> <% if @mastercount != 0.0 %> -
+
Master
<%= @mastercount %>
diff --git a/app/views/origami/redeem_payments/index.html.erb b/app/views/origami/redeem_payments/index.html.erb index 50347dd1..23b6dc29 100755 --- a/app/views/origami/redeem_payments/index.html.erb +++ b/app/views/origami/redeem_payments/index.html.erb @@ -174,9 +174,10 @@ data: {redeem_amount:redeem_amount,membership_id:membership_id,sale_id:sale_id}, success: function(result){ if(result.status == true){ + console.log(result) swal({ title: "Information!", - text: result.status, + text: result.message, }, function () { window.location.href = '/origami/sale/'+ sale_id + "/payment" }); diff --git a/app/views/reports/saleitem/_shift_sale_report_filter.html.erb b/app/views/reports/saleitem/_shift_sale_report_filter.html.erb index b6dfe98f..c913b592 100755 --- a/app/views/reports/saleitem/_shift_sale_report_filter.html.erb +++ b/app/views/reports/saleitem/_shift_sale_report_filter.html.erb @@ -3,7 +3,7 @@ <% if period_type != false %>
- + +
+
+ + +
+
+ + +
+ +
+ +
+
+
+ <% end %> + + + + +
+
+
+ + + + + + + + + + + + + + + + + + + + + <% if @shift_sales != 0 %> + <% @shift_sales.each do |shift_sale| %> + + + + + + + + + + + + + + + + <% end %> + <% else %> + + <% end %> + +
Cashier NameCashier Terminal Opening Time Closing Time Opening float Closing Amount Cast In Cast Out Total Receipt Dining Count Takeaway Count Total VoidAction
<%= shift_sale.employee.name%><%=shift_sale.cashier_terminal.name%><%= shift_sale.shift_started_at.utc.getlocal.strftime('%d-%m-%Y %I:%M %p') %> + <%= shift_sale.shift_started_at.utc.getlocal.strftime('%d-%m-%Y %I:%M %p') rescue '-' %> + <%=shift_sale.opening_balance %><%=shift_sale.closing_balance %><%=shift_sale.cash_in %><%=shift_sale.cash_out %><%= shift_sale.total_receipt %><%= shift_sale.dining_count %><%= shift_sale.takeaway_count %>(<%= shift_sale.total_void.round(2) %>)<%= link_to t("views.btn.show"), transactions_shift_sale_path(shift_sale),:class => 'btn btn-info btn-sm waves-effect' %>

There is no data for search....

+
+ <% if @shift_sales != 0 %> + <%= paginate @shift_sales %> + <% end %> +
+
+
+ +
+
+ + + + + diff --git a/app/views/transactions/shift_sales/index.json.jbuilder b/app/views/transactions/shift_sales/index.json.jbuilder new file mode 100755 index 00000000..a67adc38 --- /dev/null +++ b/app/views/transactions/shift_sales/index.json.jbuilder @@ -0,0 +1 @@ +json.array! @transactions_sales, partial: 'transactions_sales/transactions_sale', as: :transactions_sale diff --git a/app/views/transactions/shift_sales/indexback.html.erb b/app/views/transactions/shift_sales/indexback.html.erb new file mode 100755 index 00000000..fe8c820a --- /dev/null +++ b/app/views/transactions/shift_sales/indexback.html.erb @@ -0,0 +1,59 @@ +

<%= notice %>

+ +

<%= t("views.right_panel.header.transactions_sales") %>

+ + + + + + + + + + + + + + + + + + + + + + + + + + + <% @transactions_sales.each do |transactions_sale| %> + + + + + + + + + + + + + + + + + + + + + + + <% end %> + +
<%= t :cashier %><%= t :cashier %> <%= t("views.right_panel.detail.name_txt2") %><%= t("views.right_panel.detail.requested_by") %><%= t("views.right_panel.detail.requested_at") %><%= t("views.right_panel.detail.receipt_no") %><%= t("views.right_panel.detail.receipt_date") %><%= t :customer %><%= t("views.right_panel.detail.payment_status") %><%= t("views.right_panel.detail.sale_status") %><%= t("views.right_panel.detail.total_amount") %><%= t("views.right_panel.detail.total_discount") %><%= t("views.right_panel.detail.total_tax") %><%= t("views.right_panel.detail.tax_type") %><%= t("views.right_panel.detail.grand_total") %><%= t("views.right_panel.detail.rnd_adj") %><%= t("views.right_panel.detail.amt_received") %><%= t("views.right_panel.detail.amt_changed") %>
<%= transactions_sale.cashier %><%= transactions_sale.cashier_name %><%= transactions_sale.requested_by %><%= transactions_sale.requested_at %><%= transactions_sale.receipt_no %><%= transactions_sale.receipt_date %><%= transactions_sale.customer %><%= transactions_sale.payment_status %><%= transactions_sale.sale_status %><%= transactions_sale.total_amount %><%= transactions_sale.total_discount %><%= transactions_sale.total_tax %><%= transactions_sale.tax_type %><%= transactions_sale.grand_total %><%= transactions_sale.rounding_adjustment %><%= transactions_sale.amount_received %><%= transactions_sale.amount_changed %><%= link_to t("views.btn.show"), transactions_sale %><%= link_to t("views.btn.edit"), edit_transactions_sale_path(transactions_sale) %><%= link_to t("views.btn.delete"), transactions_sale, method: :delete, data: { confirm: 'Are you sure?' } %>
+ +
+ +<%= link_to 'New Transactions Sale', new_transactions_sale_path %> diff --git a/app/views/transactions/shift_sales/show.html.erb b/app/views/transactions/shift_sales/show.html.erb new file mode 100755 index 00000000..3b2b6c6d --- /dev/null +++ b/app/views/transactions/shift_sales/show.html.erb @@ -0,0 +1,196 @@ + +
+
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Cashier Cashier Terminal Opening Date Opening float Received Amount Cast In Cast Out Total Receipt Dining Count Takeaway Count Total Void
<%= @shift.employee.name%><%=@shift.cashier_terminal.name%><%= @shift.shift_started_at.utc.getlocal.strftime('%d-%m-%Y %I:%M %p') %> + <%=@shift.opening_balance %><%=@shift.closing_balance %><%=@shift.cash_in %><%=@shift.cash_out %><%= @shift.total_receipt %><%= @shift.dining_count %><%= @shift.takeaway_count %>(<%= @shift.total_void.round(2) %>)
+ + <% @total_amount_by_account.each do |amount| %> + + + + + + <%end%> + + + + + + + <% @total_discount_by_account.each do |amount| %> + + + + + + <%end%> + + <% if !@total_member_discount[0].member_discount.nil? + @member_discount = @total_member_discount[0].member_discount rescue 0.0 + @overall = @shift.total_discounts - @member_discount + %> + + + + + + <%else @overall = @shift.total_discounts %> + + <%end%> + + + + + + + + + + + + <% @sale_taxes.each do |tax| %> + + + + + + <%end%> + + + + + + + + + + + + + + + +
Total <%= amount.account_name %> Amount<%= amount.total_price.round(2) %>
Net Sales<%=@shift.nett_sales %>
Total <%= amount.account_name %> Discount<%= amount.total_price.round(2) %>
Total Member Discount<%= @member_discount %>
Total Overall Discount<%= @overall %>
Total Discount<%= @shift.total_discounts %>
<%= tax.tax_name %> <%= tax.st_amount.round(2) %>
Total Tax <%=@shift.total_taxes %>
Rounding Adj <%= @shift.total_rounding.round(2) %>
Grand Total <%= @shift.grand_total.round(2) %>
+
+ + + + + + + + + + + + <% @total_amount = 0 + + @other_payment.each do |other| %> + + + + + + + + + + <% @total_amount = @total_amount+other.mpu_amount rescue 0.0 %> + + + + + + <% @total_amount = @total_amount+other.visa_amount rescue 0.0 %> + + + + + + <% @total_amount = @total_amount+other.master_amount rescue 0.0 %> + + + + + + <% @total_amount = @total_amount+other.jcb_amount rescue 0.0 %> + + + + + + <% @total_amount = @total_amount+other.paypar_amount rescue 0.0 %> + + + + + + <% @total_amount = @total_amount+other.foc_amount rescue 0.0 %> + + <%end%> + + + + + + + + + + + + +
Cash Payment <%=@shift.cash_sales %>
Credit Payment <%=@shift.credit_sales %>
Other Payment Detail
MPU Payment <%=other.mpu_amount.round(2) rescue 0.0 %>
VISA Payment <%=other.visa_amount.round(2) rescue 0.0 %>
JCB Payment <%=other.master_amount.round(2) rescue 0.0 %>
Master Payment <%=other.jcb_amount.round(2) rescue 0.0 %>
Reedem Payment <%=other.paypar_amount.round(2) rescue 0.0 %>
FOC <%=other.foc_amount.round(2) rescue 0.0 %>
Total Other Payment <%=@shift.other_sales %>
Total Payment <%= @total_amount+@shift.cash_sales+@shift.credit_sales %>
+
+
+
+
+
+
diff --git a/app/views/transactions/shift_sales/show.json.jbuilder b/app/views/transactions/shift_sales/show.json.jbuilder new file mode 100755 index 00000000..48c70528 --- /dev/null +++ b/app/views/transactions/shift_sales/show.json.jbuilder @@ -0,0 +1 @@ +json.partial! "transactions_sales/transactions_sale", transactions_sale: @transactions_sale diff --git a/config/locales/en.yml b/config/locales/en.yml index 69f0904c..242c60cf 100755 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -28,6 +28,7 @@ en: hourly: "Hourly" top: "Top" orders: "Orders" + shiftsale: "ShiftSale" credit: "Credit" bookings: "Booking" home: "Home" diff --git a/config/locales/mm.yml b/config/locales/mm.yml index d103a5c0..5becd44b 100755 --- a/config/locales/mm.yml +++ b/config/locales/mm.yml @@ -28,6 +28,7 @@ mm: hourly: "နာရီအလိုက်" top: "အရောင်းရဆုံး" orders: "အော်ဒါများ" + shiftsale: "အော်ဒါများ" bookings: "အော်ဒါများ" credit: "အကြွေး" home: "မူလစာမျက်နှာ" diff --git a/config/routes.rb b/config/routes.rb index 64f68262..0adeb4bc 100755 --- a/config/routes.rb +++ b/config/routes.rb @@ -336,6 +336,7 @@ scope "(:locale)", locale: /en|mm/ do resources :orders resources :credit_notes resources :bookings + resources :shift_sales 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" From 6360a914b402933ed4a09aaf4ad086f70f70e881 Mon Sep 17 00:00:00 2001 From: Aung Myo Date: Thu, 16 Nov 2017 14:23:51 +0630 Subject: [PATCH 06/14] update add order for popup qty --- app/assets/javascripts/addorder.js | 51 +++++++++++++---- app/assets/stylesheets/addorder.scss | 2 +- app/views/layouts/_left_sidebar.html.erb | 9 ++- app/views/origami/addorders/detail.html.erb | 55 ++++++++++++++----- app/views/settings/employees/_form.html.erb | 2 +- .../transactions/shift_sales/index.html.erb | 4 +- 6 files changed, 94 insertions(+), 29 deletions(-) diff --git a/app/assets/javascripts/addorder.js b/app/assets/javascripts/addorder.js index 2804583a..34c93405 100755 --- a/app/assets/javascripts/addorder.js +++ b/app/assets/javascripts/addorder.js @@ -339,13 +339,14 @@ $(function(){ $(".sx_item_set_detailModal").css({ 'display': "none" }); }else{ $(".sx_item_set_detailModal").css({ 'display': "block" }); - $.alert({ - title: 'Alert!', - content: 'Please Select Minimum ' + min_qty + " items", - type: 'red', - typeAnimated: true, - btnClass: 'btn-danger', - }); + swal("Alert !", 'Please Select Minimum ' + min_qty + " items", "warning"); + // $.alert({ + // title: 'Alert!', + // content: 'Please Select Minimum ' + min_qty + " items", + // type: 'red', + // typeAnimated: true, + // btnClass: 'btn-danger', + // }); } }); //End add order Click @@ -420,7 +421,7 @@ $(function(){ for(var field in attributes) { value = attributes[field]["values"]; type = attributes[field]["type"] - row = "

"+attributes[field]["type"]+"

"; + row = "
"+attributes[field]["type"]+"
"; $(value).each(function(i){ disabled = "" @@ -794,11 +795,10 @@ $(function(){ // Get Selected Class function change_qty_plus_minus(id,plus,minus) { - var count = 1; + var count = parseInt($('#'+id).val()) var countEl = document.getElementById(id); $('#'+plus).on("click", function(){ - count++; countEl.value = count; @@ -852,6 +852,37 @@ $(function(){ } }) } + + + $('.keypress_qty').keyup(function(e){ + + id = $(this).attr('id'); + value = $(this).val(); + + if (id=="count") { + price = $("#unit_price").text(); + $("#total_price").text(value*price); + }else{ + var item_row = $('.selected-instance'); + price = $("#set_unit_price").text(); + set_total_price = $("#set_total_price").text(); + $("#set_count").val(value); + if (item_row.length > 1) { + total = 0 ; + $(item_row).each(function(i){ + total += value * $(item_row[i]).attr('data-price'); + total_price = total; + }); + }else{ + total_price = value*price; + } + $("#set_total_price").text(total_price); + } + }); + + /* $("input").keypress(function(){ + $("span").text(i += 1); +});*/ // $("#set_change_qty").change(function(){ // qty = $(this).val(); // price = $("#set_total_price").text(); diff --git a/app/assets/stylesheets/addorder.scss b/app/assets/stylesheets/addorder.scss index b14895df..47b52a07 100755 --- a/app/assets/stylesheets/addorder.scss +++ b/app/assets/stylesheets/addorder.scss @@ -152,6 +152,6 @@ section.content{ } -#count { +#count ,#set_count{ text-align: center; } \ No newline at end of file diff --git a/app/views/layouts/_left_sidebar.html.erb b/app/views/layouts/_left_sidebar.html.erb index 25b196af..1ec77487 100755 --- a/app/views/layouts/_left_sidebar.html.erb +++ b/app/views/layouts/_left_sidebar.html.erb @@ -77,12 +77,12 @@ <%= t :transactions %>
  • diff --git a/app/views/origami/addorders/detail.html.erb b/app/views/origami/addorders/detail.html.erb index 8fa1b640..6cfe0bbf 100755 --- a/app/views/origami/addorders/detail.html.erb +++ b/app/views/origami/addorders/detail.html.erb @@ -33,7 +33,7 @@
    - ORDER DETAILS | Table<%=@table.name%> + ORDER DETAILS | Table-<%=@table.name%> @@ -98,8 +98,16 @@
  • @@ -110,7 +118,7 @@
    @@ -173,7 +193,7 @@