/// <summary> /// GetMInOutLine /// </summary> /// <param name="ctx"></param> /// <param name="fields"></param> /// <returns></returns> public Dictionary <string, string> GetMInOutLine(Ctx ctx, string fields) { string[] paramValue = fields.Split(','); //Assign parameter value int Orig_InOutLine_ID = Util.GetValueOfInt(paramValue[0].ToString()); //End Assign parameter value MInOutLine ioLine = new MInOutLine(ctx, Orig_InOutLine_ID, null); Dictionary <string, string> result = new Dictionary <string, string>(); result["M_Locator_ID"] = ioLine.GetM_Locator_ID().ToString(); result["MovementQty"] = ioLine.GetMovementQty().ToString(); result["C_Project_ID"] = ioLine.GetC_Project_ID().ToString(); result["C_Campaign_ID"] = ioLine.GetC_Campaign_ID().ToString(); result["M_Product_ID"] = ioLine.GetM_Product_ID().ToString(); result["M_AttributeSetInstance_ID"] = ioLine.GetM_AttributeSetInstance_ID().ToString(); result["C_UOM_ID"] = ioLine.GetC_UOM_ID().ToString(); result["IsDropShip"] = ioLine.IsDropShip() ? "Y" : "N"; // JID_1310: On Selection of Shipment line on Customer/Vendor RMA. System should check Total Delivred - Total Return Qty From Sales PO line and Balance show in qty field decimal qtyRMA = Util.GetValueOfDecimal(DB.ExecuteScalar(@"SELECT SUM(QtyEntered) FROM C_Order o INNER JOIN C_OrderLine ol ON o.C_Order_ID = ol.C_Order_ID WHERE ol.Orig_InOutLine_ID = " + Orig_InOutLine_ID + @" AND ol.Isactive = 'Y' AND o.docstatus NOT IN ('RE' , 'VO')", null, null)); decimal QtyNotDelivered = ioLine.GetQtyEntered() - qtyRMA; result["QtyEntered"] = QtyNotDelivered.ToString(); //retlst.Add(retValue); return(result); }
public JsonResult GetInOutLine(string param) { string retError = ""; string retJSON = ""; if (Session["ctx"] != null) { VAdvantage.Utility.Ctx ctx = Session["ctx"] as Ctx; string[] paramValue = param.Split(','); Dictionary <String, String> retDic = new Dictionary <string, string>(); int id; //Assign parameter value id = Util.GetValueOfInt(paramValue[0].ToString()); MInOutLine Orig_InOutLine = new MInOutLine(ctx, id, null); retDic["MovementQty"] = Orig_InOutLine.GetMovementQty().ToString(); retDic["C_Project_ID"] = Orig_InOutLine.GetC_Project_ID().ToString(); retDic["C_Campaign_ID"] = Orig_InOutLine.GetC_Campaign_ID().ToString(); retDic["M_Product_ID"] = Orig_InOutLine.GetM_Product_ID().ToString(); retDic["M_AttributeSetInstance_ID"] = Orig_InOutLine.GetM_AttributeSetInstance_ID().ToString(); retDic["C_UOM_ID"] = Orig_InOutLine.GetC_UOM_ID().ToString(); //retlst.Add(retValue); //retVal.Add(notReserved); retJSON = JsonConvert.SerializeObject(retDic); } else { retError = "Session Expired"; } return(Json(new { result = retJSON, error = retError }, JsonRequestBehavior.AllowGet)); }
/// <summary> /// GetMInOutLine /// </summary> /// <param name="ctx"></param> /// <param name="fields"></param> /// <returns></returns> public Dictionary <string, string> GetMInOutLine(Ctx ctx, string fields) { string[] paramValue = fields.Split(','); //Assign parameter value int Orig_InOutLine_ID = Util.GetValueOfInt(paramValue[0].ToString()); //End Assign parameter value MInOutLine ioLine = new MInOutLine(ctx, Orig_InOutLine_ID, null); Dictionary <string, string> result = new Dictionary <string, string>(); result["M_Locator_ID"] = ioLine.GetM_Locator_ID().ToString(); result["MovementQty"] = ioLine.GetMovementQty().ToString(); result["C_Project_ID"] = ioLine.GetC_Project_ID().ToString(); result["C_Campaign_ID"] = ioLine.GetC_Campaign_ID().ToString(); result["M_Product_ID"] = ioLine.GetM_Product_ID().ToString(); result["M_AttributeSetInstance_ID"] = ioLine.GetM_AttributeSetInstance_ID().ToString(); result["C_UOM_ID"] = ioLine.GetC_UOM_ID().ToString(); //retlst.Add(retValue); return(result); }
/** * Split Shipment into confirmed and dispute * @param original original shipment * @param C_DocType_ID target DocType * @param confirmLines confirm lines */ private void SplitInOut(MInOut original, int C_DocType_ID, MInOutLineConfirm[] confirmLines) { MInOut split = new MInOut(original, C_DocType_ID, original.GetMovementDate()); split.AddDescription("Splitted from " + original.GetDocumentNo()); split.SetIsInDispute(true); // new 13 jan int _count = Util.GetValueOfInt(DB.ExecuteScalar("SELECT count(*) FROM AD_Column clm INNER JOIN ad_table tbl on (tbl.ad_table_id=clm.ad_table_id) where tbl.tablename='M_InOutLineConfirm' and clm.columnname = 'M_Locator_ID' ")); //nnayak : Change for bug 1431337 split.SetRef_InOut_ID(original.Get_ID()); if (!split.Save(Get_TrxName())) { throw new Exception("Cannot save Split"); } original.AddDescription("Split: " + split.GetDocumentNo()); if (!original.Save(Get_TrxName())) { throw new Exception("Cannot update original Shipment"); } // Go through confirmations for (int i = 0; i < confirmLines.Length; i++) { MInOutLineConfirm confirmLine = confirmLines[i]; Decimal differenceQty = confirmLine.GetDifferenceQty(); if (differenceQty.CompareTo(Env.ZERO) == 0) { continue; } // MInOutLine oldLine = confirmLine.GetLine(); log.Fine("Qty=" + differenceQty + ", Old=" + oldLine); // MInOutLine splitLine = new MInOutLine(split); splitLine.SetC_OrderLine_ID(oldLine.GetC_OrderLine_ID()); splitLine.SetC_UOM_ID(oldLine.GetC_UOM_ID()); splitLine.SetDescription(oldLine.GetDescription()); splitLine.SetIsDescription(oldLine.IsDescription()); splitLine.SetLine(oldLine.GetLine()); splitLine.SetM_AttributeSetInstance_ID(oldLine.GetM_AttributeSetInstance_ID()); //new 13 jan vikas ,assigne by surya sir if (_count > 0) { if (confirmLine.GetM_Locator_ID() > 0) { splitLine.SetM_Locator_ID(confirmLine.GetM_Locator_ID()); } else { splitLine.SetM_Locator_ID(oldLine.GetM_Locator_ID()); } } else { splitLine.SetM_Locator_ID(oldLine.GetM_Locator_ID()); } //End // splitLine.SetM_Locator_ID(oldLine.GetM_Locator_ID()); splitLine.SetM_Product_ID(oldLine.GetM_Product_ID()); splitLine.SetM_Warehouse_ID(oldLine.GetM_Warehouse_ID()); splitLine.SetRef_InOutLine_ID(oldLine.GetRef_InOutLine_ID()); splitLine.AddDescription("Split: from " + oldLine.GetMovementQty()); // Qtys splitLine.SetQty(differenceQty); // Entered/Movement if (!splitLine.Save(Get_TrxName())) { throw new Exception("Cannot save Split Line"); } // Old oldLine.AddDescription("Splitted: from " + oldLine.GetMovementQty()); oldLine.SetQty(Decimal.Subtract(oldLine.GetMovementQty(), differenceQty)); if (!oldLine.Save(Get_TrxName())) { throw new Exception("Cannot save Splited Line"); } // Update Confirmation Line confirmLine.SetTargetQty(Decimal.Subtract(confirmLine.GetTargetQty(), differenceQty)); confirmLine.SetDifferenceQty(Env.ZERO); if (!confirmLine.Save(Get_TrxName())) { throw new Exception("Cannot save Split Confirmation"); } } // for all confirmations _processMsg = "Split @M_InOut_ID@=" + split.GetDocumentNo() + " - @M_InOutConfirm_ID@="; // Create Dispute Confirmation split.ProcessIt(DocActionVariables.ACTION_PREPARE); // split.createConfirmation(); split.Save(Get_TrxName()); MInOutConfirm[] splitConfirms = split.GetConfirmations(true); if (splitConfirms.Length > 0) { int index = 0; if (splitConfirms[index].IsProcessed()) { if (splitConfirms.Length > 1) { index++; // try just next } if (splitConfirms[index].IsProcessed()) { _processMsg += splitConfirms[index].GetDocumentNo() + " processed??"; return; } } splitConfirms[index].SetIsInDispute(true); splitConfirms[index].Save(Get_TrxName()); _processMsg += splitConfirms[index].GetDocumentNo(); // Set Lines to unconfirmed MInOutLineConfirm[] splitConfirmLines = splitConfirms[index].GetLines(false); for (int i = 0; i < splitConfirmLines.Length; i++) { MInOutLineConfirm splitConfirmLine = splitConfirmLines[i]; splitConfirmLine.SetScrappedQty(Env.ZERO); splitConfirmLine.SetConfirmedQty(Env.ZERO); splitConfirmLine.Save(Get_TrxName()); } } else { _processMsg += "??"; } }