You are on page 1of 2

import java.util.

ArrayList;
import java.util.Date;
import java.util.Scanner;

public class InventorySystem {

static ArrayList<Supplier> supplierList = new ArrayList<Supplier>();


static ArrayList<Purchases> purchasesList = new ArrayList<Purchases>();

static Scanner s = new Scanner(System.in);


public static int displayMenu(){

System.out.println("1. Supplier Details\n 2. Enter Purchase Invoice 3.


Show All Stock Balances as on Now" +
"4. Show outstanding dues to Suppliers\n5. Customers Membersship\n6. Sales to
Customers"+
"7. GST Credit\n 8. Show Day registers\n 9. Expiry Due Items.\n 10. Enter
Damaged Goods:");
System.out.println("Enter the choice:");
Scanner s = new Scanner(System.in);
int choice = s.nextInt();
return choice;
}

public static void main(String[] args) {


int choice = displayMenu();

switch(choice){
case 1:
while(true){
System.out.println("Enter Supplier Details:");
System.out.println("Enter Supplier Id:");
String supplierId = s.next();
System.out.println("Enter Company Name:");
String companyName = s.next();
System.out.println("Enter contact Number:");
String contactNumber = s.next();
System.out.println("Enter Address:");
String address = s.next();
System.out.println("Enter city:");
String city = s.next();

Supplier sp = new Supplier();

sp.setSupplierId(supplierId);sp.setCompanyName(companyName);

sp.setAddress(address);sp.setCity(city);sp.setContactNumber(contactNumber);
supplierList.add(sp);
System.out.println("Do you wanna add more
suppliers:(true/false)");
boolean flag = s.nextBoolean();
if(!flag){
System.out.println("Press 9 to goto main
Menu:");
String n = s.next();
if(n.equals("9")){
displayMenu();
break;
}
}
}
case 2: System.out.println("Enter Purchase Invoices:");
while(true){
Purchases ps = new Purchases();
ps.setPurchaseDate(new Date());
System.out.println("Enter Supplier Id:");
String supplierId = s.next();
System.out.println("Enter Invoice Number:");
int invoiceNo = s.nextInt();
System.out.println("Enter Goods Code:");
String goodsCode = s.next();
System.out.println("Enter no of Items:");
int items = s.nextInt();
System.out.println("Enter purchase Unit rate:");
double pur = s.nextDouble();
double grossValue = items*pur;
System.out.println("Enter GST:");
double gst = s.nextDouble();
double gst_per_item = grossValue*(gst/100);
double totalValue = grossValue+gst_per_item;
double salesUnitRate = s.nextDouble();
Date expiryDate = new Date();
System.out.println("Enter expiry Date:");
String ed = s.next();
String ds[] = ed.split("/");
expiryDate.setDate(Integer.parseInt(ds[0]));
expiryDate.setMonth(Integer.parseInt(ds[1]));
expiryDate.setYear(Integer.parseInt(ds[2]));

ps.setExpiryDate(expiryDate);
ps.setSalesUnitRate(salesUnitRate);
ps.setSalesUnitRate(salesUnitRate);
ps.setGst(gst);
ps.setTotalValue(totalValue);
ps.setGrossValue(grossValue);
ps.setPurchaseUnitRate(pur);
ps.setNumofItems(items);
ps.setGoodsCode(goodsCode);
ps.setInvoiceNumber(invoiceNo);
ps.setSupplierId(supplierId);
}

}
//System.out.println(supplierList);
}

You might also like