Package com.centraview.account.common

Examples of com.centraview.account.common.ItemElement


            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 else 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


    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);
        if(taxAmount[i] != null){
          taxAmount[i] = taxAmount[i].replaceAll(",","");
        }
        else{
          taxAmount[i] = "0";
        }
        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);

      }// end of for
    }
View Full Code Here

            int removeToken = Integer.parseInt(str);
           
            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");
                } else if (status.equals("New")) {
                  removeKeys.add(obj);
                }
              }
            }
          }   // end while (st.hasMoreTokens())
         
          for (int i = 0; i < removeKeys.size(); i++) {
            itemLines.remove(removeKeys.get(i));
          }
        }
       
        ((OrderForm)form).setJurisdictionVec(taxJurisdiction);
        ((OrderForm)form).setItemLines(itemLines);
        request.setAttribute("ItemLines",itemLines);
      }
     
      if (typeOfOperation != null && typeOfOperation.equals("ADDITEM")) {
        String newItemID = request.getParameter("theitemid");
        ItemList IL = null;
        ListGenerator lg = ListGenerator.getListGenerator(dataSource);
        IL = (ItemList)lg.getItemList(individualID, 1, 10, "", "ItemID");
       
        OrderForm orderForm = (OrderForm)form;
        orderForm.convertArrayToItemLines();
        orderForm.convertFormbeanToValueObject("edit");
       
        StringTokenizer st;
        String token, nextItr;
       
        if (newItemID != null) {
          st = new StringTokenizer(newItemID, ",");
          ItemLines itemLines = (orderForm).getItemLines();
          Integer intJurisdictionID = (orderForm).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 if (listItemid.intValue() == intToken)
            }   // end while (itr.hasNext())
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);

        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
    }
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)

        expenseForm.setItemLines(itemLines);
        request.setAttribute("expenseform",expenseForm);

      }// 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 = (expenseForm).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

    for (int j = 0; j < length; j++)
    {
      document = getDocumentFromString(list.item(j).toString());

      ItemElement ie = new ItemElement();

      int itemId = 0;

      String sku = "";
      String externalID = "";
      String cvID = "";
      if (document.getElementsByTagName("ItemRef").getLength() != 0)
      {
        sku = getValueOfNodeByTagName(document.getElementsByTagName("ItemRef").item(0), "FullName");
        externalID = getValueOfNodeByTagName(document.getElementsByTagName("ItemRef").item(0), "ListID");
        cvID = getIDFromEXID("Item", externalID);

        if (!cvID.equals(""))
          itemId = Integer.parseInt(cvID);
      }
      if (cvID.equals("0") || cvID.equals(""))
        continue;
      IntMember ItemId = new IntMember("ItemId", itemId, 'D', "", 'T', false, 20);

      StringMember SKU = new StringMember("SKU", sku, 'D', "", 'T', false);

      String desc = "";
      if (document.getElementsByTagName("Desc").getLength() != 0)
      {
        desc = getValueOfNodeByTagName(document.getFirstChild(), "Desc");
      }

      StringMember Description = new StringMember("Description", desc, 'D', "", 'T', false);

      String qty = "0";

      if (document.getElementsByTagName("Quantity").getLength() != 0)
      {
        qty = getValueOfNodeByTagName(document.getFirstChild(), "Quantity");

      }

      FloatMember Quantity = new FloatMember("Quantity", new Float(qty), 'D', "0", 'T', false, 20);

      String priceEach = "0";
      if (document.getElementsByTagName("Rate").getLength() != 0)
      {
        priceEach = getValueOfNodeByTagName(document.getFirstChild(), "Rate");
      }

      FloatMember PriceEach = new FloatMember("PriceEach", new Float(priceEach), 'D', "", 'T', false, 20);

      String priceExt = "0";

      if (document.getElementsByTagName("PriceExtended").getLength() != 0)
      {
        priceExt = getValueOfNodeByTagName(document.getFirstChild(), "PriceExtended");
      }

      FloatMember PriceExtended = new FloatMember("PriceExtended", new Float(priceExt), 'D', "", 'T', false, 20);
      FloatMember UnitTax = new FloatMember("UnitTax", new Float("1"), 'D', "", 'T', false, 20);
      FloatMember unitTaxrate = new FloatMember("UnitTax", new Float("1"), 'D', "", 'T', false, 20);
      ie.put("ItemId", ItemId);
      ie.put("UnitTaxrate", unitTaxrate);
      ie.put("UnitTax", UnitTax);
      ie.put("SKU", SKU);
      ie.put("Description", Description);
      ie.put("Quantity", Quantity);
      ie.put("PriceEach", PriceEach);
      ie.put("PriceExtended", PriceExtended);
      ie.setLineStatus("New");
      itemLines.put(new Integer(j), ie);
    }
    //   itemLines.calculate();
    return itemLines;
  }
View Full Code Here

      Object obj = it.next();

      itemID = Integer.valueOf(obj.toString());

      ItemElement ele = (ItemElement)itemLines.get(itemID.toString());

      IntMember ItemId = (IntMember)ele.get("ItemId");

      id = Integer.valueOf(ItemId.getDisplayString()).intValue();
      //itemID = (Integer)ItemId.getMemberValue();
      itemExternalID = getEXIDFromID("Item", id);

      StringMember sku = (StringMember)ele.get("SKU");

      FloatMember qty = (FloatMember)ele.get("Quantity");

      FloatMember priceEach = (FloatMember)ele.get("PriceEach");

      FloatMember priceExe = (FloatMember)ele.get("PriceExtended");

      qbTags += "<" + tagName + "> \n" + "<ItemRef> \n" + "<ListID>" + itemExternalID + "</ListID> \n" + "</ItemRef> \n" + "<Quantity>" + df.format(Float.valueOf(qty.getMemberValue().toString())) + "</Quantity> \n" + "<Rate>" + df.format(Float.valueOf(priceEach.getMemberValue().toString())) + "</Rate> \n" + "<Amount>"
          + df.format(Float.valueOf(priceExe.getMemberValue().toString())) + "</Amount> \n" + "</" + tagName + "> \n";
    }
    return qbTags;
View Full Code Here

            int removeToken = Integer.parseInt(str);
           
            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");
                } else if (status.equals("New")) {
                  removeKeys.add(obj);
                }
              }
            }
          }
         
          for (int i=0; i < removeKeys.size(); i++) {
            itemLines.remove(removeKeys.get(i));
          }
        }
       
        ((OrderForm)form).setItemLines(itemLines);
      } 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
       
        orderForm.convertArrayToItemLines();
        orderForm.convertFormbeanToValueObject("add");
       
        StringTokenizer st;
        String token, nextItr;
        if (newItemID != null) {
          st = new StringTokenizer(newItemID, ",");
          itemLines = (orderForm).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);
                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;
              }
            }
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)

        expenseForm.setItemLines(itemLines);
        request.setAttribute("expenseform",expenseForm);
      }// 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 = (expenseForm).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

    {
      if (invoiceID != null)
      {
        for (int i=0;i<invoiceID.length;i++)
        {
          ItemElement ie = new ItemElement();
          IntMember     InvoiceId = new IntMember("InvoiceId",invoiceID[i],'D',"",'T',false,20);
          String invNumStr = "";
          StringMember   InvoiceNum = new StringMember("InvoiceNum",invoiceNum[i],'D',"",'T',false);

          DateFormat   df = new SimpleDateFormat("yyyy-mm-dd") ;
          java.util.Date InvoiceDate = new java.util.Date();
          try{
            InvoiceDate = df.parse(invDateStr[i]) ;
          }
          catch (Exception e){
            e.printStackTrace();
          }
          DateMember invoiceDate = new DateMember ("Date",InvoiceDate,10,"",'T',false,1,"EST");

          DoubleMember   Total = new DoubleMember("Total",new Double(total[i]),'D',"0",'T',false,20);


          DoubleMember   AmountDue = new DoubleMember("AmountDue",new Double(amtDue[i]),'D',"",'T',false,20);
          DoubleMember   AmountApplied = new DoubleMember("AmountApplied",new Double(payment[i]),'D',"",'T',false,20);


          ie.put ("InvoiceId", InvoiceId);
          ie.put ("InvoiceNum", InvoiceNum);
          ie.put ("Date", invoiceDate);
          ie.put ("Total", Total);
          ie.put ("AmountDue", AmountDue);
          ie.put ("AmountApplied", AmountApplied);

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

          ie.setLineStatus(status);

          totalPayment += payment[i];

        //  double paymentamount = 0.0d;
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.