diff --git a/app/assets/javascripts/application.js b/app/assets/javascripts/application.js index a05ea4ee..b0937554 100644 --- a/app/assets/javascripts/application.js +++ b/app/assets/javascripts/application.js @@ -18,6 +18,139 @@ //= require cable //= require settings/processing_items +$(document).on("focus", "[data-behaviour~='datepicker']", function(e){ + $(this).datepicker({"format": "yyyy-M-dd", "weekStart": 1, "autoclose": true}); + $('.dropdown-toggle').dropdown(); +}); + +/* +* ToDo Move to here from pages +* +* +$(function(){ + $('#custom_excel').hide(); + + $('#custom_excel').click(function(){ + var url = $('#custom_excel').attr('data-url'); + $('#frm_report').attr('action',url) + $('#frm_report').submit(); + // window.location = url; + }); + + var item = $('#item').val(); + var payment_type = $('#payment_type'); + + if(item == 'order'){ + $('#cashier').hide(); + $('#waiter').show(); + if(payment_type){ + $('#payment_type').hide(); + } + } + else if(item == 'sale'){ + $('#waiter').hide(); + $('#cashier').show(); + } + else{ + $('#waiter').hide(); + $('#cashier').show(); + $("#item").val('sale'); + } +}); + +//Reset the form to pervious values +$("#branch").val(<%=params[:branch]%>); +$("#waiter").val("<%=params[:waiter]%>"); +$("#cashier").val(<%=params[:cashier]%>); +$("#product").val(<%=params[:product]%>); +$("#singer").val(<%=params[:singer]%>); +$("#item").val('<%=params[:item]%>'); +$("#guest_role").val('<%=params[:guest_role]%>'); + + +$("#from").val("<%=params[:from]%>"); +$("#to").val("<%=params[:to]%>"); +$("#sel_period").val(<%=params[:period]%>); +$("#sel_sale_type").val(<%=params[:sale_type]%>); + +<% if params[:period_type] == 1 || params[:period_type] == "1" %> + $("#rd_period_type_1").attr("checked","checked"); +<% else %> + $("#rd_period_type_0").attr("checked","checked"); +<% end %> +$(".btn-group button").removeClass("active"); +<% report_type = params[:report_type].blank? ? "0" : params[:report_type] %> +$("#btn_report_type_<%= report_type %>").addClass("active"); + +$('#item').change(function(){ + var item = $('#item').val(); + var payment_type = $('#payment_type'); + + if(item == 'sale'){ + $('#waiter').hide(); + $('#cashier').show(); + if(payment_type){ + $('#payment_type').show(); + } + } + else{ + $('#cashier').hide(); + $('#waiter').show(); + if(payment_type){ + $('#payment_type').hide(); + } + } +}); + +$(function(){ + var check_arr = []; + var search = '<%= params[:period_type] %>'; + if(search){ + if(parseInt(search) == 0){ + search_by_period(); + } + else{ + search_by_date(); + } + }else{ + search_by_period(); + } + $('#sel_period').change(function(){ + search_by_period(); + }); + function search_by_period(){ + var period = $('#sel_period').val(); + var period_type = 0; + var from = ""; + var to = ""; + } + + $('#from').change(function(){ + search_by_date(); + }); + + $('#to').change(function(){ + search_by_date(); + }); + function search_by_date(){ + var from = $('#from').val(); + var to = $('#to').val(); + var period = 0; + var period_type = 1; + if(to != '' && from != ''){ + shift_name = from + ',' + to; + check_arr.push(to); + // console.log(check_arr.length) + if(check_arr.length == 1){ + } + if(check_arr.length == 3){ + check_arr = []; + } + } + } +}); +*/ +>>>>>>> d54fd19d1c18384ee6b21c43ca51587fb7fa843f diff --git a/app/assets/javascripts/origami.js b/app/assets/javascripts/origami.js index 0079142f..fbf641df 100644 --- a/app/assets/javascripts/origami.js +++ b/app/assets/javascripts/origami.js @@ -185,7 +185,7 @@ $(document).ready(function(){ }else{ var sale_id = $(".selected-item").find(".order-cid").text(); } - window.location.href = '/origami/'+ sale_id + "/add_customer" + window.location.href = '/origami/'+ sale_id + "/customers" return false; }); @@ -199,6 +199,7 @@ $(document).ready(function(){ } $('.customer_detail').removeClass('hide'); + //Start Ajax $.ajax({ type: "GET", @@ -210,8 +211,16 @@ $(document).ready(function(){ $.each(data["response_data"]["data"], function (i) { if(data["response_data"]["data"][i]["accountable_type"] == "RebateAccount"){ var balance = data["response_data"]["data"][i]["balance"]; - console.log(balance); - $("#customer_amount").text(balance); + if (data["response_data"]["status"]==true) { + $('.rebate_amount').removeClass('hide'); + console.log(balance); + row = + '' + data["response_data"]["data"][i]["accountable_type"] +'' + +'' + balance + ''; + + $(".rebate_amount").append(row); + } + } }); } diff --git a/app/assets/stylesheets/application.scss b/app/assets/stylesheets/application.scss index 6097a890..bed2e04f 100644 --- a/app/assets/stylesheets/application.scss +++ b/app/assets/stylesheets/application.scss @@ -58,3 +58,19 @@ ul.dropdown-menu li a{ /*----- Header Bar -----*/ /*----- Header Bar -----*/ + +/*----- Layout ------ */ + +.margin-top-20 { + margin: 20px 0 0 0; +} + +/*----- Layout ------ */ + +/*--- Reset --- */ + +select.form-control { + height: inherit !important; +} + +/*--- Reset --- */ diff --git a/app/controllers/crm/customers_controller.rb b/app/controllers/crm/customers_controller.rb index 1f35da76..57f4eafc 100644 --- a/app/controllers/crm/customers_controller.rb +++ b/app/controllers/crm/customers_controller.rb @@ -45,6 +45,35 @@ class Crm::CustomersController < BaseCrmController @sale_items = @sale_items + sale.sale_items end end + + #get customer amount + @customer = Customer.find(params[:id]) + + membership = MembershipSetting.find_by_membership_type("paypar_url") + + memberaction = MembershipAction.find_by_membership_type("get_all_member_account") + merchant_uid = memberaction.merchant_account_id.to_s + auth_token = memberaction.auth_token.to_s + url = membership.gateway_url.to_s + memberaction.gateway_url.to_s + + response = HTTParty.get(url, :body => { membership_id: @customer.membership_id,merchant_uid:merchant_uid,auth_token:auth_token}.to_json, + :headers => { + 'Content-Type' => 'application/json', + 'Accept' => 'application/json' + } + ) + + @type = "-" + @balance = 0.00 + response["data"].each do |res| + if res["accountable_type"] == "RebateAccount" + @balance = res["balance"] + @type = "RebateAccount" + end + end + + #end customer amount + end # GET /crm/customers/new @@ -76,11 +105,12 @@ class Crm::CustomersController < BaseCrmController membership = MembershipSetting.find_by_membership_type("paypar_url") memberaction = MembershipAction.find_by_membership_type("create_membership_customer") merchant_uid = memberaction.merchant_account_id.to_s + auth_token = memberaction.auth_token.to_s url = membership.gateway_url.to_s + memberaction.gateway_url.to_s response = HTTParty.post(url, :body => { name: name,phone: phone,email: email, dob: dob, - member_group_id: member_group_id,merchant_uid:merchant_uid}.to_json, + member_group_id: member_group_id,merchant_uid:merchant_uid,auth_token:auth_token}.to_json, :headers => { 'Content-Type' => 'application/json', 'Accept' => 'application/json' @@ -93,7 +123,7 @@ class Crm::CustomersController < BaseCrmController status = customer.update_attributes(membership_id: response["customer_datas"]["id"]) if params[:sale_id] - format.html { redirect_to '/origami/'+params[:sale_id]+'/add_customer', notice: 'Customer was successfully created.' } + format.html { redirect_to '/origami/'+params[:sale_id]+'/customers', notice: 'Customer was successfully created.' } else format.html { redirect_to crm_customers_path, notice: 'Customer was successfully created'} end @@ -102,7 +132,7 @@ class Crm::CustomersController < BaseCrmController @crm_customers.destroy if params[:sale_id] - format.html { redirect_to '/origami/'+params[:sale_id]+'/add_customer'} + format.html { redirect_to '/origami/'+params[:sale_id]+'/customers'} else format.html { redirect_to crm_customers_path, notice: response["message"] } end @@ -111,7 +141,7 @@ class Crm::CustomersController < BaseCrmController if params[:sale_id] flash[:errors] = @crm_customers.errors - format.html { redirect_to '/origami/'+params[:sale_id]+'/add_customer'} + format.html { redirect_to '/origami/'+params[:sale_id]+'/customers'} format.json { render json: @crm_customers.errors, status: :unprocessable_entity } else flash[:errors] = @crm_customers.errors @@ -140,11 +170,12 @@ end membership = MembershipSetting.find_by_membership_type("paypar_url") memberaction = MembershipAction.find_by_membership_type("update_membership_customer") merchant_uid = memberaction.merchant_account_id.to_s + auth_token = memberaction.auth_token.to_s url = membership.gateway_url.to_s + memberaction.gateway_url.to_s response = HTTParty.post(url, :body => { name: name,phone: phone,email: email, dob: dob, - id: id,member_group_id:member_group_id,merchant_uid:merchant_uid}.to_json, + id: id,member_group_id:member_group_id,merchant_uid:merchant_uid,auth_token:auth_token}.to_json, :headers => { 'Content-Type' => 'application/json', 'Accept' => 'application/json' diff --git a/app/controllers/origami/home_controller.rb b/app/controllers/origami/home_controller.rb index de526f81..22c0c119 100644 --- a/app/controllers/origami/home_controller.rb +++ b/app/controllers/origami/home_controller.rb @@ -74,9 +74,10 @@ class Origami::HomeController < BaseOrigamiController memberaction = MembershipAction.find_by_membership_type("get_all_member_account") merchant_uid = memberaction.merchant_account_id.to_s + auth_token = memberaction.auth_token.to_s url = membership.gateway_url.to_s + memberaction.gateway_url.to_s - response = HTTParty.get(url, :body => { membership_id: @customer.membership_id,merchant_uid:merchant_uid}.to_json, + response = HTTParty.get(url, :body => { membership_id: @customer.membership_id,merchant_uid:merchant_uid,auth_token:auth_token}.to_json, :headers => { 'Content-Type' => 'application/json', 'Accept' => 'application/json' diff --git a/app/controllers/origami/redeem_payments_controller.rb b/app/controllers/origami/redeem_payments_controller.rb index 1f650e36..99601449 100644 --- a/app/controllers/origami/redeem_payments_controller.rb +++ b/app/controllers/origami/redeem_payments_controller.rb @@ -36,7 +36,8 @@ class Origami::RedeemPaymentsController < BaseOrigamiController @campaign_type_id = member_actions.additional_parameter["campaign_type_id"] url = membership_setting.gateway_url.to_s + member_actions.gateway_url.to_s merchant_uid= member_actions.merchant_account_id - membership_data = SalePayment.get_paypar_account(url,membership_setting.auth_token,@membership_id,@campaign_type_id,merchant_uid) + auth_token = member_actions.auth_token.to_s + membership_data = SalePayment.get_paypar_account(url,membership_setting.auth_token,@membership_id,@campaign_type_id,merchant_uid,auth_token) if membership_data["status"]==true @membership_rebate_balance=membership_data["balance"] @out = true, @membership_rebate_balance,@membership_id diff --git a/app/controllers/reports/daily_sale_controller.rb b/app/controllers/reports/daily_sale_controller.rb index b4c701ae..b487c269 100644 --- a/app/controllers/reports/daily_sale_controller.rb +++ b/app/controllers/reports/daily_sale_controller.rb @@ -1,21 +1,9 @@ class Reports::DailySaleController < BaseReportController - 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 index from, to = get_date_range_from_params @sale_data = Sale.get_receipt_no_list(from,to) @sale_data = Kaminari.paginate_array(@sale_data).page(params[:page]).per(50) -end + end end \ No newline at end of file diff --git a/app/controllers/settings/sales_controller.rb b/app/controllers/settings/sales_controller.rb index 6bb58244..aabc2282 100644 --- a/app/controllers/settings/sales_controller.rb +++ b/app/controllers/settings/sales_controller.rb @@ -5,23 +5,13 @@ class Settings::SalesController < ApplicationController receipt_no = params[:receipt_no] today = Date.today - if receipt_no.nil? && search_date.nil? - @sales = Sale.where("NOT sale_status = 'void'" ).order("sale_id desc").limit(500) + if receipt_no.nil? + @sales = Sale.order("sale_id").page(params[:page]) + #@products = Product.order("name").page(params[:page]).per(5) else - if !search_date.blank? && receipt_no.blank? - sale = Sale.where("DATE_FORMAT(receipt_date,'%Y-%b-%d') = ?", search_date).order("sale_id desc").limit(500).page(params[:page]) - elsif !search_date.blank? && !receipt_no.blank? - sale = Sale.where("receipt_no LIKE ? or DATE_FORMAT(receipt_date,'%Y-%b-%d') = ?", "%#{receipt_no}%", search_date).order("sale_id desc").limit(500).page(params[:page]) - else - sale = Sale.where("receipt_no LIKE ?", receipt_no).order("sale_id desc").limit(500).page(params[:page]) - end - if sale.count > 0 - @sales = sale - else - @sales = Sale.where("NOT sale_status = 'void'").order("sale_id desc").limit(500) - end + @sales = Sale.where("receipt_no LIKE ?", "%#{receipt_no}%").order("receipt_no").page(params[:page]) end - @sales = Kaminari.paginate_array(@sales).page(params[:page]).per(50) + #@sales = Kaminari.paginate_array(@sales).page(params[:page]).per(50) respond_to do |format| format.html # index.html.erb format.json { render json: @sales } diff --git a/app/models/sale.rb b/app/models/sale.rb index 52625917..b9ce13d2 100644 --- a/app/models/sale.rb +++ b/app/models/sale.rb @@ -258,6 +258,14 @@ class Sale < ApplicationRecord end end + def self.search(search) + if search + find(:all, :conditions => ['receipt_no LIKE ?', "%#{search}%"]) + else + find(:all) + end + end + private def generate_custom_id diff --git a/app/models/sale_payment.rb b/app/models/sale_payment.rb index 894592b5..72260344 100644 --- a/app/models/sale_payment.rb +++ b/app/models/sale_payment.rb @@ -66,9 +66,9 @@ class SalePayment < ApplicationRecord end - def self.get_paypar_account(url,token,membership_id,campaign_type_id,merchant_uid) + def self.get_paypar_account(url,token,membership_id,campaign_type_id,merchant_uid,auth_token) response = HTTParty.get(url, - :body => { app_token: token,membership_id:membership_id,campaign_type_id:campaign_type_id,merchant_uid:merchant_uid}.to_json, + :body => { app_token: token,membership_id:membership_id,campaign_type_id:campaign_type_id,merchant_uid:merchant_uid,auth_token:auth_token}.to_json, :headers => { 'Content-Type' => 'application/json', 'Accept' => 'application/json' @@ -83,11 +83,12 @@ class SalePayment < ApplicationRecord if !membership_actions_data.nil? url = paypar_url.to_s + membership_actions_data.gateway_url.to_s merchant_uid = membership_actions_data.merchant_account_id + auth_token = membership_actions_data.auth_token campaign_type_id = membership_actions_data.additional_parameter["campaign_type_id"] sale_data = Sale.find_by_sale_id(sale_id) if sale_data response = HTTParty.post(url, - :body => { generic_customer_id:membership_id,redeem_amount:received_amount,receipt_no:sale_data.receipt_no,campaign_type_id:campaign_type_id,account_no:"",merchant_uid:merchant_uid}.to_json, + :body => { generic_customer_id:membership_id,redeem_amount:received_amount,receipt_no:sale_data.receipt_no,campaign_type_id:campaign_type_id,account_no:"",merchant_uid:merchant_uid,auth_token:auth_token}.to_json, :headers => { 'Content-Type' => 'application/json', 'Accept' => 'application/json' diff --git a/app/views/crm/customers/show.html.erb b/app/views/crm/customers/show.html.erb index df1184b7..62ebf9c0 100644 --- a/app/views/crm/customers/show.html.erb +++ b/app/views/crm/customers/show.html.erb @@ -26,6 +26,9 @@ Contact no Company Date Of Birth + Membership Account + Balance + Type @@ -36,7 +39,11 @@ <%= @crm_customer.contact_no %> <%= @crm_customer.company %> <%= @crm_customer.date_of_birth %> - + <%= @balance %> + <%= @type %> + <% +puts "hhhhhhhhhhhhhhhhhhhhh" + puts @member_data.to_json %> diff --git a/app/views/origami/customers/index.html.erb b/app/views/origami/customers/index.html.erb index bb3c96e6..6fa5ae03 100644 --- a/app/views/origami/customers/index.html.erb +++ b/app/views/origami/customers/index.html.erb @@ -14,7 +14,7 @@
-
+
@@ -38,7 +38,6 @@ Company Contact no Email - Date of Birth @@ -51,10 +50,7 @@ <%= crm_customer.company rescue '-' %> <%= crm_customer.contact_no %> <%= crm_customer.email %> - - <%= crm_customer.date_of_birth rescue '-' %> - - + <% end %> @@ -68,7 +64,7 @@
-
+
<%= simple_form_for @crm_customer,:url => crm_customers_path, :method => :post do |f| %> @@ -92,27 +88,32 @@
- - <%= f.text_field :date_of_birth,:class=>"form-control datepicker"%> + + <%= f.text_field :date_of_birth,:class=>"form-control datepicker"%> +
+ +
+ + +
+ +
+ <%= f.button :submit, "Submit",:class => 'btn btn-primary ', :id => 'submit_customer' %> + +
+ <%end%> +
+ - -
- - -
- -
- <%= f.button :submit, "Submit",:class => 'btn btn-primary ', :id => 'submit_customer' %> - -
- <%end%> -
@@ -197,7 +198,7 @@ success: function(data) { if(data.status == true) { - alert('Customer has assigned'); + window.location.href = '/origami' }else{ alert('Record not found!'); diff --git a/app/views/origami/home/index.html.erb b/app/views/origami/home/index.html.erb index 24410ef8..f9356f68 100644 --- a/app/views/origami/home/index.html.erb +++ b/app/views/origami/home/index.html.erb @@ -297,9 +297,7 @@

Customer :

-
-

Amount :

-
+
@@ -373,6 +371,9 @@ + + +
Grand Total: <%=@selected_item.grand_total rescue 0%>
diff --git a/app/views/origami/redeem_payments/index.html.erb b/app/views/origami/redeem_payments/index.html.erb index 7936e66a..9ae576d4 100644 --- a/app/views/origami/redeem_payments/index.html.erb +++ b/app/views/origami/redeem_payments/index.html.erb @@ -5,14 +5,14 @@
- +

- +
0.0

diff --git a/app/views/reports/_shift_sale_report_filter.html.erb b/app/views/reports/_shift_sale_report_filter.html.erb new file mode 100644 index 00000000..1b4082f5 --- /dev/null +++ b/app/views/reports/_shift_sale_report_filter.html.erb @@ -0,0 +1,211 @@ +
+
+ <%= form_tag report_path, :method => :get, :id=>"frm_report", :class => "form" do %> + <% if period_type != false %> +
+
+ + +
+
+ + +
+
+ + + +
+
+ + +
+
+ +
+
+ <% end %> + + + +
+
+ <% if defined? promotions %> + <%= select_tag "promotion", options_for_select(@promotions, :selected => params[:promotion_type]), :class => "form-control" %> + <% end %> + + <% if defined? menu_types %> + <%= select_tag "menu_type", options_for_select(@menu_types, :selected => params[:menu_type]), :class => "form-control" %> + <% end %> + + <% if defined? payments %> + <%= select_tag "payment_type", options_for_select(@payments, :selected => params[:payment_type]), :class => "form-control" %> + <% end %> + + <% if defined? shift_name %> + + <% end %> + + <% if defined? cashiers %> + <%= select_tag "cashier", options_from_collection_for_select(@cashiers,"id","name"),:prompt => "All Cashier Stations", :class => "form-control" %> + <% end %> + + <% if defined? singer %> + <%= select_tag "singer", options_from_collection_for_select(singer,"id","name"),:prompt => "All Vocal List", :class => "form-control" %> + <% end %> + + <% if defined? bsm %> + <%= select_tag "singer", options_from_collection_for_select(bsm,"id","name"),:prompt => "All BSM List", :class => "form-control" %> + <% end %> + + <% if defined? guest_role %> + <%= select_tag "guest_role", options_from_collection_for_select(@guest_role,"id","name"),:prompt => "Vocal/BSM List", :class => "form-control" %> + <% end %> + + <% if defined? list_by_payment_type %> + <%= select_tag "payment_type_list", options_for_select(@payment_list, :selected => params[:payment_type_list]), :class => "form-control" %> + <% end %> + + <% if defined? products %> + <%= select_tag "product", options_from_collection_for_select(@products,"id","name"),:prompt => "All Products", :class => "form-control" %> + <% end %> + + <% if defined? items %> + <%= select_tag "item", options_for_select(@items, :selected => params[:item_type]), :class => "form-control" %> + <% end %> +
+
+ + + + <% end %> +
+
+ + + + \ 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 deleted file mode 100644 index 8cac8b64..00000000 --- a/app/views/reports/receipt_no/_shift_sale_report_filter.html.erb +++ /dev/null @@ -1,247 +0,0 @@ -<%= form_tag report_path, :method => :get, :id=>"frm_report" do %> -
-
-
- <% if defined? product_account %> - <%= select_tag "account", options_from_collection_for_select(@accounts,"id","title", :selected => params[:account])%> - <% end %> - <% if defined? shift_product_account %> - <%= select_tag "account", options_from_collection_for_select(@accounts,"id","title", :selected => params[:account]), :prompt => 'All Group'%> - <% end %> -
- -
- <% if period_type != false %> - - - <% end %> -
- -
-
- Export to Excel - - -
-
-
-
- -
- -
-
- <% if defined? show_sale_type %> - - <% end %> - - <% if defined? promotions %> - <%= select_tag "promotion", options_for_select(@promotions, :selected => params[:promotion_type]) %> - <% end %> - - <% if defined? menu_types %> - <%= select_tag "menu_type", options_for_select(@menu_types, :selected => params[:menu_type]) %> - <% end %> - - <% if defined? payments %> - <%= select_tag "payment_type", options_for_select(@payments, :selected => params[:payment_type]) %> - <% end %> - - <% if defined? shift_name %> - - <% end %> - <% if defined? cashiers %> - <%= select_tag "cashier", options_from_collection_for_select(@cashiers,"id","name"),:prompt => "All Cashier Stations" %> - <% end %> - - <% if defined? singer %> - <%= select_tag "singer", options_from_collection_for_select(singer,"id","name"),:prompt => "All Vocal List" %> - <% end %> - - <% if defined? bsm %> - <%= select_tag "singer", options_from_collection_for_select(bsm,"id","name"),:prompt => "All BSM List" %> - <% end %> - - <% if defined? guest_role %> - <%= select_tag "guest_role", options_from_collection_for_select(@guest_role,"id","name"),:prompt => "Vocal/BSM List" %> - <% end %> - - <% if defined? list_by_payment_type %> - <%= select_tag "payment_type_list", options_for_select(@payment_list, :selected => params[:payment_type_list]) %> - <% end %> - - <% if defined? products %> - <%= select_tag "product", options_from_collection_for_select(@products,"id","name"),:prompt => "All Products" %> - <% end %> - <% if defined? items %> - <%= select_tag "item", options_for_select(@items, :selected => params[:item_type]) %> - <% end %> -
- -
- - -
- To     - -
-
- - - <% if defined? show_monthly %> -
- -
- - - -
-
- <% end %> - -
- -
-
- -<% end %> - - \ No newline at end of file diff --git a/app/views/reports/receipt_no/index.html.erb b/app/views/reports/receipt_no/index.html.erb index 91c489b1..9d5c4f88 100644 --- a/app/views/reports/receipt_no/index.html.erb +++ b/app/views/reports/receipt_no/index.html.erb @@ -2,49 +2,63 @@
-
- - - - - - - - - - - - - - - - <% total_sales = 0 %> - <% net_sales = 0 %> - <% @sale_data.each do |sale| %> - <% total_sales = sale.total_amount.to_f - sale.total_discount.to_f%> - <% net_sales = total_sales.to_f + sale.total_tax.to_f%> - - - - - - - - - - - <% end %> - -
DateReceipt NoCashier NameGross SalesDiscountTotal SalesCTNett Sales
<%= sale.receipt_date.strftime("#{sale.receipt_date.day.ordinalize} %b") rescue '-' %><%=sale.receipt_no.to_s rescue ''%><%=sale.cashier_id rescue ''%><%= number_with_delimiter(sprintf("%.2f",sale.total_amount.to_f), :delimiter => ',') %><%= number_with_delimiter(sprintf("%.2f",sale.total_discount.to_f), :delimiter => ',') %><%= number_with_delimiter(sprintf("%.2f",total_sales.to_f), :delimiter => ',') %><%= number_with_delimiter(sprintf("%.2f",sale.total_tax.to_f), :delimiter => ',') %><%= number_with_delimiter(sprintf("%.2f",net_sales.to_f), :delimiter => ',') %>
+
+ <%= render :partial=>'shift_sale_report_filter', + :locals=>{ :period_type => true, :shift_name => false, :report_path =>reports_receipt_no_index_path} %> +
+ +
+
+ +
+
+ +
+
+ + + + + + + + + + + + + + + + <% total_sales = 0 %> + <% net_sales = 0 %> + <% @sale_data.each do |sale| %> + <% total_sales = sale.total_amount.to_f - sale.total_discount.to_f%> + <% net_sales = total_sales.to_f + sale.total_tax.to_f%> + + + + + + + + + + + <% end %> + +
DateReceipt NoCashier NameGross SalesDiscountTotal SalesCTNett Sales
<%= sale.receipt_date.strftime("#{sale.receipt_date.day.ordinalize} %b") rescue '-' %><%=sale.receipt_no.to_s rescue ''%><%=sale.cashier_id rescue ''%><%= number_with_delimiter(sprintf("%.2f",sale.total_amount.to_f), :delimiter => ',') %><%= number_with_delimiter(sprintf("%.2f",sale.total_discount.to_f), :delimiter => ',') %><%= number_with_delimiter(sprintf("%.2f",total_sales.to_f), :delimiter => ',') %><%= number_with_delimiter(sprintf("%.2f",sale.total_tax.to_f), :delimiter => ',') %><%= number_with_delimiter(sprintf("%.2f",net_sales.to_f), :delimiter => ',') %>
+
+
+ <%= paginate @sale_data %> + diff --git a/config/routes.rb b/config/routes.rb index c4592d6d..6bfe588e 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -95,11 +95,11 @@ Rails.application.routes.draw do get 'sale/:sale_id/payment/others_payment/MPU' => "mpu#index" post 'payment/mpu' => "mpu#create" - get 'sale/:sale_id/payment/others_payment/REDEEM' => "redeem_payments#index" + get 'sale/:sale_id/payment/others_payment/Redeem' => "redeem_payments#index" #---------Add Customer --------------# #resources :customers - get '/:sale_id/add_customer', to: "customers#add_customer" + get '/:sale_id/customers', to: "customers#add_customer" get '/:customer_id/get_customer' => 'home#get_customer' post '/:sale_id/update_sale' , to: "home#update_sale_by_customer"#update customer id in sale table end diff --git a/db/seeds.rb b/db/seeds.rb index 3f2621a8..d47decef 100644 --- a/db/seeds.rb +++ b/db/seeds.rb @@ -145,18 +145,18 @@ crm_order_printer=PrintSetting.create({name: "CRM Order", unique_code: "CrmOrder member_setting = MembershipSetting.create({membership_type:"paypar_url",gateway_url: "http://192.168.1.47:3006",merchant_account_id:"vWSsseoZCzxd6xcNf_uS"}) -member_actions= MembershipAction.create([{membership_type:"get_account_balance",gateway_url:"/api/membership_campaigns/get_correspond_account_data",additional_parameter:{campaign_type_id:1},merchant_account_id:"vWSsseoZCzxd6xcNf_uS"}, - {membership_type:"redeem",gateway_url:"/api/membership_campaigns/redeem",additional_parameter:{campaign_type_id:1},merchant_account_id:"vWSsseoZCzxd6xcNf_uS"}, - {membership_type:"create_membership_customer",gateway_url:"/api/generic_customer/create_membership_customer",merchant_account_id:"vWSsseoZCzxd6xcNf_uS"}, - {membership_type:"update_membership_customer",gateway_url:"/api/generic_customer/update_membership_customer",merchant_account_id:"vWSsseoZCzxd6xcNf_uS"}, - {membership_type:"get_all_member_group",gateway_url:"/api/member_group/get_all_member_group",merchant_account_id:"vWSsseoZCzxd6xcNf_uS"}, - {membership_type:"rebate",gateway_url:"/api/membership_campaigns/rebate",additional_parameter:{campaign_type_id:1},merchant_account_id:"vWSsseoZCzxd6xcNf_uS"}, - {membership_type:"get_all_member_account",gateway_url:"/api/generic_customer/get_membership_data",merchant_account_id:"vWSsseoZCzxd6xcNf_uS"} +member_actions= MembershipAction.create([{membership_type:"get_account_balance",gateway_url:"/api/membership_campaigns/get_correspond_account_data",additional_parameter:{campaign_type_id:1},merchant_account_id:"vWSsseoZCzxd6xcNf_uS",auth_token:"code2lab"}, + {membership_type:"redeem",gateway_url:"/api/membership_campaigns/redeem",additional_parameter:{campaign_type_id:1},merchant_account_id:"vWSsseoZCzxd6xcNf_uS",auth_token:"code2lab"}, + {membership_type:"create_membership_customer",gateway_url:"/api/generic_customer/create_membership_customer",merchant_account_id:"vWSsseoZCzxd6xcNf_uS",auth_token:"code2lab"}, + {membership_type:"update_membership_customer",gateway_url:"/api/generic_customer/update_membership_customer",merchant_account_id:"vWSsseoZCzxd6xcNf_uS",auth_token:"code2lab"}, + {membership_type:"get_all_member_group",gateway_url:"/api/member_group/get_all_member_group",merchant_account_id:"vWSsseoZCzxd6xcNf_uS",auth_token:"code2lab"}, + {membership_type:"rebate",gateway_url:"/api/membership_campaigns/rebate",additional_parameter:{campaign_type_id:1},merchant_account_id:"vWSsseoZCzxd6xcNf_uS",auth_token:"code2lab"}, + {membership_type:"get_all_member_account",gateway_url:"/api/generic_customer/get_membership_data",merchant_account_id:"vWSsseoZCzxd6xcNf_uS",auth_token:"code2lab"} ]) payment_methods = PaymentMethodSetting.create({payment_method:"MPU",gateway_url: "http//192.168.1.47:3006"}) -payment_methods = PaymentMethodSetting.create({payment_method:"REDEEM",gateway_url: "http://192.168.1.47:3006",merchant_account_id:"vWSsseoZCzxd6xcNf_uS"}) +payment_methods = PaymentMethodSetting.create({payment_method:"Redeem",gateway_url: "http://192.168.1.47:3006",merchant_account_id:"vWSsseoZCzxd6xcNf_uS"}) # shop = Shop.create(