Controller class and builder class

 /// <summary>

/// Report conreoller class.

/// </summary>

public class SolvCommercialInvoiceControllerPS extends SrsReportRunController

{

    #ISOCountryRegionCodes

    /// <summary>

    /// Construct method.

    /// </summary>

    /// <returns> Static </returns>

    public static SolvCommercialInvoiceControllerPS construct()

    {

        return new SolvCommercialInvoiceControllerPS();

    }


    /// <summary>

    /// Controller main method.

    /// </summary>

    /// <param name = "_args"> Args </param>

    public static void main(Args _args)

    {

       

        SolvCommercialInvoiceControllerPS controller = new SolvCommercialInvoiceControllerPS();

        dataAreaID dataAreaID =curExt();

        if(dataAreaID == '8046'

        && SysCountryRegionCode::isLegalEntityInCountryRegion([#isoAE]))

        {

            controller.parmReportName(ssrsReportStr(SolvCommercialInvoiceReportPS, ReportAE));

        }

        else

        {

            controller.parmReportName(ssrsReportStr(SolvCommercialInvoiceReportPS, Report));

        }

        controller.parmArgs(_args);

        controller.parmShowDialog(true);

        controller.startOperation();

       

    }


    /// <summary>

    /// Pre modify contract method.

    /// </summary>


    public void prePromptModifyContract()

    {

        CustPackingSlipJour custPackingSlipJour;

        SolvInvHistory      solvInvoiceHistory;

        FormDataSource fds;


        List invoiceIdList = new List(Types::String);

        List commercialList = new List(Types::String);


        SolvCommercialInvoiceContractPS  contract = new SolvCommercialInvoiceContractPS();


        contract  = this.parmReportContract().parmRdpContract() as SolvCommercialInvoiceContractPS;


        fds = FormDataUtil::getFormDataSource(this.parmArgs().record());


        if(this.parmArgs() && this.parmArgs().dataset() == tableNum(CustPackingSlipJour))

        {

            for(custPackingSlipJour = getFirstSelection(fds); custPackingSlipJour; custPackingSlipJour = fds.getNext())

            {

                select firstonly solvInvoiceHistory where solvInvoiceHistory.InvoiceId == custPackingSlipJour.PackingSlipId;

                if(solvInvoiceHistory.InvoiceNumber)

                {

                    commercialList.addEnd(solvInvoiceHistory.InvoiceNumber);

                }

                else

                {

                    commercialList.addEnd('Null');

                }

                invoiceIdList.addEnd(custPackingSlipJour.PackingSlipId);

            }


            if(contract)

            {

                contract.GetInvoiceId(invoiceIdList);

                contract.GetcommInvIds(commercialList);

            }

        }


        this.parmShowDialog(true);

    }


}


/// <summary>

/// The <c>SolvCommercialInvoicePSBuilder</c> class is responsible for building the dialog associated with the HcmWorkersHiredInPeriod report

/// </summary>

[

    SrsReportNameAttribute(ssrsReportStr(SolvCommercialInvoiceReportPS, ReportAE))

]

class SolvCommercialInvoiceBuilder extends SrsReportDataContractUIBuilder

{

    #ISOCountryRegionCodes

    public void postBuild()

    {

        DialogField dialogField;

        dataAreaID dataAreaID = curExt();

        

        SolvCommercialInvoiceContract contract = this.dataContractObject() as SolvCommercialInvoiceContract;


        // Get the dialog field for the control you want to hide/show

        dialogField = this.bindInfo().getDialogField(this.dataContractObject(), methodStr(SolvCommercialInvoiceContract, parmEnableHSCCode));


        // Apply the condition

        if(dataAreaID == '8046'

                    && SysCountryRegionCode::isLegalEntityInCountryRegion([#isoAE]))

        {

            dialogField.visible(true);

        }

        else

        {

            dialogField.visible(false);

        }

    }


}

Comments

Popular posts from this blog

Price disc agreement

Sample integration

Create ledger journals in D365FO using X++ + LedgerDimensionACType