Tax and discount on sales orders....

Tax and discount on sales orders....

I dont know if its a bug, but i would appreciate an explanation for the following issue: 
When i apply tax to a line item or to the Total, the taxamount overwrites any other discounts i may have set.Why?

Also: I thought the field "discount" in the Total section, where the total amount of discount added to all the line items- but this doesnt seem to be the case? Where do i fix this?