Internal management system

Source: Internet
Author: User
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.

  1. // The sum function is used to record the total amount of expenditure/income.
  2. // The problem is how to calculate the income table-output table difference.
  3. Include 'Conn. php ';
  4. Function sum ($ name, $ table_name ){
  5. // Filter data
  6. $ SQL = "SELECT * FROM {$ table_name }";
  7. $ Query = mysql_query ($ SQL );
  8. $ List = array ();
  9. $ Sum1 = 0;
  10. While ($ res = mysql_fetch_array ($ query ))
  11. {
  12. $ List [] = $ res;
  13. $ Sum1 + = $ res ['Money'];
  14. }
  15. // Check the name of the input table. if it is payout, a negative number is displayed.
  16. If ($ table_name = 'payout '){
  17. Echo ''. $ name.": "."-". $ sum1 ."";
  18. }
  19. Else {
  20. Echo ''. $ name.": ". $ sum1 ."";
  21. }
  22. }
  23. // $ Sum2 = $ sum ('revenue table: ', 'Welcome ');
  24. // $ Sum1 = $ sum ('revenue table: ', 'payout ');
  25. ?>

  1. Session_start ();
  2. Error_reporting (0 );
  3. Include 'Conn. php ';
  4. Include 'header. php ';
  5. Include 'sum. php ';
  6. If (! $ _ SESSION ['user']) header ('Location: index. php ');
  7. // Paging logic
  8. $ Length = 5;
  9. $ Pagenum = $ _ GET ['Page']? $ _ GET ['Page']: 1;
  10. $ Offset = ($ pagenum-1) * $ length;
  11. $ SQL = "SELECT * FROM income order by id asc limit {$ offset}, {$ length }";
  12. $ Query = mysql_query ($ SQL );
  13. // Output table
  14. Echo'
  15. Echo "revenue statement ";
  16. While ($ res = mysql_fetch_array ($ query ))
  17. {
  18. ?>
  19. }
  20. Echo"
  21. ';

    Project

    Summary

    Amount (RMB)

    Sign Contract

    Commission

    Date

    Owner

    Operation

    ";
  22. // Obtain the next page of the previous page
  23. $ Prevpage = $ pagenum-1;
  24. $ Nextpage = $ pagenum + 1;
  25. ?>
  26. "> Previous Page |"> Next page
  27. // Calculate the total price
  28. Echo $ table = sum ('revenue indicates fine ', 'income ');
  29. ?>

  1. // Read the content in the payout table and display it as a table
  2. Session_start ();
  3. Error_reporting (0 );
  4. Include ("conn. php ");
  5. Include 'function. php ';
  6. Include 'sum. php ';
  7. If (! $ _ SESSION ['user']) header ("location: login. php ");
  8. Include ("header. php ");
  9. Echo' ';
  10. // Paging logic
  11. $ Pagesize = 20;
  12. $ Pagenum = $ _ GET ['Page']? $ _ GET ['Page']: 1;
  13. $ Offset = ($ pagenum-1) * $ pagesize;
  14. $ SQL = "SELECT * FROM payout order by pid asc limit {$ pagenum}, {$ pagesize }";
  15. $ Query = mysql_query ($ SQL );
  16. // Start the table
  17. Echo'
  18. Echo'
  19. Echo "expenditure schedule ";
  20. // Starts to read data cyclically.
  21. While ($ res = mysql_fetch_array ($ query )){
  22. ?>
  23. Output Table
  24. $ SQL = "SELECT * from payout ";
  25. $ Query = mysql_query ($ SQL );
  26. // Start calculation
  27. Echo $ sum = sum ("income table", "payout ");
  28. Mysql_close ();
  29. ?>
  30. '; ';

    Project details

    Summary

    Amount

    Date

    Handled

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.