Esempio n. 1
0
        void openreceivingentry(object sender, EventArgs e)
        {
            String          intlotcode = cbexistinglot.Text.Trim();
            List <object[]> data       = new List <object[]>();
            MainMenu        frm        = new MainMenu();

            data = frm.get_data_table_string("tbreceiving", "intlotcode", intlotcode);

            if (data.Count > 0)
            {
                String tipe     = data[0][3].ToString();
                String species  = data[0][2].ToString();
                String rcvno    = "R1-" + intlotcode;
                String rcvdate  = data[0][4].ToString();
                String supplier = data[0][5].ToString();
                String opt      = Properties.Settings.Default.username;
                Int32  id       = Int32.Parse(data[0][0].ToString());
                String dono     = data[0][8].ToString();

                var current = sender as Button;
                this.Hide();
                var frmReceiving = new frmReceiving();
                frmReceiving.Closed += (s, args) => this.Close();

                frmReceiving.setInitialValue(tipe, species, intlotcode, rcvno, rcvdate, supplier, opt, id, dono);
                frmReceiving.loaddatarcvdet();
                frmReceiving.loadtotalwrap();
                frmReceiving.set_fishno(intlotcode);
                frmReceiving.ShowDialog();
            }
        }
Esempio n. 2
0
        void receivingentry(object sender, EventArgs e)
        {
            if (species == null || tipe == null)
            {
                MessageBox.Show("Please select option species or type");
                return;
            }


            if (species.Trim().Equals(""))
            {
                MessageBox.Show("Please select option species");
                return;
            }


            String intlotcode = "";
            String rcvno      = "";
            String rcvdate    = "";
            String supplier   = "";
            String opt        = "";
            var    current    = sender as Button;

            this.Hide();
            var frmReceiving = new frmReceiving();

            frmReceiving.Closed += (s, args) => this.Close();

            //rcv date
            DateTime dt = DateTime.Now;

            rcvdate = dt.ToString("yyyy-MM-dd hh:mm:ss");

            // supplier
            supplier = comboBox1.Text.Trim();


            //operator
            opt = Properties.Settings.Default.username;

            //int lot code
            //List<object[]> fdata = new List<object[]>();
            //MainMenu fmain = new MainMenu();
            //fdata = fmain.get_data_table_string("tbcompany", "companyid", "bogi");

            //String typelotcode = "";

            DateTime tgl = DateTime.Now;
            int      julian;
            String   stddate = "";

            julian = tgl.DayOfYear;

            String julianstr = julian.ToString();

            if (julianstr.Length == 1)
            {
                julianstr = "00" + julianstr;
            }
            else if (julianstr.Length == 2)
            {
                julianstr = "0" + julianstr;
            }

            stddate = dt.ToString("yy") + julianstr;


            //stddate = dt.ToString("ddMMyy");
            String[] std = new String[4];
            std = supplier.Split('-');
            String standardcode = std[0] + std[1] + stddate;


            List <object[]> data = new List <object[]>();
            MainMenu        frm  = new MainMenu();

            data = frm.get_data_table_string_2param("tbsetup", "Lotseq", "1", "optionremark", this.tipe);
            String kode1 = "";

            if (data.Count > 0)
            {
                kode1 = data[0][3].ToString();
            }


            data = frm.get_data_table_string_2param("tbsetup", "Lotseq", "2", "optionremark", this.certificate);
            String kode2 = "";

            if (data.Count > 0)
            {
                kode2 = data[0][3].ToString();
            }


            data = frm.get_data_table_string_2param("tbsetup", "Lotseq", "3", "optionremark", this.company);
            String kode3 = "";

            if (data.Count > 0)
            {
                kode3 = data[0][3].ToString();
            }

            //String rcvsequence = frm.get_data_sequence_receiving("tbreceiving", "intlotcode", standardcode);
            intlotcode = standardcode;


            if (!kode1.Equals(""))
            {
                intlotcode = intlotcode + "." + kode1;
            }

            if (!kode2.Equals(""))
            {
                intlotcode = intlotcode + "." + kode2;
            }

            if (!kode3.Equals(""))
            {
                intlotcode = intlotcode + "." + kode3;
            }

            //Certificate
            Properties.Settings.Default.certificate = kode2;

            //Sequence receiving
            Boolean         sequence = false;
            List <object[]> data1    = new List <object[]>();

            data1 = frm.get_data_table_string("tbsetup", "category", "receivingsequencenumber");
            if (data1.Count > 0)
            {
                String sequencesetting = data1[0][3].ToString();
                if (sequencesetting.Equals("Y") || sequencesetting.Equals("y"))
                {
                    sequence = true;
                }
            }

            String rcvsequence = "";

            if (sequence)
            {
                rcvsequence = frm.get_data_sequence_receiving("tbreceiving", "intlotcode", intlotcode);
            }



            //If there is receiving sequence
            if (sequence)
            {
                intlotcode = intlotcode + "-" + rcvsequence;
            }


            String dono = txtdono.Text.Trim();

            //rcv no
            rcvno = "R1-" + intlotcode;

            //check data receiving based on intlotcode

            save_receiving(tipe, species, intlotcode, supplier, opt);

            data = frm.get_data_table_string("tbreceiving", "intlotcode", intlotcode);
            Int32 id;

            if (data.Count > 0)
            {
                id = Int32.Parse(data[0][0].ToString());
                frmReceiving.setInitialValue(tipe, species, intlotcode, rcvno, rcvdate, supplier, opt, id, dono);
                frmReceiving.loaddatarcvdet();
                frmReceiving.ShowDialog();
            }
        }