Example #1
0
        protected void Page_Load(object sender, EventArgs e)
        {
            using (var db = Database.SPBase())
            {
                Label1.Text = db.RepLng.First(w => w.RepId == 4 && w.LangId == 2).Name;

                var wh = db.Warehouse.Where(w => w.UserAccessWh.Any(a => a.UserId == 0)).Select(s => new { WId = s.WId.ToString(), s.Name, s.Def }).ToList();

                WhComboBox.DataSource = new List <WhComboBoxItem>()
                {
                    new WhComboBoxItem {
                        WId = "*", Name = "Усі"
                    }
                }.Concat(wh.Select(s => new WhComboBoxItem
                {
                    WId  = s.WId,
                    Name = s.Name
                }).ToList());
                WhComboBox.DataBind();

                GrpComboBox.DataSource = new List <GrpComboBoxItem>()
                {
                    new GrpComboBoxItem {
                        GrpId = 0, Name = "Усі"
                    }
                }.Concat(db.MatGroup.Where(w => w.Deleted == 0).Select(s => new GrpComboBoxItem {
                    GrpId = s.GrpId, Name = s.Name
                }).ToList());
                GrpComboBox.DataBind();

                var k_list = new List <KagentComboBoxItem>()
                {
                    new KagentComboBoxItem {
                        KaId = 0, Name = "Усі"
                    }
                }.Concat(db.Kagent.Where(w => w.Deleted == 0 && (!w.Archived.HasValue || w.Archived == 0)).OrderBy(o => o.Name).Select(s => new KagentComboBoxItem {
                    KaId = s.KaId, Name = s.Name
                })).ToList();
                KagentComboBox.DataSource = k_list;
                KagentComboBox.DataBind();

                if (!IsPostBack)
                {
                    StartDateEdit.Date = DateTime.Now.Date.AddDays(-1);
                    EndDateEdit.Date   = DateTime.Now.Date.AddHours(23).AddMinutes(59).AddSeconds(59);

                    WhComboBox.Value     = "*";
                    GrpComboBox.Value    = 0;
                    KagentComboBox.Value = 0;
                }
            }
        }
Example #2
0
        protected void Page_Load(object sender, EventArgs e)
        {
            using (var db = Database.SPBase())
            {
                Label1.Text = db.RepLng.First(w => w.RepId == 7 && w.LangId == 2).Name;

                var wh = db.Warehouse.Where(w => w.UserAccessWh.Any(a => a.UserId == 0)).Select(s => new { WId = s.WId.ToString(), s.Name, s.Def }).ToList();

                WhComboBox.DataSource = new List <WhComboBoxItem>()
                {
                    new WhComboBoxItem {
                        WId = "*", Name = "Усі"
                    }
                }.Concat(wh.Select(s => new WhComboBoxItem
                {
                    WId  = s.WId,
                    Name = s.Name
                }).ToList());
                WhComboBox.DataBind();

                GrpComboBox.DataSource = new List <GrpComboBoxItem>()
                {
                    new GrpComboBoxItem {
                        GrpId = 0, Name = "Усі"
                    }
                }.Concat(db.MatGroup.Where(w => w.Deleted == 0).Select(s => new GrpComboBoxItem {
                    GrpId = s.GrpId, Name = s.Name
                }).ToList());
                GrpComboBox.DataBind();
            }

            if (!IsPostBack)
            {
                OnDateDBEdit.Date = DateTime.Now;
                WhComboBox.Value  = "*";
                GrpComboBox.Value = 0;
            }
        }
Example #3
0
        private void OkButton_Click(object sender, EventArgs e)
        {
            String str = "";

            if (checkEdit2.Checked)
            {
                str += "1";
            }
            if (checkEdit1.Checked)
            {
                str += ",5";
            }
            if (checkEdit3.Checked)
            {
                str += ",6";
            }

            if (checkEdit4.Checked)
            {
                str += ",-1";
            }
            if (checkEdit5.Checked)
            {
                str += ",-6";
            }
            if (checkEdit6.Checked)
            {
                str += ",-5";
            }
            if (checkEdit7.Checked)
            {
                str += ",-20";
            }
            if (checkEdit8.Checked)
            {
                str += ",-22";
            }
            if (checkEdit9.Checked)
            {
                str += ",-24";
            }
            SetDate();

            int grp = ChildGroupCheckEdit.Checked ? Convert.ToInt32((GrpComboBox.GetSelectedDataRow() as dynamic).GrpId) : 0;

            /*    var pr = new PrintReport
             *  {
             *      OnDate = OnDateDBEdit.DateTime,
             *      StartDate = StartDateEdit.DateTime,
             *      EndDate = EndDateEdit.DateTime,
             *      MatGroup = GrpComboBox.GetSelectedDataRow(),
             *      Kagent = KagentComboBox.GetSelectedDataRow(),
             *      Warehouse = WhComboBox.GetSelectedDataRow(),
             *      Material = MatComboBox.GetSelectedDataRow(),
             *      DocStr = str,
             *      DocType = DocTypeEdit.EditValue,
             *      ChType = ChTypeEdit.GetSelectedDataRow(),
             *      Status = wbStatusList.EditValue,
             *      KontragentGroup = GrpKagentLookUpEdit.GetSelectedDataRow(),
             *      GrpStr = ChildGroupCheckEdit.Checked ? String.Join(",", new BaseEntities().GetMatGroupTree(grp).ToList().Select(s => Convert.ToString(s.GrpId))) : "",
             *      Person = PersonLookUpEdit.GetSelectedDataRow()
             *  };
             *
             * pr.CreateReport(_rep_id);*/

            var pr2 = new PrintReportv2(_rep_id, DBHelper.CurrentUser.KaId, DBHelper.CurrentUser.UserId)
            {
                OnDate          = OnDateDBEdit.DateTime,
                StartDate       = StartDateEdit.DateTime,
                EndDate         = EndDateEdit.DateTime,
                MatGroup        = GrpComboBox.GetSelectedDataRow() as GrpComboBoxItem,
                Kagent          = KagentComboBox.GetSelectedDataRow() as KagentComboBoxItem,
                Warehouse       = WhComboBox.GetSelectedDataRow() as WhComboBoxItem,
                Material        = MatComboBox.GetSelectedDataRow() as MatComboBoxItem,
                DocStr          = str,
                DocType         = DocTypeEdit.EditValue,
                ChType          = ChTypeEdit.GetSelectedDataRow() as ChTypeComboBoxItem,
                Status          = wbStatusList.EditValue,
                KontragentGroup = GrpKagentLookUpEdit.GetSelectedDataRow() as GrpKagentComboBoxItem,
                GrpStr          = ChildGroupCheckEdit.Checked ? String.Join(",", new BaseEntities().GetMatGroupTree(grp).ToList().Select(s => Convert.ToString(s.GrpId))) : "",
                Person          = PersonLookUpEdit.GetSelectedDataRow()
            };

            var template_name = pr2.GetTemlate(_rep_id);
            var template_file = Path.Combine(IHelper.template_path, template_name);

            if (File.Exists(template_file))
            {
                var report_data = pr2.CreateReport(template_file, DBHelper.CurrentUser.ReportFormat);
                if (report_data != null)
                {
                    IHelper.ShowReport(report_data, template_name);
                }
                else
                {
                    MessageBox.Show("За обраний період звіт не містить даних !");
                }
            }
            else
            {
                MessageBox.Show("Шлях до шаблонів " + template_file + " не знайдено!");
            }
        }