<?php
session_start();
require_once("../codelibrary/inc/variables.php");
require_once("../codelibrary/inc/functions.php");
validate_user();
@extract($_REQUEST);
$vat_per=5;
$cur_date=date('d-M-Y');

/* log4php start here */
include('../log4php/Logger.php');
Logger::configure('../logger-config.xml');
$logger = Logger::getLogger("-Pharmacy Sales-");
/* log4php end here */


if(isset($_GET['uhid'])){
	
	$patientId=$_GET['uhid'];
	$sql_uhid= mysql_query_db("select * from health_patient where patientId='$patientId'");
    $line_uhid= mysql_fetch_db($sql_uhid);
	$opd= mysql_query_db("select * from health_opd where patientId='$patientId' order by opdId desc limit 0,1");
	
	$fopd= mysql_fetch_db($opd);
	
	$doctor= mysql_query_db("select * from health_doctors where id='".$fopd['doctorId']."'");
	$fdoctor= mysql_fetch_db($doctor);
	//print_r($fdoctor);
}

/* code for fetch all product(medicine) start here*/
$sql=mysql_query_db("select * from pharmacy_product where expire_date>='$save_date' and ((quantity!=0)||(totalTablet!=0)) group by name order by name asc");
while($line=mysql_fetch_db($sql)){ 
    $sal= mysql_query_db("select * from pharmacy_salt where saltId='".$line['name']."'");
    $fsal=mysql_fetch_db($sal);
    $pro_name[]='"'.ucfirst($fsal['saltName']).'"';
}
if($pro_name){
    $pro_name='['.implode(',',$pro_name).']';
}
/* code for fetch all product(medicine) end here*/
/* code for add medicine in list start here*/
if($submit=="Add")
{
    if($medicine_name==''){
?>
<script>
    alert("Please Select Drug Name");
</script>
<?php 
    } else {
        
        $pro=mysql_query_db("select * from pharmacy_product where batch_no='$batchStockNo'");
        $fpro=mysql_fetch_db($pro);
        $slt=mysql_query_db("select * from pharmacy_salt where saltId='".$fpro['name']."'");
        $fslt=mysql_fetch_db($slt);
        if($medi_type==1){
            if($fslt['tabletStrip']>0){
                $mrp=$fpro['mrp']/$fslt['tabletStrip'];
            }
            
        } else {
            $mrp=$fpro['mrp'];
        }
        $nn="insert into pharmacy_temp set product_id='".$fpro['id']."',price='$mrp',session_id='".session_id()."',customer_name='$customer_name',bill_no='$bill_id',quantity='$quantity',quantity_type='$medi_type',lastUpdate='$curDateTime',updateBy='".$_SESSION['sess_uid']."',ipAddress='$ipAddress'";
        mysql_query_db("insert into pharmacy_temp set product_id='".$fpro['id']."',price='$mrp',session_id='".session_id()."',customer_name='$customer_name',bill_no='$bill_id',quantity='$quantity',quantity_type='$medi_type',lastUpdate='$curDateTime',updateBy='".$_SESSION['sess_uid']."',ipAddress='$ipAddress'");
        $logger->warn("Add drugs by ".$_SESSION['sess_uname']." - ".$curDateTime." and IP: ".$ipAddress.", Query is ".$nn);
    }
}
/* code for add medicine in list end here*/
/* code for save or print bill for customer start here*/
if(($submit=="Save")||($submit=="Print"))
{
    $nn2="insert into pharmacy_master_customer set customer_name='$customer_name',customer_phone='$customer_phone',doctor_name='$doctor_name',hospital_name='$hospital_name',post_date='$save_date',lastUpdate='$curDateTime',updateBy='".$_SESSION['sess_uid']."',ipAddress='$ipAddress'";
    mysql_query_db("insert into pharmacy_master_customer set customer_name='$customer_name',customer_phone='$customer_phone',doctor_name='$doctor_name',hospital_name='$hospital_name',post_date='$save_date',lastUpdate='$curDateTime',updateBy='".$_SESSION['sess_uid']."',ipAddress='$ipAddress'");
    $myid=mysql_insert_id_db($sql);
    $logger->warn("Add drugs to customer".$myid." by ".$_SESSION['sess_uname']." - ".$curDateTime." and IP: ".$ipAddress.", Query is ".$nn2);
    
    $nn3="insert into pharmacy_order set date='$save_date',customer_id='$myid',grossTotal='$grossTotal',VATCharge='$VATCharge',discount='$discount',netAmount='$netAmount',lastUpdate='$curDateTime',updateBy='".$_SESSION['sess_uid']."',ipAddress='$ipAddress',vendorId='$vendorId'";
    mysql_query_db("insert into pharmacy_order set date='$save_date',customer_id='$myid',grossTotal='$grossTotal',VATCharge='$VATCharge',discount='$discount',netAmount='$netAmount',lastUpdate='$curDateTime',updateBy='".$_SESSION['sess_uid']."',ipAddress='$ipAddress',vendorId='$vendorId'");/*total_amount='".$_SESSION['$total_amount']."'*/
    $myorderid=mysql_insert_id_db($sql);
    $logger->warn("Add order to customer ".$myid." order ID ".$myorderid." by ".$_SESSION['sess_uname']." - ".$curDateTime." and IP: ".$ipAddress.", Query is ".$nn3);
    
    $crt=mysql_query_db("select * from pharmacy_temp where customer_name='$customer_name' and bill_no='$bill_id'");
    while($fcrt=mysql_fetch_db($crt))
    {   
        $pro55=mysql_query_db("select * from pharmacy_product where id='".$fcrt['product_id']."'");
        $fpro55=mysql_fetch_db($pro55);
        $slt33= mysql_query_db("select * from pharmacy_salt where unitType='".$fcrt['quantity_type']."'");
        $fslt33=mysql_fetch_db($slt33);
        $slt44= mysql_query_db("select * from pharmacy_salt where saltId='".$fpro55['name']."'");
        $fslt44=mysql_fetch_db($slt44);
        if(($fcrt['quantity_type']==1)||($fcrt['quantity_type']==3)){
            $fpro55['totalTablet']=$fpro55['totalTablet']-$fcrt['quantity'];
            $fpro55['quantity']=$fpro55['quantity']-($fcrt['quantity']/$fslt44['tabletStrip']);
            $wh.=",quantity='".$fpro55['quantity']."',totalTablet='".$fpro55['totalTablet']."'";
        }
        else {
            $fpro55['quantity']=$fpro55['quantity']-$fcrt['quantity'];
            $fpro55['totalTablet']=$fpro55['totalTablet']-($fcrt['quantity']*$fslt33['tabletStrip']);
            $wh.=",quantity='".$fpro55['quantity']."',totalTablet='".$fpro55['totalTablet']."'";
        }
        
        mysql_query_db("update pharmacy_product set lastUpdate='$curDateTime',updateBy='".$_SESSION['sess_uid']."',ipAddress='$ipAddress'$wh where id='".$fpro55['id']."'");
        $ttl_price=$fcrt['quantity']*$fcrt['price'];
        $nn4="insert into pharmacy_cart set order_id='$myorderid',product_id='".$fcrt['product_id']."',quantity='".$fcrt['quantity']."',quantity_type='".$fcrt['quantity_type']."',price='".$fcrt['price']."',ttl_price='$ttl_price',customer_name='$customer_name',status=1,post_date='$save_date',lastUpdate='$curDateTime',updateBy='".$_SESSION['sess_uid']."',ipAddress='$ipAddress'";
        mysql_query_db("insert into pharmacy_cart set order_id='$myorderid',product_id='".$fcrt['product_id']."',quantity='".$fcrt['quantity']."',quantity_type='".$fcrt['quantity_type']."',price='".$fcrt['price']."',ttl_price='$ttl_price',customer_name='$customer_name',status=1,post_date='$save_date',lastUpdate='$curDateTime',updateBy='".$_SESSION['sess_uid']."',ipAddress='$ipAddress'");
        $logger->warn("Add order to customer ".$myid." order ID ".$myorderid." by ".$_SESSION['sess_uname']." - ".$curDateTime." and IP: ".$ipAddress.", Query is ".$nn4);
    }
    mysql_query_db("delete from pharmacy_temp where customer_name='$customer_name' and bill_no='$bill_id'");
    header("location:sale-print.php?myid=".$myid);
}
/* code for save or print bill for customer end here*/
/* code for cancel sale or order start here*/
if($submit=="Cancel")
{
    $nn5="delete from pharmacy_temp where bill_no='$bill_id'";
    mysql_query_db("delete from pharmacy_temp where bill_no='$bill_id'");
    $logger->warn("Delete order id ".$bill_id." by ".$_SESSION['sess_uname']." - ".$curDateTime." and IP: ".$ipAddress.", Query is ".$nn5);
    header("location:dashboard.php");
}
/* code for cancel sale or order end here*/
/* code for fetch bill ID start here*/
$ord=mysql_query_db("select * from pharmacy_order where 1=1 order by order_id desc");
$ford=mysql_fetch_db($ord);
$order=$ford['order_id']+1;
/* code for fetch bill ID end here*/
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<title>Pharmacy</title>
<link rel="icon" href="../images/favicon.png" type="image/png" />
<link href="../css/style.css" rel="stylesheet" type="text/css">
<link href="../awesome/css/font-awesome.css" rel="stylesheet" type="text/css">
<link href="../awesome/css/font-awesome.min.css" rel="stylesheet" type="text/css">
<script src="../ajax.js"></script>
<!-- auto complete start here -->
  <link rel="stylesheet" href="../css/jquery-ui.css">
  <script src="../js/jquery-1.12.4.js"></script>
  <script src="../js/jquery-ui.js"></script>
  <script>
  $( function() {
  var availableTags=<?php echo $pro_name;?>;
    $( "#tags" ).autocomplete({
      source: availableTags
    });
  } );
  </script>
<!-- auto complete end here --> 
<script>
    function _isNumberKey(evt){
        var charCode = (evt.which) ? evt.which : event.keyCode
            if (charCode > 31 && (charCode < 48 || charCode > 57) && charCode!=46)
                return false;
            return true;
    }
</script>
<!-- validation css and js start here -->
    <link rel="stylesheet" href="../validation/css/vstyle.css">
<!-- validation css and js end -->

<script>
    <!-- select city from ajax-->
    function _saleUnitType_ajax(val59)
    {
        url = document.location.href;
        xend = url.lastIndexOf("/") + 1;
        var base_url = url.substring(0, xend);
        url="../allajax/saleUnitType-ajax.php";
            if (url.substring(0, 4) != 'http') 
            {
                url = base_url + url;		
            }
        var strSubmit="id59="+val59;
        var strURL = url;
        document.getElementById('unitId_ajax').innerHTML="<img src='../images/loding.gif'>";
        var strResultFunc = "displaysubResult59";
        xmlhttpPost(strURL, strSubmit, strResultFunc)
        return true; 
    }
    function displaysubResult59(strIn44) 
    {    
        document.getElementById('unitId_ajax').innerHTML=strIn44;
    }
    
    function _deleteSaleAjax(val39)
    {
        url = document.location.href;
        xend = url.lastIndexOf("/") + 1;
        var base_url = url.substring(0, xend);
        url="../allajax/deleteSale-ajax.php";
            if (url.substring(0, 4) != 'http') 
            {
                url = base_url + url;		
            }
        var strSubmit="id39="+val39;
        var strURL = url;
        document.getElementById('del_div').innerHTML="<img src='../images/loding.gif'>";
        var strResultFunc = "displaysubResult39";
        xmlhttpPost(strURL, strSubmit, strResultFunc)
        return true; 
    }
    function displaysubResult39(strIn44) 
    {    
        document.getElementById('del_div').innerHTML=strIn44;
    }
    
</script>

</head>
<body>

<div class="full">
    <?php include("dashboard-menu.php");?>
    <div class="clearfix20"></div>
    <div class="full">
        <div class="mauto95">
            <div class="full18">
                <?php include("sale-sidemenu.php");?>
            </div>
            <div class="full80r grey_bck22">
                
                    <div class="full">
                        <div class="full line_hgt30 pink_bck">
                            <div class="mauto95">
                               <div class="full40 printgrey18">
								
						  <form name="via_opd" method="get">
                                <div class="full">
                                    <div class="full white_bck">
                                        <div class="full40">
                                            <div class="full">
                                                <div class="full25 grey14 line_hgt30"> 
                                                   UHID
                                                </div>
                                                <div class="full5 txt_center line_hgt30"> : </div>
                                                <div class="full70">
                                                    <div class="full">
                                                        <input required type="text" name="uhid" id="uhid" value="<?php echo $uhid;?>" placeholder="Enter UHID" maxlength="8" onkeypress="return _isNumberKey(event)" class="dash_txt_box79 padd_left10">
                                                    </div>
                                                </div>
                                            </div>
                                        </div>
                                        <div class="full40">
                                            <input type="submit" name="submit_uhid" value="Search" class="dash_btn">
                                        </div>
                                    </div>
                                
                            </div>
                            </form>
								
								</div>
                                <div class="full50r white16">
									<div class="full80r txt_right">Date : <?php echo $cur_date;?></div>
                                
                                    <div class="full20 txt_right bold yellow_bck" style="display:none">Bill No : 0<?php echo $order;?></div>
								</div>   
                            </div>
                        </div>
                        <div class="mauto95">
						<form name="add_medicine" id="add_medicine" method="post">
						<input type="hidden" name="add_medicine" value="1">
                            <div class="full">
                                <div class="clearfix10"></div>
                                <!--<div class="full">
                                    <div class="full50">
                                        <div class="full30 grey14 line_hgt25"> Bill ID </div>
                                        <div class="full5 txt_center line_hgt25"> : </div>
                                        <div class="full65"><input type="text" name="bill_id" value="<?php //echo $order;?>" readonly class="dash_txt_box" style="background-color:#CCCCCC;"></div>
                                    </div>
                                    <!--<div class="full50">
                                    <div class="full30 grey14 line_hgt25"> Date </div>
                                    <div class="full5 txt_center line_hgt25"> : </div>
                                    <div class="full65 grey14 line_hgt25"></div>
                                    </div>--
                                </div>
                                <div class="clearfix10"></div>-->
                                <div class="full">
                                    <div class="full50">
                                        <div class="full30 grey14 line_hgt25"> Patient Name </div>
                                        <div class="full5 txt_center line_hgt25"> : </div>
                                        <div class="full65">
                                            <div class="full">
                                                <input type="text" name="customer_name" id="customer_name" required maxlength="50" placeholder="Patient Name" title="Please Enter Customer Name" value="<?php if($line_uhid['patientName']){ echo ucwords($line_uhid['patientName']);}else{echo $customer_name;}?>"  class="dash_txt_box allUpperCase">
                                            </div>
                                        </div>
                                    </div>
                                    <div class="full50">
                                        <div class="full30 grey14 line_hgt25"> Contact No.</div>
                                        <div class="full5 txt_center line_hgt25"> : </div>
                                        <div class="full65">
                                            <div class="full"><!-- id="customer_phone" -->
                                                <input type="text" name="customer_phone" onkeypress="return _isNumberKey(event)" placeholder="Patient Contact No." title="Please Enter Contact Number" value="<?php if($line_uhid['mobileNumber']){ echo ucwords($line_uhid['mobileNumber']);}else{ echo $customer_phone;}?>" maxlength="15" class="dash_txt_box">
                                            </div>
                                        </div>
                                    </div>
                                </div>
                                <div class="clearfix10"></div>
                                <div class="full">
                                    <div class="full50">
                                        <div class="full30 grey14 line_hgt25"> Doctor Name </div>
                                        <div class="full5 txt_center line_hgt25"> : </div>
                                        <div class="full65">
                                            <div class="full"><input type="text" name="doctor_name" required placeholder="Doctor Name" maxlength="100" value="<?php echo $fdoctor['doctorName'];?>" class="dash_txt_box allUpperCase"></div> <!--id="doctor_name" required title="Please Enter Doctor Name" -->
                                        </div>
                                    </div>
                                    <div class="full50" style="display:none">
                                        <div class="full30 grey14 line_hgt25"> Hospital Name </div>
                                        <div class="full5 txt_center line_hgt25"> : </div>
                                        <div class="full65">
                                            <div class="full">
                                                <input type="text" name="hospital_name" value="New Life Care Hospital " required placeholder="Hospital Name" maxlength="50" class="dash_txt_box allUpperCase"><!--id="hospital_name" required  title="Please Enter Hospital Name" -->
                                            </div>
                                        </div>
                                    </div>
                                </div>
                                <div class="clearfix10"></div>
                                <div class="full">
                                    <div class="full50" style="display:none">
                                        <div class="full30 grey14 line_hgt25"> Vendor Name </div>
                                        <div class="full5 txt_center line_hgt25"> : </div>
                                        <div class="full65">
                                            <select name="vendorId" id="vendorId"  class="select_txt82 grey14 allUpperCase">
                                                <!--<option value="">-- Select Vendor --</option>-->
                                                <?php 
                                                    $vend= mysql_query_db("select * from pharmacy_vendor where vendorStatus=1");
                                                    while($fvend= mysql_fetch_db($vend)){
                                                ?>
                                                <option value="<?php echo $fvend['vendorId'];?>"<?php if($fvend['vendorId']==$vendorId){ echo "selected";}?>><?php echo strtoupper($fvend['vendorName']);?></option>
                                                <?php }?>
                                            </select>
                                        </div>
                                    </div>
                                    <!--<div class="full50">
                                        <div class="full30 grey14 line_hgt25"> Hospital Name </div>
                                        <div class="full5 txt_center line_hgt25"> : </div>
                                        <div class="full65">
                                            <div class="full">
                                                <input type="text" name="hospital_name" value="<?php //echo $hospital_name;?>" required placeholder="Hospital Name" maxlength="50" class="dash_txt_box allUpperCase"><!--id="hospital_name" required  title="Please Enter Hospital Name" --
                                            </div>
                                        </div>
                                    </div>-->
                                </div>
                            </div>
                        </div>
                    </div>  
                <div class="clearfix20"></div>
                <div class="medi_dtls150 txt_center grey16">Medicine Details</div>
                <div class="full grey16" style="border-bottom:1px solid #CCCCCC;"></div>
                <div class="clearfix20"></div>
                <div class="mauto95">
                <div class="full">
                    <div class="full">
                        <div class="full35">
                            <div class="full30 grey14 line_hgt25"> Medicine Name</div>
                            <div class="full5 txt_center line_hgt25"> : </div>
                            <div class="full65">
                                <div class="ui-widget">
                                    <input id="tags" name="medicine_name" maxlength="50" placeholder="Medicine Name" class="dash_txt_box90 allUpperCase" value="" style="font-size:12px;" onchange="_saleUnitType_ajax(this.value)">
                                </div>
                            </div>
                        </div>
                        <div class="full65">
                            <div class="full55 grey14" id="unitId_ajax">
                                <select name="batchStockNo" class="dash_selc_box50">
                                    <option value="">Batch No and Stock</option>
                                    <?php 
                                        //$btch= mysql_query_db("select * from pharmacy_product");
                                        //while($fbtch= mysql_fetch_db($btch)) {
                                    ?>
                                    <!--<option value="<?php //echo strtoupper($fbtch['batch_no']);?>"><?php //echo "Batch No: ".$fbtch['batch_no'].", Stock: ".$fbtch['quantity'];?></option>-->
                                    <?php //}?>
                                </select> 
                                <select name="medi_type" class="dash_selc_box35">
                                    <?php 
                                        $unt= mysql_query_db("select * from pharmacy_unittype where unitStatus=1");
                                        while($funt= mysql_fetch_db($unt)) {
                                    ?>
                                    <option value="<?php echo strtoupper($funt['unitId']);?>"><?php echo strtoupper($funt['unitName']);?></option>
                                    <?php }?>
                                </select> 
                            </div>
                            <div class="full6 grey14 line_hgt25"> Quantity</div>
                            <div class="full5 txt_center line_hgt25"> : </div>
                            <div class="full15">
                                <input type="text" name="quantity" value="" maxlength="3" onkeypress="return _isNumberKey(event)" placeholder="Quantity" class="dash_txt_box">
                            </div>
                            <div class="full20r"><input type="submit" name="submit" value="Add" class="dash_btn"></div>
                        </div>
                    </div>
                </div>
            </div>
            <div class="clearfix10"></div>
            </div>
        </div>
    </div>
</div>
<div class="clearfix10"></div>
<div class="full">
    <div class="mauto95">
        <div class="full grey_bck22" id="del_div">
            <div class="full" style="max-height:300px; overflow-y:scroll;">
                <table cellpadding="0" cellspacing="0" width="100%">
                    <tr style="line-height:30px;" class="white16 txt_center pink_bck">
                        <td class="grey_brdr_rght grey_brdr_btm" style="width:5%;">S No.</td>
                        <td class="grey_brdr_rght grey_brdr_btm" style="width:6%;">ID</td>
                        <td class="grey_brdr_rght grey_brdr_btm" style="width:17%;">Products</td>
                        <td class="grey_brdr_rght grey_brdr_btm" style="width:14%;">Formulation</td>
                        <td class="grey_brdr_rght grey_brdr_btm" style="width:8%;">Qty.</td>
                        <td class="grey_brdr_rght grey_brdr_btm" style="width:12%;">Batch No.</td>
                        <td class="grey_brdr_rght grey_brdr_btm" style="width:12%;">Expiry</td>
                        <td class="grey_brdr_rght grey_brdr_btm" style="width:10%;">Price/Unit</td>
                        <td class="grey_brdr_rght grey_brdr_btm" style="width:4%;">Delete</td>
                        <td class="grey_brdr_btm" style="width:12%;">Amount (<i class="fa fa-inr" aria-hidden="true" style="font-size: 13px;"></i>)</td>
                        
                    </tr>
                    <?php
                    $i=1; 
                    $list=mysql_query_db("select * from pharmacy_temp where session_id='".session_id()."'");
                    $num=mysql_num_db($list);
                    while($flist=mysql_fetch_db($list))
                    {
                        $pro=mysql_query_db("select * from pharmacy_product where id='".$flist['product_id']."'");
                        $fpro=mysql_fetch_db($pro);
                        $slt22=mysql_query_db("select * from pharmacy_salt where saltId='".$fpro['name']."'");
                        $fslt22=mysql_fetch_db($slt22);
                        $ttl=$flist['price']*$flist['quantity'];
                        $unt22=mysql_query_db("select * from pharmacy_unittype where unitId='".$flist['quantity_type']."'");
                        $funt22=mysql_fetch_db($unt22);
                    ?>
                    <tr style="background-color:#FFFFFF; line-height:25px;" class="grey14 txt_center">
                        <td class="grey_brdr_rght grey_brdr_btm" style="width:5%;"><?php echo $i;?></td>
                        <td class="grey_brdr_rght grey_brdr_btm" style="width:6%;"><?php echo $fpro['id'];?></td>
                        <td class="grey_brdr_rght grey_brdr_btm" style="width:17%;"><?php echo ucfirst($fslt22['saltName']);?></td>
                        <td class="grey_brdr_rght grey_brdr_btm" style="width:14%;"><?php echo ucfirst($funt22['unitName']);?></td>
                        <td class="grey_brdr_rght grey_brdr_btm" style="width:8%;"><?php echo $flist['quantity'];?></td>
                        <td class="grey_brdr_rght grey_brdr_btm" style="width:12%;"><?php echo $fpro['batch_no'];?></td>
                        <td class="grey_brdr_rght grey_brdr_btm" style="width:12%;"><?php echo date('d-M-Y',strtotime($fpro['expire_date']));?></td>
                        <td class="grey_brdr_rght grey_brdr_btm" style="width:10%;"><?php echo number_format($flist['price'], 2, '.', ',');?></td>
                        <td class="grey_brdr_rght grey_brdr_btm" style="width:4%;"><a href="javascript:void(0)" onclick="_deleteSaleAjax(<?php echo $flist['id'];?>)"><i class="fa fa-times" aria-hidden="true" style="color:#CC0000;"></i></a></td>
                        <td class="grey_brdr_btm" style="width:12%;"><?php echo number_format($ttl, 2, '.', ',');?></td>
                    </tr>
                    <?php
                        $grossttl=$grossttl+$ttl;
                        $_SESSION['$total_amount']=$total_amount;
                        $i++;
                    }
                    ?>
                    <?php
                        //$vatCharge=($grossttl*$VATtax)/100;
                        //$aftr_vat=$grossttl+$vatCharge;
                        //$disc=($aftr_vat*$pharmacyDiscount)/100;
                        //$net_amount=round($aftr_vat-$disc);
                        //$net_amount=round($aftr_vat);
                    ?>
                </table>
            </div>
            <table cellpadding="0" cellspacing="0" width="100%">
                <tr style="background-color:#f4f4f4; line-height:25px;" class="grey14 txt_center">
                    <td class="grey_brdr_rght txt_right padd_right20" style="width: 86.8%;">Gross Amount (<i class="fa fa-inr" aria-hidden="true" style="font-size: 13px;"></i>)</td>
                    <td style="width: 19.2%;"><?php echo number_format($grossttl, 2, '.', ',');?></td>
                </tr>
                <!--<tr style="background-color:#FFFFFF; line-height:25px;" class="grey14 txt_center">
                    <td class="grey_brdr_rght grey_brdr_btm txt_right padd_right20" style="width: 86.25%;">VAT (<?php //echo $VATtax."%";?>)</td>
                    <td class="grey_brdr_rght grey_brdr_btm" style="width: 13.75%;"><?php //echo $vatCharge;?></td>
                </tr>
                <tr style="background-color:#FFFFFF; line-height:25px;" class="grey14 txt_center">
                    <td class="grey_brdr_rght grey_brdr_btm txt_right padd_right20" style="width: 86.25%;">Discount (<?php //echo $pharmacyDiscount."%";?>)</td>
                    <td class="grey_brdr_rght grey_brdr_btm" style="width: 13.75%;"><?php //echo $disc;?></td>
                </tr>
                <tr style="background-color:#FFFFFF; line-height:25px;" class="grey14 txt_center">
                    <td class="grey_brdr_rght grey_brdr_btm txt_right padd_right20" style="width: 86.25%;">Net Amount</td>
                    <td class="grey_brdr_rght grey_brdr_btm" style="width: 13.75%;">Rs <?php //echo $net_amount;?></td>
                </tr>-->
                <input type="hidden" name="grossTotal" value="<?php echo $grossttl;?>">
                <input type="hidden" name="VATCharge" value="<?php echo $vatCharge;?>">
                <input type="hidden" name="discount" value="<?php echo $disc;?>">
                <!--<input type="hidden" name="netAmount" value="<?php //echo $net_amount;?>">-->
                <input type="hidden" name="netAmount" value="<?php echo $grossttl;?>">
            </table>
        </div>
        <div class="clearfix20"></div>
        <div class="full txt_right">
            <!--<input type="submit" name="submit" value="Save" class="dash_btn">-->
            <input type="submit" name="submit" value="Print" class="dash_btn">
            <input type="submit" name="submit" value="Cancel" class="dash_btn">
        </div>
    </div>
</div>
</form>
    <div class="clearfix20" style="height:80px;"></div>
<?php include("../footer-inc.php");?>
</div>
<!--end city css js-->
<!--<script src="validation/js/jquery-1.11.1.min.js"></script>-- clash with autopopulate script-->
<script src="../validation/js/jquery.validate.min.js"></script>
<script src="../validation/js/additional-methods.min.js"></script>

</body>
</html>