{"App":{"Id":462,"AppId":462,"AppName":"Movement","AppDescription":"Movement","AppIdentifier":"efb146f2-bf68-42b5-967b-d35247b2054e","AppVersion":"11","ProductVersion":"5.4.5.0","Publisher":"4Sight","IsActive":false,"IsFree":true,"IsLicensed":false,"IsCreated":false,"LogoId":199650,"HelpLink":"https://4flow.bidvestcatering.co.za/","AboutLink":"https://4flow.bidvestcatering.co.za/","PrivacyLink":"https://4flow.bidvestcatering.co.za/","TermsLink":"https://4flow.bidvestcatering.co.za/","AppDependencyId":1,"WriteUp":"<p>https://4flow.bidvestcatering.co.za/</p>","WhenValidated":"2025-08-26T08:43:24","AppData":"","AppDataFileStoreId":null,"Logo":null,"AppModuleList":[],"AppTransactionTypeList":[],"AppSourceList":[{"Id":1535,"AppSourceId":1535,"AppId":462,"SourceId":1342}],"AppQueryList":[{"Id":9492,"AppQueryId":9492,"AppId":462,"QueryId":21817},{"Id":9493,"AppQueryId":9493,"AppId":462,"QueryId":21816}],"AppFormList":[],"AppProcessList":[],"AppDashboardList":[],"AppRoleList":[{"Id":9094,"AppRoleId":9094,"AppId":462,"RoleId":1077}],"AppNotificationTemplateList":[],"AppMappingXmlList":[],"AppOrgStructureList":[],"AppReportList":[{"Id":676,"AppReportId":676,"AppId":462,"ReportId":719,"FileStoreId":0},{"Id":677,"AppReportId":677,"AppId":462,"ReportId":718,"FileStoreId":0},{"Id":678,"AppReportId":678,"AppId":462,"ReportId":718,"FileStoreId":0}],"AppDataFilterList":[],"AppDataSetList":[],"AppHistoryList":[],"AppImageList":[],"AppFileList":[{"Id":549,"AppFileId":549,"AppId":462,"FileStoreId":1123498},{"Id":550,"AppFileId":550,"AppId":462,"FileStoreId":962343}],"AppFileTypeList":[],"AppScheduleList":[],"AppLocalDataList":[],"AppVirtualDataList":[],"AppResourceList":[],"AppTransactionTableList":[],"AppTransactionFieldList":[],"AppDependencyList":[{"Id":5,"AppDependencyId":5,"AppDependencyName":"Acumatica"},{"Id":6,"AppDependencyId":6,"AppDependencyName":"Intact"},{"Id":4,"AppDependencyId":4,"AppDependencyName":"Microsoft D365"},{"Id":7,"AppDependencyId":7,"AppDependencyName":"Other"},{"Id":2,"AppDependencyId":2,"AppDependencyName":"Sage 200"},{"Id":1,"AppDependencyId":1,"AppDependencyName":"Sage 300"},{"Id":3,"AppDependencyId":3,"AppDependencyName":"Sage X3"}],"AppIntegrationTemplateList":[],"AppDataTables":[],"WhenUpdated":"2025-11-03T19:22:24","WhoUpdated":6628},"ModuleList":[],"TransactionTypeList":[],"SourceList":[{"Id":1342,"SourceId":1342,"SourceName":"ROYDAT","SourceDescription":"ROYDAT","Domain":null,"Username":null,"Password":null,"ConnectionString1":null,"ConnectionString2":null,"ConnectionString3":null,"Version":"72A","SourceTypeId":1,"TrustServerCertificate":true,"SourceType":{"Id":1,"SourceTypeId":1,"SourceTypeName":"MSSQL"},"WhoUpdatedUser":null,"OAuth2":{"Id":0,"OAuth2Id":0,"SourceId":0,"TokenName":null,"GrantTypeId":0,"AuthUrl":null,"CallbackUrl":null,"AccessTokenUrl":null,"ClientId":null,"ClientSecret":null,"Username":null,"Password":null,"Scope":null,"State":null,"CodeChallengeMethodId":0,"CodeVerifier":null,"ClientAuthenticationTypeId":0,"OAuth2Parameters":[]},"SageIntacct":null,"WhenUpdated":"2025-06-15T16:08:31","WhoUpdated":2387}],"QueryList":[{"Id":21817,"QueryId":21817,"SourceId":1342,"QueryCategoryId":2,"QueryDescription":null,"QueryName":"Inventory Movement Main","QueryString":"SELECT A.* \n,ISNULL((SELECT TOP 1 [OpeningQty] FROM [ROYDAT].[dbo].[tblStockMovementOpeningBalances] as I WHERE I.[LocationCode] = A.[LOCATION] and I.[ItemNo] = A.[ITEMNO] AND [OpeningFY]=A.FISCYEAR AND [OpeningFP]=A.FISCPERIOD),0) OPENINGQTY\n\t  ,ISNULL((SELECT TOP 1 [OpeningTotalCost] FROM [ROYDAT].[dbo].[tblStockMovementOpeningBalances] as I WHERE I.[LocationCode] = A.[LOCATION] and I.[ItemNo] = A.[ITEMNO] AND [OpeningFY]=A.FISCYEAR AND [OpeningFP]=A.FISCPERIOD),0) OPENINGCOST\n,ISNULL((SELECT TOP 1 [ClosingQty] FROM [ROYDAT].[dbo].[tblStockMovementOpeningBalances] as I WHERE I.[LocationCode] = A.[LOCATION] and I.[ItemNo] = A.[ITEMNO] AND [OpeningFY]=A.FISCYEAR AND [OpeningFP]=A.FISCPERIOD),0) CLOSGINGQTY\n\t  ,ISNULL((SELECT TOP 1 [ClosingTotalCost] FROM [ROYDAT].[dbo].[tblStockMovementOpeningBalances] as I WHERE I.[LocationCode] = A.[LOCATION] and I.[ItemNo] = A.[ITEMNO] AND [OpeningFY]=A.FISCYEAR AND [OpeningFP]=A.FISCPERIOD),0) CLOSINGCOST\n\t  \n\n\n,(SELECT TOP 1 SUM(isnull([OpeningTotalCost],0)) FROM [ROYDAT].[dbo].[tblStockMovementOpeningBalances] where LocationCode = @LocationCode and OpeningFY = @Year and OpeningFP = @Period and ITEMNO >= case when isnull(@FromItemNumber,'') = '' then '' else @FromItemNumber end and ITEMNO <= case when isnull(@ToItemNumber,'') = '' then '99-999-999-9999-99999' else @ToItemNumber end) as GRANDOPENINGBAL\n\t  ,ISNULL((SELECT SUM(TRANSCOST) FROM ICIVAL where [LOCATION] = @LocationCode and FISCYEAR=@Year and FISCPERIOD=@Period and ITEMNO >= case when isnull(@FromItemNumber,'') = '' then '' else @FromItemNumber end and ITEMNO <= case when isnull(@ToItemNumber,'') = '' then '99-999-999-9999-99999' else @ToItemNumber end),0) AS GRANDNET\n\n\t  ,(SELECT TOP 1 SUM(isnull([OpeningTotalCost],0)) FROM [ROYDAT].[dbo].[tblStockMovementOpeningBalances] where LocationCode = @LocationCode and OpeningFY = @Year and OpeningFP = @Period and ITEMNO >= case when isnull(@FromItemNumber,'') = '' then '' else @FromItemNumber end and ITEMNO <= case when isnull(@ToItemNumber,'') = '' then '99-999-999-9999-99999' else @ToItemNumber end) \n\t  +ISNULL((SELECT SUM(TRANSCOST) FROM ICIVAL where [LOCATION] = @LocationCode and FISCYEAR=@Year and FISCPERIOD=@Period and ITEMNO >= case when isnull(@FromItemNumber,'') = '' then '' else @FromItemNumber end and ITEMNO <= case when isnull(@ToItemNumber,'') = '' then '99-999-999-9999-99999' else @ToItemNumber end),0) AS GRANDTOTAL\n\n,isnull((SELECT TOP 1 SUM(isnull([OpeningQty],0)) FROM [ROYDAT].[dbo].[tblStockMovementOpeningBalances] where LocationCode = @LocationCode and OpeningFY = @Year and OpeningFP = @Period and ITEMNO >= case when isnull(@FromItemNumber,'') = '' then '' else @FromItemNumber end and ITEMNO <= case when isnull(@ToItemNumber,'') = '' then '99-999-999-9999-99999' else @ToItemNumber end),0) as GRANDOPENINGQTY\n\t  ,isnull((SELECT TOP 1 SUM(isnull([ClosingQty],0)) FROM [ROYDAT].[dbo].[tblStockMovementOpeningBalances] where LocationCode = @LocationCode and OpeningFY = @Year and OpeningFP = @Period and ITEMNO >= case when isnull(@FromItemNumber,'') = '' then '' else @FromItemNumber end and ITEMNO <= case when isnull(@ToItemNumber,'') = '' then '99-999-999-9999-99999' else @ToItemNumber end)\n- (SELECT TOP 1 SUM(isnull([OpeningQty],0)) FROM [ROYDAT].[dbo].[tblStockMovementOpeningBalances] where LocationCode = @LocationCode and OpeningFY = @Year and OpeningFP = @Period and ITEMNO >= case when isnull(@FromItemNumber,'') = '' then '' else @FromItemNumber end and ITEMNO <= case when isnull(@ToItemNumber,'') = '' then '99-999-999-9999-99999' else @ToItemNumber end),0) AS GRANDNETQTY\n\n\t  ,isnull((SELECT TOP 1 SUM(isnull([ClosingQty],0)) FROM [ROYDAT].[dbo].[tblStockMovementOpeningBalances] where LocationCode = @LocationCode and OpeningFY = @Year and OpeningFP = @Period and ITEMNO >= case when isnull(@FromItemNumber,'') = '' then '' else @FromItemNumber end and ITEMNO <= case when isnull(@ToItemNumber,'') = '' then '99-999-999-9999-99999' else @ToItemNumber end),0) AS GRANDCLOSINGQTY\n\n\nFROM \n(\n  SELECT distinct L.[LOCATION]\n\t  ,L.[DESC] as [LOCATIONDESC]\n      ,I.FMTITEMNO as FMTITEMNO\n\t  ,I.[DESC] as [ITEMDESC]\n\t  ,I.ITEMNO as ITEMNO\n\t  ,V.ITEMNO as A\n\t  ,V.FISCYEAR\n\t  ,V.FISCPERIOD\n  FROM [ROYDAT].[dbo].[ICITEM] AS I\n  inner join [ROYDAT].[dbo].ICILOC as IL on IL.[ITEMNO] = I.[ITEMNO]\n  inner join ICLOC AS L on L.[LOCATION] = IL.[LOCATION]\n  left outer join [ROYDAT].[dbo].[ICIVAL] as V on V.FISCYEAR =@Year and V.FISCPERIOD=@Period \nand V.[LOCATION] = L.[LOCATION] and V.[ITEMNO] = I.[ITEMNO]\n\n  \nWHERE L.[LOCATION] = @LocationCode and I.ITEMNO >= case when isnull(@FromItemNumber,'') = '' then '' else @FromItemNumber end\nand I.ITEMNO <= case when isnull(@ToItemNumber,'') = '' then '99999999999999999' else @ToItemNumber end\n  ) as A order by A.ITEMNO","QueryFields":null,"Source":{"Id":1342,"SourceId":1342,"SourceName":"ROYDAT","SourceDescription":"ROYDAT","Domain":null,"Username":null,"Password":null,"ConnectionString1":null,"ConnectionString2":null,"ConnectionString3":null,"Version":"72A","SourceTypeId":1,"TrustServerCertificate":true,"SourceType":null,"WhoUpdatedUser":null,"OAuth2":null,"SageIntacct":null,"WhenUpdated":"2025-06-15T16:08:31","WhoUpdated":2387},"QueryCategory":null,"QueryRest":{"Id":0,"QueryRestId":0,"QueryId":0,"RestTypeId":0,"Headers":"","Body":"","RestType":{"Id":0,"RestTypeId":0,"RestTypeName":""},"Parameters":null},"QueryParameterList":[{"Id":8290,"QueryParameterId":8290,"QueryId":21817,"DataTypeId":1,"Name":"LocationCode","Value":"600000"},{"Id":8514,"QueryParameterId":8514,"QueryId":21817,"DataTypeId":1,"Name":"Year","Value":"2024"},{"Id":8515,"QueryParameterId":8515,"QueryId":21817,"DataTypeId":1,"Name":"Period","Value":"8"},{"Id":9407,"QueryParameterId":9407,"QueryId":21817,"DataTypeId":1,"Name":"FromItemNumber","Value":"01002005003700109"},{"Id":9408,"QueryParameterId":9408,"QueryId":21817,"DataTypeId":1,"Name":"ToItemNumber","Value":"01002005003700109"}],"QuerySchema":{"Id":3361,"JsonContent":"{\r\n  \"$schema\": \"http://json-schema.org/draft-04/schema#\",\r\n  \"type\": \"array\",\r\n  \"items\": {\r\n    \"$ref\": \"#/definitions/Anonymous\"\r\n  },\r\n  \"definitions\": {\r\n    \"Anonymous\": {\r\n      \"type\": \"object\",\r\n      \"properties\": {\r\n        \"LOCATION\": {\r\n          \"type\": \"string\"\r\n        },\r\n        \"LOCATIONDESC\": {\r\n          \"type\": \"string\"\r\n        },\r\n        \"FMTITEMNO\": {\r\n          \"type\": \"string\"\r\n        },\r\n        \"ITEMDESC\": {\r\n          \"type\": \"string\"\r\n        },\r\n        \"ITEMNO\": {\r\n          \"type\": \"string\"\r\n        },\r\n        \"A\": {\r\n          \"type\": \"string\"\r\n        },\r\n        \"FISCYEAR\": {\r\n          \"type\": \"string\"\r\n        },\r\n        \"FISCPERIOD\": {\r\n          \"type\": \"integer\"\r\n        },\r\n        \"OPENINGQTY\": {\r\n          \"type\": \"number\"\r\n        },\r\n        \"OPENINGCOST\": {\r\n          \"type\": \"number\"\r\n        },\r\n        \"CLOSGINGQTY\": {\r\n          \"type\": \"number\"\r\n        },\r\n        \"CLOSINGCOST\": {\r\n          \"type\": \"number\"\r\n        },\r\n        \"GRANDOPENINGBAL\": {\r\n          \"type\": \"number\"\r\n        },\r\n        \"GRANDNET\": {\r\n          \"type\": \"number\"\r\n        },\r\n        \"GRANDTOTAL\": {\r\n          \"type\": \"number\"\r\n        },\r\n        \"GRANDOPENINGQTY\": {\r\n          \"type\": \"number\"\r\n        },\r\n        \"GRANDNETQTY\": {\r\n          \"type\": \"number\"\r\n        },\r\n        \"GRANDCLOSINGQTY\": {\r\n          \"type\": \"number\"\r\n        }\r\n      }\r\n    }\r\n  }\r\n}","QuerySchemaId":3361,"QueryId":21817,"WhenUpdated":"2025-02-17T21:36:31.7633333","WhoUpdated":160},"WhenUpdated":"2025-02-17T21:36:32","WhoUpdated":160},{"Id":21816,"QueryId":21816,"SourceId":1342,"QueryCategoryId":2,"QueryDescription":null,"QueryName":"InvMovementSubreport","QueryString":"\n\n\nSELECT  \nformat(CAST(CAST([TRANSDATE] AS VARCHAR(8)) AS DATE),'yyyy-MM-dd') as [TRANSDATE]\n,[DOCNUM]\n,[APP]\n,case when [APP] = 'PO' and [TRANSTYPE] = '1' Then 'Receipt'\n when [APP] = 'PO' and [TRANSTYPE] = '2' Then 'Receipt Adj.'\n  when [APP] = 'PO' and [TRANSTYPE] = '3' Then 'Return'\nwhen [APP] = 'IC' and [TRANSTYPE] = '11' Then 'Adj. Both -'\nwhen [APP] = 'IC' and [TRANSTYPE] = '7' Then 'Adj. Both -'\nwhen [APP] = 'IC' and [TRANSTYPE] = '10' Then 'Adj. Both +'\nwhen [APP] = 'IC' and [TRANSTYPE] = '17' Then 'Adj. Both +'\nwhen [APP] = 'IC' and [TRANSTYPE] = '20' Then 'Internal Usage'\nwhen [APP] = 'IC' and [TRANSTYPE] = '12' Then 'Transfer'\nELSE convert(nvarchar(10),[TRANSTYPE]) END as [TRANSTYPE]\n,[UNIT]\n ,case when [QUANTITY]>=0 then [QUANTITY] ELSE NULL END as [QUANTITY IN]\n ,case when [TRANSCOST]>=0 then [TRANSCOST] ELSE NULL END as [TRANSCOST IN]\n  ,case when [QUANTITY]<0 then ABS([QUANTITY]) ELSE NULL END as [QUANTITY OUT]\n ,case when [TRANSCOST]<0 then ABS([TRANSCOST]) ELSE NULL END as [TRANSCOST OUT]\n ,[ICIVAL].[TOTALQTY]\n ,[ICIVAL].[TOTALCOST]\n,Convert(Decimal(18,4),isnull(@OpeningQty,0.00))as OpeningQty\n,Convert(Decimal(18,4),isnull(@OpeningCost,0.00)) as OpeningCost\n,Convert(Decimal(18,4),isnull(@ClosingQty,0.00)) as ClosingQty\n,Convert(Decimal(18,4),isnull(@ClosingCost,0.00)) as ClosingCost\n      ,[ICIVAL].[LOCATION]\n\t  ,L.[DESC] as [LOCATIONDESC]\n      ,I.FMTITEMNO as FMTITEMNO\n\t  ,I.ITEMNO as ITEMNO\n\t  ,I.[DESC] as [ITEMDESC]\n      ,[FISCYEAR]\n      ,[FISCPERIOD]\n      \n      ,[ICIVAL].[CATEGORY]\n      \nFROM [ROYDAT].[dbo].[ICITEM] AS I\n  inner join [ROYDAT].[dbo].ICILOC as IL on IL.[ITEMNO] = I.[ITEMNO] and IL.[LOCATION] = @LocationCode\n  inner join ICLOC AS L on L.[LOCATION] = IL.[LOCATION]\n  left outer join [ICIVAL] on [ICIVAL].FISCYEAR =@Year and [ICIVAL].FISCPERIOD=@Period and [ICIVAL].[LOCATION] = L.[LOCATION]  and [ICIVAL].ITEMNO = I.ITEMNO\n\n  where \n--I.ITEMNO = @ItemNumber\n--  and \nL.[LOCATION] = @LocationCode\n\nORDER BY ICIVAL.DAYENDSEQ,ICIVAL.ENTRYSEQ,ICIVAL.[LINENO]","QueryFields":null,"Source":{"Id":1342,"SourceId":1342,"SourceName":"ROYDAT","SourceDescription":"ROYDAT","Domain":null,"Username":null,"Password":null,"ConnectionString1":null,"ConnectionString2":null,"ConnectionString3":null,"Version":"72A","SourceTypeId":1,"TrustServerCertificate":true,"SourceType":null,"WhoUpdatedUser":null,"OAuth2":null,"SageIntacct":null,"WhenUpdated":"2025-06-15T16:08:31","WhoUpdated":2387},"QueryCategory":null,"QueryRest":{"Id":0,"QueryRestId":0,"QueryId":0,"RestTypeId":0,"Headers":"","Body":"","RestType":{"Id":0,"RestTypeId":0,"RestTypeName":""},"Parameters":null},"QueryParameterList":[{"Id":8284,"QueryParameterId":8284,"QueryId":21816,"DataTypeId":1,"Name":"LocationCode","Value":"600000"},{"Id":8287,"QueryParameterId":8287,"QueryId":21816,"DataTypeId":1,"Name":"ItemNumber","Value":"01002005003700109"},{"Id":8311,"QueryParameterId":8311,"QueryId":21816,"DataTypeId":1,"Name":"OpeningQty","Value":"0"},{"Id":8312,"QueryParameterId":8312,"QueryId":21816,"DataTypeId":3,"Name":"OpeningCost","Value":"43"},{"Id":8313,"QueryParameterId":8313,"QueryId":21816,"DataTypeId":3,"Name":"ClosingQty","Value":"234"},{"Id":8314,"QueryParameterId":8314,"QueryId":21816,"DataTypeId":3,"Name":"ClosingCost","Value":"2345"},{"Id":8516,"QueryParameterId":8516,"QueryId":21816,"DataTypeId":1,"Name":"Year","Value":"2024"},{"Id":8517,"QueryParameterId":8517,"QueryId":21816,"DataTypeId":1,"Name":"Period","Value":"8"}],"QuerySchema":{"Id":3389,"JsonContent":"{\r\n  \"$schema\": \"http://json-schema.org/draft-04/schema#\",\r\n  \"type\": \"array\",\r\n  \"items\": {\r\n    \"$ref\": \"#/definitions/Anonymous\"\r\n  },\r\n  \"definitions\": {\r\n    \"Anonymous\": {\r\n      \"type\": \"object\",\r\n      \"properties\": {\r\n        \"TRANSDATE\": {},\r\n        \"DOCNUM\": {},\r\n        \"APP\": {},\r\n        \"TRANSTYPE\": {},\r\n        \"UNIT\": {},\r\n        \"QUANTITY IN\": {},\r\n        \"TRANSCOST IN\": {},\r\n        \"QUANTITY OUT\": {},\r\n        \"TRANSCOST OUT\": {},\r\n        \"TOTALQTY\": {},\r\n        \"TOTALCOST\": {},\r\n        \"OpeningQty\": {\r\n          \"type\": \"number\"\r\n        },\r\n        \"OpeningCost\": {\r\n          \"type\": \"number\"\r\n        },\r\n        \"ClosingQty\": {\r\n          \"type\": \"number\"\r\n        },\r\n        \"ClosingCost\": {\r\n          \"type\": \"number\"\r\n        },\r\n        \"LOCATION\": {},\r\n        \"LOCATIONDESC\": {\r\n          \"type\": \"string\"\r\n        },\r\n        \"FMTITEMNO\": {\r\n          \"type\": \"string\"\r\n        },\r\n        \"ITEMNO\": {\r\n          \"type\": \"string\"\r\n        },\r\n        \"ITEMDESC\": {\r\n          \"type\": \"string\"\r\n        },\r\n        \"FISCYEAR\": {},\r\n        \"FISCPERIOD\": {},\r\n        \"CATEGORY\": {}\r\n      }\r\n    }\r\n  }\r\n}","QuerySchemaId":3389,"QueryId":21816,"WhenUpdated":"2025-02-17T21:52:04.1666667","WhoUpdated":160},"WhenUpdated":"2025-02-17T21:52:04","WhoUpdated":160}],"FormList":[],"ProcessList":[],"DashboardList":[],"NotificationTemplateList":[],"RoleList":[{"Id":1077,"RoleId":1077,"RoleName":"Tenant Admin","RoleDescription":"Tenant Admin","WhenUpdated":"2020-06-01T10:18:06","WhoUpdated":160}],"MappingXMLList":[],"OrgStructureList":[],"ReportList":[{"Id":719,"ReportId":719,"ReportCategoryId":1,"QueryId":21817,"SourceId":1342,"ReportTypeId":8,"ReportName":"BCS Inventory Movement Main Report","Description":"BCS Inventory Movement Main Report","ReportPath":null,"FileStoreId":199651,"IsActive":true,"PowerBiReportTypeId":0,"PowerBiReportId":"00000000-0000-0000-0000-000000000000","PowerBiWorkspaceId":"00000000-0000-0000-0000-000000000000","ReportType":{"Id":8,"ReportTypeId":8,"ReportTypeName":"Xtra Reports"},"ReportRoles":[{"Id":19944,"ReportRoleId":19944,"RoleId":1077,"ReportId":719,"WhenUpdated":"2024-08-19T14:13:54","WhoUpdated":2332}],"ReportCategory":{"Id":1,"ReportCategoryId":1,"ReportCategoryName":"Workflow"},"Query":{"Id":21817,"QueryId":21817,"SourceId":1342,"QueryCategoryId":2,"QueryDescription":null,"QueryName":"Inventory Movement Main","QueryString":"SELECT A.* \n,ISNULL((SELECT TOP 1 [OpeningQty] FROM [ROYDAT].[dbo].[tblStockMovementOpeningBalances] as I WHERE I.[LocationCode] = A.[LOCATION] and I.[ItemNo] = A.[ITEMNO] AND [OpeningFY]=A.FISCYEAR AND [OpeningFP]=A.FISCPERIOD),0) OPENINGQTY\n\t  ,ISNULL((SELECT TOP 1 [OpeningTotalCost] FROM [ROYDAT].[dbo].[tblStockMovementOpeningBalances] as I WHERE I.[LocationCode] = A.[LOCATION] and I.[ItemNo] = A.[ITEMNO] AND [OpeningFY]=A.FISCYEAR AND [OpeningFP]=A.FISCPERIOD),0) OPENINGCOST\n,ISNULL((SELECT TOP 1 [ClosingQty] FROM [ROYDAT].[dbo].[tblStockMovementOpeningBalances] as I WHERE I.[LocationCode] = A.[LOCATION] and I.[ItemNo] = A.[ITEMNO] AND [OpeningFY]=A.FISCYEAR AND [OpeningFP]=A.FISCPERIOD),0) CLOSGINGQTY\n\t  ,ISNULL((SELECT TOP 1 [ClosingTotalCost] FROM [ROYDAT].[dbo].[tblStockMovementOpeningBalances] as I WHERE I.[LocationCode] = A.[LOCATION] and I.[ItemNo] = A.[ITEMNO] AND [OpeningFY]=A.FISCYEAR AND [OpeningFP]=A.FISCPERIOD),0) CLOSINGCOST\n\t  \n\n\n,(SELECT TOP 1 SUM(isnull([OpeningTotalCost],0)) FROM [ROYDAT].[dbo].[tblStockMovementOpeningBalances] where LocationCode = @LocationCode and OpeningFY = @Year and OpeningFP = @Period and ITEMNO >= case when isnull(@FromItemNumber,'') = '' then '' else @FromItemNumber end and ITEMNO <= case when isnull(@ToItemNumber,'') = '' then '99-999-999-9999-99999' else @ToItemNumber end) as GRANDOPENINGBAL\n\t  ,ISNULL((SELECT SUM(TRANSCOST) FROM ICIVAL where [LOCATION] = @LocationCode and FISCYEAR=@Year and FISCPERIOD=@Period and ITEMNO >= case when isnull(@FromItemNumber,'') = '' then '' else @FromItemNumber end and ITEMNO <= case when isnull(@ToItemNumber,'') = '' then '99-999-999-9999-99999' else @ToItemNumber end),0) AS GRANDNET\n\n\t  ,(SELECT TOP 1 SUM(isnull([OpeningTotalCost],0)) FROM [ROYDAT].[dbo].[tblStockMovementOpeningBalances] where LocationCode = @LocationCode and OpeningFY = @Year and OpeningFP = @Period and ITEMNO >= case when isnull(@FromItemNumber,'') = '' then '' else @FromItemNumber end and ITEMNO <= case when isnull(@ToItemNumber,'') = '' then '99-999-999-9999-99999' else @ToItemNumber end) \n\t  +ISNULL((SELECT SUM(TRANSCOST) FROM ICIVAL where [LOCATION] = @LocationCode and FISCYEAR=@Year and FISCPERIOD=@Period and ITEMNO >= case when isnull(@FromItemNumber,'') = '' then '' else @FromItemNumber end and ITEMNO <= case when isnull(@ToItemNumber,'') = '' then '99-999-999-9999-99999' else @ToItemNumber end),0) AS GRANDTOTAL\n\n,isnull((SELECT TOP 1 SUM(isnull([OpeningQty],0)) FROM [ROYDAT].[dbo].[tblStockMovementOpeningBalances] where LocationCode = @LocationCode and OpeningFY = @Year and OpeningFP = @Period and ITEMNO >= case when isnull(@FromItemNumber,'') = '' then '' else @FromItemNumber end and ITEMNO <= case when isnull(@ToItemNumber,'') = '' then '99-999-999-9999-99999' else @ToItemNumber end),0) as GRANDOPENINGQTY\n\t  ,isnull((SELECT TOP 1 SUM(isnull([ClosingQty],0)) FROM [ROYDAT].[dbo].[tblStockMovementOpeningBalances] where LocationCode = @LocationCode and OpeningFY = @Year and OpeningFP = @Period and ITEMNO >= case when isnull(@FromItemNumber,'') = '' then '' else @FromItemNumber end and ITEMNO <= case when isnull(@ToItemNumber,'') = '' then '99-999-999-9999-99999' else @ToItemNumber end)\n- (SELECT TOP 1 SUM(isnull([OpeningQty],0)) FROM [ROYDAT].[dbo].[tblStockMovementOpeningBalances] where LocationCode = @LocationCode and OpeningFY = @Year and OpeningFP = @Period and ITEMNO >= case when isnull(@FromItemNumber,'') = '' then '' else @FromItemNumber end and ITEMNO <= case when isnull(@ToItemNumber,'') = '' then '99-999-999-9999-99999' else @ToItemNumber end),0) AS GRANDNETQTY\n\n\t  ,isnull((SELECT TOP 1 SUM(isnull([ClosingQty],0)) FROM [ROYDAT].[dbo].[tblStockMovementOpeningBalances] where LocationCode = @LocationCode and OpeningFY = @Year and OpeningFP = @Period and ITEMNO >= case when isnull(@FromItemNumber,'') = '' then '' else @FromItemNumber end and ITEMNO <= case when isnull(@ToItemNumber,'') = '' then '99-999-999-9999-99999' else @ToItemNumber end),0) AS GRANDCLOSINGQTY\n\n\nFROM \n(\n  SELECT distinct L.[LOCATION]\n\t  ,L.[DESC] as [LOCATIONDESC]\n      ,I.FMTITEMNO as FMTITEMNO\n\t  ,I.[DESC] as [ITEMDESC]\n\t  ,I.ITEMNO as ITEMNO\n\t  ,V.ITEMNO as A\n\t  ,V.FISCYEAR\n\t  ,V.FISCPERIOD\n  FROM [ROYDAT].[dbo].[ICITEM] AS I\n  inner join [ROYDAT].[dbo].ICILOC as IL on IL.[ITEMNO] = I.[ITEMNO]\n  inner join ICLOC AS L on L.[LOCATION] = IL.[LOCATION]\n  left outer join [ROYDAT].[dbo].[ICIVAL] as V on V.FISCYEAR =@Year and V.FISCPERIOD=@Period \nand V.[LOCATION] = L.[LOCATION] and V.[ITEMNO] = I.[ITEMNO]\n\n  \nWHERE L.[LOCATION] = @LocationCode and I.ITEMNO >= case when isnull(@FromItemNumber,'') = '' then '' else @FromItemNumber end\nand I.ITEMNO <= case when isnull(@ToItemNumber,'') = '' then '99999999999999999' else @ToItemNumber end\n  ) as A order by A.ITEMNO","QueryFields":null,"Source":null,"QueryCategory":null,"QueryRest":null,"QueryParameterList":null,"QuerySchema":null,"WhenUpdated":"2025-02-17T21:36:32","WhoUpdated":160},"PowerBiReportType":null,"WhoUpdatedUser":null,"WhenUpdated":"2024-08-19T14:13:54","WhoUpdated":2332},{"Id":718,"ReportId":718,"ReportCategoryId":1,"QueryId":21816,"SourceId":1342,"ReportTypeId":8,"ReportName":"BCS Inventory Movement SubReport","Description":"BCS Inventory Movement SubReport","ReportPath":null,"FileStoreId":199652,"IsActive":true,"PowerBiReportTypeId":0,"PowerBiReportId":"00000000-0000-0000-0000-000000000000","PowerBiWorkspaceId":"00000000-0000-0000-0000-000000000000","ReportType":{"Id":8,"ReportTypeId":8,"ReportTypeName":"Xtra Reports"},"ReportRoles":[{"Id":18473,"ReportRoleId":18473,"RoleId":1077,"ReportId":718,"WhenUpdated":"2024-07-02T08:38:54","WhoUpdated":160}],"ReportCategory":{"Id":1,"ReportCategoryId":1,"ReportCategoryName":"Workflow"},"Query":{"Id":21816,"QueryId":21816,"SourceId":1342,"QueryCategoryId":2,"QueryDescription":null,"QueryName":"InvMovementSubreport","QueryString":"\n\n\nSELECT  \nformat(CAST(CAST([TRANSDATE] AS VARCHAR(8)) AS DATE),'yyyy-MM-dd') as [TRANSDATE]\n,[DOCNUM]\n,[APP]\n,case when [APP] = 'PO' and [TRANSTYPE] = '1' Then 'Receipt'\n when [APP] = 'PO' and [TRANSTYPE] = '2' Then 'Receipt Adj.'\n  when [APP] = 'PO' and [TRANSTYPE] = '3' Then 'Return'\nwhen [APP] = 'IC' and [TRANSTYPE] = '11' Then 'Adj. Both -'\nwhen [APP] = 'IC' and [TRANSTYPE] = '7' Then 'Adj. Both -'\nwhen [APP] = 'IC' and [TRANSTYPE] = '10' Then 'Adj. Both +'\nwhen [APP] = 'IC' and [TRANSTYPE] = '17' Then 'Adj. Both +'\nwhen [APP] = 'IC' and [TRANSTYPE] = '20' Then 'Internal Usage'\nwhen [APP] = 'IC' and [TRANSTYPE] = '12' Then 'Transfer'\nELSE convert(nvarchar(10),[TRANSTYPE]) END as [TRANSTYPE]\n,[UNIT]\n ,case when [QUANTITY]>=0 then [QUANTITY] ELSE NULL END as [QUANTITY IN]\n ,case when [TRANSCOST]>=0 then [TRANSCOST] ELSE NULL END as [TRANSCOST IN]\n  ,case when [QUANTITY]<0 then ABS([QUANTITY]) ELSE NULL END as [QUANTITY OUT]\n ,case when [TRANSCOST]<0 then ABS([TRANSCOST]) ELSE NULL END as [TRANSCOST OUT]\n ,[ICIVAL].[TOTALQTY]\n ,[ICIVAL].[TOTALCOST]\n,Convert(Decimal(18,4),isnull(@OpeningQty,0.00))as OpeningQty\n,Convert(Decimal(18,4),isnull(@OpeningCost,0.00)) as OpeningCost\n,Convert(Decimal(18,4),isnull(@ClosingQty,0.00)) as ClosingQty\n,Convert(Decimal(18,4),isnull(@ClosingCost,0.00)) as ClosingCost\n      ,[ICIVAL].[LOCATION]\n\t  ,L.[DESC] as [LOCATIONDESC]\n      ,I.FMTITEMNO as FMTITEMNO\n\t  ,I.ITEMNO as ITEMNO\n\t  ,I.[DESC] as [ITEMDESC]\n      ,[FISCYEAR]\n      ,[FISCPERIOD]\n      \n      ,[ICIVAL].[CATEGORY]\n      \nFROM [ROYDAT].[dbo].[ICITEM] AS I\n  inner join [ROYDAT].[dbo].ICILOC as IL on IL.[ITEMNO] = I.[ITEMNO] and IL.[LOCATION] = @LocationCode\n  inner join ICLOC AS L on L.[LOCATION] = IL.[LOCATION]\n  left outer join [ICIVAL] on [ICIVAL].FISCYEAR =@Year and [ICIVAL].FISCPERIOD=@Period and [ICIVAL].[LOCATION] = L.[LOCATION]  and [ICIVAL].ITEMNO = I.ITEMNO\n\n  where \n--I.ITEMNO = @ItemNumber\n--  and \nL.[LOCATION] = @LocationCode\n\nORDER BY ICIVAL.DAYENDSEQ,ICIVAL.ENTRYSEQ,ICIVAL.[LINENO]","QueryFields":null,"Source":null,"QueryCategory":null,"QueryRest":null,"QueryParameterList":null,"QuerySchema":null,"WhenUpdated":"2025-02-17T21:52:04","WhoUpdated":160},"PowerBiReportType":null,"WhoUpdatedUser":null,"WhenUpdated":"2024-07-02T08:38:54","WhoUpdated":160},{"Id":718,"ReportId":718,"ReportCategoryId":1,"QueryId":21816,"SourceId":1342,"ReportTypeId":8,"ReportName":"BCS Inventory Movement SubReport","Description":"BCS Inventory Movement SubReport","ReportPath":null,"FileStoreId":199652,"IsActive":true,"PowerBiReportTypeId":0,"PowerBiReportId":"00000000-0000-0000-0000-000000000000","PowerBiWorkspaceId":"00000000-0000-0000-0000-000000000000","ReportType":{"Id":8,"ReportTypeId":8,"ReportTypeName":"Xtra Reports"},"ReportRoles":[{"Id":18473,"ReportRoleId":18473,"RoleId":1077,"ReportId":718,"WhenUpdated":"2024-07-02T08:38:54","WhoUpdated":160}],"ReportCategory":{"Id":1,"ReportCategoryId":1,"ReportCategoryName":"Workflow"},"Query":{"Id":21816,"QueryId":21816,"SourceId":1342,"QueryCategoryId":2,"QueryDescription":null,"QueryName":"InvMovementSubreport","QueryString":"\n\n\nSELECT  \nformat(CAST(CAST([TRANSDATE] AS VARCHAR(8)) AS DATE),'yyyy-MM-dd') as [TRANSDATE]\n,[DOCNUM]\n,[APP]\n,case when [APP] = 'PO' and [TRANSTYPE] = '1' Then 'Receipt'\n when [APP] = 'PO' and [TRANSTYPE] = '2' Then 'Receipt Adj.'\n  when [APP] = 'PO' and [TRANSTYPE] = '3' Then 'Return'\nwhen [APP] = 'IC' and [TRANSTYPE] = '11' Then 'Adj. Both -'\nwhen [APP] = 'IC' and [TRANSTYPE] = '7' Then 'Adj. Both -'\nwhen [APP] = 'IC' and [TRANSTYPE] = '10' Then 'Adj. Both +'\nwhen [APP] = 'IC' and [TRANSTYPE] = '17' Then 'Adj. Both +'\nwhen [APP] = 'IC' and [TRANSTYPE] = '20' Then 'Internal Usage'\nwhen [APP] = 'IC' and [TRANSTYPE] = '12' Then 'Transfer'\nELSE convert(nvarchar(10),[TRANSTYPE]) END as [TRANSTYPE]\n,[UNIT]\n ,case when [QUANTITY]>=0 then [QUANTITY] ELSE NULL END as [QUANTITY IN]\n ,case when [TRANSCOST]>=0 then [TRANSCOST] ELSE NULL END as [TRANSCOST IN]\n  ,case when [QUANTITY]<0 then ABS([QUANTITY]) ELSE NULL END as [QUANTITY OUT]\n ,case when [TRANSCOST]<0 then ABS([TRANSCOST]) ELSE NULL END as [TRANSCOST OUT]\n ,[ICIVAL].[TOTALQTY]\n ,[ICIVAL].[TOTALCOST]\n,Convert(Decimal(18,4),isnull(@OpeningQty,0.00))as OpeningQty\n,Convert(Decimal(18,4),isnull(@OpeningCost,0.00)) as OpeningCost\n,Convert(Decimal(18,4),isnull(@ClosingQty,0.00)) as ClosingQty\n,Convert(Decimal(18,4),isnull(@ClosingCost,0.00)) as ClosingCost\n      ,[ICIVAL].[LOCATION]\n\t  ,L.[DESC] as [LOCATIONDESC]\n      ,I.FMTITEMNO as FMTITEMNO\n\t  ,I.ITEMNO as ITEMNO\n\t  ,I.[DESC] as [ITEMDESC]\n      ,[FISCYEAR]\n      ,[FISCPERIOD]\n      \n      ,[ICIVAL].[CATEGORY]\n      \nFROM [ROYDAT].[dbo].[ICITEM] AS I\n  inner join [ROYDAT].[dbo].ICILOC as IL on IL.[ITEMNO] = I.[ITEMNO] and IL.[LOCATION] = @LocationCode\n  inner join ICLOC AS L on L.[LOCATION] = IL.[LOCATION]\n  left outer join [ICIVAL] on [ICIVAL].FISCYEAR =@Year and [ICIVAL].FISCPERIOD=@Period and [ICIVAL].[LOCATION] = L.[LOCATION]  and [ICIVAL].ITEMNO = I.ITEMNO\n\n  where \n--I.ITEMNO = @ItemNumber\n--  and \nL.[LOCATION] = @LocationCode\n\nORDER BY ICIVAL.DAYENDSEQ,ICIVAL.ENTRYSEQ,ICIVAL.[LINENO]","QueryFields":null,"Source":null,"QueryCategory":null,"QueryRest":null,"QueryParameterList":null,"QuerySchema":null,"WhenUpdated":"2025-02-17T21:52:04","WhoUpdated":160},"PowerBiReportType":null,"WhoUpdatedUser":null,"WhenUpdated":"2024-07-02T08:38:54","WhoUpdated":160}],"DataFilterList":[],"DataSetList":[],"FileStoreList":[],"ScheduleList":[],"LocalDataList":[],"VirtualDataList":[],"LocalDataEditList":{},"ResourceList":[],"TransactionTableList":[],"TransactionFieldList":[],"IntegrationTemplateList":[],"FileTypeList":[],"XtraReportMappings":null}