PageRenderTime 57ms CodeModel.GetById 30ms RepoModel.GetById 0ms app.codeStats 0ms

/include/imgcreator/inc_label_single_large.php

https://github.com/timschofield/2.8
PHP | 125 lines | 67 code | 15 blank | 43 comment | 10 complexity | f8115eca17b6941a36df8d8d1e0403b6 MD5 | raw file
Possible License(s): LGPL-2.1, BSD-3-Clause, GPL-2.0
  1. <?php
  2. /* Load the barcode img if it exists */
  3. if(file_exists(CARE_BASE .'cache/barcodes/pn_'.$fen.'.png'))
  4. {
  5. $bc = ImageCreateFrompng(CARE_BASE .'cache/barcodes/pn_'.$fen.'.png');
  6. }elseif(file_exists(CARE_BASE .'cache/barcodes/en_'.$fen.'.png')){
  7. $bc = ImageCreateFrompng(CARE_BASE .'cache/barcodes/en_'.$fen.'.png');
  8. }
  9. /* Dimensions of the patient's label */
  10. $label_w=282;
  11. $label_h=178;
  12. // -- create label
  13. $label=ImageCreate($label_w,$label_h);
  14. $ewhite = ImageColorAllocate ($label, 255,255,255); //white bkgrnd
  15. $elightgreen= ImageColorAllocate ($label, 205, 225, 236);
  16. $eblue=ImageColorAllocate($label, 0, 127, 255);
  17. $eblack = ImageColorAllocate ($label, 0, 0, 0);
  18. $egray= ImageColorAllocate($label,127,127,127);
  19. //ImageFillToBorder($label,2,2,$egray,$ewhite);
  20. ImageRectangle($label,0,0,281,177,$egray);
  21. # Write the data on the label
  22. # Location info, admission class, blood group
  23. $locstr=strtoupper($location['dept_id']).' '.strtoupper($location['ward_id']).' '.$location['roomprefix'];
  24. if($location['room_nr']) $locstr.='-'.$location['room_nr'];
  25. if($location['bed_nr']) $locstr.=' '.strtoupper(chr($location['bed_nr']+96));
  26. $locstr.=' '.$admit_type.' '.$LDInsShortID[$result['insurance_class_nr']];
  27. //$verdana='VERDANA.TTF';
  28. //if(function_exists(ImageTTFText)&&file_exists($font_path.$arial)&&file_exists($font_path.$verdana)){
  29. if($ttf_ok){
  30. $tmargin=2;
  31. $lmargin=6;
  32. # Full encounter nr
  33. ImageTTFText($label,12,0,$lmargin,$tmargin+14,$eblack,$arial,$fen);
  34. # Encounter admission date
  35. ImageTTFText($label,11,0,$lmargin,$tmargin+30,$eblack,$arial,$result['pdate']);
  36. # Family name, first name
  37. ImageTTFText($label,16,0,$lmargin,$tmargin+56,$eblack,$arial,$result['name_last'].', '.$result['name_first']);
  38. # Date of birth
  39. ImageTTFText($label,11,0,$lmargin,$tmargin+74,$eblack,$arial,$result['date_birth']);
  40. # Address street nr, street name
  41. ImageTTFText($label,11,0,$lmargin,$tmargin+93,$eblack,$arial,ucfirst($result['addr_str']).' '.$result['addr_str_nr']);
  42. # Address, zip, city/town name
  43. ImageTTFText($label,11,0,$lmargin,$tmargin+108,$eblack,$arial,ucfirst($result['addr_zip']).' '.$result['citytown_name']);
  44. # Sex
  45. ImageTTFText($label,14,0,$lmargin,$tmargin+130,$eblack,$arial,strtoupper($result['sex']));
  46. # Family name, repeat print
  47. ImageTTFText($label,14,0,$lmargin+30,$tmargin+130,$eblack,$arial,$result['name_last']);
  48. # Insurance co name
  49. ImageTTFText($label,14,0,$lmargin,$tmargin+150,$eblack,$arial,$ins_obj->getFirmName($result['insurance_firm_id']));
  50. # Location
  51. ImageTTFText($label,9,0,$lmargin,$tmargin+170,$eblack,$arial,$locstr);
  52. #Blood group
  53. if(stristr('AB',$result['blood_group'])){
  54. ImageTTFText($label,24,0,$lmargin+240,$tmargin+127,$eblack,$arial,$result['blood_group']);
  55. }else{
  56. ImageTTFText($label,24,0,$lmargin+245,$tmargin+127,$eblack,$arial,$result['blood_group']);
  57. }
  58. }else{ # Use system fonts
  59. # Full encounter nr
  60. ImageString($label,4,2,2,$fen,$eblack);
  61. # Encounter admission date
  62. ImageString($label,2,2,18,$result['pdate'],$eblack);
  63. # Family name, first name
  64. ImageString($label,5,10,40,$result['name_last'].', '.$result['name_first'],$eblack);
  65. # Date of birth
  66. ImageString($label,3,10,55,$result['date_birth'],$eblack);
  67. //for($a=0,$l=75;$a<sizeof($addr);$a++,$l+=15) ImageString($label,4,10,$l,$addr[$a],$eblack);
  68. # Address street nr, street name
  69. ImageString($label,4,10,75,strtoupper($result['addr_str']).' '.$result['addr_str_nr'],$eblack);
  70. # Address, zip, city/town name
  71. ImageString($label,4,10,90,strtoupper($result['addr_zip']).' '.$result['citytown_name'],$eblack);
  72. # Sex
  73. ImageString($label,5,10,125,strtoupper($result['sex']),$eblack);
  74. # Family name, repeat print
  75. ImageString($label,5,30,125,$result['name_last'],$eblack);
  76. # Insurance co name
  77. ImageString($label,4,10,140,$ins_obj->getFirmName($result['insurance_firm_id']),$eblack);
  78. # Location
  79. ImageString($label,3,10,160,$locstr,$eblack);
  80. #Blood group
  81. if(stristr('AB',$result['blood_group'])){
  82. ImageString($label,5,257,125,$result['blood_group'],$eblack);
  83. }else{
  84. ImageString($label,5,265,125,$result['blood_group'],$eblack);
  85. }
  86. }
  87. // place the barcode img
  88. if($bc) ImageCopy($label,$bc,110,4,9,9,170,37);
  89. if(!$child_img)
  90. {
  91. Imagepng($label);
  92. // *******************************************************************
  93. // * comment the following one line if you want to deactivate caching of
  94. // * the barcode label image
  95. // *******************************************************************
  96. /*
  97. // START
  98. Imagepng ($im,"../cache/barcodes/pn_".$pn."_bclabel_".$lang.".png");
  99. // END
  100. */
  101. // Do not edit the following lines
  102. ImageDestroy($label);
  103. }
  104. else
  105. {
  106. if(file_exists('gd_test_request_'.$subtarget.'.php')) include_once(CARE_BASE .'include/imgcreator/gd_test_request_'.$subtarget.'.php');
  107. else Imagepng($label);
  108. /* Imagepng($label);*/
  109. }
  110. ?>