Exemple #1
0
    public function getListEmployee($period_id)
    {
        include_once '../hr/class/Leave.php';
        $leave = new Leave();
        $login_user = $leave->getEmployeeId($this->updatedby);
        if ($login_user > 0 && $this->isAdmin == false) {
            $wherestr = " and em.employee_id = {$login_user} ";
        }
        $sql = "select em.*,dp.department_name,py.payslip_id,py.iscomplete,py.batch_id,py.netpayamt\r\n    from {$this->tableemployee} em\r\n    inner join {$this->tabledepartment} dp on dp.department_id = em.department_id\r\n    left join {$this->tablepayslip} py on py.employee_id = em.employee_id and py.period_id = {$period_id}\r\n    where em.employee_id > 0 and em.isactive = 1\r\n    {$wherestr}\r\n    group by em.employee_id    \r\n    order by cast(em.employee_no as signed) asc";
        echo <<<EOF

    <table >

    <tr>
    <th align="center">No</th>
    <th align="center">Employee</th>
    <th align="center">Employee No</th>
    <th align="center">Ic No</th>
    <th align="center">Department</th>
    <th align="center">Amount (RM)</th>
    <th align="center">Complete</th>
    <th align="center">Operation</th>
    </tr>
EOF;
        $query = $this->xoopsDB->query($sql);
        $rowtype = 0;
        $i = 0;
        while ($row = $this->xoopsDB->fetchArray($query)) {
            $i++;
            //cater for Report No: 184
            $new_emp = "select count(*) as cnt from {$this->tablepayslip} where employee_id={$row['employee_id']}";
            $emp_q = $this->xoopsDB->query($new_emp);
            $p = $this->xoopsDB->fetchArray($emp_q);
            if ($p[cnt] <= 0) {
                $img = "<img src='images/new.gif' width='35' height='15'>";
            } else {
                $img = "";
            }
            $employee_id = $row['employee_id'];
            $employee_name = $row['employee_name'] . " " . $img;
            $employee_no = $row['employee_no'];
            $employee_newicno = $row['employee_newicno'];
            $department_name = $row['department_name'];
            $payslip_id = $row['payslip_id'];
            $iscomplete = $row['iscomplete'];
            $batch_id = $row['batch_id'];
            $netpayamt = $row['netpayamt'];
            if ($rowtype == "even") {
                $rowtype = "odd";
            } else {
                $rowtype = "even";
            }
            if ($login_user > 0 && $this->isAdmin == false) {
                if ($iscomplete == "Y") {
                    $buttonopr = "<a href='printpayslip.php?payslip_id={$payslip_id}' target='blank'><img src='images/list.gif' title='View This Payslip'></a>";
                }
            } else {
                if ($payslip_id <= 0) {
                    $rowtype = "vfocus";
                    $buttonopr = "<form action='payslip.php' method='POST' target='_blank'>\r\n            <input type='hidden' name='action' value='processgenerate'>\r\n            <input type='hidden' name='period_id' value='{$period_id}'>\r\n            <input type='hidden' name='employee_id' value='{$employee_id}'>\r\n            <input type='submit' value='Generate Payslip'>\r\n            </form>";
                } else {
                    if ($iscomplete == "N") {
                        $buttonopr = "<form action='payslip.php' method='POST' target='_blank'>\r\n            <input type='hidden' name='action' value='edit'>\r\n            <input type='hidden' name='payslip_id' value='{$payslip_id}'>\r\n            <input type='hidden' name='employee_id' value='{$employee_id}'>\r\n            <input type='submit' value='Edit Payslip'>\r\n            </form>";
                    } else {
                        $buttonopr = "<form action='payslip.php' method='POST' target='_blank'>\r\n            <input type='hidden' name='action' value='enable'>\r\n            <input type='hidden' name='payslip_id' value='{$payslip_id}'>\r\n            <input type='hidden' value='{$batch_id}' name='batch_id'>\r\n            <input type='submit' value='Enable Payslip'>\r\n            <a href='printpayslip.php?payslip_id={$payslip_id}' target='blank'><img src='images/list.gif' title='View This Payslip'></a>\r\n            </form>";
                    }
                }
            }
            if ($iscomplete == "Y") {
                $iscompletename = "Y";
            } else {
                $iscomplete = "<font color=red><b>N</b></font>";
            }
            echo <<<EOF

    <tr>
    <td class="{$rowtype}" align="center">{$i}</td>
    <td class="{$rowtype}" align="left"><a href="../simbiz/employee.php?action=view&employee_id={$employee_id}">{$employee_name}</a></td>
    <td class="{$rowtype}" align="center">{$employee_no}</td>
    <td class="{$rowtype}" align="center">{$employee_newicno}</td>
    <td class="{$rowtype}" align="center">{$department_name}</td>
    <td class="{$rowtype}" align="center">{$netpayamt}</td>
    <td class="{$rowtype}" align="center">{$iscomplete}</td>
    <td class="{$rowtype}" align="center">{$buttonopr}</td>
    </tr>
EOF;
        }
        echo <<<EOF
    </table>

EOF;
    }