lib/ish/invoice.rb in ish_models-0.0.33.267 vs lib/ish/invoice.rb in ish_models-0.0.33.268
- old
+ new
@@ -21,26 +21,31 @@
field :leadset_id, type: Integer
def leadset
Leadset.find leadset_id
end
- field :number, type: Integer, default: 100
- increments :number
+ field :number, type: Integer
field :month_on, type: Date
+ has_one :asset, class_name: '::Gameui::Asset3d'
+
+ def filename
+ "invoice-#{number}.pdf"
+ end
+
# field :amount_cents, type: Integer
# has_many :payments, :class_name => 'Ish::Payment'
# field :paid_amount_cents, type: Integer, :default => 0 ## @TODO: unused? _vp_ 2023-08-18
# field :description, type: String
# field :items, type: Array
## Prawn/pdf unit of measure is 1/72"
## Canvas width: 612, height: 792
- def generate_monthly_invoice month_on
+ def generate_monthly_invoice
tree_img_url = "#{Rails.root.join('public')}/tree-1.jpg"
wasya_co_logo_url = "#{Rails.root.join('public')}/259x66-WasyaCo-logo.png"
## canvas width: 612, height: 792
pdf = Prawn::Document.new
@@ -74,10 +79,10 @@
pdf.text leadset.email
end
pdf.bounding_box( [4.5*72, 8.25*72], width: 3.25*72, height: 0.75*72 ) do
pdf.text "Notes:"
- pdf.text "Support & various tasks, for the month of #{ month_on }."
+ pdf.text "Support & various tasks, for the month of #{ month_on.strftime('%B') }."
end
lineitems_with_header = [
[ 'Description', 'Per Unit', '# of Units', 'Subtotal' ]
]