protected void btnSearch_Click(object sender, EventArgs e)
    {
        try
        {
            InvoiceSearch searchInvoice = new InvoiceSearch();
            searchInvoice.FromDateRep = dtpFromDate.Date;
            searchInvoice.ToDateRep = dtpToDate.Date;

            if (searchInvoice.ToDateRep < searchInvoice.FromDateRep)
            {
                return;
            }

            Session["SalesItemReportByRep"] = null;
            Session["SalesItemReportByRep"] = searchInvoice.SearchInvoicedItemsRepWise();

            dxgvSalesByItems.DataSource = (DataSet)Session["SalesItemReportByRep"];
            dxgvSalesByItems.DataBind();

            dxgvSalesByItems.ExpandAll();
        }
        catch (Exception ex)
        {
            ex.Data.Add("UILayerException", this.GetType().ToString() + Constant.Error_Seperator + "protected void btnSearch_Click(object sender, EventArgs e)");
            if (Master.LoggedUser != null && Master.LoggedUser.UserName != null && Master.LoggedUser.UserName != string.Empty)
            {
                Response.Redirect("Error.aspx?LogId=" + LankaTilesExceptions.WriteEventLogs(ex, Constant.Database_Connection_Name, Master.LoggedUser.UserName), false);
            }
            else
            {
                Response.Redirect("Error.aspx?LogId=" + LankaTilesExceptions.WriteEventLogs(ex, Constant.Database_Connection_Name, "Annonimous"), false);
            }
        }
    }
Ejemplo n.º 2
0
    private void FillSession()
    {
        try
        {
            InvoiceSearch search = new InvoiceSearch();

            search.FromDateRep = dtpFromDate.Date;
            search.ToDateRep = dtpToDate.Date;

            if ((int)rblReportOption.SelectedItem.Value == 0)
            {
                Session["InvoiceReport"] = new InvoiceDAO().GetAllInvoicesAndDetailsForReporting(search);
            }
            else if ((int)rblReportOption.SelectedItem.Value == 1)
            {
                //load all active only
                Session["InvoiceReport"] = new InvoiceDAO().GetAllActiveInvoicesForReporting(search);
            }
            else if ((int)rblReportOption.SelectedItem.Value == 2)
            {
                //load all cancelled only
                Session["InvoiceReport"] = new InvoiceDAO().GetAllCancelledInvoicesForReporting(search);
            }
            else if ((int)rblReportOption.SelectedItem.Value == 3)
            {
                //load all pending payments only
                Session["InvoiceReport"] = new InvoiceDAO().GetAllPaymentDueInvoicesForReporting(search);
            }

            this.FilterDataByUserRole();
        }
        catch (Exception ex)
        {
            throw ex;
        }
    }
Ejemplo n.º 3
0
        public DataSet GetItemWiseSalesForReportingRepWise(InvoiceSearch invoiceSearch)
        {
            try
            {
                Database db = DatabaseFactory.CreateDatabase(Constant.Database_Connection_Name);
                DbCommand dbCommand = db.GetStoredProcCommand(Constant.SP_Invoice_Report_GetItemSalesByItemsRepWise);

                db.AddInParameter(dbCommand, "@dFromDate", DbType.DateTime, invoiceSearch.FromDateRep);
                db.AddInParameter(dbCommand, "@dToDate", DbType.DateTime, invoiceSearch.ToDateRep);

                return db.ExecuteDataSet(dbCommand);

            }
            catch (System.Exception ex)
            {
                ex.Data.Add("BusinessLayerException", GetType().ToString() + Constant.Error_Seperator + "public DataSet GetItemWiseSalesForReportingRepWise(InvoiceSearch invoiceSearch)");
                return null;
                throw ex;
            }
        }
Ejemplo n.º 4
0
        public DataSet SearchInvoice(InvoiceSearch invoiceSearch)
        {
            DataSet ds = null;
            try
            {
                Database db = DatabaseFactory.CreateDatabase(Constant.Database_Connection_Name);
                DbCommand cmd = db.GetStoredProcCommand(Constant.SP_Invoice_Search);

                db.AddInParameter(cmd, "@sInvoiceNo", DbType.String, invoiceSearch.InvoiceNo);
                db.AddInParameter(cmd, "@sFromDate", DbType.String, invoiceSearch.FromDate);
                db.AddInParameter(cmd, "@sToDate", DbType.String, invoiceSearch.ToDate);
                db.AddInParameter(cmd, "@iBranchId", DbType.Int32, invoiceSearch.BranchId);
                db.AddInParameter(cmd, "@iCustomerID", DbType.Int32, invoiceSearch.CustomerID);
                db.AddInParameter(cmd, "@iDueOption", DbType.Int32, invoiceSearch.DueOption);
                db.AddInParameter(cmd, "@iIsPaid", DbType.Int32, invoiceSearch.IsPaid);

                ds = db.ExecuteDataSet(cmd);
            }
            catch (System.Exception ex)
            {
                ds = null;
                throw ex;
            }
            return ds;
        }
Ejemplo n.º 5
0
        /// <summary>
        /// Get all payment due invoices
        /// </summary>
        /// <returns>Dataset with one table</returns>
        public DataSet GetAllPaymentDueInvoicesForReporting(InvoiceSearch invoiceSearch)
        {
            DataSet ds = null;
            try
            {
                Database db = DatabaseFactory.CreateDatabase(Constant.Database_Connection_Name);
                DbCommand dbCommand = db.GetStoredProcCommand(Constant.SP_Invoice_Report_GetAllPaymentDueInvoicesByDateRange);

                db.AddInParameter(dbCommand, "@dFromDate", DbType.DateTime, invoiceSearch.FromDateRep);
                db.AddInParameter(dbCommand, "@dToDate", DbType.DateTime, invoiceSearch.ToDateRep);

                ds = db.ExecuteDataSet(dbCommand);
            }
            catch (System.Exception ex)
            {
                ds = null;
                throw ex;
            }
            return ds;
        }