project QadFinancials > class BMfgNumberRangeManagement > method UpdateMfgData

Description

Controls the processing of any update logic that is required when performing a create/modfiy operation on an MFG/PRO business component.
KEEP THE ANCESTOR TAG IN THE DESCENDANTS TO AVOID SCOPING PROBLEMS ON THE RECORD-AVAILABILITY
This method is the place holder for nay update ligic and complex mapping from the financials table to MFG/PRO.


Parameters


icMfgTableNameinputcharacterName of the MFG/PRO table name that is currently being processed. This is used to determine which logic to execute within the method in the cases where one business component maps to multiple tables in MFG/PRO.
icFinancialTableNameinputcharacterName of the Financial table name that is currently being processed. This is used to determine which logic to execute within the method in the cases where one business component has multiple tables that map to MFG/PRO.
ihFinancialDataBufferinputhandle
ihMfgDataBufferinputhandle
icMfgDomaininputcharacter
oiReturnStatusoutputintegerReturn status of the method.


Internal usage


unused


program code (program/bmfgnrm.p)

<ANCESTOR-CODE>

oiReturnStatus = -98.

if available tJournalBook then do:
    if tJournalBook.tc_Status = "C":U then do:
 
        <Q-2 run JournalByJournalIDCodeType (all) (Read) (NoCache)
           (input viCompanyID, (CompanyId)
            input tJournalBook.Journal_ID, (JournalID)
            input tJournalBook.JournalCode, (JournalCode)
            input tJournalBook.JournalTypeCode, (JournalTypeCode)
            output dataset tqJournalByJournalIDCodeType) in BJournal >
        
        for first tqJournalByJournalIDCodeType
            where tqJournalByJournalIDCodeType.tiJournal_ID = tJournalbook.Journal_ID:    
            /* If Daybook Code is inactivated then set the expiry date of the corresponding Number Range Sequence ID */
            /* to the system date */
            if tJournalBook.JournalIsActive = no and
               tqJournalByJournalIDCodeType.tlJournalIsActive <> tJournalBook.JournalIsActive
            then do:
                if available tnr_mstr then
                    assign tnr_mstr.nr_exp_date = today.
            end.
            /* If Daybook Code is activated then set the expiry date of the corresponding Number Range Sequence ID to ? */
            else if tJournalBook.JournalIsActive = yes and
               tqJournalByJournalIDCodeType.tlJournalIsActive <> tJournalBook.JournalIsActive
            then do:
                if available tnr_mstr then
                    assign tnr_mstr.nr_exp_date = ?.
            end.            
        end.
    end.
    else if tJournalBook.tc_Status = "N" then do:
        /* Default the NR year for the sequence to today's year */
        assign vcNrYear = string(year(today)).

        <Q-3 run GLCalendarYrByDateDomain (all) (Read) (NoCache)
           (input icMfgDomain, (DomainCode)
            input today, (Date)
            output dataset tqGLCalendarYrByDateDomain) in BMfgGLCalendar >
        find first tqGLCalendarYrByDateDomain no-error.
        if available tqGLCalendarYrByDateDomain then do:
            <Q-4 run GLCalendarYrStartByDateDomain (all) (Read) (NoCache)
               (input icMfgDomain, (DomainCode)
                input tqGLCalendarYrByDateDomain.tiglc_year, (Year)
                output dataset tqGLCalendarYrStartByDateDomain) in BMfgGLCalendar >
            find first tqGLCalendarYrStartByDateDomain no-error.
            if available tqGLCalendarYrStartByDateDomain then
               assign 
                    vtGLCalendarYearStartDate = tqGLCalendarYrStartByDateDomain.ttglc_start
                    vcNrYear = string(tqGLCalendarYrStartByDateDomain.tiglc_year).
            else
                assign vtGLCalendarYearStartDate = date(1,1,year(today)).    
        end.
        else
            assign vtGLCalendarYearStartDate = date(1,1,year(today)).       
        
        assign
            tnr_mstr.nr_dataset       = "Sequence ID":U
            tnr_mstr.nr_internal      = yes
            tnr_mstr.nr_allow_discard = no
            tnr_mstr.nr_effdate       = vtGLCalendarYearStartDate
            tnr_mstr.nr_exp_date      = ?
            tnr_mstr.nr_seg_min       = ",,,000000001,":U
            tnr_mstr.nr_seg_max       = ",,,999999999,":U
            tnr_mstr.nr_seg_ini       = ",,,000000001,":U
            tnr_mstr.nr_seg_reset     = ",,,000000001,":U
            tnr_mstr.nr_seg_type      = "3,4,4,1,":U
            tnr_mstr.nr_seg_format    = "Y,,,999999999,":U
            tnr_mstr.nr_segcount      = 4
            tnr_mstr.nr_seg_rank      = "0,3,3,2,":U
            tnr_mstr.nr_seg_value     = vcNrYear 
                                      + ",/,":U 
                                      + tnr_mstr.nr_seqid 
                                      + ",000000001":U.
    end.                                      
end.

if oiReturnStatus = -98 then
    assign oiReturnStatus = 0.