Пример #1
0
        private string PrepareXMLString()
        {
            string  strXMLString = "";
            int     SrlNo        = 1;
            string  ByTo         = "PAYMENT";
            decimal DRAmount     = 0;

            strXMLString = "<NewDataSet>";
            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)
                    {
                        strXMLString += "<TrnCashBankVoucherDetail";
                        strXMLString += " SrlNo = \"" + SrlNo.ToString() + "\"";
                        strXMLString += " ByTo = \"" + ByTo + "\"";
                        strXMLString += " LedgerID = \"" + dgvFeesHead.DataKeys[DGV.RowIndex].Values["AssestLedgerID_FK"].ToString() + "\"";
                        strXMLString += " DRAmount = \"" + DRAmount + "\"";
                        strXMLString += " CRAmount = \"" + Amount + "\"";
                        strXMLString += " />";
                        SrlNo        += 1;
                    }
                }
            }

            strXMLString += "</NewDataSet>";
            return(strXMLString);
        }
        private string PrepareXMLString()
        {
            string  strXMLString = "";
            int     SrlNo        = 1;
            decimal Amount       = 0;

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

                    if (Amount > 0)
                    {
                        strXMLString += "<TrnDebitNoteDetail";
                        strXMLString += " SrlNo = \"" + SrlNo.ToString() + "\"";
                        strXMLString += " PurchaseBillId_FK = \"" + dgvBill.DataKeys[DGV.RowIndex].Value.ToString() + "\"";
                        strXMLString += " Amount = \"" + Amount + "\"";
                        strXMLString += " />";
                        SrlNo        += 1;
                    }
                }
            }

            strXMLString += "</NewDataSet>";
            return(strXMLString);
        }
Пример #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;
        }