Example #1
0
        private void buttonBILLPrint_Click(object sender, EventArgs e)
        {
            if (dataViewBill.SelectedRows.Count > 0)
            {
                // Get bill for print
                Bill billDetail = Bill.GetBill(Convert.ToInt32(dataViewBill.SelectedRows[0].Cells[0].Value.ToString()));

                FormReport reportForm = new FormReport();

                switch (billDetail.BillTypeID)
                {
                case Bill.MEDICINEBILL:
                    reportForm.ReportType = "MEDICINEBILL";
                    reportForm.ObjectID   = billDetail.BillID;
                    break;

                case Bill.SERVICEBILL:
                    reportForm.ReportType = "SERVICEBILL";
                    reportForm.ObjectID   = billDetail.BillID;
                    break;

                case Bill.MATERIALBILL:
                    reportForm.ReportType = "MATERIALBILL";
                    reportForm.ObjectID   = billDetail.BillID;
                    break;

                default:
                    MessageBox.Show("Vui lòng chọn hóa đơn để in!", "Lỗi", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    return;
                }

                reportForm.Show();
            }
        }
Example #2
0
        private void buttonStatisticsReport_Click(object sender, EventArgs e)
        {
            FormReport reportForm = new FormReport();

            switch (comboBoxStatisticsType.SelectedIndex)
            {
            case 0:
                reportForm.ReportType = "REVENUEBYDAY";
                break;

            case 1:
                reportForm.ReportType = "REVENUEBYMONTH";
                break;

            case 2:
                reportForm.ReportType = "REVENUEBYYEAR";
                break;

            default:
                MessageBox.Show("Chọn loại thống kê!", "Lỗi", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }

            reportForm.DATEFROM = dateTimeInputStatisticsDateFrom.Value;
            reportForm.DATETO   = dateTimeInputStatisticsDateTo.Value;
            reportForm.Show();
        }
Example #3
0
        private void buttonExamination_Click(object sender, EventArgs e)
        {
            if (dataViewExamination.SelectedRows.Count > 0)
            {
                ExaminationCertificate ECPrint = ExaminationCertificate.GetEC(Convert.ToInt32(dataViewExamination.SelectedRows[0].Cells[0].Value));

                FormReport reportForm = new FormReport();

                reportForm.ReportType = "EC";
                reportForm.ObjectID = ECPrint.ECID;
                reportForm.Show();
            }
        }
Example #4
0
        static void Main()
        {
            //Application.ThreadException += new ThreadExceptionEventHandler(Application_ThreadException); 
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);


            Application.Run(new FormLogin());

            // Test
            //Bill newBill = Bill.GetBill(10000017);            
            //Patient patient = Patient.GetPatient(10000000);
            //Application.Run(new FormBillDetail("edit", newBill));
            FormReport test = new FormReport();
            test.ReportType = "REVENUEBYDAY";
            test.ObjectID = 10000001;
            test.DATEFROM = new DateTime(2012, 5, 30);
            test.DATETO = new DateTime(2012, 6, 4);
            //Application.Run(test);
            //Application.Run(new Form2());
        }
Example #5
0
        private void buttonStatisticsReport_Click(object sender, EventArgs e)
        {
            FormReport reportForm = new FormReport();

            switch (comboBoxStatisticsType.SelectedIndex)
            { 
                case 0:
                    reportForm.ReportType = "REVENUEBYDAY";                    
                    break;
                case 1:
                    reportForm.ReportType = "REVENUEBYMONTH";
                    break;
                case 2:
                    reportForm.ReportType = "REVENUEBYYEAR";
                    break;
                default:
                    MessageBox.Show("Chọn loại thống kê!", "Lỗi", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    return;
            }

            reportForm.DATEFROM = dateTimeInputStatisticsDateFrom.Value;
            reportForm.DATETO = dateTimeInputStatisticsDateTo.Value;
            reportForm.Show();
        }
Example #6
0
        // Accept payment
        private void buttonPay_Click(object sender, EventArgs e)
        {
            try
            {
                if (dataViewBillDetail.Rows.Count <= 0)
                {
                    MessageBox.Show("Thêm chi tiết hóa đơn!", "Lỗi", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    return;
                }

                // Ask user to accpet payment
                if (MessageBox.Show("Xác nhận thanh toán?", "Xác nhận", MessageBoxButtons.YesNo, MessageBoxIcon.Asterisk)
                    == DialogResult.Yes)
                {
                    if ("insert".Equals(UserAction))
                    {
                        if (HICID != 0)
                        {
                            BillDetail.TotalPrice = BillDetail.TotalPrice / 4;
                        }
                        BillDetail.State = Bill.PAY;
                        Bill.InsertBill(BillDetail);

                        insertBillDetail();
                    }
                    else if ("edit".Equals(UserAction))
                    {
                        if (HICID != 0)
                        {
                            BillDetail.TotalPrice = BillDetail.TotalPrice / 4;
                        }
                        BillDetail.State = Bill.PAY;
                        Bill.UpdateBill(BillDetail);
                    }

                    Bill billReport;

                    if ("insert".Equals(UserAction))
                    {
                        billReport = Bill.GetBill(Bill.GetCurrentBillID());
                    }
                    else
                    {
                        billReport = BillDetail;
                    }

                    FormReport reportForm = new FormReport();

                    switch (billReport.BillTypeID)
                    {
                    case Bill.MEDICINEBILL:
                        reportForm.ReportType = "MEDICINEBILL";
                        reportForm.ObjectID   = billReport.BillID;
                        break;

                    case Bill.SERVICEBILL:
                        reportForm.ReportType = "SERVICEBILL";
                        reportForm.ObjectID   = billReport.BillID;
                        break;

                    case Bill.MATERIALBILL:
                        reportForm.ReportType = "MATERIALBILL";
                        reportForm.ObjectID   = billReport.BillID;
                        break;

                    default:
                        MessageBox.Show("Vui lòng chọn hóa đơn để in!", "Lỗi", MessageBoxButtons.OK, MessageBoxIcon.Error);
                        return;
                    }

                    reportForm.ShowDialog();

                    this.Close();
                }
            }
            catch (SqlException exception)
            {
                MessageBox.Show(exception.Message, "Lỗi dữ liệu", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
Example #7
0
        private void buttonOk_Click(object sender, System.EventArgs e)
        {
            try
            {
                if (!superValidator1.Validate())
                {
                    return;
                }
                if (this.UserAction.Equals("edit"))
                {
                    ExaminationCertificate newEC = new ExaminationCertificate();
                    newEC        = this.ECDetail;
                    newEC.Result = textBoxResult.Text;
                    newEC.State  = comboBoxState.SelectedIndex;
                    newEC.Date   = dateCreate.Value;
                    DialogResult dialogResult = MessageBox.Show("Xác nhận cập nhập thông tin phiếu khám bệnh", "Thông báo", MessageBoxButtons.YesNo, MessageBoxIcon.Warning);
                    if (dialogResult == DialogResult.Yes)
                    {
                        if (ExaminationCertificate.UpdateEC(newEC) > 0)
                        {
                            MessageBox.Show("Cập nhập thông tin phiếu khám bệnh thành công", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Information);
                        }
                    }
                }
                else if (this.UserAction == "updateResult")
                {
                    ExaminationCertificate newEC = new ExaminationCertificate();
                    newEC.ECID      = Convert.ToInt32(textBoxECID.Text);
                    newEC.PatientID = Convert.ToInt32(textBoxPatientID.Text);
                    newEC.StaffID   = Convert.ToInt32(textBoxStaffID.Text);
                    newEC.State     = 1;
                    newEC.Date      = dateCreate.Value;
                    newEC.Result    = textBoxResult.Text;
                    if (ExaminationCertificate.UpdateEC(newEC) > 0)
                    {
                        MessageBox.Show("Cập nhập kết quả khám bệnh thành công", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    }
                }
                else
                {
                    ExaminationCertificate newEC = new ExaminationCertificate();
                    newEC.ECID      = 0;
                    newEC.PatientID = Convert.ToInt32(textBoxPatientID.Text);
                    newEC.StaffID   = Convert.ToInt32(textBoxStaffID.Text);
                    newEC.State     = comboBoxState.SelectedIndex;
                    newEC.Date      = dateCreate.Value;
                    newEC.Result    = textBoxResult.Text;
                    if (ExaminationCertificate.InsertEC(newEC) > 0)
                    {
                        FormReport reportForm = new FormReport();

                        reportForm.ReportType = "EC";
                        reportForm.ObjectID   = ExaminationCertificate.GetCurrentECID();
                        reportForm.ShowDialog();

                        int patientID = newEC.PatientID;
                        //Current user
                        int staffID = LoginStaff.StaffID;

                        Bill           newBill        = new Bill(Bill.SERVICEBILL, patientID, staffID);
                        FormBillDetail billDetailForm = new FormBillDetail("insertExamination", newBill);
                        billDetailForm.ShowDialog();
                    }
                }
            }
            catch
            {
                MessageBox.Show("Lỗi dữ liệu", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            this.Close();
        }
Example #8
0
        // Accept payment
        private void buttonPay_Click(object sender, EventArgs e)
        {
            try
            {
                if (dataViewBillDetail.Rows.Count <= 0)
                {
                    MessageBox.Show("Thêm chi tiết hóa đơn!", "Lỗi", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    return;
                }

                // Ask user to accpet payment
                if (MessageBox.Show("Xác nhận thanh toán?", "Xác nhận", MessageBoxButtons.YesNo, MessageBoxIcon.Asterisk)
                            == DialogResult.Yes)
                {


                    if ("insert".Equals(UserAction))
                    {
                        if (HICID != 0)
                        {
                            BillDetail.TotalPrice = BillDetail.TotalPrice / 4;
                        }
                        BillDetail.State = Bill.PAY;
                        Bill.InsertBill(BillDetail);

                        insertBillDetail();
                    }
                    else if ("edit".Equals(UserAction))
                    {
                        if (HICID != 0)
                        {
                            BillDetail.TotalPrice = BillDetail.TotalPrice / 4;
                        }
                        BillDetail.State = Bill.PAY;
                        Bill.UpdateBill(BillDetail);                        
                    }

                    Bill billReport;

                    if ("insert".Equals(UserAction))
                    {
                        billReport = Bill.GetBill(Bill.GetCurrentBillID());
                    }
                    else
                    {
                        billReport = BillDetail;
                    }

                    FormReport reportForm = new FormReport();

                    switch (billReport.BillTypeID)
                    {
                        case Bill.MEDICINEBILL:
                            reportForm.ReportType = "MEDICINEBILL";
                            reportForm.ObjectID = billReport.BillID;
                            break;
                        case Bill.SERVICEBILL:
                            reportForm.ReportType = "SERVICEBILL";
                            reportForm.ObjectID = billReport.BillID;
                            break;
                        case Bill.MATERIALBILL:
                            reportForm.ReportType = "MATERIALBILL";
                            reportForm.ObjectID = billReport.BillID;
                            break;
                        default:
                            MessageBox.Show("Vui lòng chọn hóa đơn để in!", "Lỗi", MessageBoxButtons.OK, MessageBoxIcon.Error);
                            return;
                    }

                    reportForm.ShowDialog();

                    this.Close();
                }
            }
            catch (SqlException exception)
            {
                MessageBox.Show(exception.Message, "Lỗi dữ liệu", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }            
        }
Example #9
0
        private void buttonOk_Click(object sender, System.EventArgs e)
        {
            try
            {

                if (!superValidator1.Validate())
                {
                    return;
                }
                if (this.UserAction.Equals("edit"))
                {
                    ExaminationCertificate newEC = new ExaminationCertificate();
                    newEC = this.ECDetail;
                    newEC.Result = textBoxResult.Text;
                    newEC.State = comboBoxState.SelectedIndex;
                    newEC.Date = dateCreate.Value;
                    DialogResult dialogResult = MessageBox.Show("Xác nhận cập nhập thông tin phiếu khám bệnh", "Thông báo", MessageBoxButtons.YesNo, MessageBoxIcon.Warning);
                    if (dialogResult == DialogResult.Yes)
                    {
                        if (ExaminationCertificate.UpdateEC(newEC) > 0)
                            MessageBox.Show("Cập nhập thông tin phiếu khám bệnh thành công", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    }

                }
                else if (this.UserAction == "updateResult")
                {
                    ExaminationCertificate newEC = new ExaminationCertificate();
                    newEC.ECID = Convert.ToInt32(textBoxECID.Text);
                    newEC.PatientID = Convert.ToInt32(textBoxPatientID.Text);
                    newEC.StaffID = Convert.ToInt32(textBoxStaffID.Text);
                    newEC.State = 1;
                    newEC.Date = dateCreate.Value;
                    newEC.Result = textBoxResult.Text;
                    if (ExaminationCertificate.UpdateEC(newEC) > 0)
                        MessageBox.Show("Cập nhập kết quả khám bệnh thành công", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Information);
                }
                else
                {
                    ExaminationCertificate newEC = new ExaminationCertificate();
                    newEC.ECID = 0;
                    newEC.PatientID = Convert.ToInt32(textBoxPatientID.Text);
                    newEC.StaffID = Convert.ToInt32(textBoxStaffID.Text);
                    newEC.State = comboBoxState.SelectedIndex;
                    newEC.Date = dateCreate.Value;
                    newEC.Result = textBoxResult.Text;
                    if (ExaminationCertificate.InsertEC(newEC) > 0)
                    {
                        FormReport reportForm = new FormReport();

                        reportForm.ReportType = "EC";
                        reportForm.ObjectID = ExaminationCertificate.GetCurrentECID();
                        reportForm.ShowDialog();

                        int patientID = newEC.PatientID;
                        //Current user
                        int staffID = LoginStaff.StaffID;

                        Bill newBill = new Bill(Bill.SERVICEBILL, patientID, staffID);
                        FormBillDetail billDetailForm = new FormBillDetail("insertExamination", newBill);
                        billDetailForm.ShowDialog();
                    }
                }


            }
            catch
            {
                MessageBox.Show("Lỗi dữ liệu", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            this.Close();
        }
Example #10
0
        private void buttonBILLPrint_Click(object sender, EventArgs e)
        {
            if (dataViewBill.SelectedRows.Count > 0)
            {
                // Get bill for print
                Bill billDetail = Bill.GetBill(Convert.ToInt32(dataViewBill.SelectedRows[0].Cells[0].Value.ToString()));

                FormReport reportForm = new FormReport();

                switch (billDetail.BillTypeID)
                {
                    case Bill.MEDICINEBILL:
                        reportForm.ReportType = "MEDICINEBILL";
                        reportForm.ObjectID = billDetail.BillID;
                        break;
                    case Bill.SERVICEBILL:
                        reportForm.ReportType = "SERVICEBILL";
                        reportForm.ObjectID = billDetail.BillID;
                        break;
                    case Bill.MATERIALBILL:
                        reportForm.ReportType = "MATERIALBILL";
                        reportForm.ObjectID = billDetail.BillID;
                        break;
                    default:
                        MessageBox.Show("Vui lòng chọn hóa đơn để in!", "Lỗi", MessageBoxButtons.OK, MessageBoxIcon.Error);
                        return;
                }

                reportForm.Show();

            }
        }