if($inp[bulan]=="" ){
$inp[bulan]=date("m");
}
if($inp[tahun]==""){
$inp[tahun]=date("Y");
}
$txtout=" |
global $tgl_range2,$tgl_range1,$mode,$kode,$tanggal,$tgl_cur_stamp,$tahun_xx,$tanggal,$tahun_bong,$bulan_xx;
global $kode,$inp,$p_dini_pic,$p_dini_sbu_kode,$tgl_akhir;
global $cusername;
$st_sasaran=$inp[p_dini_status_sasaran]=='t'?'t':'f';
$st_rkap=$inp[p_dini_status_rkap]=='t'?'t':'f';
$st_kso=$inp[p_dini_status_kso]=='t'?'t':'f';
$sp_tgl_akhir=split("-",$tgl_akhir);
$sq="select * from tbl_divisi where position('.' in divisi_kode)=0 and divisi_kode <> 'KP' order by divisi_kode";
$resul=dbresult($sq);
while($r = pg_fetch_array($resul)){
$txtout= "";
}
echo $txtout;
?>
echo "";
echo "";
echo " NO | ";
echo "";
echo " UNIT USAHA | ";
echo " PASAR POTENSI | ";
echo " DIPEROLEH | ";
echo " % | ";
echo " ";
?>
global $tgl_range2,$tgl_range1,$mode,$kode,$tanggal,$tgl_cur_stamp,$tahun_xx,$tanggal,$tahun_bong,$bulan_xx;
global $kode,$inp,$p_dini_pic,$p_dini_sbu_kode,$tgl_akhir;
global $cusername;
$st_sasaran=$inp[p_dini_status_sasaran]=='t'?'t':'f';
$st_rkap=$inp[p_dini_status_rkap]=='t'?'t':'f';
$st_kso=$inp[p_dini_status_kso]=='t'?'t':'f';
$sp_tgl_akhir=split("-",$tgl_akhir);
$sql="select * from tbl_divisi where position('.' in divisi_kode)=0 and divisi_kode <> 'KP' order by divisi_kode";
$result=dbresult($sql);
$i=1;
while($s=pg_fetch_array($result)){
echo "";
echo "$i | ";
echo "$s[divisi_name] | ";
echo " | ";
echo " | ";
echo " | ";
echo " ";
$sql="select * from tbl_divisi where divisi_kode like '$s[divisi_kode].%' order by divisi_kode";
$result_c=dbresult($sql);
while($s_c=pg_fetch_array($result_c)){
echo "";
echo " | ";
echo "$s_c[divisi_name] | ";
$sql1="select sum(p_dini_nilai_proyek) as \"nilai\" from qry_pasar_potensial where (divisi_kode='$s_c[divisi_kode]') and p_dini_mulai>='$tgl_range1' and p_dini_mulai<'$tgl_range2'";
//echo $sql1;
$hasil = dbresult($sql1);
$po = pg_fetch_array($hasil);
if ($po[nilai]==''){
$po[nilai]='0';
}
echo "".number_format($po[nilai],2)." | ";
if ($inp[bulan]<12){
$c=$inp[bulan]+01;
$tgl2=$inp[tahun]."-".$c."-". 01;
}else{
$tgl2=$inp[tahun]."-".$inp[bulan]."-". 31;
}
$tgl1=$inp[tahun]."-". $inp[bulan]. "-". 01;
$sql2="select sum(p_diperoleh_nilai_kontrak_akhir) as \"nilai\" from qry_pasar_diperoleh where (p_diperoleh_status_approve='approve') and (true and divisi_kode='$s_c[divisi_kode]') and p_diperoleh_tgl_pengumuman>='$tgl_range1' and p_diperoleh_tgl_pengumuman<'$tgl_range2'";
$result2=dbresult($sql2);
$su=pg_fetch_array($result2);
if ($su[nilai]==''){
$su[nilai]='0';
}
echo "".number_format($su[nilai],2)." | ";
if ($su[nilai]==''){
$su[nilai]=0;
}
$jumlah=(($po[nilai]=='') or ($po[nilai]=='0'))?0:$su[nilai]/$po[nilai]*100;
$cok=number_format($jumlah,2);
echo "$cok % | ";
}
echo "";
echo " | ";
echo "SUB TOTAL $s[divisi_name] | ";
if ($inp[bulan]<12){
$c=$inp[bulan]+01;
$tgl3=$inp[tahun]."-".$c."-". 01;
}else{
$tgl3=$inp[tahun]."-".$inp[bulan]."-". 31;
}
$tgl4=$inp[tahun]."-". $inp[bulan]."-". 01;
#$tgl4=$inp[tahun]."-".$inp[bulan]."-01";
#$tgl3=$inp[tahun]."-".$inp[bulan]."-". 30;
$sql1="select sum(p_dini_nilai_proyek) as \"nilai\" from qry_pasar_potensial where (divisi_kode='$s[divisi_kode]' or divisi_kode like '$s[divisi_kode].%') and p_dini_mulai>='$tgl_range1' and p_dini_mulai<'$tgl_range2'";
//echo $sql1;
$hasil = dbresult($sql1);
$po = pg_fetch_array($hasil);
if ($po[nilai]==''){
$po[nilai]='0';
}
$juml_pot=$juml_pot+$po[nilai];
echo "".number_format($po[nilai],2)." | ";
if ($inp[bulan]<12){
$c=$inp[bulan]+01;
$tgl2=$inp[tahun]."-".$c."-". 01;
}else{
$tgl2=$inp[tahun]."-".$inp[bulan]."-". 31;
}
$tgl1=$inp[tahun]."-". $inp[bulan]. "-". 01;
#$tgl1=$inp[tahun]."-".$inp[bulan]."-01";
#$tgl2=$inp[tahun]."-".$inp[bulan]."-". 30;
$sql2="select sum(p_diperoleh_nilai_kontrak_akhir) as \"nilai\" from qry_pasar_diperoleh where (p_diperoleh_status_approve='approve') and (true and divisi_name='$s[divisi_name]') and p_diperoleh_tgl_pengumuman>='$tgl_range1' and p_diperoleh_tgl_pengumuman<'$tgl_range2'";
$result2=dbresult($sql2);
$su=pg_fetch_array($result2);
if ($su[nilai]==''){
$su[nilai]='0';
}
$juml_efek=$juml_efek+$su[nilai];
echo "".number_format($su[nilai],2)." | ";
if ($su[nilai]==''){
$su[nilai]=0;
}
$jumlah=(($po[nilai]=='') or ($po[nilai]=='0'))?0:$su[nilai]/$po[nilai]*100;
$cok=number_format($jumlah,2);
$jml_total_bawah=$jml_total_bawah+$cok;
#echo "$su[name] | ";
#$jumlah=$su[name]/$s[divisi_name]*100;
echo "$cok % | ";
$i++;
}
$txtut.=" ";
$txtut.=" T O T A L | ";
$txtut.=" ".number_format($juml_pot,2)." | ";
$txtut.=" ".number_format($juml_efek,2)." | ";
$bmb=(($juml_pot=='') or ($juml_pot=='0'))?0:$juml_efek/$juml_pot*100;
$txtut.=" ".number_format($bmb,2)." | ";
$txtut.=" ";
echo $txtut;
?>
|
|