maideen
-
Posts
36 -
Joined
-
Last visited
Posts posted by maideen
-
-
thanks mec_gyver
Once removed mysqli_close($con);
it works fine
Tq.
-
Hi.
I am new. I don't know how to validate certain data like emai, web site and numeric value. Here is my code which is work fine. Below is my code.
Pls Help me
add.php<?php include_once '../inc/header.php'; ?> <Script Language="javascript"> function change_action() { var frm_obj=document.getElementById("frm"); frm_obj.action="data.php"; } </Script> <form action="" method="POST" id="frm" > <table class="" align="center" cellpadding="4" cellspacing="1"> <tr> <td><label class="lbl">ID </label></td> <td><label class="lbl">: </label></td> <td><input type="text" name="id" id="id" readonly="" class="txt"></td> </tr> <tr> <td><label class="lbl">Name </label></td> <td><label class="lbl">: </label></td> <td><input type="text" name="name" id="name" class="txt"></td> </tr> <tr> <td><label class="lbl">Address </label></td> <td><label class="lbl">: </label></td> <td><textarea name="address" id="address" class="txt" rows="5" cols="40"></textarea></td> </tr> <tr> <td><label class="lbl">Tel</label></td> <td><label class="lbl">: </label></td> <td><input type="text" name="tel" id="tel" class="txt"></td> </tr> <tr> <td><label class="lbl">Fax</label></td> <td><label class="lbl">: </label></td> <td><input type="text" name="fax" id="fax" class="txt"></td> </tr> <tr> <td><label class="lbl">Email</label></td> <td><label class="lbl">: </label></td> <td><input type="text" name="email" id="email" class="txt"></td> </tr> <tr> <td><label class="lbl">Web site</label></td> <td><label class="lbl">: </label></td> <td><input type="text" name="website" id="website" class="txt"></td> </tr> <tr> <td><label class="lbl">Type</label></td> <td><label class="lbl">: </label></td> <!--<td><input type="text" name="type" id="type" class="txt"></td>--> <td> <SELECT NAME=type id="type"> <OPTION VALUE=0>Choose <?php $sql="SELECT * FROM bk_parameter where type='typcs' order by id"; $result = mysqli_query($con,$sql); while($row = mysqli_fetch_array($result)) { $typename=$row["name"]; echo "<OPTION VALUE=\"$typename\">".$typename.'</option>'; } ?> </SELECT> </td> </tr> <tr> <td></td> <td></td> <td><input type="submit" value="submit" name="submit" class="btn" onclick="change_action()"> <input type="submit" value="back" name="back" class="btn" onclick="change_action()"></td> </tr> </table> </form> <?php include_once '../inc/footer.php'; ?>
data.php
<?php include_once '../inc/header.php'; //insert into table if (isset($_POST['submit']) && $_POST['submit'] != "" ) { $name = ($_POST["name"]); $address = ($_POST["address"]); $tel = ($_POST["tel"]); $fax = ($_POST["fax"]); $email = ($_POST["email"]); $website = ($_POST["website"]); $type = ($_POST["type"]); try { $sql="INSERT INTO bk_customer (name,address,tel,fax,email,website,type) VALUES ('$name','$address','$tel','$fax','$email','$website','$type')"; $result = mysqli_query($con,$sql) ; header("Location:index.php"); exit(); } catch (Exception $ex) { echo $e->getMessage() . "\n"; file_put_contents('PDOErrors.txt', $e->getMessage(), FILE_APPEND); exit(); } } //mysqli_close($con); // update table if (isset($_POST['update']) && $_POST['update'] != "" ) { $id= ($_POST["id"]); $name = ($_POST["name"]); $address = ($_POST["address"]); $tel = ($_POST["tel"]); $fax = ($_POST["fax"]); $email = ($_POST["email"]); $website = ($_POST["website"]); $type = ($_POST["type"]); try { $sql="UPDATE bk_customer SET name='$name',address='$address', tel='$tel',fax='$fax'," . "email='$email', website='$website',type='$type' WHERE id='$id'"; $result = mysqli_query($con,$sql) ; header("Location:index.php"); } catch (Exception $ex) { echo $e->getMessage() . "\n"; file_put_contents('PDOErrors.txt', $e->getMessage(), FILE_APPEND); exit(); } } // update record if (isset($_POST['delete']) && $_POST['delete'] != "" ) { $id=$_POST["id"]; try { $sql="DELETE FROM bk_customer WHERE id='$id'"; $result = mysqli_query($con,$sql) ; header("Location:index.php"); } catch (Exception $ex) { echo $e->getMessage() . "\n"; file_put_contents('PDOErrors.txt', $e->getMessage(), FILE_APPEND); exit(); } } // back to index.php if (isset($_POST['back']) && $_POST['back'] != "" ) { header("Location:index.php"); }
-
hi ginerjm
I have echoed. It is fine. But the below error
It is echoed. it is fine
500 Kinney 661.64 af blandit.mattis@nonleoVivamus.ca www.mujveqthwgg.oys supplier
Warning: mysqli_query(): Couldn't fetch mysqli in
C:\xampp\htdocs\bkstore\customer\add_data.php on line 59
pls help me. -
Hi
I have another issue in Update. Could not be updated. pls help me
if (isset($_POST['update']) && $_POST['update'] != "" ) { $id=$_POST["id"]; $name = $_POST["name"]; $address = $_POST["address"]; $tel = $_POST["tel"]; $fax = $_POST["fax"]; $email = $_POST["email"]; $website = $_POST["website"]; $type = $_POST["type"]; try { $sql="UPDATE bk_customer SET name='$name',address='$address', tel='$tel',fax='$fax',email='$email', website='$website',type='$type' WHERE id='$id'"; $result = mysqli_query($con,$sql) ; // $result=mysqli_fetch_assoc($con,$sql); } catch (Exception $ex) { echo $e->getMessage() . "\n"; file_put_contents('PDOErrors.txt', $e->getMessage(), FILE_APPEND); exit(); } }
-
hi
Thanks for your comment
I have solved, just remove the id. Works fine.
Thank you
maideen
-
Hi
I am new in php. I could not insert the data into mysql table. and there is no error prompt Below is my code. Pls help me.
<?php include_once '../inc/header.php'; if (isset($_POST['submit']) && $_POST['submit'] != "" ) { $name = $_POST["name"]; $address = $_POST["address"]; $tel = $_POST["tel"]; $fax = $_POST["fax"]; $email = $_POST["email"]; $website = $_POST["website"]; $type = $_POST["type"]; try { $sql="INSERT INTO bk_customer (id,name,address,tel,fax,email,type,website) VALUES ('$name','$address','$tel','$fax','$email','$website','$type')"; $result = mysqli_query($con,$sql) ; exit(); } catch (Exception $ex) { echo $e->getMessage() . "\n"; file_put_contents('PDOErrors.txt', $e->getMessage(), FILE_APPEND); exit(); } } mysqli_close($con); ?>
-
hi Ch0cu3r
When I use below code, i got id of last record. If I have 100 record in database, I shows last record i.e 100. But I need what I selected. Pls help me
<Script Language="javascript"> function change_action() { var frm_obj=document.getElementById("frm"); frm_obj.action="data.php"; } </Script> <form action="" method="POST" id="frm" > <table width="100%" align="center" cellpadding="4" cellspacing="1"> <tr> <td>ID</td> <td>ID</td> <td>NAME</td> <td>FIRST NAME</td> <td>AGE</td> <td></td> </tr>
<?php if(isset($result)){ while($row = mysqli_fetch_array($result)){ ?> <tr> <td><input type="hidden" name="vid" id="id" value="<?php echo $row['id'];?>"></td> <td><?php echo $row['id'];?></td> <td><?php echo $row['name'];?></td> <td><?php echo $row['firstname'];?></td> <td><?php echo $row['age'] ;?></td> <td><input type="submit" value="update" name="update" onclick="change_action()"> <input type="submit" value="delete" name="delete" onclick="change_action()"> </td> </tr> <?php } } mysqli_close($con); ?>
<?php include_once '../../inc/config.inc.php'; if (isset($_POST['update']) && $_POST['update'] != "" ) { $id = $_POST["vid"]; $sql="SELECT * FROM demo where id='$id'"; $result = mysqli_query($con,$sql); include 'edit.php'; //header("Location:edit.php"); }
-
I am telling the scnario. I have page with all customer data as grid format. last column is "UPDATE". If I select 5th row and click update, next page open the details of 5th row customer data.My sql command:$sql="select id,name,firstname,age from customer where id='$id'"How can i pass the id for select customer to the next page to retrive data from mysql database and to update if any changes.Pls help meID NAME FIRST NAME AGE1 Hoffman Tatyana 100 Update2 Atkins Ishmael 44 Update3 Hamilton Mohammad 73 Update4 Murray Troy 18 Update5 Schwartz Carla 79 Update6 Bond Leno 33 Update7 Noble Georgia 88 Update8 Frederick Bradley 80 Update9 Chambers Aphrodite 63 Update10 Schultz Allegra 90 Update11 Garrett Lillith 20 Update12 Mcdaniel Venus 89 Update13 Acevedo Iola 26 Update
-
Hi Guru
This is the post action
Basically page shows all data as table format with id. If i click the selected update button, the id of selected row to be posted into next pages to retrive the data of the particular Id. Can you pls explain how to do?
<form action="" method="POST" id="frm" >
<table width="100%" align="center" cellpadding="4" cellspacing="1">
<tr>
<td>ID</td>
<td>ID</td>
<td>NAME</td>
<td>FIRST NAME</td>
<td>AGE</td>
<td></td>
</tr>
<?php
if(isset($result)){
while($row = mysqli_fetch_array($result)){ ?>
<tr>
<td><input type="text" name="vid" value="<?php echo $row['id'];?>"/></td>
<td><?php echo $row['id'];?></td>
<td><?php echo $row['name'];?></td>
<td><?php echo $row['firstname'];?></td>
<td><?php echo $row['age'] ;?></td>
<td><input type="submit" value="update" name="update" onclick="change_action()">
<input type="submit" value="delete" name="delete" onclick="change_action()">
</td>
</tr>
<?php
} -
Hi
I am new, Pls help me the following issue. When click the update button, ID should be to another page to process the update function. Below is my entire code
index.php<?php include_once '../../inc/config.inc.php'; $sql="SELECT * FROM demo order by id"; try { $result = mysqli_query($con,$sql); include 'view.html.php'; } catch (PDOException $e) { echo $e->getMessage() . "\n"; file_put_contents('PDOErrors.txt', $e->getMessage(), FILE_APPEND); // $output = 'Error fetching authors from database!'; // include '../../notification/errormsg.php'; exit(); }
view.html.php
<Script Language="javascript"> function change_action() { var frm_obj=document.getElementById("frm"); frm_obj.action="data.php"; } </Script> <h3>User Details</h3> <form action="" method="POST" id="frm" > <table width="100%" align="center" cellpadding="4" cellspacing="1"> <tr> <td>ID</td> <td>ID</td> <td>NAME</td> <td>FIRST NAME</td> <td>AGE</td> <td></td> </tr> <?php if(isset($result)){ while($row = mysqli_fetch_array($result)){ ?> <tr> <td><input type="text" name="vid" value="<?php echo $row['id'];?>"/></td> <td><?php echo $row['id'];?></td> <td><?php echo $row['name'];?></td> <td><?php echo $row['firstname'];?></td> <td><?php echo $row['age'] ;?></td> <td><input type="submit" value="update" name="update" onclick="change_action()"> <input type="submit" value="delete" name="delete" onclick="change_action()"> </td> </tr> <?php } } mysqli_close($con); ?> </table> </FORM> <?php include '../../inc/footer.php';
data.php
<Script Language="javascript"> function change_action() { var frm_obj=document.getElementById("frm"); frm_obj.action="data.php"; } </Script> <h3>User Details</h3> <form action="" method="POST" id="frm" > <table width="100%" align="center" cellpadding="4" cellspacing="1"> <tr> <td>ID</td> <td>ID</td> <td>NAME</td> <td>FIRST NAME</td> <td>AGE</td> <td></td> </tr> <?php if(isset($result)){ while($row = mysqli_fetch_array($result)){ ?> <tr> <td><input type="text" name="vid" value="<?php echo $row['id'];?>"/></td> <td><?php echo $row['id'];?></td> <td><?php echo $row['name'];?></td> <td><?php echo $row['firstname'];?></td> <td><?php echo $row['age'] ;?></td> <td><input type="submit" value="update" name="update" onclick="change_action()"> <input type="submit" value="delete" name="delete" onclick="change_action()"> </td> </tr> <?php } } mysqli_close($con); ?> </table> </FORM> <?php include '../../inc/footer.php';
edit.php
<?php echo 'edit.php'; if(isset($result)) { while($row = mysqli_fetch_array($result)) { echo $row['id'];'<br>'; echo $row['name'];'<br>'; echo $row['firstname'];'<br>'; echo $row['age'];'<br>'; } }
Tq
Maideen
-
Hi
I am new in php. Below code works fine. But If I change Select Command Like this:
$sql = "SELECT login_id,password FROM user_right WHERE login_id = '$username' and password = '$password'";
It shows error recorde not found. Also I need to show the role of select user.Pls Help me
<?php include_once'../inc/header.php'; if (isset($_POST['submit']) && $_POST['submit'] != "" ) { if(empty($_POST['username'])) { $handleError = "User is empty!"; $_SESSION["errormsg"] = $handleError; header("Location:../notification/errormsg.php"); //echo $handleError; return false; } if(empty($_POST['password'])) { $handleError = "Password is empty!"; $_SESSION["errormsg"] = $handleError; header("Location:../notification/errormsg.php"); //echo $handleError; return false; } $username = trim($_POST['username']); $password = trim($_POST['password']); try { $sql = "SELECT * FROM user_right WHERE login_id = '$username' and password = '$password'"; $stmt = $dbh->prepare($sql); $stmt->setFetchMode(PDO::FETCH_ASSOC); if ($stmt = $dbh->query($sql)) { if ($stmt->fetchColumn() > 0) { $_SESSION["username"] = $username; $_SESSION["password"] = $password; header("Location:../admin/"); exit(); } else { $handleError="user name or password is wrong"; $_SESSION["errormsg"] = $handleError; header("Location:../notification/errormsg.php"); exit(); }; } } catch (PDOException $e) { echo $e->getMessage() . "\n"; file_put_contents('PDOErrors.txt', $e->getMessage(), FILE_APPEND); } } include '../inc/footer.php';
-
hi
Thank you of you to give the suggestion to solve the problem.
there was wrong in Search.php
Here is the code working fine
<?php $query = $_GET['query']; echo $query; $stmt = $dbh->query("SELECT * FROM CompanyInfo WHERE (Name LIKE '%".$query."%' OR Address LIKE '%".$query."%')"); $stmt->setFetchMode(PDO::FETCH_ASSOC); if(isset($stmt)) { while($row = $stmt->fetch()){ ?> <tr> <td><?php echo $row['Name'];?></td> <td><?php echo $row['Address'];?></td> </tr> <?php echo $row['Name']; } }?>
Thank you very much once again
-
Hi
I have tried this command too. Nothing happend.
pls
maideen
-
Hi
I have one problem , I need to search any string data . Below my code. When I click, no results as well as no error
Index.php
<?php include_once '../templete/header.php'; ?> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>Search</title> <link href="style.css" rel="stylesheet" type="text/css" /> </head> <body> <form action="search.php" method="get" > <table border="0" cellpadding="0" cellspacing="0"> <tr> <td><input type="text" name="query" id="text" /> </td> <td><input type="submit" name="submit" id="search" value="Search" /></td> </form> </body> </html>
Search.php
<?php include_once '../templete/header.php'; include_once '../inc/connection.inc.php'; ?> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>Search</title> <link href="style.css" rel="stylesheet" type="text/css" /> </head> <body> <table> <tr> <td>Name</td> <td>Address</td> </tr> <?php $query = $_GET['query']; $stmt = $dbh->prepare("SELECT * FROM CompanyInfo WHERE (Name LIKE '%".$query."%') OR (Address LIKE '%".$query."%')"); $stmt->setFetchMode(PDO::FETCH_ASSOC); //$stmt->execute(); if(isset($stmt)) { while($row = $stmt->fetch()); ?> <tr> <td><?php echo $row['Name'];?></td> <td><?php echo $row['Address'];?></td> </tr> <?php } ?> </table> </body> </html>
Pls help me
Maideen
-
Hi
page button
I have tried many way but results both page and printer dialog box appear.
Pls help me.
Maideen
-
hi
The above code works fine. no problem. when click the print button it opens two pages
Print.html.php is printing page
One is the printer dialog another is print.html.php with data.
But i need only print dialog page.
Pls help me
maideen
-
hi. i have a problem in printing the report to printer. Now i can print the php reports, but it will open both printer dialog and page together. But I need only one to printer dialog box. Pls help meBelow code i working fine. But only in print the reports i have issueBelow my codeConnection database
<?php try { $hostname = "sqlserver2005"; //host $dbname = "dbdata"; //db name $username = "sa"; // username like 'sa' $pw = "pass5"; // password for the user $dbh = new PDO ("mssql:host=$hostname;dbname=$dbname","$username","$pw"); } catch (PDOException $e) { echo "cannot find the server. pls check your administrator " . $e->getMessage() . "\n"; file_put_contents('PDOErrors.txt', $e->getMessage(), FILE_APPEND); exit; } ?>
Index file
<?php include_once '../inc/connection.inc.php'; ?> <?php try { $stmt = $dbh->prepare('SELECT * FROM StudentRecord order by Name'); $stmt->execute(); } catch (PDOException $e) { $output = 'Error fetching authors from database!'; include '../errormsg.php'; exit(); } foreach ($stmt as $row) { $sid[] = array('SID' => $row['SID'], 'Name' => $row['Name']); } include 'searchform.html.php'; ?>
searchform.html.php
<?php include '../templete/header.php'; ?> <Script Language="javascript"> function change_action() { var frm_obj=document.getElementById("frm"); frm_obj.action="data.php"; } </Script> <script language="javascript" type="text/javascript"> </script> <table class="tbl_table" align="center"> <form action="" method="POST" id="frm" > <tr> <td class="td_title" colspan="2"><strong>Help Printing</strong></td> </tr> <tr> <td class="td_class_right">Student Name</td> <td> <select name="sid" id="sid"><option value="">Student ID</option> <?php foreach ($sid as $sids): ?> <option value="<?php htmlout($sids['SID']); ?>"> <?php htmlout($sids['Name']);?> <?php htmlout($sids['SID']);?> </option> <?php endforeach; ?> </select> </td> <tr> <td class="td_button" colspan="2"> <input class="buttondesign" type="submit" value="Search" name="search" onclick="change_action()"> <input class="buttondesign" type="submit" value="print" name="print" onclick="change_action()"> </td> </tr> </form> </table>
data.php
<?php include_once '../inc/connection.inc.php'; ?> <?php if (isset($_POST['search']) && $_POST['search'] != "" ) { $sid = $_POST["sid"]; $stmt = $dbh->query("SELECT * FROM vwStatementOpen WHERE SID='$sid' ORDER BY RCDate"); $stmt->setFetchMode(PDO::FETCH_ASSOC); include 'view.html.php'; } ?> <?php if (isset($_POST['print']) && $_POST['print'] != "" ) { $sid = $_POST["sid"]; $stmt = $dbh->query("SELECT * FROM vwStatementOpen WHERE SID='$sid' ORDER BY RCDate"); $stmt->setFetchMode(PDO::FETCH_ASSOC); include 'print.html.php'; } ?>
view.htm.php
<?php include '../templete/header.php'; $total=0; $scoursefee = 0; $sinipay = 0; $sdisc = 0; $scholar = 0; $nomonth = 0; $totalpaid=0; $balance=0; $totalother=0; $totaloverall=0; ?> <?php $sid = $_POST["sid"]; $s = $dbh->query("SELECT * FROM StudentRecord WHERE SID='$sid'"); $s->execute(); while($row = $s->fetch()) { $ssid = $row['SID']; $sname = $row['Name']; $snric = $row['NRIC']; $scoursecode = $row['CourseCode']; $spaytype = $row['PayMode']; $scoursefee = $row['CourseFee']; $sinipay = $row['IniPayment']; $sdisc = $row['Discount']; $scholar = $row['ScholarShip']; $nomonth = $row['NoMonths']; } $a = $dbh->query("SELECT SUM(Amount) as Amount FROM vwStatement WHERE SID='$sid'"); $a->execute(); while($row = $a->fetch()) { $totalpaid=$row['Amount']; } $balance=$scoursefee-$totalpaid; $b = $dbh->query("SELECT SUM(Amount) as Amount FROM vwStatementopen WHERE SID='$sid'"); $b->execute(); while($row = $b->fetch()) { $totaloverall=$row['Amount']; } $totalother=$totaloverall-$totalpaid ?> <div class="title">Statement</div> <hr /> <table align="center" cellpadding="1" cellspacing="1" style="width: 100%" > <tr> <td class="tdempty" style="width: 30px"></td> <td class="labeldesign_statement" style="width: 114px">Student ID</td> <td class="labeldesign_statement" style="width: 34px">:</td> <td class="labeldesign_statement"><?php echo htmlout($ssid);?></td> <td class="tdempty" style="width: 30px"></td> <td class="labeldesign_statement" style="width: 114px">Course Fee</td> <td class="labeldesign_statement" style="width: 27px">:</td> <td class="labeldesign_statement"><?php echo number_format($scoursefee,2);?></td> <td class="tdempty" style="width: 30px"></td> <td class="labeldesign_statement" style="width: 114px">Total Paid(Fee)</td> <td class="labeldesign_statement" style="width: 27px">:</td> <td class="labeldesign_statement"><?php echo number_format($totalpaid,2);?></td> </tr> <tr> <td class="tdempty" style="width: 30px"></td> <td class="labeldesign_statement" style="width: 114px">Student Name</td> <td class="labeldesign_statement" style="width: 34px">:</td> <td class="labeldesign_statement"><?php echo htmlout($sname);?></td> <td class="tdempty" style="width: 30px"></td> <td class="labeldesign_statement" style="width: 114px">Initial Payment</td> <td class="labeldesign_statement" style="width: 27px">:</td> <td class="labeldesign_statement"><?php echo number_format($sinipay,2);?></td> <td class="tdempty" style="width: 30px"></td> <td class="labeldesign_statement" style="width: 114px">Balance(Fee)</td> <td class="labeldesign_statement" style="width: 27px">:</td> <td class="labeldesign_statement"><?php echo number_format($balance,2);?></td> </tr> <tr> <td class="tdempty" style="width: 30px"></td> <td class="labeldesign_statement" style="width: 114px">NRIC/PP</td> <td class="labeldesign_statement" style="width: 34px">:</td> <td class="labeldesign_statement"><?php echo htmlout($snric);?></td> <td class="tdempty" style="width: 30px"></td> <td class="labeldesign_statement" style="width: 114px">Discount</td> <td class="labeldesign_statement" style="width: 27px">:</td> <td class="labeldesign_statement"><?php echo number_format($sdisc,2);?></td> <td class="tdempty" style="width: 30px"></td> <td class="labeldesign_statement" style="width: 114px">Total Paid(Others)</td> <td class="labeldesign_statement" style="width: 27px">:</td> <td class="labeldesign_statement"><?php echo number_format($totalother,2);?></td> </tr> <tr> <td class="tdempty" style="width: 30px"></td> <td class="labeldesign_statement" style="width: 114px">Course</td> <td class="labeldesign_statement" style="width: 34px">:</td> <td class="labeldesign_statement"><?php echo htmlout($scoursecode);?></td> <td class="tdempty" style="width: 30px"></td> <td class="labeldesign_statement" style="width: 114px">Scholarship</td> <td class="labeldesign_statement" style="width: 27px">:</td> <td class="labeldesign_statement"><?php echo number_format($scholar,2);?></td> <td class="tdempty" style="width: 30px"></td> <td class="labeldesign_statement" style="width: 114px">Total Paid(Overall)</td> <td class="labeldesign_statement" style="width: 27px">:</td> <td class="labeldesign_statement"><?php echo number_format($totaloverall,2);?></td> </tr> <tr> <td class="tdempty" style="width: 30px"></td> <td class="labeldesign_statement" style="width: 114px">Pay Type</td> <td class="labeldesign_statement" style="width: 34px">:</td> <td class="labeldesign_statement"><?php echo htmlout($spaytype);?></td> <td class="tdempty" style="width: 30px"></td> <td class="labeldesign_statement" style="width: 114px">No of Month</td> <td class="labeldesign_statement" style="width: 27px">:</td> <td class="labeldesign_statement"><?php echo number_format($nomonth);?></td> </tr> </table> <table width="100%" align="center" cellpadding="4" cellspacing="1"> <tr> <td class="tdempty"></td> <td class="tbl_header">Receipt No</td> <td class="tbl_header">Receipt Date</td> <td class="tbl_header">Description</td> <td class="tbl_header">Mode</td> <td class="tbl_header">Cheque No</td> <td class="tbl_header_right">Amount</td> <td class="tdempty"></td> </tr> <?php if(isset($stmt)) { while($row = $stmt->fetch()) {?> <tr> <td class="tdempty"></td> <td class="tbl_content"><?php echo $row['RCNo'];?></td> <td class="tbl_content"><?php echo date("d-m-Y", strtotime($row['RcDate']));?></td> <td class="tbl_content"><?php echo $row['Rcvdfor'];?></td> <td class="tbl_content"><?php echo $row['Mode'];?></td> <td class="tbl_content"><?php echo $row['ChqNo'];?></td> <td class="tbl_content_right"><?php echo number_format($row['Amount'],2) ;?></td> <td class="tdempty"></td> </tr> <?php $total+=$row['Amount']; }}?> <tr><td colspan="9"><hr /></td></tr> <tr> <td colspan="6"></td> <td class="tbl_subtotal_right"> <?php echo number_format($total,2);?></td> </tr> </table> <?php unset($dbh); unset($stmt); ?> <?php include '../templete/footer.php'; ?>
print_head.php
<?php include '../inc/connection.inc.php'; include_once '../inc/html_function.php'; $comp = $dbh->query("SELECT * FROM CompanyInfo"); $comp->execute(); while($row = $comp->fetch()) { $cname = $row['Name']; $caddress = $row['Address']; $ctel=$row['Tel']; $cfax=$row['Fax']; $cemail=$row['Email']; } ?> <!DOCTYPE html> <html lang="en"> <!--<META HTTP-EQUIV="REFRESH" CONTENT="120">--> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>HCK reporting Service-PHP</title> <link rel="shortcut icon" href="../image/102.ICO" /> <link rel="stylesheet" type="text/css" href="../css/print.css"> <!--<a href="http://www.silsnetwork.com"><img id="logo" src="../image/logo.jpg" alt="sils" /></a>--> <div class="title"><?php htmlout($cname)?></div> <div class="address"><?php htmlout($caddress)?></div> <div class="address">Tel:<?php htmlout($ctel)?> Fax:<?php htmlout($cfax)?> Email:<?php htmlout($cemail)?> </div> <div class="address"><hr /> </div> <div class="clickon_display"> <!--<a href="javascript:window.print();">Printed on :- <?php echo date("M d, Y"); ?> </a>--> </div> <!--<a href="javascript:window.print();"><?php echo $title; ?> </a>--> <!--<a href="javascript:window.print();"><h6>Titel of reports</h6></a>--> <script language="Javascript1.2"> function printpage() { window.print(); } </script> </head> <body onload="printpage()">
print.html.php
<?php include '../templete/print_head.php'; $total=0; $scoursefee = 0; $sinipay = 0; $sdisc = 0; $scholar = 0; $nomonth = 0; $totalpaid=0; $balance=0; $totalother=0; $totaloverall=0; ?> <?php $sid = $_POST["sid"]; $s = $dbh->query("SELECT * FROM StudentRecord WHERE SID='$sid'"); $s->execute(); while($row = $s->fetch()) { $ssid = $row['SID']; $sname = $row['Name']; $snric = $row['NRIC']; $scoursecode = $row['CourseCode']; $spaytype = $row['PayMode']; $scoursefee = $row['CourseFee']; $sinipay = $row['IniPayment']; $sdisc = $row['Discount']; $scholar = $row['ScholarShip']; $nomonth = $row['NoMonths']; } $a = $dbh->query("SELECT SUM(Amount) as Amount FROM vwStatement WHERE SID='$sid'"); $a->execute(); while($row = $a->fetch()) { $totalpaid=$row['Amount']; } $balance=$scoursefee-$totalpaid; $b = $dbh->query("SELECT SUM(Amount) as Amount FROM vwStatementopen WHERE SID='$sid'"); $b->execute(); while($row = $b->fetch()) { $totaloverall=$row['Amount']; } $totalother=$totaloverall-$totalpaid ?> <div class="title">Statement</div> <hr /> <table align="center" cellpadding="1" cellspacing="1" style="width: 100%" > <tr> <td class="tdempty" style="width: 30px"></td> <td class="labeldesign_statement" style="width: 114px">Student ID</td> <td class="labeldesign_statement" style="width: 34px">:</td> <td class="labeldesign_statement"><?php echo htmlout($ssid);?></td> <td class="tdempty" style="width: 30px"></td> <td class="labeldesign_statement" style="width: 114px">Course Fee</td> <td class="labeldesign_statement" style="width: 27px">:</td> <td class="labeldesign_statement"><?php echo number_format($scoursefee,2);?></td> <td class="tdempty" style="width: 30px"></td> <td class="labeldesign_statement" style="width: 114px">Total Paid(Fee)</td> <td class="labeldesign_statement" style="width: 27px">:</td> <td class="labeldesign_statement"><?php echo number_format($totalpaid,2);?></td> </tr> <tr> <td class="tdempty" style="width: 30px"></td> <td class="labeldesign_statement" style="width: 114px">Student Name</td> <td class="labeldesign_statement" style="width: 34px">:</td> <td class="labeldesign_statement"><?php echo htmlout($sname);?></td> <td class="tdempty" style="width: 30px"></td> <td class="labeldesign_statement" style="width: 114px">Initial Payment</td> <td class="labeldesign_statement" style="width: 27px">:</td> <td class="labeldesign_statement"><?php echo number_format($sinipay,2);?></td> <td class="tdempty" style="width: 30px"></td> <td class="labeldesign_statement" style="width: 114px">Balance(Fee)</td> <td class="labeldesign_statement" style="width: 27px">:</td> <td class="labeldesign_statement"><?php echo number_format($balance,2);?></td> </tr> <tr> <td class="tdempty" style="width: 30px"></td> <td class="labeldesign_statement" style="width: 114px">NRIC/PP</td> <td class="labeldesign_statement" style="width: 34px">:</td> <td class="labeldesign_statement"><?php echo htmlout($snric);?></td> <td class="tdempty" style="width: 30px"></td> <td class="labeldesign_statement" style="width: 114px">Discount</td> <td class="labeldesign_statement" style="width: 27px">:</td> <td class="labeldesign_statement"><?php echo number_format($sdisc,2);?></td> <td class="tdempty" style="width: 30px"></td> <td class="labeldesign_statement" style="width: 114px">Total Paid(Others)</td> <td class="labeldesign_statement" style="width: 27px">:</td> <td class="labeldesign_statement"><?php echo number_format($totalother,2);?></td> </tr> <tr> <td class="tdempty" style="width: 30px"></td> <td class="labeldesign_statement" style="width: 114px">Course</td> <td class="labeldesign_statement" style="width: 34px">:</td> <td class="labeldesign_statement"><?php echo htmlout($scoursecode);?></td> <td class="tdempty" style="width: 30px"></td> <td class="labeldesign_statement" style="width: 114px">Scholarship</td> <td class="labeldesign_statement" style="width: 27px">:</td> <td class="labeldesign_statement"><?php echo number_format($scholar,2);?></td> <td class="tdempty" style="width: 30px"></td> <td class="labeldesign_statement" style="width: 114px">Total Paid(Overall)</td> <td class="labeldesign_statement" style="width: 27px">:</td> <td class="labeldesign_statement"><?php echo number_format($totaloverall,2);?></td> </tr> <tr> <td class="tdempty" style="width: 30px"></td> <td class="labeldesign_statement" style="width: 114px">Pay Type</td> <td class="labeldesign_statement" style="width: 34px">:</td> <td class="labeldesign_statement"><?php echo htmlout($spaytype);?></td> <td class="tdempty" style="width: 30px"></td> <td class="labeldesign_statement" style="width: 114px">No of Month</td> <td class="labeldesign_statement" style="width: 27px">:</td> <td class="labeldesign_statement"><?php echo number_format($nomonth);?></td> </tr> </table> <table width="100%" align="center" cellpadding="4" cellspacing="1"> <tr><td colspan="7"><hr /></td></tr> <tr> <td class="tdempty"></td> <td class="tbl_header">Receipt No</td> <td class="tbl_header">Receipt Date</td> <td class="tbl_header">Description</td> <td class="tbl_header">Mode</td> <td class="tbl_header">Cheque No</td> <td class="tbl_header_right">Amount</td> <td class="tdempty"></td> </tr> <tr><td colspan="7"><hr /></td></tr> <?php if(isset($stmt)) { while($row = $stmt->fetch()) {?> <tr> <td class="tdempty"></td> <td class="tbl_content"><?php echo $row['RCNo'];?></td> <td class="tbl_content"><?php echo date("d-m-Y", strtotime($row['RcDate']));?></td> <td class="tbl_content"><?php echo $row['Rcvdfor'];?></td> <td class="tbl_content"><?php echo $row['Mode'];?></td> <td class="tbl_content"><?php echo $row['ChqNo'];?></td> <td class="tbl_content_right"><?php echo number_format($row['Amount'],2) ;?></td> <td class="tdempty"></td> </tr> <?php $total+=$row['Amount']; }}?> <tr><td colspan="7"><hr /></td></tr> <tr> <td colspan="6"></td> <td class="tbl_subtotal_right"> <?php echo number_format($total,2);?></td> </tr> <tr><td colspan="7"><hr /></td></tr> </table> <?php unset($dbh); unset($stmt); ?>
Please Help meMaideen -
hi Muddy
Can i have the javascript example?
Maideen
-
Hi
I have a problem to send php page with data to printer directly. Below code is working fine but only print issue.
Pls help me
Html page
<style type="text/css"></style> <?php include '../templete/header.php'; ?> <Script Language="javascript"> function change_action() { var frm_obj=document.getElementById("frm"); frm_obj.action="data.php"; } </Script> <table class="tbl_table" align="center"> <form action="" method="POST" id="frm" > <tr> <td class="td_title" colspan="2"><strong>Outstanding Balance Report</strong></td> </tr> <tr> <td class="td_class_right">Until:</td> <td><input class="textdesign" type="text" id="datepicker1" name="datefrom" /></td> </tr> <tr> <td class="td_button" colspan="2"> <input class="buttondesign" type="submit" value="Search" name="search" onclick="change_action()"> <input class="buttondesign" type="submit" value="print" name="print" onclick="change_action()"> </td> </tr> </form> </table>
data.php
<?php include_once '../inc/connection.inc.php'; ?> <?php if (isset($_POST['search']) && $_POST['search'] != "" ) { $datefrom=$_POST["datefrom"]; $s = $dbh->prepare("EXECUTE usp_OutStanding_Balance ?"); $s->bindParam(1, $datefrom, PDO::PARAM_STR); $stmt = $s->execute(); $stmt = $dbh->query("SELECT * FROM vw_OutStanding_Balance ORDER BY MVName"); $stmt->setFetchMode(PDO::FETCH_ASSOC); include 'view.html.php'; } ?> <?php if (isset($_POST['print']) && $_POST['print'] != "" ) { $datefrom=$_POST["datefrom"]; $s = $dbh->prepare("EXECUTE usp_OutStanding_Balance ?"); $s->bindParam(1, $datefrom, PDO::PARAM_STR); $stmt = $s->execute(); $stmt = $dbh->query("SELECT * FROM vw_OutStanding_Balance ORDER BY MVName"); $stmt->setFetchMode(PDO::FETCH_ASSOC); include 'print.html.php'; } ?>
print.html.php
<?php include '../templete/print_head.php'; ?> <?php $groupby = ''; $displaySubTotal = FALSE; $subTotal = 0; $grandTotal = 0; $sub_debit=0; // maideen $grn_debit=0; // maideen $sub_credit=0; // maideen $grn_credit=0; // maideen $sub_bal=0; // maideen $grn_bal=0; // maideen ?> <div class="title">Outstanding Report</div> <table width="100%" align="center" cellpadding="4" cellspacing="1" class=tbl_table"> <tr><td colspan="6"><hr /></td></tr> <tr> <td class="tdempty"></td> <td class="tbl_header">MV CODE</td> <td class="tbl_header">MV NAME</td> <td class="tbl_header_right">DEBIT</td> <td class="tbl_header_right">CREDIT</td> <td class="tbl_header_right">BALANCE</td> <td class="tdempty"></td> </tr> <tr><td colspan="6"><hr /></td></tr> <?php if(isset($stmt)) { while($row = $stmt->fetch()): if($groupby!=$row['MVName']): if($displaySubTotal): ?> <?php $grn_debit += $sub_debit; $sub_debit=0; $grn_credit += $sub_credit; $sub_credit=0; $grn_bal += $sub_bal; $sub_bal=0; else: $displaySubTotal = TRUE; endif; $groupby = $row['MVName']; endif; ?> <tr> <td class="tdempty"></td> <td class="tbl_content"><?php echo $row['MVcode'];?></td> <td class="tbl_content"><?php echo $row['MVName'];?></td> <td class="tbl_content_right"><?php echo number_format($row['Debit'],2) ;?></td> <td class="tbl_content_right"><?php echo number_format($row['Credit'],2) ;?></td> <td class="tbl_content_right"><?php echo number_format($row['Balance'],2) ;?></td> <td class="tdempty"></td> </td> <?php $sub_debit += $row['Debit']; $sub_credit += $row['Credit']; $sub_bal += $row['Balance']; endwhile; $grn_debit += $sub_debit; $grn_credit += $sub_credit; $grn_bal += $sub_bal; ?> <tr><td colspan="6"><hr /></td></tr> <tr> <td colspan="2"> <td class="tbl_subtotal_left"><b>Grand Total</b></td> <td class="tbl_subtotal_right"><b><?php echo number_format($grn_debit,2); ?></b></td> <td class="tbl_subtotal_right"><b><?php echo number_format($grn_credit,2); ?></b></td> <td class="tbl_subtotal_right"><b><?php echo number_format($grn_bal,2); ?></b></td> </tr> <tr><td colspan="6"><hr /></td></tr> <?php }?> </table> <?php unset($dbh); unset($stmt); ?>
Pls help me if anybody knows. I need once click the print button, system should send data to printer
Regards
Maideen
-
Hi
How do change form action dynamically.
maideen
-
Hi
First of all Thank you very much your reply
I have tested. It is ok. But it does not data what i have selected. It shows only empty page. it did not passing date to that pages.
How to do this?
Pls
Maideen
-
HiI have two button in my page One is 'search' and another is 'print'But i could not re direct and passing date to another page. code is working fine for search. But printI am blur of this. Pls help me how i can redirect the page by using button click. Pls help meBelow my codeindex.php
<?php include_once '../inc/connection.inc.php'; ?> <?php try { $stmt = $dbh->prepare('SELECT * FROM MVendorMaster order by MVName'); $stmt->execute(); } catch (PDOException $e) { $output = 'Error fetching main vendor from database!'; include '../errormsg.php'; exit(); } foreach ($stmt as $row) { $mvcode[] = array('MVCode' => $row['MVCode'], 'MVName' => $row['MVName']); } include 'searchform.html.php'; ?> <?php if (isset($_POST['search']) && $_POST['search'] != "" ) { $mvcode = $_POST["mvendor"]; $datefrom=$_POST["datefrom"]; $dateto=$_POST["dateto"]; $stmt = $dbh->query("SELECT * FROM php_vw_InvoiceHead WHERE MVCode='$mvcode' and SODate>='$datefrom' and SODate<='$dateto' ORDER BY MVCode,SODate"); $stmt->setFetchMode(PDO::FETCH_ASSOC); include 'view.html.php'; } if (isset($_POST['print']) && $_POST['print'] != "" ) { $mvcode = $_POST["mvendor"]; $datefrom=$_POST["datefrom"]; $dateto=$_POST["dateto"]; $stmt = $dbh->query("SELECT * FROM php_vw_InvoiceHead WHERE MVCode='$mvcode' and SODate>='$datefrom' and SODate<='$dateto' ORDER BY MVCode,SODate"); $stmt->setFetchMode(PDO::FETCH_ASSOC); include 'print.html.php'; } ?>
searchform.html.php<?php include '../templete/header.php'; ?> <div> <h6>Sales Report by Main Vendor</h6> </div> <form action="" method="POST"> <table class="tdtable" id="tdtable"> <tr> <td>Main Vendor Name </td> <td> <select name="mvendor" id="mvcode"><option value="">Mian Vendor</option> <?php foreach ($mvcode as $mvcodes): ?> <option value="<?php htmlout($mvcodes['MVCode']); ?>"> <?php htmlout($mvcodes['MVName']); ?></option> <?php endforeach; ?> </select> </td> </tr> <tr> <td>Date[From]:</td> <td><input type="text" id="datepicker1" name="datefrom" /></td> </tr> <tr> <td>Date[To]:</td> <td><input type="text" id="datepicker2" name="dateto" /></td> </tr> </table> <div> <input type="submit" value="Search" name="search"> <input type="submit" value="Print" name="print"> </div> </form>
view.html.php<?php $groupby = ''; $displaySubTotal = FALSE; $subTotal = 0; $grandTotal = 0; $sub_balqty=0; // maideen $grn_balqty=0; // maideen $sub_rtnqty=0; // maideen $grn_rtnqty=0; // maideen $sub_qty=0; // maideen $grn_qty=0; // maideen ?> <table width="100%" align="center" cellpadding="4" cellspacing="1" class=tbl_table"> <tr> <td class="tbl_header">MV CODE</td> <td class="tbl_header">MV NAME</td> <td class="tbl_header">SO Date</td> <td class="tbl_header">SO No</td> <td class="tbl_header">RATE</td> <td class="tbl_header">SUPP.QTY</td> <td class="tbl_header">RTN.QTY</td> <td class="tbl_header">BAL.Qty</td> <td class="tbl_header">SOLD AMT</td> <td class="tbl_header">Actions</td> </tr> <?php if(isset($stmt)) { while($row = $stmt->fetch()): if($groupby!=$row['MVCode']): if($displaySubTotal): ?> <tr><td colspan="10"><hr /></td></tr> <tr> <td colspan="4"> <td class="tbl_subtotal_left" ><b>Sub Total </b></td> <td class="tbl_subtotal_right"><b><?php echo number_format($sub_qty); ?></b></td> <td class="tbl_subtotal_right"><b><?php echo number_format($sub_rtnqty); ?></b></td> <td class="tbl_subtotal_right"><b><?php echo number_format($sub_balqty); ?></b></td> <td class="tbl_subtotal_right"><b><?php echo number_format($subTotal,2); ?></b></td> </tr> <tr><td colspan="10"><hr /></td></tr> <?php $grandTotal += $subTotal; $subTotal = 0; $grn_balqty += $sub_balqty; $sub_balqty=0; $grn_rtnqty += $sub_rtnqty; $sub_rtnqty=0; $grn_qty += $sub_qty; $sub_qty=0; else: $displaySubTotal = TRUE; endif; //$groupby = $row['SODate']; $groupby = $row['MVCode']; endif; ?> <tr> <td class="tbl_content"><?php echo $row['MVCode'];?></td> <td class="tbl_content"><?php echo $row['MVName'];?></td> <td class="tbl_content"><?php echo date("d-m-Y", strtotime($row['SODate']));?></td> <td class="tbl_content"><?php echo $row['SONo'];?></td> <td class="tbl_content_right"><?php echo number_format($row['Rate'],2) ;?></td> <td class="tbl_content_right"><?php echo number_format($row['Qty']) ;?></td> <td class="tbl_content_right"><?php echo number_format($row['RTNQty']) ;?></td> <td class="tbl_content_right"><?php echo number_format($row['BalQty']) ;?></td> <td class="tbl_content_right"><?php echo number_format($row['BalAmt'],2) ;?></td> </td> <?php $subTotal += $row['BalAmt']; $sub_balqty += $row['BalQty']; $sub_rtnqty += $row['RTNQty']; $sub_qty += $row['Qty']; endwhile; $grandTotal += $subTotal; $grn_balqty += $sub_balqty; $grn_rtnqty += $sub_rtnqty; $grn_qty += $sub_qty; ?> <tr><td colspan="10"><hr /></td></tr> <tr> <td colspan="4"> <td class="tbl_subtotal_left" ><b>Sub Total </b></td> <td class="tbl_subtotal_right"><b><?php echo number_format($sub_qty); ?></b></td> <td class="tbl_subtotal_right"><b><?php echo number_format($sub_rtnqty); ?></b></td> <td class="tbl_subtotal_right"><b><?php echo number_format($sub_balqty); ?></b></td> <td class="tbl_subtotal_right"><b><?php echo number_format($subTotal,2); ?></b></td> </tr> <!-- <tr><td colspan="10"><hr /></td></tr> <tr> <td colspan="4"> <td class="tbl_subtotal_left"><b>Grand Total</b></td> <td class="tbl_subtotal_right"><b><?php echo number_format($grn_qty); ?></b></td> <td class="tbl_subtotal_right"><b><?php echo number_format($grn_rtnqty); ?></b></td> <td class="tbl_subtotal_right"><b><?php echo number_format($grn_balqty); ?></b></td> <td class="tbl_subtotal_right"><b><?php echo number_format($grandTotal,2); ?></b></td> </tr> <tr><td colspan="10"><hr /></td></tr> --> <?php }?> </table> <?php unset($dbh); unset($stmt); ?> <?php include '../templete/footer.php'; ?>
print.html.php<?php echo "print page"; ?> <script language="javascript" type="text/javascript"> function printFunction(){ window.print(); } </script> <script language="javascript" type="text/javascript"> function PrintGridData() { var prtGrid = document.getElementById('<%=txtDocNo%>'); prtGrid.border = 0; var prtwin = window.open('', 'PrintGridViewData', 'left=100,top=100,width=1000,height=1000,tollbar=0,scrollbars=1,status=0,resizable=1'); prtwin.document.write(prtGrid.outerHTML); prtwin.document.close(); prtwin.focus(); prtwin.print(); prtwin.close(); </script> <?php $groupby = ''; $displaySubTotal = FALSE; $subTotal = 0; $grandTotal = 0; $sub_balqty=0; // maideen $grn_balqty=0; // maideen $sub_rtnqty=0; // maideen $grn_rtnqty=0; // maideen $sub_qty=0; // maideen $grn_qty=0; // maideen ?> <table width="100%" align="center" cellpadding="4" cellspacing="1" class=tbl_table"> <tr> <td class="tbl_header">MV CODE</td> <td class="tbl_header">MV NAME</td> <td class="tbl_header">SO Date</td> <td class="tbl_header">SO No</td> <td class="tbl_header">RATE</td> <td class="tbl_header">SUPP.QTY</td> <td class="tbl_header">RTN.QTY</td> <td class="tbl_header">BAL.Qty</td> <td class="tbl_header">SOLD AMT</td> <td class="tbl_header">Actions</td> </tr> <?php if(isset($stmt)) { while($row = $stmt->fetch()): if($groupby!=$row['MVCode']): if($displaySubTotal): ?> <tr><td colspan="10"><hr /></td></tr> <tr> <td colspan="4"> <td class="tbl_subtotal_left" ><b>Sub Total </b></td> <td class="tbl_subtotal_right"><b><?php echo number_format($sub_qty); ?></b></td> <td class="tbl_subtotal_right"><b><?php echo number_format($sub_rtnqty); ?></b></td> <td class="tbl_subtotal_right"><b><?php echo number_format($sub_balqty); ?></b></td> <td class="tbl_subtotal_right"><b><?php echo number_format($subTotal,2); ?></b></td> </tr> <tr><td colspan="10"><hr /></td></tr> <?php $grandTotal += $subTotal; $subTotal = 0; $grn_balqty += $sub_balqty; $sub_balqty=0; $grn_rtnqty += $sub_rtnqty; $sub_rtnqty=0; $grn_qty += $sub_qty; $sub_qty=0; else: $displaySubTotal = TRUE; endif; //$groupby = $row['SODate']; $groupby = $row['MVCode']; endif; ?> <tr> <td class="tbl_content"><?php echo $row['MVCode'];?></td> <td class="tbl_content"><?php echo $row['MVName'];?></td> <td class="tbl_content"><?php echo date("d-m-Y", strtotime($row['SODate']));?></td> <td class="tbl_content"><?php echo $row['SONo'];?></td> <td class="tbl_content_right"><?php echo number_format($row['Rate'],2) ;?></td> <td class="tbl_content_right"><?php echo number_format($row['Qty']) ;?></td> <td class="tbl_content_right"><?php echo number_format($row['RTNQty']) ;?></td> <td class="tbl_content_right"><?php echo number_format($row['BalQty']) ;?></td> <td class="tbl_content_right"><?php echo number_format($row['BalAmt'],2) ;?></td> </td> <?php $subTotal += $row['BalAmt']; $sub_balqty += $row['BalQty']; $sub_rtnqty += $row['RTNQty']; $sub_qty += $row['Qty']; endwhile; $grandTotal += $subTotal; $grn_balqty += $sub_balqty; $grn_rtnqty += $sub_rtnqty; $grn_qty += $sub_qty; ?> <tr><td colspan="10"><hr /></td></tr> <tr> <td colspan="4"> <td class="tbl_subtotal_left" ><b>Sub Total </b></td> <td class="tbl_subtotal_right"><b><?php echo number_format($sub_qty); ?></b></td> <td class="tbl_subtotal_right"><b><?php echo number_format($sub_rtnqty); ?></b></td> <td class="tbl_subtotal_right"><b><?php echo number_format($sub_balqty); ?></b></td> <td class="tbl_subtotal_right"><b><?php echo number_format($subTotal,2); ?></b></td> </tr> <!-- <tr><td colspan="10"><hr /></td></tr> <tr> <td colspan="4"> <td class="tbl_subtotal_left"><b>Grand Total</b></td> <td class="tbl_subtotal_right"><b><?php echo number_format($grn_qty); ?></b></td> <td class="tbl_subtotal_right"><b><?php echo number_format($grn_rtnqty); ?></b></td> <td class="tbl_subtotal_right"><b><?php echo number_format($grn_balqty); ?></b></td> <td class="tbl_subtotal_right"><b><?php echo number_format($grandTotal,2); ?></b></td> </tr> <tr><td colspan="10"><hr /></td></tr> --> <?php }?> </table> <?php unset($dbh); unset($stmt); ?> <?php include '../templete/footer.php'; ?>
Thank you very much
Regards
Maideen
-
Hi all
Thank you very much for supporting by giving suggestion
I have solved by using Store procedure in Mssql server. Here it is...
USE [CMSHCK]GOSET ANSI_NULLS ONGOSET QUOTED_IDENTIFIER ONGOALTER PROCEDURE [dbo].[php_usp_AgeingReportNew]@dtCurrent datetimeASBEGIN-- if @dtCurrent = '' begin-- Set @dtCurrent = GetDate()-- endselect code as MVCode, Name as MVName, sum(Balance) Month30into #Month30from dbo.AgeingReportwhere DocDate >= DateAdd("d", -30, (@dtCurrent))and DocDate < @dtCurrentgroup by code, Nameselect code as MVCode, Name as MVName, sum(Balance) Month60into #Month60from dbo.AgeingReportwhere DocDate >= DateAdd("d", -60, (@dtCurrent))and DocDate < DateAdd("d", -30, (@dtCurrent))group by code, Nameselect code as MVCode, Name as MVName, sum(Balance) Month90into #Month90from dbo.AgeingReportwhere DocDate >= DateAdd("d", -90, (@dtCurrent))and DocDate < DateAdd("d", -60, (@dtCurrent))group by code, Nameselect code as MVCode, Name as MVName, sum(Balance) Month120into #Month120from dbo.AgeingReportwhere DocDate >= DateAdd("d", -120, (@dtCurrent))and DocDate < DateAdd("d", -90, (@dtCurrent))group by code, Nameselect code as MVCode, Name as MVName, sum(Balance) Month150into #Month150from dbo.AgeingReportwhere DocDate >= DateAdd("d", -150, (@dtCurrent))and DocDate < DateAdd("d", -120, (@dtCurrent))group by code, Nameselect code as MVCode, Name as MVName, sum(Balance) Month180into #Month180from dbo.AgeingReportwhere DocDate >= DateAdd("d", -9999, (@dtCurrent))and DocDate < DateAdd("d", -150, (@dtCurrent))group by code, Nameselect X.MVCODE, X.MVNAME, SUM(Days30) Days30, SUM(Days60) Days60, SUM(Days90) Days90,SUM(Days120) Days120, SUM(Days150) Days150, SUM(Days180) Days180 FROM (select MVCode, MVname, Month30 as 'Days30' , '0' as 'Days60' , '0' as 'Days90' , '0' as 'Days120' , '0' as 'Days150' , '0' as 'Days180' from #Month30unionselect MVCode, MVname, '0' as 'Days30' , Month60 'Days60' , '0' as 'Days90' ,'0' as 'Days120' , '0' as 'Days150' , '0' as 'Days180' from #Month60unionselect MVCode, MVname, '0' as 'Days30' , '0' as 'Days60' , Month90 as 'Days90', '0' as 'Days120' , '0' as 'Days150' , '0' as 'Days180' from #Month90unionselect MVCode, MVname, '0' as 'Days30' , '0' as 'Days60' , '0' as 'Days90' , Month120 as 'Days120' , '0' as 'Days150' , '0' as 'Days180' from #Month120unionselect MVCode, MVname, '0' as 'Days30' , '0' as 'Days60' , '0' as 'Days90' , '0' as 'Days120' ,Month150 as 'Days150', '0' as 'Days180' from #Month150unionselect MVCode, MVname, '0' as 'Days30' , '0' as 'Days60' , '0' as 'Days90' , '0' as 'Days120' ,'0' as 'Days150' ,Month180 as 'Days180' from #Month180) XGROUP BY MVCODE, MVNAMEorder by MVCODEdrop table #Month30drop table #Month60drop table #Month90drop table #Month120drop table #Month150drop table #Month180ENDThank you very much -
thank you Mr.Guru
I will try first and let you know
maideen
Insert PHP Grid Data into Mysql Table
in PHP Coding Help
Posted