/** * 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); }
/// <summary> /// Load Specific Document Details /// </summary> /// <returns>error message or null</returns> public override String LoadDocumentDetails() { MCash cash = (MCash)GetPO(); SetDateDoc(cash.GetStatementDate()); BeginningBalance = cash.GetBeginningBalance(); HeaderCasbookID = cash.GetC_CashBook_ID(); // Amounts SetAmount(Doc.AMTTYPE_Gross, cash.GetStatementDifference()); // Set CashBook Org & Currency MCashBook cb = MCashBook.Get(GetCtx(), cash.GetC_CashBook_ID()); SetC_CashBook_ID(cb.GetC_CashBook_ID()); SetC_Currency_ID(cb.GetC_Currency_ID()); // Contained Objects _lines = LoadLines(cash, cb); log.Fine("Lines=" + _lines.Length); return(null); }