Copay not included in the patient balance

@stephenwaite I was hoping you could help me read this correctly.
This is in the file.

        // $copay = !empty($insarr[0]['copay']) ? $insarr[0]['copay'] * 1 : 0;

The above operatory is commented out and the value of $copay has been set to zero below. The above line if uncommented would set the value of copay to whatever value is in the insurance table multiplied by one (not sure why it needs to be multiplied by one). If there is no value is found. It is set to zero. Am I reading that correctly?

        $copay = 0;

        $amt = !empty($brow['amount']) ? $brow['amount'] * 1 : 0;
        $pay = !empty($drow['payments']) ? $drow['payments'] * 1 : 0;
        $ptbal = $copay + $amt - $pay;
        if ($ptbal) { // @TODO check if we want to show patient payment credits.
            $balance += $ptbal;

Seems that it would nice to make this a global in the billing section whether to add copays to the patient balance or not?

After looking at the data, I think I understand why the amount would be multiplied by one. Empty is different than 0. There are a lot of entries in our database that are 0 so it is not empty. Thus to keep the math right and not change the value multiplying 0 * 1 would render zero.

I am not sure why the $copay = 0 was added. This eliminates the possibility of ever adding the copay to the balance in my opinion. It seems that the turnery operator is correct and should be uncommented. But in case a user does not want copays added. There should be a global in the billing section to turn it on or off.

What is your opinion?

hi @juggernautsei , the * 1 should be addressed since it was used to transform string to int, the reason it’s been commented out is say you have past encounters where there wasn’t a fee sheet created or any billing done, in these situations it’s adding the copay to the balance that displays in the dashboard

OK, help me understand in what situation should the copay be added to the patient balance? Share with me the logic needed to properly know when to add the copay to the patient balance?


hi @juggernautsei, you could restore the lines commented that don’t represent cash but instead the amount of the copay entered in the insurance demographics. The copay is currently added to the patient balance when the payment is posted either through the invoice or fees->payment.

A global is probably a good idea for the situation where the practice wants to see the copay amount from the insurance demographics applied against the encounter. This might be especially true for offices that bill services that require a copay.

Oh, I did not know it was for show.
I am still learning. The practice reported that they are not seeing the copay when the patient has a zero balance. But to me if the patient has a zero balance. Why would the copay show as needing to be collected?

in the demos 2014-02-01 Encounter for Phil Belford
Phil has paid his copay
current code:
Screenshot from 2022-10-16 15-20-51

future global set to use insurance copay to calc pt bal due display in billing dashboard:
Screenshot from 2022-10-16 15-21-59

1 Like

Hi, thanks but the practice is still using v6.

The modification that was put on the flowboard is to show the patient balance there. So, when the staff is calling patients they have the information they need to collect past due amounts while they have the patient on the phone without having to go into the chart.

But they noticed that the amount does not include the copay.

So, I started looking into how to include the copay and ran into the code that was commented out.

hi @juggernautsei, no prob, what v6?

v6.0.0(1) is the version that is being used currently.