Forums
This topic is locked
display in line
Posted 20 Jul 2007 11:27:46
1
has voted
20 Jul 2007 11:27:46 nizam salamon posted:
<pre id=code><font face=courier size=2 id=code> <?php$var_i=1;
$EE1 = " "; $EE2= " ";
$T_OT1=0; $T_OT2=0; $T_OT3=0; $T_OT4=0; $T_OT5=0;
$OT1=0; $OT2=0; $OT3=0; $OT4=0; $OT5=0;
while (!$rs_hptrx->EOF) {
$TT = $rs_hptrx->Fields('TRX_CODE');
$AMT = $rs_hptrx->Fields('tot_ot');
$T_AMT = $T_AMT + $rs_hptrx->Fields('tot_ot');
if ( $TT == 'OT1' ) {$OT1 = $AMT; $T_OT1 = $T_OT1 + $AMT;}
else if ( $TT == 'OT2' ) {$OT2 = $AMT; $T_OT2 = $T_OT2 + $AMT;}
else if ( $TT == 'OT3' ) {$OT3 = $AMT; $T_OT3 = $T_OT3 + $AMT;}
else if ( $TT == 'OT4' ) {$OT4 = $AMT; $T_OT4 = $T_OT4 + $AMT;}
else if ( $TT == 'OT5' ) {$OT5 = $AMT; $T_OT5 = $T_OT5 + $AMT;}
$var_i3++;
if (!($EE1 != $EE2)){</font id=code></pre id=code>
<pre id=code><font face=courier size=2 id=code>
?>
<tr class="12">
<td width="3%"><?php echo $var_i ?></td>
<td width="15%" height="46" ><?php echo $rs_hptrx->Fields('emp_Id'); ?></td>
<td width="16%"><?php echo $rs_hptrx->Fields('emp_Name'); ?></td>
<td width="16%"><?php echo $OT1; ?></td>
<td width="7%"><?php echo $OT2; ?></td>
<td width="7%"><?php echo $OT3; ?></td>
<td width="7%"><?php echo $OT4; ?></td>
<td width="7%"><?php echo $OT5; ?></td>
<td width="13%"><?php echo $T_AMT; ?></td>
</tr>
<?php
//$T_AMT = 0;
$var_i++;
$EE1 = $rs_hptrx->Fields('emp_Id');
//$OT1=0; $OT2=0; $OT3=0; $OT4=0; $OT5=0;
}
$rs_hptrx->MoveNext();
$EE2 = $rs_hptrx->Fields('emp_Id');
} // while not eof rs_hptrx
?>
<tr class="">
<td height="2" colspan="1" ></td>
</tr>
<tr class="12">
<td width="3%"><?php echo $var_i -1 ?></td>
<td height="16" colspan="2" >GRAND TOTAL </td>
<td width="7%"><?php echo $T_OT1; ?></td>
<td width="7%"><?php echo $T_OT2; ?></td>
<td width="7%"><?php echo $T_OT3; ?></td>
<td width="7%"><?php echo $T_OT4; ?></td>
<td width="7%"><?php echo $T_OT5; ?></td>
<td width="13%"></td>
</tr> </font id=code></pre id=code>
I need some help to correct the looping..Thanks in advance
NiZAM-iT
Edited by - nizamasdiana on 20 Jul 2007 11:30:09