From 357c7c8682f5defe906112fa19110e882d863f7c Mon Sep 17 00:00:00 2001 From: Aung Myo Date: Wed, 24 Jan 2018 18:12:47 +0630 Subject: [PATCH] update table invoice --- app/assets/javascripts/origami.js | 7 ++++++- app/views/origami/table_invoices/show.html.erb | 14 +++++++------- 2 files changed, 13 insertions(+), 8 deletions(-) diff --git a/app/assets/javascripts/origami.js b/app/assets/javascripts/origami.js index 712ce8f7..d2359593 100755 --- a/app/assets/javascripts/origami.js +++ b/app/assets/javascripts/origami.js @@ -162,8 +162,13 @@ function checkReceiptNoInFirstBillData(receipt_no,payment) { } } } + if (payment) { - return json_data[0]["payment"]; + if (json_data.length>0) { + return json_data[0]["payment"]; + }else{ + return false; + } }else{ return status; } diff --git a/app/views/origami/table_invoices/show.html.erb b/app/views/origami/table_invoices/show.html.erb index d8478468..5270202d 100755 --- a/app/views/origami/table_invoices/show.html.erb +++ b/app/views/origami/table_invoices/show.html.erb @@ -25,22 +25,22 @@
-

Receipt No: +   Receipt No: <%= @sale.receipt_no rescue '' %> -

+
-

Date: <%= @sale.created_at.utc.getlocal.strftime("%d/%m/%Y - %I:%M %p") rescue '-'%>

+ Date: <%= @sale.created_at.utc.getlocal.strftime("%d/%m/%Y - %I:%M %p") rescue '-'%> 
<% if @status_sale == 'sale' %> -

Customer : <%= @sale.customer.name rescue '-' %>

+   Customer : <%= @sale.customer.name rescue '-' %> <%else%> -

Customer : <%= @customer.name rescue "-" %>

+   Customer : <%= @customer.name rescue "-" %> <%end%>
@@ -68,7 +68,7 @@ <% # Can't check for discount - unless sale_item.price == 0 + # unless sale_item.price == 0 %> <%= count %> @@ -77,7 +77,7 @@ <%= sale_item.price %> <% - end + # end end end