Window: Cash book Payment
Issue replication: Create a new Payment , go straight to type a value on the new transaction line and tab out - Jiwa crashes
If you have some text in the Header Description field then all is well
- Code: Select all
public void Setup(JiwaFinancials.Jiwa.JiwaApplication.IJiwaForm JiwaForm, JiwaFinancials.Jiwa.JiwaApplication.Plugin.Plugin Plugin)
{
if(JiwaForm is JiwaFinancials.Jiwa.JiwaCashBookUI.frmCashBook)
{
JiwaFinancials.Jiwa.JiwaCashBookUI.frmCashBook cashBookForm = (JiwaFinancials.Jiwa.JiwaCashBookUI.frmCashBook)JiwaForm;
_cashBookForm = cashBookForm;
_Plugin = Plugin;
cashBookForm.CashBook.CashBookTransactions.Added += CashBook_TransactionAdded;
cashBookForm.CashBook.CashBookTransactions.Changed += CashBookTransactions_Changed;
}
}
private void CashBook_TransactionAdded(JiwaFinancials.Jiwa.JiwaCashBook.CashBookTransaction item)
{
try
{
if (_cashBookForm.CashBook.Description.ToString().Length > 0 )
{
item.Remark = _cashBookForm.CashBook.Description.ToString() ;
}
item.PaymentType.ReadRecord ("000000001Z00000000RH"); // demodata setting to AMX
}
catch(Exception ex)
{
MessageBox.Show("Error setting transaction properties in trx add err: " + ex.Message , "Plugin: " + _Plugin.Name , MessageBoxButtons.OK , MessageBoxIcon.Error );
}
}
private void CashBookTransactions_Changed(JiwaFinancials.Jiwa.JiwaCashBook.CashBookTransaction item , System.ComponentModel.PropertyChangedEventArgs e )
{
try
{
if (e.PropertyName.Trim().ToUpper() != "JOBCHARGEAMOUNT" )
{
item.JobChargeAmount = item.HomeAmount * ( (decimal) 1.1 ) ;
}
if ( item.Remark.Trim().Length == 0 )
{
item.Remark = _cashBookForm.CashBook.Description.ToString();
}
}
catch(Exception ex)
{
MessageBox.Show("Error setting transaction properties in trx change err: " + ex.Message , "Plugin: " + _Plugin.Name , MessageBoxButtons.OK , MessageBoxIcon.Error );
}
}