Exemplo n.º 1
0
 protected void Page_Load(object sender, EventArgs e)
 {
     InvoiceDAO invAccess = new InvoiceDAO();
     DataSet dsInvoice = new DataSet();
     dsInvoice = invAccess.GetAllInvoicesAndDetailsForReporting();
     pgSalesSummary.DataSource = dsInvoice;
     pgSalesSummary.DataBind();
 }
    protected void dxgvReportsSalesDetails_BeforePerformDataSelect(object sender, EventArgs e)
    {
        try
        {
            if ((sender as ASPxGridView).GetMasterRowKeyValue() == null)
            {
                return;
            }
            Int64 ItemId = Int32.Parse((sender as ASPxGridView).GetMasterRowKeyValue().ToString());//ItemId
            DataSet ds = new InvoiceDAO().GetItemWiseInvoicesForReporting(ItemId,dtpFromDate.Date,dtpToDate.Date);
            (sender as ASPxGridView).DataSource = ds;

        }
        catch (Exception ex)
        {
            ex.Data.Add("UILayerException", this.GetType().ToString() + Constant.Error_Seperator + "protected void dxgvReportsSalesDetails_BeforePerformDataSelect(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);
        }
    }
Exemplo n.º 3
0
    protected void Page_Load(object sender, EventArgs e)
    {
        try
        {
            if (!IsPostBack)
            {
                Master.ClearSessions();//Clear all sessions
                DataSet dsSelectAllInv = new InvoiceDAO().GetInvoiceByRole(Master.LoggedUser.UserRoleID);
                dxgvInvoice.DataSource = dsSelectAllInv;
                dxgvInvoice.DataBind();
                Session["SearchInvoice"] = dsSelectAllInv;
            }
            if (IsCallback)
            {
                if (Session["SearchInvoice"] != null)
                {
                    dxgvInvoice.DataSource = (DataSet)Session["SearchInvoice"];
                    dxgvInvoice.DataBind();
                }
                else
                {
                    dxgvInvoice.DataSource = new InvoiceDAO().GetAllInvoices();
                    dxgvInvoice.DataBind();
                }
            }
        }
        catch (Exception ex)
        {
            ex.Data.Add("UILayerException", this.GetType().ToString() + Constant.Error_Seperator + "protected void Page_Load(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);

        }
    }
Exemplo n.º 4
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;
        }
    }
Exemplo n.º 5
0
    protected void ddlItemCode_SelectedIndexChanged(object sender, EventArgs e)
    {
        try
        {
            if (ddlItemCode.SelectedValue.Trim() != "-1" && ddlItemCode.SelectedValue.Trim() != "")
            {
                if (rblGRNType.SelectedItem.Value.Trim() == "1")//PO
                {
                    Item tmpItem = new Item();
                    tmpItem.ItemId = Int32.Parse(ddlItemCode.SelectedValue.Trim());
                    tmpItem.GetItemByID();
                    txtItemName.Text = tmpItem.ItemDescription.Trim();

                    DataSet dsItems = ObjGRNPO.GetAllPartialyReceivedPOItemsByPOID();
                    if (dsItems != null && dsItems.Tables[0].Rows.Count > 0)
                    {
                        DataView dvItems = dsItems.Tables[0].DefaultView;

                        dvItems.Sort = "ItemId";
                        DataRowView[] dr = dvItems.FindRows(tmpItem.ItemId.ToString());
                        if (dr.Length > 0)
                        {
                            hdnItemId.Value = dr[0]["ItemId"].ToString();
                            txtItemName.Text = dr[0]["ItemDescription"].ToString();
                            txtMaxRecievable.Text = dr[0]["TotalRemaining"].ToString();
                            hdnItemValue.Value = dr[0]["POItemCost"].ToString();
                            txtCost.Text = Decimal.Round(Convert.ToDecimal(dr[0]["POItemCost"].ToString()), 2).ToString();
                        }
                    }
                }
                else if (rblGRNType.SelectedItem.Value.Trim() == "2")//Invoice
                {
                    DataSet ds = new DataSet();
                    ds = new InvoiceDAO().GetInvoiceDetailsByInvoiceIDForReturns(ObjGRN.GRNInvoice);

                    if (ds != null && ds.Tables[0].Rows.Count > 0)
                    {

                        DataView dvItems = ds.Tables[0].DefaultView;
                        dvItems.Sort = "Id";
                        DataRowView[] dr = dvItems.FindRows(ddlItemCode.SelectedValue.Trim());
                        if (dr.Length>0)
                        {
                            hdnItemId.Value = dr[0]["Id"].ToString();
                            txtItemName.Text = dr[0]["ItemDescription"].ToString();
                            txtMaxRecievable.Text = dr[0]["ReturnQty"].ToString();//IssuedQTY - 30-09-2012 changed from ReturnQty to IssuedQTY
                            hdnItemValue.Value = dr[0]["Price"].ToString();
                            txtCost.Text = Math.Round(Convert.ToDecimal(dr[0]["Price"].ToString()), 2).ToString();
                        }
                    }
                }
            }
            else
            {
                ClearItemDetails();
            }
        }
        catch (Exception ex)
        {
            ex.Data.Add("UILayerException", this.GetType().ToString() + Constant.Error_Seperator + "protected void ddlItemCode_SelectedIndexChanged(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);

        }
    }