setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); $textarea = ""; if ($_GET['full'] == "1") { try { $query_orders = "SELECT * FROM `TABLE 2` ORDER BY `Order Date` DESC"; $stmt_orders = $conn->prepare($query_orders); $stmt_orders->execute(); }catch(PDOException $e) { echo $e->getMessage(); }; //$query_rec = "SELECT * FROM `stock` ORDER BY `date` DESC"; try { $query_recs = "SELECT * FROM `TABLE 7`"; $stmt_recs = $conn->prepare($query_recs); $stmt_recs->execute(); }catch(PDOException $e) { echo $e->getMessage(); }; }; if ($_GET['between'] == "1") { $from = date("Y-m-d", strtotime($_GET['from'])); $to = date("Y-m-d", strtotime($_GET['to'])); try { $query_recs = "SELECT * FROM `TABLE 7` WHERE `date` BETWEEN '$from' AND '$to' ORDER BY `date` DESC"; $stmt_recs = $conn->prepare($query_recs); $stmt_recs->execute(); }catch(PDOException $e) { echo $e->getMessage(); }; try { $query_orders = "SELECT DISTINCT * FROM `TABLE 2` WHERE `Order Date` BETWEEN '$from' AND '$to' ORDER BY `Order Date` DESC"; $stmt_orders = $conn->prepare($query_orders); $stmt_orders->execute(); }catch(PDOException $e) { echo $e->getMessage(); }; try { $query_rec = "SELECT * FROM `TABLE 6` WHERE `COL 1` BETWEEN '$from' AND '$to' "; $stmt_rec = $conn->prepare($query_rec); $stmt_rec->execute(); }catch(PDOException $e) { echo $e->getMessage(); }; }; $flatblack = 0; $flatblacknet = 0; $flatblackprofit = 0; $whitestandard = 0; $whitestandardnet = 0; $whitestandardprofit = 0; $totalsalesprofit = 0; $totalsales = 0; $coststock = 0; $flatblackcost = 18; $whitestandardcost = 28; $day = 0; $Date = "2021-01-01"; if ($_GET['updaterent'] == "yes") { for ($x = 0; $x <= 730; $x+=1) { //echo "The number is: $day
"; $day++; if ($day == 30){echo date('Y-m-d', strtotime($Date. ' + 30 days')); $Date= date('Y-m-d', strtotime($Date. ' + 30 days')); $day = 0; try { $statement = $conn->prepare("INSERT INTO `TABLE 7`(`filename`, `Listing title`, `date`, `Total price`) VALUES(:filename, :description, :date, :price)"); $statement->execute(array( "filename" => "EMPTY", "description" => "RENT", "date" => $Date, "price" => 100 )); } catch(PDOException $e) { echo $e->getMessage(); }; }; }; }; if ($_GET['updatebayitems'] == "yes") { try { $query_ebay = "SELECT * FROM `TABLE 15`"; $stmt_ebay = $conn->prepare($query_ebay); $stmt_ebay->execute(); }catch(PDOException $e) { echo $e->getMessage(); }; while ($r=$stmt_ebay->fetch(PDO::FETCH_ASSOC)) { $dateebay = $r['OrderDate']; $date = date('Y-m-d', strtotime($dateebay));; echo $date."
"; $ebayid = $r['ItemID']; try { $query_ebay2 = "SELECT * FROM `TABLE 7` WHERE `Item ID` = $ebayid AND `date` BETWEEN '$date' AND '$date' "; $stmt_ebay2 = $conn->prepare($query_ebay2); $stmt_ebay2->execute(); $row = $stmt_ebay2->fetch(); if ($row) { // here! as simple as that echo 'no data found'; $res = preg_replace("/[^0-9.]/", "", $r['OrderTotal']); try { $statement = $conn->prepare("INSERT INTO `TABLE 7`(`filename`, `Listing title`, `date`, `Total price`, `Item ID`) VALUES(:filename, :description, :date, :price, :itemid)"); $statement->execute(array( "filename" => "EMPTY", "description" => $r['ItemName'], "date" => $date, "price" => $res, "itemid" => $r['ItemID'] )); } catch(PDOException $e) { echo $e->getMessage(); }; }; }catch(PDOException $e) { echo $e->getMessage(); }; }; }; $duplicate=array(); if ($_GET['updatesolditems'] == "yes") { try { $query_ebay = "SELECT * FROM `TABLE 15`"; $stmt_ebay = $conn->prepare($query_ebay); $stmt_ebay->execute(); }catch(PDOException $e) { echo $e->getMessage(); }; while ($r=$stmt_ebay->fetch(PDO::FETCH_ASSOC)) { $dateebay = $r['OrderDate']; $date = date('Y-m-d', strtotime($dateebay));; echo $date."
"; $ebayid = $r['ItemID']; try { $query_ebay2 = "SELECT * FROM `TABLE 7` WHERE `Item ID` = $ebayid AND `date` BETWEEN '$date' AND '$date' "; $stmt_ebay2 = $conn->prepare($query_ebay2); $stmt_ebay2->execute(); $row = $stmt_ebay2->fetch(); if (!$row) { // here! as simple as that echo 'no data found'; $res = preg_replace("/[^0-9.]/", "", $r['OrderTotal']); try { $statement = $conn->prepare("INSERT INTO `TABLE 7`(`filename`, `Listing title`, `date`, `Total price`, `Item ID`) VALUES(:filename, :description, :date, :price, :itemid)"); $statement->execute(array( "filename" => "EMPTY", "description" => $r['ItemName'], "date" => $date, "price" => $res, "itemid" => $r['ItemID'] )); } catch(PDOException $e) { echo $e->getMessage(); }; }; }catch(PDOException $e) { echo $e->getMessage(); }; }; }; ?>

Stock Section

942

Total Sales

328

GROSS Profit

328

NET Profit

328

Stock Cost

Table head options

Use one of two modifier classes to make <thead>s appear light or dark gray.

Amount Product Net Profit
1 Black Flat Otto @mdo
2 White standard Thornton @fat

Stock Cost

fetch(PDO::FETCH_ASSOC)) { $id = $r['Order ID'];$originalDate = $r['Sale Date']; if (in_array($id, $duplicate)) { try { $query_delete = "SELECT * FROM `TABLE 2` WHERE `Order ID` = $id"; $stmt_delete = $conn->prepare($query_delete); $stmt_delete->execute(); $no=$stmt_delete ->rowCount(); echo " No of records = ".$no; }catch(PDOException $e) { echo $e->getMessage(); } if ($no > 1) { echo "DELETE".$id; $sql = "DELETE FROM `TABLE 2` WHERE `Order ID` = $id"; $stmt= $conn->prepare($sql); $stmt->execute(); }; } else { // echo "Match not found"; array_push($duplicate,$id);}; //print_r($duplicate); $time = strtotime($originalDate); $newformat = date('m-d-Y',$time); $dt=date("m-d-Y");// Today's date //echo $originalDate; try { $query_item = "SELECT * FROM `TABLE 4` WHERE `Order ID` = $id LIMIT 1"; $stmt_item = $conn->prepare($query_item); $stmt_item->execute(); }catch(PDOException $e) { echo $e->getMessage(); } $newDate = date("d-m-y", strtotime($originalDate)); $date = date('Y-m-d', strtotime($newformat));; if ($_GET['update'] == "yes") { try { $sql = "UPDATE `TABLE 2` SET `Order Date` = STR_TO_DATE('$newformat', '%m-%d-%Y') WHERE `Order ID` =$id"; // Prepare statement $stmt = $conn->prepare($sql); // execute the query $stmt->execute(); // echo a message to say the UPDATE succeeded echo " records UPDATED successfully"; } catch(PDOException $e) { echo $sql . "
" . $e->getMessage(); } }; if ($_GET['updatestock'] == "yes") { try { $sql = "UPDATE `TABLE 7` SET `Order Date` = STR_TO_DATE('$newformat', '%m-%d-%Y') WHERE `Order ID` =$id"; // Prepare statement $stmt = $conn->prepare($sql); // execute the query $stmt->execute(); // echo a message to say the UPDATE succeeded echo " records UPDATED successfully"; } catch(PDOException $e) { echo $sql . "
" . $e->getMessage(); } }; ?>
Date Order ID Products Name Item Price Total Postage Manufacturing Price Card Fee TAX Platform Total Profit Order Status Action
fetch(PDO::FETCH_ASSOC)) { $price = $i['price']; if ($i['price'] < 35.00) { $flatblack = $flatblack + $i['quantity']; $flatblacknet = $flatblacknet + $i['price']; $flatblackprofit = $flatblackprofit + $i['quantity']*$flatblackcost; $blackaddonconst = $i['quantity']*$flatblackcost; $totalsalesprofit = $totalsalesprofit + $blackaddonconst; $totalsales = $totalsales + $i['quantity']; }; if ($i['price'] > 34.00 && $i['price'] < 55.00) { $whitestandard = $whitestandard + $i['quantity']; $whitestandardnet = $whitestandardnet + $i['price']; $whitestandardprofit = $whitestandardprofit + $i['quantity']*$whitestandardcost; $whiteaddonconst = $i['quantity']*$whitestandardcost; $totalsalesprofit = $totalsalesprofit + $whiteaddonconst; $totalsales = $totalsales + $i['quantity'];}; $itt= substr($i['Item Name'],0,20); echo $itt; ;}; ?> £5 ETSY £20 PROCESSED