Anda di halaman 1dari 3

1 #include<stdio.

h>
2 #include<conio.h>
3 #include<math.h>
4 #define p printf
5 #define s scanf
6 #define g gotoxy
7
8 int x,z;
9 int Count;
10 char User[32];
11 char Pass[32];
12 float qty;
13 float unitprice;
14 char item[12];
15 float Amount;
16 int NumOfItems;
17 int NumOfOrders;
18 float TotalAmount;
19 float Change;
20 float Payment;
21 int Limit;
22
23 void main()
24 {
25 clrscr();
26 //Table for Login
27 for(x=1;x<=23;x++)
28 {
29 g(28+x,8);p("");
30 g(28+x,13);p("");
31 g(28+x,15);p("");
32 }
33 g(28,8);p("");
34 g(52,8);p("");
35 for(x=1;x<=6;x++)
36 {
37 g(28,8+x);p("");
38 g(52,8+x);p("");
39 }
40 g(28,13);p("");
41 g(52,13);p("");
42 g(28,15);p("");
43 g(52,15);p("");
44 //Login
45 g(30,9);p("Username: ");
46 g(30,10);p("Password: ");
47 g(40,9);s("%s", &User);
48 g(40,10);s("%s", &Pass);
49 g(29,12);p("Loading...");
50 for(x=1;x<=23;x++)
51 {
52 g(48,12);p("%d%",x*4+8);
53 g(x+28,14);delay(50);p("");
54 }
55 g(29,12);p("Success! ");delay(1000);
56 for(Count=1;Count<=5;Count++)
57 {
58 //Table for Main Menu
59 for(x=1;x<=10;x++)
60 {
61 qty=0;
62 item=="";
63 unitprice=0;
64 Amount=0;
65 NumOfItems=0;
66 NumOfOrders=0;
67 TotalAmount=0;
68 Change=0;
69 Payment=0;
70 }
71 clrscr();
72 for(x=1;x<=80;x++)
73 {
74 g(x,1);p("");
75 g(x,24);p("");
76 }
77 for(x=1;x<=24;x++)
78 {
79 g(1,x);p("");
80 g(40,x);p("");
81 g(80,x);p("");
82 }
83 for(x=1;x<=40;x++)
84 {
85 g(x+39,12);p("");
86 }
87 g(1,1);p("");
88 g(40,1);p("");
89 g(80,1);p("");
90 g(40,12);p("");
91 g(80,12);p("");
92 g(1,24);p("");
93 g(40,24);p("");
94 g(80,24);p("");
95 //Order System
96 g(21,2);p("Receipt No. PUP-00%d",Count);
97 g(10,4);p("Polytechnic University");
98 g(17,5);p("of the");
99 g(14,6);p("Philippines");
100 g(13,7);p("Ordering System");
101 g(3,8);p("Qty");
102 g(11,8);p("Items");
103 g(21,8);p("UnitPrice");
104 g(33,8);p("Amount");
105 //Summary
106 g(56,3);p("Summary");
107 g(42,6);p("Total Amount of Orders: %d", NumOfOrders);
108 g(42,8);p("Total Number of Items: %d", NumOfItems);
109 g(42,10);p("Total Amount: P%.02f", TotalAmount);
110 //Payment
111 g(61,14);p("Receipt No. PUP-00%d",Count);
112 g(42,17);p("Total Amount to Pay: P%.02f",TotalAmount);
113 g(42,19);p("Cash: ");
114 g(42,21);p("Change: ");
115 //Insert Data
116 for(x=1;x<=10;x++)
117 {
118 g(3,x+8);s("%f", &qty);
119 if(qty==0)
120 {
121 for(z=1;z<=37;z++)
122 {
123 g(z+2,x+8);p(" ");
124 }
125 Limit = x-1;
126 g(66,6);p("%d", NumOfOrders);
127 g(66,8);p("%d", NumOfItems);
128 g(66,10);p("P%.02f", TotalAmount);
129 g(63,17);p("P%.02f",TotalAmount);
130 break;
131 }
132 g(9,x+8);s("%s", &item);
133 if((strcmp(item,"break") == 0)||(strcmp(item,"Break") == 0))
134 {
135 for(z=1;z<=37;z++)
136 {
137 g(z+2,x+8);p(" ");
138 }
139 Limit = x-1;
140 g(66,6);p("%d", NumOfOrders);
141 g(66,8);p("%d", NumOfItems);
142 g(66,10);p("P%.02f", TotalAmount);
143 g(63,17);p("P%.02f",TotalAmount);
144 break;
145 }
146 g(21,x+8);s("%f", &unitprice);
147 g(21,x+8);p(" ");
148 g(21,x+8);p("%.02f",unitprice);
149 Amount = (unitprice) * (qty);
150 g(33,x+8);p("%.02f", Amount);
151 Limit=x;
152 TotalAmount+=Amount;
153 NumOfItems+=qty;
154 NumOfOrders=Limit;
155 g(66,6);p("%d", NumOfOrders);
156 g(66,8);p("%d", NumOfItems);
157 g(66,10);p("P%.02f", TotalAmount);
158 g(63,17);p("P%.02f",TotalAmount);
159 }
160 g(63,19);s("%f",&Payment);
161 g(63,19);p(" ");
162 g(63,19);p("P%.02f",Payment);
163 Change = Payment - TotalAmount;
164 g(63,21);p("P%.02f",Change);
165 getch();
166 }
167
168 }
169