or_retrieve
SELECT Mid(A.OrNo,4,11) AS [OR], A.OrDate, A.OrType, A.FormOfPayment, A.Payment, A.ActualPayment, A.RebateDiscount, A.Interest, A.BusinessName, A.TIN, A.InvoiceType, A.InvoiceNo, Iif(not IsNull(B.InvoiceDate),C.InvoiceDate,
Iif(not IsNull(C.InvoiceDate),C.InvoiceDate,
Iif(not Isnull(D.InvoiceDate),D.InvoiceDate))), A.Fullname, A.Address, A.BankBranch, A.CheckNo, A.DateofCheck
FROM
(
(
(
OfficialReceipt AS A
LEFT JOIN AccountCashBasis AS B ON ((A.InvoiceNo=B.InvoiceNo) AND (A.InvoiceType='MSC'))
)
LEFT JOIN AccountInstallment AS C ON ((A.Invoiceno=C.InvoiceNo) AND (A.InvoiceType='MSI'))
)
LEFT JOIN ItemInvoiceHeader AS D ON ((A.InvoiceNo=D.InvoiceNo) AND (A.InvoiceType='ISC'))
)
WHERE A.OrNo = p_OrNo;

0 Comments:
Post a Comment
<< Home