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

$formname = "Agents Position";
$file = "agentposn_fr.php";
$grid = "";
$zroot = $_SESSION["zdbroot"];

$accdb = "actran";

$admin = $_SESSION["admin_" . $dbname];
$zdb = $_SESSION["zdbyear_" . $dbname];
$myyear = $_SESSION[$myyear];
$zyear = right($zdb, 4);
$mfrmdate = getzdates($zyear, 'S', $conn);
$mtodate = getzdates($zyear, 'E', $conn);
mysqli_select_db($conn, $zdb);


$accode = $_REQUEST['accode'];

$getname = mysqli_query($conn, "Select * from accmast where accode='$accode'") or die(mysqli_error($conn));
$fetname = mysqli_fetch_array($getname);
$partyname = $fetname['name'];
$seriescond = "";
include("includes/linkshead.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;
    }
    .totdwn{
        font-size: 20px;
    }

    .depbtn {
        color: #585858;
        text-transform: uppercase;
        text-decoration: none;
        border: 2px solid purple;
        border-radius:  5px;
        padding: 10px 20px;
        font-size: 17px;
        font-weight: bold;
        background: transparent;
        position: relative;
        transition: all 1s;
        overflow: hidden;
    }

    .depbtn:hover {
        color: white;
    }

    .depbtn::before {
        content: '';
        position: absolute;
        height: 100%;
        width: 0%;
        top: 0;
        left: -40px;
        transform: skewX(45deg);
        background-color: #585858;
        z-index: -1;
        transition: all 1s;
    }

    .depbtn:hover::before {
        width: 160%;
    }

    .withbtn {
        color: black;
        text-transform: uppercase;
        text-decoration: none;
        border: 2px solid green;
        border-radius:  5px;
        padding: 10px 20px;
        font-size: 17px;
        font-weight: bold;
        background: transparent;
        position: relative;
        transition: all 1s;
        overflow: hidden;
    }

    .withbtn:hover {
        color: white;
    }

    .withbtn::before {
        content: '';
        position: absolute;
        height: 100%;
        width: 0%;
        top: 0;
        left: -40px;
        transform: skewX(45deg);
        background-color: #D6BD60;
        z-index: -1;
        transition: all 1s;
    }

    .withbtn:hover::before {
        width: 160%;
    }

    .tradbtn {
        color: #963634;
        text-transform: uppercase;
        text-decoration: none;
        border: 2px solid #963634;
        border-radius:  5px;
        padding: 10px 20px;
        font-size: 17px;
        font-weight: bold;
        background: transparent;
        position: relative;
        transition: all 1s;
        overflow: hidden;
    }

    .tradbtn:hover {
        color: white;
    }

    .tradbtn::before {
        content: '';
        position: absolute;
        height: 100%;
        width: 0%;
        top: 0;
        left: -40px;
        transform: skewX(45deg);
        background-color: #963634;
        z-index: -1;
        transition: all 1s;
    }

    .tradbtn:hover::before {
        width: 160%;
    }
</style>
<script type="text/javascript">
    $(document).ready(function () {
        $("body").on("click", ".depbtn", Deposit);
        $("body").on("click", ".withbtn", Deposit);
        $("body").on("click", ".tradbtn", Trading);
        $("body").on("click", ".savdep", savDeposit);
        function Deposit() {
            $(".depModal").modal("show");
            var depwit = $(this).val();
            $(".para").val(depwit);
            if (depwit == "D") {
                $("#myLargeModalLabel1").show();
                $("#myLargeModalLabel2").hide();
                $(".wittrd").hide();
                $(".deptrd").show();
            } else {
                $(".wittrd").show();
                $(".deptrd").hide();
                $("#myLargeModalLabel1").hide();
                $("#myLargeModalLabel2").show();
            }
        }
        function Trading() {
            $(".tradeModal").modal("show");
//            var depwit = $(this).val();
//            $(".para").val(depwit);
        }
        $("body").on("keyup", ".dollar, .inr, .dollarrecd, .rmb, .rmbamt ", Calculations);

        function Calculations() {
            var inr = $(".inr").val();
            var dollar = $(".dollar").val();
            var rmb = $(".rmb").val();
            var dollarrecd = $(".dollarrecd").val();

            if (inr && dollar > 0) {
                let exchangedrate = inr / dollar;
                let roe = exchangedrate.toFixed(2);

                $(".roe").val(roe);
            } else {
                $(".roe").val(0);
            }
            if (dollar && dollarrecd > 0) {
                let conVal = dollar - dollarrecd;
                let conchgs = conVal.toFixed(2);

                $(".conchgs").val(conchgs);
            } else {
                $(".conchgs").val(0);
            }

//            if (dollarrecd && rmb > 0) {
//                let rmbamount = dollarrecd * rmb;
//                let rmbamt = rmbamount.toFixed(2);
//
//                $(".rmbamt").val(rmbamt);
//            } else {
//                $(".rmbamt").val(0);
//            }
            var rmbamt = $(".rmbamt").val();

            if (rmbamt && inr > 0) {
                let rmbamount = inr / rmbamt;
                let inrtormb = rmbamount.toFixed(2);

                $(".inrtormb").val(inrtormb);
            } else {
                $(".inrtormb").val(0);
            }
        }
        function savDeposit() {
            var formData = {};

            // Iterate over all visible input, textarea, and select fields
            $('.depModal input, textarea, select').filter(':visible').each(function () {
                var fieldName = $(this).attr('name');
                var fieldValue;
                var fieldType = $(this).attr('type'); // Get the type of the field


                // Only add to the object if the field has a name attribute

                if (fieldType === 'checkbox' || fieldType === 'radio') {
                    // For checkboxes and radios, check if they are checked
                    fieldValue = $(this).is(':checked') ? $(this).val() : null;
                } else {
                    // For other fields (text, textarea, select), get the value directly
                    fieldValue = $(this).val();
                }
                if (fieldName && fieldValue !== null) {
                    formData[fieldName] = fieldValue;
                }
            });

            // Convert the object to JSON format
            var jsonData = JSON.stringify(formData);
            var newv = 0;

            $.ajax({
//                url: 'addhtrtcrd.php', // Replace with your server URL
                url: 'saveAgentIn.php', // Replace with your server URL
                type: 'POST',
                contentType: 'application/json',
                data: jsonData,
                success: function (response) {
                    var m = response;
                    if (m.success == true) {

                        newv = m.vouchno;
                        $(".vouchno").val(m.vouchno);
                        if (newv > 0) {
                            location.reload();
                        }
                        event.preventDefault();

                    }
                },
                error: function (xhr, status, error) {
                    console.error('Error:', status, error);
                }
            });
//            alert(jsonData);
        }


        $("body").on("keyup", ".droe", convertRMBToINR);

        function convertRMBToINR() {
            var rmb = $(".drmb").val();
            var roe = $(".droe").val();

            if (rmb && roe > 0) {
                var inramount = rmb * roe;
                var inr = inramount.toFixed(2);
                $(".dinr").val(inr);
            } else {
                $(".dinr").val(0);
            }
        }


    })
</script>
<style>
    @media print {
        a {
            text-decoration: none; /* Remove the underline */
            color: black; /* Change the color to black */
        }
        a[href]:after {
            content: none; /* Hide the href */
        }

        table td{
            font-size: 10px;
        }
    }
</style>


</head>
<body>
    <div class="" style="padding-left:2%;padding-right: 2%">
        <input type="hidden" name="accode" class="accode" value="<?= $accode ?>">
        <?php // include("includes/head_rep.php"); ?>
        <br>
        <div class="row" >
            <div class="col-lg-2 col-md-1 col-sm-3 col-xs-3 pad text-right" >
                <button type="button" class="depbtn" value="D">Agent In</button>
            </div>
            <div class="col-lg-2 col-md-1 col-sm-3 col-xs-3 pad text-right" >
                <button type="button" class="withbtn" value="W">Agent Out</button>
            </div>
            <!--            <div class="col-lg-2 col-md-1 col-sm-2 col-xs-2 pad text-right" >
                            <button type="button" class="tradbtn">Trade</button>
                        </div>-->
        </div>
        <!--        <div class="row" >
                    <div class="col-lg-2 col-md-1 col-sm-2 col-xs-2 pad text-right" >
                        <h1 style="background-color:#585858;color:white;border: 1px solid black;">Bid </h1>
                    </div>
                    <div class="col-lg-2 col-md-1 col-sm-2 col-xs-2 text-center pad">
                        <h1 style="background-color:#D6BD60;color:#963634;border: 1px solid black;"><?php echo "$bidrate"; ?></h1>
                    </div>
                            </div>
                            <div class="row">
                    <div class="col-lg-2 col-md-1 col-sm-2 col-xs-2 pad text-right" style="">
                        <h1 style="background-color:#585858;color:white;border: 1px solid black;">Ask </h1>
                    </div>
                    <div class="col-lg-2 col-md-1 col-sm-2 col-xs-2 text-center pad">
                        <h1 style="background-color:#D6BD60;color:#963634;border: 1px solid black;"><?php echo "$askrate"; ?></h1>
                    </div>
                </div>-->
        <div class="row">
            <div class="col-lg-12 col-md-12 col-sm-12 text-center col-xs-12 pad">
                <h1 style="background-color:#963634;color:whitesmoke;border: 1px solid black;"><?= $fetname['name'] ?></h1>
            </div>
        </div>

        <div class="row">
            <?php
            $agent = $accode;
            
            $getpmain = mysqli_query($conn, "SELECT a.*, DATE_FORMAT(a.`vouchdt`, '%d-%m-%Y') as mydt, b.name AS agent 
                                        FROM `agentin` a, accmast b where a.party = b.accode and a.agent = '$accode'
                                        and a.`vouchdt` >= '$mfrmdate' AND a.`vouchdt` <= '$mtodate' $agentcond")or die(mysqli_error($conn));

            mysqli_select_db($conn, $zdb);
            ?>

            <div class="">
                <div class="row">
                    <div class="col-lg-6" style="width:100%;">
                        <div class="box">
                            <table width="100%">
                                <tr style="border:2px">
                                    <th style="font-size: 18px;color:black" colspan="2"> <?= $mname ?></th>
                                </tr>
                                <tr>
                                    <td width="60%" style="float:left">
                                        <table style="background: white" class="table table-condensed table-hover table-bordered">
                                            <thead>
                                                <tr class="mySearchTr">
                                                    <th style="width:2%">Voucher</th>
                                                    <th style="width:9%">Date</th>
                                                    <th style="width:7%" class="text-right">INR</th>
                                                    <th style="width:7%" class="text-right">Dollar</th>
                                                    <th style="width:6%" class="text-right">Conversion to Dollar</th>
                                                    <th style="width:7%" class="text-right">Dollar Received</th>
                                                    <th style="width:7%" class="text-right">Conversion Charges (USD)</th>
                                                    <th style="width:6%" class="text-right">Conversion Dollar to RMB</th>
                                                    <th style="width:7%" class="text-right">RMB Amount</th>
                                                    <th style="width:5%" class="text-right">INR to RMB</th>
                                                </tr>
                                            </thead>
                                            <tbody>
                                                <?php
                                                $ctr = $totinr = $totroe = $totdollar = $totrmb = $totrmbamt = $totdollarrecd = $totchgs = $totinrtormb = 0;

                                                if ($agent != '') {
                                                    $getagm = mysqli_query($conn, "SELECT openbal, dc, openfe, dcfe FROM `accmast` WHERE accode = '$agent' ") or die(mysqli_error($conn));
                                                    $fetagm = mysqli_fetch_array($getagm);
                                                    $opfe = $fetagm['openfe'];
                                                    $opfedc = $fetagm['dcfe'];

                                                    if ($opfedc == 'C') {
                                                        $opfe = $opfe * - 1;
                                                    }
                                                    
                                                    $opfeamt = 0 ;
//                                                    $getag = mysqli_query($conn, "SELECT DATE_FORMAT(`date`, '%d-%m-%Y') as opdt, sum(feamt) as opfeamt FROM `actran`
//                                                                     WHERE `date` < '$mfrmdate' and accode = '$agent' ") or die(mysqli_error($conn));
//                                                    $fetag = mysqli_fetch_array($getag);
//                                                    $opfeamt = $fetag['opfeamt'];

                                                    $opagamt = $opfe + $opfeamt;

                                                    Echo "<tr id='boldfont' class='clickable-row2' data-href='agent.php?accode=$agent&mode=edit' data-target='_blank'>";
                                                    Echo "<td></td>";
                                                    Echo "<td>Opening</td>";
                                                    Echo "<td></td>";
                                                    Echo "<td></td>";
                                                    Echo "<td class='text-right'></td>";
                                                    Echo "<td class='text-right'></td>";
                                                    Echo "<td class='text-right'></td>";
                                                    Echo "<td class='text-right'></td>";
                                                    Echo "<td class='text-right'>$opagamt</td>";
                                                    Echo "<td class='text-right'></td>";
                                                    Echo "</tr>";
                                                    $totrmb = $opagamt;
                                                }

                                                while ($pmain = mysqli_fetch_array($getpmain)) {

                                                    $vouch = $pmain['vouchno'];
                                                    $ctr++;
                                                    Echo "<tr id='boldfont' class='clickable-row2' data-href='agentin.php?vouchno=$vouch&mode=edit' data-target='_blank'>";
//                                                    Echo "<td></td>";
                                                    Echo "<td>$pmain[vouchno]</td>";
                                                    Echo "<td>$pmain[mydt]</td>";
//                                                    Echo "<td>$pmain[agent]</td>";
                                                    Echo "<td class='text-right'>$pmain[inr]</td>";
                                                    Echo "<td class='text-right'>$pmain[dollar]</td>";
                                                    Echo "<td class='text-right'>$pmain[roe]</td>";
                                                    Echo "<td class='text-right'>$pmain[dollarrecd]</td>";
                                                    Echo "<td class='text-right'>$pmain[conchgs]</td>";
                                                    Echo "<td class='text-right'>$pmain[rmb]</td>";
                                                    Echo "<td class='text-right'>$pmain[rmbamt]</td>";
                                                    Echo "<td class='text-right'>$pmain[inrtormb]</td>";
//                                                    Echo "<td>$pmain[remark1]  $pmain[remark2]</td>";
                                                    Echo "</tr>";

                                                    $totinr += $pmain['inr'];
                                                    $totdollar += $pmain['dollar'];
                                                    $totdollarrecd += $pmain['dollarrecd'];
                                                    $totchgs += $pmain['conchgs'];
                                                    $totrmb += $pmain['rmbamt'];
                                                }

                                                $colr = "green";
                                                echo "<tr> ";
                                                echo "<td style='color:$colr;' colspan='2' class='text-right'><h5><b>Grand Total</b></h5></td>";
                                                echo "<td align='right' style='color:$colr;' id='font'><h5><b>$totinr</b></h5></td>";
                                                echo "<td align='right' style='color:$colr;' id='font'><h5><b>$totdollar</b></h5></td>";
                                                echo "<td align='right' style='color:$colr;' id='font'><h5><b></b></h5></td>";
                                                echo "<td align='right' style='color:$colr;' id='font'><h5><b>$totdollarrecd</b></h5></td>";
                                                echo "<td align='right' style='color:$colr;' id='font'><h5><b>$totchgs</b></h5></td>";
                                                echo "<td align='right' style='color:$colr;' id='font'><h5><b></b></h5></td>";
                                                echo "<td align='right' style='color:$colr;' id='font'><h5><b>$totrmb</b></h5></td>";
                                                echo "<td align='right' style='color:$colr;' id='font'><h5><b></b></h5></td>";
                                                echo "</tr>";
                                                ?>
                                            </tbody>
                                        </table>
                                    </td>


                                    <?php
                                    $getpmain2 = mysqli_query($conn, "SELECT a.*, DATE_FORMAT(a.`date`, '%d-%m-%Y') as mydt, b.name AS agent FROM `actran` a LEFT JOIN accmast b 
                                        ON a.accode = b.accode WHERE a.`date` >= '$mfrmdate' AND a.`date` <= '$mtodate' and a.feamt > 0 
                                        and a.accode = '$accode' ")or die(mysqli_error($conn));
                                    // print table($getpmain2);
                                    // die();
                                    
                                    ?>
                                    <td width="40%" style="float:right">
                                        <table style="background: white" class="table table-condensed table-hover table-bordered">
                                            <thead>
                                                <tr class="mySearchTr" style="height:45px">
                                                    <th style="width:5%">Voucher</th>
                                                    <th style="width:10%">Date</th>
                                                    <!--<th style="width:18%">Agent</th>-->
                                                    <th style="width:18%">Party</th>
                                                    <th style="width:8%" class="text-right">RMB</th>
                                                    <th style="width:8%" class="text-right">ROE</th>
                                                    <!-- <th style="width:8%" class="text-right">INsR</th> -->
                                                </tr>
                                             
                                            </thead>
                                            <tbody>
                                                <?php
                                                $totoutrmb = $totoutinr = 0 ;
                                                $ctr = $totinr = $totroe = $totdollar = $totdollarrecd = $totchgs = $totinrtormb = 0;
                                                if ($accode != '') {
                                                    $getagm = mysqli_query($conn, "SELECT openfe, dcfe FROM `accmast` WHERE accode = '$accode' ") or die(mysqli_error($conn));
                                                    $fetagm = mysqli_fetch_array($getagm);
                                                    $opfe = $fetagm['openfe'];
                                                    $opfedc = $fetagm['dcfe'];

                                                    if ($opfedc == 'D') {
                                                        $opfe = $opfe * - 1;
                                                    }

                                                    $getag = mysqli_query($conn, "SELECT DATE_FORMAT(`date`, '%d-%m-%Y') as opdt, sum(feamt) as opfeamt FROM `actran`
                                                                     WHERE `date` < '$mfrmdate' and accode = '$accode' ") or die(mysqli_error($conn));
                                                    $fetag = mysqli_fetch_array($getag);
                                                    $opfeamt = $fetag['opfeamt'];

                                                    $opagamt = $opfe + $opfeamt;
                                                    $showopagamt = abs($opagamt);

                                                    Echo "<tr style='height:27px'>";
                                                    Echo "<td></td>";
                                                    Echo "<td></td>";
                                                    Echo "<td></td>";
                                                    Echo "<td></td>";
                                                    Echo "<td></td>";
                                                    // Echo "<td class='text-right'></td>";
                                                    Echo "</tr>";

//                                                    $getagt = mysqli_query($conn, "SELECT sum(feamt) as trfeamt FROM `actran` WHERE feamt < 0 and 
//                                                                     `date` >= '$mfrmdate' and `date` <= '$mtodate' and accode = '$accode' ") or die(mysqli_error($conn));
//                                                    $fetagt = mysqli_fetch_array($getagt);
//                                                    $trfeamt = $fetagt['trfeamt'];
//
//                                                    Echo "<tr id='boldfont' class='' >";
//                                                    Echo "<td></td>";
//                                                    Echo "<td></td>";
//                                                    Echo "<td>In Amount ($mfdt --- $mtdt)</td>";
//                                                    Echo "<td class='text-right'>$trfeamt</td>";
//                                                    Echo "<td></td>";
//                                                    Echo "<td class='text-right'></td>";
//                                                    Echo "</tr>";

                                                    $totoutrmb = $opagamt + $trfeamt;
                                                }
                                                
                                                while ($pmain = mysqli_fetch_array($getpmain2)) {
                                                    $vouchno = $pmain['vouchno'];
                                                    $source = $pmain['source'];
//                                browse($vouchno);
//browse($source);
                                                    if ($source == 'FRAG') {
                                                        $url = "agentout.php?vouchno=$vouchno&mode=edit";
                                                        $url2 = "agentout_fr.php?vouchno=$vouchno";
                                                        $desc = "Payment From Agent";

                                                        $getcash = mysqli_query($conn, "Select party as accode from `agentout` where `vouchno`='$vouchno' ") or die(mysqli_error($conn));
                                                        $fetcash = mysqli_fetch_array($getcash);
                                                        $taccode = $fetcash['accode'];

                                                        $getacc = mysqli_query($conn, "Select name from `accmast` where `accode`='$taccode' ") or die(mysqli_error($conn));
                                                        $fetacc = mysqli_fetch_array($getacc);
                                                        $desc = $fetacc['name'];
                                                    }

                                                    if ($source == 'CARR') {
                                                        $url = "carrierfees.php?vouchno=$vouchno&mode=edit";
                                                        $url2 = "";
                                                        $desc = "Carrier Fees";

                                                        $getcash = mysqli_query($conn, "Select party as accode from `carrierfees` where `vouchno`='$vouchno' ") or die(mysqli_error($conn));
                                                        $fetcash = mysqli_fetch_array($getcash);
                                                        $taccode = $fetcash['accode'];

                                                        $getacc = mysqli_query($conn, "Select name from `accmast` where `accode`='$taccode' ") or die(mysqli_error($conn));
                                                        $fetacc = mysqli_fetch_array($getacc);
                                                        $desc = $fetacc['name'];
                                                    }

                                                    $ctr++;
                                                    Echo "<tr id='boldfont' class='clickable-row' data-href='$url' data-target='_blank'>";
                                                    Echo "<td>$source - $pmain[vouchno]</td>";
                                                    Echo "<td>$pmain[mydt]</td>";
//                                                    Echo "<td>$pmain[agent]</td>";
                                                    Echo "<td>$desc</td>";
                                                    Echo "<td class='text-right'>$pmain[feamt]</td>";
                                                    Echo "<td class='text-right'>" . number_format($pmain['roe'],2)."</td>";
                                                    // Echo "<td class='text-right'>$pmain[amount]</td>";
                                                    Echo "</tr>";

                                                    $totoutrmb += $pmain['feamt'];
                                                    $totoutinr += $pmain['amount'];
                                                }

                                                $colr = "green";
                                                echo "<tr> ";
                                                echo "<td style='color:$colr;' colspan='3' class='text-right'><h5><b>Grand Total</b></h5></td>";
                                                echo "<td align='right' style='color:$colr;' id='font'><h5><b>$totoutrmb</b></h5></td>";
                                                echo "<td align='right' style='color:$colr;' id='font'><h5><b></b></h5></td>";
                                                // echo "<td align='right' style='color:$colr;' id='font'><h5><b>$totoutinr</b></h5></td>";
                                                echo "</tr>";

                                                $balrmb = abs($totrmb) - abs($totoutrmb);
                                                
                                                echo "<tr>";
                                                echo "<td style='color:$colr;' colspan='3' class='text-right'><h5><b>Balance</b></h5></td>";
                                                echo "<td align='right' style='color:$colr;' id='font'><h5><b>$balrmb</b></h5></td>";
                                                echo "</tr>";
                                                
                                                ?>
                                            </tbody>
                                        </table>
                                    </td>
                                </tr>

                            </table>
                        </div>
                    </div>
                </div>
            </div>

        </div>
    </div>

    <?php include("includes/linksfoot.php");
    ?>
    <div class="modal fade tradeModal" tabindex="-1" role="dialog" aria-labelledby="myLargeModalLabel">
        <div class="modal-dialog modal-lg">
            <div class="modal-content" style="width:50%">
                <div class="modal-header">
                    <button class="close" data-dismiss="modal"><span>&times;</span></button>
                    <h4 class="modal-title">TRADING ENTRY</h4>
                </div>
                <div class="modal-body">

                </div>
                <div class="modal-footer"></div>
            </div>
        </div>
    </div>
    <input type="hidden" name="para" class="para">
    <div class="modal fade depModal" tabindex="-1" role="dialog" aria-labelledby="myLargeModalLabel">
        <div class="modal-dialog modal-lg">
            <div class="modal-content" style="width:80%">
                <div class="modal-header">
                    <button class="close" data-dismiss="modal"><span>&times;</span></button>
                    <h4 class="modal-title" id="myLargeModalLabel1">Agent In</h4>
                    <h4 class="modal-title" id="myLargeModalLabel2">Agent Out</h4>
                </div>
                <div class="modal-body">
                    <div class="row">
                        <div class="col-lg-4 col-md-1 col-sm-4 col-xs-4 text-right">
                            <label class="label-control">Date</label>
                        </div>
                        <div class="col-lg-4 col-md-3 col-sm-8 col-xs-8 pad"> 
                            <input type="date" name="withdate"   placeholder="date" value="<?php echo date('Y-m-d'); ?>" class="form-control withdate" style="height: 30px;" autofocus="autofocus">
                        </div>
                    </div>

                    <div class="row deptrd">
                        <div class="col-lg-4 col-md-1 col-sm-4 col-xs-4 text-right">
                            <label class="label-control">Cash / Bank</label>
                        </div>
                        <div class="col-lg-6 col-md-6 col-sm-8 col-xs-8 pad"> 
                            <select id="bankname" name="bankname"  class="form-control select2 bankname" style="width:100%">
                                <option value=""></option>
                                <?php
                                $mown1 = mysqli_query($conn, "SELECT accode, `name` FROM `accmast` where `grpcode` = '002' or grpcode = '001'") or die(mysqli_error($conn));
                                while ($trow1 = mysqli_fetch_array($mown1)) {
                                    echo "<option value='$trow1[accode]'>$trow1[name]</option>";
                                }
                                ?>
                            </select>
                        </div>
                    </div>
                    <div class="row deptrd">
                        <div class="col-lg-4 col-md-3 col-sm-3 col-xs-3 text-right pad">
                            <label class="label-control marg">INR</label>
                        </div>
                        <div class="col-lg-2 col-md-2 col-sm-2 col-xs-2 pad">
                            <input type="text" name="inr" id="inr" value="" class="form-control inr text-right">
                        </div>
                    </div>

                    <div class="row deptrd">
                        <div class="col-lg-4 col-md-3 col-sm-3 col-xs-3 text-right pad">
                            <label class="label-control marg">Dollar </label>
                        </div>
                        <div class="col-lg-2 col-md-2 col-sm-2 col-xs-2 pad">
                            <input type="text" name="dollar" value="" class="form-control dollar text-right" style="color:red;font:bolder">
                        </div>
                        <div class="col-lg-3 col-md-3 col-sm-3 col-xs-3 text-right pad">
                            <label class="label-control marg">Conversion INR To Dollar</label>
                        </div>
                        <div class="col-lg-2 col-md-2 col-sm-2 col-xs-2 pad">
                            <input type="text" name="roe" id="roe" value="" style="color:blue;" class="form-control roe text-right" tabindex="-1" readonly>
                        </div>
                    </div>

                    <div class="row deptrd">
                        <div class="col-lg-4 col-md-3 col-sm-3 col-xs-3 text-right pad">
                            <label class="label-control marg">Dollar Received </label>
                        </div>
                        <div class="col-lg-2 col-md-2 col-sm-2 col-xs-2 pad">
                            <input type="text" name="dollarrecd" value="" class="form-control dollarrecd text-right" style="font:bolder">
                        </div>
                    </div>

                    <div class="row deptrd">
                        <div class="col-lg-4 col-md-3 col-sm-3 col-xs-3 text-right pad">
                            <label class="label-control marg">Conversion Charges (USD)</label>
                        </div>
                        <div class="col-lg-2 col-md-2 col-sm-2 col-xs-2 pad">
                            <input type="text" name="conchgs" value="" class="form-control conchgs text-right" style="font:bolder" tabindex="-1" readonly>
                        </div>
                    </div>       

                    <div class="row deptrd">
                        <div class="col-lg-4 col-md-3 col-sm-3 col-xs-3 text-right pad">
                            <label class="label-control marg">Conversion Dollar To RMB</label>
                        </div>
                        <div class="col-lg-2 col-md-2 col-sm-2 col-xs-2 pad">
                            <input type="text" name="rmb" value="" class="form-control rmb text-right">
                        </div>
                    </div>

                    <div class="row deptrd">
                        <div class="col-lg-4 col-md-3 col-sm-3 col-xs-3 text-right pad">
                            <label class="label-control marg">RMB Amount</label>
                        </div>
                        <div class="col-lg-2 col-md-2 col-sm-2 col-xs-2 pad">
                            <input type="text" name="rmbamt" value="" class="form-control rmbamt text-right" style="color:red;font:bolder">
                        </div>
                        <div class="col-lg-3 col-md-3 col-sm-3 col-xs-3 text-right pad">
                            <label class="label-control marg">INR To RMB</label>
                        </div>
                        <div class="col-lg-2 col-md-2 col-sm-2 col-xs-2 pad">
                            <input type="text" name="inrtormb" value="" class="form-control inrtormb text-right" style="color:#99582a;font:bolder" tabindex="-1" readonly>
                        </div>
                    </div>



                    <div class="row wittrd">
                        <div class="col-lg-4 col-md-3 col-sm-3 col-xs-3 text-right pad">
                            <label class="label-control marg">Party</label>
                        </div>
                        <div class="col-lg-6 col-md-6 col-sm-7 col-xs-7 pad">
                            <select class="form-control select2" name="party" id="party" style='width:100%'>
                                <option value=""></option>
                                <?php
                                $mown = mysqli_query($conn, "SELECT accode, `name` FROM `accmast` where `grpcode` = '010' ") or die(mysqli_error($conn));
                                while ($trow = mysqli_fetch_array($mown)) {
                                    echo "<option value='$trow[accode]'>$trow[name]</option>";
                                }
                                ?>
                            </select>
                        </div>
                        <!--                        <div class="col-lg-1 col-md-3 col-sm-3 col-xs-3 text-right pad">
                                                    <label style="color:#26A69A"label-control marg ><b id="bankamt"></b></label>
                                                </div>-->
                    </div>

                    <div class="row wittrd">
                        <div class="col-lg-4 col-md-3 col-sm-3 col-xs-3 text-right pad">
                            <label class="label-control marg">RMB</label>
                        </div>
                        <div class="col-lg-2 col-md-2 col-sm-2 col-xs-2 pad">
                            <input type="text" name="rmb" value="0" class="form-control  drmb text-right">                                    
                        </div>
                    </div>
                    <div class="row wittrd">
                        <div class="col-lg-4 col-md-3 col-sm-3 col-xs-3 text-right pad">
                            <label class="label-control marg">ROE</label>
                        </div>
                        <div class="col-lg-2 col-md-2 col-sm-2 col-xs-2 pad">
                            <input type="text" name="roe" value="0" class="form-control  droe text-right">                                    
                        </div>
                    </div>
                    <!-- <div class="row wittrd">
                        <div class="col-lg-4 col-md-3 col-sm-3 col-xs-3 text-right pad">
                            <label class="label-control marg">INR</label>
                        </div>
                        <div class="col-lg-2 col-md-2 col-sm-2 col-xs-2 pad">
                            <input type="text" name="inr" value="0" class="form-control  dinr text-right" style="color:red;" readonly>                                    
                        </div>
                    </div> -->
                    <div class="row">
                        <div class="col-xs-12 text-right search-action-bar">
                            <input type="button"  class="btn btn-primary savdep" value="SAVE">
                            <!--<input type="button"  class="btn btn-primary snext" value="Next">-->
                        </div>
                    </div>
                    <input type="text" name="agent" value="<?php echo $accode; ?>" class="form-control agent text-right" style="width:0px" tabindex="-1" readonly>
                </div>
                <div class="modal-footer"></div>
            </div>
        </div>
    </div>
</body>
</html>