|
District Wise NGO Contraceptive Acceptors and Acceptance Rate (CAR%) |
|
//Division name
$Div_Name = mysql_query("select division.Div_Name from division where Div_Code='$div_code'");
$rowD=mysql_fetch_array($Div_Name);
$D_Name=$rowD['Div_Name'];
//Month name
$sql=mysql_query("select M_name from month where M_id='$m'");
$rowM=mysql_fetch_array($sql);
$M_Name=$rowM['M_name'];
$result = mysql_query("select district.Dist_Name,Sum(car_details.Total_EC) EC,
(Sum(car_details.Pill_Old)+Sum(car_details.Pill_New)) Pill,
(Sum(car_details.Con_Old)+Sum(car_details.Con_New)) Con,
(Sum(car_details.Inj_Old)+Sum(car_details.Inj_New)) Inj,
(Sum(car_details.IUD_Old)+Sum(car_details.IUD_New)) IUD,
(Sum(car_details.Imp_Old)+Sum(car_details.Imp_New)) Imp,
(Sum(car_details.PerM_Old)+Sum(car_details.PerM_New)) PerM,
(Sum(car_details.PerF_Old)+Sum(car_details.PerF_New)) PerF,
(Sum(car_details.PerM_Old)+Sum(car_details.PerM_New)+Sum(car_details.PerF_Old)+Sum(car_details.PerF_New)) TPer,
(((Sum(car_details.Pill_Old)+Sum(car_details.Pill_New))+
(Sum(car_details.Con_Old)+Sum(car_details.Con_New))+
(Sum(car_details.Inj_Old)+Sum(car_details.Inj_New))+
(Sum(car_details.IUD_Old)+Sum(car_details.IUD_New))+
(Sum(car_details.Imp_Old)+Sum(car_details.Imp_New))+
(Sum(car_details.PerM_Old)+Sum(car_details.PerM_New))+
(Sum(car_details.PerF_Old)+Sum(car_details.PerF_New)) )/sum(car_details.Total_EC))*100 TCAR
from district,thana,car_details
Where ((district.Dist_code = thana.Dist_code)
And (car_details.Thana_code=thana.Thana_code))
And car_details.Month_Id='$Date'
AND district.Div_Code='$div_code' And NGO_Code<>'1'
Group By district.Dist_Name Order By district.Dist_code");
$num=mysql_num_rows($result);
//Total Output
$Tresult =mysql_query("select sum(car_details.Total_EC) TEC,
(Sum(car_details.Pill_Old)+Sum(car_details.Pill_New)) TPill,
(Sum(car_details.Con_Old)+Sum(car_details.Con_New)) TCon,
(Sum(car_details.Inj_Old)+Sum(car_details.Inj_New)) TInj,
(Sum(car_details.IUD_Old)+Sum(car_details.IUD_New)) TIUD,
(Sum(car_details.Imp_Old)+Sum(car_details.Imp_New)) TImp,
(Sum(car_details.PerM_Old)+Sum(car_details.PerM_New)) TPerM,
(Sum(car_details.PerF_Old)+Sum(car_details.PerF_New)) TPerF,
(Sum(car_details.PerM_Old)+Sum(car_details.PerM_New)+Sum(car_details.PerF_Old)+Sum(car_details.PerF_New)) TTPer,
(((Sum(car_details.Pill_Old)+Sum(car_details.Pill_New))+
(Sum(car_details.Con_Old)+Sum(car_details.Con_New))+
(Sum(car_details.Inj_Old)+Sum(car_details.Inj_New))+
(Sum(car_details.IUD_Old)+Sum(car_details.IUD_New))+
(Sum(car_details.Imp_Old)+Sum(car_details.Imp_New))+
(Sum(car_details.PerM_Old)+Sum(car_details.PerM_New))+
(Sum(car_details.PerF_Old)+Sum(car_details.PerF_New)) )/sum(car_details.Total_EC))*100 TTCAR
from district,thana,car_details
Where ((district.Dist_code = thana.Dist_code)
And (car_details.Thana_code=thana.Thana_code))
And car_details.Month_Id='$Date' And NGO_Code<>'1'
AND district.Div_Code='$div_code'");
$Trow=mysql_fetch_array($Tresult);
$T_EC=$Trow['TEC'];
$T_Pill=$Trow['TPill'];
$T_Con=$Trow['TCon'];
$T_Inj=$Trow['TInj'];
$T_IUD=$Trow['TIUD'];
$T_Imp=$Trow['TImp'];
$T_PerM=$Trow['TPerM'];
$T_PerF=$Trow['TPerF'];
$T_Tper=$Trow['TTPer'];
$T_Total=$T_Pill+$T_Con+$T_Inj+$T_IUD+$T_Imp+$T_Tper;
$T_CAR=number_format($Trow['TTCAR'],2);
//Reporting Thana Count
$sql1=mysql_query("select count(Thana_code) Thana_code from car_details where Month_Id='$Date' And NGO_Code='1'
And substr(Thana_code,1,2)='$div_Code'");
$rowR=mysql_fetch_array($sql1);
$R_Thana=$rowR['Thana_code'];
//Total Thana Count
$sql2=mysql_query("select count(Thana_code) Thana_code from thana where substr(Thana_code,1,2)='$div_Code'");
$rowT=mysql_fetch_array($sql2);
$T_Thana=$rowT['Thana_code'];
?>
Division: echo $D_Name; ?>
Reporting Month: echo $M_Name; ?>, echo $y; ?> |
District Name |
Eligible Couple |
Oral Pill |
Condom |
Injectable |
I U D |
Implant |
Permanent Method |
Total Acceptors |
CAR(%) |
Male |
Female |
Total |
$i=0;
while ($i<$num){
$Dist_name=mysql_result($result,$i,"district.Dist_Name");
$Toatal_Ec=mysql_result($result,$i,"EC");
$Pill=mysql_result($result,$i,"Pill");
$Con=mysql_result($result,$i,"Con");
$Inj=mysql_result($result,$i,"Inj");
$IUD=mysql_result($result,$i,"IUD");
$Imp=mysql_result($result,$i,"Imp");
$PerM=mysql_result($result,$i,"PerM");
$PerF=mysql_result($result,$i,"PerF");
$TPer=mysql_result($result,$i,"TPer");
$TUser=$Pill+$Con+$Inj+$IUD+$Imp+$TPer;
$TCAR=number_format(mysql_result($result,$i,"TCAR"),2);
$style = "sr";
if ($i % 2 != 0) {
$style = "dr";
}
?>
echo $Dist_name;?> |
echo $Toatal_Ec;?>
| echo $Pill;?> |
echo $Con;?>
| echo $Inj;?>
| echo $IUD;?>
| echo $Imp;?>
| echo $PerM;?>
| echo $PerF;?>
| echo $TPer;?>
| echo $TUser;?>
| echo $TCAR;?>
|
++$i;
}
?>
Division Total |
echo $T_EC;?> |
echo $T_Pill;?> |
echo $T_Con;?> |
echo $T_Inj;?> |
echo $T_IUD;?> |
echo $T_Imp;?> |
echo $T_PerM;?> |
echo $T_PerF;?> |
echo $T_Tper;?> |
echo $T_Total;?> |
echo $T_CAR;?> |