Beispiel #1
0
 private void barButtonItem3_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
 {
     try
     {
         cmbcustomer.Text  = "";
         txtaddress.Text   = "";
         txtphone.Text     = "";
         txtnetamount.Text = "0";
         DataTable source = gridControl1.DataSource as DataTable;
         source.Clear();
         gridControl1.DataSource = source;
         Test.Sale.Database.QuatationData quatation = new Sale.Database.QuatationData();
         quatation.FnConn();
         DataTable dt1 = quatation.FillData("M", "");
         String    res = quatation.FnTrans();
         if (dt1.Rows.Count > 0)
         {
             int    number = Convert.ToInt32(dt1.Rows[0]["number"].ToString()) + 1;
             string quonum = number + "";
             txtquatationnno.Text = "QU/" + quonum.PadLeft(5, '0');
         }
         barButtonItem1.Enabled = true;
     }
     catch (Exception)
     {
     }
 }
Beispiel #2
0
        private void Sales_Quotation_Load(object sender, EventArgs e)
        {
            txtnetamount.Text = "0";
            Test.Sale.Database.QuatationData quatation = new Sale.Database.QuatationData();
            quatation.FnConn();
            DataTable dt1 = quatation.FillData("M", "");
            String    res = quatation.FnTrans();

            if (dt1.Rows.Count > 0)
            {
                int    number = Convert.ToInt32(dt1.Rows[0]["number"].ToString()) + 1;
                string quonum = number + "";
                txtquatationnno.Text = "QU/" + quonum.PadLeft(5, '0');
            }
            DataTable dt = new DataTable();

            dt.Columns.Add("slno", Type.GetType("System.Int32"));
            dt.Columns.Add("quotationNo", Type.GetType("System.String"));
            dt.Columns.Add("barcode", Type.GetType("System.String"));
            dt.Columns.Add("itemcode", Type.GetType("System.String"));
            dt.Columns.Add("description", Type.GetType("System.String"));
            dt.Columns.Add("brandName", Type.GetType("System.String"));
            dt.Columns.Add("quantity", Type.GetType("System.Double"));
            dt.Columns.Add("unitPrice", Type.GetType("System.Double"));
            dt.Columns.Add("totalAmount", Type.GetType("System.Double"));
            DataRow dr = dt.NewRow();

            dt.Rows.Add(dr);
            gridControl1.DataSource = dt;
            dtpdate.EditValue       = DateTime.Now;
            Test.Sale.Database.SalesData sales = new Sale.Database.SalesData();
            sales.FnConn();
            DataTable dt2 = sales.FillData("S", "", "spCustomer");

            if (dt2.Rows.Count > 0)
            {
                for (int i = 0; i < dt2.Rows.Count; i++)
                {
                    try
                    {
                        cmbcustomer.Properties.Items.Add(dt2.Rows[i]["name"].ToString());
                    }
                    catch (Exception ex) { }
                }
            }
            sales.FnTrans();
        }
Beispiel #3
0
        private void barButtonItem1_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            gridView1.RefreshData();
            DataTable source = gridControl1.DataSource as DataTable;
            DataTable dt     = new DataTable();

            dt.Clear();
            dt.Columns.Add("quotationno");
            dt.Columns.Add("date");
            dt.Columns.Add("id");
            dt.Columns.Add("name");
            dt.Columns.Add("address");
            dt.Columns.Add("phone");
            dt.Columns.Add("totalamount");
            dt.Rows.Add(new object[] { txtquatationnno.Text, dtpdate.Text, CustomerId, cmbcustomer.Text, txtaddress.Text, txtphone.Text, txtnetamount.Text });
            Test.Sale.Database.QuatationData quatationData = new Sale.Database.QuatationData(source, dt);
            quatationData.FnConn();
            quatationData.fnTransactionData();
            quatationData.FnTrans();
            MessageBox.Show("Quotation creater", "ALERT", MessageBoxButtons.OK, MessageBoxIcon.Information);
            barButtonItem1.Enabled = false;
        }
        private void gridView1_ShownEditor(object sender, EventArgs e)
        {
            Test.Sale.Database.QuatationData quatation = new Sale.Database.QuatationData();
            if (gridView1.FocusedColumn.FieldName.Equals("itemCode"))//Don't work only for this column
            {
                TextEdit currentEditor = (sender as GridView).ActiveEditor as TextEdit;
                if (currentEditor != null)
                {
                    AutoCompleteStringCollection customSource = new AutoCompleteStringCollection();

                    quatation.FnConn();
                    DataTable dt  = quatation.FillData("itemcode", "");
                    string    res = quatation.FnTrans();
                    if (dt.Rows.Count > 0)
                    {
                        for (int i = 0; i < dt.Rows.Count; i++)
                        {
                            customSource.Add(dt.Rows[i][0].ToString());
                        }
                    }

                    //   customSource.Add("Programa 1");
                    // customSource.Add("Paaaaaaa 3");
                    //customSource.Add("Pabbbbbb 2");

                    currentEditor.MaskBox.AutoCompleteMode         = AutoCompleteMode.SuggestAppend;
                    currentEditor.MaskBox.AutoCompleteSource       = AutoCompleteSource.CustomSource;
                    currentEditor.MaskBox.AutoCompleteCustomSource = customSource;
                }
            }
            else if (gridView1.FocusedColumn.FieldName.Equals("description"))//Don't work only for this column
            {
                TextEdit currentEditor = (sender as GridView).ActiveEditor as TextEdit;
                if (currentEditor != null)
                {
                    AutoCompleteStringCollection customSource = new AutoCompleteStringCollection();
                    quatation.FnConn();
                    DataTable dt  = quatation.FillData("name", "");
                    string    res = quatation.FnTrans();
                    if (dt.Rows.Count > 0)
                    {
                        for (int i = 0; i < dt.Rows.Count; i++)
                        {
                            customSource.Add(dt.Rows[i][0].ToString());
                        }
                    }

                    currentEditor.MaskBox.AutoCompleteMode         = AutoCompleteMode.SuggestAppend;
                    currentEditor.MaskBox.AutoCompleteSource       = AutoCompleteSource.CustomSource;
                    currentEditor.MaskBox.AutoCompleteCustomSource = customSource;
                }
            }
            else if (gridView1.FocusedColumn.FieldName.Equals("quantity"))//Don't work only for this column
            {
                TextEdit currentEditor = (sender as GridView).ActiveEditor as TextEdit;
                if (currentEditor != null)
                {
                    AutoCompleteStringCollection customSource = new AutoCompleteStringCollection();
                    //quatation.FnConn();
                    //DataTable dt = quatation.FillData("name", "");
                    //string res = quatation.FnTrans();
                    //if (dt.Rows.Count > 0)
                    //{
                    //    for (int i = 0; i < dt.Rows.Count; i++)
                    //    {
                    //        customSource.Add(dt.Rows[i][0].ToString());
                    //    }
                    //}

                    currentEditor.MaskBox.AutoCompleteMode         = AutoCompleteMode.SuggestAppend;
                    currentEditor.MaskBox.AutoCompleteSource       = AutoCompleteSource.CustomSource;
                    currentEditor.MaskBox.AutoCompleteCustomSource = customSource;
                }
            }
        }