PK

ADDRLIN : /home/anibklip/vpgldh.com/
FLL :
Current File : //home/anibklip/vpgldh.com/view_enquiry_details.php

<center>
<style type="text/css">
.no-footer{width:99% !important;}
.table > tbody > tr > td{padding:2px !important;}
.table thead tr th{font-size:12px !important; padding:2px !important; background-image:url('tr_bg.gif');line-height:20px; color:#ffffff;}

.table-bordered > tbody > tr > td{font-size:11px; line-height:18px;}

.input-small_s{width:60px !important;}

.input-small{width:96% !important; font-size:11px; }
textarea.input-small_txtarea{width:100% ;}
</style>

<?php
require 'phpmailer/PHPMailerAutoload.php';

//print_r($_POST);

if($_POST[genr_quote_btn]!=""){
	/*$query="select quote_no from enquiries order by quote_no desc ";
	$q=mysql_query($query) or die(mysql_error());
	if($r=mysql_fetch_array($q,MYSQL_ASSOC)){	
	}
	if($r[quote_no]){
		$quote_no=$r[quote_no]+1;
	}else{
		$enq_series=getColumn("numbers","no_id",2,"value");
		$quote_no=$enq_series;
	}*/
	$enq_series=getColumn("numbers","no_id",2,"value");
	$quote_no=$enq_series+1;
	
	$q="update enquiries set quote_no='$quote_no' where enquiry_id='$_POST[enquiry_id]' ";
	//echo "$q";
	mysql_query($q) or die(mysql_error());

	$query="update numbers set value=value+1 where no_id='2' ";
	mysql_query($query) or die(mysql_error());
	$msg="Quotation Number Generated successfully.";
}

if($_POST[enq_updt_btn]!=""){
	$_POST[quote_dt]=date("Y-m-d",strtotime($_POST[quote_dt]));
	$q="update enquiries set
		quote_no='$_POST[quote_no]',
		quote_dt='$_POST[quote_dt]',
		quote_remarks='$_POST[quote_remarks]'
		where enquiry_id='$_POST[enquiry_id]'
	";
	//echo "$q";
	mysql_query($q) or die(mysql_error());
	$msg="Record updated successfully.";
}

if($_POST[sbmt_paymt_termsbtn]!=""){
	$q="update enquiries set
		validity='$_POST[validity]',
		price_basis='$_POST[price_basis]',
		payment='$_POST[payment]',
		delivery='$_POST[delivery]',
		currency='$_POST[currency]',
		taxes='$_POST[taxes]',
		freight='$_POST[freight]',
		advance='$_POST[advance]',
		quote_from='$_POST[quote_from]'
		where enquiry_id='$_POST[enquiry_id]'
	";
	//echo "$q";
	mysql_query($q) or die(mysql_error());
	$msg="Record updated successfully.";
}

if($_POST[enquiry_id]!=""){
	$query="select * from enquiries where enquiry_id='$_POST[enquiry_id]'";
}elseif($_POST[quote_no]!=""){
	$query="select * from enquiries where quote_no='$_POST[quote_no]'";
}elseif($_POST[ref_no]!=""){
	$query="select * from enquiries where reference='$_POST[ref_no]'";
}else{
	$query="select * from enquiries where enquiry_id='$_GET[enquiry_id]'";
}
//echo $query;
$q=mysql_query($query) or die(mysql_error());
if($enq=mysql_fetch_array($q)){
	//echo $enq[quote_no];
}

?>
</center>

<!-- BEGIN PAGE LEVEL STYLES -->
<link rel="stylesheet" type="text/css" href="assets/global/plugins/datatables/plugins/bootstrap/dataTables.bootstrap.css"/>
<link rel="stylesheet" type="text/css" href="assets/global/plugins/select2/select2.css"/>
<link rel="stylesheet" type="text/css" href="assets/global/plugins/bootstrap-wysihtml5/bootstrap-wysihtml5.css"/>
<link rel="stylesheet" type="text/css" href="assets/global/plugins/bootstrap-markdown/css/bootstrap-markdown.min.css">
<link rel="stylesheet" type="text/css" href="assets/global/plugins/bootstrap-datepicker/css/bootstrap-datepicker3.min.css"/>
<!-- END PAGE LEVEL SCRIPTS -->

<!-- BEGIN CONTAINER -->
<!-- BEGIN CONTENT -->
<div class="page-content">
    <!-- BEGIN PAGE HEADER-->
    <h3 class="page-title">Register Enquiry<small></small></h3>
    <div class="page-bar">
        <ul class="page-breadcrumb">
            <li>
				<i class="fa fa-home"></i>
				<a href="main.php">Home</a>
				<i class="fa fa-angle-right"></i>
            </li>
        </ul>
    </div>
    <!-- END PAGE HEADER-->
    <!-- BEGIN PAGE CONTENT-->

    <div class="row">
         <!-- BEGIN SAMPLE TABLE PORTLET-->
 		<div class="col-md-12">
			<form method="post" action="">
			  <table width="100%">
				<tr>
					<td>Enquiry # 
						<select name="enquiry_id" id="enquiry_id" class="form-control select2me" style="width:98%;">
							<option value="">Select Enquiry No.</option>
							<?php
							$query="select * from enquiries order by enquiry_id desc ";
							$q=mysql_query($query) or die(mysql_error());
							while($r=mysql_fetch_array($q)){
								if($r[enquiry_id]==$_REQUEST[enquiry_id]){
									$sel="selected";
								}else{
									$sel="";
								}
								?>
								<option <?php echo $sel?> value="<?php echo $r[enquiry_id]?>"><?php echo $r[enquiry_id]?></option>
								<?php
							}
							?>
						</select>
						<!-- <input name="enquiry_id" type="text" class="form-control" style="width:98%;" value="<?php echo $_REQUEST[enquiry_id]?>"/> -->
					</td>
					<td>
						Quotation # 
						<select name="quote_no" id="quote_no" class="form-control select2me" style="width:98%;">
							<option value="">Quotation #</option>
							<?php
							$query="select * from enquiries order by enquiry_id desc ";
							$q=mysql_query($query) or die(mysql_error());
							while($r=mysql_fetch_array($q)){
								if($r[quote_no]==$enq[quote_no]){	//$r[quote_no]==$_REQUEST[quote_no] || 
									$sel="selected";
								}else{
									$sel="";
								}
								?>
								<option <?php echo $sel?> value="<?php echo $r[quote_no]?>"><?php echo $r[quote_no]?></option>
								<?php
							}
							?>
						</select>
						<!-- <input type="text" name="quote_no" class="form-control" style="width:98%;" value="<?php echo $enq[quote_no]?>" /> -->
					</td>
					<td>
						Customer Reference 
						<select name="ref_no" id="ref_no" class="form-control select2me" style="width:98%;">
							<option value="">Customer Reference</option>
							<?php
							$query="select * from enquiries order by enquiry_id desc ";
							$q=mysql_query($query) or die(mysql_error());
							while($r=mysql_fetch_array($q)){
								if($r[enquiry_id]==$_REQUEST[enquiry_id]){
									$sel="selected";
								}else{
									$sel="";
								}
								?>
								<option <?php echo $sel?> value="<?php echo $r[reference]?>"><?php echo $r[reference]?></option>
								<?php
							}
							?>
						</select>
						<!-- <input type="text" name="ref_no" class="form-control" style="width:98%;" value="<?php echo $enq[reference]?>" /> -->
					</td>
					<td>Client 
						<div style="border:1px solid #cccccc; padding:4px; margin-right:4px; width:100%;">
							<?php echo getColumn("dbo_clientlist","ClientID",$enq[ClientID],"CompName")?><br>
							<?php echo getColumn("dbo_clientcontacts","ID",$enq[client_contact_id],"ConName")?>
						</div>
					</td>
					<td><input type="submit" value="Search" class="btn red"/></td>
					<td></td>
				</tr>
			  </table>
			</form>
			<br /><br />


			<?php
			if($_GET[saction]!="add"){
				$query="select * from enquiries where enquiry_id='$_GET[enquiry_id]'";
				$q=mysql_query($query) or die(mysql_error());
				if($editrow=mysql_fetch_array($q)){
				}
			}
			?>
			<div class="portlet-body">
				<div class="tabbable">
					<?php include "enq_tabs.php";?>
					<div class="tab-content no-space">
						<div id="enq_details" class="tab-pane active">
						  <div>
							<table width="100%">
                            	<tr>
                                	<td valign="top" width="33%">
                                    	<form action="" method="post">
                                         <input name="enquiry_id" type="hidden" value="<?php echo $enq[enquiry_id]?>" />
                                         <table class="table table-striped table-hover table-bordered">
                                            <tbody>
                                            <tr>
                                                <td colspan="2">Enquiry Details</td>
                                            </tr>
                                            <tr>
                                                <td>Enquiry Number</td>
                                                <td><?php echo $enq[enquiry_id]?></td>
                                            </tr>
                                            <tr>
                                                <td>Date Received</td>
                                                <td><?php echo $enq[dt]?></td>
                                            </tr><tr>
                                                <td>Customer</td>
                                                <td><?php echo getColumn("dbo_clientlist","ClientID",$enq[ClientID],"CompName")?></td>
                                            </tr><tr>
                                                <td>Enquiry Reference</td>
                                                <td><?php echo $enq[reference]?></td>
                                            </tr><tr>
                                                <td>Manufacturer</td>
                                                <td><?php echo $enq[manufacturer]?></td>
                                            </tr><tr>
                                                <td>Description</td>
                                                <td><?php echo $enq[descp]?></td>
                                            </tr><tr>
                                                <td>Closing Date</td>
                                                <td><?php echo $enq[close_dt]?></td>
                                            </tr><tr>
                                                <td>Client Contact</td>
                                                <td><?php echo $enq[client_contact_id]?></td>
                                            </tr><tr>
                                                <td>Our Quote Number</td>
                                                <td>
                                                    <input type="text" id="quote_no" class="form-control" name="quote_no" value="<?php echo $enq[quote_no]?>"/>
                                                    <?php if($enq[quote_no]==0){?><input type="submit" class="btn green" id="genr_quote_btn" name="genr_quote_btn" value="Generate Quote No"/><?php }?>
                                                </td>
                                            </tr><tr>
                                                <td>Quote Date</td>
                                                <td>
                                                <?php
                                                if($enq[quote_dt]!="" && $enq[quote_dt]!="0000-00-00"&& $enq[quote_dt]!="1970-01-01"){
													$quote_dt=$enq[quote_dt];
													//$quote_dt=date("d F, Y",strtotime($quote_dt));
                                                }else{
                                                    $quote_dt=date("Y-m-d");
                                                }
                                                ?>
												<div class="col-md-12 input-group date date-picker" data-date-format="yyyy-mm-dd">
													<input type="text" class="form-control" readonly1 name="quote_dt" id="quote_dt" value="<?php echo $quote_dt?>" />
													<span class="input-group-btn"><button class="btn default" type="button"><i class="fa fa-calendar"></i></button></span>
												</div>
                                                <!-- <input type="text" name="quote_dt" class="form-control datepicker" id="quote_dt" required value="<?php echo $quote_dt;?>" readonly/> -->
                                              </td>
                                            </tr>
                                            <tr>
                                                <td>Remarks</td>
                                                <td><input type="text" id="quote_remarks" class="form-control" name="quote_remarks" value="<?php echo $enq[quote_remarks]?>"/></td>
                                            </tr><tr>
                                                <td>Entered By</td>
                                                <td>&nbsp;</td>
                                            </tr>
                                            <tr>
                                                <td>QuotePending</td>
                                                <td>&nbsp;</td>
                                            </tr>
                                            <tr>
                                                <td><input type="submit" name="enq_updt_btn" class="btn purple" value="Update" /></td>
                                                <td>&nbsp;</td>
                                            </tr>
                                        </tbody></table>
                                        </form>
                                    </td>
                                    <td valign="top" width="33%" align="center">
                                    	<form method="post" action="">
										<input type="hidden" name="enquiry_id" value="<?php echo $enq[enquiry_id]?>"/>
										<table cellspacing="0" border="0" style="width:98%" class="table table-striped table-hover table-bordered">
                                           <tbody>
										    <tr>
                                                <td colspan="2" align="center"><strong>PAYMENT TERMS</strong></td>
                                            </tr>
                                            <tr>
                                                <td>Validity</td>
                                                <td>
                                                  <select class="form-control" id="validity" name="validity">
                                                    <option value=""></option>
                                                    <option value="60 Days" <?php echo ($enq[validity]=="60 Days"?"selected":"")?>>60 Days</option>
                                                    <option value="30 Days" <?php echo ($enq[validity]=="30 Days"?"selected":"")?>>30 Days</option>
                                                    <option value="15 Days" <?php echo ($enq[validity]=="15 Days"?"selected":"")?>>15 Days</option>
                                                    <option value="7 Days" <?php echo ($enq[validity]=="7 Days"?"selected":"")?>>7 Days</option>
                        
                                                </select></td>
                                            </tr>
											<tr>
                                              <td>Delivery Terms</td><td><input type="text" class="form-control" id="price_basis" name="price_basis" value="<?php echo $enq[price_basis]?>"></td>
                                            </tr>
											<tr>
                                              <td>Payment</td>
											  <td>
												<select class="form-control" id="payment" name="payment">
                                                    <option value=""></option>
                                                    <option value="Before Delivery" <?php echo ($enq[payment]=="Before Delivery"?"selected":"")?>>Before Delivery</option>
                                                    <option value="Advance" <?php echo ($enq[payment]=="Advance"?"selected":"")?>>Advance</option>
                                                    <option value="30 Days" <?php echo ($enq[payment]=="30 Days"?"selected":"")?>>30 Days</option>
                                                    <option value="On Reciept of Material" <?php echo ($enq[payment]=="On Reciept of Material"?"selected":"")?>>On Reciept of Material</option>
                                                    <option value="Letter of Credit" <?php echo ($enq[payment]=="Letter of Credit"?"selected":"")?>>Letter of Credit</option>
                                                    <option value="Documents against payment at sight" <?php echo ($enq[payment]=="Documents against payment at sight"?"selected":"")?>>Documents against payment at sight</option>
                                                </select>
											  </td>
                                            </tr>
											<tr>
                                              <td>Delivery</td><td><input type="text" class="form-control" id="delivery" name="delivery" value="<?php echo $enq[delivery]?>"></td>
                                            </tr>
											<tr>
                                              <td>Currency</td>
											  <td>
												<select class="form-control" id="currency" name="currency">
                                                    <option value=""></option>
                                                    <option <?php echo ($enq[currency]=="USD"?"selected":"")?> value="USD">USD</option>
                                                    <option <?php echo ($enq[currency]=="CAD"?"selected":"")?> value="CAD">CAD</option>
                                                    <option <?php echo ($enq[currency]=="EUR"?"selected":"")?> value="EUR">EUR</option>
                                                    <option <?php echo ($enq[currency]=="GBP"?"selected":"")?> value="GBP">GBP</option>
                                                    <option <?php echo ($enq[currency]=="JPY"?"selected":"")?> value="JPY">JPY</option>
                                                    <option <?php echo ($enq[currency]=="AUD"?"selected":"")?> value="AUD">AUD</option>
                        
                                                </select></td>
                                            </tr>
											<tr>
                                                <td>Taxes</td>
												<td><input type="text" class="form-control" value="<?php echo $enq[taxes]?>" id="taxes" name="taxes"></td>
                                            </tr>
											<tr>
                                                <td>Freight</td>
												<td><input type="text" class="form-control" value="<?php echo $enq[freight]?>" id="freight" name="freight"></td>
                                            </tr><tr>
                                                <td>Advance</td><td><input type="text" class="form-control"value="<?php echo $enq[advance]?>" id="advance" name="advance"></td>
                                            </tr>
											<tr>
                                                <td>Quote From</td>
												<td><input type="text" class="form-control" id="quote_from" name="quote_from" value="<?php echo $enq[quote_from]?>"></td>
                                            </tr>
											<tr>
                                                <td align="center" colspan="2">
                                                	<input type="submit" class="btn green" id="sbmt_paymt_termsbtn" value="Insert" name="sbmt_paymt_termsbtn">
                                                    <input type="submit" class="btn" id="cancel" value="Cancel" name="cancel">
                                               	</td>
                                            </tr>
                                          </tbody>
										</table>
										</form>
                                	</td>
                                    <td valign="top" width="33%">
										<form method="get" target="_blank" action="pdf_quote.php">
											<input type="hidden" id="enquiry_id" name="enquiry_id" value="<?php echo $_REQUEST[enquiry_id]?>" />
											<input name="pdf_quote" value="Quotation(PDF)" id="pdf_quote" class="btn" type="submit">
										</form>
                                    </td>
                                </tr>
                            </table>
						  </div>
						</div>  <!-- enq_details -->
					</div>
				</div>
			</div>
        </div>
        <!-- END SAMPLE TABLE PORTLET-->
    </div>

    <!-- END PAGE CONTENT-->
</div>
<!-- END CONTENT -->
<!-- END CONTAINER -->


PK 99