File manager - Edit - /home/autoph/public_html/connect/home/PRF_ahgPRFApproval.php
Back
<?php include 'core/init.php'; protected_page(); $uniqueRefID = $user_data['u_id']; //echo $uniqueRefID; $prfDate = date_create() ->format("Y-m-d"); $prtTime =Explode(":", date('H:i:s')); $txDate = explode("-",$prfDate); $refYear = $txDate[0]; $refMonth = $txDate[1]; $refMinute = $prtTime[1]; $refSecond = $prtTime[2]; $NewRefCode = $refMonth.''.$refMinute.''.$refSecond; ?> <!DOCTYPE html> <html lang="en"> <head> <link rel="stylesheet" type="text/css" href="css/bootstrap.css"/> <link rel="stylesheet" type="text/css" href="css/jquery-ui.css"/> <meta charset="UTF-8" name="viewport" content="width=device-width, initial-scale=1"/> </head> <body> <div class='NewPRFHeader' style=''> <p class='PRFBodyTitle'>📝 AUTOHUB ADMIN APPROVAL </p> </div> <!--########################## MAIN TABLE WINDOW ############################################--> <!--########################################################################################################--> <div class='NewPRFBody'> <!--<div class='NewPRFBodyMenu'> <div class='searchDIVA'> <b class='BodyTopMenu' id='LoadNewPRFForm' onclick='showActionSlipForm()'>➕ New Purchase </b> <b class='BodyTopMenu'>📠 Print </b> <b class='BodyTopMenu'>💾 Export</b> </div> <div class='searchDIVB'> <input type='text' id='searchText' placeholder='Search Record.' class='textSearch' style='width:70%;margin:0px;border:1px solid lightgray;'> <button id='searchNewPRF' class='searchButton' style='width:25%'> 🔍 Search</button> </div> </div>--> <div id='mainTable' class='PRFTableBody'> <div style='width:100%;height:33px;background:white'> <table> <thead> <th style='width:5%;font-family:Calibri;font-size:12px'>REC. NO</th> <th style='width:8%;font-family:Calibri;font-size:12px'>REF. CODE</th> <th style='width:8%;font-family:Calibri;font-size:12px'>REQ. DATE</th> <th style='width:8%;font-family:Calibri;font-size:12px'>COMPANY</th> <th style='width:40%;font-family:Calibri;font-size:12px'>PURPOSE OF REQUEST</th> <th style='width:7%;font-family:Calibri;font-size:12px'>DATE NEEDED</th> <th style='width:10%;font-family:Calibri;font-size:12px'>REQUEST BY</th> <th style='width:6%;font-family:Calibri;font-size:12px'>DOCS</th> </thead> </table> </div> <div class='PRFTableItems'> <table> <?php $getItemHdr = mysql_query("SELECT * FROM `prf_request_hdr` WHERE `deleted`=0 AND `ahg_admin_id`=0 AND `ahg_admin_date`='' AND `gm_approval_date`!='' AND `dept_approval_date`!='' AND `admin_approval_date`!='' ORDER BY id DESC"); //SELECT COUNT(id) FROM `prf_request_hdr` WHERE `deleted`=0 AND `ahg_admin_id`=0 AND `ahg_admin_date`='' AND `gm_approval_date`!='' AND `dept_approval_date`!='' AND `approving_admin_date`!='' while($row=mysql_fetch_array($getItemHdr)){ $itemRefCode=$row['reference_code']; $Cat = $row['category_id']; $SubCat = $row['sub_category_id']; $CatName = mysql_result(mysql_query("SELECT description FROM prf_expensecategory WHERE id='$Cat'"),0); $SubCatName = mysql_result(mysql_query("SELECT description FROM prf_expenseitems WHERE id='$SubCat'"),0); $compCode = mysql_result(mysql_query("SELECT comp_code FROM vts_company WHERE comp_id='".$row['comp_id']."'"),0); $dealCode = mysql_result(mysql_query("SELECT deal_code FROM vts_dealerships WHERE deal_id='".$row['deal_id']."'"),0); $reqBy = mysql_result(mysql_query("SELECT request_by FROM prf_request_hdr WHERE reference_code='$itemRefCode'"),0); $reqByFName = mysql_result(mysql_query("SELECT u_fname FROM vts_users WHERE u_id='$reqBy'"),0); $reqByLName = mysql_result(mysql_query("SELECT u_lname FROM vts_users WHERE u_id='$reqBy'"),0); $getPRFApprovalCode = mysql_result(mysql_query("SELECT current_status FROM prf_request_hdr WHERE reference_code='$itemRefCode' "),0); //if($getPRFApprovalCode == 4){ ?><tr onclick="javascript:showPRFheaderForDeletion(this);"><?php echo "<td style='width:5%'>".$row['id']."</td>"; echo "<td style='width:8%'>".strtoupper($row['reference_code'])."</td>"; echo "<td style='width:8%'>".strtoupper($row['date_created'])."</td>"; echo "<td style='width:8%'>".strtoupper($dealCode)."</td>"; echo "<td style='width:40%;text-align:left'>".strtoupper($row['purpose_of_request'])."</td>"; echo "<td style='width:7%;text-align:center'>".strtoupper($row['date_needed'])."</td>"; echo "<td style='width:10%'>".strtoupper($reqByLName).", ".strtoupper($reqByFName)."</td>"; echo "<td style='width:6%;text-align:center;font-size:14px;padding:3px'>"; $chkAttachment = mysql_result(mysql_query("SELECT COUNT(1) FROM `prf_attachment` WHERE `prf_number` = '".$row['reference_code']."'"),0); $withMail ='📝'; $attFilename = mysql_result(mysql_query("SELECT `document_name` FROM `prf_attachment` WHERE `prf_number` = '".$row['reference_code']."'"),0); $noMail = '-'; if($chkAttachment > 0){ echo "<a href='FILES/prfdoc/".$attFilename."' target='_Blank'><abbr title='View Attached document'>📑</abbr></a>"; }else{ echo $noMail; } echo"</td>"; echo "</tr>"; //} } ?> <tr><td colspan='9' ><hr style='padding:0px;background:transparent;border:0px;border-bottom:1px solid gray'></td> <tr> <td colspan='3' style='background:white;font-family:Yu Gothic; font-size:13px;color: #f97d43 ;height:20px;font-weight:normal'>Selected Record:</td> <td colspan='6' style='background:white;'> <input type='hidden' id='selectedPRFHeaderID' class='TableBottomLabel'> <input disabled type='text' id='selectedPRFHeaderIDLabel' style='background:white;border:0px;font-family:Yu Gothic;font-size:14px;color: #f97d43 ;font-weight:normal'> </td> </tr> </table> </div> </div> </div> <!--########################## POPUP ACTION WINDOW FOR DELETE AND VIEW DETAILS ############################################--> <!--########################################################################################################--> <div id="showActionViewDelete" class="PopUpActionWindow" style='position:fixed'> <div class='PopUpWindowTitle'> 🪧 Confirm Action <div class='PopUpWindowClose'> <b onclick="javascript:hideActionViewDelete(this);" style='font-weight:bold'> ✕ </b> </div> </div> <table> <tr> <td style='padding:10px;padding-left:20px;width:100%;background:white;font-family:Yu Gothic; font-size:16px;color:red ;height:10px;font-weight:normal;text-align:left'>Selected Record:<br> <input disabled type='hidden' id='ActionReferenceID' style='text-align:center;margin-top:10px;background:lightgray;border:0px;font-family:Yu Gothic;font-size:18px;color: red ;font-weight:bold;margin-bottom:3px;padding-bottom:2px'> <input disabled type='text' id='ActionReferenceIDDesc' style='text-align:center;margin-top:10px;background:lightgray;border:0px;font-family:Yu Gothic;font-size:18px;color: red ;font-weight:bold;margin-bottom:3px;padding-bottom:2px'> <br><br> </td> </tr> <tr> <td colspan='1' style='padding:10px;width:250px;background:white;border-top:1px solid gray;text-align:center;padding-top:5px'> <div style='width:100%;float:right;height:50px;padding:10px;background:white'> <button id='viewPRFItems' onclick="javascript:showUpdatePRFForm(this);" class='PopUpLowerButtonR' >📑 View Details</button> <!--<button onclick="javascript:showUpdatePRFForm(this);" id='LoadCanvassSheet' class='PopUpLowerButtonR' >🗒 Canvass Sheet</button>--> </div> </td> </tr> </table> </div> <!--########################## ADD NEW PURCHASE REQEUST ############################################--> <!--########################################################################################################--> <div id="PRFCreateNewRequest" class="PopUpWindowPRF" style='position:fixed'> <div class='PopUpWindowTitle'> 🗒 New Purchase Request <div class='PopUpWindowClose'> <b id='XCloseButton' style='font-weight:bold'> ✕ </b> </div> </div> <!--BODY--> <div class='PopUpWindowBodyContainer'> <input type='hidden' id='PRFReferenceNumber'> <label class='PRFRefID' id='uReferenceID'>:</label> <label class='PRFRefID'>Reference Number.</label> <div id="PRFNewContentInfo" class="PopUpWindowBody"> <div class='PRFdropItemSelectionContainer'> <div class='PRFdropItemSelection'> <p class='buttonTitle'>Select Company:</p> <select id='prfCompanySelected' class='DropDownButton' onchange="showDealership(this.value)"> <option value='0'>-- Select Company --</option> <?php $getCompanyAccess = mysql_query(" SELECT brand_access.user_id, brand_access.comp_id,brand_access.dealer_id,vts_company.comp_id,vts_company.comp_code,vts_company.comp_name FROM brand_access JOIN vts_company ON brand_access.comp_id = vts_company.comp_id WHERE brand_access.user_id=$uniqueRefID GROUP BY brand_access.comp_id ORDER BY vts_company.comp_name ASC "); while($row=mysql_fetch_array($getCompanyAccess)){ echo "<option value='".$row['comp_id']."'>".strToupper($row['comp_name'])."</option>"; } ?> </select> </div> <div class='PRFdropItemSelection'> <p class='buttonTitle'>Select Dealer:</p> <select id='myDealerList' class='DropDownButton' > </select> </div> <div class='PRFdropItemSelection'> <p class='buttonTitle'>Select Expense Category:</p> <select id='prfCategorySelected' class='DropDownButton' onchange="showCategoryItems(this.value)"> <option value='0'>-- Select Category --</option> <?php $getCompanyAccess = mysql_query("SELECT * FROM `prf_expensecategory` WHERE `status` = 1 ORDER BY description ASC "); while($row=mysql_fetch_array($getCompanyAccess)){ echo "<option value='".$row['id']."'>".strToupper($row['description'])."</option>"; } ?> </select> </div> <div class='PRFdropItemSelection'> <p class='buttonTitle'>Expense Type:</p> <select id='CategorySubItem' class='DropDownButton' > </select> </div> </div> <div class='PRFdropItemSelectionContainer'> <div class='PRFdropItemSelection' style='width:50%;background:transparent;padding-bottom:0px;padding-top:0px'> <p class='buttonTitle' style='margin-top:0px;padding-top:0px'>Purpose of Request:</p> <input type='text' id='PurposeOfReqeust' class='DropDownButton' style='margin:0px;'> </div> <div class='PRFdropItemSelection' style='width:25%;background:transparent;padding-bottom:0px;padding-top:0px'> <p class='buttonTitle' style='margin-top:0px;padding-top:0px'>Date Needed:</p> <input type='date' id='DateNeeded' > </div> <div class='PRFdropItemSelection' style='width:25%;background:transparent;padding-bottom:0px;padding-top:0px'> <p class='buttonTitle' style='margin-top:0px;padding-top:0px'>Approving Head:</p> <select id='prfApprovingHead' class='DropDownButton' style='margin:0px;' > <option value='0'>-- Select Category --</option> <?php $getCompanyAccess = mysql_query("SELECT vts_users.u_id,vts_users.u_fname,vts_users.u_lname,cl_approving_officers.cl_emp_id_a FROM cl_approving_officers JOIN vts_users ON cl_approving_officers.cl_emp_id_a = vts_users.u_id WHERE cl_approving_officers.cl_status=1 GROUP by cl_approving_officers.cl_emp_id_a "); while($row=mysql_fetch_array($getCompanyAccess)){ echo "<option value='".$row['u_id']."'>".strToupper($row['u_lname']).", ".strToupper($row['u_fname'])."</option>"; } ?> </select> </div> </div> <div class='PRFAddNewItem'> <div class='PRFdropItemSelection' style='width:50%;background:transparent;padding-bottom:0px;padding-top:0px'> <p class='buttonTitle' style='margin-top:0px;padding-top:0px'>Item Description:</p> <input type='text' id='txtAddItemDesc' class='DropDownButton' style='margin:0px;'> </div> <div class='PRFdropItemSelection' style='width:15%;background:transparent;padding-bottom:0px;padding-top:0px'> <p class='buttonTitle' style='margin-top:0px;padding-top:0px'>Quantity:</p> <input type='number' value='1' id='txtAddItemQty' min="1" class='DropDownButton' style='margin:0px;'> </div> <div class='PRFdropItemSelection' style='width:15%;background:transparent;padding-bottom:0px;padding-top:0px'> <p class='buttonTitle' style='margin-top:0px;padding-top:0px'>UoM:</p> <select id='UnitOfMeasure' class='DropDownButton' style='margin:0px;' > <option value='0'>-- Select --</option> <?php $getCompanyAccess = mysql_query("SELECT * FROM PRF_UoM WHERE status =1 ORDER BY Description ASC "); while($row=mysql_fetch_array($getCompanyAccess)){ echo "<option value='".$row['description']."'>".strToupper($row['description'])."</option>"; } ?> </select> </div> <div class='PRFdropItemSelection' style='width:20%;background:transparent;padding-bottom:0px;padding-top:0px'> <p class='buttonTitle' style='margin-top:0px;padding-top:0px'></p> <button id='btnAddNewItem' class='InsertButton'>➕ Add Item</button> </div> </div> <div class='PRFNewTableBody' id='PRFItemBody'> </div> </div> </div> </div> <!--########################## END OF ADD NEW PURCHASE REQEUST ############################################--> <!--########################## EDIT/UPDATE PURCHASE REQUEST ###############################################--> <div id="PRFUPDATENewRequest" class="PopUpWindowPRF" style='position:fixed'> <div class='PopUpWindowTitle'> 🗒 PRF INFORMATION <div class='PopUpWindowClose'> <b onclick="javascript:hideUpdatePRFForm(this);" style='font-weight:bold'> ✕ </b> </div> </div> <!--BODY--> <div class='PopUpWindowBodyContainer'> <input type='hidden' id='UpdatePRFReferenceNumber'> <input type='hidden' id='ItemRecordID'> <label class='PRFRefID' id='UpdateuReferenceID'>:</label> <label class='PRFRefID'>Reference Number.</label> <div id="UpdatePRFNewContentInfo" class="PopUpWindowBody" style='height:480px;background:white'> </div> </div> </div> <!--########################## END OF EDIT/UPDATING PURCHASE REQEUST ############################################--> </body> </html> <!--- LOCALIZED COPY OF JAVASCRIPT --> <!--<script type="text/javascript" src="http://code.jquery.com/jquery-1.9.1.js"></script> --> <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.6.0/jquery.min.js"></script> <script type="text/javascript" src="https://code.jquery.com/jquery-3.6.0.js"></script> <script type="text/javascript"> $(document).ready(function(){ //====================================================================================================== $("#viewPRFItems").click(function(){ var UpdatePRFReferenceNumber = $("#UpdatePRFReferenceNumber").val(); ShowUploadBar(); //alert(UpdatePRFReferenceNumber); //exit; //============ $.ajax({ url: "PRF_ViewContentOnly.php", type: "POST", async: false, data: { "UpdatePRFReferenceNumber": UpdatePRFReferenceNumber, "done": 1 }, success: function(d){ $("#UpdatePRFNewContentInfo").html(d); updateAHGApprovalCount(); ShowUploadBar(); } }) }); //====================================================================================================== $("#btnAddNewItem").click(function(){ var prfCompanySelected = $("#prfCompanySelected").val(); var myDealerList = $("#myDealerList").val(); var prfCategorySelected = $("#prfCategorySelected").val(); var CategorySubItem = $("#CategorySubItem").val(); var PurposeOfReqeust = $("#PurposeOfReqeust").val(); var DateNeeded = $("#DateNeeded").val(); var prfApprovingHead = $("#prfApprovingHead").val(); var txtAddItemDesc = $("#txtAddItemDesc").val(); var txtAddItemQty = $("#txtAddItemQty").val(); var UnitOfMeasure = $("#UnitOfMeasure").val(); var uReferenceID = $("#PRFReferenceNumber").val(); if(prfCompanySelected ==0){ alert("Please select company."); exit; } if(myDealerList ==0){ alert("Please select dealer."); exit; } if(prfCategorySelected ==0){ alert("Please select purchase category."); exit; } if(CategorySubItem ==0){ alert("Please select purchase subcategory."); exit; } if(PurposeOfReqeust ==""){ alert("Please indicate the purpose of your request."); exit; } if(DateNeeded ==""){ alert("Please indicate date needed"); exit; } if(prfApprovingHead ==0){ alert("Please select approving head"); exit; } if(txtAddItemDesc ==""){ alert("Please type something in the item description"); exit; } if(UnitOfMeasure ==""){ alert("Please select unit of measure"); exit; } document.getElementById("prfCompanySelected").disabled = true; document.getElementById("myDealerList").disabled = true; document.getElementById("prfCategorySelected").disabled = true; document.getElementById("CategorySubItem").disabled = true; document.getElementById("PurposeOfReqeust").disabled = true; document.getElementById("DateNeeded").disabled = true; document.getElementById("prfApprovingHead").disabled = true; //document.getElementById("btnAddNewItem").style.backgroundColor = "gray"; //document.getElementById("btnAddNewItem").style.color = "lightgray"; ShowUploadBar(); $.ajax({ url: "PRF_AddNewPRFItemsAndHeaders.php", type: "POST", async: false, data: { "uReferenceID": uReferenceID, "prfCompanySelected": prfCompanySelected, "myDealerList": myDealerList, "prfCategorySelected": prfCategorySelected, "CategorySubItem": CategorySubItem, "PurposeOfReqeust": PurposeOfReqeust, "DateNeeded": DateNeeded, "txtAddItemDesc": txtAddItemDesc, "prfApprovingHead": prfApprovingHead, "txtAddItemQty": txtAddItemQty, "UnitOfMeasure": UnitOfMeasure, "done": 1 }, success: function(d){ ShowUploadBar(); $("#PRFItemBody").html(d); //invHideAssignMsg(); //$('#searchText').val(''); } }) }); //====================================================================================================== function updateAHGApprovalCount(){ $.ajax({ url: "PRF_UpdateAHGApproval.php", type: "POST", async: false, data: { "trans":2 }, success: function(d){ $("#AHGadminApprovalCount").html(d); } }) } }); </script> <!--- LOCALIZED COPY OF JAVASCRIPT --> <script type="text/javascript"> function hideActionSlipForm(){ $("#PRFCreateNewRequest").fadeOut(500); }; function showActionSlipForm(){ $("#PRFCreateNewRequest").fadeIn(500); }; function hideActionViewDelete(){ $("#showActionViewDelete").fadeOut(500); }; function showActionViewDelete(){ $("#showActionViewDelete").fadeIn(500); }; function hideUpdatePRFForm(){ $("#PRFUPDATENewRequest").fadeOut(500); }; function showUpdatePRFForm(){ $("#PRFUPDATENewRequest").fadeIn(500); $("#showActionViewDelete").fadeOut(500); }; function showPRFheaderForDeletion(row) { var x=row.cells; document.getElementById("selectedPRFHeaderID").value = x[1].innerHTML; document.getElementById("selectedPRFHeaderIDLabel").value = x[1].innerHTML; document.getElementById("ActionReferenceID").value = x[1].innerHTML; document.getElementById("ActionReferenceIDDesc").value = "Ref.#: " + x[1].innerHTML; document.getElementById("UpdateuReferenceID").innerHTML = x[1].innerHTML; document.getElementById("UpdatePRFReferenceNumber").value = x[1].innerHTML; document.getElementById("ItemRecordID").value = x[0].innerHTML; showActionViewDelete(); } //LOAD DEALER BASED ON SELECTED COMPANY function showDealership(str) { //alert(str); if (str == "") { document.getElementById("myDealerList").innerHTML = ""; return; } else { if (window.XMLHttpRequest) { // code for IE7+, Firefox, Chrome, Opera, Safari xmlhttp = new XMLHttpRequest(); } else { // code for IE6, IE5 xmlhttp = new ActiveXObject("Microsoft.XMLHTTP"); } xmlhttp.onreadystatechange = function() { if (xmlhttp.readyState == 4 && xmlhttp.status == 200) { document.getElementById("myDealerList").innerHTML = xmlhttp.responseText; } } xmlhttp.open("GET","PRF_LOAD_DealerBySelectedCompany.php?q="+str,true); xmlhttp.send(); } } //LOAD DEALER BASED ON SELECTED COMPANY function showCategoryItems(str) { //alert(str); if (str == "") { document.getElementById("CategorySubItem").innerHTML = ""; return; } else { if (window.XMLHttpRequest) { // code for IE7+, Firefox, Chrome, Opera, Safari xmlhttp = new XMLHttpRequest(); } else { // code for IE6, IE5 xmlhttp = new ActiveXObject("Microsoft.XMLHTTP"); } xmlhttp.onreadystatechange = function() { if (xmlhttp.readyState == 4 && xmlhttp.status == 200) { document.getElementById("CategorySubItem").innerHTML = xmlhttp.responseText; } } xmlhttp.open("GET","PRF_LOAD_ExpenseCategoryItems.php?q="+str,true); xmlhttp.send(); } } </script>
| ver. 1.4 |
.
| PHP 7.3.33 | Generation time: 0 |
proxy
|
phpinfo
|
Settings