Internal management system
Simple recording of expenses, income, and reimbursement.
The problem is how to calculate the income table (income)-output table (payout) difference.
If you need a complete set of source code, you can directly leave a mailbox or add me QQ to send it directly.
I hope that you can help correct the logic with errors or how to strengthen it.
Thank you.
- // The sum function is used to record the total amount of expenditure/income.
- // The problem is how to calculate the income table-output table difference.
- Include 'Conn. php ';
- Function sum ($ name, $ table_name ){
- // Filter data
- $ SQL = "SELECT * FROM {$ table_name }";
- $ Query = mysql_query ($ SQL );
- $ List = array ();
- $ Sum1 = 0;
- While ($ res = mysql_fetch_array ($ query ))
- {
- $ List [] = $ res;
- $ Sum1 + = $ res ['Money'];
- }
- // Check the name of the input table. if it is payout, a negative number is displayed.
- If ($ table_name = 'payout '){
- Echo ''. $ name.": "."-". $ sum1 ."";
- }
- Else {
- Echo ''. $ name.": ". $ sum1 ."";
- }
- }
- // $ Sum2 = $ sum ('revenue table: ', 'Welcome ');
- // $ Sum1 = $ sum ('revenue table: ', 'payout ');
- ?>
- Session_start ();
- Error_reporting (0 );
- Include 'Conn. php ';
- Include 'header. php ';
- Include 'sum. php ';
- If (! $ _ SESSION ['user']) header ('Location: index. php ');
- // Paging logic
- $ Length = 5;
- $ Pagenum = $ _ GET ['Page']? $ _ GET ['Page']: 1;
- $ Offset = ($ pagenum-1) * $ length;
- $ SQL = "SELECT * FROM income order by id asc limit {$ offset}, {$ length }";
- $ Query = mysql_query ($ SQL );
- // Output table
- Echo'
- Echo "revenue statement ";
- While ($ res = mysql_fetch_array ($ query ))
- {
- ?>
- }
- Echo"
|
Project |
Summary |
Amount (RMB) |
Sign Contract |
Commission |
Date |
Owner |
Operation |
';
";
- // Obtain the next page of the previous page
- $ Prevpage = $ pagenum-1;
- $ Nextpage = $ pagenum + 1;
- ?>
- "> Previous Page |"> Next page
- // Calculate the total price
- Echo $ table = sum ('revenue indicates fine ', 'income ');
- ?>
- // Read the content in the payout table and display it as a table
- Session_start ();
- Error_reporting (0 );
- Include ("conn. php ");
- Include 'function. php ';
- Include 'sum. php ';
- If (! $ _ SESSION ['user']) header ("location: login. php ");
- Include ("header. php ");
- Echo' ';
- // Paging logic
- $ Pagesize = 20;
- $ Pagenum = $ _ GET ['Page']? $ _ GET ['Page']: 1;
- $ Offset = ($ pagenum-1) * $ pagesize;
- $ SQL = "SELECT * FROM payout order by pid asc limit {$ pagenum}, {$ pagesize }";
- $ Query = mysql_query ($ SQL );
- // Start the table
- Echo'
- Echo'
- Echo "expenditure schedule ";
- // Starts to read data cyclically.
- While ($ res = mysql_fetch_array ($ query )){
- ?>
- Output Table
- $ SQL = "SELECT * from payout ";
- $ Query = mysql_query ($ SQL );
- // Start calculation
- Echo $ sum = sum ("income table", "payout ");
- Mysql_close ();
- ?>
-
';
|
Project details |
Summary |
Amount |
Date |
Handled |
';
|