Jump to content

Asim_Khan

New Members
  • Content Count

    3
  • Joined

  • Last visited

Community Reputation

0 Neutral

About Asim_Khan

  • Rank
    Newbie
  1. I had finally resolved almost all issues.I just started learning php . I will keep your suggestion in mind in future...Now i had this code , It is properly working .All calculations are proper but problem is that it only prints one item of Point of sale.How can i give iteration .i tried this ($i=1 , echo $i++) on Line 181.May be I am placing it in wrong place.Kindly help me to resolve it.Thanks <?php include_once("init.php"); // Use session variable on this page. This function must put on the top of page. if (!isset($_SESSION['username']) || $_SESSION['usertype'] != 'admin') { // if session variable "username" does not exist. header("location: index.php?msg=Please%20login%20to%20access%20admin%20area%20!"); // Re-direct to index.php exit; } else { error_reporting(0); if (isset($_GET['sid'])) { echo $_GET['sid']; } ?> <!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=iso-8859-1"/> <title>Simple invoice in PHP</title> <style type="text/css"> body { font-family: Verdana;; } div.invoice { border:1px solid #ccc; padding:10px; height:740pt; width:570pt; } div.company-address { border:1px solid #ccc; float:left; width:200pt; } div.invoice-details { border:1px solid #ccc; float:right; width:200pt; } div.customer-address { border:1px solid #ccc; float:right; margin-bottom:50px; margin-top:100px; width:200pt; } div.clear-fix { clear:both; float:none; } table { width:60%; } th { text-align: left; } td { } .text-left { text-align:left; } .text-center { text-align:center; } .text-right { text-align:right; } </style> </head> <body> <div class="invoice"> <div class="company-address"> <?php $sid = $_GET['sid']; $line = $db->queryUniqueObject("SELECT * FROM stock_sales WHERE transactionid='$sid' "); $mysqldate = $line->date; $phpdate = strtotime($mysqldate); $phpdate = date("d/m/Y", $phpdate); ?> <?php $line4 = $db->queryUniqueObject("SELECT * FROM store_details "); ?> <?php echo $line4->name; ?> <br /> <?php echo $line4->address; ?>,<?php echo $line4->place; ?> <br /> LPhone <strong>:<?php echo $line4->phone; ?></strong> <br /> </div> <div class="invoice-details"> Invoice no : <?php echo $sid; ?> <br /> Date: <?php $sid = $_GET['sid']; $line = $db->queryUniqueObject("SELECT * FROM stock_sales WHERE transactionid='$sid' "); $mysqldate = $line->date; $phpdate = strtotime($mysqldate); $phpdate = date("d/m/Y", $phpdate); echo $phpdate; ?> </div> <div class="customer-address"> To: <br /> <?php echo $line->customer_id; $cname = $line->customer_id; ?> <br/> <?php $line2 = $db->queryUniqueObject("SELECT * FROM customer_details WHERE customer_name='$cname' "); echo $line2->customer_address; ?> <br/> <?php $line2 = $db->queryUniqueObject("SELECT * FROM customer_details WHERE customer_name='$cname' "); echo $line2->customer_contact1; ?> </div> <div class="clear-fix"></div> <table border='1' cellspacing='0'> <tr> <th width=250>Description</th> <th width=80>Quantity</th> <th width=100>Unit price</th> <th width=100>Total price</th> </tr> <?php $db->query("SELECT * FROM stock_sales where transactionid='$sid'"); while ($line3 = $db->fetchNextObject()) { ?> <tr> <td><?php echo $line3->stock_name; ?></td> <td class='text-center'><?php echo $line3->quantity; ?></td> <td class='text-right'><?php echo $line3->selling_price; ?></td> <td class='text-right'><?php echo $line3->amount; ?></td> </tr> <tr> <td colspan='3' class='text-right'>Sub total</td> <td class='text-right'><?php echo $line3->subtotal?></td> </tr> <tr> <td colspan='3' class='text-right'>VAT</td> <td class='text-right'><?php echo $discount = $line3->discount ?>%</td> </tr> <tr> <td colspan='3' class='text-right'><b>Paid</b></td> <td class='text-right'><b><?php echo $payment = $line3->payment ?></b></td> </tr> <tr> <td colspan='3' class='text-right'><b>Due Payment</b></td> <td class='text-right'><b><?php echo $balance = $line3->balance ?></b></td> </table> </div> </body> </html> <?php echo "Error in processing printing the sales receipt"; } } ?>
  2. <?php include_once("init.php"); // Use session variable on this page. This function must put on the top of page. if(!isset($_SESSION['username']) || $_SESSION['usertype'] != 'admin'){ // if session variable "username" does not exist. header("location: index.php?msg=Please%20login%20to%20access%20admin%20area%20!"); // Re-direct to index.php } else { error_reporting(0); if(isset($_GET['sid'])) { echo $_GET['sid']; ?><!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=iso-8859-1"/> <title>Simple invoice in PHP</title> <style type="text/css"> body { font-family: Verdana;; } div.invoice { border:1px solid #ccc; padding:10px; height:740pt; width:570pt; } div.company-address { border:1px solid #ccc; float:left; width:200pt; } div.invoice-details { border:1px solid #ccc; float:right; width:200pt; } div.customer-address { border:1px solid #ccc; float:right; margin-bottom:50px; margin-top:100px; width:200pt; } div.clear-fix { clear:both; float:none; } table { width:100%; } th { text-align: left; } td { } .text-left { text-align:left; } .text-center { text-align:center; } .text-right { text-align:right; } </style> </head> <body> <div class="invoice"> <div class="company-address"> <?php $sid = $_GET['sid']; $line = $db->queryUniqueObject("SELECT * FROM stock_sales WHERE transactionid='$sid' "); $mysqldate = $line->date; $phpdate = strtotime($mysqldate); $phpdate = date("d/m/Y", $phpdate); echo $phpdate; ?><?php echo $sid; ?> <?php $line4 = $db->queryUniqueObject("SELECT * FROM store_details "); ?> <?php echo $line4->name; ?> <br /> <?php echo $line4->address; ?>,<?php echo $line4->place; ?> <br /> LPhone <strong>:<?php echo $line4->phone; ?></strong> <br /> </div> <div class="invoice-details"> Invoice no : <?php echo $sid;?> <br /> Date: <?php $sid = $_GET['sid']; $line = $db->queryUniqueObject("SELECT * FROM stock_sales WHERE transactionid='$sid' "); $mysqldate = $line->date; $phpdate = strtotime($mysqldate); $phpdate = date("d/m/Y", $phpdate); echo $phpdate; ?> </div> <div class="customer-address"> To: <br /> <?php echo $line->customer_id; $cname = $line->customer_id; $line2 = $db->queryUniqueObject("SELECT * FROM customer_details WHERE customer_name='$cname' "); echo $line2->customer_address; ?> <br /> 123 Long Street <br /> London, DC3P F3Z <br /> </div> <div class="clear-fix"></div> <table border='1' cellspacing='0'> <tr> <th width=250>Description</th> <th width=80>Quantity</th> <th width=100>Unit price</th> <th width=100>Total price</th> </tr> <?php $db->query("SELECT * FROM stock_sales where transactionid='$sid'"); while ($line3 = $db->fetchNextObject()) { ?> echo("<tr>"); echo("<td><?php echo $line3->stock_name; ?></td>"); echo("<td class='text-center'><?php echo $line3->quantity; ?></td>"); echo("<td class='text-right'><?php echo $line3->selling_price; ?></td>"); echo("<td class='text-right'><?php echo $line3->amount; ?></td>"); echo("</tr>"); } ?> echo("<tr>"); echo("<td colspan='3' class='text-right'>Sub total</td>"); echo("<td class='text-right'><?php $subtotal = $line3->subtotal;?></td>"); echo("</tr>"); echo("<tr>"); echo("<td colspan='3' class='text-right'>VAT</td>"); echo("<td class='text-right'><?php $discount = $line3->discount;?></td>"); echo("</tr>"); echo("<tr>"); echo("<td colspan='3' class='text-right'><b>TOTAL</b></td>"); echo("<td class='text-right'><b><?php $payment = $line3->payment;?></b></td>"); echo("</tr>"); </table> </div> </body> </html> <?php } else "Error in processing printing the sales receipt"; } ?>
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.