コード例 #1
0
ファイル: Attribute.cs プロジェクト: PavelMPD/SimpleProjects
        protected virtual IEnumerable GetRecords()
        {
            bool    ar      = true;
            PXCache cache   = this._Graph.Caches[BqlCommand.GetItemType(moduleField)];
            string  docType = ARDocType.Invoice;
            string  refNbr  = null;

            if (cache.Current != null)
            {
                docType = (string)cache.GetValue(cache.Current, docTypeField.Name);
                refNbr  = (string)cache.GetValue(cache.Current, refNbrField.Name);
                string module = (string)cache.GetValue(cache.Current, moduleField.Name);
                if (module == BatchModule.AP)
                {
                    ar = false;
                }
            }

            if (ar)
            {
                PXSelectBase <ARTran> select = new PXSelect <ARTran,
                                                             Where <ARTran.tranType, Equal <Required <ARTran.tranType> >,
                                                                    And <ARTran.refNbr, Equal <Required <ARTran.refNbr> > > > >(this._Graph);
                foreach (ARTran tran in select.Select(docType, refNbr))
                {
                    DRLineRecord record = new DRLineRecord();
                    record.CuryInfoID  = tran.CuryInfoID;
                    record.CuryTranAmt = tran.CuryTranAmt;
                    record.InventoryID = tran.InventoryID;
                    record.LineNbr     = tran.LineNbr;
                    record.TranAmt     = tran.TranAmt;
                    record.TranDesc    = tran.TranDesc;

                    yield return(record);
                }
            }
            else
            {
                PXSelectBase <APTran> select = new PXSelect <APTran,
                                                             Where <APTran.tranType, Equal <Required <APTran.tranType> >,
                                                                    And <APTran.refNbr, Equal <Required <APTran.refNbr> > > > >(this._Graph);
                foreach (APTran tran in select.Select(docType, refNbr))
                {
                    DRLineRecord record = new DRLineRecord();
                    record.CuryInfoID  = tran.CuryInfoID;
                    record.CuryTranAmt = tran.CuryTranAmt;
                    record.InventoryID = tran.InventoryID;
                    record.LineNbr     = tran.LineNbr;
                    record.TranAmt     = tran.TranAmt;
                    record.TranDesc    = tran.TranDesc;

                    yield return(record);
                }
            }
        }
コード例 #2
0
ファイル: Attribute.cs プロジェクト: PavelMPD/SimpleProjects
		protected virtual IEnumerable GetRecords()
		{
			bool ar = true;
			PXCache cache = this._Graph.Caches[BqlCommand.GetItemType(moduleField)];
			string docType = ARDocType.Invoice;
			string refNbr = null;

			if (cache.Current != null)
			{
				docType = (string)cache.GetValue(cache.Current, docTypeField.Name);
				refNbr = (string)cache.GetValue(cache.Current, refNbrField.Name);
				string module = (string)cache.GetValue(cache.Current, moduleField.Name);
				if (module == BatchModule.AP)
					ar = false;
			}

			if (ar)
			{
				PXSelectBase<ARTran> select = new PXSelect<ARTran,
					Where<ARTran.tranType, Equal<Required<ARTran.tranType>>,
					And<ARTran.refNbr, Equal<Required<ARTran.refNbr>>>>>(this._Graph);
				foreach (ARTran tran in select.Select(docType, refNbr))
				{
					DRLineRecord record = new DRLineRecord();
					record.CuryInfoID = tran.CuryInfoID;
					record.CuryTranAmt = tran.CuryTranAmt;
					record.InventoryID = tran.InventoryID;
					record.LineNbr = tran.LineNbr;
					record.TranAmt = tran.TranAmt;
					record.TranDesc = tran.TranDesc;

					yield return record;
				}
			}
			else
			{
				PXSelectBase<APTran> select = new PXSelect<APTran,
					Where<APTran.tranType, Equal<Required<APTran.tranType>>,
					And<APTran.refNbr, Equal<Required<APTran.refNbr>>>>>(this._Graph);
				foreach (APTran tran in select.Select(docType, refNbr))
				{
					DRLineRecord record = new DRLineRecord();
					record.CuryInfoID = tran.CuryInfoID;
					record.CuryTranAmt = tran.CuryTranAmt;
					record.InventoryID = tran.InventoryID;
					record.LineNbr = tran.LineNbr;
					record.TranAmt = tran.TranAmt;
					record.TranDesc = tran.TranDesc;

					yield return record;
				}
			}
		}