Skip to content

Instantly share code, notes, and snippets.

@mattiaswolff
Created August 23, 2012 09:44
Show Gist options
  • Save mattiaswolff/3434801 to your computer and use it in GitHub Desktop.
Save mattiaswolff/3434801 to your computer and use it in GitHub Desktop.
Mediusflow: Get invoice information on all invoices on one project
declare @strAccount nvarchar(20)
declare @strCompanyId nvarchar(20)
set @strAccount = ''
set @strCompanyId = ''
SELECT InvoiceNumber,
VerificationIdentity,
SupplierName,
ps.SupplierId,
InvoiceDate,
DueDate,
iha.Debit as 'Debit',
iha.credit as 'Kredit',
TotalAmount,
Currency
FROM INVOICE_HEAD ih
INNER JOIN PRO_SUPPLIER ps ON (ps.ID = ih.SupplierId)
INNER JOIN INVOICE_HEAD_ACCOUNTING iha ON (iha.InvoiceId = ih.ID)
WHERE iha.AccountProjectId =
(select id from accounting where value = @strAccount and ACCOUNTING_TYPEID in
(select ID from ACCOUNTING_TYPE where COMPANYID =
(select ID from company where COMPANY_ID = @strCompanyId)))
ORDER BY VerificationIdentity
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment