마감시 손익분개
차변 |
대변 |
총매출액 |
총매출원가 |
영엉외수익 |
판관비 |
당기순손실 |
영업외비용 |
|
당기순수익 |
차변합계금액과 대변합계금액이 일치해야된다.
마감시 손익분개
차변 |
대변 |
총매출액 |
총매출원가 |
영엉외수익 |
판관비 |
당기순손실 |
영업외비용 |
|
당기순수익 |
차변합계금액과 대변합계금액이 일치해야된다.
jsp파일
<form method="post" name="regGoodsform" id="regGoodsform" enctype="multipart/form-data"> |
java파일
private File destinationDir = new File("파일저장될 폴더 위치"); //예) C:/file @RequestMapping("/aaa/bbb.do") //request의 "file"을 찾아 file객체에 세팅한다. |
답글형계시판 일단 소스 압축해서 먼저 올립니다. (0) | 2012.03.28 |
---|---|
ORA-01000: 최대 열기 커서 수를 초과 (0) | 2012.03.28 |
아직 완성이 된건 아니지만 기본기능(4칙연산등)은 모두 됨
import java.awt.*;
import java.awt.event.*;
import java.text.DecimalFormat;
import java.text.NumberFormat;
import java.text.ParseException;
class Exam12_sub extends Frame implements ActionListener {
// 메뉴
private MenuBar mb = new MenuBar();
private Menu edit = new Menu("편집");
private MenuItem fcopy = new MenuItem("편집");
private MenuItem fpase = new MenuItem("편집");
private Menu view = new Menu("편집");
private CheckboxMenuItem v1 = new CheckboxMenuItem("편집", true);
private CheckboxMenuItem v2 = new CheckboxMenuItem("편집", false);
private CheckboxMenuItem v3 = new CheckboxMenuItem("편집");
private Menu help = new Menu("편집");
private MenuItem h1 = new MenuItem("편집");
private MenuItem h2 = new MenuItem("편집");
// 텍스트필드
private TextField tf = new TextField();
// 버튼
private Button[] bt = new Button[24];
private Button[] bt01 = new Button[3];
// 버튼이름
private String[] bt01name = {"Backspace","CE","C"};
private String[] bt02name = {"MC","7","8","9","/","sqrt","MR","4","5","6","*","%","MS","1","2","3","-","1/x","M+","0","+/-",".","+","="};
// 패널
private Panel p = new Panel();
private Panel p01 = new Panel();
//사칙연산클릭확인
int calnum = 1;
String[] numarray = new String[3];
// 사칙연산클릭확인
boolean calclick = false;
//String 문자열 패턴
public String numpattern(String num) throws ParseException {
String pattern = "###,###,###,###,###,###.#######"; //패턴문양
NumberFormat parser = new DecimalFormat(pattern); //객체생성
parser.setParseIntegerOnly(false); //숫자형만 할것인지(true로 할경우 소수점 않나옴)
parser.setMinimumFractionDigits(0); //소수점 최소자리
parser.setMaximumFractionDigits(7); //소수점 최대자리
return parser.format(parser.parse(num)); //패턴형식으로 리턴
}
//Exam12_sub class
public Exam12_sub (String title) {
super(title);
Color bc = new Color(236, 233, 216);
super.setBackground(bc);
this.init();
super.setSize(300,250);
super.setLocation(100,100);
super.setResizable(false);
super.setVisible(true);
}
//모양만들기
public void init() {
//메뉴만들기
edit.add(fcopy);
edit.add(fpase);
mb.add(edit);
view.add(v1);
view.add(v2);
view.addSeparator();
view.add(v3);
mb.add(view);
help.add(h1);
help.addSeparator();
help.add(h2);
mb.add(help);
this.setMenuBar(mb);
//상당
this.setLayout(new BorderLayout(10,10));
this.tf.setText("0");
this.add("North",tf);
Color red = new Color(255, 0, 0);
//중단
p01.setLayout(new GridLayout(1,3,10,10));
for(int i=0; i < bt01.length; i++) {
String btname = bt01name[i];
bt01[i] = new Button(btname);
bt01[i].setForeground(red);
bt01[i].addActionListener(this);
p01.add(bt01[i]);
}
this.add("Center",p01);
//하단
p.setLayout(new GridLayout(4,6,10,10));
for(int i=0; i < bt.length; i++) {
String btname = bt02name[i];
bt[i] = new Button(btname);
if(i%6 == 0) {
bt[i].setForeground(red);
}
bt[i].addActionListener(this);
p.add(bt[i]);
}
this.add("South",p);
}
//각 버튼 이벤트
public void actionPerformed(ActionEvent e) {
// TODO Auto-generated method stub
String id = e.getActionCommand();
int hashcode = id.hashCode();
System.out.println("hashcode===>>>"+id.hashCode());
//1~9까지
if(hashcode >= 48 && hashcode <= 57 || hashcode == 46) {
if(!this.calclick) {
if(tf.getText().equals("0") || this.numarray[0] == null) {
this.tf.setText(id);
} else {
this.tf.setText(tf.getText()+""+id);
}
} else {
this.tf.setText(id);
}
if(this.calnum == 1) {
numarray[0] = this.tf.getText();
} else if(this.calnum == 2) {
numarray[2] = this.tf.getText();
}
this.calclick = false;
//C, CE
} else if(hashcode == 67 || hashcode == 2146 ) {
this.tf.setText("0");
//CE인경우 바로앞취소
if(hashcode == 2146 ) {
this.numarray[2] = null;
//C인경우 초기화
} else {
this.numarray = new String[3];
this.calnum = 1;
}
//backspace
} else if(hashcode == -937491361) {
if(!tf.getText().equals("0")) {
if(this.tf.getText().length() == 1 ){
this.tf.setText("0");
} else {
this.tf.setText(this.tf.getText().substring(0,this.tf.getText().length()-1));
}
}
//사칙연산
} else if(hashcode == 43 || hashcode == 47 || hashcode == 42 || hashcode == 45) {
//연산method
cal(hashcode, e);
if(id.hashCode() == 43) {
this.numarray[1] = "+";
} else if(id.hashCode() == 47) {
this.numarray[1] = "/";
} else if(id.hashCode() == 42) {
this.numarray[1] = "*";
} else if(id.hashCode() == 45) {
this.numarray[1] = "-";
}
if(this.calnum == 1) this.calnum = 1+1;
this.calclick = true;
// "="
} else if(hashcode == 61) {
cal(hashcode, e);
this.calclick = false;
// "+/-"
} else if (hashcode == 42825) {
try {
if(this.calnum == 1) {
if(this.numarray[0] == null || this.numarray[0].equals("0")) {
this.numarray[0] = "0";
this.tf.setText("0");
} else {
this.numarray[0] = String.valueOf(Double.parseDouble(this.numarray[0])*-1);
this.tf.setText(numpattern(this.numarray[0]));
}
} else {
if(this.numarray[2] == null || this.numarray[2].equals("0")) {
this.numarray[2] = "0";
this.tf.setText("0");
} else {
this.numarray[2] = String.valueOf(Double.parseDouble(this.numarray[2])*-1);
this.tf.setText(numpattern(this.numarray[2]));
}
}
} catch (ParseException e1) {
// TODO Auto-generated catch block
e1.printStackTrace();
}
}
}
//연산만 따로 빼놓음
public void cal(int num, ActionEvent e) {
try {
Double num01 = 0.0;
if(this.numarray[0] != null && this.numarray[1] != null && this.numarray[2] != null) {
if(this.numarray[1].equals("+")) {
num01 = Double.parseDouble(this.numarray[0])+Double.parseDouble(this.numarray[2]);
} else if(this.numarray[1].equals("/")) {
num01 = Double.parseDouble(this.numarray[0])/Double.parseDouble(this.numarray[2]);
} else if(this.numarray[1].equals("*")) {
num01 = Double.parseDouble(this.numarray[0])*Double.parseDouble(this.numarray[2]);
} else if(this.numarray[1].equals("-")) {
num01 = Double.parseDouble(this.numarray[0])-Double.parseDouble(this.numarray[2]);
}
numarray[0] = String.valueOf(num01);
this.tf.setText(numpattern(String.valueOf(num01)));
if(num == 61) {
this.calnum = 1;
this.numarray = new String[3];
}
} else if(num == 61 && this.numarray[0] != null && this.numarray[2] == null) {
num01 = Double.parseDouble(this.numarray[0]);
this.tf.setText(numpattern(String.valueOf(num01)));
this.calnum = 1;
this.numarray = new String[3];
}
} catch (ParseException e1) {
e1.printStackTrace();
}
}
}
public class Exam12 {
public static void main(String[] args) {
Exam12_sub eb = new Exam12_sub("계산기");
}
}
string형식의 숫자에 3자리수 콤마 붙이기(소수점포함) (0) | 2012.04.16 |
---|