views:

559

answers:

2

Edit: The objective is to make quote documents that were attached to Purchase Requisitions available to staff that processes the Purchase Orders directly an in an easy way without having to navigate back to the requisition document itself.

I would like to use the DocuRef::openDocHandling method from within the Purchase Order screen without duplicating the document that was linked to the Purchase Requisition. I would like to do this from a button that I will add to the Purchase Order Screen; I do know what the Requisition Number is that is linked to the Purchase Order.

Many thanks in advance.

+1  A: 

If you want a button to open the document view if not open and activate if open, then your clicked method should look like this:

void clicked()
{
    if (!infolog.docu().isDocuViewSet())
        infolog.docu().note(element);
    else
        infolog.docu().setActive();
}

Your question is unclear on your objective. What do you want? Please expand.

Jan B. Kjeldsen
Thanks Jan - I added a comment above.
mm2010
+1  A: 

In form PurchTable add a datasource VendPurchOrderJour with the (active) purchase requistion. You do not have to display any of the fields of the datasource, so you might use the OnlyFetchActive property. Then create the form method "docCursor", to tell the DocuView form which record is the active one.

public Common docCursor()
{
    return reqDoc ? vendPurchOrderJour : purchTable;
}

Create the button with a "clicked" method:

void clicked()
{
    reqDoc = true;
    if (!infolog.docu().isDocuViewSet())
        infolog.docu().note(element);
    else
        infolog.docu().setActive();
}

Clear the "reqDoc" in the "active" method of PurchTable.

This solution does not allow for documents on purchase lines, you may have to expand the solution like this (line is a form group):

public Common docCursor()
{
    return reqDoc ? vendPurchOrderJour : 
                    line.contains(element.selectedControl()) ? purchLine :
                    purchTable;
}
Jan B. Kjeldsen
Hi Jan,I am getting the following prob:1. reqDoc is not declared.2. Type conflict if I declare it as type common or boolean in class declaration since it conflicts with the clicked method where it is set as true.Im not that expierienced yet - thanks for your help.
mm2010
Hi Jan,Got it to work thanks to your help: I added the following modifications:1. Declared reqDoc as boolean in class declaration.2. added declaration: Common docCursor; to docCursor method.3. Changed datasource from VendPurchOrderJour to PurchReqTable and references above thereto.Now its working perfectly - thanks a stack
mm2010