| " . $i . " |
" . $row['STK_NO'] . " |
" . $row['DESCRIPT'] . " | ";
for ($x = 0; $x <= $count; $x++) {
$sql_inv = "SELECT SUM(QTY) AS QTY from s_trn where month(SDATE) >='".$month1."' and year(SDATE) >='".$month1_y."' and month(SDATE) <='".$month1."' and year(SDATE) <='".$month1_y."' and ( LEDINDI='INV' ) and STK_NO='".$row['STK_NO']."' " ;
if($_GET['dep'] !=""){
$sql_inv.=" and DEPARTMENT='".$_GET['dep']."'";
}
$result_inv = $conn->query($sql_inv);
$row_inv = $result_inv->fetch();
$sql_grn = "SELECT SUM(QTY) AS QTY from s_trn where month(SDATE) >='".$month1."' and year(SDATE) >='".$month1_y."' and month(SDATE) <='".$month1."' and year(SDATE) <='".$month1_y."' and ( LEDINDI='GRN' ) and STK_NO='".$row['STK_NO']."' " ;
if($_GET['dep'] !=""){
$sql_grn.=" and DEPARTMENT='".$_GET['dep']."'";
}
$result_grn = $conn->query($sql_grn);
$row_grn = $result_grn->fetch();
$sql_iin = "SELECT SUM(QTY) AS QTY from s_trn where month(SDATE) >='".$month1."' and year(SDATE) >='".$month1_y."' and month(SDATE) <='".$month1."' and year(SDATE) <='".$month1_y."' and ( LEDINDI='IIN' ) and STK_NO='".$row['STK_NO']."' " ;
if($_GET['dep'] !=""){
$sql_iin.=" and DEPARTMENT='".$_GET['dep']."'";
}
$result_iin = $conn->query($sql_iin);
$row_iin = $result_iin->fetch();
$sql_iou = "SELECT SUM(QTY) AS QTY from s_trn where month(SDATE) >='".$month1."' and year(SDATE) >='".$month1_y."' and month(SDATE) <='".$month1."' and year(SDATE) <='".$month1_y."' and ( LEDINDI='IOU' ) and STK_NO='".$row['STK_NO']."' " ;
if($_GET['dep'] !=""){
$sql_iou.=" and DEPARTMENT='".$_GET['dep']."'";
}
$result_iou = $conn->query($sql_iou);
$row_iou = $result_iou->fetch();
$sql_gini = "SELECT SUM(QTY) AS QTY from s_trn where month(SDATE) >='".$month1."' and year(SDATE) >='".$month1_y."' and month(SDATE) <='".$month1."' and year(SDATE) <='".$month1_y."' and ( LEDINDI='GINI' ) and STK_NO='".$row['STK_NO']."' " ;
if($_GET['dep'] !=""){
$sql_gini.=" and DEPARTMENT='".$_GET['dep']."'";
}
$result_gini = $conn->query($sql_gini);
$row_gini = $result_gini->fetch();
$sql_ginr = "SELECT SUM(QTY) AS QTY from s_trn where month(SDATE) >='".$month1."' and year(SDATE) >='".$month1_y."' and month(SDATE) <='".$month1."' and year(SDATE) <='".$month1_y."' and ( LEDINDI='GINR' ) and STK_NO='".$row['STK_NO']."' " ;
if($_GET['dep'] !=""){
$sql_ginr.=" and DEPARTMENT='".$_GET['dep']."'";
}
$result_ginr = $conn->query($sql_ginr);
$row_ginr = $result_ginr->fetch();
$sql_arn = "SELECT SUM(QTY) AS QTY from s_trn where month(SDATE) >='".$month1."' and year(SDATE) >='".$month1_y."' and month(SDATE) <='".$month1."' and year(SDATE) <='".$month1_y."' and ( LEDINDI='ARN' ) and STK_NO='".$row['STK_NO']."' " ;
if($_GET['dep'] !=""){
$sql_arn.=" and DEPARTMENT='".$_GET['dep']."'";
}
$result_arn = $conn->query($sql_arn);
$row_arn = $result_arn->fetch();
$sql_arr = "SELECT SUM(QTY) AS QTY from s_trn where month(SDATE) >='".$month1."' and year(SDATE) >='".$month1_y."' and month(SDATE) <='".$month1."' and year(SDATE) <='".$month1_y."' and ( LEDINDI='ARR' ) and STK_NO='".$row['STK_NO']."' " ;
if($_GET['dep'] !=""){
$sql_arr.=" and DEPARTMENT='".$_GET['dep']."'";
}
$result_arr = $conn->query($sql_arr);
$row_arr = $result_arr->fetch();
$arn=$row_arn['QTY'];
$arr=$row_arr['QTY'];
$gini=$row_gini['QTY'];
$ginr=$row_ginr['QTY'];
$iin=$row_iin['QTY'];
$iou=$row_iou['QTY'];
$inv=$row_inv['QTY'];
$grn=$row_grn['QTY'];
$bal=$row_inv['QTY']-$row_grn['QTY'];
echo " ". number_format($arn,2)." | ";
echo " ". number_format($arr,2)." | ";
echo " ". number_format($gini_1,2)." | ";
echo " ". number_format($ginr,2)." | ";
echo " ". number_format($iin,2)." | ";
echo " ". number_format($iou,2)." | ";
echo " ". number_format($inv,2)." | ";
echo " ". number_format($grn,2)." | ";
echo " ". number_format($bal,2)." | ";
$month1=$month1+1;
$month2=$month2+1;
}
echo"
";
$i=$i+1;
}
echo"