<?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 = $_REQUEST["maindb"];
$source = $_REQUEST["source"];
$myyear = $_SESSION[$myyear];


browse($maindb);
browse($source);

$result = mysqli_query($conn, "SELECT party,vouchno FROM `$maindb` WHERE `vouchno`!= '' order by vouchno") or die(mysqli_error($conn));

$getnum = mysqli_num_rows($result);
browse($getnum);
while ($get = mysqli_fetch_array($result)) {
    $cgstamt = 0;
    $igstamt = 0;

    $vouchno = $get["vouchno"];
    $party = $get["party"];
    
    mysqli_query($conn, "update `transacn` set `accode`='$party' where vouchno = '$vouchno' and source = '$source'") or die(mysqli_error($conn));
}
browse("Success");
?>
