-
-
Save vkostyanetsky/cf34c6cb088515e2bab6485b2f35eab8 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
SELECT | |
<...> | |
CASE | |
WHEN ENDOFPERIOD(Inventory.SalesDocument.Date, MONTH) < ENDOFPERIOD(Inventory.Period, MONTH) | |
THEN TRUE | |
ELSE FALSE | |
END AS ItsReturnOfLastPeriod, | |
INTO TTReturns | |
FROM | |
AccumulationRegister.Inventory AS Inventory | |
WHERE | |
CASE | |
WHEN &Ref = UNDEFINED | |
THEN Inventory.Period BETWEEN &BeginOfPeriod AND &EndOfPeriod | |
ELSE Inventory.Recorder = &Ref | |
END | |
AND ( | |
NOT Inventory.FixedCost | |
OR ENDOFPERIOD(Inventory.SalesDocument.Date, MONTH) < ENDOFPERIOD(Inventory.Period, MONTH) | |
AND Inventory.FixedCost | |
) | |
AND Inventory.Return | |
AND Inventory.Entity = &Entity | |
AND Inventory.CorrGLAccount_GL = &EmptyAccount_GL | |
AND Inventory.SalesDocument <> UNDEFINED | |
GROUP BY | |
<...> | |
CASE | |
WHEN ENDOFPERIOD(Inventory.SalesDocument.Date, MONTH) < ENDOFPERIOD(Inventory.Period, MONTH) | |
THEN TRUE | |
ELSE FALSE | |
END |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment