1: <?php
2: use Azalea\Selenium\App\ApplicationTestCase;
3: use Azalea\Selenium\App\Customers;
4: use Azalea\Selenium\App\Patients;
5: use Azalea\Selenium\App\Users;
6:
7: class EncounterLedgerTest extends ApplicationTestCase
8: {
9: public function supportsCustomer($cus_id)
10: {
11:
12: return (Customers::isEhrCustomer($cus_id) || Customers::isPmCustomer($cus_id));
13: }
14:
15: 16: 17: 18: 19:
20: public function testProcedurePaymentForSelfPayPatient()
21: {
22: $app = $this->login(Users::FELIX_MILLER, Users::PASSWORD);
23:
24:
25: $encounterView = $app->patients->get(Patients::SELENIUM_SELF_PAY)
26: ->encounters
27: ->navigate()
28: ->addEncounter();
29:
30:
31:
32: $encounterView->setDateOfService(date("m/d/Y", time()))
33: ->select("enc_spl_id", "9")
34: ->select("enc_loc_id", "401")
35: ->select("enc_cfs_id", "173")
36: ->tab();
37:
38: $this->waitForAjax();
39:
40:
41:
42: $encounterView->procedures->fillQuickSubmit("99212", 1)
43: ->submitQuickSubmit();
44: $encounterView->procedures->grid->waitForRowCount(1);
45:
46: 47: 48: 49: 50: 51: 52: 53:
54: $this->spinWait(function () use ($encounterView) {
55: $encounterView->ledger->table->assertCanSee("Today");
56: $encounterView->ledger->table->assertCanSee("99212");
57: $encounterView->ledger->table->assertCanSee("$151.83");
58: $encounterView->ledger->table->assertCanSee("Next Payer: PATIENT");
59: $encounterView->ledger->table->filter(
60: $encounterView->ledger->table->selectors->totalEncounterCharges
61: )->assertCanSee("$151.83");
62: $encounterView->ledger->table->filter(
63: $encounterView->ledger->table->selectors->totalEncounterBalance
64: )->assertCanSee("$151.83");
65: return true;
66: });
67:
68:
69: $encounterView->procedures->removeAll();
70:
71: 72: 73: 74:
75: $this->spinWait(function () use ($encounterView) {
76: $encounterView->ledger->table->assertCanNotSee("Today");
77: $encounterView->ledger->table->assertCanNotSee("99212");
78: $encounterView->ledger->table->assertCanNotSee("$151.83");
79: $encounterView->ledger->table->assertCanNotSee("Next Payer: PATIENT");
80: return true;
81: });
82:
83:
84: $encounterView->cancel();
85:
86: $this->assertNoErrorPopups();
87: }
88:
89: 90: 91: 92: 93:
94: public function testProcedurePaymentForInsurancePatient()
95: {
96: $app = $this->login(Users::FELIX_MILLER, Users::PASSWORD);
97:
98:
99: $encounterView = $app->patients->get(Patients::SELENIUM_PRIMARY_INSURANCE)
100: ->encounters
101: ->navigate()
102: ->addEncounter();
103:
104:
105:
106: $encounterView->setDateOfService(date("m/d/Y", time()))
107: ->select("enc_spl_id", "9")
108: ->select("enc_loc_id", "401")
109: ->select("enc_cfs_id", "173")
110: ->tab();
111:
112: $this->waitForAjax();
113:
114:
115:
116: $encounterView->procedures->fillQuickSubmit("99212", 1)
117: ->submitQuickSubmit();
118: $encounterView->procedures->grid->waitForRowCount(1);
119:
120: 121: 122: 123: 124: 125: 126: 127:
128: $this->spinWait(function () use ($encounterView) {
129: $encounterView->ledger->table->assertCanSee("Today");
130: $encounterView->ledger->table->assertCanSee("99212");
131: $encounterView->ledger->table->assertCanSee("$148.56");
132: $encounterView->ledger->table->assertCanSee("Next Payer: PRIMARY INS.:1ST MEDICAL NETWORK");
133: $encounterView->ledger->table->filter(
134: $encounterView->ledger->table->selectors->totalEncounterCharges
135: )->assertCanSee("$148.56");
136: $encounterView->ledger->table->filter(
137: $encounterView->ledger->table->selectors->totalEncounterBalance
138: )->assertCanSee("$148.56");
139: return true;
140: });
141:
142:
143: $encounterView->procedures->removeAll();
144:
145: 146: 147: 148:
149: $this->spinWait(function () use ($encounterView) {
150: $encounterView->ledger->table->assertCanNotSee("Today");
151: $encounterView->ledger->table->assertCanNotSee("99212");
152: $encounterView->ledger->table->assertCanNotSee("$148.56");
153: $encounterView->ledger->table->assertCanNotSee("Next Payer: PRIMARY INS.:1ST MEDICAL NETWORK");
154: return true;
155: });
156:
157:
158: $encounterView->cancel();
159:
160: $this->assertNoErrorPopups();
161: }
162:
163: 164: 165: 166: 167:
168: public function testCashOverPaymentForSelfPayPatient()
169: {
170: $app = $this->login(Users::FELIX_MILLER, Users::PASSWORD);
171:
172:
173: $encounterView = $app->patients->get(Patients::SELENIUM_SELF_PAY)
174: ->encounters
175: ->navigate()
176: ->addEncounter();
177:
178:
179:
180: $encounterView->setDateOfService(date("m/d/Y", time()))
181: ->select("enc_spl_id", "9")
182: ->select("enc_loc_id", "401")
183: ->select("enc_cfs_id", "173")
184: ->tab();
185:
186: $this->waitForAjax();
187:
188:
189:
190: $encounterView->procedures->fillQuickSubmit("99212", 1)
191: ->submitQuickSubmit();
192: $encounterView->procedures->grid->waitForRowCount(1);
193:
194: $ledger = $encounterView->ledger;
195:
196:
197: $ledger->addPaymentAdjustment();
198:
199:
200: $encounterView->popups->addPayment->press("Today");
201:
202:
203: $encounterView->popups->addPayment->select("epay_bil_id", "1");
204:
205:
206: $options = $encounterView->popups->addPayment->querySelectorAll('[name="led_apply_to_ecp_id"] > option');
207: $value = $options[1]->attribute("value");
208: $encounterView->popups->addPayment->select("led_apply_to_ecp_id", $value);
209:
210:
211: $encounterView->popups->addPayment->setInput("epay_amount", "300.00");
212:
213:
214: $app->popup->last()->press("Submit");
215:
216: $this->waitForAjax();
217:
218: 219: 220: 221: 222: 223: 224: 225:
226: $this->spinWait(function () use ($ledger) {
227: $payment = $ledger->table->filter(".payment");
228: $payment->assertCanSee("CASH PAYMENT -");
229: $payment->assertCanSee("PATIENT");
230: $payment->assertCanSee("$(300.00)");
231: $payment->assertCanSee("99212");
232:
233: $subtotal = $ledger->table->filter(".subtotal");
234: $subtotal->assertCanSee("$(148.17)");
235: $subtotal->assertCanSee("Next Payer: CREDIT");
236:
237: $ledger->table->filter(
238: $ledger->table->selectors->totalEncounterCharges
239: )->assertCanSee("$151.83");
240: $ledger->table->filter(
241: $ledger->table->selectors->totalEncounterBalance
242: )->assertCanSee("$(148.17)");
243: return true;
244: });
245:
246: $this->assertNoErrorPopups();
247: }
248:
249: 250: 251: 252: 253:
254: public function testCashUnderPaymentForSelfPayPatient()
255: {
256: $app = $this->login(Users::FELIX_MILLER, Users::PASSWORD);
257:
258:
259: $encounterView = $app->patients->get(Patients::SELENIUM_SELF_PAY)
260: ->encounters
261: ->navigate()
262: ->addEncounter();
263:
264:
265:
266: $encounterView->setDateOfService(date("m/d/Y", time()))
267: ->select("enc_spl_id", "9")
268: ->select("enc_loc_id", "401")
269: ->select("enc_cfs_id", "173")
270: ->tab();
271:
272: $this->waitForAjax();
273:
274:
275:
276: $encounterView->procedures->fillQuickSubmit("99212", 1)
277: ->submitQuickSubmit();
278: $encounterView->procedures->grid->waitForRowCount(1);
279:
280: $ledger = $encounterView->ledger;
281:
282:
283: $ledger->addPaymentAdjustment();
284:
285:
286: $encounterView->popups->addPayment->press("Today");
287:
288:
289: $encounterView->popups->addPayment->select("epay_bil_id", "1");
290:
291:
292: $options = $encounterView->popups->addPayment->querySelectorAll('[name="led_apply_to_ecp_id"] > option');
293: $value = $options[1]->attribute("value");
294: $encounterView->popups->addPayment->select("led_apply_to_ecp_id", $value);
295:
296:
297: $encounterView->popups->addPayment->setInput("epay_amount", "50.00");
298:
299:
300: $app->popup->last()->press("Submit");
301:
302: $this->waitForAjax();
303:
304: 305: 306: 307: 308: 309: 310: 311:
312: $this->spinWait(function () use ($ledger) {
313: $payment = $ledger->table->filter(".payment");
314: $payment->assertCanSee("CASH PAYMENT -");
315: $payment->assertCanSee("PATIENT");
316: $payment->assertCanSee("$(50.00)");
317: $payment->assertCanSee("99212");
318:
319: $subtotal = $ledger->table->filter(".subtotal");
320: $subtotal->assertCanSee("$101.83");
321: $subtotal->assertCanSee("Next Payer: PATIENT");
322:
323: $ledger->table->filter(
324: $ledger->table->selectors->totalEncounterCharges
325: )->assertCanSee("$151.83");
326: $ledger->table->filter(
327: $ledger->table->selectors->totalEncounterBalance
328: )->assertCanSee("$101.83");
329: return true;
330: });
331:
332: $this->assertNoErrorPopups();
333: }
334:
335: 336: 337: 338: 339:
340: public function testCashExactPaymentForSelfPayPatient()
341: {
342: $app = $this->login(Users::FELIX_MILLER, Users::PASSWORD);
343:
344:
345: $encounterView = $app->patients->get(Patients::SELENIUM_SELF_PAY)
346: ->encounters
347: ->navigate()
348: ->addEncounter();
349:
350:
351:
352: $encounterView->setDateOfService(date("m/d/Y", time()))
353: ->select("enc_spl_id", "9")
354: ->select("enc_loc_id", "401")
355: ->select("enc_cfs_id", "173")
356: ->tab();
357:
358: $this->waitForAjax();
359:
360:
361:
362: $encounterView->procedures->fillQuickSubmit("99212", 1)
363: ->submitQuickSubmit();
364: $encounterView->procedures->grid->waitForRowCount(1);
365:
366: $ledger = $encounterView->ledger;
367:
368:
369: $ledger->addPaymentAdjustment();
370:
371:
372: $encounterView->popups->addPayment->press("Today");
373:
374:
375: $encounterView->popups->addPayment->select("epay_bil_id", "1");
376:
377:
378: $options = $encounterView->popups->addPayment->querySelectorAll('[name="led_apply_to_ecp_id"] > option');
379: $value = $options[1]->attribute("value");
380: $encounterView->popups->addPayment->select("led_apply_to_ecp_id", $value);
381:
382:
383: $encounterView->popups->addPayment->setInput("epay_amount", "151.83");
384:
385:
386: $app->popup->last()->press("Submit");
387:
388: $this->waitForAjax();
389:
390: 391: 392: 393: 394: 395: 396: 397:
398: $this->spinWait(function () use ($ledger) {
399: $payment = $ledger->table->filter(".payment");
400: $payment->assertCanSee("CASH PAYMENT -");
401: $payment->assertCanSee("PATIENT");
402: $payment->assertCanSee("$(151.83)");
403: $payment->assertCanSee("99212");
404:
405: $subtotal = $ledger->table->filter(".subtotal");
406: $subtotal->assertCanSee("$0.00");
407: $subtotal->assertCanSee("Next Payer: -");
408:
409: $ledger->table->filter(
410: $ledger->table->selectors->totalEncounterCharges
411: )->assertCanSee("$151.83");
412: $ledger->table->filter(
413: $ledger->table->selectors->totalEncounterBalance
414: )->assertCanSee("$0.00");
415: return true;
416: });
417:
418: $this->assertNoErrorPopups();
419: }
420:
421: 422: 423: 424: 425:
426: public function testCanRemovePatientPayment()
427: {
428: $app = $this->login(Users::FELIX_MILLER, Users::PASSWORD);
429:
430:
431: $encounterView = $app->patients->get(Patients::SELENIUM_SELF_PAY)
432: ->encounters
433: ->navigate()
434: ->addEncounter();
435:
436:
437:
438: $encounterView->setDateOfService(date("m/d/Y", time()))
439: ->select("enc_spl_id", "9")
440: ->select("enc_loc_id", "401")
441: ->select("enc_cfs_id", "173")
442: ->tab();
443:
444: $this->waitForAjax();
445:
446:
447:
448: $encounterView->procedures->fillQuickSubmit("99212", 1)
449: ->submitQuickSubmit();
450: $encounterView->procedures->grid->waitForRowCount(1);
451:
452: $ledger = $encounterView->ledger;
453:
454:
455: $ledger->addPaymentAdjustment();
456:
457:
458: $encounterView->popups->addPayment->press("Today");
459:
460:
461: $encounterView->popups->addPayment->select("epay_bil_id", "1");
462:
463:
464: $options = $encounterView->popups->addPayment->querySelectorAll('[name="led_apply_to_ecp_id"] > option');
465: $value = $options[1]->attribute("value");
466: $encounterView->popups->addPayment->select("led_apply_to_ecp_id", $value);
467:
468:
469: $encounterView->popups->addPayment->setInput("epay_amount", "151.83");
470:
471:
472: $app->popup->last()->press("Submit");
473:
474: $this->waitForAjax();
475:
476:
477: $ledger->table->filter(".payment")->click("Remove");
478:
479:
480: $app->popup->last()->setInput("void_reason", "Cancel payment.");
481:
482:
483: $app->popup->last()->press("Submit");
484:
485: 486: 487: 488: 489: 490: 491: 492:
493: $this->spinWait(function () use ($ledger) {
494: $ledger->table->assertCanNotSee("CASH PAYMENT -");
495: $ledger->table->assertCanNotSee("$(151.83)");
496:
497: $subtotal = $ledger->table->filter(".subtotal");
498: $subtotal->assertCanSee("$151.83");
499: $subtotal->assertCanSee("Next Payer: PATIENT");
500:
501: $ledger->table->filter(
502: $ledger->table->selectors->totalEncounterCharges
503: )->assertCanSee("$151.83");
504: $ledger->table->filter(
505: $ledger->table->selectors->totalEncounterBalance
506: )->assertCanSee("$151.83");
507: return true;
508: });
509:
510: $this->assertNoErrorPopups();
511: }
512: }
513:
514: ?>