$index_file = "<?php\nheader(\"Location: ../index.php\");\n?>";
$fp = fopen($dir."/index.php", "w");
fwrite($fp, $index_file);
- fclose($fp); _vd($dir);
+ fclose($fp);
}
// file name compatible with POSIX
// protect against directory traversal
/*
Update main or gl company setup.
*/
-function update_company_prefs( $params, $pref = TB_PREF )
+function update_company_prefs($params)
{
- $sql = "UPDATE {$pref}sys_prefs SET value = ";
+ $sql = "UPDATE ".TB_PREF."sys_prefs SET value = ";
foreach($params as $name => $value) {
if (!db_query($sql. db_escape($value). " WHERE name=".db_escape($name),
"The company prefferences could not be updated "))
$prefs can be preference name, array of names, or null for all preferences.
*/
-function get_company_pref($prefs = null, $tbpref = null)
+function get_company_pref($prefs = null)
{
global $SysPrefs, $db_version;
- static $cached; // retrieve values from db once a request. Some values can't be cached between requests
- // to ensure prefs integrity for all usrs (e.g. gl_close_date).
-
- if (!$cached || !isset($_SESSION['SysPrefs'])) { // cached preferences
+ if (!isset($_SESSION['SysPrefs']->prefs)) { // cached preferences
$_SESSION['SysPrefs'] = new sys_prefs();
- if (!isset($tbpref))
- $tbpref = TB_PREF;
-
- $sql = "SELECT name, value FROM {$tbpref}sys_prefs";
+ $sql = "SELECT name, value FROM ".TB_PREF."sys_prefs";
$result = @db_query($sql); // supress errors before 2.3 db structure upgrade
if(!$result)
// update current db status for info in log file
$SysPrefs->db_ok = $SysPrefs->prefs['version_id'] == $db_version;
- $cached = true;
}
$all = $_SESSION['SysPrefs']->prefs;
return $ret;
}
-function get_company_prefs($tbpref = TB_PREF)
+function get_company_prefs()
{
- return get_company_pref(null, $tbpref);
+ return get_company_pref(null);
}
function set_company_pref($pref, $category, $type, $length, $value)
{
- $sql = "REPLACE ".TB_PREF."sys_prefs SET name=".db_escape($pref).", category=".db_escape($category)
- .", type=".db_escape($type).", length=".db_escape($length).", value=".db_escape($value);
+ $sql = "REPLACE `".TB_PREF."sys_prefs` SET `name`=".db_escape($pref).", `category`=".db_escape($category)
+ .", `type`=".db_escape($type).", `length`=".db_escape($length).", `value`=".db_escape($value);
return db_query($sql, "cannot set company pref");
}
$from = sql2date($myrow['begin']);
begin_transaction();
- open_transactions($from);
+ close_transactions(add_days($from, -1));
commit_transaction();
}
db_query($sql, "Could not delete exchange rates");
$sql = "DELETE FROM ".TB_PREF."budget_trans WHERE tran_date <= '$to'";
db_query($sql, "Could not delete exchange rates");
-
- $sql = "SELECT account, SUM(amount) AS amount FROM ".TB_PREF."gl_trans WHERE tran_date <= '$to' GROUP by account";
+ $sql = "SELECT account, SUM(amount) AS amount, person_type_id, person_id FROM "
+ .TB_PREF."gl_trans WHERE tran_date <= '$to' GROUP by account, person_type_id, person_id";
$result = db_query($sql, "Could not retrieve gl trans");
$trans_no = get_next_trans_no(ST_JOURNAL);
+
+ $last_account='';
$new = false;
while ($row = db_fetch($result))
{
- $sql = "DELETE FROM ".TB_PREF."gl_trans WHERE tran_date <= '$to' AND account = '{$row['account']}'";
- db_query($sql, "Could not delete gl trans");
- if (is_account_balancesheet($row['account']))
+ if ($last_account != $row['account']) // deletes all subledgers postings, so do it once for account
+ {
+ $sql = "DELETE FROM ".TB_PREF."gl_trans WHERE tran_date <= '$to' AND account = '{$row['account']}'";
+ db_query($sql, "Could not delete gl trans");
+ $last_account = $row['account'];
+ }
+ if (is_account_balancesheet($row['account']) && $row['amount'])
{
- $sql = "INSERT INTO ".TB_PREF."gl_trans (type, type_no, tran_date, account, memo_, amount) VALUES
- (".ST_JOURNAL.", $trans_no, '$to', '{$row['account']}', '$ref', {$row['amount']})";
+ $sql = "INSERT INTO ".TB_PREF."gl_trans (type, type_no, tran_date, account, memo_, amount, person_type_id, person_id) VALUES
+ (".ST_JOURNAL.", $trans_no, '$to', '{$row['account']}', '$ref', {$row['amount']}, "
+ .db_escape($row['person_type_id'], true).", ".db_escape($row['person_id'], true).")";
db_query($sql, "Could not insert gl trans");
$new = true;
}
}
}
}
-
+
db_query("SET foreign_key_checks=1");
if ($delimiter != ';') db_query("delimiter ;"); // just for any case
return explode("\n", $file_data);
}
-function db_backup($conn, $ext='no', $comm='', $tbpref = TB_PREF)
+function db_backup($conn, $ext='no', $comm='', $path=null)
{
if ($conn['tbpref'] != "")
$filename = $conn['dbname'] . "_" . $conn['tbpref'] . date("Ymd_Hi") . ".sql";
else
$filename = $conn['dbname'] . "_" . date("Ymd_Hi") . ".sql";
- return db_export($conn, clean_file_name($filename), $ext, $comm, $tbpref);
+ if (!isset($path))
+ $path = BACKUP_PATH;
+
+ return db_export($conn, $path . clean_file_name($filename), $ext, $comm);
}
// generates a dump of $db database
// $drop and $zip tell if to include the drop table statement or dry to pack
-function db_export($conn, $filename, $zip='no', $comment='', $tbpref = TB_PREF, $no_default=false)
+function db_export($conn, $filename, $zip='no', $comment='', $no_default=false)
{
global $app_title, $version, $power_url, $path_to_root;
+
$error = false;
// set max string size before writing to file
$max_size = 1048576 * 2; // 2 MB
$backupfile = $filename . ".zip";
else
$backupfile = $filename;
- $company = get_company_pref('coy_name', $tbpref);
+ $company = $conn['name']; // get_company_pref('coy_name');
//create comment
$out="# MySQL dump of database '".$conn["dbname"]."' on host '".$conn["host"]."'\n";
}
elseif ($error)
{
- @unlink(BACKUP_PATH . $backupfile);
+ @unlink($backupfile);
return false;
}
}
else
{
- @unlink(BACKUP_PATH . $backupfile);
+ @unlink($backupfile);
return false;
}
}
else
{
- @unlink(BACKUP_PATH . $backupfile);
+ @unlink($backupfile);
return false;
}
return $backupfile;
// saves the string in $fileData to the file $backupfile as gz file or not ($zip)
// returns backup file name if name has changed (zip), else TRUE. If saving failed, return value is FALSE
-function save_to_file($backupfile, $zip, $fileData)
+function save_to_file($path, $zip, $fileData)
{
global $path_to_root;
+ $backupfile = basename($path);
+
if ($zip == "gzip")
{
- if ($zp = @gzopen(BACKUP_PATH . $backupfile, "a9"))
+ if ($zp = @gzopen($path, "a9"))
{
@gzwrite($zp, $fileData);
@gzclose($zp);
// total # of entries "on this disk", total # of entries overall, size of central dir, offset to start of central dir, .zip file comment length
$fileData .= pack('v', 1) . pack('v', 1) . pack('V', strlen($cdrec)) . pack('V', strlen($fr)) . "\x00\x00";
- if ($zp = @fopen(BACKUP_PATH . $backupfile, "a"))
+ if ($zp = @fopen($path, "a"))
{
@fwrite($zp, $fileData);
@fclose($zp);
}
else
{
- if ($zp = @fopen(BACKUP_PATH . $backupfile, "a"))
+ if ($zp = @fopen($path, "a"))
{
@fwrite($zp, $fileData);
@fclose($zp);
'default_prompt_payment_act', 'default_inventory_act', 'default_cogs_act',
'default_adj_act', 'default_inv_sales_act', 'default_assembly_act', 'legal_text',
'past_due_days', 'default_workorder_required', 'default_dim_required',
- 'default_delivery_required', 'grn_clearing_act',
+ 'default_delivery_required', 'grn_clearing_act', 'tax_algorithm',
'allow_negative_stock'=> 0, 'accumulate_shipping'=> 0,
'po_over_receive' => 0.0, 'po_over_charge' => 0.0, 'default_credit_limit'=>0.0
)));
start_outer_table(TABLESTYLE2);
table_section(1);
-
if (get_company_pref('grn_clearing_act') === null) { // available form 2.3.1, can be not defined on pre-2.4 installations
set_company_pref('grn_clearing_act', 'glsetup.purchase', 'varchar', 15, 0);
refresh_sys_prefs();
$_POST['exchange_diff_act'] = $myrow["exchange_diff_act"];
$_POST['bank_charge_act'] = $myrow["bank_charge_act"];
+$_POST['tax_algorithm'] = $myrow["tax_algorithm"];
$_POST['default_sales_act'] = $myrow["default_sales_act"];
$_POST['default_sales_discount_act'] = $myrow["default_sales_discount_act"];
$_POST['default_prompt_payment_act'] = $myrow["default_prompt_payment_act"];
gl_all_accounts_list_row(_("Bank Charges Account:"), 'bank_charge_act', $_POST['bank_charge_act']);
+tax_algorithm_list_row(_("Tax Algorithm:"), 'tax_algorithm', $_POST['tax_algorithm']);
+
//---------------
table_section_title(_("Customers and Sales"));
//
// Apply one differential data set.
//
-function upgrade_step($index, $conn)
+function upgrade_step($index, $company, $conn)
{
global $path_to_root, $installers;
if ($sql != '')
$ret &= db_import($path_to_root.'/sql/'.$sql, $conn, $force);
- $ret &= $inst->install($pref, $force);
+ $ret &= $inst->install($company, $force);
error_log(_("Database upgrade finished."));
continue;
}
// create security backup
- db_backup($conn, 'no', 'Security backup before upgrade', $conn['tbpref']);
+ db_backup($conn, 'no', 'Security backup before upgrade');
// apply all upgrade data
foreach ($installers as $i => $inst)
{
- $ret = upgrade_step($i, $conn);
+ $ret = upgrade_step($i, $comp, $conn);
if (!$ret)
display_error(
sprintf(_("Database upgrade to version %s failed for company '%s'."),
if (!isset($row['type']))
$row['type'] = $_POST['filterType'];
if (!is_date_in_fiscalyear($row['trans_date'], true))
- return _("No");
+ return _("N/A");
return button('Edit'.$row["trans_no"], _("Select"), _("Select"), ICON_EDIT);
}
start_table(TABLESTYLE_NOBORDER);
start_row();
- systypes_list_cells(_("Type:"), 'filterType', null, true, $not_implemented);
+ systypes_list_cells(_("Transaction Type:"), 'filterType', null, true, $not_implemented);
if (list_updated('filterType'))
$selected_id = -1;
ref_cells(_("to #:"), 'ToTransNo');
submit_cells('ProcessSearch', _("Search"), '', '', 'default');
-
+
end_row();
end_table(1);
"gl/manage/gl_account_types.php?", 'SA_GLACCOUNTGROUP', MENU_MAINTENANCE);
$this->add_rapp_function(2, _("GL Account &Classes"),
"gl/manage/gl_account_classes.php?", 'SA_GLACCOUNTCLASS', MENU_MAINTENANCE);
- $this->add_rapp_function(2, "","");
+ $this->add_rapp_function(2, _("&Closing GL Transactions"),
+ "gl/manage/close_period.php?", 'SA_GLSETUP', MENU_MAINTENANCE);
$this->add_rapp_function(2, _("&Revaluation of Currency Accounts"),
"gl/manage/revaluate_currencies.php?", 'SA_EXCHANGERATE', MENU_MAINTENANCE);
/* $show_voiced_gl_trans = 0, setting this to 1 will show the voided gl trans */
$show_voided_gl_trans = 0;
-
+
/* use old style convert (income and expense in BS, PL) */
$use_oldstyle_convert = 0;
/* suppress tax rates on documents. 0 = no, 1 = yes. */
$suppress_tax_rates = 0;
-
+
+ /* allow reopening closed transactions */
+ $allow_gl_reopen = 0;
+
$dateformats = array("MMDDYYYY", "DDMMYYYY", "YYYYMMDD");
$dateseps = array("/", ".", "-", " ");
$thoseps = array(",", ".", " ");
if (!defined('ICON_EDIT'))
{
- define("ICON_EDIT", "edit.gif");
- define("ICON_DELETE", "delete.gif");
- define("ICON_ADD", "ok.gif");
- define("ICON_UPDATE", "ok.gif");
- define("ICON_OK", "ok.gif");
- define("ICON_CANCEL", "cancel.png");
- define("ICON_GL", "gl.png");
- define("ICON_PRINT", "print.png");
- define("ICON_PDF", "pdf.gif");
- define("ICON_DOC", "invoice.gif");
- define("ICON_CREDIT", "credit.gif");
- define("ICON_RECEIVE", "receive.gif");
- define("ICON_DOWN", "download.gif");
- define("ICON_MONEY", "money.png");
- define("ICON_REMOVE", "remove.png");
- define("ICON_REPORT", "report.png");
- define("ICON_VIEW", "view.gif");
+ define("ICON_EDIT", "edit.gif");
+ define("ICON_DELETE", "delete.gif");
+ define("ICON_ADD", "ok.gif");
+ define("ICON_UPDATE", "ok.gif");
+ define("ICON_OK", "ok.gif");
+ define("ICON_CANCEL", "cancel.png");
+ define("ICON_GL", "gl.png");
+ define("ICON_PRINT", "print.png");
+ define("ICON_PDF", "pdf.gif");
+ define("ICON_DOC", "invoice.gif");
+ define("ICON_CREDIT", "credit.gif");
+ define("ICON_RECEIVE", "receive.gif");
+ define("ICON_DOWN", "download.gif");
+ define("ICON_MONEY", "money.png");
+ define("ICON_REMOVE", "remove.png");
+ define("ICON_REPORT", "report.png");
+ define("ICON_VIEW", "view.gif");
define("ICON_SUBMIT", "ok.gif");
- define("ICON_ESCAPE", "escape.png");
+ define("ICON_ESCAPE", "escape.png");
+ define("ICON_CLOSED", "closed.png");
}
?>
\ No newline at end of file
$_POST['TransToDate'] = Today();
date_cells(_("from:"), 'TransFromDate');
date_cells(_("to:"), 'TransToDate');
-submit_cells('Show',_("Show"), '', false);
+submit_cells('Show',_("Show"), '', false, 'default');
end_row();
--- /dev/null
+Changes in framework API introduced in FrontAccounting 2.4
+----------------------------------------------------------
+The list does not contain changes made in user interface files.
+
+Changed functions:
+ company_db_inc:
+ update_company_prefs($params)
+ get_company_pref($prefs = null)
+ get_company_prefs()
+ maintenance_db.inc:
+ db_backup($conn, $ext='no', $comm='', $path=null)
+ db_export($conn, $filename, $zip='no', $comment='', $no_default=false)
+ save_to_file($path, $zip, $fileData)
+
+
+Before 2.4:
+ update_company_prefs( $params, $pref = TB_PREF )
+Now:
+ update_company_prefs($params)
+Description:
+ $pref parameter has been removed. All calls should be done after switch to selected company database with
+ set_global_connection($company).
+
+Before 2.4:
+ get_company_pref($prefs = null, $tbpref = null)
+Now:
+ get_company_pref($prefs = null)
+Description:
+ $tbpref parameter has been removed. All calls should be done after switch to selected company database with
+ set_global_connection($company).
+
+Before 2.4:
+ get_company_prefs($tbpref = TB_PREF)
+Now:
+ get_company_prefs()
+Description:
+ $tbpref parameter has been removed. All calls should be done after switch to selected company database with
+ set_global_connection($company).
+
+Before 2.4:
+ db_backup($conn, $ext='no', $comm='', $tbpref = TB_PREF)
+Now:
+ db_backup($conn, $ext='no', $comm='', $path=null)
+Description:
+ $tbpref parameter has been removed. Calls should be done after switch to selected company database with
+ set_global_connection($company).
+ $path parameter has been added: path to storage directory for generated backup file. If not set defaults to BACKUP_PATH.
+
+Before 2.4:
+ db_export($conn, $filename, $zip='no', $comment='', $tbpref = TB_PREF, $no_default=false)
+Now:
+ db_export($conn, $filename, $zip='no', $comment='', $no_default=false)
+Description:
+ $tbpref parameter has been removed. Calls should be done after switch to selected company database with
+ set_global_connection($company).
+ $filename now have to contain full path to target directory.
+
+Before 2.4:
+ save_to_file($backupfile, $zip, $fileData)
+Now:
+ save_to_file($path, $zip, $fileData)
+Description:
+ $path parameter have to contain full path to file, no assumptions to target folder is done inside function.
}
elseif (!is_date_in_fiscalyear($_POST['date_']))
{
- display_error(_("The entered date is not in fiscal year."));
+ display_error(_("The entered date is out of fiscal year or is closed for further data entry."));
set_focus('date_');
$input_error = 1;
}
if (!is_date_in_fiscalyears($lastdate, false))
{
- display_error(_("Some of the period dates are outside the fiscal year. Create a new fiscal year first!"));
+ display_error(_("Some of the period dates are outside the fiscal year or are closed for further data entry. Create a new fiscal year first!"));
set_focus('date_');
$input_error = 1;
}
return $value>0 ? price_format($value) : '';
}
-function fmt_person($row)
+function fmt_person($trans)
{
- return payment_person_name($row["person_type_id"],$row["person_id"]);
+ return get_counterparty_name($trans["type"], $trans["trans_no"]);
}
$update_pager = false;
}
if (!is_date_in_fiscalyear($_POST['DatePaid']))
{
- display_error(_("The entered date is not in fiscal year."));
+ display_error(_("The entered date is out of fiscal year or is closed for further data entry."));
set_focus('DatePaid');
return false;
}
unset ($_SESSION['pay_items']);
}
+ check_is_closed($type, $trans_no);
+
$cart = new items_cart($type);
$cart->order_id = $trans_no;
// apply exchange rate
foreach($cart->gl_items as $line_no => $line)
$cart->gl_items[$line_no]->amount *= $ex_rate;
-
+
} else {
$cart->reference = $Refs->get_next($cart->trans_type);
$cart->tran_date = new_doc_date();
}
elseif (!is_date_in_fiscalyear($_POST['date_']))
{
- display_error(_("The entered date is not in fiscal year."));
+ display_error(_("The entered date is out of fiscal year or is closed for further data entry."));
set_focus('date_');
$input_error = 1;
}
$_SESSION['pay_items']->trans_type, $_SESSION['pay_items']->order_id, $_POST['bank_account'],
$_SESSION['pay_items'], $_POST['date_'],
$_POST['PayType'], $_POST['person_id'], get_post('PersonDetailID'),
- $_POST['ref'], $_POST['memo_'], true);
+ $_POST['ref'], $_POST['memo_'], false);
$trans_type = $trans[0];
$trans_no = $trans[1];
function line_start_focus() {
global $Ajax;
+ unset($_POST['Index']);
$Ajax->activate('items_table');
set_focus('_code_id_edit');
}
unset ($_SESSION['journal_items']);
}
+ check_is_closed($type, $trans_no);
$cart = new items_cart($type);
$cart->order_id = $trans_no;
if ($row['amount'] == 0) continue;
$date = $row['tran_date'];
$cart->add_gl_item($row['account'], $row['dimension_id'],
- $row['dimension2_id'], $row['amount'], $row['memo_']);
+ $row['dimension2_id'], $row['amount'], $row['memo_'], '', $row['person_id']);
}
}
$cart->memo_ = get_comments_string($type, $trans_no);
}
elseif (!is_date_in_fiscalyear($_POST['date_']))
{
- display_error(_("The entered date is not in fiscal year."));
+ display_error(_("The entered date is out of fiscal year or is closed for further data entry."));
set_focus('date_');
$input_error = 1;
}
$amount = -input_num('AmountCredit');
$_SESSION['journal_items']->update_gl_item($_POST['Index'], $_POST['code_id'],
- $_POST['dimension_id'], $_POST['dimension2_id'], $amount, $_POST['LineMemo']);
+ $_POST['dimension_id'], $_POST['dimension2_id'], $amount, $_POST['LineMemo'], '', get_post('person_id'));
}
line_start_focus();
}
$amount = -input_num('AmountCredit');
$_SESSION['journal_items']->add_gl_item($_POST['code_id'], $_POST['dimension_id'],
- $_POST['dimension2_id'], $amount, $_POST['LineMemo']);
+ $_POST['dimension2_id'], $amount, $_POST['LineMemo'], '', get_post('person_id'));
line_start_focus();
}
$myrow = db_fetch_row($result);
return ($myrow[0] > 0);
}
+//
+// Returns n>0 when account is AR, n<0 when account is AP
+// (priority for AR accounts)
+//
+ function is_subledger_account($account)
+ {
+ $sql = "SELECT 1 FROM ".TB_PREF."cust_branch WHERE receivables_account=".db_escape($account)
+ ." UNION SELECT -1 FROM ".TB_PREF."suppliers WHERE payable_account=".db_escape($account);
+
+ $result = db_query($sql,"Couldn't test AR/AP account");
+ $myrow = db_fetch_row($result);
+ return $myrow[0];
+ }
+
+function get_subaccount_name($code_id, $person_id)
+{
+ $sql = "SELECT debtor_ref as ref FROM ".TB_PREF."cust_branch branch LEFT JOIN ".TB_PREF."debtors_master d ON branch.debtor_no = d.debtor_no
+ WHERE branch.receivables_account=".db_escape($code_id)." AND d.debtor_no=".db_escape($person_id)
+ ." UNION SELECT supp_ref as ref FROM ".TB_PREF."suppliers supp
+ WHERE payable_account=".db_escape($code_id)." AND supplier_id=".db_escape($person_id);
+ $result = db_query($sql, 'cannot retrieve counterparty name');
+ $row = db_fetch($result);
+
+ return $row ? $row['ref'] : '';
+}
function gl_account_in_bank_accounts($acc)
{
return null;
return max(0, get_balance_before_for_bank_account($account, add_days($date,1))); // in case of manco made before the check was implemented
}
+
+function identify_bank_account($account_number)
+{
+ $number = db_escape($account_number);
+ $sql = "(SELECT id AS id, ".BO_COMPANY." AS type FROM ".TB_PREF."bank_accounts WHERE REPLACE(bank_account_number,' ', '')=$number)";
+ $sql .= " UNION (SELECT supplier_id AS id, ".BO_SUPPLIER." AS type FROM ".TB_PREF."suppliers WHERE REPLACE(bank_account,' ', '')=$number)";
+ $sql .= " UNION (SELECT branch_code AS id, ".BO_CUSTBRANCH." AS type FROM ".TB_PREF."cust_branch WHERE REPLACE(bank_account,' ', '')=$number)";
+
+ $result = db_query($sql, 'bank account identification failed');
+
+ if (db_num_rows($result))
+ return db_fetch($result);
+ else
+ return null;
+}
?>
\ No newline at end of file
}
//------------- New helper functions for revaluation of customer/supplier currencies 2011-05-08 Joe Hunt.
-
function add_exchange_variation_all($date=null, $ref="", $memo)
{
global $Refs;
}
}
//------------- END
-
+
commit_transaction();
return array(($exchanged ? $trans_no : 0), $je);
}
if ($SysPrefs->auto_currency_revaluation())
{
$currency = get_bank_account_currency($to_account);
-
if (add_exchange_variation($trans_no1, $date_, $to_account, $to_gl_account,
$currency, PT_MISC, $person_id))
$exchanged = true;
'person_type_id', 'person_id', 'person_detail_id', 'ref', 'memo_', 'use_transaction'),
$args);
hook_db_prewrite($args, $trans_type);
+
$aid = 0;
if ($trans_no) {
$old_trans = $trans_no;
return array($trans_type, $trans_no);
}
-
-?>
\ No newline at end of file
else
$memo_ = $_SESSION["wa_current_user"]->username . " - " . $memo_;
}
+ if (!is_subledger_account($account))
+ $person_id = $person_type_id = null;
+
$sql = "INSERT INTO ".TB_PREF."gl_trans ( type, type_no, tran_date,
account, dimension_id, dimension2_id, memo_, amount";
//--------------------------------------------------------------------------------
-function get_gl_wo_cost_trans($trans_id, $person_id=-1)
+function get_gl_wo_cost_trans($trans_id, $cost_type=-1)
{
- $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=".ST_WORKORDER
- ." AND ".TB_PREF."gl_trans.type_no=".db_escape($trans_id)."
- AND ".TB_PREF."gl_trans.person_type_id=".PT_WORKORDER;
- if ($person_id != -1)
- $sql .= " AND ".TB_PREF."gl_trans.person_id=".db_escape($person_id);
- $sql .= " AND amount < 0";
+ $sql = "SELECT costing.*, gl.*, chart.account_name, com.memo_ FROM "
+ .TB_PREF."wo_costing costing, "
+ .TB_PREF."gl_trans gl LEFT JOIN ".TB_PREF."comments com ON gl.type=com.type AND gl.type_no=com.id,"
+ .TB_PREF."chart_master chart
+ WHERE
+ costing.workorder_id=".db_escape($trans_id)
+ ." AND chart.account_code=gl.account
+ AND gl.type=costing.trans_type
+ AND gl.type_no=costing.trans_no";
+ if ($cost_type != -1)
+ $sql .= " AND costing.cost_type=".db_escape($cost_type);
+ $sql .= " AND amount < 0";
return db_query($sql, "The gl transactions could not be retrieved");
}
}
add_trans_tax_details($trans_type, $trans_no, $tax['id'], $tax['rate'], $included,
$amount, $net_amount, $ex_rate, $date, $memo);
-
+
}
//--------------------------------------------------------------------------------
// post to first found bank account using given gl acount code.
$is_bank_to = is_bank_account($journal_item->code_id);
- add_gl_trans($trans_type, $trans_id, $date_, $journal_item->code_id,
- $journal_item->dimension_id, $journal_item->dimension2_id,
- $journal_item->reference, $journal_item->amount);
+ add_gl_trans($trans_type, $trans_id, $date_, $journal_item->code_id,
+ $journal_item->dimension_id, $journal_item->dimension2_id,
+ $journal_item->reference, $journal_item->amount, null,
+ $journal_item->person_type_id,
+ $journal_item->person_id);
+
if ($is_bank_to)
{
add_bank_trans($trans_type, $trans_id, $is_bank_to, $ref,
add_gl_trans($trans_type, $trans_id_reverse, $reversingDate,
$journal_item->code_id, $journal_item->dimension_id, $journal_item->dimension2_id,
- $journal_item->reference, -$journal_item->amount);
+ $journal_item->reference, -$journal_item->amount,
+ null, $journal_item->person_type_id, $journal_item->person_id);
+
if ($is_bank_to)
{
add_bank_trans($trans_type, $trans_id_reverse, $is_bank_to, $ref,
//----------------------------------------------------------------------------------------
+function clear_gl_trans($type, $trans_id, $nested=false)
+{
+ if (!$nested)
+ begin_transaction();
+
+ $sql = "DELETE FROM ".TB_PREF."gl_trans WHERE type=".db_escape($type)
+ ." AND type_no=".db_escape($trans_id);
+
+ db_query($sql, "could not clear gl transactions for type=$type and trans_no=$trans_id");
+
+ if (!$nested)
+ commit_transaction();
+}
+
+//----------------------------------------------------------------------------------------
+
function void_journal_trans($type, $type_no, $use_transaction=true)
{
if ($use_transaction)
if (!$alsoclosed) {
$sql .= " AND gl_seq=0";
}
- $sql .= " GROUP BY gl.type, gl.type_no";
+ else
+ $sql .= " AND NOT ISNULL(a.gl_seq)";
+
+ $sql .= " GROUP BY tran_date, gl_seq, gl.type, gl.type_no";
+
return $sql;
}
?>
\ No newline at end of file
$customer_error = true;
display_error(_("This customer account is on hold."));
}
- else
+ else
display_warning(_("This customer account is on hold."));
- }
+ }
break;
case PT_QUICKENTRY :
{
table_section(3, "40%");
start_row();
- quick_entries_list_cells(_("Quick Entry").":", 'person_id', null, QE_JOURNAL, true);
- $qid = get_quick_entry(get_post('person_id'));
- if (list_updated('person_id')) {
+ quick_entries_list_cells(_("Quick Entry").":", 'quick', null, QE_JOURNAL, true);
+ $qid = get_quick_entry(get_post('quick'));
+ if (list_updated('quick')) {
unset($_POST['totamount']); // enable default
$Ajax->activate('totamount');
}
end_row();
}
-
+
end_outer_table(1);
}
$dim = get_company_pref('use_dimension');
+ $sub_type = is_subledger_account(get_post('code_id'));
+ $has_subaccounts = $order->has_sub_accounts();
+
div_start('items_table');
start_table(TABLESTYLE, "colspan=7 width=95%");
if ($dim == 2)
_("Debit"), _("Credit"), _("Memo"), "");
if (count($order->gl_items)) $th[] = '';
+ if ($sub_type || $has_subaccounts)
+ array_insert($th, 2, _("Counterparty"));
- table_header($th);
+ table_header($th);
$k = 0;
$id = find_submit('Edit');
+ if ($id == -1)
+ $id = get_post('Index', -1);
+
foreach ($order->gl_items as $line => $item)
{
if ($id != $line)
{
alt_table_row_color($k);
- label_cells($item->code_id, $item->description);
+ $acc = $item->code_id . ($item->person_id ? sprintf(' %05d', $item->person_id) : '');
+ label_cells($acc, $item->description);
+
+ label_cell($item->person_name);
+
if ($dim >= 1)
label_cell(get_dimension_string($item->dimension_id, true));
if ($dim > 1)
{
amount_cell(abs($item->amount));
label_cell("");
- }
+ }
else
{
label_cell("");
}
else
{
- gl_edit_item_controls($order, $dim, $line);
+ gl_edit_item_controls($order, $dim, $item->person_id, $line);
}
}
if ($id == -1)
- gl_edit_item_controls($order, $dim);
+ gl_edit_item_controls($order, $dim, $sub_type);
if ($order->count_gl_items())
{
//---------------------------------------------------------------------------------
-function gl_edit_item_controls(&$order, $dim, $Index=null)
+function gl_edit_item_controls(&$order, $dim, $sub_accounts, $Index=null)
{
global $Ajax;
start_row();
$id = find_submit('Edit');
+ if ($id == -1)
+ $continue = $id = get_post('Index', -1);
+
if ($Index != -1 && $Index == $id)
{
// Modifying an existing row
$item = $order->gl_items[$Index];
- $_POST['code_id'] = $item->code_id;
- $_POST['dimension_id'] = $item->dimension_id;
- $_POST['dimension2_id'] = $item->dimension2_id;
- if ($item->amount > 0)
+ if (!isset($continue))
{
- $_POST['AmountDebit'] = price_format($item->amount);
- $_POST['AmountCredit'] = "";
+ $_POST['code_id'] = $item->code_id;
+ $_POST['dimension_id'] = $item->dimension_id;
+ $_POST['dimension2_id'] = $item->dimension2_id;
+ $_POST['person_id'] = $item->person_id;
+ if ($item->amount > 0)
+ {
+ $_POST['AmountDebit'] = price_format($item->amount);
+ $_POST['AmountCredit'] = "";
+ }
+ else
+ {
+ $_POST['AmountDebit'] = "";
+ $_POST['AmountCredit'] = price_format(abs($item->amount));
+ }
+ $_POST['description'] = $item->description;
+ $_POST['LineMemo'] = $item->reference;
}
- else
- {
- $_POST['AmountDebit'] = "";
- $_POST['AmountCredit'] = price_format(abs($item->amount));
- }
- $_POST['description'] = $item->description;
- $_POST['LineMemo'] = $item->reference;
-
hidden('Index', $id);
$skip_bank = !$_SESSION["wa_current_user"]->can_access('SA_BANKJOURNAL');
- echo gl_all_accounts_list('code_id', null, $skip_bank, true);
+ echo gl_all_accounts_list('code_id', null, $skip_bank, true, _('[Select account]'), true, false, false);
+
+ if (is_subledger_account(get_post('code_id')))
+ {
+ subledger_list_cells(null, 'person_id', get_post('code_id'));
+ } elseif ($order->has_sub_accounts())
+ label_cell('');
if ($dim >= 1)
dimensions_list_cells(null, 'dimension_id', null, true, " ", false, 1);
if ($dim > 1)
}
else
{
- // Adding a new row
- $_POST['AmountDebit'] = ''; //price_format(0);
- $_POST['AmountCredit'] = ''; //price_format(0);
- $_POST['dimension_id'] = 0;
- $_POST['dimension2_id'] = 0;
- //$_POST['LineMemo'] = ""; // let memo go to next line Joe Hunt 2010-05-30
- $_POST['_code_id_edit'] = "";
- $_POST['code_id'] = "";
+
+ if (!list_updated('code_id'))
+ {
+ // Adding a new row
+ $_POST['AmountDebit'] = ''; //price_format(0);
+ $_POST['AmountCredit'] = ''; //price_format(0);
+ $_POST['dimension_id'] = 0;
+ $_POST['dimension2_id'] = 0;
+ //$_POST['LineMemo'] = ""; // let memo go to next line Joe Hunt 2010-05-30
+ $_POST['_code_id_edit'] = "";
+ $_POST['code_id'] = "";
+ }
if(isset($_POST['_code_id_update'])) {
- $Ajax->activate('code_id');
+ $Ajax->activate('code_id');
}
-
+
$skip_bank = !$_SESSION["wa_current_user"]->can_access('SA_BANKJOURNAL');
- echo gl_all_accounts_list('code_id', null, $skip_bank, true);
+ echo gl_all_accounts_list('code_id', null, $skip_bank, true, _('[Select account]'), true, false, false);
+
+ if ($sub_accounts)
+ {
+ subledger_list_cells(null, 'person_id', get_post('code_id'));
+ }
+ elseif ($order->has_sub_accounts())
+ label_cell('');
+
if ($dim >= 1)
dimensions_list_cells(null, 'dimension_id', null, true, " ", false, 1);
if ($dim > 1)
echo "</table>";
}
-
-
-//---------------------------------------------------------------------------------
-
-?>
\ No newline at end of file
label_cell($trandate);
display_debit_or_credit_cells($myrow["amount"]);
amount_cell($running_total);
- label_cell(payment_person_name($myrow["person_type_id"],$myrow["person_id"]));
+ label_cell(get_counterparty_name($myrow["type"], $myrow["trans_no"]));
label_cell(get_gl_view_str($myrow["type"], $myrow["trans_no"]));
end_row();
if ($myrow["amount"] > 0 )
function display_trial_balance($type, $typename)
{
global $path_to_root;
-
+
global $k, $pdeb, $pcre, $cdeb, $ccre, $tdeb, $tcre, $pbal, $cbal, $tbal;
$printtitle = 0; //Flag for printing type name
$k = 0;
- //$accounts = get_gl_accounts();
//Get Accounts directly under this group/type
- $accounts = get_gl_accounts(null, null, $type);
-
+ $accounts = get_gl_accounts(null, null, $type);
+
$begin = get_fiscalyear_begin_for_date($_POST['TransFromDate']);
- //$begin = begin_fiscalyear();
if (date1_greater_date2($begin, $_POST['TransFromDate']))
$begin = $_POST['TransFromDate'];
$begin = add_days($begin, -1);
-
+
while ($account = db_fetch($accounts))
{
//Print Type Title if it has atleast one non-zero account
if (!$printtitle)
- {
+ {
start_row("class='inquirybg' style='font-weight:bold'");
label_cell(_("Group")." - ".$type ." - ".$typename, "colspan=8");
- end_row();
- $printtitle = 1;
- }
-
+ end_row();
+ $printtitle = 1;
+ }
+
$prev = get_balance($account["account_code"], $_POST['Dimension'], $_POST['Dimension2'], $begin, $_POST['TransFromDate'], false, false);
$curr = get_balance($account["account_code"], $_POST['Dimension'], $_POST['Dimension2'], $_POST['TransFromDate'], $_POST['TransToDate'], true, true);
$tot = get_balance($account["account_code"], $_POST['Dimension'], $_POST['Dimension2'], $begin, $_POST['TransToDate'], false, true);
display_debit_or_credit_cells($prev['balance']);
display_debit_or_credit_cells($curr['balance']);
display_debit_or_credit_cells($tot['balance']);
-
+
}
else
{
{
start_row("class='inquirybg' style='font-weight:bold'");
label_cell(_("Group")." - ".$type ." - ".$typename, "colspan=8");
- end_row();
- $printtitle = 1;
+ end_row();
+ $printtitle = 1;
+
}
display_trial_balance($accounttype["id"], $accounttype["name"].' ('.$typename.')');
}
display_error(_("The from date cannot be bigger than the fiscal year end."));
set_focus('TransFromDate');
return;
- }
-}
+ }
+}
div_start('balance_tbl');
if (!isset($_POST['Dimension']))
$_POST['Dimension'] = 0;
--- /dev/null
+<?php
+/**********************************************************************
+ Copyright (C) FrontAccounting, LLC.
+ Released under the terms of the GNU General Public License, GPL,
+ as published by the Free Software Foundation, either version 3
+ of the License, or (at your option) any later version.
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ See the License here <http://www.gnu.org/licenses/gpl-3.0.html>.
+***********************************************************************/
+
+$page_security = 'SA_GLCLOSE';
+$path_to_root = "../..";
+include_once($path_to_root . "/includes/session.inc");
+
+include_once($path_to_root . "/includes/date_functions.inc");
+include_once($path_to_root . "/includes/ui.inc");
+include_once($path_to_root . "/includes/banking.inc");
+include_once($path_to_root . "/admin/db/fiscalyears_db.inc");
+
+$js = "";
+if ($use_date_picker)
+ $js .= get_js_date_picker();
+page(_($help_context = "Closing GL Transactions"), false, false, "", $js);
+
+//---------------------------------------------------------------------------------------------
+function check_data()
+{
+ global $Refs, $allow_gl_reopen;
+
+ if (!is_date($_POST['date']) || date1_greater_date2($_POST['date'], Today()))
+ {
+ display_error( _("The entered date is invalid."));
+ set_focus('date');
+ return false;
+ }
+ if (!is_date_in_fiscalyears($_POST['date'], false))
+ {
+ display_error(_("Selected date is not in fiscal year or the year is closed."));
+ set_focus('date');
+ return false;
+ }
+ if (date1_greater_date2(sql2date(get_company_pref('gl_closing_date')), $_POST['date']))
+ {
+ if (!$allow_gl_reopen) {
+ display_error(_("The entered date is earlier than date already selected as closing date."));
+ set_focus('date');
+ return false;
+ } elseif (!user_check_access('SA_GLREOPEN')) {
+ display_error(_("You are not allowed to reopen already closed transactions."));
+ set_focus('date');
+ return false;
+ }
+ }
+ return true;
+}
+
+//---------------------------------------------------------------------------------------------
+
+function handle_submit()
+{
+ if (!check_data())
+ return;
+
+ if (!close_transactions($_POST['date']))
+ {
+ display_notification(
+ sprintf( _("All transactions resulting in GL accounts changes up to %s has been closed for further edition."),
+ sql2date(get_company_pref('gl_closing_date'))) );
+ }
+
+}
+
+
+//---------------------------------------------------------------------------------------------
+
+function clear_data()
+{
+ unset($_POST['date_']);
+}
+
+//---------------------------------------------------------------------------------------------
+
+if (get_post('submit'))
+ handle_submit();
+else
+ display_note(_("Using this feature you can prevent entering new transactions <br>
+ and disable edition of already entered transactions up to specified date.<br>
+ Only transactions which can generate GL postings are subject to the constraint."));
+
+//---------------------------------------------------------------------------------------------
+
+br(1);
+start_form();
+start_table(TABLESTYLE2);
+if (!isset($_POST['date'])) {
+ $cdate = sql2date(get_company_pref('gl_closing_date'));
+ $_POST['date'] = $cdate ;// ? end_month(add_months($cdate, 1)) : Today();
+}
+date_row(_("End date of closing period:"), 'date');
+end_table(1);
+
+submit_center('submit', _("Close Transactions"), true, false);
+end_form();
+
+end_page();
+
+?>
$page_security = 'SA_GLACCOUNT';
$path_to_root = "../..";
include($path_to_root . "/includes/session.inc");
-
+
page(_($help_context = "Chart of Accounts"));
include($path_to_root . "/includes/ui.inc");
if (get_post('inactive') == 1 && is_bank_account($_POST['account_code']))
{
display_error(_("The account belongs to a bank account and cannot be inactivated."));
- }
+ }
elseif (update_gl_account($_POST['account_code'], $_POST['account_name'],
$_POST['account_type'], $_POST['account_code2'])) {
update_record_status($_POST['account_code'], $_POST['inactive'],
{
display_error(_("Cannot delete this account because it is used by a bank account."));
return false;
- }
+ }
if (gl_account_in_stock_category($selected_account))
{
display_error(_("Cannot delete this account because it is used by one or more Item Categories."));
return false;
- }
-
+ }
+
if (gl_account_in_stock_master($selected_account))
{
display_error(_("Cannot delete this account because it is used by one or more Items."));
return false;
- }
-
+ }
+
if (gl_account_in_tax_types($selected_account))
{
display_error(_("Cannot delete this account because it is used by one or more Taxes."));
return false;
- }
-
+ }
+
if (gl_account_in_cust_branch($selected_account))
{
display_error(_("Cannot delete this account because it is used by one or more Customer Branches."));
return false;
- }
-
+ }
if (gl_account_in_suppliers($selected_account))
{
display_error(_("Cannot delete this account because it is used by one or more suppliers."));
}
if (!is_date_in_fiscalyear($_POST['date']))
{
- display_error(_("The entered date is not in fiscal year."));
+ display_error(_("The entered date is out of fiscal year or is closed for further data entry."));
set_focus('date');
return false;
}
label_cells(_("Date"), sql2date($to_trans['trans_date']), "class='tableheader2'");
end_row();
start_row();
-label_cells(_("From"), payment_person_name($to_trans['person_type_id'], $to_trans['person_id']), "class='tableheader2'", "colspan=$colspan1");
+label_cells(_("From"), get_counterparty_name(ST_BANKDEPOSIT, $trans_no), "class='tableheader2'", "colspan=$colspan1");
label_cells(_("Deposit Type"), $bank_transfer_types[$to_trans['account_type']], "class='tableheader2'");
end_row();
start_row();
label_cells(_("Date"), sql2date($from_trans['trans_date']), "class='tableheader2'");
end_row();
start_row();
-label_cells(_("Pay To"), payment_person_name($from_trans['person_type_id'], $from_trans['person_id']), "class='tableheader2'", "colspan=$colspan1");
+label_cells(_("Pay To"), get_counterparty_name(ST_BANKPAYMENT, $trans_no), "class='tableheader2'", "colspan=$colspan1");
label_cells(_("Payment Type"), $bank_transfer_types[$from_trans['account_type']], "class='tableheader2'");
end_row();
start_row();
$trans_name = $systypes_array[$_GET['type_id']];
start_table(TABLESTYLE, "width=95%");
$th = array(_("General Ledger Transaction Details"), _("Reference"),
- _("Date"), _("Person/Item"));
- table_header($th);
- start_row();
+ _("Date"));
+
+ if ($_GET['type_id'] != ST_JOURNAL)
+ $th[] = _("Counterparty");
+
+ table_header($th);
+ start_row();
label_cell("$trans_name #" . $_GET['trans_no']);
label_cell($myrow["reference"]);
label_cell(sql2date($myrow["tran_date"]));
- label_cell(payment_person_name($myrow["person_type_id"],$myrow["person_id"]));
-
+ if ($_GET['type_id'] != ST_JOURNAL)
+ label_cell(get_counterparty_name($_GET['type_id'],$_GET['trans_no']));
+
end_row();
comments_display_row($_GET['type_id'], $_GET['trans_no']);
else
$th = array(_("Account Code"), _("Account Name"),
_("Debit"), _("Credit"), _("Memo"));
+
$k = 0; //row colour counter
$heading_shown = false;
start_table(TABLESTYLE, "width=95%");
table_header($th);
$heading_shown = true;
- }
+ }
alt_table_row_color($k);
-
- label_cell($myrow['account']);
- label_cell($myrow['account_name']);
+
+ $counterpartyname = get_subaccount_name($myrow["account"], $myrow["person_id"]);
+ $counterparty_id = $counterpartyname ? sprintf(' %05d', $myrow["person_id"]) : '';
+
+ label_cell($myrow['account'].$counterparty_id);
+ label_cell($myrow['account_name'] . ($counterpartyname ? ': '.$counterpartyname : ''));
if ($dim >= 1)
label_cell(get_dimension_string($myrow['dimension_id'], true));
if ($dim > 1)
'SA_FISCALYEARS' => array(SS_GL_C|9, _("Fiscal years maintenance")),
'SA_GLSETUP' => array(SS_GL_C|10, _("Company GL setup")),
'SA_GLACCOUNTTAGS' => array(SS_GL_C|11, _("GL Account tags")),
+ 'SA_GLCLOSE' => array(SS_GL_C|14, _("Closing GL transactions")),
+ 'SA_GLREOPEN' => array(SS_GL_C|15, _("Reopening GL transactions")), // see below
'SA_MULTIFISCALYEARS' => array(SS_GL_C|13, _("Allow entry on non closed Fiscal years")),
'SA_BANKTRANSVIEW' => array(SS_GL|1, _("Bank transactions view")),
'SA_BANKREP' => array(SS_GL_A|3, _("Bank reports and inquiries")),
'SA_GLREP' => array(SS_GL_A|4, _("GL reports and inquiries")),
);
+
+if (!@$allow_gl_reopen)
+ unset($security_areas['SA_GLREOPEN']);
/*
This function should be called whenever we want to extend core access level system
with new security areas and/or sections i.e.:
--- /dev/null
+<?php
+/**********************************************************************
+ Copyright (C) FrontAccounting, LLC.
+ Released under the terms of the GNU General Public License, GPL,
+ as published by the Free Software Foundation, either version 3
+ of the License, or (at your option) any later version.
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ See the License here <http://www.gnu.org/licenses/gpl-3.0.html>.
+***********************************************************************/
+/*
+ This file contains all application entry points.
+*/
+
+/*
+ Transaction editors. First paraneter is transaction number, second (optional) transaction type.
+*/
+$trans_editors = array(
+
+ ST_JOURNAL => "/gl/gl_journal.php?ModifyGL=Yes&trans_no=%d&trans_type=%d",
+ ST_BANKPAYMENT => "/gl/gl_bank.php?ModifyPayment=Yes&trans_no=%d&trans_type=%d",
+ ST_BANKDEPOSIT => "/gl/gl_bank.php?ModifyDeposit=Yes&trans_no=%d&trans_type=%d",
+ //ST_BANKTRANSFER => ,
+
+ ST_SALESINVOICE => "/sales/customer_invoice.php?ModifyInvoice=%d",
+// 11=>
+// free hand (debtors_trans.order_==0)
+// "/sales/credit_note_entry.php?ModifyCredit=%d"
+// credit invoice
+// "/sales/customer_credit_invoice.php?ModifyCredit=%d"
+ ST_CUSTCREDIT => "/sales/customer_credit_invoice.php?ModifyCredit=%s",
+ //ST_CUSTPAYMENT => ,
+ ST_CUSTDELIVERY => "/sales/customer_delivery.php?ModifyDelivery=%d",
+
+ //ST_LOCTRANSFER => ,
+ //ST_INVADJUST => ,
+
+ ST_PURCHORDER => "/purchasing/po_entry_items.php?ModifyOrderNumber=%d",
+ ST_SUPPINVOICE => "/purchasing/supplier_invoice.php?ModifyInvoice=%d",
+
+ //ST_SUPPCREDIT => ,
+ //ST_SUPPAYMENT => ,
+ //ST_SUPPRECEIVE => ,
+
+ //ST_WORKORDER => ,
+ //ST_MANUISSUE => ,
+ //ST_MANURECEIVE => ,
+
+ ST_SALESORDER => "/sales/sales_order_entry.php?ModifyOrderNumber=%d",
+ ST_SALESQUOTE => "/sales/sales_order_entry.php?ModifyQuotationNumber=%d",
+ //ST_COSTUPDATE => ,
+ //ST_DIMENSION => ,
+);
if ($Auth_Result)
{
$myrow = get_user_by_login($loginname);
+
$this->old_db = isset($myrow["full_access"]);
if (! @$myrow["inactive"]) {
if ($this->old_db) {
return $_SESSION["wa_current_user"]->prefs->start_up_tab();
}
+function user_check_access($sec_area)
+{
+ return $_SESSION["wa_current_user"]->can_access($sec_area);
+}
+
function set_user_prefs($prefs)
{
$_SESSION["wa_current_user"]->update_prefs($prefs);
$dir = opendir($path);
if(!$dir)
return;
+
while(false !== ($fname = readdir($dir))) {
if($fname=='.' || $fname=='..' || $fname=='CVS' || (!$wipe && $fname=='index.php')) continue;
if(is_dir($path.'/'.$fname)) {
return 1;
}
-
-?>
\ No newline at end of file
+function check_is_closed($type, $type_no, $msg=null)
+{
+ global $systypes_array;
+
+ if (($type_no > 0) && is_closed_trans($type, $type_no))
+ {
+ if (!$msg)
+ $msg = sprintf(_("%s #%s is closed for further edition."), $systypes_array[$type], $type_no);
+ display_error($msg, true);
+ end_page();
+ exit;
+ }
+}
global $path_to_root;
include_once($path_to_root . "/admin/db/fiscalyears_db.inc");
- //Chaitanya
- if ($convert)
- $date2 = sql2date($date);
- else
- $date2 = $date;
-
- if ($_SESSION["wa_current_user"]->can_access('SA_MULTIFISCALYEARS')) // allow all open years for this one
- return is_date_in_fiscalyears($date2, false);
-
- $myrow = get_current_fiscalyear();
- if ($myrow['closed'] == 1)
- return 0;
-
- $begin = sql2date($myrow['begin']);
- $end = sql2date($myrow['end']);
- if (date1_greater_date2($begin, $date2) || date1_greater_date2($date2, $end))
- {
- return 0;
- }
- return 1;
+ if ($convert)
+ $date2 = sql2date($date);
+ else
+ $date2 = $date;
+
+ if (user_check_access('SA_MULTIFISCALYEARS')) // allow all open years for this one
+ return is_date_in_fiscalyears($date2, false);
+
+ if (is_date_closed($date2))
+ return 0;
+ $myrow = get_current_fiscalyear();
+ $begin = sql2date($myrow['begin']);
+ $end = sql2date($myrow['end']);
+ if (date1_greater_date2($begin, $date2) || date1_greater_date2($date2, $end))
+ {
+ return 0;
+ }
+ return 1;
+}
+
+function is_date_closed($date)
+{
+ return !date1_greater_date2($date, sql2date(get_company_pref('gl_closing_date')));
}
function begin_fiscalyear()
$date_ = trim($date_);
$year = $month = $day = 0;
-
// Split up the date by the separator based on "how" to split it
if ($how == 0) // MMDDYYYY
list($month, $day, $year) = explode($sep, $date_);
function add_audit_trail($trans_type, $trans_no, $trans_date, $descr='')
{
+ $date = date2sql($trans_date);
$sql = "INSERT INTO ".TB_PREF."audit_trail"
- . " (type, trans_no, user, fiscal_year, gl_date, description, gl_seq)
+ . " (type, trans_no, user, gl_date, description)
VALUES(".db_escape($trans_type).", ".db_escape($trans_no).","
- . $_SESSION["wa_current_user"]->user. ","
- . get_company_pref('f_year') .","
- . "'". date2sql($trans_date) ."',"
- . db_escape($descr). ", 0)";
+ . $_SESSION["wa_current_user"]->user . ","
+ . "'$date',". db_escape($descr). ")";
db_query($sql, "Cannot add audit info");
-
- // all audit records beside latest one should have gl_seq set to NULL
+ // all audit records beside just inserted one should have gl_seq set to NULL
// to avoid need for subqueries (not existing in MySQL 3) all over the code
- $sql = "UPDATE ".TB_PREF."audit_trail SET gl_seq = NULL"
+ $sql = "UPDATE ".TB_PREF."audit_trail audit LEFT JOIN ".TB_PREF."fiscal_year year ON year.begin<='$date' AND year.end>='$date'
+ SET audit.gl_seq = IF(audit.id=".db_insert_id().", 0, NULL),"
+ ."audit.fiscal_year=year.id"
. " WHERE type=".db_escape($trans_type)." AND trans_no="
- .db_escape($trans_no)." AND id!=".db_insert_id();
+ . db_escape($trans_no);
db_query($sql, "Cannot update audit gl_seq");
}
and reindex journal.
*/
function close_transactions($todate) {
+
+ begin_transaction();
+
$errors = 0;
- $sql = "SELECT DISTINCT a.id, a.gl_date, a.fiscal_year"
+ // select only those audit trail records which produce any GL postings
+ $sql = "SELECT a.id, gl.tran_date, a.fiscal_year, a.gl_seq,
+ gl.tran_date <= '". date2sql($todate) ."' as closed"
." FROM ".TB_PREF."gl_trans gl"
." LEFT JOIN ". TB_PREF."audit_trail a ON
(gl.type=a.type AND gl.type_no=a.trans_no)"
- . " WHERE gl_date<='". date2sql($todate) ."'"
- . " AND NOT ISNULL(gl_seq)"
- . " ORDER BY a.fiscal_year, a.gl_date, a.id";
+ . " WHERE NOT ISNULL(a.gl_seq) AND gl.amount!=0" // skip old audit records and voided transactions
+ . " GROUP BY a.id, gl.tran_date, a.fiscal_year, a.gl_seq ORDER BY a.fiscal_year, gl.tran_date, a.id";
$result = db_query($sql, "Cannot select transactions for closing");
}
if ($last_year != $row['fiscal_year']) {
$last_year = $row['fiscal_year'];
- $counter = 1; // reset counter on fiscal year change
- } else
- $counter++;
- $sql2 = "UPDATE ".TB_PREF."audit_trail SET"
- . " gl_seq=$counter"
- . " WHERE id=".$row['id'];
-
- db_query($sql2, "Cannot reindex journal");
+ $counter = 0; // reset counter on fiscal year change
+ }
+
+ $seq = $row['closed'] ? ++$counter : 0;
+ if ($row['gl_seq'] != $seq) { // update transaction status only when gl_seq has changed
+ $sql2 = "UPDATE ".TB_PREF."audit_trail SET"
+ . " gl_seq=$seq"
+ . " WHERE id=".$row['id'];
+ db_query($sql2, "Cannot reindex journal");
+ }
}
}
-
+
if ($errors)
display_warning(_("Some transactions journal GL postings were not indexed due to lack of audit trail record."));
-}
-
-/*
- Reopen all transactions for edition up from date $fromdate
-*/
-function open_transactions($fromdate) {
-
- $sql = "SELECT a.id, a.gl_date, a.fiscal_year"
- ." FROM ".TB_PREF."gl_trans gl"
- ." LEFT JOIN ". TB_PREF."audit_trail a ON
- (gl.type=a.type AND gl.type_no=a.trans_no)"
- . " WHERE gl_date>='". date2sql($fromdate) ."'"
- . " AND !ISNULL(gl_seq)"
- . " ORDER BY a.fiscal_year, a.gl_date, a.id";
-
- $result = db_query($sql, "Cannot select transactions for openning");
+ else
+ update_company_prefs(array('gl_closing_date'=> date2sql($todate)));
+ commit_transaction();
- if (db_num_rows($result)) {
- $last_year = 0;
-
- while ($row = db_fetch($result)) {
- if ($row['fiscal_year'] == null) {
- continue;
- }
- $sql2 = "UPDATE ".TB_PREF."audit_trail SET"
- . " gl_seq=0"
- . " WHERE id=".$row['id'];
-
- db_query($sql2, "Cannot clear journal order");
- }
- }
+ return $errors;
}
+
/*
Closed transactions have gl_seq number assigned.
*/
function is_closed_trans($type, $trans_no) {
+
+ $cdate = get_company_pref('gl_closing_date');
+ if (!$cdate)
+ return false;
+
+// FIXME: gl_date can be badly entered for some transactions due to bug in previous FA versions
$sql = "SELECT gl_seq FROM ".TB_PREF."audit_trail"
. " WHERE type=".db_escape($type)
." AND trans_no=".db_escape($trans_no)
- ." AND gl_seq>0";
+ ." AND gl_date<='$cdate'"; // date is stored in sql format
+// ." AND (gl_date<='$cdate'" // some transaction can be not sequenced due to 0 amount, however after edition this could change
+// ." OR gl_seq>0)";
$res = db_query($sql, "Cannot check transaction");
{
global $db, $show_sql, $sql_trail, $select_trail, $go_debug, $sql_queries, $Ajax,
$db_connections, $db_last_inserted_id;
-
+
// set current db prefix
$cur_prefix = $db_connections[$_SESSION["wa_current_user"]->cur_con]['tbpref'];
$sql = str_replace(TB_PREF, $cur_prefix, $sql);
}
$result = mysql_query($sql, $db);
-
+
if($sql_trail) {
$db_last_inserted_id = mysql_insert_id($db); // preserve in case trail insert is done
if ($select_trail || (strstr($sql, 'SELECT') === false)) {
$negative_trans_id = $myrow['trans_id'];
}
if ($qty >= 0)
- $flag = 0;
+ $flag = 0;
}
-
+
if ($flag == 1)
return $negative_trans_id;
else
function get_deliveries_from_trans($stock_id, $from)
{
// -ve qty is delivery either by ST_CUSTDELIVERY or inventory adjustment
- //Price for GRN and SUPPCREDIT and std_cost for other trans_types\r
- $sql = "SELECT SUM(-qty), SUM(-qty*IF(type=".ST_SUPPRECEIVE." OR type=".ST_SUPPCREDIT.", price, standard_cost))\r
- FROM ".TB_PREF."stock_moves\r
- WHERE stock_id=".db_escape($stock_id)." AND qty < 0 AND\r
+ //Price for GRN and SUPPCREDIT and std_cost for other trans_types
+ $sql = "SELECT SUM(-qty), SUM(-qty*IF(type=".ST_SUPPRECEIVE." OR type=".ST_SUPPCREDIT.", price, standard_cost))
+ FROM ".TB_PREF."stock_moves
+ WHERE stock_id=".db_escape($stock_id)." AND qty < 0 AND
trans_id>='$from' GROUP BY stock_id";
$result = db_query($sql, "The deliveries could not be updated");
$row = db_fetch_row($result);
- $sql = "SELECT IF(type=".ST_SUPPRECEIVE." OR type=".ST_SUPPCREDIT.", price, standard_cost)\r
- FROM ".TB_PREF."stock_moves\r
- WHERE stock_id=".db_escape($stock_id)\r
- ." AND trans_id ='$from'";\r
- $result = db_query($sql, "The deliveries could not be updated");\r
+ $sql = "SELECT IF(type=".ST_SUPPRECEIVE." OR type=".ST_SUPPCREDIT.", price, standard_cost)
+ FROM ".TB_PREF."stock_moves
+ WHERE stock_id=".db_escape($stock_id)
+ ." AND trans_id ='$from'";
+ $result = db_query($sql, "The deliveries could not be updated");
$cost = db_fetch_row($result);
-
+
// Adjusting QOH valuation
$sql = "SELECT SUM(qty) FROM ".TB_PREF."stock_moves
WHERE stock_id=".db_escape($stock_id)." AND
trans_id<'$from' GROUP BY stock_id";
$result = db_query($sql, "The deliveries could not be updated");
$qoh = db_fetch_row($result);
-
- $qty = $row[0] - $qoh[0]; //QOH prior to -ve stock is subtracted\r
+
+ $qty = $row[0] - $qoh[0]; //QOH prior to -ve stock is subtracted
$final_cost = $row[1] - $qoh[0]*$cost[0];
return array($qty,$final_cost);
$new_purchase_cost = $row[0] * $material_cost;
$purchase_diff = $new_purchase_cost - $old_purchase_cost;
}
-
+
$diff = $sales_diff - $purchase_diff;
if ($diff != 0)
}
//-----------------------------------------------------------------------------------------
-\r
+
function handle_negative_inventory($stock_id, $quantity, $standard_cost, $date_)
{
- //If negative adjustment result in negative or zero inventory \r
+ //If negative adjustment result in negative or zero inventory
//then difference should be adjusted
$qoh = get_qoh_on_date($stock_id);
function void_stock_move($type, $type_no)
{
-
$sql = "SELECT stock_id, standard_cost, loc_code, tran_date, reference, person_id, visible, discount_percent, price,
sum(qty) qty FROM ".TB_PREF."stock_moves WHERE type=".db_escape($type)." AND trans_no=".db_escape($type_no)."
GROUP BY stock_id, standard_cost, loc_code, tran_date, reference, person_id, visible, discount_percent, price HAVING sum(qty) <> 0";
-
$result = db_query($sql, "Could not void stock moves");
while ($row = db_fetch($result))
{
//Skip cost averaging of service items
if (is_inventory_item($row["stock_id"]))
- {
+ {
// The cost has to be adjusted.
// Transaction rates are stored either as price or standard_cost depending on types
$types = array(ST_SUPPCREDIT, ST_SUPPRECEIVE);
update_average_material_cost(0, $row["stock_id"],
$trans_rate, -$row["qty"], sql2date($row["tran_date"]));
}
-
+
//Post stock move for service items also
add_stock_move($type, $row["stock_id"], $type_no, $row["loc_code"],
sql2date($row["tran_date"]), $row["reference"], -$row["qty"]
, $row["standard_cost"], $row["person_id"], $row["visible"],
$row["price"], $row["discount_percent"]);
- }\r
+ }
}
//--------------------------------------------------------------------------------------------------
display_db_error("could not retreive the location name for $loc_code", $sql, true);
}
-
-//--------------------------------------------------------------------------------------------------
-
-
-?>
\ No newline at end of file
// FIX center is unused now
function fmt_errors($center=false) {
global $messages, $path_to_root, $go_debug;
-
+
$msg_class = array(
E_USER_ERROR => 'err_msg',
E_USER_WARNING =>'warn_msg',
$content = ''; // clean other messages
}
}
-
+
$str = $msg[1];
if (!in_array($msg[0], array(E_USER_NOTICE, E_USER_ERROR, E_USER_WARNING)) && $msg[2] != null)
$str .= ' '._('in file').': '.$msg[2].' '._('at line ').$msg[3];
function price_in_words($amount, $doc_type)
{
}
+
//
// Exchange rate currency $curr as on date $date.
// Keep in mind FA has internally implemented 3 exrate providers
function activate_hooks($ext, $comp)
{
global $Hooks;
-
+
$hooks = @$Hooks[$ext];
if (!$hooks) {
$hookclass = 'hooks_'.$ext;
{
global $Hooks;
-
+
$result = null;
foreach($Hooks as $ext => $hook) {
if (method_exists($hook, $method)) {
include_once($path_to_root . "/admin/db/users_db.inc");
include_once($path_to_root . "/includes/ui/ui_view.inc");
include_once($path_to_root . "/includes/ui/ui_controls.inc");
-
+
+$page_nested = -1;
+
function page($title, $no_menu=false, $is_index=false, $onload="", $js="", $script_only=false, $css='')
{
- global $path_to_root, $page_security;
+ global $path_to_root, $page_security, $page_nested;
+ if (++$page_nested) return;
$hide_menu = $no_menu;
- include($path_to_root . "/includes/page/header.inc");
+ include_once($path_to_root . "/includes/page/header.inc");
page_header($title, $no_menu, $is_index, $onload, $js, $css);
check_page_security($page_security);
// error_box();
- if($script_only) {
+ if($script_only) {
echo '<noscript>';
echo display_heading(_('This page is usable only with javascript enabled browsers.'));
echo '</noscript>';
function end_page($no_menu=false, $is_index=false, $final_screen=false, $type_no=0, $trans_no=0)
{
- global $path_to_root;
+ global $path_to_root, $page_nested;
+
+ if ($page_nested-- > 0) return;
if (!$is_index && function_exists('hyperlink_back'))
hyperlink_back(true, $no_menu, $type_no, $trans_no, $final_screen);
div_end(); // end of _page_body section
- include($path_to_root . "/includes/page/footer.inc");
+ include_once($path_to_root . "/includes/page/footer.inc");
page_footer($no_menu, $is_index);
}
}
//----------------------------------------------------------------------------
-
-function is_new_reference($ref, $type)
+//
+// Check if reference was not used so far (for other transaction than $trans_no)
+//
+function is_new_reference($ref, $type, $trans_no=0)
{
$db_info = get_systype_db_info($type);
$db_name = $db_info[0];
ini_set('session.gc_maxlifetime', 36000); // 10hrs
+hook_session_start(@$_POST["company_login_name"]);
+
$Session_manager = new SessionManager();
$Session_manager->sessionStart('FA'.md5(dirname(__FILE__)));
include_once($path_to_root . "/includes/access_levels.inc");
include_once($path_to_root . "/version.php");
include_once($path_to_root . "/includes/main.inc");
+include_once($path_to_root . "/includes/app_entries.inc");
// Ajax communication object
$Ajax = new Ajax();
// POST vars cleanup needed for direct reuse.
// We quote all values later with db_escape() before db update.
$_POST = strip_quotes($_POST);
-
-?>
\ No newline at end of file
//
global $systypes_array, $bank_account_types, $bank_transfer_types,
$payment_person_types, $wo_types_array, $wo_cost_types, $class_types,
- $quick_actions, $quick_entry_types, $stock_types, $tag_types;
+ $quick_actions, $quick_entry_types, $stock_types, $tag_types, $bank_owner;
$systypes_array = array (
ST_JOURNAL => _("Journal Entry"),
$wo_cost_types = array(
WO_LABOUR => _("Labour Cost"),
WO_OVERHEAD => _("Overhead Cost"),
+ WO_MATERIALS => _("Materials")
);
//----------------------------------------------------------------------------------
PTT_FOLLOWING => _("Day In Following Month")
);
+$tax_algorithms = array(
+ TCA_LINES => _("Sum per line taxes"),
+ TCA_TOTALS => _("Taxes from totals")
+);
+//----------------------------------------------------------------------------------
+
+$bank_owner_types = array(
+ BO_UNKNOWN => _("Unknown"),
+ BO_COMPANY => _("Company"),
+ BO_CUSTBRANCH => _("Customer"),
+ BO_SUPPLIER => _("Supplier")
+);
?>
\ No newline at end of file
function tst_langs($install)
{
global $installed_languages, $path_to_root, $GetText;
-
+
$test['descr'] = _('Language configuration consistency');
$test['type'] = 3;
$test['result'] = true;
}
}
+//
+// Returns counterparty (supplier/customer) name for selected transaction.
+//
+function get_counterparty_name($trans_type, $trans_no, $full=true)
+{
+ switch($trans_type)
+ {
+ case ST_SALESORDER:
+ case ST_SALESQUOTE:
+ $sql = "SELECT order.customer_id as person_id, debtor.name as name
+ FROM ".TB_PREF."sales_orders order, ".TB_PREF."debtors_master debtor
+ WHERE order_no=".db_escape($trans_no)." AND trans_type=".db_escape($trans_type)
+ ." AND order.debtor_no=debtor.debtor_no";
+ break;
+ case ST_SALESINVOICE :
+ case ST_CUSTCREDIT :
+ case ST_CUSTPAYMENT :
+ case ST_CUSTDELIVERY :
+ $sql = "SELECT trans.debtor_no as person_id, debtor.name as name
+ FROM ".TB_PREF."debtor_trans trans, ".TB_PREF."debtors_master debtor
+ WHERE trans_no=".db_escape($trans_no)." AND type=".db_escape($trans_type)
+ ." AND trans.debtor_no=debtor.debtor_no";
+ break;
+
+ case ST_PURCHORDER :
+ $sql = "SELECT order.supplier_id as person_id, supp.supp_name as name
+ FROM ".TB_PREF."purch_orders order, ".TB_PREF."suppliers supp
+ WHERE order_no=".db_escape($trans_no)
+ ." AND order.supplier_id=supp.supplier_id";
+ break;
+
+ case ST_SUPPINVOICE :
+ case ST_SUPPCREDIT :
+ case ST_SUPPAYMENT :
+ $sql = "SELECT trans.supplier_id as person_id, supp.supp_name as name
+ FROM ".TB_PREF."supp_trans trans, ".TB_PREF."suppliers supp
+ WHERE trans_no=".db_escape($trans_no)." AND type=".db_escape($trans_type)
+ ." AND trans.supplier_id=supp.supplier_id";
+ break;
+
+ case ST_SUPPRECEIVE :
+ $sql = "SELECT trans.supplier_id as person_id, supp.supp_name as name
+ FROM ".TB_PREF."grn_batch trans, ".TB_PREF."suppliers supp
+ WHERE id=".db_escape($trans_no)
+ ." AND trans.supplier_id=supp.supplier_id";
+ break;
+
+ case ST_JOURNAL: // FIXME - this one can have multiply counterparties of various types depending on person_type_id
+
+ default:
+ /* // internal operations
+ case ST_WORKORDER :
+ case ST_INVADJUST : // GRN/DN returns ?
+ case ST_BANKTRANSFER :
+ case ST_LOCTRANSFER :
+ case ST_MANUISSUE :
+ case ST_MANURECEIVE :
+ case ST_COSTUPDATE :
+ case ST_BANKPAYMENT : // generic bank transactions
+ case ST_BANKDEPOSIT :*/
+ return null;
+ }
+
+ $result = db_query($sql, 'cannot retrieve counterparty name');
+ if (db_num_rows($result))
+ {
+ $row = db_fetch($result);
+ return sprintf("[%05s] %s", $row['person_id'], $row['name']);
+ }
+
+ return '';
+}
+
function payment_person_has_items($type) {
switch ($type)
{
define('WO_LABOUR', 0);
define('WO_OVERHEAD', 1);
+define('WO_MATERIALS', 2);
//----------------------------------------------------------------------------------
// GL account classes
define('PTT_DAYS', 3);
define('PTT_FOLLOWING', 4);
+//----------------------------------------------------------------------------------
+// Tax calculation algorithms used in als and purchase (depends on supplier's invoicing software)
+
+define('TCA_TOTALS', 1); // taxes are calculated from respective net totals for all lines
+define('TCA_LINES', 2); // taxes calculated for every line, then summed
+//
+// Bank account owner types
+//
+define('BO_UNKNOWN', 0);
+define('BO_COMPANY', 1);
+define('BO_CUSTBRANCH', 2);
+define('BO_SUPPLIER', 3);
+
include_once($path_to_root . '/includes/sysnames.inc');
?>
\ No newline at end of file
var $transfer_type;
var $increase;
var $memo_;
- var $person_id;
var $branch_id;
var $reference;
var $original_amount;
// ----------- GL item functions
- function add_gl_item($code_id, $dimension_id, $dimension2_id, $amount, $reference, $description=null)
+ function add_gl_item($code_id, $dimension_id, $dimension2_id, $amount, $reference, $description=null, $person_id=null)
{
if (isset($code_id) && $code_id != "" && isset($amount) && isset($dimension_id) &&
isset($dimension2_id))
{
- $this->gl_items[] = new gl_item($code_id, $dimension_id, $dimension2_id, $amount, $reference, $description);
+ $this->gl_items[] = new gl_item($code_id, $dimension_id, $dimension2_id, $amount, $reference, $description, $person_id);
return true;
}
else
return false;
}
- function update_gl_item($index, $code_id, $dimension_id, $dimension2_id, $amount, $reference, $description=null)
+ function update_gl_item($index, $code_id, $dimension_id, $dimension2_id, $amount, $reference, $description=null, $person_id=null)
{
$this->gl_items[$index]->code_id = $code_id;
+ $this->gl_items[$index]->person_id = $person_id;
+
+ $gl_type = is_subledger_account($code_id, $person_id);
+ if ($gl_type)
+ {
+ $this->gl_items[$index]->person_type_id = $gl_type > 0 ? PT_CUSTOMER : PT_SUPPLIER;
+ $this->gl_items[$index]->person_name = get_subaccount_name($code_id, $person_id);
+ } else
+ {
+ $this->gl_items[$index]->person_type_id = $this->gl_items[$index]->person_name = '';
+ }
$this->gl_items[$index]->dimension_id = $dimension_id;
$this->gl_items[$index]->dimension2_id = $dimension2_id;
$this->gl_items[$index]->amount = $amount;
$this->gl_items = array();
}
+ //
+ // Check if cart contains virtual subaccount (AP/AR) postings
+ //
+ function has_sub_accounts()
+ {
+ foreach ($this->gl_items as $gl_item)
+ {
+ if ($gl_item->person_id)
+ return true;
+ }
+ return false;
+ }
}
//--------------------------------------------------------------------------------------------
var $amount;
var $reference;
var $description;
+ var $person_id;
+ var $person_type_id;
+ var $person_name;
function gl_item($code_id, $dimension_id, $dimension2_id, $amount, $reference,
- $description=null)
+ $description=null, $person_id=null)
{
//echo "adding $index, $code_id, $dimension_id, $amount, $reference<br>";
$this->description = $description;
$this->code_id = $code_id;
+ $this->person_id = $person_id;
+ $gl_type = is_subledger_account($code_id, $person_id);
+ if ($gl_type)
+ {
+ $this->person_type_id = $gl_type > 0 ? PT_CUSTOMER : PT_SUPPLIER;
+ $this->person_name = get_subaccount_name($code_id, $person_id);
+ }
$this->dimension_id = $dimension_id;
$this->dimension2_id = $dimension2_id;
$this->amount = $amount;
((!isset($_POST[$name]) || $_POST[$name] === '') ? $dflt : $_POST[$name]);
}
//---------------------------------------------------------------------------------
+$form_nested = -1;
function start_form($multi=false, $dummy=false, $action="", $name="")
{
// $dummy - leaved for compatibility with 2.0 API
+ global $form_nested;
+
+ if (++$form_nested) return;
+
if ($name != "")
$name = "name='$name'";
function end_form($breaks=0)
{
- global $Ajax;
+ global $Ajax, $form_nested;
+
+ if ($form_nested-- > 0) return;
$_SESSION['csrf_token'] = hash('sha256', uniqid(mt_rand(), true));
if ($breaks)
$Editors[$key] = array( $path_to_root . $popup_editors[$type][0], $input,
$popup_editors[$type][3], $popup_editors[$type][4]);
-
+
$help = 'F' . ($key - 111) . ' - ';
$help .= $popup_editors[$type][2];
$Pagehelp[] = $help;
'cancel' - cancel form entry on Escape press; dflt ICON_CANCEL
'process' - displays progress bar during call; optional icon
'nonajax' - ditto, non-ajax submit
+
$atype can contain also multiply type selectors separated by space,
however make sense only combination of 'process' and one of defualt/selector/cancel
*/
."</a>", $parms);
}
+/*
+ Edit transaction link to be used in transaction inquires
+*/
+function edit_trans_link($trans_type, $trans_no, $url='')
+{
+ global $path_to_root, $trans_editors;
+
+ if (!$url) $url = @$trans_editors[$trans_type];
+
+ if (!$trans_no || !$url)
+ return '';
+
+ if (is_closed_trans($trans_type, $trans_no)) {
+ return set_icon(ICON_CLOSED, _('Closed'));
+ } else {
+ $link_text = user_graphic_links() ? set_icon(ICON_EDIT, _('Edit')) : _('Edit');
+ return "<a href='".$path_to_root . sprintf($url, $trans_no, $trans_type)."'>$link_text</a>";
+ }
+}
+
function bank_balance_row($bank_acc, $parms='')
{
global $path_to_root;
-
+
$to = add_days(Today(), 1);
$bal = get_balance_before_for_bank_account($bank_acc, $to);
label_row( _("Bank Balance:"),
if ($editkey)
set_editor('supplier', $name, $editkey);
-
+
$ret = combo_input($name, $selected_id, $sql, 'supplier_id', 'supp_name',
array(
'format' => '_format_add_curr',
function customer_list_row($label, $name, $selected_id=null, $all_option = false,
$submit_on_change=false, $show_inactive=false, $editkey = false)
{
- global $path_to_root;
echo "<tr><td class='label'>$label</td><td nowrap>";
echo customer_list($name, $selected_id, $all_option, $submit_on_change,
if ($editkey)
{
$ret .= add_edit_combo('branch');
- }
+ }
return $ret;
}
//------------------------------------------------------------------------------------------------
'order' => array('c.description','stock_id')
), $opts) );
if ($editkey)
- $ret .= add_edit_combo('item');
+ $ret .= add_edit_combo('item');
return $ret;
-
}
function _format_stock_items($row)
}
//-----------------------------------------------------------------------------------------------
-function cash_accounts_list_row($label, $name, $selected_id=null, $submit_on_change=false)
+function cash_accounts_list_row($label, $name, $selected_id=null, $submit_on_change=false, $all_option=false)
{
+ global $all_items;
+
$sql = "SELECT ".TB_PREF."bank_accounts.id, bank_account_name, bank_curr_code, inactive
FROM ".TB_PREF."bank_accounts
WHERE ".TB_PREF."bank_accounts.account_type=".BT_CASH;
echo "<td>";
echo combo_input($name, $selected_id, $sql, 'id', 'bank_account_name',
array(
+ 'spec_option' => $all_option,
+ 'spec_id' => $all_items,
'format' => '_format_add_curr',
'select_submit'=> $submit_on_change,
'async' => true
));
}
-?>
+function tax_algorithm_list($name, $value=null, $submit_on_change = false)
+{
+ global $tax_algorithms;
+
+ return array_selector($name, $value, $tax_algorithms,
+ array(
+ 'select_submit'=> $submit_on_change,
+ 'async' => true,
+ )
+ );
+}
+
+function tax_algorithm_list_cells($label, $name, $value=null, $submit_on_change=false)
+{
+ if ($label != null)
+ echo "<td>$label</td>\n";
+ echo "<td>";
+ echo tax_algorithm_list($name, $value, $submit_on_change);
+ echo "</td>\n";
+}
+
+function tax_algorithm_list_row($label, $name, $value=null, $submit_on_change=false)
+{
+ echo "<tr><td class='label'>$label</td>";
+ tax_algorithm_list_cells(null, $name, $value, $submit_on_change);
+ echo "</tr>\n";
+}
+//----------------------------------------------------------------------------------------------
+
+function subledger_list($name, $account, $selected_id=null)
+{
+ global $all_items;
+
+ $type = is_subledger_account($account);
+ if (!$type)
+ return '';
+
+ if($type > 0)
+ $sql = "SELECT DISTINCT d.debtor_no as id, debtor_ref as name
+ FROM "
+ .TB_PREF."debtors_master d,"
+ .TB_PREF."cust_branch c
+ WHERE d.debtor_no=c.debtor_no AND c.receivables_account=".db_escape($account);
+ else
+ $sql = "SELECT supplier_id as id, supp_ref as name
+ FROM "
+ .TB_PREF."suppliers s
+ WHERE s.payable_account=".db_escape($account);
+
+ $mode = get_company_pref('no_customer_list');
+
+ return combo_input($name, $selected_id, $sql, 'id', 'name',
+ array(
+ 'type' => 1,
+ 'size' => 20,
+ 'async' => false,
+ ) );
+}
+
+function subledger_list_cells($label, $name, $account, $selected_id=null)
+{
+ if ($label != null)
+ echo "<td>$label</td>\n";
+ echo "<td nowrap>";
+ echo subledger_list($name, $account, $selected_id);
+ echo "</td>\n";
+}
+
+function subledger_list_row($label, $name, $selected_id=null, $all_option = false,
+ $submit_on_change=false, $show_inactive=false, $editkey = false)
+{
+ echo "<tr><td class='label'>$label</td><td nowrap>";
+ echo subledger_list($name, $account, $selected_id);
+ echo "</td>\n</tr>\n";
+}
{
$label = _("GL");
$icon = ICON_GL;
- }
+ }
+ $url = ($type == ST_WORKORDER && !work_order_is_closed($trans_no)) ? "manufacturing/view/wo_costs_view.php?trans_no=$trans_no"
+ : "gl/view/gl_trans_view.php?type_id=$type&trans_no=$trans_no";
- return viewer_link($label,
- "gl/view/gl_trans_view.php?type_id=$type&trans_no=$trans_no",
- $class, $id, $icon);
+ return viewer_link($label, $url, $class, $id, $icon);
}
//--------------------------------------------------------------------------------------
$begin = "";
else
$begin = begin_fiscalyear(); // from fiscalyear begin
- }
+ }
$base = get_gl_trans_from_to($begin, $cart->tran_date, $qe['base_desc']);
-
+
}
if ($descr != '') $qe['description'] .= ': '.$descr;
$result = get_quick_entry_lines($id);
display_error( _("No Quick Entry lines are defined."));
set_focus('totamount');
return 0;
- }
+ }
$totrate = 0;
while ($row = db_fetch($result))
{
else
$frac = "";
return _number_to_words(intval($amount)) . $frac;
-}
+}
function get_js_open_window($width, $height)
{
return strtr($link, $patterns);
}
-
-?>
\ No newline at end of file
#
msgid ""
msgstr ""
-"Project-Id-Version: PACKAGE TEAM\n"
+"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
-"POT-Creation-Date: 2011-03-31 10:54+0200\n"
-"PO-Revision-Date: 2011-03-31 19:30+0100\n"
+"POT-Creation-Date: 2010-08-08 12:50+0200\n"
+"PO-Revision-Date: 2010-08-13 09:13+0100\n"
"Last-Translator: Translation Team <info@frontaccounting.net>\n"
"Language-Team: infotechaccountants.com <hameed@infotechaccountants.com>\n"
"MIME-Version: 1.0\n"
"Content-Transfer-Encoding: 8bit\n"
"X-Poedit-Language: Arabic\n"
"X-Poedit-Country: EGYPT\n"
-"X-Poedit-SourceCharset: iso-8859-1\n"
-#: install/index.php:20
-#: install/index.php:40
+#: /var/www/fa2.3/devel/../install/index.php:20
+#: /var/www/fa2.3/devel/../install/index.php:40
msgid "FrontAccouting ERP Installation Wizard"
msgstr "معالج التثبيت الخاص بالحل المالي لإدارة موارد المؤسسات \"FrontAccounting\""
-#: install/index.php:41
+#: /var/www/fa2.3/devel/../install/index.php:41
#, php-format
msgid "Step %d: %s"
msgstr "الخطوة %d: %s "
-#: install/index.php:48
+#: /var/www/fa2.3/devel/../install/index.php:48
msgid "Chart of accounts"
msgstr "خريطة الحسابات"
-#: install/index.php:48
-#: install/index.php:75
+#: /var/www/fa2.3/devel/../install/index.php:48
+#: /var/www/fa2.3/devel/../install/index.php:75
msgid "Encoding"
msgstr "الترميز"
-#: install/index.php:48
-#: install/index.php:75
+#: /var/www/fa2.3/devel/../install/index.php:48
+#: /var/www/fa2.3/devel/../install/index.php:75
msgid "Description"
msgstr "الوصف"
-#: install/index.php:48
-#: install/index.php:75
+#: /var/www/fa2.3/devel/../install/index.php:48
+#: /var/www/fa2.3/devel/../install/index.php:75
msgid "Install"
msgstr "التثبيت"
-#: install/index.php:65
-#: install/index.php:93
+#: /var/www/fa2.3/devel/../install/index.php:65
+#: /var/www/fa2.3/devel/../install/index.php:93
msgid "Installed"
msgstr "تم تثبيته"
-#: install/index.php:75
+#: /var/www/fa2.3/devel/../install/index.php:75
msgid "Language"
msgstr "اللغة"
-#: install/index.php:123
-msgid "Cannot connect to database. User or password is invalid or you have no permittions to create database."
-msgstr ""
-
-#: install/index.php:159
+#: /var/www/fa2.3/devel/../install/index.php:156
msgid "Cannot save system configuration file 'config.php'."
msgstr "لا يمكن حفظ ملف التوصيف الخاص بالنظام 'config.php'"
-#: install/index.php:166
+#: /var/www/fa2.3/devel/../install/index.php:173
msgid "Cannot open 'config_db.php' configuration file."
msgstr "لا يمكن فتح ملف التوصيف 'config_db.php'"
-#: install/index.php:169
+#: /var/www/fa2.3/devel/../install/index.php:176
msgid "Cannot write to the 'config_db.php' configuration file."
msgstr "لا يمكن الكتابة على ملف التوصيف 'config_db.php'"
-#: install/index.php:172
+#: /var/www/fa2.3/devel/../install/index.php:179
msgid "Configuration file 'config_db.php' is not writable. Change its permissions so it is, then re-run installation step."
msgstr "ملف التوصيف 'config_db.php' غير قابل للكتابة ، الرجاء تغيير صلاحيات الأستخدام و بعد ذلك أعد تشغيل خطوة التثبيت مرة أخرى"
-#: install/index.php:211
+#: /var/www/fa2.3/devel/../install/index.php:217
msgid "Host name cannot be empty."
msgstr "أسم المضيف لا يمكن تركه فارغاً "
-#: install/index.php:215
+#: /var/www/fa2.3/devel/../install/index.php:221
msgid "Database user name cannot be empty."
msgstr "أسم مستخدم قاعدة البيانات لا يمكن تركه فارغاً"
-#: install/index.php:219
+#: /var/www/fa2.3/devel/../install/index.php:225
msgid "Database name cannot be empty."
msgstr "لا يمكن ترك أسم قاعدة البيانات فارغاً"
-#: install/index.php:272
+#: /var/www/fa2.3/devel/../install/index.php:277
msgid "Company name cannot be empty."
msgstr "لا يمكن ترك أسم الشركة فارغاً"
-#: install/index.php:276
+#: /var/www/fa2.3/devel/../install/index.php:281
msgid "Company admin name cannot be empty."
msgstr "لا يمكن ترك أسم مدير النظام فارغاً"
-#: install/index.php:280
+#: /var/www/fa2.3/devel/../install/index.php:285
msgid "Company admin password cannot be empty."
msgstr "لا يمكن ترك كلمة مرور مدير النظام فارغاً"
-#: install/index.php:284
+#: /var/www/fa2.3/devel/../install/index.php:289
msgid "Company admin passwords differ."
msgstr "كلمات مرور مدير النظام مختلفة"
-#: install/index.php:316
+#: /var/www/fa2.3/devel/../install/index.php:320
msgid "System Diagnostics"
msgstr "تشخيص النظام"
-#: install/index.php:318
+#: /var/www/fa2.3/devel/../install/index.php:323
msgid "Select install wizard language:"
msgstr "أختيار لغة معالج التثبيت"
-#: install/index.php:324
+#: /var/www/fa2.3/devel/../install/index.php:329
msgid "All application preliminary requirements seems to be correct. Please press Continue button below."
msgstr "جميع المتطلبات التمهيدية الخاصة بالتطبيق تبدو صحيحة ، الرجاء الضغط على زر الأستمرار في الأسفل"
-#: install/index.php:325
-#: install/index.php:351
-#: install/index.php:358
-#: install/index.php:365
-#: install/index.php:384
+#: /var/www/fa2.3/devel/../install/index.php:330
+#: /var/www/fa2.3/devel/../install/index.php:356
+#: /var/www/fa2.3/devel/../install/index.php:363
+#: /var/www/fa2.3/devel/../install/index.php:370
+#: /var/www/fa2.3/devel/../install/index.php:389
msgid "Continue >>"
msgstr "<< الاستمرار"
-#: install/index.php:327
+#: /var/www/fa2.3/devel/../install/index.php:332
msgid "Application cannot be installed. Please fix problems listed below in red, and press Refresh button."
msgstr "لا يمكن تثبيت التطبيق ، الرجاء إصلاح المشاكل الملونة باللون الأحمر و المدرجة بالأسف ثم الضغط على زر التنشيط"
-#: install/index.php:328
+#: /var/www/fa2.3/devel/../install/index.php:333
msgid "Refresh"
msgstr "تنشيط"
-#: install/index.php:338
+#: /var/www/fa2.3/devel/../install/index.php:343
msgid "Database Server Settings"
msgstr "إعدادات خادم قاعدة البيانات"
-#: install/index.php:340
+#: /var/www/fa2.3/devel/../install/index.php:345
msgid "Server Host:"
msgstr "الخادم المستضيف :"
-#: install/index.php:341
+#: /var/www/fa2.3/devel/../install/index.php:346
msgid "Database User:"
msgstr "مستخدم قاعدة البيانات:"
-#: install/index.php:342
+#: /var/www/fa2.3/devel/../install/index.php:347
msgid "Database Password:"
msgstr "كلمة مرور قاعدة البيانات:"
-#: install/index.php:343
+#: /var/www/fa2.3/devel/../install/index.php:348
msgid "Database Name:"
msgstr "أسم قاعدة البيانات:"
-#: install/index.php:344
+#: /var/www/fa2.3/devel/../install/index.php:349
msgid "Use '0_' Table Prefix:"
msgstr "استخدام '0_' كبادئة جدول"
-#: install/index.php:344
-#: includes/system_tests.inc:38
-#: includes/system_tests.inc:113
-#: includes/system_tests.inc:126
+#: /var/www/fa2.3/devel/../install/index.php:349
+#: /var/www/fa2.3/devel/../includes/system_tests.inc:38
+#: /var/www/fa2.3/devel/../includes/system_tests.inc:113
+#: /var/www/fa2.3/devel/../includes/system_tests.inc:126
msgid "Yes"
msgstr "نعم"
-#: install/index.php:344
-#: includes/system_tests.inc:38
-#: includes/system_tests.inc:113
-#: includes/system_tests.inc:126
+#: /var/www/fa2.3/devel/../install/index.php:349
+#: /var/www/fa2.3/devel/../includes/system_tests.inc:38
+#: /var/www/fa2.3/devel/../includes/system_tests.inc:113
+#: /var/www/fa2.3/devel/../includes/system_tests.inc:126
msgid "No"
msgstr "لا"
-#: install/index.php:345
+#: /var/www/fa2.3/devel/../install/index.php:350
msgid "Install Additional Language Packs from FA Repository:"
msgstr "تثبيت حزم لغات إضافية من مستودع التطبيق :"
-#: install/index.php:346
+#: /var/www/fa2.3/devel/../install/index.php:351
msgid "Install Additional COAs from FA Repository:"
msgstr "تثبيت خرائط حسابات أضافية من مستودع التطبيق :"
-#: install/index.php:348
+#: /var/www/fa2.3/devel/../install/index.php:353
msgid "Use table prefix if you share selected database for more than one FA company."
msgstr "أستخدم بادئة جدول إذا كنت تريد أن تحتوي قاعدة البيانات الواحدة على أكثر من شركة واحدة"
-#: install/index.php:349
+#: /var/www/fa2.3/devel/../install/index.php:354
msgid "Do not select additional langs nor COAs if you have no working internet connection right now. You can install them later."
msgstr "لا تختار لغات إضافية أو خرائط حسابات إضافية إذا لم يكن لديك الآن توصيلة أنترنت تعمل بكفاءة ، يمكنك أن تثبت اللغات و خرائط الحسابات في وقت لاحق"
-#: install/index.php:350
-#: install/index.php:357
-#: install/index.php:364
-#: install/index.php:383
+#: /var/www/fa2.3/devel/../install/index.php:355
+#: /var/www/fa2.3/devel/../install/index.php:362
+#: /var/www/fa2.3/devel/../install/index.php:369
+#: /var/www/fa2.3/devel/../install/index.php:388
msgid "<< Back"
msgstr "للخلف >>"
-#: install/index.php:355
+#: /var/www/fa2.3/devel/../install/index.php:360
msgid "User Interface Languages Selection"
msgstr "اختيار لغات واجهة المستخدم"
-#: install/index.php:362
+#: /var/www/fa2.3/devel/../install/index.php:367
msgid "Charts of Accounts Selection"
msgstr "أختيار خرائط الحسابات"
-#: install/index.php:374
+#: /var/www/fa2.3/devel/../install/index.php:379
msgid "Company Settings"
msgstr "إعدادات الشركة"
-#: install/index.php:376
+#: /var/www/fa2.3/devel/../install/index.php:381
msgid "Company Name:"
msgstr "أسم الشركة :"
-#: install/index.php:377
+#: /var/www/fa2.3/devel/../install/index.php:382
msgid "Admin Login:"
msgstr "أسم الدخول لمدير النظام :"
-#: install/index.php:378
+#: /var/www/fa2.3/devel/../install/index.php:383
msgid "Admin Password:"
msgstr "كلمة مرور مدير النظام :"
-#: install/index.php:379
+#: /var/www/fa2.3/devel/../install/index.php:384
msgid "Reenter Password:"
msgstr "إعادة أدخال كلمة المرور :"
-#: install/index.php:380
+#: /var/www/fa2.3/devel/../install/index.php:385
msgid "Select Chart of Accounts:"
msgstr "اختيار خريطة الحسابات :"
-#: install/index.php:381
+#: /var/www/fa2.3/devel/../install/index.php:386
msgid "Select Default Language:"
msgstr "اختيار اللغة الأفتراضية :"
-#: install/index.php:388
+#: /var/www/fa2.3/devel/../install/index.php:393
msgid "FrontAccounting ERP has been installed successsfully."
msgstr "تمت عملية تثبيت FrontAccounting ERP بنجاح"
-#: install/index.php:389
+#: /var/www/fa2.3/devel/../install/index.php:394
msgid "Please do not forget to remove install wizard folder."
msgstr "الرجاء لا تنسى أن تزيل مجلد معالج التثبيت"
-#: install/index.php:392
+#: /var/www/fa2.3/devel/../install/index.php:396
msgid "Click here to start."
msgstr "الضغط هنا للبدء"
-#: includes/system_tests.inc:15
+#: /var/www/fa2.3/devel/../includes/system_tests.inc:15
msgid "Info"
msgstr "معلومات"
-#: includes/system_tests.inc:16
+#: /var/www/fa2.3/devel/../includes/system_tests.inc:16
msgid "Optional"
msgstr "اختياري"
-#: includes/system_tests.inc:17
+#: /var/www/fa2.3/devel/../includes/system_tests.inc:17
msgid "Recommended"
msgstr "يوصى به"
-#: includes/system_tests.inc:18
+#: /var/www/fa2.3/devel/../includes/system_tests.inc:18
msgid "Required "
msgstr "مطلوب"
-#: includes/system_tests.inc:24
+#: /var/www/fa2.3/devel/../includes/system_tests.inc:24
msgid "MySQL version"
msgstr "إصدار MySQL"
-#: includes/system_tests.inc:28
+#: /var/www/fa2.3/devel/../includes/system_tests.inc:28
msgid "Upgrade MySQL server to version at least 4.1"
msgstr "ترقية خادم MySQL إلى الإصدار 4.1 على الأقل"
-#: includes/system_tests.inc:35
+#: /var/www/fa2.3/devel/../includes/system_tests.inc:35
msgid "PHP MySQL extension"
msgstr "رابط برمجي بين PHP و MySQL"
-#: includes/system_tests.inc:40
+#: /var/www/fa2.3/devel/../includes/system_tests.inc:40
msgid "Your PHP has to have MySQL extension enabled."
msgstr "الـ PHP الخاص بك يجب أن يحتوي على رابط برمجي لـ MySQL مفعل"
-#: includes/system_tests.inc:46
+#: /var/www/fa2.3/devel/../includes/system_tests.inc:46
msgid "PHP version"
msgstr "إصدار PHP"
-#: includes/system_tests.inc:50
+#: /var/www/fa2.3/devel/../includes/system_tests.inc:50
msgid "Upgrade PHP to version at least 4.3.3"
msgstr "ترقية PHP إلى الإصدار رقم 4.3.3 على الأقل"
-#: includes/system_tests.inc:57
+#: /var/www/fa2.3/devel/../includes/system_tests.inc:57
msgid "Server system"
msgstr "نظام الخادم"
-#: includes/system_tests.inc:67
+#: /var/www/fa2.3/devel/../includes/system_tests.inc:67
msgid "Session save path"
msgstr "مسار حفظ جلسة الأستخدام"
-#: includes/system_tests.inc:79
+#: /var/www/fa2.3/devel/../includes/system_tests.inc:79
msgid "Removed install wizard folder"
msgstr "مجلد معالج التثبيت الذي تمت إزالته"
-#: includes/system_tests.inc:82
+#: /var/www/fa2.3/devel/../includes/system_tests.inc:82
msgid "Not removed"
msgstr "لم يتم إزالته"
-#: includes/system_tests.inc:83
+#: /var/www/fa2.3/devel/../includes/system_tests.inc:83
msgid "Remove or rename install wizard folder for security reasons."
msgstr "قم بإزالة أو قم بإعادة تسمية مجلد معالج التثبيت و ذلك لأسباب أمنية"
-#: includes/system_tests.inc:90
+#: /var/www/fa2.3/devel/../includes/system_tests.inc:90
msgid "Browser type"
msgstr "نوع المتصفح"
-#: includes/system_tests.inc:94
+#: /var/www/fa2.3/devel/../includes/system_tests.inc:94
msgid "Any browser is supported"
msgstr "أي مستصفح تم دعمه"
-#: includes/system_tests.inc:101
+#: /var/www/fa2.3/devel/../includes/system_tests.inc:101
msgid "Http server type"
msgstr "نوع خادم Http"
-#: includes/system_tests.inc:105
+#: /var/www/fa2.3/devel/../includes/system_tests.inc:105
msgid "Any server is supported"
msgstr "أي خادم تم دعمه"
-#: includes/system_tests.inc:112
+#: /var/www/fa2.3/devel/../includes/system_tests.inc:112
msgid "Native gettext"
msgstr "جيتيكس الطبيعية"
-#: includes/system_tests.inc:116
+#: /var/www/fa2.3/devel/../includes/system_tests.inc:116
msgid "In case of no gettext support, php emulation is used"
msgstr "في حالة عدم دعم جيتيكس ، فإن محاكي PHP سوف يستخدم "
-#: includes/system_tests.inc:124
+#: /var/www/fa2.3/devel/../includes/system_tests.inc:124
msgid "Debugging mode"
msgstr "بيئة تصحيح الأخطاء"
-#: includes/system_tests.inc:128
+#: /var/www/fa2.3/devel/../includes/system_tests.inc:128
msgid "To switch debugging on set $go_debug>0 in config.php file"
msgstr "لتفعيل بيئة تصحيح الأخطاء يجب أن يتم ضبط $go_debug>0 في الملف config.php"
-#: includes/system_tests.inc:137
+#: /var/www/fa2.3/devel/../includes/system_tests.inc:137
msgid "Error logging"
msgstr "سجل وقائع الأخطاء"
-#: includes/system_tests.inc:145
+#: /var/www/fa2.3/devel/../includes/system_tests.inc:145
msgid "Disabled"
msgstr "غير مفعل"
-#: includes/system_tests.inc:148
+#: /var/www/fa2.3/devel/../includes/system_tests.inc:148
msgid "To switch error logging set $error_logging in config.php file"
msgstr "لتفعيل سجل وقائع الأخطاء يجب أن يتم ضبط $error_logging في ملف config.php"
-#: includes/system_tests.inc:151
+#: /var/www/fa2.3/devel/../includes/system_tests.inc:151
msgid "Log file is not writeable"
msgstr "ملف سجل الوقائع غير قابل للكتابة عليه"
-#: includes/system_tests.inc:161
+#: /var/www/fa2.3/devel/../includes/system_tests.inc:161
msgid "Current database version"
msgstr "إصدار قاعدة البيانات الحالي"
-#: includes/system_tests.inc:165
+#: /var/www/fa2.3/devel/../includes/system_tests.inc:165
msgid "Database structure seems to be not upgraded to current version"
msgstr "يبدو أن هيكل قاعدة البيانات لم تتم ترقيته إلى الإصدار الحالي"
-#: includes/system_tests.inc:180
+#: /var/www/fa2.3/devel/../includes/system_tests.inc:180
msgid "Company subdirectories consistency"
msgstr "اتساق الفهارس الفرعية للشركة"
-#: includes/system_tests.inc:193
-#: includes/system_tests.inc:200
-#: includes/system_tests.inc:208
-#: includes/system_tests.inc:225
-#: includes/system_tests.inc:340
-#: includes/system_tests.inc:349
-#: includes/system_tests.inc:358
+#: /var/www/fa2.3/devel/../includes/system_tests.inc:193
+#: /var/www/fa2.3/devel/../includes/system_tests.inc:200
+#: /var/www/fa2.3/devel/../includes/system_tests.inc:208
+#: /var/www/fa2.3/devel/../includes/system_tests.inc:225
+#: /var/www/fa2.3/devel/../includes/system_tests.inc:345
#, php-format
msgid "'%s' is not writeable"
msgstr "'%s' غير قابل للكتابة عليه"
-#: includes/system_tests.inc:221
+#: /var/www/fa2.3/devel/../includes/system_tests.inc:221
msgid "Temporary directory"
msgstr "الفهرس المؤقت"
-#: includes/system_tests.inc:233
+#: /var/www/fa2.3/devel/../includes/system_tests.inc:233
msgid "Language configuration consistency"
msgstr "اتساق توصيف اللغة"
-#: includes/system_tests.inc:242
+#: /var/www/fa2.3/devel/../includes/system_tests.inc:242
msgid "Languages folder should be writeable."
msgstr "مجلد اللغات يجب أن يكون قابل للكتابة عليه"
-#: includes/system_tests.inc:251
+#: /var/www/fa2.3/devel/../includes/system_tests.inc:250
msgid "Languages configuration file should be writeable."
msgstr "ملف توصيف اللغات يجب أن يكون قابل للكتابة عليه"
-#: includes/system_tests.inc:270
+#: /var/www/fa2.3/devel/../includes/system_tests.inc:268
#, php-format
msgid "Missing %s translation file."
msgstr "ملف الترجمة %s مفقود"
-#: includes/system_tests.inc:275
+#: /var/www/fa2.3/devel/../includes/system_tests.inc:273
#, php-format
msgid "Missing system locale: %s"
msgstr "مسار النظام المفقود : %s"
-#: includes/system_tests.inc:288
+#: /var/www/fa2.3/devel/../includes/system_tests.inc:286
msgid "Main config file"
msgstr "ملف التوصيف الرئيسي"
-#: includes/system_tests.inc:295
-#: includes/system_tests.inc:317
+#: /var/www/fa2.3/devel/../includes/system_tests.inc:293
+#: /var/www/fa2.3/devel/../includes/system_tests.inc:315
#, php-format
msgid "Can't write '%s' file. Check FA directory write permissions."
msgstr "لا يمكن الكتابة على الملف '%s' ، قم بفحص صلاحيات الكتابة على مجلد التطبيق"
-#: includes/system_tests.inc:296
-#: includes/system_tests.inc:318
+#: /var/www/fa2.3/devel/../includes/system_tests.inc:294
+#: /var/www/fa2.3/devel/../includes/system_tests.inc:316
#, php-format
msgid "'%s' file exists."
msgstr "ملف '%s' موجود"
-#: includes/system_tests.inc:300
+#: /var/www/fa2.3/devel/../includes/system_tests.inc:298
#, php-format
msgid "'%s' file should be read-only"
msgstr "الملف '%s' يجب أن يكون للقراءة فقط "
-#: includes/system_tests.inc:309
+#: /var/www/fa2.3/devel/../includes/system_tests.inc:307
msgid "Database auth file"
msgstr "ملف اعتماد قاعدة البيانات"
-#: includes/system_tests.inc:322
+#: /var/www/fa2.3/devel/../includes/system_tests.inc:320
#, php-format
msgid "'%s' file should be read-only if you do not plan to add or change companies"
msgstr "الملف '%s' يجب أن يكون للقراءة فقط ، إذا كنت تخطط أن تضيف أو تغير الشركات"
-#: includes/system_tests.inc:333
+#: /var/www/fa2.3/devel/../includes/system_tests.inc:331
msgid "Extensions system"
msgstr "نظام الإضافات البرمجية"
-#: includes/system_tests.inc:363
+#: /var/www/fa2.3/devel/../includes/system_tests.inc:366
msgid "Extensions configuration files and directories should be writeable"
msgstr "ملفات توصيف الإضافات البرمجية و المجلدات يجب أن تكون قابلة للكتابة"
-#: includes/system_tests.inc:375
+#: /var/www/fa2.3/devel/../includes/system_tests.inc:378
#, php-format
msgid "Non-standard theme directory '%s' is not writable"
msgstr "مجلد الشكل الغير معياري '%s' يجب أن يكون غير قابل للكتابة"
-#: includes/system_tests.inc:385
+#: /var/www/fa2.3/devel/../includes/system_tests.inc:388
msgid "OpenSSL PHP extension have to be enabled to use extension repository system."
msgstr "نظام الروابط البرمجية OpenSSL لـ PHP يجب أن يكون مفعل لأستخدام مستودع الإضافات البرمجية للنظام"
-#: includes/system_tests.inc:388
+#: /var/www/fa2.3/devel/../includes/system_tests.inc:391
msgid "OpenSSL have to be available on your server to use extension repository system."
msgstr "OpenSSL يجب أن يكون متاح على الخادم حتى يمكنك أستخدام مستودع الإضافات البرمجية للنظام"
-#: includes/system_tests.inc:411
+#: /var/www/fa2.3/devel/../includes/system_tests.inc:414
msgid "Test"
msgstr "اختبار"
-#: includes/system_tests.inc:411
+#: /var/www/fa2.3/devel/../includes/system_tests.inc:414
msgid "Test type"
msgstr "نوع الاختبار"
-#: includes/system_tests.inc:411
+#: /var/www/fa2.3/devel/../includes/system_tests.inc:414
msgid "Value"
msgstr "القيمة"
-#: includes/system_tests.inc:411
+#: /var/www/fa2.3/devel/../includes/system_tests.inc:414
msgid "Comments"
msgstr "الملاحظات"
-#: includes/system_tests.inc:435
+#: /var/www/fa2.3/devel/../includes/system_tests.inc:438
msgid "Ok"
msgstr "موافق"
-#: includes/packages.inc:190
-#, php-format
-msgid "No key field '%s' in file '%s'"
-msgstr ""
-
-#: includes/packages.inc:295
-msgid "Release file in repository is invalid, or public key is outdated."
-msgstr ""
-
-#: includes/packages.inc:311
-msgid "Repository version does not match application version."
-msgstr ""
-
-#: includes/packages.inc:325
-#, php-format
-msgid "Security alert: broken index file in repository '%s'. Please inform repository administrator about this issue."
-msgstr ""
-
-#: includes/packages.inc:358
-#, php-format
-msgid "Security alert: broken package '%s' in repository. Please inform repository administrator about this issue."
-msgstr ""
-
-#: includes/packages.inc:613
-#: includes/packages.inc:664
-#, php-format
-msgid "Package '%s' not found."
-msgstr ""
-
msgstr ""
"Project-Id-Version: FrontAccounting 2.3.0\n"
"Report-Msgid-Bugs-To: \n"
-"POT-Creation-Date: \n"
-"PO-Revision-Date: 2011-03-31 19:39+0100\n"
-"Last-Translator: Translation Team <info@frontaccounting.net>\n"
-"Language-Team: Language <LL@li.org>\n"
+"POT-Creation-Date: 2010-08-08 12:50+0200\n"
+"PO-Revision-Date: 2010-08-08 12:48-0500\n"
+"Last-Translator: Gaston <gaston.huot@videotron.ca>\n"
+"Language-Team: LANGUAGE <LL@li.org>\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=ISO-8859-1\n"
"Content-Transfer-Encoding: 8bit\n"
-#: install/index.php:20
-#: install/index.php:40
+#: /var/www/fa2.3/devel/../install/index.php:20
+#: /var/www/fa2.3/devel/../install/index.php:40
msgid "FrontAccouting ERP Installation Wizard"
msgstr "Outil d'installation assistée de FrontAccounting"
-#: install/index.php:41
+#: /var/www/fa2.3/devel/../install/index.php:41
#, php-format
msgid "Step %d: %s"
msgstr "Étape %d: %s"
-#: install/index.php:48
+#: /var/www/fa2.3/devel/../install/index.php:48
msgid "Chart of accounts"
msgstr "Charte des postes comptables"
-#: install/index.php:48
-#: install/index.php:75
+#: /var/www/fa2.3/devel/../install/index.php:48
+#: /var/www/fa2.3/devel/../install/index.php:75
msgid "Encoding"
msgstr "Codage des caractères"
-#: install/index.php:48
-#: install/index.php:75
+#: /var/www/fa2.3/devel/../install/index.php:48
+#: /var/www/fa2.3/devel/../install/index.php:75
msgid "Description"
msgstr "Description"
-#: install/index.php:48
-#: install/index.php:75
+#: /var/www/fa2.3/devel/../install/index.php:48
+#: /var/www/fa2.3/devel/../install/index.php:75
msgid "Install"
msgstr "Installer"
-#: install/index.php:65
-#: install/index.php:93
+#: /var/www/fa2.3/devel/../install/index.php:65
+#: /var/www/fa2.3/devel/../install/index.php:93
msgid "Installed"
msgstr "Installé"
-#: install/index.php:75
+#: /var/www/fa2.3/devel/../install/index.php:75
msgid "Language"
msgstr "Langue"
-#: install/index.php:123
-msgid "Cannot connect to database. User or password is invalid or you have no permittions to create database."
-msgstr ""
-
-#: install/index.php:159
+#: /var/www/fa2.3/devel/../install/index.php:156
msgid "Cannot save system configuration file 'config.php'."
msgstr "Impossible d'enregistrer le fichier 'config.php'"
-#: install/index.php:166
+#: /var/www/fa2.3/devel/../install/index.php:173
msgid "Cannot open 'config_db.php' configuration file."
msgstr "Impossible d'ouvrir le fichier 'config_db.php'"
-#: install/index.php:169
+#: /var/www/fa2.3/devel/../install/index.php:176
msgid "Cannot write to the 'config_db.php' configuration file."
msgstr "Impossible d'écrire dans le fichier 'config_db.php'"
-#: install/index.php:172
+#: /var/www/fa2.3/devel/../install/index.php:179
msgid "Configuration file 'config_db.php' is not writable. Change its permissions so it is, then re-run installation step."
msgstr "Il n'est pas possible d'écrire dans le fichier de configuration 'config_db.php'. Svp revoir les permissions et recommencer le processus d'installation."
-#: install/index.php:211
+#: /var/www/fa2.3/devel/../install/index.php:217
msgid "Host name cannot be empty."
msgstr "Le nom du Host ne peut être vide."
-#: install/index.php:215
+#: /var/www/fa2.3/devel/../install/index.php:221
msgid "Database user name cannot be empty."
msgstr "Svp un code d'utilisateur pour cette BD"
-#: install/index.php:219
+#: /var/www/fa2.3/devel/../install/index.php:225
msgid "Database name cannot be empty."
msgstr "Svp préciser le nom de la BD"
-#: install/index.php:272
+#: /var/www/fa2.3/devel/../install/index.php:277
msgid "Company name cannot be empty."
msgstr "SVP préciser le nom de la compagnie"
-#: install/index.php:276
+#: /var/www/fa2.3/devel/../install/index.php:281
msgid "Company admin name cannot be empty."
msgstr "SVP préciser le nom de l'administrateur "
-#: install/index.php:280
+#: /var/www/fa2.3/devel/../install/index.php:285
msgid "Company admin password cannot be empty."
msgstr "SVP préciser le mot de passe de l'administrateur"
-#: install/index.php:284
+#: /var/www/fa2.3/devel/../install/index.php:289
msgid "Company admin passwords differ."
msgstr "Les 2 entrées de mot de passe diffèrent."
-#: install/index.php:316
+#: /var/www/fa2.3/devel/../install/index.php:320
msgid "System Diagnostics"
msgstr "Diagnostique du système"
-#: install/index.php:318
+#: /var/www/fa2.3/devel/../install/index.php:323
msgid "Select install wizard language:"
msgstr "Svp choisir la langue d'installation."
-#: install/index.php:324
+#: /var/www/fa2.3/devel/../install/index.php:329
msgid "All application preliminary requirements seems to be correct. Please press Continue button below."
msgstr "Tous les pré-requis semblent corrects. Svp appuyez sur le bouton Continuer situé ci-après"
-#: install/index.php:325
-#: install/index.php:351
-#: install/index.php:358
-#: install/index.php:365
-#: install/index.php:384
+#: /var/www/fa2.3/devel/../install/index.php:330
+#: /var/www/fa2.3/devel/../install/index.php:356
+#: /var/www/fa2.3/devel/../install/index.php:363
+#: /var/www/fa2.3/devel/../install/index.php:370
+#: /var/www/fa2.3/devel/../install/index.php:389
msgid "Continue >>"
msgstr "Continuer >>"
-#: install/index.php:327
+#: /var/www/fa2.3/devel/../install/index.php:332
msgid "Application cannot be installed. Please fix problems listed below in red, and press Refresh button."
msgstr "L'application n'a pu être installée. Svp résoudre le problème libellé en rouge et appuyez sur le bouton Actualiser"
-#: install/index.php:328
+#: /var/www/fa2.3/devel/../install/index.php:333
msgid "Refresh"
msgstr "Actualiser"
-#: install/index.php:338
+#: /var/www/fa2.3/devel/../install/index.php:343
msgid "Database Server Settings"
msgstr "Réglages de la BD"
-#: install/index.php:340
+#: /var/www/fa2.3/devel/../install/index.php:345
msgid "Server Host:"
msgstr "Nom du serveur:"
-#: install/index.php:341
+#: /var/www/fa2.3/devel/../install/index.php:346
msgid "Database User:"
msgstr "ID de l'utilisateur de la BD:"
-#: install/index.php:342
+#: /var/www/fa2.3/devel/../install/index.php:347
msgid "Database Password:"
msgstr "Mot de passe :"
-#: install/index.php:343
+#: /var/www/fa2.3/devel/../install/index.php:348
msgid "Database Name:"
msgstr "Nom de la BD:"
-#: install/index.php:344
+#: /var/www/fa2.3/devel/../install/index.php:349
msgid "Use '0_' Table Prefix:"
msgstr "Utilisez le préfix de table '0_':"
-#: install/index.php:344
-#: includes/system_tests.inc:38
-#: includes/system_tests.inc:113
-#: includes/system_tests.inc:126
+#: /var/www/fa2.3/devel/../install/index.php:349
+#: /var/www/fa2.3/devel/../includes/system_tests.inc:38
+#: /var/www/fa2.3/devel/../includes/system_tests.inc:113
+#: /var/www/fa2.3/devel/../includes/system_tests.inc:126
msgid "Yes"
msgstr "Oui"
-#: install/index.php:344
-#: includes/system_tests.inc:38
-#: includes/system_tests.inc:113
-#: includes/system_tests.inc:126
+#: /var/www/fa2.3/devel/../install/index.php:349
+#: /var/www/fa2.3/devel/../includes/system_tests.inc:38
+#: /var/www/fa2.3/devel/../includes/system_tests.inc:113
+#: /var/www/fa2.3/devel/../includes/system_tests.inc:126
msgid "No"
msgstr "Non"
-#: install/index.php:345
+#: /var/www/fa2.3/devel/../install/index.php:350
msgid "Install Additional Language Packs from FA Repository:"
msgstr "Installer d'autres langues:"
-#: install/index.php:346
+#: /var/www/fa2.3/devel/../install/index.php:351
msgid "Install Additional COAs from FA Repository:"
msgstr "Installer d'autres COAs à partir du dépôt de FA:"
-#: install/index.php:348
+#: /var/www/fa2.3/devel/../install/index.php:353
msgid "Use table prefix if you share selected database for more than one FA company."
msgstr "Svp utiliser un préfixe de table si vous partagez la BD pour plus d'une compagnie."
-#: install/index.php:349
+#: /var/www/fa2.3/devel/../install/index.php:354
msgid "Do not select additional langs nor COAs if you have no working internet connection right now. You can install them later."
msgstr "Ne pas sélectionner d'autres langues (ni COA) si votre connection internet n'est pas active en ce moment. Vous pourrez le faire plus tard."
-#: install/index.php:350
-#: install/index.php:357
-#: install/index.php:364
-#: install/index.php:383
+#: /var/www/fa2.3/devel/../install/index.php:355
+#: /var/www/fa2.3/devel/../install/index.php:362
+#: /var/www/fa2.3/devel/../install/index.php:369
+#: /var/www/fa2.3/devel/../install/index.php:388
msgid "<< Back"
msgstr "<< Retour"
-#: install/index.php:355
+#: /var/www/fa2.3/devel/../install/index.php:360
msgid "User Interface Languages Selection"
msgstr "Sélection de la langue :"
-#: install/index.php:362
+#: /var/www/fa2.3/devel/../install/index.php:367
msgid "Charts of Accounts Selection"
msgstr "Sélection de la charte des postes comptables"
-#: install/index.php:374
+#: /var/www/fa2.3/devel/../install/index.php:379
msgid "Company Settings"
msgstr "Réglages systèmes de la compagnie"
-#: install/index.php:376
+#: /var/www/fa2.3/devel/../install/index.php:381
msgid "Company Name:"
msgstr "Nom de la compagnie:"
-#: install/index.php:377
+#: /var/www/fa2.3/devel/../install/index.php:382
msgid "Admin Login:"
msgstr "Identifiant d'administrateur:"
-#: install/index.php:378
+#: /var/www/fa2.3/devel/../install/index.php:383
msgid "Admin Password:"
msgstr "Mot de passe de l'administrateur:"
-#: install/index.php:379
+#: /var/www/fa2.3/devel/../install/index.php:384
msgid "Reenter Password:"
msgstr "Saisir de nouveau le mot de passe:"
-#: install/index.php:380
+#: /var/www/fa2.3/devel/../install/index.php:385
msgid "Select Chart of Accounts:"
msgstr "Sélectionner la charte de postes comptables:"
-#: install/index.php:381
+#: /var/www/fa2.3/devel/../install/index.php:386
msgid "Select Default Language:"
msgstr "Sélectionner la langue par défaut:"
-#: install/index.php:388
+#: /var/www/fa2.3/devel/../install/index.php:393
msgid "FrontAccounting ERP has been installed successsfully."
msgstr "L'installation de FrontAccounting est un succès."
-#: install/index.php:389
+#: /var/www/fa2.3/devel/../install/index.php:394
msgid "Please do not forget to remove install wizard folder."
msgstr "Svp ne pas oublier de retirer le répertoire d'installation."
-#: install/index.php:392
+#: /var/www/fa2.3/devel/../install/index.php:396
msgid "Click here to start."
msgstr "Appuyez ici pour démarrer."
-#: includes/system_tests.inc:15
+#: /var/www/fa2.3/devel/../includes/system_tests.inc:15
msgid "Info"
msgstr "Information"
-#: includes/system_tests.inc:16
+#: /var/www/fa2.3/devel/../includes/system_tests.inc:16
msgid "Optional"
msgstr "Optionnel"
-#: includes/system_tests.inc:17
+#: /var/www/fa2.3/devel/../includes/system_tests.inc:17
msgid "Recommended"
msgstr "Recommandé"
-#: includes/system_tests.inc:18
+#: /var/www/fa2.3/devel/../includes/system_tests.inc:18
msgid "Required "
msgstr "Requis"
-#: includes/system_tests.inc:24
+#: /var/www/fa2.3/devel/../includes/system_tests.inc:24
msgid "MySQL version"
msgstr "Version de MySQL"
-#: includes/system_tests.inc:28
+#: /var/www/fa2.3/devel/../includes/system_tests.inc:28
msgid "Upgrade MySQL server to version at least 4.1"
msgstr "Mettre à niveau MySQL à la vesion 4.1 et plus"
-#: includes/system_tests.inc:35
+#: /var/www/fa2.3/devel/../includes/system_tests.inc:35
msgid "PHP MySQL extension"
msgstr "Extension MySQL de PHP"
-#: includes/system_tests.inc:40
+#: /var/www/fa2.3/devel/../includes/system_tests.inc:40
msgid "Your PHP has to have MySQL extension enabled."
msgstr "SVP activer l'extension MySQL de votre PHP"
-#: includes/system_tests.inc:46
+#: /var/www/fa2.3/devel/../includes/system_tests.inc:46
msgid "PHP version"
msgstr "Version de PHP"
-#: includes/system_tests.inc:50
+#: /var/www/fa2.3/devel/../includes/system_tests.inc:50
msgid "Upgrade PHP to version at least 4.3.3"
msgstr "Mettre à niveau PHP à la version 4.3.3 et plus"
-#: includes/system_tests.inc:57
+#: /var/www/fa2.3/devel/../includes/system_tests.inc:57
msgid "Server system"
msgstr "Système serveur"
-#: includes/system_tests.inc:67
+#: /var/www/fa2.3/devel/../includes/system_tests.inc:67
msgid "Session save path"
msgstr "Chemin d'accès à la sauvegarde de la session"
-#: includes/system_tests.inc:79
+#: /var/www/fa2.3/devel/../includes/system_tests.inc:79
msgid "Removed install wizard folder"
msgstr "Le répertoire d'installation a été retiré."
-#: includes/system_tests.inc:82
+#: /var/www/fa2.3/devel/../includes/system_tests.inc:82
msgid "Not removed"
msgstr "Non retiré"
-#: includes/system_tests.inc:83
+#: /var/www/fa2.3/devel/../includes/system_tests.inc:83
msgid "Remove or rename install wizard folder for security reasons."
msgstr "Pour des raisons de sécurité, vous devez retirer ou renommer le répertoire d'installation."
-#: includes/system_tests.inc:90
+#: /var/www/fa2.3/devel/../includes/system_tests.inc:90
msgid "Browser type"
msgstr "Type de navigateur"
-#: includes/system_tests.inc:94
+#: /var/www/fa2.3/devel/../includes/system_tests.inc:94
msgid "Any browser is supported"
msgstr "Tous les navigateurs sont supportés"
-#: includes/system_tests.inc:101
+#: /var/www/fa2.3/devel/../includes/system_tests.inc:101
msgid "Http server type"
msgstr "Type de serveur Http"
-#: includes/system_tests.inc:105
+#: /var/www/fa2.3/devel/../includes/system_tests.inc:105
msgid "Any server is supported"
msgstr "Tous les serveurs sont supportés"
-#: includes/system_tests.inc:112
+#: /var/www/fa2.3/devel/../includes/system_tests.inc:112
msgid "Native gettext"
msgstr "Gettext natif"
-#: includes/system_tests.inc:116
+#: /var/www/fa2.3/devel/../includes/system_tests.inc:116
msgid "In case of no gettext support, php emulation is used"
msgstr "Si gettext est non supporté, l'émulation php sera utilisée"
-#: includes/system_tests.inc:124
+#: /var/www/fa2.3/devel/../includes/system_tests.inc:124
msgid "Debugging mode"
msgstr "Mode de débuggage"
-#: includes/system_tests.inc:128
+#: /var/www/fa2.3/devel/../includes/system_tests.inc:128
msgid "To switch debugging on set $go_debug>0 in config.php file"
msgstr "Pour activer le code de débug, modifier $go_debug>0 dans le fichier config.php"
-#: includes/system_tests.inc:137
+#: /var/www/fa2.3/devel/../includes/system_tests.inc:137
msgid "Error logging"
msgstr "Enregistrement des erreurs"
-#: includes/system_tests.inc:145
+#: /var/www/fa2.3/devel/../includes/system_tests.inc:145
msgid "Disabled"
msgstr "Désactivé"
-#: includes/system_tests.inc:148
+#: /var/www/fa2.3/devel/../includes/system_tests.inc:148
msgid "To switch error logging set $error_logging in config.php file"
msgstr "Pour activer l'enregistrement des erreurs, modifiez $error_logging dans le fichier de configuration config.php"
-#: includes/system_tests.inc:151
+#: /var/www/fa2.3/devel/../includes/system_tests.inc:151
msgid "Log file is not writeable"
msgstr "Impossible d'écrire dans le fichier de log"
-#: includes/system_tests.inc:161
+#: /var/www/fa2.3/devel/../includes/system_tests.inc:161
msgid "Current database version"
msgstr "Version de la BD"
-#: includes/system_tests.inc:165
+#: /var/www/fa2.3/devel/../includes/system_tests.inc:165
msgid "Database structure seems to be not upgraded to current version"
msgstr "La structure de la BD ne semble pas être de niveau avec la version actuelle"
-#: includes/system_tests.inc:180
+#: /var/www/fa2.3/devel/../includes/system_tests.inc:180
msgid "Company subdirectories consistency"
msgstr "Cohérence des sous-répertoire de la compagnie"
-#: includes/system_tests.inc:193
-#: includes/system_tests.inc:200
-#: includes/system_tests.inc:208
-#: includes/system_tests.inc:225
-#: includes/system_tests.inc:340
-#: includes/system_tests.inc:349
-#: includes/system_tests.inc:358
+#: /var/www/fa2.3/devel/../includes/system_tests.inc:193
+#: /var/www/fa2.3/devel/../includes/system_tests.inc:200
+#: /var/www/fa2.3/devel/../includes/system_tests.inc:208
+#: /var/www/fa2.3/devel/../includes/system_tests.inc:225
+#: /var/www/fa2.3/devel/../includes/system_tests.inc:345
#, php-format
msgid "'%s' is not writeable"
msgstr "Il est impossible d'écrire dans '%s' "
-#: includes/system_tests.inc:221
+#: /var/www/fa2.3/devel/../includes/system_tests.inc:221
msgid "Temporary directory"
msgstr "Répertoire temporaire"
-#: includes/system_tests.inc:233
+#: /var/www/fa2.3/devel/../includes/system_tests.inc:233
msgid "Language configuration consistency"
msgstr "Cohérence de la configuration de la langue"
-#: includes/system_tests.inc:242
+#: /var/www/fa2.3/devel/../includes/system_tests.inc:242
msgid "Languages folder should be writeable."
msgstr "Les répertoires de langue doivent avoir un accès en écriture"
-#: includes/system_tests.inc:251
+#: /var/www/fa2.3/devel/../includes/system_tests.inc:250
msgid "Languages configuration file should be writeable."
msgstr "Le fichier de configuration de langues doit être accessible en écriture"
-#: includes/system_tests.inc:270
+#: /var/www/fa2.3/devel/../includes/system_tests.inc:268
#, php-format
msgid "Missing %s translation file."
msgstr "Le fichier de traduction '%s' est manquant"
-#: includes/system_tests.inc:275
+#: /var/www/fa2.3/devel/../includes/system_tests.inc:273
#, php-format
msgid "Missing system locale: %s"
msgstr "Il manque '%s'"
-#: includes/system_tests.inc:288
+#: /var/www/fa2.3/devel/../includes/system_tests.inc:286
msgid "Main config file"
msgstr "Fichier de configuration"
-#: includes/system_tests.inc:295
-#: includes/system_tests.inc:317
+#: /var/www/fa2.3/devel/../includes/system_tests.inc:293
+#: /var/www/fa2.3/devel/../includes/system_tests.inc:315
#, php-format
msgid "Can't write '%s' file. Check FA directory write permissions."
msgstr "Impossible d'écrire '%s'. Svp vérifier les permissions d'écriture sur le répertoire de FA"
-#: includes/system_tests.inc:296
-#: includes/system_tests.inc:318
+#: /var/www/fa2.3/devel/../includes/system_tests.inc:294
+#: /var/www/fa2.3/devel/../includes/system_tests.inc:316
#, php-format
msgid "'%s' file exists."
msgstr "Fichier '%s' existant."
-#: includes/system_tests.inc:300
+#: /var/www/fa2.3/devel/../includes/system_tests.inc:298
#, php-format
msgid "'%s' file should be read-only"
msgstr "'%s' doit être en lecture seule."
-#: includes/system_tests.inc:309
+#: /var/www/fa2.3/devel/../includes/system_tests.inc:307
msgid "Database auth file"
msgstr "Fichier d'autorisation de la BD"
-#: includes/system_tests.inc:322
+#: /var/www/fa2.3/devel/../includes/system_tests.inc:320
#, php-format
msgid "'%s' file should be read-only if you do not plan to add or change companies"
msgstr "Le fichier '%s' devrait être en lecture seule si vous ne prévoyez pas ajouter ou changer les compagnies."
-#: includes/system_tests.inc:333
+#: /var/www/fa2.3/devel/../includes/system_tests.inc:331
msgid "Extensions system"
msgstr "Système des extensions"
-#: includes/system_tests.inc:363
+#: /var/www/fa2.3/devel/../includes/system_tests.inc:366
msgid "Extensions configuration files and directories should be writeable"
msgstr "Les répertoires et fichiers de configuration des extensions doivent accepter les écritures"
-#: includes/system_tests.inc:375
+#: /var/www/fa2.3/devel/../includes/system_tests.inc:378
#, php-format
msgid "Non-standard theme directory '%s' is not writable"
msgstr "Le répertoire de thèmes non-standards '%s' n'accepte pas les écritures"
-#: includes/system_tests.inc:385
+#: /var/www/fa2.3/devel/../includes/system_tests.inc:388
msgid "OpenSSL PHP extension have to be enabled to use extension repository system."
msgstr "Les extensions OpenSSL de PHP doivent être activées pour utiliser le système de dépôt des extensions"
-#: includes/system_tests.inc:388
+#: /var/www/fa2.3/devel/../includes/system_tests.inc:391
msgid "OpenSSL have to be available on your server to use extension repository system."
msgstr "Les extensions OpenSSL de PHP doivent être disponibles pour utiliser le système de dépôt des extensions"
-#: includes/system_tests.inc:411
+#: /var/www/fa2.3/devel/../includes/system_tests.inc:414
msgid "Test"
msgstr "Test"
-#: includes/system_tests.inc:411
+#: /var/www/fa2.3/devel/../includes/system_tests.inc:414
msgid "Test type"
msgstr "Type de test"
-#: includes/system_tests.inc:411
+#: /var/www/fa2.3/devel/../includes/system_tests.inc:414
msgid "Value"
msgstr "Valeur"
-#: includes/system_tests.inc:411
+#: /var/www/fa2.3/devel/../includes/system_tests.inc:414
msgid "Comments"
msgstr "Commentaires"
-#: includes/system_tests.inc:435
+#: /var/www/fa2.3/devel/../includes/system_tests.inc:438
msgid "Ok"
msgstr "Ok"
-#: includes/packages.inc:190
-#, php-format
-msgid "No key field '%s' in file '%s'"
-msgstr ""
-
-#: includes/packages.inc:295
-msgid "Release file in repository is invalid, or public key is outdated."
-msgstr ""
-
-#: includes/packages.inc:311
-msgid "Repository version does not match application version."
-msgstr ""
-
-#: includes/packages.inc:325
-#, php-format
-msgid "Security alert: broken index file in repository '%s'. Please inform repository administrator about this issue."
-msgstr ""
-
-#: includes/packages.inc:358
-#, php-format
-msgid "Security alert: broken package '%s' in repository. Please inform repository administrator about this issue."
-msgstr ""
-
-#: includes/packages.inc:613
-#: includes/packages.inc:664
-#, php-format
-msgid "Package '%s' not found."
-msgstr ""
-
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
+"POT-Creation-Date: 2012-02-29 09:49+0100\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
"Content-Type: text/plain; charset=ISO-8859-2\n"
"Content-Transfer-Encoding: 8bit\n"
-#: install/index.php:20 install/index.php:40
+#: install/index.php:20 install/index.php:41
msgid "FrontAccouting ERP Installation Wizard"
msgstr ""
-#: install/index.php:41
+#: install/index.php:42
#, php-format
msgid "Step %d: %s"
msgstr ""
-#: install/index.php:48
+#: install/index.php:49
msgid "Chart of accounts"
msgstr ""
-#: install/index.php:48 install/index.php:75
+#: install/index.php:49 install/index.php:76
msgid "Encoding"
msgstr ""
-#: install/index.php:48 install/index.php:75
+#: install/index.php:49 install/index.php:76
msgid "Description"
msgstr ""
-#: install/index.php:48 install/index.php:75
+#: install/index.php:49 install/index.php:76
msgid "Install"
msgstr ""
-#: install/index.php:65 install/index.php:93
+#: install/index.php:66 install/index.php:94
msgid "Installed"
msgstr ""
-#: install/index.php:75
+#: install/index.php:76
msgid "Language"
msgstr ""
-#: install/index.php:123
+#: install/index.php:124
msgid ""
"Cannot connect to database. User or password is invalid or you have no "
"permittions to create database."
msgstr ""
-#: install/index.php:159
+#: install/index.php:160
msgid "Cannot save system configuration file 'config.php'."
msgstr ""
-#: install/index.php:166
+#: install/index.php:167
msgid "Cannot open 'config_db.php' configuration file."
msgstr ""
-#: install/index.php:169
+#: install/index.php:170
msgid "Cannot write to the 'config_db.php' configuration file."
msgstr ""
-#: install/index.php:172
+#: install/index.php:173
msgid ""
"Configuration file 'config_db.php' is not writable. Change its permissions "
"so it is, then re-run installation step."
msgstr ""
#: install/index.php:325 install/index.php:351 install/index.php:358
-#: install/index.php:365 install/index.php:384
+#: install/index.php:365 install/index.php:389
msgid "Continue >>"
msgstr ""
msgstr ""
#: install/index.php:350 install/index.php:357 install/index.php:364
-#: install/index.php:383
+#: install/index.php:388
msgid "<< Back"
msgstr ""
msgid "Charts of Accounts Selection"
msgstr ""
-#: install/index.php:374
+#: install/index.php:379
msgid "Company Settings"
msgstr ""
-#: install/index.php:376
+#: install/index.php:381
msgid "Company Name:"
msgstr ""
-#: install/index.php:377
+#: install/index.php:382
msgid "Admin Login:"
msgstr ""
-#: install/index.php:378
+#: install/index.php:383
msgid "Admin Password:"
msgstr ""
-#: install/index.php:379
+#: install/index.php:384
msgid "Reenter Password:"
msgstr ""
-#: install/index.php:380
+#: install/index.php:385
msgid "Select Chart of Accounts:"
msgstr ""
-#: install/index.php:381
+#: install/index.php:386
msgid "Select Default Language:"
msgstr ""
-#: install/index.php:388
+#: install/index.php:393
msgid "FrontAccounting ERP has been installed successsfully."
msgstr ""
-#: install/index.php:389
+#: install/index.php:394
msgid "Please do not forget to remove install wizard folder."
msgstr ""
-#: install/index.php:392
+#: install/index.php:397
msgid "Click here to start."
msgstr ""
msgid "No key field '%s' in file '%s'"
msgstr ""
-#: includes/packages.inc:295
+#: includes/packages.inc:295 includes/packages.inc:329
+#, php-format
+msgid "Cannot delete outdated '%s' file."
+msgstr ""
+
+#: includes/packages.inc:299
msgid "Release file in repository is invalid, or public key is outdated."
msgstr ""
-#: includes/packages.inc:311
+#: includes/packages.inc:316
msgid "Repository version does not match application version."
msgstr ""
-#: includes/packages.inc:325
+#: includes/packages.inc:333
#, php-format
msgid ""
"Security alert: broken index file in repository '%s'. Please inform "
"repository administrator about this issue."
msgstr ""
-#: includes/packages.inc:358
+#: includes/packages.inc:366
#, php-format
msgid ""
"Security alert: broken package '%s' in repository. Please inform repository "
"administrator about this issue."
msgstr ""
-#: includes/packages.inc:613 includes/packages.inc:664
+#: includes/packages.inc:621 includes/packages.inc:672
#, php-format
msgid "Package '%s' not found."
msgstr ""
msgstr ""
"Project-Id-Version: \n"
"Report-Msgid-Bugs-To: \n"
-"POT-Creation-Date: 2011-03-31 10:54+0200\n"
+"POT-Creation-Date: 2010-08-08 12:50+0200\n"
"PO-Revision-Date: \n"
-"Last-Translator: Translation Team <info@frontaccounting.net>\n"
+"Last-Translator: Janusz Dobrowolski <janusz@iron.from.pl>\n"
"Language-Team: \n"
-"Language: \n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=ISO-8859-2\n"
"Content-Transfer-Encoding: 8bit\n"
-#: install/index.php:20
-#: install/index.php:40
+#: /var/www/fa2.3/devel/../install/index.php:20
+#: /var/www/fa2.3/devel/../install/index.php:40
msgid "FrontAccouting ERP Installation Wizard"
msgstr "Instalator FrontAccounting ERP"
-#: install/index.php:41
+#: /var/www/fa2.3/devel/../install/index.php:41
#, php-format
msgid "Step %d: %s"
msgstr "Krok %d: %s"
-#: install/index.php:48
+#: /var/www/fa2.3/devel/../install/index.php:48
msgid "Chart of accounts"
msgstr "Plan kont"
-#: install/index.php:48
-#: install/index.php:75
+#: /var/www/fa2.3/devel/../install/index.php:48
+#: /var/www/fa2.3/devel/../install/index.php:75
msgid "Encoding"
msgstr "Kodowanie"
-#: install/index.php:48
-#: install/index.php:75
+#: /var/www/fa2.3/devel/../install/index.php:48
+#: /var/www/fa2.3/devel/../install/index.php:75
msgid "Description"
msgstr "Opis"
-#: install/index.php:48
-#: install/index.php:75
+#: /var/www/fa2.3/devel/../install/index.php:48
+#: /var/www/fa2.3/devel/../install/index.php:75
msgid "Install"
msgstr "Zainstaluj"
-#: install/index.php:65
-#: install/index.php:93
+#: /var/www/fa2.3/devel/../install/index.php:65
+#: /var/www/fa2.3/devel/../install/index.php:93
msgid "Installed"
msgstr "Zainstalowany"
-#: install/index.php:75
+#: /var/www/fa2.3/devel/../install/index.php:75
msgid "Language"
msgstr "Jêzyk"
-#: install/index.php:123
-msgid "Cannot connect to database. User or password is invalid or you have no permittions to create database."
-msgstr "Nie mo¿na po³aæzyæ siê z baz± danych. Login lub has³o jest niepoprawne, lub brak uprawnieñ do tworzenia bazy danych."
-
-#: install/index.php:159
+#: /var/www/fa2.3/devel/../install/index.php:156
msgid "Cannot save system configuration file 'config.php'."
msgstr "Nie mo¿na zapisaæ pliku konfiguracyjnego 'config.php'."
-#: install/index.php:166
+#: /var/www/fa2.3/devel/../install/index.php:173
msgid "Cannot open 'config_db.php' configuration file."
msgstr "Nie mo¿na utworzyæ pliku konfiguracji 'config_db.php'."
-#: install/index.php:169
+#: /var/www/fa2.3/devel/../install/index.php:176
msgid "Cannot write to the 'config_db.php' configuration file."
msgstr "Nie mo¿na zapisaæ pliku konfiguracji 'config_db.php'."
-#: install/index.php:172
-msgid "Configuration file 'config_db.php' is not writable. Change its permissions so it is, then re-run installation step."
-msgstr "Plik konfiguracji 'config_db.php' jest zabezpieczony przed zapisem. Zmieñ prawa dostêpu i powtórz krok instalacji."
+#: /var/www/fa2.3/devel/../install/index.php:179
+msgid ""
+"Configuration file 'config_db.php' is not writable. Change its permissions "
+"so it is, then re-run installation step."
+msgstr ""
+"Plik konfiguracji 'config_db.php' jest zabezpieczony przed zapisem. Zmieñ "
+"prawa dostêpu i powtórz krok instalacji."
-#: install/index.php:211
+#: /var/www/fa2.3/devel/../install/index.php:217
msgid "Host name cannot be empty."
msgstr "Adres serwera nie mo¿e byæ pusty."
-#: install/index.php:215
+#: /var/www/fa2.3/devel/../install/index.php:221
msgid "Database user name cannot be empty."
msgstr "Nazwa u¿ytkownika nie mo¿e by pusta."
-#: install/index.php:219
+#: /var/www/fa2.3/devel/../install/index.php:225
msgid "Database name cannot be empty."
msgstr "Nazwa bazy danych nie mo¿e byæ pusta."
-#: install/index.php:272
+#: /var/www/fa2.3/devel/../install/index.php:277
msgid "Company name cannot be empty."
msgstr "Nazwa firmy nie mo¿e by pusta."
-#: install/index.php:276
+#: /var/www/fa2.3/devel/../install/index.php:281
msgid "Company admin name cannot be empty."
msgstr "Nazwa administratora nie mo¿e byæ pusta."
-#: install/index.php:280
+#: /var/www/fa2.3/devel/../install/index.php:285
msgid "Company admin password cannot be empty."
msgstr "Has³o administratora nie mo¿e by puste."
-#: install/index.php:284
+#: /var/www/fa2.3/devel/../install/index.php:289
msgid "Company admin passwords differ."
msgstr "Wprowadzone has³a ró¿ni± siê."
-#: install/index.php:316
+#: /var/www/fa2.3/devel/../install/index.php:320
msgid "System Diagnostics"
msgstr "Diagnostyka Systemu"
-#: install/index.php:318
+#: /var/www/fa2.3/devel/../install/index.php:323
msgid "Select install wizard language:"
msgstr "Wybierz jêzyk u¿ywany przy instalacji:"
-#: install/index.php:324
-msgid "All application preliminary requirements seems to be correct. Please press Continue button below."
-msgstr "Wszystkie wymagania systemu wydaj± siê byæ spe³nione. Kliknij klawisz poni¿ej aby rozpocz±æ instalacjê."
-
-#: install/index.php:325
-#: install/index.php:351
-#: install/index.php:358
-#: install/index.php:365
-#: install/index.php:384
+#: /var/www/fa2.3/devel/../install/index.php:329
+msgid ""
+"All application preliminary requirements seems to be correct. Please press "
+"Continue button below."
+msgstr ""
+"Wszystkie wymagania systemu wydaj± siê byæ spe³nione. Kliknij klawisz "
+"poni¿ej aby rozpocz±æ instalacjê."
+
+#: /var/www/fa2.3/devel/../install/index.php:330
+#: /var/www/fa2.3/devel/../install/index.php:356
+#: /var/www/fa2.3/devel/../install/index.php:363
+#: /var/www/fa2.3/devel/../install/index.php:370
+#: /var/www/fa2.3/devel/../install/index.php:389
msgid "Continue >>"
msgstr "Kontynuuj >>"
-#: install/index.php:327
-msgid "Application cannot be installed. Please fix problems listed below in red, and press Refresh button."
-msgstr "Aplikacja nie mo¿e byæ zainstalowana. Usuñ wskazane problemy i kliknij klawisz 'Od¶wie¿'."
+#: /var/www/fa2.3/devel/../install/index.php:332
+msgid ""
+"Application cannot be installed. Please fix problems listed below in red, "
+"and press Refresh button."
+msgstr ""
+"Aplikacja nie mo¿e byæ zainstalowana. Usuñ wskazane problemy i kliknij "
+"klawisz 'Od¶wie¿'."
-#: install/index.php:328
+#: /var/www/fa2.3/devel/../install/index.php:333
msgid "Refresh"
msgstr "Od¶wierz"
-#: install/index.php:338
+#: /var/www/fa2.3/devel/../install/index.php:343
msgid "Database Server Settings"
msgstr "Ustawienia Serwera Bazy Danych"
-#: install/index.php:340
+#: /var/www/fa2.3/devel/../install/index.php:345
msgid "Server Host:"
msgstr "Adres Serwera:"
-#: install/index.php:341
+#: /var/www/fa2.3/devel/../install/index.php:346
msgid "Database User:"
msgstr "Nazwa U¿ytkownika:"
-#: install/index.php:342
+#: /var/www/fa2.3/devel/../install/index.php:347
msgid "Database Password:"
msgstr "Has³o:"
-#: install/index.php:343
+#: /var/www/fa2.3/devel/../install/index.php:348
msgid "Database Name:"
msgstr "Nazwa Bazy Danych:"
-#: install/index.php:344
+#: /var/www/fa2.3/devel/../install/index.php:349
msgid "Use '0_' Table Prefix:"
msgstr "Prefiks '0_' dla Nazw Tablic:"
-#: install/index.php:344
-#: includes/system_tests.inc:38
-#: includes/system_tests.inc:113
-#: includes/system_tests.inc:126
+#: /var/www/fa2.3/devel/../install/index.php:349
+#: /var/www/fa2.3/devel/../includes/system_tests.inc:38
+#: /var/www/fa2.3/devel/../includes/system_tests.inc:113
+#: /var/www/fa2.3/devel/../includes/system_tests.inc:126
msgid "Yes"
msgstr "Tak"
-#: install/index.php:344
-#: includes/system_tests.inc:38
-#: includes/system_tests.inc:113
-#: includes/system_tests.inc:126
+#: /var/www/fa2.3/devel/../install/index.php:349
+#: /var/www/fa2.3/devel/../includes/system_tests.inc:38
+#: /var/www/fa2.3/devel/../includes/system_tests.inc:113
+#: /var/www/fa2.3/devel/../includes/system_tests.inc:126
msgid "No"
msgstr "Nie"
-#: install/index.php:345
+#: /var/www/fa2.3/devel/../install/index.php:350
msgid "Install Additional Language Packs from FA Repository:"
msgstr "Instalacja Dodatkowych Jêzyków z Repozytorium FA:"
-#: install/index.php:346
+#: /var/www/fa2.3/devel/../install/index.php:351
msgid "Install Additional COAs from FA Repository:"
msgstr "Instalacja Dodatkowych Planów Kont z Repozytorium FA:"
-#: install/index.php:348
-msgid "Use table prefix if you share selected database for more than one FA company."
+#: /var/www/fa2.3/devel/../install/index.php:353
+msgid ""
+"Use table prefix if you share selected database for more than one FA company."
msgstr "U¿yj prefiksu je¶li ta sama baza danych bêdzie u¿ywana dla kilku firm."
-#: install/index.php:349
-msgid "Do not select additional langs nor COAs if you have no working internet connection right now. You can install them later."
-msgstr "Nie zaznaczaj wyboru dodatkowych jêzyków ani planów kont je¶li w tej chwili nie masz dostêpu do internetu. Bêdziesz je móg³ zainstalowaæ równie¿ pó¼niej."
+#: /var/www/fa2.3/devel/../install/index.php:354
+msgid ""
+"Do not select additional langs nor COAs if you have no working internet "
+"connection right now. You can install them later."
+msgstr ""
+"Nie zaznaczaj wyboru dodatkowych jêzyków ani planów kont je¶li w tej chwili "
+"nie masz dostêpu do internetu. Bêdziesz je móg³ zainstalowaæ równie¿ pó¼niej."
-#: install/index.php:350
-#: install/index.php:357
-#: install/index.php:364
-#: install/index.php:383
+#: /var/www/fa2.3/devel/../install/index.php:355
+#: /var/www/fa2.3/devel/../install/index.php:362
+#: /var/www/fa2.3/devel/../install/index.php:369
+#: /var/www/fa2.3/devel/../install/index.php:388
msgid "<< Back"
msgstr "<< Wróæ"
-#: install/index.php:355
+#: /var/www/fa2.3/devel/../install/index.php:360
msgid "User Interface Languages Selection"
msgstr "Wybór Jêzyków Interfejsu U¿ytkownika"
-#: install/index.php:362
+#: /var/www/fa2.3/devel/../install/index.php:367
msgid "Charts of Accounts Selection"
msgstr "Wybór Planów Kont"
-#: install/index.php:374
+#: /var/www/fa2.3/devel/../install/index.php:379
msgid "Company Settings"
msgstr "Ustawienia Firmy"
-#: install/index.php:376
+#: /var/www/fa2.3/devel/../install/index.php:381
msgid "Company Name:"
msgstr "Nazwa Firmy:"
-#: install/index.php:377
+#: /var/www/fa2.3/devel/../install/index.php:382
msgid "Admin Login:"
msgstr "Login Administratora:"
-#: install/index.php:378
+#: /var/www/fa2.3/devel/../install/index.php:383
msgid "Admin Password:"
msgstr "Has³o Administratora:"
-#: install/index.php:379
+#: /var/www/fa2.3/devel/../install/index.php:384
msgid "Reenter Password:"
msgstr "Powtórz Has³o:"
-#: install/index.php:380
+#: /var/www/fa2.3/devel/../install/index.php:385
msgid "Select Chart of Accounts:"
msgstr "Wybierz Planów Kont:"
-#: install/index.php:381
+#: /var/www/fa2.3/devel/../install/index.php:386
msgid "Select Default Language:"
msgstr "Wybierz Jêzyk Domy¶lny:"
-#: install/index.php:388
+#: /var/www/fa2.3/devel/../install/index.php:393
msgid "FrontAccounting ERP has been installed successsfully."
msgstr "Aplikacja FrontAccounting ERP zosta³a zainstalowana pomy¶lnie."
-#: install/index.php:389
+#: /var/www/fa2.3/devel/../install/index.php:394
msgid "Please do not forget to remove install wizard folder."
msgstr "Nie zapomnij usun±æ folderu instalatora."
-#: install/index.php:392
+#: /var/www/fa2.3/devel/../install/index.php:396
msgid "Click here to start."
msgstr "Kliknij tutaj, aby rozpocz±æ pracê."
-#: includes/system_tests.inc:15
+#: /var/www/fa2.3/devel/../includes/system_tests.inc:15
msgid "Info"
msgstr "Informacja"
-#: includes/system_tests.inc:16
+#: /var/www/fa2.3/devel/../includes/system_tests.inc:16
msgid "Optional"
msgstr "Opcjonalne"
-#: includes/system_tests.inc:17
+#: /var/www/fa2.3/devel/../includes/system_tests.inc:17
msgid "Recommended"
msgstr "Zalecane"
-#: includes/system_tests.inc:18
+#: /var/www/fa2.3/devel/../includes/system_tests.inc:18
msgid "Required "
msgstr "Wymagane"
-#: includes/system_tests.inc:24
+#: /var/www/fa2.3/devel/../includes/system_tests.inc:24
msgid "MySQL version"
msgstr "Wersja MySQL"
-#: includes/system_tests.inc:28
+#: /var/www/fa2.3/devel/../includes/system_tests.inc:28
msgid "Upgrade MySQL server to version at least 4.1"
msgstr "U¿yj wersji serwera MySQL minimum 4.1"
-#: includes/system_tests.inc:35
+#: /var/www/fa2.3/devel/../includes/system_tests.inc:35
msgid "PHP MySQL extension"
msgstr "Rozszerzenie PHP MySQL"
-#: includes/system_tests.inc:40
+#: /var/www/fa2.3/devel/../includes/system_tests.inc:40
msgid "Your PHP has to have MySQL extension enabled."
msgstr "PHP musi mieæ w³±czone rozszerzenie MySQL."
-#: includes/system_tests.inc:46
+#: /var/www/fa2.3/devel/../includes/system_tests.inc:46
msgid "PHP version"
msgstr "Wersja PHP"
-#: includes/system_tests.inc:50
+#: /var/www/fa2.3/devel/../includes/system_tests.inc:50
msgid "Upgrade PHP to version at least 4.3.3"
msgstr "Zainstaluj PHP w wersji co najmniej 4.3.3"
-#: includes/system_tests.inc:57
+#: /var/www/fa2.3/devel/../includes/system_tests.inc:57
msgid "Server system"
msgstr "System serwera"
-#: includes/system_tests.inc:67
+#: /var/www/fa2.3/devel/../includes/system_tests.inc:67
msgid "Session save path"
msgstr "Katalog zapisu pliku sesji"
-#: includes/system_tests.inc:79
+#: /var/www/fa2.3/devel/../includes/system_tests.inc:79
msgid "Removed install wizard folder"
msgstr "Folder instalatora usuniêty"
-#: includes/system_tests.inc:82
+#: /var/www/fa2.3/devel/../includes/system_tests.inc:82
msgid "Not removed"
msgstr "Nie usuniêty"
-#: includes/system_tests.inc:83
+#: /var/www/fa2.3/devel/../includes/system_tests.inc:83
msgid "Remove or rename install wizard folder for security reasons."
msgstr "Ze wzglêdów bezpieczeñstwa usuñ lub zmieñ nazwê folderu instalatora."
-#: includes/system_tests.inc:90
+#: /var/www/fa2.3/devel/../includes/system_tests.inc:90
msgid "Browser type"
msgstr "Typ przegl±darki"
-#: includes/system_tests.inc:94
+#: /var/www/fa2.3/devel/../includes/system_tests.inc:94
msgid "Any browser is supported"
msgstr "Mo¿e byæ u¿yty dowolny typ przegl±darki"
-#: includes/system_tests.inc:101
+#: /var/www/fa2.3/devel/../includes/system_tests.inc:101
msgid "Http server type"
msgstr "Serwer http"
-#: includes/system_tests.inc:105
+#: /var/www/fa2.3/devel/../includes/system_tests.inc:105
msgid "Any server is supported"
msgstr "Dowolny"
-#: includes/system_tests.inc:112
+#: /var/www/fa2.3/devel/../includes/system_tests.inc:112
msgid "Native gettext"
msgstr "Biblioteka Gettext "
-#: includes/system_tests.inc:116
+#: /var/www/fa2.3/devel/../includes/system_tests.inc:116
msgid "In case of no gettext support, php emulation is used"
msgstr "W przypadku braku wsparcia systemu, gettext jest emulowany."
-#: includes/system_tests.inc:124
+#: /var/www/fa2.3/devel/../includes/system_tests.inc:124
msgid "Debugging mode"
msgstr "Tryb debug"
-#: includes/system_tests.inc:128
+#: /var/www/fa2.3/devel/../includes/system_tests.inc:128
msgid "To switch debugging on set $go_debug>0 in config.php file"
msgstr "Aby w³±czyæ tryb debug ustaw $go_debug>0 in config.php file"
-#: includes/system_tests.inc:137
+#: /var/www/fa2.3/devel/../includes/system_tests.inc:137
msgid "Error logging"
msgstr "Logowanie b³êdów"
-#: includes/system_tests.inc:145
+#: /var/www/fa2.3/devel/../includes/system_tests.inc:145
msgid "Disabled"
msgstr "Wy³±czony"
-#: includes/system_tests.inc:148
+#: /var/www/fa2.3/devel/../includes/system_tests.inc:148
msgid "To switch error logging set $error_logging in config.php file"
-msgstr "Aby w³±czyæ logowanie b³êdów ustaw zmienn± $error_logging w pliku config.php"
+msgstr ""
+"Aby w³±czyæ logowanie b³êdów ustaw zmienn± $error_logging w pliku config.php"
-#: includes/system_tests.inc:151
+#: /var/www/fa2.3/devel/../includes/system_tests.inc:151
msgid "Log file is not writeable"
msgstr "Logfile jest niezapisywalny"
-#: includes/system_tests.inc:161
+#: /var/www/fa2.3/devel/../includes/system_tests.inc:161
msgid "Current database version"
msgstr "Aktualna wersja bazy danych"
-#: includes/system_tests.inc:165
+#: /var/www/fa2.3/devel/../includes/system_tests.inc:165
msgid "Database structure seems to be not upgraded to current version"
msgstr "Struktura bazy danych nie jest zaktualizowana do bie¿±cej wersji"
-#: includes/system_tests.inc:180
+#: /var/www/fa2.3/devel/../includes/system_tests.inc:180
msgid "Company subdirectories consistency"
msgstr "Prawid³owa struktura folderów firmowych"
-#: includes/system_tests.inc:193
-#: includes/system_tests.inc:200
-#: includes/system_tests.inc:208
-#: includes/system_tests.inc:225
-#: includes/system_tests.inc:340
-#: includes/system_tests.inc:349
-#: includes/system_tests.inc:358
+#: /var/www/fa2.3/devel/../includes/system_tests.inc:193
+#: /var/www/fa2.3/devel/../includes/system_tests.inc:200
+#: /var/www/fa2.3/devel/../includes/system_tests.inc:208
+#: /var/www/fa2.3/devel/../includes/system_tests.inc:225
+#: /var/www/fa2.3/devel/../includes/system_tests.inc:345
#, php-format
msgid "'%s' is not writeable"
msgstr "'%s' jest niezapisywalny"
-#: includes/system_tests.inc:221
+#: /var/www/fa2.3/devel/../includes/system_tests.inc:221
msgid "Temporary directory"
msgstr "Katalog plików tymczasowych"
-#: includes/system_tests.inc:233
+#: /var/www/fa2.3/devel/../includes/system_tests.inc:233
msgid "Language configuration consistency"
msgstr "Konfiguracja jêzykowa"
-#: includes/system_tests.inc:242
+#: /var/www/fa2.3/devel/../includes/system_tests.inc:242
msgid "Languages folder should be writeable."
msgstr "Folder jêzyków musi byæ zapisywalny"
-#: includes/system_tests.inc:251
+#: /var/www/fa2.3/devel/../includes/system_tests.inc:250
msgid "Languages configuration file should be writeable."
msgstr "Pliki konfiguracyjny jêzyków musi byæ zapisywalny."
-#: includes/system_tests.inc:270
+#: /var/www/fa2.3/devel/../includes/system_tests.inc:268
#, php-format
msgid "Missing %s translation file."
msgstr "Brak pliku t³umaczeñ %s"
-#: includes/system_tests.inc:275
+#: /var/www/fa2.3/devel/../includes/system_tests.inc:273
#, php-format
msgid "Missing system locale: %s"
msgstr "Lokalizacja '%s' nie jest zainstalowana w systemie"
-#: includes/system_tests.inc:288
+#: /var/www/fa2.3/devel/../includes/system_tests.inc:286
msgid "Main config file"
msgstr "G³ówny plik konfiguracyjny "
-#: includes/system_tests.inc:295
-#: includes/system_tests.inc:317
+#: /var/www/fa2.3/devel/../includes/system_tests.inc:293
+#: /var/www/fa2.3/devel/../includes/system_tests.inc:315
#, php-format
msgid "Can't write '%s' file. Check FA directory write permissions."
msgstr "Nie mo¿na zapisaæ pliku '%s'. Sprawd¼ prawa zapisu do foderu FA."
-#: includes/system_tests.inc:296
-#: includes/system_tests.inc:318
+#: /var/www/fa2.3/devel/../includes/system_tests.inc:294
+#: /var/www/fa2.3/devel/../includes/system_tests.inc:316
#, php-format
msgid "'%s' file exists."
msgstr "Plik '%s' istnieje."
-#: includes/system_tests.inc:300
+#: /var/www/fa2.3/devel/../includes/system_tests.inc:298
#, php-format
msgid "'%s' file should be read-only"
msgstr "Plik '%s powinien byæ zabezpieczony przed zapisem"
-#: includes/system_tests.inc:309
+#: /var/www/fa2.3/devel/../includes/system_tests.inc:307
msgid "Database auth file"
msgstr "Pik configuracyjny bazy danych"
-#: includes/system_tests.inc:322
+#: /var/www/fa2.3/devel/../includes/system_tests.inc:320
#, php-format
-msgid "'%s' file should be read-only if you do not plan to add or change companies"
-msgstr "Plik '%s' powinien byæ zabezpieczony przed zapisem je¶li nie planujesz dodawania ani zmiany firm"
+msgid ""
+"'%s' file should be read-only if you do not plan to add or change companies"
+msgstr ""
+"Plik '%s' powinien byæ zabezpieczony przed zapisem je¶li nie planujesz "
+"dodawania ani zmiany firm"
-#: includes/system_tests.inc:333
+#: /var/www/fa2.3/devel/../includes/system_tests.inc:331
msgid "Extensions system"
msgstr "System rozszerzeñ"
-#: includes/system_tests.inc:363
+#: /var/www/fa2.3/devel/../includes/system_tests.inc:366
msgid "Extensions configuration files and directories should be writeable"
msgstr "Pliki konfiguracyjne i foldery rozszerzeñ powinny byæ zapisywalne"
-#: includes/system_tests.inc:375
+#: /var/www/fa2.3/devel/../includes/system_tests.inc:378
#, php-format
msgid "Non-standard theme directory '%s' is not writable"
msgstr "Niestandardowy folder tematu '%s' jest zazpieczony przed zapisem"
-#: includes/system_tests.inc:385
-msgid "OpenSSL PHP extension have to be enabled to use extension repository system."
+#: /var/www/fa2.3/devel/../includes/system_tests.inc:388
+msgid ""
+"OpenSSL PHP extension have to be enabled to use extension repository system."
msgstr "System pakietów wymaga zaisnatlowanego rozszerzenia PHP OpenSSL."
-#: includes/system_tests.inc:388
-msgid "OpenSSL have to be available on your server to use extension repository system."
-msgstr "Serwer musi mieæ zainstalowane OpenSSL ¿eby mo¿na by³o korzystaæ z repozytorium pakietów rozszerzeñ FA."
+#: /var/www/fa2.3/devel/../includes/system_tests.inc:391
+msgid ""
+"OpenSSL have to be available on your server to use extension repository "
+"system."
+msgstr ""
+"Serwer musi mieæ zainstalowane OpenSSL ¿eby mo¿na by³o korzystaæ z "
+"repozytorium pakietów rozszerzeñ FA."
-#: includes/system_tests.inc:411
+#: /var/www/fa2.3/devel/../includes/system_tests.inc:414
msgid "Test"
msgstr "Test"
-#: includes/system_tests.inc:411
+#: /var/www/fa2.3/devel/../includes/system_tests.inc:414
msgid "Test type"
msgstr "Typ testu"
-#: includes/system_tests.inc:411
+#: /var/www/fa2.3/devel/../includes/system_tests.inc:414
msgid "Value"
msgstr "Warto¶æ"
-#: includes/system_tests.inc:411
+#: /var/www/fa2.3/devel/../includes/system_tests.inc:414
msgid "Comments"
msgstr "Komentarz"
-#: includes/system_tests.inc:435
+#: /var/www/fa2.3/devel/../includes/system_tests.inc:438
msgid "Ok"
msgstr "Ok"
-
-#: includes/packages.inc:190
-#, php-format
-msgid "No key field '%s' in file '%s'"
-msgstr "Brak pola '%s' w pliku '%s'"
-
-#: includes/packages.inc:295
-msgid "Release file in repository is invalid, or public key is outdated."
-msgstr "Plik kontrolny wydania jest uszkodzony, lub klucz publiczny jest nieaktualny."
-
-#: includes/packages.inc:311
-msgid "Repository version does not match application version."
-msgstr "Wersja repozytorium nie zgadza siê z wersj± aplikacji."
-
-#: includes/packages.inc:325
-#, php-format
-msgid "Security alert: broken index file in repository '%s'. Please inform repository administrator about this issue."
-msgstr "Alarm bezpieczeñstwa: uszkodzony plik indeksu repozytorium '%s'. Poinformuj administratora repozytorium o tym problemie."
-
-#: includes/packages.inc:358
-#, php-format
-msgid "Security alert: broken package '%s' in repository. Please inform repository administrator about this issue."
-msgstr "Alarm bezpieczeñstwa: uszkodzony plik '%s' w repozytorium. Poinformuj administratora repozytorium o tym problemie."
-
-#: includes/packages.inc:613
-#: includes/packages.inc:664
-#, php-format
-msgid "Package '%s' not found."
-msgstr "Pakiet '%s' nie zosta³ znaleziony."
-
# This file is distributed under the same license as the PACKAGE package.
# InterConnect Brasil Ltda. <info@inter.bz>, 2010.
#
+#, fuzzy
msgid ""
msgstr ""
-"Project-Id-Version: PACKAGE Version\n"
+"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
-"POT-Creation-Date: \n"
-"PO-Revision-Date: 2011-03-31 22:44+0100\n"
-"Last-Translator: Translation Team <info@frontaccounting.net>\n"
+"POT-Creation-Date: 2010-08-08 12:50+0200\n"
+"PO-Revision-Date: 2010-08-12 12:50+0200\n"
+"Last-Translator: InterConnect Brasil <info@inter.bz>\n"
"Language-Team: PT-BR <>\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=ISO-8859-1\n"
"Content-Transfer-Encoding: 8bit\n"
-#: install/index.php:20
-#: install/index.php:40
+#: /var/www/fa2.3/devel/../install/index.php:20
+#: /var/www/fa2.3/devel/../install/index.php:40
msgid "FrontAccouting ERP Installation Wizard"
msgstr "Assistente de Instalação do FrontAccouting ERP"
-#: install/index.php:41
+#: /var/www/fa2.3/devel/../install/index.php:41
#, php-format
msgid "Step %d: %s"
msgstr "%do. passo: %s"
-#: install/index.php:48
+#: /var/www/fa2.3/devel/../install/index.php:48
msgid "Chart of accounts"
msgstr "Plano de contas"
-#: install/index.php:48
-#: install/index.php:75
+#: /var/www/fa2.3/devel/../install/index.php:48
+#: /var/www/fa2.3/devel/../install/index.php:75
msgid "Encoding"
msgstr "Codificação"
-#: install/index.php:48
-#: install/index.php:75
+#: /var/www/fa2.3/devel/../install/index.php:48
+#: /var/www/fa2.3/devel/../install/index.php:75
msgid "Description"
msgstr "Descrição"
-#: install/index.php:48
-#: install/index.php:75
+#: /var/www/fa2.3/devel/../install/index.php:48
+#: /var/www/fa2.3/devel/../install/index.php:75
msgid "Install"
msgstr "Instalar"
-#: install/index.php:65
-#: install/index.php:93
+#: /var/www/fa2.3/devel/../install/index.php:65
+#: /var/www/fa2.3/devel/../install/index.php:93
msgid "Installed"
msgstr "Instalado"
-#: install/index.php:75
+#: /var/www/fa2.3/devel/../install/index.php:75
msgid "Language"
msgstr "Idioma"
-#: install/index.php:123
-msgid "Cannot connect to database. User or password is invalid or you have no permittions to create database."
-msgstr ""
-
-#: install/index.php:159
+#: /var/www/fa2.3/devel/../install/index.php:156
msgid "Cannot save system configuration file 'config.php'."
msgstr "Não é possível gravar o arquivo de configuração do sistema 'config.php'."
-#: install/index.php:166
+#: /var/www/fa2.3/devel/../install/index.php:173
msgid "Cannot open 'config_db.php' configuration file."
msgstr "Não é possível abrir o arquivo de configuração 'config_db.php'."
-#: install/index.php:169
+#: /var/www/fa2.3/devel/../install/index.php:176
msgid "Cannot write to the 'config_db.php' configuration file."
msgstr "Não é possível escrever no arquivo de configuração 'config_db.php'."
-#: install/index.php:172
-msgid "Configuration file 'config_db.php' is not writable. Change its permissions so it is, then re-run installation step."
-msgstr "Arquivo de configuração 'config_db.php' não é gravável. Mudar suas permissões para gravável, então reinstale passo a passo."
+#: /var/www/fa2.3/devel/../install/index.php:179
+msgid ""
+"Configuration file 'config_db.php' is not writable. Change its permissions "
+"so it is, then re-run installation step."
+msgstr ""
+"Arquivo de configuração 'config_db.php' não é gravável. Mudar suas permissões "
+"para gravável, então reinstale passo a passo."
-#: install/index.php:211
+#: /var/www/fa2.3/devel/../install/index.php:217
msgid "Host name cannot be empty."
msgstr "O nome da máquina deve ser preenchido."
-#: install/index.php:215
+#: /var/www/fa2.3/devel/../install/index.php:221
msgid "Database user name cannot be empty."
msgstr "O nome do usuário do banco de dados deve ser preenchido."
-#: install/index.php:219
+#: /var/www/fa2.3/devel/../install/index.php:225
msgid "Database name cannot be empty."
msgstr "O nome do banco de dados deve ser preenchido."
-#: install/index.php:272
+#: /var/www/fa2.3/devel/../install/index.php:277
msgid "Company name cannot be empty."
msgstr "O nome da empresa deve ser preenchido."
-#: install/index.php:276
+#: /var/www/fa2.3/devel/../install/index.php:281
msgid "Company admin name cannot be empty."
msgstr "O nome do admin da empresa deve ser preenchido."
-#: install/index.php:280
+#: /var/www/fa2.3/devel/../install/index.php:285
msgid "Company admin password cannot be empty."
msgstr "A senha do admin da empresa deve ser preenchida."
-#: install/index.php:284
+#: /var/www/fa2.3/devel/../install/index.php:289
msgid "Company admin passwords differ."
msgstr "As senhas do administrador da empresa diferem"
-#: install/index.php:316
+#: /var/www/fa2.3/devel/../install/index.php:320
msgid "System Diagnostics"
msgstr "Diagnóstico do Sistema"
-#: install/index.php:318
+#: /var/www/fa2.3/devel/../install/index.php:323
msgid "Select install wizard language:"
msgstr "Selecione o idioma do assistente de instalação:"
-#: install/index.php:324
-msgid "All application preliminary requirements seems to be correct. Please press Continue button below."
-msgstr "Todos os requisitos de aplicação preliminar parece esta correto. Por favor pressione o botão Continuar."
-
-#: install/index.php:325
-#: install/index.php:351
-#: install/index.php:358
-#: install/index.php:365
-#: install/index.php:384
+#: /var/www/fa2.3/devel/../install/index.php:329
+msgid ""
+"All application preliminary requirements seems to be correct. Please press "
+"Continue button below."
+msgstr ""
+"Todos os requisitos de aplicação preliminar parece esta correto. Por favor "
+"pressione o botão Continuar."
+
+#: /var/www/fa2.3/devel/../install/index.php:330
+#: /var/www/fa2.3/devel/../install/index.php:356
+#: /var/www/fa2.3/devel/../install/index.php:363
+#: /var/www/fa2.3/devel/../install/index.php:370
+#: /var/www/fa2.3/devel/../install/index.php:389
msgid "Continue >>"
msgstr "Continuar >>"
-#: install/index.php:327
-msgid "Application cannot be installed. Please fix problems listed below in red, and press Refresh button."
-msgstr "O aplicativo não pode ser instalad0. Por favor corrija os problemas listados abaixo em vermelho, e pressione o botão Atualizar."
+#: /var/www/fa2.3/devel/../install/index.php:332
+msgid ""
+"Application cannot be installed. Please fix problems listed below in red, "
+"and press Refresh button."
+msgstr ""
+"O aplicativo não pode ser instalad0. Por favor corrija os problemas listados abaixo em vermelho, "
+"e pressione o botão Atualizar."
-#: install/index.php:328
+#: /var/www/fa2.3/devel/../install/index.php:333
msgid "Refresh"
msgstr "Atualizar"
-#: install/index.php:338
+#: /var/www/fa2.3/devel/../install/index.php:343
msgid "Database Server Settings"
msgstr "Configuração do Banco de Dados"
-#: install/index.php:340
+#: /var/www/fa2.3/devel/../install/index.php:345
msgid "Server Host:"
msgstr "Servidor do Banco de Dados:"
-#: install/index.php:341
+#: /var/www/fa2.3/devel/../install/index.php:346
msgid "Database User:"
msgstr "Usuário do Banco de Dados:"
-#: install/index.php:342
+#: /var/www/fa2.3/devel/../install/index.php:347
msgid "Database Password:"
msgstr "Senha do Banco de Dados:"
-#: install/index.php:343
+#: /var/www/fa2.3/devel/../install/index.php:348
msgid "Database Name:"
msgstr "Nome do Banco de Dados:"
-#: install/index.php:344
+#: /var/www/fa2.3/devel/../install/index.php:349
msgid "Use '0_' Table Prefix:"
msgstr "Usar Prefixo de Tabela '0_':"
-#: install/index.php:344
-#: includes/system_tests.inc:38
-#: includes/system_tests.inc:113
-#: includes/system_tests.inc:126
+#: /var/www/fa2.3/devel/../install/index.php:349
+#: /var/www/fa2.3/devel/../includes/system_tests.inc:38
+#: /var/www/fa2.3/devel/../includes/system_tests.inc:113
+#: /var/www/fa2.3/devel/../includes/system_tests.inc:126
msgid "Yes"
msgstr "Sim"
-#: install/index.php:344
-#: includes/system_tests.inc:38
-#: includes/system_tests.inc:113
-#: includes/system_tests.inc:126
+#: /var/www/fa2.3/devel/../install/index.php:349
+#: /var/www/fa2.3/devel/../includes/system_tests.inc:38
+#: /var/www/fa2.3/devel/../includes/system_tests.inc:113
+#: /var/www/fa2.3/devel/../includes/system_tests.inc:126
msgid "No"
msgstr "Não"
-#: install/index.php:345
+#: /var/www/fa2.3/devel/../install/index.php:350
msgid "Install Additional Language Packs from FA Repository:"
msgstr "Instalar Suporte de Idiomas Adicionais do Repositório do FA:"
-#: install/index.php:346
+#: /var/www/fa2.3/devel/../install/index.php:351
msgid "Install Additional COAs from FA Repository:"
msgstr "Instalar Plano de Contas do Repositório do FA:"
-#: install/index.php:348
-msgid "Use table prefix if you share selected database for more than one FA company."
-msgstr "Use o prefixo da tabela se você for utilizar o banco de dados para mais de uma empresa."
+#: /var/www/fa2.3/devel/../install/index.php:353
+msgid ""
+"Use table prefix if you share selected database for more than one FA company."
+msgstr ""
+"Use o prefixo da tabela se você for utilizar o banco de dados para mais de uma empresa."
-#: install/index.php:349
-msgid "Do not select additional langs nor COAs if you have no working internet connection right now. You can install them later."
-msgstr "Não selecione Idiomas Adicionais nem Plano de Contas se você não tem uma conexão com a internet agora. Você poderá instalar mais tarde."
+#: /var/www/fa2.3/devel/../install/index.php:354
+msgid ""
+"Do not select additional langs nor COAs if you have no working internet "
+"connection right now. You can install them later."
+msgstr ""
+"Não selecione Idiomas Adicionais nem Plano de Contas se você não tem uma "
+"conexão com a internet agora. Você poderá instalar mais tarde."
-#: install/index.php:350
-#: install/index.php:357
-#: install/index.php:364
-#: install/index.php:383
+#: /var/www/fa2.3/devel/../install/index.php:355
+#: /var/www/fa2.3/devel/../install/index.php:362
+#: /var/www/fa2.3/devel/../install/index.php:369
+#: /var/www/fa2.3/devel/../install/index.php:388
msgid "<< Back"
msgstr "<< Voltar"
-#: install/index.php:355
+#: /var/www/fa2.3/devel/../install/index.php:360
msgid "User Interface Languages Selection"
msgstr "Seleção da Idioma da Interface"
-#: install/index.php:362
+#: /var/www/fa2.3/devel/../install/index.php:367
msgid "Charts of Accounts Selection"
msgstr "Seleção do Plano de Contas"
-#: install/index.php:374
+#: /var/www/fa2.3/devel/../install/index.php:379
msgid "Company Settings"
msgstr "Configuração da Empresa"
-#: install/index.php:376
+#: /var/www/fa2.3/devel/../install/index.php:381
msgid "Company Name:"
msgstr "Nome da Empresa:"
-#: install/index.php:377
+#: /var/www/fa2.3/devel/../install/index.php:382
msgid "Admin Login:"
msgstr "Login do Administrador:"
-#: install/index.php:378
+#: /var/www/fa2.3/devel/../install/index.php:383
msgid "Admin Password:"
msgstr "Senha do Administrador:"
-#: install/index.php:379
+#: /var/www/fa2.3/devel/../install/index.php:384
msgid "Reenter Password:"
msgstr "Digitar a Senha Novamente:"
-#: install/index.php:380
+#: /var/www/fa2.3/devel/../install/index.php:385
msgid "Select Chart of Accounts:"
msgstr "Selecionar Plano de Contas:"
-#: install/index.php:381
+#: /var/www/fa2.3/devel/../install/index.php:386
msgid "Select Default Language:"
msgstr "Selecionar Idioma Padrão:"
-#: install/index.php:388
+#: /var/www/fa2.3/devel/../install/index.php:393
msgid "FrontAccounting ERP has been installed successsfully."
msgstr "O FrontAccounting ERP foi instalado com sucesso."
-#: install/index.php:389
+#: /var/www/fa2.3/devel/../install/index.php:394
msgid "Please do not forget to remove install wizard folder."
msgstr "Por favor não se esqueça de remover a pasta de instalação do assistente."
-#: install/index.php:392
+#: /var/www/fa2.3/devel/../install/index.php:396
msgid "Click here to start."
msgstr "Clique aqui para iniciar."
-#: includes/system_tests.inc:15
+#: /var/www/fa2.3/devel/../includes/system_tests.inc:15
msgid "Info"
msgstr "Info"
-#: includes/system_tests.inc:16
+#: /var/www/fa2.3/devel/../includes/system_tests.inc:16
msgid "Optional"
msgstr "Opcional"
-#: includes/system_tests.inc:17
-#, fuzzy
-msgid "Recommended"
+#: /var/www/fa2.3/devel/../includes/system_tests.inc:17
+msgid "Recomended"
msgstr "Recomendado"
-#: includes/system_tests.inc:18
+#: /var/www/fa2.3/devel/../includes/system_tests.inc:18
msgid "Required "
msgstr "Requerido "
-#: includes/system_tests.inc:24
+#: /var/www/fa2.3/devel/../includes/system_tests.inc:24
msgid "MySQL version"
msgstr "Versão do MySQL"
-#: includes/system_tests.inc:28
+#: /var/www/fa2.3/devel/../includes/system_tests.inc:28
msgid "Upgrade MySQL server to version at least 4.1"
msgstr "Atualize o servidor MySQL para versão 4.1 ou superior"
-#: includes/system_tests.inc:35
+#: /var/www/fa2.3/devel/../includes/system_tests.inc:35
msgid "PHP MySQL extension"
msgstr "Extensão PHP MySQL"
-#: includes/system_tests.inc:40
+#: /var/www/fa2.3/devel/../includes/system_tests.inc:40
msgid "Your PHP has to have MySQL extension enabled."
msgstr "Seu PHP deve ter extensão de MySQL habilitada."
-#: includes/system_tests.inc:46
+#: /var/www/fa2.3/devel/../includes/system_tests.inc:46
msgid "PHP version"
msgstr "Versão do PHP"
-#: includes/system_tests.inc:50
+#: /var/www/fa2.3/devel/../includes/system_tests.inc:50
msgid "Upgrade PHP to version at least 4.3.3"
msgstr "Atualize o PHP para versão 4.3.3 ou superior"
-#: includes/system_tests.inc:57
+#: /var/www/fa2.3/devel/../includes/system_tests.inc:57
msgid "Server system"
msgstr "Sistema do Servidor"
-#: includes/system_tests.inc:67
+#: /var/www/fa2.3/devel/../includes/system_tests.inc:67
msgid "Session save path"
msgstr "Endereço de gravação da seção"
-#: includes/system_tests.inc:79
+#: /var/www/fa2.3/devel/../includes/system_tests.inc:79
msgid "Removed install wizard folder"
msgstr "Removida a pasta do assistente de instalação"
-#: includes/system_tests.inc:82
+#: /var/www/fa2.3/devel/../includes/system_tests.inc:82
msgid "Not removed"
msgstr "Não removido"
-#: includes/system_tests.inc:83
+#: /var/www/fa2.3/devel/../includes/system_tests.inc:83
msgid "Remove or rename install wizard folder for security reasons."
msgstr "Remover ou renomear a pasta do assistente de instalação por motivos de segurança."
-#: includes/system_tests.inc:90
+#: /var/www/fa2.3/devel/../includes/system_tests.inc:90
msgid "Browser type"
msgstr "Tipo do navegador"
-#: includes/system_tests.inc:94
+#: /var/www/fa2.3/devel/../includes/system_tests.inc:94
msgid "Any browser is supported"
msgstr "Qualquer navegador é compatível"
-#: includes/system_tests.inc:101
+#: /var/www/fa2.3/devel/../includes/system_tests.inc:101
msgid "Http server type"
msgstr "Tipo de servidor Http"
-#: includes/system_tests.inc:105
+#: /var/www/fa2.3/devel/../includes/system_tests.inc:105
msgid "Any server is supported"
msgstr "Qualquer servidor é compatível"
-#: includes/system_tests.inc:112
+#: /var/www/fa2.3/devel/../includes/system_tests.inc:112
msgid "Native gettext"
msgstr "gettext nativo"
-#: includes/system_tests.inc:116
-#, fuzzy
-msgid "In case of no gettext support, php emulation is used"
+#: /var/www/fa2.3/devel/../includes/system_tests.inc:116
+msgid "In case of no getext support, php emulation is used"
msgstr "Na falta de suporte getext, a emulação php será usada"
-#: includes/system_tests.inc:124
+#: /var/www/fa2.3/devel/../includes/system_tests.inc:124
msgid "Debugging mode"
msgstr "Modo de depuração (debug)"
-#: includes/system_tests.inc:128
+#: /var/www/fa2.3/devel/../includes/system_tests.inc:128
msgid "To switch debugging on set $go_debug>0 in config.php file"
msgstr "Para ativar depuração (debug) inclua $go_debug>0 no arquivo config.php"
-#: includes/system_tests.inc:137
+#: /var/www/fa2.3/devel/../includes/system_tests.inc:137
msgid "Error logging"
msgstr "Log de erros"
-#: includes/system_tests.inc:145
+#: /var/www/fa2.3/devel/../includes/system_tests.inc:145
msgid "Disabled"
msgstr "Desabilitado"
-#: includes/system_tests.inc:148
+#: /var/www/fa2.3/devel/../includes/system_tests.inc:148
msgid "To switch error logging set $error_logging in config.php file"
msgstr "Para logar erros inclua $error_logging no arquivo config.php"
-#: includes/system_tests.inc:151
+#: /var/www/fa2.3/devel/../includes/system_tests.inc:151
msgid "Log file is not writeable"
msgstr "Arquivo de log não é gravável"
-#: includes/system_tests.inc:161
+#: /var/www/fa2.3/devel/../includes/system_tests.inc:161
msgid "Current database version"
msgstr "Versão do banco de dados atual"
-#: includes/system_tests.inc:165
+#: /var/www/fa2.3/devel/../includes/system_tests.inc:165
msgid "Database structure seems to be not upgraded to current version"
msgstr "A estrutura do banco de dados não foi atualizada para a versão atual"
-#: includes/system_tests.inc:180
+#: /var/www/fa2.3/devel/../includes/system_tests.inc:180
msgid "Company subdirectories consistency"
msgstr "Consistência de subdiretórios da empresa"
-#: includes/system_tests.inc:193
-#: includes/system_tests.inc:200
-#: includes/system_tests.inc:208
-#: includes/system_tests.inc:225
-#: includes/system_tests.inc:340
-#: includes/system_tests.inc:349
-#: includes/system_tests.inc:358
+#: /var/www/fa2.3/devel/../includes/system_tests.inc:193
+#: /var/www/fa2.3/devel/../includes/system_tests.inc:200
+#: /var/www/fa2.3/devel/../includes/system_tests.inc:208
+#: /var/www/fa2.3/devel/../includes/system_tests.inc:225
+#: /var/www/fa2.3/devel/../includes/system_tests.inc:345
#, php-format
msgid "'%s' is not writeable"
msgstr "'%s' não é gravável"
-#: includes/system_tests.inc:221
+#: /var/www/fa2.3/devel/../includes/system_tests.inc:221
msgid "Temporary directory"
msgstr "Diretório temporário"
-#: includes/system_tests.inc:233
+#: /var/www/fa2.3/devel/../includes/system_tests.inc:233
msgid "Language configuration consistency"
msgstr "Consistência de configuração de idioma"
-#: includes/system_tests.inc:242
+#: /var/www/fa2.3/devel/../includes/system_tests.inc:242
msgid "Languages folder should be writeable."
msgstr "Diretório de idiomas deveria ser gravável."
-#: includes/system_tests.inc:251
+#: /var/www/fa2.3/devel/../includes/system_tests.inc:250
msgid "Languages configuration file should be writeable."
msgstr "O arquivo de configuração de idiomas deve ser gravável."
-#: includes/system_tests.inc:270
+#: /var/www/fa2.3/devel/../includes/system_tests.inc:268
#, php-format
msgid "Missing %s translation file."
msgstr "Falta o arquivo de tradução %s."
-#: includes/system_tests.inc:275
+#: /var/www/fa2.3/devel/../includes/system_tests.inc:273
#, php-format
msgid "Missing system locale: %s"
msgstr "Falta localidade (locale) do sistema: %s"
-#: includes/system_tests.inc:288
+#: /var/www/fa2.3/devel/../includes/system_tests.inc:286
msgid "Main config file"
msgstr "Arquivo de configuração principal"
-#: includes/system_tests.inc:295
-#: includes/system_tests.inc:317
+#: /var/www/fa2.3/devel/../includes/system_tests.inc:293
+#: /var/www/fa2.3/devel/../includes/system_tests.inc:315
#, php-format
msgid "Can't write '%s' file. Check FA directory write permissions."
msgstr "Não é possível escrever no arquivo '%s'. Verifique a permissõe de escrita do diretório FA"
-#: includes/system_tests.inc:296
-#: includes/system_tests.inc:318
+#: /var/www/fa2.3/devel/../includes/system_tests.inc:294
+#: /var/www/fa2.3/devel/../includes/system_tests.inc:316
#, php-format
msgid "'%s' file exists."
msgstr "O arquivo '%s' existente."
-#: includes/system_tests.inc:300
+#: /var/www/fa2.3/devel/../includes/system_tests.inc:298
#, php-format
msgid "'%s' file should be read-only"
msgstr "O arquivo '%s' deve ser somente leitura"
-#: includes/system_tests.inc:309
+#: /var/www/fa2.3/devel/../includes/system_tests.inc:307
msgid "Database auth file"
msgstr "Arquivo de autorização da base de dados"
-#: includes/system_tests.inc:322
+#: /var/www/fa2.3/devel/../includes/system_tests.inc:320
#, php-format
-msgid "'%s' file should be read-only if you do not plan to add or change companies"
-msgstr "O arquivo '%s' deve ser somente leitura se você não planeja adicionar ou alterar empresas"
+msgid ""
+"'%s' file should be read-only if you do not plan to add or change companies"
+msgstr ""
+"O arquivo '%s' deve ser somente leitura se você não planeja adicionar ou alterar empresas"
-#: includes/system_tests.inc:333
+#: /var/www/fa2.3/devel/../includes/system_tests.inc:331
msgid "Extensions system"
msgstr "Sistema de extensões"
-#: includes/system_tests.inc:363
+#: /var/www/fa2.3/devel/../includes/system_tests.inc:366
msgid "Extensions configuration files and directories should be writeable"
msgstr "Extensões de arquivos de configuração e diretórios devem ser graváveis"
-#: includes/system_tests.inc:375
+#: /var/www/fa2.3/devel/../includes/system_tests.inc:378
#, php-format
msgid "Non-standard theme directory '%s' is not writable"
msgstr "Descrição de diretório sem-padrão '%s' não é gravável"
-#: includes/system_tests.inc:385
-msgid "OpenSSL PHP extension have to be enabled to use extension repository system."
-msgstr "A extensão OpenSSL PHP tem que estar habilitada para usar o repositório de extensão."
+#: /var/www/fa2.3/devel/../includes/system_tests.inc:388
+msgid ""
+"OpenSSL PHP extension have to be enabled to use extension repository system."
+msgstr ""
+"A extensão OpenSSL PHP tem que estar habilitada para usar o repositório de extensão."
-#: includes/system_tests.inc:388
-msgid "OpenSSL have to be available on your server to use extension repository system."
-msgstr "OpenSSL deve estar disponível no seu servidor para utilizar o repositório de extensão."
+#: /var/www/fa2.3/devel/../includes/system_tests.inc:391
+msgid ""
+"OpenSSL have to be available on your server to use extension repository "
+"system."
+msgstr ""
+"OpenSSL deve estar disponível no seu servidor para utilizar o repositório "
+"de extensão."
-#: includes/system_tests.inc:411
+#: /var/www/fa2.3/devel/../includes/system_tests.inc:414
msgid "Test"
msgstr "Teste"
-#: includes/system_tests.inc:411
+#: /var/www/fa2.3/devel/../includes/system_tests.inc:414
msgid "Test type"
msgstr "Tipo de teste"
-#: includes/system_tests.inc:411
+#: /var/www/fa2.3/devel/../includes/system_tests.inc:414
msgid "Value"
msgstr "Valor"
-#: includes/system_tests.inc:411
+#: /var/www/fa2.3/devel/../includes/system_tests.inc:414
msgid "Comments"
msgstr "Comentários"
-#: includes/system_tests.inc:435
+#: /var/www/fa2.3/devel/../includes/system_tests.inc:438
msgid "Ok"
msgstr "Ok"
-
-#: includes/packages.inc:190
-#, php-format
-msgid "No key field '%s' in file '%s'"
-msgstr ""
-
-#: includes/packages.inc:295
-msgid "Release file in repository is invalid, or public key is outdated."
-msgstr ""
-
-#: includes/packages.inc:311
-msgid "Repository version does not match application version."
-msgstr ""
-
-#: includes/packages.inc:325
-#, php-format
-msgid "Security alert: broken index file in repository '%s'. Please inform repository administrator about this issue."
-msgstr ""
-
-#: includes/packages.inc:358
-#, php-format
-msgid "Security alert: broken package '%s' in repository. Please inform repository administrator about this issue."
-msgstr ""
-
-#: includes/packages.inc:613
-#: includes/packages.inc:664
-#, php-format
-msgid "Package '%s' not found."
-msgstr ""
-
}
elseif (!is_date_in_fiscalyear($_POST['AdjDate']))
{
- display_error(_("The entered date is not in fiscal year."));
+ display_error(_("The entered date is out of fiscal year or is closed for further data entry."));
set_focus('AdjDate');
return false;
} else {
{
$old_cost = get_standard_cost($_POST['stock_id']);
-
+
$new_cost = input_num('material_cost') + input_num('labour_cost')
+ input_num('overhead_cost');
{
$new_cost = $material_cost + $labour_cost + $overhead_cost;
+ $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(ST_COSTUPDATE, $update_no, $date_, $stock_gl_code["adjustment_account"],
+ $stock_gl_code["dimension_id"], $stock_gl_code["dimension2_id"], $memo_, (-$value_of_change));
+
$value_of_change = round2($qoh * ($new_cost - $last_cost), user_price_dec());
if ($value_of_change != 0)
add_gl_trans_std_cost(ST_COSTUPDATE, $update_no, $date_, $stock_gl_code["inventory_account"], 0, 0, $memo_,
$value_of_change);
- }
+ }
}
add_audit_trail(ST_COSTUPDATE, $update_no, $date_);
include_once($path_to_root . "/sales/includes/sales_db.inc");
include_once($path_to_root . "/includes/ui.inc");
-if (!@$_GET['popup'])
-{
- $js = "";
- if ($use_popup_windows)
- $js .= get_js_open_window(800, 500);
- if ($use_date_picker)
- $js .= get_js_date_picker();
- page(_($help_context = "Inventory Item Movement"), @$_GET['popup'], false, "", $js);
-}
+$js = "";
+if ($use_popup_windows)
+ $js .= get_js_open_window(800, 500);
+if ($use_date_picker)
+ $js .= get_js_date_picker();
+page(_($help_context = "Inventory Item Movement"), @$_GET['popup'], false, "", $js);
//------------------------------------------------------------------------------------------------
check_db_has_stock_items(_("There are no items defined in the system."));
$_POST['stock_id'] = $_GET['stock_id'];
}
-if (!@$_GET['popup'])
- start_form();
+start_form();
if (!isset($_POST['stock_id']))
$_POST['stock_id'] = get_global_stock_item();
start_table(TABLESTYLE_NOBORDER);
start_row();
-if (!@$_GET['popup'])
+if (!$page_nested)
stock_costable_items_list_cells(_("Item:"), 'stock_id', $_POST['stock_id']);
end_row();
end_table();
end_table(1);
div_end();
-if (!@$_GET['popup'])
- end_page(@$_GET['popup'], false, false);
+end_page();
?>
$path_to_root = "../..";
include_once($path_to_root . "/includes/session.inc");
-if (!@$_GET['popup'])
-{
- if (isset($_GET['stock_id'])){
- page(_($help_context = "Inventory Item Status"), true);
- } else {
- page(_($help_context = "Inventory Item Status"));
- }
-}
+page(_($help_context = "Inventory Item Status"));
+
if (isset($_GET['stock_id']))
$_POST['stock_id'] = $_GET['stock_id'];
+
include_once($path_to_root . "/includes/date_functions.inc");
include_once($path_to_root . "/includes/ui.inc");
include_once($path_to_root . "/includes/manufacturing.inc");
check_db_has_stock_items(_("There are no items defined in the system."));
-if (!@$_GET['popup'])
- start_form();
+start_form();
if (!isset($_POST['stock_id']))
$_POST['stock_id'] = get_global_stock_item();
-if (!@$_GET['popup'])
+if (!$page_nested)
{
echo "<center> " . _("Item:"). " ";
echo stock_costable_items_list('stock_id', $_POST['stock_id'], false, true);
-}
+}
echo "<br>";
echo "<hr></center>";
end_table();
div_end();
-if (!@$_GET['popup'])
-{
- end_form();
- end_page(@$_GET['popup'], false, false);
-}
+end_form();
+end_page();
?>
$page_security = 'SA_ITEM';
$path_to_root = "../..";
include($path_to_root . "/includes/session.inc");
+
$js = "";
if ($use_popup_windows)
$js .= get_js_open_window(900, 500);
if ($use_date_picker)
$js .= get_js_date_picker();
-page(_($help_context = "Items"), false, false, "", $js);
+page(_($help_context = "Items"), @$_REQUEST['popup'], false, "", $js);
+
include_once($path_to_root . "/includes/date_functions.inc");
include_once($path_to_root . "/includes/ui.inc");
display_warning(_('The file size is over the maximum allowed. The maximum size allowed in KB is') . ' ' . $max_image_size);
$upload_file ='No';
}
+ elseif ( $_FILES['pic']['type'] == "text/plain" )
+ { //File type Check
+ display_warning( _('Only graphics files can be uploaded'));
+ $upload_file ='No';
+ }
elseif (file_exists($filename))
{
$result = unlink($filename);
div_end();
-
hidden('popup', @$_REQUEST['popup']);
end_form();
}
elseif (!is_date_in_fiscalyear($_POST['AdjDate']))
{
- display_error(_("The entered date is not in fiscal year."));
+ display_error(_("The entered date is out of fiscal year or is closed for further data entry."));
set_focus('AdjDate');
$input_error = 1;
}
--- /dev/null
+<?php
+/**********************************************************************
+ Copyright (C) FrontAccounting, LLC.
+ Released under the terms of the GNU General Public License, GPL,
+ as published by the Free Software Foundation, either version 3
+ of the License, or (at your option) any later version.
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ See the License here <http://www.gnu.org/licenses/gpl-3.0.html>.
+***********************************************************************/
+
+function add_wo_costing($workorder_id, $cost_type, $trans_type, $trans_no, $factor=1)
+{
+ $sql = "INSERT INTO ".TB_PREF."wo_costing (workorder_id, cost_type, trans_type, trans_no, factor)
+ VALUES (".db_escape($workorder_id).","
+ .db_escape($cost_type).",".db_escape($trans_type).","
+ .db_escape($trans_no).",".db_escape($factor).")";
+
+ db_query($sql, "could not add work order costing");
+
+}
+
+function get_wo_costing($workorder_id)
+{
+ $sql="SELECT * FROM ".TB_PREF."wo_costing WHERE workorder_id=".db_escape($workorder_id);
+
+ return db_query($sql, "could not get work order costing");
+}
+
+function delete_wo_costing($trans_type, $trans_no)
+{
+ $sql="DELETE FROM ".TB_PREF."wo_costing WHERE trans_type=".db_escape($trans_type)
+ ." AND trans_no=".db_escape($trans_no);
+
+ db_query($sql, "could not delete work order costing");
+}
+
+//--------------------------------------------------------------------------------------
+
+function add_material_cost($stock_id, $qty, $date_)
+{
+ $m_cost = 0;
+ $result = get_bom($stock_id);
+ while ($bom_item = db_fetch($result))
+ {
+ $standard_cost = get_standard_cost($bom_item['component']);
+ $m_cost += ($bom_item['quantity'] * $standard_cost);
+ }
+ //$dec = user_price_dec();
+ //price_decimal_format($m_cost, $dec);
+ $sql = "SELECT material_cost FROM ".TB_PREF."stock_master WHERE stock_id = "
+ .db_escape($stock_id);
+ $result = db_query($sql);
+ $myrow = db_fetch($result);
+ $material_cost = $myrow['material_cost'];
+ //$qoh = get_qoh_on_date($stock_id, null, $date_);
+ $qoh = get_qoh_on_date($stock_id);
+ if ($qoh < 0)
+ $qoh = 0;
+ if ($qoh + $qty != 0)
+ $material_cost = ($qoh * $material_cost + $qty * $m_cost) / ($qoh + $qty);
+ //$material_cost = round2($material_cost, $dec);
+ $sql = "UPDATE ".TB_PREF."stock_master SET material_cost=$material_cost
+ WHERE stock_id=".db_escape($stock_id);
+ db_query($sql,"The cost details for the inventory item could not be updated");
+}
+
+function add_overhead_cost($stock_id, $qty, $date_, $costs)
+{
+ //$dec = user_price_dec();
+ //price_decimal_format($costs, $dec);
+ if ($qty != 0)
+ $costs /= $qty;
+ $sql = "SELECT overhead_cost FROM ".TB_PREF."stock_master WHERE stock_id = "
+ .db_escape($stock_id);
+ $result = db_query($sql);
+ $myrow = db_fetch($result);
+ $overhead_cost = $myrow['overhead_cost'];
+ //$qoh = get_qoh_on_date($stock_id, null, $date_);
+ $qoh = get_qoh_on_date($stock_id);
+ if ($qoh < 0)
+ $qoh = 0;
+ if ($qoh + $qty != 0)
+ $overhead_cost = ($qoh * $overhead_cost + $qty * $costs) / ($qoh + $qty);
+ //$overhead_cost = round2($overhead_cost, $dec);
+ $sql = "UPDATE ".TB_PREF."stock_master SET overhead_cost=".db_escape($overhead_cost)."
+ WHERE stock_id=".db_escape($stock_id);
+ db_query($sql,"The cost details for the inventory item could not be updated");
+}
+
+function add_labour_cost($stock_id, $qty, $date_, $costs)
+{
+ //$dec = user_price_dec();
+ //price_decimal_format($costs, $dec);
+ if ($qty != 0)
+ $costs /= $qty;
+ $sql = "SELECT labour_cost FROM ".TB_PREF."stock_master WHERE stock_id = "
+ .db_escape($stock_id);
+ $result = db_query($sql);
+ $myrow = db_fetch($result);
+ $labour_cost = $myrow['labour_cost'];
+ //$qoh = get_qoh_on_date($stock_id, null, $date_);
+ $qoh = get_qoh_on_date($stock_id);
+ if ($qoh < 0)
+ $qoh = 0;
+ if ($qoh + $qty != 0)
+ $labour_cost = ($qoh * $labour_cost + $qty * $costs) / ($qoh + $qty);
+ //$labour_cost = round2($labour_cost, $dec);
+ $sql = "UPDATE ".TB_PREF."stock_master SET labour_cost=".db_escape($labour_cost)."
+ WHERE stock_id=".db_escape($stock_id);
+ db_query($sql,"The cost details for the inventory item could not be updated");
+}
+
+function add_issue_cost($stock_id, $qty, $date_, $costs)
+{
+ if ($qty != 0)
+ $costs /= $qty;
+ $sql = "SELECT material_cost FROM ".TB_PREF."stock_master WHERE stock_id = "
+ .db_escape($stock_id);
+ $result = db_query($sql);
+ $myrow = db_fetch($result);
+ $material_cost = $myrow['material_cost'];
+ //$dec = user_price_dec();
+ //price_decimal_format($material_cost, $dec);
+ //$qoh = get_qoh_on_date($stock_id, null, $date_);
+ $qoh = get_qoh_on_date($stock_id);
+ if ($qoh < 0)
+ $qoh = 0;
+ if ($qoh + $qty != 0)
+ $material_cost = ($qty * $costs) / ($qoh + $qty);
+ //$material_cost = round2($material_cost, $dec);
+ $sql = "UPDATE ".TB_PREF."stock_master SET material_cost=material_cost+"
+ .db_escape($material_cost)
+ ." WHERE stock_id=".db_escape($stock_id);
+ db_query($sql,"The cost details for the inventory item could not be updated");
+}
+
+/*
+ Create journal entry for WO related costs.
+*/
+function add_wo_costs_journal($wo_id, $amount, $cost_type, $cr_acc, $db_acc, $date, $dim1=0, $dim2=0, $memo = null, $ref= null)
+{
+//-------- this should be done by single call to write_journal_entries() using items_cart()
+//
+ global $Refs, $wo_cost_types;
+
+ begin_transaction();
+
+ $journal_id = get_next_trans_no(ST_JOURNAL);
+ if (!$ref) $ref = $Refs->get_next(ST_JOURNAL);
+
+ add_gl_trans_std_cost(ST_JOURNAL, $journal_id, $date, $cr_acc,
+ 0, 0, $wo_cost_types[$cost_type], -$amount);
+ $is_bank_to = is_bank_account($cr_acc);
+ if ($is_bank_to)
+ {
+ add_bank_trans(ST_JOURNAL, $journal_id, $is_bank_to, "",
+ $date, -$amount, PT_WORKORDER, $wo_id, get_company_currency(),
+ "Cannot insert a destination bank transaction");
+ }
+
+ add_gl_trans_std_cost(ST_JOURNAL, $journal_id, $date, $db_acc,
+ $dim1, $dim2, $wo_cost_types[$cost_type], $amount);
+
+ $Refs->save(ST_JOURNAL, $journal_id, $ref);
+
+ add_wo_costing($wo_id, $cost_type, ST_JOURNAL, $journal_id);
+
+ add_comments(ST_JOURNAL, $journal_id, $date, $memo);
+ add_audit_trail(ST_JOURNAL, $journal_id, $date);
+
+ commit_transaction();
+}
+
+function void_wo_costing($wo_id)
+{
+ $res = get_wo_costing($wo_id);
+
+ while($row = db_fetch($res))
+ {
+ // void any related gl trans
+ void_gl_trans($row['trans_type'], $row['trans_no'], true);
+ }
+
+ $sql = "DELETE FROM ".TB_PREF."wo_costing WHERE workorder_id=".db_escape($wo_id);
+ db_query($sql, "could not delete work order costing");
+}
$issue_cost = $standard_cost * $item->quantity;
$issue = get_stock_gl_code($item->stock_id);
$stockitem = get_item($item->stock_id);
-
+
//Chaitanya : Compatibility for Service Items
if (!is_service($issue["mb_flag"]))
$ivaccount = $issue["inventory_account"];
else
$ivaccount = $issue["cogs_account"];
-
+
$total_cost += add_gl_trans_std_cost(ST_WORKORDER, $woid, $date_, $ivaccount, 0, 0,
$date_.": "._("Issue of")." ".$stockitem["description"], -$issue_cost);
$issue_total += $issue_cost;
{
begin_transaction();
hook_db_prevoid(ST_MANUISSUE, $type_no);
-
+
//Chaitanya : Skip processing already voided entry i.e. explicitly voided
$void_entry = get_voided_entry(ST_MANUISSUE, $type_no);
if ($void_entry)
$manf_stock_id = $issue["stock_id"];
$date_ = sql2date($issue["issue_date"]);
$woid = $issue["workorder_id"];
-
+
$result = get_stock_moves(ST_MANUISSUE, $type_no);
$total_cost = 0;
$issue_total = 0;
$issue_cost = $myrow["qty"]*$myrow["standard_cost"];
$issue = get_stock_gl_code($myrow["stock_id"]);
$stockitem = get_item($myrow["stock_id"]);
-
+
//Chaitanya : Compatibility for Service Items
if (!is_service($issue["mb_flag"]))
$ivaccount = $issue["inventory_account"];
else
- $ivaccount = $issue["cogs_account"];
-
+ $ivaccount = $issue["cogs_account"];
+
if ($issue_cost != 0)
{
$total_cost += add_gl_trans_std_cost(ST_WORKORDER, $woid, $date_, $ivaccount, 0, 0,
$date_.": "._("Reversed the issue of")." ".$stockitem["description"],
- -$issue_cost);
+ -$issue_cost);
$issue_total += $issue_cost;
}
}
add_gl_trans_std_cost(ST_WORKORDER, $woid, $date_, $issue["inventory_account"],
0, 0, $date_.": "._("Reversed the issue to")." ".$stockitem["description"],
-$total_cost);
-
+
//Chaitanya : Shifted below void all related stock moves
void_stock_move(ST_MANUISSUE, $type_no);
-
+
commit_transaction();
}
db_query($sql,"A work order manufacture could not be added");
$id = db_insert_id();
-
+
// -------------------------------------------------------------------------
work_order_quick_costs($woid, $details["stock_id"], $quantity, $date_, $id);
-
// -------------------------------------------------------------------------
// Chaitanya: stamp BOM cost to finished item
{
$standard_cost = get_standard_cost($bom_item['component']);
$m_cost += ($bom_item['quantity'] * $standard_cost);
- }
+ }
// insert a +ve stock move for the item being manufactured
// negative means "unproduce" or unassemble
{
begin_transaction();
hook_db_prevoid(ST_MANURECEIVE, $type_no);
-
+
//Chaitanya : Skip processing already voided entry i.e. explicitly voided
$void_entry = get_voided_entry(ST_MANURECEIVE, $type_no);
if ($void_entry)
$issue_cost = $myrow["qty"]*$myrow["standard_cost"];
$issue = get_stock_gl_code($myrow["stock_id"]);
$stockitem = get_item($myrow["stock_id"]);
-
+
//Chaitanya : Compatibility for Service Items
if (!is_service($issue["mb_flag"]))
$ivaccount = $issue["inventory_account"];
else
- $ivaccount = $issue["cogs_account"];
-
+ $ivaccount = $issue["cogs_account"];
+
if ($issue_cost != 0)
{
add_gl_trans_std_cost(ST_WORKORDER, $woid, $date_, $ivaccount, 0, 0,
$date_.": "._("Reversed the production ")." ".$stockitem["description"],
-$issue_cost);
}
- }
-
+ }
// clear the production record
$sql = "UPDATE ".TB_PREF."wo_manufacture SET quantity=0 WHERE id=".db_escape($type_no);
- db_query($sql, "Cannot void a wo production");
-
+ db_query($sql, "Cannot void a wo production");
+
//Chaitanya : Shifted below
// void all related stock moves
void_stock_move(ST_MANURECEIVE, $type_no);
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
See the License here <http://www.gnu.org/licenses/gpl-3.0.html>.
***********************************************************************/
-//--------------------------------------------------------------------------------------
-
-function add_material_cost($stock_id, $qty, $date_, $advanced=false)
-{
- $m_cost = 0;
- $result = get_bom($stock_id);
- while ($bom_item = db_fetch($result))
- {
- $standard_cost = get_standard_cost($bom_item['component']);
- $m_cost += ($bom_item['quantity'] * $standard_cost);
- }
- $bom_cost = $m_cost;
-
- $sql = "SELECT material_cost, labour_cost, overhead_cost FROM ".TB_PREF."stock_master WHERE stock_id = "
- .db_escape($stock_id);
- $result = db_query($sql);
- $myrow = db_fetch($result);
- $material_cost = $myrow['material_cost'];
-
- if ($advanced)
- {
- //reduce overhead_cost and labour_cost from price as those will remain as is
- $m_cost = $m_cost - $myrow['labour_cost'] - $myrow['overhead_cost'];
- }
-
- $qoh = get_qoh_on_date($stock_id);
- $cost_adjust = false;
- if ($qoh < 0)
- {
- if ($qoh + $qty >= 0)
- $cost_adjust = true;
- $qoh = 0;
- }
- if ($qoh + $qty != 0)
- $material_cost = ($qoh * $material_cost + $qty * $m_cost) / ($qoh + $qty);
-
- if ($advanced && $cost_adjust) // new 2010-02-10
- adjust_deliveries($stock_id, $bom_cost, $date_);
-
- $sql = "UPDATE ".TB_PREF."stock_master SET material_cost=".db_escape($material_cost)."
- WHERE stock_id=".db_escape($stock_id);
- db_query($sql,"The cost details for the inventory item could not be updated");
-}
-
-function add_overhead_cost($stock_id, $qty, $date_, $costs, $adj_only=false)
-{
- if ($qty != 0)
- $costs /= $qty;
- $sql = "SELECT overhead_cost FROM ".TB_PREF."stock_master WHERE stock_id = "
- .db_escape($stock_id);
- $result = db_query($sql);
- $myrow = db_fetch($result);
- $overhead_cost = $myrow['overhead_cost'];
- $qoh = get_qoh_on_date($stock_id);
- if ($qoh < 0)
- $qoh = 0;
- if ($adj_only)
- {
- if ($qty != 0)
- $costs = $qty * $costs;
- if ($qoh>0)
- $overhead_cost = ($qoh * $overhead_cost + $costs) / $qoh;
- else // Journal Entry if QOH is 0/negative \r
- {
- global $Refs;
-
- $id = get_next_trans_no(ST_JOURNAL);
- $ref = $Refs->get_next(ST_JOURNAL);
-
- $stock_gl_code = get_stock_gl_code($stock_id);
- $memo = "WO Overhead cost settlement JV for zero/negative respository of ".$stock_id;
- //Reverse the inventory effect if $qoh <=0
- add_gl_trans_std_cost(ST_JOURNAL, $id, $date_,
- $stock_gl_code["inventory_account"],
- $stock_gl_code['dimension_id'], $stock_gl_code['dimension2_id'], $memo,
- -$costs);
- //GL Posting to inventory adjustment account
- add_gl_trans_std_cost(ST_JOURNAL, $id, $date_,
- $stock_gl_code["adjustment_account"],
- $stock_gl_code['dimension_id'], $stock_gl_code['dimension2_id'], $memo,
- $costs);
-
- add_audit_trail(ST_JOURNAL, $id, $date_);
- add_comments(ST_JOURNAL, $id, $date_, $memo);
- $Refs->save(ST_JOURNAL, $id, $ref);
- }
- }
- else
- {
- if ($qoh + $qty != 0)
- $overhead_cost = ($qoh * $overhead_cost + $qty * $costs) / ($qoh + $qty);
- }
- $sql = "UPDATE ".TB_PREF."stock_master SET overhead_cost=".db_escape($overhead_cost)."
- WHERE stock_id=".db_escape($stock_id);
- db_query($sql,"The cost details for the inventory item could not be updated");
-}
-
-function add_labour_cost($stock_id, $qty, $date_, $costs, $adj_only=false)
-{
- if ($qty != 0)
- $costs /= $qty;
- $sql = "SELECT labour_cost FROM ".TB_PREF."stock_master WHERE stock_id = "
- .db_escape($stock_id);
- $result = db_query($sql);
- $myrow = db_fetch($result);
- $labour_cost = $myrow['labour_cost'];
- $qoh = get_qoh_on_date($stock_id);
- if ($qoh < 0)
- $qoh = 0;
- if ($adj_only)
- {
- if ($qty != 0)
- $costs = $qty * $costs;
- if ($qoh>0)
- $labour_cost = ($qoh * $labour_cost + $costs) / $qoh;
- else // Journal Entry if QOH is 0/negative \r
- {
- global $Refs;
-
- $id = get_next_trans_no(ST_JOURNAL);
- $ref = $Refs->get_next(ST_JOURNAL);
-
- $stock_gl_code = get_stock_gl_code($stock_id);
- $memo = "WO labour cost settlement JV for zero/negative respository of ".$stock_id;
- //Reverse the inventory effect if $qoh <=0
- add_gl_trans_std_cost(ST_JOURNAL, $id, $date_,
- $stock_gl_code["inventory_account"],
- $stock_gl_code['dimension_id'], $stock_gl_code['dimension2_id'], $memo,
- -$costs);
- //GL Posting to inventory adjustment account
- add_gl_trans_std_cost(ST_JOURNAL, $id, $date_,
- $stock_gl_code["adjustment_account"],
- $stock_gl_code['dimension_id'], $stock_gl_code['dimension2_id'], $memo,
- $costs);
-
- add_audit_trail(ST_JOURNAL, $id, $date_);
- add_comments(ST_JOURNAL, $id, $date_, $memo);
- $Refs->save(ST_JOURNAL, $id, $ref);
- }
- }
- else
- {
- if ($qoh + $qty != 0)
- $labour_cost = ($qoh * $labour_cost + $qty * $costs) / ($qoh + $qty);
- } \r
- $sql = "UPDATE ".TB_PREF."stock_master SET labour_cost=".db_escape($labour_cost)."
- WHERE stock_id=".db_escape($stock_id);
- db_query($sql,"The cost details for the inventory item could not be updated");
-}
-
-function add_issue_cost($stock_id, $qty, $date_, $costs, $adj_only=false)
-{
- if ($qty != 0)
- $costs /= $qty;
- $sql = "SELECT material_cost FROM ".TB_PREF."stock_master WHERE stock_id = "
- .db_escape($stock_id);
- $result = db_query($sql);
- $myrow = db_fetch($result);
- $material_cost = $myrow['material_cost'];
- $qoh = get_qoh_on_date($stock_id);
- if ($qoh < 0)
- $qoh = 0;
- if ($adj_only)
- {
- if ($qty != 0)
- $costs = $qty * $costs;
- if ($qoh>0)
- $material_cost = $costs / $qoh;
- else // Journal Entry if QOH is 0/negative\r
- {
- global $Refs;
-
- $id = get_next_trans_no(ST_JOURNAL);
- $ref = $Refs->get_next(ST_JOURNAL);
-
- $stock_gl_code = get_stock_gl_code($stock_id);
- $memo = "WO Issue settlement JV for zero/negative respository of ".$stock_id;
- //Reverse the inventory effect if $qoh <=0
- add_gl_trans_std_cost(ST_JOURNAL, $id, $date_,
- $stock_gl_code["inventory_account"],
- $stock_gl_code['dimension_id'], $stock_gl_code['dimension2_id'], $memo,
- -$costs);
- //GL Posting to inventory adjustment account
- add_gl_trans_std_cost(ST_JOURNAL, $id, $date_,
- $stock_gl_code["adjustment_account"],
- $stock_gl_code['dimension_id'], $stock_gl_code['dimension2_id'], $memo,
- $costs);
-
- add_audit_trail(ST_JOURNAL, $id, $date_);
- add_comments(ST_JOURNAL, $id, $date_, $memo);
- $Refs->save(ST_JOURNAL, $id, $ref);
- }
- }
- else
- {
- if ($qoh + $qty != 0)
- $material_cost = ($qty * $costs) / ($qoh + $qty);
- } \r
- $sql = "UPDATE ".TB_PREF."stock_master SET material_cost=material_cost+"
- .db_escape($material_cost)
- ." WHERE stock_id=".db_escape($stock_id);
- db_query($sql,"The cost details for the inventory item could not be updated");
-}
-
function add_work_order($wo_ref, $loc_code, $units_reqd, $stock_id,
$type, $date_, $required_by, $memo_, $costs, $cr_acc, $labour, $cr_lab_acc)
{
$args->woid = 0;
hook_db_prewrite($args, ST_WORKORDER);
+ add_material_cost($stock_id, $units_reqd, $date_);
+
$date = date2sql($date_);
$required = date2sql($required_by);
'date_', 'required_by', 'memo_'), $args);
hook_db_prewrite($args, ST_WORKORDER);
+ add_material_cost($_POST['old_stk_id'], -$_POST['old_qty'], $date_);
+ add_material_cost($stock_id, $units_reqd, $date_);
+
$date = date2sql($date_);
$required = date2sql($required_by);
begin_transaction();
hook_db_prevoid(ST_WORKORDER, $woid);
+ add_material_cost($_POST['stock_id'], -$_POST['quantity'], $_POST['date_']);
+
// delete the work order requirements
delete_wo_requirements($woid);
create_wo_requirements($woid, $stock_id);
add_comments(ST_WORKORDER, $woid, $releaseDate, $memo_);
- add_audit_trail(ST_WORKORDER, $woid, $releaseDate,_("Released."));
+ add_audit_trail(ST_WORKORDER, $woid, sql2date($myrow['date_']), _("Released."));
commit_transaction();
}
$work_order = get_work_order($woid);
if (!($work_order["type"] == WO_ADVANCED))
{
+ $date = sql2date($work_order['date_']);
+ $qty = $work_order['units_reqd'];
+ add_material_cost($work_order['stock_id'], -$qty, $date); // remove avg. cost for qty
+ $cost = get_gl_wo_cost($woid, WO_LABOUR); // get the labour cost and reduce avg cost
+ if ($cost != 0)
+ add_labour_cost($work_order['stock_id'], -$qty, $date, $cost);
+ $cost = get_gl_wo_cost($woid, WO_OVERHEAD); // get the overhead cost and reduce avg cost
+ if ($cost != 0)
+ add_overhead_cost($work_order['stock_id'], -$qty, $date, $cost);
+
$sql = "UPDATE ".TB_PREF."workorders SET closed=1,units_reqd=0,units_issued=0 WHERE id = "
.db_escape($woid);
db_query($sql, "The work order couldn't be voided");
// void all related stock moves
void_stock_move(ST_WORKORDER, $woid);
- // void any related bank/gl trans
- void_bank_trans(ST_WORKORDER, $woid, true);
+ void_wo_costing($woid);
// clear the requirements units received
void_wo_requirements($woid);
{
// void everything inside the work order : issues, productions, payments
$date = sql2date($work_order['date_']);
-
+ add_material_cost($work_order['stock_id'], -$work_order['units_reqd'], $date); // remove avg. cost for qty
$result = get_work_order_productions($woid); // check the produced quantity
$qty = 0;
while ($row = db_fetch($result))
{
- void_work_order_produce($row['id']);
+ $qty += $row['quantity'];
+ // clear the production record
+ $sql = "UPDATE ".TB_PREF."wo_manufacture SET quantity=0 WHERE id=".$$row['id'];
+ db_query($sql, "Cannot void a wo production");
- //Post voided entry if not prevoided explicitly
- $void_entry = get_voided_entry(ST_MANURECEIVE, $row['id']);
- if ($void_entry)
- continue;
- $memo_ = _("Voiding Work Order Trans # ").$woid;
- add_audit_trail(ST_MANURECEIVE, $row['id'], today(), _("Voided.")."\n".$memo_);
- add_voided_entry(ST_MANURECEIVE, $row['id'], today(), $memo_);\r
+ void_stock_move(ST_MANURECEIVE, $row['id']); // and void the stock moves;
}
-\r
- $result = get_work_order_issues($woid);
+ $result = get_additional_issues($woid); // check the issued quantities
$cost = 0;
$issue_no = 0;
while ($row = db_fetch($result))
{
- void_work_order_issue($row['issue_no']);
-
- //Post voided entry if not prevoided explicitly
- $void_entry = get_voided_entry(ST_MANUISSUE, $row['issue_no']);
- if ($void_entry)
- continue;
- $memo_ = _("Voiding Work Order Trans # ").$woid;
- add_audit_trail(ST_MANUISSUE, $row['issue_no'], today(), _("Voided.")."\n".$memo_);
- add_voided_entry(ST_MANUISSUE, $row['issue_no'], today(), $memo_);
- }
+ $std_cost = get_standard_cost($row['stock_id']);
+ $icost = $std_cost * $row['qty_issued'];
+ $cost += $icost;
+ if ($issue_no == 0)
+ $issue_no = $row['issue_no'];
+ // void the actual issue items and their quantities
+ $sql = "UPDATE ".TB_PREF."wo_issue_items SET qty_issued = 0 WHERE issue_id="
+ .db_escape($row['id']);
+ db_query($sql,"A work order issue item could not be voided");
+ }
+ if ($issue_no != 0)
+ void_stock_move(ST_MANUISSUE, $issue_no); // and void the stock moves
+ if ($cost != 0)
+ add_issue_cost($work_order['stock_id'], -$qty, $date, $cost);
- //Adust avg labour cost\r
- $cost = get_gl_wo_cost($woid, WO_LABOUR); \r
+ $cost = get_gl_wo_cost($woid, WO_LABOUR); // get the labour cost and reduce avg cost
if ($cost != 0)
- add_labour_cost($work_order['stock_id'], 1, $date, -$cost, true);
- \r
- //Adust avg overhead cost\r
- $cost = get_gl_wo_cost($woid, WO_OVERHEAD); \r
+ add_labour_cost($work_order['stock_id'], -$qty, $date, $cost);
+ $cost = get_gl_wo_cost($woid, WO_OVERHEAD); // get the overhead cost and reduce avg cost
if ($cost != 0)
- add_overhead_cost($work_order['stock_id'], 1, $date, -$cost, true);
+ add_overhead_cost($work_order['stock_id'], -$qty, $date, $cost);
$sql = "UPDATE ".TB_PREF."workorders SET closed=1,units_reqd=0,units_issued=0 WHERE id = "
.db_escape($woid);
// void all related stock moves
void_stock_move(ST_WORKORDER, $woid);
- // void any related bank/gl trans
- void_bank_trans(ST_WORKORDER, $woid, true);
+ void_wo_costing($wo);
// clear the requirements units received
void_wo_requirements($woid);
db_query($sql, "The work order requirements could not be added");
// insert a -ve stock move for each item
- // Chaitanya: Updated to record price and cost as std_cost for work order issued item
- $UnitCost = get_standard_cost($bom_item["component"]);
add_stock_move(ST_WORKORDER, $bom_item["component"], $woid,
- $bom_item["loc_code"], $date_, $wo_ref, -$item_quantity, $UnitCost, 0, 1, $UnitCost);
- }
-
- // -------------------------------------------------------------------------
- //Negative Stock Handling
- $qoh = get_qoh_on_date($stock_id);
- $cost_adjust = false;
- if ($qoh < 0)
- {
- if ($qoh + $units_reqd > 0)
- $cost_adjust = true;
+ $bom_item["loc_code"], $date_, $wo_ref, -$item_quantity, 0);
}
+
// -------------------------------------------------------------------------
-
- //Negative Stock Handling First; Prior to add_stock_move
- if ($cost_adjust)
- adjust_deliveries($stock_id, get_standard_cost($stock_id), $date_);
-
- // -------------------------------------------------------------------------
// insert a +ve stock move for the item being manufactured
add_stock_move(ST_WORKORDER, $stock_id, $woid, $loc_code, $date_,
// -------------------------------------------------------------------------
work_order_quick_costs($woid, $stock_id, $units_reqd, $date_, 0, $costs, $cr_acc, $labour, $cr_lab_acc);
-
- //--------------------------------------------------------------------------
+
+ // -------------------------------------------------------------------------
add_comments(ST_WORKORDER, $woid, $date_, $memo_);
// credit all the components
$total_cost = 0;
- //Chaitanya : capture the exact i.e. non-rounded cost to avoid rounding error amplification
- $total_material_cost = 0;
while ($bom_item = db_fetch($result))
{
+
$bom_accounts = get_stock_gl_code($bom_item["component"]);
$bom_cost = $bom_item["ComponentCost"] * $units_reqd;
$memo = $date_.": ".$memo;
update_wo_requirement_issued($woid, $bom_item['component'], $bom_item["quantity"] * $units_reqd);
// insert a -ve stock move for each item
- // Chaitanya: Updated to record price and cost as std_cost for work order issued item
- $UnitCost = get_standard_cost($bom_item["component"]);
add_stock_move(ST_MANURECEIVE, $bom_item["component"], $advanced,
- $bom_item["loc_code"], $date_, "", -$bom_item["quantity"] * $units_reqd, $UnitCost, 0, 1, $UnitCost);
+ $bom_item["loc_code"], $date_, "", -$bom_item["quantity"] * $units_reqd, 0);
}
-
- //Chaitanya : Compatibility for Service Items
- if (!is_service($bom_accounts["mb_flag"]))
- $ivaccount = $bom_accounts["inventory_account"];
- else
- $ivaccount = $bom_accounts["cogs_account"];
- $total_cost += add_gl_trans_std_cost(ST_WORKORDER, $woid, $date_, $ivaccount, 0, 0,
+ $total_cost += add_gl_trans_std_cost(ST_WORKORDER, $woid, $date_, $bom_accounts["inventory_account"], 0, 0,
$memo, -$bom_cost);
- $total_material_cost += $bom_cost;
+
}
+ $item_accounts = get_stock_gl_code($stock_id);
if ($advanced)
{
- //Chaitanya: Material cost added at time of production as per BOM at the time and in adjustment mode.
- add_material_cost($stock_id, $units_reqd, $date_, true);
-
$wo = get_work_order($woid);
// also take the additional issues
// moved to work_order_issues_db.inc
if ($issue_total != 0)
add_issue_cost($stock_id, $units_reqd, $date_, $issue_total);
*/
-
- // Logic moved to work_order_costs.php
- /*
$lcost = get_gl_wo_cost($woid, WO_LABOUR);
add_labour_cost($stock_id, $units_reqd, $date_, $lcost * $units_reqd / $wo['units_reqd']);
$ocost = get_gl_wo_cost($woid, WO_OVERHEAD);
- add_overhead_cost($stock_id, $units_reqd, $date_, $ocost * $units_reqd / $wo['units_reqd']); */
- }
- // credit additional costs
- $item_accounts = get_stock_gl_code($stock_id);
- if ($costs != 0.0)
- {
- 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(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(ST_WORKORDER, $woid, $date_, $item_accounts["assembly_account"],
- $item_accounts["dimension_id"], $item_accounts["dimension2_id"], $wo_cost_types[WO_OVERHEAD], $costs,
- PT_WORKORDER, WO_OVERHEAD);
- }
- if ($labour != 0.0)
- {
- 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(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(ST_WORKORDER, $woid, $date_, $item_accounts["assembly_account"],
- $item_accounts["dimension_id"], $item_accounts["dimension2_id"], $wo_cost_types[WO_LABOUR], $labour,
- PT_WORKORDER, WO_LABOUR);
+ add_overhead_cost($stock_id, $units_reqd, $date_, $ocost * $units_reqd / $wo['units_reqd']);
+
+ } else { // only for quick
+ // credit additional costs
+
+ if ($costs != 0.0)
+ {
+ add_wo_costs_journal($woid, $costs, WO_OVERHEAD, $cr_acc, $item_accounts["assembly_account"],
+ $date_, $item_accounts["dimension_id"], $item_accounts["dimension2_id"]);
+ }
+ if ($labour != 0.0) // only for quick
+ {
+ add_wo_costs_journal($woid, $labour, WO_LABOUR, $cr_lab_acc, $item_accounts["assembly_account"],
+ $date_, $item_accounts["dimension_id"], $item_accounts["dimension2_id"]);
+ }
}
// debit total components $total_cost
$stockitem = get_item($stock_id);
if ($advanced)
$memo = $date_.": ".$memo;
add_gl_trans_std_cost(ST_WORKORDER, $woid, $date_, $item_accounts["inventory_account"],
- 0, 0, $memo, -$total_cost);
-
- //Chaitanya : Update cost of the manufactured item in stock moves table
- $UnitWOCost = ($total_material_cost + $costs + $labour)/$units_reqd;
- update_stock_move(ST_WORKORDER, $woid, $stock_id, $UnitWOCost);
+ 0, 0, $memo, -$total_cost);
}
//--------------------------------------------------------------------------------------
***********************************************************************/
include_once($path_to_root . "/manufacturing/includes/db/work_centres_db.inc");
include_once($path_to_root . "/manufacturing/includes/db/work_orders_db.inc");
+include_once($path_to_root . "/manufacturing/includes/db/work_order_costing_db.inc");
include_once($path_to_root . "/manufacturing/includes/db/work_orders_quick_db.inc");
include_once($path_to_root . "/manufacturing/includes/db/work_order_issues_db.inc");
include_once($path_to_root . "/manufacturing/includes/db/work_order_produce_items_db.inc");
alt_table_row_color($k);
- label_cell(get_gl_view_str(ST_WORKORDER, $myrow["type_no"], $myrow["type_no"]));
- label_cell($wo_cost_types[$myrow['person_id']]);
+ label_cell(get_gl_view_str( $myrow["type"], $myrow["type_no"], $myrow["type_no"]));
+ label_cell($wo_cost_types[$myrow['cost_type']]);
$date = sql2date($myrow["tran_date"]);
label_cell($date);
amount_cell(-($myrow['amount']));
--- /dev/null
+<?php
+/**********************************************************************
+ Copyright (C) FrontAccounting, LLC.
+ Released under the terms of the GNU General Public License, GPL,
+ as published by the Free Software Foundation, either version 3
+ of the License, or (at your option) any later version.
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ See the License here <http://www.gnu.org/licenses/gpl-3.0.html>.
+***********************************************************************/
+$page_security = 'SA_MANUFTRANSVIEW';
+$path_to_root = "../..";
+
+include_once($path_to_root . "/includes/session.inc");
+
+$js = "";
+if ($use_popup_windows)
+ $js .= get_js_open_window(900, 500);
+page(_($help_context = "View Work Order Costs"), true, false, "", $js);
+
+include_once($path_to_root . "/includes/date_functions.inc");
+include_once($path_to_root . "/includes/manufacturing.inc");
+include_once($path_to_root . "/includes/data_checks.inc");
+
+include_once($path_to_root . "/manufacturing/includes/manufacturing_db.inc");
+include_once($path_to_root . "/manufacturing/includes/manufacturing_ui.inc");
+
+//-------------------------------------------------------------------------------------------------
+
+if ($_GET['trans_no'] != "")
+{
+ $wo_id = $_GET['trans_no'];
+}
+
+//-------------------------------------------------------------------------------------------------
+
+function display_wo_costs($prod_id)
+{
+ global $wo_cost_types;
+
+ $costs = get_gl_wo_cost_trans($prod_id);
+
+ br(1);
+ start_table(TABLESTYLE);
+ $th = array(_("Date"), _("Type"), _("Amount"), _("Memo"), '');
+ table_header($th);
+ while($myrow = db_fetch($costs)) {
+ start_row();
+ label_cell(sql2date($myrow["tran_date"]));
+ label_cell($wo_cost_types[$myrow["cost_type"]]);
+ amount_cell(-$myrow['amount']);
+ label_cell($myrow['memo_']);
+ label_cell(get_trans_view_str($myrow['trans_type'],$myrow["trans_no"]));
+ end_row();
+ }
+ end_table(1);
+}
+
+//-------------------------------------------------------------------------------------------------
+
+display_heading(sprintf(_("Production Costs for Work Order # %d"), $wo_id));
+
+display_wo_costs($wo_id);
+
+//-------------------------------------------------------------------------------------------------
+
+br(2);
+
+end_page(true, false, false, ST_WORKORDER, $wo_id);
+
+?>
+
}
elseif (!is_date_in_fiscalyear($_POST['date_']))
{
- display_error(_("The entered date is not in fiscal year."));
+ display_error(_("The entered date is out of fiscal year or is closed for further data entry."));
set_focus('date_');
return false;
}
display_note(get_trans_view_str($stype, $id, _("View this Work Order")));
- display_note(get_gl_view_str($stype, $id, _("View the GL Journal Entries for this Work Order")), 1);
-
hyperlink_params("work_order_costs.php", _("Enter another additional cost."), "trans_no=$id");
hyperlink_no_params("search_work_orders.php", _("Select another &Work Order to Process"));
//--------------------------------------------------------------------------------------------------
-function can_process()
+function can_process($wo_details)
{
- global $wo_details;
if (!check_num('costs', 0))
{
display_error(_("The amount entered is not a valid number or less then zero."));
set_focus('costs');
return false;
- }
+ }
if (!is_date($_POST['date_']))
{
}
elseif (!is_date_in_fiscalyear($_POST['date_']))
{
- display_error(_("The entered date is not in fiscal year."));
+ display_error(_("The entered date is out of fiscal year or is closed for further data entry."));
set_focus('date_');
return false;
}
//--------------------------------------------------------------------------------------------------
-if (isset($_POST['process']) && can_process() == true)
+if (isset($_POST['process']) && can_process($wo_details) == true)
{
$date = $_POST['date_'];
- begin_transaction();
- add_gl_trans_std_cost(ST_WORKORDER, $_POST['selected_id'], $_POST['date_'], $_POST['cr_acc'],
- 0, 0, $date.": ".$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(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");
- }
+ $memo = $_POST['memo'];
+ $ref = $_POST['ref'];
- add_gl_trans_std_cost(ST_WORKORDER, $_POST['selected_id'], $_POST['date_'], $_POST['db_acc'],
- $_POST['dim1'], $_POST['dim2'], $date.": ".$wo_cost_types[$_POST['PaymentType']], input_num('costs'), PT_WORKORDER,
- $_POST['PaymentType']);
-
- //Chaitanya : Apply the costs to manfuctured stock item as adjustement
- $wo = get_work_order($_POST['selected_id']);
- if ($_POST['PaymentType'] == 0)
- add_labour_cost($wo['stock_id'], 0, $_POST['date_'], input_num('costs'), true);
- else
- add_overhead_cost($wo['stock_id'], 0, $_POST['date_'], input_num('costs'), true);
-
- commit_transaction();
+ add_wo_costs_journal($_POST['selected_id'], input_num('costs'), $_POST['PaymentType'],
+ $_POST['cr_acc'], $_POST['db_acc'], $date, $_POST['dim1'], $_POST['dim2'], $memo, $ref);
meta_forward($_SERVER['PHP_SELF'], "AddedID=".$_POST['selected_id']);
}
//-------------------------------------------------------------------------------------
+if (!isset($_POST['ref']))
+ $_POST['ref'] = $Refs->get_next(ST_JOURNAL);
+
start_form();
hidden('selected_id', $_POST['selected_id']);
br();
-yesno_list_row(_("Type:"), 'PaymentType', null, $wo_cost_types[WO_OVERHEAD], $wo_cost_types[WO_LABOUR]);
date_row(_("Date:"), 'date_');
+ref_row(_("Reference:"), 'ref', '');
+
+yesno_list_row(_("Type:"), 'PaymentType', null, $wo_cost_types[WO_OVERHEAD], $wo_cost_types[WO_LABOUR]);
$item_accounts = get_stock_gl_code($wo_details['stock_id']);
$_POST['db_acc'] = $item_accounts['assembly_account'];
amount_row(_("Additional Costs:"), 'costs');
gl_all_accounts_list_row(_("Debit Account"), 'db_acc', null);
gl_all_accounts_list_row(_("Credit Account"), 'cr_acc', null);
-
+textarea_row(_("Memo:"), 'memo', null, 40, 5);
end_table(1);
hidden('dim1', $item_accounts["dimension_id"]);
hidden('dim2', $item_accounts["dimension2_id"]);
}
elseif (!is_date_in_fiscalyear($_POST['date_']))
{
- display_error(_("The entered date is not in fiscal year."));
+ display_error(_("The entered date is out of fiscal year or is closed for further data entry."));
set_focus('date_');
return false;
}
}
//elseif (!is_date_in_fiscalyear($_POST['RequDate']))
//{
- // display_error(_("The entered date is not in fiscal year."));
+ // display_error(_("The entered date is out of fiscal year or is closed for further data entry."));
// return false;
//}
if (isset($selected_id))
***********************************************************************/
$page_security = 'SA_MANUFISSUE';
$path_to_root = "..";
+
include_once($path_to_root . "/includes/ui/items_cart.inc");
include_once($path_to_root . "/includes/session.inc");
$js .= get_js_open_window(800, 500);
if ($use_date_picker)
$js .= get_js_date_picker();
+
page(_($help_context = "Issue Items to Work Order"), false, false, "", $js);
//-----------------------------------------------------------------------------------------------
unset ($_SESSION['issue_items']);
}
- Session_register("issue_items");
-
$_SESSION['issue_items'] = new items_cart(ST_MANUISSUE);
$_SESSION['issue_items']->order_id = $_GET['trans_no'];
}
//-----------------------------------------------------------------------------------------------
-
function can_process()
{
global $Refs;
}
elseif (!is_date_in_fiscalyear($_POST['date_']))
{
- display_error(_("The entered date is not in fiscal year."));
+ display_error(_("The entered date is out of fiscal year or is closed for further data entry."));
set_focus('date_');
return false;
}
$failed_item = $_SESSION['issue_items']->check_qoh($_POST['Location'], $_POST['date_'], !$_POST['IssueType']);
if ($failed_item != -1)
{
+ $item = $_SESSION['issue_items']->line_items[$failed_item];
display_error( _("The issue cannot be processed because an entered item would cause a negative inventory balance :") .
- " " . $failed_item->stock_id . " - " . $failed_item->item_description);
+ " " . $item->stock_id . " - " . $item->item_description);
return false;
}
function update_average_material_cost($supplier, $stock_id, $price, $qty, $date, $adj_only=false)
{
//Handle if inventory will become negative
- //8-OCT-2011 : Skip negative inventory adjustment for case of adjust_only\r
- if (is_inventory_item($stock_id) && !$adj_only) \r
+ //8-OCT-2011 : Skip negative inventory adjustment for case of adjust_only
+ if (is_inventory_item($stock_id) && !$adj_only)
handle_negative_inventory($stock_id, $qty, $price, $date);
// probably this function should be optimized
}
else
$price_in_home_currency = $price;
-
+
$price_in_home_currency_ = $price_in_home_currency;
$sql = "SELECT mb_flag, material_cost, labour_cost, overhead_cost FROM ".TB_PREF."stock_master WHERE stock_id=".db_escape($stock_id);
$myrow = db_fetch($result);
$material_cost = $myrow['material_cost'];
- //Price adjustment for manufactured item\r
- if (!$adj_only && $myrow['mb_flag'] == 'M') \r
+ //Price adjustment for manufactured item
+ if (!$adj_only && $myrow['mb_flag'] == 'M')
{
$standard_cost = get_standard_cost($stock_id);
//reduce overhead_cost and labour_cost from price as those will remain as is
$price_in_home_currency = $price_in_home_currency - $myrow['labour_cost'] - $myrow['overhead_cost'];
}
-
+
if ($adj_only)
$exclude = ST_CUSTDELIVERY;
else
$exclude = 0;
$cost_adjust = false;
+
$qoh = get_qoh_on_date($stock_id);
if ($adj_only)
$qoh = 0;
}
if ($qoh + $qty > 0)
- $material_cost
-= ($qoh * $material_cost + $qty * $price_in_home_currency) / ($qoh + $qty);
- }
-
+ $material_cost = ($qoh * $material_cost + $qty * $price_in_home_currency) / ($qoh + $qty);
+ }
+
if ($cost_adjust) // new 2010-02-10 //Chaitanya : Material_cost replaced with price
adjust_deliveries($stock_id, $price_in_home_currency_, $date);
$sql = "UPDATE ".TB_PREF."stock_master SET material_cost=".db_escape($material_cost)."
if ($clearing_act)
$total += add_gl_trans_supplier(ST_SUPPRECEIVE, $grn, $date_, $stock_gl_code["inventory_account"],
$stock_gl_code['dimension_id'], $stock_gl_code['dimension2_id'],
- $order_line->receive_qty * $order_line->taxfree_charge_price($po), $po->supplier_id, '', 0, $order_line->stock_id);\r
- update_average_material_cost($po->supplier_id, $order_line->stock_id, $order_line->price,\r
+ $order_line->receive_qty * $order_line->taxfree_charge_price($po), $po->supplier_id, '', 0, $order_line->stock_id);
+ update_average_material_cost($po->supplier_id, $order_line->stock_id, $order_line->price,
$order_line->receive_qty, $date_);
- }
+ }
//----------------------------------------------------------------------------------------------------------------
if ($order_line->qty_received == 0)
{
/* Update location stock records - NB a po cannot be entered for a service/kit parts done automatically */
add_stock_move(ST_SUPPRECEIVE, $order_line->stock_id, $grn, $po->Location, $date_, "",
$order_line->receive_qty, $order_line->standard_cost,
- $po->supplier_id, 1, $order_line->taxfree_charge_price($po));\r
+ $po->supplier_id, 1, $order_line->taxfree_charge_price($po));
} /*quantity received is != 0 */
} /*end of order_line loop */
function get_grn_items($grn_batch_id=0, $supplier_id="", $outstanding_only=false,
$is_invoiced_only=false, $invoice_no=0, $begin="", $end="")
{
- $sql = "SELECT ".TB_PREF."grn_batch.*, ".TB_PREF."grn_items.*, "
- .TB_PREF."purch_order_details.unit_price,"
- .TB_PREF."purch_order_details.act_price,"
- .TB_PREF."purch_order_details.quantity_ordered,"
- .TB_PREF."purch_order_details.std_cost_unit, units
- FROM ".TB_PREF."grn_batch, ".TB_PREF."grn_items, "
- .TB_PREF."purch_order_details, ".TB_PREF."stock_master";
- if ($invoice_no != 0)
- $sql .= ", ".TB_PREF."supp_invoice_items";
- $sql .= " WHERE ".TB_PREF."grn_items.grn_batch_id=".TB_PREF."grn_batch.id
- AND ".TB_PREF."grn_items.po_detail_item=".TB_PREF."purch_order_details.po_detail_item";
- if ($invoice_no != 0)
- $sql .= " AND ".TB_PREF."supp_invoice_items.supp_trans_type=".ST_SUPPINVOICE." AND
- ".TB_PREF."supp_invoice_items.supp_trans_no=$invoice_no AND
- ".TB_PREF."grn_items.id=".TB_PREF."supp_invoice_items.grn_item_id";
- $sql .= " AND ".TB_PREF."stock_master.stock_id=".TB_PREF."grn_items.item_code ";
+ $sql = "SELECT grn.*, grn_item.*,
+ grn_item.quantity_inv".($invoice_no ? "-invoice_item.quantity" : '')." quantity_inv,
+ po_item.unit_price,
+ po_item.act_price,
+ po_item.quantity_ordered,
+ po_item.std_cost_unit, units
+ FROM ".TB_PREF."grn_batch grn, "
+ .TB_PREF."purch_order_details po_item, "
+ .TB_PREF."stock_master stock_item,"
+ .TB_PREF."grn_items grn_item ";
+
+ if ($invoice_no != 0) {
+ $sql .= " LEFT JOIN ".TB_PREF."supp_invoice_items invoice_item ON ";
+
+ $inv_cond = "invoice_item.supp_trans_type=".ST_SUPPINVOICE." AND invoice_item.supp_trans_no ";
+ if (is_array($invoice_no))
+ $inv_cond .= " IN (".implode(',' , $invoice_no) . ")";
+ else
+ $inv_cond .= " = $invoice_no";
+ $sql .= "($inv_cond) AND grn_item.id=invoice_item.grn_item_id";
+ }
+ $sql .= " WHERE grn_item.grn_batch_id=grn.id
+ AND grn_item.po_detail_item=po_item.po_detail_item";
+
+ if ($outstanding_only)
+ $sql .= " AND (".($invoice_no ? "$inv_cond OR ":'')."grn_item.qty_recd - grn_item.quantity_inv > 0)";
+
+ $sql .= " AND stock_item.stock_id=grn_item.item_code ";
if ($begin != "")
- $sql .= " AND ".TB_PREF."grn_batch.delivery_date>='".date2sql($begin)."'";
+ $sql .= " AND grn.delivery_date>='".date2sql($begin)."'";
if ($end != "")
- $sql .= " AND ".TB_PREF."grn_batch.delivery_date<='".date2sql($end)."'";
+ $sql .= " AND grn.delivery_date<='".date2sql($end)."'";
if ($grn_batch_id != 0)
- $sql .= " AND ".TB_PREF."grn_batch.id=".db_escape($grn_batch_id)
- ." AND ".TB_PREF."grn_items.grn_batch_id=".db_escape($grn_batch_id);
+ $sql .= " AND grn.id=".db_escape($grn_batch_id)
+ ." AND grn_item.grn_batch_id=".db_escape($grn_batch_id);
if ($is_invoiced_only)
- $sql .= " AND ".TB_PREF."grn_items.quantity_inv > 0";
-
- if ($outstanding_only)
- $sql .= " AND ".TB_PREF."grn_items.qty_recd - ".TB_PREF."grn_items.quantity_inv > 0";
+ $sql .= " AND grn_item.quantity_inv > 0";
if ($supplier_id != "")
- $sql .= " AND ".TB_PREF."grn_batch.supplier_id =".db_escape($supplier_id);
+ $sql .= " AND grn.supplier_id =".db_escape($supplier_id);
- $sql .= " ORDER BY ".TB_PREF."grn_batch.delivery_date, ".TB_PREF."grn_batch.id, ".TB_PREF."grn_items.id";
+ $sql .= " ORDER BY grn.delivery_date, grn.id, grn_item.id";
return db_query($sql, "Could not retreive GRNS");
}
function read_supplier_details_to_trans(&$supp_trans, $supplier_id)
{
$sql = "SELECT supp.supp_name, terms.terms, terms.days_before_due,
- terms.day_in_following_month, supp.tax_included,
+ terms.day_in_following_month, supp.tax_included, supp.tax_algorithm,
supp.tax_group_id, tax_group.name AS tax_group_name,
supp.credit_limit - Sum(IFNULL(IF(trans.type=".ST_SUPPCREDIT.", -1, 1)
* (ov_amount + ov_gst + ov_discount),0)) as cur_credit
- FROM ".TB_PREF."suppliers supp
- LEFT JOIN ".TB_PREF."supp_trans trans ON supp.supplier_id = trans.supplier_id, "
- .TB_PREF."payment_terms terms, ".TB_PREF."tax_groups tax_group
+ FROM ".TB_PREF."suppliers supp LEFT JOIN "
+ .TB_PREF."supp_trans trans ON supp.supplier_id = trans.supplier_id, "
+ .TB_PREF."payment_terms terms, "
+ .TB_PREF."tax_groups tax_group
WHERE supp.tax_group_id = tax_group.id
AND supp.payment_terms=terms.terms_indicator
AND supp.supplier_id = ".db_escape($supplier_id)." GROUP BY supp.supp_name";
$myrow = db_fetch($result);
+ if ($supp_trans->tran_date == "")
+ {
+ $supp_trans->tran_date = Today();
+
+ if (!is_date_in_fiscalyear($supp_trans->tran_date))
+ $supp_trans->tran_date = end_fiscalyear();
+ }
+ if ($supp_trans->supplier_id != $supplier_id)
+ get_duedate_from_terms($supp_trans);
+
$supp_trans->supplier_id = $supplier_id;
$supp_trans->tax_included = $myrow['tax_included'];
+ $supp_trans->tax_algorithm = $supp_trans->stored_algorithm = $myrow['tax_algorithm'];
$supp_trans->supplier_name = $myrow['supp_name'];
$supp_trans->terms = array(
'description' => $myrow['terms'],
'days_before_due' => $myrow['days_before_due'],
'day_in_following_month' => $myrow['day_in_following_month'] );
-
+
$supp_trans->credit = $myrow['cur_credit'];
$supp_trans->tax_description = $myrow['tax_group_name'];
$supp_trans->tax_group_id = $myrow['tax_group_id'];
- if ($supp_trans->tran_date == "")
- {
- $supp_trans->tran_date = Today();
- if (!is_date_in_fiscalyear($supp_trans->tran_date))
- $supp_trans->tran_date = end_fiscalyear();
- }
- //if ($supp_trans->due_date=="") {
- // get_duedate_from_terms($supp_trans);
- //}
- get_duedate_from_terms($supp_trans);
}
-//--------------------------------------------------------------------------------------------------
-
+//-------------------------------------------------------------------------------------------------
+// Updates invoiced quantity in PO and GRN line, and act_price in PO
+// Returns:
+// if chg_price is set: previous act_price, delivery date and unit_price from PO
+//
function update_supp_received_items_for_invoice($id, $po_detail_item, $qty_invoiced, $chg_price=null)
{
if ($chg_price != null)
}
//----------------------------------------------------------------------------------------
-function add_supp_invoice($supp_trans, $invoice_no=0) // do not receive as ref because we change locally
+function add_supp_invoice(&$supp_trans) // do not receive as ref because we change locally
{
global $Refs;
//$company_currency = get_company_currency();
+ $trans_no = $supp_trans->trans_no;
+ $trans_type = $supp_trans->trans_type;
/*Start an sql transaction */
begin_transaction();
- hook_db_prewrite($supp_trans, $supp_trans->trans_type);
+ hook_db_prewrite($supp_trans, $trans_type);
$tax_total = 0;
$taxes = $supp_trans->get_taxes($supp_trans->tax_group_id);
+ if ($trans_no) {
+ void_transaction($trans_type, $trans_no, Today(), _("Document reentered."));
+ $Refs->restore_last($trans_type, $trans_no);
+ }
foreach ($taxes as $n => $taxitem)
{
$tax_total += $taxes[$n]['Value'];
}
- $invoice_items_total = $supp_trans->get_items_total();
+ $invoice_items_total = $supp_trans->get_items_total(); // get total with/without tax dep. on tax_included
// $invoice_items_total = $supp_trans->get_total_taxfree($supp_trans->tax_group_id);
if($supp_trans->tax_included==0) {
$item_added_tax = $tax_total;
} else {
$item_added_tax = 0;
-
}
- $trans_type = $supp_trans->trans_type;
-
if ($trans_type == ST_SUPPCREDIT)
{
// let's negate everything because it's a credit note
/*First insert the invoice into the supp_trans table*/
$invoice_id = write_supp_trans($trans_type, 0, $supp_trans->supplier_id, $date_, $supp_trans->due_date,
$supp_trans->reference, $supp_trans->supp_reference,
- $invoice_items_total, $item_added_tax, $supp_trans->ov_discount, "", 0, $supp_trans->tax_included);
+ $invoice_items_total, $item_added_tax, $supp_trans->ov_discount, "", 0, $supp_trans->tax_included,
+ $supp_trans->tax_algorithm);
+
+
+ $supp_trans->trans_no = $invoice_id;
$total = 0;
/* Now the control account */
$trans_type, $invoice_id, $entered_gl_code->amount,
$ex_rate, $date_, $supp_trans->supp_reference, $supp_trans->tax_included);
}
-
+
$clearing_act = get_company_pref('grn_clearing_act');
foreach ($supp_trans->grn_items as $line_no => $entered_grn)
{
$line_taxfree = $entered_grn->taxfree_charge_price($supp_trans->tax_group_id);
$line_tax = $entered_grn->full_charge_price($supp_trans->tax_group_id) - $line_taxfree;
$stock_gl_code = get_stock_gl_code($entered_grn->item_code);
-
+
if ($trans_type == ST_SUPPCREDIT)
{
$iv_act = (is_inventory_item($entered_grn->item_code) ? $stock_gl_code["inventory_account"] :
$entered_grn->this_quantity_inv * $old_price, $supp_trans->supplier_id, "", $ex_rate);
$diff = get_diff_in_home_currency($supp_trans->supplier_id, $old_date, $date_, $old_price,
$line_taxfree);
-
+
// always return due to change in currency.
/*$mat_cost = update_average_material_cost(null, $entered_grn->item_code,
$diff, $entered_grn->this_quantity_inv, $old_date, true); */
$taxitem['tax_type_id'], $taxitem['rate'], $supp_trans->tax_included, $taxitem['Value'],
$taxitem['Net'], $ex_rate, $date_, $supp_trans->supp_reference);
- if ($trans_type == ST_SUPPCREDIT)
- $taxitem['Value'] = -$taxitem['Value'];
- $total += add_gl_trans_supplier($trans_type, $invoice_id, $date_,
- $taxitem['purchasing_gl_code'], 0, 0, $taxitem['Value'],
- $supp_trans->supplier_id,
- "A general ledger transaction for the tax amount could not be added");
+ if (isset($taxitem['purchasing_gl_code']))
+ {
+ if ($trans_type == ST_SUPPCREDIT)
+ $taxitem['Value'] = -$taxitem['Value'];
+ $total += add_gl_trans_supplier($trans_type, $invoice_id, $date_,
+ $taxitem['purchasing_gl_code'], 0, 0, $taxitem['Value'],
+ $supp_trans->supplier_id,
+ "A general ledger transaction for the tax amount could not be added");
+ }
}
}
$Refs->save($trans_type, $invoice_id, $supp_trans->reference);
- if ($invoice_no != 0)
+ if ($supp_trans->src_docs)
{
- $invoice_alloc_balance = get_supp_trans_allocation_balance(ST_SUPPINVOICE, $invoice_no);
+ $invoice_alloc_balance = get_supp_trans_allocation_balance(ST_SUPPINVOICE, $supp_trans->src_docs);
if ($invoice_alloc_balance > 0)
{ //the invoice is not already fully allocated
- $trans = get_supp_trans($invoice_no, ST_SUPPINVOICE);
+ $trans = get_supp_trans($supp_trans->src_docs, ST_SUPPINVOICE);
$total = $trans['Total'];
$allocate_amount = ($invoice_alloc_balance > $total) ? $total : $invoice_alloc_balance;
/*Now insert the allocation record if > 0 */
if ($allocate_amount != 0)
{
- update_supp_trans_allocation(ST_SUPPINVOICE, $invoice_no, $allocate_amount);
+ update_supp_trans_allocation(ST_SUPPINVOICE, $supp_trans->src_docs, $allocate_amount);
update_supp_trans_allocation(ST_SUPPCREDIT, $invoice_id, $allocate_amount); // ***
- add_supp_allocation($allocate_amount, ST_SUPPCREDIT, $invoice_id, ST_SUPPINVOICE, $invoice_no,
+ add_supp_allocation($allocate_amount, ST_SUPPCREDIT, $invoice_id, ST_SUPPINVOICE, $supp_trans->src_docs,
$date_);
// Exchange Variations Joe Hunt 2008-09-20 ////////////////////////////////////////
- exchange_variation(ST_SUPPCREDIT, $invoice_id, ST_SUPPINVOICE, $invoice_no, $date_,
+ exchange_variation(ST_SUPPCREDIT, $invoice_id, ST_SUPPINVOICE, $supp_trans->src_docs, $date_,
$allocate_amount, PT_SUPPLIER);
///////////////////////////////////////////////////////////////////////////
}
}
- $supp_trans->trans_no = $invoice_id;
hook_db_postwrite($supp_trans, $supp_trans->trans_type);
commit_transaction();
function read_supp_invoice($trans_no, $trans_type, &$supp_trans)
{
- $sql = "SELECT ".TB_PREF."supp_trans.*, supp_name FROM ".TB_PREF."supp_trans,".TB_PREF."suppliers
+ $sql = "SELECT ".TB_PREF."supp_trans.*, supp_name
+ FROM ".TB_PREF."supp_trans,".TB_PREF."suppliers
WHERE trans_no = ".db_escape($trans_no)." AND type = ".db_escape($trans_type)."
AND ".TB_PREF."suppliers.supplier_id=".TB_PREF."supp_trans.supplier_id";
+
$result = db_query($sql, "Cannot retreive a supplier transaction");
if (db_num_rows($result) == 1)
$supp_trans->ov_discount = $trans_row["ov_discount"];
$supp_trans->ov_gst = $trans_row["ov_gst"];
$supp_trans->tax_included = $trans_row["tax_included"];
+ $supp_trans->stored_algorithm = $supp_trans->tax_algorithm = $trans_row["tax_algorithm"];
$id = $trans_row["trans_no"];
if ($details_row["gl_code"] == 0)
{
$supp_trans->add_grn_to_trans($details_row["grn_item_id"], $details_row["po_detail_item_id"], $details_row["stock_id"],
- $details_row["description"], 0, 0, $details_row["quantity"], 0, $details_row["FullUnitPrice"],
+ $details_row["description"],
+ $details_row['qty_recd'],
+ $details_row['quantity_inv']-$details_row["quantity"],
+ $details_row["quantity"], 0, $details_row["FullUnitPrice"],
0, 0);
}
else
$batch = get_grn_batch_from_item($details_row["grn_item_id"]);
$grn = get_grn_batch($batch);
if ($type == ST_SUPPCREDIT) // credit note 2009-06-14 Joe Hunt Must restore the po and grn
- {
+ { // We must get the corresponding invoice item to check for price chg.
$match = get_matching_invoice_item($details_row["stock_id"], $details_row["po_detail_item_id"]);
-
//Chaitanya : Skipped costing block & handle in void_stock_move
// We must get the corresponding invoice item to check for price chg.
/*if ($match !== false)
else
$mat_cost = update_average_material_cost($grn["supplier_id"], $details_row["stock_id"],
$details_row["FullUnitPrice"], -$details_row["quantity"], $old_date, $old[1] !== $trans['tran_date']);*/
-
+
$sql = "UPDATE ".TB_PREF."purch_order_details
SET quantity_ordered = quantity_ordered + ".-$details_row["quantity"].", ";
if ($match !== false)
function remove_not_invoice_item($id)
{
- begin_transaction();
+ begin_transaction();
$myrow = get_grn_item_detail($id);
$grn = get_grn_batch($myrow['grn_batch_id']);
-
+
$supp = get_supplier($grn["supplier_id"]);
- $sql = "UPDATE ".TB_PREF."purch_order_details
- SET quantity_received = qty_invoiced, quantity_ordered = qty_invoiced WHERE po_detail_item = ".$myrow["po_detail_item"];
- db_query($sql, "The quantity invoiced of the purchase order line could not be updated");
+ $sql = "UPDATE ".TB_PREF."purch_order_details
+ SET quantity_received = qty_invoiced, quantity_ordered = qty_invoiced WHERE po_detail_item = ".$myrow["po_detail_item"];
+ db_query($sql, "The quantity invoiced of the purchase order line could not be updated");
$sql = "UPDATE ".TB_PREF."grn_items
SET qty_recd = quantity_inv WHERE id = ".$myrow["id"];
commit_transaction();
}
-?>
+
+function find_src_invoices($cart)
+{
+ $invoices = $po_ids = array();
+ foreach($cart->grn_items as $item)
+ $po_ids[] = "'$item->po_detail_item'"; // credit item lines
+
+ if (count($po_ids)) {
+ $sql = "SELECT DISTINCT trans.trans_no, trans.reference, trans.supp_reference
+ FROM ".TB_PREF."supp_invoice_items items
+ LEFT JOIN ".TB_PREF."supp_trans trans ON trans.trans_no=items.supp_trans_no AND trans.`type`=items.supp_trans_type
+ WHERE items.po_detail_item_id IN (" . implode(',', $po_ids). ")"." AND items.supp_trans_type=20";
+ $result = db_query($sql, "cannot find source invoice details");
+ while ($rec = db_fetch($result))
+ {
+ $invoices[$rec['trans_no']] = $rec['supp_reference']; // array($rec['reference'], $rec['supp_reference']);
+ }
+ }
+ return $invoices;
+}
function get_supp_invoice_items($supp_trans_type, $supp_trans_no)
{
- $sql = "SELECT *, unit_price AS FullUnitPrice FROM ".TB_PREF."supp_invoice_items
+ $sql = "SELECT *, unit_price AS FullUnitPrice FROM "
+ .TB_PREF."supp_invoice_items inv LEFT JOIN ".TB_PREF."grn_items grn ON grn.id =inv.grn_item_id
WHERE supp_trans_type = ".db_escape($supp_trans_type)."
- AND supp_trans_no = ".db_escape($supp_trans_no)." ORDER BY id";
+ AND supp_trans_no = ".db_escape($supp_trans_no)
+ ." ORDER BY inv.id";
return db_query($sql, "Cannot retreive supplier transaction detail records");
}
.db_escape($po_line->price) . ", "
.db_escape($po_line->quantity) . ", "
.db_escape($po_line->qty_received) . ")";
-
db_query($sql, "One of the purchase order detail records could not be updated");
}
function read_po_header($order_no, &$order)
{
- $sql = "SELECT ".TB_PREF."purch_orders.*, ".TB_PREF."suppliers.supp_name, ".TB_PREF."suppliers.tax_group_id,
- ".TB_PREF."suppliers.curr_code, ".TB_PREF."locations.location_name
+ $sql = "SELECT ".TB_PREF."purch_orders.*, "
+ .TB_PREF."suppliers.*, "
+ .TB_PREF."locations.location_name
FROM ".TB_PREF."purch_orders, ".TB_PREF."suppliers, ".TB_PREF."locations
WHERE ".TB_PREF."purch_orders.supplier_id = ".TB_PREF."suppliers.supplier_id
AND ".TB_PREF."locations.loc_code = into_stock_location
$order->trans_type = ST_PURCHORDER;
$order->order_no = $order_no;
-
+
$order->set_supplier($myrow["supplier_id"], $myrow["supp_name"], $myrow["curr_code"],
- $myrow['tax_group_id'], $myrow["tax_included"]);
+ $myrow['tax_group_id'], $myrow["tax_included"], @$myrow["tax_algorithm"]);
$order->credit = get_current_supp_credit($order->supplier_id);
/*now enter the bank_trans entry */
add_bank_trans($trans_type, $payment_id, $bank_account, $ref,
- $date_, -($amount + $charge), PT_SUPPLIER,
+ $date_, -($amount + $supp_charge), PT_SUPPLIER,
$supplier_id, $bank_account_currency,
"Could not add the supplier payment bank transaction");
// FIXME - this should be revised for transaction update case.
//
function write_supp_trans($type, $trans_no, $supplier_id, $date_, $due_date, $reference, $supp_reference,
- $amount, $amount_tax, $discount, $err_msg="", $rate=0, $included=0)
+ $amount, $amount_tax, $discount, $err_msg="", $rate=0, $included=0, $tax_algorithm = null)
{
$new = $trans_no==0;
$date = date2sql($date_);
$sql = "INSERT INTO ".TB_PREF."supp_trans (trans_no, type, supplier_id, tran_date, due_date,
- reference, supp_reference, ov_amount, ov_gst, rate, ov_discount, tax_included) ";
+ reference, supp_reference, ov_amount, ov_gst, rate, ov_discount, tax_included, tax_algorithm) ";
$sql .= "VALUES (".db_escape($trans_no).", ".db_escape($type)
.", ".db_escape($supplier_id).", '$date', '$due_date',
".db_escape($reference).", ".db_escape($supp_reference).", ".db_escape($amount)
- .", ".db_escape($amount_tax).", ".db_escape($rate).", ".db_escape($discount).", ".db_escape($included).")";
+ .", ".db_escape($amount_tax).", ".db_escape($rate).", ".db_escape($discount).", ".db_escape($included).
+ ", ".db_escape($tax_algorithm, true).")";
if ($err_msg == "")
$err_msg = "Cannot insert a supplier transaction record";
if ($extra_conditions)
$sql .= " AND $extra_conditions";
-
+
return $sql;
}
return db_query($sql." ORDER BY due_date", "Cannot retreive alloc to transactions");
}
+
function get_sql_for_supplier_allocation_inquiry()
{
$date_after = date2sql($_POST['TransAfterDate']);
function add_supplier($supp_name, $supp_ref, $address, $supp_address, $gst_no,
$website, $supp_account_no, $bank_account, $credit_limit, $dimension_id, $dimension2_id,
$curr_code, $payment_terms, $payable_account, $purchase_account, $payment_discount_account,
- $notes, $tax_group_id, $tax_included)
+ $notes, $tax_group_id, $tax_included, $tax_algorithm)
{
$sql = "INSERT INTO ".TB_PREF."suppliers (supp_name, supp_ref, address, supp_address, gst_no, website,
supp_account_no, bank_account, credit_limit, dimension_id, dimension2_id, curr_code,
payment_terms, payable_account, purchase_account, payment_discount_account, notes,
- tax_group_id, tax_included)
- VALUES (".db_escape($supp_name). ", "
+ tax_group_id, tax_included, tax_algorithm)
+ VALUES (".db_escape($_POST['supp_name']). ", "
.db_escape($supp_ref). ", "
.db_escape($address) . ", "
.db_escape($supp_address) . ", "
.db_escape($website). ", "
.db_escape($supp_account_no). ", "
.db_escape($bank_account). ", "
- .db_escape($credit_limit). ", "
+ .$credit_limit. ", "
.db_escape($dimension_id). ", "
.db_escape($dimension2_id). ", "
.db_escape($curr_code). ", "
.db_escape($payment_discount_account). ", "
.db_escape($notes). ", "
.db_escape($tax_group_id). ", "
- .db_escape($tax_included). ")";
+ .db_escape($tax_included). ", "
+ .db_escape($tax_algorithm). ")";
db_query($sql,"The supplier could not be added");
}
function update_supplier($supplier_id, $supp_name, $supp_ref, $address, $supp_address, $gst_no,
$website, $supp_account_no, $bank_account, $credit_limit, $dimension_id, $dimension2_id,
$curr_code, $payment_terms, $payable_account, $purchase_account, $payment_discount_account,
- $notes, $tax_group_id, $tax_included)
+ $notes, $tax_group_id, $tax_included, $tax_algorithm)
{
$sql = "UPDATE ".TB_PREF."suppliers SET supp_name=".db_escape($supp_name) . ",
supp_ref=".db_escape($supp_ref) . ",
payment_discount_account=".db_escape($payment_discount_account) . ",
notes=".db_escape($notes) . ",
tax_group_id=".db_escape($tax_group_id). ",
- tax_included=".db_escape($tax_included)
+ tax_included=".db_escape($tax_included).",
+ tax_algorithm=".db_escape($tax_algorithm)
." WHERE supplier_id = ".db_escape($supplier_id);
db_query($sql,"The supplier could not be updated");
".TB_PREF."payment_terms.terms,
".TB_PREF."payment_terms.days_before_due,
".TB_PREF."payment_terms.day_in_following_month";
-
$result = db_query($sql,"The customer details could not be retrieved");
$supp = db_fetch($result);
return !key_in_foreign_table($id, $tables, 'supplier_id');
}
-?>
\ No newline at end of file
+
+function update_supp_tax_algorithm($supplier_id, $tax_algorithm)
+{
+ $sql = "UPDATE ".TB_PREF."suppliers SET tax_algorithm=".db_escape($tax_algorithm)
+ . " WHERE supplier_id=".db_escape($supplier_id);
+ return db_query($sql, "cannot update supplier's tax calculation algorithm");
+}
var $tax_group_id;
var $tax_group_array = null; // saves db queries
var $tax_included; // type of prices
+ var $tax_algorithm;
+ var $stored_algorithm; // copy to find the change after invoice in processed
var $terms;
var $reference;
$this->lines_on_order = $this->order_no = $this->supplier_id = 0;
}
- function set_supplier($supplier_id, $supplier_name, $curr_code, $tax_group_id, $tax_included)
+ function set_supplier($supplier_id, $supplier_name, $curr_code, $tax_group_id, $tax_included, $tax_algorithm)
{
$this->supplier_id = $supplier_id;
$this->supplier_name = $supplier_name;
$this->curr_code = $curr_code;
$this->tax_group_id = $tax_group_id;
$this->tax_included = $tax_included;
+ $this->stored_algorithm = $this->tax_algorithm = $tax_algorithm;
$this->tax_group_array = get_tax_group_items_as_array($tax_group_id);
}
$prices[] = round($ln_itm->price * ($receival ? $ln_itm->receive_qty : $ln_itm->quantity), user_price_dec());
}
$taxes = get_tax_for_items($items, $prices, $shipping_cost,
- $this->tax_group_id, $this->tax_included, $this->tax_group_array);
+ $this->tax_group_id, $this->tax_included, $this->tax_group_array, $this->tax_algorithm);
// Adjustment for swiss franken, we always have 5 rappen = 1/20 franken
if ($this->curr_code == 'CHF') {
$val = $taxes['1']['Value'];
- $val1 = (floatval((intval(round(($val*20),0)))/20));
- $taxes['1']['Value'] = $val1;
+ $taxes['1']['Value'] = (floatval((intval(round(($val*20),0)))/20));
}
return $taxes;
}
if (!$this->tax_included ) {
$taxes = get_tax_for_items($items, $prices, 0, $this->tax_group_id,
- $this->tax_included, $this->tax_group_array);
+ $this->tax_included, $this->tax_group_array, $this->tax_algorithm);
foreach($taxes as $tax)
$total += round($tax['Value'], $dec);
var $tax_included;
var $trans_type; // invoice or credit
+ var $trans_no;
var $Comments;
var $tran_date;
var $due_date;
+ var $src_docs = array(); // source invoice for this credit note (if any)
var $supp_reference;
var $reference;
var $ov_gst;
var $gl_codes_counter=0;
var $credit = 0;
+ var $tax_algorithm;
+ var $stored_algorithm;
+ var $currency;
- function supp_trans($trans_type)
+ function supp_trans($trans_type, $trans_no=0)
{
$this->trans_type = $trans_type;
/*Constructor function initialises a new Supplier Transaction object */
- $this->grn_items = array();
- $this->gl_codes = array();
+ $this->read($trans_type, $trans_no);
+ }
+
+ function read($trans_type, $trans_no)
+ {
+ $this->trans_type = $trans_type;
+ $this->trans_no = $trans_no;
+ $this->grn_items = array();
+ $this->gl_codes = array();
+ if ($trans_no) {
+ read_supp_invoice($trans_no, $trans_type, $this);
+ if ($trans_type == ST_SUPPCREDIT)
+ {
+ $this->src_docs = find_src_invoices($trans_no);
+ }
+ read_supplier_details_to_trans($this, $this->supplier_id);
+ }
}
function add_grn_to_trans($grn_item_id, $po_detail_item, $item_code, $item_description,
$this->grn_items[$grn_item_id] = new grn_item($grn_item_id, $po_detail_item,
$item_code, $item_description, $qty_recd, $prev_quantity_inv, $this_quantity_inv,
$order_price, $chg_price, $std_cost_unit, $gl_code, $this->tax_included);
+ $this->src_docs = find_src_invoices($this);
return 1;
}
if ($tax_group_id == null)
$tax_group_id = $this->tax_group_id;
$taxes = get_tax_for_items($items, $prices, $shipping_cost, $tax_group_id,
- $this->tax_included);
+ $this->tax_included, null, $this->tax_algorithm);
///////////////// Joe Hunt 2009.08.18
}
return $total;
}
-
+ //
+ // Returns transaction total
+ //
function get_items_total()
{
$total = 0;
ref_cells(_("Reference"), 'ref', '', null, "class='tableheader2'");
if (!isset($_POST['Location']))
- $_POST['Location'] = $po->location;
+ $_POST['Location'] = $po->Location;
label_cell(_("Deliver Into Location"), "class='tableheader2'");
locations_list_cells(null, "Location", $_POST['Location']);
else
{
label_cells(_("Reference"), $po->reference, "class='tableheader2'");
- label_cells(_("Deliver Into Location"), get_location_name($po->location), "class='tableheader2'");
+ label_cells(_("Deliver Into Location"), get_location_name($po->Location), "class='tableheader2'");
label_cells(_("Supplier's Reference"), $po->supp_ref, "class='tableheader2'");
}
$_POST['supp_reference'] = $supp_trans->supp_reference;
$_POST['reference'] = $supp_trans->reference;
$_POST['supplier_id'] = $supp_trans->supplier_id;
+ $_POST['tax_algorithm'] = $supp_trans->tax_algorithm;
}
//--------------------------------------------------------------------------------------------------
$supp_trans->due_date = $_POST['due_date'];
$supp_trans->supp_reference = $_POST['supp_reference'];
$supp_trans->reference = $_POST['reference'];
+ if (isset($_POST['tax_algorithm']))
+ $supp_trans->tax_algorithm = $_POST['tax_algorithm'];
$supp_trans->ov_amount = 0; /* for starters */
if (count($supp_trans->grn_items) > 0)
table_section(1);
- if (isset($_POST['invoice_no']))
+ if ($supp_trans->trans_type == ST_SUPPCREDIT && $supp_trans->src_docs)
{
- $trans = get_supp_trans($_POST['invoice_no'], ST_SUPPINVOICE);
- $_POST['supplier_id'] = $trans['supplier_id'];
- $supp = $trans['supplier_name'] . " - " . $trans['SupplierCurrCode'];
+// $trans = get_supp_trans($_POST['invoice_no'], ST_SUPPINVOICE);
+// $trans = get_supp_trans($supp_trans->supplier_id, ST_SUPPINVOICE);
+// $_POST['supplier_id'] = $trans['supplier_id'];
+// $supp = $trans['supplier_name'] . " - " . $trans['SupplierCurrCode'];
+
+ $_POST['supplier_id'] = $supp_trans->supplier_id;
+ $supp = $supp_trans->supplier_name." - ".$supp_trans->currency;
label_row(_("Supplier:"), $supp.hidden('supplier_id', $_POST['supplier_id'], false));
- }
+ }
else
{
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->trans_no)
+ supplier_list_row(_("Supplier:"), 'supplier_id', $_POST['supplier_id'], false, true);
+ else
+ label_row(_("Supplier:"), $supp_trans->supplier_name
+ .($supp_trans->currency ? ' - '.$supp_trans->currency : '')
+ .hidden('supplier_id', $_POST['supplier_id'], false));
}
if ($supp_trans->supplier_id != $_POST['supplier_id'])
{
ref_row(_("Reference:"), 'reference', '', $Refs->get_next($supp_trans->trans_type));
- if (isset($_POST['invoice_no']))
+ if ($supp_trans->trans_type == ST_SUPPCREDIT)
{
- label_row(_("Supplier's Ref.:"), $_POST['invoice_no'].hidden('invoice_no', $_POST['invoice_no'], false).hidden('supp_reference', $_POST['invoice_no'], false));
- }
- else
- text_row(_("Supplier's Ref.:"), 'supp_reference', $_POST['supp_reference'], 20, 60);
+ label_row(_("Source Invoices:"), implode(',' , $supp_trans->src_docs),'','','src_docs');
+ }
+ text_row(_("Supplier's Ref.:"), 'supp_reference', $_POST['supp_reference'], 20, 60);
table_section(2, "33%");
function invoice_totals(&$supp_trans)
{
+ global $Ajax;
+
copy_to_trans($supp_trans);
$dim = get_company_pref('use_dimension');
$colspan = ($dim == 2 ? 7 : ($dim == 1 ? 6 : 5));
+ div_start('tax_table');
start_table(TABLESTYLE, "width=95%");
label_row(_("Sub-total:"), price_format( $supp_trans->ov_amount), "colspan=$colspan align=right", "align=right");
end_table(1);
start_table(TABLESTYLE2);
+ tax_algorithm_list_row(_("Tax algorithm:"), 'tax_algorithm', null, true);
+ if (list_updated('tax_algorithm')) {
+ $supp_trans->tax_algorithm = $_POST['tax_algorithm'];
+ $Ajax->activate('tax_table');
+ }
textarea_row(_("Memo:"), "Comments", null, 50, 3);
end_table(1);
+ div_end();
}
//--------------------------------------------------------------------------------------------------
function display_grn_items_for_selection(&$supp_trans, $k)
{
-
- if ($supp_trans->trans_type == ST_SUPPINVOICE)
- $result = get_grn_items(0, $supp_trans->supplier_id, true);
+ if ($supp_trans->trans_type == ST_SUPPINVOICE) // outstanding grns and eventually for selected invoice
+ $result = get_grn_items(0, $supp_trans->supplier_id, true, false, $supp_trans->trans_no);
else
- {
+ { // only invoiced
if (isset($_POST['receive_begin']) && isset($_POST['receive_end']))
$result = get_grn_items(0, $supp_trans->supplier_id, false, true, 0, $_POST['receive_begin'], $_POST['receive_end']);
- else if (isset($_POST['invoice_no']))
- $result = get_grn_items(0, $supp_trans->supplier_id, false, true, $_POST['invoice_no']);
+ else if ($supp_trans->src_docs)
+ $result = get_grn_items(0, $supp_trans->supplier_id, false, true, array_keys($supp_trans->src_docs));
else
$result = get_grn_items(0, $supp_trans->supplier_id, false, true);
}
$grn_already_on_invoice = true;
}
}
+
if ($grn_already_on_invoice == false)
{
alt_table_row_color($k);
$n = $myrow["id"];
- label_cell(get_trans_view_str(25, $myrow["grn_batch_id"]).
- hidden('qty_recd'.$n, $myrow["qty_recd"], false).
- hidden('item_code'.$n, $myrow["item_code"], false).
- hidden('item_description'.$n, $myrow["description"], false).
- hidden('prev_quantity_inv'.$n, $myrow['quantity_inv'], false).
- 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).
- hidden('location'.$n, $myrow["loc_code"], false));
+ label_cell(get_trans_view_str(ST_SUPPRECEIVE, $myrow["grn_batch_id"]));
+ label_cell($myrow["id"].
+ hidden('qty_recd'.$n, $myrow["qty_recd"], false).
+ hidden('item_code'.$n, $myrow["item_code"], false).
+ hidden('item_description'.$n, $myrow["description"], false).
+ hidden('prev_quantity_inv'.$n, $myrow['quantity_inv'], false).
+ 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(ST_PURCHORDER, $myrow["purch_order_no"]));
label_cell($myrow["item_code"]);
label_cell($myrow["description"]);
if ($supp_trans->trans_type == ST_SUPPINVOICE)
qty_cells(null, 'this_quantity_inv'.$n, number_format2($myrow["qty_recd"] - $myrow["quantity_inv"], $dec),
null, null, $dec);
- else
+ else
qty_cells(null, 'This_QuantityCredited'.$n, number_format2(max($myrow["quantity_inv"], 0), $dec),
null, null, $dec);
- $dec2 = 0;
+ $dec2 = 0;
if ($supp_trans->trans_type == ST_SUPPINVOICE)
{
amount_cells(null, 'ChgPrice'.$n, price_decimal_format($myrow["unit_price"], $dec2), null, null, $dec2);
if (($supp_trans->trans_type == ST_SUPPINVOICE) && $_SESSION["wa_current_user"]->can_access('SA_GRNDELETE')) { // Added 2008-10-18 by Joe Hunt. Special access rights needed.
submit_cells('void_item_id'.$n, _("Remove"), '', _("WARNING! Be careful with removal. The operation is executed immediately and cannot be undone !!!"), true);
submit_js_confirm('void_item_id'.$n,
- _('You are about to remove all yet non-invoiced items from selected delivery line. This operation also irreversibly changes related order line. Do you want to continue ?'));
+ sprintf(_('You are about to remove all yet non-invoiced items from delivery line #%d. This operation also irreversibly changes related order line. Do you want to continue ?'), $n));
}
end_row();
}
$heading = _("Received Items Charged on this Invoice");
else
$heading = _("Received Items Credited on this Note");
- }
+ }
display_heading($heading);
if ($mode == 1)
{
- if ($supp_trans->trans_type == ST_SUPPCREDIT && !isset($_POST['invoice_no']))
+ if ($supp_trans->trans_type == ST_SUPPCREDIT)
{
echo "</td>";
date_cells(_("Received between"), 'receive_begin', "", null, -30, 0, 0, "valign=middle");
date_cells(_("and"), 'receive_end', '', null, 1, 0, 0, "valign=middle");
submit_cells('RefreshInquiry', _("Search"),'',_('Refresh Inquiry'), true);
echo "<td>";
- }
-
+ }
+
if ($heading2 != "")
{
display_note($heading2, 0, 0, "class='overduefg'");
- }
+ }
echo "</td><td width=10% align='right'>";
submit('InvGRNAll', _("Add All Items"), true, false,true);
- }
+ }
end_outer_table(0, false);
start_table(TABLESTYLE, "width=95%");
if ($mode == 1)
{
- $th = array(_("Delivery"), _("P.O."), _("Item"), _("Description"),
+ $th = array(_("Delivery"), _("Sequence #"), _("P.O."), _("Item"), _("Description"),
_("Received On"), _("Quantity Received"), _("Quantity Invoiced"),
_("Qty Yet To Invoice"), $supp_trans->tax_included ? _("Price after Tax") : _("Price before Tax"),
_("Total"), "");
alt_table_row_color($k);
$grn_batch = get_grn_batch_from_item($entered_grn->id);
- label_cell(get_trans_view_str(ST_SUPPRECEIVE,$grn_batch));
+ label_cell(get_trans_view_str(ST_SUPPRECEIVE, $grn_batch));
if ($mode == 1)
{
- $row = get_grn_batch($grn_batch);
- label_cell($row['purch_order_no']); // PO
- }
+ label_cell($entered_grn->id);
+ $row = get_grn_batch($grn_batch);
+ label_cell(get_trans_view_str(ST_PURCHORDER, $row["purch_order_no"])); // PO
+ }
label_cell($entered_grn->item_code);
label_cell($entered_grn->item_description);
$dec = get_qty_dec($entered_grn->item_code);
$_POST['supplier_id'] = $cart->supplier_id;
$_POST['OrderDate'] = $cart->orig_order_date;
- if ($cart->trans_type==ST_SUPPINVOICE)
+ if ($cart->trans_type == ST_SUPPINVOICE)
$_POST['due_date'] = $cart->due_date;
$_POST['supp_ref'] = $cart->supp_ref;
$_POST['ref'] = $cart->reference;
$_POST['Comments'] = $cart->Comments;
$_POST['StkLocation'] = $cart->Location;
$_POST['delivery_address'] = $cart->delivery_address;
+ $_POST['tax_algorithm'] = $cart->tax_algorithm;
}
function copy_to_cart()
$cart->supplier_id = $_POST['supplier_id'];
$cart->orig_order_date = $_POST['OrderDate'];
- if ($cart->trans_type==ST_SUPPINVOICE)
+ if ($cart->trans_type == ST_SUPPINVOICE)
$cart->due_date = $_POST['due_date'];
$cart->reference = $_POST['ref'];
$cart->supp_ref = $_POST['supp_ref'];
$cart->Comments = $_POST['Comments'];
$cart->Location = $_POST['StkLocation'];
$cart->delivery_address = $_POST['delivery_address'];
+ if (isset($_POST['tax_algorithm']))
+ $cart->tax_algorithm = $_POST['tax_algorithm'];
}
// ------------------------------------------------------------------------------
function get_supplier_details_to_order(&$order, $supplier_id)
{
- $sql = "SELECT curr_code, supp_name, tax_group_id, supp.tax_included,
+ $sql = "SELECT curr_code, supp_name, tax_group_id, supp.tax_included, supp.tax_algorithm,
supp.credit_limit - Sum(IFNULL(IF(trans.type=".ST_SUPPCREDIT.", -1, 1)
* (ov_amount + ov_gst + ov_discount),0)) as cur_credit,
terms.terms, terms.days_before_due, terms.day_in_following_month
$_POST['curr_code'] = $myrow["curr_code"];
$order->set_supplier($supplier_id, $myrow["supp_name"], $myrow["curr_code"],
- $myrow["tax_group_id"], $myrow["tax_included"]);
+ $myrow["tax_group_id"], $myrow["tax_included"], $myrow["tax_algorithm"]);
}
//---------------------------------------------------------------------------------------------------
get_supplier_details_to_order($order, $_POST['supplier_id']);
get_duedate_from_terms($order);
$_POST['due_date'] = $order->due_date;
+ $_POST['tax_algorithm'] = $order->tax_algorithm;
// supplier default price update
foreach ($order->line_items as $line_no=>$item) {
}
$Ajax->activate('items_table');
$Ajax->activate('due_date');
+ $Ajax->activate('tax_algorithm');
}
set_global_supplier($_POST['supplier_id']);
include_once($path_to_root . "/purchasing/includes/purchasing_ui.inc");
include_once($path_to_root . "/reporting/includes/reporting.inc");
-if (!@$_GET['popup'])
-{
- $js = "";
- if ($use_popup_windows)
- $js .= get_js_open_window(900, 500);
- if ($use_date_picker)
- $js .= get_js_date_picker();
- page(_($help_context = "Search Purchase Orders"), false, false, "", $js);
-}
+$js = "";
+if ($use_popup_windows)
+ $js .= get_js_open_window(900, 500);
+if ($use_date_picker)
+ $js .= get_js_date_picker();
+page(_($help_context = "Search Purchase Orders"), false, false, "", $js);
+
if (isset($_GET['order_number']))
{
$order_number = $_GET['order_number'];
}
//---------------------------------------------------------------------------------------------
-if (!@$_GET['popup'])
- start_form();
+start_form();
start_table(TABLESTYLE_NOBORDER);
start_row();
function edit_link($row)
{
- if (@$_GET['popup'])
+ global $page_nested;
+
+ if ($page_nested)
return '';
return pager_link( _("Edit"),
"/purchasing/po_entry_items.php?" . SID
display_db_pager($table);
-if (!@$_GET['popup'])
-{
- end_form();
- end_page();
-}
+end_form();
+end_page();
?>
function alloc_link($row)
{
- if (($row["type"] == ST_BANKPAYMENT || $row["type"] == ST_SUPPCREDIT || $row["type"] == ST_SUPPAYMENT)
+ $link =
+ pager_link(_("Allocations"),
+ "/purchasing/allocations/supplier_allocate.php?trans_no=" .
+ $row["trans_no"]. "&trans_type=" . $row["type"], ICON_MONEY );
+
+ return (($row["type"] == ST_BANKPAYMENT || $row["type"] == ST_SUPPCREDIT || $row["type"] == ST_SUPPAYMENT)
&& (-$row["TotalAmount"] - $row["Allocated"]) > 0)
- return pager_link(_("Allocations"), "/purchasing/allocations/supplier_allocate.php?trans_no=" .
- $row["trans_no"]. "&trans_type=" . $row["type"], ICON_MONEY );
- elseif ($row["type"] == ST_SUPPINVOICE && ($row["TotalAmount"] - $row["Allocated"]) > 0)
- return pager_link(_("Pay"), "/purchasing/supplier_payment.php?supplier_id=".$row["supplier_id"]
- ."&PInvoice=".$row["trans_no"], ICON_MONEY );
- else
- return '';
+ ? $link : '';
}
function fmt_debit($row)
include_once($path_to_root . "/purchasing/includes/purchasing_ui.inc");
include_once($path_to_root . "/reporting/includes/reporting.inc");
-if (!@$_GET['popup'])
-{
- $js = "";
- if ($use_popup_windows)
- $js .= get_js_open_window(900, 500);
- if ($use_date_picker)
- $js .= get_js_date_picker();
- page(_($help_context = "Supplier Inquiry"), isset($_GET['supplier_id']), false, "", $js);
-}
+$js = "";
+if ($use_popup_windows)
+ $js .= get_js_open_window(900, 500);
+if ($use_date_picker)
+ $js .= get_js_date_picker();
+page(_($help_context = "Supplier Inquiry"), isset($_GET['supplier_id']), false, "", $js);
+
if (isset($_GET['supplier_id'])){
$_POST['supplier_id'] = $_GET['supplier_id'];
}
//------------------------------------------------------------------------------------------------
-if (!@$_GET['popup'])
- start_form();
+start_form();
if (!isset($_POST['supplier_id']))
$_POST['supplier_id'] = get_global_supplier();
start_table(TABLESTYLE_NOBORDER);
start_row();
-if (!@$_GET['popup'])
- supplier_list_cells(_("Select a supplier:"), 'supplier_id', null, true, false, false, !@$_GET['popup']);
+if (!$page_nested)
+ supplier_list_cells(_("Select a supplier:"), 'supplier_id', null, true, false, false, true);
date_cells(_("From:"), 'TransAfterDate', '', null, -30);
date_cells(_("To:"), 'TransToDate');
global $systypes_array;
return $systypes_array[$type];
}
+div_end();
function trans_view($trans)
{
function credit_link($row)
{
- if (@$_GET['popup'])
+ global $page_nested;
+
+ if ($page_nested)
return '';
return $row['type'] == ST_SUPPINVOICE && $row["TotalAmount"] - $row["Allocated"] > 0 ?
pager_link(_("Credit This"),
return $row['OverDue'] == 1
&& (abs($row["TotalAmount"]) - $row["Allocated"] != 0);
}
+
+function edit_link($row)
+{
+ return edit_trans_link($row['type'], $row['trans_no']);
+}
//------------------------------------------------------------------------------------------------
$sql = get_sql_for_supplier_inquiry();
_("Credit") => array('align'=>'right', 'insert'=>true,'fun'=>'fmt_credit'),
array('insert'=>true, 'fun'=>'gl_view'),
array('insert'=>true, 'fun'=>'credit_link'),
- array('insert'=>true, 'fun'=>'prt_link')
+ array('insert'=>true, 'fun'=>'prt_link'),
+ array('insert'=>true, 'fun'=>'edit_link')
);
if ($_POST['supplier_id'] != ALL_TEXT)
$cols[_("Supplier")] = 'skip';
$cols[_("Currency")] = 'skip';
}
-//------------------------------------------------------------------------------------------------
-
/*show a table of the transactions returned by the sql */
$table =& new_db_pager('trans_tbl', $sql, $cols);
display_db_pager($table);
-if (!@$_GET['popup'])
-{
- end_form();
- end_page(@$_GET['popup'], false, false);
-}
+end_form();
+end_page();
+
?>
$_POST['credit_limit'] = price_format($myrow["credit_limit"]);
$_POST['tax_group_id'] = $myrow["tax_group_id"];
$_POST['tax_included'] = $myrow["tax_included"];
+ $_POST['tax_algorithm'] = $myrow["tax_algorithm"];
$_POST['payable_account'] = $myrow["payable_account"];
$_POST['purchase_account'] = $myrow["purchase_account"];
$_POST['payment_discount_account'] = $myrow["payment_discount_account"];
$_POST['dimension_id'] = 0;
$_POST['dimension2_id'] = 0;
$_POST['tax_included'] = 0;
+ $_POST['tax_algorithm'] = 1;
$_POST['sales_type'] = -1;
$_POST['gst_no'] = $_POST['bank_account'] = '';
$_POST['payment_terms'] = '';
payment_terms_list_row(_("Payment Terms:"), 'payment_terms', null);
//
// tax_included option from supplier record is used directly in update_average_cost() function,
- // therefore we can't edit the option after any transaction waas done for the supplier.
+ // therefore we can't edit the option after any transaction was done for the supplier.
//
if (is_new_supplier($supplier_id))
check_row(_("Prices contain tax included:"), 'tax_included');
hidden('tax_included');
label_row(_("Prices contain tax included:"), $_POST['tax_included'] ? _('Yes') : _('No'));
}
+ tax_algorithm_list_row(_("Tax Calculation Algorithm:"), 'tax_algorithm', null);
+
+ if (!$supplier_id) table_section(2);
+
table_section_title(_("Accounts"));
gl_all_accounts_list_row(_("Accounts Payable Account:"), 'payable_account', $_POST['payable_account']);
gl_all_accounts_list_row(_("Purchase Account:"), 'purchase_account', $_POST['purchase_account'],
table_section_title(_("Contact Data"));
text_row(_("Phone Number:"), 'phone', null, 32, 30);
text_row(_("Secondary Phone Number:"), 'phone2', null, 32, 30);
+ table_section_title(_("Contact Data"));
+ text_row(_("Fax Number:"), 'fax', null, 32, 30);
+ email_row(_("E-mail:"), 'email', null, 35, 55);
+ languages_list_row(_("Document Language:"), 'rep_lang', null, _('System default'));
}
-
- table_section(2);
$dim = get_company_pref('use_dimension');
if ($dim >= 1)
{
hidden('dimension_id', 0);
if ($dim < 2)
hidden('dimension2_id', 0);
+ table_section(2);
table_section_title(_("Addresses"));
textarea_row(_("General Notes:"), 'notes', null, 35, 5);
if ($supplier_id)
record_status_list_row(_("Supplier status:"), 'inactive');
- else {
- table_section_title(_("Contact Data"));
- text_row(_("Contact Person:"), 'contact', null, 42, 40);
- text_row(_("Fax Number:"), 'fax', null, 32, 30);
- email_row(_("E-mail:"), 'email', null, 35, 55);
- languages_list_row(_("Document Language:"), 'rep_lang', null, _('System default'));
- }
end_outer_table(1);
div_start('controls');
$_POST['website'], $_POST['supp_account_no'], $_POST['bank_account'],
input_num('credit_limit', 0), $_POST['dimension_id'], $_POST['dimension2_id'], $_POST['curr_code'],
$_POST['payment_terms'], $_POST['payable_account'], $_POST['purchase_account'], $_POST['payment_discount_account'],
- $_POST['notes'], $_POST['tax_group_id'], @$_POST['tax_included']);
+ $_POST['notes'], $_POST['tax_group_id'], @$_POST['tax_included'], get_post('tax_algorithm'));
update_record_status($_POST['supplier_id'], $_POST['inactive'],
'suppliers', 'supplier_id');
$_POST['gst_no'], $_POST['website'], $_POST['supp_account_no'], $_POST['bank_account'],
input_num('credit_limit',0), $_POST['dimension_id'], $_POST['dimension2_id'],
$_POST['curr_code'], $_POST['payment_terms'], $_POST['payable_account'], $_POST['purchase_account'],
- $_POST['payment_discount_account'], $_POST['notes'], $_POST['tax_group_id'], check_value('tax_included'));
+ $_POST['payment_discount_account'], $_POST['notes'], $_POST['tax_group_id'], check_value('tax_included'), get_post('tax_algorithm'));
$supplier_id = $_POST['supplier_id'] = db_insert_id();
page($_SESSION['page_title'], false, false, "", $js);
+if (isset($_GET['ModifyOrderNumber']))
+ check_is_closed(ST_PURCHORDER, $_GET['ModifyOrderNumber']);
+
//---------------------------------------------------------------------------------------------------
check_db_has_suppliers(_("There are no suppliers defined in the system."));
set_focus('supplier_id');
return false;
}
-
+
if (!is_date($_POST['OrderDate']))
{
display_error(_("The entered order date is invalid."));
set_focus('OrderDate');
return false;
}
-
- if ($_SESSION['PO']->trans_type != ST_PURCHORDER && !is_date_in_fiscalyear($_POST['OrderDate']))
- {
- display_error(_("The entered date is not in fiscal year"));
+ if (($_SESSION['PO']->trans_type == ST_SUPPRECEIVE || $_SESSION['PO']->trans_type == ST_SUPPINVOICE)
+ && !is_date_in_fiscalyear($_POST['OrderDate'])) {
+ display_error(_("The entered date is out of fiscal year or is closed for further data entry."));
set_focus('OrderDate');
return false;
}
set_focus('due_date');
return false;
}
-
+
if (!$_SESSION['PO']->order_no)
{
if (!$Refs->is_valid(get_post('ref')))
set_focus('ref');
return false;
}
-
+
if (!is_new_reference(get_post('ref'), $_SESSION['PO']->trans_type))
{
display_error(_("The entered reference is already in use."));
return false;
}
}
-
+
if ($_SESSION['PO']->trans_type == ST_SUPPINVOICE && !$Refs->is_valid(get_post('supp_ref')))
{
display_error(_("You must enter a supplier's invoice reference."));
function handle_commit_order()
{
+ global $Refs, $type_shortcuts;
+
$cart = &$_SESSION['PO'];
if (can_commit()) {
$inv->reference = $ref;
$inv->supp_reference = $cart->supp_ref;
$inv->tax_included = $cart->tax_included;
+ $inv->tax_algorithm = $cart->tax_algorithm;
+ $inv->stored_algorithm = $cart->stored_algorithm;
$supp = get_supplier($cart->supplier_id);
$inv->tax_group_id = $supp['tax_group_id'];
-// $inv->ov_discount 'this isn't used at all'
- $inv->ov_amount = $inv->ov_gst = 0;
-
+ $total = 0;
+
foreach($cart->line_items as $key => $line) {
$inv->add_grn_to_trans($line->grn_item_id, $line->po_detail_rec, $line->stock_id,
$line->item_description, $line->receive_qty, 0, $line->receive_qty,
$line->price, $line->price, true, get_standard_cost($line->stock_id), '');
- $inv->ov_amount += round2(($line->receive_qty * $line->price), user_price_dec());
+ $total += round2(($line->receive_qty * $line->price), user_price_dec());
}
- $taxes = $inv->get_taxes($inv->tax_group_id, 0, false);
- foreach( $taxes as $taxitem) {
- $inv->ov_gst += round2($taxitem['Value'], user_price_dec());
+ if (!$inv->tax_included) {
+ $taxes = $inv->get_taxes($inv->tax_group_id, 0, false, $inv->tax_algorithm);
+ foreach( $taxes as $taxitem) {
+ $total += $taxitem['Value'];
+ }
}
+
$inv_no = add_supp_invoice($inv);
- commit_transaction(); // save PO+GRN+PI
- // FIXME payment for cash terms. (Needs cash account selection)
+ // presume supplier data need correction
+ if ($inv->stored_algorithm != $inv->tax_algorithm)
+ update_supp_tax_algorithm($inv->supplier_id, $inv->tax_algorithm);
+
+ if (get_post('cash_account')) {
+
+ $pmt_no = add_supp_payment($inv->supplier_id, $inv->tran_date, get_post('cash_account'),
+ $total, 0, $Refs->get_next(ST_SUPPAYMENT),
+ _('Payment for:').$inv->supp_reference .' ('.$type_shortcuts[ST_SUPPINVOICE].$inv_no.')');
+ add_supp_allocation($total, ST_SUPPAYMENT, $pmt_no, ST_SUPPINVOICE, $inv_no, $inv->tran_date);
+ update_supp_trans_allocation(ST_SUPPINVOICE, $inv_no, $total);
+ update_supp_trans_allocation(ST_SUPPAYMENT, $pmt_no, $total);
+
+ }
+
+ commit_transaction(); // save PO+GRN+PI(+SP)
+
unset($_SESSION['PO']);
meta_forward($_SERVER['PHP_SELF'], "AddedPI=$inv_no");
}
display_po_items($_SESSION['PO']);
start_table(TABLESTYLE2);
+
+if (list_updated('tax_algorithm')) {
+ $_SESSION['PO']->tax_algorithm = $_POST['tax_algorithm'];
+ $Ajax->activate('items_table');
+}
+
+if ($_SESSION['PO']->trans_type == ST_SUPPINVOICE) {
+ tax_algorithm_list_row(_("Tax algorithm:"), 'tax_algorithm', null, true);
+ cash_accounts_list_row(_("Payment:"), 'cash_account', null, false, _('Delayed'));
+}
+
textarea_row(_("Memo:"), 'Comments', null, 70, 4);
end_table(1);
set_focus('DefaultReceivedDate');
return false;
}
-
- if (!is_date_in_fiscalyear($_POST['DefaultReceivedDate']))
- {
- display_error(_("The entered date is not in fiscal year"));
+ if (!is_date_in_fiscalyear($_POST['DefaultReceivedDate'])) {
+ display_error(_("The entered date is out of fiscal year or is closed for further data entry."));
set_focus('DefaultReceivedDate');
return false;
}
$js .= get_js_open_window(900, 500);
if ($use_date_picker)
$js .= get_js_date_picker();
-page(_($help_context = "Supplier Credit Note"), false, false, "", $js);
//----------------------------------------------------------------------------------------
check_db_has_suppliers(_("There are no suppliers defined in the system."));
+if (isset($_GET['ModifyCredit']))
+ check_is_closed(ST_SUPPINVOICE, $_GET['ModifyCredit']);
+
+//---------------------------------------------------------------------------------------------------
+
+if (isset($_GET['New']))
+{
+ if (isset( $_SESSION['supp_trans']))
+ {
+ unset ($_SESSION['supp_trans']->grn_items);
+ unset ($_SESSION['supp_trans']->gl_codes);
+ unset ($_SESSION['supp_trans']);
+ }
+
+ if (isset($_GET['invoice_no']))
+ {
+ $_SESSION['supp_trans'] = new supp_trans(ST_SUPPINVOICE, $_GET['invoice_no']);
+ $_SESSION['supp_trans']->src_doc = $_GET['invoice_no'];
+
+
+ $_SESSION['supp_trans']->trans_type = ST_SUPPCREDIT;
+ $_SESSION['supp_trans']->trans_no = 0;
+ $_SESSION['supp_trans']->supp_reference = '';
+ // $_SESSION['supp_trans']->supp_reference = $_POST['invoice_no'] = $_GET['invoice_no'];
+ $help_context = "Supplier Credit Note";
+ $_SESSION['page_title'] = _("Supplier Credit Note");
+
+ $_SESSION['supp_trans'] = new supp_trans(ST_SUPPCREDIT);
+ } elseif (isset($_GET['ModifyInvoice'])) {
+ $help_context = 'Modifying Purchase Invoice';
+ $_SESSION['page_title'] = sprintf( _("Modifying Supplier Credit # %d"), $_GET['ModifyCredit']);
+ $_SESSION['supp_trans'] = new supp_trans(ST_SUPPCREDIT, $_GET['ModifyCredit']);
+ }
+}
+page($_SESSION['page_title'], false, false, "", $js);
+
//---------------------------------------------------------------------------------------------------------------
if (isset($_GET['AddedID']))
hyperlink_params($_SERVER['PHP_SELF'], _("Enter Another Credit Note"), "New=1");
hyperlink_params("$path_to_root/admin/attachments.php", _("Add an Attachment"), "filterType=$trans_type&trans_no=$invoice_no");
-
- display_footer_exit();
-}
-
-//---------------------------------------------------------------------------------------------------
-
-if (isset($_GET['New']))
-{
- if (isset( $_SESSION['supp_trans']))
- {
- unset ($_SESSION['supp_trans']->grn_items);
- unset ($_SESSION['supp_trans']->gl_codes);
- unset ($_SESSION['supp_trans']);
- }
- $_SESSION['supp_trans'] = new supp_trans(ST_SUPPCREDIT);
- if (isset($_GET['invoice_no']))
- {
- $_SESSION['supp_trans']->supp_reference = $_POST['invoice_no'] = $_GET['invoice_no'];
- }
+ display_footer_exit();
}
function clear_fields()
clear_fields();
}
-if (isset($_POST['AddGLCodeToTrans'])){
+if (isset($_POST['AddGLCodeToTrans'])) {
$Ajax->activate('gl_items');
$input_error = false;
function check_data()
{
global $total_grn_value, $total_gl_value, $Refs, $SysPrefs;
-
+
if (!$_SESSION['supp_trans']->is_valid_trans_to_post())
{
display_error(_("The credit note cannot be processed because the there are no items or values on the invoice. Credit notes are expected to have a charge."));
return false;
}
- if (!is_new_reference($_SESSION['supp_trans']->reference, ST_SUPPCREDIT))
+ if (!is_new_reference($_SESSION['supp_trans']->reference, ST_SUPPCREDIT, $_SESSION['supp_trans']->trans_no))
{
display_error(_("The entered reference is already in use."));
set_focus('reference');
}
elseif (!is_date_in_fiscalyear($_SESSION['supp_trans']->tran_date))
{
- display_error(_("The entered date is not in fiscal year."));
+ display_error(_("The entered date is out of fiscal year or is closed for further data entry."));
set_focus('tran_date');
return false;
}
$js .= get_js_open_window(900, 500);
if ($use_date_picker)
$js .= get_js_date_picker();
-page(_($help_context = "Enter Supplier Invoice"), false, false, "", $js);
-
//----------------------------------------------------------------------------------------
check_db_has_suppliers(_("There are no suppliers defined in the system."));
+if (isset($_GET['ModifyInvoice']))
+ check_is_closed(ST_SUPPINVOICE, $_GET['ModifyInvoice']);
+
+//--------------------------------------------------------------------------------------------------
+
+if (isset($_GET['New']))
+{
+ if (isset( $_SESSION['supp_trans']))
+ {
+ unset ($_SESSION['supp_trans']->grn_items);
+ unset ($_SESSION['supp_trans']->gl_codes);
+ unset ($_SESSION['supp_trans']);
+ }
+ $help_context = "Enter Supplier Invoice";
+ $_SESSION['page_title'] = _("Enter Supplier Invoice");
+
+ $_SESSION['supp_trans'] = new supp_trans(ST_SUPPINVOICE);
+} else if(isset($_GET['ModifyInvoice'])) {
+ $help_context = 'Modifying Purchase Invoice';
+ $_SESSION['page_title'] = sprintf( _("Modifying Purchase Invoice # %d"), $_GET['ModifyInvoice']);
+ $_SESSION['supp_trans'] = new supp_trans(ST_SUPPINVOICE, $_GET['ModifyInvoice']);
+}
+
+page($_SESSION['page_title'], false, false, "", $js);
//---------------------------------------------------------------------------------------------------------------
if (isset($_GET['AddedID']))
}
$_SESSION['supp_trans'] = new supp_trans(ST_SUPPINVOICE);
+} else if(isset($_GET['ModifyInvoice'])) {
+ $_SESSION['supp_trans'] = new supp_trans(ST_SUPPINVOICE, $_GET['ModifyInvoice']);
}
//--------------------------------------------------------------------------------------------------
return false;
}
- if (!is_new_reference($_SESSION['supp_trans']->reference, ST_SUPPINVOICE))
+ if (!is_new_reference($_SESSION['supp_trans']->reference, ST_SUPPINVOICE, $_SESSION['supp_trans']->trans_no))
{
display_error(_("The entered reference is already in use."));
set_focus('reference');
}
elseif (!is_date_in_fiscalyear($_SESSION['supp_trans']->tran_date))
{
- display_error(_("The entered date is not in fiscal year."));
+ display_error(_("The entered date is out of fiscal year or is closed for further data entry."));
set_focus('trans_date');
return false;
}
return false;
}
- if (is_reference_already_there($_SESSION['supp_trans']->supplier_id, $_POST['supp_reference']))
+ if (is_reference_already_there($_SESSION['supp_trans']->supplier_id, $_POST['supp_reference'], $_SESSION['supp_trans']->trans_no))
{ /*Transaction reference already entered */
display_error(_("This invoice number has already been entered. It cannot be entered again.") . " (" . $_POST['supp_reference'] . ")");
return false;
if (!check_data())
return;
+ $inv = $_SESSION['supp_trans'];
+ $invoice_no = add_supp_invoice($inv);
- $invoice_no = add_supp_invoice($_SESSION['supp_trans']);
+ // presume supplier data need correction
+ if ($inv->stored_algorithm != $inv->tax_algorithm)
+ update_supp_tax_algorithm($inv->supplier_id, $inv->tax_algorithm);
$_SESSION['supp_trans']->clear_items();
unset($_SESSION['supp_trans']);
{
global $check_price_charged_vs_order_price,
$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."));
{
if (check_item_data($n))
{
+ if (input_num('this_quantity_inv'.$n) >= ($_POST['qty_recd'.$n] - $_POST['prev_quantity_inv'.$n]))
+ {
+ $complete = true;
+ }
+ else
+ {
+ $complete = false;
+ }
+
$_SESSION['supp_trans']->add_grn_to_trans($n, $_POST['po_detail_item'.$n],
$_POST['item_code'.$n], $_POST['item_description'.$n], $_POST['qty_recd'.$n],
$_POST['prev_quantity_inv'.$n], input_num('this_quantity_inv'.$n),
- $_POST['order_price'.$n], input_num('ChgPrice'.$n),
+ $_POST['order_price'.$n], input_num('ChgPrice'.$n), $complete,
$_POST['std_cost_unit'.$n], "");
}
}
}
elseif (!is_date_in_fiscalyear($_POST['DatePaid']))
{
- display_error(_("The entered date is not in fiscal year."));
+ display_error(_("The entered date is out of fiscal year or is closed for further data entry."));
set_focus('DatePaid');
return false;
}
supplier_list_row(_("Payment To:"), 'supplier_id', null, false, true);
set_global_supplier($_POST['supplier_id']);
-
+
if (!list_updated('bank_account'))
$_POST['bank_account'] = get_default_supplier_bank_account($_POST['supplier_id']);
-
+
bank_accounts_list_row(_("From Bank Account:"), 'bank_account', null, true);
-
+
bank_balance_row($_POST['bank_account']);
table_section(2);
$path_to_root = "../..";
include_once($path_to_root . "/purchasing/includes/purchasing_db.inc");
+include_once($path_to_root . "/includes/ui/items_cart.inc");
include_once($path_to_root . "/includes/session.inc");
include_once($path_to_root . "/purchasing/includes/purchasing_ui.inc");
$display_total = number_format2($supp_trans->ov_amount + $supp_trans->ov_gst,user_price_dec());
-label_row(_("TOTAL INVOICE"), $display_total, "colspan=1 align=right", "nowrap align=right");
+label_row(_("TOTAL INVOICE").' ('.$supplier_curr_code.')', $display_total, "colspan=1 align=right", "nowrap align=right");
end_table(1);
{
default : $fontname = "freesans13"; break;
}
- }
+ }
// else use built-in adobe fonts helvetica.
}
$this->SetFont($fontname, $style);
foreach(explode("\n", $this->company['legal_text']) as $line)
$Footer[] = $line;
}
-
-?>
function End($email=0, $subject='')
{
- global $path_to_root;
++$this->y;
for ($i = 0; $i < $this->numcols; $i++)
$this->sheet->writeBlank($this->y, $i, $this->formatFooter);
$rep->TextCol(4, 5, $DisplayPrice, -2);
$rep->TextCol(5, 6, $DisplayDiscount, -2);
$rep->TextCol(6, 7, $DisplayNet, -2);
- }
+ }
$rep->row = $newrow;
//$rep->NewLine(1);
if ($rep->row < $rep->bottomMargin + (15 * $rep->lineHeight))
if ($tax_item['amount'] == 0)
continue;
$DisplayTax = number_format2($sign*$tax_item['amount'], $dec);
-
+
if (isset($suppress_tax_rates) && $suppress_tax_rates == 1)
$tax_type_name = $tax_item['tax_type_name'];
else
$rep->TextCol(4, 5, $DisplayPrice, -2);
$rep->TextCol(5, 6, $DisplayDiscount, -2);
$rep->TextCol(6, 7, $DisplayNet, -2);
- }
+ }
$rep->row = $newrow;
//$rep->NewLine(1);
if ($rep->row < $rep->bottomMargin + (15 * $rep->lineHeight))
{
if ($myrow2["quantity"] == 0)
continue;
-
+
$Net = round2(((1 - $myrow2["discount_percent"]) * $myrow2["unit_price"] * $myrow2["quantity"]),
user_price_dec());
$SubTotal += $Net;
$newrow = $rep->row;
$rep->row = $oldrow;
if ($Net != 0.0 || !is_service($myrow2['mb_flag']) || !isset($no_zero_lines_amount) || $no_zero_lines_amount == 0)
- {
+ {
$rep->TextCol(2, 3, $DisplayQty, -2);
$rep->TextCol(3, 4, $myrow2['units'], -2);
if ($packing_slip == 0)
$rep->TextCol(5, 6, $DisplayDiscount, -2);
$rep->TextCol(6, 7, $DisplayNet, -2);
}
- }
+ }
$rep->row = $newrow;
//$rep->NewLine(1);
if ($rep->row < $rep->bottomMargin + (15 * $rep->lineHeight))
$rep->TextCol(4, 5, $DisplayPrice, -2);
$rep->TextCol(5, 6, $DisplayDiscount, -2);
$rep->TextCol(6, 7, $DisplayNet, -2);
- }
+ }
$rep->row = $newrow;
//$rep->NewLine(1);
if ($rep->row < $rep->bottomMargin + (15 * $rep->lineHeight))
$DisplaySubTot = number_format2($SubTotal,$dec);
$DisplayFreight = number_format2($myrow["freight_cost"],$dec);
- $rep->row = $rep->bottomMargin + (15 * $rep->lineHeight);
$doctype = ST_SALESQUOTE;
$rep->TextCol(3, 6, _("Sub-total"), -2);
{
$myrow = get_receipt($j, $i);
if (!$myrow)
- continue;
+ continue;
$res = get_bank_trans($j, $i);
$baccount = db_fetch($res);
$params['bankaccount'] = $baccount['bank_act'];
$total_allocated = 0;
$rep->TextCol(0, 4, _("As advance / full / part / payment towards:"), -2);
$rep->NewLine(2);
-
+
while ($myrow2=db_fetch($result))
{
$rep->TextCol(0, 1, $systypes_array[$myrow2['type']], -2);
{
$rep->NewLine(1);
$rep->TextCol(0, 7, $myrow['curr_code'] . ": " . $words, - 2);
- }
+ }
$rep->Font();
$rep->NewLine();
$rep->TextCol(6, 7, _("Received / Sign"), - 2);
$rep->TextCol(4, 5, _("Branch"), - 2);
$rep->TextCol(5, 6, "__________________", - 2);
$rep->TextCol(6, 7, "__________________");
- }
+ }
}
$rep->End();
}
// Revomed allocated from sql
if ($all)
$value = "(".TB_PREF."supp_trans.ov_amount + ".TB_PREF."supp_trans.ov_gst + ".TB_PREF."supp_trans.ov_discount)";
- else
+ else
$value = "IF (".TB_PREF."supp_trans.type=".ST_SUPPINVOICE." OR ".TB_PREF."supp_trans.type=".ST_BANKDEPOSIT.",
(".TB_PREF."supp_trans.ov_amount + ".TB_PREF."supp_trans.ov_gst + ".TB_PREF."supp_trans.ov_discount - ".TB_PREF."supp_trans.alloc),
(".TB_PREF."supp_trans.ov_amount + ".TB_PREF."supp_trans.ov_gst + ".TB_PREF."supp_trans.ov_discount + ".TB_PREF."supp_trans.alloc))";
function get_po($order_no)
{
$sql = "SELECT ".TB_PREF."purch_orders.*, ".TB_PREF."suppliers.supp_name, "
- .TB_PREF."suppliers.supp_account_no,".TB_PREF."suppliers.tax_included,
+ .TB_PREF."suppliers.supp_account_no,".TB_PREF."suppliers.tax_included,".TB_PREF."suppliers.tax_algorithm,
".TB_PREF."suppliers.curr_code, ".TB_PREF."suppliers.payment_terms, ".TB_PREF."locations.location_name,
".TB_PREF."suppliers.address, ".TB_PREF."suppliers.contact, ".TB_PREF."suppliers.tax_group_id
FROM ".TB_PREF."purch_orders, ".TB_PREF."suppliers, ".TB_PREF."locations
$rep->NewLine();
$tax_items = get_tax_for_items($items, $prices, 0,
- $myrow['tax_group_id'], $myrow['tax_included'], null);
+ $myrow['tax_group_id'], $myrow['tax_included'], null, $myrow['tax_algorithm']);
$first = true;
foreach($tax_items as $tax_item)
{
continue;
$DisplayTax = number_format2($tax_item['Value'], $dec);
- $tax_type_name = $tax_item['tax_type_name'];
+ if (isset($suppress_tax_rates) && $suppress_tax_rates == 1)
+ $tax_type_name = $tax_item['tax_type_name'];
+ else
+ $tax_type_name = $tax_item['tax_type_name']." (".$tax_item['rate']."%) ";
if ($myrow['tax_included'])
{
{
$myrow = get_remittance($j, $i);
if (!$myrow)
- continue;
+ continue;
$res = get_bank_trans($j, $i);
$baccount = db_fetch($res);
$params['bankaccount'] = $baccount['bank_act'];
$total_allocated = 0;
$rep->TextCol(0, 4, _("As advance / full / part / payment towards:"), -2);
$rep->NewLine(2);
-
+
while ($myrow2=db_fetch($result))
{
$rep->TextCol(0, 1, $systypes_array[$myrow2['type']], -2);
{
$rep->NewLine(2);
$rep->TextCol(1, 7, $myrow['curr_code'] . ": " . $words, - 2);
- }
+ }
$rep->Font();
if ($email == 1)
{
$myrow['DebtorName'] = $myrow['supp_name'];
$rep->End($email);
}
- }
+ }
}
if ($email == 0)
$rep->End();
{
$from = date2sql($from);
$to = date2sql($to);
-
+
$sql = "SELECT ".TB_PREF."grn_batch.id batch_no,
".TB_PREF."grn_batch.supplier_id,
".TB_PREF."purch_order_details.*,
AND ".TB_PREF."grn_batch.delivery_date>='$from'
AND ".TB_PREF."grn_batch.delivery_date<='$to'
ORDER BY ".TB_PREF."stock_master.stock_id, ".TB_PREF."grn_batch.delivery_date";
-
+
return db_query($sql,"No transactions were returned");
}
$rep->TextCol(2, 3, $trans['order_no']);
$qdec = get_qty_dec($trans['item_code']);
$rep->TextCol(3, 4, $trans['batch_no']);
-
+
if ($trans['quantity_inv'])
{
$suppinv = getSuppInvDetails($trans['grn_item_id']);
$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_name($myrow["person_type_id"],$myrow["person_id"], false));
+ $rep->TextCol(4, 5, get_counterparty_name($myrow["type"], $myrow["trans_no"], false));
if ($myrow['amount'] > 0.0)
{
$rep->AmountCol(5, 6, abs($myrow['amount']), $dec);
--- /dev/null
+<?php
+/**********************************************************************
+ Copyright (C) FrontAccounting, LLC.
+ Released under the terms of the GNU General Public License, GPL,
+ as published by the Free Software Foundation, either version 3
+ of the License, or (at your option) any later version.
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ See the License here <http://www.gnu.org/licenses/gpl-3.0.html>.
+***********************************************************************/
+$page_security = 'SA_BANKREP';
+// ----------------------------------------------------------------
+// $ Revision: 2.3.3-1
+// Creator: Chaitanya-India <3chaitanya@gmail.com>
+// date_: 2005-05-19
+// Title: Bank Statements w/Reconcile
+// Desc: Bank Statement w/ Reconcile like the normal Bank Statement but with reconcile columns\r
+// ----------------------------------------------------------------
+$path_to_root="..";
+
+include_once($path_to_root . "/includes/session.inc");
+include_once($path_to_root . "/includes/date_functions.inc");
+include_once($path_to_root . "/includes/data_checks.inc");
+include_once($path_to_root . "/gl/includes/gl_db.inc");
+
+//----------------------------------------------------------------------------------------------------
+
+print_bank_transactions_reconcile();
+
+//----------------------------------------------------------------------------------------------------
+
+function get_bank_balance_to($to, $account)
+{
+ $to = date2sql($to);
+ $sql = "SELECT SUM(amount) FROM ".TB_PREF."bank_trans WHERE bank_act='$account'
+ AND trans_date < '$to'";
+ $result = db_query($sql, "The starting balance on hand could not be calculated");
+ $row = db_fetch_row($result);
+ return $row[0];
+}
+
+function get_bank_transactions($from, $to, $account)
+{
+ $from = date2sql($from);
+ $to = date2sql($to);
+ $sql = "SELECT ".TB_PREF."bank_trans.*, ".TB_PREF."comments.memo_\r
+ FROM ".TB_PREF."bank_trans LEFT JOIN ".TB_PREF."comments ON \r
+ (".TB_PREF."bank_trans.type = ".TB_PREF."comments.type\r
+ AND ".TB_PREF."bank_trans.trans_no = ".TB_PREF."comments.id)\r
+ WHERE ".TB_PREF."bank_trans.bank_act = '$account'
+ AND trans_date >= '$from'
+ AND trans_date <= '$to'
+ ORDER BY trans_date,".TB_PREF."bank_trans.id";
+
+ return db_query($sql,"The transactions for '$account' could not be retrieved");
+}
+
+function print_bank_transactions_reconcile()
+{
+ global $path_to_root, $systypes_array;
+
+ $acc = $_POST['PARAM_0'];
+ $from = $_POST['PARAM_1'];
+ $to = $_POST['PARAM_2'];
+ $comments = $_POST['PARAM_3'];
+ $destination = $_POST['PARAM_4'];
+ if ($destination)
+ include_once($path_to_root . "/reporting/includes/excel_report.inc");
+ else
+ include_once($path_to_root . "/reporting/includes/pdf_report.inc");
+
+ $rep = new FrontReport(_('Bank Statement w/Reconcile'), "BankStatementReconcile", user_pagesize(), 9, "L");
+ $dec = user_price_dec();
+
+ $cols = array(0, 90, 110, 170, 225, 450, 500, 550, 600, 660, 700);\r
+
+ $aligns = array('left', 'left', 'left', 'left', 'left', 'right', 'right', 'right', 'center', 'left');\r
+
+ $headers = array(_('Type'), _('#'), _('Reference'), _('Date'), _('Person/Item'),
+ _('Debit'), _('Credit'), _('Balance'), _('Reco Date'), _('Narration'));\r
+
+ $account = get_bank_account($acc);
+ $act = $account['bank_account_name']." - ".$account['bank_curr_code']." - ".$account['bank_account_number'];
+ $params = array( 0 => $comments,
+ 1 => array('text' => _('Period'), 'from' => $from, 'to' => $to),
+ 2 => array('text' => _('Bank Account'),'from' => $act,'to' => ''));
+
+ $rep->Font();
+ $rep->Info($params, $cols, $headers, $aligns);
+ $rep->NewPage();
+
+
+ $prev_balance = get_bank_balance_to($from, $account["id"]);
+
+ $trans = get_bank_transactions($from, $to, $account['id']);
+
+ $rows = db_num_rows($trans);
+ if ($prev_balance != 0.0 || $rows != 0)
+ {
+ $rep->Font('bold');
+ $rep->TextCol(0, 3, $act);
+ $rep->TextCol(3, 5, _('Opening Balance'));
+ if ($prev_balance > 0.0)
+ $rep->AmountCol(5, 6, abs($prev_balance), $dec);
+ else
+ $rep->AmountCol(6, 7, abs($prev_balance), $dec);
+ $rep->Font();
+ $total = $prev_balance;
+ $rep->NewLine(2);
+ if ($rows > 0)
+ {
+ // Keep a running total as we loop through
+ // the transactions.
+ $total_debit = $total_credit = 0; \r
+
+ while ($myrow=db_fetch($trans))
+ {
+ $total += $myrow['amount'];
+
+ $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_name($myrow["person_type_id"],$myrow["person_id"], false));
+ if ($myrow['amount'] > 0.0)
+ {
+ $rep->AmountCol(5, 6, abs($myrow['amount']), $dec);
+ $total_debit += abs($myrow['amount']);
+ }
+ else
+ {
+ $rep->AmountCol(6, 7, abs($myrow['amount']), $dec);
+ $total_credit += abs($myrow['amount']);
+ }
+ $rep->AmountCol(7, 8, $total, $dec);
+ if ($myrow["reconciled"] && $myrow["reconciled"] != '0000-00-00')\r
+ $rep->DateCol(8, 9, $myrow["reconciled"], true);\r
+ $rep->TextCol(9, 10, $myrow['memo_']);\r
+ $rep->NewLine();
+ if ($rep->row < $rep->bottomMargin + $rep->lineHeight)
+ {
+ $rep->Line($rep->row - 2);
+ $rep->NewPage();
+ }
+ }
+ $rep->NewLine();
+ }
+
+ // Print totals for the debit and credit columns.
+ $rep->TextCol(3, 5, _("Total Debit / Credit"));
+ $rep->AmountCol(5, 6, $total_debit, $dec);
+ $rep->AmountCol(6, 7, $total_credit, $dec);
+ $rep->NewLine(2);
+
+ $rep->Font('bold');
+ $rep->TextCol(3, 5, _("Ending Balance"));
+ if ($total > 0.0)
+ $rep->AmountCol(5, 6, abs($total), $dec);
+ else
+ $rep->AmountCol(6, 7, abs($total), $dec);
+ $rep->Font();
+ $rep->NewLine(2); \r
+
+ // Print the difference between starting and ending balances.
+ $net_change = ($total - $prev_balance);
+ $rep->TextCol(3, 5, _("Net Change"));
+ if ($total > 0.0)
+ $rep->AmountCol(5, 6, $net_change, $dec, 0, 0, 0, 0, null, 1, True);
+ else
+ $rep->AmountCol(6, 7, $net_change, $dec, 0, 0, 0, 0, null, 1, True);
+ $rep->Font();\r
+ $rep->NewLine(2); \r
+ \r
+ // Calculate Bank Balance as per reco\r
+ $date = date2sql($to);\r
+ $sql = "SELECT SUM(IF(reconciled<='$date' AND reconciled !='0000-00-00', amount, 0)) as reconciled,\r
+ SUM(amount) as books_total\r
+ FROM ".TB_PREF."bank_trans trans\r
+ WHERE bank_act=".db_escape($account['id'])."\r
+ AND trans_date <= '$date'"; \r
+ \r
+ // ." AND trans.reconciled IS NOT NULL";\r
+ //display_notification($sql);\r
+ $t_result = db_query($sql,"Cannot retrieve reconciliation data");\r
+\r
+ if ($t_row = db_fetch($t_result)) {\r
+ $books_total = $t_row['books_total'];\r
+ $reconciled = $t_row['reconciled'];\r
+ } \r
+ $difference = $books_total - $reconciled; \r
+ \r
+ // Bank Balance (by Reco)\r
+ $rep->Font('bold');\r
+ $rep->TextCol(3, 5, _("Bank Balance"));\r
+ if ($reconciled > 0.0)\r
+ $rep->AmountCol(5, 6, abs($reconciled), $dec);\r
+ else\r
+ $rep->AmountCol(6, 7, abs($reconciled), $dec);\r
+ $rep->Font();\r
+ $rep->NewLine(2); \r
+\r
+ // Reco Difference\r
+ $rep->Font('bold');\r
+ $rep->TextCol(3, 5, _("Difference"));\r
+ if ($difference > 0.0)\r
+ $rep->AmountCol(5, 6, abs($difference), $dec);\r
+ else\r
+ $rep->AmountCol(6, 7, abs($difference), $dec);\r
+ $rep->Font();\r
+ $rep->NewLine(2); \r
+ \r
+ $rep->Line($rep->row - $rep->lineHeight + 4);\r
+ $rep->NewLine(2, 1); \r
+ \r
+ }
+ $rep->End();
+}
+
+?>
\ No newline at end of file
function display_type ($type, $typename, &$dec, &$rep, $showbalance, $level)
{
$printtitle = 0; //Flag for printing type name
-
+
//Get Accounts directly under this group/type
$result = get_gl_accounts(null, null, $type);
while ($account=db_fetch($result))
for ($sp=1; $sp<=$level; $sp++)
{
$prefix .= ' ';
- }
+ }
$printtitle = 1;
$rep->row -= 4;
$rep->TextCol(0, 1, $type);
$rep->AmountCol(3, 4, $balance, $dec);
$rep->NewLine();
}
-
+
//Get Account groups/types under this group/type
$result = get_account_types(false, false, $type);
while ($accounttype=db_fetch($result))
$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_name($myrow["person_type_id"],$myrow["person_id"]);
+ $coms = get_subaccount_name($myrow["account"], $myrow["person_id"]);
$memo = get_comments_string($myrow['type'], $myrow['type_no']);
if ($memo != '')
{
$rep->Font();
$rep->Info($params, $cols, $headers, $aligns, $cols2, $headers2, $aligns2);
$rep->NewPage();
-
+
$classresult = get_account_classes(false);
while ($class = db_fetch($classresult))
{
else
$rep->AmountCol(7, 8, abs($tbal), $dec);
$rep->NewLine();
-
+
$rep->Line($rep->row + 10);
if (($pbal = round2($pbal, $dec)) != 0.0 && $dimension == 0 && $dimension2 == 0)
{
function print_tax_report()
{
global $path_to_root, $trans_dir, $Hooks, $systypes_array;
-
+
$from = $_POST['PARAM_0'];
$to = $_POST['PARAM_1'];
$summaryOnly = $_POST['PARAM_2'];
$trans['net_amount'] *= -1;
$trans['amount'] *= -1;
}
-
+
if (!$summaryOnly)
{
$rep->TextCol(0, 1, $systypes_array[$trans['trans_type']]);
$rep->AmountCol(5, 6, $trans['net_amount'], $dec);
$rep->AmountCol(6, 7, $trans['rate'], $dec);
$rep->AmountCol(7, 8, $trans['amount'], $dec);
-
+
$rep->TextCol(9, 10, $trans['taxname']);
$rep->NewLine();
_('Currency Filter') => 'CURRENCY',
_('Email Customers') => 'YES_NO',
_('Comments') => 'TEXTBOX'));
-$reports->addReport(RC_SUPPLIER, 210, _('Print Remittances'),
+$reports->addReport(RC_SUPPLIER, 210, _('Print Remi&ttances'),
array( _('From') => 'REMITTANCE',
_('To') => 'REMITTANCE',
_('Currency Filter') => 'CURRENCY',
$reports->addReportClass(_('Inventory'), RC_INVENTORY);
$reports->addReport(RC_INVENTORY, 301, _('Inventory &Valuation Report'),
- array( _('End Date') => 'DATE',
+ array( _('End Date') => 'DATE',
_('Inventory Category') => 'CATEGORIES',
_('Location') => 'LOCATIONS',
_('Summary Only') => 'YES_NO',
}
}
else
- display_error(_("The entered date is not in fiscal year."));
+ display_error(_("The entered date is out of fiscal year or is closed for further data entry."));
}
$result = get_recurrent_invoices();
set_focus('OrderDate');
$input_error = 1;
} elseif (!is_date_in_fiscalyear($_POST['OrderDate'])) {
- display_error(_("The entered date is not in fiscal year."));
+ display_error(_("The entered date is out of fiscal year or is closed for further data entry."));
set_focus('OrderDate');
$input_error = 1;
}
set_focus('CreditDate');
return false;
} elseif (!is_date_in_fiscalyear($_POST['CreditDate'])) {
- display_error(_("The entered date is not in fiscal year."));
+ display_error(_("The entered date is out of fiscal year or is closed for further data entry."));
set_focus('CreditDate');
return false;
}
} elseif (isset($_GET['ModifyDelivery']) && $_GET['ModifyDelivery'] > 0) {
- $_SESSION['Items'] = new Cart(ST_CUSTDELIVERY, $_GET['ModifyDelivery']);
+ check_is_closed(ST_CUSTDELIVERY, $_GET['ModifyDelivery']);
+ $_SESSION['Items'] = new Cart(ST_CUSTDELIVERY,$_GET['ModifyDelivery']);
if ($_SESSION['Items']->count_items() == 0) {
hyperlink_params($path_to_root . "/sales/inquiry/sales_orders_view.php",
}
if (!is_date_in_fiscalyear($_POST['DispatchDate'])) {
- display_error(_("The entered date of delivery is not in fiscal year."));
+ display_error(_("The entered date is out of fiscal year or is closed for further data entry."));
set_focus('DispatchDate');
return false;
}
if (!$newdelivery)
{
$delivered = get_already_delivered($itm->stock_id, $_POST['Location'], key($dn->trans_no));
-
+
$qoh_abs = $qoh_abs - $delivered;
$qoh_by_date = $qoh_by_date - $delivered;
}
} elseif (isset($_GET['ModifyInvoice']) && $_GET['ModifyInvoice'] > 0) {
+ check_is_closed(ST_SALESINVOICE, $_GET['ModifyInvoice']);
+
if ( get_sales_parent_numbers(ST_SALESINVOICE, $_GET['ModifyInvoice']) == 0) { // 1.xx compatibility hack
echo"<center><br><b>" . _("There are no delivery notes for this invoice.<br>
Most likely this invoice was created in Front Accounting version prior to 2.0
}
if (!is_date_in_fiscalyear($_POST['InvoiceDate'])) {
- display_error(_("The entered invoice date is not in fiscal year."));
+ display_error(_("The entered date is out of fiscal year or is closed for further data entry."));
set_focus('InvoiceDate');
return false;
}
set_focus('DateBanked');
return false;
} elseif (!is_date_in_fiscalyear($_POST['DateBanked'])) {
- display_error(_("The entered date is not in fiscal year."));
+ display_error(_("The entered date is out of fiscal year or is closed for further data entry."));
set_focus('DateBanked');
return false;
}
display_error( _("The entered reference is already in use."));
display_footer_exit();
}
-}
+}
$new = $_SESSION['alloc']->trans_no == 0;
if (list_updated('customer_id') || ($new && list_updated('bank_account'))) {
//Chaitanya : 13-OCT-2011 - Is AJAX call really needed ???
//bank_accounts_list_row(_("Into Bank Account:"), 'bank_account', null, true);
bank_accounts_list_row(_("Into Bank Account:"), 'bank_account', null, false);
-
text_row(_("Reference:"), 'ref', null, 20, 40);
table_section(3);
var $tax_group_array = null; // saves db queries
var $price_factor; // ditto for price calculations
- var $pos; // user assigned POS (contains cash accont number/name)
+ var $pos; // user assigned POS
+ var $cash_account;
+ var $account_name;
var $cash_discount; // not used as of FA 2.1
var $dimension_id;
var $dimension2_id;
//-------------------------------------------------------------------------
//
// $trans_no==0 => open new/direct document
- // $trans_no!=0 && $prep_child==false => update with parent constarints for reedition
- // $trans_no!=0 && $prep_child==true => prepare for child doc entry
+ // $trans_no!=0 && $no_edit==false => update with parent constarints for reedition
+ // $trans_no!=0 && $no_edit==true => read only: for view, or later child doc entry
//
function Cart($type, $trans_no=0, $prep_child=false) {
/*Constructor function initialises a new shopping cart */
// Writing new/modified sales document to database.
// Makes parent documents for direct delivery/invoice by recurent call.
// $policy - 0 or 1: writeoff/return for IV, back order/cancel for DN
- function write($policy=0) {
+ function write($policy=0) {
begin_transaction(); // prevents partial database changes in case of direct delivery/invoice
if (count($this->src_docs) == 0 && ($this->trans_type == ST_SALESINVOICE || $this->trans_type == ST_CUSTDELIVERY)) {
// this is direct document - first add parent
function get_shipping_tax()
{
- $tax_items = get_shipping_tax_as_array();
+ $tax_items = get_shipping_tax_as_array($this->tax_group_id);
$tax_rate = 0;
if ($tax_items != null) {
foreach ($tax_items as $item_tax) {
function add_branch($customer_id, $br_name, $br_ref, $br_address, $salesman, $area,
$tax_group_id, $sales_account, $sales_discount_account, $receivables_account,
$payment_discount_account, $default_location, $br_post_address, $disable_trans, $group_no,
- $default_ship_via, $notes)
+ $default_ship_via, $notes, $bank_account)
{
$sql = "INSERT INTO ".TB_PREF."cust_branch (debtor_no, br_name, branch_ref, br_address,
salesman, area, tax_group_id, sales_account, receivables_account, payment_discount_account,
sales_discount_account, default_location,
- br_post_address, disable_trans, group_no, default_ship_via, notes)
+ br_post_address, disable_trans, group_no, default_ship_via, notes, bank_account)
VALUES (".db_escape($customer_id). ",".db_escape($br_name) . ", "
.db_escape($br_ref) . ", "
.db_escape($br_address) . ", ".db_escape($salesman) . ", "
.db_escape($disable_trans) . ", "
.db_escape($group_no) . ", "
.db_escape($default_ship_via). ", "
- .db_escape($notes).")";
+ .db_escape($notes). ", "
+ .db_escape($bank_account, true).")";
db_query($sql,"The branch record could not be added");
}
function update_branch($customer_id, $branch_code, $br_name, $br_ref, $br_address,
$salesman, $area, $tax_group_id, $sales_account, $sales_discount_account, $receivables_account,
$payment_discount_account, $default_location, $br_post_address, $disable_trans, $group_no,
- $default_ship_via, $notes)
+ $default_ship_via, $notes, $bank_account)
{
$sql = "UPDATE ".TB_PREF."cust_branch SET br_name = " . db_escape($br_name) . ",
branch_ref = " . db_escape($br_ref) . ",
disable_trans=".db_escape($disable_trans) . ",
group_no=".db_escape($group_no) . ",
default_ship_via=".db_escape($default_ship_via) . ",
- notes=".db_escape($notes) . "
+ notes=".db_escape($notes) . ",
+ bank_account=".db_escape($bank_account, true)."
WHERE branch_code =".db_escape($branch_code) . "
AND debtor_no=".db_escape($customer_id);
db_query($sql,"The branch record could not be updated");
$sql .= implode(' OR ', $trans_no) . ')';
$res = db_query($sql, 'document version retreival');
-
+
$vers = array();
while($mysql=db_fetch($res)) {
$vers[$mysql['trans_no']] = $mysql['version'];
function write_customer_trans($trans_type, $trans_no, $debtor_no, $BranchNo,
$date_, $reference, $Total, $discount=0, $Tax=0, $Freight=0, $FreightTax=0,
$sales_type=0, $order_no=0, $ship_via=0, $due_date="",
- $AllocAmt=0, $rate=0, $dimension_id=0, $dimension2_id=0, $payment_terms=null)
+ $AllocAmt=0, $rate=0, $dimension_id=0, $dimension2_id=0, $payment_terms=null, $tax_included=0)
{
$new = $trans_no==0;
$curr = get_customer_currency($debtor_no);
order_, ov_amount, ov_discount,
ov_gst, ov_freight, ov_freight_tax,
rate, ship_via, alloc,
- dimension_id, dimension2_id, payment_terms
+ dimension_id, dimension2_id, payment_terms, tax_included
) VALUES (".db_escape($trans_no).", ".db_escape($trans_type).",
".db_escape($debtor_no).", ".db_escape($BranchNo).",
'$SQLDate', '$SQLDueDate', ".db_escape($reference).",
".db_escape($Freight).",
$FreightTax, $rate, ".db_escape($ship_via).", $AllocAmt,
".db_escape($dimension_id).", ".db_escape($dimension2_id).", "
- .db_escape($payment_terms, true).")";
+ .db_escape($payment_terms, true).", "
+ .db_escape($tax_included).")";
} else { // may be optional argument should stay unchanged ?
$sql = "UPDATE ".TB_PREF."debtor_trans SET
debtor_no=".db_escape($debtor_no)." , branch_code=".db_escape($BranchNo).",
ov_freight=".db_escape($Freight).", ov_freight_tax=$FreightTax, rate=$rate,
ship_via=".db_escape($ship_via).", alloc=$AllocAmt,
dimension_id=".db_escape($dimension_id).", dimension2_id=".db_escape($dimension2_id).",
- payment_terms=".db_escape($payment_terms)."
+ payment_terms=".db_escape($payment_terms).",
+ tax_included=".db_escape($tax_included)."
WHERE trans_no=".db_escape($trans_no)." AND type=".db_escape($trans_type);
}
db_query($sql, "The debtor transaction record could not be inserted");
" . db_escape($credit_status) . ", ".db_escape($payment_terms) . ", " . $discount . ",
" . $pymt_discount . ", " . $credit_limit
.", ".db_escape($sales_type).", ".db_escape($notes) . ")";
-
db_query($sql,"The customer could not be added");
}
{
global $Refs;
- $credit_invoice = is_array($credit_note->src_docs) ?
- reset(array_keys($credit_note->src_docs)) : $credit_note->src_docs;
+ if (is_array($credit_note->src_docs))
+ {
+ $docs = array_keys($credit_note->src_docs);
+ $credit_invoice = reset($docs);
+ }
+ else
+ $credit_invoice = $credit_note->src_docs;
$credit_date = $credit_note->document_date;
$tax_group_id = $credit_note->tax_group_id;
$credit_note->freight_cost, $freight_added_tax,
$credit_note->sales_type, $credit_note->order_no, $credit_note->ship_via,
null, $alloc, 0, $credit_note->dimension_id, $credit_note->dimension2_id,
- $credit_note->payment);
+ $credit_note->payment, $credit_note->tax_included);
// 2008-06-14 extra $alloc, 2008-11-12 dimension_id Joe Hunt
if ($trans_no==0) {
// Insert a stock movement coming back in to show the credit note and
// a reversing stock movement to show the write off
//
-
function add_credit_movements_item(&$credit_note, &$credit_line,
$credit_type, $price, $credited_invoice=0)
{
$delivery->tax_included ? 0 : $freight_tax,
$delivery->sales_type, $delivery->order_no,
$delivery->ship_via, $delivery->due_date, 0, 0, $delivery->dimension_id,
- $delivery->dimension2_id, $delivery->payment);
+ $delivery->dimension2_id, $delivery->payment, $delivery->tax_included);
if ($trans_no == 0) {
$delivery->trans_no = array($delivery_no=>0);
$items_added_tax, $invoice->freight_cost, $freight_added_tax,
$invoice->sales_type, $sales_order, $invoice->ship_via,
$invoice->due_date, 0, 0, $invoice->dimension_id,
- $invoice->dimension2_id, $invoice->payment);
+ $invoice->dimension2_id, $invoice->payment, $invoice->tax_included);
// 2008-06-14 extra $alloc, 2008-11-12 added dimension_id Joe Hunt
if ($trans_no == 0) {
$taxitem['rate'], $invoice->tax_included, $taxitem['Value'],
$taxitem['Net'], $ex_rate, $date_, $invoice->reference);
- $total += add_gl_trans_customer(ST_SALESINVOICE, $invoice_no, $date_, $taxitem['sales_gl_code'], 0, 0,
- (-$taxitem['Value']), $invoice->customer_id,
- "A tax GL posting could not be inserted");
+ if (isset($taxitem['sales_gl_code']))
+ $total += add_gl_trans_customer(ST_SALESINVOICE, $invoice_no, $date_, $taxitem['sales_gl_code'], 0, 0,
+ (-$taxitem['Value']), $invoice->customer_id,
+ "A tax GL posting could not be inserted");
}
}
add_audit_trail($order->trans_type, $order_no, $order->document_date);
$Refs->save($order->trans_type, $order_no, $order->reference);
+ add_audit_trail($order->trans_type, $order_no, $order->document_date);
+ $Refs->save($order->trans_type, $order_no, $order->reference);
+
hook_db_postwrite($order, $order->trans_type);
commit_transaction();
elseif ($filter=='InvoiceTemplates' || $filter=='DeliveryTemplates')
$sql .= " AND sorder.type=1";
-
+
//Chaiatanya : New Filter
if ($customer_id != ALL_TEXT)
$sql .= " AND sorder.debtor_no = ".db_escape($customer_id);
include_once($path_to_root . "/sales/includes/sales_db.inc");
include_once($path_to_root . "/reporting/includes/reporting.inc");
-if (!@$_GET['popup'])
-{
- $js = "";
- if ($use_popup_windows)
- $js .= get_js_open_window(900, 500);
- if ($use_date_picker)
- $js .= get_js_date_picker();
- page(_($help_context = "Customer Transactions"), isset($_GET['customer_id']), false, "", $js);
-}
+$js = "";
+if ($use_popup_windows)
+ $js .= get_js_open_window(900, 500);
+if ($use_date_picker)
+ $js .= get_js_date_picker();
+page(_($help_context = "Customer Transactions"), isset($_GET['customer_id']), false, "", $js);
if (isset($_GET['customer_id']))
{
//------------------------------------------------------------------------------------------------
-if (!@$_GET['popup'])
- start_form();
+start_form();
if (!isset($_POST['customer_id']))
$_POST['customer_id'] = get_global_customer();
start_table(TABLESTYLE_NOBORDER);
start_row();
-if (!@$_GET['popup'])
+if (!$page_nested)
customer_list_cells(_("Select a customer: "), 'customer_id', null, true, false, false, !@$_GET['popup']);
date_cells(_("From:"), 'TransAfterDate', '', null, -30);
function credit_link($row)
{
- if (@$_GET['popup'])
+ global $page_nested;
+
+ if ($page_nested)
return '';
return $row['type'] == ST_SALESINVOICE && $row["Outstanding"] > 0 ?
pager_link(_("Credit This") ,
function edit_link($row)
{
- $str = '';
+ global $page_nested;
- if (@$_GET['popup'])
+ $str = '';
+ if ($page_nested)
return '';
- switch($row['type']) {
- case ST_SALESINVOICE:
- if (get_voided_entry(ST_SALESINVOICE, $row["trans_no"]) === false && $row['Allocated'] == 0)
- $str = "/sales/customer_invoice.php?ModifyInvoice=".$row['trans_no'];
- break;
- case ST_CUSTCREDIT:
- if (get_voided_entry(ST_CUSTCREDIT, $row["trans_no"]) === false && $row['Allocated'] == 0) // 2008-11-19 Joe Hunt
- {
- if ($row['order_']==0) // free-hand credit note
- $str = "/sales/credit_note_entry.php?ModifyCredit=".$row['trans_no'];
- else // credit invoice
- $str = "/sales/customer_credit_invoice.php?ModifyCredit=".$row['trans_no'];
- }
- break;
- case ST_CUSTDELIVERY:
- if (get_voided_entry(ST_CUSTDELIVERY, $row["trans_no"]) === false)
- $str = "/sales/customer_delivery.php?ModifyDelivery=".$row['trans_no'];
- break;
- case ST_CUSTPAYMENT:
- if (get_voided_entry(ST_CUSTPAYMENT, $row["trans_no"]) === false)
- $str = "/sales/customer_payments.php?trans_no=".$row['trans_no'];
- break;
- }
- if ($str != "" && !is_closed_trans($row['type'], $row["trans_no"]))
- return pager_link(_('Edit'), $str, ICON_EDIT);
- return '';
+
+ return edit_trans_link($row['type'], $row['trans_no'], $row['type']==ST_CUSTCREDIT && $row['order_']==0 ?
+ "/sales/credit_note_entry.php?ModifyCredit=%d" : 0);
}
function prt_link($row)
display_db_pager($table);
-if (!@$_GET['popup'])
-{
- end_form();
- end_page(@$_GET['popup'], false, false);
-}
+end_form();
+end_page();
?>
$_SESSION['page_title'] = _($help_context = "Search All Sales Quotations");
}
-if (!@$_GET['popup'])
-{
- $js = "";
- if ($use_popup_windows)
- $js .= get_js_open_window(900, 600);
- if ($use_date_picker)
- $js .= get_js_date_picker();
- page($_SESSION['page_title'], false, false, "", $js);
-}
+$js = "";
+if ($use_popup_windows)
+ $js .= get_js_open_window(900, 600);
+if ($use_date_picker)
+ $js .= get_js_date_picker();
+page($_SESSION['page_title'], false, false, "", $js);
if (isset($_GET['selected_customer']))
{
function edit_link($row)
{
- if (@$_GET['popup'])\r
- return '';\r
+ global $page_nested;
+
+ if ($page_nested)
+ return '';
global $trans_type;
$modify = ($trans_type == ST_SALESORDER ? "ModifyOrderNumber" : "ModifyQuotationNumber");
return pager_link( _("Edit"),
function tmpl_checkbox($row)
{
- global $trans_type;
+ global $trans_type, $page_nested;
if ($trans_type == ST_SALESQUOTE)
return '';
- if (@$_GET['popup'])\r
- return '';\r
+
+ if ($page_nested)
+ return '';
$name = "chgtpl" .$row['order_no'];
$value = $row['type'] ? 1:0;
$Ajax->activate('orders_tbl');
}
-if (!@$_GET['popup'])\r
- start_form();
+start_form();
start_table(TABLESTYLE_NOBORDER);
start_row();
start_row();
}
stock_items_list_cells(_("Item:"), 'SelectStockFromList', null, true);
-if (!@$_GET['popup'])\r
- customer_list_cells(_("Select a customer: "), 'customer_id', null, true);\r
+if (!@$_GET['popup'])
+ customer_list_cells(_("Select a customer: "), 'customer_id', null, true);
if ($trans_type == ST_SALESQUOTE)
check_cells(_("Show All:"), 'show_all');
// Orders inquiry table
//
$sql = get_sql_for_sales_orders_view($selected_customer, $trans_type, $_POST['OrderNumber'], $_POST['order_view_mode'],
- @$selected_stock_item, @$_POST['OrdersAfterDate'], @$_POST['OrdersToDate'], @$_POST['OrderReference'], $_POST['StockLocation'], $_POST['customer_id']);\r
+ @$selected_stock_item, @$_POST['OrdersAfterDate'], @$_POST['OrdersToDate'], @$_POST['OrderReference'], $_POST['StockLocation'], $_POST['customer_id']);
if ($trans_type == ST_SALESORDER)
$cols = array(
'Type' => 'skip',
_("Currency") => array('align'=>'center')
);
-if ($_POST['order_view_mode'] == 'OutstandingOnly') {\r
- //array_substitute($cols, 3, 1, _("Cust Order Ref"));\r
- array_append($cols, array(\r
- array('insert'=>true, 'fun'=>'dispatch_link'),\r
- array('insert'=>true, 'fun'=>'edit_link')));\r
+if ($_POST['order_view_mode'] == 'OutstandingOnly') {
+ //array_substitute($cols, 3, 1, _("Cust Order Ref"));
+ array_append($cols, array(
+ array('insert'=>true, 'fun'=>'dispatch_link'),
+ array('insert'=>true, 'fun'=>'edit_link')));
} elseif ($_POST['order_view_mode'] == 'InvoiceTemplates') {
array_substitute($cols, 3, 1, _("Description"));
display_db_pager($table);
submit_center('Update', _("Update"), true, '', null);
-if (!@$_GET['popup'])\r
-{
- end_form();
- end_page();
-}\r
+end_form();
+end_page();
?>
\ No newline at end of file
$_POST['br_address'], $_POST['salesman'], $_POST['area'], $_POST['tax_group_id'], $_POST['sales_account'],
$_POST['sales_discount_account'], $_POST['receivables_account'], $_POST['payment_discount_account'],
$_POST['default_location'], $_POST['br_post_address'], $_POST['disable_trans'], $_POST['group_no'],
- $_POST['default_ship_via'], $_POST['notes']);
+ $_POST['default_ship_via'], $_POST['notes'], $_POST['bank_account']);
// update_record_status($_POST['supplier_id'], $_POST['inactive'],
// 'cust_branch', 'branch_code');
$_POST['br_address'], $_POST['salesman'], $_POST['area'], $_POST['tax_group_id'], $_POST['sales_account'],
$_POST['sales_discount_account'], $_POST['receivables_account'], $_POST['payment_discount_account'],
$_POST['default_location'], $_POST['br_post_address'], 0, $_POST['group_no'],
- $_POST['default_ship_via'], $_POST['notes']);
+ $_POST['default_ship_via'], $_POST['notes'], $_POST['bank_account']);
$selected_id = db_insert_id();
add_crm_person($_POST['contact_name'], $_POST['contact_name'], '', $_POST['br_post_address'],
$_POST['payment_discount_account'] = $myrow['payment_discount_account'];
$_POST['group_no'] = $myrow["group_no"];
$_POST['notes'] = $myrow["notes"];
+ $_POST['bank_account'] = $myrow["bank_account"];
}
}
// We use the Item Sales Account as default!
// $_POST['sales_account'] = $company_record["default_sales_act"];
- $_POST['sales_account'] = $_POST['notes'] = '';
+ $_POST['sales_account'] = $_POST['notes'] = $_POST['bank_account'] = '';
$_POST['sales_discount_account'] = $company_record['default_sales_discount_act'];
$_POST['receivables_account'] = $company_record['debtors_act'];
$_POST['payment_discount_account'] = $company_record['default_prompt_payment_act'];
gl_all_accounts_list_row(_("Sales Discount Account:"), 'sales_discount_account');
gl_all_accounts_list_row(_("Accounts Receivable Account:"), 'receivables_account', null, true);
gl_all_accounts_list_row(_("Prompt Payment Discount Account:"), 'payment_discount_account');
+ text_row(_("Bank Account Number:"), 'bank_account', null, 30, 60);
table_section(2);
$page_security = 'SA_CUSTOMER';
$path_to_root = "../..";
-include($path_to_root . "/includes/db_pager.inc");
+include_once($path_to_root . "/includes/db_pager.inc");
include_once($path_to_root . "/includes/session.inc");
$js = "";
if ($use_popup_windows)
break;
case 'transactions':
$_GET['customer_id'] = $selected_id;
- $_GET['popup'] = 1;
include_once($path_to_root."/sales/inquiry/customer_inquiry.php");
break;
case 'orders':
$_GET['customer_id'] = $selected_id;
- $_GET['popup'] = 1;
include_once($path_to_root."/sales/inquiry/sales_orders_view.php");
break;
};
}
page($_SESSION['page_title'], false, false, "", $js);
+
//-----------------------------------------------------------------------------
if (list_updated('branch_id')) {
return false;
}
if ($_SESSION['Items']->trans_type!=ST_SALESORDER && $_SESSION['Items']->trans_type!=ST_SALESQUOTE && !is_date_in_fiscalyear($_POST['OrderDate'])) {
- display_error(_("The entered date is not in fiscal year"));
+ display_error(_("The entered date is out of fiscal year or is closed for further data entry."));
set_focus('OrderDate');
return false;
}
unset ($_SESSION['View']);
}
-$_SESSION['View'] = new Cart($_GET['trans_type'], $_GET['trans_no']);
+$_SESSION['View'] = new Cart($_GET['trans_type'], $_GET['trans_no'], true);
start_table(TABLESTYLE2, "width=95%", 5);
// Install procedure. All additional changes
// not included in sql file should go here.
//
- function install($pref, $force)
+ function install($company, $force)
{
global $db;
+
/*
Statement below is allowed only for MySQL >=4.0.4:
UPDATE `0_bank_trans`, `0_bank_accounts`
SET 0_bank_trans.bank_act=0_bank_accounts.id
WHERE 0_bank_trans.bank_act=0_bank_accounts.account_code;
*/
- $sql = "SELECT id, account_code FROM ".$pref."bank_accounts";
+ $sql = "SELECT id, account_code FROM ".TB_PREF."bank_accounts";
if(!($res = db_query($sql))) {
display_error(_("Cannot retrieve bank accounts codes")
.':<br>'. db_error_msg($db));
return false;
}
while ($acc = db_fetch($res)) {
- $sql = "UPDATE ".$pref."bank_trans SET bank_act='"
+ $sql = "UPDATE ".TB_PREF."bank_trans SET bank_act='"
.$acc['id']."' WHERE bank_act=".$acc['account_code'];
if (db_query($sql)==false) {
display_error(_("Cannot update bank transactions")
}
}
// copy all item codes from stock_master into item_codes
- $sql = "SELECT `stock_id`,`description`,`category_id` FROM ".$pref."stock_master";
+ $sql = "SELECT `stock_id`,`description`,`category_id` FROM ".TB_PREF."stock_master";
$result = db_query($sql);
if (!$result) {
display_error(_("Cannot select stock identificators")
} else {
while ($row = db_fetch_assoc($result)) {
$sql = "INSERT IGNORE "
- .$pref."item_codes (`item_code`,`stock_id`,`description`,`category_id`)
+ .TB_PREF."item_codes (`item_code`,`stock_id`,`description`,`category_id`)
VALUES('".$row['stock_id']."','".$row['stock_id']."','"
.$row['description']."','".$row['category_id']."')";
$res2 = db_query($sql);
"SELECT tr.tran_date, tr.type, tr.trans_no, dt.tax_type_id,
dt.rate, dt.included_in_price, dt.amount, tr.reference as ref,
tr.rate as ex_rate
- FROM ".$pref."debtor_trans_tax_details dt
- LEFT JOIN ".$pref."trans_tax_details tt
+ FROM ".TB_PREF."debtor_trans_tax_details dt
+ LEFT JOIN ".TB_PREF."trans_tax_details tt
ON dt.debtor_trans_no=tt.trans_no
AND dt.debtor_trans_type=tt.trans_type,
- ".$pref."debtor_trans tr
+ ".TB_PREF."debtor_trans tr
WHERE tt.trans_type is NULL
AND dt.debtor_trans_no = tr.trans_no
AND dt.debtor_trans_type = tr.type",
"SELECT tr.tran_date, tr.type, tr.trans_no, st.tax_type_id,
st.rate, st.included_in_price, st.amount, tr.supp_reference as ref,
tr.rate as ex_rate
- FROM ".$pref."supp_invoice_tax_items st
- LEFT JOIN ".$pref."trans_tax_details tt
+ FROM ".TB_PREF."supp_invoice_tax_items st
+ LEFT JOIN ".TB_PREF."trans_tax_details tt
ON st.supp_trans_no=tt.trans_no
AND st.supp_trans_type=tt.trans_type,
".$pref."supp_trans tr
AND st.supp_trans_type = tr.type");
foreach ($move_sql as $tbl => $sql) {
- if (!check_table($pref, $tbl)){
+ if (!check_table(TB_PREF, $tbl)){
$res = db_query($sql, "Cannot retrieve trans tax details from $tbl");
while ($row = db_fetch($res)) {
$net_amount = $row['rate'] == 0 ?
0 : ($row['included_in_price'] ?
($row['amount']/$row['rate']*(100-$row['rate']))
:($row['amount']/$row['rate']*100));
- $sql2 = "INSERT INTO ".$pref."trans_tax_details
+ $sql2 = "INSERT INTO ".TB_PREF."trans_tax_details
(trans_type,trans_no,tran_date,tax_type_id,rate,ex_rate,
included_in_price, net_amount, amount, memo)
VALUES ('".$row['type']."','".$row['trans_no']."','"
."','".$row['amount']."','".$row['ref']."')";
db_query($sql2, "Cannot move trans tax details from $tbl");
}
- db_query("DROP TABLE ".$pref.$tbl, "cannot remove $tbl");
+ db_query("DROP TABLE ".TB_PREF.$tbl, "cannot remove $tbl");
}
}
// Install procedure. All additional changes
// not included in sql file should go here.
//
- function install($pref, $force)
+ function install($company, $force)
{
- global $db, $systypes_array;
+ global $db, $systypes_array, $db_connections;
if (!$this->preconf)
return false;
+ $pref = $db_connections[$company]['tbpref'];
// Until 2.2 sanitizing text input with db_escape was not
// consequent enough. To avoid comparision problems we have to
// fix this now.
// set item category dflt accounts to values from company GL setup
$prefs = get_company_prefs();
- $sql = "UPDATE {$pref}stock_category SET "
+ $sql = "UPDATE ".TB_PREF."stock_category SET "
."dflt_sales_act = '" . $prefs['default_inv_sales_act'] . "',"
."dflt_cogs_act = '". $prefs['default_cogs_act'] . "',"
."dflt_inventory_act = '" . $prefs['default_inventory_act'] . "',"
foreach($systypes_array as $typeno => $typename) {
$info = get_systype_db_info($typeno);
if ($info == null || $info[3] == null) continue;
- $tbl = str_replace(TB_PREF, $pref, $info[0]);
+ $tbl = $info[0];
$sql = "SELECT DISTINCT {$info[2]} as id,{$info[3]} as ref FROM $tbl";
if ($info[1])
$sql .= " WHERE {$info[1]}=$typeno";
$result = db_query($sql);
if (db_num_rows($result)) {
while ($row = db_fetch($result)) {
- $res2 = db_query("INSERT INTO {$pref}refs VALUES("
+ $res2 = db_query("INSERT INTO ".TB_PREF."refs VALUES("
. $row['id'].",".$typeno.",'".$row['ref']."')");
if (!$res2) {
display_error(_("Cannot copy references from $tbl")
}
}
- if (!($ret = db_query("SELECT MAX(`order_no`) FROM `{$pref}sales_orders`")) ||
+ if (!($ret = db_query("SELECT MAX(`order_no`) FROM `".TB_PREF."sales_orders`")) ||
!db_num_rows($ret))
{
display_error(_('Cannot query max sales order number.'));
$row = db_fetch($ret);
$max_order = $row[0];
$next_ref = $max_order+1;
- $sql = "UPDATE `{$pref}sys_types`
+ $sql = "UPDATE `".TB_PREF."sys_types`
SET `type_no`='$max_order',`next_reference`='$next_ref'
WHERE `type_id`=30";
if(!db_query($sql))
}
$sections = array_keys($sections);
sort($sections); sort($area_set);
- import_security_role($pref, $security_headings[$role_id], $sections, $area_set);
+ import_security_role($security_headings[$role_id], $sections, $area_set);
$new_ids[$role_id] = db_insert_id();
}
$result = get_users(true);
}
foreach($users as $old_id => $uids)
foreach( $uids as $id) {
- $sql = "UPDATE {$pref}users set role_id=".$new_ids[$old_id].
+ $sql = "UPDATE ".TB_PREF."users set role_id=".$new_ids[$old_id].
" WHERE id=$id";
$ret = db_query($sql, 'cannot update users roles');
if(!$ret) return false;
return true;
}
-function import_security_role($pref, $name, $sections, $areas)
+function import_security_role($name, $sections, $areas)
{
- $sql = "INSERT INTO {$pref}security_roles (role, description, sections, areas)
+ $sql = "INSERT INTO ".TB_PREF."security_roles (role, description, sections, areas)
VALUES (".db_escape('FA 2.1 '.$name).",".db_escape($name).","
.db_escape(implode(';',$sections)).",".db_escape(implode(';',$areas)).")";
}
}
- if (empty($keys)) { // comments table have no primary key, so let's give up
+ if (empty($keys)) { // comments table have no primary key, so give up
continue;
}
if ($test)
$key[] = $k.'=\''.$rec[substr($k,1,-1)].'\'';
}
$sql .= implode( ' AND ', $key);
- if ($test) {
- error_log($sql);
+ if ($test)
error_log("\t(".implode(',',$val).") updated");
- } else
+ else
db_query($sql, 'cannot update record');
}
}
// Install procedure. All additional changes
// not included in sql file should go here.
//
- function install($pref, $force)
+ function install($company, $force)
{
global $db_version, $dflt_lang;
if (!$this->beta) {
// all specials below are already done on 2.3beta
- $sql = "SELECT debtor_no, payment_terms FROM {$pref}debtors_master";
-
+ $sql = "SELECT debtor_no, payment_terms FROM ".TB_PREF."debtors_master";
+
$result = db_query($sql);
if (!$result) {
display_error("Cannot read customers"
}
// update all sales orders and transactions with customer std payment terms
while($cust = db_fetch($result)) {
- $sql = "UPDATE {$pref}debtor_trans SET "
+ $sql = "UPDATE ".TB_PREF."debtor_trans SET "
."payment_terms = '" .$cust['payment_terms']
."' WHERE debtor_no='".$cust['debtor_no']."'";
if (db_query($sql)==false) {
.':<br>'. db_error_msg($db));
return false;
}
- $sql = "UPDATE {$pref}sales_orders SET "
+ $sql = "UPDATE ".TB_PREF."sales_orders SET "
."payment_terms = '" .$cust['payment_terms']
."' WHERE debtor_no='".$cust['debtor_no']."'";
if (db_query($sql)==false) {
return false;
}
}
- if (!$this->update_totals($pref)) {
+ if (!$this->update_totals()) {
display_error("Cannot update order totals");
return false;
}
- if (!$this->update_line_relations($pref)) {
+ if (!$this->update_line_relations()) {
display_error("Cannot update sales document links");
return false;
}
foreach($dropcol as $table => $columns)
foreach($columns as $col) {
- if (db_query("ALTER TABLE `{$pref}{$table}` DROP `$col`")==false) {
+ if (db_query("ALTER TABLE `".TB_PREF."{$table}` DROP `$col`")==false) {
display_error("Cannot drop {$table}.{$col} column:<br>".db_error_msg($db));
return false;
}
}
// remove old preferences table after upgrade script has been executed
- $sql = "DROP TABLE IF EXISTS `{$pref}company`";
+ $sql = "DROP TABLE IF EXISTS `".TB_PREF."company`";
if (!db_query($sql))
return false;
}
$this->update_lang_cfg();
- return update_company_prefs(array('version_id'=>$db_version), $pref);
+ return update_company_prefs(array('version_id'=>$db_version));
}
//
// Checking before install
/*
Update order totals
*/
- function update_totals($pref)
+ function update_totals()
{
global $path_to_root;
include_once("$path_to_root/sales/includes/cart_class.inc");
include_once("$path_to_root/purchasing/includes/po_class.inc");
$cart = new cart(ST_SALESORDER);
- $sql = "SELECT order_no, trans_type FROM {$pref}sales_orders";
+ $sql = "SELECT order_no, trans_type FROM ".TB_PREF."sales_orders";
$orders = db_query($sql);
if (!$orders)
return false;
while ($order = db_fetch($orders)) {
read_sales_order($order['order_no'], $cart, $order['trans_type']);
- $result = db_query("UPDATE {$pref}sales_orders
+ $result = db_query("UPDATE ".TB_PREF."sales_orders
SET total=".$cart->get_trans_total()
." WHERE order_no=".$order[0]);
unset($cart->line_items);
}
unset($cart);
$cart = new purch_order();
- $sql = "SELECT order_no FROM {$pref}purch_orders";
+ $sql = "SELECT order_no FROM ".TB_PREF."purch_orders";
$orders = db_query($sql);
if (!$orders)
return false;
while ($order_no = db_fetch($orders)) {
read_po($order_no[0], $cart);
- $result = db_query("UPDATE {$pref}purch_orders SET total=".$cart->get_trans_total());
+ $result = db_query("UPDATE ".TB_PREF."purch_orders SET total=".$cart->get_trans_total());
unset($cart->line_items);
}
return true;
there can be sales documents with lines not properly linked to parents. This rare
cases will be described in error log.
*/
- function update_line_relations($pref)
+ function update_line_relations()
{
global $path_to_root, $systypes_array;
require_once("$path_to_root/includes/sysnames.inc");
- $sql = "SELECT d.type, trans_no, order_ FROM {$pref}debtor_trans d
- LEFT JOIN {$pref}voided v ON d.type=v.type AND d.trans_no=v.id
+ $sql = "SELECT d.type, trans_no, order_ FROM ".TB_PREF."debtor_trans d
+ LEFT JOIN ".TB_PREF."voided v ON d.type=v.type AND d.trans_no=v.id
WHERE ISNULL(v.type) AND
(d.type=".ST_CUSTDELIVERY
." OR d.type=".ST_SALESINVOICE
if ($src_line['stock_id'] == $doc_line['stock_id']
&& ($src_line['quantity'] >= $doc_line['quantity'])) {
- $sql = "UPDATE {$pref}debtor_trans_details SET src_id = {$src_line['id']}
+ $sql = "UPDATE ".TB_PREF."debtor_trans_details SET src_id = {$src_line['id']}
WHERE id = {$doc_line['id']}";
if (!db_query($sql))
return false;
--- /dev/null
+<?php
+/**********************************************************************
+ Copyright (C) FrontAccounting, LLC.
+ Released under the terms of the GNU General Public License, GPL,
+ as published by the Free Software Foundation, either version 3
+ of the License, or (at your option) any later version.
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ See the License here <http://www.gnu.org/licenses/gpl-3.0.html>.
+***********************************************************************/
+class fa2_4 {
+ var $version = '2.4'; // version installed
+ var $description;
+ var $sql = 'alter2.4.sql';
+ var $preconf = true;
+
+ function fa2_4() {
+ $this->description = _('Upgrade from version 2.3 to 2.4');
+ }
+
+ //
+ // Install procedure. All additional changes
+ // not included in sql file should go here.
+ //
+ function install($company, $force)
+ {
+ global $db_version;
+
+ if (get_company_pref('grn_clearing_act') === null) { // available form 2.3.1, can be not defined on pre-2.4 installations
+ set_company_pref('grn_clearing_act', 'glsetup.purchase', 'varchar', 15, 0);
+ }
+ $result = $this->update_workorders();
+ if ($result)
+ $result = $this->do_cleanup();
+// return update_company_prefs(array('version_id'=>$db_version));
+ return true;
+ }
+ //
+ // Checking before install
+ //
+ function pre_check($pref, $force)
+ {
+ return true;
+ }
+ //
+ // Test if patch was applied before.
+ //
+ function installed($pref)
+ {
+ $n = 2; // number of patches to be installed
+ $patchcnt = 0;
+
+ if (!check_table($pref, 'suppliers', 'tax_algorithm')) $patchcnt++;
+ if (!check_table($pref, 'wo_costing')) $patchcnt++;
+ return $n == $patchcnt ? true : ($patchcnt ? ($patchcnt.'/'. $n) : 0);
+ }
+
+ function update_workorders()
+ {
+ global $db;
+
+ $sql = "SELECT DISTINCT type, type_no, tran_date, person_id FROM ".TB_PREF."gl_trans WHERE `type`=".ST_WORKORDER
+ ." AND person_type_id=1";
+ $res = db_query($sql);
+ if (!$res)
+ {
+ display_error("Cannot update work orders costs"
+ .':<br>'. db_error_msg($db));
+ return false;
+ }
+ while ($row = db_fetch($res))
+ {
+ $journal_id = get_next_trans_no(ST_JOURNAL);
+
+ $sql1 = "UPDATE ".TB_PREF."gl_trans SET `type`=".ST_JOURNAL.", type_no={$journal_id},
+ person_type_id=NULL, person_id=0
+ WHERE `type`=".ST_WORKORDER." AND type_no={$row['type_no']} AND tran_date='{$row['tran_date']}'
+ AND person_id='{$row['person_id']}'";
+ if (!db_query($sql1)) return false;
+
+ $sql2 = "INSERT INTO ".TB_PREF."wo_costing (workorder_id, cost_type, trans_no)
+ VALUES ({$row['type_no']}, {$row['person_id']}, {$journal_id})";
+ if (!db_query($sql2)) return false;
+ }
+ return true;
+ }
+
+ function do_cleanup()
+ {
+ $sql = "ALTER TABLE `".TB_PREF."tax_group_items` DROP COLUMN `rate`";
+ return db_query($sql);
+ }
+}
+
+$install = new fa2_4;
--- /dev/null
+ALTER TABLE `0_suppliers` ADD COLUMN `tax_algorithm` tinyint(1) NOT NULL default '1' AFTER `tax_included`;
+ALTER TABLE `0_supp_trans` ADD COLUMN `tax_algorithm` tinyint(1) NULL default '1' AFTER `tax_included`;
+INSERT INTO `0_sys_prefs` VALUES('tax_algorithm','glsetup.customer', 'tinyint', 1, '1');
+INSERT INTO `0_sys_prefs` VALUES('gl_closing_date','setup.closing_date', 'date', 8, '');
+# Fix eventual invalid date/year in audit records
+UPDATE `0_audit_trail` audit
+ LEFT JOIN `0_gl_trans` gl ON gl.`type`=audit.`type` AND gl.type_no=audit.trans_no
+ LEFT JOIN `0_fiscal_year` year ON year.begin<=gl.tran_date AND year.end>=gl.tran_date
+ SET audit.gl_date=gl.tran_date, audit.fiscal_year=year.id
+ WHERE NOT ISNULL(gl.`type`);
+
+DROP TABLE IF EXISTS `0_wo_costing`;
+
+CREATE TABLE `0_wo_costing` (
+ `id` int(11) NOT NULL auto_increment,
+ `workorder_id` int(11) NOT NULL default '0',
+ `cost_type` tinyint(1) NOT NULL default '0',
+ `trans_type` int(11) NOT NULL default '0',
+ `trans_no` int(11) NOT NULL default '0',
+ `factor` double NOT NULL default '1',
+ PRIMARY KEY (`id`)
+) TYPE=InnoDB;
+
+UPDATE `0_gl_trans` gl
+ LEFT JOIN `0_cust_branch` br ON br.receivables_account=gl.account AND br.debtor_no=gl.person_id AND gl.person_type_id=2
+ LEFT JOIN `0_suppliers` sup ON sup.payable_account=gl.account AND sup.supplier_id=gl.person_id AND gl.person_type_id=3
+ SET `person_id` = IF(br.receivables_account, br.debtor_no, IF(sup.payable_account, sup.supplier_id, NULL)),
+ `person_type_id` = IF(br.receivables_account, 2, IF(sup.payable_account, 3, NULL));
+
+ALTER TABLE `0_tax_group_items` ADD COLUMN `tax_shipping` tinyint(1) NOT NULL default '0' AFTER `rate`;
+UPDATE `0_tax_group_items` tgi
+ SET tgi.tax_shipping=1
+ WHERE tgi.rate=(SELECT 0_tax_types.rate FROM 0_tax_types, 0_tax_groups
+ WHERE tax_shipping=1 AND tgi.tax_group_id=0_tax_groups.id AND tgi.tax_type_id=0_tax_types.id);
+ALTER TABLE `0_tax_groups` DROP COLUMN `tax_shipping`;
+
+ALTER TABLE `0_sales_order_details` ADD KEY `stkcode` (`stk_code`);
+ALTER TABLE `0_purch_order_details` ADD KEY `itemcode` (`item_code`);
+ALTER TABLE `0_sys_prefs` CHANGE `value` `value` TEXT NOT NULL DEFAULT '';
+ALTER TABLE `0_cust_branch` ADD COLUMN `bank_account` varchar(60) DEFAULT NULL AFTER `notes`;
+
+ALTER TABLE `0_debtor_trans` ADD COLUMN `tax_included` tinyint(1) unsigned NOT NULL default '0' AFTER `payment_terms`;
+UPDATE `0_debtor_trans` tr, `0_trans_tax_details` td SET tr.tax_included=td.included_in_price
+ WHERE tr.`type`=td.trans_type AND tr.trans_no=td.trans_no AND td.included_in_price
\ No newline at end of file
`br_post_address` tinytext NOT NULL,
`group_no` int(11) NOT NULL default '0',
`notes` tinytext NOT NULL,
+ `bank_account` varchar(60) DEFAULT NULL,
`inactive` tinyint(1) NOT NULL default '0',
PRIMARY KEY (`branch_code`,`debtor_no`),
KEY `branch_code` (`branch_code`),
-- Dumping data for table `0_cust_branch`
--
-INSERT INTO `0_cust_branch` VALUES(1, 1, 'Beefeater Ltd.', 'Beefeater', '', 1, 1, 'Main Branch', 'DEF', 2, '', '4510', '1200', '4500', 1, 0, 'Address 1\nAddress 2\nAddress 3', 0, '', 0);
-INSERT INTO `0_cust_branch` VALUES(2, 2, 'Ghostbusters Corp.', 'Ghostbusters', 'Address 1\nAddress 2\nAddress 3', 1, 1, 'Main Branch', 'DEF', 1, '', '4510', '1200', '4500', 1, 0, 'Address 1\nAddress 2\nAddress 3', 0, '', 0);
-INSERT INTO `0_cust_branch` VALUES(3, 3, 'Brezan', 'Brezan', 'Address 1\nAddress 2\nAddress 3', 1, 1, 'Main Branch', 'DEF', 1, '', '4510', '1200', '4500', 1, 0, 'Address 1\nAddress 2\nAddress 3', 0, '', 0);
+INSERT INTO `0_cust_branch` VALUES(1, 1, 'Beefeater Ltd.', 'Beefeater', '', 1, 1, 'Main Branch', 'DEF', 2, '', '4510', '1200', '4500', 1, 0, 'Address 1\nAddress 2\nAddress 3', 0, '', '', 0);
+INSERT INTO `0_cust_branch` VALUES(2, 2, 'Ghostbusters Corp.', 'Ghostbusters', 'Address 1\nAddress 2\nAddress 3', 1, 1, 'Main Branch', 'DEF', 1, '', '4510', '1200', '4500', 1, 0, 'Address 1\nAddress 2\nAddress 3', 0, '','', 0);
+INSERT INTO `0_cust_branch` VALUES(3, 3, 'Brezan', 'Brezan', 'Address 1\nAddress 2\nAddress 3', 1, 1, 'Main Branch', 'DEF', 1, '', '4510', '1200', '4500', 1, 0, 'Address 1\nAddress 2\nAddress 3', 0, '', '', 0);
-- --------------------------------------------------------
`dimension_id` int(11) NOT NULL default '0',
`dimension2_id` int(11) NOT NULL default '0',
`payment_terms` int(11) default NULL,
+ `tax_included` tinyint(1) unsigned NOT NULL default '0',
PRIMARY KEY (`type`,`trans_no`),
KEY `debtor_no` (`debtor_no`,`branch_code`),
KEY `tran_date` (`tran_date`)
-- Dumping data for table `0_debtor_trans`
--
-INSERT INTO `0_debtor_trans` VALUES(17, 10, 0, 2, 2, '2009-06-21', '2009-06-22', '1', 1, 2, 50, 2.5, 0, 0, 0, 0, 1, 1, 0, 0, 4);
-INSERT INTO `0_debtor_trans` VALUES(18, 10, 1, 3, 3, '2009-06-21', '2009-07-01', '2', 2, 3, 35.89, 1.79, 0, 0, 0, 37.68, 1.3932, 1, 2, 0, 3);
-INSERT INTO `0_debtor_trans` VALUES(19, 10, 0, 2, 2, '2009-06-21', '2009-06-22', '3', 1, 5, 50, 0, 5, 0, 0, 0, 1, 1, 0, 0, 4);
-INSERT INTO `0_debtor_trans` VALUES(3, 11, 0, 3, 3, '2009-06-21', '0000-00-00', '1', 2, 3, 35.89, 1.79, 0, 0, 0, 37.68, 1.3932, 1, 2, 0, 3);
-INSERT INTO `0_debtor_trans` VALUES(2, 13, 0, 1, 1, '2009-06-21', '2009-06-22', '1', 2, 1, 60.8, 0, 10, 0, 0, 0, 1.6445729799917, 1, 0, 0, 3);
-INSERT INTO `0_debtor_trans` VALUES(3, 13, 1, 2, 2, '2009-06-21', '2009-06-22', 'auto', 1, 2, 50, 2.5, 0, 0, 0, 0, 1, 1, 0, 0, 4);
-INSERT INTO `0_debtor_trans` VALUES(4, 13, 1, 3, 3, '2009-06-21', '2009-07-01', 'auto', 2, 3, 35.89, 1.79, 0, 0, 0, 0, 1.3932, 1, 2, 0, 3);
-INSERT INTO `0_debtor_trans` VALUES(5, 13, 1, 2, 2, '2009-06-21', '2009-06-22', 'auto', 1, 5, 50, 0, 5, 0, 0, 0, 1, 1, 0, 0, 4);
+INSERT INTO `0_debtor_trans` VALUES(17, 10, 0, 2, 2, '2009-06-21', '2009-06-22', '1', 1, 2, 50, 2.5, 0, 0, 0, 0, 1, 1, 0, 0, 4, 0);
+INSERT INTO `0_debtor_trans` VALUES(18, 10, 1, 3, 3, '2009-06-21', '2009-07-01', '2', 2, 3, 35.89, 1.79, 0, 0, 0, 37.68, 1.3932, 1, 2, 0, 3, 0);
+INSERT INTO `0_debtor_trans` VALUES(19, 10, 0, 2, 2, '2009-06-21', '2009-06-22', '3', 1, 5, 50, 0, 5, 0, 0, 0, 1, 1, 0, 0, 4, 0);
+INSERT INTO `0_debtor_trans` VALUES(3, 11, 0, 3, 3, '2009-06-21', '0000-00-00', '1', 2, 3, 35.89, 1.79, 0, 0, 0, 37.68, 1.3932, 1, 2, 0, 3, 0);
+INSERT INTO `0_debtor_trans` VALUES(2, 13, 0, 1, 1, '2009-06-21', '2009-06-22', '1', 2, 1, 60.8, 0, 10, 0, 0, 0, 1.6445729799917, 1, 0, 0, 3, 0);
+INSERT INTO `0_debtor_trans` VALUES(3, 13, 1, 2, 2, '2009-06-21', '2009-06-22', 'auto', 1, 2, 50, 2.5, 0, 0, 0, 0, 1, 1, 0, 0, 4, 0);
+INSERT INTO `0_debtor_trans` VALUES(4, 13, 1, 3, 3, '2009-06-21', '2009-07-01', 'auto', 2, 3, 35.89, 1.79, 0, 0, 0, 0, 1.3932, 1, 2, 0, 3, 0);
+INSERT INTO `0_debtor_trans` VALUES(5, 13, 1, 2, 2, '2009-06-21', '2009-06-22', 'auto', 1, 5, 50, 0, 5, 0, 0, 0, 1, 1, 0, 0, 4, 0);
-- --------------------------------------------------------
`quantity_ordered` double NOT NULL default '0',
`quantity_received` double NOT NULL default '0',
PRIMARY KEY (`po_detail_item`),
- KEY `order` (`order_no`,`po_detail_item`)
+ KEY `order` (`order_no`,`po_detail_item`),
+ KEY `itemcode` (`item_code`)
) ENGINE=InnoDB AUTO_INCREMENT=6 ;
--
`quantity` double NOT NULL default '0',
`discount_percent` double NOT NULL default '0',
PRIMARY KEY (`id`),
- KEY `sorder` (`trans_type`,`order_no`)
+ KEY `sorder` (`trans_type`,`order_no`),
+ KEY `stkcode` (`stk_code`)
) ENGINE=InnoDB AUTO_INCREMENT=6 ;
--
`curr_code` char(3) default NULL,
`payment_terms` int(11) default NULL,
`tax_included` tinyint(1) NOT NULL default '0',
+ `tax_algorithm` tinyint(1) NOT NULL default '1',
`dimension_id` int(11) default '0',
`dimension2_id` int(11) default '0',
`tax_group_id` int(11) default NULL,
-- Dumping data for table `0_suppliers`
--
-INSERT INTO `0_suppliers` VALUES(1, 'Junk Beer ApS', 'Junk Beer', 'Mailing 1\nMailing 2\nMailing 3', 'Address 1\nAddress 2\nAddress 3', '123456', 'Contact', '111', '', '', 'DKK', 3, 0, 1, 0, 2, 1000, '', '2100', '5060', 'A supplier with junk beers.', 0);
-INSERT INTO `0_suppliers` VALUES(2, 'Lucky Luke Inc.', 'Lucky Luke', 'Mailing 1\nMailing 2\nMailing 3', 'Address 1\nAddress 2\nAddress 3', '654321', 'Luke', '333', '', '', 'USD', 3, 0, 0, 0, 1, 500, '', '2100', '5060', '', 0);
-INSERT INTO `0_suppliers` VALUES(3, 'Money Makers Ltd.', 'Money Makers', 'Mailing 1\nMailing 2\nMailing 3', 'Address 1\nAddress 2\nAddress 3', '987654', 'Makers', '222', '', '', 'GBP', 3, 0, 0, 0, 2, 300, '', '2100', '5060', '', 0);
+INSERT INTO `0_suppliers` VALUES(1, 'Junk Beer ApS', 'Junk Beer', 'Mailing 1\nMailing 2\nMailing 3', 'Address 1\nAddress 2\nAddress 3', '123456', 'Contact', '111', '', '', 'DKK', 3, 0, 1, 1, 0, 2, 1000, '', '2100', '5060', 'A supplier with junk beers.', 0);
+INSERT INTO `0_suppliers` VALUES(2, 'Lucky Luke Inc.', 'Lucky Luke', 'Mailing 1\nMailing 2\nMailing 3', 'Address 1\nAddress 2\nAddress 3', '654321', 'Luke', '333', '', '', 'USD', 3, 0, 1, 0, 0, 1, 500, '', '2100', '5060', '', 0);
+INSERT INTO `0_suppliers` VALUES(3, 'Money Makers Ltd.', 'Money Makers', 'Mailing 1\nMailing 2\nMailing 3', 'Address 1\nAddress 2\nAddress 3', '987654', 'Makers', '222', '', '', 'GBP', 3, 0, 1, 0, 0, 2, 300, '', '2100', '5060', '', 0);
-- --------------------------------------------------------
`rate` double NOT NULL default '1',
`alloc` double NOT NULL default '0',
`tax_included` tinyint(1) NOT NULL default '0',
+ `tax_algorihm` tinyint(1) NOT NULL default '1',
PRIMARY KEY (`type`,`trans_no`),
KEY `supplier_id` (`supplier_id`),
KEY `SupplierID_2` (`supplier_id`,`supp_reference`),
-- Dumping data for table `0_supp_trans`
--
-INSERT INTO `0_supp_trans` VALUES(7, 20, 2, '1', '5t', '2009-06-21', '2009-07-01', 3300, 0, 165, 1, 3465, 0);
-INSERT INTO `0_supp_trans` VALUES(8, 20, 2, '2', 'cc', '2009-06-21', '2009-07-01', 20, 0, 0, 1, 0, 0);
-INSERT INTO `0_supp_trans` VALUES(4, 22, 2, '1', '', '2009-06-21', '2009-06-21', -3465, 0, 0, 1, 3465, 0);
+INSERT INTO `0_supp_trans` VALUES(7, 20, 2, '1', '5t', '2009-06-21', '2009-07-01', 3300, 0, 165, 1, 3465, 0, 1);
+INSERT INTO `0_supp_trans` VALUES(8, 20, 2, '2', 'cc', '2009-06-21', '2009-07-01', 20, 0, 0, 1, 0, 0, 1);
+INSERT INTO `0_supp_trans` VALUES(4, 22, 2, '1', '', '2009-06-21', '2009-06-21', -3465, 0, 0, 1, 3465, 0, 1);
-- --------------------------------------------------------
`category` varchar(30) default NULL,
`type` varchar(20) NOT NULL default '',
`length` smallint(6) default NULL,
- `value` tinytext,
+ `value` text,
PRIMARY KEY (`name`),
KEY `category` (`category`)
) ENGINE=MyISAM;
INSERT INTO `0_sys_prefs` VALUES('domicile', 'setup.company', 'varchar', 55, '');
INSERT INTO `0_sys_prefs` VALUES('curr_default', 'setup.company', 'char', 3, 'USD');
INSERT INTO `0_sys_prefs` VALUES('use_dimension', 'setup.company', 'tinyint', 1, '1');
-INSERT INTO `0_sys_prefs` VALUES('f_year', 'setup.company', 'int', 11, '4');
+INSERT INTO `0_sys_prefs` VALUES('f_year', 'setup.company', 'int', 11, '3');
INSERT INTO `0_sys_prefs` VALUES('no_item_list', 'setup.company', 'tinyint', 1, '0');
INSERT INTO `0_sys_prefs` VALUES('no_customer_list', 'setup.company', 'tinyint', 1, '0');
INSERT INTO `0_sys_prefs` VALUES('no_supplier_list', 'setup.company', 'tinyint', 1, '0');
INSERT INTO `0_sys_prefs` VALUES('retained_earnings_act', 'glsetup.general', 'varchar', 15, '3590');
INSERT INTO `0_sys_prefs` VALUES('bank_charge_act', 'glsetup.general', 'varchar', 15, '5690');
INSERT INTO `0_sys_prefs` VALUES('exchange_diff_act', 'glsetup.general', 'varchar', 15, '4450');
+INSERT INTO `0_sys_prefs` VALUES('tax_algorithm', 'glsetup.general', 'tinyint', 1, '1');
INSERT INTO `0_sys_prefs` VALUES('default_credit_limit', 'glsetup.customer', 'int', 11, '1000');
INSERT INTO `0_sys_prefs` VALUES('accumulate_shipping', 'glsetup.customer', 'tinyint', 1, '0');
INSERT INTO `0_sys_prefs` VALUES('legal_text', 'glsetup.customer', 'tinytext', 0, '');
CREATE TABLE IF NOT EXISTS `0_tax_groups` (
`id` int(11) NOT NULL auto_increment,
`name` varchar(60) NOT NULL default '',
- `tax_shipping` tinyint(1) NOT NULL default '0',
`inactive` tinyint(1) NOT NULL default '0',
PRIMARY KEY (`id`),
UNIQUE KEY `name` (`name`)
-- Dumping data for table `0_tax_groups`
--
-INSERT INTO `0_tax_groups` VALUES(1, 'Tax', 0, 0);
-INSERT INTO `0_tax_groups` VALUES(2, 'Tax Exempt', 0, 0);
+INSERT INTO `0_tax_groups` VALUES(1, 'Tax', 0);
+INSERT INTO `0_tax_groups` VALUES(2, 'Tax Exempt', 0);
-- --------------------------------------------------------
CREATE TABLE IF NOT EXISTS `0_tax_group_items` (
`tax_group_id` int(11) NOT NULL default '0',
`tax_type_id` int(11) NOT NULL default '0',
- `rate` double NOT NULL default '0',
+ `tax_shipping` tinyint(1) NOT NULL default '0',
PRIMARY KEY (`tax_group_id`,`tax_type_id`)
) ENGINE=InnoDB;
-- Dumping data for table `0_tax_group_items`
--
-INSERT INTO `0_tax_group_items` VALUES(1, 1, 5);
+INSERT INTO `0_tax_group_items` VALUES(1, 1, 1);
-- --------------------------------------------------------
`br_post_address` tinytext NOT NULL,
`group_no` int(11) NOT NULL default '0',
`notes` tinytext NOT NULL,
+ `bank_account` varchar(60) DEFAULT NULL,
`inactive` tinyint(1) NOT NULL default '0',
PRIMARY KEY (`branch_code`,`debtor_no`),
KEY `branch_code` (`branch_code`),
`dimension_id` int(11) NOT NULL default '0',
`dimension2_id` int(11) NOT NULL default '0',
`payment_terms` int(11) default NULL,
+ `tax_included` tinyint(1) unsigned NOT NULL default '0',
PRIMARY KEY (`type`,`trans_no`),
KEY `debtor_no` (`debtor_no`,`branch_code`),
KEY `tran_date` (`tran_date`)
`quantity_ordered` double NOT NULL default '0',
`quantity_received` double NOT NULL default '0',
PRIMARY KEY (`po_detail_item`),
- KEY `order` (`order_no`,`po_detail_item`)
+ KEY `order` (`order_no`,`po_detail_item`),
+ KEY `itemcode` (`item_code`)
) ENGINE=InnoDB AUTO_INCREMENT=1 ;
--
`quantity` double NOT NULL default '0',
`discount_percent` double NOT NULL default '0',
PRIMARY KEY (`id`),
- KEY `sorder` (`trans_type`,`order_no`)
+ KEY `sorder` (`trans_type`,`order_no`),
+ KEY `stkcode` (`stk_code`)
) ENGINE=InnoDB AUTO_INCREMENT=1 ;
--
`curr_code` char(3) default NULL,
`payment_terms` int(11) default NULL,
`tax_included` tinyint(1) NOT NULL default '0',
+ `tax_algorithm` tinyint(1) NOT NULL default '1',
`dimension_id` int(11) default '0',
`dimension2_id` int(11) default '0',
`tax_group_id` int(11) default NULL,
`rate` double NOT NULL default '1',
`alloc` double NOT NULL default '0',
`tax_included` tinyint(1) NOT NULL default '0',
+ `tax_algorihm` tinyint(1) NOT NULL default '1',
PRIMARY KEY (`type`,`trans_no`),
KEY `supplier_id` (`supplier_id`),
KEY `SupplierID_2` (`supplier_id`,`supp_reference`),
`category` varchar(30) default NULL,
`type` varchar(20) NOT NULL default '',
`length` smallint(6) default NULL,
- `value` tinytext,
+ `value` text,
PRIMARY KEY (`name`),
KEY `category` (`category`)
) ENGINE=MyISAM;
INSERT INTO `0_sys_prefs` VALUES('domicile', 'setup.company', 'varchar', 55, '');
INSERT INTO `0_sys_prefs` VALUES('curr_default', 'setup.company', 'char', 3, 'USD');
INSERT INTO `0_sys_prefs` VALUES('use_dimension', 'setup.company', 'tinyint', 1, '1');
-INSERT INTO `0_sys_prefs` VALUES('f_year', 'setup.company', 'int', 11, '4');
+INSERT INTO `0_sys_prefs` VALUES('f_year', 'setup.company', 'int', 11, '3');
INSERT INTO `0_sys_prefs` VALUES('no_item_list', 'setup.company', 'tinyint', 1, '0');
INSERT INTO `0_sys_prefs` VALUES('no_customer_list', 'setup.company', 'tinyint', 1, '0');
INSERT INTO `0_sys_prefs` VALUES('no_supplier_list', 'setup.company', 'tinyint', 1, '0');
INSERT INTO `0_sys_prefs` VALUES('retained_earnings_act', 'glsetup.general', 'varchar', 15, '3590');
INSERT INTO `0_sys_prefs` VALUES('bank_charge_act', 'glsetup.general', 'varchar', 15, '5690');
INSERT INTO `0_sys_prefs` VALUES('exchange_diff_act', 'glsetup.general', 'varchar', 15, '4450');
+INSERT INTO `0_sys_prefs` VALUES('tax_algorithm', 'glsetup.general', 'tinyint', 1, '1');
INSERT INTO `0_sys_prefs` VALUES('default_credit_limit', 'glsetup.customer', 'int', 11, '1000');
INSERT INTO `0_sys_prefs` VALUES('accumulate_shipping', 'glsetup.customer', 'tinyint', 1, '0');
INSERT INTO `0_sys_prefs` VALUES('legal_text', 'glsetup.customer', 'tinytext', 0, '');
CREATE TABLE IF NOT EXISTS `0_tax_groups` (
`id` int(11) NOT NULL auto_increment,
`name` varchar(60) NOT NULL default '',
- `tax_shipping` tinyint(1) NOT NULL default '0',
`inactive` tinyint(1) NOT NULL default '0',
PRIMARY KEY (`id`),
UNIQUE KEY `name` (`name`)
-- Dumping data for table `0_tax_groups`
--
-INSERT INTO `0_tax_groups` VALUES(1, 'Tax', 0, 0);
-INSERT INTO `0_tax_groups` VALUES(2, 'Tax Exempt', 0, 0);
+INSERT INTO `0_tax_groups` VALUES(1, 'Tax', 0);
+INSERT INTO `0_tax_groups` VALUES(2, 'Tax Exempt', 0);
-- --------------------------------------------------------
CREATE TABLE IF NOT EXISTS `0_tax_group_items` (
`tax_group_id` int(11) NOT NULL default '0',
`tax_type_id` int(11) NOT NULL default '0',
- `rate` double NOT NULL default '0',
+ `tax_shipping` tinyint(1) NOT NULL default '0',
PRIMARY KEY (`tax_group_id`,`tax_type_id`)
) ENGINE=InnoDB;
-- Dumping data for table `0_tax_group_items`
--
-INSERT INTO `0_tax_group_items` VALUES(1, 1, 5);
+INSERT INTO `0_tax_group_items` VALUES(1, 1, 5, 1);
-- --------------------------------------------------------
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
See the License here <http://www.gnu.org/licenses/gpl-3.0.html>.
***********************************************************************/
-function clear_shipping_tax_group() {
- $sql = "UPDATE ".TB_PREF."tax_groups SET tax_shipping=0 WHERE 1";
- db_query($sql, "could not update tax_shipping fields");
-}
-
-function add_tax_group($name, $tax_shipping, $taxes, $rates)
+function add_tax_group($name, $taxes, $tax_shippings)
{
begin_transaction();
- if($tax_shipping) // only one tax group for shipping
- clear_shipping_tax_group();
-
- $sql = "INSERT INTO ".TB_PREF."tax_groups (name, tax_shipping) VALUES (".db_escape($name).", ".db_escape($tax_shipping).")";
+ $sql = "INSERT INTO ".TB_PREF."tax_groups (name) VALUES (".db_escape($name).")";
db_query($sql, "could not add tax group");
$id = db_insert_id();
- add_tax_group_items($id, $taxes, $rates);
+ add_tax_group_items($id, $taxes, $tax_shippings);
commit_transaction();
}
-function update_tax_group($id, $name, $tax_shipping, $taxes, $rates)
+function update_tax_group($id, $name, $taxes, $tax_shippings)
{
begin_transaction();
- if($tax_shipping) // only one tax group for shipping
- clear_shipping_tax_group();
-
- $sql = "UPDATE ".TB_PREF."tax_groups SET name=".db_escape($name).",tax_shipping=".db_escape($tax_shipping)." WHERE id=".db_escape($id);
+ $sql = "UPDATE ".TB_PREF."tax_groups SET name=".db_escape($name)." WHERE id=".db_escape($id);
db_query($sql, "could not update tax group");
delete_tax_group_items($id);
- add_tax_group_items($id, $taxes, $rates);
+ add_tax_group_items($id, $taxes, $tax_shippings);
commit_transaction();
}
commit_transaction();
}
-function add_tax_group_items($id, $items, $rates)
+function add_tax_group_items($id, $items, $tax_shippings)
{
for ($i=0; $i < count($items); $i++)
{
- $sql = "INSERT INTO ".TB_PREF."tax_group_items (tax_group_id, tax_type_id, rate)
- VALUES (".db_escape($id).", ".db_escape($items[$i]).", " . $rates[$i] .")";
+ $sql = "INSERT INTO ".TB_PREF."tax_group_items (tax_group_id, tax_type_id, tax_shipping)
+ VALUES (".db_escape($id).", ".db_escape($items[$i]).", " . $tax_shippings[$i] .")";
db_query($sql, "could not add item tax group item");
}
}
// Return all tax types with rate value updated according to tax group selected
// Call the function without arg to find shipment group taxes.
//
-function get_tax_group_rates($group_id=null)
+function get_tax_group_rates($group_id=null, $tax_shipping=false)
{
global $suppress_tax_rates;
: "CONCAT(t.name, ' (', t.rate, '%)') as tax_type_name,")
."t.sales_gl_code,
t.purchasing_gl_code,
- IF(g.tax_type_id, t.rate, NULL) as rate
+ IF(g.tax_type_id, t.rate, NULL) as rate,
+ g.tax_shipping
FROM ".TB_PREF."tax_types t
LEFT JOIN ".TB_PREF."tax_group_items g ON t.id=g.tax_type_id
- AND g.tax_group_id=". ($group_id ? db_escape($group_id) : "(SELECT id FROM ".TB_PREF."tax_groups WHERE tax_shipping=1)")
- ." WHERE !t.inactive";
+ AND g.tax_group_id=". ($group_id ? db_escape($group_id) : "(SELECT MIN(id) FROM ".TB_PREF."tax_groups)")
+ . " WHERE !t.inactive";
+ if ($tax_shipping)
+ $sql .= " AND g.tax_shipping=1";
return db_query($sql, "cannot get tax types as array");
}
function get_tax_group_items_as_array($id)
{
- $active_taxes = $ret_tax_array = array();
-
+ $ret_tax_array = array();
+
$tax_group_items = get_tax_group_rates($id);
-
- while ($tax_group_item = db_fetch_assoc($tax_group_items))
+
+ while ($tax_group_item = db_fetch($tax_group_items))
{
$tax_group_item['Value'] = 0;
$ret_tax_array[$tax_group_item['tax_type_id']] = $tax_group_item;
- }
+ }
+
return $ret_tax_array;
}
-
-function get_shipping_tax_as_array()
+function get_shipping_tax_as_array($id)
{
- $active_taxes = $ret_tax_array = array();
+ $ret_tax_array = array();
- $tax_group_items = get_tax_group_rates();
+ $tax_group_items = get_tax_group_rates($id, true);
- while ($tax_group_item = db_fetch_assoc($tax_group_items))
+ while ($tax_group_item = db_fetch($tax_group_items))
{
$tax_group_item['Value'] = 0;
$ret_tax_array[$tax_group_item['tax_type_id']] = $tax_group_item;
}
-
+
return $ret_tax_array;
}
-
+?>
\ No newline at end of file
//print_r($ret_tax_array);
$tax_array = get_taxes_for_item($stock_id, $ret_tax_array);
+
// if no exemptions or taxgroup is empty, then no included/excluded taxes
if ($tax_array == null)
return $price;
//-----------------------------------------------------------------------------------
// return an array of (tax_type_id, tax_type_name, sales_gl_code, purchasing_gl_code, rate, included_in_price, Value)
-function get_tax_for_items($items, $prices, $shipping_cost, $tax_group, $tax_included=null, $tax_items_array=null)
+function get_tax_for_items($items, $prices, $shipping_cost, $tax_group, $tax_included=null, $tax_items_array=null, $tax_algorithm = null)
{
+ if (!$tax_algorithm)
+ $tax_algorithm = get_company_pref('tax_algorithm');
// first create and set an array with all the tax types of the tax group
if($tax_items_array!=null)
$ret_tax_array = $tax_items_array;
else
$ret_tax_array = get_tax_group_items_as_array($tax_group);
+ $dec = user_price_dec();
+
+ $fully_exempt = true;
foreach($ret_tax_array as $k=>$t)
+ {
+ if ($t['rate'] !== null)
+ $fully_exempt = false;
$ret_tax_array[$k]['Net'] = 0;
+ }
+ $ret_tax_array['exempt'] = array('Value'=>0, 'Net'=>0, 'rate' => null, 'tax_type_id' => '');
$dec = user_price_dec();
// loop for all items
for ($i = 0; $i < count($items); $i++)
{
$item_taxes = get_taxes_for_item($items[$i], $ret_tax_array);
- if ($item_taxes != null)
+ if ($item_taxes == null || $fully_exempt)
+ {
+ $ret_tax_array['exempt']['Value'] += round2(0, $dec);
+ $ret_tax_array['exempt']['Net'] += $prices[$i];
+ }
+ else
{
$tax_multiplier = 0;
foreach ($item_taxes as $taxitem)
$ret_tax_array[$index]['Value'] += round2($prices[$i]*$item_tax['rate']/(100+$tax_multiplier), $dec);
$ret_tax_array[$index]['Net'] += round2($prices[$i]*100/(100+$tax_multiplier), $dec);
} else {
- $ret_tax_array[$index]['Value'] += ($prices[$i] * $item_tax['rate'] / 100);
+ $ret_tax_array[$index]['Value'] += round2($prices[$i] * $item_tax['rate'] / 100, $dec);
$ret_tax_array[$index]['Net'] += $prices[$i];
}
}
}
}
}
-
// add the shipping taxes, only if non-zero, and only if tax group taxes shipping
if ($shipping_cost != 0)
{
- $item_taxes = get_shipping_tax_as_array();
+ $item_taxes = get_shipping_tax_as_array($tax_group);
if ($item_taxes != null)
{
if ($tax_included == 1)
$ret_tax_array[$index]['Value'] += round2($shipping_cost*$item_tax['rate']/(100+$tax_rate), $dec);
$ret_tax_array[$index]['Net'] += $shipping_net;
} else {
- $ret_tax_array[$index]['Value'] += ($shipping_cost * $item_tax['rate'] / 100);
+ $ret_tax_array[$index]['Value'] += round2($shipping_cost * $item_tax['rate'] / 100, $dec);
$ret_tax_array[$index]['Net'] += $shipping_cost;
}
}
}
}
}
- //print_r($ret_tax_array);
+
+ if ($tax_algorithm == TCA_TOTALS ) {
+ // update taxes with
+ foreach($ret_tax_array as $index => $item_tax) {
+ $ret_tax_array[$index]['Value'] = round2($item_tax['Net'] * $item_tax['rate'] / 100, $dec);
+ }
+ }
return $ret_tax_array;
}
display_error(_("The tax group name cannot be empty."));
set_focus('name');
}
-
if ($input_error != 1)
{
// create an array of the taxes and array of rates
$taxes = array();
- $rates = array();
+ $tax_shippings = array();
while (($id = find_submit('tax_type_id'))!=-1)
{
$taxes[] = $id;
- $rates[] = get_tax_type_default_rate($id);
+ $tax_shippings[] = check_value('tax_shipping'.$id);
unset($_POST['tax_type_id' . $id]);
+ unset($_POST['tax_shipping' . $id]);
}
if ($selected_id != -1)
{
- update_tax_group($selected_id, $_POST['name'], $_POST['tax_shipping'], $taxes,
- $rates);
+ update_tax_group($selected_id, $_POST['name'], $taxes, $tax_shippings);
display_notification(_('Selected tax group has been updated'));
}
else
{
- add_tax_group($_POST['name'], $_POST['tax_shipping'], $taxes, $rates);
+ add_tax_group($_POST['name'], $taxes, $tax_shippings);
display_notification(_('New tax group has been added'));
}
$selected_id = -1;
$sav = get_post('show_inactive');
unset($_POST);
- if($sav)
+ if ($sav)
$_POST['show_inactive'] = $sav;
}
//-----------------------------------------------------------------------------------
start_form();
start_table(TABLESTYLE);
-$th = array(_("Description"), _("Shipping Tax"), "", "");
+$th = array(_("Description"), "", "");
inactive_control_column($th);
table_header($th);
alt_table_row_color($k);
label_cell($myrow["name"]);
- if ($myrow["tax_shipping"])
- label_cell(_("Yes"));
- else
- label_cell(_("No"));
inactive_control_cell($myrow["id"], $myrow["inactive"], 'tax_groups', 'id');
edit_button_cell("Edit".$myrow["id"], _("Edit"));
$group = get_tax_group($selected_id);
$_POST['name'] = $group["name"];
- $_POST['tax_shipping'] = $group["tax_shipping"];
}
hidden('selected_id', $selected_id);
+
}
text_row_ex(_("Description:"), 'name', 40);
-yesno_list_row(_("Tax applied to Shipping:"), 'tax_shipping', null, "", "", true);
end_table();
display_note(_("Select the taxes that are included in this group."), 1, 1);
-// null means transport tax group, but for new we do not use real rates
$items = get_tax_group_rates($selected_id!=-1 ? $selected_id : null);
-$th = array(_("Tax"), "");
-
start_table(TABLESTYLE2);
+$th = array(_("Tax"), "", _("Shipping Tax"));
table_header($th);
-while($item = db_fetch_assoc($items))
+while($item = db_fetch($items))
{
- check_row($item['tax_type_name'], 'tax_type_id' . $item['tax_type_id'],
- $selected_id!=-1 && isset($item['rate']), "align='center'");
+ start_row();
+ if ($selected_id != -1)
+ {
+ check_cells($item['tax_type_name'], 'tax_type_id' . $item['tax_type_id'],
+ isset($item['rate']), true, false, "align='center'");
+ if (isset($item['rate']))
+ check_cells(null, 'tax_shipping' . $item['tax_type_id'], $item['tax_shipping']);
+ }
+ else
+ {
+ check_cells($item['tax_type_name'], 'tax_type_id' . $item['tax_type_id'],
+ null, true, false, "align='center'");
+ if (get_post('_tax_type_id' . $item['tax_type_id'].'_update'))
+ {
+ //$_POST['_tax_type_id' . $item['tax_type_id'].'_update'] = 0;
+ $Ajax->activate('_page_body');
+ }
+ if (check_value('tax_type_id' . $item['tax_type_id'])==1)
+ check_cells(null, 'tax_shipping' . $item['tax_type_id'], null);
+ }
+ end_row();
+
}
end_table(1);
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
-<html><head>\r
- <meta http-equiv="CONTENT-TYPE" content="text/html; charset=iso-8859-2">\r
- \r
- <title>FrontAccounting Update</title><meta name="GENERATOR" content="OpenOffice.org 2.4 (Linux)">\r
- <meta name="CREATED" content="0;0">\r
- <meta name="CHANGED" content="20100902;19041400"></head>\r
-<body dir="ltr" lang="en-US">\r
-<p style="margin-bottom: 0cm;"><strong><font color="#cc6600"><font style="font-size: 20pt;" size="5"><i>Front</i></font></font></strong><strong><font style="font-size: 20pt;" size="5">Accounting\r
-Update</font></strong></p>\r
-<h2>Important Notes for release 2.3.5.</h2>Change in the behaviour of <span style="font-weight: bold; font-style: italic;">Recurrent Invoices</span>.<br><ul><li>Now\r
-the Last Sent day is stamped with the former Last Sent (or Begin date\r
-the first time) + months + days. Before the Last Sent day was stamped\r
-with tthe creation date (today). The Invoice date is still todays date.\r
-</li><li>If you for some reason want to make a pause in the recurrent\r
-invoices, you can now edit the Last Sent day in the Management section\r
-of Sales tab.</li><li>Before the days value, together with a month\r
-value, decided which day in the month the invoice was due.. This\r
-does not work now. You can change the day in the month you\r
-want the recurrency to happen by setting the Last Sent day with the new\r
-day in the Management section. </li><li>If you create a new Recurrent Invoice the Beginning date can be set to the day in the month you want the recurrencies to be due.</li></ul>\r
-<h2>Important Notes</h2>\r
-<p>Upgrade process can be done only by administrator of the first\r
-company created during FrontAccounting installation. This person is\r
-considered as a site admin who have granted access to potentially\r
-dangerous setup options, like Setup/Software Upgrade.</p>\r
-<p>In the following description sections related to older FA versions are\r
-prefixed with <span style="background: rgb(235, 97, 61) none repeat scroll 0% 50%; -moz-background-clip: initial; -moz-background-origin: initial; -moz-background-inline-policy: initial;">[color tags]</span><span style="background: transparent none repeat scroll 0% 50%; -moz-background-clip: initial; -moz-background-origin: initial; -moz-background-inline-policy: initial;">\r
-. Y</span>ou can skip tagged fragment safely if currently FA\r
-application is newer than the version in tag.</p>\r
-<p>Upgrade process consists of up to four stages, some of them are\r
-optional:</p>\r
-<ol>\r
- <li><p>Application source files update \r
- </p>\r
- </li><li><p>Database upgrade – this step is needed only during\r
- upgrade which involves change in major application version number\r
- (e.g. from 2.2.x to 2.3.x), and sometimes during upgrade from beta\r
- release to stable version. Otherwise this step can be skipped.</p>\r
- </li><li><p>Final cleanup – is needed when some old source files,\r
- obsoleted by new release should be removed.</p>\r
- </li><li><p>New features configuration – this is optional step\r
- needed for most major releases and some minor ones. \r
- </p>\r
-</li></ol>\r
-<p style="margin-bottom: 0cm;">Before starting upgrade ensure nobody\r
-is using the application and make database backup for all companies.\r
-To be on safe side backup also old source files, especially those\r
-locally customized (if any).</p>\r
-<p>Log into admin account of first company.<strong> </strong><strong><span style="">If\r
-you use a theme other than the standard 3 (aqua, cool or default),\r
-switch to one of these before going further.</span></strong></p>\r
-<h2><strong><b>1. Application files update</b></strong></h2>\r
-<p style="margin-top: 0.42cm; page-break-after: avoid;"><font face="Liberation Sans, sans-serif"><font size="4"><strong><span style="">a. Source\r
-files update</span></strong></font></font></p>\r
-<p><strong><span style="">Extract distribution\r
-zip/tar.gz file in empty directory, and copy all the files to your\r
-FrontAccounting directory overwriting old files. If it is major\r
-release upgrade you can skip next step and go directly to cleanup.</span></strong></p>\r
-<p style="margin-top: 0.42cm; page-break-after: avoid;"><strong><font face="Liberation Sans, sans-serif"><font size="4"><span style="">b. Configuration\r
-files update</span></font></font></strong></p>\r
-<p><strong><span style="">Compare new\r
-</span></strong><strong><i><b>config.default.php</b></i></strong><strong>\r
-</strong><strong><span style="">file with the old\r
-</span></strong><strong><i><b>config.php </b></i></strong><strong><span style="font-style: normal;"><span style="">and\r
-add all n</span></span></strong><strong><span style="">ew\r
-settings (if any). </span></strong>\r
-</p>\r
-<p><strong><span style=""><span style="background: rgb(235, 97, 61) none repeat scroll 0% 50%; -moz-background-clip: initial; -moz-background-origin: initial; -moz-background-inline-policy: initial;">[<FA\r
-2.2beta]</span></span></strong></p>\r
-<p><strong> <span style="">$show_users_online = 0;</span></strong></p>\r
-<p><strong> <span style="">$def_print_destination\r
-= 0;</span></strong></p>\r
-<p><strong><span style="">$dflt_date_fmt=0;</span></strong></p>\r
-<p><strong><span style="">$dflt_date_sep=0;</span></strong></p>\r
-<p><strong><span style="">$table_style,table_style2\r
-changed</span></strong></p>\r
-<p><strong><span style=""><span style="background: rgb(235, 97, 61) none repeat scroll 0% 50%; -moz-background-clip: initial; -moz-background-origin: initial; -moz-background-inline-policy: initial;">[<FA\r
-2.3beta]</span></span></strong></p>\r
-<p><strong> <span style="">$alternative_tax_include_on_doc=0;</span></strong></p>\r
-<p><strong><span style="">$suppress_tax_rates = 0;</span></strong></p>\r
-<p><strong><span style=""><span style="background: rgb(235, 97, 61) none repeat scroll 0% 50%; -moz-background-clip: initial; -moz-background-origin: initial; -moz-background-inline-policy: initial;">[<FA\r
-2.3RC1]</span></span></strong><strong> </strong>\r
-</p>\r
-<p><strong><span style="">Application version\r
-information and a couple of other private FA variables are stored in\r
-</span></strong><strong><i><b>version.php</b></i></strong><strong>\r
-</strong><strong><span style="">file. The\r
-application version displayed in footer is defined in $version\r
-variable unless this is set in config.php file. If you want current\r
-release version to be displayed on every FA update just remove or\r
-comment out $version variable in </span></strong><strong><span style="font-style: normal;"><span style="">config.php</span></span></strong><strong><span style="">.</span></strong></p>\r
-<p><strong><span style=""><span style="background: rgb(235, 97, 61) none repeat scroll 0% 50%; -moz-background-clip: initial; -moz-background-origin: initial; -moz-background-inline-policy: initial;">[<FA\r
-2.3RC2]</span></span></strong></p>\r
-<p><strong> <span style="">$save_report_selections = 0; // A value > 0 means days to save the report selections.</span></strong></p><p><strong><span style=""><span style="background: rgb(235, 97, 61) none repeat scroll 0% 50%; -moz-background-clip: initial; -moz-background-origin: initial; -moz-background-inline-policy: initial;">[<FA\r
-2.3]</span></span></strong></p><p><strong> <span style="">$save_po_item_codes = 0; // show item codes on purchase order </span></strong></p><p><strong><span style="">$def_print_destination = 0; // default print destination. 0 = PDF/Printer, 1 = Excel</span></strong></p><p><strong><span style="">$alternative_tax_include_on_docs = 0; // 1 = print Subtotal tax excluded, tax and Total tax included</span></strong></p><p><strong><span style="">$suppress_tax_rates = 0; // suppress tax rates on documents. 0 = no, 1 = yes.</span></strong></p><strong><span style=""><span style="background: rgb(235, 97, 61) none repeat scroll 0% 50%; -moz-background-clip: initial; -moz-background-origin: initial; -moz-background-inline-policy: initial;"></span></span></strong>\r
-\r
-<strong><span style=""><span style="background: rgb(235, 97, 61) none repeat scroll 0% 50%; -moz-background-clip: initial; -moz-background-origin: initial; -moz-background-inline-policy: initial;"></span></span></strong><h2><strong><b>2. Database upgrade</b></strong></h2>\r
-<p><strong><span style="">This step can be skipped\r
-for small version updates i.e. when you have already installed\r
-FrontAccounting version 2.3.1 or later. Before database upgrade is\r
-done on all company databases backup file is created automatically to\r
-enable database restore after failure.</span></strong></p>\r
-<p><strong><span style="">After major version\r
-upgrade overwriting files in first step makes the system unaccessible\r
-for all users but site admin, who have to run upgrade procedures to\r
-update all company databases to the new version provided with the\r
-release. After logging to administrator account of first installed\r
-company go directly to Setup/Software Upgrade screen, mark all\r
-subsequent 'Install' checkboxes and press 'Upgrade System'.</span></strong></p>\r
-<p style="">If something goes wrong during\r
-upgrade, you can eventually try forced upgrade option. Forced upgrade\r
-ignores some smaller errors which can arise during upgrade due to\r
-some exotic database configuration. This is depreciated option, so\r
-first read error messages if any, try to fix signalized problems,\r
-restore databases from backup and retry normal installation. To run\r
-upgrade in forced mode check box 'Force Upgrade', and press 'Upgrade\r
-System' again.</p>\r
-<h2>3. Final cleanup</h2>\r
-<p>Remove or rename install folder in main FrontAccounting directory.\r
-</p>\r
-<p>After upgrade is installed you can remove files obsoleted by new\r
-FrontAccounting version. Also old, unused settings <span style="font-style: normal;"><span style="">can\r
-be removed from </span></span><i><b>config.php</b></i><span style="font-style: normal;"><span style="">\r
-file.</span></span></p>\r
-<p style="margin-top: 0.42cm; page-break-after: avoid;"><font face="Liberation Sans, sans-serif"><font size="4">a.\r
-Source files cleanup</font></font></p>\r
-<p><strong><span style=""><span style="background: rgb(235, 97, 61) none repeat scroll 0% 50%; -moz-background-clip: initial; -moz-background-origin: initial; -moz-background-inline-policy: initial;">[<FA\r
-2.2beta]</span></span></strong></p>\r
-<p><strong><span style=""><span style="background: transparent none repeat scroll 0% 50%; -moz-background-clip: initial; -moz-background-origin: initial; -moz-background-inline-policy: initial;">/includes/reserved.inc\r
-– removed.</span></span></strong></p>\r
-<p><strong><span style=""><span style="background: rgb(235, 97, 61) none repeat scroll 0% 50%; -moz-background-clip: initial; -moz-background-origin: initial; -moz-background-inline-policy: initial;">[<FA\r
-2.1]</span></span></strong><strong> </strong>\r
-</p>\r
-<p><strong><span style="">/admin/db/v_banktrans.inc\r
-- removed</span></strong></p>\r
-<p style="margin-top: 0.42cm; page-break-after: avoid;"><font face="Liberation Sans, sans-serif"><font size="4"><span style="font-style: normal;"><span style="">b.\r
-Config.php cleanup </span></span></font></font>\r
-</p>\r
-<p><strong><span style=""><span style="background: rgb(235, 97, 61) none repeat scroll 0% 50%; -moz-background-clip: initial; -moz-background-origin: initial; -moz-background-inline-policy: initial;">[<FA\r
-2.2RC1]</span></span></strong><strong> </strong>\r
-</p>\r
-<p><strong><span style="">$security_headings,\r
-$security_groups arrays – moved to database (see Access Setup) \r
-</span></strong>\r
-</p>\r
-<p><strong><span style="">$def_app – moved\r
-to user configuration in database.</span></strong></p>\r
-<p><strong><span style="font-style: normal;"><span style="">$version\r
-– moved to </span></span></strong><strong><i><b>version.php</b></i></strong><strong><span style="font-style: normal;"><span style="">\r
-file. Remove</span></span></strong></p>\r
-<h2>4. New features configuration</h2>\r
-<p>During upgrade process new features are initialized to default\r
-status, and sometimes old settings are also changed to conform with\r
-new security policy. This automatic process is designed to be as\r
-neutral for end users as possible, however sometimes site or company\r
-admin intervention can be necessary to set thing after changes to\r
-their best state. Below you will find description of new settings\r
-available after upgrade.</p>\r
-<p><br><br>\r
-</p>\r
-<p>----------------------</p>\r
-<ul></ul>\r
+<html><head>
+ <meta http-equiv="CONTENT-TYPE" content="text/html; charset=iso-8859-2">
+
+ <title>FrontAccounting Update</title><meta name="GENERATOR" content="OpenOffice.org 2.4 (Linux)">
+ <meta name="CREATED" content="0;0">
+ <meta name="CHANGED" content="20100902;19041400"></head>
+<body dir="ltr" lang="en-US">
+<p style="margin-bottom: 0cm;"><strong><font color="#cc6600"><font style="font-size: 20pt;" size="5"><i>Front</i></font></font></strong><strong><font style="font-size: 20pt;" size="5">Accounting
+Update</font></strong></p>
+<h2>Important Notes for release 2.3.5.</h2>Change in the behaviour of <span style="font-weight: bold; font-style: italic;">Recurrent Invoices</span>.<br><ul><li>Now
+the Last Sent day is stamped with the former Last Sent (or Begin date
+the first time) + months + days. Before the Last Sent day was stamped
+with tthe creation date (today). The Invoice date is still todays date.
+</li><li>If you for some reason want to make a pause in the recurrent
+invoices, you can now edit the Last Sent day in the Management section
+of Sales tab.</li><li>Before the days value, together with a month
+value, decided which day in the month the invoice was due.. This
+does not work now. You can change the day in the month you
+want the recurrency to happen by setting the Last Sent day with the new
+day in the Management section. </li><li>If you create a new Recurrent Invoice the Beginning date can be set to the day in the month you want the recurrencies to be due.</li></ul>
+<h2>Important Notes</h2>
+<p>Upgrade process can be done only by administrator of the first
+company created during FrontAccounting installation. This person is
+considered as a site admin who have granted access to potentially
+dangerous setup options, like Setup/Software Upgrade.</p>
+<p>In the following description sections related to older FA versions are
+prefixed with <span style="background: rgb(235, 97, 61) none repeat scroll 0% 50%; -moz-background-clip: initial; -moz-background-origin: initial; -moz-background-inline-policy: initial;">[color tags]</span><span style="background: transparent none repeat scroll 0% 50%; -moz-background-clip: initial; -moz-background-origin: initial; -moz-background-inline-policy: initial;">
+. Y</span>ou can skip tagged fragment safely if currently FA
+application is newer than the version in tag.</p>
+<p>Upgrade process consists of up to four stages, some of them are
+optional:</p>
+<ol>
+ <li><p>Application source files update
+ </p>
+ </li><li><p>Database upgrade – this step is needed only during
+ upgrade which involves change in major application version number
+ (e.g. from 2.2.x to 2.3.x), and sometimes during upgrade from beta
+ release to stable version. Otherwise this step can be skipped.</p>
+ </li><li><p>Final cleanup – is needed when some old source files,
+ obsoleted by new release should be removed.</p>
+ </li><li><p>New features configuration – this is optional step
+ needed for most major releases and some minor ones.
+ </p>
+</li></ol>
+<p style="margin-bottom: 0cm;">Before starting upgrade ensure nobody
+is using the application and make database backup for all companies.
+To be on safe side backup also old source files, especially those
+locally customized (if any).</p>
+<p>Log into admin account of first company.<strong> </strong><strong><span style="">If
+you use a theme other than the standard 3 (aqua, cool or default),
+switch to one of these before going further.</span></strong></p>
+<h2><strong><b>1. Application files update</b></strong></h2>
+<p style="margin-top: 0.42cm; page-break-after: avoid;"><font face="Liberation Sans, sans-serif"><font size="4"><strong><span style="">a. Source
+files update</span></strong></font></font></p>
+<p><strong><span style="">Extract distribution
+zip/tar.gz file in empty directory, and copy all the files to your
+FrontAccounting directory overwriting old files. If it is major
+release upgrade you can skip next step and go directly to cleanup.</span></strong></p>
+<p style="margin-top: 0.42cm; page-break-after: avoid;"><strong><font face="Liberation Sans, sans-serif"><font size="4"><span style="">b. Configuration
+files update</span></font></font></strong></p>
+<p><strong><span style="">Compare new
+</span></strong><strong><i><b>config.default.php</b></i></strong><strong>
+</strong><strong><span style="">file with the old
+</span></strong><strong><i><b>config.php </b></i></strong><strong><span style="font-style: normal;"><span style="">and
+add all n</span></span></strong><strong><span style="">ew
+settings (if any). </span></strong>
+</p>
+<p><strong><span style=""><span style="background: rgb(235, 97, 61) none repeat scroll 0% 50%; -moz-background-clip: initial; -moz-background-origin: initial; -moz-background-inline-policy: initial;">[<FA
+2.2beta]</span></span></strong></p>
+<p><strong> <span style="">$show_users_online = 0;</span></strong></p>
+<p><strong> <span style="">$def_print_destination
+= 0;</span></strong></p>
+<p><strong><span style="">$dflt_date_fmt=0;</span></strong></p>
+<p><strong><span style="">$dflt_date_sep=0;</span></strong></p>
+<p><strong><span style="">$table_style,table_style2
+changed</span></strong></p>
+<p><strong><span style=""><span style="background: rgb(235, 97, 61) none repeat scroll 0% 50%; -moz-background-clip: initial; -moz-background-origin: initial; -moz-background-inline-policy: initial;">[<FA
+2.3beta]</span></span></strong></p>
+<p><strong> <span style="">$alternative_tax_include_on_doc=0;</span></strong></p>
+<p><strong><span style="">$suppress_tax_rates = 0;</span></strong></p>
+<p><strong><span style=""><span style="background: rgb(235, 97, 61) none repeat scroll 0% 50%; -moz-background-clip: initial; -moz-background-origin: initial; -moz-background-inline-policy: initial;">[<FA
+2.3RC1]</span></span></strong><strong> </strong>
+</p>
+<p><strong><span style="">Application version
+information and a couple of other private FA variables are stored in
+</span></strong><strong><i><b>version.php</b></i></strong><strong>
+</strong><strong><span style="">file. The
+application version displayed in footer is defined in $version
+variable unless this is set in config.php file. If you want current
+release version to be displayed on every FA update just remove or
+comment out $version variable in </span></strong><strong><span style="font-style: normal;"><span style="">config.php</span></span></strong><strong><span style="">.</span></strong></p>
+<p><strong><span style=""><span style="background: rgb(235, 97, 61) none repeat scroll 0% 50%; -moz-background-clip: initial; -moz-background-origin: initial; -moz-background-inline-policy: initial;">[<FA
+2.3RC2]</span></span></strong></p>
+<p><strong> <span style="">$save_report_selections = 0; // A value > 0 means days to save the report selections.</span></strong></p><p><strong><span style=""><span style="background: rgb(235, 97, 61) none repeat scroll 0% 50%; -moz-background-clip: initial; -moz-background-origin: initial; -moz-background-inline-policy: initial;">[<FA
+2.3]</span></span></strong></p><p><strong> <span style="">$save_po_item_codes = 0; // show item codes on purchase order </span></strong></p><p><strong><span style="">$def_print_destination = 0; // default print destination. 0 = PDF/Printer, 1 = Excel</span></strong></p><p><strong><span style="">$alternative_tax_include_on_docs = 0; // 1 = print Subtotal tax excluded, tax and Total tax included</span></strong></p><p><strong><span style="">$suppress_tax_rates = 0; // suppress tax rates on documents. 0 = no, 1 = yes.</span></strong></p><strong><span style=""><span style="background: rgb(235, 97, 61) none repeat scroll 0% 50%; -moz-background-clip: initial; -moz-background-origin: initial; -moz-background-inline-policy: initial;"></span></span></strong>
+
+<strong><span style=""><span style="background: rgb(235, 97, 61) none repeat scroll 0% 50%; -moz-background-clip: initial; -moz-background-origin: initial; -moz-background-inline-policy: initial;"></span></span></strong><h2><strong><b>2. Database upgrade</b></strong></h2>
+<p><strong><span style="">This step can be skipped
+for small version updates i.e. when you have already installed
+FrontAccounting version 2.3.1 or later. Before database upgrade is
+done on all company databases backup file is created automatically to
+enable database restore after failure.</span></strong></p>
+<p><strong><span style="">After major version
+upgrade overwriting files in first step makes the system unaccessible
+for all users but site admin, who have to run upgrade procedures to
+update all company databases to the new version provided with the
+release. After logging to administrator account of first installed
+company go directly to Setup/Software Upgrade screen, mark all
+subsequent 'Install' checkboxes and press 'Upgrade System'.</span></strong></p>
+<p style="">If something goes wrong during
+upgrade, you can eventually try forced upgrade option. Forced upgrade
+ignores some smaller errors which can arise during upgrade due to
+some exotic database configuration. This is depreciated option, so
+first read error messages if any, try to fix signalized problems,
+restore databases from backup and retry normal installation. To run
+upgrade in forced mode check box 'Force Upgrade', and press 'Upgrade
+System' again.</p>
+<h2>3. Final cleanup</h2>
+<p>Remove or rename install folder in main FrontAccounting directory.
+</p>
+<p>After upgrade is installed you can remove files obsoleted by new
+FrontAccounting version. Also old, unused settings <span style="font-style: normal;"><span style="">can
+be removed from </span></span><i><b>config.php</b></i><span style="font-style: normal;"><span style="">
+file.</span></span></p>
+<p style="margin-top: 0.42cm; page-break-after: avoid;"><font face="Liberation Sans, sans-serif"><font size="4">a.
+Source files cleanup</font></font></p>
+<p><strong><span style=""><span style="background: rgb(235, 97, 61) none repeat scroll 0% 50%; -moz-background-clip: initial; -moz-background-origin: initial; -moz-background-inline-policy: initial;">[<FA
+2.2beta]</span></span></strong></p>
+<p><strong><span style=""><span style="background: transparent none repeat scroll 0% 50%; -moz-background-clip: initial; -moz-background-origin: initial; -moz-background-inline-policy: initial;">/includes/reserved.inc
+– removed.</span></span></strong></p>
+<p><strong><span style=""><span style="background: rgb(235, 97, 61) none repeat scroll 0% 50%; -moz-background-clip: initial; -moz-background-origin: initial; -moz-background-inline-policy: initial;">[<FA
+2.1]</span></span></strong><strong> </strong>
+</p>
+<p><strong><span style="">/admin/db/v_banktrans.inc
+- removed</span></strong></p>
+<p style="margin-top: 0.42cm; page-break-after: avoid;"><font face="Liberation Sans, sans-serif"><font size="4"><span style="font-style: normal;"><span style="">b.
+Config.php cleanup </span></span></font></font>
+</p>
+<p><strong><span style=""><span style="background: rgb(235, 97, 61) none repeat scroll 0% 50%; -moz-background-clip: initial; -moz-background-origin: initial; -moz-background-inline-policy: initial;">[<FA
+2.2RC1]</span></span></strong><strong> </strong>
+</p>
+<p><strong><span style="">$security_headings,
+$security_groups arrays – moved to database (see Access Setup)
+</span></strong>
+</p>
+<p><strong><span style="">$def_app – moved
+to user configuration in database.</span></strong></p>
+<p><strong><span style="font-style: normal;"><span style="">$version
+– moved to </span></span></strong><strong><i><b>version.php</b></i></strong><strong><span style="font-style: normal;"><span style="">
+file. Remove</span></span></strong></p>
+<h2>4. New features configuration</h2>
+<p>During upgrade process new features are initialized to default
+status, and sometimes old settings are also changed to conform with
+new security policy. This automatic process is designed to be as
+neutral for end users as possible, however sometimes site or company
+admin intervention can be necessary to set thing after changes to
+their best state. Below you will find description of new settings
+available after upgrade.</p>
+<p><br><br>
+</p>
+<p>----------------------</p>
+<ul></ul>
</body></html>
\ No newline at end of file
// application version - can be overriden in config.php
if (!isset($version))
- $version = "2.3.10";
+ $version = "2.4 alpha";
//======================================================================
// Extension packages repository settings