YTD Fees for loans on a statement come from file LNFEES. That file is updated as part of EOD for the sole purpose of printing of YTD and Period Fees totals on statements as per Reg Z.  The LNFEES file has a bucket for each month for totaling all fees; it also has a YTD Fees bucket. 

For credit cards, Reg. Z fees are split out on the statement at the time the statement is created.  Fee transactions are identified based on the criteria outlined below, and the YTD Fees and YTD Interest totals are calculated on the fly at statement print time based on the data in file CRDDTL.  The CRDDTL file is updated whenever a Credit Card transaction posts.
 
Transactions are considered fees based on the following selection when looking at the TRANS record:

Tran Code = 53 and (Tran Type = 68 or 38 or 60 or 51 or 52 or 50)
(An example of Type 38 would be NSF fees.  Types 50, 51, 52 are usually Insurance/Debt protection.  Type 60 is Delinquency/Late Fines.  And examples of Type 68 are Phone Transfer and Foreign Conversion Fees on credit card loans.)

or

Tran Code = 23 and (Tran Type = 60 or 51 or 52 or 50)
Types 50, 51, 52 are ususally Insurance/Debt protection, and Type 60 is Delinquency/Late Fines.

or

Tran Code  = 52 and Tran Type = 17 and Tran Description = 'FOREIGN CUR CON FEE' 

or

Tran Code = 53 and Tran Type = 2 and the first 7 characters of Tran Description NOT = 'FIN CHG'
(Usually Cash Advance Fees on Credit Card loans.)

 

NOTE: There is currently no mechanism to manually remove fees from the LNFEES file (such as if you refund a fee via a manual account adjustment), nor any technique for manually adding miscellaneous fees to the tally that appears on member statements.