<?php

require_once('config.php');

function f_syn_mst($json,$php_file,$IP,$LOGINID){	

	global $syn_conn;
	
	$sql_insert_syn_mst = "	INSERT syn_mst 
								(	site_cd ,			syn_mst_module,		syn_mst_doc_no,		syn_mst_action, 
									syn_mst_status,		syn_mst_desc,		syn_mst_dvc_id ,	syn_mst_json,
									syn_mst_mobile_ver,	syn_mst_api_ver,	audit_user,			audit_date ) 
						VALUES 
								(	?,					?,					?,					?,
									?,					?,					?,					?,				
									?,					?,					?,					GetDate())";

	$params_insert_syn_mst = array($site_cd,			"Work Order",		$wko_mst_wo_no,		"Upload",
									"Fail",				"Fail this Work Order No:'".$wko_mst_wo_no."'",$dvc_id,$data,
									 $sys_ver_mobile_ver,$api_ver,			$LOGINID,);
		$stmt_insert_syn_mst = sqlsrv_query( $syn_conn, $sql_insert_syn_mst,$params_insert_syn_mst);	
		if( !$stmt_insert_syn_mst ) {
		$error_message = "Error (INSERT Table syn_mst)";
		returnError($error_message);
		die( print_r( sqlsrv_errors(), true));
			
		}
		sqlsrv_free_stmt( $stmt_insert_syn_mst);
 

}

?>