예제 #1
0
        public virtual FSCreatedDoc PressSave(int batchID, List <DocLineExt> docLines, BeforeSaveDelegate beforeSave)
        {
            if (Base.Document.Current == null)
            {
                throw new SharedClasses.TransactionScopeException();
            }

            if (beforeSave != null)
            {
                beforeSave(Base);
            }

            Base.SelectTimeStamp();
            Base.Save.Press();

            ARInvoice arInvoice = Base.Document.Current;

            var fsCreatedDocRow = new FSCreatedDoc()
            {
                BatchID        = batchID,
                PostTo         = ID.Batch_PostTo.SI,
                CreatedDocType = arInvoice.DocType,
                CreatedRefNbr  = arInvoice.RefNbr
            };

            return(fsCreatedDocRow);
        }
예제 #2
0
        public virtual FSCreatedDoc PressSave(int batchID, List <DocLineExt> docLines, BeforeSaveDelegate beforeSave)
        {
            if (Base.Document.Current == null)
            {
                throw new SharedClasses.TransactionScopeException();
            }

            if (beforeSave != null)
            {
                beforeSave(Base);
            }

            Base.Save.Press();

            if (docLines != null && docLines.Count > 0)
            {
                FSSrvOrdType fsSrvOrdTypeRow = docLines[0].fsSrvOrdType;

                if (fsSrvOrdTypeRow != null && fsSrvOrdTypeRow.ReleaseProjectTransactionOnInvoice == true)
                {
                    Base.ReleaseDocument(Base.Document.Current);
                }
            }

            var fsCreatedDocRow = new FSCreatedDoc()
            {
                BatchID        = batchID,
                PostTo         = ID.Batch_PostTo.PM,
                CreatedDocType = Base.Document.Current.Module,
                CreatedRefNbr  = Base.Document.Current.RefNbr
            };

            return(fsCreatedDocRow);
        }
        protected virtual void ARInvoice_RowPersisting(PXCache cache, PXRowPersistingEventArgs e)
        {
            if (e.Row == null || SharedFunctions.isFSSetupSet(Base) == false)
            {
                return;
            }

            ARInvoice arInvoiceRow = (ARInvoice)e.Row;

            if (e.Operation == PXDBOperation.Update &&
                (Base.Accessinfo.ScreenID != SharedFunctions.SetScreenIDToDotFormat(ID.ScreenID.INVOICE_BY_APPOINTMENT) &&
                 Base.Accessinfo.ScreenID != SharedFunctions.SetScreenIDToDotFormat(ID.ScreenID.INVOICE_BY_SERVICE_ORDER)))
            {
                FSCreatedDoc fsCreatedDocRow = PXSelectJoin <FSCreatedDoc,
                                                             InnerJoin <FSPostBatch, On <FSCreatedDoc.batchID, Equal <FSPostBatch.batchID> > >,
                                                             Where <
                                                                 FSPostBatch.status, Equal <FSPostBatch.status.temporary>,
                                                                 And <FSPostBatch.postTo, Equal <FSPostBatch.postTo.AR>,
                                                                      And <FSCreatedDoc.createdRefNbr, Equal <Required <FSCreatedDoc.createdRefNbr> >,
                                                                           And <FSCreatedDoc.createdDocType, Equal <Required <FSCreatedDoc.createdDocType> > > > > > >
                                               .Select(Base, arInvoiceRow.RefNbr, arInvoiceRow.DocType);

                if (fsCreatedDocRow != null)
                {
                    throw new PXException(TX.Error.CANNOT_UPDATE_DOCUMENT_BECAUSE_BATCH_STATUS_IS_TEMPORARY);
                }
            }
        }
예제 #4
0
        public virtual FSCreatedDoc PressSave(int batchID, BeforeSaveDelegate beforeSave)
        {
            if (Base.Document.Current == null)
            {
                throw new SharedClasses.TransactionScopeException();
            }

            if (beforeSave != null)
            {
                beforeSave(Base);
            }

            Base.Save.Press();

            APInvoice apInvoiceRow = Base.Document.Current;

            var fsCreatedDocRow = new FSCreatedDoc()
            {
                BatchID        = batchID,
                PostTo         = ID.Batch_PostTo.AP,
                CreatedDocType = apInvoiceRow.DocType,
                CreatedRefNbr  = apInvoiceRow.RefNbr
            };

            return(fsCreatedDocRow);
        }
예제 #5
0
        public virtual void DeleteDocument(FSCreatedDoc fsCreatedDocRow)
        {
            Base.issue.Current = Base.issue.Search <INRegister.refNbr>(fsCreatedDocRow.CreatedRefNbr);

            if (Base.issue.Current != null)
            {
                if (Base.issue.Current.RefNbr == fsCreatedDocRow.CreatedRefNbr)
                {
                    Base.Delete.Press();
                }
            }
        }
예제 #6
0
        public virtual void DeleteDocument(FSCreatedDoc fsCreatedDocRow)
        {
            Base.Document.Current = Base.Document.Search <APInvoice.refNbr>(fsCreatedDocRow.CreatedRefNbr, fsCreatedDocRow.CreatedDocType);

            if (Base.Document.Current != null)
            {
                if (Base.Document.Current.RefNbr == fsCreatedDocRow.CreatedRefNbr &&
                    Base.Document.Current.DocType == fsCreatedDocRow.CreatedDocType)
                {
                    Base.Delete.Press();
                }
            }
        }
예제 #7
0
        public virtual FSCreatedDoc PressSave(int batchID, List <DocLineExt> docLines, BeforeSaveDelegate beforeSave)
        {
            if (Base.issue.Current == null)
            {
                throw new SharedClasses.TransactionScopeException();
            }

            if (beforeSave != null)
            {
                beforeSave(Base);
            }

            Base.Save.Press();

            INRegister inRegisterRow = Base.issue.Current != null ? Base.issue.Current : Base.issue.Select();

            if (docLines != null && docLines.Count > 0)
            {
                FSSrvOrdType fsSrvOrdTypeRow = docLines[0].fsSrvOrdType;

                if (fsSrvOrdTypeRow != null && fsSrvOrdTypeRow.ReleaseIssueOnInvoice == true)
                {
                    if (inRegisterRow.Hold == true)
                    {
                        Base.issue.Cache.SetValueExtIfDifferent <INRegister.hold>(inRegisterRow, false);

                        inRegisterRow = Base.issue.Update(inRegisterRow);
                    }

                    Base.release.Press();
                }
            }

            string docType = Base.issue.Current.DocType;
            string refNbr  = Base.issue.Current.RefNbr;

            var fsCreatedDocRow = new FSCreatedDoc()
            {
                BatchID        = batchID,
                PostTo         = ID.Batch_PostTo.IN,
                CreatedDocType = inRegisterRow.DocType,
                CreatedRefNbr  = inRegisterRow.RefNbr
            };

            return(fsCreatedDocRow);
        }
예제 #8
0
        public virtual FSCreatedDoc PressSave(int batchID, List <DocLineExt> docLines, BeforeSaveDelegate beforeSave)
        {
            if (Base.Document.Current == null)
            {
                throw new SharedClasses.TransactionScopeException();
            }

            if (beforeSave != null)
            {
                beforeSave(Base);
            }

            APInvoiceEntryExternalTax TaxGraphExt = Base.GetExtension <APInvoiceEntryExternalTax>();

            if (TaxGraphExt != null)
            {
                TaxGraphExt.SkipTaxCalcAndSave();
            }
            else
            {
                Base.Save.Press();
            }

            string docType = Base.Document.Current.DocType;
            string refNbr  = Base.Document.Current.RefNbr;

            // Reload APInvoice to get the current value of IsTaxValid
            Base.Clear();
            Base.Document.Current = PXSelect <APInvoice, Where <APInvoice.docType, Equal <Required <APInvoice.docType> >, And <APInvoice.refNbr, Equal <Required <APInvoice.refNbr> > > > > .Select(Base, docType, refNbr);

            APInvoice apInvoiceRow = Base.Document.Current;

            var fsCreatedDocRow = new FSCreatedDoc()
            {
                BatchID        = batchID,
                PostTo         = ID.Batch_PostTo.AP,
                CreatedDocType = apInvoiceRow.DocType,
                CreatedRefNbr  = apInvoiceRow.RefNbr
            };

            return(fsCreatedDocRow);
        }
예제 #9
0
        public static void ValidatePostBatchStatus(PXGraph graph, PXDBOperation dbOperation, string postTo, string createdDocType, string createdRefNbr)
        {
            if (dbOperation == PXDBOperation.Update &&
                graph.Accessinfo.ScreenID != SharedFunctions.SetScreenIDToDotFormat(ID.ScreenID.INVOICE_BY_APPOINTMENT) &&
                graph.Accessinfo.ScreenID != SharedFunctions.SetScreenIDToDotFormat(ID.ScreenID.INVOICE_BY_SERVICE_ORDER)
                )
            {
                FSCreatedDoc fsCreatedDocRow = PXSelectJoin <FSCreatedDoc,
                                                             InnerJoin <FSPostBatch, On <FSCreatedDoc.batchID, Equal <FSPostBatch.batchID> > >,
                                                             Where <
                                                                 FSPostBatch.status, Equal <FSPostBatch.status.temporary>,
                                                                 And <FSCreatedDoc.postTo, Equal <Required <FSCreatedDoc.postTo> >,
                                                                      And <FSCreatedDoc.createdDocType, Equal <Required <FSCreatedDoc.createdDocType> >,
                                                                           And <FSCreatedDoc.createdRefNbr, Equal <Required <FSCreatedDoc.createdRefNbr> > > > > > >
                                               .Select(graph, postTo, createdDocType, createdRefNbr);

                if (fsCreatedDocRow != null)
                {
                    throw new PXException(TX.Error.CANNOT_UPDATE_DOCUMENT_BECAUSE_BATCH_STATUS_IS_TEMPORARY);
                }
            }
        }
예제 #10
0
        public virtual void openDocument()
        {
            FSCreatedDoc postingBatchDetailRow = BatchDetailsInfo.Current;

            if (postingBatchDetailRow.PostTo == ID.Batch_PostTo.SO)
            {
                if (PXAccess.FeatureInstalled <FeaturesSet.distributionModule>())
                {
                    SOOrderEntry graphSOOrderEntry = PXGraph.CreateInstance <SOOrderEntry>();
                    graphSOOrderEntry.Document.Current = graphSOOrderEntry.Document.Search <SOOrder.orderNbr>(postingBatchDetailRow.CreatedRefNbr, postingBatchDetailRow.CreatedDocType);
                    throw new PXRedirectRequiredException(graphSOOrderEntry, null)
                          {
                              Mode = PXBaseRedirectException.WindowMode.NewWindow
                          };
                }
            }
            else if (postingBatchDetailRow.PostTo == ID.Batch_PostTo.AR)
            {
                ARInvoiceEntry graphARInvoiceEntry = PXGraph.CreateInstance <ARInvoiceEntry>();
                graphARInvoiceEntry.Document.Current = graphARInvoiceEntry.Document.Search <ARInvoice.refNbr>(postingBatchDetailRow.CreatedRefNbr, postingBatchDetailRow.CreatedDocType);
                throw new PXRedirectRequiredException(graphARInvoiceEntry, null)
                      {
                          Mode = PXBaseRedirectException.WindowMode.NewWindow
                      };
            }
            else if (postingBatchDetailRow.PostTo == ID.Batch_PostTo.SI)
            {
                SOInvoiceEntry graphSOInvoiceEntry = PXGraph.CreateInstance <SOInvoiceEntry>();
                graphSOInvoiceEntry.Document.Current = graphSOInvoiceEntry.Document.Search <ARInvoice.refNbr>(postingBatchDetailRow.CreatedRefNbr, postingBatchDetailRow.CreatedDocType);
                throw new PXRedirectRequiredException(graphSOInvoiceEntry, null)
                      {
                          Mode = PXBaseRedirectException.WindowMode.NewWindow
                      };
            }
            else if (postingBatchDetailRow.PostTo == ID.Batch_PostTo.AP)
            {
                APInvoiceEntry graphAPInvoiceEntry = PXGraph.CreateInstance <APInvoiceEntry>();
                graphAPInvoiceEntry.Document.Current = graphAPInvoiceEntry.Document.Search <APInvoice.refNbr>(postingBatchDetailRow.CreatedRefNbr, postingBatchDetailRow.CreatedDocType);
                throw new PXRedirectRequiredException(graphAPInvoiceEntry, null)
                      {
                          Mode = PXBaseRedirectException.WindowMode.NewWindow
                      };
            }
            else if (postingBatchDetailRow.PostTo == ID.Batch_PostTo.IN)
            {
                INIssueEntry graphINIssueEntry = PXGraph.CreateInstance <INIssueEntry>();
                graphINIssueEntry.issue.Current = graphINIssueEntry.issue.Search <INRegister.refNbr>(postingBatchDetailRow.CreatedRefNbr, postingBatchDetailRow.CreatedDocType);
                throw new PXRedirectRequiredException(graphINIssueEntry, null)
                      {
                          Mode = PXBaseRedirectException.WindowMode.NewWindow
                      };
            }
            else if (postingBatchDetailRow.PostTo == ID.Batch_PostTo.PM)
            {
                RegisterEntry graphRegisterEntry = PXGraph.CreateInstance <RegisterEntry>();
                graphRegisterEntry.Document.Current = graphRegisterEntry.Document.Search <PMRegister.refNbr>(postingBatchDetailRow.CreatedRefNbr, postingBatchDetailRow.CreatedDocType);
                throw new PXRedirectRequiredException(graphRegisterEntry, null)
                      {
                          Mode = PXBaseRedirectException.WindowMode.NewWindow
                      };
            }
        }