function new_crm($estabelecimento,$nome,$whatsapp,$email,$tipo,$documento,$estado,$cidade,$cep,$numero,$bairro,$rua,$contato,$nascimento,$descricao) {



		global $db_con;

		global $_SESSION;



		if( mysqli_query( $db_con, "INSERT INTO crm (estabelecimento_id, nome, celular, email, tipo, doc, estado,cidade,cep,numero,bairro,rua,contato,nascimento,obs) VALUES ('$estabelecimento','$nome','$whatsapp','$email','$tipo','$documento','$estado','$cidade','$cep','$numero','$bairro','$rua','$contato','$nascimento','$descricao');") ) {
			if( $_SESSION['user']['level'] == "1" ) {

					$log_user_tipo = "O Administrador";

				}

				if( $_SESSION['user']['level'] == "2" ) {

					$log_user_tipo = "A Loja";

				}
			return true;	

		} else {

			return false;
		}

	}

	function edit_crm( $id,$estabelecimento,$nome,$whatsapp,$email,$tipo,$documento,$estado,$cidade,$cep,$numero,$bairro,$rua,$contato,$nascimento,$descricao) {



		global $db_con;

		global $_SESSION;

		$sql="UPDATE  crm SET estabelecimento_id='$estabelecimento',nome='$nome', celular='$whatsapp', email='$email', tipo='$tipo', doc='$documento',estado='$estado',cidade='$cidade',cep='$cep',numero='$numero',bairro='$bairro',rua='$rua',contato='$contato',nascimento='$nascimento',obs='$descricao' WHERE id='$id'";

		if( mysqli_query( $db_con,$sql ) ) {

				if( $_SESSION['user']['level'] == "1" ) {

					$log_user_tipo = "O Administrador";

				}

				if( $_SESSION['user']['level'] == "2" ) {

					$log_user_tipo = "A Loja";

				}		



			return true;

		

		} else {



			return false;



		}

	}

	function delete_crm( $id ) {



		global $db_con;



		if( mysqli_query( $db_con, "DELETE FROM crm WHERE id = '$id'") ) {



			
				if( $_SESSION['user']['level'] == "1" ) {

					$log_user_tipo = "O Administrador";

				}

				if( $_SESSION['user']['level'] == "2" ) {

					$log_user_tipo = "A Loja";

				}

		

			return true;



		} else {



			return false;



		}

	}