private void btn_YFAdd_Click(object sender, EventArgs e) { if (this.atBillsIncomeList == null) { this.atBillsIncomeList = new List <Model.AtBillsIncome>(); } Model.AtBillsIncome model = new Book.Model.AtBillsIncome(); model.BillsId = Guid.NewGuid().ToString(); model.TheOpenDate = DateTime.Now; model.ShouldPayAccountId = this.shouldPayAccount.ShouldPayAccountId; this.atBillsIncomeList.Add(model); this.bindingSourceAtBill.Position = this.bindingSourceAtBill.IndexOf(model); this.gridControl3.RefreshDataSource(); }
protected override void AddNew() { //会计传票 this.atSummon = new Model.AtSummon(); this.atSummon.SummonDate = DateTime.Now; this.atSummon.Id = this.atSummonManager.GetId(); this.atSummon.SummonId = Guid.NewGuid().ToString(); this.atSummon.Details = new List <Model.AtSummonDetail>(); this.atSummon.CreditTotal = 0; this.atSummon.TotalDebits = 0; this.shouldPayAccount = new Book.Model.ShouldPayAccount(); this.shouldPayAccount.ShouldPayAccountId = Guid.NewGuid().ToString(); this.shouldPayAccount.AtSummon = this.atSummon; this.shouldPayAccount.AtSummonId = this.atSummon.SummonId; //this.shouldPayAccount.AtBillsIncome = this.AtBillsIncome; //this.shouldPayAccount.AtBillsIncomeId = this.AtBillsIncome.BillsId; this.shouldPayAccount.Employee = BL.V.ActiveOperator.Employee; if (this.shouldPayAccount.Employee != null) { this.shouldPayAccount.EmployeeId = this.shouldPayAccount.Employee.EmployeeId; } //应付票据作业 //this.AtBillsIncome = new Model.AtBillsIncome(); //this.AtBillsIncome.BillsId = Guid.NewGuid().ToString(); //this.AtBillsIncome.IncomeCategory = "0"; //this.AtBillsIncome.BillsOften = "0"; //this.AtBillsIncome.TheOpenDate = DateTime.Now; this.atBillsIncomeList = new List <Model.AtBillsIncome>(); Model.AtBillsIncome model = new Book.Model.AtBillsIncome(); model.BillsId = Guid.NewGuid().ToString(); model.TheOpenDate = DateTime.Now; model.ShouldPayAccountId = this.shouldPayAccount.ShouldPayAccountId; this.atBillsIncomeList.Add(model); this.action = "insert"; }
//查询应付账款明细表 private void btn_Search_Click(object sender, EventArgs e) { Book.UI.Query.ConditionCOChooseForm f = new ConditionCOChooseForm(); if (f.ShowDialog(this) == DialogResult.OK) { ConditionCO condition = f.Condition as ConditionCO; dt = this.invoicecgmanager.SelectByConditionCOBiao(condition.StartInvoiceDate, condition.EndInvoiceDate, condition.StartJHDate, condition.EndJHDate, condition.StartFKDate, condition.EndFKDate, condition.SupplierStart, condition.SupplierEnd, condition.ProductStart, condition.ProductEnd, condition.COStartId, condition.COEndId, condition.CusXOId, condition.EmpStart, condition.EmpEnd); //查询条件 this.shouldPayAccountCondition = this.shouldPayAccount.ShouldPayAccountCondition; if (this.shouldPayAccountCondition == null) { this.shouldPayAccountCondition = new Book.Model.ShouldPayAccountCondition(); this.shouldPayAccountCondition.ShouldPayAccountConditionId = Guid.NewGuid().ToString(); } this.shouldPayAccountCondition.StartInvoiceDate = condition.StartInvoiceDate; this.shouldPayAccountCondition.EndInvoiceDate = condition.EndInvoiceDate; this.shouldPayAccountCondition.StartJHDate = condition.StartJHDate; this.shouldPayAccountCondition.EndJHDate = condition.EndJHDate; this.shouldPayAccountCondition.StartFKDate = condition.StartFKDate; this.shouldPayAccountCondition.EndFKDate = condition.EndFKDate; this.shouldPayAccountCondition.SupplierStart = condition.SupplierStart; this.shouldPayAccountCondition.SupplierStartId = condition.SupplierStart == null ? null : condition.SupplierStart.SupplierId; this.shouldPayAccountCondition.SupplierEnd = condition.SupplierEnd; this.shouldPayAccountCondition.SupplierEndId = condition.SupplierEnd == null ? null : condition.SupplierEnd.SupplierId; this.shouldPayAccountCondition.ProductStart = condition.ProductStart; this.shouldPayAccountCondition.ProductStartId = condition.ProductStart == null ? null : condition.ProductStart.ProductId; this.shouldPayAccountCondition.ProductEnd = condition.ProductEnd; this.shouldPayAccountCondition.ProductEndId = condition.ProductEnd == null ? null : condition.ProductEnd.ProductId; this.shouldPayAccountCondition.COStartId = condition.COStartId; this.shouldPayAccountCondition.COEndId = condition.COEndId; this.shouldPayAccountCondition.CusXOId = condition.CusXOId; this.shouldPayAccountCondition.EmpStart = condition.EmpStart; this.shouldPayAccountCondition.EmpStartId = condition.EmpStart == null ? null : condition.EmpStart.EmployeeId; this.shouldPayAccountCondition.EmpEnd = condition.EmpEnd; this.shouldPayAccountCondition.EmpEndId = condition.EmpEnd == null ? null : condition.EmpEnd.EmployeeId; this.shouldPayAccount.ShouldPayAccountCondition = this.shouldPayAccountCondition; this.shouldPayAccount.ShouldPayAccountConditionId = this.shouldPayAccountCondition == null ? null : this.shouldPayAccountCondition.ShouldPayAccountConditionId; if (condition.SupplierStart != null && condition.SupplierEnd != null) { if (condition.SupplierStart.SupplierId != condition.SupplierEnd.SupplierId) { this.nccSupplier.EditValue = null; this.txt_PayMethod.EditValue = null; } else { this.nccSupplier.EditValue = condition.SupplierStart == null ? null : condition.SupplierStart; this.txt_PayMethod.EditValue = condition.SupplierStart == null ? null : condition.SupplierStart.PayMethod; } } this.txt_InvoiceDate.EditValue = (condition.StartInvoiceDate == null ? null : condition.StartInvoiceDate.Value.ToString("yyyy-MM-dd")) + " - " + (condition.EndInvoiceDate == null ? null : condition.EndInvoiceDate.Value.ToString("yyyy-MM-dd")); this.txt_FKDate.EditValue = (condition.StartFKDate == null ? null : condition.StartFKDate.Value.ToString("yyyy-MM-dd")) + " - " + (condition.EndFKDate == null ? null : condition.EndFKDate.Value.ToString("yyyy-MM-dd")); if (dt.Rows.Count > 0) { this.spe_JinE.EditValue = Math.Round(Convert.ToDouble(dt.Compute("Sum(JinE)", "1=1")), 0); this.spe_ShuiE.EditValue = Math.Round(Convert.ToDouble(dt.Compute("Sum(ShuiE)", "")), 0); this.spe_Total.EditValue = Math.Round(Convert.ToDouble(this.spe_JinE.Value) + Convert.ToDouble(this.spe_ShuiE.Value), 0); } //添加、删除会计传票详细 int count = this.atSummon.Details.Count; for (int i = 0; i < count; i++) { if (this.atSummon.Details.Any(d => d.Lending == "借")) { this.atSummon.Details.Remove(this.atSummon.Details.First(d => d.Lending == "借")); } } atSummondetail = new Book.Model.AtSummonDetail(); atSummondetail.SummonDetailId = Guid.NewGuid().ToString(); atSummondetail.Lending = "借"; //atSummondetail.SubjectId = this.subjectList.First(d => d.Id == "2144001").SubjectId; atSummondetail.AMoney = Convert.ToDecimal(this.spe_JinE.EditValue) - Convert.ToDecimal(this.spe_ZheRang.EditValue); this.atSummon.Details.Add(atSummondetail); atSummondetail = new Book.Model.AtSummonDetail(); atSummondetail.SummonDetailId = Guid.NewGuid().ToString(); atSummondetail.Lending = "借"; //atSummondetail.SubjectId = this.subjectList.First(d => d.Id == "6213000").SubjectId; atSummondetail.AMoney = Convert.ToDecimal(this.spe_ShuiE.EditValue); this.atSummon.Details.Add(atSummondetail); this.CountJieDaiTotal(this.atSummon.Details); this.gridControl1.RefreshDataSource(); this.spe_FKZheRang.EditValue = 0; this.spe_ZheRang.EditValue = 0; //应付票据作业 if (this.atBillsIncomeList.Count > 0) { Model.AtBillsIncome atbill = this.atBillsIncomeList[0]; atbill.NotesMoney = this.spe_Total.Value; atbill.PassingObject = this.shouldPayAccountCondition.SupplierStartId; } else { Model.AtBillsIncome atbill = new Book.Model.AtBillsIncome(); atbill.BillsId = Guid.NewGuid().ToString(); atbill.TheOpenDate = DateTime.Now; atbill.ShouldPayAccountId = this.shouldPayAccount.ShouldPayAccountId; atbill.NotesMoney = this.spe_Total.Value; atbill.PassingObject = this.shouldPayAccountCondition.SupplierStartId; this.atBillsIncomeList.Add(atbill); } this.gridControl3.RefreshDataSource(); } }