<?php 
$conn = mysqli_connect("localhost","root","admin@2411","attrans_wr");
mysqli_query($conn,"set sql_mode = '' ") or die(mysqli_error());
require 'function.php';
$select = mysqli_query($conn, "SELECT * FROM `temp_vendor`");
$detail = array();
while ($row = mysqli_fetch_assoc($select)) {
	$detail[] = $row;
}

foreach ($detail as $key => $details) {
	$act_code = accountCode($conn);
	$vcode    = vendorCode($conn);
	
	$insert = mysqli_query($conn, "INSERT INTO `vendor_master`(`code`, `type`, `name`, `p_name`, `address`, `p_address`, `country`, `state`, `district`, `city`, `pincode`, `contact`, `mobile`, `email`, `pan`, `gstin`, `group_id`, `file_img`, `proprietor`, `contact_person`, `designation`, `con_per_mobile`, `con_per_email`, `contact_person1`, `designation1`, `con_per_mobile1`, `con_per_email1`, `contact_person2`, `designation2`, `con_per_mobile2`, `con_per_email2`, `status`, `branch_id`, `company_id`, `created_id`, `created_datetime`, `updated_id`, `updated_datetime`)VALUES ('".$vcode."','V','".$details['name']."','".$details['name']."','".$details['address']."','".$details['address']."','".$details['country']."','".$details['state']."','".$details['dist']."','".$details['city']."','".$details['pincode']."','','','','".$details['panno']."','".$details['gst']."','0','','','','','','','','','','','','','','','0','1','1','1','','1','')");

	$act = mysqli_query($conn, "INSERT INTO `act_master`(`act_code`, `ac_name`, `dr_open_bal`, `cr_open_bal`, `account_group`, `party_code`, `mode`, `branch_id`, `company_id`, `created_id`, `created_datetime`, `updated_id`, `updated_datetime`) VALUES ('".$act_code."','".$details['name']."','','','SUNDRY DEBTORS','".$vcode."','','1','1','1','','1','')");
}
?>