Hi,
i have created a Methord that Pulls Soline items, i want to throw Error for certain conditions in that methord, How can we Achive that?
Hi,
i have created a Methord that Pulls Soline items, i want to throw Error for certain conditions in that methord, How can we Achive that?
Best answer by Atiq
Hi Vignesh,
i have written the logic to bring the soline values from artran, and using Saleorderval(tran1,line1); method, iam populating the error
public virtual IEnumerable invFilter(PXAdapter adapter)
{
var x = AlternateInvId.Select().Count;
var q = Invview.Select().Count;
var s = Lineqty.Select().Count;
var k = Invview.AskExt();
if (this.Invview.AskExt() == WebDialogResult.OK)
{
foreach (ARInvoice invoice in Invview.Select())
{
if (invoice.Selected == true)
{
try
{
foreach (SOLine sO in Lineqty.Select())
{
var kb = sO.InvoiceNbr;
var aa = sO.OrderNbr;
}
foreach (ARTran tran1 in PXSelect<
ARTran,
Where<ARTran.tranType, Equal<Current<ARInvoice.docType>>,
And<ARTran.refNbr, Equal<Current<ARInvoice.refNbr>>>>>
.Select(Base, invoice.RefNbr, invoice.DocType))
{
SOLine line1 = PXSelect<
SOLine,
Where<SOLine.orderType, Equal<Required<SOLine.orderType>>,
And<SOLine.orderNbr, Equal<Required<SOLine.orderNbr>>,
And<SOLine.lineNbr, Equal<Required<SOLine.lineNbr>>>>>>
.Select(Base, tran1.SOOrderType, tran1.SOOrderNbr, tran1.SOOrderLineNbr);
if (line1 != null)
{
SOLine line = new SOLine();
line.InventoryID = line1.InventoryID;
ItemAvailabilityExt.Check(line);
//line.UOM = tran1.UOM;
line.BranchID = line1.BranchID;
line.OrderQty = line1.OrderQty;
Saleorderval(tran1,line1);
line.UOM = line1.UOM;
line.InvoiceNbr = invoice.RefNbr;
PXDBQuantityAttribute.CalcTranQty<SOLine.orderQty>(Base.Transactions.Cache, line1);
Base.Transactions.Insert(line);
}
}
}
catch (PXException ex)
{
// throw ex.Message;
}
public void Saleorderval(ARTran tran, SOLine line2)
{
foreach (SOLine line
in PXSelect<SOLine, Where<SOLine.invoiceNbr, Equal<Required<SOLine.invoiceNbr>>, And<SOLine.inventoryID, Equal<Required<SOLine.inventoryID>>>>>.Select(Base, tran.RefNbr, tran.InventoryID))
{
if (line.OrderType == "RC")
{
if (line.CustomerID == tran.CustomerID)
{
if (line.InvoiceNbr == tran.RefNbr)
{
if (tran.Qty != (LineQtyCount))
{
LineQtyCount = LineQtyCount + line.OrderQty;
if (line.OrderQty != LineQtyCount)
{
// throw new PXException(Messages.SOLine, PXErrorLevel.RowError);
PXUIFieldAttribute.SetError<SOLine.orderQty>(Base.Transactions.Cache, line1, "No");
}
}
}
}
}
Enter your E-mail address. We'll send you an e-mail with instructions to reset your password.