Hi Experts,
I am working on the Cust. Ledger Entry table trying to design the customer Balance to date report.
My problem is i want to count the No. of months from the Posting dates so that i can get the no. of months that are paid in the report.
The posting dates Correspond to the payments made.
I need Assistance in this Please. I want to count the no. of months paid for.
Any idea please?
Thanks.
0
Comments
MVP - Dynamics NAV
My BLOG
NAVERTICA a.s.
AP Commerce, Inc. = where I work
Getting Started with Dynamics NAV 2013 Application Development = my book
Implementing Microsoft Dynamics NAV - 3rd Edition = my 2nd book
Sorry for the late reply.
The No. of Months here is based on calendar month. Basically, is like Customers paying for mortgages by installment every Month. Any month they pay should be subtracted from the Principal and each of this months payment is indicated in the Cust. Ledger Entry under the document type as Payment.
I am trying to use this document type called payment to Count the No. of Months that are being paid, because when there is no payment made the document type column in the report will be empty indicating no payment, so should not be count. Only the payments should be counted for each month.
I also need the total months in the period i.e From 01/01/07 to date. This one is counting correctly, but it is the No. of months paid that is not counting Correctly.
Here is the Sample Code i have wrote:
//Setting Date range(Date to be consirdered)
FromDate := 010107D;
ToDate :=TODAY;
//Code to Count Months in the Period(010107D to TODAY)
//This one is working correctly
IF (FromDate <> 0D) AND (ToDate > FromDate) THEN BEGIN
Calendar.RESET;
Calendar.SETRANGE("Period Type",Calendar."Period Type"::Month);
Calendar.SETRANGE("Period Start",FromDate,ToDate);
Months := Calendar.COUNT;
END ELSE
Months := 0;
//Date Range for the payments
FromDate1 := 101017D;
ToDate1 := "Date Filter";
//Code to Count the No. of Months Paid(Payment mONTHS)
//This one is the one not working correctly(This is the Problem)
IF (FromDate1 <> 0D) AND (ToDate1 > FromDate1) THEN BEGIN
Calendar.RESET;
Calendar.SETRANGE("Period Type",Calendar."Period Type"::Month);
Calendar.SETRANGE("Period Start",FromDate1,ToDate1);
MonthsPaid1 := Calendar.COUNT;
END ELSE
MonthsPaid1 := 0;
//Code Ends above.
// Code to Calculate payments in Installment
// This one is working correctly
IF "Cust. Ledger Entry".FIND('-') THEN BEGIN
Cust.GET("Customer No.");
MonthsPaid1 := Calendar.COUNT;
Arrears := Cust."Monthly Install" + OriginalAmt;
END ELSE BEGIN
Arrears := Arrears + Cust."Monthly Install";
END;
TotalArr += Arrears;
TotMonthsArr := Months - MonthsPaid1;
Arrears2 := TotMonthsArr * Cust."Monthly Install";
TotArr := TotalArr + Arrears2;
Can you please check my code and see where the Code that is not working has a problem. I will also like to see the correct code that can solve my problem.
Thanks.
You will need to deal with partial months. Try using just a date as the ToDate1 value.
The Date Filter is a filter field. It is used to filter the Dates.
I would like to have the Code to loop through the Cloumn called Document type and loook for payment under this column and then count it as month. So if it see payment, it should be counted as one and continue the loop untill it finds and payment and count it as two,and so on. This will give me the No. of months paid. This is the only thing that is not working.
Can anyone help and show me a code that can do this. I will be greatfull if i found one here. Then my problem will be solved.
Thanks.
http://www.BiloBeauty.com
http://www.autismspeaks.org
sounds like you just want a COUNT of the number of payment type entries.
Savatage, this is exactly what i am trying to do. But i just don't know how to do it. I tried all i could but to no avail.
Can you please help me with the code that can solve my problem. I will be greatful if anyone can help me solve this.
There is suppose to be a loop that can go and search for payment type entry and count as one and skip the ones that are not payment or has blanks. It should count the payment type entries.
Any idea please?
Thanks.
Try this Untested code but should give you the help!
David
Mobile: +44(0)7854 842801
Email: david.cox@adeptris.com
Twitter: https://twitter.com/Adeptris
Website: http://www.adeptris.com
if you're not using report # 50064 then here is the fob you can import
http://savatage99.googlepages.com/Report50064.fob
I made a post here that shows you how to add Summary or Detail in case you don't want each payment info to show.
http://www.mibuso.com/forum/viewtopic.php?p=89276
It will look something like this.
http://savatage99.googlepages.com/CLEreportsample.JPG
else here is the code you can playwith
It basically tablefilterview "Payments" only & count's them - I'm not sure what other info you needed to have. but perhaps this can help
http://www.BiloBeauty.com
http://www.autismspeaks.org
Thanks you very much. The No. of months paid is working correctly. =D>
I have one more problem. I want to elliminate the first entry under the arreas column in the report.
The first entry is the principal amount, therefore it should indicate Zero under the arrears column instead of 560. Here the monthly installment of 60 was added to the 500 under the arrears column to give 560. This addition should start with the second entry and so on. The first entry should have zero as arrears.
Your helps are welcome again.
Thanks.
No PM,please use the forum. || May the <SOLVED>-attribute be in your title!