private void WarehouseCBActionPerformed(
      java.awt.event.ActionEvent evt) { // GEN-FIRST:event_WarehouseCBActionPerformed
    int warehouseindex =
        st.getWarehouseIndex(((String) WarehouseCB.getSelectedItem()).toLowerCase());

    QuantityLB.setText(
        "Total Quantity: "
            + st.getTotalQuantityByWarehouseAndCode(
                ((String) WarehouseCB.getSelectedItem()).toLowerCase(), item_code));

    ArrayList<String[]> quantity_expired_list =
        st.setQuantityExpiredDateTable(warehouseindex, itemindex);

    DefaultTableModel quantity_expired_model = (DefaultTableModel) QuantityTB.getModel();

    GuiHelper.ClearAllTable(QuantityTB);
    quantity_row_length = quantity_expired_list.size();
    for (int i = 0; i < quantity_row_length; i++) {
      if (i == quantity_expired_model.getRowCount()) {
        ((DefaultTableModel) quantity_expired_model)
            .addRow(
                new Object[] {
                  null, null, null, null, null, null, null, null, null, null, null, null, null,
                  null, null, null
                });
      }
      String[] single_list = (String[]) quantity_expired_list.get(i);
      quantity_expired_model.setValueAt(single_list[0], i, 0);
      quantity_expired_model.setValueAt(single_list[1], i, 1);
    }
  } // GEN-LAST:event_WarehouseCBActionPerformed
  private void QuantityAddButtonActionPerformed(
      java.awt.event.ActionEvent evt) { // GEN-FIRST:event_QuantityAddButtonActionPerformed

    int warehouseindex = getWarehouseIndex();
    if (warehouseindex == -1) return;

    AddQuantityDialog addquantity_dialog =
        new AddQuantityDialog(null, true, st, itemindex, warehouseindex);
    addquantity_dialog.setVisible(true);
    String[] added_value = addquantity_dialog.getReturnValue();

    if (added_value == null) {
      JOptionPane.showMessageDialog(
          null,
          "Error adding quantity and expired date.",
          "Error Dialog",
          JOptionPane.ERROR_MESSAGE);
      return;
    }
    // clicking cancel button
    else if (added_value.length == 0) {
      return;
    }

    int total_row = QuantityTB.getRowCount();
    if (quantity_row_length == total_row) {
      ((DefaultTableModel) QuantityTB.getModel())
          .addRow(
              new Object[] {
                null, null, null, null, null, null, null, null, null, null, null, null, null, null,
                null, null
              });
    }
    QuantityTB.setValueAt(added_value[0], quantity_row_length, 0);
    QuantityTB.setValueAt(added_value[1], quantity_row_length, 1);
    quantity_row_length++;
  } // GEN-LAST:event_QuantityAddButtonActionPerformed