Bingo!
This is the final code.
- Code: Select all
public void Setup(JiwaFinancials.Jiwa.JiwaApplication.IJiwaBusinessLogic JiwaBusinessLogic, JiwaFinancials.Jiwa.JiwaApplication.Plugin.Plugin Plugin)
{
if(JiwaBusinessLogic.GetType() == typeof(JiwaFinancials.Jiwa.JiwaInvReceival.Receival))
{
JiwaFinancials.Jiwa.JiwaInvReceival.Receival GRN =(JiwaFinancials.Jiwa.JiwaInvReceival.Receival) JiwaBusinessLogic;
GRN.SortOrders.Insert(0, new JiwaFinancials.Jiwa.JiwaApplication.IJiwaNavigable.SortKey{
//GRN.SortOrders.Add(new JiwaFinancials.Jiwa.JiwaApplication.IJiwaNavigable.SortKey{
Description = "Slip Date",
FieldName = "RE_Main.SlipDate",
SortFieldValueMethod = delegate() {return GRN.SlipDate.ToString("yyyyMMdd"); }
});
GRN.BaseFindSQLQuery = "SELECT TOP 1 RE_Main.PackSlipID FROM RE_Main ";
}
}
I remmed out the Add and used Insert so I can put in a index in the hope that will be the first option which appears when opening the module.
And I also made the SlipDate return a string as per Stuart's suggestion but formatted to yyyyMMdd. Without that formatting, it throws an error using the green Previous/Next buttons.
Seems to work but It only works when 1 GRN has been done on any day.
If there are mutiple GRNs on the same day, it doesn't scroll previous/next to the next GRN. I suspect I need it to recognise hours & minutes but have tried all kinds of syntax tweaks but none work.
Suggestions?