From b41f81ed2c825462ec293ff11521320606bdeb8e Mon Sep 17 00:00:00 2001 From: Janusz Dobrowolski Date: Sat, 8 Nov 2008 21:50:58 +0000 Subject: [PATCH] Fixed query table content after changed customer selector. --- sales/inquiry/customer_allocation_inquiry.php | 8 +++++--- sales/inquiry/customer_inquiry.php | 15 +++++++++++---- sales/inquiry/sales_deliveries_view.php | 1 + sales/inquiry/sales_orders_view.php | 1 + 4 files changed, 18 insertions(+), 7 deletions(-) diff --git a/sales/inquiry/customer_allocation_inquiry.php b/sales/inquiry/customer_allocation_inquiry.php index c16cb253..b82dda85 100644 --- a/sales/inquiry/customer_allocation_inquiry.php +++ b/sales/inquiry/customer_allocation_inquiry.php @@ -206,8 +206,8 @@ $cols = array( _("Order") => array('type'=>'spec', 'fun'=>'order_link'), _("Date") => array('type'=>'date', 'ord'=>'asc'), _("Due Date") => array('type'=>'spec', 'fun'=>'due_date'), - _("Customer"), - _("Currency"), + _("Customer") => 'text', + _("Currency") => 'text', _("Debit") => array('type'=>'spec', 'fun'=>'fmt_debit'), _("Credit") => array('type'=>'insert', 'fun'=>'fmt_credit'), _("Allocated") => 'amount', @@ -216,7 +216,8 @@ $cols = array( ); if ($_POST['customer_id'] != reserved_words::get_all()) { - array_remove($cols, 6, 2); + $cols[_("Customer")] = 'skip'; + $cols[_("Currency")] = 'skip'; } $table =& new_db_pager('doc_tbl', $sql, $cols); @@ -226,6 +227,7 @@ $table->set_marker('check_overdue', _("Marked items are overdue.")); if(get_post('RefreshInquiry')) { $table->set_sql($sql); + $table->set_columns($cols); $Ajax->activate('doc_tbl'); } diff --git a/sales/inquiry/customer_inquiry.php b/sales/inquiry/customer_inquiry.php index b9669feb..db516ee0 100644 --- a/sales/inquiry/customer_inquiry.php +++ b/sales/inquiry/customer_inquiry.php @@ -116,7 +116,7 @@ function trans_view($trans) function due_date($row) { - return $row["type"] == 10 ? sql2date($row["due_date"]) : ''; + return ($row["type"]==20 || $row["type"]==21)? sql2date($row["due_date"]) : ''; } function fmt_balance($row) @@ -146,6 +146,11 @@ function fmt_credit($row) return $value>0 ? price_format($value) : ''; } +function gl_link($row) +{ + return get_gl_view_str($row["type"], $row["trans_no"]); +} + function alloc_link($row) { if ($row['type'] == 10) @@ -272,9 +277,10 @@ $cols = array( _("Due Date") => array('type'=>'spec', 'fun'=>'due_date'), _("Customer") => array('ord'=>''), _("Branch") => array('ord'=>''), - _("Currency"), + _("Currency") => 'text', _("Debit") => array('type'=>'spec', 'fun'=>'fmt_debit'), _("Credit") => array('type'=>'insert', 'fun'=>'fmt_credit'), + array('type'=>'insert', 'fun'=>'gl_view'), array('type'=>'insert', 'fun'=>'alloc_link'), array('type'=>'insert', 'fun'=>'credit_link'), array('type'=>'insert', 'fun'=>'edit_link'), @@ -282,8 +288,8 @@ $cols = array( ); if ($_POST['customer_id'] != reserved_words::get_all()) { - array_remove($cols, 6); - array_remove($cols, 8); + $cols[_("Customer")] = 'skip'; + $cols[_("Currency")] = 'skip'; } @@ -294,6 +300,7 @@ $table->set_marker('check_overdue', _("Marked items are overdue.")); if(get_post('RefreshInquiry')) { $table->set_sql($sql); + $table->set_columns($cols); $Ajax->activate('trans_tbl'); $Ajax->activate('totals_tbl'); } diff --git a/sales/inquiry/sales_deliveries_view.php b/sales/inquiry/sales_deliveries_view.php index 0194d5c3..1d879a87 100644 --- a/sales/inquiry/sales_deliveries_view.php +++ b/sales/inquiry/sales_deliveries_view.php @@ -256,6 +256,7 @@ $table->set_marker('check_overdue', _("Marked items are overdue.")); if(get_post('SearchOrders')) { $table->set_sql($sql); + $table->set_columns($cols); $Ajax->activate('doc_tbl'); } diff --git a/sales/inquiry/sales_orders_view.php b/sales/inquiry/sales_orders_view.php index 0c9fd701..6d3cfee5 100644 --- a/sales/inquiry/sales_orders_view.php +++ b/sales/inquiry/sales_orders_view.php @@ -293,6 +293,7 @@ $table->set_marker('check_overdue', _("Marked items are overdue.")); if (get_post('SearchOrders')) { $table->set_sql($sql); + $table->set_columns($cols); $Ajax->activate('orders_tbl'); } start_form(); -- 2.30.2