SugarCRM Create pdf report

SugarCRM Create pdf report

May 29, 2018 PHP SugarCRM 0

include file:

<?php

 

include("config.php");

 

$id = $_REQUEST['id'];

//echo $sugar_config['dbconfig']['db_host_name'];

//echo $sugar_config['dbconfig']['db_user_name'];

//echo $sugar_config['dbconfig']['db_password'];

//exit;

$sqlcon = mysql_connect($sugar_config['dbconfig']['db_host_name'],$sugar_config['dbconfig']['db_user_name'],$sugar_config['dbconfig']['db_password']);

$sqldb = mysql_select_db($sugar_config['dbconfig']['db_name'],$sqlcon);

//echo $sugar_config['dbconfig']['db_host_name'];

 

$result = mysql_query("Select * from cases where id = '".$id."'");

while ($row = mysql_fetch_array($result))

{

$no = $row['case_number'];

$sub = $row['name'];

$cr_dt1 = $row['date_entered'];

$ass_usr = $row['assigned_user_id'];

$des = $row['description'];

$acc_id = $row['account_id'];

}

 

$cr_dt2 = explode(" ",$cr_dt1);

$cr_dt = $cr_dt2[0];

$res1 = mysql_query("Select * from cases_cstm where id_c like '".$id."'");

 

while ($row1 = mysql_fetch_array($res1))

{

$prd = $row1['products_c'];

$cl_os = $row1['client_os_c'];

$sr_os = $row1['server_os_c'];

 

$pay = $row1['pay_mode_c'];

$vist = $row1['visit_date_c'];

}

 

$res2 = mysql_query("Select * from accounts where id like '".$acc_id."'");

while ($row2 = mysql_fetch_array($res2))

{

$acc = $row2['name'];

$street = $row2['billing_address_street'];

$city = $row2['billing_address_city'];

$state = $row['billing_address_state'];

 

}

 

$res3 = mysql_query("Select * from users where id like '".$ass_usr."'");

while ($row3 = mysql_fetch_array($res3))

{

$usr = $row3['first_name'].' '.$row3['last_name'];

}

 

$des2 = explode("==============================",$des);

//print_r($des2);

 

print("<html>

<body onload=window.print()>

<form>

<table border='1'>

<tr>

<td colspan='4'><center><h1>Enjay Service Report</h1></center></td>

</tr>

<tr>

<td width=13%>Client Name</td>

<td width=30%><h3>$acc</h3></td>

<td width=13%>Client Address</td>

<td><h4>".$street."<br>".$city."<br>".$state."</h4></td></tr>

 

<tr>

<td>Case Subject</td>

<td>$sub</td>

<td>Case Number</td>

<td>".$no."</td></tr>

<tr>

<td>Product</td>

<td>$prd</td>

<td>Assigned Name</td>

<td>$usr</td></tr>

<tr>

<td>Server OS</td>

<td>$sr_os</td>

<td>Client OS</td>

<td>$cl_os</td></tr>

<tr>

<td>Case Created</td>

<td>$cr_dt</td>

<td>Visit Date</td>

<td>$vist</td></tr>

<tr>

<td>Payment</td>

<td>".$pay."</td>

<td></td><td></td></tr>

<td>Description</td>

<td colspan='3'>".nl2br($des2[1])."<br>".nl2br($des2[2])."</td>

</tr>

<tr>

<td>Engineer Solution</td>

<td><Textarea rows='5' cols='50'></textarea></td>

<td>Engineer Feedback</td>

<td><Textarea rows='5' cols='50'></textarea></td>

</tr>

<tr>

<td>Client Feedback</td>

<td colspan='3'><Textarea rows='6' cols='120'></textarea></td>

</tr>

 

<tr>

<td>Approved BY :</td>

<td><input type='text' name='asgin' size='50'></td>

<td>Client Sign :</td>

<td><input type='text' name='asgin1' size='50'></td>

</td>

</tr>

</table>

</form>

<br>

<br>

<form>

<table border='1'>

<tr>

<td colspan='4'><center><h1>Enjay Service Report</h1></center></td>

</tr>

<tr>

<td width=13%>Client Name</td>

<td width=30%><h3>$acc</h3></td>

<td width=13%>Client Address</td>

<td><h4>".$street."<br>".$city."<br>".$state."</h4></td></tr>

<tr>

<td>Case Subject</td>

<td>$sub</td>

<td>Case Number</td>

<td>".$no."</td></tr>

<tr>

<td>Product</td>

<td>$prd</td>

<td>Assigned Name</td>

<td>$usr</td></tr>

<tr>

<td>Server OS</td>

<td>$sr_os</td>

<td>Client OS</td>

<td>$cl_os</td></tr>

 

<tr>

<td>Case Created</td>

<td>$cr_dt</td>

<td>Visit Date</td>

<td>$vist</td></tr>

<tr>

<td>Payment</td>

<td>".$pay."</td>

<td></td><td></td></tr>

<td>Description</td>

<td colspan='3'>".nl2br($des2[1])."<br>".nl2br($des2[2])."</td>

</tr>

<tr>

<td>Engineer Solution</td>

<td><Textarea rows='5' cols='50'></textarea></td>

<td>Engineer Feedback</td>

<td><Textarea rows='5' cols='50'></textarea></td>

</tr>

<tr>

<td>Client Feedback</td>

<td colspan='3'><Textarea rows='6' cols='120'></textarea></td>

</tr>

<tr>

<td>Approved BY :</td>

<td><input type='text' name='asgin' size='50'></td>

<td>Client Sign :</td>

<td><input type='text' name='asgin1' size='50'></td>

</td>

</tr>

</table>

</form>

 

</body>

</html>");

 

?>

Leave a Reply

Your email address will not be published. Required fields are marked *