<?php
session_start();
ob_start();
if(!isset($_SESSION['LOGIN_STATUS']))
{
header('location:../index.php');
}
require "../model/configuration.php";
include("../model/words_class.php");
/* @var $sion type */
$estno = $_GET['estno'];
$cust = $_GET['cust'];
$date = $_GET['date'];
//$specdisc=$_POST['specdisc'];
//$taxprice=$_POST['taxprice'];
//$expence=$_POST['expence'];
?>
<!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" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title><?php echo $_SESSION['title'];?></title>
    <link rel='stylesheet' type='text/css' href='../css/fonts.googleapis.com/css_cd14c140.css' />
    <!-- Bootstrap CSS -->
    <link rel="stylesheet" type="text/css" href="../vendor/bootstrap/css/bootstrap.min.css" />
    <!-- Theme CSS -->
    <link rel="stylesheet" type="text/css" href="../css/vendor.css" />
    <link rel="stylesheet" type="text/css" href="../css/theme.css" />
    <link rel="stylesheet" type="text/css" href="../css/utility.css" />
    <link rel="stylesheet" type="text/css" href="../css/custom.css" />
    <link rel="stylesheet" type="text/css" href="../css/categorys/limara_catgory_one.css" />
  </head>
  <body class="dashboard-page">
    <script> var boxtest = localStorage.getItem('boxed'); if (boxtest === 'true') {document.body.className+=' boxed-layout';} </script>
    <!-- Start: Theme Preview Pane -->
    <!-- Start: Header -->
    <header class="navbar navbar-fixed-top">
      
      <?php include_once("../include/top_menu.php");?>
    </header>
    <!-- Start: Main -->
    <div id="main">
      
      <!-- Start: Sidebar -->
      <?php include_once("../include/left_menu.php");?>
      <!-- Start: Content -->
      <section id="content_wrapper">
        <div id="topbar">
          <div class="topbar-left">
            <ol class="breadcrumb">
              <li class="crumb-icon"><a href="#"><span class="glyphicon glyphicon-home"></span></a></li>
              <li class="crumb-link"><a href="#">Estimate</a></li>
              <li class="crumb-trail">Estimate Add</li>
            </ol>
          </div>
          
        </div>
        
        
        <div id="content">
          <div class="row">
            <div class="col-md-12">
              <div class="panel">
                
                
                
                
                <div id="divToPrint">
                  
                  
                  
                  
                  <div class="prntmain" id="prntmain">
                    <?php
                    $lamnatamt=0;
                    $bckprintamt=0;
                    $foldamt=0;
                    $cresamt=0;
                    $othrtot=0;
                    $nettotal=0;
                      $salquery = $db->execute("SELECT * FROM estimate_table where estimation_no='".$estno."' and customer='".$cust."' and date='".$date."'");
                      $salero = $salquery->fetch_assoc();
                    ?>
                    <?php
                      $vqry=$db->execute("select * from clients where client_id='".$cust."' and delet='0'");
                      $vqrow=$vqry->fetch_assoc();
                    ?>
                    
                    <div class="cont_main">
                      <div class="prnthead">WORK ESTIMATE</div>
                      <div class="prnt_gap">&nbsp;</div>
                      <div class="head_content"><div class="head_left"><div class="head_left_dtls">Order No:&nbsp;<?php echo $estno;?></div></div><div class="head_right"><div class="head_rght_dtls">Date:&nbsp;<?php echo date('d-m-Y',strtotime($date));?></div></div></div>
                      <div class="head_content"><div class="head_left">
                        <div class="head_left_dtls">Customer Name &amp; Contact No :&nbsp;<?php echo $vqrow['client_name']."/".$vqrow['phone']?></div></div>
                        <div class="head_right"><div class="head_rght_dtls"><!--Req.Del.Date.:-->&nbsp;<?php //date('Y-m-d', strtotime($salero['frmdte']));;?></div></div></div>
                        <div class="prnt_body">Type of work:&nbsp;<?php echo $salero['typeofwork'];?> </div>
                        <div class="prnt_body">Number of copies :&nbsp;<?php echo $salero['copies'];?> </div>
                        <div class="prnt_body">Customer Description of work:&nbsp;<?php echo $salero['workdescription'];?> </div>
                        <div class="prnt_btm_content">
                          <div class="btminrcnt">
                            <div class="prnt_btm_connr">Paper type :&nbsp;
                              <?php
                              $pname = $db->execute("SELECT * FROM estimate_table where estimation_no='".$estno."' and customer='".$cust."' and date='".$date."'");
                             
							 while($ar=$pname->fetch_assoc())
							 //extract($ar);
							 {
							 
                            echo substr($ar['product_name'],0,6)."+";
							$nettotal=$ar['total'];
							
							
							 }
                             $nettotal=$nettotal+$ar['advamt']
                              
                              ?>
                            </div>
                            <div class="prnt_btm_cor">Qty. of Dummy. :&nbsp;<?php echo $salero['dummypaper'];?> </div>
                            <div class="prnt_btm_cor">Qty of Books. :&nbsp;<?php echo $salero['numberofbooks'];?> </div>
                          </div>
                          <div class="btminrcnt"><div class="prnt_btm_coninr">Back Printing : &nbsp;<?php echo $salero['backprint'];?></div>
                          <div class="prnt_btm_coninr">Leaf No. from: &nbsp;<?php echo $salero['startingno'];?></div><div class="prnt_btm_coninr">Book No. from : &nbsp;<?php  echo $salero['bookno_frm'];?></div></div>
                          <div class="btminrcnt"><div class="prnt_btm_coninr">Size: &nbsp;<?php echo $salero['print_size'];?></div><div class="prnt_btm_coninr">Duplicates : &nbsp;<?php echo $salero['numberofsetsperbooks'];?></div><div class="prnt_btm_coninr">Ink color : &nbsp;<?php echo $salero['inkcolor'];?></div></div>
                          <!--<div class="btminrcnt"><div class="prnt_btm_coninr">Lamination : </div><div class="prnt_btm_coninr">Folding : </div><div class="prnt_btm_coninr">Creasing : </div></div>-->
                        
                        <!--estimate amount -->
                         
                          <div class="btminrcnt"><div class="prnt_btm_coninr">Estimation Amount :&nbsp;<?php
                           
                            echo $nettotal;?> 
                            
                            
                            
                            
                            </div><div class="prnt_btm_coninr">Advance Amount :&nbsp;<?php echo $salero['advamt'];?> </div><div class="prnt_btm_coninr">Balance :&nbsp;<?php echo $nettotal-$salero['advamt'];?> </div></div>
                          </div>
                          <div class="head_content"><div class="head_left"><div class="head_left_dtls">Proof Confirmed and signed (By Customer)..................................</div></div><div class="head_right"><div class="head_rght_dtls">Sign.Manager:&nbsp;</div></div></div>
                          <div class="dot_line"></div>
                        </div>
                        
                      <div class="cont_main">
                        <div class="top_gap">&nbsp;</div>
                        <div class="prnthead">CUSTOMER RECEIPT</div>
                        <div class="head_content"><div class="head_left"><div class="head_left_dtls">Order No:&nbsp;<?php echo $estno;?></div></div><div class="head_right"><div class="head_rght_dtls">Date:&nbsp;<?php echo date('d-m-Y',strtotime($date));?></div></div></div>
                        <div class="head_content"><div class="head_left"><div class="head_left_dtls">Customer Name &amp; Contact No :&nbsp;<?php echo $vqrow['client_name']."/".$vqrow['phone']?></div></div><div class="head_right"><div class="head_rght_dtls">&nbsp;</div></div></div>
                        <div class="prnt_body">Type of work: &nbsp;<?php echo $salero['typeofwork'];?></div>
                        <div class="prnt_body">Customer Description of work:&nbsp;<?php echo $salero['workdescription'];?> </div>
                        <div class="prnt_btm_content">
                          <div class="btminrcnt">
                            <div class="prnt_btm_connr">Paper type : &nbsp;
                              <?php
                              $pname = $db->execute("SELECT * FROM estimate_table where estimation_no='".$estno."' and customer='".$cust."' and date='".$date."'");
                             
							 while($ar=$pname->fetch_assoc())
							 //extract($ar);
							 {
							 
                            echo substr($ar['product_name'],0,6)."+";
							 }
							  
							  ?>
                              
                              </div><div class="prnt_btm_coninr">Number of copies :&nbsp;<?php echo $salero['copies'];?></div><div class="prnt_btm_coninr">Ink Colour : &nbsp;<?php echo $salero['inkcolor'];?></div></div>
                              <!--<div class="btminrcnt"><div class="prnt_btm_coninr">Number of copies : </div><div class="prnt_btm_coninr">Ink Colour : </div><div class="prnt_btm_coninr">Duplicates : </div></div>-->
                              <div class="btminrcnt">
                                <div class="prnt_btm_coninr">Qty of Books : &nbsp;<?php echo $salero['numberofbooks'];?></div>
                                <div class="prnt_btm_coninr">Size: &nbsp;<?php  echo $salero['print_size'];?></div>
                                <div class="prnt_btm_coninr">Duplicates: &nbsp;<?php echo $salero['numberofsetsperbooks'];?></div>
                              </div>
                              <div class="btminrcnt">
                                <div class="prnt_btm_coninr">Book No. from : &nbsp;<?php echo $salero['bookno_frm'];?></div>
                                <div class="prnt_btm_coninr">Leaf No. from: &nbsp;<?php  echo  $salero['startingno'];?></div>
                              </div>
                              <div class="btminrcnt">
                                <div class="prnt_btm_coninr">Estimated Amount : &nbsp;<?php echo $nettotal;?></div>
                                <div class="prnt_btm_coninr">Advance Amount : &nbsp;<?php  echo $salero['advamt'];?></div>
                                <div class="prnt_btm_coninr">Balance : &nbsp;<?php echo $nettotal-$salero['advamt'];?></div>
                              </div>
                            </div>
                            <div class="head_content"><div class="head_left"><div class="head_left_dtls">&nbsp;</div></div><div class="head_right"><div class="head_rght_dtls">Sign.Manager:&nbsp;</div></div></div>
                            <div class="dot_line"></div>
                          </div>
                          
                          
                          <div class="cont_main">
                          <div class="prnthead">PRINTING ORDER</div>
                          <div class="head_content"><div class="head_left"><div class="head_left_dtls">Order No:&nbsp;<?php echo $estno;?></div></div><div class="head_right"><div class="head_rght_dtls">Date:&nbsp;<?php echo date('d-m-Y',strtotime($date));?></div></div></div>
                          <div class="head_content"><div class="head_left"><div class="head_left_dtls">Customer Name &amp; Contact No :&nbsp;<?php echo $vqrow['client_name']."/".$vqrow['phone']?></div></div><div class="head_right"><div class="head_rght_dtls">&nbsp;</div></div></div>
                          <div class="prnt_body">Type of work:&nbsp;<?php echo $salero['typeofwork'];?></div>
                          <div class="prnt_body">Customer Description of work:&nbsp;<?php echo $salero['workdescription'];?> </div>
                          <div class="prnt_btm_content">
                            <div class="btminrcnt"><div class="prnt_btm_connr">Paper type : &nbsp;
                              <?php
                              $pname = $db->execute("SELECT * FROM estimate_table where estimation_no='".$estno."' and customer='".$cust."' and date='".$date."'");
                             
							 while($ar=$pname->fetch_assoc())
							 //extract($ar);
							 {
							 
                            echo substr($ar['product_name'],0,6)."+";
							 }
							 
							 
                           // echo substr($ar['product_name'],0,6."+");
                              ?>
                            </div>
                            <div class="prnt_btm_coninr">Back Printing : &nbsp;<?php echo $salero['backprint'];?></div>
                            <div class="prnt_btm_coninr">Ink Color :&nbsp;<?php echo $salero['inkcolor'];?> </div>
                          </div>
                          <!--<div class="btminrcnt"><div class="prnt_btm_coninr">Number of copies : </div><div class="prnt_btm_coninr">Back Printing : </div><div class="prnt_btm_coninr">Ink color : </div></div>-->
                          <div class="btminrcnt">
                            <div class="prnt_btm_coninr">Qty. of Dummy : &nbsp;<?php echo $salero['dummypaper'];?></div>
                            <div class="prnt_btm_coninr">Qty of Books: &nbsp;<?php echo $salero['numberofbooks'];?></div>
                            <div class="prnt_btm_coninr">No of pages: &nbsp;<?php echo $salero['nopages'];?></div>
                          </div>
                          <div class="btminrcnt">
                            <div class="prnt_btm_coninr">Print on last Cp-YES/NO: &nbsp;<?php echo $salero['prntlastcopy'];?></div>
                            <div class="prnt_btm_coninr">Size: &nbsp;<?php echo $salero['print_size'];?></div>
                            <div class="prnt_btm_coninr">Duplicates: &nbsp;<?php echo $salero['numberofsetsperbooks'];?></div>
                          </div>
                          <div class="btminrcnt">
                            <div class="prnt_btm_coninr">Lamination : &nbsp;<?php echo $salero['lamination'];?></div>
                            <div class="prnt_btm_coninr">Folding : &nbsp;<?php echo $salero['folding'];?></div>
                            <div class="prnt_btm_coninr">Creasing : &nbsp;<?php echo $salero['creasing'];?></div>
                          </div>
                          <div class="btminrcnt">
                            <div class="prnt_btm_coninr">Binding  : &nbsp;<?php echo $salero['binding'];?></div>
                            <div class="prnt_btm_coninr">Perforation : &nbsp;<?php //echo $salero['folding'];?></div>
                            <div class="prnt_btm_coninr">Stapling : &nbsp;<?php echo $salero['stapling'];?></div>
                          </div>
                          <div class="btminrcnt">
                            <div class="prnt_btm_coninr">Pasting  : &nbsp;<?php echo $salero['binding'];?></div>
                            <div class="prnt_btm_coninr">Book No. from : &nbsp;<?php echo $salero['bookno_frm'];?></div>
                            <div class="prnt_btm_coninr">Leaf No. from : &nbsp;<?php echo $salero['startingno'];?></div>
                          </div>
                          <div class="btminrcnt"><div class="prnt_btm_coninr">Number of copies : &nbsp;<?php echo $salero['copies'];?></div><div class="prnt_btm_coninr">Size :&nbsp;<?php echo $salero['print_size'];?> </div><div class="prnt_btm_coninr">&nbsp; </div></div>
                        </div>
                        <div class="head_content"><div class="head_left"><div class="head_left_dtls">&nbsp;</div></div><div class="head_right"><div class="head_rght_dtls">Sign.Q.C:&nbsp;</div></div></div>
                        <div class="dot_line"></div>
                      </div>
                          
                          
                          
                          
                        </div>
                        
                        
                        
                        
                        
                      </div>
                      
                      
                      <div class="row"><br />
                        <div class="col-xs-8 invoice-block pull-right">
                          <a href="estimate_report.php" class="btn btn-info">Back</a>
                          <input type="button" class="btn btn-success" onclick="PrintDiv();" value="Print"/>
                          <?php
                          if( $salero['approve']==0)
                          {
                          ?>
                          <a href="../controler/approve.php?id=<?php echo $salero['id'];?>&&estno=<?php echo $salero['estimation_no']?>&&cust=<?php echo $salero['customer'] ?>&&date=<?php echo $salero['date'];?>" onclick="if(!confirm('Do you want to Approve?'))return false" class="btn btn-alert">Approve</a>
                          <?php
                          }
                          ?>
                        </div>
                        <br />
                      </div>
                
                      
                      
                    </div>
                  </div>
                  
                  
                </div>
                
                
                
                
                
                
                
                
                
                
                <?php //include_once("dashboard_content.php");?>
                
                
                
                
                
                
                
                
                
                
                
                
                
                
                
                
                
              </div>
              
            </section>
            
            <!-- Start: Right Sidebar -->
            
          </div>
          <!-- End #Main -->
          <!-- jQuery -->
          <script type="text/javascript" src="../vendor/jquery/jquery-1.11.1.min.js"></script>
          <script type="text/javascript" src="../vendor/jquery/jquery_ui/jquery-ui.min.js"></script> <!-- Bootstrap -->
          <script type="text/javascript" src="../vendor/bootstrap/js/bootstrap.min.js"></script>
          <!-- Page Plugins -->
          <script type="text/javascript" src="../vendor/plugins/validate/jquery.validate.js"></script>
          <script type="text/javascript" src="../vendor/plugins/morris/morris.js"></script>
          <script type="text/javascript" src="../vendor/plugins/datatables/js/jquery.dataTables.min.js"></script>
          <script type="text/javascript" src="../vendor/plugins/datatables/js/datatables.js"></script>
          <script type="text/javascript" src="../vendor/plugins/multiselect/bootstrap-multiselect.js"></script>
          <script type="text/javascript" src="../vendor/plugins/jvectormap/jquery-jvectormap.min.js"></script>
          <script type="text/javascript" src="../vendor/plugins/jvectormap/assets/jquery-jvectormap-us-lcc-en.js"></script>
          <script type="text/javascript" src="../vendor/plugins/clndr/clndr.js"></script>
          <script type="text/javascript" src="../vendor/plugins/clndr/moment.js"></script>
          <script type="text/javascript" src="../vendor/plugins/datepicker/bootstrap-datepicker.js"></script>
          <script type="text/javascript" src="../vendor/plugins/jquerymask/jquery.maskedinput.min.js"></script>
          <!-- Flot Plugins -->
          <script type="text/javascript" src="../vendor/plugins/jqueryflot/jquery.flot.min.js"></script>
          <!-- Theme Javascript -->
          <script type="text/javascript" src="../js/utility/spin.min.js"></script>
          <script type="text/javascript" src="../js/utility/underscore-min.js"></script>
          <script type="text/javascript" src="../js/main.js"></script>
          <script type="text/javascript" src="../js/ajax.js"></script>
          <script type="text/javascript" src="../js/custom.js"></script>
          <script type="text/javascript">
          function PrintDiv() {
          var divToPrint = document.getElementById('divToPrint');
          var popupWin = window.open('', '_blank', 'width=595,height=842');
          popupWin.document.open();
          popupWin.document.write('<html><link href="../css/categorys/limara_catgory_one.css" rel="stylesheet" type="text/css" /><body onload="window.print()">' + divToPrint.innerHTML + '</html>');
          popupWin.document.close();
          }
          </script>
        </body>
      </html>