There can be two ways
Create Two controller class (which in my personal option, is a non-optimized way usually)
Example of #1
ControllerClass1Name objectControllerClass1;
ControllerClass1Name objectControllerClass2;
If(Sales.Qty == 0 )
{
//Proceed with objectControllerClass1
}
Else
{
//Proceed with objectControllerClass2
}
Create single controller class and handle logic inside
Example of #2
AOT >> Classes >> smmReportsController
Have a look at main method>> line number 2
controller.parmReportName(smmReportsController::getReportName(_args));
Go inside smmReportsController::getReportName
Here you can see conditions and how multiple designs are handled
You can put your condtions such as follwing
salesTableRecId = _args.record().RecId
//calculate you quantity based on salesTableRecId
And then proceed with condition
If(….)
{
}
…….