Your IP : 216.73.217.79


Current Path : /var/www/cesa.co.za/php/templates/
Upload File :
Current File : /var/www/cesa.co.za/php/templates/msd-review-popup.php

<div class="printhide">
    <?php
    $arrAudit = array();
//echo 'ADQAuditID: ' . $row["ADQAuditID"];
    if (!empty($row["ADQAuditID"])) {
        $sql = "SELECT * FROM ADQAudit WHERE ADQAuditID=" . $row["ADQAuditID"];
        $recAudit = mysqli_query($conni, $sql);
        if ($rowAudit = mysqli_fetch_assoc($recAudit)) {
            $arrAudit = $rowAudit;
            $sButtonLabel = "Review: ";
            if (empty($rowAudit["Verified"]))
                $sButtonLabel .= " In Progress";
            if ($rowAudit["Verified"] == "Y")
                $sButtonLabel .= " Verified";
            if ($rowAudit["Verified"] == "C")
                $sButtonLabel .= " Verified With Comments";
            if ($rowAudit["Verified"] == "N")
                $sButtonLabel .= " Not Verified";
            if ($row["ADQAuditID"] == $row["FirstADQAuditID"]) {
                $arrAudit["DateStarted"] = $rowAudit["DateUpdated"];
                $arrAudit["StartedBy"] = $rowAudit["UpdatedBy"];
            }
            if (($rowAudit["Verified"] == "Y") || ($rowAudit["Verified"] == "C")) {
                $arrAudit["DateVerified"] = $rowAudit["DateUpdated"];
                $arrAudit["VerifiedBy"] = $rowAudit["UpdatedBy"];
            }
        }
        mysqli_free_result($recAudit);
        if ($row["ADQAuditID"] != $row["FirstADQAuditID"]) {
            $sql = "SELECT * FROM ADQAudit WHERE ADQAuditID=" . $row["FirstADQAuditID"];
            $recAudit = mysqli_query($conni, $sql);
            if ($rowAudit = mysqli_fetch_assoc($recAudit)) {
                $arrAudit["DateStarted"] = $rowAudit["DateUpdated"];
                $arrAudit["StartedBy"] = $rowAudit["UpdatedBy"];
            }
            mysqli_free_result($recAudit);
        }
    } else {
        $sButtonLabel = "Review";
    }
    if (!isset($arrAudit["ContactPerson"]) || empty($arrAudit["ContactPerson"])) {
        $sql = "SELECT ADQAnswers.Answer FROM ADQAnswers JOIN ADQuestions USING (ADQuestionID)
		WHERE ADQAnswers.ADQFirmID=" . $row["ADQFirmID"] . "
		AND ADQuestions.ADQID=" . $Questionnaire_ID . "
		AND ADQuestions.Question='Name of competent person completing the MSD'";
        $recCP = mysqli_query($conni, $sql);
        if ($rowCP = mysqli_fetch_assoc($recCP))
            $arrAudit["ContactPerson"] = $rowCP["Answer"];
        mysqli_free_result($recCP);
    }
//var_dump($arrAudit);
    ?>
    <div style="text-align: right; margin-top: 8px;">
        <input type="button" value="<?php echo $sButtonLabel; ?>" onclick="$('#AuditDialog<?php echo $adqFirm["ADQFirmID"]; ?>').dialog('open'); setDTPickers();">
    </div>
    <div id="AuditDialog<?php echo $adqFirm["ADQFirmID"]; ?>" class="AuditDialog" title="<?php
    switch ($Questionnaire_ID) {
        case 1: echo "FIMS";
            break;
        case 2: echo "QMS";
            break;
        case 3: echo "PSM";
            break;
    }
    ?> Review: <?php echo $adqFirm["FirmName"]; ?>">
        <form method="post" action="<?php echo $_SERVER['REQUEST_URI']; ?>">
            <input type="hidden" name="go" value="AuditPopup">
            <input type="hidden" name="id" value="<?php echo $adqFirm['ADQID']; ?>">
            <input type="hidden" name="filtertable" value="<?php echo $_REQUEST["filtertable"]; ?>">
            <input type="hidden" name="filteraudit" value="<?php echo $_REQUEST["filteraudit"]; ?>">
            <input type="hidden" name="ADQFirmID" value="<?php echo $adqFirm["ADQFirmID"]; ?>">
            <p><b>Reviewee:</b></p>
            <input type="text" name="ContactPerson" value="<?php echo @$arrAudit["ContactPerson"]; ?>" placeholder="Contact Person" size="40"><br>
            <p><b>General Comments:</b></p>
            <textarea name="Comments" placeholder="Comments" rows="10" cols="40"><?php echo @$arrAudit["Comments"]; ?></textarea><br>
            <input type="radio" required name="Verified" value=""<?php if (isset($arrAudit["Verified"]) && empty($arrAudit["Verified"])) echo " checked"; ?>> Verification in progress / pending<br>
            <input type="radio" name="Verified" value="Y"<?php if (isset($arrAudit["Verified"]) && ($arrAudit["Verified"] == "Y")) echo " checked"; ?>> Verified<Br>
            <input type="radio" name="Verified" value="C"<?php if (isset($arrAudit["Verified"]) && ($arrAudit["Verified"] == "C")) echo " checked"; ?>> Verified With Comments<Br>
            <input type="radio" name="Verified" value="N"<?php if (isset($arrAudit["Verified"]) && ($arrAudit["Verified"] == "N")) echo " checked"; ?>> Not Verified
            <br>
            <?php
            if (isset($arrAudit["DateStarted"])) {
//            echo "Started on " . HTMLHelper::drawInput('text', 'date_started', $arrAudit["DateStarted"], '', array('class' => 'date-picker')) . " by " . $arrAudit["StartedBy"];
                echo "Started on " . $arrAudit["DateStarted"] . " by " . $arrAudit["StartedBy"];
            }
            ?>
            <?php
            if (isset($arrAudit["DateUpdated"])) {
                echo "<br>Last Updated on " . $arrAudit["DateUpdated"] . " by " . $arrAudit["UpdatedBy"];
            }
            ?>
            <?php
            if (isset($arrAudit["DateVerified"])) {
                echo "<br>Verified on " . $arrAudit["DateVerified"] . " by " . $arrAudit["VerifiedBy"];
            }
            ?>
            <p><b>Reviewer:</b> <?php echo CurrentUserName(); ?></p><br>
            <p align="center"><input type="submit" value="Save"></p>
        </form>

        <?php
        if (!isset($adqAuditObj)) {
            $adqAuditObj = new ADQAudit($sqlf);
        }

        $pastReviews = $adqAuditObj->getPast($row["ADQFirmID"]);

        if (is_array($pastReviews) && count($pastReviews) > 0) {
            ?>
            <h4>Past Reviews:</h4>
            <table border="1" cellspacing="0" cellpadding="2" align="center" width="100%">
                <tr>
                    <th>
                        Date Updated
                    </th>
                    <th>
                        Updated By
                    </th>
                    <th>
                        Reviewee
                    </th>
                    <th>
                        Verified
                    </th>
                    <th>
                        Comments
                    </th>
                </tr>
                <?php
                foreach ($pastReviews as $pastReview) {
                    ?>
                    <tr>
                        <td align="left" valign="top">
                            <?php echo $pastReview['DateUpdated'] ?>
                        </td>
                        <td align="left" valign="top">
                            <?php echo $pastReview['UpdatedBy'] ?>
                        </td>
                        <td align="left" valign="top">
                            <?php echo $pastReview['ContactPerson'] ?>
                        </td>
                        <td align="left" valign="top">
                            <?php echo ADQAudit::getStatus($pastReview['Verified']); ?>
                        </td>
                        <td align="left" valign="top">
                            <?php echo nl2br($pastReview['Comments']); ?>
                        </td>
                    </tr>
                    <?php
                } //foreach
                ?>
            </table>
            <?php
        }
        ?>
    </div>
</div>