| ihLocalHandleToThePersistence | input | handle | |
| iiGL1SafID | input | integer | |
| iiGL2SafID | input | integer | |
| iiGL3SafID | input | integer | |
| iiGL4SafID | input | integer | |
| iiGL5SafID | input | integer | |
| iiCostCentre1SafID | input | integer | |
| iiCostCentre2SafID | input | integer | |
| iiCostCentre3SafID | input | integer | |
| iiCostCentre4SafID | input | integer | |
| iiCostCentre5SafID | input | integer | |
| iiProject1SafID | input | integer | |
| iiProject2SafID | input | integer | |
| iiProject3SafID | input | integer | |
| iiProject4SafID | input | integer | |
| iiProject5SafID | input | integer | |
| iiGLSafStructureID | input | integer | |
| iiCostCentreSafStructureID | input | integer | |
| iiProjectSafStructureID | input | integer | |
| oiNewPostingSafCombinedID | output | integer | |
| oiNbrOfCreatedPostingSAFCombined | output | integer | |
| oiNbrOfCreatedPostingSAFHist | output | integer | |
| oiReturnStatus | output | integer | Return status of the method. |
QadFinancials
/* ============================================================================================= */
/* This method creates a new SAF combination in the tables PostingSafCombined and PostingSafHist */
/* ============================================================================================= */
/* Input */
/* iiCostCentre1-5Saf_ID and iiCostCentreSafStructureID */
/* iiGL1-5Saf_ID and iiGLSafStructureID */
/* iiProject1-5Saf_ID and iiProjectSafStructureID */
/* Output */
/* oiPostingSafCombinedId (the new The PostingSafCombinedId) */
/* oiNbrOfCreatedPostingSAFCombined */
/* oiNbrOfCreatedPostingSAFHist */
/* ============================================================================================= */
/* Indicate Direct db-access (find, update and create) is done here */
<I-46 {WRITEDIRECTDBACCESS
&WRITETABLENAMES = "'PostingSaf,PostingSafCombined'"}>
/* =============================== */
/* Initialise output parameters */
/* =============================== */
assign oiNbrOfCreatedPostingSAFCombined = 0
oiNbrOfCreatedPostingSAFHist = 0.
/* ========================================================= */
/* Create the PostingSafCombined based upon the input params */
/* ========================================================= */
create PostingSafCombined.
assign vhFcComponent = ihLocalHandleToThePersistence
PostingSafCombined.PostingSafCombined_ID = <M-18 GetNextValue (input 'ObjectNumber':U (icSequence)) in Progress>
PostingSafCombined.Project1Saf_ID = iiProject1SafID
PostingSafCombined.Project2Saf_ID = iiProject2SafID
PostingSafCombined.Project3Saf_ID = iiProject3SafID
PostingSafCombined.Project4Saf_ID = iiProject4SafID
PostingSafCombined.Project5Saf_ID = iiProject5SafID
PostingSafCombined.CostCentre1Saf_ID = iiCostCentre1SafID
PostingSafCombined.CostCentre2Saf_ID = iiCostCentre2SafID
PostingSafCombined.CostCentre3Saf_ID = iiCostCentre3SafID
PostingSafCombined.CostCentre4Saf_ID = iiCostCentre4SafID
PostingSafCombined.CostCentre5Saf_ID = iiCostCentre5SafID
PostingSafCombined.GL1Saf_ID = iiGL1SafID
PostingSafCombined.GL2Saf_ID = iiGL2SafID
PostingSafCombined.GL3Saf_ID = iiGL3SafID
PostingSafCombined.GL4Saf_ID = iiGL4SafID
PostingSafCombined.GL5Saf_ID = iiGL5SafID
PostingSafCombined.ProjectSafStructure_ID = iiProjectSafStructureID
PostingSafCombined.CostCentreSafStructure_ID = iiCostCentreSafStructureID
PostingSafCombined.GLSafStructure_ID = iiGLSafStructureID
PostingSafCombined.LastModifiedDate = today
PostingSafCombined.LastModifiedTime = time
PostingSafCombined.LastModifiedUser = vcUserLogin.
/* ================= */
/* Set output values */
/* ================= */
assign oiNbrOfCreatedPostingSAFCombined = oiNbrOfCreatedPostingSAFCombined + 1
oiNewPostingSafCombinedID = PostingSafCombined.PostingSafCombined_ID.
/* ======================================================================================= */
/* Create the PostingSafHist records underneath the PostingSafCombined - for the GLSafID's */
/* ======================================================================================= */
if iiGL1SafID > 0
then do:
create PostingSafHist.
assign oiNbrOfCreatedPostingSAFHist = oiNbrOfCreatedPostingSAFHist + 1
vhFcComponent = ihLocalHandleToThePersistence
PostingSafHist.PostingSafHist_ID = <M-9 GetNextValue (input 'ObjectNumber':U (icSequence)) in Progress>
PostingSafHist.Saf_ID = iiGL1SafID
PostingSafHist.PostingSafCombined_ID = PostingSafCombined.PostingSafCombined_ID.
end.
if iiGL2SafID > 0
then do:
create PostingSafHist.
assign oiNbrOfCreatedPostingSAFHist = oiNbrOfCreatedPostingSAFHist + 1
vhFcComponent = ihLocalHandleToThePersistence
PostingSafHist.PostingSafHist_ID = <M-53 GetNextValue (input 'ObjectNumber':U (icSequence)) in Progress>
PostingSafHist.Saf_ID = iiGL2SafID
PostingSafHist.PostingSafCombined_ID = PostingSafCombined.PostingSafCombined_ID.
end.
if iiGL3SafID > 0
then do:
create PostingSafHist.
assign oiNbrOfCreatedPostingSAFHist = oiNbrOfCreatedPostingSAFHist + 1
vhFcComponent = ihLocalHandleToThePersistence
PostingSafHist.PostingSafHist_ID = <M-81 GetNextValue (input 'ObjectNumber':U (icSequence)) in Progress>
PostingSafHist.Saf_ID = iiGL3SafID
PostingSafHist.PostingSafCombined_ID = PostingSafCombined.PostingSafCombined_ID.
end.
if iiGL4SafID > 0
then do:
create PostingSafHist.
assign oiNbrOfCreatedPostingSAFHist = oiNbrOfCreatedPostingSAFHist + 1
vhFcComponent = ihLocalHandleToThePersistence
PostingSafHist.PostingSafHist_ID = <M-63 GetNextValue (input 'ObjectNumber':U (icSequence)) in Progress>
PostingSafHist.Saf_ID = iiGL4SafID
PostingSafHist.PostingSafCombined_ID = PostingSafCombined.PostingSafCombined_ID.
end.
if iiGL5SafID > 0
then do:
create PostingSafHist.
assign oiNbrOfCreatedPostingSAFHist = oiNbrOfCreatedPostingSAFHist + 1
vhFcComponent = ihLocalHandleToThePersistence
PostingSafHist.PostingSafHist_ID = <M-70 GetNextValue (input 'ObjectNumber':U (icSequence)) in Progress>
PostingSafHist.Saf_ID = iiGL5SafID
PostingSafHist.PostingSafCombined_ID = PostingSafCombined.PostingSafCombined_ID.
end.
/* ============================================================================================ */
/* Create the PostingSafHist records underneath the PostingSafCombined - for the CostCentreID's */
/* ============================================================================================ */
if iiCostCentre1SafID > 0
then do:
create PostingSafHist.
assign oiNbrOfCreatedPostingSAFHist = oiNbrOfCreatedPostingSAFHist + 1
vhFcComponent = ihLocalHandleToThePersistence
PostingSafHist.PostingSafHist_ID = <M-85 GetNextValue (input 'ObjectNumber':U (icSequence)) in Progress>
PostingSafHist.Saf_ID = iiCostCentre1SafID
PostingSafHist.PostingSafCombined_ID = PostingSafCombined.PostingSafCombined_ID.
end.
if iiCostCentre2SafID > 0
then do:
create PostingSafHist.
assign oiNbrOfCreatedPostingSAFHist = oiNbrOfCreatedPostingSAFHist + 1
vhFcComponent = ihLocalHandleToThePersistence
PostingSafHist.PostingSafHist_ID = <M-11 GetNextValue (input 'ObjectNumber':U (icSequence)) in Progress>
PostingSafHist.Saf_ID = iiCostCentre2SafID
PostingSafHist.PostingSafCombined_ID = PostingSafCombined.PostingSafCombined_ID.
end.
if iiCostCentre3SafID > 0
then do:
create PostingSafHist.
assign oiNbrOfCreatedPostingSAFHist = oiNbrOfCreatedPostingSAFHist + 1
vhFcComponent = ihLocalHandleToThePersistence
PostingSafHist.PostingSafHist_ID = <M-87 GetNextValue (input 'ObjectNumber':U (icSequence)) in Progress>
PostingSafHist.Saf_ID = iiCostCentre3SafID
PostingSafHist.PostingSafCombined_ID = PostingSafCombined.PostingSafCombined_ID.
end.
if iiCostCentre4SafID > 0
then do:
create PostingSafHist.
assign oiNbrOfCreatedPostingSAFHist = oiNbrOfCreatedPostingSAFHist + 1
vhFcComponent = ihLocalHandleToThePersistence
PostingSafHist.PostingSafHist_ID = <M-67 GetNextValue (input 'ObjectNumber':U (icSequence)) in Progress>
PostingSafHist.Saf_ID = iiCostCentre4SafID
PostingSafHist.PostingSafCombined_ID = PostingSafCombined.PostingSafCombined_ID.
end.
if iiCostCentre5SafID > 0
then do:
create PostingSafHist.
assign oiNbrOfCreatedPostingSAFHist = oiNbrOfCreatedPostingSAFHist + 1
vhFcComponent = ihLocalHandleToThePersistence
PostingSafHist.PostingSafHist_ID = <M-77 GetNextValue (input 'ObjectNumber':U (icSequence)) in Progress>
PostingSafHist.Saf_ID = iiCostCentre5SafID
PostingSafHist.PostingSafCombined_ID = PostingSafCombined.PostingSafCombined_ID.
end.
/* ============================================================================================ */
/* Create the PostingSafHist records underneath the PostingSafCombined - for the ProjectSafID's */
/* ============================================================================================ */
if iiProject1SafID > 0
then do:
create PostingSafHist.
assign oiNbrOfCreatedPostingSAFHist = oiNbrOfCreatedPostingSAFHist + 1
vhFcComponent = ihLocalHandleToThePersistence
PostingSafHist.PostingSafHist_ID = <M-65 GetNextValue (input 'ObjectNumber':U (icSequence)) in Progress>
PostingSafHist.Saf_ID = iiProject1SafID
PostingSafHist.PostingSafCombined_ID = PostingSafCombined.PostingSafCombined_ID.
end.
if iiProject2SafID > 0
then do:
create PostingSafHist.
assign oiNbrOfCreatedPostingSAFHist = oiNbrOfCreatedPostingSAFHist + 1
vhFcComponent = ihLocalHandleToThePersistence
PostingSafHist.PostingSafHist_ID = <M-64 GetNextValue (input 'ObjectNumber':U (icSequence)) in Progress>
PostingSafHist.Saf_ID = iiProject2SafID
PostingSafHist.PostingSafCombined_ID = PostingSafCombined.PostingSafCombined_ID.
end.
if iiProject3SafID > 0
then do:
create PostingSafHist.
assign oiNbrOfCreatedPostingSAFHist = oiNbrOfCreatedPostingSAFHist + 1
vhFcComponent = ihLocalHandleToThePersistence
PostingSafHist.PostingSafHist_ID = <M-4 GetNextValue (input 'ObjectNumber':U (icSequence)) in Progress>
PostingSafHist.Saf_ID = iiProject3SafID
PostingSafHist.PostingSafCombined_ID = PostingSafCombined.PostingSafCombined_ID.
end.
if iiProject4SafID > 0
then do:
create PostingSafHist.
assign oiNbrOfCreatedPostingSAFHist = oiNbrOfCreatedPostingSAFHist + 1
vhFcComponent = ihLocalHandleToThePersistence
PostingSafHist.PostingSafHist_ID = <M-37 GetNextValue (input 'ObjectNumber':U (icSequence)) in Progress>
PostingSafHist.Saf_ID = iiProject4SafID
PostingSafHist.PostingSafCombined_ID = PostingSafCombined.PostingSafCombined_ID.
end.
if iiProject5SafID > 0
then do:
create PostingSafHist.
assign oiNbrOfCreatedPostingSAFHist = oiNbrOfCreatedPostingSAFHist + 1
vhFcComponent = ihLocalHandleToThePersistence
PostingSafHist.PostingSafHist_ID = <M-57 GetNextValue (input 'ObjectNumber':U (icSequence)) in Progress>
PostingSafHist.Saf_ID = iiProject5SafID
PostingSafHist.PostingSafCombined_ID = PostingSafCombined.PostingSafCombined_ID.
end.
/* ======================== */
/* Release the used buffers */
/* ======================== */
release PostingSafCombined.
release PostingSafHist.