<?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
<?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);
<?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; }
<?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();
\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}' )";
<?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();
<?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>
<?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
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;
<?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
<?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"); ?>
<?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); }
<?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); } }
<?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");
\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) {
function redirect_onok($location) { $res = beginDocument('Operation COMPLETE'); $res .= '<script type="text/javascript"> function timeoutgo() { document.location.href="' . html_entity_decode($location, ENT_QUOTES, 'UTF-8') . '"; } window.setTimeout("timeoutgo();", 500); </script>'; $res .= '<div align="center">' . beginTable(); $res .= '<tr><td><b>Operation COMPLETE</b></td></tr>'; $res .= endTable() . '</div>'; $res .= endDocument(); return $res; }
session_register("sess_name"); session_register("sess_admin"); beginDocument("Session Began", $sess_name); echo "Got User, session started, redirecting!<br>"; if ($customer != 1) { echo "<a href='main.php'>Main</a>"; echo "<script language='JavaScript'>window.location='main.php'</script>"; } else { echo "<a href='publicprofile.php'>Main</a>"; echo "<script language='JavaScript'>window.location='publicprofile.php'</script>"; } } else { echo "<script language='JavaScript'>window.location='index.php?login=failed'</script>"; } } else { beginDocument("Login", "Not Logged In"); session_destroy(); ?> <form name='login' method='POST' action='<?php $PHP_SELF; ?> '> <?php openForm("login", $PHP_SELF); ?> <table width='100%' height='50%' cellpadding=0 cellspacing=0 border=0> <tr> <td valign='center' align='center'> <?php beginPrettyTable("2", $lLogin); ?>
<?php # enter_salary_element.php displays a form that allows the entry of a new salary element and # handles the submission require "accrp.php"; session_start(); require "security/secure.php"; pt_register('POST', 'sal_desc', 'id_tp'); beginDocument("Enter Salary Element", $sess_user); if ($sal_desc) { $db = getDBConnection(); $result = mysql_query("INSERT INTO SAL_ID (SAL_DESC,ID_TP) VALUES ('{$sal_desc}','{$id_tp}')", $db); checkMySQLError(); mysqlReport($result, "Salary Element sucessfully added!", "main.php", "Home"); mysql_close($db); } else { ?> <table cellpadding=5 cellspacing=0 border=0 width='100%'> <tr> <td valign=top width='15%'> <?php beginPrettyTable("1"); ?> <tr> <?php echo "<td><a href='list_salary_elements.php'>show List</a></td>"; ?> </tr> <tr>
<?php # This form allows to enter a date. After submitting, all Bank and Cash Account-balances get # printed seperated by Projects. session_start(); require "accrp.php"; require "security/secure.php"; beginDocument("list Cash and Bank", $sess_user); if ($date) { $ac1 = get_ac_array(1); foreach ($ac1 as $key => $prj_desc) { $accounts = new BankAndCashAccounts_byProject($key, $date, "c"); beginPrettyTable(4, "{$prj_desc}"); printRow(array("Account", "Balance")); while ($row = $accounts->getNext()) { printRow(array($row["AC5_DESC"], $accounts->getActualBalance() . " "), "irgendwas"); } printRow(array("Sum", $accounts->getSum())); endPrettyTable(); } } else { openForm("enter Date", $PHP_SELF); beginPrettyTable("2", "list bank and cash"); makeTextField("date", get_today_hrd_string(), "Date:"); makeSubmitter(); endPrettyTable(); closeForm(); } endDocument();
<?php # enter_desig.php displays a form that allows the entry of a designation and # handles the submission session_start(); require "accrp.php"; require "security/secure.php"; beginDocument("Enter Designation", $sess_user); if ($desig_desc) { $db = getDBConnection(); $result = mysql_query("INSERT INTO DESIG (DESIG_DESC) VALUES ('{$desig_desc}')", $db); checkMySQLError(); mysqlReport($result, $lCustomerAddition, "main.php", "Home"); mysql_close($db); } else { ?> <table cellpadding=5 cellspacing=0 border=0 width='100%'> <tr> <td valign=top width='15%'> <?php beginPrettyTable("1"); ?> <tr> <?php echo "<td><a href='list_desig.php'>show List</a></td>"; ?> </tr> <tr> <td><hr color='black'></td>
<?php # enter_personal.php displays a form that allows the entry of a personal and # handles the submission session_start(); require "accrp.php"; require "security/secure.php"; beginDocument("Enter personal", $sess_user); if ($desig_id) { $db = getDBConnection(); # convert dates if ($conf_dt == "") { $conf_dt = "0000-00-00"; } else { $conf_dt = conv_to_srd($conf_dt); } if (!isset($join_dt) || $join_dt == "") { $join_dt = "0000-00-00"; } else { $join_dt = conv_to_srd($join_dt); } if ($emp_id3) { $query = "UPDATE PERSONAL SET EMP_NAME='{$emp_name}', DESIG_ID={$desig_id}, STATUS='{$status}', AC_NO='{$ac_no}', CONF_DT='{$conf_dt}', JOIN_DT='{$join_dt}' WHERE EMP_ID3={$emp_id3}"; echo $query; $result = mysql_query($query, $db); checkMySQLError(); mysqlReport($result, "Employer sucessfully updated", "main.php", "Home"); mysql_close($db); } else { $query = "INSERT INTO PERSONAL (EMP_NAME, DESIG_ID, STATUS, AC_NO, CONF_DT,JOIN_DT) VALUES ('{$emp_name}','{$desig_id}','{$status}', '{$ac_no}', '{$conf_dt}','{$join_dt}')"; echo $query;
?> </field> <old_value><?php echo db_result($result, $x, 'old_value'); ?> </old_value> <date><?php echo db_result($result, $x, 'entrydate'); ?> </date> <by><?php echo db_result($result, $x, 'user_name'); ?> </by> </item> <?php } ?> </change_log> <?php } ?> </artifact> </tracker> <?php } } else { beginDocument(); displayError('Group ID or Artifact ID Not Set'); endDocument(); }