Ejemplo n.º 1
0
 public void BindDataWithPage(int Page)
 {
     QueryObject<Product> query = new QueryObject<Product>();
     query.Page = Page;
     query.PageSize = pager.PageSize;
     query.Condition = new Product();
     query.Condition.Name = this.ProductName.Text.Trim();
     query.Condition.Model = this.Model.Text.Trim();
     query.Condition.CategoryId = SelectedCategory.Id;
     QueryObject<Product> result = myItemManager.GetProducts(query);
     if (result.Result != null && result.Result.Count > 0)
     {
         pager.PageIndex = result.Page;
         pager.PageSize = result.PageSize;
         pager.RecordCount = result.RecordCount;
         list = result.Result;
         DoFill(list);
     }
     else
     {
         pager.PageIndex = Page;
         pager.PageSize = 20;
         pager.RecordCount = 0;
         list = result.Result;
         DoFill(list);
     }
 }
Ejemplo n.º 2
0
 private void BindDataWithPage(int Page)
 {
     QueryObject<Supplier> query = new QueryObject<Supplier>();
     query.Page = Page;
     query.PageSize = pager.PageSize;
     query.Condition = new Supplier();
     query.Condition.Name = this.SupplierName.Text.Trim();
     query.Condition.Remark = this.Remark.Text.Trim();
     QueryObject<Supplier> result = supplierManager.GetSupplierList(query);
     if (result.Result != null && result.Result.Count > 0)
     {
         pager.PageIndex = result.Page;
         pager.PageSize = result.PageSize;
         pager.RecordCount = result.RecordCount;
         list = result.Result;
         DoFill(list);
     }
     else
     {
         pager.PageIndex = Page;
         pager.PageSize = 20;
         pager.RecordCount = 0;
         list = result.Result;
         DoFill(list);
     }
 }
Ejemplo n.º 3
0
 public List<BuyerInfo> GetBuyerInforList(QueryObject<BuyerInfo> query)
 {
     string sql = "SELECT Id, Type, CompanyName, CompanyInfo, Category, Mail,BuyerName, ContactInfo, Url, UrlTitle, Status FROM BuyerInfo";
     if (query.IsPager)
     {
         query.RecordCount = dbHelper.GetItemCount(sql, null);
         sql = sql + " order by Id asc limit " + query.Start + ", " + query.PageSize;
     }
     DataTable dt = dbHelper.ExecuteDataTable(sql, null);
     List<BuyerInfo> list = new List<BuyerInfo>();
     foreach (DataRow row in dt.Rows)
     {
         BuyerInfo kw = new BuyerInfo();
         kw.Id = Convert.ToInt32(row["Id"]);
         kw.Type = (string)row["Type"];
         kw.CompanyName = (string)row["CompanyName"];
         kw.CompanyInfo = (string)row["CompanyInfo"];
         kw.Category = (string)row["Category"];
         kw.Mail = (string)row["Mail"];
         kw.BuyerName = (string)row["BuyerName"];
         kw.ContactInfo = (string)row["ContactInfo"];
         kw.Url = (string)row["Url"];
         kw.UrlTitle = (string)row["UrlTitle"];
         kw.Status = Convert.ToInt32(row["Status"]);
         list.Add(kw);
     }
     return list;
 }
Ejemplo n.º 4
0
        public void ExecuteDynamicQueryObject()
        {
            var source = new List<Product>
                             {
                                 new Product {Name = "NPatterns", Version = 1.2},
                                 new Product {Name = "NPatterns.Messaging.IoC",Version = 1.1},
                                 new Product {Name = "NPatterns.ObjectRelational.EF",Version = 1.0},
                                 new Product {Name = null,Version = 0}
                             };

            var query = new QueryObject(new DynamicQueryObjectExecutor());
            query.Add(new Criteria { Field = "Name", Operator = CriteriaOperator.IsNotNull });

            var criteriaGroup = new CriteriaGroup { Operator = CriteriaGroupOperator.Or };
            criteriaGroup.Criterias.Add(new Criteria { Field = "Name", Operator = CriteriaOperator.IsEqualTo, Value = "npatterns" });
            criteriaGroup.Criterias.Add(new Criteria { Field = "Name", Operator = CriteriaOperator.EndsWith, Value = "ioc" });

            query.Add(criteriaGroup);
            query.Add(new SortDescription { Field = "Version", Direction = SortDirection.Ascending });

            var result = query.Execute(source.AsQueryable()).ToList();
            Assert.AreEqual(2, result.Count);
            Assert.IsTrue(result[0].Version < result[1].Version);

            query.Add(new Criteria { Field = "Version", Operator = CriteriaOperator.IsEqualTo, Value = 1.0 }, CriteriaGroupOperator.Or);
            var result2 = query.Execute(source.AsQueryable()).ToList();
            Assert.AreEqual(3, result2.Count);
        }
Ejemplo n.º 5
0
 private void BindDataWithPage(int Page)
 {
     this.BeginInvoke(new Action(() =>
     {
         QueryObject<FinDetails> query = new QueryObject<FinDetails>();
         query.Page = Page;
         query.PageSize = FinDetailPager.PageSize;
         query.Condition = new FinDetails();
         query.Condition.BeginTime = this.BeginDateTxt.Value.ToString(Constants.DateFormat);
         query.Condition.EndTime = this.EndDateTxt.Value.ToString(Constants.DateFormat);
         query.Condition.Description = this.EventNameTxt.Text.Trim();
         query.Condition.EventType = (string)this.EventTypeTxt.SelectedValue;
         query.Condition.ItemType = (string)this.ItemTypeTxt.SelectedValue;
         query.Condition.OrderNo = this.OrderNoTxt.Text.Trim();
         query.Condition.Association = (string)this.AssociationTxt.SelectedValue;
         QueryObject<FinDetails> result = finOrderManager.GetFinDetails(query);
         if (result.Result != null && result.Result.Count > 0)
         {
             FinDetailPager.PageIndex = result.Page;
             FinDetailPager.PageSize = result.PageSize;
             FinDetailPager.RecordCount = result.RecordCount;
             BindDateTable(result.Result);
         }
         else
         {
             FinDetailPager.PageIndex = Page;
             FinDetailPager.PageSize = 100;
             FinDetailPager.RecordCount = 0;
             BindDateTable(null);
         }
     }));
 }
Ejemplo n.º 6
0
        public QueryObject<AliProduct> GetAliProductList(QueryObject<AliProduct> query)
        {
            string sql = "SELECT Id,Keywords, IsKeywords, Status, GroupId,"
                + " GroupName1,GroupName2,GroupName3, Subject, RedModel, DetailUrl,AbsImageUrl,AbsSummImageUrl,IsWindowProduct,  "
                + "GmtModified, Type, IsDisplay, OwnerMemberId, OwnerMemberName, IsLowScore from AliProducts where 1 = 1";
            int GroupId = Convert.ToInt32(query.Condition.GroupId);
            if (GroupId > 0)
            {
                sql = sql + " and GroupId like '%" + GroupId.ToString() + "%'";
            }
            else {
                bool IsWindowProduct = query.Condition.IsWindowProduct;
                if (IsWindowProduct)
                {
                    sql = sql + " and IsWindowProduct = 1";
                }
            }

            query.RecordCount = dbHelper.GetItemCount(sql, null);
            sql = sql + " order by GmtModified desc limit " + query.Start + ", " + query.PageSize;
            DataTable dt = dbHelper.ExecuteDataTable(sql , null);
            List<AliProduct> list = new List<AliProduct>();
            foreach (DataRow row in dt.Rows)
            {
                AliProduct kw = new AliProduct();
                kw.Id = Convert.ToInt32(row["Id"]);
                kw.Keywords = (string)row["Keywords"];
                kw.IsKeywords = Convert.ToBoolean(row["IsKeywords"]);
                kw.Status = (string)row["Status"];
                kw.GroupName1 = (string)row["GroupName1"];
                kw.GroupName2 = (string)row["GroupName2"];
                kw.GroupName3 = (string)row["GroupName3"];
                kw.Subject = (string)row["Subject"];
                kw.RedModel = (string)row["RedModel"];
                kw.DetailUrl = (string)row["DetailUrl"];
                kw.AbsImageUrl = (string)row["AbsImageUrl"];
                kw.AbsSummImageUrl = (string)row["AbsSummImageUrl"];
                kw.IsWindowProduct = Convert.ToBoolean(row["IsWindowProduct"]);
                kw.GmtModified = (string)row["GmtModified"];
                kw.Type = (string)row["Type"];
                kw.IsDisplay = (string)row["IsDisplay"];
                kw.OwnerMemberId = (string)row["OwnerMemberId"];
                kw.OwnerMemberName = (string)row["OwnerMemberName"];
                kw.IsLowScore = (string)row["IsLowScore"];
                list.Add(kw);
            }
            query.Result = list;
            return query;
        }
Ejemplo n.º 7
0
        private void Build(int treeArrayIndex, int segmentStartIndex, int segmentEndIndex)
        {
            if (segmentStartIndex == segmentEndIndex)
            {
                _treeArray[treeArrayIndex] = new QueryObject(segmentStartIndex, _sourceArray[segmentStartIndex]);
                return;
            }

            int leftChildTreeArrayIndex = 2 * treeArrayIndex + 1;
            int rightChildTreeArrayIndex = leftChildTreeArrayIndex + 1;

            Build(leftChildTreeArrayIndex, segmentStartIndex, (segmentStartIndex + segmentEndIndex) / 2);
            Build(rightChildTreeArrayIndex, (segmentStartIndex + segmentEndIndex) / 2 + 1, segmentEndIndex);

            _treeArray[treeArrayIndex] = _treeArray[leftChildTreeArrayIndex].Combine(_treeArray[rightChildTreeArrayIndex]);
        }
Ejemplo n.º 8
0
        public QueryObject<ImageInfo> GetAliImageList(QueryObject<ImageInfo> query)
        {
            string sql = "select Status, Width, HashCode, FileSize, Id, GroupId, Height, ReferenceCount, ";
            sql = sql + "MemberSeq, FileName, MemberId, MemberName, CompanyId, DisplayNameUtf8, Url, LocationUrl ";
            sql = sql + "FROM AliImages where 1 = 1 ";
            if (query.Condition != null)
            {
                if (query.Condition.GroupId != -1)
                {
                    sql = sql + "and GroupId = " + query.Condition.GroupId + " ";
                }
                if (!string.IsNullOrEmpty(query.Condition.DisplayNameUtf8))
                {
                    sql = sql + "and DisplayNameUtf8 like '%" + query.Condition.DisplayNameUtf8 + "%' ";
                }
            }

            query.RecordCount = dbHelper.GetItemCount(sql, null);

            sql = sql + "limit " + query.Page + ", " + query.PageSize;
            DataTable dt = dbHelper.ExecuteDataTable(sql, null);
            List<ImageInfo> list = new List<ImageInfo>();
            foreach (DataRow row in dt.Rows)
            {
                ImageInfo info = new ImageInfo();
                info.Id = Convert.ToInt32(row["Id"]);
                info.Status = (string)row["Status"];
                info.Width = Convert.ToInt32(row["Width"]);
                info.HashCode = (string)row["HashCode"];
                info.FileSize = Convert.ToInt32(row["FileSize"]);
                info.GroupId = Convert.ToInt32(row["GroupId"]);
                info.Height = Convert.ToInt32(row["Height"]);
                info.ReferenceCount = Convert.ToInt32(row["ReferenceCount"]);
                info.MemberSeq = Convert.ToInt32(row["MemberSeq"]);
                info.FileName = (string)row["FileName"];
                info.MemberId = (string)row["MemberId"];
                info.MemberName = (string)row["MemberName"];
                info.CompanyId = Convert.ToInt32(row["CompanyId"]);
                info.DisplayNameUtf8 = (string)row["DisplayNameUtf8"];
                info.Url = (string)row["Url"];
                info.LocationUrl = (string)row["LocationUrl"];
                list.Add(info);
            }
            query.Result = list;
            return query;
        }
Ejemplo n.º 9
0
 public List<string> GetBuyerInforList(QueryObject<string> query)
 {
     string sql = "SELECT Url FROM SearchUrls";
     if (query.IsPager)
     {
         query.RecordCount = dbHelper.GetItemCount(sql, null);
         sql = sql + " order by Id asc limit " + query.Start + ", " + query.PageSize;
     }
     DataTable dt = dbHelper.ExecuteDataTable(sql, null);
     List<string> list = new List<string>();
     foreach (DataRow row in dt.Rows)
     {
         string url = (string)row["Url"];
         list.Add(url);
     }
     return list;
 }
Ejemplo n.º 10
0
        public void ExecuteDynamicQueryObjectWithComplexType()
        {
            var source = new List<ProductFeature>
                             {
                                 new ProductFeature
                                     {
                                         Product = new Product {Name = "NPatterns", Version = 1.2},
                                         Feature = new Feature {Name = "IUnitOfWork"}
                                     },
                                 new ProductFeature
                                     {
                                         Product = new Product {Name = "NPatterns.Messaging.IoC", Version = 1.1},
                                         Feature = new Feature {Name = "MessageBus"}
                                     },
                                 new ProductFeature
                                     {
                                         Product = new Product {Name = "NPatterns.ObjectRelational.EF", Version = 1.0},
                                         Feature = new Feature {Name = "UnitOfWork"}
                                     },
                                 new ProductFeature
                                     {
                                         Product = new Product(),
                                         Feature = new Feature()
                                     }
                             };

            var query = new QueryObject(new DynamicQueryObjectExecutor());
            query.Add(new Criteria { Field = "Product.Name", Operator = CriteriaOperator.IsNotNull });

            var criteriaGroup = new CriteriaGroup { Operator = CriteriaGroupOperator.Or };
            criteriaGroup.Criterias.Add(new Criteria { Field = "Product.Name", Operator = CriteriaOperator.IsEqualTo, Value = "npatterns" });
            criteriaGroup.Criterias.Add(new Criteria { Field = "Product.Name", Operator = CriteriaOperator.EndsWith, Value = "ioc" });

            query.Add(criteriaGroup);
            var result = query.Execute(source.AsQueryable()).ToList();
            Assert.AreEqual(2, result.Count);

            query.Add(new Criteria { Field = "Product.Version", Operator = CriteriaOperator.IsEqualTo, Value = 1.0 }, CriteriaGroupOperator.Or);
            var result2 = query.Execute(source.AsQueryable()).ToList();
            Assert.AreEqual(3, result2.Count);
        }
Ejemplo n.º 11
0
 public QueryObject<Product> GetProducts(QueryObject<Product> query)
 {
     return productDao.GetProducts(query);
 }
 public static Task <IEnumerable <TSource> > QueryAsync <TSource>(this ISession session, QueryObject queryObject, SqlExecutionOptions executionOptions)
 {
     return(session.QueryAsync <TSource>(queryObject.Sql, queryObject.QueryParams, executionOptions.CommandTimeoutSeconds));
 }
Ejemplo n.º 13
0
 public override IList Coincidencias(Criterio criterio)
 {
     QueryObject consulta = new QueryObject(typeof(Persona));
     consulta.AnadirCriterio(criterio);
     return consulta.Ejecutar();
 }
Ejemplo n.º 14
0
 public QueryObject<Order> GetOrders(QueryObject<Order> query)
 {
     return orderDao.GetOrders(query);
 }
Ejemplo n.º 15
0
        public void Start(PluginStartArguments pluginStartArgs)
        {
            //initialize static context
            StaticContext.Initialize(pluginStartArgs.Plugin, pluginStartArgs.ServiceProvider);

            var entMan = new EntityManager();
            var relMan = new EntityRelationManager();
            var recMan = new RecordManager();
            var storeSystemSettings = DbContext.Current.SettingsRepository.Read();
            var systemSettings      = new SystemSettings(storeSystemSettings);

            using (SecurityContext.OpenSystemScope())
            {
                //Create transaction
                using (var connection = DbContext.Current.CreateConnection())
                {
                    try
                    {
                        connection.BeginTransaction();

                        //Here we need to initialize or update the environment based on the plugin requirements.
                        //The default place for the plugin data is the "plugin_data" entity -> the "data" text field, which is used to store stringified JSON
                        //containing the plugin settings or version

                        #region << 1.Get the current ERP database version and checks for other plugin dependencies >>
                        if (systemSettings.Version > 0)
                        {
                            //Do something if database version is not what you expect
                        }

                        //This plugin needs the webvella-crm plugin to be installed, so we will check this here
                        var installedPlugins = new PluginService().Plugins;
                        var crmPluginFound   = false;
                        foreach (var plugin in installedPlugins)
                        {
                            switch (plugin.Name)
                            {
                            case "webvella-crm":
                                crmPluginFound = true;
                                break;

                            default:
                                break;
                            }
                        }

                        if (!crmPluginFound)
                        {
                            throw new Exception("'webvella-crm' plugin is required for the 'webvella-project' to operate");
                        }

                        #endregion

                        #region << 2.Get the current plugin settings from the database >>
                        var         currentPluginSettings   = new PluginSettings();
                        QueryObject pluginDataQueryObject   = EntityQuery.QueryEQ("name", WEBVELLA_PROJECT_PLUGIN_NAME);
                        var         pluginDataQuery         = new EntityQuery("plugin_data", "*", pluginDataQueryObject);
                        var         pluginDataQueryResponse = recMan.Find(pluginDataQuery);
                        if (!pluginDataQueryResponse.Success)
                        {
                            throw new Exception("plugin 'webvella-project' failed to get its settings due to: " + pluginDataQueryResponse.Message);
                        }

                        if (pluginDataQueryResponse.Object == null || !pluginDataQueryResponse.Object.Data.Any() || pluginDataQueryResponse.Object.Data[0]["data"] == DBNull.Value)
                        {
                            //plugin was not installed
                            currentPluginSettings.Version = 20160429;
                            {
                                string json = JsonConvert.SerializeObject(currentPluginSettings);
                                var    settingsEntityRecord = new EntityRecord();
                                settingsEntityRecord["id"]   = WEBVELLA_PROJECT_PLUGIN_ID;
                                settingsEntityRecord["name"] = WEBVELLA_PROJECT_PLUGIN_NAME;
                                settingsEntityRecord["data"] = json;
                                var settingsSaveReponse = recMan.CreateRecord("plugin_data", settingsEntityRecord);
                                if (!settingsSaveReponse.Success)
                                {
                                    throw new Exception("plugin 'webvella-project' failed to save its settings in the database due to: " + pluginDataQueryResponse.Message);
                                }
                            }
                        }
                        else
                        {
                            string json = (string)((List <EntityRecord>)pluginDataQueryResponse.Object.Data)[0]["data"];
                            currentPluginSettings = JsonConvert.DeserializeObject <PluginSettings>(json);
                        }
                        #endregion

                        #region << 3. Run methods based on the current installed version of the plugin >>
                        if (currentPluginSettings.Version < 20160430)
                        {
                            try
                            {
                                currentPluginSettings.Version = 20160430;
                                Patch160430(entMan, relMan, recMan, createSampleRecords);
                            }
                            catch (Exception ex)
                            {
                                throw ex;
                            }
                        }

                        if (currentPluginSettings.Version < 20160610)
                        {
                            try
                            {
                                currentPluginSettings.Version = 20160610;
                                Patch160610(entMan, relMan, recMan, createSampleRecords);
                            }
                            catch (Exception ex)
                            {
                                throw ex;
                            }
                        }

                        if (currentPluginSettings.Version < 20160613)
                        {
                            try
                            {
                                currentPluginSettings.Version = 20160613;
                                Patch160613(entMan, relMan, recMan, createSampleRecords);
                            }
                            catch (Exception ex)
                            {
                                throw ex;
                            }
                        }

                        if (currentPluginSettings.Version < 20160627)
                        {
                            try
                            {
                                currentPluginSettings.Version = 20160627;
                                Patch160627(entMan, relMan, recMan, createSampleRecords);
                            }
                            catch (Exception ex)
                            {
                                throw ex;
                            }
                        }

                        if (currentPluginSettings.Version < 20160707)
                        {
                            try
                            {
                                currentPluginSettings.Version = 20160707;
                                Patch160707(entMan, relMan, recMan, createSampleRecords);
                            }
                            catch (Exception ex)
                            {
                                throw ex;
                            }
                        }

                        if (currentPluginSettings.Version < 20161118)
                        {
                            try
                            {
                                currentPluginSettings.Version = 20161118;
                                Patch161118(entMan, relMan, recMan, createSampleRecords);
                            }
                            catch (Exception ex)
                            {
                                throw ex;
                            }
                        }

                        if (currentPluginSettings.Version < 20161119)
                        {
                            try
                            {
                                currentPluginSettings.Version = 20161119;
                                Patch161119(entMan, relMan, recMan, createSampleRecords);
                            }
                            catch (Exception ex)
                            {
                                var exception = ex;
                                throw ex;
                            }
                        }

                        if (currentPluginSettings.Version < 20170119)
                        {
                            try
                            {
                                currentPluginSettings.Version = 20170119;
                                Patch170119(entMan, relMan, recMan, createSampleRecords);
                            }
                            catch (Exception ex)
                            {
                                throw ex;
                            }
                        }

                        if (currentPluginSettings.Version < 20170328)
                        {
                            try
                            {
                                currentPluginSettings.Version = 20170328;
                                Patch170328(entMan, relMan, recMan, createSampleRecords);
                            }
                            catch (Exception ex)
                            {
                                throw ex;
                            }
                        }

                        if (currentPluginSettings.Version < 20170502)
                        {
                            try
                            {
                                currentPluginSettings.Version = 20170502;
                                Patch20170502(entMan, relMan, recMan, createSampleRecords);
                            }
                            catch (Exception ex)
                            {
                                throw ex;
                            }
                        }

                        #endregion

                        #region << 4. Save needed changes to the plugin setting data >>
                        {
                            string json = JsonConvert.SerializeObject(currentPluginSettings);
                            var    settingsEntityRecord = new EntityRecord();
                            settingsEntityRecord["id"]   = WEBVELLA_PROJECT_PLUGIN_ID;
                            settingsEntityRecord["name"] = WEBVELLA_PROJECT_PLUGIN_NAME;
                            settingsEntityRecord["data"] = json;
                            var settingsUpdateReponse = recMan.UpdateRecord("plugin_data", settingsEntityRecord);
                            if (!settingsUpdateReponse.Success)
                            {
                                throw new Exception("plugin 'webvella-project' failed to update its settings in the database due to: " + pluginDataQueryResponse.Message);
                            }
                        }
                        #endregion


                        connection.CommitTransaction();
                    }
                    catch (Exception ex)
                    {
                        connection.RollbackTransaction();
                        throw ex;
                    }
                }
            }
        }
Ejemplo n.º 16
0
 public QueryObject Combine(QueryObject rightAdjacentObject)
     => new QueryObject(
         segmentStartIndex: SegmentStartIndex,
         segmentEndIndex: rightAdjacentObject.SegmentEndIndex,
         sum: Sum + rightAdjacentObject.Sum);
Ejemplo n.º 17
0
        private void GenerateResultTable()
        {
            string ResultSQL = " SELECT RunID, TestcaseID, TestcaseName, ContextID, ContextName, ResultTypeID, ResultTypeDescription, Analyzed, AnalyzedBit, Comment, FailCount, TotalCount, " +
                     " StartTime, EndTime, PrevTestcaseID, MachineID, MachineName, OSID, OSName, ProductID, ProductName, TestOwnerId, TestOwnerName, TeamID, TeamName, " +
                      " AreaID, AreaName, AreaHierarchy, DesignStatusID, DesignStatusName, RunStatusID, RunStatusName, TestDriverName, TestdriverID, TeamHierarchy, ResetCount, " +
                      " OwnerID, OwnerName, Priority, RunTimeInSeconds, RunTime, AutoAnalysisStatus, BranchID, BranchName, AnalysisDescription, AutoAnalysisInvalid" +
                      " FROM vResults WHERE (RunID IN ({0}))";

            QueryObject Robj = new QueryObject(string.Format(ResultSQL,RunID), MDTypes.Results);
            Console.WriteLine(Robj);
            _resultTable = Robj.GetDataSet().Tables[0];
        }
Ejemplo n.º 18
0
        public bool Rebate(int orderId)
        {
            var Transaction = _databaseInstance.BeginTransaction();

            //try
            //{
            WxPayAPI.Log.Debug("Ecard.SqlServices.SqlRebateService.Rebate", "开始返利");
            var order = _databaseInstance.GetById <Order>("fz_Orders", orderId);

            if (order == null)
            {
                return(false);
            }
            if (order.orderState != OrderStates.complete)
            {
                return(false);
            }
            string sql       = "select  * from fz_OrderDetails where OrderId=@OrderId";
            var    orderDeal = new QueryObject <OrderDetail>(_databaseInstance, sql, new { OrderId = orderId });

            if (orderDeal == null)
            {
                return(false);
            }
            if (orderDeal.ToList().Count <= 0)
            {
                return(false);
            }
            var account = IAccountService.GetById(order.userId);

            if (account == null)
            {
                return(false);
            }
            Account one   = IAccountService.GetById(account.salerId);
            Account two   = null;
            Account three = null;

            if (one != null)
            {
                //WxPayAPI.Log.Debug("Ecard.SqlServices.SqlRebateService.Rebate", "第一层:"+one.name);
                two = IAccountService.GetById(one.salerId);
            }
            if (two != null)
            {
                three = IAccountService.GetById(two.salerId);
            }
            var site = ISiteService.Query(null).FirstOrDefault();

            if (site == null)
            {
                return(false);
            }
            foreach (var item in orderDeal.ToList())
            {
                if (one != null)
                {
                    var oneAmount = item.amount * site.OneRebate;
                    // WxPayAPI.Log.Debug("Ecard.SqlServices.SqlRebateService.Rebate", "第一层金额:" + oneAmount.ToString());
                    if (oneAmount > 0)
                    {
                        one.amount += oneAmount;
                        var fzRebate = new fz_Rebate();
                        fzRebate.accountId     = one.accountId;
                        fzRebate.orderDetailId = item.orderDetailId;
                        fzRebate.payAmount     = item.amount;
                        fzRebate.reateAmount   = oneAmount;
                        fzRebate.reateRatio    = site.OneRebate;
                        fzRebate.state         = RebateState.normal;
                        fzRebate.submitTime    = DateTime.Now;
                        fzRebate.type          = RebateType.one;
                        fzRebate.rebateId      = _databaseInstance.Insert(fzRebate, "fz_Rebate");
                        if (fzRebate.accountId > 0)
                        {
                            var operationAmountLog = new fz_OperationAmountLogs();
                            operationAmountLog.amount     = oneAmount;
                            operationAmountLog.source     = fzRebate.rebateId.ToString();
                            operationAmountLog.userId     = fzRebate.accountId;
                            operationAmountLog.type       = OperationAmountType.Income;
                            operationAmountLog.category   = OperationAmountCategory.rebate;
                            operationAmountLog.submitTime = DateTime.Now;
                            if (_databaseInstance.Insert(operationAmountLog, "fz_OperationAmountLogs") <= 0)
                            {
                                return(false);
                            }
                        }
                        else
                        {
                            return(false);
                        }
                        //WxPayAPI.Log.Debug("Ecard.SqlServices.SqlRebateService.Rebate", "第一层返利成功:" + fzRebate.rebateId.ToString());
                    }
                }
                if (two != null)
                {
                    var twoAmount = item.amount * site.TwoRebate;
                    if (twoAmount > 0)
                    {
                        two.amount += twoAmount;
                        var fzRebate = new fz_Rebate();
                        fzRebate.accountId     = two.accountId;
                        fzRebate.orderDetailId = item.orderDetailId;
                        fzRebate.payAmount     = item.amount;
                        fzRebate.reateAmount   = twoAmount;
                        fzRebate.reateRatio    = site.TwoRebate;
                        fzRebate.state         = RebateState.normal;
                        fzRebate.submitTime    = DateTime.Now;
                        fzRebate.type          = RebateType.two;
                        fzRebate.rebateId      = _databaseInstance.Insert(fzRebate, "fz_Rebate");
                        if (fzRebate.accountId > 0)
                        {
                            var operationAmountLog = new fz_OperationAmountLogs();
                            operationAmountLog.amount     = twoAmount;
                            operationAmountLog.source     = fzRebate.rebateId.ToString();
                            operationAmountLog.userId     = fzRebate.accountId;
                            operationAmountLog.type       = OperationAmountType.Income;
                            operationAmountLog.category   = OperationAmountCategory.rebate;
                            operationAmountLog.submitTime = DateTime.Now;
                            if (_databaseInstance.Insert(operationAmountLog, "fz_OperationAmountLogs") <= 0)
                            {
                                return(false);
                            }
                        }
                        else
                        {
                            return(false);
                        }
                    }
                }

                if (three != null)
                {
                    var threeAmount = item.amount * site.ThreeRebate;
                    if (threeAmount > 0)
                    {
                        three.amount += threeAmount;
                        var fzRebate = new fz_Rebate();
                        fzRebate.accountId     = three.accountId;
                        fzRebate.orderDetailId = item.orderDetailId;
                        fzRebate.payAmount     = item.amount;
                        fzRebate.reateAmount   = threeAmount;
                        fzRebate.reateRatio    = site.ThreeRebate;
                        fzRebate.state         = RebateState.normal;
                        fzRebate.submitTime    = DateTime.Now;
                        fzRebate.type          = RebateType.three;
                        fzRebate.rebateId      = _databaseInstance.Insert(fzRebate, "fz_Rebate");
                        if (fzRebate.accountId > 0)
                        {
                            var operationAmountLog = new fz_OperationAmountLogs();
                            operationAmountLog.amount     = threeAmount;
                            operationAmountLog.source     = fzRebate.rebateId.ToString();
                            operationAmountLog.userId     = fzRebate.accountId;
                            operationAmountLog.type       = OperationAmountType.Income;
                            operationAmountLog.category   = OperationAmountCategory.rebate;
                            operationAmountLog.submitTime = DateTime.Now;
                            if (_databaseInstance.Insert(operationAmountLog, "fz_OperationAmountLogs") <= 0)
                            {
                                return(false);
                            }
                        }
                        else
                        {
                            return(false);
                        }
                    }
                }
                item.IsRebate = true;
                if (_databaseInstance.Update(item, "fz_OrderDetails") <= 0)
                {
                    return(false);
                }
            }
            if (one != null)
            {
                _databaseInstance.Update(one, "fz_Accounts");
            }
            if (two != null)
            {
                _databaseInstance.Update(two, "fz_Accounts");
            }
            if (three != null)
            {
                _databaseInstance.Update(three, "fz_Accounts");
            }

            Transaction.Commit();
            Transaction.Dispose();
            return(true);
            //}
            //catch (Exception ex)
            //{
            //    ILog4netService.Insert(ex);
            //    Transaction.Rollback();
            //    return false;
            //}
            //finally
            //{
            //    Transaction.Dispose();
            //}
        }
Ejemplo n.º 19
0
        /// <summary>
        /// 获取可操作状态信息
        /// </summary>
        /// <returns></returns>
        public string OP_GetStatus()
        {
            GenerWorkFlow gwf = new GenerWorkFlow(this.WorkID);

            Hashtable ht = new Hashtable();

            string json = "{";
            bool   isCan;

            #region 文件打印的权限判断,这里为天业集团做的特殊判断,现实的应用中,都可以打印.
            bool CanPackUp = true;
            if (SystemConfig.CustomerNo == "TianYe" && WebUser.No != "admin")
            {
                CanPackUp = IsCanPrintSpecForTianYe(gwf);
            }
            #endregion 文件打印的权限判断,这里为天业集团做的特殊判断,现实的应用中,都可以打印.

            ht.Add("CanPackUp", CanPackUp.ToString().ToLower());

            //是否可以打印.
            switch (gwf.WFState)
            {
            case WFState.Runing:     /* 运行时*/
                /*删除流程.*/
                isCan = BP.WF.Dev2Interface.Flow_IsCanDeleteFlowInstance(this.FK_Flow, this.WorkID, WebUser.No);

                ht.Add("CanFlowOverByCoercion", isCan.ToString().ToLower());

                /*取回审批*/
                isCan = false;
                string para   = "";
                string sql    = "SELECT NodeID FROM WF_Node WHERE CheckNodes LIKE '%" + gwf.FK_Node + "%'";
                int    myNode = DBAccess.RunSQLReturnValInt(sql, 0);

                if (myNode != 0)
                {
                    GetTask gt = new GetTask(myNode);
                    if (gt.Can_I_Do_It())
                    {
                        isCan = true;

                        ht.Add("TackBackFromNode", gwf.FK_Node);
                        ht.Add("TackBackToNode", myNode);
                    }
                }
                ht.Add("CanTackBack", isCan.ToString().ToLower());

                /*撤销发送*/
                GenerWorkerLists workerlists = new GenerWorkerLists();
                QueryObject      info        = new QueryObject(workerlists);
                info.AddWhere(GenerWorkerListAttr.FK_Emp, WebUser.No);
                info.addAnd();
                info.AddWhere(GenerWorkerListAttr.IsPass, "1");
                info.addAnd();
                info.AddWhere(GenerWorkerListAttr.IsEnable, "1");
                info.addAnd();
                info.AddWhere(GenerWorkerListAttr.WorkID, this.WorkID);
                isCan = info.DoQuery() > 0;
                ht.Add("CanUnSend", isCan.ToString().ToLower());
                break;

            case WFState.Complete:     // 完成.
            case WFState.Delete:       // 逻辑删除..
                /*恢复使用流程*/
                isCan = WebUser.No == "admin";
                ht.Add("CanRollBack", isCan.ToString().ToLower());

                ht.Add("Rollback", "1");


                //判断是否可以打印.
                break;

            case WFState.HungUp:     // 挂起.
                /*撤销挂起*/
                isCan = BP.WF.Dev2Interface.Flow_IsCanDoCurrentWork(WorkID, WebUser.No);

                ht.Add("CanUnHungUp", isCan.ToString().ToLower());
                break;

            default:
                break;
            }

            return(BP.Tools.Json.ToJson(ht));

            //return json + "}";
        }
Ejemplo n.º 20
0
        public async Task <IActionResult> GetAll([ModelBinder(typeof(QueryModelBinder))] QueryObject query)
        {
            var devicesPayload = await _service.GetAllDevices(query).ConfigureAwait(false);

            return(new PayloadResult(devicesPayload, HttpStatusCode.OK));
        }
Ejemplo n.º 21
0
 private void NewItemForm_Load(object sender, EventArgs e)
 {
     this.ProductStatus.DisplayMember = "Label";
     this.ProductStatus.ValueMember = "Key";
     this.ProductStatus.DataSource = manager.GetAppDicOptions(Constants.ProductStatus);
     this.PriceCate.DisplayMember = "CateName";
     this.PriceCate.ValueMember = "Id";
     this.Minimum.Text = "100";
     QueryObject<PriceCate> query = new QueryObject<PriceCate>();
     query.IsExport = true;
     this.PriceCate.DataSource = manager.GetPriceCates(query).Result;
     this.selectedCategory = DataCache.Instance.SelectedCategory;
     LoadUpdatedProduct(UpdatedProduct);
     LoadCategoryTreeView();
 }
Ejemplo n.º 22
0
        public async Task Location(IDialogContext context, LuisResult result)
        {
            string message = ""; string levelOfGeography = "";
            Tuple <string, string> subjectTuple;
            var      conversation        = context.Activity as Activity;
            Activity replyToConversation = conversation.CreateReply(message);

            replyToConversation.Type = "message";

            var entities    = new List <EntityRecommendation>(result.Entities);
            int resultCount = EntityHandler.GetResultCount(entities);

            subjectTuple = EntityHandler.DetermineSubject(entities);
            string fullSubjectStr = subjectTuple.Item2;

            if (fullSubjectStr == "B")
            {
                replyToConversation.Text = "Sorry, unable to determine what subject you're asking about";
                await context.PostAsync(replyToConversation);

                context.Wait(MessageReceived); return;
            }
            string      queryTopic = DataSubjects.Topics.First(t => t.Item2 == fullSubjectStr.Substring(1, 2)).Item1;
            QueryObject _queryObj  = new QueryObject(fullSubjectStr);

            if (entities.Any((entity) => entity.Type == "level_of_geography"))
            {
                levelOfGeography = entities.Where(e => e.Type == "level_of_geography")
                                   .First().Entity;
                Parser.ParseLevelOfGeography(levelOfGeography, _queryObj, _dataTypes);
                if (!_dataTypes.ResolveSuccess)
                {
                    replyToConversation.Text = $"{_dataTypes.Message}: '{levelOfGeography}'";
                    await context.PostAsync(replyToConversation);

                    context.Wait(MessageReceived);
                    return;
                }
            }
            if (entities.Any((entity) => entity.Type == "location"))
            {
                string locationEntity = entities.Where(e => e.Type == "location")
                                        .First().Entity.ToLower();
                LevelsOfGeography lg = Parser.ParseLocation(locationEntity, _queryObj);
                if (lg.ResolveSuccess)
                {
                    _queryObj.Location = $"{_queryObj.LocationLevel}:{lg.LocationCode}";
                }
                else
                {
                    replyToConversation.Text = $"{lg.Message}: '{locationEntity}'";
                    await context.PostAsync(replyToConversation);

                    context.Wait(MessageReceived);
                    return;
                }
            }

            await context.PostAsync(replyToConversation);

            string apiResponse = await _queryObj.QueryWeb();

            var            resultObjects = Parser.ParseToObjects(apiResponse, _queryObj);
            List <JObject> newObjects    = new List <JObject>();

            try
            {
                if (entities.Any(e => e.Type == "ascending"))
                {
                    newObjects = resultObjects
                                 .OrderBy(x => Convert.ToInt32(x[fullSubjectStr])).Take(resultCount).ToList();
                    for (var i = 0; i < newObjects.Count(); i++)
                    {
                        if (i == 0)
                        {
                            replyToConversation.Text = $"{newObjects[i]["NAME"].ToString().Replace("  ", "%").Split('%')[0]} has the least {subjectTuple.Item1} with {newObjects[i][fullSubjectStr]}.  \r\n";
                        }
                        else if (i == newObjects.Count() - 1)
                        {
                            replyToConversation.Text += $"Finally, {newObjects[i]["NAME"].ToString().Replace("  ","%").Split('%')[0]} has {subjectTuple.Item1} with {newObjects[i][fullSubjectStr]}. ";
                        }
                        else
                        {
                            //randomize conjunctions to make more natural syntax
                            replyToConversation.Text += $"{PartsOfSpeech.GetConjunctiveAdverb()} {newObjects[i]["NAME"].ToString().Replace("  ", "%").Split('%')[0]} with {newObjects[i][fullSubjectStr]}.  \r\n";
                        }
                    }
                }
                else if (entities.Any(e => e.Type == "descending"))
                {
                    newObjects = resultObjects
                                 .OrderByDescending(x => Convert.ToInt32(x[fullSubjectStr])).Take(resultCount).ToList();
                    for (var i = 0; i < newObjects.Count(); i++)
                    {
                        if (i == 0)
                        {
                            replyToConversation.Text = $"{newObjects[i]["NAME"].ToString().Replace("  ", "%").Split('%')[0]} has the most {subjectTuple.Item1} with {newObjects[i][fullSubjectStr]}.  \r\n";
                        }
                        else if (i == newObjects.Count() - 1)
                        {
                            replyToConversation.Text += $"Finally, {newObjects[i]["NAME"].ToString().Replace("  ", "%").Split('%')[0]} has {newObjects[i][fullSubjectStr]}.  ";
                        }
                        else
                        {
                            //randomize conjunctions to make more natural syntax
                            replyToConversation.Text += $"{PartsOfSpeech.GetConjunctiveAdverb()} {newObjects[i]["NAME"].ToString().Replace("  ", "%").Split('%')[0]} with {newObjects[i][fullSubjectStr]}.  \r\n";
                        }
                    }
                }
                var json = JsonConvert.SerializeObject(newObjects);
                //replyToConversation.Text = json;
            }
            catch (Exception e)
            {
                replyToConversation.Text = "Sorry, I ran into an error trying to serialize my response";
                Console.WriteLine(e.Message);
            }

            await context.PostAsync(replyToConversation);

            context.Wait(MessageReceived);
        }
Ejemplo n.º 23
0
 public NameEvaluator2(VisitorContext context, QueryObject right)
 {
     _context = context;
     _right   = right;
 }
Ejemplo n.º 24
0
 public virtual IQueryFluent <TEntity> Query(QueryObject <TEntity> queryObject)
 {
     return(new QueryFluent <TEntity>(this, queryObject));
 }
Ejemplo n.º 25
0
 public QueryObject<FinDetails> GetFinDetails(QueryObject<FinDetails> query)
 {
     return financeDao.GetFinDetails(query);
 }
Ejemplo n.º 26
0
        /// <summary>
        /// 获取流程的JSON数据,以供显示工作轨迹/流程设计
        /// </summary>
        /// <param name="fk_flow">流程编号</param>
        /// <param name="workid">工作编号</param>
        /// <param name="fid">父流程编号</param>
        /// <returns></returns>
        public string Chart_Init()
        {
            string fk_flow = this.FK_Flow;
            Int64  workid  = this.WorkID;
            Int64  fid     = this.FID;

            DataSet   ds   = new DataSet();
            DataTable dt   = null;
            string    json = string.Empty;

            try
            {
                //获取流程信息
                var sql = "SELECT No \"No\", Name \"Name\", Paras \"Paras\", ChartType \"ChartType\" FROM WF_Flow WHERE No='" + fk_flow + "'";
                dt           = DBAccess.RunSQLReturnTable(sql);
                dt.TableName = "WF_Flow";
                ds.Tables.Add(dt);

                //获取流程中的节点信息
                sql = "SELECT NodeID \"ID\", Name \"Name\", ICON \"Icon\", X \"X\", Y \"Y\", NodePosType \"NodePosType\",RunModel \"RunModel\",HisToNDs \"HisToNDs\",TodolistModel \"TodolistModel\" FROM WF_Node WHERE FK_Flow='" +
                      fk_flow + "' ORDER BY Step";
                dt           = DBAccess.RunSQLReturnTable(sql);
                dt.TableName = "WF_Node";
                ds.Tables.Add(dt);

                //获取流程中的标签信息
                sql          = "SELECT MyPK \"MyPK\", Name \"Name\", X \"X\", Y \"Y\" FROM WF_LabNote WHERE FK_Flow='" + fk_flow + "'";
                dt           = DBAccess.RunSQLReturnTable(sql);
                dt.TableName = "WF_LabNote";
                ds.Tables.Add(dt);

                //获取流程中的线段方向信息
                sql          = "SELECT Node \"Node\", ToNode \"ToNode\", 0 as  \"DirType\", 0 as \"IsCanBack\",Dots \"Dots\" FROM WF_Direction WHERE FK_Flow='" + fk_flow + "'";
                dt           = DBAccess.RunSQLReturnTable(sql);
                dt.TableName = "WF_Direction";
                ds.Tables.Add(dt);

                if (workid != 0)
                {
                    //获取流程信息,added by liuxc,2016-10-26
                    //sql =
                    //    "SELECT wgwf.Starter,wgwf.StarterName,wgwf.RDT,wgwf.WFSta,wgwf.WFState FROM WF_GenerWorkFlow wgwf WHERE wgwf.WorkID = " +
                    //    workid;
                    sql = "SELECT wgwf.Starter as \"Starter\","
                          + "        wgwf.StarterName as \"StarterName\","
                          + "        wgwf.RDT as \"RDT\","
                          + "        wgwf.WFSta as \"WFSta\","
                          + "        se.Lab  as   \"WFStaText\","
                          + "        wgwf.WFState as \"WFState\","
                          + "        wgwf.FID as \"FID\","
                          + "        wgwf.PWorkID as \"PWorkID\","
                          + "        wgwf.PFlowNo as \"PFlowNo\","
                          + "        wgwf.PNodeID as \"PNodeID\","
                          + "        wgwf.FK_Flow as \"FK_Flow\","
                          + "        wgwf.FK_Node as \"FK_Node\","
                          + "        wgwf.Title as \"Title\","
                          + "        wgwf.WorkID as \"WorkID\","
                          + "        wgwf.NodeName as \"NodeName\","
                          + "        wf.Name  as   \"FlowName\""
                          + " FROM   WF_GenerWorkFlow wgwf"
                          + "        INNER JOIN WF_Flow wf"
                          + "             ON  wf.No = wgwf.FK_Flow"
                          + "        INNER JOIN Sys_Enum se"
                          + "             ON  se.IntKey = wgwf.WFSta"
                          + "             AND se.EnumKey = 'WFSta'"
                          + " WHERE  wgwf.WorkID = {0}"
                          + "        OR  wgwf.FID = {0}"
                          + "        OR  wgwf.PWorkID = {0}"
                          + " ORDER BY"
                          + "        wgwf.RDT DESC";

                    dt           = DBAccess.RunSQLReturnTable(string.Format(sql, workid));
                    dt.TableName = "FlowInfo";
                    ds.Tables.Add(dt);

                    //获得流程状态.
                    WFState wfState = (WFState)int.Parse(dt.Rows[0]["WFState"].ToString());

                    String fk_Node = dt.Rows[0]["FK_Node"].ToString();
                    //把节点审核配置信息.
                    FrmWorkCheck fwc = new FrmWorkCheck(fk_Node);
                    ds.Tables.Add(fwc.ToDataTableField("FrmWorkCheck"));


                    //获取工作轨迹信息
                    var trackTable = "ND" + int.Parse(fk_flow) + "Track";
                    sql = "SELECT FID \"FID\",NDFrom \"NDFrom\",NDFromT \"NDFromT\",NDTo  \"NDTo\", NDToT \"NDToT\", ActionType \"ActionType\",ActionTypeText \"ActionTypeText\",Msg \"Msg\",RDT \"RDT\",EmpFrom \"EmpFrom\",EmpFromT \"EmpFromT\", EmpToT \"EmpToT\",EmpTo \"EmpTo\" FROM " + trackTable +
                          " WHERE WorkID=" +
                          workid + (fid == 0 ? (" OR FID=" + workid) : (" OR WorkID=" + fid + " OR FID=" + fid)) + " ORDER BY RDT DESC";

                    dt = DBAccess.RunSQLReturnTable(sql);
                    DataTable newdt = new DataTable();
                    newdt = dt.Clone();
                    //判断轨迹数据中,最后一步是否是撤销或退回状态的,如果是,则删除最后2条数据
                    if (dt.Rows.Count > 0)
                    {
                        if (Equals(dt.Rows[0]["ACTIONTYPE"], (int)ActionType.Return) || Equals(dt.Rows[0]["ACTIONTYPE"], (int)ActionType.UnSend))
                        {
                            if (dt.Rows.Count > 1)
                            {
                                dt.Rows.RemoveAt(0);
                                dt.Rows.RemoveAt(0);
                            }
                            else
                            {
                                dt.Rows.RemoveAt(0);
                            }

                            newdt = dt;
                        }
                        else if (dt.Rows.Count > 1 && (Equals(dt.Rows[1]["ACTIONTYPE"], (int)ActionType.Return) || Equals(dt.Rows[1]["ACTIONTYPE"], (int)ActionType.UnSend)))
                        {
                            //删除已发送的节点,
                            if (dt.Rows.Count > 3)
                            {
                                dt.Rows.RemoveAt(1);
                                dt.Rows.RemoveAt(1);
                            }
                            else
                            {
                                dt.Rows.RemoveAt(1);
                            }

                            string fk_node = "";
                            if (dt.Rows[0]["NDFrom"].Equals(dt.Rows[0]["NDTo"]))
                            {
                                fk_node = dt.Rows[0]["NDFrom"].ToString();
                            }
                            if (DataType.IsNullOrEmpty(fk_node) == false)
                            {
                                //如果是跳转页面,则需要删除中间跳转的节点
                                foreach (DataRow dr in dt.Rows)
                                {
                                    if (Equals(dr["ACTIONTYPE"], (int)ActionType.Skip) && dr["NDFrom"].ToString().Equals(fk_node))
                                    {
                                        continue;
                                    }
                                    DataRow newdr = newdt.NewRow();
                                    newdr.ItemArray = dr.ItemArray;
                                    newdt.Rows.Add(newdr);
                                }
                            }
                            else
                            {
                                newdt = dt.Copy();
                            }
                        }
                        else
                        {
                            newdt = dt.Copy();
                        }
                    }

                    newdt.TableName = "Track";
                    ds.Tables.Add(newdt);

                    //获取预先计算的节点处理人,以及处理时间,added by liuxc,2016-4-15
                    sql = "SELECT wsa.FK_Node as \"FK_Node\",wsa.FK_Emp as \"FK_Emp\",wsa.EmpName as \"EmpName\",wsa.TimeLimit as \"TimeLimit\",wsa.TSpanHour as \"TSpanHour\",wsa.ADT as \"ADT\",wsa.SDT as \"SDT\" FROM WF_SelectAccper wsa WHERE wsa.WorkID = " + workid;
                    dt  = DBAccess.RunSQLReturnTable(sql);
                    // dt.TableName = "POSSIBLE";
                    dt.TableName = "Possible";
                    ds.Tables.Add(dt);

                    //获取节点处理人数据,及处理/查看信息
                    sql = "SELECT wgw.FK_Emp as \"FK_Emp\",wgw.FK_Node as \"FK_Node\",wgw.FK_EmpText as \"FK_EmpText\",wgw.RDT as \"RDT\",wgw.IsRead as \"IsRead\",wgw.IsPass as \"IsPass\" FROM WF_GenerWorkerlist wgw WHERE wgw.WorkID = " +
                          workid + (fid == 0 ? (" OR FID=" + workid) : (" OR WorkID=" + fid + " OR FID=" + fid));
                    dt           = DBAccess.RunSQLReturnTable(sql);
                    dt.TableName = "DISPOSE";
                    ds.Tables.Add(dt);



                    //如果流程没有完成.
                    if (wfState != WFState.Complete)
                    {
                        GenerWorkerLists gwls = new GenerWorkerLists();
                        Int64            id   = this.FID;
                        if (id == 0)
                        {
                            id = this.WorkID;
                        }

                        QueryObject qo = new QueryObject(gwls);
                        qo.AddWhere(GenerWorkerListAttr.FID, id);
                        qo.addOr();
                        qo.AddWhere(GenerWorkerListAttr.WorkID, id);
                        qo.DoQuery();

                        DataTable dtGwls = gwls.ToDataTableField("WF_GenerWorkerList");
                        ds.Tables.Add(dtGwls);
                    }
                }
                else
                {
                    var trackTable = "ND" + int.Parse(fk_flow) + "Track";
                    sql = "SELECT NDFrom \"NDFrom\", NDTo \"NDTo\",ActionType \"ActionType\",ActionTypeText \"ActionTypeText\",Msg \"Msg\",RDT \"RDT\",EmpFrom \"EmpFrom\",EmpFromT \"EmpFromT\",EmpToT \"EmpToT\",EmpTo \"EmpTo\" FROM " + trackTable +
                          " WHERE WorkID=0 ORDER BY RDT ASC";
                    dt           = DBAccess.RunSQLReturnTable(sql);
                    dt.TableName = "TRACK";
                    ds.Tables.Add(dt);
                }

                //for (int i = 0; i < ds.Tables.Count; i++)
                //{
                //    dt = ds.Tables[i];
                //    dt.TableName = dt.TableName.ToUpper();
                //    for (int j = 0; j < dt.Columns.Count; j++)
                //    {
                //        dt.Columns[j].ColumnName = dt.Columns[j].ColumnName.ToUpper();
                //    }
                //}

                string str = BP.Tools.Json.DataSetToJson(ds);
                //  DataType.WriteFile("c:\\GetFlowTrackJsonData_CCflow.txt", str);
                return(str);
            }
            catch (Exception ex)
            {
                return("err@" + ex.Message);
            }
            return(json);
        }
Ejemplo n.º 27
0
 /// <summary>
 /// Returns and activates the last query added.
 /// </summary>
 public QueryObject Pop(MySQLManager MySQLManager)
 {
     QueryObject Obj = new QueryObject();
     Obj.Push(MySQLManager, Querys.Pop());
     return Obj;
 }
Ejemplo n.º 28
0
 private IQueryable <Product> ByNamesDouble(IQueryable <Product> efQuery, QueryObject query)
 {
     return(efQuery.Where(c => c.ProductName.Contains(query.CombinedInputs[0]) ||
                          c.ProductName.Contains(query.CombinedInputs[1])));
 }
Ejemplo n.º 29
0
 public QueryObject<Finance> GetFinances(QueryObject<Finance> query)
 {
     return financeDao.GetFinances(query);
 }
Ejemplo n.º 30
0
 private void BindDataWithPage(string orderNo)
 {
     this.BeginInvoke(new Action(() =>
     {
         QueryObject<FinDetails> query = new QueryObject<FinDetails>();
         query.Page = 1;
         query.PageSize = 1000000;
         query.Condition = new FinDetails();
         query.Condition.OrderNo = orderNo.Trim();
         QueryObject<FinDetails> result = finOrderManager.GetFinDetails(query);
         DoFill(result.Result);
     }));
 }
Ejemplo n.º 31
0
        public QueryObject<FinDetails> GetFinDetails(QueryObject<FinDetails> query)
        {
            string sql = "select DetailId, FinId, FinDate,Description,Amount,OrderNo,ItemType,Association,EventType,Remark, ";
            sql = sql + "Rate, Currency, Amount * Rate TotalAmount FROM FinDetails where 1 = 1 ";
            List<MySqlParameter> QueryParameters = new List<MySqlParameter>();
            if (query.Condition != null)
            {
                if (query.Condition.BeginTime != null)
                {
                    sql = sql + "and FinDate >= @BeginTime ";
                    QueryParameters.Add(new MySqlParameter("@BeginTime", query.Condition.BeginTime));
                }
                if (query.Condition.EndTime != null)
                {
                    sql = sql + "and FinDate <= @EndTime ";
                    QueryParameters.Add(new MySqlParameter("@EndTime", query.Condition.EndTime));
                }
                if (!string.IsNullOrEmpty(query.Condition.Description))
                {
                    sql = sql + "and Description like '%" + query.Condition.Description.Trim() + "%' ";
                }
                if (!string.IsNullOrEmpty(query.Condition.ItemType))
                {
                    sql = sql + "and ItemType = @ItemType ";
                    QueryParameters.Add(new MySqlParameter("@ItemType", query.Condition.ItemType));
                }
                if (!string.IsNullOrEmpty(query.Condition.EventType))
                {
                    sql = sql + "and EventType = @EventType ";
                    QueryParameters.Add(new MySqlParameter("@EventType", query.Condition.EventType));
                }
                if (!string.IsNullOrEmpty(query.Condition.OrderNo))
                {
                    sql = sql + "and OrderNo like '%" + query.Condition.OrderNo.Trim() + "%' ";
                }
                if (!string.IsNullOrEmpty(query.Condition.Association))
                {
                    sql = sql + "and Association like '%" + query.Condition.Association.Trim() + "%' ";
                }
            }
            if (query.IsExport == false)
            {
                query.RecordCount = dbHelper.GetItemCount(sql, QueryParameters.ToArray());
                sql = sql + "order by FinDate asc limit " + query.Start + ", " + query.PageSize;
            }
            else
            {
                sql = sql + " order by FinDate asc";
            }

            query.dt = dbHelper.ExecuteDataTable(sql, QueryParameters.ToArray());
            query.Result = DetailTableToList(query.dt);
            return query;
        }
Ejemplo n.º 32
0
    public void Bind()
    {
        #region 生成标题
        Entity en  = this.HisEn;
        Map    map = this.HisEn.EnMap;
        EnCfg  cfg = new EnCfg(en.ToString());

        UIConfig uicfg = new UIConfig(en);

        Attrs attrs = map.Attrs;
        if (attrs.Count >= 4)
        {
            this.ucsys1.Add("<table border=0 cellpadding='0'  style='border-collapse: collapse;width:100%' cellspacing='0'  >");
        }
        else
        {
            this.ucsys1.Add("<table border=0 cellpadding='0'  style='border-collapse: collapse;width:50%' cellspacing='0'  >");
        }

        this.ucsys1.AddTR();
        CheckBox cb   = new CheckBox();
        string   str1 = "<INPUT id='checkedAll' onclick='SelectAll()' type='checkbox' name='checkedAll'>";
        this.ucsys1.AddTDGroupTitle(str1);
        foreach (Attr attr in attrs)
        {
            if (attr.UIVisible == false)
            {
                continue;
            }
            this.ucsys1.AddTDGroupTitle(attr.Desc);
        }

        if (map.IsHaveFJ)
        {
            this.ucsys1.AddTDGroupTitle("附件");
        }
        this.ucsys1.AddTDGroupTitle();
        this.ucsys1.AddTREnd();
        #endregion 生成标题

        this.Title = en.EnDesc;

        Entities    ens = this.HisEns;
        QueryObject qo  = new QueryObject(ens);

        #region 用户界面属性设置- del
        //BP.Web.Comm.UIRowStyleGlo tableStyle = (UIRowStyleGlo)ens.GetEnsAppCfgByKeyInt("UIRowStyleGlo"); // 界面风格。
        //bool IsEnableDouclickGlo = ens.GetEnsAppCfgByKeyBoolen("IsEnableDouclickGlo"); // 是否启用双击
        //bool IsEnableRefFunc = ens.GetEnsAppCfgByKeyBoolen("IsEnableRefFunc"); // 是否显示相关功能。
        //bool IsEnableFocusField = ens.GetEnsAppCfgByKeyBoolen("IsEnableFocusField"); //是否启用焦点字段。
        //bool isShowOpenICON = ens.GetEnsAppCfgByKeyBoolen("IsEnableOpenICON"); //是否启用 OpenICON 。
        //string FocusField = null;
        //if (IsEnableFocusField)
        //    FocusField = ens.GetEnsAppCfgByKeyString("FocusField");

        //int WinCardH = ens.GetEnsAppCfgByKeyInt("WinCardH"); // 弹出窗口高度
        //int WinCardW = ens.GetEnsAppCfgByKeyInt("WinCardW"); // 弹出窗口宽度.
        #endregion 用户界面属性设置

        #region 生成翻页
        try
        {
            this.ucsys2.Clear();
            this.ucsys2.BindPageIdx(qo.GetCount(), BP.Sys.SystemConfig.PageSize, this.PageIdx, "Ens.aspx?EnsName=" + this.EnsName);
            qo.DoQuery(en.PK, BP.Sys.SystemConfig.PageSize, this.PageIdx, false);
        }
        catch (Exception ex)
        {
            ens.GetNewEntity.CheckPhysicsTable();
            return;
        }
        #endregion 生成翻页

        en.PKVal = "0";
        ens.AddEntity(en);
        DDL  ddl = new DDL();
        bool is1 = false;

        #region 生成数据
        int i = 0;
        foreach (Entity dtl in ens)
        {
            string urlExt = "\"javascript:ShowEn('./RefFunc/UIEn.aspx?EnsName=" + ens.ToString() + "&PK=" + dtl.PKVal + "', 'cd');\"";
            i++;
            if (dtl.PKVal == "0")
            {
                this.ucsys1.AddTRSum();
                this.ucsys1.AddTDIdx("<b>*</b>");
            }
            else
            {
                is1     = this.ucsys1.AddTR(is1, "ondblclick=" + urlExt);
                cb      = new CheckBox();
                cb.ID   = "IDX_" + dtl.PKVal;
                cb.Text = i.ToString();
                this.ucsys1.AddTDIdx(cb);
            }
            foreach (Attr attr in attrs)
            {
                if (attr.UIVisible == false)
                {
                    continue;
                }

                if (attr.Key == "OID")
                {
                    continue;
                }

                string val = dtl.GetValByKey(attr.Key).ToString();
                switch (attr.UIContralType)
                {
                case UIContralType.TB:
                    TB tb = new TB();
                    tb.LoadMapAttr(attr);
                    this.ucsys1.AddTD(tb);
                    tb.ID = "TB_" + attr.Key + "_" + dtl.PKVal;
                    switch (attr.MyDataType)
                    {
                    case DataType.AppMoney:
                    case DataType.AppRate:
                        tb.TextExtMoney = decimal.Parse(val);
                        break;

                    default:
                        tb.Text = val;
                        break;
                    }

                    if (attr.IsNum && attr.IsFKorEnum == false)
                    {
                        if (tb.Enabled)
                        {
                            // OnKeyPress="javascript:return VirtyNum(this);"
                            //  tb.Attributes["OnKeyDown"] = "javascript:return VirtyNum(this);";
                            // tb.Attributes["onkeyup"] += "javascript:C" + dtl.PKVal + "();C" + attr.Key + "();";
                            tb.Attributes["class"] = "TBNum";
                        }
                        else
                        {
                            //   tb.Attributes["onpropertychange"] += "C" + attr.Key + "();";
                            tb.Attributes["class"] = "TBNumReadonly";
                        }
                    }
                    break;

                case UIContralType.DDL:
                    if (attr.UIIsReadonly)
                    {
                        ddl = new DDL();
                        ddl.LoadMapAttr(attr);
                        ddl.ID = "DDL_" + attr.Key + "_" + dtl.PKVal;
                        //  this.ucsys1.AddTD(ddl);
                        this.ucsys1.AddTD(ddl);
                        ddl.SetSelectItem(val);
                    }
                    else
                    {
                        this.ucsys1.AddTD(dtl.GetValRefTextByKey(attr.Key));
                    }
                    break;

                case UIContralType.CheckBok:
                    cb    = new CheckBox();
                    cb.ID = "CB_" + attr.Key + "_" + dtl.PKVal;
                    //cb.Text = attr.Name;
                    if (val == "1")
                    {
                        cb.Checked = true;
                    }
                    else
                    {
                        cb.Checked = false;
                    }
                    this.ucsys1.AddTDCenter(cb);
                    break;

                default:
                    break;
                }
            }
            if (map.IsHaveFJ)
            {
                string ext = dtl.GetValStrByKey("MyFileExt");
                if (ext == null || ext.Length > 1)
                {
                    this.ucsys1.AddTD("<a href='" + cfg.FJWebPath + "/" + dtl.PKVal + "." + ext + "' target=_blank ><img src='../Images/FileType/" + dtl.GetValStrByKey("MyFileExt") + ".gif' border=0/>" + dtl.GetValStrByKey("MyFileName") + "</a>");
                }
                else
                {
                    this.ucsys1.AddTD();
                }
            }
            if (uicfg.IsEnableOpenICON)
            {
                this.ucsys1.Add("<TD class='TD' style='cursor:hand;' nowrap=true><a href=" + urlExt + " ><img src='../Img/Btn/Open.gif' border=0/></a></TD>");
            }
            else
            {
                this.ucsys1.AddTD();
            }
            this.ucsys1.AddTREnd();
        }

        #region 生成合计
        if (false)
        {
            this.ucsys1.AddTRSum();
            this.ucsys1.AddTD("colspan=1", "合计");
            foreach (Attr attr in attrs)
            {
                if (attr.UIVisible == false)
                {
                    continue;
                }

                if (attr.IsNum && attr.IsFKorEnum == false)
                {
                    TB tb = new TB();
                    tb.ID        = "TB_" + attr.Key;
                    tb.Text      = attr.DefaultVal.ToString();
                    tb.ShowType  = attr.HisTBType;
                    tb.ReadOnly  = true;
                    tb.Font.Bold = true;
                    tb.BackColor = System.Drawing.Color.FromName("#FFFFFF");

                    switch (attr.MyDataType)
                    {
                    case DataType.AppRate:
                    case DataType.AppMoney:
                        tb.TextExtMoney = ens.GetSumDecimalByKey(attr.Key);
                        break;

                    case DataType.AppInt:
                        tb.TextExtInt = ens.GetSumIntByKey(attr.Key);
                        break;

                    case DataType.AppFloat:
                        tb.TextExtFloat = ens.GetSumFloatByKey(attr.Key);
                        break;

                    default:
                        break;
                    }
                    this.ucsys1.AddTD(tb);
                }
                else
                {
                    this.ucsys1.AddTD();
                }
            }

            if (map.IsHaveFJ)
            {
                this.ucsys1.AddTD();
            }

            this.ucsys1.AddTD();
            this.ucsys1.AddTREnd();
        }
        #endregion 生成合计

        #endregion 生成数据

        this.ucsys1.AddTableEnd();
    }
Ejemplo n.º 33
0
 private IQueryable <Product> ByColorsTriple(IQueryable <Product> efQuery, QueryObject query)
 {
     return(efQuery.Where(c => c.Color.ColorName.Contains(query.CombinedInputs[0]) ||
                          c.Color.ColorName.Contains(query.CombinedInputs[1]) ||
                          c.Color.ColorName.Contains(query.CombinedInputs[2])));
 }
Ejemplo n.º 34
0
        public void BindSFTable(SFTable en)
        {
            bool   isItem = false;
            string star   = "<font color=red><b>(*)</b></font>";

            this.Ucsys1.AddTable();

            #region 生成标题.
            if (this.FromApp == "SL")
            {
                if (this.RefNo == null)
                {
                    this.Ucsys1.AddCaption("新建WebService数据源接口");
                }
                else
                {
                    this.Ucsys1.AddCaption("编辑WebService数据源接口");
                }
            }
            else
            {
                this.Ucsys1.AddCaption("<a href='Do.aspx?DoType=AddF&MyPK=" + this.MyPK + "&IDX=" + this.IDX + "'><img src='/WF/Img/Btn/Back.gif'>返回</a> - <a href='Do.aspx?DoType=AddSFWS&MyPK=" + this.MyPK + "&IDX=" + this.IDX + "'>WebService数据源接口</a> - 新建WebService数据源接口");
            }

            if (this.RefNo == null)
            {
                this.Title = "新建WebService数据源接口";
            }
            else
            {
                this.Title = "编辑WebService数据源接口";
            }

            #endregion 生成标题.

            int idx = 0;
            this.Ucsys1.AddTR();
            this.Ucsys1.AddTDTitle("Idx");
            this.Ucsys1.AddTDTitle("项目");
            this.Ucsys1.AddTDTitle("采集");
            this.Ucsys1.AddTDTitle("备注");
            this.Ucsys1.AddTREnd();

            isItem = this.Ucsys1.AddTR(isItem);
            this.Ucsys1.AddTDIdx(idx++);
            this.Ucsys1.AddTD("接口英文名称" + star);
            var tb = new BP.Web.Controls.TB();
            tb.ID   = "TB_" + SFTableAttr.No;
            tb.Text = en.No;
            if (this.RefNo == null)
            {
                tb.Enabled = true;
            }
            else
            {
                tb.Enabled = false;
            }

            if (tb.Text == "")
            {
                tb.Text = "SF_";
            }

            this.Ucsys1.AddTD(tb);
            this.Ucsys1.AddTDBigDoc("必须以字母或者下划线开头,不能包含特殊字符。");
            this.Ucsys1.AddTREnd();

            isItem = this.Ucsys1.AddTR(isItem);
            this.Ucsys1.AddTDIdx(idx++);
            this.Ucsys1.AddTD("接口中文名称" + star);
            tb      = new BP.Web.Controls.TB();
            tb.ID   = "TB_" + SFTableAttr.Name;
            tb.Text = en.Name;
            this.Ucsys1.AddTD(tb);
            this.Ucsys1.AddTD("WebService中的接口方法的中文名称。");
            this.Ucsys1.AddTREnd();

            isItem = this.Ucsys1.AddTR(isItem);
            this.Ucsys1.AddTDIdx(idx++);
            this.Ucsys1.AddTD("数据源" + star);
            BP.Web.Controls.DDL ddl  = new BP.Web.Controls.DDL();
            SFDBSrcs            srcs = new SFDBSrcs();
            BP.En.QueryObject   qo   = new QueryObject(srcs);
            qo.AddWhere(SFDBSrcAttr.DBSrcType, " = ", "100");
            qo.DoQuery();
            ddl.Bind(srcs, en.FK_SFDBSrc);
            ddl.ID                    = "DDL_" + SFTableAttr.FK_SFDBSrc;
            ddl.AutoPostBack          = true;
            ddl.SelectedIndexChanged += new EventHandler(ddl_SelectedIndexChanged);
            this.Ucsys1.AddTD(ddl);
            this.Ucsys1.AddTD("选择数据源,点击这里<a href=\"javascript:WinOpen('/WF/Comm/Search.aspx?EnsName=BP.Sys.SFDBSrcs')\">创建</a>,<a href='SFWS.aspx?DoType=New&MyPK=" + this.MyPK + "&Idx='>刷新</a>。");
            this.Ucsys1.AddTREnd();

            var rt = en.TableDesc.Split(',');

            isItem = this.Ucsys1.AddTR(isItem);
            this.Ucsys1.AddTDIdx(idx++);
            this.Ucsys1.AddTD("选择接口" + star);
            ddl    = new BP.Web.Controls.DDL();
            ddl.ID = "DDL_" + SFTableAttr.TableDesc;

            if (srcs.Count > 0)
            {
                var ms = GetWebServiceMethods(!string.IsNullOrWhiteSpace(en.FK_SFDBSrc) ? (SFDBSrc)srcs.GetEntityByKey(SFDBSrcAttr.No, en.FK_SFDBSrc) : (SFDBSrc)srcs[0]);

                foreach (var m in ms)
                {
                    ddl.Items.Add(new ListItem(m.Value, m.Key));
                }

                ddl.SetSelectItem(rt.Length == 2 ? rt[0] : ms.Count > 0 ? ms.First().Key : string.Empty);
            }

            this.Ucsys1.AddTD(ddl);
            this.Ucsys1.AddTDBigDoc("选择WebService中的接口方法名。");
            this.Ucsys1.AddTREnd();

            isItem = this.Ucsys1.AddTR(isItem);
            this.Ucsys1.AddTDIdx(idx++);
            this.Ucsys1.AddTD("colspan=3", "接口参数定义" + star + "支持ccform表达式,允许有@WebUser.No,@WebUser.Name,@WebUser.FK_Dept变量。");
            this.Ucsys1.AddTREnd();

            isItem = this.Ucsys1.AddTR(isItem);
            this.Ucsys1.AddTDIdx(idx++);
            tb          = new BP.Web.Controls.TB();
            tb.ID       = "TB_" + SFTableAttr.SelectStatement;
            tb.Text     = en.SelectStatement;
            tb.TextMode = TextBoxMode.MultiLine;
            tb.Rows     = 3;
            tb.Columns  = 70;
            this.Ucsys1.AddTD("colspan=3", tb);
            this.Ucsys1.AddTREnd();

            isItem = this.Ucsys1.AddTR(isItem);
            this.Ucsys1.AddTDIdx(idx++);
            this.Ucsys1.AddTD("colspan=3", "如:WorkId=@WorkID&FK_Flow=@FK_Flow&FK_Node=@FK_Node&SearchType=1,带@的参数值在运行时自动使用发起流程的相关参数值替换,而不带@的参数值使用后面的赋值;参数个数与WebServices接口方法的参数个数一致,且顺序一致,且值均为字符类型。");
            this.Ucsys1.AddTREnd();

            isItem = this.Ucsys1.AddTR(isItem);
            this.Ucsys1.AddTDIdx(idx++);
            this.Ucsys1.AddTD("返回值类型" + star);
            ddl    = new BP.Web.Controls.DDL();
            ddl.ID = "DDL_ResultType";

            ddl.Items.Add(new ListItem("DataTable数据表", "DataTable"));
            ddl.Items.Add(new ListItem("DataSet数据集", "DataSet"));
            ddl.Items.Add(new ListItem("Json字符串", "Json"));
            ddl.Items.Add(new ListItem("Xml字符串", "Xml"));

            if (rt.Length == 2)
            {
                ddl.SetSelectItem(rt[1]);
            }

            this.Ucsys1.AddTDBegin();
            this.Ucsys1.Add(ddl);
            this.Ucsys1.AddBR();
            this.Ucsys1.Add("注意:所有返回值类型都需有No,Name这两列。" +
                            "<script type='text/javascript'>" +
                            "   var info = '1. DataTable数据表,必须为DataTable命名。\\n" +
                            "2. DataSet数据集,只取数据集里面的第1个DataTable。\\n" +
                            "3. Json字符串,格式如:\\n" +
                            "[\\n" +
                            "  {\"No\":\"001\",\"Name\":\"生产部\"},\\n" +
                            "  {\"No\":\"002\",\"Name\":\"研发部\"},\\n" +
                            "  ...\\n" +
                            "]\\n" +
                            "4. Xml字符串,格式如:\\n" +
                            "<?xml version=\"1.0\" encoding=\"utf-8\" ?>\\n" +
                            "<Array>\\n" +
                            "  <Item>\\n" +
                            "    <No>001</No>\\n" +
                            "    <Name>生产部</Name>\\n" +
                            "  </Item>\\n" +
                            "  <Item>\\n" +
                            "    <No>002</No>\\n" +
                            "    <Name>研发部</Name>\\n" +
                            "  </Item>\\n" +
                            "  ...\\n" +
                            "</Array>';" +
                            "</script>" +
                            "<a href='javascript:void(0)' onclick='alert(info)'>格式说明</a>");
            this.Ucsys1.AddTDEnd();
            this.Ucsys1.AddTDBigDoc("选择WebService中的接口方法返回值的类型。");
            this.Ucsys1.AddTREnd();

            isItem = this.Ucsys1.AddTR(isItem);
            this.Ucsys1.AddTDIdx(idx++);
            this.Ucsys1.AddTD("返回数据结构");
            ddl    = new BP.Web.Controls.DDL();
            ddl.ID = "DDL_" + SFTableAttr.CodeStruct;
            ddl.BindSysEnum(SFTableAttr.CodeStruct, (int)en.CodeStruct);
            this.Ucsys1.AddTD(ddl);
            this.Ucsys1.AddTD("WebService接口返回的数据结构,用于在下拉框中不同格式的展现。");
            this.Ucsys1.AddTREnd();

            isItem = this.Ucsys1.AddTR(isItem);
            this.Ucsys1.AddTDIdx(idx++);
            this.Ucsys1.Add("<TD colspan=3 align=center>");
            Button btn = new Button();
            btn.ID       = "Btn_Save";
            btn.CssClass = "Btn";
            if (this.RefNo == null)
            {
                btn.Text = "创建";
            }
            else
            {
                btn.Text = "保存";
            }
            btn.Click += new EventHandler(btn_Save_Click);
            this.Ucsys1.Add(btn);

            if (this.FromApp != "SL")
            {
                btn          = new Button();
                btn.ID       = "Btn_Add";
                btn.CssClass = "Btn";
                btn.Text     = "添加到表单";; // "添加到表单";
                btn.Attributes["onclick"] = " return confirm('您确认吗?');";
                btn.Click += new EventHandler(btn_Add_Click);
                if (this.RefNo == null)
                {
                    btn.Enabled = false;
                }
                this.Ucsys1.Add(btn);
            }

            btn          = new Button();
            btn.ID       = "Btn_Del";
            btn.CssClass = "Btn";
            btn.Text     = "删除";
            btn.Attributes["onclick"] = " return confirm('您确认吗?');";
            if (this.RefNo == null)
            {
                btn.Enabled = false;
            }

            btn.Click += new EventHandler(btn_Del_Click);
            this.Ucsys1.Add(btn);
            this.Ucsys1.Add("</TD>");
            this.Ucsys1.AddTREnd();
            this.Ucsys1.AddTableEnd();
        }
Ejemplo n.º 35
0
        public async Task <QueryResult <ProjectResponse> > GetProjects([FromQuery] QueryObject query)
        {
            var result = await _projectRepository.Filter(query);

            return(_mapper.Map <QueryResult <Project>, QueryResult <ProjectResponse> >(result));
        }
        private void RunTotals(List <long> listUserNums, List <long> listClinicsNums)
        {
            ReportComplex report = new ReportComplex(true, false);

            report.AddTitle("Title", Lan.g(this, "Presented Treatment Production"));
            report.AddSubTitle("SubTitle", "Totals Report");
            report.AddSubTitle("PracTitle", PrefC.GetString(PrefName.PracticeTitle));
            report.AddSubTitle("Date", date1.SelectionStart.ToShortDateString() + " - " + date2.SelectionStart.ToShortDateString());
            if (checkAllUsers.Checked)
            {
                report.AddSubTitle("Users", Lan.g(this, "All Users"));
            }
            else
            {
                string strUsers = "";
                for (int i = 0; i < listUser.SelectedIndices.Count; i++)
                {
                    if (i == 0)
                    {
                        strUsers = _listUsers[listUser.SelectedIndices[i]].UserName;
                    }
                    else
                    {
                        strUsers += ", " + _listUsers[listUser.SelectedIndices[i]].UserName;
                    }
                }
                report.AddSubTitle("Users", strUsers);
            }
            if (PrefC.HasClinicsEnabled)
            {
                if (checkAllClinics.Checked)
                {
                    report.AddSubTitle("Clinics", Lan.g(this, "All Clinics"));
                }
                else
                {
                    string clinNames = "";
                    for (int i = 0; i < listClin.SelectedIndices.Count; i++)
                    {
                        if (i > 0)
                        {
                            clinNames += ", ";
                        }
                        if (Security.CurUser.ClinicIsRestricted)
                        {
                            clinNames += _listClinics[listClin.SelectedIndices[i]].Abbr;
                        }
                        else
                        {
                            if (listClin.SelectedIndices[i] == 0)
                            {
                                clinNames += Lan.g(this, "Unassigned");
                            }
                            else
                            {
                                clinNames += _listClinics[listClin.SelectedIndices[i] - 1].Abbr;                            //Minus 1 from the selected index
                            }
                        }
                    }
                    report.AddSubTitle("Clinics", clinNames);
                }
            }
            DataTable table = RpPresentedTreatmentProduction.GetPresentedTreatmentProductionTable(date1.SelectionStart, date2.SelectionStart, listClinicsNums, checkAllClinics.Checked
                                                                                                  , PrefC.HasClinicsEnabled, radioPresenter.Checked, radioFirstPresented.Checked, listUserNums, false);
            QueryObject query = report.AddQuery(table, "", "", SplitByKind.None, 1, true);

            query.AddColumn(Lan.g(this, "Presenter"), 100, FieldValueType.String);
            query.AddColumn(Lan.g(this, "# of Procs"), 70, FieldValueType.Integer);
            query.AddColumn(Lan.g(this, "GrossProd"), 100, FieldValueType.Number);
            query.AddColumn(Lan.g(this, "WriteOffs"), 100, FieldValueType.Number);
            query.AddColumn(Lan.g(this, "Adjustments"), 100, FieldValueType.Number);
            query.AddColumn(Lan.g(this, "NetProduction"), 100, FieldValueType.Number);
            if (!report.SubmitQueries())
            {
                DialogResult = DialogResult.Cancel;
                return;
            }
            FormReportComplex FormR = new FormReportComplex(report);

            FormR.ShowDialog();
            DialogResult = DialogResult.OK;
        }
Ejemplo n.º 37
0
    public void Save()
    {
        string      msg  = null;
        Entities    dtls = BP.En.ClassFactory.GetEns(this.EnsName);
        Entity      en   = dtls.GetNewEntity;
        QueryObject qo   = new QueryObject(dtls);

        qo.DoQuery(en.PK, BP.Sys.SystemConfig.PageSize, this.PageIdx, false);
        Map map = dtls.GetNewEntity.EnMap;

        foreach (Entity dtl in dtls)
        {
            this.ucsys1.Copy(dtl, dtl.PKVal.ToString(), map);
            try
            {
                dtl.Update();
            }
            catch (Exception ex)
            {
                msg += "<hr>" + ex.Message;
            }
        }

        // BP.Sys.MapDtl
        en = this.ucsys1.Copy(en, "0", map);
        if (en.IsBlank == false)
        {
            if (en.IsNoEntity)
            {
                if (en.EnMap.IsAutoGenerNo)
                {
                    en.SetValByKey("No", en.GenerNewNoByKey("No"));
                }
            }

            try
            {
                if (en.PKVal.ToString() == "0")
                {
                }
                else
                {
                    en.Insert();
                }
            }
            catch (Exception ex)
            {
                //msg += "<hr>" + ex.Message;
            }
        }

        if (msg != null)
        {
            this.Session["info1"] = msg;
            //this.ResponseWriteRedMsg(msg);
            this.Response.Redirect("Ens.aspx?EnsName=" + this.EnsName + "&PageIdx=" + this.PageIdx, true);
        }
        else
        {
            this.Response.Redirect("Ens.aspx?EnsName=" + this.EnsName + "&PageIdx=" + this.PageIdx, true);
        }
    }
Ejemplo n.º 38
0
        protected void Page_Load(object sender, EventArgs e)
        {
            Flow        fl  = new Flow(this.FK_Flow);
            Node        nd  = new Node(int.Parse(this.FK_Flow + "01"));
            Works       wks = nd.HisWorks;
            QueryObject qo  = new QueryObject(wks);

            qo.AddWhere(WorkAttr.FID, this.FID);
            qo.DoQuery();

            Flow   from     = new Flow(this.FK_FlowFrom);
            string currNode = BP.DA.DBAccess.RunSQLReturnVal("SELECT FK_Node FROM WF_GenerWorkFlow WHERE WorkID=" + this.FID) as string;

            if (wks.Count == 0)
            {
                this.Response.Redirect("MyFlow" + Glo.FromPageType + ".aspx?FK_Flow=" + this.FK_Flow + "&FID=" + this.FID + "&FromNode=" + this.Request.QueryString["FromNode"]);
                return;
            }


            //this.Pub2.BindPageIdx(qo.GetCount(), 10, this.PageIdx, "CallSubFlow.aspx?FK_Flow=" + this.FK_Flow + "&FID=" + this.FID + "&FK_FlowFrom=" + this.FK_FlowFrom);
            //qo.DoQuery("OID", 10, this.PageIdx);

            // 生成页面数据。
            Attrs attrs   = nd.HisWork.EnMap.Attrs;
            int   colspan = 2;

            foreach (Attr attr in attrs)
            {
                if (attr.UIVisible == false)
                {
                    continue;
                }
                colspan++;
            }
            this.Pub1.AddTable("width='100%' align=center");
            this.Pub1.AddTR();
            this.Pub1.Add("<TD class=TitleTop colspan=" + colspan + "></TD>");
            this.Pub1.AddTREnd();

            this.Pub1.AddTR();
            this.Pub1.Add("<TD class=TitleMsg  align=left colspan=" + colspan + "><img src='/WF/Img/EmpWorks.gif' > <b>您的位置:<a href='MyFlow.aspx?FK_Flow=" + this.FK_Flow + "&WorkID=" + this.FID + "' >流程处理:" + from.Name + "</a> => <a href='MyFlow.aspx?FK_Flow=" + this.FK_Flow + "&FID=" + this.FID + "&FromNode=" + currNode + "'>流程发起</a></b> - <a href=\"javascript:WinOpen('/WF/Comm/PanelEns.aspx?EnsName=ND" + int.Parse(this.FK_Flow) + "Rpt');\" >流程查询</a></TD>");
            this.Pub1.AddTREnd();

            this.Pub1.AddTR();
            this.Pub1.AddTDTitle("序");
            foreach (Attr attr in attrs)
            {
                if (attr.UIVisible == false)
                {
                    continue;
                }

                this.Pub1.AddTDTitle(attr.Desc);
            }
            this.Pub1.AddTDTitle("操作");
            this.Pub1.AddTREnd();

            int  idx = 0;
            bool is1 = false;

            foreach (Entity en in wks)
            {
                idx++;
                is1 = this.Pub1.AddTR(is1);
                this.Pub1.AddTD(idx);
                foreach (Attr attr in attrs)
                {
                    if (attr.UIVisible == false)
                    {
                        continue;
                    }

                    switch (attr.MyDataType)
                    {
                    case DataType.AppBoolean:
                        this.Pub1.AddTD(en.GetValBoolStrByKey(attr.Key));
                        break;

                    case DataType.AppFloat:
                    case DataType.AppInt:
                    case DataType.AppDouble:
                        this.Pub1.AddTD(en.GetValFloatByKey(attr.Key));
                        break;

                    case DataType.AppMoney:
                        this.Pub1.AddTDMoney(en.GetValDecimalByKey(attr.Key));
                        break;

                    default:
                        this.Pub1.AddTD(en.GetValStrByKey(attr.Key));
                        break;
                    }
                }
                this.Pub1.AddTD("<a href=\"WFRpt.aspx?WorkID=" + en.GetValIntByKey("OID") + "&FID=" + en.GetValByKey("FID") + "&FK_Flow=" + nd.FK_Flow + "\" target=bk >报告</a>-<a href=\"Chart.aspx?WorkID=" + en.GetValIntByKey("OID") + "&FID=" + en.GetValByKey("FID") + "&FK_Flow=" + nd.FK_Flow + "\" target=bk >轨迹</a>");
                this.Pub1.AddTREnd();
            }

            this.Pub1.AddTRSum();
            this.Pub1.AddTD("");
            foreach (Attr attr in attrs)
            {
                if (attr.UIVisible == false)
                {
                    continue;
                }

                switch (attr.MyDataType)
                {
                case DataType.AppFloat:
                case DataType.AppInt:
                case DataType.AppDouble:
                    this.Pub1.AddTDB(wks.GetSumDecimalByKey(attr.Key).ToString());
                    break;

                case DataType.AppMoney:
                    this.Pub1.AddTDB(wks.GetSumDecimalByKey(attr.Key).ToString("0.00"));
                    break;

                default:
                    this.Pub1.AddTD();
                    break;
                }
            }
            this.Pub1.AddTD();
            this.Pub1.AddTREnd();
            this.Pub1.AddTableEnd();
        }
 public static int Execute(this ISession session, QueryObject queryObject, SqlExecutionOptions executionOptions)
 {
     return(session.Execute(queryObject.Sql, queryObject.QueryParams, executionOptions.CommandTimeoutSeconds));
 }
Ejemplo n.º 40
0
        private void butOK_Click(object sender, System.EventArgs e)
        {
            if (!checkBillTypesAll.Checked && listBillType.SelectedIndices.Count == 0)
            {
                MsgBox.Show(this, "At least one billing type must be selected.");
                return;
            }
            if (!checkProvAll.Checked && listProv.SelectedIndices.Count == 0)
            {
                MsgBox.Show(this, "At least one provider must be selected.");
                return;
            }
            if (PrefC.HasClinicsEnabled && !checkAllClin.Checked && listClin.SelectedIndices.Count == 0)
            {
                MsgBox.Show(this, "At least one clinic must be selected.");
                return;
            }
            if (textDate.errorProvider1.GetError(textDate) != "")
            {
                MsgBox.Show(this, "Invalid date.");
                return;
            }
            RpAgingParamObject rpo        = GetParamsFromForm();
            ReportComplex      report     = new ReportComplex(true, true);
            DataTable          tableAging = new DataTable();

            tableAging        = RpInsAging.GetInsAgingTable(rpo);
            report.ReportName = Lan.g(this, "Insurance Aging Report");
            report.AddTitle("InsAging", Lan.g(this, "Insurance Aging Report"));
            report.AddSubTitle("PracTitle", PrefC.GetString(PrefName.PracticeTitle));
            report.AddSubTitle("AsOf", Lan.g(this, "As of") + " " + rpo.AsOfDate.ToShortDateString());
            if (radioAny.Checked)
            {
                report.AddSubTitle("Balance", Lan.g(this, "Any Balance"));
            }
            else if (radio30.Checked)
            {
                report.AddSubTitle("Over30", Lan.g(this, "Over 30 Days"));
            }
            else if (radio60.Checked)
            {
                report.AddSubTitle("Over60", Lan.g(this, "Over 60 Days"));
            }
            else if (radio90.Checked)
            {
                report.AddSubTitle("Over90", Lan.g(this, "Over 90 Days"));
            }
            if (checkBillTypesAll.Checked)
            {
                report.AddSubTitle("AllBillingTypes", Lan.g(this, "All Billing Types"));
            }
            else
            {
                report.AddSubTitle("", string.Join(", ", listBillType.SelectedIndices.OfType <int>().Select(x => _listBillingTypeDefs[x].ItemName)));             //there must be at least one selected
            }
            if (checkProvAll.Checked)
            {
                report.AddSubTitle("Providers", Lan.g(this, "All Providers"));
            }
            else
            {
                report.AddSubTitle("Providers", string.Join(", ", listProv.SelectedIndices.OfType <int>().Select(x => _listProviders[x].Abbr)));
            }
            if (checkAllClin.Checked)
            {
                report.AddSubTitle("Clinics", Lan.g(this, "All Clinics"));
            }
            else
            {
                report.AddSubTitle("Clinics", string.Join(", ", listClin.SelectedTags <Clinic>().Select(x => x.Abbr)));
            }
            //Patient Account Aging Query-----------------------------------------------
            QueryObject query = report.AddQuery(tableAging, "Date " + DateTime.Today.ToShortDateString());

            query.AddColumn((radioGroupByFam.Checked?"Guarantor":"Patient"), 160, FieldValueType.String);
            query.AddColumn("Ins Pay\r\nEst 0-30", 75, FieldValueType.Number);
            query.AddColumn("Ins Pay\r\nEst 31-60", 75, FieldValueType.Number);
            query.AddColumn("Ins Pay\r\nEst 61-90", 75, FieldValueType.Number);
            query.AddColumn("Ins Pay\r\nEst >90", 75, FieldValueType.Number);
            query.AddColumn("Ins Pay\r\nEst Total", 80, FieldValueType.Number);
            query.AddColumn("Pat Est\r\nBal 0-30", 75, FieldValueType.Number);
            query.AddColumn("Pat Est\r\nBal 31-60", 75, FieldValueType.Number);
            query.AddColumn("Pat Est\r\nBal 61-90", 75, FieldValueType.Number);
            query.AddColumn("Pat Est\r\nBal >90", 75, FieldValueType.Number);
            query.AddColumn("Pat Est\r\nBal Total", 80, FieldValueType.Number);
            query.AddColumn("-W/O\r\nChange", 75, FieldValueType.Number);
            query.AddColumn("=Pat Est\r\nAmt Due", 80, FieldValueType.Number);
            report.AddPageNum();
            if (!report.SubmitQueries())
            {
                return;
            }
            FormReportComplex FormR = new FormReportComplex(report);

            FormR.ShowDialog();
            DialogResult = DialogResult.OK;
        }
Ejemplo n.º 41
0
 public QueryObject<PriceCate> GetPriceCates(QueryObject<PriceCate> query)
 {
     return productDao.GetPriceCates(query);
 }
        private void RunReport(List <long> listUserNums, List <long> listClinicsNums)
        {
            ReportComplex report = new ReportComplex(true, false);

            report.AddTitle("Title", Lan.g(this, "Presented Procedure Totals"));
            report.AddSubTitle("PracTitle", PrefC.GetString(PrefName.PracticeTitle));
            report.AddSubTitle("Date", date1.SelectionStart.ToShortDateString() + " - " + date2.SelectionStart.ToShortDateString());
            List <Userod> listSelectedUsers = new List <Userod>();

            if (checkAllUsers.Checked)
            {
                report.AddSubTitle("Users", Lan.g(this, "All Users"));
                listSelectedUsers.AddRange(_listUsers);                 //add all users
            }
            else
            {
                for (int i = 0; i < listUser.SelectedIndices.Count; i++)
                {
                    listSelectedUsers.Add(_listUsers[listUser.SelectedIndices[i]]);                     //add selected users
                }
                report.AddSubTitle("Users", string.Join(",", listSelectedUsers.Select(x => x.UserName)));
            }
            List <Clinic> listSelectedClinics = new List <Clinic>();

            if (PrefC.HasClinicsEnabled)
            {
                if (checkAllClinics.Checked)
                {
                    report.AddSubTitle("Clinics", Lan.g(this, "All Clinics"));
                    listSelectedClinics.Add(new Clinic()
                    {
                        ClinicNum   = 0,
                        Description = "Unassigned"
                    });
                    listSelectedClinics.AddRange(_listClinics);                     //add all clinics and the unassigned clinic.
                }
                else
                {
                    for (int i = 0; i < listClin.SelectedIndices.Count; i++)
                    {
                        if (Security.CurUser.ClinicIsRestricted)
                        {
                            listSelectedClinics.Add(_listClinics[listClin.SelectedIndices[i]]);
                        }
                        else
                        {
                            if (listClin.SelectedIndices[i] == 0)
                            {
                                listSelectedClinics.Add(new Clinic()
                                {
                                    ClinicNum   = 0,
                                    Description = "Unassigned"
                                });
                            }
                            else
                            {
                                listSelectedClinics.Add(_listClinics[listClin.SelectedIndices[i] - 1]);                              //Minus 1 from the selected index
                            }
                        }
                    }
                    report.AddSubTitle("Clinics", string.Join(",", listSelectedClinics.Select(x => x.Description)));
                }
            }
            List <long> clinicNums = listSelectedClinics.Select(y => y.ClinicNum).ToList();
            List <long> userNums   = listSelectedUsers.Select(y => y.UserNum).ToList();
            DataTable   table      = RpTreatPlanPresentationStatistics.GetTreatPlanPresentationStatistics(date1.SelectionStart, date2.SelectionStart, radioFirstPresented.Checked
                                                                                                          , checkAllClinics.Checked, PrefC.HasClinicsEnabled, radioPresenter.Checked, radioGross.Checked, checkAllUsers.Checked, userNums, clinicNums);
            QueryObject query = report.AddQuery(table, "", "", SplitByKind.None, 1, true);

            query.AddColumn(Lan.g(this, "Presenter"), 100, FieldValueType.String);
            query.AddColumn(Lan.g(this, "# of Plans"), 85, FieldValueType.Integer);
            query.AddColumn(Lan.g(this, "# of Procs"), 85, FieldValueType.Integer);
            query.AddColumn(Lan.g(this, "# of ProcsSched"), 100, FieldValueType.Integer);
            query.AddColumn(Lan.g(this, "# of ProcsComp"), 100, FieldValueType.Integer);
            if (radioGross.Checked)
            {
                query.AddColumn(Lan.g(this, "GrossTPAmt"), 95, FieldValueType.Number);
                query.AddColumn(Lan.g(this, "GrossSchedAmt"), 95, FieldValueType.Number);
                query.AddColumn(Lan.g(this, "GrossCompAmt"), 95, FieldValueType.Number);
            }
            else
            {
                query.AddColumn(Lan.g(this, "NetTPAmt"), 95, FieldValueType.Number);
                query.AddColumn(Lan.g(this, "NetSchedAmt"), 95, FieldValueType.Number);
                query.AddColumn(Lan.g(this, "NetCompAmt"), 95, FieldValueType.Number);
            }
            if (!report.SubmitQueries())
            {
                DialogResult = DialogResult.Cancel;
                return;
            }
            FormReportComplex FormR = new FormReportComplex(report);

            FormR.ShowDialog();
            //DialogResult=DialogResult.OK;
        }
Ejemplo n.º 43
0
        public QueryObject InitQueryObjectByEns(Entities ens, bool IsShowSearchKey, DTSearchWay dw, string dtKey, Attrs attrs, AttrsOfSearch attrsOfSearch, AttrSearchs searchAttrs)
        {
            QueryObject qo = new QueryObject(ens);

            #region 关键字
            string keyVal = "";
            //Attrs attrs = en.EnMap.Attrs;
            if (IsShowSearchKey)
            {
                keyVal = this.GetTBByID("TB_Key").Text.Trim();
                this.Page.Session["SKey"] = keyVal;
            }

            if (keyVal.Length >= 1)
            {
                Attr attrPK = new Attr();
                foreach (Attr attr in attrs)
                {
                    if (attr.IsPK)
                    {
                        attrPK = attr;
                        break;
                    }
                }
                int i = 0;
                foreach (Attr attr in attrs)
                {
                    switch (attr.MyFieldType)
                    {
                    case FieldType.Enum:
                    case FieldType.FK:
                    case FieldType.PKFK:
                        continue;

                    default:
                        break;
                    }


                    if (attr.MyDataType != DataType.AppString)
                    {
                        continue;
                    }

                    if (attr.MyFieldType == FieldType.RefText)
                    {
                        continue;
                    }

                    if (attr.Key == "FK_Dept")
                    {
                        continue;
                    }

                    //added by liuxc,2015-8-7,增加判断是否是MySql数据库,MySql数据库的字符串连接用CONCAT('','','')函数

                    i++;
                    if (i == 1)
                    {
                        /* 第一次进来。 */
                        qo.addLeftBracket();
                        if (SystemConfig.AppCenterDBVarStr == "@")
                        {
                            qo.AddWhere(attr.Key, " LIKE ", SystemConfig.AppCenterDBType == DBType.MySQL ? (" CONCAT('%'," + SystemConfig.AppCenterDBVarStr + "SKey,'%')") : (" '%'+" + SystemConfig.AppCenterDBVarStr + "SKey+'%'"));
                        }
                        else
                        {
                            qo.AddWhere(attr.Key, " LIKE ", " '%'||" + SystemConfig.AppCenterDBVarStr + "SKey||'%'");
                        }
                        continue;
                    }
                    qo.addOr();

                    if (SystemConfig.AppCenterDBVarStr == "@")
                    {
                        qo.AddWhere(attr.Key, " LIKE ", SystemConfig.AppCenterDBType == DBType.MySQL ? ("CONCAT('%'," + SystemConfig.AppCenterDBVarStr + "SKey,'%')") : ("'%'+" + SystemConfig.AppCenterDBVarStr + "SKey+'%'"));
                    }
                    else
                    {
                        qo.AddWhere(attr.Key, " LIKE ", "'%'||" + SystemConfig.AppCenterDBVarStr + "SKey||'%'");
                    }
                }
                qo.MyParas.Add("SKey", keyVal);
                qo.addRightBracket();
            }
            else
            {
                qo.addLeftBracket();
                qo.AddWhere("abc", "all");
                qo.addRightBracket();
            }
            #endregion

            #region 普通属性
            string opkey = ""; // 操作符号。
            foreach (AttrOfSearch attr in attrsOfSearch)
            {
                if (attr.IsHidden)
                {
                    qo.addAnd();
                    qo.addLeftBracket();
                    qo.AddWhere(attr.RefAttrKey, attr.DefaultSymbol, attr.DefaultValRun);
                    qo.addRightBracket();
                    continue;
                }

                if (attr.SymbolEnable == true)
                {
                    opkey = this.GetDDLByKey("DDL_" + attr.Key).SelectedItemStringVal;
                    if (opkey == "all")
                    {
                        continue;
                    }
                }
                else
                {
                    opkey = attr.DefaultSymbol;
                }

                qo.addAnd();
                qo.addLeftBracket();

                if (attr.DefaultVal.Length >= 8)
                {
                    string date = "2005-09-01";
                    try
                    {
                        /* 就可能是年月日。 */
                        string y = this.GetDDLByKey("DDL_" + attr.Key + "_Year").SelectedItemStringVal;
                        string m = this.GetDDLByKey("DDL_" + attr.Key + "_Month").SelectedItemStringVal;
                        string d = this.GetDDLByKey("DDL_" + attr.Key + "_Day").SelectedItemStringVal;
                        date = y + "-" + m + "-" + d;

                        if (opkey == "<=")
                        {
                            DateTime dt = DataType.ParseSysDate2DateTime(date).AddDays(1);
                            date = dt.ToString(DataType.SysDataFormat);
                        }
                    }
                    catch
                    {
                    }

                    qo.AddWhere(attr.RefAttrKey, opkey, date);
                }
                else
                {
                    qo.AddWhere(attr.RefAttrKey, opkey, this.GetTBByID("TB_" + attr.Key).Text);
                }
                qo.addRightBracket();
            }
            #endregion

            #region 外键
            foreach (AttrSearch attr1 in searchAttrs)
            {
                Attr attr = attr1.HisAttr;

                if (attr.MyFieldType == FieldType.RefText)
                {
                    continue;
                }


                DDL ddl = this.GetDDLByKey("DDL_" + attr.Key);
                if (ddl.Items.Count == 0)
                {
                    continue;
                }

                string selectVal = ddl.SelectedItemStringVal;
                if (selectVal == "all" || selectVal == "-1")
                {
                    continue;
                }

                if (selectVal == "mvals")
                {
                    UserRegedit sUr = new UserRegedit();
                    sUr.MyPK = WebUser.No + this.EnsName + "_SearchAttrs";
                    sUr.RetrieveFromDBSources();

                    /* 如果是多选值 */
                    string cfgVal = sUr.MVals;
                    AtPara ap     = new AtPara(cfgVal);
                    string instr  = ap.GetValStrByKey(attr.Key);
                    if (instr == null || instr == "")
                    {
                        if (attr.Key == "FK_Dept" || attr.Key == "FK_Unit")
                        {
                            if (attr.Key == "FK_Dept")
                            {
                                selectVal         = WebUser.FK_Dept;
                                ddl.SelectedIndex = 0;
                            }

                            //if (attr.Key == "FK_Unit")
                            //{
                            //    selectVal = WebUser.FK_Unit;
                            //    ddl.SelectedIndex = 0;
                            //}
                        }
                        else
                        {
                            continue;
                        }
                    }
                    else
                    {
                        instr = instr.Replace("..", ".");
                        instr = instr.Replace(".", "','");
                        instr = instr.Substring(2);
                        instr = instr.Substring(0, instr.Length - 2);

                        qo.addAnd();
                        qo.addLeftBracket();
                        qo.AddWhereIn(attr.Key, "(" + instr + ")");
                        qo.addRightBracket();
                        continue;
                    }
                }


                qo.addAnd();
                qo.addLeftBracket();

                if (attr.UIBindKey == "BP.Port.Depts" || attr.UIBindKey == "BP.Port.Units")  //判断特殊情况。
                {
                    qo.AddWhere(attr.Key, " LIKE ", selectVal + "%");
                }
                else
                {
                    qo.AddWhere(attr.Key, selectVal);
                }

                //qo.AddWhere(attr.Key,this.GetDDLByKey("DDL_"+attr.Key).SelectedItemStringVal ) ;
                qo.addRightBracket();
            }
            #endregion .

            if (dw != DTSearchWay.None)
            {
                string dtFrom = this.GetTBByID("TB_S_From").Text.Trim();
                string dtTo   = this.GetTBByID("TB_S_To").Text.Trim();
                if (dw == DTSearchWay.ByDate)
                {
                    qo.addAnd();
                    qo.addLeftBracket();
                    qo.SQL = dtKey + " >= '" + dtFrom + " 01:01'";
                    qo.addAnd();
                    qo.SQL = dtKey + " <= '" + dtTo + " 23:59'";
                    qo.addRightBracket();

                    //qo.AddWhere(dtKey, ">=", dtFrom+" 01:01");
                    //qo.addAnd();
                    //qo.AddWhere(dtKey, "<=", dtTo + " 23:59");
                    //qo.addRightBracket();
                }

                if (dw == DTSearchWay.ByDateTime)
                {
                    qo.addAnd();
                    qo.addLeftBracket();
                    qo.SQL = dtKey + " >= '" + dtFrom + "'";
                    qo.addAnd();
                    qo.SQL = dtKey + " <= '" + dtTo + "'";
                    qo.addRightBracket();

                    //qo.addAnd();
                    //qo.addLeftBracket();
                    //qo.AddWhere(dtKey, ">=", dtFrom);
                    //qo.addAnd();
                    //qo.AddWhere(dtKey, "<=", dtTo);
                    //qo.addRightBracket();
                }
            }

            //  throw new Exception(qo.SQL);
            return(qo);
        }
        private void butOK_Click(object sender, System.EventArgs e)
        {
            if (PrefC.HasClinicsEnabled && !checkAllClin.Checked && listClin.SelectedIndices.Count == 0)
            {
                MsgBox.Show(this, "At least one clinic must be selected.");
                return;
            }
            ReportComplex report         = new ReportComplex(true, false);
            List <long>   listClinicNums = new List <long>();

            if (PrefC.HasClinicsEnabled)
            {
                for (int i = 0; i < listClin.SelectedIndices.Count; i++)
                {
                    if (Security.CurUser.ClinicIsRestricted)
                    {
                        listClinicNums.Add(_listClinics[listClin.SelectedIndices[i]].ClinicNum);                        //we know that the list is a 1:1 to _listClinics
                    }
                    else
                    {
                        if (listClin.SelectedIndices[i] == 0)
                        {
                            listClinicNums.Add(0);
                        }
                        else
                        {
                            listClinicNums.Add(_listClinics[listClin.SelectedIndices[i] - 1].ClinicNum);                          //Minus 1 from the selected index
                        }
                    }
                }
            }
            DataTable table           = RpPatPortionUncollected.GetPatUncollected(date1.SelectionStart, date2.SelectionStart, listClinicNums);
            string    subtitleClinics = "";

            if (PrefC.HasClinicsEnabled)
            {
                if (checkAllClin.Checked && !Security.CurUser.ClinicIsRestricted)
                {
                    subtitleClinics = Lan.g(this, "All Clinics");
                }
                else
                {
                    for (int i = 0; i < listClin.SelectedIndices.Count; i++)
                    {
                        if (i > 0)
                        {
                            subtitleClinics += ", ";
                        }
                        if (Security.CurUser.ClinicIsRestricted)
                        {
                            subtitleClinics += _listClinics[listClin.SelectedIndices[i]].Abbr;
                        }
                        else
                        {
                            if (listClin.SelectedIndices[i] == 0)
                            {
                                subtitleClinics += Lan.g(this, "Unassigned");
                            }
                            else
                            {
                                subtitleClinics += _listClinics[listClin.SelectedIndices[i] - 1].Abbr;                            //Minus 1 from the selected index
                            }
                        }
                    }
                }
            }
            Font font         = new Font("Tahoma", 9);
            Font fontBold     = new Font("Tahoma", 9, FontStyle.Bold);
            Font fontTitle    = new Font("Tahoma", 17, FontStyle.Bold);
            Font fontSubTitle = new Font("Tahoma", 10, FontStyle.Bold);

            report.ReportName = Lan.g(this, "Patient Portion Uncollected");
            report.AddTitle("Title", Lan.g(this, "Patient Portion Uncollected"), fontTitle);
            report.AddSubTitle("Practice Title", PrefC.GetString(PrefName.PracticeTitle), fontSubTitle);
            report.AddSubTitle("Dates of Report", date1.SelectionStart.ToString("d") + " - " + date2.SelectionStart.ToString("d"), fontSubTitle);
            if (PrefC.HasClinicsEnabled)
            {
                report.AddSubTitle("Clinics", subtitleClinics, fontSubTitle);
            }

            QueryObject query = report.AddQuery(table, "Patient Portion Uncollected");

            query.AddColumn("Date", 90, FieldValueType.Date, font);
            query.GetColumnDetail("Date").StringFormat = "d";
            query.AddColumn("Patient Name", 150, FieldValueType.String, font);
            query.AddColumn("Procedure", 80, FieldValueType.String, font);
            query.AddColumn("Fee", 60, FieldValueType.Number, font);
            query.AddColumn("Patient", 65, FieldValueType.Number, font);
            query.AddColumn("Adjustment", 75, FieldValueType.Number, font);
            query.AddColumn("Patient Paid", 90, FieldValueType.Number, font);
            query.AddColumn("Uncollected", 80, FieldValueType.Number, font);
            report.AddPageNum(font);
            report.AddGridLines();
            if (!report.SubmitQueries())
            {
                return;
            }
            FormReportComplex FormR = new FormReportComplex(report);

            FormR.ShowDialog();
            DialogResult = DialogResult.OK;
        }
Ejemplo n.º 45
0
        public QueryObject<Order> GetOrders(QueryObject<Order> query)
        {
            string sql = string.Empty;
            if (!query.Condition.IsFinOrderView)
            {
                sql = "select t.* FROM Orders t where 1 = 1 ";
            }
            else {
                sql = "SELECT t.*, sum(d.Amount * d.Rate) TotalAmount FROM orders t left join findetails d on t.OrderNo = d.OrderNo where 1 = 1 ";
            }

            List<MySqlParameter> QueryParameters = new List<MySqlParameter>();
            if (query.Condition != null)
            {
                if (!string.IsNullOrEmpty(query.Condition.BeginDateForm))
                {
                    sql = sql + "and t.BeginDate >= @BeginDateForm ";
                    QueryParameters.Add(new MySqlParameter("@BeginDateForm", query.Condition.BeginDateForm));
                }
                if (!string.IsNullOrEmpty(query.Condition.BeginDateTo))
                {
                    sql = sql + "and t.BeginDate <= @BeginDateTo ";
                    QueryParameters.Add(new MySqlParameter("@BeginDateTo", query.Condition.BeginDateTo));
                }
                if (!string.IsNullOrEmpty(query.Condition.EndDateForm))
                {
                    sql = sql + "and t.EndDate >= @EndDateForm ";
                    QueryParameters.Add(new MySqlParameter("@EndDateForm", query.Condition.EndDateForm));
                }
                if (!string.IsNullOrEmpty(query.Condition.EndDateTo))
                {
                    sql = sql + "and t.EndDate <= @EndDateTo ";
                    QueryParameters.Add(new MySqlParameter("@EndDateTo", query.Condition.EndDateTo));
                }
                if (!string.IsNullOrEmpty(query.Condition.Description))
                {
                    sql = sql + "and t.Description like '%" + query.Condition.Description.Trim() + "%' ";
                }
                if (!string.IsNullOrEmpty(query.Condition.Status))
                {
                    sql = sql + "and t.Status = @Status ";
                    QueryParameters.Add(new MySqlParameter("@Status", query.Condition.Status));
                }
                if (!string.IsNullOrEmpty(query.Condition.Remark))
                {
                    sql = sql + "and t.Remark like '%" + query.Condition.Remark.Trim() + "%' ";
                }
                if (!string.IsNullOrEmpty(query.Condition.SalesMan))
                {
                    sql = sql + "and t.SalesMan = @SalesMan ";
                    QueryParameters.Add(new MySqlParameter("@SalesMan", query.Condition.SalesMan));
                }
            }
            if (query.Condition.IsFinOrderView)
            {
                sql = sql + "Group By t.Id";
            }
            sql = sql + " Order by BeginDate asc";
            query.dt = dbHelper.ExecuteDataTable(sql, QueryParameters.ToArray());
            query.Result = DataTableToList(query.dt);
            return query;
        }
Ejemplo n.º 46
0
 public PageList Query(QueryObject qo)
 {
     return(QueryUtil.query(qo, "employee"));
 }
Ejemplo n.º 47
0
 private void BindDataWithPage(int Page)
 {
     QueryObject<PriceCate> query = new QueryObject<PriceCate>();
     query.Page = Page;
     query.PageSize = pager.PageSize;
     query.Condition = new PriceCate();
     QueryObject<PriceCate> result = myItemManager.GetPriceCates(query);
     if (result.Result != null && result.Result.Count > 0)
     {
         pager.PageIndex = result.Page;
         pager.PageSize = result.PageSize;
         pager.RecordCount = result.RecordCount;
         list = result.Result;
         DoFill(list);
     }
     else
     {
         pager.PageIndex = Page;
         pager.PageSize = 20;
         pager.RecordCount = 0;
         list = result.Result;
         DoFill(list);
     }
 }
Ejemplo n.º 48
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="workId"></param>
        /// <param name="nodeId"></param>
        /// <param name="isWithEmpExts">是否要包含记忆中的人员</param>
        public GenerWorkerLists(Int64 workId, int nodeId, bool isWithEmpExts)
        {
            QueryObject qo = new QueryObject(this);

            qo.addLeftBracket();
            qo.AddWhere(GenerWorkerListAttr.WorkID, workId);
            qo.addOr();
            qo.AddWhere(GenerWorkerListAttr.FID, workId);
            qo.addRightBracket();
            qo.addAnd();
            qo.AddWhere(GenerWorkerListAttr.FK_Node, nodeId);
            int i = qo.DoQuery();

            if (isWithEmpExts == false)
            {
                return;
            }

            if (i == 0)
            {
                throw new Exception("@系统错误,工作人员丢失请与管理员联系。NodeID=" + nodeId + " WorkID=" + workId);
            }

            RememberMe rm = new RememberMe();

            rm.FK_Emp  = Web.WebUser.No;
            rm.FK_Node = nodeId;
            if (rm.RetrieveFromDBSources() == 0)
            {
                return;
            }

            GenerWorkerList wl = (GenerWorkerList)this[0];

            string[] emps = rm.Emps.Split('@');
            foreach (string emp in emps)
            {
                if (emp == null || emp == "")
                {
                    continue;
                }

                if (this.GetCountByKey(GenerWorkerListAttr.FK_Emp, emp) >= 1)
                {
                    continue;
                }

                GenerWorkerList mywl = new GenerWorkerList();
                mywl.Copy(wl);
                mywl.IsEnable = false;
                mywl.FK_Emp   = emp;
                WF.Port.WFEmp myEmp = new Port.WFEmp(emp);
                mywl.FK_EmpText = myEmp.Name;
                try
                {
                    mywl.Insert();
                }
                catch
                {
                    mywl.Update();
                    continue;
                }
                this.AddEntity(mywl);
            }
            return;
        }
Ejemplo n.º 49
0
 public void Update(QueryObject updatedLeftChild, QueryObject updatedRightChild)
     => SumWithoutRangeAddition = updatedLeftChild.Sum + updatedRightChild.Sum;
Ejemplo n.º 50
0
		/// <summary>
		/// Dispose graphics resources using the underlying <see cref="GraphicsContext"/>.
		/// </summary>
		/// <param name='ctx'>
		/// A <see cref="GraphicsContext"/> which have access to the <see cref="IRenderDisposable"/> graphics resources.
		/// </param>
		/// <remarks>
		/// <para>
		/// The instance shall be considered disposed as it were called <see cref="IDisposable.Dispose"/>, but in addition
		/// this method will release this instance resources.
		/// </para>
		/// <para>
		/// The <see cref="Dispose()"/> method should try to release the underlying resources by getting the optional graphics
		/// context current on the calling thread.
		/// </para>
		/// </remarks>
		public override void Dispose(GraphicsContext ctx)
		{
			if (_PrimitivesGenerated != null) {
				_PrimitivesGenerated.Dispose(ctx);
				_PrimitivesGenerated = null;
			}

			if (_PrimitivesWritten != null) {
				_PrimitivesWritten.Dispose(ctx);
				_PrimitivesWritten = null;
			}

			// Base implementation
			base.Dispose(ctx);
		}
Ejemplo n.º 51
0
 public QueryObject<Supplier> GetSupplierList(QueryObject<Supplier> query)
 {
     return supplierDao.GetSuppliers(query);
 }
Ejemplo n.º 52
0
        private void BPToolBar2_ButtonClick(object sender, System.EventArgs e)
        {
            try
            {
                ToolbarBtn  btn = (ToolbarBtn)sender;
                DefVal      en  = new DefVal();
                QueryObject qo  = new QueryObject(en);

                // BP.En.Entity enDA = DA.ClassFactory.GetEn(this.EnsName);
                switch (btn.ID)
                {
                case NamesOfBtn.Cancel:
                    this.WinClose();
                    break;

                case "Btn_SaveToMyDefaultValues":
                    if (AttrKeyValue.Trim().Length == 0)
                    {
                        throw new Exception("@默认值不能为空。");
                    }

                    en.FK_Emp  = WebUser.No;
                    en.EnsName = this.EnsName;
                    en.AttrKey = this.AttrKey;
                    en.Val     = this.AttrKeyValue;

                    qo.AddWhere(DefValAttr.FK_Emp, en.FK_Emp);
                    qo.addAnd();
                    qo.AddWhere(DefValAttr.AttrKey, en.AttrKey);
                    qo.addAnd();
                    qo.AddWhere(DefValAttr.EnsName, en.EnsName);
                    qo.addAnd();
                    qo.AddWhere(DefValAttr.Val, en.Val);
                    if (qo.DoQuery() == 0)
                    {
                        en.Insert();
                    }

                    this.SetDGData();
                    this.ResponseWriteBlueMsg_SaveOK();
                    break;

                case "Btn_SaveToAppDefaultValues":
                    if (AttrKeyValue.Trim().Length == 0)
                    {
                        throw new Exception("@默认值不能为空。");
                    }

                    en.FK_Emp  = "0";
                    en.EnsName = this.EnsName;
                    en.AttrKey = this.AttrKey;
                    en.Val     = this.AttrKeyValue;

                    qo.AddWhere(DefValAttr.FK_Emp, en.FK_Emp);
                    qo.addAnd();
                    qo.AddWhere(DefValAttr.AttrKey, en.AttrKey);
                    qo.addAnd();
                    qo.AddWhere(DefValAttr.EnsName, en.EnsName);
                    qo.addAnd();
                    qo.AddWhere(DefValAttr.Val, en.Val);
                    if (qo.DoQuery() == 0)
                    {
                        en.Insert();
                    }

                    this.SetDGData();
                    this.ResponseWriteBlueMsg_SaveOK();
                    break;

                case NamesOfBtn.Confirm:
                    this.Confirm();
                    break;

                default:
                    throw new Exception("没有处理的控件" + btn.ID);
                }
            }
            catch (Exception ex)
            {
                this.ResponseWriteRedMsg(ex);
            }
        }
Ejemplo n.º 53
0
 public QueryObject<Finance> GetFinances(QueryObject<Finance> query)
 {
     string sql = "select *, Amount * Rate TotalAmount FROM Finance f where 1 = 1 ";
     List<MySqlParameter> QueryParameters = new List<MySqlParameter>();
     if (query.Condition != null)
     {
         if (query.Condition.BeginTime != null)
         {
             sql = sql + "and f.FinDate >= @BeginTime ";
             QueryParameters.Add(new MySqlParameter("@BeginTime", query.Condition.BeginTime));
         }
         if (query.Condition.EndTime != null)
         {
             sql = sql + "and f.FinDate <= @EndTime ";
             QueryParameters.Add(new MySqlParameter("@EndTime", query.Condition.EndTime));
         }
         if (!string.IsNullOrEmpty(query.Condition.Description))
         {
             sql = sql + "and f.Description like '%" + query.Condition.Description.Trim() + "%' ";
         }
         if (!string.IsNullOrEmpty(query.Condition.ItemType))
         {
             sql = sql + "and f.ItemType = @ItemType ";
             QueryParameters.Add(new MySqlParameter("@ItemType", query.Condition.ItemType));
         }
         if (!string.IsNullOrEmpty(query.Condition.EventType))
         {
             sql = sql + "and f.EventType = @EventType ";
             QueryParameters.Add(new MySqlParameter("@EventType", query.Condition.EventType));
         }
         if (!string.IsNullOrEmpty(query.Condition.Association))
         {
             sql = sql + "and f.Association like '%" + query.Condition.Association.Trim() + "%' ";
         }
         if (!string.IsNullOrEmpty(query.Condition.ReceivePaymentor))
         {
             sql = sql + "and f.ReceivePaymentor like '%" + query.Condition.ReceivePaymentor.Trim() + "%' ";
         }
     }
     sql = sql + " order by f.FinDate asc";
     query.dt = dbHelper.ExecuteDataTable(sql, QueryParameters.ToArray());
     List<Finance> FinanceList = FinanceTableToList(query.dt);
     foreach(Finance fin in FinanceList)
     {
         if (fin.FinId > 0)
         {
             fin.Details = GetFinDetails(fin.FinId);
         }
     }
     query.Result = FinanceList;
     return query;
 }
Ejemplo n.º 54
0
        private void butOK_Click(object sender, EventArgs e)
        {
            ReportComplex report = new ReportComplex(true, false);

            report.ReportName = Lan.g(this, "Completed Cases");
            report.AddTitle("Title", Lan.g(this, "Completed Cases"));
            // report.AddSubTitle("Date", dateStart.SelectionStart.ToShortDateString() + " - " + dateEnd.SelectionStart.ToShortDateString());
            report.AddSubTitle("Date", dtpStart.Value.ToShortDateString() + " - " + dtpEnd.Value.ToShortDateString());

            DataTable tablePats;
            // tablePats = KPICompletedCases.GetCompletedCases(dateStart.SelectionStart, dateEnd.SelectionStart);
            String patQuery = @"
				SELECT DISTINCT p.PatNum, p.LName, p.FName, p.MiddleI, 
                           p.HmPhone, p.WkPhone, p.WirelessPhone, p.Email
                FROM opendental.procedurelog pl
                JOIN opendental.appointment a ON pl.PlannedAptNum = a.AptNum
                JOIN opendental.procedurecode pc ON pc.CodeNum = pl.CodeNum
                JOIN opendental.patient p ON p.PatNum = pl.PatNum
                WHERE a.AptStatus = 6
                AND pl.ProcStatus = 2            
            ";


            // tablePats = StretchKPICustomForm.GetPatients(dateStart.SelectionStart, dateEnd.SelectionStart, patQuery);
            // tablePats = KPICompletedCases.GetCompletedCasesPats(dateStart.SelectionStart, dateEnd.SelectionStart);
            tablePats = KPICompletedCases.GetCompletedCasesPats(dtpStart.Value, dtpEnd.Value);

            for (int i = 0; i < tablePats.Rows.Count; i++)
            {
                DataTable onePat   = new DataTable();
                DataTable localPat = tablePats.Clone();

                DataRow iPat = tablePats.Rows[i];
                //onePat.ImportRow(iPat);
                // localPat.Clear();
                localPat.ImportRow(iPat);

                QueryObject query = report.AddQuery(localPat, "", "", SplitByKind.None, 0);
                // query.AddColumn("PatNum", 90, FieldValueType.Number);
                query.AddColumn("PatNum", 60, FieldValueType.String);
                query.AddColumn("Name", 150, FieldValueType.String);
                query.AddColumn("Home Phone", 80, FieldValueType.String);
                query.AddColumn("Work Phone", 80, FieldValueType.String);
                query.AddColumn("Cell Phone", 80, FieldValueType.String);
                query.AddColumn("Email", 150, FieldValueType.String);

                String iPatNum = iPat["PatNum"].ToString();

                // DataTable procsForPat = KPICompletedCases.GetCompletedCasesPerPat(dateStart.SelectionStart,
                //     dateEnd.SelectionStart, iPatNum);
                DataTable procsForPat = KPICompletedCases.GetCompletedCasesPerPat(dtpStart.Value, dtpEnd.Value, iPatNum);

                QueryObject procsQ = report.AddQuery(procsForPat, "", "", SplitByKind.None, 0);
                procsQ.AddColumn("Date of Service", 100, FieldValueType.String);
                procsQ.AddColumn("Treatment Code", 100, FieldValueType.String);
                procsQ.AddColumn("Treatment Completed", 350, FieldValueType.String);
                procsQ.AddColumn("Billed", 50, FieldValueType.Number);

                //    procsQ.AddGroupSummaryField("Number of Completed Cases for "+ iPat["Name"] + ":", "Date of Service",
                //        "Treatment Code", SummaryOperation.Count);
                //    procsQ.AddGroupSummaryField("TOTAL:", "Billed", "Billed", SummaryOperation.Count);


                report.AddLine("line", AreaSectionType.GroupFooter, Color.AliceBlue, 20,
                               LineOrientation.Horizontal, LinePosition.Center, 25, 0, 0);
            }

            /*
             * // OLDER FORM:
             * DataTable tablePats = KPICompletedCases.GetCompletedCases(dateStart.SelectionStart, dateEnd.SelectionStart);
             * ReportComplex report = new ReportComplex(true, false);
             * report.ReportName = Lan.g(this, "Completed Cases");
             * report.AddTitle("Title", Lan.g(this, "Completed Cases"));
             * report.AddSubTitle("Date", dateStart.SelectionStart.ToShortDateString() + " - " + dateEnd.SelectionStart.ToShortDateString());
             * QueryObject query;
             * query = report.AddQuery(tablePats, "", "", SplitByKind.None, 0);
             * query.AddColumn("Name", 150, FieldValueType.String);
             *
             * query.AddColumn("Date of Service", 100, FieldValueType.String);
             * query.AddColumn("Treatment Code", 80, FieldValueType.String);
             * query.AddColumn("Treatment Completed", 280, FieldValueType.String);
             * query.AddColumn("Billed", 50, FieldValueType.String);
             * //        query.AddColumn("Birthdate", 80, FieldValueType.String);
             * //        query.AddColumn("Sex", 150, FieldValueType.String);
             * //        query.AddColumn("Postal Code", 90, FieldValueType.String);
             * //        query.AddColumn("Date of Service", 100, FieldValueType.String);
             * //        query.AddColumn("Primary Provider", 40, FieldValueType.String);
             * //        query.AddGroupSummaryField("Number of Completed Cases:", "Name", "Provider", SummaryOperation.Count);
             *
             */
            report.AddPageNum();
            if (!report.SubmitQueries())
            {
                return;
            }
            FormReportComplex FormR = new FormReportComplex(report);

            FormR.ShowDialog();
            //DialogResult=DialogResult.OK;
        }
Ejemplo n.º 55
0
 public QueryObject<Order> GetQueryObject()
 {
     QueryObject<Order> query = new QueryObject<Order>();
     query.Condition = new Order();
     query.Condition.IsFinOrderView = IsFinOrderView;
     query.Condition.BeginDateForm = this.BeginDateForm.Value.ToString(Constants.DateFormat);
     query.Condition.BeginDateTo = this.BeginDateTo.Value.ToString(Constants.DateFormat);
     if (this.EndDateForm.ValueX != null)
     {
         query.Condition.EndDateForm = this.EndDateForm.ValueX.Value.ToString(Constants.DateFormat);
     }
     if (this.EndDateTo.ValueX != null)
     {
         DateTime endDateTo = this.EndDateTo.ValueX.Value;
         query.Condition.EndDateTo = endDateTo.ToString(Constants.DateFormat);
     }
     query.Condition.Description = this.Description.Text.Trim();
     query.Condition.Status = (string)this.Status.SelectedValue;
     query.Condition.SalesMan = (string)this.SalesMan.SelectedValue;
     query.Condition.Remark = this.Remark.Text.Trim();
     return query;
 }
Ejemplo n.º 56
0
        private void butOK_Click(object sender, System.EventArgs e)
        {
            int     payPlanVersion = PrefC.GetInt(PrefName.PayPlansVersion);
            string  bDate;
            string  eDate;
            decimal rcvStart          = 0;
            decimal rcvProd           = 0;
            decimal rcvPayPlanCharges = 0;
            decimal rcvAdj            = 0;
            decimal rcvWriteoff       = 0;
            decimal rcvPayment        = 0;
            decimal rcvInsPayment     = 0;
            decimal runningRcv        = 0;
            decimal rcvDaily          = 0;

            decimal[] colTotals = new decimal[9];
            string    wMonth;
            string    wYear;
            string    wDay = "01";
            string    wDate;

            // Get the year / month and instert the 1st of the month for stop point for calculated running balance
            wYear  = date1.SelectionStart.Year.ToString();
            wMonth = date1.SelectionStart.Month.ToString();
            if (wMonth.Length < 2)
            {
                wMonth = "0" + wMonth;
            }
            wDate = wYear + "-" + wMonth + "-" + wDay;
            List <long> listProvNums = new List <long>();
            bool        hasAllProvs  = (listProv.SelectedIndices[0] == 0);

            if (!hasAllProvs)
            {
                for (int i = 0; i < listProv.SelectedIndices.Count; i++)
                {
                    //Minus 1 due to the 'Practice' option.
                    listProvNums.Add(_listProvs[listProv.SelectedIndices[i] - 1].ProvNum);
                }
            }
            bool isPayPlan2;

            if (payPlanVersion == 2)
            {
                isPayPlan2 = true;
            }
            else
            {
                isPayPlan2 = false;
            }
            ReportComplex report             = new ReportComplex(true, false);
            DataTable     TableCharge        = new DataTable(); //charges
            DataTable     TablePayPlanCharge = new DataTable(); //PayPlanCharges
            DataTable     TableCapWriteoff   = new DataTable(); //capComplete writeoffs
            DataTable     TableInsWriteoff   = new DataTable(); //ins writeoffs
            DataTable     TablePay           = new DataTable(); //payments - Patient
            DataTable     TableIns           = new DataTable(); //payments - Ins, added SPK
            DataTable     TableAdj           = new DataTable(); //adjustments

            //
            // Main Loop:  This will loop twice 1st loop gets running balance to start of month selected
            //             2nd will break the numbers down by day and calculate the running balances
            //
            for (int j = 0; j <= 1; j++)
            {
                if (j == 0)
                {
                    bDate = "0001-01-01";
                    eDate = wDate;
                }
                else
                {
                    bDate = wDate;
                    eDate = POut.Date(date1.SelectionStart.AddDays(1)).Substring(1, 10);                   // Needed because all Queries are < end date to get correct Starting AR
                }
                TableCharge = RpReceivablesBreakdown.GetRecvBreakdownTable(date1.SelectionStart, listProvNums, radioWriteoffPay.Checked, isPayPlan2, wDate, eDate, bDate, "TableCharge");
                if (isPayPlan2)
                {
                    TablePayPlanCharge = RpReceivablesBreakdown.GetRecvBreakdownTable(date1.SelectionStart, listProvNums, radioWriteoffPay.Checked, isPayPlan2, wDate, eDate, bDate, "TablePayPlanCharge");
                }
                TableCapWriteoff = RpReceivablesBreakdown.GetRecvBreakdownTable(date1.SelectionStart, listProvNums, radioWriteoffPay.Checked, isPayPlan2, wDate, eDate, bDate, "TableCapWriteoff");
                TableInsWriteoff = RpReceivablesBreakdown.GetRecvBreakdownTable(date1.SelectionStart, listProvNums, radioWriteoffPay.Checked, isPayPlan2, wDate, eDate, bDate, "TableInsWriteoff");
                TablePay         = RpReceivablesBreakdown.GetRecvBreakdownTable(date1.SelectionStart, listProvNums, radioWriteoffPay.Checked, isPayPlan2, wDate, eDate, bDate, "TablePay");
                TableIns         = RpReceivablesBreakdown.GetRecvBreakdownTable(date1.SelectionStart, listProvNums, radioWriteoffPay.Checked, isPayPlan2, wDate, eDate, bDate, "TableIns");
                TableAdj         = RpReceivablesBreakdown.GetRecvBreakdownTable(date1.SelectionStart, listProvNums, radioWriteoffPay.Checked, isPayPlan2, wDate, eDate, bDate, "TableAdj");
                //Sum up all the transactions grouped by date.
                Dictionary <DateTime, decimal> dictPayPlanCharges = TablePayPlanCharge.Select().GroupBy(x => PIn.Date(x["ChargeDate"].ToString()))
                                                                    .ToDictionary(y => y.Key, y => y.ToList().Sum(z => PIn.Decimal(z["Amt"].ToString())));
                //1st Loop Calculate running Accounts Receivable upto the 1st of the Month Selected
                //2nd Loop Calculate the Daily Accounts Receivable upto the Date Selected
                //Finaly Generate Report showing the breakdown upto the date specified with totals for what is on the report
                if (j == 0)
                {
                    for (int k = 0; k < TableCharge.Rows.Count; k++)
                    {
                        rcvProd += PIn.Decimal(TableCharge.Rows[k][1].ToString());
                    }
                    rcvPayPlanCharges += dictPayPlanCharges.Sum(x => x.Value);
                    for (int k = 0; k < TableCapWriteoff.Rows.Count; k++)
                    {
                        rcvWriteoff += PIn.Decimal(TableCapWriteoff.Rows[k][1].ToString());
                    }
                    for (int k = 0; k < TableInsWriteoff.Rows.Count; k++)
                    {
                        rcvWriteoff += PIn.Decimal(TableInsWriteoff.Rows[k][1].ToString());
                    }
                    for (int k = 0; k < TablePay.Rows.Count; k++)
                    {
                        rcvPayment += PIn.Decimal(TablePay.Rows[k][1].ToString());
                    }
                    for (int k = 0; k < TableIns.Rows.Count; k++)
                    {
                        rcvInsPayment += PIn.Decimal(TableIns.Rows[k][1].ToString());
                    }
                    for (int k = 0; k < TableAdj.Rows.Count; k++)
                    {
                        rcvAdj += PIn.Decimal(TableAdj.Rows[k][1].ToString());
                    }
                    TableCharge.Clear();
                    TablePayPlanCharge.Clear();
                    TableCapWriteoff.Clear();
                    TableInsWriteoff.Clear();
                    TablePay.Clear();
                    TableIns.Clear();
                    TableAdj.Clear();
                    rcvStart = (rcvProd + rcvPayPlanCharges + rcvAdj - rcvWriteoff) - (rcvPayment + rcvInsPayment);
                }
                else
                {
                    rcvAdj            = 0;
                    rcvInsPayment     = 0;
                    rcvPayment        = 0;
                    rcvProd           = 0;
                    rcvPayPlanCharges = 0;
                    rcvWriteoff       = 0;
                    rcvDaily          = 0;
                    runningRcv        = rcvStart;
                    DataTable TableQ = new DataTable();
                    TableQ.Columns.Add("Date");
                    TableQ.Columns.Add("Charges");
                    TableQ.Columns.Add("PayPlanCharges");
                    TableQ.Columns.Add("Adjustments");
                    TableQ.Columns.Add("Writeoffs");
                    TableQ.Columns.Add("Payment");
                    TableQ.Columns.Add("InsPayment");
                    TableQ.Columns.Add("Daily");
                    TableQ.Columns.Add("Running");
                    eDate = POut.Date(date1.SelectionStart).Substring(1, 10); // Reset EndDate to Selected Date
                    DateTime[] dates = new DateTime[(PIn.Date(eDate) - PIn.Date(bDate)).Days + 1];
                    for (int i = 0; i < dates.Length; i++)                    //usually 31 days in loop
                    {
                        dates[i] = PIn.Date(bDate).AddDays(i);
                        //create new row called 'row' based on structure of TableQ
                        DataRow row = TableQ.NewRow();
                        row[0] = dates[i].ToShortDateString();
                        for (int k = 0; k < TableCharge.Rows.Count; k++)
                        {
                            if (dates[i] == (PIn.Date(TableCharge.Rows[k][0].ToString())))
                            {
                                rcvProd += PIn.Decimal(TableCharge.Rows[k][1].ToString());
                            }
                        }
                        decimal rcvPayPlanChargesForDay = 0;
                        if (dictPayPlanCharges.TryGetValue(dates[i], out rcvPayPlanChargesForDay))
                        {
                            rcvPayPlanCharges += rcvPayPlanChargesForDay;
                        }
                        for (int k = 0; k < TableCapWriteoff.Rows.Count; k++)
                        {
                            if (dates[i] == (PIn.Date(TableCapWriteoff.Rows[k][0].ToString())))
                            {
                                rcvWriteoff += PIn.Decimal(TableCapWriteoff.Rows[k][1].ToString());
                            }
                        }
                        for (int k = 0; k < TableAdj.Rows.Count; k++)
                        {
                            if (dates[i] == (PIn.Date(TableAdj.Rows[k][0].ToString())))
                            {
                                rcvAdj += PIn.Decimal(TableAdj.Rows[k][1].ToString());
                            }
                        }
                        for (int k = 0; k < TableInsWriteoff.Rows.Count; k++)
                        {
                            if (dates[i] == (PIn.Date(TableInsWriteoff.Rows[k][0].ToString())))
                            {
                                rcvWriteoff += PIn.Decimal(TableInsWriteoff.Rows[k][1].ToString());
                            }
                        }
                        for (int k = 0; k < TablePay.Rows.Count; k++)
                        {
                            if (dates[i] == (PIn.Date(TablePay.Rows[k][0].ToString())))
                            {
                                rcvPayment += PIn.Decimal(TablePay.Rows[k][1].ToString());
                            }
                        }
                        for (int k = 0; k < TableIns.Rows.Count; k++)
                        {
                            if (dates[i] == (PIn.Date(TableIns.Rows[k][0].ToString())))
                            {
                                rcvInsPayment += PIn.Decimal(TableIns.Rows[k][1].ToString());
                            }
                        }
                        //rcvPayPlanCharges will be 0 if not on version 2.
                        rcvDaily              = (rcvProd + rcvPayPlanCharges + rcvAdj - rcvWriteoff) - (rcvPayment + rcvInsPayment);
                        runningRcv           += (rcvProd + rcvPayPlanCharges + rcvAdj - rcvWriteoff) - (rcvPayment + rcvInsPayment);
                        row["Charges"]        = rcvProd.ToString("n");
                        row["PayPlanCharges"] = rcvPayPlanCharges.ToString("n");
                        row["Adjustments"]    = rcvAdj.ToString("n");
                        row["Writeoffs"]      = rcvWriteoff.ToString("n");
                        row["Payment"]        = rcvPayment.ToString("n");
                        row["InsPayment"]     = rcvInsPayment.ToString("n");
                        row["Daily"]          = rcvDaily.ToString("n");
                        row["Running"]        = runningRcv.ToString("n");
                        colTotals[1]         += rcvProd;
                        colTotals[2]         += rcvPayPlanCharges;
                        colTotals[3]         += rcvAdj;
                        colTotals[4]         += rcvWriteoff;
                        colTotals[5]         += rcvPayment;
                        colTotals[6]         += rcvInsPayment;
                        colTotals[7]         += rcvDaily;
                        colTotals[8]          = runningRcv;
                        TableQ.Rows.Add(row);                          //adds row to table Q
                        rcvAdj            = 0;
                        rcvInsPayment     = 0;
                        rcvPayment        = 0;
                        rcvProd           = 0;
                        rcvPayPlanCharges = 0;
                        rcvWriteoff       = 0;
                    }
                    //Drop the PayPlanCharges column if not version 2
                    if (payPlanVersion != 2)
                    {
                        TableQ.Columns.RemoveAt(2);
                    }
                    ////columnCount will get incremented on the second ColTotal call so we can use it in this way
                    //if(payPlanVersion==2) {
                    //	report.ColTotal[1]=PIn.Decimal(colTotals[1].ToString("n")); //prod
                    //	report.ColTotal[2]=PIn.Decimal(colTotals[2].ToString("n")); //payplancharges
                    //	report.ColTotal[3]=PIn.Decimal(colTotals[3].ToString("n")); //adjustment
                    //	report.ColTotal[4]=PIn.Decimal(colTotals[4].ToString("n")); //writeoffs
                    //	report.ColTotal[5]=PIn.Decimal(colTotals[5].ToString("n")); //payment
                    //	report.ColTotal[6]=PIn.Decimal(colTotals[6].ToString("n")); //inspayment
                    //	report.ColTotal[7]=PIn.Decimal(colTotals[7].ToString("n")); //daily
                    //	report.ColTotal[8]=PIn.Decimal(colTotals[8].ToString("n")); //running
                    //}
                    //else {
                    //	report.ColTotal[1]=PIn.Decimal(colTotals[1].ToString("n")); //prod
                    //	report.ColTotal[2]=PIn.Decimal(colTotals[3].ToString("n")); //adjustment
                    //	report.ColTotal[3]=PIn.Decimal(colTotals[4].ToString("n")); //writeoffs
                    //	report.ColTotal[4]=PIn.Decimal(colTotals[5].ToString("n")); //payment
                    //	report.ColTotal[5]=PIn.Decimal(colTotals[6].ToString("n")); //inspayment
                    //	report.ColTotal[6]=PIn.Decimal(colTotals[7].ToString("n")); //daily
                    //	report.ColTotal[7]=PIn.Decimal(colTotals[8].ToString("n")); //running
                    //}
                    Font font         = new Font("Tahoma", 9);
                    Font boldFont     = new Font("Tahoma", 9, FontStyle.Bold);
                    Font fontTitle    = new Font("Tahoma", 17, FontStyle.Bold);
                    Font fontSubTitle = new Font("Tahoma", 10, FontStyle.Bold);
                    report.ReportName = Lan.g(this, "Receivables Breakdown");
                    report.AddTitle("Title", Lan.g(this, "Receivables Breakdown"), fontTitle);
                    report.AddSubTitle("PracticeTitle", PrefC.GetString(PrefName.PracticeTitle), fontSubTitle);
                    report.AddSubTitle("Date SubTitle", date1.SelectionStart.ToString("d"), fontSubTitle);
                    string provNames = "";
                    for (int i = 0; i < listProv.SelectedIndices.Count; i++)
                    {
                        if (hasAllProvs)
                        {
                            provNames = "All Providers";
                            break;
                        }
                        if (i > 0)
                        {
                            provNames += ", ";
                        }
                        provNames += _listProvs[listProv.SelectedIndices[i] - 1].Abbr;
                    }
                    report.AddSubTitle("Provider SubTitle", provNames);
                    int[]       summaryGroups1 = { 1 };
                    QueryObject query          = report.AddQuery(TableQ, Lan.g(this, "Date") + ": " + DateTimeOD.Today.ToString("d"));
                    query.AddColumn("Date", 72, FieldValueType.Date);
                    query.AddColumn("Production", 80, FieldValueType.Number);
                    query.GetColumnDetail("Production").ContentAlignment = ContentAlignment.MiddleRight;
                    if (payPlanVersion == 2)
                    {
                        query.AddColumn("PayPlan", 80, FieldValueType.Number);
                        query.GetColumnDetail("PayPlan").ContentAlignment = ContentAlignment.MiddleRight;
                    }
                    query.AddColumn("Adjustment", 80, FieldValueType.Number);
                    query.GetColumnDetail("Adjustment").ContentAlignment = ContentAlignment.MiddleRight;
                    query.AddColumn("Writeoff", 80, FieldValueType.Number);
                    query.GetColumnDetail("Writeoff").ContentAlignment = ContentAlignment.MiddleRight;
                    query.AddColumn("Payment", 80, FieldValueType.Number);
                    query.GetColumnDetail("Payment").ContentAlignment = ContentAlignment.MiddleRight;
                    query.AddColumn("InsPayment", 80, FieldValueType.Number);
                    query.GetColumnDetail("InsPayment").ContentAlignment = ContentAlignment.MiddleRight;
                    query.AddColumn("Daily A/R", 100, FieldValueType.Number);
                    query.GetColumnDetail("Daily A/R").ContentAlignment = ContentAlignment.MiddleRight;
                    query.AddColumn("Ending A/R", 100);
                    query.GetColumnDetail("Ending A/R").ContentAlignment = ContentAlignment.MiddleRight;
                    query.GetColumnDetail("Ending A/R").Font             = boldFont;
                    report.AddFooterText("Desc", "Receivables Calculation: (Production + PayPlanCharges + Adjustments - Writeoffs) - (Payments + Insurance Payments)", font, 0, ContentAlignment.MiddleRight);
                    //report.AddText("EndingAR","Final Ending A/R: "+runningRcv.ToString(),boldFont,0,ContentAlignment.MiddleLeft);
                    report.AddPageNum(font);
                    if (!report.SubmitQueries())
                    {
                        return;
                    }
                    FormReportComplex FormR = new FormReportComplex(report);
                    FormR.ShowDialog();
                    DialogResult = DialogResult.OK;
                } //END If
            }     // END For Loop
        }         //END OK button Clicked
Ejemplo n.º 57
0
 /// <summary>
 /// Returns and activates the last query added.
 /// </summary>
 public QueryObject Pop()
 {
     QueryObject Obj = new QueryObject();
     Obj.Push(Querys.Pop());
     return Obj;
 }
Ejemplo n.º 58
0
        private void butOK_Click(object sender, System.EventArgs e)
        {
            if (listProv.SelectedIndices.Count == 0)
            {
                MsgBox.Show(this, "Please select at least one provider.");
                return;
            }
            if (PrefC.HasClinicsEnabled)             //Using clinics
            {
                if (listClin.SelectedIndices.Count == 0)
                {
                    MsgBox.Show(this, "Please select at least one clinic.");
                    return;
                }
            }
            if (dateStart.Value > dateEnd.Value)
            {
                MsgBox.Show(this, "Start date cannot be greater than the end date.");
                return;
            }
            ReportComplex report         = new ReportComplex(true, true);
            List <long>   listProvNums   = new List <long>();
            List <long>   listClinicNums = new List <long>();

            for (int i = 0; i < listProv.SelectedIndices.Count; i++)
            {
                listProvNums.Add(_listProviders[listProv.SelectedIndices[i]].ProvNum);
            }
            if (checkAllProv.Checked)
            {
                for (int i = 0; i < _listProviders.Count; i++)
                {
                    listProvNums.Add(_listProviders[i].ProvNum);
                }
            }
            if (PrefC.HasClinicsEnabled)
            {
                for (int i = 0; i < listClin.SelectedIndices.Count; i++)
                {
                    if (Security.CurUser.ClinicIsRestricted)
                    {
                        listClinicNums.Add(_listClinics[listClin.SelectedIndices[i]].ClinicNum);                        //we know that the list is a 1:1 to _listClinics
                    }
                    else
                    {
                        if (listClin.SelectedIndices[i] == 0)
                        {
                            listClinicNums.Add(0);
                        }
                        else
                        {
                            listClinicNums.Add(_listClinics[listClin.SelectedIndices[i] - 1].ClinicNum);                          //Minus 1 from the selected index
                        }
                    }
                }
            }
            DisplayPayPlanType displayPayPlanType;

            if (radioInsurance.Checked)
            {
                displayPayPlanType = DisplayPayPlanType.Insurance;
            }
            else if (radioPatient.Checked)
            {
                displayPayPlanType = DisplayPayPlanType.Patient;
            }
            else
            {
                displayPayPlanType = DisplayPayPlanType.Both;
            }
            bool    isPayPlanV2 = (PrefC.GetInt(PrefName.PayPlansVersion) == 2);
            DataSet ds          = RpPayPlan.GetPayPlanTable(dateStart.Value, dateEnd.Value, listProvNums, listClinicNums, checkAllProv.Checked
                                                            , displayPayPlanType, checkHideCompletePlans.Checked, checkShowFamilyBalance.Checked, checkHasDateRange.Checked, isPayPlanV2);
            DataTable table        = ds.Tables["Clinic"];
            DataTable tableTotal   = ds.Tables["Total"];
            Font      font         = new Font("Tahoma", 9);
            Font      fontTitle    = new Font("Tahoma", 17, FontStyle.Bold);
            Font      fontSubTitle = new Font("Tahoma", 10, FontStyle.Bold);

            report.ReportName = Lan.g(this, "PaymentPlans");
            report.AddTitle("Title", Lan.g(this, "Payment Plans"), fontTitle);
            report.AddSubTitle("PracticeTitle", PrefC.GetString(PrefName.PracticeTitle), fontSubTitle);
            if (checkHasDateRange.Checked)
            {
                report.AddSubTitle("Date SubTitle", dateStart.Value.ToShortDateString() + " - " + dateEnd.Value.ToShortDateString(), fontSubTitle);
            }
            else
            {
                report.AddSubTitle("Date SubTitle", DateTimeOD.Today.ToShortDateString(), fontSubTitle);
            }
            QueryObject query;

            if (PrefC.HasClinicsEnabled)
            {
                query = report.AddQuery(table, "", "clinicName", SplitByKind.Value, 1, true);
            }
            else
            {
                query = report.AddQuery(table, "", "", SplitByKind.None, 1, true);
            }
            query.AddColumn("Provider", 160, FieldValueType.String, font);
            query.AddColumn("Guarantor", 160, FieldValueType.String, font);
            query.AddColumn("Ins", 40, FieldValueType.String, font);
            query.GetColumnHeader("Ins").ContentAlignment = ContentAlignment.MiddleCenter;
            query.GetColumnDetail("Ins").ContentAlignment = ContentAlignment.MiddleCenter;
            query.AddColumn("Princ", 100, FieldValueType.Number, font);
            query.GetColumnHeader("Princ").ContentAlignment = ContentAlignment.MiddleRight;
            query.GetColumnDetail("Princ").ContentAlignment = ContentAlignment.MiddleRight;
            query.AddColumn("Accum Int", 100, FieldValueType.Number, font);
            query.GetColumnHeader("Accum Int").ContentAlignment = ContentAlignment.MiddleRight;
            query.GetColumnDetail("Accum Int").ContentAlignment = ContentAlignment.MiddleRight;
            query.AddColumn("Paid", 100, FieldValueType.Number, font);
            query.GetColumnHeader("Paid").ContentAlignment = ContentAlignment.MiddleRight;
            query.GetColumnDetail("Paid").ContentAlignment = ContentAlignment.MiddleRight;
            query.AddColumn("Balance", 100, FieldValueType.Number, font);
            query.GetColumnHeader("Balance").ContentAlignment = ContentAlignment.MiddleRight;
            query.GetColumnDetail("Balance").ContentAlignment = ContentAlignment.MiddleRight;
            query.AddColumn("Due Now", 100, FieldValueType.Number, font);
            query.GetColumnHeader("Due Now").ContentAlignment = ContentAlignment.MiddleRight;
            query.GetColumnDetail("Due Now").ContentAlignment = ContentAlignment.MiddleRight;
            if (isPayPlanV2)
            {
                query.AddColumn("Bal Not Due", 100, FieldValueType.Number, font);
                query.GetColumnHeader("Bal Not Due").ContentAlignment = ContentAlignment.MiddleRight;
                query.GetColumnDetail("Bal Not Due").ContentAlignment = ContentAlignment.MiddleRight;
            }
            if (checkShowFamilyBalance.Checked)
            {
                query.AddColumn("Fam Balance", 100, FieldValueType.String, font);
                query.GetColumnHeader("Fam Balance").ContentAlignment    = ContentAlignment.MiddleRight;
                query.GetColumnDetail("Fam Balance").ContentAlignment    = ContentAlignment.MiddleRight;
                query.GetColumnDetail("Fam Balance").SuppressIfDuplicate = true;
            }
            if (PrefC.HasClinicsEnabled)
            {
                QueryObject queryTotals = report.AddQuery(tableTotal, "Totals");
                queryTotals.AddColumn("Clinic", 360, FieldValueType.String, font);
                queryTotals.AddColumn("Princ", 100, FieldValueType.Number, font);
                queryTotals.GetColumnHeader("Princ").ContentAlignment = ContentAlignment.MiddleRight;
                queryTotals.GetColumnDetail("Princ").ContentAlignment = ContentAlignment.MiddleRight;
                queryTotals.AddColumn("Accum Int", 100, FieldValueType.Number, font);
                queryTotals.GetColumnHeader("Accum Int").ContentAlignment = ContentAlignment.MiddleRight;
                queryTotals.GetColumnDetail("Accum Int").ContentAlignment = ContentAlignment.MiddleRight;
                queryTotals.AddColumn("Paid", 100, FieldValueType.Number, font);
                queryTotals.GetColumnHeader("Paid").ContentAlignment = ContentAlignment.MiddleRight;
                queryTotals.GetColumnDetail("Paid").ContentAlignment = ContentAlignment.MiddleRight;
                queryTotals.AddColumn("Balance", 100, FieldValueType.Number, font);
                queryTotals.GetColumnHeader("Balance").ContentAlignment = ContentAlignment.MiddleRight;
                queryTotals.GetColumnDetail("Balance").ContentAlignment = ContentAlignment.MiddleRight;
                queryTotals.AddColumn("Due Now", 100, FieldValueType.Number, font);
                queryTotals.GetColumnHeader("Due Now").ContentAlignment = ContentAlignment.MiddleRight;
                queryTotals.GetColumnDetail("Due Now").ContentAlignment = ContentAlignment.MiddleRight;
                if (isPayPlanV2)
                {
                    queryTotals.AddColumn("Bal Not Due", 100, FieldValueType.Number, font);
                    queryTotals.GetColumnHeader("Bal Not Due").ContentAlignment = ContentAlignment.MiddleRight;
                    queryTotals.GetColumnDetail("Bal Not Due").ContentAlignment = ContentAlignment.MiddleRight;
                }
                if (checkShowFamilyBalance.Checked)
                {
                    queryTotals.AddColumn("Fam Balance", 100, FieldValueType.String, font);
                    queryTotals.GetColumnHeader("Fam Balance").ContentAlignment    = ContentAlignment.MiddleRight;
                    queryTotals.GetColumnDetail("Fam Balance").ContentAlignment    = ContentAlignment.MiddleRight;
                    queryTotals.GetColumnDetail("Fam Balance").SuppressIfDuplicate = true;
                }
            }
            if (!report.SubmitQueries())
            {
                return;
            }
            FormReportComplex FormR = new FormReportComplex(report);

            FormR.ShowDialog();
            DialogResult = DialogResult.OK;
        }
Ejemplo n.º 59
0
        private void butOK_Click(object sender, System.EventArgs e)
        {
            if (PrefC.HasClinicsEnabled)
            {
                if (!checkAllClin.Checked && listClin.SelectedIndices.Count == 0)
                {
                    MsgBox.Show(this, "At least one clinic must be selected.");
                    return;
                }
            }
            ReportComplex report = new ReportComplex(true, false);

            Cursor = Cursors.WaitCursor;
            List <long> listClinicNums = new List <long>();

            if (PrefC.HasClinicsEnabled)
            {
                for (int i = 0; i < listClin.SelectedIndices.Count; i++)
                {
                    if (Security.CurUser.ClinicIsRestricted)
                    {
                        listClinicNums.Add(_listClinics[listClin.SelectedIndices[i]].ClinicNum);                        //we know that the list is a 1:1 to _listClinics
                    }
                    else
                    {
                        if (listClin.SelectedIndices[i] == 0)
                        {
                            listClinicNums.Add(0);
                        }
                        else
                        {
                            listClinicNums.Add(_listClinics[listClin.SelectedIndices[i] - 1].ClinicNum);                          //Minus 1 from the selected index
                        }
                    }
                }
            }
            DataTable tableOverpaid = RpInsOverpaid.GetInsuranceOverpaid(dateStart.SelectionStart, dateEnd.SelectionStart, listClinicNums,
                                                                         radioGroupByProc.Checked);

            Cursor = Cursors.Default;
            string subtitleClinics = "";

            if (PrefC.HasClinicsEnabled)
            {
                if (checkAllClin.Checked)
                {
                    subtitleClinics = Lan.g(this, "All Clinics");
                }
                else
                {
                    for (int i = 0; i < listClin.SelectedIndices.Count; i++)
                    {
                        if (i > 0)
                        {
                            subtitleClinics += ", ";
                        }
                        if (Security.CurUser.ClinicIsRestricted)
                        {
                            subtitleClinics += _listClinics[listClin.SelectedIndices[i]].Abbr;
                        }
                        else
                        {
                            if (listClin.SelectedIndices[i] == 0)
                            {
                                subtitleClinics += Lan.g(this, "Unassigned");
                            }
                            else
                            {
                                subtitleClinics += _listClinics[listClin.SelectedIndices[i] - 1].Abbr;                            //Minus 1 from the selected index
                            }
                        }
                    }
                }
            }
            report.ReportName = Lan.g(this, "Insurance Overpaid");
            report.AddTitle("Title", Lan.g(this, "Insurance Overpaid"));
            report.AddSubTitle("Practice Name", PrefC.GetString(PrefName.PracticeTitle));
            if (PrefC.HasClinicsEnabled)
            {
                report.AddSubTitle("Clinics", subtitleClinics);
            }
            QueryObject query = report.AddQuery(tableOverpaid, DateTimeOD.Today.ToShortDateString());

            query.AddColumn("Pat Name", 200, FieldValueType.String);
            query.AddColumn("Date", 90, FieldValueType.Date);
            query.GetColumnDetail("Date").StringFormat = "d";
            query.AddColumn("Fee", 100, FieldValueType.Number);
            query.AddColumn("InsPaid+W/O", 120, FieldValueType.Number);
            report.AddPageNum();
            if (!report.SubmitQueries())
            {
                return;
            }
            FormReportComplex FormR = new FormReportComplex(report);

            FormR.ShowDialog();
            DialogResult = DialogResult.OK;
        }
Ejemplo n.º 60
0
        protected void Page_Load(object sender, EventArgs e)
        {
            #region  属性
            string sealName = null;
            #endregion 属性
#warning 没有缓存经常预览与设计不一致

            if (this.Request.QueryString["IsTest"] == "1")
            {
                BP.Sys.SystemConfig.DoClearCash_del();
            }

            if (this.Request.QueryString["IsLoadData"] == "1")
            {
                this.UCEn1.IsLoadData = true;
            }

            MapData md = new MapData();
            md.No = this.FK_MapData;
            if (md.RetrieveFromDBSources() == 0 && md.Name.Length > 3)
            {
                /*如果没有找到,就可能是dtl。*/
                if (md.HisFrmType == FrmType.Url)
                {
                    string no       = Request.QueryString["NO"];
                    string urlParas = "OID=" + this.OID + "&NO=" + no + "&WorkID=" + this.WorkID + "&FK_Node=" + this.FK_Node + "&UserNo=" + WebUser.No + "&SID=" + this.SID;
                    /*如果是URL.*/
                    if (md.Url.Contains("?") == true)
                    {
                        this.Response.Redirect(md.Url + "&" + urlParas, true);
                    }
                    else
                    {
                        this.Response.Redirect(md.Url + "?" + urlParas, true);
                    }
                    return;
                }

                /* 没有找到此map. */
                MapDtl dtl   = new MapDtl(this.FK_MapData);
                GEDtl  dtlEn = dtl.HisGEDtl;
                dtlEn.SetValByKey("OID", this.FID);

                if (dtlEn.EnMap.Attrs.Count <= 0)
                {
                    md.RepairMap();
                    this.Response.Redirect(this.Request.RawUrl, true);
                    return;
                }

                int i = dtlEn.RetrieveFromDBSources();

                string[] paras = this.RequestParas.Split('&');
                foreach (string str in paras)
                {
                    if (string.IsNullOrEmpty(str) || str.Contains("=") == false)
                    {
                        continue;
                    }

                    string[] kvs = str.Split('=');
                    dtlEn.SetValByKey(kvs[0], kvs[1]);
                }
                Width = md.MaxRight + md.MaxLeft * 2 + 10 + "";
                if (float.Parse(Width) < 500)
                {
                    Width = "900";
                }

                Height = md.MaxEnd > md.FrmH ? md.MaxEnd + "" : md.FrmH + "";
                if (float.Parse(Height) <= 800)
                {
                    Height = "800";
                }

                this.UCEn1.Add("<div id=divCCForm style='width:" + Width + "px;height:" + Height + "px' >");

                if (md.HisFrmType == FrmType.FreeFrm)
                {
                    this.UCEn1.BindCCForm(dtlEn, this.FK_MapData, !this.IsEdit, 0, this.IsLoadData);
                }

                if (md.HisFrmType == FrmType.Column4Frm)
                {
                    this.UCEn1.BindCCForm(dtlEn, this.FK_MapData, !this.IsEdit, 0, this.IsLoadData);
                }

                this.AddJSEvent(dtlEn);
                this.UCEn1.Add("</div>");
            }
            else
            {
                /*如果没有找到,就可能是dtl。*/
                if (md.HisFrmType == FrmType.Url)
                {
                    string no       = Request.QueryString["NO"];
                    string urlParas = "OID=" + this.OID + "&NO=" + no + "&WorkID=" + this.WorkID + "&FK_Node=" + this.FK_Node + "&IsEdit=" + this.IsEdit.ToString() + "&UserNo=" + WebUser.No + "&SID=" + this.SID;
                    /*如果是URL.*/
                    if (md.Url.Contains("?") == true)
                    {
                        this.Response.Redirect(md.Url + "&" + urlParas, true);
                    }
                    else
                    {
                        this.Response.Redirect(md.Url + "?" + urlParas, true);
                    }
                    return;
                }

                if (md.HisFrmType == FrmType.WordFrm)
                {
                    string no       = Request.QueryString["NO"];
                    string urlParas = "OID=" + this.OID + "&NO=" + no + "&WorkID=" + this.WorkID + "&FK_Node=" + this.FK_Node + "&UserNo=" + WebUser.No + "&SID=" + this.SID + "&FK_MapData=" + this.FK_MapData + "&OIDPKVal=" + this.OIDPKVal + "&FID=" + this.FID + "&FK_Flow=" + this.FK_Flow;
                    /*如果是URL.*/
                    string   requestParas = this.RequestParas;
                    string[] parasArrary  = this.RequestParas.Split('&');
                    foreach (string str in parasArrary)
                    {
                        if (string.IsNullOrEmpty(str) || str.Contains("=") == false)
                        {
                            continue;
                        }
                        string[] kvs = str.Split('=');
                        if (urlParas.Contains(kvs[0]))
                        {
                            continue;
                        }
                        urlParas += "&" + kvs[0] + "=" + kvs[1];
                    }
                    if (md.Url.Contains("?") == true)
                    {
                        this.Response.Redirect("WordFrm.aspx?1=2" + "&" + urlParas, true);
                    }
                    else
                    {
                        this.Response.Redirect("WordFrm.aspx" + "?" + urlParas, true);
                    }
                    return;
                }

                if (md.HisFrmType == FrmType.ExcelFrm)
                {
                    this.Response.Redirect("FrmExcel.aspx?1=2" + this.RequestParas, true);
                    return;
                }

                GEEntity en = md.HisGEEn;

                #region 求出 who is pk 值.
                int    pk     = this.OID;
                string nodeid = this.FK_Node.ToString();
                if (nodeid != "0" && string.IsNullOrEmpty(this.FK_Flow) == false)
                {
                    /*说明是流程调用它, 就要判断谁是表单的PK.*/
                    FrmNode fn = new FrmNode(this.FK_Flow, this.FK_Node, this.FK_MapData);
                    switch (fn.WhoIsPK)
                    {
                    case WhoIsPK.FID:
                        pk = this.FID;
                        if (pk == 0)
                        {
                            throw new Exception("@没有接收到参数FID");
                        }
                        break;

                    case WhoIsPK.CWorkID:     /*延续流程ID*/
                        pk = this.CWorkID;
                        if (pk == 0)
                        {
                            throw new Exception("@没有接收到参数CWorkID");
                        }
                        break;

                    case WhoIsPK.PWorkID:     /*父流程ID*/
                        pk = this.PWorkID;
                        if (pk == 0)
                        {
                            throw new Exception("@没有接收到参数PWorkID");
                        }
                        break;

                    case WhoIsPK.OID:
                    default:
                        break;
                    }
                }

                en.SetValByKey("OID", pk);
                #endregion 求出pk 值.

                if (en.EnMap.Attrs.Count <= 0)
                {
                    md.RepairMap(); //让他刷新一下,重新进入.
                    this.Response.Redirect(this.Request.RawUrl, true);
                    return;
                }

                //检查实体数据是否存在,并重新设置默认值
                if (en.RetrieveFromDBSources() == 0)
                {
                    en.ResetDefaultValAllAttr();
                    try
                    {
                        en.DirectInsert();
                    }
                    catch (Exception ex)
                    {
                        md.RepairMap();
                        en.CheckPhysicsTable();
                        throw new Exception("@装载出现错误:如果是第一次出现该错误,请刷新一次,系统有可能自动修复了。技术信息:" + ex.Message);
                    }
                }

                string[] paras = this.RequestParas.Split('&');
                foreach (string str in paras)
                {
                    if (string.IsNullOrEmpty(str) || str.Contains("=") == false)
                    {
                        continue;
                    }

                    string[] kvs = str.Split('=');
                    en.SetValByKey(kvs[0], kvs[1]);
                }

                if (en.ToString() == "0")
                {
                    en.SetValByKey("OID", pk);
                }
                this.OIDPKVal = pk;


                #region 处理表单权限控制方案
                Width = md.FrmW.ToString();//md.MaxRight + md.MaxLeft * 2 + 10 + "";
                if (float.Parse(Width) < 500)
                {
                    Width = "900";
                }

                Height = md.MaxEnd > md.FrmH ? md.MaxEnd + "" : md.FrmH + "";
                if (float.Parse(Height) <= 800)
                {
                    Height = "800";
                }

                this.UCEn1.Add("<div id=divCCForm style='width:" + Width + "px;height:" + Height + "px' >");
                if (nodeid != null)
                {
                    this.UCEn1.FK_Node = this.FK_Node;
                    /*处理表单权限控制方案*/
                    this.HisFrmNode = new FrmNode();
                    int ii = this.HisFrmNode.Retrieve(FrmNodeAttr.FK_Frm, this.FK_MapData,
                                                      FrmNodeAttr.FK_Node, int.Parse(nodeid));

                    if (ii == 0 || this.HisFrmNode.FrmSln == 0)
                    {
                        /*说明没有配置,或者方案编号为默认就不用处理,*/
                        this.UCEn1.BindCCForm(en, this.FK_MapData, !this.IsEdit, 0, this.IsLoadData);
                    }
                    else
                    {
                        BP.Sys.FrmFields fls = new BP.Sys.FrmFields(this.FK_MapData, this.HisFrmNode.FrmSln);
                        //求出集合.
                        MapAttrs mattrs = new MapAttrs(this.FK_MapData);
                        foreach (BP.Sys.FrmField item in fls)
                        {
                            foreach (MapAttr attr in mattrs)
                            {
                                if (attr.KeyOfEn != item.KeyOfEn)
                                {
                                    continue;
                                }

                                if (item.IsSigan)
                                {
                                    item.UIIsEnable = false;
                                }
                                if (attr.SignType == SignType.CA)
                                {
                                    long        workId  = Convert.ToInt64(this.OID);
                                    FrmField    keyOfEn = new FrmField();
                                    QueryObject info    = new QueryObject(keyOfEn);
                                    info.AddWhere(FrmFieldAttr.FK_Node, this.FK_Node);
                                    info.addAnd();
                                    info.AddWhere(FrmFieldAttr.FK_MapData, attr.FK_MapData);
                                    info.addAnd();
                                    info.AddWhere(FrmFieldAttr.KeyOfEn, attr.KeyOfEn);
                                    info.addAnd();
                                    info.AddWhere(MapAttrAttr.UIIsEnable, "1");
                                    if (info.DoQuery() > 0)
                                    {
                                        sealName = en.GetValStrByKey(attr.KeyOfEn);
                                    }
                                }

                                attr.UIIsEnable = item.UIIsEnable;
                                attr.UIVisible  = item.UIVisible;
                                attr.IsSigan    = item.IsSigan;
                                attr.DefValReal = item.DefVal;
                            }
                        }

                        #region 设置默认值.
                        if (this.IsEdit == true)
                        {
                            bool isHave = false;
                            foreach (MapAttr attr in mattrs)
                            {
                                //if (attr.UIIsEnable)
                                //    continue;

                                if (attr.DefValReal.Contains("@") == false)
                                {
                                    continue;
                                }

                                en.SetValByKey(attr.KeyOfEn, attr.DefVal);
                                isHave = true;
                            }
                            if (isHave)
                            {
                                en.DirectUpdate(); //让其直接更新.
                            }
                        }
                        #endregion 设置默认值.

                        //按照当前方案绑定表单.

                        /*
                         * 修改说明:如果是自定义方案,就不要装载填充了.
                         */

                        ////是否要重新装载数据.
                        bool isLoadData = this.IsLoadData;
                        if (this.HisFrmNode.IsEnableLoadData == true)
                        {
                            /*如果允许启用.*/
                        }
                        else
                        {
                            isLoadData = false;
                        }

                        this.UCEn1.BindCCForm(en, md, mattrs, this.FK_MapData, !this.IsEdit, Int64.Parse(Width), isLoadData);

                        #region 检查必填项
                        string scriptCheckFrm = "";
                        scriptCheckFrm += "\t\n<script type='text/javascript' >";
                        scriptCheckFrm += "\t\n function CheckFrmSlnIsNull(){ ";
                        scriptCheckFrm += "\t\n var isPass = true;";
                        scriptCheckFrm += "\t\n var alloweSave = true;";
                        scriptCheckFrm += "\t\n var erroMsg = '提示信息:';";

                        //表单权限设置为必填项
                        //查询出来,需要不为空的
                        Paras ps = new Paras();
                        ps.SQL = "SELECT KeyOfEn, Name FROM Sys_FrmSln WHERE FK_MapData=" + ps.DBStr + "FK_MapData AND FK_Node=" + ps.DBStr + "FK_Node AND IsNotNull=" + ps.DBStr + "IsNotNull";
                        ps.Add(BP.Sys.FrmFieldAttr.FK_MapData, this.FK_MapData);
                        ps.Add(BP.Sys.FrmFieldAttr.FK_Node, this.FK_Node);
                        ps.Add(BP.Sys.FrmFieldAttr.IsNotNull, 1);

                        //查询
                        System.Data.DataTable dtKeys = DBAccess.RunSQLReturnTable(ps);
                        // 检查数据是否完整.
                        foreach (System.Data.DataRow dr in dtKeys.Rows)
                        {
                            string             key        = dr[0].ToString();
                            string             name       = dr[1].ToString();
                            BP.Web.Controls.TB TB_NotNull = this.UCEn1.GetTBByID("TB_" + key);
                            if (TB_NotNull != null)
                            {
                                scriptCheckFrm += "\t\n try{  ";
                                scriptCheckFrm += "\t\n var element = document.getElementById('" + TB_NotNull.ClientID + "');";
                                //验证输入的正则格式
                                scriptCheckFrm += "\t\n if(element && element.readOnly == true) return;";
                                scriptCheckFrm += "\t\n isPass = EleSubmitCheck(element,'.{1}','" + name + ",不能为空。');";
                                scriptCheckFrm += "\t\n  if(isPass == false){";
                                scriptCheckFrm += "\t\n    alloweSave = false;";
                                scriptCheckFrm += "\t\n    erroMsg += '" + name + ",不能为空。';";
                                scriptCheckFrm += "\t\n  }";
                                scriptCheckFrm += "\t\n } catch(e) { ";
                                scriptCheckFrm += "\t\n  alert(e.name  + e.message);  return false;";
                                scriptCheckFrm += "\t\n } ";
                            }
                        }
                        scriptCheckFrm += "\t\n return alloweSave; } ";
                        scriptCheckFrm += "\t\n</script>";
                        #endregion
                        //检查必填项
                        this.UCEn1.Add(scriptCheckFrm);
                    }
                }
                else
                {
                    this.UCEn1.BindCCForm(en, this.FK_MapData, !this.IsEdit, 0, this.IsLoadData);
                }
                this.UCEn1.Add("</div>");
                #endregion

                if (!IsPostBack)
                {
                    if (md.IsHaveCA)
                    {
                        //#region 检查是否有ca签名.
                        //if (md.IsHaveCA == true)
                        //{
                        //    if (string.IsNullOrEmpty(sealName))
                        //        sealName = WebUser.No;

                        //    string basePath = Server.MapPath("~/DataUser/Siganture/" + WorkID);

                        //    if (!System.IO.Directory.Exists(basePath))
                        //    {
                        //        System.IO.Directory.CreateDirectory(basePath);
                        //    }

                        //    // basePath = "C:\\";

                        //    this.TB_SealFile.Text = basePath + "\\" + sealName + ".jpg";

                        //    #region 获取存储的 签名信息

                        //    BP.Tools.WFSealData sealData = new BP.Tools.WFSealData();
                        //    sealData.RetrieveByAttrAnd(BP.Tools.WFSealDataAttr.OID, WorkID, BP.Tools.WFSealDataAttr.FK_Node, FK_Node);
                        //    //sealData.RetrieveFromDBSources();
                        //    if (!string.IsNullOrEmpty(sealData.SealData))
                        //    {
                        //        this.TB_SealData.Text = sealData.SealData;
                        //    }
                        //    #endregion

                        //    //this.TB_SealData.Text = en.GetValStringByKey("SealData");
                        //}
                        //#endregion 检查是否有ca签名.
                    }
                }
                this.AddJSEvent(en);
            }

            Session["Count"]        = null;
            this.Btn_Save.Click    += new EventHandler(Btn_Save_Click);
            this.Btn_Save.Visible   = this.HisFrmNode.IsEdit;
            this.Btn_Save.Enabled   = this.HisFrmNode.IsEdit;
            this.Btn_Save.BackColor = System.Drawing.Color.White;
            Node curNd = new Node();
            curNd.NodeID = this.FK_Node;
            curNd.RetrieveFromDBSources();

            if (curNd.FormType == NodeFormType.SheetTree)
            {
                this.Btn_Save.Visible  = true;
                this.Btn_Save.Enabled  = true;
                this.Btn_Print.Enabled = false;
                this.Btn_Print.Visible = false;
            }
            else
            {
                this.Btn_Print.Visible = this.HisFrmNode.IsPrint;
                this.Btn_Print.Enabled = this.HisFrmNode.IsPrint;
                this.Btn_Print.Attributes["onclick"] = "window.open('Print.aspx?FK_Node=" + this.FK_Node + "&FID=" + this.FID + "&FK_MapData=" + this.FK_MapData + "&WorkID=" + this.OID + "', '', 'dialogHeight: 350px; dialogWidth:450px; center: yes; help: no'); return false;";
            }
        }