Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- unit jms;
- interface
- procedure ParseProcessedFile (const filename : string;
- each_line : ProcessedLineCallback);
- implementation
- uses
- sysutils;
- type
- HeaderLineType = record
- p_last_name : string;
- p_first_name : string;
- dos_from : TDateTime;
- dos_to : TDateTime;
- p_address : string;
- p_city : string;
- p_state : string;
- p_zip : string;
- f_name : string;
- f_address : string;
- f_city : string;
- f_state : string;
- f_zip : string;
- account_number : string;
- in_out_network : Boolean;
- claim_id : longint;
- end;
- DetailLineType = record
- dos_from : TDateTime;
- dos_to : TDateTime;
- description : string;
- revenue_code : string;
- hcpcs_cpt_code : string;
- modifiers : string;
- units : string;
- unit_price : string;
- charges : string;
- tiff_id : string;
- end;
- TotalLineType = record
- file_date : string;
- detail_line_count : string;
- summary_line_count : string;
- end;
- ProcessedLineType = record
- pdf_filename : string;
- claim_id : longint;
- file_id : longint;
- returned_date : TDateTime;
- end;
- ProcessedLineCallback = procedure (line : ProcessedLineType);
- function JmsDateToDate (const date_str : string) : TDateTime;
- var
- yr, mo, da : word;
- begin
- Val(Copy(date_str, 0, 2), yr);
- Val(Copy(date_str, 3, 2), mo);
- Val(Copy(date_str, 5, 2), da);
- JmsDateToDate := EncodeDate (2000 + yr, mo, da);
- end;
- function ParseProcessedLine (const line : string) : ProcessedLineType;
- var
- underscore_pos : integer;
- period_pos : integer;
- pipe_pos : integer;
- begin
- underscore_pos := Pos('_', line);
- period_pos := Pos('.', line);
- pipe_pos := Pos('|', line);
- Val(Copy(line, 0, underscore_pos-1), ParseProcessedLine.claim_id);
- Val(Copy(line, underscore_pos+1, period_pos-underscore_pos-1),
- ParseProcessedLine.file_id);
- ParseProcessedLine.pdf_filename := Copy(line, 0, pipe_pos-1);
- ParseProcessedLine.returned_date := JmsDateToDate(Copy(line, pipe_pos+1, 6));
- end;
- procedure ParseProcessedFile (const filename : string; each_line : ProcessedLineCallback);
- var
- F : text;
- L : string;
- processed_line : ProcessedLineType;
- begin
- Assign (F, filename);
- Reset (F);
- while not Eof (F) do
- begin
- Readln (F, L);
- processed_line := ParseProcessedLine (L);
- each_line (processed_line);
- end;
- end;
- begin
- end.
Add Comment
Please, Sign In to add comment