Customer Billing System Project

Customer Billing System Project In C Language

In today’s tutorial, we will create a simple Customer Billing System Project In C Programming Language. This Customer Billing System Project’s main purpose is to store the customer’s billing reports and their information. The program is in the C programming language. It creates a broad understanding of how restaurant billing information, such as their name, address, contact numbers, etc. The user interface is relatively straightforward, with a standard screen design, so that staff may quickly become acquainted with it.

A simple and easy-to-understand project based on the C programming language that involves the keeping of personal records for information gathering. Furthermore, this mini c programming project includes a minimal number of features. It is suitable for usage as a college project for first-year IT students studying C programming.

About Customer Billing System Project

The Customer Billing System Project is a simple console application that shows how the C programming language is handy in practice. And it’s potential as well as to construct a tool for charging clients in any department store, store, café, etc. You can use this program to keep track of details about your regular clients, such as name, address, phone number, the amount paid, amount owing, date of payment, and so forth. If you have a new client, you can also add and update accounts at any time. The Customer Billing System Project in C source code was totally written in C; no graphics were used.

Some Important Terms

  • #include <stdio.h>: This is the first thing you will need to put in your file before you run the C project. It is one of the important header files that the C compiler will detect. This header file will us to use the print and scan statement in our program, i.e it stands for standard input-output. Make sure you include this header file above your code.

How To Run Employee Management System In C Programming

All you need to have is codeblocks for C/C++ integration. You can download one from the link given above the table. Download the editor and follow these simple steps.

  • The first step is to download the project and unzip it.
  • Then, extract the project and check for the files in it.
  • Once you are ok with the available files open the C file in the editor.
  • Then, hit run, and there you go your project is up and running.
  • There you go, your project is up and running.
  • If any error occurs then, leave a comment.

Code Implementation of Customer Billing System Project In C Programming

 #include<stdio.h>
 #include<conio.h>
 #include<stdlib.h>

 void input();
 void writefile();
 void search();
 void output();

 struct date{
	   int month;
	   int day;
	   int year;
	   };

  struct account {
	int number;
	char name[100];
	int acct_no;
	float mobile_no;
	char street[100];
	char city[100];
	char acct_type;
	float oldbalance;
	float newbalance;
	float payment;
	struct date lastpayment;
  }customer;
  int tl,sl,ts;
 void main()
	{
	  int i,n;
	  char ch;
	  clrscr();

	  _setcursortype(_NOCURSOR);
	  printf("   CUSTOMER BILLING SYSTEM:\n\n");
	  printf("===============================\n");
	  printf("\n1:    to add account on list\n");
	  printf("2:    to search customer account\n");
	  printf("3:    exit\n");
	  printf("\n================================\n");
	  do{
	       printf("\nselect what do you want to do?");
	       ch=getche();
	  }while(ch<='0' || ch>'3');
	  switch(ch){
		case '1':
			clrscr();
			printf("\nhow many customer accounts?");
			scanf("%d",&n);
			for(i=0;i<n;i++){
				input();
				if(customer.payment>0)
					customer.acct_type=(customer.payment<0.1*customer.oldbalance)? 'O': 'D';
				else
					customer.acct_type=(customer.oldbalance>0)?'D' : 'C';
				customer.newbalance=customer.oldbalance - customer.payment;
				writefile();
			}
			main();
		case '2':
			clrscr();
			printf("search by what?\n");
			printf("\n1 --- search by customer number\n");
			printf("2 --- search by customer name\n");
			search();
			ch=getche();
			main();
		case '3':
			clrscr();
			delay(700);
			textcolor(RED);
			gotoxy(25,25);
			cprintf("\nA PROJECT BY BIDUR & SUJAN");
			delay(1500);
			exit(1);
	  }
 }


   void input()
	{
	  FILE *fp=fopen("bidur.dat","rb");
	  fseek (fp,0,SEEK_END);
	  tl=ftell(fp);
	  sl=sizeof(customer);
	  ts=tl/sl;
	  fseek(fp,(ts-1)*sl,SEEK_SET);
	  fread(&customer,sizeof(customer),1,fp);
	  printf("\ncustomer no:%d\n",++customer.number);
	  fclose(fp);
	  printf("         Account number:");
	  scanf("%d",&customer.acct_no);
	  printf("\n       Name:");
	  scanf("%s",customer.name);
	  printf("\n       mobile no:");
	  scanf("%f",&customer.mobile_no);
	  printf("         Street:");
	  scanf("%s",customer.street);
	  printf("         City:");
	  scanf("%s",customer.city);
	  printf("         Previous balance:");
	  scanf("%f",&customer.oldbalance);
	  printf("         Current payment:");
	  scanf("%f",&customer.payment);
	  printf("         Payment date(mm/dd/yyyy):");
	  scanf("%d/%d/%d",&customer.lastpayment.month,&customer.lastpayment.day,&customer.lastpayment.year);
	  return;
   }

   void writefile()
   {
	  FILE *fp;
	  fp=fopen("bidur.dat","ab");
	  fwrite(&customer,sizeof(customer),1,fp);
	  fclose(fp);
	  return;
   }

   void search()
   {
	 char ch;
	 char nam[100];
	 int n,i,m=1;
	 FILE *fp;
	 fp=fopen("bidur.dat","rb");
	 do{
		printf("\nenter your choice:");
		ch=getche();
	 }while(ch!='1' && ch!='2');
	 switch(ch){
	      case '1':
		    fseek(fp,0,SEEK_END);
		    tl=ftell(fp);
		    sl=sizeof(customer);
		    ts=tl/sl;
		    do{
			printf("\nchoose customer number:");
			scanf("%d",&n);
			if(n<=0 || n>ts)
			printf("\nenter correct\n");
			else{
			    fseek(fp,(n-1)*sl,SEEK_SET);
			    fread(&customer,sl,1,fp);
			    output();
			}
			printf("\n\nagain?(y/n)");
			ch=getche();
		    }while(ch=='y');
		    fclose(fp);
		    break;
	      case '2':
		    fseek(fp,0,SEEK_END);
		    tl=ftell(fp);
		    sl=sizeof(customer);
		    ts=tl/sl;
		    fseek(fp,(ts-1)*sl,SEEK_SET);
		    fread(&customer,sizeof(customer),1,fp);
		    n=customer.number;

		    do{
			printf("\nenter the name:");
			scanf("%s",nam);
			fseek(fp,0,SEEK_SET);
			for(i=1;i<=n;i++)
			{
			     fread(&customer,sizeof(customer),1,fp);
			     if(strcmp(customer.name,nam)==0)
			     {
				output();
				m=0;
				break;
			     }
			}
			if(m!=0)
			printf("\n\ndoesn't exist\n");
			printf("\nanother?(y/n)");
			ch=getche();
		    }while(ch=='y');
		    fclose(fp);
	      }
	      return;
	 }



   void output()
	 {
	   printf("\n\n    Customer no    :%d\n",customer.number);
	   printf("    Name 	   :%s\n",customer.name);
	   printf("    Mobile no      :%.f\n",customer.mobile_no);
	   printf("    Account number :%d\n",customer.acct_no);
	   printf("    Street         :%s\n",customer.street);
	   printf("    City           :%s\n",customer.city);
	   printf("    Old balance    :%.2f\n",customer.oldbalance);
	   printf("    Current payment:%.2f\n",customer.payment);
	   printf("    New balance    :%.2f\n",customer.newbalance);
	   printf("    Payment date   :%d/%d/%d\n\n",customer.lastpayment.month,customer.lastpayment.day,customer.lastpayment.year);
	   printf("    Account status :");
	   textcolor(128+RED);
	   switch(customer.acct_type)
	      {
	      case 'C':
		 cprintf("CURRENT\n\n");
		 break;
	      case 'O':
		 cprintf("OVERDUE\n\n");
		 break;
	      case 'D':
		 cprintf("DELINQUENT\n\n");
		 break;
	      default:
		 cprintf("ERROR\\n\n");
	      }
	      textcolor(WHITE);
	      return;
	   }

Code Explanation

Some of the user-defined functions:

Although this project did not use any images, it benefited greatly from the use of user-defined structures and functions. The primary user-defined functions used in this C project are as follows:

  • void input()
  • void writefile()
  • void search()
  • void output()

It asks for and enters data such as name, address, phone number, and amount, when the method void input() uses, to create a new customer account. To store a customer’s data and create a file on the computer’s hard drive, another function called void writefile() was utilized.

Using the customer’s name or number, the function void search() was used to look for previously saved accounts. This Customer Billing System Project in C’s fourth and final user-defined function, void output(), is used to show the outcome on the console.

In the Customer Billing System, the structure is very effective to combine the various data kinds into a single entity. While other variables (name, number, street, payment amount, etc.) are in the account structure, date variables (day, month, and year) are together in the data structure.

The application for the Customer Billing System is very user-friendly. Double-click the executable file to launch the software, then select one of the following three possibilities:

  1. To add an account, click here.
  2. To find an account, click here.
  3. To leave

Features

  • It is capable of hosting an infinite number of accounts, and more can be added at any time.
  • Simple calculations have been coded into the project code, including the calculation of due amounts, balances, and so forth.
  • You can look for an account using either the customer’s name or the customer’s number by utilizing the Customer Billing System project in C.
  • A negative balance is displayed to indicate the amount that has to be paid.
  • If you no longer require the software, you can shut it off instantly from the main menu.

Final Words

This is for today’s tutorial. Hope you guys like it.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.