コード例 #1
0
ファイル: Invoice.cs プロジェクト: unicloud/FRP
        /// <summary>
        ///     设置订单
        /// </summary>
        /// <param name="order">订单</param>
        public void SetOrder(Order order)
        {
            if (order == null || order.IsTransient())
            {
                return;
            }

            OrderId = order.Id;
        }
コード例 #2
0
ファイル: InvoiceFactory.cs プロジェクト: unicloud/FRP
 /// <summary>
 ///     设置发票行属性
 /// </summary>
 /// <param name="invoiceLine">发票行</param>
 /// <param name="itemName">项名称</param>
 /// <param name="amount">金额</param>
 /// <param name="order">订单</param>
 /// <param name="orderLineId">订单行Id</param>
 /// <param name="note">备注</param>
 public static void SetInvoiceLine(PurchaseInvoiceLine invoiceLine, int itemName, decimal amount, Order order,
     int orderLineId, string note)
 {
     if (order != null)
     {
         var orderLine = order.OrderLines.FirstOrDefault(p => p.Id == orderLineId);
         invoiceLine.SetOrderLine(orderLine);
     }
     invoiceLine.SetItemName((ItemNameType)itemName);
     invoiceLine.SetAmount(amount);
     invoiceLine.SetNote(note);
 }
コード例 #3
0
 /// <summary>
 ///     更新发票行集合
 /// </summary>
 /// <param name="sourceInvoiceLines">客户端集合</param>
 /// <param name="dstInvoice">数据库集合</param>
 /// <param name="order"></param>
 private void UpdateInvoiceLines(IEnumerable<InvoiceLineDTO> sourceInvoiceLines, BasePurchaseInvoice dstInvoice,
     Order order)
 {
     var invoiceLines = new List<PurchaseInvoiceLine>();
     foreach (InvoiceLineDTO sourceInvoiceLine in sourceInvoiceLines)
     {
         PurchaseInvoiceLine result =
             dstInvoice.InvoiceLines.FirstOrDefault(p => p.Id == sourceInvoiceLine.InvoiceLineId);
         if (result == null)
         {
             result = InvoiceFactory.CreateInvoiceLine();
             result.ChangeCurrentIdentity(sourceInvoiceLine.InvoiceLineId);
         }
         InvoiceFactory.SetInvoiceLine(result, sourceInvoiceLine.ItemName, sourceInvoiceLine.Amount, order,
             sourceInvoiceLine.InvoiceLineId, sourceInvoiceLine.Note);
         invoiceLines.Add(result);
     }
     dstInvoice.InvoiceLines.ToList().ForEach(p =>
     {
         if (invoiceLines.FirstOrDefault(t => t.Id == p.Id) == null)
         {
             _invoiceRepository.RemoveInvoiceLine(p);
         }
     });
     dstInvoice.InvoiceLines = invoiceLines;
 }
コード例 #4
0
ファイル: InvoiceFactory.cs プロジェクト: unicloud/FRP
 /// <summary>
 ///     设置发票属性
 /// </summary>
 /// <param name="invoice">发票</param>
 /// <param name="invoideCode">发票代码</param>
 /// <param name="invoiceDate">发票日期</param>
 /// <param name="operatorName">经办人</param>
 /// <param name="invoiceNumber">发票号</param>
 /// <param name="supplier">供应商</param>
 /// <param name="order">订单</param>
 /// <param name="paidAmount">已付金额</param>
 /// <param name="currency">币种</param>
 /// <param name="paymentScheduleLineId">付款计划行ID</param>
 /// <param name="status">发票状态</param>
 /// <returns>发票</returns>
 public static void SetInvoice(Invoice invoice, string invoideCode, DateTime invoiceDate, string operatorName,
     string invoiceNumber, Supplier supplier, Order order,
     decimal paidAmount, Currency currency, int? paymentScheduleLineId, int status)
 {
     invoice.InvoideCode = invoideCode;
     invoice.InvoiceDate = invoiceDate;
     invoice.SetOperator(operatorName);
     invoice.SetInvoiceNumber(invoiceNumber);
     invoice.SetSupplier(supplier);
     invoice.SetOrder(order);
     invoice.SetCurrency(currency);
     invoice.SetPaymentScheduleLine(paymentScheduleLineId);
     invoice.SetInvoiceStatus((InvoiceStatus) status);
 }