diff --git a/app/assets/stylesheets/origami.scss b/app/assets/stylesheets/origami.scss index 6b350bf1..30e3781d 100644 --- a/app/assets/stylesheets/origami.scss +++ b/app/assets/stylesheets/origami.scss @@ -179,3 +179,9 @@ select.form-control { tr.discount-item-row:hover { background-color: #e3e3e3 !important; } + +/* Jquery Confirm */ + +.jconfirm-box-container{ + margin-left:-40px !important +} \ No newline at end of file diff --git a/app/controllers/crm/customers_controller.rb b/app/controllers/crm/customers_controller.rb index 646f6475..ce585686 100644 --- a/app/controllers/crm/customers_controller.rb +++ b/app/controllers/crm/customers_controller.rb @@ -46,7 +46,7 @@ class Crm::CustomersController < BaseCrmController end #get customer amount - @customer = Customer.find(params[:id]) + @customer = Customer.find(params[:id]) @response = Customer.get_membership_transactions(@customer) #end customer amount @@ -201,6 +201,6 @@ end def customer_params params.require(:customer).permit(:name, :company, :contact_no, :email, - :date_of_birth,:salution,:gender,:nrc_no,:address,:card_no) + :date_of_birth,:salutation,:gender,:nrc_no,:address,:card_no) end end diff --git a/app/controllers/origami/customers_controller.rb b/app/controllers/origami/customers_controller.rb index 601055e5..373dc2f5 100644 --- a/app/controllers/origami/customers_controller.rb +++ b/app/controllers/origami/customers_controller.rb @@ -39,5 +39,29 @@ class Origami::CustomersController < BaseOrigamiController end end + def update_sale_by_customer + + id = params[:sale_id][0,3] + if(id == "SAL") + sale = Sale.find(params[:sale_id]) + status = sale.update_attributes(customer_id: params[:customer_id]) + else + @booking = BookingOrder.find_by_order_id(params[:sale_id]) + @orders = BookingOrder.where("booking_id = ? ", @booking.booking_id) + + @orders.each do |bo| + order = Order.find(bo.order_id) + status = order.update_attributes(customer_id: params[:customer_id]) + end + + end + + if status == true + render json: JSON.generate({:status => true}) + else + render json: JSON.generate({:status => false, :error_message => "Record not found"}) + end + end + end diff --git a/app/controllers/reports/daily_sale_controller.rb b/app/controllers/reports/daily_sale_controller.rb index 6e1eb85a..ba453f55 100644 --- a/app/controllers/reports/daily_sale_controller.rb +++ b/app/controllers/reports/daily_sale_controller.rb @@ -4,6 +4,10 @@ class Reports::DailySaleController < BaseReportController from, to ,report_type = get_date_range_from_params @sale_data = Sale.daily_sales_list(from,to) @tax = SaleTax.get_tax(from,to) + respond_to do |format| + format.html + format.xls + end end def show diff --git a/app/controllers/reports/receipt_no_controller.rb b/app/controllers/reports/receipt_no_controller.rb index 86c8d981..d85c7d57 100644 --- a/app/controllers/reports/receipt_no_controller.rb +++ b/app/controllers/reports/receipt_no_controller.rb @@ -8,6 +8,10 @@ class Reports::ReceiptNoController < BaseReportController puts to @sale_data = Sale.get_receipt_no_list(from,to) @sale_data = Kaminari.paginate_array(@sale_data).page(params[:page]).per(50) + respond_to do |format| + format.html + format.xls + end end def show diff --git a/app/controllers/reports/sale_item_controller.rb b/app/controllers/reports/sale_item_controller.rb index 1da31aff..eb7d3b86 100644 --- a/app/controllers/reports/sale_item_controller.rb +++ b/app/controllers/reports/sale_item_controller.rb @@ -5,6 +5,11 @@ class Reports::SaleItemController < BaseReportController from, to, report_type = get_date_range_from_params @sale_data = Sale.get_by_range_by_saleitems(from,to,Sale::SALE_STATUS_COMPLETED,report_type) + + respond_to do |format| + format.html + format.xls + end end def show diff --git a/app/models/customer.rb b/app/models/customer.rb index 4e25c9bc..5debec38 100644 --- a/app/models/customer.rb +++ b/app/models/customer.rb @@ -6,7 +6,7 @@ class Customer < ApplicationRecord has_many :orders has_many :sales - validates_presence_of :name, :contact_no, :email,:company,:card_no + validates_presence_of :name, :contact_no, :email,:card_no validates :contact_no, uniqueness: true validates :email, uniqueness: true validates :card_no, uniqueness: true diff --git a/app/views/api/customers/index.json.jbuilder b/app/views/api/customers/index.json.jbuilder index 2c3c07a7..0d1d37e7 100644 --- a/app/views/api/customers/index.json.jbuilder +++ b/app/views/api/customers/index.json.jbuilder @@ -1,3 +1,3 @@ -json.array! @customers, :id, :name, :company, :contact_no,:salution, +json.array! @customers, :id, :name, :company, :contact_no,:salutation, :gender,:nrc_no,:address,:card_no, :membership_type, :membership_id, :created_at diff --git a/app/views/api/customers/show.json.jbuilder b/app/views/api/customers/show.json.jbuilder index db56961b..acf54ac1 100644 --- a/app/views/api/customers/show.json.jbuilder +++ b/app/views/api/customers/show.json.jbuilder @@ -1,4 +1,4 @@ -json.extract! @customer, :id, :name, :company, :contact_no,:salution, +json.extract! @customer, :id, :name, :company, :contact_no,:salutation, :gender,:nrc_no,:address,:card_no, :membership_type, :membership_id, :created_at json.invoices do diff --git a/app/views/crm/customers/_crm_customer.json.jbuilder b/app/views/crm/customers/_crm_customer.json.jbuilder index c80c1716..1b1b237e 100644 --- a/app/views/crm/customers/_crm_customer.json.jbuilder +++ b/app/views/crm/customers/_crm_customer.json.jbuilder @@ -1,2 +1,2 @@ -json.extract! crm_customer, :id, :name, :company, :contact_no, :email, :date_of_birth, :membership_id, :membership_type, :membership_authentication_code, :created_at, :updated_at +json.extract! crm_customer, :id, :name, :company, :contact_no, :email, :date_of_birth, :membership_id, :membership_type, :membership_authentication_code, :created_at, :updated_at,:salutation, :gender,:nrc_no,:address,:card_no json.url crm_customer_url(crm_customer, format: :json) diff --git a/app/views/crm/customers/index.html.erb b/app/views/crm/customers/index.html.erb index e7b47460..3678008e 100644 --- a/app/views/crm/customers/index.html.erb +++ b/app/views/crm/customers/index.html.erb @@ -120,7 +120,7 @@ $(document).on('click',".customer_tr",function(){ $('#customer_company').val(data.company); $('#customer_contact_no').val(data.contact_no); $('#customer_email').val(data.email); - $('#customer_salution').val(data.salution); + $('#customer_salutation').val(data.salutation); $('#customer_nrc_no').val(data.nrc_no); $('#customer_card_no').val(data.card_no); $('#customer_address').val(data.address); @@ -133,11 +133,11 @@ $(document).on('click',".customer_tr",function(){ $('.female').prop( "checked", true ) } - if(data.salution == 'Mr') { + if(data.salutation == 'Mr') { $('.mr').prop( "checked", true ) - }else if(data.salution == 'Miss') { + }else if(data.salutation == 'Miss') { $('.miss').prop( "checked", true ) - }else if(data.salution == 'Mrs'){ + }else if(data.salutation == 'Mrs'){ $('.mrs').prop( "checked", true ) }else{ $('.mdm').prop( "checked", true ) diff --git a/app/views/crm/customers/show.json.jbuilder b/app/views/crm/customers/show.json.jbuilder index d41edb5d..86901801 100644 --- a/app/views/crm/customers/show.json.jbuilder +++ b/app/views/crm/customers/show.json.jbuilder @@ -1,5 +1,4 @@ json.extract! @crm_customer, :id, :name, :company, :contact_no, :email, :date_of_birth, :membership_id, :membership_type, :membership_authentication_code, - :created_at, :updated_at, - :salution, :gender,:nrc_no,:address,:card_no + :salutation, :gender,:nrc_no,:address,:card_no json.url crm_customer_url(@crm_customer, format: :json) diff --git a/app/views/origami/customers/index.html.erb b/app/views/origami/customers/index.html.erb index 3b192319..8a811073 100644 --- a/app/views/origami/customers/index.html.erb +++ b/app/views/origami/customers/index.html.erb @@ -225,7 +225,7 @@ $('.select > option[value="'+data.membership_id+'"]').attr('selected','selected'); $('.membership_authentication_code').val(data.membership_authentication_code); - $('#customer_salution').val(data.salution); + $('#customer_salutation').val(data.salutation); $('#customer_nrc_no').val(data.nrc_no); if (data.gender == 'Male') { @@ -234,11 +234,11 @@ $('.female').prop( "checked", true ) } - if (data.salution == 'Mr') { + if (data.salutation == 'Mr') { $('.mr').prop( "checked", true ) - } else if(data.salution == 'Miss') { + } else if(data.salutation == 'Miss') { $('.miss').prop( "checked", true ) - }else if(data.salution == 'Mrs'){ + }else if(data.salutation == 'Mrs'){ $('.mrs').prop( "checked", true ) }else{ $('.mdm').prop( "checked", true ) @@ -246,7 +246,7 @@ $('#update_customer').removeAttr('disabled').val(''); $('#update_customer').attr('value', 'Update'); - $('#submit_customer').attr('disabled','disabled'); + // $('#submit_customer').attr('disabled','disabled'); $("#new_customer").attr('class', 'simple_form edit_customer'); var id = "edit_customer_"+$('#customer_id').val(); diff --git a/app/views/origami/home/show.html.erb b/app/views/origami/home/show.html.erb index 139697e3..364b0f91 100644 --- a/app/views/origami/home/show.html.erb +++ b/app/views/origami/home/show.html.erb @@ -301,7 +301,7 @@ $(document).ready(function(){ // bind customer to order or sale $("#customer").on('click', function(){ var sale = $('#sale_id').val(); - if (sale!="") { + if (sale) { var sale_id = sale }else{ var sale_id = $('#save_order_id').attr('data-order'); diff --git a/app/views/reports/sale_item/index.xls.erb b/app/views/reports/sale_item/index.xls.erb index dfcc18d4..2807ec3f 100644 --- a/app/views/reports/sale_item/index.xls.erb +++ b/app/views/reports/sale_item/index.xls.erb @@ -1,116 +1,136 @@ -
| Sale (<%= params[:from] rescue '-' %> - <%= params[:to] rescue '-'%>) | -||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Sr.no | -Date | -Daily Void Amount | -Daily mpu Sales | -Daily master Sales | -Daily visa Sales | -Daily jcb Sales | -Daily paypar Sales | -Daily Cash Sales | -Daily Credit Sales | -Daily FOC Sales | -(Daily Discount) | -Grand Total + Rounding Adj. |
- Rounding Adj. | -Grand Total | -||
| <%= count %> | -<%= sale[:sale_date].strftime("#{sale[:sale_date].day.ordinalize} %b") rescue '-' %> | -<%= number_with_delimiter(sprintf("%.2f",sale[:void_amount]), :delimiter => ',') rescue '-'%> | -<%= number_with_delimiter(sprintf("%.2f",sale[:mpu_amount]), :delimiter => ',') rescue '-'%> | -<%= number_with_delimiter(sprintf("%.2f",sale[:master_amount]), :delimiter => ',') rescue '-'%> | -<%= number_with_delimiter(sprintf("%.2f",sale[:visa_amount]), :delimiter => ',') rescue '-'%> | -<%= number_with_delimiter(sprintf("%.2f",sale[:jcb_amount]), :delimiter => ',') rescue '-'%> | -<%= number_with_delimiter(sprintf("%.2f",sale[:paypar_amount]), :delimiter => ',') rescue '-'%> | -<%= number_with_delimiter(sprintf("%.2f",sale[:cash_amount]), :delimiter => ',') rescue '-'%> | -<%= number_with_delimiter(sprintf("%.2f",sale[:credit_amount]), :delimiter => ',') rescue '-'%> | -<%= number_with_delimiter(sprintf("%.2f",sale[:foc_amount]), :delimiter => ',') rescue '-'%> | -(<%= number_with_delimiter(sprintf("%.2f",sale[:total_discount]), :delimiter => ',') rescue '-'%>) | -<%= number_with_delimiter(sprintf("%.2f",sale[:grand_total].to_f + sale[:rounding_adj].to_f ), :delimiter => ',') rescue '-'%> | -<%= number_with_delimiter(sprintf("%.2f",sale[:rounding_adj].to_f), :delimiter => ',') rescue '-'%> | -<%= number_with_delimiter(sprintf("%.2f",sale[:grand_total]), :delimiter => ',') rescue '-'%> | -||
| Total | -<%= number_with_delimiter(sprintf("%.2f",mpu_amount), :delimiter => ',') rescue '-'%> | -<%= number_with_delimiter(sprintf("%.2f",master_amount), :delimiter => ',') rescue '-'%> | -<%= number_with_delimiter(sprintf("%.2f",visa_amount), :delimiter => ',') rescue '-'%> | -<%= number_with_delimiter(sprintf("%.2f",jcb_amount), :delimiter => ',') rescue '-'%> | -<%= number_with_delimiter(sprintf("%.2f",paypar_amount), :delimiter => ',') rescue '-'%> | -<%= number_with_delimiter(sprintf("%.2f",cash), :delimiter => ',') rescue '-'%> | -<%= number_with_delimiter(sprintf("%.2f",credit), :delimiter => ',') rescue '-'%> | -<%= number_with_delimiter(sprintf("%.2f",foc), :delimiter => ',') rescue '-'%> | -(<%= number_with_delimiter(sprintf("%.2f",discount), :delimiter => ',') rescue '-'%>) | -<%= number_with_delimiter(sprintf("%.2f",total), :delimiter => ',') rescue '-'%> | -<%= number_with_delimiter(sprintf("%.2f",rounding_adj), :delimiter => ',') rescue '-'%> | -<%= number_with_delimiter(sprintf("%.2f",grand_total), :delimiter => ',') rescue '-'%> | -||||
| <%= tax.tax_name rescue '-'%> | -<%= number_with_delimiter(sprintf("%.2f",tax.tax_amount), :delimiter => ',') rescue '-'%> | -- | ||||||||||||
| Net Amount | -<%= number_with_delimiter(sprintf("%.2f",net), :delimiter => ',') rescue '-'%> | -- | ||||||||||||
| From Date : <%= params[:from] %> , To Date : <%= params[:to] %> | +||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Shift Name = <%= @shift_from %> - <%= @shift_to %> ( <%= cashier_name %> ) | +||||||||||||||
| + | Menu Category | +Code | +Product | +Total Item | +Unit Price | +Revenue | +||||||||
| <%= sale.account_name %> | ++ | Total Price By <%= sale.account_name %> | ++ <% @totalByAccount.each do |account, total| %> + <% if sale.account_id == account %> + <%= total %> + <% end %> + <% end %> + | +|||||||||||
| + <% if !cate_arr.include?(sale.menu_category_id) %> + | <%= sale.menu_category_name %> | + <% cate_arr.push(sale.menu_category_id) %> + <% else %> +<% end %> - | ||||||||||||