<?php 
include("config.php"); 



$blquery = mysqli_query($conn,"select * from vendor_master order by id");
$bl = mysqli_num_rows($blquery);
while ($rows = mysqli_fetch_array($blquery)) {
	$data[] = $rows;
}
foreach ($data as $key => $datas) {
   $chk_agent_ac = "SELECT * FROM  `act_master` WHERE `ac_name` = '".$datas['name']."'";
   $chk_agent_ac_query = mysqli_query($conn, $chk_agent_ac);
   if(mysqli_num_rows($chk_agent_ac_query) <= 0){
      $act_code      = accountCode($conn);
      $trans = mysqli_query($conn, "INSERT INTO `act_master`(`act_code`, `ac_name`, `dr_open_bal`, `cr_open_bal`, `account_group`, `party_code`, `branch_id`, `company_id`, `created_id`, `created_datetime`, `updated_id`, `updated_datetime`)  VALUES ('".$act_code."','".$datas['name']."','0.00','0.00','SUNDRY DEBTORS','NULL','1','1','".$created_id."','".$created_datetime."','".$updated_id."','".$updated_datetime."')");
   }
}

$blquery = mysqli_query($conn,"select * from truck_mst where length(o_name) > 1 order by id");
$bl = mysqli_num_rows($blquery);
while ($rows = mysqli_fetch_array($blquery)) {
	$data[] = $rows;
}
foreach ($data as $key => $datas) {
   $chk_agent_ac = "SELECT * FROM  `act_master` WHERE `ac_name` = '".$datas['o_name']."'";
   $chk_agent_ac_query = mysqli_query($conn, $chk_agent_ac);
   if(mysqli_num_rows($chk_agent_ac_query) <= 0){
      $act_code      = accountCode($conn);
      $trans = mysqli_query($conn, "INSERT INTO `act_master`(`act_code`, `ac_name`, `dr_open_bal`, `cr_open_bal`, `account_group`, `party_code`, `branch_id`, `company_id`, `created_id`, `created_datetime`, `updated_id`, `updated_datetime`)  VALUES ('".$act_code."','".$datas['o_name']."','0.00','0.00','SUNDRY CREDITORS','NULL','".$branch_id."','".$company_id."','".$created_id."','".$created_datetime."','".$updated_id."','".$updated_datetime."')");
   }
}
?>


