reformat initial comment block.
[openemr.git] / library / classes / X12Partner.class.php
bloba2b1fdbd57e2ce6734e57e4f6351ecb5056ded63
1 <?php
2 require_once("ORDataObject.class.php");
4 /**
5 * class X12Partner
7 */
9 class X12Partner extends ORDataObject{
11 var $id;
12 var $name;
13 var $id_number;
14 var $x12_isa01; //
15 var $x12_isa02; //
16 var $x12_isa03; //
17 var $x12_isa04; //
18 var $x12_isa05; // Sender Interchange ID Qualifier. ZZ = mutually defined, 01 = Duns, etc.
19 var $x12_sender_id; // ISA06
20 var $x12_isa07; // Receiver Interchange ID Qualifier.
21 var $x12_receiver_id; // ISA08
22 var $x12_isa14; // Acknowledgment Requested. 0 = No, 1 = Yes.
23 var $x12_isa15; // Usage Indicator. T = testing, P = production.
24 var $x12_gs02; // Application Sender's Code. Default to ISA06.
25 var $x12_per06; // The submitter's EDI Access Number, if any.
26 var $x12_version;
27 var $processing_format;
28 var $processing_format_array;
29 var $x12_gs03; // Application Sender's Code. If this isn't set then we will use the $x12_receiver_id(ISA08).
31 /**
32 * Constructor sets all Insurance attributes to their default value
35 function X12Partner ($id = "", $prefix = "") {
36 parent::ORDataObject();
37 $this->id = $id;
38 $this->_table = "x12_partners";
39 $this->processing_format_array = $this->_load_enum("processing_format",false);
40 $this->processing_format = $this->processing_format_array[0];
41 //most recent x12 version mandated by HIPAA and CMS
42 // $this->x12_version = "004010X098A1";
43 $this->x12_version = "005010X222A1";
44 $this->x12_isa05 = "ZZ";
45 $this->x12_isa07 = "ZZ";
46 $this->x12_isa14 = "0";
47 if ($id != "") {
48 $this->populate();
52 function x12_partner_factory() {
53 $partners = array();
54 $x = new X12Partner();
55 $sql = "SELECT id FROM " . $x->_table . " order by name";
56 $result = $x->_db->Execute($sql);
57 while($result && !$result->EOF) {
58 $partners[] = new X12Partner($result->fields['id']);
59 $result->MoveNext();
61 return $partners;
64 function get_id() {
65 return $this->id;
68 function set_id($id) {
69 if (is_numeric($id)) {
70 $this->id = $id;
74 function get_name() {
75 return $this->name;
78 function set_name($string) {
79 $this->name = $string;
82 function get_id_number() {
83 return $this->id_number;
86 function set_id_number($string) {
87 $this->id_number = $string;
90 function get_x12_sender_id() {
91 return $this->x12_sender_id;
94 function set_x12_sender_id($string) {
95 $this->x12_sender_id = $string;
98 function get_x12_receiver_id() {
99 return $this->x12_receiver_id;
102 function set_x12_receiver_id($string) {
103 $this->x12_receiver_id = $string;
106 function get_x12_version() {
107 return $this->x12_version;
110 function set_x12_version($string) {
111 $this->x12_version = $string;
114 function get_x12_isa01() {
115 return $this->x12_isa01;
118 function set_x12_isa01($string) {
119 $this->x12_isa01 = $string;
122 function get_x12_isa02() {
123 return $this->x12_isa02;
126 function set_x12_isa02($string) {
127 $this->x12_isa02 = $string;
130 function get_x12_isa03() {
131 return $this->x12_isa03;
134 function set_x12_isa03($string) {
135 $this->x12_isa03 = $string;
138 function get_x12_isa04() {
139 return $this->x12_isa04;
142 function set_x12_isa04($string) {
143 $this->x12_isa04 = $string;
146 function get_x12_isa05() {
147 return $this->x12_isa05;
150 function set_x12_isa05($string) {
151 $this->x12_isa05 = $string;
154 function get_x12_isa07() {
155 return $this->x12_isa07;
158 function set_x12_isa07($string) {
159 $this->x12_isa07 = $string;
162 function get_x12_isa14() {
163 return $this->x12_isa14;
166 function set_x12_isa14($string) {
167 $this->x12_isa14 = $string;
170 function get_x12_isa15() {
171 return $this->x12_isa15;
174 function set_x12_isa15($string) {
175 $this->x12_isa15 = $string;
178 function get_x12_gs02() {
179 return $this->x12_gs02;
182 function set_x12_gs02($string) {
183 $this->x12_gs02 = $string;
186 function get_x12_per06() {
187 return $this->x12_per06;
190 function set_x12_per06($string) {
191 $this->x12_per06 = $string;
194 function get_processing_format() {
195 //this is enum so it can be string or int
196 if (!is_numeric($this->processing_format)) {
197 $ta = $this->processing_format_array;
198 return $ta[$this->processing_format];
200 return $this->processing_format;
203 function get_processing_format_array() {
204 //flip it because normally it is an id to name lookup, for templates it needs to be a name to id lookup
205 return array_flip($this->processing_format_array);
208 function set_processing_format($string) {
209 $this->processing_format = $string;
212 function get_x12_gs03() {
213 return $this->x12_gs03;
216 function set_x12_gs03($string) {
217 $this->x12_gs03 = $string;
220 function get_x12_isa14_array() {
221 return array(
222 '0' => 'No',
223 '1' => 'Yes',
227 function get_x12_isa15_array() {
228 return array(
229 'T' => 'Testing',
230 'P' => 'Production',
234 function get_idqual_array() {
235 return array(
236 '01' => 'Duns (Dun & Bradstreet)',
237 '14' => 'Duns Plus Suffix',
238 '20' => 'Health Industry Number (HIN)',
239 '27' => 'Carrier ID from HCFA',
240 '28' => 'Fiscal Intermediary ID from HCFA',
241 '29' => 'Medicare ID from HCFA',
242 '30' => 'U.S. Federal Tax ID Number',
243 '33' => 'NAIC Company Code',
244 'ZZ' => 'Mutually Defined',
248 function get_x12_version_array() {
249 return array(
250 '005010X222A1' => '005010X222A1',
251 '004010X098A1' => '004010X098A1',