-
Notifications
You must be signed in to change notification settings - Fork 0
/
elec_get_list_MM.php
152 lines (148 loc) · 4.53 KB
/
elec_get_list_MM.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
<?
include("inc/check_session.php");
include("inc/dbconnection.php");
include("inc/common_function_mt_elect.php");
if(isset($_REQUEST['value']))
{
$val=$_REQUEST['value'];
}
else
$val='';
$Department='';
$Machine='';
$Motor='';
$DateRange='';
if($val!='')
{
$val=explode(',',$val);
$department_id=$val[0];
$machine_id=$val[1];
$motor_id=$val[2];
$dfrom=getDateFormate($val[3]);
$dto=getDateFormate($val[4]);
$DateRange="(MM_date BETWEEN '".$dfrom."' and '".$dto."')";
if($department_id!='')
$Department="and department_id='".$department_id."'";
if($machine_id!='' && $machine_id!='0')
$Machine="and machine_id='".$machine_id."'";
if($motor_id!='' && $motor_id!='0')
$Motor="and motor_id='".$motor_id."'";
}
$sql="select * from elec_MM where
$DateRange
$Department
$Machine
$Motor
";
$result=mysql_query($sql) or die("Error in : ".$sql."<br>".mysql_errno()." : ".mysql_error());$sum=0;
?>
<div class="AddMore" style="padding-top:10px">
<form action="elec_print_list_MM.php" name="test" id="test" method="post" target="_blank">
<input type="hidden" name="value" id="value" value="<?=$_REQUEST['value'] ?>" />
<a href="#" onclick="test.submit();">Print </a>
</form>
</div>
<table align="center" width="100%" border="1" class="table1 text_1">
<tr>
<td class="gredBg" width="6%"><b>SNo.</b></td>
<td class="gredBg" width="8%"><b>Date</b></td>
<td class="gredBg" width="14%"><b>Department</b></td>
<td class="gredBg" width="12%"><b>Machine</b></td>
<td class="gredBg" width="18%"><b>Motor</b></td>
<td class="gredBg" width="34%"><b>Details</b></td>
<td class="gredBg" width="4%"><b>Edit</b></td>
<td class="gredBg" width="4%"><b>Delete</b></td>
</tr>
<?
if(mysql_num_rows($result)>0)
{
$sno=1;
while($row=mysql_fetch_array($result))
{
$sql_idate="select * from elec_MM where insert_date='".date('Y-m-d')."' and MM_id='".$row['MM_id']."'";
$res_idate=mysql_query($sql_idate);
$row_idate=mysql_fetch_array($res_idate);
$insert_date=$row_idate['insert_date'];
?>
<tr>
<td align="center"><?=$sno++?></td>
<td align="center"><?=getDateFormate($row['MM_date'])?></td>
<td align="left" style="padding-left:2px">
<?
$sqlD="select name from elec_department where department_id='".$row['department_id']."'";
$resD=mysql_query($sqlD);
$dname='';
if(mysql_num_rows($resD)>0)
{
$rowD=mysql_fetch_array($resD);
$dname=$rowD['name'];
}
echo $dname;
?>
</td>
<td align="left" style="padding-left:2px">
<?
$sqlM="select name from elec_machine where machine_id='".$row['machine_id']."'";
$resM=mysql_query($sqlM);
$mname='';
if(mysql_num_rows($resM)>0)
{
$rowM=mysql_fetch_array($resM);
$mname=$rowM['name'];
}
echo $mname;
?>
</td>
<td align="left" style="padding-left:2px">
<?
$sqlMO="select name from elec_motor where motor_id='".$row['motor_id']."'";
$resMO=mysql_query($sqlMO);
$mname='';
if(mysql_num_rows($resMO)>0)
{
$rowMO=mysql_fetch_array($resMO);
$mname=$rowMO['name'];
}
echo $mname;
?>
</td>
<td align="left" style="padding-left:2px"><?=stripcslashes($row['details'])?></td>
<?
if(1)
{
//$SessionUserType=='Administrator' || (date('Y-m-d')==$insert_date)
?>
<td align="center">
<a href="elec_add_MM.php?MM_id=<?=$row["MM_id"]?>&mode=edit">
<img src="images/icon_edit.gif" alt="Edit" title="Edit" border="0" />
</a>
</td>
<td align="center">
<a href="javascript:;" onClick="overlay(<?=$row["MM_id"]?>);">
<img src="images/delete_icon.gif" alt="Delete" title="Delete" border="0">
</a>
</td>
<?
}
else
{
?>
<td align="center"></td>
<td align="center"></td>
<?
}
?>
</tr>
<?
}
}
else
{
?>
<tr>
<td colspan="8" align="center"><b>No Record Found</b></td>
</tr>
<?
}
?>
</table>