Scenario: User wants to be able to attach one set of attachments and be able to access those attachments from any of the lines in a GL Journal Entry.
Example Solution:
- Open SSMS (SQL Management Studio) and connect to your SQL Server
- Copy and paste the SQL Query below into a new Query window
- Review the query to ensure you copied the entire query and didn’t miss and of the WHERE clause as that would cause unexpected results.
- Execute the query to create the stored procedure.
- Open a new query window and copy and paste GRANT EXECUTE ON [dbo].[CTS_GLDBAttachtoAll] TO [VCSUsers] into the query window and execute the query.
- Open VA Custom Form Buttons in Vista
- Add a new button record for form GLJE.
- Title the button Sync Attachments to All Lines
- Set action type to Stored Procedure
- Set Action to CTS_GLDBAttachtoAll
- Set Button Refresh to Refresh Data Set.
- Switch to the parameter tab
- Setup Parameters as follows:
- @GLCo,Type=4
- @Mth,Type=3,DefaultValue=1
- @BatchID,Type=3, DefaultValue=2
- @BatchSeq,Type=3,DefaultValue=10
- Open the GL Journal Transaction Entry form.
- Select move custom buttons from the tools menu.
- Drag the new button to a desired location, typically to the right of the reference total.
- Accept the location by clicking accept on the sidebar panel.
- Test button to validate functionality before using on production entries by using the following steps.
- Enter a journal entry and then attach attachments to one line.
- Select the line with the attachments and then click the Sync Attachments to All Lines button to sync the attachments to the remaining lines in the journal entry.
- A couple of items to note on this functionality:
- This works by sharing the UniqueAttchID (which is Vista’s pointer to a record contains the links to the attachments) across all of the lines in the journal entry.
- Only use this if you want this attachments shared with all lines in the batch. SO don’t use this if you have an reclass entry and a WIP adjustment in the same batch.
- If desired, the Stored procedure could be modified to restrict the attachment sync to only the lines with the same Reference.
- If another line already has attachments this will override the UniqueAttchID of that line and orphan those attachments in the system.
- A couple of items to note on this functionality:
- Verify the attachments on each line of the entry.
- One the first production entry, verify the attachments using GL Trial Balance Drilldown.
SQL Query
USE [Viewpoint]
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE PROCEDURE [dbo].[CTS_GLDBAttachtoAll] @GLCo bCompany
, @Mth bMonth
, @BatchID INT
, @BatchSeq INT
, @ReturnMessage VARCHAR(255) = NULL OUTPUT
AS
/*
* Created by: Constructive Tech Solutions kah 2020.12.18
* (C) 2020 Constructive Tech Solutions, All Rights Reserved
* PURPOSE: Copies the Unique Attachment ID so that Attachments can be shared across an entire Journal Entry without reattaching multiple copies of the files
*
* SOURCES: GLDB
*
* Change History:
*
*/
DECLARE @msg varchar(1000)
, @rows INT
BEGIN
UPDATE GLDB
SET UniqueAttchID = (select UniqueAttchID
FROM GLDB
WHERE Co = @GLCo
and Mth = @Mth
and BatchId = @BatchID
and BatchSeq = @BatchSeq)
FROM GLDB b
WHERE b.Co = @GLCo
and b.Mth = @Mth
and b.BatchId = @BatchID
set @rows = @@ROWCOUNT
SELECT @ReturnMessage = ISNULL(@msg, CAST((@rows-1) AS varchar(10)) + ' lines were linked to the attachments from sequence ' + ISNULL(CAST((@BatchSeq) AS varchar(10)),'**Error**'))
END
GO
Leave A Comment