! -> Note
$ -> Affected files
+18-Jun-2009 Joe Hunt
+! Better support for conversion_factor in Purchasing Pricing. Instruction on Sticky Inventory Forum.
+$ /inventory/purchasing_data.php
+ /purchasing/includes/purchasing_db.inc
+ /purchasing/includes/ui/po_ui.inc
+
17-Jun-2009 Janusz Dobrowolski
# Fixed form reset after error, allowed png logo files.
$ /admin/company_preferences.php
}
else
{
- start_table("$table_style width=60%");
+ start_table("$table_style width=65%");
$th = array(_("Supplier"), _("Price"), _("Currency"),
- _("Supplier's Unit"), _("Supplier's Description"), "", "");
+ _("Supplier's Unit"), _("Conversion Factor"), _("Supplier's Description"), "", "");
table_header($th);
amount_cell($myrow["price"]);
label_cell($myrow["curr_code"]);
label_cell($myrow["suppliers_uom"]);
+ qty_cell($myrow['conversion_factor'], false, user_exrate_dec());
label_cell($myrow["supplier_description"]);
edit_button_cell("Edit".$myrow['supplier_id'], _("Edit"));
delete_button_cell("Delete".$myrow['supplier_id'], _("Delete"));
$_POST['conversion_factor'] = exrate_format($myrow["conversion_factor"]);
}
-echo "<br>";
+br();
hidden('selected_id', $selected_id);
start_table($table_style2);
else
{
supplier_list_row(_("Supplier:"), 'supplier_id', null, false, true);
+ $_POST['price'] = $_POST['suppliers_uom'] = $_POST['conversion_factor'] = $_POST['supplier_description'] = "";
}
amount_row(_("Price:"), 'price', null,'', get_supplier_currency($selected_id));
text_row(_("Suppliers Unit of Measure:"), 'suppliers_uom', null, 50, 51);
}
}
+function get_purchase_conversion_factor($supplier_id, $stock_id)
+{
+ $sql = "SELECT conversion_factor FROM ".TB_PREF."purch_data
+ WHERE supplier_id = '" . $supplier_id . "'
+ AND stock_id = '". $stock_id . "'";
+ $result = db_query($sql, "The supplier pricing details for " . $stock_id . " could not be retrieved");
+
+ if (db_num_rows($result) == 1)
+ {
+ $myrow = db_fetch($result);
+ return $myrow['conversion_factor'];
+ }
+ else
+ {
+ return 1;
+ }
+}
//----------------------------------------------------------------------------------------
function get_purchase_data($supplier_id, $stock_id)
foreach ($order->line_items as $line_no=>$item) {
$line = &$order->line_items[$line_no];
$line->price = get_purchase_price ($order->supplier_id, $_POST['stock_id']);
+ $line->quantity = get_purchase_conversion_factor ($order->supplier_id, $_POST['stock_id']);
}
$Ajax->activate('items_table');
}
$_POST['units'] = $item_info["units"];
$dec = $item_info["decimals"];
- $_POST['qty'] = number_format2(1, $dec);
+ $_POST['qty'] = number_format2(get_purchase_conversion_factor ($order->supplier_id, $_POST['stock_id']), $dec);
$_POST['price'] = price_format(get_purchase_price ($order->supplier_id, $_POST['stock_id']));
$_POST['req_del_date'] = add_days(Today(), 10);
}