corrected
[openemr.git] / library / classes / X12Partner.class.php
blob8a584194a983ba926ae3c59462cbe008f81c4585
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_sender_id; // ISA06
15 var $x12_receiver_id; // ISA08
16 var $x12_isa05; // Sender Interchange ID Qualifier. ZZ = mutually defined, 01 = Duns, etc.
17 var $x12_isa07; // Receiver Interchange ID Qualifier.
18 var $x12_isa14; // Acknowledgment Requested. 0 = No, 1 = Yes.
19 var $x12_isa15; // Usage Indicator. T = testing, P = production.
20 var $x12_gs02; // Application Sender's Code. Default to ISA06.
21 var $x12_per06; // The submitter's EDI Access Number, if any.
22 var $x12_version;
23 var $processing_format;
24 var $processing_format_array;
25 var $x12_gs03; // Application Sender's Code. Default to ISA08.
27 /**
28 * Constructor sets all Insurance attributes to their default value
31 function X12Partner ($id = "", $prefix = "") {
32 parent::ORDataObject();
33 $this->id = $id;
34 $this->_table = "x12_partners";
35 $this->processing_format_array = $this->_load_enum("processing_format",false);
36 $this->processing_format = $this->processing_format_array[0];
37 //most recent x12 version mandated by HIPAA and CMS
38 // $this->x12_version = "004010X098A1";
39 $this->x12_version = "005010X222A1";
40 $this->x12_isa05 = "ZZ";
41 $this->x12_isa07 = "ZZ";
42 $this->x12_isa14 = "0";
43 if ($id != "") {
44 $this->populate();
48 function x12_partner_factory() {
49 $partners = array();
50 $x = new X12Partner();
51 $sql = "SELECT id FROM " . $x->_table . " order by name";
52 $result = $x->_db->Execute($sql);
53 while($result && !$result->EOF) {
54 $partners[] = new X12Partner($result->fields['id']);
55 $result->MoveNext();
57 return $partners;
60 function get_id() {
61 return $this->id;
64 function set_id($id) {
65 if (is_numeric($id)) {
66 $this->id = $id;
70 function get_name() {
71 return $this->name;
74 function set_name($string) {
75 $this->name = $string;
78 function get_id_number() {
79 return $this->id_number;
82 function set_id_number($string) {
83 $this->id_number = $string;
86 function get_x12_sender_id() {
87 return $this->x12_sender_id;
90 function set_x12_sender_id($string) {
91 $this->x12_sender_id = $string;
94 function get_x12_receiver_id() {
95 return $this->x12_receiver_id;
98 function set_x12_receiver_id($string) {
99 $this->x12_receiver_id = $string;
102 function get_x12_version() {
103 return $this->x12_version;
106 function set_x12_version($string) {
107 $this->x12_version = $string;
110 function get_x12_isa05() {
111 return $this->x12_isa05;
114 function set_x12_isa05($string) {
115 $this->x12_isa05 = $string;
118 function get_x12_isa07() {
119 return $this->x12_isa07;
122 function set_x12_isa07($string) {
123 $this->x12_isa07 = $string;
126 function get_x12_isa14() {
127 return $this->x12_isa14;
130 function set_x12_isa14($string) {
131 $this->x12_isa14 = $string;
134 function get_x12_isa15() {
135 return $this->x12_isa15;
138 function set_x12_isa15($string) {
139 $this->x12_isa15 = $string;
142 function get_x12_gs02() {
143 return $this->x12_gs02;
146 function set_x12_gs02($string) {
147 $this->x12_gs02 = $string;
150 function get_x12_per06() {
151 return $this->x12_per06;
154 function set_x12_per06($string) {
155 $this->x12_per06 = $string;
158 function get_processing_format() {
159 //this is enum so it can be string or int
160 if (!is_numeric($this->processing_format)) {
161 $ta = $this->processing_format_array;
162 return $ta[$this->processing_format];
164 return $this->processing_format;
167 function get_processing_format_array() {
168 //flip it because normally it is an id to name lookup, for templates it needs to be a name to id lookup
169 return array_flip($this->processing_format_array);
172 function set_processing_format($string) {
173 $this->processing_format = $string;
176 function get_x12_gs03() {
177 return $this->x12_gs03;
180 function set_x12_gs03($string) {
181 $this->x12_gs03 = $string;
184 function get_x12_isa14_array() {
185 return array(
186 '0' => 'No',
187 '1' => 'Yes',
191 function get_x12_isa15_array() {
192 return array(
193 'T' => 'Testing',
194 'P' => 'Production',
198 function get_idqual_array() {
199 return array(
200 '01' => 'Duns (Dun & Bradstreet)',
201 '14' => 'Duns Plus Suffix',
202 '20' => 'Health Industry Number (HIN)',
203 '27' => 'Carrier ID from HCFA',
204 '28' => 'Fiscal Intermediary ID from HCFA',
205 '29' => 'Medicare ID from HCFA',
206 '30' => 'U.S. Federal Tax ID Number',
207 '33' => 'NAIC Company Code',
208 'ZZ' => 'Mutually Defined',
212 function get_x12_version_array() {
213 return array(
214 '005010X222A1' => '005010X222A1',
215 '004010X098A1' => '004010X098A1',