Esempio n. 1
0
        protected void btnSearch_Click(object sender, EventArgs e)
        {
            if (Session["State"].ToString() == "0")
            {
                if (ddlMember.SelectedValue != "0" && ddlMember.Text != string.Empty)
                {
                    BusinessLayer.Accounts.StudentFeesCollection ObjFees = new BusinessLayer.Accounts.StudentFeesCollection();
                    int MemberId = Convert.ToInt32(ddlMember.SelectedValue.Trim());

                    DataSet ds = ObjFees.GetStudentUnpaidTrans(MemberId, Convert.ToInt32(Session["FinYrID"].ToString()));
                    //if (ds.Tables[0].Rows.Count > 0)
                    //    ImgPhoto.ImageUrl = "../Student/" + ds.Tables[0].Rows[0]["Photo"].ToString();


                    dgvFeesHead.DataSource = ds.Tables[1];
                    dgvFeesHead.DataBind();

                    Message.Show = false;
                    rowCnt       = dgvFeesHead.Rows.Count;
                    dgvFeesHead.Focus();
                }
                else
                {
                    Message.IsSuccess = false;
                    Message.Text      = "Please Select Member";
                    Message.Show      = true;
                }
            }
        }
        protected void gvCBVView_RowDeleting(object sender, GridViewDeleteEventArgs e)
        {
            BusinessLayer.Accounts.StudentFeesCollection objSfc = new BusinessLayer.Accounts.StudentFeesCollection();
            int headerId = int.Parse(gvCBVView.DataKeys[e.RowIndex].Value.ToString());

            objSfc.DeleteCVB(headerId);
            //****************
            PopulateHeaderGrid(ViewState["sortColumn"].ToString(), ViewState["sortDirection"].ToString());
        }
Esempio n. 3
0
        protected void btnSave_Click(object sender, EventArgs e)
        {
            if (Validate())
            {
                string strValues = DateTime.Now.ToString("dd MMM yyyy");
                strValues += chr.ToString() + "";
                DataSet ds_fn = gf.ExecuteSelectSP("spSelect_GetFnYear", strValues);

                //if (ds_fn.Tables[0].Rows[0]["FinYearID"].ToString() == Session["FinYrID"].ToString().Trim())
                //{
                BusinessLayer.Accounts.StudentFeesCollection ObjFees = new BusinessLayer.Accounts.StudentFeesCollection();
                Entity.Accounts.StudentFeesCollection        Fees    = new Entity.Accounts.StudentFeesCollection();
                Fees.PaymentId = 0; //Always Save
                Fees.StudentId = Convert.ToInt32(ddlMember.SelectedValue.Trim());
                //Fees.SemNo = Convert.ToInt32(ddlSemester.SelectedValue.Trim());
                Fees.Amount           = Convert.ToDecimal(txtTotalAmt.Text.Trim());
                Fees.PaymentDate      = Convert.ToDateTime(txtVoucherDate.Text.Trim() + " 00:00:00");
                Fees.CashBankLedgerID = Convert.ToInt32(ddlCashBankLedger.SelectedValue.Trim());
                Fees.TransactionType  = "RECEIVE";
                Fees.ModeOfPayment    = ddlReceiptMode.SelectedValue.Trim();
                Fees.ChequeNo         = txtChequeNo.Text.Trim();

                if (txtChequeDate.Text.Trim().Length == 0)
                {
                    Fees.ChequeDate = null;
                }
                else
                {
                    Fees.ChequeDate = Convert.ToDateTime(txtChequeDate.Text.Trim());
                }

                Fees.DrawnOn        = txtDrawnOn.Text.Trim();
                Fees.CreatedBy      = int.Parse(HttpContext.Current.User.Identity.Name);
                Fees.CompanyId      = int.Parse(Session["CompanyId"].ToString());
                Fees.BranchId       = int.Parse(Session["BranchId"].ToString());
                Fees.FinYrId        = int.Parse(Session["FinYrID"].ToString());
                Fees.FeesBookNumber = txtFeesBookNo.Text.Trim();
                Fees.Narration      = txtNarration.Text.Trim();

                DataTable DT = new DataTable();
                DT.Columns.Add("FeesHeadId", typeof(int));
                DT.Columns.Add("Amount", typeof(decimal));
                DataRow DR;

                foreach (GridViewRow DGV in dgvFeesHead.Rows)
                {
                    if (DGV.RowType == DataControlRowType.DataRow)
                    {
                        TextBox txtAmount = (TextBox)DGV.FindControl("txtAmount");
                        decimal Amount    = (txtAmount.Text.Trim().Length > 0) ? Convert.ToDecimal(txtAmount.Text.Trim()) : 0;

                        if (Amount > 0)
                        {
                            DR = DT.NewRow();
                            DR["FeesHeadId"] = Convert.ToInt32(dgvFeesHead.DataKeys[DGV.RowIndex].Values["id"].ToString());
                            DR["Amount"]     = Amount;
                            DT.Rows.Add(DR);
                            DT.AcceptChanges();
                        }
                    }
                }

                using (DataSet ds = new DataSet())
                {
                    ds.Tables.Add(DT);
                    Fees.PaymentDetailsXML = ds.GetXml().Replace("Table1>", "Table>");
                }

                Fees.XMLCashBankVoucherDetails = PrepareXMLString();
                Fees.IsRefund = false;

                ObjFees.Save(Fees);
                Fees = ObjFees.GetAllById(Fees.PaymentId);
                btnSearch_Click(sender, e);
                GetLedgerBalance();
                txtVoucherDate.Text = DateTime.Now.ToString("dd MMM yyyy");
                txtTotalAmt.Text    = "0.00";

                Message.IsSuccess = true;
                Message.Text      = "Money Receipt No " + Fees.MoneyReceiptNo + " is generated. You can take print out now";
                txtReceiptNo.Text = Fees.MoneyReceiptNo;
                //-----------------------------------------------------------Add On 08-08-2013
                btnPrint.Attributes.Add("onclick", "javascript:openPopup('MoneyReceipt.aspx?id=" + Fees.PaymentId + "&refund=0'); return false;");
                //if (txtReceiptNo.Text.ToString().Substring(4, 4) == "ENGG")
                //{
                //    btnPrint.Attributes.Add("onclick", "javascript:openPopup('MoneyReceipt.aspx?id=" + Fees.PaymentId + "&refund=0'); return false;");
                //}
                //else if (txtReceiptNo.Text.Substring(4, 4) == "DEPL")
                //{
                //    btnPrint.Attributes.Add("onclick", "javascript:openPopup('MoneyReceiptDiploma.aspx?id=" + Fees.PaymentId + "&refund=0'); return false;");
                //}
                //else
                //{
                //    btnPrint.Attributes.Add("onclick", "javascript:openPopup('MoneyReceiptMgmnt.aspx?id=" + Fees.PaymentId + "&refund=0'); return false;");
                //}
                //------------------------------------------------------------
                //-------------------------CLEAR PAGE---------------------Add on 14-08-2013
                txtReceiptNo.Text            = "Auto Generated";
                txtVoucherDate.Text          = DateTime.Now.ToString("dd MMM yyyy");
                txtChequeNo.Text             = "";
                txtDrawnOn.Text              = "";
                txtChequeDate.Text           = "";
                ltrLedgerBalance.Text        = "";
                txtNarration.Text            = "";
                ddlReceiptMode.SelectedIndex = 0;

                txtChequeNo.Enabled   = false;
                txtDrawnOn.Enabled    = false;
                txtChequeDate.Enabled = false;

                dgvFeesHead.DataSource = null;
                dgvFeesHead.DataBind();
                Session["State"] = 0;
                //PopulateDropDownLists();
                LoadCashBankLedger();
                txtTotalAmt.Text   = "0.00";
                txtFeesBookNo.Text = string.Empty;
                //--------------------------------------------------------

                //}
                //else
                //{
                //    Message.IsSuccess = false;
                //    Message.Text = "Please select a Date Between " + Session["SesFromDate"].ToString() + " & " + Session["SesToDate"].ToString() + "";
                //}
            }
            Message.Show = true;
        }