Package com.finiac.model

Examples of com.finiac.model.Sales


  //  final DateFormat df = new SimpleDateFormat("dd/MM/yyyy");
        final Calendar c = Calendar.getInstance();
        long billId;
        int month;
        Bill bill1 = new Bill();
        Sales sales= new Sales();
        String dateInFormat;
        month=c.get(Calendar.MONTH)+1;
        if(month<10)
          dateInFormat="0"+month+"/";
        else
          dateInFormat=month+"/";
        if(c.get(Calendar.DAY_OF_MONTH)<10) // value of month starts fro        
          dateInFormat+="0"+c.get(Calendar.DAY_OF_MONTH)+"/";
        else
          dateInFormat+=c.get(Calendar.DAY_OF_MONTH)+"/";
       
      dateInFormat+= c.get(Calendar.YEAR);
      if(request.getSession().getAttribute("billId")!=null)
      {
        float amount=0;
        billId=Long.parseLong(request.getSession().getAttribute("billId").toString());
        System.out.println("control in " +billId);
        List<Sales> salesList= salesDAO.selectByBillId(billId);
        for(int i=0;i<salesList.size();i++)
      {
        sales = salesList.get(i);
        amount+=sales.getTotal();
     
        bill1=billDAO.selectBill(billId);
        bill1.setAmount(amount);
        billDAO.updateBill(bill1);
      }
View Full Code Here


        if(product.getQtyAvail()< Float.parseFloat(stockAlertLimit.getValue()))
          stockAlertString="stockAlert="+temp;   
      billId= Long.parseLong(request.getSession().getAttribute("billId").toString());
      Bill bill = new Bill();
      bill= billDAO.selectBill(billId);
      Sales sales= new Sales(product, qtySold, total,bill ,1); //Sales(Product productId, float qtySold, float total, long billId , int isActive)
      salesDAO.newSalesEntry(sales)
      return new ModelAndView("redirect:listBill.htm?"+stockAlertString);
    }

   
View Full Code Here

 
    long billId;
    billId= Long.parseLong(request.getSession().getAttribute("billId").toString());
    ModelMap modelMap = new ModelMap();
    modelMap.addAttribute("items", salesDAO.getSalesEntries(billId));
    modelMap.addAttribute("bill", new Sales());
    return new ModelAndView("newBill",modelMap);
  }
View Full Code Here

  public ModelAndView deleteSalesEntry(HttpServletRequest request, HttpServletResponse response)throws Exception
  {
    int id=Integer.parseInt(request.getParameter("id"));
    float qtySold,qtyAvail;
    Product productId;
    Sales sales= new Sales();
    List<Sales> salesList= salesDAO.selectById(id);
    for(int i=0;i<salesList.size();i++)
    {
      sales = salesList.get(i);
    }
    sales.setIsActive(0);
    qtySold = sales.getQtySold();
    productId=sales.getProductId();
    qtyAvail=productId.getQtyAvail();
    productId.setQtyAvail(qtyAvail+qtySold);
    productDAO.updateProduct(productId);
    salesDAO.updateSalesEntry(sales);
    return new ModelAndView("redirect:listBill.htm");
View Full Code Here

      long billId=Long.parseLong(request.getParameter("billNo"));
      System.out.println(billId);
      modelMap.addAttribute("items", salesDAO.selectByBillId(billId));
    }
   
    modelMap.addAttribute("bill", new Sales());
    return new ModelAndView("prevEntry",modelMap);
  }
View Full Code Here

  {
    if(request.getSession().getAttribute("billId")!=null// to update total field of bill table of request is comming
      {    System.out.println("control in ");                       // from add new list;
        float amt=0;
        long billId;
        Sales sales= new Sales();
        Bill bill1= new Bill();
        billId=Long.parseLong(request.getSession().getAttribute("billId").toString());
        System.out.println("control in " +billId);
        List<Sales> salesList= salesDAO.selectByBillId(billId);
        for(int i=0;i<salesList.size();i++)
      {
        sales = salesList.get(i);
        amt+=sales.getTotal();
     
        bill1=billDAO.selectBill(billId);
        bill1.setAmount(amt);
        billDAO.updateBill(bill1);
      }
View Full Code Here

    String date= request.getParameter("date");
    if(date=="")
      date="00/00/0000";
    ModelMap modelMap = new ModelMap();
    modelMap.addAttribute("items", salesDAO.selectByDate(date));
    modelMap.addAttribute("bill", new Sales());
    return new ModelAndView("dailyAccountSummary",modelMap);
  }
View Full Code Here

      month="00";
      year="00";
    }
    ModelMap modelMap = new ModelMap();
    modelMap.addAttribute("items", salesDAO.selectByMonth(month,year));
    modelMap.addAttribute("bill", new Sales());
    return new ModelAndView("monthlyAccountSummary",modelMap);
  }
View Full Code Here

  @SuppressWarnings("unchecked")
  @Override
  public List<Sales> selectByDate(String date) {
 
    Sales sales = new Sales();
    Sales salesFinal = new Sales();
    int addFlag=0;
    ArrayList<Sales> finalSalesList = new ArrayList<Sales>();
    List<Sales> salesList =hibernateTemplate.find("from Sales where isActive=1");
    for(int i=0;i<salesList.size();i++)
    {
      sales = salesList.get(i);
      if(sales.getBillId().getDate().equals(date))
      {
        addFlag=0;
        for(int j=0;j<finalSalesList.size();j++)
        {
          salesFinal = finalSalesList.get(j);
          if(salesFinal.getProductId().getId()== sales.getProductId().getId())
          {
            addFlag=1;
            salesFinal.setQtySold(sales.getQtySold()+salesFinal.getQtySold());
            salesFinal.setTotal(sales.getTotal()+salesFinal.getTotal());
          }
        }
        if(addFlag==0)
          finalSalesList.add(sales);
      }
View Full Code Here


  @SuppressWarnings("unchecked")
  @Override
  public List<Sales> selectByMonth(String month, String year) {
    Sales sales = new Sales();
    String year1,month1;
    Sales salesFinal = new Sales();
    int addFlag=0;
    ArrayList<Sales> finalSalesList = new ArrayList<Sales>();
    List<Sales> salesList =hibernateTemplate.find("from Sales where isActive=1");
    for(int i=0;i<salesList.size();i++)
    {
      sales = salesList.get(i);
      month1= sales.getBillId().getDate().substring(0, 2);
      year1=sales.getBillId().getDate().substring(6, 10);
     
      if(month1.equals(month) && year1.equals(year1))
      {
        addFlag=0;
        for(int j=0;j<finalSalesList.size();j++)
        {
          salesFinal = finalSalesList.get(j);
          if(salesFinal.getProductId().getId()== sales.getProductId().getId())
          {
            addFlag=1;
            salesFinal.setQtySold(sales.getQtySold()+salesFinal.getQtySold());
            salesFinal.setTotal(sales.getTotal()+salesFinal.getTotal());
          }
        }
        if(addFlag==0)
          finalSalesList.add(sales);
      }
View Full Code Here

TOP

Related Classes of com.finiac.model.Sales

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.