/** Creates a new service report generator object which creates a new * provider directory (service report). */ public ServiceReportGenerator() { try { Services services = new Services(); services.open(); //Create a new provider directory report = new ProviderDirectory(); //Get all services List <Service> allServices = services.getAllOrderedByName(); //Add all services to provider directory foreach (Service aService in allServices) { report.addDetail(aService.getName(), aService.getCode(), aService.getFee()); } services.close(); } catch (Exception ex) { //occurs if the file cannot be created report.addErrorMessage(ex.Message); } //catch (ParseException ex) //{ // //occurs if the file format is incorrect // report.addErrorMessage(ex.getMessage()); //} }//default constructor
/** * Creates a new ServiceMaintainer control object */ public ServiceMaintainer() { try { //Create and open the service collection services = new Services(); services.open(); //Create a user interface and set up menu ui = new UserInterface(); String menuText = "1.\tAdd a New Service\n" + "2.\tEdit a Service\n" + "3.\tDelete a Service\n" + "4.\tQuit\n"; int choice; do { ui.message("\t\t\tMaintain Services\n\n"); choice = ui.menu(menuText); //display menu and get choice switch (choice) { case 1: addService(); break; case 2: editService(); break; case 3: deleteService(); break; case 4: break; default: ui.errorMessage("Invalid choice. Please re-enter."); break; } } while (choice != 4); //close the service collection services.close(); } catch (Exception ex) //Error in file format { ui.errorMessage(ex.Message); return; } //catch (FileNotFoundException ex) //{ // //occurs if the file cannot be created // ui.errorMessage(ex.getMessage()); //} }//default constructor
/** Creates a new Claim Submitter object * @param theProvider the provider submitting the claim * @param theMember the member to whom the service was provided */ public ClaimSubmitter(Provider theProvider, Member theMember) { try { ui = new UserInterface(); services = new Services(); claims = new Claims(); services.open(); claims.open(); //get the service date DateTime serviceDate = ui.promptForDate ("Service Date (" + UserInterface.DATE_FORMAT + "): "); //get the correct service Service theService = null; bool correctCode = false; do { //get the service code String serviceCode = ui.promptForString("Service Code: "); theService = services.find(serviceCode); if (theService == null) { ui.errorMessage("Invalid code. Please re-enter."); } else { //confirm the service String answer = ui.promptForString("Service: " + theService.getName() + " \nIs this correct? (Y)es or (N)o: "); if (answer != null && answer.Length >= 1 && Char.ToUpper(answer[0]) == 'Y') { correctCode = true; } } } while (!correctCode); //Create new claim. The constructor initializes //the submission date and time with the system time. Claim aClaim = new Claim(theService.getCode(), theProvider.getNumber(), theMember.getNumber(), serviceDate); claims.add(aClaim); //Display success confirmation and service fee ui.message("Your claim has been submitted successfully."); ui.message("Service fee due to you: " + ui.formatAsCurrency(theService.getFee())); services.close(); claims.close(); } catch (Exception ex) { //File format is incorrect ui.errorMessage(ex.Message); } }//default constructor
/** Creates a new accounts payable report generator which creates a new * accounts payable report * @param endDate a date within the week for which the report is to be * generated * @throws FileNotFoundException if the file cannot be created. */ public AccountsPayableReportGenerator(DateTime endDate) { Claims claims = null; Services services = null; Providers providers = null; //create a new accounts payable report report = new AccountsPayableReport(endDate); try { //create and open claims, services and providers collections claims = new Claims(); claims.open(); services = new Services(); services.open(); providers = new Providers(); providers.open(); int totalNoConsultations = 0; //accumulates number of consultations int providerCount = 0; //counts number of providers to be paid double grandTotalFee = 0; //accumulates all fees payable //get all providers List <Person> allProviders = providers.getAll(); //for each provider foreach (Person person in allProviders) { int noConsultations = 0; //counts this provider's claims double totalFee = 0; //accumulates fees payable to this provider Provider provider = (Provider)person; //get all claims submitted by this provider List <Claim> providerClaims = claims.findByProvider(provider.getNumber()); //for each claim foreach (Claim nextClaim in providerClaims) { //test whether within date range if (nextClaim.getSubmissionDate() > (report.getStartDateRange()) && nextClaim.getSubmissionDate() < (report.getEndDateRange())) { //get service fee double serviceFee; Service service = services.find(nextClaim.getServiceCode()); if (service == null) { serviceFee = 0; //indicates invalid code } else { serviceFee = service.getFee(); } //increment number of consultations noConsultations++; //accumulate fees payable totalFee += serviceFee; } //if date in specified week } //for each claim if (noConsultations > 0) { //add provider detauls to report report.addDetail(provider.getNumber(), noConsultations , totalFee, provider.getName()); //accumulate number of consultations for all providers totalNoConsultations += noConsultations; //accumulate fees payable for all providers grandTotalFee += totalFee; //increment provider count providerCount++; } }//for each provider //add summary to report report.addSummary(totalNoConsultations, grandTotalFee , providerCount); }//try catch (Exception ex) { report.addErrorMessage(ex.Message); } finally { if (claims != null) { claims.close(); } if (providers != null) { providers.close(); } if (services != null) { services.close(); } } }//constructor
/** Creates a new EFT report generator which creates a new * EFT report. * @param endDate a date within the week for which the report is to be * generated * @throws FileNotFoundException if the file cannot be created. */ public EFTReportGenerator(DateTime endDate) { Claims claims = null; Services services = null; Providers providers = null; //create a new EFT report report = new EFTReport(endDate); try { //create and open claims, services and providers collections claims = new Claims(); claims.open(); services = new Services(); services.open(); providers = new Providers(); providers.open(); //get all providers List <Person> allProviders = providers.getAll(); //for each provider foreach (Person person in allProviders) { double totalFee = 0; //accumulates fees payable to provider Provider provider = (Provider)person; //get all claims submitted by provider List <Claim> providerClaims = claims.findByProvider(provider.getNumber()); //for each claim foreach (Claim nextClaim in providerClaims) { //test whether claim is witin date range if (nextClaim.getSubmissionDate() > (report.getStartDateRange()) && nextClaim.getSubmissionDate() < (report.getEndDateRange())) { //get service fee double serviceFee; Service service = services.find(nextClaim.getServiceCode()); if (service == null) { throw new System.Exception("Invalid Code"); } else { serviceFee = service.getFee(); } //accumulate fees payable totalFee += serviceFee; } //if date in specified week } //for each claim if (totalFee > 0) { //add fees payable detail to report report.addDetail(provider.getNumber(), totalFee, provider.getName()); } } //for each provider } //try catch (Exception ex) { report.addErrorMessage(ex.Message); } finally { if (claims != null) { claims.close(); } if (providers != null) { providers.close(); } if (services != null) { services.close(); } } }//constructor
/** Creates a new provider report generator which creates a new provider report. * @param provider the provider about whom the report is generated * @param endDate a date within the week for which the report is to be * generated * @throws FileNotFoundException if the file cannot be created. */ public ProviderReportGenerator(Provider provider, DateTime endDate) { Claims claims = null; Members members = null; Services services = null; //Create a new provider report report = new ProviderReport(provider, endDate); try { //create and open the collections of claims, members and services claims = new Claims(); claims.open(); members = new Members(); members.open(); services = new Services(); services.open(); int noConsultations = 0; //use to count number of consultations double totalFee = 0; //use to accumulate fee //get all claims submitted by provider List <Claim> providerClaims = claims.findByProvider(provider.getNumber()); //for each claim foreach (Claim nextClaim in providerClaims) { //test whether within date range if (nextClaim.getSubmissionDate() > report.getStartDateRange() && nextClaim.getSubmissionDate() < report.getEndDateRange()) { //get the member to whom the service was provided String memberName; Member member = members.find(nextClaim.getMemberNumber()); if (member == null) { memberName = "Invalid Number"; } else { memberName = member.getName(); } //get the fee for the service double serviceFee; Service service = services.find(nextClaim.getServiceCode()); if (service == null) { serviceFee = 0; //indicates invalid code } else { serviceFee = service.getFee(); } //add claim details to report report.addDetail(nextClaim.getSubmissionDate(), nextClaim.getServiceDate(), nextClaim.getMemberNumber(), memberName, nextClaim.getServiceCode(), serviceFee); //increment number of consultations noConsultations++; //accumulate fee totalFee += serviceFee; } //if date in specified week } //for //add summary details to report report.addSummary(noConsultations, totalFee); }//try catch (Exception ex) { report.addErrorMessage(ex.Message); } finally { if (claims != null) { claims.close(); } if (members != null) { members.close(); } if (services != null) { services.close(); } } }//constructor
/** Creates a new member report generator which creates a new member report. * @param member the member about whom the report is generated * @param endDate a date within the week for which the report is to be * generated * @throws FileNotFoundException if the file cannot be created. */ public MemberReportGenerator(Member member, DateTime endDate) { Claims claims = null; Providers providers = null; Services services = null; //Create a new member report report = new MemberReport(member, endDate); try { //create and open the claims, providers and services collections claims = new Claims(); claims.open(); providers = new Providers(); providers.open(); services = new Services(); services.open(); //Get all claims submitted for services to this member, ordered by //service date List <Claim> memberClaims = claims.findByMember(member.getNumber()); //for each claim foreach (Claim nextClaim in memberClaims) { //test whether within date range if (nextClaim.getSubmissionDate() > (report.getStartDateRange()) && nextClaim.getSubmissionDate() < (report.getEndDateRange())) { //get provider String providerName; Provider provider = providers .find(nextClaim.getProviderNumber()); if (provider == null) { providerName = "Invalid Number"; } else { providerName = provider.getName(); } //get service String serviceName; Service service = services.find(nextClaim.getServiceCode()); if (service == null) { serviceName = "Invalid Code"; } else { serviceName = service.getName(); } //add service details to report report.addDetail(nextClaim.getServiceDate(), serviceName, providerName); } //if date in specified week } //for } //try catch (Exception ex) { report.addErrorMessage(ex.Message); } finally { if (claims != null) { claims.close(); } if (providers != null) { providers.close(); } if (services != null) { services.close(); } } }//constructor