public static CustomerPaymentJournalFee CreateCustomerPaymentJournalFee(string dataAreaId,
                                                                                string sourceJournalBatchNumber,
                                                                                decimal sourceJournalLineNumber,
                                                                                string paymentFeeId,
                                                                                decimal amount,
                                                                                global::Microsoft.Dynamics.DataEntities.Currency currency,
                                                                                global::Microsoft.Dynamics.DataEntities.CustomerPaymentFee customerPaymentFee,
                                                                                global::Microsoft.Dynamics.DataEntities.CustomerPaymentJournalLine customerPaymentJournalLine)
        {
            CustomerPaymentJournalFee customerPaymentJournalFee = new CustomerPaymentJournalFee();

            customerPaymentJournalFee.dataAreaId = dataAreaId;
            customerPaymentJournalFee.SourceJournalBatchNumber = sourceJournalBatchNumber;
            customerPaymentJournalFee.SourceJournalLineNumber  = sourceJournalLineNumber;
            customerPaymentJournalFee.PaymentFeeId             = paymentFeeId;
            customerPaymentJournalFee.Amount = amount;
            if ((currency == null))
            {
                throw new global::System.ArgumentNullException("currency");
            }
            customerPaymentJournalFee.Currency = currency;
            if ((customerPaymentFee == null))
            {
                throw new global::System.ArgumentNullException("customerPaymentFee");
            }
            customerPaymentJournalFee.CustomerPaymentFee = customerPaymentFee;
            if ((customerPaymentJournalLine == null))
            {
                throw new global::System.ArgumentNullException("customerPaymentJournalLine");
            }
            customerPaymentJournalFee.CustomerPaymentJournalLine = customerPaymentJournalLine;
            return(customerPaymentJournalFee);
        }
 partial void OnCustomerPaymentJournalLineRelatedRoleChanging(global::Microsoft.Dynamics.DataEntities.CustomerPaymentJournalLine value);
        public static PaymentJournalLineSettledInvoice CreatePaymentJournalLineSettledInvoice(string journalLineCompany,
                                                                                              string journalBatchNumber,
                                                                                              decimal journalLineNumber,
                                                                                              string invoiceNumber,
                                                                                              string invoiceCompany,
                                                                                              global::System.DateTimeOffset invoiceDueDate,
                                                                                              decimal invoiceToPaymentCrossRate,
                                                                                              decimal cashDiscountToTakeInInvoiceCurrency,
                                                                                              decimal settlementAmountInInvoiceCurrency,
                                                                                              global::Microsoft.Dynamics.DataEntities.CustomerPaymentJournalLine customerPaymentJournalLineRelatedRole,
                                                                                              global::Microsoft.Dynamics.DataEntities.CustomerPaymentJournalHeader customerPaymentJournalHeaderRelatedRole)
        {
            PaymentJournalLineSettledInvoice paymentJournalLineSettledInvoice = new PaymentJournalLineSettledInvoice();

            paymentJournalLineSettledInvoice.JournalLineCompany                  = journalLineCompany;
            paymentJournalLineSettledInvoice.JournalBatchNumber                  = journalBatchNumber;
            paymentJournalLineSettledInvoice.JournalLineNumber                   = journalLineNumber;
            paymentJournalLineSettledInvoice.InvoiceNumber                       = invoiceNumber;
            paymentJournalLineSettledInvoice.InvoiceCompany                      = invoiceCompany;
            paymentJournalLineSettledInvoice.InvoiceDueDate                      = invoiceDueDate;
            paymentJournalLineSettledInvoice.InvoiceToPaymentCrossRate           = invoiceToPaymentCrossRate;
            paymentJournalLineSettledInvoice.CashDiscountToTakeInInvoiceCurrency = cashDiscountToTakeInInvoiceCurrency;
            paymentJournalLineSettledInvoice.SettlementAmountInInvoiceCurrency   = settlementAmountInInvoiceCurrency;
            if ((customerPaymentJournalLineRelatedRole == null))
            {
                throw new global::System.ArgumentNullException("customerPaymentJournalLineRelatedRole");
            }
            paymentJournalLineSettledInvoice.CustomerPaymentJournalLineRelatedRole = customerPaymentJournalLineRelatedRole;
            if ((customerPaymentJournalHeaderRelatedRole == null))
            {
                throw new global::System.ArgumentNullException("customerPaymentJournalHeaderRelatedRole");
            }
            paymentJournalLineSettledInvoice.CustomerPaymentJournalHeaderRelatedRole = customerPaymentJournalHeaderRelatedRole;
            return(paymentJournalLineSettledInvoice);
        }