Skip to content

Commit

Permalink
Merge pull request #317 from dhanasingh/dev
Browse files Browse the repository at this point in the history
v4.7.5
  • Loading branch information
Arun-TAK authored Sep 13, 2024
2 parents 635446a + 087cca0 commit 324f9c4
Show file tree
Hide file tree
Showing 7 changed files with 35 additions and 15 deletions.
7 changes: 5 additions & 2 deletions README.rdoc
Original file line number Diff line number Diff line change
Expand Up @@ -111,9 +111,12 @@ For more information on features, please refer to the user guide

rake redmine:plugins:migrate NAME=redmine_wktime VERSION=0 RAILS_ENV=production

=== Release Notes for v4.7.4
=== Release Notes for v4.7.5

- Minor changes.
* *Bug* *fixes*
- Fixed month wise date sorting issue in Accounting module
- Fixed monthly closing balance total issue in Accounting module
- Fixed unable to save amount of less then 1 in Accounting module

=== Customization

Expand Down
27 changes: 19 additions & 8 deletions app/controllers/wkgltransaction_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -67,9 +67,12 @@ def index
summary_by = getDatePart('trans_date','year')
alice_name = getDatePart('trans_date','year', 'tyear')
end

trans_date = transaction.minimum(:trans_date) - 1 unless transaction.minimum(:trans_date).blank?
@transDate = @from.blank? ? trans_date : @from -1
order_val = alice_name.split(',').map{|item| (item.split('as').last).strip().to_s + " DESC"}
sort_direction = params[:sort].present? ? (params[:sort].split(':')[1] || "asc") : "desc"

order_val = alice_name.split(',').map{|item| (item.split('as').last).strip().to_s + " #{sort_direction}"}
transaction = transaction.group(" #{summary_by}, detail_type, ledger_id")
.select(" #{alice_name}, detail_type, ledger_id, sum(amount) as amount").order("#{order_val.join(',')}")
@summaryHash = Hash.new
Expand Down Expand Up @@ -102,6 +105,14 @@ def index
@summaryHash[key][:ledger_id] = entry.ledger_id
end
end

dup_summary = sort_direction == "desc" ? @summaryHash.to_a.reverse.to_h : @summaryHash
dup_summary.each do |key, value|
getSummeryamount(key, value)
@summaryHash[key][:CB] = @closeBal
end
@summaryHashFirstKey = dup_summary.keys.first

else
formPagination(transaction.reorder(sort_clause))
isSubCr = isSubtractCr(@selectedLedger.ledger_type)
Expand All @@ -118,8 +129,8 @@ def index
formPagination(transaction.reorder(sort_clause))
end
transaction
end

end
def edit
@transEntry = nil
@transDetails = nil
Expand Down Expand Up @@ -163,9 +174,9 @@ def update

end
wktxnDetail.ledger_id = params["txn_particular_#{i}"]
if (params["txn_debit_#{i}"].blank? || params["txn_debit_#{i}"].to_i == 0) && (params["txn_credit_#{i}"].blank? || params["txn_credit_#{i}"].to_i == 0)
if (params["txn_debit_#{i}"].blank? || params["txn_debit_#{i}"].to_f == 0) && (params["txn_credit_#{i}"].blank? || params["txn_credit_#{i}"].to_f == 0)
next
elsif params["txn_debit_#{i}"].blank? || params["txn_debit_#{i}"].to_i == 0
elsif params["txn_debit_#{i}"].blank? || params["txn_debit_#{i}"].to_f == 0
wktxnDetail.detail_type = 'c'
wktxnDetail.amount = params["txn_credit_#{i}"]
else
Expand Down Expand Up @@ -233,7 +244,7 @@ def update
end
}
end
end
end

def validateTransaction
ret = true
Expand Down Expand Up @@ -298,8 +309,8 @@ def validateTransaction
end

for i in 1..params[:txntotalrow].to_i
txnDebitTotal = txnDebitTotal + params["txn_debit_#{i}"].to_i if !params["txn_debit_#{i}"].blank?
txnCreditTotal = txnCreditTotal + params["txn_debit_#{i}"].to_i if !params["txn_debit_#{i}"].blank?
txnDebitTotal = txnDebitTotal + params["txn_debit_#{i}"].to_f if !params["txn_debit_#{i}"].blank?
txnCreditTotal = txnCreditTotal + params["txn_debit_#{i}"].to_f if !params["txn_debit_#{i}"].blank?
end

if ret
Expand Down
2 changes: 1 addition & 1 deletion app/helpers/wkgltransaction_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -379,7 +379,7 @@ def getSummeryamount(key, value)
@debitTotal += value[:DT].to_f
@creditTotal += value[:CT].to_f
diff = isSubCr ? (value[:DT].to_f - value[:CT].to_f) : (value[:CT].to_f - value[:DT].to_f)
if key == @summaryHash.keys.first
if key == @summaryHashFirstKey
@closeBal = diff + openingBalance.to_f
else
@closeBal = diff + @closeBal
Expand Down
1 change: 1 addition & 0 deletions app/views/wkcrmaccount/edit.api.rsb
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ api.wk_account do
api.account_billing @accountEntry.account_billing
api.account_category @accountEntry.account_category
api.location_id @accountEntry.location_id
api.tax_number @accountEntry.tax_number
api.description @accountEntry.description
api.address(
id: @accountEntry.address.id, address1: @accountEntry.address.address1, address2: @accountEntry.address.address2,
Expand Down
6 changes: 3 additions & 3 deletions app/views/wkgltransaction/_summary_trans_list.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
<thead>
</tr>
<tr>
<th class="lbl-txt-align"><%= l(:label_date_range) %></th>
<%= sort_header_tag('trans_date', :caption => l(:label_date_range), class: "lbl-txt-align", title: "") %>
<th class="lbl-txt-align"><%= l(:label_debit) %></th>
<th class="lbl-txt-align"><%= l(:label_credit) %></th>
<th class="lbl-txt-align"><%= l(:label_closing_balance) %></th>
Expand All @@ -24,12 +24,12 @@
</thead>
<tbody>
<% @summaryHash.each do |key, value| %>
<% getSummeryamount(key, value) %>
<% # getSummeryamount(key, value) %>
<tr>
<td class="lbl-txt-align"><%=h key %></td>
<td class="lbl-txt-align"><%=h "%.2f" % value[:DT].to_f %></td>
<td class="lbl-txt-align"><%=h "%.2f" % value[:CT].to_f %></td>
<td class="lbl-txt-align"><%=h "%.2f" % @closeBal.abs %></td>
<td class="lbl-txt-align"><%=h "%.2f" % value[:CB].abs %></td>
<td class="lbl-txt-align"><%= link_to image_tag('edit.png'), {:controller => controller.controller_name, :action => 'index', :summary_by => 'days', :from => value[:beginning_date], :to => value[:end_date], :is_summary_edit => true, :summary_period => 2, :txn_ledger => value[:ledger_id], :tab => controller.controller_name}, :title => l(:button_edit) %> </td>
</tr>
<% end %>
Expand Down
5 changes: 5 additions & 0 deletions db/migrate/20240912130705_update_wk_survey_responses.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
class UpdateWkSurveyResponses < ActiveRecord::Migration[6.1]
def up
change_column :wk_survey_responses, :ip_address, :string, limit: 60
end
end
2 changes: 1 addition & 1 deletion init.rb
Original file line number Diff line number Diff line change
Expand Up @@ -588,7 +588,7 @@ def getSupervisorCondStr
name 'ERPmine'
author 'Adhi Software Pvt Ltd'
description 'ERPmine is an ERP for Service Industries. It has the following modules: Time & Expense, Attendance, Payroll, CRM, Billing, Accounting, Purchasing, Inventory, Asset , Reports, Dashboards and Survey'
version '4.7.4'
version '4.7.5'
url 'https://www.redmine.org/plugins/wk-time'
author_url 'http://www.adhisoftware.co.in/'

Expand Down

0 comments on commit 324f9c4

Please sign in to comment.