private void OnAdd(object obj) { if (SelCreditNote == null) { MessageAlert("请选择一条记录!"); return; } SelInvoiceLine = new InvoiceLineDTO { InvoiceLineId = RandomHelper.Next(), InvoiceId = SelCreditNote.CreditNoteId, }; SelCreditNote.InvoiceLines.Add(SelInvoiceLine); InvoiceLines.Add(SelInvoiceLine); }
private void OnAdd(object obj) { if (SelPrepaymentInvoice == null) { MessageAlert("请选择一条记录!"); return; } SelInvoiceLine = new InvoiceLineDTO { InvoiceLineId = RandomHelper.Next(), InvoiceId = SelPrepaymentInvoice.PrepaymentInvoiceId }; SelPrepaymentInvoice.InvoiceLines.Add(SelInvoiceLine); InvoiceLines.Add(SelInvoiceLine); }
/// <summary> /// 执行确定命令。 /// </summary> /// <param name="sender"></param> public void OnCommitExecute(object sender) { var invoice = new LeaseInvoiceDTO { LeaseInvoiceId = RandomHelper.Next(), CreateDate = DateTime.Now, InvoiceDate = DateTime.Now, OperatorName = StatusData.curUser }; var selectedPane = leasePayscheduleChildView.PaneGroups.SelectedPane.Title.ToString(); if (selectedPane == "租赁的飞机对应的付款计划") { if (SelContractAircraft == null) { MessageAlert("还未选择合同飞机!"); } else if (SelAcPaymentSchedule != null) { if (SelPaymentScheduleLine == null) { MessageAlert("请选择一条付款计划行!"); } else { var orderline = new AircraftLeaseOrderLineDTO(); var order = AircraftLeaseOrders.FirstOrDefault(p => { orderline = p.AircraftLeaseOrderLines.FirstOrDefault( l => l.ContractAircraftId == SelContractAircraft.ContractAircrafId); return orderline != null && orderline.OrderId == p.Id; }); if (order != null) { invoice.OrderId = order.Id; //发票关联到订单,发票行关联到订单行 } else { MessageAlert("与订单关联时出错,请检查数据!"); } invoice.SupplierName = SelAcPaymentSchedule.SupplierName; invoice.SupplierId = SelAcPaymentSchedule.SupplierId; invoice.PaymentScheduleLineId = SelPaymentScheduleLine.PaymentScheduleLineId; invoice.InvoiceValue = SelPaymentScheduleLine.Amount; var invoiceLine = new InvoiceLineDTO { OrderLineId = orderline.Id, Amount = SelPaymentScheduleLine.Amount, }; invoice.InvoiceLines.Add(invoiceLine); LeaseInvoices.AddNew(invoice); leasePayscheduleChildView.Close(); } } } else if (selectedPane == "租赁的发动机对应的付款计划") { if (SelContractEngine == null) { MessageAlert("还未选择合同发动机!"); } else if (SelEnginePaymentSchedule != null) { if (SelPaymentScheduleLine == null) { MessageAlert("请选择一条付款计划行!"); } else { var orderline = new EngineLeaseOrderLineDTO(); var order = EngineLeaseOrders.FirstOrDefault(p => { orderline = p.EngineLeaseOrderLines.FirstOrDefault( l => l.ContractEngineId == SelContractEngine.ContractEngineId); return orderline != null && orderline.OrderId == p.Id; }); if (order != null) { invoice.OrderId = order.Id; //发票关联到订单,发票行关联到订单行 } else { MessageAlert("与订单关联时出错,请检查数据!"); } invoice.SupplierName = SelEnginePaymentSchedule.SupplierName; invoice.SupplierId = SelEnginePaymentSchedule.SupplierId; invoice.PaymentScheduleLineId = SelPaymentScheduleLine.PaymentScheduleLineId; invoice.InvoiceValue = SelPaymentScheduleLine.Amount; var invoiceLine = new InvoiceLineDTO { OrderLineId = orderline.Id, Amount = SelPaymentScheduleLine.Amount, }; invoice.InvoiceLines.Add(invoiceLine); LeaseInvoices.AddNew(invoice); leasePayscheduleChildView.Close(); } } } }
/// <summary> /// 执行确定命令。 /// </summary> /// <param name="sender"></param> public void OnCommitExecute(object sender) { var invoice = new MaintainPrepaymentInvoiceDTO { PrepaymentInvoiceId = RandomHelper.Next(), CreateDate = DateTime.Now, InvoiceDate = DateTime.Now, }; if (SelectMaintainPaymentSchedule != null) { if (SelectPaymentScheduleLine == null) { MessageAlert("请选择一条付款计划行!"); } else { invoice.SupplierId = SelectMaintainPaymentSchedule.SupplierId; invoice.CurrencyId = SelectMaintainPaymentSchedule.CurrencyId; invoice.SupplierName = SelectMaintainPaymentSchedule.SupplierName; invoice.PaymentScheduleLineId = SelectPaymentScheduleLine.PaymentScheduleLineId; invoice.InvoiceValue = SelectPaymentScheduleLine.Amount; var invoiceLine = new InvoiceLineDTO { Amount = SelectPaymentScheduleLine.Amount, }; invoice.InvoiceLines.Add(invoiceLine); PrepaymentInvoices.AddNew(invoice); prepayPayscheduleChildView.Close(); } } else { MessageAlert("未选中维修付款计划!"); } }