[x]
Posted via EE Mobile

Search, ask, and monitor your questions on the go with EE Mobile. Visit Experts Exchange from your mobile device and never be out of touch again.

Question
[x]
Attachment Details
[x]
The Solution Rating System

With so many solutions, how can you tell which solutions are most likely to help you and which ones are not? To provide you with a tool to use, we rate our solutions based on various elements that most accurately determine if a solution is a quality solution. To explain what factors affect the solution rating, here are the elements we take into consideration when formulating our solution rating.

  • The Grade of the Solution
  • The Zone Rank of the Expert Providing the Solution
  • The Number of Author and Expert Comments
  • The Number of Experts Contributing
  • The Feedback of the Community

Your Input Matters
Because of the way the system is set up, the most important variable in this equation is you. As a member of Experts Exchange, you are able to cast your vote on the quality of the solutions in regard to how complete, accurate, helpful and easy to understand each solution is. When you provide your feedback, each rating is adjusted accordingly. So, if you see a solution that has a poor rating that you think is a good solution, let us know by rating it. As you do, the rating will be adjusted and will become more accurate for other members of our site.

If you have any suggestions that you would like to make for our rating system, please ask a question in the Suggestions Zone of Community Support.

Thank you!

5.0

modify accounting program

Asked by francoma617 in PHP and Databases

Tags: actual_cos, validn

Dear Experts,

I use the following program to generate the account report and the output is as follows:
Month Revenue estimated cost estimated GP
1 2005-11 1,600.00 1,260.00 340.00
2 2005-12 4,080.00 2,280.00 1,800.00
3 2006-01 2,640.00 660.00 1,980.00
Total: 8,320.00  4,200.00  4,200.00  

There is a table “cost_table” which store the actual cost per month and the structure is as follows:
mysql> describe cost_table;
+-----------+-------------+------+-----+---------+----------------
| Field     | Type        | Null | Key | Default | Extra
+-----------+-------------+------+-----+---------+----------------
| id        | int(11)     | NO   | PRI | NULL    | auto_increment
| date      | date        | NO   |     |         |
| item      | varchar(30) | NO   |     |         |
| costtype  | varchar(30) | NO   |     |         |
| amount    | float       | NO   |     |         |
| remark    | varchar(30) | NO   |     |         |
| receiptno | varchar(30) | NO   |     |         |
| bank      | varchar(30) | NO   |     |         |
| bankno    | varchar(30) | NO   |     |         |
| tutorname | varchar(30) | NO   |     |         |
| test      | float       | NO   |     |         |
| chequeno  | varchar(30) | NO   |     |         |

Please help to modify the following program to use the field “amount” from table “cost_table” above to replace the field “salary” from table “course”. I want the new program below the original one and create some more calculation as follows:

Month Revenue “actual cost” “actual GP”
1 2005-11 1,600.00 1,260.00 340.00
2 2005-12 4,080.00 2,280.00 1,800.00
3 2006-01 2,640.00 660.00 1,980.00
Total: 8,320.00  4,200.00  4,200.00  

Actual monthly GP: XXXX
(it should be equal to total “actual GP” divide by no. of month. In the above case, it is $4200 / 3 = $1400).

GP(%): XXXXX
(it should be the percentage total actual GP with total Month Revenue. In the above case, it is 4200/8320 = 50.4%)

Here is the program:
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Futurelink program</title>
</head>
<body>

<?php
include_once "coolmenu.php";
?>
<br>



<form name="form1" method="post" action="checkallmonthrevenue.php">
<p>please input month range to list the revenue generated for the month
}<br>
From<input type="text" name="udatefrom">
To<input type="text" name="udateto">
<input type="submit" name="Submit" value="Submit">
<input name="Reset" type="reset" id="Reset" value="Reset">
<p> Remark: The input format should be like: 2005-12 2006-01, 2006-01 2006-04,or...<br>

</form>


<?php
//configue for connect to database
$host="localhost";
$user="franco";
$pass="1234";
$database="futurelink";
$table="course";

$udatefrom=isset($_POST["udatefrom"])?$_POST["udatefrom"]:"";
$udateto=isset($_POST["udateto"])?$_POST["udateto"]:"";
if(isset($_POST['Submit'])) {

if(empty($udatefrom) || empty($udateto)) {
     die("Both From and To Dates Are Required");
}
/* added date validn */
if (date("Y-m",strtotime($udatefrom)) > date("Y-m",strtotime($udateto))){
     die("From date Cannot Be greater than To Date");
}

echo "<font size=3><b>The result is:</b></font><hr>";

//When there is content that we could get from the list

  //Connect to mysql
   $link=mysql_connect($host,$user,$pass)or die ("Error ".mysql_query());
   mysql_query("SET NAMES utf8");
 
  //judge the connection is ok or not
   if($link != False)
   {
        mysql_select_db($database) or die ("Error ".mysql_query());
     //setup search command
     //get data from course that match with the condition
      $qsum="Select sum(revenue) as Revenue ,sum(salary) as Salary, sum(gp) as Gp ,date_format(lesson1,'%Y-%m') as Month From course where DATE_FORMAT(lesson1,'%Y-%m') between '$udatefrom' and '$udateto' group by date_format(lesson1,'%Y-%m')";

      $result=mysql_db_query($database,$qsum,$link);  
      $rows=mysql_num_rows($result) or die ("Error ".mysql_query());

if($rows > 0)    
{  
$rowcnt =1;
$revenue_sum=0;
$salary_sum=0;
$gp_sum=0;
echo "<table border=2 bgcolor='yellow'>";
echo "<tr><td>Id</td><td>Month</td><td>Revenue</td><td>estimated cost</td><td>estimated GP</td>";
while($row = mysql_fetch_array($result)){
?>
<tr>
<td><?php echo $rowcnt ;?></td>
<td><?php echo $row[3];?></td>
<td><?php echo number_format($row[0],2);?></td>
<td><?php echo number_format($row[1],2);?></td>
<td><?php echo number_format($row[2],2);?></td>
</tr>

<?php
     $rowcnt++;
     $revenue_sum=$revenue_sum+$row[0];
     $salary_sum=$salary_sum+$row[1];
     $gp_sum=$gp_sum+$row[1];    
}
echo "<tr style='font-weight:bold'><td colspan=2>Total:</td><td>".number_format($revenue_sum, 2)." </td>
    <td>".number_format($salary_sum, 2)." </td>
    <td>".number_format($gp_sum, 2)." </td>    
    </tr>";
echo "</table>";
      }else{
            echo "No Records Available";
      }
     
  }else{
     echo "Cannot connect to MySQL";
  }

}
?>

</body>
</html>

[+][-]01/11/06 08:10 PM, ID: 15678649Expert Comment

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]01/11/06 08:14 PM, ID: 15678660Author Comment

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]01/11/06 08:18 PM, ID: 15678677Expert Comment

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]01/11/06 08:21 PM, ID: 15678689Expert Comment

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]01/11/06 08:22 PM, ID: 15678691Author Comment

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]01/11/06 08:23 PM, ID: 15678695Author Comment

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]01/11/06 08:46 PM, ID: 15678785Expert Comment

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]01/11/06 08:55 PM, ID: 15678818Author Comment

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]01/11/06 09:02 PM, ID: 15678836Expert Comment

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]01/11/06 09:07 PM, ID: 15678847Author Comment

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]01/11/06 09:33 PM, ID: 15678928Expert Comment

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]01/11/06 09:49 PM, ID: 15678974Author Comment

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]01/11/06 10:16 PM, ID: 15679021Author Comment

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]01/11/06 10:22 PM, ID: 15679035Expert Comment

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]01/11/06 10:28 PM, ID: 15679046Author Comment

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]01/11/06 10:41 PM, ID: 15679087Expert Comment

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]01/11/06 11:13 PM, ID: 15679156Expert Comment

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]01/11/06 11:20 PM, ID: 15679171Author Comment

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]01/11/06 11:40 PM, ID: 15679223Author Comment

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]01/11/06 11:48 PM, ID: 15679243Expert Comment

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]01/11/06 11:52 PM, ID: 15679254Author Comment

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]01/11/06 11:58 PM, ID: 15679278Expert Comment

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]01/12/06 12:11 AM, ID: 15679323Expert Comment

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]01/12/06 12:23 AM, ID: 15679364Author Comment

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]01/12/06 12:49 AM, ID: 15679451Expert Comment

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]01/12/06 12:59 AM, ID: 15679483Author Comment

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]01/12/06 01:04 AM, ID: 15679503Expert Comment

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]01/12/06 01:11 AM, ID: 15679527Author Comment

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]01/12/06 01:14 AM, ID: 15679540Expert Comment

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]01/12/06 01:17 AM, ID: 15679562Author Comment

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]01/12/06 01:48 AM, ID: 15679710Accepted Solution

View this solution now by starting your 30-day free trial. Setting up your free trial is quick, easy, and secure. We will return you to this solution, unlocked, when you're done.

About this solution

Zone: PHP and Databases
Tags: actual_cos, validn
Sign Up Now!
Solution Provided By: sajuks
Participating Experts: 1
Solution Grade: A
 
 
Loading Advertisement...
20091021-EE-VQP-81