diff --git a/README.rdoc b/README.rdoc index 827f6a57b..2a589ecd1 100644 --- a/README.rdoc +++ b/README.rdoc @@ -48,11 +48,11 @@ If an apache passenger module is used then make sure the following settings are b) RailsAppSpawnerIdleTime 0 c) PassengerPreStart http://rails-app-url/ -Release Notes for 2.5.1 +Release Notes for 2.5.2 Features: - Billing module is introduced. BugFixing: - - Payroll usersettings tab not working. + - Fixed: Account validation not working on mac safari. Customization: For any Customization/Support, please contact us, our consulting team will be happy to help you diff --git a/app/controllers/wkaccount_controller.rb b/app/controllers/wkaccount_controller.rb index 073f7113a..86df37ac9 100644 --- a/app/controllers/wkaccount_controller.rb +++ b/app/controllers/wkaccount_controller.rb @@ -38,12 +38,12 @@ def edit @accountEntry = nil unless params[:account_id].blank? @accountEntry = WkAccount.find(params[:account_id]) - else - @accountEntry = @accountEntry end end def update + errorMsg = nil + wkaddress = nil if params[:address_id].blank? || params[:address_id].to_i == 0 wkaddress = WkAddress.new else @@ -52,32 +52,35 @@ def update wkaddress.address1 = params[:address1] wkaddress.address2 = params[:address2] wkaddress.work_phone = params[:work_phone] - wkaddress.home_phone = params[:home_phone] wkaddress.city = params[:city] wkaddress.state = params[:state] wkaddress.pin = params[:pin] - wkaddress.mobile = params[:mobile] - wkaddress.email = params[:email] wkaddress.country = params[:country] wkaddress.fax = params[:fax] - wkaddress.save() - address_id = wkaddress.id + unless wkaddress.valid? + errorMsg = wkaddress.errors.full_messages.join("
") + end if params[:account_id].blank? || params[:account_id].to_i == 0 wkaccount = WkAccount.new else wkaccount = WkAccount.find(params[:account_id].to_i) end - wkaccount.address_id = address_id + #wkaccount.address_id = wkaddress.id wkaccount.name = params[:name] wkaccount.account_type = 'A' wkaccount.account_billing = params[:account_billing].blank? ? 0 : params[:account_billing] - wkaccount.save() - if wkaccount.save() + unless wkaccount.valid? + errorMsg = errorMsg.blank? ? wkaccount.errors.full_messages.join("
") : wkaccount.errors.full_messages.join("
") + "
" + errorMsg + end + if errorMsg.nil? + wkaddress.save + wkaccount.address_id = wkaddress.id + wkaccount.save redirect_to :controller => 'wkaccount',:action => 'index' , :tab => 'wkaccount' flash[:notice] = l(:notice_successful_update) else - redirect_to :controller => 'wkaccount',:action => 'edit' , :tab => 'wkaccount' - flash[:error] = wkaccount.errors.full_messages.join("
") + flash[:error] = errorMsg #wkaccount.errors.full_messages.join("
") + redirect_to :controller => 'wkaccount',:action => 'edit', :account_id => wkaccount.id end end diff --git a/app/controllers/wkinvoice_controller.rb b/app/controllers/wkinvoice_controller.rb index 56fb2d0ab..c5ca56c09 100644 --- a/app/controllers/wkinvoice_controller.rb +++ b/app/controllers/wkinvoice_controller.rb @@ -63,6 +63,7 @@ def edit @invoice = WkInvoice.find(params[:invoice_id].to_i) @invoiceItem = @invoice.invoice_items unless params[:is_report].blank? || !to_boolean(params[:is_report]) + @invoiceItem = @invoiceItem.order(:project_id, :item_type) render :action => 'invreport', :layout => false end @@ -77,9 +78,10 @@ def invreport def update errorMsg = nil invoiceItem = nil - invItemId = WkInvoiceItem.select(:id).where(:invoice_id => params["invoice_id"].to_i) - arrId = invItemId.map {|i| i.id } + #invItemId = WkInvoiceItem.select(:id).where(:invoice_id => params["invoice_id"].to_i) + #arrId = invItemId.map {|i| i.id } @invoice = WkInvoice.find(params["invoice_id"].to_i) + arrId = @invoice.invoice_items.pluck(:id) @invoice.status = params[:field_status] if @invoice.status_changed? @invoice.closed_on = Time.now @@ -87,19 +89,30 @@ def update end totalAmount = 0 tothash = Hash.new - for i in 1..(params[:totalrow].to_i) - if !params["item_id#{i}"].blank? + totalRow = params[:totalrow].to_i + savedRows = 0 + deletedRows = 0 + #for i in 1..totalRow + while savedRows < totalRow + i = savedRows + deletedRows + 1 + if params["item_id#{i}"].blank? && params["project_id#{i}"].blank? + deletedRows = deletedRows + 1 + next + end + unless params["item_id#{i}"].blank? arrId.delete(params["item_id#{i}"].to_i) invoiceItem = WkInvoiceItem.find(params["item_id#{i}"].to_i) updatedItem = updateInvoiceItem(invoiceItem, params["project_id#{i}"], params["name#{i}"], params["rate#{i}"].to_f, params["quantity#{i}"].to_f, invoiceItem.currency) - else + else invoiceItem = @invoice.invoice_items.new updatedItem = updateInvoiceItem(invoiceItem, params["project_id#{i}"], params["name#{i}"], params["rate#{i}"].to_f, params["quantity#{i}"].to_f, params["currency#{i}"]) end + savedRows = savedRows + 1 tothash[updatedItem.project_id] = [(tothash[updatedItem.project_id].blank? ? 0 : tothash[updatedItem.project_id][0]) + updatedItem.amount, updatedItem.currency] end if !arrId.blank? + deleteBilledEntries(arrId) WkInvoiceItem.delete_all(:id => arrId) end @@ -109,6 +122,13 @@ def update addTaxes(accountProject[0], val[1], val[0]) end + unless @invoice.id.blank? + totalAmount = @invoice.invoice_items.sum(:amount) + if (totalAmount.round - totalAmount) != 0 + addRoundInvItem(totalAmount) + end + end + if errorMsg.nil? redirect_to :action => 'index' , :tab => 'wkinvoice' flash[:notice] = l(:notice_successful_update) @@ -119,11 +139,16 @@ def update end def destroy - WkInvoice.find(params[:invoice_id].to_i).destroy - + invoice = WkInvoice.find(params[:invoice_id].to_i)#.destroy + deleteBilledEntries(invoice.invoice_items.pluck(:id)) + invoice.destroy flash[:notice] = l(:notice_successful_delete) redirect_back_or_default :action => 'index', :tab => params[:tab] end + + def deleteBilledEntries(invItemIdsArr) + CustomField.find(getSettingCfId('wktime_billing_id_cf')).custom_values.where(:value => invItemIdsArr).delete_all unless getSettingCfId('wktime_billing_id_cf').blank? || getSettingCfId('wktime_billing_id_cf') == 0 + end def getAccountProjIds accArr = "" diff --git a/app/helpers/wkinvoice_helper.rb b/app/helpers/wkinvoice_helper.rb index d82a6b2b1..486e40bbb 100644 --- a/app/helpers/wkinvoice_helper.rb +++ b/app/helpers/wkinvoice_helper.rb @@ -25,16 +25,27 @@ def addInvoice(accountId, projectId, invoiceDate,invoicePeriod) @invoice.modifier_id = User.current.id @invoice.account_id = accountId @invoice.invoice_number = getPluginSetting('wktime_invoice_no_prefix') - if !@invoice.save + errorMsg = generateInvoiceItems(projectId) + unless @invoice.id.blank? + totalAmount = @invoice.invoice_items.sum(:amount) + if (totalAmount.round - totalAmount) != 0 + addRoundInvItem(totalAmount) + end + end + errorMsg + end + + def saveInvoice + errorMsg = nil + unless @invoice.save errorMsg = @invoice.errors.full_messages.join("
") else @invoice.invoice_number = @invoice.invoice_number + @invoice.id.to_s @invoice.save - errorMsg = generateInvoiceItems(projectId) end errorMsg end - + def generateInvoices(accountId, projectId, invoiceDate,invoicePeriod) errorMsg = nil account = WkAccount.find(accountId) @@ -51,27 +62,33 @@ def generateInvoices(accountId, projectId, invoiceDate,invoicePeriod) def generateInvoiceItems(projectId) if projectId.blank? || projectId.to_i == 0 WkAccountProject.where(account_id: @invoice.account_id).find_each do |accProj| - addInvoiceItem(accProj) + errorMsg = addInvoiceItem(accProj) end else accountProject = WkAccountProject.where("account_id = ? and project_id = ?", @invoice.account_id, projectId) - addInvoiceItem(accountProject[0]) + errorMsg = addInvoiceItem(accountProject[0]) end - errorMsg = nil errorMsg end def addInvoiceItem(accountProject) if accountProject.billing_type == 'TM' # Add invoice items for Time and Materiel cost - saveTAMInvoiceItem(accountProject) + errorMsg = saveTAMInvoiceItem(accountProject) else # Add invoice item for fixed cost from the scheduled entries + errorMsg = nil genInvFrom = Setting.plugin_redmine_wktime['wktime_generate_invoice_from'] genInvFrom = genInvFrom.blank? ? @invoice.start_date : genInvFrom.to_date scheduledEntries = accountProject.wk_billing_schedules.where(:account_project_id => accountProject.id, :bill_date => genInvFrom .. @invoice.end_date, :invoice_id => nil) totalAmount = 0 scheduledEntries.each do |entry| + if @invoice.id.blank? + errorMsg = saveInvoice + unless errorMsg.blank? + break + end + end invItem = saveFCInvoiceItem(entry) totalAmount = totalAmount + invItem.amount entry.invoice_id = @invoice.id @@ -83,6 +100,7 @@ def addInvoiceItem(accountProject) addTaxes(accountProject, scheduledEntries[0].currency, totalAmount) end end + errorMsg end # Add the invoice items for the scheduled entries @@ -107,6 +125,7 @@ def saveTAMInvoiceItem(accountProject) genInvFrom = genInvFrom.blank? ? @invoice.start_date : genInvFrom.to_date timeEntries = TimeEntry.joins("left outer join custom_values on time_entries.id = custom_values.customized_id and custom_values.customized_type = 'TimeEntry' and custom_values.custom_field_id = #{getSettingCfId('wktime_billing_id_cf')}").where(project_id: accountProject.project_id, spent_on: genInvFrom .. @invoice.end_date).where("custom_values.value is null OR #{getSqlLengthQry("custom_values.value")} = 0 ") + errorMsg = nil totalAmount = 0 lastUserId = 0 lastIssueId = 0 @@ -126,6 +145,12 @@ def saveTAMInvoiceItem(accountProject) updateBilledHours(entry, lasInvItmId) next end + if @invoice.id.blank? + errorMsg = saveInvoice + unless errorMsg.blank? + break + end + end invItem = @invoice.invoice_items.new() lastUserId = entry.user_id lastIssueId = entry.issue_id @@ -149,6 +174,12 @@ def saveTAMInvoiceItem(accountProject) next end lastIssueId = entry.issue_id + if @invoice.id.blank? + errorMsg = saveInvoice + unless errorMsg.blank? + break + end + end invItem = @invoice.invoice_items.new() if accountProject.itemized_bill description = entry.issue.blank? ? entry.project.name : (accountProject.account.account_billing ? entry.project.name + ' - ' + entry.issue.subject : entry.issue.subject) @@ -165,7 +196,8 @@ def saveTAMInvoiceItem(accountProject) end if accountProject.apply_tax && totalAmount>0 addTaxes(accountProject, rateHash['currency'], totalAmount) - end + end + errorMsg end # Update invoice item by the given invoice item Object @@ -222,7 +254,7 @@ def addTaxes(accountProject, currency, totalAmount) projectTaxes = accountProject.wk_acc_project_taxes projectTaxes.each do |projtax| invItem = @invoice.invoice_items.new() - invItem.name = accountProject.project.name + ' - ' + projtax.tax.name + invItem.name = projtax.tax.name invItem.rate = projtax.tax.rate_pct.blank? ? 0 : projtax.tax.rate_pct invItem.project_id = accountProject.project_id invItem.currency = currency @@ -234,6 +266,20 @@ def addTaxes(accountProject, currency, totalAmount) end end + # Add an invoice item for the round off value + def addRoundInvItem(totalAmount) + invItem = @invoice.invoice_items.new() + invItem.name = l(:label_round_off) + invItem.rate = nil + invItem.project_id = @invoice.invoice_items[0].project_id + invItem.currency = @invoice.invoice_items[0].currency + invItem.quantity = nil + invItem.amount = totalAmount.round - totalAmount + invItem.item_type = 'r' + invItem.modifier_id = User.current.id + invItem.save() + end + # Return the Query string with SQL length function for the given column def getSqlLengthQry(column) if ActiveRecord::Base.connection.adapter_name == 'SQLServer' diff --git a/app/models/wk_account.rb b/app/models/wk_account.rb index 290e04d57..ecd7a8e39 100644 --- a/app/models/wk_account.rb +++ b/app/models/wk_account.rb @@ -6,6 +6,7 @@ class WkAccount < ActiveRecord::Base has_many :invoice_items, through: :invoices has_many :projects, through: :wk_account_projects has_many :contracts, foreign_key: "account_id", class_name: "WkContract", :dependent => :destroy + validates_presence_of :name # Returns account's contracts for the given project # or nil if the account do not have contract diff --git a/app/models/wk_address.rb b/app/models/wk_address.rb index f3323514f..29958e84d 100644 --- a/app/models/wk_address.rb +++ b/app/models/wk_address.rb @@ -1,4 +1,6 @@ class WkAddress < ActiveRecord::Base unloadable has_many :wk_accounts, foreign_key: "address_id", class_name: "WkAccount" + validates_presence_of :address1, :work_phone, :fax, :city, :state, :country + validates_numericality_of :pin, :only_integer => true, :greater_than_or_equal_to => 0, :message => :invalid end diff --git a/app/views/wkaccount/_account_list.html.erb b/app/views/wkaccount/_account_list.html.erb index f2b282355..6ec04535f 100644 --- a/app/views/wkaccount/_account_list.html.erb +++ b/app/views/wkaccount/_account_list.html.erb @@ -6,7 +6,7 @@ <%= l(:label_account_name) %> <%= l(:label_account_address) %> <%= l(:label_work_phone) %> - <%= l(:label_email) %> + <%= l(:label_country) %> <%= l(:label_city) %> @@ -18,7 +18,7 @@ <%=h entry.name %> <%=h entry.address.blank? ? "" : entry.address.address1 %> <%=h entry.address.blank? ? "" : entry.address.work_phone %> - <%=h entry.address.blank? ? "" : entry.address.email %> + <%=h entry.address.blank? ? "" : entry.address.country %> <%=h entry.address.blank? ? "" : entry.address.city %> diff --git a/app/views/wkaccount/edit.html.erb b/app/views/wkaccount/edit.html.erb index be81e539a..9c98886bf 100644 --- a/app/views/wkaccount/edit.html.erb +++ b/app/views/wkaccount/edit.html.erb @@ -2,14 +2,14 @@

<%=@accountEntry.blank? ? l(:label_new_account) : l(:label_edit_account) %>

-
+
<%=l(:label_account_information)%> <%=h hidden_field_tag('account_id', @accountEntry.blank? ? "" :@accountEntry.id) %> <%=h hidden_field_tag('address_id', @accountEntry.blank? ? "" :@accountEntry.address_id) %> - + @@ -17,23 +17,23 @@ - + - + - +
<%= l(:label_account_name) %><%=h text_field_tag("name",@accountEntry.blank? ? "" : @accountEntry.name,:size => 20, :required => true) %> <%=h text_field_tag("name",@accountEntry.blank? ? "" : @accountEntry.name,:size => 20) %>
<%= l(:label_account_billing) %>
<%= l(:label_work_phone) %><%=h text_field_tag("work_phone",@accountEntry.blank? || @accountEntry.address.blank? ? "" : @accountEntry.address.work_phone,:size => 20, :required => true) %> <%=h text_field_tag("work_phone",@accountEntry.blank? || @accountEntry.address.blank? ? "" : @accountEntry.address.work_phone,:size => 20) %>
<%= l(:label_fax) %><%=h text_field_tag("fax",@accountEntry.blank? || @accountEntry.address.blank? ? "" : @accountEntry.address.fax,:size => 20, :required => true) %> <%=h text_field_tag("fax",@accountEntry.blank? || @accountEntry.address.blank? ? "" : @accountEntry.address.fax,:size => 20) %>
@@ -44,27 +44,27 @@ - + - + - + - + - + - +
<%= l(:label_account_address1) %><%=h text_field_tag("address1",@accountEntry.blank? || @accountEntry.address.blank? ? "" : @accountEntry.address.address1,:size =>40,:required => true) %> <%=h text_field_tag("address1",@accountEntry.blank? || @accountEntry.address.blank? ? "" : @accountEntry.address.address1,:size =>40) %>
<%= l(:label_account_address2) %><%=h text_field_tag("address2",@accountEntry.blank? || @accountEntry.address.blank? ? "" : @accountEntry.address.address2,:size =>40,:required => true) %> <%=h text_field_tag("address2",@accountEntry.blank? || @accountEntry.address.blank? ? "" : @accountEntry.address.address2,:size =>40) %>
<%= l(:label_city) %><%=h text_field_tag("city",@accountEntry.blank? || @accountEntry.address.blank? ? "" : @accountEntry.address.city,:size =>30,:required => true) %> <%=h text_field_tag("city",@accountEntry.blank? || @accountEntry.address.blank? ? "" : @accountEntry.address.city,:size =>30) %>
<%= l(:label_state) %><%=h text_field_tag("state",@accountEntry.blank? || @accountEntry.address.blank? ? "" : @accountEntry.address.state,:size =>30,:required => true) %> <%=h text_field_tag("state",@accountEntry.blank? || @accountEntry.address.blank? ? "" : @accountEntry.address.state,:size =>30) %>
<%= l(:label_country) %><%=h text_field_tag("country",@accountEntry.blank? || @accountEntry.address.blank? ? "" : @accountEntry.address.country,:size =>30,:required => true) %> <%=h text_field_tag("country",@accountEntry.blank? || @accountEntry.address.blank? ? "" : @accountEntry.address.country,:size =>30) %>
<%= l(:label_pin) %><%=h text_field_tag("pin",@accountEntry.blank? || @accountEntry.address.blank? ? "" : @accountEntry.address.pin,:size =>30,:required => true) %> <%=h text_field_tag("pin",@accountEntry.blank? || @accountEntry.address.blank? ? "" : @accountEntry.address.pin,:size =>30) %>
diff --git a/app/views/wkattendance/clockedit.html.erb b/app/views/wkattendance/clockedit.html.erb index 32fc86ad6..5f7097b7a 100644 --- a/app/views/wkattendance/clockedit.html.erb +++ b/app/views/wkattendance/clockedit.html.erb @@ -69,7 +69,7 @@ <% end %> " > - + <%=h text_field_tag("tothours", totalhours.round(2),:size => 10, :disabled => isAccountUser ? false : true, :required => true) %> diff --git a/app/views/wkinvoice/_edit_invoice.html.erb b/app/views/wkinvoice/_edit_invoice.html.erb index 7cc7ef62e..cbb9454cb 100644 --- a/app/views/wkinvoice/_edit_invoice.html.erb +++ b/app/views/wkinvoice/_edit_invoice.html.erb @@ -37,8 +37,7 @@ - <% @invoiceItem.each do |entry| %> - <% if entry.item_type == 'i' %> + <% @invoiceItem.where(:item_type => 'i').each do |entry| %> <%=h hidden_field_tag("item_id#{row_index}", entry.id ) %> @@ -55,29 +54,46 @@ :title => l(:button_delete) %> <% row_index = row_index + 1 %> - <% end %> <% end %> +<% if @invoiceItem.where(:item_type => 't').count > 0 %> +<% end %> <% tax_index = 1 %> - <% @invoiceItem.each do |entry| %> - <% if entry.item_type == 't' %> + <% @invoiceItem.where(:item_type => 't').each do |entry| %> - - - - - - - + + + + + + + <% total = total + entry.amount %> <% tax_index = tax_index + 1 %> - <% end %> <% end %> - + +
<%=h hidden_field_tag("tax_id#{tax_index}", entry.id ) %><%=h hidden_field_tag("pjt_id#{tax_index}", entry.project_id ) %><%= entry.name %> <%= entry.quantity %><%= entry.currency %><%=h hidden_field_tag("tax_id#{tax_index}", entry.id ) %><%=h entry.project.name%><%= entry.name %> <%=h hidden_field_tag("pjt_id#{tax_index}", entry.project_id ) %><%= entry.currency %>
+ +<% round_index = 1 %> + + <% @invoiceItem.where(:item_type => 'r').each do |entry| %> + + + + + + + + + <% total = total + entry.amount %> + + + <% round_index = round_index + 1 %> + <% end %>
<%=h hidden_field_tag("round_id#{round_index}", entry.id ) %><%=h hidden_field_tag("pjt_id#{round_index}", entry.project_id ) %><%= entry.name %><%= entry.currency %>
<%=h hidden_field_tag("totalrow", row_index-1 ) %> diff --git a/app/views/wkinvoice/invreport.html.erb b/app/views/wkinvoice/invreport.html.erb index 3d1fb989c..1108072f8 100644 --- a/app/views/wkinvoice/invreport.html.erb +++ b/app/views/wkinvoice/invreport.html.erb @@ -1,7 +1,7 @@ <% if !@invoiceItem.blank? %>
-
<%= l(:label_export_invoice) %>
+
<%= (l(:label_invoice)).upcase %>
@@ -15,18 +15,18 @@
- - +
+ - - - + + + - - - - + + + + @@ -37,56 +37,95 @@ + - - - - - - + - <% @invoiceItem.where(:item_type => 'i').each do | entry | %> - - - - - - - - - <% end %> - <% if @invoiceItem.where(:item_type => 't').count > 0 %> - - - - - - - - - <% end %> - - <% @invoiceItem.where(:item_type => 't').each do | entry | %> - - - - - - - - - <% end %> - - - - - - + - + <% unless Setting.plugin_redmine_wktime['wktime_invoice_components'].blank? Setting.plugin_redmine_wktime['wktime_invoice_components'].each do |element| @@ -99,7 +138,9 @@ <% end %>
<%= l(:label_name_address_of,l(:label_supplier)) %><%= l(:label_name_address_of,l(:label_customer)) %><%= l(:label_invoice_number) %><%= l(:label_invoice_date) %><%= l(:label_name_address_of,l(:label_customer)) %><%= l(:label_invoice_number) %><%= l(:label_invoice_date) %>
<%=h Setting.plugin_redmine_wktime['wktime_company_name'] + " " + Setting.plugin_redmine_wktime['wktime_company_address'] %><%=h @invoice.account.name + " " + @invoice.account.address.address1 + " " + @invoice.account.address.city + " " + @invoice.account.address.state + " " + @invoice.account.address.country + " " + @invoice.account.address.pin.to_s %><%=h @invoice.invoice_number %><%=h @invoice.invoice_date.to_formatted_s(:long) %><%=h Setting.plugin_redmine_wktime['wktime_company_name'] + "\n" + Setting.plugin_redmine_wktime['wktime_company_address'] %><%=h @invoice.account.name + "\n" + @invoice.account.address.address1 + "\n" + (@invoice.account.address.address2.blank? ? "" : (@invoice.account.address.address2) + "\n") + @invoice.account.address.city + " " + @invoice.account.address.state + "\n" + @invoice.account.address.pin.to_s + "\n" + @invoice.account.address.country %> <%=h @invoice.invoice_number %><%=h @invoice.invoice_date.to_formatted_s(:long) %>
<%= l(:label_cntrt_purchase_work_order) %><%=h accContract.contract_number + " - " + accContract.start_date.to_formatted_s(:long) unless accContract.blank? %> <%=h @invoice.start_date.to_formatted_s(:long) + ' to ' + @invoice.end_date.to_formatted_s(:long) %>
<%= l(:label_invoice_name) %><%= l(:label_billing_type) %><%= l(:label_rate) %><%= l(:label_quantity) %><%= l(:label_wk_currency) %><%= l(:field_amount) %> + + + + + + + + + + <% lastItemType = nil %> + <% lastProjectId = nil %> + <% @invoiceItem.each do | entry | %> + <% if entry.item_type != 'r' %> + <% if !lastItemType.blank? && entry.item_type != lastItemType && lastProjectId == entry.project_id %> + + + + + + + + + <% end %> + + <% if !lastProjectId.blank? && lastProjectId != entry.project_id %> + + + + + + + + + <% end %> + + + + + + + + + + <% end %> + + <% lastItemType = entry.item_type%> + <% lastProjectId = entry.project_id %> + <% end %> + + + + + + + + + <% @invoiceItem.where(:item_type => 'r').each do | entry | %> + + + + + + + + + <% end %> +
<%= l(:label_invoice_name) %><%= l(:label_billing_type) %><%= l(:label_rate) %><%= l(:label_quantity) %><%= l(:label_wk_currency) %><%= l(:field_amount) %>
<%=h l(:label_sub_total) %><%=h "%.2f" % @invoiceItem.where(:project_id => lastProjectId, :item_type => 'i').sum(:quantity) %><%=h entry.currency %><%=h "%.2f" % @invoiceItem.where(:project_id => lastProjectId, :item_type => 'i').sum(:amount) %>
<%=h l(:label_total) %><%=h "%.2f" % @invoiceItem.where(:project_id => lastProjectId).where.not(:item_type => 'r').sum(:quantity) %><%=h entry.currency %><%=h "%.2f" % @invoiceItem.where(:project_id => lastProjectId).where.not(:item_type => 'r').sum(:amount) %>
<%=h entry.name %><%=h entry.item_type == 'i' ? l(:field_hours) : '' %><%=h ("%.2f" % entry.rate).to_s + (entry.item_type == 'i' ? '' : "%") unless entry.rate.blank? %><%=h "%.2f" % entry.quantity unless entry.quantity.blank? %><%=h entry.currency %><%=h "%.2f" % entry.amount unless entry.amount.blank?%>
<%=h l(:label_total) %><%=h "%.2f" % @invoiceItem.where(:project_id => lastProjectId).where.not(:item_type => 'r').sum(:quantity) %><%=h @invoiceItem[0].currency %><%=h "%.2f" % @invoiceItem.where(:project_id => lastProjectId).where.not(:item_type => 'r').sum(:amount) %>
<%=h entry.name %><%=h entry.item_type == 'i' ? l(:field_hours) : '' %><%=h "%.2f" % entry.rate unless entry.rate.blank? %><%=h "%.2f" % entry.quantity unless entry.quantity.blank? %><%=h entry.currency %><%=h "%.2f" % entry.amount unless entry.amount.blank?%>
+
<%=h entry.name %><%=h l(:field_hours) %><%=h "%.2f" % entry.rate unless entry.rate.blank? %><%=h "%.2f" % entry.quantity unless entry.quantity.blank? %><%=h entry.currency %><%=h "%.2f" % entry.amount unless entry.amount.blank?%>
<%=h l(:label_sub_total) %><%=h "%.2f" % @invoiceItem.where(:item_type => 'i').sum(:quantity) %><%=h @invoiceItem[0].currency %><%=h "%.2f" % @invoiceItem.where(:item_type => 'i').sum(:amount) %>
<%=h entry.name %><%=h l(:label_tax) %><%=h "%.2f" % entry.rate.to_s + "%" unless entry.rate.blank? %><%=h "%.2f" % entry.quantity unless entry.quantity.blank? %><%=h entry.currency %><%=h "%.2f" % entry.amount unless entry.amount.blank?%>
<%=h l(:label_total) %><%=h "%.2f" % @invoiceItem.sum(:quantity) %><%=h @invoiceItem[0].currency %><%=h "%.2f" % @invoiceItem.sum(:amount) %> + + + + + + + + + +
<%=h l(:label_grand_total) %><%=h "%.2f" % @invoiceItem.sum(:quantity) %><%=h @invoiceItem[0].currency %><%=h "%.2f" % @invoiceItem.sum(:amount) %>
+
<%= l(:label_amount_in_words) %><%=h numberInWords(@invoiceItem.sum(:amount)) + " only" %><%=h numberInWords(@invoiceItem.sum(:amount)) + " only." %>
-
+
+
+
diff --git a/app/views/wktime/_attendance.html.erb b/app/views/wktime/_attendance.html.erb index ca106821e..dbcb96c55 100644 --- a/app/views/wktime/_attendance.html.erb +++ b/app/views/wktime/_attendance.html.erb @@ -72,7 +72,7 @@ <% end %> <%=h hidden_field_tag("attnDayEntriesCnt_#{i}", j) %>

- <%= l(:label_grand_total) %> + <%= l(:label_total_hours) %> <%= text_field_tag "grandTotal_#{i}" , "" , :size => 4, :disabled => disable %>

<% if isAccountUser %> diff --git a/app/views/wktime/_attendance_widget.html.erb b/app/views/wktime/_attendance_widget.html.erb index e079fc33f..bd9b151bc 100644 --- a/app/views/wktime/_attendance_widget.html.erb +++ b/app/views/wktime/_attendance_widget.html.erb @@ -28,7 +28,7 @@ <% totalhours = (hideStart ? ( !remaininghr.blank? ? remaininghr.round(0)+totalhours : totalhours) : totalhours ) %> <% totalhours1 = Time.at(totalhours).utc.strftime("%H:%M:%S") %> <% if User.current.logged? && wktime_helper.checkViewPermission %> -
<%= l(:label_place) %> :