Sorry not stopped to read your code but can't you use the status
'Registered' (PO line / Functions / Register) and then just do Delivery note
posting based on Registered?
 
 


  _____  

From: development-axapta@yahoogroups.com
[mailto:[EMAIL PROTECTED] On Behalf Of Shabbir Ahsan
Sent: 25 November 2008 23:58
To: development-axapta@yahoogroups.com
Subject: [development-axapta] Receiving items from purchase order in x++



Hi,

I want to be able to receive items on a PO, but process one by one, 
rather than one go as is the option within AX. I want to be able to 
update the status of the line to received and then when all items are 
received run a function to post the entire PO. 

The current code I am using to process each line is: 

PurchTable purchTable; 
PurchLine purchLine; 
TransDate transDate; 
; 

transDate = SystemDateGet(); 

try 
{ 
ttsbegin; 

purchTable = PurchTable::find(myPOId); 

select forupdate purchLine where purchLine.PurchId == myPOId && 
purchLine.ItemId == myItem && purchLine.LineNum == mynum; 

purchLine.PurchReceivedNow = RecQty; 
purchLine.RemainPurchPhysical = (purchLine.RemainPurchPhysical - 
RecQty); 
purchLine.setInventReceivedNow(); 
if (purchLine.RemainPurchPhysical == 0) 
{ 
purchLine.setPurchStatus(); 
} 

purchLine.update(true); 

ttscommit; 
} 
catch (Exception::Error) 
{ 
return "got an error"; 
} 
return "processed"; 

} 

With the above code, it sets the status as cancelled. Do I have to 
calculate and set the REmainPurchFinancial value as well in order for 
it to give the correct status. Is there not a function that can 
receive an item and calculate this automatically? 

After all the status of items is set to received (ie all items have 
matching quantity to that ordered) I will post the PO using the 
following code - I don't think there will be a problem here: 

purchformletter = 
purchformletter::construct(DocumentStatus::PackingSlip,true); 
purchtable.clear(); 
purchtable = purchtable::find(myPOId); 

purchformletter.update(purchtable,myDelNo,systemDateGet(),purchUpdate:
:All,AccountOrder::None, 
NoYes::No, 
NoYes::Yes); 

Some help on this would be much appreciated.



 


[Non-text portions of this message have been removed]

Reply via email to