From: Joe Hunt Date: Wed, 7 Jan 2009 16:26:12 +0000 (+0000) Subject: Changed supplier credit note to only show items for a period, default 30 days back. X-Git-Tag: v2.4.2~19^2~1649 X-Git-Url: https://delta.frontaccounting.com/gitweb/?a=commitdiff_plain;h=53ce24049be7e47179b98f69af45352001855f50;p=fa-stable.git Changed supplier credit note to only show items for a period, default 30 days back. --- diff --git a/CHANGELOG.txt b/CHANGELOG.txt index 66ef3df9..695dd346 100644 --- a/CHANGELOG.txt +++ b/CHANGELOG.txt @@ -19,6 +19,12 @@ Legend: ! -> Note $ -> Affected files +07-Jan-2009 Joe Hunt +! Changed supplier credit note to only show items for a period, default 30 days back. +$ /purchasing/includes/db/grn_db.inc + /purchasing/includes/invoice_ui.inc + /purchasing/supplier_credit.php + 07-Jan-2009 Janusz Dobrowolski # [0000105] Not initialized user pos numbers after upgrade, fixed some new table fields. $ /sql/alter2.1.sql diff --git a/purchasing/includes/db/grn_db.inc b/purchasing/includes/db/grn_db.inc index 10e0d1cf..0008af16 100644 --- a/purchasing/includes/db/grn_db.inc +++ b/purchasing/includes/db/grn_db.inc @@ -175,7 +175,7 @@ function set_grn_item_credited(&$entered_grn, $supplier, $transno, $date) } function get_grn_items($grn_batch_id=0, $supplier_id="", $outstanding_only=false, - $is_invoiced_only=false, $invoice_no=0) + $is_invoiced_only=false, $invoice_no=0, $begin="", $end="") { $sql = "SELECT ".TB_PREF."grn_batch.*, ".TB_PREF."grn_items.*, ".TB_PREF."purch_order_details.unit_price, ".TB_PREF."purch_order_details.std_cost_unit, units @@ -190,6 +190,10 @@ function get_grn_items($grn_batch_id=0, $supplier_id="", $outstanding_only=false ".TB_PREF."grn_items.id=".TB_PREF."supp_invoice_items.grn_item_id"; $sql .= " AND ".TB_PREF."stock_master.stock_id=".TB_PREF."grn_items.item_code "; + if ($begin != "") + $sql .= " AND ".TB_PREF."grn_batch.delivery_date>='".date2sql($begin)."'"; + if ($end != "") + $sql .= " AND ".TB_PREF."grn_batch.delivery_date<='".date2sql($end)."'"; if ($grn_batch_id != 0) $sql .= " AND ".TB_PREF."grn_batch.id=$grn_batch_id AND ".TB_PREF."grn_items.grn_batch_id=$grn_batch_id "; diff --git a/purchasing/includes/ui/invoice_ui.inc b/purchasing/includes/ui/invoice_ui.inc index 67f63e82..116dee3c 100644 --- a/purchasing/includes/ui/invoice_ui.inc +++ b/purchasing/includes/ui/invoice_ui.inc @@ -316,7 +316,9 @@ function display_grn_items_for_selection(&$supp_trans, $k) $result = get_grn_items(0, $supp_trans->supplier_id, true); else { - if (isset($_POST['invoice_no'])) + if (isset($_POST['receive_begin']) && isset($_POST['receive_end'])) + $result = get_grn_items(0, $supp_trans->supplier_id, false, true, 0, $_POST['receive_begin'], $_POST['receive_end']); + else if (isset($_POST['invoice_no'])) $result = get_grn_items(0, $supp_trans->supplier_id, false, true, $_POST['invoice_no']); else $result = get_grn_items(0, $supp_trans->supplier_id, false, true); @@ -428,6 +430,15 @@ function display_grn_items(&$supp_trans, $mode=0) if ($mode == 1) { + if (!$supp_trans->is_invoice && !isset($_POST['invoice_no'])) + { + echo ""; + date_cells(_("Received between"), 'receive_begin', "", null, -30); + date_cells(_("and"), 'receive_end', '', null, 1); + submit_cells('RefreshInquiry', _("Search"),'',_('Refresh Inquiry'), true); + echo ""; + } + if ($heading2 != "") { //br(); diff --git a/purchasing/supplier_credit.php b/purchasing/supplier_credit.php index e6c83e64..00a8cd5e 100644 --- a/purchasing/supplier_credit.php +++ b/purchasing/supplier_credit.php @@ -302,6 +302,11 @@ if ($id4 != -1) $Ajax->activate('gl_items'); $Ajax->activate('inv_tot'); } +if (isset($_POST['RefreshInquiry'])) +{ + $Ajax->activate('grn_items'); + $Ajax->activate('inv_tot'); +} if (isset($_POST['go'])) {