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
        //=====BUTTON OK
        private void b_ok_Click(object sender, EventArgs e)
        {
            API_ReturnOrder returnOrder = new API_ReturnOrder();
            bool            api_response;

            try
            {
                if (count_eror != 0)
                {
                    MessageBox.Show("There Is A Total Quantity That Exceeds Inventory. Please Check Again !");
                }
                else
                {
                    String cmd_update = "UPDATE returnorder SET REMARK= '" + t_remark.Text + "' ,TOTAL_QTY='" + qty2 + "', STATUS='1', EMPLOYEE_ID='" + epy_id2 + "', EMPLOYEE_NAME='" + epy_name2 + "', TOTAL_AMOUNT='" + total_amount + "', NO_SJ='" + no_sj2 + "' WHERE RETURN_ORDER_ID = '" + return_id2 + "'";
                    CRUD   update     = new CRUD();
                    update.ExecuteNonQuery(cmd_update);

                    api_response = returnOrder.returnOrder().Result;

                    if (api_response)
                    {
                        //===POTONG INVENTORY
                        Inv_Line inv        = new Inv_Line();
                        String   type_trans = "5";
                        inv.cek_type_trans(type_trans);
                        inv.cek_type_trans(type_trans);
                        inv.return_order(return_id2);
                        MessageBox.Show("Confirmed");

                        UC_Ret_order.Instance.reset();
                        UC_Ret_order.Instance.new_invoice();
                        UC_Ret_order.Instance.holding();
                        UC_Ret_order.Instance.runRetreive();
                        this.Close();
                    }
                    else
                    {
                        MessageBox.Show("Make Sure You are Connected To Internet");
                    }
                }
            }
            catch
            {
                MessageBox.Show("data failured added");
                this.Close();
            }
        }
Ejemplo n.º 5
0
        //FUNGSI SIMPAN DO HEADER====
        public void simpan_do_header2()
        {
            API_DeliveryOrderConfirm do_confirm = new API_DeliveryOrderConfirm();

            try
            {
                Inv_Line inv        = new Inv_Line();
                String   type_trans = "2";
                inv.cek_type_trans(type_trans);
                inv.get_do_line(id2);
                do_confirm.deliveryOrderConfirm(id2, id_epy2, name_epy2, cust_id_store).Wait();
                UC_DO.Instance.reset();
                this.Close();
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.ToString());
            }
        }
Ejemplo n.º 6
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();
                }
            }
        }
Ejemplo n.º 7
0
        private void b_ok_Click(object sender, EventArgs e)
        {
            CRUD sql = new CRUD();

            //wahyu 13-11-19
            //set_running_number();
            //ckon.con.Close();
            try
            {
                ckon.sqlCon().Open();
                String cmd = "SELECT top 1 a.TRANSACTION_ID FROM [transaction] a LEFT JOIN transaction_line b ON a.TRANSACTION_ID = b.TRANSACTION_ID WHERE b.transaction_ID is null AND STATUS IN ('0','3') and COMP_NAME='" + comp_nam + "' ORDER BY a._id asc";
                ckon.sqlDataRd = sql.ExecuteDataReader(cmd, ckon.sqlCon());

                if (ckon.sqlDataRd.HasRows)
                {
                    while (ckon.sqlDataRd.Read())
                    {
                        head_stts   = 1;
                        new_idTrans = ckon.sqlDataRd["TRANSACTION_ID"].ToString();
                    }
                }

                DateTime mydate = DateTime.Now;

                Inv_Line inv        = new Inv_Line();
                String   type_trans = "4";
                inv.cek_type_trans(type_trans);
                inv.void_trans(id_trans);
                //====================================
                String a = mydate.ToString("yyyy-MM-dd");
                save_trans_header();
                save_trans_line();
                save_trans_header_new();
                //
                this.Close();
                f1.label3.Text = "TRANSACTION";
                f1.p_kanan.Controls.Clear();
                if (!f1.p_kanan.Controls.Contains(uc_coba.Instance))
                {
                    f1.p_kanan.Controls.Add(uc_coba.Instance);
                    f1.setProp();
                    uc_coba.Instance.Dock = DockStyle.Fill;
                    uc_coba.Instance.holding(a);
                    uc_coba.Instance.id_employe2 = employee_id;
                    uc_coba.Instance.voidClick(new_idTrans2);
                    uc_coba.Instance.BringToFront();
                }
                else
                {
                    f1.p_kanan.Controls.Add(uc_coba.Instance);
                    f1.setProp();
                    uc_coba.Instance.Dock = DockStyle.Fill;
                    uc_coba.Instance.holding(a);
                    uc_coba.Instance.id_employe2 = employee_id;
                    uc_coba.Instance.voidClick(new_idTrans2);
                    uc_coba.Instance.BringToFront();
                }
            }
            catch (Exception er)
            {
                MessageBox.Show("No connection to database", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            finally
            {
                if (ckon.sqlDataRd != null)
                {
                    ckon.sqlDataRd.Close();
                }

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

            //String sqlStatus = "UPDATE transaction SET STATUS='3' WHERE STATUS='0' AND COMP_NAME='" + comp_nam + "'";
            //CRUD ubah = new CRUD();
            //ubah.ExecuteNonQuery(sqlStatus);
            //ckon.cmd = new MySqlCommand(sql, ckon.con);
            //ckon.con.Open();
            //ckon.myReader = ckon.cmd.ExecuteReader();
            //if (ckon.myReader.HasRows)
            //{
            //    while (ckon.myReader.Read())
            //    {
            //        head_stts = 1;
            //        new_idTrans = ckon.myReader.GetString("TRANSACTION_ID");
            //    }
            //} else
            //{
            //    new_idTrans = final_running_number;
            //}
            //ckon.con.Close();
            //end
        }
Ejemplo n.º 8
0
        //====================================================================================

        //============================BUTTON CONFIRM======================================
        private void b_confirm_Click(object sender, EventArgs e)
        {
            API_MutasiOrder mutasiOrder = new API_MutasiOrder();
            bool            api_response;

            try
            {
                this.ActiveControl = t_barcode;
                t_barcode.Focus();
                if (l_qty.Text == "0" || combo_InOut.Text == "" || combo_coverage.Text == "" || combo_mutasiTo.Text == "")
                {
                    MessageBox.Show("No Item On List And Please Select All Info");
                }
                else
                {
                    get_data_combo_store();

                    if (combo_InOut.Text == "IN")
                    {
                        String cmd_update = "UPDATE mutasiorder SET MUTASI_FROM_WAREHOUSE='" + combo_store2 + "' ,MUTASI_TO_WAREHOUSE = '" + store_code + "',REQUEST_DELIVERY_DATE = '" + tanggal_req.Text + "' ,TOTAL_QTY='" + l_qty.Text + "', STATUS='1', CUST_ID_STORE='" + cust_id_store + "', EMPLOYEE_ID='" + epy_id + "', EMPLOYEE_NAME='" + epy_name + "',TOTAL_AMOUNT='" + total_amount + "', NO_SJ = '" + no_sj.Text + "' WHERE MUTASI_ORDER_ID = '" + l_transaksi.Text + "'";
                        CRUD   update     = new CRUD();
                        update.ExecuteNonQuery(cmd_update);

                        api_response = mutasiOrder.mutasiOrder().Result;
                        if (api_response)
                        {
                            MessageBox.Show("data successfully added");
                            reset();
                            holding();
                            new_invoice();
                            set_running_number();
                            save_trans_header();
                        }
                        else
                        {
                            MessageBox.Show("Make Sure You are Connected To Internet");
                        }
                    }
                    else
                    {
                        if (count_eror != 0)
                        {
                            MessageBox.Show("There Is A Total Quantity That Exceeds Inventory. Please Check Again !");
                        }
                        else
                        {
                            String cmd_update = "UPDATE mutasiorder SET MUTASI_FROM_WAREHOUSE='" + store_code + "' ,MUTASI_TO_WAREHOUSE = '" + combo_store2 + "',REQUEST_DELIVERY_DATE = '" + tanggal_req.Text + "' ,TOTAL_QTY='" + l_qty.Text + "', STATUS='1', CUST_ID_STORE='" + cust_id_store + "', EMPLOYEE_ID='" + epy_id + "', EMPLOYEE_NAME='" + epy_name + "',TOTAL_AMOUNT='" + total_amount + "', NO_SJ = '" + no_sj.Text + "' WHERE MUTASI_ORDER_ID = '" + l_transaksi.Text + "'";
                            CRUD   update     = new CRUD();
                            update.ExecuteNonQuery(cmd_update);

                            api_response = mutasiOrder.mutasiOrder().Result;
                            if (api_response)
                            {
                                //===POTONG INVENTORY SAAT MUTASI OUT
                                Inv_Line inv        = new Inv_Line();
                                String   type_trans = "3";
                                inv.cek_type_trans(type_trans);
                                inv.mutasi_out(l_transaksi.Text);
                                MessageBox.Show("data successfully added");
                                reset();
                                holding();
                                new_invoice();
                                set_running_number();
                                save_trans_header();
                            }
                            else
                            {
                                MessageBox.Show("Make Sure You are Connected To Internet");
                            }
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.ToString());
            }
        }