Пример #1
0
        private string CalcMaskRegionForSelectedRegions(ReportProperty priceProp, string[] pricePropNames, string[] regionPropNames)
        {
            if (pricePropNames.Contains(priceProp.PropertyType.PropertyName))
            {
                // получаем свойство 'Список значений "Прайс"'
                var prices = reportProperties.FirstOrDefault(p => pricePropNames.Contains(p.PropertyType.PropertyName));

                decimal regionMask = 0;
                string  pricesStr  = String.Empty;
                // получаем свойство 'Список значений "Региона"'
                var regEqual = reportProperties.FirstOrDefault(p => regionPropNames.Contains(p.PropertyType.PropertyName));
                if (regEqual != null)
                {
                    regionMask = regEqual.Values.Select(v => {
                        UInt64 regionCode;
                        return(UInt64.TryParse(v.Value, out regionCode) ? regionCode : Convert.ToUInt64(0));
                    }).Sum(r => Convert.ToDecimal(r));
                }
                if (prices != null)
                {
                    var priceCodes = prices.Values.Select(v => {
                        int priceCode;
                        if (Int32.TryParse(v.Value, out priceCode))
                        {
                            return(priceCode);
                        }
                        return(-1);
                    }).Where(v => v >= 0);
                    pricesStr = priceCodes.Implode(",");
                }
                return(String.Format("inID={0}&inFilter={1}", Convert.ToUInt64(regionMask), pricesStr));
            }
            return(String.Empty);
        }
Пример #2
0
        internal static byte?GetNonCompiledEnumProp(byte styleAttributeRplId, StyleAttributeNames styleAttributeName, Style style, StyleInstance styleIntance)
        {
            if (style == null)
            {
                return(null);
            }
            ReportProperty reportProperty = style[styleAttributeName];

            if (reportProperty == null)
            {
                return(null);
            }
            if (reportProperty.IsExpression)
            {
                if (styleIntance != null)
                {
                    object obj = styleIntance[styleAttributeName];
                    if (obj != null)
                    {
                        bool convertToString = false;
                        return(PageItem.GetStylePropByte(styleAttributeRplId, obj, ref convertToString));
                    }
                }
                return(null);
            }
            return(PageItem.GetStylePropByte(styleAttributeRplId, reportProperty));
        }
Пример #3
0
        public void AddressTest()
        {
            var controller = new ReportsTuningController();

            Prepare(controller);
            controller.DbSession = session;
            var reportType     = session.Query <ReportType>().First(rt => rt.ReportTypeFilePrefix == "Mixed");
            var report         = session.Query <Report>().First(r => r.ReportType == reportType);
            var propertyType   = session.Query <ReportTypeProperty>().First(rpt => rpt.ReportType == reportType && rpt.PropertyName == "AddressesEqual");
            var reportProperty = new ReportProperty {
                Value        = "1",
                Report       = report,
                PropertyType = propertyType
            };

            reportProperty.Save();
            var value = new ReportPropertyValue {
                ReportPropertyId = reportProperty.Id,
                Value            = "0"
            };

            value.Save();
            reportProperty.Values = new List <ReportPropertyValue> {
                value
            };
            reportProperty.Save();
            var filter = new AddressesFilter {
                Report              = report.Id,
                GeneralReport       = 1u,
                ReportPropertyValue = reportProperty.Id
            };

            controller.SelectAddresses(filter);
            Assert.IsNotNull(controller.PropertyBag["addresses"]);
        }
Пример #4
0
        public ActionResult GetDataWaving(ReportProperty rp)
        {
            List <ReportListWaving> result = new List <ReportListWaving>();

            using (HELLOWEntities db = new HELLOWEntities())
            {
                result = (from td in db.tt_TransactionDetail
                          join t in db.tt_Transaction on td.Transaction_FK equals t.Transaction_PK
                          join mesin in db.tm_Mesin on t.Mesin_FK equals mesin.Mesin_PK
                          join statmesin in db.tm_StatusMesin on mesin.StatusMesin_FK equals statmesin.StatusMesin_PK
                          join daily in db.tt_Daily on t.Daily_FK equals daily.Daily_PK
                          join kodewarna in db.tm_KodeWarna on t.KodeWarna_FK equals kodewarna.KodeWarna_PK
                          join op in db.tm_Operator on td.Operator_FK equals op.Operator_PK
                          where daily.Status_FK == 1 && t.Status_FK == 1 && td.Status_FK == 1 && daily.Date >= rp.startdate && daily.Date <= rp.enddate
                          select new ReportListWaving
                {
                    NoOperator = op.NoOperator.ToString(),
                    NIP = op.NIP,
                    Nama = op.Nama,
                    HasilKain = td.HasilKain,
                    Total = Math.Round(kodewarna.Pick * statmesin.Nilai * td.HasilKain, 2)
                }).GroupBy(l => l.NoOperator)
                         .Select(cl => new ReportListWaving
                {
                    NoOperator = cl.FirstOrDefault().NoOperator,
                    NIP        = cl.FirstOrDefault().NIP,
                    Nama       = cl.FirstOrDefault().Nama,
                    HasilKain  = cl.Sum(x => x.HasilKain),
                    Total      = cl.Sum(x => x.Total)
                }).ToList();
            }
            return(Json(new { data = result }, JsonRequestBehavior.AllowGet));
        }
Пример #5
0
        public static byte?GetNonCompiledEnumProp(byte styleAttributeRplId, StyleAttributeNames styleAttributeName, Style style, StyleInstance styleIntance)
        {
            if (style == null)
            {
                return(null);
            }
            ReportProperty reportProperty = ((StyleBase)style)[styleAttributeName];

            if (reportProperty == null)
            {
                return(null);
            }
            if (reportProperty.IsExpression)
            {
                if (styleIntance != null)
                {
                    object obj = ((StyleBaseInstance)styleIntance)[styleAttributeName];
                    if (obj != null)
                    {
                        bool flag = false;
                        return(PageItem.GetStylePropByte(styleAttributeRplId, obj, ref flag));
                    }
                }
                return(null);
            }
            return(PageItem.GetStylePropByte(styleAttributeRplId, reportProperty));
        }
Пример #6
0
        public ActionResult GetDataInspect(ReportProperty rp)
        {
            List <ReportListWaving> result = new List <ReportListWaving>();

            using (HELLOWEntities db = new HELLOWEntities())
            {
                result = (from t in db.tt_Transaction
                          join daily in db.tt_Daily on t.Daily_FK equals daily.Daily_PK
                          join rc in db.tm_Recorder on daily.Recorder_FK equals rc.Recorder_PK
                          where daily.Status_FK == 1 && t.Status_FK == 1 && daily.Date >= rp.startdate && daily.Date <= rp.enddate
                          select new ReportListWaving
                {
                    NoOperator = rc.NoRecorder.ToString(),
                    NIP = rc.NIP,
                    Nama = rc.Nama,
                    HasilKain = db.tt_TransactionDetail.Where(x => x.Transaction_FK == t.Transaction_PK).Sum(i => ((Double?)i.HasilKain) ?? 0) + (t.Penambahan ?? 0.0)
                }).GroupBy(l => l.NoOperator)
                         .Select(cl => new ReportListWaving
                {
                    NoOperator = cl.FirstOrDefault().NoOperator,
                    NIP        = cl.FirstOrDefault().NIP,
                    Nama       = cl.FirstOrDefault().Nama,
                    HasilKain  = cl.Sum(x => x.HasilKain),
                }).ToList();
                foreach (var item in result)
                {
                    item.Total = item.HasilKain * 25;
                }
            }
            return(Json(new { data = result }, JsonRequestBehavior.AllowGet));
        }
Пример #7
0
        public ActionResult GetDataInspectD(ReportProperty rp)
        {
            List <ReportListInspect> result = new List <ReportListInspect>();

            using (HELLOWEntities db = new HELLOWEntities())
            {
                var res = (from t in db.tt_Transaction
                           join mesin in db.tm_Mesin on t.Mesin_FK equals mesin.Mesin_PK
                           join daily in db.tt_Daily on t.Daily_FK equals daily.Daily_PK
                           where daily.Status_FK == 1 && t.Status_FK == 1 && daily.Recorder_FK == rp.Operator && daily.Date >= rp.startdate && daily.Date <= rp.enddate
                           select new ReportListInspect
                {
                    Tanggal = daily.Date.ToString(),
                    SheetNum = daily.SheetNum,
                    NoMesin = mesin.KodeMesin.ToString(),
                    HasilKain = db.tt_TransactionDetail.Where(x => x.Transaction_FK == t.Transaction_PK).Sum(i => (Double?)i.HasilKain) + (t.Penambahan.HasValue ? t.Penambahan.Value : 0.0) ?? 0
                }).GroupBy(l => l.SheetNum)
                          .Select(cl => new ReportListInspect
                {
                    Tanggal   = cl.FirstOrDefault().Tanggal,
                    SheetNum  = cl.FirstOrDefault().SheetNum,
                    NoMesin   = cl.FirstOrDefault().NoMesin,
                    HasilKain = cl.Sum(x => x.HasilKain),
                }).ToList();;

                result = res.ToList();

                foreach (var item in result)
                {
                    item.Total = item.HasilKain * 25;
                }
            }
            return(Json(new { data = result }, JsonRequestBehavior.AllowGet));
        }
Пример #8
0
        public ActionResult GetSumInspectD(ReportProperty rp)
        {
            List <ReportListInspect> result = new List <ReportListInspect>();

            using (HELLOWEntities db = new HELLOWEntities())
            {
                result = (from t in db.tt_Transaction
                          join daily in db.tt_Daily on t.Daily_FK equals daily.Daily_PK
                          where daily.Status_FK == 1 && t.Status_FK == 1 && daily.Recorder_FK == rp.Operator && daily.Date >= rp.startdate && daily.Date <= rp.enddate
                          select new ReportListInspect
                {
                    Tanggal = daily.Date.ToString(),
                    SheetNum = daily.SheetNum,
                    NoMesin = t.Mesin_FK.ToString(),
                    HasilKain = db.tt_TransactionDetail.Where(x => x.Transaction_FK == t.Transaction_PK).Sum(i => (Double?)i.HasilKain) + (t.Penambahan.HasValue ? t.Penambahan.Value : 0.0) ?? 0
                }).ToList();
                double summary = 0;
                foreach (var item in result)
                {
                    item.Total = item.HasilKain * 25;
                    summary   += item.Total;
                }
                summary = Math.Round(summary, 2);
                return(Json(new { data = summary }, JsonRequestBehavior.AllowGet));
            }
        }
Пример #9
0
        public ActionResult GetDataInspect(ReportProperty rp)
        {
            List <ReportPerMesin> result = new List <ReportPerMesin>();

            using (HELLOWEntities db = new HELLOWEntities())
            {
                result = (from td in db.tt_TransactionDetail
                          join t in db.tt_Transaction on td.Transaction_FK equals t.Transaction_PK
                          join mesin in db.tm_Mesin on t.Mesin_FK equals mesin.Mesin_PK
                          join statmesin in db.tm_StatusMesin on mesin.StatusMesin_FK equals statmesin.StatusMesin_PK
                          join daily in db.tt_Daily on t.Daily_FK equals daily.Daily_PK
                          join kodewarna in db.tm_KodeWarna on t.KodeWarna_FK equals kodewarna.KodeWarna_PK
                          join op in db.tm_Operator on td.Operator_FK equals op.Operator_PK
                          where daily.Status_FK == 1 && t.Status_FK == 1 && td.Status_FK == 1 && daily.Date >= rp.startdate && daily.Date <= rp.enddate
                          select new ReportPerMesin
                {
                    NoMesin = mesin.KodeMesin,
                    HasilKain = td.HasilKain
                }).GroupBy(l => l.NoMesin)
                         .Select(cl => new ReportPerMesin
                {
                    NoMesin   = cl.FirstOrDefault().NoMesin,
                    HasilKain = cl.Sum(x => x.HasilKain),
                }).ToList();
            }
            return(Json(new { data = result }, JsonRequestBehavior.AllowGet));
        }
Пример #10
0
        public ActionResult GetSum(ReportProperty rp)
        {
            List <ReportList> result = new List <ReportList>();

            using (HELLOWEntities db = new HELLOWEntities())
            {
                result = (from td in db.tt_TransactionDetail
                          join t in db.tt_Transaction on td.Transaction_FK equals t.Transaction_PK
                          join mesin in db.tm_Mesin on t.Mesin_FK equals mesin.Mesin_PK
                          join statmesin in db.tm_StatusMesin on mesin.StatusMesin_FK equals statmesin.StatusMesin_PK
                          join daily in db.tt_Daily on t.Daily_FK equals daily.Daily_PK
                          join kodewarna in db.tm_KodeWarna on t.KodeWarna_FK equals kodewarna.KodeWarna_PK
                          where daily.Status_FK == 1 && t.Status_FK == 1 && td.Status_FK == 1 && td.Operator_FK == rp.Operator && daily.Date >= rp.startdate && daily.Date <= rp.enddate
                          select new ReportList
                {
                    Tanggal = daily.Date.ToString(),
                    KodeWarna = kodewarna.KodeWarna,
                    StatusMesin = statmesin.Status,
                    HasilKain = td.HasilKain,
                    Pick = kodewarna.Pick,
                    Nilai = statmesin.Nilai,
                    HargaMeter = Math.Round(kodewarna.Pick * statmesin.Nilai, 2),
                    Total = Math.Round(kodewarna.Pick * statmesin.Nilai * td.HasilKain, 2)
                }).ToList();
                double summary = 0;
                foreach (var item in result)
                {
                    summary += item.Total;
                }
                summary = Math.Round(summary, 2);
                return(Json(new { data = summary }, JsonRequestBehavior.AllowGet));
            }
        }
Пример #11
0
        internal static void AddStyle(byte rplId, ReportProperty prop, StyleWriter writer)
        {
            byte?stylePropByte = PageItem.GetStylePropByte(rplId, prop);

            if (stylePropByte.HasValue)
            {
                writer.Write(rplId, stylePropByte.Value);
            }
        }
Пример #12
0
        public static void AddStyle(byte rplId, ReportProperty prop, StyleWriter writer)
        {
            byte?stylePropByte = PageItem.GetStylePropByte(rplId, prop);
            int? nullable      = stylePropByte;

            if (nullable.HasValue)
            {
                writer.Write(rplId, stylePropByte.Value);
            }
        }
Пример #13
0
 internal static void WriteSharedStyles(StyleWriter writeTo, Style styleDef)
 {
     foreach (StyleAttributeNames sharedStyleAttribute in styleDef.SharedStyleAttributes)
     {
         ReportProperty reportProperty = styleDef[sharedStyleAttribute];
         if (reportProperty != null)
         {
             WriteStyleProperty(writeTo, sharedStyleAttribute, reportProperty);
         }
     }
 }
Пример #14
0
        public ActionResult GetPoin(ReportProperty rp)
        {
            List <PointoCountList> result = new List <PointoCountList>();

            using (OCBCTestEntities1 db = new OCBCTestEntities1())
            {
                result = (from td in db.tt_Transaction
                          join n in db.tm_Nasabah on td.AccountID equals n.AccountID
                          select new PointoCountList
                {
                    AccountID = td.AccountID,
                    Nama = n.Nama,
                    Amount = td.Amount,
                    Description = td.Description
                }).ToList();
                foreach (var item in result)
                {
                    if (item.Description == "Beli Pulsa")
                    {
                        if (item.Amount > 30000)
                        {
                            item.poin += Convert.ToInt32((item.Amount / 1000) * 2);
                        }
                        else if (item.Amount > 10000)
                        {
                            item.poin += Convert.ToInt32((item.Amount / 1000));
                        }
                    }
                    else if (item.Description == "Bayar Listrik")
                    {
                        if (item.Amount > 100000)
                        {
                            item.poin += Convert.ToInt32((item.Amount / 2000) * 2);
                        }
                        else if (item.Amount > 50000)
                        {
                            item.poin += Convert.ToInt32((item.Amount / 2000));
                        }
                    }
                }
                result = result.GroupBy(l => l.AccountID)
                         .Select(cl => new PointoCountList
                {
                    AccountID   = cl.FirstOrDefault().AccountID,
                    Nama        = cl.FirstOrDefault().Nama,
                    Description = "",
                    Amount      = 0,
                    poin        = cl.Sum(x => x.poin),
                }).ToList();;
            }
            return(Json(new { data = result }, JsonRequestBehavior.AllowGet));
        }
Пример #15
0
        public static void WriteSharedStyles(StyleWriter writeTo, Style styleDef)
        {
            List <StyleAttributeNames> sharedStyleAttributes = styleDef.SharedStyleAttributes;

            foreach (StyleAttributeNames item in sharedStyleAttributes)
            {
                ReportProperty reportProperty = ((StyleBase)styleDef)[item];
                if (reportProperty != null)
                {
                    Utility.WriteStyleProperty(writeTo, item, reportProperty);
                }
            }
        }
Пример #16
0
        public ActionResult DownloadWaving(ReportProperty rp)
        {
            List <ReportListWaving> result = new List <ReportListWaving>();

            using (HELLOWEntities db = new HELLOWEntities())
            {
                result = (from td in db.tt_TransactionDetail
                          join t in db.tt_Transaction on td.Transaction_FK equals t.Transaction_PK
                          join mesin in db.tm_Mesin on t.Mesin_FK equals mesin.Mesin_PK
                          join statmesin in db.tm_StatusMesin on mesin.StatusMesin_FK equals statmesin.StatusMesin_PK
                          join daily in db.tt_Daily on t.Daily_FK equals daily.Daily_PK
                          join kodewarna in db.tm_KodeWarna on t.KodeWarna_FK equals kodewarna.KodeWarna_PK
                          join op in db.tm_Operator on td.Operator_FK equals op.Operator_PK
                          where daily.Status_FK == 1 && t.Status_FK == 1 && td.Status_FK == 1 && daily.Date >= rp.startdate && daily.Date <= rp.enddate
                          select new ReportListWaving
                {
                    NoOperator = op.NoOperator.ToString(),
                    NIP = op.NIP,
                    Nama = op.Nama,
                    HasilKain = td.HasilKain,
                    Total = Math.Round(kodewarna.Pick * statmesin.Nilai * td.HasilKain, 2)
                }).GroupBy(l => l.NoOperator)
                         .Select(cl => new ReportListWaving
                {
                    NoOperator = cl.FirstOrDefault().NoOperator,
                    NIP        = cl.FirstOrDefault().NIP,
                    Nama       = cl.FirstOrDefault().Nama,
                    HasilKain  = cl.Sum(x => x.HasilKain),
                    Total      = cl.Sum(x => x.Total)
                }).ToList();
            }

            XLWorkbook wb = new XLWorkbook();
            DataTable  dt = DataCommonHelper.ConvertListToDataTable(result, string.Empty);

            wb.Worksheets.Add(dt, "GajiWaving");
            IXLWorksheet ws = wb.Worksheet(1);

            string       myName = Server.UrlEncode("GajiWaving.xlsx");
            MemoryStream stream = GetStream(wb);// The method is defined below

            Response.Clear();
            Response.Buffer = true;
            Response.AddHeader("content-disposition",
                               "attachment; filename=" + myName);
            Response.ContentType = "application/vnd.ms-excel";
            Response.BinaryWrite(stream.ToArray());
            Response.End();
            return(View());
        }
Пример #17
0
        public ActionResult DownloadInspect(ReportProperty rp)
        {
            List <ReportListWaving> result = new List <ReportListWaving>();

            using (HELLOWEntities db = new HELLOWEntities())
            {
                result = (from t in db.tt_Transaction
                          join daily in db.tt_Daily on t.Daily_FK equals daily.Daily_PK
                          join rc in db.tm_Recorder on daily.Recorder_FK equals rc.Recorder_PK
                          where daily.Status_FK == 1 && t.Status_FK == 1 && daily.Date >= rp.startdate && daily.Date <= rp.enddate
                          select new ReportListWaving
                {
                    NoOperator = rc.NoRecorder.ToString(),
                    NIP = rc.NIP,
                    Nama = rc.Nama,
                    HasilKain = db.tt_TransactionDetail.Where(x => x.Transaction_FK == t.Transaction_PK).Sum(i => ((Double?)i.HasilKain) ?? 0) + (t.Penambahan ?? 0.0)
                }).GroupBy(l => l.NoOperator)
                         .Select(cl => new ReportListWaving
                {
                    NoOperator = cl.FirstOrDefault().NoOperator,
                    NIP        = cl.FirstOrDefault().NIP,
                    Nama       = cl.FirstOrDefault().Nama,
                    HasilKain  = cl.Sum(x => x.HasilKain),
                }).ToList();
                foreach (var item in result)
                {
                    item.Total = item.HasilKain * 25;
                }
            }

            XLWorkbook wb = new XLWorkbook();
            DataTable  dt = DataCommonHelper.ConvertListToDataTable(result, string.Empty);

            wb.Worksheets.Add(dt, "GajiInspect");
            IXLWorksheet ws = wb.Worksheet(1);

            string       myName = Server.UrlEncode("GajiInspect.xlsx");
            MemoryStream stream = GetStream(wb);// The method is defined below

            Response.Clear();
            Response.Buffer = true;
            Response.AddHeader("content-disposition",
                               "attachment; filename=" + myName);
            Response.ContentType = "application/vnd.ms-excel";
            Response.BinaryWrite(stream.ToArray());
            Response.End();
            return(View());
        }
Пример #18
0
        private ReportSize GetStyleValue(StyleAttributeNames styleName)
        {
            object         obj            = null;
            ReportProperty reportProperty = m_source.Style[styleName];

            if (reportProperty != null)
            {
                if (reportProperty.IsExpression)
                {
                    obj = GetStyleInstance(m_source, null)[styleName];
                }
                if (obj == null)
                {
                    obj = ((ReportSizeProperty)reportProperty).Value;
                }
            }
            return(obj as ReportSize);
        }
Пример #19
0
 private string GetUserByClient(ReportProperty selectedProp, string[] suppliersPropNames, string[] clientPropNames, string userPropName)
 {
     if (suppliersPropNames.Contains(selectedProp.PropertyType.PropertyName))
     {
         // получаем свойство "Пользователь" (если выбрано)
         DataRow drUser = dtOptionalParams.Rows.Cast <DataRow>().Where(r => r["OPPropertyName"].ToString() == userPropName).FirstOrDefault();
         uint?   userid = null;
         if (drUser != null)
         {
             if (!(drUser["OPPropertyValue"] is DBNull))
             {
                 userid = Convert.ToUInt32(drUser["OPPropertyValue"]);
             }
         }
         else
         {
             // получаем свойство "Клиент"
             var drClient = dtNonOptionalParams.Rows.Cast <DataRow>().FirstOrDefault(r => clientPropNames.Contains(r["PPropertyName"].ToString()));
             if (drClient != null)
             {
                 using (new SessionScope()) {
                     if (!(drClient["PPropertyValue"] is DBNull))
                     {
                         uint   clientId = Convert.ToUInt32(drClient["PPropertyValue"]);                               // код клиента
                         Client client   = Client.TryFind(clientId);
                         if (client != null)
                         {
                             var user = client.Users.FirstOrDefault();
                             if (user != null)
                             {
                                 userid = user.Id;
                             }
                         }
                     }
                 }
             }
         }
         if (userid != null)
         {
             return(String.Format("userId={0}", userid));
         }
     }
     return(String.Empty);
 }
Пример #20
0
 private string CalcMaskRegionByClient(ReportProperty regionProp, string[] regionPropNames, string[] clientPropNames)
 {
     if (regionPropNames.Contains(regionProp.PropertyType.PropertyName))
     {
         // получаем свойство "Клиент"
         DataRow dr = dtNonOptionalParams.Rows.Cast <DataRow>().Where(r => clientPropNames.Contains(r["PPropertyName"].ToString())).FirstOrDefault();
         if (dr != null)
         {
             using (new SessionScope()) {
                 // текущий список регионов
                 var regEqual =
                     reportProperties.Where(p => p.PropertyType.PropertyName == regionProp.PropertyType.PropertyName).FirstOrDefault();
                 if (!(dr["PPropertyValue"] is DBNull))
                 {
                     uint   clientId = Convert.ToUInt32(dr["PPropertyValue"]);                           // код клиента
                     Client client   = Client.TryFind(clientId);
                     if (client != null)
                     {
                         long clientMaskRegion = client.MaskRegion;
                         var  regionMask       = clientMaskRegion;
                         if (regEqual != null)
                         {
                             regionMask = clientMaskRegion + regEqual.Values
                                          .Select(v => {
                                 uint reg;
                                 if (UInt32.TryParse(v.Value, out reg))
                                 {
                                     return(reg);
                                 }
                                 return(0u);
                             })
                                          .Where(r => r > 0 && (r & clientMaskRegion) == 0).Sum(r => r);
                         }
                         // маска для списка регионов, недоступных клиенту
                         return(String.Format("inID={0}", regionMask));
                         // результирующая маска, включает доступные и ранее выбранные недоступные клиенту регионы
                     }
                 }
             }
         }
     }
     return(String.Empty);
 }
Пример #21
0
        private ReportSize GetStyleValue(StyleAttributeNames styleName)
        {
            object         obj            = null;
            ReportProperty reportProperty = ((StyleBase)base.m_source.Style)[styleName];

            if (reportProperty != null)
            {
                if (reportProperty.IsExpression)
                {
                    StyleInstance styleInstance = base.GetStyleInstance(base.m_source, null);
                    obj = ((StyleBaseInstance)styleInstance)[styleName];
                }
                if (obj == null)
                {
                    obj = ((ReportSizeProperty)reportProperty).Value;
                }
            }
            return(obj as ReportSize);
        }
Пример #22
0
        private static ReportSize GetStyleValue(StyleAttributeNames styleName, ref bool shared, ReportItem source)
        {
            object         obj            = null;
            ReportProperty reportProperty = source.Style[styleName];

            if (reportProperty != null)
            {
                if (reportProperty.IsExpression)
                {
                    shared = false;
                    obj    = source.Instance.Style[styleName];
                }
                if (obj == null)
                {
                    obj = ((ReportSizeProperty)reportProperty).Value;
                }
            }
            return(obj as ReportSize);
        }
Пример #23
0
        public ActionResult GetData(ReportProperty rp)
        {
            List <Transaksi> result = new List <Transaksi>();

            using (OCBCTestEntities1 db = new OCBCTestEntities1())
            {
                result = (from x in db.tt_Transaction
                          where x.AccountID == rp.Operator && (x.TransDate >= rp.startdate && x.TransDate <= rp.enddate)
                          select new Transaksi
                {
                    TransactionID = x.TransactionID,
                    AccountID = x.AccountID,
                    TransDate = x.TransDate.ToString(),
                    Description = x.Description,
                    DebitCreditStatus = x.DebitCreditStatus,
                    Amount = x.Amount
                }).ToList();
            }
            return(Json(new { data = result }, JsonRequestBehavior.AllowGet));
        }
Пример #24
0
        internal static byte?GetEnumProp(byte rplId, StyleAttributeNames styleAttributeName, Style styleDef, Dictionary <byte, object> styles)
        {
            object value = null;

            if (styles != null && styles.TryGetValue(rplId, out value))
            {
                byte?b = value as byte?;
                if (b.HasValue)
                {
                    return(b.Value);
                }
            }
            ReportProperty reportProperty = styleDef[styleAttributeName];

            if (reportProperty != null && !reportProperty.IsExpression)
            {
                return(PageItem.GetStylePropByte(rplId, reportProperty));
            }
            return(null);
        }
            private static ExceptionData GetExceptionDataFromReportException(ReportException ex)
            {
                PropertySet properties = null;

                foreach (object obj in ex.Properties)
                {
                    ReportProperty property = obj as ReportProperty;
                    if (property != null && property.Value != null)
                    {
                        if (properties == null)
                        {
                            properties = new PropertySet();
                        }
                        properties[property.Name] = property.Value;
                    }
                }

                return(new ExceptionData(ex.Type ?? "", ex.Message ?? "", ex.StackTrace ?? "",
                                         properties ?? ExceptionData.NoProperties,
                                         ex.Exception != null ? GetExceptionDataFromReportException(ex.Exception) : null));
            }
Пример #26
0
        public static byte?GetEnumProp(byte rplId, StyleAttributeNames styleAttributeName, Style styleDef, Dictionary <byte, object> styles)
        {
            object obj = null;

            if (styles != null && styles.TryGetValue(rplId, out obj))
            {
                byte?nullable  = (byte?)(object)(obj as byte?);
                int? nullable2 = nullable;
                if (nullable2.HasValue)
                {
                    return(nullable.Value);
                }
            }
            ReportProperty reportProperty = ((StyleBase)styleDef)[styleAttributeName];

            if (reportProperty != null && !reportProperty.IsExpression)
            {
                return(PageItem.GetStylePropByte(rplId, reportProperty));
            }
            return(null);
        }
Пример #27
0
    private ReportProperty GetReportProperty(DataRowView row)
    {
        string columnName;

        if (row.Row.Table.Columns.Contains(PID.ColumnName))
        {
            columnName = PID.ColumnName;
        }
        else
        {
            columnName = OPID.ColumnName;
        }

        var id       = Convert.ToUInt64(row[columnName]);
        var property = ReportProperty.Find(id);

        //тк мы во время одной сессии можем значала загрузить объект
        //потом с помощью dataset его обновить
        //повторного запроса к базе не будет тк объект уже в сессии
        //и мы увидем старые данные
        //что бы этого изюежать явно запрашиваем обновленные данные
        property.Refresh();
        return(property);
    }
Пример #28
0
        public void AddNewOptions()
        {
            ulong reportTypeCode = 1;

            using (new SessionScope()) {
                var reports = Report.Queryable.Where(r => r.ReportType.Id == reportTypeCode).ToList();

                var prop_types = ReportTypeProperty.Queryable
                                 .Where(pt => pt.ReportType.Id == reportTypeCode)
                                 .Where(pt => pt.PropertyName == "ByBaseCosts" ||
                                        pt.PropertyName == "PriceCodeEqual" ||
                                        pt.PropertyName == "RegionEqual")
                                 .ToList();

                foreach (var report in reports)
                {
                    foreach (var prop_type in prop_types)
                    {
                        var prop = ReportProperty.Queryable.Where(p => p.Report == report &&
                                                                  p.PropertyType.Id == prop_type.Id)
                                   .ToList();
                        if (prop.Count != 0)
                        {
                            continue;
                        }
                        var property = new ReportProperty {
                            Report       = report,
                            PropertyType = prop_type,
                            Value        = prop_type.DefaultValue
                        };

                        property.Save();
                    }
                }
            }
        }
Пример #29
0
        public BudgetDataEntities ConvertToFunctionArgs(Kingdee.BOS.Context ctx, string[] args)
        {
            this.Context = ctx;
            ReportProperty namedSlotData = KdsCalcCacheMananger.GetNamedSlotData("ReportProperty") as ReportProperty;
            bool           flag          = namedSlotData != null;
            bool           flag2         = false;

            if (flag)
            {
                flag2 = namedSlotData.AcctParameter != null;
            }
            BudgetDataEntities funcArgs = new BudgetDataEntities();
            int schemeIdByNumber        = this.GetSchemeIdByNumber(args[0]);

            if ((schemeIdByNumber == 0) && flag)
            {
                if (flag && (namedSlotData.AcctParameter.SchemeId > 0))
                {
                    schemeIdByNumber = namedSlotData.AcctParameter.SchemeId;
                }
                else
                {
                    schemeIdByNumber = namedSlotData.SchemeId;
                }
            }
            funcArgs.SchemeId = schemeIdByNumber;
            string str = args[1];

            if (!string.IsNullOrWhiteSpace(str))
            {
                this.GetOrgIdByNumber(str, funcArgs);
            }
            else if (flag && (namedSlotData.AcctParameter.OrgId > 0L))
            {
                funcArgs.OrgId   = namedSlotData.AcctParameter.OrgId;
                funcArgs.OrgType = namedSlotData.AcctParameter.OrgType;
            }
            else
            {
                funcArgs.OrgId   = namedSlotData.OrgId;
                funcArgs.OrgType = namedSlotData.OrgType;
            }
            string periodTypeByNumber = args[2];

            if (!string.IsNullOrWhiteSpace(periodTypeByNumber))
            {
                periodTypeByNumber = this.GetPeriodTypeByNumber(periodTypeByNumber);
            }
            else if (flag)
            {
                periodTypeByNumber = namedSlotData.CycleType;
            }
            funcArgs.PeriodType = periodTypeByNumber;
            int year        = args[3].IsNullOrEmptyOrWhiteSpace() ? 0 : Convert.ToInt32(args[3]);
            int startPeriod = args[4].IsNullOrEmptyOrWhiteSpace() ? 0 : Convert.ToInt32(args[4]);
            int endPeriod   = args[5].IsNullOrEmptyOrWhiteSpace() ? 0 : Convert.ToInt32(args[5]);

            if ((year == 0) && flag)
            {
                if (flag)
                {
                    year = namedSlotData.AcctParameter.Year;
                }
                if (year == 0)
                {
                    year = namedSlotData.Year;
                }
            }
            if ((startPeriod == 0) && flag)
            {
                if (flag)
                {
                    startPeriod = namedSlotData.AcctParameter.StartPeriod;
                }
                if (startPeriod == 0)
                {
                    startPeriod = namedSlotData.Period;
                }
            }
            if ((endPeriod == 0) && flag)
            {
                if (flag)
                {
                    endPeriod = namedSlotData.AcctParameter.EndPeriod;
                }
                if (endPeriod == 0)
                {
                    endPeriod = namedSlotData.Period;
                }
            }
            DateTime relativePeriod = this.GetRelativePeriod(ctx);

            switch (year)
            {
            case 0:
            case -1:
                year = relativePeriod.Year + year;
                break;
            }
            if ((startPeriod == 0) || (startPeriod == -1))
            {
                startPeriod = relativePeriod.Month + startPeriod;
            }
            if ((endPeriod == 0) || (endPeriod == -1))
            {
                endPeriod = startPeriod;
            }
            funcArgs.Year            = year;
            funcArgs.StartPeriod     = startPeriod;
            funcArgs.EndPeriod       = endPeriod;
            funcArgs.StartYearPeriod = (year * 0x3e8) + startPeriod;
            funcArgs.EndYearPeriod   = (year * 0x3e8) + endPeriod;
            string dimissionInfo = args[6];

            funcArgs.DicDimissionFilter = this.GetScopeFilter(ctx, dimissionInfo);
            funcArgs.BusinessType       = this.GetBusinessTypeIdByNumber(args[7]);
            int dataTypeIdByNumber = this.GetDataTypeIdByNumber(args[8]);

            if (dataTypeIdByNumber > 0)
            {
                switch (Convert.ToString(this.DicDataTypeInfo[args[8]]["FDATATYPE"]))
                {
                case "0":
                case "2":
                    funcArgs.IsAmount = true;
                    break;
                }
            }
            funcArgs.DataType   = dataTypeIdByNumber;
            funcArgs.ValueType  = args[9].IsNullOrEmptyOrWhiteSpace() ? 0 : Convert.ToInt32(args[9]);
            funcArgs.CurrencyId = this.GetCurrencyIdByNumber(args[10]);
            string amountUnitNumber = args[11].IsNullOrEmptyOrWhiteSpace() ? "JEDW01_SYS" : args[11];

            funcArgs.AmountUnitId = this.GetAmountUnitIdByNumber(amountUnitNumber);
            bool includeUnAuditReport = false;

            if (flag2)
            {
                includeUnAuditReport = namedSlotData.AcctParameter.IncludeUnAuditReport;
            }
            funcArgs.IncludeUnAuditReport = includeUnAuditReport;
            bool includeAuditAdjustData = false;

            if (flag2)
            {
                includeAuditAdjustData = namedSlotData.AcctParameter.IncludeAuditAdjustData;
            }
            funcArgs.IncludeAuditAdjustData = includeAuditAdjustData;
            funcArgs.CalcType = CalcType.Formula;
            return(funcArgs);
        }
Пример #30
0
 public string GetRelativeValue(ReportProperty prop)
 {
     if (report == null)
     {
         return(null);
     }
     if (report.ReportType.ReportClassName.Contains("PharmacyMixedReport"))
     {
         // В смешанном для аптеки отчете в списки регионов должны включаться только доступные клиенту регионы (а также те, которые ранее были доступны, чтобы их можно было выключить)
         var res = CalcMaskRegionByClient(prop, new[] { "RegionEqual", "RegionNonEqual" }, new[] { "SourceFirmCode" });
         if (!String.IsNullOrEmpty(res))
         {
             return(res);
         }
     }
     if (report.ReportType.ReportClassName.Contains("SpecReport"))
     {
         // В специальном отчете в списки регионов должны включаться только доступные клиенту регионы (а также те, которые ранее были доступны, чтобы их можно было выключить)
         var res = CalcMaskRegionByClient(prop, new[] { "RegionClientEqual" }, new[] { "ClientCode" });
         if (!String.IsNullOrEmpty(res))
         {
             return(res);
         }
         // В специальном отчете список поставщиков должен формироваться с учетом выбранного клиента
         res = GetUserByClient(prop, new[] { "IgnoredSuppliers", "FirmCodeEqual" }, new[] { "ClientCode" }, "UserCode");
         if (!String.IsNullOrEmpty(res))
         {
             return(res);
         }
         // В специальном отчете при выставленной опции 'По базовым ценам' в списке прайс-листов (Список значений "Прайс") должны показываться только прайсы, доступные в опции 'Список значений "Региона"'
         res = CalcMaskRegionForSelectedRegions(prop, new[] { "PriceCodeEqual" }, new[] { "RegionEqual" });
         // Добавляем фильтрацию по типу прайса
         var resTypes = String.Format("&inTypes={0},{1}", 1, 2);
         if (!String.IsNullOrEmpty(res))
         {
             return(res + resTypes);
         }
         // Список исключений "Прайс"
         res = CalcMaskRegionForSelectedRegions(prop, new[] { "PriceCodeNonValues" }, new[] { "RegionEqual" });
         if (!String.IsNullOrEmpty(res))
         {
             return(res + resTypes);
         }
     }
     if (report.ReportType.ReportClassName.Contains("CombReport"))
     {
         var res = GetUserByClient(prop, new[] { "IgnoredSuppliers", "FirmCodeEqual" }, new[] { "ClientCode" }, "UserCode");
         if (!String.IsNullOrEmpty(res))
         {
             return(res);
         }
         // В комбинированном отчете при выставленной опции 'По базовым ценам' в списке прайс-листов (Список значений "Прайс") должны показываться только прайсы, доступные в опции 'Список значений "Региона"'
         res = CalcMaskRegionForSelectedRegions(prop, new[] { "PriceCodeEqual" }, new[] { "RegionEqual" });
         var resTypes = String.Format("&inTypes={0},{1}", 1, 2);
         if (!String.IsNullOrEmpty(res))
         {
             return(res + resTypes);
         }
         res = CalcMaskRegionForSelectedRegions(prop, new[] { "PriceCodeNonValues" }, new[] { "RegionEqual" });
         if (!String.IsNullOrEmpty(res))
         {
             return(res + resTypes);
         }
     }
     if (report.ReportType.ReportClassName.Contains("DefReport"))
     {
         var res = GetUserByClient(prop, new[] { "IgnoredSuppliers" }, new[] { "ClientCode" }, "UserCode");
         if (!String.IsNullOrEmpty(res))
         {
             return(res);
         }
         // В дефектурном отчете при выставленной опции 'По базовым ценам' в списке прайс-листов (Список значений "Прайс") должны показываться только прайсы, доступные в опции 'Список значений "Региона"'
         res = CalcMaskRegionForSelectedRegions(prop, new[] { "PriceCodeEqual" }, new[] { "RegionEqual" });
         var resTypes = String.Format("&inTypes={0},{1}", 1, 2);
         if (!String.IsNullOrEmpty(res))
         {
             return(res + resTypes);
         }
         res = CalcMaskRegionForSelectedRegions(prop, new[] { "PriceCodeNonValues" }, new[] { "RegionEqual" });
         if (!String.IsNullOrEmpty(res))
         {
             return(res + resTypes);
         }
     }
     if (report.ReportType.ReportClassName.Contains("LeakOffersReport"))
     {
         var res = GetUserByClient(prop, new[] { "IgnoredSuppliers", "FirmCodeEqual" }, new[] { "ClientCode" }, "UserCode");
         if (!String.IsNullOrEmpty(res))
         {
             return(res);
         }
     }
     if (report.ReportType.ReportClassName.Contains("OffersReport"))
     {
         var res = GetUserByClient(prop, new[] { "IgnoredSuppliers", "FirmCodeEqual" }, new[] { "ClientCode" }, "UserCode");
         if (!String.IsNullOrEmpty(res))
         {
             return(res);
         }
         res = CalcMaskRegionForSelectedRegions(prop, new[] { "PriceCodeEqual" }, new[] { "RegionEqual" });
         if (!String.IsNullOrEmpty(res))
         {
             return(res);
         }
     }
     if (report.ReportType.ReportClassName.Contains("PharmacyOffersReport"))
     {
         var res = GetUserByClient(prop, new[] { "IgnoredSuppliers", "FirmCodeEqual" }, new[] { "ClientCode" }, "UserCode");
         if (!String.IsNullOrEmpty(res))
         {
             return(res);
         }
     }
     return(String.Empty);
 }