diff --git a/app/assets/stylesheets/origami.scss b/app/assets/stylesheets/origami.scss index 9f7de6dd..e097b448 100755 --- a/app/assets/stylesheets/origami.scss +++ b/app/assets/stylesheets/origami.scss @@ -59,11 +59,13 @@ select.form-control { padding: 0px 0px 7px 0px; } +/* .order-info { min-height:300px; max-height:500px; overflow:auto } +*/ .others-payment{ line-height:100px; diff --git a/app/controllers/transactions/bookings_controller.rb b/app/controllers/transactions/bookings_controller.rb index 66418caa..3b8e241e 100644 --- a/app/controllers/transactions/bookings_controller.rb +++ b/app/controllers/transactions/bookings_controller.rb @@ -20,7 +20,9 @@ class Transactions::BookingsController < ApplicationController @bookings = 0 end end - + @receipt_no = filter + @from = from + @to = to respond_to do |format| format.html # index.html.erb format.json { render json: @bookings } diff --git a/app/controllers/transactions/credit_notes_controller.rb b/app/controllers/transactions/credit_notes_controller.rb index e28b5331..09f48d66 100755 --- a/app/controllers/transactions/credit_notes_controller.rb +++ b/app/controllers/transactions/credit_notes_controller.rb @@ -14,20 +14,21 @@ class Transactions::CreditNotesController < ApplicationController to = params[:to] if filter.nil? && from.nil? && to.nil? && customer.nil? - @sales = Sale.where('payment_status = ?', Sale::SALE_STATUS_OUTSTANDING) + @credit_notes = Sale.where('payment_status = ?', Sale::SALE_STATUS_OUTSTANDING) else sale = Sale.search_credit_sales(customer,filter,from,to) if sale.count > 0 - @sales = sale - @sales = Kaminari.paginate_array(@sales).page(params[:page]).per(20) + @credit_notes = sale + @credit_notes = Kaminari.paginate_array(@credit_notes).page(params[:page]).per(20) else - @sales = 0 + @credit_notes = 0 end end - +puts "sssssssssssss" +puts @credit_notes.to_json respond_to do |format| format.html # index.html.erb - format.json { render json: @sales } + format.json { render json: @credit_notes } end end diff --git a/app/controllers/transactions/orders_controller.rb b/app/controllers/transactions/orders_controller.rb index 496d43cd..7bc1e969 100755 --- a/app/controllers/transactions/orders_controller.rb +++ b/app/controllers/transactions/orders_controller.rb @@ -20,6 +20,10 @@ class Transactions::OrdersController < ApplicationController else @orders = [] end + + @receipt_no = filter + @from = from + @to = to respond_to do |format| format.html # index.html.erb diff --git a/app/controllers/transactions/sales_controller.rb b/app/controllers/transactions/sales_controller.rb index 8486d9ca..fafc89f3 100755 --- a/app/controllers/transactions/sales_controller.rb +++ b/app/controllers/transactions/sales_controller.rb @@ -22,6 +22,9 @@ class Transactions::SalesController < ApplicationController @sales = 0 end end + @receipt_no = receipt_no + @from = from + @to = to # if receipt_no.nil? && search_date.nil? # @sales = Sale.where("NOT sale_status = 'void' " ).order("sale_id desc").limit(500) diff --git a/app/models/sale_item.rb b/app/models/sale_item.rb index d4aaf5ee..ad46fa1f 100755 --- a/app/models/sale_item.rb +++ b/app/models/sale_item.rb @@ -11,6 +11,21 @@ class SaleItem < ApplicationRecord def compute_item end + # Add Sale Items + def self.add_sale_items(sale_items, ) + sale_items.each do|saleitemObj| + saleitemObj.remark = 'foc' + saleitemObj.save + @newsaleitem = SaleItem.new + @newsaleitem = saleitemObj.dup + @newsaleitem.save + @newsaleitem.qty = saleitemObj.qty * -1 + @newsaleitem.price = saleitemObj.price * -1 + @newsaleitem.is_taxable = 1 + @newsaleitem.product_name = saleitemObj.product_name + ' (FOC)' + @newsaleitem.save + end + end def self.get_order_items_details(sale_id) order_details = SaleItem.select("sales.total_tax as tax_amount, sales.grand_total as grand_total_amount , sales.total_discount as discount_amount,sales.receipt_date as receipt_date, diff --git a/app/models/sale_payment.rb b/app/models/sale_payment.rb index 1ab1c613..310966dd 100755 --- a/app/models/sale_payment.rb +++ b/app/models/sale_payment.rb @@ -169,12 +169,18 @@ class SalePayment < ApplicationRecord def foc_payment payment_status = false + + # add to sale item with foc + sale_items = SaleItem.find_by_sale_id(self.sale) + SaleItem.add_sale_items(sale_items) + self.payment_method = "foc" self.payment_amount = self.received_amount self.outstanding_amount = self.sale.grand_total.to_f - self.received_amount.to_f self.payment_status = "paid" payment_method = self.save! - sale_update_payment_status(self.received_amount) + sale_update_payment_status(self.received_amount) + return payment_status end diff --git a/app/views/origami/surveys/_form.html.erb b/app/views/origami/surveys/_form.html.erb index 321ec745..b5e9e8e4 100755 --- a/app/views/origami/surveys/_form.html.erb +++ b/app/views/origami/surveys/_form.html.erb @@ -1,57 +1,118 @@
-
- <%= simple_form_for(@survey, :url => origami_create_surveys_path) do |f| %> - <%= f.error_notification %> -
+
+
+ <%= simple_form_for(@survey, :url => origami_create_surveys_path) do |f| %> + <%= f.error_notification %> +
- <%= f.input :child , input_html: { class: 'col-md-8' }%> - <%= f.input :adult , input_html: { class: 'col-md-8' }%> - <%= f.input :male , input_html: { class: 'col-md-8' }%> - <%= f.input :female , input_html: { class: 'col-md-8' }%> - <%= f.input :total_customer, input_html: { class: 'col-md-8'} %> - <%= f.input :local , input_html: { class: 'col-md-8' }%> + <%= f.input :child , input_html: { class: 'col-md-10' }%> + <%= f.input :adult , input_html: { class: 'col-md-10' }%> + <%= f.input :male , input_html: { class: 'col-md-10' }%> + <%= f.input :female , input_html: { class: 'col-md-10' }%> + <%= f.input :total_customer, input_html: { class: 'col-md-10'} %> + <%= f.input :local , input_html: { class: 'col-md-10' }%> -
-
-
- - - -
-
-
-
- - -
-
-
-
- -
+
+
+
+ + + +
+
+
+
+ + +
+
+
+
+ +
+
+ + + + <%= f.input :dining_name, :as => :hidden, :input_html => { :value => @dining_facility.name } %> + <%= f.input :created_by, :as => :hidden, :input_html => { :value => current_login_employee.name } %> + <%= f.input :receipt_no, :as => :hidden, :input_html => { :value => @receipt_no} %> + <%= f.input :total_amount, :as => :hidden, :input_html => { :value => @grand_total } %> +
+
+ <%= f.submit "Submit",:class => 'btn btn-primary btn-lg waves-effect' %>
- +
+
+
+
+
+
+
+
+
+
1
+
2
+
3
+
+
+
+ +
+
+
+
4
+
5
+
6
+
+
+
+ +
+
+
+
7
+
8
+
9
+
+
+
+ +
+
+
+
0
+
.
+
00
+
+
+
+ +
+
+
+
+
DEL
+
CLR
+
+
+
+
- - - <%= f.input :dining_name, :as => :hidden, :input_html => { :value => @dining_facility.name } %> - <%= f.input :created_by, :as => :hidden, :input_html => { :value => current_login_employee.name } %> - <%= f.input :receipt_no, :as => :hidden, :input_html => { :value => @receipt_no} %> - <%= f.input :total_amount, :as => :hidden, :input_html => { :value => @grand_total } %> -
-
- <%= f.submit "Submit",:class => 'btn btn-primary btn-lg waves-effect' %> -
- <% end %> +
+
-
+