From: Joe Hunt Date: Thu, 4 Sep 2008 13:35:44 +0000 (+0000) Subject: Bug [0000047] Not possible to view delivery sequence X-Git-Tag: 2.3-final~1481 X-Git-Url: https://delta.frontaccounting.com/gitweb/?a=commitdiff_plain;h=bac0b0ad0031ba837735a9e8a7f6e734ba53c83a;p=fa-stable.git Bug [0000047] Not possible to view delivery sequence Bug [0000048] Crediting invoice and choosing gl account for items to be written off doesn't work --- diff --git a/CHANGELOG.txt b/CHANGELOG.txt index d0ddd6c2..a899566c 100644 --- a/CHANGELOG.txt +++ b/CHANGELOG.txt @@ -19,6 +19,17 @@ Legend: ! -> Note $ -> Affected files +04-Sep-2008 Joe Hunt +# Bug [0000047] Not possible to view delivery sequence +$ /purchasing/supplier_credit_grns.php + /purchasing/supplier_invoice_grns.php + /purchasing/includes/db/grn_db.inc + /purchasing/includes/ui/invoice_ui.inc + /purchasing/view/view_po.php + /purchasing/view/view_supp_credit.php +# Bug [0000048] Crediting invoice and choosing gl account for items to be written off doesn't work +$ /sales/includes/db/sales_credit_db.inc + 03-Sep-2008 Janusz Dobrowolski # Fixed fatal error handling in php5 $ /includes/errors.inc diff --git a/config.php b/config.php index 68fa5aaf..731e26f3 100644 --- a/config.php +++ b/config.php @@ -38,7 +38,7 @@ if (!isset($path_to_root) || isset($_GET['path_to_root']) || isset($_POST['path_ // Main Title $app_title = "FrontAccounting"; // application version - $version = "2.0 RC2"; + $version = "2.0"; // Build for development purposes $build_version = date("d.m.Y", filemtime("$path_to_root/CHANGELOG.txt")); diff --git a/purchasing/includes/db/grn_db.inc b/purchasing/includes/db/grn_db.inc index 0335e64f..3b5443f6 100644 --- a/purchasing/includes/db/grn_db.inc +++ b/purchasing/includes/db/grn_db.inc @@ -128,9 +128,19 @@ function add_grn_detail_item($grn_batch_id, $po_detail_item, $item_code, $descri } //---------------------------------------------------------------------------------------- +function get_grn_batch_from_item($item) +{ + $sql = "SELECT grn_batch_id FROM ".TB_PREF."grn_items WHERE id=$item"; + $result = db_query($sql, "Could not retreive GRN batch id"); + $row = db_fetch_row($result); + return $row[0]; +} function set_grn_item_credited(&$entered_grn, $supplier, $transno, $date) { + $mcost = update_average_material_cost($supplier, $entered_grn->item_code, + $entered_grn->chg_price, $entered_grn->this_quantity_inv, $date); + $sql = "SELECT ".TB_PREF."grn_batch.*, ".TB_PREF."grn_items.* FROM ".TB_PREF."grn_batch, ".TB_PREF."grn_items WHERE ".TB_PREF."grn_items.grn_batch_id=".TB_PREF."grn_batch.id @@ -138,12 +148,19 @@ function set_grn_item_credited(&$entered_grn, $supplier, $transno, $date) AND ".TB_PREF."grn_items.item_code='$entered_grn->item_code' "; $result = db_query($sql, "Could not retreive GRNS"); $myrow = db_fetch($result); + + $sql = "UPDATE ".TB_PREF."purch_order_details + SET quantity_received = quantity_received + $entered_grn->this_quantity_inv, + std_cost_unit=$mcost, + act_price=$entered_grn->chg_price + WHERE po_detail_item = ".$myrow["po_detail_item"]; + db_query($sql, "a purchase order details record could not be updated. This receipt of goods has not been processed "); + //$sql = "UPDATE ".TB_PREF."grn_items SET qty_recd=0, quantity_inv=0 WHERE id=$entered_grn->id"; $sql = "UPDATE ".TB_PREF."grn_items SET qty_recd=qty_recd+$entered_grn->this_quantity_inv, quantity_inv=quantity_inv+$entered_grn->this_quantity_inv WHERE id=$entered_grn->id"; db_query($sql); - $mcost = update_average_material_cost($supplier, $entered_grn->item_code, - $entered_grn->chg_price, $entered_grn->this_quantity_inv, $date); + add_stock_move(21, $entered_grn->item_code, $transno, $myrow['loc_code'], $date, "", $entered_grn->this_quantity_inv, $mcost, $supplier, 1, $entered_grn->chg_price); } diff --git a/purchasing/includes/ui/invoice_ui.inc b/purchasing/includes/ui/invoice_ui.inc index 196db747..85ef98d0 100644 --- a/purchasing/includes/ui/invoice_ui.inc +++ b/purchasing/includes/ui/invoice_ui.inc @@ -297,7 +297,7 @@ function display_grn_items(&$supp_trans, $mode=0) div_start('grn_items'); echo ""; - $th = array(_("Delivery Sequence #"), _("Item"), _("Description"), + $th = array(_("Delivery"), _("Item"), _("Description"), _("Quantity"), _("Price"), _("Line Value")); table_header($th); @@ -312,7 +312,8 @@ function display_grn_items(&$supp_trans, $mode=0) alt_table_row_color($k); - label_cell(get_trans_view_str(25,$entered_grn->id)); + $grn_batch = get_grn_batch_from_item($entered_grn->id); + label_cell(get_trans_view_str(25,$grn_batch)); label_cell($entered_grn->item_code); label_cell($entered_grn->item_description); qty_cell(abs($entered_grn->this_quantity_inv), false, get_qty_dec($entered_grn->item_code)); diff --git a/purchasing/supplier_credit_grns.php b/purchasing/supplier_credit_grns.php index b9bfbe33..6c3abd1f 100644 --- a/purchasing/supplier_credit_grns.php +++ b/purchasing/supplier_credit_grns.php @@ -11,6 +11,8 @@ include_once($path_to_root . "/purchasing/includes/purchasing_db.inc"); $js = ""; if ($use_date_picker) $js .= get_js_date_picker(); +if ($use_popup_windows) + $js .= get_js_open_window(900, 500); page(_("Select Received Items to Add"), false, false, "", $js); if (!isset($_SESSION['supp_trans'])) @@ -161,7 +163,7 @@ if ($id || get_post('AddGRNToTrans')) { $Ajax->activate('grn_selector'); } -if (get_post('AddGRNToTrans')) +if (get_post('AddGRNToTrans')) { $Ajax->activate('grn_table'); $Ajax->activate('grn_items'); diff --git a/purchasing/supplier_invoice_grns.php b/purchasing/supplier_invoice_grns.php index 541a4c4d..c334a699 100644 --- a/purchasing/supplier_invoice_grns.php +++ b/purchasing/supplier_invoice_grns.php @@ -11,6 +11,8 @@ include_once($path_to_root . "/purchasing/includes/purchasing_db.inc"); $js = ""; if ($use_date_picker) $js .= get_js_date_picker(); +if ($use_popup_windows) + $js .= get_js_open_window(900, 500); page(_("Select Received Items to Add"), false, false, "", $js); if (!isset($_SESSION['supp_trans'])) @@ -194,7 +196,7 @@ if (find_submit('grn_item_id') || get_post('AddGRNToTrans')) { $Ajax->activate('grn_selector'); } -if (get_post('AddGRNToTrans')) +if (get_post('AddGRNToTrans')) { $Ajax->activate('grn_table'); $Ajax->activate('grn_items'); diff --git a/purchasing/view/view_po.php b/purchasing/view/view_po.php index fe164822..144192df 100644 --- a/purchasing/view/view_po.php +++ b/purchasing/view/view_po.php @@ -6,10 +6,14 @@ $path_to_root="../.."; include($path_to_root . "/purchasing/includes/po_class.inc"); include($path_to_root . "/includes/session.inc"); -page(_("View Purchase Order"), true); - include($path_to_root . "/purchasing/includes/purchasing_ui.inc"); +$js = ""; +if ($use_popup_windows) + $js .= get_js_open_window(900, 500); +page(_("View Purchase Order"), true, false, "", $js); + + if (!isset($_GET['trans_no'])) { die ("
" . _("This page must be called with a purchase order number to review.")); diff --git a/purchasing/view/view_supp_credit.php b/purchasing/view/view_supp_credit.php index d5fc40e1..64ed9b8c 100644 --- a/purchasing/view/view_supp_credit.php +++ b/purchasing/view/view_supp_credit.php @@ -6,14 +6,17 @@ $path_to_root="../.."; include_once($path_to_root . "/purchasing/includes/purchasing_db.inc"); include_once($path_to_root . "/includes/session.inc"); -page(_("View Supplier Credit Note"), true); - include_once($path_to_root . "/purchasing/includes/purchasing_ui.inc"); +$js = ""; +if ($use_popup_windows) + $js .= get_js_open_window(900, 500); +page(_("View Supplier Credit Note"), true, false, "", $js); + if (isset($_GET["trans_no"])) { $trans_no = $_GET["trans_no"]; -} +} elseif (isset($_POST["trans_no"])) { $trans_no = $_POST["trans_no"]; @@ -58,7 +61,7 @@ end_table(1); $voided = is_voided_display(21, $trans_no, _("This credit note has been voided.")); -if (!$voided) +if (!$voided) { $tax_total = 0; // ?????? display_allocations_from(payment_person_types::supplier(), $supp_trans->supplier_id, 21, $trans_no, -($supp_trans->ov_amount + $tax_total)); diff --git a/sales/includes/db/sales_credit_db.inc b/sales/includes/db/sales_credit_db.inc index 2faf9e7e..e5041a20 100644 --- a/sales/includes/db/sales_credit_db.inc +++ b/sales/includes/db/sales_credit_db.inc @@ -17,7 +17,7 @@ function write_credit_note($credit_note, $write_off_acc) $trans_no = key($trans_no); } - $credit_type = $write_off_acc == 0 ? 'Return' : 'Writeoff'; + $credit_type = $write_off_acc == 0 ? 'Return' : 'WriteOff'; begin_transaction(); @@ -205,11 +205,12 @@ function add_gl_trans_credit_costs($order, $order_line, $credit_no, $date_, $dim2 = ($customer['dimension2_id'] != 0 ? $customer["dimension2_id"] : $stock_gl_codes["dimension2_id"]); /* insert gl_trans to credit stock and debit cost of sales at standard cost*/ - if ($order_line->standard_cost != 0) { + $standard_cost = get_standard_cost($order_line->stock_id); + if ($standard_cost != 0) { /*first the cost of sales entry*/ add_gl_trans_std_cost(11, $credit_no, $date_, $stock_gl_codes["cogs_account"], - $dim, $dim2, "", -($order_line->standard_cost * $order_line->qty_dispatched), + $dim, $dim2, "", -($standard_cost * $order_line->qty_dispatched), payment_person_types::customer(), $order->customer_id, "The cost of sales GL posting could not be inserted"); @@ -222,7 +223,7 @@ function add_gl_trans_credit_costs($order, $order_line, $credit_no, $date_, } add_gl_trans_std_cost(11, $credit_no, $date_, $stock_entry_account, 0, 0, - "", ($order_line->standard_cost * $order_line->qty_dispatched), + "", ($standard_cost * $order_line->qty_dispatched), payment_person_types::customer(), $order->customer_id, "The stock side (or write off) of the cost of sales GL posting could not be inserted");