project QadFinancials > class BExpenseNote > method InitialValues

Description

Add code here to initialize the calculated fields of a 'new' record (= a record that must be created in the application database) in a class temp-table.


Parameters


icTableNameinputcharacterName of the database table of which a record is created in the class temp-table.
oiReturnStatusoutputinteger


Internal usage


unused


program code (program/bexpensenote.p)

define buffer bExpNoteLine for tExpNoteLine.
<ANCESTOR-CODE>

if icTableName = "ExpNote":U
then do:
    assign tExpNote.Company_ID        = viCompanyId
           tExpNote.ExpNoteYear       = year(today)
           tExpNote.ExpNoteStatusCode = {&EXPENSENOTESTATUS-OPEN}.
     
    assign vhFcComponent = ?.
    
    <M-3 run GetNumber
       (input  viCompanyId (iiCompanyId), 
        input  tExpNote.ExpNoteYear (iiNumbrYear), 
        input  'EXPNOTE':U (icNumbrType), 
        output tExpNote.ExpNoteNumber (oiNumber), 
        input  viFcCurrentInstanceId (iiInstanceId), 
        input  vcFcComponentName (icClassName), 
        output viFcReturnSuper (oiReturnStatus)) in BNumber>    
    if viFcReturnSuper <> 0
    then do:
        assign vcMessage = trim(subst(#T-5'The systen cannot retrieve the expense note number (error number: &1).':255(1899)t-5#, string(viFcReturnSuper))).
        <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-2384':U (icFcMsgNumber),
                     input  '' (icFcExplanation),
                     input  '' (icFcIdentification),
                     input  '' (icFcContext),
                     output viFcReturnSuper (oiReturnStatus)) in BExpenseNote>
    end.
    if not can-do(vcExpenseNoteCommitNumber,tExpNote.tc_Rowid)
    then assign vcExpenseNoteCommitNumber = vcExpenseNoteCommitNumber + ",":U + tExpNote.tc_Rowid.
end.

if icTableName = "ExpNoteLine":U
then do:
    assign tExpNoteLine.tcCurrencyCode = vcCompanyLC
           tExpNoteLine.ExpNoteLineLCRate  = 1
           tExpNoteLine.ExpNoteLineLCScale = 1
           tExpNoteLine.ExpNoteLineType    = {&EXPENSENOTELINETYPE-DEDUCTIBLE}
           tExpNoteLine.tlGLIsDivisionAccount = true.
    assign viSeq = 1.
    for each bExpNoteLine where bExpNoteLine.ExpNote_ID = tExpNoteLine.ExpNote_ID:
       if bExpNoteLine.ExpNoteLineSequence >= viSeq
       then assign viSeq = bExpNoteLine.ExpNoteLineSequence + 1.
    end.
    assign tExpNoteLine.ExpNoteLineSequence = viSeq.
end.