function get_transactions() { $data_after = date2sql($_POST['TransAfterDate']); $date_to = date2sql($_POST['TransToDate']); $sql = "SELECT debtor_trans.*,\n\t\tdebtors_master.name AS CustName, debtors_master.curr_code AS CustCurrCode,\n \t(debtor_trans.ov_amount + debtor_trans.ov_gst + " . "debtor_trans.ov_freight + debtor_trans.ov_freight_tax + debtor_trans.ov_discount)\n\t\tAS TotalAmount,\n\t\tdebtor_trans.alloc AS Allocated,\n\t\t((debtor_trans.type = 10)\n\t\tAND debtor_trans.due_date < '" . date2sql(Today()) . "') AS OverDue\n \tFROM debtor_trans, debtors_master\n \tWHERE debtors_master.debtor_no = debtor_trans.debtor_no\n\t\t\tAND (debtor_trans.ov_amount + debtor_trans.ov_gst + " . "debtor_trans.ov_freight + debtor_trans.ov_freight_tax + debtor_trans.ov_discount != 0)\n \t\tAND debtor_trans.tran_date >= '{$data_after}'\n \t\tAND debtor_trans.tran_date <= '{$date_to}'"; if ($_POST['customer_id'] != reserved_words::get_all()) { $sql .= " AND debtor_trans.debtor_no = '" . $_POST['customer_id'] . "'"; } if (isset($_POST['filterType']) && $_POST['filterType'] != reserved_words::get_all()) { if ($_POST['filterType'] == '1' || $_POST['filterType'] == '2') { $sql .= " AND debtor_trans.type = 10 "; } elseif ($_POST['filterType'] == '3') { $sql .= " AND debtor_trans.type = " . systypes::cust_payment(); } elseif ($_POST['filterType'] == '4') { $sql .= " AND debtor_trans.type = 11 "; } if ($_POST['filterType'] == '2') { $today = date2sql(Today()); $sql .= " AND debtor_trans.due_date < '{$today}'\n\t\t\t\tAND (round(abs(debtor_trans.ov_amount + " . "debtor_trans.ov_gst + debtor_trans.ov_freight + " . "debtor_trans.ov_freight_tax + debtor_trans.ov_discount) - debtor_trans.alloc,6) > 0) "; } } else { $sql .= " AND debtor_trans.type != 13 "; } if (!check_value('showSettled')) { $sql .= " AND (round(abs(debtor_trans.ov_amount + debtor_trans.ov_gst + " . "debtor_trans.ov_freight + debtor_trans.ov_freight_tax + " . "debtor_trans.ov_discount) - debtor_trans.alloc,6) != 0) "; } $sql .= " ORDER BY debtor_trans.tran_date"; return db_query($sql, "No transactions were returned"); }
function display_trial_balance() { global $table_style, $path_to_root; start_table($table_style); $tableheader = "<tr>\n <td rowspan=2 class='tableheader'>" . tr("Account") . "</td>\n <td rowspan=2 class='tableheader'>" . tr("Account Name") . "</td>\n\t\t<td colspan=2 class='tableheader'>" . tr("Brought Forward") . "</td>\n\t\t<td colspan=2 class='tableheader'>" . tr("This Period") . "</td>\n\t\t<td colspan=2 class='tableheader'>" . tr("Balance") . "</td>\n\t\t</tr><tr>\n\t\t<td class='tableheader'>" . tr("Debit") . "</td>\n <td class='tableheader'>" . tr("Credit") . "</td>\n\t\t<td class='tableheader'>" . tr("Debit") . "</td>\n\t\t<td class='tableheader'>" . tr("Credit") . "</td>\n <td class='tableheader'>" . tr("Debit") . "</td>\n <td class='tableheader'>" . tr("Credit") . "</td>\n </tr>"; echo $tableheader; $k = 0; $accounts = get_gl_accounts(); while ($account = db_fetch($accounts)) { if (is_account_balancesheet($account["account_code"])) { $begin = null; } else { $begin = begin_fiscalyear(); if ($_POST['TransFromDate'] < $begin) { $begin = $_POST['TransFromDate']; } $begin = add_days($begin, -1); } $prev_balance = get_balance($account["account_code"], $begin, $_POST['TransFromDate'], false, false); $curr_balance = get_balance($account["account_code"], $_POST['TransFromDate'], $_POST['TransToDate']); if (check_value("NoZero") && !$prev_balance && !$curr_balance) { continue; } alt_table_row_color($k); $url = "<a href='{$path_to_root}/gl/inquiry/gl_account_inquiry.php?" . SID . "TransFromDate=" . $_POST["TransFromDate"] . "&TransToDate=" . $_POST["TransToDate"] . "&account=" . $account["account_code"] . "'>" . $account["account_code"] . "</a>"; label_cell($url); label_cell($account["account_name"]); display_debit_or_credit_cells($prev_balance); display_debit_or_credit_cells($curr_balance); display_debit_or_credit_cells($prev_balance + $curr_balance); end_row(); } end_table(1); }
function get_nulagoon_btc_nbt($search_tolerance, $btc_usd) { $url_wall = 'https://bitbucket.org/henry_nu/data/downloads/datetu.json'; $content_wall = file_get_contents($url_wall); $wall_json = json_decode($content_wall, true); $url_price = 'https://bitbucket.org/henry_nu/data/downloads/rd.json'; $content_price = file_get_contents($url_price); $price_json = json_decode($content_price, true); $ask_total = 0; $bid_total = 0; if (!check_value($wall_json["bal"]["NBT"]) && !check_value($price_json["ask"])) { writelog("nulagoon_btc_nbt", "querry_error", "unresolved"); } else { $tolerance = $btc_usd * $search_tolerance / 100; $ask_price = $btc_usd + $tolerance; $bid_price = $btc_usd - $tolerance; $ask_value = $wall_json["bal"]["NBT"]; $bid_value = $wall_json["bal"]["BTC"] * $btc_usd; $wall_price_ask = $price_json["ask"]; $wall_price_bid = $price_json["bid"]; if ($wall_price_ask <= $ask_price) { $ask_total = $ask_value; } if ($wall_price_bid >= $bid_price) { $bid_total = $bid_value; } } $total = $ask_total + $bid_total; $orderbook = array('tolerance' => $search_tolerance, 'ask_total' => $ask_total, 'bid_total' => $bid_total, 'total' => $total); return $orderbook; }
/** * login_user * Checks for the admin/user password * * @return mixed */ public static function login_user($password = '', $keep = '') { // Always clean the cookie and session on new login request if (check_value($password)) { unset($_SESSION["login_password"]); setcookie('login_password', '', time() - 3600, __CHV_RELATIVE_ROOT__, $_SERVER['SERVER_NAME']); } if (isset($_COOKIE['login_password'])) { $_SESSION['login_password'] = $_COOKIE['login_password']; } $admin_password = md5(chevereto_config('admin_password')); $user_password = md5(chevereto_config('user_password')); $permission = NULL; if ($password == $admin_password || isset($_SESSION['login_password']) && $_SESSION['login_password'] == $admin_password) { $permission = 'admin'; } elseif (check_value(chevereto_config('user_password')) && ($password == $user_password || $_SESSION['login_password'] == $user_password)) { $permission = 'user'; } if (!is_null($permission) && check_value($password) && $keep == 1) { setcookie('login_password', $password, time() + 60 * 60 * 24 * 30, __CHV_RELATIVE_ROOT__, $_SERVER['SERVER_NAME']); } if (!is_null($permission) && check_value($password)) { $_SESSION['login_password'] = $password; } if (is_null($permission)) { self::do_logout(); } else { self::$user = $permission; } return !is_null($permission) ? $permission : false; }
function show_results() { global $path_to_root; /*Now get the transactions */ div_start('trans_tbl'); start_table(TABLESTYLE); $netAmounts = check_value('NetAmounts'); if ($netAmounts) { $net = _("Net"); } else { $net = _("Gross"); } $th = array(_("Type"), _("Description"), _("Tax") . "<br>" . _("Amount"), $net . "<br>" . _("Outputs") . "/" . _("Inputs")); table_header($th); $k = 0; $total = 0; $bdate = date2sql($_POST['TransFromDate']); $edate = date2sql($_POST['TransToDate']); $taxes = get_tax_cash_summary($_POST['TransFromDate'], $_POST['TransToDate']); while ($tx = db_fetch($taxes)) { $payable = $tx['payable']; $collectible = $tx['collectible']; $net = $collectible + $payable; $total += $net; alt_table_row_color($k); label_cell($tx['name'] . " " . $tx['rate'] . "%"); label_cell(_("Charged on sales") . " (" . _("Output Tax") . "):"); amount_cell($payable); if ($netAmounts) { amount_cell($tx['net_output']); } else { amount_cell($tx['gross_output']); } end_row(); alt_table_row_color($k); label_cell($tx['name'] . " " . $tx['rate'] . "%"); label_cell(_("Paid on purchases") . " (" . _("Input Tax") . "):"); amount_cell($collectible); if ($netAmounts) { amount_cell($tx['net_input']); } else { amount_cell($tx['gross_input']); } end_row(); alt_table_row_color($k); label_cell("<b>" . $tx['name'] . " " . $tx['rate'] . "%</b>"); label_cell("<b>" . _("Net payable or collectible") . ":</b>"); amount_cell($net, true); label_cell(""); end_row(); } alt_table_row_color($k); label_cell(""); label_cell("<b>" . _("Total payable or refund") . ":</b>"); amount_cell($total, true); label_cell(""); end_row(); end_table(2); div_end(); }
function get_transactions() { global $db; $date_after = date2sql($_POST['TransAfterDate']); $date_to = date2sql($_POST['TransToDate']); // Sherifoz 22.06.03 Also get the description $sql = "SELECT supp_trans.type, supp_trans.trans_no,\n \tsupp_trans.tran_date, supp_trans.reference, supp_trans.supp_reference,\n \t(supp_trans.ov_amount + supp_trans.ov_gst + supp_trans.ov_discount) AS TotalAmount, supp_trans.alloc AS Allocated,\n\t\t((supp_trans.type = 20 OR supp_trans.type = 21) AND supp_trans.due_date < '" . date2sql(Today()) . "') AS OverDue,\n\t\tsuppliers.curr_code, suppliers.supp_name, supp_trans.due_date\n \tFROM supp_trans, suppliers\n \tWHERE suppliers.supplier_id = supp_trans.supplier_id\n \tAND supp_trans.tran_date >= '{$date_after}'\n \tAND supp_trans.tran_date <= '{$date_to}'"; if ($_POST['supplier_id'] != reserved_words::get_all()) { $sql .= " AND supp_trans.supplier_id = '" . $_POST['supplier_id'] . "'"; } if (isset($_POST['filterType']) && $_POST['filterType'] != reserved_words::get_all()) { if ($_POST['filterType'] == '1' || $_POST['filterType'] == '2') { $sql .= " AND supp_trans.type = 20 "; } elseif ($_POST['filterType'] == '3') { $sql .= " AND supp_trans.type = 22 "; } elseif ($_POST['filterType'] == '4' || $_POST['filterType'] == '5') { $sql .= " AND supp_trans.type = 21 "; } if ($_POST['filterType'] == '2' || $_POST['filterType'] == '5') { $today = date2sql(Today()); $sql .= " AND supp_trans.due_date < '{$today}' "; } } if (!check_value('showSettled')) { $sql .= " AND (round(abs(ov_amount + ov_gst + ov_discount) - alloc,6) != 0) "; } $sql .= " ORDER BY supp_trans.tran_date"; return db_query($sql, "No supplier transactions were returned"); }
function get_nulagoon_btc_nbt() { $url_price = 'https://bitbucket.org/henry_nu/data/downloads/rd.json'; $content_price = file_get_contents($url_price); $price_json = json_decode($content_price, true); if (!check_value($price_json["24vol"][0])) { writelog("nulagoon_btc_nbt", "querry_error", "unresolved"); $nulagoon_btc_nbt_24 = "-1"; } else { $nulagoon_btc_nbt_24 = $price_json["24vol"][0]; } return $nulagoon_btc_nbt_24; }
function can_process() { global $use_oldstyle_convert; if (strlen(trim($_POST['id'])) == 0) { display_error(_("The account class ID cannot be empty.")); set_focus('id'); return false; } if (strlen(trim($_POST['name'])) == 0) { display_error(_("The account class name cannot be empty.")); set_focus('name'); return false; } if (isset($use_oldstyle_convert) && $use_oldstyle_convert == 1) { $_POST['Balance'] = check_value('Balance'); } return true; }
} elseif ($row["type"] == ST_CUSTPAYMENT && $row['TotalAmount'] <= 0) { /*its a negative receipt */ return ''; } elseif ($row["type"] == ST_SALESINVOICE && $row['TotalAmount'] - $row['Allocated'] > 0) { return pager_link(_("Payment"), "/sales/customer_payments.php?customer_id=" . $row["debtor_no"] . "&SInvoice=" . $row["trans_no"], ICON_MONEY); } } function fmt_debit($row) { $value = $row['type'] == ST_CUSTCREDIT || $row['type'] == ST_CUSTPAYMENT || $row['type'] == ST_BANKDEPOSIT ? -$row["TotalAmount"] : $row["TotalAmount"]; return $value >= 0 ? price_format($value) : ''; } function fmt_credit($row) { $value = !($row['type'] == ST_CUSTCREDIT || $row['type'] == ST_CUSTPAYMENT || $row['type'] == ST_BANKDEPOSIT) ? -$row["TotalAmount"] : $row["TotalAmount"]; return $value > 0 ? price_format($value) : ''; } //------------------------------------------------------------------------------------------------ $sql = get_sql_for_customer_allocation_inquiry(get_post('TransAfterDate'), get_post('TransToDate'), get_post('customer_id'), get_post('filterType'), check_value('showSettled')); //------------------------------------------------------------------------------------------------ $cols = array(_("Type") => array('fun' => 'systype_name'), _("#") => array('fun' => 'view_link'), _("Reference"), _("Order") => array('fun' => 'order_link', 'ord' => ''), _("Date") => array('name' => 'tran_date', 'type' => 'date', 'ord' => 'asc'), _("Due Date") => array('type' => 'date', 'fun' => 'due_date'), _("Customer") => array('name' => 'name', 'ord' => 'asc'), _("Currency") => array('align' => 'center'), _("Debit") => array('align' => 'right', 'fun' => 'fmt_debit'), _("Credit") => array('align' => 'right', 'insert' => true, 'fun' => 'fmt_credit'), _("Allocated") => 'amount', _("Balance") => array('type' => 'amount', 'insert' => true, 'fun' => 'fmt_balance'), array('insert' => true, 'fun' => 'alloc_link')); if ($_POST['customer_id'] != ALL_TEXT) { $cols[_("Customer")] = 'skip'; $cols[_("Currency")] = 'skip'; } $table =& new_db_pager('doc_tbl', $sql, $cols); $table->set_marker('check_overdue', _("Marked items are overdue.")); $table->width = "80%"; display_db_pager($table); end_form(); end_page();
if (!$selected_id) { submit_center('submit', _("Add New Customer"), true, '', 'default'); } else { submit_center_first('submit', _("Update Customer"), _('Update customer data'), @$_REQUEST['popup'] ? true : 'default'); submit_return('select', $selected_id, _("Select this customer and return to document entry.")); submit_center_last('delete', _("Delete Customer"), _('Delete customer data if have been never used'), true); } div_end(); } //-------------------------------------------------------------------------------------------- check_db_has_sales_types(_("There are no sales types defined. Please define at least one sales type before adding a customer.")); start_form(); if (db_has_customers()) { start_table(TABLESTYLE_NOBORDER); start_row(); customer_list_cells(_("Select a customer: "), 'customer_id', null, _('New customer'), true, check_value('show_inactive')); check_cells(_("Show inactive:"), 'show_inactive', null, true); end_row(); end_table(); if (get_post('_show_inactive_update')) { $Ajax->activate('customer_id'); set_focus('customer_id'); } } else { hidden('customer_id'); } if (!$selected_id) { unset($_POST['_tabs_sel']); } // force settings tab for new customer tabbed_content_start('tabs', array('settings' => array(_('&General settings'), $selected_id), 'contacts' => array(_('&Contacts'), $selected_id), 'transactions' => array(_('&Transactions'), $selected_id), 'orders' => array(_('Sales &Orders'), $selected_id)));
if ($cancel_delete == 0) { delete_item_level($selected_id); display_notification(_('Selected book level has been deleted')); } //end if Delete group $Mode = 'RESET'; } if ($Mode == 'RESET') { $selected_id = -1; $sav = get_post('show_inactive'); unset($_POST); if ($sav) { $_POST['show_inactive'] = 1; } } $result = get_item_level(check_value('show_inactive')); start_form(); start_table(TABLESTYLE, "width=30%"); $th = array(_("No"), _("Description"), "", ""); inactive_control_column($th); table_header($th); $k = 0; while ($myrow = db_fetch($result)) { alt_table_row_color($k); label_cell($myrow["id"]); label_cell($myrow["description"]); inactive_control_cell($myrow["id"], $myrow["inactive"], 'levels', 'id'); edit_button_cell("Edit" . $myrow["id"], _("Edit")); delete_button_cell("Delete" . $myrow["id"], _("Delete")); end_row(); }
} elseif (isset($_POST['continue'])) { $_POST['Page'] = 2; } elseif (isset($_POST['db_test'])) { if (get_post('host') == '') { display_error(_('Host name cannot be empty.')); set_focus('host'); } elseif ($_POST['dbuser'] == '') { display_error(_('Database user name cannot be empty.')); set_focus('dbuser'); } elseif ($_POST['dbname'] == '') { display_error(_('Database name cannot be empty.')); set_focus('dbname'); } else { $_SESSION['inst_set'] = array_merge($_SESSION['inst_set'], array('host' => $_POST['host'], 'dbuser' => $_POST['dbuser'], 'dbpassword' => $_POST['dbpassword'], 'dbname' => $_POST['dbname'], 'tbpref' => $_POST['tbpref'] ? '0_' : '', 'sel_langs' => check_value('sel_langs'), 'sel_coas' => check_value('sel_coas'))); if (install_connect_db()) { $_POST['Page'] = check_value('sel_langs') ? 3 : (check_value('sel_coas') ? 4 : 5); } } if (!file_exists($path_to_root . "/lang/installed_languages.inc")) { $installed_languages = array(0 => array('code' => 'C', 'name' => 'English', 'encoding' => 'iso-8859-1')); $dflt_lang = 'C'; write_lang(); } } elseif (get_post('install_langs')) { $ret = true; if (isset($_POST['langs'])) { foreach ($_POST['langs'] as $package => $ok) { $ret &= install_language($package); } } if ($ret) {
//----------------------------------------------------------------------------------- if ($Mode == 'Delete') { if (can_delete($selected_id)) { delete_credit_status($selected_id); display_notification(_('Selected credit status has been deleted')); } $Mode = 'RESET'; } if ($Mode == 'RESET') { $selected_id = -1; $sav = get_post('show_inactive'); unset($_POST); $_POST['show_inactive'] = $sav; } //----------------------------------------------------------------------------------- $result = get_all_credit_status(check_value('show_inactive')); start_form(); start_table(TABLESTYLE, "width=40%"); $th = array(_("Description"), _("Dissallow Invoices"), '', ''); inactive_control_column($th); table_header($th); $k = 0; while ($myrow = db_fetch($result)) { alt_table_row_color($k); if ($myrow["dissallow_invoices"] == 0) { $disallow_text = _("Invoice OK"); } else { $disallow_text = "<b>" . _("NO INVOICING") . "</b>"; } label_cell($myrow["reason_description"]); label_cell($disallow_text);
display_error(_("Cannot delete this shipping company because invoices have been created using this shipping company.")); } else { delete_shipper($selected_id); display_notification(_('Selected shipping company has been deleted')); } } $Mode = 'RESET'; } if ($Mode == 'RESET') { $selected_id = -1; $sav = get_post('show_inactive'); unset($_POST); $_POST['show_inactive'] = $sav; } //---------------------------------------------------------------------------------------------- $result = get_shippers(check_value('show_inactive')); start_form(); start_table(TABLESTYLE); $th = array(_("Name"), _("Contact Person"), _("Phone Number"), _("Secondary Phone"), _("Address"), "", ""); inactive_control_column($th); table_header($th); $k = 0; //row colour counter while ($myrow = db_fetch($result)) { alt_table_row_color($k); label_cell($myrow["shipper_name"]); label_cell($myrow["contact"]); label_cell($myrow["phone"]); label_cell($myrow["phone2"]); label_cell($myrow["address"]); inactive_control_cell($myrow["shipper_id"], $myrow["inactive"], 'shippers', 'shipper_id');
delete_sales_group($selected_id); display_notification(_('Selected sales group has been deleted')); } //end if Delete group $Mode = 'RESET'; } if ($Mode == 'RESET') { $selected_id = -1; $sav = get_post('show_inactive'); unset($_POST); if ($sav) { $_POST['show_inactive'] = 1; } } //------------------------------------------------------------------------------------------------- $result = get_sales_groups(check_value('show_inactive')); start_form(); start_table(TABLESTYLE, "width=30%"); $th = array(_("ID"), _("Group Name"), "", ""); inactive_control_column($th); table_header($th); $k = 0; while ($myrow = db_fetch($result)) { alt_table_row_color($k); label_cell($myrow["id"]); label_cell($myrow["description"]); inactive_control_cell($myrow["id"], $myrow["inactive"], 'groups', 'id'); edit_button_cell("Edit" . $myrow["id"], _("Edit")); delete_button_cell("Delete" . $myrow["id"], _("Delete")); end_row(); }
/** * Return if a barcode value match syntax * * @param string $codefortest Code to check syntax * @param string $typefortest Type of barcode (ISBN, EAN, ...) * @return int 0 if OK, <0 if KO */ function verif_syntax($codefortest, $typefortest) { global $conf; $res = 0; // Get Mask value $mask = empty($conf->global->BARCODE_STANDARD_PRODUCT_MASK) ? '' : $conf->global->BARCODE_STANDARD_PRODUCT_MASK; if (!$mask) { $this->error = 'NotConfigured'; return ''; } $newcodefortest = $codefortest; if (in_array($typefortest, array('EAN13', 'ISBN'))) { $newcodefortest = substr($newcodefortest, 0, 12); } $result = check_value($mask, $newcodefortest); return $result; }
delete_item_category($selected_id); display_notification(_('Selected item category has been deleted')); } $Mode = 'RESET'; } if ($Mode == 'RESET') { $selected_id = -1; $sav = get_post('show_inactive'); unset($_POST); $_POST['show_inactive'] = $sav; } if (list_updated('mb_flag')) { $Ajax->activate('details'); } //---------------------------------------------------------------------------------- $result = get_item_categories(check_value('show_inactive')); start_form(); start_table(TABLESTYLE, "width=80%"); $th = array(_("Name"), _("Tax type"), _("Units"), _("Type"), _("Sales Act"), _("Inventory Account"), _("COGS Account"), _("Adjustment Account"), _("Assembly Account"), "", ""); inactive_control_column($th); table_header($th); $k = 0; //row colour counter while ($myrow = db_fetch($result)) { alt_table_row_color($k); label_cell($myrow["description"]); label_cell($myrow["tax_name"]); label_cell($myrow["dflt_units"], "align=center"); label_cell($stock_types[$myrow["dflt_mb_flag"]]); label_cell($myrow["dflt_sales_act"], "align=center"); label_cell($myrow["dflt_inventory_act"], "align=center");
//----------------------------------------------------------------------------------- if ($Mode == 'Delete') { if (can_delete($selected_id)) { delete_account_type($selected_id); display_notification(_('Selected account group has been deleted')); } $Mode = 'RESET'; } if ($Mode == 'RESET') { $selected_id = ""; $_POST['id'] = $_POST['name'] = ''; unset($_POST['parent']); unset($_POST['class_id']); } //----------------------------------------------------------------------------------- $result = get_account_types(check_value('show_inactive')); start_form(); start_table(TABLESTYLE); $th = array(_("Group ID"), _("Group Name"), _("Subgroup Of"), _("Class"), "", ""); inactive_control_column($th); table_header($th); $k = 0; while ($myrow = db_fetch($result)) { alt_table_row_color($k); $bs_text = get_account_class_name($myrow["class_id"]); if ($myrow["parent"] == '-1') { $parent_text = ""; } else { $parent_text = get_account_type_name($myrow["parent"]); } label_cell($myrow["id"]);
$k = 0; //row colour counter while ($myrow = db_fetch($result)) { alt_table_row_color($k); $last_visit_date = sql2date($myrow["last_visit_date"]); /*The security_headings array is defined in config.php */ $not_me = strcasecmp($myrow["user_id"], $_SESSION["wa_current_user"]->username); label_cell($myrow["user_id"]); label_cell($myrow["real_name"]); label_cell($myrow["phone"]); email_cell($myrow["email"]); label_cell($last_visit_date, "nowrap"); label_cell($myrow["role"]); if ($not_me) { inactive_control_cell($myrow["id"], $myrow["inactive"], 'users', 'id'); } elseif (check_value('show_inactive')) { label_cell(''); } edit_button_cell("Edit" . $myrow["id"], _("Edit")); if ($not_me) { delete_button_cell("Delete" . $myrow["id"], _("Delete")); } else { label_cell(''); } end_row(); } //END WHILE LIST LOOP inactive_control_row($th); end_table(1); //------------------------------------------------------------------------------------------------- start_table(TABLESTYLE2);
//---------------------------------------------------------------------------------- if ($Mode == 'Delete') { if (can_delete($selected_id)) { delete_item_location($selected_id); display_notification(_('Selected location has been deleted')); } //end if Delete Location $Mode = 'RESET'; } if ($Mode == 'RESET') { $selected_id = -1; $sav = get_post('show_inactive'); unset($_POST); $_POST['show_inactive'] = $sav; } $result = get_item_locations(check_value('show_inactive')); start_form(); start_table(TABLESTYLE); $th = array(_("Location Code"), _("Location Name"), _("Address"), _("Phone"), _("Secondary Phone"), "", ""); inactive_control_column($th); table_header($th); $k = 0; //row colour counter while ($myrow = db_fetch($result)) { alt_table_row_color($k); label_cell($myrow["loc_code"]); label_cell($myrow["location_name"]); label_cell($myrow["delivery_address"]); label_cell($myrow["phone"]); label_cell($myrow["phone2"]); inactive_control_cell($myrow["loc_code"], $myrow["inactive"], 'locations', 'loc_code');
//----------------------------------------------------------------------------------- if ($Mode == 'Delete') { if (can_delete($selected_id)) { delete_work_centre($selected_id); display_notification(_('Selected work center has been deleted')); } $Mode = 'RESET'; } if ($Mode == 'RESET') { $selected_id = -1; $sav = get_post('show_inactive'); unset($_POST); $_POST['show_inactive'] = $sav; } //----------------------------------------------------------------------------------- $result = get_all_work_centres(check_value('show_inactive')); start_form(); start_table(TABLESTYLE, "width=50%"); $th = array(_("Name"), _("description"), "", ""); inactive_control_column($th); table_header($th); $k = 0; while ($myrow = db_fetch($result)) { alt_table_row_color($k); label_cell($myrow["name"]); label_cell($myrow["description"]); inactive_control_cell($myrow["id"], $myrow["inactive"], 'workcentres', 'id'); edit_button_cell("Edit" . $myrow['id'], _("Edit")); delete_button_cell("Delete" . $myrow['id'], _("Delete")); end_row(); }
<*****@*****.**> Copyright (c) Rodolfo Berrios <*****@*****.**> Licensed under the MIT license http://opensource.org/licenses/MIT --------------------------------------------------------------------- */ if (!defined('access') or !access) { die('This file cannot be directly accessed.'); } /** * This File declarates and proccess the Short URL */ require_once __CHV_PATH_CLASSES__ . 'class.shorturl.php'; $ShortURL = new ShortURL(); if (!check_value(chevereto_config('short_url_service'))) { $config['short_url_service'] = 'tinyurl'; } $ShortURL->service = chevereto_config('short_url_service'); if (check_value(chevereto_config('short_url_user')) or check_value(chevereto_config('short_url_keypass'))) { $ShortURL->user = chevereto_config('short_url_user'); $ShortURL->pass = chevereto_config('short_url_keypass'); } if (chevereto_config('short_url_service') == "google" && !check_value(chevereto_config('short_url_keypass'))) { $ShortURL->pass = '******'; // For demo / new installations only } if (chevereto_config('short_url_service') == 'custom' and check_value(chevereto_config('custom_short_url_api'))) { $ShortURL->custom_service_api = chevereto_config('custom_short_url_api'); }
handle_delete($selected_id); $Mode = 'RESET'; } if (get_post('Refresh')) { $comp = get_post('extset'); $exts = get_company_extensions($comp); $result = true; foreach ($exts as $i => $ext) { if ($ext['package'] && $ext['active'] ^ check_value('Active' . $i)) { $activated = activate_hooks($ext['package'], $comp, !$ext['active']); // change active state if ($activated !== null) { $result &= $activated; } if ($activated || $activated === null) { $exts[$i]['active'] = check_value('Active' . $i); } } } write_extensions($exts, get_post('extset')); if (get_post('extset') == user_company()) { $installed_extensions = $exts; } if (!$result) { display_error(_('Status change for some extensions failed.')); $Ajax->activate('ext_tbl'); // refresh settings display } else { display_notification(_('Current active extensions set has been saved.')); } }
display_error(_("The entered reference is already in use.")); set_focus('ref'); $input_error = 1; } } if ($input_error == 1) { unset($_POST['Process']); } } if (isset($_POST['Process'])) { $cart =& $_SESSION['journal_items']; $new = $cart->order_id == 0; $cart->reference = $_POST['ref']; $cart->memo_ = $_POST['memo_']; $cart->tran_date = $_POST['date_']; $trans_no = write_journal_entries($cart, check_value('Reverse')); $cart->clear_items(); new_doc_date($_POST['date_']); unset($_SESSION['journal_items']); if ($new) { meta_forward($_SERVER['PHP_SELF'], "AddedID={$trans_no}"); } else { meta_forward($_SERVER['PHP_SELF'], "UpdatedID={$trans_no}"); } } //----------------------------------------------------------------------------------------------- function check_item_data() { if (isset($_POST['dimension_id']) && $_POST['dimension_id'] != 0 && dimension_is_closed($_POST['dimension_id'])) { display_error(_("Dimension is closed.")); set_focus('dimension_id');
} if (isset($_POST['empl_id'])) { $empl_id = update_employee($_POST['empl_id'], $_POST['empl_name'], $_POST['pre_address'], $_POST['per_address'], $_POST['date_of_birth'], $_POST['age'], $_POST['mobile_phone'], $_POST['email'], $_POST['grade'], $_POST['department'], $_POST['designation'], $_POST['gross_salary'], $_POST['date_of_join']); meta_forward($_SERVER['PHP_SELF'], "Updated=yes&selected_id={$empl_id}"); } else { $empl_id = add_employee($_POST['empl_name'], $_POST['pre_address'], $_POST['per_address'], $_POST['date_of_birth'], $_POST['age'], $_POST['mobile_phone'], $_POST['email'], $_POST['grade'], $_POST['department'], $_POST['designation'], $_POST['gross_salary'], $_POST['date_of_join']); meta_forward($_SERVER['PHP_SELF'], "Added=yes&selected_id={$empl_id}"); } } start_form(); if (db_has_employees()) { start_table(TABLESTYLE_NOBORDER); start_row(); hrm_year_list(_("Year:"), 'year', null); hrm_months_list(_("Month:"), 'month', null); employee_list_cells(_("Select an Employee: "), 'selected_id', null, _('New Employee'), true, check_value('show_inactive')); $new_item = get_post('selected_id') == ''; end_row(); end_table(); if (get_post('_show_inactive_update')) { $Ajax->activate('selected_id'); set_focus('selected_id'); } } else { hidden('selected_id', get_post('selected_id')); } //$_POST['leave_days'] = $_POST['monthly_loan'] = 0; div_start('details'); if (isset($selected_id) && $selected_id != '') { $_POST['empl_id'] = $_POST['selected_id']; $myrow = get_employee($_POST['empl_id']);
$inpug_error = 1; display_error(tr("When the check box is not checked to indicate that the term expects a number of days after which accounts are due, the number entered should be less than 500 days.")); set_focus('DayNumber'); } if ($_POST['DayNumber'] == '') { $_POST['DayNumber'] = 0; } if ($inpug_error != 1) { if (isset($selected_id)) { if (check_value('DaysOrFoll')) { $sql = "UPDATE payment_terms SET terms=" . db_escape($_POST['terms']) . ",\n\t\t\t\t\tday_in_following_month=0,\n\t\t\t\t\tdays_before_due=" . db_escape($_POST['DayNumber']) . "\n\t\t\t\t\tWHERE terms_indicator = " . db_escape($selected_id); } else { $sql = "UPDATE payment_terms SET terms=" . db_escape($_POST['terms']) . ",\n\t\t\t\t\tday_in_following_month=" . db_escape($_POST['DayNumber']) . ",\n\t\t\t\t\tdays_before_due=0\n\t\t\t\t\tWHERE terms_indicator = " . db_escape($selected_id); } } else { if (check_value('DaysOrFoll')) { $sql = "INSERT INTO payment_terms (terms,\n\t\t\t\t\tdays_before_due, day_in_following_month)\n\t\t\t\t\tVALUES (" . db_escape($_POST['terms']) . ", " . db_escape($_POST['DayNumber']) . ", 0)"; } else { $sql = "INSERT INTO payment_terms (terms,\n\t\t\t\t\tdays_before_due, day_in_following_month)\n\t\t\t\t\tVALUES (" . db_escape($_POST['terms']) . ",\n\t\t\t\t\t0, " . db_escape($_POST['DayNumber']) . ")"; } } //run the sql from either of the above possibilites db_query($sql, "The payment term could not be added or updated"); meta_forward($_SERVER['PHP_SELF']); } } if (isset($_GET['delete'])) { // PREVENT DELETES IF DEPENDENT RECORDS IN debtors_master $sql = "SELECT COUNT(*) FROM debtors_master WHERE payment_terms = '{$selected_id}'"; $result = db_query($sql, "check failed"); $myrow = db_fetch_row($result);
function get_language_html_tags($lang_iso_code = '') { $lang_iso_code = !check_value($lang_iso_code) ? $lang_code : $lang_iso_code; return 'xml:lang="' . get_lang_used() . '" lang="' . get_lang_used() . '" dir="' . get_language_direction($lang_iso_code) . '"'; }
function change_tpl_flag($reconcile_id) { global $Ajax; if (!check_date() && check_value("rec_" . $reconcile_id)) { // temporary fix return false; } if (get_post('bank_date') == '') { // new reconciliation $Ajax->activate('bank_date'); } $_POST['bank_date'] = date2sql(get_post('reconcile_date')); $reconcile_value = check_value("rec_" . $reconcile_id) ? "'" . $_POST['bank_date'] . "'" : 'NULL'; update_reconciled_values($reconcile_id, $reconcile_value, $_POST['reconcile_date'], input_num('end_balance'), $_POST['bank_account']); $Ajax->activate('reconciled'); $Ajax->activate('difference'); return true; }
$api_upload->resize_width = $to_resize; $api_upload->thumb_width = chevereto_config('thumb_width'); $api_upload->thumb_height = chevereto_config('thumb_height'); $api_upload->max_size = return_bytes(chevereto_config('max_filesize')); /*** Do the thing? ***/ if ($api_upload->process()) { $api_status_code = 200; $api_status_txt = 'OK'; // Build the data array $api_data_array = $api_upload->image_info; if ($api_upload->is_remote) { $api_data_array['source'] = $to_upload; } else { $api_data_array['source'] = 'base64 image string'; } $api_data_array['resized'] = check_value($to_resize) ? '1' : '0'; $api_txt_output = $api_upload->image_info['image_url']; // Short URL generation if (is_config_short_url()) { require __CHV_PATH_INCLUDES__ . 'shorturl.php'; $api_data_array['shorturl'] = $ShortURL->get_ShortURL($api_upload->image_info['image_url']); } } else { $api_status_code = 403; $api_status_txt = $api_upload->error; } } else { $api_status_code = 403; $api_status_txt = $error; } $REST_API = array('status_code' => $api_status_code, 'status_txt' => $api_status_txt, 'data' => $api_data_array);
require_once __CHV_PATH_INCLUDES__ . 'template.functions.php'; /*** Set some url paths ***/ define('__CHV_URL_SYSTEM_JS__', absolute_to_url(__CHV_PATH_SYSTEM_JS__)); define('__CHV_URL_THEME__', absolute_to_url(__CHV_PATH_THEME__)); define('__CHV_URL_UPDATE_SCRIPT__', __CHV_BASE_URL__ . 'update.php'); // Virtual paths define('__CHV_VIRTUALFOLDER_IMAGE__', sanitize_path($config['virtual_folder_image'])); define('__CHV_VIRTUALFOLDER_UPLOADED__', sanitize_path($config['virtual_folder_uploaded'])); /*** Call the dB class ***/ require_once __CHV_PATH_CLASSES__ . 'class.db.php'; $dB = new dB(); /*** Call the Login class ***/ require_once __CHV_PATH_CLASSES__ . 'class.login.php'; $Login = new Login(); /*** Call the ShortURL class ***/ require_once __CHV_PATH_CLASSES__ . 'class.shorturl.php'; $ShortURL = new ShortURL(); /*** Flood protection ***/ if (preg_match('/upload/', access)) { $flood = is_upload_flood(); } /*** maintenance ***/ if (preg_match('/upload|API|pref/', access) && chevereto_config('maintenance')) { status_header(400); die('maintenance'); } /*** Call the handler ***/ if (check_value(access) && !preg_match("/API|update|pref/", access)) { require_once __CHV_PATH_CLASSES__ . 'class.handler.php'; $handler = new Handler(); }