update merge with admibbsb-materi for multiple set item and report
This commit is contained in:
@@ -315,6 +315,7 @@ $(function() {
|
|||||||
$(".options-list").empty();
|
$(".options-list").empty();
|
||||||
|
|
||||||
rowCount = $('.selected-instance');
|
rowCount = $('.selected-instance');
|
||||||
|
setCount = $('.selected-set');
|
||||||
item_options = $(this).data('option');
|
item_options = $(this).data('option');
|
||||||
|
|
||||||
min_qty = $(this).data('min-qty');
|
min_qty = $(this).data('min-qty');
|
||||||
@@ -335,19 +336,19 @@ $(function() {
|
|||||||
$(".options-list").append(row);
|
$(".options-list").append(row);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if($(this).hasClass('selected-instance') == true){
|
// if($(this).hasClass('selected-instance') == true){
|
||||||
sub_total = $('#set_total_price').text();
|
// sub_total = $('#set_total_price').text();
|
||||||
name = $(this).data('name');
|
// name = $(this).data('name');
|
||||||
price = $(this).data('price');
|
// price = $(this).data('price');
|
||||||
// qty = $('#set_change_qty').val();
|
// // qty = $('#set_change_qty').val();
|
||||||
qty = document.getElementById("set_count").value;
|
// qty = document.getElementById("set_count").value;
|
||||||
total = qty*price;
|
// total = qty*price;
|
||||||
var total_price = +sub_total - +total;
|
// var total_price = +sub_total - +total;
|
||||||
$(this).removeClass('selected-instance');
|
// $(this).removeClass('selected-instance');
|
||||||
$(".options-list").empty();
|
// $(".options-list").empty();
|
||||||
$(this).removeAttr('data-options');
|
// $(this).removeAttr('data-options');
|
||||||
$('#instance_option').text('')
|
// $('#instance_option').text('')
|
||||||
}else {
|
// }else {
|
||||||
if (rowCount.length+1 <= max_qty) {
|
if (rowCount.length+1 <= max_qty) {
|
||||||
sub_total = $('#set_total_price').text();
|
sub_total = $('#set_total_price').text();
|
||||||
name = $(this).data('name');
|
name = $(this).data('name');
|
||||||
@@ -358,12 +359,55 @@ $(function() {
|
|||||||
total = qty*price;
|
total = qty*price;
|
||||||
var total_price = +sub_total + +total;
|
var total_price = +sub_total + +total;
|
||||||
$(this).addClass('selected-instance');
|
$(this).addClass('selected-instance');
|
||||||
|
|
||||||
|
set = "<div class='selected-set card custom-card' style='margin-bottom:10px !important'"
|
||||||
|
+"' data-name='"+$(this).data('name')
|
||||||
|
+"' data-code='"+code
|
||||||
|
+"' data-price='"+$(this).data('price')
|
||||||
|
+"' data-option='"+JSON.stringify($(this).data('option'))
|
||||||
|
+"' data-min-qty='"+$(this).data('min-qty')
|
||||||
|
+"' data-max-qty='"+$(this).data('max-qty')
|
||||||
|
+"' data-parent-code='"+$(this).data('parent-code')
|
||||||
|
+"' data-parent-id='"+$(this).data('parent-id')
|
||||||
|
+"' data-sub-item='true"
|
||||||
|
+"'>"
|
||||||
|
|
||||||
|
+'<div class="card-block" style="background-color:#54A5AF;">'
|
||||||
|
+' <button type="button" class="close" id="remove_set" style="font-size: 20px;">×</button>'
|
||||||
|
+'<span style="color:#fff">'+$(this).data('name')+'</span>'
|
||||||
|
+'</div>'
|
||||||
|
+'<div class="card-block custom-card-block">'
|
||||||
|
|
||||||
|
+' <small style="float:" id="instance_option"></small>'
|
||||||
|
+'</div>'
|
||||||
|
// +'<div class="card-footer custom-card-footer">'
|
||||||
|
// +' <span>'+$(this).data('price')+'</span>'
|
||||||
|
// // +' <small style="float:right" id="instance_option"></small>'
|
||||||
|
// +'</div>'
|
||||||
|
+'</div>'
|
||||||
|
$(".selected-set-list").append(set);
|
||||||
|
}else{
|
||||||
|
swal("Alert !", 'Maximum Qty is ' + max_qty + " items", "warning");
|
||||||
}
|
}
|
||||||
}
|
// }
|
||||||
$('#set_unit_price').text(price);
|
$('#set_unit_price').text(price);
|
||||||
$('#set_total_price').text(total_price);
|
$('#set_total_price').text(total_price);
|
||||||
|
|
||||||
}); //End selecct attribute buttom
|
}); //End selecct attribute buttom
|
||||||
|
|
||||||
|
// click add order
|
||||||
|
$(document).on('click', '#remove_set', function(event){
|
||||||
|
code = $(this).parent().parent('.selected-set').attr('data-code');
|
||||||
|
instance = $(".selected-instance");
|
||||||
|
console.log(code)
|
||||||
|
$(instance).each(function(i){
|
||||||
|
if ($(instance[i]).attr('data-code')==code){
|
||||||
|
console.log($(instance[i]))
|
||||||
|
$(instance[i]).removeClass("selected-instance")
|
||||||
|
}
|
||||||
|
});
|
||||||
|
$(this).parent().parent('.selected-set').remove();
|
||||||
|
});
|
||||||
|
|
||||||
// click add order
|
// click add order
|
||||||
$(document).on('click', '.set_order', function(event){
|
$(document).on('click', '.set_order', function(event){
|
||||||
@@ -637,15 +681,17 @@ $(function() {
|
|||||||
|
|
||||||
|
|
||||||
if(group == "set_menu"){
|
if(group == "set_menu"){
|
||||||
|
option_arr = get_selected_attributes('selected-option');
|
||||||
instance = $(".selected-instance");
|
$(".selected-set:last").attr('data-options',JSON.stringify(option_arr));
|
||||||
$(instance).each(function(i){
|
$(".selected-set:last").children().children('#instance_option').text(option_arr);
|
||||||
if ($(instance[i]).attr('data-code')==code){
|
// instance = $(".selected-instance");
|
||||||
option_arr = get_selected_attributes('selected-option');
|
// $(instance).each(function(i){
|
||||||
$(instance[i]).attr('data-options',JSON.stringify(option_arr));
|
// if ($(instance[i]).attr('data-code')==code){
|
||||||
$(instance[i]).children().children('#instance_option').text(option_arr);
|
// option_arr = get_selected_attributes('selected-option');
|
||||||
}
|
// $(instance[i]).attr('data-options',JSON.stringify(option_arr));
|
||||||
});
|
// $(instance[i]).children().children('#instance_option').text(option_arr);
|
||||||
|
// }
|
||||||
|
// });
|
||||||
}
|
}
|
||||||
|
|
||||||
if(group == "set_menu_default"){
|
if(group == "set_menu_default"){
|
||||||
|
|||||||
@@ -32,6 +32,26 @@ $(document).ready(function() {
|
|||||||
railBorderRadius: '0',
|
railBorderRadius: '0',
|
||||||
touchScrollStep : 50
|
touchScrollStep : 50
|
||||||
});
|
});
|
||||||
|
|
||||||
|
$('#modal-slimscroll').slimScroll({
|
||||||
|
height: height-$('#modal-slimscroll').attr('data-height'),
|
||||||
|
size: '5px',
|
||||||
|
color: 'rgba(0,0,0,0.5)',
|
||||||
|
alwaysVisible: false,
|
||||||
|
borderRadius: '0',
|
||||||
|
railBorderRadius: '0',
|
||||||
|
touchScrollStep : 45
|
||||||
|
});
|
||||||
|
|
||||||
|
$('#modal-set-slimscroll').slimScroll({
|
||||||
|
height: height-$('#modal-slimscroll').attr('data-height'),
|
||||||
|
size: '5px',
|
||||||
|
color: 'rgba(0,0,0,0.5)',
|
||||||
|
alwaysVisible: false,
|
||||||
|
borderRadius: '0',
|
||||||
|
railBorderRadius: '0',
|
||||||
|
touchScrollStep : 45
|
||||||
|
});
|
||||||
|
|
||||||
// $('.delete').click(function(){
|
// $('.delete').click(function(){
|
||||||
// var method = $(this).attr('data-method');
|
// var method = $(this).attr('data-method');
|
||||||
|
|||||||
@@ -3,18 +3,26 @@ class Reports::SaleitemController < BaseReportController
|
|||||||
def index
|
def index
|
||||||
|
|
||||||
from, to = get_date_range_from_params
|
from, to = get_date_range_from_params
|
||||||
shift_sale_range = Sale.get_by_shift_sale(from,to,Sale::SALE_STATUS_COMPLETED)
|
|
||||||
|
shift_sale_range = ''
|
||||||
|
|
||||||
shift = ''
|
shift = ''
|
||||||
if params[:shift_name].to_i != 0
|
if params[:shift_name].to_i != 0
|
||||||
|
|
||||||
|
shift_sale_range = Sale.get_by_shift_sale_by_item(from,to,Sale::SALE_STATUS_COMPLETED)
|
||||||
|
|
||||||
shift_sale = ShiftSale.find(params[:shift_name])
|
shift_sale = ShiftSale.find(params[:shift_name])
|
||||||
if to.blank?
|
if to.blank?
|
||||||
shift = ShiftSale.where('shift_started_at = ? and shift_closed_at is NULL ',shift_sale.shift_started_at)
|
shift = ShiftSale.where('shift_started_at = ? and shift_closed_at is NULL ',shift_sale.shift_started_at)
|
||||||
else
|
else
|
||||||
|
if shift_sale.shift_closed_at.blank?
|
||||||
shift = ShiftSale.where('shift_started_at = ? and shift_closed_at = ? ',shift_sale.shift_started_at, shift_sale.shift_closed_at)
|
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
|
||||||
end
|
end
|
||||||
|
|
||||||
@type = params[:sale_type]
|
@type = params[:sale_type]
|
||||||
@sale_data, @other_charges,@discount_data , @cash_data , @card_data , @credit_data , @foc_data , @grand_total , @change_amount = Sale.get_by_shift_items(shift_sale_range,shift, from, to, Sale::SALE_STATUS_COMPLETED,@type)
|
@sale_data, @other_charges,@discount_data , @cash_data , @card_data , @credit_data , @foc_data , @grand_total , @change_amount = Sale.get_by_shift_items(shift_sale_range,shift, from, to, Sale::SALE_STATUS_COMPLETED,@type)
|
||||||
|
|
||||||
@@ -54,8 +62,8 @@ class Reports::SaleitemController < BaseReportController
|
|||||||
|
|
||||||
def show
|
def show
|
||||||
from, to, report_type = get_date_range_from_params
|
from, to, report_type = get_date_range_from_params
|
||||||
|
puts "aaaaaaaaaaaaaaaaaaaaaaaaaa"
|
||||||
@sale_data = Sale.get_by_shift_sale(from,to,Sale::SALE_STATUS_COMPLETED)
|
@sale_data = Sale.get_by_shift_sale_by_item(from,to,Sale::SALE_STATUS_COMPLETED)
|
||||||
|
|
||||||
date_arr = Array.new
|
date_arr = Array.new
|
||||||
@sale_data.each do |sale|
|
@sale_data.each do |sale|
|
||||||
@@ -68,8 +76,8 @@ class Reports::SaleitemController < BaseReportController
|
|||||||
date_arr.push(str)
|
date_arr.push(str)
|
||||||
end
|
end
|
||||||
|
|
||||||
@totalByAccount = Hash.new {|hash, key| hash[key] = 0}
|
# @totalByAccount = Hash.new {|hash, key| hash[key] = 0}
|
||||||
@sale_data.each {|acc| @totalByAccount[acc.account_id] += acc.grand_total}
|
# @sale_data.each {|acc| @totalByAccount[acc.account_id] += acc.grand_total}
|
||||||
|
|
||||||
out = {:status => 'ok', :message => date_arr}
|
out = {:status => 'ok', :message => date_arr}
|
||||||
|
|
||||||
|
|||||||
@@ -134,24 +134,36 @@ class License
|
|||||||
def verify_license
|
def verify_license
|
||||||
api_token = read_license_no_decrypt("api_token")
|
api_token = read_license_no_decrypt("api_token")
|
||||||
@params = { query: {lookup_type: "application", api_token: api_token} }
|
@params = { query: {lookup_type: "application", api_token: api_token} }
|
||||||
response = self.class.get("/verify", @params)
|
|
||||||
|
begin
|
||||||
|
response = self.class.get("/verify", @params)
|
||||||
|
@varified = response.parsed_response
|
||||||
|
Rails.logger.debug "License Remote Response - " + response.parsed_response.to_s
|
||||||
|
if (@varified["status"])
|
||||||
|
if (!check_expired(@varified["renewable_date"]))
|
||||||
|
return true
|
||||||
|
end
|
||||||
|
else
|
||||||
|
delete_license_file
|
||||||
|
end
|
||||||
|
|
||||||
rescue SocketError => e
|
rescue SocketError => e
|
||||||
Rails.logger.debug "In Socket errror"
|
Rails.logger.debug "In SocketError No Internet connection ! "
|
||||||
return true
|
return true
|
||||||
rescue => e
|
rescue HTTParty::Error
|
||||||
@varified = response.parsed_response
|
Rails.logger.debug "Server Error HTTParty"
|
||||||
Rails.logger.debug "License Remote Response - " + response.parsed_response.to_s
|
return true
|
||||||
if (@varified["status"])
|
rescue Net::OpenTimeout
|
||||||
if (!check_expired(@varified["renewable_date"]))
|
Rails.logger.debug "connection Timeout"
|
||||||
return true
|
return true
|
||||||
end
|
rescue OpenURI::HTTPError
|
||||||
else
|
Rails.logger.debug "Can't connect server"
|
||||||
delete_license_file
|
return true
|
||||||
end
|
end
|
||||||
return false
|
return false
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
# Check Expired before 30 days
|
# Check Expired before 30 days
|
||||||
def check_expiring(renewal_date_str)
|
def check_expiring(renewal_date_str)
|
||||||
if !renewal_date_str.empty?
|
if !renewal_date_str.empty?
|
||||||
@@ -164,7 +176,6 @@ class License
|
|||||||
def check_expired(renewal_date_str)
|
def check_expired(renewal_date_str)
|
||||||
expired_date_str = read_license("renewable_date")
|
expired_date_str = read_license("renewable_date")
|
||||||
renewal_date = DateTime.parse(renewal_date_str)
|
renewal_date = DateTime.parse(renewal_date_str)
|
||||||
|
|
||||||
if(renewal_date_str != expired_date_str)
|
if(renewal_date_str != expired_date_str)
|
||||||
update_license("renewable_date", renewal_date_str)
|
update_license("renewable_date", renewal_date_str)
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -806,6 +806,15 @@ def self.get_by_shift_sale(from,to,status)
|
|||||||
return query = query.where("shift_sales.shift_started_at >= ?" + " AND shift_sales.shift_closed_at <= ?", from,to)
|
return query = query.where("shift_sales.shift_started_at >= ?" + " AND shift_sales.shift_closed_at <= ?", from,to)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def self.get_by_shift_sale_by_item(from,to,status)
|
||||||
|
query = ShiftSale.select("shift_sales.id ,shift_started_at AS opening_date,
|
||||||
|
shift_closed_at As closing_date," +
|
||||||
|
" grand_total AS grand_total, cash_sales AS cash," +
|
||||||
|
"total_taxes AS total_tax,total_discounts As total_discount")
|
||||||
|
.order("shift_sales.id DESC")
|
||||||
|
return query = query.where("shift_sales.shift_started_at >= ?" , from)
|
||||||
|
end
|
||||||
|
|
||||||
def self.get_item_query(type)
|
def self.get_item_query(type)
|
||||||
|
|
||||||
if type == "revenue" || type.nil?
|
if type == "revenue" || type.nil?
|
||||||
|
|||||||
@@ -11,8 +11,8 @@
|
|||||||
<link rel="icon" href="favicon.ico" type="image/x-icon">
|
<link rel="icon" href="favicon.ico" type="image/x-icon">
|
||||||
|
|
||||||
<!-- Google Fonts -->
|
<!-- Google Fonts -->
|
||||||
<link href="https://fonts.googleapis.com/css?family=Roboto:400,700&subset=latin,cyrillic-ext" rel="stylesheet" type="text/css">
|
<!-- <link href="https://fonts.googleapis.com/css?family=Roboto:400,700&subset=latin,cyrillic-ext" rel="stylesheet" type="text/css">
|
||||||
<link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet" type="text/css">
|
<link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet" type="text/css">-->
|
||||||
|
|
||||||
<%= stylesheet_link_tag 'login', media: 'all', 'data-turbolinks-track': 'reload' %>
|
<%= stylesheet_link_tag 'login', media: 'all', 'data-turbolinks-track': 'reload' %>
|
||||||
|
|
||||||
|
|||||||
@@ -405,9 +405,15 @@
|
|||||||
<p class="hidden" id="set_item_code"></p>
|
<p class="hidden" id="set_item_code"></p>
|
||||||
<p></p>
|
<p></p>
|
||||||
|
|
||||||
<div class="options-list">
|
<div class="" id="modal-slimscroll" data-height="250">
|
||||||
|
<div class="options-list" style="margin-top:-5px">
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<div class='selected-set-list'>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
<div class="col-md-8">
|
<div class="col-md-8">
|
||||||
<div class="instance-list row"></div>
|
<div class="instance-list row"></div>
|
||||||
|
|||||||
@@ -325,7 +325,8 @@
|
|||||||
var str = '';
|
var str = '';
|
||||||
var param_shift = '<%= params[:shift_name]%>';
|
var param_shift = '<%= params[:shift_name]%>';
|
||||||
|
|
||||||
url = '<%= reports_get_shift_by_date_path %>';
|
url = '<%= reports_get_shift_by_sale_item_path %>';
|
||||||
|
console.log(url)
|
||||||
$.get(url, {period :period, period_type :period_type, from :from, to :to, report_type :shift_item} , function(data){
|
$.get(url, {period :period, period_type :period_type, from :from, to :to, report_type :shift_item} , function(data){
|
||||||
console.log(data)
|
console.log(data)
|
||||||
|
|
||||||
|
|||||||
15
config/license.yml
Normal file
15
config/license.yml
Normal file
@@ -0,0 +1,15 @@
|
|||||||
|
iv_key: rwOZKWcQho6fE4V+A2zFuQ==
|
||||||
|
shop_name: AMZ_Test
|
||||||
|
email: aungmyo.zaw@code2lab.com
|
||||||
|
telephone:
|
||||||
|
fax:
|
||||||
|
address:
|
||||||
|
dbhost: dNzh66R80remB694OEds96OpuyZ4wmHeHFdQh0KwjYFvTInK6+pCN/y6HdbyIlqqjcBHkqPjkjzw45PznLn7hA==
|
||||||
|
dbschema: 4vooJDxgWdFv/8V7Qx8tzR/8B8T2c5U4XvYcF+2KOoA=
|
||||||
|
dbusername: Xc8ELRsW7N/f8KsVikMBlg==
|
||||||
|
dbpassword: HMg+TbLxmfYrDFI4IIAd4g==
|
||||||
|
api_token: bisryXiEnbTJlZwghAnIByQpiRUMouu
|
||||||
|
app_token: LycQXJYBZGeCygjIEKdlBXnjIGMiMzgmt
|
||||||
|
plan_sku: 84hdnSCgkfhvItY7uB/pPQ==
|
||||||
|
renewable_date: 8E6Ecz8QXAMSlKZnIzn0pQ==
|
||||||
|
plan_name: 4cMIO0n/JzGFPIccXM6u5A==
|
||||||
@@ -419,8 +419,9 @@ scope "(:locale)", locale: /en|mm/ do
|
|||||||
resources :stock_check, :only => [:index, :show]
|
resources :stock_check, :only => [:index, :show]
|
||||||
resources :payment_method
|
resources :payment_method
|
||||||
resources :product_sale, :only => [:index, :show]
|
resources :product_sale, :only => [:index, :show]
|
||||||
|
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"
|
get "receipt_no/get_shift_by_date", to: "receipt_no#get_shift_by_date", as: "get_shift_by_date"
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
# ----------- Inventory ---------------------------
|
# ----------- Inventory ---------------------------
|
||||||
|
|||||||
@@ -12,7 +12,7 @@
|
|||||||
|
|
||||||
development:
|
development:
|
||||||
secret_key_base: b61d85f8ed2a1a9e0eeece3443b3e8f838d002cc1d9f32115d8e93db920e2957adfedc57501d44741211538f3108b742cdeada87d5bfae796c53da1f90a3cd61
|
secret_key_base: b61d85f8ed2a1a9e0eeece3443b3e8f838d002cc1d9f32115d8e93db920e2957adfedc57501d44741211538f3108b742cdeada87d5bfae796c53da1f90a3cd61
|
||||||
sx_provision_url: connect.smartsales.dev/api #connect.smartsales.dev/api #connect.smartsales.asia/api #provision.zsai.ws/api
|
sx_provision_url: connect.smartsales.asia/api #connect.smartsales.dev/api #connect.smartsales.asia/api #provision.zsai.ws/api
|
||||||
server_mode: application
|
server_mode: application
|
||||||
cipher_type: AES-256-CBC
|
cipher_type: AES-256-CBC
|
||||||
sx_key: Wh@t1$C2L
|
sx_key: Wh@t1$C2L
|
||||||
|
|||||||
Reference in New Issue
Block a user