<?php

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

$maindb = 'salemain';
$trandb = 'saletran';

$accdb = 'actran';
$stkdb = 'transacn';

$trandbexist = 1;
$source = "SL  ";

$keyfld = "vouchno";
$myyear = $_SESSION["tit_" . $dbname];

date_default_timezone_set('Asia/Kolkata');
$time = date('H:i:s');

$usertype = $_SESSION["usertype"];
$username = $_SESSION["username_" . $dbname];

//browse($username);
$formname = 'Sale';

$admin = $_SESSION["admin_" . $dbname];
$zdb = $_SESSION["zdbyear_" . $dbname];

mysqli_select_db($conn, $zdb);

$getmain = mysqli_query($conn, "Select * from `product` order by code") or die(mysqli_error($conn));
while ($fetmain = mysqli_fetch_array($getmain)) {
    $code = $fetmain["code"];
    $cost = $fetmain["cost"];

    
    mysqli_query($conn, "update `saletran` set cost = '$cost' where itemcode = '$code'") or die(mysqli_error($conn));
}
echo "Success";
