/** * Create Line Reversal * @return new reversed CashLine */ public MCashLine CreateReversal() { MCash parent = GetParent(); if (parent.IsProcessed()) { // saved parent = MCash.Get(GetCtx(), parent.GetAD_Org_ID(), parent.GetStatementDate(), parent.GetC_Currency_ID(), Get_TrxName()); } // MCashLine reversal = new MCashLine(parent); reversal.SetClientOrg(this); reversal.SetC_BankAccount_ID(GetC_BankAccount_ID()); reversal.SetC_Charge_ID(GetC_Charge_ID()); reversal.SetC_Currency_ID(GetC_Currency_ID()); reversal.SetC_Invoice_ID(GetC_Invoice_ID()); reversal.SetCashType(GetCashType()); reversal.SetDescription(GetDescription()); reversal.SetIsGenerated(true); // reversal.SetAmount(Decimal.Negate(GetAmount())); //if (GetDiscountAmt() == null) //// SetDiscountAmt(Env.ZERO); //else reversal.SetDiscountAmt(Decimal.Negate(GetDiscountAmt())); //if (GetWriteOffAmt() == null) // SetWriteOffAmt(Env.ZERO); //else reversal.SetWriteOffAmt(Decimal.Negate(GetWriteOffAmt())); reversal.AddDescription("(" + GetLine() + ")"); return(reversal); }