From: Anneli <an...@us...> - 2005-01-17 10:24:02
|
Update of /cvsroot/redpos/RedPOS/src/org/redpos/client/ui/plugin/function In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv17783/src/org/redpos/client/ui/plugin/function Modified Files: Pay.java Log Message: New type of payment SimpleCurrencyExchange, enter rate on one currency in properties.xml, when using this payment type the amount will be shown in the currency entered, this is just for the gui part, no info about rate or will be saved in the database. Index: Pay.java =================================================================== RCS file: /cvsroot/redpos/RedPOS/src/org/redpos/client/ui/plugin/function/Pay.java,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** Pay.java 23 Dec 2004 10:14:27 -0000 1.3 --- Pay.java 17 Jan 2005 10:23:21 -0000 1.4 *************** *** 84,87 **** --- 84,90 ---- private ConfirmActionUI confirmCancelReceiptAction; + + private Amount toPayChange; + private Amount payChange; /** *************** *** 288,306 **** paymentSelection = null; parent.layout(); ! String inputHeader = payment.receiptText; ! String inputMessage = language.getString( ! "ui.plugin.receipt.pay.message3.text", "Amount to pay:"); ! Amount toPay = getAmountToPay(); ! if(toPay != null) ! inputMessage = inputMessage + " " + toPay.toString(); ! String inputLabelText = language.getString( ! "ui.plugin.receipt.pay.message1.text", "Enter amount:"); ! ! // create user input ui ! userInput = new UserInputUI(parent, SWT.NORMAL, inputHeader, ! inputMessage, inputLabelText, true, getLanguage(), this); ! userInput.setFocus(); ! } else --- 291,343 ---- paymentSelection = null; parent.layout(); + + // the amount to pay will be shown in a different currency + if (payment.code.equals("SICUEX")) + { + try + { + String inputHeader = payment.receiptText; + String inputMessage = language.getString( + "ui.plugin.receipt.pay.message3.text", "Amount to pay:"); + Amount toPay = getAmountToPay(); + if(toPay != null) + { + toPayChange = getAmountToPay(); + toPayChange.multiply(posEngineUtility.getCurrencyRate()); + inputMessage = language.getString("ui.plugin.receipt.pay.message6.text", + "Currency: ") +toPayChange.toString(); + } + + String inputLabelText = language.getString( + "ui.plugin.receipt.pay.message1.text", "Enter amount:"); + + // create user input ui + userInput = new UserInputUI(parent, SWT.NORMAL, inputHeader, + inputMessage, inputLabelText, true, getLanguage(), this); + userInput.setFocus(); + } + catch(JMException e) + { + log.error(e.getMessage(), e); + } + + } + else + { + String inputHeader = payment.receiptText; + String inputMessage = language.getString( + "ui.plugin.receipt.pay.message3.text", "Amount to pay:"); + Amount toPay = getAmountToPay(); + if(toPay != null) + inputMessage = inputMessage + " " + toPay.toString(); + + String inputLabelText = language.getString( + "ui.plugin.receipt.pay.message1.text", "Enter amount:"); ! // create user input ui ! userInput = new UserInputUI(parent, SWT.NORMAL, inputHeader, ! inputMessage, inputLabelText, true, getLanguage(), this); ! userInput.setFocus(); ! } } else *************** *** 332,335 **** --- 369,373 ---- { amount = getAmountToPay(); + payChange = new Amount(0); } else *************** *** 337,340 **** --- 375,379 ---- Double dAmount = Double.valueOf(input); amount = new Amount(dAmount.doubleValue()); + payChange = new Amount(dAmount.doubleValue()); } *************** *** 534,538 **** "Return to customer:"); } ! String messageString = displayText + " " + returnToCustomer.toString(); --- 573,577 ---- "Return to customer:"); } ! String messageString = displayText + " " + returnToCustomer.toString(); *************** *** 542,545 **** --- 581,593 ---- "ui.main.dashboard.message.ok.text", "OK"); String cancelText = ""; + + // the amount to receive will be shown in a different currency + if (payment.code.equals("SICUEX")) + { + toPayChange.subtract(payChange); + messageString = displayText +language.getString("ui.plugin.receipt.pay.message6.text", + "Currency: ") + toPayChange.absolute().toString(); + } + ConfirmActionUI.ConfirmListener listener = new ConfirmActionUI.ConfirmListener() { |