Esempio n. 1
0
        public DataSet GetBillReportData(CompanyEL _CompanyEL, BillEL _BillEL)
        {
            SQLHelper objSQLHelper = new SQLHelper();
            DataSet   ds           = new DataSet();



            //DataTable dtBillBody = ds.Tables.Add("GetBillReportBody");
            //DataTable dtBillHeader = ds.Tables.Add("GetBillReportHeader");

            DataTable dtBillBody = objSQLHelper.ExecuteSelectProcedure("GetBillReportBody"
                                                                       , objSQLHelper.SqlParam("@Bill_Id", _BillEL.Bill_Id, SqlDbType.Int)
                                                                       , objSQLHelper.SqlParam("@Company_id", _CompanyEL.Company_id, SqlDbType.Int)
                                                                       );

            DataTable dtBillHeader = objSQLHelper.ExecuteSelectProcedure("GetBillReportHeader"
                                                                         , objSQLHelper.SqlParam("@Bill_Id", _BillEL.Bill_Id, SqlDbType.Int)
                                                                         , objSQLHelper.SqlParam("@Company_id", _CompanyEL.Company_id, SqlDbType.Int)
                                                                         );

            dtBillHeader.TableName = "GetBillReportHeader";
            dtBillBody.TableName   = "GetBillReportBody";

            ds.Tables.Add(dtBillBody);
            ds.Tables.Add(dtBillHeader);

            return(ds);
        }
Esempio n. 2
0
        public BillEL GetBillById(int BillId)
        {
            SQLHelper objSQLHelper = new SQLHelper();
            DataTable dt           = objSQLHelper.ExecuteSelectProcedure("SelectBillById"
                                                                         , objSQLHelper.SqlParam("@Bill_Id", BillId, SqlDbType.Int)
                                                                         );

            BillEL objBillEL = new BillEL();

            if (dt != null && dt.Rows.Count > 0)
            {
                objBillEL.Bill_Date              = Convert.ToDateTime(dt.Rows[0]["Bill_Date"]);
                objBillEL.Bill_Id                = (int)dt.Rows[0]["Bill_Id"];
                objBillEL.Bill_No                = dt.Rows[0]["Bill_No"].ToString();
                objBillEL.Bill_Type_Id           = (int)dt.Rows[0]["Bill_Type_Id"];
                objBillEL.Company_id             = (int)dt.Rows[0]["Company_id"];
                objBillEL.Is_Tax_Inclusive       = Convert.ToInt32(dt.Rows[0]["Is_Tax_Inclusive"]);
                objBillEL.Tax_Percentage         = Convert.ToDecimal(dt.Rows[0]["Tax_Percentage"]);
                objBillEL.Central_Tax_Percentage = Convert.ToDecimal(dt.Rows[0]["Central_Tax_Percentage"]);
                objBillEL.Tax_Name               = dt.Rows[0]["Tax_Name"].ToString();
                objBillEL.Central_Tax_Name       = dt.Rows[0]["Central_Tax_Name"].ToString();
                objBillEL.Cartage                = dt.Rows[0]["Cartage"].GetType() == typeof(DBNull) ? (decimal?)null : Convert.ToDecimal(dt.Rows[0]["Cartage"]);
                objBillEL.Discount               = dt.Rows[0]["Discount"].GetType() == typeof(DBNull) ? (decimal?)null : Convert.ToDecimal(dt.Rows[0]["Discount"]);
            }
            return(objBillEL);
        }
Esempio n. 3
0
        public List <BillEL> GetBillByCompanyId(int companyId)
        {
            BillEL        objBillEL;
            List <BillEL> lstBillEL = new List <BillEL>();

            SQLHelper objSQLHelper = new SQLHelper();
            DataTable dt           = objSQLHelper.ExecuteSelectProcedure("GetBillByCompanyId"
                                                                         , objSQLHelper.SqlParam("@Company_id", companyId, SqlDbType.Int)
                                                                         );

            if (dt != null)
            {
                for (int i = 0; i < dt.Rows.Count; i++)
                {
                    objBillEL                        = new BillEL();
                    objBillEL.Bill_Date              = Convert.ToDateTime(dt.Rows[i]["Bill_Date"]);
                    objBillEL.Bill_Id                = (int)dt.Rows[i]["Bill_Id"];
                    objBillEL.Bill_No                = dt.Rows[i]["Bill_No"].ToString();
                    objBillEL.Bill_Type_Id           = (int)dt.Rows[i]["Bill_Type_Id"];
                    objBillEL.Company_id             = (int)dt.Rows[i]["Company_id"];
                    objBillEL.Is_Tax_Inclusive       = Convert.ToInt32(dt.Rows[i]["Is_Tax_Inclusive"]);
                    objBillEL.Tax_Percentage         = Convert.ToDecimal(dt.Rows[i]["Tax_Percentage"]);
                    objBillEL.Central_Tax_Percentage = Convert.ToDecimal(dt.Rows[i]["Central_Tax_Percentage"]);
                    objBillEL.Tax_Name               = dt.Rows[i]["Tax_Name"].ToString();
                    objBillEL.Central_Tax_Name       = dt.Rows[i]["Central_Tax_Name"].ToString();
                    objBillEL.Cartage                = dt.Rows[i]["Cartage"].GetType() == typeof(DBNull) ? (decimal?)null : Convert.ToDecimal(dt.Rows[i]["Cartage"]);
                    objBillEL.Discount               = dt.Rows[i]["Discount"].GetType() == typeof(DBNull) ? (decimal?)null : Convert.ToDecimal(dt.Rows[i]["Discount"]);

                    lstBillEL.Add(objBillEL);
                }
            }
            return(lstBillEL);
        }
Esempio n. 4
0
 public void Delete(SqlTransaction objSqlTransaction, BillEL objBillEL)
 {
     SQLHelper objSQLHelper = new SQLHelper();
     int       cpmpanyId    = objSQLHelper.ExecuteDeleteProcedure("DeleteBill", objSqlTransaction
                                                                  , objSQLHelper.SqlParam("@Bill_Id", objBillEL.Bill_Id, SqlDbType.Int)
                                                                  );
 }
Esempio n. 5
0
 private void btnClose_Click(object sender, EventArgs e)
 {
     crystalReportViewer1.Dispose();
     lstBillingDelivertDetail = null;
     billEL = null;
     this.Close();
     this.Dispose();
 }
Esempio n. 6
0
 public BillEdit(BillEL objBillEL)
     : this()
 {
     _BillEL         = objBillEL;
     lbItemName.Text = _BillEL.Bill_No;
     FillComboBox();
     SetControlvalue();
 }
Esempio n. 7
0
        private void SetControlvalue()
        {
            BillDL _BillDL   = new BillDL();
            BillEL ObjBillEL = _BillDL.GetBillById(_BillEL.Bill_Id);

            datePkrBilldate.Value     = ObjBillEL.Bill_Date;
            cmbBillType.SelectedValue = ObjBillEL.Bill_Type_Id;
            txtTaxAnount.Text         = ObjBillEL.Tax_Percentage.ToString();
            chkTaxInclusive.Checked   = ObjBillEL.Is_Tax_Inclusive == (int)enumTaxinclusive.Yes ? true : false;
        }
Esempio n. 8
0
        public BillReportViewer(CompanyEL _company, BillEL _BillEL)
            : this()
        {
            companyEL = _company;
            billEL    = _BillEL;

            GetGlobalVariableData();
            BindComboBox();

            CreateReport(" ");
        }
Esempio n. 9
0
        public DataTable Get_Previous_Next_Billdate(BillEL objBillEL)
        {
            SQLHelper objSQLHelper = new SQLHelper();

            DataTable dt = objSQLHelper.ExecuteSelectProcedure("Get_Previous_Next_Billdate"
                                                               , objSQLHelper.SqlParam("@Bill_Id", objBillEL.Bill_Id, SqlDbType.Int)
                                                               , objSQLHelper.SqlParam("@Bill_Date", objBillEL.Bill_Date, SqlDbType.DateTime)
                                                               , objSQLHelper.SqlParam("@Bill_Type_Id", objBillEL.Bill_Type_Id, SqlDbType.Int)
                                                               , objSQLHelper.SqlParam("@Company_id", objBillEL.Company_id, SqlDbType.Int)
                                                               );

            return(dt);
        }
Esempio n. 10
0
        public void Update(SqlTransaction objSqlTransaction, BillEL objBillEL)
        {
            SQLHelper objSQLHelper = new SQLHelper();

            objSQLHelper.ExecuteUpdateProcedure("UpdateBill", objSqlTransaction
                                                , objSQLHelper.SqlParam("@Bill_Date", objBillEL.Bill_Date, SqlDbType.DateTime)
                                                , objSQLHelper.SqlParam("@Bill_Type_Id", objBillEL.Bill_Type_Id, SqlDbType.Int)
                                                , objSQLHelper.SqlParam("@Is_Tax_Inclusive", objBillEL.Is_Tax_Inclusive, SqlDbType.Int)
                                                , objSQLHelper.SqlParam("@Tax_Name", objBillEL.Tax_Name, SqlDbType.NVarChar)
                                                , objSQLHelper.SqlParam("@Central_Tax_Name", objBillEL.Central_Tax_Name, SqlDbType.NVarChar)
                                                , objSQLHelper.SqlParam("@Tax_Percentage", objBillEL.Tax_Percentage, SqlDbType.Decimal)
                                                , objSQLHelper.SqlParam("@Central_Tax_Percentage", objBillEL.Central_Tax_Percentage, SqlDbType.Decimal)
                                                , objSQLHelper.SqlParam("@Cartage", objBillEL.Cartage, SqlDbType.Decimal)
                                                , objSQLHelper.SqlParam("@Discount", objBillEL.Discount, SqlDbType.Decimal)
                                                , objSQLHelper.SqlParam("@Bill_Id", objBillEL.Bill_Id, SqlDbType.Int)
                                                );
        }
Esempio n. 11
0
        public bool Delete(BillEL objBillEL)
        {
            SQLHelper      objSQLHelper      = new SQLHelper();
            SqlTransaction objSqlTransaction = objSQLHelper.BeginTrans();

            try
            {
                Delete(objSqlTransaction, objBillEL);
                objSqlTransaction.Commit();
                return(true);
            }
            catch
            {
                objSqlTransaction.Rollback();
                return(false);
            }
        }
Esempio n. 12
0
        public int Insert(BillEL objBillEL)
        {
            SQLHelper      objSQLHelper      = new SQLHelper();
            SqlTransaction objSqlTransaction = objSQLHelper.BeginTrans();

            try
            {
                int Id = Insert(objSqlTransaction, objBillEL);
                objSqlTransaction.Commit();
                return(Id);
            }
            catch (Exception)
            {
                objSqlTransaction.Rollback();
                throw;
            }
        }
Esempio n. 13
0
        public DateTime GetLastBilldate(BillEL objBillEL)
        {
            SQLHelper objSQLHelper = new SQLHelper();

            DataTable dt = objSQLHelper.ExecuteSelectProcedure("GetLastBilldate"
                                                               , objSQLHelper.SqlParam("@Bill_Date", objBillEL.Bill_Date, SqlDbType.DateTime)
                                                               , objSQLHelper.SqlParam("@Bill_Type_Id", objBillEL.Bill_Type_Id, SqlDbType.Int)
                                                               , objSQLHelper.SqlParam("@Company_id", objBillEL.Company_id, SqlDbType.Int)
                                                               );

            if (dt != null && dt.Rows.Count > 0)
            {
                return(Convert.ToDateTime(dt.Rows[0][0]));
            }
            else
            {
                return(new DateTime(1900, 1, 1));
            }
        }
Esempio n. 14
0
        public int Insert(SqlTransaction _objSqlTransaction, BillEL objBillEL)
        {
            SQLHelper objSQLHelper = new SQLHelper();

            int Id = objSQLHelper.ExecuteInsertProcedure("InsertBill", _objSqlTransaction
                                                         , objSQLHelper.SqlParam("@Bill_Date", objBillEL.Bill_Date, SqlDbType.DateTime)
                                                         , objSQLHelper.SqlParam("@Bill_No", objBillEL.Bill_No, SqlDbType.NVarChar)
                                                         , objSQLHelper.SqlParam("@Bill_Type_Id", objBillEL.Bill_Type_Id, SqlDbType.Int)
                                                         , objSQLHelper.SqlParam("@Company_id", objBillEL.Company_id, SqlDbType.Int)
                                                         , objSQLHelper.SqlParam("@Is_Tax_Inclusive", objBillEL.Is_Tax_Inclusive, SqlDbType.Int)
                                                         , objSQLHelper.SqlParam("@Tax_Name", objBillEL.Tax_Name, SqlDbType.NVarChar)
                                                         , objSQLHelper.SqlParam("@Central_Tax_Name", objBillEL.Central_Tax_Name, SqlDbType.NVarChar)
                                                         , objSQLHelper.SqlParam("@Tax_Percentage", objBillEL.Tax_Percentage, SqlDbType.Decimal)
                                                         , objSQLHelper.SqlParam("@Central_Tax_Percentage", objBillEL.Central_Tax_Percentage, SqlDbType.Decimal)
                                                         , objSQLHelper.SqlParam("@Cartage", objBillEL.Cartage, SqlDbType.Decimal)
                                                         , objSQLHelper.SqlParam("@Discount", objBillEL.Discount, SqlDbType.Decimal)
                                                         );

            return(Id);
        }
Esempio n. 15
0
        private void btnUpdate_Click(object sender, EventArgs e)
        {
            BillEL objBillEL = new BillEL();
            BillDL _BillDL   = new BillDL();

            try
            {
                objBillEL.Bill_Id          = _BillEL.Bill_Id;
                objBillEL.Bill_Date        = datePkrBilldate.Value;
                objBillEL.Bill_Type_Id     = Convert.ToInt32(cmbBillType.SelectedValue);
                objBillEL.Is_Tax_Inclusive = chkTaxInclusive.Checked == true ? (int)enumTaxinclusive.Yes : (int)enumTaxinclusive.No;
                objBillEL.Tax_Percentage   = Convert.ToDecimal(txtTaxAnount.Text);

                if (_BillDL.Update(objBillEL))
                {
                    Common.MessageUpdate();
                }
            }
            catch (Exception)
            {
            }
        }
Esempio n. 16
0
        private void dataGridView1_CellContentClick(object sender, DataGridViewCellEventArgs e)
        {
            try
            {
                if (e.ColumnIndex == 9) // for print
                {
                    BillEL objBillEL = new BillEL();
                    objBillEL.Bill_Id = Convert.ToInt32(dataGridView1.SelectedRows[0].Cells["Bill_Id"].Value);

                    BillReportViewer objBillReportViewer = new BillReportViewer(companyEL, objBillEL);
                    objBillReportViewer.ShowDialog();
                    objBillReportViewer.Dispose();
                }
                if (e.ColumnIndex == 10) //For Delete
                {
                    if (Common.MessageConfim("Are You Want To Delete This "))
                    {
                        SQLHelper      objSQLHelper      = new SQLHelper();
                        SqlTransaction objSqlTransaction = objSQLHelper.BeginTrans();

                        BillDL objBillDL = new BillDL();
                        BillEL objBillEL = new BillEL();
                        objBillEL.Bill_Id = Convert.ToInt32(dataGridView1.SelectedRows[0].Cells["Bill_Id"].Value);

                        BillDetailDL        objBillDetailDL = new BillDetailDL();
                        List <BillDetailEL> lstBillDetail   = objBillDetailDL.GetBillDetailByBillId(objBillEL.Bill_Id);


                        BillItemDL        objBillItemDL = new BillItemDL();
                        List <BillItemEL> lstBillItemEL = objBillItemDL.GetBillItemByBillId(objBillEL.Bill_Id);

                        BillItemNarrationDL        _BillItemNarrationDL = new BillItemNarrationDL();
                        List <BillItemNarrationEL> lstBillItemNarration = new List <BillItemNarrationEL>();


                        try
                        {
                            lstBillItemEL.ForEach(r => lstBillItemNarration.AddRange(_BillItemNarrationDL.GetBillItemNarrationBy_BillItemId(r.Bill_Item_Id)));


                            lstBillItemNarration.ForEach(n => _BillItemNarrationDL.Delete(objSqlTransaction, n));
                            lstBillDetail.ForEach(r => objBillDetailDL.Delete(objSqlTransaction, r));
                            lstBillItemEL.ForEach(r => objBillItemDL.Delete(objSqlTransaction, r));

                            objBillDL.Delete(objSqlTransaction, objBillEL);

                            objSqlTransaction.Commit();
                            Common.MessageDelete();
                            GridBind();
                        }
                        catch (Exception)
                        {
                            objSqlTransaction.Rollback();
                        }
                    }
                }
                if (e.ColumnIndex == 11)//For bill Edit
                {
                    BillDL _BillDL   = new BillDL();
                    BillEL objBillEL = _BillDL.GetBillById(Convert.ToInt32(dataGridView1.SelectedRows[0].Cells["Bill_Id"].Value));

                    CreateBill objCreateBill = new CreateBill(companyEL, objBillEL);
                    objCreateBill.ControlBox  = true;
                    objCreateBill.MinimizeBox = false;

                    objCreateBill.ShowDialog();
                    GridBind();
                }
            }
            catch
            {
            }
        }