/// <summary> /// Void Document. /// </summary> /// <returns>false</returns> public Boolean VoidIt() { //Added BY arpit on 12th Dec,2016 if (GetDocStatus() == "CO") { this.SetDocAction(DOCACTION_Void); this.SetDocStatus(DOCACTION_Void); if (!this.Save(Get_Trx())) { _processMsg = "Could not void the document"; return(false); } MMovementConfirm RevMoveConf = new MMovementConfirm(GetCtx(), 0, Get_Trx()); CopyValues(this, RevMoveConf, GetAD_Client_ID(), GetAD_Org_ID()); RevMoveConf.SetDocumentNo(GetDocumentNo()); // RevMoveConf.SetDocStatus("RE"); // RevMoveConf.SetDocAction(DOCACTION_Void); // RevMoveConf.SetProcessed(true); RevMoveConf.AddDescription("{->" + GetDocumentNo() + ")"); if (RevMoveConf.Save(Get_Trx())) { MMovementLineConfirm[] Lines = GetLines(true); for (int i = 0; i < Lines.Length; i++) { MMovementLineConfirm oLines = Lines[i]; MMovementLineConfirm revLines = new MMovementLineConfirm(GetCtx(), 0, Get_TrxName()); CopyValues(oLines, revLines, oLines.GetAD_Client_ID(), oLines.GetAD_Org_ID()); revLines.SetM_MovementConfirm_ID(RevMoveConf.GetM_MovementConfirm_ID()); revLines.SetConfirmedQty(Decimal.Negate(revLines.GetConfirmedQty())); revLines.SetDifferenceQty(Decimal.Negate(revLines.GetDifferenceQty())); revLines.SetScrappedQty(Decimal.Negate(revLines.GetScrappedQty())); revLines.SetTargetQty(Decimal.Negate(revLines.GetTargetQty())); revLines.SetProcessed(true); if (!revLines.Save(Get_Trx())) { Get_Trx().Rollback(); _processMsg = "Could not create Movement Comfirmation Reversal Line"; return(false); } } } else { Get_Trx().Rollback(); _processMsg = "Could not create Move Confirmation Reversal"; return(false); } if (RevMoveConf.CompleteIt() == DocActionVariables.ACTION_COMPLETE) { RevMoveConf.SetDocStatus("RE"); RevMoveConf.SetDocAction(DOCACTION_Void); RevMoveConf.SetProcessed(true); RevMoveConf.Save(Get_Trx()); } else { _processMsg = "Reversal ERROR: "; return(false); } } //End Here log.Info("VoidIt - " + ToString()); return(true); }