예제 #1
0
        private void buttonPatientService_Click(object sender, EventArgs e)
        {
            if (dataViewPatient.SelectedRows.Count > 0)
            {
                int patientID = Convert.ToInt32(dataViewPatient.SelectedRows[0].Cells[0].Value);
                //Current user
                int staffID = loginStaff.StaffID;

                Bill           newBill        = new Bill(Bill.SERVICEBILL, patientID, staffID);
                FormBillDetail billDetailForm = new FormBillDetail("insert", newBill);
                billDetailForm.ShowDialog();
            }
        }
예제 #2
0
        private void buttonEdit_Click(object sender, EventArgs e)
        {
            // Get bill for edit
            Bill billDetail = Bill.GetBill(Convert.ToInt32(dataViewBill.SelectedRows[0].Cells[0].Value.ToString()));

            // Open billdetail form for edit
            FormBillDetail billDetailForm = new FormBillDetail("edit", billDetail);

            billDetailForm.ShowDialog();

            // Refresh datagridview after edit
            refreshDataViewBill();
        }
예제 #3
0
        private void buttonPrescriptionSell_Click(object sender, EventArgs e)
        {
            if (dataViewPrescription.SelectedRows.Count > 0)
            {
                int prescriptionID = Convert.ToInt32(dataViewPrescription.SelectedRows[0].Cells[0].Value);
                int patientID      = Convert.ToInt32(Prescription.GetPatientIDInPrescription(prescriptionID).Rows[0][0]);
                int staffID        = loginStaff.StaffID;

                Bill           newBill        = new Bill(Bill.MEDICINEBILL, patientID, staffID);
                FormBillDetail billDetailForm = new FormBillDetail("insert", newBill, prescriptionID);
                billDetailForm.ShowDialog();
            }
        }
예제 #4
0
        private void buttonBillEdit_Click(object sender, EventArgs e)
        {
            if (dataViewBill.SelectedRows.Count > 0)
            {
                // Get bill for edit
                Bill billDetail = Bill.GetBill(Convert.ToInt32(dataViewBill.SelectedRows[0].Cells[0].Value.ToString()));

                // Open billdetail form for edit
                FormBillDetail billDetailForm = new FormBillDetail("edit", billDetail);
                billDetailForm.ShowDialog();

                // Refresh datagridview after edit
                refreshDataViewBill();
            }
        }
예제 #5
0
        private void buttonPatientMaterial_Click(object sender, EventArgs e)
        {
            if (dataViewPatient.SelectedRows.Count > 0)
            {
                int patientID = Convert.ToInt32(dataViewPatient.SelectedRows[0].Cells[0].Value);
                if (Patient.GetPatient(patientID).State == 1)
                {
                    //Current user
                    int staffID = loginStaff.StaffID;

                    Bill           newBill        = new Bill(Bill.MATERIALBILL, patientID, staffID);
                    FormBillDetail billDetailForm = new FormBillDetail("insert", newBill);
                    billDetailForm.ShowDialog();
                }
                else
                {
                    MessageBox.Show("Bệnh nhân chưa nhập viện nên không được phép mượn vật tư", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                }
            }
        }
예제 #6
0
        private void buttonPatientService_Click(object sender, EventArgs e)
        {
            if (dataViewPatient.SelectedRows.Count > 0)
            {
                int patientID = Convert.ToInt32(dataViewPatient.SelectedRows[0].Cells[0].Value);
                //Current user
                int staffID = loginStaff.StaffID;

                Bill newBill = new Bill(Bill.SERVICEBILL, patientID, staffID);
                FormBillDetail billDetailForm = new FormBillDetail("insert", newBill);
                billDetailForm.ShowDialog();
            }
        }
예제 #7
0
        private void buttonPatientMaterial_Click(object sender, EventArgs e)
        {
            if (dataViewPatient.SelectedRows.Count > 0)
            {
                int patientID = Convert.ToInt32(dataViewPatient.SelectedRows[0].Cells[0].Value);
                if (Patient.GetPatient(patientID).State == 1)
                {
                    //Current user
                    int staffID = loginStaff.StaffID;

                    Bill newBill = new Bill(Bill.MATERIALBILL, patientID, staffID);
                    FormBillDetail billDetailForm = new FormBillDetail("insert", newBill);
                    billDetailForm.ShowDialog();
                }
                else
                {
                    MessageBox.Show("Bệnh nhân chưa nhập viện nên không được phép mượn vật tư", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                }
            }
        }
예제 #8
0
        private void buttonPrescriptionSell_Click(object sender, EventArgs e)
        {
            if (dataViewPrescription.SelectedRows.Count > 0)
            {
                int prescriptionID = Convert.ToInt32(dataViewPrescription.SelectedRows[0].Cells[0].Value);                
                int patientID = Convert.ToInt32(Prescription.GetPatientIDInPrescription(prescriptionID).Rows[0][0]);
                int staffID = loginStaff.StaffID;

                Bill newBill = new Bill(Bill.MEDICINEBILL, patientID, staffID);
                FormBillDetail billDetailForm = new FormBillDetail("insert", newBill, prescriptionID);
                billDetailForm.ShowDialog();
            }
        }
예제 #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();
        }
예제 #10
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();
        }