Skip to content

Commit

Permalink
Reapply "Merge pull request fivetran#149 from fivetran/release/v0.17.…
Browse files Browse the repository at this point in the history
…1-a1"

This reverts commit 2a54cde.
  • Loading branch information
robcurtis committed Jan 9, 2025
1 parent 2167f5c commit 4c30e1e
Show file tree
Hide file tree
Showing 7 changed files with 24 additions and 31 deletions.
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
# dbt_quickbooks v0.17.1
[PR #149](https://github.com/fivetran/dbt_quickbooks/pull/149) introduces the following updates:

## Bug Fix
- Updated the logic in `int_quickbooks__retained_earnings` to ensure accounting periods with no revenue and expense class lines were accounted for.
- This will ensure the net income adjustment is available regardless of existing revenue or expenses.
- Brought in `created_at` and `updated_at` fields for the `credit_card_pymt` and `invoice` intermediate `*_double_entry` models to provide full support for the [`v0.17.0` release update](https://github.com/fivetran/dbt_quickbooks/releases/tag/v0.17.0).

# dbt_quickbooks v0.17.0
[PR #146](https://github.com/fivetran/dbt_quickbooks/pull/146) introduces the following updates:

Expand Down
2 changes: 1 addition & 1 deletion docs/catalog.json

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion docs/manifest.json

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion integration_tests/dbt_project.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: 'quickbooks_integration_tests'

version: '0.17.0'
version: '0.17.1'

profile: 'integration_tests'
config-version: 2
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,8 @@ final as (
cast(bank_account_id as {{ dbt.type_string() }}) as account_id,
class_id,
department_id,
created_at,
updated_at,
'credit' as transaction_type,
'credit card payment' as transaction_source
from credit_card_payment_prep
Expand All @@ -65,6 +67,8 @@ final as (
cast(credit_card_account_id as {{ dbt.type_string() }}) as account_id,
class_id,
department_id,
created_at,
updated_at,
'debit' as transaction_type,
'credit card payment' as transaction_source
from credit_card_payment_prep
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -175,6 +175,8 @@ final as (
account_id,
class_id,
department_id,
created_at,
updated_at,
case when invoice_line_transaction_type = 'DiscountLineDetail' then 'debit'
else 'credit'
end as transaction_type,
Expand All @@ -197,6 +199,8 @@ final as (
ar_accounts.account_id,
class_id,
department_id,
created_at,
updated_at,
case when invoice_line_transaction_type = 'DiscountLineDetail' then 'credit'
else 'debit'
end as transaction_type,
Expand Down
33 changes: 5 additions & 28 deletions models/intermediate/int_quickbooks__retained_earnings.sql
Original file line number Diff line number Diff line change
Expand Up @@ -4,42 +4,19 @@ with general_ledger_balances as (
from {{ ref('int_quickbooks__general_ledger_balances') }}
),

revenue_starter as (
net_income_loss as (

select
period_first_day,
source_relation,
sum(period_net_change) as revenue_net_change,
sum(period_net_converted_change) as revenue_net_converted_change
sum(case when account_class = 'Revenue' then period_net_change else 0 end) as revenue_net_change,
sum(case when account_class = 'Revenue' then period_net_converted_change else 0 end) as revenue_net_converted_change,
sum(case when account_class = 'Expense' then period_net_change else 0 end) as expense_net_change,
sum(case when account_class = 'Expense' then period_net_converted_change else 0 end) as expense_net_converted_change
from general_ledger_balances

where account_class = 'Revenue'

{{ dbt_utils.group_by(2) }}
),

expense_starter as (

select
period_first_day,
source_relation,
sum(period_net_change) as expense_net_change,
sum(period_net_converted_change) as expense_net_converted_change
from general_ledger_balances

where account_class = 'Expense'

{{ dbt_utils.group_by(2) }}
),

net_income_loss as (

select *
from revenue_starter

join expense_starter
using (period_first_day, source_relation)
),
retained_earnings_starter as (

select
Expand Down

0 comments on commit 4c30e1e

Please sign in to comment.