select (DQ.Code || '-' || CAST(a.OrdNumber AS VARCHAR(10)) ||'/' || P.Code) as DisplayName, FO.Name as FirmOfficeName, A.DocDate$Date as DocDate$Date, A.Duedate$Date as DueDate$Date, A.LocalAmount, A.LocalCreditAmount, A.LocalPaidAmount, A.LocalPaidCreditAmount, DQ.Code, A.ID as ID from IssuedInvoices A join DocQueues DQ on DQ.ID = A.Docqueue_Id and DQ.Documenttype = '03' join Periods P on P.ID = A.Period_Id join FirmOffices FO on FO.ID = A.FirmOffice_Id where (((A.LocalAmount>=0) and ((A.LocalAmount + A.LocalPaidCreditAmount - A.LocalPaidAmount - A.LocalCreditAmount) > 0)) or ((A.LocalAmount <0) and ((A.LocalAmount + A.LocalPaidCreditAmount - A.LocalPaidAmount - A.LocalCreditAmount) < 0))) and (A.Firm_ID IN (SELECT x.ID FROM Firms x WHERE x.ID = :FirmOID OR x.Firm_ID = :FirmOID))
Generated by ABRA Software a.s. 27.10.2021 16:34:09