예제 #1
0
        void EditUpdate()
        {
            koneksi = new cds_MYSQLKonektor(new cds_KoneksiString(SettingHelper.host, SettingHelper.user, SettingHelper.pass, SettingHelper.port), true, System.Data.IsolationLevel.Serializable);
            param   = new ParameterData[] { new ParameterData("nama_terapi", txtNama.Text),
                                            new ParameterData("jenis_terapi", txtJenis.Text),
                                            new ParameterData("biaya_terapi", biayaAngka),
                                            new ParameterData("keterangan_terapi", txtKeterangan.Text) };

            koneksi.UpdateRow(SettingHelper.database, "tbl_terapi", "id_terapi=" + txtID.Text, 0, param);
            koneksi.Commit(true);

            AddItemCallback();
            koneksi.Dispose();

            this.Close();
            MessageBox.Show("Data terapi berhasil diubah", "Informasi", MessageBoxButton.OK, MessageBoxImage.Information);
        }
예제 #2
0
        void EditUpdate()
        {
            koneksi = new cds_MYSQLKonektor(new cds_KoneksiString(SettingHelper.host, SettingHelper.user, SettingHelper.pass, SettingHelper.port), true, System.Data.IsolationLevel.Serializable);
            param   = new ParameterData[] { new ParameterData("nama_karyawan", txtNama.Text),
                                            new ParameterData("jenis_karyawan", cmbJenis.SelectedItem),
                                            new ParameterData("alamat_karyawan", txtAlamat.Text),
                                            new ParameterData("telp_karyawan", txtTelp.Text),
                                            new ParameterData("tglmasuk_karyawan", datePick.SelectedDate),
                                            new ParameterData("keterangan_karyawan", txtKeterangan.Text) };
            koneksi.UpdateRow(SettingHelper.database, "tbl_karyawan", "id_karyawan=" + txtID.Text, 0, param);
            koneksi.Commit(true);

            AddItemCallback();

            koneksi.Dispose();
            this.Close();
            MessageBox.Show("Data karyawan berhasil diubah", "Informasi", MessageBoxButton.OK, MessageBoxImage.Information);
        }
예제 #3
0
        private void Status_Click(object sender, RoutedEventArgs e)
        {
            var button = (FrameworkElement)sender;
            var row    = (DataGridRow)button.Tag;

            ((CheckBox)sender).IsChecked = !((CheckBox)sender).IsChecked;

            //MessageBox.Show(((CheckBox)sender).IsChecked.ToString());
            MessageBoxResult result = MessageBox.Show("Ubah Status Appointment?", "Konfirmasi", MessageBoxButton.YesNo);

            if (result == MessageBoxResult.Yes)
            {
                koneksi = new cds_MYSQLKonektor(new cds_KoneksiString(SettingHelper.host, SettingHelper.user, SettingHelper.pass, SettingHelper.port), true, System.Data.IsolationLevel.Serializable);
                //Update Status database
                ((CheckBox)sender).IsChecked = !((CheckBox)sender).IsChecked;

                bool statusbool = (bool)((CheckBox)sender).IsChecked;
                int  status;
                if (statusbool)
                {
                    status = 1;
                }
                else
                {
                    status = 0;
                }

                ParameterData[] parameter = new ParameterData[] { new ParameterData("status_appo", status) };

                koneksi.UpdateRow(SettingHelper.database, "tbl_appointment", "id_appo=" + GetIndexKaryawan(row), 0, parameter);
                koneksi.Commit(true);

                //AddItemCallback();
                koneksi.Dispose();
                MessageBox.Show("Data status appointment berhasil diubah", "Informasi", MessageBoxButton.OK, MessageBoxImage.Information);



                //Warna();
                //MessageBox.Show(GetIndexKaryawan(row));
            }
        }
예제 #4
0
        void EditUpdate()
        {
            koneksi = new cds_MYSQLKonektor(new cds_KoneksiString(SettingHelper.host, SettingHelper.user, SettingHelper.pass, SettingHelper.port), true, System.Data.IsolationLevel.Serializable);
            param   = new ParameterData[] { new ParameterData("id_pasien", IDPasien),
                                            new ParameterData("jam_appo", dJam),
                                            new ParameterData("tanggal_appo", datePick.SelectedDate),
                                            new ParameterData("norm_appo", txtNoRm.Text),
                                            new ParameterData("namapasien_appo", txtNamaPasien.Text),
                                            new ParameterData("namadokter_appo", cmbNamaDokter.SelectedItem),
                                            new ParameterData("status_appo", status),
                                            new ParameterData("keterangan_appo", txtKeterangan.Text) };

            koneksi.UpdateRow(SettingHelper.database, "tbl_appointment", "id_appo =" + IDAppoinment, 0, param);
            koneksi.Commit(true);

            AddItemCallback();
            koneksi.Dispose();

            this.Close();
            MessageBox.Show("Data appointment berhasil diubah", "Informasi", MessageBoxButton.OK, MessageBoxImage.Information);
        }
예제 #5
0
        void EditUpdate()
        {
            koneksi = new cds_MYSQLKonektor(new cds_KoneksiString(SettingHelper.host, SettingHelper.user, SettingHelper.pass, SettingHelper.port), true, System.Data.IsolationLevel.Serializable);
            param = new ParameterData[] { new ParameterData("nama_obat", txtNama.Text),
                                          new ParameterData("jenis_obat",  cmbJenis.SelectedItem),
                                          new ParameterData("hargabeli_obat", biayaBeliAngka),
                                          new ParameterData("hargajual_obat", biayaJualAngka),
                                          new ParameterData("stok_obat", txtStok.Text),
                                          new ParameterData("keterangan_obat", txtKeterangan.Text)};

            koneksi.UpdateRow(SettingHelper.database, "tbl_obat", "id_obat=" + txtID.Text, 0, param);
            koneksi.Commit(true);

            AddItemCallback();
            koneksi.Dispose();

            this.Close();
            MessageBox.Show("Data obat berhasil diubah", "Informasi", MessageBoxButton.OK, MessageBoxImage.Information);
        }
        void EditUpdate()
        {
            koneksi = new cds_MYSQLKonektor(new cds_KoneksiString(SettingHelper.host, SettingHelper.user, SettingHelper.pass, SettingHelper.port), true, System.Data.IsolationLevel.Serializable);
            param = new ParameterData[] { new ParameterData("nama_karyawan", txtNama.Text),
                                          new ParameterData("jenis_karyawan", cmbJenis.SelectedItem),
                                          new ParameterData("alamat_karyawan", txtAlamat.Text),
                                          new ParameterData("telp_karyawan", txtTelp.Text),
                                          new ParameterData("tglmasuk_karyawan", datePick.SelectedDate),
                                          new ParameterData("keterangan_karyawan", txtKeterangan.Text)};
            koneksi.UpdateRow(SettingHelper.database, "tbl_karyawan", "id_karyawan=" + txtID.Text, 0, param);
            koneksi.Commit(true);

            AddItemCallback();

            koneksi.Dispose();
            this.Close();
            MessageBox.Show("Data karyawan berhasil diubah", "Informasi", MessageBoxButton.OK, MessageBoxImage.Information);
        }
예제 #7
0
        private void dgTerapi_CurrentCellChanged(object sender, EventArgs e)
        {
            if (v != null)
            {
                v.EndEdit();

                string   StandartMasuk1 = "06:30:00";
                DateTime s1             = DateTime.Parse(StandartMasuk1);
                string   StandartMasuk2 = "4:30:00";
                DateTime s2             = DateTime.Parse(StandartMasuk2);

                string   Msk1 = (string)v[4].ToString();
                DateTime m1   = DateTime.Parse(Msk1);
                string   Plg1 = (string)v[5].ToString();
                DateTime p1   = DateTime.Parse(Plg1);


                string   Msk2 = (string)v[6].ToString();
                DateTime m2   = DateTime.Parse(Msk2);
                string   Plg2 = (string)v[7].ToString();
                DateTime p2   = DateTime.Parse(Plg2);

                double TotalP1_M1 = (p1.TimeOfDay - m1.TimeOfDay).TotalHours;
                double TotalP2_M2 = (p2.TimeOfDay - m2.TimeOfDay).TotalHours;

                double   total  = 0;
                double   jumlah = TotalP1_M1 + TotalP2_M2;
                TimeSpan LT; // = TimeSpan.FromHours(total);
                TimeSpan OT; // = TimeSpan.FromHours(total);
                TimeSpan RumusJumlah = TimeSpan.FromHours(jumlah);

                //MessageBox.Show((TotalP2_M2).ToString());
                if (TotalP2_M2 == 0)
                {
                    total = ((s1.TimeOfDay.TotalHours - TotalP1_M1));
                }

                if (TotalP1_M1 == 0)
                {
                    total = ((s2.TimeOfDay.TotalHours - TotalP2_M2));
                }

                if (TotalP2_M2 != 0 && TotalP1_M1 != 0)
                {
                    total = ((s1.TimeOfDay.TotalHours - TotalP1_M1) + (s2.TimeOfDay.TotalHours - TotalP2_M2));
                }

                if (total >= 0)
                {
                    LT = TimeSpan.FromHours(total);
                    OT = TimeSpan.Zero;
                }
                else
                {
                    OT = TimeSpan.FromHours(total);
                    LT = TimeSpan.Zero;
                }


                //MessageBox.Show((string)v[4].ToString());
                koneksi = new cds_MYSQLKonektor(new cds_KoneksiString(SettingHelper.host, SettingHelper.user, SettingHelper.pass, SettingHelper.port), true, System.Data.IsolationLevel.Serializable);
                param   = new ParameterData[] { new ParameterData("masuk1_presensi", TimeSpan.ParseExact((string)v[4].ToString(), "c", null)),
                                                new ParameterData("pulang1_presensi", TimeSpan.ParseExact((string)v[5].ToString(), "c", null)),
                                                new ParameterData("masuk2_presensi", TimeSpan.ParseExact((string)v[6].ToString(), "c", null)),
                                                new ParameterData("pulang2_presensi", TimeSpan.ParseExact((string)v[7].ToString(), "c", null)),
                                                new ParameterData("ot_presensi", OT),
                                                new ParameterData("lt_presensi", LT),
                                                new ParameterData("jumlah_presensi", RumusJumlah) };
                koneksi.UpdateRow(SettingHelper.database, "tbl_presensi", "id_presensi=" + (string)v[0].ToString(), 0, param);
                koneksi.Commit(true);

                ShowDataTabel();

                /*
                 * double TotalJumlah = 0;
                 * DateTime d = new DateTime();
                 * for (int x = 0; x < dgTerapi.Items.Count; x++)
                 * {
                 *
                 *  var rows = (DataGridRow)dgTerapi.ItemContainerGenerator.ContainerFromIndex(x);
                 *
                 *  DataRowView vx = (DataRowView)dgTerapi.Items[x];
                 *  DateTime t = DateTime.Parse((string)vx[10].ToString());
                 *
                 *  //d = d + t.TimeOfDay;
                 *
                 *  TotalJumlah += (d.TimeOfDay + t.TimeOfDay).TotalHours;
                 * }
                 *
                 * totalJumlah.Text = TimeSpan.FromHours(TotalJumlah).ToString();
                 */

                //MessageBox.Show("Data karyawan berhasil diubah", "Informasi", MessageBoxButton.OK, MessageBoxImage.Information);

                koneksi.Dispose();
                v = null;
            }
        }
        void EditUpdate()
        {
            koneksi = new cds_MYSQLKonektor(new cds_KoneksiString(SettingHelper.host, SettingHelper.user, SettingHelper.pass, SettingHelper.port), true, System.Data.IsolationLevel.Serializable);
            param = new ParameterData[] { new ParameterData("id_pasien", IDPasien),
                                          new ParameterData("jam_appo", dJam),
                                          new ParameterData("tanggal_appo", datePick.SelectedDate),
                                          new ParameterData("norm_appo", txtNoRm.Text),
                                          new ParameterData("namapasien_appo", txtNamaPasien.Text),
                                          new ParameterData("namadokter_appo", cmbNamaDokter.SelectedItem),
                                          new ParameterData("status_appo", status),
                                          new ParameterData("keterangan_appo", txtKeterangan.Text)};

            koneksi.UpdateRow(SettingHelper.database, "tbl_appointment", "id_appo =" + IDAppoinment, 0, param);
            koneksi.Commit(true);

            AddItemCallback();
            koneksi.Dispose();

            this.Close();
            MessageBox.Show("Data appointment berhasil diubah", "Informasi", MessageBoxButton.OK, MessageBoxImage.Information);
        }
예제 #9
0
        private void btn_tambah_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                if (txtKWT.Text != string.Empty && txtNamaPasien.Text != string.Empty && cmbNamaDokter.SelectedIndex != -1)
                {
                    if (dgTerapi.Items.Count > 0 || dgObat.Items.Count > 0)
                    {
                        string invoice_order = UnixTimeNow().ToString();
                        string grandTotal    = txtGrandTotal.Text.Replace("Rp", "").Replace(".", "").Replace(",", "");
                        string totalObat     = txtTotalObat.Text.Replace("Rp", "").Replace(".", "").Replace(",", "");
                        string totalRekap    = txtTotalTerapi.Text.Replace("Rp", "").Replace(".", "").Replace(",", "");
                        koneksi = new cds_MYSQLKonektor(new cds_KoneksiString(SettingHelper.host, SettingHelper.user, SettingHelper.pass, SettingHelper.port), true, System.Data.IsolationLevel.Serializable);
                        //Terapi
                        for (int x = 0; x < dgTerapi.Items.Count; x++)
                        {
                            var        row = (DataGridRow)dgTerapi.ItemContainerGenerator.ContainerFromIndex(x);
                            DataTerapi v   = (DataTerapi)dgTerapi.Items[row.GetIndex()];



                            // ParameterData dalam bentuk Array (Menyesuakian Database)
                            param = new ParameterData[] { new ParameterData("invoice_rekapterapi", invoice_order),
                                                          new ParameterData("tanggal_rekapterapi", datePick.SelectedDate),
                                                          new ParameterData("nokwt_rekapterapi", txtKWT.Text),
                                                          new ParameterData("namaterapi_rekapterapi", v.NamaTerapi),
                                                          new ParameterData("namapasien_rekapterapi", txtNamaPasien.Text),
                                                          new ParameterData("namadokter_rekapterapi", cmbNamaDokter.Text),
                                                          new ParameterData("qty_rekapterapi", 1),
                                                          new ParameterData("card_rekapterapi", txtCard.Text),
                                                          new ParameterData("diskon_rekapterapi", txtDiskon.Text),
                                                          new ParameterData("total_rekapterapi", totalRekap),
                                                          new ParameterData("grandtotal_rekapterapi", grandTotal) };

                            koneksi.InsertRow(SettingHelper.database, "tbl_rekapterapi", true, param);

                            // Penting ketika melakukan fungsi InsertRow, kalau tidak dicommit data gk akan masuk ke database
                            koneksi.Commit(true);

                            // melaksanakan fungsi delegate
                        }



                        for (int x = 0; x < dgObat.Items.Count; x++)
                        {
                            var      row = (DataGridRow)dgObat.ItemContainerGenerator.ContainerFromIndex(x);
                            DataObat v   = (DataObat)dgObat.Items[row.GetIndex()];



                            // ParameterData dalam bentuk Array (Menyesuakian Database)
                            param = new ParameterData[] { new ParameterData("invoice_rekapobat", invoice_order),
                                                          new ParameterData("tanggal_rekapobat", datePick.SelectedDate),
                                                          new ParameterData("nokwt_rekapobat", txtKWT.Text),
                                                          new ParameterData("namapasien_rekapobat", txtNamaPasien.Text),
                                                          new ParameterData("namadokter_rekapobat", cmbNamaDokter.Text),
                                                          new ParameterData("namaobat_rekapobat", v.NamaObat),
                                                          new ParameterData("qty_rekapobat", v.QTY),
                                                          new ParameterData("card_rekapobat", txtCard.Text),
                                                          new ParameterData("diskon_rekapobat", txtCard.Text),
                                                          new ParameterData("total_rekapobat", totalObat),
                                                          new ParameterData("grandtotal_rekapobat", grandTotal) };

                            koneksi.InsertRow(SettingHelper.database, "tbl_rekapobat", true, param);

                            // Penting ketika melakukan fungsi InsertRow, kalau tidak dicommit data gk akan masuk ke database
                            koneksi.Commit(true);



                            //pengurangan stok

                            DataTable Datatable = koneksi.GetDataTable("SELECT * FROM mydentist.tbl_obat WHERE mydentist.tbl_obat.id_obat =" + v.ID, null);

                            int stokakhir = 0;

                            foreach (DataRow rows in Datatable.Rows)
                            {
                                stokakhir = (int)rows["stok_obat"] - v.QTY;
                                MessageBox.Show(stokakhir.ToString());

                                try
                                {
                                    //koneksi = new cds_MYSQLKonektor(new cds_KoneksiString(SettingHelper.host, SettingHelper.user, SettingHelper.pass, SettingHelper.port), true, System.Data.IsolationLevel.Serializable);
                                    ParameterData[] para = new ParameterData[] { new ParameterData("stok_obat", stokakhir) };
                                    koneksi.UpdateRow(SettingHelper.database, "tbl_obat", "id_obat=" + v.ID, 1, para);
                                    koneksi.Commit(true);
                                }catch (Exception ex) {
                                    //MessageBox.Show(ex.Message);
                                }
                            }
                        }



                        for (int i = 0; i < dgPerawat.Items.Count; i++)
                        {
                            DataGridRow rows     = (DataGridRow)dgPerawat.ItemContainerGenerator.ContainerFromIndex(i);
                            CheckBox    checkBox = FindChild <CheckBox>(rows, "chkSelectAll");
                            //checkBox.IsChecked = ((CheckBox)sender).IsChecked;

                            if (checkBox != null && checkBox.IsChecked == true)
                            {
                                DataRowView v = (DataRowView)dgPerawat.Items[rows.GetIndex()];

                                //koneksi = new cds_MYSQLKonektor(new cds_KoneksiString(SettingHelper.host, SettingHelper.user, SettingHelper.pass, SettingHelper.port), true, System.Data.IsolationLevel.Serializable);
                                // ParameterData dalam bentuk Array (Menyesuakian Database)
                                param = new ParameterData[] { new ParameterData("nama_perawat", (string)v[1].ToString()),
                                                              new ParameterData("id_perawat", (string)v[0].ToString()),
                                                              new ParameterData("tanggal_rekapperawat", datePick.SelectedDate),
                                                              new ParameterData("invoice_rekapperawat", invoice_order),
                                                              new ParameterData("nokwt_rekapperawat", txtKWT.Text) };

                                koneksi.InsertRow(SettingHelper.database, "tbl_rekapperawat", true, param);

                                // Penting ketika melakukan fungsi InsertRow, kalau tidak dicommit data gk akan masuk ke database
                                koneksi.Commit(true);
                                // koneksi.Dispose();
                            }
                        }

                        koneksi.Dispose();
                        MessageBox.Show("Data transaki berhasil disimpan", "Informasi", MessageBoxButton.OK, MessageBoxImage.Information);
                        ClearAll();
                    }
                    else
                    {
                        MessageBox.Show("Mohon data field diisi !", "Informasi", MessageBoxButton.OK, MessageBoxImage.Error);
                    }
                }
                else
                {
                    MessageBox.Show("Mohon data field diisi !", "Informasi", MessageBoxButton.OK, MessageBoxImage.Error);
                }
            }catch (Exception ex) {
                MessageBox.Show(ex.Message);
            }
        }