\documentclass[openany, 12pt]{book} 
\usepackage{graphicx} % inserting images
\usepackage{color}
\usepackage{paralist}
\usepackage{subfig}
\usepackage{amsmath}
\usepackage{amsthm}
\usepackage{amsfonts}
\usepackage{amssymb}
\usepackage{mdwlist}
\usepackage{lscape}
\usepackage{setspace} 
\usepackage{tocbibind}
\usepackage{makeidx}
\usepackage{fancyhdr} 
\usepackage{subfigure}
\usepackage{mathtools}
\usepackage{fancyvrb} 
\usepackage{algorithm}
\usepackage{cite}
\usepackage[colorlinks,linkcolor=blue,citecolor=magenta]{hyperref}
\usepackage{relsize}
\usepackage[top=30mm, bottom=25mm, left=25mm, right=35mm]{geometry}
\usepackage{xcolor}
\usepackage[utf8]{inputenc}
\usepackage[colorlinks,linkcolor=black,citecolor=black]{hyperref}
\usepackage[top=50mm, bottom=45mm, left=27mm, right=35mm]{geometry} 
\usepackage{zref-perpage}
\usepackage{longtable}
\usepackage[usenames,dvipsnames]{color,xcolor} 
\usepackage{listings}
\usepackage{hyperref}


\usepackage{mdframed}
\usepackage{lipsum}

\usepackage{amsthm} 
\usepackage{shadethm}

\usepackage[usenames,dvipsnames]{color,xcolor} 
\usepackage{tikz,times}
\usepackage{xparse}
\usepackage{ifthen}
\usepackage{pifont}
\usepackage{xepersian}


\settextfont{Yas}
\makeatletter
\def\lstlistingname{برنامه}‮
\makeatother

\newshadetheorem{thm}{نکته}
\definecolor{shadethmcolor}{HTML}{F0F0F0}
\setlength{\shadeboxrule}{.5pt}
\setlength\shadeboxsep{6pt}  
\setlength\shadedtextwidth{\dimexpr\textwidth-5\shadeboxsep\relax}

%
%\newmdtheoremenv[
%  hidealllines=true,
%  innerleftmargin=8pt,%
%  innerrightmargin=8pt,%
%  innertopmargin=12pt,%
%  innerbottommargin=12pt,%
%  backgroundcolor=blue!10,%
%  skipbelow=\baselineskip,%
%  skipabove=\baselineskip]{remarking}{نکته}[]




\zmakeperpage{footnote}







\setfootnoteLR
\graphicspath{{images/}}
\pagestyle{fancy}
\cfoot{}
\lhead{\thepage}
\makeindex


%---listings colors 
\definecolor{codegreen}{rgb}{0,0.6,0}
\definecolor{codegray}{rgb}{0.5,0.5,0.5}
\definecolor{codepurple}{rgb}{0.58,0,0.82}
\definecolor{backcolour}{rgb}{0.95,0.95,0.92}
%---listings colors 
 
\lstdefinestyle{mystyle}{
	tabsize=4,
	breaklines=true,
	breakatwhitespace=true,
	basicstyle=\footnotesize\ttfamily,
	numberstyle=\footnotesize\ttfamily,
	aboveskip=\baselineskip,
	captionpos=b,
	columns=fullflexible,
	showstringspaces=false,
	extendedchars=true,
	breaklines=true,
	showtabs=false,
	showspaces=false,
	showstringspaces=false,
	identifierstyle=\ttfamily,
    backgroundcolor=\color{backcolour},   
    commentstyle=\scriptsize\ttfamily,
    numberstyle=\tiny\color{codegray},
    stringstyle=\bfseries\ttfamily,
    basicstyle=\LSTfont,
    breakatwhitespace=false,         
    breaklines=true,                 
    captionpos=b,                    
    keepspaces=true,                 
    numbers=none,                    
    numbersep=5pt,                  
    showspaces=false,                
    showstringspaces=false,
    showtabs=false,                  
    tabsize=2,
    escapechar=|,
    %frame=trBL
    basicstyle=\footnotesize\ttfamily,
	keywordstyle=\bfseries\ttfamily
}
\setlatinmonofont[ExternalLocation,BoldFont={cmuntb},ItalicFont={cmunti},BoldItalicFont={cmuntx}]{cmuntt} 
\setlatinmonofont[ExternalLocation,BoldFont={pcrb8a},ItalicFont={pcri8a},BoldItalicFont={pcrbi8a}]{pcrr8a}

\lstset{style=mystyle}
%\captionsetup[lstlisting]{singlelinecheck=false, labelfont={blue}, textfont={blue}}





\setlatintextfont[ExternalLocation,BoldFont={lmroman10-bold},BoldItalicFont={lmroman10-bolditalic},ItalicFont={lmroman10-italic}]{lmroman10-regular}
\setlatintextfont[Scale=0.8]{Tahoma}


\setlength{\baselineskip}{1.6\baselineskip} 

\graphicspath{{images/}}
\pagestyle{fancy}
\cfoot{}
\lhead{\thepage}
\makeindex

\setlength{\baselineskip}{5.3\baselineskip}

\makeatletter 

\setdigitfont[Scale=1.1]{ParsiDigits}
\settextfont[Scale=1.2]{XB Yas}
\defpersianfont\nastaliq[Scale=1.6]{IranNastaliq}
\defpersianfont\persiantitle[Scale=1.6]{XB Yas}
\defpersianfont\authername[Scale=1.3]{XB Yas}



\newcommand{\handBS}{\noindent\textcolor{ForestGreen}{\Huge\ding{45}}}
\NewDocumentEnvironment{noted}{g g}{
	\tikzstyle{mybox1} = [draw=YellowGreen, fill=green!15,very thick, rectangle, rounded corners, inner sep=10pt, inner ysep=20pt]
	\tikzstyle{fancytitle1} =[fill=YellowGreen, text=white]
	\tikzstyle{fancytitle2} =[fill=YellowGreen!5, text=white]
	\tikzstyle{fancytitle3} =[fill=white, text=white]
	\begin{center}
		\begin{tikzpicture}
			\node [mybox1] (box)\bgroup
			\IfValueTF{#2}{
				\IfFileExists{#2}{\begin{minipage}{.85\textwidth}}{\begin{minipage}{.93\textwidth}}
			}{%%
				\IfFileExists{mnote.png}{\begin{minipage}{.85\textwidth}}{\begin{minipage}{.93\textwidth}}
			}%%
			\baselineskip=.95cm
				\begin{RTL}
}{%
				\end{RTL}
			\end{minipage}
			\egroup;
			\IfValueTF{#1}{\node[fancytitle1, left=10pt] at (box.north east) {\hboxR{#1}};}{\node[fancytitle1, left=10pt] at (box.north east) {\hboxR{نکته}};}%
			\IfValueTF{#2}{
				\IfFileExists{#2}
				{\node[fancytitle3, left=3pt,   rounded corners] at (box.west) {\includegraphics[width=.07\textwidth]{#2}}; }
				{\node[fancytitle2,  rounded corners] at (box.west) {\handBS};}			
			}{%%
				\IfFileExists{mnote.png}
				{\node[fancytitle3, left=3pt,   rounded corners] at (box.west) {\includegraphics[width=.07\textwidth]{mnote}}; }
				{\node[fancytitle2,  rounded corners] at (box.west) {\handBS};}
			}%%
		\end{tikzpicture}
	\end{center}
}%

\begin{document} 


\begin{LTR}
\lstset{language=JAVA, inputencoding={utf8}}
\begin{lstlisting}[texcl,caption=\rl{اس کیو ال}]
//\rl{هدر ستونها را در ابزار نمایش میدهد} 
sqlite>.headers on
\end{lstlisting}
\end{LTR}


\begin{noted} 
شهر مردگان، 
\end{noted}



\end{document} 