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);
        }
 private void CustomerUpdateGrid()
 {
     FormUtility.LoadDatabaseToGrid(
         "SELECT customer_id as CUSTOMER_ID, customer_name as NAMA_CUSTOMER, segment as SEGMENT, region_name as WILAYAH, market as MARKET from tbl_customers inner join tbl_users on tbl_users.user_id=tbl_customers.sales_id",
         Customer_Grid, null);
 }
 void Display_nego()
 {
     FormUtility.LoadDatabaseToGrid("select tbl_negos.customer_id as CUSTOMER_ID, tbl_customers.customer_name as CUSTOMER, tbl_users.fullname as SALESMAN, design_name as DESIGN_NAME, price_before as HARGA, price_after as HARGA_NEGO, tgl_nego as TGL_NEGO, status_desc as STATUS, reason as NOTE from tbl_negos inner join tbl_customers on tbl_customers.customer_id=tbl_negos.customer_id inner join tbl_users on tbl_users.user_id=tbl_negos.sales_id",
                                    Nego_Grid, null);
 }
Example #4
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;
            }
        }
Example #5
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;
            }
        }
Example #6
0
 private void SalesUpdateGrid()
 {
     FormUtility.LoadDatabaseToGrid(
         querySales,
         Sales_Grid, null);
 }
 private void ProductGridUpdate()
 {
     FormUtility.LoadDatabaseToGrid(
         "SELECT distinct contract as CONTRACT, product_code_desc as PRODUCT_NAME, fam_product_desc as FAMILY_NAME, unit as SATUAN, description as DESIGN_NAME, price_exc as HARGA from tbl_barangs where grade ='A'",
         Product_Grid, null);
 }