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 numer
43 byte baka_name[64]; //name of client
44 byte baka_phone[64]; //name of client
45 byte baka_address[64]; //name of client
46 byte baka_desc[4096]; //Description of the problem
48 byte baka_price; //price
49 word baka_done; //is it done?
57 byte str[BAKAPEE], buff[BAKAPEE], st[24];
61 FILE *in = fopen ( "baka.db", "r+" );
67 out = fopen ( "baka.db", "w+" );
68 printf("\nNew database being made ^^;\n");
69 printf("Work order number: ");
70 scanf("%ud\n", &baka_id); // input~
71 if(baka_id==0) baka_id=1;
81 while ( fgets ( buff, sizeof buff, in ) != NULL );
83 pc = strtok(buff, SEPE);
86 out = fopen ( "baka.db", "a+" );
87 //printf(" baka_id=%u\n", baka_id);
89 sprintf(st, "%u", baka_id);
93 printf("Client's name: ");
94 scanf("%s", &(baka_name)); // input~
96 //TODO make uppercased names
100 strcat(str,baka_name); strcat(str,SEPE);
103 printf("Client's Phone Number: ");
104 scanf("%s", &(baka_phone)); // input~
105 }else getstrfromdb(2);
106 strcat(str,baka_phone); strcat(str,SEPE);
109 printf("Client's Address: ");
110 scanf("%s", &(baka_address)); // input~
111 }else getstrfromdb(3);
112 strcat(str,baka_address); strcat(str,SEPE);
114 printf("Description of the Problem: ");
115 scanf("%s", &(baka_desc)); // input~
116 strcat(str,baka_desc); strcat(str,SEPE);
118 memset(st, 0, sizeof st); //reset str~
119 baka_date=time(NULL);
120 sprintf(st, "%s", ctime(&baka_date));
122 p++; /* 'N' is not in `p` */
123 p[strlen(p)-1] = 0; /* 'P' is not in `p` (and it isn't in `mystr` either) */
124 //printf("[%s]", st);
125 strcat(str, st); strcat(str,SEPE);
128 strcat(str, "0"); strcat(str,SEPE);
135 fwrite(str, strlen(str), 1, out);
141 void bddone(iword id)
143 byte buff[BAKAPEE], st[16], str[BAKAPEE];
147 FILE *in = fopen ( "baka.db", "r" );
149 while ( fgets ( buff, sizeof buff, in ) != (NULL) )
152 pc = strtok(buff, SEPE);
160 sprintf(st, "%d", "1");
162 p++; /* 'N' is not in `p` */
163 p[strlen(p)-4] = st[0]; /* 'P' is not in `p` (and it isn't in `mystr` either) */
164 //printf("[%d]\n", eed);
168 out = fopen ( "baka.db", "w+" );
169 fwrite(str, strlen(str), 1, out);
174 void bdchange(iword id, byte i, sword t)
176 byte buff[BAKAPEE], str[BAKAPEE];
181 FILE *in = fopen ( "baka.db", "r" );
185 while ( fgets ( buff, sizeof buff, in ) != (NULL) )
188 pc = strtok(buff, SEPE);
197 //sprintf(st, "%f", );
199 p++; /* 'N' is not in `p` */
200 p[strlen(p)+(t*4)] = ((*bakapee)+(iword)(i)); /* 'P' is not in `p` (and it isn't in `mystr` either) */
201 //printf("[%d]\n", eed);
205 out = fopen ( "baka.db", "w+" );
206 fwrite(str, strlen(str), 1, out);
213 byte str[BAKAPEE*16], boo[BAKAPEE], st[24];
214 FILE *out = fopen ( "sheet.txt", "w+" );
217 strcpy(str, "Dr. Bulldog Computers (318) 255-0333\n");
218 strcat(str, "208 N Trenton Street Monday - Friday\n");
219 strcat(str, "Ruston, LA 71270 10:00 AM – 6:00 PM\n");
220 strcat(str, "Personal Information\n");
221 strcat(str,"Name: ");
223 // strcpy(baka_name, pc); strcat(str, baka_name); strcat(str, " ");
224 // strcat(str,"Date: ");
225 // sprintf(st, "%s", baka_date);
226 // strcat(str, st); strcat(str, "\n");
228 Street Address: _____________________________ City: _______________ State: _____ Zip: _________
229 Phone: Cell ( ) ______________ other: ( ) ________________ E-mail:______________________
230 Name of person referred you to us, if any: ___________________________________________
232 Brand: ______________Model: ____________Login Password:____________ Serial No:_____________
233 Accessories Included (Charger, External HDD, etc.): ___________________________________________
234 Problem Description (Please be specific)
235 __________________________________________________________________________________________________________________________________________________________________________
237 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:
238 I DO NOT NEED ANY BACKUPS *All data will be deleted*
239 I DO NOT ALLOW A FORMAT *The software will not be altered in any way*
240 Personal Data (My Documents, My Pictures, My Music, My Videos, IE Favorites, Desktop)
241 E-Mail (Microsoft Outlook, Outlook Express, or Windows Mail)
242 Other (Be Specific) _______________________________________________________________
244 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.
245 Customer Signature: ______________________________ Date: ___/___/___*/
255 bakapee = (byte *)baka_id;
259 bakapee = &baka_name;
263 bakapee = &baka_phone;
267 bakapee = &baka_address;
271 bakapee = &baka_price;
279 void getstrfromdb(sword i)
283 FILE *in = fopen ( "baka.db", "r+" );
284 if(found_id>0) dbvar(i);
285 while ( fgets ( buff, sizeof buff, in ) != NULL )
287 pc = strtok(buff, SEPE);
288 if(found_id==atoi(pc))
297 pc = strtok(NULL, SEPE);
304 pc = strtok(SEPE, NULL);
312 void cmpstrfromdb(word i)
317 FILE *in = fopen ( "baka.db", "r+" );
319 while ( fgets ( buff, sizeof buff, in ) != NULL )
321 pc = strtok(buff, SEPE);
325 pc = strtok(NULL, SEPE);
327 if(strcmp(bakapee, pc)<1)