public virtual IEnumerable AddARTran(PXAdapter adapter) { foreach (ARTranForDirectInvoice origTran in arTranList.Cache.Updated) { if (origTran.Selected != true) { continue; } var tran = (ARTran)Base.Transactions.Cache.CreateInstance(); tran.InventoryID = origTran.InventoryID; tran.SubItemID = origTran.SubItemID; tran.SiteID = origTran.SiteID; tran.LocationID = origTran.LocationID; tran.LotSerialNbr = origTran.LotSerialNbr; tran.ExpireDate = origTran.ExpireDate; tran.UOM = origTran.UOM; tran.Qty = INTranType.InvtMultFromInvoiceType(Base.Document.Current.DocType) * Math.Abs(origTran.Qty ?? 0m); tran.CuryUnitPrice = origTran.CuryUnitPrice; tran.OrigInvoiceType = origTran.TranType; tran.OrigInvoiceNbr = origTran.RefNbr; tran.OrigInvoiceLineNbr = origTran.LineNbr; // not necessary Base.InsertInvoiceDirectLine(tran); origTran.Selected = false; } return(adapter.Get()); }
protected virtual void SOOrderTypeOperation_InvtMult_FieldDefaulting(PXCache sender, PXFieldDefaultingEventArgs e) { SOOrderTypeOperation row = e.Row as SOOrderTypeOperation; if (row != null) { e.NewValue = INTranType.InvtMult(row.INDocType); e.Cancel = true; } }
protected virtual void SOOrderTypeOperation_INDocType_FieldVerifying(PXCache sender, PXFieldVerifyingEventArgs e) { SOOrderTypeOperation row = (SOOrderTypeOperation)e.Row; if (row == null) { return; } short?inInvtMult = INTranType.InvtMult((string)e.NewValue); if ((row.Operation == SOOperation.Issue && inInvtMult > 0) || (row.Operation == SOOperation.Receipt && inInvtMult < 0)) { throw new PXSetPropertyException(Messages.OrderTypeUnsupportedOperation); } }
protected virtual void Validate(PXCache sender, SOOrderType row) { SOOrderTypeOperation def = this.defaultOperation.Select(row.OrderType, row.DefaultOperation); if (def == null) { return; } //if (def.INDocType != INTranType.NoUpdate && row.RequireShipping != true && row.RequireLocation != true) //{ // PXException ex = new PXSetPropertyException(Messages.OrderTypeShipmentOrLocation); // sender.RaiseExceptionHandling<SOOrderType.requireShipping>(row, row.RequireShipping, ex); // sender.RaiseExceptionHandling<SOOrderType.requireLocation>(row, row.RequireLocation, ex); //} //else if (def.INDocType != INTranType.NoUpdate && row.RequireShipping == true && row.RequireLocation == true) //{ // PXException ex = new PXSetPropertyException(Messages.OrderTypeShipmentNotLocation); // sender.RaiseExceptionHandling<SOOrderType.requireShipping>(row, row.RequireShipping, ex); // sender.RaiseExceptionHandling<SOOrderType.requireLocation>(row, row.RequireLocation, ex); //} short?arInvtMult = 0; short?inInvtMult = INTranType.InvtMult(def.INDocType); switch (row.ARDocType) { case ARDocType.Invoice: case ARDocType.DebitMemo: case ARDocType.CashSale: arInvtMult = -1; break; case ARDocType.CreditMemo: arInvtMult = 1; break; } if (row.Behavior != SOBehavior.RM && inInvtMult != arInvtMult && inInvtMult != 0 && arInvtMult != 0) { PXException ex = new PXSetPropertyException(Messages.OrderTypeUnsupportedCombination); sender.RaiseExceptionHandling <SOOrderType.aRDocType>(row, row.ARDocType, ex); this.operations.Cache.RaiseExceptionHandling <SOOrderTypeOperation.iNDocType>(def, def.INDocType, ex); } }
public virtual void ARTran_UOM_FieldVerifying(PXCache sender, PXFieldVerifyingEventArgs e) { var row = (ARTran)e.Row; PXResult <InventoryItem, INLotSerClass> item = ReadInventoryItem(sender, row.InventoryID); string inTranType = INTranType.TranTypeFromInvoiceType(row.TranType, row.Qty); if (item != null && INLotSerialNbrAttribute.IsTrackSerial(item, inTranType, row.InvtMult)) { object newval; sender.RaiseFieldDefaulting <ARTran.uOM>(e.Row, out newval); if (object.Equals(newval, e.NewValue) == false) { e.NewValue = newval; sender.RaiseExceptionHandling <ARTran.uOM>(e.Row, null, new PXSetPropertyException(IN.Messages.SerialItemAdjustment_UOMUpdated, PXErrorLevel.Warning, newval)); } } }
public override void Master_Qty_FieldVerifying(PXCache sender, PXFieldVerifyingEventArgs e) { var row = (ARTran)e.Row; if (row.InvtMult == 0) { return; } PXResult <InventoryItem, INLotSerClass> item = ReadInventoryItem(sender, row.InventoryID); string inTranType = INTranType.TranTypeFromInvoiceType(row.TranType, row.Qty); if (item != null && INLotSerialNbrAttribute.IsTrackSerial(item, inTranType, row.InvtMult)) { if (e.NewValue != null && e.NewValue is decimal && (decimal)e.NewValue != 0m && (decimal)e.NewValue != 1m && (decimal)e.NewValue != -1m) { e.NewValue = (decimal)e.NewValue > 0 ? 1m : -1m; sender.RaiseExceptionHandling <ARTran.qty>(e.Row, null, new PXSetPropertyException(IN.Messages.SerialItemAdjustment_LineQtyUpdated, PXErrorLevel.Warning, ((InventoryItem)item).BaseUnit)); } } }
protected override bool IsTracked(ILSMaster row, INLotSerClass lotSerClass, string tranType, int?invMult) { string inTranType = INTranType.TranTypeFromInvoiceType(tranType, row.Qty); return((invMult == 0) ? false : base.IsTracked(row, lotSerClass, inTranType, invMult)); }
protected override INLotSerTrack.Mode GetTranTrackMode(ILSMaster row, INLotSerClass lotSerClass) { string inTranType = INTranType.TranTypeFromInvoiceType(row.TranType, row.Qty); return(INLotSerialNbrAttribute.TranTrackMode(lotSerClass, inTranType, row.InvtMult)); }