PHP Mysql Accounting & Bookkeeping
PHP Mysql Accounting & Bookkeeping:
Journal Entry
Under Construction
1. Main Menu   2. Customers   3. Items   4. Ledger  
5. PayPal   6. Download  

This is the PHP Mysql Accounting & Bookkeeping software we have been writing for our current operating business.
We are currently using a much updated version and as time permits we will add the modified code to this website.
Download
-- phpMyAdmin SQL Dump
-- version 2.6.4-pl1
-- http://www.phpmyadmin.net
--
--
-- Table structure for table `bookkeeping`
--
Step 1 create a database called ier and then query it with the following

CREATE TABLE `bookkeeping` (
`DebitCCCheck` varchar(99) collate latin1_general_ci NOT NULL default '',
`AccountingGLCode` varchar(99) collate latin1_general_ci NOT NULL default '',
`DescriptionOfExpense` varchar(99) collate latin1_general_ci NOT NULL default '',
`ExpenseAmount` varchar(99) collate latin1_general_ci NOT NULL default '',
`timestamp` varchar(99) collate latin1_general_ci NOT NULL default '',
`IncomeAmount` varchar(99) collate latin1_general_ci NOT NULL default '',
`counter` int(99) NOT NULL auto_increment,
PRIMARY KEY (`count`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_general_ci AUTO_INCREMENT=1 ;

938
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html><head>
<?
######################################################################

# Open Database Connection
#
######################################################################
$DB_HOST "localhost";
$DB_USER "root";
$DB_PASS "";
$DB_DB "ier";
$db= @mysql_pconnect $DB_HOST $DB_USER $DB_PASS );
@
mysql_select_db $DB_DB )  or die ( "DATABASE ERROR!" );
######################################################################
$table "paypal";

$result mysql_query("SHOW FIELDS FROM $DB_DB.$table");
$Paypal_i 0;
//echo "<HR>Database:$DB_DB TABLE:$table<BR>";

while ($row mysql_fetch_array($result)) 
 {
 
//echo $row['Field'] . "-" .$row['Type'] . "<BR>";
 
$Paypal_Field[$Paypal_i] = $row['Field'];
 
$Paypal_Type[$Paypal_i] = $row['Type']; 
 
$Paypal_i++; 
 }
?>
<LINK rel="stylesheet" type="text/css" title="bluesilver" href="/xampp/www/1Repair/blueSilver.css">
<style type="text/css"> <!-- A:hover {color:#0000ff} --></style>
</head>
<!-- End Header -->    
<body bgcolor="ffffff" link="FFFFFF" vlink="FFFFFF" topmargin="3" leftmargin="5" marginwidth="5">
<?


$post_with_threads_query 
mysql_query("SELECT * FROM paypal");
$jobs .= "<table border=1>";
            
$jobs .= "<tr><th>";
       
$jobs .= "<span class=\"postdetails\">" ;                                                
            
$jobs .= 'Date';
            
$jobs .= "</th><th>";                             
            
$jobs .= 'Name';
            
$jobs .= "</th><th>";                             
            
$jobs .= 'Item Title';
            
$jobs .= "</th><th>";
            
$jobs .= 'Gross';
            
$jobs .= "</th><th>";     
            
$jobs .= 'Fee';
            
$jobs .= "</th><th>";     
            
$jobs .= 'Net';
            
$jobs .= "</th><th>";     
            
$jobs .= 'Balance';
            
$jobs .= "</th><th>";     
            
$jobs .= 'Shipping and Handling Amount';     
            
$jobs .= "</th>";     
            
$jobs .= "</tr>";

while (
$post_with_threads mysql_fetch_array($post_with_threads_query))
        {
        
$total_++;
    
//Gross, Fee, Net
       
$Gross stripslashes($post_with_threads['Gross']);
         
$Fee stripslashes($post_with_threads['Fee']);
          
$Net stripslashes($post_with_threads['Net']);
          
$ShippingandHandlingAmount stripslashes($post_with_threads['Shipping and Handling Amount']);
     
     if(
$Gross 0){$Total_Spent $Total_Spent $Gross;}
     
         
$Total_Fee $Total_Fee $Fee;
          
$Total_Net $Total_Net $Net;
          
$Total_ShippingandHandlingAmount $Total_ShippingandHandlingAmount $ShippingandHandlingAmount;

     
     if(
$post_with_threads['Name'] != "Bank Account")
{          
            
$jobs .= "<tr><td>";
       
$jobs .= "<span class=\"postdetails\">" ;                                                
            
$jobs .= $post_with_threads['Date'];
            
$jobs .= "</td><td>";
            
$jobs .= $post_with_threads['Name'];
            
$jobs .= "</td><td>.";                             
            
$jobs .= $post_with_threads['Item Title'];
            
$jobs .= "</td><td>";
     if(
$Gross 0){            $jobs .= "<font color=red><b>".$post_with_threads['Gross'] . "</b></font>"$Total_Deposits $Total_Deposits $Gross;}
//     else{$jobs .= $post_with_threads['Gross']."<BR>".$Total_Spent;}
     
else{$jobs .= $post_with_threads['Gross'];}     
            
$jobs .= "</td><td>";     
            
$jobs .= $post_with_threads['Fee'];
            
$jobs .= "</td><td>";     
            
$jobs .= $post_with_threads['Net'];
            
$jobs .= "</td><td>";
            
$jobs .= $post_with_threads['Balance'];          

            
$jobs .= "</td><td>S&H $";     
            
$jobs .= $post_with_threads['Shipping and Handling Amount'];
            
$jobs .= "</td></tr><tr>";
}     
     
     
     
     
     
    }
$jobs .= "</table>";    

echo 
"<BR>Total Paypal Spent: $" $Total_Spent;
echo 
"<BR>Total_Net $" $Total_Net;
echo 
"<BR>Total Shipping & Handling: $" $Total_ShippingandHandlingAmount;

echo 
"<HR>Total_Deposits $" $Total_Deposits ;
echo 
"<BR>Total_Fee $" $Total_Fee;
echo 
"<BR>%" . ($Total_Fee/$Total_Deposits 100);
echo 
"<HR>";
echo 
$jobs;    




<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html><head>
<?
echo "Need to edit before use!<HR>";
$sql 'TRUNCATE TABLE `paypal` removes all data';
echo 
$sql;
exit;

######################################################################

# Open Database Connection
#
######################################################################
$DB_HOST "localhost";
$DB_USER "root";
$DB_PASS "";
$DB_DB "ier";
$db= @mysql_pconnect $DB_HOST $DB_USER $DB_PASS );
@
mysql_select_db $DB_DB )  or die ( "DATABASE ERROR!" );
######################################################################
$table "paypal";

$result mysql_query("SHOW FIELDS FROM $DB_DB.$table");
$Paypal_i 0;
//echo "<HR>Database:$DB_DB TABLE:$table<BR>";

while ($row mysql_fetch_array($result)) 
 {
// echo $row['Field'] . "<BR>";
 
$Paypal_Field[$Paypal_i] = $row['Field'];
 
$Paypal_Type[$Paypal_i] = $row['Type']; 
 
$Paypal_i++; 
 }
?>
<LINK rel="stylesheet" type="text/css" title="bluesilver" href="/xampp/www/1Repair/blueSilver.css">
<style type="text/css"> <!-- A:hover {color:#0000ff} --></style>
</head>
<!-- End Header -->    
<body bgcolor="ffffff" link="FFFFFF" vlink="FFFFFF" topmargin="3" leftmargin="5" marginwidth="5">
<?
$sql 
'TRUNCATE TABLE `paypal`';
mysql_query($sql)or die(mysql_error());

$handle fopen("Download.csv""r");
while ((
$data fgetcsv($handle1000",")) !== FALSE
  {
  
$num count($data)-1;
  
$query create_query($table,$Paypal_i,$Paypal_Field ,$num ,$data);
  echo 
$query "<HR>";
  
mysql_query($query)or die(mysql_error() ."<hr> ".__LINE__);
  
$query '';  
  }
fclose($handle); 
                



function 
create_query($table,$DB_Table_count,$DB_Table_Fields,$Insert_Values_Count,$Insert_Values_Content)
{
echo 
"<p> $DB_Table_count fields in database table!<br /></p>\n";
echo 
"<p> $Insert_Values_Count fields in Values Data! <br /></p>\n";


$limit $DB_Table_count ;
$query "INSERT INTO ".$table." (";
      for (
$i2 0$i2 $DB_Table_count$i2++) 
         {
            
$dis $DB_Table_Fields[$i2];
            if(
$i2 != $limit)
       
                    {    
$query .= "`" ;                $query .= $dis ."`"", ";                    }
            else
                    {        
$query .= "`" ;                    $query .= $dis ."`""" ;                    }     
        }
            
$query .= ")VALUES(" ;

$limit $Insert_Values_Count ;
for (
$i2 0$i2 $Insert_Values_Count$i2++) 
         {
             
$dis addslashes($Insert_Values_Content[$i2]);
             
$query .= "'" ;              
             
$query .= $dis;
      
             if(
$i2 != $limit)
               {                  
$query .= "', ";                  }
          else
               {                  
$query .= "');";                  }
        }
return 
$query;    
}



-- phpMyAdmin SQL Dump
-- version 2.6.4-pl1
-- http://www.phpmyadmin.net
-- 
-- Host: localhost
-- Generation Time: Jun 13, 2007 at 08:04 PM
-- Server version: 4.1.14
-- PHP Version: 5.0.5
-- 
-- Database: `ier`
-- 

-- --------------------------------------------------------

-- 
-- Table structure for table `paypal`
-- 

CREATE TABLE `paypal` (
  `Date` varchar(99) collate latin1_general_ci NOT NULL default '',
  `Time` varchar(99) collate latin1_general_ci NOT NULL default '',
  `Time Zone` varchar(99) collate latin1_general_ci NOT NULL default '',
  `Name` varchar(99) collate latin1_general_ci NOT NULL default '',
  `Type` varchar(99) collate latin1_general_ci NOT NULL default '',
  `Status` varchar(99) collate latin1_general_ci NOT NULL default '',
  `Currency` varchar(99) collate latin1_general_ci NOT NULL default '',
  `Gross` varchar(99) collate latin1_general_ci NOT NULL default '',
  `Fee` varchar(99) collate latin1_general_ci NOT NULL default '',
  `Net` varchar(99) collate latin1_general_ci NOT NULL default '',
  `From Email Address` varchar(99) collate latin1_general_ci NOT NULL default '',
  `To Email Address` varchar(99) collate latin1_general_ci NOT NULL default '',
  `Transaction ID` varchar(99) collate latin1_general_ci NOT NULL default '',
  `Counterparty Status` varchar(99) collate latin1_general_ci NOT NULL default '',
  `Shipping Address` varchar(99) collate latin1_general_ci NOT NULL default '',
  `Address Status` varchar(99) collate latin1_general_ci NOT NULL default '',
  `Item Title` varchar(99) collate latin1_general_ci NOT NULL default '',
  `Item ID` varchar(99) collate latin1_general_ci NOT NULL default '',
  `Shipping and Handling Amount` varchar(99) collate latin1_general_ci NOT NULL default '',
  `Insurance Amount` varchar(99) collate latin1_general_ci NOT NULL default '',
  `Sales Tax` varchar(99) collate latin1_general_ci NOT NULL default '',
  `Option 1 Name` varchar(99) collate latin1_general_ci NOT NULL default '',
  `Option 1 Value` varchar(99) collate latin1_general_ci NOT NULL default '',
  `Option 2 Name` varchar(99) collate latin1_general_ci NOT NULL default '',
  `Option 2 Value` varchar(99) collate latin1_general_ci NOT NULL default '',
  `Auction Site` varchar(99) collate latin1_general_ci NOT NULL default '',
  `Buyer ID` varchar(99) collate latin1_general_ci NOT NULL default '',
  `Item URL` varchar(99) collate latin1_general_ci NOT NULL default '',
  `Closing Date` varchar(99) collate latin1_general_ci NOT NULL default '',
  `Escrow Id` varchar(99) collate latin1_general_ci NOT NULL default '',
  `Invoice Id` varchar(99) collate latin1_general_ci NOT NULL default '',
  `Reference Txn ID` varchar(99) collate latin1_general_ci NOT NULL default '',
  `Invoice Number` varchar(99) collate latin1_general_ci NOT NULL default '',
  `Custom Id` varchar(99) collate latin1_general_ci NOT NULL default '',
  `Receipt ID` varchar(99) collate latin1_general_ci NOT NULL default '',
  `Balance` varchar(99) collate latin1_general_ci NOT NULL default '',
  `Contact Phone Number` varchar(99) collate latin1_general_ci NOT NULL default ''
) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_general_ci;