Beispiel #1
0
        private void btnPrint_Click(object sender, EventArgs e)
        {
            //if (VisibilitySetting.HandleUnits == 3) chkCalculateInPacks.Enabled = false;
            //chkCalculateInPacks.Checked = false;
            if (
                XtraMessageBox.Show("Are you sure you want to save and print the VRF?", "Confirm",
                                    MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.No)
            {
                return;
            }
            SaveVRF();
            var ginfo = new GeneralInfo();

            ginfo.LoadAll();
            var ethioDateFrom = new EthiopianDate.EthiopianDate(_fromYear, _fromMonth, 1);
            var vrfReport     = new VRFReport
            {
                FacilityName = { Text = ginfo.HospitalName },
                Period       =
                {
                    Text =
                        string.Format("{0}, {1}", ethioDateFrom.GetMonthName(),
                                      ethioDateFrom.Year)
                },
                ProgramName       = { Text = cboProgram.Text },
                categoryName      = { Text = lkCategory.Text },
                RegionZoneWoreda  = { Text = ginfo.DSUpdateFrequency },
                ResponsiblePerson = { Text = ginfo.HospitalContact },
                TelephoneNumber   = { Text = ginfo.Telephone },
                MonthsToSupply    = { Text = ginfo.RRFStatusUpdateFrequency },
                Births            = { Text = ginfo.RRFStatusFirstUpdateAfter },
                SurvivingInfants  = { Text = ginfo.ScmsWSUserName },
                RequestDate       = { Text = DateTime.Now.ToShortDateString() }
            };

            var tbl1 = ((DataView)gridItemChoiceView.DataSource).Table;

            tbl1.TableName = "DataTable11";
            var dtset = new DataSet();

            dtset.Tables.Add(tbl1.Copy());
            vrfReport.DataSource = dtset;
            if (Convert.ToInt32(cboProgram.EditValue) == 0 && Convert.ToInt32(lkCategory.EditValue) == 0)
            {
                vrfReport.ShowPreviewDialog();
            }
            else if (Convert.ToInt32(lkCategory.EditValue) != 0)
            {
                vrfReport.FilterString = String.Format("ProgramID={0} and TypeID ={1}", Convert.ToInt32(cboProgram.EditValue), Convert.ToInt32(lkCategory.EditValue));
                vrfReport.ShowPreviewDialog();
            }
            else
            {
                vrfReport.FilterString = String.Format("ProgramID={0}", Convert.ToInt32(cboProgram.EditValue));
                vrfReport.ShowPreviewDialog();
            }
        }
 private void lkAccount_EditValueChanged(object sender, EventArgs e)
 {
     var ed = new EthiopianDate.EthiopianDate();
     if (lkFiscalYear.EditValue != null && lkAccount.EditValue != null)
     {
         FiscalYear fYear = new FiscalYear();
         fYear.LoadByPrimaryKey(Convert.ToInt32(lkFiscalYear.EditValue));
         //TODO: this has to be re-implemented.
         cutOffNumberReport = new CutOffNumberReport(CurrentContext.LoggedInUserName);
         cutOffNumberReport.DataSource = ReceiveDoc.GetCutOffNumber(Convert.ToInt32(lkFiscalYear.EditValue), Convert.ToInt32(lkAccount.EditValue));
         cutOffNumberReport.xrMonth.Text = string.Format("{0}", ed.GetMonthName());
         cutOffNumberReport.xrAccount.Text = string.Format("{0}", lkAccount.Text);
         cutOffNumberReport.xrYear.Text = string.Format("{0}", fYear.Name );
         printControl1.PrintingSystem = cutOffNumberReport.PrintingSystem;
         cutOffNumberReport.CreateDocument();
     }
 }
        private void lkAccount_EditValueChanged(object sender, EventArgs e)
        {
            var ed = new EthiopianDate.EthiopianDate();

            if (lkFiscalYear.EditValue != null && lkAccount.EditValue != null)
            {
                FiscalYear fYear = new FiscalYear();
                fYear.LoadByPrimaryKey(Convert.ToInt32(lkFiscalYear.EditValue));
                //TODO: this has to be re-implemented.
                cutOffNumberReport                = new CutOffNumberReport(CurrentContext.LoggedInUserName);
                cutOffNumberReport.DataSource     = ReceiveDoc.GetCutOffNumber(Convert.ToInt32(lkFiscalYear.EditValue), Convert.ToInt32(lkAccount.EditValue));
                cutOffNumberReport.xrMonth.Text   = string.Format("{0}", ed.GetMonthName());
                cutOffNumberReport.xrAccount.Text = string.Format("{0}", lkAccount.Text);
                cutOffNumberReport.xrYear.Text    = string.Format("{0}", fYear.Name);
                printControl1.PrintingSystem      = cutOffNumberReport.PrintingSystem;
                cutOffNumberReport.CreateDocument();
            }
        }