public void copyClassDocumentDetail(ClassDocumentDetail dtl, ClassDocumentDetail tDtl, IObjectSpace ios) { #region assign udf detail ClassUDFDetail sClassD = getUDFDetailClass(dtl); ClassUDFDetail tClassD = getUDFDetailClass(tDtl); AssignUDFDetailValues(ref sClassD, ref tClassD); #endregion CopyGenDocumentValues(ios, dtl, tDtl); //tDtl.Quantity = dtl.Quantity; //if (dtl.DocCur != null) // tDtl.DocCur = ios.FindObject<vwCurrency>(CriteriaOperator.Parse("BoKey=?", dtl.DocCur.BoKey)); //if (dtl.ItemCode != null) // tDtl.ItemCode = ios.FindObject<vwItemMasters>(CriteriaOperator.Parse("BoKey=?", dtl.ItemCode.BoKey)); //tDtl.Dscription = dtl.Dscription; //if (dtl.WhsCode != null) // tDtl.WhsCode = ios.FindObject<vwWarehouses>(CriteriaOperator.Parse("BoKey=?", dtl.WhsCode.BoKey)); //if (dtl.BinCode != null) // tDtl.BinCode = ios.FindObject<vwWarehouseBins>(CriteriaOperator.Parse("BoKey=?", dtl.BinCode.BoKey)); //if (dtl.OcrCode != null) // tDtl.OcrCode = ios.FindObject<vwDimension1>(CriteriaOperator.Parse("BoKey=?", dtl.OcrCode.BoKey)); //if (dtl.OcrCode2 != null) // tDtl.OcrCode2 = ios.FindObject<vwDimension2>(CriteriaOperator.Parse("BoKey=?", dtl.OcrCode2.BoKey)); //if (dtl.OcrCode3 != null) // tDtl.OcrCode3 = ios.FindObject<vwDimension3>(CriteriaOperator.Parse("BoKey=?", dtl.OcrCode3.BoKey)); //if (dtl.OcrCode4 != null) // tDtl.OcrCode4 = ios.FindObject<vwDimension4>(CriteriaOperator.Parse("BoKey=?", dtl.OcrCode4.BoKey)); //if (dtl.OcrCode5 != null) // tDtl.OcrCode5 = ios.FindObject<vwDimension5>(CriteriaOperator.Parse("BoKey=?", dtl.OcrCode5.BoKey)); //if (dtl.PrjCode != null) // tDtl.PrjCode = ios.FindObject<vwProjects>(CriteriaOperator.Parse("BoKey=?", dtl.PrjCode.BoKey)); //if (dtl.AcctCode != null) // tDtl.AcctCode = ios.FindObject<vwAccounts>(CriteriaOperator.Parse("BoKey=?", dtl.AcctCode.BoKey)); //if (dtl.TaxCode != null) // tDtl.TaxCode = ios.FindObject<vwTaxes>(CriteriaOperator.Parse("BoKey=?", dtl.TaxCode.BoKey)); //if (dtl.FreightCharge != null) // tDtl.FreightCharge = ios.FindObject<vwExpenses>(CriteriaOperator.Parse("BoKey=?", dtl.FreightCharge.BoKey)); //tDtl.BatchNumber = dtl.BatchNumber; //tDtl.UnitMsr = dtl.UnitMsr; //tDtl.UnitPrice = dtl.UnitPrice; //tDtl.TaxPerc = dtl.TaxPerc; //tDtl.TaxAmt = dtl.TaxAmt; //tDtl.DiscountAmt = dtl.DiscountAmt; //tDtl.FreightAmt = dtl.FreightAmt; //if (dtl.BaseType != null) // tDtl.BaseType = ios.GetObjectByKey<DocType>(dtl.BaseType.Oid); //tDtl.Baseline = dtl.Baseline; //tDtl.SAPBaseType = dtl.SAPBaseType; //tDtl.SAPBaseEntry = dtl.SAPBaseEntry; //tDtl.SAPBaseLine = dtl.SAPBaseLine; tDtl.Quantity = dtl.Quantity; tDtl.Baseline = dtl.Baseline; tDtl.IsDuplicated = true; }
private void DuplicateDetail_Execute(object sender, SimpleActionExecuteEventArgs e) { if (!ObjectSpace.IsModified) { genCon.showMsg("", "View Mode cannot proceed.", InformationType.Error); return; } if (((ListView)View).SelectedObjects.Count != 1) { genCon.showMsg("", "Please select only 1 item.", InformationType.Error); return; } IObjectSpace os = Application.CreateObjectSpace(); if (typeof(ClassDocumentDetail).IsAssignableFrom(View.ObjectTypeInfo.Type)) { foreach (ClassDocumentDetail dtl in ((ListView)View).SelectedObjects) { if (View.ObjectTypeInfo.Type == typeof(PurchaseRequestDetail)) { sDtl = dtl; } if (View.ObjectTypeInfo.Type == typeof(PurchaseOrderDetail)) { sDtl = dtl; } if (View.ObjectTypeInfo.Type == typeof(PurchaseDeliveryDetail)) { sDtl = dtl; } if (View.ObjectTypeInfo.Type == typeof(PurchaseReturnDetail)) { sDtl = dtl; } if (View.ObjectTypeInfo.Type == typeof(PurchaseQuotationDetail)) { sDtl = dtl; } //copyCon.copyClassDocumentDetail(dtl, sDtl, os); } } if (typeof(ClassStockTransferDocumentDetail).IsAssignableFrom(View.ObjectTypeInfo.Type)) { foreach (ClassStockTransferDocumentDetail dtl in ((ListView)View).SelectedObjects) { if (View.ObjectTypeInfo.Type == typeof(StockTransferRequestDetail)) { sDtlS = dtl; } //copyCon.copyClassStockTransferDocumentDetail(dtl, sDtlS, os); } } NewObjectViewController newobjectcon = Frame.GetController <NewObjectViewController>(); newobjectcon.NewObjectAction.DoExecute(newobjectcon.NewObjectAction.Items.FirstActiveItem); }
public void AddDetailClassFromDocumentClass(ClassDocument tObject, ClassDocumentDetail tDtl) { if (tObject.GetType() == typeof(PurchaseRequest)) { ((PurchaseRequest)tObject).PurchaseRequestDetail.Add((PurchaseRequestDetail)tDtl); } else if (tObject.GetType() == typeof(PurchaseOrder)) { ((PurchaseOrder)tObject).PurchaseOrderDetail.Add((PurchaseOrderDetail)tDtl); } else if (tObject.GetType() == typeof(PurchaseDelivery)) { ((PurchaseDelivery)tObject).PurchaseDeliveryDetail.Add((PurchaseDeliveryDetail)tDtl); } else if (tObject.GetType() == typeof(PurchaseReturn)) { ((PurchaseReturn)tObject).PurchaseReturnDetail.Add((PurchaseReturnDetail)tDtl); } else if (tObject.GetType() == typeof(PurchaseQuotation)) { ((PurchaseQuotation)tObject).PurchaseQuotationDetail.Add((PurchaseQuotationDetail)tDtl); } }
public bool CopyFromDocument(ClassDocument tObject, ListView sListView, IObjectSpace ios) { if (tObject == null) { return(false); } bool added = false; int minvalue = 0; int maxvisorder = 0; GetDetailClassVisOrder(tObject, ref minvalue, ref maxvisorder); foreach (ClassDocumentDetail dtl in sListView.SelectedObjects) { if (dtl.OpenQty > 0 && dtl.LineStatus == LineStatusEnum.Open) { if (added) { minvalue--; maxvisorder++; } added = true; #region create object by type ClassDocumentDetail tDtl = CreateDetailClassFromDocumentClass(ios, tObject); #endregion #region assign udf detail ClassUDFDetail sClassD = getUDFDetailClass(dtl); ClassUDFDetail tClassD = getUDFDetailClass(tDtl); AssignUDFDetailValues(ref sClassD, ref tClassD); #endregion tDtl.Oid = minvalue; tDtl.VisOrder = maxvisorder; CopyGenDocumentValues(ios, dtl, tDtl); //tDtl.Quantity = dtl.OpenQty; //if (dtl.DocCur != null) // tDtl.DocCur = ios.FindObject<vwCurrency>(CriteriaOperator.Parse("BoKey=?", dtl.DocCur.BoKey)); //if (dtl.ItemCode != null) // tDtl.ItemCode = ios.FindObject<vwItemMasters>(CriteriaOperator.Parse("BoKey=?", dtl.ItemCode.BoKey)); //tDtl.Dscription = dtl.Dscription; //if (dtl.WhsCode != null) // tDtl.WhsCode = ios.FindObject<vwWarehouses>(CriteriaOperator.Parse("BoKey=?", dtl.WhsCode.BoKey)); //if (dtl.BinCode != null) // tDtl.BinCode = ios.FindObject<vwWarehouseBins>(CriteriaOperator.Parse("BoKey=?", dtl.BinCode.BoKey)); //if (dtl.OcrCode != null) // tDtl.OcrCode = ios.FindObject<vwDimension1>(CriteriaOperator.Parse("BoKey=?", dtl.OcrCode.BoKey)); //if (dtl.OcrCode2 != null) // tDtl.OcrCode2 = ios.FindObject<vwDimension2>(CriteriaOperator.Parse("BoKey=?", dtl.OcrCode2.BoKey)); //if (dtl.OcrCode3 != null) // tDtl.OcrCode3 = ios.FindObject<vwDimension3>(CriteriaOperator.Parse("BoKey=?", dtl.OcrCode3.BoKey)); //if (dtl.OcrCode4 != null) // tDtl.OcrCode4 = ios.FindObject<vwDimension4>(CriteriaOperator.Parse("BoKey=?", dtl.OcrCode4.BoKey)); //if (dtl.OcrCode5 != null) // tDtl.OcrCode5 = ios.FindObject<vwDimension5>(CriteriaOperator.Parse("BoKey=?", dtl.OcrCode5.BoKey)); //if (dtl.PrjCode != null) // tDtl.PrjCode = ios.FindObject<vwProjects>(CriteriaOperator.Parse("BoKey=?", dtl.PrjCode.BoKey)); //if (dtl.AcctCode != null) // tDtl.AcctCode = ios.FindObject<vwAccounts>(CriteriaOperator.Parse("BoKey=?", dtl.AcctCode.BoKey)); //if (dtl.TaxCode != null) // tDtl.TaxCode = ios.FindObject<vwTaxes>(CriteriaOperator.Parse("BoKey=?", dtl.TaxCode.BoKey)); //if (dtl.FreightCharge != null) // tDtl.FreightCharge = ios.FindObject<vwExpenses>(CriteriaOperator.Parse("BoKey=?", dtl.FreightCharge.BoKey)); //tDtl.BatchNumber = dtl.BatchNumber; //tDtl.UnitMsr = dtl.UnitMsr; //tDtl.UnitPrice = dtl.UnitPrice; //tDtl.TaxPerc = dtl.TaxPerc; //tDtl.TaxAmt = dtl.TaxAmt; //tDtl.DiscountAmt = dtl.DiscountAmt; //tDtl.FreightAmt = dtl.FreightAmt; //if (dtl.ObjType != null) // tDtl.BaseType = ios.GetObjectByKey<DocType>(dtl.ObjType.Oid); //tDtl.Baseline = dtl.Oid; //tDtl.SAPBaseType = dtl.SAPObjType; //tDtl.SAPBaseEntry = dtl.SAPDocEntry; //tDtl.SAPBaseLine = dtl.SAPLineNum; #region create object by type AddDetailClassFromDocumentClass(tObject, tDtl); #endregion } } #region assign total AssignDocumentClassTotal(tObject); #endregion return(added); }
public void CopyGenDocumentValues(IObjectSpace ios, ClassDocumentDetail dtl, ClassDocumentDetail tDtl) { tDtl.Quantity = dtl.OpenQty; if (dtl.DocCur != null) { tDtl.DocCur = ios.FindObject <vwCurrency>(CriteriaOperator.Parse("BoKey=?", dtl.DocCur.BoKey)); } if (dtl.ItemCode != null) { tDtl.ItemCode = ios.FindObject <vwItemMasters>(CriteriaOperator.Parse("BoKey=?", dtl.ItemCode.BoKey)); } tDtl.Dscription = dtl.Dscription; if (dtl.WhsCode != null) { tDtl.WhsCode = ios.FindObject <vwWarehouses>(CriteriaOperator.Parse("BoKey=?", dtl.WhsCode.BoKey)); } if (dtl.BinCode != null) { tDtl.BinCode = ios.FindObject <vwWarehouseBins>(CriteriaOperator.Parse("BoKey=?", dtl.BinCode.BoKey)); } if (dtl.OcrCode != null) { tDtl.OcrCode = ios.FindObject <vwDimension1>(CriteriaOperator.Parse("BoKey=?", dtl.OcrCode.BoKey)); } if (dtl.OcrCode2 != null) { tDtl.OcrCode2 = ios.FindObject <vwDimension2>(CriteriaOperator.Parse("BoKey=?", dtl.OcrCode2.BoKey)); } if (dtl.OcrCode3 != null) { tDtl.OcrCode3 = ios.FindObject <vwDimension3>(CriteriaOperator.Parse("BoKey=?", dtl.OcrCode3.BoKey)); } if (dtl.OcrCode4 != null) { tDtl.OcrCode4 = ios.FindObject <vwDimension4>(CriteriaOperator.Parse("BoKey=?", dtl.OcrCode4.BoKey)); } if (dtl.OcrCode5 != null) { tDtl.OcrCode5 = ios.FindObject <vwDimension5>(CriteriaOperator.Parse("BoKey=?", dtl.OcrCode5.BoKey)); } if (dtl.PrjCode != null) { tDtl.PrjCode = ios.FindObject <vwProjects>(CriteriaOperator.Parse("BoKey=?", dtl.PrjCode.BoKey)); } if (dtl.AcctCode != null) { tDtl.AcctCode = ios.FindObject <vwAccounts>(CriteriaOperator.Parse("BoKey=?", dtl.AcctCode.BoKey)); } if (dtl.TaxCode != null) { tDtl.TaxCode = ios.FindObject <vwTaxes>(CriteriaOperator.Parse("BoKey=?", dtl.TaxCode.BoKey)); } if (dtl.FreightCharge != null) { tDtl.FreightCharge = ios.FindObject <vwExpenses>(CriteriaOperator.Parse("BoKey=?", dtl.FreightCharge.BoKey)); } tDtl.BatchNumber = dtl.BatchNumber; tDtl.UnitMsr = dtl.UnitMsr; tDtl.UnitPrice = dtl.UnitPrice; tDtl.TaxPerc = dtl.TaxPerc; tDtl.TaxAmt = dtl.TaxAmt; tDtl.DiscountAmt = dtl.DiscountAmt; tDtl.FreightAmt = dtl.FreightAmt; if (dtl.ObjType != null) { tDtl.BaseType = ios.GetObjectByKey <DocType>(dtl.ObjType.Oid); } tDtl.Baseline = dtl.Oid; tDtl.SAPBaseType = dtl.SAPObjType; tDtl.SAPBaseEntry = dtl.SAPDocEntry; tDtl.SAPBaseLine = dtl.SAPLineNum; }
public bool CopyToDocument(ClassDocument sObject, ClassDocument tObject, IObjectSpace ios, DetailView sDetailView) { if (sObject == null) { return(false); } if (tObject == null) { return(false); } bool added = false; int minvalue = 0; int maxvisorder = 0; //GetDetailClassVisOrder(tObject, ref minvalue, ref maxvisorder); if (sDetailView != null) { if (sObject.CardCode != null) { tObject.CardCode = ios.FindObject <vwBusinessPartners>(CriteriaOperator.Parse("BoKey=?", sObject.CardCode.BoKey)); } tObject.CardName = sObject.CardName; if (sObject.CncttCode != null) { tObject.CncttCode = ios.FindObject <vwContactPersons>(CriteriaOperator.Parse("BoKey=?", sObject.CncttCode.BoKey)); } if (sObject.DocCur != null) { tObject.DocCur = ios.FindObject <vwCurrency>(CriteriaOperator.Parse("BoKey=?", sObject.DocCur.BoKey)); } if (sObject.ShipToCode != null) { tObject.ShipToCode = ios.FindObject <vwShipToAddress>(CriteriaOperator.Parse("BoKey=?", sObject.ShipToCode.BoKey)); } tObject.Address2 = sObject.Address2; if (sObject.BillToCode != null) { tObject.BillToCode = ios.FindObject <vwBillToAddress>(CriteriaOperator.Parse("BoKey=?", sObject.BillToCode.BoKey)); } tObject.Address = sObject.Address; if (sObject.SlpCode != null) { tObject.SlpCode = ios.FindObject <vwSalesPersons>(CriteriaOperator.Parse("BoKey=?", sObject.SlpCode.BoKey)); } tObject.JrnMemo = sObject.JrnMemo; tObject.Comments = sObject.Comments; #region assign udf header ClassUDFHeader sClass = getUDFHeaderClass(sObject); ClassUDFHeader tClass = getUDFHeaderClass(tObject); AssignUDFHeaderValues(ref sClass, ref tClass); #endregion } ListPropertyEditor listviewDetail = null; foreach (ViewItem item in sDetailView.Items) { if ((item is ListPropertyEditor)) { if (item.Id == "PurchaseRequestDetail" || item.Id == "PurchaseOrderDetail" || item.Id == "PurchaseDeliveryDetail" || item.Id == "PurchaseReturnDetail" || item.Id == "PurchaseQuotationDetail") { listviewDetail = item as ListPropertyEditor; } } } if (listviewDetail != null && listviewDetail.ListView != null) { foreach (ClassDocumentDetail dtl in listviewDetail.ListView.CollectionSource.List) { if (dtl.OpenQty > dtl.CopyQty && dtl.LineStatus == LineStatusEnum.Open) { //if (added) //{ minvalue--; maxvisorder++; //} added = true; #region create object by type ClassDocumentDetail tDtl = CreateDetailClassFromDocumentClass(ios, tObject); #endregion #region assign udf detail ClassUDFDetail sClassD = getUDFDetailClass(dtl); ClassUDFDetail tClassD = getUDFDetailClass(tDtl); AssignUDFDetailValues(ref sClassD, ref tClassD); #endregion tDtl.Oid = minvalue; tDtl.VisOrder = maxvisorder; CopyGenDocumentValues(ios, dtl, tDtl); //tDtl.Quantity = dtl.OpenQty; //if (dtl.DocCur != null) // tDtl.DocCur = ios.FindObject<vwCurrency>(CriteriaOperator.Parse("BoKey=?", dtl.DocCur.BoKey)); //if (dtl.ItemCode != null) // tDtl.ItemCode = ios.FindObject<vwItemMasters>(CriteriaOperator.Parse("BoKey=?", dtl.ItemCode.BoKey)); //tDtl.Dscription = dtl.Dscription; //if (dtl.WhsCode != null) // tDtl.WhsCode = ios.FindObject<vwWarehouses>(CriteriaOperator.Parse("BoKey=?", dtl.WhsCode.BoKey)); //if (dtl.BinCode != null) // tDtl.BinCode = ios.FindObject<vwWarehouseBins>(CriteriaOperator.Parse("BoKey=?", dtl.BinCode.BoKey)); //if (dtl.OcrCode != null) // tDtl.OcrCode = ios.FindObject<vwDimension1>(CriteriaOperator.Parse("BoKey=?", dtl.OcrCode.BoKey)); //if (dtl.OcrCode2 != null) // tDtl.OcrCode2 = ios.FindObject<vwDimension2>(CriteriaOperator.Parse("BoKey=?", dtl.OcrCode2.BoKey)); //if (dtl.OcrCode3 != null) // tDtl.OcrCode3 = ios.FindObject<vwDimension3>(CriteriaOperator.Parse("BoKey=?", dtl.OcrCode3.BoKey)); //if (dtl.OcrCode4 != null) // tDtl.OcrCode4 = ios.FindObject<vwDimension4>(CriteriaOperator.Parse("BoKey=?", dtl.OcrCode4.BoKey)); //if (dtl.OcrCode5 != null) // tDtl.OcrCode5 = ios.FindObject<vwDimension5>(CriteriaOperator.Parse("BoKey=?", dtl.OcrCode5.BoKey)); //if (dtl.PrjCode != null) // tDtl.PrjCode = ios.FindObject<vwProjects>(CriteriaOperator.Parse("BoKey=?", dtl.PrjCode.BoKey)); //if (dtl.AcctCode != null) // tDtl.AcctCode = ios.FindObject<vwAccounts>(CriteriaOperator.Parse("BoKey=?", dtl.AcctCode.BoKey)); //if (dtl.TaxCode != null) // tDtl.TaxCode = ios.FindObject<vwTaxes>(CriteriaOperator.Parse("BoKey=?", dtl.TaxCode.BoKey)); //if (dtl.FreightCharge != null) // tDtl.FreightCharge = ios.FindObject<vwExpenses>(CriteriaOperator.Parse("BoKey=?", dtl.FreightCharge.BoKey)); //tDtl.BatchNumber = dtl.BatchNumber; //tDtl.UnitMsr = dtl.UnitMsr; //tDtl.UnitPrice = dtl.UnitPrice; //tDtl.TaxPerc = dtl.TaxPerc; //tDtl.TaxAmt = dtl.TaxAmt; //tDtl.DiscountAmt = dtl.DiscountAmt; //tDtl.FreightAmt = dtl.FreightAmt; //if (dtl.ObjType != null) // tDtl.BaseType = ios.GetObjectByKey<DocType>(dtl.ObjType.Oid); //tDtl.Baseline = dtl.Oid; //tDtl.SAPBaseType = dtl.SAPObjType; //tDtl.SAPBaseEntry = dtl.SAPDocEntry; //tDtl.SAPBaseLine = dtl.SAPLineNum; #region create object by type AddDetailClassFromDocumentClass(tObject, tDtl); #endregion } } } #region assign total AssignDocumentClassTotal(tObject); #endregion return(added); }
private void Controller_ObjectCreated(object sender, ObjectCreatedEventArgs e) { ListView lv = ((ListView)View); if (lv.CollectionSource is PropertyCollectionSource) { PropertyCollectionSource collectionSource = (PropertyCollectionSource)lv.CollectionSource; if (collectionSource.MasterObject != null) { int minvalue = 0; int maxvisorder = 0; if (collectionSource.MasterObjectType == typeof(StockTransferRequest) && e.CreatedObject.GetType() == typeof(StockTransferRequestDetail)) { StockTransferRequest masterobject = (StockTransferRequest)collectionSource.MasterObject; StockTransferRequestDetail currentobject = (StockTransferRequestDetail)e.CreatedObject; copyCon.GetStockDetailClassVisOrder(masterobject, ref minvalue, ref maxvisorder); currentobject.Oid = minvalue; currentobject.VisOrder = maxvisorder; if (sDtlS != null) { copyCon.copyClassStockTransferDocumentDetail(sDtlS, currentobject, e.ObjectSpace); } } else if (collectionSource.MasterObjectType == typeof(PurchaseOrder)) { PurchaseOrder masterobject = (PurchaseOrder)collectionSource.MasterObject; PurchaseOrderDetail currentobject = (PurchaseOrderDetail)e.CreatedObject; copyCon.GetDetailClassVisOrder(masterobject, ref minvalue, ref maxvisorder); currentobject.Oid = minvalue; currentobject.VisOrder = maxvisorder; currentobject.DocCur = currentobject.Session.GetObjectByKey <vwCurrency>(masterobject.DocCur.BoKey); if (sDtl != null) { copyCon.copyClassDocumentDetail(sDtl, currentobject, e.ObjectSpace); } } else if (collectionSource.MasterObjectType == typeof(PurchaseRequest)) { PurchaseRequest masterobject = (PurchaseRequest)collectionSource.MasterObject; PurchaseRequestDetail currentobject = (PurchaseRequestDetail)e.CreatedObject; copyCon.GetDetailClassVisOrder(masterobject, ref minvalue, ref maxvisorder); currentobject.Oid = minvalue; currentobject.VisOrder = maxvisorder; if (masterobject.DocCur != null) { currentobject.DocCur = currentobject.Session.GetObjectByKey <vwCurrency>(masterobject.DocCur.BoKey); } if (sDtl != null) { copyCon.copyClassDocumentDetail(sDtl, currentobject, e.ObjectSpace); } } else if (collectionSource.MasterObjectType == typeof(PurchaseDelivery)) { PurchaseDelivery masterobject = (PurchaseDelivery)collectionSource.MasterObject; PurchaseDeliveryDetail currentobject = (PurchaseDeliveryDetail)e.CreatedObject; copyCon.GetDetailClassVisOrder(masterobject, ref minvalue, ref maxvisorder); currentobject.Oid = minvalue; currentobject.VisOrder = maxvisorder; if (masterobject.DocCur != null) { currentobject.DocCur = currentobject.Session.GetObjectByKey <vwCurrency>(masterobject.DocCur.BoKey); } if (sDtl != null) { copyCon.copyClassDocumentDetail(sDtl, currentobject, e.ObjectSpace); } } else if (collectionSource.MasterObjectType == typeof(PurchaseReturn)) { PurchaseReturn masterobject = (PurchaseReturn)collectionSource.MasterObject; PurchaseReturnDetail currentobject = (PurchaseReturnDetail)e.CreatedObject; copyCon.GetDetailClassVisOrder(masterobject, ref minvalue, ref maxvisorder); currentobject.Oid = minvalue; currentobject.VisOrder = maxvisorder; if (masterobject.DocCur != null) { currentobject.DocCur = currentobject.Session.GetObjectByKey <vwCurrency>(masterobject.DocCur.BoKey); } if (sDtl != null) { copyCon.copyClassDocumentDetail(sDtl, currentobject, e.ObjectSpace); } } else if (collectionSource.MasterObjectType == typeof(PurchaseQuotation)) { PurchaseQuotation masterobject = (PurchaseQuotation)collectionSource.MasterObject; PurchaseQuotationDetail currentobject = (PurchaseQuotationDetail)e.CreatedObject; copyCon.GetDetailClassVisOrder(masterobject, ref minvalue, ref maxvisorder); currentobject.Oid = minvalue; currentobject.VisOrder = maxvisorder; if (masterobject.DocCur != null) { currentobject.DocCur = currentobject.Session.GetObjectByKey <vwCurrency>(masterobject.DocCur.BoKey); } if (sDtl != null) { copyCon.copyClassDocumentDetail(sDtl, currentobject, e.ObjectSpace); } } } } sDtl = null; sDtlS = null; }