Merge branch 'r-1902001-01' of gitlab.com:code2lab/SXRestaurant into r-1902001-01

This commit is contained in:
code2lab
2019-05-30 14:01:03 +06:30
9 changed files with 107 additions and 69 deletions

View File

@@ -129,6 +129,7 @@ i.logout_icon{
@media screen and (max-width: 785px) {
#setting{ display: none;}
.menu-up{ display: none;}
.card-btn{padding: 0px 35px;}
}
@media screen and (max-width: 785px) {

View File

@@ -122,5 +122,9 @@
@media screen and (max-width: 785px) {
.login_pwd{width: 90%;}
.login_ent{width: 10%;}
// .card-btn{padding: 0px 35px;}
// .nav-tabs{padding: 0px 44px;}
.box{margin: unset;}
.mbl-btn-usrgp{width: 48%;}
}

View File

@@ -87,31 +87,44 @@ class Reports::SaleitemController < BaseReportController
end
def print_sale_items
type = params[:type]
account = params[:account]
from_date = to_date = '-'
if !params[:from].nil?
from_date = Date.parse(params[:from])
from, to = get_date_range_from_params
shift_sale_range = ''
shift = ''
shift_name = 'All Shift'
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])
if to.blank?
shift = ShiftSale.where('shift_started_at = ? and shift_closed_at is NULL ',shift_sale.shift_started_at)
else
if shift_sale.shift_closed_at.blank?
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
if !params[:to].nil?
to_date = Date.parse(params[:to])
end
shift = params[:shift_name]
shift_name = "All Shifts"
if shift.to_i > 0
shift_name = params[:shift_from].to_s+" - ".to_s+params[:shift_to].to_s
sh_name = "#{shift_sale.shift_started_at.utc.getlocal.strftime('%d %B %l:%M%p')} - #{shift_sale.shift_closed_at.utc.getlocal.strftime('%d %B %l:%M%p')}"
employee = Employee.find(shift_sale.employee_id)
shift_name = employee.nil? ? sh_name : "#{sh_name} (#{employee.name})"
end
period_name = get_period_name(params[:period])
shop_details = shop_detail
account_type = params[:account_type]
@type = params[:period_type]
period_name = get_period_name(params[:period])
@sale_data, @other_charges,@product, @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,account_type)
# get printer info
print_settings = PrintSetting.find_by_unique_code('CloseCashierPdf') # SaleItemsPdf
printer = Printer::CashierStationPrinter.new(print_settings)
printer.print_sale_items_report(print_settings, shop_details, period_name, type, account, from_date, to_date, shift_name, params[:sale_items], params[:menu_cate_count])
printer.print_sale_items_report(print_settings, shop_details, period_name, @type, account_type, from, to, shift_name, @sale_data)
respond_to do |format|
format.html { redirect_to '/en/reports/saleitem/', notice: 'Printing Completed.'}

View File

@@ -81,10 +81,10 @@ class Printer::CashierStationPrinter < Printer::PrinterWorker
end
end
def print_sale_items_report(print_settings, shop_details, period_name, type, account, from_date, to_date, shift_name, sale_items, menu_cate_count)
def print_sale_items_report(print_settings, shop_details, period_name, type, account, from_date, to_date, shift_name, sale_items)
filename = "tmp/reports_sale_items.pdf"
pdf = SaleItemsPdf.new(print_settings, shop_details, period_name, type, account, from_date, to_date, shift_name, sale_items, nil, menu_cate_count, nil)
pdf = SaleItemsPdf.new(print_settings, shop_details, period_name, type, account, from_date, to_date, shift_name, sale_items, nil, nil, nil)
pdf.render_file filename

View File

@@ -105,7 +105,7 @@ class SaleItemsPdf < Prawn::Document
text "From Date : ", :size => self.item_font_size,:align => :left
end
bounding_box([@label_name_width,y_position], :width => @label_item_width, :height => self.item_height) do
text "#{ from_date}" , :size => self.item_font_size,:align => :left
text "#{ from_date.utc.getlocal.strftime("%d-%m-%Y")}" , :size => self.item_font_size,:align => :left
end
y_position = cursor
@@ -113,14 +113,14 @@ class SaleItemsPdf < Prawn::Document
text "To Date : ", :size => self.item_font_size,:align => :left
end
bounding_box([@label_name_width,y_position], :width => @label_item_width, :height => self.item_height) do
text "#{ to_date}" , :size => self.item_font_size,:align => :left
text "#{ to_date.utc.getlocal.strftime("%d-%m-%Y")}" , :size => self.item_font_size,:align => :left
end
y_position = cursor
bounding_box([0,y_position], :width =>@label_name_width, :height => self.item_height) do
text "Shift : ", :size => self.item_font_size,:align => :left
end
bounding_box([@label_name_width,y_position], :width => @label_item_width, :height => self.item_height) do
bounding_box([@label_name_width,y_position], :width => @label_item_width) do
text "#{shift}" , :size => self.item_font_size,:align => :left
end
@@ -148,7 +148,7 @@ class SaleItemsPdf < Prawn::Document
arr = Array.new
unless sale_items.nil?
JSON.parse(sale_items).each do |item|
sale_items.each do |item|
if !arr.include?(item['menu_category_id'])

View File

@@ -135,8 +135,6 @@
<div class="pin_pad left" data-value="0">0</div>
<div class="pin_pad bg-blue-grey" data-value="CLR">CLR</div>
<% end %>
</div>
</div>
</div>

View File

@@ -80,7 +80,7 @@
<br>
<div class="card padding-10">
<div class="card-content">
<div class="card-content card-btn">
<div class='col-md-12'>
<div class='row bottom'>
<div class="pin_pad " data-value="1">1</div>
@@ -129,7 +129,7 @@
<div class="tab-pane" id="<%=role%>" role="tabpanel" style="max-height:; overflow:auto">
<% @employees.each do |employee| %>
<%if employee.role == role %>
<div class="col-xs-3 col-sm-3 col-md-3 col-lg-3 empBtn" data-formid="#form_<%= employee.emp_id %>" style="float: left;">
<div class="col-xs-3 col-sm-3 col-md-3 col-lg-3 empBtn mbl-btn-usrgp" data-formid="#form_<%= employee.emp_id %>" style="float: left;">
<form id="form_<%= employee.emp_id %>" action="<%= emp_login_path(employee.emp_id) %>" method="PATCH">
</form>
<%if employee.image_path.present? %>
@@ -268,6 +268,3 @@
}
//end Notificaiotn message
</script>

View File

@@ -15,7 +15,7 @@
<hr />
<div class="text-right">
<%= link_to "Print", reports_print_sale_items_path(:type => params[:sale_type], :period => params[:period], :account => params[:account_type], :from => @from, :to => @to, :shift_name => params[:shift_name], :shift_from => @shift_from, :shift_to => @shift_to, :menu_cate_count => @menu_cate_count, :sale_items => @sale_data.to_json), :method => 'post', class:"btn btn-info wave-effects" %>
<button class="btn btn-info wave-effects" onclick="print_sale_items()">Print</button>
<a href="javascript:export_to('<%=reports_saleitem_index_path%>.xls')" class = "btn btn-info wave-effects "><%= t("views.btn.exp_to_excel") %></a>
</div>
@@ -66,6 +66,7 @@
<% other_sub_total = 0 %>
<% product_sub_total = 0 %>
<% count = 0 %>
<% row_count = 0 %>
<% total_price = 0 %>
<% cate_count = 0 %>
<% acc_count = 0 %>
@@ -78,6 +79,7 @@
<% total_tax = 0 %>
<% unless @sale_data.blank? %>
<% @sale_data.each do |sale| %>
<% row_count += 1 %>
<!-- all total qty sum -->
<% if sale.status_type != "Discount" && sale.status_type != "foc" && sale.status_type != "promotion"
@@ -285,6 +287,7 @@
<%end%>
</tbody>
</table>
</div>
</div>
</div>
@@ -293,10 +296,7 @@
<script>
$(function(){
var check_arr = [];
var search = '<%= params[:period_type] %>';
if(search){
@@ -407,4 +407,29 @@
}
});
function print_sale_items(){
var period = $('#sel_period').val();
var type = $('#sel_sale_type').val();
var account = $('#account_type').val();
var from = $('#from').val();
var to = $('#to').val();
var shift = $('#shift_name').val();
// var flag = false;
// alert($('#row_count').val())
// if (flag == true) {
$.ajax({
type: "POST",
url: "<%= reports_print_sale_items_path %>",
data: "period="+period+"&period_type="+type+"&account_type="+account+"&from="+from+"&to="+to+"&shift_name="+shift,
success: function(data){
if (data != null){
location.reload();
}
$("#loader").hide();
}
});
// }
}
</script>

BIN
dump.rdb

Binary file not shown.