974 lines
30 KiB
PHP
974 lines
30 KiB
PHP
<title>CRM</title>
|
|
<?php
|
|
include('pop_up_top.php');
|
|
$TABLENAME='tbl_notes';
|
|
$this_script='notes.php';
|
|
|
|
?>
|
|
<link href="includes/css-js/admin.css" rel="stylesheet" type="text/css" />
|
|
<script>
|
|
$(document).ready(function () {
|
|
var user_role = document.getElementById('user_id').value;
|
|
/*if(user_role=='143'){
|
|
alert('Access Denied');
|
|
window.close();
|
|
}*/
|
|
var count = document.getElementById('valCount').value;
|
|
|
|
var count1 = document.getElementById('countPL').value;
|
|
|
|
for(var b=0;b<count1;b++){
|
|
//alert('b====='+b);
|
|
for(var c=0;c<count;c++){
|
|
//alert('c===='+c);
|
|
var pl1 = document.getElementById('pl_no1'+b).value;
|
|
//alert('pl111===='+pl1);
|
|
var pl = document.getElementById('pl_no'+c).value;
|
|
//alert('pl===='+pl);
|
|
if(pl1 == pl){
|
|
document.getElementById('check'+c).checked = true;
|
|
}
|
|
}
|
|
|
|
}
|
|
//alert(count);
|
|
});
|
|
|
|
function selectAll(){
|
|
var count = document.getElementById('valCount').value;
|
|
//alert(count);
|
|
var selectVal = document.getElementById('select').checked;
|
|
//alert(selectVal);
|
|
if(selectVal == true){
|
|
for(var i=0;i<count;i++){
|
|
document.getElementById('check'+i).checked = true;
|
|
//alert(document.getElementById('check0').checked);
|
|
}}
|
|
if(selectVal == false){
|
|
for(var i=0;i<count;i++){
|
|
document.getElementById('check'+i).checked = false;
|
|
//alert(document.getElementById('check0').checked);
|
|
}
|
|
}
|
|
//alert('hello');
|
|
var plCount = document.getElementById('valCount').value;
|
|
//alert(plCount);
|
|
}
|
|
|
|
function validateForPL(){
|
|
var add = 0
|
|
var count = document.getElementById('valCount').value;
|
|
for(var c=0;c<count;c++){
|
|
var selectVal = document.getElementById('check'+c).checked;
|
|
if(selectVal == true){
|
|
var pl = document.getElementById('pl_no'+c).value;
|
|
//alert('pl===='+pl);
|
|
add = add+pl;
|
|
}
|
|
}
|
|
if(add==0){
|
|
alert('select pl');
|
|
return false;
|
|
}
|
|
else{
|
|
//alert('selected');
|
|
}
|
|
|
|
}
|
|
</script>
|
|
<tr>
|
|
<?php
|
|
$sql_user_check = "select a.access_level from assign_menu a left join tbl_users b on a.role_id=b.role_id where b.user_id='".$_SESSION['user_id']."'";
|
|
$res_user_check = @mysqli_query($conn,$sql_user_check);
|
|
$row_user_check = @mysqli_fetch_array($res_user_check);
|
|
?>
|
|
<input type="hidden" id="user_id" value="<?php echo $_SESSION['user_id']?>">
|
|
<input type="hidden" id="user_role" value="<?php echo $row_user_check['access_level']?>">
|
|
|
|
<td height="350" valign="top" style="padding:10px;"><table width="100%" border="0" cellspacing="0" cellpadding="0">
|
|
|
|
<tr>
|
|
|
|
<td><fieldset class="bdr1" >
|
|
|
|
<?php
|
|
|
|
if(isset($acn) && $acn=='delete')
|
|
|
|
{
|
|
|
|
if($note_id)
|
|
|
|
mysqli_query($conn,"DELETE FROM tbl_notes WHERE note_id ='".$note_id."'");
|
|
mysqli_query($conn,"DELETE FROM tbl_reply WHERE note_id ='".$note_id."'");
|
|
|
|
}
|
|
|
|
|
|
//UPDATE tbl_reply SET age = null WHERE id
|
|
if(isset($hid) && $hid=='1')
|
|
{
|
|
if($added_id)
|
|
{
|
|
}else{
|
|
$added_id=$_SESSION['user_id'];
|
|
}
|
|
|
|
if($note_category=='T')
|
|
{
|
|
$sql7="SELECT client_id FROM tbl_tenders_list Where tender_no='".$associated_id."'";
|
|
}
|
|
if($note_category=='P')
|
|
{
|
|
$sql7="SELECT client_id FROM purchase_order_master where production_file_no='".$associated_id."'";
|
|
}
|
|
if($note_category=='Q')
|
|
{
|
|
$sql7="SELECT client_id FROM tbl_tenders_list Where tender_no = (SELECT tender_no FROM quotation_master where internal_ref_no='".$associated_id."')";
|
|
}
|
|
$result7 = mysqli_query($conn,$sql7);
|
|
$row7 = @mysqli_fetch_array($result7);
|
|
|
|
if($frmacn=='Update')
|
|
{
|
|
|
|
}
|
|
else
|
|
{
|
|
$sq="select max(ref_id) as cn_aid FROM tbl_notes WHERE associated_id ='".$associated_id."'";
|
|
$re=mysqli_query($conn,$sq);
|
|
$ro=@mysqli_fetch_array($re);
|
|
@extract($ro);
|
|
|
|
$cn_aid = $cn_aid + 1;
|
|
$ref_id=$cn_aid;
|
|
}
|
|
|
|
$query_main=" SET firm_id='".$firm_id."',subject='$subject_select', note_category='".$note_category."',associated_id='".$associated_id."',ref_id='".$ref_id."', client_id='".$row7['client_id']."', corr_date='".date_conversion($corr_date,"d-m-Y","Y-m-d")."', corr_rec_date='".date_conversion($corr_rec_date,"d-m-Y","Y-m-d")."', cm_radio='".$cm_radio."', initiated_by='".$initiated_by."',client_ref='".$client_ref."',note_details='".$note_details."',added_id='".$added_id."', modified_by='".$_SESSION['user_id']."'";
|
|
|
|
$query_prefix='';
|
|
|
|
$query_suffix="";
|
|
|
|
$query_additional="";
|
|
|
|
if($frmacn=="Update")
|
|
|
|
{
|
|
|
|
$query_prefix='UPDATE ';
|
|
|
|
$query_suffix=" WHERE note_id ='".$note_id."'";
|
|
|
|
$query_additional="";
|
|
|
|
$msg="Information Note Updated Successfully";
|
|
|
|
for($a=0;$a<$valCount;$a++){
|
|
$sql1 = "delete from tbl_corr_item where id = '${"id$a"}' ";
|
|
//echo "</br>";
|
|
$result1 = @mysqli_query($conn,$sql1);
|
|
|
|
}
|
|
for($a=0;$a<$valCount;$a++){
|
|
$chk = $_REQUEST['chk'.$a];
|
|
|
|
if($chk == true){
|
|
|
|
|
|
$sql = "insert into tbl_corr_item set ref_id = '$ref_id', associated_id = '$associated_id', pl_no = '${"pl_no$a"}' , modified_by='".$_SESSION['user_id']."' ";
|
|
//echo "</br>";
|
|
$result = @mysqli_query($conn,$sql) or die($sql);
|
|
}
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
elseif($frmacn=="Add")
|
|
|
|
{
|
|
$sqlNote="select note_id, associated_id from tbl_notes where associated_id='$associated_id' ";
|
|
$resNote=mysqli_query($conn,$sqlNote);
|
|
$rowsNote=mysqli_fetch_array($resNote);
|
|
$note_id = $rowsNote['note_id'];
|
|
$associated_id1 = $rowsNote['associated_id'];
|
|
//echo "note id".$note_id."</br>";
|
|
|
|
//echo $note_id."</br>";
|
|
|
|
/*if(isset($associated_id1))
|
|
{
|
|
$sqlReply="select reply_counter from tbl_reply where note_id = '$note_id'";
|
|
$resReply=mysqli_query($conn,$sqlReply);
|
|
$rowsReply=mysqli_fetch_array($resReply);
|
|
$reply_counter = $rowsReply['reply_counter'];
|
|
if(isset($reply_counter)){
|
|
//echo "note id".$reply_counter;
|
|
}
|
|
else{
|
|
echo "<script>alert('Pending Case On this Record'); window.close();</script>";
|
|
return false;
|
|
}
|
|
}
|
|
else{
|
|
|
|
|
|
}*/
|
|
|
|
$query_prefix='INSERT INTO ';
|
|
$query_suffix='';
|
|
|
|
$msg="Information Note Added Successfully";
|
|
|
|
|
|
for($a=0;$a<$valCount;$a++){
|
|
$chk = $_REQUEST['chk'.$a];
|
|
if($chk == true){
|
|
$sql = "insert into tbl_corr_item set ref_id = '$ref_id', associated_id = '$associated_id', pl_no = '${"pl_no$a"}' , modified_by='".$_SESSION['user_id']."' ";
|
|
$result = @mysqli_query($conn,$sql);
|
|
}
|
|
}
|
|
|
|
}
|
|
|
|
$sql=$query_prefix.$TABLENAME.$query_main.$query_additional.$query_suffix;
|
|
|
|
$res=@mysqli_query($conn,$sql);
|
|
if(!$res){
|
|
$msg='Error adding/updating Note class.';
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
?>
|
|
|
|
|
|
|
|
|
|
|
|
<form name="f1" method="post" action="#" onsubmit="return validateForm();" >
|
|
<table width="100%" border="0" cellspacing="0" >
|
|
<tr><td colspan="2" align="center" width="25%" style="color:#293D3D; font-size:16px;"><b>Correspondance<hr></b></td></tr>
|
|
|
|
<tr>
|
|
|
|
<td colspan="2" align="center">
|
|
|
|
<span class="txt">
|
|
|
|
<?php
|
|
|
|
if($msg)
|
|
|
|
echo $msg;
|
|
|
|
?>
|
|
</span></td>
|
|
</tr>
|
|
<?php if($acn=='add' || $acn=='update'|| $acn=='view') { ?>
|
|
|
|
<?php
|
|
|
|
if($acn=='update'|| $acn=='view')
|
|
|
|
{
|
|
|
|
$sql=@mysqli_query($conn,"SELECT * FROM $TABLENAME WHERE note_id ='".$note_id."'");
|
|
|
|
$row=@mysqli_fetch_array($sql);
|
|
|
|
@extract($row);
|
|
|
|
?>
|
|
|
|
<tr>
|
|
<td width="55%" align="left" class="bdr_td"><span style="color:#293D3D; font-size:10px;" ><b>Firm:</b></span></td>
|
|
<td align="left" class="bdr_td">
|
|
<?php
|
|
$sql12 = "select a.firm_name,a.firm_id from tbl_firms a left join tbl_notes b on a.firm_id=b.firm_id where a.firm_id ='".$row['firm_id']."'";
|
|
$result12 = mysqli_query($conn,$sql12);
|
|
$row12 = @mysqli_fetch_array($result12);
|
|
//echo $row12['firm_id'];
|
|
//echo $row12['firm_name'];
|
|
?>
|
|
<input type="hidden" readonly class="textbox1" name="firm_name" value="<?php echo $row12['firm_name']?>" style="width:100%;"><?php echo $row12['firm_name'];?>
|
|
<input type="hidden" readonly class="textbox1" name="firm_id" value="<?php echo $row12['firm_id']?>">
|
|
<input type="hidden" class="textbox1" name="note_id" id="note_id" value="<?php echo $note_id?>" />
|
|
<input type="hidden" class="textbox1" name="added_id" id="added_id" value="<?php echo $added_id?>" /></td>
|
|
|
|
</td>
|
|
</tr>
|
|
<tr>
|
|
|
|
<td width="55%" align="left" class="bdr_td"><span style="color:#293D3D; font-size:10px;" ><b>Category:</b></span></td>
|
|
|
|
|
|
|
|
<td align="left" class="bdr_td">
|
|
<?php
|
|
if($note_category=='T'){?>
|
|
<input type="hidden" readonly class="textbox" name="note_category" value="T">Tender
|
|
<?php }
|
|
if($note_category=='Q'){
|
|
?>
|
|
<input type="hidden" readonly class="textbox" name="note_category" value="Q">Quotation
|
|
<?php }
|
|
if($note_category=='P'){
|
|
?>
|
|
<input type="hidden" readonly class="textbox" name="note_category" value="P">Order File
|
|
<?php } ?>
|
|
|
|
|
|
</td>
|
|
</tr>
|
|
<tr>
|
|
|
|
<td width="55%" align="left" class="bdr_td"><span style="color:#293D3D; font-size:10px;" ><b>Associated Record:</b></span></td>
|
|
<td align="left" class="bdr_td">
|
|
|
|
<?php echo $associated_id; ?>
|
|
|
|
</td>
|
|
|
|
|
|
|
|
</tr>
|
|
<tr>
|
|
<td width="55%" align="left" class="bdr_td"><span style="color:#293D3D; font-size:10px;" ><b>Case No:</b></span></td>
|
|
<td align="left" class="bdr_td" name="corr_A" id="corr_A" >
|
|
<?php if(isset($ref_id)){?>
|
|
<?php echo $ref_id; ?>
|
|
|
|
|
|
<?php }
|
|
else{
|
|
?>
|
|
|
|
<?php } ?>
|
|
</td>
|
|
</tr>
|
|
<tr>
|
|
<td width="55%" align="left" class="bdr_td"><span style="color:#293D3D; font-size:10px;" ><b>PL No:</b></span></td>
|
|
|
|
<td id="pl_id" >
|
|
<p>Select All<input type="checkbox" id="select" name="selectAllup" onclick="selectAll();"></p>
|
|
<?php
|
|
$sqlCategory = "select note_category from tbl_notes where note_id='$note_id'and ref_id='$ref_id'";
|
|
$resultCategory = mysqli_query($conn,$sqlCategory);
|
|
$rowCategory = mysqli_fetch_array($resultCategory);
|
|
$category = $rowCategory['note_category'];
|
|
?>
|
|
<?php
|
|
if($category == 'P'){
|
|
$sql = "select purchase_order_no from purchase_order_master where production_file_no = '$associated_id'";
|
|
$res=mysqli_query($conn,$sql);
|
|
$rows=mysqli_fetch_array($res);
|
|
|
|
$purchase_order_no= $rows['purchase_order_no'];
|
|
if(has_amendments($purchase_order_no)) {
|
|
$count=0;
|
|
$sql1 = "select distinct pl_no from purchase_order_details_amendment where purchase_order_no = '$purchase_order_no' and qty!= '0'";
|
|
$res1=mysqli_query($conn,$sql1);
|
|
|
|
while($rows1=mysqli_fetch_array($res1)){
|
|
$val = $rows1['pl_no'];
|
|
$a = "<p><input type='text' name='pl_no$count' value='$val' class='textbox1' id='pl_no$count'><input type='checkbox' id='check$count' name='chk$count' ></p>";
|
|
$output= $a;
|
|
echo $output;
|
|
$count++;
|
|
}
|
|
echo "<input type='hidden' value='$count' id='valCount' name='valCount'>";
|
|
}
|
|
else {
|
|
$count=0;
|
|
$sql1 = "select distinct pl_no from purchase_order_details where purchase_order_no = '$purchase_order_no' and qty != '0' ";
|
|
$res1=mysqli_query($conn,$sql1);
|
|
while($rows1=mysqli_fetch_array($res1)){
|
|
$val = $rows1['pl_no'];
|
|
$a = "<p><input type='text' name='pl_no$count' value='$val' class='textbox1' id='pl_no$count'><input type='checkbox' id='check$count' name='chk$count'></p>";
|
|
$output= $a;
|
|
echo $output;
|
|
$count++;
|
|
}
|
|
echo "<input type='hidden' value='$count' id='valCount' name='valCount'>";
|
|
}
|
|
|
|
|
|
$sqlPL = "select id,pl_no from tbl_corr_item where associated_id = '$associated_id' and ref_id='$ref_id'";
|
|
$resultPL = @mysqli_query($conn,$sqlPL);
|
|
$countPL = 0;
|
|
while($rowPL = @mysqli_fetch_array($resultPL)){
|
|
$pl_no=$rowPL['pl_no'];
|
|
$id=$rowPL['id'];
|
|
?>
|
|
|
|
<input type="hidden" name="id<?php echo $countPL?>" value="<?php echo $id?>" style="width:25px;">
|
|
<input type="hidden" value="<?php echo $pl_no?>" class="textbox1" name="pl_no1<?php echo $countPL?>" id="pl_no1<?php echo $countPL?>">
|
|
<!-- <input type="checkbox" name="PLC<?php echo $countPL?>" id="PLC<?php echo $countPL?>"> -->
|
|
|
|
<?php $countPL++; }
|
|
}
|
|
if($category == 'T'){
|
|
$sql1 = "select distinct pl_no from tbl_tender_items where tender_no = '$associated_id'";
|
|
$res1=@mysqli_query($conn,$sql1);
|
|
$count=0;
|
|
while($rows1=@mysqli_fetch_array($res1)){
|
|
$val = $rows1['pl_no'];
|
|
$a = "<p><input type='text' name='pl_no$count' value='$val' class='textbox1' id='pl_no$count'><input type='checkbox' id='check$count' name='chk$count'></p>";
|
|
$output= $a;
|
|
echo $output;
|
|
$count++;
|
|
}
|
|
echo "<input type='hidden' value='$count' id='valCount' name='valCount'>";
|
|
$sqlPL = "select id,pl_no from tbl_corr_item where associated_id = '$associated_id' and ref_id='$ref_id'";
|
|
$resultPL = @mysqli_query($conn,$sqlPL);
|
|
$countPL = 0;
|
|
while($rowPL = @mysqli_fetch_array($resultPL)){
|
|
$pl_no=$rowPL['pl_no'];
|
|
$id=$rowPL['id'];
|
|
?>
|
|
|
|
<input type="hidden" name="id<?php echo $countPL?>" value="<?php echo $id?>" style="width:25px;">
|
|
<input type="hidden" value="<?php echo $pl_no?>" class="textbox1" name="pl_no1<?php echo $countPL?>" id="pl_no1<?php echo $countPL?>">
|
|
<!-- <input type="checkbox" name="PLC<?php echo $countPL?>" id="PLC<?php echo $countPL?>"> -->
|
|
|
|
<?php $countPL++; }}
|
|
if($category == 'Q'){
|
|
$sql_tender="select tender_no from quotation_master where internal_ref_no = '$associated_id'";
|
|
$result_tender = mysqli_query($conn,$sql_tender);
|
|
$row_tender = mysqli_fetch_array($result_tender);
|
|
if(isset($row_tender)){
|
|
$sql1 = "select distinct pl_no from tbl_tender_items where tender_no = '".$row_tender['tender_no']."'";
|
|
$res1=@mysqli_query($conn,$sql1);
|
|
$count=0;
|
|
while($rows1=mysqli_fetch_array($res1)){
|
|
$val = $rows1['pl_no'];
|
|
$a = "<p><input type='text' name='pl_no$count' value='$val' class='textbox1' id='pl_no$count'><input type='checkbox' id='check$count' name='chk$count'></p>";
|
|
$output= $a;
|
|
echo $output;
|
|
$count++;
|
|
}
|
|
echo "<input type='hidden' value='$count' id='valCount' name='valCount'>";
|
|
|
|
}
|
|
else{
|
|
$sql1 = "select distinct pl_no from quotation_item_details where internal_ref_no = '$associated_id'";
|
|
$res1=@mysqli_query($conn,$sql1);
|
|
$count=0;
|
|
while($rows1=mysqli_fetch_array($res1)){
|
|
$val = $rows1['pl_no'];
|
|
$a = "<p><input type='text' name='pl_no$count' value='$val' class='textbox1' id='pl_no$count'><input type='checkbox' id='check$count' name='chk$count'></p>";
|
|
$output= $a;
|
|
echo $output;
|
|
$count++;
|
|
}
|
|
echo "<input type='hidden' value='$count' id='valCount' name='valCount'>";
|
|
|
|
}
|
|
$sqlPL = "select id,pl_no from tbl_corr_item where associated_id = '$associated_id' and ref_id='$ref_id'";
|
|
$resultPL = @mysqli_query($conn,$sqlPL);
|
|
$countPL = 0;
|
|
while($rowPL = @mysqli_fetch_array($resultPL)){
|
|
$pl_no=$rowPL['pl_no'];
|
|
$id=$rowPL['id'];
|
|
?>
|
|
|
|
<input type="hidden" name="id<?php echo $countPL?>" value="<?php echo $id?>" style="width:25px;">
|
|
<input type="hidden" value="<?php echo $pl_no?>" class="textbox1" name="pl_no1<?php echo $countPL?>" id="pl_no1<?php echo $countPL?>">
|
|
<?php $countPL++;}
|
|
|
|
}
|
|
?>
|
|
|
|
<input type="hidden" name="countPL" value="<?php echo $countPL?>" id="countPL">
|
|
<input type="hidden" name="associated_id" value="<?php echo $associated_id?>">
|
|
</td>
|
|
|
|
|
|
|
|
|
|
</tr>
|
|
|
|
<!-- for add section -->
|
|
|
|
<?php }
|
|
else{
|
|
?>
|
|
<tr>
|
|
<td width="55%" align="left" class="bdr_td"><span style="color:#293D3D; font-size:10px;" ><b>Firm:</b></span></td>
|
|
<td align="left" class="bdr_td"><select class="selectbox" id="firm_id" name="firm_id" onchange="check();" >
|
|
<option value="">-Select-</option>
|
|
<?php
|
|
$sql_firm ="select a.firm_id,firm_name from tbl_firms a, user_firms b where a.firm_id=b.firm_id and b.user_id= '".$_SESSION['user_id']."' ";
|
|
//echo $sql_firm;
|
|
generate_options($sql_firm,$firm_id,'firm_id','firm_name','');
|
|
?>
|
|
</select>
|
|
<input type="hidden" class="textbox1" name="note_id" id="note_id" value="<?php echo $note_id?>" />
|
|
<input type="hidden" class="textbox1" name="added_id" id="added_id" value="<?php echo $added_id?>" /> </td>
|
|
</tr>
|
|
<tr>
|
|
|
|
<td width="55%" align="left" class="bdr_td"><span style="color:#293D3D; font-size:10px;" ><b>Category:</b></span></td>
|
|
|
|
|
|
|
|
<td align="left" class="bdr_td">
|
|
<select class="selectbox" id="note_category" name="note_category" onchange="getNoteAssociations(this.value,'associated_id','',document.forms[0].firm_id.value);">
|
|
<option value="">-Select-</option>
|
|
<option <?php if($note_category=='T'){?>selected <?php }?>value="T">Tender</option>
|
|
<option <?php if($note_category=='Q'){?>selected <?php }?>value="Q">Quotation</option>
|
|
<option <?php if($note_category=='P'){?>selected <?php }?>value="P">Order File</option>
|
|
</select> </td>
|
|
</tr>
|
|
<tr>
|
|
|
|
<td width="55%" align="left" class="bdr_td"><span style="color:#293D3D; font-size:10px;" ><b>Associated Record:</b></span></td>
|
|
<td align="left" class="bdr_td">
|
|
<div id="associated_id_div">
|
|
<select class="selectbox" name="associated_id" id="associated_id" onchange="correspondanceNo(this.value);" onblur="associated_history(this.value);">
|
|
<?php if(isset($associated_id)){?>
|
|
|
|
<option value=""><?php echo $associated_id; ?></option>
|
|
|
|
<?php
|
|
$sql_firm ="SELECT distinct(production_file_no) as production_file_no from purchase_order_master where firm_id ='".$firm_id."' ORDER BY production_file_no ASC";
|
|
//echo $sql_firm;
|
|
generate_options($sql_firm,$firm_id,'firm_id','production_file_no','');
|
|
?>
|
|
<?php }
|
|
else{
|
|
?>
|
|
<option value=""></option>
|
|
<?php } ?>
|
|
|
|
|
|
|
|
|
|
</select>
|
|
|
|
</div></td>
|
|
|
|
|
|
|
|
</tr>
|
|
|
|
<tr>
|
|
<td width="55%" align="left" class="bdr_td" valign="top" ><span style="color:#293D3D; font-size:10px;" ><b>Case No:</br>PL No:</b></span></td>
|
|
<td align="left" class="bdr_td" name="corr_A" id="corr_A" >
|
|
|
|
|
|
</td>
|
|
</tr>
|
|
|
|
|
|
|
|
|
|
|
|
</tr>
|
|
|
|
<?php } ?>
|
|
|
|
|
|
|
|
<tr>
|
|
<td width="55%" align="left" class="bdr_td"><span style="color:#293D3D; font-size:10px;" ><b>Subject:</b></span></td>
|
|
<td align="left" class="bdr_td">
|
|
<select class="selectbox" id="subject_select" name="subject_select" onchange="validate_subject(this.value);" >
|
|
<option value="">-Select-</option>
|
|
<?php
|
|
$var = "select subject_id,subject_desc from tbl_corr_subject ORDER BY subject_desc " ;
|
|
|
|
generate_options($var,$subject,'subject_id','subject_desc','');
|
|
|
|
?>
|
|
</select></td>
|
|
</tr>
|
|
<tr>
|
|
<td width="55%" align="left" class="bdr_td"><span style="color:#293D3D; font-size:10px;" ><b>Correspondence Date:</b></span></td>
|
|
<td align="left" class="bdr_td"><input type="text" class="textbox1" name="corr_date" id="corr_date" value="<?php echo date_conversion($row['corr_date'],"Y-m-d","d-m-Y")?>" />
|
|
<a href="javascript:NewCal('corr_date','DDMMYYYY')"><img src="images/cal.gif" width="16" height="16" border="0" alt="Pick a date" />
|
|
</input>
|
|
</a></td>
|
|
</tr>
|
|
<tr>
|
|
<td width="55%" align="left" class="bdr_td"><span style="color:#293D3D; font-size:10px;" ><b>Received Date:</b></span></td>
|
|
<td align="left" class="bdr_td"><input type="text" class="textbox1" name="corr_rec_date" id="corr_rec_date" value="<?php echo date_conversion($row['corr_rec_date'],"Y-m-d","d-m-Y")?>" />
|
|
<a href="javascript:NewCal('corr_rec_date','DDMMYYYY')"><img src="images/cal.gif" width="16" height="16" border="0" alt="Pick a date" />
|
|
</input>
|
|
</a></td>
|
|
</tr>
|
|
|
|
<tr>
|
|
<td width="55%" align="left" class="bdr_td"><span style="color:#293D3D; font-size:10px;" ><b>Initiated By:</b></span></td>
|
|
<td>
|
|
<input type="radio" name="initiated_by" id="initiated_by" value="S" <?php if($initiated_by=='S' ){?>checked<?php }?> />Self
|
|
<input type="radio" name="initiated_by" id="initiated_by2" value="C" <?php if($initiated_by=='C' ){?>checked<?php }?> />Client
|
|
</label></td>
|
|
</tr>
|
|
|
|
|
|
|
|
<tr>
|
|
<td align="left" class="bg3"><span style="color:#293D3D; font-size:10px;" >Client Ref:</span></td>
|
|
<td align="left" class="bdr_td"><input type="text" id="client_reference" class="textbox1" name="client_ref" enabled="enabled" value="<?php echo $client_ref?>" onkeyup="return CheckClientRef(this.value);">If Initiated by Self, Enter N/A</td>
|
|
</tr>
|
|
|
|
|
|
<tr>
|
|
<td width="55%" align="left" class="bdr_td"><span style="color:#293D3D; font-size:10px;" ><b>Description:</b></span></td>
|
|
<td align="left" class="bdr_td"><textarea name="note_details" cols="30" rows="2"><?php echo htmlentities($note_details)?></textarea></td>
|
|
</tr>
|
|
|
|
|
|
<tr>
|
|
<td align="right" class="bg3">
|
|
<input type="hidden" name="class_id" value="<?php echo $class_id?>">
|
|
<input type="hidden" name="ref_id" value="<?php echo $_REQUEST['ref_id']?>">
|
|
<input type="hidden" name="hid" value="1"></td>
|
|
</tr>
|
|
|
|
|
|
<tr>
|
|
|
|
<td colspan="2" align="center">
|
|
|
|
<?php if($acn=='update') { ?>
|
|
|
|
<input type="submit" name="frmacn" value="Update" class="submitbutton" style="background:#CCFF33; border-radius:10px; color:black; font-size:11px;width:80px; height:20px;" onclick="return validateForPL();">
|
|
|
|
<?php } else if($acn=='add') { ?>
|
|
|
|
<input type="submit" name="frmacn" value="Add" class="submitbutton" style="background:#CCFF33; border-radius:10px; color:black; font-size:11px;width:80px; height:20px;" onclick="return validateForPL();">
|
|
<?php } ?>
|
|
<input type="button" onClick="window.close();"value="Close" class="submitbutton" style="background:#FF5C33; border-radius:10px; color:black; font-size:11px;width:80px; height:20px;"> </td>
|
|
</tr>
|
|
<tr height="30px"></tr>
|
|
</table>
|
|
<table width="100%" border="1" id="case_history" style="border-collapse: collapse">
|
|
|
|
</table>
|
|
|
|
</form>
|
|
|
|
<?php } else {
|
|
echo "<script>location.href='flexi_notes.php'</script>";
|
|
?>
|
|
|
|
<form name="f1" method="post" action="#">
|
|
|
|
|
|
|
|
<table width="100%" border="0" cellspacing="0" cellpadding="4" class="bdr_table">
|
|
|
|
<tr class="bg2">
|
|
|
|
<td colspan="10" align="center"><font color="maroon"><?php echo $msg?></font></td>
|
|
</tr>
|
|
<tr>
|
|
<td colspan="15" class="bg1">
|
|
<select class="selectbox" name="qry" id="qry" style="width:130pt">
|
|
<option value="1" <?php if($qry=='1'){?>selected<?php }?>>All </option>
|
|
<option value="2" <?php if($qry=='2'){?>selected<?php }?>>Tender</option>
|
|
<option value="3" <?php if($qry=='3'){?>selected<?php }?>>Quotation</option>
|
|
<option value="4" <?php if($qry=='4'){?>selected<?php }?>>Order File</option>
|
|
</select>
|
|
<input type="submit" class="submitbutton" name="filter" value="filter"/>
|
|
<a href="notes.php?qry"></a>
|
|
</td>
|
|
</tr>
|
|
<tr class="bg2">
|
|
|
|
<td align="left" ><strong>S.No.</strong></td>
|
|
|
|
<td align="center"><strong>Date of note</strong></td>
|
|
|
|
<td align="center"><strong>Noted by</strong></td>
|
|
<td align="center"><strong>Note Associated ID</strong></td>
|
|
|
|
<td align="center"><strong>Note Details</strong></td>
|
|
|
|
<td align="center"><strong>View</strong></td>
|
|
|
|
<td align="center"><strong>Edit</strong></td>
|
|
|
|
<td align="center"><strong>Delete</strong></td>
|
|
</tr>
|
|
|
|
<?php
|
|
|
|
if(!empty($qry))
|
|
{
|
|
if($qry=='1')
|
|
{
|
|
$sql="SELECT *, Date_Format(corr_date,'%e-%b-%Y') as corr_date1 FROM tbl_notes ORDER BY note_id DESC";
|
|
}
|
|
|
|
if($qry=='2')
|
|
{
|
|
$sql="SELECT *, Date_Format(corr_date,'%e-%b-%Y') as corr_date1 FROM tbl_notes WHERE note_category='T' ORDER BY associated_id ASC";
|
|
}
|
|
|
|
if($qry=='3')
|
|
{
|
|
$sql="SELECT *, Date_Format(corr_date,'%e-%b-%Y') as corr_date1 FROM tbl_notes WHERE note_category='Q' ORDER BY associated_id ASC";
|
|
}
|
|
|
|
if($qry=='4')
|
|
{
|
|
$sql="SELECT *, Date_Format(corr_date,'%e-%b-%Y') as corr_date1 FROM tbl_notes WHERE note_category='P' ORDER BY associated_id ASC";
|
|
}
|
|
}
|
|
else
|
|
{
|
|
$sql="SELECT *, Date_Format(corr_date,'%e-%b-%Y') as corr_date1 FROM tbl_notes ORDER BY note_id DESC";
|
|
}
|
|
|
|
$result = mysqli_query($conn,$sql);
|
|
|
|
$num_rows=@mysqli_num_rows($result);
|
|
|
|
$page=new Page();
|
|
|
|
$page->set_page_data($this_script,$num_rows,$records_per_page=100000,$scroll_num=0,$show_prev_next=true,$show_scroll_prev_next=true,$show_first_last=true);
|
|
|
|
$page->set_qry_string("");
|
|
|
|
$page_order_result=@mysqli_query($conn,$page->get_limit_query($sql));
|
|
|
|
$num=@mysqli_num_rows($page_order_result);
|
|
|
|
if($num>0)
|
|
|
|
{
|
|
|
|
$pageon=$_GET['page'];
|
|
|
|
$pageon=($pageon)*100000;
|
|
|
|
$count=$pageon+1;
|
|
|
|
while($row=@mysqli_fetch_array($page_order_result))
|
|
|
|
{
|
|
|
|
extract($row);
|
|
|
|
?>
|
|
|
|
<tr class="bdr_td">
|
|
|
|
<td align="left" class="bdr_td"><?php echo $count?></td>
|
|
<?php
|
|
if($note_category=='T')
|
|
$note_category="Tender";
|
|
if($note_category=='Q')
|
|
$note_category="Quotation";
|
|
if($note_category=='P')
|
|
$note_category="Purchase Order";
|
|
?>
|
|
|
|
<td align="center" class="bdr_td"><a href="reply_notes.php?acn=reply¬e_id=<?php echo $note_id?>"><?php echo stripslashes($corr_date1)?></a></td>
|
|
<td align="center" class="bdr_td"><?php echo getUserInfo($added_id)?></td>
|
|
<td align="center" class="bdr_td"><?php echo stripslashes($associated_id)?>/<?php echo roman($ref_id)?></td>
|
|
<td align="center" class="bdr_td"><?php echo stripslashes($note_details)?></td>
|
|
<td align="center" class="bdr_td"> <a href="javascript:void(0);" onclick="javascript:sendpage('<?php echo $this_script?>?acn=view¬e_id=<?php echo $note_id?>');"><img src='images/view.jpg' border="0" /></a></td>
|
|
<?php
|
|
$sql1="select distinct(note_id) as nid from tbl_reply where note_id=$note_id";
|
|
$res1=mysqli_query($conn,$sql1);
|
|
$row1=@mysqli_fetch_array($res1);
|
|
@extract($row1);
|
|
?>
|
|
<td align="center" class="bdr_td"><?php if(!$row1){ ?> <a href="javascript:void(0);" onclick="javascript:sendpage('<?php echo $this_script?>?acn=update¬e_id=<?php echo $note_id?>&ref_id=<?php echo $ref_id?>');"><img src='images/edit.png' border="0" /></a><?php }?> </td>
|
|
<td align="center" class="bdr_td"><?php if(!$row1){ ?> <a href="javascript:void(0);" onclick="javascript:deleterecord('<?php echo $this_script?>?acn=delete¬e_id=<?php echo $note_id?>');"><img src='images/drop.png' border="0" /></a><?php }elseif($_SESSION['user_id']=='27'){?><a href="javascript:void(0);" onclick="javascript:deleterecord('<?php echo $this_script?>?acn=delete¬e_id=<?php echo $note_id?>');"><img src='images/drop1.png' border="0" /></a><?php }?> </td>
|
|
</tr>
|
|
|
|
<?php
|
|
|
|
$count++;
|
|
|
|
} ?>
|
|
|
|
<tr class='bg2'><td colspan='10'><div style="margin-right:10px; ">Page <?php echo "<br>".$page->get_page_nav();?></div></td></tr>
|
|
|
|
<?php }
|
|
|
|
else
|
|
|
|
{
|
|
|
|
echo "<tr><td align='center' colspan='13' class='bdr_td'><strong>No Record Found</strong></td></tr>";
|
|
|
|
}
|
|
|
|
?>
|
|
|
|
<tr><td colspan="10" align="right"><input type="button" onclick="window.location.href='notes.php?acn=add'" value="Add New"></td></tr>
|
|
</table>
|
|
<?php ?>
|
|
|
|
|
|
</form>
|
|
|
|
<?php } ?>
|
|
|
|
</center>
|
|
|
|
</fieldset>
|
|
|
|
</td>
|
|
|
|
</tr>
|
|
|
|
</table></td>
|
|
|
|
</tr>
|
|
|
|
|
|
|
|
|
|
|
|
<script>
|
|
var fieldArray = new Array(
|
|
new Array('firm_id','note_category','subject_select','corr_date','corr_rec_date','initiated_by','note_details'), new Array('Please select Firm','Please select Category','Please select Associated Record','Please select Subject','Please select Correspondence Date','Please select Received Date','Please select Initiated By','Please enter Client Ref No','Please enter Remarks'));
|
|
|
|
function validateForm(){
|
|
|
|
return checkform('f1',fieldArray);
|
|
}
|
|
|
|
function check()
|
|
{
|
|
document.getElementById('note_category').value="";
|
|
//document.getElementById('associated_id').value="";
|
|
}
|
|
|
|
|
|
function alertForReply(Id)
|
|
{
|
|
|
|
|
|
function stateChangedState()
|
|
{
|
|
|
|
if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
|
|
{
|
|
if(xmlHttp.responseText =='')
|
|
{
|
|
//alert("Case is Open but Reply not Recieved");
|
|
}
|
|
//document.getElementById('corr_A').innerHTML=xmlHttp.responseText;
|
|
correspondanceNo(Id);
|
|
|
|
|
|
}
|
|
}
|
|
|
|
Params='request_type=alertForReply&Id='+Id;
|
|
SendAjaxRequest('ajax.php','POST',true,Params,stateChangedState);
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
function correspondanceNo(Id)
|
|
{
|
|
var note_cat = document.getElementById('note_category').value;
|
|
//alert(note_cat);
|
|
if(note_cat=='T'){
|
|
request_type='getTendersPL';
|
|
}else if(note_cat=='Q'){
|
|
request_type='getQuotationsPL';
|
|
}else if(note_cat=='P'){
|
|
request_type='getProductionFilePL';
|
|
}
|
|
function stateChangedState()
|
|
{
|
|
|
|
//alert(document.getElementById(listdiv).innerHTML);
|
|
if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
|
|
{
|
|
|
|
|
|
document.getElementById('corr_A').innerHTML=xmlHttp.responseText;
|
|
|
|
}
|
|
}
|
|
|
|
Params='request_type='+request_type+'&Id='+Id;
|
|
SendAjaxRequest('ajax.php','POST',true,Params,stateChangedState);
|
|
|
|
|
|
|
|
}
|
|
function getCRMpl(Id){
|
|
alert(Id);
|
|
//var assoc_record = document.getElementById("associated_id").value;
|
|
//alert(Id);
|
|
function stateChangedState()
|
|
{
|
|
//alert('hello');
|
|
if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
|
|
{
|
|
|
|
|
|
document.getElementById('pl_id').innerHTML=xmlHttp.responseText;
|
|
|
|
}
|
|
}
|
|
|
|
Params='request_type=getCRMpl&Id='+Id;
|
|
SendAjaxRequest('ajax.php','POST',true,Params,stateChangedState);
|
|
//alert('hello');
|
|
//alert(Params);
|
|
}
|
|
function associated_history(Id){
|
|
//alert('Check History');
|
|
function stateChangedState()
|
|
{
|
|
//alert('hello');
|
|
if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
|
|
{
|
|
|
|
|
|
document.getElementById('case_history').innerHTML=xmlHttp.responseText;
|
|
|
|
}
|
|
}
|
|
|
|
Params='request_type=associated_history&Id='+Id;
|
|
SendAjaxRequest('ajax.php','POST',true,Params,stateChangedState);
|
|
|
|
}
|
|
function validate_subject(val){
|
|
//alert(val);
|
|
var count = document.getElementById('count').value;
|
|
for(var i=0;i<count;i++)
|
|
{
|
|
var subject = document.getElementById('subject_case'+i).value;
|
|
if(val==subject){
|
|
alert('Same Case is still open, you can not choose this');
|
|
return false;
|
|
}
|
|
}
|
|
}
|
|
function CheckClientRef(val){
|
|
var count = document.getElementById('count').value;
|
|
for(var i=0;i<count;i++)
|
|
{
|
|
var client_ref = document.getElementById('client_ref'+i).value;
|
|
if(val==client_ref){
|
|
alert('This Client Reference is already define for an open case, you can not choose this');
|
|
document.getElementById('client_reference').value='';
|
|
return false;
|
|
}
|
|
}
|
|
}
|
|
</script>
|