private static void AddPOReceiptLineToBill(PXGraph graph, APInvoiceEntry invoiceEntry, EntityValueField receiptNbr, EntityValueField receiptLineNbr)
        {
            var receiptLineExtension = graph.GetExtension <PO.GraphExtensions.APInvoiceSmartPanel.AddPOReceiptLineExtension>();

            POReceiptLineAdd line = receiptLineExtension.ReceipLineAdd.Select(receiptNbr.Value, receiptLineNbr.Value);

            if (line == null)
            {
                throw new PXException($"Receipt Line {receiptNbr.Value} - {receiptLineNbr.Value} not found.");
            }

            line.Selected = true;

            receiptLineExtension.poReceiptLinesSelection.Update(line);

            receiptLineExtension.addReceiptLine2.Press();
        }
Пример #2
0
        public virtual void POReceiptLineAdd_ReceiptNbr_FieldSelecting(PXCache sender, PXFieldSelectingEventArgs e)
        {
            POReceiptLineAdd row = (POReceiptLineAdd)e.Row;
            APInvoice        doc = Base.Document.Current;

            if (row != null && doc != null)
            {
                POOrder order = PXSelect <POOrder, Where <POOrder.orderType, Equal <Required <POOrder.orderType> >, And <POOrder.orderNbr, Equal <Required <POOrder.orderNbr> > > > > .Select(Base, row.POType, row.PONbr);

                if (order != null && order.CuryID != doc.CuryID)
                {
                    string       fieldName = typeof(POReceipt.curyID).Name;
                    PXErrorLevel msgLevel  = PXErrorLevel.RowWarning;
                    e.ReturnState = PXFieldState.CreateInstance(e.ReturnState, typeof(String), false, null, null, null, null, null, fieldName,
                                                                null, null, AP.Messages.APDocumentCurrencyDiffersFromSourceDocument, msgLevel, null, null, null, PXUIVisibility.Undefined, null, null, null);
                    e.IsAltered = true;
                }
            }
        }