Пример #1
0
        private void FrmDetailSPD_Load(object sender, EventArgs e)
        {
            //hide label dan komponen passing data
            lblkomitmen.Visible     = false;
            lblnip_komitmen.Visible = false;

            data_.Visible     = false;
            lama.Visible      = false;
            asal.Visible      = false;
            tujuan.Visible    = false;
            total.Visible     = false;
            terbilang.Visible = false;

            Form1 _nm1 = new Form1();

            spd = DbQuery.getSpdById(id);
            foreach (var s in spd)
            {
                lblPNama.Text        = s.p_nama;
                lblKode.Text         = s.kode;
                lblNip.Text          = s.nip;
                lblMaksud.Text       = s.maksud;
                lblTB.Text           = s.tb;
                lblTransportasi.Text = s.transport;
                lblTBerangkat.Text   = s.t_berangkat;
                lblTTujuan.Text      = s.t_tujuan;
                lblTNama.Text        = s.penjabat;
                lblJabatan.Text      = s.t_jabatan;
                lblTglBerangkat.Text = s.tgl_berangkat;
                lblTglKemabali.Text  = s.tgl_kembali;
                lblLama.Text         = s.lama.ToString();
                lblNoSurat.Text      = s.no_surat;
                lblTglSurat.Text     = s.tgl_tugas;
                lblAkun.Text         = s.akun;

                tujuan.Text = s.t_tujuan;


                lblkomitmen.Text     = komitmens;
                lblnip_komitmen.Text = nipss;
            }

            biaya = DbQuery.getBiayaBydata(id);
            foreach (var b in biaya)
            {
                lblUangHarian.Text     = "Rp. " + b.h_total.ToString();
                lblPenginapan.Text     = "Rp. " + b.p_total.ToString();
                lblTransportPP.Text    = "Rp. " + b.transport_pp.ToString();
                lblTransportLokal.Text = "Rp. " + b.transport_loak.ToString();
                lblDamri.Text          = "Rp. " + b.damri.ToString();
                lblLainLain.Text       = "Rp. " + b.lain_lain.ToString();

                data_.Text = b.id.ToString();

                lama.Text  = b.h_lama.ToString() + " Hari";
                _total     = (b.h_total) + (b.p_total) + (b.transport_pp) + (b.transport_loak) + (b.damri) + (b.lain_lain);
                total.Text = " Rp." + _total.ToString("N0", CultureInfo.InvariantCulture);

                _Terbilang ter = new _Terbilang();
                terbilang.Text = ter.Terbilang(_total).TrimStart() + " RUPIAH";
            }

            pengikut = DbQuery.getPengikutByData(id);
            if (pengikut.ElementAtOrDefault(0) != null)
            {
                Pegawai p = DbQuery.GetPegawaiById(pengikut[0].pegawai);
                lblNPengikut1.Text   = p.nama;
                lblTglPengikut1.Text = pengikut[0].t_lahir;
                lblKetPengikut1.Text = pengikut[0].ket;
            }

            if (pengikut.ElementAtOrDefault(1) != null)
            {
                Pegawai p = DbQuery.GetPegawaiById(pengikut[1].pegawai);
                lblNPengikut2.Text   = p.nama;
                lblTglPengikut2.Text = pengikut[1].t_lahir;
                lblKetPengikut2.Text = pengikut[1].ket;
            }

            if (pengikut.ElementAtOrDefault(2) != null)
            {
                Pegawai p = DbQuery.GetPegawaiById(pengikut[2].pegawai);
                lblNPengikut3.Text   = p.nama;
                lblTglPengikut3.Text = pengikut[2].t_lahir;
                lblKetPengikut3.Text = pengikut[2].ket;
            }
        }
Пример #2
0
        private void btnSimpan_Click(object sender, EventArgs e)
        {
            Spd             s = new Spd();
            List <Pengikut> p = new List <Pengikut>();
            Biaya           b = new Biaya();

            s.kode           = txtKode.Text;
            s.pegawai_id     = ((KeyValuePair <int, string>)cmbPegawai.SelectedItem).Key;
            s.tb             = cmbTb.SelectedItem.ToString();
            s.maksud         = txtMaksud.Text;
            s.trasport_id    = ((KeyValuePair <int, string>)cmbTrasportasi.SelectedItem).Key;
            s.t_berangkat_id = ((KeyValuePair <int, string>)cmbBerangkat.SelectedItem).Key;
            s.t_tujuan_id    = ((KeyValuePair <int, string>)cmbTujuan.SelectedItem).Key;
            s.penjabat       = txtPenjabat.Text;
            s.t_jabatan      = txtTJabatan.Text;
            s.lama           = Int32.Parse(txtLama.Text);
            s.tgl_berangkat  = dtTglBerangkat.Value.ToString("yyyy-MM-dd");
            s.tgl_kembali    = dtTglKembali.Value.ToString("yyyy-MM-dd");
            s.no_surat       = txtNoSuratTuga.Text;
            s.tgl_tugas      = dtTglSurat.Value.ToString("yyyy-MM-dd");
            s.akun           = txtAkun.Text;

            if (cbPengikut1.Checked)
            {
                Pengikut p1 = new Pengikut();
                if (aksi == "update")
                {
                    p1.id = pengikut.ElementAtOrDefault(0) == null ? -1 : pengikut[0].id;
                }
                p1.pegawai = ((KeyValuePair <int, string>)cmbPengikut1.SelectedItem).Key;
                p1.ket     = txtKetPengikut1.Text;
                p1.t_lahir = tgl_lahir.Text;
                p.Add(p1);
            }

            if (cbPengikut2.Checked)
            {
                Pengikut p2 = new Pengikut();
                if (aksi == "update")
                {
                    p2.id = pengikut.ElementAtOrDefault(1) == null ? -1 : pengikut[1].id;
                }
                p2.pegawai = ((KeyValuePair <int, string>)cmbPengikut2.SelectedItem).Key;
                p2.ket     = txtKetPengikut2.Text;
                p2.t_lahir = tgl_lahir1.Text;
                p.Add(p2);
            }

            if (cbPengikut3.Checked)
            {
                Pengikut p3 = new Pengikut();
                if (aksi == "update")
                {
                    p3.id = pengikut.ElementAtOrDefault(2) == null ? -1 : pengikut[2].id;
                }
                p3.pegawai = ((KeyValuePair <int, string>)cmbPengikut3.SelectedItem).Key;
                p3.ket     = txtKetPengikut3.Text;
                p3.t_lahir = tgl_lahir2.Text;
                p.Add(p3);
            }

            b.harian         = string.IsNullOrEmpty(txtHarian.Text) ? 0 : int.Parse(txtHarian.Text);
            b.h_lama         = string.IsNullOrEmpty(txtHLama.Text) ? 0 : int.Parse(txtHLama.Text);
            b.h_total        = Int32.Parse(txtHLama.Text) * Int32.Parse(txtHarian.Text);
            b.penginapan     = string.IsNullOrEmpty(txtPenginapan.Text) ? 0 : int.Parse(txtPenginapan.Text);
            b.p_lama         = string.IsNullOrEmpty(txtP_lama.Text) ? 0 : int.Parse(txtP_lama.Text);
            b.p_total        = Int32.Parse(txtP_lama.Text) * Int32.Parse(txtPenginapan.Text);
            b.transport_pp   = string.IsNullOrEmpty(txtTransport.Text) ? 0 : int.Parse(txtTransport.Text);
            b.transport_loak = string.IsNullOrEmpty(txtLTransport.Text) ? 0 : int.Parse(txtLTransport.Text);
            b.damri          = string.IsNullOrEmpty(txtLTransport.Text) ? 0 : int.Parse(txtDamri.Text);
            b.lain_lain      = string.IsNullOrEmpty(txtLain_lain.Text) ? 0 : int.Parse(txtLain_lain.Text);
            int result = -1;

            if (aksi == "insert")
            {
                result = DbQuery.InsertSPD(s, p, b);
            }
            else if (aksi == "update")
            {
                foreach (var ss in spd)
                {
                    s.id = ss.id;
                }

                foreach (var bi in biaya)
                {
                    b.id = bi.id;
                }
                result = DbQuery.UpdateSPD(s, p, b);
            }
            string msg = "Terjadi Kesalahan Pada Saat Menyimpan Data";

            if (result > 0)
            {
                msg = "Berhasil! Data Telah Tersimpan";
            }
            MessageBox.Show(msg);
            if (Application.OpenForms["Form1"] != null)
            {
                (Application.OpenForms["Form1"] as Form1).RefSpd();
            }
            this.Close();
        }
Пример #3
0
        private void FrmSPD_Load(object sender, EventArgs e)
        {
            List <Pegawai>           pegawai     = DbQuery.GetPegawai();
            Dictionary <int, string> dCmbPegawai = new Dictionary <int, string>();

            dCmbPegawai.Add(-1, "Pilih Pegawai");
            foreach (var p in pegawai)
            {
                dCmbPegawai.Add(p.id, p.nip + " | " + p.nama);
            }
            cmbPegawai.DataSource    = new BindingSource(dCmbPegawai, null);
            cmbPegawai.DisplayMember = "Value";
            cmbPegawai.ValueMember   = "Key";

            List <Transport>         transport     = DbQuery.GetTransport();
            Dictionary <int, string> dCmbTransport = new Dictionary <int, string>();

            dCmbTransport.Add(-1, "Pilih Transport");
            foreach (var t in transport)
            {
                dCmbTransport.Add(t.id, t.transport);
            }
            cmbTrasportasi.DataSource    = new BindingSource(dCmbTransport, null);
            cmbTrasportasi.DisplayMember = "Value";
            cmbTrasportasi.ValueMember   = "Key";

            Dictionary <int, string> dCmbKotaBerangkat = new Dictionary <int, string>();

            dCmbKotaBerangkat.Add(438, "Kota Palu");
            cmbBerangkat.DataSource    = new BindingSource(dCmbKotaBerangkat, null);
            cmbBerangkat.DisplayMember = "Value";
            cmbBerangkat.ValueMember   = "Key";

            List <Provinsi>             provinsi     = DbQuery.GetProvinsi();
            Dictionary <string, string> dCmbProvinsi = new Dictionary <string, string>();

            dCmbProvinsi.Add("", "Pilih Provinsi");
            foreach (var p in provinsi)
            {
                dCmbProvinsi.Add(p.kode, p.nama);
            }
            cmbProvinsi.DataSource    = new BindingSource(dCmbProvinsi, null);
            cmbProvinsi.DisplayMember = "Value";
            cmbProvinsi.ValueMember   = "Key";

            if (aksi == "update")
            {
                foreach (var s in spd)
                {
                    txtKode.Text                 = s.kode;
                    txtMaksud.Text               = s.maksud;
                    txtPenjabat.Text             = s.penjabat;
                    txtTJabatan.Text             = s.t_jabatan;
                    txtLama.Text                 = s.lama.ToString();
                    txtNoSuratTuga.Text          = s.no_surat;
                    txtAkun.Text                 = s.akun;
                    cmbTb.SelectedIndex          = cmbTb.FindStringExact(s.tb);
                    cmbPegawai.SelectedValue     = s.pegawai_id;
                    cmbTrasportasi.SelectedValue = s.trasport_id;
                    cmbTujuan.SelectedValue      = s.t_tujuan_id;
                    if (s.tgl_berangkat != "")
                    {
                        dtTglBerangkat.Value = DateTime.ParseExact(s.tgl_berangkat, "yyyy-MM-dd", CultureInfo.InvariantCulture);
                    }
                    if (s.tgl_kembali != "")
                    {
                        dtTglKembali.Value = DateTime.ParseExact(s.tgl_kembali, "yyyy-MM-dd", CultureInfo.InvariantCulture);
                    }
                    if (s.tgl_tugas != "")
                    {
                        dtTglSurat.Value = DateTime.ParseExact(s.tgl_tugas, "yyyy-MM-dd", CultureInfo.InvariantCulture);
                    }

                    Dictionary <int, string> dCmbKotaTujuan = new Dictionary <int, string>();
                    dCmbKotaTujuan.Add(s.t_tujuan_id, s.t_tujuan);
                    cmbTujuan.DataSource    = new BindingSource(dCmbKotaTujuan, null);
                    cmbTujuan.DisplayMember = "Value";
                    cmbTujuan.ValueMember   = "Key";
                }

                foreach (var b in biaya)
                {
                    lbTotalHarian.Text      = " = Rp" + b.h_total.ToString("N1", CultureInfo.InvariantCulture);
                    txtHarian.Text          = b.harian.ToString();
                    txtHLama.Text           = b.h_lama.ToString();
                    lblTotalPenginapan.Text = " = Rp" + b.p_total.ToString("N1", CultureInfo.InvariantCulture);
                    txtPenginapan.Text      = b.penginapan.ToString();
                    txtP_lama.Text          = b.p_lama.ToString();
                    txtTransport.Text       = b.transport_pp.ToString();
                    txtLTransport.Text      = b.transport_loak.ToString();
                    txtDamri.Text           = b.damri.ToString();
                    txtLain_lain.Text       = b.lain_lain.ToString();
                }

                if (pengikut.ElementAtOrDefault(0) != null)
                {
                    gpPengikut1.Enabled        = true;
                    cbPengikut1.Checked        = true;
                    cmbPengikut1.SelectedValue = pengikut[0].pegawai;
                    txtKetPengikut1.Text       = pengikut[0].ket;
                }

                if (pengikut.ElementAtOrDefault(1) != null)
                {
                    gpPengikut2.Enabled        = true;
                    cbPengikut2.Checked        = true;
                    cmbPengikut2.SelectedValue = pengikut[1].pegawai;
                    txtKetPengikut2.Text       = pengikut[1].ket;
                }

                if (pengikut.ElementAtOrDefault(2) != null)
                {
                    gpPengikut3.Enabled        = true;
                    cbPengikut3.Checked        = true;
                    cmbPengikut3.SelectedValue = pengikut[2].pegawai;
                    txtKetPengikut3.Text       = pengikut[2].ket;
                }
            }
        }
Пример #4
0
        private void Form1_Load(object sender, EventArgs e)
        {
            lblkomitmen.Text = komitmen;
            lblnips.Text     = nip;

            string sql = "SELECT * FROM v_data WHERE no_surat = '" + tbnomor.Text + "'";

            DbQuery.ExecuteSQL(sql);
            DataTable dt = DbQuery.GetDataTable(sql);

            ReportDataSource reportDSDetail = new ReportDataSource("DataSet1", dt);

            this.reportViewer1.LocalReport.DataSources.Clear();
            this.reportViewer1.LocalReport.DataSources.Add(reportDSDetail);
            this.reportViewer1.LocalReport.Refresh();
            this.reportViewer1.RefreshReport();

            // TODO: This line of code loads data into the 'DataSet1.DataTable2' table. You can move, or remove it, as needed.
            //   this.DataTable2TableAdapter.Fill (this.DataSet1.DataTable2);

            ReportParameterCollection reportParameters = new ReportParameterCollection();

            reportParameters.Add(new ReportParameter("nm1", nm1.Text));
            reportParameters.Add(new ReportParameter("nm2", nm2.Text));
            reportParameters.Add(new ReportParameter("nm3", nm3.Text));
            reportParameters.Add(new ReportParameter("tgl1", tgl1.Text));
            reportParameters.Add(new ReportParameter("tgl2", tgl2.Text));
            reportParameters.Add(new ReportParameter("tgl3", tgl3.Text));
            reportParameters.Add(new ReportParameter("ket1", ket1.Text));
            reportParameters.Add(new ReportParameter("ket2", ket2.Text));
            reportParameters.Add(new ReportParameter("ket3", ket3.Text));
            reportParameters.Add(new ReportParameter("pembuat_komitmen", komitmen));
            reportParameters.Add(new ReportParameter("nip_komitmen", nip));
            this.reportViewer1.LocalReport.SetParameters(reportParameters);

            //this.DataTable2TableAdapter.Fill(this.DataSet1.DataTable2);

            //sembunyikan label parameter
            nm1.Visible = false;
            nm2.Visible = false;
            nm3.Visible = false;

            tgl1.Visible = false;
            tgl2.Visible = false;
            tgl3.Visible = false;

            ket1.Visible = false;
            ket2.Visible = false;
            ket3.Visible = false;

            //hide label dari report spd
            lblkomitmen.Visible = false;
            lblnips.Visible     = false;

            //hide label dari data spd
            lbl_pembuat_komitmen.Visible = false;
            lblnip_komitmen.Visible      = false;

            // label3.Text = LabelText;
            // TODO: This line of code loads data into the 'DataSet1.DataTable1' table. You can move, or remove it, as needed.
            //           this.DataTable1TableAdapter.Fill(this.DataSet1.DataTable1);
            RefSpd();
            //          ReportParameterCollection reportParameters = new ReportParameterCollection();
            //        reportParameters.Add(new ReportParameter("ReportParameter1", fds.lblNPengikut1.Text));
            //      this.reportViewer1.LocalReport.SetParameters(reportParameters);
            //         this.reportViewer1.RefreshReport();
            //       this.reportViewer1.RefreshReport();
            this.reportViewer1.RefreshReport();
        }