//通过total,cutoff,backFreight计算realTotal private void calTotalBackAndRealTotal() { double total = 0; ValidateUtility.getPrice(this.dataGridView2[1, 0], false, out total); double totalPieces = 0; double.TryParse(this.label_totalPieces.Text, out totalPieces); double cutoff = 100; double.TryParse(this.textBox_cutoff.Text, out cutoff); double backFreightPerPiece = 0; double.TryParse(this.textBox_backFreightPerPiece.Text, out backFreightPerPiece); this.label_totalBackFreight.Text = (totalPieces * backFreightPerPiece).ToString(); double realTotal = total * cutoff / 100 - backFreightPerPiece * totalPieces; this.textBox_realTotal.Text = realTotal.ToString(); }
protected bool getCirculation(out ProductCirculation circulation) { circulation = new ProductCirculation(); circulation.ID = circulationID; circulation.Type = (int)conf.type; circulation.FlowType = conf.productDirection; circulation.ArrearDirection = conf.arrearsDirection; string name; if (ValidateUtility.getName(this.textBox_serial, this.errorProvider1, out name) == false) { return(false); } circulation.Code = name; int customerID = -1; if (this.lookupText1.Visible == true && ValidateUtility.getLookupValueID(this.lookupText1, this.errorProvider1, out customerID) == false) { return(false); } circulation.CustomerID = customerID; circulation.CirculationTime = this.dateTime_sellTime.Value; circulation.Comment = this.textBox_comment.Text; circulation.Oper = this.textBox_operator.Text; circulation.LastPayReceipt = this.label_lastPayReceipt.Text; if (dataGridView2[1, 0].Value == null || dataGridView2[1, 0].Value.ToString() == "") { circulation.Total = 0; } else { circulation.Total = (double)dataGridView2[1, 0].Value; } circulation.CustomerName = this.lookupText1.Text_Lookup; double total, backFreightPerPiece, cutoff, realTotal, previousArrears, thisPayed, freight; if (ValidateUtility.getPrice(this.dataGridView2[1, 0], true, out total) && ValidateUtility.getDouble(this.textBox_cutoff, this.errorProvider1, false, true, out cutoff) && ValidateUtility.getPrice(this.textBox_backFreightPerPiece, this.errorProvider1, false, true, out backFreightPerPiece) && ValidateUtility.getPrice(this.textBox_realTotal, this.errorProvider1, true, true, out realTotal) && ValidateUtility.getPrice(this.textBox_previousArrears, this.errorProvider1, false, false, out previousArrears) && ValidateUtility.getPrice(this.textBox_thisPayed, this.errorProvider1, false, true, out thisPayed) && ValidateUtility.getPrice(this.textBox_freight, this.errorProvider1, false, true, out freight)) { circulation.Total = total; circulation.BackFreightPerPiece = backFreightPerPiece; circulation.RealTotal = realTotal; circulation.PreviousArrears = previousArrears; circulation.ThisPayed = thisPayed; circulation.Freight = freight; } else { return(false); } return(true); }