SELECT
A.Category, A.DocDate$DATE, A.Text, A.DocumentType, A.Document_ID,
A.PDocumentType, A.PDocument_ID, A.DocumentDisplayName, A.PDocumentDisplayName,
A.IncomeType_ID, A.ExpenseType_ID, A.RowNumber, A.SORT_DocumentDisplayName, A.SORT_PDocumentDisplayName,
Max(A.Error) as Error,
Sum(A.BankCredit) as BankCredit,
Sum(A.BankDebit) as BankDebit,
Sum(A.CashCredit) as CashCredit,
Sum(A.CashDebit) as CashDebit,
Sum(A.ThroughItemCredit) as ThroughItemCredit,
Sum(A.ThroughItemDebit) as ThroughItemDebit,
Sum(A.VATCredit) as VATCredit,
Sum(A.VATDebit) as VATDebit,
Sum(A.Amount) as Amount
FROM SimpleCashBook({$DateFrom}, {$DateTo}) A
{WHERE}
GROUP BY 1,2,3,4,5,6,7,8,9,10,11,12,13,14
{ORDERBY}
| Jméno | Typ | Velikost | Výraz | CLSID | Popis |
|---|---|---|---|---|---|
| Amount | dtFloat | 10 | Částka | ||
| BankCredit | dtFloat | 10 | Banka příjem | ||
| BankDebit | dtFloat | 10 | Banka výdej | ||
| CashCredit | dtString | 10 | Pokladna příjem | ||
| CashDebit | dtFloat | 10 | Pokladna výdej | ||
| Category | dtInteger | 10 | Typ | ||
| DocDate$DATE | dtDateTime | 10 | Datum dokladu | ||
| Document_ID | dtString | 10 | ID dokladu (platba) | ||
| DocumentDisplayName | dtString | 23 | Číslo dokladu (platba) | ||
| DocumentType | dtString | 2 | Typ dokladu (platba) | ||
| Error | dtInteger | 10 | Chyba | ||
| ExpenseType_ID | dtString | 10 | 0AVVSAICKNDL3ACT03KIU0CLP4 | Typ výdaje | |
| IncomeType_ID | dtString | 10 | 02VVSAICKNDL3ACT03KIU0CLP4 | Typ příjmu | |
| PDocument_ID | dtString | 10 | ID dokladu (placený doklad) | ||
| PDocumentDisplayName | dtString | 16 | Číslo dokladu (plac. doklad) | ||
| PDocumentType | dtString | 2 | Typ dokladu (placený doklad) | ||
| SORT_DocumentDisplayName | dtString | 10 | Číslo dokladu pro řazení (platba) | ||
| SORT_PDocumentDisplayName | dtString | 10 | Číslo dokladu pro řazení (plac. doklad) | ||
| Text | dtString | 80 | Text | ||
| ThroughItemCredit | dtFloat | 10 | Průběžná položka příjem | ||
| ThroughItemDebit | dtFloat | 10 | Průběžná položka výdej | ||
| VATCredit | dtFloat | 10 | DPH příjem | ||
| VATDebit | dtFloat | 10 | DPH výdej |
SELECT
A.Category, IT.BookColumn as ITBookColumn, IT.category as ITCategory,
ET.BookColumn as ETBookColumn, ET.category as ETCategory,
Sum(A.BankCredit) as BankCredit,
Sum(A.BankDebit) as BankDebit,
Sum(A.CashCredit) as CashCredit,
Sum(A.CashDebit) as CashDebit,
Sum(A.ThroughItemCredit) as ThroughItemCredit,
Sum(A.ThroughItemDebit) as ThroughItemDebit,
Sum(A.VATCredit) as VATCredit,
Sum(A.VATDebit) as VATDebit,
Sum(A.Amount) as Amount,
SUM(A.Error) as Error
FROM SimpleCashBook((SELECT Max(DateFrom$DATE) from Periods WHERE DateFrom$DATE<={$DateFrom2}), {$DateFrom2}) A
LEFT JOIN IncomeTypes IT on IT.ID = A.IncomeType_ID
LEFT JOIN ExpenseTypes ET on ET.ID = A.ExpenseType_ID
group by 1, 2, 3, 4, 5
UNION ALL
SELECT
Cast(0 as integer) as Category,
Cast(0 as integer) as ITBookColumn,
Cast(0 as integer) as ITCategory,
Cast(0 as integer) as ETBookColumn,
Cast(0 as integer) as ETCategory,
Sum(A.BeginningLocal) as BankCredit,
Cast(0 as NUMERIC(15,2)) as BankDebit,
Cast(0 as NUMERIC(15,2)) as CashCredit,
Cast(0 as NUMERIC(15,2)) as CashDebit,
Cast(0 as NUMERIC(15,2)) as ThroughItemCredit,
Cast(0 as NUMERIC(15,2)) as ThroughItemDebit,
Cast(0 as NUMERIC(15,2)) as VATCredit,
Cast(0 as NUMERIC(15,2)) as VATDebit,
Cast(0 as NUMERIC(15,2)) as Amount,
Cast(0 as NUMERIC(10,0)) as Error
FROM BankAccounts2 A WHERE
A.Period_ID = (select ID from Periods where DateTo$DATE > {$DateFrom2} and DateFrom$DATE <= {$DateFrom2})
UNION ALL
SELECT
Cast(0 as integer) as Category,
Cast(0 as integer) as ITBookColumn,
Cast(0 as integer) as ITCategory,
Cast(0 as integer) as ETBookColumn,
Cast(0 as integer) as ETCategory,
Cast(0 as NUMERIC(15,2)) as BankCredit,
Cast(0 as NUMERIC(15,2)) as BankDebit,
Sum(A.BeginningLocal) as CashCredit,
Cast(0 as NUMERIC(15,2)) as CashDebit,
Cast(0 as NUMERIC(15,2)) as ThroughItemCredit,
Cast(0 as NUMERIC(15,2)) as ThroughItemDebit,
Cast(0 as NUMERIC(15,2)) as VATCredit,
Cast(0 as NUMERIC(15,2)) as VATDebit,
Cast(0 as NUMERIC(15,2)) as Amount,
Cast(0 as NUMERIC(10,0)) as Error
FROM CashDesks2 A WHERE
A.Period_ID = (select ID from Periods where DateTo$DATE > {$DateFrom2} and DateFrom$DATE <= {$DateFrom2})
(<field> >= {:LOW}) and (<field> < {:HIGH})
A.DocumentType = {:VALUE}
A.DocumentType IS NULL
A.DocumentType IN ({:LIST})
A.Document_ID = {:VALUE}
A.Document_ID IS NULL
A.PDocumentType IS NULL
A.PDocumentType = {:VALUE}
A.PDocumentType IN ({:LIST})
A.PDocument_ID = {:VALUE}
A.PDocument_ID IS NULL
##CASEOR {:VALUE} #
##1# A.Category = 0
##2# A.Category = 1
##END#
A.Text = {:VALUE}
(<field> >= {:LOW}) and (<field> < {:HIGH})
##CASEOR {:VALUE} #
##1# A.Error > 0
##2# A.Error = 0
##END#
%Category%
%DocDate$DATE%
%Text%
%DocumentType%
%Document_ID%
%PDocumentType%
%PDocument_ID%
%SORT_DocumentDisplayName%
%SORT_PDocumentDisplayName%
%IncomeType_ID%
%ExpenseType_ID%
%Error%
%BankCredit%
%BankDebit%
%CashCredit%
%CashDebit%
%ThroughItemCredit%
%ThroughItemDebit%
%VATCredit%
%VATDebit%
%Amount%
Generated by ABRA Software a.s. 27.10.2021 16:36