lblChkMember = new Label("Choose Member or Non-Member:");
lblChkMember.setFont(f);
txtMemberId = new TextField(15);
FocusListener l = new FocusListener() {
public void focusGained(FocusEvent e) {
// TODO Auto-generated method stub
}
public void focusLost(FocusEvent e) {
String id = txtMemberId.getText().trim();
if (id.length() != 0) {
try {
member = appController.selectMember(id);
if (member != null) {
int point = appController.getMemberPoint(id);
setlblDeemValue(Integer.toString(point));
} else {
MessageDialog m = new MessageDialog(mainForm,
"No Member", "This MemberID is not exist.");
m.setResizable(false);
m.setVisible(true);
txtMemberId.setText("");
}
} catch (AppException ex) {
MessageDialog m = new MessageDialog(mainForm,
"Error Loading Category", ex.getMessage());
m.setResizable(false);
m.setVisible(true);
}
}
}
};
txtMemberId.addFocusListener(l);
txtBarCode = new TextField(15);
txtQty = new TextField(3);
txtDeemUsed = new TextField(3);
l = new FocusListener() {
public void focusGained(FocusEvent arg0) {
}
public void focusLost(FocusEvent arg0) {
try {
if (checkDeemPointAmt() == true)
Calculate();
} catch (Exception e) {
MessageDialog m = new MessageDialog(mainForm,
"Wrong Input Format", "Deem point must be Number.");
m.setResizable(false);
m.setVisible(true);
txtDeemUsed.setText("0");
}
}
};
txtDeemUsed.addFocusListener(l);
txtPaymentAmt = new TextField(10);
l = new FocusListener() {
public void focusGained(FocusEvent arg0) {
// TODO Auto-generated method stub
}
public void focusLost(FocusEvent arg0) {
String pay = txtPaymentAmt.getText().trim();
if (pay.length() != 0) {
try {
float payment = Float.parseFloat(pay);
float refund = 0.0f;
if (payment > grandtotal) {
refund = calulateRefund(payment);
} else if (payment < grandtotal) {
MessageDialog m = new MessageDialog(mainForm,
"Invalid Payment",
"Payment Amount must be greater than Grandtotal.");
m.setResizable(false);
m.setVisible(true);
txtPaymentAmt.setText("0");
}
lblRefundValue.setText(Float.toString(refund));
} catch (Exception e) {
MessageDialog m = new MessageDialog(mainForm,
"Wrong Input Format",
"Payment Amount must be Number.");
m.setResizable(false);
m.setVisible(true);
}
}
}
};
txtPaymentAmt.addFocusListener(l);
lblDiscountValue = new Label();
lblPaymentAmt = new Label("Payment Amt");
lblPaymentAmt.setFont(f);
lblRefund = new Label("Refund");
lblRefund.setFont(f);
lblRefundValue = new Label();
txtDeemUsed.setText("0");
txtDeemUsed.setEnabled(false);
l = new FocusListener() {
public void focusGained(FocusEvent arg0) {
// TODO Auto-generated method stub
}