public FFDataSet.EnvelopeLineRow NewEnvelopeLineRow(LineItemDRM lineItem) { FFDataSet.EnvelopeLineRow newRow = this.NewEnvelopeLineRow(); newRow.lineItemID = lineItem.LineID; return(newRow); }
public FFDataSet.EnvelopeLineRow NewEnvelopeLineRow() { FFDataSet.EnvelopeLineRow newRow = ffDataSet.EnvelopeLine.NewEnvelopeLineRow(); newRow.id = this.getNextIDFromTableNamed("EnvelopeLine"); newRow.lineItemID = LineItemCON.NULL.ID; newRow.envelopeID = EnvelopeCON.NULL.ID; newRow.description = ""; newRow.amount = 0; ffDataSet.EnvelopeLine.AddEnvelopeLineRow(newRow); return(newRow); }
private static bool copyFromOppLines(FFDataSet dataSet, FFDataSet.LineItemRow line, decimal envSum) { bool copied = false; List <FFDataSet.EnvelopeLineRow> oppELines = new List <FFDataSet.EnvelopeLineRow>(); decimal sum = 0.0m; // get opp Envelope lines foreach (FFDataSet.EnvelopeLineRow oppELine in dataSet.EnvelopeLine) { if (oppELine.LineItemRow.transactionID == line.transactionID && oppELine.LineItemRow.creditDebit != line.creditDebit) { oppELines.Add(oppELine); sum += oppELine.amount; } } if (sum == line.amount - envSum) { foreach (FFDataSet.EnvelopeLineRow eLine in oppELines) { FFDataSet.EnvelopeLineRow newEline = dataSet.EnvelopeLine.NewEnvelopeLineRow(); newEline.lineItemID = line.id; newEline.envelopeID = eLine.envelopeID; newEline.description = eLine.description; newEline.amount = eLine.amount; dataSet.EnvelopeLine.AddEnvelopeLineRow(newEline); if (oppELines.Count == 1) { newEline.LineItemRow.envelopeID = eLine.envelopeID; } else if (oppELines.Count > 1) { newEline.LineItemRow.envelopeID = SpclEnvelope.SPLIT; } } copied = true; } return(copied); }
private static void fillInFromEnvelopeLines(FFDataSet dataSet, LineSum lineSum, List <EnvBal> envelopes, decimal skipAmount) { decimal remainingAmount = lineSum.RemainingAmount - skipAmount; while (remainingAmount > 0.0m) { FFDataSet.EnvelopeLineRow envLine = null; EnvBal envelope = getNegativeEnvelope(envelopes); if (envelope == null) { break; } // Make a new envelope line for this envelope envLine = dataSet.EnvelopeLine.NewEnvelopeLineRow(); envLine.lineItemID = lineSum.Line.id; envLine.envelopeID = envelope.envelopeID; envLine.description = ""; envLine.amount = 0.0m; dataSet.EnvelopeLine.AddEnvelopeLineRow(envLine); // decide how much to change the envelopeLine.amount if (remainingAmount >= +Math.Abs(envelope.balance)) { envLine.amount = Math.Abs(envelope.balance); remainingAmount -= Math.Abs(envelope.balance); envelope.balance = 0.0m; } else { envLine.amount = remainingAmount; envelope.balance += remainingAmount; remainingAmount = 0.0m; } } }
public EnvelopeLineDRM(LineItemDRM parentLine) { this.envelopeLineRow = DataSetModel.Instance.NewEnvelopeLineRow(parentLine); }
public EnvelopeLineDRM(FFDataSet.EnvelopeLineRow envLineRow) { this.envelopeLineRow = envLineRow; }
/////////////////////////////////////////////////////////// // Public functions /////////////////////////////////////////////////////////// public EnvelopeLineDRM() { this.envelopeLineRow = DataSetModel.Instance.NewEnvelopeLineRow(); }
//private void setAmount(decimal? amount, bool cd) //{ // decimal newAmount = amount.Value; // if (newAmount < 0.0m) // { // newAmount = decimal.Negate(newAmount); // cd = !cd; // } // newAmount = decimal.Round(newAmount, 2); // this.eLineRow.amount = newAmount; // this.eLineRow.creditDebit = cd; // this.setOppLineAmount(this.eLineRow.id); //} /////////////////////////////////////////////////////////////////////// // Protected functions /////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////// // Public functions /////////////////////////////////////////////////////////////////////// public SubLineRegModel(FFDataSet.EnvelopeLineRow row) : base(row.LineItemRow) { this.eLineRow = row; }