File manager - Edit - /home/autoph/public_html/portal/includes/gpos_new.php
Back
<script> var mousex; var mousey; var move = false; var ldivx = 270; var ldivy = 80;window.onload = init; function init() { var d = document.getElementById('dragme'); d.onmousedown = mousedown;d.onmouseup = mouseup; d.onmousemove = mousemove;d.style.left = ldivx +'px'; d.style.top = ldivy +'px';d.style.display = 'block'; } function mousedown(e) { document.getElementById('dragme').style.color = 'red'; move = true;mousex = e.clientX; mousey = e.clientY; } function mouseup(e) { document.getElementById('dragme').style.color = 'black'; move = false; } function mousemove(e) { if(move){ ldivx = ldivx + e.clientX - mousex;ldivy = ldivy + e.clientY - mousey; mousex = e.clientX; mousey = e.clientY; var d = document.getElementById('dragme'); d.style.left = ldivx +'px';d.style.top = ldivy +'px'; } } </script> <?php $user = $user_data['u_name']; $comCode = $user_data['company_assignment']; $checkAccess = $user_data['add_payment']; $or = $_GET['or']; $cs = $_GET['cs']; $empFname = $_GET['empFname']; $empLname = $_GET['empLname']; $empID = $_GET['empID']; $hID = $_GET['hID']; $date = new DateTime($toDate); $week = $date->format("W"); if(isset($_GET['empID'])){ $myPatientName = $empFname ." " .$empLname. "---". $empID; }else { $myPatientName = ''; } ?> <table style='width:100%;border-collapse:collapse'> <tr> <td colspan='2' class="lightGradient" style="border:1px solid lightgray;height:28px;font-size:14px;font-weight:normal;color:gray;border-right:1px solid #f2f2f2"> <img src="images/bullet.gif" width="10px" height="10px"> </img> <b style="font-size:14px;color:red"> SPONSORS UTILIZATION SUMMARY:<?php echo "<b style='font-size:16px;color:blue'> " .$empLname ." , ".$empFname ."</b>";?></b> </td> <td align='center' class="lightGradient" style='width:3%;background:#F2F2F2;border:1px solid lightgray'> <a href='main_new.php?view=302&sid=SP1&sview=302&tab=2#id-2'> <input type='button' name='close' value='X' style='width:25px;font-size:16;font-weight:bold;height:25px'></a> </td> </tr> </table> <?php $pageWasRefreshed = isset($_SERVER['HTTP_CACHE_CONTROL']) && $_SERVER['HTTP_CACHE_CONTROL'] ==='max-age=0'; if($pageWasRefreshed){ }else{ if($checkAccess == '0'){ secalert(); }else{ //============================================================================================== echo "<div id ='dragme' style='position:absolute;width:99.6%;height:398px;border:1px solid white;border-radius:5px;background:#EFFBFB;'>"; echo "<center>"; echo "<table style='width:100%;background:yellow;border-collapse:collapse'> <form action='' method='POST'> <input type='hidden' name='view' value='gpay'>"; echo "<tr>"; echo "<td style='min-width:100px'>Name of Patient:</td>"; echo "<td style='width:350px'>"; echo "<input type='text' name='patientName' id='tags' value='".$myPatientName."' placeholder='TYPE NAME OF PATIENT' style='width:100%;height:26px;padding:2px;background:white;border:1px solid red;padding-left:5px'>"; echo "</td>"; echo "</tr>"; echo "<tr>"; echo "<td style='width:50px'>Select Item:</td>"; echo "<td style='width:350px'>"; echo "<input type='text' name='medicine' id='med' value='' placeholder='TYPE MEDICINE DESC' style='width:100%;height:26px;padding:2px;background:white;border:1px solid blue;padding-left:5px'>"; echo "</td>"; echo "</tr>"; echo "<tr>"; echo "<td style='width:50px'>Type of Payment</td>"; echo "<td align='left' style='width:100px'><select name='paymentmethod' style='width:150px;height:25px; border:1px solid gray;border-radius:5px;font-size:14px;color:gray;background:yellow'> <option style='font-size:14px'>".$_GET['gName']."</option> </select> LOE No. <input type='text' name='LOENumber' style='background:#A9E2F3;width:130px;height:25px;padding;2px;border:1px solid blue;text-align:center' > Approval: <input type='text' name='ApprovalCode' style='background:#A9E2F3;width:150px;height:25px;padding;2px;border:1px solid blue; text-align:center' > </td>"; echo "</tr>"; echo "<tr>"; echo "<td style='width:50px'>Quantity</td>"; echo "<td align='left' style='width:100px'> <input type='text' name='qty' value='1' style='text-align:center;font-size:14px;font-weight:bold;color:#0B0B61;width:60px;height:25px;border:1px solid lightgray;border-radius:3px;background:yellow' required> Amount: <input type='text' id='amount' name='Amount' style='text-align:right;font-size:14px;font-weight:bold;color:#0B0B61;width:200px;height:25px;border:1px solid lightgray;border-radius:3px;background:yellow' placeholder='0.00' required> </td>"; echo "</tr>"; echo "<tr>"; echo "<td style='width:50px'>O.R Number</td>"; echo "<td align='left' style='width:100px'> <input type='text' id='ornumber' value='".$or."' name='OrNo' style='text-align:center;font-size:14px;font-weight:bold;color:black;width:200px;height:30px;border:1px solid lightgray;border-radius:3px;background:yellow' disabled placeholder='O.R Number' required> C.S Number <input type='text' id='csnumber' value='".$cs."' name='CSNo' style='text-align:center;font-size:14px;font-weight:bold;color:#000;width:200px;height:30px;border:1px solid lightgray;border-radius:3px;background:yellow' placeholder='NA' required> </td>"; echo "</tr>"; echo "<tr>"; echo "<td style='width:50px'>Remarks:</td>"; if($_GET['gName']==='INTELLICARE' || $_GET['gName']==='MEDICARD' || $_GET['gName']==='VALUECARE'){ echo "<td align='right' style='width:100px'> <input type='text' name='remarks' value='' style='text-align:left;font-size:14px;font-weight:normal;color:red;width:100%;height:30px;border:1px solid gray;border-radius:3px;background:lightyellow' placeholder='ENTER AUTHORIZATION CODE' required> </td>"; }else{ echo "<td align='right' style='width:100px'> <input type='text' name='remarks' value='Payment charge to guarantee letter, refer to OR number ".$or."' style='text-align:left;font-size:14px;font-weight:normal;color:red;width:100%;height:30px;border:1px solid gray;border-radius:3px;background:lightyellow'> </td>"; } echo "</tr>"; echo "<tr>"; echo "<td colspan='2' align='center' style='width:300px;height:35px;border:1px solid #EFFBFB;background:#fff;font-size:14px'> <input type='submit' name='addpayments' value='Save Record' style='width:100px;height:30px;border:1px solid gray;border-radius:3px;text-align:center;font-size:14px;font-weight:normal' class='lightGradient'> <a href='main_new.php?view=302&sid=SP1&sview=302&tab=2#id-2'><input type='button' value='Close' style='width:100px;height:30px;border:1px solid gray;border-radius:3px;text-align:center;font-size:14px;font-weight:normal' class='lightGradient'></a> </td>"; echo "</tr>"; echo "</form> </table> </center>"; //====================================================== echo "<div style='padding:5px;height:180px;overflow:auto'position:relative;width:100%'> <table style='width:100%;border-collapse:collapse;'>"; echo "<tr>"; echo "<td cols='5'>"; $qq=mysql_query("SELECT * FROM `guarantee_letter_usage` WHERE `p_id`='$empID' AND `or_number`='$or' AND `branch_code`='$comCode' ORDER by `date` ASC"); echo "<table style='width:100%; border:1px solid white; border-collapse:collapse;'>"; echo "<tr> <th class='Gradient' style='text-align:center;width:30px;background:lightgray;border:1px solid gray;font-size:12px;height:20px'>No.</th> <th class='Gradient' align='center' style='width:50px;background:lightgray;border:1px solid gray;font-size:12px'>Availment Date</th> <th class='Gradient' align='center' style='width:50px;background:lightgray;border:1px solid gray;font-size:12px'>Reference Number</th> <th class='Gradient' align='center' style='width:200px;background:lightgray;border:1px solid gray;font-size:12px'>Item Description</th> <th class='Gradient' align='center' style='width:30px;background:lightgray;border:1px solid gray;font-size:12px'>Qty</th> <th class='Gradient' align='center' style='width:50px;background:lightgray;border:1px solid gray;font-size:12px'>Total Amount</th> </tr>"; //$TreatmentUsage = mysql_result(mysql_query("SELECT COUNT('session_id') FROM `treatment_session` WHERE `session_patient_id`='$patientID' AND `session_header_id`='$transactionID'"),0); while($row = mysql_fetch_array($qq)){ $totalORAmount = $row['amount'] +$totalORAmount; $count = $count +1; echo "<tr>"; echo "<td align='center' style='font-size:10px;'>".$count."</td>"; echo "<td align='center' style='font-size:10px;'>".$row['date']."</td>"; echo "<td align='center' style='font-size:10px;'>".$row['or_number']."</td>"; echo "<td style='font-size:10px;'>"; $item_id = $row['item_id']; $itemDesc = mysql_result(mysql_query("SELECT `medicine_desc` FROM `medicines` WHERE `medicine_id`='$item_id'"),0); echo $itemDesc; echo "</td>"; echo "<td align='center' style='font-size:10px;'>".$row['qty']."</td>"; echo "<td align='right' style='font-size:10px;'>".$row['amount']."</td>"; echo "</tr>"; } echo "<tr>"; echo "<th colspan='7' align='right'> <b style='font-size:14px;'>TOTAL </b> "; echo number_format($totalORAmount,2,'.',','); echo "</th></tr>"; echo "</table></div>"; echo "</td>"; echo "</tr>"; echo "</table>"; echo "</div>"; //============================================================================================== } //============================================================================================== if(isset($_GET['action'])){ $search = $_GET['action']; if($search==='search'){ echo "<div style='position:absolute;width:800px;height:400px;left:100px;top:200px;border:1px solid gray;border-radius:5px;background:#EFFBFB;'>"; echo "<h3>ITEM SEARCH...</h3><div style='top:-20px;left:96%;position:relative'> <a href='main_new.php?view=gpay&hID=".$hID."&gName=".$gName."&cs=".$cs."&or=".$_GET['or']."&empFname=".$_GET['empFname']."&empLname=".$_GET['empLname']."&empID=".$_GET['empID']."><img src='images/closebutton.png' width='25px' height='25px'></img></a></div>"; echo "<form action='' method='POST'>"; echo "<center><br><input type='text' name='searchItem' style='text-align:center;font-size:14px;width:400px;height:35px;border:1px solid gray;background:white;border-radius:3px'> <input type='submit' name='itemsearch' value='Search...' style='font-size:14px;font-weight:bold;width:80px;height:35px;border:1px solid gray;border-radius:3px'></center>"; echo "<table style='border-collapse:collapse:width:100%;'>"; echo "</table>"; echo "</form>"; //search item //================================================================================================================= //================================================================================================================= if(isset($_POST['itemsearch'])){ $medicinelookup = $_POST['searchItem']; $q=mysql_query("SELECT * FROM `medicines` WHERE `medicine_desc` LIKE '%$medicinelookup%'"); $row=mysql_fetch_array($q); $total=mysql_num_rows($q); $dis=30; $total_page=ceil($total/$dis); $page_cur=(isset($_GET['page']))?$_GET['page']:1; $k=($page_cur-1)*$dis; $page_cur = mysql_real_escape_string($page_cur); $qq=mysql_query("SELECT * FROM `medicines` WHERE `medicine_desc` LIKE '%$medicinelookup%'"); echo "<br><table style='width:100%; height:95% border:1px solid white; border-collapse:collapse;background:lightgreen'>"; echo "<tr> <th class='Gradient' style='text-align:center;width:80px;background:#f5f5f5;border:1px solid gray;font-size:11px;height:25px'>No.</th> <th class='Gradient' style='text-align:center;width:100px;background:#f5f5f5;border:1px solid gray;font-size:11px;height:25px'>Item Code</th> <th class='Gradient' style='text-align:center;width:300px;background:#f5f5f5;border:1px solid gray;font-size:11px;height:25px'>Medicine</th> <th class='Gradient' style='text-align:center;width:100px;background:#f5f5f5;border:1px solid gray;font-size:11px;height:25px'>Type</th> <th class='Gradient' align='center' style='text-align:center;width:50px;background:#f5f5f5;border:1px solid gray;font-size:11px;height:25px'>-</th>"; echo "</tr>"; while($row = mysql_fetch_array($qq)){ $itemID=$row['medicine_id']; $checkInvnty = mysql_result(mysql_query("SELECT `item_qty` FROM `inventory` WHERE `item_id`='$itemID'"),0); $count =$count + 1 ; echo "<form action='' method='POST'><tr>"; echo "<input type ='hidden' name='sessionID' value='$sessionID'>"; echo "<input type ='hidden' name='patientID' value='$patientID'>"; echo "<input type ='hidden' name='itemID' value='$itemID'>"; echo "<input type ='hidden' name='hID' value='$headerID'>"; echo "<td>".$count."</td>"; echo "<td style='font-size:10px;'>".$row['item_code']."</td>"; echo "<td style='font-size:10px;'>".$row['medicine_desc']."</td>"; echo "<td style='font-size:10px;'>".$row['type']."</td>"; if($checkInvnty > 0){ echo "<td align='center' style='font-size:10px;'> <abbr title='".$checkInvnty."'> <a href='mainindex.php?view=gpay&hID=".$hID."&gName=".$gName."&cs=".$cs."&or=".$_GET['or']."&empFname=".$_GET['empFname']."&empLname=".$_GET['empLname']."&empID=".$empID."&med=".$row['medicine_desc']."---" .$row['medicine_id']."'><input type='button' name='nurseaddmed' value='Insert' style='width:50px;height:20px; border:1px solid lightgray;border-radius:5px;font-size:10px;font-weight:bold;color:blue'></a></abbr> </td>"; }else { echo "<td align='center' style='font-size:10px;'> <abbr title='No Stock Available'> <input type='submit' name='nurseaddmed' value='N.S' style='width:50px;height:20px; border:1px solid lightgray;border-radius:5px;font-size:10px;font-weight:bold;color:gray' disabled></abbr> </td>"; } echo "</tr></form>"; } echo "</table>"; } } echo "</div>"; } //================================================================================================================= //================================================================================================================= //Saving Records Guarantee letter usage if(isset($_POST['addpayments'])){ $curYear =$toDate; $exCurYear = explode("/",$curYear); $selYear = $exCurYear[2]; //CHECK IF PCSO OR HMO $Type = $_GET['gName']; if($Type === 'PCSO'){ $pfType ='PCSO'; }else { $pfType ='HMO'; } $LOENumber = $_POST['LOENumber']; $ApprovalCode = $_POST['ApprovalCode']; $patientName = $_POST['patientName']; $itemName = $_POST['medicine']; $exPatient = explode("---",$patientName); $exItem = explode("---",$itemName); $hID = $_GET['hID']; $empID = $_GET['empID']; $itemID = $exItem[1]; $itemDesc= $exItem[0]; $pfName = mysql_result(mysql_query("SELECT `patient_fname` FROM `patient_list` WHERE `patient_id`='$empID'"),0); $plName = mysql_result(mysql_query("SELECT `patient_lname` FROM `patient_list` WHERE `patient_id`='$empID'"),0); $docID = mysql_result(mysql_query("SELECT `assigned_doctor` FROM `patient_list` WHERE `patient_id`='$empID'"),0); $paymentmethod=$_POST['paymentmethod']; $Amount=$_POST['Amount']; $remarks=$_POST['remarks']; $remarks = mysql_real_escape_string($remarks); $OrNo= $_GET['or']; $gName=$_GET['gName']; $CSNo= $_POST['CSNo']; //echo "My CS Number: ". $cs; //exit; $medType = mysql_result(mysql_query("SELECT `type` FROM `medicines` WHERE `medicine_id`='$itemID'"),0); $qty = $_POST['qty']; //CHECK IF INVENTORY $pPackage =mysql_result(mysql_query("SELECT `index_hdr_package` FROM `pindex_hdr` WHERE `index_patient_id` = '$empID' AND `index_hdr_status`='Open' AND `branch_code`='$comCode'"),0); $onHand = mysql_result(mysql_query("SELECT `item_qty` FROM `inventory` WHERE `item_id`='$itemID' AND `inv_comp_id` = '$comCode'"),0); //UPDATE usage Amount $uAmount =mysql_result(mysql_query("SELECT `g_usage` FROM `guarantee_letter` WHERE `g_id`='$hID' AND `g_patient_id`='$empID' AND `ref_id`='$OrNo' AND `g_branch_code`='$comCode'"),0); $orAmount = mysql_result(mysql_query("SELECT `g_amount` FROM `guarantee_letter` WHERE `g_id`='$hID' AND `g_patient_id`='$empID' AND `ref_id`='$OrNo' AND `g_branch_code`='$comCode'"),0); $totalUsageIF = $uAmount + $Amount; $newAmount = $uAmount + $Amount; $balance = $orAmount - $uAmount; //==================================================================================================================== //==================================================================================================================== //==================================================================================================================== //INSERT ENTRY TO DIALYZER TABLE IF SELECTED ITEMS IS DIALYER //=========================================================== //Error: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '`,issued_by`,`reused_count`,`expired_date`,`remarks`,`dialyer_status`) VA' at line 1 $checkItemType = mysql_result(mysql_query("SELECT `type` FROM `medicines` WHERE `medicine_id`='$itemID'"),0); if($checkItemType ==='Dialyzer'){ $checkPrescription = mysql_result(mysql_query("SELECT `dialyzer` FROM `patient_list` WHERE `patient_id`='$empID'"),0); if($itemID != $checkPrescription){ //echo "<br>checkItemType" . $checkItemType; //echo "<br>checkPrescription" . $checkPrescription; //echo "<br>itemID" . $itemID; echo " <center> <div style='position:absolute;width:300px;height:185x;left:250px;top:200px;border:1px solid red;border-radius:5px;background:white'> <table> <tr> <td align='center' style='font-size:12px;font-weight:normal;color:red;width:300px;height:140px;background:white;border:1px solid white'><br> <h3>WRONG DIALYZER!</h3></td> </tr> <tr> <td align='center' style='font-size:15px;font-weight:normal;color:red;width:100px;height:100px;background:white;border:1px solid white'> <img src='images/istop.png' width='60px' height='60px'> </img> </td> <td align='center' style='font-size:12px;font-weight:normal;color:red;width:300px;height:100px;background:white;border:1px solid white'> WARNING! You are giving a wrong Dialyzer to patient. Prescribed dialyzer by doctor was code: <b style='font-size:12px;color:blue'>".$checkPrescription."</b>. Please check your entry and try again, or you may ask your nurser/doctor for updates. Thank you.<br><br> </td> <tr> <td colspan='2' align='center' style='font-size:15px;font-weight:normal;color:red;width:300px;height:10px;background:white;border:1px solid white'> <a href='main_new.php?view=302&sview=302&sid=SP1&action=use&hID=".$_GET['hID']."&empID=".$_GET['empID']."&gName=".$_GET['gName']."&or=".$_GET['or']."&empFname=".$_GET['empFname']."&empLname=".$_GET['empLname']."&tab=0#id-2'> <input style='background-color:#E5E4E2;border:1px black solid;border-radius:5px;width:120px;height:30px;color:black;font-size:16px;font-weight:bold;'type ='button' name ='edit' value = 'Close'> </a> <br> <br> </td> </tr> </tr> </table> </div> </center>"; exit(); } $IssuedDialyzer = 'true'; } //================================================================================================================= //CHECK FOR DUPLICATE TREATMENT PAYMENT. SYSTEM WILL ALLOW ONLY ONE PAYMENT PER OR //================================================================================================================= if($itemID ==='219'){ $ddup = mysql_result(mysql_query("SELECT COUNT('payment_id') FROM `payments` WHERE `item_id` = '219' AND `patient_id`='$empID' AND `branch_code`='$comCode' AND `payment_date`='$toDate'"),0); if($ddup > 0){ echo " <center> <div style='z-index:5002;position:absolute;visibility:visible;width:400px;height:185x;left:250px;top:200px;border:2px solid red;border-radius:5px;background:white'> <table> <tr> <td colspan='2' style='font-size:15px;font-weight:normal;color:red;width:500px;height:10px;background:white;border:1px solid white'><h3>SYSTEM ALERT!</h3></td> </tr> <tr> <td align='center' style='font-size:15px;font-weight:normal;color:red;width:100px;height:100px;background:white;border:1px solid white'> <img src='images/istop.png' width='60px' height='60px'> </img> </td> <td align='center' style='font-size:12px;font-weight:normal;color:red;width:500px;height:100px;background:white;border:1px solid white'> WARNING! Duplicate treatment is detected, you can only process one (1) treament session per day per Patient. Please check your entry and try again.<br><br> </td> <tr> <td colspan='2' align='center' style='font-size:15px;font-weight:normal;color:red;width:500px;height:10px;background:white;border:1px solid white'> <a href='main_new.php?view=302&sview=302&sid=SP1&action=use&hID=".$_GET['hID']."&empID=".$_GET['']."&gName=".$_GET['gName']."&or=".$_GET['or']."&empFname=".$_GET['empFname']."&empLname=".$_GET['empLname']."&tab=0#id-2'> <input style='background-color:#E5E4E2;border:1px black solid;border-radius:5px;width:120px;height:30px;color:black;font-size:16px;font-weight:bold;'type ='button' name ='edit' value = 'Close'> </a> <br> <br> </td> </tr> </tr> </table> </div> </center>"; exit(); } } //=========================================================== //CHECK IF PREVIOUSLY ISSUED DIALZYER STILL USABLE OR NOT EXHUASTED YET //=========================================================== $chkDialyzerUsage = mysql_result(mysql_query("SELECT `reused_count` FROM `dialyzer_usage` WHERE `pID`='$empID' AND `dialyzer_status`='Open' AND `dialyzer_code`='$itemID'"),0); if($chkDialyzerUsage < 10 && $chkDialyzerUsage !=''){ echo "<center> <div style='position:absolute;width:300px;height:185x;left:250px;top:200px;border:1px solid red;border-radius:5px;background:white'> <table> <tr> <td align='center' style='font-size:12px;font-weight:normal;color:red;width:300px;height:140px;background:white;border:1px solid white'><br> <h3>DIALYZER ISSUANCE ERROR</h3></td> </tr> <tr> <td align='center' style='font-size:12px;font-weight:normal;color:red;width:100px;height:100px;background:white;border:1px solid white'> <img src='images/istop.png' width='60px' height='60px'> </img> </td> <td align='center' style='font-size:12px;font-weight:normal;color:red;width:500px;height:100px;background:white;border:1px solid white'> WARNING! Previously issued dialyzer is not exhausted yet with only <b style='font-size:12px;color:blue'>(".$chkDialyzerUsage." / 10)</b> re-used count. If dialyzer already expired, kindly update patient record first to process new issuance. Thank you.<br><br> </td> <tr> <td colspan='2' align='center' style='font-size:12px;font-weight:normal;color:red;width:500px;height:10px;background:white;border:1px solid white'> <a href='main_new.php?view=302&sview=302&sid=SP1&action=use&hID=".$_GET['hID']."&empID=".$_GET['']."&gName=".$_GET['gName']."&or=".$_GET['or']."&empFname=".$_GET['empFname']."&empLname=".$_GET['empLname']."&tab=0#id-2'> <input style='background-color:#E5E4E2;border:1px black solid;border-radius:5px;width:120px;height:30px;color:black;font-size:16px;font-weight:bold;'type ='button' name ='edit' value = 'Close'> </a> <br> <br> </td> </tr> </tr> </table> </div> </center>"; exit(); } //==================================================================================================================== //==================================================================================================================== //==================================================================================================================== if($totalUsageIF > $orAmount) { echo " <center> <div style='position:absolute;width:300px;height:185x;left:250px;top:200px;border:1px solid red;border-radius:5px;background:white'> <table> <tr> <td align='center' style='font-size:12px;font-weight:normal;color:red;width:300px;height:140px;background:white;border:1px solid white'><br> Amount not sufficient. You only have <b style='font-size:18px;color:blue'>".number_format($balance,2,'.',',')."</b>. Please check your entry and try again. Thank you!</font> <br> <br> <a href='main_new.php?view=302&sid=SP1&sview=302&tab=2#id-2'><br> <input style='background-color:#E5E4E2;border:1px black solid;border-radius:5px;width:120px;height:30px;color:black;font-size:16px;font-weight:bold;'type ='button' name ='edit' value = 'Close'> </a> <br><br> </td> </tr> </table> </div> </center>"; break; } if($itemDesc != 'Treatment'){ if($onHand >= $qty){ $adsql="INSERT INTO `guarantee_letter_usage` (`gu_id`, `g_id`,`ref_id`,`p_id`,`cs_number`, `or_number`,`item_id`, `qty`,`amount`,`date`, `time`,`by`,`branch_code`,`remarks`,`sponsor_loe`,`sponsor_approval`) VALUES('','$hID','$OrNo','$empID','$CSNo','$OrNo','$itemID','$qty','$Amount','$toDate','$currentTime','$user','$comCode','$remarks','$LOENumber','$ApprovalCode')"; if(!mysql_query($adsql)){ die('Error: ' . mysql_error()); }else{ } mysql_query("UPDATE `guarantee_letter` SET `g_usage` = '$newAmount' WHERE `g_patient_id`='$empID' AND `ref_id`='$OrNo' AND `g_branch_code`='$comCode'"); //UPDATE usage Amount //UPDATE INVENTORY RECORD $qtyBalance = $onHand - $qty; mysql_query("UPDATE `inventory` SET `item_qty` = '$qtyBalance' WHERE `item_id`='$itemID' AND `inv_comp_id`='$comCode'"); //CREATE HEADER IN SALES JOURNAL $checkIfExist = mysql_result(mysql_query("SELECT COUNT('journal_hdr') FROM `sales_journal_hdr` WHERE `journal_date`='$toDate' AND `journal_comp_id`='$comCode' AND `ref_number`='$OrNo'"),0); if($checkIfExist == 0){ $hdrsql="INSERT INTO `sales_journal_hdr` (`journal_hdr`, `ref_number`,`journal_patient_id`,`journal_date`,`journal_time`,`journal_by`,`journal_comp_id`,`cs_number`,`notes`) VALUES('','$OrNo','$empID','$toDate','$currentTime','$user','$comCode','$CSNo','Receivables')"; if(!mysql_query($hdrsql)){ die('Error: ' . mysql_error()); }else{ } } //Add entry to sales journal details $sql="INSERT INTO `sales_journal` (`sj_id`, `trans_id`,`patient_id`,`cust_fname`, `cust_lname`,`item_id`,`item_desc`, `trans_qty`,`amount`,`trans_type`,`trans_date`,`trans_time`,`trans_by`,`remarks`,`branch_code`,`doctor_id`,`cs_number`) VALUES('','$OrNo','$empID','$pfName','$plName','$itemID','$itemDesc','$qty','$Amount','$paymentmethod','$toDate','$currentTime','$user','$remarks','$comCode','$docID','$CSNo')"; if(!mysql_query($sql)){ die('Error: ' . mysql_error()); }else{ } //UPDATE STOCKCARD TABLE $begQTY = $onHand; $endQTY = $begQTY - $qty; $sql="INSERT INTO `stockcard` (`stk_id`, `ref_number`, `trans_type`,`item_id`,`beg_qty`,`trans_qty`,`end_qty`,`date`,`time`,`branch_code`,`by`,`posted`,`transType`) VALUES('','$OrNo','Sales Transaction','$itemID','$begQTY','$qty','$endQTY','$toDate','$currentTime','$compCode','$user','No','$paymentmethod')"; if(!mysql_query($sql)){ die('Error: ' . mysql_error()); } //=========================================================== //INSERT ENTRY TO DIALYZER TABLE IF SELECTED ITEMS IS DIALYER //=========================================================== //$checkItemType = mysql_result(mysql_query("SELECT `type` FROM `medicines` WHERE `medicine_id`='$itemID'"),0); // ErrorError: Unknown column 'dialyer_status' in 'field if($IssuedDialyzer === 'true'){ $hdrsql="INSERT INTO `dialyzer_usage` (`trans_id`,`pay_id`,`issued_date`,`issued_time`,`issued_by`,`reused_count`,`expired_date`,`remarks`,`dialyzer_status`,`pID`,`dialyzer_code`) VALUES('','$OrNo','$toDate','$currentTime','$user','','','New Issuance','Open','$empID','$itemID')"; if(!mysql_query($hdrsql)){ die('Error: ' . mysql_error()); }else{ } } //=========================================================== //=========================================================== //Insert records to payments table // amount chargeable to sponsor $sql="INSERT INTO `payments` (`payment_id`, `last_name`,`payment_or`,`payment_amount`, `payment_type`, `payment_by`,`payment_date`,`payment_time`, `quantity`,`item_id`,`patient_id`,`payment_method`,`branch_code`,`remarks`,`cancel`,`year`,`week`,`payment_cs`,`sponsor_loe`,`sponsor_approval`) VALUES('','$plName','$OrNo','$Amount','$medType','$user','$toDate','$currentTime','$qty','$itemID','$empID','$paymentmethod','$comCode','$remarks','no','$selYear','$week','$CSNo','$LOENumber','$ApprovalCode')"; if(!mysql_query($sql)){ die('Error: ' . mysql_error()); }else{ echo " <center> <div style='position:absolute;width:300px;height:185x;left:250px;top:200px;border:1px solid red;border-radius:5px;background:white'> <table> <tr> <td align='center' style='font-size:12px;font-weight:normal;color:red;width:300px;height:140px;background:white;border:1px solid white'><br> Payment has been received with issued O.R Number ".$OrNo.". <br><br>Thank you!</font> <br> <br> <a href='main_new.php?view=302&sview=302&sid=SP1&action=use&hID=".$hID."&gName=".$gName."&cs=".$CSNo."&or=".$OrNo."&empFname=".$pfName."&empLname=".$plName."&empID=".$empID."&tab=2#id-2'><br> <input style='background-color:#E5E4E2;border:1px black solid;border-radius:5px;width:120px;height:30px;color:black;font-size:16px;font-weight:bold;'type ='button' name ='CLOSE' value = 'CLOSE'> </a> <br><br> </td> </tr> </table> </div> </center>"; } }else{ echo " <center> <div style='position:absolute;width:300px;height:185x;left:250px;top:200px;border:1px solid red;border-radius:5px;background:white'> <table> <tr> <td align='center' style='font-size:12px;font-weight:normal;color:red;width:300px;height:140px;background:white;border:1px solid white'><br> Sorry, you don't have enough stock available. Please check your entry and try again. <br><br>Thank you!</font> <br> <br> <a href='main_new.php?view=302&sview=302&sid=SP1&action=use&hID=".$_GET['hID']."&empID=".$_GET['empID']."&gName=".$_GET['hID']."&or=".$_GET['or']."&empFname=".$_GET['empFname']."&empLname=".$_GET['empLname']."&tab=0#id-2'><br> <input style='background-color:#E5E4E2;border:1px black solid;border-radius:5px;width:120px;height:30px;color:black;font-size:16px;font-weight:bold;'type ='button' name ='edit' value = 'Close'> </a> <br><br> </td> </tr> </table> </div> </center>"; } }else{ //=====================================================================================================================================================// // IF TREATMENT TRANSACTION USING GL //=====================================================================================================================================================// if($pPackage==='OUTRIGHT_PATIENT'){ $pfType = mysql_result(mysql_query("SELECT `pf_type` FROM `patient_list` WHERE `patient_id`='$empID'"),0); // PER BRACH PACKAGE $ChargeablePF = mysql_result(mysql_query("SELECT `doctor_pf` FROM `package_header` WHERE `package_code`='$pPackage' AND `branch_code`='$comCode'"),0); $PgName = $_GET['gName']; $gName = "Tx-".$PgName; $gPFName =$gName ."-PF"; $gINCName =$gName ."-Incentive"; $ChargeablePF = mysql_result(mysql_query("SELECT `pf_amount` FROM `sponsors` WHERE `sponsor_name`='$PgName'"),0); $ChargeableIncentives =mysql_result(mysql_query("SELECT `incentive` FROM `sponsors` WHERE `sponsor_name`='$PgName'"),0); $companyAmount = ($Amount - $ChargeablePF) - $ChargeableIncentives; $docID = mysql_result(mysql_query("SELECT `assigned_doctor` FROM `patient_list` WHERE `patient_id`='$empID'"),0); //CREATE HEADER IN SALES JOURNAL $checkIfExist = mysql_result(mysql_query("SELECT COUNT('journal_hdr') FROM `sales_journal_hdr` WHERE `journal_date`='$toDate' AND `journal_comp_id`='$comCode' AND `ref_number`='$OrNo'"),0); if($checkIfExist == 0){ $hdrsql="INSERT INTO `sales_journal_hdr` (`journal_hdr`, `ref_number`,`journal_patient_id`,`journal_date`,`journal_time`,`journal_by`,`journal_comp_id`,`cs_number`,`notes`) VALUES('','$OrNo','$empID','$toDate','$currentTime','$user','$comCode','$CSNo','Receivables')"; if(!mysql_query($hdrsql)){ die('Error: ' . mysql_error()); }else{ } } //insert charging amount to sales journal tag as cash (co-pay amount) $sql="INSERT INTO `sales_journal` (`sj_id`, `trans_id`,`cs_number`,`patient_id`,`cust_fname`, `cust_lname`,`item_id`,`item_desc`, `trans_qty`,`amount`,`trans_type`,`trans_date`,`trans_time`,`trans_by`,`remarks`,`branch_code`,`doctor_id`) VALUES('','$OrNo','$CSNo','$empID','$pfName','$plName','0','$gName','1','$companyAmount','Receivables','$toDate','$currentTime','$user','','$comCode','$docID')"; if(!mysql_query($sql)){ die('Error: ' . mysql_error()); }else{ } //insert PF amount to sales journal $sql="INSERT INTO `sales_journal` (`sj_id`, `trans_id`,`cs_number`,`patient_id`,`cust_fname`, `cust_lname`,`item_id`,`item_desc`, `trans_qty`,`amount`,`trans_type`,`trans_date`,`trans_time`,`trans_by`,`remarks`,`branch_code`,`doctor_id`) VALUES('','$OrNo','$CSNo','$empID','$pfName','$plName','0','$gPFName','1','$ChargeablePF','Receivables','$toDate','$currentTime','$user','','$comCode','$docID')"; if(!mysql_query($sql)){ die('Error: ' . mysql_error()); }else{ } if($ChargeableIncentives > 0){ $sql="INSERT INTO `sales_journal` (`sj_id`, `trans_id`,`cs_number`,`patient_id`,`cust_fname`, `cust_lname`,`item_id`,`item_desc`, `trans_qty`,`amount`,`trans_type`,`trans_date`,`trans_time`,`trans_by`,`remarks`,`branch_code`,`doctor_id`) VALUES('','$OrNo','$CSNo','$empID','$pfName','$plName','0','$gINCName','1','$ChargeableIncentives','$paymentmethod','$toDate','$currentTime','$user','','$comCode','$docID')"; if(!mysql_query($sql)){ die('Error: ' . mysql_error()); }else{ } } $adsql="INSERT INTO `guarantee_letter_usage` (`gu_id`, `g_id`,`ref_id`,`p_id`,`cs_number`, `or_number`,`item_id`, `qty`,`amount`,`date`, `time`,`by`,`branch_code`,`remarks`,`sponsor_loe`,`sponsor_approval`) VALUES('','$hID','$OrNo','$empID','$CSNo','$OrNo','$itemID','$qty','$Amount','$toDate','$currentTime','$user','$comCode','$remarks','$LOENumber','$ApprovalCode')"; if(!mysql_query($adsql)){ die('Error: ' . mysql_error()); }else{ } mysql_query("UPDATE `guarantee_letter` SET `g_usage` = '$newAmount' WHERE `g_patient_id`='$empID' AND `ref_id`='$OrNo' AND `g_branch_code`='$comCode'"); //NEWLY ADJUSTED CODE TO AUTOMATE ENDORSEMENT OF PATIENT FOR OUTRIGHT PACKAGE //IF item is TREATMENT //ENDORSE PATIENT TO NURSE STATIONS IF TREAMENT PAYMENT IS DETECTED DURING CASHIER'S TRANSACTION //UPDATE CHECK-IN STATUS mysql_query("UPDATE `pindex_hdr` SET `active_session` = 'Yes',`pf_type`='$pfType', `patient_status`='In' WHERE `index_hdr_status`='Open' AND `branch_code`='$comCode' AND `index_patient_id`='$empID'"); mysql_query("UPDATE `patient_list` SET `patient_status`='In' WHERE `patient_id`='$empID' AND `branch_code`='$comCode'"); //Insert records to payments table $sql="INSERT INTO `payments` (`payment_id`, `last_name`,`payment_or`,`payment_cs`,`payment_amount`, `payment_type`, `payment_by`,`payment_date`,`payment_time`, `quantity`,`item_id`,`patient_id`,`payment_method`,`branch_code`,`remarks`,`sponsor_loe`,`sponsor_approval`) VALUES('','$plName','$OrNo','$CSNo','$Amount','$medType','$user','$toDate','$currentTime','$qty','$itemID','$empID','$paymentmethod','$comCode','$remarks','$LOENumber','$ApprovalCode')"; if(!mysql_query($sql)){ die('Error: ' . mysql_error()); }else{ echo " <center> <div style='position:absolute;width:300px;height:185x;left:250px;top:200px;border:1px solid red;border-radius:5px;background:white'> <table> <tr> <td align='center' style='font-size:12px;font-weight:normal;color:red;width:300px;height:140px;background:white;border:1px solid white'><br> Payment has been received with issued O.R Number ".$OrNo.". <br><br>Thank you!</font> <br> <br> <a href='main_new.php?view=302&sview=302&sid=SP1&action=use&hID=".$hID."&gName=".$gName."&cs=".$CSNo."&or=".$OrNo."&empFname=".$pfName."&empLname=".$plName."&empID=".$empID."&tab=2#id-2'><br> <input style='background-color:#E5E4E2;border:1px black solid;border-radius:5px;width:120px;height:30px;color:black;font-size:16px;font-weight:bold;'type ='button' name ='CLOSE' value = 'CLOSE'> </a> <br><br> </td> </tr> </table> </div> </center>"; } } else { echo " <center> <div style='position:absolute;width:300px;height:185x;left:250px;top:200px;border:1px solid red;border-radius:5px;background:white'> <table> <tr> <td align='center' style='font-size:12px;font-weight:normal;color:red;width:300px;height:140px;background:white;border:1px solid white'><br> Please change package to OUTRIGHT_PATIENT.... <br><br>Thank you!</font> <br> <br> <a href='main_new.php?view=200&sid=P1&sview=200&tab=1#id-1'><br> <input style='background-color:#E5E4E2;border:1px black solid;border-radius:5px;width:120px;height:30px;color:black;font-size:16px;font-weight:bold;'type ='button' name ='edit' value = 'Close'> </a> <br><br> </td> </tr> </table> </div> </center>"; } } } } ?>
| ver. 1.4 |
.
| PHP 7.3.33 | Generation time: 0 |
proxy
|
phpinfo
|
Settings