function getannualSalarystmtpdf($tableData){
$compdetails = array ();
$stmt ="SELECT c.company_email,c.company_name,c.company_logo,c.company_build_name,c.company_street,c.company_area,c.company_city,
c.company_pin_code FROM company_details c WHERE c.company_id = '" . $_SESSION ['company_id'] . "' AND c.info_flag='A'";
$result = mysqli_query ( $this->conn,$stmt );
while ( $row = mysqli_fetch_array ( $result, MYSQL_ASSOC ) ) {
array_push ( $compdetails, $row );
}
$html = '<div class="reportTable"><table id="annualTable" style="width:100%;" ><thead><tr>';
foreach($tableData[2] as $k=>$v) {
if($v!='-' )
$html .= '<th style="text-align:center;">' .$k. '</th>';
}
$html .= '<th style="text-align:center;">Total</th></tr></thead><tbody>';
for ($i = 0, $len = count($tableData); $i < $len; ++$i) {
$header="";
if($i % 2 == 0){
$html .= '<tr class="alt">';
}else{
$html .= '<tr>';
}
$total=0;
foreach($tableData[$i] as $k1=>$v1) {
if($k1=='SALARYHEADS' ){
if(explode("_",$v1)[1]=='A' ){
$html .= '<td style="text-align:left;">ALLOWANCES</td>';
}else if(explode("_", $v1)[1]=='D') {
$html .= '<td style="text-align:left;">DEDUCTION</td>';
}else if(explode("_", $v1)[1]=='Gross'){
$html .= '<td style="font-weight:bold;text-align: right;">'.explode("_", $v1)[1].'</td>';
// header= '<tr><td colspan="13">Deduction</td></tr>';
}else if(explode("_", $v1)[1]=='Net Salary'){
$html .= '<td style="font-weight: bold;text-align: right;">'.explode("_", $v1)[1].'</td>';
}else if(explode("_", $v1)[1]=='TotalDedu'){
$html .= '<td style="font-weight: bold;text-align: right;">'.explode("_", $v1)[1].'</td>';
} else{
$html .= '<td style="padding-left: 15%;">'.explode("_", $v1)[1].'</td>' .$header;
}
}
else if($v1!='-' ){
$html .= '<td style="text-align:right;">' . inr_format($v1) . '</td>';
$total+=floatval($v1);
}
}
$html .= "<td style='text-align:right;'>" . inr_format($total) .'</td></tr>';
echo $html;
die();
}
$html .= '</tbody></table></div>';
include_once (dirname ( dirname ( dirname ( __FILE__ ) ) ) . "/js/mpdf/mpdf.php");
$mpdf = new mPDF ( 'en-GB-x', 'L', '', '', 10, 10, 10, 10, 6, 3 ); // if remove note isset into 20
$styleSheet = file_get_contents ( dirname ( dirname ( __DIR__ ) ) . "/css/reportTable.css" );
$header1 .= '<table> <tr>
<th style="width:20% "><img src=../' . $compdetails [0] ['company_logo'] . ' style="width:15%"></th>
<td style="font-weight: bold;font-size:15px;text-align:left; ">' . ucwords ( $compdetails [0] ['company_name'] ) . '<br>' . ucwords ( $compdetails [0] ['company_build_name'] ) . ',' . ucwords ( $compdetails [0] ['company_street'] ) . ',' . ucwords ( $compdetails [0] ['company_area'] ) . ',<br>' . ucwords ( $compdetails [0] ['company_city'] ) . ',' . $compdetails [0] ['company_pin_code'] . '</td></tr></table>';
$mpdf->WriteHTML ( $styleSheet, 1 );
$mpdf->setAutoTopMargin='stretch';// Writing style to pdf
$mpdf->setHeader ( $header1 );
$mpdf->setHTMLFooter ( $footer );
$mpdf->WriteHTML ( $html, 2 );
$mpdf->Output ( 'provisional_Statement_' . $name . '.pdf', D );
exit ();
}
我还附上了一张图片..我想从4月份的津贴和扣除中删除零点,并且可能是月份..只显示零总数。我应该为此写出什么小逻辑?表格动态生成..