private void gridControl1_Click(object sender, EventArgs e)
 {
     if (gridView1.GetRowCellValue(gridView1.FocusedRowHandle, gridView1.Columns[0]) != null)
     {
         if (gridView1.GetRowCellValue(gridView1.FocusedRowHandle, gridView1.Columns[0]).ToString() != "")
         {
             PRODUCT objproduct = new PRODUCT();
             if (gridView1.GetRowCellValue(gridView1.FocusedRowHandle, gridView1.Columns[0]) != null)
             {
                 string test = gridView1.GetRowCellValue(gridView1.FocusedRowHandle, gridView1.Columns[0]).ToString();
                 objproduct = new PRODUCTController().PRODUCT_Get(test.ToString());
                 if (objproduct.Product_Name.Trim() != gridView1.GetRowCellValue(gridView1.FocusedRowHandle, gridView1.Columns[1]).ToString())
                 {
                     gridView1.SetRowCellValue(gridView1.FocusedRowHandle, gridView1.Columns[1], gridView2.GetRowCellDisplayText(GlobalRowSelect, "Product_Name"));
                     gridView1.SetRowCellValue(gridView1.FocusedRowHandle, gridView1.Columns[2], gridView2.GetRowCellDisplayText(GlobalRowSelect, "Stock_ID"));
                     gridView1.SetRowCellValue(gridView1.FocusedRowHandle, gridView1.Columns[3], new UNITController().UNIT_Get(objproduct.Unit).Unit_ID);
                     gridView1.SetRowCellValue(gridView1.FocusedRowHandle, gridView1.Columns[4], "1");
                     gridView1.SetRowCellValue(gridView1.FocusedRowHandle, gridView1.Columns[5], double.Parse(gridView2.GetRowCellDisplayText(GlobalRowSelect, "Org_Price")));
                     gridView1.SetRowCellValue(gridView1.FocusedRowHandle, gridView1.Columns[6], objproduct.VAT_ID);
                     gridView1.SetRowCellValue(gridView1.FocusedRowHandle, gridView1.Columns[8], objproduct.Discount);
                 }
                 gridView1.SetRowCellValue(gridView1.FocusedRowHandle, gridView1.Columns[7], double.Parse(gridView1.GetRowCellValue(gridView1.FocusedRowHandle, gridView1.Columns[4]).ToString()) * double.Parse(gridView1.GetRowCellValue(gridView1.FocusedRowHandle, gridView1.Columns[5]).ToString()));
             }
         }
     }
 }
        private void gridLookUpEdit1_EditValueChanged(object sender, EventArgs e)
        {
            PRODUCT objproduct = new PRODUCT();

            objproduct          = new PRODUCTController().PRODUCT_Get(gridLookUpEdit1View.GetFocusedRowCellDisplayText("Product_ID"));
            calcdongia.Value    = (decimal)objproduct.Org_Price;
            calcthanhtien.Value = (calcdongia.Value) * (calcsoluong.Value);
        }
Exemple #3
0
        private void simpleButton1_Click(object sender, EventArgs e)
        {
            int rs = -1;

            /*FileStream frm;
             * frm = new FileStream(Pathname, FileMode.Open, FileAccess.Read);
             * byte[] picbyte = new byte[frm.Length];
             * frm.Read(picbyte, 0, System.Convert.ToInt32(frm.Length));
             * frm.Close();
             * objproduct.Photo = picbyte;
             */

            MemoryStream ms = new MemoryStream();

            try
            {
                pictureEdit1.Image.Save(ms, System.Drawing.Imaging.ImageFormat.Jpeg);
                byte[] buff = ms.GetBuffer();
                objproduct.Photo = buff;
            }
            catch
            {
                byte[] buff = { 1 };
                objproduct.Photo = buff;
            }
            objproduct.Product_Type_ID  = cboloaihang.SelectedIndex;
            objproduct.Provider_ID      = lookkho.GetColumnValue("Stock_ID").ToString();
            objproduct.Product_Group_ID = lookphanloai.GetColumnValue("ProductGroup_ID").ToString();
            objproduct.Product_ID       = txtMa.Text;
            objproduct.Barcode          = txtbarcode.Text;
            objproduct.Product_Name     = txtten.Text;
            objproduct.Unit             = lookdonvi.GetColumnValue("Unit_ID").ToString();
            objproduct.Origin           = txtxuatxu.Text;
            objproduct.MinStock         = double.Parse(caltoithieu.Text);
            objproduct.Customer_ID      = looknhacungcap.GetColumnValue("Customer_ID").ToString();
            objproduct.Org_Price        = double.Parse(calcgiamua.Text);
            objproduct.Sale_Price       = double.Parse(calcgiasi.Text);
            objproduct.Retail_Price     = double.Parse(calcgiale.Text);
            objproduct.UnitRate         = 1;
            objproduct.Customer_Name    = looknhacungcap.Text;
            objproduct.ExchangeRate     = 1;
            objproduct.Active           = true;
            objproduct.UserID           = objuser.UserID;
            objproduct.Currency_ID      = "VND";
            rs = new PRODUCTController().PRODUCT_Insert_Photo(objproduct);
            if (rs < 1)
            {
                MessageBox.Show("Mặt Hàng đã tồn tại", "Thông báo");
            }
            else
            {
                MessageBox.Show("Mặt Hàng mới đã được lưu", "Thông báo");
            }
        }
Exemple #4
0
 private void gridControl1_DoubleClick(object sender, EventArgs e)
 {
     if (gridView1.FocusedRowHandle >= 0)
     {
         string id = gridView1.GetRowCellValue(gridView1.FocusedRowHandle, gridView1.Columns[1]).ToString();
         //MessageBox.Show(id);
         PRODUCT objproduct = new PRODUCT();
         objproduct = new PRODUCTController().PRODUCT_Get(id);
         frmCapNhatHoangHoa_DichVu frm = new frmCapNhatHoangHoa_DichVu();
         frm.Load_Data(objproduct);
         frm.ShowDialog();
     }
 }
Exemple #5
0
 private void barLargeButtonItem2_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
 {
     if (gridView1.FocusedRowHandle >= 0)
     {
         string id = gridView1.GetRowCellValue(gridView1.FocusedRowHandle, gridView1.Columns[1]).ToString();
         //MessageBox.Show(id);
         PRODUCT objproduct = new PRODUCT();
         objproduct = new PRODUCTController().PRODUCT_Get(id);
         frmCapNhatHoangHoa_DichVu frm = new frmCapNhatHoangHoa_DichVu();
         frm.Load_Data(objproduct);
         frm.ShowDialog();
     }
 }
Exemple #6
0
        private void gridControl1_Click(object sender, EventArgs e)
        {
            PRODUCT objproduct = new PRODUCT();

            if (gridView1.GetRowCellValue(gridView1.FocusedRowHandle, gridView1.Columns[0]) != null)
            {
                string test = gridView1.GetRowCellValue(gridView1.FocusedRowHandle, gridView1.Columns[0]).ToString();
                objproduct = new PRODUCTController().PRODUCT_Get(test.ToString());
                if (objproduct.Product_Name.Trim() != gridView1.GetRowCellValue(gridView1.FocusedRowHandle, gridView1.Columns[1]).ToString())
                {
                    gridView1.SetRowCellValue(gridView1.FocusedRowHandle, gridView1.Columns[1], gridView2.GetRowCellDisplayText(GlobalRowSelect, "Product_Name"));
                    gridView1.SetRowCellValue(gridView1.FocusedRowHandle, gridView1.Columns[2], objproduct.Unit);
                    gridView1.SetRowCellValue(gridView1.FocusedRowHandle, gridView1.Columns[3], "1");
                }
            }
        }
Exemple #7
0
        private void gridControl1_Click(object sender, EventArgs e)
        {
            PRODUCT objproduct = new PRODUCT();

            if (gridView1.GetRowCellValue(gridView1.FocusedRowHandle, gridView1.Columns[0]) != null)
            {
                string test = gridView1.GetRowCellValue(gridView1.FocusedRowHandle, gridView1.Columns[0]).ToString();
                objproduct = new PRODUCTController().PRODUCT_Get(test.ToString());
                if (objproduct.Product_Name.Trim() != gridView1.GetRowCellValue(gridView1.FocusedRowHandle, gridView1.Columns[1]).ToString())
                {
                    gridView1.SetRowCellValue(gridView1.FocusedRowHandle, gridView1.Columns[1], repositoryItemGridLookUpEdit1View.GetRowCellDisplayText(GlobalRowSelect, "Product_Name"));
                    gridView1.SetRowCellValue(gridView1.FocusedRowHandle, gridView1.Columns[2], repositoryItemGridLookUpEdit1View.GetRowCellDisplayText(GlobalRowSelect, "Stock_Name"));
                    gridView1.SetRowCellValue(gridView1.FocusedRowHandle, gridView1.Columns[3], new UNITController().UNIT_Get(objproduct.Unit).Unit_Name);
                    gridView1.SetRowCellValue(gridView1.FocusedRowHandle, gridView1.Columns[4], 1);
                    gridView1.SetRowCellValue(gridView1.FocusedRowHandle, gridView1.Columns[5], (objproduct.Org_Price));
                }
                gridView1.SetRowCellValue(gridView1.FocusedRowHandle, gridView1.Columns[6], double.Parse(gridView1.GetRowCellValue(gridView1.FocusedRowHandle, gridView1.Columns[4]).ToString()) * double.Parse(gridView1.GetRowCellValue(gridView1.FocusedRowHandle, gridView1.Columns[5]).ToString()));
            }
        }
        private void simpleButton3_Click(object sender, EventArgs e)
        {
            PRODUCT objproduct = new PRODUCT();
            int     rs         = -1;

            if (gridView1.RowCount > 0)
            {
                for (int i = 0; i < gridView1.RowCount; i++)
                {
                    objproduct.Product_ID       = gridView1.GetRowCellValue(i, gridView1.Columns[0]).ToString();
                    objproduct.Product_Name     = gridView1.GetRowCellValue(i, gridView1.Columns[1]).ToString();
                    objproduct.Barcode          = gridView1.GetRowCellValue(i, gridView1.Columns[2]).ToString();
                    objproduct.Unit             = gridView1.GetRowCellValue(i, gridView1.Columns[3]).ToString();
                    objproduct.Product_Group_ID = gridView1.GetRowCellValue(i, gridView1.Columns[4]).ToString();
                    objproduct.Org_Price        = double.Parse(gridView1.GetRowCellValue(i, gridView1.Columns[6]).ToString());
                    objproduct.Sale_Price       = double.Parse(gridView1.GetRowCellValue(i, gridView1.Columns[7]).ToString());
                    objproduct.Retail_Price     = double.Parse(gridView1.GetRowCellValue(i, gridView1.Columns[8]).ToString());
                    objproduct.Provider_ID      = lookUpKho.GetColumnValue("Stock_ID").ToString();
                    objproduct.Product_Type_ID  = int.Parse(lookphanloai.GetColumnValue("Product_Type_ID").ToString());
                    objproduct.Active           = true;
                    rs = new PRODUCTController().PRODUCT_Insert(objproduct);
                    if (rs == -1)
                    {
                        MessageBox.Show("Lưu Thất Bại", "Thông Báo");
                        break;
                    }
                }
                if (rs > -1)
                {
                    MessageBox.Show("Lưu Thành công", "Thông Báo");
                }
                else
                {
                    MessageBox.Show("Lưu Thất bại", "Thông Báo");
                }
                frmhanghoa.RefreshData();
            }
            else
            {
                MessageBox.Show("Chưa có dữ liệu nhập", "Thông Báo");
            }
        }
Exemple #9
0
 private void barLargeButtonItem4_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
 {
     if (MessageBox.Show("Bạn Muốn Xóa Mặt Hàng Này?", "Cảnh Báo", MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button1) == DialogResult.Yes)
     {
         if (gridView1.RowCount > 0)
         {
             int    rs = -1;
             string id = gridView1.GetRowCellValue(gridView1.FocusedRowHandle, gridView1.Columns[1]).ToString();
             rs = new PRODUCTController().PRODUCT_Delete(id);
             if (rs < 1)
             {
                 MessageBox.Show("Hàng hóa không được xóa", "Thông báo");
             }
             else
             {
                 MessageBox.Show("Hàng hóa đã được xóa", "Thông báo");
             }
             repositoryItemLookUpEdit1.DataSource = new PRODUCT_GROUPController().PRODUCT_GROUP_GetList();
             gridControl1.DataSource = new PRODUCTController().PRODUCT_GetFull_Stock();
         }
     }
 }
        private void simpleButton2_Click(object sender, EventArgs e)
        {
            PRODUCT objproduct = new PRODUCT();

            if (gridLookUpEdit1.Text != "")
            {
                objproduct = new PRODUCTController().PRODUCT_Get(gridLookUpEdit1View.GetFocusedRowCellDisplayText("Product_ID"));
                gridLookUpEdit1.EditValue = objproduct.Product_ID;
                calcdongia.Value          = (decimal)objproduct.Org_Price;
                calcthanhtien.Value       = (calcdongia.Value) * (calcsoluong.Value);
                txtBarcode.Text           = "";
                if (cbohanhdong.SelectedIndex == 0)
                {
                    DataRow rows = dtable.NewRow();
                    rows["Product_ID"]  = objproduct.Product_ID;
                    rows["ProductName"] = objproduct.Product_Name;
                    rows["Stock_Name"]  = new STOCKController().Stock_GetNameQuantityMin(objproduct.Product_ID).Stock_Name;
                    rows["Unit_Name"]   = new UNITController().UNIT_Get(objproduct.Unit).Unit_Name;
                    rows["Quantity"]    = calcsoluong.Value;
                    rows["UnitPrice"]   = calcdongia.Value;
                    rows["Amount"]      = calcthanhtien.Value;
                    rows["Discount"]    = objproduct.Discount;
                    rows["Vat"]         = objproduct.VAT_ID;
                    dtable.Rows.Add(rows);
                }
                else if (cbohanhdong.SelectedIndex == 1)
                {
                    if (FindIndexGridView(gridLookUpEdit1View.GetFocusedRowCellDisplayText("Product_ID")) > -1)
                    {
                        for (int i = 0; i < gridView1.RowCount - 1; i++)
                        {
                            if (gridView1.GetRowCellValue(i, gridView1.Columns[0]).ToString() == gridLookUpEdit1View.GetFocusedRowCellDisplayText("Product_ID"))
                            {
                                gridView1.SetRowCellValue(i, gridView1.Columns[4], (decimal)calcsoluong.Value);
                                gridView1.SetRowCellValue(i, gridView1.Columns[7], double.Parse(gridView1.GetRowCellValue(i, gridView1.Columns[4]).ToString()) * double.Parse(gridView1.GetRowCellValue(i, gridView1.Columns[5]).ToString()));
                                gridView1.RefreshData();
                            }
                        }
                    }
                    else
                    {
                        DataRow rows = dtable.NewRow();
                        rows["Product_ID"]  = objproduct.Product_ID;
                        rows["ProductName"] = objproduct.Product_Name;
                        rows["Stock_Name"]  = new STOCKController().Stock_GetNameQuantityMin(objproduct.Product_ID).Stock_Name;
                        rows["Unit_Name"]   = new UNITController().UNIT_Get(objproduct.Unit).Unit_Name;
                        rows["Quantity"]    = calcsoluong.Value;
                        rows["UnitPrice"]   = calcdongia.Value;
                        rows["Amount"]      = calcthanhtien.Value;
                        rows["Discount"]    = objproduct.Discount;
                        rows["Vat"]         = objproduct.VAT_ID;
                        dtable.Rows.Add(rows);
                    }
                }
                else if (cbohanhdong.SelectedIndex == 2)
                {
                    int i = FindIndexGridView(gridLookUpEdit1View.GetFocusedRowCellDisplayText("Product_ID"));
                    if (i > -1)
                    {
                        //XtraMessageBox.Show(FindIndexGridView(objproduct.Product_ID).ToString());
                        gridView1.SetRowCellValue(FindIndexGridView(gridLookUpEdit1View.GetFocusedRowCellDisplayText("Product_ID")), gridView1.Columns[4], decimal.Parse(gridView1.GetRowCellValue(FindIndexGridView(gridLookUpEdit1View.GetFocusedRowCellDisplayText("Product_ID")), gridView1.Columns[4]).ToString()) + (decimal)calcsoluong.Value);
                        gridView1.SetRowCellValue(i, gridView1.Columns[7], double.Parse(gridView1.GetRowCellValue(i, gridView1.Columns[4]).ToString()) * double.Parse(gridView1.GetRowCellValue(i, gridView1.Columns[5]).ToString()));
                        gridView1.RefreshData();
                    }
                    else
                    {
                        DataRow rows = dtable.NewRow();
                        rows["Product_ID"]  = objproduct.Product_ID;
                        rows["ProductName"] = objproduct.Product_Name;
                        rows["Stock_Name"]  = new STOCKController().Stock_GetNameQuantityMin(objproduct.Product_ID).Stock_Name;
                        rows["Unit_Name"]   = new UNITController().UNIT_Get(objproduct.Unit).Unit_Name;
                        rows["Quantity"]    = calcsoluong.Value;
                        rows["UnitPrice"]   = calcdongia.Value;
                        rows["Amount"]      = calcthanhtien.Value;
                        rows["Discount"]    = objproduct.Discount;
                        rows["Vat"]         = objproduct.VAT_ID;
                        dtable.Rows.Add(rows);
                    }
                }
                else if (cbohanhdong.SelectedIndex == 3)
                {
                    if (FindIndexGridView(gridLookUpEdit1View.GetFocusedRowCellDisplayText("Product_ID")) > -1)
                    {
                        XtraMessageBox.Show("Hàng hóa bị trùng!", "Thông Báo");
                    }
                    else
                    {
                        DataRow rows = dtable.NewRow();
                        rows["Product_ID"]  = objproduct.Product_ID;
                        rows["ProductName"] = objproduct.Product_Name;
                        rows["Stock_Name"]  = new STOCKController().Stock_GetNameQuantityMin(objproduct.Product_ID).Stock_Name;
                        rows["Unit_Name"]   = new UNITController().UNIT_Get(objproduct.Unit).Unit_Name;
                        rows["Quantity"]    = calcsoluong.Value;
                        rows["UnitPrice"]   = calcdongia.Value;
                        rows["Amount"]      = calcthanhtien.Value;
                        rows["Discount"]    = objproduct.Discount;
                        rows["Vat"]         = objproduct.VAT_ID;
                        dtable.Rows.Add(rows);
                    }
                }
            }
        }