Description
Validates that in modify mode that the only field that can be modified is the description field
Parameters
oiReturnStatus | output | integer | |
Internal usage
unused
program code (program/bopenitemadjustment.p)
/* ============================================================= */
/* Avoid having NULL values in field belonging to a unique index */
/* ============================================================= */
for each t_sOIAdjustLn where
t_sOIAdjustLn.tc_Status = "N":U or
t_sOIAdjustLn.tc_Status = "C":U :
if t_sOIAdjustLn.CInvoice_ID = ?
then assign t_sOIAdjustLn.CInvoice_ID = 0.
if t_sOIAdjustLn.DInvoice_ID = ?
then assign t_sOIAdjustLn.DInvoice_ID = 0.
if t_sOIAdjustLn.JournalEntryPostingLine_ID = ?
then assign t_sOIAdjustLn.JournalEntryPostingLine_ID = 0.
end. /* for each t_sOIAdjustLn where */
/* ======================================================================= */
/* Any Invoices with NoAllocatin Status and whose SIREC is not knocked off */
/* ======================================================================= */
for each t_sOIAdjustLn where
t_sOIAdjustLn.CInvoice_ID <> 0 and
(t_sOIAdjustLn.tc_Status = "N":U or
t_sOIAdjustLn.tc_Status = "C":U) and
(t_sOIAdjustLn.OIAdjustLnInvType = {&INVOICETYPE-INVOICE} or
t_sOIAdjustLn.OIAdjustLnInvType = {&INVOICETYPE-INVOICECORRECTION} or
t_sOIAdjustLn.OIAdjustLnInvType = {&INVOICETYPE-CREDITNOTE} or
t_sOIAdjustLn.OIAdjustLnInvType = {&INVOICETYPE-CREDITNOTECORRECTION})
break by t_sOIAdjustLn.OIAdjustLnInvCompanyCode :
if first-of(t_sOIAdjustLn.OIAdjustLnInvCompanyCode)
then do:
<Q-72 run CompanyPrim (all) (Read) (NoCache)
(input ?, (LookupCompanyId)
input t_sOIAdjustLn.OIAdjustLnInvCompanyCode, (CompanyCode)
output dataset tqCompanyPrim) in BCompany>
find tqCompanyPrim where
tqCompanyPrim.tcCompanyCode = t_sOIAdjustLn.OIAdjustLnInvCompanyCode
no-lock no-error.
if available tqCompanyPrim and tqCompanyPrim.tiCompany_ID <> 0
then assign viOIAdjLnCompanyID = tqCompanyPrim.tiCompany_ID.
end. /*if first-of(OIAdjustLnInvCompanyCode)*/
<Q-50 run CInvoiceByIDForNoAllocation (all) (Read) (NoCache)
(input viOIAdjLNCompanyID, (CompanyId)
input {&ALLOCSTATUS-NOALLOC}, (CInvoiceAllocationStatus)
input t_sOIAdjustLn.CInvoice_ID, (CInvoiceID)
output dataset tqCInvoiceByIDForNoAllocation) in BCInvoice>
for each tqCInvoiceByIDForNoAllocation where
tqCInvoiceByIDForNoAllocation.tiCompany_ID = viOIAdjLNCompanyID and
tqCInvoiceByIDForNoAllocation.tcCInvoiceAllocationStatus = {&ALLOCSTATUS-NOALLOC} and
tqCInvoiceByIDForNoAllocation.tiCInvoice_ID = t_sOIAdjustLn.CInvoice_ID
no-lock:
assign
vdSIRECCreditCC = vdSIRECCreditCC + tqCInvoiceByIDForNoAllocation.tdPostingLineCreditCC
vdSIRECCreditLC = vdSIRECCreditLC + tqCInvoiceByIDForNoAllocation.tdPostingLineCreditLC
vdSIRECCreditTC = vdSIRECCreditTC + tqCInvoiceByIDForNoAllocation.tdPostingLineCreditTC
vdSIRECDebitCC = vdSIRECDebitCC + tqCInvoiceByIDForNoAllocation.tdPostingLineDebitCC
vdSIRECDebitLC = vdSIRECDebitLC + tqCInvoiceByIDForNoAllocation.tdPostingLineDebitLC
vdSIRECDebitTC = vdSIRECDebitTC + tqCInvoiceByIDForNoAllocation.tdPostingLineDebitTC.
end. /* for each tqCInvoiceByIDForNoAllocation no-lock: */
if last-of(t_sOIAdjustLn.OIAdjustLnInvCompanyCode)
then assign viOIAdjLNCompanyID = 0.
end. /* for each t_sOIAdjsutLn where ... */
if vdSIRECCreditCC <> vdSIRECDebitCC or
vdSIRECCreditLC <> vdSIRECDebitLC or
vdSIRECCreditTC <> vdSIRECDebitTC
then do:
assign
vcMessage = substitute(trim(#T-2'Supplier Invoice(s) with No Allocation status is selected. SIREC account must be balanced for such invoice(s) to be adjusted.':255(332443902)T-2# ) + chr(10) + chr(10)
+ trim(#T-42'Sum of SIREC Credit(Transaction Currency) = &1':255(248947128)T-42#) + chr(10)
+ trim(#T-13'Sum of SIREC Credit(Base Currency) = &2':255(155331613)T-13#) + chr(10)
+ trim(#T-23'Sum of SIREC Credit(Statutory Currency) = &3':255(111884128)T-23#) + chr(10)
+ trim(#T-24'Sum of SIREC Debit(Transaction Currency) = &4':255(991690795)T-24#) + chr(10)
+ trim(#T-19'Sum of SIREC Debit(Base Currency) = &5':255(961973949)T-19#) + chr(10)
+ trim(#T-10'Sum of SIREC Debit(Statutory Currency) = &6':255(27504830)T-10#),
trim(string(vdSIRECCreditTC,"->>,>>9.99<<")), trim(string(vdSIRECCreditLC,"->>,>>9.99<<")), trim(string(vdSIRECCreditCC,"->>,>>9.99<<")),
trim(string(vdSIRECDebitTC,"->>,>>9.99<<")), trim(string(vdSIRECDebitLC,"->>,>>9.99<<")), trim(string(vdSIRECDebitCC,"->>,>>9.99<<"))).
<M-91 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-659882':U (icFcMsgNumber),
input '':U (icFcExplanation),
input '':U (icFcIdentification),
input '':U (icFcContext),
output oiReturnStatus (oiReturnStatus)) in BOpenItemAdjustment>
assign oiReturnStatus = -1.
return.
end. /* if vdSIRECCreditCC <> vdSIRECDebitCC and ... */
<ANCESTOR-CODE>
/* ensure that the only field that can be modified is the description field */
for each t_sOIAdjust where t_sOIAdjust.tc_status = 'C':U:
find first t_iOIAdjust where t_iOIAdjust.tc_rowid = t_sOIAdjust.tc_rowid no-lock no-error.
if available t_iOIAdjust
then do :
if (t_sOIAdjust.OIAdjust_ID <> t_iOIAdjust.OIAdjust_ID) or
(t_sOIAdjust.Company_ID <> t_iOIAdjust.Company_ID) or
(t_sOIAdjust.Posting_ID <> t_iOIAdjust.Posting_ID) or
(t_sOIAdjust.OIAdjustPostingYear <> t_iOIAdjust.OIAdjustPostingYear) or
(t_sOIAdjust.OIAdjustPostingPeriod <> t_iOIAdjust.OIAdjustPostingPeriod) or
(t_sOIAdjust.OIAdjustPostingJournalCode <> t_iOIAdjust.OIAdjustPostingJournalCode) or
(t_sOIAdjust.OIAdjustPostingVoucher <> t_iOIAdjust.OIAdjustPostingVoucher ) or
(t_sOIAdjust.OIAdjustPostingDate <> t_iOIAdjust.OIAdjustPostingDate ) or
(t_sOIAdjust.OIAdjustPostingJournalType <> t_iOIAdjust.OIAdjustPostingJournalType ) or
(t_sOIAdjust.OIAdjustComment <> t_iOIAdjust.OIAdjustComment)
then do:
assign vcMessage = trim(#T-56'Only Open Item Adjustment Description can be modified with this function. ($1/$2/$3)':255(947697190)T-56#)
oiReturnStatus = -1.
<M-90 run SetMessage
(input vcMessage (icMessage),
input string(t_sOIAdjust.OIAdjustPostingYear) + chr(2) + t_sOIAdjust.OIAdjustPostingJournalCode + chr(2) + string(t_sOIAdjust.OIAdjustPostingVoucher) (icArguments),
input '':U (icFieldName),
input '':U (icFieldValue),
input 'E':U (icType),
input 3 (iiSeverity),
input '' (icRowid),
input 'qadfin-753227':U (icFcMsgNumber),
input '' (icFcExplanation),
input '' (icFcIdentification),
input '' (icFcContext),
output viFcReturnSuper (oiReturnStatus)) in BOpenItemAdjustment>
end. /* if (t_sOIAdjust.OIAdjust_ID */
end. /*if available */
end. /* for each t_sOIAdjust where */