Ejemplo n.º 1
0
        private static void AddLandedCostXML()
        {
            SAPbobsCOM.Company        oCompany        = Application.SBO_Application.Company.GetDICompany() as SAPbobsCOM.Company;
            SAPbobsCOM.CompanyService oCompanyService = oCompany.GetCompanyService() as SAPbobsCOM.CompanyService;
            LandedCostsService        LandedService   = oCompanyService.GetBusinessService(ServiceTypes.LandedCostsService) as LandedCostsService;
            LandedCost       oLandedCost     = LandedService.GetDataInterface(LandedCostsServiceDataInterfaces.lcsLandedCost) as LandedCost;
            LandedCostParams oCopiedLCParams = LandedService.GetDataInterface(LandedCostsServiceDataInterfaces.lcsLandedCostParams) as LandedCostParams;

            oCopiedLCParams.LandedCostNumber = 17;
            LandedCost oCopiedLC = LandedService.GetDataInterface(LandedCostsServiceDataInterfaces.lcsLandedCost) as LandedCost;

            oCopiedLC = LandedService.GetLandedCost(oCopiedLCParams);

            string k = XMLCleaner(oCopiedLC.ToXMLString(), oCopiedLC.LandedCostNumber + "", oCopiedLC.DocEntry + "");

            oLandedCost.FromXMLString(k);
            //Adding Costs
            LandedCost_CostLine oLandedCost_CostLine = oLandedCost.LandedCost_CostLines.Add();

            oLandedCost_CostLine.LandedCostCode = "TI";
            oLandedCost_CostLine.amount         = 10;


            LandedService.AddLandedCost(oLandedCost);
        }
Ejemplo n.º 2
0
        private static void testLandedCost()
        {
            SAPbobsCOM.Company        oCompany        = Application.SBO_Application.Company.GetDICompany() as SAPbobsCOM.Company;
            SAPbobsCOM.CompanyService oCompanyService = oCompany.GetCompanyService() as SAPbobsCOM.CompanyService;
            LandedCostsService        LandedService   = oCompanyService.GetBusinessService(ServiceTypes.LandedCostsService) as LandedCostsService;
            LandedCost       oLandedCost     = LandedService.GetDataInterface(LandedCostsServiceDataInterfaces.lcsLandedCost) as LandedCost;
            LandedCostParams oCopiedLCParams = LandedService.GetDataInterface(LandedCostsServiceDataInterfaces.lcsLandedCostParams) as LandedCostParams;

            oCopiedLCParams.LandedCostNumber = 13;
            LandedCost oCopiedLC = LandedService.GetDataInterface(LandedCostsServiceDataInterfaces.lcsLandedCost) as LandedCost;

            oCopiedLC = LandedService.GetLandedCost(oCopiedLCParams);
            //Testing
            int  total_lineNum    = oCopiedLC.LandedCost_ItemLines.Count;
            long oLandedCostEntry = 0;//Try 10
            int  GRPOEntry        = 2474;

            //Adding Items
            for (int i = 0; i < 2; i++)
            {
                LandedCost_ItemLine oLandedCost_ItemLine = oLandedCost.LandedCost_ItemLines.Add();
                oLandedCost_ItemLine.BaseDocumentType = LandedCostBaseDocumentTypeEnum.asPurchaseInvoice;
                oLandedCost_ItemLine.BaseEntry        = GRPOEntry;
                oLandedCost_ItemLine.BaseLine         = i;
            }

            //Adding Costs
            LandedCost_CostLine oLandedCost_CostLine = oLandedCost.LandedCost_CostLines.Add();

            oLandedCost_CostLine.LandedCostCode = "CD";
            oLandedCost_CostLine.amount         = 99;
            //Extra Cost
            oLandedCost_CostLine = oLandedCost.LandedCost_CostLines.Add();
            oLandedCost_CostLine.LandedCostCode = "CM";
            oLandedCost_CostLine.amount         = 150;



            LandedCostParams oLandedCostParams;

            oLandedCostParams = LandedService.AddLandedCost(oLandedCost);
            oLandedCostEntry  = oLandedCostParams.LandedCostNumber;
        }