private void load_Template() { // TODO : _template: 0 = reguler, 1 = template, 2 = edit //MessageBox.Show("Show"); if (_template == 1) { // MessageBox.Show(_namaracikan.Substring(0, _namaracikan.Length - 3) + "0106"); var dh = new dataset.yakkumdbTableAdapters.fa_rx_template_racikanTableAdapter(); dh.FillByTempDokter(yakkumdb.fa_rx_template_racikan, _namaracikan.Substring(0, _namaracikan.Length - 3).TrimStart(), _kdokter, _kodefornas); DataTable dt = dh.GetDataByTempDokter(_namaracikan.Substring(0, _namaracikan.Length - 3).TrimStart(), _kdokter, _kdtemplateracikan); foreach (DataRow r in dt.Rows) { //MessageBox.Show(r["nama_obat"].ToString()); DataGridViewRow row = (DataGridViewRow)dgvRacik.Rows[0].Clone(); row.Cells[1].Value = r["nama_obat"].ToString(); row.Cells[2].Value = r["dosis"].ToString(); row.Cells[3].Value = r["satuan"].ToString(); row.Cells[5].Value = r["kode_obat"].ToString(); dgvRacik.Rows.Add(row); } } if (_template == 2) { var dt = new dataset.yakkumdbTableAdapters.fa_rx_racikanTableAdapter(); var dh = new dataset.yakkumdbTableAdapters.fa_rx_resep_dTableAdapter(); DataRow dr = dh.GetDataByRXD(_koderxd).Rows[0]; //Obat.Text = dr["vc_namaobat"].ToString(); //lblkodeobat.Text = dr["vc_kode_obat"].ToString(); txtdd1.Text = dr["nvc_dd1"].ToString(); txtdd2.Text = dr["nvc_dd2"].ToString(); txtJumlah.Text = dr["num_jml"].ToString(); txtSignalain.Text = dr["vc_signalain"].ToString(); cmbSatuanDosis.Text = dr["vc_satuan_dosis"].ToString(); cmbSatuan.Text = dr["vc_satuan"].ToString(); DataTable t = dt.GetDataByKodeRD(_koderxd); foreach (DataRow r in t.Rows) { DataGridViewRow row = (DataGridViewRow)dgvRacik.Rows[0].Clone(); row.Cells[1].Value = r["vc_nama_obat"].ToString(); row.Cells[2].Value = r["vc_dosis"].ToString(); row.Cells[3].Value = r["vc_satuan"].ToString(); row.Cells[5].Value = r["vc_k_obat"].ToString(); dgvRacik.Rows.Add(row); } } else { // MessageBox.Show("TEst"); } }
public static DataTable Treedata(string noreg) { var dt = new DataTable(); dt.Columns.Add("EQUID", typeof(int)); dt.Columns.Add("DESEQU", typeof(string)); var parentColumn = dt.Columns.Add("PEQUID", typeof(int)); //Data Resep var dh = new dataset.yakkumdbTableAdapters.resep_detilTableAdapter(); var th = new dataset.yakkumdbTableAdapters.fa_rx_racikanTableAdapter(); // TODO : Cari cara get variable dari luar class //MessageBox.Show(noreg); DataTable ds = dh.GetDataByGolongan(noreg); foreach (DataRow r in ds.Rows) { //Rows //MessageBox.Show(r["golongan_obat"].ToString()); dt.Rows.Add(Int32.Parse(r["kd_golongan"].ToString()), r["golongan_obat"].ToString()); DataTable ds2 = dh.GetData(noreg, r["kd_golongan"].ToString());//r["kd_golongan"].ToString() foreach (DataRow d in ds2.Rows) { //MessageBox.Show(d["vc_nama_obat"].ToString() + d["bt_racikan"].ToString()); dt.Rows.Add( Int32.Parse(d["in_no_urut"].ToString() + d["vc_kode_obat"].ToString()), d["num_jml"].ToString() + " " + d["vc_satuan"].ToString() + " | " + d["vc_nama_obat"].ToString(), Int32.Parse(d["kd_golongan"].ToString()) ); if ((Boolean)d["bt_racikan"] == true) //if ( d["bt_racikan"].ToString() == "1") { DataTable tt = th.GetDataByKodeRD(d["vc_kode_rx_d"].ToString()); foreach (DataRow t in tt.Rows) { //MessageBox.Show(t["vc_nama_obat"].ToString()); dt.Rows.Add( Int32.Parse(t["in_no_urut"].ToString() + t["vc_k_obat"].ToString()), t["vc_dosis"].ToString() + " " + t["vc_satuan"].ToString() + " | " + t["vc_nama_obat"].ToString(), Int32.Parse(d["in_no_urut"].ToString() + d["vc_kode_obat"].ToString())); } } } } return(dt); }
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(); }