Skip to content

Commit 037de9e

Browse files
committed
Added 'Print Barcode Label' Option on Add VL Request Zambia form
1 parent 9345126 commit 037de9e

12 files changed

+135
-36
lines changed

alter.sql

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -964,6 +964,6 @@ INSERT INTO `r_sample_status` (`status_id`, `status_name`) VALUES (NULL, 'Sent t
964964
--saravanan 11-apr-2017
965965
INSERT INTO `global_config` (`display_name`, `name`, `value`) VALUES ('Barcode Printing', 'bar_code_printing', 'off');
966966
--saravanan 12-apr-2017
967-
INSERT INTO `form_details` (`vlsm_country_id`, `form_name`) VALUES (6, 'WHO FORM')
968-
ALTER TABLE `vl_request_form` ADD `patient_receiving_theraphy` VARCHAR(255) NULL DEFAULT NULL AFTER `patient_art_date`, ADD `patient_drugs_transmission` VARCHAR(255) NULL DEFAULT NULL AFTER `patient_receiving_theraphy`, ADD `patient_tb` VARCHAR(255) NULL DEFAULT NULL AFTER `patient_drugs_transmission`, ADD `patient_tb_yes` VARCHAR(255) NULL DEFAULT NULL AFTER `patient_tb`;
967+
INSERT INTO `form_details` (`vlsm_country_id`, `form_name`) VALUES (6, 'WHO FORM');
968+
ALTER TABLE `vl_request_form` ADD `patient_receiving_therapy` VARCHAR(255) NULL DEFAULT NULL AFTER `patient_art_date`, ADD `patient_drugs_transmission` VARCHAR(255) NULL DEFAULT NULL AFTER `patient_receiving_therapy`, ADD `patient_tb` VARCHAR(255) NULL DEFAULT NULL AFTER `patient_drugs_transmission`, ADD `patient_tb_yes` VARCHAR(255) NULL DEFAULT NULL AFTER `patient_tb`;
969969
ALTER TABLE `vl_request_form` ADD `test_requested_on` DATE NULL DEFAULT NULL AFTER `request_clinician_name`;

assets/js/dymo-print.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
1-
1+
function urldecode(str) { if (typeof str != "string") { return str; } return decodeURIComponent(str.replace(/\+/g, ' ')); }
22

33
function printBarcodeLabel(barcode,facility){
44

55

66
$.blockUI();
77
dymo.label.framework.trace = 1; //true
8+
facility = urldecode(urldecode);
89

910

1011
try{

assets/js/zebra-print.js

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@ var format_start = "^XA^FO100,100^BY3^B3N,N,100,Y,N^FD123ABC^FS^XZ";
66
var format_end = "^FS^XZ";
77
var default_mode = true;
88

9+
function urldecode(str) { if (typeof str != "string") { return str; } return decodeURIComponent(str.replace(/\+/g, ' ')); }
10+
911
function setup_web_print()
1012
{
1113
$('#printer_select').on('change', onPrinterSelected);
@@ -78,9 +80,10 @@ function showBrowserPrintNotFound()
7880
showErrorMessage("An error occured while attempting to connect to your Zebra Printer. You may not have Zebra Browser Print installed, or it may not be running. Install Zebra Browser Print, or start the Zebra Browser Print Service, and try again.");
7981

8082
};
81-
function printBarcode(bcode)
83+
function printBarcodeLabel(bcode,facility)
8284
{
8385
showLoading("Printing...");
86+
facility = urldecode(urldecode);
8487
checkPrinterStatus( function (text){
8588
if (text == "Ready to Print")
8689
{
@@ -206,3 +209,6 @@ function trySetupAgain()
206209
}
207210

208211

212+
$(document).ready(function() {
213+
setup_web_print();
214+
});

header.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,10 @@
1818
{
1919
if($global['instance_type']=='Clinic/Lab'){
2020
$hideResult = "display:none;";
21-
}else if($global['instance_type']=='Viral Load Lab'){
22-
$hideRequest = "display:none;";
2321
}
22+
//else if($global['instance_type']=='Viral Load Lab'){
23+
// $hideRequest = "display:none;";
24+
//}
2425
}
2526
if(!isset($_SESSION['userId'])){
2627
header("location:../login.php");

vl-print/updateVlTestResultWho.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -261,10 +261,10 @@
261261
<tr>
262262
<td colspan="3"><label for="therapy">Is the Patient receiving second-line theraphy? </label>
263263
<label class="radio-inline">
264-
<input type="radio" class="" id="theraphyYes" name="theraphy" value="yes" <?php echo($vlQueryInfo[0]['patient_receiving_theraphy'] == 'yes' )?"checked='checked'":""; ?> title="Is the Patient receiving second-line theraphy? " <?php echo $disable;?>> Yes
264+
<input type="radio" class="" id="theraphyYes" name="theraphy" value="yes" <?php echo($vlQueryInfo[0]['patient_receiving_therapy'] == 'yes' )?"checked='checked'":""; ?> title="Is the Patient receiving second-line theraphy? " <?php echo $disable;?>> Yes
265265
</label>
266266
<label class="radio-inline">
267-
<input type="radio" class=" " id="theraphyNo" name="theraphy" value="no"<?php echo($vlQueryInfo[0]['patient_receiving_theraphy'] == 'no' )?"checked='checked'":""; ?> title="Is the Patient receiving second-line theraphy?" <?php echo $disable;?>> No
267+
<input type="radio" class=" " id="theraphyNo" name="theraphy" value="no"<?php echo($vlQueryInfo[0]['patient_receiving_therapy'] == 'no' )?"checked='checked'":""; ?> title="Is the Patient receiving second-line theraphy?" <?php echo $disable;?>> No
268268
</label>
269269
</td>
270270
<td colspan="3" class=""><label for="breastfeeding">Is the Patient Pregnant or Breastfeeding?</label>

vl-request/addVlRequestHelperWho.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@
9292
'last_vl_result_failure_ac'=>(isset($_POST['repeatTestingVlValue']) && $_POST['repeatTestingVlValue']!='' ? $_POST['repeatTestingVlValue'] : NULL),
9393
'last_vl_date_failure'=>(isset($_POST['suspendTreatmentLastVLDate']) && $_POST['suspendTreatmentLastVLDate']!='' ? $general->dateFormat($_POST['suspendTreatmentLastVLDate']) : NULL),
9494
'last_vl_result_failure'=>(isset($_POST['suspendTreatmentVlValue']) && $_POST['suspendTreatmentVlValue']!='' ? $_POST['suspendTreatmentVlValue'] : NULL),
95-
'patient_receiving_theraphy'=>(isset($_POST['theraphy']) && $_POST['theraphy']!='' ? $_POST['theraphy'] : NULL),
95+
'patient_receiving_therapy'=>(isset($_POST['theraphy']) && $_POST['theraphy']!='' ? $_POST['theraphy'] : NULL),
9696
'patient_drugs_transmission'=>(isset($_POST['drugTransmission']) && $_POST['drugTransmission']!='' ? $_POST['drugTransmission'] : NULL),
9797
'patient_tb'=>(isset($_POST['patientTB']) && $_POST['patientTB']!='' ? $_POST['patientTB'] : NULL),
9898
'patient_tb_yes'=>(isset($_POST['patientTBActive']) && $_POST['patientTBActive']!='' ? $_POST['patientTBActive'] : NULL),

vl-request/addVlRequestHelperZam.php

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@
9797
'sample_code_format'=>(isset($_POST['sampleCodeFormat']) && $_POST['sampleCodeFormat']!='' ? $_POST['sampleCodeFormat'] : NULL),
9898
'sample_code_key'=>(isset($_POST['sampleCodeKey']) && $_POST['sampleCodeKey']!='' ? $_POST['sampleCodeKey'] : NULL),
9999
'facility_id'=>(isset($_POST['clinicName']) && $_POST['clinicName']!='' ? $_POST['clinicName'] : NULL),
100-
'request_clinician_name'=>(isset($_POST['clinicianName']) && $_POST['clinicianName']!='' ? $_POST['clinicianName'] : NULL),
100+
'lab_contact_person'=>(isset($_POST['clinicianName']) && $_POST['clinicianName']!='' ? $_POST['clinicianName'] : NULL),
101101
'sample_collection_date'=>$_POST['sampleCollectionDate'],
102102
'patient_first_name'=>(isset($_POST['patientFname']) && $_POST['patientFname']!='' ? $_POST['patientFname'] : NULL),
103103
'patient_last_name'=>(isset($_POST['surName']) && $_POST['surName']!='' ? $_POST['surName'] : NULL),
@@ -135,7 +135,7 @@
135135
'last_modified_datetime'=>$general->getDateTime(),
136136
'manual_result_entry'=>'yes'
137137
);
138-
//echo "<pre>";var_dump($vldata);die;
138+
//echo "<pre>";var_dump($vldata);die;
139139
$id=$db->insert($tableName,$vldata);
140140
if($id>0){
141141
$_SESSION['alertMsg']="VL request added successfully";
@@ -150,10 +150,22 @@
150150
'date_time'=>$general->getDateTime()
151151
);
152152
$db->insert($tableName1,$data);
153+
154+
155+
$barcode = "";
156+
if(isset($_POST['printBarCode']) && $_POST['printBarCode'] =='on'){
157+
$s = $_POST['sampleCode'];
158+
$facQuery="SELECT * FROM facility_details where facility_id=".$_POST['clinicName'];
159+
$facResult = $db->rawQuery($facQuery);
160+
$f = ucwords($facResult[0]['facility_name'])." | ".$_POST['sampleCollectionDate'];
161+
$barcode = "?barcode=true&s=$s&f=$f";
162+
}
163+
164+
153165
if(isset($_POST['saveNext']) && $_POST['saveNext']=='next'){
154-
header("location:addVlRequest.php");
166+
header("location:addVlRequest.php".$barcode);
155167
}else{
156-
header("location:vlRequest.php");
168+
header("location:vlRequest.php".$barcode);
157169
}
158170
}else{
159171
$_SESSION['alertMsg']="Please try again later";

vl-request/addVlRequestZam.php

Lines changed: 95 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,28 @@
11
<?php
22
ob_start();
33
include('../General.php');
4+
45
$general=new Deforay_Commons_General();
56
//global config
67
$cSampleQuery="SELECT * FROM global_config";
78
$cSampleResult=$db->query($cSampleQuery);
8-
$arr = array();
9+
$gconfig = array();
910
// now we create an associative array so that we can easily create view variables
1011
for ($i = 0; $i < sizeof($cSampleResult); $i++) {
11-
$arr[$cSampleResult[$i]['name']] = $cSampleResult[$i]['value'];
12+
$gconfig[$cSampleResult[$i]['name']] = $cSampleResult[$i]['value'];
1213
}
13-
if($arr['sample_code']=='auto' || $arr['sample_code']=='alphanumeric'){
14+
if($gconfig['sample_code']=='auto' || $gconfig['sample_code']=='alphanumeric'){
1415
$numeric = '';
1516
$maxLength = '';
16-
if($arr['max_length']!='' && $arr['sample_code']=='alphanumeric'){
17-
$maxLength = $arr['max_length'];
17+
if($gconfig['max_length']!='' && $gconfig['sample_code']=='alphanumeric'){
18+
$maxLength = $gconfig['max_length'];
1819
$maxLength = "maxlength=".$maxLength;
1920
}
2021
}else{
2122
$numeric = 'checkNum';
2223
$maxLength = '';
23-
if($arr['max_length']!=''){
24-
$maxLength = $arr['max_length'];
24+
if($gconfig['max_length']!=''){
25+
$maxLength = $gconfig['max_length'];
2526
$maxLength = "maxlength=".$maxLength;
2627
}
2728
}
@@ -131,6 +132,23 @@
131132
<input type="text" class="form-control sampleCode isRequired <?php echo $numeric;?>" id="sampleCode" name="sampleCode" <?php echo $maxLength;?> placeholder="Enter Sample Code" title="Please enter sample code" style="width:100%;" onblur="checkNameValidation('vl_request_form','sample_code',this,null,'This sample code already exists.Try another number',null)" />
132133
</div>
133134
</div>
135+
136+
137+
<!-- BARCODESTUFF START -->
138+
<?php
139+
if(isset($global['bar_code_printing']) && $global['bar_code_printing'] != "off"){
140+
?>
141+
<div class="col-xs-3 col-md-3 pull-right">
142+
<div class="form-group">
143+
<label for="sampleCode">Print Barcode Label<span class="mandatory">*</span> </label>
144+
<input type="checkbox" class="" id="printBarCode" name="printBarCode" checked/>
145+
</div>
146+
</div>
147+
<?php
148+
}
149+
?>
150+
<!-- BARCODESTUFF END -->
151+
134152
</div>
135153
<div class="row">
136154
<div class="col-xs-3 col-md-3">
@@ -331,9 +349,9 @@
331349
?>
332350
</select>
333351
</td>
334-
<td><?php if(isset($arr['sample_type']) && trim($arr['sample_type']) == "enabled"){ ?><label for="specimenType">Specimen type</label><?php } ?></td>
352+
<td><?php if(isset($gconfig['sample_type']) && trim($gconfig['sample_type']) == "enabled"){ ?><label for="specimenType">Specimen type</label><?php } ?></td>
335353
<td>
336-
<?php if(isset($arr['sample_type']) && trim($arr['sample_type']) == "enabled"){ ?>
354+
<?php if(isset($gconfig['sample_type']) && trim($gconfig['sample_type']) == "enabled"){ ?>
337355
<select name="specimenType" id="specimenType" class="form-control" title="Please choose Specimen type">
338356
<option value=""> -- Select -- </option>
339357
<?php
@@ -417,15 +435,45 @@
417435
<td colspan="3"><textarea class="form-control" name="labComments" id="labComments" title="Enter lab comments" style="width:100%"></textarea></td>
418436
</tr>
419437
</table>
438+
439+
440+
420441
</div>
421442
</div>
422443
</div>
423444
<!-- /.box-body -->
424445
<div class="box-footer">
446+
447+
448+
<!-- BARCODESTUFF START -->
449+
<?php
450+
if(isset($global['bar_code_printing']) && $global['bar_code_printing'] == 'zebra-printer'){
451+
?>
452+
453+
<div id="printer_data_loading" style="display:none"><span id="loading_message">Loading Printer Details...</span><br/>
454+
<div class="progress" style="width:100%">
455+
<div class="progress-bar progress-bar-striped active" role="progressbar" aria-valuenow="100" aria-valuemin="0" aria-valuemax="100" style="width: 100%">
456+
</div>
457+
</div>
458+
</div> <!-- /printer_data_loading -->
459+
<div id="printer_details" style="display:none">
460+
<span id="selected_printer">No printer selected!</span>
461+
<button type="button" class="btn btn-success" onclick="changePrinter()">Change/Retry</button>
462+
</div><br /> <!-- /printer_details -->
463+
<div id="printer_select" style="display:none">
464+
Zebra Printer Options<br />
465+
Printer: <select id="printers"></select>
466+
</div> <!-- /printer_select -->
467+
468+
<?php
469+
}
470+
?>
471+
<!-- BARCODESTUFF END -->
472+
425473
<a class="btn btn-primary" href="javascript:void(0);" onclick="validateNow();return false;">Save</a>
426474
<input type="hidden" name="saveNext" id="saveNext"/>
427475
<input type="hidden" name="formId" id="formId" value="4"/>
428-
<?php if($arr['sample_code']=='auto'){ ?>
476+
<?php if($gconfig['sample_code']=='auto'){ ?>
429477
<input type="hidden" name="sampleCodeFormat" id="sampleCodeFormat" value="<?php echo $sFormat;?>"/>
430478
<input type="hidden" name="sampleCodeKey" id="sampleCodeKey" value="<?php echo $sKey;?>"/>
431479
<?php } ?>
@@ -444,12 +492,43 @@
444492
<!-- /.content -->
445493
</div>
446494

495+
496+
<!-- BARCODESTUFF START -->
497+
498+
<?php
499+
if(isset($global['bar_code_printing']) && $global['bar_code_printing'] != "off"){
500+
if($global['bar_code_printing'] == 'dymo-labelwriter-450'){
501+
?>
502+
<script src="../assets/js/DYMO.Label.Framework.2.0.2.js"></script>
503+
<script src="../assets/js/dymo-print.js"></script>
504+
<?php
505+
}else if($global['bar_code_printing'] == 'zebra-printer'){
506+
?>
507+
<script src="../assets/js/BrowserPrint-1.0.4.min.js"></script>
508+
<script src="../assets/js/zebra-print.js"></script>
509+
<?php
510+
}
511+
}
512+
?>
513+
514+
<!-- BARCODESTUFF END -->
515+
447516
<script type="text/javascript">
448517

449518
provinceName = true;
450519
facilityName = true;
451520
machineName = true;
452-
$(document).ready(function() {
521+
$(document).ready(function() {
522+
523+
// BARCODESTUFF START
524+
525+
<?php
526+
if(isset($_GET['barcode']) && $_GET['barcode'] == 'true'){
527+
echo "printBarcodeLabel('".$_GET['s']."','".$_GET['f']."');";
528+
}
529+
?>
530+
// BARCODESTUFF END
531+
453532
$('.date').datepicker({
454533
changeMonth: true,
455534
changeYear: true,
@@ -479,9 +558,9 @@
479558
});
480559
});
481560
function validateNow(){
482-
var format = '<?php echo $arr['sample_code'];?>';
561+
var format = '<?php echo $gconfig['sample_code'];?>';
483562
var sCodeLentgh = $("#sampleCode").val();
484-
var minLength = '<?php echo $arr['min_length'];?>';
563+
var minLength = '<?php echo $gconfig['min_length'];?>';
485564
if((format == 'alphanumeric' || format =='numeric') && sCodeLentgh.length < minLength && sCodeLentgh!=''){
486565
alert("Sample code length atleast "+minLength+" characters");
487566
return false;
@@ -504,9 +583,9 @@ function validateNow(){
504583
}
505584
}
506585
function validateSaveNow(){
507-
var format = '<?php echo $arr['sample_code'];?>';
586+
var format = '<?php echo $gconfig['sample_code'];?>';
508587
var sCodeLentgh = $("#sampleCode").val();
509-
var minLength = '<?php echo $arr['min_length'];?>';
588+
var minLength = '<?php echo $gconfig['min_length'];?>';
510589
if((format == 'alphanumeric' || format =='numeric') && sCodeLentgh.length < minLength && sCodeLentgh!=''){
511590
alert("Sample code length atleast "+minLength+" characters");
512591
return false;
@@ -548,7 +627,7 @@ function(data){
548627
});
549628
}
550629
<?php
551-
if($arr['sample_code']=='auto'){
630+
if($gconfig['sample_code']=='auto'){
552631
?>
553632
pNameVal = pName.split("##");
554633
sCode = '<?php echo date('Ymd');?>';

vl-request/editVlRequestHelperWho.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@
8484
'last_vl_result_failure_ac'=>(isset($_POST['repeatTestingVlValue']) && $_POST['repeatTestingVlValue']!='' ? $_POST['repeatTestingVlValue'] : NULL),
8585
'last_vl_date_failure'=>(isset($_POST['suspendTreatmentLastVLDate']) && $_POST['suspendTreatmentLastVLDate']!='' ? $general->dateFormat($_POST['suspendTreatmentLastVLDate']) : NULL),
8686
'last_vl_result_failure'=>(isset($_POST['suspendTreatmentVlValue']) && $_POST['suspendTreatmentVlValue']!='' ? $_POST['suspendTreatmentVlValue'] : NULL),
87-
'patient_receiving_theraphy'=>(isset($_POST['theraphy']) && $_POST['theraphy']!='' ? $_POST['theraphy'] : NULL),
87+
'patient_receiving_therapy'=>(isset($_POST['theraphy']) && $_POST['theraphy']!='' ? $_POST['theraphy'] : NULL),
8888
'patient_drugs_transmission'=>(isset($_POST['drugTransmission']) && $_POST['drugTransmission']!='' ? $_POST['drugTransmission'] : NULL),
8989
'patient_tb'=>(isset($_POST['patientTB']) && $_POST['patientTB']!='' ? $_POST['patientTB'] : NULL),
9090
'patient_tb_yes'=>(isset($_POST['patientTBActive']) && $_POST['patientTBActive']!='' ? $_POST['patientTBActive'] : NULL),

vl-request/editVlRequestWho.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -259,10 +259,10 @@
259259
<tr>
260260
<td colspan="3"><label for="therapy">Is the Patient receiving second-line theraphy? </label>
261261
<label class="radio-inline">
262-
<input type="radio" class="" id="theraphyYes" name="theraphy" value="yes" <?php echo($vlQueryInfo[0]['patient_receiving_theraphy'] == 'yes' )?"checked='checked'":""; ?> title="Is the Patient receiving second-line theraphy? "> Yes
262+
<input type="radio" class="" id="theraphyYes" name="theraphy" value="yes" <?php echo($vlQueryInfo[0]['patient_receiving_therapy'] == 'yes' )?"checked='checked'":""; ?> title="Is the Patient receiving second-line theraphy? "> Yes
263263
</label>
264264
<label class="radio-inline">
265-
<input type="radio" class=" " id="theraphyNo" name="theraphy" value="no"<?php echo($vlQueryInfo[0]['patient_receiving_theraphy'] == 'no' )?"checked='checked'":""; ?> title="Is the Patient receiving second-line theraphy?"> No
265+
<input type="radio" class=" " id="theraphyNo" name="theraphy" value="no"<?php echo($vlQueryInfo[0]['patient_receiving_therapy'] == 'no' )?"checked='checked'":""; ?> title="Is the Patient receiving second-line theraphy?"> No
266266
</label>
267267
</td>
268268
<td colspan="3" class=""><label for="breastfeeding">Is the Patient Pregnant or Breastfeeding?</label>

0 commit comments

Comments
 (0)