Code:
//*************************************Service Cost*************************************************
void service_data(void)
{
Client detail;
int hwcost=0;
char hw;
int swcost=0;
char sw;
int tcost=0;
int labourcost=0;
printf("****************************************************************************\n");
printf("*****************************Service Details********************************\n");
printf("****************************************************************************\n\n");
printf("Please enter whether PC is a laptop or Desktop\n");
gets(detail.type);
printf("Please enter the manufacturer\n");
gets(detail.brand);
printf("Please enter the PC's model number\n");
gets(detail.model_no);
gets(detail.ID);
printf("\n____________________________________________________________\n");
printf("\t\t\t------Service Cost\n");
printf("\n____________________________________________________________\n");
printf("Enter the hardware installed if any and separate each type by forward slash'/'\n");
printf("eg. CPU: Intel Core i7 2.6Ghz/ MOBO: ASUS RAMPAGE Z68LX/ RAM: 2X Corsair Vengance 8GB");
scanf("%c",&hw);
printf("Please enter the total cost of hardware\n");
scanf("%d", &hwcost);
printf("Enter the software installed if any and separate each type by forward slash'/'\n");
printf("eg. AV: bitdefender Internet Security 2012/ Office tools: Microsoft Office Student/ OS: Windows 8 home premium\n");
scanf("%c",&sw);
printf("Please enter the total cost of software\n");
scanf("%d",&swcost);
printf("Please enter the labour cost\n");
scanf("%d",&labourcost);
tcost= hwcost + swcost + labourcost;
printf("The total service cost is %d", tcost);
fp=fopen(Services,"a+");
fprintf(fp,"Record created at %12s\n", __TIME__);
fprintf(fp,"The requested day was : %s", __DATE__);
fprintf(fp,"The PC type is : %s",detail.type); //writes to file
fprintf(fp,"\nPC manufactorer is: %s",detail.brand); //writes to file
fprintf(fp,"\nPC model number is: %d",detail.model_no); //writes to file
fprintf(fp,"\nThe client owner is ID: %d", detail.ID);
fprintf(fp,"Hardware installed in system include: %c\n",hw);
fprintf(fp,"The hardware cost is: %d\n",hwcost); //writes to file
fprintf(fp,"Software installed in system include: %c\n",sw);
fprintf(fp,"The software cost is: %d\n",swcost); //writes to file
fprintf(fp,"The labour cost is: %d\n",labourcost); //writes to file
fprintf(fp,"The overall cost is: %d\n", tcost);
fclose(fp); //close file
serviced();
}
//******************************Customer Information******************************
void client_information(void)
{ // Starting point of the function
Client data; // declaration of character
system("cls"); // Clears the screen
printf("\n\n\n\t\t************************ Customer Record *******************\n\n");//printf statement
printf(" Enter client's First Name\n\n"); //printf statement
gets(data.firstname); // gets the input
printf("Enter client's Last Name\n\n"); // printf statement
gets(data.surname); //gets the input
printf("Enter client's Phone Number\n\n"); // printf statement
gets(data.Contact_No); //gets input
printf("Enter client's Address\n\n"); // printf statement
gets(data.address); //gets input
printf("Enter customer ID Number\n\n"); // printf statement
gets(data.ID); //gets input
fp1=fopen(customer,"a+"); // open file
fprintf(fp1,"First Name is: %s\n",data.firstname); // writes to file
fprintf(fp1,"Last Name is: %s\n",data.surname); // writes to file
fprintf(fp1,"Client's Phone Number is:- %s\n",data.Contact_No); // writes to file
fprintf(fp1,"Address is: %s\n",data.address); // writes to file
fprintf(fp1,"ID number is:%d\n",data.ID); // writes to file
fclose(fp1); // close file
system("PAUSE"); //Pause the screen
system("cls"); //Clears the screen
clientdata();
}