本文整理汇总了PHP中beginDocument函数的典型用法代码示例。如果您正苦于以下问题:PHP beginDocument函数的具体用法?PHP beginDocument怎么用?PHP beginDocument使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了beginDocument函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: session_start
<?php
# enter_openingbalance.php displays a form that allows the entry of a opening balance
# All Accounts which have BANK or CASH in their AC3 get listed
require "accrp.php";
session_start();
require "security/secure.php";
pt_register('POST', 'submitnow');
# others are not needed, they get accessed by $_POST (see line 33)
beginDocument("Enter OpeningBalance", $sess_user);
if ($submitnow == 1) {
$db = getDBConnection();
$query_part1 = "INSERT INTO TRANS (VR_NO, VR_DT, VR_TP, AC_ID1, AC_ID2, AC_ID3, AC_ID4, AC_ID5, DR_CR, CHQ_NO, AMOUNT, PARTY, REMARKS, T_DT, DEPT) VALUES ";
$today = get_today_srd_string();
$accounts = new BankAndCashAccounts("1", "0000-00-00", "c");
while ($row = $accounts->getNext()) {
$ac1 = $row["AC_ID1"];
$ac2 = $row["AC_ID2"];
$ac3 = $row["AC_ID3"];
$ac4 = $row["AC_ID4"];
$ac5 = $row["AC_ID5"];
$field_name = "account_field_" . $ac5;
$field_desc = $accounts->getActualCodeName();
$amount = $_POST[$field_name];
if ($amount == "") {
echo "Warning: Field {$field_desc} has zero Amount!<br>";
continue;
}
$amount = $_POST[$field_name];
$vr_no = get_new_vrno();
# insert voucher
示例2: session_start
<?php
# lists all transactions on a specific Account
require "accrp.php";
session_start();
require "security/secure.php";
pt_register('POST', 'ac_id1', 'startdate', 'enddate');
beginDocument("list Project Transactions", $sess_user);
if (isset($ac_id1)) {
print_project_transactions_head($ac_id1, $startdate, $enddate, $ac_name);
#Receipts
# generate Transaction-object
if ($ac_id1 != 0) {
$transactions = new Transactions($ac_id1, $startdate, $enddate);
} else {
$transactions = new Transactions_byProject("1", $startdate, $enddate);
}
beginPrettyTable("4", "Receipts");
printRow(array("", "<b>opening Balance:</b>", "<b>" . $transactions->getOpeningBalance() . "</b>"));
printRow(array("Code Number", "Description", "Amount", "VR-Type"));
while ($row = $transactions->getNextReceipt()) {
printRow($row, "fluct");
}
printRow(array("", "<b>total Receipts<b>", "<b>" . $transactions->getTotalReceipts() . "</b>"));
endPrettyTable();
# Payments
# generate Transaction-object
if ($ac_id1 != 0) {
$transactions = new Transactions($ac_id1, $startdate, $enddate);
} else {
$transactions = new Transactions_byProject("1", $startdate, $enddate);
示例3: beginDocument
<?php
# This chunk of code checks to see if a customer has been registered in the
# session, if not, it dies. Security!
if (!session_is_registered("sess_customer") and !session_is_registered("sess_user")) {
beginDocument("Security", "Not Logged In");
beginPrettyTable(1, "Security");
echo "<tr><td class='data'>You are not logged in. Please <a href='index.php'>Login</a></td></tr>";
endPrettyTable();
die;
}
示例4: session_start
<?php
# Correct the stupid AC5-ID in the TRANS Table
# should only started once after loading datadump
session_start();
require "accrp.php";
require "security/secure.php";
beginDocument("Correcting AC5 in TRANS-Table", $sess_user);
$db = getDBConnection();
$result = mysql_query("SELECT * from `TRANS`", $db);
checkMySQLError();
while ($row = mysql_fetch_array($result, $db)) {
$vr_dt = $row["VR_DT"];
$vr_no = $row["VR_NO"];
$ac1 = $row["AC_ID1"];
$ac2 = $row["AC_ID2"];
$ac3 = $row["AC_ID3"];
$ac4 = $row["AC_ID4"];
$new_ac5 = get_ac5($ac1, $ac2, $ac3, $ac4);
$result2 = mysql_query("UPDATE TRANS SET AC_ID5='{$new_ac5}' WHERE VR_DT='{$vr_dt}' AND VR_NO='{$vr_no}'", $db);
checkMySQLError();
echo "updated new AC5 {$new_ac5}<br>";
}
echo "done it<br>";
endDocument();
示例5: Date
\t}
\treturn new Date(year,month-1,day);
}
function checkdate(datestring) {
\tvar reg_exp = /(\\d{1,2})-(\\d{1,2})-(\\d{4})/;
\tif (!datestring.match(reg_exp)) {
\t\talert("Date (" + datestring + ") is invalid!");
\t\treturn false;
\t}
\treturn true;
}
//-->
</script>
EOD;
beginDocument("Enter PF-Loan entry", $sess_user, $javascript);
if ($emp_id3) {
$db = getDBConnection();
if ($type == "PF") {
$loan_table = "PF_LOAN";
} else {
if ($type == "CUF") {
$loan_table = "CUF_LOAN";
} else {
die("Loantype unspecified !");
}
}
$loan_dt = conv_to_srd($loan_dt);
$loan_start = conv_to_srd($loan_start);
$loan_end = conv_to_srd($loan_end);
$query = "INSERT INTO {$loan_table} (EMP_ID3,LOAN_DT,LOAN_START,LOAN_END,LOAN_AMT,INT_AMT,TOT_AMT,INST_NO,INT_RATE) VALUES ('{$emp_name}','{$loan_dt}','{$loan_start}','{$loan_end}','{$loan_amt}','{$int_amt}','{$tot_amt}', '{$inst_no}', '{$int_rate}' )";
示例6: session_start
<?php
# Show Profile shows all the Customer Info, Invoices, Payments, Tickets,
# and a balance.
require "accrp.php";
session_start();
require "security/secure.php";
beginDocument($lCustomerProfile, $sess_user);
$db = getDBConnection();
$result = mysql_query("select * from DESIG order by DESIG_ID", $db);
checkMySQLError();
if ($result_row = mysql_fetch_array($result)) {
beginPrettyTable("4", "DESIGNATIONS");
beginBorderedTable("4");
echo "<tr>\n";
echo " <td><b>DESIG_ID</b></td> <td><b>DESIG_DESC</b></td> \n <td><b>{$lActions}</b></td>\n </tr>\n";
do {
if ($class == "odd") {
$class = "even";
} else {
$class = "odd";
}
printf(" <tr class='{$class}'>\n <td><a href='%s?CustomerID=%s'>%s</td> <td>%s</td>\n <td align='center'><a href='confirm.php?action=deletecustomer&CustomerID=%s'><img src='images/delete.gif' height=24 width=24 border=0 alt='Delete this Customer'></a></td></tr>\n", $PHP_SELF, $result_row["DESIG_ID"], $result_row["DESIG_ID"], $result_row["DESIG_DESC"], $result_row["DESIG_ID"]);
} while ($result_row = mysql_fetch_array($result));
endPrettyTable();
endBorderedTable();
} else {
echo "No Designations Found...\n";
}
endDocument();
示例7: session_start
<?php
require "accrp.php";
session_start();
require "security/secure.php";
beginDocument("Main", $sess_user);
$db = getDBConnection();
#$result = mysql_query("SELECT * from Configuration", $db);
# $configuration = mysql_fetch_array($result);
$version = 0.1;
# $configuration["Version"];
echo "<b> accrp {$version}</b>\n";
?>
<hr>
<table cellpadding=5 cellspacing=0 border=0 width='100%'>
<tr>
<td valign=top width='15%'>
<?php
beginPrettyTable("1");
?>
<tr>
<td><a href='list_ledger_sheet.php'>Ledger sheet</a></td>
</tr>
<tr>
<td><hr color='black'></td>
</tr>
<tr>
<td><a href='list_project_balances.php'>Project Balance</a></td>
</tr>
<tr>
<td><hr color='black'></td>
示例8: session_start
<?php
# enter_dept.php displays a form that allows the entry of a department and
# handles the submission
# I don't know what this is doing.
# I've copied it from the origin Project
session_start();
# see page 218 of "beginning PHP". Nearly the same than include(...)
# (I don't know the difference between require and include)
require "accrp.php";
require "security/secure.php";
# Prints all that HTML-stuff, we don't want to deal with
beginDocument("Enter Department", $sess_user);
# This PHP-File (and nearly all the others) have two parts. One is showing
# the Form, the other one is doing database-stuff with the data, typed
# in the form
if ($dept_name) {
# means nearly the same than "if user already typed in data"
# get a connection to the database
$db = getDBConnection();
# insert the new department
$result = mysql_query("INSERT INTO DEPT (DEPT_NAME) VALUES ('{$dept_name}')", $db);
# check if anything went wrong
checkMySQLError();
# Give the user a report
mysqlReport($result, "Department sucessfully added", "main.php", "Home");
# close connection to database
mysql_close($db);
} else {
## the following code is ignored. perhaps, we will use it sometimes
## later, when we make the possibility to edit a department
示例9: changedExpenseField
function changedExpenseField(value) {
\tif (isNaN(value) || value=="")
\t\tvalue = 0;
\tvar diff = parseInt(value)-expenseOld;
\tvar expense_sum = parseInt(document.editsalary.expense_sum.value);
\tvar total_sum = parseInt(document.editsalary.total_sum.value);
\tdocument.editsalary.expense_sum.value = expense_sum + diff;
\tdocument.editsalary.total_sum.value = total_sum - diff;
}
//-->
</script>
EOD;
beginDocument("Enter personal", $sess_user, $javascript);
if ($submitnow == 1) {
$db = getDBConnection();
# this is not very clever. First removing everything and then again inserting and we
# don't get a history, what the employees earned one
# year ago ... but it's easier and I'm in hurry ...
$query = "DELETE FROM EMP_SAL WHERE EMP_ID3={$emp_id3}";
echo "{$query}";
$result = mysql_query($query, $db);
checkMySQLError();
$salary_elements_array_desc = get_salary_elements_array("SAL_DESC");
$salary_elements_array_tp = get_salary_elements_array("ID_TP");
foreach ($_POST as $key => $value) {
echo "processing field: {$key}<br>";
if (ereg("^salary_field_([0-9]*)_tp\$", $key)) {
continue;
示例10: session_start
<?php
# enter_ac5.php displays a form that allows the entry of a AC5 and
# handles the submission
session_start();
require "accrp.php";
require "security/secure.php";
beginDocument("Enter AC_Code 5", $sess_user);
if ($ac5_desc) {
foreach ($HTTP_POST_VARS as $key => $value) {
if ($value == -1) {
report($result, "Please, don't leave any field empty !", "main.php", "Home");
exit;
}
}
$db = getDBConnection();
$result = mysql_query("INSERT INTO AC_CODE5 (AC_ID1, AC_ID2, AC_ID3, AC_ID4, AC5_DESC) VALUES ('{$ac_id1}', '{$ac_id2}', '{$ac_id3}', '{$ac_id4}', '{$ac5_desc}')", $db);
checkMySQLError();
mysqlReport($result, $lCustomerAddition, "main.php", "Home");
mysql_close($db);
} else {
$ac1_array = get_ac_array(1);
$ac2_array = get_ac_array(2);
$ac3_array = get_ac_array(3);
$ac4_array = get_ac_array(4);
?>
<table cellpadding=5 cellspacing=0 border=0 width='100%'>
<tr>
<td valign=top width='15%'>
<?php
示例11: session_start
<?php
# Enter customer displays a form that allows the entry of a customer, and
# handles the submission
require "accrp.php";
session_start();
require "security/secure.php";
pt_register('POST', 'ac', 'ac_desc');
beginDocument($lEnterCustomer, $sess_user);
if ($ac_desc) {
# the variable $ac determines, which AC_CODE_Table to alter
if (!$ac) {
$ac = 1;
}
$db = getDBConnection();
$result = mysql_query("INSERT INTO AC_CODE{$ac} (AC{$ac}_DESC) VALUES ('{$ac_desc}')", $db);
mysqlReport($result, "show list", "list_acs?showac={$ac}", "show list");
mysql_close($db);
} else {
if (!$ac) {
die("Error: I don't know, which Table to alter !");
}
?>
<table cellpadding=5 cellspacing=0 border=0 width='100%'>
<tr>
<td valign=top width='15%'>
<?php
beginPrettyTable("1");
?>
示例12: session_start
<?php
# lists all transactions on a specific Account
session_start();
require "accrp.php";
require "security/secure.php";
beginDocument("list Ledger Sheet", $sess_user);
if (isset($ac_id1)) {
print_project_transactions_head($ac_id1, $startdate, $enddate, $ac_name);
#Receipts
# generate Transaction-object
if ($ac_id1 != 0) {
$transactions = new Transactions($ac_id1, $startdate, $enddate);
} else {
$transactions = new Transactions_byProject("1", $startdate, $enddate);
}
beginPrettyTable("4", "Receipts");
printRow(array("", "<b>opening Balance:</b>", "<b>" . $transactions->getOpeningBalance() . "</b>"));
printRow(array("Code Number", "Description", "Amount", "VR-Type"));
while ($row = $transactions->getNextReceipt()) {
printRow($row, "abwechselnd");
}
printRow(array("", "<b>total Receipts<b>", "<b>" . $transactions->getTotalReceipts() . "</b>"));
endPrettyTable();
# Payments
# generate Transaction-object
if ($ac_id1 != 0) {
$transactions = new Transactions($ac_id1, $startdate, $enddate);
} else {
$transactions = new Transactions_byProject("1", $startdate, $enddate);
}
示例13: session_start
<?php
session_start();
require "accrp.php";
require "security/secure.php";
beginDocument("restore_backup", $sess_user);
pt_register('POST', 'submit');
if ($dbdumpfile) {
if ($_FILES['dbdumpfile']['type'] != "application/x-tgz") {
die("Datadump must be a tar-gz-file !");
}
$db = getDBConnection();
deldir("/tmp/ac4ngosdata/");
# 0333 does not work properly :-( so chmod ...
$filename = $_FILES['dbdumpfile']['tmp_name'];
move_uploaded_file($filename, "/tmp/ac4ngosimport.tar.gz") || die("Something wrong with the uploaded file ...");
exec("cd /tmp; tar -xzf ac4ngosimport.tar.gz;chmod -R o+r ac4ngosdata");
$result = mysql_query("SHOW TABLES FROM {$DBNAME}");
checkMySQLError();
while ($row = mysql_fetch_array($result, $db)) {
$tablename = $row["Tables_in_{$DBNAME}"];
$query = "DELETE FROM {$tablename}";
$result2 = mysql_query($query, $db);
checkMySQLError($query);
$filename = "/tmp/accrpdata/" . $tablename . ".txt";
if (file_exists($filename)) {
$query = "LOAD DATA INFILE '{$filename}' INTO TABLE `{$tablename}`";
$result2 = mysql_query($query, $db);
checkMySQLError($query);
}
}
示例14: session_start
<?php
# Idont know, what this is for :-(
session_start();
require "accrp.php";
require "security/secure.php";
beginDocument("list project Balance", $sess_user);
if (isset($ac_id1)) {
print_project_transactions_head($ac_id1, $startdate, $enddate, $ac_name);
# generate account-objects
if ($ac_id1 != 0) {
$openingAccounts = new BankAndCashAccounts_byProject($ac_id1, $startdate, "o");
$paymentsAccounts = new Accounts_byProject($ac_id1, $startdate, $enddate, "Ea");
$receiptsAccounts = new Accounts_byProject($ac_id1, $startdate, $enddate, "LI");
$closingAccounts = new BankAndCashAccounts_byProject($ac_id1, $enddate, "c");
} else {
$openingAccounts = new BankAndCashAccounts("1", $startdate, "o");
$paymentsAccounts = new Accounts("1", $startdate, $enddate, "Ea");
$receiptsAccounts = new Accounts("1", $startdate, $enddate, "LI");
$closingAccounts = new BankAndCashAccounts("1", $enddate, "c");
}
# Opening Balance
beginPrettyTable("4", "Opening Balance");
printRow(array("Code Number", "Description", "Amount"));
while ($openingAccounts->getNext()) {
printRow(array($openingAccounts->getActualCodeString(), $openingAccounts->getActualCodeName(), $openingAccounts->getActualBalance()), "abwechselnd");
}
printRow(array("", "Total", $openingAccounts->getSum()));
endPrettyTable();
# Payments
beginPrettyTable("4", "Payments");
示例15: beginDocument
\t\t\talert("{$errorNo5}");
\t\t\treturn false;
\t\t}
\t}
}\t\t\t\t\t\t\t\t\t\t\t\t\t
//-->
</script>
EOD;
# Adapt the Errormessages for the FallBack-Solution
$back_button = " Please use the back-button of your browser and correct your voucher!";
$errorNo1 .= $back_button;
$errorNo2 .= $back_button;
$errorNo3 .= $back_button;
$errorNo4 .= $back_button;
$errorNo5 .= $back_button;
beginDocument("Enter Transaction", $sess_user, $javascript);
if ($submitnow == "1") {
$db = getDBConnection();
$ac5_array = get_ac5_array();
# Get easily the different AC_Codes with AC_ID5
# For this, AC_ID5 must be a primary key (no doubles)
$ac_id1 = $ac5_array[$ac_name][1];
$ac_id2 = $ac5_array[$ac_name][2];
$ac_id3 = $ac5_array[$ac_name][3];
$ac_id4 = $ac5_array[$ac_name][4];
$vr_dt = conv_to_srd($vr_dt);
$t_dt = get_today_srd_string();
# First, we have to check, if everything is fine (see above errormessages)
# This is already done with javascript but we need a fallback-solution
# 1. An Account must be chosen
if ($ac_name == -1) {