post_void_customer_trans($type, $type_no);
break;
- case systypes::location_transfer() : // it's a stock transfer
+ case ST_LOCTRANSFER : // it's a stock transfer
if (get_stock_transfer_items($type_no) == null)
return false;
void_stock_transfer($type_no);
break;
- case systypes::inventory_adjustment() : // it's a stock adjustment
+ case ST_INVADJUST : // it's a stock adjustment
if (get_stock_adjustment_items($type_no) == null)
return false;
void_stock_adjustment($type_no);
return false;
break;
- case systypes::work_order() : // it's a work order
+ case ST_WORKORDER : // it's a work order
if (!get_work_order($type_no, true))
return false;
void_work_order($type_no);
case 32: // it's a sales quotation
return false;
- case systypes::cost_update() : // it's a stock cost update
+ case ST_COSTUPDATE : // it's a stock cost update
return false;
break;
}
$_POST['language'], check_value('sticky_doc_date'), $_POST['startup_tab']);
if ($chg_lang)
- language::set_language($_POST['language']);
+ $_SESSION['language']->set_language($_POST['language']);
// refresh main menu
flush_dir($comp_path.'/'.user_company().'/js_cache');
if ($balance != 0.0)
{
- $trans_type = systypes::journal_entry();
+ $trans_type = ST_JOURNAL;
$trans_id = get_next_trans_no($trans_type);
add_gl_trans($trans_type, $trans_id, $to, $co['retained_earnings_act'],
db_query($sql, "Could not delete purchase order details");
$sql = "DELETE FROM ".TB_PREF."purch_orders WHERE order_no = {$row['order_no']}";
db_query($sql, "Could not delete purchase order");
- delete_attachments_and_comments(systypes::po(), $row['order_no']);
+ delete_attachments_and_comments(ST_PURCHORDER, $row['order_no']);
}
}
$sql = "SELECT id FROM ".TB_PREF."grn_batch WHERE delivery_date <= '$to'";
table_section(2);
table_header($th);
}
- ref_row(systypes::name($type["type_id"]), 'id' . $type["type_id"], '', $type["next_reference"]);
+ ref_row($systypes_array[$type["type_id"]], 'id' . $type["type_id"], '', $type["next_reference"]);
}
end_outer_table(1);
$print_type = $_POST['filterType'];
- $print_out = ($print_type == 10 || $print_type == 11 || $print_type == systypes::cust_dispatch() ||
- $print_type == systypes::po() || $print_type == systypes::sales_order() || $print_type == systypes::sales_quotation());
+ $print_out = ($print_type == 10 || $print_type == 11 || $print_type == ST_CUSTDELIVERY ||
+ $print_type == ST_PURCHORDER || $print_type == ST_SALESORDER || $print_type == ST_SALESQUOTE);
$cols = array(
_("#"),
return false;
break;
- case systypes::location_transfer() : // it's a stock transfer
+ case ST_LOCTRANSFER : // it's a stock transfer
if (get_stock_transfer_items($type_no) == null)
return false;
break;
- case systypes::inventory_adjustment() : // it's a stock adjustment
+ case ST_INVADJUST : // it's a stock adjustment
if (get_stock_adjustment_items($type_no) == null)
return false;
break;
return false;
break;
- case systypes::work_order() : // it's a work order
+ case ST_WORKORDER : // it's a work order
if (!get_work_order($type_no, true))
return false;
break;
case 30: // it's a sales order
case 32: // it's a sales quotation
return false;
- case systypes::cost_update() : // it's a stock cost update
+ case ST_COSTUPDATE : // it's a stock cost update
return false;
break;
}
function can_process()
{
- global $selected_id;
+ global $selected_id, $Refs;
if ($selected_id == -1)
{
- if (!references::is_valid($_POST['ref']))
+ if (!$Refs->is_valid($_POST['ref']))
{
display_error( _("The dimension reference must be entered."));
set_focus('ref');
return false;
}
- if (!is_new_reference($_POST['ref'], systypes::dimension()))
+ if (!is_new_reference($_POST['ref'], ST_DIMENSION))
{
display_error(_("The entered reference is already in use."));
set_focus('ref');
$_POST['type_'] = $myrow["type_"];
$_POST['date_'] = sql2date($myrow["date_"]);
$_POST['due_date'] = sql2date($myrow["due_date"]);
- $_POST['memo_'] = get_comments_string(systypes::dimension(), $selected_id);
+ $_POST['memo_'] = get_comments_string(ST_DIMENSION, $selected_id);
hidden('ref', $_POST['ref']);
}
else
{
- ref_row(_("Dimension Reference:"), 'ref', '', references::get_next(systypes::dimension()));
+ ref_row(_("Dimension Reference:"), 'ref', '', $Refs->get_next(ST_DIMENSION));
}
text_row_ex(_("Name") . ":", 'name', 50, 75);
date_row(_("Start Date") . ":", 'date_');
-date_row(_("Date Required By") . ":", 'due_date', '', null, sys_prefs::default_dimension_required_by());
+date_row(_("Date Required By") . ":", 'due_date', '', null, $SysPrefs->default_dimension_required_by());
textarea_row(_("Memo:"), 'memo_', null, 40, 5);
***********************************************************************/
function add_dimension($reference, $name, $type_, $date_, $due_date, $memo_)
{
+ global $Refs;
+
begin_transaction();
$date = date2sql($date_);
$id = db_insert_id();
- add_comments(systypes::dimension(), $id, $date_, $memo_);
+ add_comments(ST_DIMENSION, $id, $date_, $memo_);
- references::save(systypes::dimension(), $id, $reference);
+ $Refs->save(ST_DIMENSION, $id, $reference);
commit_transaction();
db_query($sql, "could not update dimension");
- update_comments(systypes::dimension(), $id, null, $memo_);
+ update_comments(ST_DIMENSION, $id, null, $memo_);
commit_transaction();
$sql="DELETE FROM ".TB_PREF."dimensions WHERE id=$id";
db_query($sql,"The dimension could not be deleted");
- delete_comments(systypes::dimension(), $id);
+ delete_comments(ST_DIMENSION, $id);
commit_transaction();
}
function view_link($row)
{
- return get_dimensions_trans_view_str(systypes::dimension(), $row["id"]);
+ return get_dimensions_trans_view_str(ST_DIMENSION, $row["id"]);
}
function is_closed($row)
}
-display_heading(systypes::name(systypes::dimension()) . " # " . $id);
+display_heading($systypes_array[ST_DIMENSION] . " # " . $id);
br(1);
$myrow = get_dimension($id);
label_cell(sql2date($myrow["due_date"]));
end_row();
-comments_display_row(systypes::dimension(), $id);
+comments_display_row(ST_DIMENSION, $id);
end_table();
{
foreach ($installed_extensions as $ext)
{
- get_text::add_domain($_SESSION['language']->code,
+ $_SESSION['get_text']->add_domain($_SESSION['language']->code,
$ext['folder']."/lang");
$class = $ext['name']."_app";
$this->add_application(new $class());
- get_text::add_domain($_SESSION['language']->code,
+ $_SESSION['get_text']->add_domain($_SESSION['language']->code,
$path_to_root."/lang");
}
}
function systype_name($dummy, $type)
{
- return systypes::name($type);
+ global $systypes_array;
+
+ return $systypes_array[$type];
}
function trans_view($trans)
function fmt_person($row)
{
- return payment_person_types::person_name($row["person_type_id"],$row["person_id"]);
+ return payment_person_name($row["person_type_id"],$row["person_id"]);
}
$update_pager = false;
if (isset($_GET['AddedID']))
{
$trans_no = $_GET['AddedID'];
- $trans_type = systypes::bank_transfer();
+ $trans_type = ST_BANKTRANSFER;
display_notification_centered( _("Transfer has been entered"));
function gl_payment_controls()
{
- global $table_style2;
+ global $table_style2, $Refs;
+
$home_currency = get_company_currency();
start_form();
table_section(2);
- ref_row(_("Reference:"), 'ref', '', references::get_next(systypes::bank_transfer()));
+ ref_row(_("Reference:"), 'ref', '', $Refs->get_next(ST_BANKTRANSFER));
textarea_row(_("Memo:"), 'memo_', null, 40,4);
function check_valid_entries()
{
+ global $Refs;
+
if (!is_date($_POST['DatePaid']))
{
display_error(_("The entered date is invalid."));
set_focus('charge');
return false;
}
- if (!references::is_valid($_POST['ref']))
+ if (!$Refs->is_valid($_POST['ref']))
{
display_error(_("You must enter a reference."));
set_focus('ref');
return false;
}
- if (!is_new_reference($_POST['ref'], systypes::bank_transfer()))
+ if (!is_new_reference($_POST['ref'], ST_BANKTRANSFER))
{
display_error(_("The entered reference is already in use."));
set_focus('ref');
if (isset($_GET['NewPayment'])) {
$_SESSION['page_title'] = _("Bank Account Payment Entry");
- handle_new_order(systypes::bank_payment());
+ handle_new_order(ST_BANKPAYMENT);
} else if(isset($_GET['NewDeposit'])) {
$_SESSION['page_title'] = _("Bank Account Deposit Entry");
- handle_new_order(systypes::bank_deposit());
+ handle_new_order(ST_BANKDEPOSIT);
}
page($_SESSION['page_title'], false, false, '', $js);
if (isset($_GET['AddedID']))
{
$trans_no = $_GET['AddedID'];
- $trans_type = systypes::bank_payment();
+ $trans_type = ST_BANKPAYMENT;
display_notification_centered(_("Payment has been entered"));
if (isset($_GET['AddedDep']))
{
$trans_no = $_GET['AddedDep'];
- $trans_type = systypes::bank_deposit();
+ $trans_type = ST_BANKDEPOSIT;
display_notification_centered(_("Deposit has been entered"));
$input_error = 1;
}
- if (!references::is_valid($_POST['ref']))
+ if (!$Refs->is_valid($_POST['ref']))
{
display_error( _("You must enter a reference."));
set_focus('ref');
$_SESSION['pay_items']->clear_items();
unset($_SESSION['pay_items']);
- meta_forward($_SERVER['PHP_SELF'], $trans_type==systypes::bank_payment() ?
+ meta_forward($_SERVER['PHP_SELF'], $trans_type==ST_BANKPAYMENT ?
"AddedID=$trans_no" : "AddedDep=$trans_no");
} /*end of process credit note */
//if (is_bank_account($_POST['code_id']))
//{
- // if ($_SESSION['pay_items']->trans_type == systypes::bank_payment())
+ // if ($_SESSION['pay_items']->trans_type == ST_BANKPAYMENT)
// display_error( _("You cannot make a payment to a bank account. Please use the transfer funds facility for this."));
// else
// display_error( _("You cannot make a deposit from a bank account. Please use the transfer funds facility for this."));
function handle_update_item()
{
- $amount = ($_SESSION['pay_items']->trans_type==systypes::bank_payment() ? 1:-1) * input_num('amount');
+ $amount = ($_SESSION['pay_items']->trans_type==ST_BANKPAYMENT ? 1:-1) * input_num('amount');
if($_POST['UpdateItem'] != "" && check_item_data())
{
$_SESSION['pay_items']->update_gl_item($_POST['Index'], $_POST['dimension_id'],
{
if (!check_item_data())
return;
- $amount = ($_SESSION['pay_items']->trans_type==systypes::bank_payment() ? 1:-1) * input_num('amount');
+ $amount = ($_SESSION['pay_items']->trans_type==ST_BANKPAYMENT ? 1:-1) * input_num('amount');
$_SESSION['pay_items']->add_gl_item($_POST['code_id'], $_POST['dimension_id'],
$_POST['dimension2_id'], $amount, $_POST['LineMemo']);
if (isset($_POST['go']))
{
display_quick_entries($_SESSION['pay_items'], $_POST['person_id'], input_num('totamount'),
- $_SESSION['pay_items']->trans_type==systypes::bank_payment() ? QE_PAYMENT : QE_DEPOSIT);
+ $_SESSION['pay_items']->trans_type==ST_BANKPAYMENT ? QE_PAYMENT : QE_DEPOSIT);
$_POST['totamount'] = price_format(0); $Ajax->activate('totamount');
line_start_focus();
}
start_table("$table_style2 width=90%", 10);
start_row();
echo "<td>";
-display_gl_items($_SESSION['pay_items']->trans_type==systypes::bank_payment() ?
+display_gl_items($_SESSION['pay_items']->trans_type==ST_BANKPAYMENT ?
_("Payment Items"):_("Deposit Items"), $_SESSION['pay_items']);
gl_options_controls();
echo "</td>";
end_table(1);
submit_center_first('Update', _("Update"), '', null);
-submit_center_last('Process', $_SESSION['pay_items']->trans_type==systypes::bank_payment() ?
+submit_center_last('Process', $_SESSION['pay_items']->trans_type==ST_BANKPAYMENT ?
_("Process Payment"):_("Process Deposit"), '', 'default');
end_form();
if (isset($_GET['AddedID']))
{
$trans_no = $_GET['AddedID'];
- $trans_type = systypes::journal_entry();
+ $trans_type = ST_JOURNAL;
display_notification_centered( _("Journal entry has been entered") . " #$trans_no");
} elseif (isset($_GET['UpdatedID']))
{
$trans_no = $_GET['UpdatedID'];
- $trans_type = systypes::journal_entry();
+ $trans_type = ST_JOURNAL;
display_notification_centered( _("Journal entry has been updated") . " #$trans_no");
function create_cart($type=0, $trans_no=0)
{
+ global $Refs;
+
if (isset($_SESSION['journal_items']))
{
unset ($_SESSION['journal_items']);
}
$cart->memo_ = get_comments_string($type, $trans_no);
$cart->tran_date = sql2date($date);
- $cart->reference = references::get($type, $trans_no);
+ $cart->reference = $Refs->get($type, $trans_no);
} else {
- $cart->reference = references::get_next(0);
+ $cart->reference = $Refs->get_next(0);
$cart->tran_date = new_doc_date();
}
if (!is_date_in_fiscalyear($cart->tran_date))
$input_error = 1;
}
if ($_SESSION['journal_items']->order_id == 0) {
- if (!references::is_valid($_POST['ref']))
+ if (!$Refs->is_valid($_POST['ref']))
{
display_error( _("You must enter a reference."));
set_focus('ref');
$input_error = 1;
}
- elseif (references::exists(systypes::journal_entry(), $_POST['ref']))
+ elseif ($Refs->exists(ST_JOURNAL, $_POST['ref']))
{
display_error( _("The entered reference is already in use."));
set_focus('ref');
if ($diff != 0)
{
if ($trans_type == null)
- $trans_type = systypes::journal_entry();
+ $trans_type = ST_JOURNAL;
if ($trans_no == null)
$trans_no = get_next_trans_no($trans_type);
if ($person_type_id == null)
- $person_type_id = payment_person_types::misc();
+ $person_type_id = PT_MISC;
add_gl_trans($trans_type, $trans_no, $date_, $account, 0, 0, _("Exchange Variance"),
-$diff, null, $person_type_id, $person_id);
add_gl_trans($trans_type, $trans_no, $date_, get_company_pref('exchange_diff_act'), 0, 0,
function add_bank_transfer($from_account, $to_account, $date_,
$amount, $ref, $memo_, $charge=0)
{
+ global $Refs;
+
begin_transaction();
- $trans_type = systypes::bank_transfer();
+ $trans_type = ST_BANKTRANSFER;
$currency = get_bank_account_currency($from_account);
add_bank_trans($trans_type, $trans_no, $from_account, $ref,
$date_, -($amount + $charge),
- payment_person_types::misc(), "", $currency,
+ PT_MISC, "", $currency,
"Cannot insert a source bank transaction");
add_exchange_variation($trans_type, $trans_no, $date_, $from_account, $from_gl_account,
- $currency, payment_person_types::misc(), "");
+ $currency, PT_MISC, "");
if ($charge != 0)
{
add_gl_balance($trans_type, $trans_no, $date_, -$total);
add_bank_trans($trans_type, $trans_no, $to_account, $ref,
- $date_, $amount, payment_person_types::misc(), "",
+ $date_, $amount, PT_MISC, "",
$currency, "Cannot insert a destination bank transaction");
add_exchange_variation($trans_type, $trans_no, $date_, $from_account, $from_gl_account,
- $currency, payment_person_types::misc(), "");
+ $currency, PT_MISC, "");
add_comments($trans_type, $trans_no, $date_, $memo_);
- references::save($trans_type, $trans_no, $ref);
+ $Refs->save($trans_type, $trans_no, $ref);
add_audit_trail($trans_type, $trans_no, $date_);
commit_transaction();
function add_bank_transaction($trans_type, $from_account, $items, $date_,
$person_type_id, $person_id, $person_detail_id, $ref, $memo_)
{
+ global $Refs;
+
// we can only handle type 1 (payment)and type 2 (deposit)
- if ($trans_type != systypes::bank_payment() && $trans_type != systypes::bank_deposit())
+ if ($trans_type != ST_BANKPAYMENT && $trans_type != ST_BANKDEPOSIT)
display_db_error("Invalid type ($trans_type) sent to add_bank_transaction");
$do_exchange_variance = false;
// the gl items are already inversed/negated for type 2 (deposit)
$total_amount = $items->gl_items_total();
- if ($person_type_id == payment_person_types::customer())
+ if ($person_type_id == PT_CUSTOMER)
{
// we need to add a customer transaction record
$ref, $cust_amount);
}
- elseif ($person_type_id == payment_person_types::supplier())
+ elseif ($person_type_id == PT_SUPPLIER)
{
// we need to add a supplier transaction record
// convert to supp currency
add_comments($trans_type, $trans_no, $date_, $memo_);
- references::save($trans_type, $trans_no, $ref);
+ $Refs->save($trans_type, $trans_no, $ref);
add_audit_trail($trans_type, $trans_no, $date_);
commit_transaction();
{
$sql = "SELECT ".TB_PREF."gl_trans.*, ".TB_PREF."chart_master.account_name FROM ".TB_PREF."gl_trans, ".TB_PREF."chart_master
WHERE ".TB_PREF."chart_master.account_code=".TB_PREF."gl_trans.account
- AND ".TB_PREF."gl_trans.type=".systypes::work_order()." AND ".TB_PREF."gl_trans.type_no=$trans_id
- AND ".TB_PREF."gl_trans.person_type_id=".payment_person_types::WorkOrder();
+ AND ".TB_PREF."gl_trans.type=".ST_WORKORDER." AND ".TB_PREF."gl_trans.type_no=$trans_id
+ AND ".TB_PREF."gl_trans.person_type_id=".PT_WORKORDER;
if ($person_id != -1)
$sql .= " AND ".TB_PREF."gl_trans.person_id=$person_id";
$sql .= " AND amount < 0";
//
function write_journal_entries(&$cart, $reverse)
{
+ global $Refs;
+
$date_ = $cart->tran_date;
$ref = $cart->reference;
$memo_ = $cart->memo_;
if ($new) {
add_comments($trans_type, $trans_id, $date_, $memo_);
- references::save($trans_type, $trans_id, $ref);
+ $Refs->save($trans_type, $trans_id, $ref);
} else
update_comments($trans_type, $trans_id, null, $memo_);
add_comments($trans_type, $trans_id_reverse, $reversingDate, $memo_);
- references::save($trans_type, $trans_id_reverse, $ref);
+ $Refs->save($trans_type, $trans_id_reverse, $ref);
add_audit_trail($trans_type, $trans_id_reverse, $reversingDate);
}
***********************************************************************/
function display_bank_header(&$order)
{
- global $table_style2, $Ajax;
- $payment = $order->trans_type == systypes::bank_payment();
+ global $table_style2, $Ajax, $Refs;
+ $payment = $order->trans_type == ST_BANKPAYMENT;
div_start('pmt_header');
'PayType', $_POST['PayType'], true);
switch ($_POST['PayType'])
{
- case payment_person_types::misc() :
+ case PT_MISC :
text_row_ex($payment ?_("To the Order of:"):_("Name:"),
'person_id', 40, 50);
break;
- //case payment_person_types::WorkOrder() :
+ //case PT_WORKORDER :
// workorders_list_row(_("Work Order:"), 'person_id', null);
// break;
- case payment_person_types::supplier() :
+ case PT_SUPPLIER :
supplier_list_row(_("Supplier:"), 'person_id', null, false, true, false, true);
break;
- case payment_person_types::customer() :
+ case PT_CUSTOMER :
customer_list_row(_("Customer:"), 'person_id', null, false, true, false, true);
if (db_customer_has_branches($_POST['person_id']))
}
else
{
- $_POST['PersonDetailID'] = reserved_words::get_any_numeric();
+ $_POST['PersonDetailID'] = ANY_NUMERIC;
hidden('PersonDetailID');
}
break;
- case payment_person_types::QuickEntry() :
+ case PT_QUICKENTRY :
quick_entries_list_row(_("Type").":", 'person_id', null, ($payment ? QE_PAYMENT : QE_DEPOSIT), true);
$qid = get_quick_entry(get_post('person_id'));
if (list_updated('person_id')) {
// break;
}
- $person_currency = payment_person_types::person_currency($_POST['PayType'], $_POST['person_id']);
+ $person_currency = payment_person_currency($_POST['PayType'], $_POST['person_id']);
$bank_currency = get_bank_account_currency($_POST['bank_account']);
exchange_rate_display($bank_currency, $person_currency, $_POST['date_']);
table_section(3, "33%");
if (isset($_GET['NewPayment']))
- ref_row(_("Reference:"), 'ref', '', references::get_next(systypes::bank_payment()));
+ ref_row(_("Reference:"), 'ref', '', $Refs->get_next(ST_BANKPAYMENT));
else
- ref_row(_("Reference:"), 'ref', '', references::get_next(systypes::bank_deposit()));
+ ref_row(_("Reference:"), 'ref', '', $Refs->get_next(ST_BANKDEPOSIT));
end_outer_table(1); // outer table
if ($dim > 1)
label_cell(get_dimension_string($item->dimension2_id, true));
//amount_cell(abs($item->amount));
- if ($order->trans_type == systypes::bank_deposit())
+ if ($order->trans_type == ST_BANKDEPOSIT)
amount_cell(-$item->amount);
else
amount_cell($item->amount);
function gl_edit_item_controls(&$order, $dim, $Index=null)
{
global $Ajax;
- $payment = $order->trans_type == systypes::bank_payment();
+ $payment = $order->trans_type == ST_BANKPAYMENT;
start_row();
$id = find_submit('Edit');
$Ajax->activate('code_id');
}
- if ($_POST['PayType'] == payment_person_types::customer())
+ if ($_POST['PayType'] == PT_CUSTOMER)
{
$acc = get_branch_accounts($_POST['PersonDetailID']);
$_POST['code_id'] = $acc['receivables_account'];
}
- elseif ($_POST['PayType'] == payment_person_types::supplier())
+ elseif ($_POST['PayType'] == PT_SUPPLIER)
{
$acc = get_supplier_accounts($_POST['person_id']);
$_POST['code_id'] = $acc['payable_account'];
}
- //elseif ($_POST['PayType'] == payment_person_types::WorkOrder())
+ //elseif ($_POST['PayType'] == PT_WORKORDER)
// $_POST['code_id'] = get_company_pref('default_assembly_act');
else {
$_POST['code_id'] =
$running_total += $myrow["amount"];
$trandate = sql2date($myrow["trans_date"]);
- label_cell(systypes::name($myrow["type"]));
+ label_cell($systypes_array[$myrow["type"]]);
label_cell(get_trans_view_str($myrow["type"],$myrow["trans_no"]));
label_cell(get_trans_view_str($myrow["type"],$myrow["trans_no"],$myrow['ref']));
label_cell($trandate);
display_debit_or_credit_cells($myrow["amount"]);
amount_cell($running_total);
- label_cell(payment_person_types::person_name($myrow["person_type_id"],$myrow["person_id"]));
+ label_cell(payment_person_name($myrow["person_type_id"],$myrow["person_id"]));
label_cell(get_gl_view_str($myrow["type"], $myrow["trans_no"]));
end_row();
function show_results()
{
- global $path_to_root, $table_style;
+ global $path_to_root, $table_style, $systypes_array;
if (!isset($_POST["account"]) || $_POST["account"] == "")
return;
$trandate = sql2date($myrow["tran_date"]);
- label_cell(systypes::name($myrow["type"]));
+ label_cell($systypes_array[$myrow["type"]]);
label_cell(get_gl_view_str($myrow["type"], $myrow["type_no"], $myrow["type_no"], true));
label_cell($trandate);
if ($dim >= 1)
label_cell(get_dimension_string($myrow['dimension_id'], true));
if ($dim > 1)
label_cell(get_dimension_string($myrow['dimension2_id'], true));
- label_cell(payment_person_types::person_name($myrow["person_type_id"],$myrow["person_id"]));
+ label_cell(payment_person_name($myrow["person_type_id"],$myrow["person_id"]));
display_debit_or_credit_cells($myrow["amount"]);
amount_cell($running_total);
label_cell($myrow['memo_']);
function systype_name($dummy, $type)
{
- return systypes::name($type);
+ global $systypes_array;
+
+ return $systypes_array[$type];
}
function view_link($row)
alt_table_row_color($k);
label_cell($myrow["bank_account_name"], "nowrap");
- label_cell(bank_account_types::name($myrow["account_type"]), "nowrap");
+ label_cell($bank_account_types[$myrow["account_type"]], "nowrap");
label_cell($myrow["bank_curr_code"], "nowrap");
label_cell($myrow["account_code"] . " " . $myrow["account_name"], "nowrap");
label_cell($myrow["bank_name"], "nowrap");
if ($is_editing)
{
- label_row(_("Account Type:"), bank_account_types::name($_POST['account_type']));
+ label_row(_("Account Type:"), $bank_account_types[$_POST['account_type']]);
}
else
{
$bs_text = get_account_class_name($myrow["class_id"]);
- if ($myrow["parent"] == reserved_words::get_any_numeric())
+ if ($myrow["parent"] == ANY_NUMERIC)
{
$parent_text = "";
}
$trans_no = $_GET["trans_no"];
}
-$result = get_bank_trans(systypes::bank_transfer(), $trans_no);
+$result = get_bank_trans(ST_BANKTRANSFER, $trans_no);
if (db_num_rows($result) != 2)
display_db_error("Bank transfer does not contain two records", $sql);
$show_both_amounts = true;
}
-display_heading(systypes::name(systypes::bank_transfer()) . " #$trans_no");
+display_heading($systypes_array[ST_BANKTRANSFER] . " #$trans_no");
echo "<br>";
start_table("$table_style width=80%");
end_row();
start_row();
label_cells(_("Date"), sql2date($from_trans['trans_date']), "class='tableheader2'");
-label_cells(_("Transfer Type"), bank_account_types::transfer_type($from_trans['account_type']), "class='tableheader2'");
+label_cells(_("Transfer Type"), $bank_transfer_types[$from_trans['account_type']],
+ "class='tableheader2'");
label_cells(_("Reference"), $from_trans['ref'], "class='tableheader2'");
end_row();
-comments_display_row(systypes::bank_transfer(), $trans_no);
+comments_display_row(ST_BANKTRANSFER, $trans_no);
end_table(1);
-is_voided_display(systypes::bank_transfer(), $trans_no, _("This transfer has been voided."));
+is_voided_display(ST_BANKTRANSFER, $trans_no, _("This transfer has been voided."));
end_page(true);
?>
\ No newline at end of file
}
// get the pay-to bank payment info
-$result = get_bank_trans(systypes::bank_deposit(), $trans_no);
+$result = get_bank_trans(ST_BANKDEPOSIT, $trans_no);
if (db_num_rows($result) != 1)
display_db_error("duplicate payment bank transaction found", "");
label_cells(_("Date"), sql2date($to_trans['trans_date']), "class='tableheader2'");
end_row();
start_row();
-label_cells(_("From"), payment_person_types::person_name($to_trans['person_type_id'], $to_trans['person_id']), "class='tableheader2'", "colspan=$colspan1");
-label_cells(_("Deposit Type"), bank_account_types::transfer_type($to_trans['account_type']), "class='tableheader2'");
+label_cells(_("From"), payment_person_name($to_trans['person_type_id'], $to_trans['person_id']), "class='tableheader2'", "colspan=$colspan1");
+label_cells(_("Deposit Type"), $bank_transfer_types[$to_trans['account_type']], "class='tableheader2'");
end_row();
start_row();
label_cells(_("Reference"), $to_trans['ref'], "class='tableheader2'", "colspan=$colspan2");
end_row();
-comments_display_row(systypes::bank_deposit(), $trans_no);
+comments_display_row(ST_BANKDEPOSIT, $trans_no);
end_table(1);
-is_voided_display(systypes::bank_deposit(), $trans_no, _("This deposit has been voided."));
+is_voided_display(ST_BANKDEPOSIT, $trans_no, _("This deposit has been voided."));
-$items = get_gl_trans(systypes::bank_deposit(), $trans_no);
+$items = get_gl_trans(ST_BANKDEPOSIT, $trans_no);
if (db_num_rows($items) == 0)
{
}
// get the pay-from bank payment info
-$result = get_bank_trans(systypes::bank_payment(), $trans_no);
+$result = get_bank_trans(ST_BANKPAYMENT, $trans_no);
if (db_num_rows($result) != 1)
display_db_error("duplicate payment bank transaction found", "");
label_cells(_("Date"), sql2date($from_trans['trans_date']), "class='tableheader2'");
end_row();
start_row();
-label_cells(_("Pay To"), payment_person_types::person_name($from_trans['person_type_id'], $from_trans['person_id']), "class='tableheader2'", "colspan=$colspan1");
-label_cells(_("Payment Type"),bank_account_types::transfer_type($from_trans['account_type']), "class='tableheader2'");
+label_cells(_("Pay To"), payment_person_name($from_trans['person_type_id'], $from_trans['person_id']), "class='tableheader2'", "colspan=$colspan1");
+label_cells(_("Payment Type"), $bank_transfer_types[$from_trans['account_type']], "class='tableheader2'");
end_row();
start_row();
label_cells(_("Reference"), $from_trans['ref'], "class='tableheader2'", "colspan=$colspan2");
end_row();
-comments_display_row(systypes::bank_payment(), $trans_no);
+comments_display_row(ST_BANKPAYMENT, $trans_no);
end_table(1);
-$voided = is_voided_display(systypes::bank_payment(), $trans_no, _("This payment has been voided."));
+$voided = is_voided_display(ST_BANKPAYMENT, $trans_no, _("This payment has been voided."));
-$items = get_gl_trans(systypes::bank_payment(), $trans_no);
+$items = get_gl_trans(ST_BANKPAYMENT, $trans_no);
if (db_num_rows($items)==0)
{
function display_gl_heading($myrow)
{
- global $table_style;
- $trans_name = systypes::name($_GET['type_id']);
+ global $table_style, $systypes_array;
+ $trans_name = $systypes_array[$_GET['type_id']];
start_table("$table_style width=95%");
$th = array(_("General Ledger Transaction Details"),
_("Date"), _("Person/Item"));
start_row();
label_cell("$trans_name #" . $_GET['trans_no']);
label_cell(sql2date($myrow["tran_date"]));
- label_cell(payment_person_types::person_name($myrow["person_type_id"],$myrow["person_id"]));
+ label_cell(payment_person_name($myrow["person_type_id"],$myrow["person_id"]));
end_row();
if (db_num_rows($result) == 0)
{
- echo "<p><center>" . _("No general ledger transactions have been created for") . " " .systypes::name($_GET['type_id'])." " . _("number") . " " . $_GET['trans_no'] . "</center></p><br><br>";
+ echo "<p><center>" . _("No general ledger transactions have been created for") . " " .$systypes_array$_GET['type_id']]." " . _("number") . " " . $_GET['trans_no'] . "</center></p><br><br>";
end_page(true);
exit;
}
if (isset($_GET['AddedID']))
{
$trans_no = $_GET['AddedID'];
- $trans_type = systypes::inventory_adjustment();
+ $trans_type = ST_INVADJUST;
display_notification_centered(_("Items adjustment has been processed"));
display_note(get_trans_view_str($trans_type, $trans_no, _("&View this adjustment")));
session_register("adj_items");
- $_SESSION['adj_items'] = new items_cart(systypes::inventory_adjustment());
+ $_SESSION['adj_items'] = new items_cart(ST_INVADJUST);
$_POST['AdjDate'] = new_doc_date();
if (!is_date_in_fiscalyear($_POST['AdjDate']))
$_POST['AdjDate'] = end_fiscalyear();
function can_process()
{
+ global $Refs;
+
$adj = &$_SESSION['adj_items'];
if (count($adj->line_items) == 0) {
set_focus('stock_id');
return false;
}
- if (!references::is_valid($_POST['ref']))
+ if (!$Refs->is_valid($_POST['ref']))
{
display_error( _("You must enter a reference."));
set_focus('ref');
return false;
}
- if (!is_new_reference($_POST['ref'], systypes::inventory_adjustment()))
+ if (!is_new_reference($_POST['ref'], ST_INVADJUST))
{
display_error( _("The entered reference is already in use."));
set_focus('ref');
if ($update_no > 0)
{
- display_note(get_gl_view_str(systypes::cost_update(), $update_no, _("View the GL Journal Entries for this Cost Update")), 0, 1);
+ display_note(get_gl_view_str(ST_COSTUPDATE, $update_no, _("View the GL Journal Entries for this Cost Update")), 0, 1);
}
}
}
function add_stock_adjustment($items, $location, $date_, $type, $increase, $reference, $memo_)
{
+ global $Refs;
+
begin_transaction();
- $adj_id = get_next_trans_no(systypes::inventory_adjustment());
+ $adj_id = get_next_trans_no(ST_INVADJUST);
foreach ($items as $line_item)
{
$line_item->quantity, $line_item->standard_cost, $memo_);
}
- add_comments(systypes::inventory_adjustment(), $adj_id, $date_, $memo_);
+ add_comments(ST_INVADJUST, $adj_id, $date_, $memo_);
- references::save(systypes::inventory_adjustment(), $adj_id, $reference);
- add_audit_trail(systypes::inventory_adjustment(), $adj_id, $date_);
+ $Refs->save(ST_INVADJUST, $adj_id, $reference);
+ add_audit_trail(ST_INVADJUST, $adj_id, $date_);
commit_transaction();
function void_stock_adjustment($type_no)
{
- void_gl_trans(systypes::inventory_adjustment(), $type_no);
- void_stock_move(systypes::inventory_adjustment(), $type_no);
+ void_gl_trans(ST_INVADJUST, $type_no);
+ void_stock_move(ST_INVADJUST, $type_no);
}
//-------------------------------------------------------------------------------------------------------------
function get_stock_adjustment_items($trans_no)
{
- $result = get_stock_moves(systypes::inventory_adjustment(), $trans_no);
+ $result = get_stock_moves(ST_INVADJUST, $trans_no);
if (db_num_rows($result) == 0)
{
update_average_material_cost(null, $stock_id, $standard_cost, $quantity, $date_);
- add_stock_move(systypes::inventory_adjustment(), $stock_id, $adj_id, $location,
+ add_stock_move(ST_INVADJUST, $stock_id, $adj_id, $location,
$date_, $reference, $quantity, $standard_cost, $type);
if ($standard_cost > 0)
$stock_gl_codes = get_stock_gl_code($stock_id);
- add_gl_trans_std_cost(systypes::inventory_adjustment(), $adj_id, $date_,
+ add_gl_trans_std_cost(ST_INVADJUST, $adj_id, $date_,
$stock_gl_codes['adjustment_account'], $stock_gl_codes['dimension_id'], $stock_gl_codes['dimension2_id'], $memo_, ($standard_cost * -($quantity)));
- add_gl_trans_std_cost(systypes::inventory_adjustment(), $adj_id, $date_, $stock_gl_codes['inventory_account'], 0, 0, $memo_, ($standard_cost * $quantity));
+ add_gl_trans_std_cost(ST_INVADJUST, $adj_id, $date_, $stock_gl_codes['inventory_account'], 0, 0, $memo_, ($standard_cost * $quantity));
}
}
if ($qoh > 0)
{
- $update_no = get_next_trans_no(systypes::cost_update());
+ $update_no = get_next_trans_no(ST_COSTUPDATE);
if (!is_date_in_fiscalyear($date_))
$date_ = end_fiscalyear();
$value_of_change = $qoh * ($new_cost - $last_cost);
$memo_ = "Cost was " . $last_cost . " changed to " . $new_cost . " x quantity on hand of $qoh";
- add_gl_trans_std_cost(systypes::cost_update(), $update_no, $date_, $stock_gl_code["adjustment_account"],
+ add_gl_trans_std_cost(ST_COSTUPDATE, $update_no, $date_, $stock_gl_code["adjustment_account"],
$stock_gl_code["dimension_id"], $stock_gl_code["dimension2_id"], $memo_, (-$value_of_change));
- add_gl_trans_std_cost(systypes::cost_update(), $update_no, $date_, $stock_gl_code["inventory_account"], 0, 0, $memo_,
+ add_gl_trans_std_cost(ST_COSTUPDATE, $update_no, $date_, $stock_gl_code["inventory_account"], 0, 0, $memo_,
$value_of_change);
}
- add_audit_trail(systypes::cost_update(), $update_no, $date_);
+ add_audit_trail(ST_COSTUPDATE, $update_no, $date_);
commit_transaction();
return $update_no;
function add_stock_transfer($Items, $location_from, $location_to, $date_, $type, $reference, $memo_)
{
+ global $Refs;
+
begin_transaction();
- $transfer_id = get_next_trans_no(systypes::location_transfer());
+ $transfer_id = get_next_trans_no(ST_LOCTRANSFER);
foreach ($Items as $line_item)
{
$location_to, $date_, $type, $reference, $line_item->quantity);
}
- add_comments(systypes::location_transfer(), $transfer_id, $date_, $memo_);
+ add_comments(ST_LOCTRANSFER, $transfer_id, $date_, $memo_);
- references::save(systypes::location_transfer(), $transfer_id, $reference);
- add_audit_trail(systypes::location_transfer(), $transfer_id, $date_);
+ $Refs->save(ST_LOCTRANSFER, $transfer_id, $reference);
+ add_audit_trail(ST_LOCTRANSFER, $transfer_id, $date_);
commit_transaction();
function add_stock_transfer_item($transfer_id, $stock_id, $location_from, $location_to,
$date_, $type, $reference, $quantity)
{
- add_stock_move(systypes::location_transfer(), $stock_id, $transfer_id, $location_from,
+ add_stock_move(ST_LOCTRANSFER, $stock_id, $transfer_id, $location_from,
$date_, $reference, -$quantity, 0, $type);
- add_stock_move(systypes::location_transfer(), $stock_id, $transfer_id, $location_to,
+ add_stock_move(ST_LOCTRANSFER, $stock_id, $transfer_id, $location_to,
$date_, $reference, $quantity, 0, $type);
}
function get_stock_transfer_items($trans_no)
{
- $result = get_stock_moves(systypes::location_transfer(), $trans_no);
+ $result = get_stock_moves(ST_LOCTRANSFER, $trans_no);
if (db_num_rows($result) == 0)
{
function void_stock_transfer($type_no)
{
- void_stock_move(systypes::location_transfer(), $type_no);
+ void_stock_move(ST_LOCTRANSFER, $type_no);
}
?>
\ No newline at end of file
function display_order_header(&$order)
{
- global $table_style2;
+ global $table_style2, $Refs;
start_outer_table("width=70% $table_style2"); // outer table
table_section(1);
locations_list_row(_("Location:"), 'StockLocation', null);
- ref_row(_("Reference:"), 'ref', '', references::get_next(systypes::inventory_adjustment()));
+ ref_row(_("Reference:"), 'ref', '', $Refs->get_next(ST_INVADJUST));
table_section(2, "33%");
function display_order_header(&$order)
{
- global $table_style;
+ global $table_style, $Refs;
start_outer_table("width=70% $table_style");
table_section(2, "33%");
- ref_row(_("Reference:"), 'ref', '', references::get_next(systypes::location_transfer()));
+ ref_row(_("Reference:"), 'ref', '', $Refs->get_next(ST_LOCTRANSFER));
date_row(_("Date:"), 'AdjDate', '', true);
$trandate = sql2date($myrow["tran_date"]);
- $type_name = systypes::name($myrow["type"]);
+ $type_name = $systypes_array[$myrow["type"]];
if ($myrow["qty"] > 0)
{
if (strlen($supp_row['supp_name']) > 0)
$person = $supp_row['supp_name'];
}
- elseif ($myrow["type"] == systypes::location_transfer() || $myrow["type"] == systypes::inventory_adjustment())
+ elseif ($myrow["type"] == ST_LOCTRANSFER || $myrow["type"] == ST_INVADJUST)
{
// get the adjustment type
$movement_type = get_movement_type($myrow["person_id"]);
$person = $movement_type["name"];
}
- elseif ($myrow["type"]==systypes::work_order() || $myrow["type"] == 28 ||
+ elseif ($myrow["type"]==ST_WORKORDER || $myrow["type"] == 28 ||
$myrow["type"] == 29)
{
$person = "";
function can_delete($selected_id)
{
$sql= "SELECT COUNT(*) FROM ".TB_PREF."stock_moves
- WHERE type=" . systypes::inventory_adjustment(). " AND person_id=$selected_id";
+ WHERE type=" . ST_INVADJUST. " AND person_id=$selected_id";
$result = db_query($sql, "could not query stock moves");
$myrow = db_fetch_row($result);
if ($myrow[0] > 0)
if (isset($_GET['AddedID']))
{
$trans_no = $_GET['AddedID'];
- $trans_type = systypes::location_transfer();
+ $trans_type = ST_LOCTRANSFER;
display_notification_centered(_("Inventory transfer has been processed"));
display_note(get_trans_view_str($trans_type, $trans_no, _("&View this transfer")));
session_register("transfer_items");
- $_SESSION['transfer_items'] = new items_cart(systypes::location_transfer());
+ $_SESSION['transfer_items'] = new items_cart(ST_LOCTRANSFER);
$_POST['AdjDate'] = new_doc_date();
if (!is_date_in_fiscalyear($_POST['AdjDate']))
$_POST['AdjDate'] = end_fiscalyear();
if (isset($_POST['Process']))
{
+ global $Refs;
$tr = &$_SESSION['transfer_items'];
$input_error = 0;
set_focus('stock_id');
return false;
}
- if (!references::is_valid($_POST['ref']))
+ if (!$Refs->is_valid($_POST['ref']))
{
display_error(_("You must enter a reference."));
set_focus('ref');
$input_error = 1;
}
- elseif (!is_new_reference($_POST['ref'], systypes::location_transfer()))
+ elseif (!is_new_reference($_POST['ref'], ST_LOCTRANSFER))
{
display_error(_("The entered reference is already in use."));
set_focus('ref');
$trans_no = $_GET["trans_no"];
}
-display_heading(systypes::name(systypes::inventory_adjustment()) . " #$trans_no");
+display_heading($systypes_array[ST_INVADJUST] . " #$trans_no");
br(1);
$adjustment_items = get_stock_adjustment_items($trans_no);
label_cells(_("Date"), sql2date($adjustment['tran_date']), "class='tableheader2'");
label_cells(_("Adjustment Type"), $adjustment_type['name'], "class='tableheader2'");
end_row();
- comments_display_row(systypes::inventory_adjustment(), $trans_no);
+ comments_display_row(ST_INVADJUST, $trans_no);
end_table();
$header_shown = true;
end_table(1);
-is_voided_display(systypes::inventory_adjustment(), $trans_no, _("This adjustment has been voided."));
+is_voided_display(ST_INVADJUST, $trans_no, _("This adjustment has been voided."));
end_page(true);
?>
\ No newline at end of file
$from_trans = $transfer_items[0];
$to_trans = $transfer_items[1];
-display_heading(systypes::name(systypes::location_transfer()) . " #$trans_no");
+display_heading($systypes_array[ST_LOCTRANSFER] . " #$trans_no");
echo "<br>";
start_table("$table_style2 width=90%");
label_cells(_("Date"), sql2date($from_trans['tran_date']), "class='tableheader2'");
end_row();
-comments_display_row(systypes::location_transfer(), $trans_no);
+comments_display_row(ST_LOCTRANSFER, $trans_no);
end_table(1);
$th = array(_("Item"), _("Description"), _("Quantity"), _("Units"));
table_header($th);
-$transfer_items = get_stock_moves(systypes::location_transfer(), $trans_no);
+$transfer_items = get_stock_moves(ST_LOCTRANSFER, $trans_no);
$k = 0;
while ($item = db_fetch($transfer_items))
{
end_table(1);
-is_voided_display(systypes::location_transfer(), $trans_no, _("This transfer has been voided."));
+is_voided_display(ST_LOCTRANSFER, $trans_no, _("This transfer has been voided."));
end_page(true);
?>
\ No newline at end of file
function add_work_order_issue($woid, $ref, $to_work_order, $items, $location, $workcentre,
$date_, $memo_)
{
+ global $Refs;
+
begin_transaction();
$details = get_work_order($woid);
if ($memo_)
add_comments(28, $number, $date_, $memo_);
- references::save(28, $number, $ref);
+ $Refs->save(28, $number, $ref);
add_audit_trail(28, $number, $date_);
commit_transaction();
***********************************************************************/
function work_order_produce($woid, $ref, $quantity, $date_, $memo_, $close_wo)
{
+ global $Refs;
+
begin_transaction();
$details = get_work_order($woid);
if ($memo_)
add_comments(29, $id, $date_, $memo_);
- references::save(29, $id, $ref);
+ $Refs->save(29, $id, $ref);
add_audit_trail(29, $id, $date_, _("Production."));
commit_transaction();
function add_work_order($wo_ref, $loc_code, $units_reqd, $stock_id,
$type, $date_, $required_by, $memo_, $costs, $cr_acc, $labour, $cr_lab_acc)
{
- if (!($type == wo_types::advanced()))
+ global $Refs;
+
+ if (!($type == WO_ADVANCED))
return add_work_order_quick($wo_ref, $loc_code, $units_reqd, $stock_id, $type, $date_, $memo_, $costs, $cr_acc, $labour, $cr_lab_acc);
begin_transaction();
$woid = db_insert_id();
- add_comments(systypes::work_order(), $woid, $required_by, $memo_);
+ add_comments(ST_WORKORDER, $woid, $required_by, $memo_);
- references::save(systypes::work_order(), $woid, $wo_ref);
- add_audit_trail(systypes::work_order(), $woid, $date_);
+ $Refs->save(ST_WORKORDER, $woid, $wo_ref);
+ add_audit_trail(ST_WORKORDER, $woid, $date_);
commit_transaction();
db_query($sql, "could not update work order");
- update_comments(systypes::work_order(), $woid, null, $memo_);
- add_audit_trail(systypes::work_order(), $woid, $date_, _("Updated."));
+ update_comments(ST_WORKORDER, $woid, null, $memo_);
+ add_audit_trail(ST_WORKORDER, $woid, $date_, _("Updated."));
commit_transaction();
}
$sql = "DELETE FROM ".TB_PREF."workorders WHERE id=$woid";
db_query($sql,"The work order could not be deleted");
- delete_comments(systypes::work_order(), $woid);
- add_audit_trail(systypes::work_order(), $woid, $_POST['date_'], _("Canceled."));
+ delete_comments(ST_WORKORDER, $woid);
+ add_audit_trail(ST_WORKORDER, $woid, $_POST['date_'], _("Canceled."));
commit_transaction();
}
// create Work Order Requirements based on the bom
create_wo_requirements($woid, $stock_id);
- add_comments(systypes::work_order(), $woid, $releaseDate, $memo_);
- add_audit_trail(systypes::work_order(), $woid, $releaseDate,_("Released."));
+ add_comments(ST_WORKORDER, $woid, $releaseDate, $memo_);
+ add_audit_trail(ST_WORKORDER, $woid, $releaseDate,_("Released."));
commit_transaction();
}
{
$work_order = get_work_order($woid);
- if (!($work_order["type"] == wo_types::advanced()))
+ if (!($work_order["type"] == WO_ADVANCED))
{
begin_transaction();
db_query($sql, "The work order couldn't be voided");
// void all related stock moves
- void_stock_move(systypes::work_order(), $woid);
+ void_stock_move(ST_WORKORDER, $woid);
// void any related gl trans
- void_gl_trans(systypes::work_order(), $woid, true);
+ void_gl_trans(ST_WORKORDER, $woid, true);
// clear the requirements units received
void_wo_requirements($woid);
function add_work_order_quick($wo_ref, $loc_code, $units_reqd, $stock_id, $type, $date_, $memo_, $costs, $cr_acc, $labour, $cr_lab_acc)
{
+ global $Refs;
+
begin_transaction();
// if unassembling, reverse the stock movements
- if ($type == wo_types::unassemble())
+ if ($type == WO_UNASSEMBLY)
$units_reqd = -$units_reqd;
add_material_cost($stock_id, $units_reqd, $date_);
db_query($sql, "The work order requirements could not be added");
// insert a -ve stock move for each item
- add_stock_move(systypes::work_order(), $bom_item["component"], $woid,
+ add_stock_move(ST_WORKORDER, $bom_item["component"], $woid,
$bom_item["loc_code"], $date_, $wo_ref, -$item_quantity, 0);
}
// -------------------------------------------------------------------------
// insert a +ve stock move for the item being manufactured
- add_stock_move(systypes::work_order(), $stock_id, $woid, $loc_code, $date_,
+ add_stock_move(ST_WORKORDER, $stock_id, $woid, $loc_code, $date_,
$wo_ref, $units_reqd, 0);
// -------------------------------------------------------------------------
// -------------------------------------------------------------------------
- add_comments(systypes::work_order(), $woid, $date_, $memo_);
+ add_comments(ST_WORKORDER, $woid, $date_, $memo_);
- references::save(systypes::work_order(), $woid, $wo_ref);
- add_audit_trail(systypes::work_order(), $woid, $date_,_("Quick production."));
+ $Refs->save(ST_WORKORDER, $woid, $wo_ref);
+ add_audit_trail(ST_WORKORDER, $woid, $date_,_("Quick production."));
commit_transaction();
return $woid;
}
if ($advanced)
{
// insert a -ve stock move for each item
- add_stock_move(systypes::work_order(), $bom_item["component"], $woid,
+ add_stock_move(ST_WORKORDER, $bom_item["component"], $woid,
$bom_item["loc_code"], $date_, "", -$bom_item["quantity"] * $units_reqd, 0);
}
- $total_cost += add_gl_trans_std_cost(systypes::work_order(), $woid, $date_, $bom_accounts["inventory_account"], 0, 0,
+ $total_cost += add_gl_trans_std_cost(ST_WORKORDER, $woid, $date_, $bom_accounts["inventory_account"], 0, 0,
null, -$bom_cost);
}
$standard_cost = get_standard_cost($item['stock_id']);
$issue_cost = $standard_cost * $item['qty_issued'] * $units_reqd / $wo['units_reqd'];
$issue = get_stock_gl_code($item['stock_id']);
- $total_cost += add_gl_trans_std_cost(systypes::work_order(), $woid, $date_, $issue["inventory_account"], 0, 0,
+ $total_cost += add_gl_trans_std_cost(ST_WORKORDER, $woid, $date_, $issue["inventory_account"], 0, 0,
null, -$issue_cost);
$issue_total += $issue_cost;
}
$item_accounts = get_stock_gl_code($stock_id);
if ($costs != 0.0)
{
- add_gl_trans_std_cost(systypes::work_order(), $woid, $date_, $cr_acc,
- 0, 0, $wo_cost_types[WO_OVERHEAD], -$costs, payment_person_types::WorkOrder(), WO_OVERHEAD);
+ add_gl_trans_std_cost(ST_WORKORDER, $woid, $date_, $cr_acc,
+ 0, 0, $wo_cost_types[WO_OVERHEAD], -$costs, PT_WORKORDER, WO_OVERHEAD);
$is_bank_to = is_bank_account($cr_acc);
if ($is_bank_to)
{
- add_bank_trans(systypes::work_order(), $woid, $is_bank_to, "",
- $date_, -$costs, payment_person_types::WorkOrder(), WO_OVERHEAD, get_company_currency(),
+ add_bank_trans(ST_WORKORDER, $woid, $is_bank_to, "",
+ $date_, -$costs, PT_WORKORDER, WO_OVERHEAD, get_company_currency(),
"Cannot insert a destination bank transaction");
}
- add_gl_trans_std_cost(systypes::work_order(), $woid, $date_, $item_accounts["assembly_account"],
+ add_gl_trans_std_cost(ST_WORKORDER, $woid, $date_, $item_accounts["assembly_account"],
$item_accounts["dimension_id"], $item_accounts["dimension2_id"], $wo_cost_types[WO_OVERHEAD], $costs,
- payment_person_types::WorkOrder(), WO_OVERHEAD);
+ PT_WORKORDER, WO_OVERHEAD);
}
if ($labour != 0.0)
{
- add_gl_trans_std_cost(systypes::work_order(), $woid, $date_, $cr_lab_acc,
- 0, 0, $wo_cost_types[WO_LABOUR], -$labour, payment_person_types::WorkOrder(), WO_LABOUR);
+ add_gl_trans_std_cost(ST_WORKORDER, $woid, $date_, $cr_lab_acc,
+ 0, 0, $wo_cost_types[WO_LABOUR], -$labour, PT_WORKORDER, WO_LABOUR);
$is_bank_to = is_bank_account($cr_lab_acc);
if ($is_bank_to)
{
- add_bank_trans(systypes::work_order(), $woid, $is_bank_to, "",
- $date_, -$labour, payment_person_types::WorkOrder(), WO_LABOUR, get_company_currency(),
+ add_bank_trans(ST_WORKORDER, $woid, $is_bank_to, "",
+ $date_, -$labour, PT_WORKORDER, WO_LABOUR, get_company_currency(),
"Cannot insert a destination bank transaction");
}
- add_gl_trans_std_cost(systypes::work_order(), $woid, $date_, $item_accounts["assembly_account"],
+ add_gl_trans_std_cost(ST_WORKORDER, $woid, $date_, $item_accounts["assembly_account"],
$item_accounts["dimension_id"], $item_accounts["dimension2_id"], $wo_cost_types[WO_LABOUR], $labour,
- payment_person_types::WorkOrder(), WO_LABOUR);
+ PT_WORKORDER, WO_LABOUR);
}
// debit total components $total_cost
- add_gl_trans_std_cost(systypes::work_order(), $woid, $date_, $item_accounts["inventory_account"],
+ add_gl_trans_std_cost(ST_WORKORDER, $woid, $date_, $item_accounts["inventory_account"],
0, 0, null, -$total_cost);
}
function display_wo_requirements($woid, $quantity, $show_qoh=false, $date=null)
{
- global $table_style;
+ global $table_style, $SysPrefs;
$result = get_wo_requirements($woid);
$qoh = get_qoh_on_date($myrow["stock_id"], $myrow["loc_code"], $date);
if ($show_qoh && ($myrow["units_req"] * $quantity > $qoh) &&
- !sys_prefs::allow_negative_stock())
+ !$SysPrefs->allow_negative_stock())
{
// oops, we don't have enough of one of the component items
start_row("class='stockmankobg'");
{
global $path_to_root, $table_style, $wo_cost_types;
- //$result = get_bank_trans(null, null, payment_person_types::WorkOrder(), $woid);
+ //$result = get_bank_trans(null, null, PT_WORKORDER, $woid);
$result = get_gl_wo_cost_trans($woid);
if (db_num_rows($result) == 0)
alt_table_row_color($k);
- label_cell(get_gl_view_str(systypes::work_order(), $myrow["type_no"], $myrow["type_no"]));
+ label_cell(get_gl_view_str(ST_WORKORDER, $myrow["type_no"], $myrow["type_no"]));
label_cell($wo_cost_types[$myrow['person_id']]);
$date = sql2date($myrow["tran_date"]);
label_cell($date);
function display_wo_details($woid, $suppress_view_link=false)
{
- global $table_style;
+ global $table_style, $wo_types_array;
$myrow = get_work_order($woid);
if ($suppress_view_link)
label_cell($myrow["id"]);
else
- label_cell(get_trans_view_str(systypes::work_order(), $myrow["id"]));
+ label_cell(get_trans_view_str(ST_WORKORDER, $myrow["id"]));
label_cell($myrow["wo_ref"]);
- label_cell(wo_types::name($myrow["type"]));
+ label_cell($wo_types_array[$myrow["type"]]);
view_stock_status_cell($myrow["stock_id"], $myrow["StockItemName"]);
label_cell($myrow["location_name"]);
label_cell(sql2date($myrow["date_"]));
}
end_row();
- comments_display_row(systypes::work_order(), $woid);
+ comments_display_row(ST_WORKORDER, $woid);
end_table();
function display_wo_details_quick($woid, $suppress_view_link=false)
{
- global $table_style;
+ global $table_style, $wo_types_array;
$myrow = get_work_order($woid);
if ($suppress_view_link)
label_cell($myrow["id"]);
else
- label_cell(get_trans_view_str(systypes::work_order(), $myrow["id"]));
+ label_cell(get_trans_view_str(ST_WORKORDER, $myrow["id"]));
label_cell($myrow["wo_ref"]);
- label_cell(wo_types::name($myrow["type"]));
+ label_cell($wo_types_array[$myrow["type"]]);
view_stock_status_cell($myrow["stock_id"], $myrow["StockItemName"]);
label_cell($myrow["location_name"]);
label_cell(sql2date($myrow["date_"]));
end_row();
- comments_display_row(systypes::work_order(), $woid);
+ comments_display_row(ST_WORKORDER, $woid);
end_table();
function issue_options_controls()
{
+ global $Refs;
+
echo "<br>";
start_table();
- ref_row(_("Reference:"), 'ref', '', references::get_next(28));
+ ref_row(_("Reference:"), 'ref', '', $Refs->get_next(28));
if (!isset($_POST['IssueType']))
$_POST['IssueType'] = 0;
function view_link($dummy, $order_no)
{
- return get_trans_view_str(systypes::work_order(), $order_no);
+ return get_trans_view_str(ST_WORKORDER, $order_no);
}
function view_stock($row)
function wo_type_name($dummy, $type)
{
- return wo_types::name($type);
+ global $wo_types_array;
+
+ return $wo_types_array[$type];
}
function edit_link($row)
return $row["closed"] || !$row["released"] ? '' :
pager_link(_('Costs'),
"/gl/gl_bank.php?NewPayment=1&PayType="
- .payment_person_types::WorkOrder(). "&PayPerson=" .$row["id"]);
+ .PT_WORKORDER. "&PayPerson=" .$row["id"]);
*/
return $row["closed"] || !$row["released"] ? '' :
pager_link(_('Costs'),
{
if ($row['closed'] == 0)
return '';
- return get_gl_view_str(systypes::work_order(), $row['id']);
+ return get_gl_view_str(ST_WORKORDER, $row['id']);
}
function dec_amount($row, $amount)
start_row();
label_cell($myrow["issue_no"]);
label_cell($myrow["reference"]);
- label_cell(get_trans_view_str(systypes::work_order(),$myrow["workorder_id"]));
+ label_cell(get_trans_view_str(ST_WORKORDER,$myrow["workorder_id"]));
label_cell($myrow["stock_id"] . " - " . $myrow["description"]);
label_cell($myrow["location_name"]);
label_cell($myrow["WorkCentreName"]);
//-------------------------------------------------------------------------------------------------
-display_heading(systypes::name(28) . " # " . $wo_issue_no);
+display_heading($systypes_array[ST_MANUISSUE] . " # " . $wo_issue_no);
display_wo_issue($wo_issue_no);
start_row();
label_cell($myrow["id"]);
label_cell($myrow["reference"]);
- label_cell(get_trans_view_str(systypes::work_order(),$myrow["workorder_id"]));
+ label_cell(get_trans_view_str(ST_WORKORDER,$myrow["workorder_id"]));
label_cell($myrow["stock_id"] . " - " . $myrow["StockDescription"]);
qty_cell($myrow["quantity"], false, get_qty_dec($myrow["stock_id"]));
label_cell(sql2date($myrow["date_"]));
//-------------------------------------------------------------------------------------------------
-display_heading(systypes::name(29) . " # " . $wo_production);
+display_heading($systypes_array[ST_MANURECEIVE] . " # " . $wo_production);
display_wo_production($wo_production);
$woid = $_GET['trans_no'];
}
-display_heading(systypes::name(systypes::work_order()) . " # " . $woid);
+display_heading($systypes_array[ST_WORKORDER] . " # " . $woid);
br(1);
$myrow = get_work_order($woid);
-if ($myrow["type"] == wo_types::advanced())
+if ($myrow["type"] == WO_ADVANCED)
display_wo_details($woid, true);
else
display_wo_details_quick($woid, true);
{
display_heading2(_("Work Order Requirements"));
display_wo_requirements($woid, $myrow["units_reqd"]);
- if ($myrow["type"] == wo_types::advanced())
+ if ($myrow["type"] == WO_ADVANCED)
{
echo "<br><table cellspacing=7><tr valign=top><td>";
display_heading2(_("Issues"));
echo "<br></center>";
-is_voided_display(systypes::work_order(), $woid, _("This work order has been voided."));
+is_voided_display(ST_WORKORDER, $woid, _("This work order has been voided."));
end_page(true);
{
include_once($path_to_root . "/reporting/includes/reporting.inc");
$id = $_GET['AddedID'];
- $stype = systypes::work_order();
+ $stype = ST_WORKORDER;
display_notification(_("The manufacturing process has been entered."));
function can_process()
{
- global $wo_details;
+ global $wo_details, $SysPrefs, $Refs;
- if (!references::is_valid($_POST['ref']))
+ if (!$Refs->is_valid($_POST['ref']))
{
display_error(_("You must enter a reference."));
set_focus('ref');
}
// if unassembling we need to check the qoh
- if (($_POST['ProductionType'] == 0) && !sys_prefs::allow_negative_stock())
+ if (($_POST['ProductionType'] == 0) && !$SysPrefs->allow_negative_stock())
{
$wo_details = get_work_order($_POST['selected_id']);
}
// if production we need to check the qoh of the wo requirements
- if (($_POST['ProductionType'] == 1) && !sys_prefs::allow_negative_stock())
+ if (($_POST['ProductionType'] == 1) && !$SysPrefs->allow_negative_stock())
{
$err = false;
$result = get_wo_requirements($_POST['selected_id']);
start_table($table_style2);
br();
-ref_row(_("Reference:"), 'ref', '', references::get_next(29));
+ref_row(_("Reference:"), 'ref', '', $Refs->get_next(29));
if (!isset($_POST['ProductionType']))
$_POST['ProductionType'] = 1;
if (isset($_GET['AddedID']))
{
$id = $_GET['AddedID'];
- $stype = systypes::work_order();
+ $stype = ST_WORKORDER;
display_notification(_("The additional cost has been entered."));
if (isset($_POST['process']) && can_process() == true)
{
begin_transaction();
- add_gl_trans_std_cost(systypes::work_order(), $_POST['selected_id'], $_POST['date_'], $_POST['cr_acc'],
- 0, 0, $wo_cost_types[$_POST['PaymentType']], -input_num('costs'), payment_person_types::WorkOrder(), $_POST['PaymentType']);
+ add_gl_trans_std_cost(ST_WORKORDER, $_POST['selected_id'], $_POST['date_'], $_POST['cr_acc'],
+ 0, 0, $wo_cost_types[$_POST['PaymentType']], -input_num('costs'), PT_WORKORDER, $_POST['PaymentType']);
$is_bank_to = is_bank_account($_POST['cr_acc']);
if ($is_bank_to)
{
- add_bank_trans(systypes::work_order(), $_POST['selected_id'], $is_bank_to, "",
- $_POST['date_'], -input_num('costs'), payment_person_types::WorkOrder(), $_POST['PaymentType'], get_company_currency(),
+ add_bank_trans(ST_WORKORDER, $_POST['selected_id'], $is_bank_to, "",
+ $_POST['date_'], -input_num('costs'), PT_WORKORDER, $_POST['PaymentType'], get_company_currency(),
"Cannot insert a destination bank transaction");
}
- add_gl_trans_std_cost(systypes::work_order(), $_POST['selected_id'], $_POST['date_'], $_POST['db_acc'],
- $_POST['dim1'], $_POST['dim2'], $wo_cost_types[$_POST['PaymentType']], input_num('costs'), payment_person_types::WorkOrder(),
+ add_gl_trans_std_cost(ST_WORKORDER, $_POST['selected_id'], $_POST['date_'], $_POST['db_acc'],
+ $_POST['dim1'], $_POST['dim2'], $wo_cost_types[$_POST['PaymentType']], input_num('costs'), PT_WORKORDER,
$_POST['PaymentType']);
commit_transaction();
if (isset($_GET['AddedID']))
{
$id = $_GET['AddedID'];
- $stype = systypes::work_order();
+ $stype = ST_WORKORDER;
display_notification_centered(_("The work order been added."));
display_note(get_trans_view_str($stype, $id, _("View this Work Order")));
- if ($_GET['type'] != wo_types::advanced())
+ if ($_GET['type'] != WO_ADVANCED)
{
include_once($path_to_root . "/reporting/includes/reporting.inc");
$ar = array('PARAM_0' => $id, 'PARAM_1' => $id, 'PARAM_2' => 0);
function can_process()
{
- global $selected_id;
+ global $selected_id, $SysPrefs, $Refs;
if (!isset($selected_id))
{
- if (!references::is_valid($_POST['wo_ref']))
+ if (!$Refs->is_valid($_POST['wo_ref']))
{
display_error(_("You must enter a reference."));
set_focus('wo_ref');
return false;
}
- if (!is_new_reference($_POST['wo_ref'], systypes::work_order()))
+ if (!is_new_reference($_POST['wo_ref'], ST_WORKORDER))
{
display_error(_("The entered reference is already in use."));
set_focus('wo_ref');
return false;
}
// only check bom and quantites if quick assembly
- if (!($_POST['type'] == wo_types::advanced()))
+ if (!($_POST['type'] == WO_ADVANCED))
{
if (!has_bom($_POST['stock_id']))
{
return false;
}
- if (!sys_prefs::allow_negative_stock())
+ if (!$SysPrefs->allow_negative_stock())
{
- if ($_POST['type'] == wo_types::assemble())
+ if ($_POST['type'] == WO_ASSEMBLY)
{
// check bom if assembling
$result = get_bom($_POST['stock_id']);
}
}
}
- elseif ($_POST['type'] == wo_types::unassemble())
+ elseif ($_POST['type'] == WO_UNASSEMBLY)
{
// if unassembling, check item to unassemble
$qoh = get_qoh_on_date($_POST['stock_id'], $_POST['StockLocation'], $_POST['date_']);
$_POST['units_issued'] = $myrow["units_issued"];
$_POST['Costs'] = price_format($myrow["additional_costs"]);
- $_POST['memo_'] = get_comments_string(systypes::work_order(), $selected_id);
+ $_POST['memo_'] = get_comments_string(ST_WORKORDER, $selected_id);
hidden('wo_ref', $_POST['wo_ref']);
hidden('units_issued', $_POST['units_issued']);
hidden('old_stk_id', $myrow["stock_id"]);
label_row(_("Reference:"), $_POST['wo_ref']);
- label_row(_("Type:"), wo_types::name($_POST['type']));
+ label_row(_("Type:"), $wo_types_array[$_POST['type']]);
hidden('type', $myrow["type"]);
}
else
{
$_POST['units_issued'] = $_POST['released'] = 0;
- ref_row(_("Reference:"), 'wo_ref', '', references::get_next(systypes::work_order()));
+ ref_row(_("Reference:"), 'wo_ref', '', $Refs->get_next(ST_WORKORDER));
wo_types_list_row(_("Type:"), 'type', null);
}
$_POST['quantity'] = qty_format($_POST['quantity'], $_POST['stock_id'], $dec);
-if (get_post('type') == wo_types::advanced())
+if (get_post('type') == WO_ADVANCED)
{
qty_row(_("Quantity Required:"), 'quantity', null, null, null, $dec);
if ($_POST['released'])
label_row(_("Quantity Manufactured:"), number_format($_POST['units_issued'], get_qty_dec($_POST['stock_id'])));
date_row(_("Date") . ":", 'date_', '', true);
- date_row(_("Date Required By") . ":", 'RequDate', '', null, sys_prefs::default_wo_required_by());
+ date_row(_("Date Required By") . ":", 'RequDate', '', null, $SysPrefs->default_wo_required_by());
}
else
{
{
display_notification(_("The work order issue has been entered."));
- display_note(get_trans_view_str(systypes::work_order(), $_GET['AddedID'], _("View this Work Order")));
+ display_note(get_trans_view_str(ST_WORKORDER, $_GET['AddedID'], _("View this Work Order")));
hyperlink_no_params("search_work_orders.php", _("Select another &Work Order to Process"));
function can_process()
{
+ global $Refs;
+
if (!is_date($_POST['date_']))
{
display_error(_("The entered date for the issue is invalid."));
set_focus('date_');
return false;
}
- if (!references::is_valid($_POST['ref']))
+ if (!$Refs->is_valid($_POST['ref']))
{
display_error(_("You must enter a reference."));
set_focus('ref');
display_notification(_("The work order has been released to manufacturing."));
- display_note(get_trans_view_str(systypes::work_order(), $selected_id, _("View this Work Order")));
+ display_note(get_trans_view_str(ST_WORKORDER, $selected_id, _("View this Work Order")));
hyperlink_no_params("search_work_orders.php", _("Select another &work order"));
{
start_form();
- display_heading(_("Allocation of") . " " . systypes::name($_SESSION['alloc']->type) . " # " . $_SESSION['alloc']->trans_no);
+ display_heading(_("Allocation of") . " " . $systypes_array[$_SESSION['alloc']->type] . " # " . $_SESSION['alloc']->trans_no);
display_heading($_SESSION['alloc']->person_name);
end_form();
set_global_supplier($_POST['supplier_id']);
- if (isset($_POST['supplier_id']) && ($_POST['supplier_id'] == reserved_words::get_all()))
+ if (isset($_POST['supplier_id']) && ($_POST['supplier_id'] == ALL_TEXT))
{
unset($_POST['supplier_id']);
}
//--------------------------------------------------------------------------------
function systype_name($dummy, $type)
{
- return systypes::name($type);
+ global $systypes_array;
+
+ return $systypes_array[$type;
}
function trans_view($trans)
function add_grn(&$po, $date_, $reference, $location)
{
+ global $Refs;
+
begin_transaction();
$grn = add_grn_batch($po->order_no, $po->supplier_id, $reference, $location, $date_);
} /*quantity received is != 0 */
} /*end of order_line loop */
- references::save(25, $grn, $reference);
+ $Refs->save(25, $grn, $reference);
add_audit_trail(25, $grn, $date_);
function add_supp_invoice($supp_trans, $invoice_no=0) // do not receive as ref because we change locally
{
+ global $Refs;
+
//$company_currency = get_company_currency();
/*Start an sql transaction */
begin_transaction();
}
/*Post a balance post if $total != 0 */
- add_gl_balance($trans_type, $invoice_id, $date_, -$total, payment_person_types::supplier(), $supp_trans->supplier_id);
+ add_gl_balance($trans_type, $invoice_id, $date_, -$total, PT_SUPPLIER, $supp_trans->supplier_id);
add_comments($trans_type, $invoice_id, $date_, $supp_trans->Comments);
- references::save($trans_type, $invoice_id, $supp_trans->reference);
+ $Refs->save($trans_type, $invoice_id, $supp_trans->reference);
if ($invoice_no != 0)
{
// Exchange Variations Joe Hunt 2008-09-20 ////////////////////////////////////////
exchange_variation(21, $invoice_id, 20, $invoice_no, $date_,
- $allocate_amount, payment_person_types::supplier());
+ $allocate_amount, PT_SUPPLIER);
///////////////////////////////////////////////////////////////////////////
}
function add_po(&$po_obj)
{
+ global $Refs;
+
begin_transaction();
/*Insert to purchase order header record */
}
}
- references::save(systypes::po(), $po_obj->order_no, $po_obj->reference);
+ $Refs->save(ST_PURCHORDER, $po_obj->order_no, $po_obj->reference);
- //add_comments(systypes::po(), $po_obj->order_no, $po_obj->orig_order_date, $po_obj->Comments);
+ //add_comments(ST_PURCHORDER, $po_obj->order_no, $po_obj->orig_order_date, $po_obj->Comments);
- add_audit_trail(systypes::po(), $po_obj->order_no, $po_obj->orig_order_date);
+ add_audit_trail(ST_PURCHORDER, $po_obj->order_no, $po_obj->orig_order_date);
commit_transaction();
return $po_obj->order_no;
db_query($sql, "One of the purchase order detail records could not be updated");
}
- //add_comments(systypes::po(), $po_obj->order_no, $po_obj->orig_order_date, $po_obj->Comments);
+ //add_comments(ST_PURCHORDER, $po_obj->order_no, $po_obj->orig_order_date, $po_obj->Comments);
commit_transaction();
function add_supp_payment($supplier_id, $date_, $bank_account,
$amount, $discount, $ref, $memo_, $rate=0, $charge=0)
{
+ global $Refs;
+
begin_transaction();
$supplier_currency = get_supplier_currency($supplier_id);
}
/*Post a balance post if $total != 0 */
- add_gl_balance($trans_type, $payment_id, $date_, -$total, payment_person_types::supplier(), $supplier_id);
+ add_gl_balance($trans_type, $payment_id, $date_, -$total, PT_SUPPLIER, $supplier_id);
/*now enter the bank_trans entry */
add_bank_trans($trans_type, $payment_id, $bank_account, $ref,
- $date_, -($amount + $supp_charge), payment_person_types::supplier(),
+ $date_, -($amount + $supp_charge), PT_SUPPLIER,
$supplier_id, $bank_account_currency,
"Could not add the supplier payment bank transaction");
add_comments($trans_type, $payment_id, $date_, $memo_);
- references::save($trans_type, $payment_id, $ref);
+ $Refs->save($trans_type, $payment_id, $ref);
commit_transaction();
// 2008-09-20 Joe Hunt
if ($date != "")
exchange_variation($type, $type_no, $row['trans_type_to'], $row['trans_no_to'], $date,
- $row['amt'], payment_person_types::supplier(), true);
+ $row['amt'], PT_SUPPLIER, true);
//////////////////////
}
return add_gl_trans($type, $type_no, $date_, $account, $dimension, $dimension2, $memo,
$amount, get_supplier_currency($supplier_id),
- payment_person_types::supplier(), $supplier_id, $err_msg, $rate);
+ PT_SUPPLIER, $supplier_id, $err_msg, $rate);
}
//----------------------------------------------------------------------------------------
function display_grn_summary(&$po, $editable=false)
{
- global $table_style2;
+ global $table_style2, $Refs;
start_table("$table_style2 width=90%");
start_row();
if (!is_company_currency($po->curr_code))
label_cells(_("Order Currency"), $po->curr_code, "class='tableheader2'");
- label_cells(_("For Purchase Order"), get_trans_view_str(systypes::po(), $po->order_no),
+ label_cells(_("For Purchase Order"), get_trans_view_str(ST_PURCHORDER, $po->order_no),
"class='tableheader2'");
label_cells(_("Ordered On"), $po->orig_order_date, "class='tableheader2'");
if ($editable)
{
if (!isset($_POST['ref']))
- $_POST['ref'] = references::get_next(25);
+ $_POST['ref'] = $Refs->get_next(25);
ref_cells(_("Reference"), 'ref', '', null, "class='tableheader2'");
if (!isset($_POST['Location']))
function invoice_header(&$supp_trans)
{
- global $Ajax, $table_style;
+ global $Ajax, $table_style, $Refs;
// if vars have been lost, recopy
if (!isset($_POST['tran_date']))
}
else
{
- if (!isset($_POST['supplier_id']) && (get_global_supplier() != reserved_words::get_all()))
+ if (!isset($_POST['supplier_id']) && (get_global_supplier() != ALL_TEXT))
$_POST['supplier_id'] = get_global_supplier();
supplier_list_row(_("Supplier:"), 'supplier_id', $_POST['supplier_id'], false, true);
}
if ($supp_trans->is_invoice)
- ref_row(_("Reference:"), 'reference', '', references::get_next(20));
+ ref_row(_("Reference:"), 'reference', '', $Refs->get_next(20));
else
- ref_row(_("Reference:"), 'reference', '', references::get_next(21));
+ ref_row(_("Reference:"), 'reference', '', $Refs->get_next(21));
if (isset($_POST['invoice_no']))
{
hidden('order_price'.$n, $myrow['unit_price'], false).
hidden('std_cost_unit'.$n, $myrow['std_cost_unit'], false).
hidden('po_detail_item'.$n, $myrow['po_detail_item'], false));
- label_cell(get_trans_view_str(systypes::po(), $myrow["purch_order_no"]));
+ label_cell(get_trans_view_str(ST_PURCHORDER, $myrow["purch_order_no"]));
label_cell($myrow["item_code"]);
label_cell($myrow["description"]);
label_cell(sql2date($myrow["delivery_date"]));
function display_po_header(&$order)
{
- global $table_style2, $Ajax;
+ global $table_style2, $Ajax, $Refs;
$editable = ($order->order_no == 0);
table_section(1);
if ($editable)
{
- if (!isset($_POST['supplier_id']) && (get_global_supplier() != reserved_words::get_all()))
+ if (!isset($_POST['supplier_id']) && (get_global_supplier() != ALL_TEXT))
$_POST['supplier_id'] = get_global_supplier();
supplier_list_row(_("Supplier:"), 'supplier_id', null, false, true, false, true);
if ($editable)
{
- ref_row(_("Reference:"), 'ref', '', references::get_next(systypes::po()));
+ ref_row(_("Reference:"), 'ref', '', $Refs->get_next(ST_PURCHORDER));
}
else
{
if (!$is_self)
{
- label_cells(_("Purchase Order"), get_trans_view_str(systypes::po(), $po->order_no),
+ label_cells(_("Purchase Order"), get_trans_view_str(ST_PURCHORDER, $po->order_no),
"class='tableheader2'");
}
end_row();
//---------------------------------------------------------------------------------------------
function trans_view($trans)
{
- return get_trans_view_str(systypes::po(), $trans["order_no"]);
+ return get_trans_view_str(ST_PURCHORDER, $trans["order_no"]);
}
function edit_link($row)
}
if (isset($_POST['SelectStockFromList']) && ($_POST['SelectStockFromList'] != "") &&
- ($_POST['SelectStockFromList'] != reserved_words::get_all()))
+ ($_POST['SelectStockFromList'] != ALL_TEXT))
{
$selected_stock_item = $_POST['SelectStockFromList'];
}
//---------------------------------------------------------------------------------------------
function trans_view($trans)
{
- return get_trans_view_str(systypes::po(), $trans["order_no"]);
+ return get_trans_view_str(ST_PURCHORDER, $trans["order_no"]);
}
function edit_link($row)
$sql .= " AND porder.ord_date >= '$data_after'";
$sql .= " AND porder.ord_date <= '$date_before'";
- if (isset($_POST['StockLocation']) && $_POST['StockLocation'] != reserved_words::get_all())
+ if (isset($_POST['StockLocation']) && $_POST['StockLocation'] != ALL_TEXT)
{
$sql .= " AND porder.into_stock_location = '". $_POST['StockLocation'] . "' ";
}
function systype_name($dummy, $type)
{
- return systypes::name($type);
+ global $systypes_array;
+
+ return $systypes_array[$type];
}
function view_link($trans)
WHERE supplier.supplier_id = trans.supplier_id
AND trans.tran_date >= '$date_after'
AND trans.tran_date <= '$date_to'";
- if ($_POST['supplier_id'] != reserved_words::get_all())
+ if ($_POST['supplier_id'] != ALL_TEXT)
$sql .= " AND trans.supplier_id = '" . $_POST['supplier_id'] . "'";
- if (isset($_POST['filterType']) && $_POST['filterType'] != reserved_words::get_all())
+ if (isset($_POST['filterType']) && $_POST['filterType'] != ALL_TEXT)
{
if (($_POST['filterType'] == '1') || ($_POST['filterType'] == '2'))
{
array('insert'=>true, 'fun'=>'alloc_link')
);
-if ($_POST['supplier_id'] != reserved_words::get_all()) {
+if ($_POST['supplier_id'] != ALL_TEXT) {
$cols[_("Supplier")] = 'skip';
$cols[_("Currency")] = 'skip';
}
//------------------------------------------------------------------------------------------------
div_start('totals_tbl');
-if (($_POST['supplier_id'] != "") && ($_POST['supplier_id'] != reserved_words::get_all()))
+if (($_POST['supplier_id'] != "") && ($_POST['supplier_id'] != ALL_TEXT))
{
$supplier_record = get_supplier_details($_POST['supplier_id']);
display_supplier_summary($supplier_record);
//------------------------------------------------------------------------------------------------
function systype_name($dummy, $type)
{
- return systypes::name($type);
+ global $systypes_array;
+ return $systypes_array[$type];
}
function trans_view($trans)
AND trans.tran_date >= '$date_after'
AND trans.tran_date <= '$date_to'
AND trans.ov_amount != 0"; // exclude voided transactions
- if ($_POST['supplier_id'] != reserved_words::get_all())
+ if ($_POST['supplier_id'] != ALL_TEXT)
$sql .= " AND trans.supplier_id = '" . $_POST['supplier_id'] . "'";
- if (isset($_POST['filterType']) && $_POST['filterType'] != reserved_words::get_all())
+ if (isset($_POST['filterType']) && $_POST['filterType'] != ALL_TEXT)
{
if (($_POST['filterType'] == '1'))
{
array('insert'=>true, 'fun'=>'credit_link')
);
-if ($_POST['supplier_id'] != reserved_words::get_all())
+if ($_POST['supplier_id'] != ALL_TEXT)
{
$cols[_("Supplier")] = 'skip';
$cols[_("Currency")] = 'skip';
if (isset($_GET['AddedID']))
{
$order_no = $_GET['AddedID'];
- $trans_type = systypes::po();
+ $trans_type = ST_PURCHORDER;
if (!isset($_GET['Updated']))
display_notification_centered(_("Purchase Order has been entered"));
function can_commit()
{
+ global $Refs;
+
if (!is_date($_POST['OrderDate']))
{
display_error(_("The entered order date is invalid."));
if (!$_SESSION['PO']->order_no)
{
- if (!references::is_valid(get_post('ref')))
+ if (!$Refs->is_valid(get_post('ref')))
{
display_error(_("There is no reference entered for this purchase order."));
set_focus('ref');
return false;
}
- if (!is_new_reference(get_post('ref'), systypes::po()))
+ if (!is_new_reference(get_post('ref'), ST_PURCHORDER))
{
display_error(_("The entered reference is already in use."));
set_focus('ref');
function can_process()
{
+ global $SysPrefs, $Refs;
+
if (count($_SESSION['PO']->line_items) <= 0)
{
display_error(_("There is nothing to process. Please enter valid quantities greater than zero."));
return false;
}
- if (!references::is_valid($_POST['ref']))
+ if (!$Refs->is_valid($_POST['ref']))
{
display_error(_("You must enter a reference."));
set_focus('ref');
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)))
+ $order_line->quantity * (1+ ($SysPrefs->over_receive_allowance() / 100)))
{
$delivery_qty_too_large = 1;
break;
}
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() ."%)."
+ display_error(_("Entered quantities cannot be greater than the quantity entered on the purchase order including the allowed over-receive percentage") . " (" . $SysPrefs->over_receive_allowance() ."%)."
. "<br>" .
_("Modify the ordered items on the purchase order if you wish to increase the quantities."));
return false;
function check_data()
{
- global $total_grn_value, $total_gl_value;
+ global $total_grn_value, $total_gl_value, $Refs;
if (!$_SESSION['supp_trans']->is_valid_trans_to_post())
{
return false;
}
- if (!references::is_valid($_SESSION['supp_trans']->reference))
+ if (!$Refs->is_valid($_SESSION['supp_trans']->reference))
{
display_error(_("You must enter an credit note reference."));
set_focus('reference');
return false;
}
- if (!references::is_valid($_SESSION['supp_trans']->supp_reference))
+ if (!$Refs->is_valid($_SESSION['supp_trans']->supp_reference))
{
display_error(_("You must enter a supplier's credit note reference."));
set_focus('supp_reference');
function check_data()
{
- If (!$_SESSION['supp_trans']->is_valid_trans_to_post())
+ global $Refs;
+
+ if (!$_SESSION['supp_trans']->is_valid_trans_to_post())
{
display_error(_("The invoice cannot be processed because the there are no items or values on the invoice. Invoices are expected to have a charge."));
return false;
}
- if (!references::is_valid($_SESSION['supp_trans']->reference))
+ if (!$Refs->is_valid($_SESSION['supp_trans']->reference))
{
display_error(_("You must enter an invoice reference."));
set_focus('reference');
return false;
}
- if (!references::is_valid($_SESSION['supp_trans']->supp_reference))
+ if (!$Refs->is_valid($_SESSION['supp_trans']->supp_reference))
{
display_error(_("You must enter a supplier's invoice reference."));
set_focus('supp_reference');
function check_item_data($n)
{
global $check_price_charged_vs_order_price,
- $check_qty_charged_vs_del_qty;
+ $check_qty_charged_vs_del_qty, $SysPrefs;
if (!check_num('this_quantity_inv'.$n, 0) || input_num('this_quantity_inv'.$n)==0)
{
display_error( _("The quantity to invoice must be numeric and greater than zero."));
return false;
}
+ $margin = $SysPrefs->over_charge_allowance();
if ($check_price_charged_vs_order_price == True)
{
if ($_POST['order_price'.$n]!=input_num('ChgPrice'.$n)) {
if ($_POST['order_price'.$n]==0 ||
input_num('ChgPrice'.$n)/$_POST['order_price'.$n] >
- (1 + (sys_prefs::over_charge_allowance() / 100)))
+ (1 + ($margin/ 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.") .
- _("The over-charge percentage allowance is :") . sys_prefs::over_charge_allowance() . "%");
+ _("The over-charge percentage allowance is :") . $margin . "%");
set_focus('ChgPrice'.$n);
return false;
}
if ($check_qty_charged_vs_del_qty == True)
{
if (input_num('this_quantity_inv'.$n) / ($_POST['qty_recd'.$n] - $_POST['prev_quantity_inv'.$n]) >
- (1+ (sys_prefs::over_charge_allowance() / 100)))
+ (1+ ($margin / 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.")
- . _("The over-charge percentage allowance is :") . sys_prefs::over_charge_allowance() . "%");
+ . _("The over-charge percentage allowance is :") . $margin . "%");
set_focus('this_quantity_inv'.$n);
return false;
}
function check_inputs()
{
+ global $Refs;
+
if ($_POST['amount'] == "")
{
$_POST['amount'] = price_format(0);
set_focus('DatePaid');
return false;
}
- if (!references::is_valid($_POST['ref']))
+ if (!$Refs->is_valid($_POST['ref']))
{
display_error(_("You must enter a reference."));
set_focus('ref');
table_section(2);
- ref_row(_("Reference:"), 'ref', '', references::get_next(22));
+ ref_row(_("Reference:"), 'ref', '', $Refs->get_next(22));
date_row(_("Date Paid") . ":", 'DatePaid', '', true, 0, 0, 0, null, true);
if (!$voided)
{
- display_allocations_from(payment_person_types::supplier(), $supp_trans->supplier_id, 21, $trans_no, -($supp_trans->ov_amount + $supp_trans->ov_gst));
+ display_allocations_from(PT_SUPPLIER, $supp_trans->supplier_id, 21, $trans_no, -($supp_trans->ov_amount + $supp_trans->ov_gst));
}
end_page(true);
if ($show_currencies)
label_cells(_("Payment Currency"), $receipt['bank_curr_code'], "class='tableheader2'");
label_cells(_("Amount"), number_format2(-$receipt['BankAmount'], user_price_dec()), "class='tableheader2'");
-label_cells(_("Payment Type"), bank_account_types::transfer_type($receipt['BankTransType']), "class='tableheader2'");
+label_cells(_("Payment Type"), $bank_transfer_typea[$receipt['BankTransType']], "class='tableheader2'");
end_row();
start_row();
if ($show_currencies)
// now display the allocations for this payment
if (!$voided)
{
- display_allocations_from(payment_person_types::supplier(), $receipt['supplier_id'], 22, $trans_no, -$receipt['Total']);
+ display_allocations_from(PT_SUPPLIER, $receipt['supplier_id'], 22, $trans_no, -$receipt['Total']);
}
end_page(true);
***********************************************************************/
// New version (without vertical lines)
+ global $wo_types_array;
+
$this->row = $this->pageHeight - $this->topMargin;
$upper = $this->row - 2 * $this->lineHeight;
$this->TextWrap($col, $this->row, $width, $row['salesman_name'], 'C');
}
elseif ($doctype == 26)
- $this->TextWrap($col, $this->row, $width, wo_types::name($myrow["type"]), 'C');
+ $this->TextWrap($col, $this->row, $width, $wo_types_array[$myrow["type"]], 'C');
$col += $width;
if ($doctype == 26)
$this->TextWrap($col, $this->row, $width, $myrow["StockItemName"], 'C');
switch ($type_no)
{
- case systypes::sales_quotation() :
+ case ST_SALESQUOTE :
$rep = 111;
// from, to, currency, bank acc, email, quote, comments
$ar = array(
'PARAM_4' => $email,
'PARAM_5' => "");
break;
- case systypes::sales_order() :
+ case ST_SALESORDER :
$rep = 109;
// from, to, currency, bank acc, email, quote, comments
$ar = array(
'PARAM_5' => 0,
'PARAM_6' => "");
break;
- case systypes::cust_dispatch() :
+ case ST_CUSTDELIVERY :
$rep = 110;
// from, to, email, comments
$ar = array(
'PARAM_6' => "",
'PARAM_7' => $type_no);
break;
- case systypes::po() :
+ case ST_PURCHORDER :
$rep = 209;
// from, to, currency, bank acc, email, comments
$ar = array(
if ($all_option == true)
{
if ($all_option_numeric)
- $reserved_word = reserved_words::get_all_numeric();
+ $reserved_word = ALL_NUMERIC;
else
- $reserved_word = reserved_words::get_all();
+ $reserved_word = ALL_TEXT;
if ($reserved_word == $selected_id)
{
$st = "<select name='$name'>";
if ($all_option == true)
{
- $reserved_word = reserved_words::get_all_numeric();
+ $reserved_word = ALL_NUMERIC;
if ($reserved_word == $selected_id)
$st .= "<option selected value='" . $reserved_word . "'>" . $all_option_name . "</option>\n";
else
function print_customer_balances()
{
- global $path_to_root;
+ global $path_to_root, $systypes_array;
$from = $_POST['PARAM_0'];
$to = $_POST['PARAM_1'];
else
include_once($path_to_root . "/reporting/includes/pdf_report.inc");
- if ($fromcust == reserved_words::get_all_numeric())
+ if ($fromcust == ALL_NUMERIC)
$cust = _('All');
else
$cust = get_customer_name($fromcust);
$dec = user_price_dec();
- if ($currency == reserved_words::get_all())
+ if ($currency == ALL_TEXT)
{
$convert = true;
$currency = _('Balances in Home Currency');
$grandtotal = array(0,0,0,0);
$sql = "SELECT debtor_no, name, curr_code FROM ".TB_PREF."debtors_master ";
- if ($fromcust != reserved_words::get_all_numeric())
+ if ($fromcust != ALL_NUMERIC)
$sql .= "WHERE debtor_no=$fromcust ";
$sql .= "ORDER BY name";
$result = db_query($sql, "The customers could not be retrieved");
while ($trans = db_fetch($res))
{
$rep->NewLine(1, 2);
- $rep->TextCol(0, 1, systypes::name($trans['type']));
+ $rep->TextCol(0, 1, $systypes_array[$trans['type']]);
$rep->TextCol(1, 2, $trans['reference']);
$rep->DateCol(2, 3, $trans['tran_date'], true);
if ($trans['type'] == 10)
function print_aged_customer_analysis()
{
- global $comp_path, $path_to_root;
+ global $comp_path, $path_to_root, $systypes_array;
$to = $_POST['PARAM_0'];
$fromcust = $_POST['PARAM_1'];
$pg = new graph();
}
- if ($fromcust == reserved_words::get_all_numeric())
+ if ($fromcust == ALL_NUMERIC)
$from = _('All');
else
$from = get_customer_name($fromcust);
$summary = _('Summary Only');
else
$summary = _('Detailed Report');
- if ($currency == reserved_words::get_all())
+ if ($currency == ALL_TEXT)
{
$convert = true;
$currency = _('Balances in Home Currency');
$total = array(0,0,0,0, 0);
$sql = "SELECT debtor_no, name, curr_code FROM ".TB_PREF."debtors_master ";
- if ($fromcust != reserved_words::get_all_numeric())
+ if ($fromcust != ALL_NUMERIC)
$sql .= "WHERE debtor_no=$fromcust ";
$sql .= "ORDER BY name";
$result = db_query($sql, "The customers could not be retrieved");
while ($trans=db_fetch($res))
{
$rep->NewLine(1, 2);
- $rep->TextCol(0, 1, systypes::name($trans['type']), -2);
+ $rep->TextCol(0, 1, $systypes_array[$trans['type']], -2);
$rep->TextCol(1, 2, $trans['reference'], -2);
$rep->DateCol(2, 3, $trans['tran_date'], true, -2);
if ($trans['type'] == 11 || $trans['type'] == 12 || $trans['type'] == 2)
$dec = 0;
- if ($area == reserved_words::get_all_numeric())
+ if ($area == ALL_NUMERIC)
$area = 0;
- if ($folk == reserved_words::get_all_numeric())
+ if ($folk == ALL_NUMERIC)
$folk = 0;
if ($area == 0)
$dec = user_price_dec();
$home_curr = get_company_pref('curr_default');
- if ($currency == reserved_words::get_all())
+ if ($currency == ALL_TEXT)
$currency = $home_curr;
$curr = get_currency($currency);
$curr_sel = $currency . " - " . $curr['currency'];
- if ($category == reserved_words::get_all_numeric())
+ if ($category == ALL_NUMERIC)
$category = 0;
- if ($salestype == reserved_words::get_all_numeric())
+ if ($salestype == ALL_NUMERIC)
$salestype = 0;
if ($category == 0)
$cat = _('All');
else
include_once($path_to_root . "/reporting/includes/pdf_report.inc");
- if ($category == reserved_words::get_all_numeric())
+ if ($category == ALL_NUMERIC)
$category = 0;
- if ($location == reserved_words::get_all())
+ if ($location == ALL_TEXT)
$location = null;
if ($category == 0)
$cat = _('All');
function print_statements()
{
- global $path_to_root;
+ global $path_to_root, $systypes_array;
include_once($path_to_root . "/reporting/includes/pdf_report.inc");
}
$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())
+ if ($customer != ALL_NUMERIC)
$sql .= " WHERE debtor_no = $customer";
else
$sql .= " ORDER by name";
$DisplayAlloc = number_format2($myrow2["Allocated"],$dec);
$DisplayNet = number_format2($myrow2["TotalAmount"] - $myrow2["Allocated"],$dec);
- $rep->TextCol(0, 1, systypes::name($myrow2['type']), -2);
+ $rep->TextCol(0, 1, $systypes_array[$myrow2['type']], -2);
$rep->TextCol(1, 2, $myrow2['reference'], -2);
$rep->TextCol(2, 3, sql2date($myrow2['tran_date']), -2);
if ($myrow2['type'] == 10)
function print_supplier_balances()
{
- global $path_to_root;
+ global $path_to_root, $systypes_array;
$from = $_POST['PARAM_0'];
$to = $_POST['PARAM_1'];
else
include_once($path_to_root . "/reporting/includes/pdf_report.inc");
- if ($fromsupp == reserved_words::get_all_numeric())
+ if ($fromsupp == ALL_NUMERIC)
$supp = _('All');
else
$supp = get_supplier_name($fromsupp);
$dec = user_price_dec();
- if ($currency == reserved_words::get_all())
+ if ($currency == ALL_TEXT)
{
$convert = true;
$currency = _('Balances in Home currency');
$grandtotal = array(0,0,0,0);
$sql = "SELECT supplier_id, supp_name AS name, curr_code FROM ".TB_PREF."suppliers ";
- if ($fromsupp != reserved_words::get_all_numeric())
+ if ($fromsupp != ALL_NUMERIC)
$sql .= "WHERE supplier_id=$fromsupp ";
$sql .= "ORDER BY supp_name";
$result = db_query($sql, "The customers could not be retrieved");
while ($trans=db_fetch($res))
{
$rep->NewLine(1, 2);
- $rep->TextCol(0, 1, systypes::name($trans['type']));
+ $rep->TextCol(0, 1, $systypes_array[$trans['type']]);
$rep->TextCol(1, 2, $trans['reference']);
$rep->DateCol(2, 3, $trans['tran_date'], true);
if ($trans['type'] == 20)
function print_aged_supplier_analysis()
{
- global $comp_path, $path_to_root;
+ global $comp_path, $path_to_root, $systypes_array;
$to = $_POST['PARAM_0'];
$fromsupp = $_POST['PARAM_1'];
$pg = new graph();
}
- if ($fromsupp == reserved_words::get_all_numeric())
+ if ($fromsupp == ALL_NUMERIC)
$from = _('All');
else
$from = get_supplier_name($fromsupp);
$summary = _('Summary Only');
else
$summary = _('Detailed Report');
- if ($currency == reserved_words::get_all())
+ if ($currency == ALL_TEXT)
{
$convert = true;
$currency = _('Balances in Home Currency');
$pastdue2 = _('Over') . " " . $PastDueDays2 . " " . _('Days');
$sql = "SELECT supplier_id, supp_name AS name, curr_code FROM ".TB_PREF."suppliers ";
- if ($fromsupp != reserved_words::get_all_numeric())
+ if ($fromsupp != ALL_NUMERIC)
$sql .= "WHERE supplier_id=$fromsupp ";
$sql .= "ORDER BY supp_name";
$result = db_query($sql, "The suppliers could not be retrieved");
while ($trans=db_fetch($res))
{
$rep->NewLine(1, 2);
- $rep->TextCol(0, 1, systypes::name($trans['type']), -2);
+ $rep->TextCol(0, 1, $systypes_array[$trans['type']], -2);
$rep->TextCol(1, 2, $trans['reference'], -2);
$rep->TextCol(2, 3, sql2date($trans['tran_date']), -2);
foreach ($trans as $i => $value)
function print_payment_report()
{
- global $path_to_root;
+ global $path_to_root, $systypes_array;
$to = $_POST['PARAM_0'];
$fromsupp = $_POST['PARAM_1'];
else
include_once($path_to_root . "/reporting/includes/pdf_report.inc");
- if ($fromsupp == reserved_words::get_all_numeric())
+ if ($fromsupp == ALL_NUMERIC)
$from = _('All');
else
$from = get_supplier_name($fromsupp);
$dec = user_price_dec();
- if ($currency == reserved_words::get_all())
+ if ($currency == ALL_TEXT)
{
$convert = true;
$currency = _('Balances in Home Currency');
$sql = "SELECT supplier_id, supp_name AS name, curr_code, ".TB_PREF."payment_terms.terms FROM ".TB_PREF."suppliers, ".TB_PREF."payment_terms
WHERE ";
- if ($fromsupp != reserved_words::get_all_numeric())
+ if ($fromsupp != ALL_NUMERIC)
$sql .= "supplier_id=$fromsupp AND ";
$sql .= "".TB_PREF."suppliers.payment_terms = ".TB_PREF."payment_terms.terms_indicator
ORDER BY supp_name";
else
$rate = 1.0;
$rep->NewLine(1, 2);
- $rep->TextCol(0, 1, systypes::name($trans['type']));
+ $rep->TextCol(0, 1, $systypes_array[$trans['type']]);
$rep->TextCol(1, 2, $trans['supp_reference']);
if ($trans['type'] == 20)
$rep->DateCol(2, 3, $trans['due_date'], true);
AND ".TB_PREF."grn_batch.id = ".TB_PREF."grn_items.grn_batch_id
AND ".TB_PREF."grn_items.po_detail_item = ".TB_PREF."purch_order_details.po_detail_item
AND qty_recd-quantity_inv <>0 ";
- if ($fromsupp != reserved_words::get_all_numeric())
+ if ($fromsupp != ALL_NUMERIC)
$sql .= "AND ".TB_PREF."grn_batch.supplier_id ='" . $fromsupp . "' ";
$sql .= "ORDER BY ".TB_PREF."grn_batch.supplier_id,
".TB_PREF."grn_batch.id";
else
include_once($path_to_root . "/reporting/includes/pdf_report.inc");
- if ($fromsupp == reserved_words::get_all_numeric())
+ if ($fromsupp == ALL_NUMERIC)
$from = _('All');
else
$from = get_supplier_name($fromsupp);
$dec = user_price_dec();
- if ($category == reserved_words::get_all_numeric())
+ if ($category == ALL_NUMERIC)
$category = 0;
if ($category == 0)
$cat = _('All');
else
$cat = get_category_name($category);
- if ($location == reserved_words::get_all())
+ if ($location == ALL_TEXT)
$location = 'all';
if ($location == 'all')
$loc = _('All');
else
include_once($path_to_root . "/reporting/includes/pdf_report.inc");
- if ($category == reserved_words::get_all_numeric())
+ if ($category == ALL_NUMERIC)
$category = 0;
if ($category == 0)
$cat = _('All');
else
$cat = get_category_name($category);
- if ($location == reserved_words::get_all())
+ if ($location == ALL_TEXT)
$location = 'all';
if ($location == 'all')
$loc = _('All');
else
include_once($path_to_root . "/reporting/includes/pdf_report.inc");
- if ($category == reserved_words::get_all_numeric())
+ if ($category == ALL_NUMERIC)
$category = 0;
if ($category == 0)
$cat = _('All');
else
$cat = get_category_name($category);
- if ($location == reserved_words::get_all())
+ if ($location == ALL_TEXT)
$location = 'all';
if ($location == 'all')
$loc = _('All');
$dec = user_price_dec();
- if ($category == reserved_words::get_all_numeric())
+ if ($category == ALL_NUMERIC)
$category = 0;
if ($category == 0)
$cat = _('All');
else
$cat = get_category_name($category);
- if ($location == reserved_words::get_all())
+ if ($location == ALL_TEXT)
$location = 'all';
if ($location == 'all')
$loc = _('All');
else
$loc = get_location_name($location);
- if ($fromcust == reserved_words::get_all_numeric())
+ if ($fromcust == ALL_NUMERIC)
$fromc = _('All');
else
$fromc = get_customer_name($fromcust);
$cols = array(0, 75, 175, 250, 300, 375, 450, 515);
$headers = array(_('Category'), _('Description'), _('Customer'), _('Qty'), _('Sales'), _('Cost'), _('Contribution'));
- if ($fromcust != reserved_words::get_all_numeric())
+ if ($fromcust != ALL_NUMERIC)
$headers[2] = '';
$aligns = array('left', 'left', 'left', 'right', 'right', 'right', 'right');
$rep->NewLine();
$rep->fontsize -= 2;
$rep->TextCol(0, 1, $trans['stock_id']);
- if ($fromcust == reserved_words::get_all_numeric())
+ if ($fromcust == ALL_NUMERIC)
{
$rep->TextCol(1, 2, $trans['description']);
$rep->TextCol(2, 3, $trans['debtor_name']);
function print_workorders()
{
- global $path_to_root;
+ global $path_to_root, $SysPrefs;
include_once($path_to_root . "/reporting/includes/pdf_report.inc");
$qoh = get_qoh_on_date($myrow2["stock_id"], $myrow2["loc_code"], $date_);
if ($show_qoh && ($myrow2["units_req"] * $myrow["units_issued"] > $qoh) &&
- !sys_prefs::allow_negative_stock())
+ !$SysPrefs->allow_negative_stock())
{
// oops, we don't have enough of one of the component items
$has_marked = true;
function print_bank_transactions()
{
- global $path_to_root;
+ global $path_to_root, $systypes_array;
$acc = $_POST['PARAM_0'];
$from = $_POST['PARAM_1'];
{
$total += $myrow['amount'];
- $rep->TextCol(0, 1, systypes::name($myrow["type"]));
+ $rep->TextCol(0, 1, $systypes_array[$myrow["type"]]);
$rep->TextCol(1, 2, $myrow['trans_no']);
$rep->TextCol(2, 3, $myrow['ref']);
$rep->DateCol(3, 4, $myrow["trans_date"], true);
- $rep->TextCol(4, 5, payment_person_types::person_name($myrow["person_type_id"],$myrow["person_id"], false));
+ $rep->TextCol(4, 5, payment_person_name($myrow["person_type_id"],$myrow["person_id"], false));
if ($myrow['amount'] > 0.0)
$rep->AmountCol(5, 6, abs($myrow['amount']), $dec);
else
function print_list_of_journal_entries()
{
- global $path_to_root;
+ global $path_to_root, $systypes_array;
$from = $_POST['PARAM_0'];
$to = $_POST['PARAM_1'];
$params = array( 0 => $comments,
1 => array('text' => _('Period'), 'from' => $from,'to' => $to),
- 2 => array('text' => _('Type'), 'from' => systypes::name($systype),
+ 2 => array('text' => _('Type'), 'from' => $systypes_array[$systype],
'to' => ''));
$rep = new FrontReport(_('List of Journal Entries'), "JournalEntries", user_pagesize());
}
$typeno = $myrow['type_no'];
$type = $myrow['type'];
- $TransName = systypes::name($myrow['type']);
+ $TransName = $systypes_array[$myrow['type']];
$rep->TextCol(0, 1, $TransName . " # " . $myrow['type_no']);
$rep->TextCol(1, 2, get_reference($myrow['type'], $myrow['type_no']));
$rep->DateCol(2, 3, $myrow['tran_date'], true);
- $coms = payment_person_types::person_name($myrow["person_type_id"],$myrow["person_id"]);
+ $coms = payment_person_name($myrow["person_type_id"],$myrow["person_id"]);
$memo = get_comments_string($myrow['type'], $myrow['type_no']);
if ($memo != '')
{
function print_GL_transactions()
{
- global $path_to_root;
+ global $path_to_root, $systypes_array;
$dim = get_company_pref('use_dimension');
$dimension = $dimension2 = 0;
{
$total += $myrow['amount'];
- $rep->TextCol(0, 1, systypes::name($myrow["type"]));
+ $rep->TextCol(0, 1, $systypes_array[$myrow["type"]]);
$rep->TextCol(1, 2, $myrow['type_no']);
$rep->DateCol(2, 3, $myrow["tran_date"], true);
if ($dim >= 1)
$rep->TextCol(3, 4, get_dimension_string($myrow['dimension_id']));
if ($dim > 1)
$rep->TextCol(4, 5, get_dimension_string($myrow['dimension2_id']));
- $rep->TextCol(5, 6, payment_person_types::person_name($myrow["person_type_id"],$myrow["person_id"], false));
+ $rep->TextCol(5, 6, payment_person_name($myrow["person_type_id"],$myrow["person_id"], false));
if ($myrow['amount'] > 0.0)
$rep->AmountCol(6, 7, abs($myrow['amount']), $dec);
else
function print_tax_report()
{
- global $path_to_root, $trans_dir, $Hooks;
+ global $path_to_root, $trans_dir, $Hooks, $systypes_array;
$from = $_POST['PARAM_0'];
$to = $_POST['PARAM_1'];
if (!$summaryOnly)
{
- $rep->TextCol(0, 1, systypes::name($trans['trans_type']));
+ $rep->TextCol(0, 1, $systypes_array[$trans['trans_type']]);
if ($trans['memo'] == '')
$trans['memo'] = get_reference($trans['trans_type'], $trans['trans_no']);
$rep->TextCol(1, 2, $trans['memo']);
function print_audit_trail()
{
- global $path_to_root;
+ global $path_to_root, $systypes_array;
$from = $_POST['PARAM_0'];
$to = $_POST['PARAM_1'];
$user_id = $usr['user_id'];
$params = array( 0 => $comments,
1 => array('text' => _('Period'), 'from' => $from,'to' => $to),
- 2 => array('text' => _('Type'), 'from' => ($systype != -1 ? systypes::name($systype) : _('All')), 'to' => ''),
+ 2 => array('text' => _('Type'), 'from' => ($systype != -1 ? $systypes_array[$systype] : _('All')), 'to' => ''),
3 => array('text' => _('User'), 'from' => ($user != -1 ? $user_id : _('All')), 'to' => ''));
$rep = new FrontReport(_('Audit Trail'), "AuditTrail", user_pagesize());
$rep->TextCol(1, 2, date("H:i:s", $myrow['unix_stamp']));
$rep->TextCol(2, 3, $myrow['user_id']);
$rep->TextCol(3, 4, sql2date($myrow['gl_date']));
- $rep->TextCol(4, 5, systypes::name($myrow['type']));
+ $rep->TextCol(4, 5, $systypes_array[$myrow['type']]);
$rep->TextCol(5, 6, $myrow['trans_no']);
if ($myrow['gl_seq'] == null)
$action = _('Changed');
function edit_allocations_for_transaction($type, $trans_no)
{
+ global $systypes_array;
- display_heading(sprintf(_("Allocation of %s # %d"), systypes::name($_SESSION['alloc']->type),$_SESSION['alloc']->trans_no));
+ display_heading(sprintf(_("Allocation of %s # %d"), $systypes_array[$_SESSION['alloc']->type],
+ $_SESSION['alloc']->trans_no));
display_heading($_SESSION['alloc']->person_name);
set_global_customer($_POST['customer_id']);
- if (isset($_POST['customer_id']) && ($_POST['customer_id'] == reserved_words::get_all()))
+ if (isset($_POST['customer_id']) && ($_POST['customer_id'] == ALL_TEXT))
{
unset($_POST['customer_id']);
}
//--------------------------------------------------------------------------------
function systype_name($dummy, $type)
{
- return systypes::name($type);
+ global $systypes_array;
+
+ return $systypes_array[$type];
}
function trans_view($trans)
$sql = "UPDATE ".TB_PREF."recurrent_invoices SET last_sent='$date' WHERE id=$id";
db_query($sql,"The recurrent invoice could not be updated or added");
}
-
+
function create_recurrent_invoices($customer_id, $branch_id, $order_no, $tmpl_no)
{
+ global $Refs;
+
$doc = new Cart(30, array($order_no));
get_customer_details_to_order($doc, $customer_id, $branch_id);
$doc->document_date = Today(); // 2006-06-15. Added so Invoices and Deliveries get current day
$doc->due_date = get_invoice_duedate($doc->customer_id, $doc->document_date);
- $doc->reference = references::get_next($doc->trans_type);
+ $doc->reference = $Refs->get_next($doc->trans_type);
//$doc->Comments='';
foreach ($doc->line_items as $line_no=>$item) {
}
$cart = $doc;
$cart->trans_type = 10;
- $cart->reference = references::get_next($cart->trans_type);
+ $cart->reference = $Refs->get_next($cart->trans_type);
$invno = $cart->write(1);
set_last_sent($tmpl_no, $cart->document_date);
return $invno;
function can_process()
{
+ global $Refs;
$input_error = 0;
if ($_SESSION['Items']->count_items() == 0 && (!check_num('ChargeFreightCost',0)))
return false;
if($_SESSION['Items']->trans_no == 0) {
- if (!references::is_valid($_POST['ref'])) {
+ if (!$Refs->is_valid($_POST['ref'])) {
display_error( _("You must enter a reference."));
set_focus('ref');
$input_error = 1;
function can_process()
{
+ global $Refs;
+
if (!is_date($_POST['CreditDate'])) {
display_error(_("The entered date is invalid."));;
set_focus('CreditDate');
}
if ($_SESSION['Items']->trans_no==0) {
- if (!references::is_valid($_POST['ref'])) {
+ if (!$Refs->is_valid($_POST['ref'])) {
display_error(_("You must enter a reference."));;
set_focus('ref');
return false;
$ci->src_date = $ci->document_date;
$ci->trans_no = 0;
$ci->document_date = new_doc_date();
- $ci->reference = references::get_next(11);
+ $ci->reference = $Refs->get_next(11);
for ($line_no=0; $line_no<count($ci->line_items); $line_no++) {
$ci->line_items[$line_no]->qty_dispatched = '0';
start_row();
// if (!isset($_POST['ref']))
-// $_POST['ref'] = references::get_next(11);
+// $_POST['ref'] = $Refs->get_next(11);
if ($_SESSION['Items']->trans_no==0) {
ref_cells(_("Reference"), 'ref', '', null, "class='tableheader2'");
$ord->src_docs = $ord->trans_no;
$ord->order_no = key($ord->trans_no);
$ord->trans_no = 0;
- $ord->reference = references::get_next(13);
+ $ord->reference = $Refs->get_next(13);
$ord->document_date = new_doc_date();
$_SESSION['Items'] = $ord;
copy_from_cart();
function check_data()
{
+ global $Refs;
+
if (!isset($_POST['DispatchDate']) || !is_date($_POST['DispatchDate'])) {
display_error(_("The entered date of delivery is invalid."));
set_focus('DispatchDate');
}
if ($_SESSION['Items']->trans_no==0) {
- if (!references::is_valid($_POST['ref'])) {
+ if (!$Refs->is_valid($_POST['ref'])) {
display_error(_("You must enter a reference."));
set_focus('ref');
return false;
function check_qoh()
{
- if (!sys_prefs::allow_negative_stock()) {
+ global $SysPrefs;
+
+ if (!$SysPrefs->allow_negative_stock()) {
foreach ($_SESSION['Items']->line_items as $itm) {
if ($itm->qty_dispatched && has_stock_holding($itm->mb_flag)) {
start_row();
//if (!isset($_POST['ref']))
-// $_POST['ref'] = references::get_next(13);
+// $_POST['ref'] = $Refs->get_next(13);
if ($_SESSION['Items']->trans_no==0) {
ref_cells(_("Reference"), 'ref', '', null, "class='tableheader2'");
label_cells(_("Reference"), $_SESSION['Items']->reference, "class='tableheader2'");
}
-label_cells(_("For Sales Order"), get_customer_trans_view_str(systypes::sales_order(), $_SESSION['Items']->order_no), "class='tableheader2'");
+label_cells(_("For Sales Order"), get_customer_trans_view_str(ST_SALESORDER, $_SESSION['Items']->order_no), "class='tableheader2'");
label_cells(_("Sales Type"), $_SESSION['Items']->sales_type_name, "class='tableheader2'");
end_row();
}
// if it's a non-stock item (eg. service) don't show qoh
$show_qoh = true;
- if (sys_prefs::allow_negative_stock() || !has_stock_holding($ln_itm->mb_flag) ||
+ if ($SysPrefs->allow_negative_stock() || !has_stock_holding($ln_itm->mb_flag) ||
$ln_itm->qty_dispatched == 0) {
$show_qoh = false;
}
$dn->trans_type = 10;
$dn->src_docs = $dn->trans_no;
$dn->trans_no = 0;
- $dn->reference = references::get_next(10);
+ $dn->reference = $Refs->get_next(10);
$dn->due_date = get_invoice_duedate($dn->customer_id, $dn->document_date);
$_SESSION['Items'] = $dn;
function check_data()
{
+ global $Refs;
+
if (!isset($_POST['InvoiceDate']) || !is_date($_POST['InvoiceDate'])) {
display_error(_("The entered invoice date is invalid."));
set_focus('InvoiceDate');
}
if ($_SESSION['Items']->trans_no == 0) {
- if (!references::is_valid($_POST['ref'])) {
+ if (!$Refs->is_valid($_POST['ref'])) {
display_error(_("You must enter a reference."));
set_focus('ref');
return false;
}
label_cells(_("Delivery Notes:"),
-get_customer_trans_view_str(systypes::cust_dispatch(), array_keys($_SESSION['Items']->src_docs)), "class='tableheader2'");
+get_customer_trans_view_str(ST_CUSTDELIVERY, array_keys($_SESSION['Items']->src_docs)), "class='tableheader2'");
label_cells(_("Sales Type"), $_SESSION['Items']->sales_type_name, "class='tableheader2'");
function can_process()
{
+ global $Refs;
+
if (!isset($_POST['DateBanked']) || !is_date($_POST['DateBanked'])) {
display_error(_("The entered date is invalid. Please enter a valid date for the payment."));
set_focus('DateBanked');
return false;
}
- if (!references::is_valid($_POST['ref'])) {
+ if (!$Refs->is_valid($_POST['ref'])) {
display_error(_("You must enter a reference."));
set_focus('ref');
return false;
function read_customer_data()
{
+ global $Refs;
+
$sql = "SELECT ".TB_PREF."debtors_master.pymt_discount,
".TB_PREF."credit_status.dissallow_invoices
FROM ".TB_PREF."debtors_master, ".TB_PREF."credit_status
$_POST['HoldAccount'] = $myrow["dissallow_invoices"];
$_POST['pymt_discount'] = $myrow["pymt_discount"];
- $_POST['ref'] = references::get_next(12);
+ $_POST['ref'] = $Refs->get_next(12);
}
//----------------------------------------------------------------------------------------------
if (db_customer_has_branches($_POST['customer_id'])) {
customer_branches_list_row(_("Branch:"), $_POST['customer_id'], 'BranchID', null, false, true, true);
} else {
- hidden('BranchID', reserved_words::get_any_numeric());
+ hidden('BranchID', ANY_NUMERIC);
}
read_customer_data();
//
function read($type, $trans_no = 0, $view=false ) {
+ global $SysPrefs, $Refs;
+
if (!is_array($trans_no)) $trans_no = array($trans_no);
if ($trans_no[0]) {
if ($type == 30 || $type == 32) { // sales order || sales quotation
$this->trans_type = $type;
$this->trans_no = 0;
// set new sales document defaults here
- if (get_global_customer() != reserved_words::get_all())
+ if (get_global_customer() != ALL_TEXT)
$this->customer_id = get_global_customer();
else
$this->customer_id = '';
$this->document_date = new_doc_date();
if (!is_date_in_fiscalyear($this->document_date))
$this->document_date = end_fiscalyear();
- $this->reference = references::get_next($this->trans_type);
+ $this->reference = $Refs->get_next($this->trans_type);
if ($type != 30 && $type != 32) // Added 2.1 Joe Hunt 2008-11-12
{
$dim = get_company_pref('use_dimension');
}
} else
$this->due_date =
- add_days($this->document_date, sys_prefs::default_delivery_required_by());
+ add_days($this->document_date, $SysPrefs->default_delivery_required_by());
}
}
else
$SQLDueDate = date2sql($due_date);
- if ($trans_type == systypes::bank_payment())
+ if ($trans_type == ST_BANKPAYMENT)
$Total = -$Total;
if ($new) {
".TB_PREF."debtors_master.name AS DebtorName, ".TB_PREF."debtors_master.address, ".TB_PREF."debtors_master.email AS email2,
".TB_PREF."debtors_master.curr_code, ".TB_PREF."debtors_master.tax_id, ".TB_PREF."debtors_master.payment_terms ";
- if ($trans_type == systypes::cust_payment()) {
+ if ($trans_type == ST_CUSTPAYMENT) {
// it's a payment so also get the bank account
$sql .= ", ".TB_PREF."bank_accounts.bank_name, ".TB_PREF."bank_accounts.bank_account_name,
".TB_PREF."bank_accounts.account_type AS BankTransType ";
$sql .= " FROM ".TB_PREF."debtor_trans, ".TB_PREF."debtors_master ";
- if ($trans_type == systypes::cust_payment()) {
+ if ($trans_type == ST_CUSTPAYMENT) {
// it's a payment so also get the bank account
$sql .= ", ".TB_PREF."bank_trans, ".TB_PREF."bank_accounts";
}
AND ".TB_PREF."debtor_trans.type=$trans_type
AND ".TB_PREF."debtor_trans.debtor_no=".TB_PREF."debtors_master.debtor_no";
- if ($trans_type == systypes::cust_payment()) {
+ if ($trans_type == ST_CUSTPAYMENT) {
// it's a payment so also get the bank account
$sql .= " AND ".TB_PREF."bank_trans.trans_no =$trans_id
AND ".TB_PREF."bank_trans.type=$trans_type
// 2008-09-20 Joe Hunt
if ($date != "")
exchange_variation($type, $type_no, $row['trans_type_to'], $row['trans_no_to'], $date,
- $row['amt'], payment_person_types::customer(), true);
+ $row['amt'], PT_CUSTOMER, true);
//////////////////////
}
else
{
$sql = get_alloc_trans_sql(null, "round(ov_amount+ov_gst+ov_freight+ov_freight_tax+ov_discount-alloc,6) > 0
- AND trans.type != " . systypes::cust_payment() . "
- AND trans.type != " . systypes::bank_deposit() . "
+ AND trans.type != " . ST_CUSTPAYMENT . "
+ AND trans.type != " . ST_BANKDEPOSIT . "
AND trans.type != 11
AND trans.type != 13
AND trans.debtor_no=$customer_id");
function write_customer_payment($trans_no, $customer_id, $branch_id, $bank_account,
$date_, $ref, $amount, $discount, $memo_, $rate=0, $charge=0)
{
+ global $Refs;
+
begin_transaction();
$company_record = get_company_prefs();
$bank_gl_account, 0, 0, $amount - $charge, $customer_id,
"Cannot insert a GL transaction for the bank account debit", $rate);
- if ($branch_id != reserved_words::get_any_numeric()) {
+ if ($branch_id != ANY_NUMERIC) {
$branch_data = get_branch_accounts($branch_id);
"Cannot insert a GL transaction for the payment bank charge debit", $rate);
}
/*Post a balance post if $total != 0 */
- add_gl_balance(12, $payment_no, $date_, -$total, payment_person_types::customer(), $customer_id);
+ add_gl_balance(12, $payment_no, $date_, -$total, PT_CUSTOMER, $customer_id);
/*now enter the bank_trans entry */
add_bank_trans(12, $payment_no, $bank_account, $ref,
- $date_, $amount - $charge, payment_person_types::customer(), $customer_id,
+ $date_, $amount - $charge, PT_CUSTOMER, $customer_id,
get_customer_currency($customer_id), "", $rate);
add_comments(12, $payment_no, $date_, $memo_);
- references::save(12, $payment_no, $ref);
+ $Refs->save(12, $payment_no, $ref);
commit_transaction();
//
function write_credit_note($credit_note, $write_off_acc)
{
+ global $Refs;
+
$credit_invoice = is_array($credit_note->src_docs) ?
reset(array_keys($credit_note->src_docs)) : $credit_note->src_docs;
// Exchange Variations Joe Hunt 2008-09-20 ////////////////////////////////////////
exchange_variation(11, $credit_no, 10, $credit_invoice, $credit_date,
- $allocate_amount, payment_person_types::customer());
+ $allocate_amount, PT_CUSTOMER);
///////////////////////////////////////////////////////////////////////////
}
}
/*Post a balance post if $total != 0 */
- add_gl_balance(11, $credit_no, $credit_date, -$total, payment_person_types::customer(), $credit_note->customer_id);
+ add_gl_balance(11, $credit_no, $credit_date, -$total, PT_CUSTOMER, $credit_note->customer_id);
add_comments(11, $credit_no, $credit_date, $credit_note->Comments);
if ($trans_no == 0) {
- references::save(11, $credit_no, $credit_note->reference);
+ $Refs->save(11, $credit_no, $credit_note->reference);
}
commit_transaction();
$total += add_gl_trans_std_cost(11, $credit_no, $date_, $stock_gl_codes["cogs_account"],
$dim, $dim2, "", -($standard_cost * $order_line->qty_dispatched),
- payment_person_types::customer(), $order->customer_id,
+ PT_CUSTOMER, $order->customer_id,
"The cost of sales GL posting could not be inserted");
/*now the stock entry*/
$total += add_gl_trans_std_cost(11, $credit_no, $date_, $stock_entry_account, 0, 0,
"", ($standard_cost * $order_line->qty_dispatched),
- payment_person_types::customer(), $order->customer_id,
+ PT_CUSTOMER, $order->customer_id,
"The stock side (or write off) of the cost of sales GL posting could not be inserted");
} /* end of if GL and stock integrated and standard cost !=0 */
//
function write_sales_delivery(&$delivery,$bo_policy)
{
+ global $Refs;
$trans_no = $delivery->trans_no;
if (is_array($trans_no)) $trans_no = key($trans_no);
add_gl_trans_std_cost(13, $delivery_no,
$delivery->document_date, $stock_gl_code["cogs_account"], $dim, $dim2, "",
$delivery_line->standard_cost * $delivery_line->qty_dispatched,
- payment_person_types::customer(), $delivery->customer_id,
+ PT_CUSTOMER, $delivery->customer_id,
"The cost of sales GL posting could not be inserted");
/*now the stock entry*/
add_gl_trans_std_cost(13, $delivery_no, $delivery->document_date,
$stock_gl_code["inventory_account"], 0, 0, "",
(-$delivery_line->standard_cost * $delivery_line->qty_dispatched),
- payment_person_types::customer(), $delivery->customer_id,
+ PT_CUSTOMER, $delivery->customer_id,
"The stock side of the cost of sales GL posting could not be inserted");
} /* end of if GL and stock integrated and standard cost !=0 */
add_comments(13, $delivery_no, $delivery->document_date, $delivery->Comments);
if ($trans_no == 0) {
- references::save(13, $delivery_no, $delivery->reference);
+ $Refs->save(13, $delivery_no, $delivery->reference);
}
commit_transaction();
//
function write_sales_invoice(&$invoice)
{
+ global $Refs;
$trans_no = $invoice->trans_no;
if (is_array($trans_no))
}
/*Post a balance post if $total != 0 */
- add_gl_balance(10, $invoice_no, $date_, -$total, payment_person_types::customer(), $invoice->customer_id);
+ add_gl_balance(10, $invoice_no, $date_, -$total, PT_CUSTOMER, $invoice->customer_id);
add_comments(10, $invoice_no, $date_, $invoice->Comments);
if ($trans_no == 0) {
- references::save(10, $invoice_no, $invoice->reference);
+ $Refs->save(10, $invoice_no, $invoice->reference);
if ($invoice->cash) {
$amount = $items_total + $items_added_tax + $invoice->freight_cost
+ $freight_added_tax;
$discount = 0; // $invoice->cash_discount*$amount;
$pmtno = write_customer_payment(0, $invoice->customer_id,
$invoice->Branch, $invoice->cash_account, $date_,
- references::get_next(12), $amount-$discount, $discount,
+ $Refs->get_next(12), $amount-$discount, $discount,
_('Cash invoice').' '.$invoice_no);
add_cust_allocation($amount, 12, $pmtno, 10, $invoice_no);
//----------------------------------------------------------------------------------------
function add_sales_order(&$order)
{
- global $loc_notification, $path_to_root;
+ global $loc_notification, $path_to_root, $Refs;
begin_transaction();
} /* inserted line items into sales order details */
add_audit_trail($order->trans_type, $order_no, $order->document_date);
- references::save($order->trans_type, $order_no, $order->reference);
+ $Refs->save($order->trans_type, $order_no, $order->reference);
commit_transaction();
if ($loc_notification == 1 && count($st_ids) > 0)
function update_sales_order($order)
{
- global $loc_notification, $path_to_root;
+ global $loc_notification, $path_to_root, $Refs;
$del_date = date2sql($order->due_date);
$ord_date = date2sql($order->document_date);
} /* inserted line items into sales order details */
add_audit_trail($order->trans_type, $order_no, $order->document_date, _("Updated."));
- references::delete($order->trans_type, $order_no);
- references::save($order->trans_type, $order_no, $order->reference);
+ $Refs->delete($order->trans_type, $order_no);
+ $Refs->save($order->trans_type, $order_no, $order->reference);
commit_transaction();
if ($loc_notification == 1 && count($st_ids) > 0)
{
return add_gl_trans($type, $type_no, $date_, $account, $dimension, $dimension2, "", $amount,
get_customer_currency($customer_id),
- payment_person_types::customer(), $customer_id, $err_msg, $rate);
+ PT_CUSTOMER, $customer_id, $err_msg, $rate);
}
//----------------------------------------------------------------------------------------
function display_credit_header(&$order)
{
- global $table_style, $Ajax;
+ global $table_style, $Ajax, $Refs;
start_outer_table("width=80% $table_style");
table_section(1);
$customer_error = "";
$change_prices = 0;
- if (!isset($_POST['customer_id']) && (get_global_customer() != reserved_words::get_all()))
+ if (!isset($_POST['customer_id']) && (get_global_customer() != ALL_TEXT))
$_POST['customer_id'] = get_global_customer();
customer_list_row(_("Customer:"), 'customer_id', null, false, true, false, true);
set_global_customer($_POST['customer_id']);
if (!isset($_POST['ref']))
- $_POST['ref'] = references::get_next(11);
+ $_POST['ref'] = $Refs->get_next(11);
if ($order->trans_no==0)
ref_row(_("Reference").':', 'ref');
else
function display_order_summary($title, &$order, $editable_items=false)
{
- global $table_style, $path_to_root;
+ global $table_style, $path_to_root, $SysPrefs;
display_heading($title);
$qoh_msg = '';
if (!$editable_items || $id != $line_no)
{
- if (!sys_prefs::allow_negative_stock() && is_inventory_item($stock_item->stock_id)) {
+ if (!$SysPrefs->allow_negative_stock() && is_inventory_item($stock_item->stock_id)) {
$qoh = get_qoh_on_date($stock_item->stock_id,
$_POST['Location'], $_POST['OrderDate']);
if ($stock_item->qty_dispatched > $qoh)
end_table();
if ($has_marked) {
display_note(_("Marked items have insufficient quantities in stock as on day of delivery."), 0, 1, "class='stockmankofg'");
- if ($order->trans_type!=30 && !sys_prefs::allow_negative_stock())
+ if ($order->trans_type!=30 && !$SysPrefs->allow_negative_stock())
display_error(_("The delivery cannot be processed because there is an insufficient quantity for item:")
. '<br>'. $qoh_msg);
}
function display_order_header(&$order, $editable, $date_text, $display_tax_group=false)
{
- global $table_style, $Ajax;
+ global $table_style, $Ajax, $SysPrefs;
start_outer_table("width=80% $table_style");
if ($order->trans_type == 10) {
$_POST['delivery_date'] = get_invoice_duedate(get_post('customer_id'), get_post('OrderDate'));
} else
- $_POST['delivery_date'] = add_days(get_post('OrderDate'), sys_prefs::default_delivery_required_by());
+ $_POST['delivery_date'] = add_days(get_post('OrderDate'), $SysPrefs->default_delivery_required_by());
$Ajax->activate('items_table');
$Ajax->activate('delivery_date');
}
function order_link($row)
{
return $row['order_']>0 ?
- get_customer_trans_view_str(systypes::sales_order(), $row['order_'])
+ get_customer_trans_view_str(ST_SALESORDER, $row['order_'])
: "";
}
function systype_name($dummy, $type)
{
- return systypes::name($type);
+ global $systypes_array;
+
+ return $systypes_array[$type];
}
function view_link($trans)
/*its a credit note which could have an allocation */
return $link;
}
- elseif (($row["type"] == systypes::cust_payment() || $row["type"] == systypes::bank_deposit()) &&
+ elseif (($row["type"] == ST_CUSTPAYMENT || $row["type"] == ST_BANKDEPOSIT) &&
($row['TotalAmount'] - $row['Allocated']) > 0)
{
/*its a receipt which could have an allocation*/
return $link;
}
- elseif ($row["type"] == systypes::cust_payment() && $row['TotalAmount'] < 0)
+ elseif ($row["type"] == ST_CUSTPAYMENT && $row['TotalAmount'] < 0)
{
/*its a negative receipt */
return '';
AND trans.tran_date >= '$data_after'
AND trans.tran_date <= '$date_to'";
- if ($_POST['customer_id'] != reserved_words::get_all())
+ if ($_POST['customer_id'] != ALL_TEXT)
$sql .= " AND trans.debtor_no = '" . $_POST['customer_id'] . "'";
- if (isset($_POST['filterType']) && $_POST['filterType'] != reserved_words::get_all())
+ if (isset($_POST['filterType']) && $_POST['filterType'] != ALL_TEXT)
{
if ($_POST['filterType'] == '1' || $_POST['filterType'] == '2')
{
}
elseif ($_POST['filterType'] == '3')
{
- $sql .= " AND trans.type = " . systypes::cust_payment();
+ $sql .= " AND trans.type = " . ST_CUSTPAYMENT;
}
elseif ($_POST['filterType'] == '4')
{
array('insert'=>true, 'fun'=>'alloc_link')
);
-if ($_POST['customer_id'] != reserved_words::get_all()) {
+if ($_POST['customer_id'] != ALL_TEXT) {
$cols[_("Customer")] = 'skip';
$cols[_("Currency")] = 'skip';
}
//------------------------------------------------------------------------------------------------
div_start('totals_tbl');
-if ($_POST['customer_id'] != "" && $_POST['customer_id'] != reserved_words::get_all())
+if ($_POST['customer_id'] != "" && $_POST['customer_id'] != ALL_TEXT)
{
$customer_record = get_customer_details($_POST['customer_id'], $_POST['TransToDate']);
display_customer_summary($customer_record);
function systype_name($dummy, $type)
{
- return systypes::name($type);
+ global $systypes_array;
+
+ return $systypes_array[$type];
}
function order_view($row)
{
return $row['order_']>0 ?
- get_customer_trans_view_str(systypes::sales_order(), $row['order_'])
+ get_customer_trans_view_str(ST_SALESORDER, $row['order_'])
: "";
}
AND trans.tran_date <= '$date_to'
AND trans.branch_code = branch.branch_code";
- if ($_POST['customer_id'] != reserved_words::get_all())
+ if ($_POST['customer_id'] != ALL_TEXT)
$sql .= " AND trans.debtor_no = '" . $_POST['customer_id'] . "'";
- if ($_POST['filterType'] != reserved_words::get_all())
+ if ($_POST['filterType'] != ALL_TEXT)
{
if ($_POST['filterType'] == '1')
{
}
elseif ($_POST['filterType'] == '3')
{
- $sql .= " AND (trans.type = " . systypes::cust_payment()
+ $sql .= " AND (trans.type = " . ST_CUSTPAYMENT
." OR trans.type = 2) ";
}
elseif ($_POST['filterType'] == '4')
array('insert'=>true, 'fun'=>'prt_link')
);
-if ($_POST['customer_id'] != reserved_words::get_all()) {
+if ($_POST['customer_id'] != ALL_TEXT) {
$cols[_("Customer")] = 'skip';
$cols[_("Currency")] = 'skip';
}
//---------------------------------------------------------------------------------------------
if (isset($_POST['SelectStockFromList']) && ($_POST['SelectStockFromList'] != "") &&
- ($_POST['SelectStockFromList'] != reserved_words::get_all()))
+ ($_POST['SelectStockFromList'] != ALL_TEXT))
{
$selected_stock_item = $_POST['SelectStockFromList'];
}
if (isset($selected_stock_item))
$sql .= " AND line.stock_id='". $selected_stock_item ."' ";
- if (isset($_POST['StockLocation']) && $_POST['StockLocation'] != reserved_words::get_all())
+ if (isset($_POST['StockLocation']) && $_POST['StockLocation'] != ALL_TEXT)
$sql .= " AND sorder.from_stk_loc = '". $_POST['StockLocation'] . "' ";
$sql .= " GROUP BY trans.trans_no ";
//---------------------------------------------------------------------------------------------
if (isset($_POST['SelectStockFromList']) && ($_POST['SelectStockFromList'] != "") &&
- ($_POST['SelectStockFromList'] != reserved_words::get_all()))
+ ($_POST['SelectStockFromList'] != ALL_TEXT))
{
$selected_stock_item = $_POST['SelectStockFromList'];
}
if (isset($selected_stock_item))
$sql .= " AND line.stk_code='". $selected_stock_item ."'";
- if (isset($_POST['StockLocation']) && $_POST['StockLocation'] != reserved_words::get_all())
+ if (isset($_POST['StockLocation']) && $_POST['StockLocation'] != ALL_TEXT)
$sql .= " AND sorder.from_stk_loc = '". $_POST['StockLocation'] . "' ";
if ($_POST['order_view_mode']=='OutstandingOnly')
$_POST['credit_status'] = -1;
$_POST['payment_terms'] = '';
$_POST['discount'] = $_POST['pymt_discount'] = percent_format(0);
- $_POST['credit_limit'] = price_format(sys_prefs::default_credit_limit());
+ $_POST['credit_limit'] = price_format($SysPrefs->default_credit_limit());
$_POST['inactive'] = 0;
}
else
//--------------------------------------------------------------------------------
function can_process() {
+ global $Refs;
+
if (!is_date($_POST['OrderDate'])) {
display_error(_("The entered date is invalid."));
set_focus('OrderDate');
return false;
}
}
- if (!references::is_valid($_POST['ref'])) {
+ if (!$Refs->is_valid($_POST['ref'])) {
display_error(_("You must enter a reference."));
set_focus('ref');
return false;
function check_item_data()
{
+ global $SysPrefs;
+
if (!check_num('qty', 0) || !check_num('Disc', 0, 100)) {
display_error( _("The item could not be updated because you are attempting to set the quantity ordered to less than 0, or the discount percent to more than 100."));
set_focus('qty');
display_error(_("You attempting to make the quantity ordered a quantity less than has already been delivered. The quantity delivered cannot be modified retrospectively."));
return false;
} // Joe Hunt added 2008-09-22 -------------------------
- elseif ($_SESSION['Items']->trans_type!=30 && $_SESSION['Items']->trans_type!=32 && !sys_prefs::allow_negative_stock() &&
+ elseif ($_SESSION['Items']->trans_type!=30 && $_SESSION['Items']->trans_type!=32 && !$SysPrefs->allow_negative_stock() &&
is_inventory_item($_POST['stock_id']))
{
$qoh = get_qoh_on_date($_POST['stock_id'], $_POST['Location'], $_POST['OrderDate']);
function create_cart($type, $trans_no)
{
+ global $Refs;
+
processing_start();
$doc_type = $type;
$doc = new Cart(32, $trans_no);
$doc->trans_no = 0;
$doc->trans_type = 30;
- $doc->reference = references::get_next($doc->trans_type);
+ $doc->reference = $Refs->get_next($doc->trans_type);
$doc->document_date = $doc->due_date = new_doc_date();
$doc->Comments = _("Sales Quotation") . " # " . $trans_no;
$_SESSION['Items'] = $doc;
$doc->cash = date_diff2($doc->due_date, Today(), 'd')<2;
} else
$doc->due_date = $doc->document_date;
- $doc->reference = references::get_next($doc->trans_type);
+ $doc->reference = $Refs->get_next($doc->trans_type);
//$doc->Comments='';
foreach($doc->line_items as $line_no => $line) {
$doc->line_items[$line_no]->qty_done = 0;
$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(PT_CUSTOMER,
$myrow['debtor_no'], 11, $trans_id, $credit_total);
/* end of check to see that there was an invoice record to print */
label_cells(_("Reference"), $myrow["reference"], "class='tableheader2'");
label_cells(_("Currency"), $sales_order["curr_code"], "class='tableheader2'");
label_cells(_("Our Order No"),
- get_customer_trans_view_str(systypes::sales_order(),$sales_order["order_no"]), "class='tableheader2'");
+ get_customer_trans_view_str(ST_SALESORDER,$sales_order["order_no"]), "class='tableheader2'");
end_row();
start_row();
label_cells(_("Customer Order Ref."), $sales_order["customer_ref"], "class='tableheader2'");
label_cells(_("Reference"), $myrow["reference"], "class='tableheader2'");
label_cells(_("Currency"), $sales_order["curr_code"], "class='tableheader2'");
label_cells(_("Our Order No"),
- get_customer_trans_view_str(systypes::sales_order(),$sales_order["order_no"]), "class='tableheader2'");
+ get_customer_trans_view_str(ST_SALESORDER,$sales_order["order_no"]), "class='tableheader2'");
end_row();
start_row();
label_cells(_("Customer Order Ref."), $sales_order["customer_ref"], "class='tableheader2'");
start_row();
label_cells(_("Invoice Date"), sql2date($myrow["tran_date"]), "class='tableheader2'", "nowrap");
label_cells(_("Due Date"), sql2date($myrow["due_date"]), "class='tableheader2'", "nowrap");
-label_cells(_("Deliveries"), get_customer_trans_view_str(systypes::cust_dispatch(),
+label_cells(_("Deliveries"), get_customer_trans_view_str(ST_CUSTDELIVERY,
get_parent_trans(10,$trans_id)), "class='tableheader2'");
end_row();
comments_display_row(10, $trans_id);
$trans_id = $_GET["trans_no"];
}
-$receipt = get_customer_trans($trans_id, systypes::cust_payment());
+$receipt = get_customer_trans($trans_id, ST_CUSTPAYMENT);
display_heading(sprintf(_("Customer Payment #%d"),$trans_id));
end_row();
start_row();
label_cells(_("Payment Type"),
- bank_account_types::transfer_type($receipt['BankTransType']), "class='tableheader2'");
+ $bank_transfer_types[$receipt['BankTransType']], "class='tableheader2'");
label_cells(_("Reference"), $receipt['reference'], "class='tableheader2'", "colspan=4");
end_row();
-comments_display_row(systypes::cust_payment(), $trans_id);
+comments_display_row(ST_CUSTPAYMENT, $trans_id);
end_table(1);
-$voided = is_voided_display(systypes::cust_payment(), $trans_id, _("This customer payment has been voided."));
+$voided = is_voided_display(ST_CUSTPAYMENT, $trans_id, _("This customer payment has been voided."));
if (!$voided)
{
- display_allocations_from(payment_person_types::customer(), $receipt['debtor_no'], systypes::cust_payment(), $trans_id, $receipt['Total']);
+ display_allocations_from(PT_CUSTOMER, $receipt['debtor_no'], ST_CUSTPAYMENT, $trans_id, $receipt['Total']);
}
end_page(true);
for ($i = 0; $i < 5; $i++)
{
if (isset($_POST['tax_type_id' . $i]) &&
- $_POST['tax_type_id' . $i] != reserved_words::get_all_numeric() &&
+ $_POST['tax_type_id' . $i] != ALL_NUMERIC &&
!check_num('rate' . $i, 0))
{
display_error( _("An entered tax rate is invalid or less than zero."));
for ($i = 0; $i < 5; $i++)
{
if (isset($_POST['tax_type_id' . $i]) &&
- $_POST['tax_type_id' . $i] != reserved_words::get_any_numeric())
+ $_POST['tax_type_id' . $i] != ANY_NUMERIC)
{
$taxes[] = $_POST['tax_type_id' . $i];
$rates[] = input_num('rate' . $i);
label_cell(_("No"));
/*for ($i=0; $i< 5; $i++)
- if ($myrow["type" . $i] != reserved_words::get_all_numeric())
+ if ($myrow["type" . $i] != ALL_NUMERIC)
echo "<td>" . $myrow["type" . $i] . "</td>";*/
inactive_control_cell($myrow["id"], $myrow["inactive"], 'tax_groups', 'id');
$_POST['tax_type_id' . $i] = 0;
tax_types_list_cells(null, 'tax_type_id' . $i, $_POST['tax_type_id' . $i], _("None"), true);
- if ($_POST['tax_type_id' . $i] != 0 && $_POST['tax_type_id' . $i] != reserved_words::get_all_numeric())
+ if ($_POST['tax_type_id' . $i] != 0 && $_POST['tax_type_id' . $i] != ALL_NUMERIC)
{
$default_rate = get_tax_type_default_rate($_POST['tax_type_id' . $i]);