<?php

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

$zdb = $_SESSION["zdbyear_$dbname"];
mysqli_select_db($conn, $zdb);

$maindb = 'accmast';
$trandb = 'actran';

$result = mysqli_query($conn, "SELECT a.init,a.bankinit,a.accode,b.vouchno FROM $maindb a, $trandb b  WHERE a.`accode`= b.accode and b.source = 'BR' and a.grpcode ='001'") or die(mysqli_error($conn));
$getnum = mysqli_num_rows($result);
while ($get = mysqli_fetch_array($result)) {
    $vouchno = $get["vouchno"];
    $init = $get["init"];
    $bankinit = $get["bankinit"];
    $accode = $get["accode"];

    mysqli_query($conn, "Update $trandb set init='$init', bankinit='$bankinit' where vouchno = '$vouchno' and source = 'BR'") or die(mysqli_error($conn));
}
?>
