removed dangling </table>
[openemr.git] / library / classes / Claim.class.php
blobe6f52d965bc975eee168189663d1916a1baae68c
1 <?php
3 define ("CLAIM_TARGET_TXT",1);
4 define ("CLAIM_TARGET_PDF",2);
5 define ("CLAIM_FORMAT_X12",1);
6 define ("CLAIM_TARGET_HCFA",2);
8 require_once("ORDataObject.class.php");
9 /**
10 * class Claim
13 class Claim extends ORDataObject{
14 var $id;
15 var $billing_key;
16 var $target;
17 var $format;
18 var $server;
19 var $date;
20 var $procedures;
22 /**
23 * Constructor sets all Company attributes to their default value
25 function claim($id = "") {
26 $this->id = $id;
27 $this->billing_key = md5($GLOBALS['billing_key_salt'] . rand() . time());
28 $this->target = CLAIM_TARGET_TXT;
29 $this->target = CLAIM_FORMAT_X12;
30 $this->date = date("Y-m-d h:m");
31 $this->procedures = new array();
32 $this->_table = "claims";
33 if ($id != "") {
34 $this->populate();
39 function factory_company($foreign_id = "") {
40 if (empty($foreign_id)) {
41 $foreign_id= "like '%'";
43 else {
44 $foreign_id= " = '" . mysql_real_escape_string(strval($foreign_id)) . "'";
46 $a = new Address();
47 $sql = "SELECT id FROM " . $a->_table . " WHERE foreign_id " .$foreign_id ;
48 //echo $sql . "<bR />";
49 $results = sqlQ($sql);
50 //echo "sql: $sql";
51 $row = mysql_fetch_array($results);
52 if (!empty($row)) {
53 $a = new Address($row['id']);
56 return $a;
59 function toString($html = false) {
60 $string .= "\n"
61 . "ID: " . $this->id."\n"
62 . "FID: " . $this->foreign_id."\n"
63 .$this->line1 . "\n"
64 .$this->line2 . "\n"
65 .$this->city . ", " . strtoupper($this->state) . " " . $this->zip . "-" . $this->plus_four. "\n"
66 .$this->country. "\n";
68 if ($html) {
69 return nl2br($string);
71 else {
72 return $string;
76 function set_id($id) {
77 $this->id = $id;
79 function get_id() {
80 return $this->id;
82 function set_name($name) {
83 $this->name = $name;
85 function get_name() {
86 return $this->name;
88 function set_foreign_id($fid) {
89 $this->foreign_id = $fid;
91 function get_foreign_id() {
92 return $this->foreign_id;
94 function set_line1($line1) {
95 $this->line1 = $line1;
97 function get_line1() {
98 return $this->line1;
100 function set_line2($line2) {
101 $this->line2 = $line2;
103 function get_line2() {
104 return $this->line2;
106 function set_city($city) {
107 $this->city = $city;
109 function get_city() {
110 return $this->city;
112 function set_state($state) {
113 $this->state = $state;
115 function get_state() {
116 return $this->state;
118 function set_zip($zip) {
119 $this->zip = $zip;
121 function get_zip() {
122 return $this->zip;
124 function set_plus_four($plus_four) {
125 $this->plus_four = $plus_four;
127 function get_plus_four() {
128 return $this->plus_four;
130 function set_country($country) {
131 $this->country = $country;
133 function get_country() {
134 return $this->country;
136 function persist($fid ="") {
137 if (!empty($fid)) {
138 $this->foreign_id = $fid;
140 parent::persist();
143 } // end of Company