As far as casualties go, getting outflanked by the enemy is a good way to take painful losses. If they have a "wider" line than you do, the units at the edges of your line will be attacked by multiple of their units, meaning you'll take more damage. So quantity matters a lot, up until you equal the maximum width allowed by your tech level.
For a very rough overview: Dice roll + unit pips + generals & terrain gives a raw potential for how much damage is dealt. It's then modified by the damage modifier for the unit type (the fire and shock values for infantry, cav, artillery on the military page), and amplified by discipline, combat ability, etc. This is then divided by tactics, which is amplified by discipline. It's also reduced by "- damage taken" abilities.
Morale damage is dealt with separately. Mostly simply, it's damaged by taking casualties. There is also separate morale phase in addition to fire and shock phases. In this phase, each unit damages it's opposing unit's morale based on the damaging unit's maximum morale. So morale not only determines how long a unit will fight, but also how effective it is at getting the enemy unit to retreat. With a sufficient morale disparity, the lower-morale side may route even if they are actually inflicting more casualties than their opponents.
So generally speaking, for casualties: number of units (until combat width) > modifiers to dice roll > modifiers to damage dealt and taken (which is what discipline is). If you beat your opponent on discipline but lose in one of those first two categories categories, you'll likely take heavier losses.
So yeah, if they have +2 from general, and a bonus from terrain, you'll take more casualties. Discipline will mitigate this somewhat, but it is unlikely to overcome it completely.