@FXML
    private void handleBtnRegisterAction(ActionEvent event) {
        String id = String.valueOf(System.currentTimeMillis());
        SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
        String datetime = format.format(new Date(Long.parseLong(id)));

        Persist persist = getPersist();
        persist.setAutoCommit(false);

        try {
            Sales sales = new Sales(id, datetime, String.valueOf(totalAmount));
            persist.insert(sales);

            for (ItemSaleModel model : table.getItems()) {
                Saleitems saleItems = new Saleitems();
                saleItems.setSaleid(id);
                saleItems.setItemcode(model.getItem().getItemcode());
                saleItems.setName(model.getItemName());
                saleItems.setPrice(model.getPrice());
                saleItems.setQuantity(Integer.parseInt(model.getQuantity()));
                saleItems.setSuppliercode(model.getItem().getSupplierCode());
                saleItems.setBumoncode(model.getItem().getBumonCode());
                saleItems.insert(persist);
            }

            persist.commit();
        } catch (RuntimeException e) {
            persist.rollback();
            throw new RuntimeException(e);
        }

        persist.setAutoCommit(true);
        clearFields();
    }