Friday, March 6, 2015

XML Superbill Time Description Enhancements

Another issue that we came across with the XML Superbill was that the presense of a caret in the narrative did not function the same as in the old superbill. If you were not aware, if there is a caret "^" in the narrative, anything after the caret does not output on a normal superbill, and therefore doesn't show on the invoice. The XML Superbill code did not respect the caret, and includes the entire narrative. A quick change to the SQL in the stored procedure (dg_xml_timedesc) that delivers the narrative to the XML Superbill did the trick.

Old Code:

set @mysql =
 N'set @mystrmax =
   (select tdline, tddesc from ' + @timedesc + N' timedesc
   where tindex = @tindex
   and tddesc is not null
   order by tdline for xml raw)'


New Code:

set @mysql =
 N'set @mystrmax =
   (select tdline, LEFT(tddesc,CASE WHEN CHARINDEX(''^'',tddesc)=0 THEN LEN(tddesc) ELSE CHARINDEX(''^'',tddesc)-1 END) as tddesc
   from ' + @timedesc + N' timedesc
   where tindex = @tindex
   and tddesc is not null
   AND NOT EXISTS (SELECT * FROM timedesc caret WHERE timedesc.tindex=caret.tindex AND CHARINDEX(''^'',caret.tddesc)>0 AND timedesc.tdline>caret.tdline)
   order by tdline for xml raw)'

No comments:

Post a Comment