Custom Snapshot Fields

Discussions relating to Jiwa 7 plugin development, and the Jiwa 7 API.

Custom Snapshot Fields

Postby SBarnes » Thu Feb 10, 2022 10:01 am

I have the code below in the save start of a sales order to set the value of a custom field on the snapshot, it works fine except if I copy a sales order on the first save of the copy the code fires and Jiwa doesn't complain but it clears out the custom field on the snapshot, if I then edit the order such as changing the order number and resave everything goes back to working perfectly.

I think this may be an actual bug in Jiwa.

Code: Select all
private void SalesOrderSaveStart(object sender, EventArgs e)
      {
         //System.Diagnostics.Debugger.Launch();
         JiwaFinancials.Jiwa.JiwaSales.SalesOrder.SalesOrder salesorder = (JiwaFinancials.Jiwa.JiwaSales.SalesOrder.SalesOrder)sender;
         string strTDays = salesorder.CustomFieldValues.get_ItemFromSettingName("TDays").Contents.Trim();
         int iTDays = 0;
         if (strTDays != null && strTDays != "")
         {
            iTDays = int.Parse(strTDays);

         }

         DateTime duedate = GetDueDate(salesorder,  salesorder.SalesOrderHistorys[salesorder.CurrentHistoryNo].RecordDate,  iTDays);
         

         JiwaFinancials.Jiwa.JiwaSales.SalesOrder.SalesOrderHistory hist = salesorder.SalesOrderHistorys[salesorder.CurrentHistoryNo];

         hist.CustomSettingValues.get_ItemFromSettingName("DueDate").Contents = duedate.ToString("dd/MM/yyyy");

         





      }
Regards
Stuart Barnes
SBarnes
Shihan
Shihan
 
Posts: 1696
Joined: Fri Aug 15, 2008 3:27 pm
Topics Solved: 191

Return to Technical and or Programming

Who is online

Users browsing this forum: No registered users and 5 guests