-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathturns.cs
196 lines (162 loc) · 5.26 KB
/
turns.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
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
using System;
using System.Windows.Forms;
using System.Collections.Generic;
namespace Ap_Project_Clinic_
{
public partial class turns : Form
{
List<nobatdehi> todayturn = new List<nobatdehi>();
nobatdehi x;
public turns()
{
InitializeComponent();
}
static int i = 0;
private void turns_Load(object sender, EventArgs e)
{
}
public static string returncost(string work)
{
string paths = Application.StartupPath + "\\cost.txt";
string[] cost = System.IO.File.ReadAllLines(paths);
string[] costbase = cost[0].Split('*');
if (work == "moayene")
{
return costbase[0];
}
else if (work == "tarmim1")
{
return costbase[1];
}
else if (work == "tarmim2")
{
return costbase[2];
}
else
{
return costbase[3];
}
}
private void button2_Click(object sender, EventArgs e)
{
if(txtpayment.Text=="")
{
MessageBox.Show("not correct");
return;
}
string saveincomefile = Application.StartupPath + "\\income.txt";
string cost =txtdoctor.Text+"*"+txtpayment.Text+"\n";
System.IO.File.AppendAllText(saveincomefile, cost);
managenobat manage = new managenobat(x);
manage.deletenobat(datenow.Value, txtfilecode.Text);
foreach(Control c in panel1.Controls)
{
if(c is TextBox d)
d.Text = "";
}
}
private void button5_Click(object sender, EventArgs e)
{
//todayturn = nobatdehi.getalltoday(datenow.Value);
readandwrite read = new readandwrite();
todayturn = read.getallnobatbasespeanddate(datenow.Value);
getturn();
}
private void button1_Click(object sender, EventArgs e)
{
i++;
getturn();
}
private void button3_Click(object sender, EventArgs e)
{
i--;
getturn();
}
public void getturn()
{
if(i>=todayturn.Count||i<0)
{
MessageBox.Show("invalid turn.");
return;
}
x = todayturn[i];
if (x == null)
{
MessageBox.Show("wrong date");
}
else
{
txtname.Text = x.name;
txtfamilyname.Text = x.familyname;
txtphone.Text = x.phone;
txtdoctor.Text = x.doctorname;
txtfilecode.Text = x.fileid;
txtturn.Text = Convert.ToString(x.shomarenobat);
employes newemp = new employes(x.doctorname, "doctor");
double money = Convert.ToDouble(returncost(x.work)) + Convert.ToDouble(readandwriteemp.getspecialsalary(newemp));
txtpayment.Text = money.ToString();
}
}
private void button4_Click(object sender, EventArgs e)
{
rateform rate = new rateform();
rate.Show(this);
}
private void button6_Click(object sender, EventArgs e)
{
paymentturn pay = new paymentturn(txtdoctor.Text, Convert.ToDouble(txtpayment.Text)/ Convert.ToInt32(textBox1.Text), Convert.ToInt32(textBox1.Text),datenow.Value);
readandwritepayment.writeinfile(pay);
managenobat manage = new managenobat(x);
manage.deletenobat(datenow.Value, txtfilecode.Text);
foreach (Control c in panel1.Controls)
{
if(c is TextBox d)
d.Text = "";
}
}
private void button7_Click(object sender, EventArgs e)
{
paymentturn.payalltoday(datenow.Value);
}
private void checkBox1_CheckedChanged(object sender, EventArgs e)
{
if(checkBox1.Checked==true)
{
textBox2.Enabled = true;
textBox3.Enabled = true;
button8.Enabled = true;
}
else
{
textBox2.Enabled = false;
textBox3.Enabled = false;
button8.Enabled = false;
}
}
public double getbime()
{
bime nebim = readandwritebime.search(textBox2.Text);
if(nebim!=null)
{
double newpay= (Convert.ToDouble(txtpayment.Text) * nebim.percent / 100); ;
textBox3.Text = newpay.ToString();
return newpay;
}
else
{
MessageBox.Show("sorry you have not bime");
return 0;
}
}
private void textBox3_TextChanged(object sender, EventArgs e)
{
}
private void button8_Click(object sender, EventArgs e)
{
if (checkBox1.Checked == true)
{
getbime();
}
}
}
}