2 require_once("DataObjectBase.class.php");
3 require_once("xmlrpc.inc");
5 class BillingService
Extends DataObjectBase
{
7 function BillingService() {
8 $this->_addFunc("name", array( "name" => "FreeB.FBBillingService.Name",
9 "sig" => array(XMLRPCSTRING
,XMLRPCINT
),
11 $this->_addFunc("streetaddress", array( "name" => "FreeB.FBBillingService.StreetAddress",
12 "sig" => array(XMLRPCSTRING
,XMLRPCINT
),
14 $this->_addFunc("city", array( "name" => "FreeB.FBBillingService.City",
15 "sig" => array(XMLRPCSTRING
,XMLRPCINT
),
17 $this->_addFunc("state", array( "name" => "FreeB.FBBillingService.State",
18 "sig" => array(XMLRPCSTRING
,XMLRPCINT
),
20 $this->_addFunc("zipcode", array( "name" => "FreeB.FBBillingService.Zipcode",
21 "sig" => array(XMLRPCSTRING
,XMLRPCINT
),
23 $this->_addFunc("phonecountry", array( "name" => "FreeB.FBBillingService.PhoneCountry",
24 "sig" => array(XMLRPCSTRING
,XMLRPCINT
),
26 $this->_addFunc("phoneextension", array( "name" => "FreeB.FBBillingService.PhoneExtension",
27 "sig" => array(XMLRPCSTRING
,XMLRPCINT
),
29 $this->_addFunc("phonearea", array( "name" => "FreeB.FBBillingService.PhoneArea",
30 "sig" => array(XMLRPCSTRING
,XMLRPCINT
),
32 $this->_addFunc("phonenumber", array( "name" => "FreeB.FBBillingService.PhoneNumber",
33 "sig" => array(XMLRPCSTRING
,XMLRPCINT
),
35 $this->_addFunc("etin", array( "name" => "FreeB.FBBillingService.ETIN",
36 "sig" => array(XMLRPCSTRING
,XMLRPCINT
),
38 $this->_addFunc("tin", array( "name" => "FreeB.FBBillingService.TIN",
39 "sig" => array(XMLRPCSTRING
,XMLRPCINT
),
48 $obj= $m->getparam(0);
49 $key = $obj->getval();
51 $sql = "SELECT * FROM facility where billing_location = '1'";
53 $db = $GLOBALS['adodb']['db'];
54 $results = $db->Execute($sql);
57 $err = $db->ErrorMsg();
61 $retval = $results->fields
['name'];
65 // if we generated an error, create an error return response
67 return $this->_handleError($err);
70 // otherwise, we create the right response
71 // with the state name
72 return new xmlrpcresp(new xmlrpcval($retval));
76 function streetaddress($m) {
80 $obj= $m->getparam(0);
81 $key = $obj->getval();
83 $sql = "SELECT * FROM facility where billing_location = '1'";
85 $db = $GLOBALS['adodb']['db'];
86 $results = $db->Execute($sql);
89 $err = $db->ErrorMsg();
93 $retval = $results->fields
['street'];
97 // if we generated an error, create an error return response
99 return $this->_handleError($err);
102 // otherwise, we create the right response
103 // with the state name
104 return new xmlrpcresp(new xmlrpcval($retval));
114 $obj= $m->getparam(0);
115 $key = $obj->getval();
117 $sql = "SELECT * FROM facility where billing_location = '1'";
119 $db = $GLOBALS['adodb']['db'];
120 $results = $db->Execute($sql);
123 $err = $db->ErrorMsg();
126 if (!$results->EOF
) {
127 $retval = $results->fields
['city'];
131 // if we generated an error, create an error return response
133 return $this->_handleError($err);
136 // otherwise, we create the right response
137 // with the state name
138 return new xmlrpcresp(new xmlrpcval($retval));
147 $obj= $m->getparam(0);
148 $key = $obj->getval();
150 $sql = "SELECT * FROM facility where billing_location = '1'";
152 $db = $GLOBALS['adodb']['db'];
153 $results = $db->Execute($sql);
156 $err = $db->ErrorMsg();
159 if (!$results->EOF
) {
160 $retval = $results->fields
['state'];
164 // if we generated an error, create an error return response
166 return $this->_handleError($err);
169 // otherwise, we create the right response
170 // with the state name
171 return new xmlrpcresp(new xmlrpcval($retval));
175 function zipcode($m) {
179 $obj= $m->getparam(0);
180 $key = $obj->getval();
182 $sql = "SELECT * FROM facility where billing_location = '1'";
184 $db = $GLOBALS['adodb']['db'];
185 $results = $db->Execute($sql);
188 $err = $db->ErrorMsg();
191 if (!$results->EOF
) {
192 $retval = $results->fields
['postal_code'];
196 // if we generated an error, create an error return response
198 return $this->_handleError($err);
201 // otherwise, we create the right response
202 // with the state name
203 return new xmlrpcresp(new xmlrpcval($retval));
207 function phonecountry($m) {
211 //unimplemented by OpenEMR
214 // if we generated an error, create an error return response
216 return $this->_handleError($err);
219 // otherwise, we create the right response
220 // with the state name
221 return new xmlrpcresp(new xmlrpcval($pkey));
225 function phoneextension($m) {
229 //unimplemented by OpenEMR
232 // if we generated an error, create an error return response
234 return $this->_handleError($err);
237 // otherwise, we create the right response
238 // with the state name
239 return new xmlrpcresp(new xmlrpcval($pkey));
243 function phonearea($m) {
247 $sql = "SELECT * FROM facility where billing_location = '1'";
249 $db = $GLOBALS['adodb']['db'];
250 $results = $db->Execute($sql);
253 $err = $db->ErrorMsg();
256 if (!$results->EOF
) {
257 $retval = $results->fields
['phone'];
261 $phone_parts = array();
262 // preg_match("/^\((.*?)\)\s(.*?)\-(.*?)$/",$retval,$phone_parts);
263 preg_match("/(\d\d\d)\D*(\d\d\d)\D*(\d\d\d\d)/",$retval,$phone_parts);
264 $retval = $phone_parts[1];
266 // if we generated an error, create an error return response
268 return $this->_handleError($err);
271 // otherwise, we create the right response
272 // with the state name
273 return new xmlrpcresp(new xmlrpcval($retval));
277 function phonenumber($m) {
281 $obj= $m->getparam(0);
282 $key = $obj->getval();
284 $sql = "SELECT * FROM facility where billing_location = '1'";
286 $db = $GLOBALS['adodb']['db'];
287 $results = $db->Execute($sql);
290 $err = $db->ErrorMsg();
293 if (!$results->EOF
) {
294 $retval = $results->fields
['phone'];
298 $phone_parts = array();
299 // preg_match("/^\((.*?)\)\s(.*?)\-(.*?)$/",$retval,$phone_parts);
300 preg_match("/(\d\d\d)\D*(\d\d\d)\D*(\d\d\d\d)/",$retval,$phone_parts);
301 $retval = $phone_parts[2] . "-" . $phone_parts[3];
303 // if we generated an error, create an error return response
305 return $this->_handleError($err);
308 // otherwise, we create the right response
309 // with the state name
310 return new xmlrpcresp(new xmlrpcval($retval));
318 $obj= $m->getparam(0);
319 $key = $obj->getval();
321 $sql = "SELECT * FROM facility where billing_location = 1";
323 $db = $GLOBALS['adodb']['db'];
324 $results = $db->Execute($sql);
328 $err = $db->ErrorMsg();
331 if (!$results->EOF
) {
332 $retval = $results->fields
['federal_ein'];
337 // if we generated an error, create an error return response
339 return $this->_handleError($err);
342 // otherwise, we create the right response
343 // with the state name
344 return new xmlrpcresp(new xmlrpcval($retval));
352 $obj= $m->getparam(0);
353 $key = $obj->getval();
355 $sql = "SELECT * FROM facility where billing_location = 1";
357 $db = $GLOBALS['adodb']['db'];
358 $results = $db->Execute($sql);
362 $err = $db->ErrorMsg();
365 if (!$results->EOF
) {
366 $retval = $results->fields
['federal_ein'];
371 // if we generated an error, create an error return response
373 return $this->_handleError($err);
376 // otherwise, we create the right response
377 // with the state name
378 return new xmlrpcresp(new xmlrpcval($retval));
384 //'FreeB.FBBillingService.Name' => \&FreeB_FBBillingService_Name,
385 //'FreeB.FBBillingService.StreetAddress' => \&FreeB_FBBillingService_StreetAddress,
386 //'FreeB.FBBillingService.City' => \&FreeB_FBBillingService_City,
387 //'FreeB.FBBillingService.State' => \&FreeB_FBBillingService_State,
388 //'FreeB.FBBillingService.Zipcode' => \&FreeB_FBBillingService_Zipcode,
389 //'FreeB.FBBillingService.PhoneCountry' => \&FreeB_FBBillingService_PhoneCountry,
390 //'FreeB.FBBillingService.PhoneExtension' => \&FreeB_FBBillingService_PhoneExtension,
391 //'FreeB.FBBillingService.PhoneArea' => \&FreeB_FBBillingService_PhoneArea,
392 //'FreeB.FBBillingService.PhoneNumber' => \&FreeB_FBBillingService_PhoneNumber,
393 //'FreeB.FBBillingService.ETIN' => \&FreeB_FBBillingService_ETIN,
394 //'FreeB.FBBillingService.TIN' => \&FreeB_FBBillingService_TIN,