From bd94e808d4cdcf3e44297d082cca3c23973bc38b Mon Sep 17 00:00:00 2001 From: Yan Date: Thu, 15 Jun 2017 13:24:37 +0630 Subject: [PATCH 01/10] print format --- app/controllers/api/bill_controller.rb | 4 +- app/models/order.rb | 6 +-- app/pdf/receipt_bill_pdf.rb | 52 ++++++++++++------------- dump.rdb | Bin 18787 -> 18800 bytes 4 files changed, 31 insertions(+), 31 deletions(-) diff --git a/app/controllers/api/bill_controller.rb b/app/controllers/api/bill_controller.rb index a01cc717..6b1fb225 100644 --- a/app/controllers/api/bill_controller.rb +++ b/app/controllers/api/bill_controller.rb @@ -12,14 +12,14 @@ class Api::BillController < Api::ApiController if booking if booking.sale_id.nil? @sale = Sale.new - @status, @sale_id = @sale.generate_invoice_from_booking(params[:booking_id], current_login_employee.name) + @status, @sale_id = @sale.generate_invoice_from_booking(params[:booking_id], current_login_employee) else @status = true end end elsif (params[:order_id]) @sale = Sale.new - @status, @sale_id = @sale.generate_invoice_from_order(params[:order_id], current_login_employee.name) + @status, @sale_id = @sale.generate_invoice_from_order(params[:order_id], current_login_employee) end end diff --git a/app/models/order.rb b/app/models/order.rb index 83eb9418..a53ba3cf 100644 --- a/app/models/order.rb +++ b/app/models/order.rb @@ -231,7 +231,7 @@ class Order < ApplicationRecord .joins("left join orders on orders.order_id = booking_orders.order_id") .joins("left join sales on sales.sale_id = bookings.sale_id") .where("(orders.status = 'new' or orders.status = 'billed') and (dining_facilities.type=? and dining_facilities.is_active=?)",DiningFacility::TABLE_TYPE,true) - .group("bookings.booking_id,orders.status,sales.receipt_no,sales.sale_status,orders.order_id,sales.customer_id,sales.sale_id,dining_facilities.name") + .group("bookings.booking_id") # For PG # booking_orders.order_id IS NOT NULL and dining_facilities.type=? and dining_facilities.is_active=?",DiningFacility::TABLE_TYPE,true # sales.receipt_no,orders.status,sales.sale_id,dining_facilities.name,orders.status,orders.order_id @@ -246,7 +246,7 @@ class Order < ApplicationRecord .joins("left join orders on orders.order_id = booking_orders.order_id") .joins("left join sales on sales.sale_id = bookings.sale_id") .where("sales.sale_status='completed'") - .group("sales.sale_id,orders.status,orders.order_id,bookings.booking_id,dining_facilities.name") + .group("sales.sale_id") # For PG #bookings.booking_id,sales.receipt_no,orders.status,sales.sale_id,dining_facilities.name,orders.status,orders.order_id end @@ -262,7 +262,7 @@ class Order < ApplicationRecord .joins("left join orders on orders.order_id = booking_orders.order_id") .joins("left join sales on sales.sale_id = bookings.sale_id") .where("(orders.status = 'new' or orders.status = 'billed') and (dining_facilities.type=? and dining_facilities.is_active=?)",DiningFacility::ROOM_TYPE,true) - .group("bookings.booking_id,sales.receipt_no,orders.status,orders.order_id,sales.customer_id,sales.sale_status,orders.customer_id,sales.sale_id,dining_facilities.name") + .group("bookings.booking_id") # For PG # booking_orders.order_id IS NOT NULL and dining_facilities.type=? and dining_facilities.is_active=?",DiningFacility::ROOM_TYPE,true # sales.receipt_no,orders.status,sales.sale_id,dining_facilities.name,orders.customer_id,orders.order_id diff --git a/app/pdf/receipt_bill_pdf.rb b/app/pdf/receipt_bill_pdf.rb index c766b8cc..71562277 100644 --- a/app/pdf/receipt_bill_pdf.rb +++ b/app/pdf/receipt_bill_pdf.rb @@ -1,16 +1,16 @@ class ReceiptBillPdf < 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 def initialize(printer_settings, sale_items, sale_data, customer_name, food_total, beverage_total, member_info = nil) - self.page_width = 250 - self.page_height = 1450 - self.margin = 10 - self.price_width = 40 + self.page_width = 210 + self.page_height = 2500 + self.margin = 5 + self.price_width = 35 self.qty_width = 20 - self.total_width = 40 - self.item_width = self.page_width - ((self.price_width + self.qty_width + self.total_width)+(self.margin*4)) + self.total_width = 35 + 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 - (self.price_width + self.qty_width + self.total_width) - self.label_width=80 + self.item_description_width = (self.page_width-20) / 2 + self.label_width = 100 # @item_width = self.page_width.to_i / 2 # @qty_width = @item_width.to_i / 3 @@ -22,10 +22,10 @@ class ReceiptBillPdf < Prawn::Document # 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 = 11 - self.item_font_size = 9 + self.header_font_size = 10 + self.item_font_size = 8 - header( printer_settings.printer_name, printer_settings.name) + header( "Beauty In the Pot", printer_settings.name) stroke_horizontal_rule @@ -92,8 +92,8 @@ class ReceiptBillPdf < Prawn::Document # @item_width.to_i + @half_qty.to_i text_box "Items", :at =>[0,y_position], :width => self.item_width, :height =>self.item_height, :size => self.item_font_size, :overflow => :shrink_to_fix text_box "Price", :at =>[self.item_width,y_position], :width => self.price_width, :height =>self.item_height, :size => self.item_font_size, :align => :right, :overflow => :shrink_to_fix - text_box "Qty", :at =>[(self.item_width+self.price_width),y_position], :width => self.qty_width, :height =>self.item_height, :size => self.item_font_size, :align => :right, :overflow => :shrink_to_fix - text_box "Total", :at =>[(self.item_width+self.price_width+2),y_position], :width => self.total_width+2, :height =>self.item_height, :size => self.item_font_size, :align => :right, :overflow => :shrink_to_fix + text_box "Qty", :at =>[(self.item_width+self.price_width),y_position], :width => self.qty_width, :height =>self.item_height, :size => self.item_font_size, :align => :center, :overflow => :shrink_to_fix + text_box "Total", :at =>[(self.item_width+self.price_width),y_position], :width => self.total_width+5, :height =>self.item_height, :size => self.item_font_size, :align => :right, :overflow => :shrink_to_fix } @@ -121,9 +121,9 @@ class ReceiptBillPdf < Prawn::Document pad_top(15) { text_box "#{product_name}", :at =>[0,y_position], :width => self.item_width, :height =>self.item_height, :overflow => :shrink_to_fix, :size => self.item_font_size, :overflow => :shrink_to_fix - text_box "#{price}", :at =>[self.item_width,y_position], :width => self.price_width, :height =>self.item_height, :size => self.item_font_size, :align => :right, :overflow => :shrink_to_fix - text_box "#{qty.to_i}", :at =>[item_name_width,y_position], :width => self.qty_width, :height =>self.item_height, :size => self.item_font_size, :align => :right, :overflow => :shrink_to_fix - text_box "#{total_price}", :at =>[(item_name_width+2),y_position], :width =>self.total_width+2, :height =>self.item_height, :size => self.item_font_size, :align => :right, :overflow => :shrink_to_fix + text_box "#{price.to_i}", :at =>[self.item_width,y_position], :width => self.price_width, :height =>self.item_height, :size => self.item_font_size, :align => :right, :overflow => :shrink_to_fix + text_box "#{qty.to_i}", :at =>[item_name_width,y_position], :width => self.qty_width, :height =>self.item_height, :size => self.item_font_size, :align => :center, :overflow => :shrink_to_fix + text_box "#{total_price.to_i}", :at =>[(item_name_width),y_position], :width =>self.total_width+5, :height =>self.item_height, :size => self.item_font_size, :align => :right, :overflow => :shrink_to_fix } move_down 3 end @@ -132,10 +132,10 @@ class ReceiptBillPdf < Prawn::Document move_down 5 y_position = cursor - bounding_box([0,y_position], :width =>item_name_width, :height => self.item_height) do + bounding_box([0,y_position], :width =>self.item_description_width, :height => self.item_height) do text "Sub Total", :size => self.item_font_size,:align => :left end - bounding_box([item_name_width,y_position], :width =>self.total_width) do + bounding_box([self.item_description_width,y_position], :width =>self.label_width) do text "#{ sub_total }" , :size => self.item_font_size,:align => :right end @@ -145,10 +145,10 @@ class ReceiptBillPdf < Prawn::Document move_down 5 y_position = cursor - bounding_box([0,y_position], :width =>(item_name_width), :height => self.item_height) do + bounding_box([0,y_position], :width => self.item_description_width, :height => self.item_height) do text "Food/Beverage Total", :size => self.item_font_size,:align => :left end - bounding_box([item_name_width,y_position], :width =>self.total_width) do + bounding_box([self.item_description_width,y_position], :width => self.label_width) do text "#{ food_beverage_total }" , :size => self.item_font_size,:align => :right end end @@ -158,30 +158,30 @@ class ReceiptBillPdf < Prawn::Document move_down 5 y_position = cursor - bounding_box([0,y_position], :width =>(item_name_width+self.price_width), :height => self.item_height) do + bounding_box([0,y_position], :width =>self.item_description_width, :height => self.item_height) do text "Discount", :size => self.item_font_size,:align => :left end - bounding_box([(item_name_width+self.price_width),y_position], :width =>self.total_width) do + bounding_box([self.item_description_width,y_position], :width =>self.label_width) do text "( " +"#{sale_data.total_discount}" +" )" , :size => self.item_font_size,:align => :right end move_down 5 y_position = cursor - bounding_box([0,y_position], :width =>(item_name_width+self.price_width), :height => self.item_height) do + bounding_box([0,y_position], :width =>self.item_description_width, :height => self.item_height) do text "Total Tax", :size => self.item_font_size,:align => :left end - bounding_box([(item_name_width+self.price_width),y_position], :width =>self.total_width) do + bounding_box([self.item_description_width,y_position], :width =>self.label_width) do text "( " +"#{sale_data.total_tax}" +" )" , :size => self.item_font_size,:align => :right end move_down 5 y_position = cursor move_down 5 - bounding_box([0,y_position], :width =>(item_name_width+self.price_width), :height => self.item_height) do + bounding_box([0,y_position], :width =>self.item_description_width, :height => self.item_height) do text "Grand Total", :size => self.item_font_size,:align => :left end - bounding_box([(item_name_width+self.price_width),y_position], :width =>self.total_width) do + bounding_box([self.item_description_width,y_position], :width =>self.label_width) do text "#{sale_data.grand_total}" , :size => self.item_font_size,:align => :right end move_down 5 diff --git a/dump.rdb b/dump.rdb index c1a940eb5a86063e47c769946f40c57019cc2bca..63a4647b0a10a4c97d4109a8cddff7a04d5b4731 100644 GIT binary patch delta 1424 zcmYk6TWnNC9LCS=X?IJl?e;<>t>QG=prK6Xekp9TyT+0}c)?%{k@O!kk|vZFc`=;wXtM2Ap@1)qHcBX6(8Tzl0VOd(yv*5dw|$&BIp6%h@B7XC zlmQPi;2hpDjnao6R~#SjKe}hQe|RB&x!(KN`@0s{=ewRc-_z}j&!^94|7tPFv*-|w$9)(RY#Fb=%*rEEvrc6_bNl6thq)Mu(XoQQBsOA)LO_kJ6 zbT$2k8@1DZ8A%3TRgM5~Y-4G!RNZKLT3|^uL4-+42!*hGY;1I_XSn$tU_nbmK<`^?0SrgfXQMl?FcYggvltv=z>!Kry}` zsSPIIZd1*J**MfLS~wNp}*VZ?>|s+m*jPI$9r#)V>L9+veS89hFd zTx_mOMMCYi>|9h5p_JYjQVEx0xMhUdl)kg)R+SJKBh47YR5{r`X9M#MNw~PB?I6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?f;fZm$bb1wrvg&HAR(eO1v|vHyqZQQb-C^r zGxb5}vw*qgcIC(2X&wS*VV}5qxqT%FIE9bCK zgTSm$%F;Y4Ft>;!v=2Hn-@AwMV^&+92jG@^`@o!fpRN=P=Z-d9GMyc5II2J9#%GoS z#6n!yh{2`Eoub#D7_yMg7QG!q980n33&%R4x~3P_Ocg@;PR*CQimnJoF!nZJVA*5{ zk>vl_QjR6s9x5WS<&`)m>UQlLsjU4XFt2KoJX}xi`84RI&|?WU_#Hx}$5K?C-&_6A zc6ty+n^0n#IGP?rsjyQv-T>x}JpFMsv~ML?<+alSEW-3-kWST7f9ME25$VZ{`}$%} zMB0tVI%{El@j@hWV969*kS%DT3WL)1@^gKzN?zc6;&g@CI912jO+D9JBd*R@7jC0I z3DnY|ELYmruwRGE){P(3Dn)%)2WG$k1IiwYVK{X Nc<^FkKCxbT_8-Zw%-8?` From addf3603ff914f3c9bc69dab9833c37a4f8f5613 Mon Sep 17 00:00:00 2001 From: Aung Myo Date: Thu, 15 Jun 2017 14:19:31 +0630 Subject: [PATCH 02/10] update customer --- app/views/crm/customers/index.html.erb | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/app/views/crm/customers/index.html.erb b/app/views/crm/customers/index.html.erb index c74c34f6..f97de091 100644 --- a/app/views/crm/customers/index.html.erb +++ b/app/views/crm/customers/index.html.erb @@ -121,6 +121,7 @@
<%= f.button :submit, "Submit",:class => 'btn btn-primary ', :id => 'submit_customer' %> <%= f.button :submit, "Update",:class => 'btn btn-primary ', :disabled =>'', :id => 'update_customer' %> + <%= f.button :button, "Reset",:class => 'btn btn-danger ', :id => 'reset' %>
<%end%> @@ -230,5 +231,12 @@ $(function() { }); } + $('#reset').click(function() { + + window.location.href = '/crm/customers' + + return false; + }); + \ No newline at end of file From a48ff7745d1b68da5a3053f1f7f1b97dc7e1023a Mon Sep 17 00:00:00 2001 From: Aung Myo Date: Thu, 15 Jun 2017 14:21:20 +0630 Subject: [PATCH 03/10] update customer --- app/views/origami/customers/index.html.erb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/views/origami/customers/index.html.erb b/app/views/origami/customers/index.html.erb index 340bc307..dd2b1b99 100644 --- a/app/views/origami/customers/index.html.erb +++ b/app/views/origami/customers/index.html.erb @@ -2,9 +2,9 @@