void completeSale(Payment payment) {
        try {
            TableModel model = jTable2.getModel();
            int rowCount = model.getRowCount();
            OrderProduct[] products = new OrderProduct[rowCount];

            for (int i = 0; i < rowCount; i++) {
                products[i] = new OrderProduct((String) model.getValueAt(i, 5),
                        (String) model.getValueAt(i, 0),
                        (String) model.getValueAt(i, 1),
                        ((Double) model.getValueAt(i, 2)).doubleValue(),
                        ((Double) model.getValueAt(i, 3)).doubleValue(),
                        ((Integer) model.getValueAt(i, 4)).intValue());
            }

            NumberFormat nf = NumberFormat.getInstance();
            User user = ((MainFrame) parent).getUser();

            Order order = Order.createOrder(products,
                    totalPanel.getTotal(),
                    totalPanel.getSalesTax(), payment,
                    user.getId(), customer);

            if (order != null) {
                newSale();

                if (payment.getPaymentType().equals("Cash")) {
                    CDrawer.open();
                }

                Printer.print(order);

                if (payment.getPaymentType().equals("Credit/Debit")) {
                    Printer.print(order, "customer");
                    Printer.print(order, "store");
                }

                if (Synchronizer.getMode() == Synchronizer.REAL_SYNC) {
                    order.sync();
                }

                if (payment.getPaymentType().equals("Cash")) {
                    while (!CDrawer.close()) {
                        try {
                            JOptionPane.showMessageDialog(parent,
                                    I18N.getMessageString(
                                    "Please close cash drawer."),
                                    I18N.getLabelString("Error"),
                                    JOptionPane.ERROR_MESSAGE);
                            Thread.sleep(10);
                        } catch (Exception exp) {
                        }
                    }
                }
            } else {
                JOptionPane.showMessageDialog(parent,
                        I18N.getMessageString(
                        "Order processing error."),
                        I18N.getLabelString("Error"),
                        JOptionPane.ERROR_MESSAGE);

            }
        } catch (Exception ex) {
            JOptionPane.showMessageDialog(parent,
                    ex.getMessage(),
                    I18N.getLabelString("Error"),
                    JOptionPane.ERROR_MESSAGE);

        }
    }