foc qty error fixed
This commit is contained in:
@@ -18,13 +18,13 @@ class Customer < ApplicationRecord
|
|||||||
paginates_per 50
|
paginates_per 50
|
||||||
|
|
||||||
def self.get_member_account(customer)
|
def self.get_member_account(customer)
|
||||||
membership = MembershipSetting.find_by_membership_type("paypar_url")
|
membership = MembershipSetting.active.find_by_membership_type("paypar_url")
|
||||||
memberaction = MembershipAction.find_by_membership_type("get_all_member_account")
|
memberaction = MembershipAction.active.find_by_membership_type("get_all_member_account")
|
||||||
merchant_uid = memberaction.merchant_account_id.to_s
|
merchant_uid = memberaction.merchant_account_id.to_s
|
||||||
auth_token = memberaction.auth_token.to_s
|
auth_token = memberaction.auth_token.to_s
|
||||||
url = membership.gateway_url.to_s + memberaction.gateway_url.to_s
|
url = membership.gateway_url.to_s + memberaction.gateway_url.to_s
|
||||||
# urltest =self.url_exist?(url)
|
# urltest =self.url_exist?(url)
|
||||||
|
if !membership.nil? && !memberaction.nil?
|
||||||
begin
|
begin
|
||||||
response = HTTParty.get(url, :body => {
|
response = HTTParty.get(url, :body => {
|
||||||
membership_id: customer.membership_id,
|
membership_id: customer.membership_id,
|
||||||
@@ -49,6 +49,9 @@ class Customer < ApplicationRecord
|
|||||||
rescue SocketError
|
rescue SocketError
|
||||||
response = { status: false, message: "Can't connect server"}
|
response = { status: false, message: "Can't connect server"}
|
||||||
end
|
end
|
||||||
|
else
|
||||||
|
response = {status: false, message: "There is no membership setting."}
|
||||||
|
end
|
||||||
Rails.logger.debug "--------Get Member Account response -------"
|
Rails.logger.debug "--------Get Member Account response -------"
|
||||||
Rails.logger.debug response.to_json
|
Rails.logger.debug response.to_json
|
||||||
return response;
|
return response;
|
||||||
|
|||||||
@@ -180,10 +180,10 @@ class SaleItem < ApplicationRecord
|
|||||||
def self.get_all_sale_items(sale_id)
|
def self.get_all_sale_items(sale_id)
|
||||||
sale_items = SaleItem.select("sale_id,product_code,item_instance_code,
|
sale_items = SaleItem.select("sale_id,product_code,item_instance_code,
|
||||||
product_name,product_alt_name,account_id,status,remark,
|
product_name,product_alt_name,account_id,status,remark,
|
||||||
(CASE WHEN (qty > 0 AND remark IS NULL) OR (qty < 0 AND status = 'foc') OR (qty < 0 AND status='Discount') OR (status='promotion' AND (remark='promotion' OR remark = 'promotion nett price' OR remark= 'promotion discount')) THEN SUM(qty) ELSE qty END) as qty,
|
(CASE WHEN (qty > 0 AND remark IS NULL) OR (qty > 0 AND status='foc') OR (qty < 0 AND status = 'foc') OR (qty < 0 AND status='Discount') OR (status='promotion' AND (remark='promotion' OR remark = 'promotion nett price' OR remark= 'promotion discount')) THEN SUM(qty) ELSE qty END) as qty,
|
||||||
unit_price,
|
unit_price,
|
||||||
taxable_price,
|
taxable_price,
|
||||||
(CASE WHEN (price > 0 AND remark IS NULL) OR (qty < 0 AND status = 'foc') OR (price < 0 AND status='Discount') OR (status='promotion' AND (remark='promotion' OR remark = 'promotion nett price' OR remark= 'promotion discount')) THEN SUM(price) ELSE price END) as price,
|
(CASE WHEN (price > 0 AND remark IS NULL) OR (qty > 0 AND status='foc') OR (qty < 0 AND status = 'foc') OR (price < 0 AND status='Discount') OR (status='promotion' AND (remark='promotion' OR remark = 'promotion nett price' OR remark= 'promotion discount')) THEN SUM(price) ELSE price END) as price,
|
||||||
is_taxable")
|
is_taxable")
|
||||||
.where("sale_id = ?",sale_id)
|
.where("sale_id = ?",sale_id)
|
||||||
.order("product_name asc")
|
.order("product_name asc")
|
||||||
|
|||||||
@@ -721,7 +721,6 @@ $(document).ready(function(){
|
|||||||
var sale_id = $('#sale_id').text();
|
var sale_id = $('#sale_id').text();
|
||||||
window.location.replace('/origami/sale/'+sale_id+'/cashier/payment');
|
window.location.replace('/origami/sale/'+sale_id+'/cashier/payment');
|
||||||
}
|
}
|
||||||
|
|
||||||
/* replace url type*/
|
/* replace url type*/
|
||||||
/* start check first bill or not*/
|
/* start check first bill or not*/
|
||||||
var member_id = $('#membership_id').text();
|
var member_id = $('#membership_id').text();
|
||||||
@@ -1125,6 +1124,8 @@ $(document).ready(function(){
|
|||||||
<% else %>
|
<% else %>
|
||||||
$('#balance').text(parseFloat(result));
|
$('#balance').text(parseFloat(result));
|
||||||
<% end %>
|
<% end %>
|
||||||
|
|
||||||
|
show_hide_btn($('#balance').text());
|
||||||
}
|
}
|
||||||
|
|
||||||
function customer_display_view(data,status) {
|
function customer_display_view(data,status) {
|
||||||
@@ -1831,4 +1832,15 @@ $(document).ready(function(){
|
|||||||
}
|
}
|
||||||
},100);
|
},100);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
function show_hide_btn(balance) {
|
||||||
|
// show discount when balance is greater than 0
|
||||||
|
// if(parseFloat(balance) > 0){
|
||||||
|
// $("#discount").show();
|
||||||
|
// $("#edit").show();
|
||||||
|
// }else{
|
||||||
|
// $("#discount").hide();
|
||||||
|
// $("#edit").hide();
|
||||||
|
// }
|
||||||
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
Reference in New Issue
Block a user