New Hooks
Posted: Thu Sep 05, 2019 6:38 am
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
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