Situation
x12 files are not being generated correctly. OpenEMR doesn’t through any errors but the x12 files are being rejected by the clearinghouse with errors.
OpenEMR Version
I’m using OpenEMR version 7.0.1.1
Browser:
I’m using: Chrome and Firefox
Operating System
I’m using: Ubuntu 20.04 and 22.04
Search
Did you search the forum for similar questions? yes
Logs
Did you check the logs?
Was there anything pertinent in them?
Please paste them here (surround with three backticks (```) for readability.
You can also turn on User Debugging under Administration->Globals->Logging User Debugging Options=>All
You’ll also want to have those zip fixes if you haven’t grabbed them. My apologies since there were a lot of moving parts but all will be well with patch 2.
I made both of those changes but we are stilling getting those errors.
protected function updateBatchFile(BillingClaim $claim)
{
// Generate the file
$log = '';
$hlCount = 1;
$segs = explode(
"~\n",
X125010837P::genX12837P(
$claim->getPid(),
$claim->getEncounter(),
$claim->getPartner(),
$log,
$this->encounter_claim,
false,
$hlCount
)
);
$this->appendToLog($log);
$this->batch->append_claim($segs);
// Store the claims that are in this claims batch, because
// if remote SFTP is enabled, we'll need the x12 partner ID to look up SFTP credentials
$this->batch->addClaim($claim);
}
} else {
$log .= "*** Missing service facility street.\n";
}
++$edicount;
$out .= "N4" .
"*";
if ($claim->facilityCity()) {
$out .= $claim->facilityCity();
} else {
$log .= "*** Missing service facility city.\n";
}
$out .= "*";
if ($claim->facilityState()) {
$out .= $claim->facilityState();
} else {
$log .= "*** Missing service facility state.\n";
}
$out .= "*";
if (strlen($claim->facilityZip()) != 9) {
$log .= "*** Service facility zip is not 9 digits.\n";
}
$out .= $claim->facilityZip();
$out .= "~\n";
}
Removing that line solved part of the problem as we can now generate some x12 files that the clearinghouse can successfully process but there are some with secondary claims that are still failing. I took a look and there are some times when the secondary insurance doesn’t have a zip code in the x12 file even though one has been entered when I look in the OpenEMR webui. Thanks. example-bad-2023-06-21-170639-batch.txt (2.2 KB)
if (
!(strlen($claim->payerZip($ins)) == 5)
|| (strlen($claim->payerZip($ins) == 9))
) {
$log .= "*** Other payer zip is not 5 or 9 digits.\n";
}
$out .= $claim->x12Zip($claim->payerZip($ins));
$out .= "~\n";
that fixed the issue and we were able to submit the x12 to the clearinghouse successfully. One thing of note is that in the logs on openemr it still throws an error “*** Other payer zip is not 5 or 9 digits.”
nice, thanks for the feedback, it’s meant to log something that might be an issue for some payers there in the billing log and could be a potential error that a biller might want to fix