Topic: Allocation Details to be displayed on invoices and credit notes

Hi,

Currently the customer/supplier payment entry shows its allocations to invoices.
But in reverse way, the invoice is allocated by which payment entry is not displayed.

Sometimes finding such details are required. Displaying them on 'view' pages of invoices and credit notes will be helpful.

Thanks,

Chaitanya

Re: Allocation Details to be displayed on invoices and credit notes

Any idea of how to implement it?

/Joe

Re: Allocation Details to be displayed on invoices and credit notes

Hi Joe,

similar to following code in view_receipt.php
display_allocations_from(PT_CUSTOMER, $receipt['debtor_no'], ST_CUSTPAYMENT, $trans_id, $receipt['Total']);

we can add
display_allocations_to(PT_CUSTOMER, $receipt['debtor_no'], ST_SALESINVOICE, $trans_id, $receipt['Total']);

custalloc_db.inc has function get_allocatable_to_cust_transactions similarly we can write function get_allocatable_FROM_cust_transactions
as below -

function get_allocatable_from_cust_transactions($customer_id, $trans_no=null, $type=null)
{
    if ($trans_no != null and $type != null)
    {
        $sql = get_alloc_trans_sql("amt", "trans.trans_no = alloc.trans_no_from
            AND trans.type = alloc.trans_type_from
            AND alloc.trans_no_to=".db_escape($trans_no)."
            AND alloc.trans_type_to=".db_escape($type)."
            AND trans.debtor_no=".db_escape($customer_id),
            "".TB_PREF."cust_allocations as alloc");
    }
    else
    {
        $sql = get_alloc_trans_sql(null, "round(ov_amount+ov_gst+ov_freight+ov_freight_tax+ov_discount-alloc,6) > 0
            AND trans.type <> " . ST_CUSTPAYMENT . "
            AND trans.type <> " . ST_BANKDEPOSIT . "
            AND trans.type <> " . ST_CUSTCREDIT . "
            AND trans.type <> " . ST_CUSTDELIVERY . "
            AND trans.debtor_no=".db_escape($customer_id));
    }

    return db_query($sql." ORDER BY trans_no", "Cannot retreive alloc to transactions");
}

Hope I am clear enough. smile

Thanks

Chaitanya

Re: Allocation Details to be displayed on invoices and credit notes

Seems like a good idea. Implemented in HG repository to goto next minor release. Also implemented on supplier side.

/Joe