Server IP : 162.240.98.243 / Your IP : 18.117.137.12 Web Server : Apache System : Linux server.bti.yaw.mybluehostin.me 3.10.0-1160.119.1.el7.x86_64 #1 SMP Tue Jun 4 14:43:51 UTC 2024 x86_64 User : btiyawmy ( 1003) PHP Version : 7.2.34 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : ON | Pkexec : ON Directory : /home/btiyawmy/public_html/login.easenup.in/ |
Upload File : |
<?php session_start(); require_once("../dbconnection.php"); require_once('../DBManager.php'); require_once('../LoginManager.php'); $DisplayForm=True; $sql= "SELECT * FROM purchasereport WHERE invoice_no='$_GET[invoice_no]' AND vendor='$_GET[vendor]' AND medicine_id=$_GET[medicine_id] AND status='1'"; $qsql = mysqli_query($con,$sql); if($rh = mysqli_fetch_array($qsql)) { $DisplayForm=False; echo "<script>window.location='view_purchase_invoice.php?invoice_no=$rh[invoice_no]&vendor=$_GET[vendor]&pid=$rh[purchase_report_id]&medicine_id=$_GET[medicine_id]'</script>"; } if($DisplayForm) { ?> <?php include("dbconnection.php"); require_once('../DBManager.php'); require_once('../patientmanager.php'); include("header.php"); include 'workdeskmenu.php'; ?> <div class="content-wrapper"> <!-- Content Header (Page header) --> <section class="content-header"> <h1>Purchase Invoice</h1> <br> <!-- Toggle #1 --> <!--start --> <?php include("dbconnection.php"); require_once('../DBManager.php'); if(isset($_POST['saveAmt'])){ for ($i = 0; $i < count($_POST["Batch_number"]); $i++) { $DRUGS_name= $_POST["DRUGS_name"][$i]; $Cmrp= $_POST["Cmrp"][$i]; $mrp=$_POST["mrp"][$i]; $Quantity= $_POST["Quantity"][$i]; $price= $_POST["price"][$i]; $updated_at=date("F d, Y / h:i:s A"); $created_at=date("F d, Y / h:i:s A"); $Batch_number= $_POST["Batch_number"][$i]; $HSN_No= $_POST["HSN_No"][$i]; $GSTfinal= $_POST["GSTfinal"][$i]; $gstper= $_POST["gstper"][$i]; $expireDate= $_POST["Expiry_Date"][$i]; $DisPrice= $_POST["DisPrice"][$i]; $srno = $_POST['srno'][$i]; $Fprice = $_POST['Fprice'][$i]; $inventory_id=$_POST['inventory_id'][$i]; $medicine_id=$_POST['medicine_id'][$i]; $GST=$_POST['GST'][$i]; $invoice=mt_rand(1000,99999); $total_gst=$_POST['GSTfinal'][$i]; $Fgst=$_POST['Fgst'][$i]; $today=date('Y-m-d'); $purchase_report=$con->query("INSERT INTO `purchasereport`(`invoice_no`, `medicine_ID`, `Batch_number`, `HSN_No`, `Expiry_Date`, `Quantity`, `Rate`, `MRP`, `GST`, `GST_Final`, `CalAmt`, `DisAmt`,`ReturnAmt`, `TotalAmt`, `Discount`, `GrantTotal`, `PaymentMode`, `CardHolder`, `CardHolderName`, `UPI_Card_No`, `Inventory_ID`, `GSTFinalAmt`, `DRUGS_name`, `vendor`, `purchaseDate`,`purchase_invoice`,`Cal_gst`,`Fgst`,`purchase_id`,`hospital_Id`,`entered_by`, `created_at`, `update_by`,`CreateDate`) VALUES ('$_POST[invoice_no]','$medicine_id','$Batch_number','$HSN_No','$expireDate','$Quantity','$Cmrp','$mrp','$GST','$total_gst','$price','$Fprice','$Fprice','$_POST[TotalAmt]','$_POST[discount]','$_POST[pricetotal1]','$_POST[paymentmode]','$_POST[CardHolder]','$_POST[CardNumber]','$_POST[UPI_Number]','$inventory_id','$_POST[GSTFinalAmt]','$DRUGS_name','$_GET[vendor]','$_POST[purchasedate]','$invoice','$_POST[Cal_gst]','$Fgst','$_POST[purchase_id]','$_POST[hospital_Id]','$_POST[entered_by]','$created_at','$updated_at','$today')"); if($purchase_report==1){ } } } if(isset($_POST['saveAmt'])){ for ($i = 0; $i < count($_POST["Batch_number"]); $i++) { $price= $_POST["price"][$i]; $Batch_number= $_POST["Batch_number"][$i]; $Fprice = $_POST['Fprice'][$i]; $medicine_id=$_POST['medicine_id'][$i]; $pur_invoice=$con->query("UPDATE `purchase_invoice` SET `paymentmode`='$_POST[paymentmode]',`CardHolder`='$_POST[CardHolder]',`CardNumber`='$_POST[CardNumber]',`UPI_Number`='$_POST[UPI_Number]',`DisPrice`='$_POST[discount]',`pricetotal1`='$_POST[pricetotal1]',`price`='$_POST[price]',`Fprice`='$_POST[Fprice]' ,`status`='1' WHERE `invoice_no`='$_GET[invoice_no]' AND medicine_id='$medicine_id' AND Batch_number='$Batch_number'"); } ?> <!-- /.card-header --> <div class="card-body"> <?php if($pur_invoice==1){ echo'<script>alert("Save Successfully.....");</script>'; echo "<script>window.location='view_purchase_invoice.php?medicine_id=$_GET[medicine_id]&invoice_no=$_GET[invoice_no]&vendor=$_GET[vendor]'</script>;</script>"; }else{ echo '<div class="alert"> <span class="closebtn">×</span> <strong>Not!</strong> Allowed. </div>'; } } ?> <br> <table style='width:100%' class="table table-bordered table-hover" id="myTable"> <form method="post" enctype='multipart/form-data'> <table id="myTable1" class="table table-bordered table-hover" style='width:100%;'> <thead style='width:100%;'> <tr> <th><strong>Created Towards</strong></th> <th><strong>Invoice</strong></th> <th><strong>Medicine Details</strong></th><th><strong>Batch Number</strong></th><th><strong>HSN Code</strong></th> <th><strong>Expiry Date</strong></th><th><strong>Quantity</strong></th><th><strong>Rate</strong></th> <th><strong>MRP</strong></th> <th><strong>GST</strong></th> <th><strong>Status</strong></th> <th><strong>Net Amt</strong></th> </tr> </thead> <tbody> <?php include("dbconnection.php"); require_once('../DBManager.php'); require_once('../LoginManager.php'); $narayan=LoginManager::currentUser(); $usertype=LoginManager::getUserTypeByuname("$narayan"); $sql1 ="SELECT * FROM site_users WHERE userno='$usertype'"; $qsql1 = mysqli_query($con,$sql1); if($re = mysqli_fetch_array($qsql1)) { $sql ="SELECT * FROM purchase_invoice where invoice_no='$_GET[invoice_no]' "; $qsql = mysqli_query($con,$sql); while($RowMedicineIn = mysqli_fetch_array($qsql)) { $medicine_stok ="SELECT * FROM medicine_stok WHERE medicine_id='$RowMedicineIn[medicine_id]' AND admin_id='$re[entered_by]'"; $qmedicine_stok = mysqli_query($con,$medicine_stok); while($rmedicine_stok = mysqli_fetch_array($qmedicine_stok)) { if($rmedicine_stok['Category']=='Injectable'){ $cat="Vial"; $pricetotal1=$RowMedicineIn[Cmrp]*$RowMedicineIn['Quantity']; //$pricetotal1=$sizefinal*$rsp2[quantitygiven]; $pricetotal=round($pricetotal1); } if($rmedicine_stok['Category']=='IV Fluid'){ $cat="Bottle"; $pricetotal1=$RowMedicineIn[Cmrp]*$RowMedicineIn['Quantity']; // $pricetotal1=$sizefinal*$rsp2[quantitygiven]; $pricetotal=round($pricetotal1); } if($rmedicine_stok['Category']=='Capsule'){ $cat="Capsules"; $pricetotal1=$RowMedicineIn[Cmrp]*$RowMedicineIn['Quantity']; //$pricetotal1=$sizefinal*$rsp2[quantitygiven]; $pricetotal=round($pricetotal1); } if($rmedicine_stok['Category']=='Tablet'){ $cat="Tablets"; $pricetotal1=$RowMedicineIn[Cmrp]*$RowMedicineIn['Quantity']; // $pricetotal1=$sizefinal*$rsp2[quantitygiven]; $pricetotal=round($pricetotal1); } if($rmedicine_stok['Category']=='Syrup'){ $cat="Bottle"; $pricetotal1=$RowMedicineIn[Cmrp]*$RowMedicineIn['Quantity']; //$pricetotal1=$sizefinal*$rsp2[quantitygiven]; $pricetotal=round($pricetotal1); } if($rmedicine_stok['Category']=='Powder'){ $cat="Bottle"; $pricetotal1=$RowMedicineIn[Cmrp]*$RowMedicineIn['Quantity']; // $pricetotal1=$sizefinal*$rsp2[quantitygiven]; $pricetotal=round($pricetotal1); } if($rmedicine_stok['Category']=='Ointment'){ $cat="Tube"; $pricetotal1=$RowMedicineIn[Cmrp]*$RowMedicineIn['Quantity']; // $pricetotal1=$sizefinal*$rsp2[quantitygiven]; $pricetotal=round($pricetotal1); } if($rmedicine_stok['Category']=='Drop'){ $cat="Bottle"; $pricetotal1=$RowMedicineIn[Cmrp]*$RowMedicineIn['Quantity']; //$pricetotal1=$sizefinal*$rsp2[quantitygiven]; $pricetotal=round($pricetotal1); } if($rmedicine_stok['Category']=='Solution'){ $cat="Bottle"; $pricetotal1=$RowMedicineIn[Cmrp]*$RowMedicineIn['Quantity']; //$pricetotal1=$sizefinal*$rsp2[quantitygiven]; $pricetotal=round($pricetotal1); } if($rmedicine_stok['Category']=='Patch'){ $cat="Patch"; $pricetotal1=$RowMedicineIn[Cmrp]*$RowMedicineIn['Quantity']; //$pricetotal1=$sizefinal*$rsp2[quantitygiven]; $pricetotal=round($pricetotal1); } $disGST=$pricetotal/100; $GSTfinal1=$disGST*$RowMedicineIn[gst]; $GSTfinal=round($GSTfinal1) ; $GRANDTOTAL=$rsp2[pricetotal]; ?> <tr> <td><?php echo $RowMedicineIn['created_at'] ?> <input type='hidden' name='created_at' id='created_at' value='<?php echo $RowMedicineIn['created_at'] ?>'> <input type='hidden' name='purchase_id' id='purchase_id' value='<?php echo $RowMedicineIn['purchase_id'] ?>'> <input type='hidden' name='hospital_Id' id='hospital_Id' value='<?php echo $re['userno'] ?>'> <input type='hidden' name='entered_by' id='entered_by' value='<?php echo $re['entered_by'] ?>'> <input type='hidden' name='inventory_id[]' id='inventory_id' value='<?php echo $RowMedicineIn['inventory_id'] ?>'> <input type='hidden' name='medicine_id[]' id='medicine_id' value='<?php echo $RowMedicineIn['medicine_id'] ?>'> </td> <td><?php echo $RowMedicineIn['invoice_no'] ?> <input type='hidden' name='invoice_no' id='invoice_no' value='<?php echo $RowMedicineIn['invoice_no'] ?>'></td> <td><?php echo $rmedicine_stok['DRUGS_name'] ?> <input type='hidden' name='DRUGS_name[]' id='DRUGS_name' value='<?php echo $rmedicine_stok['DRUGS_name'] ?>'></td> <td><?php echo $RowMedicineIn['Batch_number'] ?> <input type='hidden' name='Batch_number[]' id='Batch_number' value='<?php echo $RowMedicineIn['Batch_number'] ?>'></td> <td><?php echo $RowMedicineIn['HSN_No'] ?> <input type='hidden' name='HSN_No[]' id='HSN_No' value='<?php echo $RowMedicineIn['HSN_No'] ?>'></td> <td><?php echo $RowMedicineIn['Expiry_Date'] ?> <input type='hidden' name='Expiry_Date[]' id='Expiry_Date' value='<?php echo $RowMedicineIn['Expiry_Date'] ?>'></td> <td><?php echo $RowMedicineIn['Quantity'] ?><br> (<?php echo $RowMedicineIn['totalQuatity'] ?> <?php echo $rmedicine_stok['Category'] ?>) <input type='hidden' name='Quantity[]' id='Quantity' value='<?php echo $RowMedicineIn['Quantity'] ?>'></td> <td><?php echo $RowMedicineIn['Cmrp'] ?> <input type='hidden' name='Cmrp[]' id='Cmrp' value='<?php echo $RowMedicineIn['Cmrp'] ?>'></td> <td><?php echo $RowMedicineIn['mrp'] ?> <input type='hidden' name='mrp[]' id='mrp' value='<?php echo $RowMedicineIn['mrp'] ?>'></td> <td><?php echo $RowMedicineIn['gst'] ?>%<br><?php echo $GSTfinal ?> <input type='hidden' name='GSTfinal[]' id='gst<?php echo $rmedicine_stok['medicine_id'] ?>' class='gst' value='<?php echo $GSTfinal ?>'> <input class='Fgst' id='Fgst<?php echo $rmedicine_stok['medicine_id'] ?>' type='hidden' name='Fgst[]' /> <input type='hidden' name='GST[]' id='total_gst' class='total_gst' value='<?php echo $RowMedicineIn['gst'] ?>'> </td> <td>Due</td> <td><?php echo $pricetotal; ?> <input type='hidden' name='price[]' id='price<?php echo $rmedicine_stok['medicine_id'] ?>' class='price' value='<?php echo $pricetotal ?>'> <input class='Fprice' id='Fprice<?php echo $rmedicine_stok['medicine_id'] ?>' type='hidden' name='Fprice[]' /> <script> $(document).on("change keyup blur", "#chDiscount", function() { var main3 = $('#price<?php echo $rmedicine_stok['medicine_id'] ?>').val(); var disc3 = $('#chDiscount').val(); var dec3 = (disc3 / 100).toFixed(2); //its convert 10 into 0.10 var mult3 = main3 * dec3; // gives the value for subtract from main value var discont3 = main3 - mult3; $('#Fprice<?php echo $rmedicine_stok['medicine_id'] ?>').val(discont3); }); $(document).on("change keyup blur", "#chDiscount", function() { var main4 = $('#gst<?php echo $rmedicine_stok['medicine_id'] ?>').val(); var disc4 = $('#chDiscount').val(); var dec4 = (disc4 / 100).toFixed(2); //its convert 10 into 0.10 var mult4 = main4 * dec4; // gives the value for subtract from main value var discont4 = main4 - mult4; $('#Fgst<?php echo $rmedicine_stok['medicine_id'] ?>').val(discont4); }); </script> </td> </tr> <?php } } }?> </tbody> <tfoot> <tr> <td colspan=9> <span style='float:right;'> <b>Gross Amt. :</b></span> <br> <span style='float:right;'> <b>Total Cmrp. :</b></span> <br> <span style='float:right;'> <b>GST . :</b></span> <br> <span style='float:right;'> <b>Discount. :</b></span><br><br> <span style='float:right;'> <b>Grand Total :</b></span> <!-- <br><br>--> <!--<span style='float:right;'>--> <!-- <b>GST Final :</b></span>--> <br><br> <span style='float:right;'> <b>Payment Mode :</b></span> </td> <td colspan=3> <?php date_default_timezone_set("Asia/Kolkata"); //India time (GMT+5:30) $date= date('Y-m-d'); echo" <b><i class='fa fa-inr'></i> <span align='right' id='val'></b></span> <div class=''> <b><i class='fa fa-inr'></i> <span align='right' id='val2'></span></div> <div class=''> <b><i class='fa fa-inr'></i> <span align='right' id='AddGST'></span></div> <input type='hidden' id='cBalance'> <div class=''><span><input type='text' name='discount' id='chDiscount' size='2'></span></div> <div class=''> <input type='text' name='pricetotal1' size='2' id='result' required style='margin-top:5px;'></span></div> <div class=''> <input type='hidden' name='Cal_gst' size='2' id='result2' class='result2' required style='margin-top:5px;'> <input type='hidden' name='purchasedate' size='2' id='' value='$date' required style='margin-top:5px;'></span></div> <div class='checkbox'> <select name='paymentmode'> <option value='Cash'>Cash</option> <option value='Card'>Card</option> <option value='UPI'>UPI</option> </select></span></div> <div class=''> <div class='Card box'><input name='CardHolder' id='CardHolder' class='CardHolder' type='text' placeholder='Enter Card Hoder' style='margin-top:5px;' /> <input name='CardNumber' id='CardNumber' class='CardNumber' type='text' placeholder='Enter Card Number' style='margin-top:5px;'/> </div></div> <div class=''> <div class='UPI box'><input name='UPI_Number' id='UPI_Number' class='UPI_Number' type='text' placeholder='Enter UPI Number' style='margin-top:5px;' /> </div></div> "; ?> <br> <br> </div> <script src="https://code.jquery.com/jquery-3.5.1.min.js"></script> <script> $(document).ready(function(){ $("select").change(function(){ $(this).find("option:selected").each(function(){ var optionValue = $(this).attr("value"); if(optionValue){ $(".box").not("." + optionValue).hide(); $("." + optionValue).show(); } else{ $(".box").hide(); } }); }).change(); }); </script> <script> $(document).on("change keyup blur", "#chDiscount", function() { var main2 = $('#GSTFinalAmt').val(); var disc2 = $('#chDiscount').val(); var dec2 = (disc2 / 100).toFixed(2); //its convert 10 into 0.10 var mult2 = main2 * dec2; // gives the value for subtract from main value var discont2 = main2 - mult2; var discont3 = main2 - mult2; $('#result2').val(discont2); }); </script> <script> $(document).on("change keyup blur", "#chDiscount", function() { var main = $('#cBalance').val(); var disc = $('#chDiscount').val(); var dec = (disc / 100).toFixed(2); //its convert 10 into 0.10 var mult = main * dec; // gives the value for subtract from main value var discont = main - mult; $('#result').val(discont); }); </script> <!--<b><i class='fa fa-inr'></i> <span align='right' id="DisVal"></b></span><br><br>--> <!--<span id="sum">0</span><br>--> <input type="hidden" id="total_value" name="TotalAmt" /> <input type="hidden" id="Final_value1" name="FinalAmt" /> <input type="hidden" id="GSTFinalAmt" name="GSTFinalAmt" /> </td> </tr> <!--<tr>--> <!-- <td>GST Discount</td><td><b><i class='fa fa-inr'></i> <span align='right' id="gstAmt"></b></span></td>--> <!--</tr>--> </tfoot> </table> <?php $medicine_slot = "SELECT * FROM medicine_slot WHERE prescriptionid='$_GET[prescriptionid]' AND patientid='$_GET[patientid]' AND action='Disperse'"; $qMS = mysqli_query($con,$medicine_slot); $rMS = mysqli_fetch_array($qMS); if($rMS['action']=='Disperse' ) ?> <b> <input id="addAll" type="submit" name="saveAmt" value="Pay" /><br /> </form> <?php ?> </table> <br> <script type="text/javascript" src="http://ajax.microsoft.com/ajax/jQuery/jquery-1.4.2.min.js"> </script> <script type="text/javascript"> $(function() { $("#addAll").click(function() { var add = 0; $(".price").each(function() { add += Number($(this).val()); }); // $("#val").text("Rs : " +add); $('#total_value').val(add); var Disadd = 0; $(".DisPrice").each(function() { Disadd += Number($(this).val()); }); // $("#val").text("Rs : " +add); $('#Final_value').val(Disadd); }); }); $(function() { $("#addAll").click(function() { }); }); // $(document).ready(function(){ // //iterate through each textboxes and add keyup // //handler to trigger sum event // $(".txt").each(function() { // $(this).keyup(function(){ // calculateSum(); // }); // }); // }); // function calculateSum() { // var sum = 0; // //iterate through each textboxes and add the values // $(".txt").each(function() { // //add only if the value is number // if(!isNaN(this.value) && this.value.length!=0) { // sum += parseFloat(this.value); // } // }); // //.toFixed() method will roundoff the final sum to 2 decimal places // $("#sum").html(sum.toFixed(2)); // $('#total_value').val(sum); // } var close = document.getElementsByClassName("closebtn"); var i; for (i = 0; i < close.length; i++) { close[i].onclick = function(){ var div = this.parentElement; div.style.opacity = "0"; setTimeout(function(){ div.style.display = "none"; }, 600); } } </script> <script> var table = document.getElementById("myTable"), sumVal = 0; $(".price").each(function() { sumVal += Number($(this).val()); }); document.getElementById("val").innerHTML = "" + sumVal; $('#total_value').val(sumVal); document.getElementById("val2").innerHTML = "" + sumVal; $('#total_value2').val(sumVal); document.getElementById("val2").innerHTML = "" + sumVal; $('#result').val(sumVal); document.getElementById("val2").innerHTML = "" + sumVal; $('#cBalance').val(sumVal); console.log(sumVal); </script> <script> ///////////////////Dis Price/////////////////// var table2 = document.getElementById("myTable"), DissumVal = 0; $(".DisPrice").each(function() { DissumVal += Number($(this).val()); }); document.getElementById("DisVal").innerHTML = "" + DissumVal; $('#Final_value1').val(DissumVal); console.log(DissumVal); </script> <script> ////////////////////GST Final Value////////////////// var table3 = document.getElementById("myTable"), sumGST = 0; $(".gst").each(function() { sumGST += Number($(this).val()); console.log(sumGST); }); document.getElementById("AddGST").innerHTML = "" + sumGST; $('#GSTFinalAmt').val(sumGST) console.log(sumGST); </script> <?php } ?>