Custom Snapshot Fields
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.
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");
}