WayStar 837 HL sequence issue

There is an issue with the 837 files. Below is the sequence that is being sent in the 837 files. As you can see the sequence is off. I am posting to see if anyone else has run into this and fixed it.
v7.0.0 (2) is where this is happening.

HL*1**20*1

HL*2*1*22*0

HL*3*1*22*1

HL*4*3*23*0

HL*4*1*22*1 (should be HL*5)

HL*5*4*23*0 (should be HL*6)

HL*5*1*22*0 (should be HL*7)

HL*6*1*22*0 (should be HL*8)

HL*7*1*22*0 (should be HL*9)

HL*8*1*22*0 (should be HL*10)

We just tried to manually change the segments to sequential order. It caused more issues. I am going to log onto their developer forum to see if I can get more information about their error message.

What version of OpenEMR @juggernautsei ?

I just looked at a few files I’m getting from other people. Every file I get is a single claim per transaction (ST-SE). I’m assuming it’s a setting, you might try switching it up to to multiple transactions rather than a single one. That would certainly fix any weird HL counters.

Screenshot from 2023-05-16 14-10-55

was fixed recently, if running 7.0.1 should be good

@stephenwaite I did an upgrade and ran the batch and the issue is still the same. So, I am trying to get into the WayStart developer support.
We manually changed numbers and it caused other issues with the file so what the agent told us is not the issue. The only time there is an issue is when the patient is not the insured.

Conclusion
@growlingflea helped. There is a setting in the config under billing where the claims can be formatted for insurance. We had that box checked. It should not have been. Unchecking that box changed the format of the claim so that it was conducive for a clearinghouse. Next, in our system, we were still getting a skip from HL2 to HL4*23. So, I commented out line 520 of the X125010837P file. Now the segment counts are right.

I learned a lot about segment counts. Also, the segments are correct in v7.0.1.

ok, nice, could you point out the line in the repository please?

@stephenwaite the line that I commented out to get the HL* count corrected is in v7.0.0 (2).

    // Segment REF (Payer Secondary Identification) omitted.
    // Segment REF (Billing Provider Secondary Identification) omitted.

    if (!$claim->isSelfOfInsured()) {
        //$HLcount++;  <--Here is what I commented out and that fixed the symptom but not the cause
        ++$edicount;
        $out .= "HL" .        // Loop 2000C Patient Information
            "*" . $HLcount .
            "*" . $HLSubscriber .
            "*" . "23" .
            "*" . "0" .
            "~\n";

This does not have to be done in the current release.