Пример #1
0
    protected void rdAmtType_SelectedIndexChanged(object sender, EventArgs e)
    {
        try
        {
            if (rdAmtType.SelectedValue == "0")
            {
                if (Convert.ToInt32(ddlLedgerNameTO.SelectedValue) > 0)
                {
                    txtNarration.Text = "Ref:";
                    txtNarration.Focus();

                    Ds = Obj_Call.GetoutStanding(Convert.ToInt32(ddlLedgerNameTO.SelectedValue), out StrError);

                    if (Ds.Tables.Count > 0 && Ds.Tables[0].Rows.Count > 0)
                    {
                        GridInvoice.DataSource = Ds.Tables[0];
                        GridInvoice.DataBind();
                        GridInvoice.Visible = true;
                    }
                    else
                    {
                        CommFun.ShowPopUpMsg("There is no invoice for selected supplier", this.Page);
                        for (int i = 0; i < rdAmtType.Items.Count; i++)
                        {
                            rdAmtType.Items[i].Selected = false;
                        }
                        rdAmtType.Focus();
                        GridInvoice.Visible = false;
                    }
                }
                else
                {
                    txtNarration.Text = "Ref:";
                    txtNarration.Focus();
                }
            }
            if (rdAmtType.SelectedValue == "1")
            {
                txtNarration.Text = "On Account:";
                txtNarration.Focus();
                MakeControlEmpty();
            }
            if (rdAmtType.SelectedValue == "2")
            {
                txtNarration.Text = "Advance:";
                txtNarration.Focus();
                MakeControlEmpty();
            }
        }
        catch (Exception ex)
        {
            CommFun.ShowPopUpMsg(ex.Message, this.Page);
        }
    }
Пример #2
0
    private void SetInitialRow()
    {
        try
        {
            DataTable dt = new DataTable();
            DataRow   dr = null;

            dt.Columns.Add(new DataColumn("InvoiceId", typeof(int)));
            dt.Columns.Add(new DataColumn("InvoiceNo", typeof(string)));
            dt.Columns.Add(new DataColumn("InvoiceAmt", typeof(decimal)));
            dt.Columns.Add(new DataColumn("Outstanding", typeof(decimal)));
            dt.Columns.Add(new DataColumn("ReceivedAmt", typeof(decimal)));
            dt.Columns.Add(new DataColumn("OutstandingSample", typeof(decimal)));
            dt.Columns.Add(new DataColumn("ReceivedAmtSample", typeof(decimal)));


            dr = dt.NewRow();

            dr["InvoiceId"] = 0;
            dr["InvoiceNo"] = "";

            dr["InvoiceAmt"]        = 0;
            dr["Outstanding"]       = 0;
            dr["ReceivedAmt"]       = 0;
            dr["OutstandingSample"] = 0;
            dr["ReceivedAmtSample"] = 0;


            dt.Rows.Add(dr);

            ViewState["CurrentTable"] = dt;
            GridInvoice.DataSource    = dt;
            GridInvoice.DataBind();

            dt = null;
            dr = null;
        }
        catch (Exception ex)
        {
            throw new Exception(ex.Message);
        }
    }
Пример #3
0
 private void MakeControlEmpty()
 {
     GridInvoice.Visible    = false;
     GridInvoice.DataSource = null;
     GridInvoice.DataBind();
 }
Пример #4
0
    protected void ddlLedgerNameTO_SelectedIndexChanged(object sender, EventArgs e)
    {
        try
        {
            string ToDate        = string.Empty;
            string FromDate      = string.Empty;
            int    LedgerGroupId = 0;
            lblOutstandingName.Visible = true;

            StrCondition = StrCondition + "AND (CAST(FLOOR(CAST(VoucherDate as FLOAT)) AS DateTime))<= '" + Convert.ToDateTime(DateTime.Now).ToString("MM-dd-yyyy") + "'";
            Ds           = obj_Ledger.GetdetailsLedgerIdOther1n2(Convert.ToInt32(ddlLedgerNameTO.SelectedValue), StrCondition, out StrError);

            if (Ds.Tables.Count > 0 && Ds.Tables[0].Rows.Count > 0)
            {
                Debit   = Convert.ToDecimal(Ds.Tables[0].Rows[0]["Debit"].ToString());
                Credit  = Convert.ToDecimal(Ds.Tables[0].Rows[0]["Credit"].ToString());
                Balance = Debit - Credit;
                if (Balance < 0)
                {
                    Balance = Math.Abs(Balance);
                    //lblOutstandingName.Text = "OutStanding Limit: " + Outstanding.ToString("0.00") + " OutStanding Balance: " + Balance.ToString("0.00") + " CR";
                    lblOutstandingName.Text = " OutStanding Balance: " + Balance.ToString("0.00") + " CR";
                }
                else
                {
                    //lblOutstandingName.Text = "OutStanding Limit: " + Outstanding.ToString("0.00") + " OutStanding Balance: " + Balance.ToString("0.00") + " DR";
                    lblOutstandingName.Text = " OutStanding Balance: " + Balance.ToString("0.00") + " DR";
                }
            }

            if (rdAmtType.SelectedValue == "0")
            {
                if (Convert.ToInt32(ddlLedgerNameTO.SelectedValue) > 0)
                {
                    Ds = Obj_Call.GetoutStanding(Convert.ToInt32(ddlLedgerNameTO.SelectedValue), out StrError);

                    if (Ds.Tables.Count > 0 && Ds.Tables[0].Rows.Count > 0)
                    {
                        GridInvoice.DataSource = Ds.Tables[0];
                        GridInvoice.DataBind();
                        GridInvoice.Visible = true;
                    }
                    else
                    {
                        CommFun.ShowPopUpMsg("There is no invoice for selected supplier", this.Page);
                        for (int i = 0; i < rdAmtType.Items.Count; i++)
                        {
                            rdAmtType.Items[i].Selected = false;
                        }
                        rdAmtType.Focus();
                    }
                }
            }
            if (rdAmtType.SelectedValue == "1")
            {
                txtNarration.Text = "On Account:";
                txtNarration.Focus();
                MakeControlEmpty();
            }
            if (rdAmtType.SelectedValue == "2")
            {
                txtNarration.Text = "Advance:";
                txtNarration.Focus();
                MakeControlEmpty();
            }
        }
        catch (Exception ex)
        {
            CommFun.ShowPopUpMsg(ex.Message, this.Page);
        }
    }
Пример #5
0
    private void GetEditRecordList()
    {
        if (Ds.Tables.Count > 0 && Ds.Tables[0].Rows.Count > 0)
        {
            txtDate.Text                  = Convert.ToDateTime(Convert.ToDateTime(Ds.Tables[0].Rows[0]["VoucherDate"]).ToShortDateString()).ToString("dd-MMM-yyy");
            txtVoucherNo.Text             = Ds.Tables[0].Rows[0]["VoucherNo"].ToString();
            ddlLedgerNameTO.SelectedValue = Ds.Tables[0].Rows[0]["VoucherDebit"].ToString();
            ddlLedgerNameFrom.Text        = Ds.Tables[0].Rows[0]["VoucherCredit"].ToString();
            txtCrAmt.Text                 = Ds.Tables[0].Rows[0]["VoucherAmount"].ToString();
            txtDrAmt.Text                 = Ds.Tables[0].Rows[0]["VoucherAmount"].ToString();
            txtNarration.Text             = Ds.Tables[0].Rows[0]["Narration"].ToString();
            TxtTotalCredit.Text           = Ds.Tables[0].Rows[0]["VoucherAmount"].ToString();
            TxtTotalDebit.Text            = Ds.Tables[0].Rows[0]["VoucherAmount"].ToString();
            TxtSearch.Text                = string.Empty;

            AmtInWrd();
            ViewState["Name"]   = ddlLedgerNameTO.SelectedItem.Text;
            ViewState["Amount"] = txtCrAmt.Text;
            ViewState["Date"]   = txtDate.Text;

            string str = Ds.Tables[0].Rows[0]["Narration"].ToString();
            if (str.StartsWith("Ref:"))
            {
                rdAmtType.SelectedValue = "0";
            }
            if (str.StartsWith("On Account:"))
            {
                rdAmtType.SelectedValue = "1";
            }
            if (str.StartsWith("Advance:"))
            {
                rdAmtType.SelectedValue = "2";
            }
            if (Convert.ToBoolean(Ds.Tables[0].Rows[0]["IsReference"]) == true)
            {
                GridInvoice.Visible = true;
                if (Ds.Tables[1].Rows.Count > 0)
                {
                    GridInvoice.DataSource = Ds.Tables[1];
                    GridInvoice.DataBind();
                    ViewState["CurrentTable"] = Ds.Tables[1];
                }
            }
            else
            {
                GridInvoice.Visible = false;
            }

            lblOutstandingName.Visible = true;
            StrCondition = StrCondition + "AND (CAST(FLOOR(CAST(VoucherDate as FLOAT)) AS DateTime))<= '" + Convert.ToDateTime(DateTime.Now).ToString("MM-dd-yyyy") + "'";
            Ds           = obj_Ledger.GetdetailsLedgerIdOther1n2(Convert.ToInt32(ddlLedgerNameTO.SelectedValue), StrCondition, out StrError);

            if (Ds.Tables.Count > 0 && Ds.Tables[0].Rows.Count > 0)
            {
                Debit   = Convert.ToDecimal(Ds.Tables[0].Rows[0]["Debit"].ToString());
                Credit  = Convert.ToDecimal(Ds.Tables[0].Rows[0]["Credit"].ToString());
                Balance = Debit - Credit;
                if (Balance < 0)
                {
                    Balance = Math.Abs(Balance);
                    //lblOutstandingName.Text = "OutStanding Limit: " + Outstanding.ToString("0.00") + " OutStanding Balance: " + Balance.ToString("0.00") + " CR";
                    lblOutstandingName.Text = " OutStanding Balance: " + Balance.ToString("0.00") + " CR";
                }
                else
                {
                    //lblOutstandingName.Text = "OutStanding Limit: " + Outstanding.ToString("0.00") + " OutStanding Balance: " + Balance.ToString("0.00") + " DR";
                    lblOutstandingName.Text = " OutStanding Balance: " + Balance.ToString("0.00") + " DR";
                }
            }
            else
            {
                GridInvoice.Visible = false;
            }
            rdAmtType.Enabled = false;
        }
        else
        {
            MakeEmptyForm();
        }
        if (!FlagEdit)
        {
            BtnUpdate.Visible = true;
        }


        BtnSave.Visible   = false;
        BtnCancel.Visible = true;
    }
Пример #6
0
        protected void Page_Load(object sender, EventArgs e)
        {
            //con.Open();
            //String pass = "******";
            //Random r = new Random();
            //char[] mypass = new char[10];
            //for (int i = 0; i < 10; i++)
            //{
            //    mypass[i] = pass[(int)(35 * r.NextDouble())];

            //}
            //String orderid;
            //orderid = "Order" + new string(mypass);

            lblOrderId.Text = Session["orderid"].ToString();


            lblOrderDate.Text = Session["orderdate"].ToString();;


            if (Session["fittingitems"] == null)
            {
                DataTable dt = new DataTable();
                dt = (DataTable)Session["buyitems"];
                GridInvoice.DataSource = dt;
                GridInvoice.DataBind();
                GridInvoice.FooterRow.Cells[0].Text = "Total Amount";
                GridInvoice.FooterRow.Cells[1].Text = cartgrandtotal().ToString();
                con.Close();
            }
            else
            {
                DataTable dt1 = new DataTable();
                dt1 = (DataTable)Session["fittingitems"];
                FittingInvoice.DataSource = dt1;
                FittingInvoice.DataBind();
                FittingInvoice.FooterRow.Cells[0].Text = "Total Amount";
                FittingInvoice.FooterRow.Cells[1].Text = grandtotal().ToString();
                con.Close();
            }



            if (Session["buyitems"] == null)
            {
                DataTable dt1 = new DataTable();
                dt1 = (DataTable)Session["fittingitems"];
                FittingInvoice.DataSource = dt1;
                FittingInvoice.DataBind();
                FittingInvoice.FooterRow.Cells[0].Text = "Total Amount";
                FittingInvoice.FooterRow.Cells[1].Text = grandtotal().ToString();
                con.Close();
            }
            else
            {
                DataTable dt = new DataTable();
                dt = (DataTable)Session["buyitems"];
                GridInvoice.DataSource = dt;
                GridInvoice.DataBind();
                GridInvoice.FooterRow.Cells[0].Text = "Total Amount";
                GridInvoice.FooterRow.Cells[1].Text = cartgrandtotal().ToString();
                con.Close();
            }
        }