project QadFinancials > class BVATPeriod > method DataNewMultipleCopyYear
Description
Method that allows the creation of a new vat year based on another existing vat or accounting year
Parameters
iiVatYear | input | integer | the VAT Year that you want to create |
ilIsVATYear | input | logical | Do you want to copy from a VAT Year of from an Accounting Year ? True = VAT Year, False = Accounting Year |
iiCopyYear | input | integer | the Accounting year or the VAT year where you want to copy from |
oiReturnStatus | output | integer | Return status of the method. |
Internal usage
unused
program code (program1/bvatperiod.p)
if iiVatYear = 0
then do:
assign vcMessage = trim(#T-20'Enter the tax year you want to create.':255(3861)T-20#)
oiReturnStatus = -1.
<M-1 run SetMessage (input vcMessage (icMessage),
input '':U (icArguments),
input '':U (icFieldName),
input '':U (icFieldValue),
input 'E':U (icType),
input 3 (iiSeverity),
input '':U (icRowid),
input 'QADFIN-217':U (icFcMsgNumber),
input '' (icFcExplanation),
input '' (icFcIdentification),
input '' (icFcContext),
output viFcReturnSuper (oiReturnStatus)) in BVATPeriod>
return.
end.
if iiCopyYear = 0
then do:
assign vcMessage = trim(#T-21'Select the year you want to copy.':255(3862)t-21#)
oiReturnStatus = -1.
<M-2 run SetMessage (input vcMessage (icMessage),
input '':U (icArguments),
input '':U (icFieldName),
input '':U (icFieldValue),
input 'E':U (icType),
input 3 (iiSeverity),
input '':U (icRowid),
input 'QADFIN-218':U (icFcMsgNumber),
input '' (icFcExplanation),
input '' (icFcIdentification),
input '' (icFcContext),
output viFcReturnSuper (oiReturnStatus)) in BVATPeriod>
return.
end.
if ilIsVATYear
then do:
<Q-12 assign vlFcQueryRecordsAvailable = VatPeriodByVatYearPeriod (NoCache)
(input viCompanyId, (CompanyId)
input iiCopyYear, (VatPeriodYear)
input ?, (VatPeriodPeriod)) in BVATPeriod >
if not vlFcQueryRecordsAvailable
then do:
assign vcMessage = trim(#T-22'The tax year you want to copy is not defined in the system.':255(3863)t-22#)
oiReturnStatus = -1.
<M-13 run SetMessage (input vcMessage (icMessage),
input '':U (icArguments),
input '':U (icFieldName),
input '':U (icFieldValue),
input 'E':U (icType),
input 3 (iiSeverity),
input '':U (icRowid),
input 'QADFIN-266':U (icFcMsgNumber),
input '' (icFcExplanation),
input '' (icFcIdentification),
input '' (icFcContext),
output viFcReturnSuper (oiReturnStatus)) in BVATPeriod>
return.
end.
end.
else do:
<Q-3 assign vlFcQueryRecordsAvailable = PeriodByYearPeriod (NoCache)
(input viCompanyId, (CompanyId)
input iiCopyYear, (PeriodYear)
input ?, (PeriodPeriod)
input ?, (PeriodId)) in BPeriod >
if not vlFcQueryRecordsAvailable
then do:
assign vcMessage = trim(#T-23'The GL calendar year you want to copy does not exist.':255(3095)T-23#)
oiReturnStatus = -1.
<M-4 run SetMessage (input vcMessage (icMessage),
input '':U (icArguments),
input '':U (icFieldName),
input '':U (icFieldValue),
input 'E':U (icType),
input 3 (iiSeverity),
input '':U (icRowid),
input 'QADFIN-219':U (icFcMsgNumber),
input '' (icFcExplanation),
input '' (icFcIdentification),
input '' (icFcContext),
output viFcReturnSuper (oiReturnStatus)) in BVATPeriod>
return.
end.
end.
<M-7 run ClearData (output viFcReturnSuper (oiReturnStatus)) in BVATPeriod>
if viFcReturnSuper <> 0
then do:
assign oiReturnStatus = viFcReturnSuper.
return.
end.
if ilIsVATYear
then do:
<Q-14 run VatPeriodByVatYearPeriod (all) (Read) (NoCache)
(input viCompanyId, (CompanyId)
input iiCopyYear, (VatPeriodYear)
input ?, (VatPeriodPeriod)
output dataset tqVatPeriodByVatYearPeriod) in BVATPeriod >
for each tqVatPeriodByVatYearPeriod where
tqVatPeriodByVatYearPeriod.tiCompany_ID = viCompanyId and
tqVatPeriodByVatYearPeriod.tiVatPeriodYear = iiCopyYear:
<M-15 run AddDetailLine (input 'VatPeriod':U (icTable),
input '':U (icParentRowid),
output viFcReturnSuper (oiReturnStatus)) in BVATPeriod>
if viFcReturnSuper <> 0
then do:
assign oiReturnStatus = viFcReturnSuper.
return.
end.
assign tVatPeriod.VatPeriodYear = iiVatYear
tVatPeriod.VatPeriodPeriod = tqVatPeriodByVatYearPeriod.tiVatPeriodPeriod
tVatPeriod.VatPeriodYearPeriod = (iiVatYear * 100) + tqVatPeriodByVatYearPeriod.tiVatPeriodPeriod
tVatPeriod.VatPeriodStartDate = <M-16 GetDate (input tqVatPeriodByVatYearPeriod.ttVatPeriodStartDate (itDate),
input iiCopyYear (iiOldYear),
input iiVatYear (iiNewYear)) in BVATPeriod>
tVatPeriod.VatPeriodEndDate = <M-17 GetDate (input tqVatPeriodByVatYearPeriod.ttVatPeriodEndDate (itDate),
input iiCopyYear (iiOldYear),
input iiVatYear (iiNewYear)) in BVATPeriod>
tVatPeriod.VatPeriodStatus = {&VATPERIODSTATUS-OPEN}.
end.
end.
else do:
<Q-8 run PeriodByYearPeriod (all) (Read) (NoCache)
(input viCompanyId, (CompanyId)
input iiCopyYear, (PeriodYear)
input ?, (PeriodPeriod)
input ?, (PeriodId)
output dataset tqPeriodByYearPeriod) in BPeriod >
for each tqPeriodByYearPeriod where
tqPeriodByYearPeriod.tiCompany_ID = viCompanyId and
tqPeriodByYearPeriod.tiPeriodYear = iiCopyYear and
tqPeriodByYearPeriod.tcPeriodTypeCode <> {&PERIODTYPECODE-CORRECTION}:
<M-9 run AddDetailLine (input 'VatPeriod':U (icTable),
input '':U (icParentRowid),
output viFcReturnSuper (oiReturnStatus)) in BVATPeriod>
if viFcReturnSuper <> 0
then do:
assign oiReturnStatus = viFcReturnSuper.
return.
end.
assign tVatPeriod.VatPeriodYear = iiVatYear
tVatPeriod.VatPeriodPeriod = tqPeriodByYearPeriod.tiPeriodPeriod
tVatPeriod.VatPeriodYearPeriod = (iiVatYear * 100) + tqPeriodByYearPeriod.tiPeriodPeriod
tVatPeriod.VatPeriodStartDate = <M-18 GetDate (input tqPeriodByYearPeriod.ttPeriodStartDate (itDate),
input iiCopyYear (iiOldYear),
input iiVatYear (iiNewYear)) in BVATPeriod>
tVatPeriod.VatPeriodEndDate = <M-19 GetDate (input tqPeriodByYearPeriod.ttPeriodEndDate (itDate),
input iiCopyYear (iiOldYear),
input iiVatYear (iiNewYear)) in BVATPeriod>
tVatPeriod.VatPeriodStatus = {&VATPERIODSTATUS-OPEN}.
end.
end.