private string PrepareDistrictAmountXMLString()
        {
            DataTable dt = new DataTable();

            dt.Columns.Add("DistrictId", typeof(int));
            dt.Columns.Add("Amount", typeof(decimal));
            dt.AcceptChanges();
            DataRow DR;
            string  strXMLString;

            foreach (GridViewRow GVR in grdvwDistrict.Rows)
            {
                if (GVR.RowType == DataControlRowType.DataRow)
                {
                    TextBox txtAmount = (TextBox)GVR.FindControl("txtAmount");
                    if (txtAmount.Text.Length > 0)
                    {
                        DR = dt.NewRow();
                        DR["DistrictId"] = int.Parse(grdvwDistrict.DataKeys[GVR.RowIndex].Values[0].ToString());
                        DR["Amount"]     = (txtAmount.Text.Trim().Length > 0) ? Convert.ToDecimal(txtAmount.Text.Trim()) : 0;

                        dt.Rows.Add(DR);
                        dt.AcceptChanges();
                    }
                }
            }
            using (DataSet DS = new DataSet())
            {
                DS.Tables.Add(dt);
                strXMLString = DS.GetXml();
            }
            return(strXMLString);
        }
        protected void gvBalanceSheet_RowDataBound(object sender, GridViewRowEventArgs e)
        {
            foreach (GridViewRow GVR in gvBalanceSheet.Rows)
            {
                if (GVR.RowType == DataControlRowType.DataRow)
                {
                    Label lblamount1 = (Label)GVR.FindControl("lblamount1");
                    if (lblamount1.Text == "0.00")
                    {
                        lblamount1.Text = "";
                    }

                    Label lblamnt2 = (Label)GVR.FindControl("lblamnt2");
                    if (lblamnt2.Text == "0.00")
                    {
                        lblamnt2.Text = "";
                    }
                }
            }
        }
Example #3
0
 /// <summary>
 ///
 /// </summary>
 protected void HighlightSelectedRow()
 {
     if (this.GrdRegisters.Rows.Count > 0 && this.GrdRegisters.SelectedRow != null)
     {
         GridViewRow gvRow = this.GrdRegisters.SelectedRow;
         foreach (GridViewRow GVR in this.GrdRegisters.Rows)
         {
             if (GVR == gvRow)
             {
                 GVR.CssClass += " selectedrow";
                 if (ListRegisters[this.GrdRegisters.SelectedIndex + this.GrdRegisters.PageIndex * this.GrdRegisters.PageSize].chaRF != "1")
                 {
                     GVR.FindControl("pnlDetails").Visible = true;
                 }
             }
             else
             {
                 GVR.CssClass = GVR.CssClass.Replace(" selectedrow", "");
                 GVR.FindControl("pnlDetails").Visible = false;
             }
         }
     }
 }
Example #4
0
        protected void btnSave_Click(object sender, EventArgs e)
        {
            int count = 0;

            if (ddlMember.SelectedValue == "0" || ddlMember.Text == string.Empty)
            {
                Message.IsSuccess = false;
                Message.Text      = "Please Select a Member";
                Message.Show      = true;
            }
            else
            {
                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.StudentOpeningBal objOpeningBal = new BusinessLayer.Accounts.StudentOpeningBal();
                Entity.Accounts.StudentOpeningBal        OpBal         = new Entity.Accounts.StudentOpeningBal();

                OpBal.CompanyID_FK = Convert.ToInt32(Session["CompanyId"].ToString().Trim());
                OpBal.BranchID_FK  = Convert.ToInt32(Session["BranchId"].ToString().Trim());
                OpBal.FinYearID_FK = Convert.ToInt32(Session["FinYrID"].ToString().Trim());
                OpBal.StudentId    = Convert.ToInt32(ddlMember.SelectedValue.Trim());
                OpBal.BillAmount   = Convert.ToDecimal(txtTotalAmt.Text.Trim());
                OpBal.CreatedBy    = Convert.ToInt32(Session["UserId"].ToString().Trim());

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

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

                        if (Amount > 0)
                        {
                            count++;
                            DR = DT.NewRow();
                            DR["FeesHeadId"] = Convert.ToInt32(dgvFeesHead.DataKeys[GVR.RowIndex].Value.ToString());
                            DR["AmountDr"]   = (ddlDrCr.SelectedValue == "DR") ? Amount : 0;
                            DR["AmountCr"]   = (ddlDrCr.SelectedValue == "CR") ? Amount : 0;
                            DT.Rows.Add(DR);
                            DT.AcceptChanges();
                        }
                    }
                }

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

                if (ViewState["BillId"] != null && ViewState["BillId"].ToString().Length > 0)
                {
                    OpBal.BillId = int.Parse(ViewState["BillId"].ToString());
                    ViewState.Remove("BillId");
                }
                else
                {
                    OpBal.BillId = 0;
                }

                if (count > 0)
                {
                    int RecCount = objOpeningBal.SaveOpBal(OpBal);
                    if (RecCount > 0)
                    {
                        Message.IsSuccess = true;
                        Message.Text      = "Opening Balance Created Successfully";
                    }
                    else
                    {
                        Message.IsSuccess = false;
                        Message.Text      = "Opening Balance Allready Created";
                    }
                }
                else
                {
                    Message.IsSuccess = false;
                    Message.Text      = "Please Enter Amount for Atleast One Head";
                }
                //}
                //else
                //{
                //    Message.IsSuccess = false;
                //    Message.Text = "Please select a Date Between " + Session["SesFromDate"].ToString() + " & " + Session["SesToDate"].ToString();
                //}

                Message.Show = true;
            }
        }
Example #5
0
        protected void lbtnAction1_Click(object sender, EventArgs e)//Summary Section
        {
            GridViewRow GVR;

            if (sender is GridView)
            {
                GVR = ((GridView)sender).Rows[SeletedRowIndex];
            }
            else
            {
                GVR = (GridViewRow)((LinkButton)sender).NamingContainer;
            }

            Label lblBeingEdited = (Label)GVR.FindControl("lblBeingEdited");

            int InCount          = Convert.ToInt32(GVR.Cells[7].Text);
            int batchID          = Convert.ToInt32(GVR.Cells[0].Text);
            int countBeingEdited = 0;

            if (!test)
            {
                if (gvSummary.HeaderRow.Cells[7].Text.ToLower() == "in progress")
                {
                    countBeingEdited = Convert.ToInt32(lblBeingEdited.Text);
                }

                if (countBeingEdited > 0 && !UserName.Contains("P2D"))
                {
                    this.ClientScript.RegisterStartupScript(this.GetType(), "_msg", "alert('Sorry, you cannot access batches currently being processed.')", true);
                    return;
                }
            }
            else
            {
                countBeingEdited = Convert.ToInt32(lblBeingEdited.Text);

                if (countBeingEdited > 0)
                {
                    this.ClientScript.RegisterStartupScript(this.GetType(), "_msg", "alert('Sorry, you cannot access batches currently being processed.')", true);
                    return;
                }
            }

            if (InCount <= 0)
            {
                this.ClientScript.RegisterStartupScript(this.GetType(), "_msg", "alert('Batch complete. Please load another batch.')", true);
            }
            else
            {
                /*g.If the batch is accessed from the details page then the window should close after processing only
                 * that batch, and not move onto the next batch in the list. Thus SetbatchIDLilst is disabled. */
                //SetBatchIDLilst(GVR);
                SetSingleRowTableSession();

                if (Session["IsSingleBatch"] != null)
                {
                    Session.Remove("IsSingleBatch");
                }

                Session["IsSingleBatch"] = true;//is this single batch only?

                if (Session["IsSingleDoc"] != null)
                {
                    Session.Remove("IsSingleDoc");
                }

                Session["IsSingleDoc"] = false;                      //is this single invoice only?

                int docID = ReturnFirstAvailableDocumentID(batchID); //Convert.ToInt32(gvDetails.Rows[0].Cells[0].Text);

                if (docID > 0)
                {
                    int comID = Convert.ToInt32(Request.QueryString["id"]);

                    string url = "ActionWindow.aspx?cid=" + comID + "&did=" + docID;

                    //Response.Redirect(url, true);

                    string browser = ReturnBrowser();
                    this.ClientScript.RegisterStartupScript(this.GetType(), "_popUP", "PopupPage('" + url + "', screen.width, screen.height, '" + browser + "');", true);
                }
                else
                {
                    this.ClientScript.RegisterStartupScript(this.GetType(), "_msg", "alert('No document is available to Action.')", true);
                }
            }
        }
        protected void btnSave_Click(object sender, EventArgs e)
        {
            if (Validate())
            {
                string strValues = txtPaymentDate.Text;
                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.PurchaseBillPayment ObjPayment = new BusinessLayer.Accounts.PurchaseBillPayment();
                    Entity.Accounts.PurchaseBillPayment        Payment    = new Entity.Accounts.PurchaseBillPayment();
                    Payment.PurchaseBillPaymentId = 0;
                    Payment.SupplierLedgerId_FK   = Convert.ToInt32(ddlSupplierLedger.SelectedValue.Trim());
                    Payment.CashBankLedgerID      = Convert.ToInt32(ddlCashBankLedger.SelectedValue.Trim());
                    Payment.TransactionType       = "PAYMENT";
                    Payment.AmountPaid            = Convert.ToDecimal(txtTotalAmt.Text.Trim());
                    Payment.AmountDeducted        = Convert.ToDecimal(txtTotalDeductionAmt.Text.Trim());
                    Payment.PaymentDate           = Convert.ToDateTime(txtPaymentDate.Text.Trim() + " 00:00:00");
                    Payment.ModeOfPayment         = ddlPaymentMode.SelectedValue.Trim();
                    Payment.ChequeNo = txtChequeNo.Text.Trim();

                    if (txtChequeDate.Text.Trim().Length == 0)
                    {
                        Payment.ChequeDate = null;
                    }
                    else
                    {
                        Payment.ChequeDate = Convert.ToDateTime(txtChequeDate.Text.Trim() + " 00:00:00");
                    }

                    Payment.DrawnOn   = txtDrawnOn.Text.Trim();
                    Payment.CreatedBy = Convert.ToInt32(HttpContext.Current.User.Identity.Name);
                    Payment.CompanyId = Convert.ToInt32(Session["CompanyId"].ToString());
                    Payment.BranchId  = Convert.ToInt32(Session["BranchId"].ToString());
                    Payment.FinYrId   = Convert.ToInt32(Session["FinYrID"].ToString());
                    Payment.Narration = txtNarration.Text.Trim();

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

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

                            if (Amount > 0)
                            {
                                DR = DT.NewRow();
                                DR["PurchaseBillId"] = Convert.ToInt32(dgvBill.DataKeys[GVR.RowIndex].Value.ToString());
                                DR["Amount"]         = Amount;
                                DT.Rows.Add(DR);
                                DT.AcceptChanges();
                            }
                        }
                    }

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


                    //---------------------------------------------------------------------------//
                    string DeductionDetails = "";

                    if (ViewState["DeductionDetails"] != null)
                    {
                        DT = (DataTable)ViewState["DeductionDetails"];
                        DT.Columns.Remove("DeductionHead");
                        DT.AcceptChanges();

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

                    Payment.DeductionDetailsXML       = DeductionDetails;
                    Payment.XMLCashBankVoucherDetails = PrepareXMLString();
                    ObjPayment.Save(Payment);
                    ClearControls();

                    Message.IsSuccess = true;
                    Message.Text      = "Payment Saved Successfully";
                    btnPrint.Attributes.Add("onclick", "javascript:window.open('RPTGridView.aspx?ID=" + Payment.CBVHeaderID + "'); return false;");
                }
                else
                {
                    Message.IsSuccess = false;
                    Message.Text      = "Please select a Date Between " + Session["SesFromDate"].ToString() + " & " + Session["SesToDate"].ToString() + "";
                }
            }
            Message.Show = true;
        }