Esempio n. 1
0
        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());
            }
        }
Esempio n. 2
0
        private void btnSave_Click(object sender, EventArgs e)
        {
            btnPay.Enabled         = true;
            btnChangeTable.Enabled = true;
            bool        status     = false;
            double      totalPrice = Convert.ToDouble(txtToTal.Text);
            int         sale       = Convert.ToInt32(cbxSale.SelectedItem);
            List <Bill> bills      = Bill.GetAllBill(tableid);

            if (!btnAddFood.Enabled)
            {
                ArrayList arrayList = new ArrayList()
                {
                    DateTime.Now, tableid, status, totalPrice, lblStaff.Text, sale
                };
                Bill.AddBill(arrayList);
            }

            int billId = Bill.GetAllBill(tableid)[0].Id;

            if (Bill.GetAllBill(tableid).Count > 0)
            {
                BillInfor.DeleteBillInfor(billId);
            }
            for (int i = 0; i < dgvOrder.Rows.Count; i++)
            {
                ArrayList billInfor = new ArrayList()
                {
                    billId, foodId[i], dgvOrder.Rows[i].Cells["Số Lượng"].Value, dgvOrder.Rows[i].Cells["Thành Tiền"].Value
                };
                BillInfor.AddBill(billInfor);
            }
            ArrayList tableList = new ArrayList()
            {
                "Có Người", tableid
            };

            Table.UpdateTableStatus(tableList);
            LoadTable();
            dgvOrder.DataSource = MenuDAL.GetMenuByTableId(tableid);
            refreshDgvOrder();
        }
Esempio n. 3
0
        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());
            }
        }
Esempio n. 4
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());
            }
        }
Esempio n. 5
0
        private void frmConsultationBill_Load(object sender, EventArgs e)
        {
            try
            {
                dgvInv.ColumnHeadersBorderStyle = DataGridViewHeaderBorderStyle.None;
                dgvInv.AutoGenerateColumns      = false;
                DataTable dtOpt = opt.GetOptionFromName("CLINIC_NAME");
                if (dtOpt.Rows.Count > 0)
                {
                    lblClinic.Text = dtOpt.Rows[0]["op_value"].ToString();
                }
                if (bill_id == 0)
                {
                    dtBill = bill.GetAppointmentBill(appointment_id, patient_id, 1);
                    if (dtBill.Rows.Count == 0)
                    {
                        bill_id = bill.AddBill(appointment_id, patient_id, Convert.ToDecimal(dtPat.Rows[0]["doctor_fee"].ToString()), 1, 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());
                    dgvInv.Rows.Add(new object[] { "1", "Consultation Fees and Charges", Utils.FormatAmount(bill_total) });

                    txtTotal.Text   = Utils.FormatAmount(bill_total);
                    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());
                    DataTable dtUser  = bill.GetBillCreatedUser(creator);
                    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());
            }
        }
Esempio n. 6
0
        private void FormFoodChoices_Load(object sender, EventArgs e)
        {
            #region Dymamic Menu
            TabControl tab          = new TabControl();
            var        listCategory = Category.GetListCategory();
            tab.Location = new Point(10, 65);
            tab.Size     = new Size(555, 445);
            tab.Font     = new Font("UTM Bebas", 12, FontStyle.Regular);
            for (int i = 0; i < listCategory.Count; i++)
            {
                TabPage tp = new TabPage(listCategory[i].Name);
                tp.Location  = new Point(10, 58);
                tp.BackColor = Color.Transparent;
                var             listFood = Food.GetFoodByCategory(listCategory[i].ID);
                FlowLayoutPanel fl       = new FlowLayoutPanel();
                fl.Location   = new Point(0, 0);
                fl.BackColor  = Color.Transparent;
                fl.AutoScroll = true;
                fl.Dock       = DockStyle.Fill;
                for (int j = 0; j < listFood.Count; j++)
                {
                    Panel pn = new Panel();
                    pn.Size      = new Size(170, 250);
                    pn.BackColor = Color.DarkGray;
                    PictureBox pc = new PictureBox();
                    pc.Location = new Point(20, 10);
                    pc.Size     = new Size(130, 120);
                    //  if (listFood[j].Image == null) pc.Image = Image.FromFile(@"C:\Users\Admin\Desktop\Food\bia-tiger-lon-01.jpg");
                    //else pc.Image = Image.FromFile(listFood[j].Image);

                    pc.SizeMode = PictureBoxSizeMode.StretchImage;
                    Label         name      = new Label();
                    Label         lbGia     = new Label();
                    Label         VND       = new Label();
                    Label         sl        = new Label();
                    NumericUpDown numeric   = new NumericUpDown();
                    Button        btnChon   = new Button();
                    Button        btnBoChon = new Button();

                    btnChon.Text        = "Chọn";
                    btnBoChon.Text      = "Bỏ Chọn";
                    btnChon.Font        = new Font("UTM Bebas", 10, FontStyle.Regular);
                    btnBoChon.Font      = new Font("UTM Bebas", 10, FontStyle.Regular);
                    btnChon.Tag         = listFood[j].ID;
                    btnBoChon.Tag       = listFood[j].ID;
                    btnChon.Click      += new EventHandler(this.chon_Click);
                    btnBoChon.Click    += new EventHandler(this.bochon_Click);
                    btnBoChon.Size      = new Size(55, 30);
                    btnChon.Size        = new Size(55, 30);
                    btnChon.Location    = new Point(30, pn.Height - 5 - btnChon.Height);
                    btnBoChon.Location  = new Point(30 + btnChon.Width, pn.Height - 5 - btnBoChon.Height);
                    btnBoChon.BackColor = Color.Transparent;
                    btnChon.BackColor   = Color.Transparent;

                    sl.Text          = "Số Lượng";
                    sl.Location      = new Point(btnChon.Location.X, btnChon.Location.Y - 25);
                    sl.Size          = new Size(60, 30);
                    numeric.Value    = 0;
                    numeric.Name     = "SL";
                    numeric.Font     = new Font("UTM Bebas", 10, FontStyle.Regular);
                    numeric.Size     = new Size(50, 25);
                    numeric.Location = new Point(sl.Location.X + sl.Width, sl.Location.Y);
                    pn.Controls.Add(btnBoChon);
                    pn.Controls.Add(btnChon);
                    pn.Controls.Add(sl);
                    pn.Controls.Add(numeric);
                    lbGia.Text     = String.Format("{0:n0}", listFood[j].Price);
                    lbGia.Location = new Point(sl.Location.X, sl.Location.Y - sl.Height);
                    pn.Controls.Add(lbGia);

                    VND.Text     = "VND";
                    VND.Location = new Point(numeric.Location.X + numeric.Width - 30, sl.Location.Y - sl.Height);

                    pn.Controls.Add(pc);
                    pn.Controls.Add(VND);
                    VND.BringToFront();

                    name.Text      = listFood[j].Name;
                    name.Size      = new Size(120, 20);
                    name.Font      = new Font("UTM Bebas", 10, FontStyle.Regular);
                    name.Location  = new Point(lbGia.Location.X, lbGia.Location.Y - lbGia.Height);
                    name.TextAlign = ContentAlignment.MiddleCenter;
                    pn.Controls.Add(name);
                    fl.Controls.Add(pn);
                }
                tab.TabPages.Add(tp);
                tp.Controls.Add(fl);
            }
            this.Controls.Add(tab);
            tab.BringToFront();
            #endregion
            ID_Bill = Bill.AddBill(EmployeeID);
            dataGridView1.ReadOnly              = true;
            dataGridView1.AutoSizeColumnsMode   = DataGridViewAutoSizeColumnsMode.Fill;
            dataGridView1.AllowUserToAddRows    = false;
            dataGridView1.SelectionMode         = DataGridViewSelectionMode.FullRowSelect;
            dataGridView1.BackgroundColor       = Color.White;
            dataGridView1.RowHeadersVisible     = false;
            dataGridView1.DefaultCellStyle.Font = new Font("UTM", 10, FontStyle.Regular);
        }