|
|
ผมต้องการให้มีเซลปล่าวๆ ในกรณีที่ไม่มีข้อมูลครับอย่างคอลัมแรกมีข้อมูล
แต่ในลูปถัดไปไม่มีข้อมูลก็ให้เป็นเซลปล่าวจนเท่ากับแถวสุดท้ายครับ
อาจจะเขียนใหม่หรือยังไงช่วยแนะนำทีครับ
Code (PHP)
function BasicTable($data, $data1,$results) {
$head = array('','TODAY SALES', 'MTD', 'QTD', 'YTD');
$ss = array( 143,33, 33, 33, 33);
$header = array('NO.', 'ACCOUNT', 'SALES DIVISION', 'SALES DEPARTMENT', 'LEVEL OF RELATIONSHIP', 'GRADE', 'LOCATION NAME',
'TERRITORY', 'SELL-IN', 'SELL-OUT', 'VARIANCE', 'SELL-IN', 'SELL-OUT', 'VARIANCE', 'SELL-IN', 'SELL-OUT', 'VARIANCE', 'SELL-IN', 'SELL-OUT', 'VARIANCE');
$w = array(5, 20, 20, 25, 25, 15, 15, 18, 11, 11,11, 11, 11, 11, 11, 11,11, 11, 11, 11, 11, 11);
// $this->SetX(153);
for ($i = 0; $i < count($head); $i++)
$this->Cell($ss[$i], 5, iconv('UTF-8', 'TIS-620', $head[$i]), 1, 0, 'C'); //หัววคอลัมท่ี2
$this->Ln();
for ($i = 0; $i < count($header); $i++)
$this->Cell($w[$i], 5, iconv('UTF-8', 'TIS-620', $header[$i]), 1, 0, 'C');//เซตหัวข้อเป็นไทย
$this->Ln();
foreach ($results as $eachResult) {
$this->Cell(5, 6, $row, 1, 0, 'C');
$this->Cell(20, 6, $eachResult["name"], 1, 0, 'C');
}
foreach ($data1 as $obj) {
$this->setX(35);
$this->Cell(20, 6, $obj["sellingdivision_c"], 1, 0, 'C');
$this->Cell(25, 6, $obj["sellingdepartmentbranch_c"], 1, 0, 'C');
// $this->Cell(34,6, $obj["netamount_c"],1,0,'C');
$this->Ln();
}
foreach ($data as $result) {
$this->SetXY(80,20);
$this->Cell(25, 6, $result["levelofrelationship_c"], 1, 0, 'C');
$this->Cell(15, 6, $result["grade_c"], 1, 0, 'C');
$this->Cell(15, 6, 'Unknow',1,0,'C');
$this->Cell(18, 6, $result["territory_c"], 1, 0, 'C');
}
foreach ($data1 as $data1) {
$this->SetX(-144);
$this->Cell(11,6, $data1["netamount_c"],1,0,'C');
$this->Cell(11,6,'0',1,0,'C');//ถ้าได้ใช้งานก็ค่อยเข้ามาเปลี่ยน 0 ให้เป็นตัวแปรอื่น
$res = $data1["netamount_c"]-0;
$this->Cell(11,6,$res,1,0,'C');
$this->Cell(11,6,'',1,0,'C');
$this->Cell(11,6,'',1,0,'C');
$this->Cell(11,6,'',1,0,'C');
$this->Cell(11,6,'',1,0,'C');
$this->Cell(11,6,'',1,0,'C');
$this->Cell(11,6,'',1,0,'C');
$this->Cell(11,6,'',1,0,'C');
$this->Cell(11,6,'',1,0,'C');
$this->Cell(11,6,'',1,0,'C');
$this->Ln();
}
}
Tag : PHP, MySQL, HTML/CSS, Report Others
|
|
|
|
|
|
Date :
2011-11-18 15:34:09 |
By :
taqman |
View :
990 |
Reply :
2 |
|
|
|
|
|
|
|
|
|