Bill.php 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153
  1. <?php include_once('pdqconnect.inc'); ?>
  2. <html>
  3. <head>
  4. <script src="jquery.min.js"></script>
  5. <script>$(document).ready(function(){ // jquery stuff in here
  6. Reload();
  7. setInterval(function(){
  8. if(dontreload==0){
  9. Reload();
  10. }
  11. },60000); // 1000 = 1 second
  12. $( "#messages" ).focusout(function() {
  13. var newData=$(this).html();
  14. billsMessage(newData);
  15. $(this).attr("contenteditable", "false");
  16. $(this).css("background-color", "orange");
  17. })
  18. $( "#messages" ).dblclick(function() {
  19. dontreload=1;
  20. globalOldData = $(this).html();
  21. if($(this).attr("contenteditable")=="true"){
  22. return;
  23. } else {
  24. $(this).css("background-color", "yellow");
  25. $(this).attr("contenteditable", "true");
  26. }
  27. })
  28. })</script>
  29. <script>
  30. function billsMessage(newmessage){
  31. var sendMe = 'newmessage=' + encodeURIComponent(newmessage);
  32. $.post("bin/PDQmessage.php",sendMe,
  33. function(data,status){
  34. dontreload=0;
  35. if(data=='Success' ){
  36. $("#messages").css("background-color", '');
  37. } else {
  38. $("#messages").css("background-color", 'red');
  39. alert("error: " + data);
  40. }
  41. }
  42. );
  43. }
  44. var globalOldData;
  45. var dontreload=0;
  46. function sendUpdates(subKID, column, current, callingObject){
  47. var sendMe = "subKID=" + encodeURIComponent(subKID) + "&column=" + encodeURIComponent(column)+ "&current=" + encodeURIComponent(current);
  48. $.post("bin/PDQacknowledge.php",sendMe,
  49. function(data,status){
  50. dontreload=0;
  51. if(data=="Success" ){
  52. $(callingObject).html("");
  53. $(callingObject).css("background-color", "");
  54. Reload();
  55. } else {
  56. $(callingObject).css("background-color", "red");
  57. alert("error: " + data);
  58. }
  59. }
  60. );
  61. }
  62. function Reload(){
  63. $.get( "bin/billstable.php", function( data ) {
  64. $( "#billstable" ).html( data );
  65. $( ".updatableDiv" ).dblclick(function() {
  66. //alert('wh');
  67. //dontreload=1;
  68. globalOldData = $(this).html();
  69. var subKID=$(this).attr("data-subkid");
  70. var column=$(this).attr("data-column");
  71. sendUpdates(subKID, column, $(this).html(), this);
  72. $(this).css("background-color", "orange");
  73. })
  74. // put current time in caption
  75. var currentdate = new Date();
  76. var datetime = "Last Sync: " + (currentdate.getMonth()+1) + "/" + currentdate.getDate() + " : " +currentdate.getHours() + ":" + currentdate.getMinutes();
  77. $("#tableCap").html(datetime);
  78. $("#tableCap").css("font-size","26pt");
  79. });
  80. }
  81. </script>
  82. <style>
  83. #messages{
  84. font-size:24px;
  85. min-height:20px;
  86. border:1px solid;
  87. }
  88. body{
  89. margin-left:5%;
  90. }
  91. .smaller{
  92. font-size:18pt;
  93. }
  94. .right{
  95. text-align:right;
  96. }
  97. .center{
  98. text-align:center;
  99. }
  100. .tc{
  101. display:table-cell;
  102. padding-left:25px;
  103. font-size:16pt;
  104. }
  105. th{
  106. padding-left:25px;
  107. padding-right:25px;
  108. font-size:30pt;
  109. }
  110. td{
  111. padding-left:25px;
  112. padding-right:25px;
  113. font-size:30pt;
  114. }
  115. tr:hover{
  116. background-color:rgba(49,13,84,.08);
  117. }
  118. .colorRow{
  119. background-color:rgba(49,13,84,.08);
  120. }
  121. .rjust{
  122. text-align:right;
  123. }
  124. .smalltext{
  125. font-size:10pt;
  126. }
  127. </style>
  128. </head>
  129. <body>
  130. <div id='messages' contenteditable="False" >
  131. <?php
  132. $sql = "select message from PDQMessage where PDQMid=0";
  133. $rs=mysqli_query($mydb,$sql) or die(mysqli_error());
  134. $row=mysqli_fetch_assoc($rs);
  135. echo $row['message'];
  136. ?>
  137. </div>
  138. <div id='billstable'>
  139. </div>
  140. </body>
  141. </html>