Creating an invoice


Posted on 16th Feb 2014 07:03 pm by admin

Using fpdf I am trying to create an invoice to send to clients. The products are sold in pricing tiers.

I've got it working so it only displays a tier if the quantity is greater than 0 but I end up with a bunch of empty rows in between.

Instead of for example:

1 $20
2 $30
3 $40

I am getting

1 $20

2 $30


3 $40

How can I get it so the row is advanced only if something is output?

Code: for ($j=0; $j<12; $j++)
{
$data = Array();


if($pricearray[$j] > 0){
$data[0]['TEXT'] = $pricearray[$j];


$data[1]['TEXT'] = $_POST['select'];
$data[1]['TEXT'] .= " " . $pricedescriptionarray[$j];
$data[2]['TEXT'] = "Description";
$data[3]['TEXT'] = "20";
$data[4]['TEXT'] = "100";
}


$fsize += 0.5;

if ($fsize > 10) $fsize = 5;

$rgb_b -= 10;
$rgb_g -= 5;
$rgb_b -= 20;

if ($rgb_b < 150) $rgb_b = 255;
if ($rgb_g < 150) $rgb_g = 255;
if ($rgb_b < 150) $rgb_b = 255;

$pdf->tbDrawData($data);
}

No comments posted yet

Your Answer:

Login to answer
124 Like 35 Dislike
Previous forums Next forums
Other forums

Sharing PHP Sessions Across Domains
I am in the process of writing a script to share a php session across various domains I have.
The

How do I know when getBounds Method is ready to be called.
I have an application that changes out stylesheets client side. Once I change stylesheet the browse

Need to write a cookie with a url var
Not sure if its possible, but I need to write a cookie with a url.

So this would write 2232 a

How to write on database when a link is clicked?
Hi, I have a list of products in a gridview. When the link is clicked currently it takes to an ext

Scrolling news bar and MySQL
I am not sure if this is the correct forum to post this on. If not, I apologize. I am still pretty

Calculus Help (and by help I mean homework)
Hrmmm, I hate posting about math homework, partly because it's homework, and partly because I hate w

FAGL_FC_TRANSLATION FAS52 New GL ECC 6.0
Hello,

The new program for Translating GL Balances (FAS 52) gives the option to use diffe

Problem with Subscreen
Dear Experts ,
I am facing a problem with the subscreens. My senario is as follows :

ALV sum various columns problem
Hi all,
I'm doing a report on ABAP for a timesheet of the current month. The output i want is s

Count Session and Trigger Events
I am New in PHP, seeking a method to count logged users by counting the sessions or any …, is

Sign up to write
Sign up now if you have flare of writing..
Login   |   Register
Follow Us
Indyaspeak @ Facebook Indyaspeak @ Twitter Indyaspeak @ Pinterest RSS



Play Free Quiz and Win Cash