MOON
Server: Apache/2.2.23 (Unix) mod_ssl/2.2.23 OpenSSL/0.9.8e-fips-rhel5 mod_auth_passthrough/2.1 mod_bwlimited/1.4 PHP/5.4.10
System: Linux vps.presagepowered.net 2.6.18-398.el5 #1 SMP Tue Sep 16 20:51:48 EDT 2014 i686
User: mckernan (512)
PHP: 5.4.10
Disabled: NONE
Upload Files
File: /home/mckernan/public_html/iJournal/includes/client/rptcats.php
<?php

// categories report

	// init database name
	$database = DB_PREFIX;	
	
		
	// process request
	if ($sid != '')
	{
		// sid check
		require "includes/session/sidck.php";
		// fetch database name / open db
		if ( isset($_POST['db']) ) $dbn = $_POST['db'];
		if ( isset($_GET['db']) ) $dbn = $_GET['db'];
		
		if ($dbn == '') die();
		
		$database .= $dbn;
		
		require "includes/db.php";
		
        // fetch client name
        $client = '';
        
        $query = "SELECT cli_sortname FROM client";
        
        if ($result = $db->query($query))
        {
            $row = $result->fetch_assoc();
            
            $client = $row['cli_sortname'];    
        }
        
		
		// fetch categories
        $query = "SELECT * FROM categories";
		
		$result = $db->query($query);
		
        $row = $result->fetch_assoc();
			
		
		require "CatsReportClass.php";
        
        $pdf = new PDF($client);
        $pdf->AliasNbPages();
        $pdf->SetDrawColor(150, 150, 150);
        $pdf->SetFillColor(242, 242, 242);
        $pdf->SetFont('Arial', '', '9');
        $pdf->AddPage();
        
        
        $pdf->SetFont('Arial', 'B', '9');
        $pdf->SetFillColor(230, 230, 230);
        $pdf->SetX(20);
        $pdf->SetLeftMargin(20);
        $pdf->Cell(75, 5, 'Income Categories', 1, 1, 'C', true);
        $pdf->SetFillColor(242, 242, 242);
        $pdf->SetFont('Arial', '', '9');
        $fill = false;
        
        $pdf->Ln(1);
        
        $pdf->Cell(75, 5, $row['in_gross'], 0, 1, 'L', $fill);
        $fill = !$fill;
		
        if ($row['in_cogs'] != '')
        {
            $pdf->Cell(75, 5, $row['in_cogs'], 0, 1, 'L', $fill);
            $fill = !$fill;    
        }
		if ($row['in_0'] != '')
        {
		  $pdf->Cell(75, 5, $row['in_0'], 0, 1, 'L', $fill);
          $fill = !$fill;
        }
        if ($row['in_1'] != '')
        {
		  $pdf->Cell(75, 5, $row['in_1'], 0, 1, 'L', $fill);
          $fill = !$fill;
        }
        if ($row['in_2'] != '')
        {
            $pdf->Cell(75, 5, $row['in_2'], 0, 1, 'L', $fill);
            $fill = !$fill;
        }
        if ($row['in_3'] != '')
        {
            $pdf->Cell(75, 5, $row['in_3'], 0, 1, 'L', $fill);
            $fill = !$fill;
        }
        
        $pdf->Ln(5);
        
        $pdf->SetFont('Arial', 'B', '9');
        $pdf->SetFillColor(230, 230, 230);
        $pdf->Cell(75, 5, 'Overhead Expense Categories', 1, 1, 'C', true);
        $pdf->SetFillColor(242, 242, 242);
        $pdf->SetFont('Arial', '', '9');
        $fill = false;
        
        $pdf->Ln(1);
        
        $pdf->Cell(75, 5, $row['oh_0'], 0, 1, 'L', $fill);
        $fill = !$fill;
		$pdf->Cell(75, 5, $row['oh_1'], 0, 1, 'L', $fill);
        $fill = !$fill;
		$pdf->Cell(75, 5, $row['oh_2'], 0, 1, 'L', $fill);
        $fill = !$fill;
		$pdf->Cell(75, 5, $row['oh_3'], 0, 1, 'L', $fill);
        $fill = !$fill;
		$pdf->Cell(75, 5, $row['oh_4'], 0, 1, 'L', $fill);
        $fill = !$fill;
        if ($row['oh_5'] != '')
        {
		  $pdf->Cell(75, 5, $row['oh_5'], 0, 1, 'L', $fill);
          $fill = !$fill;
        }
        if ($row['oh_6'] != '')
        {
		  $pdf->Cell(75, 5, $row['oh_6'], 0, 1, 'L', $fill);
          $fill = !$fill;
        }
        if ($row['oh_7'] != '')
        {
		  $pdf->Cell(75, 5, $row['oh_7'], 0, 1, 'L', $fill);
          $fill = !$fill;
        }
        if ($row['oh_8'] != '')
        {
		  $pdf->Cell(75, 5, $row['oh_8'], 0, 1, 'L', $fill);
          $fill = !$fill;
        }
        
        $pdf->Ln(5);
        
        $pdf->SetFont('Arial', 'B', '9');
        $pdf->SetFillColor(230, 230, 230);
        $pdf->Cell(75, 5, 'Labor Expense Categories', 1, 1, 'C', true);
        $pdf->SetFillColor(242, 242, 242);
        $pdf->SetFont('Arial', '', '9');
        $fill = false;
        
        $pdf->Ln(1);
        
		$pdf->Cell(75, 5, $row['la_0'], 0, 1, 'L', $fill);
        $fill = !$fill;
		$pdf->Cell(75, 5, $row['la_1'], 0, 1, 'L', $fill);
        $fill = !$fill;
		$pdf->Cell(75, 5, $row['la_2'], 0, 1, 'L', $fill);
        $fill = !$fill;
        if ($row['la_3'] != '')
        {
		  $pdf->Cell(75, 5, $row['la_3'], 0, 1, 'L', $fill);
          $fill = !$fill;
        }
        if ($row['la_4'] != '')
        {
		  $pdf->Cell(75, 5, $row['la_4'], 0, 1, 'L', $fill);
          $fill = !$fill;
        }
        if ($row['la_5'] != '')
        {
		  $pdf->Cell(75, 5, $row['la_5'], 0, 1, 'L', $fill);
          $fill = !$fill;
        }
        if ($row['la_6'] != '')
        {
		  $pdf->Cell(75, 5, $row['la_6'], 0, 1, 'L', $fill);
          $fill = !$fill;
        }
        if ($row['la_7'] != '')
        {
		  $pdf->Cell(75, 5, $row['la_7'], 0, 1, 'L', $fill);
          $fill = !$fill;
        }
        
        $pdf->Ln(5);
        
        $pdf->SetFont('Arial', 'B', '9');
        $pdf->SetFillColor(230, 230, 230);
        $pdf->Cell(75, 5, 'Operating Expense Categories', 1, 1, 'C', true);
        $pdf->SetFillColor(242, 242, 242);
        $pdf->SetFont('Arial', '', '9');
        $fill = false;
        
        $pdf->Ln(1);
        
		$pdf->Cell(75, 5, $row['op_0'], 0, 1, 'L', $fill);
        $fill = !$fill;
		$pdf->Cell(75, 5, $row['op_1'], 0, 1, 'L', $fill);
        $fill = !$fill;
		$pdf->Cell(75, 5, $row['op_2'], 0, 1, 'L', $fill);
        $fill = !$fill;
        $pdf->Cell(75, 5, $row['op_3'], 0, 1, 'L', $fill);
        $fill = !$fill;
		$pdf->Cell(75, 5, $row['op_4'], 0, 1, 'L', $fill);
        $fill = !$fill;
		$pdf->Cell(75, 5, $row['op_5'], 0, 1, 'L', $fill);
        $fill = !$fill;
		$pdf->Cell(75, 5, $row['op_6'], 0, 1, 'L', $fill);
        $fill = !$fill;
		$pdf->Cell(75, 5, $row['op_7'], 0, 1, 'L', $fill);
        $fill = !$fill;
		$pdf->Cell(75, 5, $row['op_8'], 0, 1, 'L', $fill);
        $fill = !$fill;
		$pdf->Cell(75, 5, $row['op_9'], 0, 1, 'L', $fill);
        $fill = !$fill;
		$pdf->Cell(75, 5, $row['op_10'], 0, 1, 'L', $fill);
        $fill = !$fill;
		$pdf->Cell(75, 5, $row['op_11'], 0, 1, 'L', $fill);
        $fill = !$fill;
        if ($row['op_12'] != '')
        {
		  $pdf->Cell(75, 5, $row['op_12'], 0, 1, 'L', $fill);
          $fill = !$fill;
        }
        if ($row['op_13'] != '')
        {
		  $pdf->Cell(75, 5, $row['op_13'], 0, 1, 'L', $fill);
          $fill = !$fill;
        }
        if ($row['op_14'] != '')
        {
		  $pdf->Cell(75, 5, $row['op_14'], 0, 1, 'L', $fill);
          $fill = !$fill;
        }
        if ($row['op_15'] != '')
        {
		  $pdf->Cell(75, 5, $row['op_15'], 0, 1, 'L', $fill);
          $fill = !$fill;
        }
        if ($row['op_16'] != '')
        {
		  $pdf->Cell(75, 5, $row['op_16'], 0, 1, 'L', $fill);
          $fill = !$fill;
        }
        if ($row['op_17'] != '')
        {
		  $pdf->Cell(75, 5, $row['op_17'], 0, 1, 'L', $fill);
          $fill = !$fill;
        }
        if ($row['op_18'] != '')
        {
		  $pdf->Cell(75, 5, $row['op_18'], 0, 1, 'L', $fill);
          $fill = !$fill;
        }
        if ($row['op_19'] != '')
        {
		  $pdf->Cell(75, 5, $row['op_19'], 0, 1, 'L', $fill);
          $fill = !$fill;
        }
        
            
        $pdf->Output();
    }
?>