From: Joe Hunt Date: Fri, 31 Dec 2010 16:22:31 +0000 (+0000) Subject: Added GL trans on Removal GRN items (Supp Invoice) if GRN Clearing X-Git-Tag: 2.3-final~832 X-Git-Url: https://delta.frontaccounting.com/gitweb/?p=fa-stable.git;a=commitdiff_plain;h=ddb3f34d970ba59b7304965a47f59d81ce150b51 Added GL trans on Removal GRN items (Supp Invoice) if GRN Clearing --- diff --git a/CHANGELOG.txt b/CHANGELOG.txt index 5d62fa28..f755e30c 100644 --- a/CHANGELOG.txt +++ b/CHANGELOG.txt @@ -32,6 +32,8 @@ $ /purchasing/po_receive_items.php /purchasing/po_entry_items.php # Bug. $n undefined in /admin/gl_setup.php $ /admin/gl_setup.php +! Added GL trans on Removal GRN items (Supp Invoice) if GRN Clearing +$ /purchasing/includes/db/invoice_db.inc 30-Dec-2010 Janusz Dobrowolski + Added option for using GRN Clearing Account for yet non invoiced GRNs. diff --git a/purchasing/includes/db/invoice_db.inc b/purchasing/includes/db/invoice_db.inc index a8b6e0dc..06d27cde 100644 --- a/purchasing/includes/db/invoice_db.inc +++ b/purchasing/includes/db/invoice_db.inc @@ -580,6 +580,21 @@ function remove_not_invoice_item($id) add_stock_move(ST_SUPPRECEIVE, $myrow["item_code"], $myrow['grn_batch_id'], $grn['loc_code'], sql2date($grn["delivery_date"]), "", -$myrow["QtyOstdg"], $myrow['std_cost_unit'], $grn["supplier_id"], 1, $myrow['unit_price']); + + $clearing_act = get_company_pref('grn_clearing_act'); + if ($clearing_act) { // otherwise GRN clearing account is not used + if (is_inventory_item($myrow['item_code'])) + { + $total = 0; + $stock_gl_code = get_stock_gl_code($myrow['item_code']); + $date = sql2date($grn["delivery_date"]); + $total += add_gl_trans_supplier(ST_SUPPRECEIVE, $myrow['grn_batch_id'], $date, $stock_gl_code["inventory_account"], + $stock_gl_code['dimension_id'], $stock_gl_code['dimension2_id'], + -$myrow['QtyOstdg'] * $myrow['unit_price'], $grn["supplier_id"], "", 0, _("GRN Removal")); + $total += add_gl_trans_supplier(ST_SUPPRECEIVE, $myrow['grn_batch_id'], $date, $clearing_act, + 0, 0, -$total, null, "", 0, _("GRN Removal")); + } + } commit_transaction(); }