Exemplo n.º 1
0
        private void btnSave_Click(object sender, EventArgs e)
        {
            bool result = false;

            if (string.IsNullOrEmpty(txtExpAmount.Text) || string.IsNullOrEmpty(comboBox1.Text))
            {
                FrmMessage.Show("Fields with * Symbols are Mandatory!!!", caption, OkButton, ErrorIcon);
            }
            else
            {
                if (btnSave.Text == "Add")
                {
                    sqlhelp = new SQLHelper();
                    result  = sqlhelp.ExecuteNonQuery("insert into Pcard(CardNumber,CreatedBy,IsActive) values" +
                                                      "('" + txtExpAmount.Text + "'," + GlobalData.UserID + ",'" + comboBox1.Text + "')");
                }
                else
                {
                    sqlhelp = new SQLHelper();
                    result  = sqlhelp.ExecuteNonQuery("UPDATE Pcard SET CardNumber='" + txtExpAmount.Text + "',IsActive='" + comboBox1.Text + "' where " +
                                                      "PSNo=" + PSNo + "");
                }

                if (result == true)
                {
                    FrmMessage.Show("Transaction Success");
                    btnTbSearch_Click(sender, e);
                    Cat_ItemGrid.DataSource = null;
                    Cat_ItemGrid.Columns.Clear();
                }
            }
        }
Exemplo n.º 2
0
        private void btnSearch_Click(object sender, EventArgs e)
        {
            EmpGrid.Visible = true;
            string EmpRole = "";

            if (SrchddlRole.SelectedValue.ToString() == "0")
            {
                EmpRole = "%";
            }
            else
            {
                EmpRole = SrchddlRole.SelectedValue.ToString();
            }
            ds = new DataSet();
            ds = sqlhelp.ExecuteQueries("Select U.UserID,R.RoleID,U.LoginID,R.RoleName,U.Name,U.Address,U.Email," +
                                        "U.Mobile,U.IsActive as [Status] from Users U, Roles R where U.RoleID=R.RoleID and U.Name like '" + txtSrchName.Text + "%'" +
                                        " and U.RoleID like '" + EmpRole + "'");
            if (ds.Tables[0].Rows.Count > 0)
            {
                EmpGrid.DataSource = ds.Tables[0];
                EmpGrid.Columns["UserID"].Visible = false;
                EmpGrid.Columns["RoleID"].Visible = false;
            }
            else
            {
                FrmMessage.Show("No Records Found !!!");
                EmpGrid.DataSource = null;
                EmpGrid.Columns.Clear();
            }
        }
Exemplo n.º 3
0
        private void btnSave_Click(object sender, EventArgs e)
        {
            bool result = false;

            if (string.IsNullOrEmpty(txtRackNo.Text) || string.IsNullOrEmpty(cmbbxStatus.Text) || string.IsNullOrEmpty(txtNoOfSelfs.Text))
            {
                FrmMessage.Show("Fields with * Symbols are Mandatory!!!", caption, OkButton, ErrorIcon);
            }
            else
            {
                if (btnSave.Text == "Add")
                {
                    sqlhelp = new SQLHelper();
                    result  = sqlhelp.ExecuteNonQuery("insert into RACK(RACKNO,NOOFSELFS,CreatedBy,STATUS) values" +
                                                      "('" + txtRackNo.Text + "','" + txtNoOfSelfs.Text + "'," + GlobalData.UserID + ",'" + cmbbxStatus.Text + "')");
                }
                else
                {
                    sqlhelp = new SQLHelper();
                    result  = sqlhelp.ExecuteNonQuery("UPDATE RACK SET RACKNO='" + txtRackNo.Text + "', NOOFSELFS='" + txtNoOfSelfs.Text + "', STATUS='" + cmbbxStatus.Text + "' where " +
                                                      "RNO=" + RNO + "");
                }

                if (result == true)
                {
                    FrmMessage.Show("Transaction Success");
                    btnTbSearch_Click(sender, e);
                    Cat_ItemGrid.DataSource = null;
                    Cat_ItemGrid.Columns.Clear();
                    FillRack();
                }
            }
        }
Exemplo n.º 4
0
        private void btnSave_Click(object sender, EventArgs e)
        {
            bool result = false;

            if (string.IsNullOrEmpty(txtExpDesc.Text) || string.IsNullOrEmpty(txtExpName.Text))
            {
                FrmMessage.Show("Fields with * Symbols are Mandatory!!!", caption, OkButton, ErrorIcon);
            }
            else
            {
                if (btnSave.Text == "Add")
                {
                    sqlhelp = new SQLHelper();
                    result  = sqlhelp.ExecuteNonQuery("insert into ExpenseTypes(ExpenseName,Description,CreatedBy) values" +
                                                      "('" + txtExpName.Text + "','" + txtExpDesc.Text + "'," + GlobalData.UserID + ")");
                }
                else
                {
                    sqlhelp = new SQLHelper();
                    result  = sqlhelp.ExecuteNonQuery("UPDATE ExpenseTypes SET ExpenseName='" + txtExpName.Text + "',Description='" + txtExpDesc.Text + "' where " +
                                                      "ExpTypeID=" + ExpTypeID + "");
                }

                if (result == true)
                {
                    FrmMessage.Show("Transaction Success");
                    btnTbSearch_Click(sender, e);
                }
            }
        }
Exemplo n.º 5
0
        private void btnSave_Click(object sender, EventArgs e)
        {
            bool result = false;

            if (string.IsNullOrEmpty(textBox4.Text) || string.IsNullOrEmpty(textBox5.Text))
            {
                FrmMessage.Show("Fields with * Symbols are Mandatory!!!", caption, OkButton, ErrorIcon);
            }
            else
            {
                {
                    sqlhelp = new SQLHelper();
                    result  = sqlhelp.ExecuteNonQuery("insert into comissionpaid(ANO, PAIDAMOUNT) values" +
                                                      "(" + textBox5.Text + "," + textBox1.Text + ")");
                }


                if (result == true)
                {
                    FrmMessage.Show("Transaction Success");

                    dataGridView1.DataSource = null;
                    dataGridView1.Columns.Clear();
                    textBox1.Text   = "0";
                    textBox2.Text   = "0";
                    textBox6.Text   = "0";
                    txtAddr.Text    = string.Empty;
                    txtEmpName.Text = string.Empty;
                    txtMobile.Text  = string.Empty;
                }
            }
        }
Exemplo n.º 6
0
        private void textBox4_Leave(object sender, EventArgs e)
        {
            sqlhelp = new SQLHelper();
            DataSet ds  = new DataSet();
            DataSet DS1 = new DataSet();
            DataSet DS2 = new DataSet();

            ds = sqlhelp.ExecuteQueries("select * from AGENT where memberno = '" + textBox4.Text + "'");
            if (ds.Tables[0].Rows.Count > 0)
            {
                txtEmpName.Text = ds.Tables[0].Rows[0]["DNAME"].ToString();
                txtMobile.Text  = ds.Tables[0].Rows[0]["MOBILE"].ToString();
                txtAddr.Text    = ds.Tables[0].Rows[0]["ADDRESS"].ToString();
                textBox5.Text   = ds.Tables[0].Rows[0]["ANO"].ToString();
            }

            DS1 = sqlhelper.ExecuteQueries("Select ANO, [Agent Name],Mobile, Address,Email,DOB,[AgentNo],transactionno as [Bill No],[comission %],comissionearned as [Comission],[Comission Date] FROM AGENTCOMISSIONEARNEDQUERY where AGENTNO = '" + textBox4.Text + "'");
            if (DS1.Tables[0].Rows.Count > 0)
            {
                dataGridView1.DataSource             = DS1.Tables[0];
                dataGridView1.Columns["ANO"].Visible = false;
            }

            DS2 = sqlhelper.ExecuteQueries("Select * FROM COMISSIONBALANCE where ANO = " + textBox5.Text + "");
            if (DS2.Tables[0].Rows.Count > 0)
            {
                textBox6.Text = DS2.Tables[0].Rows[0]["BALANCE"].ToString();
            }
            else
            {
                FrmMessage.Show("No AGENT Records Found", caption, OkButton, InformationIcon);
            }
        }
Exemplo n.º 7
0
 private void btnSearch_Click(object sender, EventArgs e)
 {
     try
     {
         DataSetReports dsr = new DataSetReports();
         da = new OleDbDataAdapter("select * from GetServicesDone where cdate(format(ServiceDate,'dd-MMMM-yyyy')) between cdate(format('" + ddlFromDate.Text + "','dd-MMM-yyyy')) and cdate(format('" + ddlToDate.Text + "','dd-MMM-yyyy')) ", sqlhelp.Con);
         da.Fill(dsr.Tables["ServiceRpt"]);
         if (dsr.Tables["ServiceRpt"].Rows.Count > 0)
         {
             reportViewer1.LocalReport.ReportEmbeddedResource = "Inventory.ServiceRpts.rdlc";
             reportViewer1.LocalReport.DataSources.Clear();
             reportViewer1.LocalReport.DataSources.Add(new Microsoft.Reporting.WinForms.ReportDataSource("ServiceRpt", dsr.Tables["ServiceRpt"]));
             reportViewer1.DocumentMapCollapsed = true;
             reportViewer1.RefreshReport();
             reportViewer1.Visible = true;
         }
         else
         {
             reportViewer1.Visible = false;
             FrmMessage.Show("No Records Found");
         }
     }
     catch (Exception ex)
     {
     }
     finally
     {
     }
 }
Exemplo n.º 8
0
 private void btnSearch_Click(object sender, EventArgs e)
 {
     try
     {
         sqlhelp = new SQLHelper();
         ds      = new DataSet();
         string ExpTypeSrchID = "";
         if (SrchddlExpTypes.SelectedIndex == 0)
         {
             ExpTypeSrchID = "%";
         }
         else
         {
             ExpTypeSrchID = SrchddlExpTypes.SelectedValue.ToString();
         }
         ds = sqlhelp.ExecuteQueries("select ExpenseID,ExpTypeID,[ExpenseName],[ExpenseDate],Amount,Description from GetExpense where ExpTypeID like '" + ExpTypeSrchID + "'");
         if (ds.Tables[0].Rows.Count > 0)
         {
             ExpenseGrid.DataSource = ds.Tables[0];
             ExpenseGrid.Columns["ExpenseID"].Visible = false;
             ExpenseGrid.Columns["ExpTypeID"].Visible = false;
         }
         else
         {
             FrmMessage.Show("No records found !!!");
         }
     }
     catch (Exception ex)
     {
     }
     finally
     {
     }
 }
Exemplo n.º 9
0
        private void btnClear_Click(object sender, EventArgs e)
        {
            if (btnClear.Text == "Clear")
            {
                txtImage.Text        = string.Empty;
                txtServiceName.Text  = string.Empty;
                BtnImageupld.Enabled = true;
                if (PriviewPic.Image != null)
                {
                    PriviewPic.Image.Dispose();
                }
                this.PriviewPic.InitialImage = global::Inventory.Properties.Resources.Noimage;
                PriviewPic.Image             = PriviewPic.InitialImage;
                ImageName      = string.Empty;
                txtDesc.Text   = string.Empty;
                txtSrChrg.Text = string.Empty;
                btnTbAdd.Text  = "Add";
                BtnAdd.Text    = "Add";
            }

            else
            {
                if (DialogResult.Yes == FrmMessage.Show("Are you Sure. You want to Delete this Service ?", caption, YesNoButton, QuestionIcon))
                {
                    if (Int32.Parse(sqlhelp.ExecuteScalar("select count(serviceID) from STransDetails where serviceID=" + ServicesGrid.CurrentRow.Cells["ServiceID"].Value + "")) == 0)
                    {
                        sqlhelp.ExecuteNonQuery("delete from Service where ServiceID=" + ServicesGrid.CurrentRow.Cells["ServiceID"].Value + "");
                    }
                    else
                    {
                        FrmMessage.Show("You cannot delete this service as it is referred in ServiceAccounts");
                    }
                }
            }
        }
Exemplo n.º 10
0
        private void btnSave_Click(object sender, EventArgs e)
        {
            bool result = true;

            if (string.IsNullOrEmpty(txtExpAmount.Text))
            {
                FrmMessage.Show("Fields with * Symbols are Mandatory!!!");
            }
            else
            {
                if (btnSave.Text == "Add")
                {
                    sqlhelp = new SQLHelper();
                    result  = sqlhelp.ExecuteNonQuery("insert into Tax (tax) values" +
                                                      "(" + txtExpAmount.Text + ")");
                }
                else
                {
                    sqlhelp = new SQLHelper();
                    result  = sqlhelp.ExecuteNonQuery("UPDATE Tax SET Tax=" + txtExpAmount.Text + " where " +
                                                      "TaxID=" + PSNo + "");
                }

                if (result == true)
                {
                    FrmMessage.Show("Transaction Success");
                    btnTbSearch_Click(sender, e);
                    // btnTbAdd.Visible = false;
                    //Cat_ItemGrid.DataSource = null;
                    //Cat_ItemGrid.Columns.Clear();
                }
            }
        }
Exemplo n.º 11
0
        private void button1_Click(object sender, EventArgs e)
        {
            try
            {
                //else if (GlobalData.ReportName == "MemberCardReport")
                //{
                string ddlcategory;

                dsr = new DataSetReports();
                da  = new OleDbDataAdapter("select * from COMISSIONQUERY", sqlhelp.Con);
                da.Fill(dsr.Tables["AGENTCOMISSIONREPORT"]);
                if (dsr.Tables["AGENTCOMISSIONREPORT"].Rows.Count > 0)
                {
                    reportViewer1.LocalReport.ReportEmbeddedResource = "Inventory.AGENTCOMISSIONREPORT.rdlc";
                    reportViewer1.LocalReport.DataSources.Clear();
                    reportViewer1.LocalReport.DataSources.Add(new Microsoft.Reporting.WinForms.ReportDataSource("DataSet1", dsr.Tables["AGENTCOMISSIONREPORT"]));
                    reportViewer1.DocumentMapCollapsed = true;
                    reportViewer1.RefreshReport();
                }
                else
                {
                    reportViewer1.LocalReport.DataSources.Clear();
                    FrmMessage.Show("No Records Found");
                }
            }
            //}



            //}
            catch (Exception ex)
            {
            }
        }
Exemplo n.º 12
0
        //private void txtRePwd_KeyDown(object sender, KeyEventArgs e)
        //{
        //    if (e.KeyCode == Keys.Enter)
        //    {
        //        if (txtPwd.Text == txtRePwd.Text)
        //        {
        //            btnSave_Click(sender, e);
        //        }
        //        else
        //        {
        //            lblmsg.Visible = true;
        //            txtRePwd.Text = string.Empty;
        //        }

        //    }
        //}

        //private void txtRePwd_TextChanged(object sender, EventArgs e)
        //{
        //    if (txtPwd.Text != txtRePwd.Text)
        //    {
        //        lblmsg.Visible = true;
        //    }
        //    else
        //    {
        //        lblmsg.Visible = false;
        //    }
        //}

        private void btnSearch_Click(object sender, EventArgs e)
        {
            EmpGrid.Visible = true;
            string EmpRole = "";

            //if (SrchddlRole.SelectedValue.ToString() == "0")
            //{
            //    EmpRole = "%";
            //}
            //else
            //{
            //    EmpRole = SrchddlRole.SelectedValue.ToString();
            //}
            ds = new DataSet();
            ds = sqlhelp.ExecuteQueries("Select * from Company where CName like '" + txtSrchName.Text + "%'");
            if (ds.Tables[0].Rows.Count > 0)
            {
                EmpGrid.DataSource             = ds.Tables[0];
                EmpGrid.Columns["CID"].Visible = false;
                //EmpGrid.Columns["RoleID"].Visible = false;
            }
            else
            {
                FrmMessage.Show("No Records Found !!!");
                EmpGrid.DataSource = null;
                EmpGrid.Columns.Clear();
            }
        }
Exemplo n.º 13
0
 private void btngetpwd_Click(object sender, EventArgs e)
 {
     try
     {
         sqlhelp = new SQLHelper();
         dt      = new DataTable();
         dt      = sqlhelp.ExecuteTables("SELECT U.[LoginID],U.[Password] " +
                                         "FROM Users U,Roles R WHERE R.RoleID=U.RoleID AND " +
                                         "U.LoginID = '" + txtFrgLoginID.Text + "'");
         if (dt.Rows.Count > 0)
         {
             txtFrgPwd.Text = dt.Rows[0]["Password"].ToString();
         }
         else
         {
             FrmMessage.Show("Invalid LoginID.Please Re-Enter the LoginID");
         }
     }
     catch (Exception ex)
     {
     }
     finally
     {
     }
 }
Exemplo n.º 14
0
        private void textBox64_KeyPress(object sender, KeyPressEventArgs e)
        {
            try
            {
                if (Convert.ToInt32(e.KeyChar) == 13)
                {
                    sqlhelper = new SQLHelper();
                    DataSet ds      = new DataSet();
                    DataSet dsAmer2 = new DataSet();
                    ds = sqlhelper.ExecuteQueries("select * FROM Dealer where MemberNo = '" + textBox64.Text + "'");
                    if (ds.Tables[0].Rows.Count > 0)
                    {
                        textBox63.Text = ds.Tables[0].Rows[0]["DNAME"].ToString();
                        DEALERID       = Int32.Parse(ds.Tables[0].Rows[0]["DEALERID"].ToString());

                        dsAmer2 = sqlhelper.ExecuteQueries("select * FROM CREDITCHECK where MemberNo = '" + textBox64.Text + "'");

                        textBox62.Text = dsAmer2.Tables[0].Rows[0]["DUE"].ToString();
                    }
                    else
                    {
                        FrmMessage.Show("No Records Found");
                    }
                }
                else
                {
                }
            }
            catch (Exception)
            {
            }
        }
Exemplo n.º 15
0
 private void btnClear_Click(object sender, EventArgs e)
 {
     if (btnClear.Text == "Clear")
     {
         clear();
     }
     else
     {
         bool result;
         int  count;
         sqlhelp = new SQLHelper();
         count   = int.Parse(sqlhelp.ExecuteScalar("select count(*) from Expenses where ExpTypeID= " + ExpTypeID + ""));
         if (count == 0)
         {
             if (DialogResult.OK == FrmMessage.Show("Are you Sure. You want to Delete this ExpenseType ?", caption, OkCancelButton, QuestionIcon))
             {
                 result = sqlhelp.ExecuteNonQuery("delete from ExpenseTypes where ExpTypeID=" + ExpTypeID + "");
                 if (result == true)
                 {
                     FrmMessage.Show("ExpenseType Deleted Successfully", caption, OkButton, InformationIcon);
                     btnClear.Text = "Clear";
                     btnSave.Text  = "Add";
                     btnTbSearch_Click(sender, e);
                 }
             }
         }
         else
         {
             FrmMessage.Show("You Cannnot Delete this Category. First Delete the Items of this Category", caption, OkButton, InformationIcon);
             btnClear.Text = "Clear";
             btnSave.Text  = "Add";
             btnTbSearch_Click(sender, e);
         }
     }
 }
Exemplo n.º 16
0
        private void btnAddRacks_Click_1(object sender, EventArgs e)
        {
            bool result = false;

            if (string.IsNullOrEmpty(textBox1.Text))
            {
                FrmMessage.Show("Fields with * Symbols are Mandatory!!!", caption, OkButton, ErrorIcon);
            }
            else
            {
                if (btnSave.Text == "Add")
                {
                    sqlhelp = new SQLHelper();
                    result  = sqlhelp.ExecuteNonQuery("insert into RACKPOSITION(RNO,ITEMID,SELFPOSITION,CreatedBy) values" +
                                                      "(" + comboBox3.SelectedValue + "," + comboBox5.SelectedValue + ",'" + textBox1.Text + "'," + GlobalData.UserID + ")");
                }
                else
                {
                    sqlhelp = new SQLHelper();
                    result  = sqlhelp.ExecuteNonQuery("UPDATE RACKPOSITION SET ITEMID='" + comboBox5.SelectedValue + "', SELFPOSITION='" + textBox1.Text + "' where " +
                                                      "RPNO=" + RPNO + "");
                }

                if (result == true)
                {
                    FrmMessage.Show("Transaction Success");
                    btnTbSearch_Click(sender, e);
                    Cat_ItemGrid.DataSource = null;
                    Cat_ItemGrid.Columns.Clear();
                }
            }
        }
Exemplo n.º 17
0
 private void btnSearch_Click(object sender, EventArgs e)
 {
     try
     {
         ServicesGrid.DataSource = null;
         ServicesGrid.Columns.Clear();
         ServicesGrid.Visible = true;
         DataTable dt = new DataTable();
         dt = sqlhelp.ExecuteTables("select ServiceID,ServiceName,ServiceCharge,Description,[Image] from Services where ServiceName like'" + txtServiceName.Text.Trim() + "%'");
         if (dt.Rows.Count > 0)
         {
             ServicesGrid.DataSource = dt;
             ServicesGrid.Columns["ServiceID"].Visible = false;
             ServicesGrid.Columns["Image"].Visible     = false;
         }
         else
         {
             FrmMessage.Show("No Records Found !!");
         }
     }
     catch (Exception ex)
     {
     }
     finally
     {
     }
 }
Exemplo n.º 18
0
        private void StockGrid_CellContentClick(object sender, DataGridViewCellEventArgs e)
        {
            if (e.RowIndex != -1)
            {
                stockId = int.Parse(StockGrid.CurrentRow.Cells["POID"].Value.ToString());
                string wherecondition = "CategoryID like " + ddlSrchCategory.SelectedValue + "" +
                                        " and SupplierID like " + ddlsrchSupp.SelectedValue + " and POID Like '" + stockId + "'";

                ds = sqlhelp.ExecuteQueries("Select * from ItemSplit where " + wherecondition + "");
                if (ds.Tables[0].Rows.Count > 0)
                {
                    FrmMessage.Show("This Item Has Already Splited, You Can not split this item Again !!");
                }
                else
                {
                    stockId  = int.Parse(StockGrid.CurrentRow.Cells["POID"].Value.ToString());
                    stockId1 = int.Parse(StockGrid.CurrentRow.Cells["SupplierID"].Value.ToString());
                    stockId2 = int.Parse(StockGrid.CurrentRow.Cells["CategoryID"].Value.ToString());

                    txtSrchBarcode.Text = StockGrid.CurrentRow.Cells["ItemName"].Value.ToString();
                    textBox1.Text       = StockGrid.CurrentRow.Cells["QTY"].Value.ToString();
                    textBox5.Text       = StockGrid.CurrentRow.Cells["QtyType"].Value.ToString();
                }
            }
        }
Exemplo n.º 19
0
        private void btnSave_Click(object sender, EventArgs e)
        {
            bool result = false;

            if (string.IsNullOrEmpty(txtExpAmount.Text) || string.IsNullOrEmpty(textBox1.Text))
            {
                FrmMessage.Show("Fields with * Symbols are Mandatory!!!", caption, OkButton, ErrorIcon);
            }
            else
            {
                if (btnSave.Text == "Add")
                {
                    sqlhelp = new SQLHelper();
                    result  = sqlhelp.ExecuteNonQuery("insert into PCardPointSetting(PerPointAmount, Points,RedeemPoints, RedeemAmount,CreatedBy) values" +
                                                      "('" + txtExpAmount.Text + "','" + textBox1.Text + "'," + textBox2.Text + "," + textBox3.Text + "," + GlobalData.UserID + ")");
                }
                else
                {
                    sqlhelp = new SQLHelper();
                    result  = sqlhelp.ExecuteNonQuery("UPDATE PCardPointSetting SET PerPointAmount='" + txtExpAmount.Text + "',Points='" + textBox1.Text + "',RedeemPoints=" + textBox2.Text + ",RedeemAmount=" + textBox3.Text + " where " +
                                                      "PCSNo=" + PSNo + "");
                }

                if (result == true)
                {
                    FrmMessage.Show("Transaction Success");
                    btnTbSearch_Click(sender, e);
                    Cat_ItemGrid.DataSource = null;
                    Cat_ItemGrid.Columns.Clear();
                }
            }
        }
Exemplo n.º 20
0
        private void btnaddcategory_Click(object sender, EventArgs e)
        {
            if (string.IsNullOrEmpty(txtnewCategory.Text.Trim()))
            {
                FrmMessage.Show("Fields with * Symbols are Mandatory!!!", caption, OkButton, ErrorIcon);
            }
            else
            {
                if (btnaddcategory.Text == "Add")
                {
                    Result = sqlhelp.ExecuteNonQuery("insert into Categories (CategoryName,CategoryDescription,Createdby) " +
                                                     "values('" + txtnewCategory.Text.Trim() + "','" + rtbDescCategory.Text + "'," + GlobalData.UserID + ")");
                    if (Result == true)
                    {
                        FrmMessage.Show("Category Added successfully", caption, OkButton, InformationIcon);
                        fillSearchCategory();
                        ClearCategoryTextBoxes();
                    }
                }

                else
                {
                    Result = sqlhelp.ExecuteNonQuery("Update Categories Set CategoryName = '" + txtnewCategory.Text + "'," +
                                                     "CategoryDescription='" + rtbDescCategory.Text + "',UpdatedBy=" + GlobalData.UserID + "" +
                                                     " where CategoryID= " + CatID + "");

                    if (Result == true)
                    {
                        FrmMessage.Show("Category Updated successfully", caption, OkButton, InformationIcon);
                        fillSearchCategory();
                        btnTbSearch_Click(sender, e);
                    }
                }
            }
        }
Exemplo n.º 21
0
        private void btnClear_Click(object sender, EventArgs e)
        {
            if (btnClear.Text == "Clear")
            {
                ClearTextboxes();
            }
            else if (btnClear.Text == "DeActivate")
            {
                if (DialogResult.Yes == FrmMessage.Show("Are You Sure You want to Deactivate", caption, YesNoButton, QuestionIcon))
                {
                    if (EmpId == 1)
                    {
                        FrmMessage.Show("You can't De-activate the Main Admin User !!!", caption, OkButton, InformationIcon);
                    }
                    else if (EmpId != 1)
                    {
                        if (int.Parse(GlobalData.UserID) == EmpId)
                        {
                            FrmMessage.Show("You can't De-activate the loggedin User !!!", caption, OkButton, InformationIcon);
                        }
                        else
                        {
                            sqlhelp = new SQLHelper();
                            bool result = sqlhelp.ExecuteNonQuery("Update Users set IsActive=False where UserID= " + EmpId + "");
                            if (result == true)
                            {
                                FrmMessage.Show("Deactivated the user Successfully !!", caption, OkButton, InformationIcon);
                            }
                        }
                    }
                }

                SearchGroup.Visible = true;
                AddGroup.Visible    = false;
                btnTbAdd.Text       = "Add";
                EmpGrid.Visible     = false;
                txtSrchName.Text    = string.Empty;
                //SrchddlRole.SelectedIndex = 0;
            }
            else if (btnClear.Text == "Activate")
            {
                sqlhelp = new SQLHelper();
                bool result = sqlhelp.ExecuteNonQuery("Update Users set IsActive=True where UserID= " + EmpId + "");
                if (result == true)
                {
                    FrmMessage.Show("Activated the user Successfully", caption, OkButton, InformationIcon);
                }
                SearchGroup.Visible = true;
                AddGroup.Visible    = false;
                btnTbAdd.Text       = "Add";
                EmpGrid.Visible     = false;
                txtSrchName.Text    = string.Empty;
                //SrchddlRole.SelectedIndex = 0;
            }
        }
Exemplo n.º 22
0
        private void button3_Click(object sender, EventArgs e)
        {
            textBox7.Text = "0";
            try
            {
                searchid          = 0;
                StockGrid.Visible = true;
                ds = new DataSet();
                StockGrid.DataSource = null;
                StockGrid.Columns.Clear();
                sqlhelp = new SQLHelper();
                string srchBarcode = "";



                //string wherecondition = "ItemName Like '" + textBox6.Text + "'";
                string wherecondition = "CategoryID like " + ddlSrchCategory.SelectedValue + "" +
                                        " and SupplierID like " + ddlsrchSupp.SelectedValue + " and ItemName Like '" + textBox6.Text + "'";

                ds = sqlhelp.ExecuteQueries("Select * from SupplierOrder where " + wherecondition + "");
                if (ds.Tables[0].Rows.Count > 0)
                {
                    StockGrid.DataSource = ds.Tables[0];
                    StockGrid.Columns["POID"].Visible         = false;
                    StockGrid.Columns["CategoryID"].Visible   = false;
                    StockGrid.Columns["SupplierID"].Visible   = false;
                    StockGrid.Columns["ReceivedDate"].Visible = false;
                    StockGrid.Columns["TotalAmount"].Visible  = false;
                    DataGridViewButtonColumn btnUpdate = new DataGridViewButtonColumn();
                    btnUpdate.HeaderText = "Split Quantity";
                    btnUpdate.Text       = "Split Quantity";
                    btnUpdate.UseColumnTextForButtonValue = true;
                    btnUpdate.AutoSizeMode = DataGridViewAutoSizeColumnMode.AllCells;
                    btnUpdate.FlatStyle    = FlatStyle.Standard;
                    btnUpdate.CellTemplate.Style.BackColor = Color.Honeydew;
                    StockGrid.Columns.Add(btnUpdate);
                }
                else
                {
                    StockGrid.DataSource = ds.Tables[0];
                    StockGrid.Columns["POID"].Visible       = false;
                    StockGrid.Columns["CategoryID"].Visible = false;
                    StockGrid.Columns["SupplierID"].Visible = false;
                    FrmMessage.Show("No records Found!!!", caption, OkButton, InformationIcon);
                }
            }
            catch (Exception ex)
            {
            }
            finally
            {
            }
        }
Exemplo n.º 23
0
        private void button1_Click(object sender, EventArgs e)
        {
            try
            {
                if (dataGridView1.Rows.Count == 0 || dataGridView2.Rows.Count == 0)
                {
                    FrmMessage.Show("No items were selected for return.");
                }
                else if (string.IsNullOrEmpty(textBox1.Text.Trim()))
                {
                    FrmMessage.Show("Please Enter the reason for return.");
                }
                else
                {
                    if (DialogResult.Yes == FrmMessage.Show("Are You Sure You want to return these items to Supplier.", caption, YesNoButton, QuestionIcon))
                    {
                        bool result = false;
                        for (int i = 0; i < dataGridView2.Rows.Count; i++)
                        {
                            result = sqlhelp.ExecuteNonQuery("insert into RETURNITEMSTOSUPPLIER (POID,SUPPLIERID,CATEGORYID,ITEMNAME,RETURNQTY,ITEMPRICE,TOTALAMOUNT,Reason,CREATEDBY) Values " +
                                                             "(" + dataGridView2.Rows[i].Cells["POID"].Value.ToString() + "," + dataGridView2.Rows[i].Cells["SupplierID"].Value.ToString() + "," + dataGridView2.Rows[i].Cells["CategoryID"].Value.ToString() + "," +
                                                             "'" + dataGridView2.Rows[i].Cells["ItemName"].Value.ToString() + "'," + dataGridView2.Rows[i].Cells["Qty"].Value.ToString() + "," +
                                                             "" + dataGridView2.Rows[i].Cells["UnitPrice"].Value.ToString() + "," + dataGridView2.Rows[i].Cells["AfterVat"].Value.ToString() + ",'" + textBox1.Text.Trim() + "'," + GlobalData.UserID + ")");

                            result = sqlhelp.ExecuteNonQuery("update SupplierOrder set Qty= (Qty-" + dataGridView2.Rows[i].Cells["Qty"].Value + "),TotalAmount = (TotalAmount-" + dataGridView2.Rows[i].Cells["BeforeVat"].Value + ")" +
                                                             " where SUPPLIERID=" + dataGridView2.Rows[i].Cells["SupplierID"].Value.ToString() + " and CATEGORYID=" + dataGridView2.Rows[i].Cells["CategoryID"].Value.ToString() + "" +
                                                             " and POID=" + dataGridView2.Rows[i].Cells["POID"].Value.ToString() + " and ItemName='" + dataGridView2.Rows[i].Cells["ItemName"].Value.ToString() + "'");
                        }
                        if (result == true)
                        {
                            FrmMessage.Show("Returned Items to Supplier Successfully Make Sure you Return the Items from Stock for this Item !!");
                            ReturnToSupplier form = new ReturnToSupplier
                            {
                                MdiParent = this.MdiParent,
                                Anchor    = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
                                                                                   | System.Windows.Forms.AnchorStyles.Left)
                                                                                  | System.Windows.Forms.AnchorStyles.Right))),
                                Dock = DockStyle.Fill
                            };

                            form.Show();
                        }
                    }
                }
            }
            catch (Exception ex)
            {
            }
            finally
            {
            }
        }
Exemplo n.º 24
0
        private void btnSave_Click(object sender, EventArgs e)
        {
            try
            {
                if (ReturnGrid.Rows.Count == 0 || TransGrid.Rows.Count == 0)
                {
                    FrmMessage.Show("No items were selected for return.");
                }
                else if (string.IsNullOrEmpty(txtReason.Text.Trim()))
                {
                    FrmMessage.Show("Please Enter the reason for return.");
                }
                else
                {
                    if (DialogResult.Yes == FrmMessage.Show("Are You Sure You want to return these items.", caption, YesNoButton, QuestionIcon))
                    {
                        bool result = false;
                        for (int i = 0; i < ReturnGrid.Rows.Count; i++)
                        {
                            result = sqlhelp.ExecuteNonQuery("insert into RETURNTOSUPPLIER (StockID,SUPPLIERID,CATEGORYID,ITEMID,Barcode,RETURNQTY,ITEMPRICE,TOTALAMOUNT,Reason,CREATEDBY) Values " +
                                                             "(" + ReturnGrid.Rows[i].Cells["StockID"].Value.ToString() + "," + ReturnGrid.Rows[i].Cells["SupplierID"].Value.ToString() + "," + ReturnGrid.Rows[i].Cells["CategoryID"].Value.ToString() + "," +
                                                             "" + ReturnGrid.Rows[i].Cells["ItemID"].Value.ToString() + ",'" + ReturnGrid.Rows[i].Cells["Barcode"].Value.ToString() + "'," + ReturnGrid.Rows[i].Cells["Quantity"].Value.ToString() + "," +
                                                             "" + ReturnGrid.Rows[i].Cells["Item Price"].Value.ToString() + "," + ReturnGrid.Rows[i].Cells["Total Amount"].Value.ToString() + ",'" + txtReason.Text.Trim() + "'," + GlobalData.UserID + ")");

                            result = sqlhelp.ExecuteNonQuery("update Stock set StockQuantity= (StockQuantity-" + int.Parse(ReturnGrid.Rows[i].Cells["Quantity"].Value.ToString()) + ")" +
                                                             " where SUPPLIERID=" + ReturnGrid.Rows[i].Cells["SupplierID"].Value.ToString() + " and CATEGORYID=" + ReturnGrid.Rows[i].Cells["CategoryID"].Value.ToString() + "" +
                                                             " and ITEMID=" + ReturnGrid.Rows[i].Cells["ItemID"].Value.ToString() + " and StockID=" + ReturnGrid.Rows[i].Cells["StockID"].Value.ToString() + "");
                        }
                        if (result == true)
                        {
                            FrmMessage.Show("Returned Items to Supplier Successfully");
                            ReturnToSupplier form = new ReturnToSupplier
                            {
                                MdiParent = this.MdiParent,
                                Anchor    = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
                                                                                   | System.Windows.Forms.AnchorStyles.Left)
                                                                                  | System.Windows.Forms.AnchorStyles.Right))),
                                Dock = DockStyle.Fill
                            };

                            form.Show();
                        }
                    }
                }
            }
            catch (Exception ex)
            {
            }
            finally
            {
            }
        }
Exemplo n.º 25
0
        private void dataGridView2_CellValueChanged(object sender, DataGridViewCellEventArgs e)
        {
            try
            {
                for (int i = 0; i < dataGridView1.Rows.Count; i++)
                {
                    if (dataGridView2.CurrentRow.Cells["POID"].Value.ToString() == dataGridView1.Rows[i].Cells["POID"].Value.ToString())
                    {
                        if (!string.IsNullOrEmpty(dataGridView2.CurrentRow.Cells["Qty"].Value.ToString()))
                        {
                            if (double.Parse(dataGridView2.CurrentRow.Cells["Qty"].Value.ToString()) > double.Parse(dataGridView1.Rows[i].Cells["Qty"].Value.ToString()) || int.Parse(dataGridView2.CurrentRow.Cells["Qty"].Value.ToString()) == 0)
                            {
                                FrmMessage.Show("Quanity should be between 1 and max quantity " + dataGridView1.Rows[i].Cells["Qty"].Value.ToString());
                                dataGridView2.CurrentRow.Cells["Qty"].Value = dataGridView1.Rows[i].Cells["Qty"].Value.ToString();
                                break;
                            }
                            else
                            {
                                dataGridView2.CurrentRow.Cells["AfterVat"].Value  = "" + Math.Round((decimal.Parse(dataGridView2.CurrentRow.Cells["Qty"].Value.ToString()) * (decimal.Parse(dataGridView2.CurrentRow.Cells["UnitPrice"].Value.ToString()))) + ((decimal.Parse(dataGridView2.CurrentRow.Cells["Qty"].Value.ToString()) * (decimal.Parse(dataGridView2.CurrentRow.Cells["UnitPrice"].Value.ToString()))) * (decimal.Parse(dataGridView2.CurrentRow.Cells["vat%"].Value.ToString()) / 100)), 2).ToString();
                                dataGridView2.CurrentRow.Cells["BeforeVat"].Value = "" + Math.Round((decimal.Parse(dataGridView2.CurrentRow.Cells["Qty"].Value.ToString()) * (decimal.Parse(dataGridView2.CurrentRow.Cells["UnitPrice"].Value.ToString()))), 2).ToString();
                                break;
                            }
                        }
                        else
                        {
                            dataGridView2.CurrentRow.Cells["Qty"].Value = dataGridView1.Rows[i].Cells["Qty"].Value.ToString();
                            break;
                        }
                    }
                }

                decimal TotalRefund = 0;
                TotalActualAmount = 0;

                for (int k = 0; k < (dataGridView2.Rows.Count); k++)
                {
                    //decimal afterdiscountamount = Math.Round(((decimal.Parse(dataGridView1.Rows[k].Cells[3].Value.ToString()) / 100) * (decimal.Parse(dataGridView1.Rows[k].Cells[1].Value.ToString()))), 2);
                    TotalRefund       = Math.Round((TotalRefund + (decimal.Parse(dataGridView2.Rows[k].Cells["AfterVat"].Value.ToString()))), 2);
                    TotalActualAmount = Math.Round((TotalActualAmount + (decimal.Parse(dataGridView2.Rows[k].Cells["Qty"].Value.ToString()) * decimal.Parse(dataGridView2.Rows[k].Cells["UnitPrice"].Value.ToString()))), 2);
                }


                textBox2.Text = TotalRefund.ToString();
            }
            catch (Exception ex)
            {
            }
            finally
            {
            }
        }
Exemplo n.º 26
0
        private void button1_Click_1(object sender, EventArgs e)
        {
            if (string.IsNullOrEmpty(txtSrchBarcode.Text.Trim()) || string.IsNullOrEmpty(textBox2.Text.Trim()) || string.IsNullOrEmpty(textBox2.Text.Trim()))
            {
                FrmMessage.Show("Fields with * Symbols are Mandatory!!!", caption, OkButton, ErrorIcon);
            }
            else
            {
                if (dtStockList.Columns.Count == 0)
                {
                    dtStockList.Columns.Add("Item Name");
                    dtStockList.Columns.Add("Packs");
                    dtStockList.Columns.Add("Weight");
                    dtStockList.Columns.Add("Total Weight");
                }

                bool AlreadyAddedd = false;

                foreach (DataRow dr in dtStockList.Rows)
                {
                    if (dr["Weight"].ToString() == textBox3.Text.Trim())
                    {
                        AlreadyAddedd = true;
                    }
                }
                if (AlreadyAddedd == true)
                {
                    FrmMessage.Show("This Weight is already added to list for the selected Item");
                }
                else
                {
                    dtStockList.Rows.Add(txtSrchBarcode.Text.Trim(), textBox2.Text.Trim(),
                                         textBox3.Text, textBox4.Text.Trim());
                    dtStockList.AcceptChanges();
                    GridStockPurchase.DataSource = dtStockList;
                    decimal pric      = 0;
                    decimal vatAmount = 0;
                    for (int k = 0; k < (GridStockPurchase.Rows.Count); k++)
                    {
                        GridStockPurchase.Columns[k].SortMode = DataGridViewColumnSortMode.NotSortable;
                        //pric = Math.Round((pric + (decimal.Parse(GridStockPurchase.Rows[k].Cells["Total"].Value.ToString()))), 2);
                        //vatAmount = Math.Round((vatAmount + (decimal.Parse(GridStockPurchase.Rows[k].Cells["Total"].Value.ToString())) * (decimal.Parse(GridStockPurchase.Rows[k].Cells["Vat %"].Value.ToString()) / 100)), 2);
                    }
                    //txtVatAmount.Text = vatAmount.ToString();
                    //txtSubTotal.Text = pric.ToString();
                    //clear();
                    textBox2.Text = "0";
                    textBox3.Text = "0";
                }
            }
        }
Exemplo n.º 27
0
 private void ShowStock()
 {
     if (dataGridView4.SelectedRows.Count > 0)
     {
         dataGridView4.SelectedRows[0].Cells["Barcode"].Value.ToString();
         DataSet   dsstk = new DataSet();
         SQLHelper sqlh  = new SQLHelper();
         dsstk = sqlh.ExecuteQueries("select * from GetItemsForCashier where barcode='" + dataGridView4.SelectedRows[0].Cells["Barcode"].Value.ToString() + "'");
         if (dsstk.Tables[0].Rows.Count > 0)
         {
             FrmMessage.Show("Avail Quantity " + Convert.ToDecimal(dsstk.Tables[0].Rows[0]["StockQuantity"].ToString()));
         }
     }
 }
Exemplo n.º 28
0
        private void ReturnGrid_CellValueChanged(object sender, DataGridViewCellEventArgs e)
        {
            try
            {
                for (int i = 0; i < TransGrid.Rows.Count; i++)
                {
                    if (ReturnGrid.CurrentRow.Cells["StockID"].Value.ToString() == TransGrid.Rows[i].Cells["StockID"].Value.ToString())
                    {
                        if (!string.IsNullOrEmpty(ReturnGrid.CurrentRow.Cells["Quantity"].Value.ToString()))
                        {
                            if (double.Parse(ReturnGrid.CurrentRow.Cells["Quantity"].Value.ToString()) > double.Parse(TransGrid.Rows[i].Cells["Quantity"].Value.ToString()) || int.Parse(ReturnGrid.CurrentRow.Cells["Quantity"].Value.ToString()) == 0)
                            {
                                FrmMessage.Show("Quanity should be between 1 and max quantity " + TransGrid.Rows[i].Cells["Quantity"].Value.ToString());
                                ReturnGrid.CurrentRow.Cells["Quantity"].Value = TransGrid.Rows[i].Cells["Quantity"].Value.ToString();
                                break;
                            }
                            else
                            {
                                ReturnGrid.CurrentRow.Cells["Total Amount"].Value = "" + Math.Round((decimal.Parse(ReturnGrid.CurrentRow.Cells["Quantity"].Value.ToString()) * (decimal.Parse(ReturnGrid.CurrentRow.Cells["Item Price"].Value.ToString()))), 2).ToString();
                                break;
                            }
                        }
                        else
                        {
                            ReturnGrid.CurrentRow.Cells["Quantity"].Value = TransGrid.Rows[i].Cells["Available Quantity"].Value.ToString();
                            break;
                        }
                    }
                }

                decimal TotalRefund = 0;
                TotalActualAmount = 0;

                for (int k = 0; k < (ReturnGrid.Rows.Count); k++)
                {
                    //decimal afterdiscountamount = Math.Round(((decimal.Parse(dataGridView1.Rows[k].Cells[3].Value.ToString()) / 100) * (decimal.Parse(dataGridView1.Rows[k].Cells[1].Value.ToString()))), 2);
                    TotalRefund       = Math.Round((TotalRefund + (decimal.Parse(ReturnGrid.Rows[k].Cells["Total Amount"].Value.ToString()))), 2);
                    TotalActualAmount = Math.Round((TotalActualAmount + (decimal.Parse(ReturnGrid.Rows[k].Cells["Quantity"].Value.ToString()) * decimal.Parse(ReturnGrid.Rows[k].Cells["Item Price"].Value.ToString()))), 2);
                }


                txtTotalRefund.Text = TotalRefund.ToString();
            }
            catch (Exception ex)
            {
            }
            finally
            {
            }
        }
Exemplo n.º 29
0
        private void btnSrchItems_Click(object sender, EventArgs e)
        {
            try
            {
                dtTran  = new DataTable();
                dtTran1 = new DataTable();

                dtTran = sqlhelp.ExecuteTables("Select GS.*,(SH.InvoiceAmount/SH.Qty) as [ItemPrice] from GetStock GS, StockHistory SH where GS.StockID=SH.StockID and GS.SupplierID like'" + ddlsrchsupp.SelectedValue + "' and GS.CategoryID like'" + ddlSrchCat.SelectedValue + "' and GS.ItemID like'" + ddlsrchitem.SelectedValue + "'");
                if (dtTran.Rows.Count > 0)
                {
                    dtTran1 = sqlhelp.ExecuteTables("Select * from ItemSplit where SupplierID like'" + ddlsrchsupp.SelectedValue + "' and CategoryID like'" + ddlSrchCat.SelectedValue + "' and ItemName ='" + ddlsrchitem.Text + "'");
                    if (dtTran1.Rows.Count > 0)
                    {
                        FrmMessage.Show("You can not return this Item, Beacuse This Item Has Splited to lesser Qty !!!");
                    }
                    else
                    {
                        TransGrid.DataSource = dtTran;
                        TransGrid.Columns["ItemPrice"].HeaderText     = "Item Price";
                        TransGrid.Columns["StockID"].Visible          = false;
                        TransGrid.Columns["SupplierID"].Visible       = false;
                        TransGrid.Columns["ItemID"].Visible           = false;
                        TransGrid.Columns["CategoryID"].Visible       = false;
                        TransGrid.Columns["ImageName"].Visible        = false;
                        TransGrid.Columns["ReOrder Qty"].Visible      = false;
                        TransGrid.Columns["StockDescription"].Visible = false;
                    }
                }
                else
                {
                    FrmMessage.Show("No Records Found !!!");
                    ReturnToSupplier rtnStock = new ReturnToSupplier
                    {
                        MdiParent = this,
                        Anchor    = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
                                                                           | System.Windows.Forms.AnchorStyles.Left)
                                                                          | System.Windows.Forms.AnchorStyles.Right))),
                        Dock = DockStyle.Fill
                    };

                    rtnStock.Show();
                }
            }
            catch (Exception ex)
            {
            }
            finally
            {
            }
        }
Exemplo n.º 30
0
 private void btnClearSup_Click(object sender, EventArgs e)
 {
     try
     {
         if (btnClearSup.Text == "Clear")
         {
             txtaddress.Text  = string.Empty;
             txtSupName.Text  = string.Empty;
             txtSupPhone.Text = string.Empty;
             txtSupName.Text  = string.Empty;
             textBox2.Text    = string.Empty;
             //cmbSTKcategories.SelectedValue = 1;
             txtSupPhone.Text = string.Empty;
             textBox1.Text    = string.Empty;
             textBox3.Text    = string.Empty;
             txtaddress.Text  = string.Empty;
             textBox5.Text    = string.Empty;
             textBox6.Text    = string.Empty;
             textBox4.Text    = string.Empty;
             textBox7.Text    = string.Empty;
             textBox8.Text    = string.Empty;
             textBox9.Text    = string.Empty;
             textBox10.Text   = string.Empty;
             textBox11.Text   = string.Empty;
             textBox12.Text   = string.Empty;
             textBox13.Text   = string.Empty;
         }
         else
         {
             int count = int.Parse(sqlhelp.ExecuteScalar("select count(*) from Items where SupplierID= " + SupplierID + ""));
             if (count == 0)
             {
                 if (DialogResult.Yes == FrmMessage.Show("Are you Sure. You want to Delete this Supplier ?", caption, YesNoButton, QuestionIcon))
                 {
                     bool result = sqlhelp.ExecuteNonQuery("delete from Supplier where SupplierID=" + SupplierID + "");
                 }
             }
             else
             {
                 FrmMessage.Show("You Cannot Delete this Supplier. First Delete the Items of this Supplier from Stock", caption, OkButton, InformationIcon);
             }
         }
     }
     catch (Exception ex)
     {
     }
     finally
     {
     }
 }