示例#1
0
        protected virtual void BatchSelection_RowInserted(PXCache sender, PXRowInsertedEventArgs e)
        {
            BatchSelection batch = (BatchSelection)e.Row;

            if (batch != null && !String.IsNullOrWhiteSpace(batch.Module) && !String.IsNullOrWhiteSpace(batch.BatchNbr))
            {
                batch = PXSelectReadonly <BatchSelection,
                                          Where <BatchSelection.module, Equal <Required <BatchSelection.module> >,
                                                 And <BatchSelection.batchNbr, Equal <Required <BatchSelection.batchNbr> > > > >
                        .Select(this, batch.Module, batch.BatchNbr);

                PXSelectorAttribute selectorAttr = (PXSelectorAttribute)sender.GetAttributesReadonly <BatchSelection.batchNbr>(batch).Find(
                    (PXEventSubscriberAttribute attr) => { return(attr is PXSelectorAttribute); });

                BqlCommand selectorSearch = selectorAttr.GetSelect();

                if (batch != null && selectorSearch.Meet(sender, batch))
                {
                    Batch_Detail.Delete(batch);
                    Batch_Detail.Update(batch);
                }
                else
                {
                    batch = (BatchSelection)e.Row;
                    sender.RaiseExceptionHandling <BatchSelection.batchNbr>(batch, batch.BatchNbr, new PXSetPropertyException(Messages.BatchNbrNotValid));
                    Batch_Detail.Delete(batch);
                }
            }
        }
示例#2
0
        private void UpdateTransactionsLedgerBalanceType(BatchSelection updatedBatch)
        {
            foreach (GLTran glTransaction in PXSelect <GLTran,
                                                       Where <GLTran.module, Equal <Current <BatchSelection.module> >,
                                                              And <GLTran.batchNbr, Equal <Current <BatchSelection.batchNbr> > > > >
                     .SelectMultiBound(this, new object[] { updatedBatch }))
            {
                glTransaction.LedgerBalanceType = "N";

                GLTransactions.Update(glTransaction);
            }
        }
示例#3
0
 protected virtual void RemoveBatchCashTransactions(BatchSelection batch)
 {
     foreach (CATran cashTransaction in PXSelect <
                  CATran,
                  Where <
                      CATran.origModule, Equal <Current <BatchSelection.module> >,
                      And <CATran.origTranType, Equal <GLTranType.gLEntry>,
                           And <CATran.origRefNbr, Equal <Current <BatchSelection.batchNbr> > > > > >
              .SelectMultiBound(this, new object[] { batch }))
     {
         CATransactions.Delete(cashTransaction);
     }
 }
示例#4
0
        protected virtual void BatchSelection_RowUpdated(PXCache cache, PXRowUpdatedEventArgs e)
        {
            Batch b = e.Row as Batch;

            if (b != null && b.Voided == false)
            {
                b.Scheduled  = true;
                b.ScheduleID = Schedule_Header.Current.ScheduleID;
            }

            BatchSelection batch = e.Row as BatchSelection;

            if (batch != null && !string.IsNullOrWhiteSpace(batch.Module) && !string.IsNullOrWhiteSpace(batch.BatchNbr) &&
                PXSelectorAttribute.Select <BatchSelection.batchNbr>(cache, batch) == null)
            {
                cache.RaiseExceptionHandling <BatchSelection.batchNbr>(batch, batch.BatchNbr, new PXSetPropertyException(Messages.BatchNbrNotValid));
                Batch_Detail.Cache.Remove(batch);
            }
        }