⚠ In case you've missed it, we have migrated to our new website, with a brand new forum. For more details about the migration you can read our blog post for website migration. This is an archived forum. ⚠

  •     

profile picture

Print



MSuprayogie KivaHeatnix
  • profile picture
  • Member

Posted 21 June 2013 - 03:08 AM

need help . . . i want costume print header footer n border table in grucery crued print can u help me ? check the image

 

 

 

 

 

 

 

 


davidoster
  • profile picture
  • Member

Posted 23 June 2013 - 04:43 AM

I believe you need to extend the Grocery CRUD library and make your own print out by overloading the protected function _print_webpage($data).

Check under application/libraries the grocery_crud.php file around line 1628.

 

The _print_web_page() generates an html output of the list.


MSuprayogie KivaHeatnix
  • profile picture
  • Member

Posted 23 June 2013 - 14:09 PM

thx david i will try . . . . n how to add my header 2 that script . . . can u give me example ? that alot david


MSuprayogie KivaHeatnix
  • profile picture
  • Member

Posted 23 June 2013 - 15:09 PM

protected function _print_webpage($data)
                
                
                
{
$string_to_print = "<meta charset=\"utf-8\" />
                <style type=\"text/css\" >
#print-table{ color: #000; background: #fff; font-family: Verdana,Tahoma,Helvetica,sans-serif; font-size: 13px;}
#print-table table tr td, #print-table table tr th{ border: 1px solid black; border-bottom: none; border-right: none; padding: 4px 8px 4px 4px}
#print-table table{ border-bottom: 1px solid black; border-right: 1px solid black}
#print-table table tr th{text-align: center;background: #ddd}
#print-table table tr:nth-child(odd){background: #eee}
</style>";
$string_to_print .= "<div id='print-table'>";
 
$string_to_print .= '<table width="100%" cellpadding="1" cellspacing="1" ><tr>';
foreach($data->columns as $column){
$string_to_print .= "<th>".$column->display_as."</th>";
}
$string_to_print .= "</tr>";
 
foreach(
                        $data->list as $num_row => $row)
                  {
$string_to_print .= "<tr>";
foreach($data->columns as $column){
$string_to_print .= "<td>".$this->_trim_print_string($row->{$column->field_name})."</td>";
}
$string_to_print .= "</tr>";
}
 
                
                
$string_to_print .= "</table></div>";
                
               $string_to_print .= "";
 
echo $string_to_print;
die();
}


where i put my header david ?