Adjusting Misc Invoice amounts via data directive C#

Has anyone adjusted the invoice misc charges via a data directive? I am trying to adjust the amount of a surcharge amount “misc charge” based off of how many parts we are actually shipping and update all related amounts. I have done a trace when adjusting the amount manually and the the two main BO’s are OnChangeOfMiscAmt and UpdateMaster. My thoughts are to do a standard data directive and fire off the BO’s but i am having issues getting the OnChangeOfMiscAmt to work correctly. Any help would be greatly appreciated. E10.1.400.20 Thanks!

Ken,

A few questions, are you using a data directive or method directive? The great thing about a method directive is that it is more picky on firing.

I’ve never messed with this particular BO (I assume its SalesOrderAdapter). Maybe this will get you somewhere in the ballpark. (untested code). Let me know if I got lucky and this actually does something :slight_smile:

SalesOrderAdapter so = new SalesOrderAdapter(oTrans);
            so.BOConnect();
            bool GotRecords = so.GetByID(405283);
         
            if (GotRecords)
                foreach (var row in so.SalesOrderData.OrderDtl.Rows)// all)
                {
                    ((DataRow)row)["MiscCharges"] = 1.23m; //your charges
                }
         //so.ChangeMiscAmount("Some Table Name") ;   //????? 
            so.Update();

*I have no idea what TableName to pass - maybe check your trace for a clue *