Topic: Add Email column to Customer Transactions page

Not sure if this was ever discussed in the past - I didn't see a topic after a quick search.
Also, I don't know the proper protocol for doing posting this.

Here's a quick change to add an Email column to the Customer Transactions - something that should be standard in the release, in my humble opinion.

Edit sales/inquiry/customer_inquiry.php

Add function email_lnk right after prt_link:

function prt_link($row)
{
        if ($row['type'] == ST_CUSTPAYMENT || $row['type'] == ST_BANKDEPOSIT)
                return print_document_link($row['trans_no']."-".$row['type'], _("Print Receipt"), true, ST_CUSTPAYMENT, ICON_PRINT);
        elseif ($row['type'] == ST_BANKPAYMENT) // bank payment printout not defined yet.
                return '';
        else
                return print_document_link($row['trans_no']."-".$row['type'], _("Print"), true, $row['type'], ICON_PRINT);
}

// New: Function for email column
function email_link($row)
{
        if (get_voided_entry($row['type'], $row["trans_no"]))
                return _("Void");

        if ($row['type'] == ST_CUSTPAYMENT || $row['type'] == ST_BANKDEPOSIT)
                return print_document_link($row['trans_no']."-".$row['type'], _("Email"), true, ST_CUSTPAYMENT, ICON_EMAIL, "printlink", "", 1);
        elseif ($row['type'] == ST_BANKPAYMENT) // bank payment printout not defined yet.
                return '';
        else
                return print_document_link($row['trans_no']."-".$row['type'], _("Email"), true, $row['type'], ICON_EMAIL, "printlink", "", 1);
}
// End

Add and center row to the table:

$cols = array(
        _("Type") => array('fun'=>'systype_name', 'ord'=>''),
        _("#") => array('fun'=>'trans_view', 'ord'=>'', 'align'=>'right'),
        _("Order") => array('fun'=>'order_view', 'align'=>'right'),
        _("Reference"),
        _("Date") => array('name'=>'tran_date', 'type'=>'date', 'ord'=>'desc'),
        _("Due Date") => array('type'=>'date', 'fun'=>'due_date'),
        _("Customer") => array('ord'=>''),
        _("Branch") => array('ord'=>''),
        _("Currency") => array('align'=>'center'),
        _("Amount") => array('align'=>'right', 'fun'=>'fmt_amount'),
        _("Balance") => array('align'=>'right', 'type'=>'amount'),
                array('align'=>'center', 'insert'=>true, 'fun'=>'gl_view'),
                array('align'=>'center', 'insert'=>true, 'fun'=>'edit_link'),
                array('align'=>'center', 'insert'=>true, 'fun'=>'credit_link'),
                array('align'=>'center', 'insert'=>true, 'fun'=>'prt_link'),
// Change - add email button and center all the icons
                array('align'=>'center', 'insert'=>true, 'fun'=>'email_link')

        );

Re: Add Email column to Customer Transactions page

@joe: Should this be included?

Re: Add Email column to Customer Transactions page

Your approach to modifying the customer_inquiry.php file to include an email_link function seems solid.
One thing to consider is ensuring that the email status is accurately reflected. You might want to integrate a check to see if the email was successfully sent or if there were any errors. This could be done by linking to the email logs or using a flag in the database.