Package org.ofbiz.pos.component

Examples of org.ofbiz.pos.component.Input


            pos.showDialog("dialog/error/terminalclosed");
            return;
        }

        Output output = pos.getOutput();
        Input input = pos.getInput();
        boolean lookup = false;

        if (input.isFunctionSet("VOID")) {
            lookup = true;
        } else if (UtilValidate.isNotEmpty(input.value())) {
            lookup = true;
        }

        if (lookup) {
            GenericValue state = trans.getTerminalState();
            Timestamp openDate = state.getTimestamp("openedDate");

            String orderId = input.value();
            GenericValue orderHeader = null;
            try {
                orderHeader = session.getDelegator().findByPrimaryKey("OrderHeader", UtilMisc.toMap("orderId", orderId));
            } catch (GenericEntityException e) {
                Debug.logError(e, module);
            }
            if (orderHeader == null) {
                input.clear();
                pos.showDialog("dialog/error/ordernotfound");
                return;
            } else {
                Timestamp orderDate = orderHeader.getTimestamp("orderDate");
                if (orderDate.after(openDate)) {
                    LocalDispatcher dispatcher = session.getDispatcher();
                    Map<String, Object> returnResp = null;
                    try {
                        returnResp = dispatcher.runSync("quickReturnOrder", UtilMisc.<String, Object>toMap("orderId", orderId,
                                                        "returnHeaderTypeId", "CUSTOMER_RETURN", "userLogin", session.getUserLogin()));
                    } catch (GenericServiceException e) {
                        Debug.logError(e, module);
                        pos.showDialog("dialog/error/exception", e.getMessage());
                        pos.refresh();
                        return;
                    }
                    if (returnResp != null && ServiceUtil.isError(returnResp)) {
                        pos.showDialog("dialog/error/exception", ServiceUtil.getErrorMessage(returnResp));
                        pos.refresh();
                        return;
                    }

                    // todo print void receipt

                    trans.setTxAsReturn((String) returnResp.get("returnId"));
                    input.clear();
                    pos.showDialog("dialog/error/salevoided");
                    pos.refresh();
                } else {
                    input.clear();
                    pos.showDialog("dialog/error/ordernotfound");
                    return;
                }
            }
        } else {
            input.setFunction("VOID");
            output.print(UtilProperties.getMessage(PosTransaction.resource,"PosVoid",Locale.getDefault()));
        }
    }
View Full Code Here


        PosTransaction trans = PosTransaction.getCurrentTx(pos.getSession());
        if (!trans.isOpen()) {
            pos.showDialog("dialog/error/terminalclosed");
            return;
        }
        Input input = pos.getInput();
        String[] lastFunc = input.getLastFunction();
        if (lastFunc == null || !"PROMOCODE".equals(lastFunc[0])) {
            Output output = pos.getOutput();
            input.setFunction("PROMOCODE");
            output.print(UtilProperties.getMessage(PosTransaction.resource,"PosEntPromoCode",Locale.getDefault()));
        } else if ("PROMOCODE".equals(lastFunc[0])) {
            String promoCode = input.value();
            if (UtilValidate.isNotEmpty(promoCode)) {
                String result = trans.addProductPromoCode(promoCode, pos);
                if (result != null) {
                    pos.showDialog("dialog/error/exception", result);
                    input.clearFunction("PROMOCODE");
                } else {
                    input.clearFunction("PROMOCODE");
                    NavagationEvents.showPosScreen(pos);
                    pos.refresh();
                }
            }
        }
View Full Code Here

        pos.refresh();
    }

    private static synchronized void processExternalPayment(PosScreen pos, String paymentMethodTypeId, String amountStr) {
        PosTransaction trans = PosTransaction.getCurrentTx(pos.getSession());
        Input input = pos.getInput();
        String refNum = input.value();
        if (refNum == null) {
            pos.getOutput().print(UtilProperties.getMessage(PosTransaction.resource,"PosRefNum",Locale.getDefault()));
            return;
        }
        input.clearInput();

        try {
            BigDecimal amount = processAmount(trans, pos, amountStr);
            Debug.log("Processing [" + paymentMethodTypeId + "] Amount : " + amount, module);
View Full Code Here

            pos.setNormalCursor();
        }
    }

    private static synchronized BigDecimal processAmount(PosTransaction trans, PosScreen pos, String amountStr) throws GeneralException {
        Input input = pos.getInput();

        if (input.isFunctionSet("TOTAL")) {
            String amtStr = amountStr != null ? amountStr : input.value();
            BigDecimal amount;
            if (UtilValidate.isNotEmpty(amtStr)) {
                try {
                    amount = new BigDecimal(amtStr);
                } catch (NumberFormatException e) {
                    Debug.logError("Invalid number for amount : " + amtStr, module);
                    pos.getOutput().print("Invalid Amount!");
                    input.clearInput();
                    throw new GeneralException();
                }
                amount = amount.movePointLeft(2); // convert to decimal
                Debug.log("Set amount / 100 : " + amount, module);
            } else {
View Full Code Here

    // processed or if an error occurred
    public static synchronized void clearInputPaymentFunctions(PosScreen pos) {
        String[] paymentFuncs = {"CHECK", "CHECKINFO", "CREDIT",
                                    "GIFTCARD", "MSRINFO", "REFNUM", "CREDITEXP",
                                    "TRACK2", "SECURITYCODE", "POSTALCODE" };
        Input input = pos.getInput();
        for (int i = 0; i < paymentFuncs.length; i++) {
            while (input.isFunctionSet(paymentFuncs[i])) {
                input.clearFunction(paymentFuncs[i]);
            }
        }
    }
View Full Code Here

    public static void triggerDel(PosScreen pos) {
        pos.getInput().stripLastChar();
    }

    public static void triggerA(PosScreen pos) {
        Input input = pos.getInput();
        if (capsLockSet || input.isFunctionSet("SHIFT")) {
            input.appendChar('A');
        } else {
            input.appendChar('a');
        }
    }
View Full Code Here

            input.appendChar('a');
        }
    }

    public static void triggerB(PosScreen pos) {
        Input input = pos.getInput();
        if (capsLockSet || input.isFunctionSet("SHIFT")) {
            input.appendChar('B');
        } else {
            input.appendChar('b');
        }
    }
View Full Code Here

            input.appendChar('b');
        }
    }

    public static void triggerC(PosScreen pos) {
        Input input = pos.getInput();
        if (capsLockSet || input.isFunctionSet("SHIFT")) {
            input.appendChar('C');
        } else {
            input.appendChar('c');
        }
    }
View Full Code Here

            input.appendChar('c');
        }
    }

    public static void triggerD(PosScreen pos) {
        Input input = pos.getInput();
        if (capsLockSet || input.isFunctionSet("SHIFT")) {
            input.appendChar('D');
        } else {
            input.appendChar('d');
        }
    }
View Full Code Here

            input.appendChar('d');
        }
    }

    public static void triggerE(PosScreen pos) {
        Input input = pos.getInput();
        if (capsLockSet || input.isFunctionSet("SHIFT")) {
            input.appendChar('E');
        } else {
            input.appendChar('e');
        }
    }
View Full Code Here

TOP

Related Classes of org.ofbiz.pos.component.Input

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.