[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Vendor post invoice function



Hi Chris,
    Hope everything is O.K.ً

When the user posted AP invoice, with minus quantity.

In sub post_invoice function at IR.pm File:

If the quantity is minus, you will try to return the items to the AP invoices that sold this item, order by transdate and i.qty  + i.allocated <0.

$query = qq|
                                  SELECT i.id, i.qty, i.allocated, a.transdate
                                    FROM invoice i
                                    JOIN parts p ON (p.id = i.parts_id)
                                    JOIN ap a ON (a.id = i.trans_id)
                                   WHERE i.parts_id = ? AND (i.qty +  i.allocated) < 0 AND i.sellprice = ?
                                ORDER BY transdate
                                    |;

my question:
     Is there availability to make the condition is [order by a.transdate, i.trans_id, i.id and i.qty +  i.allocated <0 or i.qty  + i.allocated = 0 ]

to recover the case, If I have i.qty  + i.allocated = 0 and I don't have i.qty +i.allocated < 0

or there are some restriction avoid that.

Brest wishes,
Shaekir,