Exemple #1
0
        //Credit Notes
        public static FIN_DocumentFinanceMaster PersistFinanceDocumentCreditNote(Guid pDocumentFinanceType)
        {
            //SourceDocument for CreditNote
            Guid xpoOidParentDocument = new Guid("316528f6-bf9b-4a6d-aa5b-530379aaa6ef");
            FIN_DocumentFinanceMaster sourceDocument = (FIN_DocumentFinanceMaster)GlobalFramework.SessionXpo.GetObjectByKey(typeof(FIN_DocumentFinanceMaster), xpoOidParentDocument);

            ArticleBag articleBag = TestArticleBag.GetArticleBag(false);

            //Fill Required Reference and Reason
            foreach (var item in articleBag)
            {
                item.Value.Reference = sourceDocument;
                item.Value.Reason    = "Anulação";
                item.Value.Quantity -= 1;
            }

            ProcessFinanceDocumentParameter processFinanceDocumentParameter = new ProcessFinanceDocumentParameter(pDocumentFinanceType, articleBag)
            {
                SourceMode = PersistFinanceDocumentSourceMode.CustomArticleBag,
                //P1
                PaymentCondition = SettingsApp.XpoOidDocumentPaymentCondition,
                PaymentMethod    = SettingsApp.XpoOidDocumentPaymentMethod,
                Currency         = SettingsApp.XpoOidDocumentCurrency,
                //Used for Credit Notes
                DocumentParent = xpoOidParentDocument,
                //P2
                Customer = SettingsApp.XpoOidDocumentCustomer
            };

            return(PersistFinanceDocumentBase(pDocumentFinanceType, processFinanceDocumentParameter));
        }
Exemple #2
0
        //Default
        public static FIN_DocumentFinanceMaster PersistFinanceDocument(Guid pDocumentFinanceType)
        {
            ArticleBag articleBag = TestArticleBag.GetArticleBag(false);

            ProcessFinanceDocumentParameter processFinanceDocumentParameter = new ProcessFinanceDocumentParameter(pDocumentFinanceType, articleBag)
            {
                SourceMode = PersistFinanceDocumentSourceMode.CustomArticleBag,
                //P1
                PaymentCondition = SettingsApp.XpoOidDocumentPaymentCondition,
                PaymentMethod    = SettingsApp.XpoOidDocumentPaymentMethod,
                Currency         = SettingsApp.XpoOidDocumentCurrency,
                //P2
                Customer = SettingsApp.XpoOidDocumentCustomer
            };

            return(PersistFinanceDocumentBase(pDocumentFinanceType, processFinanceDocumentParameter));
        }
Exemple #3
0
        public static FIN_DocumentFinanceMaster PersistFinanceDocumentBase(Guid pDocumentFinanceType, ProcessFinanceDocumentParameter pProcessFinanceDocumentParameter)
        {
            ArticleBag articleBag = TestArticleBag.GetArticleBag(false);

            //Change default DocumentDateTime
            //processFinanceDocumentParameter.DocumentDateTime = FrameworkUtils.CurrentDateTimeAtomic().AddDays(-5);

            FIN_DocumentFinanceMaster documentFinanceMaster = ProcessFinanceDocument.PersistFinanceDocument(pProcessFinanceDocumentParameter);

            if (documentFinanceMaster != null)
            {
                Console.WriteLine(string.Format("documentFinanceMaster.DocumentNumber: [{0}]", documentFinanceMaster.DocumentNumber));
                PrintRouter.PrintFinanceDocument(documentFinanceMaster);
            }

            return(documentFinanceMaster);
        }
        public static void ShowArticleBag()
        {
            Guid articleClassProducts = new Guid("6924945d-f99e-476b-9c4d-78fb9e2b30a3");
            Guid articleClassServices = new Guid("7622e5d2-2d52-4be9-bb8b-e5efae5ec791");

            ArticleBag articleBag = TestArticleBag.GetArticleBag(false);

            foreach (var item in articleBag)
            {
                //_log.Debug(string.Format("{0} x {1}", item.Key.Designation, item.Value.Quantity));
                Console.WriteLine(string.Format("{0} x {1}", item.Key.Designation, item.Value.Quantity));
            }

            //Test GetClassTotals
            Dictionary <string, decimal> classTotals = articleBag.GetClassTotals();

            //Show Result
            Console.WriteLine(Environment.NewLine);
            Console.WriteLine("TotalFinal P: [{0}]", classTotals["P"]);
            Console.WriteLine("TotalFinal S: [{0}]", classTotals["S"]);
            Console.WriteLine("ArticleBag TotalFinal: [{0}], TotalPAndS: [{1}]", articleBag.TotalFinal, classTotals["P"] + classTotals["S"]);
        }