Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Problem changing SQL time to Human time in JRE program 1

Status
Not open for further replies.

chunkII123

IS-IT--Management
Mar 18, 2009
78
0
0
US
Hey everyone,

I am having trouble getting a code written by a previous employee at my company to grab the time off of the MySQL server and change it to human time, it's coming in via 'yyyy-MM-dd'. I am unsure how to use the DateFormat, SimpleDateFormat, or the one our previous programmer wrote called DDatFormat, which when one calls the '.toString()' command it asks the var to look up date on GregorianCalendar. How can I change this information, i'm adding a zip file with all of the .java files so you amazing programmers can look at this and see if we can figure this mess out.

The files are StatusLetter.java, StatusForm.java, and DDateFormat.java.

As you can see, when one compiles the status letter (which is called from the form) it throws the date in properly, as well as the 'termDate', the termDate is pulled directly from the SQL database. I tried mimicking the 'termDate' 'responseDate', but it only caused the program the throw the current date in the "termination letter". Personally I feel that it is important to have these letter come out as smoothly as possible, picking information from the DB, but clients need to be able to read them, and half of them aren't the smartest when it comes to reading machine date/EU dating.

Please help, I really need to make this program work for our company, and don't want to waste the time of rewriting the whole thing when it is technically functional.

Thanks again community!
 
After I have looked at the Java code, I do not think you need to rewrite the whole thing. The class DDateFormat is a simple class that return a human readable date. DDateFormat operates on GregorianCalendar. If you can be familiar with GregorianCalendar and SimpleDateFormat, you do not need to worry.
When you are modifying StatusForm.java, you may just add several lines and a few lines of System.out.println to print the intermediate results at each time. Do not add a large segment of code at each time before compiling and running when
you are not so experienced in Java.
 
Absolutely, that is what I have been doing for two days. I just can't figure out where I would add the code so that I can say "hey Java, SQL says the date is this, but when you output it, i want it to look like this". I have a few java books here, but I could really use a few pointers from you if you wouldn't mind helping me. Thanks in advance!

-Josh
 
What exactly is more relevant than the the complete uncompiled .java files? -- see the mediafire share link?
 
I think Dian is asking you to post us just the relevant code to save us from having to download your zip file and spend time to locate the code in question.

We have our time invested in our own jobs and interests and you are more likely to get help if you help us to help you.

I'm not trying to be antagonistic here, I'm just stating a fact. If I can read your question and see just the relevant code posted here, I may have an insight and spend the time putting it in a reply.

Tim
 
Here are the three codes in question. Based on my question "How would you put SQL time to Human Time", I don't know where I might insert the proper code into either statusLetter.java or Status.java to get the program to do this. I have the basic understanding that the DDateFormat code (under the 'var().toString()') it is telling toString to get todays date based on GregorianCalendar, so for this code i'm unsure if it will work for calling dates. According to the Status.java file it is 'DATE_FORMAT' '%M/%D/%Y' the date that it is pulling from SQL, but when you call (for instance) 'dateOfSecondLetter' within statusForm it brings it in as machine time. the whole idea of the status form is to bring up members information and print it. The whole reason I put the code on via mediafire was so that the post wouldn't be ridiculously long and force people to sift through it when they could open in their favorite IDE or Notepad, but I put the code in the post, and I would like to thank all in advance for your help.

DDateFormat
Code:
/*
 * DateFormat.java
 *
 * Created on May 15, 2006, 1:09 PM
 *
 * To change this template, choose Tools | Template Manager
 * and open the template in the editor.
 */

package membersinformation.components;
import java.text.DateFormat;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.GregorianCalendar;
import membersinformation.forms.WarningMessage;

public class DDateFormat {
    
    /** Creates a new instance of DateFormat */
     public DDateFormat() {
        dateVal = new GregorianCalendar();
    }
    
    public DDateFormat(int month, int day, int year) {
        dateVal = new GregorianCalendar(month, day, year);
    }
    
    public DDateFormat(String date) {
        try {
            DateFormat formatter = new SimpleDateFormat("MM-dd-yyyy");
            Date formatedDate = (Date) formatter.parse(date);
            
            dateVal = new GregorianCalendar();
            dateVal.setGregorianChange(formatedDate);
        } catch (ParseException exc) {
            exc.printStackTrace();
            WarningMessage warning = new WarningMessage(true, exc.getMessage(), WarningMessage.CRITICAL_ERROR);
            warning.setVisible(true);
        }
    }
    
    public String getMonth() {
        Date date = dateVal.getTime();
        int month = dateVal.get(GregorianCalendar.MONTH) + 1;
        String formatted_month = "";
        
        switch(month){
            case 1: formatted_month = "January"; break;
            case 2: formatted_month = "Febuary"; break;
            case 3: formatted_month = "March"; break;
            case 4: formatted_month = "April"; break;
            case 5: formatted_month = "May"; break;
            case 6: formatted_month = "June"; break;
            case 7: formatted_month = "July"; break;
            case 8: formatted_month = "August"; break;
            case 9: formatted_month = "September"; break;
            case 10: formatted_month = "October"; break;
            case 11: formatted_month = "November"; break;
            case 12: formatted_month = "December"; break;
            default: formatted_month = "Date not found"; break;
        }
                
        return formatted_month;
    }
  
    @Override
   public String toString() {
        Date date = dateVal.getTime();
        return DateFormat.getDateInstance(DateFormat.SHORT).format(date);
    }
    
    public void add(int days) {
        dateVal.add(GregorianCalendar.DATE, days);
    }
    
    public GregorianCalendar dateVal;
}
</code>
statusLetter.java
<code>
/*
 * FeedbackLetter.java
 *
 * Created on May 8, 2006, 2:47 PM
 */

package membersinformation.forms;

import java.awt.Color;
import java.awt.Component;
import java.awt.Dimension;
import java.awt.Graphics;
import java.awt.Graphics2D;
import java.awt.print.PageFormat;
import java.awt.print.Paper;
import java.awt.print.Printable;
import javax.swing.RepaintManager;
import membersinformation.components.DDateFormat;
import membersinformation.utilities.PrintUtilities;



public class StatusLetter extends javax.swing.JFrame implements Printable {
    public static final int FEEDBACK_LETTER = 0;
    public static final int PHONE_DISCONNECTION_LETTER = 1;
    public static final int STATUS_LETTER = 2;
    public static final int TERMINATION_LETTER = 3;
    
    /** Creates new form FeedbackLetter */      
    public StatusLetter(int letter) {
        initComponents();
        this.getContentPane().setBackground(new Color(255, 255, 255));
        
        /* Set the screen size */
        this.setPreferredSize(new Dimension (640, 740));
        setLocation(0,106);
        if (letter <= 3)
            setLetter (letter);
    }
    
    public StatusLetter(int letter, String name, String firstName, String streetAddress, String cityStateZip, String memberNumber, String date) {
        initComponents();
        this.getContentPane().setBackground(new Color(255, 255, 255));
        
        /* Set the screen size */
        this.setPreferredSize(new Dimension (640, 740));
        
        if (letter <= 3)
            setLetter (letter);
        
        nameField.setText(name);
        streetAddressField.setText(streetAddress);
        cityStateZipField.setText(cityStateZip);
        memberNumberField.setText(memberNumber);
        dateField.setText(date);
        firstNameField.setText("Dear " + firstName + ",");
        setLocation(0,106);
    }
    
    public StatusLetter(int letter, String name, String firstName, String streetAddress, String cityStateZip, String memberNumber, String date, String responseDate) {
        initComponents();
        this.getContentPane().setBackground(new Color(255, 255, 255));
        
        /* Set the screen size */
        this.setPreferredSize(new Dimension (640, 740));
        
        nameField.setText(name);
        streetAddressField.setText(streetAddress);
        cityStateZipField.setText(cityStateZip);
        memberNumberField.setText(memberNumber);
        dateField.setText(date);
        firstNameField.setText("Dear " + firstName + ",");
        this.responseDate = responseDate;
                      
        if (letter <= 3)
            setLetter (letter);
        setLocation(0,106);
    }
    
    public StatusLetter(int letter, String name, String firstName, String streetAddress, String cityStateZip, String memberNumber, String date, String date1, String date2, String date3, String termDate) {
        initComponents();
        this.getContentPane().setBackground(new Color(255, 255, 255));
        
        /* Set the screen size */
        this.setPreferredSize(new Dimension (640, 740));
        
        nameField.setText(name);
        streetAddressField.setText(streetAddress);
        cityStateZipField.setText(cityStateZip);
        memberNumberField.setText(memberNumber);
        dateField.setText(date);
        firstNameField.setText("Dear " + firstName + ",");
        
        dateOfFirstLetter = date1;
        System.out.println(dateOfFirstLetter.toString());
        dateOfSecondLetter = date2;
        System.out.println(dateOfSecondLetter.toString());
        dateOfThirdLetter = date3;
        System.out.println(dateOfThirdLetter.toString());
        responseDate = termDate;
        System.out.println(responseDate.toString());

        
               
        if (letter <= 3)
            setLetter (letter);
        setLocation(0,106);
     }


    public void setLetter (int letter) {
        if (letter == FEEDBACK_LETTER)
            this.messageField.setText("We have noticed we are not receiving feedback from you regarding your referrals.  We realize you are very busy at times, but because we are not receiving any feedback, we have no idea how things are working for you.  Feedback is crucial in the success of your membership with Matchmaker International.  Without your feedback on each and every referral, we at Matchmaker have no way of knowing if we are meeting your expectations.\n\nDuring your initial interview, it was stressed to you how important communication with us is during your membership.  At this time, it may become very difficult to continue matching you without any feedback.  This lack of communication may force us to stop matching you until an effort is made to communicate with us.\n\n You are a valued member and we want you to find success with Matchmaker International.  So please take a moment to touch base with us and let us know how things are going for you.  Thank you in advance for your prompt attention in this matter. If you believe that you received this letter in error, please call the office at (800)377-8540.\n\n Respectfully, \n\n MatchMaker International");
        else if (letter == PHONE_DISCONNECTION_LETTER)
            this.messageField.setText("We have recently found that your home telephone number has been disconnected. Up to this point, we have not been informed of any phone number change. It is very important that you update us with your new home phone number.\n\nAs you know, your referrals have no way of making contact with you without a valid phone number. Therefore, we will not be able to match you until we have a valid telephone number for you on file. \n\nYou will be given until " + responseDate + " to respond to this notice. Please act immediately in order to maintain your active status with MatchMaker International.\n\nYou may send us a letter or call our office at (800) 377-8540\n\nFailure to respond may result in the eventual termination of your membership with MatchMaker International. Thank you in advance for your cooperation in this matter.\n\nRespectfully,\n\nMatchMaker International");
        else if (letter == STATUS_LETTER)
            this.messageField.setText("We need to know the status of your membership.  It is our policy to only match members who are actively interested in meeting with their referrals.  Please complete the form and return it promptly to us.\n\nWe will not be able to match you until we receive written notification of your status or your change in address/phone number.  Failure to return this form could result in termination of your membership.\n\nThank you for your cooperation and immediate attention in this matter.  If you believe you have received this letter in error, please contact the office at (800)377-8540.\n\nRespectfully,\n\nMatchMaker International\n\nPlease check the phrase that applies to your current status:\n\n__ I am currently active and wish to receive referrals.\n__ I am currently inactive and wish to go on hold.\n__ I am currently inactive and wish to cancel my membership.\n\nPlease Print:\n\nName: _______________________\nAddress: _____________________\n               _____________________\nPhone: _______________________\n\n\nSignature: __________________________");
        else if (letter == TERMINATION_LETTER)
            this.messageField.setText("We have made numerous attempts to contact you by mail regarding the status of your membership with us.  According to our records you have not responded to these attempts.\n\nYour first status letter was sent on: " + dateOfFirstLetter.toString() + "\nYour second status letter was sent on: " + dateOfSecondLetter + ".\nYour FINAL NOTICE, was sent to you on: " + dateOfThirdLetter + ".\n\nAll of these letters have been ignored.  At this time you are being notified that your membership has been terminated. Thank you in advance for your immediate attention in this matter. If you believe you have received this letter in error, please contact the office at (800)377-8540.\n\nRegards,\n\nMatchMaker International");
      }

    
    public void setFields(String name, String firstName, String streetAddress, String cityStateZip, String memberNumber, String date) {
        nameField.setText(name);
        streetAddressField.setText(streetAddress);
        cityStateZipField.setText(cityStateZip);
        memberNumberField.setText(memberNumber);
        dateField.setText(date);
        firstNameField.setText("Dear " + firstName + ",");
    }


    public void setTermDates(String date1, String date2, String date3, String termDate) {
        dateOfFirstLetter = date1;
        dateOfSecondLetter = date2;
        dateOfThirdLetter = date3;
        responseDate = termDate;
        this.dateOfFirstLetter = date1.toString();
        this.dateOfSecondLetter = date2.toString();
        this.dateOfThirdLetter = date3.toString();
    }
    
    public void print() {
        PrintUtilities printUtil = new PrintUtilities (this.getContentPane());

        PageFormat myPageFormat = new PageFormat();
        myPageFormat.setOrientation(myPageFormat.PORTRAIT);

        Paper paperType = new Paper();
        paperType.setImageableArea(72.0, 72.0, 545.0, 725.0);

        myPageFormat.setPaper(paperType);
        printUtil.setPageFormat(myPageFormat);
        printUtil.setPrintJobName("Status Letter - " + nameField.getText());
        //printUtil.setPageSize(.95, .95);
        this.setVisible(true);
                
        printUtil.print();
    }
    
    public int print(Graphics g, PageFormat pageFormat, int pageIndex) {
        Graphics2D g2d = (Graphics2D)g;
        g2d.translate(pageFormat.getImageableX(), pageFormat.getImageableY());
                
        this.setVisible(true);
        disableDoubleBuffering(this);
        this.paint(g2d);
        enableDoubleBuffering(this);
        
        return(PAGE_EXISTS);
    }
    
    /** The speed and quality of printing suffers dramatically if
    *  any of the containers have double buffering turned on.
    *  So this turns if off globally.
    *  @see enableDoubleBuffering
    */
    public static void disableDoubleBuffering(Component c) {
        RepaintManager currentManager = RepaintManager.currentManager(c);
        currentManager.setDoubleBufferingEnabled(false);
    }

    /** Re-enables double buffering globally. */
    public static void enableDoubleBuffering(Component c) {
        RepaintManager currentManager = RepaintManager.currentManager(c);
        currentManager.setDoubleBufferingEnabled(true);
    }


    
    /** This method is called from within the constructor to
     * initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is
     * always regenerated by the Form Editor.
     */
    // <editor-fold defaultstate="collapsed" desc="Generated Code">                          
    private void initComponents() {
        java.awt.GridBagConstraints gridBagConstraints;

        jLabel1 = new javax.swing.JLabel();
        jScrollPane1 = new javax.swing.JScrollPane();
        messageField = new javax.swing.JTextArea();
        jLabel2 = new javax.swing.JLabel();
        jLabel3 = new javax.swing.JLabel();
        jLabel4 = new javax.swing.JLabel();
        jLabel5 = new javax.swing.JLabel();
        nameField = new javax.swing.JTextField();
        streetAddressField = new javax.swing.JTextField();
        memberNumberField = new javax.swing.JTextField();
        dateField = new javax.swing.JTextField();
        firstNameField = new javax.swing.JTextField();
        cityStateZipField = new javax.swing.JTextField();
        jLabel6 = new javax.swing.JLabel();
        jLabel7 = new javax.swing.JLabel();
        jLabel8 = new javax.swing.JLabel();
        jLabel9 = new javax.swing.JLabel();
        jLabel10 = new javax.swing.JLabel();

        setTitle("Status Letter");
        getContentPane().setLayout(new java.awt.GridBagLayout());

        jLabel1.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
        jLabel1.setIcon(new javax.swing.ImageIcon(getClass().getResource("/membersinformation/pictures/Logo.PNG"))); // NOI18N
        jLabel1.setMaximumSize(new java.awt.Dimension(252, 68));
        jLabel1.setMinimumSize(new java.awt.Dimension(252, 68));
        jLabel1.setPreferredSize(new java.awt.Dimension(252, 68));
        gridBagConstraints = new java.awt.GridBagConstraints();
        gridBagConstraints.gridwidth = java.awt.GridBagConstraints.REMAINDER;
        gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH;
        gridBagConstraints.insets = new java.awt.Insets(3, 3, 0, 3);
        getContentPane().add(jLabel1, gridBagConstraints);

        jScrollPane1.setBorder(null);
        jScrollPane1.setPreferredSize(new java.awt.Dimension(464, 425));

        messageField.setColumns(20);
        messageField.setFont(new java.awt.Font("Times New Roman", 0, 12)); // NOI18N
        messageField.setLineWrap(true);
        messageField.setRows(5);
        messageField.setWrapStyleWord(true);
        messageField.setBorder(null);
        messageField.setPreferredSize(new java.awt.Dimension(250, 420));
        jScrollPane1.setViewportView(messageField);

        gridBagConstraints = new java.awt.GridBagConstraints();
        gridBagConstraints.gridx = 0;
        gridBagConstraints.gridy = 7;
        gridBagConstraints.gridwidth = java.awt.GridBagConstraints.REMAINDER;
        gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH;
        gridBagConstraints.insets = new java.awt.Insets(3, 3, 3, 3);
        getContentPane().add(jScrollPane1, gridBagConstraints);

        jLabel2.setFont(new java.awt.Font("Times New Roman", 0, 12)); // NOI18N
        jLabel2.setText("Name:");
        gridBagConstraints = new java.awt.GridBagConstraints();
        gridBagConstraints.gridx = 0;
        gridBagConstraints.gridy = 3;
        gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH;
        gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
        gridBagConstraints.insets = new java.awt.Insets(3, 3, 3, 3);
        getContentPane().add(jLabel2, gridBagConstraints);

        jLabel3.setFont(new java.awt.Font("Times New Roman", 0, 12)); // NOI18N
        jLabel3.setText("Address:");
        gridBagConstraints = new java.awt.GridBagConstraints();
        gridBagConstraints.gridx = 0;
        gridBagConstraints.gridy = 4;
        gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH;
        gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
        gridBagConstraints.insets = new java.awt.Insets(3, 3, 3, 3);
        getContentPane().add(jLabel3, gridBagConstraints);

        jLabel4.setFont(new java.awt.Font("Times New Roman", 0, 12)); // NOI18N
        jLabel4.setText("Member Number:");
        gridBagConstraints = new java.awt.GridBagConstraints();
        gridBagConstraints.gridx = 2;
        gridBagConstraints.gridy = 3;
        gridBagConstraints.gridwidth = 2;
        gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH;
        gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
        gridBagConstraints.insets = new java.awt.Insets(3, 50, 3, 3);
        getContentPane().add(jLabel4, gridBagConstraints);

        jLabel5.setFont(new java.awt.Font("Times New Roman", 0, 12)); // NOI18N
        jLabel5.setText("Date:");
        gridBagConstraints = new java.awt.GridBagConstraints();
        gridBagConstraints.gridx = 2;
        gridBagConstraints.gridy = 4;
        gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH;
        gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
        gridBagConstraints.insets = new java.awt.Insets(3, 50, 3, 3);
        getContentPane().add(jLabel5, gridBagConstraints);

        nameField.setFont(new java.awt.Font("Times New Roman", 0, 12)); // NOI18N
        nameField.setBorder(null);
        nameField.setPreferredSize(new java.awt.Dimension(150, 20));
        gridBagConstraints = new java.awt.GridBagConstraints();
        gridBagConstraints.gridx = 1;
        gridBagConstraints.gridy = 3;
        gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH;
        gridBagConstraints.insets = new java.awt.Insets(3, 3, 3, 3);
        getContentPane().add(nameField, gridBagConstraints);

        streetAddressField.setFont(new java.awt.Font("Times New Roman", 0, 12)); // NOI18N
        streetAddressField.setBorder(null);
        streetAddressField.setPreferredSize(new java.awt.Dimension(150, 20));
        gridBagConstraints = new java.awt.GridBagConstraints();
        gridBagConstraints.gridx = 1;
        gridBagConstraints.gridy = 4;
        gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH;
        gridBagConstraints.insets = new java.awt.Insets(3, 3, 3, 3);
        getContentPane().add(streetAddressField, gridBagConstraints);

        memberNumberField.setFont(new java.awt.Font("Times New Roman", 0, 12)); // NOI18N
        memberNumberField.setBorder(null);
        memberNumberField.setPreferredSize(new java.awt.Dimension(100, 20));
        gridBagConstraints = new java.awt.GridBagConstraints();
        gridBagConstraints.gridx = 4;
        gridBagConstraints.gridy = 3;
        gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH;
        gridBagConstraints.insets = new java.awt.Insets(3, 3, 3, 3);
        getContentPane().add(memberNumberField, gridBagConstraints);

        dateField.setFont(new java.awt.Font("Times New Roman", 0, 12)); // NOI18N
        dateField.setBorder(null);
        dateField.setPreferredSize(new java.awt.Dimension(100, 20));
        gridBagConstraints = new java.awt.GridBagConstraints();
        gridBagConstraints.gridx = 3;
        gridBagConstraints.gridy = 4;
        gridBagConstraints.gridwidth = 2;
        gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH;
        gridBagConstraints.insets = new java.awt.Insets(3, 3, 3, 3);
        getContentPane().add(dateField, gridBagConstraints);

        firstNameField.setFont(new java.awt.Font("Times New Roman", 0, 12)); // NOI18N
        firstNameField.setText("Dear");
        firstNameField.setBorder(null);
        gridBagConstraints = new java.awt.GridBagConstraints();
        gridBagConstraints.gridx = 0;
        gridBagConstraints.gridy = 6;
        gridBagConstraints.gridwidth = 2;
        gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH;
        gridBagConstraints.insets = new java.awt.Insets(3, 3, 20, 3);
        getContentPane().add(firstNameField, gridBagConstraints);

        cityStateZipField.setFont(new java.awt.Font("Times New Roman", 0, 12)); // NOI18N
        cityStateZipField.setBorder(null);
        cityStateZipField.setPreferredSize(new java.awt.Dimension(150, 20));
        gridBagConstraints = new java.awt.GridBagConstraints();
        gridBagConstraints.gridx = 1;
        gridBagConstraints.gridy = 5;
        gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH;
        gridBagConstraints.insets = new java.awt.Insets(3, 3, 25, 3);
        getContentPane().add(cityStateZipField, gridBagConstraints);

        jLabel6.setFont(new java.awt.Font("Times New Roman", 0, 10)); // NOI18N
        jLabel6.setText("Email: matchmakerintl@sbcglobal.net");
        gridBagConstraints = new java.awt.GridBagConstraints();
        gridBagConstraints.gridx = 0;
        gridBagConstraints.gridy = 8;
        gridBagConstraints.gridwidth = 2;
        gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH;
        gridBagConstraints.insets = new java.awt.Insets(20, 3, 0, 0);
        getContentPane().add(jLabel6, gridBagConstraints);

        jLabel7.setFont(new java.awt.Font("Times New Roman", 0, 10)); // NOI18N
        jLabel7.setText("Office: (616) 827-1700");
        gridBagConstraints = new java.awt.GridBagConstraints();
        gridBagConstraints.gridx = 2;
        gridBagConstraints.gridy = 8;
        gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH;
        gridBagConstraints.insets = new java.awt.Insets(20, 0, 0, 0);
        getContentPane().add(jLabel7, gridBagConstraints);

        jLabel8.setFont(new java.awt.Font("Times New Roman", 0, 10)); // NOI18N
        jLabel8.setText("Fax: (616) 827-8042");
        gridBagConstraints = new java.awt.GridBagConstraints();
        gridBagConstraints.gridx = 4;
        gridBagConstraints.gridy = 8;
        gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH;
        gridBagConstraints.insets = new java.awt.Insets(20, 0, 0, 3);
        getContentPane().add(jLabel8, gridBagConstraints);

        jLabel9.setFont(new java.awt.Font("Times New Roman", 0, 10)); // NOI18N
        jLabel9.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
        jLabel9.setText("2450 44th ST SE Suite 205      ");
        gridBagConstraints = new java.awt.GridBagConstraints();
        gridBagConstraints.gridx = 0;
        gridBagConstraints.gridy = 1;
        gridBagConstraints.gridwidth = java.awt.GridBagConstraints.REMAINDER;
        gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH;
        gridBagConstraints.insets = new java.awt.Insets(0, 3, 0, 3);
        getContentPane().add(jLabel9, gridBagConstraints);

        jLabel10.setFont(new java.awt.Font("Times New Roman", 0, 10)); // NOI18N
        jLabel10.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
        jLabel10.setText("Kentwood, MI 49512       ");
        gridBagConstraints = new java.awt.GridBagConstraints();
        gridBagConstraints.gridx = 0;
        gridBagConstraints.gridy = 2;
        gridBagConstraints.gridwidth = java.awt.GridBagConstraints.REMAINDER;
        gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH;
        gridBagConstraints.insets = new java.awt.Insets(0, 3, 25, 3);
        getContentPane().add(jLabel10, gridBagConstraints);

        pack();
    }// </editor-fold>                        

    public String dateOfFirstLetter;
    public String dateOfSecondLetter;
    public String dateOfThirdLetter;
    public String responseDate;
    public String DDateformat;
   
    // Variables declaration - do not modify                     
    private javax.swing.JTextField cityStateZipField;
    private javax.swing.JTextField dateField;
    private javax.swing.JTextField firstNameField;
    private javax.swing.JLabel jLabel1;
    private javax.swing.JLabel jLabel10;
    private javax.swing.JLabel jLabel2;
    private javax.swing.JLabel jLabel3;
    private javax.swing.JLabel jLabel4;
    private javax.swing.JLabel jLabel5;
    private javax.swing.JLabel jLabel6;
    private javax.swing.JLabel jLabel7;
    private javax.swing.JLabel jLabel8;
    private javax.swing.JLabel jLabel9;
    private javax.swing.JScrollPane jScrollPane1;
    private javax.swing.JTextField memberNumberField;
    private javax.swing.JTextArea messageField;
    private javax.swing.JTextField nameField;
    private javax.swing.JTextField streetAddressField;
    // End of variables declaration                   
    
}

</code>
Status.java
<code>
/*
 * Status.java
 *
 * Created on June 24, 2006, 2:56 PM
 *
 * To change this template, choose Tools | Template Manager
 * and open the template in the editor.
 */

package membersinformation.forms;
import membersinformation.components.TempDataModel;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;

public class Status {
    
    /** Creates a new instance of Status */
    public Status() {
        DAO = new DataAccessObject();
    }
    
    public ResultSet getPhoneDiscInfo() {
        ResultSet rs = null;
                
        try {
            String query = "SELECT CONCAT(FirstName, \" \", LastName) AS FullName, FirstName, LastName, " +
                                "Status.MemberNumber, letter AS FirstLetter, " +
                                "DATE_FORMAT(DateOfFirstLetter, '%m/%d/%Y'), " +
                                "DATE_FORMAT(DateOfSecondLetter, '%m/%d/%Y'), " +
                                "DATE_FORMAT(DateOfThirdLetter, '%m/%d/%Y'), " +
                                "DATE_FORMAT(TerminationDate, '%m/%d/%Y'), " +
                                "StreetAddress, City, State, Zip " +
                           "FROM Status, MembersInformation, StatusLetters " +
                           "WHERE Status.MemberNumber = MembersInformation.MemberNumber AND " +
                                 "Status.FirstLetter = StatusLetters.ID AND " +
                                 "(dateOfFirstLetter IS NULL AND " +
                                 "FirstLetter = 1)";
            
            PreparedStatement pstmt = DAO.prepareStatement(query);
            rs = DAO.executeQuery(pstmt);
        } catch (Exception e) {
            e.printStackTrace();
            WarningMessage warning = new WarningMessage(true, (String) e.getMessage(), WarningMessage.CRITICAL_ERROR);
            warning.setVisible(true);
        }
        
        return rs;
    }
    
    public TempDataModel getPhoneDiscDataModel() {
        TempDataModel aModel = null;
                
        try {
            String query = "SELECT CONCAT(FirstName, \" \", LastName) AS FullName, FirstName, LastName, " +
                                "Status.MemberNumber, letter AS FirstLetter, " +
                                "DATE_FORMAT(DateOfFirstLetter, '%m/%d/%Y'), " +
                                "DATE_FORMAT(DateOfSecondLetter, '%m/%d/%Y'), " +
                                "DATE_FORMAT(DateOfThirdLetter, '%m/%d/%Y'), " +
                                "DATE_FORMAT(TerminationDate, '%m/%d/%Y'), " +
                                "StreetAddress, City, State, Zip " +
                           "FROM Status, MembersInformation, StatusLetters " +
                           "WHERE Status.MemberNumber = MembersInformation.MemberNumber AND " +
                                 "Status.FirstLetter = StatusLetters.ID AND " +
                                 "(dateOfFirstLetter IS NULL AND " +
                                 "FirstLetter = 1)";
            
            PreparedStatement pstmt = DAO.prepareStatement(query);
            ResultSet rs = DAO.executeQuery(pstmt);
            
            /* Set which columns will be visible */
            boolean[] visibleColumns = {true, false, false, false, false, false, false, false, false, false, false, false, false};
            
            aModel = new TempDataModel(rs, visibleColumns);
            aModel.setColumnName(0, "Phone Disconnection Letters");
            
            /* Close the connection to the database */
            rs.close();
            pstmt.close();
        } catch (Exception e) {
            e.printStackTrace();
            WarningMessage warning = new WarningMessage(true, (String) e.getMessage(), WarningMessage.CRITICAL_ERROR);
            warning.setVisible(true);
        }
        
        return aModel;
    }

    public ResultSet getFeedbackInfo() {
        ResultSet rs = null;
                
        try {
            String query = "SELECT CONCAT(FirstName, \" \", LastName) AS FullName, " +
                                  "FirstName, LastName, Status.MemberNumber, " +
                                  "Letter AS FirstLetter, DateOfFirstLetter, " +
                                  "DateOfSecondLetter, DateOfThirdLetter, " +
                                  "TerminationDate, StreetAddress, City, State, " +
                                  "Zip " +
                           "FROM Status, StatusLetters, MembersInformation " +
                           "WHERE Status.MemberNumber = MembersInformation.MemberNumber AND " +
                                 "Status.FirstLetter = StatusLetters.ID AND " +
                                 "(dateOfFirstLetter IS NULL AND " +
                                 "FirstLetter = 0)";
            
            PreparedStatement pstmt = DAO.prepareStatement(query);
            rs = DAO.executeQuery(pstmt);
        } catch (Exception e) {
            e.printStackTrace();
            WarningMessage warning = new WarningMessage(true, (String) e.getMessage(), WarningMessage.CRITICAL_ERROR);
            warning.setVisible(true);
        }
        
        return rs;
    }
    
    public TempDataModel getFeedbackDataModel() {
        TempDataModel aModel = null;
                
        try {
            String query = "SELECT CONCAT(FirstName, \" \", LastName) AS FullName, " +
                                  "FirstName, LastName, Status.MemberNumber, " +
                                  "Letter AS FirstLetter, " +
                                  "DATE_FORMAT(DateOfFirstLetter, '%m/%d/%Y'), " +
                                  "DATE_FORMAT(DateOfSecondLetter, '%m/%d/%Y'), " +
                                  "DATE_FORMAT(DateOfThirdLetter, '%m/%d/%Y'), " +
                                  "DATE_FORMAT(TerminationDate, '%m/%d/%Y'), " +
                                  "StreetAddress, City, State, Zip " +
                           "FROM Status, StatusLetters, MembersInformation " +
                           "WHERE Status.MemberNumber = MembersInformation.MemberNumber AND " +
                                 "Status.FirstLetter = StatusLetters.ID AND " +
                                 "(dateOfFirstLetter IS NULL AND " +
                                 "FirstLetter = 0)";
            
            PreparedStatement pstmt = DAO.prepareStatement(query);
            ResultSet rs = DAO.executeQuery(pstmt);
            
            /* Set which columns will be visible */
            boolean[] visibleColumns = {true, false, false, false, false, false, false, false, false, false, false, false, false, false};
            
            aModel = new TempDataModel(rs, visibleColumns);
            aModel.setColumnName(0, "Feedback Letters");
            
            /* Close the connection to the database */
            rs.close();
            pstmt.close();
        } catch (Exception e) {
            e.printStackTrace();
            WarningMessage warning = new WarningMessage(true, (String) e.getMessage(), WarningMessage.CRITICAL_ERROR);
            warning.setVisible(true);            
        }
        
        return aModel;
    }
    
    public ResultSet getStatusInfo() {
        ResultSet rs = null;
                
        try {
            String query = "SELECT CONCAT(FirstName, \" \", LastName) AS FullName, " +
                                  "FirstName, LastName, Status.MemberNumber, " +
                                  "Letter AS FirstLetter, DateOfFirstLetter, " +
                                  "DateOfSecondLetter, DateOfThirdLetter, " +
                                  "TerminationDate, StreetAddress, City, " +
                                  "State, Zip " +
                           "FROM Status, StatusLetters, MembersInformation " +
                           "WHERE Status.MemberNumber = MembersInformation.MemberNumber AND " +
                                 "Status.FirstLetter = StatusLetters.ID AND " +
                                 "((dateOfFirstLetter IS NOT NULL AND " +
                                 "(dateOfSecondLetter IS NULL OR dateOfThirdLetter IS NULL)) OR " +
                                 "(dateOfFirstLetter IS NULL AND FirstLetter = 2))";
            
            PreparedStatement pstmt = DAO.prepareStatement(query);
            rs = DAO.executeQuery(pstmt);
        } catch (Exception e) {
            e.printStackTrace();
            WarningMessage warning = new WarningMessage(true, (String) e.getMessage(), WarningMessage.CRITICAL_ERROR);
            warning.setVisible(true);
        }
        
        return rs;
    }
    
    public TempDataModel getStatusDataModel() {
        TempDataModel aModel = null;
                
        try {
            String query = "SELECT CONCAT(FirstName, \" \", LastName) AS FullName, " +
                                  "FirstName, LastName, Status.MemberNumber, " +
                                  "Letter AS FirstLetter, " +
                                  "DATE_FORMAT(DateOfFirstLetter, '%m/%d/%Y'), " +
                                  "DATE_FORMAT(DateOfSecondLetter, '%m/%d/%Y'), " +
                                  "DATE_FORMAT(DateOfThirdLetter, '%m/%d/%Y'), " +
                                  "DATE_FORMAT(TerminationDate, '%m/%d/%Y'), " +
                                  "StreetAddress, City, State, Zip " +
                           "FROM Status, StatusLetters, MembersInformation " +
                           "WHERE Status.MemberNumber = MembersInformation.MemberNumber AND " +
                                 "Status.FirstLetter = StatusLetters.ID AND " +
                                 "((dateOfFirstLetter IS NOT NULL AND " +
                                 "(dateOfSecondLetter IS NULL OR dateOfThirdLetter IS NULL)) OR " +
                                 "(dateOfFirstLetter IS NULL AND FirstLetter = 2))";
            
            PreparedStatement pstmt = DAO.prepareStatement(query);
            ResultSet rs = DAO.executeQuery(pstmt);
            
            /* Sets which columns will be visible */
            boolean[] visibleColumns = {true, false, false, false, false, false, false, false, false, false, false, false, false, false};
            
            aModel = new TempDataModel(rs, visibleColumns);
            aModel.setColumnName(0, "Status Letters:");
            
            /* Close the connection to the database */
            rs.close();
            pstmt.close();
        } catch (Exception e) {
            e.printStackTrace();
            WarningMessage warning = new WarningMessage(true, (String) e.getMessage(), WarningMessage.CRITICAL_ERROR);
            warning.setVisible(true);
        }
        
        return aModel;
    }
    
    public ResultSet getTerminationInfo() {
        ResultSet rs = null;
                
        try {
            String query = "SELECT CONCAT(FirstName, \" \", LastName) AS FullName, FirstName, " +
                                  "LastName, Status.MemberNumber, Letter AS FirstLetter, " +
                                  "DateOfFirstLetter, DateOfSecondLetter, DateOfThirdLetter, " +
                                  "TerminationDate, StreetAddress, City, State, Zip " +
                           "FROM Status, StatusLetters, MembersInformation " +
                           "WHERE Status.MemberNumber = MembersInformation.MemberNumber AND " +
                                 "Status.FirstLetter = StatusLetters.ID AND " +
                                 "dateOfThirdLetter IS NOT NULL AND " +
                                 "TerminationDate IS NULL";
            
            PreparedStatement pstmt = DAO.prepareStatement(query);
            rs = DAO.executeQuery(pstmt);
        } catch (Exception e) {
            e.printStackTrace();
            WarningMessage warning = new WarningMessage(true, (String) e.getMessage(), WarningMessage.CRITICAL_ERROR);
            warning.setVisible(true);
        }
        
        return rs;
    }
    
    public TempDataModel getTerminationDataModel() {
        TempDataModel aModel = null;
                
        try {
            String query = "SELECT CONCAT(FirstName, \" \", LastName) AS FullName, FirstName, " +
                                  "LastName, Status.MemberNumber, Letter AS FirstLetter, " +
                                  "DATE_FORMAT(DateOfFirstLetter, '%m/%d/%Y'), " +
                                  "DATE_FORMAT(DateOfSecondLetter, '%m/%d/%Y'), " +
                                  "DATE_FORMAT(DateOfThirdLetter, '%m/%d/%Y'), " +
                                  "DATE_FORMAT(TerminationDate, '%m/%d/%Y'), " +
                                  "StreetAddress, City, State, Zip " +
                           "FROM Status, StatusLetters, MembersInformation " +
                           "WHERE Status.MemberNumber = MembersInformation.MemberNumber AND " +
                                 "Status.FirstLetter = StatusLetters.ID AND " +
                                 "dateOfThirdLetter IS NOT NULL AND " +
                                 "TerminationDate IS NULL";
            
            PreparedStatement pstmt = DAO.prepareStatement(query);
            ResultSet rs = pstmt.executeQuery();
            
            /* Set which columns will be visible */
            boolean[] visibleColumns = {true, false, false, false, false, false, false, false, false, false, false, false, false, false};
            
            aModel = new TempDataModel(rs, visibleColumns);
            aModel.setColumnName(0, "Termination Letters");
            
            /* Close the connection to the database */
            rs.close();
            pstmt.close();
        } catch (Exception e) {
            e.printStackTrace();
            WarningMessage warning = new WarningMessage(true, (String) e.getMessage(), WarningMessage.CRITICAL_ERROR);
            warning.setVisible(true);
        }
        
        return aModel;
    }
    
    public ResultSet getTerminatedMembersInfo() {
        ResultSet rs = null;
                
        try {
            String query = "SELECT CONCAT(FirstName, \" \", LastName) AS FullName, FirstName, " +
                                "LastName, Status.MemberNumber, Letter AS FirstLetter, " +
                                "DateOfFirstLetter, DateOfSecondLetter, DateOfThirdLetter, TerminationDate " +
                           "FROM Status, StatusLetters, MembersInformation " +
                           "WHERE Status.MemberNumber = MembersInformation.MemberNumber AND " +
                                 "Status.FirstLetter = StatusLetters.ID AND " +
                                 "(TerminationDate <= NOW())";
            
            PreparedStatement pstmt = DAO.prepareStatement(query);
            rs = DAO.executeQuery(pstmt);
        } catch (Exception e) {
            e.printStackTrace();
            WarningMessage warning = new WarningMessage(true, (String) e.getMessage(), WarningMessage.CRITICAL_ERROR);
            warning.setVisible(true);
        }
        
        return rs;
    }
    
    public TempDataModel getTerminatedMembersDataModel() {
        TempDataModel aModel = null;
                
        try {
            String query = "SELECT CONCAT(FirstName, \" \", LastName) AS FullName, FirstName, " +
                                "LastName, Status.MemberNumber, Letter AS FirstLetter, " +
                                "DATE_FORMAT(DateOfFirstLetter, '%m/%d/%Y'), " +
                                "DATE_FORMAT(DateOfSecondLetter, '%m/%d/%Y'), " +
                                "DATE_FORMAT(DateOfThirdLetter, '%m/%d/%Y'), " +
                                "DATE_FORMAT(TerminationDate, '%m/%d/%Y') " +
                           "FROM Status, StatusLetters, MembersInformation " +
                           "WHERE Status.MemberNumber = MembersInformation.MemberNumber AND " +
                                 "Status.FirstLetter = StatusLetters.ID AND " +
                                 "(TerminationDate <= NOW())";
            
            PreparedStatement pstmt = DAO.prepareStatement(query);
            ResultSet rs = DAO.executeQuery(pstmt);
            
            /* Set which columns will be visible */
            boolean[] visibleColumns = {true, false, false, false, false, false, false, false, false, false};
            
            aModel = new TempDataModel(rs, visibleColumns);
            aModel.setColumnName(0, "Terminated Members");
            
            /* Close the connection to the database */
            rs.close();
            pstmt.close();
        } catch (Exception e) {
            e.printStackTrace();
            WarningMessage warning = new WarningMessage(true, (String) e.getMessage(), WarningMessage.CRITICAL_ERROR);
            warning.setVisible(true);
        }
        
        return aModel;
    }
    
    public void updateCurrentLetter(int memberNumber, String dateOfFirstLetter, String dateOfSecondLetter, String dateOfThirdLetter) {
        String query;
                
        if (dateOfFirstLetter.equals("")) {
            query = "UPDATE Status SET DateOfFirstLetter = NOW() WHERE MemberNumber = ?";
        }
        else if (dateOfSecondLetter.equals("")) {
            query = "UPDATE Status SET DateOfSecondLetter = NOW() WHERE MemberNumber = ?";// AND DateOfFirstLetter <> NOW()";
        }
        else if (dateOfThirdLetter.equals("")) {
            query = "UPDATE Status SET DateOfThirdLetter = NOW() WHERE MemberNumber = ?";// AND DateOfSecondLetter <> NOW()";
        }
        else query = "UPDATE Status SET TerminationDate = NOW() WHERE MemberNumber = ?";// AND DateOfThirdLetter <> NOW()";

        try {
            PreparedStatement pstmt = DAO.prepareStatement(query);

            pstmt.setInt(1, memberNumber);
            pstmt.executeUpdate(query);
            
            /* Close the connection to the database */
            pstmt.close();
        } catch (SQLException exc) {
            exc.printStackTrace();
            WarningMessage warning = new WarningMessage(true, exc.getMessage(), WarningMessage.CRITICAL_ERROR);
            warning.setVisible(true);
        }
    }
    
    public void documentLetters() {
        // Checks status table for non-status members
        String statusCleanUp = "DELETE FROM status " +
                               "WHERE membernumber in (select membernumber " +
                                    "from membersinformation " +
                                    "where status <> 'status - feedback' " +
                                        "and status <> 'status - status' " +
                                        "and status <> 'status - phone disconnection' " +
                                        "and status <> 'Terminated')";
        
        String docLetter1 = "UPDATE StatusMembers SET DateOfFirstLetter = NOW() WHERE DateOfFirstLetter IS NULL";
        String docLetter2 = "UPDATE StatusMembers SET DateOfSecondLetter = NOW() WHERE DateOfSecondLetter IS NULL AND DateOfFirstLetter IS NOT NULL";
        String docLetter3 = "UPDATE StatusMembers SET DateOfThirdLetter = NOW() WHERE DateOfThirdLetter IS NULL AND DateOfSecondLetter IS NOT NULL";
        String docTermLetters = "UPDATE StatusMembers SET TerminationDate = ADDDATE(NOW(), 15) WHERE DateOfThirdLetter IS NOT NULL AND DateOfSecondLetter IS NOT NULL";
        String terminateMembers = "DELETE FROM Status WHERE DateOfFirstLetter Is Not Null And DateOfSecondLetter Is Not Null And DateOfThirdLetter Is Not Null And TerminationDate <= NOW()";
        String terminateMembers2 = "UPDATE MembersInformation SET Status = 'Terminated' WHERE MemberNumber in (SELECT MemberNumber FROM Status WHERE DateOfFirstLetter Is Not Null And DateOfSecondLetter Is Not Null And DateOfThirdLetter Is Not Null And TerminationDate IS NOT NULL)";
                 
        String date = membersinformation.utilities.UtilitiesDB.getDate();
        String docMemFeedbackLetters = "UPDATE MembersInformation mi " +
                    "SET matches = CONCAT(\"" + date + " Feedback Letter Sent\\n\", matches) " +
                    "WHERE mi.MemberNumber IN (SELECT MemberNumber " +
                                              "FROM Status " +
                                              "WHERE Status.FirstLetter = 0 AND " +
                                                    "dateOfFirstLetter IS NULL)";
        
        String docMemPhoneDiscLetters = "UPDATE MembersInformation mi " +
                    "SET matches = CONCAT(\"" + date + " Phone Disconnection Letter Sent\\n\", matches) " +
                    "WHERE mi.MemberNumber IN (SELECT MemberNumber " +
                                              "FROM Status " +
                                              "WHERE Status.FirstLetter = 1 AND " +
                                                    "dateOfFirstLetter IS NULL)";
                
        String docMemStatusLetters = "UPDATE MembersInformation mi " +
                    "SET matches = CONCAT(\"" + date + " Status Letter Sent\\n\", matches) " +
                    "WHERE mi.MemberNumber IN (SELECT MemberNumber " +
                                              "FROM Status " +
                                              "WHERE (Status.FirstLetter = 1 AND " +
                                                     "dateOfFirstLetter IS NULL) " +
                                                     "OR (DateOfThirdLetter IS NULL " +
                                                     "AND DateOfFirstLetter IS NOT NULL))";
        
        String docMemTermLetters = "UPDATE MembersInformation mi " +
                    "SET matches = CONCAT(\"" + date + " Termination Letter Sent\\n\", matches) " +
                    "WHERE MemberNumber in (SELECT MemberNumber " +
                                           "FROM Status " +
                                           "WHERE DateOfFirstLetter Is Not Null " +
                                                 "And DateOfSecondLetter Is Not Null " +
                                                 "And DateOfThirdLetter Is Not Null " +
                                                 "And TerminationDate IS NOT NULL)";
        
        System.out.println(terminateMembers);
        System.out.println(terminateMembers2);
        System.out.println(docTermLetters);
        System.out.println(docLetter3);
        System.out.println(docLetter2);
        System.out.println(docLetter1);

        try {
            
            PreparedStatement pstmt = DAO.prepareStatement(docMemFeedbackLetters);
            DAO.execute(pstmt);
            
            pstmt = DAO.prepareStatement(docMemPhoneDiscLetters);
            DAO.execute(pstmt);
            
            pstmt = DAO.prepareStatement(docMemStatusLetters);
            DAO.execute(pstmt);
            
            pstmt = DAO.prepareStatement(docMemTermLetters);
            DAO.execute(pstmt);
            
            pstmt = DAO.prepareStatement(docTermLetters);
            DAO.execute(pstmt);
            
            pstmt = DAO.prepareStatement(terminateMembers2);
            DAO.execute(pstmt);
            
            pstmt = DAO.prepareStatement(terminateMembers);
            DAO.execute(pstmt);

            pstmt = DAO.prepareStatement(docLetter3);
            DAO.execute(pstmt);

            pstmt = DAO.prepareStatement(docLetter2);
            DAO.execute(pstmt);

            pstmt = DAO.prepareStatement(docLetter1);
            DAO.execute(pstmt);
            
            pstmt = DAO.prepareStatement(statusCleanUp);
            DAO.execute(pstmt);
            
            /* Close the connection to the database */
            pstmt.close();
        } catch (SQLException exc) {
            exc.printStackTrace();
            WarningMessage warning = new WarningMessage(true, exc.getMessage(), WarningMessage.CRITICAL_ERROR);
            warning.setVisible(true);
        }
    }
        
    public ResultSet getPrintPhoneDiscInfo() {
        ResultSet rs = null;
                
        try {
            String query = "SELECT CONCAT(FirstName, \" \", LastName) AS FullName, " +
                                  "FirstName, Status.MemberNumber, StreetAddress, City, " +
                                  "State, Zip " +
                           "FROM Status, MembersInformation, StatusLetters " +
                           "WHERE Status.MemberNumber = MembersInformation.MemberNumber AND " +
                                 "Status.FirstLetter = StatusLetters.ID AND " +
                                 "(DateOfFirstLetter IS NULL AND FirstLetter = 1)";

            PreparedStatement pstmt = DAO.prepareStatement(query);
            rs = DAO.executeQuery(pstmt);
        } catch (Exception e) {
            e.printStackTrace();
            WarningMessage warning = new WarningMessage(true, (String) e.getMessage(), WarningMessage.CRITICAL_ERROR);
            warning.setVisible(true);
        }
        
        return rs;
    }

    public ResultSet getPrintFeedbackInfo() {
        ResultSet rs = null;
                
        try {
            String query = "SELECT CONCAT(FirstName, \" \", LastName) AS FullName, " +
                                          "FirstName, Status.MemberNumber, StreetAddress, " +
                                          "City, State, Zip " +
                                   "FROM Status, MembersInformation, StatusLetters " +
                                   "WHERE Status.MemberNumber = MembersInformation.MemberNumber AND " +
                                         "Status.FirstLetter = StatusLetters.ID AND " +
                                         "(DateOfFirstLetter IS NULL AND FirstLetter = 0)";
            
            PreparedStatement pstmt = DAO.prepareStatement(query);
            rs = DAO.executeQuery(pstmt);
        } catch (Exception e) {
            e.printStackTrace();
            WarningMessage warning = new WarningMessage(true, (String) e.getMessage(), WarningMessage.CRITICAL_ERROR);
            warning.setVisible(true);
        }
        
        return rs;
    }
    
    public ResultSet getPrintStatusInfo() {
        ResultSet rs = null;
                
        try {
            String query = "SELECT CONCAT(FirstName, \" \", LastName) AS FullName, " +
                                          "FirstName, Status.MemberNumber, StreetAddress, " +
                                          "City, State, Zip " +
                                   "FROM Status, MembersInformation, " +
                                          "StatusLetters " +
                                   "WHERE Status.MemberNumber = MembersInformation.MemberNumber AND " +
                                         "Status.FirstLetter = StatusLetters.ID AND " +
                                         "((dateOfFirstLetter IS NOT NULL AND " +
                                         "(dateOfSecondLetter IS NULL OR dateOfThirdLetter IS NULL)) OR " +
                                         "(dateOfFirstLetter IS NULL AND FirstLetter = 2))";
            
            PreparedStatement pstmt = DAO.prepareStatement(query);
            rs = DAO.executeQuery(pstmt);
        } catch (Exception e) {
            e.printStackTrace();
            WarningMessage warning = new WarningMessage(true, (String) e.getMessage(), WarningMessage.CRITICAL_ERROR);
            warning.setVisible(true);
        }
        
        return rs;
    }
    
    public ResultSet getPrintTerminationInfo() {
        ResultSet rs = null;
                
        try {
            String query = "SELECT CONCAT(FirstName, \" \", LastName) AS FullName, " +
                                  "FirstName, Status.MemberNumber, StreetAddress, City, " +
                                  "State, Zip, DateOfFirstLetter, DateOfSecondLetter, DateOfThirdLetter " +
                           "FROM Status, MembersInformation, StatusLetters " +
                           "WHERE Status.MemberNumber = MembersInformation.MemberNumber AND " +
                                 "Status.FirstLetter = StatusLetters.ID AND " +
                                 "((dateOfFirstLetter IS NOT NULL AND " +
                                 "dateOfThirdLetter IS NOT NULL AND " +
                                 "TerminationDate IS NULL))";
            
            PreparedStatement pstmt = DAO.prepareStatement(query);
            rs = DAO.executeQuery(pstmt);
        } catch (Exception e) {
            e.printStackTrace();
            WarningMessage warning = new WarningMessage(true, (String) e.getMessage(), WarningMessage.CRITICAL_ERROR);
            warning.setVisible(true);
        }
        
        return rs;
    }
    
    private DataAccessObject DAO;
}

 
Can't you put your problem into 2 or 3 lines of code, maybe +4 lines for boilerplate main, and 4 extra lines for the class around, and 2 lines import, and 4 lines sql-connection, and 6 lines exception - totally about 20 lines?

We're surely not interested in your GUI-Design and the lettertext.

don't visit my homepage:
 
I hope I have understood your requirement/question correctly. Here is what you need to do:

In your DDateFormat class add a static method like this:

public static Date getDateInParticularFormat(Date dateToFormat, String format)
{
DateFormat formatter = new SimpleDateFormat(format);
return (Date)formatter.parse(dateToFormat);
}

After adding this, in StatusLetter.java, where ever you want the formatted date (and where you are currently using date.toString()) call this static method e.g. DDateFormat.getDateInParticularFormat(date1, "mm-dd-yyyy"). Having this method will enable you to format the date in any way you want.

Hope this will help!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top