| Current Path : /var/www/html/mmishra/istore/ |
| Current File : /var/www/html/mmishra/istore/tnotification.inc.bak |
<h2 align='left'>Tender Notification</h2>
<center>
<?php
$tbl = 't_tenders';
$id = $_REQUEST["id"];
$tenderno = $_REQUEST["tender_no"];
$datetender = $_REQUEST['date_tender'];
if (!$datetender) $datetender = date("Y-m-d");
$datesubmission = $_REQUEST["date_submission"];
if (!$datesubmission) $datesubmission = date('Y-m-d', strtotime("+15 days"));
$timesubmission = $_POST["time_submission"];
if (!$timesubmission) $timesubmission = "12:30:00";
$dateopening = $_REQUEST['date_opening'];
if (!$dateopening) $dateopening = date('Y-m-d', strtotime("+15 days"));
$timeopening = $_POST['time_opening'];
if (!$timeopening) $timeopening = "15:30:00";
$classification = $_POST['classification'];
$objective = $_POST['objective'];
$title = $_POST['title'];
$tenderfee = $_POST['tender_fee'];
$estcost = $_POST['est_cost'];
$emdamount = $_POST['emd_amount'];
$userdept = $_POST['user_dept'];
$useremail = $_POST['user_email'];
$tenderfile = basename($_FILES['userfile']['name']);
$status = $_POST['status'];
if ($_POST["submit"] == 'SAVE') {
if ($tenderfile) {
$tenderfile = uploadfile("tenderfiles");
if ($tenderfile) mysql_query("update $tbl set tender_file='$tenderfile' where id=$id");
}
if (mysql_num_rows(mysql_query("select * from $tbl where id=$id"))) {
//update existing tender
mysql_query("update $tbl set tender_no='$tenderno',date_tender='$datetender',classification='$classification',objective='$objective',date_opening='$dateopening',
title='$title',tender_fee=$tenderfee,est_cost=$estcost,emd_amount=$emdamount,user_dept='$userdept',user_email='$useremail',
date_submission='$datesubmission',time_submission='$timesubmission',date_opening='$dateopening',time_opening='$timeopening',dated=now()
where id=$id");
} else {
//insert new tender
mysql_query("insert into $tbl(tender_no,date_tender,classification,objective,title,est_cost,emd_amount,user_dept,user_email,
tender_fee,date_submission,time_submission,date_opening,time_opening,tender_file,status,dated)
values('$tenderno','$datetender','$classification','$objective','$title',$estcost,$emdamount,'$userdept','$useremail',
$tenderfee,'$datesubmission','$timesubmission','$dateopening','$timeopening','$tenderfile','Online',now())");
$rs = mysql_query("select * from st_config");
if (mysql_num_rows($rs)) {
$o = mysql_fetch_object($rs);
$automailing = $o->auto_mailing;
$tendernotice = $o->tender_notice;
$tenderemails = explode(",",$o->tender_emails);
$uploadnotice = $o->upload_notice;
$uploademails = explode(",",$o->upload_emails);
if ($automailing) {
$str = "<table width='100%' border='1' style='border-collapse:collapse'>
<tr><th>Tender No.</th><th>Description</th><th>Dated</th><th>User Dept.</th></tr>
<tr><td>$tenderno</td><td>$title</td><td>$datetender</td><td>$userdept</td></tr>
</table>";
foreach ($tenderemails as $email) {
automailer($email, "Tender Notification", $tendernotice.$str, '/var/www/html/istore/'.$tenderfile);
}
foreach ($uploademails as $email) {
automailer($email, "Tender Notification", $uploadnotice.$str, '/var/www/html/istore/'.$tenderfile);
}
}
}
}
} else if ($_POST["submit"] == 'DELETE') {
mysql_query("delete from $tbl where id=$id");
$id = 0;
}
$rs = mysql_query("select * from $tbl where id=$id");
if (mysql_num_rows($rs)) {
$o = mysql_fetch_object($rs);
$id = $o->id;
$tenderno = $o->tender_no;
$datetender = $o->date_tender;
$datesubmission = $o->date_submission;
$timesubmission = $o->time_submission;
if ($timesubmission == '00:00:00') $timesubmission = "12:30:00";
$dateopening = $o->date_opening;
$timeopening = $o->time_opening;
if ($timeopening == '00:00:00') $timeopening = "15:30:00";
$classification = $o->classification;
$objective = $o->objective;
$title = $o->title;
$tenderfee = $o->tender_fee;
$estcost = $o->est_cost;
$emdamount = $o->emd_amount;
$userdept = $o->user_dept;
$useremail = $o->user_email;
$tenderfile = $o->tender_file;
$status = $o->status;
}
?>
<table width='90%'><tr><th width='60%'>[ <a href='?pg=<?php echo $pg; ?>&id=0'>New</a> ] Tender Details</th><th width='40%'>Online Tenders</th></tr>
<tr valign='top'><td>
<table width='100%' border='1' style='border-collapse: collapse'>
<?php
echo "<tr><td width='15%'>Tender No.</td><td width='85%'><input type='text' name='tender_no' size='20' value='$tenderno'> ";
if ($id) {
$no1 = 0;
$no2 = 0;
$sr = mysql_query("select count(tender_no) as no from t_corrigendums where tender_no=$id");
if (mysql_num_rows($sr)) {
$q = mysql_fetch_object($sr);
$no1 = $q->no;
}
$sr = mysql_query("select count(tender_no) as no from t_extensions where tender_no=$id");
if (mysql_num_rows($sr)) {
$q = mysql_fetch_object($sr);
$no2 = $q->no;
}
echo "(<a href='?pg=tcorrigendum&tender_no=$id'>Corrigendum</a>: $no1, <a href='?pg=textension&tender_no=$id'>Extension</a>: $no2)";
}
echo "</td></tr>
<tr><td>Classification</td><td><select name='classification'>";
foreach ($classifications as $cl) {
echo "<option value='$cl'".($cl == $o->classification ? ' selected' : '').">$cl</option>";
}
echo "</select> Objective <select name='objective'>";
foreach ($objectives as $ob) {
echo "<option value='$ob'".($ob == $o->objective ? ' selected' : '').">$ob</option>";
}
echo "</select></td></tr>
<tr><td>Tender Period</td><td>";
$myCalendar = new tc_calendar("date_tender", true, false);
$myCalendar->setIcon("images/iconCalendar.gif");
$myCalendar->setDate(date('d', strtotime($datetender)), date('m', strtotime($datetender)), date('Y', strtotime($datetender)));
$myCalendar->setPath("calendar/");
$myCalendar->setYearInterval(2016, 2020);
$myCalendar->setAlignment('left', 'bottom');
$myCalendar->setDatePair('date_tender', 'date_submission', $datesubmission);
$myCalendar->writeScript();
echo " To ";
$myCalendar = new tc_calendar("date_submission", true, false);
$myCalendar->setIcon("images/iconCalendar.gif");
$myCalendar->setDate(date('d', strtotime($datesubmission)), date('m', strtotime($datesubmission)), date('Y', strtotime($datesubmission)));
$myCalendar->setPath("calendar/");
$myCalendar->setYearInterval(2016, 2020);
$myCalendar->setAlignment('left', 'bottom');
$myCalendar->setDatePair('date_tender', 'date_submission', $datesubmission);
$myCalendar->writeScript();
echo " till <input type='text' name='time_submission' size='10' value='$timesubmission'> 24 hour clock format<input type='hidden' name='id' value='$id'></td></tr>
<tr><td>Opening Date</td><td>";
$myCalendar = new tc_calendar("date_opening", true, false);
$myCalendar->setIcon("images/iconCalendar.gif");
$myCalendar->setDate(date('d', strtotime($dateopening)), date('m', strtotime($dateopening)), date('Y', strtotime($dateopening)));
$myCalendar->setPath("calendar/");
$myCalendar->setYearInterval(2016, 2020);
$myCalendar->setAlignment('left', 'bottom');
$myCalendar->writeScript();
echo " at <input type='text' name='time_opening' size='10' value='$timeopening'> 24 hour clock format</td></tr>
<tr><td>Tender Title</td><td><textarea name='title' rows='2' cols='50'>$title</textarea></td></tr>
<tr><td>Tender Fee</td><td><input type='text' name='tender_fee' size='20' value='$tenderfee'> in INR</td></tr>
<tr><td>Estimated Cost</td><td><input type='text' name='est_cost' size='20' value='$estcost'> in INR</td></tr>
<tr><td>Emd Amount</td><td><input type='text' name='emd_amount' size='20' value='$emdamount'> in INR</td></tr>
<tr><td>User Dept.</td><td><input type='text' name='user_dept' size='50' value='$userdept'></td></tr>
<tr><td>User Email</td><td><input type='text' name='user_email' size='50' value='$useremail'></td></tr>
<tr><td>Tender File</td><td><input type='file' name='userfile' size='50'><a href='$tenderfile'>$tenderfile</a></td></tr>
<tr><th>".($id ? "<input type='submit' name='submit' value='DELETE'>" : "")."</th>
<th><input type='submit' name='submit' value='SAVE'></th></tr>";
?>
</table>
</td><td>
<ul>
<?php
$rs = mysql_query("select * from $tbl order by date_tender desc");
while ($o = mysql_fetch_object($rs)) {
echo "<li>[ <a href='?pg=$pg&id=$o->id'>$o->tender_no</a> ] $o->title <br>
Duration $o->date_tender to $o->date_submission <br>
< $o->tender_file ></li>";
}
?>
</ul>
</td></tr>
</table>
<tr><td colspan='2'>
[ <a href='tformats.php?pg=openingnote&tno=<?php echo $id; ?>'>Opening Note</a> ]
[ <a href='tformats.php?pg=summarynote&tno=<?php echo $id; ?>'>Summary Note</a> ]
[ <a href='tformats.php?pg=extensionnote&tno=<?php echo $id; ?>'>Extension Note</a> ]
[ <a href='tformats.php?pg=extensionorder&tno=<?php echo $id; ?>'>Extension Order</a> ]
</td></tr>
</tr>
</table>
</center>