示例#1
0
        private void KagentComboBox_EditValueChanged(object sender, EventArgs e)
        {
            var row = KagentComboBox.GetSelectedDataRow() as dynamic;

            if (row == null)
            {
                return;
            }
            wb.KaId = row.KaId;

            wb.Nds = row.NdsPayer == 1 ? DBHelper.CommonParam.Nds : 0;

            GetOk();
        }
示例#2
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 + " не знайдено!");
            }
        }