Package com.centraview.account.common

Examples of com.centraview.account.common.ItemElement


  {
    if (itemLines != null)
    {
      for(int i = 0; i < itemLines.size(); i++)
      {
        ItemElement ie = (ItemElement)itemLines.get(new Integer(i));
        IntMember LineId = (IntMember)ie.get("LineId");
        IntMember Itemid = (IntMember)ie.get("ItemId");
        StringMember SKU = (StringMember)ie.get("SKU");
        StringMember Description = (StringMember)ie.get("Description");
        IntMember Quantity = (IntMember)ie.get("Quantity");
        FloatMember PriceEach = (FloatMember)ie.get("Price");
        FloatMember PriceExtended = (FloatMember)ie.get("PriceExtended");
        FloatMember TaxAmount = (FloatMember)ie.get("TaxAmount");

        lineid[i] = (String)LineId.getMemberValue();
        itemid[i] = (String)Itemid.getMemberValue();
        sku[i] = (String)SKU.getMemberValue();
        description[i] = (String)Description.getMemberValue();
View Full Code Here


    itemLines = new ItemLines();
    if(itemid != null)
    {
      for(int i = 0; i < itemid.length; i++)
      {
        ItemElement ie = new ItemElement();
        IntMember LineId = new IntMember("LineId",Integer.parseInt(lineid[i]),'D',"",'T',false,20);
        IntMember ItemId = new IntMember("ItemId",Integer.parseInt(itemid[i]),'D',"",'T',false,20);
        IntMember Quantity = new IntMember("Quantity",Integer.parseInt(quantity[i]),'D',"",'T',false,20);
        priceeach[i] = priceeach[i].replaceAll(",","");
        FloatMember  PriceEach = new FloatMember("Price",new Float(priceeach[i]),'D',"",'T',false,20);
        StringMember SKU = new StringMember("SKU",sku[i],'D',"",'T',false);
        StringMember Description = new StringMember("Description",description[i],'D',"",'T',false);
        if(priceExtended[i] != null){
          priceExtended[i] = priceExtended[i].replaceAll(",","");
        }else{
          priceExtended[i] = "";
        }
        FloatMember  PriceExtended = new FloatMember("PriceExtended",new Float(priceExtended[i]),'D',"",'T',false,20);
        taxAmount[i] = taxAmount[i].replaceAll(",","");
        FloatMember  TaxAmount = new FloatMember("TaxAmount",new Float(taxAmount[i]),'D',"",'T',false,20);

        ie.put ("LineId",LineId);
        ie.put ("ItemId",ItemId);
        ie.put ("SKU",SKU);
        ie.put ("Description",Description);
        ie.put ("Quantity",Quantity);
        ie.put ("Price",PriceEach);
        ie.put ("PriceExtended",PriceExtended);
        ie.put ("TaxAmount",TaxAmount);

        String status = linestatus[i];
        if(status == null)
        status = "New";
        ie.setLineStatus(status);

        itemLines.put(new Integer(i),ie);
      }
    }
  }
View Full Code Here

        Set itemSet = itemLines.keySet();
        Iterator iter = itemSet.iterator();
        while (iter.hasNext()) {
          HashMap formItemInfo = new HashMap();
          String treeMapKey = (String)iter.next();
          ItemElement myItem = (ItemElement)itemLines.get(treeMapKey);

          formItemInfo.put("itemSku", (String)(myItem.getMember("SKU")).getMemberValue());
          formItemInfo.put("description", (String)(myItem.getMember("Description")).getMemberValue());

          Number lineQuantityFloat = (Number)(myItem.getMember("Quantity")).getMemberValue();
          totalItems += lineQuantityFloat.intValue();
          formItemInfo.put("quantity", new Integer(lineQuantityFloat.intValue()));
         
          if (myItem.getMember("Price") != null) {
            Number priceEach = (Number)(myItem.getMember("Price")).getMemberValue();
            formItemInfo.put("priceEach", priceEach);
          } else {
            formItemInfo.put("priceEach", new Float(0));
          }

          Number lineSubTotal = new Float(0);
          if (myItem.getMember("PriceExtended") != null) {
            lineSubTotal = (Number)(myItem.getMember("PriceExtended")).getMemberValue();
          }
          formItemInfo.put("price", lineSubTotal);
         
          orderSubTotal = new Float(orderSubTotal.floatValue() + lineSubTotal.floatValue());
View Full Code Here

        Iterator iter = itemSet.iterator();
        while (iter.hasNext())
        {
          HashMap formItemInfo = new HashMap();
          String treeMapKey = (String)iter.next();
          ItemElement myItem = (ItemElement)itemLines.get(treeMapKey);

          formItemInfo.put("itemSku", (String)(myItem.getMember("SKU")).getMemberValue());
          formItemInfo.put("description", (String)(myItem.getMember("Description")).getMemberValue());
         
          Float lineQuantityFloat = (Float)(myItem.getMember("Quantity")).getMemberValue();
          totalItems += lineQuantityFloat.intValue();
          formItemInfo.put("quantity", new Integer(lineQuantityFloat.intValue()));
         
          Float priceEach = (Float)(myItem.getMember("PriceEach")).getMemberValue();
          formItemInfo.put("priceEach", priceEach);
         
          Float lineSubTotal = (Float)(myItem.getMember("PriceExtended")).getMemberValue();
          formItemInfo.put("price", lineSubTotal);
         
          invoiceSubTotal = new Float(invoiceSubTotal.floatValue() + lineSubTotal.floatValue());

          // add the hashmap of item info to the arraylist of items
View Full Code Here

  }


  public void addLine (AccountingLineElement ale) {

    ItemElement ie = null;
    try
    {
      ie = (ItemElement)ale;
    }catch (Exception e)
    {
        System.out.println("ItemLines:addLine: Exception caught: Cannot add this Line");
        return;
    }//catch

    int maxIndex = 0;
    maxIndex = this.getMaxLineId();
    maxIndex +=1;
    ie.setElementId(maxIndex);
    String newKey = ""+((ListElementMember)ie.get(this.getSortMember())).getSortString()+maxIndex ;
    this.put(newKey, ie);

  }//addline
View Full Code Here

        Iterator iter = itemSet.iterator();
        while (iter.hasNext())
        {
          HashMap formInvoiceInfo = new HashMap();
          String key = (String)iter.next();
          ItemElement myItem = (ItemElement)paymentLines.get(key);

          String invoiceNumber = (String)myItem.getMember("InvoiceNum").getMemberValue();
          formInvoiceInfo.put("invoiceNumber", new Integer(invoiceNumber));

          formInvoiceInfo.put("date", myItem.getMember("Date").getMemberValue());

          Number total = (Number)myItem.getMember("Total").getMemberValue();
          formInvoiceInfo.put("total", new Float(total.floatValue()));

          Number amountDue = (Number)myItem.getMember("AmountDue").getMemberValue();
          formInvoiceInfo.put("amountDue", new Float(amountDue.floatValue()));

          Number amountApplied = (Number)myItem.getMember("AmountApplied").getMemberValue();
          formInvoiceInfo.put("amountApplied", new Float(amountApplied.floatValue()));

          invoiceList.add(formInvoiceInfo);
        }
      }
View Full Code Here

            itr = itemLines.keySet().iterator();
            while (itr.hasNext())
            {
              Object obj = itr.next();
              ItemElement ILE = (ItemElement)itemLines.get(obj);
              IntMember ItemId = (IntMember)ILE.get("ItemId");
              Integer currItemId = (Integer)ItemId.getMemberValue();
              if ( currItemId.intValue() == removeToken)
              {
                String status = ILE.getLineStatus();
                if (status.equals("Active"))
                {
                  ILE.setLineStatus("Deleted");
                }//end of if (status.equals("Active"))
                else  if (status.equals("New"))
                {
                  removeKeys.add(obj);
                }//end of else  if (status.equals("New"))
              }//end of if ( currItemId.intValue() == removeToken)
            }//end of while (itr.hasNext())
          }//end of while (st.hasMoreTokens())

          for(int i=0; i<removeKeys.size(); i++)
          {
            itemLines.remove(removeKeys.get(i));
          }//end of for(int i=0; i<removeKeys.size(); i++)
        }//end of if (itemLines != null)
        ((InvoiceForm)form).setJurisdictionVec(taxJurisdiction);
        ((InvoiceForm)form).setItemLines(itemLines);
        request.setAttribute(AccountConstantKeys.TYPEOFOPERATION,"REMOVEITEM");
      }// end of else if ( request.getParameter(AccountConstantKeys.TYPEOFOPERATION).equals("REMOVEITEM") )
      else if ( request.getParameter(AccountConstantKeys.TYPEOFOPERATION).equals("ADDITEM") )
      {

        String newItemID = request.getParameter("theitemid");

        ItemList IL = null ;

        ListGenerator lg = ListGenerator.getListGenerator(dataSource);//get the List Generator object for Listing
        IL = (ItemList )lg.getItemList( individualID , 1, 10 , "" , "ItemID");//called when the request for the list is for first time


        StringTokenizer st;
        String token, nextItr;
        if (newItemID != null)
        {
          st = new StringTokenizer(newItemID, ",");
          ItemLines itemLines = ((InvoiceForm)form).getItemLines();
          Integer intJurisdictionID = ((InvoiceForm)form).getJurisdictionID();
          int jurisdictionID = intJurisdictionID.intValue();

          if(itemLines == null)
            itemLines = new ItemLines();
          int counter = itemLines.size();
          while (st.hasMoreTokens())
          {
            token   = (String)st.nextToken();
            int intToken = Integer.parseInt(token);

            Iterator itr = IL.keySet().iterator();
            while (itr.hasNext())
            {
              nextItr = (String)itr.next();
              ListElement ile = (ListElement)IL.get(nextItr);
              IntMember smid = (IntMember)ile.get("ItemID");
              Integer listItemid = (Integer)smid.getMemberValue();

              if ( listItemid.intValue() == intToken )
              {

                StringMember smName = (StringMember)ile.get("Name"); // name = description
                String name = (String) smName.getMemberValue();

                StringMember smSku  = (StringMember) ile.get("SKU");
                String sku = (String)smSku.getMemberValue();
                FloatMember dmprice  = (FloatMember) ile.get("Price");

                float price = Float.parseFloat((dmprice.getMemberValue()).toString());

                int id = ile.getElementID();

                IntMember LineId = new IntMember("LineId",0,'D',"",'T',false,20);
                IntMember ItemId = new IntMember("ItemId",id,'D',"",'T',false,20);
                IntMember  Quantity = new IntMember("Quantity",1,'D',"",'T',false,20);
                FloatMember  PriceEach = new FloatMember("Price",new Float(price),'D',"",'T',false,20);
                StringMember SKU = new StringMember("SKU",sku,'D',"",'T',false);
                StringMember Description = new StringMember("Description",name,'D',"",'T',false);
                FloatMember  PriceExtended = new FloatMember("PriceExtended",new Float(0.0f),'D',"",'T',false,20);
                FloatMember  TaxAmount = new FloatMember("TaxAmount",new Float(0.0f),'D',"",'T',false,20);

                ItemElement ie = new ItemElement(0);
                ie.put ("LineId",LineId);
                ie.put ("ItemId",ItemId);
                ie.put ("SKU",SKU);
                ie.put ("Description",Description);
                ie.put ("Quantity",Quantity);
                ie.put ("Price",PriceEach);
                ie.put ("PriceExtended",PriceExtended);
                ie.put ("TaxAmount",TaxAmount);

                ie.setLineStatus("New");
                counter += 1;
                itemLines.put(new Integer(counter), ie);
                break;
              }// end of if ( listItemid.intValue() == intToken )
            }// end of while (itr.hasNext())
View Full Code Here

    if (itemid != null)
    {
      for (int i=0;i<itemid.length;i++)
      {

        ItemElement ie = new ItemElement();
        IntMember LineId = new IntMember("LineId",Integer.parseInt(lineid[i]),'D',"",'T',false,20);
        IntMember ItemId = new IntMember("ItemId",Integer.parseInt(itemid[i]),'D',"",'T',false,20);
        IntMember Quantity = new IntMember("Quantity",Integer.parseInt(quantity[i]),'D',"",'T',false,20);
        priceeach[i] = priceeach[i].replaceAll(",","");
        FloatMember  PriceEach = new FloatMember("Price",new Float(priceeach[i]),'D',"",'T',false,20);
        StringMember SKU = new StringMember("SKU",sku[i],'D',"",'T',false);
        StringMember Description = new StringMember("Description",description[i],'D',"",'T',false);
        if(priceExtended[i] != null){
          priceExtended[i] = priceExtended[i].replaceAll(",","");
        }else{
          priceExtended[i] = "";
        }
        FloatMember  PriceExtended = new FloatMember("PriceExtended",new Float(priceExtended[i]),'D',"",'T',false,20);

        ie.put ("LineId",LineId);
        ie.put ("ItemId",ItemId);
        ie.put ("SKU",SKU);
        ie.put ("Description",Description);
        ie.put ("Quantity",Quantity);
        ie.put ("Price",PriceEach);
        ie.put ("PriceExtended",PriceExtended);

        String status = linestatus[i];
        if(status == null)
          status = "New";
        ie.setLineStatus(status);

        itemLines.put(new Integer(i),ie);
      }// end of for (int i=0;i<itemid.length;i++)
    }// end of if (itemid != null)
  }// end of public void  convertItemLines()
View Full Code Here

            itr = itemLines.keySet().iterator();
            while (itr.hasNext())
            {
              Object obj = itr.next();
              ItemElement ILE = (ItemElement)itemLines.get(obj);
              IntMember ItemId = (IntMember)ILE.get("ItemId");
              Integer currItemId = (Integer)ItemId.getMemberValue();
              if ( currItemId.intValue() == removeToken)
              {
                String status = ILE.getLineStatus();
                if (status.equals("Active"))
                {
                  ILE.setLineStatus("Deleted");
                }//end of if (status.equals("Active"))
                else  if (status.equals("New"))
                {
                   removeKeys.add(obj);
                }//end of else  if (status.equals("New"))
              }//end of if ( currItemId.intValue() == removeToken)
            }//end of while (itr.hasNext())
          }//end of while (st.hasMoreTokens())

          for(int i=0; i<removeKeys.size(); i++)
          {
            itemLines.remove(removeKeys.get(i));
          }//end of for(int i=0; i<removeKeys.size(); i++)
        }//end of if (itemLines != null)

          ((PurchaseOrderForm)form).setItemLines(itemLines);
                request.setAttribute(AccountConstantKeys.TYPEOFOPERATION,"REMOVEITEM");
      } // end of if(typeOfOperation != null && typeOfOperation.equals("REMOVEITEM") )
      else if (typeOfOperation != null &&typeOfOperation.equals("ADDITEM"))
      {

        String newItemID = request.getParameter("theitemid");
        ItemList IL = null ;
        ListGenerator lg = ListGenerator.getListGenerator(dataSource);//get the List Generator object for Listing
        IL = (ItemList )lg.getItemList( individualID , 1, 10 , "" , "ItemID");//called when the request for the list is for first time

        StringTokenizer st;
        String token, nextItr;

        if (newItemID != null)
        {
          st = new StringTokenizer(newItemID, ",");
          itemLines = ((PurchaseOrderForm)form).getItemLines();

          if(itemLines == null)
            itemLines = new ItemLines();
          int counter = itemLines.size();
          while (st.hasMoreTokens())
          {
            token   = (String)st.nextToken();
            int intToken = Integer.parseInt(token);
            Iterator itr = IL.keySet().iterator();
            while (itr.hasNext())
            {
              nextItr = (String)itr.next();
              ListElement ile = (ListElement)IL.get(nextItr);
              IntMember smid = (IntMember)ile.get("ItemID");
              Integer listItemid = (Integer)smid.getMemberValue();

              if ( listItemid.intValue() == intToken )
              {

                StringMember smName = (StringMember)ile.get("Name"); // name = description
                String name = (String) smName.getMemberValue();

                StringMember smSku  = (StringMember) ile.get("SKU");
                String sku = (String)smSku.getMemberValue();
                FloatMember dmprice  = (FloatMember) ile.get("Price");

                float price = Float.parseFloat((dmprice.getMemberValue()).toString());

                int id = ile.getElementID();

                IntMember LineId = new IntMember("LineId",0,'D',"",'T',false,20);
                IntMember ItemId = new IntMember("ItemId",id,'D',"",'T',false,20);
                IntMember  Quantity = new IntMember("Quantity",1,'D',"",'T',false,20);
                FloatMember  PriceEach = new FloatMember("Price",new Float(price),'D',"",'T',false,20);
                StringMember SKU = new StringMember("SKU",sku,'D',"",'T',false);
                StringMember Description = new StringMember("Description",name,'D',"",'T',false);
                FloatMember  PriceExtended = new FloatMember("PriceExtended",new Float(0.0f),'D',"",'T',false,20);

                ItemElement ie = new ItemElement(0);
                ie.put ("LineId",LineId);
                ie.put ("ItemId",ItemId);
                ie.put ("SKU",SKU);
                ie.put ("Description",Description);
                ie.put ("Quantity",Quantity);
                ie.put ("Price",PriceEach);
                ie.put ("PriceExtended",PriceExtended);

                ie.setLineStatus("New");
                counter += 1;
                itemLines.put(new Integer(counter), ie);
                break;
              }// end of if ( listItemid.intValue() == intToken )
            }// end of while (itr.hasNext())
View Full Code Here

            itr = itemLines.keySet().iterator();
            while (itr.hasNext())
            {
              Object obj = itr.next();
              ItemElement ILE = (ItemElement)itemLines.get(obj);
              IntMember ItemId = (IntMember)ILE.get("ItemId");
              Integer currItemId = (Integer)ItemId.getMemberValue();
              if ( currItemId.intValue() == removeToken)
              {
                String status = ILE.getLineStatus();
                if (status.equals("Active"))
                {
                  ILE.setLineStatus("Deleted");
                }// end of if (status.equals("Active"))
                else  if (status.equals("New"))
                {
                   removeKeys.add(obj);
                }// end of else  if (status.equals("New"))
              }// end of if ( currItemId.intValue() == removeToken)
            }// end of while (itr.hasNext())
          }// end of while (st.hasMoreTokens())

          for(int i=0; i<removeKeys.size(); i++)
          {
            itemLines.remove(removeKeys.get(i));
          }// end of for(int i=0; i<removeKeys.size(); i++)
        }// end of if (itemLines != null)

         ((PurchaseOrderForm)form).setItemLines(itemLines);
      }// end of if( typeOfOperation != null && typeOfOperation.equals("REMOVEITEM") )
      //----------  ADD item
      else if (typeOfOperation != null &&  typeOfOperation.equals("ADDITEM") )
      {

        String newItemID = request.getParameter("theitemid");
        ItemList IL = null ;
        ListGenerator lg = ListGenerator.getListGenerator(dataSource);//get the List Generator object for Listing
        IL = (ItemList )lg.getItemList( individualID , 1, 10 , "" , "ItemID");//called when the request for the list is for first time

        StringTokenizer st;
        String token, nextItr;

        if (newItemID != null)
        {
          st = new StringTokenizer(newItemID, ",");
          itemLines = ((PurchaseOrderForm)form).getItemLines();

          if(itemLines == null)
            itemLines = new ItemLines();
          int counter = itemLines.size();
          while (st.hasMoreTokens())
          {
            token   = (String)st.nextToken();
            int intToken = Integer.parseInt(token);

            Iterator itr = IL.keySet().iterator();
            while (itr.hasNext())
            {
              nextItr = (String)itr.next();
              ListElement ile = (ListElement)IL.get(nextItr);
              IntMember smid = (IntMember)ile.get("ItemID");
              Integer listItemid = (Integer)smid.getMemberValue();

              if ( listItemid.intValue() == intToken )
              {

                StringMember smName = (StringMember)ile.get("Name"); // name = description
                String name = (String) smName.getMemberValue();

                StringMember smSku  = (StringMember) ile.get("SKU");
                String sku = (String)smSku.getMemberValue();
                FloatMember dmprice  = (FloatMember) ile.get("Price");

                float price = Float.parseFloat((dmprice.getMemberValue()).toString());

                int id = ile.getElementID();

                IntMember LineId = new IntMember("LineId",0,'D',"",'T',false,20);
                IntMember ItemId = new IntMember("ItemId",id,'D',"",'T',false,20);
                IntMember  Quantity = new IntMember("Quantity",1,'D',"",'T',false,20);
                FloatMember  PriceEach = new FloatMember("Price",new Float(price),'D',"",'T',false,20);
                StringMember SKU = new StringMember("SKU",sku,'D',"",'T',false);
                StringMember Description = new StringMember("Description",name,'D',"",'T',false);
                FloatMember  PriceExtended = new FloatMember("PriceExtended",new Float(0.0f),'D',"",'T',false,20);

                ItemElement ie = new ItemElement(0);
                ie.put ("LineId",LineId);
                ie.put ("ItemId",ItemId);
                ie.put ("SKU",SKU);
                ie.put ("Description",Description);
                ie.put ("Quantity",Quantity);
                ie.put ("Price",PriceEach);
                ie.put ("PriceExtended",PriceExtended);

                ie.setLineStatus("New");
                counter += 1;
                itemLines.put(new Integer(counter), ie);
                break;
              }// end of if ( listItemid.intValue() == intToken )
            }// end of while (itr.hasNext())
View Full Code Here

TOP

Related Classes of com.centraview.account.common.ItemElement

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.