Thanks Aji,

Thanks for the extensive reply. This completes my
analysis and enables me to perform the update and add
a my new document.

regards,
Danny

--- Aji Sarosa <[EMAIL PROTECTED]> wrote:

>
> Hi Danny,

> Container fed by checkIfUpdate is actually built in
> method checkIfUpdate() in CLASS salesTableType,
> where it calls method can...BeUpdated() (and
> subsequently, method may...beUpdated()) to get
> enable status. Method checkIfUpdate() in salesTable
> simply calls method checkIfUpdate() in class
> SalesTableType. Try to set a breakpoint on this
> method, you'll get the idea.

> Now I try to explain how you can enable the button
> for your new (additional) document. From this
> explanation you may grasp the mechanism applied in
> standard Axapta.
> if you want to attach a new (additional) document
> update, there are things you have to prepare. Let's
> say you want to add another document called "pasca
> invoice" (whatever it is) to be posted, you'd
> probably follow these steps:

> 1. Add a new element PascaInvoice in base enum
> DocumentStatus

> 2. Duplicate menu item action
> SalesFormLetter_Invoice then change the properties:
>    Name : SalesFormLetter_PascaInvoice
>    Label: Pasca invoice
>    EnumParameter: pascaInvoice
>      
> 3. In the design form SalesTable, add menuItemButton
> under MenuButton ButtonHeaderUpdate:
>    Name : buttonUpdatePascaInvoice
>    AutoDeclaration: Yes
>    MenuItemType: Action
>    MenuItemName: SalesFormLetter_PascaInvoice
>    DataSource: SalesTable
>   
> Up to this point, you might test it and find error
> when you click menu 'Pasca Invoice'.
> It's because your new DocumentStatus::PascaInvoice
> has not been recognized by class
> salesFormLetter. You must create a new class called
> SalesFormLetter_PascaInvoice which extends
> SalesFormLetter. The objective of this new class is
> to process your document. Inside the static method
> construct(...) of class SalesFormLetter, add a line
> of code for your new class instantiation inside the
> switch:

> case DocumentStatus::PascaInvoice: return new
> SalesFormLetter_PascaInvoice (getParmId);
>   
> I don't discuss the implementation inside your new
> class, since it depends on your requirements and
> time consuming as well. There are also some related
> classes, tables, and other objects to consider. But
> you can try to figure out the process by examining
> similar classes such as SalesFormLetter_Invoice,
> SalesFormLetter_PackingSlip, etc. Don't forget also
> to look at the form SalesEditLine which is the
> intermediate form opened before the document is
> actually posted.

> 4. Now, modify class SalesTableType, add these new
> methods:

> boolean mayPascaInvoiceBeUpdated()
> {
>     // let's say, it may only be updated if the
> sales order status is invoiced
>     return (salesTable.salesStatus ==
> SalesStatus::Invoiced);
> }

> boolean canPascaInvoiceBeUpdated()
> {
>     boolean  ok;
>     ;
>     ok = this.mayPascaInvoiceBeUpdated();
>     if (ok)
>     {
>         // if it may be updated, what make it can't
>         // ... add your own validation here,
>     }
>    
>     return ok;
> }

> client server static int posPascaInvoice()
> {
>     return 8; // the highest index in standard is 7,
> so just make it 8
> }  

> // modify checkIfUpdate. remember this method is a
> member of class SalesTableType
> container checkIfUpdate()
> {
>     container c;
>     .
>     .
>     .
>     // add this line
>     c = conIns(c, SalesTableType::posPascaInvoice(),
> this.canPascaInvoiceBeUpdated());
>     return c;
> }

> 5. Modify class SalesTableForm
> void enableUpdateJournalButtons(SalesTable        
> _salesTable,
>                               
> FormFunctionButtonControl   buttonUpdateQuotation,
>                               
> FormFunctionButtonControl 
> buttonUpdateConfirmation,
>                               
> FormFunctionButtonControl   buttonUpdatePickingList,
>                               
> FormFunctionButtonControl 
> buttonUpdatePickingListRegistrate,
>                               
> FormFunctionButtonControl   buttonUpdatePackingSlip,
>                               
> FormFunctionButtonControl   buttonUpdateInvoice,
>                               
> FormFunctionButtonControl 
> buttonUpdateProjectPackingSlip,
>                                 // add this
> parameter
>                               
> FormFunctionButtonControl   buttonUpdatePascaInvoice
>                                 )
> {
>     FormDataSource      salesTable_ds;
>     SalesTable          localSalesTable;
>     SalesTableType      salesTableType;
>     container           checkIfupdate;
>     .
>     .
>     // add this
>     boolean enablePascaInvoiceButton =
> buttonUpdatePascaInvoice? false : true;
>     ;
>     salesTable_ds   = _salesTable.dataSource();
>     localSalesTable = salesTable_ds.getFirst(true);
>     if (localSalesTable)
>     {
>         while(localSalesTable)
>         {
>             if ((enableQuotationButton          ==
> true) &&
>                 (enableConfirmationButton        
> == true) &&
>                 (enablePickingListButton        ==
> true) &&
>                 (enablePickingListRegistrateButton
> == true) &&
>                 (enablePackingSlipButton        ==
> true) &&
>                 (enableInvoiceButton             
> == true) &&
>                 (enableProjectPackingSlipButton ==
> true) &&
>                 (enablePascaInvoiceButton        
> == true))
>             {
>                 break;
>             }
>             .
>             .
>             .
>             if (!enablePascaInvoiceButton)
>                 enablePascaInvoiceButton =
> salesTableType.mayPascaInvoiceBeUpdated();
>             localSalesTable =
> salesTable_ds.getNext();
>         }
>     }
>     else
>     {
>      // you might find that
> _salesTable.checkIfUpdate() will actually call
> method
>      // chekIfUpdate() in class salesTableType ...
>      // no wonder method may...BeUpdated() is called
> as well
>         checkIfupdate                       =
> _salesTable.checkIfUpdate();
>  .
>  .    
>         enablePascaInvoiceButton =
> conPeek(checkIfUpdate, 
>                                                    
>            SalesTableType::posPascaInvoice());
>     }
>     .
>     .
>    
>
=== message truncated ===



           
__________________________________
Do you Yahoo!?
Read only the mail you want - Yahoo! Mail SpamGuard.
http://promotions.yahoo.com/new_mail




Yahoo! Groups Sponsor
ADVERTISEMENT
click here


Yahoo! Groups Links

Reply via email to