mirror of
https://github.com/internetee/registry.git
synced 2025-05-19 18:59:38 +02:00
story#116954455 - directo monthly invoices use billing date, not real
This commit is contained in:
parent
56f9cb325d
commit
fa682e1780
1 changed files with 6 additions and 4 deletions
|
@ -101,8 +101,8 @@ class Directo < ActiveRecord::Base
|
||||||
"ProductName" => ".#{pricelist.category} registreerimine: #{pricelist.years_amount} aasta",
|
"ProductName" => ".#{pricelist.category} registreerimine: #{pricelist.years_amount} aasta",
|
||||||
"UnitPriceWoVAT" => pricelist.price_decimal/pricelist.years_amount
|
"UnitPriceWoVAT" => pricelist.price_decimal/pricelist.years_amount
|
||||||
}
|
}
|
||||||
hash["StartDate"] = (activity.created_at + year.year).strftime(date_format) if year > 1
|
hash["StartDate"] = (activity.created_at + (year-1).year).end_of_month.strftime(date_format) if year > 1
|
||||||
hash["EndDate"] = (activity.created_at + year.year + 1).strftime(date_format) if year > 1
|
hash["EndDate"] = (activity.created_at + (year-1).year + 1).end_of_month.strftime(date_format) if year > 1
|
||||||
|
|
||||||
if items.has_key?(hash)
|
if items.has_key?(hash)
|
||||||
items[hash]["Quantity"] += 1
|
items[hash]["Quantity"] += 1
|
||||||
|
@ -113,8 +113,10 @@ class Directo < ActiveRecord::Base
|
||||||
end
|
end
|
||||||
|
|
||||||
#adding prepaiments
|
#adding prepaiments
|
||||||
registrar_activities.where(activity_type: [AccountActivity::ADD_CREDIT]).each do |activity|
|
if items.any?
|
||||||
hash = {"ProductID" => Setting.directo_receipt_product_name, "Unit" => "tk", "ProductName" => "Domeenide ettemaks", "UnitPriceWoVAT"=>activity.sum}
|
total = 0
|
||||||
|
items.each{ |key, val| total += val["Quantity"] * key["UnitPriceWoVAT"] }
|
||||||
|
hash = {"ProductID" => Setting.directo_receipt_product_name, "Unit" => "tk", "ProductName" => "Domeenide ettemaks", "UnitPriceWoVAT"=>total}
|
||||||
items[hash] = {"RN"=>counter.next, "RR" => counter.now, "Quantity"=> -1}
|
items[hash] = {"RN"=>counter.next, "RR" => counter.now, "Quantity"=> -1}
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue