Exemplo n.º 1
0
        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;
        }
Exemplo n.º 2
0
 public void AssignUDFDetailValues(ref ClassUDFDetail sClass, ref ClassUDFDetail tClass)
 {
     if (sClass is null || tClass is null)
     {
         return;
     }
     System.Reflection.PropertyInfo[] properties = typeof(ClassUDFDetail).GetProperties();
     foreach (System.Reflection.PropertyInfo property in properties)
     {
         //property.GetValue(sClass);
         if (property.Name.Contains("U_"))
         {
             property.SetValue(tClass, property.GetValue(sClass, null), null);
         }
     }
 }
Exemplo n.º 3
0
        public void copyClassStockTransferDocumentDetail(ClassStockTransferDocumentDetail dtl, ClassStockTransferDocumentDetail tDtl, IObjectSpace ios)
        {
            #region assign udf detail
            ClassUDFDetail sClassD = getUDFDetailClass(dtl);
            ClassUDFDetail tClassD = getUDFDetailClass(tDtl);
            AssignUDFDetailValues(ref sClassD, ref tClassD);
            #endregion

            tDtl.Quantity = dtl.Quantity;
            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.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));
            }
            tDtl.UnitMsr = dtl.UnitMsr;

            tDtl.IsDuplicated = true;
        }
Exemplo n.º 4
0
        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);
        }
Exemplo n.º 5
0
        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);
        }