Quantcast
Channel: Microsoft Dynamics AX Forum - Recent Threads
Viewing all 175888 articles
Browse latest View live

Restrict "Edit category hierarchy" button on the procurement category form

$
0
0

Hi all, 

I want to restrict some of the users with particular roles giving access to edit the procurement category form. The Edit category hierarchy button needs to be restricted for them so they can't edit the category names or their description on the form but they can still view the category form.

Thanks much.  


Cost accounting

$
0
0

I am unable to find the cost accounting module docs which contains process and how to work on Cost accounting module in d365 F&O ..

In Microsoft Docs only theory part is there but no process or how to work on cost accounting module is not there.

For example : Suppose there is a topic Cost sheet so in Microsoft Docs there is no mentioned how to prepare cost sheet and how to interpret it.

Kindly someone please share the matter of cost accounting module which includes how to work and process in d365 f&o

Error in Inventory Recalculation (Ax2012R3)

$
0
0

Hi,

        we make the inventory closing for Year 2021 its gone fine, then recalculation for the month of jan 2022 its ok. But  for the recalculation of Feb 2022 the system stop at certain point and keep looping , when i check the error log by the voucher no. its gives miscellaneous, after that i break the process and pause\resume the process it will stop again at certain item then keep looping  with no further progress,  

version of Ax2012R3  

i want to know what are possible root causes. how to solve this issue. 

 appreciate your  help.

Thanks.

hashmath

selected value of multi select lookup not displaying in form

$
0
0

I have created multi select lookup. It is working fine but when I select value it does not display value on form. below is my screen shot 

Sales Order without lines validation

$
0
0

In the SalesTableListPage form, when I select 2 sales order with only one of the my selected orders has lines, then I press the invoice button.
The SalesEditLines form open with the valid selected order only displayed.

Where is the code that validate whether the order has lines or not?

Your help is most appreciated.
Thanks in advance.

X++ code to get FinancialDimension Name/description from generaljournalAccountrEntry(LedgerDimensionField)

$
0
0

Hello,

I have below code to get Financial Dimension values from generaljournalAccountrEntry(LedgerDimensionField). I need Financial dimension description or name like below in picture and below is my code its getting only financial dimension segment CostCenter. But I need Full name/description of CostCenter.

static void Job32(Args _args)
{
      DimensionAttributeLevelValueAllView dimAttrLevelAll;
    DimensionAttribute                  dimAttribute;
    DimensionAttributeValue     dimAttributeValue;
    DimensionFinancialTag               dimensionfinancialtag;
    refrecid  financialTagCategory;
    ;


    select DisplayValue from dimAttrLevelAll
    join dimAttribute
    where dimAttribute.RecId                    == dimAttrLevelAll.DimensionAttribute
           && dimAttrLevelAll.ValueCombinationRecId == 5640344835 //generalJournalAccountEntry.LedgerDimension && dimAttribute.Name                     == "CostCenter";
    info(strFmt("CostCenter: %1", dimAttrLevelAll.DisplayValue)); 
   // info(strFmt("CostCenter Name/Desc: %1", dimAttribute.dimensionName())); 

}

Budget Reservation isn't working as expected

$
0
0

Greetings all, this is my first post here and I'm a new user of AX system in general.

We've recently activated the budget control in our company and now we started linking it with purchase requisitions but it behaves in a strange way.

So when a user creates a PR for Feb and the PR is released to a PO and I closed by the accounting team in the same month it behaves as expected (the amounts are deducted from Feb budget and are converted to actual expenditures)

what I can't comprehend is when a user creates a PR at the end of the month for example on the 28th of Feb and the accounting team released the PR to a PO in march. the system automatically reserves the budget from Feb and transfers it into march. I expected it to reserve from Feb budget but why is it automatically transferring the amounts to March budget as illustrated in the photo below? the accounting team now can't post it in Feb expenses unless I do a manual transfer from march to Feb as it exceeds the budget amount.

Thanks in advance

Microsoft Dynamics AX 2012 endpoint URL

$
0
0

I need Microsoft Dynamics AX 2012 endpoint URL to integrate with. But I didn't know how to get or generate??


Stopped (error): X++ Exception cannot create a record in alerts - event inbox data (EventInboxData). Inbox ID : 5637144685. The record already exists. at

$
0
0

Hello,

I hope you are doing good.

I getting below error whenever I am creating purchase order workflow.

I am submitting the workflow from draft to in review. After running the workflow I am getting error below.

 

Can you please help me with this?

Clear Values On Form

$
0
0

How to clear the values when i reopen the form or when i open the form?

Change Main account type from P&L to Balance Sheet after role over,

$
0
0

Hi, 

We have just finished our year end rollover. We compared the Trial balances before and after and found one difference. Account 06227 was setup incorrectly in the chart of accounts as a P+L account when it should have been balance sheet. We've made the correction now.

Do we have to do the rollover  again to see the changes?

Thanks 

label files not shown after importing and exporting

$
0
0

i export label file from environment to another and labels not shown i deployed the report but nothing happened ..

any help ?

Retail statement Posting - How to update sales table custom field during posting

$
0
0

Hello Everyone,

There is a scenario I need to update one custom field in sales table during posting the statement. So, while debugging unable to find the place where sales order is creating and which place, I can write my logic to update my custom field.

anyone can help me on this.

Steps:  Store financials>Calculate Statement >Post statement.

is it possible to refresh DB from PU45 version to tier 2 to PU45 sandbox, as Microsoft has stopped supporting PU40 versions

$
0
0

is it possible to refresh DB from PU45 version to tier 2 to PU45 sandbox, as Microsoft has stopped supporting PU40 versions

Sales Order Voucher Transactions Discrepancy

$
0
0

This is my setup for a specific item group/item model group:

Upon sales order invoicing, this is what the voucher looks like.

But some of the sales order vouchers (items using the same item group/item model group), looks like this.

What should we do, all the sales order vouchers should look like the 2nd picture with 2 lines only. Since this is a revenue from sales orders.

What setup should we remove? And why does it apply only to few invoices?

PS: Both invoices/vouchers did NOT go through packing slip.


Unable to arrange grid columns

$
0
0

Hi,

I have created new column (Currency) in a form grid. But I am unable to arrange it. I need to move this column to the front. But it is shown at the last column. 

I have set it by using ALT+UP near Costamount column but it is showing at the last. Need your help.

Regards,

Ram

Retrive All Projects childs and childs of childs

$
0
0

in project managment i wanna get all projects childs and childs of childs 

for ex proj1 - proj1-1 - proj1-1-1 - proj1-2


* proj proj1-1 , proj1-2 childs of proj1

*  proj1-1-1 child of proj1-1

i wanna retrive all in one query ,, any help ?

Form does not insert value in all tables

$
0
0

I have created customize form for creating new employee in AX 2012. Form was working correctly when deployed on test server but when i deployed on live server it is misbehaving. When user insert data first time then form insert values in all tables but when user insert second record it insert data only in some table not all table. What should be the reason.

Note : I want to tell you that I have written all insert code in click method of button.

Here is my code

void clicked()
{
    DialogButton Button;
    boolean                                 ret = true;
    boolean                             isHcmPositionTable;
    boolean                             ishcmjobtable;
    boolean                             ishcmjobdetail;
    boolean                             ishcmpositiondetailtable;
    boolean                             ishcmpositiondurationtable;
    boolean                             ishcmpositiondefaultdimensiontable;
    boolean                             isPayrollPositionDetailstable;
    boolean                             ishcmworkertable;
    boolean                             ishcmemploymenttable;
    boolean                             ishcmemploymentdetailtable;
    boolean                             isWorkCalendarEmploymenttable;
    boolean                             isHcmPersonPrivateDetailstable;
    boolean                             isaddressView;
    boolean                             ishcmpersondetails;
    boolean                             isPayrollWorkerPositionEarningCode;
    boolean                             isHRMCompFixedEmpl;

    CompanyInfo                             companyInfo;
    HcmEmploymentRecId                      newEmploymentRecId;
    HcmPositionWorkerAssignmentRecId        newPositionWorkerAssignmentRecId;
    HcmPositionWorkerAssignmentStartDate    assignmentStrtDt;
    HcmPositionWorkerAssignmentEndDate      assignmentEndDt;
    str                                     newWorkerContractId,_earningCode;
    int64                                   internshipDurationVar;
    SL_InternshipDuration                   durationUnit;
    utcDateTime                             newDateIntern;
    boolean                                 isRenew;
    date                                    _joiningDate;
    #RetailSMB
    //utcDateTime                             validFrom;

    //laraib code
    DirPersonName                           _dirPersonName;
    ValidFromDateTime                       employmentStartDateTime;
    ValidToDateTime                         employmentEndDateTime;
    HcmTitle                                _hcmtitletable;
    HcmWorkerPrimaryPosition                _HcmWorkerPrimaryPositionTable;
    HcmJob                                  _hcmjobtable;
    HcmPosition                             _hcmpositiontable;
    HcmPositionDetail                       _hcmpositiondetailtable;
    HcmPositionDuration                     _hcmpositiondurationtable;
    HcmPositionDefaultDimension             _hcmpositiondefaultdimensiontable;
    HcmWorker                               _hcmworkertable;
    HcmEmployment                           _hcmemploymenttable;
    HcmEmploymentDetail                     _hcmemploymentdetailtable;
    WorkCalendarEmployment                  _WorkCalendarEmploymenttable;
    HcmPersonPrivateDetails                 _HcmPersonPrivateDetailstable;
    DirPartyPostalAddressView               _DirPartyPostalAddressViewtable;
    HcmPersonDetails                        _hcmpersondetails;
    PayrollWorkerPositionEarningCode        _PayrollWorkerPositionEarningCode;
    HRMCompFixedEmpl                        _HRMCompFixedEmpl;
    HcmWorkerTitle                          _HcmWorkerTitletable;
    HcmJobDetail                            _hcmjobdetail;
    OMOperatingUnit                         _department;
    PayrollPositionDetails                  _PayrollPositionDetailstable;
    HCMPOSITIONWORKERASSIGNMENT             _hcmpositionworkerassignmenttable;
    str                                     _zone,_city,_location,_financialdept;
    date                                    _HcmPersonBirthDate;
    HRMCompFixedEmplActionHire              hrmCompFixedEmplActionHire;
    HRMCompFixedPlanTable                   hrmCompFixedPlanTable;
    str                                     NewActionId = 'Hire';
    str                                     NewPlanId = 'Worker',_Userbranch;
    int64                                   _personnelno;
    HcmPersonnelNumberId                    _Generatedpersonalnumber,_hcmPersonnelNumberId;
    HcmEmploymentType                       _employmenttype;
    HcmPersonGender                         _gender;
    PaymMode                                _paymentmode;
    SysUserInfo                             _SysUserInfo;

    DirPartyPostalAddressView               _dirPartyPostalAddressView;
    DirParty                                _dirPartyforaddress;
    DirPartyTable                           _dirPartyTable;


    DimensionAttributeValueSetStorage valueSetStorage = new DimensionAttributeValueSetStorage();
    DimensionDefault result;
    int i;
    DimensionAttribute dimensionAttribute;
    DimensionAttributeValue dimensionAttributeValue;

    container conAttr = ["Zone", "Branch","Department_Costcenter","Item_Faimly","Location"]; // Dimensions
    container conValue;
    str dimValue;

    DirPersonRecId                                  _dirPersonRecid;
    DirPartyPostalAddressView                       _addressView;
    dirPartyContactInfoView                         _contactView;
    DirParty                                        _dirParty;
    container                                       _roles;
    boolean                                         _isAlltable = false;
    BOOLEAN                                         _isAllPositiontable = false;
    boolean                                         _isAllemploymenttable = false;
    boolean                                         _isdetailtables = true;

    isHcmPositionTable = false;
    ishcmjobtable = false;
    ishcmjobdetail = false;
    ishcmpositiondetailtable  = false;
    ishcmpositiondurationtable = false;
    ishcmpositiondefaultdimensiontable = false;
    isPayrollPositionDetailstable = false;
    ishcmworkertable = false;
    ishcmemploymenttable = false;
    ishcmemploymentdetailtable = false;
    isWorkCalendarEmploymenttable = false;
    isHcmPersonPrivateDetailstable = false;
    isaddressView = false;
    ishcmpersondetails = false;
    isPayrollWorkerPositionEarningCode = false;
    isHRMCompFixedEmpl = false;




   if (element.isValidCreate() == false)
    {

        throw error("You have missed above mandatory fields thats why this Employee Can not be created. Please Reopen this form and do the process.");
        //info('You have missed above mandatory fields thats why this Employee Can not be created. Please Reopen this form and do the process.');
        //Ok.visible(false);
    }


    else if(element.isValidCreate() == true)
    {
        _Generatedpersonalnumber = personnelNumber.valueStr();
        if (isAlreadyCNICExist == true)
        {
             Button=  Box::okCancel('This person was your employee. Are you sure to rehire this person.',DialogButton::No);
                if (Button == DialogButton::Ok)
                {
                    element.rehireemployee();
                }
            //element.rehireemployee();
        }

        else if (isAlreadyCNICExist == false)
        {

        Ok.visible(true);
        _SysUserInfo = SysUserInfo::find(curUserId());
        if(_SysUserInfo.Id == 'laraib.t')
        {
            SLPRLMethodOfPayment.visible(false);
             _HcmPersonBirthDate = DateTimeUtil::date(utc_Datetime.dateTimeValue());
              dirPersonName.FirstName     = FirstName.valueStr();
              dirPersonName.MiddleName    = MiddleName.valueStr();
              dirPersonName.LastName      = LastName.valueStr();
             _joiningDate = DateTimeUtil::date(EmploymentStartDate.dateTimeValue());
              employmentStartDateTime = datetobeginUtcDateTime(_joiningDate,DateTimeUtil::getUserPreferredTimeZone());
              employmentEndDateTime = DateTimeUtil::maxValue();
             _gender = Gender.selection();
             _department = OMOperatingUnit::findName(Dept.valueStr(),OMOperatingUnitType::OMDepartment);
            _employmenttype = HcmEmploymentType::Contractual;
          _Userbranch = 'BQF';
            _location = 'Bin Qasim Factory';
            _zone = 'South';
            _city = 'Karachi';
            _financialdept = 'Production-BQF';

            HcmEmployment_PaymMode.enabled(true);
            relationType.enabled(true);
            if (_zone && _city && _location && _financialdept)
                {
                    conValue = [DimensionFinancialTag::findByFinancialTagCategoryAndDiscription(5637144582,_zone).Value,
                    DimensionFinancialTag::findByFinancialTagCategoryAndDiscription(5637144581,_location).Value,
                    DimensionFinancialTag::findByFinancialTagCategoryAndDiscription(5637144578,_financialdept).Value,"999",
                    DimensionFinancialTag::findByFinancialTagCategoryAndDiscription(5637144576,_city).Value];
                }

                for (i = 1; i <= conLen(conAttr); i++)
                {
                dimensionAttribute = dimensionAttribute::findByName(conPeek(conAttr,i));
                if (dimensionAttribute.RecId == 0)
                {
                continue;
                }
                dimValue = conPeek(conValue,i);
                    if (dimValue != "")
                    {
                    // The last parameter is “true”. A dimensionAttributeValue record will be created if not //found.
                    dimensionAttributeValue =
                    dimensionAttributeValue::findByDimensionAttributeAndValue(dimensionAttribute,dimValue,false,true);
                    // Add the dimensionAttibuteValue to the default dimension
                    valueSetStorage.addItem(dimensionAttributeValue);

                    }
                }

                result = valueSetStorage.save();
        }
        if(_SysUserInfo.Id == 'raheel.a')
        {

             _HcmPersonBirthDate = DateTimeUtil::date(utc_Datetime.dateTimeValue());
              dirPersonName.FirstName     = FirstName.valueStr();
              dirPersonName.MiddleName    = MiddleName.valueStr();
              dirPersonName.LastName      = LastName.valueStr();
             _joiningDate = DateTimeUtil::date(EmploymentStartDate.dateTimeValue());
              employmentStartDateTime = datetobeginUtcDateTime(_joiningDate,DateTimeUtil::getUserPreferredTimeZone());
              employmentEndDateTime = DateTimeUtil::maxValue();
             _gender = Gender.selection();
             _department = OMOperatingUnit::findName(Dept.valueStr(),OMOperatingUnitType::OMDepartment);
             _employmenttype = HcmEmploymentType::Contractual;
             _paymentmode = 'CASH';

            //////////////////////////
            _Userbranch = 'BQF';
            _location = 'Bin Qasim Factory';
            _zone = 'South';
            _city = 'Karachi';
            _financialdept = 'Production-BQF';
             HcmEmployment_PaymMode.enabled(false);
            relationType.enabled(false);
            _employmenttype = HcmEmploymentType::Contractual;
            _paymentmode = 'CASH';
            if (_zone && _city && _location && _financialdept)
                {
                    conValue = [DimensionFinancialTag::findByFinancialTagCategoryAndDiscription(5637144582,_zone).Value,
                    DimensionFinancialTag::findByFinancialTagCategoryAndDiscription(5637144581,_location).Value,
                    DimensionFinancialTag::findByFinancialTagCategoryAndDiscription(5637144578,_financialdept).Value,"999",
                    DimensionFinancialTag::findByFinancialTagCategoryAndDiscription(5637144576,_city).Value];
                }

                for (i = 1; i <= conLen(conAttr); i++)
                {
                dimensionAttribute = dimensionAttribute::findByName(conPeek(conAttr,i));
                if (dimensionAttribute.RecId == 0)
                {
                continue;
                }
                dimValue = conPeek(conValue,i);
                    if (dimValue != "")
                    {
                    // The last parameter is “true”. A dimensionAttributeValue record will be created if not //found.
                    dimensionAttributeValue =
                    dimensionAttributeValue::findByDimensionAttributeAndValue(dimensionAttribute,dimValue,false,true);
                    // Add the dimensionAttibuteValue to the default dimension
                    valueSetStorage.addItem(dimensionAttributeValue);

                    }
                }

                result = valueSetStorage.save();
        }
        if(_SysUserInfo.Id == 'ikram.qa')
        {
             _HcmPersonBirthDate = DateTimeUtil::date(utc_Datetime.dateTimeValue());
              dirPersonName.FirstName     = FirstName.valueStr();
              dirPersonName.MiddleName    = MiddleName.valueStr();
              dirPersonName.LastName      = LastName.valueStr();
             _joiningDate = DateTimeUtil::date(EmploymentStartDate.dateTimeValue());
              employmentStartDateTime = datetobeginUtcDateTime(_joiningDate,DateTimeUtil::getUserPreferredTimeZone());
              employmentEndDateTime = DateTimeUtil::maxValue();
             _gender = Gender.selection();
             _department = OMOperatingUnit::findName(Dept.valueStr(),OMOperatingUnitType::OMDepartment);
             _employmenttype = HcmEmploymentType::Contractual;
             _paymentmode = 'CASH';
            //////////////////////////////////////////
            _Userbranch = 'PQF';

            _location = 'Port Qasim Factory';
            _zone = 'South';
            _city = 'Karachi';
            _financialdept = 'Production PQF';
            relationType.enabled(false);
            HcmEmployment_PaymMode.enabled(false);
            _employmenttype = HcmEmploymentType::Contractual;
            _paymentmode = 'CASH';

                if (_zone && _city && _location && _financialdept)
                {
                    conValue = [DimensionFinancialTag::findByFinancialTagCategoryAndDiscription(5637144582,_zone).Value,
                    DimensionFinancialTag::findByFinancialTagCategoryAndDiscription(5637144581,_location).Value,
                    DimensionFinancialTag::findByFinancialTagCategoryAndDiscription(5637144578,_financialdept).Value,"999",
                    DimensionFinancialTag::findByFinancialTagCategoryAndDiscription(5637144576,_city).Value];
                }

                for (i = 1; i <= conLen(conAttr); i++)
                {
                dimensionAttribute = dimensionAttribute::findByName(conPeek(conAttr,i));
                if (dimensionAttribute.RecId == 0)
                {
                continue;
                }
                dimValue = conPeek(conValue,i);
                    if (dimValue != "")
                    {
                    // The last parameter is “true”. A dimensionAttributeValue record will be created if not //found.
                    dimensionAttributeValue =
                    dimensionAttributeValue::findByDimensionAttributeAndValue(dimensionAttribute,dimValue,false,true);
                    // Add the dimensionAttibuteValue to the default dimension
                    valueSetStorage.addItem(dimensionAttributeValue);

                    }
                }

                result = valueSetStorage.save();
        }

            if(_SysUserInfo.Id == 'axtest')
        {
            SLPRLMethodOfPayment.visible(false);
             _HcmPersonBirthDate = DateTimeUtil::date(utc_Datetime.dateTimeValue());
              dirPersonName.FirstName     = FirstName.valueStr();
              dirPersonName.MiddleName    = MiddleName.valueStr();
              dirPersonName.LastName      = LastName.valueStr();
             _joiningDate = DateTimeUtil::date(EmploymentStartDate.dateTimeValue());
              employmentStartDateTime = datetobeginUtcDateTime(_joiningDate,DateTimeUtil::getUserPreferredTimeZone());
              employmentEndDateTime = DateTimeUtil::maxValue();
             _gender = Gender.selection();
             _department = OMOperatingUnit::findName(Dept.valueStr(),OMOperatingUnitType::OMDepartment);
            _employmenttype = HcmEmploymentType::Contractual;
          _Userbranch = 'BQF';
            _location = 'Bin Qasim Factory';
            _zone = 'South';
            _city = 'Karachi';
            _financialdept = 'Production-BQF';

            HcmEmployment_PaymMode.enabled(true);
            relationType.enabled(true);
            if (_zone && _city && _location && _financialdept)
                {
                    conValue = [DimensionFinancialTag::findByFinancialTagCategoryAndDiscription(5637144582,_zone).Value,
                    DimensionFinancialTag::findByFinancialTagCategoryAndDiscription(5637144581,_location).Value,
                    DimensionFinancialTag::findByFinancialTagCategoryAndDiscription(5637144578,_financialdept).Value,"999",
                    DimensionFinancialTag::findByFinancialTagCategoryAndDiscription(5637144576,_city).Value];
                }

                for (i = 1; i <= conLen(conAttr); i++)
                {
                dimensionAttribute = dimensionAttribute::findByName(conPeek(conAttr,i));
                if (dimensionAttribute.RecId == 0)
                {
                continue;
                }
                dimValue = conPeek(conValue,i);
                    if (dimValue != "")
                    {
                    // The last parameter is “true”. A dimensionAttributeValue record will be created if not //found.
                    dimensionAttributeValue =
                    dimensionAttributeValue::findByDimensionAttributeAndValue(dimensionAttribute,dimValue,false,true);
                    // Add the dimensionAttibuteValue to the default dimension
                    valueSetStorage.addItem(dimensionAttributeValue);

                    }
                }

                result = valueSetStorage.save();
        }


        if(_SysUserInfo.Id == 'laraib.t' || _SysUserInfo.Id == 'axtest' || _SysUserInfo.Id == 'raheel.a' || _SysUserInfo.Id == 'ikram.qa')
        {


                        _hcmtitletable = HcmTitle::findByTitle(designation.valueStr());
            if(!_hcmtitletable)
                {
                    throw error('Employee can not be created beacuse you have selected wrong designation.');
                    info('Please ask HR Dept to create new designation.');

                }
            else if(_hcmtitletable)
                {
                    //checking either job exist or not
                    _hcmjobtable = HcmJob::findByJob(_hcmtitletable.TitleId);
                    _hcmjobdetail = HcmJobDetail::findByJob(_hcmjobtable.RecId);

                    if(!_hcmjobtable)
                    {
                    _hcmjobtable.clear();
                    _hcmjobtable.initValue();
                    _hcmjobtable.JobId = designation.valueStr();
                    _hcmjobtable.MaximumPositions = 2147483647;

                    if(_hcmjobtable.validateWrite())
                    {
                        _hcmjobtable.insert();
                        ishcmjobtable =true;
                    }

                    _hcmjobdetail = HcmJobDetail::findByJob(_hcmjobtable.RecId);
                        if (!_hcmjobdetail)
                        {
                            _hcmjobdetail.clear();
                            _hcmjobdetail.initValue();
                            _hcmjobdetail.Job = _hcmjobtable.RecId;
                            _hcmjobdetail.ValidFrom = DateTimeUtil::addHours(employmentStartDateTime, -3);
                            _hcmjobdetail.ValidTo = employmentEndDateTime;
                            _hcmjobdetail.DefaultFullTimeEquivalency = 1.00;
                            _hcmjobdetail.Description = _hcmjobtable.JobId;
                            _hcmjobdetail.CompensationLevel = 5637144576;
                            _hcmjobdetail.Title = _hcmtitletable.RecId;
                            _hcmjobdetail.JobFunction = 0;
                            _hcmjobdetail.JobType = 0;
                            _hcmjobdetail.SurveyCompany = 0;
                            if(_hcmjobdetail.validateWrite())
                            {
                                _hcmjobdetail.insert();
                                ishcmjobdetail =true;
                            }
                        }
                    }

                     if (dirPersonName.Person != 0 || element.checkDuplicateName())
                {
                    select firstonly RecId from companyInfo where companyInfo.DataArea == 'rni';

                    //startLengthyOperation();
                }

                //if (ishcmjobtable == true && ishcmjobdetail == true)
                    //{
                    // inserting hcmposition table
                       _hcmpositiontable.clear();
                       _hcmpositiontable.initValue();
                       _hcmpositiontable.PositionId = NumberSeq::newGetNum(NumberSeqReference::findReference(extendedTypeNum(HcmPositionId)), true).num();
                        _hcmpositiontable.insert();
                            //ishcmpositiontable =true;
                       _hcmpositiondetailtable = HcmPositionDetail::findByPosition(_hcmpositiontable.RecId);


                    if (!_hcmpositiondetailtable)
                    {
                        //inserting hcmposition detail table
                         _hcmpositiondetailtable.clear();
                         _hcmpositiondetailtable.initValue();

                         _hcmpositiondetailtable.Position = _hcmpositiontable.RecId;
                         _hcmpositiondetailtable.Job = HcmJob::findByJob(_hcmjobtable.JobId).RecId;
                         _hcmpositiondetailtable.ValidFrom = employmentStartDateTime;
                         _hcmpositiondetailtable.ValidTo = employmentEndDateTime;
                         _hcmpositiondetailtable.Position  = _hcmpositiontable.RecId;
                         _hcmpositiondetailtable.Department = _department.recid;
                         _hcmpositiondetailtable.Description =_hcmtitletable.TitleId;
                         _hcmpositiondetailtable.Title = _hcmtitletable.RecId;
                         _hcmpositiondetailtable.Job = _hcmjobdetail.Job;
                         _hcmpositiondetailtable.FullTimeEquivalency = 0.00;
                         _hcmpositiondetailtable.CompLocation = 0;
                         _hcmpositiondetailtable.PositionType = 5637144577;

                        if(_hcmpositiondetailtable.validateWrite())
                        {
                            _hcmpositiondetailtable.insert();
                            //ishcmpositiondetailtable =true;
                        }

                        //checking hcmpositiondurationtable
                        _hcmpositiondurationtable = HcmPositionDuration::findByPosition(_hcmpositiontable.RecId);
                        _PayrollPositionDetailstable = PayrollPositionDetails::findByPosition(_hcmpositiontable.RecId);

                        if(!_hcmpositiondurationtable)
                        {
                            _hcmpositiondurationtable.clear();
                            _hcmpositiondurationtable.initValue();
                            _hcmpositiondurationtable.Position    = _hcmpositiontable.RecId;
                            _hcmpositiondurationtable.ValidFrom   = employmentStartDateTime;
                            _hcmpositiondurationtable.ValidTo     = employmentEndDateTime;

                            if(_hcmpositiondurationtable.validateWrite())
                            {
                                 _hcmpositiondurationtable.insert();
                               // ishcmpositiondurationtable = true;
                            }
                        }

                         if (!_hcmpositiondefaultdimensiontable)
                            {
                                //inserting hcmpositiondefaultdimensiontable
                                 _hcmpositiondefaultdimensiontable.LegalEntity = companyInfo.RecId;
                                 _hcmpositiondefaultdimensiontable.DefaultDimension = result;
                                 _hcmpositiondefaultdimensiontable.Position = _hcmpositiontable.RecId;
                                 _hcmpositiondefaultdimensiontable.AccountingDistributionTemplate = 0;
                                if(_hcmpositiondefaultdimensiontable.validateWrite())
                                { _hcmpositiondefaultdimensiontable.insert();
                                    //ishcmpositiondefaultdimensiontable =true;
                                }
                            }
                        if (!_PayrollPositionDetailstable)
                        {
                            _PayrollPositionDetailstable.AutoGenerateSalary = NoYes::Yes;
                            _PayrollPositionDetailstable.DefaultEarningCode = 5637144576;
                            _PayrollPositionDetailstable.DefaultGLIBenefit = 0;
                            _PayrollPositionDetailstable.GenerateEarningsFromSchedule = NoYes::No;
                            _PayrollPositionDetailstable.IsCompanyOfficer = NoYes::No;
                            _PayrollPositionDetailstable.PaidByLegalEntity = 5637145326;
                            _PayrollPositionDetailstable.PayCycle = 5637144576;
                            _PayrollPositionDetailstable.PayrollNormalHours = 2920.00;
                            _PayrollPositionDetailstable.PayrollOvertimeHours = 0.00;
                            _PayrollPositionDetailstable.Position = _hcmpositiontable.RecId;
                            _PayrollPositionDetailstable.Schedule = "Calendar";
                            _PayrollPositionDetailstable.ScheduleDataAreaId = "rni";
                            _PayrollPositionDetailstable.ValidFrom = DateTimeUtil::date(employmentStartDateTime);// DateTimeUtil::date(DateTimeUtil::addHours(EmploymentStartDate.dateTimeValue(), -1));
                            _PayrollPositionDetailstable.ValidTo = DateTimeUtil::date(employmentEndDateTime);
                            _PayrollPositionDetailstable.WorkCycle = 0;
                            if(_PayrollPositionDetailstable.validateWrite())
                            {_PayrollPositionDetailstable.insert();
                               // isPayrollPositionDetailstable = true;
                            }
                        }
                    }
                    //}

                    //if(isPayrollPositionDetailstable == true && ishcmpositiontable == true && ishcmpositiondefaultdimensiontable == true
                        //&& ishcmpositiondetailtable == true)
                    //{
                        //_isAllPositiontable = true;
                        //
                    //}




             //if (_employmenttype == HcmEmploymentType::Contractual)
                     //{
//
//
                         //if (_Userbranch == 'BQF')
                         //{
                                    //select firstfast _hcmworkertable order by _hcmworkertable.PersonnelNumber desc
                                    //where _hcmworkertable.HcmEmployementType == HcmEmploymentType::Contractual
                                     //&& !(_hcmworkertable.PERSONNELNUMBER like '*TESTING*')
                                    //&& (_hcmworkertable.PERSONNELNUMBER like '2*');
                                    //personnelno = str2int64(_hcmworkertable.PersonnelNumber);
                                    //Generatedpersonalnumber =  strFmt("%1",int642str(personnelno+1));
                         //}
//
                          //else if (_Userbranch == 'PQF')
                         //{
                                    //select firstfast _hcmworkertable order by _hcmworkertable.PersonnelNumber desc
                                    //where _hcmworkertable.HcmEmployementType == HcmEmploymentType::Contractual
                                    //&& !(_hcmworkertable.PERSONNELNUMBER like '*TESTING*') && (_hcmworkertable.PERSONNELNUMBER like '1*')
                                    //&& !(_hcmworkertable.PERSONNELNUMBER like '*100331_del*');
                                    //personnelno = str2int64(_hcmworkertable.PersonnelNumber);
                                    //Generatedpersonalnumber =  strFmt("%1",int642str(personnelno+1));
//
                         //}
                        // checking either employee exist or not

                    // }

                     _hcmworkertable = HcmWorker::findByPersonnelNumber(_Generatedpersonalnumber);

             if (!_hcmworkertable || _hcmworkertable.RecId == 0)
                     {

                                    //inserting in hcmworker
                                    _hcmworkertable = HcmWorker::find(HcmWorkerTransition::newHireHcmWorker_Customize(CNIC.valueStr(),
                                                                                _employmenttype,
                                                                                 dirPersonName,
                                                                                 _Generatedpersonalnumber,
                                                                                 _hcmpositiontable.RecId,
                                                                                 employmentStartDateTime,
                                                                                 employmentEndDateTime,
                                                                                 employmentStartDateTime,//DateTimeUtil::removeTimeZoneOffset(EmploymentStartDate.dateTimeValue(), DateTimeUtil::getUserPreferredTimeZone()),
                                                                                 employmentEndDateTime,
                                                                                 companyInfo.RecId
                                                                                 ));
                                       // ishcmworkertable = true;



                                    _hcmWorkerTitletable.clear();
                                    _hcmWorkerTitletable.initValue();
                                    _hcmWorkerTitletable.Worker = HcmWorker::findByPersonnelNumber(_Generatedpersonalnumber).RecId;
                                    _hcmWorkerTitletable.Title = _hcmtitletable.RecId;
                                    _hcmWorkerTitletable.OfficeLocation = _location;
                                    _hcmWorkerTitletable.ValidFrom = employmentStartDateTime;
                                    _hcmWorkerTitletable.ValidTo = employmentEndDateTime;
                                    _hcmWorkerTitletable.Location = 0;
                                    if(_hcmWorkerTitletable.validateWrite())
                                    {_hcmWorkerTitletable.insert();}


                                        //updating hcmemployment
                                        _hcmemploymenttable.validTimeStateUpdateMode(ValidTimeStateUpdate::Correction);
                                        ttsBegin;
                                                 while select forUpdate _hcmemploymenttable
                                                    where _hcmemploymenttable.Worker       == HcmWorker::findByPersonnelNumber(_Generatedpersonalnumber).RecId
                                                     && _hcmemploymenttable.EmploymentType == _employmenttype&& _hcmemploymenttable.LegalEntity == companyInfo.RecId
                                                        {
                                                                    if (_hcmemploymenttable.EmploymentType == HcmEmploymentType::Contractual)
                                                                    {
                                                                             _hcmemploymenttable.DefaultDimension = result;
                                                                             _hcmemploymenttable.VendAccount = "V-000001";
                                                                             _hcmemploymenttable.PaymMode = 'CASH';
                                                                             _hcmemploymenttable.SLDefaultProfileId = "General";
                                                                             _hcmemploymenttable.SLMarkAutoAttendance = NoYes::Yes;
                                                                             _hcmemploymenttable.SLExperience = 0;
                                                                             if(_hcmemploymenttable.validateWrite())
                                                                             {_hcmemploymenttable.Update();
                                                                                 //ishcmemploymenttable = true;
                                                                        }
                                                                    }
                                                            }
                                        ttsCommit;

                                        //checking employment detail
                                        _hcmemploymentdetailtable = HcmEmploymentDetail::findByWorkerLegalEntity(_hcmworkertable.RecId,companyInfo.RecId);



                                        if(_hcmemploymentdetailtable)
                                        {
                                            _hcmemploymentdetailtable.ValidTimeStateUpdateMode (ValidTimeStateUpdate::Correction);
                                            //Updating employment detail
                                            ttsBegin;
                                             while select forUpdate _hcmemploymentdetailtable
                                                where _hcmemploymentdetailtable.Employment == _hcmworkertable.RecId
                                                    {

                                                        _hcmemploymentdetailtable.WorkerStartDate = employmentStartDateTime;
                                                        _hcmemploymentdetailtable.AdjustedWorkerStartDate = employmentStartDateTime;
                                                        _hcmemploymentdetailtable.ValidFrom = employmentStartDateTime;
                                                        //if(_hcmemploymentdetailtable.validateWrite())
                                                        //{
                                                            _hcmemploymentdetailtable.update();
                                                            //ishcmemploymentdetailtable = true;
                                                        //}
                                                    }
                                            ttsCommit;
                                            _hcmemploymenttable = HcmEmployment::findByWorkerLegalEntity(_hcmworkertable.RecId,companyInfo.RecId);
                                            _WorkCalendarEmploymenttable = WorkCalendarEmployment::findByEmploymentRecId(_hcmemploymenttable.RecId);
                                        }

                    }


              if(_WorkCalendarEmploymenttable && _hcmemploymenttable.RecId != 0)
                {
                     ttsBegin;
                                                 while select forUpdate _WorkCalendarEmploymenttable
                                                    where _WorkCalendarEmploymenttable.Employment == _hcmemploymenttable.RecId
                                                        {
                                                            _WorkCalendarEmploymenttable.CalendarId = "Calendar";
                                                            _WorkCalendarEmploymenttable.CalendarDataAreaId = "rni";
                                                            if(_WorkCalendarEmploymenttable.validateWrite())
                                                            {
                                                                _WorkCalendarEmploymenttable.doUpdate();
                                                                //isWorkCalendarEmploymenttable = true;
                                                            }
                                                        }
                     ttsCommit;

                }

            if(!_WorkCalendarEmploymenttable && _hcmemploymenttable.RecId != 0)
                    {
                         //inserting calendar
                         _WorkCalendarEmploymenttable.clear();
                         _WorkCalendarEmploymenttable.initValue();
                         _WorkCalendarEmploymenttable.CalendarId = "Calendar";
                         _WorkCalendarEmploymenttable.CalendarDataAreaId = "rni";
                         _WorkCalendarEmploymenttable.Employment = _hcmemploymenttable.RecId;
                        if(_WorkCalendarEmploymenttable.validateWrite())
                         {
                             _WorkCalendarEmploymenttable.insert();
                            // isWorkCalendarEmploymenttable = true;
                        }
                            //checking hcm person private
                        if (_hcmworkertable.Person)
                        {_HcmPersonPrivateDetailstable = HcmPersonPrivateDetails::findByPerson(_hcmworkertable.Person);}

                    }
                   //if (ishcmworkertable == true && ishcmemploymenttable == true && ishcmemploymentdetailtable == true && isWorkCalendarEmploymenttable == true)
                    //{
                        //_isAllemploymenttable = true;
                    //}

            if(!_HcmPersonPrivateDetailstable)
                    {
                        if (_hcmworkertable.Person)
                        {
                            //insert hcm person private
                                                        _HcmPersonPrivateDetailstable.clear();
                                                        _HcmPersonPrivateDetailstable.initValue();
                                                        _HcmPersonPrivateDetailstable.NativeLanguage = 5637144577;
                                                        _HcmPersonPrivateDetailstable.BirthDate = _HcmPersonBirthDate;
                                                        if (_gender == HcmPersonGender::Male)
                                                        {_HcmPersonPrivateDetailstable.Gender = HcmPersonGender::Male;}
                                                        if (_gender == HcmPersonGender::Female)
                                                        {_HcmPersonPrivateDetailstable.Gender = HcmPersonGender::Female;}
                                                        _HcmPersonPrivateDetailstable.HcmWorker = 0;
                                                        _HcmPersonPrivateDetailstable.Person = _hcmworkertable.Person;
                                                        _HcmPersonPrivateDetailstable.CitizenshipCountryRegion = 'PAK';
                                                        _HcmPersonPrivateDetailstable.IsFulltimeStudent = NoYes::No;
                                                        _HcmPersonPrivateDetailstable.SLBloodGroup = SLBloodGroup::Blank;
                                                        if(_HcmPersonPrivateDetailstable.validateWrite())
                                                        {
                                                            _HcmPersonPrivateDetailstable.insert();
                                                           // isHcmPersonPrivateDetailstable = true;
                                                        }

                        }

                    }



                     _dirPersonRecid = HcmWorker::findByPersonnelNumber(_Generatedpersonalnumber).Person;
                    _roles  = [LogisticsLocationRole::findBytype(LogisticsLocationRoleType::Home).RecId];

                    //create address
                    _DirParty = DirParty::constructFromPartyRecId(_dirPersonRecid);
                    if(Address.valueStr() != '')
                    {

                        _addressView.CountryRegionId = LogisticsAddressCountryRegion::findByISOCode(SysCountryRegionCode::countryInfo(curext())).CountryRegionId;
                        _addressView.Street  = Address.valueStr();
                        _addressView.City    = 'Karachi';
                        _addressView.IsPrimary   = NoYes::Yes;
                        _addressView.IsPrivate = NoYes::Yes;
                        _addressView.Party   = _dirPersonRecid;
                        _addressView.Address = Address.valueStr();
                        _DirParty.createOrUpdatePostalAddress(_addressView,_roles);
                       // isaddressView = true;
                    }
                     if(Contact.valueStr() != '')
                    {
                    _contactView.clear();
                    _contactView.LocationName                = 'Phone';
                    _contactView.Locator                     = Contact.valueStr();
                    _contactView.Type                        = LogisticsElectronicAddressMethodType::Phone;
                    _contactView.Party                       = _dirPersonRecid;
                    _contactView.IsPrimary                   = NoYes::Yes;
                    _dirParty.createOrUpdateContactInfo(_contactView);
                    }

             _hcmpersondetails = HcmPersonDetails::findByPerson(_hcmworkertable.Person);
            if(!_hcmpersondetails)
                    {
                                                            //insert into hcmpersondetail
                                                                _hcmpersondetails.clear();
                                                                _hcmpersondetails.initValue();
                                                                _hcmpersondetails.DisabledVeteran = NoYes::No;
                                                                _hcmpersondetails.ValidFrom = EmploymentStartDate.dateTimeValue();
                                                                _hcmpersondetails.ValidTo = employmentEndDateTime;
                                                                _hcmpersondetails.Person = _hcmworkertable.Person;
                                                                _hcmpersondetails.VeteranStatus = 0;
                                                                _hcmpersondetails.IsExpatriateRulingApplicable = NoYes::No;
                                                                _hcmpersondetails.MaritalStatus = HcmPersonMaritalStatus::None;
                                                                _hcmpersondetails.NumberOfDependents = 0;
                                                                _hcmpersondetails.SLSpecialty = "";
                                                                if(_hcmpersondetails.validateWrite())
                                                                {
                                                                    _hcmpersondetails.insert();
                                                                   // ishcmpersondetails = true;
                                                                }
                    }
//
                  //if (isHcmPersonPrivateDetailstable == true && isaddressView == true && ishcmpersondetails == true)
                    //{
                        //_isdetailtables = true;
                    //}

                  //if (_isdetailtables == true)
                    //{
                        _PayrollWorkerPositionEarningCode.clear();
                        _PayrollWorkerPositionEarningCode.initValue();

                        if (PayrollEarningCode::findByEarningCode('Late/Leave Deductions').QuantityUnit == PayrollQuantityUnit::Each)
                                {
                                   _PayrollWorkerPositionEarningCode.CalculationFrequency = PayrollCalculationFrequency::findDefaultCalculationFrequency().RecId;
                                }
                         else
                                {
                                     _PayrollWorkerPositionEarningCode.CalculationFrequency = 0;
                                }
                         _PayrollWorkerPositionEarningCode.CalculationFrequency = PayrollCalculationFrequency::findDefaultCalculationFrequency().RecId;
                         _PayrollWorkerPositionEarningCode.Formula = 1.00;
                         _PayrollWorkerPositionEarningCode.EarningCode = 5637145375;
                         _PayrollWorkerPositionEarningCode.Position = _hcmpositiontable.RecId;
                         _PayrollWorkerPositionEarningCode.ValidFrom = DateTimeUtil::date(EmploymentStartDate.dateTimeValue());
                         _PayrollWorkerPositionEarningCode.ValidTo = DateTimeUtil::date(employmentEndDateTime);
                         _PayrollWorkerPositionEarningCode.Worker = _hcmworkertable.RecId;
                         _PayrollWorkerPositionEarningCode.EmploymentType = _hcmworkertable.HcmEmployementType;
                         if(_PayrollWorkerPositionEarningCode.validateWrite())
                         {
                             _PayrollWorkerPositionEarningCode.insert();
                            // isPayrollWorkerPositionEarningCode =true;
                         }

                  //  }



                    _HRMCompFixedEmpl = HRMCompFixedEmpl::findByWorker(_hcmworkertable.RecId);

             //if (isPayrollWorkerPositionEarningCode == true)
                    //{
                        if(!_HRMCompFixedEmpl)
                       {
                           hrmCompFixedEmplActionHire = new HRMCompFixedEmplActionHire();
                           _HRMCompFixedEmpl.clear();
                           _HRMCompFixedEmpl.initValue();
                           _HRMCompFixedEmpl.PlanId   = NewPlanId;
                                                                      _HRMCompFixedEmpl.Worker  = _hcmworkertable.RecId;
                                                                      _HRMCompFixedEmpl.Status    = HRMCompFixedEmplStatus::Active;

                                                                      hrmCompFixedPlanTable = HRMCompFixedPlanTable::find(NewPlanId);
                                                                      _HRMCompFixedEmpl.Type  = hrmCompFixedPlanTable.Type;
                                                                      _HRMCompFixedEmpl.CurrencyCode    = hrmCompFixedPlanTable.CurrencyCode;
                                                                      _HRMCompFixedEmpl.PayFrequencyId = hrmCompFixedPlanTable.PayFrequencyId;

                                                                      _HRMCompFixedEmpl.ActionId       = NewActionId;
                                                                      _HRMCompFixedEmpl.Position        = _hcmpositiontable.RecId;
                                                                      _HRMCompFixedEmpl.ValidFrom    = DateTimeUtil::date(EmploymentStartDate.dateTimeValue());
                                                                      _HRMCompFixedEmpl.ValidTo         = DateTimeUtil::date(employmentEndDateTime);
                                                                      _HRMCompFixedEmpl.PayRate        = Salary.value()+ Mobileallowance.value() + maintainanceallowance.value();
                                                                      _HRMCompFixedEmpl.GrossPayRate   = Salary.value()+ Mobileallowance.value() + maintainanceallowance.value();
                                                                      _HRMCompFixedEmpl.ProcessType = HRMCompProcessType::NonCyclical;
                                                                      _HRMCompFixedEmpl.DefaultDimension = result;

                                                                      //insert
                                                                      if(_HRMCompFixedEmpl.validateWrite())
                                                                      {
                                                                        _HRMCompFixedEmpl.Insert();
                                                                         // isHRMCompFixedEmpl = true;
                                                                      }

                                                                      HRMCompFixedEmplActionHire.parmHrmCompFixedEmpl(_HRMCompFixedEmpl);
                                                                      HRMCompFixedEmplActionHire.parmActionType(HRMCompFixedActionType::HireRehire);

                                                                      HRMCompFixedEmplActionHire.run();
                                                                    if(_HRMCompFixedEmpl)
                                                                    { Box::info('Employee has been created'); element.refreshempcode();}
                        }




                }// hcm title condition end

            }

        }



        }

    }

Inventory value report -financial quantity of an item is negative

$
0
0

Dear All,

I would like to ask about the AX Inventory value report.

First of all, I'm running my inventory valuation report and for one of the item financial quantity was negative. Attaching the screenshot for reference

But, In the system We are not allowing physical negative inventory. 

Thank you
Laxmi narayana

While reversing the received RMA I am getting an inventory period closed error.

$
0
0

Hello All,

We are using Microsoft Dynamics AX 2012 R3.

We have a return order wth received status, the packing slip is already generated. and so the inventory transaction is created on date 2/24/2022, see below:

For some reason, the user wants to reverse the packing slip. i tried to do so by clicking on the cancel packing slip button:

but I am getting this error "The Packing slip correction cannot be posted to the original accounting date when the inventory period is closed. The accounting date has been moved to the first day in the next open inventory period"

Is there any way to reverse the posted packing slip without opening the closed period?

Your advice will be very helpful.

Viewing all 175888 articles
Browse latest View live


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>