浏览代码

old site as is

Bernn 1 周之前
当前提交
4cb0da8167
共有 8 个文件被更改,包括 540 次插入0 次删除
  1. 153 0
      Bill.php
  2. 30 0
      ICGstable.php
  3. 177 0
      PDQ.php
  4. 12 0
      PDQAddOne.php
  5. 96 0
      PDQUpdates.php
  6. 33 0
      PDQacknowledge.php
  7. 10 0
      PDQmessage.php
  8. 29 0
      billstable.php

+ 153 - 0
Bill.php

@@ -0,0 +1,153 @@
+<?php include_once('pdqconnect.inc'); ?>
+<html>
+<head>
+<script src="jquery.min.js"></script>
+<script>$(document).ready(function(){   // jquery stuff in here
+	Reload();
+	setInterval(function(){
+		if(dontreload==0){
+			Reload();
+		}
+	},60000);  // 1000 = 1 second
+		$( "#messages" ).focusout(function() {
+			var newData=$(this).html();
+				billsMessage(newData);
+				$(this).attr("contenteditable", "false");
+				$(this).css("background-color", "orange");
+		})
+
+		$( "#messages" ).dblclick(function() {
+			dontreload=1;
+			globalOldData = $(this).html();
+			if($(this).attr("contenteditable")=="true"){
+				return;
+			} else {
+				$(this).css("background-color", "yellow");
+				$(this).attr("contenteditable", "true");
+				
+			}
+		})
+	
+})</script>
+
+<script>
+function billsMessage(newmessage){
+	var sendMe = 'newmessage=' + encodeURIComponent(newmessage);
+
+	$.post("bin/PDQmessage.php",sendMe,
+			function(data,status){
+			dontreload=0;
+			if(data=='Success' ){
+				$("#messages").css("background-color", '');
+			} else {
+				$("#messages").css("background-color", 'red');
+				alert("error: " + data);
+			}
+		}
+	);
+}
+var globalOldData;
+var dontreload=0;
+function sendUpdates(subKID, column, current, callingObject){
+	var sendMe = "subKID=" + encodeURIComponent(subKID) + "&column=" +  encodeURIComponent(column)+ "&current=" +  encodeURIComponent(current);
+
+	$.post("bin/PDQacknowledge.php",sendMe,
+		function(data,status){
+			dontreload=0;
+			if(data=="Success" ){
+				$(callingObject).html("");
+				$(callingObject).css("background-color", "");
+				Reload();
+			} else {
+				$(callingObject).css("background-color", "red");
+				alert("error: " + data);
+			}
+		}
+	);
+}
+
+function Reload(){
+	$.get( "bin/billstable.php", function( data ) {
+		$( "#billstable" ).html( data );
+			$( ".updatableDiv" ).dblclick(function() {
+				//alert('wh');
+				//dontreload=1;
+				globalOldData = $(this).html();
+				var subKID=$(this).attr("data-subkid");
+				var column=$(this).attr("data-column");
+				sendUpdates(subKID, column, $(this).html(), this);
+				$(this).css("background-color", "orange");
+			})
+			
+			// put current time in caption
+			var currentdate = new Date(); 
+			var datetime = "Last Sync: " + (currentdate.getMonth()+1) + "/" + currentdate.getDate() + " : " +currentdate.getHours() + ":" + currentdate.getMinutes();  
+			$("#tableCap").html(datetime);
+			$("#tableCap").css("font-size","26pt");
+	});
+
+}
+</script>
+
+<style>
+#messages{
+	font-size:24px;
+	min-height:20px;
+	border:1px solid;
+}
+body{
+	margin-left:5%;
+}
+.smaller{
+	font-size:18pt;
+}
+.right{
+	text-align:right;
+}
+.center{
+	text-align:center;
+}
+.tc{
+	display:table-cell;
+	padding-left:25px;
+	font-size:16pt;
+}
+th{
+	padding-left:25px;
+	padding-right:25px;
+	font-size:30pt;
+}
+td{
+	padding-left:25px;
+	padding-right:25px;
+	font-size:30pt;
+}
+tr:hover{
+	background-color:rgba(49,13,84,.08);
+}
+.colorRow{
+	background-color:rgba(49,13,84,.08);
+}
+.rjust{
+	text-align:right;
+}
+
+.smalltext{
+	font-size:10pt;
+}
+
+</style>
+</head>
+<body>
+<div id='messages' contenteditable="False" >
+<?php
+$sql = "select message from PDQMessage where PDQMid=0";
+$rs=mysqli_query($mydb,$sql) or die(mysqli_error());
+$row=mysqli_fetch_assoc($rs);
+echo $row['message'];
+?>
+</div>
+<div id='billstable'>
+</div>
+</body>
+</html>

+ 30 - 0
ICGstable.php

@@ -0,0 +1,30 @@
+<?php
+include_once('pdqconnect.inc');
+
+$sql = "select subK.*, date_format(subKdue,'%c-%e') as dueDate from subK 
+		where (subKstatus != 'Received') or ( subKLastUpdate > DATE_SUB(CURDATE(), INTERVAL 4 DAY))
+		order by subKstatus asc, subKack desc, subKdue asc, subKjob";
+
+$rs=mysqli_query($mydb,$sql) or die(mysqli_error() . "<br>". $sql);
+echo "<table border=0>";
+echo "<tr><th>Job</th><th>Material</th><th>Description</th><th>Qty</th><th>Due Date</th><th>New</th><th>Status</th></tr>\n";
+while($row=mysqli_fetch_array($rs)){
+	if(strlen($row['subKjob'])>9){
+		$fontClass='smaller';
+	} else {
+		$fontClass='';
+	}
+
+	//$Vname = $row['Vname'];
+	$Qty = number_format($row['subKqty'],0);
+	echo "<tr><td data-subKID='{$row['subKID']}' data-column='subKjob' class='$fontClass updatableDiv'>{$row['subKjob']}</td>";
+	echo "<td data-subKID='{$row['subKID']}' data-column='subKmaterial' class='updatableDiv'>{$row['subKmaterial']}</td>";
+	echo "<td data-subKID='{$row['subKID']}' data-column='subKdesc' class='updatableDiv center'>{$row['subKdesc']}</td>";
+	echo "<td data-subKID='{$row['subKID']}' data-column='subKqty' class='updatableDiv right'>$Qty</td>";
+	echo "<td data-subKID='{$row['subKID']}' data-column='subKdue' class='updatableDiv center'>{$row['dueDate']}</td>";
+	echo "<td data-subKID='{$row['subKID']}' data-column='subKack' class='updatableDiv center'>{$row['subKack']}</td>";
+	echo "<td data-subKID='{$row['subKID']}' data-column='subKstatus' class='updateStatus center' >{$row['subKstatus']}</td></tr>\n";
+}
+echo "<caption>PDQ Schedule</caption></table>";
+
+?>

+ 177 - 0
PDQ.php

@@ -0,0 +1,177 @@
+<?php include_once('pdqconnect.inc'); ?>
+<html>
+<head>
+<script src="jquery.min.js"></script>
+<script>$(document).ready(function(){   // jquery stuff in here
+	Reload();
+	setInterval(function(){
+		if(dontreload==0){
+			Reload();
+		}
+	},120000);  // 1000 = 1 second
+
+
+		$( "#messages" ).focusout(function() {
+			var newData=$(this).html();
+				billsMessage(newData);
+				$(this).attr("contenteditable", "false");
+				$(this).css("background-color", "orange");
+		})
+
+		$( "#messages" ).dblclick(function() {
+			dontreload=1;
+			globalOldData = $(this).html();
+			if($(this).attr("contenteditable")=="true"){
+				return;
+			} else {
+				$(this).css("background-color", "yellow");
+				$(this).attr("contenteditable", "true");
+				
+			}
+		})
+})
+</script>
+
+<script>
+var globalOldData;
+var dontreload=0;
+
+function Reload(){
+	$.get( "bin/ICGstable.php", function( data ) {
+		$( "#billstable" ).html( data );
+		
+		$( ".updatableDiv" ).focusout(function() {
+			var subKID=$(this).attr("data-subKID");
+			var newData=$(this).html();
+			var column=$(this).attr("data-column");
+			if($(this).html()==globalOldData){
+				$(this).css("background-color", "");
+				$(this).attr("contenteditable", "false");
+				dontreload=0;
+			} else {
+				sendUpdates(subKID, newData, column, this);
+				$(this).attr("contenteditable", "false");
+				$(this).css("background-color", "orange");
+			}
+		})
+
+		$( ".updatableDiv" ).dblclick(function() {
+			dontreload=1;
+			globalOldData = $(this).html();
+			if($(this).attr("contenteditable")=="true"){
+				return;
+			} else {
+				$(this).css("background-color", "yellow");
+				$(this).attr("contenteditable", "true");
+				
+			}
+		})
+		$( ".updateStatus" ).dblclick(function() {
+			dontreload=1;
+			var column=$(this).attr("data-column");
+			var subKID=$(this).attr("data-subKID");
+			sendUpdates(subKID, $(this).html(), column, this);
+		})
+	})
+}
+function billsMessage(newmessage){
+	var sendMe = 'newmessage=' + encodeURIComponent(newmessage);
+
+	$.post("bin/PDQmessage.php",sendMe,
+			function(data,status){
+			dontreload=0;
+			if(data=='Success' ){
+				$("#messages").css("background-color", '');
+			} else {
+				$("#messages").css("background-color", 'red');
+				alert("error: " + data);
+			}
+		}
+	);
+}
+function sendUpdates(subKID, newData, column, callingObject){
+	var sendMe = 'subKID=' + encodeURIComponent(subKID) + '&newData=' + encodeURIComponent(newData) + '&column=' + encodeURIComponent(column);
+
+	$.post("bin/PDQUpdates.php",sendMe,
+			function(data,status){
+			dontreload=0;
+		
+			if(data=='Success' ){
+				$(callingObject).css("background-color", '');
+			} else {
+				$(callingObject).css("background-color", 'red');
+				alert("error: " + data);
+			}
+			if(column=="subKstatus"){Reload();}
+		}
+	);
+}
+</script>
+
+<style>
+#messages{
+	min-height:30px;
+	font-size:18pt;
+	border: 1px solid;
+
+}
+body{
+	margin-left:5%;
+}
+.smaller{
+	font-size:18pt;
+}
+.right{
+	text-align:right;
+}
+.center{
+	text-align:center;
+}
+.tc{
+	display:table-cell;
+	padding-left:25px;
+	font-size:16pt;
+}
+th{
+	padding-left:25px;
+	padding-right:25px;
+	font-size:30pt;
+}
+td{
+	padding-left:25px;
+	padding-right:25px;
+	font-size:30pt;
+}
+tr:hover{
+	background-color:rgba(49,13,84,.08);
+}
+.colorRow{
+	background-color:rgba(49,13,84,.08);
+}
+.rjust{
+	text-align:right;
+}
+
+.smalltext{
+	font-size:10pt;
+}
+
+</style>
+</head>
+
+<body>
+<div id='messages' contenteditable="False" >
+<?php
+$sql = "select message from PDQMessage where PDQMid=0";
+$rs=mysqli_query($mydb,$sql) or die(mysqli_error($mydb));
+$row=mysqli_fetch_assoc($rs);
+echo $row['message'];
+?>
+</div>
+<div> 
+<button onclick="location.href='bin/PDQAddOne.php'">Add One</button>
+</div>
+<div id='billstable'>
+</div>
+</body>
+</html>

+ 12 - 0
PDQAddOne.php

@@ -0,0 +1,12 @@
+<?php 
+include('pdqconnect.inc');
+
+//$sql = "update subK set " . mysqli_real_escape_string($mydb,$column)  . " = '$mySQLDate' where subKID = " . mysqli_real_escape_string($mydb,$subKID);
+$sql = "insert into subK set subKvid=0,subKack='' ,subKstatus='', subKjob='New'";
+$rs=mysqli_query($mydb, $sql) or die(mysqli_error($mydb));
+header( 'Location: ../PDQ.php' ) ;
+
+	
+
+
+

+ 96 - 0
PDQUpdates.php

@@ -0,0 +1,96 @@
+<?php
+include('pdqconnect.inc');
+
+extract($_POST);
+
+if($column=="subKjob" or $column=="subKdesc" or $column=="subKmaterial" ){
+	$parseMe = trim(mysqli_real_escape_string($mydb,$newData));
+	$parseMe = str_replace("<br>", "" ,$parseMe);
+	$sql = "update subK set " . mysqli_real_escape_string($mydb,$column)  ." = '$parseMe' 
+	where subKID = " . mysqli_real_escape_string($mydb,$subKID);
+	$rs=mysqli_query($mydb,$sql) or die(mysqli_error());
+	if(mysqli_affected_rows($mydb)>0){
+		echo "Success";
+	} else {
+		echo "Failure - $sql";
+	}
+} 
+elseif($column=="subKstatus"){
+	$parseMe = trim(mysqli_real_escape_string($mydb,$newData));
+	$parseMe = str_replace("<br>", "" ,$parseMe);
+	$parseMe = str_replace("&nbsp;", "" ,$parseMe);
+	if($parseMe!=""){
+		if($parseMe=="Shipped"){$newstatus="Received";}
+		if($parseMe=="Received"){$newstatus="Shipped";}	
+		$sql = "update subK set subKstatus = '$newstatus' where subKID = " . mysqli_real_escape_string($mydb,$subKID);
+		$rs=mysqli_query($mydb,$sql) or die(mysqli_error());
+	}
+	echo "Success";
+}
+
+elseif($column=="subKack"){
+	$parseMe = str_replace(" ", "" ,trim(mysqli_real_escape_string($mydb,$newData)));
+	$parseMe = str_replace("<br>", "" ,$parseMe);
+	$parseMe = str_replace("&nbsp;", "" ,$parseMe);
+
+	$sql = "update subK set " . mysqli_real_escape_string($mydb,$column)  ." = '". $parseMe. "'
+	where subKID = " . mysqli_real_escape_string($mydb,$subKID);
+	$rs=mysqli_query($mydb,$sql) or die($sql);
+	if(mysqli_affected_rows($mydb)>0){
+		echo "Success";
+	} else {
+		echo "Failure - $sql";
+	}
+
+}
+elseif($column=='subKqty'){
+	$parseMe = str_replace(" ", "" ,trim(mysqli_real_escape_string($mydb,$newData)));
+	$parseMe = str_replace("<br>", "" ,$parseMe);
+	$parseMe = str_replace("&nbsp;", "" ,$parseMe);
+
+	$sql = "update subK set " . mysqli_real_escape_string($mydb,$column)  ." = ". $parseMe. " 
+	where subKID = " . mysqli_real_escape_string($mydb,$subKID);
+	$rs=mysqli_query($mydb,$sql) or die($sql);
+	if(mysqli_affected_rows($mydb)>0){
+		echo "Success";
+	} else {
+		echo "Failure - $sql";
+	}
+
+}
+elseif($column=='subKdue'){
+	$parseMe = str_replace("/", "-" ,trim($newData));
+	$parseMe = str_replace("<br>", "" ,$parseMe);
+	$parseMe = str_replace("&nbsp;", "" ,$parseMe);
+	$exploded = explode("-", $parseMe);
+	if(count($exploded)==3){
+		$myArray['mon']=$exploded[0];
+		$myArray['mday']=$exploded[1];
+		$myArray['year']=$exploded[2];
+	}
+	elseif(count($exploded)==2){
+		$today=getdate();
+		$myArray['mon']=$exploded[0];
+		$myArray['mday']=$exploded[1];
+		$myArray['year']=$today['year'];	
+	}
+	elseif(count($exploded)==1){
+		$today=getdate();
+		$myArray['mon']=$today['mon'];
+		$myArray['mday']=$exploded[1];
+		$myArray['year']=$today['year'];	
+	}
+	
+	$mySQLDate = $myArray['year'].'-'.$myArray['mon'].'-'.$myArray['mday'];
+	$sql = "update subK set " . mysqli_real_escape_string($mydb,$column)  . " = '$mySQLDate' 
+	where subKID = " . mysqli_real_escape_string($mydb,$subKID);
+	$rs=mysqli_query($mydb,$sql) or die(mysqli_error());
+	if(mysqli_affected_rows($mydb)>0){
+		echo "Success";
+	} else {
+		echo "Failure - $sql";
+	}
+}
+
+
+

+ 33 - 0
PDQacknowledge.php

@@ -0,0 +1,33 @@
+<?php
+include('pdqconnect.inc');
+
+extract($_POST);
+$subKID = mysqli_real_escape_string($mydb,$subKID);
+
+$parseMe = str_replace(" ", "" ,trim(mysqli_real_escape_string($mydb,$current)));
+$parseMe = str_replace("<br>", "" ,$parseMe);
+$parseMe = str_replace("&nbsp;", "" ,$parseMe);
+
+if($subKID>0){
+	if($column=="subKack"){
+		$sql = "update subK set subKack = ''	where subKID = " . mysqli_real_escape_string($mydb,$subKID);
+		$rs=mysqli_query($mydb,$sql) or die(mysqli_error());
+		echo "Success";
+	} elseif($column=="subKstatus"){
+		if($parseMe=="Finished"){
+			$sql = "update subK set subKstatus = 'Shipped'	where subKID = " . mysqli_real_escape_string($mydb,$subKID);
+			$rs=mysqli_query($mydb,$sql) or die(mysqli_error());
+			echo "Success";
+		}
+		if($parseMe=="Shipped"){
+			$sql = "update subK set subKstatus = ''	where subKID = " . mysqli_real_escape_string($mydb,$subKID);
+			$rs=mysqli_query($mydb,$sql) or die(mysqli_error());
+			echo "Success";
+		}
+		if($parseMe==""){
+			$sql = "update subK set subKstatus = 'Finished'	where subKID = " . mysqli_real_escape_string($mydb,$subKID);
+			$rs=mysqli_query($mydb,$sql) or die(mysqli_error());
+			echo "Success";
+		}
+	}
+} 

+ 10 - 0
PDQmessage.php

@@ -0,0 +1,10 @@
+<?php
+include('pdqconnect.inc');
+
+$sql = "update PDQMessage set message= '".  mysqli_real_escape_string($mydb,$_POST['newmessage'])  . "'  where PDQMid=0";
+$rs=mysqli_query($mydb, $sql) or die(mysqli_error());
+if(mysqli_affected_rows($mydb)>0){
+	echo "Success";
+} else {
+	echo "Failure - $sql";
+}

+ 29 - 0
billstable.php

@@ -0,0 +1,29 @@
+<?php
+include_once('pdqconnect.inc');
+
+$sql = "select subK.*, date_format(subKdue,'%c-%e') as dueDate from subK 
+		where (subKstatus != 'Received') or ( subKLastUpdate > DATE_SUB(CURDATE(), INTERVAL 4 DAY))
+		order by subKstatus asc, subKack desc, subKdue asc, subKjob";
+
+$rs=mysqli_query($mydb,$sql) or die(mysqli_error() . "<br>". $sql);
+echo "<table border=0>";
+echo "<tr><th>Job</th><th>Material</th><th>Description</th><th>Qty</th><th>Due Date</th><th>New</th><th>Status</th></tr>\n";
+while($row=mysqli_fetch_array($rs)){
+	if(strlen($row['subKjob'])>9){
+		$fontClass='smaller';
+	} else {
+		$fontClass='';
+	}
+//	$Vname = $row['Vname'];
+	$Qty = number_format($row['subKqty'],0);
+	echo "<tr><td data-subKID='{$row['subKID']}' data-column='subKjob' class='$fontClass'>{$row['subKjob']}</td>";
+	echo "<td data-subKID='{$row['subKID']}' data-column='subKmaterial' class=''>{$row['subKmaterial']}</td>";
+	echo "<td data-subKID='{$row['subKID']}' data-column='subKdesc' class=' center'>{$row['subKdesc']}</td>";
+	echo "<td data-subKID='{$row['subKID']}' data-column='subKqty' class=' right'>$Qty</td>";
+	echo "<td data-subKID='{$row['subKID']}' data-column='subKdue' class=' center'>{$row['dueDate']}</td>";
+	echo "<td data-subKID='{$row['subKID']}' data-column='subKack' class='updatableDiv center' >{$row['subKack']}</td>";
+	echo "<td data-subKID='{$row['subKID']}' data-column='subKstatus' class='updatableDiv center' >{$row['subKstatus']}</td></tr>\n";
+}
+echo "<caption id='tableCap'>Schedule</caption></table>";
+
+?>