POS, Quantity by price

I want to add a field like the field quantity in pos, but the quantity is measured based on the price paid by the customer…
For example a customer pays price of 200$ for something that has 240$ price per kg, the salesman/cashier just put the 200$ in that field and the quantity and amount auto updates when he puts in that value… how to do that guide please!!