Viewing file: searchreceipt.php (9.06 KB) -rw-r--r-- Select action/file-type: (+) | (+) | (+) | Code (+) | Session (+) | (+) | SDB (+) | (+) | (+) | (+) | (+) | (+) |
<?php include('session.php'); ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title> Receipt</title>
<style type="text/css" media="print"> @page { size: auto; /* auto is the initial value */ margin: 10mm; /* this affects the margin in the printer settings */ } @media print { #Header, #Footer { display: none !important; } } </style> <script type="text/javascript">
function print1(strid) { if(confirm("Do you want to print?")) { var values = document.getElementById(strid); var printing = window.open('','','left=0,top=0,width=550,height=400,toolbar=0,scrollbars=0,sta?tus=0'); printing.document.write(values.innerHTML); printing.document.close(); printing.focus(); printing.print(); printing.close(); } } </script> <style type="text/css"> body { background-color: #F93; } body,td,th { color: #000; } </style> </head> <CENTER> <body> <table width="100%" border="0" bgcolor="#FFFFFF"> <tr> <td ><?php include('header.php'); ?></td> </tr> <tr> <td colspan="2" bgcolor="#999999"><?php include('menubar.php'); ?></td> </tr> <tr> <td colspan="2" bgcolor="#999999"><table width="100%" border="0"> <tr> <td width="522" align="left">Welcome <?php echo $user ?></td> <td width="293" align="left"><a href="logout.php">Logout</a></td> <td width="59" align="left"><?php echo "Today is " . date("d/m/y") . "<br>";?></td> <td width="81" align="left"> </td> </tr> </table> </td> </tr> <tr> <td colspan="2"><table width="100%" border="0"> <tr> <td align="left" bgcolor="#999999"><form action="" method="get" name="form"> Enter Receipt No : <?php // Create connection $con=mysqli_connect("localhost","sarkmicr_user","rb!sar838","sarkmicr_data");
// Check connection if (mysqli_connect_errno())
// Check connection if (mysqli_connect_errno()) { echo "Failed to connect to MySQL: " . mysqli_connect_error(); } else { echo "We are connected."; }
$result = mysqli_query($con,"SELECT ID, receipt_no FROM new_acc WHERE plan_name like \"RD\" "); ?> <select name="q" id="q" > <? while($row = mysqli_fetch_array($result)) { echo "<option value='" . $row['receipt_no'] . "'>" . $row['receipt_no'] . "</option>"; } ?> </select> <input type="submit" name="Submit" value="Search" /> </form></td> </tr> <tr> <td bgcolor="#FFFFFF"> </td> </tr> </table> <?php
// Get the search variable from URL
$var = @$_GET['q'] ; $trimmed = trim($var); //trim whitespace from the stored variable
// rows to return $limit=1;
// check for an empty string and display a message. if ($trimmed == "") { exit; }
// check for a search parameter if (!isset($var)) { echo "<p>We dont seem to have a search parameter!</p>"; exit; }
mysql_connect("localhost","sarkmicr_user","rb!sar838"); //(host, username, password)
//specify database ** EDIT REQUIRED HERE ** mysql_select_db("sarkmicr_data") or die("Unable to select database"); //select which database we're using
$field = 'receipt2'; // Build SQL Query $query = "select * from create_receipt where $field like \"$trimmed\" "; // EDIT HERE and specify your table and field names for the SQL query
$numresults=mysql_query($query); $numrows=mysql_num_rows($numresults);
// If we have no results, offer a google search as an alternative
if ($numrows == 0) { echo " Sorry, $trimmed this Number is not found";
}
// next determine if s has been passed to script, if not use 0 if (empty($s)) { $s=0; }
// get results $query .= " limit $s,$limit"; $result = mysql_query($query) or die("Couldn't execute query");
// begin to show results set
$count = 1 + $s ;
// now you can display the results returned while ($row= mysql_fetch_array($result)) { $genreceipt=$row['receipt2']; $printdate=$row['jdate'].'/'.$row['jmonth'].'/'.$row['jyear']; $nddate= $row['njdate'].'/'.$row['njmonth'].'/'.$row['njyear']; $account=$row['acc_no']; $accountname=$row['cname'].$row['accountholder']; $noofinstall=$row['noofinstallment']; $address=$row['address'].$row['village'].''.$row['post'].''. $row['distt'].''. $row['pin']; $planname=$row['planname']; $branchname=$row['branch_name']; $nextinstdate=$row['next_inst']; $depositby=$row['depositby']; $agentcode=$row['agentcode']; $planperiod=$row['plantime']; $amount=$row['amount']; $amountinword=$row['amountrups']; $matamount=$row['maturamount']; $matdate=$row['maturdate']; $ndate=$row['jdate']; $nmonth=$row['month']; $nyear=$row['jyear']; $mcode=$row['mcode']; $eecode=$row['agentcode']; $application=$row['allication']; $depositby=$row['depositby']; $pt=$row['pt'];
$count++ ; }
$currPage = (($s/$limit) + 1);
//break before paging echo "";
// next we need to do the links to other results if ($s>=1) { // bypass PREV link if s is 0 $prevs=($s-$limit); print "<a href=\"$PHP_SELF?s=$prevs&q=$var\"><< Prev 10</a> "; }
// calculate number of pages needing links $pages=intval($numrows/$limit);
// $pages now contains int of pages needed unless there is a remainder from division
?> <div id="print2"> <table width="900" border="0" cellspacing="0" cellpadding="0"> <tr> <td height="250" colspan="4"><p><img src="images/receiptbanner.jpg" width="100%" height="150" /></p> </td> </tr> <tr> <td width="154" align="left" bgcolor="#EBEBEB"><strong>Receipt No</strong></td> <td width="229" align="left" bgcolor="#EBEBEB"><?php echo $genreceipt ?></td> <td width="142" align="left" bgcolor="#EBEBEB"><strong>Print Date</strong></td> <td width="365" align="left" bgcolor="#EBEBEB"><?php echo $printdate ?></td> </tr> <tr> <td align="left"><strong>Branch Name</strong></td> <td align="left"><?php echo $branchname ?></td> <td align="left"><strong>Branch Code</strong></td> <td align="left"><?php echo $branchname ?></td> </tr> <tr> <td align="left"><strong>Name</strong></td> <td align="left"><?php echo $accountname ?></td> <td align="left"> </td> <td align="left"> </td> </tr> <tr> <td align="left" valign="top"><strong>Applicant Address</strong></td> <td colspan="3" align="left" valign="top"><?php echo $address ?> <p> </p></td> </tr> <tr> <td align="left"><strong>Deposit Amount</strong></td> <td align="left"><?php echo $amount?></td> <td align="left"><strong>Amount In Word</strong></td> <td align="left"><?php echo $amountinword ?></td> </tr> <tr> <td align="left"> </td> <td align="left"> </td> <td align="left"><strong>Deposit Date</strong></td> <td align="left"><?php echo $printdate ?></td> </tr> <tr> <td align="left"><strong>Redemmption Amount</strong></td> <td align="left"><?php echo $matamount ?></td> <td align="left"><strong>Redemmption Date</strong></td> <td align="left"><?php echo $matdate ?></td> </tr> <tr> <td align="left"><strong>Application No</strong></td> <td align="left"><?php echo $application ?></td> <td align="left"><strong>Next Due Date</strong></td> <td align="left"><?php echo $nddate ?></td> </tr> <tr> <td align="left"><strong>Account No</strong></td> <td align="left"><?php echo $account ?></td> <td align="left"><strong>Plan Period</strong></td> <td align="left"><?php echo $planperiod. "Months"?></td> </tr> <tr> <td align="left"><strong>Plan Name</strong></td> <td align="left"><?php echo $planname .'-'.$pt ?></td> <td align="left"><strong>Installment No</strong></td> <td align="left"><?php echo $noofinstall ?></td> </tr> <tr> <td align="left"><strong>Late Fine</strong></td> <td align="left"><?php echo ''?></td> <td align="left"><strong>Deposit By</strong></td> <td align="left"><?php echo $depositby ?></td> </tr> <tr> <td align="left"><strong>Employee Code</strong></td> <td align="left"><?php echo $eecode ?></td> <td align="left"><strong>Member Code</strong></td> <td align="left"><?php echo $mcode ?></td> </tr> <tr> <td align="left"> </td> <td align="left"> </td> <td align="left"> </td> <td align="left"> </td> </tr> <tr> <td align="left"> </td> <td align="left"> </td> <td align="left"> </td> <td align="left"> </td> </tr> <tr> <td align="left"> </td> <td align="left"> </td> <td align="left"> </td> <td align="left">Authorised Signatory</td> </tr> </table> </div> <table width="300" border="0" cellspacing="10" cellpadding="10"> <tr> <td><form action=""><input type="button" value="New" onclick="window.location.href='createreceipt.php';"/> </form> </td><form action=""> <td><input type="button" name="printbutton" value="Print Receipt" onclick="return print1('print2')"/></form></td> </tr> </table>
</body></center> </html>
|