project QadFinancials > class BCInvoice > method PostSaveDynamicCreations
Description
PostSaveDynamicCreations: submethod of the inheritted method PostSave that will create the QCInvoiceMovement records based upon temp-tables
Parameters
oiNbrOfCreatedQCInvoiceMovement | output | integer | QCInvoiceMovementCreated: Returns the number of QCInvoiceMovement records that are created |
oiReturnStatus | output | integer | Return status of the method. |
Internal usage
QadFinancials
program code (program1/bcinvoice.p)
/* ====================================================================================================================== */
/* IMPORTANT NOTES: */
/* */
/* The normal process is that updates towards other classes are done through the normal approach with Starting&Opening */
/* the external instance and then call a method in there. But as that decreases the performance to much for frequently */
/* used actions like the creation of the QCInvoiceMovement-records, we will here do the creation of these */
/* records here via dynamic buffers. */
/* */
/* The temp-tables used in here need to be defined with KeepState=true as the records in them are created in method */
/* AdditionalUpdates but they are used in PostSave and these method are not always executed in one go. */
/* So the 2 (AdditionalUpdates and PostSave) can be handled by another appserver-process and then PostSave would find */
/* the temp-table to empty when they were not defined with KeepState=true. */
/* ====================================================================================================================== */
/* ====================================================================================== */
/* Use an include that is only used to track direct writes in the program-code */
/* ====================================================================================== */
<I-70 {WRITEDIRECTDBACCESS
&WRITETABLENAMES = "'QCInvoiceMovement':U"}>
/* ====================================================================================== */
/* Start the persistenceLayer once so it can be used for get new db-sequences */
/* ====================================================================================== */
<M-26 run StartPersistence
(output vhFcComponent (ohPersistence),
output viFcReturnSuper (oiReturnStatus)) in BCInvoice>
/* =============================================================================================== */
/* QCInvoiceMovement: Transfer the data that is in the temp-tables to the db using dynamic buffers */
/* =============================================================================================== */
create buffer vhBufferQCInvoiceMovement for table "QCInvoiceMovement":U in widget-pool "non-persistent":U.
For each tQCInvoiceMovementToCreate
no-lock
on error undo, throw :
vhBufferQCInvoiceMovement:Buffer-Create().
assign oiNbrOfCreatedQCInvoiceMovement = oiNbrOfCreatedQCInvoiceMovement + 1
vhBufferQCInvoiceMovement::QCInvoiceMovement_ID = <M-71 GetNextValue (input 'ObjectNumber':U (icSequence)) in Progress>
vhBufferQCInvoiceMovement::CInvoiceMovementDebitLC = tQCInvoiceMovementToCreate.CInvoiceMovementDebitLC
vhBufferQCInvoiceMovement::CInvoiceMovementCreditLC = tQCInvoiceMovementToCreate.CInvoiceMovementCreditLC
vhBufferQCInvoiceMovement::CInvoiceMovementDebitTC = tQCInvoiceMovementToCreate.CInvoiceMovementDebitTC
vhBufferQCInvoiceMovement::CInvoiceMovementCreditTC = tQCInvoiceMovementToCreate.CInvoiceMovementCreditTC
vhBufferQCInvoiceMovement::CInvoiceMovementDebitCC = tQCInvoiceMovementToCreate.CInvoiceMovementDebitCC
vhBufferQCInvoiceMovement::CInvoiceMovementCreditCC = tQCInvoiceMovementToCreate.CInvoiceMovementCreditCC
vhBufferQCInvoiceMovement::CInvoiceMovementVatDebLC = tQCInvoiceMovementToCreate.CInvoiceMovementVatDebLC
vhBufferQCInvoiceMovement::CInvoiceMovementVatCredLC = tQCInvoiceMovementToCreate.CInvoiceMovementVatCredLC
vhBufferQCInvoiceMovement::CInvoiceMovementVatDebTC = tQCInvoiceMovementToCreate.CInvoiceMovementVatDebTC
vhBufferQCInvoiceMovement::CInvoiceMovementVatCredTC = tQCInvoiceMovementToCreate.CInvoiceMovementVatCredTC
vhBufferQCInvoiceMovement::CInvoiceMovementVatDebCC = tQCInvoiceMovementToCreate.CInvoiceMovementVatDebCC
vhBufferQCInvoiceMovement::CInvoiceMovementVatCredCC = tQCInvoiceMovementToCreate.CInvoiceMovementVatCredCC
vhBufferQCInvoiceMovement::CInvoiceMovementIsInvoice = tQCInvoiceMovementToCreate.CInvoiceMovementIsInvoice
vhBufferQCInvoiceMovement::CInvoiceMovementIsCreditN = tQCInvoiceMovementToCreate.CInvoiceMovementIsCreditN
vhBufferQCInvoiceMovement::CInvoiceMovementType = tQCInvoiceMovementToCreate.CInvoiceMovementType
vhBufferQCInvoiceMovement::CInvoiceMovementInfo = tQCInvoiceMovementToCreate.CInvoiceMovementInfo
vhBufferQCInvoiceMovement::MovementYearPeriod = tQCInvoiceMovementToCreate.MovementYearPeriod
vhBufferQCInvoiceMovement::Company_ID = tQCInvoiceMovementToCreate.Company_ID
vhBufferQCInvoiceMovement::Currency_ID = tQCInvoiceMovementToCreate.Currency_ID
vhBufferQCInvoiceMovement::Creditor_ID = tQCInvoiceMovementToCreate.Creditor_ID
vhBufferQCInvoiceMovement::Period_ID = tQCInvoiceMovementToCreate.Period_ID
vhBufferQCInvoiceMovement::GL_ID = tQCInvoiceMovementToCreate.GL_ID
vhBufferQCInvoiceMovement::Division_ID = tQCInvoiceMovementToCreate.Division_ID
vhBufferQCInvoiceMovement::Project_ID = tQCInvoiceMovementToCreate.Project_ID
vhBufferQCInvoiceMovement::CostCentre_ID = tQCInvoiceMovementToCreate.CostCentre_ID
vhBufferQCInvoiceMovement::Journal_ID = tQCInvoiceMovementToCreate.Journal_ID.
vhBufferQCInvoiceMovement:Buffer-Release().
End. /* For each tQCInvoiceMovementToCreate where */
/* ================================================================================================== */
/* Empty the temp-tables as they are no longer needed and thus only increase the size of the instance */
/* ================================================================================================== */
empty temp-table tQCInvoiceMovementToCreate.
/* =============== */
/* Finally actions */
/* =============== */
finally:
if vhBufferQCInvoiceMovement <> ?
then vhBufferQCInvoiceMovement:buffer-release().
Delete Object vhBufferQCInvoiceMovement no-error.
end finally.