I have a code where I need to search for the specific data based on the type of outsource and the type of dependent (dropdown for both, 1 dropdown each). There is 3 type of outsource and 4 type of dependent. I get to do the searching when the outsource id is 1 and 2 along with the dependent. It is a must to choose the dependent when the user choose the outsource with id 1 or 2. When the outsource id is 3, there is no need to choose dependent since it is where the user will view all the data in the unless they want to view it with the dependent. But the problem is I cannot view the data when I choose that type of outsource. It come out as a blank page.
I don't know where did I do wrong with my code:
Above are the HTML code that I use and below is the next code where it redirect from the above code after being submit:
class PDF extends FPDF
{
var $widths;
var $aligns;
function Header()
{
$this->SetLineWidth(0.4);
$this->Line(12,30,287,30);
//Arial bold 15
$this->SetFont('Helvetica','B',15);
//Move to the right
//Title
if($_GET['tarikh1'] && $_GET['tarikh2'] && $_GET['jenis_outsource'] == 1 || $_GET['tarikh1'] && $_GET['tarikh2'] && $_GET['jenis_outsource'] == 2 )//from dropdown
{
$sql = "SELECT * FROM outsource ";
$sql.= "WHERE id = '$_GET[jenis_outsource]'";
$query = mysql_query($sql);
$row5 = mysql_fetch_object($query);
$jenis = strtoupper($row5->desc);
$this->Cell(250,10,'LAPORAN PRESTASI ' .strtoupper($row5->desc),'','','C');
$this->Ln(6);
$this->Cell(260,10,' DARI '. $_GET['tarikh1'] .' SEHINGGA '. $_GET['tarikh2'],'','','C');
$this->Ln(6);
}else if($_GET['tarikh1'] && $_GET['tarikh2'] && $_GET['jenis_tanggungan'] == 'PT' || $_GET['tarikh1'] && $_GET['tarikh2'] && $_GET['jenis_tanggungan'] == 'Inden' || $_GET['tarikh1'] && $_GET['tarikh2'] && $_GET['jenis_tanggungan'] == 'Interim' || $_GET['tarikh1'] && $_GET['tarikh2'] && $_GET['jenis_tanggungan'] == 'PT/Inden' )//from dropdown
{
$sql1 = "SELECT * FROM jenis_tangunggan ";
$sql1.= "WHERE jenis = '$_GET[jenis_tanggungan]'";
$query1 = mysql_query($sql1);
$row6 = mysql_fetch_object($query1);
$jenis1 = strtoupper($row6->desc);
$this->Cell(250,10,'LAPORAN PRESTASI ' .strtoupper($row6->desc),'','','C');
$this->Ln(6);
$this->Cell(260,10,' DARI '. $_GET['tarikh1'] .' SEHINGGA '. $_GET['tarikh2'],'','','C');
$this->Ln(6);
}else {
$this->Cell(250,10,'LAPORAN PRESTASI KESELURUHAN DARI '. $_GET['tarikh1'] .' SEHINGGA '. $_GET['tarikh2'],'','','C');
$this->Ln(6);
}
//Line break
$this->Ln(10);
$this->SetFont('Helvetica','B',7);
$this->SetWidths(array(10,50,20,30,30,30,30,20,30));
$this->SetAligns(array('C','L','C','C','C','C','C','R','C'));
$this->Row(array('Bil','Nama Penerima','Jenis Tanggungan','No Rujukan','Tarikh Bayaran','No Baucar','No Cek','Jumlah','Prestasi'));
}
1st part of the code:
if($_GET['tarikh1'] && $_GET['tarikh2'] && $_GET['jenis_outsource'] && $_GET['jenis_tanggungan'])
{
/*********************************************************/
$tarikh = $tarikh[6].$tarikh[7].$tarikh[8].$tarikh[9]."-".$tarikh[3].$tarikh[4]."-".$tarikh[0].$tarikh[1];
$jumlah = 0;
$no = 0;
$tarikh1 = $_GET[tarikh1];
$tarikh2 = $_GET[tarikh2];
$tarikh1 = $tarikh1[6].$tarikh1[7].$tarikh1[8].$tarikh1[9]."-".$tarikh1[3].$tarikh1[4]."-".$tarikh1[0].$tarikh1[1];
$tarikh2 = $tarikh2[6].$tarikh2[7].$tarikh2[8].$tarikh2[9]."-".$tarikh2[3].$tarikh2[4]."-".$tarikh2[0].$tarikh2[1];
$jenis_outsource = $_GET['jenis_outsource'] ;
$jenis_tanggungan = $_GET['jenis_tanggungan'] ;
if($_GET['jenis_outsource'] == 1 || $_GET['jenis_outsource'] == 2) {
$query = " SELECT b.nama_syarikat,a.jenis_tangunggan,e.code_prestasi as prestasi,c.no_pesanan ,c.no_cek,c.tarikh_cek,c.no_baucar,sum(c.amaun) as amaun FROM tangunggan a, transaksi_baucarlo c,penyelenggaraan_syarikat b,prestasi_syarikat e WHERE c.no_pesanan = CONCAT(a.no_tangunggan,'/',a.jb_code,'/',a.tahun) AND a.jenis_outsource = '".$jenis_outsource."' AND a.jenis_tangunggan = '$jenis_tanggungan' AND c.kod_syarikat=b.kod_syarikat AND e.id=c.prestasi and c.bank != '11' AND c.status is NULL AND c.tarikh_cek >= '$tarikh1' AND c.tarikh_cek <= '$tarikh2' GROUP BY c.no_pesanan,c.no_baucar ";
$query .=" ORDER BY tarikh_cek,no_baucar ASC";
$result = mysql_query($query);
$i = 1;
while($row = mysql_fetch_assoc($result))
{
$bil++;
$row_data[] = array($bil,$row['nama_syarikat'],$row['jenis_tangunggan'],$row['no_pesanan'],SQLToDate($row['tarikh_cek']),$row['no_baucar'],$row['no_cek'],number_format($row['amaun'],2),$row['prestasi']);
}
/*********************************************************/
$pdf= new PDF();
$pdf->Open();
$pdf->SetTitle('CARIAN PRESTASI KHIDMAT LUAR');
$pdf->SetMargins(23,35,15);
$pdf->AliasNbPages();
$pdf->AddPage('L');
$pdf->SetFont('Helvetica','',6);
$pdf->SetLineWidth(0.2);
$pdf->SetWidths(array(10,50,20,30,30,30,30,20,30));
$pdf->SetFont('Helvetica','',6);
$pdf->SetAligns(array('C','L','C','C','C','C','C','R','C'));
$pdf->MultiRow($row_data);
$pdf->SetWidths(array(250));
$pdf->SetFont('Helvetica','',6);
$pdf->SetAligns(array(''));
$pdf->Row(array(''));
$pdf->SetWidths(array(220,30));
$pdf->SetFont('Helvetica','B',6);
$pdf->SetAligns(array('R','C'));
$pdf->Row(array('PRESTASI SYARIKAT','JUMLAH'));
$pdf->SetWidths(array(220,30));
$pdf->SetFont('Helvetica','',6);
$pdf->SetAligns(array('R','C'));
$pdf->Row(array('TIDAK MEMUASKAN',$total));
$pdf->Row(array('KURANG BAIK',$total));
$pdf->Row(array('SEDERHANA',$total));
$pdf->Row(array('BAIK',$total));
$pdf->Row(array('SANGAT BAIK',$total));
$pdf->Output();
}
}
?>
2nd part of the code. I know it is a bit long code, but can somebody tell me whats wrong with it? I'm working on it since 2 days ago and I'll try everything. But the result still the same. And I'm sorry the code is somehow in malay in some part.
No comments:
Post a Comment