Source Code Cross Referenced for BalanceForwardRuleHelper.java in  » ERP-CRM-Financial » Kuali-Financial-System » org » kuali » module » gl » batch » closing » year » service » impl » helper » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » ERP CRM Financial » Kuali Financial System » org.kuali.module.gl.batch.closing.year.service.impl.helper 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


0001:        /*
0002:         * Copyright 2006-2007 The Kuali Foundation.
0003:         * 
0004:         * Licensed under the Educational Community License, Version 1.0 (the "License");
0005:         * you may not use this file except in compliance with the License.
0006:         * You may obtain a copy of the License at
0007:         * 
0008:         * http://www.opensource.org/licenses/ecl1.php
0009:         * 
0010:         * Unless required by applicable law or agreed to in writing, software
0011:         * distributed under the License is distributed on an "AS IS" BASIS,
0012:         * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
0013:         * See the License for the specific language governing permissions and
0014:         * limitations under the License.
0015:         */
0016:        package org.kuali.module.gl.batch.closing.year.service.impl.helper;
0017:
0018:        import java.sql.Date;
0019:        import java.util.HashMap;
0020:        import java.util.Map;
0021:
0022:        import org.kuali.core.util.KualiDecimal;
0023:        import org.kuali.core.util.ObjectUtils;
0024:        import org.kuali.kfs.KFSConstants;
0025:        import org.kuali.kfs.bo.Options;
0026:        import org.kuali.kfs.context.SpringContext;
0027:        import org.kuali.kfs.service.OptionsService;
0028:        import org.kuali.kfs.service.ParameterService;
0029:        import org.kuali.kfs.service.impl.ParameterConstants;
0030:        import org.kuali.module.chart.bo.codes.BalanceTyp;
0031:        import org.kuali.module.chart.service.BalanceTypService;
0032:        import org.kuali.module.chart.service.PriorYearAccountService;
0033:        import org.kuali.module.chart.service.SubFundGroupService;
0034:        import org.kuali.module.financial.exceptions.InvalidFlexibleOffsetException;
0035:        import org.kuali.module.financial.service.FlexibleOffsetAccountService;
0036:        import org.kuali.module.gl.bo.Balance;
0037:        import org.kuali.module.gl.bo.OriginEntryFull;
0038:        import org.kuali.module.gl.bo.OriginEntryGroup;
0039:        import org.kuali.module.gl.service.OriginEntryService;
0040:        import org.kuali.module.gl.util.FatalErrorException;
0041:        import org.kuali.module.gl.util.NonFatalErrorException;
0042:        import org.kuali.module.gl.util.ObjectHelper;
0043:
0044:        /**
0045:         * A class to hold significant state for a balance forward job; it also has the methods that actually accomplish the job
0046:         */
0047:        public class BalanceForwardRuleHelper {
0048:
0049:            private static org.apache.log4j.Logger LOG = org.apache.log4j.Logger
0050:                    .getLogger(BalanceForwardRuleHelper.class);
0051:            private FlexibleOffsetAccountService flexibleOffsetAccountService;
0052:
0053:            /**
0054:             * A container for the state of the balance forward process. The way state is handled is heavily dependent upon the way in which
0055:             * YearEndServiceImpl.forwardBalancesForFiscalYear works.
0056:             */
0057:            public static class BalanceForwardProcessState {
0058:                private int globalReadCount;
0059:                private int globalSelectCount;
0060:                private int sequenceNumber;
0061:                private int sequenceClosedCount;
0062:                private int sequenceWriteCount;
0063:                private String accountNumberHold;
0064:                private int nonFatalCount;
0065:
0066:                public String getAccountNumberHold() {
0067:                    return accountNumberHold;
0068:                }
0069:
0070:                public void setAccountNumberHold(String accountNumberHold) {
0071:                    this .accountNumberHold = accountNumberHold;
0072:                }
0073:
0074:                public void incrementGlobalReadCount() {
0075:                    globalReadCount++;
0076:                }
0077:
0078:                public void incrementGlobalSelectCount() {
0079:                    globalSelectCount++;
0080:                }
0081:
0082:                public void incrementSequenceNumber() {
0083:                    sequenceNumber++;
0084:                }
0085:
0086:                public void incrementSequenceClosedCount() {
0087:                    sequenceClosedCount++;
0088:                }
0089:
0090:                public void incrementSequenceWriteCount() {
0091:                    sequenceWriteCount++;
0092:                }
0093:
0094:                public void incrementNonFatalCount() {
0095:                    nonFatalCount += 1;
0096:                }
0097:
0098:                public int getGlobalReadCount() {
0099:                    return globalReadCount;
0100:                }
0101:
0102:                public void setGlobalReadCount(int globalReadCount) {
0103:                    this .globalReadCount = globalReadCount;
0104:                }
0105:
0106:                public int getGlobalSelectCount() {
0107:                    return globalSelectCount;
0108:                }
0109:
0110:                public void setGlobalSelectCount(int globalSelectCount) {
0111:                    this .globalSelectCount = globalSelectCount;
0112:                }
0113:
0114:                public int getSequenceClosedCount() {
0115:                    return sequenceClosedCount;
0116:                }
0117:
0118:                public int getNonFatalCount() {
0119:                    return nonFatalCount;
0120:                }
0121:
0122:                public void setSequenceClosedCount(int sequenceClosedCount) {
0123:                    this .sequenceClosedCount = sequenceClosedCount;
0124:                }
0125:
0126:                public int getSequenceNumber() {
0127:                    return sequenceNumber;
0128:                }
0129:
0130:                public void setSequenceNumber(int sequenceNumber) {
0131:                    this .sequenceNumber = sequenceNumber;
0132:                }
0133:
0134:                public int getSequenceWriteCount() {
0135:                    return sequenceWriteCount;
0136:                }
0137:
0138:                public void setSequenceWriteCount(int sequenceWriteCount) {
0139:                    this .sequenceWriteCount = sequenceWriteCount;
0140:                }
0141:
0142:                public void setNonFatalCount(int nonFatalCount) {
0143:                    this .nonFatalCount = nonFatalCount;
0144:                }
0145:            }
0146:
0147:            private Integer closingFiscalYear;
0148:            private Date transactionDate;
0149:
0150:            private OriginEntryGroup closedPriorYearAccountGroup;
0151:            private OriginEntryGroup unclosedPriorYearAccountGroup;
0152:
0153:            private PriorYearAccountService priorYearAccountService;
0154:            private SubFundGroupService subFundGroupService;
0155:            private OriginEntryService originEntryService;
0156:            private ParameterService parameterService;
0157:            private Options currentYearOptions;
0158:            private String[] priorYearAccountObjectTypes;
0159:            private String[] generalSwObjectTypes;
0160:            private String annualClosingDocType;
0161:            private String glOriginationCode;
0162:            private Map<String, Boolean> balanceTypeEncumbranceIndicators;
0163:
0164:            private BalanceForwardProcessState state;
0165:
0166:            /**
0167:             * Constructs a BalanceForwardRuleHelper
0168:             */
0169:            public BalanceForwardRuleHelper() {
0170:                super ();
0171:                state = new BalanceForwardProcessState();
0172:                flexibleOffsetAccountService = SpringContext
0173:                        .getBean(FlexibleOffsetAccountService.class);
0174:                parameterService = SpringContext
0175:                        .getBean(ParameterService.class);
0176:                annualClosingDocType = parameterService
0177:                        .getParameterValue(
0178:                                ParameterConstants.GENERAL_LEDGER_BATCH.class,
0179:                                KFSConstants.SystemGroupParameterNames.GL_ANNUAL_CLOSING_DOC_TYPE);
0180:                glOriginationCode = parameterService
0181:                        .getParameterValue(
0182:                                ParameterConstants.GENERAL_LEDGER_BATCH.class,
0183:                                KFSConstants.SystemGroupParameterNames.GL_ORIGINATION_CODE);
0184:
0185:            }
0186:
0187:            /**
0188:             * Constructs a BalanceForwardRuleHelper, using a fiscal year. This also initializes object type arrays based on the options of
0189:             * the closing fiscal year
0190:             * 
0191:             * @param closingFiscalYear the fiscal year that is closing out
0192:             */
0193:            public BalanceForwardRuleHelper(Integer closingFiscalYear) {
0194:                this ();
0195:                setClosingFiscalYear(closingFiscalYear);
0196:
0197:                Options jobYearRunOptions = SpringContext.getBean(
0198:                        OptionsService.class).getOptions(closingFiscalYear);
0199:
0200:                generalSwObjectTypes = new String[3];
0201:                generalSwObjectTypes[0] = jobYearRunOptions
0202:                        .getFinancialObjectTypeAssetsCd();
0203:                generalSwObjectTypes[1] = jobYearRunOptions
0204:                        .getFinObjectTypeLiabilitiesCode();
0205:                generalSwObjectTypes[2] = jobYearRunOptions
0206:                        .getFinObjectTypeFundBalanceCd();
0207:
0208:                // "EE", "ES", "EX", "IC", "TE", "TI", "IN", "CH"
0209:                priorYearAccountObjectTypes = new String[8];
0210:                priorYearAccountObjectTypes[0] = jobYearRunOptions
0211:                        .getFinObjTypeExpendNotExpCode();
0212:                priorYearAccountObjectTypes[1] = jobYearRunOptions
0213:                        .getFinObjTypeExpNotExpendCode();
0214:                priorYearAccountObjectTypes[2] = jobYearRunOptions
0215:                        .getFinObjTypeExpenditureexpCd();
0216:                priorYearAccountObjectTypes[3] = jobYearRunOptions
0217:                        .getFinObjTypeIncomeNotCashCd();
0218:                priorYearAccountObjectTypes[4] = jobYearRunOptions
0219:                        .getFinancialObjectTypeTransferExpenseCd();
0220:                priorYearAccountObjectTypes[5] = jobYearRunOptions
0221:                        .getFinancialObjectTypeTransferIncomeCd();
0222:                priorYearAccountObjectTypes[6] = jobYearRunOptions
0223:                        .getFinObjectTypeIncomecashCode();
0224:                priorYearAccountObjectTypes[7] = jobYearRunOptions
0225:                        .getFinObjTypeCshNotIncomeCd();
0226:            }
0227:
0228:            /**
0229:             * Constructs a BalanceForwardRuleHelper, but this one goes whole hog: initializes all of the relevant parameters and the
0230:             * balance types to process
0231:             * 
0232:             * @param closingFiscalYear the fiscal year to close
0233:             * @param transactionDate the date this job is being run
0234:             * @param closedPriorYearAccountGroup the group to put balance forwarding origin entries with closed accounts into
0235:             * @param unclosedPriorYearAccountGroup the group to put balance forwarding origin entries with open accounts into
0236:             */
0237:            public BalanceForwardRuleHelper(Integer closingFiscalYear,
0238:                    Date transactionDate,
0239:                    OriginEntryGroup closedPriorYearAccountGroup,
0240:                    OriginEntryGroup unclosedPriorYearAccountGroup) {
0241:                this (closingFiscalYear);
0242:                setTransactionDate(transactionDate);
0243:                setClosingFiscalYear(closingFiscalYear);
0244:                setClosedPriorYearAccountGroup(closedPriorYearAccountGroup);
0245:                setUnclosedPriorYearAccountGroup(unclosedPriorYearAccountGroup);
0246:                currentYearOptions = SpringContext
0247:                        .getBean(OptionsService.class).getCurrentYearOptions();
0248:
0249:                balanceTypeEncumbranceIndicators = new HashMap<String, Boolean>();
0250:                for (Object balanceTypAsObj : SpringContext.getBean(
0251:                        BalanceTypService.class).getAllBalanceTyps()) {
0252:                    BalanceTyp balanceType = (BalanceTyp) balanceTypAsObj;
0253:                    balanceTypeEncumbranceIndicators
0254:                            .put(
0255:                                    balanceType.getCode(),
0256:                                    (balanceType
0257:                                            .isFinBalanceTypeEncumIndicator() ? Boolean.TRUE
0258:                                            : Boolean.FALSE));
0259:                }
0260:            }
0261:
0262:            /**
0263:             * The balance to create a general balance forward origin entry for
0264:             * 
0265:             * @param balance a balance to create an origin entry for
0266:             * @param closedPriorYearAccountGroup the group to put balance forwarding origin entries with closed accounts into
0267:             * @param unclosedPriorYearAccountGroup the group to put balance forwarding origin entries with open accounts into
0268:             * @throws FatalErrorException
0269:             */
0270:            public void processGeneralForwardBalance(Balance balance,
0271:                    OriginEntryGroup closedPriorYearAccountGroup,
0272:                    OriginEntryGroup unclosedPriorYearAccountGroup)
0273:                    throws FatalErrorException {
0274:                if (ObjectUtils.isNull(balance.getPriorYearAccount())) {
0275:                    throw new FatalErrorException(
0276:                            "COULD NOT RETRIEVE INFORMATION ON ACCOUNT "
0277:                                    + balance.getChartOfAccountsCode() + "-"
0278:                                    + balance.getAccountNumber());
0279:                }
0280:
0281:                if ((null == balance.getAccountNumber() && null == state
0282:                        .getAccountNumberHold())
0283:                        || (null != balance.getAccountNumber() && balance
0284:                                .getAccountNumber().equals(
0285:                                        state.getAccountNumberHold()))) {
0286:
0287:                    // 954 004770 ADD 1 TO WS-SEQ-NBR
0288:
0289:                    state.incrementSequenceNumber();
0290:
0291:                    // 955 004780 ELSE
0292:
0293:                } else {
0294:
0295:                    // 956 004790 MOVE 1 TO WS-SEQ-NBR.
0296:
0297:                    state.setSequenceNumber(1);
0298:
0299:                }
0300:
0301:                state.incrementGlobalSelectCount();
0302:
0303:                OriginEntryFull entry = generateGeneralForwardOriginEntry(balance);
0304:                saveForwardingEntry(balance, entry,
0305:                        closedPriorYearAccountGroup,
0306:                        unclosedPriorYearAccountGroup);
0307:            }
0308:
0309:            /**
0310:             * This method creates an origin entry for a cumulative balance forward and saves it in its proper origin entry group
0311:             * 
0312:             * @param balance a balance which needs to have a cumulative origin entry generated for it
0313:             * @param closedPriorYearAccountGroup the origin entry group where forwarding origin entries with closed prior year accounts go
0314:             * @param unclosedPriorYearAcocuntGroup the origin entry group where forwarding origin entries with open prior year accounts go
0315:             */
0316:            public void processCumulativeForwardBalance(Balance balance,
0317:                    OriginEntryGroup closedPriorYearAccountGroup,
0318:                    OriginEntryGroup unclosedPriorYearAccountGroup) {
0319:                if ((null == balance.getAccountNumber() && null == state
0320:                        .getAccountNumberHold())
0321:                        || (null != balance.getAccountNumber() && balance
0322:                                .getAccountNumber().equals(
0323:                                        state.getAccountNumberHold()))) {
0324:
0325:                    // 954 004770 ADD 1 TO WS-SEQ-NBR
0326:
0327:                    state.incrementSequenceNumber();
0328:
0329:                    // 955 004780 ELSE
0330:
0331:                } else {
0332:
0333:                    // 956 004790 MOVE 1 TO WS-SEQ-NBR.
0334:
0335:                    state.setSequenceNumber(1);
0336:
0337:                }
0338:
0339:                state.incrementGlobalSelectCount();
0340:
0341:                OriginEntryFull activeEntry = generateCumulativeForwardOriginEntry(balance);
0342:                saveForwardingEntry(balance, activeEntry,
0343:                        closedPriorYearAccountGroup,
0344:                        unclosedPriorYearAccountGroup);
0345:            }
0346:
0347:            /**
0348:             * This method generates an origin entry for a given cumulative balance forward balance
0349:             * 
0350:             * @param balance a balance to foward, cumulative style
0351:             * @return an OriginEntryFull to forward the given balance
0352:             */
0353:            public OriginEntryFull generateCumulativeForwardOriginEntry(
0354:                    Balance balance) {
0355:                // 1220 007470 PERFORM 4200-WRITE-ACTIVE
0356:                // 1221 007480 THRU 4200-WRITE-ACTIVE-EXIT
0357:
0358:                // 1332 008540 4200-WRITE-ACTIVE.
0359:                // 1333 008550 MOVE SPACES TO GLEN-RECORD.
0360:
0361:                OriginEntryFull activeEntry = new OriginEntryFull();
0362:
0363:                // 1334 008560 MOVE WS-UNIV-FISCAL-YR-PLUS-1
0364:                // 1335 008570 TO UNIV-FISCAL-YR OF GLEN-RECORD.
0365:
0366:                activeEntry.setUniversityFiscalYear(new Integer(
0367:                        closingFiscalYear.intValue() + 1));
0368:
0369:                // 1336 008580 MOVE GLGLBL-FIN-COA-CD
0370:                // 1337 008590 TO FIN-COA-CD OF GLEN-RECORD.
0371:
0372:                activeEntry.setChartOfAccountsCode(balance
0373:                        .getChartOfAccountsCode());
0374:
0375:                // 1338 008600 MOVE GLGLBL-ACCOUNT-NBR
0376:                // 1339 008610 TO ACCOUNT-NBR OF GLEN-RECORD.
0377:
0378:                activeEntry.setAccountNumber(balance.getAccountNumber());
0379:
0380:                // 1340 008620 MOVE GLGLBL-SUB-ACCT-NBR
0381:                // 1341 008630 TO SUB-ACCT-NBR OF GLEN-RECORD.
0382:
0383:                activeEntry.setSubAccountNumber(balance.getSubAccountNumber());
0384:
0385:                // 1342 008640 MOVE GLGLBL-FIN-OBJECT-CD
0386:                // 1343 008650 TO FIN-OBJECT-CD OF GLEN-RECORD.
0387:
0388:                activeEntry.setFinancialObjectCode(balance.getObjectCode());
0389:
0390:                // 1344 008660 MOVE GLGLBL-FIN-SUB-OBJ-CD
0391:                // 1345 008670 TO FIN-SUB-OBJ-CD OF GLEN-RECORD.
0392:
0393:                activeEntry.setFinancialSubObjectCode(balance
0394:                        .getSubObjectCode());
0395:
0396:                // 1346 008680 MOVE GLGLBL-FIN-BALANCE-TYP-CD
0397:                // 1347 008690 TO FIN-BALANCE-TYP-CD OF GLEN-RECORD.
0398:
0399:                activeEntry.setFinancialBalanceTypeCode(balance
0400:                        .getBalanceTypeCode());
0401:
0402:                // 1348 008700 MOVE GLGLBL-FIN-OBJ-TYP-CD
0403:                // 1349 008710 TO FIN-OBJ-TYP-CD OF GLEN-RECORD.
0404:
0405:                activeEntry.setFinancialObjectTypeCode(balance
0406:                        .getObjectTypeCode());
0407:
0408:                try {
0409:                    flexibleOffsetAccountService.updateOffset(activeEntry);
0410:                } catch (InvalidFlexibleOffsetException e) {
0411:                    LOG
0412:                            .debug("processBalance() Balance Forward Flexible Offset Error: "
0413:                                    + e.getMessage());
0414:                }
0415:
0416:                // 1350 008720 MOVE 'CB'
0417:                // 1351 008730 TO UNIV-FISCAL-PRD-CD OF GLEN-RECORD.
0418:
0419:                activeEntry
0420:                        .setUniversityFiscalPeriodCode(KFSConstants.PERIOD_CODE_CG_BEGINNING_BALANCE);
0421:
0422:                // 1352 008740 MOVE 'ACLO'
0423:                // 1353 008750 TO FDOC-TYP-CD OF GLEN-RECORD.
0424:
0425:                activeEntry
0426:                        .setFinancialDocumentTypeCode(this .annualClosingDocType);
0427:
0428:                // 1354 008760 MOVE 'MF'
0429:                // 1355 008770 TO FS-ORIGIN-CD OF GLEN-RECORD.
0430:
0431:                activeEntry
0432:                        .setFinancialSystemOriginationCode(this .glOriginationCode);
0433:
0434:                // 1356 008780 STRING 'AC'
0435:                // 1357 008790 GLGLBL-ACCOUNT-NBR
0436:                // 1358 008800 RP-BLANK-LINE
0437:                // 1359 008810 DELIMITED BY SIZE
0438:                // 1360 008820 INTO FDOC-NBR OF GLEN-RECORD.
0439:
0440:                activeEntry.setDocumentNumber(new StringBuffer(
0441:                        KFSConstants.BALANCE_TYPE_ACTUAL).append(
0442:                        balance.getAccountNumber()).toString());
0443:
0444:                // 1361 008830 MOVE WS-SEQ-NBR
0445:                // 1362 008840 TO TRN-ENTR-SEQ-NBR OF GLEN-RECORD.
0446:
0447:                activeEntry
0448:                        .setTransactionLedgerEntrySequenceNumber(new Integer(
0449:                                state.getSequenceNumber()));
0450:
0451:                // 1363 008850 STRING 'BEG C & G BAL BROUGHT FORWARD FROM '
0452:                // 1364 008860 VAR-UNIV-FISCAL-YR
0453:                // 1365 008870 RP-BLANK-LINE
0454:                // 1366 008880 DELIMITED BY SIZE INTO
0455:                // 1367 008890 TRN-LDGR-ENTR-DESC OF GLEN-RECORD.
0456:
0457:                activeEntry
0458:                        .setTransactionLedgerEntryDescription(new StringBuffer(
0459:                                "BEG C & G BAL BROUGHT FORWARD FROM ").append(
0460:                                closingFiscalYear).toString());
0461:
0462:                // 1368 008900 ADD GLGLBL-ACLN-ANNL-BAL-AMT
0463:                // 1369 008910 GLGLBL-CONTR-GR-BB-AC-AMT
0464:                // 1370 008920 GIVING TRN-LDGR-ENTR-AMT OF GLEN-RECORD.
0465:
0466:                activeEntry
0467:                        .setTransactionLedgerEntryAmount(balance
0468:                                .getAccountLineAnnualBalanceAmount()
0469:                                .add(
0470:                                        balance
0471:                                                .getContractsGrantsBeginningBalanceAmount()));
0472:
0473:                // 1371 008930 IF GLGLBL-FIN-BALANCE-TYP-CD = 'CB'
0474:
0475:                if (KFSConstants.BALANCE_TYPE_CURRENT_BUDGET.equals(balance
0476:                        .getBalanceTypeCode())) {
0477:
0478:                    // 1372 008940 MOVE SPACES
0479:                    // 1373 008950 TO TRN-DEBIT-CRDT-CD OF GLEN-RECORD
0480:
0481:                    activeEntry.setTransactionDebitCreditCode(null);
0482:
0483:                    // 1374 008960 ELSE
0484:
0485:                } else {
0486:
0487:                    String wsFinancialObjectTypeDebitCreditCode = null;
0488:
0489:                    try {
0490:                        wsFinancialObjectTypeDebitCreditCode = getFinancialObjectTypeDebitCreditCode(balance);
0491:                    } catch (NonFatalErrorException nfee) {
0492:
0493:                        getState().incrementNonFatalCount();
0494:
0495:                        // 1197 007240 PERFORM 8500-CHECK-NEW-PAGE
0496:                        // 1198 007250 THRU 8500-CHECK-NEW-PAGE-EXIT
0497:                        // 1199 007260 MOVE 'C' TO WS-FIN-OBJTYP-DBCR-CD
0498:
0499:                        wsFinancialObjectTypeDebitCreditCode = KFSConstants.GL_CREDIT_CODE;
0500:
0501:                        LOG.info(nfee.getMessage());
0502:                    }
0503:
0504:                    // 1375 008970 IF TRN-LDGR-ENTR-AMT OF GLEN-RECORD < ZERO
0505:
0506:                    if (activeEntry.getTransactionLedgerEntryAmount()
0507:                            .isNegative()) {
0508:
0509:                        // 1376 008980 IF WS-FIN-OBJTYP-DBCR-CD = 'C'
0510:
0511:                        if (KFSConstants.GL_CREDIT_CODE
0512:                                .equals(wsFinancialObjectTypeDebitCreditCode)) {
0513:
0514:                            // 1377 008990 MOVE 'D'
0515:                            // 1378 009000 TO TRN-DEBIT-CRDT-CD OF GLEN-RECORD
0516:
0517:                            activeEntry
0518:                                    .setTransactionDebitCreditCode(KFSConstants.GL_DEBIT_CODE);
0519:
0520:                            // 1379 009010 ELSE
0521:
0522:                        } else {
0523:
0524:                            // 1380 009020 MOVE 'C'
0525:                            // 1381 009030 TO TRN-DEBIT-CRDT-CD OF GLEN-RECORD
0526:
0527:                            activeEntry
0528:                                    .setTransactionDebitCreditCode(KFSConstants.GL_CREDIT_CODE);
0529:
0530:                        }
0531:
0532:                        // 1382 009040 ELSE
0533:
0534:                    } else {
0535:
0536:                        // 1383 009050 MOVE WS-FIN-OBJTYP-DBCR-CD
0537:                        // 1384 009060 TO TRN-DEBIT-CRDT-CD OF GLEN-RECORD.
0538:
0539:                        activeEntry
0540:                                .setTransactionDebitCreditCode(wsFinancialObjectTypeDebitCreditCode);
0541:
0542:                    }
0543:
0544:                }
0545:
0546:                // 1385 009070 MOVE VAR-TRANSACTION-DT
0547:                // 1386 009080 TO TRANSACTION-DT OF GLEN-RECORD.
0548:
0549:                activeEntry.setTransactionDate(transactionDate);
0550:
0551:                // 1387 009090 MOVE SPACES
0552:                // 1388 009100 TO ORG-DOC-NBR OF GLEN-RECORD.
0553:
0554:                activeEntry.setOrganizationDocumentNumber(null);
0555:
0556:                // 1389 009110 MOVE ALL '-'
0557:                // 1390 009120 TO PROJECT-CD OF GLEN-RECORD.
0558:
0559:                activeEntry.setProjectCode(KFSConstants.getDashProjectCode());
0560:
0561:                // 1391 009130 MOVE SPACES
0562:                // 1392 009140 TO ORG-REFERENCE-ID OF GLEN-RECORD.
0563:
0564:                activeEntry.setOrganizationReferenceId(null);
0565:
0566:                // 1393 009150 MOVE SPACES
0567:                // 1394 009160 TO FDOC-REF-TYP-CD OF GLEN-RECORD.
0568:
0569:                activeEntry.setReferenceFinancialDocumentNumber(null);
0570:
0571:                // 1395 009170 MOVE SPACES
0572:                // 1396 009180 TO FS-REF-ORIGIN-CD OF GLEN-RECORD.
0573:
0574:                activeEntry.setReferenceFinancialSystemOriginationCode(null);
0575:
0576:                // 1397 009190 MOVE SPACES
0577:                // 1398 009200 TO FDOC-REF-NBR OF GLEN-RECORD.
0578:
0579:                activeEntry.setReferenceFinancialDocumentNumber(null);
0580:
0581:                // 1399 009210 MOVE SPACES
0582:                // 1400 009220 TO FDOC-REVERSAL-DT OF GLEN-RECORD.
0583:
0584:                activeEntry.setReversalDate(null);
0585:
0586:                // 1401 009230 MOVE WS-TRN-ENCUM-UPDT-CD
0587:                // 1402 009240 TO TRN-ENCUM-UPDT-CD OF GLEN-RECORD.
0588:
0589:                String transactionEncumbranceUpdateCode = null;
0590:                try {
0591:                    transactionEncumbranceUpdateCode = getTransactionEncumbranceUpdateCode(balance);
0592:                } catch (NonFatalErrorException nfee) {
0593:
0594:                    // 1161 006880 ADD +1 TO NON-FATAL-COUNT
0595:
0596:                    getState().incrementNonFatalCount();
0597:
0598:                    LOG.info(nfee.getMessage());
0599:                }
0600:
0601:                activeEntry
0602:                        .setTransactionEncumbranceUpdateCode(transactionEncumbranceUpdateCode);
0603:
0604:                // 1403 009250 IF FIN-BALANCE-TYP-CD OF GLEN-RECORD = 'NB'
0605:
0606:                // NOTE (laran) This might be a bug. I'm not sure if
0607:                // "FIN-BALANCE-TYP-CD OF GLEN-RECORD" refers to the
0608:                // value previously set into the GLEN-RECORD, which
0609:                // would be the variable called "entry" at this point.
0610:                // Or perhaps it refers to a value set previously on the
0611:                // variable called "activeEntry" at this point.
0612:
0613:                if (KFSConstants.BALANCE_TYPE_AUDIT_TRAIL.equals(balance
0614:                        .getBalanceTypeCode())) {
0615:
0616:                    // 1404 009260 MOVE 'AC' TO FIN-BALANCE-TYP-CD OF GLEN-RECORD.
0617:
0618:                    activeEntry
0619:                            .setFinancialBalanceTypeCode(KFSConstants.BALANCE_TYPE_ACTUAL);
0620:
0621:                }
0622:
0623:                // 1405 009270 IF TRN-LDGR-ENTR-AMT OF GLEN-RECORD < 0
0624:
0625:                if (activeEntry.getTransactionLedgerEntryAmount().isNegative()) {
0626:
0627:                    // 1406 009280 IF FIN-BALANCE-TYP-CD OF GLEN-RECORD = 'AC'
0628:
0629:                    if (KFSConstants.BALANCE_TYPE_ACTUAL.equals(activeEntry
0630:                            .getFinancialBalanceTypeCode())) {
0631:
0632:                        // 1407 009290 COMPUTE TRN-LDGR-ENTR-AMT OF GLEN-RECORD
0633:                        // 1408 009300 = TRN-LDGR-ENTR-AMT OF GLEN-RECORD * -1.
0634:
0635:                        activeEntry.setTransactionLedgerEntryAmount(activeEntry
0636:                                .getTransactionLedgerEntryAmount().negated());
0637:
0638:                    }
0639:
0640:                }
0641:
0642:                // 1409 009310 IF CAPYACTT-ACCT-CLOSED-IND NOT = 'Y'
0643:
0644:                return activeEntry;
0645:            }
0646:
0647:            /**
0648:             * Creates an origin entry that will forward this "general" balance
0649:             * 
0650:             * @param balance the balance to create a general origin entry for
0651:             * @return the generated origin entry
0652:             */
0653:            public OriginEntryFull generateGeneralForwardOriginEntry(
0654:                    Balance balance) {
0655:
0656:                OriginEntryFull entry = new OriginEntryFull();
0657:
0658:                // 1215 007420 PERFORM 4100-WRITE-GENERAL
0659:                // 1216 007430 THRU 4100-WRITE-GENERAL-EXIT
0660:
0661:                // 1225 007520 4100-WRITE-GENERAL.
0662:                // 1226 007530 MOVE SPACES TO GLEN-RECORD.
0663:                // 1227 007540 MOVE WS-UNIV-FISCAL-YR-PLUS-1
0664:                // 1228 007550 TO UNIV-FISCAL-YR OF GLEN-RECORD.
0665:
0666:                entry.setUniversityFiscalYear(new Integer(closingFiscalYear
0667:                        .intValue() + 1));
0668:
0669:                // 1229 007560 MOVE GLGLBL-FIN-COA-CD
0670:                // 1230 007570 TO FIN-COA-CD.
0671:
0672:                entry.setChartOfAccountsCode(balance.getChartOfAccountsCode());
0673:
0674:                // 1231 007580 MOVE GLGLBL-ACCOUNT-NBR
0675:                // 1232 007590 TO ACCOUNT-NBR.
0676:
0677:                entry.setAccountNumber(balance.getAccountNumber());
0678:
0679:                // 1233 007600 MOVE GLGLBL-SUB-ACCT-NBR
0680:                // 1234 007610 TO SUB-ACCT-NBR.
0681:
0682:                entry.setSubAccountNumber(balance.getSubAccountNumber());
0683:
0684:                // 1235 007620 MOVE GLGLBL-FIN-OBJECT-CD
0685:                // 1236 007630 TO FIN-OBJECT-CD.
0686:
0687:                entry.setFinancialObjectCode(balance.getObjectCode());
0688:
0689:                // 1237 007640 MOVE GLGLBL-FIN-SUB-OBJ-CD
0690:                // 1238 007650 TO FIN-SUB-OBJ-CD.
0691:
0692:                entry.setFinancialSubObjectCode(balance.getSubObjectCode());
0693:
0694:                // 1239 007660 MOVE GLGLBL-FIN-BALANCE-TYP-CD
0695:                // 1240 007670 TO FIN-BALANCE-TYP-CD.
0696:
0697:                entry.setFinancialBalanceTypeCode(balance.getBalanceTypeCode());
0698:
0699:                // 1241 007680 IF GLGLBL-FIN-OBJ-TYP-CD = 'EE'
0700:
0701:                if (currentYearOptions.getFinObjTypeExpendNotExpCode().equals(
0702:                        balance.getObjectTypeCode())) {
0703:
0704:                    // 1242 007690 MOVE 'AS'
0705:                    // 1243 007700 TO FIN-OBJ-TYP-CD
0706:
0707:                    entry.setFinancialObjectTypeCode(currentYearOptions
0708:                            .getFinancialObjectTypeAssetsCd());
0709:
0710:                    // 1244 007710 ELSE
0711:
0712:                } else {
0713:
0714:                    // 1245 007720 MOVE GLGLBL-FIN-OBJ-TYP-CD
0715:                    // 1246 007730 TO FIN-OBJ-TYP-CD.
0716:
0717:                    entry.setFinancialObjectTypeCode(balance
0718:                            .getObjectTypeCode());
0719:
0720:                }
0721:
0722:                // 1247 007740 MOVE 'BB'
0723:                // 1248 007750 TO UNIV-FISCAL-PRD-CD.
0724:
0725:                entry
0726:                        .setUniversityFiscalPeriodCode(KFSConstants.PERIOD_CODE_BEGINNING_BALANCE);
0727:
0728:                // 1249 007760 MOVE 'ACLO'
0729:                // 1250 007770 TO FDOC-TYP-CD.
0730:
0731:                entry.setFinancialDocumentTypeCode(this .annualClosingDocType);
0732:
0733:                // 1251 007780 MOVE 'MF'
0734:                // 1252 007790 TO FS-ORIGIN-CD.
0735:
0736:                entry.setFinancialSystemOriginationCode(this .glOriginationCode);
0737:
0738:                // 1253 007800 STRING 'AC'
0739:                // 1254 007810 GLGLBL-ACCOUNT-NBR
0740:                // 1255 007820 RP-BLANK-LINE
0741:                // 1256 007830 DELIMITED BY SIZE
0742:                // 1257 007840 INTO FDOC-NBR.
0743:
0744:                // FIXME Once tests are running properly uncomment the code to include the
0745:                // chartOfAccountsCode in the document number. It will cause the tests to
0746:                // break given the current framework but is desired as an enhancement for Kuali.
0747:                entry
0748:                        .setDocumentNumber(new StringBuffer(
0749:                                KFSConstants.BALANCE_TYPE_ACTUAL)
0750:                                .append(balance.getAccountNumber())
0751:                                /* .append(balance.getChartOfAccountsCode()) */.toString());
0752:
0753:                // 1258 007850 MOVE WS-SEQ-NBR
0754:                // 1259 007860 TO TRN-ENTR-SEQ-NBR.
0755:
0756:                entry.setTransactionLedgerEntrySequenceNumber(new Integer(state
0757:                        .getSequenceNumber()));
0758:
0759:                // 1260 007870 STRING 'BEG BAL BROUGHT FORWARD FROM '
0760:                // 1261 007880 VAR-UNIV-FISCAL-YR
0761:                // 1262 007890 RP-BLANK-LINE
0762:                // 1263 007900 DELIMITED BY SIZE INTO
0763:                // 1264 007910 TRN-LDGR-ENTR-DESC.
0764:
0765:                entry.setTransactionLedgerEntryDescription(new StringBuffer(
0766:                        "BEG BAL BROUGHT FORWARD FROM ").append(
0767:                        closingFiscalYear).toString());
0768:
0769:                String transactionEncumbranceUpdateCode = null;
0770:                try {
0771:                    transactionEncumbranceUpdateCode = getTransactionEncumbranceUpdateCode(balance);
0772:                } catch (NonFatalErrorException nfee) {
0773:
0774:                    // 1161 006880 ADD +1 TO NON-FATAL-COUNT
0775:
0776:                    getState().incrementNonFatalCount();
0777:
0778:                    LOG.info(nfee.getMessage());
0779:                }
0780:                entry
0781:                        .setTransactionEncumbranceUpdateCode(transactionEncumbranceUpdateCode);
0782:
0783:                // 1265 007920 ADD GLGLBL-ACLN-ANNL-BAL-AMT
0784:                // 1266 007930 GLGLBL-FIN-BEG-BAL-LN-AMT
0785:                // 1267 007940 GLGLBL-CONTR-GR-BB-AC-AMT
0786:                // 1268 007950 GIVING TRN-LDGR-ENTR-AMT.
0787:
0788:                KualiDecimal transactionLedgerEntryAmount = new KualiDecimal(0);
0789:                transactionLedgerEntryAmount = transactionLedgerEntryAmount
0790:                        .add(balance.getAccountLineAnnualBalanceAmount())
0791:                        .add(balance.getBeginningBalanceLineAmount())
0792:                        .add(balance.getContractsGrantsBeginningBalanceAmount());
0793:
0794:                String wsFinancialObjectTypeDebitCreditCode = null;
0795:
0796:                try {
0797:                    wsFinancialObjectTypeDebitCreditCode = getFinancialObjectTypeDebitCreditCode(balance);
0798:                } catch (NonFatalErrorException nfee) {
0799:
0800:                    getState().incrementNonFatalCount();
0801:
0802:                    // 1197 007240 PERFORM 8500-CHECK-NEW-PAGE
0803:                    // 1198 007250 THRU 8500-CHECK-NEW-PAGE-EXIT
0804:                    // 1199 007260 MOVE 'C' TO WS-FIN-OBJTYP-DBCR-CD
0805:
0806:                    wsFinancialObjectTypeDebitCreditCode = KFSConstants.GL_CREDIT_CODE;
0807:
0808:                    LOG.info(nfee.getMessage());
0809:                }
0810:
0811:                // 1269 007960 IF TRN-LDGR-ENTR-AMT < ZERO
0812:
0813:                if (transactionLedgerEntryAmount.isNegative()) {
0814:
0815:                    // 1270 007970 IF WS-FIN-OBJTYP-DBCR-CD = 'D'
0816:
0817:                    if (KFSConstants.GL_DEBIT_CODE
0818:                            .equals(wsFinancialObjectTypeDebitCreditCode)) {
0819:
0820:                        // 1271 007980 MOVE 'C' TO TRN-DEBIT-CRDT-CD
0821:
0822:                        entry
0823:                                .setTransactionDebitCreditCode(KFSConstants.GL_CREDIT_CODE);
0824:
0825:                        // 1272 007990 ELSE
0826:
0827:                    } else {
0828:
0829:                        // 1273 008000 MOVE 'D' TO TRN-DEBIT-CRDT-CD
0830:
0831:                        entry
0832:                                .setTransactionDebitCreditCode(KFSConstants.GL_DEBIT_CODE);
0833:
0834:                    }
0835:
0836:                    // 1274 008010 ELSE
0837:
0838:                } else {
0839:
0840:                    // 1275 008020 MOVE WS-FIN-OBJTYP-DBCR-CD
0841:                    // 1276 008030 TO TRN-DEBIT-CRDT-CD.
0842:
0843:                    entry
0844:                            .setTransactionDebitCreditCode(wsFinancialObjectTypeDebitCreditCode);
0845:
0846:                }
0847:
0848:                // 1277 008040 MOVE VAR-TRANSACTION-DT
0849:                // 1278 008050 TO TRANSACTION-DT OF GLEN-RECORD.
0850:
0851:                entry.setTransactionDate(transactionDate);
0852:
0853:                // 1279 008060 MOVE SPACES
0854:                // 1280 008070 TO ORG-DOC-NBR.
0855:
0856:                entry.setOrganizationDocumentNumber(null);
0857:
0858:                // 1281 008080 MOVE ALL '-'
0859:                // 1282 008090 TO PROJECT-CD.
0860:
0861:                entry.setProjectCode(KFSConstants.getDashProjectCode());
0862:
0863:                // 1283 008100 MOVE SPACES
0864:                // 1284 008110 TO ORG-REFERENCE-ID.
0865:
0866:                entry.setOrganizationReferenceId(null);
0867:
0868:                // 1285 008120 MOVE SPACES
0869:                // 1286 008130 TO FDOC-REF-TYP-CD.
0870:
0871:                entry.setReferenceFinancialDocumentTypeCode(null);
0872:
0873:                // 1287 008140 MOVE SPACES
0874:                // 1288 008150 TO FS-REF-ORIGIN-CD.
0875:
0876:                entry.setReferenceFinancialSystemOriginationCode(null);
0877:
0878:                // 1289 008160 MOVE SPACES
0879:                // 1290 008170 TO FDOC-REF-NBR.
0880:
0881:                entry.setReferenceFinancialDocumentNumber(null);
0882:
0883:                // 1291 008180 MOVE SPACES
0884:                // 1292 008190 TO FDOC-REVERSAL-DT.
0885:
0886:                entry.setFinancialDocumentReversalDate(null);
0887:
0888:                // 1293 008200 MOVE WS-TRN-ENCUM-UPDT-CD
0889:                // 1294 008210 TO TRN-ENCUM-UPDT-CD.
0890:
0891:                // NOTE (laran) this was set above.
0892:
0893:                // 1295 008220 IF FIN-BALANCE-TYP-CD = 'NB'
0894:
0895:                if (KFSConstants.BALANCE_TYPE_AUDIT_TRAIL.equals(entry
0896:                        .getFinancialBalanceTypeCode())) {
0897:
0898:                    // 1296 008230 MOVE 'AC' TO FIN-BALANCE-TYP-CD.
0899:
0900:                    entry
0901:                            .setFinancialBalanceTypeCode(KFSConstants.BALANCE_TYPE_ACTUAL);
0902:
0903:                }
0904:
0905:                // 1297 008240 IF TRN-LDGR-ENTR-AMT < 0
0906:
0907:                if (transactionLedgerEntryAmount.isNegative()) {
0908:
0909:                    // 1298 008250 IF FIN-BALANCE-TYP-CD = 'AC'
0910:
0911:                    if (KFSConstants.BALANCE_TYPE_ACTUAL.equals(entry
0912:                            .getFinancialBalanceTypeCode())) {
0913:
0914:                        // 1299 008260 COMPUTE TRN-LDGR-ENTR-AMT
0915:                        // 1300 008270 = TRN-LDGR-ENTR-AMT * -1.
0916:
0917:                        transactionLedgerEntryAmount = transactionLedgerEntryAmount
0918:                                .negated();
0919:
0920:                    }
0921:
0922:                }
0923:
0924:                entry
0925:                        .setTransactionLedgerEntryAmount(transactionLedgerEntryAmount);
0926:
0927:                // 1301 008280 IF CAPYACTT-ACCT-CLOSED-IND NOT = 'Y'
0928:
0929:                return entry;
0930:            }
0931:
0932:            /**
0933:             * Retrieves the transaction encumbrance update code, based on the balance type code of the balance. These codes are cached,
0934:             * based off a cache generated in the big constructor
0935:             * 
0936:             * @param balance the balance to find the encumbrance update code for
0937:             * @return the transaction update code
0938:             * @throws NonFatalErrorException if an encumbrance update code cannot be found for this balance
0939:             */
0940:            private String getTransactionEncumbranceUpdateCode(Balance balance)
0941:                    throws NonFatalErrorException {
0942:                String updateCode = null;
0943:
0944:                // 1142 006690 IF CABTYP-FBEC-I < ZERO
0945:                // 1143 006700 MOVE SPACE TO CABTYP-FIN-BALTYP-ENC-CD
0946:                // 1144 006710 END-IF
0947:
0948:                // 1145 006720 EVALUATE SQLCODE
0949:                // 1146 006730 WHEN 0
0950:                Boolean encumIndicator = this .balanceTypeEncumbranceIndicators
0951:                        .get(balance.getBalanceTypeCode());
0952:                if (encumIndicator == null) {
0953:                    throw new NonFatalErrorException(
0954:                            new StringBuffer(" ERROR ").append(
0955:                                    balance.getBalanceTypeCode()).append(
0956:                                    " NOT ON TABLE ").toString());
0957:                } else if (encumIndicator.booleanValue()) {
0958:                    updateCode = KFSConstants.ENCUMB_UPDT_NO_ENCUMBRANCE_CD;
0959:                }
0960:
0961:                return updateCode;
0962:            }
0963:
0964:            /**
0965:             * This method attempts to determine the debit/credit code of a given balance based on the object type
0966:             * 
0967:             * @param balance the balance to determin the debit/credit code for
0968:             * @return the debit or credit code
0969:             */
0970:            private String getFinancialObjectTypeDebitCreditCode(Balance balance)
0971:                    throws NonFatalErrorException {
0972:                String balanceObjectTypeDebitCreditCode = null != balance
0973:                        .getObjectType() ? balance.getObjectType()
0974:                        .getFinObjectTypeDebitcreditCd() : null;
0975:
0976:                String wsFinancialObjectTypeDebitCreditCode = null;
0977:
0978:                // 1182 007090 IF CAOTYP-FODC-I < ZERO
0979:                // 1183 007100 MOVE SPACE TO CAOTYP-FIN-OBJTYP-DBCR-CD
0980:                // 1184 007110 END-IF
0981:                // 1185 007120 EVALUATE SQLCODE
0982:                // 1186 007130 WHEN 0
0983:
0984:                if (null != balanceObjectTypeDebitCreditCode) {
0985:
0986:                    // 1187 007140 IF CAOTYP-FIN-OBJTYP-DBCR-CD = 'C' OR 'D'
0987:
0988:                    // NOTE this field doesn't seem to be used anywhere in the cobol
0989:                    // String subFundGroupCode = null;
0990:
0991:                    if (ObjectHelper.isOneOf(balanceObjectTypeDebitCreditCode,
0992:                            new String[] { KFSConstants.GL_CREDIT_CODE,
0993:                                    KFSConstants.GL_DEBIT_CODE })) {
0994:
0995:                        // 1188 007150 MOVE CAOTYP-FIN-OBJTYP-DBCR-CD
0996:                        // 1189 007160 TO WS-FIN-OBJTYP-DBCR-CD
0997:
0998:                        wsFinancialObjectTypeDebitCreditCode = balanceObjectTypeDebitCreditCode;
0999:
1000:                        // 1190 007170 MOVE CAPYACTT-SUB-FUND-GRP-CD TO WS-SUB-FUND-GRP-CD
1001:
1002:                        // NOTE this field doesn't seem to be used anywhere in the cobol
1003:                        // subFundGroupCode = priorYearAccount.getSubFundGroupCode();
1004:
1005:                        // 1191 007180 ELSE
1006:
1007:                    } else {
1008:
1009:                        // 1192 007190 MOVE 'C' TO WS-FIN-OBJTYP-DBCR-CD
1010:
1011:                        wsFinancialObjectTypeDebitCreditCode = KFSConstants.GL_CREDIT_CODE;
1012:
1013:                        // 1194 007210 END-IF
1014:
1015:                    }
1016:
1017:                    // 1195 007220 WHEN +100
1018:                    // 1196 007230 WHEN +1403
1019:
1020:                } else {
1021:
1022:                    throw new NonFatalErrorException(new StringBuffer(
1023:                            "FIN OBJ TYP CODE ").append(
1024:                            balance.getObjectTypeCode())
1025:                            .append(" NOT IN TABLE").toString());
1026:
1027:                    // 1206 007330 PERFORM CK-PRINT-STATUS THRU CK-PRINT-STATUS-EXIT
1028:                    // 1207 007340 ADD 1 TO LINE-COUNT
1029:
1030:                }
1031:                return wsFinancialObjectTypeDebitCreditCode;
1032:            }
1033:
1034:            /**
1035:             * Saves a generated origin entry to the database, within the proper group
1036:             * 
1037:             * @param balance the original balance, which still has the account to check if it is closed or not
1038:             * @param entry the origin entry to save
1039:             * @param closedPriorYearAccountGroup the group to put balance forwarding origin entries with closed accounts into
1040:             * @param unclosedPriorYearAccountGroup the group to put balance forwarding origin entries with open accounts into
1041:             */
1042:            private void saveForwardingEntry(Balance balance,
1043:                    OriginEntryFull entry,
1044:                    OriginEntryGroup closedPriorYearAccountGroup,
1045:                    OriginEntryGroup unclosedPriorYearAccountGroup) {
1046:                if (ObjectUtils.isNotNull(balance.getPriorYearAccount())
1047:                        && !balance.getPriorYearAccount()
1048:                                .isAccountClosedIndicator()) {
1049:
1050:                    // 1410 009320 MOVE TRN-LDGR-ENTR-AMT TO WS-AMT-W-PERIOD
1051:                    // 1411 009330 WS-AMT-N
1052:                    // 1412 009340 MOVE WS-AMT-X TO TRN-AMT-RED-X
1053:
1054:                    // 1413 009350 WRITE GLE-DATA FROM GLEN-RECORD
1055:
1056:                    originEntryService.createEntry(entry,
1057:                            unclosedPriorYearAccountGroup);
1058:
1059:                    // 1414 009360 MOVE WS-AMT-N TO TRN-LDGR-ENTR-AMT
1060:
1061:                    // NOTE (laran) These fields don't seem to do anything at all in the COBOL.
1062:
1063:                    // NOTE (laran) If createEntry fails an exception will be thrown, stopping the run.
1064:                    // NOTE (laran) No explicit handling is required.
1065:
1066:                    // 1415 009370 IF GLEDATA-STATUS > '09'
1067:                    // 1416 009380 DISPLAY '**ERROR WRITING TO GLEDATA FILE'
1068:                    // 1417 009390 DISPLAY ' STATUS IS ' GLEDATA-STATUS
1069:                    // 1418 009400 MOVE 8 TO RETURN-CODE
1070:                    // 1419 009410 STOP RUN
1071:                    // 1420 END-IF
1072:
1073:                    // 1421 009420 ADD +1 TO SEQ-WRITE-COUNT
1074:
1075:                    state.incrementSequenceWriteCount();
1076:
1077:                    // 1422 MOVE SEQ-WRITE-COUNT TO SEQ-CHECK-CNT
1078:                    // 1423 IF SEQ-CHECK-CNT (7:3) = '000'
1079:
1080:                    if (0 == state.getSequenceWriteCount() % 1000) {
1081:
1082:                        // 1424 DISPLAY ' SEQUENTIAL RECORDS WRITTEN = ' SEQ-CHECK-CNT
1083:
1084:                        LOG.info("  SEQUENTIAL RECORDS WRITTEN = "
1085:                                + state.getSequenceWriteCount());
1086:
1087:                        // 1425 END-IF
1088:
1089:                    }
1090:
1091:                    // 1426 009430 ELSE
1092:
1093:                } else {
1094:
1095:                    // 1427 009440 MOVE TRN-LDGR-ENTR-AMT TO WS-AMT-W-PERIOD
1096:                    // 1428 009450 WS-AMT-N
1097:
1098:                    // NOTE (laran) These fields don't seem to do anything at all in the COBOL.
1099:
1100:                    // 1429 009460 MOVE WS-AMT-X TO TRN-AMT-RED-X
1101:
1102:                    // NOTE (laran) These fields don't seem to do anything at all in the COBOL.
1103:
1104:                    // 1430 009470 WRITE CLOSE-DATA FROM GLEN-RECORD
1105:
1106:                    originEntryService.createEntry(entry,
1107:                            closedPriorYearAccountGroup);
1108:
1109:                    // 1431 009480 MOVE WS-AMT-N TO TRN-LDGR-ENTR-AMT
1110:
1111:                    // NOTE (laran) These fields don't seem to do anything at all in the COBOL.
1112:
1113:                    // NOTE (laran) If createEntry fails an exception will be thrown, stopping the run.
1114:                    // NOTE (laran) No explicit handling is required.
1115:
1116:                    // 1432 009490 IF CLOSEDATA-STATUS > '09'
1117:                    // 1433 009500 DISPLAY '**ERROR WRITING TO CLOSE FILE'
1118:                    // 1434 009510 DISPLAY ' STATUS IS ' CLOSEDATA-STATUS
1119:                    // 1435 009520 MOVE 8 TO RETURN-CODE
1120:                    // 1436 009530 STOP RUN
1121:                    // 1437 009540 END-IF
1122:
1123:                    // 1438 009550 ADD +1 TO SEQ-CLOSE-COUNT.
1124:
1125:                    state.incrementSequenceClosedCount();
1126:
1127:                    if (0 == state.getSequenceClosedCount() % 1000) {
1128:
1129:                        // 1424 DISPLAY ' SEQUENTIAL RECORDS WRITTEN = ' SEQ-CHECK-CNT
1130:
1131:                        LOG.info("  CLOSED SEQUENTIAL RECORDS WRITTEN = "
1132:                                + state.getSequenceClosedCount());
1133:
1134:                        // 1425 END-IF
1135:
1136:                    }
1137:                }
1138:            }
1139:
1140:            /**
1141:             * @param priorYearAccountService The priorYearAccountService to set.
1142:             */
1143:            public void setPriorYearAccountService(
1144:                    PriorYearAccountService priorYearAccountService) {
1145:                this .priorYearAccountService = priorYearAccountService;
1146:            }
1147:
1148:            /**
1149:             * @param subFundGroupService The subFundGroupService to set.
1150:             */
1151:            public void setSubFundGroupService(
1152:                    SubFundGroupService subFundGroupService) {
1153:                this .subFundGroupService = subFundGroupService;
1154:            }
1155:
1156:            /**
1157:             * @param originEntryService The originEntryService to set.
1158:             */
1159:            public void setOriginEntryService(
1160:                    OriginEntryService originEntryService) {
1161:                this .originEntryService = originEntryService;
1162:            }
1163:
1164:            public Integer getClosingFiscalYear() {
1165:                return closingFiscalYear;
1166:            }
1167:
1168:            public void setClosingFiscalYear(Integer fiscalYear) {
1169:                this .closingFiscalYear = fiscalYear;
1170:            }
1171:
1172:            public Date getTransactionDate() {
1173:                return transactionDate;
1174:            }
1175:
1176:            public void setTransactionDate(Date transactionDate) {
1177:                this .transactionDate = transactionDate;
1178:            }
1179:
1180:            public OriginEntryGroup getClosedPriorYearAccountGroup() {
1181:                return closedPriorYearAccountGroup;
1182:            }
1183:
1184:            public void setClosedPriorYearAccountGroup(
1185:                    OriginEntryGroup closedPriorYearAccountGroup) {
1186:                this .closedPriorYearAccountGroup = closedPriorYearAccountGroup;
1187:            }
1188:
1189:            public OriginEntryGroup getUnclosedPriorYearAccountGroup() {
1190:                return unclosedPriorYearAccountGroup;
1191:            }
1192:
1193:            public void setUnclosedPriorYearAccountGroup(
1194:                    OriginEntryGroup unclosedPriorYearAccountGroup) {
1195:                this .unclosedPriorYearAccountGroup = unclosedPriorYearAccountGroup;
1196:            }
1197:
1198:            public BalanceForwardProcessState getState() {
1199:                return state;
1200:            }
1201:        }
ww__w__._j_ava_2___s__.c___om___ | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.