Hi,
I need to have 2 new hooks added.
1) In the ContrAccount.cs - The new hook is in the ToolBarMain_ButtonClick method. It needs to be inserted right after the "Payment" case statement.
private void ToolBarMain_ButtonClick(object sender, OpenDental.UI.ODToolBarButtonClickEventArgs e) {
if(e.Button.Tag.GetType()==typeof(string)){
//standard predefined button
switch(e.Button.Tag.ToString()){
//case "Patient":
// OnPat_Click();
// break;
case "Payment":
*********************** begin new hook **************************************
if (Plugins.HookMethod(this, "ContrAccount.ToolBarMain_Payment"))
{
return;
}
*********************** end new hook **************************************
bool isTsiPayment =(TsiTransLogs.IsTransworldEnabled(PatCur.ClinicNum)
&& Patients.IsGuarCollections(PatCur.Guarantor)
&& !MsgBox.Show(this,MsgBoxButtons.YesNo,"The guarantor of this family has been sent to TSI for a past due balance. "
2) In the FormPayment.cs - The new hook is in the SavePaymentToDb method. It needs to be inserted right before the line - if (_isCCDeclined) {
if(amt!=0 && listPayType.SelectedIndex==-1) {
MsgBox.Show(this,"A payment type must be selected.");
return false;
}
}
*********************** begin new hook **************************************
object[] parameters = { listPayType.SelectedItem, textNote.Text, _isCCDeclined, _paymentCur };
Plugins.HookAddCode(this, "FormPayment.SavePaymentToDb_afterUnearnedCurCheck", parameters);
textNote.Text = textNote.Text + (string)parameters[1];
_isCCDeclined = (bool)parameters[2];
*********************** end new hook **************************************
if (_isCCDeclined) {
textAmount.Text=0.ToString("f");//So that a declined transaction does not affect account balance
Thanks,
Dave
New Hooks
Re: New Hooks
Hi Dave,
Hook Request 1:
I can put in the requested HookMethod, which will replace the code within the case statement. I just need to confirm that there are no parameters which you would be passing in. Since this is replacing a Case statement, I replaced the return with a break.
Hook Request 2:
I can put this in pretty much as is. I did adjust the assignment of textNote.text so that it wouldn't double in situations where your hook isn't active. The code before your request differs in head from what you indicated in your request. Please confirm that the hooks location, and my adjustments, are still acceptable.
Hook Request 1:
I can put in the requested HookMethod, which will replace the code within the case statement. I just need to confirm that there are no parameters which you would be passing in. Since this is replacing a Case statement, I replaced the return with a break.
Code: Select all
case "Payment":
if (Plugins.HookMethod(this,"ContrAccount.ToolBarMain_ButtonClick_Payment")) {
break;
}
bool isTsiPayment=(TsiTransLogs.IsTransworldEnabled(PatCur.ClinicNum)
I can put this in pretty much as is. I did adjust the assignment of textNote.text so that it wouldn't double in situations where your hook isn't active. The code before your request differs in head from what you indicated in your request. Please confirm that the hooks location, and my adjustments, are still acceptable.
Code: Select all
if(unearnedCur.IsLessThan(0)
&& !(unearnedCur+(double)PaySplits.GetUnearnedForFam(_famCur,payNumExcluded:_paymentCur.PayNum)).IsGreaterThanOrEqualToZero()
&& !MsgBox.Show(this,MsgBoxButtons.YesNo,"You are attempting to create a negative unearned amount. Continue?"))
{
return false;
}
object[] parameters = { listPayType.SelectedItem, textNote.Text, _isCCDeclined, _paymentCur };
Plugins.HookAddCode(this,"FormPayment.SavePaymentToDb_afterUnearnedCurCheck",parameters);
textNote.Text = (string)parameters[1];
_isCCDeclined = (bool)parameters[2];
if(_isCCDeclined) {
Re: New Hooks
Hi Patrick,
Hook 1 should be fine like you have it. I just need to know when the Payment button is selected so I don't need any fields passed with it.
Hook 2 is good also.
Thank you,
Dave
Hook 1 should be fine like you have it. I just need to know when the Payment button is selected so I don't need any fields passed with it.
Hook 2 is good also.
Thank you,
Dave
Re: New Hooks
Hooks have been added, and will be included in Beta version 19.2.23.
Re: New Hooks
Patrick,
Do you know when the next non-beta release with these hooks will be made?
What version will that be?
Thanks,
Dave
Do you know when the next non-beta release with these hooks will be made?
What version will that be?
Thanks,
Dave
Re: New Hooks
We generally release a new version in September of October. I haven't heard anything official about when we'll release, but it should be in the next few weeks.