manipulate the bulk email list  Topic is solved

Discussions relating to plugin development, and the Jiwa API.

manipulate the bulk email list

Postby indikad » Fri Jul 15, 2016 12:42 pm

Jiwa 7 - 157

area = Sales | printing & emailing | Bath printing & emailing

I need to manipulate the bottom grid - where the list populates after the user hits the Go button.
I need to remove some lines programmatically.

is there any way I can access this grid and its methods pls ?

Hopefully it wold be something like this -- below ( another similar solution )
viewtopic.php?f=26&t=543&p=1867&hilit=append+to+candidates#p1867
indikad
Frequent Contributor
Frequent Contributor
 
Posts: 182
Joined: Thu Jun 18, 2009 1:14 pm
Topics Solved: 2

Re: manipulate the bulk email list  Topic is solved

Postby Mike.Sheen » Sun Jul 31, 2016 1:42 pm

Hi Indika,

Sure, you can use the same technique:

Code: Select all
public void SetupBeforeHandlers(JiwaFinancials.Jiwa.JiwaApplication.IJiwaForm JiwaForm, JiwaFinancials.Jiwa.JiwaApplication.Plugin.Plugin Plugin)
    {
      var batchForm = (JiwaFinancials.Jiwa.JiwaSalesUI.BatchPrinting.MainForm)JiwaForm;      
      batchForm.GoUltraButton.Click += GoUltraButton_Click;
    }


and then in the click handler:

Code: Select all
private void GoUltraButton_Click(object sender, System.EventArgs e)
   {
      var button = (Infragistics.Win.Misc.UltraButton)sender;
      var batchForm = (JiwaFinancials.Jiwa.JiwaSalesUI.BatchPrinting.MainForm)button.FindForm();
      
      // batchForm.BatchPrint.Candidates is the list of candidate items - you can examine or remove from this list and the child actions also - each candidate represents an invoice - it has an Actions property which is a collection of Action - an action is and email or a report print.
   }


Alternatively you can hook into the Candidates.Adding or Actions.Adding event and decide to cancel the add instead of removing them after they've been added. Whichever works best for you.
Mike Sheen
Chief Software Engineer
Jiwa Financials

If I do answer your question to your satisfaction, please mark it as the post solving the topic so others with the same issue can readily identify the solution
User avatar
Mike.Sheen
Overflow Error
Overflow Error
 
Posts: 2445
Joined: Tue Feb 12, 2008 11:12 am
Location: Perth, Republic of Western Australia
Topics Solved: 757

Re: manipulate the bulk email list

Postby indikad » Wed Aug 17, 2016 2:05 pm

Hi Mike,

Thanks for this - however I n=belive I may need a little bit of a tip to get this working.

this is my code below and also the errors i get
Code: Select all
AddHandler oBatchForm.BatchPrint.Candidates.Adding , AddressOf candidatesAdding
         'AddHandler oBatchForm.BatchPrint.Candidates.   , AddressOf candidatesAdding
         msgbox ("found")
      End If      
    End Sub
   Private Sub candidatesAdding (ByVal item As  JiwaSales.BatchPrinting.Candidate  )
      msgbox ( Item.ToString() )
      msgbox("debtor no = " & item.DebtorAccountNo.ToString())
      
         If ( item.DebtorAccountNo.ToString().Trim() = "debtor1" ) Then
                                '---- This one works but removes all debtors. Not just THIS  debtor
            Throw New JiwaApplication.Exceptions.ClientCancelledException("removing selected debtor.")   
                                   '----   This one below gives me an error  - "Collection index must be in the range of 1 to ..... "      
            item.Actions.Remove( item.Actions.Item (0))
         End If
      '
   End Sub
indikad
Frequent Contributor
Frequent Contributor
 
Posts: 182
Joined: Thu Jun 18, 2009 1:14 pm
Topics Solved: 2

Re: manipulate the bulk email list

Postby Mike.Sheen » Thu Aug 18, 2016 7:28 pm

Throwing a client cancelled exception tells the system to stop, but don't report an error - that's not what you want to do.

You get a "Collection index must be in the range of 1 to ....." exception when you
Code: Select all
item.Actions.Remove( item.Actions.Item (0))


because, you need to use a 1 based index.

So,
Code: Select all
item.Actions.Remove( item.Actions.Item (1))


will work.
Mike Sheen
Chief Software Engineer
Jiwa Financials

If I do answer your question to your satisfaction, please mark it as the post solving the topic so others with the same issue can readily identify the solution
User avatar
Mike.Sheen
Overflow Error
Overflow Error
 
Posts: 2445
Joined: Tue Feb 12, 2008 11:12 am
Location: Perth, Republic of Western Australia
Topics Solved: 757


Return to Technical and or Programming

Who is online

Users browsing this forum: No registered users and 2 guests