<%= render "layouts/portlet-config" %> <%= render "layouts/theme-panel" %> <% if flash[:error] %>
× <%= flash[:error] %>
<% end %> <%= render "layouts/breadcrumbs" %> <%= form_tag({:action=>'create'} ,:multipart=>true,:id=>'myForms' ) do %>
checked="checked"<% end %>/> Export 
checked="checked"<% end %> value="L" onclick="get_insight_details();"/> Local 

Total Invoices Balance<%=@tseach%>

<% if @TotalSale.length >0 if @TotalSale[0].totalAmount.to_f >0 %> <%=currency_formatted(@TotalSale[0].totalAmount)%> <% else %> 0.00 <% end %> <% else %> 0.00 <% end %>

Total Due Outstanding

<% if @TotalOutStand.to_f >0 %> <%=currency_formatted(@TotalOutStand)%> <% else %> 0.00 <% end %>

Last Month Sale

<% if @TotalLastSale.length >0 if @TotalLastSale[0].totalAmount.to_f >0 %> <%=currency_formatted(@TotalLastSale[0].totalAmount)%> <% else %> 0.00 <% end %> <% else %> 0.00 <% end %>

Current Month Sale

<% if @TotalCurSale.length >0 %> <%=currency_formatted(@TotalCurSale[0].totalAmount)%> <% else %> 0.00 <% end %>

Avg Monthly Sale

<%=currency_formatted((@AvrgMSale.to_f >0 ? @AvrgMSale : '0.00'))%>

Avg Monthly Receiving

<%=currency_formatted((@AvrgMRecv.to_f >0 ? @AvrgMRecv : '0.00'))%>
<% i = 1 totalinvoices = 0 totalinvamt = 0 totalinvdue = 0 toalrecived = 0 totalbalance = 0 if @CustomerDtl.length >0 @CustomerDtl.each do |custm| totalinvoices += custm.totalInvoice.to_f totalinvamt += custm.totalAmount.to_f if custm.duepends == 'Y' totalinvdue += custm.totaldueamt.to_f end %> <% k = 1 newinvamt = 0 newdueamt = 0 newcomm = 0 newcredits = 0 newcommulative = 0 dyscredits = 0 trecived = 0 afrecvbala = 0 objcustomerbill = get_all_selected_customer_bills(custm.hd_customer_id,@finayear,@lastfinyear) if objcustomerbill.length >0 objcustomerbill.each do |custdetail| newinvamt += custdetail.totalinvoice.to_f if custdetail.duepends == 'Y' newdueamt += custdetail.balanceamount.to_f else newdueamt += 0 end newcomm += custdetail.cummulative.to_i newcredits += custdetail.creditdays.to_i >0 ? custdetail.creditdays.to_i : 0 dyscredits += custdetail.newcreditdays.to_i >0 ? custdetail.newcreditdays.to_i : 0 if k ==1 if custdetail.duepends == 'Y' newcommulative = custdetail.balanceamount.to_f end else if custdetail.duepends == 'Y' newcommulative += custdetail.balanceamount.to_f end end newcomm +=newcommulative.to_f %> <% k +=1 end %> <% else %> <% end %> <% i +=1 end %> <% else %> <% end %>
View SL.No. Customer Name No of Invoices Total Invoice
Amount
Received
Amount
Balance
Amount
Last Payment
Details
Click Below
to Send Mail
<%=i%> <%=custm.cs_customername%> <%=custm.totalInvoice%> <%=currency_formatted(custm.totalAmount)%> <% recvamtobj = customer_received_payment_total(custm.hd_customer_id,custm.allinvoicesno) toalrecived +=recvamtobj.to_f %> <%=currency_formatted(recvamtobj)%> <% afterecvcustotal = custm.totalAmount.to_f-recvamtobj.to_f totalbalance += afterecvcustotal.to_f %> <%=currency_formatted(afterecvcustotal)%> <%=custm.lastdate%>
No Record(s) Found.
Grand Total <%=currency_formatted(totalinvoices)%> <%=currency_formatted(totalinvamt)%> <%=currency_formatted(toalrecived)%> <%=currency_formatted(totalbalance)%>
No Record(s) Found.
  <% if @OrdPrint!=nil %> <% end %>
<% nmonthdate2 = @nmonthdate1.to_i nmsmth = nmonthdate2.to_i+5 nmsmth = nmsmth.to_i nmonthdate1 = 1 %> <% for nmonthdate1 in 1..6 if nmonthdate2.to_i >12 nmonthdate2 = 1 end %> <% nmonthdate2 +=1 end %> <% i = 1 totalinvoices = 0 totalinvamt = 0 totalinvdue = 0 firsttotal = 0 secontotal = 0 thirdtotal = 0 fourthtotal = 0 fifthtotal = 0 sixtotal = 0 morethansix = 0 totalamts = 0 if @DueAsonDate.length >0 @DueAsonDate.each do |custm| newtotal = 0 newsixmtotal = 0 totalinvoices += custm.totalInvoice.to_f totalinvamt += custm.totalAmount.to_f totalinvdue += custm.totaldueamt.to_f colorcodes = "" if i.to_i%2 == 0 colorcodes = "#add8e6" end %> <% months3 = @nmonthdate1.to_i myyears = @nbegindate.to_i for nmonthdate1 in 1..6 if months3.to_i >12 months3 = 1 myyears = myyears.to_i+1 end %> <% months3 +=1 end %> <% i +=1 end %> <% else %> <% end %>
SL.No. Customer Name As on Date Dues <%=Date::MONTHNAMES[nmonthdate2.to_i]%> More Than
Six Month
Total
<%=i%> <%=custm.cs_customername%> <%=currency_formatted(custm.totaldueamt)%> <% mnthtotals = total_monthwise_dueamounts(custm.hd_customer_id,months3,myyears) newtotal += mnthtotals.to_f %> <%=currency_formatted(mnthtotals)%> <% if nmonthdate1.to_i == 1 firsttotal += mnthtotals.to_f elsif nmonthdate1.to_i == 2 secontotal += mnthtotals.to_f elsif nmonthdate1.to_i == 3 thirdtotal += mnthtotals.to_f elsif nmonthdate1.to_i == 4 fourthtotal += mnthtotals.to_f elsif nmonthdate1.to_i == 5 fifthtotal += mnthtotals.to_f elsif nmonthdate1.to_i == 6 sixtotal += mnthtotals.to_f end %> <% months4 = @nmonthdate1.to_i myyears2 = @nbegindate.to_i for nmonthdate1 in 1..6 if months4.to_i >12 months4 = 1 myyears2 = myyears2.to_i+1 end %> <% if nmonthdate1.to_i == 6 greatersix = greaterthan_sixmonth_dueamounts(custm.hd_customer_id,@nbegindate) newsixmtotal += greatersix.to_f morethansix += greatersix.to_f %> <%=currency_formatted(greatersix)%> <% end %> <% months4 +=1 end %> <% subtotal = newtotal.to_f+newsixmtotal.to_f+custm.totaldueamt.to_f totalamts += subtotal.to_f %> <%=currency_formatted(subtotal)%>
Grand Total <%=currency_formatted(totalinvdue)%> <%=currency_formatted(firsttotal)%> <%=currency_formatted(secontotal)%> <%=currency_formatted(thirdtotal)%> <%=currency_formatted(fourthtotal)%> <%=currency_formatted(fifthtotal)%> <%=currency_formatted(sixtotal)%> <%=currency_formatted(morethansix)%> <%=currency_formatted(totalamts)%>
No Record(s) Found.
  <% if @OrdPrint!=nil %> <% end %>
Monthly
<% end %>
<%=render 'layouts/common/send_email_tocustomer'%>