Search This Blog

Monday 13 March 2017

Payment Schedule In Dynamics 365 For Operations


Payment Schedule:

Payment Schedule is basically used to give the payment to vendor in particular installments.

For example I want to give the payment in sixth month of installments with fixed amount.

Go to: Accounts Payable -> Payment Setup -> Payment Schedule.















Here Fixed Quantity in allocation means fixed amount of installments.(you can explore the other options as well in that drop down).

Payment per means either you want to give the installments on daily basis or monthly or yearly.

Number of payments means you have to define number of installments. (this option will be enable if you select the fixed quantity option in the allocation drop down).

maximum amount and minimum amount means the maximum or minimum amount required to qualify to apply this payment schedule.

Sales tax and charge allocation means: giving the option to pay sales tax and charges either in first transaction or last transaction or proportionally in installments.

Now I will show you how we can use this payment journal in our payment schedule.

Goto: Accounts Payable -> Payments -> Payment Journal










Now select the payment journal and click lines in the action pain as you can see in the below image.









A new form will open where u can see the lines:








now select the transaction and than click on the settlement button as you can see in the above image.A new screen will open where u can see the un settled transactions like this.














No mark the transaction on which u want to apply the payment schedule and click on apply payment schedule as you can see in above image.

Now once you click the apply payment schedule a new window will open where you can apply the payment schedule.There two options you can manually create and apply the payment schedule based on amount and percentage or you can select the already created payment schedules.













Now once u click the payment schedule button it will ask you about the payment schedule that you want to apply like this.













Now when i select the payment schedule and click it divides the amount in six month equal installments.You can also divide the amount in percentage basis as well.













As you can see in the above image my amount is divided in six equal installments based on amount.
If you select percentage from the drop down than amount will be divide based on percentage not based on amount.

Now when i click OK button it will divide the transaction in six equal transactions with due date and under the same invoice as you can see in the below image.













As you can see in the above image payment amount is divided in six equal installments with the due date and same invoice number.

This was all related to creating and applying the Payment Schedule in Microsoft Dynamics 365 for Operations.

Thanks,
Muhammad Zahid

Thursday 16 February 2017

Field Fixed Relation and Related Field Fixed Relation In Microsoft Dynamics AX

Field Fixed Relation and Related Field Fixed Relations are not commonly used in AX but its Good to understand there concept as in some scenarios they are very useful.

Below are the two links that explains both Field Fixed Relation and Related Field Fixed Relation in Microsoft Dynamics AX.

https://amazingax.wordpress.com/2013/04/15/microsoft-dynamics-ax-2012-understanding-related-field-and-fixed-field-relation-on-ax-tables/

https://msdn.microsoft.com/en-us/library/bb190115.aspx?ranMID=24542&ranEAID=TnL5HPStwNw&ranSiteID=TnL5HPStwNw-CzrYWf0.SeiooLURSsjHrQ&tduid=(7765185542a4606ade00d00d5716e203)(256380)(2459594)(TnL5HPStwNw-CzrYWf0.SeiooLURSsjHrQ)()


Let me know if you have any questions related to this.

Thanks,
Muhammad Zahid.


Tuesday 14 February 2017

Ending Blocked User Session in Microsoft Dynamics AX 2009

Some times there are session in AX that are in ending blocked mode and causing the AX perfomance impact.

What you can do just right the below query to check if there is blocked session in AX or not.

'select * from SysClientSessions where SysClientSessions.STATUS = 3'

if you got any record than it means that there is blocked session in AX.

Before deleting it first verify the 'same session id' in AX -> administration -> online users.

filter the record with that session id and u will see the record with status 'ending blocked'

Now go to sql and delete the record that you find in above query or call the Sql Stored Procedure [KillDBSession] with correct session id.

Once you kill the session the user will be successfully able to login again in AX.

For more details on this please refer to the following blog:

https://axatoz.wordpress.com/2014/04/10/how-to-kill-a-blocking-session/

Thanks,

Muhammad Zahid.

Tuesday 22 November 2016

X++ checking DateNULL in Microsoft Dynamics AX

Some times we need to check the date column either its NULL or not.

Below is the link that shows how to check either date column null or not.

https://dynamicsaxposed.wordpress.com/tag/null-date-in-x/

Thanks
Muhammad Zahid. 

Wednesday 9 November 2016

Error: Getting Enum Value in Container and assigning it to the Enum variable.

I just stop in one of the scenarios in which I was trying get the enum value from container and assigning it to the enum variable by converting its type from string to enum.

The code compiles well but at the run time it throws exception.


Below is the code that was causing an issue.

static void Job26(Args _args)
{
    container _bRMAccountTypes;
    BRMAccountType bRMAccountType;
    ;

    _bRMAccountTypes = [BRMAccountType::Business];

    bRMAccountType = str2Enum(bRMAccountType, conpeek(_bRMAccountTypes, 1));

    info(strfmt('%1', bRMAccountType));
}

After running it got the following exception.













To resolve this issue the simple solution is.

Do not type cast the enum value that you are getting from container and assign it directly to the enum variable.

like this.

static void Job26(Args _args)
{
    container _bRMAccountTypes;
    BRMAccountType bRMAccountType;
    ;

    _bRMAccountTypes = [BRMAccountType::Business];

    bRMAccountType = conpeek(_bRMAccountTypes, 1);

    info(strfmt('%1', bRMAccountType));
}

It will work fine and show the correct results:


















Thanks
Muhammad Zahid.

Tuesday 18 October 2016

Working with Dates in X++

Below is the link contains detail information about X++ dates conversion.

https://dynamicsaxed.wordpress.com/2015/06/04/working-with-dates-in-x/

and below is the link that contains detail information on how to use dynamics date ranges in SSRS reports dialog.

 https://blogs.msdn.microsoft.com/dpaxfeatures/2016/08/26/using-dynamic-query-values-sysqueryrangeutil-in-dynamics-ax/

inorder to see how to set start datetime of the day and end date time of the day than below is the link

https://www.tech.alirazazaidi.com/some-usefull-date-functions-in-dynamics-ax-x/

Thanks
Muhammad Zahid.


Tuesday 6 September 2016

Exists and notExists Join in Microsoft Dynamics AX 2009 and Microsoft SQL Server

Some times while creating the query to have set the criteria that select this record from table A if  the reference of table A is available in table b or not.

This criteria can be easily achieved by using the exists and not exists join.

Below is the query that is showing the Exit join in X++;

smmBusRelTable smmBusRelTable;
smmBusRelFarmActivity smmBusRelFarmActivity;

Select count(recid) from smmBusRelTable
        exists join smmBusRelFarmActivity
    where smmBusRelTable.BRMCreditlineStatus == BRMCreditlineStatus::Preapproved
    &&
    smmBusRelFarmActivity.BusRelAccount == smmBusRelTable.BusRelAccount
        && (smmBusRelFarmActivity.CodeSecondary == "Dairy sharemilker"
        ||  smmBusRelFarmActivity.CodeSecondary == "Contract milker"
        ||  smmBusRelFarmActivity.CodeSecondary == "Personal use"
        ||  smmBusRelFarmActivity.CodeSecondary == "Retired"
        ||  smmBusRelFarmActivity.CodeSecondary == "Lifestyle"
        || (smmBusRelFarmActivity.CodePrimary == "Contractor" && smmBusRelFarmActivity.IsPrimary == NoYes::Yes));

    info(strfmt('%1', smmBusRelTable.RecId));


The above query is fetching the records from table smmBusRelTable but based on the criteria that their reference should be available in smmBusRelFarmActivity table and the range that we have applied on that table.

Same thing we can achieve for the "not exist" join like if i want to fetch the records from table A based on the criteria that its reference record should not be exist in the table B.

Below is the query for the not exists join.

smmBusRelTable smmBusRelTable;
smmBusRelFarmActivity smmBusRelFarmActivity;

Select count(recid) from smmBusRelTable
    where smmBusRelTable.BRMCreditlineStatus == BRMCreditlineStatus::Preapproved
       NotExists join smmBusRelFarmActivity
    where smmBusRelTable.BusRelAccount == smmBusRelFarmActivity.BusRelAccount
        && (smmBusRelFarmActivity.CodeSecondary == "Dairy sharemilker"
        ||  smmBusRelFarmActivity.CodeSecondary == "Contract milker"
        ||  smmBusRelFarmActivity.CodeSecondary == "Personal use"
        ||  smmBusRelFarmActivity.CodeSecondary == "Retired"
        ||  smmBusRelFarmActivity.CodeSecondary == "Lifestyle"
        || (smmBusRelFarmActivity.CodePrimary == "Contractor" && smmBusRelFarmActivity.IsPrimary == NoYes::Yes));

 info(strfmt('%1', smmBusRelTable.RecId));

note: for non exist join in the above AX query I am first applying the range on parent table i.e smmBusRelTable than doing the non exist join on the child table i.e smmBusRelFarmActivity. if we apply the range on the parent table after the join than it will not fetch the correct number of records.
Previously i was applying the range on the parent table after the join and it was not showing the same result as from sql server query and when i apply the range first on parent table and than join than it shows the same results as compare to the sql server query.

If we want to run the same query in Sql Server we can also do this.

Below is the example for using the exists and not exits joins in Microsoft Sql Server.

Not Exit Join:

select count(SMMBUSRELTABLE.RECID) from SMMBUSRELTABLE
where  Not Exists (select * from SMMBUSRELFARMACTIVITY
where SMMBUSRELFARMACTIVITY.BUSRELACCOUNT = SMMBUSRELTABLE.BUSRELACCOUNT
        and (SMMBUSRELFARMACTIVITY.CodeSecondary = 'Dairy sharemilker'
        or  SMMBUSRELFARMACTIVITY.CodeSecondary = 'Contract milker'
        or  SMMBUSRELFARMACTIVITY.CodeSecondary = 'Personal use'
        or  SMMBUSRELFARMACTIVITY.CodeSecondary = 'Retired'
        or  SMMBUSRELFARMACTIVITY.CodeSecondary = 'Lifestyle'
        or (SMMBUSRELFARMACTIVITY.CodePrimary = 'Contractor' and SMMBUSRELFARMACTIVITY.IsPrimary = '1'))
)
and
SMMBUSRELTABLE.BRMCreditlineStatus = 1


Exist Join:

select count(SMMBUSRELTABLE.RECID) from SMMBUSRELTABLE
where   Exists (select * from SMMBUSRELFARMACTIVITY
where SMMBUSRELFARMACTIVITY.BUSRELACCOUNT = SMMBUSRELTABLE.BUSRELACCOUNT
        and (SMMBUSRELFARMACTIVITY.CodeSecondary = 'Dairy sharemilker'
        or  SMMBUSRELFARMACTIVITY.CodeSecondary = 'Contract milker'
        or  SMMBUSRELFARMACTIVITY.CodeSecondary = 'Personal use'
        or  SMMBUSRELFARMACTIVITY.CodeSecondary = 'Retired'
        or  SMMBUSRELFARMACTIVITY.CodeSecondary = 'Lifestyle'
        or (SMMBUSRELFARMACTIVITY.CodePrimary = 'Contractor' and SMMBUSRELFARMACTIVITY.IsPrimary = '1'))
)
and
SMMBUSRELTABLE.CRTBRMCreditlineStatus = 1


This was all related to the exists and notexists joins in Microsoft Dynamics AX 2009 and Microsoft SQL Server.

Feel fry to comment or email me if you have any questions on this.

Thanks

Muhammad Zahid.