on 2017 Nov 13 7:00 PM
Hello everyone, I have a query that brings me the data of the received payments, but when I add the variable, it asks me, it does not work for me. Help me if you can help me detect the error.....
Declare FI timestamp
SET @FI := (/*SELECT I0.DocDate FROM SBO_FERTEC.dbo.ORCT I0 WHERE I0."DocDate"= */'[%0]')
SELECT
T1."SeriesName" "Serie",
CASE
WHEN T2."InvType" = 13 THEN 'Factura'
WHEN T2."InvType" = 14 THEN 'N.Credito'
WHEN T2."InvType" = 24 THEN 'P.Recibido'
END "Docto",
CASE
WHEN T2."InvType" = 13 THEN (SELECT A."FolioNum" FROM OINV A WHERE A."DocEntry"=T2."DocEntry")
WHEN T2."InvType" = 14 THEN (SELECT A."FolioNum" FROM ORIN A WHERE A."DocEntry"=T2."DocEntry")
END "Folio",
T0."DocNum" "No. Pago",
T0."CardCode" "Código Cliente",
T0."CardName" "Nombre Cliente",
T3."LicTradNum",
T0."CashSum" "Efectivo",
T0."CreditSum" "T. Credito",
T0."CheckSum" "Cheque",
T0."TrsfrSum" "Transf",
T0."DocTotal" "Total",
CASE WHEN T0."CheckSum" > 0 THEN t4."DueDate"
WHEN T0."TrsfrSum" > 0 THEN T0."TrsfrDate"
ELSE T0."DocDate"
END "FPago"
--T0.DocDate 'Fecha Pago'
FROM ORCT T0
INNER JOIN NNM1 T1 ON T0."Series" = T1."Series"
INNER JOIN RCT2 T2 ON T0."DocNum" = T2."DocNum"
INNER JOIN OCRD T3 ON T3."CardCode" = T0."CardCode"
LEFT JOIN RCT1 T4 ON T4."DocNum" = T0."DocNum"
WHERE T0."Canceled" = 'N'
AND T0."DocDate" > '[%0]'
please try this
SELECT T1."SeriesName" AS "Serie",
CASE
WHEN T2."InvType" = 13 THEN 'Factura'
WHEN T2."InvType" = 14 THEN 'N.Credito'
WHEN T2."InvType" = 24 THEN 'P.Recibido'
END AS "Docto",
CASE
WHEN T2."InvType" = 13 THEN
(SELECT A."FolioNum"
FROM OINV A
WHERE A."DocEntry" = T2."DocEntry")
WHEN T2."InvType" = 14 THEN
(SELECT A."FolioNum"
FROM ORIN A
WHERE A."DocEntry" = T2."DocEntry")
END AS "Folio", T0."DocNum" AS "No. Pago", T0."CardCode" AS "Código Cliente",
T0."CardName" AS "Nombre Cliente", T3."LicTradNum", T0."CashSum" AS "Efectivo",
T0."CreditSum" AS "T. Credito", T0."CheckSum" AS "Cheque", T0."TrsfrSum" AS "Transf",
T0."DocTotal" AS "Total",
CASE
WHEN T0."CheckSum" > 0 THEN t4."DueDate"
WHEN T0."TrsfrSum" > 0 THEN T0."TrsfrDate"
ELSE T0."DocDate"
END AS "FPago"
FROM ORCT T0
INNER JOIN NNM1 T1 ON T0."Series" = T1."Series"
INNER JOIN RCT2 T2 ON T0."DocNum" = T2."DocNum"
INNER JOIN OCRD T3 ON T3."CardCode" = T0."CardCode"
LEFT OUTER JOIN RCT1 T4 ON T4."DocNum" = T0."DocNum"
WHERE T0."Canceled" = 'N' AND T0."DocDate" > '[%0]'
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
104 | |
10 | |
8 | |
7 | |
4 | |
4 | |
3 | |
3 | |
3 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.