Put phone numbers on multiple lines for PDF, and in multiple columns on teh same line for CSV

This commit is contained in:
james 2005-12-08 16:05:25 +00:00
parent 074b66274c
commit 5bd24e3f8d

View File

@ -73,19 +73,40 @@
$table=array();
$table['header']=array(i18n("First Name"),i18n("Last Name"),i18n("Emerg First"),i18n("Emerg Last"), i18n("Relation"), i18n("Emerg Phone"));
$table['widths']=array( 1.25, 1.25, 1.25, 1.25, 1, 1.25);
$table['dataalign']=array("left","left","left","left","left","left");
//if its a PDF we'll put each additional phone number on a new line, for CSV, we'll have a column for each
if($type=="pdf")
{
$table['header']=array(i18n("First Name"),i18n("Last Name"),i18n("Emerg First"),i18n("Emerg Last"), i18n("Relation"), i18n("Emerg Phone"));
$table['widths']=array( 1.25, 1.25, 1.25, 1.25, 1, 1.25);
$table['dataalign']=array("left","left","left","left","left","left");
}
else if($type=="csv")
{
$table['header']=array(i18n("First Name"),i18n("Last Name"),i18n("Emerg First"),i18n("Emerg Last"), i18n("Relation"), i18n("Emerg Phone 1"),i18n("Emerg Phone 2"),i18n("Emerg Phone 3"),i18n("Emerg Phone 4"));
//.widths mean nothing for csv
$table['widths']=array( 1.25, 1.25, 1.25, 1.25, 1, 1.25,1.25,1.25,1.25);
$table['dataalign']=array("left","left","left","left","left","left","left","left","left");
}
while($r=mysql_fetch_object($q))
{
$table['data'][]=array($r->firstname,$r->lastname,$r->emerg_firstname,$r->emerg_lastname,$r->relation,$r->phone1);
if($r->phone2)
$table['data'][]=array('','','','','',$r->phone2);
if($r->phone3)
$table['data'][]=array('','','','','',$r->phone3);
if($r->phone4)
$table['data'][]=array('','','','','',$r->phone4);
//put each phone number on a new line, if it exists
if($type=="pdf")
{
$table['data'][]=array($r->firstname,$r->lastname,$r->emerg_firstname,$r->emerg_lastname,$r->relation,$r->phone1);
if($r->phone2)
$table['data'][]=array('','','','','',$r->phone2);
if($r->phone3)
$table['data'][]=array('','','','','',$r->phone3);
if($r->phone4)
$table['data'][]=array('','','','','',$r->phone4);
}
//put all phone numbers on the same line, in their own columns
else if($type=="csv")
{
$table['data'][]=array($r->firstname,$r->lastname,$r->emerg_firstname,$r->emerg_lastname,$r->relation,$r->phone1,$r->phone2,$r->phone3,$r->phone4);
}
}