Merge branch 'adminbsb_material_ui'
This commit is contained in:
@@ -164,6 +164,7 @@ class Origami::PaymentsController < BaseOrigamiController
|
|||||||
|
|
||||||
if customer.membership_id != nil && rebate && credit_data.nil?
|
if customer.membership_id != nil && rebate && credit_data.nil?
|
||||||
member_info = Customer.get_member_account(customer)
|
member_info = Customer.get_member_account(customer)
|
||||||
|
|
||||||
if member_info["status"] == true
|
if member_info["status"] == true
|
||||||
rebate_amount = Customer.get_membership_transactions(customer,saleObj.receipt_no)
|
rebate_amount = Customer.get_membership_transactions(customer,saleObj.receipt_no)
|
||||||
current_balance = SaleAudit.paymal_search(sale_id)
|
current_balance = SaleAudit.paymal_search(sale_id)
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
class Reports::ReceiptNoController < BaseReportController
|
class Reports::ReceiptNoController < BaseReportController
|
||||||
authorize_resource :class => false
|
authorize_resource :class => false
|
||||||
def index
|
def index
|
||||||
@payments = [["All Payment",''], ["Cash Payment","cash"], ["Credit Payment","creditnote"], ["FOC Payment","foc"], ["Other Payment","card"]]
|
@payments = [["All Payment",''], ["Cash Payment","cash"], ["Credit Payment","creditnote"], ["FOC Payment","foc"]]
|
||||||
|
@payment_method = PaymentMethodSetting.all
|
||||||
from, to = get_date_range_from_params
|
from, to = get_date_range_from_params
|
||||||
|
|
||||||
@shift_sale_range = ''
|
@shift_sale_range = ''
|
||||||
|
|||||||
@@ -1027,11 +1027,11 @@ def self.get_shift_sales_by_receipt_no(shift_sale_range,shift,from,to,payment_ty
|
|||||||
if payment_type.blank?
|
if payment_type.blank?
|
||||||
payment_type = ''
|
payment_type = ''
|
||||||
else
|
else
|
||||||
if payment_type == 'card'
|
# if payment_type == 'card'
|
||||||
payment_type = " and sale_payments.payment_method = 'mpu' or sale_payments.payment_method = 'visa' or sale_payments.payment_method = 'master' or sale_payments.payment_method = 'jcb' or sale_payments.payment_method = 'paypar' or sale_payments.payment_method = 'unionpay' or sale_payments.payment_method = 'alipay' or sale_payments.payment_method = 'paymal' or sale_payments.payment_method = 'dinga' or sale_payments.payment_method = 'JunctionPay'"
|
# payment_type = " and sale_payments.payment_method = 'mpu' or sale_payments.payment_method = 'visa' or sale_payments.payment_method = 'master' or sale_payments.payment_method = 'jcb' or sale_payments.payment_method = 'paypar' or sale_payments.payment_method = 'unionpay' or sale_payments.payment_method = 'alipay' or sale_payments.payment_method = 'paymal' or sale_payments.payment_method = 'dinga' or sale_payments.payment_method = 'JunctionPay'"
|
||||||
else
|
# else
|
||||||
payment_type = " and sale_payments.payment_method = '#{payment_type}'"
|
payment_type = " and sale_payments.payment_method = '#{payment_type}'"
|
||||||
end
|
# end
|
||||||
end
|
end
|
||||||
|
|
||||||
query = Sale.all
|
query = Sale.all
|
||||||
@@ -1093,37 +1093,33 @@ def self.get_total_spoile(shift_id)
|
|||||||
end
|
end
|
||||||
|
|
||||||
def self.get_separate_tax(shift_sale_range=nil,shift,from,to,payment_type)
|
def self.get_separate_tax(shift_sale_range=nil,shift,from,to,payment_type)
|
||||||
|
if payment_type.blank?
|
||||||
|
payment_type = ''
|
||||||
|
else
|
||||||
|
payment_type = " and sale_payments.payment_method = '#{payment_type}'"
|
||||||
|
end
|
||||||
|
|
||||||
# wrong amount tax for service and commercial tax
|
if payment_type == ''
|
||||||
|
|
||||||
# if payment_type.blank?
|
|
||||||
# payment_type = ''
|
|
||||||
# else
|
|
||||||
# if payment_type == 'card'
|
|
||||||
# payment_type = " and sale_payments.payment_method = 'mpu' or sale_payments.payment_method = 'visa' or sale_payments.payment_method = 'master' or sale_payments.payment_method = 'jcb' or sale_payments.payment_method = 'paypar' or sale_payments.payment_method = 'unionpay' or sale_payments.payment_method = 'alipay' or sale_payments.payment_method = 'paymal' or sale_payments.payment_method = 'dinga' or sale_payments.payment_method = 'JunctionPay'"
|
|
||||||
# else
|
|
||||||
# payment_type = " and sale_payments.payment_method = '#{payment_type}'"
|
|
||||||
# end
|
|
||||||
# end
|
|
||||||
|
|
||||||
if shift.present?
|
|
||||||
query = SaleTax.select("SUM(tax_payable_amount) AS st_amount,tax_name")
|
query = SaleTax.select("SUM(tax_payable_amount) AS st_amount,tax_name")
|
||||||
.joins("LEFT JOIN sales ON sales.sale_id = sale_taxes.sale_id")
|
.where("sale_status= 'completed'")
|
||||||
.where("sales.shift_sale_id in (?) and sale_status= 'completed'", shift.to_a)
|
.joins("LEFT JOIN sales ON sales.sale_id = sale_taxes.sale_id")
|
||||||
.group("sale_taxes.tax_name")
|
.group("sale_taxes.tax_name")
|
||||||
.order("sale_taxes.tax_name desc")
|
.order("sale_taxes.tax_name desc")
|
||||||
elsif shift_sale_range.present?
|
|
||||||
query = SaleTax.select("SUM(tax_payable_amount) AS st_amount,tax_name")
|
|
||||||
.joins("LEFT JOIN sales ON sales.sale_id = sale_taxes.sale_id")
|
|
||||||
.where("sales.shift_sale_id in (?) and sale_status= 'completed'", shift_sale_range.to_a)
|
|
||||||
.group("sale_taxes.tax_name")
|
|
||||||
.order("sale_taxes.tax_name desc")
|
|
||||||
else
|
else
|
||||||
query = SaleTax.select("SUM(tax_payable_amount) AS st_amount,tax_name")
|
query = SaleTax.select("SUM(tax_payable_amount) AS st_amount,tax_name")
|
||||||
.joins("LEFT JOIN sales ON sales.sale_id = sale_taxes.sale_id")
|
.joins("LEFT JOIN sales ON sales.sale_id = sale_taxes.sale_id")
|
||||||
.where("sales.receipt_date between ? and ? and sale_status= 'completed'", from,to)
|
.joins("JOIN sale_payments ON sale_taxes.sale_id = sale_payments.sale_id")
|
||||||
.group("sale_taxes.tax_name")
|
.where("sale_status= 'completed'#{payment_type} and sale_payments.payment_amount!=0")
|
||||||
.order("sale_taxes.tax_name desc")
|
.group("sale_taxes.tax_name")
|
||||||
|
.order("sale_taxes.tax_name desc")
|
||||||
|
end
|
||||||
|
|
||||||
|
if shift.present?
|
||||||
|
query = query.where("sales.shift_sale_id in (?) ", shift.to_a)
|
||||||
|
elsif shift_sale_range.present?
|
||||||
|
query = query.where("sales.shift_sale_id in (?) ", shift_sale_range.to_a)
|
||||||
|
else
|
||||||
|
query = query.where("sales.receipt_date between ? and ? ", from,to)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@@ -19,10 +19,19 @@
|
|||||||
</select>
|
</select>
|
||||||
</div>
|
</div>
|
||||||
<% if defined? payments %>
|
<% if defined? payments %>
|
||||||
<!-- <div class="col-lg-2 col-md-2 col-sm-2">
|
|
||||||
|
<div class="col-lg-2 col-md-2 col-sm-2">
|
||||||
<label class="font-14"><%= t("views.right_panel.detail.select_payments") %></label>
|
<label class="font-14"><%= t("views.right_panel.detail.select_payments") %></label>
|
||||||
<%= select_tag "payment_type", options_for_select(@payments, :selected => params[:payment_type]), :class => "form-control" %>
|
|
||||||
</div> -->
|
<select name="payment_type" id="payment_type" class="form-control">
|
||||||
|
<% @payments.each do |pm| %>
|
||||||
|
<option class="<%=pm[1].downcase%>" value="<%=pm[1].downcase%>"><%=pm[0]%></option>
|
||||||
|
<%end %>
|
||||||
|
<% @payment_method.each do |pm| %>
|
||||||
|
<option value="<%=pm.payment_method%>" class="<%=pm.payment_method%>" > <%=pm.payment_method%></option>
|
||||||
|
<%end %>
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
<% end %>
|
<% end %>
|
||||||
<div class="col-lg-2 col-md-2 col-sm-2">
|
<div class="col-lg-2 col-md-2 col-sm-2">
|
||||||
<!-- <label class="">Select Shift Period</label> -->
|
<!-- <label class="">Select Shift Period</label> -->
|
||||||
@@ -92,6 +101,9 @@
|
|||||||
$("#to").val("<%=params[:to] rescue '-'%>");
|
$("#to").val("<%=params[:to] rescue '-'%>");
|
||||||
$("#sel_period").val(<%=params[:period] rescue '-'%>);
|
$("#sel_period").val(<%=params[:period] rescue '-'%>);
|
||||||
$("#sel_sale_type").val(<%=params[:sale_type] rescue '-'%>);
|
$("#sel_sale_type").val(<%=params[:sale_type] rescue '-'%>);
|
||||||
|
|
||||||
|
$(".<%=params[:payment_type]%>").attr('selected','selected')
|
||||||
|
|
||||||
// shift = $(".shift-id").text()
|
// shift = $(".shift-id").text()
|
||||||
// if (shift.length>0) {
|
// if (shift.length>0) {
|
||||||
// $('.shift_name > option[value="'+shift+'"]').attr('selected','selected');
|
// $('.shift_name > option[value="'+shift+'"]').attr('selected','selected');
|
||||||
|
|||||||
Reference in New Issue
Block a user