diff --git a/app/controllers/home_controller.rb b/app/controllers/home_controller.rb
index 3136417f..f2a8676c 100644
--- a/app/controllers/home_controller.rb
+++ b/app/controllers/home_controller.rb
@@ -77,7 +77,13 @@ class HomeController < ApplicationController
def route_by_role(employee)
if employee.role == "administrator"
- redirect_to dashboard_path
+ # redirect_to dashboard_path
+ shift = ShiftSale.current_open_shift(employee.id)
+ if !shift.nil?
+ redirect_to origami_root_path
+ else
+ redirect_to new_origami_shift_path
+ end
elsif employee.role == "cashier"
#check if cashier has existing open cashier
shift = ShiftSale.current_open_shift(employee.id)
diff --git a/app/controllers/origami/discounts_controller.rb b/app/controllers/origami/discounts_controller.rb
index 6c76c27a..02a85f91 100644
--- a/app/controllers/origami/discounts_controller.rb
+++ b/app/controllers/origami/discounts_controller.rb
@@ -22,10 +22,10 @@ class Origami::DiscountsController < BaseOrigamiController
sale = Sale.find(sale_id)
table_id = sale.bookings[0].dining_facility_id
table_type = DiningFacility.find(table_id).type
- sale.total_discount = overall_discount.to_f
- sale.total_amount = sub_total.to_f
- sale.grand_total = (sub_total.to_f - overall_discount.to_f) + sale.total_tax;
- sale.save
+ # sale.total_discount = overall_discount.to_f
+ # sale.total_amount = sub_total.to_f
+ # sale.grand_total = (sub_total.to_f - overall_discount.to_f) + sale.total_tax;
+ # sale.save
if discount_items.length > 0
#save sale item for discount
discount_items.each do |di|
@@ -35,6 +35,7 @@ class Origami::DiscountsController < BaseOrigamiController
sale_item.sale_id = sale_id
sale_item.product_code = origin_sale_item != nil ? origin_sale_item.product_code : sale_id
sale_item.product_name = di["name"]
+ sale_item.product_alt_name = ""
sale_item.remark = "Discount"
sale_item.qty = 1
@@ -45,7 +46,10 @@ class Origami::DiscountsController < BaseOrigamiController
sale_item.price = di["price"]
sale_item.save
end
- end
+ end
+
+ # Re-calc All Amount in Sale
+ sale.compute_by_sale_items(sale_id, sale.sale_items, overall_discount.to_f)
end
dining = {:table_id => table_id, :table_type => table_type }
diff --git a/app/controllers/origami/other_charges_controller.rb b/app/controllers/origami/other_charges_controller.rb
index 22a4fb2c..a23ebd16 100644
--- a/app/controllers/origami/other_charges_controller.rb
+++ b/app/controllers/origami/other_charges_controller.rb
@@ -16,10 +16,11 @@ class Origami::OtherChargesController < BaseOrigamiController
if Sale.exists?(sale_id)
sale = Sale.find(sale_id)
table_id = sale.bookings[0].dining_facility_id
- table_type = DiningFacility.find(table_id).type
- sale.total_amount = sub_total.to_f
- sale.grand_total = sub_total.to_f + sale.total_tax;
- sale.save
+ table_type = DiningFacility.find(table_id).type
+
+ # sale.total_amount = sub_total.to_f
+ # sale.grand_total = sub_total.to_f + sale.total_tax;
+ # sale.save
if other_charges_items.length > 0
#save sale item for discount
other_charges_items.each do |di|
@@ -34,14 +35,17 @@ class Origami::OtherChargesController < BaseOrigamiController
sale_item.qty = 1
sale_item.unit_price = di["price"]
- sale_item.taxable_price = di["price"]
+ sale_item.taxable_price = 0
sale_item.is_taxable = 0
sale_item.price = di["price"]
sale_item.save
end
- end
- end
+ end
+
+ # Re-calc All Amount in Sale
+ sale.compute_by_sale_items(sale_id, sale.sale_items, sale.total_discount)
+ end
dining = {:table_id => table_id, :table_type => table_type }
render :json => dining.to_json
diff --git a/app/controllers/origami/sale_edit_controller.rb b/app/controllers/origami/sale_edit_controller.rb
index d4fba302..f0d57679 100644
--- a/app/controllers/origami/sale_edit_controller.rb
+++ b/app/controllers/origami/sale_edit_controller.rb
@@ -23,6 +23,26 @@ class Origami::SaleEditController < BaseOrigamiController
@newsaleitem.save
end
+ def item_edit
+ saleitemId = params[:sale_item_id]
+ update_qty = params[:update_qty]
+ update_price = params[:update_price]
+ saleitemObj = SaleItem.find(saleitemId)
+ saleitemObj.remark = 'void'
+ saleitemObj.save
+ @newsaleitem = SaleItem.new
+ @newsaleitem = saleitemObj.dup
+ @newsaleitem.save
+ @newsaleitem.qty = update_qty
+ @newsaleitem.price = update_price
+ @newsaleitem.unit_price = update_price
+ @newsaleitem.taxable_price = update_price
+ @newsaleitem.is_taxable = 0
+ @newsaleitem.remark = 'edit'
+ @newsaleitem.product_name = saleitemObj.product_name + " - updated"
+ @newsaleitem.save
+ end
+
# make cancel void item
def item_void_cancel
saleitemId = params[:sale_item_id]
diff --git a/app/controllers/origami/sales_controller.rb b/app/controllers/origami/sales_controller.rb
index e272c1ee..c397da0f 100644
--- a/app/controllers/origami/sales_controller.rb
+++ b/app/controllers/origami/sales_controller.rb
@@ -26,6 +26,9 @@ class Origami::SalesController < BaseOrigamiController
order.order_items.each do |orer_item|
saleobj.add_item (orer_item)
end
+
+ # Re-compute for add
+ saleobj.compute
saleobj.save
order.save
booking.save
diff --git a/app/controllers/origami/shifts_controller.rb b/app/controllers/origami/shifts_controller.rb
index 3329aa0b..07d10cf7 100644
--- a/app/controllers/origami/shifts_controller.rb
+++ b/app/controllers/origami/shifts_controller.rb
@@ -4,7 +4,6 @@ class Origami::ShiftsController < BaseOrigamiController
end
def show
- puts current_user.id
@shift = ShiftSale.current_open_shift(current_user.id)
end
@@ -15,8 +14,9 @@ class Origami::ShiftsController < BaseOrigamiController
def create
opening_balance = params[:opening_balance]
+ cashier_terminal = params[:cashier_terminal]
@shift = ShiftSale.new
- @shift.create(opening_balance,current_user)
+ @shift.create(opening_balance,cashier_terminal, current_user)
end
def update_shift
@@ -27,10 +27,21 @@ class Origami::ShiftsController < BaseOrigamiController
@shift.shift_closed_at = DateTime.now.utc
@shift.closing_balance = closing_balance.to_f
@shift.save
- end
- end
+ unique_code = "CloseCashierPdf"
+ shop_details = Shop.find(1)
+ # get printer info
+ print_settings=PrintSetting.find_by_unique_code(unique_code)
+
+ printer = Printer::CashierStationPrinter.new(print_settings)
+
+ printer.print_close_cashier(print_settings,@shift,shop_details)
+
+ end
+
+ end
def edit
end
+
end
diff --git a/app/models/order_item.rb b/app/models/order_item.rb
index f4f3efba..109665d0 100644
--- a/app/models/order_item.rb
+++ b/app/models/order_item.rb
@@ -43,10 +43,10 @@ class OrderItem < ApplicationRecord
def self.get_order_items_details(booking_id)
# booking_orders = BookingOrder.where("booking_id=?",booking.booking_id)
# if booking_orders
- # booking_orders.each do |book_order|
+ # booking_orders.each do |book_order|
# order_details = OrderItem.select("order_items.item_name,order_items.qty,order_items.price,(order_items.qty*order_items.price) as total_price")
# .joins("left join orders on orders.order_id = order_items.order_id")
- # .where("order_items.order_id=?",book_order.order)
+ # .where("order_items.order_id=?",book_order.order)
# return order_details
# end
# else
@@ -57,9 +57,9 @@ class OrderItem < ApplicationRecord
.joins("left join orders on orders.order_id = order_items.order_id")
.joins("left join booking_orders on booking_orders.order_id = order_items.order_id")
.joins("left join bookings on bookings.booking_id = booking_orders.booking_id")
- .where("bookings.booking_id=?",booking_id)
+ .where("bookings.booking_id=?",booking_id)
- return order_details
+ return order_details
end
private
diff --git a/app/models/printer/cashier_station_printer.rb b/app/models/printer/cashier_station_printer.rb
index 32fab03a..564b4909 100644
--- a/app/models/printer/cashier_station_printer.rb
+++ b/app/models/printer/cashier_station_printer.rb
@@ -11,14 +11,24 @@ class Printer::CashierStationPrinter < Printer::PrinterWorker
self.print("tmp/cashier_station_#{order_id}_closing_#{time}.pdf")
end
- def print_close_cashier(receipt_no)
+ # def print_close_cashier(receipt_no)
+ # #Use CUPS service
+ # #Generate PDF
+ # time = DateTime.now
+ # #Print
+ # pdf = CashierStationClosing.new
+ # pdf.render_file "tmp/cashier_station_#{order_id}_closing_#{time}.pdf"
+ # self.print("tmp/receipt.pdf")
+ # end
+
+ #Bill Receipt Print
+ def print_close_cashier(printer_settings,shift_sale,shop_details)
#Use CUPS service
#Generate PDF
- time = DateTime.now
#Print
- pdf = CashierStationClosing.new
- pdf.render_file "tmp/cashier_station_#{order_id}_closing_#{time}.pdf"
- self.print("tmp/receipt.pdf")
+ pdf = CloseCashierPdf.new(printer_settings,shift_sale,shop_details)
+ pdf.render_file "tmp/print_close_cashier.pdf"
+ self.print("tmp/print_close_cashier.pdf")
end
diff --git a/app/models/printer/receipt_printer.rb b/app/models/printer/receipt_printer.rb
index 373e05ae..f8eb46d6 100644
--- a/app/models/printer/receipt_printer.rb
+++ b/app/models/printer/receipt_printer.rb
@@ -80,16 +80,6 @@ class Printer::ReceiptPrinter < Printer::PrinterWorker
end until count == 0
end
- #Bill Receipt Print
- def print_close_cashier(printer_settings,shift_sale,shop_details)
- #Use CUPS service
- #Generate PDF
- #Print
- pdf = CloseCashierPdf.new(printer_settings,shift_sale,shop_details)
- pdf.render_file "tmp/print_close_cashier.pdf"
- self.print("tmp/print_close_cashier.pdf")
- end
-
#Queue No Print
def print_queue_no(printer_settings,queue)
#Use CUPS service
diff --git a/app/models/sale.rb b/app/models/sale.rb
index 60b471dd..0ee3484e 100644
--- a/app/models/sale.rb
+++ b/app/models/sale.rb
@@ -41,8 +41,10 @@ class Sale < ApplicationRecord
end
booking.sale_id = sale_id
end
+
order = booking.booking_orders.take.order
link_order_sale(order.id)
+
return status, sale_id
end
end
@@ -205,6 +207,33 @@ class Sale < ApplicationRecord
end
+ #compute - invoice total
+ def compute_by_sale_items(sale_id, sale_itemss, total_discount)
+ sale = Sale.find(sale_id)
+ sales_items = sale_itemss
+
+ #Computation Fields
+ subtotal_price = 0
+ total_taxable = 0
+ rounding_adjustment = 0
+
+ sales_items.each do |item|
+ #compute each item and added to total
+ subtotal_price = subtotal_price + item.price
+ total_taxable = total_taxable + (item.taxable_price * item.qty)
+ end
+
+ compute_tax(sale, total_taxable)
+ sale.total_amount = subtotal_price
+ sale.total_discount = total_discount
+ sale.grand_total = (sale.total_amount - sale.total_discount) + sale.total_tax
+ #compute rounding adjustment
+ # adjust_rounding
+
+ sale.save!
+
+ end
+
def compute_without_void
sales_items = self.sale_items
@@ -230,6 +259,39 @@ class Sale < ApplicationRecord
self.save!
end
+
+ # Tax Re-Calculte
+ def compute_tax(sale, total_taxable)
+ #if tax is not apply create new record
+ SaleTax.where("sale_id='#{sale.sale_id}'").find_each do |existing_tax|
+ #delete existing and create new
+ existing_tax.delete
+ end
+
+ total_tax_amount = 0
+ #tax_profile - list by order_by
+ tax_profiles = TaxProfile.all.order("order_by asc")
+
+ # #Creat new tax records
+ tax_profiles.each do |tax|
+ sale_tax = SaleTax.new(:sale => sale)
+ sale_tax.tax_name = tax.name
+ sale_tax.tax_rate = tax.rate
+ #include or execulive
+ # sale_tax.tax_payable_amount = total_taxable * tax.rate
+ sale_tax.tax_payable_amount = total_taxable * tax.rate / 100
+ #new taxable amount
+ total_taxable = total_taxable + sale_tax.tax_payable_amount
+
+ sale_tax.inclusive = tax.inclusive
+ sale_tax.save
+
+ total_tax_amount = total_tax_amount + sale_tax.tax_payable_amount
+ end
+
+ sale.total_tax = total_tax_amount
+ end
+
# Tax Calculate
def apply_tax(total_taxable)
#if tax is not apply create new record
@@ -344,8 +406,8 @@ class Sale < ApplicationRecord
else
## up to 100
value = 100 - get_last_no.to_f
- num += value
- puts 'up to 100'
+ num += value
+ puts 'up to 100'
end
end
end
@@ -538,11 +600,12 @@ end
def get_commerical_tax
tax = 0.0
- self.sale_taxes.each do |tax|
- if tax.tax_name == "Commerical Tax"
- tax += tax.tax_payable_amount
+ self.sale_taxes.each do |taxobj|
+ if taxobj.tax_name == "Commerical Tax"
+ tax += taxobj.tax_payable_amount
end
end
+ return tax
end
private
diff --git a/app/models/sale_payment.rb b/app/models/sale_payment.rb
index c78b6cd8..59cee9a6 100644
--- a/app/models/sale_payment.rb
+++ b/app/models/sale_payment.rb
@@ -54,6 +54,14 @@ class SalePayment < ApplicationRecord
remark = "Payment #{payment_method}- for Invoice #{invoice.receipt_no} Due [#{amount_due}]| pay amount -> #{cash_amount} | Payment Status ->#{payment_status}"
sale_audit = SaleAudit.record_payment(invoice.id, remark, action_by)
+ # update complete order items in oqs
+ SaleOrder.where("sale_id = '#{ invoice.sale_id }'").find_each do |sodr|
+ AssignedOrderItem.where("order_id = '#{ sodr.order_id }'").find_each do |aoi|
+ aoi.delivery_status = 1
+ aoi.save
+ end
+ end
+
return true, self.save
else
#record an payment in sale-audit
@@ -266,6 +274,8 @@ class SalePayment < ApplicationRecord
shift = ShiftSale.current_open_shift(self.sale.cashier_id)
if !shift.nil?
shift.update(self.sale)
+ self.sale.shift_sale_id = shift.id
+ self.sale.save
end
end
@@ -324,7 +334,7 @@ class SalePayment < ApplicationRecord
}, :timeout => 10)
rescue Net::OpenTimeout
response = { status: false }
-
+
rescue OpenURI::HTTPError
response = { status: false}
diff --git a/app/models/shift_sale.rb b/app/models/shift_sale.rb
index c6265e20..e2980593 100644
--- a/app/models/shift_sale.rb
+++ b/app/models/shift_sale.rb
@@ -20,16 +20,18 @@ class ShiftSale < ApplicationRecord
#if current_user
#find open shift where is open today and is not closed and login by current cashier
today_date = DateTime.now.strftime("%Y-%m-%d")
- puts today_date
- shift = ShiftSale.where("DATE(shift_started_at)= #{ today_date } and shift_started_at is not null and shift_closed_at is null and employee_id = #{current_user}").take
+ # puts today_date
+ # shift = ShiftSale.where("DATE(shift_started_at)= #{ today_date } and shift_started_at is not null and shift_closed_at is null and employee_id = #{current_user}").take
+ shift = ShiftSale.where("DATE(shift_started_at)=? and shift_started_at is not null and shift_closed_at is null and employee_id = #{current_user}",today_date).take
+
return shift
#end
end
- def create(opening_balance,current_user)
- self.cashier_terminal_id = CashierTerminal.first.id
+ def create(opening_balance,cashier_terminal, current_user)
+ self.cashier_terminal_id = cashier_terminal
self.shift_started_at = DateTime.now
self.employee_id = current_user.id
self.opening_balance = opening_balance
diff --git a/app/pdf/close_cashier_pdf.rb b/app/pdf/close_cashier_pdf.rb
index 3223c4b3..b3b29914 100644
--- a/app/pdf/close_cashier_pdf.rb
+++ b/app/pdf/close_cashier_pdf.rb
@@ -1,5 +1,5 @@
class CloseCashierPdf < 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
+ 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, shift_sale,shop_details)
self.page_width = 210
self.page_height = 7000
@@ -11,6 +11,8 @@ class CloseCashierPdf < Prawn::Document
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
@@ -30,9 +32,8 @@ class CloseCashierPdf < Prawn::Document
stroke_horizontal_rule
- cashier_info(shift_sale)
+ shift_detail(shift_sale)
- footer
end
@@ -50,60 +51,126 @@ class CloseCashierPdf < Prawn::Document
stroke_horizontal_rule
end
- def cashier_info(shift_sale)
+ def shift_detail(shift_sale)
move_down 7
- # move_down 2
- y_position = cursor
+ y_position = cursor
bounding_box([0,y_position], :width =>self.label_width, :height => self.item_height) do
- text "Cashier: #{shift_sale.receipt_no}", :size => self.item_font_size,:align => :left
+ text "Cashier : ", :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 "#{ shift_sale.bookings[0].dining_facility.type } - #{ sale_data.bookings[0].dining_facility.name }" , :size => self.item_font_size,:align => :right
+ text "#{ shift_sale.employee.name}" , :size => self.item_font_size,:align => :left
end
- move_down 5
y_position = cursor
bounding_box([0,y_position], :width =>self.label_width, :height => self.item_height) do
- text "Cashier Station Sta: #{shift_sale.receipt_no}", :size => self.item_font_size,:align => :left
+ text "Cashier Station : ", :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 "#{ shift_sale.bookings[0].dining_facility.type } - #{ sale_data.bookings[0].dining_facility.name }" , :size => self.item_font_size,:align => :right
+ text "#{ shift_sale.cashier_terminal.name}" , :size => self.item_font_size,:align => :left
end
-
- move_down 5
+
y_position = cursor
bounding_box([0,y_position], :width =>self.label_width, :height => self.item_height) do
- text "Opening Date", :size => self.item_font_size,:align => :left
+ text "Opening Float : ", :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 "#{ shift_sale.bookings[0].dining_facility.type } - #{ sale_data.bookings[0].dining_facility.name }" , :size => self.item_font_size,:align => :right
+ text "#{ shift_sale.opening_balance}" , :size => self.item_font_size,:align => :left
end
- move_down 5
y_position = cursor
bounding_box([0,y_position], :width =>self.label_width, :height => self.item_height) do
- text "Closing Date: #{shift_sale.receipt_no}", :size => self.item_font_size,:align => :left
+ text "Closing Float : ", :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 "#{ shift_sale.bookings[0].dining_facility.type } - #{ sale_data.bookings[0].dining_facility.name }" , :size => self.item_font_size,:align => :right
+ text "#{ shift_sale.closing_balance}" , :size => self.item_font_size,:align => :left
end
+ move_down 10
+
+ y_position = cursor
+ bounding_box([0,y_position], :width =>self.item_description_width, :height => 20) do
+ text "Received Amount :", :size => self.item_font_size, :align => :right
+ end
+ bounding_box([self.item_description_width,y_position], :width =>self.price_width, :height => 20) do
+ text "#{shift_sale.closing_balance}", :size => self.item_font_size, :align => :right
+ end
+
+ y_position = cursor
+ bounding_box([0,y_position], :width =>self.item_description_width, :height => 20) do
+ text "Net Sales:", :size => self.item_font_size, :align => :right
+ end
+ bounding_box([self.item_description_width,y_position], :width =>self.price_width, :height => 20) do
+ text "#{shift_sale.nett_sales}", :size => self.item_font_size, :align => :right
+ end
+
+ y_position = cursor
+ bounding_box([0,y_position], :width =>self.item_description_width, :height => 20) do
+ text "Total Tax :", :size => self.item_font_size, :align => :right
+ end
+ bounding_box([self.item_description_width,y_position], :width =>self.price_width, :height => 20) do
+ text "#{shift_sale.total_taxes}", :size => self.item_font_size, :align => :right
+ end
+
+ y_position = cursor
+ bounding_box([0,y_position], :width =>self.item_description_width, :height => 20) do
+ text "Cash Payment :", :size => self.item_font_size, :align => :right
+ end
+ bounding_box([self.item_description_width,y_position], :width =>self.price_width, :height => 20) do
+ text "#{shift_sale.cash_sales}", :size => self.item_font_size, :align => :right
+ end
+
+ y_position = cursor
+ bounding_box([0,y_position], :width =>self.item_description_width, :height => 20) do
+ text "Credit Payment :", :size => self.item_font_size, :align => :right
+ end
+ bounding_box([self.item_description_width,y_position], :width =>self.price_width, :height => 20) do
+ text "#{shift_sale.credit_sales}", :size => self.item_font_size, :align => :right
+ end
+
+ y_position = cursor
+ bounding_box([0,y_position], :width =>self.item_description_width, :height => 20) do
+ text "Other Payment :", :size => self.item_font_size, :align => :right
+ end
+ bounding_box([self.item_description_width,y_position], :width =>self.price_width, :height => 20) do
+ text "#{shift_sale.other_sales}", :size => self.item_font_size, :align => :right
+ end
+
+ y_position = cursor
+ bounding_box([0,y_position], :width =>self.item_description_width, :height => 20) do
+ text "Total Sale :", :size => self.item_font_size, :align => :right
+ end
+ bounding_box([self.item_description_width,y_position], :width =>self.price_width, :height => 20) do
+ text "#{shift_sale.total_revenue}", :size => self.item_font_size, :align => :right
+ end
+
+ y_position = cursor
+ bounding_box([0,y_position], :width =>self.item_description_width, :height => 20) do
+ text "Discount Amount :", :size => self.item_font_size, :align => :right
+ end
+ bounding_box([self.item_description_width,y_position], :width =>self.price_width, :height => 20) do
+ text "#{shift_sale.total_discounts}", :size => self.item_font_size, :align => :right
+ end
+
+ y_position = cursor
+ bounding_box([0,y_position], :width =>self.item_description_width, :height => 20) do
+ text "Commercial Tax :", :size => self.item_font_size, :align => :right
+ end
+ bounding_box([self.item_description_width,y_position], :width =>self.price_width, :height => 20) do
+ text "#{shift_sale.commercial_taxes}", :size => self.item_font_size, :align => :right
+ end
+
+ y_position = cursor
+ bounding_box([0,y_position], :width =>self.item_description_width, :height => 20) do
+ text "Grand Total :", :size => self.item_font_size, :align => :right
+ end
+ bounding_box([self.item_description_width,y_position], :width =>self.price_width, :height => 20) do
+ text "#{shift_sale.grand_total}", :size => self.item_font_size, :align => :right
+ end
+
move_down 5
end
-
-
- def footer
- move_down 5
- stroke_horizontal_rule
- move_down 5
-
- text "Thank You! See you Again", :left_margin => -10, :size => self.header_font_size,:align => :center
-
- move_down 5
- end
-
end
diff --git a/app/views/origami/cash_ins/new.html.erb b/app/views/origami/cash_ins/new.html.erb
index 1c513895..efc8a22b 100644
--- a/app/views/origami/cash_ins/new.html.erb
+++ b/app/views/origami/cash_ins/new.html.erb
@@ -24,26 +24,21 @@
+
+ | Reference Number
+ |
+ |
+
+
+ | Amount
+ |
+ |
+
-
-
-
-
-
-
+
+
@@ -76,4 +71,7 @@ $('#cash_in').on('click',function(){
}
});
})
+$('#back').on('click',function(){
+ window.location.href = '/origami';
+})
diff --git a/app/views/origami/cash_outs/new.html.erb b/app/views/origami/cash_outs/new.html.erb
index 17f9bdf8..9d628f24 100644
--- a/app/views/origami/cash_outs/new.html.erb
+++ b/app/views/origami/cash_outs/new.html.erb
@@ -1,6 +1,8 @@
-Payment Debit
+
+
-
+
+
Payment Debit
| Payment Reference
@@ -20,13 +22,12 @@
|
+
+
+
+
+
-
-
-
diff --git a/app/views/origami/payments/show.html.erb b/app/views/origami/payments/show.html.erb
index a9a542b6..292ae5e1 100644
--- a/app/views/origami/payments/show.html.erb
+++ b/app/views/origami/payments/show.html.erb
@@ -194,10 +194,10 @@
0.0
<% end %>
-
+
-
Balance
-
<%= @sale_data.grand_total %>
+
Balance
+
<%= @sale_data.grand_total %>
diff --git a/app/views/origami/sale_edit/edit.html.erb b/app/views/origami/sale_edit/edit.html.erb
index 76bbeb08..13812e59 100644
--- a/app/views/origami/sale_edit/edit.html.erb
+++ b/app/views/origami/sale_edit/edit.html.erb
@@ -49,18 +49,18 @@
| <%= count %> |
<%= sale_item.product_name %> |
- <% if sale_item.remark != 'void' %>
- |
- |
+ <% if sale_item.remark != 'void' && sale_item.remark != 'edit' %>
+ |
+ |
|
- <% elsif sale_item.qty.to_i < 0 %>
+ <% elsif sale_item.qty.to_i < 0 || sale_item.remark == 'edit' %>
|
|
-
+
|
<% else %>
|
@@ -101,11 +101,14 @@
$(document).ready(function(){
$(".update").on('click',function() {
var sale_item_id = $(this).attr('data-id');
- var ajax_url = "/origami/item_void";
+ var qty = $('#'+sale_item_id + "_qty").val();
+ var price = $('#'+ sale_item_id + "_price").val();
+ console.log(qty + "|" + price)
+ var ajax_url = "/origami/item_edit";
$.ajax({
type: "POST",
url: ajax_url,
- data: 'order_id='+ order_id,
+ data: 'sale_item_id='+ sale_item_id + "&update_qty="+qty + "&update_price="+ price,
success:function(result){
location.reload();
}
diff --git a/app/views/origami/shifts/new.html.erb b/app/views/origami/shifts/new.html.erb
index 2903a8ae..8d3ca457 100644
--- a/app/views/origami/shifts/new.html.erb
+++ b/app/views/origami/shifts/new.html.erb
@@ -1,16 +1,23 @@
Open Cashier
-
+
-
Del
-
Clr
-
Ent
+
Clr
+
Calculate
+
Open Cashier
@@ -60,19 +62,58 @@