Esempio n. 1
0
        public void ModifySundryInvoice(SundryInvoiceDTO sundryInvoice)
        {
            Supplier supplier = _supplierRepository.GetFiltered(p => p.Id == sundryInvoice.SupplierId).FirstOrDefault();
            Currency currency = _currencyRepository.GetFiltered(p => p.Id == sundryInvoice.CurrencyId).FirstOrDefault();

            BasePurchaseInvoice updateSundryInvoice =
                _invoiceRepository.GetBasePurchaseInvoice(sundryInvoice.SundryInvoiceId);
            //获取需要更新的对象。
            if (updateSundryInvoice != null)
            {
                InvoiceFactory.SetInvoice(updateSundryInvoice, sundryInvoice.InvoideCode,
                    sundryInvoice.InvoiceDate, sundryInvoice.OperatorName, sundryInvoice.InvoiceNumber, supplier,
                    null,
                    sundryInvoice.PaidAmount, currency, sundryInvoice.PaymentScheduleLineId, sundryInvoice.Status);
                //更新主表。

                UpdateInvoiceLines(sundryInvoice.InvoiceLines, updateSundryInvoice, null);
                //更新从表。
            }
            _invoiceRepository.Modify(updateSundryInvoice);
        }
Esempio n. 2
0
 public void DeleteSundryInvoice(SundryInvoiceDTO sundryInvoice)
 {
     if (sundryInvoice == null)
     {
         throw new ArgumentException("参数为空!");
     }
     BasePurchaseInvoice delSundryInvoice =
         _invoiceRepository.GetBasePurchaseInvoice(sundryInvoice.SundryInvoiceId);
     //获取需要删除的对象。
     if (delSundryInvoice != null)
     {
         _invoiceRepository.DeleteInvoice(delSundryInvoice); //删除杂项发票。
     }
 }
Esempio n. 3
0
        public void InsertSundryInvoice(SundryInvoiceDTO sundryInvoice)
        {
            Supplier supplier = _supplierRepository.GetFiltered(p => p.Id == sundryInvoice.SupplierId).FirstOrDefault();
            Currency currency = _currencyRepository.GetFiltered(p => p.Id == sundryInvoice.CurrencyId).FirstOrDefault();

            SundryInvoice newSundryInvoice = InvoiceFactory.CreateSundryInvoice(sundryInvoice.InvoideCode,
                sundryInvoice.InvoiceDate, sundryInvoice.OperatorName);
            DateTime date = DateTime.Now.Date;
            int seq = _invoiceRepository.GetFiltered(t => t.CreateDate > date).Count() + 1;
            newSundryInvoice.SetInvoiceNumber(seq);
            newSundryInvoice.SetSupplier(supplier);
            newSundryInvoice.SetPaidAmount(sundryInvoice.PaidAmount);
            newSundryInvoice.SetCurrency(currency);
            newSundryInvoice.SetInvoiceStatus(InvoiceStatus.草稿);
            foreach (InvoiceLineDTO invoiceLine in sundryInvoice.InvoiceLines)
            {
                newSundryInvoice.AddInvoiceLine(invoiceLine.ItemName, invoiceLine.Amount, null, invoiceLine.Note);
            }
            newSundryInvoice.SetInvoiceValue();
            _invoiceRepository.Add(newSundryInvoice);
        }