<?php
ob_start();
require("includes/check_auth_user.php");
require("includes/dbconnect.php");
include('includes/function.php');

$formname = "Party Position";
$file = "partyposn_fr.php";
$grid = "";
$zroot = $_SESSION["zdbroot"];
$admin = $_SESSION["admin_" . $dbname];
$zdb = $_SESSION["zdbyear_" . $dbname];
$myyear = $_SESSION[$myyear];
mysqli_select_db($conn, $zdb);
$seriescond = "";
include("includes/linkshead.php");
include("includes/searchrow.php");
?>
<link href="MyStyle/rep_format.css" type="text/css">
<style type="text/css">
    #tabital {
        font-style: italic;
    }

    #font1 {
        font-style: italic;
    }

    #boldfont {
        font-weight: bold;
    }

    .mtotclr {
        color: #0098DA;
    }


    .ttotclr {
        color: #ed3237;
    }


    .getdtl {
        font-size: 14px;
    }
    /* CSS */

    .button-1 {
        position: relative;
        border: none;
        background: transparent;
        padding: 0;
        cursor: pointer;
        outline-offset: 4px;
        transition: filter 250ms;
        user-select: none;
        -webkit-user-select: none;
        touch-action: manipulation;
    }


    .button-1-shadow {
        position: absolute;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        border-radius: 12px;
        background: hsl(0deg 0% 0% / 0.25);
        will-change: transform;
        transform: translateY(2px);
        transition:
            transform 600ms cubic-bezier(.3, .7, .4, 1);
    }

    .button-1-edge {
        position: absolute;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        border-radius: 12px;
        background: linear-gradient(to left,
                hsl(340deg 100% 16%) 0%,
                hsl(340deg 100% 32%) 8%,
                hsl(340deg 100% 32%) 92%,
                hsl(340deg 100% 16%) 100%);
    }

    .button-1-front {
        display: block;
        position: relative;
        padding: 12px 27px;
        border-radius: 12px;
        font-size: 15px;
        font-weight: bold;
        color: white;
        background: grey;
        will-change: transform;
        transform: translateY(-4px);
        transition:
            transform 600ms cubic-bezier(.3, .7, .4, 1);
    }


    @media (min-width: 768px) {
        .button-1-front {
            font-size: 25px;
            padding: 6px 23px;
        }
    }



    .button-1:hover {
        filter: brightness(110%);
        -webkit-filter: brightness(110%);
    }


    .button-1:hover .button-1-front {
        transform: translateY(-6px);
        transition:
            transform 250ms cubic-bezier(.3, .7, .4, 1.5);
    }



    /*

        .button-1:active .button-1-front {

            transform: translateY(-2px);

            transition: transform 34ms;

        }*/



    .button-1:hover .button-1-shadow {
        transform: translateY(4px);
        transition:
            transform 250ms cubic-bezier(.3, .7, .4, 1.5);
    }
</style>
</head>
<body>
    <div class="container">
        <div class="row" style="padding-top:1%">
            <div class="col-lg-2 col-md-1 col-sm-2 col-xs-2 pad text-center">
                <a href="customer.php?mode=true"
                    class="form-control button-1 button-1-front button-1-shadow button-1-edge">Add New</a>
            </div>
        </div>
        <div class="row">
            <div class="col-lg-12 col-md-12 col-sm-12 col-xs-12 pad">
                <table class="table1 table-bordered myTable" style="width:100%">
                    <thead class="mySearchTr">
                        <tr>
                            <center>
                                <h3 style="background-color:#963634;color:whitesmoke;border: 1px solid black;">PARTY
                                    POSITIONS</h3>
                            </center>
                        </tr>
                        <tr style="height:30px">
                            <th style="color:black;width:20%" colspan="2"><b>Party</b></th>
                            <th style="color:black;width:9%" class="text-right"><b>Amount</b></th>
                            <!--<th style="color:black;width:9%" class="text-right"><b>INR</b></th>-->
                            <th style="color:black;width:5%" class="text-center"><b>View</b></th>
                        </tr>

                    </thead>

                        <tr class='filters noPrint'style="height:30px">

                            <th style="width:20%;" class="filter-container" colspan="2"><input type ="text"  class="filter" name="party" placeholder="Party" data-col="party"></th>

                            <!--<th style="width:9%;"  class="filter-container"><input type ="text"  class="filter text-right" name="rmb" placeholder="RMB" data-col="rmb"></th>-->

                            <th style="width:9%;"  class="filter-container">
                                <!--<input type ="text"  class="filter text-right" name="inr" placeholder="Amount" data-col="inr" >-->
                            </th>

                            <th style="width:5%;"  class="filter-container"></th>

                        </tr>

                    <tbody>

                        <?php

                        $getdata = mysqli_query($conn, "SELECT * FROM accmast WHERE grpcode = '010' or grpcode = '009' order by `name`") or die(mysqli_error($conn));

                        while ($pmain = mysqli_fetch_array($getdata)) {
                            $maccode = $pmain['accode'];

                            $mopbal = $pmain['openbal'];

                            $mdc = $pmain['dc'];

                            $mopenfe = $pmain['openfe'];

                            $mdcfe = $pmain['dcfe'];

                            if ($mdc == "D") {

                                $opbal = $mopbal * -1;

                            } else {

                                $opbal = $mopbal;

                            }

                            $getdep = mysqli_query($conn, "SELECT sum(amount) as tamt FROM `actran` where accode = '$maccode'") or die(mysqli_error($conn));

                            $fetdep = mysqli_fetch_array($getdep);

                            $abalamt = $fetdep['tamt'];

                            

                            
                            $balamt = $opbal + $abalamt;

                            

                            $file = "customer.php?accode=$maccode&mode=edit";



                            echo "<tr class='getdtl' style='height:30px;'>";

                            echo "<td colspan='2' style ='font-size:13px;font-weight:bold'><a href='partydet_fr.php?accode=$maccode' target='_blank'>$pmain[name]</a></td>";

//                            echo "<td class='getdtl text-right rmb'>$balamtfe</td>";

                            echo "<td class='getdtl text-right inr'>$balamt</td>";

                            echo "<td align='center'><a href='$file' target='_blank' ><i class='fa fa-1x fa-desktop'></i></a></td>";

                            echo "</tr>";



                            $totbalamt = $totbalamt + $balamt;

                            $totbalamtfe = $totbalamtfe + $balamtfe;

                        }

                        echo "<tr style='height:30px;background-color:#c1c1c1;'>";

                        echo "<td colspan='2' class='getdtl text-right'><b>Total</b></td>";

//                        echo "<td class='getdtl text-right'><b>$totbalamtfe</b></td>";

                        echo "<td class='getdtl text-right'><b>$totbalamt</b></td>";

                        echo "<td></td>";

                        echo "</tr>";

                        ?>

                    </tbody>

                </table>

            </div>

        </div>

    </div>



    

    <?php include("includes/linksfoot.php");

    ?>

</body>



</html>