Esempio n. 1
0
        private void btnContractTypeCode_Click(object sender, EventArgs e)
        {
            try
            {
                frmGenSelect frm = new frmGenSelect("Danh sách hợp đồng", "ContractType", "ID", "Name");
                frm.IsMultipleSelect = true;
                frm.ShowDialog();
                string temp = "";
                if (frm.getArrModel != null)
                {
                    for (int i = 0; i < frm.getArrModel.Length; i++)
                    {
                        ContractTypeModel _model = (ContractTypeModel)frm.getArrModel[i];

                        _ContractTypeIDs = _model.ID;
                        temp            += ((ContractTypeModel)_model).ID + ",";
                    }
                    txtTransactionCode.Text = temp.Substring(0, temp.Length - 1);
                    LoadData();
                }
            }

            catch (Exception ex)
            {
                frmGenMessageBox frm = new frmGenMessageBox("_SystemMessage", "frmGenSearch", "GetData", TextUtils.Caption, MessageLibrary._SystemMessage, ex.Message, MessageBoxIcon.Error);
                frm.ShowDialog();
                return;
            }
        }
Esempio n. 2
0
        public void BindData()
        {
            try
            {
                rpt = new ReportDocument();
                rpt.Load(Application.StartupPath + "\\Reports\\" + ReportName);
                if (this.Source != null)
                {
                    rpt.SetDataSource(this.Source);
                }
                if (this.SubReportSource != null)
                {
                    rpt.Subreports[0].SetDataSource(SubReportSource);
                }
                if (FormulaFieldsValue != null)
                {
                    for (int i = 0; i < FormulaFields.Length; i++)
                    {
                        rpt.DataDefinition.FormulaFields[FormulaFields[i]].Text = "\"" + FormulaFieldsValue[i].Replace("\r\n", "@#$") + "\"";
                    }
                }

                //rpt.PrintOptions.PaperSize = CrystalDecisions.Shared.PaperSize.PaperA4;
                crystalReportViewer1.DisplayGroupTree    = false;
                crystalReportViewer1.ReportSource        = rpt;
                crystalReportViewer1.ShowGroupTreeButton = false;
                crystalReportViewer1.RefreshReport();
            }
            catch (Exception ex)
            {
                frmGenMessageBox frm = new frmGenMessageBox("KienNT", this.Name, "ReportName", TextUtils.Caption,
                                                            "", ex.Message, MessageBoxIcon.Error);
                frm.ShowDialog();
                return;
            }
        }
Esempio n. 3
0
        public void BindData()
        {
            try
            {
                // Khai báo document
                rpt = new ReportDocument();
                rpt.Load(Application.StartupPath + "\\Reports\\" + ReportName);

                if (this.Source != null)
                {
                    rpt.SetDataSource(this.Source);
                }
                if (this.SubReportSource != null)
                {
                    rpt.Subreports[SubReportName].SetDataSource(SubReportSource);
                }

                if (FormulaFieldsValue != null)
                {
                    for (int i = 0; i < FormulaFields.Length; i++)
                    {
                        rpt.DataDefinition.FormulaFields[FormulaFields[i]].Text = "\"" + FormulaFieldsValue[i] + "\"";
                    }
                }
                // Bind data source
                crystalReportViewer1.ReportSource = rpt;
                crystalReportViewer1.RefreshReport();
            }
            catch (Exception ex)
            {
                frmGenMessageBox frm = new frmGenMessageBox("KienNT", this.Name, "ReportName", TextUtils.Caption,
                                                            "", ex.Message, MessageBoxIcon.Error);
                frm.ShowDialog();
                return;
            }
        }
Esempio n. 4
0
 public void PrintTipReceive()
 {
     try
     {
         if (FormulaFieldsValueTip != null)
         {
             ReportDocument rpt = new ReportDocument();
             rpt.Load(Application.StartupPath + "\\Reports\\" + "PrintTip.rpt");
             for (int i = 0; i < FormulaFieldsTip.Length; i++)
             {
                 rpt.DataDefinition.FormulaFields[FormulaFieldsTip[i]].Text = "\"" + FormulaFieldsValueTip[i] + "\"";
             }
             rpt.PrintOptions.PrinterName = GetDefaultPrinter();
             rpt.PrintToPrinter(1, true, 1, 1);
         }
     }
     catch (Exception ex)
     {
         frmGenMessageBox frm = new frmGenMessageBox("KienNT", this.Name, "ReportName", TextUtils.Caption,
                                                     "", ex.Message, MessageBoxIcon.Error);
         frm.ShowDialog();
         return;
     }
 }
Esempio n. 5
0
        public void ShowReport()
        {
            try
            {
                ReportDocument rpt = new ReportDocument();
                rpt.Load(Application.StartupPath + "\\" + this.Path);

                if (this.Data != null)
                {
                    rpt.SetDataSource(this.Data);
                }

                if (FormulaFieldsValue != null)
                {
                    for (int i = 0; i < FormulaFields.Length; i++)
                    {
                        rpt.DataDefinition.FormulaFields[FormulaFields[i]].Text = "\"" + FormulaFieldsValue[i] + "\"";
                    }
                }
                rpt.PrintOptions.PaperSize        = CrystalDecisions.Shared.PaperSize.PaperA4;
                crystalReportViewer1.ReportSource = rpt;
                crystalReportViewer1.RefreshReport();
                this.ShowDialog();
            }
            catch (Exception ex)
            {
                frmGenMessageBox frm = new frmGenMessageBox("_SystemMessage",
                                                            "frmReportViewer",
                                                            "ShowReport",
                                                            TextUtils.Caption,
                                                            "",
                                                            ex.Message, MessageBoxIcon.Error);
                frm.ShowDialog();
                return;
            }
        }