| 1 | <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> |
|---|
| 2 | <html xmlns="http://www.w3.org/1999/xhtml"> |
|---|
| 3 | <head> |
|---|
| 4 | <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> |
|---|
| 5 | <?php |
|---|
| 6 | include("includes/headcontent.php"); |
|---|
| 7 | if ($_COOKIE['client_id'] == "") { |
|---|
| 8 | header("location: client_select.php?url=ckeditor_intro"); |
|---|
| 9 | } |
|---|
| 10 | include("includes/config.php"); |
|---|
| 11 | include("includes/connect.php"); |
|---|
| 12 | include("includes/commonfunctions.php"); |
|---|
| 13 | include("includes/header.php"); |
|---|
| 14 | $chk = chkauditor(); |
|---|
| 15 | ?> |
|---|
| 16 | <script src="/ckeditor/ckeditor.js"></script> |
|---|
| 17 | </head> |
|---|
| 18 | <?php |
|---|
| 19 | function update() { |
|---|
| 20 | //update db |
|---|
| 21 | global $_REQUEST; |
|---|
| 22 | $client_id = $_COOKIE['client_id']; |
|---|
| 23 | $aud_type = $_COOKIE['audit_type']; |
|---|
| 24 | $overview = replace_string($_POST['overview']); |
|---|
| 25 | $issues = replace_string($_POST['issues']); |
|---|
| 26 | $sql = "SELECT * FROM man_report WHERE client_id = '$client_id' AND aud_type = $aud_type"; |
|---|
| 27 | $result = mysql_query($sql); |
|---|
| 28 | $num_rows = mysql_num_rows($result); |
|---|
| 29 | if ($num_rows == 0) { |
|---|
| 30 | $sqli = "INSERT INTO man_report (client_id,aud_type,man_overview,issues)"; |
|---|
| 31 | $sqli .= " VALUES ('$client_id',$aud_type,'$overview','$issues')"; |
|---|
| 32 | $resulti = mysql_query($sqli); |
|---|
| 33 | $return = $resulti; |
|---|
| 34 | } |
|---|
| 35 | else { |
|---|
| 36 | $sqlu = "UPDATE man_report SET man_overview = '$overview', issues = '$issues'"; |
|---|
| 37 | $sqlu .= " WHERE client_id = '$client_id' AND aud_type = $aud_type"; |
|---|
| 38 | $resultu = mysql_query($sqlu); |
|---|
| 39 | $return = $resultu; |
|---|
| 40 | } |
|---|
| 41 | return $return; |
|---|
| 42 | } |
|---|
| 43 | ?> |
|---|
| 44 | <body> |
|---|
| 45 | <div class="main"> |
|---|
| 46 | <div class="logo"> |
|---|
| 47 | </div> |
|---|
| 48 | <div class="menubar"> |
|---|
| 49 | <?php |
|---|
| 50 | $long = "yes"; |
|---|
| 51 | include("includes/topnav.php"); |
|---|
| 52 | ?> |
|---|
| 53 | </div><!-- menubar --> |
|---|
| 54 | <div class="mainsection"> |
|---|
| 55 | <div class="mainleft"> |
|---|
| 56 | <div class="sidebar"> |
|---|
| 57 | </div> |
|---|
| 58 | </div> <!-- mainleft --> |
|---|
| 59 | <div class="mainright"> |
|---|
| 60 | <div class="greyline"></div> |
|---|
| 61 | <div class="mainbox"> |
|---|
| 62 | <?php |
|---|
| 63 | |
|---|
| 64 | $submit_text = DBSelect("button_list","button","submit"); |
|---|
| 65 | |
|---|
| 66 | $upd = true; |
|---|
| 67 | if ($_POST) { |
|---|
| 68 | $upd = update(); |
|---|
| 69 | } |
|---|
| 70 | ?> |
|---|
| 71 | <form id="write_mgtsum" name="write_mgtsum" action="ckeditor_mgtsum.php" method="post"> |
|---|
| 72 | <table border="0" width="95%"> |
|---|
| 73 | <tr> |
|---|
| 74 | <td colspan="3"><strong><?php echo $_COOKIE['company']." - ".$_COOKIE['aud_desc'];?></strong></td> |
|---|
| 75 | </tr> |
|---|
| 76 | <?php |
|---|
| 77 | $client_id = $_COOKIE['client_id']; |
|---|
| 78 | $aud_type = $_COOKIE['audit_type']; |
|---|
| 79 | $sqlca = "SELECT * FROM client_audit WHERE client_id = '$client_id' AND aud_type = $aud_type"; |
|---|
| 80 | $resultca = mysql_query($sqlca); |
|---|
| 81 | $num_rowsca = mysql_num_rows($resultca); |
|---|
| 82 | if ($num_rowsca == 0) { |
|---|
| 83 | $client_audit_id = 0; |
|---|
| 84 | } |
|---|
| 85 | else { |
|---|
| 86 | $rowca = mysql_fetch_assoc($resultca); |
|---|
| 87 | $client_audit_id = $rowca['id']; |
|---|
| 88 | } |
|---|
| 89 | |
|---|
| 90 | //if (!audcomplete() && auditorislead($client_audit_id,$_COOKIE['auditor_no'])) { |
|---|
| 91 | //HV 16/4 bug fix for autofill release |
|---|
| 92 | $sqlma = "SELECT * FROM master_auditor"; |
|---|
| 93 | $resultma = mysql_query($sqlma); |
|---|
| 94 | $num_rowsma = mysql_num_rows($resultma); |
|---|
| 95 | if ($num_rowsma == 0){ |
|---|
| 96 | $ma = false; |
|---|
| 97 | } |
|---|
| 98 | else { |
|---|
| 99 | $rowma = mysql_fetch_assoc($resultma); |
|---|
| 100 | if ($rowma['username'] == $_COOKIE['username']){ |
|---|
| 101 | $ma = true; |
|---|
| 102 | } |
|---|
| 103 | else { |
|---|
| 104 | $ma = false; |
|---|
| 105 | } |
|---|
| 106 | } |
|---|
| 107 | if ((!audcomplete() && auditorislead($client_audit_id,$_COOKIE['auditor_no'])) || (audnumber()==1 && $ma)) { |
|---|
| 108 | $sql = "SELECT man_overview, issues FROM man_report WHERE client_id = '".$_COOKIE['client_id']."' AND aud_type = " . $_COOKIE['audit_type']; |
|---|
| 109 | $result = mysql_query($sql); |
|---|
| 110 | $num_rows = mysql_num_rows($result); |
|---|
| 111 | if ($num_rows != 0) { |
|---|
| 112 | $row = mysql_fetch_assoc($result); |
|---|
| 113 | } |
|---|
| 114 | if (!$upd) { |
|---|
| 115 | ?> |
|---|
| 116 | <tr> |
|---|
| 117 | <td colspan="3"><font class="error"><?php echo DBSelect("message_list","message","mgt_sum_failed");?></font></td> |
|---|
| 118 | </tr> |
|---|
| 119 | <?php |
|---|
| 120 | } |
|---|
| 121 | ?> |
|---|
| 122 | <tr> |
|---|
| 123 | <td valign="top" colspan="3"><strong>**Management Summary**</strong></td> |
|---|
| 124 | </tr> |
|---|
| 125 | <tr> |
|---|
| 126 | <td colspan="3"><textarea name="issues" id="issues" cols="80" rows="10"><?php echo $row['issues']; ?></textarea> |
|---|
| 127 | <script>CKEDITOR.replace( 'issues', {toolbar : 'SDIAdmin'},{width: '100%',height: '80%'});</script> |
|---|
| 128 | </td> |
|---|
| 129 | </tr> |
|---|
| 130 | <tr> |
|---|
| 131 | <td> </td> |
|---|
| 132 | <td> |
|---|
| 133 | <a href="write_mgt_summary_print.php" class="main_button" onclick="var w=window.open(this.href, 'display', 'width=680,height=450,top=200,left=290,location=0,titlebar=0,menubar=0,addressbar=0,toolbar=0,status=no,scrollbars=1,resizable=0'); w.focus(); return false;"><INPUT TYPE="image" SRC="/servicedesk-certification/images/print.png" width="56" height="28" ALT="<?php echo DBSelect("button_list","button","print");?>"> |
|---|
| 134 | </td> |
|---|
| 135 | <td><INPUT TYPE="image" SRC="/servicedesk-certification/images/submit.png" width="90" height="28" onClick="submitbutton();" ALT="<?php echo $submit_text;?>"></td> |
|---|
| 136 | </tr> |
|---|
| 137 | <?php |
|---|
| 138 | } |
|---|
| 139 | else { |
|---|
| 140 | if (audcomplete()){ |
|---|
| 141 | ?> |
|---|
| 142 | <tr> |
|---|
| 143 | <td colspan="3"><font class="error"><?php echo DBSelect("message_list","message","audcomplete");?></font></td> |
|---|
| 144 | </tr> |
|---|
| 145 | <?php |
|---|
| 146 | } |
|---|
| 147 | else { |
|---|
| 148 | ?> |
|---|
| 149 | <tr> |
|---|
| 150 | <td colspan="3"><font class="error"><?php echo DBSelect("message_list","message","notleadauditor");?></font></td> |
|---|
| 151 | </tr> |
|---|
| 152 | <?php |
|---|
| 153 | } |
|---|
| 154 | } |
|---|
| 155 | ?> |
|---|
| 156 | </table> <!-- main table --> |
|---|
| 157 | </form> |
|---|
| 158 | |
|---|
| 159 | </div><!--mainbox--> |
|---|
| 160 | </div> <!-- mainright --> |
|---|
| 161 | <?php |
|---|
| 162 | include("includes/footer.php"); |
|---|
| 163 | ?> |
|---|
| 164 | </div> <!-- mainsection --> |
|---|
| 165 | </div> <!-- main --> |
|---|
| 166 | </body> |
|---|
| 167 | </html> |
|---|