fix conflit
This commit is contained in:
6
.idea/workspace.xml
generated
6
.idea/workspace.xml
generated
@@ -2,7 +2,7 @@
|
|||||||
<project version="4">
|
<project version="4">
|
||||||
<component name="ChangeListManager">
|
<component name="ChangeListManager">
|
||||||
<list default="true" id="89ca96af-a0e4-4fe4-b9a3-9969f22d7079" name="Default" comment="">
|
<list default="true" id="89ca96af-a0e4-4fe4-b9a3-9969f22d7079" name="Default" comment="">
|
||||||
<change type="MODIFICATION" beforePath="$PROJECT_DIR$/dump.rdb" afterPath="$PROJECT_DIR$/dump.rdb" />
|
<change type="MODIFICATION" beforePath="$PROJECT_DIR$/.idea/workspace.xml" afterPath="$PROJECT_DIR$/.idea/workspace.xml" />
|
||||||
</list>
|
</list>
|
||||||
<ignored path="$PROJECT_DIR$/.bundle/" />
|
<ignored path="$PROJECT_DIR$/.bundle/" />
|
||||||
<ignored path="$PROJECT_DIR$/components/" />
|
<ignored path="$PROJECT_DIR$/components/" />
|
||||||
@@ -724,12 +724,12 @@
|
|||||||
<workItem from="1503457057830" duration="7166000" />
|
<workItem from="1503457057830" duration="7166000" />
|
||||||
<workItem from="1503472116907" duration="50209000" />
|
<workItem from="1503472116907" duration="50209000" />
|
||||||
<workItem from="1503843212665" duration="21267000" />
|
<workItem from="1503843212665" duration="21267000" />
|
||||||
<workItem from="1503909487511" duration="65805000" />
|
<workItem from="1503909487511" duration="65887000" />
|
||||||
</task>
|
</task>
|
||||||
<servers />
|
<servers />
|
||||||
</component>
|
</component>
|
||||||
<component name="TimeTrackingManager">
|
<component name="TimeTrackingManager">
|
||||||
<option name="totallyTimeSpent" value="218423000" />
|
<option name="totallyTimeSpent" value="218505000" />
|
||||||
</component>
|
</component>
|
||||||
<component name="TodoView">
|
<component name="TodoView">
|
||||||
<todo-panel id="selected-file">
|
<todo-panel id="selected-file">
|
||||||
|
|||||||
@@ -23,6 +23,22 @@ class Inventory::StockChecksController < BaseInventoryController
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def print_stock_check
|
||||||
|
stock_id = params[:stock_check_id] # sale_id
|
||||||
|
stockcheck = StockCheck.find(stock_id)
|
||||||
|
stockcheck_items = stockcheck.stock_check_items
|
||||||
|
member_info = nil
|
||||||
|
unique_code = "StockPrint"
|
||||||
|
|
||||||
|
shop_details = Shop.find(1)
|
||||||
|
checker = Employee.find(stockcheck.check_by)
|
||||||
|
print_settings=PrintSetting.find_by_unique_code(unique_code)
|
||||||
|
printer = Printer::ReceiptPrinter.new(print_settings)
|
||||||
|
|
||||||
|
printer.print_stock_check_result(print_settings,stockcheck, stockcheck_items,checker.name, shop_details)
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
# before_action :set_stock_check, only: [:show, :edit, :update, :destroy]
|
# before_action :set_stock_check, only: [:show, :edit, :update, :destroy]
|
||||||
|
|
||||||
# GET /stock_checks
|
# GET /stock_checks
|
||||||
|
|||||||
@@ -87,6 +87,13 @@ class Printer::ReceiptPrinter < Printer::PrinterWorker
|
|||||||
end until count == 0
|
end until count == 0
|
||||||
end
|
end
|
||||||
|
|
||||||
|
# stock check
|
||||||
|
def print_stock_check_result(print_settings,stockcheck, stockcheck_items,checker_name, shop_details)
|
||||||
|
pdf = StockResultPdf.new(print_settings,stockcheck, stockcheck_items,checker_name, shop_details)
|
||||||
|
pdf.render_file "tmp/print_stock_check_result.pdf"
|
||||||
|
self.print("tmp/print_stock_check_result.pdf")
|
||||||
|
end
|
||||||
|
|
||||||
#Queue No Print
|
#Queue No Print
|
||||||
def print_queue_no(printer_settings,queue)
|
def print_queue_no(printer_settings,queue)
|
||||||
#Use CUPS service
|
#Use CUPS service
|
||||||
|
|||||||
92
app/pdf/stock_result_pdf.rb
Normal file
92
app/pdf/stock_result_pdf.rb
Normal file
@@ -0,0 +1,92 @@
|
|||||||
|
class StockResultPdf < Prawn::Document
|
||||||
|
attr_accessor :label_width,:price_column_width,:page_width, :page_height, :margin, :price_width, :item_width, :header_font_size, :item_font_size,:item_height,:qty_width,:total_width,:item_description_width,:text_width
|
||||||
|
|
||||||
|
def initialize(printer_settings,stockcheck, stockcheck_items,checker_name, shop_details)
|
||||||
|
self.page_width = printer_settings.page_width #PrintSetting.where("name = ?","Close Cashier").first.page_width
|
||||||
|
self.page_height = printer_settings.page_height
|
||||||
|
self.margin = 5
|
||||||
|
self.price_width = 40
|
||||||
|
self.qty_width = 20
|
||||||
|
self.total_width = 40
|
||||||
|
self.item_width = self.page_width - ((self.price_width + self.qty_width + self.total_width))
|
||||||
|
self.item_height = 15
|
||||||
|
self.item_description_width = (self.page_width-20) / 2
|
||||||
|
self.label_width = 100
|
||||||
|
|
||||||
|
self.text_width = (self.page_width - 80) - self.price_width / 3
|
||||||
|
# @item_width = self.page_width.to_i / 2
|
||||||
|
# @qty_width = @item_width.to_i / 3
|
||||||
|
# @double = @qty_width * 1.3
|
||||||
|
# @half_qty = @qty_width / 2
|
||||||
|
#setting page margin and width
|
||||||
|
super(:margin => [printer_settings.heading_space, self.margin, self.margin, self.margin], :page_size => [self.page_width, self.page_height])
|
||||||
|
|
||||||
|
# font "public/fonts/#{font_name}".to_s + ".ttf".to_s
|
||||||
|
# font "public/fonts/Zawgyi-One.ttf"
|
||||||
|
# font "public/fonts/padauk.ttf"
|
||||||
|
self.header_font_size = 10
|
||||||
|
self.item_font_size = 8
|
||||||
|
|
||||||
|
header( shop_details)
|
||||||
|
|
||||||
|
stroke_horizontal_rule
|
||||||
|
|
||||||
|
detail(stockcheck,stockcheck_items, checker_name)
|
||||||
|
end
|
||||||
|
|
||||||
|
def header (shop_details)
|
||||||
|
move_down 7
|
||||||
|
text "#{shop_details.name}", :left_margin => -10, :size => self.header_font_size,:align => :center
|
||||||
|
move_down 5
|
||||||
|
text "#{shop_details.address}", :size => self.item_font_size,:align => :center
|
||||||
|
# move_down self.item_height
|
||||||
|
move_down 5
|
||||||
|
text "#{shop_details.phone_no}", :size => self.item_font_size,:align => :center
|
||||||
|
move_down 5
|
||||||
|
|
||||||
|
stroke_horizontal_rule
|
||||||
|
end
|
||||||
|
|
||||||
|
def detail(stockcheck, stockcheck_items, checker_name)
|
||||||
|
move_down 7
|
||||||
|
y_position = cursor
|
||||||
|
bounding_box([0,y_position], :width =>self.label_width, :height => self.item_height) do
|
||||||
|
text "Checker : ", :size => self.item_font_size,:align => :left
|
||||||
|
end
|
||||||
|
bounding_box([self.label_width,y_position], :width => self.label_width, :height => self.item_height) do
|
||||||
|
text "#{checker_name}" , :size => self.item_font_size,:align => :left
|
||||||
|
end
|
||||||
|
|
||||||
|
y_position = cursor
|
||||||
|
bounding_box([0,y_position], :width =>self.label_width, :height => self.item_height) do
|
||||||
|
text "Check Start Time : ", :size => self.item_font_size,:align => :left
|
||||||
|
end
|
||||||
|
bounding_box([self.label_width,y_position], :width => self.label_width, :height => self.item_height) do
|
||||||
|
text "#{ stockcheck.check_start.utc.getlocal.strftime('%d-%m-%Y %I:%M %p') }" , :size => self.item_font_size,:align => :left
|
||||||
|
end
|
||||||
|
|
||||||
|
y_position = cursor
|
||||||
|
bounding_box([0,y_position], :width =>self.label_width, :height => self.item_height) do
|
||||||
|
text "Check End Time ", :size => self.item_font_size,:align => :left
|
||||||
|
end
|
||||||
|
bounding_box([self.label_width,y_position], :width => self.label_width, :height => self.item_height) do
|
||||||
|
text "#{ stockcheck.check_start.utc.getlocal.strftime('%d-%m-%Y %I:%M %p') }" , :size => self.item_font_size,:align => :left
|
||||||
|
end
|
||||||
|
|
||||||
|
if stockcheck_items.length > 0
|
||||||
|
stockcheck_items.each do |st|
|
||||||
|
move_down 5
|
||||||
|
y_position = cursor
|
||||||
|
|
||||||
|
bounding_box([0,y_position], :width =>self.item_description_width, :height => self.item_height) do
|
||||||
|
text "#{ st.item_code }", :size => self.item_font_size,:align => :left
|
||||||
|
end
|
||||||
|
bounding_box([self.item_description_width,y_position], :width =>self.label_width) do
|
||||||
|
text "#{st.stock_count.to_i}" , :size => self.item_font_size,:align => :right
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
move_down 5
|
||||||
|
stroke_horizontal_rule
|
||||||
|
end
|
||||||
|
end
|
||||||
@@ -71,4 +71,13 @@ $('#save_to_journal').on('click', function(){
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
|
$('#print').on('click',function(){
|
||||||
|
check_id = $('#stock_check_id').val();
|
||||||
|
$.ajax({
|
||||||
|
type: 'post',
|
||||||
|
url: '<%= inventory_print_stock_check_path %>',
|
||||||
|
data: 'stock_check_id='+ check_id
|
||||||
|
})
|
||||||
|
})
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
@@ -39,9 +39,18 @@
|
|||||||
<% end %>
|
<% end %>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="row">
|
|
||||||
<div class="col-md-12"><%= f.input :promo_day %></div>
|
<div class="row checkboxes">
|
||||||
|
<%= f.hidden_field :promo_day, :value => "", :class => "form-control col-md-1" %>
|
||||||
|
<div class="col-md-1"><input class="select" type="checkbox" name="Sunday" value="0" id="0"> Sun</div>
|
||||||
|
<div class="col-md-1"><input class="select" type="checkbox" name="Monday" value="1" id="1">Mon</div>
|
||||||
|
<div class="col-md-1"><input class="select" type="checkbox" name="Tuesday" value="2" id="2"> Tue</div>
|
||||||
|
<div class="col-md-1"><input class="select" type="checkbox" name="Wednesday" value="3" id="3"> Wed</div>
|
||||||
|
<div class="col-md-1"><input class="select" type="checkbox" name="Thursday" value="4" id="4">Thu</div>
|
||||||
|
<div class="col-md-1"><input class="select" type="checkbox" name="Friday" value="5" id="5">Fri</div>
|
||||||
|
<div class="col-md-1"><input class="select" type="checkbox" name="Saturday" value="6" id="6">Sat</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-md-6">
|
<div class="col-md-6">
|
||||||
<%= f.input :promo_type,input_html: { class: "" },
|
<%= f.input :promo_type,input_html: { class: "" },
|
||||||
@@ -133,6 +142,8 @@
|
|||||||
</div>
|
</div>
|
||||||
<% end %>
|
<% end %>
|
||||||
<script>
|
<script>
|
||||||
|
|
||||||
|
|
||||||
$(document).ready(function(){
|
$(document).ready(function(){
|
||||||
$('#promotion_promo_start_date').datetimepicker({
|
$('#promotion_promo_start_date').datetimepicker({
|
||||||
timepicker:false,
|
timepicker:false,
|
||||||
@@ -150,6 +161,39 @@ $(document).ready(function(){
|
|||||||
datepicker:false,
|
datepicker:false,
|
||||||
format:'H:m'
|
format:'H:m'
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
var form = document.getElementById("new_promotion");
|
||||||
|
var inputs = form.getElementsByTagName("input");
|
||||||
|
var arr = [];
|
||||||
|
var count = 0;
|
||||||
|
var day = "[";
|
||||||
|
|
||||||
|
$(".select").click(function() {
|
||||||
|
|
||||||
|
// debugger;
|
||||||
|
day = "[";
|
||||||
|
for (var j = 8; j <=15; j += 1){
|
||||||
|
if (inputs[j].type === "checkbox" && inputs[j].checked)
|
||||||
|
{
|
||||||
|
if(day == "["){
|
||||||
|
day = day + (inputs[j].value);
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
day = day + "," + (inputs[j].value);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if(j==15)
|
||||||
|
{
|
||||||
|
day = day + "]";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
document.getElementById("promotion_promo_day").value = '';
|
||||||
|
document.getElementById("promotion_promo_day").value = day;
|
||||||
|
});
|
||||||
|
|
||||||
$("#promotion_original_product").select2();
|
$("#promotion_original_product").select2();
|
||||||
$(".item_code_place").select2();
|
$(".item_code_place").select2();
|
||||||
$(".item_code_place").on('change', function(event) {
|
$(".item_code_place").on('change', function(event) {
|
||||||
|
|||||||
@@ -39,7 +39,13 @@
|
|||||||
<td><%= pro.promo_end_hour.utc.strftime("%I:%M %P") rescue "-" %></td>
|
<td><%= pro.promo_end_hour.utc.strftime("%I:%M %P") rescue "-" %></td>
|
||||||
<td><%= pro.promo_day %></td>
|
<td><%= pro.promo_day %></td>
|
||||||
<td>
|
<td>
|
||||||
<%= MenuItem.find_by_item_code(pro.original_product).name rescue "-"%>
|
<% item = MenuItemInstance.find_by_item_instance_code(pro.original_product)%>
|
||||||
|
<% if item.nil? %>
|
||||||
|
<%= Product.find_by_item_code(pro.original_product).name rescue "-" %>
|
||||||
|
<% else %>
|
||||||
|
<%= item.menu_item.name rescue "-" %>
|
||||||
|
- <%= item.item_instance_name rescue "-" %>
|
||||||
|
<% end %>
|
||||||
</td>
|
</td>
|
||||||
<% if Employee.exists?(pro.created_by) %>
|
<% if Employee.exists?(pro.created_by) %>
|
||||||
<td><%= Employee.find(pro.created_by).name %></td>
|
<td><%= Employee.find(pro.created_by).name %></td>
|
||||||
|
|||||||
@@ -10,7 +10,11 @@
|
|||||||
<%= render 'form', promotion: @promotion %>
|
<%= render 'form', promotion: @promotion %>
|
||||||
</div>
|
</div>
|
||||||
<script>
|
<script>
|
||||||
$("#promotion_promo_code").val(Math.random().toString(36).slice(5) + Math.random().toString(36).slice(5));
|
var r_id = Math.random().toString(36).slice(5);
|
||||||
|
if(r_id.length > 16){
|
||||||
|
r_id = r_id.substring(0, 15);
|
||||||
|
}
|
||||||
|
$("#promotion_promo_code").val(r_id);
|
||||||
// $( "#fromtime" ).timepicker();
|
// $( "#fromtime" ).timepicker();
|
||||||
// $( "#totime" ).timepicker({ 'scrollDefault': 'now' });
|
// $( "#totime" ).timepicker({ 'scrollDefault': 'now' });
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
@@ -340,6 +340,7 @@ Rails.application.routes.draw do
|
|||||||
post 'save_stock' => 'stock_checks#create', as:'stock_check_save'
|
post 'save_stock' => 'stock_checks#create', as:'stock_check_save'
|
||||||
get '/stock_checks/:id' => 'stock_checks#show'
|
get '/stock_checks/:id' => 'stock_checks#show'
|
||||||
post 'save_to_journal' => 'stock_checks#save_to_journal', as: 'save_to_journal'
|
post 'save_to_journal' => 'stock_checks#save_to_journal', as: 'save_to_journal'
|
||||||
|
post 'print_stock_check' => 'stock_checks#print_stock_check', as: 'print_stock_check'
|
||||||
# resources :stock_checks
|
# resources :stock_checks
|
||||||
resources :stock_journals
|
resources :stock_journals
|
||||||
resources :inventory_definitions
|
resources :inventory_definitions
|
||||||
|
|||||||
Reference in New Issue
Block a user