/[cvs.andrew.net.au]/stock/showwatch.php
ViewVC logotype

Contents of /stock/showwatch.php

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.1.1.1 - (show annotations) (vendor branch)
Thu Mar 14 13:23:57 2002 UTC (20 years, 3 months ago) by apollock
Branch: MAIN, stock
CVS Tags: start, HEAD
Changes since 1.1: +0 -0 lines
Imported sources

1 <?php
2 //include("inc/util.inc");
3 include_once("inc/GetWatchscreen.inc");
4 include_once("inc/GetWatchscreenContents.inc");
5 include_once("inc/GetWatchscreenOwner.inc");
6 include_once("inc/GetLatestPrice.inc");
7 include_once("inc/GetDateOfLatestPrice.inc");
8 include_once("inc/Get2ndLatestPrice.inc");
9 include_once("inc/AddStock.inc");
10 include_once("inc/GetUserId.inc");
11 include_once("inc/GetTrendClass.inc");
12 include_once("inc/RemoveStock.inc");
13 include_once("inc/GetName.inc");
14 // Need to add a little security check up here to make sure that the screen belongs to the user requesting it
15 if ($PHP_AUTH_USER != getWatchscreenOwner($id)) {
16 echo "You are so very naughty";
17 exit;
18 }
19 ?>
20 <?php if (isset($submit) && (!empty($code) && !empty($purchase_date) && !empty($purchase_price) && !empty($purchase_quantity))) {
21 if (AddStock($id, GetUserId($PHP_AUTH_USER), strtoupper($code), $purchase_date, $purchase_price, $purchase_quantity)) {
22 $added = True;
23 //echo "Stock added to watchscreen";
24 } else {
25 $added = False;
26 //echo "Stock not added to watchscreen";
27 }
28 }
29
30 if (isset($remove)) {
31 RemoveStock($id, GetUserId($PHP_AUTH_USER), $stockid);
32 }
33 ?>
34 <HTML>
35 <HEAD>
36 <TITLE>Stock Monitor: <?php echo GetWatchScreen($id)?></TITLE>
37 <STYLE type="text/css">
38 <?php include("stylesheet.css");?>
39 </STYLE>
40 <SCRIPT language="JavaScript">
41 <!--//
42 function displayChart(code) {
43 chartWindow = window.open("chart.php?code=" + code,"","width=350,height=270");
44 }
45 //-->
46 </SCRIPT>
47 </HEAD>
48 <BODY bgcolor="white">
49 <H1><A href="/main.php">stock.andrew.net.au</A> | <?php echo GetWatchScreen($id)?></H1>
50 <DIV align=right class="toolbar">
51 <A class="toolbar" href="addwatch.php">Add a watchscreen</A>
52 <A class="toolbar" href="editwatch.php">Edit a watchscreen</A>
53 <A class="toolbar" href="delwatch.php">Delete a watchscreen</A>
54 |
55 <A class="toolbar" href="password.php">Change password</A>
56 </DIV>
57 <BR>
58 <DIV ID="watchscreen">
59 <TABLE cellspacing=0 cellpadding=3 align=center border=0>
60 <TR>
61 <TH>Stock code</TH><TH>Date purchased</TH><TH>Quantity</TH><TH>Purchase price</TD><TH>Latest price</TH><TH>Trend</TH><TH>Gain/Loss</TH>
62 </TR>
63 <?php
64 $watchscreen = GetWatchScreenContents($id);
65 while(list(,$row) = each($watchscreen)) { ?>
66 <TR>
67 <TD class="code"><SPAN title="<?php echo getName($row['code'])?>"><?php echo $row['code']?></SPAN></TD><TD><?php echo date("d/m/Y", $row['purchase_date'])?></TD><TD><?php echo $row['purchase_quantity']?></TD><TD>$<?php printf("%01.2f", $row['purchase_price'] / 100.00)?></TD><TD><SPAN title="as at market close on <?php echo date("d/m/Y", getDateOfLatestPrice($row['code'])) ?>">$<?php printf("%01.2f", GetLatestPrice($row['code']) / 100.00)?></SPAN></TD><TD class="<?php echo getTrendClass($row['code'])?>">$<?php printf("%01.2f", (GetLatestPrice($row['code']) - Get2ndLatestPrice($row['code'])) / 100.00)?></TD><TD>$<?php printf("%01.2f", ((GetLatestPrice($row['code']) - $row['purchase_price']) * $row['purchase_quantity']) / 100.00)?></SPAN></TD>
68 <TD>
69 <FORM class=removeform method=post onsubmit="return confirm('Removal is final');">
70 <INPUT type=submit class="removebutton" name=remove value="Remove">
71 <INPUT type=hidden name=stockid value="<?php echo $row['id']?>">
72 <!--<A href="chart.php?id=<?php echo $row['id']?>">View chart</A>-->
73 <A href="javascript:displayChart('<?php echo $row['code']?>')">View chart</A>
74 </FORM>
75 </TD>
76 </TR>
77 <?php } ?>
78 </TABLE>
79 </DIV>
80 <BR>
81 <DIV class="addstock" align=center>
82 <FORM method=post>
83 <TABLE border=0>
84 <TR><TD>Stock code</TD><TD><INPUT type=text size=4 maxlength=4 name=code></TD></TR>
85 <TR><TD>Date purchased</TD><TD><INPUT type=text size=10 maxlength=10 name=purchase_date></TD><TD><I>dd/mm/yyyy</I></TD></TR>
86 <TR><TD>Purchase price</TD><TD><INPUT type=text name=purchase_price size=5 maxlength=5></TD><TD><I>cents</I></TD></TR>
87 <TR><TD>Quantity purchased</TD><TD><INPUT type=text name=purchase_quantity size=6 maxlength=6></TD></TR>
88 </TABLE>
89 <INPUT type=submit name=submit value="Add stock to watchscreen">
90 </FORM>
91 </DIV>
92 <?php if (isset($submit) && (!empty($code) && !empty($purchase_date) && !empty($purchase_price) && !empty($purchase_quantity))) {
93 if ($added) {
94 echo "Stock added to watchscreen";
95 } else {
96 echo "Stock not added to watchscreen";
97 }
98 unset($added);
99 }
100 ?>
101 </BODY>
102 </HTML>

  ViewVC Help
Powered by ViewVC 1.1.22