-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathprint_report.php
executable file
·164 lines (135 loc) · 4.06 KB
/
print_report.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
<?php
session_start();
echo '<html>';
echo '<head>';
echo '</head>';
echo '<body>';
/*
echo '<pre>';
print_r($GLOBALS);
echo '</pre>';
*/
include 'common.php';
/////////// Report specific data////////////////
$lab_name='New Civil Hospital Surat Laboratory Services';
$section_name='Biochemistry Section';
$address_phone='2nd Floor, Near Blood Bank, NCH Surat(Guj) Ph: 2224445 Ext:317,366';
$nabl_symbol='nabl.jpg';
$blank_symbol='blank.jpg';
$nabl_cert_no='M-0450';
$blank_cert_no='';
if(!login_varify())
{
exit();
}
function search_form($filename)
{
$link=start_nchsls();
$sql='desc sample';
if(!$result=mysql_query($sql,$link)){echo mysql_error();}
$tr=1;
echo '<table border=1><form action=\''.$filename.'\' method=post>';
echo ' <tr>
<td title=\'1) Tickmark to include the field for search. 2) Use % as wildcard. e.g. [%esh = Mahesh,Jignesh] [Mahesh%=Mahesh,Maheshbhai, Maheshkumar]\'><input type=submit name=submit value=print></td>';
/*
echo '<td>Technician:</td><td>';
mk_select_from_table('technician','','');
echo '</td>';
*/
echo '<td>Authorized Signatory:</td><td>';
mk_select_from_table('authorized_signatory','','');
echo '</td>';
echo '</tr>';
while($ar=mysql_fetch_assoc($result))
{
if($tr%3==1){echo '<tr>';}
if($ar['Field']=='sample_id')
{
echo '<td><input type=checkbox checked name=\'chk_from_'.$ar['Field'].'\' ></td><td>from_'.$ar['Field'].'</td>';
echo '<td><input type=text name=\'from_'.$ar['Field'].'\' ></td>';
echo '<td><input type=checkbox name=\'chk_to_'.$ar['Field'].'\' ></td><td>to_'.$ar['Field'].'</td>';
echo '<td><input type=text name=\'to_'.$ar['Field'].'\' >';
$tr++;
}
else
{
echo '<td><input type=checkbox name=\'chk_'.$ar['Field'].'\' ></td><td>'.$ar['Field'].'</td><td>';
if(!mk_select_from_table($ar['Field'],'',''))
{
echo '<input type=text name=\''.$ar['Field'].'\' >';
}
}
echo '</td>';
if($tr%3==0){echo '</tr>';}
$tr++;
}
echo '</form></table>';
}
main_menu();
search_form('print_report.php');
echo '<h2 style="page-break-before: always;"></h2>';
$search_str='select sample_id from sample ';
$where=array();
if(isset($_POST['submit']))
{
foreach($_POST as $key=>$value)
{
if(substr($key,0,4)=='chk_' && $value=='on')
{
//echo substr($key,4).'='.$_POST[substr($key,4)].'<br>';
$where[substr($key,4)]=$_POST[substr($key,4)];
}
}
}
//print_r($where);
$sample_id_where='';
if(isset($where['from_sample_id']) && isset($where['to_sample_id']) )
{
$sample_id_where='sample_id between \''.$where['from_sample_id'].'\' and \''.$where['to_sample_id'].'\' ';
}
elseif(isset($where['from_sample_id']))
{
$sample_id_where=' sample_id=\''.$where['from_sample_id'].'\' ';
}
elseif(isset($where['to_sample_id']))
{
$sample_id_where=' sample_id=\''.$where['to_sample_id'].'\' ';
}
$other_wheree='';
foreach($where as $key=>$value)
{
if($key!='from_sample_id' && $key!='to_sample_id' )
{
$other_wheree=$other_wheree.' '.$key.' like \''.$value.'\' and';
}
}
$other_where=substr($other_wheree,0,-3);
if(strlen($sample_id_where)>0 && strlen($other_where)>0)
{
$search_str=$search_str.' where '.$sample_id_where.' and '.$other_where;
}
elseif(strlen($sample_id_where)>0 && strlen($other_where)==0)
{
$search_str=$search_str.' where '.$sample_id_where;
}
elseif(strlen($sample_id_where)==0 && strlen($other_where)>0)
{
$search_str=$search_str.' where '.$other_where;
}
if(isset($_POST['submit']) && substr($search_str,-7)!='sample ')
{
$link=start_nchsls();
if(!$search_result=mysql_query($search_str,$link)){echo mysql_error();}
while($ar=mysql_fetch_assoc($search_result))
{
autoverify($ar['sample_id'],'','no'); //no action
autoverify($ar['sample_id'],'autoverify_action.php','yes'); //action
print_sample($ar['sample_id'],$_SESSION['login'],$_POST['authorized_signatory']);
echo '<h2 style="page-break-before: always;"></h2>';
}
}
else
{
echo '<h1>No coditions are given for selecting records</h1>';
}
?>