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

$formname = "Closing Stock";
$file = "closestk.php";

$admin = $_SESSION["admin_" . $dbname];
$zdb = $_SESSION["zdbyear_" . $dbname];
$myyear = $_SESSION[$myyear];
mysqli_select_db($conn, $zdb);

$result = mysqli_query($conn, "SELECT currbal FROM accmast where accode = '23' ") or die(mysqli_error($conn));
$get = mysqli_fetch_array($result);
$currbal = $get['currbal'];

if (isset($_POST["submit"])) {
    $a = 1;
    
    $grval = $_POST['currbal'];

    if ($a == 1) {
        $ctr = 0;

        mysqli_query($conn, "update accmast set currbal = '$grval', currdc = 'D' WHERE accode = 23 ") or die(mysqli_error($conn));
        updmess();
        header("refresh: 1; $file?$keyfld=$mvouch&mode=edit");
    }
}

include("includes/linkshead.php");
?>
</head>
<body>
    <form name="" class="validation" id="form" action="" method="post">
        <div class="col-lg-5 col-md-5 col-sm-12 col-xs-12  pad">

            <div class="panel panel-default">
                <div class="panel-heading">
                    <h3 class="panel-title"><?php Echo $formname; ?></h3>

                </div>
                <div class="panel-body">
                    <div class="row pad">
                        <div class="col-g-3 col-md-3 col-sm-3 col-xs-3 text-right">         
                            <label class="label-control marg"><?php Echo $formname; ?></label>
                        </div>
                        <div class="col-g-3 col-md-3 col-sm-3 col-xs-3 pad">         
                            <input type="number" step="any" name="currbal" value="<?php echo $currbal ?>" class="form-control text-right">
                        </div>
<!--                        <div class="col-g-2 col-md-2 col-sm-3 col-xs-3 pad">         
                            <select class="form-control" name="curdc">
                                <option value='D'<?php if ($addflag != 1)   {echo "selected='selected'";}?> >D</option>
                                <option value='C'<?php if ($addflag != 1)   {echo "selected='selected'";}?> >C</option>
                            </select>
                        </div>-->
                    </div>

                    <div style="overflow: auto; ">
                        <table class="table-condensed" style="margin: 0 auto;">
                            <tr>
                                <td class=" buttonform tooltip-bottom" id="ssubmit" style="display: <? Echo $savedisabled ?>" data-toggle="tooltip" data-placement="bottom" title="" data-original-title="Save Record">
                                    <button id='submit' type='submit' name='submit' value='<?php echo ($addflag == 0) ? "Update" : "Save"; ?>' class="btn btn-pad btn-square " style="background-color:#008D4C; ">
                                        <i class="fa fa-check" style="color:#ffffff"></i>
                                    </button>
                                </td>
                                <td class=" buttonform tooltip-bottom" id="hexit" style="display: <? Echo $exitdisabled ?>" data-toggle="tooltip" data-placement="bottom" title="" data-original-title="Exit">
                                    <button id='exit' type="button" class="btn btn-pad btn-square " style="background-color:#cccccc; "  onClick="window.location.href = 'default.php'">
                                        <i class="fa fa-power-off" style="color:red"></i>
                                    </button>
                                </td>
                            </tr>
                        </table>
                    </div>
                </div>
            </div>
        </div>
    </form>
    <?php include("includes/linksfoot.php"); ?>
</body>
</html>



