Exemplo n.º 1
0
        public bool AddPMTransDistributions(PMPurchaseDocument document, string VoucherNumber)
        {
            TableError err;

            foreach (var distribution in document.Distributions)
            {
                PmDistributionWorkOpenTable rdwt1;
                rdwt1 = Dynamics.Tables.PmDistributionWorkOpen;

                rdwt1.PostingStatus.Value    = distribution.PostingStatus;    //3
                rdwt1.VoucherNumber.Value    = VoucherNumber;
                rdwt1.DistributionType.Value = distribution.DistributionType; //17;

                rdwt1.DistributionSequenceNumber.Value = distribution.SequenceNumber;
                rdwt1.VendorId.Value = distribution.VendorNumber;
                rdwt1.DistributionAccountIndex.Value = distribution.DistributionAccountIndex;
                rdwt1.DebitAmount.Value   = distribution.DebitAmount;
                rdwt1.CreditAmount.Value  = distribution.CreditAmount;
                rdwt1.CurrencyId.Value    = distribution.CurrencyId;    //"Z-US$";
                rdwt1.CurrencyIndex.Value = distribution.CurrencyIndex; //1007;

                rdwt1.ExchangeRate.Value    = 1;
                rdwt1.IcCurrencyIndex.Value = distribution.CurrencyIndex; //1007;
                rdwt1.IcCurrencyId.Value    = distribution.CurrencyId;    //"Z-US$";
                rdwt1.DecimalPlaces.Value   = 2;

                rdwt1.DistributionReference.Value = distribution.DistributionReference;
                rdwt1.IntercompanyId.Value        = Dynamics.Globals.IntercompanyId.Value;
                try { err = rdwt1.Save(); }
                catch { return(false); }
                finally { rdwt1.Close(); }
            }
            return(true);
        }
Exemplo n.º 2
0
        public bool AddPMTransHeader(PMPurchaseDocument document, string VoucherNumber)
        {
            TableError err;

            PmTransactionWorkTable pms;

            pms = Dynamics.Tables.PmTransactionWork;

            pms.VoucherNumberWork.Value      = VoucherNumber;
            pms.DocumentDate.Value           = Dynamics.Globals.UserDate.Value;
            pms.DocumentNumber.Value         = document.DocumentNumber;
            pms.TransactionDescription.Value = document.TransactionDescription;
            pms.VoucherNumber.Value          = VoucherNumber;
            pms.VendorId.Value         = document.VendNumber;
            pms.CurrencyId.Value       = document.CurrencyId;
            pms.BatchNumber.Value      = document.BatchNumber;
            pms.TaxEngineCalled.Value  = document.TaxEngineCalled;
            pms.BatchSource.Value      = document.BatchSource;         //"RM_Sales";
            pms.DocumentType.Value     = (short)document.DocumentType; // 7;
            pms.DocumentAmount.Value   = document.AccountAmount;
            pms.PurchasesAmount.Value  = document.AccountAmount;
            pms.ChargeAmount.Value     = document.AccountAmount;
            pms.PostingDate.Value      = Dynamics.Globals.UserDate.Value;
            pms.PostingStatus.Value    = 20;
            pms.CurrentTrxAmount.Value = document.AccountAmount;

            try { err = pms.Save(); }
            catch { return(false); }
            finally { pms.Close(); }

            return(true);
        }