コード例 #1
0
        private void value_filter()
        {
            DataTable dt_contract = DBSql.DoGetData("select distinct contract from tbl_barangs").Tables[0];

            for (int i = 0; i < dt_contract.Rows.Count; i++)
            {
                Contract_Combobox.Items.Add(dt_contract.Rows[i][0].ToString());
            }

            DataTable dt_product = DBSql.DoGetData("select distinct product_code_desc from tbl_barangs").Tables[0];

            for (int i = 0; i < dt_product.Rows.Count; i++)
            {
                Product_ComboBox.Items.Add(dt_product.Rows[i][0].ToString());
            }

            DataTable dt_design = DBSql.DoGetData("select distinct description from tbl_barangs").Tables[0];

            for (int i = 0; i < dt_design.Rows.Count; i++)
            {
                Design_ComboBox.Items.Add(dt_design.Rows[i][0].ToString());
            }

            DataTable dt_family = DBSql.DoGetData("select distinct fam_product_desc from tbl_barangs").Tables[0];

            for (int i = 0; i < dt_family.Rows.Count; i++)
            {
                Family_ComboBox.Items.Add(dt_family.Rows[i][0].ToString());
            }
        }
コード例 #2
0
        private void ProductForm_Load(object sender, EventArgs e)
        {
            keyName = this.Text;
            DataSet ds_image_desain = new DataSet();

            DBSql.DoGetData("select url_design_img from tbl_barangs where description='" + keyName.Split('$')[0] + "' and contract='" + keyName.Split('$')[1] + "' and grade='A'", ds_image_desain);
            if (ds_image_desain.Tables[0].Rows.Count > 0)
            {
                if (!String.IsNullOrEmpty(ds_image_desain.Tables[0].Rows[0][0].ToString()))
                {
                    if (ds_image_desain.Tables[0].Rows[0][0].ToString() != "-")
                    {
                        string url = "http://ultimindserver.mywire.org:3000/img_file/designs/" + ds_image_desain.Tables[0].Rows[0][0].ToString();
                        r_image = new RequestImage();
                        r_image.loadFromUrlAsync(url, delegate(Image img)
                        {
                            if (img != null)
                            {
                                pic_product.Image = img;
                            }
                            else
                            {
                                pic_product.Image = Properties.Resources.img_error;
                            }
                        });
                    }

                    DataSet ds = DBSql.DoGetData("select design_id from tbl_barangs where description='" + keyName.Split('$')[0] + "' and contract='" + keyName.Split('$')[1] + "' and grade='A'");
                    design_id = ds.Tables[0].Rows[0][0].ToString();

                    DataSet ds_colors = DBSql.DoGetData("select color_desc, url_color_img, part_no, design_id from tbl_barangs where description='" + keyName.Split('$')[0] + "' and contract='" + keyName.Split('$')[1] + "' and grade='A'");
                    for (int i = 0; i < ds_colors.Tables[0].Rows.Count; i++)
                    {
                        list_colors.Items.Add(ds_colors.Tables[0].Rows[i][0].ToString());
                        list_colors_img.Add(ds_colors.Tables[0].Rows[i][1].ToString());
                        list_part.Add(ds_colors.Tables[0].Rows[i][2].ToString());
                    }
                }
                else
                {
                    pic_product.Image = Properties.Resources.img_error;
                }
            }
            else
            {
                MessageBox.Show("Data Tidak ditemukan");
                return;
            }
        }
コード例 #3
0
        void LoadData()
        {
            DataTable dt_segment = DBSql.DoGetData("select distinct segment from tbl_customers").Tables[0];

            for (int i = 0; i < dt_segment.Rows.Count; i++)
            {
                Segment_ComboBox.Items.Add(dt_segment.Rows[i][0].ToString());
            }

            DataTable dt_region = DBSql.DoGetData("select distinct region_name from tbl_customers").Tables[0];

            for (int i = 0; i < dt_region.Rows.Count; i++)
            {
                Region_ComboBox.Items.Add(dt_region.Rows[i][0].ToString());
            }
        }
コード例 #4
0
        private void Value_Filter()
        {
            DataTable dt = DBSql.DoGetData("select distinct region_name from tbl_customers").Tables[0];

            for (int i = 0; i < dt.Rows.Count; i++)
            {
                Region_Combobox.Items.Add(dt.Rows[i][0].ToString());
            }

            DataTable dt_sales = DBSql.DoGetData("select fullname from tbl_users where user_roles='3'").Tables[0];

            for (int i = 0; i < dt_sales.Rows.Count; i++)
            {
                Sales_ComboBox.Items.Add(dt_sales.Rows[i][0].ToString());
            }

            DataTable dt_segment = DBSql.DoGetData("select distinct segment from tbl_customers").Tables[0];

            for (int i = 0; i < dt_segment.Rows.Count; i++)
            {
                Segment_ComboBox.Items.Add(dt_segment.Rows[i][0].ToString());
            }
        }
コード例 #5
0
        void Display_data()
        {
            DataSet ds = DBSql.DoGetData("select order_no as ORDER_NO, order_date as TANGGAL, tbl_customers.segment as BIDANG_USAHA, checkouts.market as MARKET, checkouts.region as WILAYAH, checkouts.customer_name as CUSTOMER, tbl_users.fullname as SALESMAN, g_total_price as TOTAL_PEMBAYARAN, currency as KURS, checkout_status as STATUS, notes as NOTE from checkouts inner join tbl_users on tbl_users.user_id=checkouts.sales_id inner join tbl_customers on tbl_customers.customer_id=checkouts.customer_id" +
                                         " where checkouts.order_no='" + this.Text + "'");

            Customer_Label.Text    = ds.Tables[0].Rows[0][5].ToString();
            Segment_Label.Text     = ds.Tables[0].Rows[0][2].ToString();
            Region_Label.Text      = ds.Tables[0].Rows[0][4].ToString();
            Salesman_Label.Text    = ds.Tables[0].Rows[0][6].ToString();
            Notes_rtb.Text         = ds.Tables[0].Rows[0][10].ToString();
            Status_Label.Text      = ds.Tables[0].Rows[0][9].ToString();
            Approve_Button.Enabled = true;
            Decline_Button.Enabled = true;
            if (Status_Label.Text != "Waiting")
            {
                Approve_Button.Enabled = false;
                Decline_Button.Enabled = false;
            }

            FormUtility.LoadDatabaseToGrid(
                "select part_no as PART_NO, product_name as PRODUCT_NAME, family_name as FAMILY_NAME, design_name as DESIGN_NAME, colors_name as COLOR, grade as GRADE, qty as JUMLAH, unit as SATUAN, price_unit as HARGA_SATUAN, total_price as TOTAL_HARGA, total_price_dom as TOTAL_HARGA_DOMESTIK from tbl_orders where order_no='" + this.Text + "'",
                Detail_Grid, null);
        }
コード例 #6
0
        /// <summary>
        /// Event yang dipanggil ketika Berpindah "Scene"
        /// </summary>
        /// <param name="i"></param>
        private void Event_OnNavSelectedPageChanged(int i)
        {
            //Stop All Worker
            Worker.DisposeAllWorker();

            //UnLoad All Grid
            Order_Grid.DataSource = null;
            Order_GridView.PopulateColumns();

            Product_Grid.DataSource = null;
            Product_GridView.PopulateColumns();

            switch (i)
            {
            case 0:     //Dashboard Page
                DataTable dt = null;
                //Load Statistic
                dt = DBSql.DoGetData("select count(*) from tbl_customers").Tables[0];
                Dashboard_PanelInfo1_Num.Text = dt.Rows[0][0].ToString();

                dt = DBSql.DoGetData("select count(*) from checkouts").Tables[0];
                Dashboard_PanelInfo2_Num.Text = dt.Rows[0][0].ToString();

                dt = DBSql.DoGetData("select count(*) from checkouts where checkout_status not like 'Success'").Tables[0];
                Dashboard_PanelInfo3_Num.Text = dt.Rows[0][0].ToString();

                dt = DBSql.DoGetData("select count(*) from checkouts where checkout_status='Success'").Tables[0];
                Dashboard_PanelInfo4_Num.Text = dt.Rows[0][0].ToString();
                break;

            case 1:     //Order Page
                OrderGridUpdate();
                break;

            case 2:     //Product Page
                ProductGridUpdate();
                break;

            case 3:     //Customer Page
                if (App.userInfo.userType != UserType.SuperAdmin)
                {
                    _context.Show_Overlay(this);
                    MessageBox.Show("Akses ditolak, Hanya Super Admin yang Diperbolehkan", "Access Denied", MessageBoxButtons.OK, MessageBoxIcon.Stop);
                    _context.Hide_Overlay();
                    Header_Button_Dashboard.Checked = true;
                    return;
                }
                CustomerUpdateGrid();
                break;

            case 4:     //Sales Page
                if (App.userInfo.userType != UserType.SuperAdmin)
                {
                    _context.Show_Overlay(this);
                    MessageBox.Show("Akses ditolak, Hanya Super Admin yang Diperbolehkan", "Access Denied", MessageBoxButtons.OK, MessageBoxIcon.Stop);
                    _context.Hide_Overlay();
                    Header_Button_Dashboard.Checked = true;
                    return;
                }
                SalesUpdateGrid();
                break;
            }
        }
コード例 #7
0
        /// <summary>
        /// Event yangd dipanggil ketika <see cref="CircleButton"/> terclick di Area <see cref="Product_NavFrame"/>
        /// </summary>
        /// <param name="obj"></param>
        /// <param name="e"></param>
        private void Event_OnProductNavButtonClicked(object obj, EventArgs e)
        {
            var btn = (CircleButton)obj;

            switch (btn.tag)
            {
            case "FilterFilter":
                Form_ProductFilter form_filter = new Form_ProductFilter();
                form_filter.ShowDialog();
                string query_filter = " AND";
                if (form_filter.filterContract != "")
                {
                    query_filter += " contract='" + form_filter.filterContract + "' AND";
                }
                if (form_filter.filterProduct != "")
                {
                    query_filter += " product_code_desc='" + form_filter.filterProduct + "' AND";
                }
                if (form_filter.filterDesign != "")
                {
                    query_filter += " description='" + form_filter.filterDesign + "' AND";
                }
                if (form_filter.filterFamily != "")
                {
                    query_filter += " fam_product_desc='" + form_filter.filterFamily + "' AND";
                }
                query_filter = query_filter.Substring(0, query_filter.Length - 3);
                if (form_filter.status_filter)
                {
                    FormUtility.LoadDatabaseToGrid(queryProduct + query_filter, Product_Grid, null);
                }
                break;

            case "FilterCancel":
                FormUtility.LoadDatabaseToGrid(queryProduct, Product_Grid, null);
                break;

            case "PrevPage":
                break;

            case "NextPage":
                break;

            case "Import":
                Dialog.ShowOpenFileDialog("Import Database", "Excel 97-2003 Workbook|*.xls", delegate(bool ok, string path)
                {
                    if (ok)
                    {
                        XlsData data       = new XlsData(path);
                        DataSet ds         = data.ToDataSet();
                        bool status_import = false;
                        Random rand        = new Random(9999);
                        for (int i = 0; i < ds.Tables[0].Rows.Count; i++)
                        {
                            string query_import = "insert into tbl_barangs (contract, design_id, part_no, description, accounting_group, acc_gr_desc, product_code, product_code_desc, fam_product, fam_product_desc, prime_com, prime_com_desc, second_com, second_com_desc, unit, grade, color_code, color_desc, url_design_img, url_color_img, price_inc, price_exc) values('" + ds.Tables[0].Rows[i][0].ToString() + "','" + "des" + rand.Next(9999).ToString() + "','" + ds.Tables[0].Rows[i][1].ToString() + "','" + ds.Tables[0].Rows[i][2].ToString() + "','" + ds.Tables[0].Rows[i][3].ToString() + "','" + ds.Tables[0].Rows[i][4].ToString() + "','" + ds.Tables[0].Rows[i][5].ToString() + "','" + ds.Tables[0].Rows[i][6].ToString() + "','" + ds.Tables[0].Rows[i][7].ToString() + "','" + ds.Tables[0].Rows[i][8].ToString() + "','" + ds.Tables[0].Rows[i][9].ToString() + "','" + ds.Tables[0].Rows[i][10].ToString() + "','" + ds.Tables[0].Rows[i][11].ToString() + "','" + ds.Tables[0].Rows[i][12].ToString() + "','" + ds.Tables[0].Rows[i][13].ToString() + "','" + ds.Tables[0].Rows[i][1].ToString().Split('-')[ds.Tables[0].Rows[i][1].ToString().Split('-').Length - 1] + "','" + ds.Tables[0].Rows[i][14].ToString() + "','" + ds.Tables[0].Rows[i][15].ToString() + "','" + "-" + "','" + "-" + "','" + ds.Tables[0].Rows[i][16].ToString() + "','" + ds.Tables[0].Rows[i][17].ToString() + "')";
                            DataSet ds_check    = DBSql.DoGetData("select count(*) from tbl_barangs where part_no='" + ds.Tables[0].Rows[i][1].ToString() + "' and contract='" + ds.Tables[0].Rows[i][0].ToString() + "'");
                            if (int.Parse(ds_check.Tables[0].Rows[0][0].ToString()) == 0)
                            {
                                DataSet ds_check_part2 = DBSql.DoGetData("select design_id from tbl_barangs where description='" + ds.Tables[0].Rows[i][2].ToString() + "' and contract='" + ds.Tables[0].Rows[i][0].ToString() + "' limit 1");
                                if (ds_check_part2.Tables[0].Rows.Count > 0)
                                {
                                    query_import = "insert into tbl_barangs (contract, design_id, part_no, description, accounting_group, acc_gr_desc, product_code, product_code_desc, fam_product, fam_product_desc, prime_com, prime_com_desc, second_com, second_com_desc, unit, grade, color_code, color_desc, url_design_img, url_color_img, price_inc, price_exc) values('" + ds.Tables[0].Rows[i][0].ToString() + "','" + ds_check_part2.Tables[0].Rows[0][0].ToString() + "','" + ds.Tables[0].Rows[i][1].ToString() + "','" + ds.Tables[0].Rows[i][2].ToString() + "','" + ds.Tables[0].Rows[i][3].ToString() + "','" + ds.Tables[0].Rows[i][4].ToString() + "','" + ds.Tables[0].Rows[i][5].ToString() + "','" + ds.Tables[0].Rows[i][6].ToString() + "','" + ds.Tables[0].Rows[i][7].ToString() + "','" + ds.Tables[0].Rows[i][8].ToString() + "','" + ds.Tables[0].Rows[i][9].ToString() + "','" + ds.Tables[0].Rows[i][10].ToString() + "','" + ds.Tables[0].Rows[i][11].ToString() + "','" + ds.Tables[0].Rows[i][12].ToString() + "','" + ds.Tables[0].Rows[i][13].ToString() + "','" + ds.Tables[0].Rows[i][1].ToString().Split('-')[ds.Tables[0].Rows[i][1].ToString().Split('-').Length - 1] + "','" + ds.Tables[0].Rows[i][14].ToString() + "','" + ds.Tables[0].Rows[i][15].ToString() + "','" + "-" + "','" + "-" + "','" + ds.Tables[0].Rows[i][16].ToString() + "','" + ds.Tables[0].Rows[i][17].ToString() + "')";
                                    DBSql.DoCommand(query_import);
                                }
                                else
                                {
                                    DBSql.DoCommand(query_import);
                                }
                                status_import = true;
                            }
                        }
                        Toast.ShowToast("Data Barang " + (status_import ? "Berhasil" : "Tidak") + " Diimport", "Import Data Barang", ToastIndicator.Ok);
                    }
                });
                break;

            case "Export":
                Dialog.ShowSaveFileDialog("Export Database", "Excel 97-2003 Workbook|*.xls", delegate(bool ok, string path)
                {
                    if (ok)
                    {
                        DataSet ds   = DBSql.DoGetData("select contract as CONTRACT, part_no as PART_NO, description as DESCRIPTION, accounting_group as ACCOUNTING_GROUP, acc_gr_desc as ACC_GROUP_DESC, product_code as PRODUCT_CODE, product_code_desc as PRODUCT_CODE_DESC, fam_product as FAM_PRODUCT_CODE, fam_product_desc as FAM_PRODUCT_DESC, prime_com as PRIME_COMMODITY, prime_com_desc as PRIME_COM_DESC, second_com as SECOND_COMMODIY, second_com_desc as SECOND_COM_DESC, unit as UNIT_MEAS, grade as GRADE, color_code as COLOR_CODE, color_desc as COLOR_DESC, price_inc as PRICE_INC, price_exc as PRICE_EXC FROM tbl_barangs where grade='A'");
                        XlsData data = new XlsData(ds);
                        data.ToFile(path);
                        Toast.ShowToast("Data Barang Berhasil Diexport", "Export Data Barang", ToastIndicator.Ok);
                    }
                });
                break;
            }
        }
コード例 #8
0
        /// <summary>
        /// Event yang dipanggil ketika <see cref="CircleButton"/> terclick di Area <see cref="Order_NavFrmae"/>
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void Event_OnOrderNavButtonClicked(object sender, EventArgs e)
        {
            var btn = (CircleButton)sender;

            switch (btn.tag)
            {
            case "Approve":
                for (int i = 0; i < Order_GridView.GetSelectedRows().Length; i++)
                {
                    string order_no = Order_GridView.GetRowCellValue(Order_GridView.GetSelectedRows()[i], "ORDER_NO").ToString();
                    DBSql.DoCommand("update checkouts set checkout_status='Success' where checkout_status='Waiting' and order_no='" + order_no + "'");
                }
                FormUtility.LoadDatabaseToGrid(queryOrder, Order_Grid, null);
                Toast.ShowToast(Order_GridView.GetSelectedRows().Length + " Order Approved", "Order", ToastIndicator.Ok);
                break;

            case "Decline":
                for (int i = 0; i < Order_GridView.GetSelectedRows().Length; i++)
                {
                    string order_no = Order_GridView.GetRowCellValue(Order_GridView.GetSelectedRows()[i], "ORDER_NO").ToString();
                    DBSql.DoCommand("update checkouts set checkout_status='Declined' where checkout_status='Waiting' and order_no='" + order_no + "'");
                }
                FormUtility.LoadDatabaseToGrid(queryOrder, Order_Grid, null);
                Toast.ShowToast(Order_GridView.GetSelectedRows().Length + " Order Declined", "Order", ToastIndicator.Ok);
                break;

            case "Cancel":
                for (int i = 0; i < Order_GridView.GetSelectedRows().Length; i++)
                {
                    string order_no = Order_GridView.GetRowCellValue(Order_GridView.GetSelectedRows()[i], "ORDER_NO").ToString();
                    DBSql.DoCommand("update checkouts set checkout_status='Canceled' where checkout_status='Waiting' and order_no='" + order_no + "'");
                }
                FormUtility.LoadDatabaseToGrid(queryOrder, Order_Grid, null);
                Toast.ShowToast(Order_GridView.GetSelectedRows().Length + " Order Canceled", "Order", ToastIndicator.Ok);
                break;

            case "Print":
                break;

            case "Export":
                Dialog.ShowSaveFileDialog("Export Database", "Excel 97-2003 Workbook|*.xls", delegate(bool ok, string path) {
                    if (ok)
                    {
                        DataSet ds = DBSql.DoGetData("select checkouts.order_no as ORDER_NO, checkouts.order_date as TANGGAL, tbl_customers.segment as BIDANG_USAHA, checkouts.customer_name as CUSTOMER, tbl_customers.region_name as WILAYAH, tbl_orders.product_name as PRODUCT_DESC, tbl_orders.family_name as FAMILY_DESC, tbl_orders.part_no as PART_NO, tbl_orders.design_name as DESAIN, tbl_orders.colors_name as WARNA, checkouts.currency as KURS, tbl_orders.price_unit as HARGA_SATUAN, tbl_orders.qty as QTY, tbl_orders.total_price as HARGA_TOTAL, tbl_users.fullname as SALESMAN, checkouts.notes as NOTE, checkouts.checkout_status as STATUS from checkouts inner join tbl_orders on tbl_orders.order_no=checkouts.order_no inner join tbl_customers on tbl_customers.customer_id=checkouts.customer_id inner join tbl_users on tbl_users.user_id=checkouts.sales_id");
                        if (ds != null)
                        {
                            XlsData data = new XlsData(ds);
                            data.ToFile(path);
                        }
                        Toast.ShowToast("Data Berhasil Diexport", "Export Data Order", ToastIndicator.Ok);
                    }
                });
                break;

            case "Filter_Filter":
                //m_orderFilterToggle.state = !m_orderFilterToggle.state;
                Form_FilterOrder order_filter = new Form_FilterOrder();
                order_filter.ShowDialog();
                string query_filter = " where";
                if (order_filter.filterRegion != "")
                {
                    query_filter += " region='" + order_filter.filterRegion + "' AND";
                }
                if (order_filter.filterBidUsaha != "")
                {
                    query_filter += " segment='" + order_filter.filterBidUsaha + "' AND";
                }
                if (order_filter.filterSalesman != "")
                {
                    query_filter += " tbl_users.fullname='" + order_filter.filterSalesman + "' AND";
                }
                query_filter = query_filter.Substring(0, query_filter.Length - 3);
                if (order_filter.status_filter_order)
                {
                    FormUtility.LoadDatabaseToGrid(queryOrder + query_filter, Order_Grid, null);
                }
                break;

            case "Filter_Cancel":
                FormUtility.LoadDatabaseToGrid(queryOrder, Order_Grid, null);
                break;

            case "NextPage":
                break;

            case "PrevPage":
                break;

            case "Negosiasi":
                //This is event
                Form_Nego form_nego = new Form_Nego();
                ShowForm(form_nego);
                break;
            }
        }