Class: SAFT::V2::HTML::RenderGeneralLedgerTable
- Inherits:
-
Object
- Object
- SAFT::V2::HTML::RenderGeneralLedgerTable
- Defined in:
- lib/saft/v2/html.rb
Instance Method Summary collapse
-
#initialize(accounts) ⇒ RenderGeneralLedgerTable
constructor
A new instance of RenderGeneralLedgerTable.
- #to_tubby ⇒ Object
Constructor Details
#initialize(accounts) ⇒ RenderGeneralLedgerTable
Returns a new instance of RenderGeneralLedgerTable.
192 193 194 |
# File 'lib/saft/v2/html.rb', line 192 def initialize(accounts) @accounts = accounts end |
Instance Method Details
#to_tubby ⇒ Object
196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 |
# File 'lib/saft/v2/html.rb', line 196 def to_tubby Tubby.new { |t| t.table { t.thead { t.tr { t.th("Id") t.th("Description") t.th("Std account") t.th("Opening balance") t.th("Closing balance") t.th("Rest") } } t.tbody { @accounts.each do |account| std_account = SAFT::V2::Norway.std_account(account.standard_account_id) std_account_title = "Not found" if std_account std_account_title = <<~TEXT Account no #{std_account.number} #{std_account.description_en} #{std_account.description_no} TEXT end t.tr { t.td(account.account_id) t.td(account.account_description) t.td(account.standard_account_id, title: std_account_title) t.td { t.div(class: "flex justify-between") { if account.opening_debit_balance t.span("Debit") t.span(account.opening_debit_balance) end if account.opening_credit_balance t.span("Credit") t.span(-account.opening_credit_balance) end } } t.td { t.div(class: "flex justify-between") { if account.closing_debit_balance t.span("Debit") t.span(account.closing_debit_balance) end if account.closing_credit_balance t.span("Credit") t.span(-account.closing_credit_balance) end } } t.td(class: "pl-2") { t.div(class: "pl-2 border-l-2") { t << RenderHash.new( account .attributes .except( :account_id, :account_description, :standard_account_id, :opening_debit_balance, :opening_credit_balance, :closing_debit_balance, :closing_credit_balance, ), ) } } } end } } } end |