예제 #1
0
        private void uc_cpyResepClik(object sender, EventArgs e)
        {
            Guna.UI2.WinForms.Guna2Button us = (Guna.UI2.WinForms.Guna2Button)sender;
            var _cpyNoResep = us.Tag.ToString();

            //MessageBox.Show(_cpyNoResep);
            var       dh = new dataset.yakkumdbTableAdapters.fa_rx_resep_dTableAdapter();
            var       dt = new dataset.yakkumdbTableAdapters.fa_rx_racikanTableAdapter();
            DataTable ds = dh.GetDataByKodeRXonlyRX(_cpyNoResep);

            foreach (DataRow r in ds.Rows)
            {
                var nu = (int)dh.ScalarQueryMaxNoUrutResep(lblKodeRtx.Text) + 1;
                var sc = (int)dh.ScalarQueryNoRacikan(lblKodeRtx.Text) + 1;

                var _koderacikan = "RC" + _noreg + _kdokter + sc.ToString("00000");
                //MessageBox.Show(_koderacikan);
                if ((Boolean)r["bt_racikan"] == true)
                {
                    dh.InsertQuery
                        (lblKodeRtx.Text,
                        _koderacikan,
                        "999999",
                        sc.ToString(),
                        true,
                        r["vc_signalain"].ToString(),
                        (Boolean)r["bt_iter"],
                        (Decimal)r["num_jmliter"],
                        (Boolean)r["bt_fav"],
                        (Decimal)r["num_jml"],
                        _kdokter,
                        nu,
                        r["nvc_dd1"].ToString(),
                        r["nvc_dd2"].ToString(),
                        r["vc_satuan"].ToString(),
                        r["vc_nama_obat"].ToString(),
                        r["vc_satuan_dosis"].ToString()

                        );
                    DataTable tt = dt.GetDataByKodeRD(r["vc_kode_rx_d"].ToString());
                    foreach (DataRow t in tt.Rows)
                    {
                        dt.InsertQuery(
                            _koderacikan,
                            (int)t["in_no_urut"],
                            t["vc_k_obat"].ToString(),
                            t["vc_nama_obat"].ToString(),
                            t["vc_dosis"].ToString(),
                            t["vc_satuan"].ToString()
                            );
                    }
                }
                else
                {
                    dh.InsertQuery
                        (lblKodeRtx.Text,
                        lblKodeRtx.Text + r["vc_kode_obat"].ToString(),
                        r["vc_kode_obat"].ToString(),
                        "",
                        false,
                        r["vc_signalain"].ToString(),
                        (Boolean)r["bt_iter"],
                        (Decimal)r["num_jmliter"],
                        (Boolean)r["bt_fav"],
                        (Decimal)r["num_jml"],
                        _kdokter,
                        nu,
                        r["nvc_dd1"].ToString(),
                        r["nvc_dd2"].ToString(),
                        r["vc_satuan"].ToString(),
                        r["vc_nama_obat"].ToString(),
                        r["vc_satuan_dosis"].ToString()
                        );
                }
            }

            this.view_resepTableAdapter.Fill(this.yakkumdb.view_resep, lblKodeRtx.Text);
            bs_view_resep.Filter = "vc_kode_rx = '" + lblKodeRtx.Text + "'";
            dgvResep.Update();
            dgvResep.Refresh();

            hrclose();
            //AddData ef = new AddData(_filter, _kodeKlinik, _kodeDokter) { Dock = DockStyle.Fill, TopLevel = false, TopMost = true };
            //this.Controls.Clear();
            //this.Controls.Add(ef);
            //ef.Show();
        }
예제 #2
0
        private void btnSave_Click(object sender, EventArgs e)
        {
            switch (cekkelengkapan())
            {
            case false:
                //MessageBox.Show("Salah");
                break;

            case true:
                //MessageBox.Show("Benar");
                var dt = new dataset.yakkumdbTableAdapters.fa_rx_racikanTableAdapter();
                dt.DeleteQueryByKodeRXD(_koderxd);
                for (int i = 0; i < dgvRacik.RowCount - 1; i++)
                {
                    dt.InsertQuery(
                        _koderxd,
                        i + 1,
                        dgvRacik.Rows[i].Cells[5].Value.ToString(),
                        dgvRacik.Rows[i].Cells[1].Value.ToString(),
                        dgvRacik.Rows[i].Cells[2].Value.ToString(),
                        dgvRacik.Rows[i].Cells[3].Value.ToString()
                        );
                    //if (dgvRacik.Rows[i].Cells[2].Value.ToString() == "" || string.IsNullOrEmpty(dgvRacik.Rows[i].Cells[3].Value as string))
                    //{
                    //    MessageBox.Show("Masukan Obat Racikan");
                    //}
                    //else
                    //{
                    //dt.InsertQuery(
                    //   _koderxd,
                    //   i + 1,
                    //   dgvRacik.Rows[i].Cells[5].Value.ToString(),
                    //   dgvRacik.Rows[i].Cells[1].Value.ToString(),
                    //   dgvRacik.Rows[i].Cells[2].Value.ToString(),
                    //   dgvRacik.Rows[i].Cells[3].Value.ToString()
                    //);
                    //}
                }
                var dh = new dataset.yakkumdbTableAdapters.fa_rx_resep_dTableAdapter();
                if (_template == 2)
                {
                    dh.UpdateQuery(
                        Double.Parse(txtJumlah.Text),
                        cmbSatuan.Text,
                        txtdd1.Text,
                        txtdd2.Text,
                        cmbSatuanDosis.Text,
                        txtSignalain.Text,
                        _koderxd,
                        _nourut
                        );
                }
                else
                {
                    dh.InsertQuery
                        (_koderx,
                        _koderxd,
                        "999999",
                        _kracik,
                        true,
                        txtSignalain.Text,
                        _btIter,
                        _jmliter,
                        false,
                        Int32.Parse(txtJumlah.Text),
                        _kdokter,
                        _nourut,
                        txtdd1.Text,
                        txtdd2.Text,
                        cmbSatuan.Text,
                        _namaracikan,
                        cmbSatuanDosis.Text

                        );
                }
                this.DialogResult = DialogResult.OK;
                this.Close();
                break;
            }


            //if(cekkelengkapan() == false) { MessageBox.Show("Salah"); }
            //if (cekkelengkapan() == true)
            //{

            //}
            ////if (txtJumlah.Text == "")
            ////{
            ////    MessageBox.Show("Masukkan Jumlah Racikan");
            ////}
            ////if(cmbSatuanDosis.SelectedIndex == -1)
            ////{
            ////    MessageBox.Show("Pilih Satuan Dosis");
            ////}
            //else
            //{

            //}
        }