Пример #1
0
		protected override void ClosePeriodProc(FinPeriod p)
		{
			PXSelectBase select = new PXSelectJoin<ARRegister, 
											LeftJoin<ARAdjust, On<ARAdjust.adjgDocType, Equal<ARRegister.docType>, And<ARAdjust.adjgRefNbr, Equal<ARRegister.refNbr>, And<ARAdjust.released, Equal<False>>>>>,
											Where<ARRegister.voided, Equal<boolFalse>, 
											And<ARRegister.scheduled, Equal<boolFalse>,
											And<Where<ARAdjust.adjgFinPeriodID, IsNull, And<ARRegister.released, Equal<False>, And<ARRegister.finPeriodID, Equal<Required<ARRegister.finPeriodID>>, Or<ARAdjust.adjgFinPeriodID, Equal<Required<ARAdjust.adjgFinPeriodID>>>>>>>>>>(this);
			object doc = select.View.SelectSingle(p.FinPeriodID, p.FinPeriodID);
			if (doc != null)
			{			
				throw new PXException(AP.Messages.PeriodHasUnreleasedDocs);
			}			

			p.ARClosed = true;
			Caches[typeof(FinPeriod)].Update(p);
			Actions.PressSave();
		}
Пример #2
0
		protected override void ClosePeriodProc(FinPeriod p)
		{
			PXSelectBase select = new PXSelect<CATran,
										  Where<CATran.finPeriodID, Equal<Required<CATran.finPeriodID>>,
											And<CATran.origModule, Equal<GL.BatchModule.moduleCA>,
											And<CATran.released, Equal<boolFalse>>>>>(this);
			CATran doc = (CATran)select.View.SelectSingle(p.FinPeriodID);
			if (doc != null)
			{
				throw new PXException(Messages.PeriodHasUnreleasedDocs);
			}

			p.CAClosed = true;
			Caches[typeof(FinPeriod)].Update(p);

			Actions.PressSave();
		}
Пример #3
0
		protected override void ClosePeriodProc(FinPeriod p)
		{
			PXSelectBase select = new PXSelect<INRegister,
										  Where<INRegister.finPeriodID, Equal<Required<INRegister.finPeriodID>>,
											And<INRegister.released, Equal<boolFalse>>>>(this);
			INRegister doc = (INRegister)select.View.SelectSingle(p.FinPeriodID);
			if (doc != null)
			{
				throw new PXException(AP.Messages.PeriodHasUnreleasedDocs);
			}

			//MS Landed cost will not be able to create these transactions if the period is closed
			LandedCostTran lcTranFromAP = PXSelectJoin<LandedCostTran,
										InnerJoin<APRegister, On<LandedCostTran.aPDocType, Equal<APRegister.docType>,
											And<LandedCostTran.aPRefNbr, Equal<APRegister.refNbr>>>>,
											Where<LandedCostTran.invoiceDate, GreaterEqual<Required<LandedCostTran.invoiceDate>>,
												And<LandedCostTran.invoiceDate, Less<Required<LandedCostTran.invoiceDate>>,
												And<LandedCostTran.source, Equal<LandedCostTranSource.fromAP>,
												And<APRegister.released, Equal<True>,
												And<LandedCostTran.processed, Equal<False>>>>>>>.Select(this, p.StartDate,p.EndDate);
			if (lcTranFromAP != null && lcTranFromAP.LCTranID.HasValue) 
			{
				throw new PXException(Messages.PeriodHasINDocsFromAP_LCToBeCreated);
			}

			PO.LandedCostTran lcTranFromPO = PXSelectJoin<LandedCostTran,
											InnerJoin<POReceipt, On<LandedCostTran.pOReceiptNbr, Equal<POReceipt.receiptNbr>>>,
											Where<LandedCostTran.invoiceDate, GreaterEqual<Required<LandedCostTran.invoiceDate>>,
												And<LandedCostTran.invoiceDate, Less<Required<LandedCostTran.invoiceDate>>,
											And<LandedCostTran.source, Equal<LandedCostTranSource.fromPO>,
											And<POReceipt.released, Equal<True>,											
											And<LandedCostTran.processed, Equal<False>>>>>>>.Select(this, p.StartDate, p.EndDate);
			if (lcTranFromPO != null && lcTranFromPO.LCTranID.HasValue)
			{
				throw new PXException(Messages.PeriodHasINDocsFromPO_LCToBeCreated);
			}

			p.INClosed = true;
			Caches[typeof(FinPeriod)].Update(p);

			Actions.PressSave();
		}
Пример #4
0
		protected override void ClosePeriodProc(FinPeriod p)
        {
            APRegister prebookedDoc = PXSelect<APRegister, Where<APRegister.voided, Equal<boolFalse>,
                                            And<APRegister.prebooked, Equal<boolTrue>,
                                            And<APRegister.released, Equal<boolFalse>,
                                            And<APRegister.finPeriodID, Equal<Required<APRegister.finPeriodID>>>>>>>.Select(this, p.FinPeriodID);
            if (prebookedDoc != null)
            {
                throw new PXException(Messages.PeriodHasPrebookedDocs);
            }

			PXSelectBase select = new PXSelectJoin<APRegister,
											LeftJoin<APAdjust, On<APAdjust.adjgDocType, Equal<APRegister.docType>, And<APAdjust.adjgRefNbr, Equal<APRegister.refNbr>, And<APAdjust.released, Equal<False>>>>>,
											Where<APRegister.voided, Equal<boolFalse>,
											And<APRegister.scheduled, Equal<boolFalse>,
											And<Where<APAdjust.adjgFinPeriodID, IsNull, And<APRegister.released, Equal<False>, And<APRegister.finPeriodID, Equal<Required<APRegister.finPeriodID>>, Or<APAdjust.adjgFinPeriodID, Equal<Required<APAdjust.adjgFinPeriodID>>>>>>>>>>(this); 
			object doc = select.View.SelectSingle(p.FinPeriodID, p.FinPeriodID);
			if (doc != null)
			{
				throw new PXException(Messages.PeriodHasUnreleasedDocs);
			}

			PO.LandedCostTran lcTran = PXSelectJoin<LandedCostTran,
											InnerJoin<POReceipt, On<LandedCostTran.pOReceiptNbr, Equal<POReceipt.receiptNbr>>>,
											Where<LandedCostTran.source, Equal<LandedCostTranSource.fromPO>,
											And<POReceipt.released, Equal<True>,
											And<LandedCostTran.postponeAP,Equal<False>,
											And<LandedCostTran.processed, Equal<False>,
												And<LandedCostTran.invoiceDate, GreaterEqual<Required<LandedCostTran.invoiceDate>>,				
												And<LandedCostTran.invoiceDate, Less<Required<LandedCostTran.invoiceDate>>>>>>>>>.Select(this, p.StartDate, p.EndDate);
			if (lcTran != null && lcTran.LCTranID.HasValue) 
			{
				throw new PXException(Messages.PeriodHasAPDocsFromPO_LCToBeCreated);
			}
			
			p.APClosed = true;
			Caches[typeof(FinPeriod)].Update(p);

			Actions.PressSave();
		}
Пример #5
0
        protected override void ClosePeriodProc(FinPeriod p)
        {
            PXSelectBase select = new PXSelect<FARegister,
                                          Where<FARegister.finPeriodID, Equal<Required<FARegister.finPeriodID>>,
                                            And<FARegister.released, Equal<False>>>>(this);
            FARegister doc = (FARegister)select.View.SelectSingle(p.FinPeriodID);
            if (doc != null)
            {
                throw new PXException(AP.Messages.PeriodHasUnreleasedDocs);
            }

            PXResult<FABookBalance, FixedAsset, FABook> res = (PXResult<FABookBalance, FixedAsset, FABook>)PXSelectJoin<FABookBalance, 
                                                                                                                        LeftJoin<FixedAsset, On<FixedAsset.assetID, Equal<FABookBalance.assetID>>, 
                                                                                                                        LeftJoin<FABook, On<FABookBalance.bookID, Equal<FABook.bookID>>, 
                                                                                                                        LeftJoin<FADetails, On<FADetails.assetID, Equal<FABookBalance.assetID>>>>>,
                                                                                                                        Where<FABookBalance.deprFromPeriod, LessEqual<Current<FinPeriod.finPeriodID>>, 
                                                                                                                            And<FABookBalance.deprToPeriod, GreaterEqual<Current<FinPeriod.finPeriodID>>, 
                                                                                                                            And<FABookBalance.updateGL, Equal<True>, 
                                                                                                                            And<FABookBalance.depreciate, Equal<True>,
                                                                                                                            And<FixedAsset.suspended, NotEqual<True>, 
                                                                                                                            And<FADetails.hold, NotEqual<True>, 
                                                                                                                            And<FABookBalance.initPeriod, IsNotNull,
                                                                                                                            And<Where<FABookBalance.currDeprPeriod, IsNull, 
                                                                                                                                    And<FABookBalance.status, Equal<FixedAssetStatus.active>,
                                                                                                                                    Or<FABookBalance.currDeprPeriod, LessEqual<Current<FinPeriod.finPeriodID>>>>>>>>>>>>>>.SelectSingleBound(this, new object[]{p});
            if(res != null)
            {
                FixedAsset asset = res;
                FABook book = res;
                throw new PXException(Messages.AssetNotDepreciatedInPeriod, asset.AssetCD, book.BookCode, FinPeriodIDAttribute.FormatForError(p.FinPeriodID));
            }

            p.FAClosed = true;
            Caches[typeof(FinPeriod)].Update(p);

            Actions.PressSave();
        }