public void firstQuery() throws SQLException
    {
        String errorMessages = "";
        ConnectToDatabaseSys connectDB = new ConnectToDatabaseSys();
        int errorCount = 0;
        //FORMAT
        
        orno = validateInputs.formatStringSpaces(orno);
        ordetail = validateInputs.formatStringSpaces(ordetail);
        billid= validateInputs.formatStringSpaces(billid);
        //THEN CHECK
        
            compid = this.getCompanyIdCombo(comboCompany.getSelectedIndex());
        
        /*try
        {
            if(!(connectDB.checkDuplicate(billid, 2)))
            {
                errorMessages += "A receipt for this bill number already exists\n";
                errorCount++;
            }
        }
        catch(Exception t)
        {
            errorMessages += "A receipt for this bill number already exists\n";
            errorCount++;
        }*/
                
        try
        {
            if(!(connectDB.checkDuplicate(orno, 3)))
            {
                errorMessages += "A receipt for this OR number already exists\n";
                errorCount++;
            }
        }
        catch(Exception t)
        {
            errorMessages += "A receipt for this OR number already exists\n";
            errorCount++;
        }
                
        if(!(validateInputs.checkForSpecial(orno)))
        {
            errorMessages += "OR Number: Cannot Contain special characters\n";
            errorCount++;
        }
        
        if(!(validateInputs.checkIfEmpty(billid)))
        {
            errorMessages += "Bill Number: Field cannot be empty\n";
            errorCount++;
        }
        
        try{  
            ordt = df.parse(ordttext);
            finaldt = df.format(ordt);
            //System.out.println(finaldt);
            
        } 
        catch (Exception p)
        { 
            //System.out.println(finaldt);
            errorMessages += "Date : Format YYYY-MM-DD\n";
            errorCount++;
        } 
                
        if(errorCount == 0)
        {
                String query = "";
                if(choice == 0)
                {
                    System.out.println(compid+" "+orno+" "+finaldt+ordetail+" "+oramt+" "+billid);
                    query = "insert into or_hdr (compid, orno, ordt, ordetail, oramt, billid)"
                            + " values ('"+ compid +"','"+ orno + "','" + finaldt + "','" + ordetail + "','"
                            + oramt + "','" + billid + "')";
                }
                /*if(choice == 1)
                {
                    query = "update company set compname='"+ companyName +"',address1='"+ companyAddress1+"',address2='"+companyAddress2+"',address3='"+companyAddress3+"'"+
                            ",contactperson='"+companyContactPerson+"',contactno1='"+companyContact1+"',contactno2='"+companyContact2+"',email='"+companyEmail+"' where compid="+companyID;                            
                    choice = 0;
                }*/
                //System.out.println(query);
                 connectDB.accessInputDatabase(query);
                 this.secondQuery();
        }
        
        else if(errorCount>0)
        {
            System.out.println(errorMessages);
            JOptionPane.showMessageDialog(null, errorMessages, "Error: Receipt Information", JOptionPane.ERROR_MESSAGE);
        }
        
    }