@Override
	public void actionPerformed(ActionEvent e) {
		JTable productsTable = App.getInst().getView().getProductsTable();
		JTable categoriesTable = App.getInst().getView().getCategoriesTable();
		JComboBox<String> cmb = App.getInst().getView().getCountComboBox();
		
		count = Integer.parseInt((String) cmb.getSelectedItem());
		Integer left = Integer.parseInt(productsTable.getValueAt(productsTable.getSelectedRow(), 1).toString());
		count = count>left?left:count;
		count = count<0?0:count;
		
		String eID = App.getInst().getView().getSellerComboBox().getSelectedItem().toString();
		String employeeID = eID.substring(0, eID.indexOf(" "));

		String cID = App.getInst().getView().getCustomerComboBox().getSelectedItem().toString();
		String customerID = cID.substring(0, cID.indexOf(" "));
		
		DateModel<?> jdMod = App.getInst().getView().getJdp().getModel();

		
		Map<String, String> map = new HashMap<String,String>();
		map.put(":categoryName", categoryName);
		map.put(":productCount", count.toString());
		map.put(":productName", productName);
		map.put(":customerID", customerID);
		map.put(":employeeID", employeeID);
		map.put(":dateTime", String.valueOf(jdMod.getYear()+"-"+(jdMod.getMonth()+1)+"-"+jdMod.getDay()));
		
		App.getInst().getExecuter().execQuery(QueryCluster.replaceAll(QueryCluster.PRODUCTS_DELETION, map),true);
		
		//table updates

		
		productsTable.getSelectionModel().clearSelection();
		Object[][] data = App.getInst().getExecuter().getQueryResultAsObjectArray(replace(QueryCluster.PRODUCTS_LEFT, ":categoryInsert", replace(QueryCluster.INSERTION_PROD_BY_CAT_NAME, ":categoryName", categoryName)));
		productsTable.setModel(new CustomTableModel(data,new String[] {"Наименование", "Остаток"}));
		
		categoriesTable.getSelectionModel().clearSelection();
		Object[][] categoryData = App.getInst().getExecuter().getQueryResultAsObjectArray(QueryCluster.CATEGORIES_LEFT);
		categoriesTable.setModel(new CustomTableModel(categoryData,new String[] {"Наименование", "Остаток"}));
		
		categoryName = null;
		productName = null;
		((JButton)e.getSource()).setEnabled(false);
		
	}