| Current Path : /var/www/html/mmishra/iws8/html/erp/ |
| Current File : /var/www/html/mmishra/iws8/html/erp/dailymails.php |
<?php
include('include/config.inc');
include('include/functions.inc');
require('classes/PHPMailerAutoload.php');
require("classes/class.phpmailer.php");
date_default_timezone_set('Asia/Kolkata');
dbConnect("istore");
//******************tender meeting notice
$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);
$meetingnotice = $o->meeting_notice;
$meetingemails = explode(",",$o->meeting_emails);
}
$sql = "select tender_no,concat(title,' (',objective,')') as description,est_cost,user_dept,date_tender as dated,date_submission as submission,date_opening as opening,quotations,l1_quote,date_final as finalization from t_tenders where date_opening='".date("Y-m-d")."' order by id desc";
$sql = "select tender_no,concat(title,' (',objective,')') as description,est_cost,user_dept,date_tender as dated,date_submission as submission,date_opening as opening
from t_tenders order by id desc";
$str = list_tabledata($sql);
if ($automailing && $str) {
foreach ($meetingemails as $email) {
automailer($email, "Tender Processing - Regarding meeting", $meetingnotice.$str);
}
}
//*********************synchronize inventory quantity (in/out)
$rs = mysql_query("select item,sum(qty_in) as qi from st_stockin group by item");
while ($o = mysql_fetch_object($rs)) {
$item = $o->item;
$qi = $o->qi;
$sr = mysql_query("select * from st_items where id=$item");
$q = mysql_fetch_object($sr);
$in = $q->qty_in;
$sr = mysql_query("select item,sum(qty_out) as qo from st_stockout where item=$item");
$q = mysql_fetch_object($sr);
$qo = $q->qo;
$sr = mysql_query("select * from st_items where id=$item");
$q = mysql_fetch_object($sr);
$out = $q->qty_out;
//echo item_detail($o->item) ." [ $qi / $qo ][ $in / $out ]<br>";
//if ($qi<$qo) $qi=$qo;
mysql_query("update st_items set stock=$qi-$qo,qty_in=$qi,qty_out=$qo where id=$item");
}
//********************birthday wish
dbConnect("mm");
$today = date("m-d");
//$today = date("m-d", strtotime("15 Dec 1971"));//date("Y-m-d");
$msg = "<p align='center'>
<font size=+1 face='Time New Roman'>
Today should be a great day,
<br>
for you
<br>
Because it is your birthday!
<br>
<br>
Not because it calls for a celebration
<br>
but because it warrants introspection
<br>
<br>
<i>\"Wondering how could I be so immatured
<br>
in all these previous years
<br>
and pledging how I could be more
<br>
grown-up in the years to come\"
</i>
<br>
<br>
are the thoughts that echo,
<br>
today, on this day-the day of birthday.
<br>
<br>
The entire family of IIIT-Allahabad joins you and your family
<br>
to enjoy this special day.
<br><br>
All the best!
</font>
<p>
<p align='right'>
<font size='2px' face='Time New Roman'>
On behalf of IIIT-A
</font>
<br>
<br>
<font size=+1 face='Time New Roman'>
<b>P. Nagabhushan</b>
<br>
Director
<br>
IIIT-Allahabad
</font>
</p>
";
//echo $today;
$rs = mysql_query("select * from employees where dob like '%-$today'");
while ($o = mysql_fetch_object($rs)) {
$empno = $o->emp_no;
$empname = $o->emp_name;
$designation = $o->designation;
$email = $o->email;
$cellno = $o->cell_no;
$dob = $o->dob;
//$dobx = $o->dobx;
//echo $empname .'--'.$dob;
sendmail($email, "Happy Birthday!!", $msg);
//sendmail('dir.wish@iiita.ac.in', "Happy Birthday!!", $msg);
//echo date("d-m-Y", strtotime($dob))."\n";
//mysql_query("update faculty set dob1='".date("Y-m-d", strtotime($dob))."' where emp_no='$empno'");
}
?>