<?php
if ($ctr1 < 23) {
    ?>
    <table class="mtable">

        <tr>
            <td  class="mtable"style="width:85%;">
                <span style="padding-right:570px;"></span>Sub Total
            </td>
            <td class="mtd" style="width:15%"><b><?php echo number_format($totamt, 2, ".", ''); ?></b></td>
        </tr>

        <tr>
            <td  class="mtable"style="width:85%">PACKET CHARGES FOR
                <span style="padding-right:100px;"></span>
                <?php echo $fmain['nopack']; ?>&nbsp;&nbsp;Packets@
                <span style="padding-right:20px;"></span><i class="fa fa-inr"></i> <?php echo $fmain['packrate'] ?> 
                <span style="padding-right:20px;"></span>Per Packet
            </td>
            <td class="mtd" style="width:15%"><b><?php echo $fmain['packamt']; ?></b></td>
        </tr>

        <tr>
            <td  class="mtable"style="width:85%">S.T PARCEL NO.- &nbsp;&nbsp;&nbsp;<?php echo $fmain['parcno'] ?></td>
            <td class="mtd" style="width:15%"><b><?php echo $fmain['stamt']; ?></b></td>
        </tr>

        <tr>
            <td  class="mtable"style="width:85%">OTHER CHARGES - &nbsp;&nbsp;&nbsp;<?php echo $fmain['other'] ?></td>
            <td class="mtd" style="width:15%"><b><?php echo$fmain['otheramt']; ?></b></td>
        </tr>
        <?php
        $tdtotamt = 0;
        $tdtotamt = round($tdtotamt + $totamt + $fmain['packamt'] + $fmain['stamt'] + $fmain['otheramt']);
        $tadvance = $fmain['advance'];
        $tbalamt = $fmain['balamt'];
        ?>
        <tr>
            <td  class="mtable"style="width:85%;">E.& O.E
                <span style="padding-right:460px;"></span>Total(After Rounding)
            </td>
            <td class="mtd" style="width:15%"><b><i class="fa fa-inr"></i>&nbsp;<?php echo number_format($tdtotamt, 2, ".", ''); ?></b></td>
        </tr>
        <?php if ($tadvance > 0) { ?>
            <tr>
                <td  class="mtable"style="width:85%;">
                    <span style="padding-right:460px;"></span>Advance
                </td>
                <td class="mtd" style="width:15%"><b><i class="fa fa-inr"></i>&nbsp;<?php echo number_format($tadvance, 2, ".", ''); ?></b></td>
            </tr>
            <tr>
                <td  class="mtable"style="width:85%;">
                    <span style="padding-right:460px;"></span>Balance Amount
                </td>
                <td class="mtd" style="width:15%"><b><i class="fa fa-inr"></i>&nbsp;<?php echo number_format($tbalamt, 2, ".", ''); ?></b></td>
            </tr>
        <?php } ?>
    </table>

    <?php
    $tt = '';
    if ($tbalamt > 0) {
        $tt = rsword(abs($tbalamt)) . 'Only';
    }
    ?>
    <table>
        <tr>
            <td class="mtable"><i class="fa fa-inr"></i>&nbsp;<?php echo $tt; ?> </td>
        </tr>
    </table>

    <table>
        <tr>
            <td style="width:50%; padding:3px; "></td>
            <td style="width:50%; padding:3px;"><b>For MAHARASHTRA BHARATEEYA SHIKSHAN MANDAL
                </b></td>
        </tr>
    </table>

    <table>
        <tr>
            <td style="width:80%; padding:1px;"><i>NOTE:- PLEASE PAY YOUR DUES WITHIN 15 DAYS/PLEASE IGNORE IF ALREADY PAID.
                </i></td>
            <td style="width:20%; padding:1px;"></td>
        </tr>

        <tr>
            <td style="width:80%; padding:1px;"><span style="padding-right:40px"></span><i>
                    CHEQUE/DEMAND DRAFTS/NEFT OR RTGS PAYMENT IN FAVOUR OF
                </i></td>
            <td style="width:20%; padding:1px;"></td>
        </tr>

        <tr>
            <td style="width:80%; padding:1px;"><span style="padding-right:40px"></span>
                "MAHARASHTRA BHARATEEYA SHIKSHAN MANDAL"
            </td>
            <td style="width:20%; padding:1px;"></td>
        </tr>

        <tr>
            <td style="width:80%; padding:1px;"><span style="padding-right:40px"></span><i>
                    <!--STRICTLY DEMAND DRAFT PAYMENT FOR SCHOOLS OUT OF MUMBAI AND THANE-->
                </i></td>
            <td style="width:20%; padding:1px;"></td>
        </tr>
        <tr>
            <td style="width:80%; padding:1px;"><span style="padding-right:40px"></span><i>
                    COMPUTER GENERATED DOCUMENT SIGNATURE DENIED
                </i></td>
            <td style="width:20%; padding:1px;"></td>
        </tr>
        <?php
    } else {
        ?>
        <table>
            <tr>
                <td style="width:50%; padding:3px; "></td>
                <td style="width:50%; padding:3px;"><b>&nbsp;
                    </b></td>
            </tr>
            <tr>
                <td style="width:50%; padding:3px; "></td>
                <td style="width:50%; padding:3px;"><b>continue to next page .... 
                    </b></td>
            </tr>
        </table>
    <?php }
    ?>    
</table>
</div>
</div>
