Merge branch 'crm' of bitbucket.org:code2lab/sxrestaurant

This commit is contained in:
Yan
2017-06-26 19:28:21 +06:30
9 changed files with 114 additions and 6 deletions

View File

@@ -0,0 +1,18 @@
class Transactions::CreditNotesController < ApplicationController
before_action :set_transactions_sale, only: [:show, :edit, :update, :destroy]
# GET /transactions/sales
# GET /transactions/sales.json
def index
@sales = Sale.where('payment_status = ?', Sale::SALE_STATUS_OUTSTANDING)
respond_to do |format|
format.html # index.html.erb
format.json { render json: @sales }
end
end
end

View File

@@ -20,9 +20,9 @@ class Ability
can :manage, Zone
can :manage, CashierTerminal
can :manage, Employee
can :manage, MembershipSetting
can :manage, MembershipAction
can :manage, PaymentMethodSetting
# can :manage, MembershipSetting
# can :manage, MembershipAction
# can :manage, PaymentMethodSetting
can :manage, TaxProfile
can :manage, PrintSetting
can :manage, Account
@@ -30,9 +30,26 @@ class Ability
can :manage, Order
can :manage, Sale
can :manage, Customer
can :index, :dailysale
can :index, :saleitem
can :add_customer, Customer
can :update_sale_by_customer, Customer
can :index, :discount
can :create, :discount
can :show, :payment
can :create, :payment
can :reprint, :payment
can :move_dining, :movetable
can :moving, :movetable
can :move_dining, :moveroom
elsif user.role == "cashier"
can :read, Order

View File

@@ -22,7 +22,7 @@ class Sale < ApplicationRecord
"monthly" => 1,
"yearly" => 2
}
SALE_STATUS_OUTSTANDING = "outstanding"
SALE_STATUS_COMPLETED = "completed"
def generate_invoice_from_booking(booking_id, requested_by)

View File

@@ -47,7 +47,7 @@
<tbody>
<% @i = 0 %>
<% @crm_customers.each do |crm_customer| %>
<% if crm_customer.customer_id != "CUS-000000000001" && crm_customer.customer_id != "CUS-000000000002" %>
<% if crm_customer.customer_id != "CUS-00001" && crm_customer.customer_id != "CUS-000000000" %>
<tr class="customer_tr" data-ref="<%= crm_customer.customer_id %>">
<td>
<input type="radio" style="width:20px;" name="checkbox" class="checkbox_check" ></td>

View File

@@ -33,6 +33,7 @@
<ul class="dropdown-menu">
<li><%= link_to "Orders ", transactions_orders_path, :tabindex =>"-1" %></li>
<li><%= link_to "Sales ", transactions_sales_path, :tabindex =>"-1" %></li>
<!-- <li><%= link_to "Sales ", transactions_credit_notes_path, :tabindex =>"-1" %></li> -->
</ul>
</li>
<li class="navbar-nav mr-auto dropdown">

View File

@@ -41,7 +41,7 @@
<% if @crm_customers.count > 0 %>
<% @i = 0 %>
<% @crm_customers.each do |crm_customer| %>
<% if crm_customer.customer_id != "CUS-000000000001" && crm_customer.customer_id != "CUS-000000000002" %>
<% if crm_customer.customer_id != "CUS-00000" && crm_customer.customer_id != "CUS-00000000" %>
<tr class="customer_tr" data-ref="<%= crm_customer.customer_id %>">
<td>
<input type="radio" style="width:20px;" name="checkbox" class="checkbox_check" ></td>

View File

@@ -0,0 +1,70 @@
<div class="row">
<div class="col-lg-12">
<ol class="breadcrumb">
<li><a href="<%= crm_root_path %>">Home</a></li>
<li class="active">
<a href="<%= transactions_credit_notes_path %>">Credit Note</a>
</li>
</ol>
</div>
</div>
<div class="row">
<div class="col-lg-12">
<div class="main-box-body clearfix">
<div class="table-responsive">
<table class="table table-striped">
<thead>
<tr>
<th>Sale Id </th>
<th>Receipt no </th>
<th>Credit Amount</th>
<th>Cashier</th>
<th>Customer Name</th>
<th>Receipt Date</th>
</tr>
</thead>
<tbody>
<% @sales.each do |sale| %>
<tr>
<td><%= link_to sale.sale_id, transactions_sale_path(sale) %></td>
<td><%= sale.receipt_no %></td>
<td><%credit = SalePayment.where('sale_id = ? AND payment_method=?', sale.sale_id,"creditnote").first %>
<%= credit.payment_amount rescue '-' %>
</td>
<td><%= sale.cashier_name rescue '-' %></td>
<td><%= link_to sale.customer.name, crm_customer_path(sale.customer_id) %></td>
<td> <%= sale.receipt_date.strftime("%d-%m-%Y") %> </td>
</tr>
<% end %>
</tbody>
</table>
<br>
</div>
</div>
</div>
</div>
<!--
<script type="text/javascript">
$(function () {
$('.datepicker').datepicker({
format : 'dd-mm-yyyy',
autoclose: true
});
$('.datepicker').attr('ReadOnly','true');
$('.datepicker').css('cursor','pointer');
});
</script> -->

View File

@@ -13,6 +13,7 @@ module SXRestaurants
# -- all .rb files in that directory are automatically loaded.
config.active_record.time_zone_aware_types = [:datetime, :time]
config.active_job.queue_adapter = :sidekiq
config.time_zone = 'Asia/Rangoon'
end
end

View File

@@ -228,6 +228,7 @@ Rails.application.routes.draw do
namespace :transactions do
resources :sales
resources :orders
resources :credit_notes
get "/sales/:sale_id/manual_complete_sale" =>"manual_sales#manual_complete_sale", :as => "manual_complete_sale"
get "/sales/:sale_id/void" =>"manual_sales#void", :as => "void"