class NW_PurchaseOrderReportController extends SrsReportRunController
{
    /// <summary>
    /// Override this method to change the report contract before you run the report.
    /// </summary>
    protected void preRunModifyContract()
    {
        NW_GeneralContract        contract;
    
        PurchTable PurchTable;
    
        if(!this.parmArgs().record())
        {
            throw error("@SYS26348");
        }
        else
        {
            PurchTable = this.parmArgs().record();
        }
    
        if (PurchTable)
        {
            contract = this.parmReportContract().parmRdpContract() as NW_GeneralContract;
    
            if (PurchTable)
            {
                contract.parmRecordId(PurchTable.RecId);
    
            }
        }
    }

    public static NW_PurchaseOrderReportController construct()
    {
        return new NW_PurchaseOrderReportController();
    }

    public static void main(Args _args)
    {
        PurchTable PurchTable;
    
        SrsReportRunController controller  = NW_PurchaseOrderReportController::construct();
    
        PurchTable=_args.record();
    
        controller.parmArgs(_args);
    
        if(PurchTable.DocumentState==VersioningDocumentState::Confirmed)
        {
            controller.parmReportName(ssrsReportStr(NW_PurchaseOrderReport, PrecisionDesign1));
    
            controller.parmShowDialog(false);
            controller.startOperation();
        }

        else
        {
            error("The Purchase Order is not confirmed");
        }
       
    
    
    }

}