update credit

This commit is contained in:
Aung Myo
2017-06-26 19:02:36 +06:30
parent f3417a61c0
commit 376af85c64
5 changed files with 91 additions and 1 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

@@ -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

@@ -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

@@ -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

@@ -225,6 +225,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"