Ejemplo n.º 1
0
        //==================klik data di tabel agar masuk ke transaksi line==============================================
        private void dgv_hold_MouseDoubleClick(object sender, MouseEventArgs e)
        {
            id_inv = dgv_hold.SelectedRows[0].Cells[2].Value.ToString();
            //ambil article id, masukan ke variable
            art_id = dgv_hold.SelectedRows[0].Cells[0].Value.ToString();
            //MessageBox.Show(art_id + "");
            //======mencari data article sesuai article code==
            search_data_article();
            //===========masukan ke transaksi line
            insert();
            //===========potong inventory article===
            //MEMOTONG ARTICLE
            Inv_Line inv          = new Inv_Line();
            int      qty_min_plus = -1;
            String   type_trans   = "1";

            inv.cek_qty_inv(id_inv);
            inv.cek_type_trans(type_trans);
            inv.cek_inv_line(id_trans, qty_min_plus);
            //==panggil method di uc_coba(halaman transaksi)

            DiscountAfterUsePromNew afteruser = new DiscountAfterUsePromNew();

            afteruser.retreive(trans_id, kodetoko3, custid3);

            //uc_coba.Instance.retreive();
            //uc_coba.Instance.itung_total();
            //====tutup dialog===
            this.Close();
        }
Ejemplo n.º 2
0
        private void dgv_2_MouseDoubleClick(object sender, MouseEventArgs e)
        {
            CRUD sql = new CRUD();

            try
            {
                S_ID    = dgv_2.SelectedRows[0].Cells[0].Value.ToString();
                S_price = dgv_2.SelectedRows[0].Cells[4].Value.ToString();
                id_inv  = dgv_2.SelectedRows[0].Cells[5].Value.ToString();

                AddTransLine add = new AddTransLine();
                add.get_data(code_store, customer, S_ID, id_spg);
                add.get_data_trans_line(Convert.ToInt32(S_price), t_id);
                //add.Post_Discount();
                discCalcSP(t_id, S_ID, purchQty, id_spg, "");
                //add.cek_article2();

                //MEMOTONG ARTICLE
                Inv_Line inv          = new Inv_Line();
                int      qty_min_plus = -1;
                String   type_trans   = "1";
                inv.cek_qty_inv(id_inv);
                inv.cek_type_trans(type_trans);
                inv.cek_inv_line(t_id, qty_min_plus);

                back_uc();
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.ToString());
            }
        }
Ejemplo n.º 3
0
        //=================SELECT VALUE BY PRESS ENTER=======================
        private void dgv_2_KeyDown(object sender, KeyEventArgs e)
        {
            if (e.KeyCode == Keys.Return)
            {
                try
                {
                    //S_ID = dgv_2.SelectedRows[0].Cells[0].Value.ToString();

                    //S_price = dgv_2.SelectedRows[0].Cells[4].Value.ToString();
                    //id_inv = dgv_2.SelectedRows[0].Cells[5].Value.ToString();

                    ////============================================================
                    //Post_Discount();
                    ////============================================================
                    //cek_article2();
                    ////MEMOTONG ARTICLE
                    //Inv_Line inv = new Inv_Line();
                    //int qty_min_plus = -1;
                    //String type_trans = "1";
                    //inv.cek_qty_inv(id_inv);
                    //inv.cek_type_trans(type_trans);
                    //inv.cek_inv_line(t_id, qty_min_plus);

                    //back_uc();
                    S_ID    = dgv_2.SelectedRows[0].Cells[0].Value.ToString();
                    S_price = dgv_2.SelectedRows[0].Cells[4].Value.ToString();
                    id_inv  = dgv_2.SelectedRows[0].Cells[5].Value.ToString();

                    AddTransLine add = new AddTransLine();
                    add.get_data(code_store, customer, S_ID, id_spg);
                    add.get_data_trans_line(Convert.ToInt32(S_price), t_id);
                    //add.Post_Discount();
                    discCalcSP(t_id, S_ID, purchQty, id_spg, "");
                    //add.cek_article2();

                    //MEMOTONG ARTICLE
                    Inv_Line inv          = new Inv_Line();
                    int      qty_min_plus = -1;
                    String   type_trans   = "1";
                    inv.cek_qty_inv(id_inv);
                    inv.cek_type_trans(type_trans);
                    inv.cek_inv_line(t_id, qty_min_plus);

                    back_uc();
                }
                catch
                {
                    MessageBox.Show("Select a value in the table");
                }
                //MessageBox.Show("Enter pressed");
            }
        }
Ejemplo n.º 4
0
        public void cek_article(string _articleId, int _qty)
        {
            CRUD    sql       = new CRUD();
            koneksi ckonCheck = new koneksi();
            String  cmd_article;
            String  cmd_invent;
            Boolean hasRows = false;

            try
            {
                ckon.sqlCon().Open();
                ckonCheck.sqlCon().Open();

                cmd_article         = "SELECT * FROM article WHERE article.ARTICLE_ID_ALIAS = '" + _articleId + "'";
                ckonCheck.sqlDataRd = sql.ExecuteDataReader(cmd_article, ckonCheck.sqlCon());

                if (ckonCheck.sqlDataRd.HasRows)
                {
                    while (ckonCheck.sqlDataRd.Read())
                    {
                        artIdLoc = ckonCheck.sqlDataRd["ARTICLE_ID"].ToString();
                        hasRows  = true;
                    }
                }

                if (hasRows)
                {
                    if (ckon.sqlDataRd != null)
                    {
                        ckon.sqlDataRd.Close();
                    }

                    cmd_article          = "SELECT * FROM article WHERE ARTICLE_ID = '" + artIdLoc + "'";
                    ckon.sqlDataRdHeader = sql.ExecuteDataReader(cmd_article, ckon.sqlCon());

                    if (ckon.sqlDataRdHeader.HasRows)
                    {
                        while (ckon.sqlDataRdHeader.Read())
                        {
                            id_inv = ckon.sqlDataRdHeader["_id"].ToString();
                        }

                        cmd_invent     = "SELECT * FROM inventory WHERE ARTICLE_ID = " + id_inv + " AND GOOD_QTY >= 1";
                        ckon.sqlDataRd = sql.ExecuteDataReader(cmd_invent, ckon.sqlCon());

                        if (ckon.sqlDataRd.HasRows)
                        {
                            //MEMOTONG ARTICLE
                            Inv_Line inv          = new Inv_Line();
                            int      qty_min_plus = _qty;
                            String   type_trans   = "10";
                            inv.cek_qty_inv(id_inv);
                            inv.cek_type_trans(type_trans);
                            inv.cek_inv_line(t_delivCustId.Text, qty_min_plus);
                        }
                    }
                    else
                    {
                        MessageBox.Show("Article Not Found");
                    }
                }
                else
                {
                    if (ckon.sqlDataRd != null)
                    {
                        ckon.sqlDataRd.Close();
                    }

                    cmd_article          = "SELECT * FROM article WHERE ARTICLE_ID = '" + artIdLoc + "'";
                    ckon.sqlDataRdHeader = sql.ExecuteDataReader(cmd_article, ckon.sqlCon());

                    if (ckon.sqlDataRdHeader.HasRows)
                    {
                        while (ckon.sqlDataRdHeader.Read())
                        {
                            id_inv = ckon.sqlDataRdHeader["_id"].ToString();
                        }

                        cmd_invent     = "SELECT * FROM inventory WHERE ARTICLE_ID = " + id_inv + " AND GOOD_QTY >= 1";
                        ckon.sqlDataRd = sql.ExecuteDataReader(cmd_invent, ckon.sqlCon());

                        if (ckon.sqlDataRd.HasRows)
                        {
                            //MEMOTONG ARTICLE
                            Inv_Line inv          = new Inv_Line();
                            int      qty_min_plus = _qty;
                            String   type_trans   = "10";
                            inv.cek_qty_inv(id_inv);
                            inv.cek_type_trans(type_trans);
                            inv.cek_inv_line(t_delivCustId.Text, qty_min_plus);
                        }
                    }
                    else
                    {
                        MessageBox.Show("Article Not Found");
                    }
                }
            }
            catch (Exception e)
            {
                MessageBox.Show(e.ToString(), "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            finally
            {
                if (ckon.sqlDataRd != null)
                {
                    ckon.sqlDataRd.Close();
                }

                if (ckon.sqlCon().State == ConnectionState.Open)
                {
                    ckon.sqlCon().Close();
                }
            }
        }