Loading ...
Sorry, an error occurred while loading the content.

Help for Printing-Bill

Expand Messages
  • raji skariah
    HI Dear PHP Friends...,     Please ..help me.... I need to enter some details in a form and when I click on the Save & Print Button, need to print the
    Message 1 of 1 , Apr 15 4:28 AM
    View Source
    • 0 Attachment
      HI
      Dear PHP Friends...,     Please ..help me....
      I need to enter some details in a form and when I click on the 'Save & Print' Button, need
      to print the details to a small type printer (which is usually used in shops for billing)
      ie, A bill to the customer. and then again back to  the billing data entry screen.

      I just made an html form with the details from 'screen' to print from the
      browsers- 'File -> Print'

      But here I need to goback to the 'billing data entry' screen again with some link.
      Is there any other method to do the print from the button click from the 'billing data entry
      screen' itself? without redirecting?
      If so.. how? please help me..

      The PHP code I made is like this..

      <?php @include 'class/session.php';
          include 'class/connection.php';
          if(!$_SESSION['ADMIN']){
           header('location: index.php');
           exit;
       }
       ob_start();
       if($_REQUEST['act']=="add") {
          $txt_Tokenno        =    $_REQUEST['txt_Tokenno'];
          $txtDate                =    $_REQUEST['txtDate'];
          $txtCustName         =    $_REQUEST['txtCustName'];
          $txtCustAdd                =    $_REQUEST['txtCustAdd'];
          $txtContactNo                =    $_REQUEST['txtContactNo'];
          $txtHandsetModel            =    $_REQUEST['txtHandsetModel'];
          $txtHandsetIMEI                =    $_REQUEST['txtHandsetIMEI'];
          $menu1                    =    $_REQUEST['menu1'];
              $txtProblem                =    $_REQUEST['txtProblem'];
          $txtObservation                =    $_REQUEST['txtObservation'];
       
       $txt_Tokenno                =    htmlentities($txt_Tokenno,ENT_QUOTES);         
       $txtCustName                =    htmlentities($txtCustName,ENT_QUOTES);         
       $txtCustAdd                =    htmlentities($txtCustAdd,ENT_QUOTES);
       $txtContactNo                =    htmlentities($txtContactNo,ENT_QUOTES);         
       $txtHandsetModel            =    htmlentities($txtHandsetModel,ENT_QUOTES);
       $txtHandsetIMEI            =    htmlentities($txtHandsetIMEI,ENT_QUOTES);       

       
       $menu1                    =    htmlentities($menu1,ENT_QUOTES);
       $txtProblem                =    htmlentities($txtProblem,ENT_QUOTES);         
       $txtObservation            =    htmlentities($txtObservation,ENT_QUOTES);
       
       list($vpath,$vpath1,$vpath2)=split("-",$txtDate);
                              $y_year=$vpath;
                              $m_month=$vpath1;
                              $d_day=$vpath2;
                              list($vpath3)=split("0000",$vpath2);
                              $d_day=$vpath3;
                              $txtDate=$vpath3."/".$vpath1."/".$vpath;
             
       $insert_sql = "INSERT INTO....
      .
      .
      .
       mysql_query($insert_sql) or die(mysql_error());
       }
      ?>

      <html>
      <head><title>PRINT TOKEN</title>
      <style type="text/css">
      body {
          margin-left: 0px;
          margin-top: 0px;
          margin-right: 0px;
          margin-bottom: 0px;
           }
      body,td,th
           {
          font-family: Courier New, Courier, mono;
          font-size: 14px;
            }
      .style2 {font-size: 14px}
      .style3 {font-size: 12px}
      .superscript
      {
      vertical-align: super;
      font-size:12px;
      }
      .style12
       {
          font-size: 20px;
          font-family: "Courier New", Courier, mono;
      }
      .style15 {font-size: 10px; font-family: "Courier New", Courier, mono; }
      </style>

      <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"></head>

               
      <body onLoad="document.execCommand('SaveAs',true,'Print_Token.html');return false;">
      <br>
      <table  width="308" border=0 align="center" cellpadding=0 cellspacing=0

      bordercolor="#000000">
      <tr width="308"><td align="center" class="style16"><strong>Token Details  </strong> </td>

      </tr>
      <tr width="308"><td> </td></tr>
      <tr><td>
          <table align="center" width="308">
          <tr width="308">
            <td align="left" width="98" class="style15" >Token No</td> <td

      width="10">:</td><td  width="200" align="left" class="style15"> <?php echo

      $_POST['txt_Tokenno']-1; ?></td>
          </tr>
          <tr>
            <td align="left" class="style15" >Date</td> <td>:</td><td align="left"

      class="style15"> <?php echo $_POST['txtDate']; ?></td>
          </tr>
          <tr>
            <td align="left" class="style15" >Customer Name</td> <td>:</td><td align="left"

      class="style15"> <?php echo $_POST['txtCustName']; ?></td>
          </tr>
          <tr>
            <td align="left" class="style15" >Customer Address</td> <td>:</td><td align="left"

      class="style15"> <?php echo $_POST['txtCustAdd']; ?></td>
          </tr>
          <tr>
            <td align="left" class="style15" >Contact Number</td> <td>:</td><td align="left"

      class="style15"> <?php echo $_POST['txtContactNo']; ?></td>
          </tr>
          <tr>
            <td align="left" class="style15" >Handset Model</td> <td>:</td><td align="left"

      class="style15"> <?php echo $_POST['txtHandsetModel']; ?></td>
          </tr>
          <tr>
            <td align="left" class="style15" >Handset IMEI/ESI</td> <td>:</td><td align="left"

      class="style15"> <?php echo $_POST['txtHandsetIMEI']; ?></td>
          </tr>
          <tr>
            <td align="left" class="style15" >Warranty Status</td> <td>:</td><td align="left"

      class="style15"><?php echo $_POST['menu1']; ?></td>
          </tr>
          <tr>
            <td align="left" class="style15" >Problem Report</td> <td>:</td><td align="left"

      class="style15"> <?php echo $_POST['txtProblem']; ?></td>
          </tr>
          <tr><td align="left" class="style15">Observation</td> <td>:</td><td align="left"

      class="style15"><?php echo $_POST['txtObservation']; ?></td>
          </tr>
          <tr width="308"><td colspan="3"> </td></tr>
          <tr><td colspan="3" align="center"><input type="button" name="Submit34" value="Thank

      You" class="bigButton" onClick="window.location.href='giveToken.php';return false"></td>
          </tr>
          </table>
          </td></tr>
          </table></body></html>

      Thanks in advance.....






      [Non-text portions of this message have been removed]
    Your message has been successfully submitted and would be delivered to recipients shortly.