2 * Copyright (C) 2015 sparky4
4 * This file is part of baka database.
6 * baka database is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 3 of the License, or
9 * (at your option) any later version.
11 * baka database is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
16 * You should have received a copy of the GNU General Public License
17 * along with this program. If not, see <http://www.gnu.org/licenses/>, or
18 * write to the Free Software Foundation, Inc., 51 Franklin Street,
19 * Fifth Floor, Boston, MA 02110-1301 USA.
23 //price! and finish it
24 //additional paramiters
37 byte sheetstr[sizeof(byte)*((80*50)+1)];
42 iword baka_id; //work order number
43 iword bakacust_id; //customer id
44 byte bakacust_lastname[64]; //name of client
45 byte bakacust_firstname[64]; //name of client
46 byte bakacust_phone[64]; //phopne number of client
47 byte bakacust_address[64]; //address of client
48 byte bakacust_zipcode[64]; //zipcode
49 byte baka_desc[4096]; //Description of the problem
51 byte baka_price; //price
52 word baka_done; //is it done?
60 byte str[BAKAPEE], strc[BAKAPEE], buff[BAKAPEE], st[24];
64 FILE *inbaka = fopen ( BAKADB, "r+" );
66 FILE *incust = fopen ( CUSTDB, "r+" );
72 outbaka = fopen ( BAKADB, "w+" );
73 printf("\nNew database being made ^^;\n");
74 printf("Work order number: ");
75 scanf("%ud\n", &baka_id); // input~
76 if(baka_id==0) baka_id=1;
80 fgets(buff, 1, inbaka);
86 while ( fgets ( buff, sizeof buff, inbaka) != NULL );
88 pc = strtok(buff, SEPE);
91 outbaka = fopen ( BAKADB, "a+" );
92 outcust = fopen ( CUSTDB, "a+" );
93 //printf(" baka_id=%u\n", baka_id);
95 sprintf(st, "%u", baka_id);
102 //input 1st and last~
103 printf("Client's name Last Name: ");
104 scanf("%s", &(bakacust_lastname)); // input~
105 printf("Client's name First Name: ");
106 scanf("%s", &(bakacust_firstname)); // input~
108 //TODO make uppercased names
110 cmpstrfromdb(1); //++++update
112 strcat(str,bakacust_lastname); strcat(str,SEPE);
113 strcat(str,bakacust_lastname); strcat(str,SEPE);
114 strcat(str,bakacust_lastname); strcat(str,SEPE);
117 printf("Client's Phone Number: ");
118 scanf("%s", &(bakacust_phone)); // input~
119 }else getstrfromdb(2);
120 strcat(str,baka_phone); strcat(str,SEPE);
123 printf("Client's Address: ");
124 scanf("%s", &(baka_address)); // input~
125 }else getstrfromdb(3);
126 strcat(str,baka_address); strcat(str,SEPE);
128 printf("Description of the Problem: ");
129 scanf("%s", &(baka_desc)); // input~
130 strcat(str,baka_desc); strcat(str,SEPE);
132 memset(st, 0, sizeof st); //reset str~
133 baka_date=time(NULL);
134 sprintf(st, "%s", ctime(&baka_date));
136 p++; /* 'N' is not in `p` */
137 p[strlen(p)-1] = 0; /* 'P' is not in `p` (and it isn't in `mystr` either) */
138 //printf("[%s]", st);
139 strcat(str, st); strcat(str,SEPE);
142 strcat(str, "0"); strcat(str,SEPE);
149 fwrite(str, strlen(str), 1, outbaka);
155 void bddone(iword id)
157 byte buff[BAKAPEE], st[16], str[BAKAPEE];
161 FILE *in = fopen ( BAKADB, "r" );
163 while ( fgets ( buff, sizeof buff, in ) != (NULL) )
166 pc = strtok(buff, SEPE);
174 sprintf(st, "%d", "1");
176 p++; /* 'N' is not in `p` */
177 p[strlen(p)-4] = st[0]; /* 'P' is not in `p` (and it isn't in `mystr` either) */
178 //printf("[%d]\n", eed);
182 out = fopen ( BAKADB, "w+" );
183 fwrite(str, strlen(str), 1, out);
188 void bdchange(iword id, byte i, sword t)
190 byte buff[BAKAPEE], str[BAKAPEE];
195 FILE *in = fopen ( BAKADB, "r" );
199 while ( fgets ( buff, sizeof buff, in ) != (NULL) )
202 pc = strtok(buff, SEPE);
211 //sprintf(st, "%f", );
213 p++; /* 'N' is not in `p` */
214 p[strlen(p)+(t*4)] = ((*bakapee)+(iword)(i)); /* 'P' is not in `p` (and it isn't in `mystr` either) */
215 //printf("[%d]\n", eed);
219 out = fopen ( BAKADB, "w+" );
220 fwrite(str, strlen(str), 1, out);
227 byte str[BAKAPEE*16], boo[BAKAPEE], st[24];
228 FILE *out = fopen ( "sheet.txt", "w+" );
231 strcpy(str, "Dr. Bulldog Computers (318) 255-0333\n");
232 strcat(str, "208 N Trenton Street Monday - Friday\n");
233 strcat(str, "Ruston, LA 71270 10:00 AM – 6:00 PM\n");
234 strcat(str, "Personal Information\n");
235 strcat(str,"Name: ");
237 // strcpy(baka_name, pc); strcat(str, baka_name); strcat(str, " ");
238 // strcat(str,"Date: ");
239 // sprintf(st, "%s", baka_date);
240 // strcat(str, st); strcat(str, "\n");
242 Street Address: _____________________________ City: _______________ State: _____ Zip: _________
243 Phone: Cell ( ) ______________ other: ( ) ________________ E-mail:______________________
244 Name of person referred you to us, if any: ___________________________________________
246 Brand: ______________Model: ____________Login Password:____________ Serial No:_____________
247 Accessories Included (Charger, External HDD, etc.): ___________________________________________
248 Problem Description (Please be specific)
249 __________________________________________________________________________________________________________________________________________________________________________
251 Before any repairs are made, please inform us of any data that you want saved. Programs cannot be backed up and must be reinstalled after a format operation. Anything NOT listed here is permanently deleted. Check all that apply:
252 I DO NOT NEED ANY BACKUPS *All data will be deleted*
253 I DO NOT ALLOW A FORMAT *The software will not be altered in any way*
254 Personal Data (My Documents, My Pictures, My Music, My Videos, IE Favorites, Desktop)
255 E-Mail (Microsoft Outlook, Outlook Express, or Windows Mail)
256 Other (Be Specific) _______________________________________________________________
258 By signing this form I authorize Dr. Bulldog Computers to perform any necessary actions to repair problem as described above. I also understand that I left a malfunctioning unit that may have other problems in addition to the ones described. We quote for walk-in customers however in the case a device cannot be repaired, a $45 diagnostics fee will be charged and the device will be returned broken. Leaving your device with Dr. Bulldog for hardware repairs voids any warranty with any other company. All provided repair times are an estimate. In the event of data loss, Dr. Bulldog is not responsible for recovering the data in any way. I accept that all software on this device belongs to me and can provide any licensing necessary. The device also belongs to me, is NOT stolen, and has no liens attached. I also agree that Dr.Bulldog Computer is not responsible for the machine(s) that I left past 30 days after the take-in date and special orders that I make cannot be refunded.
259 Customer Signature: ______________________________ Date: ___/___/___*/
269 bakapee = (byte *)baka_id;
273 bakapee = &baka_name;
277 bakapee = &baka_phone;
281 bakapee = &baka_address;
285 bakapee = &baka_price;
293 void getstrfromdb(sword i)
297 FILE *in = fopen ( BAKADB, "r+" );
298 if(found_id>0) dbvar(i);
299 while ( fgets ( buff, sizeof buff, in ) != NULL )
301 pc = strtok(buff, SEPE);
302 if(found_id==atoi(pc))
311 pc = strtok(NULL, SEPE);
318 pc = strtok(SEPE, NULL);
326 void cmpstrfromdb(word i)
331 FILE *in = fopen ( BAKADB, "r+" );
333 while ( fgets ( buff, sizeof buff, in ) != NULL )
335 pc = strtok(buff, SEPE);
339 pc = strtok(NULL, SEPE);
341 if(strcmp(bakapee, pc)<1)