wip on entering individual date for invoices
This commit is contained in:
parent
b2882d8592
commit
76be8fdf1a
3 changed files with 37 additions and 3 deletions
|
|
@ -26,9 +26,32 @@ class GroupOrderInvoicesController < ApplicationController
|
|||
end
|
||||
end
|
||||
|
||||
def create_multiple
|
||||
invoice_date = params[:group_order_invoice][:invoice_date]
|
||||
order_id = params[:group_order_invoice][:order_id]
|
||||
puts "
|
||||
" + "______________" + "
|
||||
" + "______________" + "
|
||||
" + "______________" + "
|
||||
" + "#{invoice_date}" + "
|
||||
" + "______________"+ "
|
||||
" + "______________"+ "
|
||||
" + "______________"
|
||||
raise "#{invoice_date}"
|
||||
gos = GroupOrder.find_by(order_id: params[:order_id])
|
||||
for go in gos
|
||||
GroupOrderInvoice.find_or_create_by!(group_order_id: go.id)
|
||||
respond_to do |format|
|
||||
format.js
|
||||
end
|
||||
end
|
||||
redirect_back fallback_location: root_path
|
||||
rescue => error
|
||||
redirect_back fallback_location: root_path, notice: 'Something went wrong', :alert => I18n.t('errors.general_msg', :msg => error)
|
||||
end
|
||||
|
||||
def create
|
||||
go = GroupOrder.find(params[:group_order])
|
||||
@order = go.order
|
||||
GroupOrderInvoice.find_or_create_by!(group_order_id: go.id)
|
||||
respond_to do |format|
|
||||
format.js
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue