! -> 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
// 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"));
}
//----------------------------------------------------------------------------------------
+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
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);
}
div_start('grn_items');
echo "<table width=100% $table_style>";
- $th = array(_("Delivery Sequence #"), _("Item"), _("Description"),
+ $th = array(_("Delivery"), _("Item"), _("Description"),
_("Quantity"), _("Price"), _("Line Value"));
table_header($th);
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));
$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']))
{
$Ajax->activate('grn_selector');
}
-if (get_post('AddGRNToTrans'))
+if (get_post('AddGRNToTrans'))
{
$Ajax->activate('grn_table');
$Ajax->activate('grn_items');
$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']))
{
$Ajax->activate('grn_selector');
}
-if (get_post('AddGRNToTrans'))
+if (get_post('AddGRNToTrans'))
{
$Ajax->activate('grn_table');
$Ajax->activate('grn_items');
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 ("<br>" . _("This page must be called with a purchase order number to review."));
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"];
$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));
$trans_no = key($trans_no);
}
- $credit_type = $write_off_acc == 0 ? 'Return' : 'Writeoff';
+ $credit_type = $write_off_acc == 0 ? 'Return' : 'WriteOff';
begin_transaction();
$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");
}
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");