public com.netsuite.webservices.ServiceSaleItem[] GenerateNetSuitelst(List <Item> Lst_ItemsAll)
        {
            com.netsuite.webservices.ServiceSaleItem[] ItemArr = new com.netsuite.webservices.ServiceSaleItem[Lst_ItemsAll.Count];
            try
            {
                for (int i = 0; i < Lst_ItemsAll.Count; i++)
                {
                    RecordRef[] subsidiarylst = new RecordRef[1];
                    Item        Obj           = Lst_ItemsAll[i];
                    Setting     objSetting    = new GenericeDAO <Setting>().GetWhere("Subsidiary_Netsuite_Id=" + Obj.Subsidiary_Id).FirstOrDefault();
                    Categories.CategoriesAccounts            objCatAccount = new Categories.CategoriesAccounts();
                    com.netsuite.webservices.ServiceSaleItem NewItemObject = new com.netsuite.webservices.ServiceSaleItem();
                    if (Obj.Netsuite_Id <= 0)
                    {
                        NewItemObject.displayName = Obj.Display_Name_En;
                        //NewItemObject.itemId = Obj.UPC_Code;
                        NewItemObject.itemId           = Obj.Display_Name_En;
                        NewItemObject.salesDescription = Obj.Display_Name_En;
                    }
                    //check if new or can be updated
                    if (Obj.Netsuite_Id > 0)
                    {
                        NewItemObject.internalId = Obj.Netsuite_Id.ToString();
                    }

                    NewItemObject.pricingMatrix = Helper.GeneratePricingMatrix(objSetting, Obj.Price);


                    CustomFieldRef[] custFieldList = new CustomFieldRef[] {
                        new StringCustomFieldRef {
                            value    = Obj.Name_Ar != null? Obj.Name_Ar:"",
                            scriptId = "custitem_da_item_name_ar"
                        }
                    };
                    NewItemObject.customFieldList = custFieldList;


                    #region Items Account
                    RecordRef IncomAccountref = new RecordRef();
                    IncomAccountref.type        = RecordType.account;
                    NewItemObject.incomeAccount = IncomAccountref;

                    IncomAccountref.internalId = objSetting.IncomeAccount_Netsuite_Id.ToString();



                    #endregion
                    RecordRef Tax_Schedule = new RecordRef();
                    Tax_Schedule.internalId   = objSetting.TaxSchedule_Netsuite_Id.ToString();
                    Tax_Schedule.type         = RecordType.salesTaxItem;
                    NewItemObject.taxSchedule = Tax_Schedule;

                    RecordRef subsidiary = new RecordRef();
                    subsidiary.internalId        = objSetting.Subsidiary_Netsuite_Id.ToString();
                    subsidiary.type              = RecordType.subsidiary;
                    subsidiarylst[0]             = subsidiary;
                    NewItemObject.subsidiaryList = subsidiarylst;


                    NewItemObject.isInactive          = Obj.InActive;
                    NewItemObject.isInactiveSpecified = true;

                    ItemArr[i] = NewItemObject;
                }
            }
            catch (Exception ex)
            {
                LogDAO.Integration_Exception(LogIntegrationType.Error, this.GetType().FullName + "." + System.Reflection.MethodBase.GetCurrentMethod().Name, "Error " + ex.Message);
            }
            return(ItemArr);
        }
        public com.netsuite.webservices.InventoryItem[] GenerateNetSuitelst(List <Item> Lst_ItemsAll)
        {
            com.netsuite.webservices.InventoryItem[] ItemArr = new com.netsuite.webservices.InventoryItem[Lst_ItemsAll.Count];
            try
            {
                for (int i = 0; i < Lst_ItemsAll.Count; i++)
                {
                    RecordRef[] subsidiarylst = new RecordRef[1];
                    Item        Obj           = Lst_ItemsAll[i];
                    Setting     objSetting    = new GenericeDAO <Setting>().GetWhere("Subsidiary_Netsuite_Id=" + Obj.Subsidiary_Id).FirstOrDefault();
                    Categories.CategoriesAccounts          objCatAccount = new Categories.CategoriesAccounts();
                    com.netsuite.webservices.InventoryItem NewItemObject = new com.netsuite.webservices.InventoryItem();
                    //check if new or can be updated
                    if (Obj.Netsuite_Id > 0)
                    {
                        NewItemObject.internalId = Obj.Netsuite_Id.ToString();
                    }

                    NewItemObject.itemId           = Obj.UPC_Code;
                    NewItemObject.displayName      = Obj.Display_Name_En;
                    NewItemObject.salesDescription = Obj.Display_Name_En;

                    NewItemObject.trackLandedCost          = true;
                    NewItemObject.trackLandedCostSpecified = true;
                    if (Obj.Price > 0)
                    {
                        NewItemObject.pricingMatrix = Helper.GeneratePricingMatrix(objSetting, Obj.Price);
                    }
                    if (Obj.Category_Id > 0)
                    {
                        objCatAccount = new GenericeDAO <Categories.CategoriesAccounts>().GetWhere("Netsuite_Id=" + Obj.Category_Id).FirstOrDefault();
                        RecordRef classref = new RecordRef();
                        classref.internalId  = Obj.Category_Id.ToString();
                        classref.type        = RecordType.classification;
                        NewItemObject.@class = classref;
                    }
                    CustomFieldRef[] custFieldList = new CustomFieldRef[] {
                        new StringCustomFieldRef {
                            value    = Obj.Name_Ar != null? Obj.Name_Ar:"",
                            scriptId = "custitem_da_item_name_ar"
                        }
                        ,
                        new StringCustomFieldRef {
                            value    = Obj.UPC_Code.ToString(),
                            scriptId = "custitem1"
                        }
                        ,
                        new StringCustomFieldRef {
                            value    = Obj.storage_to_ingredient_factor != null? Obj.storage_to_ingredient_factor:"",
                            scriptId = "custitem_da_item_ingredient"
                        }
                    };
                    NewItemObject.customFieldList = custFieldList;
                    UnitsOfMeasure objunit = new UnitsOfMeasure();
                    if (!string.IsNullOrEmpty(Obj.Ingredient_Unit))
                    {
                        List <UnitsOfMeasure> unitlst = new GenericeDAO <UnitsOfMeasure>().GetWhere("Name ='" + Obj.Ingredient_Unit + "' and abbreviation ='" + Obj.Storage_Unit + "' and conversionRate ='" + Obj.storage_to_ingredient_factor + "'");
                        if (unitlst.Count > 0)
                        {
                            objunit = unitlst[0];
                        }
                        else
                        {
                            unitlst = new GenericeDAO <UnitsOfMeasure>().GetWhere("Name ='" + Obj.Ingredient_Unit + "' and abbreviation ='" + Obj.Storage_Unit + "'");
                            if (unitlst.Count > 0)
                            {
                                objunit = unitlst[0];
                            }
                        }
                    }
                    else if (!string.IsNullOrEmpty(Obj.Storage_Unit))
                    {
                        List <UnitsOfMeasure> unitlst = new GenericeDAO <UnitsOfMeasure>().GetWhere("unitName ='" + Obj.Storage_Unit + "' and abbreviation ='" + Obj.Storage_Unit + "' and conversionRate ='" + Obj.storage_to_ingredient_factor + "'");
                        if (unitlst.Count > 0)
                        {
                            objunit = unitlst[0];
                        }
                    }

                    if (objunit != null && objunit.Id > 0)
                    {
                        RecordRef unitsTyperef = new RecordRef();
                        unitsTyperef.internalId = objunit.unit_id.ToString();
                        unitsTyperef.type       = RecordType.unitsType;
                        NewItemObject.unitsType = unitsTyperef;

                        if (objunit.details_id > 0)
                        {
                            RecordRef unitsTyperefother = new RecordRef();
                            unitsTyperefother.internalId = objunit.details_id.ToString();
                            NewItemObject.saleUnit       = unitsTyperefother;
                            NewItemObject.stockUnit      = unitsTyperefother;
                            NewItemObject.purchaseUnit   = unitsTyperefother;
                        }
                    }


                    #region Items Account
                    RecordRef IncomAccountref = new RecordRef();
                    IncomAccountref.type = RecordType.account;
                    if (objCatAccount.income_account > 0)
                    {
                        IncomAccountref.internalId = objCatAccount.income_account.ToString();
                    }
                    else if (objSetting.IncomeAccount_Netsuite_Id > 0)
                    {
                        IncomAccountref.internalId = objSetting.IncomeAccount_Netsuite_Id.ToString();
                    }
                    if (!string.IsNullOrEmpty(IncomAccountref.internalId))
                    {
                        NewItemObject.incomeAccount = IncomAccountref;
                    }


                    RecordRef cogsAccountref = new RecordRef();
                    cogsAccountref.type = RecordType.account;
                    if (objCatAccount.cogs_account > 0)
                    {
                        cogsAccountref.internalId = objCatAccount.cogs_account.ToString();
                    }
                    else if (objSetting.CogsAccount_Netsuite_Id > 0)
                    {
                        cogsAccountref.internalId = objSetting.CogsAccount_Netsuite_Id.ToString();
                    }
                    if (!string.IsNullOrEmpty(cogsAccountref.internalId))
                    {
                        NewItemObject.cogsAccount = cogsAccountref;
                    }

                    RecordRef assetAccountref = new RecordRef();
                    assetAccountref.type = RecordType.account;
                    if (objCatAccount.asset_account > 0)
                    {
                        assetAccountref.internalId = objCatAccount.asset_account.ToString();
                    }
                    else if (objSetting.AssetAccount_Netsuite_Id > 0)
                    {
                        assetAccountref.internalId = objSetting.AssetAccount_Netsuite_Id.ToString();
                    }
                    if (!string.IsNullOrEmpty(assetAccountref.internalId))
                    {
                        NewItemObject.assetAccount = assetAccountref;
                    }


                    RecordRef intercoIncomeref = new RecordRef();
                    intercoIncomeref.type = RecordType.account;
                    if (objCatAccount.income_intercompany_account > 0)
                    {
                        intercoIncomeref.internalId = objCatAccount.income_intercompany_account.ToString();
                    }
                    else if (objSetting.IntercoIncomeAccount_Netsuite_Id > 0)
                    {
                        intercoIncomeref.internalId = objSetting.IntercoIncomeAccount_Netsuite_Id.ToString();
                    }

                    if (!string.IsNullOrEmpty(intercoIncomeref.internalId))
                    {
                        NewItemObject.intercoIncomeAccount = intercoIncomeref;
                    }

                    RecordRef intercoCogsAccount = new RecordRef();
                    intercoCogsAccount.type = RecordType.account;
                    if (objCatAccount.inter_cogs_account > 0)
                    {
                        intercoCogsAccount.internalId = objCatAccount.inter_cogs_account.ToString();
                    }
                    else if (objSetting.IntercoCogsAccount_Netsuite_Id > 0)
                    {
                        intercoCogsAccount.internalId = objSetting.IntercoCogsAccount_Netsuite_Id.ToString();
                    }

                    if (!string.IsNullOrEmpty(intercoCogsAccount.internalId))
                    {
                        NewItemObject.intercoCogsAccount = intercoCogsAccount;
                    }

                    RecordRef gainLossAccount = new RecordRef();
                    gainLossAccount.type = RecordType.account;
                    if (objCatAccount.gainloss_account > 0)
                    {
                        gainLossAccount.internalId = objCatAccount.gainloss_account.ToString();
                    }
                    else if (objSetting.GainLossAccount_Netsuite_Id > 0)
                    {
                        gainLossAccount.internalId = objSetting.GainLossAccount_Netsuite_Id.ToString();
                    }
                    if (!string.IsNullOrEmpty(gainLossAccount.internalId))
                    {
                        NewItemObject.gainLossAccount = gainLossAccount;
                    }

                    if (objCatAccount.cust_qty_variance_account > 0)
                    {
                        RecordRef refgAccount = new RecordRef();
                        refgAccount.type                  = RecordType.account;
                        refgAccount.internalId            = objCatAccount.cust_qty_variance_account.ToString();
                        NewItemObject.billQtyVarianceAcct = refgAccount;
                    }

                    if (objCatAccount.cust_ex_rate_account > 0)
                    {
                        RecordRef refgAccount = new RecordRef();
                        refgAccount.type       = RecordType.account;
                        refgAccount.internalId = objCatAccount.cust_ex_rate_account.ToString();
                        NewItemObject.billExchRateVarianceAcct = refgAccount;
                    }
                    if (objCatAccount.price_variance_account > 0)
                    {
                        RecordRef refgAccount = new RecordRef();
                        refgAccount.type       = RecordType.account;
                        refgAccount.internalId = objCatAccount.price_variance_account.ToString();
                        NewItemObject.billPriceVarianceAcct = refgAccount;
                    }

                    #endregion
                    RecordRef Tax_Schedule = new RecordRef();
                    Tax_Schedule.internalId   = objSetting.TaxSchedule_Netsuite_Id.ToString();
                    Tax_Schedule.type         = RecordType.salesTaxItem;
                    NewItemObject.taxSchedule = Tax_Schedule;

                    RecordRef subsidiary = new RecordRef();
                    subsidiary.internalId        = objSetting.Subsidiary_Netsuite_Id.ToString();
                    subsidiary.type              = RecordType.subsidiary;
                    subsidiarylst[0]             = subsidiary;
                    NewItemObject.subsidiaryList = subsidiarylst;


                    NewItemObject.isInactive          = Obj.InActive;
                    NewItemObject.isInactiveSpecified = true;

                    ItemArr[i] = NewItemObject;
                }
            }
            catch (Exception ex)
            {
                LogDAO.Integration_Exception(LogIntegrationType.Error, this.GetType().FullName + "." + System.Reflection.MethodBase.GetCurrentMethod().Name, "Error " + ex.Message);
            }
            return(ItemArr);
        }
Esempio n. 3
0
        public com.netsuite.webservices.AssemblyItem[] GenerateNetSuitelst(List <Item> Lst_Items)
        {
            Price[]   pricelst   = new Price[1];
            Pricing[] Pricinglst = new Pricing[1];
            com.netsuite.webservices.AssemblyItem[] ItemArr = new com.netsuite.webservices.AssemblyItem[Lst_Items.Count];
            try
            {
                for (int i = 0; i < Lst_Items.Count; i++)
                {
                    Item    Obj        = Lst_Items[i];
                    Setting objSetting = new GenericeDAO <Setting>().GetWhere("Subsidiary_Netsuite_Id=" + Obj.Subsidiary_Id).FirstOrDefault();
                    com.netsuite.webservices.AssemblyItem NewItemObject = new com.netsuite.webservices.AssemblyItem();
                    Categories.CategoriesAccounts         objCatAccount = new Categories.CategoriesAccounts();

                    // if (Obj.Netsuite_Id <= 0)
                    //{
                    NewItemObject.itemId      = Obj.UPC_Code;
                    NewItemObject.displayName = Obj.Display_Name_En;
                    //}


                    NewItemObject.trackLandedCost          = true;
                    NewItemObject.trackLandedCostSpecified = true;

                    if (Obj.Category_Id > 0)
                    {
                        RecordRef classref = new RecordRef();
                        classref.internalId  = Obj.Category_Id.ToString();
                        classref.type        = RecordType.classification;
                        NewItemObject.@class = classref;

                        objCatAccount = new GenericeDAO <Categories.CategoriesAccounts>().GetWhere("Netsuite_Id=" + Obj.Category_Id).FirstOrDefault();
                    }

                    #region Custom fields

                    Obj.Storage_Unit = string.IsNullOrEmpty(Obj.Storage_Unit) ? "" : Obj.Storage_Unit;

                    CustomFieldRef[] custFieldList = new CustomFieldRef[] {
                        new StringCustomFieldRef {
                            value    = !string.IsNullOrEmpty(Obj.Name_Ar)? Obj.Name_Ar.ToString():"",
                            scriptId = "custitem_da_item_name_ar"
                        }
                        ,
                        new StringCustomFieldRef {
                            value    = Obj.UPC_Code.ToString(),
                            scriptId = "custitem1"
                        }
                    };
                    NewItemObject.customFieldList = custFieldList;
                    #endregion
                    if (Obj.Netsuite_Id > 0)
                    {
                        NewItemObject.internalId = Obj.Netsuite_Id.ToString();
                    }

                    #region pricing

                    NewItemObject.pricingMatrix = Helper.GeneratePricingMatrix(objSetting, Obj.Price);
                    #endregion
                    #region AssemblyComponent

                    List <ItemCompnent> itemCompnentslst = new GenericeDAO <ItemCompnent>().GetWhere("ItemFoodics_Id ='" + Obj.Foodics_Id + "'");
                    if (itemCompnentslst.Count > 0)
                    {
                        ItemMember[]   ItemMemberlst = new ItemMember[itemCompnentslst.Count];
                        ItemMemberList memberlst     = new ItemMemberList();
                        for (int x = 0; x < itemCompnentslst.Count; x++)
                        {
                            ItemMember   obj        = new ItemMember();
                            ItemCompnent itmcompobj = itemCompnentslst[x];
                            RecordRef    Itemref    = new RecordRef();
                            Itemref.internalId = itmcompobj.ComponentId.ToString();
                            Itemref.type       = RecordType.inventoryItem;

                            obj.item = Itemref;

                            obj.quantity          = itmcompobj.Quantity == 0 ? 1 : itmcompobj.Quantity;
                            obj.quantitySpecified = true;
                            ItemMemberlst[x]      = obj;
                        }
                        memberlst.itemMember                = ItemMemberlst;
                        NewItemObject.memberList            = memberlst;
                        NewItemObject.memberList.replaceAll = true;
                    }



                    #endregion
                    #region Items Account
                    RecordRef IncomAccountref = new RecordRef();
                    IncomAccountref.type        = RecordType.account;
                    NewItemObject.incomeAccount = IncomAccountref;
                    if (objCatAccount.income_account > 0)
                    {
                        IncomAccountref.internalId = objCatAccount.income_account.ToString();
                    }
                    else if (objSetting.IncomeAccount_Netsuite_Id > 0)
                    {
                        IncomAccountref.internalId = objSetting.IncomeAccount_Netsuite_Id.ToString();
                    }

                    RecordRef cogsAccountref = new RecordRef();
                    cogsAccountref.type       = RecordType.account;
                    NewItemObject.cogsAccount = cogsAccountref;
                    if (objCatAccount.cogs_account > 0)
                    {
                        cogsAccountref.internalId = objCatAccount.cogs_account.ToString();
                    }
                    else if (objSetting.CogsAccount_Netsuite_Id > 0)
                    {
                        cogsAccountref.internalId = objSetting.CogsAccount_Netsuite_Id.ToString();
                    }

                    RecordRef assetAccountref = new RecordRef();
                    assetAccountref.type       = RecordType.account;
                    NewItemObject.assetAccount = assetAccountref;
                    if (objCatAccount.asset_account > 0)
                    {
                        assetAccountref.internalId = objCatAccount.asset_account.ToString();
                    }
                    else if (objSetting.AssetAccount_Netsuite_Id > 0)
                    {
                        assetAccountref.internalId = objSetting.AssetAccount_Netsuite_Id.ToString();
                    }

                    RecordRef intercoIncomeref = new RecordRef();
                    intercoIncomeref.type = RecordType.account;
                    NewItemObject.intercoIncomeAccount = intercoIncomeref;
                    if (objCatAccount.income_intercompany_account > 0)
                    {
                        intercoIncomeref.internalId = objCatAccount.income_intercompany_account.ToString();
                    }
                    else if (objSetting.IntercoIncomeAccount_Netsuite_Id > 0)
                    {
                        intercoIncomeref.internalId = objSetting.IntercoIncomeAccount_Netsuite_Id.ToString();
                    }

                    RecordRef intercoCogsAccount = new RecordRef();
                    intercoCogsAccount.type          = RecordType.account;
                    NewItemObject.intercoCogsAccount = intercoCogsAccount;
                    if (objCatAccount.inter_cogs_account > 0)
                    {
                        intercoCogsAccount.internalId = objCatAccount.inter_cogs_account.ToString();
                    }
                    else if (objSetting.IntercoCogsAccount_Netsuite_Id > 0)
                    {
                        intercoCogsAccount.internalId = objSetting.IntercoCogsAccount_Netsuite_Id.ToString();
                    }

                    RecordRef gainLossAccount = new RecordRef();
                    gainLossAccount.type          = RecordType.account;
                    NewItemObject.gainLossAccount = gainLossAccount;
                    if (objCatAccount.gainloss_account > 0)
                    {
                        gainLossAccount.internalId = objCatAccount.gainloss_account.ToString();
                    }
                    else if (objSetting.GainLossAccount_Netsuite_Id > 0)
                    {
                        gainLossAccount.internalId = objSetting.GainLossAccount_Netsuite_Id.ToString();
                    }


                    if (objCatAccount.cust_qty_variance_account > 0)
                    {
                        RecordRef refgAccount = new RecordRef();
                        refgAccount.type                  = RecordType.account;
                        refgAccount.internalId            = objCatAccount.cust_qty_variance_account.ToString();
                        NewItemObject.billQtyVarianceAcct = refgAccount;
                    }

                    if (objCatAccount.cust_ex_rate_account > 0)
                    {
                        RecordRef refgAccount = new RecordRef();
                        refgAccount.type       = RecordType.account;
                        refgAccount.internalId = objCatAccount.cust_ex_rate_account.ToString();
                        NewItemObject.billExchRateVarianceAcct = refgAccount;
                    }
                    if (objCatAccount.price_variance_account > 0)
                    {
                        RecordRef refgAccount = new RecordRef();
                        refgAccount.type       = RecordType.account;
                        refgAccount.internalId = objCatAccount.price_variance_account.ToString();
                        NewItemObject.billPriceVarianceAcct = refgAccount;
                    }

                    #endregion
                    RecordRef Tax_Schedule = new RecordRef();
                    Tax_Schedule.internalId   = objSetting.TaxSchedule_Netsuite_Id.ToString();
                    Tax_Schedule.type         = RecordType.salesTaxItem;
                    NewItemObject.taxSchedule = Tax_Schedule;
                    RecordRef[] subsidiarylst = new RecordRef[1];
                    RecordRef   subsidiary    = new RecordRef();
                    subsidiary.internalId        = Obj.Subsidiary_Id.ToString();
                    subsidiary.type              = RecordType.subsidiary;
                    subsidiarylst[0]             = subsidiary;
                    NewItemObject.subsidiaryList = subsidiarylst;

                    if (Obj.InActive)
                    {
                        NewItemObject.isInactive          = true;
                        NewItemObject.isInactiveSpecified = true;
                    }

                    ItemArr[i] = NewItemObject;
                }
            }
            catch (Exception ex)
            {
                LogDAO.Integration_Exception(LogIntegrationType.Error, this.GetType().FullName + "." + System.Reflection.MethodBase.GetCurrentMethod().Name, "Error " + ex.Message);
            }
            return(ItemArr);
        }
        public override void Get()
        {
            /// <summary> This method get all items (with types we need in POS) from netsuite and check item type,
            /// after that get all item info and save in DB.</summary>
            ///

            string IntrnelID = GetCustomizationId("customrecord_da_foodics_class_account");



            CustomRecordSearch      customRecordSearch      = new CustomRecordSearch();
            CustomRecordSearchBasic customRecordSearchBasic = new CustomRecordSearchBasic();
            RecordRef recordRef = new RecordRef();

            recordRef.internalId            = IntrnelID;
            recordRef.type                  = RecordType.customTransaction;
            customRecordSearchBasic.recType = recordRef;
            customRecordSearch.basic        = customRecordSearchBasic;
            SearchResult response = Service(true).search(customRecordSearch);

            if (response.status.isSuccess)
            {
                if (response.totalRecords > 0)
                {
                    CustomRecord     item_Custom;
                    CustomFieldRef[] flds;
                    List <Categories.CategoriesAccounts> lstCat = new List <Categories.CategoriesAccounts>();
                    for (int i = 0; i < response.recordList.Length; i++)
                    {
                        item_Custom = (CustomRecord)response.recordList[i];
                        flds        = item_Custom.customFieldList;


                        Categories.CategoriesAccounts CatObj = new Categories.CategoriesAccounts();
                        for (int c = 0; c < flds.Length; c++)
                        {
                            if (flds[c].scriptId == "custrecord_da_item_class")
                            {
                                CatObj.Netsuite_Id = Utility.ConvertToInt(((com.netsuite.webservices.SelectCustomFieldRef)flds[c]).value.internalId.ToString());
                            }

                            if (flds[c].scriptId == "custrecord_cogs_account")
                            {
                                CatObj.cogs_account = Utility.ConvertToInt(((com.netsuite.webservices.SelectCustomFieldRef)flds[c]).value.internalId.ToString());
                            }
                            if (flds[c].scriptId == "custrecord_inter_cogs_account")
                            {
                                CatObj.inter_cogs_account = Utility.ConvertToInt(((com.netsuite.webservices.SelectCustomFieldRef)flds[c]).value.internalId.ToString());
                            }

                            if (flds[c].scriptId == "custrecord_da_income_account")
                            {
                                CatObj.income_account = Utility.ConvertToInt(((com.netsuite.webservices.SelectCustomFieldRef)flds[c]).value.internalId.ToString());
                            }
                            if (flds[c].scriptId == "custrecord_da_gainloss_account")
                            {
                                CatObj.gainloss_account = Utility.ConvertToInt(((com.netsuite.webservices.SelectCustomFieldRef)flds[c]).value.internalId.ToString());
                            }

                            if (flds[c].scriptId == "custrecord_da_assetaccount")
                            {
                                CatObj.asset_account = Utility.ConvertToInt(((com.netsuite.webservices.SelectCustomFieldRef)flds[c]).value.internalId.ToString());
                            }
                            if (flds[c].scriptId == "custrecord_cust_income_intercompany")
                            {
                                CatObj.income_intercompany_account = Utility.ConvertToInt(((com.netsuite.webservices.SelectCustomFieldRef)flds[c]).value.internalId.ToString());
                            }

                            if (flds[c].scriptId == "custrecord_cust_da_price_variance")
                            {
                                CatObj.price_variance_account = Utility.ConvertToInt(((com.netsuite.webservices.SelectCustomFieldRef)flds[c]).value.internalId.ToString());
                            }
                            if (flds[c].scriptId == "custrecord_da_cust_qty_variance")
                            {
                                CatObj.cust_qty_variance_account = Utility.ConvertToInt(((com.netsuite.webservices.SelectCustomFieldRef)flds[c]).value.internalId.ToString());
                            }

                            if (flds[c].scriptId == "custrecord_da_cust_ex_rate")
                            {
                                CatObj.cust_ex_rate_account = Utility.ConvertToInt(((com.netsuite.webservices.SelectCustomFieldRef)flds[c]).value.internalId.ToString());
                            }
                            if (flds[c].scriptId == "custrecord_da_cust_customer_account_vari")
                            {
                                CatObj.customer_vari_account = Utility.ConvertToInt(((com.netsuite.webservices.SelectCustomFieldRef)flds[c]).value.internalId.ToString());
                            }

                            if (flds[c].scriptId == "custrecord_da_cust_vendor")
                            {
                                CatObj.cust_vendor_account = Utility.ConvertToInt(((com.netsuite.webservices.SelectCustomFieldRef)flds[c]).value.internalId.ToString());
                            }
                        }
                        lstCat.Add(CatObj);
                    }


                    new GenericeDAO <Categories.CategoriesAccounts>().BaseNetSuiteIntegration(lstCat, "Categories");
                }
            }
        }