⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 bill.java

📁 This is basic hospital management system with essentials and is build on Java Swings."dscreen.java"
💻 JAVA
字号:
import java.awt.*;
import javax.swing.*;
import java.awt.event.*;
import java.applet.Applet.*;
import java.sql.*;
public class bill extends JFrame implements ActionListener{


        Connection cn;
        Statement stm;
	ResultSet res;
	
	
	int you;
       	
	JLabel pid= new JLabel("SELECT THE PATIENT-ID");
	JLabel name= new JLabel("PATIENT NAME");
	JLabel ay= new JLabel("ANALYSIS");
	JLabel df= new JLabel("DOCTOR FEE");		
	JLabel pf= new JLabel("PHARMACY CHARGE");
        JLabel cf= new JLabel("LAB CHARGE");
        JLabel xf= new JLabel("X-RAY CHARGE");
        JLabel sf= new JLabel("SCANNING CHARGE");
	JLabel bc= new JLabel("BED CHARGE");
        

	JTextField nam=new JTextField();
	JTextField aly=new JTextField();
	JTextField t_text= new JTextField();
	JTextField df_text= new JTextField();		
	JTextField pf_text= new JTextField();
        JTextField cf_text= new JTextField();        
        JTextField xf_text=new JTextField();
        JTextField sf_text= new JTextField();
        JTextField bc_text= new JTextField();
        
	JButton total=new JButton("TOTAL");
	JButton sm=new JButton("SUBMIT");
        JButton home=new JButton("<<HOME");
	JButton ft=new JButton("TOTAL AMOUNT TO BE PAID =");
	JComboBox bl;

        JPanel pane=new JPanel();
        				
	
        ImageIcon func = new ImageIcon("bill3.JPG");
	JLabel pic =new JLabel(new ImageIcon("bill3.JPG"));
   
	public bill(){
	
	super("CLINIC CHARGES");
	setSize(1024,768);
	setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
	

	pane.setLayout(null);				
	df.setBounds(260,150,80,50);
	pf.setBounds(215,195,150,50);
        cf.setBounds(265,240,80,50);       
        xf.setBounds(250,285,100,50);
        sf.setBounds(230,330,150,50);
        bc.setBounds(265,375,80,50);
        
	ft.setBounds(120,445,225,25);
	t_text.setBounds(350,445,100,25);
        df_text.setBounds(350,160,100,25);
        pf_text.setBounds(350,205,100,25);
        cf_text.setBounds(350,250,100,25);
        xf_text.setBounds(350,295,100,25);   
        sf_text.setBounds(350,340,100,25);
        bc_text.setBounds(350,395,100,25);
	nam.setBounds(350,65,100,25);
	aly.setBounds(350,110,100,25);
	name.setBounds(250,65,100,25);
	ay.setBounds(270,115,100,25);
		        
 
	pid.setBounds(100,10,200,30);
	sm.setBounds(625,340,100,30);
        home.setBounds(750,340,100,30);
        total.setBounds(350,445,100,25);
        pic.setBounds(550,50,225,250);

	pane.add(pid);
        pane.add(pic); 
	pane.add(ft);
        pane.add(df); 
      	pane.add(pf);					
        pane.add(cf);
        pane.add(xf);
        pane.add(sf);
        pane.add(bc);
        	     
        pane.add(df_text);
	pane.add(pf_text); 
        pane.add(cf_text); 
        pane.add(xf_text);
        pane.add(sf_text);
        pane.add(bc_text);
	pane.add(t_text);
        pane.add(home);
	pane.add(total);
	pane.add(sm);
	pane.add(nam);
	pane.add(aly);
	pane.add(name);
	pane.add(ay);

	
      


	total.addActionListener(this);
 	home.addActionListener(this);
	sm.addActionListener(this);
          
	getContentPane().add(pane);				
        setVisible(true);
	t_text.setVisible(false);

	try
        	{
			
			Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");		       
			cn = DriverManager.getConnection("jdbc:odbc:hos1");
			stm= cn.createStatement();
				         
                        bl=new JComboBox();
                }
                        catch(Exception b){System.out.println(""+b);}


 		try{
		
                  		res=stm.executeQuery("select * from pd ");		
				while(res.next()){
				bl.addItem(res.getString(1));
				}}
			catch(Exception r){
			System.out.println(""+r);}
			
			 pane.add(bl);
 	   	       	 bl.setBounds(100,40,150,20);

}
 
public void actionPerformed(ActionEvent event){
       
               Object source=event.getSource();
		if(source==total)
        	{				
		 you=(Integer.parseInt(df_text.getText())+Integer.parseInt(pf_text.getText())+Integer.parseInt(cf_text.getText())+Integer.parseInt(xf_text.getText())+Integer.parseInt(sf_text.getText())+Integer.parseInt(bc_text.getText()));
			
		t_text.setText(you+"");
		t_text.setVisible(true);
		}	
       
                 else if(source==home)
               {
                 setVisible(false);
                 dscreen dsc=new dscreen();        
                 dsc.setSize(1024,768);
                 dsc.setVisible(true);
				
	       }

		 else{				

	  
         					
			try{	

                                
 				res=stm.executeQuery("select * from pd where patid='"+bl.getSelectedItem()+"'");		
				res.next();
                                nam.setText(res.getString("patname"));
				aly.setText(res.getString("analysis"));
			
							
		       	}
			catch(Exception y){
				System.out.println(""+y);
			}
                       }

		
}
 	



public static void main(String arg[]){ 

	bill bl= new bill();
}
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -