コード例 #1
0
ファイル: frmReferToDoctor.cs プロジェクト: insynctechs/hosms
        private void btnSave_Click(object sender, EventArgs e)
        {
            Double bill_total = 0;

            try
            {
                if (ValidateChildren(ValidationConstraints.Enabled))
                {
                    int ret = app.ReferAppointment(patient_id, Int32.Parse(cmbDoctor.SelectedValue.ToString()), Convert.ToDateTime(dtpDate.Text), Int32.Parse(Utils.ProcedureStatus["Scheduled"]), doctor_id, appointment_id);
                    if (ret >= 1)
                    {
                        DataTable dtBill = bill.GetAppointmentBill(appointment_id, patient_id, 3);
                        if (dtBill.Rows.Count == 0)
                        {
                            ConsultationDetails objCD  = new ConsultationDetails();
                            DataTable           dtProc = bill.getBillDetails(appointment_id);

                            if (dtProc == null || dtProc.Rows.Count <= 0) //no recs in billing details
                            {
                                Patients  pat   = new Patients();
                                DataTable dtPat = pat.getDetailedPatientRecordFromID(patient_id, appointment_id);
                                dtProc      = objCD.getProceduresInvoiceFromApptID(appointment_id);
                                bill_total += Convert.ToDouble(dtPat.Rows[0]["doctor_fee"].ToString());
                            }


                            foreach (DataRow row in dtProc.Rows)
                            {
                                bill_total += Convert.ToDouble(row["fee"].ToString());
                            }


                            int bill_id = bill.AddBill(appointment_id, patient_id, Convert.ToDecimal(bill_total), 3, LoggedUser.id);
                        }
                        MessageBox.Show("Appointment scheduled successfully!");
                    }
                    else if (ret == 0)
                    {
                        MessageBox.Show("Appointment already scheduled!");
                    }
                    else
                    {
                        MessageBox.Show("Error in scheduling appointment!");
                    }
                }
            }
            catch (Exception ex)
            {
                CommonLogger.Info(ex.ToString());
            }
        }
コード例 #2
0
ファイル: frmOneTimeBill.cs プロジェクト: insynctechs/hosms
        private void frmOneTimeBill_Load(object sender, EventArgs e)
        {
            try
            {
                dgvInv.AutoGenerateColumns = false;
                DataTable dtOpt = opt.GetOptionFromName("CLINIC_NAME");
                if (dtOpt.Rows.Count > 0)
                {
                    lblClinic.Text = dtOpt.Rows[0]["op_value"].ToString();
                }

                bill_total = 0;
                int k = 1;

                //displaying data to grid view
                dgvInv.ColumnHeadersBorderStyle = DataGridViewHeaderBorderStyle.None;
                //if this appointment has bill details then get records from details table
                //else for initial loading take from appt procedures
                dtProc = bill.getBillDetails(appointment_id);
                if (dtProc == null || dtProc.Rows.Count <= 0) //no recs in billing details
                {
                    dtProc      = objCD.getProceduresInvoiceFromApptID(appointment_id);
                    bill_total += Convert.ToDouble(dtPat.Rows[0]["doctor_fee"].ToString());
                    k           = 2;
                    dgvInv.Rows.Add(new object[] { "1", "Consultation Fees and Charges", Utils.FormatAmount(Convert.ToDouble(dtPat.Rows[0]["doctor_fee"].ToString())) });
                }


                foreach (DataRow row in dtProc.Rows)
                {
                    dgvInv.Rows.Add(new object[] { k, row["name"].ToString(), Utils.FormatAmount(Convert.ToDouble(row["fee"].ToString())) });
                    bill_total += Convert.ToDouble(row["fee"].ToString());
                    k++;
                }


                txtTotal.Text = Utils.FormatAmount(bill_total);

                if (bill_id == 0)
                {
                    dtBill = bill.GetAppointmentBill(appointment_id, patient_id, 3);
                    if (dtBill.Rows.Count == 0)
                    {
                        if (!(LoggedUser.id > 0))
                        {
                            LoggedUser.id = 1;
                        }

                        bill_id = bill.AddBill(appointment_id, patient_id, Convert.ToDecimal(bill_total), 3, LoggedUser.id);


                        if (bill_id > 0)
                        {
                            dtBill = bill.GetBill(bill_id);
                        }
                        else
                        {
                            MessageBox.Show("Error in Creating Bill");
                        }
                    }
                    else
                    {
                        bill_id = Int32.Parse(dtBill.Rows[0]["id"].ToString());
                    }
                }
                if (bill_id > 0)
                {
                    txtInvNum.Text  = dtBill.Rows[0]["bill_number"].ToString();
                    txtDate.Text    = Convert.ToDateTime(dtPat.Rows[0]["meet_date"].ToString()).ToShortDateString();
                    bill_total      = Convert.ToDouble(dtBill.Rows[0]["bill_amount"].ToString());
                    bill_paid       = Convert.ToDouble(dtBill.Rows[0]["bill_paid"].ToString());
                    bill_paid_load  = bill_paid;
                    txtPaid.Text    = Utils.FormatAmount(bill_paid);
                    bill_balance    = Convert.ToDouble(dtBill.Rows[0]["bill_balance"].ToString());
                    txtBalance.Text = Utils.FormatAmount(bill_balance);
                    lblTime.Text    = dtBill.Rows[0]["bill_date"].ToString();
                    int creator = Int32.Parse(dtBill.Rows[0]["bill_created_userid"].ToString());
                    //txtPrevDues.Text = dtBill.Rows[0]["bill_due"].ToString();
                    if (dtBill.Rows[0]["bill_due"].ToString() != "")
                    {
                        txtPrevDues.Text = Utils.FormatAmount(Convert.ToDouble(dtBill.Rows[0]["bill_due"].ToString()));
                        txtTotal.Text    = Utils.FormatAmount(bill_total + Convert.ToDouble(txtPrevDues.Text));
                    }
                    else
                    {
                        txtPrevDues.Text = "0.000";
                        txtTotal.Text    = Utils.FormatAmount(bill_total);
                    }
                    DataTable dtUser = bill.GetBillCreatedUser(creator);
                    if (dtUser != null)
                    {
                        txtLoggedUser.Text = dtUser.Rows[0]["staff_name"].ToString();
                    }
                    cmbBillStatus.SelectedValue = dtBill.Rows[0]["bill_status"].ToString();
                    bill_status = Int32.Parse(dtBill.Rows[0]["bill_status"].ToString());
                }

                editBillDetails();
            }
            catch (Exception ex)
            {
                CommonLogger.Info(ex.ToString());
            }
        }
コード例 #3
0
        private void frmProceduresBill_Load(object sender, EventArgs e)
        {
            try
            {
                dgvInv.AutoGenerateColumns = false;
                DataTable dtOpt = opt.GetOptionFromName("CLINIC_NAME");
                if (dtOpt.Rows.Count > 0)
                {
                    lblClinic.Text = dtOpt.Rows[0]["op_value"].ToString();
                }

                //displaying data to grid view
                dgvInv.ColumnHeadersBorderStyle = DataGridViewHeaderBorderStyle.None;
                dtProc = objCD.getProceduresInvoiceFromApptID(appointment_id);
                int k = 1;

                foreach (DataRow row in dtProc.Rows)
                {
                    dgvInv.Rows.Add(new object[] { k, row["name"].ToString(), row["fee"].ToString() });
                    bill_total += Convert.ToDouble(row["fee"].ToString());
                    k++;
                }
                txtTotal.Text = Utils.FormatAmount(bill_total);

                if (bill_id == 0)
                {
                    dtBill = bill.GetAppointmentBill(appointment_id, patient_id, 2);
                    if (dtBill.Rows.Count == 0)
                    {
                        if (!(LoggedUser.id > 0))
                        {
                            LoggedUser.id = 1;
                        }
                        //sj bill_id = bill.AddBill(appointment_id, patient_id, Convert.ToDecimal(dtPat.Rows[0]["doctor_fee"].ToString()), 1, LoggedUser.id);
                        bill_id = bill.AddBill(appointment_id, patient_id, Convert.ToDecimal(bill_total), 2, LoggedUser.id);
                        if (bill_id > 0)
                        {
                            dtBill = bill.GetBill(bill_id);
                        }
                        else
                        {
                            MessageBox.Show("Error in Creating Bill");
                        }
                    }
                    else
                    {
                        bill_id = Int32.Parse(dtBill.Rows[0]["id"].ToString());
                    }
                }
                if (bill_id > 0)
                {
                    txtInvNum.Text  = dtBill.Rows[0]["bill_number"].ToString();
                    txtDate.Text    = Convert.ToDateTime(dtPat.Rows[0]["meet_date"].ToString()).ToShortDateString();
                    bill_total      = Convert.ToDouble(dtBill.Rows[0]["bill_amount"].ToString());
                    bill_paid       = Convert.ToDouble(dtBill.Rows[0]["bill_paid"].ToString());
                    txtPaid.Text    = Utils.FormatAmount(bill_paid);
                    bill_balance    = Convert.ToDouble(dtBill.Rows[0]["bill_balance"].ToString());
                    txtBalance.Text = Utils.FormatAmount(bill_balance);
                    lblTime.Text    = dtBill.Rows[0]["bill_date"].ToString();
                    int creator = Int32.Parse(dtBill.Rows[0]["bill_created_userid"].ToString());
                    txtPrevDues.Text = dtPat.Rows[0]["dues"].ToString();
                    txtTotal.Text    = Utils.FormatAmount(bill_total + Convert.ToDouble(txtPrevDues.Text));
                    DataTable dtUser = bill.GetBillCreatedUser(creator);
                    if (dtUser != null)
                    {
                        txtLoggedUser.Text = dtUser.Rows[0]["staff_name"].ToString();
                    }
                    cmbBillStatus.SelectedValue = dtBill.Rows[0]["bill_status"].ToString();
                    if (dtBill.Rows[0]["bill_status"].ToString() == "4")
                    {
                        txtPaid.ReadOnly = true;
                        dgvInv.ReadOnly  = true;
                        btnSave.Enabled  = false;
                    }
                }
            }
            catch (Exception ex)
            {
                CommonLogger.Info(ex.ToString());
            }
        }