! -> Note
$ -> Affected files
+16-Jun-2008 Joe Hunt
+! Changed the Quantity routines to use the Item Units decimals if any. A lot of files.
+$ /includes/current_user.inc
+ /includes/ui/ui_input.inc
+ /includes/ui/ui_lists.inc
+ /inventory/reorder_level.inc
+ /inventory/includes/item_adjustments_ui.inc
+ /inventory/includes/stock_transfers_ui.inc
+ /inventory/includes/db/items_units_db.inc
+ /inventory/inquiry/stock_movements.php
+ /inventory/inquiry/stock_status.php
+ /inventory/manage/item_units.php
+ /inventory/view/view_adjustment.php
+ /inventory/view/view_transfer.php
+ /manufacturing/search_work_orders.php
+ /manufacturing/work_order_entry.php
+ /manufacturing/includes/manufacturing_ui.inc
+ /manufacturing/includes/work_order_issue_ui.inc
+ /manufacturing/inquiry/where_used_inquiry.php
+ /manufacturing/manage/bom_edit.php
+ /manufacturing/view/wo_issue_view.php
+ /manufacturing/view/wo_production_view.php
+ /purchasing/po_receive_items.php
+ /purchasing/supplier_credit_grns.php
+ /purchasing/supplier_invoice_grns.php
+ /purchasing/includes/ui/invoice_ui.inc
+ /purchasing/includes/ui/po_ui.inc
+ /purchasing/view/view_grn.php
+ /purchasing/view/view_po.php
+ /reporting/rep105.php
+ /reporting/rep107.php
+ /reporting/rep108.php
+ /reporting/rep109.php
+ /reporting/rep110.php
+ /reporting/rep204.php
+ /reporting/rep209.php
+ /reporting/rep301.php
+ /reporting/rep302.php
+ /reporting/rep303.php
+ /reporting/rep401.php
+ /sales/customer_credit_invoice.php
+ /sales/customer_delivery.php
+ /sales/customer_invoice.php
+ /sales/includes/ui/sales_credit_ui.inc
+ /sales/includes/ui/sales_order_ui.inc
+ /sales/view/view_credit.php
+ /sales/view/view_dispatch.php
+ /sales/view/view_invoice.php
+ /sales/view/view_sales_order.php
+
15-Jun-2008 Janusz Dobrowolski
+ Ajax driven delivery and order queries.
$ /sales/inquiry/sales_deliveries_view.php
//--------------------------------------------------------------------------
-class current_user
+class current_user
{
var $loginname;
update_user_visitdate($loginname);
$this->logged = true;
- }
- else
+ }
+ else
{
$this->logged = false;
}
$db = mysql_connect($connection["host"] ,
$connection["dbuser"], $connection["dbpassword"]);
mysql_select_db($connection["dbname"],$db);
-
+
if (!defined('TB_PREF'))
define('TB_PREF', $connection["tbpref"]);
-
+
return $db;
}
//--------------------------------------------------------------------------
-function number_format2($number, $decimals=0)
+function number_format2($number, $decimals=0)
{
global $thoseps, $decseps;
$tsep = $thoseps[$_SESSION["wa_current_user"]->prefs->tho_sep()];
}
function price_format($number) {
- return number_format2($number,
+ return number_format2($number,
$_SESSION["wa_current_user"]->prefs->price_dec());
}
-
-function qty_format($number) {
- return number_format2($number,
- $_SESSION["wa_current_user"]->prefs->qty_dec());
+// 2008-06-15. Added extra parameter $stock_id and reference for $dec
+//--------------------------------------------------------------------
+function qty_format($number, $stock_id=null, &$dec=0) {
+ $dec = get_qty_dec($stock_id);
+ return number_format2($number, $dec);
}
-
+// and get_qty_dec
+function get_qty_dec($stock_id=null)
+{
+ global $path_to_root;
+ include_once($path_to_root."/inventory/includes/db/items_units_db.inc");
+ if ($stock_id != null)
+ $dec = get_unit_dec($stock_id);
+ if ($stock_id == null || $dec == -1 || $dec == null)
+ $dec = $_SESSION["wa_current_user"]->prefs->qty_dec();
+ return $dec;
+}
+//-------------------------------------------------------------------
function exrate_format($number) {
- return number_format2($number,
+ return number_format2($number,
$_SESSION["wa_current_user"]->prefs->exrate_dec());
}
function percent_format($number) {
- return number_format2($number,
+ return number_format2($number,
$_SESSION["wa_current_user"]->prefs->percent_dec());
}
str_replace($sep, '', $num);
$sep = $decseps[user_dec_sep()];
if($sep!='.') $num = str_replace( $sep, '.', $num);
-
+
if (!is_numeric($num))
return false;
$num = (float)$num;
return $num;
}
-function user_company()
+function user_company()
{
return $_SESSION["wa_current_user"]->company;
}
-function user_language()
+function user_language()
{
return $_SESSION["wa_current_user"]->prefs->language();
}
-function user_qty_dec()
+function user_qty_dec()
{
return $_SESSION["wa_current_user"]->prefs->qty_dec();
}
-function user_price_dec()
+function user_price_dec()
{
return $_SESSION["wa_current_user"]->prefs->price_dec();
}
-function user_exrate_dec()
+function user_exrate_dec()
{
return $_SESSION["wa_current_user"]->prefs->exrate_dec();
}
-function user_percent_dec()
+function user_percent_dec()
{
return $_SESSION["wa_current_user"]->prefs->percent_dec();
}
-function user_show_gl_info()
+function user_show_gl_info()
{
return $_SESSION["wa_current_user"]->prefs->show_gl_info();
}
-function user_show_codes()
+function user_show_codes()
{
return $_SESSION["wa_current_user"]->prefs->show_codes();
}
-function user_date_format()
+function user_date_format()
{
return $_SESSION["wa_current_user"]->prefs->date_format();
}
-function user_date_display()
+function user_date_display()
{
return $_SESSION["wa_current_user"]->prefs->date_display();
}
-function user_date_sep()
+function user_date_sep()
{
return $_SESSION["wa_current_user"]->prefs->date_sep();
}
-function user_tho_sep()
+function user_tho_sep()
{
return $_SESSION["wa_current_user"]->prefs->tho_sep();
}
-function user_dec_sep()
+function user_dec_sep()
{
return $_SESSION["wa_current_user"]->prefs->dec_sep();
}
-function user_theme()
+function user_theme()
{
return $_SESSION["wa_current_user"]->prefs->get_theme();
}
-function user_pagesize()
+function user_pagesize()
{
return $_SESSION["wa_current_user"]->prefs->get_pagesize();
}
-function user_hints()
+function user_hints()
{
return $_SESSION["wa_current_user"]->prefs->show_hints();
}
function set_user_prefs($price_dec, $qty_dec, $exrate_dec, $percent_dec, $showgl, $showcodes,
- $date_format, $date_sep, $tho_sep, $dec_sep, $theme, $pagesize, $show_hints)
+ $date_format, $date_sep, $tho_sep, $dec_sep, $theme, $pagesize, $show_hints)
{
$_SESSION["wa_current_user"]->update_prefs($price_dec, $qty_dec, $exrate_dec, $percent_dec, $showgl, $showcodes,
$ts = $thoseps[user_tho_sep()];
$ds = $decseps[user_dec_sep()];
-
+
$js = "\n<script type=\"text/javascript\">\n"
. "<!--\n"
. "var user = {\n"
if ($value == null)
$value = (!isset($_POST[$name]) ? 0 : $_POST[$name]);
-
+
echo "<input"
.($value == 1 ? ' checked':'')
." type='checkbox' name='$name' value='1'"
else
label_cell(percent_format($label), "nowrap align=right", $id);
}
-
+// 2008-06-15. Changed
function qty_cell($label, $bold=false, $dec=null, $id=null)
{
+ if ($dec == null)
+ $dec = get_qty_dec();
if ($bold)
- label_cell("<b>".qty_format($label, $dec)."</b>", "nowrap align=right", $id);
+ label_cell("<b>".number_format2($label, $dec)."</b>", "nowrap align=right", $id);
else
- label_cell(qty_format($label, $dec), "nowrap align=right", $id);
+ label_cell(number_format2($label, $dec), "nowrap align=right", $id);
}
function label_cells($label, $value, $params="", $params2="")
}
if ($opts['sel_hint'] === null)
$opts['sel_hint'] = $by_id || $search_box==false ?
- '' : _('Press Space tab for search pattern entry');
+ '' : _('Press Space tab for search pattern entry');
if ($opts['box_hint'] === null)
$opts['box_hint'] = $search_box ?
}
if ($txt == '') {
if ($spec_option === false)
- $limit = ' LIMIT 1';
+ $limit = ' LIMIT 1';
else
- $opts['where'][] = $valfield . "='". get_post($name, $spec_id)."'";
+ $opts['where'][] = $valfield . "='". get_post($name, $spec_id)."'";
}
else
if ($txt != '*') {
foreach($opts['search'] as $i=> $s)
$opts['search'][$i] = $s . " LIKE '%{$txt}%'";
- $opts['where'][] = '('. implode($opts['search'], ' OR ') . ')';
+ $opts['where'][] = '('. implode($opts['search'], ' OR ') . ')';
}
}
}
if ($label != null)
echo "<td>$label</td>\n";
$str = stock_items_list($name, $selected_id, $all_option, $submit_on_change,
- array('cells'=>true));
+ array('cells'=>true));
return $str;
}
/*
function stock_units_list_row($label, $name, $value, $enabled=true)
{
- global $stock_units;
-
default_focus($name);
$result = get_all_item_units();
echo "<tr><td>$label</td>\n";
function tax_types_list($name, $selected_id, $none_option=false, $submit_on_change=false)
{
- global $all_items;
-
$sql = "SELECT id, CONCAT(name, ' (',rate,'%)') as name FROM ".TB_PREF."tax_types";
return combo_input($name, $selected_id, $sql, 'id', 'name',
function tax_groups_list($name, $selected_id,
$none_option=false, $submit_on_change=false)
{
- global $all_items;
-
$sql = "SELECT id, name FROM ".TB_PREF."tax_groups";
return combo_input($name, $selected_id, $sql, 'id', 'name',
function sales_types_list($name, $selected_id, $submit_on_change=false, $special_option=false)
{
- global $all_items;
-
$sql = "SELECT id, sales_type FROM ".TB_PREF."sales_types";
return combo_input($name, $selected_id, $sql, 'id', 'sales_type',
return $str;
}
-function number_list($name, $selected, $from, $to, $firstlabel="")
+function number_list($name, $selected, $from, $to, $no_option=false)
{
default_focus($name);
if ($selected == null)
{
- $selected = (!isset($_POST[$name]) ? $from : $_POST[$name]);
- if ($selected == $from)
- $_POST[$name] = $selected;
+ $selected = (!isset($_POST[$name]) ? reserved_words::get_all_numeric() : $_POST[$name]);
}
echo "<select name='$name'>";
+ if ($no_option !== false)
+ {
+ $reserved_word = reserved_words::get_all_numeric();
+
+ if ($selected == $reserved_word)
+ {
+ echo "<option selected value='$reserved_word'>$no_option</option>\n";
+ }
+ else
+ {
+ echo "<option value='$reserved_word'>$no_option</option>\n";
+ }
+ }
+
for ($i = $from; $i <= $to; $i++)
{
- if ($i == 0 && $firstlabel != "")
- $label = $firstlabel;
- else
- $label = $i;
if ($selected == $i)
{
- echo "<option selected value='$i'>$label</option>\n";
+ echo "<option selected value='$i'>$i</option>\n";
}
else
{
- echo "<option value='$i'>$label</option>\n";
+ echo "<option value='$i'>$i</option>\n";
}
}
echo "</select>\n";
}
-function number_list_cells($label, $name, $selected, $from, $to)
+function number_list_cells($label, $name, $selected, $from, $to, $no_option=false)
{
if ($label != null)
label_cell($label);
echo "<td>\n";
- number_list($name, $selected, $from, $to);
+ number_list($name, $selected, $from, $to, $no_option);
echo "</td>\n";
}
-function number_list_row($label, $name, $selected, $from, $to)
+function number_list_row($label, $name, $selected, $from, $to, $no_option=false)
{
echo "<tr>\n";
- number_list_cells($label, $name, $selected, $from, $to);
+ number_list_cells($label, $name, $selected, $from, $to, $no_option);
echo "</tr>\n";
}
?>
\ No newline at end of file
$sql = "SELECT * FROM ".TB_PREF."item_units ORDER BY name";
return db_query($sql, "could not get stock categories");
}
+// 2008-06-15. Added Joe Hunt to get a measure of unit by given stock_id
+function get_unit_dec($stock_id)
+{
+ $sql = "SELECT decimals FROM ".TB_PREF."item_units, ".TB_PREF."stock_master
+ WHERE abbr=units AND stock_id='$stock_id' LIMIT 1";
+ $result = db_query($sql, "could not get unit decimals");
+
+ $row = db_fetch_row($result);
+ return $row[0];
+}
+
?>
\ No newline at end of file
{
$allready_on_order = 0;
- foreach ($order->line_items as $order_item)
+ foreach ($order->line_items as $order_item)
{
- if (strcasecmp($order_item->stock_id, $new_item) == 0)
+ if (strcasecmp($order_item->stock_id, $new_item) == 0)
{
$allready_on_order = 1;
display_error(_("For Part :") . $new_item . " " . "This item is already on this order. You can change the quantity ordered of the existing line if necessary.");
function display_order_header(&$order)
{
global $table_style2;
-
+
start_table("width=70% $table_style2"); // outer table
- echo "<tr><td valign=top width=33%>";
+ echo "<tr><td valign=top width=33%>";
echo "<table>"; // inner table
locations_list_row(_("Location:"), 'StockLocation', null);
echo "</table>"; // inner table
- echo "</td><td width=33%>";
+ echo "</td><td width=33%>";
echo "<table>"; // inner table
echo "</table>"; // inner table
- echo "</td><td width=33%>";
+ echo "</td><td width=33%>";
echo "<table>"; // inner table
movement_types_list_row(_("Detail:"), 'type', null);
echo "</table>"; // inner table
- echo "</td></tr>";
+ echo "</td></tr>";
end_table(1); // outer table
}
display_heading($title);
start_table("$table_style width=80%");
- $th = array(_("Item Code"), _("Item Description"), _("Quantity"),
+ $th = array(_("Item Code"), _("Item Description"), _("Quantity"),
_("Unit"), _("Unit Cost"), _("Total"));
if ( count($order->line_items)) $th[] = '';
$total = 0;
$k = 0; //row colour counter
- foreach ($order->line_items as $stock_item)
+ foreach ($order->line_items as $stock_item)
{
$quantity = number_format2($stock_item->quantity,user_qty_dec());
edit_link_cell(SID . "Edit=$stock_item->stock_id");
delete_link_cell(SID . "Delete=$stock_item->stock_id");
end_row();
- }
- else
+ }
+ else
{
adjustment_edit_item_controls($order, $stock_item->stock_id);
}
if (!isset($_POST['stock_id']))
$_POST['stock_id'] = $order->line_items[$stock_id]->stock_id;
if (!isset($_POST['qty']) OR ($_POST['qty']==""))
- $_POST['qty'] = qty_format($order->line_items[$stock_id]->quantity);
+ $_POST['qty'] = qty_format($order->line_items[$stock_id]->quantity, $order->line_items[$stock_id]->stock_id, $dec);
if (!isset($_POST['std_cost']) OR ($_POST['std_cost']==""))
$_POST['std_cost'] = price_format($order->line_items[$stock_id]->standard_cost);
$item_info = get_item_edit_info($_POST['stock_id']);
- $_POST['qty'] = qty_format(0);
+ $_POST['qty'] = qty_format(0, $_POST['stock_id'], $dec);
$_POST['std_cost'] = price_format($item_info["standard_cost"]);
$_POST['units'] = $item_info["units"];
}
- qty_cells(null, 'qty', $_POST['qty']);
+ qty_cells(null, 'qty', $_POST['qty'], null, null, $dec);
label_cell($_POST['units']);
amount_cells(null, 'std_cost', $_POST['std_cost']);
label_cell(" ");
- if (isset($_GET['Edit']))
+ if (isset($_GET['Edit']))
{
submit_cells('UpdateItem', _("Update"));
submit_cells('CancelItemChanges', _("Cancel"));
- }
- else
+ }
+ else
{
submit_cells('AddItem', _("Add Item"), "colspan=2");
}
{
$already_on_order = 0;
- foreach ($order->line_items as $order_item)
+ foreach ($order->line_items as $order_item)
{
- if (strcasecmp($order_item->stock_id, $new_item) == 0)
+ if (strcasecmp($order_item->stock_id, $new_item) == 0)
{
$already_on_order = 1;
display_error(_("For Part :") . $new_item . " " . "This item is already on this order. You can change the quantity ordered of the existing line if necessary.");
$subtotal = 0;
$k = 0; //row colour counter
- foreach ($order->line_items as $stock_item)
+ foreach ($order->line_items as $stock_item)
{
$quantity = number_format2($stock_item->quantity,user_qty_dec());
label_cell("<a target='_blank' href='$path_to_root/inventory/inquiry/stock_status.php?" . SID . "stock_id=" . $stock_item->stock_id . "'>$stock_item->stock_id</a>");
label_cell($stock_item->item_description);
- label_cell($quantity, "nowrap align=right");
+ qty_cell($stock_item->quantity, false, get_qty_dec($stock_item->stock_id));
label_cell($stock_item->units);
edit_link_cell(SID . "Edit=$stock_item->stock_id");
delete_link_cell(SID . "Delete=$stock_item->stock_id");
end_row();
- }
- else
+ }
+ else
{
transfer_edit_item_controls($order, $stock_item->stock_id);
}
if (!isset($_POST['stock_id']))
$_POST['stock_id'] = $order->line_items[$stock_id]->stock_id;
if (!isset($_POST['qty']) || $_POST['qty'] == '')
- $_POST['qty'] = qty_format($order->line_items[$stock_id]->quantity);
+ $_POST['qty'] = qty_format($order->line_items[$stock_id]->quantity, $order->line_items[$stock_id]->stock_id, $dec);
$_POST['units'] = $order->line_items[$stock_id]->units;
$item_info = get_item_edit_info($_POST['stock_id']);
- $_POST['qty'] = qty_format(0);
+ $_POST['qty'] = qty_format(0, $_POST['stock_id'], $dec);
$_POST['units'] = $item_info["units"];
}
- small_qty_cells(null, 'qty', $_POST['qty']);
+ small_qty_cells(null, 'qty', $_POST['qty'], null, null, $dec);
label_cell($_POST['units']);
- if (isset($_GET['Edit']))
+ if (isset($_GET['Edit']))
{
submit_cells('UpdateItem', _("Update"));
submit_cells('CancelItemChanges', _("Cancel"));
- }
- else
+ }
+ else
{
submit_cells('AddItem', _("Add Item"), "colspan=2");
}
start_row("class='inquirybg'");
label_cell("<b>"._("Quantity on hand before") . " " . $_POST['AfterDate']."</b>", "align=center colspan=5");
label_cell(" ", "colspan=2");
-qty_cell($before_qty);
+$dec = get_qty_dec($_POST['stock_id']);
+qty_cell($before_qty, false, $dec);
end_row();
$j = 1;
if ($myrow["qty"] > 0)
{
- $quantity_formatted = number_format2($myrow["qty"],user_qty_dec());
+ $quantity_formatted = number_format2($myrow["qty"], $dec);
$total_in += $myrow["qty"];
}
else
{
- $quantity_formatted = number_format2(-$myrow["qty"],user_qty_dec());
+ $quantity_formatted = number_format2(-$myrow["qty"], $dec);
$total_out += -$myrow["qty"];
}
$after_qty += $myrow["qty"];
label_cell((($myrow["qty"] >= 0) ? $quantity_formatted : ""), "nowrap align=right");
label_cell((($myrow["qty"] < 0) ? $quantity_formatted : ""), "nowrap align=right");
- label_cell(number_format2($after_qty,user_qty_dec()), "nowrap align=right");
+ qty_cell($after_qty, false, $dec);
end_row();
$j++;
If ($j == 12)
//{
start_row("class='inquirybg'");
label_cell("<b>"._("Quantity on hand after") . " " . $_POST['BeforeDate']."</b>", "align=center colspan=5");
- qty_cell($total_in);
- qty_cell($total_out);
- qty_cell($after_qty);
+ qty_cell($total_in, false, $dec);
+ qty_cell($total_out, false, $dec);
+ qty_cell($after_qty, false, $dec);
end_row();
//}
_("Demand"), _("Available"), _("On Order"));
}
table_header($th);
+$dec = get_qty_dec($_POST['stock_id']);
$j = 1;
$k = 0; //row colour counter
}
label_cell($myrow["location_name"]);
- qty_cell($qoh);
- qty_cell($myrow["reorder_level"]);
- qty_cell($demand_qty);
- qty_cell($qoh - $demand_qty);
- qty_cell($qoo);
+ qty_cell($qoh, false, $dec);
+ qty_cell($myrow["reorder_level"], false, $dec);
+ qty_cell($demand_qty, false, $dec);
+ qty_cell($qoh - $demand_qty, false, $dec);
+ qty_cell($qoo, false, $dec);
end_row();
}
{
/* It must be a service or kitset part */
label_cell($myrow["location_name"]);
- qty_cell($demand_qty);
+ qty_cell($demand_qty, false, $dec);
end_row();
}
if (isset($_GET['selected_id']))
{
$selected_id = $_GET['selected_id'];
-}
+}
else if (isset($_POST['selected_id']))
{
$selected_id = $_POST['selected_id'];
//----------------------------------------------------------------------------------
-if (isset($_POST['ADD_ITEM']) || isset($_POST['UPDATE_ITEM']))
+if (isset($_POST['ADD_ITEM']) || isset($_POST['UPDATE_ITEM']))
{
//initialise no input errors assumed initially before we test
$input_error = 0;
- if (strlen($_POST['abbr']) == 0)
+ if (strlen($_POST['abbr']) == 0)
{
$input_error = 1;
display_error(_("The unit of measure code cannot be empty."));
set_focus('abbr');
}
- if (strlen($_POST['description']) == 0)
+ if (strlen($_POST['description']) == 0)
{
$input_error = 1;
display_error(_("The unit of measure description cannot be empty."));
set_focus('description');
}
- if (!is_numeric($_POST['decimals']))
+ if (!is_numeric($_POST['decimals']))
{
$input_error = 1;
display_error(_("The number of decimal places must be integer."));
if ($input_error !=1) {
write_item_unit(isset($selected_id) ? $selected_id : '', $_POST['abbr'], $_POST['description'], $_POST['decimals'] );
- meta_forward($_SERVER['PHP_SELF']);
+ meta_forward($_SERVER['PHP_SELF']);
}
}
-//----------------------------------------------------------------------------------
+//----------------------------------------------------------------------------------
-if (isset($_GET['delete']))
+if (isset($_GET['delete']))
{
// PREVENT DELETES IF DEPENDENT RECORDS IN 'stock_master'
-
+
if (item_unit_used($selected_id))
{
display_error(_("Cannot delete this unit of measure because items have been created using this units."));
- }
- else
+ }
+ else
{
delete_item_unit($selected_id);
- meta_forward($_SERVER['PHP_SELF']);
+ meta_forward($_SERVER['PHP_SELF']);
}
}
table_header($th);
$k = 0; //row colour counter
-while ($myrow = db_fetch($result))
+while ($myrow = db_fetch($result))
{
-
+
alt_table_row_color($k);
label_cell($myrow["abbr"]);
start_table("class='tablestyle_noborder'");
-if (isset($selected_id))
+if (isset($selected_id))
{
//editing an existing item category
hidden('abbr', $_POST['abbr']);
} else
text_row(_("Unit Abbreviation:"), 'abbr', null, 20, 20);
-text_row(_("Descriptive Name:"), 'description', null, 40, 40);
-text_row(_("Decimal Places:"), 'decimals', null, 3, 3);
+text_row(_("Descriptive Name:"), 'description', null, 40, 40);
+
+//text_row(_("Decimal Places:"), 'decimals', null, 3, 3);
+number_list_row(_("Decimal Places:"), 'decimals', null, 0, 6, _("User Quantity Decimals"));
end_table(1);
label_cell($myrow["location_name"]);
- $_POST[$myrow["loc_code"]] = qty_format($myrow["reorder_level"]);
+ $_POST[$myrow["loc_code"]] = qty_format($myrow["reorder_level"], $_POST['stock_id'], $dec);
- label_cell(number_format2($qoh,user_qty_dec()), "nowrap align='right'");
- qty_cells(null, $myrow["loc_code"]);
+ qty_cell($qoh, false, $dec);
+ qty_cells(null, $myrow["loc_code"], null, null, null, $dec);
end_row();
$j++;
If ($j == 12)
$adjustment_items = get_stock_adjustment_items($trans_no);
$k = 0;
$header_shown = false;
-while ($adjustment = db_fetch($adjustment_items))
+while ($adjustment = db_fetch($adjustment_items))
{
- if (!$header_shown)
+ if (!$header_shown)
{
$adjustment_type = get_movement_type($adjustment['person_id']) ;
-
+
start_table("$table_style2 width=90%");
start_row();
label_cells(_("At Location"), $adjustment['location_name'], "class='tableheader2'");
$th = array(_("Item"), _("Description"), _("Quantity"),
_("Units"), _("Unit Cost"));
- table_header($th);
+ table_header($th);
}
alt_table_row_color($k);
label_cell($adjustment['stock_id']);
label_cell($adjustment['description']);
- qty_cell($adjustment['qty']);
+ qty_cell($adjustment['qty'], false, get_qty_dec($adjustment['stock_id']));
label_cell($adjustment['units']);
amount_cell($adjustment['standard_cost']);
end_row();
$th = array(_("Item"), _("Description"), _("Quantity"), _("Units"));
table_header($th);
$transfer_items = get_stock_moves(systypes::location_transfer(), $trans_no);
-
-while ($item = db_fetch($transfer_items))
+$k = 0;
+while ($item = db_fetch($transfer_items))
{
- if ($item['loc_code'] == $to_trans['loc_code'])
+ if ($item['loc_code'] == $to_trans['loc_code'])
{
alt_table_row_color($k);
label_cell($item['stock_id']);
label_cell($item['description']);
- qty_cell($item['qty']);
+ qty_cell($item['qty'], false, get_qty_dec($item['stock_id']));
label_cell($item['units']);
end_row();;
}
label_cell($myrow["description"]);
label_cell($myrow["WorkCentreDescription"]);
label_cell($myrow["location_name"]);
- qty_cell($myrow["quantity"]);
+ qty_cell($myrow["quantity"], false, get_qty_dec($myrow["component"]));
amount_cell($myrow["standard_cost"]);
amount_cell($myrow["ComponentCost"]);
end_row();
label_cell($myrow["location_name"]);
label_cell($myrow["WorkCentreDescription"]);
- qty_cell($myrow["units_req"]);
- qty_cell($myrow["units_req"] * $quantity);
- qty_cell($myrow["units_issued"]);
+ $dec = get_qty_dec($myrow["stock_id"]);
+ qty_cell($myrow["units_req"], false, $dec);
+ qty_cell($myrow["units_req"] * $quantity, false, $dec);
+ qty_cell($myrow["units_issued"], false, $dec);
if ($show_qoh)
- qty_cell($qoh);
+ qty_cell($qoh, false, $dec);
else
label_cell("");
end_row();
label_cell($myrow["location_name"]);
label_cell(sql2date($myrow["date_"]));
label_cell(sql2date($myrow["required_by"]));
-
- qty_cell($myrow["units_reqd"]);
+ $dec = get_qty_dec($myrow["stock_id"]);
+ qty_cell($myrow["units_reqd"], false, $dec);
if ($myrow["released"] == true)
{
label_cell(sql2date($myrow["released_date"]));
- qty_cell($myrow["units_issued"]);
+ qty_cell($myrow["units_issued"], false, $dec);
}
end_row();
label_cell($myrow["location_name"]);
label_cell(sql2date($myrow["date_"]));
- qty_cell($myrow["units_issued"]);
+ qty_cell($myrow["units_issued"], false, get_qty_dec($myrow["stock_id"]));
end_row();
{
$already_on_order = 0;
- foreach ($order->line_items as $order_item)
+ foreach ($order->line_items as $order_item)
{
- if (strcasecmp($order_item->stock_id, $new_item) == 0)
+ if (strcasecmp($order_item->stock_id, $new_item) == 0)
{
$already_on_order = 1;
display_error(_("For Part :") . $new_item . " " . "This item is already on this order. You can change the quantity ordered of the existing line if necessary.");
start_table("$table_style colspan=7");
$th = array(_("Item Code"), _("Item Description"), _("Quantity"),
_("Unit"), _("Unit Cost"));
- table_header($th);
+ table_header($th);
- $subtotal = 0;
$k = 0; //row colour counter
- foreach ($order->line_items as $stock_item)
+ foreach ($order->line_items as $stock_item)
{
if ($_GET['Edit'] != $stock_item->stock_id)
label_cell("<a target='_blank' href='$path_to_root/inventory/inquiry/stock_status.php?" . SID . "stock_id=" . $stock_item->stock_id . "'>$stock_item->stock_id</a>");
label_cell($stock_item->item_description);
- qty_cell($stock_item_quantity);
+ qty_cell($stock_item->quantity, false, get_qty_dec($stock_item->stock_id));
if (strlen($stock_item->units))
label_cell($stock_item->units);
else
edit_link_cell(SID . "Edit=$stock_item->stock_id");
delete_link_cell(SID . "Delete=$stock_item->stock_id");
end_row();
- }
- else
+ }
+ else
{
adjustment_edit_item_controls($order, $stock_item->stock_id);
}
label_cell($_POST['units']);
text_cells(null, 'std_cost', $_POST['std_cost'], 15, 14);
- if (isset($_GET['Edit']))
+ if (isset($_GET['Edit']))
{
submit_cells('UpdateItem', _("Update"));
submit_cells('CancelItemChanges', _("Cancel"));
- }
- else
+ }
+ else
{
submit_cells('AddItem', _("Add Item"), "colspan=2");
}
label_cell("<a href='$select_item'>" . $myrow["parent"]. " - " . $myrow["description"]. "</a>");
label_cell($myrow["WorkCentreName"]);
label_cell($myrow["location_name"]);
- label_cell(qty_format($myrow["quantity"]));
+ label_cell(qty_format($myrow["quantity"], $_POST['stock_id']));
end_row();
$j++;
label_cell($myrow["description"]);
label_cell($myrow["location_name"]);
label_cell($myrow["WorkCentreDescription"]);
- label_cell(qty_format($myrow["quantity"]));
+ label_cell(qty_format($myrow["quantity"], $myrow["component"]));
label_cell($myrow["units"]);
edit_link_cell(SID . "NewItem=$selected_parent&selected_component=" . $myrow["id"]);
delete_link_cell(SID . "delete=" . $myrow["id"]. "&stock_id=" . $_POST['stock_id']);
$_POST['loc_code'] = $myrow["loc_code"];
$_POST['workcentre_added'] = $myrow["workcentre_added"];
- $_POST['quantity'] = qty_format($myrow["quantity"]);
+ $_POST['quantity'] = qty_format($myrow["quantity"], $myrow["component"], $dec);
hidden('selected_parent', $selected_parent);
hidden('selected_component', $selected_component);
if (!isset($_POST['quantity']))
{
- $_POST['quantity'] = qty_format(1);
+ $_POST['quantity'] = qty_format(1, $_POST['stock_id'], $dec);
}
- qty_row(_("Quantity:"), 'quantity', $_POST['quantity']);
+ qty_row(_("Quantity:"), 'quantity', $_POST['quantity'], null, null, $dec);
end_table(1);
submit_center('Submit', _("Add/Update"));
$js = "";
if ($use_popup_windows)
$js .= get_js_open_window(800, 500);
-if (isset($_GET['outstanding_only']))
+if (isset($_GET['outstanding_only']))
{
$outstanding_only = 1;
page(_("Search Outstanding Work Orders"), false, false, "", $js);
-}
-else
+}
+else
{
$outstanding_only = 0;
page(_("Search Work Orders"), false, false, "", $js);
WHERE ".TB_PREF."stock_master.stock_id=".TB_PREF."workorders.stock_id AND
".TB_PREF."locations.loc_code=".TB_PREF."workorders.loc_code ";
-if (check_value('OpenOnly'))
+if (check_value('OpenOnly'))
{
$sql .= " AND ".TB_PREF."workorders.closed=0 ";
}
-if (isset($_POST['StockLocation']) && $_POST['StockLocation'] != $all_items)
+if (isset($_POST['StockLocation']) && $_POST['StockLocation'] != $all_items)
{
$sql .= "AND ".TB_PREF."workorders.loc_code='" . $_POST['StockLocation'] . "' ";
}
-if (isset($_POST['OrderNumber']) && $_POST['OrderNumber'] != "")
+if (isset($_POST['OrderNumber']) && $_POST['OrderNumber'] != "")
{
$sql .= "AND ".TB_PREF."workorders.wo_ref LIKE '%". $_POST['OrderNumber'] . "%'";
}
-if (isset($_POST['SelectedStockItem']) && $_POST['SelectedStockItem'] != $all_items)
+if (isset($_POST['SelectedStockItem']) && $_POST['SelectedStockItem'] != $all_items)
{
$sql .= "AND ".TB_PREF."workorders.stock_id='". $_POST['SelectedStockItem'] . "'";
}
-if (check_value('OverdueOnly'))
+if (check_value('OverdueOnly'))
{
$Today = date2sql(Today());
$j = 1;
$k = 0;
-while ($myrow = db_fetch($result))
+while ($myrow = db_fetch($result))
{
// check if it's an overdue work order
- if (!$myrow["closed"] && date_diff(Today(), sql2date($myrow["required_by"]), "d") > 0)
+ if (!$myrow["closed"] && date_diff(Today(), sql2date($myrow["required_by"]), "d") > 0)
{
start_row("class='overduebg'");
}
$modify_page = $path_to_root . "/manufacturing/work_order_entry.php?" . SID . "trans_no=" . $myrow["id"];
$release_page = $path_to_root . "/manufacturing/work_order_release.php?" . SID . "trans_no=" . $myrow["id"];
- if ($myrow["closed"] == 0)
+ if ($myrow["closed"] == 0)
{
$issue = $path_to_root . "/manufacturing/work_order_issue.php?" . SID . "trans_no=" .$myrow["id"];
$add_finished = $path_to_root . "/manufacturing/work_order_add_finished.php?" . SID . "trans_no=" .$myrow["id"];
$issue_link = $can_issue?("<a href=$issue>" . _("Issue") . "</a></td>
<td><a href=$add_finished>" . _("Produce") . "</a></td>
<td><a href=$costs>" . _("Costs") . "</a>"): _("Not Released");
- }
- else
+ }
+ else
{
$issue_link = "";
}
-
+ $dec = get_qty_dec($myrow["stock_id"]);
label_cell(get_trans_view_str(systypes::work_order(), $myrow["id"]));
label_cell(get_trans_view_str(systypes::work_order(), $myrow["id"], $myrow["wo_ref"]));
label_cell(wo_types::name($myrow["type"]));
label_cell($myrow["location_name"]);
view_stock_status_cell($myrow["stock_id"], $myrow["description"]);
- qty_cell($myrow["units_reqd"]);
- qty_cell($myrow["units_issued"]);
+ qty_cell($myrow["units_reqd"], false, $dec);
+ qty_cell($myrow["units_issued"], false, $dec);
label_cell(sql2date($myrow["date_"]));
label_cell(sql2date($myrow["required_by"]));
label_cell(($myrow["closed"]? _("Yes"):_("No")));
if ($issue_link != "")
label_cell($issue_link);
- if ($myrow["released"] == 0)
+ if ($myrow["released"] == 0)
{
label_cell("<a href=$release_page>" . _("Release") . "</a>");
}
- if ($myrow["closed"] == 0)
+ if ($myrow["closed"] == 0)
{
label_cell("<a href=$modify_page>" . _("Edit") . "</a>");
}
alt_table_row_color($k);
label_cell($myrow["stock_id"] . " - " . $myrow["description"]);
- qty_cell($myrow["qty_issued"]);
+ qty_cell($myrow["qty_issued"], false, get_qty_dec($myrow["stock_id"]));
label_cell($myrow["units"]);
end_row();;
//-------------------------------------------------------------------------------------------------
-if ($_GET['trans_no'] != "")
+if ($_GET['trans_no'] != "")
{
$wo_production = $_GET['trans_no'];
}
start_table($table_style);
$th = array(_("Production #"), _("Reference"), _("For Work Order #"),
_("Item"), _("Quantity Manufactured"), _("Date"));
- table_header($th);
+ table_header($th);
start_row();
label_cell($myrow["id"]);
label_cell($myrow["reference"]);
label_cell(get_trans_view_str(systypes::work_order(),$myrow["workorder_id"]));
label_cell($myrow["stock_id"] . " - " . $myrow["StockDescription"]);
- qty_cell($myrow["quantity"]);
+ qty_cell($myrow["quantity"], false, get_qty_dec($myrow["stock_id"]));
label_cell(sql2date($myrow["date_"]));
end_row();
}
$_POST['wo_ref'] = $myrow["wo_ref"];
- $_POST['quantity'] = qty_format($myrow["units_reqd"]);
+ $_POST['stock_id'] = $myrow["stock_id"];
+ $_POST['quantity'] = qty_format($myrow["units_reqd"], $_POST['stock_id'], $dec);
$_POST['StockLocation'] = $myrow["loc_code"];
$_POST['released'] = $myrow["released"];
$_POST['closed'] = $myrow["closed"];
- $_POST['stock_id'] = $myrow["stock_id"];
$_POST['type'] = $myrow["type"];
$_POST['date_'] = sql2date($myrow["date_"]);
$_POST['RequDate'] = sql2date($myrow["required_by"]);
}
if (!isset($_POST['quantity']))
- $_POST['quantity'] = qty_format(1);
+ $_POST['quantity'] = qty_format(1, $_POST['stock_id'], $dec);
if (get_post('type') == wo_types::advanced())
{
- qty_row(_("Quantity Required:"), 'quantity', 12);
+ qty_row(_("Quantity Required:"), 'quantity', null, null, null, $dec);
if ($_POST['released'])
- label_row(_("Quantity Manufactured:"), qty_format($_POST['units_issued']));
+ label_row(_("Quantity Manufactured:"), qty_format($_POST['units_issued'], $_POST['stock_id']));
date_row(_("Date") . ":", 'date_');
date_row(_("Date Required By") . ":", 'RequDate', '', null, sys_prefs::default_wo_required_by());
}
else
{
- qty_row(_("Quantity:"), 'quantity', 12);
+ qty_row(_("Quantity:"), 'quantity', null, null, null, $dec);
date_row(_("Date") . ":", 'date_');
hidden('RequDate', '');
supplier_list_row(_("Supplier:"), 'supplier_id', $_POST['supplier_id'], false, true);
- if ($supp_trans->supplier_id != $_POST['supplier_id'])
+ if ($supp_trans->supplier_id != $_POST['supplier_id'])
{
// supplier has changed
// delete all the order items - drastic but necessary because of
if ($supp_trans->is_invoice)
label_row(_("Invoice Total:"), $display_total, "align=right", "align=right");
else
- label_row("<font color=red>" . _("Credit Note Total:") . "</font>",
+ label_row("<font color=red>" . _("Credit Note Total:") . "</font>",
"<font color=red><b>$display_total</b></font>", "align=right", "nowrap align=right");
end_table();
echo "<table width=100%>";
echo "<tr><td align=center><span class='headingtext'>$heading</span></td>";
- if ($mode == 0)
+ if ($mode == 0)
{
submit_cells('InvGL', _("Edit"), "align=right");
}
echo "</td></tr><tr><td>"; // ouer table
echo "<table width=100% $table_style>";
-
+
$dim = get_company_pref('use_dimension');
if ($dim == 2)
$th = array(_("Account"), _("Name"), _("Dimension")." 1", _("Dimension")." 2", _("Amount"), _("Memo"));
label_cell($entered_gl_code->gl_code);
label_cell($entered_gl_code->gl_act_name);
-
+
if ($dim >= 1)
label_cell(get_dimension_string($entered_gl_code->gl_dim, true));
if ($dim > 1)
$i++;
if ($i > 15)
{
- $i = 0;
- table_header($th);
+ $i = 0;
+ table_header($th);
}
}
}
$colspan = ($dim == 2 ? 4 : ($dim == 1 ? 3 : 2));
- label_row(_("Total"), price_format($total_gl_value),
+ label_row(_("Total"), price_format($total_gl_value),
"colspan=".$colspan." align=right", "nowrap align=right");
echo "</table>";
echo "</td></tr>";
-
+
end_table(); // outertable
return $total_gl_value;
echo "<table width=100% >";
echo "<tr><td align=center><span class='headingtext'>$heading</span></td>";
- if ($mode == 0)
+ if ($mode == 0)
{
submit_cells('InvGRN', _("Edit"), "align=right");
}
label_cell(get_trans_view_str(25,$entered_grn->id));
label_cell($entered_grn->item_code);
label_cell($entered_grn->item_description);
- qty_cell(abs($entered_grn->this_quantity_inv));
+ qty_cell(abs($entered_grn->this_quantity_inv), false, get_qty_dec($entered_grn->item_code));
amount_cell($entered_grn->chg_price);
amount_cell( round($entered_grn->chg_price * abs($entered_grn->this_quantity_inv)), user_price_dec());
echo "</table>";
echo "</td></tr>";
-
+
end_table(); // outertable
return $total_grn_value;
//--------------------------------------------------------------------------------------------------
function get_duedate_from_terms(&$supp_trans)
{
- if (!is_date($supp_trans->tran_date))
+ if (!is_date($supp_trans->tran_date))
{
$supp_trans->tran_date = Today();
}
- if (substr( $supp_trans->terms, 0, 1) == "1")
+ if (substr( $supp_trans->terms, 0, 1) == "1")
{ /*Its a day in the following month when due */
$supp_trans->due_date = add_days(end_month($supp_trans->tran_date), (int) substr( $supp_trans->terms,1));
- }
- else
+ }
+ else
{ /*Use the Days Before Due to add to the invoice date */
$supp_trans->due_date = add_days($supp_trans->tran_date, (int) substr( $supp_trans->terms,1));
}
alt_table_row_color($k);
label_cell($po_line->stock_id);
label_cell($po_line->item_description);
- qty_cell($po_line->quantity);
+ qty_cell($po_line->quantity, false, get_qty_dec($po_line->stock_id));
label_cell($po_line->units);
label_cell($po_line->req_del_date);
amount_cell($po_line->price);
if (!isset($_POST['stock_id']))
$_POST['stock_id'] = $order->line_items[$_GET['Edit']]->stock_id;
if (!isset($_POST['qty']) || ($_POST['qty'] == ""))
- $_POST['qty'] = qty_format($order->line_items[$_GET['Edit']]->quantity);
+ $_POST['qty'] = qty_format($order->line_items[$_GET['Edit']]->quantity, $_POST['stock_id'], $dec);
if (!isset($_POST['price']) || ($_POST['price'] == ""))
$_POST['price'] = price_format($order->line_items[$_GET['Edit']]->price);
if (!isset($_POST['req_del_date']) || ($_POST['req_del_date'] == ""))
$item_info = get_item_edit_info($_POST['stock_id']);
$_POST['units'] = $item_info["units"];
- $_POST['qty'] = qty_format(1);
+ $_POST['qty'] = qty_format(1, $_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);
}
- qty_cells(null, 'qty', null);
+ qty_cells(null, 'qty', null, null, null, $dec);
label_cell($_POST['units']);
date_cells(null, 'req_del_date', '', null, 0, 0, 0);
//---------------------------------------------------------------------------------------------------------------
-if (isset($_GET['AddedID']))
+if (isset($_GET['AddedID']))
{
$grn = $_GET['AddedID'];
$trans_type = 25;
//--------------------------------------------------------------------------------------------------
-if ((!isset($_GET['PONumber']) || $_GET['PONumber'] == 0) && !isset($_SESSION['PO']))
-//if (isset($_GET['PONumber']) && !$_GET['PONumber'] > 0 && !isset($_SESSION['PO']))
+if ((!isset($_GET['PONumber']) || $_GET['PONumber'] == 0) && !isset($_SESSION['PO']))
+//if (isset($_GET['PONumber']) && !$_GET['PONumber'] > 0 && !isset($_SESSION['PO']))
{
die (_("This page can only be opened if a purchase order has been selected. Please select a purchase order first."));
}
start_table("colspan=7 $table_style width=90%");
$th = array(_("Item Code"), _("Description"), _("Ordered"), _("Units"), _("Received"),
_("Outstanding"), _("This Delivery"), _("Price"), _("Total"));
- table_header($th);
+ table_header($th);
/*show the line items on the order with the quantity being received for modification */
if (count($_SESSION['PO']->line_items)> 0 )
{
- foreach ($_SESSION['PO']->line_items as $ln_itm)
+ foreach ($_SESSION['PO']->line_items as $ln_itm)
{
alt_table_row_color($k);
text_cells(null, $ln_itm->stock_id . "Desc", $ln_itm->item_description, 30, 50);
else
label_cell($ln_itm->item_description);
- qty_cell($ln_itm->quantity);
+ $dec = get_qty_dec($ln_itm->stock_id);
+ qty_cell($ln_itm->quantity, false, $dec);
label_cell($ln_itm->units);
- qty_cell($ln_itm->qty_received);
- qty_cell($qty_outstanding);
+ qty_cell($ln_itm->qty_received, false, $dec);
+ qty_cell($qty_outstanding, false, $dec);
if ($qty_outstanding > 0)
- qty_cells(null, $ln_itm->line_no, qty_format($ln_itm->receive_qty), "align=right");
+ qty_cells(null, $ln_itm->line_no, qty_format($ln_itm->receive_qty, $ln_itm->stock_id, $dec), "align=right", null, $dec);
else
- qty_cells(null, $ln_itm->line_no, qty_format($ln_itm->receive_qty), "align=right",
- "disabled");
+ qty_cells(null, $ln_itm->line_no, qty_format($ln_itm->receive_qty, $ln_itm->stock_id, $dec), "align=right",
+ "disabled", $dec);
amount_cell($ln_itm->price);
amount_cell($line_total);
check_db_error("Could not check that the details of the purchase order had not been changed by another user ", $sql);
$line_no = 1;
- while ($myrow = db_fetch($result))
+ while ($myrow = db_fetch($result))
{
$ln_item = $_SESSION['PO']->line_items[$line_no];
// only compare against items that are outstanding
$qty_outstanding = $ln_item->quantity - $ln_item->qty_received;
- if ($qty_outstanding > 0)
+ if ($qty_outstanding > 0)
{
- if ($ln_item->qty_inv != $myrow["qty_invoiced"] ||
- $ln_item->stock_id != $myrow["item_code"] ||
- $ln_item->quantity != $myrow["quantity_ordered"] ||
- $ln_item->qty_received != $myrow["quantity_received"])
+ if ($ln_item->qty_inv != $myrow["qty_invoiced"] ||
+ $ln_item->stock_id != $myrow["item_code"] ||
+ $ln_item->quantity != $myrow["quantity_ordered"] ||
+ $ln_item->qty_received != $myrow["quantity_received"])
{
return true;
}
return false;
}
- if (!is_date($_POST['DefaultReceivedDate']))
+ if (!is_date($_POST['DefaultReceivedDate']))
{
display_error(_("The entered date is invalid."));
set_focus('DefaultReceivedDate');
return false;
}
- if (!references::is_valid($_POST['ref']))
+ if (!references::is_valid($_POST['ref']))
{
display_error(_("You must enter a reference."));
set_focus('ref');
return false;
}
- if (!is_new_reference($_POST['ref'], 25))
+ if (!is_new_reference($_POST['ref'], 25))
{
display_error(_("The entered reference is already in use."));
set_focus('ref');
}
$something_received = 0;
- foreach ($_SESSION['PO']->line_items as $order_line)
+ foreach ($_SESSION['PO']->line_items as $order_line)
{
- if ($order_line->receive_qty > 0)
+ if ($order_line->receive_qty > 0)
{
$something_received = 1;
break;
// Check whether trying to deliver more items than are recorded on the actual purchase order (+ overreceive allowance)
$delivery_qty_too_large = 0;
- foreach ($_SESSION['PO']->line_items as $order_line)
+ foreach ($_SESSION['PO']->line_items as $order_line)
{
- if ($order_line->receive_qty+$order_line->qty_received >
- $order_line->quantity * (1+ (sys_prefs::over_receive_allowance() / 100)))
+ if ($order_line->receive_qty+$order_line->qty_received >
+ $order_line->quantity * (1+ (sys_prefs::over_receive_allowance() / 100)))
{
$delivery_qty_too_large = 1;
break;
{ /*Then dont bother proceeding cos nothing to do ! */
display_error(_("There is nothing to process. Please enter valid quantities greater than zero."));
return false;
- }
+ }
elseif ($delivery_qty_too_large == 1)
{
display_error(_("Entered quantities cannot be greater than the quantity entered on the purchase order including the allowed over-receive percentage") . " (" . sys_prefs::over_receive_allowance() ."%)."
if (!can_process())
return;
- if (check_po_changed())
+ if (check_po_changed())
{
echo "<br> " . _("This order has been changed or invoiced since this delivery was started to be actioned. Processing halted. To enter a delivery against this purchase order, it must be re-selected and re-read again to update the changes made by the other user.") . "<BR>";
//--------------------------------------------------------------------------------------------------
-if (isset($_GET['PONumber']) && $_GET['PONumber'] > 0 && !isset($_POST['Update']))
+if (isset($_GET['PONumber']) && $_GET['PONumber'] > 0 && !isset($_POST['Update']))
{
create_new_po();
//--------------------------------------------------------------------------------------------------
-if (isset($_POST['Update']) || isset($_POST['ProcessGoodsReceived']))
+if (isset($_POST['Update']) || isset($_POST['ProcessGoodsReceived']))
{
/* if update quantities button is hit page has been called and ${$line->line_no} would have be
set from the post to the quantity to be received in this receival*/
- foreach ($_SESSION['PO']->line_items as $line)
+ foreach ($_SESSION['PO']->line_items as $line)
{
$_POST[$line->line_no] = max($_POST[$line->line_no], 0);
if (!check_num($line->line_no))
- $_POST[$line->line_no] = qty_format(0);
+ $_POST[$line->line_no] = qty_format(0, $line->stock_id);
if (!isset($_POST['DefaultReceivedDate']) || $_POST['DefaultReceivedDate'] == "")
$_POST['DefaultReceivedDate'] = Today();
$_SESSION['PO']->line_items[$line->line_no]->receive_qty = input_num($line->line_no);
- if (isset($_POST[$line->stock_id . "Desc"]) && strlen($_POST[$line->stock_id . "Desc"]) > 0)
+ if (isset($_POST[$line->stock_id . "Desc"]) && strlen($_POST[$line->stock_id . "Desc"]) > 0)
{
$_SESSION['PO']->line_items[$line->line_no]->item_description = $_POST[$line->stock_id . "Desc"];
}
function check_data()
{
- if (!check_num('This_QuantityCredited', 0))
+ if (!check_num('This_QuantityCredited', 0))
{
display_error(_("The quantity to credit must be numeric and greater than zero."));
set_focus('This_QuantityCredited');
foreach ($_SESSION['supp_trans']->grn_items as $entered_grn)
{
- if ($entered_grn->id == $myrow["id"])
+ if ($entered_grn->id == $myrow["id"])
{
$grn_already_on_credit = True;
}
label_cell($myrow["item_code"]);
label_cell($myrow["description"]);
label_cell(sql2date($myrow["delivery_date"]));
- qty_cell($myrow["qty_recd"]);
- qty_cell($myrow["quantity_inv"]);
- qty_cell($myrow["qty_recd"] - $myrow["quantity_inv"]);
+ $dec = get_qty_dec($myrow["item_code"]);
+ qty_cell($myrow["qty_recd"], false, $dec);
+ qty_cell($myrow["quantity_inv"], false, $dec);
+ qty_cell($myrow["qty_recd"] - $myrow["quantity_inv"], false, $dec);
amount_cell($myrow["unit_price"]);
amount_cell(round($myrow["unit_price"] * $myrow["quantity_inv"], user_price_dec()));
end_row();
start_table("$table_style width=80%");
$th = array(_("Sequence #"), _("Item"), _("Qty Already Invoiced"),
_("Quantity to Credit"), _("Order Price"), _("Credit Price"));
- table_header($th);
+ table_header($th);
start_row();
label_cell($_POST['grn_item_id']);
label_cell($myrow['item_code'] . " " . $myrow['description']);
- qty_cell($myrow["quantity_inv"]);
- qty_cells(null, 'This_QuantityCredited', qty_format(max($myrow['quantity_inv'],0)));
+ $dec = get_qty_dec($myrow['item_code']);
+ qty_cell($myrow["quantity_inv"], false, $dec);
+ qty_cells(null, 'This_QuantityCredited', qty_format(max($myrow['quantity_inv'],0),$myrow['item_code'], $dec), null, null, $dec);
amount_cell($myrow['unit_price']);
amount_cells(null, 'ChgPrice', price_format($myrow['unit_price']));
end_row();
{
global $check_price_charged_vs_order_price,
$check_qty_charged_vs_del_qty;
- if (!check_num('this_quantity_inv', 0) || input_num('this_quantity_inv')==0)
+ if (!check_num('this_quantity_inv', 0) || input_num('this_quantity_inv')==0)
{
display_error( _("The quantity to invoice must be numeric and greater than zero."));
set_focus('this_quantity_inv');
return false;
}
- if ($check_price_charged_vs_order_price == True)
+ if ($check_price_charged_vs_order_price == True)
{
if ($_POST['order_price']!=input_num('ChgPrice')) {
if ($_POST['order_price']==0 ||
- input_num('ChgPrice')/$_POST['order_price'] >
+ input_num('ChgPrice')/$_POST['order_price'] >
(1 + (sys_prefs::over_charge_allowance() / 100)))
{
display_error(_("The price being invoiced is more than the purchase order price by more than the allowed over-charge percentage. The system is set up to prohibit this. See the system administrator to modify the set up parameters if necessary.") .
}
}
- if ($check_qty_charged_vs_del_qty == True)
+ if ($check_qty_charged_vs_del_qty == True)
{
- if (input_num('this_quantity_inv') / ($_POST['qty_recd'] - $_POST['prev_quantity_inv']) >
+ if (input_num('this_quantity_inv') / ($_POST['qty_recd'] - $_POST['prev_quantity_inv']) >
(1+ (sys_prefs::over_charge_allowance() / 100)))
{
display_error( _("The quantity being invoiced is more than the outstanding quantity by more than the allowed over-charge percentage. The system is set up to prohibit this. See the system administrator to modify the set up parameters if necessary.")
if (input_num('this_quantity_inv') >= ($_POST['qty_recd'] - $_POST['prev_quantity_inv']))
{
$complete = True;
- }
- else
+ }
+ else
{
$complete = False;
}
foreach ($_SESSION['supp_trans']->grn_items as $entered_grn)
{
- if ($entered_grn->id == $myrow["id"])
+ if ($entered_grn->id == $myrow["id"])
{
$grn_already_on_invoice = True;
}
label_cell($myrow["item_code"]);
label_cell($myrow["description"]);
label_cell(sql2date($myrow["delivery_date"]));
- qty_cell($myrow["qty_recd"]);
- qty_cell($myrow["quantity_inv"]);
- qty_cell($myrow["qty_recd"] - $myrow["quantity_inv"]);
+ $dec = get_qty_dec($myrow["item_code"]);
+ qty_cell($myrow["qty_recd"], false, $dec);
+ qty_cell($myrow["quantity_inv"], false, $dec);
+ qty_cell($myrow["qty_recd"] - $myrow["quantity_inv"], false, $dec);
amount_cell($myrow["unit_price"]);
amount_cell(round($myrow["unit_price"] * ($myrow["qty_recd"] - $myrow["quantity_inv"]),
user_price_dec()));
end_row();
-
+
$i++;
if ($i > 15)
{
start_table("$table_style width=80%");
$th = array(_("Sequence #"), _("Item"), _("Description"), _("Quantity Outstanding"),
_("Quantity to Invoice"), _("Order Price"), _("Actual Price"));
- table_header($th);
+ table_header($th);
start_row();
label_cell($_POST['grn_item_id']);
label_cell($myrow['item_code']);
label_cell($myrow['description']);
- qty_cell($myrow['QtyOstdg']);
- qty_cells(null, 'this_quantity_inv', qty_format($myrow['QtyOstdg']));
+ $dec = get_qty_dec($myrow['item_code']);
+ qty_cell($myrow['QtyOstdg'], false, $dec);
+ qty_cells(null, 'this_quantity_inv', qty_format($myrow['QtyOstdg'], $myrow['item_code'], $dec), null, null, $dec);
amount_cell($myrow['unit_price']);
small_amount_cells(null, 'ChgPrice', price_format($myrow['unit_price']));
end_row();
include($path_to_root . "/purchasing/includes/purchasing_ui.inc");
-if (!isset($_GET['trans_no']))
+if (!isset($_GET['trans_no']))
{
die ("<BR>" . _("This page must be called with a Purchase Order Delivery number to review."));
}
start_table("colspan=9 $table_style width=90%");
$th = array(_("Item Code"), _("Item Description"), _("Delivery Date"), _("Quantity"),
_("Unit"), _("Price"), _("Line Total"), _("Quantity Invoiced"));
-
-table_header($th);
+
+table_header($th);
$total = 0;
$k = 0; //row colour counter
-foreach ($purchase_order->line_items as $stock_item)
+foreach ($purchase_order->line_items as $stock_item)
{
$line_total = $stock_item->qty_received * $stock_item->price;
label_cell($stock_item->stock_id);
label_cell($stock_item->item_description);
label_cell($stock_item->req_del_date, "nowrap align=right");
- qty_cell($stock_item->qty_received);
+ $dec = get_qty_dec($stock_item->stock_id);
+ qty_cell($stock_item->qty_received, false, $dec);
label_cell($stock_item->units);
amount_cell($stock_item->price);
amount_cell($line_total);
- qty_cell($stock_item->qty_inv);
+ qty_cell($stock_item->qty_inv, false, $dec);
end_row();
$total += $line_total;
}
$display_total = number_format2($total,user_price_dec());
-label_row(_("Total Excluding Tax/Shipping"), $display_total,
+label_row(_("Total Excluding Tax/Shipping"), $display_total,
"colspan=6", "nowrap align=right");
end_table(1);
include($path_to_root . "/purchasing/includes/purchasing_ui.inc");
-if (!isset($_GET['trans_no']))
+if (!isset($_GET['trans_no']))
{
die ("<br>" . _("This page must be called with a purchase order number to review."));
}
$total = $k = 0;
$overdue_items = false;
-foreach ($purchase_order->line_items as $stock_item)
+foreach ($purchase_order->line_items as $stock_item)
{
$line_total = $stock_item->quantity * $stock_item->price;
{
start_row("class='overduebg'");
$overdue_items = true;
- }
- else
+ }
+ else
{
alt_table_row_color($k);
}
label_cell($stock_item->stock_id);
label_cell($stock_item->item_description);
- qty_cell($stock_item->quantity);
+ $dec = get_qty_dec($stock_item->stock_id);
+ qty_cell($stock_item->quantity, false, $dec);
label_cell($stock_item->units);
amount_cell($stock_item->price);
amount_cell($line_total);
label_cell($stock_item->req_del_date);
- qty_cell($stock_item->qty_received);
- qty_cell($stock_item->qty_inv);
+ qty_cell($stock_item->qty_received, false, $dec);
+ qty_cell($stock_item->qty_inv, false, $dec);
end_row();
$total += $line_total;
$backorder = $_POST['PARAM_4'];
$comments = $_POST['PARAM_5'];
- $dec = user_qty_dec();
-
if ($category == reserved_words::get_all_numeric())
$category = 0;
if ($location == reserved_words::get_all())
}
$rep->TextCol(0, 1, $myrow['stk_code']);
$rep->TextCol(1, 2, $myrow['description']);
+ $dec = get_qty_dec($myrow['stk_code']);
$rep->TextCol(2, 3, number_format2($myrow['quantity'], $dec));
$rep->TextCol(3, 4, number_format2($myrow['qty_sent'], $dec));
$rep->TextCol(4, 5, number_format2($myrow['quantity'] - $myrow['qty_sent'], $dec));
$SubTotal = 0;
while ($myrow2=db_fetch($result))
{
- $Net = round($sign * ((1 - $myrow2["discount_percent"]) * $myrow2["unit_price"] * $myrow2["quantity"]),
- user_price_dec());
- $SubTotal += $Net;
+ $Net = round($sign * ((1 - $myrow2["discount_percent"]) * $myrow2["unit_price"] * $myrow2["quantity"]),
+ user_price_dec());
+ $SubTotal += $Net;
$DisplayPrice = number_format2($myrow2["unit_price"],$dec);
- $DisplayQty = number_format2($sign*$myrow2["quantity"],user_qty_dec());
+ $DisplayQty = number_format2($sign*$myrow2["quantity"],get_qty_dec($myrow2['stock_id']));
$DisplayNet = number_format2($Net,$dec);
if ($myrow2["discount_percent"]==0)
$DisplayDiscount ="";
while ($tax_item = db_fetch($tax_items))
{
$DisplayTax = number_format2($sign*$tax_item['amount'], $dec);
-
+
if ($tax_item['included_in_price'])
{
$rep->TextCol(3, 7, $doc_Included . " " . $tax_item['tax_type_name'] .
function getTransactions($debtorno, $date)
{
- $sql = "SELECT ".TB_PREF."debtor_trans.*, ".TB_PREF."sys_types.type_name,
+ $sql = "SELECT ".TB_PREF."debtor_trans.*, ".TB_PREF."sys_types.type_name,
(".TB_PREF."debtor_trans.ov_amount + ".TB_PREF."debtor_trans.ov_gst + ".TB_PREF."debtor_trans.ov_freight + ".TB_PREF."debtor_trans.ov_discount)
AS TotalAmount, ".TB_PREF."debtor_trans.alloc AS Allocated,
((".TB_PREF."debtor_trans.type = 10)
FROM ".TB_PREF."debtor_trans, ".TB_PREF."sys_types
WHERE ".TB_PREF."debtor_trans.tran_date <= '$date' AND ".TB_PREF."debtor_trans.debtor_no = '$debtorno'
AND ".TB_PREF."debtor_trans.type = ".TB_PREF."sys_types.type_id
+ AND ".TB_PREF."debtor_trans.type <> 13
ORDER BY ".TB_PREF."debtor_trans.tran_date";
return db_query($sql,"No transactions were returned");
function print_statements()
{
global $path_to_root;
-
+
include_once($path_to_root . "reporting/includes/pdf_report.inc");
-
+
$customer = $_POST['PARAM_0'];
$currency = $_POST['PARAM_1'];
$bankaccount = $_POST['PARAM_2'];
- $email = $_POST['PARAM_3'];
+ $email = $_POST['PARAM_3'];
$comments = $_POST['PARAM_4'];
$dec = user_price_dec();
-
+
$cols = array(4, 100, 130, 190, 250, 320, 385, 450, 515);
-
+
//$headers in doctext.inc
$aligns = array('left', 'left', 'left', 'left', 'right', 'right', 'right', 'right');
-
+
$params = array('comments' => $comments,
'bankaccount' => $bankaccount);
-
+
$baccount = get_bank_account($params['bankaccount']);
$cur = get_company_pref('curr_default');
$PastDueDays1 = get_company_pref('past_due_days');
$PastDueDays2 = 2 * $PastDueDays1;
-
+
if ($email == 0)
{
$rep = new FrontReport(_('STATEMENT'), "StatementBulk.pdf", user_pagesize());
$rep->Font();
$rep->Info($params, $cols, null, $aligns);
}
-
+
$sql = "SELECT debtor_no, name AS DebtorName, address, tax_id, email, curr_code, curdate() AS tran_date, payment_terms FROM ".TB_PREF."debtors_master";
if ($customer != reserved_words::get_all_numeric())
$sql .= " WHERE debtor_no = $customer";
else
$sql .= " ORDER by name";
$result = db_query($sql, "The customers could not be retrieved");
-
- while ($myrow=db_fetch($result))
+
+ while ($myrow=db_fetch($result))
{
$date = date('Y-m-d');
-
+
$myrow['order_'] = "";
-
+
$TransResult = getTransactions($myrow['debtor_no'], $date);
if (db_num_rows($TransResult) == 0)
continue;
$doctype = 12;
if ($rep->currency != $myrow['curr_code'])
{
- include($path_to_root . "reporting/includes/doctext2.inc");
- }
+ include($path_to_root . "reporting/includes/doctext2.inc");
+ }
else
{
- include($path_to_root . "reporting/includes/doctext.inc");
- }
+ include($path_to_root . "reporting/includes/doctext.inc");
+ }
$rep->fontSize += 2;
$rep->TextCol(0, 8, $doc_Outstanding);
$rep->fontSize -= 2;
$rep->NewLine(2);
- while ($myrow2=db_fetch($TransResult))
+ while ($myrow2=db_fetch($TransResult))
{
$DisplayTotal = number_format2(Abs($myrow2["TotalAmount"]),$dec);
$DisplayAlloc = number_format2($myrow2["Allocated"],$dec);
- if ($myrow2['type'] == 10)
- $DisplayNet = number_format2($myrow2["TotalAmount"] - $myrow2["Allocated"],$dec);
- else
- $DisplayNet = number_format2($myrow2["TotalAmount"] + $myrow2["Allocated"],$dec);
+ $DisplayNet = number_format2($myrow2["TotalAmount"] - $myrow2["Allocated"],$dec);
$rep->TextCol(0, 1, $myrow2['type_name'], -2);
$rep->TextCol(1, 2, $myrow2['reference'], -2);
$rep->TextCol(2, 3, sql2date($myrow2['tran_date']), -2);
- if ($myrow2['type'] == 10)
+ if ($myrow2['type'] == 10)
$rep->TextCol(3, 4, sql2date($myrow2['due_date']), -2);
- if ($myrow2['TotalAmount'] > 0.0)
+ if ($myrow2['type'] == 10)
$rep->TextCol(4, 5, $DisplayTotal, -2);
- else
+ else
$rep->TextCol(5, 6, $DisplayTotal, -2);
$rep->TextCol(6, 7, $DisplayAlloc, -2);
$rep->TextCol(7, 8, $DisplayNet, -2);
- $rep->NewLine();
- if ($rep->row < $rep->bottomMargin + (10 * $rep->lineHeight))
+ $rep->NewLine();
+ if ($rep->row < $rep->bottomMargin + (10 * $rep->lineHeight))
$rep->Header2($myrow, null, null, $baccount);
}
$nowdue = "1-" . $PastDueDays1 . " " . $doc_Days;
number_format2($CustomerRecord["Overdue2"],$dec),
number_format2($CustomerRecord["Balance"],$dec));
$col = array($rep->cols[0], $rep->cols[0] + 110, $rep->cols[0] + 210, $rep->cols[0] + 310,
- $rep->cols[0] + 410, $rep->cols[0] + 510);
+ $rep->cols[0] + 410, $rep->cols[0] + 510);
$rep->row = $rep->bottomMargin + (8 * $rep->lineHeight);
for ($i = 0; $i < 5; $i++)
$rep->TextWrap($col[$i], $rep->row, $col[$i + 1] - $col[$i], $str[$i], 'right');
- $rep->NewLine();
+ $rep->NewLine();
for ($i = 0; $i < 5; $i++)
$rep->TextWrap($col[$i], $rep->row, $col[$i + 1] - $col[$i], $str2[$i], 'right');
if ($email == 1)
$rep->End($email, $doc_Statement . " " . $doc_as_of . " " . sql2date($date), $myrow, 12);
-
- }
+
+ }
if ($email == 0)
$rep->End();
}
function print_sales_orders()
{
global $path_to_root, $print_as_quote;
-
+
include_once($path_to_root . "reporting/includes/pdf_report.inc");
-
+
$from = $_POST['PARAM_0'];
$to = $_POST['PARAM_1'];
$currency = $_POST['PARAM_2'];
$bankaccount = $_POST['PARAM_3'];
- $email = $_POST['PARAM_4'];
- $print_as_quote = $_POST['PARAM_5'];
+ $email = $_POST['PARAM_4'];
+ $print_as_quote = $_POST['PARAM_5'];
$comments = $_POST['PARAM_6'];
if ($from == null)
if ($to == null)
$to = 0;
$dec = user_price_dec();
-
+
$cols = array(4, 60, 225, 300, 325, 385, 450, 515);
- // $headers in doctext.inc
+ // $headers in doctext.inc
$aligns = array('left', 'left', 'right', 'left', 'right', 'right', 'right');
-
+
$params = array('comments' => $comments,
'bankaccount' => $bankaccount);
-
+
$baccount = get_bank_account($params['bankaccount']);
$cur = get_company_Pref('curr_default');
-
+
if ($email == 0)
{
if ($print_as_quote == 1)
$rep = new FrontReport(_("QUOTE"), "QuoteBulk.pdf", user_pagesize());
- else
+ else
$rep = new FrontReport(_("SALES ORDER"), "SalesOrderBulk.pdf", user_pagesize());
$rep->currency = $cur;
$rep->Font();
{
$rep->title = _("SALES ORDER");
$rep->filename = "SalesOrder" . $i . ".pdf";
- }
+ }
$rep->Info($params, $cols, null, $aligns);
}
else
$SubTotal = 0;
while ($myrow2=db_fetch($result))
{
- $Net = round(((1 - $myrow2["discount_percent"]) * $myrow2["unit_price"] * $myrow2["quantity"]),
+ $Net = round(((1 - $myrow2["discount_percent"]) * $myrow2["unit_price"] * $myrow2["quantity"]),
user_price_dec());
$SubTotal += $Net;
$DisplayPrice = number_format2($myrow2["unit_price"],$dec);
- $DisplayQty = number_format2($myrow2["quantity"],user_qty_dec());
+ $DisplayQty = number_format2($myrow2["quantity"],get_qty_dec($myrow2['stk_code']));
$DisplayNet = number_format2($Net,$dec);
if ($myrow2["discount_percent"]==0)
$DisplayDiscount ="";
- else
+ else
$DisplayDiscount = number_format2($myrow2["discount_percent"]*100,user_percent_dec()) . "%";
$rep->TextCol(0, 1, $myrow2['stk_code'], -2);
$rep->TextCol(1, 2, $myrow2['description'], -2);
$rep->TextCol(5, 6, $DisplayDiscount, -2);
$rep->TextCol(6, 7, $DisplayNet, -2);
$rep->NewLine(1);
- if ($rep->row < $rep->bottomMargin + (15 * $rep->lineHeight))
+ if ($rep->row < $rep->bottomMargin + (15 * $rep->lineHeight))
$rep->Header2($myrow, $branch, $sales_order, $baccount);
}
if ($myrow['comments'] != "")
{
$rep->NewLine();
$rep->TextColLines(1, 5, $myrow['comments'], -2);
- }
+ }
$DisplaySubTot = number_format2($SubTotal,$dec);
$DisplayFreight = number_format2($myrow["freight_cost"],$dec);
$doctype = 9;
if ($rep->currency != $myrow['curr_code'])
{
- include($path_to_root . "reporting/includes/doctext2.inc");
- }
+ include($path_to_root . "reporting/includes/doctext2.inc");
+ }
else
{
- include($path_to_root . "reporting/includes/doctext.inc");
- }
+ include($path_to_root . "reporting/includes/doctext.inc");
+ }
$rep->TextCol(3, 6, $doc_Sub_total, -2);
$rep->TextCol(6, 7, $DisplaySubTot, -2);
$rep->TextCol(6, 7, $DisplayFreight, -2);
$rep->NewLine();
$DisplayTotal = number_format2($myrow["freight_cost"] + $SubTotal, $dec);
- $rep->Font('bold');
+ $rep->Font('bold');
$rep->TextCol(3, 6, $doc_TOTAL_ORDER, - 2);
$rep->TextCol(6, 7, $DisplayTotal, -2);
- $rep->Font();
+ $rep->Font();
if ($email == 1)
{
if ($myrow['contact_email'] == '')
$myrow['DebtorName'] = $branch['br_name'];
}
$rep->End($email, $doc_Invoice_no . " " . $myrow['reference'], $myrow);
- }
+ }
}
if ($email == 0)
$rep->End();
function print_deliveries()
{
global $path_to_root;
-
+
include_once($path_to_root . "reporting/includes/pdf_report.inc");
-
+
$from = $_POST['PARAM_0'];
$to = $_POST['PARAM_1'];
- $email = $_POST['PARAM_2'];
+ $email = $_POST['PARAM_2'];
$comments = $_POST['PARAM_3'];
if ($from == null)
if ($to == null)
$to = 0;
$dec = user_price_dec();
-
+
$fno = explode("-", $from);
$tno = explode("-", $to);
$cols = array(4, 60, 225, 300, 325, 385, 450, 515);
- // $headers in doctext.inc
+ // $headers in doctext.inc
$aligns = array('left', 'left', 'right', 'left', 'right', 'right', 'right');
-
+
$params = array('comments' => $comments);
-
+
$cur = get_company_Pref('curr_default');
-
+
if ($email == 0)
{
$rep = new FrontReport(_('DELIVERY'), "DeliveryNoteBulk.pdf", user_pagesize());
else
$rep->title = _('DELIVERY NOTE');
$rep->Header2($myrow, $branch, $sales_order, '', 13);
-
+
$result = get_customer_trans_details(13, $i);
$SubTotal = 0;
while ($myrow2=db_fetch($result))
{
- $Net = round(((1 - $myrow2["discount_percent"]) * $myrow2["unit_price"] * $myrow2["quantity"]),
+ $Net = round(((1 - $myrow2["discount_percent"]) * $myrow2["unit_price"] * $myrow2["quantity"]),
user_price_dec());
$SubTotal += $Net;
$DisplayPrice = number_format2($myrow2["unit_price"],$dec);
- $DisplayQty = number_format2($myrow2["quantity"],user_qty_dec());
+ $DisplayQty = number_format2($myrow2["quantity"],get_qty_dec($myrow2['stock_id']));
$DisplayNet = number_format2($Net,$dec);
if ($myrow2["discount_percent"]==0)
$DisplayDiscount ="";
- else
+ else
$DisplayDiscount = number_format2($myrow2["discount_percent"]*100,user_percent_dec()) . "%";
$rep->TextCol(0, 1, $myrow2['stock_id'], -2);
$rep->TextCol(1, 2, $myrow2['StockDescription'], -2);
$rep->TextCol(5, 6, $DisplayDiscount, -2);
$rep->TextCol(6, 7, $DisplayNet, -2);
$rep->NewLine(1);
- if ($rep->row < $rep->bottomMargin + (15 * $rep->lineHeight))
+ if ($rep->row < $rep->bottomMargin + (15 * $rep->lineHeight))
$rep->Header2($myrow, $branch, $sales_order,'',13);
}
-
+
$comments = get_comments(13, $i);
if ($comments && db_num_rows($comments))
- {
+ {
$rep->NewLine();
- while ($comment=db_fetch($comments))
+ while ($comment=db_fetch($comments))
$rep->TextColLines(0, 6, $comment['memo_'], -2);
- }
-
+ }
+
$DisplaySubTot = number_format2($SubTotal,$dec);
$DisplayFreight = number_format2($myrow["ov_freight"],$dec);
$doctype=13;
if ($rep->currency != $myrow['curr_code'])
{
- include($path_to_root . "reporting/includes/doctext2.inc");
- }
+ include($path_to_root . "reporting/includes/doctext2.inc");
+ }
else
{
- include($path_to_root . "reporting/includes/doctext.inc");
- }
-
+ include($path_to_root . "reporting/includes/doctext.inc");
+ }
+
$rep->TextCol(3, 6, $doc_Sub_total, -2);
$rep->TextCol(6, 7, $DisplaySubTot, -2);
$rep->NewLine();
$rep->TextCol(6, 7, $DisplayFreight, -2);
$rep->NewLine();
$tax_items = get_customer_trans_tax_details(13, $i);
- while ($tax_item = db_fetch($tax_items))
+ while ($tax_item = db_fetch($tax_items))
{
$DisplayTax = number_format2($tax_item['amount'], $dec);
if ($tax_item['included_in_price'])
{
- $rep->TextCol(3, 7, $doc_Included . " " . $tax_item['tax_type_name'] .
+ $rep->TextCol(3, 7, $doc_Included . " " . $tax_item['tax_type_name'] .
" (" . $tax_item['rate'] . "%) " . $doc_Amount . ":" . $DisplayTax, -2);
- }
+ }
else
{
- $rep->TextCol(3, 6, $tax_item['tax_type_name'] . " (" .
+ $rep->TextCol(3, 6, $tax_item['tax_type_name'] . " (" .
$tax_item['rate'] . "%)", -2);
$rep->TextCol(6, 7, $DisplayTax, -2);
- }
+ }
$rep->NewLine();
}
$rep->NewLine();
$DisplayTotal = number_format2($myrow["ov_freight"] +$myrow["ov_freight_tax"] + $myrow["ov_gst"] +
$myrow["ov_amount"],$dec);
- $rep->Font('bold');
- $rep->TextCol(3, 6, $doc_TOTAL_DELIVERY, - 2);
+ $rep->Font('bold');
+ $rep->TextCol(3, 6, $doc_TOTAL_DELIVERY, - 2);
$rep->TextCol(6, 7, $DisplayTotal, -2);
- $rep->Font();
+ $rep->Font();
if ($email == 1)
{
$myrow['dimension_id'] = $paylink; // helper for pmt link
$myrow['DebtorName'] = $branch['br_name'];
}
$rep->End($email, $doc_Delivery_no . " " . $myrow['reference'], $myrow, 13);
- }
+ }
}
if ($email == 0)
$rep->End();
AND qty_recd-quantity_inv <>0 ";
if ($fromsupp != reserved_words::get_all_numeric())
$sql .= "AND ".TB_PREF."grn_batch.supplier_id ='" . $fromsupp . "' ";
- $sql .= "ORDER BY ".TB_PREF."grn_batch.supplier_id,
+ $sql .= "ORDER BY ".TB_PREF."grn_batch.supplier_id,
".TB_PREF."grn_batch.id";
return db_query($sql, "No transactions were returned");
$fromsupp = $_POST['PARAM_0'];
$comments = $_POST['PARAM_1'];
-
+
if ($fromsupp == reserved_words::get_all_numeric())
$from = _('All');
else
$Supplier = '';
$SuppTot_Val=0;
$res = getTransactions($fromsupp);
-
+
While ($GRNs = db_fetch($res))
- {
+ {
+ $dec2 = get_qty_dec($GRNs['item_code']);
if ($Supplier != $GRNs['supplier_id'])
{
if ($Supplier != '')
$rep->TextCol(0, 1, $GRNs['id']);
$rep->TextCol(1, 2, $GRNs['order_no']);
$rep->TextCol(2, 3, $GRNs['item_code'] . '-' . $GRNs['description']);
- $rep->TextCol(3, 4, number_format2($GRNs['qty_recd'], $dec));
- $rep->TextCol(4, 5, number_format2($GRNs['quantity_inv'], $dec));
+ $rep->TextCol(3, 4, number_format2($GRNs['qty_recd'], $dec2));
+ $rep->TextCol(4, 5, number_format2($GRNs['quantity_inv'], $dec2));
$QtyOstg = $GRNs['qty_recd'] - $GRNs['quantity_inv'];
$Value = ($GRNs['qty_recd'] - $GRNs['quantity_inv']) * $GRNs['std_cost_unit'];
- $rep->TextCol(5, 6, number_format2($QtyOstg, $dec));
+ $rep->TextCol(5, 6, number_format2($QtyOstg, $dec2));
$rep->TextCol(6, 7, number_format2($GRNs['std_cost_unit'], $dec));
$rep->TextCol(7, 8, number_format2($Value, $dec));
$Tot_Val += $Value;
//----------------------------------------------------------------------------------------------------
function get_po($order_no)
{
- $sql = "SELECT ".TB_PREF."purch_orders.*, ".TB_PREF."suppliers.supp_name,
+ $sql = "SELECT ".TB_PREF."purch_orders.*, ".TB_PREF."suppliers.supp_name,
".TB_PREF."suppliers.curr_code, ".TB_PREF."suppliers.payment_terms, ".TB_PREF."locations.location_name,
- ".TB_PREF."suppliers.email, ".TB_PREF."suppliers.address
- FROM ".TB_PREF."purch_orders, ".TB_PREF."suppliers, ".TB_PREF."locations
+ ".TB_PREF."suppliers.email, ".TB_PREF."suppliers.address
+ FROM ".TB_PREF."purch_orders, ".TB_PREF."suppliers, ".TB_PREF."locations
WHERE ".TB_PREF."purch_orders.supplier_id = ".TB_PREF."suppliers.supplier_id
- AND ".TB_PREF."locations.loc_code = into_stock_location
+ AND ".TB_PREF."locations.loc_code = into_stock_location
AND ".TB_PREF."purch_orders.order_no = " . $order_no;
$result = db_query($sql, "The order cannot be retrieved");
return db_fetch($result);
function get_po_details($order_no)
{
- $sql = "SELECT ".TB_PREF."purch_order_details.*, units
- FROM ".TB_PREF."purch_order_details
- LEFT JOIN ".TB_PREF."stock_master
- ON ".TB_PREF."purch_order_details.item_code=".TB_PREF."stock_master.stock_id
+ $sql = "SELECT ".TB_PREF."purch_order_details.*, units
+ FROM ".TB_PREF."purch_order_details
+ LEFT JOIN ".TB_PREF."stock_master
+ ON ".TB_PREF."purch_order_details.item_code=".TB_PREF."stock_master.stock_id
WHERE order_no =$order_no ";
$sql .= " ORDER BY po_detail_item";
return db_query($sql, "Retreive order Line Items");
function print_po()
{
global $path_to_root;
-
+
include_once($path_to_root . "reporting/includes/pdf_report.inc");
-
+
$from = $_POST['PARAM_0'];
$to = $_POST['PARAM_1'];
$currency = $_POST['PARAM_2'];
$bankaccount = $_POST['PARAM_3'];
- $email = $_POST['PARAM_4'];
+ $email = $_POST['PARAM_4'];
$comments = $_POST['PARAM_5'];
if ($from == null)
if ($to == null)
$to = 0;
$dec = user_price_dec();
-
- $cols = array(4, 60, 225, 300, 325, 385, 450, 515);
- // $headers in doctext.inc
- $aligns = array('left', 'left', 'left', 'left', 'right', 'right', 'right');
-
+ $cols = array(4, 60, 225, 300, 340, 385, 450, 515);
+
+ // $headers in doctext.inc
+ $aligns = array('left', 'left', 'left', 'right', 'left', 'right', 'right');
+
$params = array('comments' => $comments,
'bankaccount' => $bankaccount);
-
+
$baccount = get_bank_account($params['bankaccount']);
$cur = get_company_Pref('curr_default');
-
+
if ($email == 0)
{
$rep = new FrontReport(_('PURCHASE ORDER'), "PurchaseOrderBulk.pdf", user_pagesize());
user_price_dec());
$SubTotal += $Net;
$DisplayPrice = number_format2($myrow2["unit_price"],$dec);
- $DisplayQty = number_format2($myrow2["quantity_ordered"],user_qty_dec());
+ $DisplayQty = number_format2($myrow2["quantity_ordered"],get_qty_dec($myrow2['item_code']));
$DisplayNet = number_format2($Net,$dec);
//$rep->TextCol(0, 1, $myrow2['item_code'], -2);
$rep->TextCol(0, 2, $myrow2['description'], -2);
$rep->TextCol(5, 6, $DisplayPrice, -2);
$rep->TextCol(6, 7, $DisplayNet, -2);
$rep->NewLine(1);
- if ($rep->row < $rep->bottomMargin + (15 * $rep->lineHeight))
+ if ($rep->row < $rep->bottomMargin + (15 * $rep->lineHeight))
$rep->Header2($myrow, $branch, $sales_order, $baccount);
}
if ($myrow['comments'] != "")
{
$rep->NewLine();
$rep->TextColLines(1, 5, $myrow['comments'], -2);
- }
+ }
$DisplaySubTot = number_format2($SubTotal,$dec);
$rep->row = $rep->bottomMargin + (15 * $rep->lineHeight);
$doctype = 8;
if ($rep->currency != $myrow['curr_code'])
{
- include($path_to_root . "reporting/includes/doctext2.inc");
- }
+ include($path_to_root . "reporting/includes/doctext2.inc");
+ }
else
{
- include($path_to_root . "reporting/includes/doctext.inc");
- }
+ include($path_to_root . "reporting/includes/doctext.inc");
+ }
$rep->TextCol(3, 6, $doc_Sub_total, -2);
$rep->TextCol(6, 7, $DisplaySubTot, -2);
$rep->NewLine();
$DisplayTotal = number_format2($SubTotal, $dec);
- $rep->Font('bold');
+ $rep->Font('bold');
$rep->TextCol(3, 6, $doc_TOTAL_PO, - 2);
$rep->TextCol(6, 7, $DisplayTotal, -2);
- $rep->Font();
+ $rep->Font();
if ($email == 1)
{
$myrow['contact_email'] = $myrow['email'];
$myrow['DebtorName'] = $myrow['supp_name'];
$myrow['reference'] = $myrow['order_no'];
$rep->End($email, $doc_Order_no . " " . $myrow['reference'], $myrow);
- }
+ }
}
if ($email == 0)
$rep->End();
$location = $_POST['PARAM_1'];
$detail = $_POST['PARAM_2'];
$comments = $_POST['PARAM_3'];
-
+
$dec = user_price_dec();
if ($category == reserved_words::get_all_numeric())
$rep->Header();
$res = getTransactions($category, $location);
- $total = $grandtotal = 0.0;
+ $total = $grandtotal = 0.0;
$catt = '';
while ($trans=db_fetch($res))
{
{
$rep->NewLine(2, 3);
$rep->TextCol(0, 4, _('Total'));
- }
+ }
$rep->Textcol(4, 5, number_format2($total, $dec));
if ($detail)
{
$rep->Line($rep->row - 2);
$rep->NewLine();
- }
+ }
$rep->NewLine();
$total = 0.0;
}
$rep->fontsize -= 2;
$rep->TextCol(0, 1, $trans['stock_id']);
$rep->TextCol(1, 2, $trans['description']);
- $rep->TextCol(2, 3, number_format2($trans['QtyOnHand'], user_qty_dec()));
+ $rep->TextCol(2, 3, number_format2($trans['QtyOnHand'], get_qty_dec($trans['stock_id'])));
$rep->TextCol(3, 4, number_format2($trans['UnitCost'], $dec));
$rep->TextCol(4, 5, number_format2($trans['ItemTotal'], $dec));
$rep->fontsize += 2;
{
$rep->NewLine(2, 3);
$rep->TextCol(0, 4, _('Total'));
- }
+ }
$rep->Textcol(4, 5, number_format2($total, $dec));
if ($detail)
{
$location = $_POST['PARAM_1'];
$comments = $_POST['PARAM_2'];
- $dec = user_qty_dec();
-
if ($category == reserved_words::get_all_numeric())
$category = 0;
if ($category == 0)
$suppqty = getSuppQty($trans['stock_id'], $trans['loc_code']);
$period = getPeriods($trans['stock_id'], $trans['loc_code']);
$rep->NewLine();
+ $dec = get_qty_dec($trans['stock_id']);
$rep->TextCol(0, 1, $trans['stock_id']);
$rep->TextCol(1, 2, $trans['description']);
$rep->TextCol(2, 3, number_format2($period['prd0'], $dec));
$pictures = $_POST['PARAM_2'];
$comments = $_POST['PARAM_3'];
- $dec = user_qty_dec();
-
if ($category == reserved_words::get_all_numeric())
$category = 0;
if ($category == 0)
$demandqty = getDemandQty($trans['stock_id'], $trans['loc_code']);
$demandqty += getDemandAsmQty($trans['stock_id'], $trans['loc_code']);
$rep->NewLine();
+ $dec = get_qty_dec($trans['stock_id']);
$rep->TextCol(0, 1, $trans['stock_id']);
$rep->TextCol(1, 2, $trans['description']);
$rep->TextCol(2, 3, number_format2($trans['QtyOnHand'], $dec));
$frompart = $_POST['PARAM_0'];
$topart = $_POST['PARAM_1'];
$comments = $_POST['PARAM_2'];
-
- $dec = user_qty_dec();
$cols = array(0, 50, 305, 375, 445, 515);
$parent = $trans['parent'];
$rep->NewLine();
}
-
+
$rep->NewLine();
+ $dec = get_qty_dec($trans['component']);
$rep->TextCol(0, 1, $trans['component']);
$rep->TextCol(1, 2, $trans['CompDescription']);
- $rep->TextCol(2, 3, $trans['loc_code']);
- $rep->TextCol(3, 4, $trans['workcentre_added']);
+ //$rep->TextCol(2, 3, $trans['loc_code']);
+ //$rep->TextCol(3, 4, $trans['workcentre_added']);
+ $wc = get_work_centre($trans['workcentre_added']);
+ $rep->TextCol(2, 3, get_location_name($trans['loc_code']));
+ $rep->TextCol(3, 4, $wc['name']);
$rep->TextCol(4, 5, number_format2($trans['quantity'], $dec));
}
$rep->Line($rep->row - 4);
foreach ($_SESSION['Items']->line_items as $line_no=>$itm) {
if (isset($_POST['Line'.$line_no])) {
if (check_num('Line'.$line_no, ($itm->quantity - $itm->qty_done))) {
- $_SESSION['Items']->line_items[$line_no]->qty_dispatched =
+ $_SESSION['Items']->line_items[$line_no]->qty_dispatched =
input_num('Line'.$line_no);
}
}
text_cells(null, 'Line'.$line_no.'Desc', $ln_itm->item_description, 30, 50);
- qty_cell($ln_itm->quantity);
+ qty_cell($ln_itm->quantity, false, get_qty_dec($ln_itm->stock_id));
label_cell($ln_itm->units);
- amount_cells(null, 'Line'.$line_no, qty_format($ln_itm->qty_dispatched));
+ amount_cells(null, 'Line'.$line_no, qty_format($ln_itm->qty_dispatched, $ln_itm->stock_id));
$line_total =($ln_itm->qty_dispatched * $ln_itm->price * (1 - $ln_itm->discount_percent));
foreach ($_SESSION['Items']->line_items as $line=>$itm) {
if (isset($_POST['Line'.$line])) {
if (!check_num('Line'.$line, $itm->qty_done, $itm->quantity) == 0) {
- $_SESSION['Items']->line_items[$line]->qty_dispatched =
+ $_SESSION['Items']->line_items[$line]->qty_dispatched =
input_num('Line'.$line);
} else {
$ok = 0;
view_stock_status_cell($ln_itm->stock_id);
text_cells(null, 'Line'.$line.'Desc', $ln_itm->item_description, 30, 50);
- qty_cell($ln_itm->quantity);
+ $dec = get_qty_dec($ln_itm->stock_id);
+ qty_cell($ln_itm->quantity, false, $dec);
label_cell($ln_itm->units);
- qty_cell($ln_itm->qty_done);
+ qty_cell($ln_itm->qty_done, false, $dec);
- small_qty_cells(null, 'Line'.$line, qty_format($ln_itm->qty_dispatched));
+ small_qty_cells(null, 'Line'.$line, qty_format($ln_itm->qty_dispatched, $ln_itm->stock_id, $dec), null, null, $dec);
$display_discount_percent = percent_format($ln_itm->discount_percent*100) . "%";
view_stock_status_cell($ln_itm->stock_id);
text_cells(null, 'Line'.$line.'Desc', $ln_itm->item_description, 30, 50);
- qty_cell($ln_itm->quantity);
+ $dec = get_qty_dec($ln_itm->stock_id);
+ qty_cell($ln_itm->quantity, false, $dec);
label_cell($ln_itm->units);
- qty_cell($ln_itm->qty_done);
+ qty_cell($ln_itm->qty_done, false, $dec);
if ($is_batch_invoice) {
// for batch invoices we can only remove whole deliveries
echo '<td nowrap align=right>';
hidden('Line' . $line, $ln_itm->qty_dispatched );
- echo qty_format($ln_itm->qty_dispatched).'</td>';
+ echo number_format2($ln_itm->qty_dispatched, $dec).'</td>';
} else {
- small_qty_cells(null, 'Line'.$line, qty_format($ln_itm->qty_dispatched));
+ small_qty_cells(null, 'Line'.$line, qty_format($ln_itm->qty_dispatched, $ln_itm->stock_id, $dec), null, null, $dec);
}
$display_discount_percent = percent_format($ln_itm->discount_percent*100) . " %";
ref_row(_("Reference").':', 'ref');
else
label_row(_("Reference").':', $_POST['ref'] );
-
+
echo "</table>";
label_cell("<a target='_blank' href='$path_to_root/inventory/inquiry/stock_status.php?" . SID . "stock_id=" . $line->stock_id . "'>$line->stock_id</a>");
label_cell($line->item_description, "nowrap");
- qty_cell($line->qty_dispatched);
+ qty_cell($line->qty_dispatched, false, get_qty_dec($line->stock_id));
label_cell($line->units);
amount_cell($line->price);
{
$_POST['stock_id'] = $order->line_items[$id]->stock_id;
- $_POST['qty'] = qty_format($order->line_items[$id]->qty_dispatched);
+ $_POST['qty'] = qty_format($order->line_items[$id]->qty_dispatched, $_POST['stock_id'], $dec);
$_POST['price'] = price_format($order->line_items[$id]->price);
$_POST['Disc'] = percent_format(($order->line_items[$id]->discount_percent)*100);
$_POST['units'] = $order->line_items[$id]->units;
$_POST['units'] = $item_info["units"];
- $_POST['qty'] = qty_format(0);
+ $_POST['qty'] = qty_format(0, $_POST['stock_id'], $dec);
$_POST['price'] = price_format(get_price($_POST['stock_id'], $order->customer_currency,
$order->sales_type, $order->price_factor, $order->document_date));
}
- qty_cells(null, 'qty', $_POST['qty']);
+ qty_cells(null, 'qty', $_POST['qty'], null, null, $dec);
// if ($order->trans_no!=0) {
// amount_cell($line_no==-1 ? 0 :$order->line_items[$line_no]->qty_done);
// }
if (db_num_rows($result) == 0)
{
return _("The selected customer and branch are not valid, or the customer does not have any branches.");
- }
+ }
$myrow = db_fetch($result);
view_stock_status_cell($stock_item->stock_id);
label_cell($stock_item->item_description, "nowrap" );
- qty_cell($stock_item->qty_dispatched);
+ qty_cell($stock_item->qty_dispatched, false, get_qty_dec($stock_item->stock_id));
if ($order->trans_no!=0)
amount_cell($stock_item->qty_done);
{
sales_order_item_controls($order, $k, $line_no);
}
-
+
$total += $line_total;
}
$_POST['branch_id'] = '';
$Ajax->activate('branch_id');
}
- customer_branches_list_row(_("Branch:"),
+ customer_branches_list_row(_("Branch:"),
$_POST['customer_id'], 'branch_id', null, false, true, true);
if (!isset($_POST['branch_id']) || $_POST['branch_id'] == "")
if ($line_no!=-1 && $line_no == $id)
{
$_POST['stock_id'] = $order->line_items[$id]->stock_id;
- $_POST['qty'] = qty_format($order->line_items[$id]->qty_dispatched);
+ $_POST['qty'] = qty_format($order->line_items[$id]->qty_dispatched, $_POST['stock_id']);
$_POST['price'] = price_format($order->line_items[$id]->price);
$_POST['Disc'] = percent_format($order->line_items[$id]->discount_percent*100);
$units = $order->line_items[$id]->units;
$item_info = get_item_edit_info($_POST['stock_id']);
$units = $item_info["units"];
- $_POST['qty'] = qty_format(1);
+ $_POST['qty'] = qty_format(1, $_POST['stock_id']);
$_POST['price'] = price_format(get_price ($_POST['stock_id'],
- $order->customer_currency, $order->sales_type,
+ $order->customer_currency, $order->sales_type,
$order->price_factor, $order->document_date));
// default to the customer's discount %
$_POST['Disc'] = percent_format($order->default_discount * 100);
}
- qty_cells(null, 'qty', qty_format($_POST['qty']));
+ qty_cells(null, 'qty', qty_format($_POST['qty'], $_POST['stock_id'], $dec), null, null, $dec);
if ($order->trans_no!=0) {
amount_cell($line_no==-1 ? 0 :$order->line_items[$line_no]->qty_done);
label_cell($units, '', 'units');
$str = amount_cells(null, 'price');
-
+
small_amount_cells(null, 'Disc', percent_format($_POST['Disc']), null, null, user_percent_dec());
$line_total = $_POST['qty'] * $_POST['price'] * (1 - $_POST['Disc'] / 100);
}
else
{
- submit_cells('AddItem', _("Add Item"), "colspan=2",
+ submit_cells('AddItem', _("Add Item"), "colspan=2",
_('Add new item to document'), true);
}
locations_list_row(_("Deliver from Location:"), 'Location', $order->Location);
- date_row($delname, 'delivery_date',
+ date_row($delname, 'delivery_date',
_('Enter requested day of delivery'), $order->due_date, 0, 0, 0);
text_row(_("Deliver To:"), 'deliver_to', $order->deliver_to, 40, 40,
if (isset($_GET["trans_no"]))
{
$trans_id = $_GET["trans_no"];
-}
+}
elseif (isset($_POST["trans_no"]))
{
$trans_id = $_POST["trans_no"];
{
$th = array(_("Item Code"), _("Item Description"), _("Quantity"),
_("Unit"), _("Price"), _("Discount %"), _("Total"));
- table_header($th);
+ table_header($th);
$k = 0; //row colour counter
$sub_total = 0;
alt_table_row_color($k);
- $value = round(((1 - $myrow2["discount_percent"]) * $myrow2["unit_price"] * $myrow2["quantity"]),
+ $value = round(((1 - $myrow2["discount_percent"]) * $myrow2["unit_price"] * $myrow2["quantity"]),
user_price_dec());
$sub_total += $value;
if ($myrow2["discount_percent"] == 0)
{
$display_discount = "";
- }
- else
+ }
+ else
{
$display_discount = percent_format($myrow2["discount_percent"]*100) . "%";
}
label_cell($myrow2["stock_id"]);
label_cell($myrow2["StockDescription"]);
- qty_cell($myrow2["quantity"]);
+ qty_cell($myrow2["quantity"], false, get_qty_dec($myrow2["stock_id"]));
label_cell($myrow2["units"], "align=right");
amount_cell($myrow2["unit_price"]);
label_cell($display_discount, "align=right");
amount_cell($value);
end_row();
} //end while there are line items to print out
-}
+}
else
display_note(_("There are no line items on this credit note."), 1, 2);
$voided = is_voided_display(11, $trans_id, _("This credit note has been voided."));
if (!$voided)
- display_allocations_from(payment_person_types::customer(),
+ display_allocations_from(payment_person_types::customer(),
$myrow['debtor_no'], 11, $trans_id, $credit_total);
/* end of check to see that there was an invoice record to print */
if (isset($_GET["trans_no"]))
{
$trans_id = $_GET["trans_no"];
-}
+}
elseif (isset($_POST["trans_no"]))
{
$trans_id = $_POST["trans_no"];
start_row();
label_cells(_("Reference"), $myrow["reference"], "class='tableheader2'");
label_cells(_("Currency"), $sales_order["curr_code"], "class='tableheader2'");
-label_cells(_("Our Order No"),
+label_cells(_("Our Order No"),
get_customer_trans_view_str(systypes::sales_order(),$sales_order["order_no"]), "class='tableheader2'");
end_row();
start_row();
{
$th = array(_("Item Code"), _("Item Description"), _("Quantity"),
_("Unit"), _("Price"), _("Discount %"), _("Total"));
- table_header($th);
+ table_header($th);
$k = 0; //row colour counter
$sub_total = 0;
if($myrow2['quantity']==0) continue;
alt_table_row_color($k);
- $value = round(((1 - $myrow2["discount_percent"]) * $myrow2["unit_price"] * $myrow2["quantity"]),
+ $value = round(((1 - $myrow2["discount_percent"]) * $myrow2["unit_price"] * $myrow2["quantity"]),
user_price_dec());
$sub_total += $value;
if ($myrow2["discount_percent"] == 0)
{
$display_discount = "";
- }
- else
+ }
+ else
{
$display_discount = percent_format($myrow2["discount_percent"]*100) . "%";
}
- label_cell($myrow2["stock_id"]);
- label_cell($myrow2["StockDescription"]);
- qty_cell($myrow2["quantity"]);
+ label_cell($myrow2["stock_id"]);
+ label_cell($myrow2["StockDescription"]);
+ qty_cell($myrow2["quantity"], false, get_qty_dec($myrow2["stock_id"]));
label_cell($myrow2["units"], "align=right");
amount_cell($myrow2["unit_price"]);
label_cell($display_discount, "nowrap align=right");
end_row();
} //end while there are line items to print out
-}
+}
else
display_note(_("There are no line items on this dispatch."), 1, 2);
$display_freight = price_format($myrow["ov_freight"]);
/*Print out the delivery note text entered */
-label_row(_("Sub-total"), $display_sub_tot, "colspan=6 align=right",
+label_row(_("Sub-total"), $display_sub_tot, "colspan=6 align=right",
"nowrap align=right width=15%");
label_row(_("Shipping"), $display_freight, "colspan=6 align=right", "nowrap align=right");
if (isset($_GET["trans_no"]))
{
$trans_id = $_GET["trans_no"];
-}
+}
elseif (isset($_POST["trans_no"]))
{
$trans_id = $_POST["trans_no"];
start_row();
label_cells(_("Reference"), $myrow["reference"], "class='tableheader2'");
label_cells(_("Currency"), $sales_order["curr_code"], "class='tableheader2'");
-label_cells(_("Our Order No"),
+label_cells(_("Our Order No"),
get_customer_trans_view_str(systypes::sales_order(),$sales_order["order_no"]), "class='tableheader2'");
end_row();
start_row();
{
$th = array(_("Item Code"), _("Item Description"), _("Quantity"),
_("Unit"), _("Price"), _("Discount %"), _("Total"));
- table_header($th);
+ table_header($th);
$k = 0; //row colour counter
$sub_total = 0;
if($myrow2["quantity"]==0) continue;
alt_table_row_color($k);
- $value = round(((1 - $myrow2["discount_percent"]) * $myrow2["unit_price"] * $myrow2["quantity"]),
+ $value = round(((1 - $myrow2["discount_percent"]) * $myrow2["unit_price"] * $myrow2["quantity"]),
user_price_dec());
$sub_total += $value;
if ($myrow2["discount_percent"] == 0)
{
$display_discount = "";
- }
- else
+ }
+ else
{
$display_discount = percent_format($myrow2["discount_percent"]*100) . "%";
}
label_cell($myrow2["stock_id"]);
label_cell($myrow2["StockDescription"]);
- qty_cell($myrow2["quantity"]);
+ qty_cell($myrow2["quantity"], false, get_qty_dec($myrow2["stock_id"]));
label_cell($myrow2["units"], "align=right");
amount_cell($myrow2["unit_price"]);
label_cell($display_discount, "nowrap align=right");
end_row();
} //end while there are line items to print out
-}
+}
else
display_note(_("There are no line items on this invoice."), 1, 2);
$display_freight = price_format($myrow["ov_freight"]);
/*Print out the invoice text entered */
-label_row(_("Sub-total"), $display_sub_tot, "colspan=6 align=right",
+label_row(_("Sub-total"), $display_sub_tot, "colspan=6 align=right",
"nowrap align=right width=15%");
label_row(_("Shipping"), $display_freight, "colspan=6 align=right", "nowrap align=right");
start_table("$table_style width=95%");
label_row(_("Customer Name"), $_SESSION['Items']->customer_name, "class='tableheader2'",
"colspan=3");
-start_row();
+start_row();
label_cells(_("Customer Order Ref."), $_SESSION['Items']->cust_ref, "class='tableheader2'");
label_cells(_("Deliver To Branch"), $_SESSION['Items']->deliver_to, "class='tableheader2'");
end_row();
label_cells(_("Deliver From Location"), $_SESSION['Items']->location_name, "class='tableheader2'");
end_row();
-label_row(_("Delivery Address"), nl2br($_SESSION['Items']->delivery_address),
+label_row(_("Delivery Address"), nl2br($_SESSION['Items']->delivery_address),
"class='tableheader2'", "colspan=3");
label_row(_("Telephone"), $_SESSION['Items']->phone, "class='tableheader2'", "colspan=3");
label_row(_("E-mail"), "<a href='mailto:" . $_SESSION['Items']->email . "'>" . $_SESSION['Items']->email . "</a>",
$delivery_total = 0;
$k = 0;
-while ($del_row = db_fetch($result))
+while ($del_row = db_fetch($result))
{
alt_table_row_color($k);
$invoices_total = 0;
$k = 0;
-while ($inv_row = db_fetch($result))
+while ($inv_row = db_fetch($result))
{
alt_table_row_color($k);
$credits_total = 0;
$k = 0;
-while ($credits_row = db_fetch($result))
+while ($credits_row = db_fetch($result))
{
alt_table_row_color($k);
foreach ($_SESSION['Items']->line_items as $stock_item) {
- $line_total = round($stock_item->quantity * $stock_item->price * (1 - $stock_item->discount_percent),
+ $line_total = round($stock_item->quantity * $stock_item->price * (1 - $stock_item->discount_percent),
user_price_dec());
alt_table_row_color($k);
label_cell($stock_item->stock_id);
label_cell($stock_item->item_description);
- qty_cell($stock_item->quantity);
+ $dec = get_qty_dec($stock_item->stock_id);
+ qty_cell($stock_item->quantity, false, $dec);
label_cell($stock_item->units);
amount_cell($stock_item->price);
amount_cell($stock_item->discount_percent * 100);
amount_cell($line_total);
-
- qty_cell($stock_item->qty_done);
+
+ qty_cell($stock_item->qty_done, false, $dec);
end_row();
}