mibuso.com

Microsoft Business Solutions online community
It is currently Sat May 25, 2013 6:36 pm

All times are UTC + 1 hour [ DST ]




Post new topic Reply to topic  [ 12 posts ] 
Author Message
 Post subject: Update Status on the Header part of a Sales Order form
PostPosted: Wed Jul 18, 2012 2:32 pm 
Offline

Joined: Thu Dec 16, 2010 8:11 am
Posts: 97
Country: Bangladesh (bd)
Hello all,

I have a card-form which is based on Header and Line.

On Sales Line form, I have kept a field Status which has the option values: Partly and Closed.
Also, I have this field on the Header part too.

For a particular Order No., I have several lines with Status Partly and Closed.
On the Sales Order form, if I validate the all Status on the Line to be Closed, then the Status of the Header part should be Closed.

For e.g: Sales Line part
1) Document No.: S0001
Line 1:
Item A - Status: Partly
Line 2:
Item B- Status: Closed
Status on Header: Partly

2) Document No.: S0002
Line 1:
Item A - Status: Closed
Line 2:
Item B- Status: Closed
Status on Header: Closed

Can somebody please give some help. I am stuck on it.

Thanks
Liizz


Top
 Profile E-mail  
 
 Post subject: Re: Update Status on the Header part of a Sales Order form
PostPosted: Wed Jul 18, 2012 2:40 pm 
Offline
MVP Microsoft Dynamics NAV

Joined: Tue Sep 02, 2008 8:37 am
Posts: 4226
Location: New Delhi
Country: India (in)
Check Completely Shipped field in Sales Header table as reference..

_________________
-Mohana
http://mibuso.com/blogs/mohana
http://mohana-dynamicsnav.blogspot.in/


Top
 Profile  
 
 Post subject: Re: Update Status on the Header part of a Sales Order form
PostPosted: Wed Jul 18, 2012 2:49 pm 
Offline

Joined: Thu Dec 16, 2010 8:11 am
Posts: 97
Country: Bangladesh (bd)
mohana_cse06 wrote:
Check Completely Shipped field in Sales Header table as reference..


There is no code on this field on table 36.

Thanks
Liizz


Top
 Profile E-mail  
 
 Post subject: Re: Update Status on the Header part of a Sales Order form
PostPosted: Wed Jul 18, 2012 2:51 pm 
Offline
MVP Microsoft Dynamics NAV

Joined: Tue Sep 02, 2008 8:37 am
Posts: 4226
Location: New Delhi
Country: India (in)
Its a FlowField

_________________
-Mohana
http://mibuso.com/blogs/mohana
http://mohana-dynamicsnav.blogspot.in/


Top
 Profile  
 
 Post subject: Re: Update Status on the Header part of a Sales Order form
PostPosted: Wed Jul 18, 2012 8:09 pm 
Offline

Joined: Thu Dec 16, 2010 8:11 am
Posts: 97
Country: Bangladesh (bd)
Hi.

Thanks Mohana.

But the field Status is not getting updated on the Header part. I am trying the example you told me.


This is the piece of code which is updating the Status for each Lines for that particular Document No.
RecLine.SETRANGE("Document No.","Document No.");
RecLine.SETFILTER("Qty Del",'>%1',0);
IF RecLine.FINDSET THEN
REPEAT
IF (RecLine."Qty Del"<>RecLine.Quantity) THEN BEGIN
RecLine.Status:=RecLine.Status::"Partly";
RecLine.MODIFY;
EXIT;
END ELSE IF (RecLine."Qty Del"=RecLine.Quantity) THEN BEGIN
RecLine.Status:=RecLine.Status::Closed;
RecLine.MODIFY;
END;
UNTIL RecLine.NEXT=0;

RecLine: record variable.

If all the Status from the Lines are closed, then Status on Header =Closed
else Status on Header=Partly

Please help me.. ](*,)

Thanks
Liizz


Top
 Profile E-mail  
 
 Post subject: Re: Update Status on the Header part of a Sales Order form
PostPosted: Wed Jul 18, 2012 8:29 pm 
Offline
MVP Microsoft Dynamics NAV
Site Supporter

Joined: Fri Jun 06, 2003 9:01 pm
Posts: 6979
Location: L.I., New York
Country: United States (us)
Doesn't the "Completely Shipped" field give you the same information?
why are you reinventing the wheel?

Do you see:
Sales Header: Completely Shipped (5752) Type Boolean
Flowfield
Min("Sales Line"."Completely Shipped" WHERE (Document Type=FIELD(Document Type),Document No.=FIELD(No.),Shipment Date=FIELD(Date Filter),Location Code=FIELD(Location Filter)))

Sales Line: Completely Shipped (5752) Type Boolean

It's value is calc'ed on Quantity - OnValidate()

if "Qty Del" is your custom field.
If you want to copy that functionality to a new fields called "Completely Delivered" then follow how "Completely Shipped" Works and you'll probably have to calc the value on your "Qty Del" - OnValidate.

You'll see you don;t need all that code. and what trigger is all that code on anyway?

_________________
Harry Ruiz
http://www.cosmeticsolutions.com
http://www.autismspeaks.org


Top
 Profile E-mail WWW  
 
 Post subject: Re: Update Status on the Header part of a Sales Order form
PostPosted: Thu Jul 19, 2012 6:04 am 
Offline

Joined: Thu Dec 16, 2010 8:11 am
Posts: 97
Country: Bangladesh (bd)
Hi.

I have placed these codes on a Submit button, each lines is getting updated.
liizz wrote:

RecLine.SETRANGE("Document No.","Document No.");
RecLine.SETFILTER("Qty Del",'>%1',0);
IF RecLine.FINDSET THEN
REPEAT
IF (RecLine."Qty Del"<>RecLine.Quantity) THEN BEGIN
RecLine.Status:=RecLine.Status::"Partly";
RecLine.MODIFY;
EXIT;
END ELSE IF (RecLine."Qty Del"=RecLine.Quantity) THEN BEGIN
RecLine.Status:=RecLine.Status::Closed;
RecLine.MODIFY;
END;
UNTIL RecLine.NEXT=0;

RecLine: record variable.


But, on the Sales Line there is no codes on the Quantity-OnValidate() where CALCFIELDS is being used.

Yes, I have also defined a Boolean field as u mentioned.
Min("Custom Lines"."Completely Delivered" WHERE (Document No.=FIELD(No.),Status=FIELD(Status)))

But still, its not working. The Status is not being changed accordingly


Last edited by liizz on Thu Jul 19, 2012 6:10 am, edited 1 time in total.

Top
 Profile E-mail  
 
 Post subject: Re: Update Status on the Header part of a Sales Order form
PostPosted: Thu Jul 19, 2012 6:08 am 
Offline
MVP Microsoft Dynamics NAV

Joined: Tue Sep 02, 2008 8:37 am
Posts: 4226
Location: New Delhi
Country: India (in)
Remove Status from flowfield calculation..add only fields which are linking header and line..

_________________
-Mohana
http://mibuso.com/blogs/mohana
http://mohana-dynamicsnav.blogspot.in/


Top
 Profile  
 
 Post subject: Re: Update Status on the Header part of a Sales Order form
PostPosted: Thu Jul 19, 2012 6:28 am 
Offline

Joined: Thu Dec 16, 2010 8:11 am
Posts: 97
Country: Bangladesh (bd)
Ok.

But where should I use the CALCFIELDS functionality?

Thanks
Liizz


Top
 Profile E-mail  
 
 Post subject: Re: Update Status on the Header part of a Sales Order form
PostPosted: Thu Jul 19, 2012 6:29 am 
Offline
MVP Microsoft Dynamics NAV

Joined: Tue Sep 02, 2008 8:37 am
Posts: 4226
Location: New Delhi
Country: India (in)
If you need it in form the simply add the field in form..
if in report then need to use CALCFIELDS..

_________________
-Mohana
http://mibuso.com/blogs/mohana
http://mohana-dynamicsnav.blogspot.in/


Top
 Profile  
 
 Post subject: Re: Update Status on the Header part of a Sales Order form
PostPosted: Thu Jul 19, 2012 6:33 am 
Offline

Joined: Thu Dec 16, 2010 8:11 am
Posts: 97
Country: Bangladesh (bd)
I need it on a form.

Please can u be a bit more clear in what u mean.

mohana_cse06 wrote:
If you need it in form the simply add the field in form..


Thanks
Liizz


Top
 Profile E-mail  
 
 Post subject: Re: Update Status on the Header part of a Sales Order form
PostPosted: Thu Jul 19, 2012 6:52 am 
Offline
MVP Microsoft Dynamics NAV

Joined: Tue Sep 02, 2008 8:37 am
Posts: 4226
Location: New Delhi
Country: India (in)
Show the Status field on form..

_________________
-Mohana
http://mibuso.com/blogs/mohana
http://mohana-dynamicsnav.blogspot.in/


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 12 posts ] 

All times are UTC + 1 hour [ DST ]


Who is online

Users browsing this forum: No registered users and 14 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum


Search for:
Jump to: