Saturday, February 15, 2014

Its Show Field by Enum value by show or hide

//Its Show Field by Enum value by show or hide


void showHideFields()
{
    switch (callerSalesQuotationTable.QuotationType)
    {
        case QuotationType::Sales             :
            salesQuotationLine_ds.object(fieldNum(SalesQuotationLine, ItemId))         .visible(true);
            salesQuotationLine_ds.object(fieldNum(SalesQuotationLine, SalesQty))       .visible(true);
            salesQuotationLine_ds.object(fieldNum(SalesQuotationLine, SalesUnit))      .visible(true);
            salesQuotationLine_ds.object(fieldNum(SalesQuotationLine, SalesPrice))     .visible(true);
            salesQuotationLine_ds.object(fieldNum(SalesQuotationLine, LineAmount))     .visible(true);
            salesQuotationLine_ds.object(fieldNum(SalesQuotationLine, LineDisc))       .visible(true);
            salesQuotationLine_ds.object(fieldNum(SalesQuotationLine, LinePercent))    .visible(true);
            salesQuotationLine_ds.object(fieldNum(SalesQuotationLine, ProjTransType))  .visible(false);
            salesQuotationLine_ds.object(fieldNum(SalesQuotationLine, ProjectWorker))  .visible(false);
            salesQuotationLine_ds.object(fieldNum(SalesQuotationLine, ProjCategoryId)) .visible(false);
            salesQuotationLine_ds.object(fieldNum(SalesQuotationLine, LinePropertyId)) .visible(false);
            salesQuotationLine_ds.object(fieldNum(SalesQuotationLine, ProjDescription)).visible(false);

            custQuotationConfirmTrans_ds.object(fieldNum(CustQuotationConfirmTrans, ItemId))         .visible(true);
            custQuotationConfirmTrans_ds.object(fieldNum(CustQuotationConfirmTrans, Qty))            .visible(true);
            custQuotationConfirmTrans_ds.object(fieldNum(CustQuotationConfirmTrans, SalesUnit))      .visible(true);
            custQuotationConfirmTrans_ds.object(fieldNum(CustQuotationConfirmTrans, SalesPrice))     .visible(true);
            custQuotationConfirmTrans_ds.object(fieldNum(CustQuotationConfirmTrans, LineAmount))     .visible(true);
            custQuotationConfirmTrans_ds.object(fieldNum(CustQuotationConfirmTrans, DiscAmount))     .visible(true);
            custQuotationConfirmTrans_ds.object(fieldNum(CustQuotationConfirmTrans, DiscPercent))    .visible(true);
            custQuotationConfirmTrans_ds.object(fieldNum(CustQuotationConfirmTrans, ProjTransType))  .visible(false);
            custQuotationConfirmTrans_ds.object(fieldNum(CustQuotationConfirmTrans, ProjectWorker))  .visible(false);
            custQuotationConfirmTrans_ds.object(fieldNum(CustQuotationConfirmTrans, ProjCategoryId)) .visible(false);
            custQuotationConfirmTrans_ds.object(fieldNum(CustQuotationConfirmTrans, LinePropertyId)) .visible(false);
            custQuotationConfirmTrans_ds.object(fieldNum(CustQuotationConfirmTrans, ProjDescription)).visible(false);


            custQuotationTrans_ds.object(fieldNum(CustQuotationTrans, ItemId))         .visible(true);
            custQuotationTrans_ds.object(fieldNum(CustQuotationTrans, Qty))            .visible(true);
            custQuotationTrans_ds.object(fieldNum(CustQuotationTrans, SalesUnit))      .visible(true);
            custQuotationTrans_ds.object(fieldNum(CustQuotationTrans, SalesPrice))     .visible(true);
            custQuotationTrans_ds.object(fieldNum(CustQuotationTrans, LineAmount))     .visible(true);
            custQuotationTrans_ds.object(fieldNum(CustQuotationTrans, DiscAmount))     .visible(true);
            custQuotationTrans_ds.object(fieldNum(CustQuotationTrans, DiscPercent))    .visible(true);
            custQuotationTrans_ds.object(fieldNum(CustQuotationTrans, ProjTransType))  .visible(false);
            custQuotationTrans_ds.object(fieldNum(CustQuotationTrans, ProjectWorker))  .visible(false);
            custQuotationTrans_ds.object(fieldNum(CustQuotationTrans, ProjCategoryId)) .visible(false);
            custQuotationTrans_ds.object(fieldNum(CustQuotationTrans, LinePropertyId)) .visible(false);
            custQuotationTrans_ds.object(fieldNum(CustQuotationTrans, ProjDescription)).visible(false);
            break;

        case QuotationType::Project           :
            salesQuotationLine_ds.object(fieldNum(SalesQuotationLine, ItemId))         .visible(true);
            salesQuotationLine_ds.object(fieldNum(SalesQuotationLine, SalesQty))       .visible(true);
            salesQuotationLine_ds.object(fieldNum(SalesQuotationLine, SalesUnit))      .visible(false);
            salesQuotationLine_ds.object(fieldNum(SalesQuotationLine, SalesPrice))     .visible(true);
            salesQuotationLine_ds.object(fieldNum(SalesQuotationLine, LineAmount))     .visible(true);
            salesQuotationLine_ds.object(fieldNum(SalesQuotationLine, LineDisc))       .visible(false);
            salesQuotationLine_ds.object(fieldNum(SalesQuotationLine, LinePercent))    .visible(false);
            salesQuotationLine_ds.object(fieldNum(SalesQuotationLine, ProjTransType))  .visible(true);
            salesQuotationLine_ds.object(fieldNum(SalesQuotationLine, ProjectWorker))  .visible(true);
            salesQuotationLine_ds.object(fieldNum(SalesQuotationLine, ProjCategoryId)) .visible(true);
            salesQuotationLine_ds.object(fieldNum(SalesQuotationLine, LinePropertyId)) .visible(true);
            salesQuotationLine_ds.object(fieldNum(SalesQuotationLine, ProjDescription)).visible(true);

            custQuotationConfirmTrans_ds.object(fieldNum(CustQuotationConfirmTrans, Qty))            .visible(true);
            custQuotationConfirmTrans_ds.object(fieldNum(CustQuotationConfirmTrans, SalesUnit))      .visible(false);
            custQuotationConfirmTrans_ds.object(fieldNum(CustQuotationConfirmTrans, SalesPrice))     .visible(true);
            custQuotationConfirmTrans_ds.object(fieldNum(CustQuotationConfirmTrans, LineAmount))     .visible(true);
            custQuotationConfirmTrans_ds.object(fieldNum(CustQuotationConfirmTrans, DiscAmount))     .visible(false);
            custQuotationConfirmTrans_ds.object(fieldNum(CustQuotationConfirmTrans, DiscPercent))    .visible(false);
            custQuotationConfirmTrans_ds.object(fieldNum(CustQuotationConfirmTrans, ProjTransType))  .visible(true);
            custQuotationConfirmTrans_ds.object(fieldNum(CustQuotationConfirmTrans, ProjCategoryId)) .visible(true);
            custQuotationConfirmTrans_ds.object(fieldNum(CustQuotationConfirmTrans, LinePropertyId)) .visible(true);
            custQuotationConfirmTrans_ds.object(fieldNum(CustQuotationConfirmTrans, ProjDescription)).visible(true);

            if (custQuotationConfirmTrans.ProjTransType == QuotationProjTransType::Item)
            {
                custQuotationConfirmTrans_ds.object(fieldNum(CustQuotationConfirmTrans, ItemId))         .visible(true);
                custQuotationConfirmTrans_ds.object(fieldNum(CustQuotationConfirmTrans, ProjectWorker))  .visible(false);
            }
            else
            {
                custQuotationConfirmTrans_ds.object(fieldNum(CustQuotationConfirmTrans, ItemId))         .visible(false);
                custQuotationConfirmTrans_ds.object(fieldNum(CustQuotationConfirmTrans, ProjectWorker))  .visible(true);
            }

            custQuotationTrans_ds.object(fieldNum(CustQuotationTrans, ItemId))         .visible(true);
            custQuotationTrans_ds.object(fieldNum(CustQuotationTrans, Qty))            .visible(true);
            custQuotationTrans_ds.object(fieldNum(CustQuotationTrans, SalesUnit))      .visible(false);
            custQuotationTrans_ds.object(fieldNum(CustQuotationTrans, SalesPrice))     .visible(true);
            custQuotationTrans_ds.object(fieldNum(CustQuotationTrans, LineAmount))     .visible(true);
            custQuotationTrans_ds.object(fieldNum(CustQuotationTrans, DiscAmount))     .visible(false);
            custQuotationTrans_ds.object(fieldNum(CustQuotationTrans, DiscPercent))    .visible(false);
            custQuotationTrans_ds.object(fieldNum(CustQuotationTrans, ProjTransType))  .visible(true);
            custQuotationTrans_ds.object(fieldNum(CustQuotationTrans, ProjectWorker))  .visible(true);
            custQuotationTrans_ds.object(fieldNum(CustQuotationTrans, ProjCategoryId)) .visible(true);
            custQuotationTrans_ds.object(fieldNum(CustQuotationTrans, LinePropertyId)) .visible(true);
            custQuotationTrans_ds.object(fieldNum(CustQuotationTrans, ProjDescription)).visible(true);

            if (custQuotationTrans.ProjTransType == QuotationProjTransType::Item)
            {
                custQuotationTrans_ds.object(fieldNum(CustQuotationTrans, ItemId))         .visible(true);
                custQuotationTrans_ds.object(fieldNum(CustQuotationTrans, ProjectWorker))  .visible(false);
            }
            else
            {
                custQuotationTrans_ds.object(fieldNum(CustQuotationTrans, ItemId))         .visible(false);
                custQuotationTrans_ds.object(fieldNum(CustQuotationTrans, ProjectWorker))  .visible(true);
            }
            break;

        default                         :
            salesQuotationLine_ds.object(fieldNum(SalesQuotationLine, ItemId))         .visible(true);
            salesQuotationLine_ds.object(fieldNum(SalesQuotationLine, SalesQty))       .visible(true);
            salesQuotationLine_ds.object(fieldNum(SalesQuotationLine, SalesUnit))      .visible(true);
            salesQuotationLine_ds.object(fieldNum(SalesQuotationLine, SalesPrice))     .visible(true);
            salesQuotationLine_ds.object(fieldNum(SalesQuotationLine, LineAmount))     .visible(true);
            salesQuotationLine_ds.object(fieldNum(SalesQuotationLine, LineDisc))       .visible(true);
            salesQuotationLine_ds.object(fieldNum(SalesQuotationLine, LinePercent))    .visible(true);
            salesQuotationLine_ds.object(fieldNum(SalesQuotationLine, ProjTransType))  .visible(false);
            salesQuotationLine_ds.object(fieldNum(SalesQuotationLine, ProjectWorker))  .visible(false);
            salesQuotationLine_ds.object(fieldNum(SalesQuotationLine, ProjCategoryId)) .visible(false);
            salesQuotationLine_ds.object(fieldNum(SalesQuotationLine, LinePropertyId)) .visible(false);
            salesQuotationLine_ds.object(fieldNum(SalesQuotationLine, ProjDescription)).visible(false);

            custQuotationTrans_ds.object(fieldNum(CustQuotationTrans, ItemId))         .visible(true);
            custQuotationTrans_ds.object(fieldNum(CustQuotationTrans, Qty))            .visible(true);
            custQuotationTrans_ds.object(fieldNum(CustQuotationTrans, SalesUnit))      .visible(true);
            custQuotationTrans_ds.object(fieldNum(CustQuotationTrans, SalesPrice))     .visible(true);
            custQuotationTrans_ds.object(fieldNum(CustQuotationTrans, LineAmount))     .visible(true);
            custQuotationTrans_ds.object(fieldNum(CustQuotationTrans, DiscAmount))     .visible(true);
            custQuotationTrans_ds.object(fieldNum(CustQuotationTrans, DiscPercent))    .visible(true);
            custQuotationTrans_ds.object(fieldNum(CustQuotationTrans, ProjTransType))  .visible(false);
            custQuotationTrans_ds.object(fieldNum(CustQuotationTrans, ProjectWorker))  .visible(false);
            custQuotationTrans_ds.object(fieldNum(CustQuotationTrans, ProjCategoryId)) .visible(false);
            custQuotationTrans_ds.object(fieldNum(CustQuotationTrans, LinePropertyId)) .visible(false);
            custQuotationTrans_ds.object(fieldNum(CustQuotationTrans, ProjDescription)).visible(false);

            custQuotationConfirmTrans_ds.object(fieldNum(CustQuotationConfirmTrans, ItemId))         .visible(true);
            custQuotationConfirmTrans_ds.object(fieldNum(CustQuotationConfirmTrans, Qty))            .visible(true);
            custQuotationConfirmTrans_ds.object(fieldNum(CustQuotationConfirmTrans, SalesUnit))      .visible(true);
            custQuotationConfirmTrans_ds.object(fieldNum(CustQuotationConfirmTrans, SalesPrice))     .visible(true);
            custQuotationConfirmTrans_ds.object(fieldNum(CustQuotationConfirmTrans, LineAmount))     .visible(true);
            custQuotationConfirmTrans_ds.object(fieldNum(CustQuotationConfirmTrans, DiscAmount))     .visible(true);
            custQuotationConfirmTrans_ds.object(fieldNum(CustQuotationConfirmTrans, DiscPercent))    .visible(true);
            custQuotationConfirmTrans_ds.object(fieldNum(CustQuotationConfirmTrans, ProjTransType))  .visible(false);
            custQuotationConfirmTrans_ds.object(fieldNum(CustQuotationConfirmTrans, ProjectWorker))  .visible(false);
            custQuotationConfirmTrans_ds.object(fieldNum(CustQuotationConfirmTrans, ProjCategoryId)) .visible(false);
            custQuotationConfirmTrans_ds.object(fieldNum(CustQuotationConfirmTrans, LinePropertyId)) .visible(false);
            custQuotationConfirmTrans_ds.object(fieldNum(CustQuotationConfirmTrans, ProjDescription)).visible(false);
            break;
    }
}

No comments:

Post a Comment

Convert Call stack to readable format in D365FO X++

//Input --container _xppCallStack = xSession::xppCallStack();  Public static str POL_formatXppCallStack(container _xppCallStack, int _skipFr...