ESH/notice.php
2024-10-23 18:28:06 +05:30

243 lines
9.5 KiB
PHP

<?php
function dateDiff($dformat, $endDate, $beginDate)
{
$date_parts1=explode($dformat, $beginDate);
$date_parts2=explode($dformat, $endDate);
$start_date=gregoriantojd($date_parts1[0], $date_parts1[1], $date_parts1[2]);
$end_date=gregoriantojd($date_parts2[0], $date_parts2[1], $date_parts2[2]);
return $end_date - $start_date;
}
?>
<link href="includes/css-js/admin.css" rel="stylesheet" type="text/css" />
<p align="center" class="heading2"></p>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<td width="50%" valign="top" align="center" class="heading1">
<form name="f1">
<table width="100%" border="0" cellspacing="0" cellpadding="4" class="bdr_table">
<tr class="bg2">
<td align="left" class="NoticeHeader" >Sr.</td>
<td align="center" class="NoticeHeader" >Date</td>
<td align="center" class="NoticeHeader" >Tender</td>
<td align="center" class="NoticeHeader" >Client</td>
<td align="left" class="NoticeHeader" >Item Description</td>
<td align="center" class="NoticeHeader" >Type</td>
<td align="center" class="NoticeHeader" >Quotation</td>
</tr>
<?php
$count=1;
$sql="SELECT a.*, b.client_City,c.client_name FROM tbl_tenders_list a, client_details b, client_master c where a.client_id = b.client_id and a.client_location_id= b.location_id and b.client_id=c.client_id and display !=0 and a.client_id in (select client_id from user_clients where user_id='".$_SESSION['user_id']."') ORDER BY `a`.`due_date` ASC";
$result = mysqli_query($conn,$sql);
while($row = mysqli_fetch_array($result))
{
extract($row);
$datetime = date_create($due_date);
$due_date=date_format($datetime, 'm/d/Y');
$date1=date("m/d/Y");
$diff=dateDiff("/", $due_date, $date1);
$datetime = date_create($due_date);
$date2=date_format($datetime, 'j-M-y');
if ($diff<11 && $diff>=0){
if ($diff>=0)
{
?>
<tr class="Normal_tr" onmouseover="className='Highlight_tr';" onmouseout="className='Normal_tr';">
<td align="left" class="Notice_td"><?php echo $count?></td>
<td align="center" class="Notice_td"><?php echo $date2?></td>
<?php
$sql_acc="select * from rights_access where user_id='".$_SESSION['user_id']."' and category='Q'";
$res_acc=mysqli_query($conn,$sql_acc);
$row_acc=@mysqli_fetch_array($res_acc);
@extract($row_acc);
?>
<?php
$tn=base64_encode($tender_id);
$acn3=base64_encode("add".$tender_id);
?>
<td align="center" class="Notice_td"><a href="javascript:void(0);" onclick="verify('acc_add','pdf_report_tender.php?tender_no=<?php echo $tender_no?>','<?php echo $acc_add?>')"><font color="RED"><?php echo $tender_no?></font></a></td>
<td align="center" class="Notice_td"><?php echo $client_name?></td>
<?php
$sql_t_items ="select a.item_desc_new, a.item_qty, b.unit_name from tbl_tender_items a LEFT JOIN unit_master b ON a.unit_id=b.unit_id where tender_no='".$tender_no."'";
$rs_t_items = @mysqli_query($conn,$sql_t_items);
$tender_items='';
while($t_items_rows = @mysqli_fetch_array($rs_t_items)){
$tender_items = $tender_items.' <p> '. $t_items_rows['item_desc_new'].'<b> Qty-'.$t_items_rows['item_qty'].' '.$t_items_rows['unit_name'].'</b></p>';
}
?>
<td align="left" class="Notice_td"><?php echo stripslashes($tender_items)?></td>
<?php
$sql_t_type ="select tender_type from tbl_tender_type where tender_type_id='".$tender_type."'";
$rs_t_type = @mysqli_query($conn,$sql_t_type);
$t_t_type = @mysqli_fetch_array($rs_t_type)
?>
<td align="center" class="Notice_td"><?php echo $t_t_type['tender_type']?></td>
<?php
$sql_t_quot ="select internal_ref_no,submission_date from quotation_master where tender_no='".$tender_no."'";
$rs_t_quot = @mysqli_query($conn,$sql_t_quot);
$internal_ref_no='';
while($t_quot_rows = @mysqli_fetch_array($rs_t_quot)){
$internal_ref_no = $internal_ref_no.' <p> '. $t_quot_rows['internal_ref_no'].' </p> ';
}
?>
<td align="center" class="Notice_td"><font color="#FF00FF"><?php echo stripslashes($internal_ref_no)?>&nbsp;</font></td>
</tr>
<?php
}else{
?>
<?php
}
$count++;
}
}
?>
</table>
</form>
</td>
<?php
$today=date("d-m-Y");
list($day, $month, $year) = split('[/.-]', $today);
$date1=date('Y-m-d', mktime(0,0,0,$month,($day+1),$year));
$date2=date('Y-m-d', mktime(0,0,0,$month,($day-25),$year));
$sql1="SELECT *, Date_Format(reply_date,'%e-%b-%Y') as reply_date1, Date_Format(corr_date,'%e-%b-%Y') as corr_date1 FROM tbl_notes where last_modified>'$date2' and last_modified<'$date1' and client_id IN (select client_id from user_clients where user_id='".$_SESSION['user_id']."') and firm_id IN (select firm_id from user_firms where user_id='".$_SESSION['user_id']."') ORDER BY note_id desc";
$result1 = mysqli_query($conn,$sql1);
if(mysqli_num_rows ( $result1)>0){
?>
<td width="1%"></td>
<td wdth="49%" valign="top" align="center" class="heading1">
<form name="f1">
<table width="100%" border="0" cellspacing="0" cellpadding="4" class="bdr_table">
<tr class="bg2">
<td align="center" class="NoticeHeader">Date</td>
<td align="center" class="NoticeHeader">Client</td>
<td align="center" class="NoticeHeader">Correspondance</td>
<td align="left" class="NoticeHeader">Description</td>
<td align="center" class="NoticeHeader">Ref</td>
</tr>
<?php
while($row1 = mysqli_fetch_array($result1))
{
extract($row1);
?>
<tr class="Normal_tr" onmouseover="className='Highlight_tr';" onmouseout="className='Normal_tr';">
<?php
$sql2="SELECT note_id FROM tbl_notes where note_id NOT IN (select note_id from tbl_reply) and note_id='".$note_id."'";
$res2=mysqli_query($conn,$sql2);
$row2=@mysqli_fetch_array($res2);
@extract($row2);
?>
<td align="left" class="Notice_td"><a href="reply_notes.php?acn=reply&note_id=<?php echo $note_id?>"><?php if($row2)
{?><font color="RED"><?php }?><?php echo $corr_date1?></font></a></td>
<?php
if($note_category=='T')
{
$sql7="SELECT client_id, client_location_id FROM tbl_tenders_list Where tender_no='".$associated_id."'";
$note_cat="Tender";
}
if($note_category=='P')
{
$sql7="SELECT client_id, client_location_id FROM purchase_order_master where production_file_no='".$associated_id."'";
$note_cat="Production File No";
}
if($note_category=='Q')
{
$sql7="SELECT client_id, client_location_id FROM tbl_tenders_list Where tender_no = (SELECT tender_no FROM quotation_master where internal_ref_no='".$associated_id."')";
$note_cat="Quotation";
}
$client='';
$result7 = mysqli_query($conn,$sql7);
$row7 = mysqli_fetch_array($result7);
$client = getClientInfo($row7['client_id'], $row7['client_location_id']);
$acc_view = getAccessView($note_category);
?>
<td align="left" class="Notice_td"><?php echo $client?>&nbsp;</td>
<td align="left" class="Notice_td">&nbsp;<?php echo $associated_id?>/<?php echo roman($ref_id)?></td>
<td align="left" class="Notice_td">&nbsp;<?php echo $note_details?></td>
<?php
if($note_cat=="Tender")
{
$tender_id = getTenderNo($associated_id);
$acnt = base64_encode("view".$tender_id);
$tender_id1 = base64_encode("$tender_id");
$sql_acc="select * from rights_access where user_id='".$_SESSION['user_id']."' and category='T'";
$res_acc=mysqli_query($conn,$sql_acc);
$row_acc=@mysqli_fetch_array($res_acc);
@extract($row_acc);
?>
<td align="left" class="Notice_td"><a href="javascript:void(0);"onclick="verify('acc_add','pdf_report_tender.php?tender_no=<?php echo $tender_no?>','<?php echo $acc_add?>')"><?php echo $associated_id?></a></td>
<?php } elseif($note_cat=="Production File No")
{
$purchase_order_no=getPurchaseOrderNo($associated_id);
/*
$isdirect = getPurchaseOrderIsDirect($associated_id);
if(has_amendments($purchase_order_no))
{
if($isdirect=='1')
{
$this_script="purchase_order_direct_amendment.php";
}
else
{
$this_script="purchase_order_amendment.php.php";
}
}
else
{
if($isdirect=='1')
{
$this_script="purchase_order_entry_direct_view.php";
}
else
{
$this_script="purchase_order_entry_view.php";
}
}
$sql_po_amend="Select max(amendment_no) as max_amendment from purchase_order_master_amendment where purchase_order_no='".$purchase_order_no."'";
$rs_amend=@mysqli_query($conn,$sql_po_amend);
$row_amemnd=@mysqli_fetch_array($rs_amend);
<td align="left" class="Notice_td"><?php echo $note_cat?> - <a href="javascript:void(0);" onclick="verify('acc_view','<?php echo $this_script?>?acn=<?php echo $acnp?>&purchase_order_no=<?php echo $purchase_order_no?>&amendment_no=<?php echo $row_amemnd['max_amendment']?>','<?php echo $acc_view?>');"><?php echo $associated_id?></a></td>
*/
if(has_amendments($purchase_order_no))
{
$amend=getLatestAmendmentNo($purchase_order_no);
}
else
{
$amend=0;
}
?>
<td align="left" class="Notice_td"><a href="javascript:void(0);" onclick="javascript:verify('acc_view','pdf_report_po.php?purchase_order_no=<?php echo stripslashes($purchase_order_no)?>&amend=<?php echo $amend?>','<?php echo $acc_view?>')"><?php echo $associated_id?></a></td>
<?php } elseif($note_cat=="Quotation")
{
$acnq = base64_encode("view".$associated_id);
$sql_acc="select * from rights_access where user_id='".$_SESSION['user_id']."' and category='Q'";
$res_acc=mysqli_query($conn,$sql_acc);
$row_acc=@mysqli_fetch_array($res_acc);
@extract($row_acc);
?>
<td align="left" class="Notice_td"><a href="javascript:void(0);" onclick="verify('acc_view','pdf_report_quotation.php?internal_ref_no=<?php echo $associated_id?>','<?php echo $acc_view?>');"><?php echo $associated_id?></a></td>
<?php }?>
</tr>
<?php }?>
</table>
</form>
</td>
<?php }?>
</table>
</fieldset>