Sales Order - Blanket Sales Order problem
sarabi98
Member Posts: 13
I have implemented the following:
Added a new fields on the sales order header call Max Amount and Max Amount Threshold.
The problem I am having is the user should get a warning if the blanker order lines exceed the Max amount. and Alse the user gets a warning when billing more that the Max Amount * Max Amount Threshold.
How can I do this with code?
I have created a function and has the below code:
Is this on the right track? Am i missing something?
Totalfields is a variable in the function.
Added a new fields on the sales order header call Max Amount and Max Amount Threshold.
The problem I am having is the user should get a warning if the blanker order lines exceed the Max amount. and Alse the user gets a warning when billing more that the Max Amount * Max Amount Threshold.
How can I do this with code?
I have created a function and has the below code:
Is this on the right track? Am i missing something?
Totalfields is a variable in the function.
SalesLine.SETRANGE("Document Type","Document Type");
SalesLine.SETRANGE("Document No.","No.");
//SalesLine.TotalFields(SalesLine.Amount);
TotalFields := TotalFields + SalesLine.Amount;
IF("Max Amount" * "Max Amount Threshold") > SalesLine.Amount THEN
MESSAGE(Text052, "Max Amount",SalesLine.Amount);
0
Comments
-
Code should be like this:
SalesLine.SETRANGE("Document Type","Document Type");
SalesLine.SETRANGE("Document No.","No.");
//SalesLine.TotalFields(SalesLine.Amount);
if SalesLine.FIND('-') THEN repeat
TotalFields := TotalFields + SalesLine.Amount;
until SalesLine.next = 0;
IF TotalFields > ("Max Amount") THEN
MESSAGE('Amount cannot be more than %1', "MaxAmount");
//IF("Max Amount" * "Max Amount Threshold") > SalesLine.Amount THEN
// MESSAGE(Text052, "Max Amount",SalesLine.Amount0 -
sarabi98 wrote:I have implemented the following:
Added a new fields on the sales order header call Max Amount and Max Amount Threshold.
The problem I am having is the user should get a warning if the blanker order lines exceed the Max amount. and Alse the user gets a warning when billing more that the Max Amount * Max Amount Threshold.
How can I do this with code?
I have created a function and has the below code:
Is this on the right track? Am i missing something?
Totalfields is a variable in the function.SalesLine.SETRANGE("Document Type","Document Type"); SalesLine.SETRANGE("Document No.","No."); //SalesLine.TotalFields(SalesLine.Amount); TotalFields := TotalFields + SalesLine.Amount; IF("Max Amount" * "Max Amount Threshold") > SalesLine.Amount THEN MESSAGE(Text052, "Max Amount",SalesLine.Amount);
IF("Max Amount") > SalesLine.Amount THEN
MESSAGE(Text052, "Max Amount",SalesLine.Amount);
IF("Max Amount" * "Max Amount Threshold") > TotalFields THEN
MESSAGE(Text052, "Max Amount" *"Max Amount Threshold",TotalFields);Analyst Developer with over 17 years Navision, Contract Status - Busy
Mobile: +44(0)7854 842801
Email: david.cox@adeptris.com
Twitter: https://twitter.com/Adeptris
Website: http://www.adeptris.com0 -
Code should be like this:
SalesLine.SETRANGE("Document Type","Document Type");
SalesLine.SETRANGE("Document No.","No.");
if SalesLine.FIND('-') THEN repeat
IF SalesLine.Amount > ("Max Amount") THEN
MESSAGE('Amount cannot be more than %1 in Line No.
%2', "MaxAmount",SalesLine."Line No.");
TotalFields := TotalFields + SalesLine.Amount;
until SalesLine.next = 0;
IF TotalFields > ("Max Amount" * "Max Amount Threshold") THEN
MESSAGE('Total billing Amount cannot be more than %1',
"Max Amount" * "Max Amount Threshold");0 -
Thank you for the help. I was able to make it work, and changed the code around. However, I still need to be able to check if in the Subform for Sales Line table, the Line Amount Field does not become greater than my max amount. I am calling the function in the Sales Line table under the line Amount field as follows (onvalidate() for line amount)
SalesHeader.CheckThresholdValue(TotalLineAmount2,MaxThresholdValue2);
For CheckThresholdValue function, the Parameters are set to pass by reference.//This is the function code SalesLine.SETRANGE("Document Type","Document Type"); SalesLine.SETRANGE("Document No.","No."); IF SalesLine.FIND('-') THEN REPEAT TotalAmount := TotalAmount + SalesLine."Line Amount"; UNTIL SalesLine.NEXT = 0; Threshold := ("Max Amount" * ("Max Amount Threshold"/100)); IF("Max Amount") < TotalAmount THEN MESSAGE(Text053, TotalAmount,"Max Amount") ELSE IF(Threshold) < TotalAmount THEN MESSAGE(Text052, TotalAmount,Threshold);
Am I calling the function in the correct place for line amount in the sales line table? Where should i call the function from?0
Categories
- All Categories
- 75 General
- 75 Announcements
- 66.7K Microsoft Dynamics NAV
- 18.8K NAV Three Tier
- 38.4K NAV/Navision Classic Client
- 3.6K Navision Attain
- 2.4K Navision Financials
- 116 Navision DOS
- 851 Navision e-Commerce
- 1K NAV Tips & Tricks
- 772 NAV Dutch speaking only
- 610 NAV Courses, Exams & Certification
- 1.9K Microsoft Dynamics-Other
- 1.5K Dynamics AX
- 251 Dynamics CRM
- 103 Dynamics GP
- 6 Dynamics SL
- 1.5K Other
- 991 SQL General
- 383 SQL Performance
- 34 SQL Tips & Tricks
- 28 Design Patterns (General & Best Practices)
- Architectural Patterns
- 9 Design Patterns
- 4 Implementation Patterns
- 53 3rd Party Products, Services & Events
- 1.6K General
- 1K General Chat
- 1.6K Website
- 77 Testing
- 1.2K Download section
- 23 How Tos section
- 249 Feedback
- 12 NAV TechDays 2013 Sessions
- 13 NAV TechDays 2012 Sessions