vendredi 27 décembre 2019

laravel:database employee id and name as qrcode

laravel generate qrcode using employee list using their id

here's my route

Route::get('/employee/printqr/{empcode?}/{empname?}', 'EmployeeController@printQr');

in view :

<!DOCTYPE html>
<html>
<body>
<br/><br/>
<img src=".png" style="width: 250px;"/>
<br/>
Employee Code: 
<br/>
Employee Name: 
<script>
    var empcode = @json($empcode);
    var empname = @json($empname);
    var ttt = '<br><br>' +
        '<img src="' + empcode + '.png" style="width:250px;" />' +
        '<br>Employee Code: ' + empcode +
        '<br>Employee Name: ' + empname;
    var newWin = window.open('', 'Print-Window');
    newWin.document.open();
    newWin.document.write('<html><body>' + ttt + '</body></html>');
    newWin.document.close();
    newWin.focus();
    setTimeout(function () {
        newWin.print();
        newWin.close();
    }, 150);
    setTimeout(function () {
        window.location.href = '/employee/index';
    }, 160);
</script>
</body>
</html>

here's my controller

public function getAllEmployeesList()
    {
        $list = array();
        $list['data'] = array();
        $qry = Employee::where('emp_active_status', 'Y')->where("emp_role_id", 6)->get()->toArray();
        $list['iTotalRecords'] = count($qry);
        $list['iTotalDisplayRecords'] = count($qry);
        foreach ($qry as $emp) {
            $emp['name'] = $emp['emp_first_name'] . ' ' . $emp['emp_last_name'];
            $emp['emp_date_of_join'] = date('d/M/Y', strtotime($emp['emp_date_of_join']));

            $list['data'][] = $emp;
        }
        return json_encode($list);

and i cannot generate all the employee id as qr code with qrcode code piker using id



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire