Pages

Banner 468 x 60px

 

Tuesday, November 21, 2017

SetFieldAccess in x++

0 comments
SetFieldAccess in x++ :

void setFieldAccess()
{
//    boolean allowEdit = purchReqFormMode == PurchReqFormMode::ShowAll ||
//                        purchReqLine.LineType == PurchReqLineType::Category ||
//                        isUserTaskOwner ||
//                        isUserApprovalOwner;
    boolean allowEdit = PurchReqTable.ApprovalStatus==ApprovalStatus::Approved ? false : true;
    PurchReqLine    ReqLine;
    PurchReqTable   tblPurchReqTable;
    ;

    if (purchReqLine.PurchQty != purchreqline.QtyRemaining)
        purchReqLine_ds.allowEdit(false); //.object(fieldnum(PurchReqLine,purchqty)).allowEdit(false);
    else
    {
        purchReqLine_ds.allowEdit(true); //.object(fieldnum(PurchReqLine,purchqty)).allowEdit(true);
        InventDim_ds.allowEdit(true);
    }

    purchReqLine_ds.object(fieldnum(PurchReqLine,PriceUnit)).allowEdit(allowEdit);
    purchReqLine_ds.object(fieldnum(PurchReqLine,PurchPrice)).allowEdit(allowEdit);
    purchReqLine_ds.object(fieldnum(PurchReqLine,LineDisc)).allowEdit(allowEdit);
    purchReqLine_ds.object(fieldnum(PurchReqLine,LinePercent)).allowEdit(allowEdit);
    purchReqLine_ds.object(fieldnum(PurchReqLine,PurchMarkup)).allowEdit(allowEdit);

    //purchReqLine_ds.object(fieldnum(PurchReqLine,CurrencyCode)).allowEdit(purchReqLine.RecId != 0);
    purchReqLine_ds.object(fieldnum(PurchReqLine,CurrencyCode)).allowEdit(allowEdit);
    purchReqLine_ds.object(fieldnum(PurchReqLine,LineAmount)).allowEdit(!purchReqLine.isCatalogItem());

    //atus
    Select FirstOnly ReqLine
        Where ReqLine.PurchReqId == PurchReqTable.PurchReqId &&
                ReqLine.PurchRFQCaseId !="";
    if(!ReqLine)
    {
        purchReqLine_ds.object(fieldnum(PurchReqLine,ExternalItemId)).allowEdit(true);
    }


    //IBN
    //xSysGlobalCache = ClassFactory.globalCache();
    //xSysGlobalCache.set(curuserid(), 1, "");

    //By CAH
    if (PurchReqTable.ApprovalStatus == ApprovalStatus::Pending ||
        PurchReqTable.ApprovalStatus == ApprovalStatus::None ||
        PurchReqTable.ApprovalStatus == ApprovalStatus::Rejected)
    {
      if (PurchReqTable.Soltius_PRGroup == Soltius_PR_Group::Inventory)
      {
        if (PurchReqTable.PurchOrigin == RequisitionOrigin::Local ||
            PurchReqTable.PurchOrigin == RequisitionOrigin::None)
        {
            if (element.CheckItemType() == true)
            {
                Validate.visible(true);
                Validate.enabled(true);

                select CAH_ValidateQty, CAH_ApprovedQty from tblPurchReqTable
                    where tblPurchReqTable.PurchReqId == PurchReqTable.PurchReqId;
                if (tblPurchReqTable.CAH_ValidateQty == noyes::No)
                {
                    validQty.enabled(true);
                }
                else
                {
                    validQty.enabled(false);
                }

                if (tblPurchReqTable.CAH_ApprovedQty == noyes::No)
                {
                    approvqty.enabled(true);
                }
                else
                {
                    approvqty.enabled(false);
                }

            }
            ValidHistoris.visible(true);
            ValidHistoris.enabled(true);
        }
        else
        {
            Validate.visible(false);
            //ValidHistoris.visible(false);
            ValidHistoris.visible(true);
        }
      }
      else
      {
        Validate.visible(false);
        //ValidHistoris.visible(false);
        ValidHistoris.visible(true);
      }
    }
    else
    {
        Validate.visible(false);
        //ValidHistoris.visible(false);
        ValidHistoris.visible(true);
    }

}

0 comments:

A financial dimension value is based on the LAND-00013 record and has been used on a transaction. You cannot delete the LAND-00013 record AX 2012

 A financial dimension value is based on the LAND-00013 record and has been used on a  transaction. You cannot delete the LAND-00013 record ...