Fix/balance inconsitency (#306)
* feat: implement fiscal period date fields component and validation logic * feat: update fiscal period validation and naming logic * feat: implement RPC for computing prior opening balances - Added `compute_prior_opening_balances` RPC to aggregate opening balances for balance-sheet accounts when no opening balance entry is set. - Updated tests across various reports to utilize the new RPC for fetching prior balances. - Refactored `getOpeningBalances` to call the RPC when necessary, improving performance and reliability. - Introduced a script to repair fiscal period chains for companies with broken periods, ensuring proper linking and continuity. - Enhanced error handling and validation in the repair script to ensure data integrity during the process. * feat: implement duplicate opening-balance repair for multi-year SIE imports * feat: enhance SIE entry listing and deduplication logic for opening balances * fix: refine companyHasPriorActivity logic to exclude storno entries and improve balance counting
This commit is contained in:
@@ -82,7 +82,7 @@ export default function ImportReviewStep({
|
||||
.from('company_settings')
|
||||
.select('default_voucher_series')
|
||||
.eq('company_id', company.id)
|
||||
.single(),
|
||||
.maybeSingle(),
|
||||
supabase
|
||||
.from('voucher_sequences')
|
||||
.select('voucher_series')
|
||||
@@ -91,8 +91,7 @@ export default function ImportReviewStep({
|
||||
|
||||
if (cancelled) return
|
||||
|
||||
// PGRST116 = no rows returned from .single(); expected when settings not yet created.
|
||||
if (settingsError && settingsError.code !== 'PGRST116') {
|
||||
if (settingsError) {
|
||||
console.error('Failed to load company settings for voucher series', settingsError)
|
||||
}
|
||||
if (sequencesError) {
|
||||
|
||||
Reference in New Issue
Block a user