-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsettings.xaml.cs
116 lines (97 loc) · 3.73 KB
/
settings.xaml.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
using System;
using System.Collections.Generic;
using System.Drawing;
using System.Drawing.Printing;
using System.IO;
using System.Linq;
using System.Text.RegularExpressions;
using System.Windows;
using System.Data.SqlClient;
using System.Data;
using System.Net;
using System.Net.Sockets;
namespace Yo_Tuk_Tuk_Epos
{
/// <summary>
/// Interaction logic for settings.xaml
/// </summary>
public partial class settings : Window
{
static double cash = 0;
static double card = 0;
static double Discount = 0;
static double total = 0;
ServerClass serverRequest = new ServerClass();
RestaurantLayout currentLayout;
public settings(RestaurantLayout layout)
{
currentLayout = layout;
InitializeComponent();
}
private void DayEnd_Click(object sender, RoutedEventArgs e)
{
serverRequest.read("xread");
//string[] read = (serverRequest.read("xread")).Split(',');
//for (int i = 0; i < read.Length; i++)
//{
// if (read[i] == "cash")
// {
// cash += double.Parse(read[i - 4]);
// }
// else if (read[i] == "card")
// {
// card += double.Parse(read[i - 4]);
// }
// else if (read[i] == "discount")
// {
// Discount += double.Parse(read[i + 1]);
// }
//}
//total = cash + card;
//printXread();
if (MessageBox.Show("Would you like to Reset X-Read?", "Reset", MessageBoxButton.YesNo) == MessageBoxResult.Yes)
{
serverRequest.read("reset");
}
}
private void printXread()
{
PrintDocument printDocument = new PrintDocument();
printDocument.PrintPage += new PrintPageEventHandler(xPrinter);
printDocument.Print();
}
private void xPrinter(object sender, PrintPageEventArgs e)
{
Graphics graphics = e.Graphics;
Font font = new Font("Arial", 12);
int startX = 0;
int startY = 0;
int offSet = 20;
StreamWriter writer = new StreamWriter("printDoc");
//graphics.DrawString("Day End".PadRight(10) + DateTime.Now, font, new SolidBrush(System.Drawing.Color.Black), 100, 0 + 0);
//offSet += 20;
//graphics.DrawString("Cash = ".PadRight(10) + cash, font, new SolidBrush(System.Drawing.Color.Black), 0, 0 + 0);
//offSet += 20;
//graphics.DrawString("Card = ".PadRight(10) + card, font, new SolidBrush(System.Drawing.Color.Black), 100, 0 + 0);
//offSet += 20;
//graphics.DrawString("Discount = ".PadRight(10) + Discount, font, new SolidBrush(System.Drawing.Color.Black), 100, 0 + 0);
//offSet += 20;
//graphics.DrawString("Total Sales = ".PadRight(10) + total, font, new SolidBrush(System.Drawing.Color.Black), 100, 0 + 0);
//offSet += 20;
writer.WriteLine("\tDay End\r\n"+"Cash = ".PadRight(10)+cash+"\r\nCard = ".PadRight(10)+card+"\r\nDiscount = ".PadRight(10)+Discount+"\r\nTotal Sales = ".PadRight(10)+total);
writer.Close();
}
private void Update_Click_1(object sender, RoutedEventArgs e)
{
FoodPricing pricing = new FoodPricing(currentLayout);
currentLayout.Hide();
this.Close();
pricing.Show();
}
private void Host_Click(object sender, RoutedEventArgs e)
{
HostWindow host = new HostWindow();
host.Show();
}
}
}