Page 1 of 1

LOAN REPORT BY CATEGORY WISE

Posted: 07 Jan 2017, 13:10
by RKMSLIMS
We need loan history reporting to display Collection Type also.

Is it possible to add another header of Collection Type also in loan history?

Re: LOAN REPORT BY CATEGORY WISE

Posted: 28 Oct 2017, 19:59
by heru_subekti
hello, you can replace code between line 163 -177 with this code :

Code: Select all

    $table_spec = 'loan AS l
    LEFT JOIN member AS m ON l.member_id=m.member_id
    LEFT JOIN item AS i ON l.item_code=i.item_code
    LEFT JOIN biblio AS b ON i.biblio_id=b.biblio_id
    LEFT JOIN mst_coll_type AS mct ON mct.coll_type_id=i.coll_type_id';

    // create datagrid
    $reportgrid = new report_datagrid();
    $reportgrid->setSQLColumn('m.member_id AS \''.__('Member ID').'\'',
        'm.member_name AS \''.__('Member Name').'\'',
        'm.member_type_id AS \''.__('Membership Type').'\'',
        'l.item_code AS \''.__('Item Code').'\'',
        'mct.coll_type_name AS \''.__('Collection Type').'\'',
        'b.title AS \''.__('Title').'\'',
        'l.loan_date AS \''.__('Loan Date').'\'',
        'l.due_date AS \''.__('Due Date').'\'', 'l.is_return AS \''.__('Loan Status').'\'');
    $reportgrid->setSQLorder('l.loan_date DESC');
and

Code: Select all

..
    function loanStatus($obj_db, $array_data)
    {
        if ($array_data[7] == 0) {
            return '<strong>'.__('On Loan').'</strong>';
        } else {
            return __('Returned');
        }
    }
..
$reportgrid->modifyColumnContent(7, 'callback{loanStatus}');
change to :

Code: Select all

..
    function loanStatus($obj_db, $array_data)
    {
        if ($array_data[8] == 0) {
            return '<strong>'.__('On Loan').'</strong>';
        } else {
            return __('Returned');
        }
    }
..
$reportgrid->modifyColumnContent(8, 'callback{loanStatus}');
preview :
ct.png
ct.png (143.82 KiB) Viewed 2005 times