public virtual CrystalDecisions.CrystalReports.Engine.ReportDocument CreateReport()
        {
            HasilRawat rpt = new HasilRawat();

            rpt.Site = this.Site;
            return(rpt);
        }
        private void Button1_Click(object sender, EventArgs e)
        {
            String dd   = DateTime.Now.Day.ToString();
            String mm   = DateTime.Now.Month.ToString();
            String yyyy = DateTime.Now.Year.ToString();

            if (checkBox1.Checked)
            {
                //Penambahan Perawatan
                String        id_pegawai = label3.Text;
                OracleCommand cmd        = new OracleCommand("SELECT ID_PERAWATAN FROM PERAWATAN WHERE NAMA_PERAWATAN = '" + label6.Text + "'", mainParent.oc);
                String        id_rawat   = cmd.ExecuteScalar().ToString();
                cmd = new OracleCommand("SELECT MAX(CTR_CHECKUP) FROM DTRANS_PERAWATAN_INAP WHERE ID_TRANS='" + id_trans + "'", mainParent.oc);
                int ctr;

                if (cmd.ExecuteScalar().ToString() != "")
                {
                    ctr = Convert.ToInt32(cmd.ExecuteScalar().ToString()) + 1;
                }
                else
                {
                    ctr = 0;
                }
                String keterangan    = textBox2.Text;
                String keluhan       = textBox1.Text;
                String tindak_lanjut = textBox3.Text;
                if (radioButton1.Checked)
                {
                    tindak_lanjut = "KELUAR";
                }
                else if (radioButton2.Checked)
                {
                    tindak_lanjut = numericUpDown1.Value.ToString() + ":" + numericUpDown2.Value.ToString() + " - Tindak Lanjut : " + comboBox4.Text;
                }

                try
                {
                    cmd = new OracleCommand("INSERT INTO DTRANS_PERAWATAN_INAP VALUES('" + id_trans + "','" + id_rawat + "','" + id_pegawai + "'," + ctr + ",'" + keterangan + "','" + keluhan + "','" + tindak_lanjut + "',TO_DATE(LPAD('" + dd + "',2,'0')||'/'||LPAD('" + mm + "',2,'0')||'/'||LPAD('" + yyyy + "',4,'0'),'DD/MM/YYYY'),'n')", mainParent.oc);
                    cmd.ExecuteNonQuery();

                    Invoice    formInvoice = new Invoice();
                    HasilRawat cr1         = new HasilRawat();
                    cr1.SetDatabaseLogon("system", "michael123", "laptop-c8ps48dq", "");
                    cr1.SetParameterValue("id_trans", id_trans);
                    cr1.SetParameterValue("dateNow", DateTime.Now);
                    cr1.SetParameterValue("keluhan", keluhan);
                    cr1.SetParameterValue("hasil", keterangan);
                    cr1.SetParameterValue("id_pegawai", id_pegawai);
                    cr1.SetParameterValue("nama_dokter", label4.Text);
                    formInvoice.crystalReportViewer1.ReportSource = cr1;
                    formInvoice.crystalReportViewer1.Refresh();
                    formInvoice.Show();
                }
                catch (Exception ex)
                {
                    MessageBox.Show(ex.Message);
                }
            }
            if (checkBox2.Checked)
            {
                //TAMBAH SUPPLY
                String        id_pegawai = label3.Text;
                OracleCommand cmd        = new OracleCommand("SELECT MAX(CTR_SUPPLY) FROM DTRANS_SUPPLY WHERE ID_TRANS='" + id_trans + "'", mainParent.oc);
                int           ctr_supply = 0;

                if (cmd.ExecuteScalar().ToString() != "")
                {
                    ctr_supply = Convert.ToInt32(cmd.ExecuteScalar().ToString()) + 1;
                }

                try
                {
                    for (int i = 0; i < listBox2.Items.Count; i++)
                    {
                        String[] supply = listBox2.Items[i].ToString().Split('|');
                        cmd = new OracleCommand("SELECT ID_SUPPLY FROM SUPPLY WHERE NAMA_SUPPLY='" + supply[1] + "'", mainParent.oc);
                        String id_supply = cmd.ExecuteScalar().ToString();
                        cmd = new OracleCommand("SELECT HARGA_SUPPLY FROM SUPPLY WHERE NAMA_SUPPLY='" + supply[1] + "'", mainParent.oc);
                        int harga    = Convert.ToInt32(cmd.ExecuteScalar().ToString());
                        int subtotal = Convert.ToInt32(supply[0]) * harga;

                        cmd = new OracleCommand("INSERT INTO DTRANS_SUPPLY VALUES('" + id_supply + "','" + id_trans + "','" + id_pegawai + "'," + supply[0] + "," + subtotal + ",'n'," + ctr_supply + ",'n')", mainParent.oc);
                        cmd.ExecuteNonQuery();
                    }
                }
                catch (Exception ex)
                {
                    MessageBox.Show(ex.Message);
                }
            }
            if (checkBox3.Checked)
            {
                //Tambah Ruang
                String nomor = label20.Text;
                String nama  = namaruangan.Text;

                if (checkBox4.Checked)
                {
                    try
                    {
                        OracleDataAdapter oda  = new OracleDataAdapter("SELECT R.ID_RUANG, R.HARGA_RUANG, DR.TOTAL_HARI FROM DTRANS_RUANG DR, RUANG R WHERE DR.ID_RUANG = R.ID_RUANG AND DR.ID_TRANS='" + id_trans + "' AND R.STATUS_RUANG='CLOSED'", mainParent.oc);
                        DataTable         inap = new DataTable();
                        oda.Fill(inap);
                        String id_ruang   = inap.Rows[0].Field <String>(0);
                        int    harga      = Convert.ToInt32(inap.Rows[0].Field <int>(1));
                        int    total_hari = Convert.ToInt32(inap.Rows[0].Field <int>(2));

                        total_hari++;
                        int subtotal = harga * total_hari;

                        OracleCommand cmd = new OracleCommand("UPDATE DTRANS_RUANG SET TOTAL_HARI=" + total_hari + ", SUBTOTAL=" + subtotal + " WHERE ID_RUANG='" + id_ruang + "' AND ID_TRANS='" + id_trans + "'", mainParent.oc);
                        cmd.ExecuteNonQuery();
                    }
                    catch (Exception ex)
                    {
                        MessageBox.Show(ex.Message);
                    }
                }
            }
        }